MessageBoard.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <template>
  2. <div class="messageBoard container" v-if="isOpen">
  3. <div class="modal-header">
  4. <h3 class="modal-title f18">
  5. <span v-if="showHistory">留言板</span>
  6. <span v-if="!showHistory">留言记录</span>
  7. </h3>
  8. <a @click="isOpendMessage"><i class="fa fa-remove"></i></a>
  9. </div>
  10. <div class="modal-body msg-body">
  11. <div v-if="showHistory">
  12. <h3>亲爱的&nbsp;<span v-text="user.userName || '游客'">&nbsp;&nbsp;</span> ,您的意见对我们很重要!</h3>
  13. <form name="messageBoardForm" method="post">
  14. <div class="txtArea">
  15. <b class="first">*</b>
  16. <textarea @keyup="textareaLength" placeholder="请将您在使用当前页面遇到的任何问题、建议或意见反馈给我们。注意:不要输入您的隐私信息,如:账户密码等。" v-model="messageBoard.question" maxlength="500"></textarea>
  17. <span class="count_tip"><span v-text="txtVal"></span>/500</span>
  18. </div>
  19. <p><b>*</b>您的身份是:</p>
  20. <p class="radioCheck">
  21. <label for="buyer01" class="radioLabel">
  22. <input type="radio" name="role" value="buyer" v-model="messageBoard.role" id="buyer01"/>
  23. <label for="buyer01" class="txtContact"></label>
  24. <span>我是买家</span>
  25. </label>
  26. <label for="buyer02" class="radioLabel">
  27. <input type="radio" name="role" value="seller" v-model="messageBoard.role" id="buyer02" checked/>
  28. <label for="buyer02" class="txtContact"></label>
  29. <span>我是卖家</span>
  30. </label>
  31. </p>
  32. <p><b>*</b>您反馈的内容类型是:</p>
  33. <p class="radioCheck">
  34. <label for="contentType01" class="radioLabel">
  35. <input type="radio" name="type" value="展示效果" v-model="messageBoard.type" id="contentType01"/>
  36. <label for="contentType01" class="txtContact"></label>
  37. <span>展示效果</span>
  38. </label>
  39. <label for="contentType02" class="radioLabel">
  40. <input type="radio" name="type" value="页面功能" v-model="messageBoard.type" id="contentType02" checked/>
  41. <label for="contentType02" class="txtContact"></label>
  42. <span>页面功能</span>
  43. </label>
  44. <label for="contentType03" class="radioLabel">
  45. <input type="radio" name="type" value="异常报错" v-model="messageBoard.type" id="contentType03"/>
  46. <label for="contentType03" class="txtContact"></label>
  47. <span>异常报错</span>
  48. </label>
  49. <label for="contentType04" class="radioLabel">
  50. <input type="radio" name="type" value="其他方面" v-model="messageBoard.type" id="contentType04"/>
  51. <label for="contentType04" class="txtContact"></label>
  52. <span>其他方面</span>
  53. </label>
  54. </p>
  55. <p>&nbsp;&nbsp;&nbsp;添加图片:</p>
  56. <div class="img-warp">
  57. <div class="img-item">
  58. <image-upload @fileAction="listenFile">
  59. <img src="/images/messageBoard/msg_uploadPic.png" alt="">
  60. </image-upload>
  61. </div>
  62. <div class="img-item">
  63. <image-upload @fileAction="listenFile">
  64. <img src="/images/messageBoard/msg_uploadPic.png" alt="">
  65. </image-upload>
  66. </div>
  67. <div class="img-item">
  68. <image-upload @fileAction="listenFile">
  69. <img src="/images/messageBoard/msg_uploadPic.png" alt="">
  70. </image-upload>
  71. </div>
  72. <div class="img-item">
  73. <image-upload @fileAction="listenFile">
  74. <img src="/images/messageBoard/msg_uploadPic.png" alt="">
  75. </image-upload>
  76. </div>
  77. <div class="img-item">
  78. <image-upload @fileAction="listenFile">
  79. <img src="/images/messageBoard/msg_uploadPic.png" alt="">
  80. </image-upload>
  81. </div>
  82. </div>
  83. <p class="tip clearfix">提示:最多可上传五张图片,每张大小不超过500KB,仅支持JPG、PNG、GIF格式.</p>
  84. <div v-if="!user.userUU">
  85. <p><b>*</b>您当前尚未登录,请留下您的联系方式,我们会不定期发布一些有奖体验活动</p>
  86. <div class="msg-message" v-if="!user.userUU">
  87. <div class="msg-content">
  88. <label>手机:</label>
  89. <input type="text" name="userTel" v-model="messageBoard.userTel" autocomplete="off" @keyup="checkMobile"/>
  90. <span v-if="!isMobile"><i class="glyphicon glyphicon-info-sign x-icon-left"></i>请输入正确的号码</span>
  91. </div>
  92. </div>
  93. <div class="msg-message" v-if="!user.userUU">
  94. <div class="msg-content">
  95. <label>邮箱:</label>
  96. <input type="text" name="email" v-model="messageBoard.email" autocomplete="off" @keyup="checkEmail"/>
  97. <span v-if="!isEmail"><i class="glyphicon glyphicon-info-sign x-icon-left"></i>请输入正确的邮箱</span>
  98. </div>
  99. </div>
  100. </div>
  101. <el-button>
  102. <button class="btn" @click="confirm">提交</button></el-button>
  103. </form>
  104. </div>
  105. <div class="msg-table" v-else-if="!showHistory && user.userUU">
  106. <div class="history" v-for="message in messageBoardCurrent.content">
  107. <div class="form-group row">
  108. <div class="col-xs-8">{{message.type}}</div>
  109. <div class="msgDate col-xs-4">{{message.createDate | date}}</div>
  110. </div>
  111. <div class="question">
  112. <span>问题:</span>
  113. <span style="word-break: break-all">{{message.question}}</span>
  114. </div>
  115. <div class="answer" v-show="message.answer" style="margin-bottom: 10px;">
  116. <span>回复:</span>
  117. <span style="word-break: break-all">{{message.answer}}</span>
  118. </div>
  119. </div>
  120. <div class="text-center" v-if="!messageBoardCurrent || messageBoardCurrent.length === 0">
  121. <div>无留言记录</div>
  122. </div>
  123. </div>
  124. <div class="page" v-if="!showHistory">
  125. <page-component
  126. :total="messageBoardCurrent.totalElements"
  127. :page-size="pageParams.count"
  128. :current="pageParams.page"
  129. v-on:childEvent="listenPage">
  130. </page-component>
  131. </div>
  132. <div class="msg-slide1" @click="isOpenHistory" v-if="showHistory">
  133. <i class="fa fa-angle-left"></i><span>留言记录</span>
  134. </div>
  135. <div class="msg-slide2" @click="isHideHistory" v-if="!showHistory">
  136. <i class="fa fa-angle-right"></i><span>关闭记录</span>
  137. </div>
  138. </div>
  139. </div>
  140. </template>
  141. <script>
  142. import ImageUpload from '~components/common/image-upload/imageUpload.vue'
  143. import PageComponent from '~components/common/page/pageComponent.vue'
  144. import {Message} from 'element-ui'
  145. export default {
  146. name: 'messageBoard',
  147. data () {
  148. return {
  149. pageParams: {
  150. page: 1,
  151. count: 3,
  152. currentPage: 1,
  153. dialogVisible: false
  154. },
  155. dialogImageUrl: [],
  156. showHistory: true,
  157. isOpen: true,
  158. isLogin: false,
  159. txtVal: 0,
  160. isMobile: true,
  161. isEmail: true
  162. }
  163. },
  164. components: {
  165. ImageUpload,
  166. PageComponent
  167. },
  168. computed: {
  169. messageBoard () {
  170. return this.$store.state.messageBoard.information.data
  171. },
  172. user () {
  173. return this.$store.state.option.user.data
  174. },
  175. messageBoardCurrent () {
  176. return this.$store.state.messageBoardInformation.information.data
  177. }
  178. },
  179. filters: {
  180. date: function (num) {
  181. const d = new Date(num)
  182. const year = d.getFullYear()
  183. const month = d.getMonth() + 1 < 10 ? '0' + d.getMonth() : '' + d.getMonth()
  184. const day = d.getDay() < 10 ? '0' + d.getDay() : '' + d.getDay()
  185. return year + '-' + month + '-' + day
  186. }
  187. },
  188. methods: {
  189. listenPage (page) {
  190. this.pageParams.page = page
  191. this.$emit('pageEvent', page)
  192. },
  193. listenFile (url) {
  194. let obj = {}
  195. obj.img = url
  196. this.dialogImageUrl.push(obj)
  197. },
  198. isOpendMessage () {
  199. this.$emit('openBoardEvent', false)
  200. },
  201. isOpenHistory () {
  202. this.$store.dispatch('getMessageBoardInformation', {page: 1, count: 3})
  203. this.showHistory = !this.showHistory
  204. },
  205. isHideHistory () {
  206. this.showHistory = !this.showHistory
  207. },
  208. textareaLength () {
  209. this.txtVal = this.messageBoard.question.length
  210. },
  211. // 判断手机号
  212. checkMobile () {
  213. this.isMobile = (/^[\d]{8,11}$/).test(this.messageBoard.userTel)
  214. },
  215. // 判断邮箱
  216. checkEmail () {
  217. this.isEmail = (/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/).test(this.messageBoard.email)
  218. },
  219. confirm () {
  220. this.$store.dispatch('uploadMessageBoardInformation', {question: this.messageBoard.question, role: this.messageBoard.role, submitTitle: '【优软商城】IC电子元器件现货采购交易平台商城', submitUrl: window.location.href, type: this.messageBoard.type, imgs: this.dialogImageUrl, userTel: '13333333333'})
  221. if (this.messageBoard) {
  222. if (!this.messageBoard.question) {
  223. Message.error('您还没有填写反馈内容')
  224. } else if (!this.messageBoard.role) {
  225. Message.error('请选择您的身份信息')
  226. } else if (!this.messageBoard.type) {
  227. Message.error('请选择一种反馈类型')
  228. } else if (!this.user) {
  229. if (!this.messageBoard.userTel && !this.messageBoard.email) {
  230. Message.error('请填写任意一种联系方式')
  231. }
  232. }
  233. }
  234. }
  235. }
  236. }
  237. </script>
  238. <style scoped>
  239. /*分页*/
  240. .page {
  241. text-align: center;
  242. }
  243. .page .page-wrap{
  244. float: none;
  245. }
  246. .page-wrap ul, .page-wrap div {
  247. float: none !important;
  248. display: inline-block;
  249. margin: 0;
  250. }
  251. body,textarea,button.btn{
  252. font-family: "MicrosoftYaHei Regual", "微软雅黑" !important;
  253. }
  254. .messageBoard {
  255. width: 680px;
  256. font-size: 14px;
  257. background: #fff;
  258. }
  259. .messageBoard .modal-header {
  260. position: relative;
  261. background: url("/images/messageBoard/msg_nav.png") no-repeat left center;
  262. min-height: 0;
  263. padding: 11.5px;
  264. text-align: center;
  265. }
  266. .messageBoard .modal-header i{
  267. position: absolute;
  268. top: 5px;
  269. left: 650px;
  270. font-size: 20px;
  271. color: #fff;
  272. cursor: pointer;
  273. }
  274. .messageBoard .modal-header>h3{
  275. font-size: 18px;
  276. color: #000;
  277. }
  278. .messageBoard .modal-header .modal-title {
  279. margin-left: 30px;
  280. text-align: center;
  281. color: #fff;
  282. }
  283. .messageBoard .modal-header .modal-title span{
  284. vertical-align: middle;
  285. }
  286. .messageBoard .modal-body {
  287. padding: 10px;
  288. min-height: 445px;
  289. margin: 0 auto;
  290. width: 680px;
  291. }
  292. .messageBoard .modal-body h3{
  293. width: 680px;
  294. text-align: center;
  295. font-size: 14px;
  296. color: #333;
  297. margin: 0 0 10px 0;
  298. }
  299. .messageBoard .modal-body h3 span{
  300. color: #5078cb;
  301. }
  302. .messageBoard .modal-body form{
  303. width: 680px;
  304. text-align: center;
  305. }
  306. .messageBoard .modal-body form .txtArea{
  307. position: relative;
  308. }
  309. .messageBoard .modal-body form textarea {
  310. padding: 10px 10px 20px 10px;
  311. width: 576px;
  312. height: 110px;
  313. color: #333;
  314. border: #c5c5c5 1px solid;
  315. font-size: 13px;
  316. letter-spacing: 1px;
  317. line-height: 18px;
  318. }
  319. .messageBoard .modal-body form span.count_tip{
  320. position: absolute;
  321. bottom: 4px;
  322. right: 55px;
  323. display: inline-block;
  324. width: 564px;
  325. height: 20px;
  326. color: #979797;
  327. line-height: 20px;
  328. font-size: 12px;
  329. background: #fff;
  330. text-align: right;
  331. padding-right: 5px;
  332. }
  333. .messageBoard .modal-body form p{
  334. padding-left: 40px;
  335. text-align: left;
  336. font-size: 14px;
  337. margin: 5px;
  338. color: #333;
  339. }
  340. .messageBoard .modal-body p.radioCheck{
  341. padding-left: 65px;
  342. }
  343. .messageBoard .modal-body form input{
  344. padding: 0 10px;
  345. margin-left: 20px;
  346. height: 30px;
  347. width: 290px;
  348. font-size: 14px;
  349. color: #656565;
  350. border: #c5c5c5 1px solid;
  351. vertical-align: sub;
  352. }
  353. .messageBoard .modal-body form label{
  354. margin-right: 25px;
  355. }
  356. .messageBoard .modal-body form .img-warp{
  357. position: relative;
  358. overflow: hidden;
  359. width: 80%;
  360. margin: 0 auto;
  361. text-align: center;
  362. }
  363. .messageBoard .modal-body form div.img-item{
  364. position: relative;
  365. float: left;
  366. margin-right: 23px;
  367. width: 84px;
  368. height: 70px;
  369. cursor: pointer;
  370. border: #C9C9C9 1px solid;
  371. font-size: 14px;
  372. }
  373. .messageBoard .modal-body form div.img-item:last-child{
  374. margin-right: 0;
  375. }
  376. .messageBoard .modal-body form div.img-item input[type="file"]{
  377. position: absolute;
  378. top: 0;
  379. left: -20px;
  380. width: 84px;
  381. height: 70px;
  382. opacity: 0;
  383. }
  384. .messageBoard .modal-body form div.img-item img{
  385. display: inline-block;
  386. max-width: 80px;
  387. max-height: 60px;
  388. z-index: 10;
  389. margin-top: 4px;
  390. }
  391. .messageBoard .modal-body form p.tip{
  392. text-align: left;
  393. color: #999;
  394. font-size: 12px;
  395. padding-left: 68px;
  396. }
  397. .messageBoard .modal-body form label{
  398. margin-bottom: 10px;
  399. font-size: 14px;
  400. font-weight: normal;
  401. }
  402. .messageBoard .modal-body form input[type='text']{
  403. width: 295px;
  404. }
  405. .messageBoard .modal-body form button{
  406. margin: 10px auto;
  407. width: 100px;
  408. height: 35px;
  409. background: #4777C6;
  410. color: #fff;
  411. border-radius: 0;
  412. text-align: center;
  413. }
  414. .messageBoard .modal-body form .msg-message>label{
  415. font-size: 14px;
  416. }
  417. .messageBoard .modal-body form .msg-message span{
  418. margin: 0 auto;
  419. font-size: 12px;
  420. margin-left: 5px;
  421. }
  422. .messageBoard .modal-body form .input-style span{
  423. color: #666;
  424. }
  425. .messageBoard .modal-body form .msg-message span i{
  426. padding-right: 5px;
  427. color: #4777C6;
  428. }
  429. .messageBoard .modal-body form b{
  430. margin-right: 5px;
  431. font-weight: bold;
  432. color: #FF5A5C;
  433. }
  434. .messageBoard .modal-body form b.first{
  435. position: relative;
  436. top: -95px;
  437. left: 2px;
  438. }
  439. .messageBoard .modal-body .history{
  440. border-collapse: collapse;
  441. margin: 10px auto;
  442. padding: 0 20px;
  443. width: 500px;
  444. min-height: 105px;
  445. font-size: 16px;
  446. color: #333;
  447. border-bottom: 1px dashed #c5c5c5;
  448. }
  449. .messageBoard .modal-body .msg-table{
  450. /*position: absolute;*/
  451. overflow: auto;
  452. height: 372px;
  453. width: 670px;
  454. margin-top: 10px;
  455. }
  456. .messageBoard .modal-body .msg-table .form-group{
  457. margin-bottom: 15px;
  458. }
  459. .messageBoard .modal-body .msgDate {
  460. padding-right: 55px;
  461. text-align: right;
  462. font-size: 13px;
  463. }
  464. .messageBoard .modal-body .question{
  465. margin-bottom: 10px;
  466. font-size: 12px;
  467. font-weight: normal;
  468. list-style-type: none;
  469. font-style: inherit;
  470. }
  471. .messageBoard .modal-body .answer{
  472. margin-bottom: 10px;
  473. color: #fa842d;
  474. font-size: 12px;
  475. font-weight: normal;
  476. list-style-type: none;
  477. font-style: inherit;
  478. }
  479. .messageBoard .msg-slide1{
  480. position: absolute;
  481. right: 0;
  482. top: 50%;
  483. width: 33px;
  484. height: 100px;
  485. margin-top: -50px;
  486. background: url("/images/messageBoard/circle-left.png") no-repeat top right;
  487. color: #fff;
  488. cursor: pointer;
  489. }
  490. .messageBoard .msg-slide1 span{
  491. display: inline-block;
  492. width: 20px;
  493. height: 40px;
  494. padding-top: 16px;
  495. margin-left: 13px;
  496. text-align: center;
  497. vertical-align: middle;
  498. }
  499. .messageBoard .msg-slide1 i{
  500. position: absolute;
  501. top: 50%;
  502. left: 2px;
  503. line-height: 20px;
  504. margin-top: -10px;
  505. font-size: 26px;
  506. }
  507. .messageBoard .msg-slide2{
  508. width: 33px;
  509. height: 100px;
  510. position: absolute;
  511. top: 50%;
  512. left: 0;
  513. margin-top: -50px;
  514. background: url("/images/messageBoard/circle-right.png") no-repeat top right;
  515. color: #fff;
  516. cursor: pointer;
  517. }
  518. .messageBoard .msg-slide2 span{
  519. display: inline-block;
  520. width: 20px;
  521. height: 40px;
  522. padding-top: 16px;
  523. margin-right: 13px;
  524. text-align: center;
  525. vertical-align: middle;
  526. }
  527. .messageBoard .msg-slide2 i{
  528. position: absolute;
  529. top: 50%;
  530. right: 2px;
  531. line-height: 20px;
  532. margin-top: -10px;
  533. font-size: 26px;
  534. }
  535. .msg-message{
  536. text-align: left;
  537. margin-bottom: 5px;
  538. height: 30px;
  539. line-height: 30px;
  540. }
  541. .msg-message .msg-content label{
  542. margin-left: 75px;
  543. margin-right: 0 !important;
  544. }
  545. .msg-message .modal-body div.txtArea{
  546. padding-left: 55px;
  547. }
  548. .messageBoard .modal-body form p.radioLabel{
  549. margin-bottom: 10px;
  550. }
  551. .radioLabel {
  552. line-height: 20px;
  553. cursor: pointer;
  554. color: #666;
  555. }
  556. .radioLabel label{
  557. width: 16px;
  558. height: 16px;
  559. background: url("/images/messageBoard/radio.png");
  560. background-position: 0 -1px;
  561. margin-right: 2px;
  562. vertical-align: middle;
  563. margin-bottom: 0 !important;
  564. margin-right: 0 !important;
  565. }
  566. .radioLabel input[type="radio"]:checked + label {
  567. background-position: -19px -1px;
  568. }
  569. .radioLabel input[type="radio"] + label + span {
  570. margin-left: 5px;
  571. }
  572. .radioLabel input[type="radio"]:checked + label + span{
  573. color: #5078cb;
  574. }
  575. .radioLabel input[type="radio"]{
  576. display: none;
  577. }
  578. </style>