demingshangjia/pages/user/myinfo.vue

323 lines
7.7 KiB
Vue
Raw Normal View History

2020-07-29 20:35:33 +08:00
<template>
<view class="user">
<view class="head" @click="toOthersPage('info')">
<view class="info">
<image :src="info.member_avatar"></image>
<view class="name">
<text>{{info.member_nickname==null?"新用户":info.member_nickname}}</text>
<text>账号{{info.member_name}}</text>
<text>个性签名{{info.signature==""?"该用户很懒没有签名!":info.signature}}</text>
</view>
</view>
<image src="/static/image/user/1.png"></image>
</view>
2020-09-01 16:05:34 +08:00
<view class="nav" @click="navtos()">
<text>活动消息</text>
<image src="/static/image/user/1.png"></image>
</view>
2020-07-29 20:35:33 +08:00
<view class="nav" @click="toOthersPage('fans')">
<text>我的粉丝</text>
<image src="/static/image/user/1.png"></image>
</view>
<view class="nav" @click="toOthersPage('content')">
<text>内容管理</text>
<image src="/static/image/user/1.png"></image>
</view>
2020-09-01 20:32:15 +08:00
<view class="nav" @click="clearCache">
<text>清除缓存</text>
<text>{{ fileSizeString }}</text>
</view>
2020-08-28 14:17:51 +08:00
<view class="nav" @click="is_loginout = true">
2020-08-22 16:58:18 +08:00
<text>退出登录</text>
<image src="/static/image/user/1.png"></image>
</view>
2020-08-15 17:52:55 +08:00
<view class="release-btn" @click="publish">
<image src="../../static/image/index/publish.png"></image>
<view class="text">发布</view>
2020-07-29 20:35:33 +08:00
</view>
<u-popup v-model="publishstate" mode="bottom">
<view class="publish">
<view class="list">
<view @click="navto('release/tosign')">
<image src="../../static/image/index/live.png"></image>
<text>直播</text>
</view>
<view @click="navto('release/index')">
<image src="../../static/image/index/photo.png"></image>
<text>图文</text>
</view>
<view @click="navto('release/video')">
<image src="../../static/image/index/video.png"></image>
<text>视频</text>
</view>
</view>
<image src="../../static/image/index/close.png" class="off" @click="close"></image>
</view>
</u-popup>
2020-08-28 14:17:51 +08:00
<u-modal v-model="is_loginout" show-confirm-button show-cancel-button :content="content" @confirm="loginOut"></u-modal>
2020-07-30 10:12:27 +08:00
<u-toast ref="uToast" />
2020-07-29 20:35:33 +08:00
</view>
</template>
<script>
export default {
name:"user",
data() {
return {
2020-09-01 20:32:15 +08:00
publishstate: false,
2020-08-28 14:17:51 +08:00
is_loginout: false,
content: "是否退出登录?",
2020-07-29 20:35:33 +08:00
info:{},
2020-09-01 20:32:15 +08:00
fileSizeString: "", // 缓存大小
2020-07-29 20:35:33 +08:00
}
},
2020-08-18 15:56:10 +08:00
onShow(){
2020-07-29 20:35:33 +08:00
this.getmyinfo()
2020-08-18 15:56:10 +08:00
},
onLoad() {
2020-09-01 20:32:15 +08:00
this.getCache();
2020-08-17 08:57:44 +08:00
const user = uni.getStorageSync('userinfo');
console.log(user)
2020-09-10 17:13:40 +08:00
this.imService.login(user.member_id,user.member_nickname,user.member_avatar)
2020-08-17 08:57:44 +08:00
this.imService.connectIM()
2020-07-29 20:35:33 +08:00
},
methods: {
2020-09-01 20:35:48 +08:00
// 获取缓存
getCache() {
let _this = this;
// #ifdef APP-PLUS
plus.cache.calculate(function(size) {
console.log(size);
let sizeCache = size;
if (sizeCache == 0) {
_this.fileSizeString = "0B";
} else if (sizeCache < 1024) {
_this.fileSizeString = sizeCache + "B";
} else if (sizeCache < 1048576) {
_this.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
} else if (sizeCache < 1073741824) {
_this.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
} else {
_this.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
}
});
// #endif
},
// 清除缓存
clearCache() {
// #ifdef APP-PLUS
uni.showModal({
title: "确定要清理缓存吗?",
cancelColor: "#999",
confirmColor: "#f00",
success: (res) => {
// console.log(res);
if (res.confirm) {
plus.cache.clear(function(e) {
console.log(e);
})
}
this.getCache();
}
})
// #endif
},
2020-09-01 16:05:34 +08:00
navtos(){
this.$u.route({
url:"/pages/messages/list"
})
},
2020-09-01 20:35:48 +08:00
// 退出登录
2020-08-28 14:17:51 +08:00
loginOut(){
2020-08-22 16:58:18 +08:00
this.imService.disconnect()
uni.clearStorage();
this.$refs.uToast.show({
title: "退出登陆成功!",
type: 'success'
});
uni.reLaunch({
url:"../login/login"
})
},
2020-07-29 20:35:33 +08:00
// 获取个人信息
getmyinfo(){
let that = this;
this.$u.api.getshopinfo({
}).then(res => {
console.log(res);
if (res.errCode != 0) {
this.$refs.uToast.show({
title: res.message,
type: 'error'
});
} else {
this.info = res.data.memberInfo
}
});
},
toOthersPage(url) {
uni.navigateTo({
url: '/pages/user/' + url
});
},
// 打开发布弹窗
publish() {
this.publishstate = true;
},
// 关闭发布弹窗
close() {
this.publishstate = false;
},
// 跳转发布页面
navto(url) {
2020-08-15 17:52:55 +08:00
// // 判断直播权限
// if(url=="release/tosign"){
// this.$u.api.canlive({}).then(res => {
// console.log(JSON.stringify(res));
// if (res.errCode != 0) {
// this.$refs.uToast.show({
// title: res.message,
// type: 'error'
// });
// } else {
// if(res.data.live_stataes==0){
// this.$u.route({
// url: `/pages/${url}`
// });
// }else{
// this.$refs.uToast.show({
// title: "当前用户没有直播权限",
// type: 'error'
// });
// }
// }
// });
// }else{
2020-07-30 19:49:12 +08:00
this.$u.route({
url: `/pages/${url}`
});
2020-08-15 17:52:55 +08:00
// }
2020-07-30 19:49:12 +08:00
2020-07-29 20:35:33 +08:00
}
},
}
</script>
<style lang="scss" scoped>
.release-btn {
position: fixed;
bottom: 475rpx;
right: 30rpx;
width: 100rpx;
height: 100rpx;
background: rgba(255, 120, 15, 1);
box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(255, 120, 15, 0.22);
border-radius: 50%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
> image {
width: 36rpx;
height: 36rpx;
flex-shrink: 0;
margin-bottom: 2rpx;
}
.text {
font-size: 20rpx;
color: rgba(255, 255, 255, 1);
}
}
.publish {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 50rpx 84rpx 31rpx 78rpx;
image {
}
.list {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
> view {
display: flex;
flex-direction: column;
align-items: center;
> image {
width: 94rpx;
height: 80rpx;
}
> text {
margin-top: 10rpx;
font-size: 28rpx;
color: #333;
font-weight: 400;
}
}
}
.off {
margin-top: 81rpx;
width: 37rpx;
height: 37rpx;
}
}
.user{
min-height: calc(100vh - var(--window-top));
background: #ececec;
.head{
width: 100%;
height: 220rpx;
background-color: #FF780F;
padding: 0 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
.info{
display: flex;
align-items: center;
>image{
width: 110rpx;
height: 110rpx;
border-radius: 50%;
}
.name{
font-size: 24rpx;
color: #fff;
display: flex;
flex-direction: column;
margin-left: 26rpx;
>text{
margin-top: 14rpx;
}
>text:first-child{
font-size: 28rpx;
margin-top: 0;
}
}
}
>image{
width: 12rpx;
height: 20rpx;
}
}
.nav{
width: 100%;
height: 100rpx;
display: flex;
padding: 30rpx;
align-items: center;
justify-content: space-between;
font-size: 30rpx;
margin-bottom: 2rpx;
color:#333;
background-color: #fff;
>image{
width: 13rpx;
height: 25rpx;
}
}
}
</style>