diff --git a/api/index.js b/api/index.js index e789c9d..9b9642f 100644 --- a/api/index.js +++ b/api/index.js @@ -18,6 +18,14 @@ export const userLogin = data => { }) } +/** 退出登录 */ +export const userLogout = () => { + return http({ + url: '/api/mobile/out', + method: 'get' + }) +} + /** 获取用户信息 */ export const getUserData = () => { return http({ diff --git a/pages.json b/pages.json index f0cfc60..721224d 100644 --- a/pages.json +++ b/pages.json @@ -10,6 +10,7 @@ { "path": "pages/login/login", "style": { + "navigationBarTitleText": "登录", "navigationStyle": "custom" } }, @@ -101,6 +102,26 @@ "navigationBarBackgroundColor": "#ffffff" } }, + { + "path": "pages/my-index/collection/index", + "style": { + "navigationBarTitleText": "收藏", + "navigationBarBackgroundColor": "#ffffff" + } + }, + { + "path": "pages/my-index/customer-service/index", + "style": { + "navigationBarTitleText": "客服" + } + }, + { + "path": "pages/my-index/set-up/index", + "style": { + "navigationBarTitleText": "设置", + "navigationBarBackgroundColor": "#ffffff" + } + }, { "path": "pages/my-index/wallet/bank-card/card-details", "style": { diff --git a/pages/mall/list.vue b/pages/mall/list.vue index 5269159..4d2a5d9 100644 --- a/pages/mall/list.vue +++ b/pages/mall/list.vue @@ -84,7 +84,7 @@ diff --git a/pages/my-index/customer-service/index.vue b/pages/my-index/customer-service/index.vue new file mode 100644 index 0000000..de9664d --- /dev/null +++ b/pages/my-index/customer-service/index.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/pages/my-index/my-index.vue b/pages/my-index/my-index.vue index 42eb972..15b8e8b 100644 --- a/pages/my-index/my-index.vue +++ b/pages/my-index/my-index.vue @@ -12,9 +12,21 @@ { name: '我的团队', icon: 'team', url: '/pages/my-index/my-team' }, { name: '会议记录', icon: 'meeting' }, { name: '我的朋友圈', icon: 'circle' }, - { name: '我的收藏', icon: 'collection' }, - { name: '在线客服', icon: 'customer' }, - { name: '系统设置', icon: 'system' } + { + name: '我的收藏', + icon: 'collection', + url: '/pages/my-index/collection/index' + }, + { + name: '在线客服', + icon: 'customer', + url: '/pages/my-index/customer-service/index' + }, + { + name: '系统设置', + icon: 'system', + url: '/pages/my-index/set-up/index' + } ] const { userInfo } = useAuthUser() diff --git a/pages/my-index/set-up/index.vue b/pages/my-index/set-up/index.vue new file mode 100644 index 0000000..65664b6 --- /dev/null +++ b/pages/my-index/set-up/index.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/static/images/my-index/customer-img.png b/static/images/my-index/customer-img.png new file mode 100644 index 0000000..ae4ab1c Binary files /dev/null and b/static/images/my-index/customer-img.png differ diff --git a/stores/user.js b/stores/user.js index 2c600f0..227efea 100644 --- a/stores/user.js +++ b/stores/user.js @@ -6,11 +6,14 @@ import { removeUserInfoData } from '@/utils/storage' import { useTokenStore } from './token' -import { getUserData } from '@/api' +import { getUserData, userLogout } from '@/api' import { ref } from 'vue' +import { useUI } from '@/utils/use-ui' +import { reLaunch } from '@/utils/router' export const useUserStore = defineStore('user', () => { const { clearToken } = useTokenStore() + const { showDialog } = useUI() const userInfo = ref( getUserInfoData() ? JSON?.parse(getUserInfoData()) : {} @@ -47,10 +50,15 @@ export const useUserStore = defineStore('user', () => { /** * 清除用户信息(退出登录) */ - const clearUserInfo = () => { - userInfo.value = null - clearToken() - removeUserInfoData() + const clearUserInfo = async () => { + const show = await showDialog('提示', '确定要退出登录吗?') + if (show) { + await userLogout() + userInfo.value = null + clearToken() + removeUserInfoData() + reLaunch('/pages/login/login') + } } /** 刷新用户信息(如用户信息被修改) */ diff --git a/pages/mall/styles/public.scss b/styles/top-selector.scss similarity index 99% rename from pages/mall/styles/public.scss rename to styles/top-selector.scss index 2d3f2b1..0c4f4bb 100644 --- a/pages/mall/styles/public.scss +++ b/styles/top-selector.scss @@ -30,4 +30,4 @@ border: 2rpx solid #00d993; color: #00d993; } -} +} \ No newline at end of file