Browse Source

留言板逻辑初步调整

yangc 8 years ago
parent
commit
7f2bbd71b1
2 changed files with 54 additions and 17 deletions
  1. 53 16
      components/messageBoard/MessageBoard.vue
  2. 1 1
      components/store/RecommendProduct.vue

+ 53 - 16
components/messageBoard/MessageBoard.vue

@@ -156,12 +156,12 @@
       Page
     },
     computed: {
-//      messageBoard () {
-//        return this.$store.state.messageBoard.information.data
-//      },
-//      user () {
-//        return this.$store.state.messageBoardIsLogin.login.data
-//      },
+      messageBoardInfo () {
+        return this.$store.state.messageBoard.information.data
+      },
+      logged () {
+        return this.$store.state.option.user.logged
+      },
       user () {
         return this.$store.state.option.user.data
       },
@@ -214,24 +214,61 @@
         this.isEmail = (/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/).test(this.messageBoard.email)
       },
       confirm () {
-        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'})
-        if (this.messageBoard) {
+        if (!this.logged) {
           if (!this.messageBoard.question) {
             this.$message.info('您还没有填写反馈内容')
           } else if (!this.messageBoard.role) {
             this.$message.info('请选择您的身份信息')
           } else if (!this.messageBoard.type) {
             this.$message.info('请选择一种反馈类型')
-          } else if (!this.user) {
-            if (!this.messageBoard.userTel && !this.messageBoard.email) {
-              this.$message.info('请填写任意一种联系方式')
+          } else if (!this.messageBoard.userTel && !this.messageBoard.email) {
+            this.$message.info('请填写任意一种联系方式')
+          } else {
+            console.log(this.isMobile)
+            console.log(this.isEmail)
+            if (this.isMobile === false) {
+              this.$message.info('请输入正确的手机号码')
+            } else if (this.isEmail === false) {
+              this.$message.info('请输入正确的邮箱')
+            } else {
+              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: this.messageBoard.userTel ? this.messageBoard.userTel : '',
+                email: this.messageBoard.email ? this.messageBoard.email : ''
+              })
+              this.isOpendMessage()
+              this.$message.info('感谢您的宝贵意见')
+              this.messageBoard = {}
             }
+          }
+        } else {
+          if (!this.messageBoard.question) {
+            this.$message.info('您还没有填写反馈内容')
+          } else if (!this.messageBoard.role) {
+            this.$message.info('请选择您的身份信息')
+          } else if (!this.messageBoard.type) {
+            this.$message.info('请选择一种反馈类型')
           } else {
-            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'})
-            this.isOpendMessage()
-            this.$message.info('感谢您的宝贵意见')
-//            window.location.reload()
-            this.messageBoard = {}
+            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
+            })
+            if (this.messageBoardInfo.question) {
+              this.isOpendMessage()
+              this.$message.info('感谢您的宝贵意见')
+              this.messageBoard = {}
+            } else {
+              this.$message.info('联系方式不可为空,请填写任意一种联系方式')
+            }
           }
         }
       }

+ 1 - 1
components/store/RecommendProduct.vue

@@ -3,7 +3,7 @@
     <div class="recommend-list">
       <ul>
         <li v-for="commodity in commodities">
-          <div class="img"><a href="javascript:void(0);"><img :src="commodity.comImg || '/images/store/common/default.png'"/></a></div>
+          <div class="img"><a href="javascript:void(0);"><img :src="commodity.comImg.startsWith('static')?'/'+commodity.comImg:commodity.comImg"/></a></div>
           <div class="content">
             <p v-text="commodity.comCode">MRFE6S9045NF001</p>
             <p class="color666" v-text="commodity.brandNameCn">PANFAEFQ</p>