feat: refactor member to pay-per-use gravity purchase; mv webview to clipboard+browser

- member.vue: rewrite from subscription plans (free/growth/sprint) to
  H5-only pay-per-use gravity purchase with quantity selector + QR code
- user.vue: gravity card replacing quota card, add share/contribute/H5-buy
  entry points, plus gravity acquisition modal (share/contribute/buy)
- share.vue: layout fix (flex column), smarter copyLink with cached URL,
  WeChat timeline hint instead of open-type
- share.controller.ts: add GET /:shareCode redirect route (IP record + 302)
- interview.vue: guest mode fix, H5 buy modal, clipboard copy instead of
  webview for mini-program
- App.vue: handleH5UrlParams for ?token=&buy=gravity auto-login
- composables/useGravityPurchase.ts: reusable gravity purchase composable
- remove webview.vue (no longer used), replace with clipboard+browser flow
- AGENTS.md: sync all above changes, fix duplicate numbering
This commit is contained in:
yuzhiran
2026-06-20 20:49:15 +08:00
parent a1e1f0b3c3
commit 8ee27fdd32
11 changed files with 648 additions and 593 deletions
+30 -18
View File
@@ -90,28 +90,22 @@
<view class="complete-bar" v-else>
<button class="cta-btn" @click="goResult">查看面试报告</button>
<button class="buy-btn" v-if="completedReason === 'noCredits'" @click="showPurchaseModal = true">引力值不足补充引力值或开通会员 </button>
<button class="buy-btn" v-if="completedReason === 'noCredits'" @click="goH5Buy">引力值不足官网购买 </button>
</view>
<!-- 购买弹窗次数不足时 -->
<view class="modal-overlay" v-if="showPurchaseModal" @click="showPurchaseModal = false">
<!-- 官网购买弹窗 -->
<view class="modal-overlay" v-if="showH5BuyModal" @click="showH5BuyModal = false">
<view class="modal-content" @click.stop>
<text class="modal-title">引力值不足</text>
<text class="modal-hint">您的引力值不足请补充后继续面试每次面试消耗 5 引力值</text>
<view class="purchase-options">
<view class="purchase-option" @click="goBuyProduct">
<text class="purchase-name">补充引力值</text>
<text class="purchase-price">¥5 </text>
<text class="purchase-desc">¥5 = 5 引力值可面试 1 </text>
</view>
<view class="purchase-option recommended" @click="goBuyMember">
<text class="purchase-badge">推荐</text>
<text class="purchase-name">开通成长版会员</text>
<text class="purchase-price">¥19.9<text class="purchase-unit">/</text></text>
<text class="purchase-desc">每月 250 引力值解锁全部权益</text>
<view class="purchase-option" @click="goH5BuyAndClose">
<text class="purchase-name">官网购买引力值</text>
<text class="purchase-price">前往网页版充值</text>
<text class="purchase-desc">打开官网 H5 页面支持多种支付方式</text>
</view>
</view>
<text class="modal-close" @click="showPurchaseModal = false">取消</text>
<text class="modal-close" @click="showH5BuyModal = false">取消</text>
</view>
</view>
</view>
@@ -122,7 +116,6 @@ import { ref, computed, onMounted, onBeforeUnmount, nextTick } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { api, API_ENDPOINTS } from '../../config'
import DigitalHuman from '../../components/digital-human.vue'
const messages = ref([{ role: 'ai', content: '你好!我是 AI 面试官,请选择岗位开始模拟面试!' }])
const inputText = ref('')
const aiLoading = ref(false)
@@ -134,7 +127,7 @@ const scrollToId = ref('')
const position = ref('')
const avatarMode = ref(true)
const showPositionPicker = ref(false)
const showPurchaseModal = ref(false)
const showH5BuyModal = ref(false)
const positions = ref([])
const positionsLoading = ref(false)
const aiSpeechText = ref('')
@@ -323,8 +316,27 @@ function onAvatarSilent() {
}
const goResult = () => uni.navigateTo({ url: `/pages/report/report?interviewId=${interviewId.value}` })
const goBuyProduct = () => uni.navigateTo({ url: '/pages/member/member?buy=interview' })
const goBuyMember = () => uni.navigateTo({ url: '/pages/member/member' })
// 官网购买引力值
const goH5Buy = () => {
showH5BuyModal.value = true
}
const goH5BuyAndClose = () => {
showH5BuyModal.value = false
const token = uni.getStorageSync('token') || ''
const url = `https://zhiyin.yzrcloud.cn/?buy=gravity${token ? '&token=' + token : ''}`
// #ifdef MP-WEIXIN
uni.setClipboardData({
data: url,
success: () => {
uni.showToast({ title: '链接已复制,请在手机浏览器中打开', icon: 'none', duration: 3000 })
},
fail: () => {
uni.showToast({ title: '复制失败,请手动访问 zhiyin.yzrcloud.cn', icon: 'none', duration: 3000 })
},
})
// #endif
}
const scrollToBottom = () => {
nextTick(() => { scrollToId.value = ''; setTimeout(() => { scrollToId.value = 'msg-bottom' }, 100) })
}