Explorar el Código

feat:登陆接口联调

DaMowang hace 3 años
padre
commit
9d3d69d4f6
Se han modificado 3 ficheros con 24 adiciones y 50 borrados
  1. 6 6
      src/pages.json
  2. 16 44
      src/pages/my/login.vue
  3. 2 0
      src/request/config.js

+ 6 - 6
src/pages.json

@@ -1,5 +1,11 @@
 {
 	"pages": [
+		{
+			"path": "pages/my/login",
+			"style":{
+				"navigationBarTitleText": "登录"
+			}
+		},
 		{
 			"path": "pages/index/index",
 			"style":{
@@ -24,12 +30,6 @@
 				"navigationBarTitleText": "我的"
 			}
 		},
-		{
-			"path": "pages/my/login",
-			"style":{
-				"navigationBarTitleText": "登录"
-			}
-		},
 		{
 			"path": "pages/protocol/index",
 			"style":{

+ 16 - 44
src/pages/my/login.vue

@@ -7,7 +7,7 @@
         <view class="phoneL" v-if="LoginType == 1">
             <view class="clearfix"><input v-model="formD2.mobile" placeholder="请输入手机号" type="number" maxlength="11" /></view>
             <view class="clearfix">
-                <input v-model="formD2.verifyCode" placeholder="请输入验证码" confirm-type="go" type="number" maxlength="4" class="w70" />
+                <input v-model="formD2.captcha" placeholder="请输入验证码" confirm-type="go" type="number" maxlength="5" class="w70" />
                 <view @click="getVerifyCode" :class="{w30:true,corb:msgNum!=='获取验证码'}">{{msgNum}}</view>
             </view>
         </view>
@@ -44,8 +44,7 @@ export default {
             },
             formD2: {
                 mobile: '',
-                verifyCode: "",
-                nationCode: "86",
+                captcha: "",
             },
             verifyimage: "",
 
@@ -58,8 +57,8 @@ export default {
         };
     },
     onLoad(option) {
-        this.changVerifyimage(); //获取图形验证码
-        this.getKey();
+        // this.changVerifyimage(); //获取图形验证码
+        // this.getKey();
     },
     onLaunch() {},
     onShow() {},
@@ -74,32 +73,11 @@ export default {
                 });
                 return
             }
-            if (this.LoginType == 1) {
-                post("login/login/verifyCode.do?fd=3", {
-                    params: {
-                        ...this.formD2,
-                        messageId: this.messageId
-                    }
-                }).then((res) => {
-                    if (res.resultCode == 1) {
-                        this.getuserInfo();
-                    }
-                });
-            } else {
-                post("login/login/password.do?fd=3", {
-                    params: {
-                        ...this.formD,
-                        password: this.$md5(this.$md5(this.formD.password)),
-                    },
-                    timestamp: parseInt((new Date()) / 1000)
-                }).then((res) => {
-                    if (res.resultCode == 1) {
-                        this.getuserInfo();
-                    } else {
-                        if (res.errorMessage == "验证码不正确") this.changVerifyimage();
-                    }
-                });
-            }
+            post("login",this.formD2).then((res) => {
+                // if (res.resultCode == 1) {
+                //     this.getuserInfo();
+                // }
+            });
         },
         getuserInfo() {
             post("srjywxservice/user2/myInfo.do").then((res) => {
@@ -123,18 +101,12 @@ export default {
             })
         },
         getVerifyCode() {
-            post("login/login/getVerifyCodeWithSign.do?fd=3", {
-                params: {
-                    ...this.formD2,
-                    randomStr: this.signKey,
-                    timeStamp: this.timestamp,
-                    sign: this.$md5(this.$md5("99D8EDED73FFCE0981E19D7CA1A58FF3" + this.signKey + this.timestamp)),
-                },
-                timestamp: this.timestamp
+            if (!this.isPhone(this.formD2.mobile)) return
+            post("getSms", {
+                mobile: this.formD2.mobile
             }).then((res) => {
-                if (res.resultCode == 1) {
-                    this.messageId = res.data.messageId;
-                    let number = 60;
+                if (res.code === 0) {
+                    let number = 59;
                     let as = setInterval(() => {
                         this.msgNum = number + "s后重发"
                         number--;
@@ -152,8 +124,8 @@ export default {
         FillIn() {
             if (this.LoginType == 1) {
                 let m = this.formD2.mobile
-                let v = this.formD2.verifyCode
-                if (m && v && v.length == 4 && this.isPhone(m)) this.ISFill = true
+                let v = this.formD2.captcha
+                if (m && v && v.length == 5 && this.isPhone(m)) this.ISFill = true
                 else this.ISFill = false
             } else {
                 let u = this.formD.username

+ 2 - 0
src/request/config.js

@@ -11,7 +11,9 @@ if(process.env.UNI_PLATFORM==="h5"){
 }
 
 export default apis==1?{
+	// Hhost: "http://api_test.haocha13.cn/v1/",
 	Hhost: "https://shop.haocha13.cn/",
 }:{
+	// Hhost: "http://api_test.haocha13.cn/v1/",
 	Hhost: "https://shop.haocha13.cn/",
 }