Ver código fonte

接口联调

lgh 1 ano atrás
pai
commit
2820ec8605

+ 0 - 10
apis/login.js

@@ -1,10 +0,0 @@
-import request from "@/request"
-import config from "@/config"
-
-// 获取用户信息
-export const getUserInfo = (data) => {
-	return request.get({
-		url: '/apiCustomer/giftCardUser/getUserInfo',
-		data: data
-	})
-}

+ 29 - 0
apis/main.js

@@ -0,0 +1,29 @@
+import request from "@/request"
+import config from "@/config"
+
+
+// 游戏币套餐列表
+export const packagePage = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/packagePage',
+		data: data
+	})
+}
+
+// 获取套餐详情 参数id即套餐id
+export const getPackageDetail = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/getPackageDetail',
+		data: data
+	})
+}
+
+// 获取订单列表
+export const getOrderPage = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/getOrderPage',
+		data: data
+	})
+}
+
+

+ 18 - 0
apis/news.js

@@ -0,0 +1,18 @@
+import request from "@/request"
+import config from "@/config"
+
+// 用户端消息列表
+export const msgPage = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/msgPage',
+		data: data
+	})
+}
+
+// 获取信息详情
+export const getMsgDetail = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/getMsgDetail',
+		data: data
+	})
+}

+ 18 - 0
apis/statistic.js

@@ -0,0 +1,18 @@
+import request from "@/request"
+import config from "@/config"
+
+// 获取统计信息
+export const statistics = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/statistics',
+		data: data
+	})
+}
+
+// 获取分销商相关配置 如等级规则等
+export const getConfig = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/getConfig',
+		data: data
+	})
+}

+ 25 - 0
apis/user.js

@@ -0,0 +1,25 @@
+import request from "@/request"
+import config from "@/config"
+
+// 获取用户信息
+export const getUserInfo = (data) => {
+	return request.get({
+		url: '/increase/agent/customer/getUserInfo',
+		data: data
+	})
+}
+
+// 登录
+export const login = (data) => {
+	return request.post({
+		url: '/increase/agent/customer/login',
+		data: data
+	})
+}
+// 登录
+export const sendCode = (data) => {
+	return request.post({
+		url: '/increase/agent/customer/sendCode',
+		data: data
+	})
+}

+ 1 - 1
config/default.js

@@ -1,4 +1,4 @@
 module.exports = {
 	ossImgUrl: 'https://obs-fanxing.obs.cn-east-3.myhuaweicloud.com', // oss图片域名地址
-	agreeUrl: 'http://debugseafood.mashangyl.com' // 用户协议、隐私政策url
+	// agreeUrl: 'http://debugseafood.mashangyl.com' // 用户协议、隐私政策url
 }

+ 2 - 2
config/index.js

@@ -4,7 +4,7 @@ const defaults = require("./default.js")
 const dev = require("./modules/dev.js")
 const test = require("./modules/test.js")
 const prod = require("./modules/prod.js")
-const pre = require("./modules/pre.js")
+// const pre = require("./modules/pre.js")
 const mock = require("./modules/mock.js")
 const debug = require("./modules/debug.js")
 const ENV = platform() === 'APP-PLUS' ? 'app' : getEnv()
