Kaynağa Gözat

登录方式优化

shish 4 gün önce
ebeveyn
işleme
28202e0a0b

+ 3 - 2
ghsApp/src/admin/home/login.vue

@@ -197,7 +197,7 @@
 import { mapActions } from "vuex";
 import { getShopInfo} from "@/utils/auth";
 import {appLogin, sendLoginSms, smsLogin} from '@/api/common'
-import { getDictionaries,postWxCode } from '@/api/mini'
+import { getDictionaries,postWxCode,getMiniMobile } from '@/api/mini'
 import { phoneLogin,wxMobileLogin } from "@/api/auth";
 
 export default {
@@ -459,7 +459,8 @@ export default {
 			let that = this
 			let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
 			if (e.detail.errMsg === "getPhoneNumber:ok") {
-				wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
+				let code = e.detail.code
+				getMiniMobile({ code: code, miniOpenId: currentMiniOpenId }).then(subRes => {
 							uni.hideLoading()
 							if(subRes.data && subRes.data.hasNoOpenId && subRes.data.hasNoOpenId ==1){
 								that.$util.confirmModal({content:'网络异常,请重新操作'},() => {

+ 7 - 0
ghsApp/src/api/mini/index.js

@@ -26,6 +26,13 @@ export const getWxPhone = data => {
 	return https.post('/admin/mini-mobile', data)
 }
 
+/** *
+ * 点击授权获取手机号 mini (新接口)
+ */
+export const getMiniMobile = data => {
+	return https.post('/auth/get-mini-mobile', data)
+}
+
 export const bindAutoLogin = data => {
 	return https.post('/admin/bind-auto-login', data)
 }

+ 4 - 3
hdApp/src/admin/home/login.vue

@@ -176,7 +176,7 @@
 import { mapActions } from "vuex";
 import { getShopInfo} from "@/utils/auth";
 import {appLogin, sendLoginSms, smsLogin} from '@/api/common'
-import { getDictionaries,postWxCode } from '@/api/mini'
+import { getDictionaries,postWxCode,getMiniMobile } from '@/api/mini'
 import { phoneLogin,wxMobileLogin } from "@/api/auth";
 import { ghsInfo } from "@/api/ghs/index";
 export default {
@@ -336,7 +336,8 @@ export default {
 		let that = this
 		let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
 		if (e.detail.errMsg === "getPhoneNumber:ok") {
-			wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
+			let code = e.detail.code
+			getMiniMobile({ code: code, miniOpenId: currentMiniOpenId }).then(subRes => {
 						uni.hideLoading()
 						if(subRes.data && subRes.data.hasNoOpenId && subRes.data.hasNoOpenId == 1){
 							that.$util.confirmModal({content:'网络异常,请刷新重试'},() => {
@@ -406,8 +407,8 @@ export default {
 									// H5 直接访问登录页,没有上一页,回首页
 									uni.reLaunch({ url: '/admin/home/workbench' })
 								}
+							}
 						}
-					}
 				});
 		} else {
 			this.$msg("登录失败");

+ 7 - 0
hdApp/src/api/mini/index.js

@@ -26,6 +26,13 @@ export const getWxPhone = data => {
 	return https.post('/admin/mini-mobile', data)
 }
 
+/** *
+ * 点击授权获取手机号 mini (新接口)
+ */
+export const getMiniMobile = data => {
+	return https.post('/auth/get-mini-mobile', data)
+}
+
 export const bindAutoLogin = data => {
 	return https.post('/admin/bind-auto-login', data)
 }