FenXiNspUniapp/pages/user/people.vue

254 lines
5.5 KiB
Vue

<template>
<view class="container">
<uni-nav-bar :fixed="true" background-color="transparent" status-bar title="我的"/>
<image src="../../static/me_bg.png" mode="" class="bgimg"></image>
<view class="tx">
<image v-if="constant.headimgUrl" :src="baseUrl + '/applet/common/static/' + constant.headimgUrl" mode=""></image>
<view class="nc" v-if="constant.nickName">
{{constant.nickName}}
</view>
</view>
<view class="bot_box" :style="{height:pageheight + 'rpx'}">
<view class="box_item" @click="tozl()">
<view class="boxitem_left">
<image src="../../static/me_icon_geren.png" mode=""></image>
<view class="zl">
个人资料
</view>
</view>
<image src="../../static/me_icon_in.png" mode=""></image>
</view>
<view class="box_item" @click="toxgmm()">
<view class="boxitem_left">
<image src="../../static/me_icon_xiugai.png" mode=""></image>
<view class="zl">
修改密码
</view>
</view>
<image src="../../static/me_icon_in.png" mode=""></image>
</view>
<view class="box_item" @click="tosb()">
<view class="boxitem_left">
<image src="../../static/me_icon_shebei.png" mode=""></image>
<view class="zl">
站点运维
</view>
</view>
<image src="../../static/me_icon_in.png" mode=""></image>
</view>
<view class="box_item" @click="toabout()">
<view class="boxitem_left">
<image src="../../static/me_icon_about.png" mode=""></image>
<view class="zl">
关于我们
</view>
</view>
<image src="../../static/me_icon_in.png" mode=""></image>
</view>
<view class="dl">
<view class="loginout" @click="loginout">
退出登录
</view>
</view>
</view>
</view>
</template>
<script>
import api from '@/api/api'
import configService from '@/common/service/config.service.js';
export default {
data() {
return {
baseUrl:configService.apiUrl,
height:0,
pageheight:0,
constant:{}
};
},
onLoad() {
uni.getSystemInfo({
success: res => {
var pxToRpxScale = 750 / res.windowWidth
var ktxStatusHeight = res.statusBarHeight * pxToRpxScale
var navigationHeight = 44 * pxToRpxScale
this.height = res.windowHeight * pxToRpxScale//将px 转换rpx
this.pageheight = this.height - ktxStatusHeight - navigationHeight - 282
}
});
},
onShow() {
if(uni.getStorageSync('third_session')){
uni.login({
success: function (res) {
this.code = res.code
let params = {}
params.jsCode = this.code
api.wxlogin(params).then(res=>{
if(res.data.code == 0){
let userInfo = res.data.data;
// uni.setStorageSync('third_session', userInfo.thirdSession);
if(!userInfo.id){
uni.reLaunch({
url:'/packDetail/pages/login/login'
})
}
}
})
}
});
}else if(!uni.getStorageSync('third_session')){
uni.reLaunch({
url:'/packDetail/pages/login/login'
})
}
this.getuserInfo()
},
methods: {
getuserInfo(){
uni.showLoading({
title: '加载中'
});
this.$http.get('/applet/userInfo').then(res=>{
this.constant = res.data.data
uni.hideLoading();
})
},
loginout(){
this.$http.post('/applet/userInfo/logout').then(res=>{
if(res.data.code == 0){
// uni.reLaunch({
// url:'/packDetail/pages/login/login'
// })
uni.reLaunch({
url:'/pages/index/index'
})
uni.removeStorageSync('third_session')
uni.removeStorageSync('constant')
}
})
},
tosb(){
uni.navigateTo({
url:'/packDetail/pages/operations/index'
})
},
toabout(){
uni.navigateTo({
url:'/packDetail1/pages/about/index'
})
},
tozl(){
uni.navigateTo({
url:'/packDetail/pages/userzl/index'
})
},
toxgmm(){
uni.navigateTo({
url:'/packDetail1/pages/changemm/index'
})
}
}
}
</script>
<style lang="scss">
page{
background-color: #ffffff;
height: 100%;
}
.container{
height: 100%;
}
.uni-nav-bar {
background-color: transparent;
border-color: transparent;
height: 44px;
}
.uni-nav-bar-text {
font-size: 32rpx;
font-family: Source Han Sans SC;
font-weight: bold;
color: #FFFFFF !important;
}
.uni-nav-bar__left,
.uni-nav-bar__right {
color: #FFFFFF;
}
.uni-navbar__content {
border: 0 none !important;
}
.bgimg{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: -99;
height: 568rpx;
}
.bot_box{
width: 100%;
background: #FFFFFF;
border-radius: 64rpx 64rpx 0 0;
margin-top: 42rpx;
padding: 61rpx 28rpx 0;
box-sizing: border-box;
}
.tx{
width: 160rpx;
margin: 0 auto;
text-align: center;
font-size: 32rpx;
font-family: Source Han Sans SC;
font-weight: 500;
color: #FFFFFF;
}
.tx image{
width: 100%;
height: 160rpx;
border-radius: 50%;
margin-bottom: 20rpx;
margin-top: 10rpx;
}
.box_item{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 63rpx;
}
.box_item image{
width: 44rpx;
height: 44rpx;
}
.boxitem_left{
display: flex;
align-items: center;
font-size: 32rpx;
font-family: Source Han Sans SC;
font-weight: 500;
color: #32394C;
}
.boxitem_left image{
width: 44rpx;
height: 44rpx;
margin-right: 11rpx;
}
.loginout{
// width: 400rpx;
height: 98rpx;
background: #FFF8F8;
border-radius: 49rpx;
font-size: 32rpx;
font-family: Source Han Sans SC;
font-weight: 500;
color: #FA5C5C;
text-align: center;
line-height: 98rpx;
}
.dl{
margin-top: 357rpx;
width: 100%;
padding: 0 147rpx;
}
</style>