hmp 4 ani în urmă
părinte
comite
076aa67c29

+ 2 - 2
common/utils/global.js

@@ -1,6 +1,6 @@
 let global = {
-	// baseUrl: 'https://vote.guosen-fumao.cn/ldt/api'
-	baseUrl: 'http://192.168.1.168:9612'
+	baseUrl: 'https://vote.guosen-fumao.cn/ldt/api'
+	// baseUrl: 'http://192.168.1.168:9612'
 }
 
 export default global

+ 30 - 36
common/utils/share.js

@@ -1,45 +1,39 @@
-import wx from'weixin-js-sdk'
+import wx from 'weixin-js-sdk'
 const url = (window.location.href.split('#')[0])
-// const url = window.location.href
-// const url ="http://vote.guosen-fumao.cn/vote-h5/index.html"
-// shareData{
-// 	title: , // 分享标题
-// 	desc: , // 分享描述
-// 	link: , // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
-// 	imgUrl: '', // 分享图标
-// }
-export const shareConfig =(shareData,vm) => {
-	vm.$u.api.wxInfo.getWxShareData({url}).then(res=>{
+export const shareConfig = (shareData, vm) => {
+	vm.$u.api.wxInfo.getWxShareData({
+		url
+	}).then(res => {
 		wx.config({
-		  debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-		  appId: res.appId, // 必填,公众号的唯一标识
-		  timestamp: res.timestamp, // 必填,生成签名的时间戳
-		  nonceStr: res.nonceStr, // 必填,生成签名的随机串
-		  signature: res.signature,// 必填,签名
-		  jsApiList: [
-			  "updateAppMessageShareData",
-			  "updateTimelineShareData"
-		  ]
+			debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+			appId: res.appId, // 必填,公众号的唯一标识
+			timestamp: res.timestamp, // 必填,生成签名的时间戳
+			nonceStr: res.nonceStr, // 必填,生成签名的随机串
+			signature: res.signature, // 必填,签名
+			jsApiList: [
+				"updateAppMessageShareData",
+				"updateTimelineShareData"
+			]
 		});
 		//分享到好友
-		wx.ready(function () {   
-		  wx.updateAppMessageShareData({ 
-			...shareData,
-		    success: function () {
-		      console.log("配置成功1");
-		    }
-		  })
+		wx.ready(function() {
+			wx.updateAppMessageShareData({
+				...shareData,
+				success: function() {
+					console.log("配置成功1");
+				}
+			})
 		});
 		//分享到朋友圈
-		wx.ready(function () {      
-		  wx.updateTimelineShareData({ 
-		    ...shareData,
-		    success: function () {
-		      console.log("配置成功2");
-		    },
-		  })
-		}); 
-		wx.error(function(res){
+		wx.ready(function() {
+			wx.updateTimelineShareData({
+				...shareData,
+				success: function() {
+					console.log("配置成功2");
+				},
+			})
+		});
+		wx.error(function(res) {
 			console.log(res);
 		});
 	})

+ 7 - 1
components/homeViews/mine-view.vue

@@ -3,7 +3,10 @@
 		<view class="container">
 			<view class="flex justify-between align-center" style="height: 200upx;" v-if="isLogin">
 				<view class="padding-left">
-					<view class="text-black text-bold text-xl">{{userData.nickName}}</view>
+					<view class="text-black text-bold text-xl">
+						{{userData.nickName}}
+						<u-button @click="logout" size="mini" style="margin-left: 10rpx;">退出</u-button>
+					</view>
 					<view class="flex align-center padding-top-sm">
 						<view>
 							<view class="text-black text-bold">{{+userData.totalHot}}</view>
@@ -117,6 +120,9 @@
 			}
 		},
 		methods: {
+			logout(){
+				uni.clearStorage()
+			},
 			toAuth() {
 				let param = "pages/activityList/home/home?current=2&activityId=" + this.activityId;
 				window.location.href = authUrl(param);

+ 7 - 0
main.js

@@ -13,6 +13,13 @@ Vue.component('mescroll-body', MescrollBody)
 import mescrollUni from "@/components/mescroll-body/mescroll-uni.vue"
 Vue.component('mescrollUni', mescrollUni)
 
+import {shareConfig} from "@/common/utils/share.js"
+Vue.prototype.$shareConfig = shareConfig
+
+// 全局注入
+import Mixin from './common/utils/mixin.js'
+Vue.mixin(Mixin)
+
 // 微信函数封装
 import mpi from './common/utils/mpi.js'
 Vue.prototype.$mpi = mpi

+ 7 - 1
pages/activityList/activity/authorBoost.vue

@@ -183,6 +183,7 @@
 				}
 			},
 			async authorization() {
+				let agenterId=uni.getStorageSync("agenterId")
 				let params = getUrlParams(window.location.search);
 				if (!this.$u.test.isEmpty(params.code)) {
 					let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
@@ -191,7 +192,12 @@
 						avatar: res.headimgurl,
 						gender: res.sex,
 						openid: res.openid,
-						unionid: res.unionid
+						unionid: res.unionid,
+						province:res.province,
+						city:res.city
+					}
+					if (!this.$u.test.isEmpty(agenterId)) {
+						datas.agenterId=agenterId
 					}
 					let result = await this.$u.api.user.login(datas);
 					if (result) {

+ 7 - 1
pages/activityList/activity/musicBoost.vue

@@ -184,6 +184,7 @@
 				}
 			},
 			async authorization() {
+				let agenterId=uni.getStorageSync("agenterId")
 				let params = getUrlParams(window.location.search);
 				if (!this.$u.test.isEmpty(params.code)) {
 					let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
@@ -192,7 +193,12 @@
 						avatar: res.headimgurl,
 						gender: res.sex,
 						openid: res.openid,
-						unionid: res.unionid
+						unionid: res.unionid,
+						province:res.province,
+						city:res.city
+					}
+					if (!this.$u.test.isEmpty(agenterId)) {
+						datas.agenterId=agenterId
 					}
 					let result = await this.$u.api.user.login(datas);
 					if (result) {

+ 7 - 1
pages/activityList/goods/detail.vue

@@ -236,6 +236,7 @@
 				}
 			},
 			async authorization() {
+				let agenterId=uni.getStorageSync("agenterId")
 				let params = getUrlParams(window.location.search);
 				if (!this.$u.test.isEmpty(params.code)) {
 					let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
@@ -244,7 +245,12 @@
 						avatar: res.headimgurl,
 						gender: res.sex,
 						openid: res.openid,
-						unionid: res.unionid
+						unionid: res.unionid,
+						province:res.province,
+						city:res.city
+					}
+					if (!this.$u.test.isEmpty(agenterId)) {
+						datas.agenterId=agenterId
 					}
 					let result = await this.$u.api.user.login(datas);
 					if (result) {

+ 7 - 1
pages/activityList/home/home.vue

@@ -56,6 +56,7 @@
 		},
 		methods: {
 			async authorization(current) {
+				let agenterId=uni.getStorageSync("agenterId")
 				let params = getUrlParams(window.location.search);
 				if (!this.$u.test.isEmpty(params.code)) {
 					let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
@@ -64,7 +65,12 @@
 						avatar: res.headimgurl,
 						gender: res.sex,
 						openid: res.openid,
-						unionid: res.unionid
+						unionid: res.unionid,
+						province:res.province,
+						city:res.city
+					}
+					if (!this.$u.test.isEmpty(agenterId)) {
+						datas.agenterId=agenterId
 					}
 					let result = await this.$u.api.user.login(datas);
 					if (result) {

+ 0 - 10
pages/index/index.vue

@@ -14,7 +14,6 @@
 </template>
 
 <script>
-	import {shareConfig} from "../../common/utils/share.js"
 	import indexView from "@/components/indexViews/home-view.vue";
 	import bottomBarIndex from "@/components/basic/bottom-bar-index.vue";
 	import mineView from "@/components/indexViews/mine-view.vue";
@@ -30,15 +29,6 @@
 				
 			}
 		},
-		mounted() {
-			let shareData={
-				title:'分享测试',
-				desc:'desc',
-				link:'/pages/activityList/index',
-				imgUrl:'https://upload-file-data.obs.cn-south-1.myhuaweicloud.com/998ed30b0aa24201bdd9aba608fbfab0-banner2.jpg'
-			}
-			shareConfig(shareData,this)
-		},
 		methods: {
 			change(index) {
 				this.current = index;