服务号关注状态

This commit is contained in:
18631081161 2026-01-28 02:05:17 +08:00
parent 7b0b5ac9a4
commit 7ec6c91c4b
7 changed files with 31 additions and 8 deletions

View File

@ -23,7 +23,7 @@ const ENV = {
} }
// 当前环境 - 开发时使用 development打包时改为 production // 当前环境 - 开发时使用 development打包时改为 production
const CURRENT_ENV = 'production' const CURRENT_ENV = 'development'
// 导出配置 // 导出配置
export const config = { export const config = {

View File

@ -16,6 +16,7 @@ import {
getSubscribeReminderClosedDate, setSubscribeReminderClosedDate getSubscribeReminderClosedDate, setSubscribeReminderClosedDate
} from '../utils/storage.js' } from '../utils/storage.js'
import { getAppConfig } from '../api/config.js' import { getAppConfig } from '../api/config.js'
import { useUserStore } from './user.js'
/** /**
* 获取今天的日期字符串 (YYYY-MM-DD) * 获取今天的日期字符串 (YYYY-MM-DD)
@ -231,15 +232,18 @@ export const useConfigStore = defineStore('config', {
/** /**
* 检查是否应该显示服务号关注弹窗 * 检查是否应该显示服务号关注弹窗
* 条件 * 条件
* 1. 用户未关注服务号 * 1. 用户未关注服务号从后端获取真实状态
* 2. 从其他页面返回首页时 * 2. 从其他页面返回首页时
* 3. 弹出后5分钟内不再弹出 * 3. 弹出后5分钟内不再弹出
* 4. 一天最多弹出3次 * 4. 一天最多弹出3次
* @param {boolean} isFromOtherPage - 是否从其他页面返回 * @param {boolean} isFromOtherPage - 是否从其他页面返回
*/ */
checkServiceAccountPopup(isFromOtherPage = false) { checkServiceAccountPopup(isFromOtherPage = false) {
// 从 userStore 获取真实的关注状态
const userStore = useUserStore()
// 如果已关注服务号,不显示 // 如果已关注服务号,不显示
if (this.serviceAccountFollowed) { if (userStore.isFollowServiceAccount) {
this.showServiceAccountPopup = false this.showServiceAccountPopup = false
return return
} }
@ -315,7 +319,7 @@ export const useConfigStore = defineStore('config', {
/** /**
* 检查是否应该显示小程序订阅消息提醒 * 检查是否应该显示小程序订阅消息提醒
* 条件 * 条件
* 1. 用户未关注服务号 * 1. 用户未关注服务号从后端获取真实状态
* 2. 今日已弹出3次服务号关注弹窗 * 2. 今日已弹出3次服务号关注弹窗
* 3. 优先级低于会员广告会员广告关闭后才显示 * 3. 优先级低于会员广告会员广告关闭后才显示
* 4. 今日未关闭过 * 4. 今日未关闭过
@ -323,9 +327,10 @@ export const useConfigStore = defineStore('config', {
*/ */
checkSubscribeReminder(isMember = false) { checkSubscribeReminder(isMember = false) {
const today = getTodayDateString() const today = getTodayDateString()
const userStore = useUserStore()
// 如果已关注服务号,不显示 // 如果已关注服务号,不显示
if (this.serviceAccountFollowed) { if (userStore.isFollowServiceAccount) {
this.showSubscribeReminder = false this.showSubscribeReminder = false
return return
} }

View File

@ -37,6 +37,7 @@ export const useUserStore = defineStore('user', {
isMember: false, isMember: false,
memberLevel: 0, memberLevel: 0,
isRealName: false, isRealName: false,
isFollowServiceAccount: false, // 是否关注服务号
genderPreference: getGenderPreference() || 0, genderPreference: getGenderPreference() || 0,
/** 上次从服务器刷新用户信息的时间戳(用于节流) */ /** 上次从服务器刷新用户信息的时间戳(用于节流) */
lastRefreshTime: 0 lastRefreshTime: 0
@ -98,6 +99,7 @@ export const useUserStore = defineStore('user', {
this.isMember = false this.isMember = false
this.memberLevel = 0 this.memberLevel = 0
this.isRealName = false this.isRealName = false
this.isFollowServiceAccount = false
removeUserInfo() removeUserInfo()
}, },
@ -116,6 +118,7 @@ export const useUserStore = defineStore('user', {
if (userInfo.isMember !== undefined) this.isMember = userInfo.isMember if (userInfo.isMember !== undefined) this.isMember = userInfo.isMember
if (userInfo.memberLevel !== undefined) this.memberLevel = userInfo.memberLevel if (userInfo.memberLevel !== undefined) this.memberLevel = userInfo.memberLevel
if (userInfo.isRealName !== undefined) this.isRealName = userInfo.isRealName if (userInfo.isRealName !== undefined) this.isRealName = userInfo.isRealName
if (userInfo.isFollowServiceAccount !== undefined) this.isFollowServiceAccount = userInfo.isFollowServiceAccount
// 持久化用户信息 // 持久化用户信息
setUserInfo({ setUserInfo({
@ -126,7 +129,8 @@ export const useUserStore = defineStore('user', {
isProfileCompleted: this.isProfileCompleted, isProfileCompleted: this.isProfileCompleted,
isMember: this.isMember, isMember: this.isMember,
memberLevel: this.memberLevel, memberLevel: this.memberLevel,
isRealName: this.isRealName isRealName: this.isRealName,
isFollowServiceAccount: this.isFollowServiceAccount
}) })
}, },
@ -160,6 +164,7 @@ export const useUserStore = defineStore('user', {
this.isMember = userInfo.isMember || false this.isMember = userInfo.isMember || false
this.memberLevel = userInfo.memberLevel || 0 this.memberLevel = userInfo.memberLevel || 0
this.isRealName = userInfo.isRealName || false this.isRealName = userInfo.isRealName || false
this.isFollowServiceAccount = userInfo.isFollowServiceAccount || false
} }
if (genderPref) { if (genderPref) {
@ -215,7 +220,8 @@ export const useUserStore = defineStore('user', {
isProfileCompleted: data.auditStatus === 1, isProfileCompleted: data.auditStatus === 1,
isMember: data.isMember, isMember: data.isMember,
memberLevel: data.memberLevel, memberLevel: data.memberLevel,
isRealName: data.isRealName isRealName: data.isRealName,
isFollowServiceAccount: data.isFollowServiceAccount
}) })
// 更新刷新时间戳 // 更新刷新时间戳
this.lastRefreshTime = Date.now() this.lastRefreshTime = Date.now()

View File

@ -54,6 +54,11 @@ public class LoginResponse
/// 是否首次登录(新用户) /// 是否首次登录(新用户)
/// </summary> /// </summary>
public bool IsNewUser { get; set; } public bool IsNewUser { get; set; }
/// <summary>
/// 是否关注服务号
/// </summary>
public bool IsFollowServiceAccount { get; set; }
} }
/// <summary> /// <summary>

View File

@ -229,6 +229,11 @@ public class ProfileResponse
/// 父母医疗保险 /// 父母医疗保险
/// </summary> /// </summary>
public string? ParentMedicalStatus { get; set; } public string? ParentMedicalStatus { get; set; }
/// <summary>
/// 是否关注服务号
/// </summary>
public bool IsFollowServiceAccount { get; set; }
} }
/// <summary> /// <summary>

View File

@ -115,7 +115,8 @@ public class AuthService : IAuthService
IsMember = existingUser.IsMember, IsMember = existingUser.IsMember,
MemberLevel = existingUser.MemberLevel, MemberLevel = existingUser.MemberLevel,
IsRealName = existingUser.IsRealName, IsRealName = existingUser.IsRealName,
IsNewUser = isNewUser IsNewUser = isNewUser,
IsFollowServiceAccount = existingUser.IsFollowServiceAccount
}; };
} }

View File

@ -268,6 +268,7 @@ public class ProfileService : IProfileService
IsMember = user.IsMember, IsMember = user.IsMember,
MemberLevel = user.MemberLevel, MemberLevel = user.MemberLevel,
IsRealName = user.IsRealName, IsRealName = user.IsRealName,
IsFollowServiceAccount = user.IsFollowServiceAccount,
Photos = photos.OrderBy(p => p.Sort).Select(p => new PhotoResponse Photos = photos.OrderBy(p => p.Sort).Select(p => new PhotoResponse
{ {
Id = p.Id, Id = p.Id,