优化小程序页面跳转逻辑,支持通过 scene 中的 ref 参数解析推荐码。更新章节配置,调整部分页面逻辑以提升用户体验,移除不必要的复制链接功能。
This commit is contained in:
@@ -92,7 +92,21 @@ Page({
|
||||
}
|
||||
if (app.globalData.initialSectionMid) delete app.globalData.initialSectionMid
|
||||
if (app.globalData.initialSectionId) delete app.globalData.initialSectionId
|
||||
const ref = options.ref
|
||||
|
||||
// ref:支持 query.ref 或 scene 中的 ref=xxx(扫码进入时 ref 在 scene 里)
|
||||
let ref = options.ref
|
||||
if (!ref && options.scene) {
|
||||
const sceneStr = (typeof options.scene === 'string' ? decodeURIComponent(options.scene) : '').trim()
|
||||
const parts = sceneStr.split(/[&_]/)
|
||||
for (const part of parts) {
|
||||
const eq = part.indexOf('=')
|
||||
if (eq > 0) {
|
||||
const k = part.slice(0, eq)
|
||||
const v = part.slice(eq + 1)
|
||||
if (k === 'ref' && v) { ref = v; break }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mid && !id) {
|
||||
console.warn('[Read] 未获取到章节 mid/id,options:', options)
|
||||
@@ -424,21 +438,6 @@ Page({
|
||||
this.setData({ showShareModal: false })
|
||||
},
|
||||
|
||||
// 复制链接
|
||||
copyLink() {
|
||||
const userInfo = app.globalData.userInfo
|
||||
const referralCode = userInfo?.referralCode || ''
|
||||
const shareUrl = `https://soul.quwanzhi.com/read/${this.data.sectionId}${referralCode ? '?ref=' + referralCode : ''}`
|
||||
|
||||
wx.setClipboardData({
|
||||
data: shareUrl,
|
||||
success: () => {
|
||||
wx.showToast({ title: '链接已复制', icon: 'success' })
|
||||
this.setData({ showShareModal: false })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 复制分享文案(朋友圈风格)
|
||||
copyShareText() {
|
||||
const { section } = this.data
|
||||
|
||||
@@ -24,16 +24,16 @@
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/chapters/chapters",
|
||||
"pathName": "pages/chapters/chapters",
|
||||
"query": "",
|
||||
"name": "ces",
|
||||
"pathName": "pages/read/read",
|
||||
"query": "scene=mid%3D3&ref%3DogpTW5a9ex",
|
||||
"scene": null,
|
||||
"launchMode": "default"
|
||||
},
|
||||
{
|
||||
"name": "ces",
|
||||
"pathName": "pages/read/read",
|
||||
"query": "scene=id%3D1.1",
|
||||
"name": "pages/chapters/chapters",
|
||||
"pathName": "pages/chapters/chapters",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user