392 lines
11 KiB
Vue
Raw Normal View History

2023-12-25 17:56:30 +08:00
<template>
2024-07-30 18:16:46 +08:00
<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>
2024-04-20 14:57:39 +08:00
</view>
2024-05-08 18:14:41 +08:00
</view>
2023-12-25 17:56:30 +08:00
</view>
2024-07-30 18:16:46 +08:00
</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">
2023-12-25 17:56:30 +08:00
<view>
2024-07-30 18:16:46 +08:00
<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>
2023-12-25 17:56:30 +08:00
</view>
2024-11-20 17:33:13 +08:00
<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 style="color: #E83A30;">
<text v-if="userInfo.if_xianshi==3">会费未缴纳</text>
</view>
2023-12-25 17:56:30 +08:00
</view>
</view>
2024-07-30 18:16:46 +08:00
<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>
2023-12-25 17:56:30 +08:00
</view>
</view>
2024-07-30 18:16:46 +08:00
<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/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" fontColor="#181818" fontSize="30rpx"
:arrow="true">数据资料导出</tn-list-cell>
<tn-list-cell @click="loginAut" padding="35rpx 30rpx" fontColor="#181818"
fontSize="30rpx" :arrow="true" :unlined="true">退出账号</tn-list-cell>
</tn-list-view>
2023-12-25 17:56:30 +08:00
</view>
</view>
</view>
</view>
2024-06-28 08:50:34 +08:00
</view>
2024-11-20 17:33:13 +08:00
<tn-modal v-model="HfModal.show" :title="HfModal.title" :content="HfModal.content" :button="HfModal.button"
@click="HfModalClick"></tn-modal>
2023-12-25 17:56:30 +08:00
</view>
</template>
<script>
2024-05-08 18:14:41 +08:00
import {
getUserIndex,
2024-06-21 16:15:26 +08:00
loginDo,
wxphoneLogin
2024-05-08 18:14:41 +08:00
} from "@/util/api";
import store from "@/store";
2024-04-23 11:58:07 +08:00
2024-05-08 18:14:41 +08:00
export default {
2023-12-25 17:56:30 +08:00
data() {
return {
2024-11-20 17:33:13 +08:00
HfModal: {
show: false,
title: '系统提醒',
content: '您的会费未缴纳,请及时缴纳!',
button: [{
text: '确定',
backgroundColor: 'tn-bg-indigo',
fontColor: '#FFFFFF'
}]
},
2024-04-23 11:58:07 +08:00
topCurrent: 0,
2024-05-08 18:14:41 +08:00
login: false,
loginMod: false,
userInfo: {},
apiImgUrl: this.$store.state.imgUrl,
loginData: {
openid: '',
phone: '',
password: '',
association_id: store.state.Gid
},
2024-05-17 18:17:07 +08:00
code: '',
2024-05-21 18:16:48 +08:00
identifyCode: '',
identifyCodeName: '',
colors: ['#00CCFF', '#FF0000', '#FF9933', '#33CC99'], // 可以根据需要增加颜色
2024-05-08 18:14:41 +08:00
}
},
mounted() {
2024-06-04 18:04:09 +08:00
2024-11-20 17:33:13 +08:00
//this.getcheckCode();
2023-12-25 17:56:30 +08:00
},
methods: {
2024-11-20 17:33:13 +08:00
HfModalClick(d) {
console.log(d);
this.HfModal.show = false;
},
onload() {
var uid = uni.getStorageSync('uid');
this.uid = uid;
if (uid) {
this.getUserInfo();
}
},
2024-06-21 16:15:26 +08:00
PhoneLogin(d) {
console.log(d);
var openid = uni.getStorageSync('openid');
wxphoneLogin({
code: d.code,
openid: openid
})
.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
});
})
},
2024-05-21 18:16:48 +08:00
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;
},
2024-05-15 17:54:48 +08:00
msg() {
return this.$store.state.msgCount;
},
2024-05-14 10:20:09 +08:00
getUserInfo() {
2024-05-08 18:14:41 +08:00
getUserIndex({
2024-05-14 10:20:09 +08:00
member_b_id: this.uid,
member_id: this.uid
2024-05-08 18:14:41 +08:00
})
.then(res => {
console.log(res);
if (res.code == 1) {
this.userInfo = res.data;
2024-11-20 17:33:13 +08:00
console.log(res.data.if_xianshi == 3);
if (res.data.if_xianshi == 3) {
this.HfModal.show = true;
}
2024-05-08 18:14:41 +08:00
this.login = true;
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
submitLogin() {
2024-05-21 18:16:48 +08:00
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;
}
2024-05-08 18:14:41 +08:00
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);
2024-06-21 16:15:26 +08:00
uni.setStorageSync('userInfo', res.data);
2024-05-08 18:14:41 +08:00
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.removeStorageSync('uid');
2024-11-20 17:33:13 +08:00
uni.removeStorageSync('userInfo');
2024-05-08 18:14:41 +08:00
that.login = false;
2024-05-27 17:40:54 +08:00
that.loginData.openid = '';
that.loginData.phone = '';
that.loginData.password = '';
that.code = '';
that.getcheckCode();
2024-05-08 18:14:41 +08:00
}
}
});
},
2024-05-21 18:16:48 +08:00
tn_ru(e) {
2024-06-26 14:17:06 +08:00
var url = "/pages/packageA/user/apply_in?association_id=" + store.state.Gid;
2024-05-21 18:16:48 +08:00
uni.navigateTo({
url: e
})
},
2024-04-20 14:57:39 +08:00
tn(e) {
2024-05-08 18:14:41 +08:00
var uid = uni.getStorageSync('uid');
2024-06-21 16:15:26 +08:00
console.log(this.userInfo);
if (!this.login) {
uni.showToast({
title: '请登陆后查看',
icon: 'none',
duration: 2000
});
2024-05-08 18:14:41 +08:00
return;
}
2024-06-21 16:15:26 +08:00
if (this.userInfo.if_member == 2) {
2024-06-26 14:17:06 +08:00
if (e == '/pages/packageA/user/my_edit') {
2024-06-21 16:15:26 +08:00
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
2024-06-26 14:17:06 +08:00
if (e.includes("/pages/packageA/user/my_invite")) {
2024-06-21 16:15:26 +08:00
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
if (e.includes("/pages/index/pizz_info")) {
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
2024-07-30 18:16:46 +08:00
if (e.includes("/pages/packageA/user/my_card_holder")) {
uni.navigateTo({
url: e
})
return;
}
2024-06-26 14:17:06 +08:00
if (e.includes("/pages/packageA/user/my_card")) {
2024-06-21 16:15:26 +08:00
uni.showToast({
title: '请入会后查看',
icon: 'none',
duration: 2000
});
return;
}
}
2024-04-20 14:57:39 +08:00
uni.navigateTo({
url: e
})
}
2023-12-25 17:56:30 +08:00
}
}
</script>
2024-08-19 18:15:03 +08:00
<style scoped>
2024-05-21 18:16:48 +08:00
.my_input view {
width: 100% !important;
}
.my_input input {
width: 100% !important;
}
2024-06-04 18:04:09 +08:00
</style>