| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <template>
- <view class="content">
- <view class="user-header" v-if="userInfo">
- <view class="avatar">
- <image :src="userInfo?userInfo.avatar:'https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png'"></image>
- </view>
- <view class="info">
- <view class="name">{{userInfo.nickname}}</view>
- <view class="desc">{{userInfo.mobile}}</view>
- </view>
- </view>
- <view class="user-header" @click="toLogin" v-else>
- <view class="avatar"><image src="/static/logo.jpg"></image></view>
- <view class="info">
- <view class="name">请先登录</view>
- <view class="desc"></view>
- </view>
- </view>
- <view class="user-body" scroll-y scroll-with-animation>
- <view class="user-menu">
- <view class="title">我的服务</view>
- <view class="menu-item" @click="toLink">
- <view class="icon"><image src="/static/image/rule-rule.png"></image></view>
- <view class="name">我的投诉</view>
- <view class="right"><image src="/static/image/right.svg"></image></view>
- </view>
- <view class="menu-item" @click="kfPop">
- <view class="icon"><image src="/static/image/service.png"></image></view>
- <view class="name">商家客服</view>
- <view class="right"><image src="/static/image/right.svg"></image></view>
- </view>
- <view @click="toLicense" class="menu-item" url="/pages/user/license">
- <view class="icon"><image src="/static/image/zizhi.png"></image></view>
- <view class="name">服务资质</view>
- <view class="right"><image src="/static/image/right.svg"></image></view>
- </view>
- </view>
- <view class="user-menu" v-if="isLogin">
- <view class="menu-item" @click="outLogin">
- <view class="icon"><image src="/static/image/out.png"></image></view>
- <view class="name">退出</view>
- <view class="right"><image src="/static/image/right.svg"></image></view>
- </view>
- </view>
- </view>
- <halfLogin ref="loginCom" @success="loginSuccess"></halfLogin>
- <kfService ref="kfService"></kfService>
- </view>
- </template>
- <script>
- var app;
- export default {
- data() {
- return {
- userInfo:null,
- isLogin:null
- }
- },
- onShow() {
- this.getUser()
- },
- onLoad() {
- app = this;
- app.isLogin = uni.getStorageSync("user_token");
- },
- methods: {
- async getUser(){
- var resp = await app.$api.auth.check.get();
- if (resp.code !== 1) return ;
- app.userInfo = resp.data;
- },
- toLogin(){
- this.$refs.loginCom.open();
- },
- toLink(){
- const data = uni.getStorageSync("contact");
- if (!data) {
- return app.$dialog.showSuccess("请先从首页进入")
- }
- if (!app.isLogin) {
- this.$refs.loginCom.open();
- return ;
- }
- uni.navigateTo({
- url:"/pages/complaint/list?poi="+data.poi_id
- })
- },
- loginSuccess(token){
- app.isLogin = token;
- app.getUser()
- },
- outLogin(){
- app.$dialog.showError("确定要退出登录吗",function(res){
- if (res.confirm) {
- app.userInfo = null;
- uni.clearStorageSync();
- }
- })
- },
- toLicense(){
- const data = uni.getStorageSync("contact");
- if (!data) {
- return app.$dialog.showSuccess("请先从首页进入")
- }
- uni.navigateTo({
- url:"/pages/user/license?poi="+data.poi_id
- })
- },
- kfPop(){
- const isLogin = uni.getStorageSync("user_token");
- if (!isLogin) {
- this.$refs.loginCom.open();
- return ;
- }
- const data = uni.getStorageSync("contact");
- this.$refs.kfService.open(data);
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content{
- position: fixed;
- z-index: 1;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- background-color: #ededed;
- display: flex;
- flex-direction: column;
- }
- .user-menu{
- background-color: #fff;
- width: 95%;
- margin: 20rpx auto;
- border-radius: 20rpx;
- .title{
- font-size: 32rpx;
- font-weight: 800;
- color: #333;
- padding: 20rpx;
- }
- .menu-item{
- height: 100upx;
- line-height: 100upx;
- display: flex;
- align-items: center;
- font-size: 28upx;
- color: #333;
- padding: 0 20upx;
- border-bottom: 2upx solid #f8f8f8;
- .icon{
- margin-right: 20upx;
- display: flex;
- align-items: center;
- justify-content: center;
- image{
- width: 40upx;
- height: 40upx;
- }
- }
- .right{
- margin-right: 0;
- margin-left: auto;
- display: flex;
- align-items: center;
- justify-content: center;
- image{
- width: 40upx;
- height: 40upx;
- }
- }
- }
- }
- .user-header{
- background-color: $main-color;
- padding: 20rpx;
- display: flex;
- align-items: center;
- gap: 20rpx;
- .info {
- .name {
- color: #fff;
- font-size: 32rpx;
- font-weight: 700;
- }
- .desc {
- color: $main-sub-color;
- font-size: 28rpx;
- margin-top: 10rpx;
- }
- }
- .avatar {
- image {
- background-color: #fff;
- padding: 4rpx;
- width: 100rpx;
- height: 100rpx;
- border-radius: 20rpx;
- }
- }
- }
- .user-body{
- height: 0;
- flex: 1;
- }
- </style>
|