281 lines
7.2 KiB
Vue
281 lines
7.2 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="toUserInfoPage()">
|
|
<!-- <svg t="1739689350355" class="avatar" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4351" width="16" height="16"><path d="M499.952941 0c-144.564706 0-265.035294 123.482353-265.035294 268.047059 0 147.576471 120.470588 268.047059 265.035294 268.047059s268.047059-120.470588 268.047059-268.047059C764.988235 120.470588 644.517647 0 499.952941 0m189.741177 566.211765H334.305882C150.588235 566.211765 0 716.8 0 903.529412v21.082353C0 1024 147.576471 1024 334.305882 1024h352.376471c177.694118 0 334.305882 0 334.305882-96.376471v-21.082353c6.023529-189.741176-144.564706-340.329412-331.294117-340.329411" fill="#1296db" p-id="4352"></path></svg> -->
|
|
<!-- <image class="avatar"
|
|
:src="this.avatar_url"
|
|
mode=""
|
|
v-if="this.avatar_url"></image>
|
|
<image class="avatar"
|
|
src="https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/center/avatar.png?expire_at=1741157497&er_sign=9b8381ae7875137d28c57d502762691b"
|
|
mode=""
|
|
v-else></image> -->
|
|
<cloud-image v-if="userInfo.avatar_file" class="avatar"
|
|
:src="userInfo.avatar_file.url"></cloud-image>
|
|
<image class="avatar"
|
|
src="https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/center/avatar.png?expire_at=1741157497&er_sign=9b8381ae7875137d28c57d502762691b"
|
|
mode=""
|
|
v-else></image>
|
|
<view class="name">
|
|
<text>{{userInfo?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>
|
|
const uniIdCo = uniCloud.importObject("uni-id-co")
|
|
import {
|
|
store,
|
|
mutations
|
|
} from '@/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
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
avatar_url:"",
|
|
menus: [
|
|
[
|
|
{
|
|
name: '我的文章',
|
|
icon: '/static/center/book.png',
|
|
arrow: true,
|
|
type: 'my_article'
|
|
},
|
|
{
|
|
name: '我的账户',
|
|
icon: '/static/center/self.png',
|
|
arrow: true,
|
|
type: 'my_account'
|
|
},
|
|
{
|
|
name: '发布文章',
|
|
icon: '/static/center/release.png',
|
|
arrow: true,
|
|
type: 'publish_article'
|
|
},
|
|
{
|
|
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/reward.png',
|
|
arrow: false,
|
|
type: 'reward'
|
|
},
|
|
],
|
|
[
|
|
{
|
|
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://env-00jxt5y29hrd.normal.cloudstatic.cn/static/center/avatar.png?expire_at=1741157497&er_sign=9b8381ae7875137d28c57d502762691b'; // 兜底默认图
|
|
}
|
|
},
|
|
dialogConfirm() {
|
|
console.log('点击确认')
|
|
},
|
|
inputDialogToggle() {
|
|
this.$refs.inputDialog.open()
|
|
},
|
|
dialogClose() {
|
|
console.log('点击关闭')
|
|
},
|
|
menuClick(e){
|
|
if (e.type === "my_article") {
|
|
uni.navigateTo({
|
|
// url: "/pages/editor/editor"
|
|
url:'/uni_modules/uni-cms/pages/article/list/list'
|
|
})
|
|
}
|
|
else if (e.type === "my_account") {
|
|
this.inputDialogToggle();
|
|
}
|
|
else if (e.type === "publish_article") {
|
|
uni.navigateTo({
|
|
url:'/uni_modules/uni-cms/pages/article/add/add'
|
|
})
|
|
}
|
|
else if (e.type === "my_reply") {
|
|
uni.navigateTo({
|
|
url:"/pages2/replyCommentList/replyCommentList"
|
|
})
|
|
}
|
|
else if (e.type === "my_collect") {
|
|
uni.navigateTo({
|
|
url:"/pages2/arctcleCollectList/arctcleCollectList"
|
|
})
|
|
}
|
|
else if (e.type === "my_like") {
|
|
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" ) {
|
|
uni.navigateTo({
|
|
url: "/pages2/historyList/historyList"
|
|
})
|
|
}
|
|
console.log(e);
|
|
},
|
|
toLogin() {
|
|
uni.navigateTo({
|
|
url:"/pages/login/login"
|
|
})
|
|
},
|
|
toUserInfoPage() {
|
|
let token = uni.getStorageSync("uni_id_token");
|
|
console.log(token);
|
|
|
|
if (!token) {
|
|
uni.navigateTo({
|
|
url:"/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=weixin"
|
|
})
|
|
}
|
|
else {
|
|
uni.navigateTo({
|
|
url: "/uni_modules/uni-id-pages/pages/userinfo/userinfo?showLoginManage=true"
|
|
})
|
|
}
|
|
|
|
},
|
|
toScan() {
|
|
this.inputDialogToggle();
|
|
},
|
|
toSetting() {
|
|
this.inputDialogToggle();
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import "./my.scss";
|
|
</style> |