Commit 2d3b0160 authored by msgroup's avatar msgroup
Browse files

5.2.1发布

parent 6c759ad9
...@@ -589,7 +589,8 @@ ...@@ -589,7 +589,8 @@
}); });
}else { }else {
this.$notify({ this.$notify({
title: response.msg, title: '失败',
message: response.msg,
type: 'warning' type: 'warning'
}); });
} }
...@@ -598,7 +599,8 @@ ...@@ -598,7 +599,8 @@
//上传超过限制 //上传超过限制
categoryImghandleExceed: function (files, fileList) { categoryImghandleExceed: function (files, fileList) {
this.$notify({ this.$notify({
title: '当前最多上传1个文件', title: '失败',
message: '当前最多上传1个文件',
type: 'warning' type: 'warning'
}); });
}, },
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>文章</title> <title>文章1</title>
<#include "../../include/head-file.ftl"> <#include "../../include/head-file.ftl">
<script src="${base}/static/mdiy/index.js"></script>
</head> </head>
<body> <body>
<div id="form" v-cloak> <div id="form" v-cloak>
...@@ -272,7 +273,7 @@ ...@@ -272,7 +273,7 @@
scaleEnabled: true, scaleEnabled: true,
compressSide: 0, compressSide: 0,
maxImageSideLength: 1000, maxImageSideLength: 1000,
maximumWords: 2000, maximumWords: 100000,
initialFrameWidth: '100%', initialFrameWidth: '100%',
initialFrameHeight: 400, initialFrameHeight: 400,
serverUrl: ms.base + "/static/plugins/ueditor/1.4.3.1/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:\'" + ms.base + "\',fileUrlPrefix:\'" + ms.base + "\',imageUrlPrefix:\'" + ms.base + "\',imagePathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\',filePathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\',videoPathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\'%7D", serverUrl: ms.base + "/static/plugins/ueditor/1.4.3.1/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:\'" + ms.base + "\',fileUrlPrefix:\'" + ms.base + "\',imageUrlPrefix:\'" + ms.base + "\',imagePathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\',filePathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\',videoPathFormat:\'/upload/${appId}/cms/content/editor/%7Btime%7D\'%7D",
...@@ -440,50 +441,24 @@ ...@@ -440,50 +441,24 @@
changeModel: function () { changeModel: function () {
var that = this; var that = this;
that.editableTabs = [that.editableTabs[0]]; that.editableTabs = [that.editableTabs[0]];
this.removeModel();
if (this.currCategory) { if (this.currCategory) {
if (this.currCategory.mdiyModelId) { if (this.currCategory.mdiyModelId) {
ms.http.get(ms.manager + "/mdiy/model/get.do", { that.rederModel(this.currCategory.mdiyModelId)
id: this.currCategory.mdiyModelId
}).then(function (data) {
if (data.data && data.data.id) {
that.rederModel(data.data, JSON.parse(data.data.modelJson));
}
});
} }
} }
}, },
rederModel: function (modelEntity, data) { rederModel: function (modelId) {
var that = this; var that = this;
that.editableTabs.push({ that.editableTabs.push({
title: modelEntity.modelName, title: '',
name: 'custom-name' name: 'custom-name'
}); });
this.removeModel(); ms.mdiy.model.extend("model1", {id:modelId},{ linkId: that.form.id }).then(function(obj) {
that.$nextTick(function () { that.model = obj;
var div = document.createElement('div'); that.editableTabs[1].title = obj.modelName
div.id = 'c_model';
var model = document.getElementById('model1');
model.appendChild(div);
var s = document.createElement('script');
s.innerHTML = data.script;
var con = document.createElement('div');
con.id = 'custom-model';
con.innerHTML = data.html;
div.appendChild(s);
div.appendChild(con); //初始化自定义模型并传入关联参数
that.model = new custom_model({
data: {
title: modelEntity.modelName,
modelId: modelEntity.id,
form: {
linkId: that.form.id
}
}
});
}); });
}, },
getValue: function (data) { getValue: function (data) {
this.form.categoryId = data.id; this.form.categoryId = data.id;
...@@ -620,7 +595,8 @@ ...@@ -620,7 +595,8 @@
}); });
}else { }else {
this.$notify({ this.$notify({
title: response.msg, title: '失败',
message: response.msg,
type: 'warning' type: 'warning'
}); });
} }
...@@ -639,7 +615,8 @@ ...@@ -639,7 +615,8 @@
//上传超过限制 //上传超过限制
contentImghandleExceed: function (files, fileList) { contentImghandleExceed: function (files, fileList) {
this.$notify({ this.$notify({
title: '当前最多上传1个文件', title: '失败',
message: '当前最多上传1个文件',
type: 'warning' type: 'warning'
}); });
}, },
......
...@@ -302,7 +302,7 @@ ...@@ -302,7 +302,7 @@
ms.http.post(ms.manager + "/cms/content/list.do", form.sqlWhere ? Object.assign({}, { ms.http.post(ms.manager + "/cms/content/list.do", form.sqlWhere ? Object.assign({}, {
categoryType: '1', categoryType: '1',
sqlWhere: form.sqlWhere sqlWhere: form.sqlWhere
}, page) : Object.assign({}, that.form, page)).then(function (res) { }, page) : Object.assign({}, form, page)).then(function (res) {
if (that.loadState) { if (that.loadState) {
that.loading = false; that.loading = false;
} else { } else {
......
...@@ -166,7 +166,8 @@ ...@@ -166,7 +166,8 @@
var that = this; var that = this;
if (!that.position || that.position == '') { if (!that.position || that.position == '') {
this.$notify({ this.$notify({
title: '请输入主页位置!', title: '失败',
message: '请输入主页位置!',
type: 'warning' type: 'warning'
}); });
return; return;
...@@ -178,13 +179,14 @@ ...@@ -178,13 +179,14 @@
}).then(function (data) { }).then(function (data) {
if (data.result) { if (data.result) {
that.$notify({ that.$notify({
title: '更新成功!', title: '成功',
message: '更新成功!',
type: 'success' type: 'success'
}); });
} else { } else {
that.$notify({ that.$notify({
title: '更新失败', title: '失败',
message: "错误", message: "更新失败!",
type: 'error' type: 'error'
}); });
} }
...@@ -203,7 +205,8 @@ ...@@ -203,7 +205,8 @@
viewIndex: function () { viewIndex: function () {
if (!this.position || this.position == '') { if (!this.position || this.position == '') {
this.$notify({ this.$notify({
title: '请输入主页位置!', title: '失败',
message: '请输入主页位置!',
type: 'warning' type: 'warning'
}); });
return; return;
...@@ -217,7 +220,8 @@ ...@@ -217,7 +220,8 @@
ms.http.get(ms.manager + '/cms/generate/' + (that.section ? that.section : 0) + '/genernateColumn.do').then(function (data) { ms.http.get(ms.manager + '/cms/generate/' + (that.section ? that.section : 0) + '/genernateColumn.do').then(function (data) {
if (data.result) { if (data.result) {
that.$notify({ that.$notify({
title: '更新成功!', title: '成功',
message: '更新成功!',
type: 'success' type: 'success'
}); });
}else { }else {
...@@ -247,7 +251,8 @@ ...@@ -247,7 +251,8 @@
}).then(function (data) { }).then(function (data) {
if (data.result) { if (data.result) {
that.$notify({ that.$notify({
title: '更新成功!', title: '成功',
message:'更新成功!',
type: 'success' type: 'success'
}); });
}else { }else {
......
/** /**
* 封装http请求 * 封装http请求
*/ */
(function() { (function () {
axios.defaults.timeout = 1000 * 60; axios.defaults.timeout = 1000 * 60;
axios.defaults.baseURL = ''; axios.defaults.baseURL = '';
//http request 拦截器 //http request 拦截器
axios.interceptors.request.use( axios.interceptors.request.use(
function (config) {
function(config) {
config.headers = { config.headers = {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
...@@ -23,23 +22,58 @@ ...@@ -23,23 +22,58 @@
} }
return config; return config;
}, },
function(error) { function (error) {
return Promise.reject(err); return Promise.reject(error);
} }
); );
//http response 拦截器 //http response 拦截器
axios.interceptors.response.use( axios.interceptors.response.use(
function(response) { function (response) {
//登录失效
if (response.data.bizCode == "401" && ms.isLoginRedirect) {
window.parent.location.href = ms.base + "/" + ms.login + "?backurl=" + encodeURIComponent(window.parent.location.href);
return;
}
return response; return response;
}, },
function(error) { function (error) {
if (error.response) {
let msg;
if (error.response.status == 401) {
msg = "登录失败";
} else if (error.response.status == 400) {
msg = "客户端错误";
} else if (error.response.status == 403) {
msg = "您的权限不足";
} else if (error.response.status == 404) {
msg = "请求不存在";
} else if (error.response.status == 423) {
msg = "账号被锁定!";
} else if (error.response.status == 500) {
msg = "服务器异常";
} else if (error.response.status == 501) {
msg = "您的操作被取消或不允许提交";
} else if (error.response.status == 423) {
msg = "服务器正在开小差....";
}
if(error.response.data && error.response.data.msg) {
msg = error.response.data.msg;
}
if (msg) {
var tempVue = document.createElement('div');
tempVue.id = "tempVue";
document.body.appendChild(tempVue)
new Vue({el: '#tempVue',}).$notify.error({
title: '错误',
message: msg,
type: 'warning'
});
if (error.response.status == 401) {
window.location.reload();
}
document.body.removeChild(tempVue);
}
}
return Promise.reject(error) return Promise.reject(error)
} }
) )
...@@ -52,7 +86,7 @@ ...@@ -52,7 +86,7 @@
headers: conf.headers == undefined ? null : conf.headers, headers: conf.headers == undefined ? null : conf.headers,
}); });
_axios.interceptors.request.use( _axios.interceptors.request.use(
function(config) { function (config) {
if (config.method === 'post' && config.headers["Content-Type"] === "application/x-www-form-urlencoded") { if (config.method === 'post' && config.headers["Content-Type"] === "application/x-www-form-urlencoded") {
config.data = Qs.stringify(config.data, { config.data = Qs.stringify(config.data, {
allowDots: true allowDots: true
...@@ -60,8 +94,8 @@ ...@@ -60,8 +94,8 @@
} }
return config; return config;
}, },
function(error) { function (error) {
return Promise.reject(err); return Promise.reject(error);
} }
); );
return _axios; return _axios;
...@@ -70,7 +104,6 @@ ...@@ -70,7 +104,6 @@
} }
/** /**
* 封装get方法 * 封装get方法
* @param url * @param url
...@@ -82,14 +115,14 @@ ...@@ -82,14 +115,14 @@
if (params == undefined) { if (params == undefined) {
params = {} params = {}
} }
return new Promise(function(resolve, reject) { return new Promise(function (resolve, reject) {
ajax().get(url, { ajax().get(url, {
params: params params: params
}) })
.then(function(response) { .then(function (response) {
resolve(response.data); resolve(response.data);
}) })
.catch(function(err) { .catch(function (err) {
reject(err) reject(err)
}) })
}) })
...@@ -109,11 +142,11 @@ ...@@ -109,11 +142,11 @@
data = {} data = {}
} }
return new Promise(function(resolve, reject) { return new Promise(function (resolve, reject) {
ajax(conf).post(url, data, conf) ajax(conf).post(url, data, conf)
.then(function(response) { .then(function (response) {
resolve(response.data); resolve(response.data);
}, function(err) { }, function (err) {
reject(err) reject(err)
}) })
}) })
...@@ -131,11 +164,11 @@ ...@@ -131,11 +164,11 @@
if (data == undefined) { if (data == undefined) {
data = {} data = {}
} }
return new Promise(function(resolve, reject) { return new Promise(function (resolve, reject) {
ajax(conf).patch(url, data, conf) ajax(conf).patch(url, data, conf)
.then(function(response) { .then(function (response) {
resolve(response); resolve(response);
}, function(err) { }, function (err) {
reject(err) reject(err)
}) })
}) })
...@@ -152,22 +185,69 @@ ...@@ -152,22 +185,69 @@
if (data == undefined) { if (data == undefined) {
data = {} data = {}
} }
return new Promise(function(resolve, reject) { return new Promise(function (resolve, reject) {
ajax(conf).put(url, data, conf) ajax(conf).put(url, data, conf)
.then(function(response) { .then(function (response) {
resolve(response.data); resolve(response.data);
}, function(err) { }, function (err) {
reject(err) reject(err)
}) })
}) })
} }
/**
* 下载资源
* @param url
* @param data
* @returns {Promise}
*/
function download(url, data) {
if (data == undefined) {
data = {}
}
return new Promise(function (resolve, reject) {
axios({
method: 'post',
// 请求地址
url: url,
// 参数
data: data,
// 表明返回服务器返回的数据类型
responseType: 'blob',
headers: {Accept: 'application/vnd.openxmlformats-officedocument'}
}).then((res) => { // 处理返回的文件流
const content = res.data
const blob = new Blob([content])
const fileName = res.headers["filename"];
if ('download' in document.createElement('a')) { // 非IE下载
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
} else { // IE10+下载
navigator.msSaveBlob(blob, fileName)
}
resolve(res);
}, function (err) {
reject(err)
})
})
}
var http = { var http = {
get: get, get: get,
post: post, post: post,
put: put, put: put,
patch: patch patch: patch,
download: download
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment