【fix】优化代码
This commit is contained in:
@ -10,7 +10,7 @@ import { toRefs } from "vue";
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
import { useInterface } from "@/hooks/useInterface";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useMainStore } from "@/store/store";
|
||||
import { useMainStore } from "@/store/modules/useMainStore";
|
||||
import { useService } from "@/hooks/useService";
|
||||
|
||||
const props = defineProps({
|
||||
@ -41,7 +41,7 @@ async function toLink(listItem) {
|
||||
if (!user.value) return toast({title: '请先登录'})
|
||||
if (!listItem.path) return toast({title: ' 暂未开放 '})
|
||||
if (listItem.path === 'kf') {
|
||||
const {getServiceData,openService} = useService();
|
||||
const {getServiceData, openService} = useService();
|
||||
await getServiceData()
|
||||
await openService()
|
||||
return
|
||||
|
@ -2,114 +2,116 @@
|
||||
<view class="mine-container">
|
||||
|
||||
<Header :show-return="false">我的</Header>
|
||||
<!-- user info -->
|
||||
<view class="userinfo-box">
|
||||
<!-- 未登录 -->
|
||||
<view
|
||||
class="userinfo-box__inner no-login"
|
||||
v-if="!(user && user.id)"
|
||||
@click="toLogin"
|
||||
>
|
||||
<view class="flex flex-ai__center">
|
||||
<image
|
||||
class="head"
|
||||
:src="defaultAvatarIcon"
|
||||
/>
|
||||
<view class="user-info">
|
||||
点击登录
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 已登录 -->
|
||||
<view
|
||||
class="userinfo-box__inner"
|
||||
@click="toUserCenter"
|
||||
v-else
|
||||
>
|
||||
<view class="flex flex-ai__center">
|
||||
<image
|
||||
class="head"
|
||||
:src="user.avatar"
|
||||
/>
|
||||
<view class="user-info">
|
||||
{{ user.nickname }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-top">
|
||||
<!-- user info -->
|
||||
<view class="userinfo-box">
|
||||
<!-- 未登录 -->
|
||||
<view
|
||||
class="sign-box"
|
||||
@click.stop="goSignIn">
|
||||
<image :src="mySignIn" />
|
||||
签到
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 账户信息 -->
|
||||
<view class="account-box">
|
||||
<template
|
||||
v-for="item in accountList"
|
||||
:key="item.id">
|
||||
<view
|
||||
v-if="user"
|
||||
class="account-item"
|
||||
@click.stop="handleJump(item)">
|
||||
<view class="count">
|
||||
{{ user[item.field] || 0 }}
|
||||
</view>
|
||||
<view class="title">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- VIP 信息 未激活 -->
|
||||
<view
|
||||
class="vip-box vip-none"
|
||||
@click="goMemberCenter"
|
||||
v-if="!memberLeverInfo.currentLevel">
|
||||
<view
|
||||
class="vip-box__inner flex flex-ai__center flex-jc__sb"
|
||||
:style="{backgroundImage:`url(${myVip1})`}">
|
||||
<image
|
||||
class="icon"
|
||||
:src="noneVip" />
|
||||
<view class="vip-text">
|
||||
开通享更多特权,省钱又省心
|
||||
</view>
|
||||
<view class="vip-button">
|
||||
立即激活
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- VIP 信息 激活 -->
|
||||
<view
|
||||
class="vip-box"
|
||||
@click="goMemberCenter"
|
||||
v-else>
|
||||
<view
|
||||
class="vip-box__inner "
|
||||
:style="{backgroundImage:`url(${myVip1})`}">
|
||||
<view class="flex flex-ai__center flex-jc__sb">
|
||||
<image
|
||||
class="icon"
|
||||
:src="memberLeverInfo.currentLevel.iconUrl" />
|
||||
<view class="vip-text flex flex-ai__center">
|
||||
{{ memberLeverInfo.currentLevel.levelName }}
|
||||
<view class="process">
|
||||
<view
|
||||
class="schedule"
|
||||
:style="{width: `${memberLeverInfo.needGrowthValue/memberLeverInfo.nextLevel.growthValue}%`}"></view>
|
||||
class="userinfo-box__inner no-login"
|
||||
v-if="!(user && user.id)"
|
||||
@click="toLogin"
|
||||
>
|
||||
<view class="flex flex-ai__center">
|
||||
<image
|
||||
class="head"
|
||||
:src="defaultAvatarIcon"
|
||||
/>
|
||||
<view class="user-info">
|
||||
点击登录
|
||||
</view>
|
||||
</view>
|
||||
<view class="vip-button">
|
||||
查看权益 >
|
||||
</view>
|
||||
<!-- 已登录 -->
|
||||
<view
|
||||
class="userinfo-box__inner"
|
||||
@click="toUserCenter"
|
||||
v-else
|
||||
>
|
||||
<view class="flex flex-ai__center">
|
||||
<image
|
||||
class="head"
|
||||
:src="user.avatar"
|
||||
/>
|
||||
<view class="user-info">
|
||||
{{ user.nickname }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="sign-box"
|
||||
@click.stop="goSignIn">
|
||||
<image :src="mySignIn" />
|
||||
签到
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips">
|
||||
再获取{{ memberLeverInfo.needGrowthValue }}经验,可升级为{{ memberLeverInfo.nextLevel.levelName }}会员
|
||||
</view>
|
||||
|
||||
<!-- 账户信息 -->
|
||||
<view class="account-box">
|
||||
<template
|
||||
v-for="item in accountList"
|
||||
:key="item.id">
|
||||
<view
|
||||
v-if="user"
|
||||
class="account-item"
|
||||
@click.stop="handleJump(item)">
|
||||
<view class="count">
|
||||
{{ user[item.field] || 0 }}
|
||||
</view>
|
||||
<view class="title">
|
||||
{{ item.field === 'integral' ? `我的${ integralName }` : item.label }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- VIP 信息 未激活 -->
|
||||
<view
|
||||
class="vip-box vip-none"
|
||||
@click="goMemberCenter"
|
||||
v-if="!memberLeverInfo.currentLevel">
|
||||
<view
|
||||
class="vip-box__inner flex flex-ai__center flex-jc__sb"
|
||||
:style="{backgroundImage:`url(${myVip1})`}">
|
||||
<image
|
||||
class="icon"
|
||||
:src="noneVip" />
|
||||
<view class="vip-text">
|
||||
开通享更多特权,省钱又省心
|
||||
</view>
|
||||
<view class="vip-button">
|
||||
立即激活
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- VIP 信息 激活 -->
|
||||
<view
|
||||
class="vip-box"
|
||||
@click="goMemberCenter"
|
||||
v-else>
|
||||
<view
|
||||
class="vip-box__inner "
|
||||
:style="{backgroundImage:`url(${myVip1})`}">
|
||||
<view class="flex flex-ai__center flex-jc__sb">
|
||||
<image
|
||||
class="icon"
|
||||
:src="memberLeverInfo.currentLevel.iconUrl" />
|
||||
<view class="vip-text flex flex-ai__center">
|
||||
{{ memberLeverInfo.currentLevel.levelName }}
|
||||
<view class="process">
|
||||
<view
|
||||
class="schedule"
|
||||
:style="{width: `${memberLeverInfo.needGrowthValue/memberLeverInfo.nextLevel.growthValue}%`}"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="vip-button">
|
||||
查看权益 >
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips">
|
||||
再获取{{ memberLeverInfo.needGrowthValue }}经验,可升级为{{ memberLeverInfo.nextLevel.levelName }}会员
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -147,7 +149,7 @@ import Header from '@/components/Header/index.vue'
|
||||
|
||||
import { orderUserCount } from '@/api/order'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { useMainStore } from '@/store/store'
|
||||
import { useMainStore } from '@/store/modules/useMainStore'
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
import { storeToRefs } from "pinia";
|
||||
import GridCard from "@/root/user/components/GridCard.vue";
|
||||
@ -155,10 +157,10 @@ import { accountList, cardOneList, cardTwoList, orderIconList } from "@/root/use
|
||||
import { defaultAvatarIcon, mySignIn, myVip1, myVipNone, noneVip } from "@/utils/images";
|
||||
import { useInterface } from "@/hooks/useInterface";
|
||||
import { useJump } from "@/hooks/useJump";
|
||||
import { getUserMemberLevel } from "@/api/member";
|
||||
import { getIntegralName, getUserMemberLevel } from "@/api/member";
|
||||
|
||||
const mainStore = useMainStore()
|
||||
const {user} = storeToRefs(mainStore);
|
||||
const {user, integralName} = storeToRefs(mainStore);
|
||||
const {push} = useRouter()
|
||||
const {toast} = useInterface();
|
||||
const {goSignIn, goMemberCenter} = useJump()
|
||||
@ -204,6 +206,7 @@ async function doGetUserMemberLevel() {
|
||||
memberLeverInfo.value = await getUserMemberLevel()
|
||||
}
|
||||
|
||||
|
||||
function handleJump(item) {
|
||||
if (!item.path) return toast({title: '暂未开放~'})
|
||||
if (typeof item.path === 'function') {
|
||||
@ -225,7 +228,12 @@ onShow(() => {
|
||||
scoped
|
||||
>
|
||||
.mine-container {
|
||||
background: linear-gradient(to bottom, #fff 0%, #fff 28%, #b0b0b0 40%, #fff 41%);
|
||||
background-color: #ffffff;
|
||||
|
||||
.user-top {
|
||||
padding-bottom: 22rpx;
|
||||
background: url("https://b2c-pro-static-dev.zkthink.com/static/my/bg-top.png") no-repeat bottom center / 100% auto;
|
||||
}
|
||||
|
||||
.userinfo-box {
|
||||
@include usePadding(32, 0);
|
||||
@ -379,7 +387,8 @@ onShow(() => {
|
||||
.big-card {
|
||||
width: 100%;
|
||||
background: #f6f6f6;
|
||||
border-radius: 30rpx;
|
||||
border-radius: 30rpx 30rpx 0 0;
|
||||
margin-top: -22rpx;
|
||||
@include usePadding(32, 32);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user