mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
优化代码
This commit is contained in:
parent
09d0c9b667
commit
3111c0e6bf
@ -13,31 +13,33 @@
|
||||
_initEvent:function(){
|
||||
vc.on('document','openDocument',function(_param){
|
||||
$('#documentModal').modal('show');
|
||||
$that._loadDocument();
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
listEnterCommunity: function (_page, _row) {
|
||||
_loadDocument:function () {
|
||||
let _componentCode = vc.getComponentCode();
|
||||
var param = {
|
||||
params: {
|
||||
_uid: '123mlkdinkldldijdhuudjdjkkd',
|
||||
page: _page,
|
||||
row: _row,
|
||||
communityName: $that.navCommunityInfo.searchCommunityName
|
||||
page:1,
|
||||
row:1,
|
||||
docCode:_componentCode
|
||||
}
|
||||
};
|
||||
vc.http.get('nav',
|
||||
'getCommunitys',
|
||||
|
||||
//发送get请求
|
||||
vc.http.apiGet('/sysDocument/querySysDocument',
|
||||
param,
|
||||
function (json, res) {
|
||||
if (res.status == 200) {
|
||||
let _data = JSON.parse(json);
|
||||
$that.navCommunityInfo.communityInfo = _data.communitys;
|
||||
vc.emit('chooseEnterCommunity','paginationPlus', 'init', {
|
||||
total: _data.records,
|
||||
currentPage: _page
|
||||
});
|
||||
let _sysDocumentManageInfo = JSON.parse(json);
|
||||
let _total = _sysDocumentManageInfo.total;
|
||||
|
||||
if(_total < 1){
|
||||
return;
|
||||
}
|
||||
}, function () {
|
||||
vc.component.documentInfo.title = _sysDocumentManageInfo.data[0].docTitle;
|
||||
vc.component.documentInfo.context = _sysDocumentManageInfo.data[0].docContent;
|
||||
}, function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">信息内容</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="ibox-content no-padding">
|
||||
<div class=" no-padding">
|
||||
<div class="summernote"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -12,8 +12,6 @@
|
||||
_initMethod: function () {
|
||||
vc.component._initSysDocumentInfo();
|
||||
|
||||
$that._loadAddSysDocumentType();
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('addSysDocumentView', 'openAddSysDocumentView', function () {
|
||||
@ -50,7 +48,7 @@
|
||||
errInfo: "文档编码超过200位"
|
||||
},
|
||||
],
|
||||
'addSysDocumentViewInfo.docContext': [
|
||||
'addSysDocumentViewInfo.docContent': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
@ -113,7 +111,7 @@
|
||||
vc.component.sendFile($summernote, files);
|
||||
},
|
||||
onChange: function (contents, $editable) {
|
||||
vc.component.addSysDocumentViewInfo.docContext = contents;
|
||||
vc.component.addSysDocumentViewInfo.docContent = contents;
|
||||
}
|
||||
},
|
||||
toolbar: [
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">信息内容</label>
|
||||
<div class="col-sm-10 ">
|
||||
<div class="ibox-content no-padding">
|
||||
<div class=" no-padding">
|
||||
<div class="eidtSummernote" ></div>
|
||||
</div>
|
||||
<!--<textarea v-model="addNoticeViewInfo.context" cols="3" type="text" placeholder="必填,请填写公告内容" class="form-control"></textarea>-->
|
||||
|
||||
@ -16,29 +16,17 @@
|
||||
_initEvent: function () {
|
||||
vc.on('editSysDocumentView', 'openEditSysDocumentModal', function (_params) {
|
||||
vc.component.refreshEditSysDocumentInfo();
|
||||
_params.context = filterXSS(_params.context);
|
||||
_params.docContent = filterXSS(_params.docContent);
|
||||
vc.component.editSysDocumentViewInfo = _params;
|
||||
|
||||
|
||||
});
|
||||
vc.on('editSysDocumentView', 'sysDocumentEditSysDocumentInfo', function (_params) {
|
||||
vc.component.refreshEditSysDocumentInfo();
|
||||
_params.context = filterXSS(_params.context);
|
||||
_params.docContent = filterXSS(_params.docContent);
|
||||
vc.copyObject(_params, vc.component.editSysDocumentViewInfo);
|
||||
$(".eidtSummernote").summernote('code', vc.component.editSysDocumentViewInfo.context);
|
||||
var photos = [];
|
||||
photos.push(vc.component.editSysDocumentViewInfo.headerImg);
|
||||
vc.emit('editSysDocumentView', 'uploadImage', 'notifyPhotos', photos);
|
||||
$(".eidtSummernote").summernote('code', vc.component.editSysDocumentViewInfo.docContent);
|
||||
});
|
||||
|
||||
vc.on("editSysDocumentView", "notifyUploadImage", function (_param) {
|
||||
if (!vc.isEmpty(_param) && _param.length > 0) {
|
||||
vc.component.editSysDocumentViewInfo.headerImg = _param[0];
|
||||
} else {
|
||||
vc.component.editSysDocumentViewInfo.headerImg = '';
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
methods: {
|
||||
editSysDocumentValidate: function () {
|
||||
@ -69,7 +57,7 @@
|
||||
errInfo: "文档编码超过200位"
|
||||
},
|
||||
],
|
||||
'editSysDocumentViewInfo.docContext': [
|
||||
'editSysDocumentViewInfo.docContent': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
@ -133,7 +121,7 @@
|
||||
vc.component.sendEditFile(files);
|
||||
},
|
||||
onChange: function (contents, $editable) {
|
||||
vc.component.editSysDocumentViewInfo.docContext = contents;
|
||||
vc.component.editSysDocumentViewInfo.docContent = contents;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -104,12 +104,12 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div v-bind:class="{no_display:sysDocumentManageInfo.componentShow != 'addsysDocumentView'}">
|
||||
<vc:create path="property/addSysDocumentView"></vc:create>
|
||||
<div v-bind:class="{no_display:sysDocumentManageInfo.componentShow != 'addSysDocumentView'}">
|
||||
<vc:create path="dev/addSysDocumentView"></vc:create>
|
||||
</div>
|
||||
<div v-bind:class="{no_display:sysDocumentManageInfo.componentShow != 'editsysDocumentView'}">
|
||||
<vc:create path="property/editSysDocumentView"></vc:create>
|
||||
<div v-bind:class="{no_display:sysDocumentManageInfo.componentShow != 'editSysDocumentView'}">
|
||||
<vc:create path="dev/editSysDocumentView"></vc:create>
|
||||
</div>
|
||||
<vc:create path="property/deleteSysDocument"></vc:create>
|
||||
<vc:create path="dev/deleteSysDocument"></vc:create>
|
||||
|
||||
</div>
|
||||
@ -45,14 +45,13 @@
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.get('sysDocumentManage',
|
||||
'list',
|
||||
vc.http.apiGet('/sysDocument/querySysDocument',
|
||||
param,
|
||||
function (json, res) {
|
||||
var _sysDocumentManageInfo = JSON.parse(json);
|
||||
vc.component.sysDocumentManageInfo.total = _sysDocumentManageInfo.total;
|
||||
vc.component.sysDocumentManageInfo.records = _sysDocumentManageInfo.records;
|
||||
vc.component.sysDocumentManageInfo.sysDocuments = _sysDocumentManageInfo.sysDocuments;
|
||||
vc.component.sysDocumentManageInfo.sysDocuments = _sysDocumentManageInfo.data;
|
||||
vc.emit('pagination', 'init', {
|
||||
total: vc.component.sysDocumentManageInfo.records,
|
||||
currentPage: _page
|
||||
|
||||
@ -1288,6 +1288,26 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
vcFramework.getComponentCode = function(){
|
||||
let _componentUrl = location.hash;
|
||||
|
||||
//判断是否为组件页面
|
||||
if (!vcFramework.notNull(_componentUrl)) {
|
||||
return "/";
|
||||
}
|
||||
|
||||
if (_componentUrl.lastIndexOf('#') < 0) {
|
||||
return "/";
|
||||
}
|
||||
|
||||
let endPos = _componentUrl.length;
|
||||
if (_componentUrl.indexOf('?') > -1) {
|
||||
endPos = _componentUrl.indexOf('?');
|
||||
}
|
||||
|
||||
_componentUrl = _componentUrl.substring(_componentUrl.lastIndexOf('#') + 1, endPos);
|
||||
return _componentUrl;
|
||||
}
|
||||
//获取url参数
|
||||
vcFramework.getParam = function (_key) {
|
||||
//返回当前 URL 的查询部分(问号 ? 之后的部分)。
|
||||
|
||||
Loading…
Reference in New Issue
Block a user