|
|
|
@ -5,7 +5,9 @@ |
|
|
|
<view class="main_section"> |
|
|
|
<view class="section"> |
|
|
|
<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.headimg)" v-if="upload_type == 1"> |
|
|
|
<image @click="changeAvatar()" class="pic" :src="uploadHeadimg" v-else> |
|
|
|
</image> |
|
|
|
<view class="btn" @click="changeAvatar()">修改头像</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -13,7 +15,7 @@ |
|
|
|
<view class="section"> |
|
|
|
<view class="item"> |
|
|
|
<view class="title"> |
|
|
|
姓名 <text class="required">*</text> |
|
|
|
学员姓名 <text class="required">*</text> |
|
|
|
</view> |
|
|
|
<view class="input"> |
|
|
|
<input v-model="formData.name" placeholder="请输入姓名"/> |
|
|
|
@ -25,25 +27,25 @@ |
|
|
|
账号 <text class="required"></text> |
|
|
|
</view> |
|
|
|
<view class="input"> |
|
|
|
<input disabled placeholder="暂无" /> |
|
|
|
<input disabled placeholder="暂无" v-model="formData.username"/> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="item"> |
|
|
|
<view class="title"> |
|
|
|
部门 <text class="required"></text> |
|
|
|
住址 <text class="required"></text> |
|
|
|
</view> |
|
|
|
<view class="input"> |
|
|
|
<input disabled placeholder="暂无" /> |
|
|
|
<input placeholder="暂无" v-model="formData.address"/> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="item"> |
|
|
|
<view class="title"> |
|
|
|
等级 <text class="required"></text> |
|
|
|
课程 <text class="required"></text> |
|
|
|
</view> |
|
|
|
<view class="input"> |
|
|
|
<input disabled placeholder="暂无" /> |
|
|
|
<input disabled placeholder="暂无" :value="formData.classes_list"/> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -55,14 +57,8 @@ |
|
|
|
</view> |
|
|
|
<view class="input"> |
|
|
|
<input placeholder="请选择性别" v-model="sex_name" @click="picker_show_sex=true" /> |
|
|
|
<fui-picker |
|
|
|
layer="1" |
|
|
|
:linkage="true" |
|
|
|
:options="options_sex_arr" |
|
|
|
:show="picker_show_sex" |
|
|
|
@change="changePickerSex" |
|
|
|
@cancel="picker_sex_show=false" |
|
|
|
></fui-picker> |
|
|
|
<fui-picker layer="1" :linkage="true" :options="options_sex_arr" :show="picker_show_sex" |
|
|
|
@change="changePickerSex" @cancel="picker_sex_show=false"></fui-picker> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
@ -72,17 +68,13 @@ |
|
|
|
</view> |
|
|
|
<view class="input"> |
|
|
|
<input placeholder="请选择生日" @click="picker_show_birthday=true" v-model="formData.birthday" /> |
|
|
|
<fui-date-picker |
|
|
|
:minDate="minDate" |
|
|
|
:maxDate="maxDate" |
|
|
|
:show="picker_show_birthday" |
|
|
|
type="3" |
|
|
|
@change="changePickerBirthday" |
|
|
|
@cancel="picker_show_birthday=false" |
|
|
|
></fui-date-picker> |
|
|
|
<fui-date-picker :minDate="minDate" :maxDate="maxDate" :show="picker_show_birthday" type="3" |
|
|
|
@change="changePickerBirthday" @cancel="picker_show_birthday=false"></fui-date-picker> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="section"> |
|
|
|
<view class="item"> |
|
|
|
<view class="title"> |
|
|
|
邮箱 <text class="required">*</text> |
|
|
|
@ -97,28 +89,22 @@ |
|
|
|
手机 <text class="required">*</text> |
|
|
|
</view> |
|
|
|
<view class="input"> |
|
|
|
<input v-model="formData.tel" placeholder="请输入手机" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="item"> |
|
|
|
<view class="title"> |
|
|
|
微信 <text class="required"></text> |
|
|
|
</view> |
|
|
|
<view class="input"> |
|
|
|
<input v-model="formData.wx" placeholder="请输入微信" /> |
|
|
|
<input v-model="formData.mobile" placeholder="请输入手机" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="submet_btn">提交</view> |
|
|
|
|
|
|
|
<view class="submet_btn" @click="submit">提交</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
// import user from '@/api/user.js'; |
|
|
|
import {Api_url} from "@/common/config.js"; |
|
|
|
import member from '@/api/member.js'; |
|
|
|
import { |
|
|
|
Api_url |
|
|
|
} from "@/common/config.js"; |
|
|
|
import AQTabber from "@/components/AQ/AQTabber" |
|
|
|
|
|
|
|
|
|
|
|
@ -128,6 +114,7 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
member_info: [], |
|
|
|
formData: { |
|
|
|
images_arr: [], |
|
|
|
name: '', //姓名 |
|
|
|
@ -139,26 +126,36 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
//上传图片APi路径 |
|
|
|
uploadUrl: `${Api_url}/salesmanapi/common/uploadFile`, |
|
|
|
uploadUrl: `${Api_url}/file/image`, |
|
|
|
|
|
|
|
//性别选择器 相关 |
|
|
|
picker_show_sex: false, |
|
|
|
sex_name: '请选择', |
|
|
|
options_sex_arr:[ |
|
|
|
{ value: 1, text: '男' }, |
|
|
|
{ value: 2, text: '女' }, |
|
|
|
options_sex_arr: [{ |
|
|
|
value: 0, |
|
|
|
text: '保密' |
|
|
|
},{ |
|
|
|
value: 1, |
|
|
|
text: '男' |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 2, |
|
|
|
text: '女' |
|
|
|
}, |
|
|
|
], |
|
|
|
|
|
|
|
//生日选择器相关 |
|
|
|
minDate: '', |
|
|
|
maxDate: '', |
|
|
|
picker_show_birthday: false, |
|
|
|
upload_type: 1, |
|
|
|
uploadHeadimg: '', |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
}, |
|
|
|
onLoad() {}, |
|
|
|
onShow() { |
|
|
|
this.init() |
|
|
|
this.member_init() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
@ -166,6 +163,25 @@ export default { |
|
|
|
this.getBirthday() |
|
|
|
}, |
|
|
|
|
|
|
|
//获取学员信息 |
|
|
|
member_init() { |
|
|
|
member.member().then(res => { |
|
|
|
if(res.code == 1){ |
|
|
|
this.member_info = res.data |
|
|
|
this.formData = {...this.member_info} |
|
|
|
if(res.data.sex == 0){ |
|
|
|
this.sex_name = '保密' |
|
|
|
}else if(this.formData.sex == 1){ |
|
|
|
this.sex_name = '男' |
|
|
|
}else if(this.formData.sex == 2){ |
|
|
|
this.sex_name = '女' |
|
|
|
} |
|
|
|
}else{ |
|
|
|
this.member_info = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 修改头像按钮 |
|
|
|
changeAvatar() { |
|
|
|
uni.chooseImage({ |
|
|
|
@ -180,48 +196,36 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
async uploadFilePromise(url) { |
|
|
|
console.log('AQ',this.uploadUrl,url) |
|
|
|
let token = uni.getStorageSync('token') || '' |
|
|
|
console.log(token,'AQ', this.uploadUrl, this.$store.state.token) |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
let a = uni.uploadFile({ |
|
|
|
url: this.uploadUrl, //仅为示例,非真实的接口地址 |
|
|
|
filePath: url, |
|
|
|
name: "file", |
|
|
|
formData: { |
|
|
|
token: this.$store.state.token, |
|
|
|
name: 'file', |
|
|
|
header: { |
|
|
|
'token': `${token}`,//请求头设置token |
|
|
|
}, |
|
|
|
success: (e) => { |
|
|
|
console.log('上传成功1',e) |
|
|
|
let res = JSON.parse(e.data.replace(/\ufeff/g, "") || "{}") |
|
|
|
console.log('上传成功2', res) |
|
|
|
if (res.code >= 0){ |
|
|
|
this.userInfo.pic = res.data.pic_path |
|
|
|
this.editPic(res.data.pic_path) |
|
|
|
if (res.code == 1) { |
|
|
|
this.upload_type = 2 |
|
|
|
this.formData.headimg = res.data.path |
|
|
|
this.uploadHeadimg = res.data.url |
|
|
|
} else { |
|
|
|
this.$util.showToast({ |
|
|
|
title: res.message |
|
|
|
}); |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
resolve(res.data.data); |
|
|
|
resolve(res.data); |
|
|
|
}, 1000); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
//修改头像Api |
|
|
|
async editPic(pic) { |
|
|
|
let res = await salesmanApi.editPic({pic: pic}) |
|
|
|
if (res.code >= 0) { |
|
|
|
this.$util.showToast({ |
|
|
|
title: '修改成功' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$util.showToast({ |
|
|
|
title: res.message |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//性别选择相关 |
|
|
|
changePickerSex(e) { |
|
|
|
console.log('监听选择', e) |
|
|
|
@ -277,12 +281,36 @@ export default { |
|
|
|
this.picker_show_birthday = false |
|
|
|
}, |
|
|
|
|
|
|
|
//提交信息 |
|
|
|
submit(){ |
|
|
|
member.member_edit({ |
|
|
|
header: this.formData.headimg, |
|
|
|
name: this.formData.name, |
|
|
|
address: this.formData.address, |
|
|
|
gender: this.formData.sex, |
|
|
|
birthday: this.formData.birthday, |
|
|
|
email: this.formData.email, |
|
|
|
phone: this.formData.mobile, |
|
|
|
}).then(res => { |
|
|
|
if(res.code == 1){ |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="less" scoped> |
|
|
|
|
|
|
|
.main_box { |
|
|
|
background: #292929; |
|
|
|
} |
|
|
|
@ -293,6 +321,7 @@ export default { |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
background: #29d3b4; |
|
|
|
|
|
|
|
.title { |
|
|
|
padding: 20rpx 0; |
|
|
|
font-size: 30rpx; |
|
|
|
@ -314,16 +343,19 @@ export default { |
|
|
|
|
|
|
|
.section { |
|
|
|
background-color: #434544; |
|
|
|
|
|
|
|
.item { |
|
|
|
padding: 20rpx 40rpx; |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
|
|
|
|
.pic { |
|
|
|
width: 82rpx; |
|
|
|
height: 82rpx; |
|
|
|
border-radius: 50%; |
|
|
|
} |
|
|
|
|
|
|
|
.btn {} |
|
|
|
|
|
|
|
.title { |
|
|
|
@ -331,11 +363,13 @@ export default { |
|
|
|
align-items: center; |
|
|
|
font-size: 26rpx; |
|
|
|
color: #D7D7D7; |
|
|
|
|
|
|
|
.required { |
|
|
|
margin-left: 10rpx; |
|
|
|
color: red; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.input { |
|
|
|
input { |
|
|
|
text-align: right; |
|
|
|
@ -360,6 +394,4 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</style> |