Files
sociology_app/pages/mine/mine/index.vue
2024-04-19 10:35:20 +08:00

647 lines
15 KiB
Vue
Raw 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 0; font-size: 28rpx; "
class="commonPage commonPageBox"
>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view class="bg_top">
<u-icon
@click="goSetting"
class="setIcon"
labelColor="#fff"
labelPos="bottom"
label="设置"
name="setting"
:style="`top:${(10 + statusBarHeight) * 2}rpx`"
color="#fff"
size="28"
></u-icon>
</view>
<view class="mine_box" :style="`top:${(45 + statusBarHeight) * 2}rpx`">
<view class="per_mes" @click="goUserInfo">
<image
:src="userMes.avatar"
v-if="userMes.avatar != null"
class="per_mes_img color_shandow"
></image>
<image
src="@/static/icon/home_icon_1.png"
v-if="userMes.avatar == null"
class="per_mes_img color_shandow"
></image>
<view class="userInfoBox">
<template v-if="userMes.nickname != null">
<view class="name">昵称{{ userMes.nickname }}</view>
</template>
<template v-else>
<view class="name">未设置</view>
</template>
<template v-if="userMes.tel">
<view class="phone">手机号({{ userMes.tel }})</view>
</template>
<template v-if="userMes.email">
<view class="phone email">邮箱({{ userMes.email }})</view>
</template>
<!-- <text class="tong">累计读书5本
<span style="margin: 0 20upx;">|</span> 今日读50分钟
</text> -->
</view>
<br clear="both" />
</view>
<!-- <view class="now_vip" v-if="userMes.vip==0">
<text>
<image src="../../static/icon/mine_p.png" style="height: 44rpx;"></image>
开通会员畅享海量内容
</text>
<b class="kt_btn" @click="onPageJump('./opeVip')">开通VIP</b>
</view> -->
<!-- <view class="now_vip" v-if="userMes.vip==1">
<text>
<image src="../../static/icon/mine_v.png"></image>
尊贵的VIP会员
<font style="font-size: 14rpx;margin-left: 20rpx;">{{userMes.vipValidtime}}到期</font>
</text>
<b class="kt_btn" @click="onPageJump('./opeVip')">立即续费</b>
</view> -->
<view class="chong_zhi boxShadow box_fillet chongzhi_box" style="padding-top: 50rpx;">
<!-- <view
class="zhanghu"
@click="onPageJump('/pages/mine/wallet/index/index')"
>
我的账户
<image src="@/static/icon/icon_right.png" class="rightArrow"></image>
</view> -->
<view class="chong_list">
<!-- v-if="iosHide" -->
<view class="chong_list_item" @click="onPageJump('/pages/mine/wallet/index/index')">
<uni-icons
type="wallet-filled"
size="40"
color="#3ab3ae"
></uni-icons>
<view class="text"
>天医币&nbsp;{{
userMes.peanutCoin ? userMes.peanutCoin : ""
}}</view
>
</view>
<!-- <view v-if="iosHide" class="chong_list_item">
<b>{{ userMes.conponsCount }}</b>
优惠券
</view> -->
<!-- <b class="chong_btn" @click="onPageJump('../sdkDemo/pay')"> </b> -->
<b
class="chong_btn"
v-if="iosHide"
@click="onPageJump('/pages/mine/wallet/recharge/index')"
> </b
>
</view>
</view>
<view class="list_box">
<view class="xiugai boxShadow box_fillet">
<common-list
:dataList="pageList"
@hancleClick="handleClickTab"
label="name"
>
<template slot="rightSlot" slot-scope="slotProps">
<text class="fdButtonBox aui-text-success">{{
slotProps.row.content
}}</text>
<view> </view>
</template>
</common-list>
<!-- <view class="nav_list" @click="onPageJump('../clock/clockList')">
<text>我的打卡</text>
</view> -->
<!-- <view class="nav_list" @click="onPageJump('../listen/home')" v-if="iosHide">
<text>我的听书</text>
</view> -->
<!-- 暂时去掉 -->
<!-- <view class="nav_list" @click="onPageJump('../listen/setListen')" v-if="iosHide">
<text>听书设置</text>
</view> -->
<!-- <view class="nav_list" @click="onPageJump('../peanut/myComments')">
<text>我的评价</text>
</view> -->
<!-- 暂时去掉 -->
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookBuy')">
<text>电子书购买记录</text>
</view> -->
<!-- <view v-if="showEbook" class="nav_list" @click="onPageJump('../eBook/bookRecord')">
<text>阅读记录</text>
</view> -->
<!-- <view class="nav_list" @click="onGoing()">
<text>帮助与反馈11111</text>
</view> -->
<!-- <view class="nav_list" @click="newOnShare" v-if="isAndorid"> -->
</view>
</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: {},
signShow: false,
signContent: "是否要退出登录?",
playData: {},
isAndorid: true,
platform: null, // 设备系统
pageList: [
{
name: "我的订单",
url: "../bookShop/orderList",
type: "pageJump",
},
// {
// name: "购物车",
// url: "../peanut/shopping",
// type: "pageJump",
// },
{
name: "个人资料",
url: "/pages/mine/userInfo/persData",
type: "pageJump",
},
{
name: "地址管理",
url: "../user/address",
type: "pageJump",
},
{
name: "分享APP",
type: "share",
},
{
name: "关于我们",
url: "/pages/mine/aboutUs/index",
type: "pageJump",
},
//{ name: "设置", url: "/pages/mine/set/index", type: "pageJump" },
// { name: "退出登录", type: "quitLogin" },
// { name: "注销帐号", type: "loginOut" },
],
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
// uni.hideTabBar();
// #ifdef APP-PLUS
this.getOS();
this.platform = uni.getSystemInfoSync().platform;
// console.log('操纵系统',this.platform)
// #endif
},
computed: {
...mapState(["userInfo"]),
},
//页面显示
onShow() {
// 隐藏原生的tabbar
// uni.hideTabBar();
this.getData();
},
components: {
musicPlay,
},
//方法
methods: {
...mapMutations(["setUserInfo"]),
goSetting() {
this.onPageJump("/pages/mine/set/index");
},
goUserInfo() {
this.onPageJump("/pages/mine/userInfo/persData");
},
handleClickTab(v) {
console.log('v at line 259:', v)
switch (v.type) {
case "pageJump":
this.onPageJump(v.url);
break;
case "share":
//分享
this.newOnShare();
break;
case "quitLogin":
//退出登录
this.signShow = true;
break;
case "loginOut":
//注销账号
this.logout();
break;
}
},
// 获得操作系统
getOS() {
let oprateOs = "";
oprateOs = uni.getSystemInfoSync().platform;
// console.log(oprateOs)
if (oprateOs == "android") {
this.isAndorid = true;
} else {
this.isAndorid = false;
}
},
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;
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: "/pages/user/login/login",
});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.per_mes {
margin: 0rpx 40rpx 60rpx 40rpx;
align-items: center;
display: flex;
align-items: center;
.per_mes_img {
width: 160rpx;
height: 160rpx;
background-color: #fff;
border-radius: 160rpx;
margin: 0 30rpx 0 0;
float: left;
}
view {
float: left;
// margin-top: 20rpx;
.name {
width: 100%;
// display: inline-block;
font-weight: bold;
font-size: 38upx;
margin-bottom: 10rpx;
color: #fff !important;
}
.phone {
font-size: 24rpx;
color: #fff;
}
.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%);
}
}
.commonPageBox{
background-color: #d8f8e4 !important;
}
.chong_zhi {
box-shadow: none;
border-bottom-left-radius: 0rpx !important;
border-bottom-right-radius: 0rpx !important;
background-color: #d8f8e4 ;
// margin: 0 0 30upx 0;
padding: 0 30upx;
height: auto;
.zhanghu {
width: 100%;
margin-bottom: 40rpx;
font-size: 32upx;
// line-height: 80rpx;
font-weight: bold;
display: flex;
align-items: center;
justify-content: space-between;
color: #3ab3ae;
font-weight: 700;
}
.chong_list {
.chong_list_item {
width: auto;
height: 120rpx;
margin-right: 60rpx;
text-align: center;
display: inline-block;
color: #3ab3ae;
.text {
font-size: 28rpx;
display: block;
font-weight: 700;
// margin: 0 0 10rpx 0;
color: #3ab3ae !important;
}
}
.chong_btn {
font-size: 26rpx;
display: block;
float: right;
border-radius: 50rpx;
color: #fffbf6;
padding: 10rpx 32rpx;
// margin: 20rpx 0 0 0;
background-image: linear-gradient(90deg, #3ab3ae 0%, #d5ecdd 200%)
}
}
}
.xiugai {
border-radius: 20rpx !important;
margin: 0 30rpx;
// padding:0 40rpx;
background: #edfcf7;
.nav_list {
background-color: #edfcf7;
padding: 15rpx 0 15rpx 10rpx;
display: flex;
align-items: center;
font-size: 22rpx;
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: 20rpx;
top: 50%;
transform: translateY(-50%);
width: 30rpx;
height: 30rpx;
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;
}
}
.box_fillet {
border-radius: 40rpx;
overflow: hidden;
// background: #fff;
}
.chongzhi_box {
padding: 30rpx 50rpx 10rpx;
background-color: #d8f8e4 ;
}
/deep/.scroll-view-item:nth-child(2n-1) {
background-color: transparent !important;
}
uni-page-body {
background: #d8f8e4 !important;
}
.bg_top {
background-image: url("@/static/icon/login_bg.png");
// background-position: center center;
padding: 0 30rpx;
background-repeat: no-repeat;
background-size: 100% 100%;
height: 45vh;
position: relative;
.setIcon {
position: absolute;
right: 30rpx;
// top: 30rpx;
}
}
.mine_box {
width: 100%;
position: absolute;
// top: 90rpx;
left: 0;
padding: 0 0rpx;
}
.list_box{
background: #d8f8e4 !important;
padding: 20rpx 0;
margin-top: -10rpx;
}
</style>