You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
245 lines
5.3 KiB
245 lines
5.3 KiB
<template>
|
|
<view class="my">
|
|
<navbar title="个人中心" :isCenter="true"></navbar>
|
|
<view class="userInfo">
|
|
<image src="../../static/my.png" mode="widthFix"></image>
|
|
<view class="avatar" v-if="userInfo&&userInfo.id">
|
|
<image src="../../static/avatar.png" mode=""></image>
|
|
<view class="userInfo">
|
|
<view class="userName">{{userInfo.username}}</view>
|
|
<view class="phone">{{userInfo.mobile}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="avatar" v-else>
|
|
<image src="../../static/avatar1.png" mode=""></image>
|
|
<view class="userInfo">
|
|
<view class="userName">请登录~</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="cellList">
|
|
<view class="cellItem" v-for="(item,index) in myList" :key="index" @click="goPage(item)">
|
|
<view class="left">
|
|
<image :src="item.icon" mode="widthFix"></image>
|
|
<text>{{item.name}}</text>
|
|
</view>
|
|
<image src="../../static/arrow.png" class="rightArrow" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="logOutBtn" @click="show=true">
|
|
退出登录
|
|
</view>
|
|
<u-modal :show="show" confirmColor="#8EC31F" @confirm="confirmHandle" @cancel="cancelHandle" :showCancelButton="true">
|
|
<view class="slot-content">
|
|
退出登录?
|
|
</view>
|
|
</u-modal>
|
|
<u-popup :show="kefu" @close="close" :closeable="true">
|
|
<view class="phoneContainer" @click="copyHandle">
|
|
<text>{{contactUs}}</text>
|
|
<text style="text-decoration: underline;color:#8EC31F" >复制</text>
|
|
</view>
|
|
</u-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import navbar from '@/components/navbar.vue'
|
|
import {logout,getUserInfo,getSetting} from '@/common/api.js'
|
|
import {removeAll} from '@/common/auth.js'
|
|
export default {
|
|
components:{navbar},
|
|
data() {
|
|
return {
|
|
myList:[
|
|
{icon:'../../static/m1.png',name:'爱家系列热水器',path:'',isweb:true},
|
|
{icon:'../../static/m2.png',name:'变频热风机',path:'',isweb:true},
|
|
{icon:'../../static/m3.png',name:'案例分享',path:'/pages/my/exampleShare',isweb:false},
|
|
{icon:'../../static/m4.png',name:'意见反馈',path:'/pages/my/feedback'},
|
|
{icon:'../../static/m5.png',name:'关于我们',path:"/pages/my/richText?name=关于我们"},
|
|
{icon:'../../static/m6.png',name:'联系客服',path:''}
|
|
],
|
|
userInfo:{},
|
|
show:false,
|
|
kefu:false,
|
|
contactUs:'',
|
|
rsq:'',
|
|
rfj:''
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.getSetting()
|
|
},
|
|
onShow() {
|
|
this.getUserInfo()
|
|
},
|
|
methods: {
|
|
logoutHandle(){
|
|
logout({ custom: { auth: true }}).then(res=>{
|
|
removeAll();
|
|
uni.reLaunch({
|
|
url:'/pages/login/login'
|
|
})
|
|
})
|
|
},
|
|
confirmHandle(){
|
|
this.logoutHandle()
|
|
},
|
|
cancelHandle(){
|
|
this.show = false;
|
|
},
|
|
goPage(item){
|
|
console.log(item)
|
|
if(item.name=='联系客服'){
|
|
this.kefu = true;
|
|
}else if(item.isweb){
|
|
if(item.name.indexOf("热水器")!=-1){
|
|
uni.navigateTo({
|
|
url:'/pages/webview/webview?url='+this.rsq
|
|
})
|
|
}
|
|
if(item.name.indexOf("热风机")!=-1){
|
|
uni.navigateTo({
|
|
url:'/pages/webview/webview?url='+this.rfj
|
|
})
|
|
}
|
|
|
|
}else{
|
|
uni.navigateTo({
|
|
url:item.path
|
|
})
|
|
}
|
|
|
|
},
|
|
getUserInfo(){
|
|
getUserInfo({ custom: { auth: true }}).then(res=>{
|
|
|
|
for(let i in res.data){
|
|
this.$set(this.userInfo,i,res.data[i])
|
|
}
|
|
})
|
|
},
|
|
close(){
|
|
this.kefu = false
|
|
},
|
|
copyHandle(){
|
|
uni.setClipboardData({
|
|
data: this.contactUs,
|
|
success: function () {
|
|
uni.$u.toast('复制成功')
|
|
}
|
|
});
|
|
},
|
|
getSetting(){
|
|
getSetting().then(res=>{
|
|
this.contactUs = res.data.mobile;
|
|
this.rsq = res.data.rsq;
|
|
this.rfj = res.data.rfj
|
|
})
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.phoneContainer{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 100rpx 24rpx 50rpx 24rpx;
|
|
|
|
}
|
|
.my{
|
|
min-height: calc(100vh);
|
|
background-color: #F4F5F7;
|
|
padding-bottom:200rpx;
|
|
overflow-x: hidden;
|
|
}
|
|
.userInfo{
|
|
position: relative;
|
|
&>image{
|
|
width:100%;
|
|
height:auto;
|
|
}
|
|
.avatar{
|
|
position: absolute;
|
|
display: flex;
|
|
width:100%;
|
|
left:24rpx;
|
|
align-items: center;
|
|
top:50%;
|
|
z-index: 9;
|
|
transform: translateY(-50%);
|
|
&>image{
|
|
width: 110rpx;
|
|
height: 110rpx;
|
|
background: #FFFFFF;
|
|
border: 2px solid #FFFFFF;
|
|
border-radius: 50%;
|
|
}
|
|
.userInfo{
|
|
margin-left:24rpx;
|
|
.userName{
|
|
font-size: 30rpx;
|
|
font-weight: 400;
|
|
color: #333333;
|
|
}
|
|
.phone{
|
|
font-size: 28rpx;
|
|
font-weight: 400;
|
|
color: #666666;
|
|
margin-top:28rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.cellList{
|
|
background: #FFFFFF;
|
|
border-radius: 10px;
|
|
margin:24rpx;
|
|
padding:0rpx 28rpx;
|
|
|
|
.cellItem{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding:38rpx 0;
|
|
border-bottom: 1px solid #EAEAEA;
|
|
&:last-child{
|
|
border:none !important;
|
|
}
|
|
.left{
|
|
display: flex;
|
|
align-items: center;
|
|
image{
|
|
width:44rpx;
|
|
height:auto;
|
|
}
|
|
text{
|
|
font-size: 30rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: 500;
|
|
color: #333333;
|
|
margin-left:20rpx;
|
|
}
|
|
}
|
|
.rightArrow{
|
|
width:44rpx;
|
|
height:44rpx;
|
|
}
|
|
}
|
|
}
|
|
.logOutBtn{
|
|
background: #F4F5F7;
|
|
border: 1px solid #CCCCCC;
|
|
border-radius: 45px;
|
|
padding:30rpx 0;
|
|
font-size: 30rpx;
|
|
font-family: PingFang SC;
|
|
font-weight: 500;
|
|
text-align: center;
|
|
color: #333333;
|
|
margin:88rpx 24rpx 0rpx 24rpx;
|
|
}
|
|
|
|
</style>
|
|
|