| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <template>
- <view class="ezy-my-page">
- <view class="my-head-box">
- <icon class="head-img-box" :style="{backgroundImage: 'url(' + myInfoData.icon + ')'}"></icon>
- <view class="head-content-box">
- <text>{{myInfoData.nickName}}</text>
- </view>
- </view>
- <!-- 图 -->
- <!-- <img :src="" class="hyqy-box-img" /> -->
- <!-- 设置 -->
- <view class="my-list-box">
- <view class="list-item" @click="yingyongshezhi">
- <icon class="list-icon yysz-icon"></icon>
- <text>应用设置</text>
- </view>
- </view>
- <!-- 底部 -->
- <CustomTabBar :currentTabNumber="3"></CustomTabBar>
- </view>
- </template>
- <script setup>
- import {
- myInfo,
- zhuxiao,
- duihuanmaCode,
- myCardList,
- commonCardList
- } from '@/api/my.js'
- import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
- import {
- onLoad
- } from '@dcloudio/uni-app';
- import {
- reactive,
- ref
- } from "vue";
- let myInfoData = reactive({
- userImg: '',
- userName: '',
- credit: '',
- vipFlag: '',
- nickName: '',
- icon: '',
- });
- // 获取用户数据
- function getMyInfo() {
- myInfo({}).then(res => {
- myInfoData.userName = res.data.userName;
- myInfoData.nickName = res.data.nickName;
- if (res.data.nickName) {
- myInfoData.nickName = res.data.nickName;
- } else {
- myInfoData.nickName = '鹅状元';
- }
- if (res.data.icon) {
- myInfoData.icon = res.data.icon;
- } else {
- getUserImg(res.data.growthType)
- }
- })
- }
- // 获取用户头像
- function getUserImg(data) {
- switch (data) {
- case 0:
- myInfoData.icon = 'static/images/my/head-img0.png'
- break;
- case 1:
- myInfoData.icon = 'static/images/my/head-img1.png'
- break;
- case 2:
- myInfoData.icon = 'static/images/my/head-img2.png'
- break;
- case 3:
- myInfoData.icon = 'static/images/my/head-img3.png'
- break;
- default:
- myInfoData.icon = 'static/images/my/head-unlogin-img.png'
- break;
- }
- }
-
- function yingyongshezhi() {
- uni.redirectTo({
- url: '/pages/chanpinXuanze/myInfo'
- })
- }
- onLoad((options) => {
- getMyInfo();
- })
- </script>
|