LinWuTai hai 20 horas
pai
achega
40d0fa3e98
Modificáronse 2 ficheiros con 63 adicións e 59 borrados
  1. 1 34
      pages/chat/chat.vue
  2. 62 25
      pages/personalCenter/personalCenter.vue

+ 1 - 34
pages/chat/chat.vue

@@ -82,40 +82,7 @@
 		pageNumber: 1,
 		pageSize: 10
 	})
-	const list = ref([
-		{
-			id: '1',
-			title: '会费缴交成功通知',
-			content: '尊敬的用户,您在2023年8月16日15:00成交缴交会费……',
-			type: 'zhifu',
-			createTime: '8/21',
-			read: true
-		},
-		{
-			id: '2',
-			title: '继续教育通知',
-			content: '尊敬的用户,您预约2023年8月16日《广州市存量房网……',
-			type: 'jiaoyu',
-			createTime: '8/20',
-			read: true
-		},
-		{
-			id: '3',
-			title: '课程购买成功通知',
-			content: '尊敬的用户,您在成功购买2023年8月16日《广州市存……',
-			type: 'goumai',
-			createTime: '8/19',
-			read: true
-		},
-		{
-			id: '4',
-			title: '个人会员生日祝福',
-			content: '尊敬的用户,今日是您的生日,协会祝你在……',
-			type: 'shengri',
-			createTime: '8/16',
-			read: false
-		},
-	])
+	const list = ref([])
 	
 	function onSearchConfirm() {
 		searchForm.value.pageNumber = 1

+ 62 - 25
pages/personalCenter/personalCenter.vue

@@ -13,10 +13,10 @@
 						<view class="iconfont icon-xiugai" @click="onIconOpen"></view>
 					</view>
 					<view class="function" v-else>
-						<view class="function-item">
+						<view class="function-item" @click="toLogin">
 							登录
 						</view>/
-						<view class="function-item">
+						<view class="function-item" @click="toRegister">
 							注册
 						</view>
 					</view>
@@ -186,7 +186,7 @@
 	import { useAuthStore } from '@/store/authStore'
 	
 	import { getCreditCard, getZhongjie, getAnjie, getIconList, updateIcon } from '@/api/user.js'
-	import { msgError, msgSuccess } from '@/utils/common'
+	import { msgError, msgSuccess, showConfirm } from '@/utils/common'
 	
 	import { useTabbarStore } from '@/store/tabbarStore.js'
 	const tabbarStore = useTabbarStore()
@@ -324,21 +324,42 @@
 		sfzh: null,
 		whcd: null
 	})
+	function showMsg() {
+		showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
+			if (res.confirm) {
+				uni.reLaunch({
+					url: '/pages/initial/initial'
+				});
+			}
+		})
+	}
 	
 	// 点击-会费缴交
 	function onHuiFeiJiaoJiao() {
+		if (!isLogin.value) {
+			showMsg()
+			return
+		}
 		uni.navigateTo({
 			url: '/pages/huiFeiJiaoJiao/huiFeiJiaoJiao'
 		})
 	}
 	// 点击-我的订单
 	function onWoDeDingDan() {
+		if (!isLogin.value) {
+			showMsg()
+			return
+		}
 		uni.navigateTo({
 			url: '/pages/order/order'
 		})
 	}
 	// 点击-我的收藏
 	function onWoDeShouChang() {
+		if (!isLogin.value) {
+			showMsg()
+			return
+		}
 		uni.navigateTo({
 			url: '/pages/collect/collect'
 		})
@@ -353,9 +374,23 @@
 	}
 	// 点击-退出登录
 	function onLogout() {
+		if (!isLogin.value) {
+			return
+		}
 		removeToken()
 		uni.redirectTo({
-			url: '/pages/login/login'
+			url: '/pages/initial/initial'
+		})
+	}
+	
+	function toLogin() {
+		uni.navigateTo({
+			url: '/pages/initial/initial'
+		})
+	}
+	function toRegister() {
+		uni.navigateTo({
+			url: '/pages/register/register'
 		})
 	}
 	
@@ -365,27 +400,29 @@
 	
 	onLoad(() => {
 		user.value = authStore.userInfo
-		getCreditCard().then(res => {
-			if (res && res.message === 'success') {
-				creditCard.value = res.data
-				authStore.setCreditCard(res.data)
-			}
-		})
-		getZhongjie().then(res => {
-			if (res && res.message === 'success') {
-				zhongjie.value = res.data ?? {zsbh: null}
-			}
-		})
-		getAnjie().then(res => {
-			if (res && res.message === 'success') {
-				anjie.value = res.data ?? {zsbh: null}
-			}
-		})
-		getIconList().then(res => {
-			if (res && res.message === 'success') {
-				iconList.value = res.data
-			}
-		})
+		if (isLogin.value) {
+			getCreditCard().then(res => {
+				if (res && res.message === 'success') {
+					creditCard.value = res.data
+					authStore.setCreditCard(res.data)
+				}
+			})
+			getZhongjie().then(res => {
+				if (res && res.message === 'success') {
+					zhongjie.value = res.data ?? {zsbh: null}
+				}
+			})
+			getAnjie().then(res => {
+				if (res && res.message === 'success') {
+					anjie.value = res.data ?? {zsbh: null}
+				}
+			})
+			getIconList().then(res => {
+				if (res && res.message === 'success') {
+					iconList.value = res.data
+				}
+			})
+		}
 	})
 </script>