优化代码

This commit is contained in:
java110 2023-03-10 19:01:42 +08:00
parent 98f0376e3a
commit 3359892955
3 changed files with 93 additions and 3 deletions

View File

@ -1417,7 +1417,7 @@ table.table-mail tr td {
}
.note-editor {
z-index: 3000!important;
/* z-index: 3000!important; */
}

View File

@ -31,6 +31,29 @@
</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label text-right">
<vc:i18n name="员工头像" namespace="addExamineStaff"></vc:i18n>
</label>
<div class="col-sm-10">
<vc:create path="frame/uploadImageUrl" callBackListener="addExamineStaff" callBackFunction="notifyUploadImage" imageCount="1" namespace="addExamineStaff">
</vc:create>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label text-right"><span><vc:i18n name='员工岗位' namespace='addExamineStaff'></vc:i18n></span></label>
<div class="col-sm-6">
<input v-model="addExamineStaffInfo.post" type="text" :placeholder="vc.i18n('必填,请填写员工岗位','addExamineStaff')" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label text-right"><span><vc:i18n name='员工简介' namespace='addExamineStaff'></vc:i18n></span></label>
<div class="col-sm-6">
<div class="no-padding">
<div class="summernote"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">

View File

@ -7,6 +7,9 @@
orgName: '',
staffName: '',
staffId: '',
post: '',
introduction: '',
headerImg: '',
projects: [],
projectIds: []
@ -14,9 +17,16 @@
},
_initMethod: function() {
$that._listExamineProjects();
$that._initTextArea();
},
_initEvent: function() {
vc.on("addExamineStaff", "notifyUploadImage", function(_param) {
if (_param.length > 0) {
vc.component.addExamineStaffInfo.headerImg = _param[0].fileId;
} else {
vc.component.addExamineStaffInfo.headerImg = ''
}
});
},
methods: {
@ -92,7 +102,64 @@
},
_goBack: function() {
vc.goBack();
},
_initTextArea: function() {
var $summernote = $('.summernote').summernote({
lang: 'zh-CN',
height: 300,
placeholder: '必填,请输入员工简介',
callbacks: {
onImageUpload: function(files, editor, $editable) {
$that.sendFile($summernote, files);
},
onChange: function(contents, $editable) {
vc.component.addExamineStaffInfo.introduction = contents;
}
},
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'picture']],
['view', ['fullscreen', 'codeview']],
],
});
},
sendFile: function($summernote, files) {
console.log('上传图片', files);
var param = new FormData();
param.append("uploadFile", files[0]);
param.append('communityId', vc.getCurrentCommunity().communityId);
vc.http.upload(
'uploadFile',
'uploadImage',
param, {
emulateJSON: true,
//添加请求头
headers: {
"Content-Type": "multipart/form-data"
}
},
function(json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
var data = JSON.parse(json);
//关闭model
//$summernote.summernote('insertImage', "/callComponent/download/getFile/file?fileId=" + data.fileId + "&communityId=" + vc.getCurrentCommunity().communityId);
$summernote.summernote('insertImage', data.url);
return;
}
vc.toast(json);
},
function(errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
}
});