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.

295 lines
6.8 KiB
Vue

1 year ago
<template>
1 year ago
<div class="set-up">
<title-block title="设置">
<template #left>
<div>
3 months ago
<image
style="width: 112rpx; height: 52rpx"
src="https://cdns.fontree.cn/fonchain-main/prod/image/default/artwork/785cf885-c4c9-44b3-8155-4b39988c7ef8.png"
@click="back"
>
1 year ago
</image>
1 year ago
</div>
1 year ago
</template>
</title-block>
<div class="content2">
<div class="wrap1">
3 months ago
<image
:src="
user.avatar
? user.avatar
: 'https://cdns.fontree.cn/fonchain-main/prod/image/407e7c22-eb62-411e-957b-b6c296fde530/artwork/814ac246-e1eb-49fe-beee-dd53aaf5d309.png'
"
mode="scaleToFill"
></image>
1 year ago
</div>
1 year ago
<div class="wrap2">
<div class="wrap2_1" @click="backDafult"></div>
3 months ago
<u-upload
:fileList="fileList"
name="1"
multiple
:maxCount="1"
@afterRead="changeAvatar"
>
<view style="width: 348rpx; height: 56rpx; margin-top: 20rpx">
<u-button
text="更换头像"
shape="circle"
class="size"
color="#76C458"
></u-button>
1 year ago
</view>
</u-upload>
1 year ago
</div>
1 year ago
</div>
<div class="content3">
<div class="wrap1">
<div class="wrap1_1">
<div class="wrap1_1_1">姓名</div>
<div class="wrap1_1_2">{{ user.nickName }}</div>
<div class="wrap1_1_3">
<view></view>
</div>
<div class="wrap1_1_4"></div>
1 year ago
</div>
1 year ago
<div class="wrap1_1">
3 months ago
<div class="wrap1_1_1">
{{ user.idType === "0" ? "身份证号" : "护照号" }}
</div>
<div class="wrap1_1_2">
{{ user.idType === "0" ? user.iDNum : user.passport.idNum }}
</div>
1 year ago
<div class="wrap1_1_3">
<view></view>
</div>
<div class="wrap1_1_4"></div>
1 year ago
</div>
1 year ago
<div class="wrap1_1">
<div class="wrap1_1_1">手机号</div>
<div class="wrap1_1_2">{{ user.telNum }}</div>
<div class="wrap1_1_3">
<view></view>
</div>
1 year ago
</div>
</div>
1 year ago
<div class="wrap2"></div>
</div>
<div class="content4">
<div class="wrap1" @click="logout"></div>
1 year ago
</div>
</div>
</template>
<script>
1 year ago
import http from "@/http/api";
12 months ago
import tabBarJs from "../../util/tabbar";
1 year ago
export default {
1 year ago
name: "set-up",
1 year ago
data() {
return {
3 months ago
user: {},
};
1 year ago
},
onLoad() {
3 months ago
this.info();
1 year ago
},
methods: {
async info() {
3 months ago
const res = await this.$api.mine.info();
1 year ago
if (res.status === 0) {
3 months ago
this.user = res.data.user;
1 year ago
} else {
this.$common.msgToast(res.msg);
}
},
changeAvatar(file) {
3 months ago
console.log(file);
1 year ago
this.uploadFilePromise(file.file[0].url);
},
uploadFilePromise(url) {
return new Promise((resolve) => {
uni.uploadFile({
url: http.baseUrl + "/api/wxuser/uploadpic",
filePath: url,
name: "file",
success: (res) => {
res.data = JSON.parse(res.data);
resolve(res.data.data.path);
this.updateInfo({
avatar: res.data.data.path,
});
},
});
});
},
3 months ago
async updateInfo(data) {
let res = await this.$api.mine.update(data);
if (res.status === 0) {
this.$common.msgToast("修改成功");
this.info();
} else {
this.$common.msgToast(res.msg);
}
1 year ago
},
backDafult() {
3 months ago
this.updateInfo({
avatar:
"https://cdns.fontree.cn/fonchain-main/prod/image/407e7c22-eb62-411e-957b-b6c296fde530/artwork/814ac246-e1eb-49fe-beee-dd53aaf5d309.png",
});
},
1 year ago
3 months ago
async logout() {
let res = await this.$api.mine.logout();
if (res.status === 0) {
this.$common.msgToast("注销成功");
1 year ago
uni.clearStorageSync();
12 months ago
uni.setStorageSync("tabBar", tabBarJs);
1 year ago
uni.navigateTo({
3 months ago
url: "/pages/login/login",
});
} else {
this.$common.msgToast(res.msg);
}
1 year ago
},
3 months ago
back() {
1 year ago
uni.navigateBack({
3 months ago
delta: 2,
1 year ago
});
3 months ago
},
1 year ago
},
3 months ago
};
1 year ago
</script>
<style scoped lang="scss">
1 year ago
.set-up {
1 year ago
background-image: url("https://cdns.fontree.cn/fonchain-main/prod/image/default/artwork/4fdc9a0f-d72a-46b6-a04d-ed56d5465213.png");
1 year ago
position: relative;
box-sizing: border-box;
1 year ago
overflow: hidden;
1 year ago
padding-left: 30rpx;
padding-right: 30rpx;
background-size: cover;
width: 100vw;
height: 100vh;
1 year ago
.content4 {
left: 50%;
1 year ago
transform: translateX(-50%);
bottom: 104rpx;
position: absolute;
display: flex;
1 year ago
.wrap2 {
1 year ago
margin-left: 38rpx;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
border-radius: 40rpx;
width: 292rpx;
height: 56rpx;
3 months ago
background: #3e3e3e;
1 year ago
}
1 year ago
.wrap1 {
1 year ago
color: #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 32rpx;
border-radius: 40rpx;
width: 292rpx;
height: 56rpx;
3 months ago
background: #ed6666;
1 year ago
}
}
1 year ago
.content2 {
1 year ago
margin-top: 60rpx;
display: flex;
align-items: center;
justify-content: center;
1 year ago
.wrap1 {
image {
1 year ago
height: 154rpx;
width: 154rpx;
}
}
1 year ago
.wrap2 {
1 year ago
margin-left: 42rpx;
1 year ago
.wrap2_2 {
1 year ago
margin-top: 20rpx;
display: flex;
justify-content: center;
align-items: center;
width: 348rpx;
height: 56rpx;
color: #fff;
font-size: 32rpx;
3 months ago
background: #76c458;
1 year ago
border-radius: 40rpx;
}
1 year ago
.wrap2_1 {
display: flex;
justify-content: center;
align-items: center;
width: 348rpx;
height: 56rpx;
color: #fff;
font-size: 32rpx;
background: #000;
border-radius: 40rpx;
}
1 year ago
}
}
1 year ago
1 year ago
.content3 {
1 year ago
margin-top: 60rpx;
1 year ago
.wrap1 {
3 months ago
border: 1rpx dashed #dfe9f0;
1 year ago
background-color: #fff;
1 year ago
.wrap1_1 {
1 year ago
position: relative;
height: 114rpx;
display: flex;
align-items: center;
1 year ago
.wrap1_1_4 {
1 year ago
left: 50%;
transform: translateX(-50%);
bottom: 0;
position: absolute;
height: 0;
width: 636rpx;
border-bottom: 0.5px solid #626262;
}
1 year ago
.wrap1_1_2 {
1 year ago
margin-right: 36rpx;
width: 0;
height: 66rpx;
border-left: 0.5px solid #626262;
1 year ago
line-height: 66rpx;
width: 100%;
padding-left: 20rpx;
1 year ago
}
1 year ago
.wrap1_1_1 {
1 year ago
width: 210rpx;
padding-left: 32rpx;
color: #626262;
font-size: 24rpx;
}
}
}
}
}
</style>