Sfoglia il codice sorgente

精修登陆,提交。以及删除部分注释代码

huyajie 6 anni fa
parent
commit
80c765cef1

+ 2 - 2
src/App.vue

@@ -28,8 +28,8 @@ export default {
     }
   },
   created () {
-    let token = 'yVJYYUYeuB5OAM16QSwQ7PWXFS0zE0TR'
-    utils.storage.save('userToken', token)
+    // let token = 'yVJYYUYeuB5OAM16QSwQ7PWXFS0zE0TR'
+    // utils.storage.save('userToken', token)
   }
 }
 </script>

BIN
src/assets/awards/discount.png


+ 3 - 2
src/common/api.js

@@ -11,7 +11,7 @@ const apis = {
   bet: `${api}/activity/sports-bet/bet`, /*  */
   summary: `${api}/activity/user/summary`, /*  */
   top_points: `${api}/activity/user/top-points`, /*  */
-  exchange: `${api}/activity/sports-bet/exchange`, /*  */
+  // exchange: `${api}/activity/sports-bet/exchange`, /*  */
   exchange_history: `${api}/activity/user/exchange-history`, /*  */
   points_list: `${api}/activity/user/points-list`, /*  */
   prize_list: `${api}/activity/sports-bet/prize-list`, /*  */
@@ -20,6 +20,7 @@ const apis = {
   // get_prefix2: `http://testapi.hoolihome.com/user/country-list`, /* 获取所有国家编号 */
   sms_send: `${api}/h5/login/sms-send`, /* 验证码 */
   sms_login: `${api}/h5/login/sms-login`, /* 登录 */
-  create_order: `${api}/h5/activity/create-order` /* 提交 */
+  update_user_info: `${api}/activity/user/update-user-info`, /* 提交 */
+  exchange: `${api}/activity/user/exchange` /* 提交地址后的兑换 */
 }
 export default apis

+ 103 - 29
src/components/Awards.vue

@@ -11,16 +11,20 @@
                     <span class="list_ct_name">{{item.name}}</span>
                     <span class="list_ct_gold">{{item.price}}</span>
                     <img v-if="item.canExchange == '0'" src="../assets/awards/gray_awards_btn.png" alt="" @click="goldInsufficient">
+                    <img v-if="item.canExchange == '2'" src="../assets/awards/gray_awards_btn.png" alt="" @click="goldOverTimer">
                     <img v-else-if="item.canExchange == '1'" src="../assets/awards/red_awards_btn.png" alt="" @click="awardsBtn(item.isVirtual,item.prizeId,item.name)">
                 </li>
             </ul>
         </div>
         <i class="back_btn" @click="backBtn"/>
         <login v-if="showLogin" @onClose="close" @onLogin="login"/>
-
+        <!-- 虚拟品兑换成功 -->
+        <div v-show="shiwuSucceed" class="conceal_tier"/>
+        <div v-show="shiwuSucceed" class="shiwu_succeed_popup"/>
         <!-- 虚拟品 -->
-        <div v-show="popup2" class="conceal_tier" @click="popupHide"/>
-        <div v-show="popup2" class="exchange_succeed3">
+        <div v-show="popup2" class="conceal_tier" />
+        <div v-show="popup2" class="exchange_succeed">
+            <p class="discount_text">{{name}}</p>
             <div class="popup2_yes_btn" @click="popup2YesBtn"/>
         </div>
         <!-- 实物邮寄地址 -->
@@ -69,6 +73,8 @@ export default {
         name: '',
         address: ''
       },
+      addressId: '',
+      shiwuSucceed: false,
       mobile: null,
       popup: false,
       popup2: false,
@@ -76,11 +82,7 @@ export default {
       pointsTotal: '',
       name: '',
       list: [
-        {
-          // name: 'name',
-          // price: 'price',
-          // canExchange: 'canExchange'
-        }
+        {}
       ]
     }
   },
