tanyanfei 2 years ago
parent
commit
5ea0ba0744

+ 14 - 23
app.json

@@ -1,22 +1,19 @@
 {
-"pages": [
- 
-  "pages/index/index",
-  "pages/rank/rank",
-  "pages/upload/upload",
-  "pages/user/user",
-  "pages/homepage/homepage",
-  "pages/today/today",
-  "pages/rethink/rethink",
-  "pages/message/message",
-  "pages/change/change",
-  "pages/stock/stock",
-    "pages/apply/apply",
+  "pages": [
     
+    "pages/index/index",
+    "pages/rank/rank",
+    "pages/upload/upload",
+    "pages/user/user",
+    "pages/homepage/homepage",
+    "pages/today/today",
+    "pages/signup/signup",
+    "pages/rethink/rethink",
+    "pages/message/message",
+    "pages/change/change",
+    "pages/stock/stock",
+    "pages/apply/apply",
     "pages/login/user",
-    
-    
-    
     "pages/myMatchDetail/myMatchDetail",
     "pages/record/record",
     "pages/aboutus/aboutus",
@@ -25,16 +22,10 @@
     "pages/day/day",
     "pages/games/games",
     "pages/search/search",
-    
     "pages/style/style",
     "pages/detail/detail",
-    
-    
     "pages/list/list",
-    
     "pages/comment/comment"
-    
-    
   ],
   "window": {
     "backgroundTextStyle": "light",
@@ -75,4 +66,4 @@
   "style": "v2",
   "sitemapLocation": "sitemap.json",
   "lazyCodeLoading": "requiredComponents"
-}
+}

+ 6 - 30
pages/apply/apply.js

@@ -8,13 +8,16 @@ Page({
      * 页面的初始数据
      */
     data: {
-        page:2
+      type:2
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+      this.setData({
+        type:options.type
+      })
         $api.getsignup().then(res=>{
             this.setData({
                 info:res.data.data
@@ -27,35 +30,8 @@ Page({
         })
     },
     post(){
-        var data={
-            signup_type:this.data.page,
-            total_fee:this.data.info.viewer_price  
-        }
-        if(this.data.page == 2){
-            data.total_fee=this.data.info.player_price  
-            data.match_id=this.data.info.id
-            data.match_name=this.data.info.name
-        }
-        $api.wxpay(data).then(res=>{
-            var timestamp = Math.round(new Date().getTime() / 1000).toString();
-            var paySign = md5('appId=' + res.data.data.appid + '&nonceStr=' + res.data.data.nonce_str + '&package=prepay_id=' + res.data.data.prepay_id + '&signType=MD5&timeStamp=' + timestamp + '&key=' + res.data.data.key).toUpperCase();
-            console.log(paySign)
-              wx.requestPayment({
-                timeStamp: timestamp,
-                nonceStr: res.data.data.nonce_str,
-                package: 'prepay_id=' + res.data.data.prepay_id,
-                signType: 'MD5',
-                paySign: paySign,
-                success(res) { 
-                    wx.showToast({
-                      title: '报名成功',
-                    })
-                  wx.switchTab({
-                    url: '../index/index'
-                  });
-                },
-                fail(res) { console.log(res)}
-              })
+        wx.navigateTo({
+          url: '../signup/signup?type='+this.data.type,
         })
     },
     /**

+ 5 - 5
pages/apply/apply.wxml

@@ -1,9 +1,9 @@
-<view class="tab">
+<!-- <view class="tab">
     <view bindtap="tab" data-id='2' class="{{page==2?'act':''}}">比赛报名 <text></text></view>
     <view bindtap="tab" data-id='1' class="{{page==1?'act':''}}">游客报名<text></text></view>
-</view>
+</view> -->
 
-<scroll-view scroll-y='{{true}}' wx:if='{{page==2}}'>
+<scroll-view scroll-y='{{true}}' wx:if='{{type==2}}'>
         <view class="intro">想要和大佬一起同台竞技,想要近距离体验拥有海量比赛数据的比赛小程序,就来报名,一次参赛,终身使用。</view>
 
         <view class="title">{{info.name}}</view>
@@ -19,10 +19,10 @@
         </view>
         <view class="title title1">三、比赛规则</view>
         <view class="date">
-            1.所有选手参赛账户真实比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则;
+            <!-- 1.所有选手参赛账户真实比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则比赛规则; -->
         </view>
 </scroll-view>
-<scroll-view wx:if='{{page==1}}'>
+<scroll-view wx:if='{{type==1}}'>
     <view class="title">顽主杯实盘大赛</view>
         <view class="title title1">一、观赛费用</view>
         <view class="date">观赛费用:<text>{{info.viewer_price}}元(此费用为观看比赛费用)</text></view>

+ 6 - 6
pages/index/index.js

@@ -301,15 +301,15 @@ Page({
   onShow: function (e) {
     //判断是否报名
     $api.getAuthinfo().then(res=>{
-      if(res.data.data.phone == null || res.data.data.phone==''){
-        wx.navigateTo({
-          url: '../login/user',
-        })
-      }
+      // if(res.data.data.phone == null || res.data.data.phone==''){
+      //   wx.navigateTo({
+      //     url: '../login/user',
+      //   })
+      // }
     
       if(res.data.data.role==0){
         wx.navigateTo({
-          url: '../apply/apply',
+          url: '../login/user?type=3',
         })
       }
     })

+ 23 - 28
pages/login/user.js

@@ -25,7 +25,11 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    
+    if(options.type){
+      this.setData({
+        status:options.type
+      })
+    }
   },
   zx(){
     wx.navigateTo({
@@ -74,9 +78,10 @@ Page({
         return
       }
       if(res.data.data.role==0){
-        wx.navigateTo({
-          url: '../apply/apply',
+        this.setData({
+          status:3
         })
+
       }else{
         this.setData({
           usercode: res.data.data.usercode,
@@ -93,20 +98,7 @@ Page({
     })
   },
 
-  getTodayData() {
-    $api.getMineLatest().then(res=>{
-      this.setData({
-        todayinfo: res.data.data,
-        todayMoney:((res.data.data.today_fund - res.data.data.yesterday_fund)*10000).toFixed(2)
-      })
-    })
-    .catch(err=>{
-      this.setData({
-        todayinfo: {},
-        status:0
-      })
-    })
-  },
+
 
   inputchange(e) {
     this.setData({
@@ -171,6 +163,13 @@ Page({
               $api.login(data)
               .then(res=>{
                 //登录成功
+                //老用户直接进入系统
+                if(res.data.data.role != 0){
+                  wx.switchTab({
+                    url: '../index/index',
+                  })
+                }
+                //新用户
                 _this.setData({
                   status:res.data.data.status
                 })
@@ -189,11 +188,8 @@ Page({
                   key: 'userInfo',
                   data: res.data.data,
                 })
-                if(res.data.data.status == 3){
-                  wx.switchTab({
-                    url: '../index/index',
-                  })
-                }
+          
+                
                 
               })
               .catch(err=>{
@@ -231,9 +227,8 @@ Page({
 
     $api.login(logindata).then(res=>{
       if(res.data.code == 0){
-  
-        wx.switchTab({
-          url: '../user/user',
+        this.setData({
+          status:3
         })
       } 
     })
@@ -255,8 +250,8 @@ Page({
     }
     $api.bindphone({phone:this.data.phone,phcode:this.data.phcode}).then(res=>{
       if(res.data.code == 0){
-          wx.switchTab({
-            url: '../user/user',
+          this.setData({
+            status:3
           })
       }
     })
@@ -281,7 +276,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+  
 
   },
 

+ 6 - 0
pages/login/user.wxml

@@ -40,3 +40,9 @@
 </view>
 
 
+<view class="no_login" wx:if='{{status == 3}}'>
+  <navigator url="../apply/apply?type=2">选手报名</navigator>
+  <navigator url="../apply/apply?type=1">游客报名</navigator>
+  <navigator url="../message/message">顽主咨询</navigator>
+</view>
+

+ 11 - 0
pages/login/user.wxss

@@ -88,6 +88,17 @@ page{
   font-size: 32rpx;
   border-radius: 8rpx;
 }
+.no_login navigator{
+  background: #D94B24;
+  color: #fff;
+  width: 100%;
+  margin-top: 48rpx;
+  height: 88rpx;
+  line-height: 88rpx;
+  padding: 0;
+  font-size: 32rpx;
+  border-radius: 8rpx;
+}
 .no_login{
   height: 100vh;
   background: #fff;

+ 1 - 1
pages/rank/rank.wxml

@@ -12,7 +12,7 @@
     <view class="zd"></view>
     <image src="../../images/lb.png" mode="widthFix"></image>
       <view class="marquee_text">
-        <navigator hover-class="none" url="../apply/apply">第49届顽主杯实盘大赛正在报名中(报名时间:2022-05-24) </navigator>
+        <navigator hover-class="none" url="../apply/apply?type=2">第49届顽主杯实盘大赛正在报名中(报名时间:2022-05-24) </navigator>
       </view>
     </view>     
 

+ 192 - 0
pages/signup/signup.js

@@ -0,0 +1,192 @@
+// pages/user/user.js
+const app = getApp()
+var host = app.globalData.host;
+const $api = require('../../utils/api.js').API;
+import md5 from '../../utils/md5.js';//支付页面引入md5.js
+var logindata={}
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    info: {},
+    index:-1,
+    type:'',
+    phone:'',
+    phcode:'',
+    text:'获取验证码'
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      type:options.type
+    })
+    $api.getsignup().then(res=>{
+      this.setData({
+          info:res.data.data
+      })
+    })
+  },
+  bindChange(e) {
+    let match=this.data.info.groups;
+    this.setData({
+      index: e.detail.value,
+      match_group: match[e.detail.value].id
+    })
+  },
+  getcode(){
+    if(this.data.phone.length>=11){
+      $api.sendcode({phone:this.data.phone}).then(res=>{
+        this.countdown()
+      })
+    }else{
+      wx.showToast({
+        icon: 'none',
+        title: '请输入正确的手机号',
+      })
+    }
+    
+  },
+  countdown(){
+    var count=60,_this=this;
+    var timer=setInterval(c,1000)
+    function c(){
+      if(count>0){
+        count--;
+        _this.setData({
+          text:count+"s重新发送"
+        })
+      }else{
+        _this.setData({
+          text:'获取验证码'
+        })
+        clearInterval(timer)
+      }
+    }
+  },
+
+  inputchange(e) {
+    this.setData({
+      phone: e.detail.value
+    })
+  },
+  codechange(e) {
+    this.setData({
+      phcode: e.detail.value
+    })
+  },
+  post(){
+      var data={
+          signup_type:this.data.type,
+          total_fee:this.data.info.viewer_price,
+          phone:this.data.phone,
+          phcode:this.data.phcode,
+          match_group:this.data.match_group,
+          match_id:this.data.info.id,
+          match_name:this.data.info.name
+      }
+      if(this.data.type == 2){
+          data.total_fee=this.data.info.player_price  
+      }
+      if (!data.match_group) {
+        wx.showToast({
+          icon: 'none',
+          title: '请选择比赛分组',
+        })
+        return
+      }
+      if (data.phone.length<11){
+        wx.showToast({
+          icon: 'none',
+          title: '请输入正确的手机号',
+        })
+        return
+      }
+      if (!data.phcode) {
+        wx.showToast({
+          icon: 'none',
+          title: '请输入验证码',
+        })
+        return
+      }
+      $api.wxpay(data).then(res=>{
+          var timestamp = Math.round(new Date().getTime() / 1000).toString();
+          var paySign = md5('appId=' + res.data.data.appid + '&nonceStr=' + res.data.data.nonce_str + '&package=prepay_id=' + res.data.data.prepay_id + '&signType=MD5&timeStamp=' + timestamp + '&key=' + res.data.data.key).toUpperCase();
+          console.log(paySign)
+            wx.requestPayment({
+              timeStamp: timestamp,
+              nonceStr: res.data.data.nonce_str,
+              package: 'prepay_id=' + res.data.data.prepay_id,
+              signType: 'MD5',
+              paySign: paySign,
+              success(res) { 
+                  wx.showToast({
+                    title: '报名成功',
+                  })
+                wx.switchTab({
+                  url: '../index/index'
+                });
+              },
+              fail(res) { console.log(res)}
+            })
+      })
+  },
+
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+
+
+})

+ 3 - 0
pages/signup/signup.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 27 - 0
pages/signup/signup.wxml

@@ -0,0 +1,27 @@
+<view class="item"> 
+   <label>比赛分组</label>
+   <view class="tags"> 
+    <picker  value="{{index}}"  range="{{info.groups}}" range-key='name' bindchange="bindChange">
+      <view class="picker">
+      <block wx:if='{{index>=0}}'>{{info.groups[index].name}}</block>
+      <text wx:else style="color: #999;">请选择</text>
+        <image style="width:24rpx;" mode="widthFix" src="../../images/icon_down@2x.png"></image>
+      </view>
+    </picker>
+  </view>
+</view>
+<view class="item"> 
+   <label>手机号</label>
+   <view class="tags"> 
+      <input  bindinput="inputchange" placeholder-style="color:#999;" placeholder="请填写"></input> 
+  </view>
+</view>
+<view class="item"> 
+   <label>验证码</label>
+   <view class="tags yzm">
+          <input type="number" placeholder-style="color:#999" bindinput='codechange' placeholder="请输入验证码"></input>
+          <view bindtap="getcode" wx:if="{{text=='获取验证码'}}">{{text}}</view>
+          <view class="disabled" wx:else>{{text}}</view>
+    </view>
+</view>
+<button bindtap="post">提交</button>

+ 91 - 0
pages/signup/signup.wxss

@@ -0,0 +1,91 @@
+/* pages/signup.wxss */
+page{
+  padding: 30rpx;
+}
+.item{
+  padding: 30rpx 0 0rpx;
+  padding-left: 140rpx;
+  position: relative;
+}
+.item label{
+  position: absolute;
+  left: 0;
+  top: 30rpx;
+  line-height: 64rpx;
+  font-weight: 500;
+}
+.tags{
+  position: relative;
+}
+.tags>text{
+  display: inline-block;
+  /* width: 160rpx; */
+  border: 1px solid #E0E0E0;
+  text-align: center;
+  line-height: 64rpx;
+  border-radius: 32rpx;
+  font-size: 30rpx;
+  margin-bottom: 16rpx;
+  margin-right: 16rpx;
+  padding: 0 30rpx;
+}
+.tags .act{
+  border: 1px solid #FFEFEB;
+  background: #FFEFEB;
+  color: #D94B24;
+}
+.date-picker{
+  line-height: 64rpx;
+}
+.date-picker text{
+  color: #666;
+  font-size: 30rpx;
+}
+.tags input,.picker{
+  border: 1px solid #E0E0E0;
+  width: 100%;
+  height: 88rpx;
+  padding: 0 24rpx;
+  box-sizing: border-box;
+  position: relative;
+  top: -5rpx;
+  font-size: 30rpx;
+  border-radius: 8rpx;
+  line-height: 88rpx;
+}
+.yzm{
+  display: flex;
+  justify-content: space-between;
+}
+.yzm input{
+  width: 58%;
+}
+.yzm view{
+  width: 40%;
+  height: 88rpx;
+  color: #D94B24;
+  line-height: 88rpx;
+  border: 1px solid #D94B24;
+  border-radius: 8rpx;
+  font-size: 30rpx;
+  text-align: center;
+}
+.yzm .disabled{
+  color: #999;
+  border-color: #999;
+}
+.picker image{
+  float: right;
+  margin-top: 30rpx;
+}
+button:not([size='mini']){
+  background: #D94B24;
+  color: #fff;
+  width: 100% !important;
+  margin-top: 100rpx;
+  height: 88rpx;
+  line-height: 88rpx;
+  padding: 0;
+  font-size: 32rpx;
+  border-radius: 8rpx;
+}

+ 3 - 4
pages/upload/upload.wxml

@@ -1,13 +1,13 @@
 <form bindtap="blur">
     <view class="label" >持仓日期   {{stock_date}}</view>
     <view class="note">交作业时间:15:00-15:30</view>
-    <view class="label">今日净资产<text class="note">(单位:万)</text></view>
+    <view class="label">今日净资产<text class="note">(单位:万)</text>  <navigator wx:if="{{role == 2}}" class="change" url="../change/change">今日资金出入?</navigator></view>
     <input type='digit' value="{{today_fund}}" bindinput="fundChange1" placeholder="请输入今日净资产"></input>
     <text style="color:red;font-weight:500">万</text>
      
     <block wx:if='{{!is_markt}}'>
     <view class="label">今日持股<text class="note">(空仓请留空不填)</text></view>
-    <view class="info" wx:for='{{stock}}'>
+    <view class="info" wx:for='{{stock}}' >
       <input bindinput='stockSearch'   data-id='{{index}}'  value="{{item.name}}" placeholder="股票名称"></input>
       <input type='digit' bindinput="fundChange" data-id='{{index}}' value="{{item.fund}}" placeholder="资金额"></input>
       <text style="color:red;font-weight:500">万</text>    
@@ -50,10 +50,9 @@
         <text>5、连续3天未交作业,无特殊原因将被视为退赛。</text>
         <text>6、重新归赛请跟顽主微信申请,并提供请假期间的银证记录。</text>
         <text>7、数据提交有误可直接修改,再点击上传。</text>
-        <navigator wx:if="{{role == 2}}" class="change" url="../change/change">初始资金修改</navigator>
     </view>
     
-    <button wx:if="{{role == 2}}" bindtap="post">上传</button>
+    <button wx:if="{{role == 2}}"  bindtap="post">上传</button>
     <!-- <button wx:else disabled>上传</button> -->
     
     <!-- <button wx:if='{{!change}}' disable='{{disable}}' bindtap="post">上传</button>

+ 13 - 9
pages/upload/upload.wxss

@@ -86,15 +86,18 @@ picker{
 .change{
   /* background: #D94B24; */
   color: #D94B24;
-  width: 90%;
-  height: 88rpx;
-  line-height: 88rpx;
-  padding: 0;
-  font-size: 32rpx;
-  border-radius: 8rpx;
-  margin-top: 50rpx;
-  text-align: center;
-  border: 1px solid #D94B24;
+  /* width: 90%; */
+  /* height: 88rpx; */
+  /* line-height: 88rpx; */
+  /* padding: 0; */
+  /* font-size: 32rpx; */
+  /* border-radius: 8rpx; */
+  /* margin-top: 50rpx; */
+  /* text-align: center; */
+  text-decoration: underline;
+  /* border: 1px solid #D94B24; */
+  display: inline;
+  margin-left: 20rpx;
 }
 
 form button:not([size='mini']){
@@ -110,6 +113,7 @@ form button:not([size='mini']){
   position: fixed;
   bottom: 0;
   margin-bottom: 10rpx;
+  z-index: 999;
 }
 .upload{
   width: 220rpx;

+ 1 - 3
pages/user/user.js

@@ -75,9 +75,7 @@ Page({
         return
       }
       if(res.data.data.role==0){
-        wx.navigateTo({
-          url: '../apply/apply',
-        })
+
       }else{
         this.setData({
           usercode: res.data.data.usercode,

+ 56 - 54
project.config.json

@@ -1,56 +1,58 @@
 {
-	"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
-	"packOptions": {
-		"ignore": [],
-		"include": []
-	},
-	"setting": {
-		"urlCheck": true,
-		"es6": true,
-		"enhance": true,
-		"postcss": true,
-		"preloadBackgroundData": false,
-		"minified": true,
-		"newFeature": true,
-		"coverView": true,
-		"nodeModules": false,
-		"autoAudits": false,
-		"showShadowRootInWxmlPanel": true,
-		"scopeDataCheck": false,
-		"uglifyFileName": false,
-		"checkInvalidKey": true,
-		"checkSiteMap": true,
-		"uploadWithSourceMap": true,
-		"compileHotReLoad": false,
-		"lazyloadPlaceholderEnable": false,
-		"useMultiFrameRuntime": true,
-		"useApiHook": true,
-		"useApiHostProcess": true,
-		"babelSetting": {
-			"ignore": [],
-			"disablePlugins": [],
-			"outputPath": ""
-		},
-		"enableEngineNative": false,
-		"useIsolateContext": false,
-		"userConfirmedBundleSwitch": false,
-		"packNpmManually": false,
-		"packNpmRelationList": [],
-		"minifyWXSS": true,
-		"disableUseStrict": false,
-		"minifyWXML": true,
-		"showES6CompileOption": false,
-		"useCompilerPlugins": false
-	},
-	"compileType": "miniprogram",
-	"libVersion": "2.15.0",
-	"appid": "wxb299e10e65157301",
-	"projectname": "newwzb_xcx",
-	"simulatorType": "wechat",
-	"simulatorPluginLibVersion": {},
-	"editorSetting": {
-		"tabIndent": "insertSpaces",
-		"tabSize": 2
-	},
-	"condition": {}
+  "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "packOptions": {
+    "ignore": [],
+    "include": []
+  },
+  "setting": {
+    "urlCheck": true,
+    "es6": true,
+    "enhance": true,
+    "postcss": true,
+    "preloadBackgroundData": false,
+    "minified": true,
+    "newFeature": true,
+    "coverView": true,
+    "nodeModules": false,
+    "autoAudits": false,
+    "showShadowRootInWxmlPanel": true,
+    "scopeDataCheck": false,
+    "uglifyFileName": false,
+    "checkInvalidKey": true,
+    "checkSiteMap": true,
+    "uploadWithSourceMap": true,
+    "compileHotReLoad": false,
+    "lazyloadPlaceholderEnable": false,
+    "useMultiFrameRuntime": true,
+    "useApiHook": true,
+    "useApiHostProcess": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "enableEngineNative": false,
+    "useIsolateContext": false,
+    "userConfirmedBundleSwitch": false,
+    "packNpmManually": false,
+    "packNpmRelationList": [],
+    "minifyWXSS": true,
+    "disableUseStrict": false,
+    "minifyWXML": true,
+    "showES6CompileOption": false,
+    "useCompilerPlugins": false,
+    "useStaticServer": true,
+    "ignoreUploadUnusedFiles": true
+  },
+  "compileType": "miniprogram",
+  "libVersion": "2.15.0",
+  "appid": "wxb299e10e65157301",
+  "projectname": "newwzb_xcx",
+  "simulatorType": "wechat",
+  "simulatorPluginLibVersion": {},
+  "editorSetting": {
+    "tabIndent": "insertSpaces",
+    "tabSize": 2
+  },
+  "condition": {}
 }