lyqu %!s(int64=4) %!d(string=hai) anos
pai
achega
f4361f4132

+ 2 - 2
common/conf/config.js

@@ -5,10 +5,10 @@ const appId = 'wx7e7a38f071b360e9';
 const appSecret = '4e862f91b48ac85a91380fa0991c9fda';
 
 //经过编码后的回调地址
-const redireactUrl = 'https://vote.guosen-fumao.cn/vote-h5/index.html#/pages/activityList/home/home';
+const redireactUrl = 'https://vote.guosen-fumao.cn/vote-h5/index.html#/pages/activityList/home/home?activityId=';
 
 //获取用户授权信息Code
-const authUrl =  `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(redireactUrl)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
+const authUrl = (activity) => { return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(redireactUrl+activity)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`};
 
 //获取用户的Access-token
 const atUrl = (code) =>{ return `https://api.weixin.qq.com/sns/oauth2/access_token?appid=${appId}&secret=${appSecret}&code=${code}&grant_type=authorization_code`}

+ 2 - 0
common/http/http.api.js

@@ -13,6 +13,7 @@ let activityUrl = {
 let userUrl = {
 	boostUrl: 'cyzh-activity/activity/getHitPersonDetail',
 	loginUrl: '/cyzh-loginUser/loginuser/login',
+	detailUrl: '/cyzh-loginUser/loginuser/detail',
 }
 // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
 // https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
@@ -31,6 +32,7 @@ const install = (Vue, vm) => {
 	let user = {
 		boost:(params = {}) => vm.$u.get(userUrl.boostUrl, params),
 		login:(params = {}) => vm.$u.post(userUrl.loginUrl, params),
+		detail:(params = {}) => vm.$u.post(userUrl.detailUrl, params),
 	}
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {wxInfo, activity, user};

+ 1 - 1
common/http/http.interceptor.js

@@ -1,5 +1,5 @@
  let baseUrl = 'https://vote.guosen-fumao.cn/ldt/api'
-   // let baseUrl = 'http://gxcadmin.guosen-fumao.cn:1888/api'
+   // let baseUrl = 'http://192.168.1.168:9612'
 let tokenUrl = `${baseUrl}/blade-auth/oauth/token?tenantId=000000&username=admin&password=21232f297a57a5a743894a0e4a801fc3&grant_type=password&scope=all&type=account`
 
 let myConfig={}

+ 13 - 8
components/homeViews/mine-view.vue

@@ -74,15 +74,14 @@
 	import {authUrl } from '@/common/conf/config.js'
 	export default {
 		props: {
-			userData: {
-				type: Object,
-				default() {
-					return {}
-				}
+			activityId: {
+				type: String,
+				default: '',
 			}
 		},
 		data() {
 			return {
+				userData: {},
 				hotVaule: '205',
 				points: '886',
 				isLogin: false,
@@ -100,20 +99,26 @@
 			}
 		},
 		mounted() {
-			if (this.$u.test.isEmpty(this.userData)) {
+			if (this.$u.test.isEmpty(uni.getStorageSync("userId"))) {
 				this.isLogin = false;
 			} else {
 				this.isLogin = true;
+				this.getUserInfo();
 			}
 		},
 		methods: {
 			toAuth() {
-				 window.location.href = authUrl;
+				 window.location.href = authUrl(this.activityId);
+			},
+			getUserInfo() {
+				this.$u.api.user.detail({id: this.userId}).then(res => {
+					this.userData = res;
+				})
 			},
 			//跳转需要带参数
 			edit() {
 				uni.navigateTo({
-					url: '/pages/activityList/mine/edit?openid=' + this.userData.openid
+					url: '/pages/activityList/mine/edit'
 				})
 			},
 			navByIcon(url) {

+ 16 - 8
components/indexViews/mine-view.vue

@@ -13,6 +13,20 @@
 				<tkiBarcode cid="itf14" :loadMake="false" format="itf14" val="1234567890123" ref="itf14" @result="itf14" />
 			</view>
 		</view>
+		<view class="text-bold text-black" style="padding: 0 0 30upx 30upx;">我的账户</view>
+		<view class="flex">
+			<view>
+				<view>2000</view>
+				<view>我的积分</view>
+			</view>
+			<view>
+				<view>+200</view>
+				<view>昨日收益</view>
+			</view>
+			<view>
+				<image src="/static/ldt/swapPoints.png" style="width: 41upx;height: 37upx;"></image>
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -24,17 +38,11 @@
 		},
 		data() {
 			return {
-				bar: ['itf14'],
+				
 			}
 		},
 		mounted() {
-			setTimeout(() => {
-				for (let index = 0; index < this.bar.length; index++) {
-					setTimeout(() => {
-						this.$refs[this.bar[index]]._makeCode()
-					}, 1000 * index);
-				}
-			}, 1000);
+			this.$refs['itf14']._makeCode()
 		},
 		methods: {
 			itf14(v) {

+ 17 - 20
pages/activityList/home/home.vue

@@ -6,7 +6,7 @@
 		</view>
 		<!--个人中心-->
 		<view v-if="current == 2">
-			<mine-view :userData="userData"></mine-view>
+			<mine-view :activityId="activityId"></mine-view>
 		</view>
 		<view style="height: 100upx;"></view>
 		<view class="footer-fixed">
@@ -38,37 +38,34 @@
 					{image: '/static/swiper1.png'},
 					{image: '/static/swiper1.png'}
 				],
-				userData: {},
 			}
 		},
 		onLoad(options) {
 			this.activityId = options.activityId;
-			
+			this.authorization();
 		},
 		methods: {
 			async authorization() {
 				let params = getUrlParams(window.location.search);
-				let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
-				this.userData = res.data;
-				let params={
-					nickName:res.data.nickname,
-					avatar:res.data.headimgurl,
-					gender:res.data.sex,
-					openid:res.data.openid,
-					unionid:res.data.unionid
-				}
-				this.$u.api.user.login(params).then(res=>{
-					if (res.success) {
-						uni.setStorageSync("userId",res.data.id)
-						//登录成功
+				if (!this.$u.test.isEmpty(params.code)) {
+					let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
+					console.log("是否登录",res);
+					let datas = {
+						nickName: res.nickname,
+						avatar: res.headimgurl,
+						gender: res.sex,
+						openid: res.openid,
+						unionid: res.unionid
+					}
+					let result = await this.$u.api.user.login(datas);
+					console.log("登录后",result)
+					if (result.success) {
+						uni.setStorageSync("userId", res.data.id);
 					}
-				})
+				}
 			},
 			change(index) {
 				this.current = index;
-				if (this.current == 2 && this.$u.test.isEmpty(uni.getStorageSync("userId"))) {
-					 this.authorization();
-				}
 			}
 		}
 	}

BIN=BIN
static/ldt/recharge.png


BIN=BIN
static/ldt/swapPoints.png