@@ -97,6 +99,9 @@ export default {
     goldInsufficient () {
       Toast('金币不足')
     },
+    goldOverTimer () {
+      Toast('已经超过兑换奖品的时间')
+    },
     close () {
       this.showLogin = false
     },
@@ -107,16 +112,40 @@ export default {
       this.showLogin = false
     },
     popup2YesBtn () {
-      Toast(this.name + '奖品兑换成功')
-      this.popup2 = false
-    },
-    popupHide () {
-      // this.popup2 = false
+      let params = {}
+      params.url = apis.exchange
+      params.data = {
+        activityId: utils.storage.fetch('activiType').activityId,
+        prizeId: this.prizeId
+      }
+      params.method = 'POST'
+      net.req(params).then((data) => {
+        Indicator.close() // mint ui
+
+        if (data.code == 0) {
+          // console.log(data)
+          this.popup2 = false
+          Toast(this.name + '奖品兑换成功')
+        }
+      }, (e) => {
+        Indicator.close() // mint ui
+
+        Toast('奖品兑换失败')
+        this.popup2 = false
+        console.log(e)
+      })
     },
+    // popupHide () {
+    //   // this.popup2 = false
+    // },
     backBtn2 () {
       this.popup = false
     },
     submit () {
+      Indicator.open({
+        text: 'Loading...',
+        spinnerType: 'fading-circle'
+      })
       // var reg = /^1[3|4|5|6|7|8][0-9]\d{4,8}$/
       if (!this.parms.name) {
         Toast('请输入姓名')
@@ -126,30 +155,52 @@ export default {
         Toast('请输入手机号码')
         return false
       }
-      if (!this.parms.name) {
+      if (isNaN(this.parms.phone) === true) {
+        Toast('手机号码格式不正确')
+        return false
+      }
+      if (!this.parms.address) {
         Toast('请输入地址')
         return false
       }
       let params = {}
-      params.url = apis.create_order
+      params.url = apis.update_user_info
       params.data = {
-        activityId: utils.storage.fetch('activiType').activityId,
-        goodsId: this.prizeId,
-        name: this.parms.name,
+        actionCode: 1,
+        userName: this.parms.name,
         mobile: this.parms.phone,
-        address: this.parms.address
+        addressDetail: this.parms.address
       }
       params.method = 'POST'
       net.req(params).then((data) => {
-        Indicator.close() // mint ui
-
+        this.addressId = data.data.addressId
         if (data.code == 0) {
-          console.log(data)
-          Toast('十日内发货')
-          this.popup = false
+          Indicator.close() // mint ui
+          let params = {}
+          params.url = apis.exchange
+          params.data = {
+            activityId: utils.storage.fetch('activiType').activityId,
+            prizeId: this.prizeId,
+            addressId: this.addressId
+          }
+          params.method = 'POST'
+          net.req(params).then((data) => {
+            if (data.code == 0) {
+              // console.log(data)
+              this.shiwuSucceed = true
+              this.popup = false
+              let that = this
+              setTimeout(function () {
+                that.shiwuSucceed = false
+              }, 3000)
+            }
+          }, (e) => {
+            console.log(e)
+          })
         }
       }, (e) => {
-        console.log(22, e)
+        Indicator.close() // mint ui
+        console.log(e)
       })
     },
     awardsBtn (i, x, n) {
@@ -190,7 +241,7 @@ export default {
         Indicator.close() // mint ui
 
         if (data.code == 0) {
-          console.log(data)
+          // console.log(data)
           this.list = data.data.list
           this.pointsTotal = data.data.currentPointsTotal
         }
@@ -325,12 +376,12 @@ export default {
   left: 2.335rem;
   font-size: .5555555rem;
 }
-.exchange_succeed3 {
+.exchange_succeed {
     display: block;
     margin: auto;
     width: 10.19rem;
     height: 9.01em;
-    background: url(../assets/awards/discount3.png) no-repeat center center;
+    background: url(../assets/awards/discount.png) no-repeat center center;
     background-size: cover;
     position: absolute;
     top: 50%;
@@ -339,11 +390,34 @@ export default {
     margin-top: -4.5rem;
     z-index: 100;
 }
+.shiwu_succeed_popup {
+    display: block;
+    margin: auto;
+    width: 10.19rem;
+    height: 7.2em;
+    background: url(../assets/awards/shiwu.png) no-repeat center center;
+    background-size: cover;
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    margin-left: -5.1rem;
+    margin-top: -5.5rem;
+    z-index: 100;
+}
+.discount_text {
+    position: absolute;
+    top: 43%;
+    font-size: .6rem;
+    padding: 0 .2rem;
+    margin-left: 6%;
+    background-color: #FCDB00;
+    border-radius: 1rem;
+}
 .popup2_yes_btn {
     position: absolute;
     width: 42%;
     height: 1.3rem;
-    background-color: red;
+    // background-color: red;
     opacity: .5;
     bottom: .1rem;
     left: 18%;

+ 7 - 20
src/components/login.vue

@@ -60,13 +60,7 @@ export default {
     }
   },
   created: function () {
-    // let token = {
-    //   showType: 'mobile',
-    //   token: 'yVJYYUYeuB5OAM16QSwQ7PWXFS0zE0TR'
-    // }
-    // utils.storage.save('token', token)
-    // this.loder()
-    // this.login()
+
   },
   mounted () {
     this.loadCountries()
@@ -89,7 +83,7 @@ export default {
       params.method = 'POST'
       net.req(params).then((data) => {
         if (data.code == 0) {
-          let tm = 5
+          let tm = 60
           let that = this
           that.timer = tm
           setInterval(function () {
@@ -107,16 +101,19 @@ export default {
       })
     },
     login () {
-      var reg = /^((13|14|15|17|18)[0-9]{1}\d{8})$/
+    //   var reg = /^((13|14|15|17|18)[0-9]{1}\d{8})$/
       if (!this.parms.name) {
         Toast('请输入姓名')
         return false
       }
-
       if (!this.parms.phone) {
         Toast('请输入手机号码')
         return false
       }
+      if (isNaN(this.parms.phone) === true) {
+        Toast('手机号码格式不正确')
+        return false
+      }
       //   if (!reg.test(this.parms.phone)) {
       //     // console.log(typeof this.parms.phone)
       //     Toast('手机格式不正确')
@@ -145,16 +142,6 @@ export default {
       }, (e) => {
         console.log(111, e)
       })
-      // alert('成功')
-      /* if (this.$route.query.backUrl) {
-        this.$router.push({
-          path: this.$route.query.backUrl
-        })
-      } else {
-        this.$router.push({
-          path: '/Home'
-        })
-      } */
     },
     // 请求国家的手机号前缀
     loadCountries: function () {

+ 3 - 9
src/views/My.vue

@@ -22,8 +22,8 @@ export default {
   data () {
     return {
       list: {
-        // currentPointsTotal: 'currentPointsTotal',
-        // remainShareTimes: 'remainShareTimes'
+        currentPointsTotal: 'currentPointsTotal',
+        remainShareTimes: 'remainShareTimes'
       }
     }
   },
@@ -59,13 +59,7 @@ export default {
       let params = {}
       params.url = apis.summary
       params.data = {
-        // userToken: utils.storage.fetch('userToken'),
-        // type: '10000',
-        // showType: 'mobile',
-        // beautiful: true,
-        // order: '0',
-        // pageSize: '20',
-        // page: '1'
+        activityId: utils.storage.fetch('activiType').activityId
       }
       params.method = 'POST'
       console.log(params)

+ 8 - 3
src/views/detail.vue

@@ -16,14 +16,13 @@
 import apis from '@/common/api.js'
 import net from '@/common/net.js'
 import utils from '@/common/utils.js'
+import { Toast, Indicator } from 'mint-ui'
 export default {
   name: 'detail',
   data () {
     return {
       list: [
         {
-          // description: 'description',
-          // pointsShow: 'pointsShow'
         }
       ]
     }
@@ -38,6 +37,10 @@ export default {
       })
     },
     loadList () {
+      Indicator.open({
+        text: 'Loading...',
+        spinnerType: 'fading-circle'
+      })
       let params = {}
       params.url = apis.points_list
       params.data = {
@@ -49,10 +52,12 @@ export default {
       params.method = 'POST'
       net.req(params).then((data) => {
         if (data.code == 0) {
-          //   Indicator.close()   //mint ui
+          Indicator.close() // mint ui
           this.list = data.data.list
         }
       }, (e) => {
+        Indicator.close() // mint ui
+
         console.log(111, e)
       })
     }

+ 11 - 4
src/views/exchangeRecord.vue

@@ -23,14 +23,13 @@
 <script>
 import apis from '@/common/api.js'
 import net from '@/common/net.js'
+import { Toast, Indicator } from 'mint-ui'
 export default {
   name: 'exchangeRecord',
   data () {
     return {
       list: [
         {
-          // name: 'name',
-          // price: 'price'
         }
       ]
     }
@@ -43,6 +42,10 @@ export default {
       this.$router.push({path: '/My'})
     },
     loadList () {
+      Indicator.open({
+        text: 'Loading...',
+        spinnerType: 'fading-circle'
+      })
       let params = {}
       params.url = apis.exchange_history
       params.data = {
@@ -51,12 +54,16 @@ export default {
       }
       params.method = 'POST'
       net.req(params).then((data) => {
+        Indicator.close() // mint ui
+
         if (data.code == 0) {
-          //   Indicator.close()   //mint ui
+          Indicator.close() // mint ui
           this.list = data.data.list
         }
       }, (e) => {
-        console.log(111, e)
+        Indicator.close() // mint ui
+
+        console.log(e)
       })
     }
   }

+ 12 - 30
src/views/guess.vue

@@ -71,7 +71,6 @@
                 <span class="cancel_btn right" @click="cancelBtn"/>
             </div>
         </div>
-        <!-- <login v-if="showLogin" @onLogin="login"/> -->
     </div>
 </template>
 <script>
@@ -79,7 +78,6 @@ import apis from '@/common/api.js'
 import net from '@/common/net.js'
 import utils from '@/common/utils.js'
 import { Toast } from 'mint-ui'
-// import Login from '@/components/login'
 
 export default {
   name: 'guess',
@@ -96,15 +94,9 @@ export default {
       listGold: [
 
       ]
-    //   components: {
-    //     Login
-    //   },
-    //   showLogin: false
     }
   },
   created: function () {
-    // let {tabActive} = this.$route.params
-    // this.tabActive = tabActive
     let parm = this.$route.query
     this.query(parm)
   },
@@ -120,14 +112,6 @@ export default {
     touchBet (id) {
       this.touzhuid = id
 
-      //   let currentTimer = new Date().getTime() / 1000
-      //   let playTimer = this.list.startTimeUnix / 1000
-      //   let playTimer2 = playTimer + 2700
-      // 判断是否超过投注时间
-      //   if (currentTimer > playTimer2) {
-      //     Toast('当前不可投注')
-      //   }
-      //   this.showLogin = true
       let params = {}
       params.url = apis.bet_dict
       params.data = {
@@ -147,14 +131,10 @@ export default {
     },
     yesBtn () {
       // 判断点击确认时,有没有选择金币
-      // console.log(this.listGold.player2Id)
-    //   if (this.currentIndex == null) {
-    //     alert('选择')
-    //     return false
-    //   }
-    //   console.log(this.listGold[this.currentIndex])
-    //   return false
-    //   console.log(this.touzhuid)
+      if (this.currentIndex == null) {
+        Toast('请选择投注金币数量')
+        return false
+      }
       let params = {}
       params.url = apis.bet
       params.data = {
@@ -166,18 +146,20 @@ export default {
       params.method = 'POST'
       net.req(params).then((data) => {
         if (data.code == 0) {
-          console.log(data)
+        //   console.log(data)
           Toast('投注成功')
-        //   this.listGold = data.data.dict
-        //   this.currentBetCount = data.data.currentBetCount
+          this.currentIndex = null
         }
       }, (e) => {
         Toast('投注失败')
+        this.currentIndex = null
+
         console.log(111, e)
       })
       this.popup = false
     },
     cancelBtn () {
+      this.currentIndex = null
       this.popup = false
     },
     query (parm) {
@@ -186,7 +168,7 @@ export default {
       params.data = parm
       params.method = 'POST'
       net.req(params).then((data) => {
-        console.log(data)
+        // console.log(data)
         if (data.code == 0) {
           this.list = data.data
         }
@@ -381,7 +363,7 @@ export default {
         right: 0;
         background-color: #000000;
         opacity: .7;
-        z-index: 10001;
+        z-index: 10;
     }
     .bet_popup {
         width: 80%;
@@ -394,7 +376,7 @@ export default {
         left: 50%;
         right: 0;
         transform: translate(-50%,-50%);
-        z-index: 10002;
+        z-index: 11;
         font-weight: bold;
     }
     .bet_popup_hd {