1159 lines
41 KiB
JavaScript
1159 lines
41 KiB
JavaScript
// commpents/myprofile/index.js
|
|
import Toast from '@vant/weapp/toast/toast';
|
|
import { API } from '../../../utils/network/api'
|
|
import { FileUtil } from '../../utils/fileutil'
|
|
|
|
const api = new API()
|
|
const app = getApp()
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
indentity: { //是否为认证页面
|
|
type: Boolean,
|
|
value: true
|
|
}
|
|
},
|
|
data: {
|
|
navbarData: {
|
|
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
|
title: '医师身份认证', //导航栏 中间的标题
|
|
},
|
|
height: app.globalData.height,
|
|
//选项卡
|
|
stickyProps: {
|
|
zIndex: 2,
|
|
},
|
|
realname:"",
|
|
idcard:"",
|
|
static_host: api.getStaticHost(),
|
|
avatar: api.getStaticHost()+"/applet/doctor/static/images/default_photo.png",
|
|
is_avatar: false,
|
|
city_show: false,
|
|
keshi_show: false,
|
|
yiyuan_show: false,
|
|
zhuanchang_show: false,
|
|
zhiye_show: false,
|
|
zige_show: false,
|
|
zhicheng_show: false,
|
|
zhicheng_img_show: false,
|
|
next_btn_txt: "下一步",
|
|
next_btn_disabled: false,
|
|
office_phone: "",
|
|
keshi_note: "请选择科室",
|
|
keshi_columns: [],
|
|
select_keshi_id: "",
|
|
select_keshi_index: "",
|
|
custom_keshi: "",
|
|
zhicheng_note: "请选择职称",
|
|
zhicheng_columns: [],
|
|
select_zhicheng_id: "",
|
|
select_zhicheng_index: "",
|
|
select_yiyuan_index: "",
|
|
yiyuan_columns: [],
|
|
zhuanchang_columns: [],
|
|
zhuanchang_selected_columns: [],
|
|
select_province_id: "",
|
|
select_city_id: "",
|
|
select_county_id: "",
|
|
city_note: "请选择城市",
|
|
yiyuan_note: "请选择医院",
|
|
select_yiyuan_id: "",
|
|
area_sub_titles: ["省份","市区","区县"],
|
|
areaList: [],
|
|
textarea_jianjie: "",
|
|
textarea_shanchang: "",
|
|
zhiye_file_list:[],
|
|
zige_file_list:[],
|
|
zhicheng_file_list:[],
|
|
doctorauthiden_data_ready: false,
|
|
basicdepartment_data_ready: false,
|
|
areaprovince_data_ready: false,
|
|
basicdoctortitle_data_ready: false,
|
|
iden_auth_status: 0,
|
|
iden_auth_disabled: 0,
|
|
iden_auth_status_txt: "未认证",
|
|
avatar_reason: "",
|
|
department_custom_mobile_reason: "",
|
|
brief_introduction_reason: "",
|
|
be_good_at_reason: "",
|
|
license_cert_reason: "",
|
|
qualification_cert_reason: "",
|
|
work_cert_reason: "",
|
|
department_custom_name_reason: '',
|
|
zhuanchang_note: '请选择专长',
|
|
jianjie_show: false,
|
|
shanchang_show: false,
|
|
show_cropper: false,
|
|
img_cropper_src: '',
|
|
img_cropper_width: 250, //宽度
|
|
img_cropper_height: 250, //高度
|
|
},
|
|
options: {
|
|
addGlobalClass: true,
|
|
styleIsolation: 'apply-shared'
|
|
},
|
|
lifetimes: {
|
|
attached(){
|
|
|
|
console.log("myprofile attached")
|
|
let _this = this;
|
|
if(!this.data.indentity){
|
|
api.getIntroduction().then(response => {
|
|
console.log("getDoctorAuthIden: ",response);
|
|
this.setData({
|
|
doctorauthiden_data_ready: true,
|
|
textarea_jianjie: response.data.brief_introduction,
|
|
textarea_shanchang: response.data.be_good_at,
|
|
custom_keshi: response.data.department_custom_name,
|
|
office_phone: response.data.department_custom_mobile,
|
|
select_keshi_id: response.data.department_custom_id,
|
|
select_zhicheng_id: response.data.doctor_title,
|
|
select_province_id: response.data.hospital.province_id,
|
|
select_city_id: response.data.hospital.city_id,
|
|
select_county_id: response.data.hospital.county_id,
|
|
select_yiyuan_id: response.data.hospital.hospital_id,
|
|
hospital: response.data.hospital,
|
|
iden_auth_status: response.data.iden_auth_status,
|
|
introduction_status: response.data.introduction_status,
|
|
avatar_reason: response.data.avatar_reason,
|
|
department_custom_mobile_reason: response.data.department_custom_mobile_reason,
|
|
brief_introduction_reason: response.data.brief_introduction_reason,
|
|
be_good_at_reason: response.data.be_good_at_reason,
|
|
license_cert_reason: response.data.license_cert_reason,
|
|
qualification_cert_reason: response.data.qualification_cert_reason,
|
|
work_cert_reason: response.data.work_cert_reason,
|
|
department_custom_name_reason: response.data.department_custom_name_reason,
|
|
});
|
|
let iden_auth_status = response.data.introduction_status;
|
|
console.log("iden_auth_status: ",iden_auth_status)
|
|
let iden_auth_status_txt = iden_auth_status == 0?'请完善资料后提交':iden_auth_status == 1?'认证通过': iden_auth_status==2?'资料已提交,审核中':iden_auth_status==3?'认证失败,修改后重新提交':'未认证';
|
|
|
|
let iden_auth_disabled = iden_auth_status == 0?false:iden_auth_status == 1?true: iden_auth_status==2?true:iden_auth_status==3?false:true;
|
|
console.log("iden_auth_disabled: ",iden_auth_disabled)
|
|
this.setData({
|
|
iden_auth_status_txt: iden_auth_status_txt,
|
|
iden_auth_disabled: iden_auth_disabled
|
|
})
|
|
if(response.data.license_cert){
|
|
let img_list = response.data.license_cert.map(item => {
|
|
let img = {};
|
|
img.url = item;
|
|
img.isImg = true;
|
|
return img;
|
|
})
|
|
this.setData({
|
|
zhiye_file_list: img_list
|
|
})
|
|
}
|
|
if(response.data.qualification_cert){
|
|
let img_list = response.data.qualification_cert.map(item => {
|
|
let img = {};
|
|
img.url = item;
|
|
img.isImg = true;
|
|
return img;
|
|
})
|
|
this.setData({
|
|
zige_file_list: img_list
|
|
})
|
|
}
|
|
if(response.data.work_cert){
|
|
let img_list = response.data.work_cert.map(item => {
|
|
let img = {};
|
|
img.url = item;
|
|
img.isImg = true;
|
|
return img;
|
|
})
|
|
this.setData({
|
|
zhicheng_file_list: img_list
|
|
})
|
|
}
|
|
let avatar = response.data.avatar;
|
|
if(avatar){
|
|
this.setData({
|
|
"avatar": avatar,
|
|
is_avatar: true,
|
|
})
|
|
}
|
|
}).catch(errors => {console.error(errors);})
|
|
api.getIntroReason().then(response=>{
|
|
//console.log(response.data);
|
|
if(response.data){
|
|
this.setData({
|
|
avatar_reason: response.data.avatar,
|
|
brief_introduction_reason: response.data.brief_introduction,
|
|
be_good_at_reason: response.data.be_good_at,
|
|
|
|
})
|
|
}
|
|
|
|
|
|
})
|
|
}else{
|
|
api.getDoctorAuthIden({source: this.data.indentity?1:2}).then(response => {
|
|
console.log("getDoctorAuthIden: ",response);
|
|
this.setData({
|
|
doctorauthiden_data_ready: true,
|
|
textarea_jianjie: response.data.brief_introduction,
|
|
textarea_shanchang: response.data.be_good_at,
|
|
custom_keshi: response.data.department_custom_name,
|
|
office_phone: response.data.department_custom_mobile,
|
|
select_keshi_id: response.data.department_custom_id,
|
|
select_zhicheng_id: response.data.doctor_title,
|
|
select_province_id: response.data.hospital.province_id,
|
|
select_city_id: response.data.hospital.city_id,
|
|
select_county_id: response.data.hospital.county_id,
|
|
select_yiyuan_id: response.data.hospital.hospital_id,
|
|
hospital: response.data.hospital,
|
|
iden_auth_status: response.data.iden_auth_status,
|
|
avatar_reason: response.data.avatar_reason,
|
|
department_custom_mobile_reason: response.data.department_custom_mobile_reason,
|
|
brief_introduction_reason: response.data.brief_introduction_reason,
|
|
be_good_at_reason: response.data.be_good_at_reason,
|
|
license_cert_reason: response.data.license_cert_reason,
|
|
qualification_cert_reason: response.data.qualification_cert_reason,
|
|
work_cert_reason: response.data.work_cert_reason,
|
|
department_custom_name_reason: response.data.department_custom_name_reason,
|
|
});
|
|
let iden_auth_status = response.data.iden_auth_status;
|
|
console.log("iden_auth_status: ",iden_auth_status)
|
|
let iden_auth_status_txt = iden_auth_status == 0?'请完善资料后提交':iden_auth_status == 1?'认证通过': iden_auth_status==2?'资料已提交,审核中':iden_auth_status==3?'认证失败,修改后重新提交':'未认证';
|
|
|
|
let iden_auth_disabled = iden_auth_status == 0?false:iden_auth_status == 1?true: iden_auth_status==2?true:iden_auth_status==3?false:true;
|
|
console.log("iden_auth_disabled: ",iden_auth_disabled)
|
|
this.setData({
|
|
iden_auth_status_txt: iden_auth_status_txt,
|
|
iden_auth_disabled: iden_auth_disabled
|
|
})
|
|
if(response.data.license_cert){
|
|
let img_list = response.data.license_cert.map(item => {
|
|
let img = {};
|
|
img.url = item;
|
|
img.isImg = true;
|
|
return img;
|
|
})
|
|
this.setData({
|
|
zhiye_file_list: img_list
|
|
})
|
|
}
|
|
if(response.data.qualification_cert){
|
|
let img_list = response.data.qualification_cert.map(item => {
|
|
let img = {};
|
|
img.url = item;
|
|
img.isImg = true;
|
|
return img;
|
|
})
|
|
this.setData({
|
|
zige_file_list: img_list
|
|
})
|
|
}
|
|
if(response.data.work_cert){
|
|
let img_list = response.data.work_cert.map(item => {
|
|
let img = {};
|
|
img.url = item;
|
|
img.isImg = true;
|
|
return img;
|
|
})
|
|
this.setData({
|
|
zhicheng_file_list: img_list
|
|
})
|
|
}
|
|
let avatar = response.data.avatar;
|
|
if(avatar){
|
|
this.setData({
|
|
"avatar": avatar,
|
|
is_avatar: true,
|
|
})
|
|
}
|
|
}).catch(errors => {console.error(errors);})
|
|
api.getIdenReason().then(response=>{
|
|
//console.log(response.data);
|
|
if(response.data){
|
|
this.setData({
|
|
avatar_reason: response.data.avatar,
|
|
department_custom_mobile_reason: response.data.department_custom_mobile,
|
|
brief_introduction_reason: response.data.brief_introduction,
|
|
be_good_at_reason: response.data.be_good_at,
|
|
license_cert_reason: response.data.license_cert,
|
|
qualification_cert_reason: response.data.qualification_cert,
|
|
work_cert_reason: response.data.work_cert,
|
|
department_custom_name_reason: response.data.department_custom_name,
|
|
})
|
|
}
|
|
|
|
|
|
})
|
|
}
|
|
//获得医师身份认证getDoctorAuthIden({source: this.data.indentity?1:2})
|
|
|
|
|
|
//加载省份列表
|
|
api.getAreaProvince().then(response => {
|
|
console.log(response);
|
|
const list = _this.formatArea(response, -1, true);
|
|
_this.setData({
|
|
areaprovince_data_ready: true,
|
|
areaList: list
|
|
})
|
|
}).catch(errors => {console.error(errors); })
|
|
|
|
//加载科室列表
|
|
api.getBasicDepartment().then(response => {
|
|
console.log(response);
|
|
const list = _this.formatKeShi(response);
|
|
_this.setData({
|
|
basicdepartment_data_ready: true,
|
|
keshi_columns: list
|
|
})
|
|
}).catch(errors => {console.error(errors); })
|
|
|
|
//加载职称列表
|
|
api.getBasicDoctorTitle().then(response => {
|
|
console.log(response);
|
|
const list = _this.formatZhiCheng(response);
|
|
_this.setData({
|
|
basicdoctortitle_data_ready: true,
|
|
zhicheng_columns: list
|
|
})
|
|
}).catch(errors => {console.error(errors); })
|
|
|
|
//加载专长列表
|
|
api.getDoctorExpertise().then(response => {
|
|
console.log(response);
|
|
_this.setData({
|
|
zhuanchang_columns: response.data
|
|
})
|
|
}).then(()=>{
|
|
let index = this.data.zhuanchang_columns.findIndex(item => {
|
|
return item.is_selected == 1;
|
|
})
|
|
if(index != undefined) {
|
|
this.setData({
|
|
zhuanchang_note: ""
|
|
})
|
|
}
|
|
}).catch(errors => {console.error(errors); })
|
|
|
|
let keshi_huixian = false;
|
|
let zhicheng_huixian = false;
|
|
let area_huixian = false;
|
|
//执行回显
|
|
let huixian_try_count = 0;
|
|
let data_replay = setInterval(() => {
|
|
try {
|
|
console.log("执行回显。。。", huixian_try_count);
|
|
|
|
//回显科室
|
|
if(_this.data.doctorauthiden_data_ready && _this.data.basicdepartment_data_ready){
|
|
let index = _this.data.keshi_columns.findIndex(item => {
|
|
console.log("value: ",item.value);
|
|
console.log("select_keshi_id: ", _this.data.select_keshi_id);
|
|
return item.value == _this.data.select_keshi_id
|
|
})
|
|
console.log("科室:", index)
|
|
if(index == -1){
|
|
clearInterval(data_replay);
|
|
return
|
|
}
|
|
if(index > -1){
|
|
_this.setData({
|
|
select_keshi_index: index,
|
|
keshi_note: _this.data.keshi_columns[index].text
|
|
})
|
|
}
|
|
keshi_huixian = true;
|
|
}
|
|
|
|
//回显职称
|
|
if(_this.data.doctorauthiden_data_ready && _this.data.basicdoctortitle_data_ready){
|
|
let index = _this.data.zhicheng_columns.findIndex(item => {
|
|
return item.value == _this.data.select_zhicheng_id
|
|
})
|
|
if(index == -1){
|
|
clearInterval(data_replay);
|
|
return
|
|
}
|
|
if(index > -1){
|
|
_this.setData({
|
|
select_zhicheng_index: index,
|
|
zhicheng_note: _this.data.zhicheng_columns[index].text
|
|
})
|
|
}
|
|
zhicheng_huixian = true;
|
|
}
|
|
|
|
//回显省市区
|
|
if(_this.data.doctorauthiden_data_ready && _this.data.areaprovince_data_ready){
|
|
|
|
let select_province_id = _this.data.select_province_id;
|
|
let select_city_id = _this.data.select_city_id;
|
|
let select_county_id = _this.data.select_county_id;
|
|
let select_yiyuan_id = _this.data.select_yiyuan_id;
|
|
|
|
api.getAreaCity({area_id: select_province_id}).then(response => {// 请求市区列表
|
|
let _index = _this.data.areaList.findIndex(item => item.value == select_province_id);
|
|
const list = _this.formatArea(response, _index, true);
|
|
const _city = "areaList[" + _index + "].children";
|
|
console.log("_city: ", _city);
|
|
_this.setData({
|
|
[_city]: list,
|
|
})
|
|
}).then(e =>{
|
|
api.getAreaCounty({area_id: select_city_id}).then(response => {// 请求市区列表
|
|
let _index = _this.data.areaList.findIndex(item => item.value == select_province_id);
|
|
console.log("getAreaCounty: ", _index)
|
|
let c_index = _this.data.areaList[_index].children.findIndex(item => item.value == select_city_id);
|
|
console.log("children: ", _index)
|
|
let p_index = _this.data.areaList[_index].children[c_index].index;
|
|
const list = _this.formatArea(response, _index, false);
|
|
const _county = "areaList[" + _index + "].children[" +p_index+ "].children";
|
|
_this.setData({
|
|
[_county]: list,
|
|
})
|
|
}).then(e => {
|
|
let params = {
|
|
province_id: _this.data.select_province_id,
|
|
city_id: _this.data.select_city_id,
|
|
county_id: _this.data.select_county_id,
|
|
}
|
|
api.getBasicHospital(params).then(response => {// 请求医院列表
|
|
_this.setData({
|
|
hospital_search_val: "",
|
|
yiyuan_columns: _this.formatYiYuan(response),
|
|
city_note: _this.data.hospital.province + "/" + _this.data.hospital.city + "/" + _this.data.hospital.county
|
|
})
|
|
|
|
setTimeout(() => {
|
|
let index = _this.data.yiyuan_columns.findIndex(item => {
|
|
return item.value == _this.data.select_yiyuan_id
|
|
})
|
|
_this.setData({
|
|
select_yiyuan_index: index,
|
|
yiyuan_note: _this.data.yiyuan_columns[index].text
|
|
})
|
|
}, 100);
|
|
|
|
|
|
}).catch(errors => {console.error(errors); })
|
|
}).catch(errors => {console.error(errors); })
|
|
}).catch(errors => {console.error(errors); })
|
|
|
|
area_huixian = true;
|
|
}
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
huixian_try_count = huixian_try_count + 1;
|
|
//都回显成功后,清除计时器
|
|
console.log("keshi_huixian: ", keshi_huixian)
|
|
console.log("zhicheng_huixian: ", zhicheng_huixian)
|
|
console.log("area_huixian: ", area_huixian)
|
|
if((keshi_huixian && zhicheng_huixian && area_huixian)){
|
|
console.log("clearInterval1111", data_replay);
|
|
clearInterval(data_replay);
|
|
}
|
|
if(huixian_try_count > 50){
|
|
console.log("clearInterva22222", data_replay);
|
|
clearInterval(data_replay);
|
|
}
|
|
console.log("计时器");
|
|
}, 500);
|
|
|
|
console.log("clearInterva3333", data_replay);
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
hospitalSearch(e){
|
|
console.log(e.detail)
|
|
},
|
|
hospitalSearchChange(e){
|
|
console.log(e.detail);
|
|
let params = {
|
|
hospital_name: e.detail.trim(),
|
|
province_id: this.data.select_province_id,
|
|
city_id: this.data.select_city_id,
|
|
county_id: this.data.select_county_id,
|
|
}
|
|
api.getBasicHospital(params).then(response => {// 请求医院列表】
|
|
this.setData({
|
|
yiyuan_columns: this.formatYiYuan(response),
|
|
yiyuan_show: true
|
|
})
|
|
}).catch(errors => {console.error(errors); })
|
|
},
|
|
onCityShow(e) {
|
|
console.log("onCityShow");
|
|
this.setData({ city_show: true });
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onCloseCity(e){
|
|
console.log("onCloseCity");
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onChangeCity(e) {
|
|
this.setData({
|
|
select_county_id: "",
|
|
select_yiyuan_id: "",
|
|
yiyuan_note: "请选择医院",
|
|
city_note: "请选择城市",
|
|
})
|
|
console.log("onChangeCity");
|
|
const { selectedOptions } = e.detail;
|
|
console.log(e.detail)
|
|
let area = selectedOptions[selectedOptions.length-1];
|
|
if(!area){
|
|
area = selectedOptions[selectedOptions.length-2];
|
|
}
|
|
const type = area.type;
|
|
const value = area.value;
|
|
const index = area.index;
|
|
const p_index = area.p_index;
|
|
if(type == 2){//省份
|
|
api.getAreaCity({area_id: value}).then(response => {// 请求市区列表
|
|
const list = this.formatArea(response, index, true);
|
|
const _city = "areaList[" + index + "].children";
|
|
this.setData({
|
|
[_city]: list,
|
|
select_province_id: value
|
|
})
|
|
}).catch(errors => {console.error(errors); })
|
|
}
|
|
if(type == 3){//市区
|
|
api.getAreaCounty({area_id: value}).then(response => {// 请求市区列表
|
|
const list = this.formatArea(response, index, false);
|
|
const _county = "areaList[" + p_index + "].children[" +index+ "].children";
|
|
this.setData({
|
|
[_county]: list,
|
|
select_city_id: value
|
|
})
|
|
}).catch(errors => {console.error(errors); })
|
|
}
|
|
|
|
console.log("type: " + type);
|
|
if(type == 4){//区县
|
|
this.setData({
|
|
select_county_id: value,
|
|
});
|
|
|
|
let params = {
|
|
province_id: this.data.select_province_id,
|
|
city_id: this.data.select_city_id,
|
|
county_id: this.data.select_county_id,
|
|
}
|
|
api.getBasicHospital(params).then(response => {// 请求医院列表】
|
|
this.setData({
|
|
hospital_search_val: "",
|
|
yiyuan_columns: this.formatYiYuan(response),
|
|
city_show: false,
|
|
city_note: this.getCityNote(selectedOptions),
|
|
yiyuan_show: true
|
|
})
|
|
}).catch(errors => {console.error(errors); })
|
|
|
|
}else{
|
|
this.setData({
|
|
city_show: true
|
|
})
|
|
}
|
|
},
|
|
getCityNote(selectedOptions){
|
|
let txt = [];
|
|
selectedOptions.forEach(item => {
|
|
if(item){
|
|
txt.push(item.label);
|
|
}
|
|
})
|
|
return txt.join("/");
|
|
},
|
|
formatArea(response, p_index, has_children){
|
|
var list = []
|
|
let index = 0;
|
|
response.data.forEach(data => {
|
|
let area = {};
|
|
area.index = index++;
|
|
area.p_index = p_index;
|
|
area.type = data.area_type;
|
|
area.label = data.area_name;
|
|
area.value = data.area_id;
|
|
if(has_children){
|
|
area.children = [];
|
|
}
|
|
list.push(area)
|
|
});
|
|
return list;
|
|
},
|
|
formatYiYuan(response){
|
|
let list = [];
|
|
response.data.forEach(data => {
|
|
let hospital = {};
|
|
hospital.text = data.hospital_name;
|
|
hospital.value = data.hospital_id;
|
|
list.push(hospital)
|
|
});
|
|
return list;
|
|
},
|
|
formatKeShi(response){
|
|
let list = [];
|
|
response.data.forEach(item => {
|
|
let data = {};
|
|
data.text = item.department_custom_name;
|
|
data.value = item.department_custom_id;
|
|
list.push(data)
|
|
});
|
|
return list;
|
|
},
|
|
formatZhiCheng(response){
|
|
let list = [];
|
|
response.data.forEach(item => {
|
|
let data = {};
|
|
data.text = item.doctor_title_name;
|
|
data.value = item.doctor_title_id;
|
|
list.push(data)
|
|
});
|
|
return list;
|
|
},
|
|
formatZhuanChang(response){
|
|
let list = [];
|
|
response.data.forEach(item => {
|
|
let data = {};
|
|
data.text = item.expertise_name;
|
|
data.value = item.expertise_id;
|
|
list.push(data)
|
|
});
|
|
return list;
|
|
},
|
|
onYiYuanShow(e) {
|
|
console.log("onYiYuanShow");
|
|
let select_province_id = this.data.select_province_id;
|
|
let select_city_id = this.data.select_city_id;
|
|
let select_county_id = this.data.select_county_id;
|
|
if(select_province_id && select_city_id && select_county_id){
|
|
this.setData({ yiyuan_show: true });
|
|
}else{
|
|
wx.showToast({
|
|
title: '请先选择城市',
|
|
icon: "error"
|
|
})
|
|
}
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onYiYuanClose(e) {
|
|
console.log("onYiYuanClose");
|
|
this.setData({ yiyuan_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onYiYuanCancel(event) {
|
|
console.log("onYiYuanCancel");
|
|
const { picker, value, index } = event.detail;
|
|
Toast(`当前值:${value}, 当前索引:${index}`);
|
|
this.setData({yiyuan_show: false});
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onYiYuanConfirm(event) {
|
|
console.log("onYiYuanConfirm");
|
|
const { picker, value, index } = event.detail;
|
|
console.log(event.detail);
|
|
if(value.value){
|
|
this.setData({
|
|
yiyuan_show: false,
|
|
select_yiyuan_id: `${value.value}`,
|
|
yiyuan_note: `${value.text}`
|
|
});
|
|
}else{
|
|
wx.showToast({
|
|
title: '请先选择医院',
|
|
icon: "error"
|
|
})
|
|
}
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onYiYuanChange(event) {
|
|
console.log("onYiYuanChange");
|
|
const { picker, value, index } = event.detail;
|
|
Toast(`当前值:${value}, 当前索引:${index}`);
|
|
},
|
|
onKeshiShow(e) {
|
|
console.log("onKeshiShow");
|
|
this.setData({ keshi_show: true });
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onKeshiCancel(event) {
|
|
console.log("onKeshiCancel");
|
|
const { picker, value, index } = event.detail;
|
|
Toast(`当前值:${value}, 当前索引:${index}`);
|
|
this.setData({ keshi_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onKeshiConfirm(event) {
|
|
console.log("onKeshiConfirm");
|
|
const { picker, value, index } = event.detail;
|
|
Toast(`当前值:${value}, 当前索引:${index}`);
|
|
this.setData({
|
|
keshi_show: false,
|
|
select_keshi_id: `${value.value}`,
|
|
keshi_note: `${value.text}`,
|
|
});
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onKeshiChange(event) {
|
|
console.log("onKeshiChange");
|
|
},
|
|
onKeshiClose(e) {
|
|
console.log("onKeshiClose");
|
|
this.setData({ keshi_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onZhiChengShow(e) {
|
|
console.log("onKeshiShow");
|
|
this.setData({ zhicheng_show: true });
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onZhiChengCancel(event) {
|
|
console.log("onKeshiCancel");
|
|
const { picker, value, index } = event.detail;
|
|
Toast(`当前值:${value}, 当前索引:${index}`);
|
|
this.setData({ zhicheng_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onZhiChengConfirm(event) {
|
|
console.log("onZhiChengConfirm");
|
|
const { picker, value, index } = event.detail;
|
|
Toast(`当前值:${value}, 当前索引:${index}`);
|
|
this.setData({
|
|
zhicheng_show: false,
|
|
select_zhicheng_id: `${value.value}`,
|
|
zhicheng_note: `${value.text}`,
|
|
});
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onZhiChengChange(event) {
|
|
console.log("onZhiChengChange");
|
|
},
|
|
onZhiChengClose(e) {
|
|
console.log("onZhiChengClose");
|
|
this.setData({ zhicheng_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onZhuanChangShow(){
|
|
this.setData({ zhuanchang_show: true });
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onZhuanChangVisibleChange(e) {
|
|
console.log("onZhuanChangVisibleChange:", e.detail.visible)
|
|
this.setData({
|
|
zhuanchang_show: e.detail.visible,
|
|
});
|
|
if(e.detail.visible == false){
|
|
this.triggerEvent('hidePageMeta');
|
|
}
|
|
},
|
|
onshowJianJieNote(e){
|
|
e.detail // 自定义组件触发事件时提供的 detail 对象
|
|
console.log("onshowJianJieNote");
|
|
this.setData({jianjie_show: true});
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onJianjieClose(e){
|
|
e.detail // 自定义组件触发事件时提供的 detail 对象
|
|
console.log("onshowJianJieNote");
|
|
this.setData({jianjie_show: false});
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onshowShanChangNote(e){
|
|
e.detail // 自定义组件触发事件时提供的 detail 对象
|
|
console.log("onshowShanChangNote");
|
|
this.setData({shanchang_show: true});
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onshowShanChangNoteClose(e){
|
|
e.detail // 自定义组件触发事件时提供的 detail 对象
|
|
console.log("onshowShanChangNote");
|
|
this.setData({shanchang_show: false});
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onshowZhiYeNote(e){
|
|
e.detail // 自定义组件触发事件时提供的 detail 对象
|
|
console.log("onshowZhiYeNote");
|
|
this.setData({ zhiye_show: true });
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onZhiYeClose(){
|
|
console.log("onZhiYeClose");
|
|
this.setData({ zhiye_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onshowZiGeNote(e){
|
|
e.detail // 自定义组件触发事件时提供的 detail 对象
|
|
console.log("onshowZiGeNote");
|
|
this.setData({ zige_show: true });
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onZiGeClose(){
|
|
console.log("onZhiYeClose");
|
|
this.setData({ zige_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onshowZhiChengImgNote(e){
|
|
e.detail // 自定义组件触发事件时提供的 detail 对象
|
|
console.log("onshowZhiChengNote");
|
|
this.setData({ zhicheng_img_show: true });
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
onZhiChengImgClose(){
|
|
console.log("onZhiChengClose");
|
|
this.setData({ zhicheng_img_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
onCustomKeshiChange(){
|
|
this.setData({
|
|
department_custom_name_reason: ""
|
|
})
|
|
},
|
|
getTextAreaVal(e){
|
|
console.log("myindex: ", e);//textarea_jianjie
|
|
let textarea_name = e.currentTarget.dataset.textarea_name;
|
|
if(textarea_name == "textarea_jianjie"){
|
|
this.setData({
|
|
brief_introduction_reason: ""
|
|
})
|
|
}
|
|
if(textarea_name == "textarea_shanchang"){
|
|
this.setData({
|
|
be_good_at_reason: ""
|
|
})
|
|
}
|
|
let reason_name = textarea_name+"_reason";
|
|
this.setData({
|
|
[textarea_name]: e.detail.value,
|
|
})
|
|
},
|
|
select_zhuanchang(e){
|
|
console.log(e);
|
|
let count = 0
|
|
this.data.zhuanchang_columns.forEach(item => {
|
|
if(item.is_selected == 1){
|
|
count = count + 1;
|
|
}
|
|
})
|
|
|
|
console.log("countcountcountcount: ",count)
|
|
if(count >= 10 && e.currentTarget.dataset.is_selected==0){
|
|
wx.showToast({
|
|
title: '最多10个专长',
|
|
icon: "error"
|
|
})
|
|
}else{
|
|
let is_selected = e.currentTarget.dataset.is_selected;
|
|
let index = e.currentTarget.dataset.index;
|
|
let data = "zhuanchang_columns["+index+"].is_selected";
|
|
this.setData({[data]: is_selected==1?0:1})
|
|
}
|
|
|
|
this.checkZhuanchangNote()
|
|
},
|
|
checkZhuanchangNote(){
|
|
let count = 0
|
|
this.data.zhuanchang_columns.forEach(item => {
|
|
if(item.is_selected == 1){
|
|
count = count + 1;
|
|
}
|
|
})
|
|
|
|
if(count > 0){
|
|
this.setData({
|
|
zhuanchang_note: ""
|
|
})
|
|
}
|
|
if(count == 0){
|
|
this.setData({
|
|
zhuanchang_note: "请选择专长"
|
|
})
|
|
}
|
|
},
|
|
zhuanchangConfirm(e){
|
|
this.setData({ zhuanchang_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
zhuanchangConcle(e){
|
|
this.setData({ zhuanchang_show: false });
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
handleUpdateIntroduction(){
|
|
let {avatar,textarea_jianjie,textarea_shanchang}=this.data;
|
|
let doctor_expertise= this.data.zhuanchang_columns.filter(e => e.is_selected == 1 ).map(e => e.expertise_id);
|
|
if(!avatar){wx.showToast({title: '请上传头像',icon: "error"});return}
|
|
if(doctor_expertise.length == 0){wx.showToast({title: '请选择专长',icon: "error"});return}
|
|
if(!textarea_jianjie){wx.showToast({title: '请输入简介',icon: "error"});return}
|
|
if(!textarea_shanchang){wx.showToast({title: '请输入擅长',icon: "error"});return}
|
|
|
|
api.updateIntroduction({
|
|
avatar,
|
|
brief_introduction:textarea_jianjie,
|
|
be_good_at:textarea_shanchang,
|
|
doctor_expertise
|
|
}).then(response=>{
|
|
wx.showToast({
|
|
title: '提交成功',
|
|
icon: "success"
|
|
})
|
|
this.setData({
|
|
introduction_status:2,
|
|
iden_auth_status_txt: "资料已提交,审核中"
|
|
})
|
|
})
|
|
},
|
|
addDoctorAuthIden(e){
|
|
console.log("addDoctorAuthIden addDoctorAuthIden")
|
|
|
|
let from = e.currentTarget.dataset.from;
|
|
console.log("from: ", from);
|
|
let params = {};
|
|
|
|
params.source = from=="myinfo"?2:1;
|
|
if(!this.data.is_avatar){wx.showToast({title: '请上传头像',icon: "error"});return}
|
|
params.avatar = this.data.avatar;
|
|
if(!this.data.select_county_id){wx.showToast({title: '请选择城市',icon: "error"});return}
|
|
if(!this.data.select_yiyuan_id){wx.showToast({title: '请选择医院',icon: "error"});return}
|
|
params.hospital_id = this.data.select_yiyuan_id;//医院id
|
|
if(!this.data.select_keshi_id){wx.showToast({title: '请选择科室',icon: "error"});return}
|
|
params.department_custom_id = this.data.select_keshi_id;//科室id
|
|
// if(!this.data.custom_keshi){wx.showToast({title: '请输入科室',icon: "error"});return}
|
|
params.department_custom_name = this.data.custom_keshi;//自定义科室名称
|
|
if(!this.data.office_phone){wx.showToast({title: '请输入科室电话',icon: "error"});return}
|
|
params.department_custom_mobile = this.data.office_phone;//科室电话
|
|
params.doctor_expertise = this.data.zhuanchang_columns.filter(e => e.is_selected == 1 ).map(e => e.expertise_id);//专长
|
|
if(params.doctor_expertise.length == 0){wx.showToast({title: '请选择专长',icon: "error"});return}
|
|
if(!this.data.select_zhicheng_id){wx.showToast({title: '请选择职称',icon: "error"});return}
|
|
params.doctor_title = this.data.select_zhicheng_id;//职称id
|
|
if(!this.data.textarea_jianjie){wx.showToast({title: '请输入简介',icon: "error"});return}
|
|
params.brief_introduction = this.data.textarea_jianjie;//简介
|
|
if(!this.data.textarea_shanchang){wx.showToast({title: '请输入擅长',icon: "error"});return}
|
|
params.be_good_at = this.data.textarea_shanchang;//擅长
|
|
|
|
if(from == "doctorauthiden"){//只有在医师身份认证模块才去修改证件
|
|
if(this.data.zhiye_file_list.length == 0){wx.showToast({title: '请上传医师执业证',icon: "error"});return}
|
|
if(this.data.zhiye_file_list.length < 2){wx.showToast({title: '医师执业证至少2张',icon: "error"});return}
|
|
params.license_cert = this.data.zhiye_file_list.map(e => e.url);//医师执业证
|
|
if(this.data.zige_file_list.length == 0){wx.showToast({title: '请上传医师资格证',icon: "error"});return}
|
|
if(this.data.zige_file_list.length<2){wx.showToast({title: '医师资格证至少2张',icon: "error"});return}
|
|
params.qualification_cert = this.data.zige_file_list.map(e => e.url);//医生资格证
|
|
if(this.data.zhicheng_file_list.length == 0){wx.showToast({title: '请上传职称证',icon: "error"});return}
|
|
params.work_cert = this.data.zhicheng_file_list.map(e => e.url);//工作证,职称证
|
|
}
|
|
console.log(params);
|
|
|
|
let _this = this;
|
|
api.postDoctorAuthIden(params).then(response => {
|
|
console.log(response);
|
|
wx.showToast({
|
|
title: '提交成功',
|
|
icon: "success"
|
|
})
|
|
_this.setData({
|
|
iden_auth_status_txt: "资料已提交,审核中",
|
|
iden_auth_disabled: true,
|
|
iden_auth_status: 2,
|
|
})
|
|
}).catch(errors => {console.error(errors);})
|
|
},
|
|
onOfficePhoneChange(){
|
|
this.setData({
|
|
department_custom_mobile_reason: ""
|
|
})
|
|
},
|
|
doUploadFile(event) {
|
|
console.log("index douploadFIle: ", event);
|
|
const scene = event.currentTarget.dataset.scene;
|
|
const field_name = event.currentTarget.dataset.field_name;
|
|
const file_multiple = event.currentTarget.dataset.file_multiple;//是否为多张图
|
|
console.log("scene: ", scene);
|
|
console.log("field_name: ", field_name);
|
|
console.log("file_multiple: ", file_multiple);
|
|
let _this = this;
|
|
api.getOssSign({user_type:2,scene:scene}).then(response => {
|
|
console.log(response);
|
|
const { file } = event.detail;
|
|
|
|
file.forEach(item => {
|
|
console.log("file: ", item);
|
|
const filename = FileUtil.getFileName(item);
|
|
const host = response.data.host;
|
|
const signature = response.data.signature;
|
|
const ossAccessKeyId = response.data.accessid;
|
|
const policy = response.data.policy;
|
|
const key = response.data.dir+filename;
|
|
const filePath = item.url; // 待上传文件的文件路径。
|
|
wx.uploadFile({
|
|
url: host, // 开发者服务器的URL。
|
|
filePath: filePath,
|
|
name: 'file', // 必须填file。
|
|
formData: {
|
|
key,
|
|
policy,
|
|
OSSAccessKeyId: ossAccessKeyId,
|
|
signature,
|
|
},
|
|
success: (res) => {
|
|
console.log("upload: ", res);
|
|
let reason_name = field_name + "_reason";//错误原因置空
|
|
if (res.statusCode === 204) {
|
|
if(scene == 1){
|
|
this.setData({
|
|
is_avatar: true
|
|
})
|
|
}
|
|
wx.showToast({title: '上传成功'})
|
|
if(file_multiple == "true"){//多张图
|
|
let img = {}
|
|
img.url = host+"/"+key;
|
|
img.isImg = true;
|
|
|
|
let img_list = _this.data[field_name];
|
|
console.log("img_list: ", img_list);
|
|
img_list.push(img);
|
|
console.log("img_list: ", img_list);
|
|
|
|
reason_name = field_name=='zhiye_file_list'?'license_cert_reason':field_name=='zige_file_list'?'qualification_cert_reason':'work_cert_reason';
|
|
this.setData({
|
|
[field_name]: img_list,
|
|
[reason_name]: ""
|
|
});
|
|
}else{
|
|
this.setData({
|
|
[field_name]: host+"/"+key,
|
|
[reason_name]: ""
|
|
});
|
|
}
|
|
}
|
|
},
|
|
fail: err => {
|
|
console.log(err);
|
|
}
|
|
});
|
|
})
|
|
|
|
}).catch(errors => {
|
|
console.error(errors);
|
|
})
|
|
},
|
|
doUploadPhoto(event) {
|
|
const { file } = event.detail;
|
|
this.setData({
|
|
photoEvent: event,
|
|
img_cropper_src: file.url,
|
|
show_cropper: true
|
|
})
|
|
this.loadimage()
|
|
},
|
|
OSSUpload(fileurl){
|
|
let event = this.data.photoEvent
|
|
console.log("index douploadFIle: ", event);
|
|
const scene = event.currentTarget.dataset.scene;
|
|
const field_name = event.currentTarget.dataset.field_name;
|
|
const file_multiple = event.currentTarget.dataset.file_multiple;//是否为多张图
|
|
console.log("scene: ", scene);
|
|
console.log("field_name: ", field_name);
|
|
console.log("file_multiple: ", file_multiple);
|
|
let _this = this;
|
|
api.getOssSign({user_type:2,scene:scene}).then(response => {
|
|
console.log(response);
|
|
const { file } = event.detail;
|
|
console.log("file: ", file);
|
|
const filename = FileUtil.getFileName(file);
|
|
const host = response.data.host;
|
|
const signature = response.data.signature;
|
|
const ossAccessKeyId = response.data.accessid;
|
|
const policy = response.data.policy;
|
|
const key = response.data.dir+filename;
|
|
const filePath = fileurl; // 待上传文件的文件路径。
|
|
wx.uploadFile({
|
|
url: host, // 开发者服务器的URL。
|
|
filePath: filePath,
|
|
name: 'file', // 必须填file。
|
|
formData: {
|
|
key,
|
|
policy,
|
|
OSSAccessKeyId: ossAccessKeyId,
|
|
signature,
|
|
},
|
|
success: (res) => {
|
|
console.log("upload: ", res);
|
|
let reason_name = field_name + "_reason";//错误原因置空
|
|
if (res.statusCode === 204) {
|
|
if(scene == 1){
|
|
this.setData({
|
|
is_avatar: true
|
|
})
|
|
}
|
|
wx.showToast({title: '上传成功'})
|
|
if(file_multiple == "true"){//多张图
|
|
let img = {}
|
|
img.url = host+"/"+key;
|
|
img.isImg = true;
|
|
|
|
let img_list = _this.data[field_name];
|
|
console.log("img_list: ", img_list);
|
|
img_list.push(img);
|
|
console.log("img_list: ", img_list);
|
|
|
|
reason_name = field_name=='zhiye_file_list'?'license_cert_reason':field_name=='zige_file_list'?'qualification_cert_reason':'work_cert_reason';
|
|
this.setData({
|
|
[field_name]: img_list,
|
|
[reason_name]: ""
|
|
});
|
|
}else{
|
|
this.setData({
|
|
[field_name]: host+"/"+key,
|
|
[reason_name]: ""
|
|
});
|
|
}
|
|
}
|
|
},
|
|
fail: err => {
|
|
console.log(err);
|
|
}
|
|
});
|
|
}).catch(errors => {
|
|
console.error(errors);
|
|
})
|
|
},
|
|
doDeleteFile(event){
|
|
console.log(event);
|
|
let url = event.detail.file.url;
|
|
let file_name = event.currentTarget.dataset.field_name;
|
|
let img_list = this.data[file_name].filter(item => item.url != url);
|
|
this.setData({
|
|
[file_name]: img_list
|
|
})
|
|
},
|
|
moveZhuanChang(){
|
|
|
|
},
|
|
cropperload(e) {
|
|
console.log("cropper初始化完成");
|
|
},
|
|
loadimage(e) {
|
|
this.cropper = this.selectComponent("#image-cropper");
|
|
//重置图片角度、缩放、位置
|
|
this.cropper.imgReset();
|
|
this.triggerEvent('showPageMeta');
|
|
},
|
|
clickcut(e) {
|
|
console.log(e);
|
|
// //点击裁剪框阅览图片
|
|
// wx.previewImage({
|
|
// current: e.detail.url, // 当前显示图片的http链接
|
|
// urls: [e.detail.url] // 需要预览的图片http链接列表
|
|
// })
|
|
|
|
this.OSSUpload(e.detail.url)
|
|
this.setData({
|
|
show_cropper: false
|
|
})
|
|
this.triggerEvent('hidePageMeta');
|
|
},
|
|
}
|
|
})
|