create.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  6. <link href="{__FRAME_PATH}css/font-awesome.min.css" rel="stylesheet">
  7. <link href="{__ADMIN_PATH}plug/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
  8. <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/jquery.min.js"></script>
  9. <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/template.min.js"></script>
  10. <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.config.js"></script>
  11. <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.min.js"></script>
  12. <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/lang/zh-cn/zh-cn.js"></script>
  13. <link rel="stylesheet" href="/static/plug/layui/css/layui.css">
  14. <link rel="stylesheet" href="{__PLUG_PATH}daterangepicker/daterangepicker.css">
  15. <script src="{__PLUG_PATH}moment.js"></script>
  16. <script src="{__PLUG_PATH}daterangepicker/daterangepicker.js"></script>
  17. <script src="/static/plug/layui/layui.js"></script>
  18. <script src="{__PLUG_PATH}vue/dist/vue.min.js"></script>
  19. <script src="/static/plug/axios.min.js"></script>
  20. <script src="{__MODULE_PATH}widget/aliyun-oss-sdk-4.4.4.min.js"></script>
  21. <script src="{__MODULE_PATH}widget/cos-js-sdk-v5.min.js"></script>
  22. <script src="{__MODULE_PATH}widget/qiniu-js-sdk-2.5.5.js"></script>
  23. <script src="{__MODULE_PATH}widget/plupload.full.min.js"></script>
  24. <style>
  25. .layui-form-item {
  26. margin-bottom: 0px;
  27. }
  28. .pictrueBox {
  29. display: inline-block !important;
  30. }
  31. .pictrue {
  32. width: 60px;
  33. height: 60px;
  34. border: 1px dotted rgba(0, 0, 0, 0.1);
  35. margin-right: 15px;
  36. display: inline-block;
  37. position: relative;
  38. cursor: pointer;
  39. }
  40. .pictrue img {
  41. width: 100%;
  42. height: 100%;
  43. }
  44. .upLoad {
  45. width: 58px;
  46. height: 58px;
  47. line-height: 58px;
  48. border: 1px dotted rgba(0, 0, 0, 0.1);
  49. border-radius: 4px;
  50. background: rgba(0, 0, 0, 0.02);
  51. cursor: pointer;
  52. display: flex;
  53. justify-content: center;
  54. align-items: center;
  55. }
  56. .rulesBox {
  57. display: flex;
  58. flex-wrap: wrap;
  59. margin-left: 10px;
  60. }
  61. .layui-tab-content {
  62. margin-top: 15px;
  63. }
  64. .ml110 {
  65. margin: 18px 0 4px 110px;
  66. }
  67. .rules {
  68. display: flex;
  69. }
  70. .rules-btn-sm {
  71. height: 30px;
  72. line-height: 30px;
  73. font-size: 12px;
  74. width: 109px;
  75. }
  76. .rules-btn-sm input {
  77. width: 79% !important;
  78. height: 84% !important;
  79. padding: 0 10px;
  80. }
  81. .ml10 {
  82. margin-left: 10px !important;
  83. }
  84. .ml40 {
  85. margin-left: 40px !important;
  86. }
  87. .closes {
  88. position: absolute;
  89. left: 86%;
  90. top: -18%;
  91. }
  92. .red {
  93. color: red;
  94. }
  95. .layui-input-block .layui-video-box {
  96. width: 22%;
  97. height: 180px;
  98. border-radius: 10px;
  99. background-color: #707070;
  100. margin-top: 10px;
  101. position: relative;
  102. overflow: hidden;
  103. }
  104. .layui-input-block .layui-video-box i {
  105. color: #fff;
  106. line-height: 180px;
  107. margin: 0 auto;
  108. width: 50px;
  109. height: 50px;
  110. display: inherit;
  111. font-size: 50px;
  112. }
  113. .layui-input-block .layui-video-box .mark {
  114. position: absolute;
  115. width: 100%;
  116. height: 30px;
  117. top: 0;
  118. background-color: rgba(0, 0, 0, .5);
  119. text-align: center;
  120. }
  121. .store_box {
  122. display: flex;
  123. }
  124. .info {
  125. color: #c9c9c9;
  126. padding-left: 10px;
  127. line-height: 30px;
  128. }
  129. </style>
  130. </head>
  131. <body>
  132. <div class="layui-fluid">
  133. <div class="layui-row layui-col-space15" id="app" v-cloak="">
  134. <div class="layui-card">
  135. <div class="layui-card-header">
  136. <span class="">{{id ? '帖子修改': '帖子添加' }}</span>
  137. <button style="margin-left: 20px" type="button" class="layui-btn layui-btn-primary layui-btn-xs"
  138. @click="goBack">返回列表
  139. </button>
  140. </div>
  141. <div class="layui-card-body">
  142. <form class="layui-form" action="" v-cloak="">
  143. <div class="layui-tab layui-tab-brief" lay-filter="docTabBrief">
  144. <!-- <ul class="layui-tab-title">-->
  145. <!-- <li class="layui-this" lay-id='1'>基础信息</li>-->
  146. <!-- <li lay-id='2'>活动详情</li>-->
  147. <!-- </ul>-->
  148. <div class="layui-tab-content">
  149. <div class="layui-tab-item layui-show">
  150. <div class="layui-row layui-col-space15">
  151. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  152. <div class="grid-demo grid-demo-bg1">
  153. <div class="layui-form-item">
  154. <label class="layui-form-label">帖子标题<i class="red">*</i></label>
  155. <div class="layui-input-block">
  156. <input type="text" name="title" lay-verify="title"
  157. autocomplete="off"
  158. placeholder="请输入帖子标题" class="layui-input"
  159. v-model="formData.title" maxlength="100">
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  165. <div class="grid-demo grid-demo-bg1">
  166. <div class="layui-form-item">
  167. <label class="layui-form-label">产品标题<i class="red">*</i></label>
  168. <div class="layui-input-block">
  169. <input type="text" name="product_title" lay-verify="product_title"
  170. autocomplete="off"
  171. placeholder="请输入产品标题" class="layui-input"
  172. v-model="formData.product_title" maxlength="100">
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  178. <div class="grid-demo grid-demo-bg1">
  179. <div class="layui-form-item">
  180. <label class="layui-form-label">产品链接<i class="red">*</i></label>
  181. <div class="layui-input-block">
  182. <input type="text" name="product_url" lay-verify="product_url"
  183. autocomplete="off"
  184. placeholder="请输入产品链接" class="layui-input"
  185. v-model="formData.product_url" maxlength="100">
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  191. <div class="grid-demo grid-demo-bg1">
  192. <div class="layui-form-item">
  193. <label class="layui-form-label">帖子图片列表<i class="red">*</i></label>
  194. <div class="pictrueBox pictrue"
  195. v-for="(item,index) in formData.img_list">
  196. <img :src="item">
  197. <i class="layui-icon closes"
  198. @click="deleteImage('img_list',index)">&#x1007</i>
  199. </div>
  200. <div class="pictrueBox">
  201. <div class="upLoad" @click="uploadImage('img_list')"
  202. v-if="formData.img_list.length <= rule.img_list.maxLength">
  203. <i class="layui-icon layui-icon-camera" class="iconfont"
  204. style="font-size: 26px;"></i>
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. <div class="layui-row layui-col-space15">
  211. <div class="layui-form-item">
  212. <textarea type="text/plain" name="content" id="myEditor"
  213. style="width:60%;">{{formData.content}}</textarea>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. <!-- <div class="layui-tab-item">-->
  219. <!---->
  220. <!-- </div>-->
  221. </div>
  222. <div class="layui-tab-content">
  223. <div class="layui-row layui-col-space15">
  224. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  225. <div class="grid-demo grid-demo-bg1">
  226. <div class="layui-form-item" v-if="id">
  227. <button class="layui-btn layui-btn-primary layui-btn-sm" type="button"
  228. @click="handleSubmit()">保存
  229. </button>
  230. <!-- <button class="layui-btn layui-btn-primary layui-btn-sm" type="button"-->
  231. <!-- @click="back" v-if="layTabId != 1">上一步-->
  232. <!-- </button>-->
  233. <!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button"-->
  234. <!-- v-if="layTabId != 2" @click="next">下一步-->
  235. </button>
  236. </div>
  237. <div class="layui-form-item" v-else>
  238. <!-- <button class="layui-btn layui-btn-primary layui-btn-sm" type="button"-->
  239. <!-- @click="back" v-if="layTabId != 1">上一步-->
  240. <!-- </button>-->
  241. <!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button"-->
  242. <!-- @click="next" v-if="layTabId != 2">下一步-->
  243. <!-- </button>-->
  244. <button class="layui-btn layui-btn-normal layui-btn-sm" type="button"
  245. @click="handleSubmit()">提交
  246. </button>
  247. </div>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. </form>
  254. </div>
  255. </div>
  256. </div>
  257. </div>
  258. <script>
  259. var id = {$id};
  260. new Vue({
  261. el: '#app',
  262. data: {
  263. id: id,
  264. upload: {
  265. videoIng: false
  266. },
  267. formData: {
  268. title: '',
  269. img_list: [],
  270. content: '',
  271. product_title: '',
  272. product_url: '',
  273. },
  274. rule: { //多图选择规则
  275. img_list: {
  276. maxLength: 5
  277. }
  278. },
  279. progress: 0,
  280. um: null,//编译器实例化
  281. form: null,//layui.form
  282. layTabId: 1,
  283. ruleBool: id ? true : false,
  284. },
  285. methods: {
  286. back: function () {
  287. var that = this;
  288. layui.use(['element'], function () {
  289. layui.element.tabChange('docTabBrief', that.layTabId == 1 ? 1 : parseInt(that.layTabId) - 1);
  290. });
  291. },
  292. next: function () {
  293. var that = this;
  294. layui.use(['element'], function () {
  295. layui.element.tabChange('docTabBrief', that.layTabId == 2 ? 2 : parseInt(that.layTabId) + 1);
  296. });
  297. },
  298. goBack: function () {
  299. location.href = this.U({c: 'qa.Questions', a: 'index'});
  300. },
  301. U: function (opt) {
  302. var m = opt.m || 'admin', c = opt.c || window.controlle || '', a = opt.a || 'index', q = opt.q || '',
  303. p = opt.p || {};
  304. var params = Object.keys(p).map(function (key) {
  305. return key + '/' + p[key];
  306. }).join('/');
  307. var gets = Object.keys(q).map(function (key) {
  308. return key + '=' + q[key];
  309. }).join('&');
  310. return '/' + m + '/' + c + '/' + a + (params == '' ? '' : '/' + params) + (gets == '' ? '' : '?' + gets);
  311. },
  312. /**
  313. * 提示
  314. * */
  315. showMsg: function (msg, success) {
  316. layui.use(['layer'], function () {
  317. layui.layer.msg(msg, success);
  318. });
  319. },
  320. /**
  321. * 获取活动信息
  322. * */
  323. getQuestionsInfo: function () {
  324. var that = this;
  325. that.requestGet(that.U({
  326. c: "qa.Questions",
  327. a: 'get_questions_info',
  328. q: {id: that.id}
  329. })).then(function (res) {
  330. var questionsInfo = res.data.questionsInfo || {};
  331. if (questionsInfo.id && that.id) {
  332. that.$set(that, 'formData', questionsInfo);
  333. // that.formData.start_time = formatDate(that.formData.start_time * 1000);
  334. // that.formData.end_time = formatDate(that.formData.end_time * 1000);
  335. }
  336. that.init();
  337. }).catch(function (res) {
  338. that.showMsg(res.msg);
  339. })
  340. },
  341. /**
  342. * 删除图片
  343. * */
  344. deleteImage: function (key, index) {
  345. var that = this;
  346. if (index != undefined) {
  347. that.formData[key].splice(index, 1);
  348. that.$set(that.formData, key, that.formData[key]);
  349. } else {
  350. that.$set(that.formData, key, '');
  351. }
  352. },
  353. createFrame: function (title, src, opt) {
  354. opt === undefined && (opt = {});
  355. var h = 0;
  356. if (window.innerHeight < 800 && window.innerHeight >= 700) {
  357. h = window.innerHeight - 50;
  358. } else if (window.innerHeight < 900 && window.innerHeight >= 800) {
  359. h = window.innerHeight - 100;
  360. } else if (window.innerHeight < 1000 && window.innerHeight >= 900) {
  361. h = window.innerHeight - 150;
  362. } else if (window.innerHeight >= 1000) {
  363. h = window.innerHeight - 200;
  364. } else {
  365. h = window.innerHeight;
  366. }
  367. var area = [(opt.w || window.innerWidth / 2) + 'px', (!opt.h || opt.h > h ? h : opt.h) + 'px'];
  368. layui.use('layer', function () {
  369. return layer.open({
  370. type: 2,
  371. title: title,
  372. area: area,
  373. fixed: false, //不固定
  374. maxmin: true,
  375. moveOut: false,//true 可以拖出窗外 false 只能在窗内拖
  376. anim: 5,//出场动画 isOutAnim bool 关闭动画
  377. offset: 'auto',//['100px','100px'],//'auto',//初始位置 ['100px','100px'] t[ 上 左]
  378. shade: 0,//遮罩
  379. resize: true,//是否允许拉伸
  380. content: src,//内容
  381. move: '.layui-layer-title'
  382. });
  383. });
  384. },
  385. changeIMG: function (name, value) {
  386. if (this.getRule(name).maxLength !== undefined) {
  387. var that = this;
  388. value.map(function (v) {
  389. that.formData[name].push(v);
  390. });
  391. this.$set(this.formData, name, this.formData[name]);
  392. } else {
  393. if (name == 'batchAttr.pic') {
  394. this.batchAttr.pic = value;
  395. } else {
  396. if (name.indexOf('.') !== -1) {
  397. var key = name.split('.');
  398. if (key.length == 2) {
  399. this.formData[key[0]][key[1]] = value;
  400. } else if (key.length == 3) {
  401. this.formData[key[0]][key[1]][key[2]] = value;
  402. } else if (key.length == 4) {
  403. this.$set(this.formData[key[0]][key[1]][key[2]], key[3], value)
  404. }
  405. } else {
  406. this.formData[name] = value;
  407. }
  408. }
  409. }
  410. },
  411. getRule: function (name) {
  412. return this.rule[name] || {};
  413. },
  414. uploadImage: function (name) {
  415. return this.createFrame('选择图片', this.U({c: "widget.images", a: 'index', p: {fodder: name}}), {
  416. h: 545,
  417. w: 900
  418. });
  419. },
  420. insertEditor: function (list) {
  421. this.um.execCommand('insertimage', list);
  422. },
  423. getContent: function () {
  424. return this.um.getContent();
  425. },
  426. /**
  427. * 监听radio字段
  428. */
  429. // eeventRadio: function () {
  430. // var that = this;
  431. // that.radioRule.map(function (val) {
  432. // that.form.on('radio(' + val + ')', function (res) {
  433. // that.formData[val] = res.value;
  434. // });
  435. // })
  436. // },
  437. init: function () {
  438. var that = this;
  439. window.UMEDITOR_CONFIG.toolbar = [
  440. // 加入一个 test
  441. 'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
  442. 'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
  443. '| justifyleft justifycenter justifyright justifyjustify |',
  444. 'link unlink | emotion selectimgs video | map',
  445. '| horizontal print preview fullscreen', 'drafts', 'formula'
  446. ];
  447. UM.registerUI('selectimgs', function (name) {
  448. var me = this;
  449. var $btn = $.eduibutton({
  450. icon: 'image',
  451. click: function () {
  452. that.createFrame('选择图片', "{:Url('widget.images/index',['fodder'=>'editor'])}");
  453. },
  454. title: '选择图片'
  455. });
  456. this.addListener('selectionchange', function () {
  457. //切换为不可编辑时,把自己变灰
  458. var state = this.queryCommandState(name);
  459. $btn.edui().disabled(state == -1).active(state == 1)
  460. });
  461. return $btn;
  462. });
  463. //实例化编辑器
  464. this.um = UM.getEditor('myEditor', {initialFrameWidth: '99%', initialFrameHeight: 400});
  465. this.um.setContent(that.formData.content);
  466. that.$nextTick(function () {
  467. layui.use(['form', 'element'], function () {
  468. that.form = layui.form;
  469. that.form.render();
  470. that.form.on('select(temp_id)', function (data) {
  471. that.$set(that.formData, 'temp_id', data.value);
  472. });
  473. that.form.on('select(rule_index)', function (data) {
  474. that.ruleIndex = data.value;
  475. });
  476. layui.element.on('tab(docTabBrief)', function () {
  477. that.layTabId = this.getAttribute('lay-id');
  478. });
  479. // that.eeventRadio();
  480. });
  481. })
  482. },
  483. requestPost: function (url, data) {
  484. return new Promise(function (resolve, reject) {
  485. axios.post(url, data).then(function (res) {
  486. if (res.status == 200 && res.data.code == 200) {
  487. resolve(res.data)
  488. } else {
  489. reject(res.data);
  490. }
  491. }).catch(function (err) {
  492. reject({msg: err})
  493. });
  494. })
  495. },
  496. requestGet: function (url) {
  497. return new Promise(function (resolve, reject) {
  498. axios.get(url).then(function (res) {
  499. if (res.status == 200 && res.data.code == 200) {
  500. resolve(res.data)
  501. } else {
  502. reject(res.data);
  503. }
  504. }).catch(function (err) {
  505. reject({msg: err})
  506. });
  507. })
  508. },
  509. handleSubmit: function () {
  510. var that = this;
  511. if (!that.formData.title.length) {
  512. return that.showMsg('请填写帖子名称');
  513. }
  514. // if (!that.formData.pay_price.length) {
  515. // return that.showMsg('请填写报名费');
  516. // }
  517. if (!that.formData.product_title.length) {
  518. return that.showMsg('请填写产品标题');
  519. }
  520. if (!that.formData.product_url.length) {
  521. return that.showMsg('请填写产品链接');
  522. }
  523. if (!that.formData.img_list.length) {
  524. return that.showMsg('请选择帖子图片');
  525. }
  526. that.formData.content = that.getContent();
  527. if (!that.formData.content.length) {
  528. return that.showMsg('请填写帖子详情');
  529. }
  530. that.requestPost(that.U({
  531. c: 'qa.Questions',
  532. a: 'save',
  533. p: {id: that.id}
  534. }), that.formData).then(function (res) {
  535. that.confirm();
  536. }).catch(function (res) {
  537. that.showMsg(res.msg);
  538. });
  539. },
  540. confirm: function () {
  541. var that = this;
  542. layui.use(['layer'], function () {
  543. var layer = layui.layer;
  544. layer.confirm(that.id ? '修改成功是否返回帖子列表' : '添加成功是否返回帖子列表', {
  545. btn: ['返回列表', that.id ? '继续修改' : '继续添加'] //按钮
  546. }, function () {
  547. location.href = that.U({c: 'qa.Questions', a: 'index'});
  548. }, function () {
  549. if (that.id == 0) {
  550. location.reload();
  551. }
  552. });
  553. });
  554. },
  555. render: function () {
  556. this.$nextTick(function () {
  557. layui.use(['form'], function () {
  558. layui.form.render('select');
  559. });
  560. })
  561. },
  562. // 移动
  563. handleDragStart(e, item) {
  564. this.dragging = item;
  565. },
  566. handleDragEnd(e, item) {
  567. this.dragging = null
  568. },
  569. handleDragOver(e) {
  570. e.dataTransfer.dropEffect = 'move'
  571. },
  572. handleDragEnter(e, item) {
  573. e.dataTransfer.effectAllowed = 'move'
  574. if (item === this.dragging) {
  575. return
  576. }
  577. var newItems = [...this.formData.activity];
  578. var src = newItems.indexOf(this.dragging);
  579. var dst = newItems.indexOf(item);
  580. newItems.splice(dst, 0, ...newItems.splice(src, 1))
  581. this.formData.activity = newItems;
  582. }
  583. },
  584. mounted: function () {
  585. var that = this;
  586. axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  587. that.getQuestionsInfo();
  588. window.$vm = that;
  589. window.changeIMG = that.changeIMG;
  590. window.insertEditor = that.insertEditor;
  591. window.insertEditorVideo = that.insertEditorVideo;
  592. $(that.$refs.filElem).change(function () {
  593. var inputFile = this.files[0];
  594. that.requestPost(that.U({c: "widget.video", a: 'get_signature'})).then(function (res) {
  595. AdminUpload.upload(res.data.uploadType, {
  596. token: res.data.uploadToken || '',
  597. file: inputFile,
  598. accessKeyId: res.data.accessKey || '',
  599. accessKeySecret: res.data.secretKey || '',
  600. bucketName: res.data.storageName || '',
  601. region: res.data.storageRegion || '',
  602. domain: res.data.domain || '',
  603. uploadIng: function (progress) {
  604. that.upload.videoIng = true;
  605. that.progress = progress;
  606. }
  607. }).then(function (res) {
  608. //成功
  609. that.$set(that.formData, 'video_link', res.url);
  610. that.progress = 0;
  611. that.upload.videoIng = false;
  612. return that.showMsg('上传成功');
  613. }).catch(function (err) {
  614. //失败
  615. console.info(err);
  616. return that.showMsg('上传错误请检查您的配置');
  617. });
  618. }).catch(function (res) {
  619. return that.showMsg(res.msg || '获取密钥失败,请检查您的配置');
  620. });
  621. })
  622. }
  623. });
  624. function formatDate(time) {
  625. var date = new Date(time);
  626. var YY = date.getFullYear() + '-';
  627. var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  628. var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
  629. var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
  630. var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
  631. var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
  632. return YY + MM + DD;
  633. }
  634. </script>
  635. </body>
  636. </html>