This commit is contained in:
2025-11-25 17:51:37 +08:00
5 changed files with 415 additions and 299 deletions

View File

@@ -1,3 +1,3 @@
{ {
"prompt": "template" "prompt" : "template"
} }

View File

@@ -215,3 +215,42 @@ export async function verifyIAP(data: any) {
}) })
return res return res
} }
/**
* 获取充值列表
* @param type 固定值 point
* @param qudao 支付类型
*/
export async function getBookBuyConfigList(type: string, qudao: string) {
const res = await mainClient.request<IApiResponse>({
url: 'common/bookBuyConfig/getBookBuyConfigList',
method: 'POST',
data: {type, qudao}
})
return res
}
/**
* 获取隐私协议
* @param id 101众妙之门隐私政策
*/
export async function getAgreement(id: string) {
console.log(id, 'id');
const res = await mainClient.request<IApiResponse>({
url: '/sys/agreement/getAgreement',
method: 'POST',
data: {id}
})
return res
}
/**
* 获取活动说明
*/
export async function getActivityDescription() {
const res = await mainClient.request<IApiResponse>({
url: 'common/bookBuyConfig/getRechargeActivity',
method: 'POST'
})
return res
}

View File

@@ -1,5 +1,5 @@
{ {
"name" : "Amazing Limited", "name" : "com.amazinglimited",
"appid" : "__UNI__1250B39", "appid" : "__UNI__1250B39",
"description" : "Amazing Limited", "description" : "Amazing Limited",
"versionName" : "1.0.2", "versionName" : "1.0.2",
@@ -99,6 +99,22 @@
"splashscreen" : { "splashscreen" : {
"useOriginalMsgbox" : true "useOriginalMsgbox" : true
} }
},
"nativePlugins" : {
"sn-googlepay5" : {
"__plugin_info__" : {
"name" : "安卓 google pay v7 v8插件",
"description" : "安卓 google pay v7,v8支付(内购,订阅,更改订阅)插件",
"platforms" : "Android",
"url" : "https://ext.dcloud.net.cn/plugin?id=12608",
"android_package_name" : "com.amazinglimited",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 1,
"pid" : "12608",
"parameters" : {}
}
}
} }
}, },
/* */ /* */

View File

