Files
im/pages/user/index/index.vue
T

239 lines
5.8 KiB
Vue
Raw Normal View History

2025-11-07 09:56:20 +08:00
<template>
2025-12-11 22:33:31 +08:00
<view class="user_page">
2025-11-27 07:48:42 +08:00
<view class="uni-white-bg">
<view class="self_info_row"></view>
<view class="info_card">
<my-avatar :src="selfInfo.faceURL" :desc="selfInfo.nickname" size="64" />
<view class="id_row">
<text class="nickname">{{ selfInfo.nickname }}</text>
<view class="id_row_copy" @click="copy">
2026-01-09 09:15:59 +08:00
<text class="id">瞬聊号{{ selfInfo.userID }}</text>
2025-11-27 07:48:42 +08:00
<image style="width: 32rpx; height: 32rpx" src="@/static/images/id_copy.png" mode="" />
</view>
2025-11-21 01:20:28 +08:00
</view>
2025-11-27 07:48:42 +08:00
<view class="qr" @click="toSelfQr">
<img src="static/images/self_info_qr.png" alt="" />
2026-01-01 04:15:30 +08:00
<u-icon name="arrow-right" color="#999"></u-icon>
2025-11-21 01:20:28 +08:00
</view>
</view>
</view>
2025-12-24 04:12:56 +08:00
<!-- 会员 -->
<template v-if="config.role_buy_open == '1'">
<view v-if="selfInfo.role_id==2" class="vipbar" @click="goto('/pages/user/vip/vip')">
<image src="/static/images/user/member_crown.png" mode="widthFix" alt="" />
<text>会员到期时间:{{selfInfo.expire_at}}</text>
<u-button>我的权益</u-button>
</view>
<view v-else class="vipbar" @click="goto('/pages/user/vip/vip')">
<image src="/static/images/user/member_crown.png" mode="widthFix" alt="" />
<text>开通会员立享特权</text>
<u-button>开通</u-button>
</view>
</template>
2025-11-27 07:48:42 +08:00
<uni-list style="margin: 20rpx auto;width: 100%;">
2025-12-23 00:18:46 +08:00
<uni-list-item title="我的信息" thumb="/static/images/profile_menu_info.png" to="/pages/user/selfInfo/index" clickable showArrow ></uni-list-item>
2025-12-24 04:12:56 +08:00
<uni-list-item title="账号设置" thumb="/static/images/profile_menu_account.png" to="/pages/user/accountSetting/index" clickable showArrow ></uni-list-item>
<uni-list-item title="关于我们" thumb="/static/images/profile_menu_about.png" to="/pages/user/about/index" clickable showArrow ></uni-list-item>
2025-11-27 07:48:42 +08:00
</uni-list>
<uni-list>
<uni-list-item title="退出登录" thumb="/static/images/profile_menu_logout.png" @click="logout" clickable showArrow ></uni-list-item>
</uni-list>
2025-11-21 01:20:28 +08:00
<u-toast ref="uToast"></u-toast>
</view>
2025-11-07 09:56:20 +08:00
</template>
<script>
2025-11-21 01:20:28 +08:00
import IMSDK from "openim-uniapp-polyfill";
import MyAvatar from "@/components/MyAvatar/index.vue";
2025-11-27 07:48:42 +08:00
import util from "@/util";
2025-12-24 04:12:56 +08:00
import { mapGetters } from "vuex";
2025-11-21 01:20:28 +08:00
export default {
components: {
MyAvatar,
},
2025-12-24 04:12:56 +08:00
computed:{
...mapGetters(["config"]),
selfInfo() {
return this.$store.getters.storeSelfInfo || {expire_at:0};
},
},
2025-11-21 01:20:28 +08:00
data() {
return {
2025-11-27 07:48:42 +08:00
profileMenus: [
2025-11-21 01:20:28 +08:00
{
idx: 4,
title: "退出登录",
icon: require("static/images/profile_menu_logout.png"),
},
],
};
},
2026-02-15 19:40:36 +08:00
// onShow() {
// const path = plus.io.convertLocalFileSystemURL('/storage/emulated/0/DCIM/Download/oceans.mp4');
// console.log('path:', path);
// const res1 = IMSDK.getVideoCover(path).then(res => {
// console.log('视频封面:', res);
// }).catch(err => {
// console.error('获取视频封面失败:', err);
// });
// console.log('res1:', res1);
// },
2025-11-21 01:20:28 +08:00
methods: {
2025-11-27 07:48:42 +08:00
...util,
2025-11-21 01:20:28 +08:00
copy() {
uni.setClipboardData({
showToast: false,
data: this.selfInfo.userID,
success: function() {
uni.showToast({
icon: "none",
title: "复制成功",
});
},
});
},
logoutConfirm() {
2025-11-25 05:36:02 +08:00
IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid()).then(() => {
uni.removeStorage({
key: "IMToken",
2025-11-21 01:20:28 +08:00
});
2025-11-25 05:36:02 +08:00
uni.removeStorage({
key: "BusinessToken",
});
2026-01-01 04:15:30 +08:00
IMSDK.asyncApi(IMSDK.IMMethods.UnInitSDK,IMSDK.uuid());
2025-11-25 05:36:02 +08:00
}).catch((err) => {
console.log(err)
}).finally(() => {
2025-12-23 00:18:46 +08:00
uni.$u.route("/pages/common/login/index");
2025-11-25 05:36:02 +08:00
});
2025-11-21 01:20:28 +08:00
},
2025-11-27 07:48:42 +08:00
logout(){
uni.showModal({
title: "提示",
content: "确定要退出当前账号吗?",
confirmText: "确认",
cancelText: "取消",
success: (res) => {
if (res.confirm) {
this.logoutConfirm();
}
},
});
2025-11-21 01:20:28 +08:00
},
toSelfQr() {
2026-01-01 04:15:30 +08:00
const info = util.aesencode({
2025-12-24 04:12:56 +08:00
code : this.selfInfo.userID,
showName: `${this.selfInfo.nickname}`,
faceURL : this.selfInfo.faceURL,
2026-01-01 04:15:30 +08:00
type : "user"
});
const url = `/pages/common/userOrGroupQrCode?sourceInfo=${info}`;
2025-11-21 01:20:28 +08:00
uni.navigateTo({
2025-12-24 04:12:56 +08:00
url: url,
2025-11-21 01:20:28 +08:00
});
},
},
};
2025-11-07 09:56:20 +08:00
</script>
<style lang="scss" scoped>
2025-11-27 07:48:42 +08:00
@import '@/uni_modules/uni-scss/index.scss';
2025-12-11 22:33:31 +08:00
.user_page {
2025-11-27 07:48:42 +08:00
background-color: #ececec;
2025-12-23 00:18:46 +08:00
.vipbar{
background: #0c1c33;
color: #FFF;
border-radius: 20rpx;
2025-12-24 04:12:56 +08:00
display: flex;
align-items: center;
margin: 20rpx 20rpx 0 20rpx;
padding: 20rpx 20rpx;
gap: 10rpx;
uni-image{
width: 50rpx;
height: 50rpx;
}
uni-text{
flex: 1;
color: #f00;
font-size: 36rpx;
}
.u-button{
font-size: 32rpx;
background-color: $uni-color-success;
border-color: $uni-color-success;
color: #FFF;
padding: 0;
height: 2em;
width: 6em;
}
2025-12-23 00:18:46 +08:00
}
2025-11-21 01:20:28 +08:00
.self_info_row {
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
width: 100%;
height: 276rpx;
2025-11-27 07:48:42 +08:00
//background-image: url("@/static/images/profile_top_bg.png");
2025-11-21 01:20:28 +08:00
background-repeat: round;
}
.info_card {
width: 640rpx;
height: 196rpx;
border-radius: 6px;
background: #fff;
margin: -120rpx auto 0 auto;
padding: 0 36rpx;
color: #0c1c33;
display: flex;
align-items: center;
.id_row {
@include vCenterBox();
display: flex;
2025-11-27 07:48:42 +08:00
//height: 46px;
2025-11-21 01:20:28 +08:00
margin-left: 16rpx;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
flex: 1;
font-size: 28rpx;
&_copy {
@include vCenterBox();
}
.nickname {
@include nomalEllipsis();
max-width: 400rpx;
2026-01-01 04:15:30 +08:00
font-weight: 400;
2025-11-21 01:20:28 +08:00
font-size: 34rpx;
2026-01-01 04:15:30 +08:00
margin-bottom: 20rpx;
2025-11-21 01:20:28 +08:00
}
.id {
color: #8e9ab0;
}
}
2026-01-01 04:15:30 +08:00
.qr{
display: flex;
align-items: center;
}
2025-11-21 01:20:28 +08:00
img {
width: 18px;
height: 18px;
}
}
}
</style>