Przeglądaj źródła

fix: 调整部分功能模块

wenxingxing 17 godzin temu
rodzic
commit
525fcdd2f9

+ 3 - 1
main.js

@@ -8,7 +8,7 @@ import uView from "@/node_modules/uview-ui";
 
 import {parseIDCardInfo,logout,checkCompanyUserLoginState,parseText,getDictLabelName,parseIdCard,getAge,parsePhone,isEmpty,getDict,
 isLogin,navBack,navTo,getUserInfo,formatHour,dateFormatStr,registerIdCode,updateMsgDot,handleBindCompanyFsUser,
-setSource,companyUserIsLogin,checkWechatInstalled,isIos,isAndroid,isAgreePrivacy,getDictLabel2Name} from './utils/common.js'
+setSource,companyUserIsLogin,checkWechatInstalled,isIos,isAndroid,isAgreePrivacy,getDictLabel2Name,urlToObj,loginOut} from './utils/common.js'
 
 import { showLoginPage,getRegistrationID } from './utils/login.js'
 import { formatSeconds,formatDate } from './utils/tools.js'
@@ -25,6 +25,8 @@ App.mpType = 'app'
 // Vuex 插件注册
 Vue.use(Vuex)
 Vue.use(uView);
+Vue.prototype.$loginOut = loginOut;
+Vue.prototype.$urlToObj = urlToObj;
 Vue.prototype.$getDict = getDict;
 Vue.prototype.$getDictLabel2Name = getDictLabel2Name;
 Vue.prototype.$checkCompanyUserLoginState = checkCompanyUserLoginState;

+ 1 - 1
pages/shopping/payOrder.vue

@@ -67,7 +67,7 @@
 				const url = decodeURIComponent(options.q)
 				this.url=url;
 				// // 对url中携带的参数提取处理
-				const obj = this.utils.urlToObj(url)
+				const obj = this.$urlToObj(url)
 				this.orderId=obj.orderId;
 		    }
 			else if(options!=null&&options.orderId!=null){

+ 4 - 2
pages/shopping/productDetails.vue

@@ -270,20 +270,22 @@ import {CustomToast} from '@/components/custom-toast.vue';
 				const url = decodeURIComponent(options.q)
 				this.url = url;
 				// // 对url中携带的参数提取处理
-				const obj = this.utils.urlToObj(url)
+				const obj = this.$urlToObj(url)
 				uni.setStorageSync('tuiUserId', obj.userId);
 			}
 			if(options.courseId){
 				this.courseId=options.courseId
 			}
+			/* #ifdef MP-WEIXIN */
 			uni.showShareMenu({
 				withShareTicket: true,
 				//小程序的原生菜单中显示分享按钮,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
 				menus: ["shareAppMessage", "shareTimeline"] //不设置默认发送给朋友
 			})
+			/* #endif */
 			this.getDicts();
 			this.productId = options.productId;
-			if (this.utils.checkToken()) {
+			if (this.$isLogin()) {
 				this.getCartCount();
 			}
 		},

+ 1 - 1
pages_company/order/productDetails.vue

@@ -208,7 +208,7 @@
 		onLoad(options) {
 			this.getDicts();
 			this.productId = options.productId;
-			if (this.utils.checkToken()) {
+			if (this.$isLogin()) {
 				this.getCartCount();
 			}
 		},

+ 1 - 1
pages_company/storeProductPackageDetails.vue

@@ -126,7 +126,7 @@
 				const url = decodeURIComponent(options.q)
 				this.url = url;
 				// // 对url中携带的参数提取处理
-				const obj = this.utils.urlToObj(url)
+				const obj = this.$urlToObj(url)
 				this.packageId = obj.packageId;
 				this.companyId = obj.companyId;
 				this.companyUserId = obj.companyUserId;

+ 1 - 1
pages_mall/homeIndex.vue

@@ -164,7 +164,7 @@ export default {
 		}
 		if (option.hasOwnProperty('q') && option.q) {
 			const url = decodeURIComponent(option.q)
-			const obj = this.utils.urlToObj(url)
+			const obj = this.$urlToObj(url)
 			uni.setStorageSync('userCode', obj.userCode)
 			if (this.$isLogin()) this.getUserInfo()
 		}

+ 1 - 1
pages_mall/payOrder.vue

@@ -67,7 +67,7 @@
 				const url = decodeURIComponent(options.q)
 				this.url=url;
 				// // 对url中携带的参数提取处理
-				const obj = this.utils.urlToObj(url)
+				const obj = this.$urlToObj(url)	
 				this.orderId=obj.orderId;
 		    }
 			else if(options!=null&&options.orderId!=null){

+ 1 - 1
pages_mall/productDetails.vue

@@ -269,7 +269,7 @@
 				const url = decodeURIComponent(options.q)
 				this.url = url;
 				// // 对url中携带的参数提取处理
-				const obj = this.utils.urlToObj(url)
+				const obj = this.$urlToObj(url)
 				uni.setStorageSync('tuiUserId', obj.userId);
 			}
 			// uni.showShareMenu({

+ 1 - 1
pages_mall/storeOrderDetail.vue

@@ -287,7 +287,7 @@
 		},
 		onShow() {
 			if(this.query&&!this.isBind) {
-				const params = this.utils.urlToObj(this.query)
+				const params = this.$urlToObj(this.query)
 				this.orderBindUser(params.orderId)
 			} else {
 				this.isBindMsg = ''

+ 1 - 1
pages_user/user/pay.vue

@@ -51,7 +51,7 @@
 		 //   	const url = decodeURIComponent(options.q)
 		 //   	this.url=url;
 		 //   	// // 对url中携带的参数提取处理
-		 //   	const obj = this.utils.urlToObj(url)
+		 //   	const obj = this.$urlToObj(url)
 			// console.log(obj)
 		 //   	this.companyId=obj.companyId;
 			// this.companyUserId=obj.companyUserId;

+ 1 - 1
pages_user/user/storeOrderDetail.vue

@@ -287,7 +287,7 @@
 		},
 		onShow() {
 			if(this.query&&!this.isBind) {
-				const params = this.utils.urlToObj(this.query)
+				const params = this.$urlToObj(this.query)
 				this.orderBindUser(params.orderId)
 			} else {
 				this.isBindMsg = ''

+ 1 - 1
pages_user/user/userTuiExtractLog.vue

@@ -93,7 +93,7 @@ export default {
 							this.nowMoney=res.user.nowMoney;
 						}
 						else{
-							this.utils.loginOut();
+							this.$loginOut();
 						}
 						
 					}else{

+ 1 - 1
pages_user/user/userTuiMoney.vue

@@ -79,7 +79,7 @@ export default {
 							this.brokeragePrice=res.user.brokeragePrice;
 						}
 						else{
-							this.utils.loginOut();
+							this.$loginOut();
 						}
 						
 					}else{

+ 5 - 1
utils/common.js

@@ -401,7 +401,7 @@ export function getAge(strBirthday) {
 }
 
 
-const urlToObj = function(url) {
+export function urlToObj(url) {
 	let obj = {}
 	let str = url.slice(url.indexOf('?') + 1)
 	let arr = str.split('&')
@@ -412,6 +412,10 @@ const urlToObj = function(url) {
 	return obj
 }
 
+export function loginOut() {
+	uni.clearStorage();
+}
+