Parcourir la source

fix:5.4.3 页面更新

msgroup il y a 10 mois
Parent
commit
fc16dc03ee

+ 10 - 10
src/main/webapp/WEB-INF/manager/cms/category/form.ftl

@@ -433,7 +433,9 @@
                     // 文章管理的内容模型id
                     mdiyModelId: '',
                     //栏目字典
-                    categoryFlag: []
+                    categoryFlag: [],
+                    // 拓展字段类型
+                    isChild: 'cms'
                 },
                 categoryTypeOptions: [{
                     "value": "1",
@@ -607,8 +609,8 @@
 
                         data.categoryImg = JSON.stringify(data.categoryImg);
                         data.categoryIco = JSON.stringify(data.categoryIco);
-                        ms.http.post(url, data).then(function (data) {
-                            if (data.result) {
+                        ms.http.post(url, data).then(function (res) {
+                            if (res.result) {
 
                                 that.$notify({
                                     title: '成功',
@@ -622,7 +624,7 @@
                             } else {
                                 that.$notify({
                                     title: '失败',
-                                    message: data.msg,
+                                    message: res.msg,
                                     type: 'warning'
                                 });
                             }
@@ -672,7 +674,7 @@
                         if (res.data.categoryImg) {
                             res.data.categoryImg = JSON.parse(res.data.categoryImg);
                             res.data.categoryImg.forEach(function (value) {
-                                value.url = ms.base + value.path;
+                                value.url = ms.base + value.url;
                             });
                         } else {
                             res.data.categoryImg = [];
@@ -680,7 +682,7 @@
                         if (res.data.categoryIco) {
                             res.data.categoryIco = JSON.parse(res.data.categoryIco);
                             res.data.categoryIco.forEach(function (value) {
-                                value.url = ms.base + value.path;
+                                value.url = ms.base + value.url;
                             });
                         } else {
                             res.data.categoryIco = [];
@@ -743,9 +745,8 @@
             categoryImgSuccess: function (response, file, fileList) {
                 if (response.result) {
                     this.form.categoryImg.push({
-                        url: file.url,
+                        url: response.data,
                         name: file.name,
-                        path: response.data,
                         uid: file.uid
                     });
                 } else {
@@ -782,9 +783,8 @@
             categoryIcoSuccess: function (response, file, fileList) {
                 if (response.result) {
                     this.form.categoryIco.push({
-                        url: file.url,
+                        url: response.data,
                         name: file.name,
-                        path: response.data,
                         uid: file.uid
                     });
                 } else {

+ 15 - 16
src/main/webapp/WEB-INF/manager/cms/content/form.ftl

@@ -166,6 +166,7 @@
                                     </el-form-item>
                                 </el-col>
                             </el-row>
+
                             <el-row
                                     :gutter=0
                                     justify="start" align="top">
@@ -209,6 +210,7 @@
                                                 :action="ms.manager+'/file/upload.do'"
                                                 :on-remove="contentImghandleRemove"
                                                 :style="{width:''}"
+                                                :multiple=true
                                                 :limit="10"
                                                 :on-exceed="contentImghandleExceed"
                                                 :disabled="false"
@@ -222,7 +224,7 @@
                                             <template #tip>
                                                 <div class="ms-form-tip">
                                                     标签:<a href="http://doc.mingsoft.net/mcms/biao-qian/wen-zhang-lie-biao-ms-arclist.html" target="_blank">${'{@ms:file field.litpic/}'}</a><br/>
-                                                    最多可上传10张图片,文章缩略图,支持jpg格式;多图情况下,{@ms:file field.litpic/}会只取第一张缩略图,其他用法参考文档arclist标签
+                                                    一次可上传多张图片,最多可上传10张图片,文章缩略图,支持jpg格式;多图情况下,{@ms:file field.litpic/}会只取第一张缩略图,其他用法参考文档arclist标签
                                                 </div>
                                             </template>
                                         </el-upload>
@@ -284,7 +286,7 @@
                             </el-form-item>
                         </el-form>
                         <div :id="'model'+index" v-else>
-                            <ms-mdiy-form v-if="modelName!=null" ref="modelForm" type="model" :model-name="modelName" :model-id="modelId" :id="form.id"></ms-mdiy-form>
+                            <ms-mdiy-form v-if="modelId!=null" ref="modelForm" type="model" :model-id="modelId" :id="form.id"></ms-mdiy-form>
                         </div>
                     </el-tab-pane>
                 </el-tabs>
@@ -310,7 +312,6 @@
                 activeName: 'form',
                 //自定义模型实例
                 model: undefined,
-                modelName:null,
                 modelId:null,
                 editableTabs: [{
                     title: '文章编辑',
@@ -363,6 +364,7 @@
                     //文章外链接
                     contentOutLink: '',
                     contentDatetime: ms.util.date.fmt(Date.now(),"yyyy-MM-dd hh:mm:ss"),
+                    id:"",
                 },
                 contentTypeOptions: [],
                 contentTagsOptions: [],
@@ -391,7 +393,7 @@
                     }],
                     // 文章外链接
                     contentOutLink: [{
-                        "pattern":/(((http|ftp|https):\/\/)?)([a-zA-Z0-9.-])\/[a-zA-Z0-9&%.\/-~-]*/,
+                        "pattern":'^((https|http|ftp|rtsp|mms){0,1}(:\/\/){0,1})(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$',
                         "message":"文章外链接格式不匹配"},{"min":0,"max":200,"message":"文章外链接长度必须为0-200"}],
                     // 文章标签
                     contentTags: [{
@@ -429,7 +431,6 @@
                 var that = this; //自定义模型需要验证
 
 
-
                 let formValid = false;
 
                 if(that.$refs.modelForm && that.$refs.modelForm.length > 0) {
@@ -480,6 +481,8 @@
                         data.contentImg = JSON.stringify(data.contentImg);
                         ms.http.post(url, data).then(function (res) {
                             if (res.result) {
+                                // 接受保存的文章id 避免新增单篇栏目保存不刷新时 再次修改造成多次保存
+                                that.form.id = res.data.id
                                 if(that.$refs.modelForm && that.$refs.modelForm.length > 0) {
                                     that.$refs.modelForm[0].$refs.form.form.linkId = res.data.id;
                                     that.$refs.modelForm[0].getForm().save(function (resModel) {
@@ -600,11 +603,10 @@
 
                 //如果存在自定义模型
                 if(_category.length == 1 && _category[0].mdiyModelId) {
+                    that.editableTabs.push({title: '加载中...',name: 'custom-name'});
                     ms.http.get(ms.manager + "/mdiy/model/get.do", {id: _category[0].mdiyModelId}).then(function (res) {
                         if (res.result && res.data) {
-                            that.editableTabs.push({title: '加载中...',name: 'custom-name'});
                             that.modelId = res.data.id;
-                            that.modelName = res.data.modelName;
                             that.editableTabs[1].title = res.data.modelName
                         }
                     });
@@ -636,7 +638,7 @@
                         if (res.data.contentImg && res.data.contentImg != '') {
                             res.data.contentImg = JSON.parse(res.data.contentImg);
                             res.data.contentImg.forEach(function (value) {
-                                value.url = ms.base + value.path;
+                                value.url = ms.base + value.url;
                             });
                         } else {
                             res.data.contentImg = [];
@@ -674,7 +676,7 @@
                             if (res.data.contentImg) {
                                 res.data.contentImg = JSON.parse(res.data.contentImg);
                                 res.data.contentImg.forEach(function (value) {
-                                    value.url = ms.base + value.path;
+                                    value.url = ms.base + value.url;
                                 });
                             } else {
                                 res.data.contentImg = [];
@@ -731,7 +733,7 @@
             //获取contentType数据源
             contentTypeOptionsGet: function () {
                 var that = this;
-                ms.http.get(ms.base + '/mdiy/dict/list.do', {
+                ms.http.get(ms.manager +'/mdiy/dict/list.do', {
                     dictType: '文章属性',
                     pageSize: 99999
                 }).then(function (data) {
@@ -746,7 +748,7 @@
             //获取contentTag数据源
             contentTagsOptionsGet: function () {
                 var that = this;
-                ms.http.get(ms.base + '/mdiy/dict/list.do', {
+                ms.http.get(ms.manager  + '/mdiy/dict/list.do', {
                     dictType: '文章标签',
                     pageSize: 99999
                 }).then(function (data) {
@@ -760,9 +762,8 @@
             contentImgSuccess: function (response, file, fileList) {
                 if(response.result){
                     this.form.contentImg.push({
-                        url: file.url,
+                        url: response.data,
                         name: file.name,
-                        path: response.data,
                         uid: file.uid
                     });
 
@@ -806,9 +807,6 @@
                     type: 'warning'
                 });
             },
-            contentImgHandLePreview:function (file) {
-                window.open(file.url)
-            },
             //只有在渲染完栏目数据之后才会初始化
             init: function () {
 				var that = this;
@@ -852,6 +850,7 @@
                     clipboard.destroy();
                 });
             },
+
         },
         created: function () {
             this.contentCategoryIdOptionsGet();

+ 10 - 3
src/main/webapp/WEB-INF/manager/cms/content/list.ftl

@@ -134,9 +134,16 @@
     var contentList = Vue.defineComponent({
         template: '#content-main',
         props:["categoryId","leaf"],
+        provide() {
+            return {
+                searchParent: this //筛选使用
+            };
+        },
         data: function () {
             return {
-                searchJson: [{
+
+                searchJson: [
+                   {
                     action: 'and',
                     field: 'content_title',
                     el: 'eq',
@@ -152,9 +159,9 @@
                     type: 'input'
                 }, {
                     action: 'and',
-                    field: 'category_id',
+                    field: 'ct.category_id',
                     el: 'eq',
-                    model: 'categoryId',
+                    model: 'contentCategoryId',
                     name: '所属栏目',
                     key: 'id',
                     title: 'categoryTitle',

+ 185 - 116
src/main/webapp/WEB-INF/manager/cms/generate/index.ftl

@@ -16,133 +16,165 @@
                 class="ms-alert-tip"
                 title="提示"
                 type="info">
-             如果需要使用自动静态化的功能,即文章发布后会自动进行更新,简单的可以采用MStore 的<a href='http://store.mingsoft.net/#/detail?id=290&type=plugin' target="_blank">自动静态化插件</a>,如果需要更好的静态化性能可以考虑选购企业级<a href="https://www.mingsoft.net/banben.html" target="_blank">版本</a>
+            如果需要使用自动静态化的功能,即文章发布后会自动进行更新,简单的可以采用MStore 的<a href='http://store.mingsoft.net/#/detail?id=290&type=plugin' target="_blank">自动静态化插件</a>,如果需要更好的静态化性能可以考虑选购企业级<a href="https://www.mingsoft.net/banben.html" target="_blank">版本</a>
         </el-alert>
 
 
-    <el-form ref="form" label-width="100px" size="default">
+        <el-form ref="form" label-width="100px" size="default" label-position="top">
 
-        <div class="class-2" >
-            <div class="class-3 panel" >
-                <div class="class-4" >
-                    <el-form-item label="主页模板" >
-                        <el-select v-model="template"
-                                   :filterable="true"
-                                   :clearable="false"
-                                   placeholder="请选择主页模板">
-                            <el-option v-for='item in templateOptions' :key="item" :value="item"
-                                       :label="item"></el-option>
-                        </el-select>
-                        <div class="ms-form-tip">
-                            一般选择<i>index.htm</i>模板
-                        </div>
-                    </el-form-item>
-                </div>
-                <div class="class-7" >
-                    <el-form-item label="主页位置">
-                        <el-input v-model="position"
-                                  :disabled="false"
-                                  :style="{width:  '100%'}"
-                                  :clearable="true"
-                                  placeholder="请输入主页位置">
-                        </el-input>
-                        <div class="ms-form-tip">
-                            一般为index.html或default.html,
-                            如果是<i>引导页面->首页</i>,可以手动调整主页模板与主页设置,先生成引导页,再生成首页。一般default.html为引导页面index.html为主页(需要服务器容器配置好对应默认页)。<br/>
-                            点击“预览主页”可跳转到网站首页进行预览网站首页<br/>
-                            不能选择有分页标签的页面生成,例如news-list.htm、search.htm<br/>
-                            如果下拉没有出现模板,请检查应用设置是否绑定了模板<br/>
-                        </div>
-                    </el-form-item>
-                </div>
-                <div class="class-10" >
-                    <el-form-item>
-                        <@shiro.hasPermission name="cms:generate:index">
-                            <el-button type="primary" @click="updataIndex" :loading="homeLoading">{{homeLoading?'更新中':'生成主页'}}</el-button>
-                        </@shiro.hasPermission>
+            <div class="class-2" >
+                <div class="class-3 panel" >
+                    <div class="class-4" >
+                        <el-form-item label="主页模板" >
+                            <el-select v-model="template"
+                                       :filterable="true"
+                                       :clearable="false"
+                                       placeholder="请选择主页模板">
+                                <el-option v-for='item in templateOptions' :key="item" :value="item"
+                                           :label="item"></el-option>
+                            </el-select>
+                            <div class="ms-form-tip">
+                                一般选择<i>index.htm</i>模板
+                            </div>
+                        </el-form-item>
+                    </div>
+                    <div class="class-7" >
+                        <el-form-item label="主页位置">
+                            <el-input v-model="position"
+                                      :disabled="false"
+                                      :style="{width:  '100%'}"
+                                      :clearable="true"
+                                      placeholder="请输入主页位置">
+                            </el-input>
+                            <div class="ms-form-tip">
+                                一般为index.html或default.html,
+                                如果是<i>引导页面->首页</i>,可以手动调整主页模板与主页设置,先生成引导页,再生成首页。一般default.html为引导页面index.html为主页(需要服务器容器配置好对应默认页)。<br/>
+                                点击“预览主页”可跳转到网站首页进行预览网站首页<br/>
+                                不能选择有分页标签的页面生成,例如news-list.htm、search.htm<br/>
+                                如果下拉没有出现模板,请检查应用设置是否绑定了模板<br/>
+                            </div>
+                        </el-form-item>
+                    </div>
+                    <div class="class-10" >
+                        <el-form-item>
+                            <@shiro.hasPermission name="cms:generate:index">
+                                <el-button type="primary" @click="updataIndex" :loading="homeLoading">{{homeLoading?'更新中':'生成主页'}}</el-button>
+                            </@shiro.hasPermission>
                             <el-button plain @click="viewIndex">预览主页</el-button>
-                    </el-form-item>
-                </div>
-            </div>
-            <div class="class-13 panel" >
-                <div class="class-14" >
-                    <el-form-item label="文章栏目">
-                        <el-tree-select
-                                v-model="contentSection"
-                                :data="treeList"
-                                :props="{value: 'id',label: 'categoryTitle',children: 'children'}"
-                                :render-after-expand="false"
-                                :check-strictly="true"
-                                :default-expand-all="true"
-                                placeholder="请选择文章栏目"
-                                filterable
-                        ></el-tree-select>
-                        <div class="ms-form-tip">
-                            生成指定栏目下的文章内容
-                        </div>
-                    </el-form-item>
-                </div>
-                <div class="class-17" >
-                    <el-form-item label="指定时间">
-                        <el-date-picker
-                                v-model="time"
-                                placeholder="请选择指定时间"
-                                start-placeholder=""
-                                en.class-3d-placeholder=""
-                                :readonly="false"
-                                :disabled="false"
-                                :editable="false"
-                                :clearable="false"
-                                format="YYYY-MM-DD"
-                                value-format="YYYY-MM-DD"
-                                :style="{width:'100%'}"
-                                type="date">
-                        </el-date-picker>
-                        <div class="ms-form-tip">
-                            根据内容的更新时间来生成,例如:2021-01-01,则生成21年01月01号以后更新过的文章,如果遇到内容没有生成或者内容样式没有更新可以调整时间
-                        </div>
-                    </el-form-item>
+                        </el-form-item>
+                    </div>
                 </div>
-                <div class="class-20" >
-                    <@shiro.hasPermission name="cms:generate:article">
-                        <el-form-item>
-                            <el-button type="primary" @click="updateArticle" :loading="articleLoading">{{articleLoading?'更新中':'生成文章'}}</el-button>
+
+
+
+
+                <div class="class-13 panel" >
+                    <div class="class-14" >
+                        <el-form-item label="文章栏目">
+                            <el-tree-select
+                                    v-model="contentSection"
+                                    :data="treeList"
+                                    :props="{value: 'id',label: 'categoryTitle',children: 'children'}"
+                                    :render-after-expand="false"
+                                    :check-strictly="true"
+                                    :default-expand-all="true"
+                                    placeholder="请选择文章栏目"
+                                    filterable
+                            ></el-tree-select>
+                            <div class="ms-form-tip">
+                                生成指定栏目下的文章内容
+                            </div>
                         </el-form-item>
-                    </@shiro.hasPermission>
+                    </div>
+                    <div class="class-17" >
+                        <el-form-item label="指定时间">
+                            <el-date-picker
+                                    v-model="time"
+                                    placeholder="请选择指定时间"
+                                    start-placeholder=""
+                                    en.class-3d-placeholder=""
+                                    :readonly="false"
+                                    :disabled="false"
+                                    :editable="false"
+                                    :clearable="false"
+                                    format="YYYY-MM-DD"
+                                    value-format="YYYY-MM-DD"
+                                    :style="{width:'100%'}"
+                                    type="date">
+                            </el-date-picker>
+                            <div class="ms-form-tip">
+                                根据内容的更新时间来生成,例如:2021-01-01,则生成21年01月01号以后更新过的文章,如果遇到内容没有生成或者内容样式没有更新可以调整时间
+                            </div>
+                        </el-form-item>
+                    </div>
+                    <div class="class-20" >
+                        <@shiro.hasPermission name="cms:generate:article">
+                            <el-form-item>
+                                <el-button type="primary" @click="updateArticle" :loading="articleLoading">{{articleLoading?'更新中':'生成文章'}}</el-button>
+                            </el-form-item>
+                        </@shiro.hasPermission>
 
-                </div>
-            </div>
-            <div class="class-23 panel" >
-                <div class="class-24" >
-                    <el-form-item label="生成栏目">
-                        <el-tree-select
-                                v-model="section"
-                                :data="treeList"
-                                :props="{value: 'id',label: 'categoryTitle',children: 'children'}"
-                                :render-after-expand="false"
-                                :check-strictly="true"
-                                :default-expand-all="true"
-                                placeholder="请选择文章栏目"
-                                filterable
-                        ></el-tree-select>
-                        <div class="ms-form-tip">
-                            生成<b>栏目类型</b>为列表的数据,例如:新闻列表、产品列表 <br>
-                            单篇栏目绑定模板后没有文章,也会生成对应html
-                        </div>
-                    </el-form-item>
+                    </div>
                 </div>
 
-                <div class="class-30" >
-                    <@shiro.hasPermission name="cms:generate:column">
-                    <el-form-item>
-                        <el-button type="primary" @click="updateColumn" :loading="columnLoading">{{columnLoading?'更新中':'生成栏目'}}</el-button>
-                    </el-form-item>
-                    </@shiro.hasPermission>
+                <div class="class-23 panel" >
+                    <div class="class-24" >
+                        <el-form-item label="生成栏目">
+                            <el-tree-select
+                                    v-model="section"
+                                    :data="treeList"
+                                    :props="{value: 'id',label: 'categoryTitle',children: 'children'}"
+                                    :render-after-expand="false"
+                                    :check-strictly="true"
+                                    :default-expand-all="true"
+                                    placeholder="请选择文章栏目"
+                                    filterable
+                            ></el-tree-select>
+                            <div class="ms-form-tip">
+                                生成<b>栏目类型</b>为列表的数据,例如:新闻列表、产品列表 <br>
+                                单篇栏目绑定模板后没有文章,也会生成对应html
+                            </div>
+                        </el-form-item>
+                    </div>
+
+                    <div class="class-30" >
+                        <@shiro.hasPermission name="cms:generate:column">
+                            <el-form-item>
+                                <el-button type="primary" @click="updateColumn" :loading="columnLoading">{{columnLoading?'更新中':'生成栏目'}}</el-button>
+                            </el-form-item>
+                        </@shiro.hasPermission>
 
+                    </div>
                 </div>
+
+                <div class="class-13 panel" >
+                    <div class="class-7" >
+                        <el-form-item label="删除页面">
+                            <el-input v-model="deletePath"
+                                      :disabled="false"
+                                      :style="{width:  '100%'}"
+                                      :clearable="true"
+                                      placeholder="请输入要删除的页面路径">
+                            </el-input>
+                            <div class="ms-form-tip">
+                                输入要删除的页面路径,复制域名后面的路径<br/>
+                                如: 页面http://localhost:8080/html/web/index.html,在输入框输入html/web/index.html<br/>
+                                如: 页面http://localhost:8080/web/index.html,在输入框输入/web/index.html,根据右侧提示信息填写开头 如html<br/>
+                                输入后点击删除页面即可<br/>
+                            </div>
+                        </el-form-item>
+                    </div>
+                    <div class="class-10" >
+                        <el-form-item>
+                            <@shiro.hasPermission name="cms:generate:del">
+                                <el-button type="primary" @click="del(deletePath)" :loading="homeLoading">{{homeLoading?'删除中':'删除页面'}}</el-button>
+                            </@shiro.hasPermission>
+                        </el-form-item>
+                    </div>
+                </div>
+
             </div>
-        </div>
-    </el-form>
+        </el-form>
     </el-main>
 </div>
 </body>
@@ -162,6 +194,7 @@
                 //主题模板
                 templateOptions: [],
                 position: 'index',
+                deletePath:"",
                 //位置
                 contentSection: '0',
                 //文章栏目
@@ -176,6 +209,42 @@
             }
         },
         methods: {
+            //删除
+            del: function (deletePath) {
+                var that = this;
+                if (!deletePath.trim()) {
+                    that.$notify({
+                        title: '失败',
+                        message: "请输入有效的页面路径",
+                        type: 'warning'
+                    });
+                    return;
+                }
+                that.$confirm('确定删除该文件吗?', '删除文件', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(function () {
+                    ms.http.post(ms.manager + "/cms/generate/delete.do", {
+                        deletePath:deletePath
+                    }).then(function (res) {
+                        if (res.result) {
+                            that.$notify({
+                                title: '成功',
+                                type: 'success',
+                                message: '删除成功!'
+                            }); //删除成功
+                        } else {
+                            that.$notify({
+                                title: '失败',
+                                message: res.msg,
+                                type: 'warning'
+                            });
+                        }
+                    });
+                })
+            },
+
             //更新主页
             updataIndex: function () {
                 var that = this;
@@ -188,7 +257,7 @@
                     return;
                 }
                 that.homeLoading = true;
-                ms.http.post(ms.manager + '/cms/generate//generateIndex.do', {
+                ms.http.post(ms.manager + '/cms/generate/generateIndex.do', {
                     url: that.template,
                     position: that.position
                 }).then(function (data) {
@@ -284,7 +353,7 @@
             },
             getTree: function () {
                 var that = this;
-                ms.http.get(ms.manager + "/cms/category/list.do", {
+                ms.http.get(ms.manager + "/cms/generate/list.do", {
                     pageSize: 9999
                 }).then(function (res) {
                     if (res.result) {