@@ -19,7 +19,7 @@ const BASE = {
 	// 测试
 	test,
 	// 预发布
-	pre,
+	// pre,
 	// mock环境
 	mock,
 	// 开发环境

+ 1 - 1
config/modules/debug.js

@@ -1,6 +1,6 @@
 module.exports = {
 	env: 'debug',
-	baseUrl: 'http://debugseafood.mashangyl.com',
+	baseUrl: 'http://debugapi.mstardance.com',
 	buyerMock: '/', // 买家mock  /mock/23/
 	sellerMock: '/', // 卖家mock  /mock/25/
 	appid: 'wxd51ce33b1119f45d'

+ 1 - 1
config/modules/dev.js

@@ -1,6 +1,6 @@
 module.exports = {
 	env: 'dev',
-	baseUrl: 'http://debugseafood.mashangyl.com',
+	baseUrl: 'http://debugapi.mstardance.com',
 	buyerMock: '/', // 买家mock  /mock/23/
 	sellerMock: '/', // 卖家mock  /mock/25/
 	appid: 'wxd51ce33b1119f45d'

+ 0 - 7
config/modules/pre.js

@@ -1,7 +0,0 @@
-module.exports = {
-	env: 'pre',
-	baseUrl: 'http://preseafood.mashangyl.com',
-	buyerMock: '/', // 买家mock  /mock/23/
-	sellerMock: '/', // 卖家mock  /mock/25/
-	appid: 'wxd51ce33b1119f45d'
-}

+ 1 - 1
config/modules/prod.js

@@ -1,6 +1,6 @@
 module.exports = {
 	env: 'prod',
-	baseUrl: 'http://seafood.boxingyu.com',
+	baseUrl: 'http://api.mstardance.com',
 	buyerMock: '/', // 买家mock  /mock/23/
 	sellerMock: '/', // 卖家mock  /mock/25/
 	appid: 'wxfabdf96c0fafc5b6'

+ 1 - 1
main.js

@@ -4,7 +4,7 @@ import App from './App'
 import Vue from 'vue'
 import store from '@/store'
 import uView from '@/plugins/uview-ui'
-// import '@/utils/preCheck.js'
+import '@/utils/preCheck.js'
 import '@/utils/prototype.js'
 import platform from "@/utils/platform" // 平台判断方法
 import getEnv from "@/utils/env" // 获取环境变量

+ 0 - 20
package.json

@@ -1,16 +1,6 @@
 {
 	"uni-app": {
 		"scripts": {
-			"mp-h5-mock": {
-				"title": "h5-mock",
-				"browser": "chrome",
-				"env": {
-					"UNI_PLATFORM": "h5"
-				},
-				"define": {
-					"MOCK": true
-				}
-			},
 			"mp-h5-debug": {
 				"title": "h5-debug",
 				"browser": "chrome",
@@ -41,16 +31,6 @@
 					"TEST": true
 				}
 			},
-			"mp-h5-pre": {
-				"title": "h5-pre",
-				"browser": "chrome",
-				"env": {
-					"UNI_PLATFORM": "h5"
-				},
-				"define": {
-					"PRE": true
-				}
-			},
 			"mp-h5-prod": {
 				"title": "h5-prod",
 				"browser": "chrome",

+ 13 - 3
pages/accountRecharge/index.vue

@@ -2,7 +2,7 @@
     <view class="account">
         <view class="search flex aic">
             <u-search placeholder="请输入充值账户" searchIconColor="#2A200A" placeholderColor="#959AA3" bgColor="#F2F3F7" v-model="searchValue" :showAction="false" maxlength="30" height="60rpx" @search="searchMobile"></u-search>
-            <view class="date flex aic">
+            <view class="date flex aic" @click="show = true">
                 <text>日期</text>
                 <re-icon name="icon-xiala" :customStyle="{ fontSize: '10rpx',marginLeft:'10rpx'}"></re-icon>
             </view>
@@ -28,21 +28,31 @@
                 <no-data :statusType="2" :top="0" tipsText="暂无数据"></no-data>
             </mescroll-body>
         </view>
+        <u-datetime-picker ref="datetimePicker" closeOnClickOverlay :show="show" v-model="value" mode="date" @confirm="confirm" @close="show = false" @cancel="show = false"></u-datetime-picker>
     </view>
 </template>
 <script>
 import MescrollMixin from "@/plugins/mescroll/components/mescroll-uni/mescroll-mixins.js"
 import MescrollBody from '@/plugins/mescroll/components/mescroll-uni/mescroll-uni.vue'
 export default {
-    components:{
+    components: {
         MescrollBody
     },
     data(){
         return{
-            searchValue:''
+            show:false,
+            searchValue:'',
+            value: Number(new Date())
         }
     },
     mixins: [MescrollMixin],
+    methods: {
+        confirm(e) {
+            console.log('confirm', e)
+            this.show = false
+            this.date = e.value[0].label
+        }
+    },
 
 }
 </script>

+ 19 - 7
pages/gallery/index.vue

@@ -19,15 +19,15 @@
 				</view>
 				<view class="news-total flex jcsa">
 					<view class="total-item">
-						<view class="item-num">156</view>
+						<view class="item-num">{{sumPayNum || 0}}</view>
 						<view class="item-text">总销订单</view>
 					</view>
 					<view class="total-item">
-						<view class="item-num">156</view>
+						<view class="item-num">{{sumGameCurrency || 0}}</view>
 						<view class="item-text">总销游戏币</view>
 					</view>
 					<view class="total-item">
-						<view class="item-num orange">¥156</view>
+						<view class="item-num orange">¥{{sumIncome || 0}}</view>
 						<view class="item-text">预估总收益</view>
 					</view>
 				</view>
@@ -99,7 +99,7 @@
 		toRpx
 	} from '@/utils/calculate.js'
 	import defaultConfig from '@/config/default.js'
-
+	import { statistics,packagePage } from '@/apis/main'
 	export default {
 		components: {},
 		computed: {
@@ -111,7 +111,11 @@
 			return {
 				bannerImage: defaultConfig.ossImgUrl + '/retail/main/img_bgtop.png',
 				title: 'Hello',
-				navBarHeight: uni.getStorageSync('navBarHeight')
+				navBarHeight: uni.getStorageSync('navBarHeight'),
+				sumPayNum: uni.getStorageSync('sumPayNum'),// 总销订单
+				sumGameCurrency: uni.getStorageSync('sumGameCurrency'),// 总销游戏币
+				sumIncome: uni.getStorageSync('sumIncome'),//预估总收益,
+				list:[],
 			}
 		},
 		onLoad() {
@@ -123,10 +127,18 @@
 				uni.navigateTo({
 					url: '/pages/mall/mallRecharge/index'
 				})
+			},
+			
+			async getData(){
+				const res = await packagePage()
+				if(res){
+					this.list = res.data.records
+				}
+				
 			}
 		},
-		mounted() {
-
+		onShow() {
+			this.getData()
 		},
 	}
 </script>

+ 32 - 18
pages/login/index.vue

@@ -19,23 +19,17 @@
                     </view>
                 </view>
 				<view class="btn">
-					<u-button>登录</u-button>
+					<u-button @click="toLogin()">登录</u-button>
 				</view>
             </view>
         </view>
     </view>
 </template>
 <script>
-	import {
-		toRpx
-	} from '@/utils/calculate.js'
+	import { toRpx } from '@/utils/calculate.js'
 	import defaultConfig from '@/config/default.js'
-    import {
-		navigateTo,
-		phoneValidate,
-		filterPhone,
-		openFilterPhone
-	} from '@/utils/utils.js'
+    import { navigateTo,phoneValidate,filterPhone,openFilterPhone } from '@/utils/utils.js'
+	import { login,sendCode } from '@/apis/user'
 	export default {
 		components: {},
 		computed: {
@@ -51,6 +45,7 @@
                 code:'',
                 tips:'',
 				getCoding: false,
+				wxopenId:uni.getStorageSync('wxOpenId')
 			}
 		},
 		onLoad() {
@@ -67,13 +62,29 @@
 			}
         },
 		methods: {
+			// 登录
+			async toLogin(){
+				const res = await login({
+					channel:1,
+					phone:this.phone,
+					code:this.code,
+				})
+				uni.showToast({
+					title:'登录成功'
+				})
+				setTimeout(() => {
+					uni.redirectTo({
+						url:'/pages/gallery/index'
+					})
+				})
+			},
             bindPhone() {
 				console.log('绑定成功')
 			},
 			codeChange(text) {
 				this.tips = text;
 			},
-			getCode() {
+			async getCode() {
 				if (!this.phone) {
 					uni.showToast({
 						title: '请先输入手机号',
@@ -94,13 +105,16 @@
 						title: '正在获取验证码',
 						icon: 'none'
 					})
-					setTimeout(() => {
-						uni.hideLoading();
-						// 这里此提示会被this.start()方法中的提示覆盖
-						uni.$u.toast('验证码已发送');
-						// 通知验证码组件内部开始倒计时
-						this.$refs.uCode.start();
-					}, 1000);
+					await sendCode({
+						phone:this.phone
+					})
+					uni.hideLoading();
+					// 这里此提示会被this.start()方法中的提示覆盖
+					uni.showToast('验证码已发送');
+					// 通知验证码组件内部开始倒计时
+					this.$refs.uCode.start();
+				} else {
+					console.log('倒计时结束后再发送')
 				}
 			},
 			end() {

+ 3 - 4
pages/mall/mallRecharge/index.vue

@@ -3,7 +3,7 @@
 	<view class="mall-recharge">
 		<view class="white-box">
 			<view class="account-text">充值账号</view>
-			<u-input class="account-name" v-model="phone" type="text" maxlength="11" placeholder="请输入手机号" fontSize="56rpx" :customStyle="{ padding: '0'}" clearable></u-input>
+			<u-input class="account-name" v-model="phone" type="text" maxlength="11" placeholder="请输入手机号" placeholder-style="font-size:32rpx;font-weight:400" fontSize="56rpx" :customStyle="{ padding: '0'}" clearable></u-input>
 		</view>
 		<view v-if="phone" class="tip flex aic">
 			<re-image imgSrc="/retail/mall/ic_tip.png" width="28" height="28"></re-image>
@@ -83,7 +83,7 @@
 						<span style="margin-left:16rpx">微信支付</span>
 					</view>
 					<re-image width="48" height="48" imgSrc="/retail/mall/yigou.png" alt="" />
-					<span class="check-icon check-icon1"></span>
+					<!-- <span class="check-icon check-icon1"></span> -->
 				</view>
 			</view>
 		</view>
@@ -133,7 +133,6 @@
 				color: #2C2B28;
 				line-height: 14rpx;
 				margin-bottom: 40rpx;
-				
 			}
 
 			.account-name {
@@ -458,7 +457,7 @@
 				}
 			}
 			.btns{
-				margin-top: 24rpx;
+				margin: 24rpx 0 8rpx;
 			}
 			.primary-btn {
 				width: 296rpx;

+ 30 - 3
pages/my/index.vue

@@ -16,7 +16,7 @@
 						<view class="phone">13630639549</view>
 					</view>
 				</view>
-				<re-image imgSrc="/retail/my/ic_more.png" width="24" height="24" class="more"></re-image>
+				<view class="right" @click="logOut"><re-image imgSrc="/retail/my/ic_more.png" width="24" height="24" class="more"></re-image></view>
 			</view>
 			<view class="menu">
 				<view class="menu-item item-one">
@@ -39,6 +39,11 @@
 				</view>
 			</view>
 		</view>
+		<u-popup :show="show" @close="close" @open="open">
+            <view class="safe-area-inset-bottom">
+                <view class="login-out">退出登录</view>
+            </view>
+		</u-popup>
 	</view>
 </template>
 
@@ -57,6 +62,7 @@
 		},
 		data() {
 			return {
+				show:false,
 				bannerImage: defaultConfig.ossImgUrl + '/retail/my/img_myBgc.png',
 				avatar: '../../static/image/img_touxiang.png',
 				navBarHeight: uni.getStorageSync('navBarHeight')
@@ -84,6 +90,16 @@
 					}
 				});
 			},
+			logOut(){
+				this.show = true
+			},
+			open() {
+				// console.log('open');
+			},
+			close() {
+				this.show = false
+				// console.log('close');
+			}
 		},
 		mounted() {
 
@@ -146,8 +162,14 @@
 						color: #363531;
 					}
 				}
-				.more{
-					margin-top: 26rpx;
+				.right{
+					flex: 1;
+					display: flex;
+					justify-content: flex-end;
+					.more{
+						
+						margin-top: 26rpx;
+					}
 				}
 
 				.news-total {
@@ -188,5 +210,10 @@
 				}
 			}
 		}
+		.login-out{
+			text-align: center;
+			margin: 40rpx 0;
+
+		}
 	}
 </style>

+ 43 - 15
pages/news/index.vue

@@ -1,34 +1,62 @@
 <template>
 	<view class="news">
-		<view class="list">
-			<view class="list-item">
-				<view class="time">2024-12-31 12:85</view>
-				<view class="new-card">
-					<view class="news-cons">
-						<view class="name">充值信息</view>
-						<view class="text ellipsis-2">消息内容文本文本文本文本文本文本文本文本</view>
-					</view>
-					<view class="news-detail" @click="toDetail">
-						<view class="txt">查看详情</view>
-						<re-image imgSrc="/retail/mall/icon_more.png" width="24" height="24"></re-image>
+		<mescroll-body height="100%" ref="mescrollRef" bottom="200" @init="mescrollInit" @down="downCallback" :up="upOption" @up="upCallback">
+			<view class="list">
+				<view class="list-item" v-for="(item,index) in list" :key="index">
+					<view class="time">{{item.sendTime}}</view>
+					<view class="new-card">
+						<view class="news-cons">
+							<view class="name">{{item.title}}</view>
+							<view class="text ellipsis-2">{{item.msg}}</view>
+						</view>
+						<view class="news-detail" @click="toDetail(item.id)">
+							<view class="txt">查看详情</view>
+							<re-image imgSrc="/retail/mall/icon_more.png" width="24" height="24"></re-image>
+						</view>
 					</view>
 				</view>
 			</view>
-		</view>
+		</mescroll-body>
 	</view>
 </template>
 
 <script>
-export default{
+import MescrollMixin from "@/plugins/mescroll/components/mescroll-uni/mescroll-mixins.js"
+import MescrollBody from '@/plugins/mescroll/components/mescroll-uni/mescroll-uni.vue'
+import { msgPage } from '@/apis/news.js'
+export default {
+	components:{
+        MescrollBody
+    },
 	data(){
 		return{
+			list: [{
+				sendTime:'2024-3-31 12:85',
+				msg:'消息内容写死的文本',
+				title:'充值信息',
 
+			}],
 		}
 	},
+	mixins: [MescrollMixin],
 	methods: {
-		toDetail(){
+		// 初始化
+		initPage() {
+			this.mescroll.resetUpScroll()
+			this.mescroll.scrollTo(0, 300)
+		},
+
+		async upCallback(){
+			this.mescroll.endErr()
+			const res = await msgPage()
+			if(res.code === 1){
+				this.mescroll.endBySize(res.records.length, res.total)
+			}
+			
+		},
+		toDetail(id){
 			uni.navigateTo({
-				url:'/pages/system/index'
+				url:'/pages/system/index?id' + id
 			})
 		}
 	},

+ 29 - 8
pages/statistics/index.vue

@@ -47,28 +47,28 @@
 						<re-image imgSrc="/retail/statistics/ic_dell.png" width="56" height="56"></re-image>
 						<view class="con-new">
 							<view class="new-text">总销订单</view>
-							<view class="new-num">25</view>
+							<view class="new-num">{{orderNum || 0}}</view>
 						</view>
 					</view>
 					<view class="con-item flex">
 						<re-image imgSrc="/retail/statistics/ic_youxibi.png" width="56" height="56"></re-image>
 						<view class="con-new">
 							<view class="new-text">总销游戏币</view>
-							<view class="new-num">25</view>
+							<view class="new-num">{{sumGameCurrency || 0}}</view>
 						</view>
 					</view>
 					<view class="con-item con-btom flex">
 						<re-image imgSrc="/retail/statistics/ic_money.png" width="56" height="56"></re-image>
 						<view class="con-new">
 							<view class="new-text">总充值金额</view>
-							<view class="new-num"><text style="font-size:24rpx">¥</text>25</view>
+							<view class="new-num"><text style="font-size:24rpx">¥</text>{{sumPay || 0}}</view>
 						</view>
 					</view>
 					<view class="con-item con-btom flex">
 						<re-image imgSrc="/retail/statistics/ic_money.png" width="56" height="56"></re-image>
 						<view class="con-new">
 							<view class="new-text">预估总收益</view>
-							<view class="new-num"><text style="font-size:24rpx">¥</text>25</view>
+							<view class="new-num"><text style="font-size:24rpx">¥</text>{{income || 0}}</view>
 						</view>
 					</view>
 				</view>
@@ -78,6 +78,7 @@
 					<view class="left flex aic">
 						<re-image width="40" height="40" imgSrc="/retail/statistics/ic_yeji.png"></re-image><text style="margin-left: 16rpx">分销等级说明</text>
 					</view>
+					<rich-text :nodes="nodes"></rich-text>
 				</view>
 			</view>
 		</view>
@@ -90,7 +91,7 @@
 		toRpx
 	} from '@/utils/calculate.js'
 	import defaultConfig from '@/config/default.js'
-
+	import { statistics,getConfig } from '@/apis/statistic'
 	export default {
 		components: {},
 		computed: {
@@ -121,7 +122,12 @@
 					}]
 				],
 				bannerImage: defaultConfig.ossImgUrl + '/retail/main/img_bgtop.png',
-				navBarHeight: uni.getStorageSync('navBarHeight')
+				navBarHeight: uni.getStorageSync('navBarHeight'),
+				nodes:'',
+				income:'',
+				orderNum:'',
+				sumGameCurrency:'',
+				sumPay:''
 			}
 		},
 		onLoad() {
@@ -150,10 +156,25 @@
                 console.log('confirm', e)
                 this.show = false
 				this.date = e.value[0].label
+			},
+			async getData(){
+				uni.showLoading()
+				const res = await statistics()
+				const { income,orderNum,sumGameCurrency,sumPay } = res
+				this.income = income
+				this.orderNum = orderNum
+				this.sumGameCurrency = sumGameCurrency
+				this.sumPay = sumPay
+				uni.hideLoading()
+			},
+			async getRule(){
+				const res = await getConfig()
+				this.nodes = res.lvRule
 			}
 		},
