优化小程序页面跳转逻辑,支持通过 scene 中的 ref 参数解析推荐码。更新章节配置,调整部分页面逻辑以提升用户体验,移除不必要的复制链接功能。
This commit is contained in:
@@ -92,7 +92,21 @@ Page({
|
|||||||
}
|
}
|
||||||
if (app.globalData.initialSectionMid) delete app.globalData.initialSectionMid
|
if (app.globalData.initialSectionMid) delete app.globalData.initialSectionMid
|
||||||
if (app.globalData.initialSectionId) delete app.globalData.initialSectionId
|
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) {
|
if (!mid && !id) {
|
||||||
console.warn('[Read] 未获取到章节 mid/id,options:', options)
|
console.warn('[Read] 未获取到章节 mid/id,options:', options)
|
||||||
@@ -424,21 +438,6 @@ Page({
|
|||||||
this.setData({ showShareModal: false })
|
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() {
|
copyShareText() {
|
||||||
const { section } = this.data
|
const { section } = this.data
|
||||||
|
|||||||
@@ -24,16 +24,16 @@
|
|||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": [
|
"list": [
|
||||||
{
|
{
|
||||||
"name": "pages/chapters/chapters",
|
"name": "ces",
|
||||||
"pathName": "pages/chapters/chapters",
|
"pathName": "pages/read/read",
|
||||||
"query": "",
|
"query": "scene=mid%3D3&ref%3DogpTW5a9ex",
|
||||||
"scene": null,
|
"scene": null,
|
||||||
"launchMode": "default"
|
"launchMode": "default"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ces",
|
"name": "pages/chapters/chapters",
|
||||||
"pathName": "pages/read/read",
|
"pathName": "pages/chapters/chapters",
|
||||||
"query": "scene=id%3D1.1",
|
"query": "",
|
||||||
"launchMode": "default",
|
"launchMode": "default",
|
||||||
"scene": null
|
"scene": null
|
||||||
},
|
},
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user