i
This commit is contained in:
@@ -8,18 +8,19 @@
|
||||
<view class="user-center-card__header__avatar">
|
||||
<nut-avatar size="large">
|
||||
<img
|
||||
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
|
||||
:src="userInfo.avatarUrl"
|
||||
/>
|
||||
</nut-avatar>
|
||||
</view>
|
||||
<view class="user-center-card__header__info">
|
||||
<view class="user-center-card__header__info__name">小明</view>
|
||||
<view class="user-center-card__header__info__name">{{ userInfo.nickName }}</view>
|
||||
<view class="user-center-card__header__info__desc"
|
||||
>ID:{{ 1 }}</view
|
||||
>ID:{{ userInfo.ID }}
|
||||
</view
|
||||
>
|
||||
</view>
|
||||
<view class="rightIcon">
|
||||
<Setting @click="toSetting" size="22" />
|
||||
<Setting @click="toSetting" size="22"/>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="user-center-card__header__transparent">
|
||||
@@ -34,7 +35,8 @@
|
||||
<view
|
||||
class="user-center-card__header__info__name"
|
||||
@tap="clickLogin"
|
||||
>点击立即授权</view
|
||||
>点击立即授权
|
||||
</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
@@ -45,24 +47,24 @@
|
||||
<view>我的订单</view>
|
||||
<view class="sub" @click="toOrderList(0)">
|
||||
<view>全部订单</view>
|
||||
<ArrowRight />
|
||||
<ArrowRight/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="center">
|
||||
<view class="center-t" @click="toOrderList(1)">
|
||||
<Order size="25px" />
|
||||
<Order size="25px"/>
|
||||
<view class="center-text">待付款</view>
|
||||
</view>
|
||||
<view class="center-t" @click="toOrderList(2)">
|
||||
<Clock size="25px" />
|
||||
<Clock size="25px"/>
|
||||
<view class="center-text">待使用</view>
|
||||
</view>
|
||||
<view class="center-t" @click="toOrderList(3)">
|
||||
<Shop size="25px" />
|
||||
<Shop size="25px"/>
|
||||
<view class="center-text">已使用</view>
|
||||
</view>
|
||||
<view class="center-t" @click="toOrderList(4)">
|
||||
<Del size="25px" />
|
||||
<Del size="25px"/>
|
||||
<view class="center-text">已失效</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -74,8 +76,10 @@
|
||||
<view class="box">
|
||||
<view
|
||||
class="box-mini"
|
||||
v-if="isLogin"
|
||||
v-for="item in userMenuList"
|
||||
:key="item.id"
|
||||
@click="toPage(item.url)"
|
||||
>
|
||||
<!-- <image :src="item.icon" /> -->
|
||||
<IconFont size="40" :name="item.icon"></IconFont>
|
||||
@@ -85,7 +89,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 商家管理 -->
|
||||
<view class="mer-box">
|
||||
<view class="mer-box" v-if="userInfo.bid !== 0">
|
||||
<nut-grid :gutter="10" :border="false">
|
||||
<nut-grid-item
|
||||
:border="false"
|
||||
@@ -105,14 +109,17 @@
|
||||
</nut-grid-item>
|
||||
</nut-grid>
|
||||
</view>
|
||||
|
||||
<!-- 版权 -->
|
||||
<!--<view class="copy">© 2023 </view>-->
|
||||
</view>
|
||||
<!-- 登录 -->
|
||||
<Auth :visible="isShowLogin" @update:visible="cancelLogin" />
|
||||
<Auth :visible="isShowLogin" @update:visible="cancelLogin" @ok="getUserInfo"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import {ref} from 'vue'
|
||||
import {
|
||||
ArrowRight,
|
||||
Order,
|
||||
@@ -120,40 +127,60 @@ import {
|
||||
Clock,
|
||||
Shop,
|
||||
Setting,
|
||||
IconFont,
|
||||
} from "@nutui/icons-vue-taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
import Auth from "../../components/Auth.vue";
|
||||
IconFont
|
||||
} from '@nutui/icons-vue-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import Auth from '@/components/Auth.vue'
|
||||
import {getPersonalInfo} from '@/api/user'
|
||||
|
||||
const isShowLogin = ref(false);
|
||||
const isShowLogin = ref(false)
|
||||
|
||||
const isLogin = ref(false);
|
||||
const isLogin = ref(false)
|
||||
|
||||
// const userInfo = ref({});
|
||||
interface UserInfo {
|
||||
nickName?: string
|
||||
avatarUrl?: string
|
||||
ID?: string
|
||||
bid?: number
|
||||
}
|
||||
|
||||
const userInfo = ref<UserInfo>({})
|
||||
|
||||
Taro.useLoad(() => {
|
||||
const token = Taro.getStorageSync("token");
|
||||
const token = Taro.getStorageSync('token')
|
||||
if (token) {
|
||||
isLogin.value = true;
|
||||
getUserInfo()
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const cancelLogin = () => {
|
||||
isShowLogin.value = false;
|
||||
};
|
||||
isShowLogin.value = false
|
||||
}
|
||||
|
||||
const getUserInfo = async () => {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
const res = await getPersonalInfo()
|
||||
userInfo.value = res.data.data
|
||||
Taro.setStorageSync('userInfo', res.data.data)
|
||||
isLogin.value = true
|
||||
cancelLogin()
|
||||
Taro.hideLoading()
|
||||
}
|
||||
|
||||
const toOrderList = (e: number) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/users/order_list/index?type=${e}`,
|
||||
});
|
||||
};
|
||||
url: `/pages/users/order_list/index?type=${e}`
|
||||
})
|
||||
}
|
||||
|
||||
const userMenuList = ref([
|
||||
{
|
||||
id: 1,
|
||||
label: "我的账户",
|
||||
url: "/pages/users/account/index",
|
||||
icon: "http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png",
|
||||
label: '我的账户',
|
||||
url: '/pages/users/account/index',
|
||||
icon: 'http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png'
|
||||
},
|
||||
// {
|
||||
// id: 2,
|
||||
@@ -163,39 +190,40 @@ const userMenuList = ref([
|
||||
// },
|
||||
{
|
||||
id: 3,
|
||||
label: "分销中心",
|
||||
url: "/pages/users/account/index",
|
||||
icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png",
|
||||
label: '分销中心',
|
||||
url: '',
|
||||
icon: 'http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
label: "关注商家",
|
||||
url: "/pages/users/account/index",
|
||||
icon: "http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png",
|
||||
label: '关注商家',
|
||||
url: '',
|
||||
icon: 'http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
label: "问题反馈",
|
||||
url: "/pages/users/account/index",
|
||||
icon: "http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png",
|
||||
},
|
||||
]);
|
||||
label: '问题反馈',
|
||||
url: '',
|
||||
icon: 'http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png'
|
||||
}
|
||||
])
|
||||
|
||||
const toSetting = () => {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/setting/index",
|
||||
});
|
||||
};
|
||||
url: '/pages/users/setting/index'
|
||||
})
|
||||
}
|
||||
|
||||
const clickLogin = () => {
|
||||
isShowLogin.value = true;
|
||||
};
|
||||
isShowLogin.value = true
|
||||
}
|
||||
|
||||
const toPage = (url: string) => {
|
||||
console.log(url)
|
||||
Taro.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
};
|
||||
url: url
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -210,6 +238,12 @@ const toPage = (url: string) => {
|
||||
color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666666));
|
||||
}
|
||||
|
||||
.user-center-card__header__avatar {
|
||||
img {
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.user-center-card__header__transparent {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
@@ -321,7 +355,6 @@ const toPage = (url: string) => {
|
||||
background-color: #fff;
|
||||
border-radius: 20px;
|
||||
margin: 20px;
|
||||
//padding: 30px;
|
||||
width: 710px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user