Browse Source

注册提示

zouling 1 năm trước cách đây
mục cha
commit
ad960fbf1a
3 tập tin đã thay đổi với 49 bổ sung12 xóa
  1. 2 2
      manifest.json
  2. 1 1
      pages/login.vue
  3. 46 9
      pages/register.vue

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "皖源融资担保",
     "appid" : "__UNI__FA20DEF",
     "description" : "",
-    "versionName" : "1.0.1",
-    "versionCode" : 101,
+    "versionName" : "1.0.2",
+    "versionCode" : 102,
     "transformPx" : false,
     "app-plus" : {
         "usingComponents" : true,

+ 1 - 1
pages/login.vue

@@ -141,7 +141,7 @@
 			},
 			voList:[],
 			voindex:0,
-			jzflag:false
+			jzflag:true
 		}
 	},
 	

+ 46 - 9
pages/register.vue

@@ -13,15 +13,16 @@
     <view class="login-form-content">
       <view class="input-item flex align-center">
         <view class="iconfont icon-user icon"></view>
-        <input v-model="registerForm.username" class="input" type="text" placeholder="请输入号" maxlength="30" />
+        <input v-model="registerForm.username" class="input" type="text" placeholder="请输入手机号" maxlength="30" />
       </view>
       <view class="input-item flex align-center">
         <view class="iconfont icon-password icon"></view>
-        <input v-model="registerForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
+		<uni-easyinput type="password" placeholderStyle="font-size: 28rpx;color: grey;" :inputBorder="false" v-model="registerForm.password" placeholder="请输入密码"></uni-easyinput>
       </view>
+	  
       <view class="input-item flex align-center">
         <view class="iconfont icon-password icon"></view>
-        <input v-model="registerForm.confirmPassword" type="password" class="input" placeholder="请输入重复密码" maxlength="20" />
+		<uni-easyinput type="password" placeholderStyle="font-size: 28rpx;color: grey;" :inputBorder="false" v-model="registerForm.confirmPassword" placeholder="请再次输入您的密码"></uni-easyinput>
       </view>
 	  <view  class="input-item flex align-center" >
 		<view class="iconfont icon-password icon"></view>
@@ -36,6 +37,7 @@
           <image :src="codeUrl" @click="getCode" class="login-code-img"></image>
         </view>
       </view>
+	  <view class="titico">*密码必须包含数字、大小写字母、特殊符号且大于8位</view>
       <view class="action-btn">
 		  <button @click="handleRegister()" type="primary" class=" rbtn mb24 mt50 btn2" >注册</button>
         <!-- <button  class="register-btn cu-btn block bg-blue lg round">注册</button> -->
@@ -48,8 +50,8 @@
 </template>
 
 <script>
-  import { getCodeImg, register,sendSmszcOnly } from '@/api/login.js'
-
+	import * as base64 from "base-64"
+  import { getCodeImg, register,sendSmszcOnly,getInfo } from '@/api/login.js'
   export default {
     data() {
       return {
@@ -60,6 +62,7 @@
 		tucode:'',
 		time:'',
         globalConfig: getApp().globalData.config,
+		jzflag:true,
         registerForm: {
           username: "",
           password: "",
@@ -133,8 +136,11 @@
 	  },
       // 注册方法
       async handleRegister() {
+		let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
         if (this.registerForm.username === "") {
-			this.$toast('请输入您的账号')
+			this.$toast('请输入您的手机号')
+		} else if (this.registerForm.username && !regphone.test(this.registerForm.username)) {
+			this.$toast('请输入正确的手机号')
         } else if (this.registerForm.password === "") {
 			this.$toast('请输入您的密码')
         } else if (this.registerForm.confirmPassword === "") {
@@ -151,14 +157,16 @@
       },
       // 用户注册
       async register() {
+		var that=this;
         register(this.registerForm).then(res => {
           this.$modal.closeLoading()
           uni.showModal({
           	title: "系统提示",
-          	content: "恭喜你,您的账号 " + this.registerForm.username + " 注册成功!",
+          	content: "恭喜你,您的账号 " + this.registerForm.username + " 注册成功!现在登录",
           	success: function (res) {
           		if (res.confirm) {
-                uni.redirectTo({ url: `/pages/login` });
+				that.pwdLogin()	
+                // uni.redirectTo({ url: `/pages/login` });
           		}
           	}
           })
@@ -168,6 +176,35 @@
           }
         })
       },
+	  // 密码登录
+	  async pwdLogin() {
+	  	var that=this;
+		var params={
+			username:this.registerForm.username,
+			password:this.registerForm.password,
+			type:1,//1:账号密码 2:手机登录
+		}
+	    this.$store.dispatch('Login', params).then((res) => {
+	  		if(that.jzflag){
+	  			var newObj={
+	  				username:params.username,
+	  				password:base64.encode(params.password),
+	  				captchaEnabled:that.captchaEnabled,
+	  			}	
+	  			uni.setStorageSync('account', JSON.parse(JSON.stringify(newObj)))
+	  		}else{
+	  			uni.removeStorageSync('account')
+	  		} 	  
+	      this.$modal.closeLoading()
+	  		  this.$toast('登录成功')
+	  		  setTimeout(function(){
+	  			  that.registerSuccess()
+	  		  },1500)
+	      
+	    }).catch((error) => {
+			
+	    })
+	  },
       // 注册成功后,处理函数
       registerSuccess(result) {
         // 设置用户信息
@@ -195,7 +232,7 @@
 }
 .codess{font-size: 30rpx;color: $com-cd3;flex: 0 0 auto;min-width: 200rpx;text-align: center;border-left: 2rpx solid #CDCDCD;}
 .codes{background: none;font-size: 28rpx;flex: 0 0 auto;width: 180rpx;text-align: center;border-left: 2rpx solid #CDCDCD;}
-
+.titico{font-weight: 500;font-size: 24rpx;color: #FF6969;}
   .normal-login-container {
     width: 100%;