@@ -67,6 +67,18 @@
"navigationBarTitleText": "%user.feedback%", "navigationBarTitleText": "%user.feedback%",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "pages/user/recharge/index",
"style": {
"navigationBarTitleText": "%user.recharge%",
"navigationStyle": "custom"
}
},{
"path": "pages/user/virtual/index",
"style": {
"navigationBarTitleText": "%user.virtual%",
"navigationStyle": "custom"
}
}, { }, {
"path": "pages/user/myBook/index", "path": "pages/user/myBook/index",
"style": { "style": {

View File

@@ -1,34 +1,30 @@
<template> <template>
<view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }"> <view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }">
<!-- 设置图标 --> <!-- 设置图标 -->
<view class="settings-icon" :style="{ top: getNotchHeight() + 30 + 'px' }" @click="goSettings"> <view class="settings-icon" :style="{ top: getNotchHeight() + 30 + 'px' }" @click="goSettings">
<wd-icon name="setting1" size="24px" color="#666" /> <wd-icon name="setting1" size="24px" color="#666" />
<text>{{ $t('user.settings') }}</text> <text>{{ $t('user.settings') }}</text>
</view> </view>
<!-- 用户信息区域 --> <!-- 用户信息区域 -->
<view class="user-info-section"> <view class="user-info-section">
<view class="user-info"> <view class="user-info">
<image <image :src="userInfo.avatar || defaultAvatar" class="avatar" @click="goProfile" />
:src="userInfo.avatar || defaultAvatar" <view class="user-details">
class="avatar" <text class="nickname">{{ userInfo.nickname || $t('user.notSet') }}</text>
@click="goProfile" <text v-if="userInfo.email" class="email">{{ userInfo.email }}</text>
/> <text v-if="vipInfo.endTime && platform === 'ios'" class="vip-time">
<view class="user-details"> VIP {{ vipInfo.endTime.split(' ')[0] }} {{ $t('user.vipExpireTime') }}
<text class="nickname">{{ userInfo.nickname || $t('user.notSet') }}</text> </text>
<text v-if="userInfo.email" class="email">{{ userInfo.email }}</text> </view>
<text v-if="vipInfo.endTime && platform === 'ios'" class="vip-time"> </view>
VIP {{ vipInfo.endTime.split(' ')[0] }} {{ $t('user.vipExpireTime') }} </view>
</text>
</view>
</view>
</view>
<!-- VIP订阅卡片 --> <!-- VIP订阅卡片 -->
<view class="vip-card-section"> <view class="vip-card-section">
<view class="vip-card"> <view class="vip-card">
用户VIP功能重写中 用户VIP功能重写中
<!-- <view v-if="vipInfo.id" class="vip-info"> <!-- <view v-if="vipInfo.id" class="vip-info">
<text class="label">{{ $t('user.vip') }}</text> <text class="label">{{ $t('user.vip') }}</text>
<text class="value">{{ vipInfo.endTime ? vipInfo.endTime.split(' ')[0] : '' }}</text> <text class="value">{{ vipInfo.endTime ? vipInfo.endTime.split(' ')[0] : '' }}</text>
</view> </view>
@@ -40,304 +36,357 @@
> >
{{ $t('user.subscribe') }} {{ $t('user.subscribe') }}
</wd-button> --> </wd-button> -->
</view> </view>
</view> </view>
<!-- 我的资产 --> <!-- 我的资产 -->
<view class="vip-card-section wallet-section"> <view class="vip-card-section wallet-section">
<view class="vip-card wallet_l"> <view class="vip-card wallet_l">
我的资产功能重写中 <view class="assets">
<!-- <text class="wallet_title">{{$t('my.coin')}}<uni-icons type="help" size="19" color="#666"></uni-icons></text> <view @click="goVirtualList">
<view class="assets_row">天医币</view>
<view>{{userInfo.peanutCoin ?? 1}}</view>
</view>
<view>
<view class="assets_row">积分</view>
<view>{{userInfo.jf ?? 1}}</view>
</view>
<view>
<view class="assets_row">优惠卷</view>
<view>0</view>
</view>
</view>
<view class="chong_btn" @click="goRecharge"> </view>
<!-- <text class="wallet_title">{{$t('my.coin')}}<uni-icons type="help" size="19" color="#666"></uni-icons></text>
<text class="wallet_count">{{userMes.peanutCoin}}</text> --> <text class="wallet_count">{{userMes.peanutCoin}}</text> -->
</view> </view>
</view> </view>
<!-- 功能菜单列表 --> <!-- 功能菜单列表 -->
<view class="menu-section"> <view class="menu-section">
<view class="menu-list"> <view class="menu-list">
<view <view v-for="item in menuItems" :key="item.id" class="menu-item" @click="handleMenuClick(item)">
v-for="item in menuItems" <text class="menu-text">{{ item.name }}</text>
:key="item.id" <wd-icon name="arrow-right" size="16px" color="#aaa" />
class="menu-item" </view>
@click="handleMenuClick(item)" </view>
> </view>
<text class="menu-text">{{ item.name }}</text> </view>
<wd-icon name="arrow-right" size="16px" color="#aaa" />
</view>
</view>
</view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { getUserInfo, getVipInfo } from '@/api/modules/user' import { getUserInfo, getVipInfo } from '@/api/modules/user'
import type { IVipInfo } from '@/types/user' import type { IVipInfo } from '@/types/user'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { getNotchHeight } from '@/utils/system' import { getNotchHeight } from '@/utils/system'
const { t } = useI18n() const { t } = useI18n()
const userStore = useUserStore() const userStore = useUserStore()
// 默认头像 // 默认头像
const defaultAvatar = '/static/home_icon.png' const defaultAvatar = '/static/home_icon.png'
// 用户信息 // 用户信息
const userInfo = computed(() => userStore.userInfo) const userInfo = computed(() => userStore.userInfo)
// VIP信息 // VIP信息
const vipInfo = ref<IVipInfo>({ const vipInfo = ref<IVipInfo>({
id: 0, id: 0,
endTime: '', endTime: '',
vipType: 0 vipType: 0
}) })
// 平台信息 // 平台信息
const platform = ref('') const platform = ref('')
// 菜单项 // 菜单项
const menuItems = computed(() => [ const menuItems = computed(() => [
{ {
id: 1, id: 1,
name: t('user.myOrders'), name: t('user.myOrders'),
url: '/pages/user/order/index', url: '/pages/user/order/index',
type: 'pageJump' type: 'pageJump'
}, },
{ {
id: 2, id: 2,
name: t('user.myBooklist'), name: t('user.myBooklist'),
url: '/pages/user/myBook/index', url: '/pages/user/myBook/index',
type: 'pageJump' type: 'pageJump'
}, },
{ {
id: 3, id: 3,
name: t('user.profile'), name: t('user.profile'),
url: '/pages/user/profile/index', url: '/pages/user/profile/index',
type: 'pageJump' type: 'pageJump'
}, },
{ {
id: 4, id: 4,
name: t('user.about'), name: t('user.about'),
url: '/pages/user/about/index', url: '/pages/user/about/index',
type: 'pageJump' type: 'pageJump'
}, },
{ {
id: 5, id: 5,
name: t('user.feedback'), name: t('user.feedback'),
url: '/pages/user/feedback/index', url: '/pages/user/feedback/index',
type: 'pageJump' type: 'pageJump'
} }
]) ])
/** /**
* 获取平台信息 * 获取平台信息
*/ */
const getPlatform = () => { const getPlatform = () => {
const systemInfo = uni.getSystemInfoSync() const systemInfo = uni.getSystemInfoSync()
platform.value = systemInfo.platform === 'android' ? 'android' : 'ios' platform.value = systemInfo.platform === 'android' ? 'android' : 'ios'
} }
/** /**
* 获取数据 * 获取数据
*/ */
const getData = async () => { const getData = async () => {
try { try {
// 获取用户信息 // 获取用户信息
const userRes = await getUserInfo() const userRes = await getUserInfo()
if (userRes.user) { console.log(userRes);
userStore.setUserInfo(userRes.user) if (userRes.user) {
} userStore.setUserInfo(userRes.user)
}
// 获取VIP信息 // 获取VIP信息
const vipRes = await getVipInfo() const vipRes = await getVipInfo()
if (vipRes.vipInfo) { if (vipRes.vipInfo) {
vipInfo.value = vipRes.vipInfo vipInfo.value = vipRes.vipInfo
} }
} catch (error) { } catch (error) {
console.error('获取数据失败:', error) console.error('获取数据失败:', error)
} }
} }
/** /**
* 跳转到设置页面 * 跳转到设置页面
*/ */
const goSettings = () => { const goSettings = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/settings/index' url: '/pages/user/settings/index'
}) })
} }
/** /**
* 跳转到个人资料页面 * 跳转到个人资料页面
*/ */
const goProfile = () => { const goProfile = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/profile/index' url: '/pages/user/profile/index'
}) })
} }
/** /**
* 跳转到订阅页面 * 跳转到订阅页面
*/ */
const goSubscribe = () => { const goSubscribe = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/wallet/index' url: '/pages/user/wallet/index'
}) })
} }
/** /**
* 处理菜单点击 * 处理菜单点击
*/ */
const handleMenuClick = (item: any) => { const handleMenuClick = (item : any) => {
switch (item.type) { switch (item.type) {
case 'pageJump': case 'pageJump':
uni.navigateTo({ uni.navigateTo({
url: item.url url: item.url
}) })
break break
case 'switchTab': case 'switchTab':
uni.switchTab({ uni.switchTab({
url: item.url url: item.url
}) })
break break
} }
} }
onMounted(() => { /**
getPlatform() * 跳转充值页面
getData() */
}) const goRecharge = () => {
uni.navigateTo({
url: '/pages/user/recharge/index'
})
}
/**
* 跳转虚拟币页面
*/
const goVirtualList = () => {
uni.navigateTo({
url: '/pages/user/virtual/index'
})
}
onMounted(() => {
getPlatform()
getData()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
$theme-color: #54a966; $theme-color: #54a966;
.user-page { .user-page {
min-height: 100vh; min-height: 100vh;
background-color: #f7faf9; background-color: #f7faf9;
} }
.settings-icon { .settings-icon {
position: absolute; position: absolute;
right: 20px; right: 20px;
z-index: 2; z-index: 2;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
line-height: 1.2; line-height: 1.2;
text { text {
display: block; display: block;
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
} }
} }
.user-info-section { .user-info-section {
padding: 0 30rpx; padding: 0 30rpx;
margin-bottom: 50rpx; margin-bottom: 50rpx;
} }
.user-info { .user-info {
display: flex; display: flex;
align-items: center; align-items: center;
.avatar { .avatar {
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
border-radius: 100rpx; border-radius: 100rpx;
margin-right: 30rpx; margin-right: 30rpx;
} }
.user-details { .user-details {
flex: 1; flex: 1;
.nickname { .nickname {
display: block; display: block;
font-size: 38rpx; font-size: 38rpx;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.email { .email {
display: block; display: block;
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.vip-time { .vip-time {
display: block; display: block;
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
} }
} }
} }
.vip-card-section { .vip-card-section {
padding: 0 20rpx; padding: 0 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.vip-card { .vip-card {
background: #fff; background: #fff;
border-radius: 15rpx; border-radius: 15rpx;
padding: 40rpx; padding: 40rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
.vip-info { .vip-info {
text-align: center; text-align: center;
.label { .label {
display: block; display: block;
font-size: 32rpx; font-size: 32rpx;
color: #333; color: #333;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.value { .value {
display: block; display: block;
font-size: 30rpx; font-size: 30rpx;
color: $theme-color; color: $theme-color;
} }
} }
} }
.menu-section { .menu-section {
padding: 20rpx 20rpx 0; padding: 20rpx 20rpx 0;
} }
.menu-list { .menu-list {
background: #fff; background: #fff;
border-radius: 15rpx; border-radius: 15rpx;
overflow: hidden; overflow: hidden;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
} }
.menu-item { .menu-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 30rpx; padding: 30rpx;
border-bottom: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
} }
&:active { &:active {
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.menu-text { .menu-text {
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
line-height: 40rpx; line-height: 40rpx;
} }
} }
.chong_btn {
font-size: 26rpx;
display: block;
border-radius: 50rpx;
color: #fffbf6;
padding: 10rpx 32rpx;
background-image: linear-gradient(90deg, #3ab3ae 0%, #d5ecdd 200%);
}
.assets {
display: flex;
flex: 1;
justify-content: space-around;
text-align: center;
transform:translateX(-20px);
.assets_row {
margin-bottom: 20rpx;
}
}
</style> </style>