修改ui
|
|
@ -41,7 +41,13 @@ builder.Services.AddAuthentication(options =>
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
|
|
||||||
// Controllers
|
// Controllers
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers()
|
||||||
|
.AddJsonOptions(options =>
|
||||||
|
{
|
||||||
|
// 支持枚举字符串序列化/反序列化
|
||||||
|
options.JsonSerializerOptions.Converters.Add(new System.Text.Json.Serialization.JsonStringEnumConverter());
|
||||||
|
options.JsonSerializerOptions.PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase;
|
||||||
|
});
|
||||||
|
|
||||||
// CORS 配置(支持移动端和管理后台跨域请求)
|
// CORS 配置(支持移动端和管理后台跨域请求)
|
||||||
builder.Services.AddCors(options =>
|
builder.Services.AddCors(options =>
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ export default {
|
||||||
stamps: 'Stamps',
|
stamps: 'Stamps',
|
||||||
qrcode: 'QR Code',
|
qrcode: 'QR Code',
|
||||||
guide: 'Guide',
|
guide: 'Guide',
|
||||||
|
redeemableCoupons: 'Redeemable Coupons',
|
||||||
redeemBtn: 'Redeem',
|
redeemBtn: 'Redeem',
|
||||||
redeemSuccess: 'Redeemed successfully',
|
redeemSuccess: 'Redeemed successfully',
|
||||||
redeemFail: 'Insufficient points',
|
redeemFail: 'Insufficient points',
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ export default {
|
||||||
stamps: '节日印花',
|
stamps: '节日印花',
|
||||||
qrcode: '会员二维码',
|
qrcode: '会员二维码',
|
||||||
guide: '使用说明',
|
guide: '使用说明',
|
||||||
|
redeemableCoupons: '可兑换优惠券',
|
||||||
redeemBtn: '兑换',
|
redeemBtn: '兑换',
|
||||||
redeemSuccess: '兑换成功',
|
redeemSuccess: '兑换成功',
|
||||||
redeemFail: '积分不足,无法兑换',
|
redeemFail: '积分不足,无法兑换',
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ export default {
|
||||||
stamps: '節日印花',
|
stamps: '節日印花',
|
||||||
qrcode: '會員二維碼',
|
qrcode: '會員二維碼',
|
||||||
guide: '使用說明',
|
guide: '使用說明',
|
||||||
|
redeemableCoupons: '可兌換優惠券',
|
||||||
redeemBtn: '兌換',
|
redeemBtn: '兌換',
|
||||||
redeemSuccess: '兌換成功',
|
redeemSuccess: '兌換成功',
|
||||||
redeemFail: '積分不足,無法兌換',
|
redeemFail: '積分不足,無法兌換',
|
||||||
|
|
|
||||||
|
|
@ -76,14 +76,14 @@
|
||||||
{
|
{
|
||||||
"pagePath": "pages/index/index",
|
"pagePath": "pages/index/index",
|
||||||
"text": "首页",
|
"text": "首页",
|
||||||
"iconPath": "static/tab-home.png",
|
"iconPath": "static/tab/ic_home.png",
|
||||||
"selectedIconPath": "static/tab-home-active.png"
|
"selectedIconPath": "static/tab/ic_home_s.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/mine/mine",
|
"pagePath": "pages/mine/mine",
|
||||||
"text": "我的",
|
"text": "我的",
|
||||||
"iconPath": "static/tab-mine.png",
|
"iconPath": "static/tab/ic_me.png",
|
||||||
"selectedIconPath": "static/tab-mine-active.png"
|
"selectedIconPath": "static/tab/ic_me_s.png"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,70 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="home-page">
|
<view class="home-page">
|
||||||
<!-- Banner轮播图 -->
|
<!-- Banner轮播图 -->
|
||||||
<swiper class="banner-swiper" autoplay circular indicator-dots>
|
<view class="banner-wrap">
|
||||||
<swiper-item v-for="banner in banners" :key="banner.id" @click="onBannerClick(banner)">
|
<swiper class="banner-swiper" autoplay circular indicator-dots indicator-color="rgba(255,255,255,0.4)" indicator-active-color="#ffffff">
|
||||||
<image class="banner-image" :src="resolveImageUrl(banner.imageUrl)" mode="aspectFill" />
|
<swiper-item v-for="banner in banners" :key="banner.id" @click="onBannerClick(banner)">
|
||||||
</swiper-item>
|
<image class="banner-image" :src="resolveImageUrl(banner.imageUrl)" mode="aspectFill" />
|
||||||
</swiper>
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 功能入口网格 -->
|
<!-- 成为会员入口 -->
|
||||||
<view class="entry-grid">
|
<view class="membership-entry" @click="onEntryClick({ key: 'membership' })">
|
||||||
<view
|
<view class="membership-entry-left">
|
||||||
v-for="entry in entries"
|
<view class="membership-icon-wrap">
|
||||||
:key="entry.id"
|
<image class="membership-icon-img" src="/static/ic_vip.png" mode="aspectFit" />
|
||||||
class="entry-item"
|
</view>
|
||||||
@click="onEntryClick(entry)"
|
<view class="membership-text">
|
||||||
>
|
<text class="membership-title">{{ t('home.membership') }}</text>
|
||||||
<image class="entry-image" :src="resolveImageUrl(entry.imageUrl)" mode="aspectFit" />
|
<text class="membership-sub">Unlock VIP Benefits</text>
|
||||||
<text class="entry-label">{{ getEntryLabel(entry.key) }}</text>
|
</view>
|
||||||
|
</view>
|
||||||
|
<text class="membership-arrow">›</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 功能入口(节日印花 + 会员二维码) -->
|
||||||
|
<view class="entry-row">
|
||||||
|
<view class="entry-card" @click="onEntryClick({ key: 'stamps' })">
|
||||||
|
<image class="entry-icon" src="/static/ic_stamp.png" mode="aspectFit" />
|
||||||
|
<text class="entry-label">{{ t('home.stamps') }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="entry-card" @click="onEntryClick({ key: 'qrcode' })">
|
||||||
|
<image class="entry-icon" src="/static/ic_qrcode.png" mode="aspectFit" />
|
||||||
|
<text class="entry-label">{{ t('home.qrcode') }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 可兑换优惠券列表 -->
|
<!-- 可兑换优惠券 -->
|
||||||
<view class="coupon-section">
|
<view class="coupon-header">
|
||||||
<CouponCard
|
<text class="coupon-title">{{ t('home.redeemableCoupons') || '可兑换优惠券' }}</text>
|
||||||
v-for="coupon in coupons"
|
<view class="coupon-guide-link" @click="handleGuideEntry">
|
||||||
:key="coupon.couponId"
|
<text class="guide-icon">ⓘ</text>
|
||||||
:coupon="coupon"
|
<text class="guide-text">{{ t('home.guide') }}</text>
|
||||||
@redeem="onRedeemClick"
|
</view>
|
||||||
/>
|
</view>
|
||||||
|
|
||||||
|
<view class="coupon-list">
|
||||||
|
<view class="coupon-card" v-for="coupon in coupons" :key="coupon.couponId">
|
||||||
|
<view class="coupon-info">
|
||||||
|
<text class="coupon-name">{{ coupon.name }}</text>
|
||||||
|
<view class="coupon-detail-row">
|
||||||
|
<text class="coupon-dot">●</text>
|
||||||
|
<text class="coupon-detail-label">到期时间:</text>
|
||||||
|
<text class="coupon-detail-value highlight">{{ formatExpire(coupon.expireAt) }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="coupon-detail-row">
|
||||||
|
<text class="coupon-dot">●</text>
|
||||||
|
<text class="coupon-detail-label">兑换条件:</text>
|
||||||
|
<text class="coupon-detail-value highlight">{{ coupon.requiredPoints }}积分</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="coupon-action">
|
||||||
|
<view class="redeem-btn" @click="onRedeemClick(coupon)">
|
||||||
|
<text class="redeem-btn-text">兑换</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 使用说明弹窗 -->
|
<!-- 使用说明弹窗 -->
|
||||||
|
|
@ -44,9 +81,6 @@
|
||||||
@confirm="onRedeemConfirm"
|
@confirm="onRedeemConfirm"
|
||||||
@cancel="showRedeem = false"
|
@cancel="showRedeem = false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 会员二维码弹窗(占位,由任务6实现) -->
|
|
||||||
<!-- <QrcodePopup :visible="showQrcode" @close="showQrcode = false" /> -->
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -58,7 +92,6 @@ import { getRedeemableCoupons, redeemCoupon } from '../../api/coupon.js'
|
||||||
import { useUserStore } from '../../stores/user.js'
|
import { useUserStore } from '../../stores/user.js'
|
||||||
import { navigateBanner } from '../../utils/navigation.js'
|
import { navigateBanner } from '../../utils/navigation.js'
|
||||||
import { resolveImageUrl } from '../../utils/image.js'
|
import { resolveImageUrl } from '../../utils/image.js'
|
||||||
import CouponCard from '../../components/CouponCard.vue'
|
|
||||||
import RedeemPopup from '../../components/RedeemPopup.vue'
|
import RedeemPopup from '../../components/RedeemPopup.vue'
|
||||||
import CouponGuidePopup from '../../components/CouponGuidePopup.vue'
|
import CouponGuidePopup from '../../components/CouponGuidePopup.vue'
|
||||||
|
|
||||||
|
|
@ -77,17 +110,6 @@ const showRedeem = ref(false)
|
||||||
const selectedCoupon = ref(null)
|
const selectedCoupon = ref(null)
|
||||||
const showQrcode = ref(false)
|
const showQrcode = ref(false)
|
||||||
|
|
||||||
// 入口标签映射
|
|
||||||
function getEntryLabel(key) {
|
|
||||||
const map = {
|
|
||||||
membership: t('home.membership'),
|
|
||||||
stamps: t('home.stamps'),
|
|
||||||
qrcode: t('home.qrcode'),
|
|
||||||
guide: t('home.guide')
|
|
||||||
}
|
|
||||||
return map[key] || key
|
|
||||||
}
|
|
||||||
|
|
||||||
// Banner点击导航
|
// Banner点击导航
|
||||||
function onBannerClick(banner) {
|
function onBannerClick(banner) {
|
||||||
navigateBanner(banner)
|
navigateBanner(banner)
|
||||||
|
|
@ -124,9 +146,7 @@ async function handleQrcodeEntry() {
|
||||||
} else {
|
} else {
|
||||||
uni.navigateTo({ url: '/pages/membership/membership' })
|
uni.navigateTo({ url: '/pages/membership/membership' })
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
// 错误已由请求模块统一处理
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用说明入口
|
// 使用说明入口
|
||||||
|
|
@ -135,9 +155,14 @@ async function handleGuideEntry() {
|
||||||
const res = await getCouponGuide()
|
const res = await getCouponGuide()
|
||||||
guideContent.value = res.data?.content || res.data || ''
|
guideContent.value = res.data?.content || res.data || ''
|
||||||
showGuide.value = true
|
showGuide.value = true
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
// 错误已由请求模块统一处理
|
}
|
||||||
}
|
|
||||||
|
// 格式化到期时间
|
||||||
|
function formatExpire(dateStr) {
|
||||||
|
if (!dateStr) return '无限制'
|
||||||
|
const d = new Date(dateStr)
|
||||||
|
return `${d.getFullYear()}年${d.getMonth() + 1}月${d.getDate()}日`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击兑换按钮
|
// 点击兑换按钮
|
||||||
|
|
@ -154,11 +179,9 @@ async function onRedeemConfirm() {
|
||||||
showRedeem.value = false
|
showRedeem.value = false
|
||||||
selectedCoupon.value = null
|
selectedCoupon.value = null
|
||||||
uni.showToast({ title: t('home.redeemSuccess'), icon: 'none' })
|
uni.showToast({ title: t('home.redeemSuccess'), icon: 'none' })
|
||||||
// 刷新优惠券列表
|
|
||||||
await loadCoupons()
|
await loadCoupons()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showRedeem.value = false
|
showRedeem.value = false
|
||||||
// 错误提示已由请求模块统一处理(积分不足、已下架等由后端message返回)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,21 +190,21 @@ async function loadBanners() {
|
||||||
try {
|
try {
|
||||||
const res = await getBanners()
|
const res = await getBanners()
|
||||||
banners.value = res.data || []
|
banners.value = res.data || []
|
||||||
} catch (e) { /* 错误已统一处理 */ }
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadEntries() {
|
async function loadEntries() {
|
||||||
try {
|
try {
|
||||||
const res = await getEntries()
|
const res = await getEntries()
|
||||||
entries.value = res.data || []
|
entries.value = res.data || []
|
||||||
} catch (e) { /* 错误已统一处理 */ }
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadCoupons() {
|
async function loadCoupons() {
|
||||||
try {
|
try {
|
||||||
const res = await getRedeemableCoupons()
|
const res = await getRedeemableCoupons()
|
||||||
coupons.value = res.data || []
|
coupons.value = res.data || []
|
||||||
} catch (e) { /* 错误已统一处理 */ }
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
@ -194,47 +217,183 @@ onMounted(() => {
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.home-page {
|
.home-page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f0e8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Banner */
|
||||||
|
.banner-wrap {
|
||||||
|
padding: 24rpx 24rpx 0;
|
||||||
|
}
|
||||||
.banner-swiper {
|
.banner-swiper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 360rpx;
|
height: 340rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner-image {
|
.banner-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
border-radius: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry-grid {
|
/* 成为会员入口 */
|
||||||
|
.membership-entry {
|
||||||
|
margin: 24rpx 24rpx 0;
|
||||||
|
background: linear-gradient(135deg, #4a5d4a, #3d4f3d);
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 30rpx 32rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
align-items: center;
|
||||||
padding: 30rpx 20rpx;
|
justify-content: space-between;
|
||||||
background-color: #ffffff;
|
}
|
||||||
margin-bottom: 20rpx;
|
.membership-entry-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.membership-icon-wrap {
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
.membership-icon-img {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
.membership-text {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.membership-title {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 4rpx;
|
||||||
|
}
|
||||||
|
.membership-sub {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
|
.membership-arrow {
|
||||||
|
font-size: 40rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry-item {
|
/* 功能入口行 */
|
||||||
width: 25%;
|
.entry-row {
|
||||||
|
display: flex;
|
||||||
|
padding: 24rpx 24rpx 0;
|
||||||
|
gap: 24rpx;
|
||||||
|
}
|
||||||
|
.entry-card {
|
||||||
|
flex: 1;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 36rpx 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 16rpx 0;
|
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
|
||||||
}
|
}
|
||||||
|
.entry-icon {
|
||||||
.entry-image {
|
width: 72rpx;
|
||||||
width: 96rpx;
|
height: 72rpx;
|
||||||
height: 96rpx;
|
margin-bottom: 16rpx;
|
||||||
margin-bottom: 12rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry-label {
|
.entry-label {
|
||||||
font-size: 24rpx;
|
font-size: 26rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.coupon-section {
|
/* 优惠券标题行 */
|
||||||
|
.coupon-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 36rpx 24rpx 16rpx;
|
||||||
|
}
|
||||||
|
.coupon-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.coupon-guide-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.guide-icon {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
}
|
||||||
|
.guide-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 优惠券列表 */
|
||||||
|
.coupon-list {
|
||||||
padding: 0 24rpx 24rpx;
|
padding: 0 24rpx 24rpx;
|
||||||
}
|
}
|
||||||
|
.coupon-card {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 32rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.coupon-info {
|
||||||
|
flex: 1;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
.coupon-name {
|
||||||
|
font-size: 34rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 600;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
.coupon-detail-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
.coupon-dot {
|
||||||
|
font-size: 14rpx;
|
||||||
|
color: #c9a96e;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
.coupon-detail-label {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.coupon-detail-value {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.coupon-detail-value.highlight {
|
||||||
|
color: #c9a96e;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 兑换按钮 */
|
||||||
|
.coupon-action {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.redeem-btn {
|
||||||
|
background: linear-gradient(135deg, #d4a855, #c9a96e);
|
||||||
|
border-radius: 36rpx;
|
||||||
|
padding: 16rpx 40rpx;
|
||||||
|
}
|
||||||
|
.redeem-btn-text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
BIN
mobile/static/ic_qrcode.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
mobile/static/ic_stamp.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
mobile/static/ic_vip.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
mobile/static/tab/ic_home.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
mobile/static/tab/ic_home_s.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
mobile/static/tab/ic_me.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
mobile/static/tab/ic_me_s.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |