This commit is contained in:
全栈小学生 2023-06-02 19:12:27 +08:00
parent 05a8c49ce6
commit 0825a05f0e
9 changed files with 321 additions and 287 deletions

View File

@ -67,5 +67,5 @@ export function bind(data : AnyObject) {
* 访 * 访
*/ */
export function memberLog(data : AnyObject) { export function memberLog(data : AnyObject) {
return request.post('member/log', data) return request.post('member/log', data, { showErrorMessage: false })
} }

View File

@ -1,11 +1,5 @@
<template> <template>
<view :style="warpCss"> <view :style="warpCss">
<!-- #ifdef MP-WEIXIN -->
<u-navbar :placeholder="true" bgColor="var(--primary-color)" titleStyle="color: #fff">
<template #left>
</template>
</u-navbar>
<!-- #endif -->
<view class="pt-[34rpx] member-info"> <view class="pt-[34rpx] member-info">
<view v-if="info" class="flex ml-[32rpx] mr-[52rpx] items-center relative"> <view v-if="info" class="flex ml-[32rpx] mr-[52rpx] items-center relative">
<!-- 唤起获取微信 --> <!-- 唤起获取微信 -->
@ -102,12 +96,14 @@
const memberStore = useMemberStore() const memberStore = useMemberStore()
// #ifdef H5
const { query } = urlDeconstruction(location.href) const { query } = urlDeconstruction(location.href)
if (query.code && isWeixinBrowser()) { if (query.code && isWeixinBrowser()) {
wechatSync({ code: query.code }).then(res => { wechatSync({ code: query.code }).then(res => {
memberStore.getMemberInfo() memberStore.getMemberInfo()
}) })
} }
// #endif
const info = computed(() => { const info = computed(() => {
// //

View File

@ -49,8 +49,10 @@
}) })
watch(() => info.value, () => { watch(() => info.value, () => {
if (info.value) {
formData.nickname = info.value.nickname formData.nickname = info.value.nickname
formData.headimg = info.value.headimg formData.headimg = info.value.headimg
}
}, { immediate: true }) }, { immediate: true })
const onChooseAvatar = (e) => { const onChooseAvatar = (e) => {

View File

@ -23,7 +23,7 @@
<u-icon name="checkbox-mark" color="var(--primary-color)" v-if="item.key == type"></u-icon> <u-icon name="checkbox-mark" color="var(--primary-color)" v-if="item.key == type"></u-icon>
</view> </view>
</block> </block>
<view class="py-[20rpx] text-center text-sm text-gray-subtitle">{{ t('pay.notHavePayType') }}</view> <view class="py-[20rpx] text-center text-sm text-gray-subtitle" v-else>{{ t('pay.notHavePayType') }}</view>
</view> </view>
</scroll-view> </scroll-view>
<view class="p-[30rpx]"> <view class="p-[30rpx]">

View File

@ -31,8 +31,10 @@ export const useShare = () => {
const setShare = async (options : any = {}) => { const setShare = async (options : any = {}) => {
let memberStore = useMemberStore(); let memberStore = useMemberStore();
// #ifdef H5
// 初始化sdk // 初始化sdk
await wechatInit(); await wechatInit();
// #endif
if (options && options.wechat && options.weapp) { if (options && options.wechat && options.weapp) {
let query = currShareRoute().params; let query = currShareRoute().params;

View File

@ -0,0 +1,12 @@
{
"nickname": "昵称",
"sex": "性别",
"mobile": "手机号",
"birthday": "生日",
"unknown": "未知",
"updateHeadimg": "更换头像",
"updateNickname": "修改昵称",
"man": "男",
"woman": "女",
"bindMobile": "绑定手机"
}

View File

@ -8,7 +8,7 @@
<input type="digit" class="h-[70rpx] leading-[70rpx] pl-[10rpx] flex-1 font-bold text-[60rpx]" <input type="digit" class="h-[70rpx] leading-[70rpx] pl-[10rpx] flex-1 font-bold text-[60rpx]"
v-model="applyData.apply_money" /> v-model="applyData.apply_money" />
<image @click="clearMoney" v-if="applyData.apply_money" <image @click="clearMoney" v-if="applyData.apply_money"
:src="img('static/resource/images/member/apply_cash_out/close.png')" class="w-[40rpx] h-[40rpx]" :src="img('static/resource/images/member/apply_withdrawal/close.png')" class="w-[40rpx] h-[40rpx]"
mode="widthFix" /> mode="widthFix" />
</view> </view>
<view class="pt-[20rpx]"> <view class="pt-[20rpx]">

View File

@ -1,20 +1,24 @@
<template> <template>
<view class="account-info-wrap"> <u-loading-page :loading="loading" loadingText=""></u-loading-page>
<view class="account-info-head" :style="{ background: 'url(' + img('static/resource/images/member/balance_bg.png') + ') no-repeat 95% 30% / auto 250rpx, linear-gradient(314deg, #FE7849 0%, #FF1959 100%)'}"> <view class="account-info-wrap" v-show="!loading">
<view class="account-info-head"
:style="{ background: 'url(' + img('static/resource/images/member/balance_bg.png') + ') no-repeat 95% 30% / auto 250rpx, linear-gradient(314deg, #FE7849 0%, #FF1959 100%)'}">
<view class="name">{{t('balanceInfo')}}</view> <view class="name">{{t('balanceInfo')}}</view>
<view class="content"> <view class="content">
<view class="money"> <view class="money">
{{ memberStore.info ? moneyFormat((parseFloat(memberStore.info.balance) + parseFloat(memberStore.info.money)).toString()) : 0.00 }} {{ memberStore.info ? moneyFormat((parseFloat(memberStore.info.balance) + parseFloat(memberStore.info.money)).toString()) : '0.00' }}
</view> </view>
<view class="text">{{t('accountBalance')}}</view> <view class="text">{{t('accountBalance')}}</view>
<view class="money-wrap"> <view class="money-wrap">
<view class="money-item" @click="redirect({ url: '/pages/member/detailed_account', param: { type : 'balance' } })"> <view class="money-item"
@click="redirect({ url: '/pages/member/detailed_account', param: { type : 'balance' } })">
<view class="money"> <view class="money">
{{ moneyFormat(memberStore.info?.balance)|| '0.00' }} {{ moneyFormat(memberStore.info?.balance)|| '0.00' }}
</view> </view>
<view class="text leading-none">{{ t('balance') }}</view> <view class="text leading-none">{{ t('balance') }}</view>
</view> </view>
<view class="money-item" @click="redirect({ url: '/pages/member/detailed_account', param: { type : 'money' } })"> <view class="money-item"
@click="redirect({ url: '/pages/member/detailed_account', param: { type : 'money' } })">
<view class="money"> <view class="money">
{{ moneyFormat(memberStore.info?.money)|| '0.00' }} {{ moneyFormat(memberStore.info?.money)|| '0.00' }}
</view> </view>
@ -28,18 +32,19 @@
<u-button type="primary" shape="circle" class="btn" <u-button type="primary" shape="circle" class="btn"
:customStyle="{backgroundColor: '#FE4E50',color: '#fff', borderColor: '#FE4E50',width: 'calc(100vw - 64rpx)'}" :customStyle="{backgroundColor: '#FE4E50',color: '#fff', borderColor: '#FE4E50',width: 'calc(100vw - 64rpx)'}"
@click="topUpFn"> @click="topUpFn">
<img class="max-w-[36rpx] max-h-[36rpx] mr-1" :src="img('static/resource/images/member/reset.png')" alt=""> <img class="max-w-[36rpx] max-h-[36rpx] mr-1" :src="img('static/resource/images/member/reset.png')"
alt="">
<text>{{t('recharge')}}</text> <text>{{t('recharge')}}</text>
</u-button> </u-button>
<u-button v-if="cashOutConfigObj.is_open == 1" type="primary" :plain="true" shape="circle" class="btn" <u-button v-if="cashOutConfigObj.is_open == 1" type="primary" :plain="true" shape="circle" class="btn"
:customStyle="{backgroundColor: '#fff',color: '#FE4E50', borderColor: '#FE4E50',width: 'calc(100vw - 64rpx)'}" :customStyle="{backgroundColor: '#fff',color: '#FE4E50', borderColor: '#FE4E50',width: 'calc(100vw - 64rpx)'}"
@click="applyCashOut"> @click="applyCashOut">
<img class="max-w-[36rpx] max-h-[36rpx] mr-1" :src="img('static/resource/images/member/withdraw_deposit.png')" alt=""> <img class="max-w-[36rpx] max-h-[36rpx] mr-1"
:src="img('static/resource/images/member/withdraw_deposit.png')" alt="">
<text>{{t('cashOut')}}</text> <text>{{t('cashOut')}}</text>
</u-button> </u-button>
</view> </view>
<!-- 充值 --> <!-- 充值 -->
<u-popup :show="topUpShow" mode="center" :round="10" @close="closePopup" :closeable="true"> <u-popup :show="topUpShow" mode="center" :round="10" @close="closePopup" :closeable="true">
<view class="w-80 px-3 pb-4 pt-7 box-border"> <view class="w-80 px-3 pb-4 pt-7 box-border">
@ -101,6 +106,8 @@
transfer_type: [] // transfer_type: [] //
}) })
const loading = ref(true);
onShow(() => { onShow(() => {
// h5 // h5
// #ifdef H5 // #ifdef H5
@ -111,6 +118,7 @@
for (let key in res.data) { for (let key in res.data) {
cashOutConfigObj[key] = res.data[key]; cashOutConfigObj[key] = res.data[key];
} }
loading.value = false;
}) })
}) })
@ -136,7 +144,7 @@
}) })
} }
const applyCashOut = ()=> { const applyCashOut = () => {
uni.setStorageSync('cashOutAccountType', 'money') uni.setStorageSync('cashOutAccountType', 'money')
redirect({ url: '/pages/member/apply_cash_out' }) redirect({ url: '/pages/member/apply_cash_out' })
} }

