You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

411 lines
23 KiB

{extend name="public/container"}
{block name='head_top'}
<style>
.layui-form-item .special-label i{display: inline-block;width: 18px;height: 18px;font-size: 18px;color: #fff;}
.layui-form-item .label-box p{line-height: inherit;}
.m-t-5{margin-top:5px;}
#app .layui-barrage-box{margin-bottom: 10px;margin-top: 10px;margin-left: 10px;border: 1px solid #0092DC;border-radius: 5px;cursor: pointer;position: relative;}
#app .layui-barrage-box.border-color{border-color: #0bb20c;}
#app .layui-barrage-box .del-text{position: absolute;top: 0;left: 0;background-color: rgba(0,0,0,0.5);color: #ffffff;width: 92%;text-align: center;}
#app .layui-barrage-box p{padding:5px 5px; }
#app .layui-empty-text{text-align: center;font-size: 18px;}
#app .layui-empty-text p{padding: 10px 10px;}
.edui-default .edui-for-image .edui-icon {background-position: -380px 0px;}
.layui-form-item .special-label {width: 50px;float: left;height: 30px;line-height: 38px;margin-left: 10px;margin-top: 5px;border-radius: 5px;background-color: #0092DC;text-align: center;}
.layui-form-item .special-label i {display: inline-block;width: 18px;height: 18px;font-size: 18px;color: #fff;}
.layui-form-item .label-box {border: 1px solid;border-radius: 10px;position: relative;padding: 10px;height: 30px;color: #fff;background-color: #393D49;text-align: center;cursor: pointer;display: inline-block;line-height: 10px;}
.layui-form-item .label-box p {line-height: inherit;}
</style>
<script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/third-party/zeroclipboard/ZeroClipboard.js"></script>
<script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/ueditor.all.min.js"></script>
<script src="{__PLUG_PATH}reg-verify.js"></script>
{/block}
{block name="content"}
<div class="layui-fluid" id="app" v-cloak>
<div class="layui-card">
<!-- <div class="layui-card-header">{{id ? '编辑讲师':'添加讲师'}}</div> -->
<div class="layui-card-body">
<form action="" class="layui-form">
<div class="layui-form-item">
<div class="layui-form-item required">
<label class="layui-form-label">法人名称:</label>
<div class="layui-input-inline">
<input type="text" name="lecturer_name" v-model.trim="formData.lecturer_name" required autocomplete="off" placeholder="请输入法人名称" maxlength="8" class="layui-input">
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">法人身份证号:</label>
<div class="layui-input-inline">
<input type="text" name="card_id" v-model.trim="formData.card_id" required autocomplete="off" placeholder="请输入法人身份证号" maxlength="18" class="layui-input">
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">统一社会信用代码:</label>
<div class="layui-input-inline">
<input type="text" name="credit_code" v-model.trim="formData.credit_code" required autocomplete="off" placeholder="请输入统一社会信用代码" class="layui-input">
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">营业期限:</label>
<div class="layui-input-inline">
<input type="text" name="business_term" v-model.trim="formData.business_term" required autocomplete="off" placeholder="营业期限:长期输入长期即可" class="layui-input">
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">身份证正面:</label>
<div class="layui-input-block">
<div class="upload-image-box" v-if="formData.card_straight" >
<img :src="formData.card_straight" alt="">
<div class="mask" style="display: block">
<p>
<i class="fa fa-eye" @click="look(formData.card_straight)"></i>
<i class="fa fa-trash-o" @click="delect('card_straight')"></i>
</p>
</div>
</div>
<div class="upload-image" v-show="!formData.card_straight" @click="upload('card_straight')">
<div class="fiexd"><i class="fa fa-plus"></i></div>
<p>选择图片</p>
</div>
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">身份证徽面:</label>
<div class="layui-input-block">
<div class="upload-image-box" v-if="formData.card_side" >
<img :src="formData.card_side" alt="">
<div class="mask" style="display: block">
<p>
<i class="fa fa-eye" @click="look(formData.card_side)"></i>
<i class="fa fa-trash-o" @click="delect('card_side')"></i>
</p>
</div>
</div>
<div class="upload-image" v-show="!formData.card_side" @click="upload('card_side')">
<div class="fiexd"><i class="fa fa-plus"></i></div>
<p>选择图片</p>
</div>
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">邮箱:</label>
<div class="layui-input-inline">
<input type="text" name="emial" v-model.trim="formData.emial" required autocomplete="off" placeholder="请输入邮箱" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">教育领域:</label>
<div class="layui-input-block" style="width:190px;">
<select name="cert_id" lay-search="" lay-filter="cert_id" v-model="formData.cert_id">
<option v-for="(items,idx) in select_list" :key="items.id" :value="items.id">{{items.title}}</option>
</select>
</div>
</div>
<div class="layui-form-item" :class="item.is_required == 1 ? 'required' : ''" v-for="(item,index) in qualifications_list" :key="index">
<label class="layui-form-label">{{item.event_name}}</label>
<div class="layui-input-inline" v-if="item.event_type == 1">
<input type="text" name="lecturer_name" v-model.trim="item.event_value" autocomplete="off" :placeholder="'请输入'+item.event_name" class="layui-input">
</div>
<div class="layui-input-inline" style="width: 380px;" v-if="item.event_type == 4">
<input type="text" v-model.trim="item.event_value" class="layui-input" autocomplete="off" :id="'date'+index" :placeholder="'请输入'+item.event_name + ':长期输入长期即可'">
</div>
<div class="layui-input-inline" v-if="item.event_type == 3">
<select :name="'event_value_id'+index" lay-search="" :lay-filter="'event_value_id'+index" v-model="item.event_value">
<option v-for="(items,idx) in item.eventValue" :key="idx" :value="idx">{{items}}</option>
</select>
</div>
<div class="layui-input-block" v-if="item.event_type == 2">
<div class="upload-image-box" v-if="item.event_value" >
<img :src="item.event_value" alt="">
<div class="mask" style="display: block">
<p>
<i class="fa fa-eye" @click="look(item.event_value)"></i>
<i class="fa fa-trash-o" @click="delect('event_value',index)"></i>
</p>
</div>
</div>
<div class="upload-image" v-if="!item.event_value" @click="upload('event_value',0,index)">
<div class="fiexd"><i class="fa fa-plus"></i></div>
<p>选择图片</p>
</div>
</div>
</div>
<div v-if="formData.label.length" class="layui-form-item">
<div class="layui-input-block">
<button v-for="item in formData.label" :key="item" type="button" class="layui-btn layui-btn-normal layui-btn-sm" @click="delLabel(item)">{{item}}</button>
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">头像:(200*200</label>
<div class="layui-input-block">
<div class="upload-image-box" v-if="formData.lecturer_head" >
<img :src="formData.lecturer_head" alt="">
<div class="mask" style="display: block">
<p>
<i class="fa fa-eye" @click="look(formData.lecturer_head)"></i>
<i class="fa fa-trash-o" @click="delect('lecturer_head')"></i>
</p>
</div>
</div>
<div class="upload-image" v-show="!formData.lecturer_head" @click="upload('lecturer_head')">
<div class="fiexd"><i class="fa fa-plus"></i></div>
<p>选择图片</p>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">手机:</label>
<div class="layui-input-inline">
<input type="text" name="phone" v-model.trim="formData.phone" required autocomplete="off" maxlength="11" placeholder="请输入手机号" class="layui-input">
</div>
</div>
<div class="layui-form-item submit">
<label class="layui-form-label">排序:</label>
<div class="layui-input-inline">
<input type="number" name="sort" v-model="formData.sort" min="0" max="9999" class="layui-input" v-sort>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态:</label>
<div class="layui-input-block">
<input type="radio" name="is_show" value="1" title="显示" v-model="formData.is_show" lay-filter="is_show" >
<input type="radio" name="is_show" value="0" title="隐藏" v-model="formData.is_show" lay-filter="is_show">
</div>
</div>
<div class="layui-form-item submit">
<div class="layui-input-block">
<button class="layui-btn layui-btn-normal" type="button" @click="save">{{id ? '立即修改':'立即提交'}}</button>
<button class="layui-btn layui-btn-primary clone" type="button" @click="clone_form">取消</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="{__ADMIN_PATH}js/layuiList.js"></script>
{/block}
{block name='script'}
<script>
var id={$id},lecturer=<?=isset($lecturer) ? $lecturer : []?>;
var all={$all};
var qualifications_list={$qualifications_list};
var cert_id = {$cert_id};
require(['vue','helper','zh-cn','request','plupload','aliyun-oss','OssUpload'],function(Vue,$h) {
new Vue({
el: "#app",
directives: {
sort: {
bind: function (el, binding, vnode) {
var vm = vnode.context;
el.addEventListener('change', function () {
if (!this.value || this.value < 0) {
vm.formData.sort = 0;
} else if (this.value > 9999) {
vm.formData.sort = 9999;
} else {
vm.formData.sort = parseInt(this.value);
}
});
}
}
},
data: {
formData:{
cert_id:cert_id,
lecturer_name:lecturer.lecturer_name || '',
lecturer_head: lecturer.lecturer_head || '',
label: lecturer.label || [],
phone: lecturer.phone || '',
explain: lecturer.explain || '',
introduction: lecturer.introduction || '',
sort:Number(lecturer.sort) || 0,
is_show:lecturer.is_show || 1,
emial:lecturer.emial ||'',
business_license:lecturer.business_license ||'',
corporate_name:lecturer.corporate_name ||'',
credit_code:lecturer.credit_code ||"",
business_term:lecturer.business_term ||'',
card_straight:lecturer.card_straight ||'',
card_side:lecturer.card_side ||'',
card_id:lecturer.card_id ||""
},
label: '',
select_list:all,
qualifications_list:qualifications_list || [],
event_index:0
},
methods:{
//查看图片
look: function (pic) {
parent.$eb.openImage(pic);
},
//上传图片
upload: function (key, count,index) {
this.event_index = index;
ossUpload.createFrame('请选择图片', {fodder: key, max_count: count === undefined ? 0 : count},{w:800,h:550});
},
// 删除领域
delLabel: function (label) {
this.formData.label.splice(this.formData.label.indexOf(label), 1);
},
// 添加领域
addLabrl: function () {
if (this.label) {
var length = this.formData.label.length;
for (var i = 0; i < length; i++) {
if (this.formData.label[i] == this.label) return layList.msg('请勿重复添加');
}
this.formData.label.push(this.label);
this.label = '';
}
},
clone_form: function () {
var that = this;
if (parseInt(id) == 0) {
parent.layer.closeAll();
}
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index); //再执行关闭
},
save:function () {
var that=this;
// that.formData.introduction = that.ue.getContent();
that.$nextTick(function () {
if (!that.formData.lecturer_name) return layList.msg('请法人名称');
for (var i = 0, len = this.qualifications_list.length; i < len; i++) {
if (!this.qualifications_list[i].is_required) {
continue;
}
switch (this.qualifications_list[i].event_type) {
case 1:
if (!this.qualifications_list[i].event_value) {
layList.msg('请输入'+this.qualifications_list[i].event_name);
return;
}
break;
case 2:
if (!this.qualifications_list[i].event_value) {
layList.msg('请上传'+this.qualifications_list[i].event_name);
return;
}
break;
}
}
// if (!that.formData.label.length) return layList.msg('请输入领域');
if (!that.formData.lecturer_head) return layList.msg('请上传机构头像');
if (!that.formData.phone) return layList.msg('请输入手机号');
if(!$reg.isPhone(that.formData.phone)){
return layList.msg('请输入正确的手机号');
}
that.formData.certificate = JSON.stringify(that.qualifications_list);
layList.loadFFF();
layList.basePost(layList.U({a: 'save_lecturer', q: {id: id}}), that.formData, function (res) {
layList.loadClear();
if (parseInt(id) == 0) {
layList.layer.confirm('添加成功,您要继续添加机构吗?', {
btn: ['继续添加', '立即提交']
}, function (index) {
layList.layer.close(index);
}, function (index) {
layList.layer.close(index);
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layList.msg('修改成功', function () {
parent.layer.closeAll();
})
}
}, function (res) {
layList.msg(res.msg);
layList.loadClear();
});
})
},
delect:function(key,index = 0){
var that=this;
if(key == 'event_value'){
that.qualifications_list[index].event_value = ""
}else{
that.formData[key]='';
}
},
changeIMG: function (key, value, multiple) {
if(key == "event_value"){
this.qualifications_list[this.event_index].event_value = value;
}else{
if (multiple) {
var that = this;
value.map(function (v) {
that.formData[key].push({pic: v, is_show: false});
});
this.$set(this.formData, key, this.formData[key]);
} else {
this.$set(this.formData, key, value);
}
}
},
},
mounted:function () {
var that=this;
window.changeIMG = that.changeIMG;
//选择图片插入到编辑器中
window.insertEditor = function(list,fodder){
that.ue.execCommand('insertimage', list);
};
// that.qualifications_list.forEach((item,index) => {
// if(item.event_type == 3){
// that.qualifications_list[index].eventValue = that.qualifications_list[index].event_value.split('#');
// }
// });
this.$nextTick(function () {
layList.form.render();
layui.config({
base: '{__ADMIN_PATH}mods/',
version: '1.0'
});
layui.use([
'layarea',
'laydate',
'form',
'element'
], function () {
var layarea = layui.layarea;
var laydate = layui.laydate;
var form = layui.form;
var layer = layui.layer;
var element = layui.element;
form.render();
});
});
layList.form.on('radio(is_show)',function (data) {
that.formData.is_show=data.value;
});
layList.form.on('select(cert_id)', function (data) {
that.formData.cert_id = Number(data.elem.value);
layList.baseGet(layList.Url({
a: 'select_list',
q: {id: that.formData.cert_id}
}), function (res) {
that.qualifications_list =res.data.qualifications;
});
});
// that.qualifications_list.forEach((item,index) => {
// if(item.event_type == 3){
// layList.form.on(`select(event_value_id${index})`,function (data) {
// that.qualifications_list[index].event_value = data.elem.value;
// });
// }
// });
}
})
})
</script>
{/block}