Compare commits
4
Commits
a8b4f08921
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e86ce2c1eb | ||
|
|
32f3db7e85 | ||
|
|
bba2571f25 | ||
|
|
6e88f6b09d |
+2
-1
@@ -34,7 +34,8 @@
|
|||||||
"build:quickapp-webview": "uni build -p quickapp-webview",
|
"build:quickapp-webview": "uni build -p quickapp-webview",
|
||||||
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
|
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
|
||||||
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
|
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
|
||||||
"type-check": "vue-tsc --noEmit"
|
"type-check": "vue-tsc --noEmit",
|
||||||
|
"check:api-prefix": "bash scripts/check-api-prefix.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dcloudio/uni-app": "3.0.0-alpha-5010320260611001",
|
"@dcloudio/uni-app": "3.0.0-alpha-5010320260611001",
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# xuchao: 防止页面调用写死 /mp-api 前缀(request.ts 的 API_BASE 已含该前缀,重复会形成双前缀,
|
||||||
|
# 依赖 chaos 路由全局剥离才能工作,属错误写法)。命中即失败。
|
||||||
|
set -e
|
||||||
|
if grep -rn --include='*.vue' --include='*.ts' -e "('/mp-api/" -e '("/mp-api/' src; then
|
||||||
|
echo "❌ 发现页面写死 /mp-api 前缀,请去掉(API_BASE 会自动拼接)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ api 前缀检查通过"
|
||||||
@@ -185,6 +185,8 @@ export interface OAuth2LoginResult {
|
|||||||
/** 用户年卡列表项(来自 /zhy-api/cardBag/userCardList) */
|
/** 用户年卡列表项(来自 /zhy-api/cardBag/userCardList) */
|
||||||
export interface UserCardListItem {
|
export interface UserCardListItem {
|
||||||
cardNo: string
|
cardNo: string
|
||||||
|
// xuchao: 卡种ID(后端 CardBagBean.cardModelId),人脸预检与卡种过滤均在用
|
||||||
|
cardModelId: number
|
||||||
cardModelName: string
|
cardModelName: string
|
||||||
validityTime: string
|
validityTime: string
|
||||||
cardModelPic: string
|
cardModelPic: string
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const loading = ref(true)
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const data = await post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'FAQ' })
|
const data = await post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'FAQ' })
|
||||||
faqList.value = (data || []).map(n => ({
|
faqList.value = (data || []).map(n => ({
|
||||||
id: n.id,
|
id: n.id,
|
||||||
title: n.title,
|
title: n.title,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const notices = ref<NoticeItem[]>([])
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const data = await post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'NOTICE' })
|
const data = await post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'NOTICE' })
|
||||||
notices.value = (data || []).map(n => ({
|
notices.value = (data || []).map(n => ({
|
||||||
id: n.id,
|
id: n.id,
|
||||||
title: n.title,
|
title: n.title,
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ onLoad((options) => {
|
|||||||
|
|
||||||
async function fetchShopNotice(shopId: string) {
|
async function fetchShopNotice(shopId: string) {
|
||||||
try {
|
try {
|
||||||
const res = await post<any>('/mp-api/mpShopNotice/queryShopNoticePage', {
|
const res = await post<any>('/mpShopNotice/queryShopNoticePage', {
|
||||||
shopId,
|
shopId,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
@@ -265,7 +265,7 @@ async function fetchDetail(shopId: string) {
|
|||||||
const phone = uni.getStorageSync('phone') as string
|
const phone = uni.getStorageSync('phone') as string
|
||||||
if (phone) params.phone = phone
|
if (phone) params.phone = phone
|
||||||
|
|
||||||
const res = await post<any>('/mp-api/mpScenic/getScenicDetail', params)
|
const res = await post<any>('/mpScenic/getScenicDetail', params)
|
||||||
if (res) {
|
if (res) {
|
||||||
scenic.value = {
|
scenic.value = {
|
||||||
id: res.id || res.scenicId || shopId,
|
id: res.id || res.scenicId || shopId,
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ async function fetchScenicList(resetPage = true) {
|
|||||||
phone: uni.getStorageSync('phone') || '',
|
phone: uni.getStorageSync('phone') || '',
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await post<any>('/mp-api/mpScenic/queryScenicList', params)
|
const res = await post<any>('/mpScenic/queryScenicList', params)
|
||||||
const list = res?.list || res?.rows || res?.records || res || []
|
const list = res?.list || res?.rows || res?.records || res || []
|
||||||
const totalCount = res?.total || res?.totalCount || 0
|
const totalCount = res?.total || res?.totalCount || 0
|
||||||
total.value = totalCount
|
total.value = totalCount
|
||||||
@@ -344,7 +344,7 @@ onLoad((query: any) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const filterRes = await post<any>('/mp-api/mpScenic/queryFilterOptions', { channel: 'pingxiang' }).catch(() => null)
|
const filterRes = await post<any>('/mpScenic/queryFilterOptions', { channel: 'pingxiang' }).catch(() => null)
|
||||||
|
|
||||||
if (filterRes) {
|
if (filterRes) {
|
||||||
const levels = filterRes.levels || filterRes.levelList || []
|
const levels = filterRes.levels || filterRes.levelList || []
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const loading = ref(true)
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const data = await post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'GUIDE' })
|
const data = await post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'GUIDE' })
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
imageUrl.value = data[0].imageUrl || ''
|
imageUrl.value = data[0].imageUrl || ''
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ export interface VoucherItem {
|
|||||||
status: number
|
status: number
|
||||||
mobile: string
|
mobile: string
|
||||||
product_name: string
|
product_name: string
|
||||||
|
// xuchao: 小泥人真实响应带此字段(前端按 product_id 过滤本渠道券码),mock 数据可不填,故设为可选
|
||||||
|
product_id?: string
|
||||||
merchant_name: string
|
merchant_name: string
|
||||||
voucherRealnameInfo?: VoucherRealnameInfo[]
|
voucherRealnameInfo?: VoucherRealnameInfo[]
|
||||||
}
|
}
|
||||||
@@ -82,7 +84,7 @@ export async function queryVoucherList(params: QueryVoucherListParams): Promise<
|
|||||||
await delay(300)
|
await delay(300)
|
||||||
return MOCK_VOUCHERS.map((v) => ({ ...v, mobile: params.mobile }))
|
return MOCK_VOUCHERS.map((v) => ({ ...v, mobile: params.mobile }))
|
||||||
}
|
}
|
||||||
return post<VoucherItem[]>('/mp-api/douyin/voucherList', params)
|
return post<VoucherItem[]>('/douyin/voucherList', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,5 +96,5 @@ export async function activateAndBind(params: ActivateAndBindParams): Promise<vo
|
|||||||
await delay(800)
|
await delay(800)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await post<null>('/mp-api/douyin/activateAndBind', params)
|
await post<null>('/douyin/activateAndBind', params)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ const noticeHtml = computed(() => fixRichHtml(noticeContent.value))
|
|||||||
/** 获取购卡须知富文本(type = CARD_PURCHASE_NOTICE) */
|
/** 获取购卡须知富文本(type = CARD_PURCHASE_NOTICE) */
|
||||||
async function fetchPurchaseNotice() {
|
async function fetchPurchaseNotice() {
|
||||||
try {
|
try {
|
||||||
const res = await post<BannerItem[]>('/mp-api/mpContent/queryList', {
|
const res = await post<BannerItem[]>('/mpContent/queryList', {
|
||||||
channel: 'pingxiang',
|
channel: 'pingxiang',
|
||||||
type: 'CARD_PURCHASE_NOTICE',
|
type: 'CARD_PURCHASE_NOTICE',
|
||||||
})
|
})
|
||||||
@@ -211,10 +211,8 @@ async function confirmBuy() {
|
|||||||
uni.redirectTo({ url: `/packages/user/pages/order/detail?orderId=${outTradeNo}` })
|
uni.redirectTo({ url: `/packages/user/pages/order/detail?orderId=${outTradeNo}` })
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
// xuchao: 取消/失败后仅提示,停留在购买页(原"跳订单列表"引用了 try 作用域外的 outTradeNo,实为失效死代码,已删)
|
||||||
uni.showToast({ title: err?.errMsg?.includes('cancel') ? '已取消支付' : '支付失败,请重试', icon: 'none' })
|
uni.showToast({ title: err?.errMsg?.includes('cancel') ? '已取消支付' : '支付失败,请重试', icon: 'none' })
|
||||||
setTimeout(() => {
|
|
||||||
uni.redirectTo({ url: `/packages/user/pages/order/list?outTradeNo=${outTradeNo}` })
|
|
||||||
}, 1500)
|
|
||||||
} finally {
|
} finally {
|
||||||
paying.value = false
|
paying.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const loading = ref(true)
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const list = await post<any[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'CARD_NOTICE' })
|
const list = await post<any[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'CARD_NOTICE' })
|
||||||
content.value = list?.[0]?.content || ''
|
content.value = list?.[0]?.content || ''
|
||||||
} catch {
|
} catch {
|
||||||
showToast('加载失败')
|
showToast('加载失败')
|
||||||
|
|||||||
@@ -4,16 +4,23 @@
|
|||||||
<image class="hero-bg" src="https://aliyunoss.hn12301.net/pxmall/px_douyin.png" mode="widthFix" />
|
<image class="hero-bg" src="https://aliyunoss.hn12301.net/pxmall/px_douyin.png" mode="widthFix" />
|
||||||
|
|
||||||
<scroll-view scroll-y class="body">
|
<scroll-view scroll-y class="body">
|
||||||
<!-- 第 1 步:确认抖音下单信息 -->
|
<!-- 第 1 步:确认第三方下单信息 -->
|
||||||
<view class="section">
|
<view class="section">
|
||||||
<view class="step-head">
|
<view class="step-head">
|
||||||
<text class="step-no">第 1 步:</text>
|
<text class="step-no">第 1 步:</text>
|
||||||
<text class="step-title">确认抖音下单信息</text>
|
<text class="step-title">确认第三方下单信息</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="step-desc">
|
<text class="step-desc">
|
||||||
请确认在抖音平台认证的号码与微信手机号一致,如号码不一致请在抖音订单详情页面复制券号,并粘贴在券号输入框
|
请确认在第三方平台认证的号码与微信手机号一致,如号码不一致请在第三方订单详情页面复制券号,并粘贴在券号输入框
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
|
<!-- xuchao: 支持的第三方出票平台图标(设计稿 50x50、间隔 12px,rpx 按 2 倍换算) -->
|
||||||
|
<view class="platform-logos">
|
||||||
|
<image class="platform-logo" src="https://aliyunoss.hn12301.net/pxmall/px_logo_dy.png" mode="aspectFit" />
|
||||||
|
<image class="platform-logo" src="https://aliyunoss.hn12301.net/pxmall/px_logo_dz.png" mode="aspectFit" />
|
||||||
|
<image class="platform-logo" src="https://aliyunoss.hn12301.net/pxmall/px_logo_mt.png" mode="aspectFit" />
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="field">
|
<view class="field">
|
||||||
<text class="field-label">当前微信手机号:</text>
|
<text class="field-label">当前微信手机号:</text>
|
||||||
<view class="field-box">
|
<view class="field-box">
|
||||||
@@ -22,7 +29,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="field">
|
<view class="field">
|
||||||
<text class="field-label">抖音的订单券号:</text>
|
<text class="field-label">第三方的订单券号:</text>
|
||||||
|
|
||||||
<!-- 有券号:按 code 分组单选列表 -->
|
<!-- 有券号:按 code 分组单选列表 -->
|
||||||
<template v-if="hasVoucher">
|
<template v-if="hasVoucher">
|
||||||
@@ -34,7 +41,7 @@
|
|||||||
@tap="selectVoucher(group)"
|
@tap="selectVoucher(group)"
|
||||||
>
|
>
|
||||||
<text class="code-text">
|
<text class="code-text">
|
||||||
抖音订单号{{ index + 1 }}:{{ group.code }}(可激活次数{{ group.count }}次)
|
第三方订单号{{ index + 1 }}:{{ group.code }}(可激活次数{{ group.count }}次)
|
||||||
</text>
|
</text>
|
||||||
<view class="radio" :class="{ 'radio--on': selectedCode === group.code }">
|
<view class="radio" :class="{ 'radio--on': selectedCode === group.code }">
|
||||||
<view v-if="selectedCode === group.code" class="radio-dot" />
|
<view v-if="selectedCode === group.code" class="radio-dot" />
|
||||||
@@ -176,11 +183,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="no-voucher-reason">
|
<view class="no-voucher-reason">
|
||||||
<text class="no-voucher-num">1.</text>
|
<text class="no-voucher-num">1.</text>
|
||||||
<text>抖音购卡的手机号和当前登录手机号码不一致</text>
|
<text>第三方购卡的手机号和当前登录手机号码不一致</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="no-voucher-reason">
|
<view class="no-voucher-reason">
|
||||||
<text class="no-voucher-num">2.</text>
|
<text class="no-voucher-num">2.</text>
|
||||||
<text>抖音购卡的订单已经核销完成了</text>
|
<text>第三方购卡的订单已经核销完成了</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="no-voucher-reason">
|
<view class="no-voucher-reason">
|
||||||
<text class="no-voucher-num">3.</text>
|
<text class="no-voucher-num">3.</text>
|
||||||
@@ -248,6 +255,27 @@ import type { BannerItem } from '../../../api/types'
|
|||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
// xuchao: 回调式 uni.request Promise 包装。当前 uni-app alpha 运行时下 `await uni.request()`
|
||||||
|
// 返回的是 RequestTask(仅含 uniqueId 字段)而非 HTTP 响应,res.data 恒为 undefined,
|
||||||
|
// 导致「获取凭证失败」;本页所有第三方直连请求统一改走此封装(对齐 api/request.ts 模式)。
|
||||||
|
function rawRequest(options: {
|
||||||
|
url: string
|
||||||
|
method?: 'GET' | 'POST'
|
||||||
|
data?: object
|
||||||
|
header?: Record<string, string>
|
||||||
|
}): Promise<UniApp.RequestSuccessCallbackResult> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.request({
|
||||||
|
url: options.url,
|
||||||
|
method: options.method || 'GET',
|
||||||
|
data: options.data as AnyObject,
|
||||||
|
header: options.header,
|
||||||
|
success: (res: UniApp.RequestSuccessCallbackResult) => resolve(res),
|
||||||
|
fail: (err: UniApp.GeneralCallbackResult) => reject(new Error(err.errMsg || 'request:fail')),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const phone = ref((uni.getStorageSync('phone') as string) || '')
|
const phone = ref((uni.getStorageSync('phone') as string) || '')
|
||||||
const maskedPhone = computed(() =>
|
const maskedPhone = computed(() =>
|
||||||
phone.value ? phone.value.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '-'
|
phone.value ? phone.value.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '-'
|
||||||
@@ -310,7 +338,7 @@ const noticeHtml = computed(() => fixRichHtml(noticeContent.value))
|
|||||||
/** 获取购卡须知富文本(type = CARD_PURCHASE_NOTICE) */
|
/** 获取购卡须知富文本(type = CARD_PURCHASE_NOTICE) */
|
||||||
async function fetchPurchaseNotice() {
|
async function fetchPurchaseNotice() {
|
||||||
try {
|
try {
|
||||||
const res = await post<BannerItem[]>('/mp-api/mpContent/queryList', {
|
const res = await post<BannerItem[]>('/mpContent/queryList', {
|
||||||
channel: 'pingxiang',
|
channel: 'pingxiang',
|
||||||
type: 'CARD_PURCHASE_NOTICE',
|
type: 'CARD_PURCHASE_NOTICE',
|
||||||
})
|
})
|
||||||
@@ -364,7 +392,7 @@ onShow(async () => {
|
|||||||
async function fetchOAuthToken() {
|
async function fetchOAuthToken() {
|
||||||
try {
|
try {
|
||||||
console.log('[douyin] fetching OAuth token...')
|
console.log('[douyin] fetching OAuth token...')
|
||||||
const res = await uni.request({
|
const res = await rawRequest({
|
||||||
url: 'https://www.xiaoniren.cn/openapi/oauth2-token/authorize?client_id=uwfdRQD0CjHrz0oY&client_key=186c07637ed40ef9ef0a2289b188ac',
|
url: 'https://www.xiaoniren.cn/openapi/oauth2-token/authorize?client_id=uwfdRQD0CjHrz0oY&client_key=186c07637ed40ef9ef0a2289b188ac',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
@@ -389,10 +417,12 @@ async function fetchVouchers() {
|
|||||||
if (!phone.value || !accessToken.value) {
|
if (!phone.value || !accessToken.value) {
|
||||||
vouchers.value = []
|
vouchers.value = []
|
||||||
vouchersLoaded.value = true
|
vouchersLoaded.value = true
|
||||||
|
// xuchao: 凭证获取失败时无券可展示,同样弹温馨提示引导手动输入券码(此前静默无提示)
|
||||||
|
showNoVoucher.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const res = await uni.request({
|
const res = await rawRequest({
|
||||||
url: `https://www.xiaoniren.cn/openapi/ticket/voucher-list?status=1&mobile=${phone.value}&product_id=59221&page=1&per-page=100`,
|
url: `https://www.xiaoniren.cn/openapi/ticket/voucher-list?status=1&mobile=${phone.value}&product_id=59221&page=1&per-page=100`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
@@ -425,7 +455,7 @@ async function verifyInputCode() {
|
|||||||
}
|
}
|
||||||
uni.showLoading({ title: '验证中...', mask: true })
|
uni.showLoading({ title: '验证中...', mask: true })
|
||||||
try {
|
try {
|
||||||
const res = await uni.request({
|
const res = await rawRequest({
|
||||||
url: `https://www.xiaoniren.cn/openapi/ticket/voucher-list?status=1&code=${encodeURIComponent(code)}&product_id=59221&page=1&per-page=100`,
|
url: `https://www.xiaoniren.cn/openapi/ticket/voucher-list?status=1&code=${encodeURIComponent(code)}&product_id=59221&page=1&per-page=100`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
@@ -496,7 +526,7 @@ async function doActivate() {
|
|||||||
uni.showLoading({ title: '核销中...', mask: true })
|
uni.showLoading({ title: '核销中...', mask: true })
|
||||||
try {
|
try {
|
||||||
// 第一步:调后端发卡绑定
|
// 第一步:调后端发卡绑定
|
||||||
const sendRes = await uni.request({
|
const sendRes = await rawRequest({
|
||||||
url: `${BASE_URL}/open-api/card/sendAndBind`,
|
url: `${BASE_URL}/open-api/card/sendAndBind`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
@@ -521,7 +551,7 @@ async function doActivate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 第二步:验证券码
|
// 第二步:验证券码
|
||||||
const validateRes = await uni.request({
|
const validateRes = await rawRequest({
|
||||||
url: 'https://www.xiaoniren.cn/openapi/ticket/validate',
|
url: 'https://www.xiaoniren.cn/openapi/ticket/validate',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
header: {
|
header: {
|
||||||
@@ -720,6 +750,18 @@ function closeNoVoucher() {
|
|||||||
color: #ff383c;
|
color: #ff383c;
|
||||||
line-height: 48rpx;
|
line-height: 48rpx;
|
||||||
}
|
}
|
||||||
|
/* xuchao: 券号下方第三方平台图标行(20x20、间隔 12px 的 2 倍 rpx) */
|
||||||
|
.platform-logos {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: 24rpx;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
}
|
||||||
|
.platform-logo {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
}
|
||||||
.field-box {
|
.field-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
+1
-1
@@ -141,7 +141,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/douyin-verify",
|
"path": "pages/douyin-verify",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "抖音核销",
|
"navigationBarTitleText": "第三方核销",
|
||||||
"backgroundColor": "#FFFFFF",
|
"backgroundColor": "#FFFFFF",
|
||||||
"backgroundColorTop": "#FFFFFF",
|
"backgroundColorTop": "#FFFFFF",
|
||||||
"backgroundColorBottom": "#FFFFFF"
|
"backgroundColorBottom": "#FFFFFF"
|
||||||
|
|||||||
+212
-54
@@ -9,37 +9,8 @@
|
|||||||
</swiper>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view scroll-y class="main-scroll">
|
<scroll-view scroll-y class="main-scroll">
|
||||||
<!-- 公告栏 -->
|
|
||||||
<view v-if="announcements.length" class="notice animate-fade-in-up stagger-1">
|
|
||||||
<view class="notice-tag">
|
|
||||||
<view class="notice-pip animate-pulse" :class="`type-${currentNoticeType}`" />
|
|
||||||
<text class="notice-label">公告</text>
|
|
||||||
</view>
|
|
||||||
<swiper
|
|
||||||
class="notice-swiper"
|
|
||||||
vertical
|
|
||||||
:autoplay="swiperAutoplay"
|
|
||||||
circular
|
|
||||||
:interval="3000"
|
|
||||||
:duration="500"
|
|
||||||
@change="onNoticeChange"
|
|
||||||
@touchstart="onNoticeTouchStart"
|
|
||||||
@touchend="onNoticeTouchEnd"
|
|
||||||
>
|
|
||||||
<swiper-item v-for="item in displayNotices" :key="item.id">
|
|
||||||
<view class="notice-item" @click="openNotice(item)">
|
|
||||||
<text class="notice-text">{{ item.title }}</text>
|
|
||||||
</view>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
<view class="notice-more" @click="goMoreNotice">
|
|
||||||
<text class="notice-more-text">更多</text>
|
|
||||||
<view class="chevron" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 金刚区 -->
|
<!-- 金刚区 -->
|
||||||
<view class="quick-grid animate-fade-in-up stagger-2">
|
<view class="quick-grid animate-fade-in-up stagger-1">
|
||||||
<view
|
<view
|
||||||
v-for="item in quickActions"
|
v-for="item in quickActions"
|
||||||
:key="item.label"
|
:key="item.label"
|
||||||
@@ -51,6 +22,28 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 公告栏:位于金刚区下方,同时展示两条公告 -->
|
||||||
|
<view v-if="announcements.length" class="notice animate-fade-in-up stagger-2">
|
||||||
|
<view class="notice-tag">
|
||||||
|
<view class="notice-pip animate-pulse" />
|
||||||
|
<text class="notice-label">公告</text>
|
||||||
|
</view>
|
||||||
|
<view class="notice-list">
|
||||||
|
<view
|
||||||
|
v-for="item in displayNotices"
|
||||||
|
:key="item.id"
|
||||||
|
class="notice-item"
|
||||||
|
@click="openNotice(item)"
|
||||||
|
>
|
||||||
|
<text class="notice-text">{{ item.title }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="notice-more" @click="goMoreNotice">
|
||||||
|
<text class="notice-more-text">更多</text>
|
||||||
|
<view class="chevron" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 旅游卡 — 大字报风格 -->
|
<!-- 旅游卡 — 大字报风格 -->
|
||||||
<view class="promo-wrap animate-fade-in-up stagger-2">
|
<view class="promo-wrap animate-fade-in-up stagger-2">
|
||||||
<view class="promo" @click="goCardDetail()">
|
<view class="promo" @click="goCardDetail()">
|
||||||
@@ -125,12 +118,34 @@
|
|||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
|
<!-- 首页弹窗广告:每次冷启动弹一次,取「首页弹窗」类型排序最前一条 -->
|
||||||
|
<view
|
||||||
|
v-if="homePopupVisible"
|
||||||
|
class="popup-overlay"
|
||||||
|
:class="{ visible: homePopupAnim }"
|
||||||
|
@click="closeHomePopup"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="popup-img"
|
||||||
|
:src="homePopupData?.imageUrl || ''"
|
||||||
|
mode="widthFix"
|
||||||
|
@click.stop="onHomePopupClick"
|
||||||
|
@error="onHomePopupImgError"
|
||||||
|
/>
|
||||||
|
<view class="popup-close" @click.stop="closeHomePopup">
|
||||||
|
<view class="close-x">
|
||||||
|
<view class="close-line line-a" />
|
||||||
|
<view class="close-line line-b" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted, nextTick } from 'vue'
|
||||||
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
import { onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
||||||
import { post } from '../../api/request'
|
import { post } from '../../api/request'
|
||||||
import { BASE_URL } from '../../config'
|
import { BASE_URL } from '../../config'
|
||||||
import type { BannerItem } from '../../api/types'
|
import type { BannerItem } from '../../api/types'
|
||||||
@@ -192,8 +207,8 @@ onMounted(() => {
|
|||||||
async function fetchBannersAndNotices() {
|
async function fetchBannersAndNotices() {
|
||||||
try {
|
try {
|
||||||
const [bannerData, noticeData] = await Promise.all([
|
const [bannerData, noticeData] = await Promise.all([
|
||||||
post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'BANNER' }),
|
post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'BANNER' }),
|
||||||
post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'NOTICE' }),
|
post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'NOTICE' }),
|
||||||
])
|
])
|
||||||
banners.value = bannerData || []
|
banners.value = bannerData || []
|
||||||
announcements.value = (noticeData || []).map(n => ({
|
announcements.value = (noticeData || []).map(n => ({
|
||||||
@@ -208,7 +223,7 @@ async function fetchBannersAndNotices() {
|
|||||||
/** 获取热门景点(独立加载,不阻塞 banner/公告渲染) */
|
/** 获取热门景点(独立加载,不阻塞 banner/公告渲染) */
|
||||||
async function fetchSpots() {
|
async function fetchSpots() {
|
||||||
try {
|
try {
|
||||||
const spotsData = await post<any>('/mp-api/mpScenic/queryScenicList', { channel: 'pingxiang', pageNo: 1, pageSize: 8, phone: uni.getStorageSync('phone') || '' })
|
const spotsData = await post<any>('/mpScenic/queryScenicList', { channel: 'pingxiang', pageNo: 1, pageSize: 8, phone: uni.getStorageSync('phone') || '' })
|
||||||
const list = spotsData?.list || spotsData || []
|
const list = spotsData?.list || spotsData || []
|
||||||
hotSpots.value = (Array.isArray(list) ? list : []).slice(0, 8).map((s: any) => ({
|
hotSpots.value = (Array.isArray(list) ? list : []).slice(0, 8).map((s: any) => ({
|
||||||
id: s.id || s.scenicId,
|
id: s.id || s.scenicId,
|
||||||
@@ -224,6 +239,71 @@ async function fetchSpots() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ====== 首页弹窗广告(HOME_POPUP) ====== */
|
||||||
|
// xuchao: 首页为 tabBar 页,实例与进程同生命周期,实例级标志即「每次冷启动弹一次」
|
||||||
|
let homePopupHandled = false
|
||||||
|
let homePopupFetching = false
|
||||||
|
const homePopupData = ref<BannerItem | null>(null)
|
||||||
|
const homePopupVisible = ref(false)
|
||||||
|
const homePopupAnim = ref(false)
|
||||||
|
|
||||||
|
onShow(() => { checkHomePopup() })
|
||||||
|
|
||||||
|
/** 首页每次显示时检查;本次启动已弹过/请求中则跳过;接口失败不置标志,下次进首页重试 */
|
||||||
|
async function checkHomePopup() {
|
||||||
|
if (homePopupHandled || homePopupFetching) return
|
||||||
|
homePopupFetching = true
|
||||||
|
try {
|
||||||
|
const list = await post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'HOME_POPUP' })
|
||||||
|
homePopupHandled = true
|
||||||
|
const item = (list || []).find(c => c.imageUrl)
|
||||||
|
if (item) {
|
||||||
|
homePopupData.value = item
|
||||||
|
homePopupVisible.value = true
|
||||||
|
nextTick(() => { homePopupAnim.value = true })
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 静默失败,下次进首页再试
|
||||||
|
} finally {
|
||||||
|
homePopupFetching = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 点击广告图:先关弹窗,再跳配置的内部页面 */
|
||||||
|
function onHomePopupClick() {
|
||||||
|
const url = homePopupData.value?.linkUrl
|
||||||
|
homePopupAnim.value = false
|
||||||
|
homePopupVisible.value = false
|
||||||
|
if (url) navigateInnerPage(url)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 关闭弹窗(离场动画结束后移除节点) */
|
||||||
|
function closeHomePopup() {
|
||||||
|
homePopupAnim.value = false
|
||||||
|
setTimeout(() => { homePopupVisible.value = false }, 280)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 图片加载失败直接移除弹窗 */
|
||||||
|
function onHomePopupImgError() {
|
||||||
|
homePopupVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// xuchao: tabBar 页 navigateTo 会失败,必须走 switchTab
|
||||||
|
const TAB_PAGE_PATHS = ['/pages/index/index', '/pages/qrcode/index', '/pages/profile/index']
|
||||||
|
|
||||||
|
/** xuchao: 小程序内部页面智能跳转(tabBar 走 switchTab,其余 navigateTo,失败兜底提示) */
|
||||||
|
function navigateInnerPage(url: string) {
|
||||||
|
const path = url.startsWith('/') ? url : `/${url}`
|
||||||
|
if (TAB_PAGE_PATHS.includes(path.split('?')[0])) {
|
||||||
|
uni.switchTab({ url: path })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: path,
|
||||||
|
fail: () => uni.showToast({ title: '页面暂未开放', icon: 'none' }),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
onShareAppMessage(() => ({
|
onShareAppMessage(() => ({
|
||||||
title: '爱上萍乡旅游年卡',
|
title: '爱上萍乡旅游年卡',
|
||||||
path: '/pages/index/index',
|
path: '/pages/index/index',
|
||||||
@@ -249,7 +329,7 @@ function onBannerClick(banner: BannerItem) {
|
|||||||
|
|
||||||
/** 金刚区操作项 */
|
/** 金刚区操作项 */
|
||||||
const quickActions = [
|
const quickActions = [
|
||||||
{ label: '抖音核销', icon: 'https://aliyunoss.hn12301.net/pxmall/douyin.png' },
|
{ label: '核销验券', icon: 'https://aliyunoss.hn12301.net/pxmall/douyin.png' },
|
||||||
{ label: '我要绑卡', icon: 'https://aliyunoss.hn12301.net/pxmall/card.png' },
|
{ label: '我要绑卡', icon: 'https://aliyunoss.hn12301.net/pxmall/card.png' },
|
||||||
{ label: '我要预约', icon: 'https://aliyunoss.hn12301.net/pxmall/reserve.png' },
|
{ label: '我要预约', icon: 'https://aliyunoss.hn12301.net/pxmall/reserve.png' },
|
||||||
{ label: '我要入园', icon: 'https://aliyunoss.hn12301.net/pxmall/check.png' },
|
{ label: '我要入园', icon: 'https://aliyunoss.hn12301.net/pxmall/check.png' },
|
||||||
@@ -278,25 +358,13 @@ function onQuickAction(item: { label: string }) {
|
|||||||
uni.navigateTo({ url: '/packages/content/pages/faq' })
|
uni.navigateTo({ url: '/packages/content/pages/faq' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (item.label === '抖音核销') {
|
if (item.label === '核销验券') {
|
||||||
uni.navigateTo({ url: '/packages/user/pages/douyin-verify' })
|
uni.navigateTo({ url: '/packages/user/pages/douyin-verify' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.showToast({ title: `${item.label}功能开发中`, icon: 'none' })
|
uni.showToast({ title: `${item.label}功能开发中`, icon: 'none' })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 公告轮播状态 */
|
|
||||||
const swiperAutoplay = ref(true)
|
|
||||||
const currentNoticeIndex = ref(0)
|
|
||||||
const currentNoticeType = computed(() => announcements.value[currentNoticeIndex.value]?.type || 'scenic')
|
|
||||||
|
|
||||||
/** @param e - swiper change 事件,`{ detail: { current } }` */
|
|
||||||
function onNoticeChange(e: { detail: { current: number } }) { currentNoticeIndex.value = e.detail.current }
|
|
||||||
/** 触摸公告轮播时暂停自动播放 */
|
|
||||||
function onNoticeTouchStart() { swiperAutoplay.value = false }
|
|
||||||
/** 触摸结束后恢复自动播放 */
|
|
||||||
function onNoticeTouchEnd() { swiperAutoplay.value = true }
|
|
||||||
|
|
||||||
/** 打开公告详情页 */
|
/** 打开公告详情页 */
|
||||||
function openNotice(item: BannerItem & { typeLabel: string }) {
|
function openNotice(item: BannerItem & { typeLabel: string }) {
|
||||||
uni.setStorageSync('notice_detail', {
|
uni.setStorageSync('notice_detail', {
|
||||||
@@ -413,7 +481,7 @@ function goMore() {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
background: $color-card;
|
background: $color-card;
|
||||||
padding: $spacing-2 $spacing-3;
|
padding: $spacing-2 $spacing-3;
|
||||||
margin: $spacing-2 $spacing-3 0;
|
margin: 0 $spacing-3 $spacing-3;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
box-shadow: $shadow-sm;
|
box-shadow: $shadow-sm;
|
||||||
}
|
}
|
||||||
@@ -433,21 +501,25 @@ function goMore() {
|
|||||||
font-weight: $font-weight-medium;
|
font-weight: $font-weight-medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-swiper {
|
/* xuchao: 公告两条同时展示,纵向排列替换原单条轮播 */
|
||||||
|
.notice-list {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 40rpx;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: $spacing-1;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-item {
|
.notice-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 40rpx;
|
height: 56rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-text {
|
.notice-text {
|
||||||
font-size: $font-size-sm;
|
font-size: $font-size-sm;
|
||||||
color: $color-muted-foreground;
|
color: $color-muted-foreground;
|
||||||
line-height: 40rpx;
|
line-height: 56rpx;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 1;
|
-webkit-line-clamp: 1;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
@@ -823,4 +895,90 @@ function goMore() {
|
|||||||
.main-scroll {
|
.main-scroll {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ============================================
|
||||||
|
首页弹窗广告
|
||||||
|
============================================ */
|
||||||
|
.popup-overlay {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: $z-modal;
|
||||||
|
background: rgba(0, 0, 0, 0.45);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 280ms cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
|
||||||
|
&.visible {
|
||||||
|
opacity: 1;
|
||||||
|
|
||||||
|
.popup-img {
|
||||||
|
transform: scale(1);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-close {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 广告图:宽 600rpx 固定,高按原图比例(widthFix)自适应 */
|
||||||
|
.popup-img {
|
||||||
|
width: 600rpx;
|
||||||
|
border-radius: $radius-2xl;
|
||||||
|
overflow: hidden;
|
||||||
|
transform: scale(0.88);
|
||||||
|
opacity: 0;
|
||||||
|
transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1),
|
||||||
|
opacity 260ms cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-close {
|
||||||
|
width: 72rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
border-radius: $radius-full;
|
||||||
|
border: 2rpx solid rgba(255, 255, 255, 0.35);
|
||||||
|
background: transparent;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: $spacing-4;
|
||||||
|
flex-shrink: 0;
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0.8);
|
||||||
|
transition: opacity 320ms cubic-bezier(0.16, 1, 0.3, 1) 120ms,
|
||||||
|
transform 320ms cubic-bezier(0.16, 1, 0.3, 1) 120ms;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-x {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-line {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
width: 28rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 2rpx;
|
||||||
|
|
||||||
|
&.line-a {
|
||||||
|
transform: translate(-50%, -50%) rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.line-b {
|
||||||
|
transform: translate(-50%, -50%) rotate(-45deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const loading = ref(true)
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const list = await post<any[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'TERMS' })
|
const list = await post<any[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'TERMS' })
|
||||||
content.value = list?.[0]?.content || ''
|
content.value = list?.[0]?.content || ''
|
||||||
} catch {
|
} catch {
|
||||||
showToast('加载失败')
|
showToast('加载失败')
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const loading = ref(true)
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const list = await post<any[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'PRIVACY' })
|
const list = await post<any[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'PRIVACY' })
|
||||||
content.value = list?.[0]?.content || ''
|
content.value = list?.[0]?.content || ''
|
||||||
} catch {
|
} catch {
|
||||||
showToast('加载失败')
|
showToast('加载失败')
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ async function fetchCards() {
|
|||||||
async function fetchEntryNotice() {
|
async function fetchEntryNotice() {
|
||||||
if (entryNoticeLoaded.value) return
|
if (entryNoticeLoaded.value) return
|
||||||
try {
|
try {
|
||||||
const list = await post<BannerItem[]>('/mp-api/mpContent/queryList', { channel: 'pingxiang', type: 'ENTRY_NOTICE' })
|
const list = await post<BannerItem[]>('/mpContent/queryList', { channel: 'pingxiang', type: 'ENTRY_NOTICE' })
|
||||||
entryNotice.value = list?.[0]?.content || ''
|
entryNotice.value = list?.[0]?.content || ''
|
||||||
} catch {
|
} catch {
|
||||||
entryNotice.value = ''
|
entryNotice.value = ''
|
||||||
@@ -386,7 +386,7 @@ function onFeatureClick(item: { label: string }) {
|
|||||||
uni.showToast({ title: '请先选择一张旅游卡', icon: 'none' })
|
uni.showToast({ title: '请先选择一张旅游卡', icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
post<any>('/mp-api/mpCard/checkFaceBind', { cardModelId: card.cardModelId, cardNumber: card.cardNo })
|
post<any>('/mpCard/checkFaceBind', { cardModelId: card.cardModelId, cardNumber: card.cardNo })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res?.needBindFace) {
|
if (res?.needBindFace) {
|
||||||
showFaceModal.value = true
|
showFaceModal.value = true
|
||||||
|
|||||||
Reference in New Issue
Block a user