MessageBoard.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  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. <button class="btn" @click="confirm">提交</button>
  102. </form>
  103. </div>
  104. <div class="msg-table" v-else-if="!showHistory && user.userUU">
  105. <div class="history" v-for="message in messageBoardCurrent.content">
  106. <div class="form-group row">
  107. <div class="col-xs-8">{{message.type}}</div>
  108. <div class="msgDate col-xs-4">{{message.createDate | date}}</div>
  109. </div>
  110. <div class="question">
  111. <span>问题:</span>
  112. <span style="word-break: break-all">{{message.question}}</span>
  113. </div>
  114. <div class="answer" v-show="message.answer" style="margin-bottom: 10px;">
  115. <span>回复:</span>
  116. <span style="word-break: break-all">{{message.answer}}</span>
  117. </div>
  118. </div>
  119. <div class="text-center" v-if="!messageBoardCurrent || messageBoardCurrent.length === 0">
  120. <div>无留言记录</div>
  121. </div>
  122. </div>
  123. <div class="page" v-if="!showHistory">
  124. <page-component
  125. :total="messageBoardCurrent.totalElements"
  126. :page-size="pageParams.count"
  127. :current="pageParams.page"
  128. v-on:childEvent="listenPage">
  129. </page-component>
  130. </div>
  131. <div class="msg-slide1" @click="isOpenHistory" v-if="showHistory">
  132. <i class="fa fa-angle-left"></i><span>留言记录</span>
  133. </div>
  134. <div class="msg-slide2" @click="isHideHistory" v-if="!showHistory">
  135. <i class="fa fa-angle-right"></i><span>关闭记录</span>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import ImageUpload from '~components/common/image-upload/imageUpload.vue'
  142. import PageComponent from '~components/common/page/pageComponent.vue'
  143. export default {
  144. name: 'messageBoard',
  145. data () {
  146. return {
  147. pageParams: {
  148. page: 1,
  149. count: 3,
  150. currentPage: 1,
  151. dialogVisible: false
  152. },
  153. dialogImageUrl: [],
  154. showHistory: true,
  155. isOpen: true,
  156. isLogin: false,
  157. txtVal: 0,
  158. isMobile: true,
  159. isEmail: true
  160. }
  161. },
  162. components: {
  163. ImageUpload,
  164. PageComponent
  165. },
  166. computed: {
  167. messageBoard () {
  168. console.log('messageBoard', this.$store.state.messageBoard.information.data)
  169. return this.$store.state.messageBoard.information.data
  170. },
  171. // user () {
  172. // return this.$store.state.messageBoardIsLogin.login.data
  173. // },
  174. user () {
  175. return this.$store.state.option.user.data
  176. },
  177. messageBoardCurrent () {
  178. return this.$store.state.messageBoardInformation.information.data
  179. }
  180. },
  181. filters: {
  182. date: function (num) {
  183. const d = new Date(num)
  184. const year = d.getFullYear()
  185. const month = d.getMonth() + 1 < 10 ? '0' + d.getMonth() : '' + d.getMonth()
  186. const day = d.getDay() < 10 ? '0' + d.getDay() : '' + d.getDay()
  187. return year + '-' + month + '-' + day
  188. }
  189. },
  190. methods: {
  191. listenPage (page) {
  192. this.pageParams.page = page
  193. this.$emit('pageEvent', page)
  194. },
  195. listenFile (url) {
  196. let obj = {}
  197. obj.img = url
  198. this.dialogImageUrl.push(obj)
  199. console.log(this.dialogImageUrl)
  200. },
  201. isOpendMessage () {
  202. this.$emit('openBoardEvent', false)
  203. },
  204. isOpenHistory () {
  205. this.showHistory = !this.showHistory
  206. },
  207. isHideHistory () {
  208. this.showHistory = !this.showHistory
  209. },
  210. textareaLength () {
  211. this.txtVal = this.messageBoard.question.length
  212. },
  213. // 判断手机号
  214. checkMobile () {
  215. this.isMobile = (/^[\d]{8,11}$/).test(this.messageBoard.userTel)
  216. },
  217. // 判断邮箱
  218. checkEmail () {
  219. this.isEmail = (/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/).test(this.messageBoard.email)
  220. },
  221. confirm () {
  222. // alert(message)
  223. /* let imgs = []
  224. if (message) {
  225. imgs[index] = {'img': message.img}
  226. } */
  227. 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'})
  228. }
  229. }
  230. }
  231. </script>
  232. <style scoped>
  233. /*分页*/
  234. .page {
  235. text-align: center;
  236. }
  237. .page .page-wrap{
  238. float: none;
  239. }
  240. .page-wrap ul, .page-wrap div {
  241. float: none !important;
  242. display: inline-block;
  243. margin: 0;
  244. }
  245. body,textarea,button.btn{
  246. font-family: "MicrosoftYaHei Regual", "微软雅黑" !important;
  247. }
  248. .messageBoard {
  249. width: 680px;
  250. font-size: 14px;
  251. background: #fff;
  252. }
  253. .messageBoard .modal-header {
  254. position: relative;
  255. background: url("/images/messageBoard/msg_nav.png") no-repeat left center;
  256. min-height: 0;
  257. padding: 11.5px;
  258. text-align: center;
  259. }
  260. .messageBoard .modal-header i{
  261. position: absolute;
  262. top: 5px;
  263. left: 650px;
  264. font-size: 20px;
  265. color: #fff;
  266. cursor: pointer;
  267. }
  268. .messageBoard .modal-header>h3{
  269. font-size: 18px;
  270. color: #000;
  271. }
  272. .messageBoard .modal-header .modal-title {
  273. margin-left: 30px;
  274. text-align: center;
  275. color: #fff;
  276. }
  277. .messageBoard .modal-header .modal-title span{
  278. vertical-align: middle;
  279. }
  280. .messageBoard .modal-body {
  281. padding: 10px;
  282. min-height: 445px;
  283. margin: 0 auto;
  284. width: 680px;
  285. }
  286. .messageBoard .modal-body h3{
  287. width: 680px;
  288. text-align: center;
  289. font-size: 14px;
  290. color: #333;
  291. margin: 0 0 10px 0;
  292. }
  293. .messageBoard .modal-body h3 span{
  294. color: #5078cb;
  295. }
  296. .messageBoard .modal-body form{
  297. width: 680px;
  298. text-align: center;
  299. }
  300. .messageBoard .modal-body form .txtArea{
  301. position: relative;
  302. }
  303. .messageBoard .modal-body form textarea {
  304. padding: 10px 10px 20px 10px;
  305. width: 576px;
  306. height: 110px;
  307. color: #333;
  308. border: #c5c5c5 1px solid;
  309. font-size: 13px;
  310. letter-spacing: 1px;
  311. line-height: 18px;
  312. }
  313. .messageBoard .modal-body form span.count_tip{
  314. position: absolute;
  315. bottom: 4px;
  316. right: 55px;
  317. display: inline-block;
  318. width: 564px;
  319. height: 20px;
  320. color: #979797;
  321. line-height: 20px;
  322. font-size: 12px;
  323. background: #fff;
  324. text-align: right;
  325. padding-right: 5px;
  326. }
  327. .messageBoard .modal-body form p{
  328. padding-left: 40px;
  329. text-align: left;
  330. font-size: 14px;
  331. margin: 5px;
  332. color: #333;
  333. }
  334. .messageBoard .modal-body p.radioCheck{
  335. padding-left: 65px;
  336. }
  337. .messageBoard .modal-body form input{
  338. padding: 0 10px;
  339. margin-left: 20px;
  340. height: 30px;
  341. width: 290px;
  342. font-size: 14px;
  343. color: #656565;
  344. border: #c5c5c5 1px solid;
  345. vertical-align: sub;
  346. }
  347. .messageBoard .modal-body form label{
  348. margin-right: 25px;
  349. }
  350. .messageBoard .modal-body form .img-warp{
  351. position: relative;
  352. overflow: hidden;
  353. width: 80%;
  354. margin: 0 auto;
  355. text-align: center;
  356. }
  357. .messageBoard .modal-body form div.img-item{
  358. position: relative;
  359. float: left;
  360. margin-right: 23px;
  361. width: 84px;
  362. height: 70px;
  363. cursor: pointer;
  364. border: #C9C9C9 1px solid;
  365. font-size: 14px;
  366. }
  367. .messageBoard .modal-body form div.img-item:last-child{
  368. margin-right: 0;
  369. }
  370. .messageBoard .modal-body form div.img-item input[type="file"]{
  371. position: absolute;
  372. top: 0;
  373. left: -20px;
  374. width: 84px;
  375. height: 70px;
  376. opacity: 0;
  377. }
  378. .messageBoard .modal-body form div.img-item img{
  379. display: inline-block;
  380. max-width: 80px;
  381. max-height: 60px;
  382. z-index: 10;
  383. margin-top: 4px;
  384. }
  385. .messageBoard .modal-body form p.tip{
  386. text-align: left;
  387. color: #999;
  388. font-size: 12px;
  389. padding-left: 68px;
  390. }
  391. .messageBoard .modal-body form label{
  392. margin-bottom: 10px;
  393. font-size: 14px;
  394. font-weight: normal;
  395. }
  396. .messageBoard .modal-body form input[type='text']{
  397. width: 295px;
  398. }
  399. .messageBoard .modal-body form button{
  400. margin: 10px auto;
  401. width: 100px;
  402. height: 35px;
  403. background: #4777C6;
  404. color: #fff;
  405. border-radius: 0;
  406. text-align: center;
  407. }
  408. .messageBoard .modal-body form .msg-message>label{
  409. font-size: 14px;
  410. }
  411. .messageBoard .modal-body form .msg-message span{
  412. margin: 0 auto;
  413. font-size: 12px;
  414. margin-left: 5px;
  415. }
  416. .messageBoard .modal-body form .input-style span{
  417. color: #666;
  418. }
  419. .messageBoard .modal-body form .msg-message span i{
  420. padding-right: 5px;
  421. color: #4777C6;
  422. }
  423. .messageBoard .modal-body form b{
  424. margin-right: 5px;
  425. font-weight: bold;
  426. color: #FF5A5C;
  427. }
  428. .messageBoard .modal-body form b.first{
  429. position: relative;
  430. top: -95px;
  431. left: 2px;
  432. }
  433. .messageBoard .modal-body .history{
  434. border-collapse: collapse;
  435. margin: 10px auto;
  436. padding: 0 20px;
  437. width: 500px;
  438. min-height: 105px;
  439. font-size: 16px;
  440. color: #333;
  441. border-bottom: 1px dashed #c5c5c5;
  442. }
  443. .messageBoard .modal-body .msg-table{
  444. /*position: absolute;*/
  445. overflow: auto;
  446. height: 372px;
  447. width: 670px;
  448. margin-top: 10px;
  449. }
  450. .messageBoard .modal-body .msg-table .form-group{
  451. margin-bottom: 15px;
  452. }
  453. .messageBoard .modal-body .msgDate {
  454. padding-right: 55px;
  455. text-align: right;
  456. font-size: 13px;
  457. }
  458. .messageBoard .modal-body .question{
  459. margin-bottom: 10px;
  460. font-size: 12px;
  461. font-weight: normal;
  462. list-style-type: none;
  463. font-style: inherit;
  464. }
  465. .messageBoard .modal-body .answer{
  466. margin-bottom: 10px;
  467. color: #fa842d;
  468. font-size: 12px;
  469. font-weight: normal;
  470. list-style-type: none;
  471. font-style: inherit;
  472. }
  473. .messageBoard .msg-slide1{
  474. position: absolute;
  475. right: 0;
  476. top: 50%;
  477. width: 33px;
  478. height: 100px;
  479. margin-top: -50px;
  480. background: url("/images/messageBoard/circle-left.png") no-repeat top right;
  481. color: #fff;
  482. cursor: pointer;
  483. }
  484. .messageBoard .msg-slide1 span{
  485. display: inline-block;
  486. width: 20px;
  487. height: 40px;
  488. padding-top: 16px;
  489. margin-left: 13px;
  490. text-align: center;
  491. vertical-align: middle;
  492. }
  493. .messageBoard .msg-slide1 i{
  494. position: absolute;
  495. top: 50%;
  496. left: 2px;
  497. line-height: 20px;
  498. margin-top: -10px;
  499. font-size: 26px;
  500. }
  501. .messageBoard .msg-slide2{
  502. width: 33px;
  503. height: 100px;
  504. position: absolute;
  505. top: 50%;
  506. left: 0;
  507. margin-top: -50px;
  508. background: url("/images/messageBoard/circle-right.png") no-repeat top right;
  509. color: #fff;
  510. cursor: pointer;
  511. }
  512. .messageBoard .msg-slide2 span{
  513. display: inline-block;
  514. width: 20px;
  515. height: 40px;
  516. padding-top: 16px;
  517. margin-right: 13px;
  518. text-align: center;
  519. vertical-align: middle;
  520. }
  521. .messageBoard .msg-slide2 i{
  522. position: absolute;
  523. top: 50%;
  524. right: 2px;
  525. line-height: 20px;
  526. margin-top: -10px;
  527. font-size: 26px;
  528. }
  529. .msg-message{
  530. text-align: left;
  531. margin-bottom: 5px;
  532. height: 30px;
  533. line-height: 30px;
  534. }
  535. .msg-message .msg-content label{
  536. margin-left: 75px;
  537. margin-right: 0 !important;
  538. }
  539. .msg-message .modal-body div.txtArea{
  540. padding-left: 55px;
  541. }
  542. .messageBoard .modal-body form p.radioLabel{
  543. margin-bottom: 10px;
  544. }
  545. .radioLabel {
  546. line-height: 20px;
  547. cursor: pointer;
  548. color: #666;
  549. }
  550. .radioLabel label{
  551. width: 16px;
  552. height: 16px;
  553. background: url("/images/messageBoard/radio.png");
  554. background-position: 0 -1px;
  555. margin-right: 2px;
  556. vertical-align: middle;
  557. margin-bottom: 0 !important;
  558. margin-right: 0 !important;
  559. }
  560. .radioLabel input[type="radio"]:checked + label {
  561. background-position: -19px -1px;
  562. }
  563. .radioLabel input[type="radio"] + label + span {
  564. margin-left: 5px;
  565. }
  566. .radioLabel input[type="radio"]:checked + label + span{
  567. color: #5078cb;
  568. }
  569. .radioLabel input[type="radio"]{
  570. display: none;
  571. }
  572. </style>