|
@@ -5,7 +5,10 @@
|
|
|
<u-input v-model="form.studentName" placeholder=" " disabled />
|
|
|
</u-form-item>
|
|
|
<u-form-item v-if="navbarTitle == '客户信息'" label="学生照片" prop="imageFileId" label-position="top">
|
|
|
- <u-upload max-count="1" :deletable="false" :file-list="form.fileList" index="1" :show-progress="false" :preview-full-image="false"></u-upload>
|
|
|
+ <u-upload v-if="headflag==1" max-count="1" :deletable="false" :file-list="form.fileList" index="1" :show-progress="false" :preview-full-image="false"></u-upload>
|
|
|
+ <u-upload v-else :max-count="1" :action="uploadUrl" :header="uploadHeader" @on-success="uploadSuccess" @on-error="uploadError"
|
|
|
+ @on-remove="uploadRemove" :file-list="form.fileList" index="1"></u-upload>
|
|
|
+ <u-button v-if="headflag==0" type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="saveHead" style="width: 30%;float: right;display: inline-block;margin-top: -120rpx;">保存头像</u-button>
|
|
|
</u-form-item>
|
|
|
<u-form-item label="学员性别" prop="sex" placeholder=" " disabled>
|
|
|
<text>{{ form.sex == '0' ? '男' : '女' }}</text>
|
|
@@ -84,6 +87,11 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ imageFileId:'',
|
|
|
+ uploadUrl: API.uploadFile,
|
|
|
+ uploadHeader: {
|
|
|
+ Authorization: uni.getStorageSync('token')
|
|
|
+ },
|
|
|
navbarTitle: '',
|
|
|
id: '',
|
|
|
form: {
|
|
@@ -121,10 +129,31 @@
|
|
|
},
|
|
|
// 追踪记录
|
|
|
recordShow: false,
|
|
|
- recordList: []
|
|
|
+ recordList: [],
|
|
|
+ headflag:1,
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ uploadSuccess(res, index, lists, name) {
|
|
|
+ this.imageFileId = res.data.id
|
|
|
+ console.log(this.imageFileId)
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: '文件上传成功',
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ // 文件上传失败回调
|
|
|
+ uploadError(res, index, lists, name) {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: error.message,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 移除文件回调
|
|
|
+ uploadRemove(index, lists, name) {
|
|
|
+ this.imageFileId = ""
|
|
|
+ },
|
|
|
// 客户信息
|
|
|
getCustomerInfo() {
|
|
|
NET.request(API.customerDetail, {
|
|
@@ -132,7 +161,13 @@
|
|
|
if(res.status == 10000) {
|
|
|
const result = res.data
|
|
|
this.form.studentName = result.studentName
|
|
|
- this.form.fileList.push(result.imageFileUrl)
|
|
|
+ this.form.studentId = result.studentId
|
|
|
+ this.headflag = result.saleHeadNo
|
|
|
+ console.log(result.imageFileUrl)
|
|
|
+ this.form.fileList = [{
|
|
|
+ url: result.imageFileUrl
|
|
|
+ }]
|
|
|
+ //this.form.fileList.push(result.imageFileUrl)
|
|
|
this.form.sex = result.sex
|
|
|
this.form.age = result.age
|
|
|
this.form.birthday = result.birthday
|
|
@@ -194,6 +229,34 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 保存头像
|
|
|
+ saveHead() {
|
|
|
+ if(this.imageFileId==""){
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: "请上传修改的学生照片",
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ NET.request(API.customerHeadSet, {
|
|
|
+ 'studentId':this.form.studentId,
|
|
|
+ 'imageFileId':this.imageFileId
|
|
|
+ }, 'POST').then(res=> {
|
|
|
+ if(res.status == 10000) {
|
|
|
+ this.getCustomerInfo()
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: error.message,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|