Просмотр исходного кода

调整授权相关

Signed-off-by: liujd <960088692@qq.com>
liujd 6 лет назад
Родитель
Сommit
1c3715a886
3 измененных файлов с 6 добавлено и 34 удалено
  1. 0 31
      mobile-code/src/utils/auth.js
  2. 0 1
      mobile-code/src/utils/pay/wxPay.js
  3. 6 2
      mobile-code/src/utils/util.js

+ 0 - 31
mobile-code/src/utils/auth.js

@@ -107,37 +107,6 @@ export async function wxLoginFn(update) {
 	return dataInfo
 }
 
-/**
- * 获取检查是否登录
- */
-export async function getCheckLogin() {
-	let status = false
-	let token = uni.getStorageSync('token')
-	if (token) {
-		status = true
-	} else {
-		// #ifdef H5
-		location.href = `${CONSTANT.hostUrl}/auth/prepare?url=${encodeURIComponent(getMiniAppUrl(this.option, true))}`
-		// #endif
-		// #ifndef H5
-		// #endif
-	}
-	// await checkLogin().then((res) => {
-	//   if (res.status === 'success') {
-	// 		status = true
-	//   } else {
-	// 		uni.removeStorageSync('token')
-	// 		uni.removeStorageSync('user_id')
-	//   }
-	// }).catch(() => {
-	// 	uni.removeStorageSync('token')
-	// 	uni.removeStorageSync('user_id')
-	// 	uni.removeStorageSync('wxMobile')
-	// })
-
-	return status
-}
-
 // export default {
 // 	getSelfInfo,
 // 	getUser,

+ 0 - 1
mobile-code/src/utils/pay/wxPay.js

@@ -65,7 +65,6 @@ wexinPay = (data, cb, errorCb) => {
 wexinPay = (payParams, cb, errorCb) => {
 	// console.log(payParams, 'payParams')
 	const { timeStamp, nonceStr, signType, paySign } = payParams
-	const that = this
 	uni.requestPayment({
 		provider: 'wxpay',
 		timeStamp: timeStamp + '',

+ 6 - 2
mobile-code/src/utils/util.js

@@ -1,6 +1,6 @@
 import CONSTANT from '@/constant'
 import { mobileReg } from '@/utils/tools/validate'
-import { getMiniAppUrl } from '@/utils/common'
+import { getMiniAppUrl, isWxBrowser } from '@/utils/common'
 // 是否为空
 const isEmpty = (val) => {
 	if (val instanceof Array) {
@@ -78,7 +78,11 @@ export async function getCheckLogin() {
 		status = true
 	} else {
 		// #ifdef H5
-		location.href = `${CONSTANT.hostUrl}/auth/prepare?url=${encodeURIComponent(getMiniAppUrl(this.option, true))}`
+		if (isWxBrowser) {
+			location.href = `${CONSTANT.hostUrl}/auth/prepare?url=${encodeURIComponent(getMiniAppUrl(this.option, true))}`
+		} else {
+			this.$msg('请用微信浏览器打开!')
+		}
 		// #endif
 		// #ifndef H5
 		// #endif