2022-10-14 05:38:26 +00:00
|
|
|
<template>
|
|
|
|
<view class="pad-x120" v-if="isLoading">
|
|
|
|
<!-- 个人信息 -->
|
|
|
|
<view class="my-herder border-box" :style="{'padding-top':statusHeight+50+'px'}">
|
|
|
|
<!-- 头像 -->
|
|
|
|
<view class="my-portrait radius100">
|
|
|
|
<image :src="headPortrait" mode="widthFix"></image>
|
|
|
|
</view>
|
|
|
|
<!-- 用户名 -->
|
|
|
|
<view class="my-nickname mar-s10 color-ff font36 flex">
|
|
|
|
<text>{{nickName}}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- 其他资料 -->
|
|
|
|
<view class="my-content background-white radius10 border-box">
|
|
|
|
<view class="item flex" v-for="(item,index) in listData" :key="index" @tap.stop="goPage(index)">
|
|
|
|
<view class="title flex">
|
|
|
|
<view class="img flex">
|
|
|
|
<image :src="item.imgSrc" :style="{width:item.iconWidth+'rpx',height:item.iconHeight+'rpx'}" mode="widthFix"></image>
|
|
|
|
</view>
|
|
|
|
<view class="title font28">{{item.titele}}</view>
|
|
|
|
</view>
|
|
|
|
<view class="more">
|
2022-10-20 13:07:14 +00:00
|
|
|
<image src="/static/icon-join.png" mode="widthFix" style="width: 14rpx;height: 26rpx;"></image>
|
2022-10-14 05:38:26 +00:00
|
|
|
</view>
|
2023-01-06 07:07:02 +00:00
|
|
|
<button class="get-phone-btn" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber" v-if="index==0&&mobile!==''"></button>
|
2022-10-14 05:38:26 +00:00
|
|
|
</view>
|
|
|
|
</view>
|
2022-11-28 07:21:53 +00:00
|
|
|
<!-- 发布按钮 -->
|
|
|
|
<release-btn></release-btn>
|
2022-10-14 05:38:26 +00:00
|
|
|
<!-- 底部tab -->
|
|
|
|
<tabbar current="1"></tabbar>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-11-28 07:21:53 +00:00
|
|
|
import releaseBtn from '@/components/release-btn/release-btn.vue';
|
2022-10-14 05:38:26 +00:00
|
|
|
import tabbar from '@/components/tabbar/tabbar.vue';
|
|
|
|
import {mapState} from 'vuex'//引入mapState
|
|
|
|
export default {
|
|
|
|
components:{
|
2022-11-28 07:21:53 +00:00
|
|
|
releaseBtn,
|
|
|
|
tabbar
|
2022-10-14 05:38:26 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
|
|
|
headPortrait:'', //头像
|
|
|
|
nickName:'', //用户名
|
2022-10-20 13:07:14 +00:00
|
|
|
mobile:'', //电话号
|
2022-10-14 05:38:26 +00:00
|
|
|
listData:[
|
|
|
|
{titele:'个人资料',imgSrc:'/static/icon-my-01.png',iconWidth:36,iconHeight:36},
|
2022-12-02 10:12:31 +00:00
|
|
|
{titele:'我的发布',imgSrc:'/static/icon-my-02.png',iconWidth:36,iconHeight:36},
|
|
|
|
{titele:'反馈建议',imgSrc:'/static/icon-my-03.png',iconWidth:36,iconHeight:36}
|
2022-10-14 05:38:26 +00:00
|
|
|
], //列表数据
|
|
|
|
isLoading:false, //是否加载完成
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
// 获取用户信息
|
|
|
|
this.getUserInfo();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
// 获取用户信息
|
|
|
|
getUserInfo(){
|
|
|
|
uni.showLoading({
|
|
|
|
title:'加载中'
|
|
|
|
});
|
2022-10-20 13:07:14 +00:00
|
|
|
this.$requst.get('/api/v1/user/info').then(res=>{
|
2022-10-14 05:38:26 +00:00
|
|
|
console.log(res,'用户信息');
|
|
|
|
if(res.code==0) {
|
|
|
|
this.headPortrait = res.data.headimgurl;
|
|
|
|
this.nickName = res.data.nickname;
|
|
|
|
this.mobile = res.data.mobile;
|
|
|
|
}
|
|
|
|
uni.hideLoading();
|
2022-11-02 06:15:55 +00:00
|
|
|
|
2022-10-14 05:38:26 +00:00
|
|
|
this.isLoading = true;
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 跳转方式
|
|
|
|
goPage(index){
|
|
|
|
switch (index){
|
|
|
|
case 0:{
|
2023-01-06 07:07:02 +00:00
|
|
|
if(this.mobile==''){
|
2022-10-14 05:38:26 +00:00
|
|
|
uni.navigateTo({
|
|
|
|
url:`/pages/my/ucenter`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:{
|
|
|
|
uni.navigateTo({
|
2022-12-05 02:35:44 +00:00
|
|
|
url:`/pagesA/goods/goods`
|
2022-10-14 05:38:26 +00:00
|
|
|
})
|
|
|
|
break;
|
|
|
|
}
|
2022-12-02 10:12:31 +00:00
|
|
|
case 2:{
|
|
|
|
uni.navigateTo({
|
2022-12-05 02:35:44 +00:00
|
|
|
url:`/pagesA/feedback/feedback`
|
2022-12-02 10:12:31 +00:00
|
|
|
})
|
|
|
|
break;
|
|
|
|
}
|
2022-10-14 05:38:26 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// 获取授权信息
|
|
|
|
onGetPhoneNumber(e){
|
|
|
|
if(e.detail.errMsg=="getPhoneNumber:fail user deny"){ //用户决绝授权
|
|
|
|
this.$toolAll.tools.showToast('您已拒绝授权');
|
|
|
|
}else{ //允许授权
|
|
|
|
let params={
|
|
|
|
iv:e.detail.iv,
|
|
|
|
encryptedData:e.detail.encryptedData
|
|
|
|
}
|
2022-10-20 13:07:14 +00:00
|
|
|
this.$requst.post('/api/v1/user/bind-phone',params).then(res=>{
|
2022-10-14 05:38:26 +00:00
|
|
|
if(res.code==0) {
|
|
|
|
this.$toolAll.tools.showToast('绑定成功');
|
|
|
|
this.getUserInfo();
|
|
|
|
uni.navigateTo({
|
|
|
|
url:`/pages/my/revise`
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
this.$toolAll.tools.showToast(res.msg);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.my-herder{
|
|
|
|
width: 100%;
|
|
|
|
padding-bottom: 40rpx;
|
|
|
|
background-image: linear-gradient(to top,rgba(25,129,255,.5),rgba(25,129,255,1));
|
|
|
|
}
|
|
|
|
.my-portrait{
|
|
|
|
width: 180rpx;
|
|
|
|
height: 180rpx;
|
|
|
|
overflow: hidden;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
.my-portrait>image{
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.my-nickname{
|
|
|
|
justify-content: center;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.my-content{
|
|
|
|
width: calc(100% - 40rpx);
|
|
|
|
margin: 20rpx auto;
|
|
|
|
padding: 20rpx;
|
|
|
|
box-shadow: 0 0 15rpx rgba(0,0,0,.1);
|
|
|
|
}
|
|
|
|
.my-content .item{
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
height: 80rpx;
|
|
|
|
border-bottom: 2rpx solid #f4f5f6;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
.my-content .item:last-child{
|
|
|
|
border: 0;
|
|
|
|
}
|
|
|
|
.my-content .item .get-phone-btn{
|
|
|
|
opacity: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
.my-content .item>.title{
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.my-content .item>.title .img{
|
|
|
|
width: 46rpx;
|
|
|
|
}
|
|
|
|
</style>
|