Files
liuyuan 41b294f626 提交
2025-10-15 16:30:07 +08:00

436 lines
11 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view style="padding: 0 20rpx; font-size: 28upx">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view style="height: 50rpx"></view>
<view class="per_mes">
<image
:src="userMes.avatar"
v-if="userMes.avatar != null"
class="per_mes_img"
></image>
<image
src="../../static/icon/home_icon_1.png"
v-if="userMes.avatar == null"
class="per_mes_img"
></image>
<view>
<text class="name" v-if="userMes.nickname != null">{{
userMes.nickname
}}</text>
<text class="name" v-if="userMes.nickname == null">未设置</text>
<!-- <image v-if="userMes.vip==1" src="../../static/icon/mine_v.png" alt="" class="per_user_img"></image> -->
<text
style="margin-left: 20rpx; font-size: 22rpx; color: #888"
v-if="userMes.tel"
>({{ userMes.tel }})</text
>
<text style="margin-left: 20rpx; font-size: 22rpx; color: #888" v-else
>({{ userMes.email }})</text
>
</view>
<br clear="both" />
</view>
<view class="chong_zhi">
<!-- <view class="zhanghu" @click="onPageJump('../user/persCount')">
我的账户
<text style="float: right; line-height: 85rpx"> </text>
</view> -->
<view class="chong_list">
<view @click="onPageJump('/pages/user/persCount')">
<b style="color: #11a669!important;">{{ userMes.peanutCoin }}</b>
天医币
</view>
<view @click="onPageJump('/pages/user/points')">
<b style="color: #11a669!important;">{{ userMes.jf }}</b>
积分
</view>
<view @click="onPageJump('/pages/mine/wallet/couponList')">
<b style="color: #fd6004 !important;">{{ userCouponNum }}</b>
优惠券
</view>
<b class="chong_btn" v-if="$platform == 'android'" @click="onPageJump('./reCharge')"> </b>
</view>
</view>
<view class="xiugai">
<view class="nav_list" @click="onPageJump('../bookShop/orderList')">
<text>我的订单</text>
</view>
<!-- <view class="nav_list" @click="onPageJump('../peanut/shopping')">
<text>购物车</text>
</view> -->
<view class="nav_list" @click="onPageJump('../user/persData')">
<text>修改个人资料</text>
</view>
<view class="nav_list" @click="onPageJump('../user/address')">
<text>地址管理</text>
</view>
<view class="nav_list" @click="newOnShare">
<text>分享App</text>
</view>
<view class="nav_list" @click="onPageJump('../peanut/aboutUs')">
<text>关于我们</text>
</view>
<view class="nav_list" @click="onPageJump('/pages/user/workOrder')">
<text>问题反馈/申诉</text>
</view>
<view class="nav_list" @click="signShow = true">
<text>退出登录</text>
</view>
<view class="nav_list" @click="logout">
<text>注销帐号</text>
</view>
</view>
<u-modal
:show="signShow"
:content="signContent"
:showCancelButton="true"
@cancel="signShow = false"
@confirm="signOut"
>
</u-modal>
<!-- 分享弹窗 -->
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
<uni-popup-share @select="haveSelected"></uni-popup-share>
</uni-popup>
<music-play :playData="playData"></music-play>
<z-navigation></z-navigation>
</view>
</template>
<script>
import musicPlay from "@/components/music.vue";
import $http from "@/config/requestConfig.js";
// import appShare, { closeShare } from '@/uni_modules/zhouWei-APPshare/js_sdk/appShare';
import { mapState, mapMutations } from "vuex";
export default {
data() {
return {
showEbook: false, // 显示电子书相关
userMes: {},
userCouponNum: 0,
signShow: false,
signContent: "是否要退出登录?",
playData: {}
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
},
computed: {
...mapState(["userInfo"]),
},
//页面显示
onShow() {
// 隐藏原生的tabbar
uni.hideTabBar();
this.getData();
},
components: {
musicPlay,
},
//方法
methods: {
...mapMutations(["setUserInfo"]),
async getUserCouponList(){
await this.$http
.request({
url: "common/coupon/getCouponHistoryList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"page":1,
"limit":10,
"getType":"",//获取类型 0 后台赠送 1 主动获取
"status":"0",//使用状态 0 未使用 1 已使用 2 已过期
"userInfo":"",//用户信息
"userId":this.userMes.id
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
if(res.code != 0) return;
this.userCouponNum = res.couponList.total
}).catch(e => {
console.log(e);
this.$commonJS.showToast(e.errMsg);
})
},
haveSelected(data) {
console.log(data, " 选择的是");
if (data.index == 0) {
// 分享到好友
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 0,
href: this.$apkUrl,
title: "疯子读书",
summary: "我正在使用疯子读书提升自己,赶紧跟我一起来体验吧!",
imageUrl: "static/fengziIcon.jpg",
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
},
});
} else if (data.index == 1) {
// 分享到朋友圈
uni.share({
provider: "weixin",
scene: "WXSceneTimeline",
type: 0,
href: this.$apkUrl,
title: "疯子读书",
summary: "我正在使用疯子读书提升自己,赶紧跟我一起来体验吧!",
imageUrl: "static/fengziIcon.jpg",
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
},
});
}
},
switchTab(url) {
uni.switchTab({
url: url,
});
},
getData() {
// 获取个人信息
if (this.userInfo.id != undefined) {
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
this.userMes = res.user;
this.getUserCouponList();
if (this.userMes.vip == 1) {
this.userMes.vipValidtime = this.userMes.vipValidtime.substring(
0,
this.userMes.vipValidtime.indexOf(" ")
);
}
});
}
},
// 新写分享
newOnShare() {
this.$refs.share.open();
},
// 注销账户
logout() {
let that = this;
uni.showModal({
title: "提示",
content: "确定要注销当前账户吗?",
success: function (res) {
if (res.confirm) {
uni.showModal({
title: "提示",
showCancel: false,
content: `注销申请已提交成功,请联系客服进行后续操作022-24142321`,
success: function (res1) {
if (res1.confirm) {
that.signOut();
}
},
});
} else if (res.cancel) {
// 取消操作
}
},
});
},
// 跳转
onGoing() {
uni.showToast({
icon: "none",
title: "开发中,敬请期待...",
});
},
onPageJump(url) {
console.log(url, "url");
uni.navigateTo({
url: url,
});
},
// 退出登录
signOut() {
this.signShow = false;
this.setUserInfo({ token: null });
uni.reLaunch({
url: "../user/login",
});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.per_mes {
margin: 50rpx 0 50rpx 0;
align-items: center;
.per_mes_img {
width: 120upx;
height: 120upx;
background-color: #fff;
border-radius: 120upx;
margin: 0 30upx 0 0;
float: left;
}
view {
float: left;
margin-top: 20rpx;
.name {
display: inline-block;
font-weight: bold;
font-size: 38upx;
margin-bottom: 10rpx;
}
.tong {
color: #999;
font-size: 25upx;
}
.per_user_img {
display: inline-block;
width: 40upx;
height: 40upx;
margin-left: 10rpx;
vertical-align: super;
}
}
}
.now_vip {
background-color: #fff;
// border-radius: 20upx;
margin: 0 0 30upx 0;
padding: 0 30upx;
height: 120upx;
background-image: linear-gradient(90deg, #feeed6 0%, #f5ce99 100%);
image {
width: 46rpx;
height: 50rpx;
display: inline-block;
vertical-align: text-bottom;
margin: 0 10rpx 0 0;
}
text {
font-size: 30upx;
line-height: 120upx;
color: #977749;
font-weight: bold;
}
.kt_btn {
font-size: 26upx;
display: block;
float: right;
border-radius: 50rpx;
color: #fffbf6;
padding: 12rpx 26rpx;
margin: 33rpx 0 0 0;
background-image: linear-gradient(90deg, #dfa964 0%, #7f5218 100%);
}
}
.chong_zhi {
background-color: #fff;
padding: 30upx;
margin-bottom: 30rpx;
.zhanghu {
font-size: 32upx;
line-height: 100upx;
font-weight: bold;
}
.chong_list {
view {
width: 25%;
text-align: center;
display: inline-block;
color: #a3a1a1;
b {
font-size: 40rpx;
display: block;
margin: 0 0 10rpx 0;
color: #76757b;
}
}
.chong_btn {
font-size: 26upx;
display: block;
float: right;
border-radius: 50rpx;
color: #fffbf6;
padding: 12rpx 42rpx;
margin: 20rpx 0 0 0;
background: #11a669;
}
}
}
.xiugai {
.nav_list {
background-color: #fff;
padding: 30upx 0 30upx 20upx;
display: flex;
align-items: center;
position: relative;
font-weight: bold;
border-bottom: 1px solid #e5e5e5;
&:active {
background-color: #f5f5f5;
}
text {
color: #333;
margin-left: 10rpx;
}
&::after {
content: "";
position: absolute;
right: 20upx;
top: 50%;
transform: translateY(-50%);
width: 40upx;
height: 40upx;
background-image: url("../../static/icon/icon_right.png");
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
}
}
.nav_list:nth-last-child(1) {
border-bottom: 0;
}
}
</style>