feat: 支持多页面分享与统一默认头像
Made-with: Cursor
This commit is contained in:
+28
-19
@@ -12,30 +12,17 @@
|
||||
<view class="menu-content">
|
||||
<text class="menu-label">分享戒烟记录</text>
|
||||
<text class="menu-desc">{{ shareDesc }}</text>
|
||||
<view class="menu-actions">
|
||||
<text class="menu-action" @tap.stop="previewSharePage">预览分享页</text>
|
||||
<text class="menu-action-sep">·</text>
|
||||
<text class="menu-action" @tap.stop="handleRefreshShare">刷新分享链接</text>
|
||||
</view>
|
||||
</view>
|
||||
<button class="share-btn" open-type="share" :disabled="shareLoading || !shareToken">
|
||||
{{ shareLoading ? '生成中' : '分享' }}
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view class="menu-item" @tap="previewSharePage">
|
||||
<view class="menu-icon menu-icon-green">👁️</view>
|
||||
<view class="menu-content">
|
||||
<text class="menu-label">预览分享页</text>
|
||||
<text class="menu-desc">本地查看分享落地页是否可访问</text>
|
||||
</view>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
|
||||
<view class="menu-item" @tap="prepareShareToken(true)">
|
||||
<view class="menu-icon menu-icon-gray">🔄</view>
|
||||
<view class="menu-content">
|
||||
<text class="menu-label">刷新分享链接</text>
|
||||
<text class="menu-desc">生成新的有效分享令牌</text>
|
||||
</view>
|
||||
<text class="menu-arrow">›</text>
|
||||
</view>
|
||||
|
||||
<view class="menu-item" @tap="goOnboarding">
|
||||
<view class="menu-icon menu-icon-green">📝</view>
|
||||
<view class="menu-content">
|
||||
@@ -89,7 +76,7 @@ const shareExpireAt = ref('')
|
||||
const shareLoading = ref(false)
|
||||
|
||||
const userName = computed(() => userStore.user?.nickname || '戒烟用户')
|
||||
const userAvatar = computed(() => userStore.user?.avatar_url || '/static/icons/profile.png')
|
||||
const userAvatar = computed(() => userStore.user?.avatar_url || 'https://linghu-wmr.oss-cn-beijing.aliyuncs.com/smt/avatar.png')
|
||||
|
||||
const shareDesc = computed(() => {
|
||||
if (!shareToken.value) {
|
||||
@@ -137,6 +124,10 @@ async function prepareShareToken(showToast = false) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleRefreshShare() {
|
||||
prepareShareToken(true)
|
||||
}
|
||||
|
||||
function previewSharePage() {
|
||||
if (!shareToken.value) {
|
||||
uni.showToast({ title: '分享令牌尚未生成', icon: 'none' })
|
||||
@@ -283,6 +274,24 @@ onMounted(async () => {
|
||||
color: #6B7280;
|
||||
}
|
||||
|
||||
.menu-actions {
|
||||
margin-top: 6rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #10B981;
|
||||
}
|
||||
|
||||
.menu-action {
|
||||
color: #10B981;
|
||||
}
|
||||
|
||||
.menu-action-sep {
|
||||
color: #9CA3AF;
|
||||
}
|
||||
|
||||
.menu-arrow {
|
||||
font-size: 36rpx;
|
||||
color: #9CA3AF;
|
||||
|
||||
Reference in New Issue
Block a user