315 lines
7.1 KiB
Vue
315 lines
7.1 KiB
Vue
<template>
|
|
<view class="page">
|
|
<view>
|
|
<uni-popup ref="inputDialog" type="dialog">
|
|
<uni-popup-dialog type="info" cancelText="关闭" confirmText="继续" title="提示" content="该功能还在开发中!"
|
|
@confirm="dialogConfirm" @close="dialogClose">
|
|
</uni-popup-dialog>
|
|
</uni-popup>
|
|
</view>
|
|
<view class="action">
|
|
<view>
|
|
<image src="/static/center/scan.png" @click="toScan()">
|
|
</image>
|
|
</view>
|
|
<view>
|
|
<image src="/static/center/setting.png" @click="toSetting()">
|
|
</image>
|
|
</view>
|
|
</view>
|
|
<view class="user" @click="toPersonalpage()">
|
|
<cloud-image v-if="userInfo.avatar_file"
|
|
width="120rpx" height="120rpx" border-radius="50%"
|
|
:src="userInfo.avatar_file.url"></cloud-image>
|
|
<image class="avatar"
|
|
src="https://qnycdn.mymoyu.top/static/avatar.jpg"
|
|
mode="" v-else></image>
|
|
<view class="name">
|
|
<text>{{userInfo.nickname?userInfo.nickname:"未登录"}}</text>
|
|
<text>个人签名</text>
|
|
</view>
|
|
<image class="right" src="/static/center/right.png"></image>
|
|
</view>
|
|
<view class="card" v-for="(v, k) in menus" :key="k">
|
|
<view class="menu">
|
|
<view class="item" v-for="(v_, k_) in v" :key="k_" @click="menuClick(v_)">
|
|
<image :src="v_.icon"></image>
|
|
<view>{{v_.name}}</view>
|
|
<image class="arrow" v-if="v_.arrow" src="/static/center/right.png"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import cloudImage from "@/components/cloud-image.vue"
|
|
const uniIdCo = uniCloud.importObject("uni-id-co")
|
|
import {
|
|
store,
|
|
mutations
|
|
} from '@/pages3/uni_modules/uni-id-pages/common/store.js';
|
|
|
|
export default {
|
|
computed: {
|
|
userInfo() {
|
|
return store.userInfo
|
|
},
|
|
realNameStatus() {
|
|
if (!this.userInfo.realNameAuth) {
|
|
return 0
|
|
}
|
|
|
|
return this.userInfo.realNameAuth.authStatus
|
|
}
|
|
},
|
|
components:{
|
|
cloudImage
|
|
},
|
|
data() {
|
|
return {
|
|
avatar_url: "",
|
|
menus: [
|
|
[
|
|
{
|
|
name: '我的主页',
|
|
icon: '/static/center/self.png',
|
|
arrow: true,
|
|
type: 'my_account'
|
|
},
|
|
{
|
|
name: '我的关注',
|
|
icon: '/static/center/icon-follow.png',
|
|
arrow: true,
|
|
type: 'my_follow'
|
|
},
|
|
{
|
|
name: '提现',
|
|
icon: '/static/center/withdraw.png',
|
|
arrow: true,
|
|
type: 'withdraw'
|
|
},
|
|
{
|
|
name: '回复我的',
|
|
icon: '/static/center/reply.png',
|
|
arrow: false,
|
|
type: 'my_reply'
|
|
},
|
|
{
|
|
name: '我的喜欢',
|
|
icon: '/static/center/like.png',
|
|
arrow: false,
|
|
type: 'my_like'
|
|
},
|
|
{
|
|
name: '浏览历史',
|
|
icon: '/static/center/history.png',
|
|
arrow: false,
|
|
type: 'history'
|
|
},
|
|
{
|
|
name: '我的收藏',
|
|
icon: '/static/center/collect.png',
|
|
arrow: false,
|
|
type: 'my_collect'
|
|
},
|
|
{
|
|
name: '充值记录',
|
|
icon: '/static/center/recharge.png',
|
|
arrow: false,
|
|
type: 'recharge'
|
|
},
|
|
],
|
|
[{
|
|
name: '联系客服',
|
|
icon: '/static/center/kefu.png',
|
|
arrow: true,
|
|
type: 'customer_service'
|
|
},
|
|
{
|
|
name: '分享应用',
|
|
icon: '/static/center/share.png',
|
|
arrow: false,
|
|
type: 'sharing_app'
|
|
},
|
|
{
|
|
name: '退出登录',
|
|
icon: '/static/center/out.png',
|
|
arrow: false,
|
|
type: 'logout'
|
|
},
|
|
]
|
|
]
|
|
}
|
|
},
|
|
onLoad() {
|
|
console.log(this.userInfo);
|
|
},
|
|
async created() {
|
|
if (this.userInfo) {
|
|
this.avatar_url = await this.getFileUrl();
|
|
console.log(this.avatar_url);
|
|
}
|
|
},
|
|
methods: {
|
|
async getFileUrl() {
|
|
try {
|
|
const fileID = 'cloud://env-00jxt5y29hrd/67bcf790589f09b6fcf6c1621741070879567';
|
|
|
|
// 调用云开发 API 转换地址
|
|
const {
|
|
fileList
|
|
} = await uniCloud.getTempFileURL({
|
|
fileList: [fileID]
|
|
});
|
|
|
|
const realUrl = fileList[0].tempFileURL;
|
|
|
|
return realUrl;
|
|
} catch (err) {
|
|
console.error('转换失败:', err);
|
|
return 'https://qnycdn.mymoyu.top/static/avatar.jpg'; // 兜底默认图
|
|
}
|
|
},
|
|
dialogConfirm() {
|
|
console.log('点击确认')
|
|
},
|
|
inputDialogToggle() {
|
|
this.$refs.inputDialog.open()
|
|
},
|
|
dialogClose() {
|
|
console.log('点击关闭')
|
|
},
|
|
menuClick(e) {
|
|
if (e.type === "my_account") {
|
|
this.toPersonalpage();
|
|
}
|
|
else if (e.type === "my_follow") {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
|
|
if (!token) {
|
|
this.toLogin();
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "/pages2/follow/follow"
|
|
})
|
|
}
|
|
}
|
|
else if (e.type === "withdraw") {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
|
|
if (!token) {
|
|
this.toLogin();
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "/pages2/balance/balance"
|
|
})
|
|
}
|
|
} else if (e.type === "my_reply") {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
|
|
if (!token) {
|
|
this.toLogin();
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "/pages2/replyCommentList/replyCommentList"
|
|
})
|
|
}
|
|
} else if (e.type === "my_collect") {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
|
|
if (!token) {
|
|
this.toLogin();
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "/pages2/arctcleCollectList/arctcleCollectList"
|
|
})
|
|
}
|
|
|
|
} else if (e.type === "my_like") {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
|
|
if (!token) {
|
|
this.toLogin();
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "/pages2/arctcleLikeList/arctcleLikeList"
|
|
})
|
|
}
|
|
|
|
} else if (e.type === "customer_service") {
|
|
this.inputDialogToggle();
|
|
} else if (e.type === "sharing_app") {
|
|
this.inputDialogToggle();
|
|
} else if (e.type === "logout") {
|
|
mutations.logout()
|
|
} else if (e.type === "history") {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
|
|
if (!token) {
|
|
this.toLogin();
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "/pages2/historyList/historyList"
|
|
})
|
|
}
|
|
|
|
|
|
}
|
|
console.log(e);
|
|
},
|
|
toLogin() {
|
|
uni.navigateTo({
|
|
url: "../../pages3/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=weixin"
|
|
})
|
|
},
|
|
toUserInfoPage() {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
|
|
if (!token) {
|
|
this.toLogin();
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "../../pages3/uni_modules/uni-id-pages/pages/userinfo/userinfo?showLoginManage=true"
|
|
})
|
|
}
|
|
|
|
},
|
|
toPersonalpage() {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
if (!token) {
|
|
uni.navigateTo({
|
|
url: "../../pages3/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=weixin"
|
|
})
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "/uni_modules/zetank-personalpage/pages/personalpage/personalpage?uid=" + this
|
|
.userInfo._id
|
|
})
|
|
}
|
|
},
|
|
toScan() {
|
|
this.inputDialogToggle();
|
|
},
|
|
toSetting() {
|
|
uni.navigateTo({
|
|
url: "/pages2/setting/setting"
|
|
})
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import "./my.scss";
|
|
</style> |