Parcourir la source

剩余分享和活动

huyajie il y a 6 ans
Parent
commit
b3dd7c8316

+ 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/discount3.png


BIN
src/assets/awards/discount5.png


BIN
src/assets/awards/discount8.png


BIN
src/assets/awards/shiwu.png


BIN
src/assets/cash_address/submit.png


BIN
src/assets/cash_address/submit2222.png


+ 5 - 3
src/common/api.js

@@ -16,8 +16,10 @@ const apis = {
   points_list: `${api}/activity/user/points-list`, /*  */
   prize_list: `${api}/activity/sports-bet/prize-list`, /*  */
   bet_dict: `${api}/activity/sports-bet/bet-dict`, /*  */
-  login: `${api}/h5/login/sms-send`,
-  get_prefix: `${api}user/country-list`, /* 获取所有国家编号 */
-  get_prefix2: `http://testapi.hoolihome.com/user/country-list` /* 获取所有国家编号 */
+  get_prefix: `${api}/user/country-list`, /* 获取所有国家编号 */
+  // 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` /* 提交 */
 }
 export default apis

+ 1 - 1
src/common/net.js

@@ -19,7 +19,7 @@ const net = {
     return new Promise((resolve, reject) => {
       params.data = utils.deepClone(params.data) || {}
       let userToken = utils.storage.fetch('userToken')
-      params.data.showType = 'mobile'
+      // params.data.showType = 'mobile'
       if (userToken) {
         params.data.token = userToken
       }

+ 96 - 27
src/components/Awards.vue

@@ -10,15 +10,19 @@
                 <li v-for="(item,index) in list" :key="index">
                     <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="">
-                    <img v-else-if="item.canExchange == '1'" src="../assets/awards/red_awards_btn.png" alt="" @click="awardsBtn()">
+                    <img v-if="item.canExchange == '0'" src="../assets/awards/gray_awards_btn.png" alt="" @click="goldInsufficient">
+                    <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="popup2" class="conceal_tier" @click="popupHide"/>
-        <div v-show="popup2" class="exchange_succeed3"/>
+        <div v-show="popup2" class="exchange_succeed3">
+            <div class="popup2_yes_btn" @click="popup2YesBtn"/>
+        </div>
         <!-- 实物邮寄地址 -->
         <div v-show="popup" class="conceal_tier"/>
         <div v-show="popup" class="address">
@@ -48,14 +52,18 @@
 <script>
 import apis from '@/common/api.js'
 import net from '@/common/net.js'
-import { Toast } from 'mint-ui'
+import { Toast, Indicator } from 'mint-ui'
 import utils from '@/common/utils.js'
-import { Indicator } from 'mint-ui'
+import Login from '@/components/login'
 
 export default {
   name: 'Awards',
+  components: {
+    Login
+  },
   data () {
     return {
+      showLogin: false,
       parms: {
         phone: '',
         name: '',
@@ -64,8 +72,9 @@ export default {
       mobile: null,
       popup: false,
       popup2: false,
-
+      prizeId: '',
       pointsTotal: '',
+      name: '',
       list: [
         {
           // name: 'name',
@@ -85,14 +94,30 @@ export default {
     this.loadList()
   },
   methods: {
-    popupHide () {
+    goldInsufficient () {
+      Toast('金币不足')
+    },
+    close () {
+      this.showLogin = false
+    },
+    backBtn1 () {
+      this.$router.push({path: '/Home'})
+    },
+    login () {
+      this.showLogin = false
+    },
+    popup2YesBtn () {
+      Toast(this.name + '奖品兑换成功')
       this.popup2 = false
     },
+    popupHide () {
+      // this.popup2 = false
+    },
     backBtn2 () {
       this.popup = false
     },
     submit () {
-      var reg = /^1[3|4|5|6|7|8][0-9]\d{4,8}$/
+      // var reg = /^1[3|4|5|6|7|8][0-9]\d{4,8}$/
       if (!this.parms.name) {
         Toast('请输入姓名')
         return
@@ -100,22 +125,53 @@ export default {
       if (!this.parms.phone) {
         Toast('请输入手机号码')
         return false
-      } else if (!reg.test(this.parms.phone)) {
-        alert('手机格式不正确')
-        return false
-      } else {
-        // alert('成功')
-        this.$router.push({
-          path: '/Home'
-        })
       }
       if (!this.parms.name) {
         Toast('请输入地址')
         return false
       }
+      let params = {}
+      params.url = apis.create_order
+      params.data = {
+        activityId: utils.storage.fetch('activiType').activityId,
+        goodsId: this.prizeId,
+        name: this.parms.name,
+        mobile: this.parms.phone,
+        address: this.parms.address
+      }
+      params.method = 'POST'
+      net.req(params).then((data) => {
+        Indicator.close() // mint ui
+
+        if (data.code == 0) {
+          console.log(data)
+          Toast('十日内发货')
+          this.popup = false
+        }
+      }, (e) => {
+        console.log(22, e)
+      })
     },
-    awardsBtn () {
-      this.popup2 = true
+    awardsBtn (i, x, n) {
+      let lastTime = new Date().getTime() / 1000
+      let nowTime = new Date('2018-07-30 23:59:59').getTime() / 1000
+      // 判断是否超过兑换时间
+      if (lastTime > nowTime) {
+        Toast('非兑换有效时间')
+        return false
+      }
+      // 判断是否登陆
+      if (utils.checkIsLogin()) {
+        this.prizeId = x
+        this.name = n
+        if (i != 1) {
+          this.popup2 = true
+        } else {
+          this.popup = true
+        }
+      } else {
+        this.showLogin = true
+      }
     },
     backBtn () {
       this.$router.push({
@@ -123,7 +179,6 @@ export default {
       })
     },
     loadList () {
-      alert(1111)
       let params = {}
       params.url = apis.prize_list
       params.data = {
@@ -132,8 +187,6 @@ export default {
       }
       params.method = 'POST'
       net.req(params).then((data) => {
-        alert(22)
-
         Indicator.close() // mint ui
 
         if (data.code == 0) {
@@ -275,16 +328,26 @@ export default {
 .exchange_succeed3 {
     display: block;
     margin: auto;
-    width: 3.2rem;
-    height: 1.17rem;
-    background: url(../assets/home/back_btn.png) no-repeat center center;
+    width: 10.19rem;
+    height: 9.01em;
+    background: url(../assets/awards/discount3.png) no-repeat center center;
     background-size: cover;
     position: absolute;
-    margin-top: 1rem;
+    top: 50%;
     left: 50%;
-    transform: translateX(-50%);
+    margin-left: -5.1rem;
+    margin-top: -4.5rem;
     z-index: 100;
 }
+.popup2_yes_btn {
+    position: absolute;
+    width: 42%;
+    height: 1.3rem;
+    background-color: red;
+    opacity: .5;
+    bottom: .1rem;
+    left: 18%;
+}
 .user_address,.user_phone,.user_name {
   width: 100%;
 }
@@ -317,11 +380,14 @@ export default {
     display: inline-block;
     width: 3.2rem;
     height: 1.17rem;
-    background: url(../assets/home/back_btn.png) no-repeat center center;
+    background: url(../assets/cash_address/submit.png) no-repeat center center;
     background-size: contain;
     margin-top: 1rem;
     border: none;
     margin-left: .3rem;
+    -webkit-appearance: none;
+    -moz-appearance: none;
+    outline: none;
 }
 .back_btn2 {
       display: inline-block;
@@ -332,5 +398,8 @@ export default {
     margin-top: 1rem;
     border: none;
     margin-left: .6rem;
+    -webkit-appearance: none;
+    -moz-appearance: none;
+    outline: none;
 }
 </style>

+ 10 - 13
src/components/Matches.vue

@@ -98,7 +98,7 @@ export default {
       this.$router.push({path: '/Home'})
     },
     login () {
-      this.showLogin = true
+      this.showLogin = false
     },
     getWin (x1, x2) {
       if (x1 == x2) {
@@ -113,18 +113,14 @@ export default {
     },
     guessBtn (e) {
       if (utils.checkIsLogin()) {
-        this.$router.push({
-          path: '/login'
-        })
-        // 取公共的 activity值
-        // let activityId = utils.storage.fetch('activiType').activityId
-        // var params = {
-        //   competitionId: e.competitionId,
-        //   activityId: activityId,
-        //   showType: 'mobile',
-        //   beautiful: true
-        // }
-        // this.$router.push({path: '/guess', query: params})
+        let activityId = utils.storage.fetch('activiType').activityId
+        var params = {
+          competitionId: e.competitionId,
+          activityId: activityId,
+          showType: 'mobile',
+          beautiful: true
+        }
+        this.$router.push({path: '/guess', query: params})
       } else {
         this.showLogin = true
       }
@@ -171,6 +167,7 @@ export default {
     opacity: .65;
     z-index: 10;
     position: absolute;
+    // display: none;
 }
 .trophy {
     width: 2.84rem;

+ 74 - 177
src/components/login.vue

@@ -9,15 +9,13 @@
                 <li class="clearfix">
                     <p>手机号:</p>
                     <div class="user_phone_box">
-                        <select class="countriesSerial" name="">
+                        <select v-model="selected" class="countriesSerial" name="">
                             <template v-for="obj in countries">
-                                <option v-for="(item,index) in obj.list"  :key="index" :value="item.id">{{item.code}}</option>
+                                <!-- <option v-for="item in obj.list" v-if="item.id == 317"   :value="item.code" disabled>{{item.code}}</option> -->
+                                <option v-for="item in obj.list" :value="item.id">{{item.code}}</option>
                             </template>
 
                         </select>
-                        <!-- <select v-model="countryId" class="weui-select">
-                            <option v-for="country in countryList" v-bind:value="country.id">({{ country.code }}){{ country.name }}</option>
-                        </select> -->
                         <!-- <span class="area_code">+86</span>-->
                         <span class="triangle-down"/>
                         <span class="phone_line"/>
@@ -42,21 +40,21 @@
 
 <script>
 // 获取国家区号
-import Vue from 'vue'
 import apis from '@/common/api.js'
 import net from '@/common/net.js'
 import utils from '@/common/utils.js'
-import { Toast } from 'mint-ui'
+import { Toast, Indicator } from 'mint-ui'
 
 export default {
   name: 'Login',
   data () {
     return {
+      selected: '317',
       countries: [],
       parms: {
         phone: '',
         name: '',
-        address: ''
+        code: ''
       },
       timer: '获取验证码'
     }
@@ -72,6 +70,7 @@ export default {
   },
   mounted () {
     this.loadCountries()
+    console.log(this.selected)
   },
   methods: {
     hideLogin: function () {
@@ -81,57 +80,67 @@ export default {
       event.stopPropagation()
     },
     getCodeBtn () {
-      let tm = 5
-      let that = this
-      that.timer = tm
-      setInterval(function () {
-        if (that.timer > 0) {
-          that.timer--
-          if (that.timer == 0) {
-            that.timer = '获取验证码'
-            return false
-          }
+      let params = {}
+      params.url = apis.sms_send
+      params.data = {
+        mobile: this.parms.phone,
+        prefix: this.selected
+      }
+      params.method = 'POST'
+      net.req(params).then((data) => {
+        if (data.code == 0) {
+          let tm = 5
+          let that = this
+          that.timer = tm
+          setInterval(function () {
+            if (that.timer > 0) {
+              that.timer--
+              if (that.timer == 0) {
+                that.timer = '获取验证码'
+                return false
+              }
+            }
+          }, 1000)
         }
-      }, 1000)
+      }, (e) => {
+        console.log(111, e)
+      })
     },
     login () {
       var reg = /^((13|14|15|17|18)[0-9]{1}\d{8})$/
       if (!this.parms.name) {
         Toast('请输入姓名')
-        return
+        return false
       }
 
       if (!this.parms.phone) {
         Toast('请输入手机号码')
         return false
       }
-      if (!reg.test(this.parms.phone)) {
-        console.log(typeof this.parms.phone)
-        Toast('手机格式不正确')
-        return false
-      }
+      //   if (!reg.test(this.parms.phone)) {
+      //     // console.log(typeof this.parms.phone)
+      //     Toast('手机格式不正确')
+      //     return false
+      //   }
       if (!this.parms.code) {
         Toast('请输入验证码')
         return false
       }
       let params = {}
-      params.url = apis.login
+      params.url = apis.sms_login
       params.data = {
-        mobile: '13263287080',
-        cityId: '317'
-        // prefix: $('#cityId').val()
-        // type: '10000',
-        // showType: 'mobile',
-        // beautiful: true,
-        // order: '0',
-        // pageSize: '20',
-        // page: '1'
+        mobile: this.parms.phone,
+        prefix: this.selected,
+        name: this.parms.name,
+        code: this.parms.code
       }
       params.method = 'POST'
       net.req(params).then((data) => {
         if (data.code == 0) {
-          console.log(data)
-        //   this.list = data.data.list
+        //   console.log(data)
+
+          utils.storage.save('userToken', data.data.token)
+          this.$emit('onLogin')
         }
       }, (e) => {
         console.log(111, e)
@@ -146,145 +155,31 @@ export default {
           path: '/Home'
         })
       } */
-
-      this.$emit('onLogin')
     },
-
+    // 请求国家的手机号前缀
     loadCountries: function () {
-    //   let params = {}
-    //   params.url = apis.get_prefix2
-    //   params.data = {
-    //     t: 'wap',
-    //     c: 'phone',
-    //     l: 'cn',
-    //     v: '3.1.3',
-    //     apiVersion: 2,
-    //     sign: null
-    //   }
-    //   params.method = 'get'
-    //   net.req(params).then((data) => {
-      // Indicator.close() // mint ui
-      // let {code} = data
-      // if (parseInt(code) == 0) {
-      //   console.log(data)
-      //   this.countries = data.data
-      //   this.showLogin = true
-      // }
-    //   }, (e) => {
-      // Indicator.close() // mint ui
-      // console.log(111, e)
-    //   })
-      //   Indicator.open({
-      //     text: 'Loading...',
-      //     spinnerType: 'fading-circle'
-      //   })
+      let params = {}
+      params.url = apis.get_prefix
+      params.data = {
+        t: 'wap'
+      }
+      params.method = 'get'
+      net.req(params).then((data) => {
+        Indicator.close() // mint ui
+        let {code} = data
+        if (parseInt(code) == 0) {
+          this.countries = data.data
+          this.showLogin = true
+        }
+      }, (e) => {
+        Indicator.close() // mint ui
+        console.log(111, e)
+      })
+      Indicator.open({
+        text: 'Loading...',
+        spinnerType: 'fading-circle'
+      })
       console.log('请求国家编号')
-      this.countries = [{
-        'name': 'A',
-        'list': [{
-          'id': '3',
-          'name': '澳大利亚',
-          'code': '+61'
-        }, {
-          'id': '767',
-          'name': '爱尔兰',
-          'code': '+353'
-        }, {
-          'id': '834',
-          'name': '阿根廷',
-          'code': '+54'
-        }]
-      }, {
-        'name': 'B',
-        'list': [{
-          'id': '836',
-          'name': '巴西',
-          'code': '+55'
-        }]
-      }, {
-        'name': 'D',
-        'list': [{
-          'id': '785',
-          'name': '德国',
-          'code': '+0049'
-        }]
-      }, {
-        'name': 'H',
-        'list': [{
-          'id': '343',
-          'name': '韩国',
-          'code': '+82'
-        }, {
-          'id': '835',
-          'name': '荷兰',
-          'code': '+31'
-        }]
-      }, {
-        'name': 'J',
-        'list': [{
-          'id': '4',
-          'name': '加拿大',
-          'code': '+1'
-        }]
-      }, {
-        'name': 'M',
-        'list': [{
-          'id': '1',
-          'name': '美国',
-          'code': '+1'
-        }]
-      }, {
-        'name': 'P',
-        'list': [{
-          'id': '786',
-          'name': '葡萄牙',
-          'code': '+351'
-        }]
-      }, {
-        'name': 'R',
-        'list': [{
-          'id': '757',
-          'name': '日本',
-          'code': '+81'
-        }]
-      }, {
-        'name': 'X',
-        'list': [{
-          'id': '5',
-          'name': '新西兰',
-          'code': '+64'
-        }, {
-          'id': '730',
-          'name': '新加坡',
-          'code': '+65'
-        }, {
-          'id': '833',
-          'name': '西班牙',
-          'code': '+34'
-        }]
-      }, {
-        'name': 'Y',
-        'list': [{
-          'id': '2',
-          'name': '英国',
-          'code': '+44'
-        }, {
-          'id': '339',
-          'name': '印度',
-          'code': '+888'
-        }]
-      }, {
-        'name': 'Z',
-        'list': [{
-          'id': '317',
-          'name': '中国',
-          'code': '+86'
-        }]
-      }]
-    //   console.log(this.countries[0].name) // 这个可以取到,但是俺找个这个格式写在页面上,说 Error in render: "TypeError: Cannot read property '0' of undefined"
-
-    //   console.log(this.countries.name) //  这样 直接就是 取不到
-    //   console.log(this.countries.name) //  这样 直接就是 取不到
     }
   }
 }
@@ -350,7 +245,7 @@ export default {
 
 }
 .ct li input.user_phone {
-    padding: 0.285rem 0 0.285rem 1.9rem;
+    padding: 0.285rem 0 0.285rem 2.5rem;
     background: url(../assets/login/border_circle.png) no-repeat center center;
     background-size: 100% 100%;
 }
@@ -401,7 +296,7 @@ export default {
     width: 0.04rem;
     height: 0.75rem;
     position: absolute;
-    left: 1.85rem;
+    left: 2.3rem;
     top: .56rem;
     display: inline-block;
 }
@@ -415,7 +310,7 @@ export default {
 }
 .triangle-down {
     position: absolute;
-    left: 1.35rem;
+    left: 1.8rem;
     top: .83rem;
 width: 0;
 height: 0;
@@ -425,7 +320,6 @@ border-top: 0.3rem solid #000000;
 }
 .countriesSerial {
     position: absolute;
-    left: .2rem;
     top: .32rem;
     font-size: 0.6rem;
     color: #000000;
@@ -435,5 +329,8 @@ border-top: 0.3rem solid #000000;
     line-height: 1.32rem;
     width: 1.5rem;
     border: none;
+    -webkit-appearance: none;
+    -moz-appearance: none;
+    outline: none;
 }
 </style>

+ 13 - 13
src/views/guess.vue

@@ -18,7 +18,6 @@
                                 <img v-if="list.statusCode == '0'" src="../assets/guess/no_state.png" class="guess_btn" alt="">
                                 <img v-else-if="list.statusCode == '1'" src="../assets/guess/underway.png" class="guess_btn" alt="">
                                 <img v-else-if="list.statusCode == '2'" src="../assets/guess/end.png" class="guess_btn" alt="">
-                                <!-- <img v-bind:src="noState" class="guess_btn" alt=""> -->
                             </div>
                         </div>
                         <div class="match_ct_right flex1">
@@ -40,7 +39,6 @@
                     <img v-if="list.player1CanBet == '0'" src="../assets/guess/no_bet.png" class="bet" alt="">
                     <img v-else-if="list.player1CanBet == '1'" src="../assets/guess/may_bet.png" class="bet" alt="" @click="touchBet(list.player1Id)">
                 </div>
-                <!-- <img :src="countryRightRediusImg" class="country_right_radius_img" alt=""> -->
             </div>
             <div class="right_win">
                 <div class="right_win_people">
@@ -65,7 +63,7 @@
             <div class="select_gold clearfix">
                 <template v-for="(item,index) in listGold">
                     <span  v-if="item.canBet=='0'"  :key="index" class="left write">{{item.betPoints}}</span>
-                    <span v-else :class="{pitch_on : index == currentIndex}" :key="index" class="left normal" @click="sGoldNmb(index)">{{item.betPoints}}</span>
+                    <span v-else :class="{pitch_on : index == currentIndex}" :key="index" class="left normal" @click="sGoldNmb(index,item.betPoints)">{{item.betPoints}}</span>
                 </template>
             </div>
             <div class="select_btn clearfix">
@@ -89,6 +87,7 @@ export default {
     return {
       popup: false,
       redNumb: false,
+      correntBetPoints: '',
       currentIndex: null,
       currentBetCount: '',
       touzhuid: '',
@@ -110,16 +109,15 @@ export default {
     this.query(parm)
   },
   methods: {
-    sGoldNmb (index) {
-      this.currentIndex = index
-    //   console.log(this.currentIndex)
+    sGoldNmb (key, val) {
+      this.currentIndex = key
+      this.correntBetPoints = val
     },
     backBtn () {
       this.$router.push({path: '/index/matches'})
     },
 
     touchBet (id) {
-      alert(id)
       this.touzhuid = id
 
       //   let currentTimer = new Date().getTime() / 1000
@@ -148,6 +146,7 @@ export default {
       this.popup = true
     },
     yesBtn () {
+      // 判断点击确认时,有没有选择金币
       // console.log(this.listGold.player2Id)
     //   if (this.currentIndex == null) {
     //     alert('选择')
@@ -157,25 +156,25 @@ export default {
     //   return false
     //   console.log(this.touzhuid)
       let params = {}
-      let aa = this.$route.query.competitionId
       params.url = apis.bet
       params.data = {
         activityId: utils.storage.fetch('activiType').activityId,
         teamld: this.touzhuid,
-        competitionId: aa,
-        stake: '200'
+        competitionId: this.$route.query.competitionId,
+        stake: this.correntBetPoints
       }
       params.method = 'POST'
       net.req(params).then((data) => {
         if (data.code == 0) {
           console.log(data)
+          Toast('投注成功')
         //   this.listGold = data.data.dict
         //   this.currentBetCount = data.data.currentBetCount
         }
       }, (e) => {
+        Toast('投注失败')
         console.log(111, e)
       })
-      alert('确认')
       this.popup = false
     },
     cancelBtn () {
@@ -324,8 +323,9 @@ export default {
         margin-left: .05rem;
         width: 1.6rem;
         height: 1.6rem;
-        margin-top: .025rem;
+        margin-top: .04rem;
         display: inline-block;
+        border-radius: 50%;
     }
     .bet {
         float: right;
@@ -455,7 +455,7 @@ export default {
     }
     .select_gold span.pitch_on {
         width: 2.38rem;
-        height: 0.97rem;
+        height: 0.94rem;
         background: url(../assets/guess/pitch_on.png) no-repeat center center;
         background-size: 100% 100%;
     }