chore: 同步阅读页、脚本、API 配置与小程序管理文档
Made-with: Cursor
This commit is contained in:
@@ -309,6 +309,9 @@ Page({
|
||||
// 好友从代付分享进入:待自动领取的 requestSn
|
||||
pendingGiftRequestSn: '',
|
||||
|
||||
/** H5 / URL Link 带 openPay=1:全屏小程序内自动调起本章微信支付(非单页) */
|
||||
pendingAutoSectionPay: false,
|
||||
|
||||
// 朋友圈单页模式(scene 1154 / systemInfo.mode):无法登录与支付,仅引导「前往小程序」
|
||||
readSinglePageMode: false,
|
||||
momentsPaywallExpanded: false,
|
||||
@@ -589,6 +592,7 @@ Page({
|
||||
readSinglePageMode: this._detectReadSinglePage(),
|
||||
momentsPaywallExpanded: false,
|
||||
showMomentsLaunchGuideModal: false,
|
||||
pendingAutoSectionPay: parseDatasetBool(options && options.openPay),
|
||||
})
|
||||
|
||||
if (ref) {
|
||||
@@ -652,6 +656,8 @@ Page({
|
||||
this._applyPrevNext(chapterRes)
|
||||
this.computeShowFullBookCta()
|
||||
this.refreshPay365MarketingFromRules()
|
||||
|
||||
this._tryAutoPayAfterH5Launch()
|
||||
|
||||
} catch (e) {
|
||||
console.error('[Read] 初始化失败:', e)
|
||||
@@ -662,6 +668,41 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
/** H5 落地 path 含 openPay=1:与外链一致,进入后尽快调起微信支付(须全屏小程序、非免费、未解锁) */
|
||||
_tryAutoPayAfterH5Launch() {
|
||||
if (!this.data.pendingAutoSectionPay) return
|
||||
if (this.data.readSinglePageMode || this._detectReadSinglePage()) {
|
||||
this.setData({ pendingAutoSectionPay: false })
|
||||
return
|
||||
}
|
||||
const section = this.data.section
|
||||
if (
|
||||
section &&
|
||||
(section.isFree === true || (section.price !== undefined && Number(section.price) === 0))
|
||||
) {
|
||||
this.setData({ pendingAutoSectionPay: false })
|
||||
wx.showToast({ title: '本章免费', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (this.data.canAccess || accessManager.canAccessFullContent(this.data.accessState)) {
|
||||
this.setData({ pendingAutoSectionPay: false })
|
||||
return
|
||||
}
|
||||
const st = this.data.accessState
|
||||
if (st === 'locked_not_purchased') {
|
||||
this.setData({ pendingAutoSectionPay: false })
|
||||
setTimeout(() => {
|
||||
this.handlePurchaseSection()
|
||||
}, 120)
|
||||
return
|
||||
}
|
||||
if (st === 'locked_not_login') {
|
||||
this.setData({ showLoginModal: true })
|
||||
return
|
||||
}
|
||||
this.setData({ pendingAutoSectionPay: false })
|
||||
},
|
||||
|
||||
_getGiftUnitPrice() {
|
||||
const p = this.data.section?.price
|
||||
const cfg = this.data.sectionPrice
|
||||
@@ -1397,7 +1438,8 @@ Page({
|
||||
copyLink() {
|
||||
const userInfo = app.globalData.userInfo
|
||||
const referralCode = userInfo?.referralCode || ''
|
||||
const shareUrl = `https://soul.quwanzhi.com/read/${this.data.sectionId}${referralCode ? '?ref=' + referralCode : ''}`
|
||||
const base = String((app.globalData && app.globalData.baseUrl) || 'https://soulapi.quwanzhi.com').replace(/\/$/, '')
|
||||
const shareUrl = `${base}/read/${this.data.sectionId}${referralCode ? '?ref=' + referralCode : ''}`
|
||||
|
||||
wx.setClipboardData({
|
||||
data: shareUrl,
|
||||
@@ -1595,6 +1637,18 @@ Page({
|
||||
}
|
||||
|
||||
wx.hideLoading()
|
||||
|
||||
if (this.data.pendingAutoSectionPay) {
|
||||
if (canAccess) {
|
||||
this.setData({ pendingAutoSectionPay: false })
|
||||
} else if (accessManager.isFreeFromChapterData(chapterRes)) {
|
||||
this.setData({ pendingAutoSectionPay: false })
|
||||
wx.showToast({ title: '本章免费', icon: 'none' })
|
||||
} else if (newAccessState === 'locked_not_purchased') {
|
||||
this.setData({ pendingAutoSectionPay: false })
|
||||
setTimeout(() => this.handlePurchaseSection(), 120)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
wx.hideLoading()
|
||||
|
||||
Reference in New Issue
Block a user