index.ftl 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. <html xmlns="http://www.w3.org/1999/html">
  2. <head>
  3. <title>静态化</title>
  4. <#include "../../include/head-file.ftl">
  5. <style>
  6. [v-cloak]{
  7. display: none;
  8. }
  9. </style>
  10. </head>
  11. <body class="custom-body">
  12. <div id="app" class="ms-index" v-cloak>
  13. <el-form ref="form" label-width="100px" size="mini">
  14. <div class="class-2" >
  15. <div class="class-3 panel" >
  16. <div class="class-4" >
  17. <el-form-item label="主页模板" >
  18. <el-select v-model="template"
  19. :filterable="true"
  20. :clearable="false"
  21. placeholder="请选择主页模板">
  22. <el-option v-for='item in templateOptions' :key="item" :value="item"
  23. :label="item"></el-option>
  24. </el-select>
  25. <div class="ms-form-tip">
  26. 一般选择<i>index.htm</i>模板
  27. </div>
  28. </el-form-item>
  29. </div>
  30. <div class="class-7" >
  31. <el-form-item label="主页位置">
  32. <el-input v-model="position"
  33. :disabled="false"
  34. :style="{width: '100%'}"
  35. :clearable="true"
  36. placeholder="请输入主页位置">
  37. </el-input>
  38. <div class="ms-form-tip">
  39. 一般为index.html或default.html,
  40. 如果是<i>引导页面->首页</i>,可以手动调整主页模板与主页设置,先生成引导页,再生成首页。一般default.html为引导页面index.html为主页(需要服务器容器配置好对应默认页)。<br/>
  41. 点击“预览主页”可跳转到网站首页进行预览网站首页<br/>
  42. 不能选择有分页标签的页面生成,例如news-list.htm、search.htm<br/>
  43. 如果下拉没有出现模板,请检查应用设置是否绑定了模板<br/>
  44. </div>
  45. </el-form-item>
  46. </div>
  47. <div class="class-10" >
  48. <el-form-item>
  49. <@shiro.hasPermission name="cms:generate:index">
  50. <el-button type="primary" @click="updataIndex" :loading="homeLoading">{{homeLoading?'更新中':'生成主页'}}</el-button>
  51. </@shiro.hasPermission>
  52. <el-button plain @click="viewIndex">预览主页</el-button>
  53. </el-form-item>
  54. </div>
  55. </div>
  56. <div class="class-13 panel" >
  57. <div class="class-14" >
  58. <el-form-item label="文章栏目">
  59. <ms-tree-select v-model:value="contentSection"
  60. :props="{value: 'id',label: 'categoryTitle',children: 'children'}"
  61. :options="treeList" :style="{width:'100%'}"
  62. placeholder="请选择文章栏目">
  63. </ms-tree-select>
  64. <div class="ms-form-tip">
  65. 生成指定栏目下的文章内容
  66. </div>
  67. </el-form-item>
  68. </div>
  69. <div class="class-17" >
  70. <el-form-item label="指定时间">
  71. <el-date-picker
  72. v-model="time"
  73. placeholder="请选择指定时间"
  74. start-placeholder=""
  75. en.class-3d-placeholder=""
  76. :readonly="false"
  77. :disabled="false"
  78. :editable="false"
  79. :clearable="false"
  80. format="yyyy-MM-dd"
  81. value-format="yyyy-MM-dd"
  82. :style="{width:'100%'}"
  83. type="date">
  84. </el-date-picker>
  85. <div class="ms-form-tip">
  86. 根据内容的更新时间来生成,例如:2021-01-01,则生成21年01月01号以后更新过的文章,如果遇到内容没有生成或者内容样式没有更新可以调整时间
  87. </div>
  88. </el-form-item>
  89. </div>
  90. <div class="class-20" >
  91. <@shiro.hasPermission name="cms:generate:article">
  92. <el-form-item>
  93. <el-button type="primary" @click="updateArticle" :loading="articleLoading">{{articleLoading?'更新中':'生成文章'}}</el-button>
  94. </el-form-item>
  95. </@shiro.hasPermission>
  96. </div>
  97. </div>
  98. <div class="class-23 panel" >
  99. <div class="class-24" >
  100. <el-form-item label="生成栏目">
  101. <ms-tree-select v-model:value="section"
  102. :props="{value: 'id',label: 'categoryTitle',children: 'children'}"
  103. :options="treeList" :style="{width:'100%'}"
  104. placeholder="请选择文章栏目">
  105. </ms-tree-select>
  106. <div class="ms-form-tip">
  107. 生成<b>栏目类型</b>为列表的数据,例如:新闻列表、产品列表
  108. </div>
  109. </el-form-item>
  110. </div>
  111. <div class="class-30" >
  112. <@shiro.hasPermission name="cms:generate:column">
  113. <el-form-item>
  114. <el-button type="primary" @click="updateColumn" :loading="columnLoading">{{columnLoading?'更新中':'生成栏目'}}</el-button>
  115. </el-form-item>
  116. </@shiro.hasPermission>
  117. </div>
  118. </div>
  119. </div>
  120. </el-form>
  121. </div>
  122. </body>
  123. </html>
  124. <script>
  125. "use strict";
  126. var app = new Vue({
  127. el: '#app',
  128. watch: {},
  129. data: function () {
  130. return {
  131. homeLoading: false,
  132. articleLoading: false,
  133. columnLoading: false,
  134. template: '',
  135. //主题模板
  136. templateOptions: [],
  137. position: 'index',
  138. //位置
  139. contentSection: '0',
  140. //文章栏目
  141. section: '0',
  142. //栏目
  143. time: ms.util.date.fmt(new Date(), "yyyy-MM-dd"),
  144. treeList: [{
  145. id: '0',
  146. categoryTitle: '顶级栏目',
  147. children: []
  148. }]
  149. }
  150. },
  151. methods: {
  152. //更新主页
  153. updataIndex: function () {
  154. var that = this;
  155. if (!that.position || that.position == '') {
  156. this.$notify({
  157. title: '失败',
  158. message: '请输入主页位置!',
  159. type: 'warning'
  160. });
  161. return;
  162. }
  163. that.homeLoading = true;
  164. ms.http.post(ms.manager + '/cms/generate//generateIndex.do', {
  165. url: that.template,
  166. position: that.position
  167. }).then(function (data) {
  168. if (data.result) {
  169. that.$notify({
  170. title: '成功',
  171. message: '更新成功!',
  172. type: 'success'
  173. });
  174. } else {
  175. that.$notify({
  176. title: '失败',
  177. message: data.msg,
  178. type: 'error'
  179. });
  180. }
  181. }).finally(function () {
  182. that.homeLoading = false;
  183. });
  184. },
  185. //预览主页
  186. viewIndex: function () {
  187. if (!this.position || this.position == '') {
  188. this.$notify({
  189. title: '失败',
  190. message: '请输入主页位置!',
  191. type: 'warning'
  192. });
  193. return;
  194. }
  195. window.open(ms.manager + "/cms/generate/" + this.position + "/viewIndex.do");
  196. },
  197. //更新栏目
  198. updateColumn: function () {
  199. var that = this;
  200. that.columnLoading = true;
  201. ms.http.get(ms.manager + '/cms/generate/' + (that.section ? that.section : 0) + '/generateColumn.do').then(function (data) {
  202. if (data.result) {
  203. that.$notify({
  204. title: '成功',
  205. message: '更新成功!',
  206. type: 'success'
  207. });
  208. }else {
  209. that.$notify({
  210. title: '生成失败',
  211. message:data.msg,
  212. type: 'error'
  213. });
  214. }
  215. }).finally(function () {
  216. that.columnLoading = false;
  217. });
  218. },
  219. //生成文章栏目
  220. updateArticle: function () {
  221. var that = this;
  222. that.articleLoading = true;
  223. ms.http.post(ms.manager + '/cms/generate/' + (that.contentSection ? that.contentSection : 0) + '/generateArticle.do', {
  224. dateTime: that.time
  225. }).then(function (data) {
  226. if (data.result) {
  227. that.$notify({
  228. title: '成功',
  229. message:'更新成功!',
  230. type: 'success'
  231. });
  232. }else {
  233. that.$notify({
  234. title: '生成失败!',
  235. message:data.msg,
  236. type: 'error'
  237. });
  238. }
  239. }).finally(function () {
  240. that.articleLoading = false;
  241. });
  242. },
  243. //获取主题模板数据源
  244. templateOptionsGet: function () {
  245. var that = this;
  246. ms.http.get(ms.manager + '/basic/template/queryTemplateFileForColumn.do', {
  247. pageSize: 99999
  248. }).then(function (data) {
  249. that.templateOptions = data.data; //寻找主页
  250. var template = that.templateOptions.find(function (x) {
  251. return x.indexOf("index") != -1 || x.indexOf("default") != -1;
  252. }); //没有就找其他的
  253. that.template = template || (that.templateOptions.length > 0 ? that.templateOptions[0] : "");
  254. });
  255. },
  256. getTree: function () {
  257. var that = this;
  258. ms.http.get(ms.manager + "/cms/category/list.do", {
  259. pageSize: 9999
  260. }).then(function (res) {
  261. if (res.result) {
  262. //res.data.rows.push({id:0,categoryId: null,categoryTitle:'顶级栏目管理'});
  263. that.treeList[0].children = ms.util.treeData(res.data.rows, 'id', 'categoryId', 'children');
  264. }
  265. });
  266. }
  267. },
  268. created: function () {
  269. this.getTree();
  270. this.templateOptionsGet();
  271. }
  272. });
  273. </script>
  274. <style>
  275. #app {
  276. background-color: white;
  277. }
  278. #app .panel {
  279. background-color: white;
  280. padding: 20px 40px 20px 40px;
  281. border: 1px solid #EBEEF5;
  282. }
  283. input{
  284. width: 100%!important;
  285. }
  286. .class-1
  287. {
  288. color:#333333;
  289. outline:none;
  290. outline-offset:-1px;
  291. max-width:100%;
  292. background-color:#FFFFFF;
  293. flex-direction:row;
  294. display:flex;
  295. animation-duration:1s;
  296. width:100%;
  297. background-repeat:no-repeat;
  298. padding: 14px;
  299. }
  300. .class-2
  301. {
  302. color:#333333;
  303. outline:none;
  304. outline-offset:-1px;
  305. height:500px;
  306. max-width:100%;
  307. flex-direction:row;
  308. display:flex;
  309. animation-duration:1s;
  310. width:100%;
  311. background-repeat:no-repeat;
  312. }
  313. .class-3
  314. {
  315. color:#333333;
  316. padding:20px;
  317. outline:none;
  318. outline-offset:-1px;
  319. min-height:250px;
  320. max-width:100%;
  321. background-color:#FFFFFF;
  322. flex-direction:column;
  323. display:flex;
  324. margin: 12px 6px 12px 12px;
  325. animation-duration:1s;
  326. width:100%;
  327. padding-left:20px;
  328. background-repeat:no-repeat;
  329. }
  330. .class-4
  331. {
  332. color:#333333;
  333. outline:none;
  334. outline-offset:-1px;
  335. max-width:100%;
  336. align-items:center;
  337. flex-direction:row;
  338. display:flex;
  339. animation-duration:1s;
  340. background-repeat:no-repeat;
  341. }
  342. .class-5
  343. {
  344. color:#333333;
  345. word-wrap:break-word;
  346. display:inline-block;
  347. animation-duration:1s;
  348. font-size:14px;
  349. line-height:1.4;
  350. }
  351. .class-6
  352. {
  353. border-color:#EEEEEE;
  354. color:#606266;
  355. padding-right:15px;
  356. box-sizing:boredr-box;
  357. outline:none;
  358. border-width:1px;
  359. border-style:solid;
  360. height:40px;
  361. margin-left:20px;
  362. animation-duration:1s;
  363. background:none;
  364. width:320px;
  365. font-size:12px;
  366. line-height:40px;
  367. padding-left:15px;
  368. }
  369. .class-7
  370. {
  371. border-color:#EEEEEE;
  372. color:#333333;
  373. outline:none;
  374. outline-offset:-1px;
  375. border-width:1px;
  376. border-style:none;
  377. max-width:100%;
  378. align-items:center;
  379. flex-direction:row;
  380. display:flex;
  381. animation-duration:1s;
  382. background-repeat:no-repeat;
  383. }
  384. .class-8
  385. {
  386. color:#333333;
  387. word-wrap:break-word;
  388. display:inline-block;
  389. animation-duration:1s;
  390. font-size:14px;
  391. line-height:1.4;
  392. }
  393. .class-9
  394. {
  395. border-color:#EEEEEE;
  396. color:#606266;
  397. padding-right:15px;
  398. box-sizing:boredr-box;
  399. outline:none;
  400. border-width:1px;
  401. border-style:solid;
  402. height:40px;
  403. margin-left:20px;
  404. animation-duration:1s;
  405. background:none;
  406. width:320px;
  407. font-size:12px;
  408. line-height:40px;
  409. padding-left:15px;
  410. }
  411. .class-10
  412. {
  413. border-color:#EEEEEE;
  414. color:#333333;
  415. outline:none;
  416. outline-offset:-1px;
  417. border-width:1px;
  418. border-style:none;
  419. max-width:100%;
  420. align-items:center;
  421. flex-direction:row;
  422. display:flex;
  423. animation-duration:1s;
  424. background-repeat:no-repeat;
  425. }
  426. .class-11
  427. {
  428. cursor:pointer;
  429. color:#ffffff;
  430. box-sizing:border-box;
  431. height:34px;
  432. background-color:#0099ff;
  433. text-align:center;
  434. display:inline-block;
  435. animation-duration:1s;
  436. border-radius:4px;
  437. width:98px;
  438. line-height:34px;
  439. font-size:14px;
  440. }
  441. .class-12
  442. {
  443. cursor:pointer;
  444. border-color:#0099FF;
  445. color:#0099FF;
  446. box-sizing:border-box;
  447. border-width:1px;
  448. border-style:solid;
  449. height:34px;
  450. background-color:#FFFFFF;
  451. text-align:center;
  452. display:inline-block;
  453. margin-left:10px;
  454. animation-duration:1s;
  455. border-radius:4px;
  456. width:98px;
  457. line-height:34px;
  458. font-size:14px;
  459. }
  460. .class-13
  461. {
  462. color:#333333;
  463. padding:20px;
  464. outline:none;
  465. outline-offset:-1px;
  466. min-height:250px;
  467. max-width:100%;
  468. background-color:#FFFFFF;
  469. flex-direction:column;
  470. display:flex;
  471. margin: 12px 6px;
  472. animation-duration:1s;
  473. width:100%;
  474. padding-left:20px;
  475. background-repeat:no-repeat;
  476. }
  477. .class-14
  478. {
  479. color:#333333;
  480. outline:none;
  481. outline-offset:-1px;
  482. max-width:100%;
  483. align-items:center;
  484. flex-direction:row;
  485. display:flex;
  486. animation-duration:1s;
  487. background-repeat:no-repeat;
  488. }
  489. .class-15
  490. {
  491. color:#333333;
  492. word-wrap:break-word;
  493. display:inline-block;
  494. animation-duration:1s;
  495. font-size:14px;
  496. line-height:1.4;
  497. }
  498. .class-16
  499. {
  500. border-color:#EEEEEE;
  501. color:#606266;
  502. padding-right:15px;
  503. box-sizing:boredr-box;
  504. outline:none;
  505. border-width:1px;
  506. border-style:solid;
  507. height:40px;
  508. margin-left:20px;
  509. animation-duration:1s;
  510. background:none;
  511. width:320px;
  512. font-size:12px;
  513. line-height:40px;
  514. padding-left:15px;
  515. }
  516. .class-17
  517. {
  518. border-color:#EEEEEE;
  519. color:#333333;
  520. outline:none;
  521. outline-offset:-1px;
  522. border-width:1px;
  523. border-style:none;
  524. max-width:100%;
  525. align-items:center;
  526. flex-direction:row;
  527. display:flex;
  528. animation-duration:1s;
  529. background-repeat:no-repeat;
  530. }
  531. .class-18
  532. {
  533. color:#333333;
  534. word-wrap:break-word;
  535. display:inline-block;
  536. animation-duration:1s;
  537. font-size:14px;
  538. line-height:1.4;
  539. }
  540. .class-19
  541. {
  542. border-color:#EEEEEE;
  543. color:#606266;
  544. padding-right:15px;
  545. box-sizing:boredr-box;
  546. outline:none;
  547. border-width:1px;
  548. border-style:solid;
  549. height:40px;
  550. margin-left:20px;
  551. animation-duration:1s;
  552. background:none;
  553. width:320px;
  554. font-size:12px;
  555. line-height:40px;
  556. padding-left:15px;
  557. }
  558. .class-20
  559. {
  560. color:#333333;
  561. outline:none;
  562. outline-offset:-1px;
  563. max-width:100%;
  564. align-items:center;
  565. flex-direction:row;
  566. display:flex;
  567. animation-duration:1s;
  568. background-repeat:no-repeat;
  569. }
  570. .class-21
  571. {
  572. cursor:pointer;
  573. color:#ffffff;
  574. box-sizing:border-box;
  575. height:34px;
  576. background-color:#0099ff;
  577. text-align:center;
  578. display:inline-block;
  579. animation-duration:1s;
  580. border-radius:4px;
  581. width:98px;
  582. line-height:34px;
  583. font-size:14px;
  584. }
  585. .class-22
  586. {
  587. cursor:pointer;
  588. border-color:#0099FF;
  589. color:#0099FF;
  590. box-sizing:border-box;
  591. border-width:1px;
  592. border-style:solid;
  593. height:34px;
  594. background-color:#FFFFFF;
  595. text-align:center;
  596. display:inline-block;
  597. margin-left:10px;
  598. animation-duration:1s;
  599. border-radius:4px;
  600. width:98px;
  601. line-height:34px;
  602. font-size:14px;
  603. }
  604. .class-23
  605. {
  606. color:#333333;
  607. padding:20px;
  608. outline:none;
  609. outline-offset:-1px;
  610. min-height:250px;
  611. max-width:100%;
  612. background-color:#FFFFFF;
  613. flex-direction:column;
  614. display:flex;
  615. margin: 12px 12px 12px 6px;
  616. animation-duration:1s;
  617. width:100%;
  618. padding-left:20px;
  619. background-repeat:no-repeat;
  620. }
  621. .class-24
  622. {
  623. color:#333333;
  624. outline:none;
  625. outline-offset:-1px;
  626. max-width:100%;
  627. align-items:center;
  628. flex-direction:row;
  629. display:flex;
  630. animation-duration:1s;
  631. background-repeat:no-repeat;
  632. }
  633. .class-25
  634. {
  635. color:#333333;
  636. word-wrap:break-word;
  637. display:inline-block;
  638. animation-duration:1s;
  639. font-size:14px;
  640. line-height:1.4;
  641. }
  642. .class-26
  643. {
  644. border-color:#EEEEEE;
  645. color:#606266;
  646. padding-right:15px;
  647. box-sizing:boredr-box;
  648. outline:none;
  649. border-width:1px;
  650. border-style:solid;
  651. height:40px;
  652. margin-left:20px;
  653. animation-duration:1s;
  654. background:none;
  655. width:320px;
  656. font-size:12px;
  657. line-height:40px;
  658. padding-left:15px;
  659. }
  660. .class-27
  661. {
  662. border-color:#EEEEEE;
  663. color:#333333;
  664. outline:none;
  665. outline-offset:-1px;
  666. border-width:1px;
  667. border-style:none;
  668. max-width:100%;
  669. align-items:center;
  670. flex-direction:row;
  671. display:flex;
  672. animation-duration:1s;
  673. background-repeat:no-repeat;
  674. }
  675. .class-28
  676. {
  677. color:#333333;
  678. word-wrap:break-word;
  679. display:inline-block;
  680. animation-duration:1s;
  681. font-size:14px;
  682. line-height:1.4;
  683. }
  684. .class-29
  685. {
  686. border-color:#EEEEEE;
  687. color:#606266;
  688. padding-right:15px;
  689. box-sizing:boredr-box;
  690. outline:none;
  691. border-width:1px;
  692. border-style:solid;
  693. height:40px;
  694. margin-left:20px;
  695. animation-duration:1s;
  696. background:none;
  697. width:320px;
  698. font-size:12px;
  699. line-height:40px;
  700. padding-left:15px;
  701. }
  702. .class-30
  703. {
  704. color:#333333;
  705. outline:none;
  706. outline-offset:-1px;
  707. max-width:100%;
  708. align-items:center;
  709. flex-direction:row;
  710. display:flex;
  711. animation-duration:1s;
  712. background-repeat:no-repeat;
  713. }
  714. .class-31
  715. {
  716. cursor:pointer;
  717. color:#ffffff;
  718. box-sizing:border-box;
  719. height:34px;
  720. background-color:#0099ff;
  721. text-align:center;
  722. display:inline-block;
  723. animation-duration:1s;
  724. border-radius:4px;
  725. width:98px;
  726. line-height:34px;
  727. font-size:14px;
  728. }
  729. .class-32
  730. {
  731. cursor:pointer;
  732. border-color:#0099FF;
  733. color:#0099FF;
  734. box-sizing:border-box;
  735. border-width:1px;
  736. border-style:solid;
  737. height:34px;
  738. background-color:#FFFFFF;
  739. text-align:center;
  740. display:inline-block;
  741. margin-left:10px;
  742. animation-duration:1s;
  743. border-radius:4px;
  744. width:98px;
  745. line-height:34px;
  746. font-size:14px;
  747. }
  748. .el-select,
  749. .el-input,
  750. .el-form-item,
  751. .el-date-editor{
  752. width: 100%;
  753. }
  754. </style>