From 3bbd80a63ac7728ac01b641a48a26befcb171a0f Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期一, 15 十二月 2025 07:19:21 +0800
Subject: [PATCH] feat:增加企业微信登录判断
---
app/pages/message/index.vue | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 59 insertions(+), 1 deletions(-)
diff --git a/app/pages/message/index.vue b/app/pages/message/index.vue
index dd713e4..95e613f 100644
--- a/app/pages/message/index.vue
+++ b/app/pages/message/index.vue
@@ -2,6 +2,10 @@
<view class="message-container">
<view class="message-header">
<view class="header-title">娑堟伅涓績</view>
+ <view class="subscribe-btn" v-if="!subscribed" @click="subscribeMessage">
+ <uni-icons type="bell" size="20" color="#007AFF"></uni-icons>
+ <text>璁㈤槄閫氱煡</text>
+ </view>
</view>
<scroll-view class="message-list-scroll" scroll-y="true">
@@ -35,13 +39,15 @@
<script>
import { getMyMessages, markAsRead } from '@/api/message'
import { formatDateTime } from '@/utils/common'
+ import subscribeManager from '@/utils/subscribe'
export default {
data() {
return {
// 娑堟伅鍒楄〃
messages: [],
- loading: false
+ loading: false,
+ subscribed: false,
}
},
computed: {
@@ -61,6 +67,8 @@
},
onLoad() {
this.loadMessages()
+ // 鑷姩璁㈤槄锛堝鏋滄湭璁㈤槄鍒欐樉绀虹‘璁ゅ脊绐楋級
+ this.autoSubscribeOnLaunch()
},
onShow() {
// 姣忔鏄剧ず椤甸潰鏃跺埛鏂版秷鎭�
@@ -74,6 +82,21 @@
})
},
methods: {
+ // 鑷姩璁㈤槄锛堥〉闈㈠姞杞芥椂璋冪敤锛�
+ autoSubscribeOnLaunch() {
+ subscribeManager.autoSubscribe()
+ .then((result) => {
+ if (result.skipped) {
+ console.log('鐢ㄦ埛宸茶闃咃紝鏃犻渶閲嶅璁㈤槄')
+ } else if (result.success) {
+ console.log('鑷姩璁㈤槄鎴愬姛')
+ }
+ })
+ .catch((error) => {
+ console.log('鑷姩璁㈤槄鍙栨秷鎴栧け璐ワ細', error)
+ })
+ },
+
// 鍔犺浇娑堟伅鍒楄〃
async loadMessages() {
try {
@@ -157,6 +180,23 @@
formatMessageTime(dateTime) {
if (!dateTime) return ''
return formatDateTime(dateTime, 'MM-DD HH:mm')
+ },
+
+ // 璁㈤槄浠诲姟閫氱煡
+ subscribeMessage() {
+ subscribeManager.subscribeWithConfirm()
+ .then((result) => {
+ if (result.success) {
+ uni.showToast({
+ title: '璁㈤槄鎴愬姛锛屾偍灏嗘敹鍒颁换鍔¢�氱煡',
+ icon: 'success',
+ duration: 2000
+ })
+ }
+ })
+ .catch((error) => {
+ console.log('璁㈤槄澶辫触锛�', error)
+ })
}
}
}
@@ -199,6 +239,24 @@
font-size: 36rpx;
font-weight: bold;
}
+
+ .subscribe-btn {
+ display: flex;
+ align-items: center;
+ padding: 10rpx 20rpx;
+ background-color: #f0f9ff;
+ border-radius: 30rpx;
+
+ text {
+ margin-left: 8rpx;
+ font-size: 26rpx;
+ color: #007AFF;
+ }
+
+ &:active {
+ opacity: 0.7;
+ }
+ }
}
.message-list-scroll {
--
Gitblit v1.9.1