-		mounted() {
-
+		onShow() {
+			this.getData()
+			this.getRule()
 		},
 	}
 </script>

+ 28 - 5
pages/system/index.vue

@@ -2,19 +2,42 @@
     <view class="system">
         <view><nav-bar title="none" icon="none" background="transparent" border-color="transparent" ></nav-bar></view>
         <view class="content">
-            <view class="title bold">系统消息文本(取前10字)</view>
-            <view class="time">2024-12-31 12:09</view>
-            <view class="text">系统消息文本文本文本文本文本文本文本文本</view>
+            <view class="title bold">{{title}}</view>
+            <view class="time">{{sendTime}}</view>
+            <view class="text">{{msg}}</view>
         </view>
     </view>
 </template>
 <script>
+import { getMsgDetail } from '@/apis/news.js'
 export default {
     data(){
         return{
-
+            id:'',
+            title:'',
+            sendTime:'',
+            msg:'',
         }
-    }
+    },
+    onLoad(params){
+        this.id = params.id
+        this.getDetail()
+    },
+    // onShow(){
+        
+    // },
+    methods: {
+        // 获取信息详情
+        async getDetail () {
+            const res = await getMsgDetail({msgId:this.id})
+            if(res){
+                const { title,sendTime,msg } = res.data
+                this.title = title
+                this.sendTime = sendTime
+                this.msg = msg
+            }
+        }
+    },
 }
 </script>
 <style lang="scss" scoped>

