MessageBoard.vue 18 KB

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