View File

@ -6,6 +6,7 @@ interface RequestConfig {
showErrorMessage ?: boolean showErrorMessage ?: boolean
showSuccessMessage ?: boolean showSuccessMessage ?: boolean
} }
interface RequestOptions extends UniNamespace.RequestOptions, RequestOptions { } interface RequestOptions extends UniNamespace.RequestOptions, RequestOptions { }
class Request { class Request {
@ -20,17 +21,21 @@ class Request {
// #ifdef H5 // #ifdef H5
this.baseUrl = import.meta.env.VITE_APP_BASE_URL || `${location.origin}/api/` this.baseUrl = import.meta.env.VITE_APP_BASE_URL || `${location.origin}/api/`
// #endif // #endif
// #ifndef H5 // #ifndef H5
this.baseUrl = import.meta.env.VITE_APP_BASE_URL this.baseUrl = import.meta.env.VITE_APP_BASE_URL
// #endif // #endif
try {
if (process.env.NODE_ENV == 'development') { if (process.env.NODE_ENV == 'development') {
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID) this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID)
} else { } else {
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID) this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID)
} }
this.config.header[import.meta.env.VITE_REQUEST_HEADER_CHANNEL_KEY] = getAppChannel() this.config.header[import.meta.env.VITE_REQUEST_HEADER_CHANNEL_KEY] = getAppChannel()
} catch (e) {
}
} }
/** /**
@ -38,7 +43,16 @@ class Request {
*/ */
private requestInterceptors() { private requestInterceptors() {
// 携带token site-id // 携带token site-id
try {
getToken() && (this.config.header[import.meta.env.VITE_REQUEST_HEADER_TOKEN_KEY] = getToken()) getToken() && (this.config.header[import.meta.env.VITE_REQUEST_HEADER_TOKEN_KEY] = getToken())
this.config.header[import.meta.env.VITE_REQUEST_HEADER_CHANNEL_KEY] = getAppChannel()
if (process.env.NODE_ENV == 'development') {
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID)
} else {
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID)
}
} catch (e) {
}
} }
public get(url : string, data : AnyObject = {}, config : RequestConfig = {}) { public get(url : string, data : AnyObject = {}, config : RequestConfig = {}) {