diff --git a/.env b/.env index b64b7c9b..e00c3b62 100644 --- a/.env +++ b/.env @@ -6,8 +6,8 @@ SHOPRO_API_PATH=/app-api # 后端接口 - 测试环境(通过 process.env.NODE_ENV == development) # SHOPRO_DEV_BASE_URL=http://127.0.0.1:48083 -# SHOPRO_DEV_BASE_URL = https://chatapi.zianxin.com -SHOPRO_DEV_BASE_URL=https://dzc001.fy.takin.cc +SHOPRO_DEV_BASE_URL = https://chatapi.zianxin.com +# SHOPRO_DEV_BASE_URL=https://dzc001.fy.takin.cc # 后端接口 - 正式环境(通过 process.env.NODE_ENV != development) SHOPRO_BASE_URL=https://chatapi.zianxin.com diff --git a/src/App.vue b/src/App.vue index 023064e0..5f69c76c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,20 +21,49 @@ export default { }; }, // #ifndef MP-WEIXIN + computed: { + unreadCount() { + let count = 0; + this.chatStore?.chats?.forEach((chat) => { + if (!chat.isDnd && !chat.delete && chat.targetId != -200) { + count += chat.unreadCount; + } + }); + return count; + }, + }, + watch: { + unreadCount(newCount, oldCount) { + this.refreshUnreadBadge(); + }, + }, methods: { - init() { + refreshUnreadBadge() { + if (this.unreadCount > 0) { + uni.setTabBarBadge({ + index: 2, + text: this.unreadCount + '', + }); + } else { + uni.removeTabBarBadge({ + index: 2, + complete: () => { }, + }); + } + }, + // 初始化聊天 + async init() { this.reconnecting = false; this.isExit = false; - // 加载数据 - this.loadStore() - .then(() => { - // 初始化websocket - this.initWebSocket(); - }) - .catch((e) => { - console.log(e); - this.exit(); - }); + try { + // 加载数据 + await this.loadStore() + // 初始化websocket + this.initWebSocket(); + } catch (error) { + console.log("初始化聊天:", error); + this.exit(); + } }, initWebSocket() { let loginInfo = uni.getStorageSync('loginInfo'); @@ -124,6 +153,7 @@ export default { this.chatStore.setLoading(false); // 刷新会话 this.chatStore.refreshChats(); + this.refreshUnreadBadge() }) .catch((e) => { console.log(e); @@ -468,6 +498,7 @@ export default { this.pullPrivateOfflineMessage(this.chatStore.privateMsgMaxId); this.pullGroupOfflineMessage(this.chatStore.groupMsgMaxId); this.configStore.setAppInit(true); + this.refreshUnreadBadge() }) .catch((e) => { console.log(e); @@ -486,13 +517,8 @@ export default { // #endif onLaunch() { - // 隐藏原生导航栏 使用自定义底部导航 - // uni.hideTabBar({ - // fail: () => {}, - // }); // 加载Shopro底层依赖 ShoproInit(); - // #ifndef MP-WEIXIN this.$mountStore(); this.closeSplashscreen(1000); // 延迟1s,避免用户看到页面跳转 @@ -516,7 +542,6 @@ export default { const args = plus.runtime.arguments; if (args) { } - // 获取剪贴板 uni.getClipboardData({ success: (res) => { }, diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index dd092cc7..20b119af 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -9,8 +9,14 @@ + + + + + { + // #ifndef MP-WEIXIN if (!phone.value) { const lastLoginPhone = uni.getStorageSync('last_login_phone'); if (lastLoginPhone) { phone.value = lastLoginPhone; } } + // #endif }); const handleGetCode = async () => { @@ -122,15 +130,6 @@ const handleLogin = async () => { return uni.showToast({ title: '手机号格式错误', icon: 'none' }); if (!smsCode.value) return uni.showToast({ title: '请填写验证码', icon: 'none' }); - // #ifdef MP-WEIXIN - if (!isAgree.value) { - uni.showToast({ title: '请先同意授权', icon: 'none' }); - return - } - disposeLogin(); - // #endif - - // #ifndef MP-WEIXIN if (!isAgree.value) { agreeMessage .confirm({ @@ -139,11 +138,13 @@ const handleLogin = async () => { }) .then(() => { disposeLogin(); + }) + .catch(error => { + uni.switchTab({ url: '/pages/wechat-tabbar/index' }); }); return; } disposeLogin(); - // #endif }; const disposeLogin = async () => { diff --git a/src/pages/tabbar/components/user-ablum.vue b/src/pages/tabbar/components/user-ablum.vue index 88f95240..6f553e8e 100644 --- a/src/pages/tabbar/components/user-ablum.vue +++ b/src/pages/tabbar/components/user-ablum.vue @@ -1,13 +1,9 @@ diff --git a/src/pages/tabbar/profile.vue b/src/pages/tabbar/profile.vue index d15e42ce..b56fef0d 100644 --- a/src/pages/tabbar/profile.vue +++ b/src/pages/tabbar/profile.vue @@ -65,21 +65,25 @@ + + + + + 开通会员 尊享特权 + + + 去开通 + + + + - VIP - - 尊享vip免费特权 - {{ formatDate(userInfo.memberVip.expirationTime, "YYYY-MM-DD") }} - - - 立即开通 - - - 立即续费 - - + class="mx-4 px-1 py-2 rounded-b-2 bg-gradient-to-b from-#111 to-#222 b-b-4 b-solid b-t-#D29E52/60 b-l-#D29E52/40 b-r-#D29E52/40 b-b-#D29E52/20 flex items-center justify-evenly"> + + + {{ v.title + }} @@ -87,7 +91,7 @@ - + @@ -103,7 +107,7 @@ - + @@ -170,7 +174,6 @@ import { formatDate } from '@/sheep/helper/utils'; // @ts-ignore import { fen2yuanSimple } from '@/sheep/hooks/useGoods'; import { useMessage } from '@/uni_modules/wot-design-uni'; -import { gotoAppPermissionSetting, requestPermission } from '@/sheep/util/permission'; const { ablumList } = useAblum(); @@ -190,6 +193,33 @@ const recentTotal = ref({ userLikeMeTotal: 0, }); +const menu = ref([ + { + title: '购买砖石', + titleColor: "#d08c30", + icon: "/src/static/me/menu_1.png", + url: "/pages/profile/recharge" + }, + { + title: '我的收益', + titleColor: "#654510", + icon: "/src/static/me/menu_2.png", + url: "/pages/wechat-tabbar/index" + }, + { + title: '邀请赚钱', + titleColor: "#f56251", + icon: "/src/static/me/menu_3.png", + url: "/pages/wechat/pages/inviter/index" + }, + { + title: '认证中心', + titleColor: "#23c0d7", + icon: "/src/static/me/menu_4.png", + url: "/pages/profile/verify-status" + } +]) + // 我的评价数据 const myEvaluation = reactive({ scoreSc: 0, @@ -268,7 +298,7 @@ const goFeedback = () => { const MenuCellList = [ // { title: '我的收益', value: '', icon: 'wallet', to: '/pages/wechat-tabbar/index' }, { title: '访客记录', value: '', icon: 'browse', to: '/pages/profile/view-record' }, - { title: '认证中心', value: '', icon: 'user', to: '/pages/profile/verify-status' }, + // { title: '认证中心', value: '', icon: 'discount-filled', to: '/pages/profile/verify-status' }, { title: '联系方式', value: '修改微信需客服核实', icon: 'user', to: '/pages/profile/set-wechat' }, { title: '我的动态', value: '', icon: 'star', to: '/pages/profile/my-moment' }, { title: '我的评价', value: '', icon: 'view-module', to: '', onClick: lookMyEvaluation }, @@ -277,4 +307,18 @@ const MenuCellList = [ { title: '关注公众号', value: '领取福利、获取最新下载地址', icon: 'qrcode', to: '', onClick: subOfficial }, // { title: '设置', value: '', icon: 'setting1', to: '/pages/profile/setting' }, ]; + +const onTapMenu = (item: any) => { + uni.navigateTo({ + url: item.url, + }); +} + + \ No newline at end of file diff --git a/src/static/icon/self/iconfont.css b/src/static/icon/self/iconfont.css index db1b6d91..6e90bdfb 100644 --- a/src/static/icon/self/iconfont.css +++ b/src/static/icon/self/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 5079650 */ - src: url('//at.alicdn.com/t/c/font_5079650_dlgclk5ww3.woff2?t=1767687032692') format('woff2'), - url('//at.alicdn.com/t/c/font_5079650_dlgclk5ww3.woff?t=1767687032692') format('woff'), - url('//at.alicdn.com/t/c/font_5079650_dlgclk5ww3.ttf?t=1767687032692') format('truetype'); + src: url('https://at.alicdn.com/t/c/font_5079650_dlgclk5ww3.woff2?t=1767687032692') format('woff2'), + url('https://at.alicdn.com/t/c/font_5079650_dlgclk5ww3.woff?t=1767687032692') format('woff'), + url('https://at.alicdn.com/t/c/font_5079650_dlgclk5ww3.ttf?t=1767687032692') format('truetype'); } .iconfont { diff --git a/src/static/me/bg.png b/src/static/me/bg.png new file mode 100644 index 00000000..bd824e0e Binary files /dev/null and b/src/static/me/bg.png differ diff --git a/src/static/me/menu_1.png b/src/static/me/menu_1.png new file mode 100644 index 00000000..16e248ee Binary files /dev/null and b/src/static/me/menu_1.png differ diff --git a/src/static/me/menu_2.png b/src/static/me/menu_2.png new file mode 100644 index 00000000..b6a8f9f1 Binary files /dev/null and b/src/static/me/menu_2.png differ diff --git a/src/static/me/menu_3.png b/src/static/me/menu_3.png new file mode 100644 index 00000000..a39959f5 Binary files /dev/null and b/src/static/me/menu_3.png differ diff --git a/src/static/me/menu_4.png b/src/static/me/menu_4.png new file mode 100644 index 00000000..855b8434 Binary files /dev/null and b/src/static/me/menu_4.png differ diff --git a/src/static/me/vip.png b/src/static/me/vip.png new file mode 100644 index 00000000..d6b65616 Binary files /dev/null and b/src/static/me/vip.png differ