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) {
return request.post('member/log', data)
return request.post('member/log', data, { showErrorMessage: false })
}

View File

@ -1,11 +1,5 @@
<template>
<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 v-if="info" class="flex ml-[32rpx] mr-[52rpx] items-center relative">
<!-- 唤起获取微信 -->
@ -102,12 +96,14 @@
const memberStore = useMemberStore()
// #ifdef H5
const { query } = urlDeconstruction(location.href)
if (query.code && isWeixinBrowser()) {
wechatSync({ code: query.code }).then(res => {
memberStore.getMemberInfo()
})
}
// #endif
const info = computed(() => {
//

View File

@ -49,8 +49,10 @@
})
watch(() => info.value, () => {
if (info.value) {
formData.nickname = info.value.nickname
formData.headimg = info.value.headimg
}
}, { immediate: true })
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>
</view>
</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>
</scroll-view>
<view class="p-[30rpx]">

View File

@ -31,8 +31,10 @@ export const useShare = () => {
const setShare = async (options : any = {}) => {
let memberStore = useMemberStore();
// #ifdef H5
// 初始化sdk
await wechatInit();
// #endif
if (options && options.wechat && options.weapp) {
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]"
v-model="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" />
</view>
<view class="pt-[20rpx]">

View File

@ -1,20 +1,24 @@
<template>
<view class="account-info-wrap">
<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%)'}">
<u-loading-page :loading="loading" loadingText=""></u-loading-page>
<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="content">
<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 class="text">{{t('accountBalance')}}</view>
<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">
{{ moneyFormat(memberStore.info?.balance)|| '0.00' }}
</view>
<view class="text leading-none">{{ t('balance') }}</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">
{{ moneyFormat(memberStore.info?.money)|| '0.00' }}
</view>
@ -28,18 +32,19 @@
<u-button type="primary" shape="circle" class="btn"
:customStyle="{backgroundColor: '#FE4E50',color: '#fff', borderColor: '#FE4E50',width: 'calc(100vw - 64rpx)'}"
@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>
</u-button>
<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)'}"
@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>
</u-button>
</view>
<!-- 充值 -->
<u-popup :show="topUpShow" mode="center" :round="10" @close="closePopup" :closeable="true">
<view class="w-80 px-3 pb-4 pt-7 box-border">
@ -101,6 +106,8 @@
transfer_type: [] //
})
const loading = ref(true);
onShow(() => {
// h5
// #ifdef H5
@ -111,6 +118,7 @@
for (let key in res.data) {
cashOutConfigObj[key] = res.data[key];
}
loading.value = false;
})
})
@ -136,7 +144,7 @@
})
}
const applyCashOut = ()=> {
const applyCashOut = () => {
uni.setStorageSync('cashOutAccountType', 'money')
redirect({ url: '/pages/member/apply_cash_out' })
}

View File

@ -6,6 +6,7 @@ interface RequestConfig {
showErrorMessage ?: boolean
showSuccessMessage ?: boolean
}
interface RequestOptions extends UniNamespace.RequestOptions, RequestOptions { }
class Request {
@ -20,17 +21,21 @@ class Request {
// #ifdef H5
this.baseUrl = import.meta.env.VITE_APP_BASE_URL || `${location.origin}/api/`
// #endif
// #ifndef H5
this.baseUrl = import.meta.env.VITE_APP_BASE_URL
// #endif
try {
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)
}
this.config.header[import.meta.env.VITE_REQUEST_HEADER_CHANNEL_KEY] = getAppChannel()
} catch (e) {
}
}
/**
@ -38,7 +43,16 @@ class Request {
*/
private requestInterceptors() {
// 携带token site-id
try {
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 = {}) {