Explorar o código

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
提交

1004749546@qq.com %!s(int64=4) %!d(string=hai) anos
pai
achega
f7960a7201
Modificáronse 4 ficheiros con 29 adicións e 34 borrados
  1. 2 2
      App.vue
  2. 4 3
      api/login.js
  3. 20 28
      pages/index/index.vue
  4. 3 1
      pages/login/login.vue

+ 2 - 2
App.vue

@@ -1,6 +1,6 @@
 <script>
-	const uat_URL = 'http://md.test.zyucgj.com/saas/clz/' // 预发布
-	// const uat_URL = 'http://192.168.16.103:9110/saas/clz/' // 本地
+	// const uat_URL = 'http://md.test.zyucgj.com/saas/clz/' // 预发布
+	const uat_URL = 'http://192.168.16.105:8103/cw-wechat/' // 本地
 	const pro_URL = 'https://car.zyucgj.com/saas/clz/'  // 生产
 	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url

+ 4 - 3
api/login.js

@@ -2,9 +2,10 @@ import axios from '@/libs/axios.js';
 
 export const login = params => {
   return axios.request({
-    url: `loginVerify`,
-    data: params,
+    url: `login`,
     method: 'post',
+	headers: { 'content-type': 'application/x-www-form-urlencoded' },
+	data:`code=${params.code}&encryptedData=${params.encryptedData}&iv=${params.iv}`
   }).then(res => res.data);
 };
 export const logout = params => {
@@ -20,7 +21,7 @@ export const checkLogin = () => {
   let token = uni.getStorageSync('token')
   if (token&&token!='') {
     return axios.request({
-      url: `checkLogin`,
+      url: `checkToken`,
       method: 'get'
     }).then(res => res.data);
   } else {

+ 20 - 28
pages/index/index.vue

@@ -116,19 +116,11 @@
 		methods: {
 			// 检验登录token是否过期
 			checkLogin () {
-				uni.checkSession({
-					success:(res) => {
-						console.log('已登录')
-						checkLogin().then(res =>{
-							if (res.status == '200'){
-								this.hasLogin = true
-							} else {
-								this.hasLogin = false
-							}
-						})
-					},
-					fail: (err) => {
-						console.log('登录过期')
+				checkLogin().then(res =>{
+					console.log(res,'11111111111')
+					if (res.status == '200'){
+						this.hasLogin = true
+					} else {
 						this.hasLogin = false
 					}
 				})
@@ -249,21 +241,21 @@
 			},
 			// 扫码洗车
 			scanCode () {
-				uni.navigateTo({
-					url: '/pages/getOrder/getOrder'
-				})
-				// if (this.hasLogin) {
-				// 	uni.scanCode({
-				// 	    success: function (res) {
-				// 	        console.log('条码类型:' + res.scanType);
-				// 	        console.log('条码内容:' + res.result);
-				// 	    }
-				// 	});
-				// } else {
-				// 	uni.navigateTo({
-				// 		url: '/pages/login/login'
-				// 	})
-				// }
+				// uni.navigateTo({
+				// 	url: '/pages/getOrder/getOrder'
+				// })
+				if (this.hasLogin) {
+					uni.scanCode({
+					    success: function (res) {
+					        console.log('条码类型:' + res.scanType);
+					        console.log('条码内容:' + res.result);
+					    }
+					});
+				} else {
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				}
 				
 			},
 			// 创建标记点

+ 3 - 1
pages/login/login.vue

@@ -1,6 +1,8 @@
 <template>
 	<view class="content">
-		<u-button type="success" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信一键登录</u-button>
+		<u-form :model="form" ref="uForm">
+			<u-button type="success" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信一键登录</u-button>
+		</u-form>
 	</view>
 </template>