优化样式

This commit is contained in:
dengjie
2023-01-31 00:14:42 +08:00
parent 7502bab1c0
commit 6445aa4783
10 changed files with 113 additions and 227 deletions

View File

@@ -1,7 +1,7 @@
<template>
<view class="my_avatar">
<view style="border-radius: 50rpx;">
<u-avatar :src="avatar" size="100rpx" shape="circle"></u-avatar>
<u-avatar :src="avatar" size="100rpx" shape="circle" @click="changeAvatar()"></u-avatar>
</view>
<view style="margin-top: 10rpx;margin-bottom: 4rpx;">
<u--image v-if="member=='2'" :src="normal" width="84rpx" height="30rpx">
@@ -10,15 +10,21 @@
</u--image>
</view>
<view style="display: flex;align-items: center;">
<text>{{nickname}}</text>
<text @click="changeAvatar()">{{nickname}}</text>
<u--image v-if="showEdit==true" src="/static/my/wd_icon_bj.png" width="22rpx" height="22rpx"
@click="changeAvatar()">
</u--image>
</view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view>
</template>
<script>
import login from 'pages/my/login/login'
export default {
name: "myAvatar",
props: {
@@ -27,6 +33,9 @@
default: ''
}
},
components: {
login
},
data() {
return {
member: false,
@@ -35,6 +44,7 @@
nickname: '用户',
normal: '/static/my/wo_icon_pthy.png',
VIP: '/static/my/wo_icon_vip.png',
isLoad: true,
};
},
created() {
@@ -42,6 +52,14 @@
this.showEdit = false
}
this.getUser()
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
options: {
styleIsolation: 'shared', // 解除样式隔离
@@ -56,12 +74,33 @@
//获取头像昵称和普通会员和VIP会员
getUser() {
this.$apiServe.getUser().then(res => {
console.log('个人信息==', res.data.data);
console.log('个人信息==', res.data);
if (res.data.msg == "登录超时,请重新登录") {
this.isLoad = false
}
var data = res.data.data
this.avatar = data.avatar
this.nickname = data.nickname
this.member = data.member
}).finally(_ => {})
},
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
this.$refs.myavatar.getUser()
},
failToLoad() {
// uni.navigateBack({
// url: '/pages/my/my'
// })
this.$toast.warn('登录失败请重试')
}
}
}

View File

@@ -2,7 +2,7 @@
<view>
<view class="products_box">
<u-grid :border="false" col="2">
<u-grid-item v-for="(item,index) in productList" :key="index">
<u-grid-item v-for="(item,index) in productList" :key="index" @click="toDetailPage(item)">
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
</u-image>
<view class="bgContent">
@@ -29,16 +29,12 @@
</view>
</view>
</view>
<u-button v-if="type==1" type="success" text="取消收藏" color="#0EBB5B" @click="cancelCollect(item)">
</u-button>
<u-button v-if="type==2" type="success" text="移除" color="#0EBB5B" @click="deleteProduct(item)">
</u-button>
</u-grid-item>
</u-grid>
<!-- <u-modal :show="showM" :content="content" showCancelButton closeOnClickOverlay="false" @confirm="confirm"
@cancel="cancel">
</u-modal> -->
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-if="type==1&&productList.length==0">
暂无更多收藏记录</view>
@@ -133,6 +129,12 @@
}
})
},
//点击图片跳转到详情页
toDetailPage(item) {
uni.navigateTo({
url: '/pages/detail/productsDetail/productsDetail?id=' + item.id
})
}
}
}
</script>