+ 116 - 0
plugins/uview-ui/components/u-datetime-picker/props.js

@@ -0,0 +1,116 @@
+export default {
+    props: {
+        // 是否打开组件
+        show: {
+            type: Boolean,
+            default: uni.$u.props.datetimePicker.show
+        },
+        // 是否展示顶部的操作栏
+        showToolbar: {
+            type: Boolean,
+            default: uni.$u.props.datetimePicker.showToolbar
+        },
+        // 绑定值
+        value: {
+            type: [String, Number],
+            default: uni.$u.props.datetimePicker.value
+        },
+        // 顶部标题
+        title: {
+            type: String,
+            default: uni.$u.props.datetimePicker.title
+        },
+        // 展示格式,mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择
+        mode: {
+            type: String,
+            default: uni.$u.props.datetimePicker.mode
+        },
+        // 可选的最大时间
+        maxDate: {
+            type: Number,
+            // 最大默认值为后10年
+            default: uni.$u.props.datetimePicker.maxDate
+        },
+        // 可选的最小时间
+        minDate: {
+            type: Number,
+            // 最小默认值为前10年
+            default: uni.$u.props.datetimePicker.minDate
+        },
+        // 可选的最小小时,仅mode=time有效
+        minHour: {
+            type: Number,
+            default: uni.$u.props.datetimePicker.minHour
+        },
+        // 可选的最大小时,仅mode=time有效
+        maxHour: {
+            type: Number,
+            default: uni.$u.props.datetimePicker.maxHour
+        },
+        // 可选的最小分钟,仅mode=time有效
+        minMinute: {
+            type: Number,
+            default: uni.$u.props.datetimePicker.minMinute
+        },
+        // 可选的最大分钟,仅mode=time有效
+        maxMinute: {
+            type: Number,
+            default: uni.$u.props.datetimePicker.maxMinute
+        },
+        // 选项过滤函数
+        filter: {
+            type: [Function, null],
+            default: uni.$u.props.datetimePicker.filter
+        },
+        // 选项格式化函数
+        formatter: {
+            type: [Function, null],
+            default: uni.$u.props.datetimePicker.formatter
+        },
+        // 是否显示加载中状态
+        loading: {
+            type: Boolean,
+            default: uni.$u.props.datetimePicker.loading
+        },
+        // 各列中,单个选项的高度
+        itemHeight: {
+            type: [String, Number],
+            default: uni.$u.props.datetimePicker.itemHeight
+        },
+        // 取消按钮的文字
+        cancelText: {
+            type: String,
+            default: uni.$u.props.datetimePicker.cancelText
+        },
+        // 确认按钮的文字
+        confirmText: {
+            type: String,
+            default: uni.$u.props.datetimePicker.confirmText
+        },
+        // 取消按钮的颜色
+        cancelColor: {
+            type: String,
+            default: uni.$u.props.datetimePicker.cancelColor
+        },
+        // 确认按钮的颜色
+        confirmColor: {
+            type: String,
+            default: uni.$u.props.datetimePicker.confirmColor
+        },
+        // 每列中可见选项的数量
+        visibleItemCount: {
+            type: [String, Number],
+            default: uni.$u.props.datetimePicker.visibleItemCount
+        },
+        // 是否允许点击遮罩关闭选择器
+        closeOnClickOverlay: {
+            type: Boolean,
+            default: uni.$u.props.datetimePicker.closeOnClickOverlay
+        },
+        // 各列的默认索引
+        defaultIndex: {
+            type: Array,
+            default: uni.$u.props.datetimePicker.defaultIndex
+        }
+    }
+}

