|
|
@ -1,11 +1,16 @@ |
|
|
<!--用户信息(教练)-详情--> |
|
|
<!--销售-个人资料-详情--> |
|
|
<template> |
|
|
<template> |
|
|
<view class="main_box"> |
|
|
<view class="main_box"> |
|
|
|
|
|
|
|
|
<view class="main_section"> |
|
|
<view class="main_section"> |
|
|
<view class="section"> |
|
|
<view class="section"> |
|
|
<view class="item"> |
|
|
<view class="item"> |
|
|
<image @click="changeAvatar()" class="pic" src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image> |
|
|
<image |
|
|
|
|
|
@click="changeAvatar()" |
|
|
|
|
|
class="pic" |
|
|
|
|
|
:src="$util.img(formData.header)" |
|
|
|
|
|
></image> |
|
|
|
|
|
|
|
|
<view class="btn" @click="changeAvatar()">修改头像</view> |
|
|
<view class="btn" @click="changeAvatar()">修改头像</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -25,7 +30,7 @@ |
|
|
账号 <text class="required"></text> |
|
|
账号 <text class="required"></text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="input"> |
|
|
<view class="input"> |
|
|
<input disabled placeholder="暂无" /> |
|
|
<input v-model="formData.username" disabled placeholder="暂无" /> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
@ -43,7 +48,7 @@ |
|
|
等级 <text class="required"></text> |
|
|
等级 <text class="required"></text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="input"> |
|
|
<view class="input"> |
|
|
<input disabled placeholder="暂无" /> |
|
|
<input v-model="formData.member_level_name" disabled placeholder="暂无" /> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -54,7 +59,7 @@ |
|
|
性别 <text class="required">*</text> |
|
|
性别 <text class="required">*</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="input"> |
|
|
<view class="input"> |
|
|
<input placeholder="请选择性别" v-model="sex_name" @click="picker_show_sex=true"/> |
|
|
<input placeholder="请选择性别" v-model="formData.gender" @click="picker_show_sex=true"/> |
|
|
<fui-picker |
|
|
<fui-picker |
|
|
layer="1" |
|
|
layer="1" |
|
|
:linkage="true" |
|
|
:linkage="true" |
|
|
@ -97,7 +102,7 @@ |
|
|
手机 <text class="required">*</text> |
|
|
手机 <text class="required">*</text> |
|
|
</view> |
|
|
</view> |
|
|
<view class="input"> |
|
|
<view class="input"> |
|
|
<input v-model="formData.tel" placeholder="请输入手机" /> |
|
|
<input v-model="formData.phone" placeholder="请输入手机" /> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
@ -111,14 +116,16 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="submet_btn">提交</view> |
|
|
<view class="submet_btn" @click="submit">提交</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
// import user from '@/api/user.js'; |
|
|
import marketApi from '@/api/market.js'; |
|
|
import {Api_url} from "@/common/config.js"; |
|
|
import { |
|
|
|
|
|
Api_url |
|
|
|
|
|
} from "@/common/config.js"; |
|
|
import AQTabber from "@/components/AQ/AQTabber" |
|
|
import AQTabber from "@/components/AQ/AQTabber" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -129,30 +136,43 @@ export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
formData:{ |
|
|
formData:{ |
|
|
images_arr:[], |
|
|
header:'',//头像地址 |
|
|
name:'',//姓名 |
|
|
name:'',//姓名 |
|
|
email:'',//邮箱 |
|
|
username:'',//账号 |
|
|
tel:'',//手机 |
|
|
address:'',//住址 |
|
|
wx:'',//微信 |
|
|
gender:'',//性别|男,女 |
|
|
sex:'',//性别 |
|
|
|
|
|
birthday:'',//生日 |
|
|
birthday:'',//生日 |
|
|
|
|
|
email:'',//邮箱 |
|
|
|
|
|
phone:'',//手机 |
|
|
|
|
|
wx:'',//微信号 |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
userInfo: {}, |
|
|
|
|
|
|
|
|
//上传图片APi路径 |
|
|
//上传图片APi路径 |
|
|
uploadUrl: `${Api_url}/salesmanapi/common/uploadFile`, |
|
|
uploadUrl: `${Api_url}/file/image`, |
|
|
|
|
|
|
|
|
//性别选择器 相关 |
|
|
//性别选择器 相关 |
|
|
picker_show_sex: false, |
|
|
picker_show_sex: false, |
|
|
sex_name:'请选择', |
|
|
sex_name:'请选择', |
|
|
options_sex_arr:[ |
|
|
options_sex_arr: [ |
|
|
{ value: 1, text: '男' }, |
|
|
{ |
|
|
{ value: 2, text: '女' }, |
|
|
value: 1, |
|
|
|
|
|
text: '男' |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
value: 2, |
|
|
|
|
|
text: '女' |
|
|
|
|
|
}, |
|
|
], |
|
|
], |
|
|
|
|
|
|
|
|
//生日选择器相关 |
|
|
//生日选择器相关 |
|
|
minDate:'', |
|
|
minDate: '', |
|
|
maxDate:'', |
|
|
maxDate: '', |
|
|
picker_show_birthday:false, |
|
|
picker_show_birthday: false, |
|
|
|
|
|
upload_type: 1, |
|
|
|
|
|
uploadHeadimg: '', |
|
|
|
|
|
editHeadimg: '', |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad() { |
|
|
onLoad() { |
|
|
@ -163,7 +183,44 @@ export default { |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
|
|
|
async init(){ |
|
|
async init(){ |
|
|
this.getBirthday() |
|
|
// this.getBirthday() |
|
|
|
|
|
this.setDateYear() |
|
|
|
|
|
await this.getUserInfo() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//设置年份 |
|
|
|
|
|
setDateYear() { |
|
|
|
|
|
let currentYear = new Date().getFullYear(); |
|
|
|
|
|
this.minDate = String(currentYear - 100); |
|
|
|
|
|
this.maxDate = String(currentYear + 1); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//获取用户详情 |
|
|
|
|
|
async getUserInfo(){ |
|
|
|
|
|
let res = await marketApi.member({}) |
|
|
|
|
|
if (res.code != 1){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: res.msg, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//用户表单 |
|
|
|
|
|
this.formData = { |
|
|
|
|
|
header: res.data.headimg,//头像地址 |
|
|
|
|
|
name: res.data.name,//姓名 |
|
|
|
|
|
username: res.data.username,//账号 |
|
|
|
|
|
address: res.data.address,//住址 |
|
|
|
|
|
gender: res.data.gender,//性别|男,女 |
|
|
|
|
|
birthday: res.data.birthday,//生日 |
|
|
|
|
|
email: res.data.email,//邮箱 |
|
|
|
|
|
phone: res.data.phone,//手机 |
|
|
|
|
|
wx: res.data.wx || '',//微信号 |
|
|
|
|
|
member_level_name: res.data.member_level_name || '',//等级名称 |
|
|
|
|
|
} |
|
|
|
|
|
console.log(123,this.formData); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 修改头像按钮 |
|
|
// 修改头像按钮 |
|
|
@ -179,34 +236,31 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
async uploadFilePromise(url) { |
|
|
uploadFilePromise(url) { |
|
|
console.log('AQ',this.uploadUrl,url) |
|
|
let token = uni.getStorageSync('token') || '' |
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
|
let a = uni.uploadFile({ |
|
|
let a = uni.uploadFile({ |
|
|
url: this.uploadUrl, // 仅为示例,非真实的接口地址 |
|
|
url: this.uploadUrl, //仅为示例,非真实的接口地址 |
|
|
filePath: url, |
|
|
filePath: url, |
|
|
name: "file", |
|
|
name: 'file', |
|
|
formData: { |
|
|
header: { |
|
|
token: this.$store.state.token, |
|
|
'token': `${token}`, //请求头设置token |
|
|
}, |
|
|
}, |
|
|
success: (e) => { |
|
|
success: (e) => { |
|
|
console.log('上传成功1',e) |
|
|
|
|
|
let res = JSON.parse(e.data.replace(/\ufeff/g, "") || "{}") |
|
|
let res = JSON.parse(e.data.replace(/\ufeff/g, "") || "{}") |
|
|
console.log('上传成功2',res) |
|
|
console.log('上传成功2', res) |
|
|
if (res.code >= 0){ |
|
|
if (res.code == 1) { |
|
|
this.userInfo.pic = res.data.pic_path |
|
|
this.upload_type = 2 |
|
|
this.editPic(res.data.pic_path) |
|
|
this.formData.header = res.data.path |
|
|
}else{ |
|
|
// this.editHeadimg = res.data.path |
|
|
this.$util.showToast({ |
|
|
// this.uploadHeadimg = res.data.url |
|
|
title: res.message |
|
|
} else { |
|
|
}); |
|
|
uni.showToast({ |
|
|
|
|
|
title: res.msg, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
setTimeout(() => { |
|
|
|
|
|
resolve(res.data.data); |
|
|
|
|
|
}, 1000); |
|
|
|
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
}, |
|
|
}, |
|
|
//修改头像Api |
|
|
//修改头像Api |
|
|
async editPic(pic) { |
|
|
async editPic(pic) { |
|
|
@ -223,16 +277,15 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//性别选择相关 |
|
|
//性别选择相关 |
|
|
changePickerSex(e){ |
|
|
changePickerSex(e) { |
|
|
console.log('监听选择',e) |
|
|
console.log('监听选择', e) |
|
|
this.sex_name = e.text |
|
|
this.formData.gender = e.text |
|
|
this.formData.sex = e.value |
|
|
|
|
|
this.picker_show_sex = false |
|
|
this.picker_show_sex = false |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//生日选择相关 |
|
|
//生日选择相关 |
|
|
//获取当前年月日+获取30年前的日期 |
|
|
//获取当前年月日+获取30年前的日期 |
|
|
getBirthday(){ |
|
|
getBirthday() { |
|
|
let date = new Date(); |
|
|
let date = new Date(); |
|
|
let year = date.getFullYear(); |
|
|
let year = date.getFullYear(); |
|
|
let month = date.getMonth() + 1; |
|
|
let month = date.getMonth() + 1; |
|
|
@ -271,12 +324,82 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//监听生日选择 |
|
|
//监听生日选择 |
|
|
changePickerBirthday(e){ |
|
|
changePickerBirthday(e) { |
|
|
console.log('监听生日选择',e) |
|
|
console.log('监听生日选择', e) |
|
|
this.formData.birthday = e.result |
|
|
this.formData.birthday = e.result |
|
|
this.picker_show_birthday = false |
|
|
this.picker_show_birthday = false |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//提交信息 |
|
|
|
|
|
async submit() { |
|
|
|
|
|
let data = {...this.formData} |
|
|
|
|
|
|
|
|
|
|
|
if(!data.header){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '请上传头像', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!data.name){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '请填写', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!data.gender){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '请选择性别', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!data.birthday){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '请选择生日', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!data.email){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '请填写邮箱', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!data.phone){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '请填写手机', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let res = await marketApi.memberEdit(data) |
|
|
|
|
|
if(res.code != 1){ |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: res.msg, |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: res.msg, |
|
|
|
|
|
icon: 'success' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.getUserInfo() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|