fix;小程序变动
This commit is contained in:
parent
fe5b055663
commit
f6aa6d9a97
|
|
@ -267,6 +267,20 @@ Page({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 点击参考来源标题, 折叠/展开链接和摘要
|
||||||
|
toggleRef(e) {
|
||||||
|
const mkey = e.currentTarget.dataset.mkey
|
||||||
|
const idx = Number(e.currentTarget.dataset.idx)
|
||||||
|
const list = this.data.messages.slice()
|
||||||
|
const i = list.findIndex((m) => m.key === mkey)
|
||||||
|
if (i === -1) return
|
||||||
|
const refs = (list[i].references || []).slice()
|
||||||
|
if (!refs[idx]) return
|
||||||
|
refs[idx] = Object.assign({}, refs[idx], { expanded: !refs[idx].expanded })
|
||||||
|
list[i] = Object.assign({}, list[i], { references: refs })
|
||||||
|
this.setData({ messages: list })
|
||||||
|
},
|
||||||
|
|
||||||
// 参考文档带 source_url 时(共享文档)点击复制链接到剪贴板。
|
// 参考文档带 source_url 时(共享文档)点击复制链接到剪贴板。
|
||||||
// 小程序无法直接打开任意外链, 复制后由用户粘贴到浏览器。
|
// 小程序无法直接打开任意外链, 复制后由用户粘贴到浏览器。
|
||||||
onRefLinkTap(e) {
|
onRefLinkTap(e) {
|
||||||
|
|
|
||||||
|
|
@ -72,18 +72,29 @@
|
||||||
<view class="refs">
|
<view class="refs">
|
||||||
<view class="refs-title">参考来源</view>
|
<view class="refs-title">参考来源</view>
|
||||||
<view class="ref-item" wx:for="{{item.references}}" wx:for-item="ref" wx:key="idx" wx:for-index="idx">
|
<view class="ref-item" wx:for="{{item.references}}" wx:for-item="ref" wx:key="idx" wx:for-index="idx">
|
||||||
<text class="ref-title" user-select="{{true}}">[{{idx + 1}}] {{ref.source_title}}</text>
|
|
||||||
<view
|
<view
|
||||||
wx:if="{{ref.source_url}}"
|
class="ref-head"
|
||||||
class="ref-link"
|
hover-class="ref-head-hover"
|
||||||
hover-class="ref-link-hover"
|
bindtap="toggleRef"
|
||||||
bindtap="onRefLinkTap"
|
data-mkey="{{item.key}}"
|
||||||
data-url="{{ref.source_url}}"
|
data-idx="{{idx}}"
|
||||||
>
|
>
|
||||||
<text class="ref-link-icon">🔗</text>
|
<text class="ref-title">[{{idx + 1}}] {{ref.source_title}}</text>
|
||||||
<text class="ref-link-url" user-select="{{true}}">{{ref.source_url}}</text>
|
<text class="ref-arrow {{ref.expanded ? 'expanded' : ''}}">›</text>
|
||||||
</view>
|
</view>
|
||||||
<text wx:if="{{ref.snippet}}" class="ref-snippet" user-select="{{true}}">{{ref.snippet}}</text>
|
<block wx:if="{{ref.expanded}}">
|
||||||
|
<view
|
||||||
|
wx:if="{{ref.source_url}}"
|
||||||
|
class="ref-link"
|
||||||
|
hover-class="ref-link-hover"
|
||||||
|
bindtap="onRefLinkTap"
|
||||||
|
data-url="{{ref.source_url}}"
|
||||||
|
>
|
||||||
|
<text class="ref-link-icon">🔗</text>
|
||||||
|
<text class="ref-link-url" user-select="{{true}}">{{ref.source_url}}</text>
|
||||||
|
</view>
|
||||||
|
<text wx:if="{{ref.snippet}}" class="ref-snippet" user-select="{{true}}">{{ref.snippet}}</text>
|
||||||
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
|
|
||||||
|
|
@ -211,11 +211,33 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 10rpx 0;
|
padding: 10rpx 0;
|
||||||
}
|
}
|
||||||
|
.ref-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12rpx;
|
||||||
|
padding: 4rpx 0;
|
||||||
|
}
|
||||||
|
.ref-head-hover {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
.ref-title {
|
.ref-title {
|
||||||
|
flex: 1;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: var(--brand);
|
color: var(--brand);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
.ref-arrow {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 1;
|
||||||
|
color: var(--brand);
|
||||||
|
transform: rotate(90deg);
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
.ref-arrow.expanded {
|
||||||
|
transform: rotate(270deg);
|
||||||
|
}
|
||||||
.ref-link {
|
.ref-link {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue