You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

281 lines
7.6 KiB
Vue

4 years ago
<template>
<div class="accountsetting-container">
<div class="accountcontent w">
4 years ago
<div class="accountSetList">
<div class="userinfobox">
<div class="avatarbox">
<i class="iconfont icon-morentouxiang"></i>
</div>
4 years ago
<div class="username" v-if="userinfo.userName">
Hi,{{ userinfo.userName }}
</div>
<div class="username" v-else>Hi,{{ userinfo.hidetel }}</div>
4 years ago
</div>
4 years ago
<ul>
4 years ago
<li
@click="pushto('/userinfo/accountsetting/loginpsw')"
:class="{ tagactive: activelist === 0 }"
>
4 years ago
<span><i class="iconfont icon-gerenzhongxin-mima"></i>登录密码</span
4 years ago
><span
><span>已设置</span>
<i class="iconfont icon-youjiantou"></i>
</span>
4 years ago
</li>
4 years ago
<li
@click="pushto('/userinfo/accountsetting/boundtel')"
:class="{ tagactive: activelist === 1 }"
>
4 years ago
<span
><i class="iconfont icon-gerenzhongxin-bangdingshouji"></i
>绑定手机</span
4 years ago
><span
><span>{{ userinfo.hidetel }}</span>
<i class="iconfont icon-youjiantou"></i>
</span>
4 years ago
</li>
4 years ago
<li
@click="pushto('/userinfo/accountsetting/boundwx')"
:class="{ tagactive: activelist === 2 }"
>
4 years ago
<span><i class="iconfont icon-weixin1"></i>绑定微信</span
4 years ago
><span
4 years ago
><span v-if="userinfo.openIdAppDTDL"></span>
4 years ago
<i class="iconfont icon-youjiantou"></i>
</span>
4 years ago
</li>
4 years ago
<li
@click="pushto('/userinfo/accountsetting/boundbankcard')"
:class="{ tagactive: activelist === 3 }"
>
4 years ago
<span
><i class="iconfont icon-bangdingyinhangka"></i>绑定银行卡</span
4 years ago
><span
><span>{{ userbanklist.length }}</span>
<i class="iconfont icon-youjiantou"></i>
</span>
</li>
</ul>
<ul>
<li
@click="pushto('/userinfo/accountsetting/realname')"
:class="{ tagactive: activelist === 4 }"
>
<span><i class="iconfont icon-shimingrenzheng"></i>实名认证</span
><span
><span v-if="userinfo.realName"></span
><span v-else></span>
<i class="iconfont icon-youjiantou"></i>
</span>
4 years ago
</li>
</ul>
4 years ago
</div>
4 years ago
<div class="rightcontent">
<router-view
:userinfo="userinfo"
:userbanklist="userbanklist"
></router-view>
</div>
4 years ago
</div>
</div>
</template>
<script>
4 years ago
import { userBaseInfoApi, getUserBankListApi } from "../../../api/userinfo";
4 years ago
4 years ago
export default {
// 组件名称
name: "",
// 局部注册的组件
components: {},
// 组件参数 接收来自父组件的数据
props: {},
// 组件状态值
data() {
4 years ago
return {
userinfo: {}, // 用户基础信息
activelist: "",
userbanklist: [],
};
4 years ago
},
// 计算属性
4 years ago
computed: {
path() {
return this.$route.fullPath;
},
},
4 years ago
// 侦听器
4 years ago
watch: {
path() {
this.changeactive();
},
},
4 years ago
// 生命周期钩子 注:没用到的钩子请自行删除
/**
* 组件实例创建完成属性已绑定但DOM还未生成$ el属性还不存在
*/
4 years ago
created() {
this.getUserInfo();
4 years ago
this.changeactive();
this.getuserbnak();
4 years ago
},
4 years ago
/**
* el 被新创建的 vm.el 替换并挂载到实例上去之后调用该钩子
* 如果 root 实例挂载了一个文档内元素 mounted 被调用时 vm.el 也在文档内
*/
mounted() {},
// 组件方法
4 years ago
methods: {
async getUserInfo() {
try {
const { data } = await userBaseInfoApi();
4 years ago
if (data.status === 200) {
this.userinfo = data.data;
console.log(this.userinfo);
const beforetel = this.userinfo.tel.substr(0, 3);
const aftertel = this.userinfo.tel.substr(7, 4);
this.userinfo.hidetel = beforetel + "****" + aftertel;
4 years ago
const beforeId = this.userinfo.IDCard.substr(0, 1);
const afterId = this.userinfo.IDCard.substr(17, 1);
this.userinfo.hideId = beforeId + "****************" + afterId;
const hidename = this.userinfo.realName.substr(
this.userinfo.realName.length - 1,
1
);
// this.userinfo.hidename = hidename;
let newstr = "";
for (let i = 0; i < this.userinfo.realName.length - 1; i++) {
newstr += "*";
}
this.userinfo.hidename = newstr + hidename;
4 years ago
console.log(aftertel);
console.log(beforetel);
}
console.log(data);
} catch (error) {
console.log(error);
}
},
pushto(url) {
this.$router.push(url);
},
changeactive() {
if (this.path.indexOf("/loginpsw") > -1) {
this.activelist = 0;
} else if (this.path.indexOf("/boundtel") > -1) {
this.activelist = 1;
} else if (this.path.indexOf("/boundwx") > -1) {
this.activelist = 2;
} else if (this.path.indexOf("/boundbankcard") > -1) {
this.activelist = 3;
} else if (this.path.indexOf("/realname") > -1) {
this.activelist = 4;
}
},
async getuserbnak() {
try {
const { data } = await getUserBankListApi();
4 years ago
console.log(data);
4 years ago
this.userbanklist = data.data;
this.userbanklist.forEach((ele) => {
ele.newbankNo = ele.bankNo.substr(14, 4);
});
// const newdata = this.userbanklist.bankNo.substr(14, 4);
// console.log(newdata);
4 years ago
} catch (error) {
console.log(error);
}
},
},
4 years ago
};
</script>
<style scoped lang="less">
.accountcontent {
4 years ago
// height: 1000px;
4 years ago
margin-top: 16px;
4 years ago
// background-color: pink;
4 years ago
display: flex;
4 years ago
4 years ago
.accountSetList {
4 years ago
width: 346px;
height: 500px;
4 years ago
// background-color: skyblue;
4 years ago
margin-right: 16px;
4 years ago
.userinfobox {
width: 346px;
height: 158px;
background: #ffffff;
border-radius: 4px;
padding: 24px 0;
4 years ago
text-align: center;
4 years ago
.avatarbox {
i {
4 years ago
font-size: 54px;
line-height: 54px;
4 years ago
color: #ff6a00;
}
}
4 years ago
.username {
margin-top: 18px;
}
4 years ago
}
> ul {
background-color: #fff;
margin-top: 16px;
// padding: 0 16px;
border-radius: 4px;
overflow: hidden;
4 years ago
4 years ago
li {
position: relative;
display: flex;
padding: 16px;
line-height: 24px;
justify-content: space-between;
// border-bottom: 1px solid #f3f4f4;
cursor: pointer;
4 years ago
&:nth-child(-n + 3):after {
4 years ago
position: absolute;
content: "";
display: inline-block;
height: 1px;
width: 314px;
4 years ago
bottom: -1px;
4 years ago
left: 16px;
background-color: #f3f4f4;
}
4 years ago
> span:first-child {
4 years ago
font-size: 16px;
i {
margin-right: 12px;
font-size: 20px;
}
}
4 years ago
> span:last-child {
line-height: 22px;
span {
color: #999;
font-size: 14px;
}
> i {
color: #888;
margin-left: 12px;
vertical-align: middle;
font-size: 22px;
}
4 years ago
}
}
}
}
.rightcontent {
width: 838px;
height: 600px;
4 years ago
padding: 0 16px;
background-color: #fff;
4 years ago
}
}
</style>