2025-03-21 16:50:18 +08:00

465 lines
13 KiB
Vue

<template>
<view style="background: #F1F2F8;">
<view
style="background: url('https://hnyea.0rui.cn/uploads/1/20240722/7f5a72050b9cbc409fb60fa8d32db76a.png');background-repeat: no-repeat;background-size: 100% 555rpx;">
<tn-nav-bar :isBack="false" :bottomShadow="false" backgroundColor="transparent">
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
<view style="width: 100%;">
<view
style="text-align: center;font-size: 34rpx;color: #000000;letter-spacing: 1px;font-weight: bold;">
<text>我的</text>
</view>
</view>
</view>
</tn-nav-bar>
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<view style="padding: 30rpx;">
<view class="tn-flex tn-flex-center tn-flex-col-center">
<view>
<view v-if="login && userInfo.photo_image">
<image :src="apiImgUrl+userInfo.photo_image"
@click="tn_ru('/pages/packageA/user/my_card?id='+userInfo.member_id)"
style="width: 120rpx;height: 120rpx;border-radius: 50%;"></image>
</view>
<view v-if="!login || !userInfo.photo_image">
<image src="/static/def.png" style="width: 120rpx;height: 120rpx;border-radius: 50%;">
</image>
</view>
</view>
<view style="margin-left: 20rpx;">
<view style="font-size: 34rpx;color: #181818;font-weight: bold;">
{{login ? userInfo.nikename:'' }}
<tn-button v-if="!login" open-type="getPhoneNumber"
@getphonenumber="PhoneLogin">点击登陆</tn-button>
</view>
<view v-if="userInfo.if_xianshi==3 && login" style="color: #E83A30;">
<text>会费未缴纳</text>
</view>
</view>
</view>
<view style="margin-top: 30rpx;">
<view style="background-color: #ffffff;padding: 30rpx 0rpx;border-radius: 20rpx;">
<tn-grid align="center" :col="col">
<tn-grid-item style="width: 25%" @click="tn('/pages/packageA/user/my_add')">
<view>
<image class="no-img" src="/static/ico1.png" style="width: 150rpx;"
mode="widthFix"></image>
</view>
<view style="margin-top: -20rpx;font-size: 30rpx;font-weight: 500;">
我的发布
</view>
</tn-grid-item>
<tn-grid-item style="width: 25%" @click="tn('/pages/packageA/user/events_my')">
<view>
<image class="no-img" src="/static/ico2.png" style="width: 150rpx;"
mode="widthFix"></image>
</view>
<view style="margin-top: -20rpx;font-size: 30rpx;font-weight: 500;">
我的活动
</view>
</tn-grid-item>
<tn-grid-item style="width: 25%" @click="tn('/pages/packageA/user/my_collection')">
<view>
<image class="no-img" src="/static/ico3.png" style="width: 150rpx;"
mode="widthFix"></image>
</view>
<view style="margin-top: -20rpx;font-size: 30rpx;font-weight: 500;">
我的收藏
</view>
</tn-grid-item>
<tn-grid-item style="width: 25%"
@click="tn('/pages/packageA/user/apply_in?association_id=1')">
<view>
<image class="no-img" src="/static/ico4.png" style="width: 150rpx;"
mode="widthFix"></image>
</view>
<view style="margin-top: -20rpx;font-size: 30rpx;font-weight: 500;">
入会申请
</view>
</tn-grid-item>
</tn-grid>
</view>
</view>
<view style="margin-top: 30rpx;">
<view style="background-color: #ffffff;border-radius: 20rpx;padding: 20rpx;">
<tn-list-view>
<tn-list-cell padding="35rpx 30rpx" @click="tn('/pages/packageA/user/sign_in')"
fontColor="#181818" fontSize="30rpx" :arrow="true">每日签到</tn-list-cell>
<tn-list-cell padding="35rpx 30rpx" @click="tn('/pages/packageA/user/sign_details')"
fontColor="#181818" fontSize="30rpx" :arrow="true">积分明细</tn-list-cell>
<tn-list-cell padding="35rpx 30rpx" @click="tn('/pages/packageA/user/my_msg')"
fontColor="#181818" fontSize="30rpx" :arrow="true">站内信</tn-list-cell>
<!-- <tn-list-cell padding="35rpx 30rpx" @click="tn('/pages/packageA/user/my_card_holder')"
fontColor="#181818" fontSize="30rpx" :arrow="true">好友申请</tn-list-cell> -->
<tn-list-cell padding="35rpx 30rpx" @click="tn('/pages/packageA/user/my_invoice')"
fontColor="#181818" fontSize="30rpx" :arrow="true">发票开取</tn-list-cell>
<tn-list-cell padding="35rpx 30rpx" @click="tn('/pages/packageA/user/my_invite')"
fontColor="#181818" fontSize="30rpx" :arrow="true">邀请会员</tn-list-cell>
<tn-list-cell padding="35rpx 30rpx" @click="tn('/pages/packageC/info/certificate')"
fontColor="#181818" fontSize="30rpx" :arrow="true">我的证书</tn-list-cell>
<!-- <tn-list-cell padding="35rpx 30rpx" fontColor="#181818" fontSize="30rpx"
:arrow="true">数据资料导出</tn-list-cell> -->
<tn-list-cell v-if="login" @click="loginAut" padding="35rpx 30rpx" fontColor="#181818"
fontSize="30rpx" :arrow="true" :unlined="true">退出账号</tn-list-cell>
</tn-list-view>
</view>
</view>
<view style="text-align: center;font-size: 12px;;color: #CCCCCC;padding: 50rpx;">V{{vuex_version}}
</view>
</view>
</view>
</view>
<tn-modal v-model="HfModal.show" :title="HfModal.title" :content="HfModal.content" :button="HfModal.button"
@click="HfModalClick"></tn-modal>
<tn-modal v-model="userEditModal.show" :maskCloseable="false" :title="userEditModal.title"
:content="userEditModal.content" :button="userEditModal.button" @click="userEditModalClick"></tn-modal>
</view>
</template>
<script>
import {
getUserIndex,
loginDo,
wxphoneLogin
} from "@/util/api";
import store from "@/store";
export default {
data() {
return {
HfModal: {
show: false,
title: '系统提醒',
content: '您的会费未缴纳,请及时缴纳!',
button: [{
text: '确定',
backgroundColor: '#3056D3',
fontColor: '#FFFFFF'
}]
},
userEditModal: {
show: false,
title: '系统提醒',
content: '您的会员信息不完整,请补充信息!',
button: [{
text: '确定',
backgroundColor: '#3056D3',
fontColor: '#FFFFFF'
}]
},
topCurrent: 0,
login: false,
loginMod: false,
userInfo: {},
apiImgUrl: this.$store.state.imgUrl,
loginData: {
openid: '',
phone: '',
password: '',
association_id: store.state.Gid
},
code: '',
identifyCode: '',
identifyCodeName: '',
colors: ['#00CCFF', '#FF0000', '#FF9933', '#33CC99'], // 可以根据需要增加颜色
}
},
mounted() {
//this.getcheckCode();
},
onShow() {
console.log('show');
},
methods: {
HfModalClick(d) {
console.log(d);
this.HfModal.show = false;
},
onload() {
var quit = uni.getStorageSync('quit');
if (quit == 0) {
var uid = uni.getStorageSync('uid');
this.uid = uid;
if (uid) {
this.getUserInfo();
}
}
},
PhoneLogin(d) {
console.log(d);
var openid = uni.getStorageSync('openid');
var recommendation_id_val = uni.getStorageSync('recommendation_id');
if (!recommendation_id_val) {
recommendation_id_val = '';
}
wxphoneLogin({
code: d.code,
openid: openid,
recommendation_id: recommendation_id_val
})
.then(res => {
console.log(res);
if (res.code == 1) {
uni.showToast({
title: '登陆成功!',
icon: 'none',
duration: 2000
});
uni.setStorageSync('quit', 0);
uni.setStorageSync('uid', res.data.id);
uni.setStorageSync('openid', res.data.openid);
uni.setStorageSync('userInfo', res.data);
this.userInfo = res.data;
if (res.data.if_xianshi == 3) {
this.HfModal.show = true;
}
if (res.data.if_xianshi == 1) {
this.userEditModal.show = true;
}
this.login = true;
this.loginMod = false;
} else {
uni.showToast({
title: '登陆失败!',
icon: 'none',
duration: 2000
});
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
getcheckCode() {
let code = [];
const codeLength = 4;
var codeName = '';
const random = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z',
];
for (let i = 0; i < codeLength; i++) {
let index = Math.floor(Math.random() * 34);
code.push(random[index]);
codeName += random[index];
}
this.identifyCodeName = codeName;
this.identifyCode = code;
},
msg() {
return this.$store.state.msgCount;
},
getUserInfo() {
getUserIndex({
member_b_id: this.uid,
member_id: this.uid
})
.then(res => {
console.log(res);
if (res.code == 1) {
this.userInfo = res.data;
console.log(res.data.if_xianshi == 3);
if (res.data.if_xianshi == 3) {
this.HfModal.show = true;
}
if (res.data.if_xianshi == 1) {
if (res.data.dimension == '' || res.data.longitude == '' || res.data.dimension ==
null || res.data.longitude == null) {
this.userEditModal.show = true;
}
}
this.login = true;
uni.setStorageSync('userInfo', res.data);
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
submitLogin() {
console.log(this.code);
console.log(this.identifyCodeName);
if (this.code.toLowerCase() !== this.identifyCodeName.toLowerCase()) {
uni.showToast({
title: '验证码错误!',
icon: 'none',
duration: 2000
});
return;
}
if (this.loginData.phone == '') {
uni.showToast({
title: '请填写手机号!',
icon: 'none',
duration: 2000
});
return;
}
if (this.loginData.password == '') {
uni.showToast({
title: '请填写密码!',
icon: 'none',
duration: 2000
});
return;
}
this.loginData.openid = uni.getStorageSync('openid');
loginDo(this.loginData)
.then(res => {
console.log(res);
if (res.code == 1) {
uni.showToast({
title: '登陆成功!',
icon: 'none',
duration: 2000
});
uni.setStorageSync('uid', res.data.id);
uni.setStorageSync('userInfo', res.data);
this.userInfo = res.data;
this.login = true;
this.loginMod = false;
} else {
uni.showToast({
title: '帐号或密码错误!',
icon: 'none',
duration: 2000
});
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
loginAut() {
var that = this;
uni.showModal({
title: '提示',
content: '确定要退出吗?',
success: function(res) {
if (res.confirm) {
uni.setStorageSync('quit', 1);
uni.removeStorageSync('birthDay');
uni.removeStorageSync('uid');
//uni.removeStorageSync('openid');
uni.removeStorageSync('userInfo');
that.login = false;
that.loginData.openid = '';
that.loginData.phone = '';
that.loginData.password = '';
that.code = '';
that.getcheckCode();
}
}
});
},
tn_ru(e) {
var url = "/pages/packageA/user/apply_in?association_id=" + store.state.Gid;
uni.navigateTo({
url: e
})
},
userEditModalClick() {
this.userEditModal.show = false;
uni.navigateTo({
url: '/pages/packageB/event/user_area'
})
},
tn(e) {
var uid = uni.getStorageSync('uid');
console.log(this.userInfo);
if (!this.login) {
uni.showToast({
title: '请登陆后查看',
icon: 'none',
duration: 2000
});
return;
}
if (this.userInfo.if_xianshi != 1) {
if (e == '/pages/packageA/user/my_edit') {
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
if (e.includes("/pages/index/pizz_info")) {
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
if (e.includes("/pages/packageA/user/my_invoice")) {
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
if (e.includes("/pages/packageC/info/certificate")) {
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
if (e.includes("/pages/packageA/user/my_invite")) {
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
if (e.includes("/pages/packageA/user/my_card_holder")) {
uni.navigateTo({
url: e
})
return;
}
if (e.includes("/pages/packageA/user/my_card")) {
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
}
uni.navigateTo({
url: e
})
}
}
}
</script>
<style scoped>
.my_input view {
width: 100% !important;
}
.my_input input {
width: 100% !important;
}
</style>