feat: 小程序统一走 Go 后台,咨询与登录切到 /api/v1
去掉协会 WebView 和魔方账密页,微信登录与咨询接口共用同一 token 和拦截器。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<yxg-page title="分享">
|
||||
<view v-if="!report && !payload" class="card">
|
||||
<text class="h1">分享内容无效</text>
|
||||
<text class="desc">可以从首页重新开始。</text>
|
||||
<view class="btn" @click="yxgGo('/')"><text>回首页</text></view>
|
||||
</view>
|
||||
<view v-else class="card">
|
||||
<yxg-tool-icon :name="icon" :size="48" />
|
||||
<text class="h1">{{ title }}</text>
|
||||
<text class="desc">{{ line }}</text>
|
||||
<view class="btn" @click="shareNow"><text>转发给朋友</text></view>
|
||||
<view class="btn ghost" @click="yxgGo(ctaTo)"><text>{{ ctaText }}</text></view>
|
||||
<text class="disc">本内容为自我探索与生活方式参考,不构成医疗建议,亦非占卜预测。</text>
|
||||
</view>
|
||||
</yxg-page>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import YxgPage from '@/components/yxg/yxg-page.vue'
|
||||
import YxgToolIcon from '@/components/yxg/yxg-tool-icon.vue'
|
||||
import { yxgApi } from '@/util/yxgApi.js'
|
||||
import { headlineOf, toolIconFor } from '@/util/yxgCatalog.js'
|
||||
import { yxgGo } from '@/util/yxgNav.js'
|
||||
|
||||
const report = ref(null)
|
||||
const payload = ref(null)
|
||||
const title = computed(() => payload.value?.title || headlineOf(report.value) || '愈心谷分享')
|
||||
const line = computed(() => payload.value?.line || report.value?.summary?.one_liner || '来看看这份探索')
|
||||
const icon = computed(() => toolIconFor(payload.value?.type || report.value?.type || 'portrait'))
|
||||
const ctaTo = computed(() => {
|
||||
const t = payload.value?.type || report.value?.type
|
||||
if (t === 'relation') return '/relation'
|
||||
if (t === 'star') return '/star'
|
||||
if (t === 'synastry') return '/synastry'
|
||||
return '/portrait'
|
||||
})
|
||||
const ctaText = computed(() => '我也去看看')
|
||||
|
||||
function shareNow() {
|
||||
uni.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] })
|
||||
uni.showToast({ title: '请点击右上角分享', icon: 'none' })
|
||||
}
|
||||
|
||||
onShareAppMessage(() => ({
|
||||
title: title.value,
|
||||
path: '/pages/yxg-magic/index',
|
||||
}))
|
||||
|
||||
onLoad(async (q) => {
|
||||
if (q.id) {
|
||||
try {
|
||||
report.value = await yxgApi.getReport(q.id)
|
||||
} catch {
|
||||
report.value = null
|
||||
}
|
||||
}
|
||||
if (q.title || q.line) {
|
||||
payload.value = { title: q.title, line: q.line, type: q.type }
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page { background-color: #ffd1c7; }
|
||||
</style>
|
||||
<style scoped>
|
||||
.card { margin: 12px 16px; padding: 20px 16px; background: #fff; border-radius: 18px; }
|
||||
.h1 { display: block; margin-top: 10px; font-size: 20px; font-weight: 700; color: #333; }
|
||||
.desc { display: block; margin-top: 8px; font-size: 14px; color: #555; line-height: 1.6; }
|
||||
.disc { display: block; margin-top: 14px; font-size: 11px; color: #bbb; }
|
||||
.btn {
|
||||
margin-top: 14px; height: 42px; border-radius: 999px; background: #e54d42; color: #fff;
|
||||
display: flex; align-items: center; justify-content: center; font-weight: 700;
|
||||
}
|
||||
.btn.ghost { background: #f7f2ef; color: #8a4a3a; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user