服务号关注状态
This commit is contained in:
parent
7b0b5ac9a4
commit
7ec6c91c4b
|
|
@ -23,7 +23,7 @@ const ENV = {
|
|||
}
|
||||
|
||||
// 当前环境 - 开发时使用 development,打包时改为 production
|
||||
const CURRENT_ENV = 'production'
|
||||
const CURRENT_ENV = 'development'
|
||||
|
||||
// 导出配置
|
||||
export const config = {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
getSubscribeReminderClosedDate, setSubscribeReminderClosedDate
|
||||
} from '../utils/storage.js'
|
||||
import { getAppConfig } from '../api/config.js'
|
||||
import { useUserStore } from './user.js'
|
||||
|
||||
/**
|
||||
* 获取今天的日期字符串 (YYYY-MM-DD)
|
||||
|
|
@ -231,15 +232,18 @@ export const useConfigStore = defineStore('config', {
|
|||
/**
|
||||
* 检查是否应该显示服务号关注弹窗
|
||||
* 条件:
|
||||
* 1. 用户未关注服务号
|
||||
* 1. 用户未关注服务号(从后端获取真实状态)
|
||||
* 2. 从其他页面返回首页时
|
||||
* 3. 弹出后5分钟内不再弹出
|
||||
* 4. 一天最多弹出3次
|
||||
* @param {boolean} isFromOtherPage - 是否从其他页面返回
|
||||
*/
|
||||
checkServiceAccountPopup(isFromOtherPage = false) {
|
||||
// 从 userStore 获取真实的关注状态
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 如果已关注服务号,不显示
|
||||
if (this.serviceAccountFollowed) {
|
||||
if (userStore.isFollowServiceAccount) {
|
||||
this.showServiceAccountPopup = false
|
||||
return
|
||||
}
|
||||
|
|
@ -315,7 +319,7 @@ export const useConfigStore = defineStore('config', {
|
|||
/**
|
||||
* 检查是否应该显示小程序订阅消息提醒
|
||||
* 条件:
|
||||
* 1. 用户未关注服务号
|
||||
* 1. 用户未关注服务号(从后端获取真实状态)
|
||||
* 2. 今日已弹出3次服务号关注弹窗
|
||||
* 3. 优先级低于会员广告(会员广告关闭后才显示)
|
||||
* 4. 今日未关闭过
|
||||
|
|
@ -323,9 +327,10 @@ export const useConfigStore = defineStore('config', {
|
|||
*/
|
||||
checkSubscribeReminder(isMember = false) {
|
||||
const today = getTodayDateString()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 如果已关注服务号,不显示
|
||||
if (this.serviceAccountFollowed) {
|
||||
if (userStore.isFollowServiceAccount) {
|
||||
this.showSubscribeReminder = false
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ export const useUserStore = defineStore('user', {
|
|||
isMember: false,
|
||||
memberLevel: 0,
|
||||
isRealName: false,
|
||||
isFollowServiceAccount: false, // 是否关注服务号
|
||||
genderPreference: getGenderPreference() || 0,
|
||||
/** 上次从服务器刷新用户信息的时间戳(用于节流) */
|
||||
lastRefreshTime: 0
|
||||
|
|
@ -98,6 +99,7 @@ export const useUserStore = defineStore('user', {
|
|||
this.isMember = false
|
||||
this.memberLevel = 0
|
||||
this.isRealName = false
|
||||
this.isFollowServiceAccount = false
|
||||
removeUserInfo()
|
||||
},
|
||||
|
||||
|
|
@ -116,6 +118,7 @@ export const useUserStore = defineStore('user', {
|
|||
if (userInfo.isMember !== undefined) this.isMember = userInfo.isMember
|
||||
if (userInfo.memberLevel !== undefined) this.memberLevel = userInfo.memberLevel
|
||||
if (userInfo.isRealName !== undefined) this.isRealName = userInfo.isRealName
|
||||
if (userInfo.isFollowServiceAccount !== undefined) this.isFollowServiceAccount = userInfo.isFollowServiceAccount
|
||||
|
||||
// 持久化用户信息
|
||||
setUserInfo({
|
||||
|
|
@ -126,7 +129,8 @@ export const useUserStore = defineStore('user', {
|
|||
isProfileCompleted: this.isProfileCompleted,
|
||||
isMember: this.isMember,
|
||||
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.memberLevel = userInfo.memberLevel || 0
|
||||
this.isRealName = userInfo.isRealName || false
|
||||
this.isFollowServiceAccount = userInfo.isFollowServiceAccount || false
|
||||
}
|
||||
|
||||
if (genderPref) {
|
||||
|
|
@ -215,7 +220,8 @@ export const useUserStore = defineStore('user', {
|
|||
isProfileCompleted: data.auditStatus === 1,
|
||||
isMember: data.isMember,
|
||||
memberLevel: data.memberLevel,
|
||||
isRealName: data.isRealName
|
||||
isRealName: data.isRealName,
|
||||
isFollowServiceAccount: data.isFollowServiceAccount
|
||||
})
|
||||
// 更新刷新时间戳
|
||||
this.lastRefreshTime = Date.now()
|
||||
|
|
|
|||
|
|
@ -54,6 +54,11 @@ public class LoginResponse
|
|||
/// 是否首次登录(新用户)
|
||||
/// </summary>
|
||||
public bool IsNewUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否关注服务号
|
||||
/// </summary>
|
||||
public bool IsFollowServiceAccount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -229,6 +229,11 @@ public class ProfileResponse
|
|||
/// 父母医疗保险
|
||||
/// </summary>
|
||||
public string? ParentMedicalStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否关注服务号
|
||||
/// </summary>
|
||||
public bool IsFollowServiceAccount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ public class AuthService : IAuthService
|
|||
IsMember = existingUser.IsMember,
|
||||
MemberLevel = existingUser.MemberLevel,
|
||||
IsRealName = existingUser.IsRealName,
|
||||
IsNewUser = isNewUser
|
||||
IsNewUser = isNewUser,
|
||||
IsFollowServiceAccount = existingUser.IsFollowServiceAccount
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -268,6 +268,7 @@ public class ProfileService : IProfileService
|
|||
IsMember = user.IsMember,
|
||||
MemberLevel = user.MemberLevel,
|
||||
IsRealName = user.IsRealName,
|
||||
IsFollowServiceAccount = user.IsFollowServiceAccount,
|
||||
Photos = photos.OrderBy(p => p.Sort).Select(p => new PhotoResponse
|
||||
{
|
||||
Id = p.Id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user