|
@@ -45,7 +45,6 @@ var articleEdit = new Vue({
|
|
|
if (!newVal.trim()) {
|
|
|
return this.chooseLabels = [];
|
|
|
}
|
|
|
-
|
|
|
if (newVal === oldVal) return;
|
|
|
this.chooseLabels = newVal.split(',');
|
|
|
}
|
|
@@ -55,7 +54,6 @@ var articleEdit = new Vue({
|
|
|
},
|
|
|
mounted: function mounted() {
|
|
|
this.NODE_ENV_BASE_URL = $('#coreServer').val(); // console.log(this.NODE_ENV_BASE_URL);
|
|
|
-
|
|
|
$('.navLayout').find('.navList').removeClass("on").find('.con').hide().find('a').removeClass("on");
|
|
|
$('.navLayout').find('.navList').eq(2).addClass("on").find('.con').show().find('a').eq(0).addClass("on");
|
|
|
this.initEditor();
|
|
@@ -64,15 +62,14 @@ var articleEdit = new Vue({
|
|
|
// 销毁编辑器
|
|
|
this.editor.destroy();
|
|
|
this.editor = null;
|
|
|
+ localStorage.removeItem('articleId');
|
|
|
},
|
|
|
methods: {
|
|
|
// 页面初始化
|
|
|
init: function init() {
|
|
|
var articleId = localStorage.getItem('articleId') || 0;
|
|
|
- localStorage.removeItem('articleId');
|
|
|
this.formData.articleId = articleId;
|
|
|
this.fetchArticleCatagory(); // 文章id就是修改文章
|
|
|
-
|
|
|
this.fetchFormList();
|
|
|
},
|
|
|
// 获取标签列表和分类列表
|
|
@@ -156,29 +153,25 @@ var articleEdit = new Vue({
|
|
|
},
|
|
|
// 保存 提交表单
|
|
|
handleSave: function handleSave() {
|
|
|
- var _this2 = this;
|
|
|
-
|
|
|
+ var _this = this;
|
|
|
this.formData.articleContent = this.editor.txt.html();
|
|
|
this.handleFormData(); // console.log(this.formData);
|
|
|
-
|
|
|
this.validAll(this.formData).then(function (valid) {
|
|
|
console.log(valid);
|
|
|
-
|
|
|
- _this2.save();
|
|
|
+ _this.save();
|
|
|
}).catch(function (err) {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
// 保存接口
|
|
|
save: function save() {
|
|
|
+ var _this = this;
|
|
|
this.formData.shopId = this.shopId;
|
|
|
SupplierApi.ArticleSubmitSave(this.formData, function (res) {
|
|
|
if (res.code === 0) {
|
|
|
CAIMEI.dialog('保存成功');
|
|
|
- localStorage.setItem('refreshType', '1'); // 通知文章列表需要刷新
|
|
|
-
|
|
|
setTimeout(function () {
|
|
|
- window.location.href = '/supplier/article/list.html';
|
|
|
+ _this.handleBack();
|
|
|
}, 2000);
|
|
|
} else {
|
|
|
CAIMEI.Alert(res.msg, '确定', false);
|
|
@@ -210,9 +203,12 @@ var articleEdit = new Vue({
|
|
|
});
|
|
|
return obj;
|
|
|
},
|
|
|
+ // 返回文章列表页面
|
|
|
handleBack: function handleBack() {
|
|
|
- // window.open('/supplier/article/list.html')
|
|
|
+ localStorage.removeItem('articleId');
|
|
|
+ window.open('/supplier/article/list.html', 'supplier-article-list');
|
|
|
window.close();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|