1. Bug修复: - 修复Markdown星号/下划线在小程序端原样显示问题(markdownToHtml增加__和_支持,contentParser增加Markdown格式剥离) - 修复@提及无反应(MentionSuggestion使用ref保持persons最新值,解决闭包捕获空数组问题) - 修复#链接标签点击"未找到小程序配置"(增加appId直接跳转降级路径) 2. 分享功能优化: - "分享到朋友圈"改为"分享给好友"(open-type从shareTimeline改为share) - 90%收益提示移到分享按钮下方 - 阅读20%后向上滑动弹出分享浮层提示(4秒自动消失) 3. 代付功能: - 后端:新增UserBalance/BalanceTransaction/GiftUnlock三个模型 - 后端:新增8个余额相关API(查询/充值/充值确认/代付/领取/退款/交易记录/礼物信息) - 小程序:阅读页新增"代付分享"按钮,支持用余额为好友解锁章节 - 分享链接携带gift参数,好友打开自动领取解锁 Made-with: Cursor
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
const app = getApp()
|
|
|
|
Page({
|
|
data: {
|
|
url: '',
|
|
title: '链接预览',
|
|
statusBarHeight: 44,
|
|
navBarHeight: 88,
|
|
loadError: false,
|
|
},
|
|
|
|
onLoad(options) {
|
|
const url = decodeURIComponent(options.url || '')
|
|
const title = options.title ? decodeURIComponent(options.title) : '链接预览'
|
|
this.setData({
|
|
url,
|
|
title,
|
|
statusBarHeight: app.globalData.statusBarHeight || 44,
|
|
navBarHeight: app.globalData.navBarHeight || 88,
|
|
})
|
|
},
|
|
|
|
onWebViewError() {
|
|
this.setData({ loadError: true })
|
|
wx.showModal({
|
|
title: '无法在小程序内打开',
|
|
content: '该链接无法在小程序内预览,是否复制链接到浏览器打开?',
|
|
confirmText: '复制链接',
|
|
cancelText: '返回',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
wx.setClipboardData({
|
|
data: this.data.url,
|
|
success: () => wx.showToast({ title: '链接已复制,请在浏览器打开', icon: 'none', duration: 2000 }),
|
|
})
|
|
} else {
|
|
this.goBack()
|
|
}
|
|
},
|
|
})
|
|
},
|
|
|
|
goBack() {
|
|
const pages = getCurrentPages()
|
|
if (pages.length > 1) {
|
|
wx.navigateBack()
|
|
} else {
|
|
wx.switchTab({ url: '/pages/index/index' })
|
|
}
|
|
},
|
|
|
|
copyLink() {
|
|
const url = (this.data.url || '').trim()
|
|
if (!url) {
|
|
wx.showToast({ title: '暂无可复制链接', icon: 'none' })
|
|
return
|
|
}
|
|
wx.setClipboardData({
|
|
data: url,
|
|
success: () => wx.showToast({ title: '链接已复制', icon: 'none' }),
|
|
})
|
|
},
|
|
})
|
|
|