Prechádzať zdrojové kódy

pc、app手机号绑定事件

TANGSHIZHE 4 rokov pred
rodič
commit
5bd60536e2

+ 0 - 2
jydocs-mobile/src/views/details/details.vue

@@ -247,7 +247,6 @@ export default class extends Vue {
   }
 
   uploaded () {
-    Toast('点击按钮')
     if (this.buyed === 1) {
       this.getDown({ docId: this.docIds }).then((res: any) => {
         if (res.error_code === 0) {
@@ -255,7 +254,6 @@ export default class extends Vue {
         }
       })
     } else {
-      console.log('111')
       if (this.coins.balance < this.detailData.price) {
         ;(this.$refs.charge as any).show = true
       } else {

+ 18 - 9
jydocs-mobile/src/views/purchase/purchase.vue

@@ -51,7 +51,7 @@
     <div class="j-footer exchange_footer">
       <div class="apply_detail">
         <div class="det_left">
-          支付积分
+          支付剑鱼币
         </div>
         <div class="det_right">
           <span class="det_money">{{response.price}}</span>
@@ -59,7 +59,7 @@
         </div>
       </div>
       <div class="readly">
-        <van-checkbox v-model="checked" checked-color="#2ABED1" >我已阅读并同意<a href="javascript:;" class="clause" @click="clause()">《剑鱼文库线上购买及服务条款》</a><a href="javascript:;" class="clause" @click="clause2()">《剑鱼标讯产品与服务线上购买服务条款》</a></van-checkbox>
+        <van-checkbox v-model="checked" checked-color="#2ABED1" @click="checkBtn()">我已阅读并同意<a href="javascript:;" class="clause" @click="clause()">《剑鱼文库线上购买及服务条款》</a><a href="javascript:;" class="clause" @click="clause2()">《剑鱼标讯产品与服务线上购买服务条款》</a></van-checkbox>
       </div>
       <div class="apply_footer">
         <button class="apply_button" :disabled="!this.btnChecked" @click="exchange()">确定兑换</button>
@@ -72,7 +72,7 @@
 import { Component, Vue } from 'vue-property-decorator'
 import { Checkbox, CheckboxGroup, Field, CellGroup, Form } from 'vant'
 import { mapActions } from 'vuex'
-// import { getDocPay } from '../../api/main'
+import { isWeiXinBrowser, formatSize } from '../../utils/globalFunctions'
 @Component({
   name: 'purchase-page',
   components: {
@@ -97,7 +97,7 @@ export default class extends Vue {
   protected getListDetail!: any
   protected getAccountInfo!: any
   checked = false
-  btnChecked = true
+  btnChecked = false
   tel = ''
   regPhoneExg = /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57]|19[0-9])[0-9]{8}$/
   query: any
@@ -119,13 +119,16 @@ export default class extends Vue {
   }
 
   validator (val: any) {
-    console.log(val)
     if (this.tel === '') {
       return true
     }
     return this.regPhoneExg.test(val)
   }
 
+  checkBtn () {
+    this.getBool(this.validator(this.tel))
+  }
+
   // 判断按钮是否可以点击
   iptValue () {
     let bool = this.validator(this.tel)
@@ -134,6 +137,10 @@ export default class extends Vue {
     } else {
       bool = false
     }
+    this.getBool(this.validator(this.tel))
+  }
+
+  getBool (bool) {
     if (this.checked === true && bool === true) {
       this.btnChecked = true
     } else {
@@ -158,7 +165,7 @@ export default class extends Vue {
         this.response.docName = item.docName
         this.response.price = item.price
         this.response.downTimes = item.downTimes
-        this.response.docFileSize = item.docFileSize
+        this.response.docFileSize = formatSize(item.docFileSize)
         this.response.docPageSize = item.docPageSize
         this.response.previewImgId = item.previewImgId
       }
@@ -191,9 +198,11 @@ export default class extends Vue {
 
   // 剑鱼标讯产品与服务线上购买服务条款
   clause2 () {
-    // app:https://app-a2.jianyu360.com/jyapp/front/staticPage/dataExport_serviceterms.html
-    // this.$router.push('/readme')
-    // wx:https://www.jianyu360.com/front/staticPage/wx-serviceterms.html
+    if (!isWeiXinBrowser) {
+      location.href = '/front/staticPage/wx-serviceterms.html'
+    } else {
+      location.href = '/jyapp/front/staticPage/dataExport_serviceterms.html'
+    }
   }
 }
 </script>

+ 26 - 15
jydocs-pc/src/views/purchase/purchase.vue

@@ -60,7 +60,7 @@
           </div>
         </div>
         <div class="doc_agreement">
-          <el-checkbox v-model="checked" >我已阅读并同意<a href="/front/staticPage/serviceterms.html" class="agree_link">《剑鱼标讯线上购买与服务条款》</a></el-checkbox>
+          <el-checkbox v-model="checked" @change="checkBtn()">我已阅读并同意<a href="/front/staticPage/serviceterms.html" class="agree_link">《剑鱼标讯线上购买与服务条款》</a></el-checkbox>
         </div>
         <div class="doc_surepur">
           <button class="btnsure" @click="setExhange()" :disabled="!this.btnChecked" id="btnsure">确定兑换</button>
@@ -143,26 +143,37 @@ export default {
         }
       })
     },
-    // 手机号输入事件
-    getValue () {
+    
+    getBool (bool) {
+      if (this.checked === true && bool === true) {
+        this.btnChecked = true
+      } else {
+        this.btnChecked = false
+      }
+    },
+    inputEvent () {
       var regex = /^(0|\+?86|17951)?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8}$/
       var bool = regex.test(this.tel)
-      if (bool || this.tel === '') {
+      console.log(bool)
+      if (this.tel === '') {
         this.setShow = false
-        this.phoneChecked = true
+        bool = true
       } else {
-        this.setShow = true
-        this.phoneChecked = false
+        if (bool) {
+          this.setShow = false
+        } else {
+          this.setShow = true
+        }
       }
-      this.btnSure()
+      this.getBool(bool)
     },
-    // 判断按钮是否可以点击
-    btnSure () {
-      if (this.checked === true && this.phoneChecked === true) {
-        this.btnChecked = true
-      } else {
-        this.btnChecked = false
-      }
+    // 手机号输入事件
+    getValue () {
+      this.inputEvent()
+    },
+    // 复选框点击事件
+    checkBtn () {
+      this.inputEvent()
     }
   }
 }