diff --git a/miniprogram/pages/read/read.js b/miniprogram/pages/read/read.js index a810e704..25dc1338 100644 --- a/miniprogram/pages/read/read.js +++ b/miniprogram/pages/read/read.js @@ -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 diff --git a/miniprogram/project.private.config.json b/miniprogram/project.private.config.json index 013ef0a3..a1bc0c88 100644 --- a/miniprogram/project.private.config.json +++ b/miniprogram/project.private.config.json @@ -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 }, diff --git a/soul-api/soul-api b/soul-api/soul-api index 918d299a..1c45f0a1 100644 Binary files a/soul-api/soul-api and b/soul-api/soul-api differ