537 lines
15 KiB
Vue
537 lines
15 KiB
Vue
<template>
|
|
<view class="content">
|
|
<page-head text="修改信息" navState="true" brF="true"></page-head>
|
|
<view class="list">
|
|
<view class="con">
|
|
<view class="listName">
|
|
<view class="text">
|
|
头像
|
|
</view>
|
|
</view>
|
|
<view class="">
|
|
<image @click="headPortrait()" class="headPortrait" :src="userData.headimgurl" mode="aspectFill">
|
|
</image>
|
|
</view>
|
|
</view>
|
|
<view class="con">
|
|
<view class="listName">
|
|
<view class="text">
|
|
昵称
|
|
</view>
|
|
</view>
|
|
<view class="hint">
|
|
<view class="text">
|
|
Anita Rose
|
|
</view>
|
|
<view class="arrows">
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="con">
|
|
<view class="listName">
|
|
<view class="text">
|
|
真实姓名
|
|
</view>
|
|
</view>
|
|
<view class="hint" @click="modification()">
|
|
<view class="text">
|
|
{{userData.real_name}}
|
|
</view>
|
|
<image class="arrows" src="../../static/jt.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="con">
|
|
<view class="listName">
|
|
<view class="text">
|
|
联系电话
|
|
</view>
|
|
</view>
|
|
<button class="hint hintBUTTON" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
|
<view class="text">
|
|
{{userData.mobile}}
|
|
|
|
</view>
|
|
<image class="arrows" src="../../static/jt.png" mode=""></image>
|
|
</button>
|
|
|
|
</view>
|
|
<view class="con">
|
|
<view class="listName">
|
|
<view class="text">
|
|
联系地址
|
|
</view>
|
|
</view>
|
|
<view class="hint" @tap="popup_bottom()">
|
|
<view class="text">
|
|
{{userData.address}}
|
|
</view>
|
|
<image class="arrows" src="../../static/jt.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="con">
|
|
<view class="listName">
|
|
<view class="text">
|
|
详细地址
|
|
</view>
|
|
</view>
|
|
<view class="hint" @click="modificationA()">
|
|
<view class="text">
|
|
{{userData.address_detail}}
|
|
</view>
|
|
<image class="arrows" src="../../static/jt.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="con">
|
|
<view class="listName">
|
|
<view class="text" v-if="!userData.vip_code" >
|
|
会员码输入
|
|
</view>
|
|
<view class="text" v-else>
|
|
会员码
|
|
</view>
|
|
</view>
|
|
<view class="hint" v-if="!userData.vip_code" @click="vipAoolyState()">
|
|
<view class="text">
|
|
输入会员码成为会员
|
|
</view>
|
|
<image class="arrows" src="../../static/jt.png" mode=""></image>
|
|
</view>
|
|
<view class="hint" v-if="userData.vip_code" >
|
|
<view class="text" v-if="userData.vip_code" >
|
|
{{userData.vip_code}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="make" v-if="makeState">
|
|
<view class="member">
|
|
<image class="memberGb" @click="cancelName()" src="../../static/gb.png" mode=""></image>
|
|
<view class="title">
|
|
姓名
|
|
</view>
|
|
|
|
<view class="name">
|
|
姓名
|
|
</view>
|
|
<input class="input" v-model="name" placeholder="请输入姓名" placeholder-class="inpal" type="text"
|
|
value="" />
|
|
|
|
<view class="button" @click="changeInformation('real_name',name)">
|
|
提交修改
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="make" v-if="makeStateA">
|
|
<view class="member memberTextarea">
|
|
<image class="memberGb" @click="cancelTel()" src="../../static/gb.png" mode=""></image>
|
|
<view class="title">
|
|
详细地址
|
|
</view>
|
|
|
|
<view class="name">
|
|
详细地址
|
|
</view>
|
|
<!-- <input placeholder="请输入详细地址" placeholder-class="inpal" type="text" value="" /> -->
|
|
<textarea class="inputTextarea" v-model="address_detail" placeholder-style="color:#000" placeholder="请输入详细地址"/>
|
|
<view class="button" @click="changeInformationAddress_detail()">
|
|
提交修改
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="make" v-if="memberStateApply">
|
|
<view class="member">
|
|
<image class="memberGb" @click="canceVipState()" src="../../static/gb.png" mode=""></image>
|
|
<view class="title">
|
|
会员码
|
|
</view>
|
|
|
|
<view class="name">
|
|
会员码
|
|
</view>
|
|
<input class="input" v-model="invitee_vip_code" placeholder="请输入6位会员邀请码" placeholder-class="inpal" type="text" value="" />
|
|
|
|
<view class="button" @click="SubmitValidation()">
|
|
提交验证
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<linkAddress ref="linkAddress" :height="height" @confirmCallback="confirmCallback">
|
|
</linkAddress>
|
|
<tab stateTab="center"></tab>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import tab from "../../component/tab.vue";
|
|
import linkAddress from '../../components/xuan-linkAddress/xuan-linkAddress.vue'
|
|
export default {
|
|
components: {
|
|
linkAddress,
|
|
tab
|
|
},
|
|
data() {
|
|
return {
|
|
title: "请您输入姓名",
|
|
height: '500px',
|
|
makeState: false,
|
|
makeStateA: false,
|
|
invitee_vip_code:"",
|
|
address_detail:"",
|
|
memberStateApply:false,
|
|
tel: "",
|
|
name: "",
|
|
userData: {},
|
|
}
|
|
},
|
|
created() {
|
|
|
|
this.getUserData()
|
|
},
|
|
methods: {
|
|
canceVipState() {
|
|
this.memberStateApply = false
|
|
},
|
|
SubmitValidation(){
|
|
if(this.invitee_vip_code){
|
|
this.memberStateApply = false
|
|
this.changeInformation("vip_code",this.invitee_vip_code)
|
|
}else{
|
|
uni.showToast({
|
|
title: '请填写会员码',
|
|
icon:"error",
|
|
duration: 2000
|
|
});
|
|
}
|
|
|
|
|
|
},
|
|
getPhoneNumber(e) {
|
|
console.log()
|
|
|
|
this.requestToken({
|
|
url: this.host + "/api/user/bind-phone",
|
|
type: "post",
|
|
data: {
|
|
iv: e.detail.iv,
|
|
encryptedData:e.detail.encryptedData
|
|
},
|
|
success: (res) => {
|
|
this.getUserData()
|
|
|
|
}
|
|
|
|
})
|
|
},
|
|
vipAooly() {
|
|
this.memberStateApply = true
|
|
},
|
|
changeInformationAddress_detail(){
|
|
if(this.address_detail){
|
|
this.makeStateA=false
|
|
this.changeInformation("address_detail",this.address_detail)
|
|
}else{
|
|
uni.showToast({
|
|
title: '请正确填写地址',
|
|
icon:"error",
|
|
duration: 2000
|
|
});
|
|
}
|
|
|
|
},
|
|
getUserData(){
|
|
this.requestToken({
|
|
url: this.host + "/api/user/info",
|
|
type: "post",
|
|
success: (res) => {
|
|
|
|
this.userData = res.data.data
|
|
}
|
|
|
|
})
|
|
},
|
|
changeInformation(key, value) {
|
|
this.makeState = false
|
|
console.log(key, value)
|
|
this.requestToken({
|
|
url: this.host + "/api/user/editInfo",
|
|
type: "post",
|
|
data: {
|
|
field: key,
|
|
value: value
|
|
},
|
|
success: (res) => {
|
|
this.getUserData()
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
changeInformationTel() {
|
|
this.requestToken({
|
|
url: "/api/user/bind-phone",
|
|
type: "post",
|
|
data: {
|
|
field: key,
|
|
value: value
|
|
|
|
}
|
|
})
|
|
},
|
|
// 打开姓名修改弹窗
|
|
modification(text) {
|
|
|
|
this.makeState = true
|
|
},
|
|
modificationA(text) {
|
|
|
|
this.makeStateA = true
|
|
},
|
|
cancelName() {
|
|
this.makeState = false
|
|
},
|
|
cancelTel() {
|
|
this.makeStateA = false
|
|
},
|
|
//点击弹出弹窗
|
|
popup_bottom: function() {
|
|
this.height = '550rpx';
|
|
//显示
|
|
this.show_popup();
|
|
|
|
},
|
|
//显示弹窗
|
|
show_popup: function() {
|
|
this.$refs.linkAddress.show();
|
|
},
|
|
//回掉
|
|
confirmCallback: function(data) {
|
|
let ads = data
|
|
this.address=""
|
|
if(ads.province){
|
|
this.address+= ads.province
|
|
}
|
|
if(ads.city){
|
|
this.address+="-"+ads.city
|
|
}
|
|
if(ads.district){
|
|
this.address+= "-"+ads.district
|
|
}
|
|
this.changeInformation("address",this.address)
|
|
},
|
|
headPortrait() {
|
|
let userData = uni.getStorageSync('userData')
|
|
uni.chooseImage({
|
|
success: (chooseImageRes) => {
|
|
console.log(chooseImageRes)
|
|
const tempFilePaths = chooseImageRes.tempFilePaths;
|
|
console.log(tempFilePaths)
|
|
uni.uploadFile({
|
|
url: this.host + '/api/file/upload/image', //仅为示例,非真实的接口地址
|
|
filePath: tempFilePaths[0],
|
|
header: {
|
|
"Authorization": "Bearer " + userData.token,
|
|
},
|
|
name: 'image',
|
|
success: (uploadFileRes) => {
|
|
|
|
this.changeInformation("headimgurl", JSON.parse(uploadFileRes
|
|
.data).data.src)
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.list {
|
|
margin-top: 13rpx;
|
|
padding-bottom: 32rpx;
|
|
background-color: #FFFFFF;
|
|
padding: 40rpx 40rpx 40rpx;
|
|
}
|
|
|
|
.list .con {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 24rpx;
|
|
|
|
padding: 15rpx 0rpx;
|
|
}
|
|
|
|
.listName {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.listName .img {
|
|
width: 43rpx;
|
|
margin-right: 15rpx;
|
|
}
|
|
|
|
.listName .text {
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.arrows {
|
|
width: 14rpx;
|
|
height: 26rpx;
|
|
}
|
|
|
|
.hint {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.hintBUTTON {
|
|
background-color: rgba(0, 0, 0, 0);
|
|
margin: 0rpx;
|
|
border: none;
|
|
padding: 0rpx;
|
|
|
|
|
|
}
|
|
|
|
.hint .text {
|
|
font-size: 24rpx;
|
|
color: #8c8c9b;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.hintBUTTON::after {
|
|
border: none;
|
|
}
|
|
|
|
.headPortrait {
|
|
width: 136rpx;
|
|
border-radius: 25rpx;
|
|
height: 136rpx;
|
|
}
|
|
|
|
.makeCon {
|
|
width: 600rpx;
|
|
border-radius: 50rpx;
|
|
background-color: #FFFFFF;
|
|
padding: 40rpx;
|
|
}
|
|
|
|
.makeList {}
|
|
|
|
.makeList .button {
|
|
width: 160rpx;
|
|
margin-top: 20rpx;
|
|
color: #FFFFFF;
|
|
height: 60rpx;
|
|
line-height: 60rpx;
|
|
font-size: 28rpx;
|
|
background-color: #D33333;
|
|
}
|
|
|
|
.title {
|
|
font-size: 28rpx;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.makeList .input {
|
|
flex: 1;
|
|
background-color: #8c8c9b;
|
|
border-radius: 50rpx;
|
|
height: 80rpx;
|
|
color: #FFFFFF;
|
|
padding-left: 28rpx;
|
|
|
|
}
|
|
|
|
.makeList .textarea {
|
|
height: 200rpx;
|
|
box-sizing: border-box;
|
|
padding: 20rpx 40rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.intPal {
|
|
color: #ddd;
|
|
}
|
|
|
|
.make {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: fixed;
|
|
left: 0rpx;
|
|
top: 0rpx;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
|
|
}
|
|
|
|
.member {
|
|
width: 658rpx;
|
|
height: 494rpx;
|
|
box-sizing: border-box;
|
|
background-color: #FFFFFF;
|
|
border-radius: 25rpx;
|
|
padding: 58rpx;
|
|
position: relative;
|
|
}
|
|
|
|
.member .title {
|
|
font-size: 30rpx;
|
|
text-align: center;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.member .name {
|
|
color: #999999;
|
|
font-size: 30rpx;
|
|
font-weight: 300;
|
|
margin-top: 50rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
.member .input {
|
|
border-bottom: 1px #e6e6e6 solid;
|
|
padding: 0rpx 0rpx 20rpx 0rpx;
|
|
}
|
|
|
|
.inpal {
|
|
color: #000000;
|
|
font-size: 30rpx
|
|
}
|
|
|
|
.member .button {
|
|
width: 559rpx;
|
|
height: 98rpx;
|
|
background-color: #D33333;
|
|
text-align: center;
|
|
line-height: 98rpx;
|
|
border-radius: 25rpx;
|
|
margin-top: 73rpx;
|
|
color: #FFFFFF;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.memberGb {
|
|
width: 77rpx;
|
|
height: 77rpx;
|
|
position: absolute;
|
|
right: -38rpx;
|
|
top: -38rpx;
|
|
}
|
|
.memberTextarea{
|
|
height: auto;
|
|
}
|
|
.inputTextarea{
|
|
/* background-color: rgba(0,0,0,0.1) */
|
|
}
|
|
</style>
|