优化首页逻辑以支持动态标题生成,提升用户体验。更新管理后台资源文件,替换旧的 JavaScript 和 CSS 文件,增强页面性能和样式一致性。同时,调整数据库结构以支持更细粒度的推送状态。
This commit is contained in:
@@ -10,8 +10,8 @@ const DEFAULT_APP_ID = 'wxb8bbb2b10dec74aa'
|
||||
const DEFAULT_MCH_ID = '1318592501'
|
||||
const DEFAULT_WITHDRAW_TMPL_ID = 'u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE'
|
||||
// baseUrl 手动切换(注释方式):
|
||||
// const API_BASE_URL = 'http://localhost:8080'
|
||||
const API_BASE_URL = 'https://soulapi.quwanzhi.com'
|
||||
const API_BASE_URL = 'http://localhost:8080'
|
||||
// const API_BASE_URL = 'https://soulapi.quwanzhi.com'
|
||||
const CONFIG_CACHE_KEY = 'mpConfigCacheV1'
|
||||
// 与上传版本号对齐;设置页展示优先用 wx.getAccountInfoSync().miniProgram.version(正式版),否则用本字段
|
||||
const APP_DISPLAY_VERSION = '1.7.2'
|
||||
|
||||
@@ -348,7 +348,7 @@ Page({
|
||||
.replace(/\{\{prefix\}\}/g, prefix)
|
||||
.trim() || baseTitle
|
||||
} else if (prefix) {
|
||||
mainTitle = `${prefix} · ${nm}`
|
||||
mainTitle = baseTitle
|
||||
} else {
|
||||
mainTitle = `@${nm}`
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ const soulBridge = require('../../utils/soulBridge.js')
|
||||
const { trackClick } = require('../../utils/trackClick')
|
||||
const { isSafeImageSrc } = require('../../utils/imageUrl.js')
|
||||
const { resolveAvatarWithMbti } = require('../../utils/mbtiAvatar.js')
|
||||
const mpPagePopups = require('../../utils/mpPagePopups.js')
|
||||
|
||||
Page({
|
||||
data: { statusBarHeight: 44, navBarTotalPx: 88, member: null, loading: true, isOwnProfile: false },
|
||||
@@ -31,15 +32,15 @@ Page({
|
||||
},
|
||||
|
||||
/**
|
||||
* 未登录解锁前:先展示后台可配的「链接 vs 解锁」说明,用户确认后再弹出登录引导(mpUi.memberDetailPage)
|
||||
* 未登录解锁前:先展示后台可配的「链接 vs 解锁」说明(mpUi.pagePopupItems:unlockIntroTitle / unlockIntroBody),兼容旧 memberDetailPage
|
||||
*/
|
||||
_showUnlockIntroThenLogin(afterConfirm) {
|
||||
const mp = app.globalData.configCache?.mpConfig?.mpUi?.memberDetailPage || {}
|
||||
const title = String(mp.unlockIntroTitle || '解锁与链接说明').trim() || '解锁与链接说明'
|
||||
const body = String(
|
||||
mp.unlockIntroBody ||
|
||||
'「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。\n\n请确认已了解后再登录。',
|
||||
).trim()
|
||||
const title =
|
||||
mpPagePopups.getMemberDetailContent(app, 'unlockIntroTitle') ||
|
||||
'解锁与链接说明'
|
||||
const body =
|
||||
mpPagePopups.getMemberDetailContent(app, 'unlockIntroBody') ||
|
||||
'「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。\n\n请确认已了解后再登录。'
|
||||
wx.showModal({
|
||||
title,
|
||||
content: body,
|
||||
|
||||
@@ -22,6 +22,7 @@ const { checkAndExecute } = require('../../utils/ruleEngine')
|
||||
const soulBridge = require('../../utils/soulBridge.js')
|
||||
|
||||
const app = getApp()
|
||||
const mpPagePopups = require('../../utils/mpPagePopups.js')
|
||||
|
||||
/** 阅读页解析正文用:人物字典 + #标签(与 /config/read-extras 一致) */
|
||||
function getContentParseConfig() {
|
||||
@@ -299,10 +300,17 @@ Page({
|
||||
const mp = (cfg && cfg.mpConfig) || {}
|
||||
const auditMode = !!mp.auditMode
|
||||
app.globalData.auditMode = auditMode
|
||||
const rp = (mp.mpUi && mp.mpUi.readPage) || {}
|
||||
const readBeforeLoginHint = String(rp.beforeLoginHint || '').trim()
|
||||
const readSinglePageTitle = String(rp.singlePageTitle || '解锁全文').trim() || '解锁全文'
|
||||
const readSinglePageHint = String(rp.singlePagePaywallHint || '').trim()
|
||||
const readBeforeLoginHint =
|
||||
mpPagePopups.getReadPageContent(app, 'beforeLoginHint') ||
|
||||
String((mp.mpUi && mp.mpUi.readPage && mp.mpUi.readPage.beforeLoginHint) || '').trim()
|
||||
let readSinglePageTitle =
|
||||
mpPagePopups.getReadPageContent(app, 'singlePageTitle') ||
|
||||
String((mp.mpUi && mp.mpUi.readPage && mp.mpUi.readPage.singlePageTitle) || '').trim() ||
|
||||
'解锁全文'
|
||||
readSinglePageTitle = readSinglePageTitle || '解锁全文'
|
||||
const readSinglePageHint =
|
||||
mpPagePopups.getReadPageContent(app, 'singlePagePaywallHint') ||
|
||||
String((mp.mpUi && mp.mpUi.readPage && mp.mpUi.readPage.singlePagePaywallHint) || '').trim()
|
||||
if (typeof this.setData === 'function') {
|
||||
this.setData({
|
||||
auditMode,
|
||||
|
||||
@@ -23,34 +23,6 @@
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "88888888",
|
||||
"pathName": "pages/read/read",
|
||||
"query": "mid=219",
|
||||
"scene": null,
|
||||
"launchMode": "default"
|
||||
},
|
||||
{
|
||||
"name": "开发登录",
|
||||
"pathName": "pages/dev-login/dev-login",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/member-detail/member-detail",
|
||||
"pathName": "pages/member-detail/member-detail",
|
||||
"query": "id=ogpTW5cVMxd5afBBtXdvmeMO8aho",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/my/my",
|
||||
"pathName": "pages/my/my",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "个人资料",
|
||||
"pathName": "pages/avatar-nickname/avatar-nickname",
|
||||
@@ -58,13 +30,6 @@
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/gift-pay/list",
|
||||
"pathName": "pages/gift-pay/list",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "代付",
|
||||
"pathName": "pages/gift-pay/detail",
|
||||
@@ -72,26 +37,12 @@
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "唤醒",
|
||||
"pathName": "pages/read/read",
|
||||
"query": "mid=209",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/my/my",
|
||||
"pathName": "pages/my/my",
|
||||
"query": "",
|
||||
"launchMode": "singlePage",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/read/read",
|
||||
"pathName": "pages/read/read",
|
||||
"query": "mid=20",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
68
miniprogram/utils/mpPagePopups.js
Normal file
68
miniprogram/utils/mpPagePopups.js
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* 从 mpConfig.mpUi.pagePopupItems 按 pagePath + key 取文案(管理端 CRUD)。
|
||||
* 兼容旧版 mpUi.memberDetailPage / readPage 字段。
|
||||
*
|
||||
* 当前代码显式引用的键(与 soul-admin 默认种子 / db.defaultMpUi 一致,勿改 key 除非双端同步):
|
||||
* - MEMBER_PATH unlockIntroTitle, unlockIntroBody → member-detail.js _showUnlockIntroThenLogin
|
||||
* - READ_PATH beforeLoginHint, singlePageTitle, singlePagePaywallHint → read.js onLoad
|
||||
*/
|
||||
|
||||
const MEMBER_PATH = '/pages/member-detail/member-detail'
|
||||
const READ_PATH = '/pages/read/read'
|
||||
|
||||
function getList(app) {
|
||||
const mpUi = app.globalData.configCache && app.globalData.configCache.mpConfig
|
||||
? app.globalData.configCache.mpConfig.mpUi
|
||||
: null
|
||||
const list = mpUi && mpUi.pagePopupItems
|
||||
return Array.isArray(list) ? list : []
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} app getApp()
|
||||
* @param {string} pagePath 如 /pages/read/read
|
||||
* @param {string} key 英文键
|
||||
* @returns {string} 文案,未配置时返回空串
|
||||
*/
|
||||
function getPagePopupContent(app, pagePath, key) {
|
||||
const list = getList(app)
|
||||
const it = list.find(function (p) {
|
||||
return p && p.pagePath === pagePath && p.key === key
|
||||
})
|
||||
if (it && typeof it.content === 'string') return it.content.trim()
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 带旧版 readPage / memberDetailPage 兜底
|
||||
*/
|
||||
function getReadPageContent(app, key) {
|
||||
const v = getPagePopupContent(app, READ_PATH, key)
|
||||
if (v) return v
|
||||
const rp = (app.globalData.configCache && app.globalData.configCache.mpConfig &&
|
||||
app.globalData.configCache.mpConfig.mpUi &&
|
||||
app.globalData.configCache.mpConfig.mpUi.readPage) || {}
|
||||
if (key === 'beforeLoginHint') return String(rp.beforeLoginHint || '').trim()
|
||||
if (key === 'singlePageTitle') return String(rp.singlePageTitle || '').trim()
|
||||
if (key === 'singlePagePaywallHint') return String(rp.singlePagePaywallHint || '').trim()
|
||||
return ''
|
||||
}
|
||||
|
||||
function getMemberDetailContent(app, key) {
|
||||
const v = getPagePopupContent(app, MEMBER_PATH, key)
|
||||
if (v) return v
|
||||
const md = (app.globalData.configCache && app.globalData.configCache.mpConfig &&
|
||||
app.globalData.configCache.mpConfig.mpUi &&
|
||||
app.globalData.configCache.mpConfig.mpUi.memberDetailPage) || {}
|
||||
if (key === 'unlockIntroTitle') return String(md.unlockIntroTitle || '').trim()
|
||||
if (key === 'unlockIntroBody') return String(md.unlockIntroBody || '').trim()
|
||||
return ''
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getPagePopupContent,
|
||||
getReadPageContent,
|
||||
getMemberDetailContent,
|
||||
MEMBER_PATH,
|
||||
READ_PATH,
|
||||
}
|
||||
Reference in New Issue
Block a user