zpj 2 жил өмнө
parent
commit
813ddc5ff2

+ 3 - 1
pages/index/index.vue

@@ -22,7 +22,7 @@
 				<view class="swiper-item">
 					<view class="index-2" v-if="index == 1">
 						<image class="text-img wow animate__animated animate__bounceInUp" src="@/static/img/czyq-text.png" mode="scaleToFill"></image>
-						<view class="fs-32 fc-F2D4A9 fw-b mb-24 wow animate__animated animate__bounceInUp">尊敬的用户</view>
+						<view class="fs-32 fc-F2D4A9 fw-b mb-24 wow animate__animated animate__bounceInUp">尊敬的{{userName?userName:'用户'}}</view>
 						<view class="fs-32 fc-F2D4A9 text-box wow animate__animated animate__bounceInUp">
 							您好!感谢百忙之中阅读此邀请函。
 							我们诚挚的邀请您参加于10月20日振合
@@ -118,6 +118,7 @@
 		components: {},
 		data() {
 			return {
+				userName:'',
 				fromData:{
 					m_id:'',
 					name:'',
@@ -131,6 +132,7 @@
 			}
 		},
 		onshow() {
+			this.userName = uni.getStorageSync('userNmae');
 			this.$wow.init();
 		},
 		methods: {

+ 5 - 4
service/router.js

@@ -18,7 +18,7 @@ const router = createRouter({
 });
 //全局路由前置守卫
 
-router.beforeEach((to, from, next) => { 
+router.beforeEach((to, from, next) => {
 	if(to.query.shopCode){
 		uni.setStorageSync("invite_code", to.query.shopCode);
 	}
@@ -29,7 +29,7 @@ router.beforeEach((to, from, next) => {
 	let isWeiXin = tools.isWx();
 	
 	if(isWeiXin){
-		let userToken = uni.getStorageSync('token')
+		let userToken = uni.getStorageSync('token_str')
 		if(userToken){
 			next();
 		}else{
@@ -58,7 +58,8 @@ router.beforeEach((to, from, next) => {
 				}
 				userWxAppletLogin(from).then((res)=>{
 					if (res.code === 1) {
-						uni.setStorageSync('token',res.data.token)
+						uni.setStorageSync('userNmae',res.data.name)
+						uni.setStorageSync('token_str',res.data.token)
 						uni.setStorageSync('m_id',res.data.m_id)
 						next(to.path)
 					} else {
@@ -66,7 +67,7 @@ router.beforeEach((to, from, next) => {
 					}
 				})
 			}else{
-				uni.removeStorageSync('token')
+				uni.removeStorageSync('token_str')
 				uni.removeStorageSync('m_id')
 				tools.wxLogin();
 			}