gjy vor 3 Jahren
Ursprung
Commit
15aebb1f7a

+ 7 - 0
pages.json

@@ -155,6 +155,13 @@
 		        "navigationBarTitleText": "交易"
 		    }
 		},
+		{
+			"path": "pages/attestation/index",
+			"style": {
+				"navigationBarTitleText": "身份认证",
+				"enablePullDownRefresh": true
+			}
+		},
 		{
             "path" : "pages/tran/tran",
             "style" : {

+ 8 - 0
pages/attestation/index.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 5 - 0
pages/public/login.vue

@@ -8,6 +8,7 @@
 			<view style='width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;' class="flex">
 				<view style='width:15%;border-right:1px solid #E8E9ED;'>+86</view>
 				<view style='width:85%;'><input style='padding-left:10px;' v-model='phone' @input='changephone' placeholder="请输入手机号码" type="number" maxlength="11"></view>
+				<image v-if='phone!=""' @click='phone=""' class='close' src='../../static/img/login/guanbi@2x.png'></image>
 			</view>
 			<button @click='gocode' :class='codestatus?"active":""' class='verificationCode'>获取验证码</button>
 			<view @click='gonumber' style='text-align:center;color:#6A6A6A;margin-top:10px;'>使用账号密码登录</view>
@@ -852,6 +853,10 @@
 		vertical-align: middle;
 		margin-right:5px;
 	}
+	.close{
+		width:20px;height:20px;position:absolute;
+		right:30px;
+	}
 	.container {
 		padding-top: 85px;
 		position: relative;

+ 24 - 8
pages/public/login_account_number.vue

@@ -5,13 +5,15 @@
 		<view class="wrapper">
 			<image style='width:38px;height:38px;margin-bottom:10px;' src='../../static/img/login/logo@2x.png'></image>
 			<h2>欢迎使用易粮易运</h2>
-			<view style='width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;' class="flex">
+			<view style='position:relative;width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;' class="flex">
 				<view style='width:15%;border-right:1px solid #E8E9ED;'>+86</view>
 				<view style='width:85%;'><input style='padding-left:10px;' maxlength='11' v-model='phone' placeholder="请输入手机号码" type="text"></view>
+			<image v-if='phone!=""' @click='phone=""' class='close' src='../../static/img/login/guanbi@2x.png'></image>
 			</view>
 			<view style='margin-top:20px;border-bottom:1px solid #E8E9ED;position:relative;'>
 				<input class='password' style='height:40px;' v-model='password' placeholder="请输入密码,6-16位字符" :type="type" value="" />
 				<view @click='switchover' style='position:absolute;right:0;top:38%;z-index:10;cursor:pointer;' class="iconfont " :class='type=="password"?"icon-yanjing-biyan":"icon-yanjing-zhengyan"'></view>
+				<image v-if='password!=""' @click='password=""' class='close2' src='../../static/img/login/guanbi@2x.png'></image>
 			</view>
 			<button :class='phone!=""&&password!=""?"active":""' @click='passlogin' class='verificationCode'>登录</button>
 			<view class='flex' style='color:#6A6A6A;margin-top:10px;'>
@@ -19,10 +21,7 @@
 				<view @click='gocode' style='flex:1;text-align:center;'>验证码登录</view>
 			</view>
 		    <button class='register'>手机号一键注册</button>
-		</view>5
-		<view v-if="loginType === 'phone'" class="register-section">
-			还没有账号?
-			<text @click="toRegist">马上注册</text>
+		</view>
 		</view>
 	</view>
 </template>
@@ -55,7 +54,7 @@
 					gender:'',
 					phone:''
 				},
-				type:'password',
+				type:'text',
 				inputStatus:'none',
 				verifyCode:null,
 				sendText:'获取验证码',
@@ -143,8 +142,9 @@
 			           that.$api.msg(failres.errmsg)
 			           uni.hideLoading()
 			    }).then(res => {
-					console.log(res)
+					console.log(res.data)
 					uni.setStorageSync('userInfo', res.data)
+					// console.log(uni.getStorageSync('userInfo'))
 					that.$store.commit('login', res.data)
 					that.liangxinLogin()
 					uni.switchTab({
@@ -776,7 +776,6 @@
 				const that = this
 				var userInfoTmp = uni.getStorageSync("userInfo")
 				console.log('userInfoTmp',userInfoTmp)
-				console.log(that.$socket)
 				that.$socket.login(userInfoTmp.phone, "123456", null, res=>{
 					console.log('粮信登录',res)
 					if (res.success) {
@@ -845,6 +844,23 @@
 	page {
 		background: #fff;
 	}
+	.close{
+		width:20px;height:20px;position:absolute;
+		right:0px;
+	}
+	.close1{
+		width:20px;height:20px;position:absolute;
+		right:10px;
+		top:0;
+	}
+	.close2{
+		    width: 15px;
+		    height: 15px;
+		    position: absolute;
+		    right: 19px;
+		    top: 50%;
+		    transform: translateY(-45%);
+	}
 	.password{
 		border:none;
 		outline:none;

+ 134 - 19
pages/public/register.vue

@@ -4,16 +4,21 @@
 		
 		<view class="wrapper">
 			<h2>手机号注册</h2>
-			<view style='width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;' class="flex">
+			<view style='width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;position:relative;' class="flex">
 				<view style='width:15%;border-right:1px solid #E8E9ED;'>+86</view>
 				<view style='width:85%;'><input maxlength="11" v-model='phone' @input='phoneinput' style='padding-left:10px;' placeholder="请输入手机号码" type="text"></view>
+			<image v-if='phone!=""' @click='phone=""' class='close' src='../../static/img/login/guanbi@2x.png'></image>
 			</view>
 			<view style='width:100%;border-bottom:1px solid #E8E9ED;position:relative;padding:10px;' class="flex">
-				<view style='width:85%;'><input  v-model='verifyCode' placeholder="请输入验证码" type="text"></view>
-				<button :class='codestatus?"active":""' @click='getcode' class='getcode'>{{sendText}}</button>
+				<view style='width:70%;position:relative;'>
+					<input  v-model='verifyCode' placeholder="请输入验证码" type="text">
+					<image v-if='verifyCode!=""' @click='verifyCode=""' class='close1' src='../../static/img/login/guanbi@2x.png'></image>
+					</view>
+				<button :class='codestatus&&!sendDisabled?"active":""' @click='getcode' class='getcode'>{{sendText}}</button>
 			</view>
 			<view style='border-bottom:1px solid #E8E9ED;padding:10px;position:relative;'>
 				<input maxlength='16' class='password' style='height:30px;' v-model='password' placeholder="请输入密码,6-16位字符" :type="type">
+				<image v-if='password!=""' @click='password=""' class='close2' src='../../static/img/login/guanbi@2x.png'></image>
 				<view @click='switchover' style='position:absolute;right:0;top:38%;z-index:10;cursor:pointer;' class="iconfont " :class='type=="password"?"icon-yanjing-biyan":"icon-yanjing-zhengyan"'></view>
 			</view>
 			<button  :class='phone!=""&&verifyCode!=""&&password!=""?"active":""' @click='register' class='verificationCode'>注册</button>
@@ -57,7 +62,7 @@
 				},
 				consentStatus:false,
 				codestatus:false,
-				type:'password',
+				type:'text',
 				inputStatus:'none',
 				verifyCode:null,
 				sendText:'获取验证码',
@@ -93,25 +98,61 @@
 			})
 		},
 		methods: {
+			// 随机数
+			randomAccess(min,max){
+				return Math.floor(Math.random() * (min - max) + max)
+			},
+			// 解码
+			decodeUnicode(str) {
+			   //Unicode显示方式是\u4e00
+			   str = "\\u"+str
+			   str = str.replace(/\\/g, "%");
+			    //转换中文
+			   str = unescape(str);
+			    //将其他受影响的转换回原来
+			   str = str.replace(/%/g, "\\");
+			   return str;
+			},
+			/*
+			*@param Number NameLength 要获取的名字长度
+			*/
+			getRandomName(NameLength){
+				let name = ""
+				for(let i = 0;i<NameLength;i++){
+					let unicodeNum  = ""
+					unicodeNum = this.randomAccess(0x4e00,0x9fa5).toString(16)
+					name += this.decodeUnicode(unicodeNum)
+				}
+				return name
+			},
 			phoneinput(e){
 				if(e.detail.value.length==11){
 					this.codestatus=true
 				}
 			},
 			getcode(){
-				console.log(/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.phone))
+				var that = this
 				if(/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.phone)){
-					// this.$api.doRequest('get','/commonUser/sendVerifyCode',{phone:this.phone}).then(res => {
-					//                 // 获得数据
-					//                 console.log(res);
-					//             })
-					//             .catch(res => {
-					                uni.showToast({
-						title: res.errmsg,
-						icon:'none',
-						duration: 2000
+					this.$api.doRequest('get','/commonUser/sendVerifyCode',{phone:this.phone}).then(res => {
+							that.sendDisabled = true
+							let sec = 60
+							let interval = setInterval(() => {
+								sec--;
+								that.sendText = sec + 's后重发'
+								if (sec <= 0) {
+									that.sendDisabled = false
+									that.sendText = "获取验证码"
+									clearInterval(interval)
+								}
+							}, 1000)
 					})
-					//             });
+					.catch(res => {
+						uni.showToast({
+							title: res.errmsg,
+							icon:'none',
+							duration: 2000
+						})
+					});
 				}else{
 					uni.showToast({
 						title: '请输入正确的手机号',
@@ -122,9 +163,67 @@
 				
 			},
 			register(){
-				this.$api.doRequest('post','/commonUser/register',{phone:this.phone,password:this.password,verifyCode:this.verifyCode}).then(res => {
-				    // 获得数据
-				    console.log(res);
+				var that = this
+				if(!this.consentStatus){
+					uni.showToast({
+						title: '请勾选协议',
+						icon:'none',
+						duration: 2000
+					})
+					return
+				}
+				if(this.verifyCode.length>6){
+					uni.showToast({
+						title: '验证码错误',
+						icon:'none',
+						duration: 2000
+					})
+					return
+				}
+				if(this.password.length<6){
+					uni.showToast({
+						title: '请输入正确的密码格式',
+						icon:'none',
+						duration: 2000
+					})
+					return
+				}
+				var username=this.getRandomName(3)
+				this.$api.doRequest('post','/commonUser/register',{phone:this.phone,password:this.password,verifyCode:this.verifyCode,userName:username}).then(res => {
+					if(res.data.code=='11002'){
+						uni.showToast({
+							title: '验证码错误或过期,请重新获取',
+							icon:'none',
+							duration: 2000
+						})
+						return
+					}else if(res.data.code=='11004'){
+						uni.showToast({
+							title: '该手机号已注册,可直接登录',
+							icon:'none',
+							duration: 2000
+						})
+						return
+					}
+					else{
+						uni.showLoading({
+							title: '登录中',
+							mask:true
+						})
+						this.$api.doRequest('get','/commonUser/login',{phone:this.phone,password:this.password}).then(res => {
+							// 获得数据
+							uni.setStorageSync('userInfo', res.data)
+							that.$store.commit('login', res.data)
+							that.liangxinLogin()
+							uni.switchTab({
+								url: '/pages/sale/information'
+							});
+							uni.hideLoading()
+						})
+						.catch(res => {
+							console.log(res);
+						});
+					}
 				})
 				.catch(res => {
 				    console.log(res);
@@ -891,7 +990,23 @@
 		background: url('../../static/img/login/bg.png');
 		background-size:100%;
 	}
-
+	.close{
+		width:20px;height:20px;position:absolute;
+		right:0px;
+	}
+	.close1{
+		width:20px;height:20px;position:absolute;
+		right:10px;
+		top:0;
+	}
+	.close2{
+		    width: 15px;
+		    height: 15px;
+		    position: absolute;
+		    right: 19px;
+		    top: 50%;
+		    transform: translateY(-45%);
+	}
 	.wrapper {
 		position: relative;
 		z-index: 90;

+ 78 - 37
pages/user/user.vue

@@ -11,7 +11,7 @@
 					<u-avatar v-else class="portrait" text=""></u-avatar>
 				</view>
 				<view class="info-box">
-					<view @click="toLogin" class="username">{{hasLogin? (userInfo.nickname || '点击设置昵称') : '立即登录' }}</view>
+					<view @click="toLogin" class="username">{{hasLogin? (userInfo.userName || '点击设置昵称') : '立即登录' }}</view>
 				</view>
 				<view class="qr-wrap">
 					<text class="cuIcon-qrcode"  @click="qrClick(userInfo)"></text>
@@ -32,13 +32,13 @@
 			<!-- <image class="arc" src="/static/arc.png"></image> -->
 <!-- 列表 -->
 						<view class="cu-list menu text-left solid-top">
-						<view class='cu-item' @click='myAccount'>
+						<!-- <view class='cu-item' @click='myAccount'>
 							<view>
 								<text class="cuIcon-sponsor icon text-grey"></text>
 								<text class="text-grey">我的名头</text>
 							</view>
 							<view class = 'tip_text cuIcon-right' ></view>
-						</view>
+						</view> -->
 						<view class="cu-item" v-for="(item, index) in gridList" v-if="item.show" :key="index" @click="gridClick(item, index)" hover-class="common-hover" :hover-stay-time="50">
 							<view>
 								<text :class="item.icon" class="grid_icon icon text-grey"></text>
@@ -52,13 +52,13 @@
 							
 						</view>
 						
-						<view class='cu-item' @click='scanCode'>
+						<!-- <view class='cu-item' @click='scanCode'>
 							<view>
 								<text class="cuIcon-scan icon text-grey"></text>
 							    <text class="text-grey">扫一扫</text>
 							</view>
 							<view class = 'tip_text cuIcon-right' ></view>
-						</view>
+						</view> -->
 						</view>
 						<view style='text-align:center;'>
 							<navigator url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/userAgreement.html" class="path" hover-class="navigator-hover">《服务协议》</navigator>|<navigator url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/screctAgreement.html"
@@ -109,33 +109,97 @@
 				inputStatus:'none',
 				carInfo:[],
 				gridList: [
+						// {
+						// 	num:0,
+						// 	name: '货源信息',
+						// 	icon:'cuIcon-apps',
+						// 	tips: 0,
+						// 	url:'/pages/tran/my_tran?TabCur=0',
+						// 	show:true
+						// },
+						// {
+						// 	num:1,
+						// 	name: '承运信息',
+						// 	icon:'cuIcon-calendar',
+						// 	tips: 0,
+						// 	url:'/pages/tran/my_tran?TabCur=1',
+						// 	show:true
+						// },
+						// {
+						// 	num:2,
+						// 	name: '我的合同',
+						// 	icon:'cuIcon-copy',
+						// 	tips: 0,
+						// 	url:'/pageB/contract/contract',
+						// 	show:true
+						// },
+						// {
+						// 	num:3,
+						// 	name: '消息列表',
+						// 	icon:'cuIcon-news',
+						// 	tips: 0,
+						// 	url:'/pages/user/message',
+						// 	show:true
+						// },
+						// {
+						// 	num:4,
+						// 	name: '任务中心',
+						// 	icon:'cuIcon-copy',
+						// 	tips: 0,
+						// 	url:`/pages/user/task`,
+						// 	show:true
+						// },
+						// {
+						// 	num:5,
+						// 	name: '我的车辆',
+						// 	icon:'cuIcon-deliver',
+						// 	tips: 0,
+						// 	url:'',
+						// 	show:true
+						// },
+						// {
+						// 	num:6,
+						// 	name: '联系我们',
+						// 	icon:'cuIcon-phone',
+						// 	tips: 0,
+						// 	url:'/pages/user/contact',
+						// 	show:true
+						// },
+						// {
+						// 	num:7,
+						// 	name: '退出登录',
+						// 	icon:'cuIcon-exit',
+						// 	tips: 0,
+						// 	url:'',
+						// 	show:true
+						// },
 						{
 							num:0,
-							name: '货源信息',
+							name: '身份认证',
 							icon:'cuIcon-apps',
 							tips: 0,
-							url:'/pages/tran/my_tran?TabCur=0',
+							url:'/pages/attestation/index',
 							show:true
 						},
 						{
 							num:1,
-							name: '承运信息',
+							name: '我的合同',
 							icon:'cuIcon-calendar',
 							tips: 0,
-							url:'/pages/tran/my_tran?TabCur=1',
+							url:'/pageB/contract/contract',
 							show:true
 						},
 						{
 							num:2,
-							name: '我的合同',
+							name: '我的任务',
 							icon:'cuIcon-copy',
 							tips: 0,
-							url:'/pageB/contract/contract',
+							url:'/pages/user/task',
 							show:true
 						},
 						{
 							num:3,
-							name: '消息列表',
+							name: '我的发布',
 							icon:'cuIcon-news',
 							tips: 0,
 							url:'/pages/user/message',
@@ -143,36 +207,12 @@
 						},
 						{
 							num:4,
-							name: '任务中心',
+							name: '货运收发',
 							icon:'cuIcon-copy',
 							tips: 0,
 							url:`/pages/user/task`,
 							show:true
 						},
-						{
-							num:5,
-							name: '我的车辆',
-							icon:'cuIcon-deliver',
-							tips: 0,
-							url:'',
-							show:true
-						},
-						{
-							num:6,
-							name: '联系我们',
-							icon:'cuIcon-phone',
-							tips: 0,
-							url:'/pages/user/contact',
-							show:true
-						},
-						{
-							num:7,
-							name: '退出登录',
-							icon:'cuIcon-exit',
-							tips: 0,
-							url:'',
-							show:true
-						},
 						
 					],
 					showTran:true,
@@ -182,6 +222,7 @@
 		},
 		
 		onShow() {
+			console.log(uni.getStorageSync('userInfo'))
 			uni.showTabBar()
 			this.loadData()
 		},

BIN
static/img/login/guanbi@2x.png