index.ftl 16 KB

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