+ 360 - 0
plugins/uview-ui/components/u-datetime-picker/u-datetime-picker.vue

@@ -0,0 +1,360 @@
+<template>
+	<u-picker
+		ref="picker"
+		:show="show"
+		:closeOnClickOverlay="closeOnClickOverlay"
+		:columns="columns"
+		:title="title"
+		:itemHeight="itemHeight"
+		:showToolbar="showToolbar"
+		:visibleItemCount="visibleItemCount"
+		:defaultIndex="innerDefaultIndex"
+		:cancelText="cancelText"
+		:confirmText="confirmText"
+		:cancelColor="cancelColor"
+		:confirmColor="confirmColor"
+		@close="close"
+		@cancel="cancel"
+		@confirm="confirm"
+		@change="change"
+	>
+	</u-picker>
+</template>
+
+<script>
+	function times(n, iteratee) {
+	    let index = -1
+	    const result = Array(n < 0 ? 0 : n)
+	    while (++index < n) {
+	        result[index] = iteratee(index)
+	    }
+	    return result
+	}
+	import props from './props.js';
+	import dayjs from '../../libs/util/dayjs.js';
+	/**
+	 * DatetimePicker 时间日期选择器
+	 * @description 此选择器用于时间日期
+	 * @tutorial https://www.uviewui.com/components/datetimePicker.html
+	 * @property {Boolean}			show				用于控制选择器的弹出与收起 ( 默认 false )
+	 * @property {Boolean}			showToolbar			是否显示顶部的操作栏  ( 默认 true )
+	 * @property {String | Number}	value				绑定值
+	 * @property {String}			title				顶部标题
+	 * @property {String}			mode				展示格式 mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择  ( 默认 ‘datetime )
+	 * @property {Number}			maxDate				可选的最大时间  默认值为后10年
+	 * @property {Number}			minDate				可选的最小时间  默认值为前10年
+	 * @property {Number}			minHour				可选的最小小时,仅mode=time有效   ( 默认 0 )
+	 * @property {Number}			maxHour				可选的最大小时,仅mode=time有效	  ( 默认 23 )
+	 * @property {Number}			minMinute			可选的最小分钟,仅mode=time有效	  ( 默认 0 )
+	 * @property {Number}			maxMinute			可选的最大分钟,仅mode=time有效   ( 默认 59 )
+	 * @property {Function}			filter				选项过滤函数
+	 * @property {Function}			formatter			选项格式化函数
+	 * @property {Boolean}			loading				是否显示加载中状态   ( 默认 false )
+	 * @property {String | Number}	itemHeight			各列中,单个选项的高度   ( 默认 44 )
+	 * @property {String}			cancelText			取消按钮的文字  ( 默认 '取消' )
+	 * @property {String}			confirmText			确认按钮的文字  ( 默认 '确认' )
+	 * @property {String}			cancelColor			取消按钮的颜色  ( 默认 '#909193' )
+	 * @property {String}			confirmColor		确认按钮的颜色  ( 默认 '#3c9cff' )
+	 * @property {String | Number}	visibleItemCount	每列中可见选项的数量  ( 默认 5 )
+	 * @property {Boolean}			closeOnClickOverlay	是否允许点击遮罩关闭选择器  ( 默认 false )
+	 * @property {Array}			defaultIndex		各列的默认索引
+	 * @event {Function} close 关闭选择器时触发
+	 * @event {Function} confirm 点击确定按钮,返回当前选择的值
+	 * @event {Function} change 当选择值变化时触发
+	 * @event {Function} cancel 点击取消按钮
+	 * @example  <u-datetime-picker :show="show" :value="value1"  mode="datetime" ></u-datetime-picker>
+	 */
+	export default {
+		name: 'datetime-picker',
+		mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
+		data() {
+			return {
+				columns: [],
+				innerDefaultIndex: [],
+				innerFormatter: (type, value) => value
+			}
+		},
+		watch: {
+			show(newValue, oldValue) {
+				if (newValue) {
+					this.updateColumnValue(this.innerValue)
+				}
+			},
+			propsChange() {
+				this.init()
+			}
+		},
+		computed: {
+			// 如果以下这些变量发生了变化,意味着需要重新初始化各列的值
+			propsChange() {
+				return [this.mode, this.maxDate, this.minDate, this.minHour, this.maxHour, this.minMinute, this.maxMinute, this.filter, ]
+			}
+		},
+		mounted() {
+			this.init()
+		},
+		methods: {
+			init() {
+				this.innerValue = this.correctValue(this.value)
+				this.updateColumnValue(this.innerValue)
+			},
+			// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
+			setFormatter(e) {
+				this.innerFormatter = e
+			},
+			// 关闭选择器
+			close() {
+				if (this.closeOnClickOverlay) {
+					this.$emit('close')
+				}
+			},
+			// 点击工具栏的取消按钮
+			cancel() {
+				this.$emit('cancel')
+			},
+			// 点击工具栏的确定按钮
+			confirm() {
+				this.$emit('confirm', {
+					value: this.innerValue,
+					mode: this.mode
+				})
+				this.$emit('input', this.innerValue)
+			},
+			//用正则截取输出值,当出现多组数字时,抛出错误
+			intercept(e,type){
+				let judge = e.match(/\d+/g)
+				//判断是否掺杂数字
+				if(judge.length>1){
+					uni.$u.error("请勿在过滤或格式化函数时添加数字")
+					return 0
+				}else if(type&&judge[0].length==4){//判断是否是年份
+					return judge[0]
+				}else if(judge[0].length>2){
+					uni.$u.error("请勿在过滤或格式化函数时添加数字")
+					return 0
+				}else{
+					return judge[0]
+				}
+			},
+			// 列发生变化时触发
+			change(e) {
+				const { indexs, values } = e
+				let selectValue = ''
+				if(this.mode === 'time') {
+					// 根据value各列索引,从各列数组中,取出当前时间的选中值
+					selectValue = `${this.intercept(values[0][indexs[0]])}:${this.intercept(values[1][indexs[1]])}`
+				} else {
+					// 将选择的值转为数值,比如'03'转为数值的3,'2019'转为数值的2019
+					const year = parseInt(this.intercept(values[0][indexs[0]],'year'))
+					const month = parseInt(this.intercept(values[1][indexs[1]]))
+					let date = parseInt(values[2] ? this.intercept(values[2][indexs[2]]) : 1)
+					let hour = 0, minute = 0
+					// 此月份的最大天数
+					const maxDate = dayjs(`${year}-${month}`).daysInMonth()
+					// year-month模式下,date不会出现在列中,设置为1,为了符合后边需要减1的需求
+					if (this.mode === 'year-month') {
+					    date = 1
+					}
+					// 不允许超过maxDate值
+					date = Math.min(maxDate, date)
+					if (this.mode === 'datetime') {
+					    hour = parseInt(this.intercept(values[3][indexs[3]]))
+					    minute = parseInt(this.intercept(values[4][indexs[4]]))
+					}
+					// 转为时间模式
+					selectValue = Number(new Date(year, month - 1, date, hour, minute))
+				}
+				// 取出准确的合法值,防止超越边界的情况
+				selectValue = this.correctValue(selectValue)
+				this.innerValue = selectValue
+				this.updateColumnValue(selectValue)
+				// 发出change时间,value为当前选中的时间戳
+				this.$emit('change', {
+					value: selectValue,
+					// #ifndef MP-WEIXIN
+					// 微信小程序不能传递this实例,会因为循环引用而报错
+					picker: this.$refs.picker,
+					// #endif
+					mode: this.mode
+				})
+			},
+			// 更新各列的值,进行补0、格式化等操作
+			updateColumnValue(value) {
+				this.innerValue = value
+				this.updateColumns()
+				this.updateIndexs(value)
+			},
+			// 更新索引
+			updateIndexs(value) {
+				let values = []
+				const formatter = this.formatter || this.innerFormatter
+				const padZero = uni.$u.padZero
+				if (this.mode === 'time') {
+					// 将time模式的时间用:分隔成数组
+				    const timeArr = value.split(':')
+					// 使用formatter格式化方法进行管道处理
+				    values = [formatter('hour', timeArr[0]), formatter('minute', timeArr[1])]
+				} else {
+				    const date = new Date(value)
+				    values = [
+				        formatter('year', `${dayjs(value).year()}`),
+						// 月份补0
+				        formatter('month', padZero(dayjs(value).month() + 1))
+				    ]
+				    if (this.mode === 'date') {
+						// date模式,需要添加天列
+				        values.push(formatter('day', padZero(dayjs(value).date())))
+				    }
+				    if (this.mode === 'datetime') {
+						// 数组的push方法,可以写入多个参数
+				        values.push(formatter('day', padZero(dayjs(value).date())), formatter('hour', padZero(dayjs(value).hour())), formatter('minute', padZero(dayjs(value).minute())))
+				    }
+				}
+
+				// 根据当前各列的所有值,从各列默认值中找到默认值在各列中的索引
+				const indexs = this.columns.map((column, index) => {
+					// 通过取大值,可以保证不会出现找不到索引的-1情况
+					return Math.max(0, column.findIndex(item => item === values[index]))
+				})
+				this.innerDefaultIndex = indexs
+			},
+			// 更新各列的值
+			updateColumns() {
+			    const formatter = this.formatter || this.innerFormatter
+				// 获取各列的值,并且map后,对各列的具体值进行补0操作
+			    const results = this.getOriginColumns().map((column) => column.values.map((value) => formatter(column.type, value)))
+				this.columns = results
+			},
+			getOriginColumns() {
+			    // 生成各列的值
+			    const results = this.getRanges().map(({ type, range }) => {
+			        let values = times(range[1] - range[0] + 1, (index) => {
+			            let value = range[0] + index
+			            value = type === 'year' ? `${value}` : uni.$u.padZero(value)
+			            return value
+			        })
+					// 进行过滤
+			        if (this.filter) {
+			            values = this.filter(type, values)
+			        }
+			        return { type, values }
+			    })
+			    return results
+			},
+			// 通过最大值和最小值生成数组
+			generateArray(start, end) {
+				return Array.from(new Array(end + 1).keys()).slice(start)
+			},
+			// 得出合法的时间
+			correctValue(value) {
+				const isDateMode = this.mode !== 'time'
+				if (isDateMode && !uni.$u.test.date(value)) {
+					// 如果是日期类型,但是又没有设置合法的当前时间的话,使用最小时间为当前时间
+					value = this.minDate
+				} else if (!isDateMode && !value) {
+					// 如果是时间类型,而又没有默认值的话,就用最小时间
+					value = `${uni.$u.padZero(this.minHour)}:${uni.$u.padZero(this.minMinute)}`
+				}
+				// 时间类型
+				if (!isDateMode) {
+					if (String(value).indexOf(':') === -1) return uni.$u.error('时间错误,请传递如12:24的格式')
+					let [hour, minute] = value.split(':')
+					// 对时间补零,同时控制在最小值和最大值之间
+					hour = uni.$u.padZero(uni.$u.range(this.minHour, this.maxHour, Number(hour)))
+					minute = uni.$u.padZero(uni.$u.range(this.minMinute, this.maxMinute, Number(minute)))
+					return `${ hour }:${ minute }`
+				} else {
+					// 如果是日期格式,控制在最小日期和最大日期之间
+					value = dayjs(value).isBefore(dayjs(this.minDate)) ? this.minDate : value
+					value = dayjs(value).isAfter(dayjs(this.maxDate)) ? this.maxDate : value
+					return value
+				}
+			},
+			// 获取每列的最大和最小值
+			getRanges() {
+			    if (this.mode === 'time') {
+			        return [
+			            {
+			                type: 'hour',
+			                range: [this.minHour, this.maxHour],
+			            },
+			            {
+			                type: 'minute',
+			                range: [this.minMinute, this.maxMinute],
+			            },
+			        ];
+			    }
+			    const { maxYear, maxDate, maxMonth, maxHour, maxMinute, } = this.getBoundary('max', this.innerValue);
+			    const { minYear, minDate, minMonth, minHour, minMinute, } = this.getBoundary('min', this.innerValue);
+			    const result = [
+			        {
+			            type: 'year',
+			            range: [minYear, maxYear],
+			        },
+			        {
+			            type: 'month',
+			            range: [minMonth, maxMonth],
+			        },
+			        {
+			            type: 'day',
+			            range: [minDate, maxDate],
+			        },
+			        {
+			            type: 'hour',
+			            range: [minHour, maxHour],
+			        },
+			        {
+			            type: 'minute',
+			            range: [minMinute, maxMinute],
+			        },
+			    ];
+			    if (this.mode === 'date')
+			        result.splice(3, 2);
+			    if (this.mode === 'year-month')
+			        result.splice(2, 3);
+			    return result;
+			},
+			// 根据minDate、maxDate、minHour、maxHour等边界值,判断各列的开始和结束边界值
+			getBoundary(type, innerValue) {
+			    const value = new Date(innerValue)
+			    const boundary = new Date(this[`${type}Date`])
+			    const year = dayjs(boundary).year()
+			    let month = 1
+			    let date = 1
+			    let hour = 0
+			    let minute = 0
+			    if (type === 'max') {
+			        month = 12
+					// 月份的天数
+			        date = dayjs(value).daysInMonth()
+			        hour = 23
+			        minute = 59
+			    }
+				// 获取边界值,逻辑是:当年达到了边界值(最大或最小年),就检查月允许的最大和最小值,以此类推
+			    if (dayjs(value).year() === year) {
+			        month = dayjs(boundary).month() + 1
+			        if (dayjs(value).month() + 1 === month) {
+			            date = dayjs(boundary).date()
+			            if (dayjs(value).date() === date) {
+			                hour = dayjs(boundary).hour()
+			                if (dayjs(value).hour() === hour) {
+			                    minute = dayjs(boundary).minute()
+			                }
+			            }
+			        }
+			    }
+			    return {
+			        [`${type}Year`]: year,
+			        [`${type}Month`]: month,
+			        [`${type}Date`]: date,
+			        [`${type}Hour`]: hour,
+			        [`${type}Minute`]: minute
+			    }
+			},
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import '../../libs/css/components.scss';
+</style>

+ 3 - 3
request/index.js

@@ -45,7 +45,7 @@ function requestHandle(obj) {
 				data: {
 					data,
 					code,
-					msg
+					message
 				}
 			}] = response
 			if (error) {
@@ -67,7 +67,7 @@ function requestHandle(obj) {
 					return
 				}
 				uni.showToast({
-					title: msg,
+					title: message,
 					icon: 'none',
 					mask: true
 				})
@@ -78,7 +78,7 @@ function requestHandle(obj) {
 				}, 1000)
 			} else if (code !== 0) {
 				uni.showToast({
-					title: msg || '服务器开小差',
+					title: message || '服务器开小差',
 					icon: 'none'
 				})
 			} else {

Diferenças do arquivo suprimidas por serem muito extensas
+ 2432 - 752
unpackage/dist/dev/mp-weixin/common/vendor.js


+ 7 - 0
unpackage/dist/dev/mp-weixin/project.private.config.json

@@ -4,6 +4,13 @@
     "miniprogram": {
       "list": [
         {
+          "name": "http://localhost:8080/login1.html",
+          "pathName": "http://localhost:8080/login1.html",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
+        },
+        {
           "name": "登录",
           "pathName": "pages/login/index",
           "query": "",

+ 92 - 93
utils/preCheck.js

@@ -5,101 +5,100 @@ import {
   getUrlParamsNormal
 } from '@/utils/utils.js'
 import {
-  getOpenId,
-  getOpenIdAndLogin,
-} from '@/apis/index.js'
-import {
-  login
-} from '@/apis/user'
-import {
-  logout
-} from '@/apis/information.js'
-const apisFilter = (station, data) => {
-  return new Promise(resolve => {
-    if (station === '1') {
-      getOpenIdAndLogin(data).then((res) => {
-        resolve(res)
-      })
-    } else {
-      getOpenId(data).then((res) => {
-        resolve(res)
-      })
-    }
-  })
-}
+  getUserInfo,login
+} from '@/apis/user.js'
+// import {
+//   logout
+// } from '@/apis/information.js'
+// const apisFilter = (station, data) => {
+//   return new Promise(resolve => {
+//     if (station === '1') {
+//       getOpenIdAndLogin(data).then((res) => {
+//         resolve(res)
+//       })
+//     } else {
+//       getOpenId(data).then((res) => {
+//         resolve(res)
+//       })
+//     }
+//   })
+// }
 if (platform() === 'H5') {
-  const getWxQuery = (name) => {
-    return new URL(window.location.href).searchParams.get(name + '')
-  }
+  // const getWxQuery = (name) => {
+  //   return new URL(window.location.href).searchParams.get(name + '')
+  // }
   let openIdSt = ''
   let station = getUrlParamsNormal('stationType') || uni.getStorageSync('stationType')
-  if (getEnv() === 'test') {
-    const opId = getUrlParamsNormal('openId') || uni.getStorageSync('openId')
-    uni.setStorageSync('openId', opId)
-    if (station) {
-      uni.setStorageSync('stationType', station)
-    }
-    openIdSt = opId || uni.getStorageSync('openId')
-  } else {
-    openIdSt = uni.getStorageSync('openId')
-    if (station) {
-      uni.setStorageSync('stationType', station)
-    }
-  }
-  if (!openIdSt) {
-    const code = getWxQuery('code')
-    if (code) {
-      apisFilter(station, {
-        code: code
-      }).then(res => {
-        const {
-          openId,
-          customerVo,
-          token,
-        } = res
-        uni.setStorageSync('openId', openId)
-        const userInfo = uni.getStorageSync('userInfo')
-        if (token && token.accessToken) { // 登录成功 后更新用户信息
-          uni.setStorageSync('accessToken', token.accessToken)
-          uni.setStorageSync('tokenType', token.tokenType)
-          uni.setStorageSync('userInfo', customerVo)
-        }
-        if (!token) { // 未登录过
-          const channel = getUrlParamsNormal('channel')
-          if (channel === 'qrcode') { // 扫码进入的页面
-            uni.redirectTo({
-              url: '/pages/main/index'
-            })
-          } else { // 进入登录
-            uni.redirectTo({
-              url: '/pages/login/index'
-            })
+  // if (getEnv() === 'test') {
+  //   const opId = getUrlParamsNormal('wxOpenid') || uni.getStorageSync('wxOpenid')
+  //   uni.setStorageSync('wxOpenid', opId)
+  //   if (station) {
+  //     uni.setStorageSync('stationType', station)
+  //   }
+  //   openIdSt = opId || uni.getStorageSync('wxOpenid')
+  // } else {
+  //   openIdSt = uni.getStorageSync('wxOpenid')
+  //   if (station) {
+  //     uni.setStorageSync('stationType', station)
+  //   }
+  // }
+  // console.log(openIdSt,'openIdSt');
+  // if (!openIdSt) {
+    // const code = getWxQuery('code')
+    // console.log(code,'code');
+    // if (code) {
+      // getUserInfo(station, {
+      //   // code: code
+      // }).then(res => {
+        // let ress = res.data
+        // uni.setStorageSync('wxOpenid', ress.wxOpenid)
+        // const userInfo = uni.getStorageSync('userInfo')
+        const token = uni.getStorageSync('token')
+        // setTimeout(() => {
+          if (token) { // 登录成功 后更新用户信息
+            uni.setStorageSync('accessToken', token)
+            // uni.setStorageSync('tokenType', token.tokenType)
+            uni.setStorageSync('userInfo', ress)
+          }
+          if (!token) { // 未登录过
+            const channel = getUrlParamsNormal('channel')
+            if (channel === 'qrcode') { // 扫码进入的页面
+              uni.redirectTo({
+                url: '/pages/gallery/index'
+              })
+            } else { // 进入登录
+              uni.redirectTo({
+                url: '/pages/login/index'
+              })
+            }
           }
-        }
-      })
-    } else {
-      uni.setStorageSync('indexHref', window.location.href)
-      if (getEnv() !== 'mock') {
-        const state = 'recruit'
-        const redirect_uri = encodeURIComponent(window.location.href)
-        const appid = config.appid
-        const scope = 'snsapi_base'
-        window.location.href =
-          `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`
-      }
-    }
-  } else {
-    uni.setStorageSync('indexHref', window.location.href)
-    const userInfo = uni.getStorageSync('userInfo')
-    if ((userInfo.type === 0 && station === '0') || (userInfo.type !== 0 && station === '1')) { // 站点切团长
-      logout().then(() => {
-        uni.removeStorageSync('accessToken')
-        uni.removeStorageSync('tokenType')
-        uni.removeStorageSync('userInfo')
-        uni.navigateTo({
-          url: '/pages/login/index'
-        })
-      })
-    }
-  }
+        // })
+        
+      // })
+    // } else {
+    //   uni.setStorageSync('indexHref', window.location.href)
+    //   if (getEnv() !== 'mock') {
+    //     console.log(22);
+    //     const state = 'retail'
+    //     const redirect_uri = encodeURIComponent(window.location.href)
+    //     const appid = config.appid
+    //     const scope = 'snsapi_userinfo'
+    //     window.location.href =
+    //       `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`
+    //   }
+    // }
+  // } else {
+  //   uni.setStorageSync('indexHref', window.location.href)
+  //   const userInfo = uni.getStorageSync('userInfo')
+  //   if ((userInfo.type === 0 && station === '0') || (userInfo.type !== 0 && station === '1')) { // 站点切团长
+      // logout().then(() => {
+      //   uni.removeStorageSync('accessToken')
+      //   uni.removeStorageSync('tokenType')
+      //   uni.removeStorageSync('userInfo')
+      //   uni.navigateTo({
+      //     url: '/pages/login/index'
+      //   })
+      // })
+//     }
+//   }
 }