Files
sifa-mp/pages/user/index.vue
T
2025-05-22 10:33:32 +08:00

109 lines
3.3 KiB
Vue

<template>
<view class="bg-gray-light min-height">
<u-navbar :autoBack="false" :bgColor="colors.LINEAR" :statusBarBgColor="colors.LINEAR" placeholder>
<template #left></template>
</u-navbar>
<view class=" p-20 flex justify-between" style="padding-bottom: 100rpx" :style="{background: colors.LINEAR}"
@click="userClick('/userPages/pages/profile')">
<view class="flex justify-start items-center">
<u-avatar :src="user.avatar" size="60"/>
<view class="flex justify-start items-start flex-col ml-25">
<u-text :text="user.nickname ? user.nickname : '点击登录' " color="white" size="15"/>
</view>
</view>
</view>
<view class="p-25">
<view class="card">
<u-button type="primary" :custom-style="{backgroundColor: '#00B48E', border: 0}" :hairline="false"
@click="userClick('/userPages/pages/userData')"
shape="circle" icon="/static/user/upload.png">认证企业
</u-button>
<u-cell-group :border="false">
<u-cell is-link label="我的企业" icon="/static/user/身份证证件.png"
@click="userClick('/userPages/pages/userData')"></u-cell>
<u-cell is-link label="我的法制检查" icon="/static/user/上传.png"
@click="userClick('/userPages/pages/userLawCheck')"></u-cell>
<u-cell is-link label="我的专题反馈" icon="/static/user/24gf-portraitMale.png"
@click="userClick('/userPages/pages/userFeedback')"></u-cell>
<u-cell is-link label="联系客服" icon="/static/user/客服.png" :border="false"></u-cell>
</u-cell-group>
</view>
</view>
<view class="p-25">
<u-button type="primary" shape="circle" v-if="logined">退出登录</u-button>
</view>
<u-gap height="140rpx"/>
<Login ref="Login" @done="getUserData"/>
<custom-tabbar :current="2"/>
</view>
</template>
<script>
import {clearUserInfo, getUserInfo, setUserInfo} from "@/util/user";
import * as COLORS from "@/config/color";
import {loginByPhoneReq, userInfoReq} from "@/api/user";
import {MAIN_API} from "@/config";
import Login from "@/components/Login.vue";
import {sysSettingInfoReq} from "@/api/common";
import CustomTabbar from "@/components/customTabbar.vue";
export default {
name: "index",
components: {CustomTabbar, Login},
data() {
return {
colors: COLORS,
user: null,
logined: false,
gridStyle: {
height: '180rpx'
},
loginCount: 0,
servicePhone: ''
}
},
methods: {
MAIN_API() {
return MAIN_API
},
async getUserData() {
const {data} = await userInfoReq()
this.user = data
this.logined = true
},
logout() {
clearUserInfo()
this.logined = false
},
login() {
this.$refs.Login.doLogin()
},
userClick(url) {
if (!this.logined) this.login()
else this.$jump(url)
},
},
onShow() {
this.logined = !!getUserInfo().token
if (this.logined) this.getUserData()
else this.login()
}
}
</script>
<style lang="scss" scoped>
.dot {
position: absolute;
right: 0;
top: -20rpx;
width: 40rpx;
heigth: 40rpx;
border-radius: 40rpx;
background-color: #E55744;
color: white;
display: flex;
align-items: center;
justify-content: center;
}
</style>