Преглед изворни кода

feat:新增小程序已扫码的接口

xuqiaoying пре 3 година
родитељ
комит
c53aa34333
4 измењених фајлова са 23 додато и 3 уклоњено
  1. 8 0
      common/httpList/login.js
  2. 3 2
      common/request.js
  3. 4 1
      pages4/login/login.vue
  4. 8 0
      pages4/login/pcLogin.vue

+ 8 - 0
common/httpList/login.js

@@ -163,5 +163,13 @@ export default {
 			method: 'post',
 			data: data
 		})
+	},
+	// 小程序已扫码
+	scanhasCode(data) {
+		return myRequest({
+			url: '/scan_code',
+			method: 'get',
+			data: data
+		})
 	}
 }

+ 3 - 2
common/request.js

@@ -5,9 +5,10 @@ import api from './api.js'
 var num = 1
 //接口api   
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
-export const BASE_URL = 'https://test.xyyxt.net'   //预发布
+// export const BASE_URL = 'https://test.xyyxt.net'   //预发布
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
-// export const BASE_URL = 'http://192.168.1.222:5055'    //dev
+// export const BASE_URL = 'http://192.168.1.222:5055'    //后端本地更新到222
+export const BASE_URL = 'http://192.168.1.24:5055'    //后端本地
 
  //图片上传api
 // export const BASE_IMG_URL = 'https://file.xyyxt.net/'     //release

+ 4 - 1
pages4/login/login.vue

@@ -512,8 +512,9 @@ export default {
 				//未完善信息,存为临时信息
 				uni.setStorageSync('user_account_temp', res.data.data.user_account);
 				uni.setStorageSync('token_temp', res.data.data.token);
+				console.log('scanCode====', this.scanCode)
 				if (this.scanCode) {
-					this.$navTo.togo('/pages2/register/bind', this.scanCode)
+					this.$navTo.togo('/pages2/register/bind', {scanCode: this.scanCode})
 				} else {
 					this.$navTo.togo('/pages2/register/bind');
 				}
@@ -530,6 +531,8 @@ export default {
 					uni.navigateTo({
 						url: '/pages4/login/pcLoginSuccess'
 					})
+				} else {
+					this.$u.toast(res.data.msg)
 				}
 			})
 		}

+ 8 - 0
pages4/login/pcLogin.vue

@@ -28,6 +28,14 @@ export default {
         this.scanCode = q.substring(q.length - 6)
         // const time = parseInt(query.scancode_time)
         console.log('扫描后得:', q, this.scanCode)
+        // 扫描二维码后调用,小程序已扫码
+        if (this.scanCode) {
+            this.$api.scanhasCode({scanCode: this.scanCode}).then((res) => {
+                if (res.data.code == 200) {
+                    console.log('扫码成功')
+                }
+            })
+        }
 	},
     methods: {
         pcLogin() {