Files
pupil/pages/my/my.vue
2023-02-27 00:50:34 +08:00

201 lines
4.6 KiB
Vue

<!-- 个人中心 -->
<template>
<view>
<u-navbar :autoBack="false" title="我的"></u-navbar>
<u--image src="/static/my/wo_icon_bj1.png" width="750rpx" height="349rpx">
</u--image>
<myAvatar ref="myavatar"></myAvatar>
<view class="table">
<u-cell-group>
<!-- <u-cell v-if="is_bind" size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true"
value="已绑定公司">
</u-cell> -->
<!-- <u-cell v-else size="large" title="绑定公司" icon="/static/my/wo_icon_bd.png" :isLink="true" value="未绑定公司"
@click="bindCompany()">
</u-cell> -->
<u-cell size="large" title="会员中心" icon="/static/my/wo_icon_hyzx.png" :isLink="true"
@click="toMemberCenter()"></u-cell>
<u-cell size="large" title="浏览记录" icon="/static/my/wo_icon_lljl.png" :isLink="true"
@click="toBrowseHistory()"></u-cell>
<u-cell size="large" title="我的收藏" icon="/static/my/wo_icon_sc.png" :isLink="true"
@click="toMyCollect()"></u-cell>
<u-cell size="large" title="我的发布" icon="/static/my/wo_icon_wdfb.png" :isLink="true"
@click="toMyRelease()"></u-cell>
<u-cell size="large" title="联系客服" icon="/static/my/wo_icon_lxkf.png" :isLink="true"
@click="showModal()">
</u-cell>
</u-cell-group>
<u-modal :show="showM" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
@confirm="confirm" @cancel="cancel">
<view>
<view>{{mobile}}</view>
<text>是否拨打客服电话</text>
</view>
</u-modal>
</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 {
components: {
login
},
data() {
return {
showM: false,
mobile: '',
isLoad: true,
is_bind: false
}
},
onTabItemTap() {
this.$refs.myavatar.getUser()
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
return
}
this.isLoad = true
},
onLoad() {
if (uni.getStorageSync('com_mobile')) {
this.is_bind = true
}
this.getCsTel()
},
methods: {
//获取客服电话
getCsTel() {
this.$apiServe.getCsTel().then(res => {
if (res.data.data) {
this.mobile = res.data.data.cs_tel
}
}).finally(_ => {})
},
//跳转到绑定公司页面
bindCompany() {
uni.navigateTo({
url: '../../packageMy/bindCompany/bindCompany'
})
},
//跳转到会员中心页面
toMemberCenter() {
uni.navigateTo({
url: '../../packageMy/memberCenter/memberCenter'
})
},
//跳转到浏览记录页面
toBrowseHistory() {
uni.navigateTo({
url: '../../packageMy/browseHistory/browseHistory'
})
},
//跳转到我的收藏页面
toMyCollect() {
uni.navigateTo({
url: '../../packageMy/myCollection/myCollection'
})
},
//跳转到我的发布页面
toMyRelease() {
uni.navigateTo({
url: '../../packageMy/myRelease/myRelease'
})
},
// 联系客服模态框
showModal() {
this.showM = true
},
confirm() {
this.showM = false
let phone = this.mobile
phone = phone.toString()
uni.makePhoneCall({
phoneNumber: phone,
success: function() {
console.log('拨打电话成功');
},
fail() {
console.log('打电话失败了');
}
})
},
cancel() {
this.showM = false
},
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
return
}
this.isLoad = true
if (this.isLoad) {
this.$refs.myavatar.getUser()
}
},
failToLoad() {
uni.reLaunch({
url: '/pages/index/index'
})
}
}
}
</script>
<style lang="scss">
.u-navbar__content__left {
display: none !important;
}
.table {
background-color: #fff;
margin-top: 50rpx;
}
.u-line {
display: none !important;
}
.u-cell--clickable {
background-color: #fff !important;
}
.u-cell {
border-bottom: 1rpx solid #EEEEEE;
}
.u-cell:last-child {
border: none !important;
}
.u-icon__icon--info {
font-size: 28rpx !important;
}
.u-cell__title-text {
margin-left: 20rpx;
font-size: 26rpx !important;
color: #252421;
line-height: 33rpx !important;
}
.u-cell__value {
font-size: 26rpx !important;
color: #CCCCCC !important;
}
.u-modal__content {
padding: 43rpx 104rpx !important;
text-indent: 25rpx;
}
</style>