index.ftl 23 KB

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