Z1hgq il y a 7 ans
Parent
commit
71e7c14223

+ 1 - 0
Gkzs/app.js

xqd
@@ -9,6 +9,7 @@ App({
     province: '',
     code: '',
     phonenumber: '',
+    usercode:'',
   },
   onLaunch: function () {
     console.log('App Launch')

+ 29 - 16
Gkzs/index/info/info.js

xqd xqd xqd xqd xqd
@@ -20,8 +20,9 @@ Page({
     province: '',
     code: '',
     errMsg:'',
-    phone:'10086',
-    phonein:0
+    phone:'',
+    phonein:'',
+    usercode:'',
   },
 
   /**
@@ -122,9 +123,6 @@ Page({
     })
   },
   showTopTips: function () {
-    wx.navigateTo({
-      url: '../result/result'
-    })
     var that = this
     if(that.data.cnumber == ''){
       that.setData({
@@ -144,10 +142,10 @@ Page({
         errMsg: '成绩不能为空'
       })
     }
-    if (that.data.phonein != that.data.phone){
+    if (that.data.phone == ''){
       that.setData({
         infoDown: false,
-        errMsg: '手机号错误'
+        errMsg: '手机号不能为空'
       })
     }
     if (that.data.infoDown == false) {
@@ -173,15 +171,6 @@ Page({
       app.userinfo.phonenumber = that.data.phone
       app.userinfo.batch = that.data.batch
       app.userinfo.province = that.data.province
-
-      console.log(getApp().userinfo.code )
-      console.log(getApp().userinfo.class)
-      console.log(getApp().userinfo.username)
-      console.log(getApp().userinfo.cnumber)
-      console.log(getApp().userinfo.grade)
-      console.log(getApp().userinfo.phonenumber)
-      console.log(getApp().userinfo.batch)
-      console.log(getApp().userinfo.province)
       wx.navigateTo({
         url: '../result/result'
       })
@@ -214,6 +203,30 @@ Page({
     console.log(e.detail.errMsg)
     console.log(e.detail.iv)
     console.log(e.detail.encryptedData) 
+    var that = this
+    wx.login({
+      success:function(res){
+        that.setData({
+          usercode: res.code
+        })
+        console.log(that.data.usercode)
+        wx.request({
+          url: 'https://t10.9026.com/api/home/getphonenumber',
+          data: {
+            code: that.data.usercode,
+            iv: e.detail.iv,
+            encryptData: e.detail.encryptedData
+          },
+          method: 'POST',
+          success: function (res) {
+            console.log(res.data)
+            that.setData({
+              phone:res.data.data.decryptedData.phoneNumber
+            })
+          }
+        })
+      }
+    })  
   },
   wenke: function () {
     this.setData({

+ 1 - 1
Gkzs/index/info/info.wxml

xqd
@@ -36,7 +36,7 @@
 
       <view class="weui-cell weui-cell_input weui-cell_vcode">
         <view class="weui-cell__bd">
-          <input class="weui-input" placeholder="手机号验证" bindinput='phoneInput'/>
+          <input class="weui-input" placeholder="手机号验证" bindinput='phoneInput' value='{{phone}}'/>
         </view>
         <view class="weui-cell__ft">
           <button class="weui-vcode-btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">获取手机号</button>

+ 52 - 20
Gkzs/index/result/result.js

xqd xqd xqd xqd
@@ -16,12 +16,17 @@ Page({
     mobile: 0,
     rank: 0,
     college_count: 0,
-    price:'',
-    timeStamp:'',
-    nonceStr:'',
-    package:'',
-    signType:'',
-    paySign:'',
+    price: '',
+    timeStamp: '',
+    nonceStr: '',
+    package: '',
+    signType: '',
+    paySign: '',
+    major_count:0,
+    showFreeInfo: true,
+    showPayButton: true,
+    showPaidInfo: false,
+    paidInfo:[],
   },
 
   /**
@@ -112,8 +117,8 @@ Page({
       success: function (res) {
         console.log(res.data)
         that.setData({
-          college_count:res.data.data.college_count,
-          rank:res.data.data.rank
+          college_count: res.data.data.college_count,
+          rank: res.data.data.rank
         })
       }
     })
@@ -133,18 +138,18 @@ Page({
       success: function (res) {
         console.log(res.data)
         //this.showRechargeableInfo()
-        if(res.data.data.price){
+        if (res.data.data.price) {
           that.setData({
             price: res.data.data.price
           })
           wx.request({
             url: 'https://t10.9026.com/api/home/pay',
-            data:{
-              userid:that.data.userid,
-              price:that.data.price
+            data: {
+              userid: that.data.userid,
+              price: that.data.price
             },
-            method:'POST',
-            success:function(res){
+            method: 'POST',
+            success: function (res) {
               console.log(res.data.data.json)
               var r = JSON.parse(res.data.data.json)
               console.log(r)
@@ -161,20 +166,47 @@ Page({
                 package: that.data.package,
                 signType: that.data.signType,
                 paySign: that.data.paySign,
-                success:function(res){//支付成功之后再获取付费信息
+                success: function (res) {//支付成功之后再获取付费信息
                   console.log(res.errMsg)
-
+                  wx.request({
+                    url: 'https://t10.9026.com/api/home/getpaidmajors',
+                    data: {
+                      userid: that.data.userid,
+                      username: that.data.username,
+                      batch: that.data.batch,
+                      province: that.data.province,
+                      class: that.data.class
+                    },
+                    method: 'POST',
+                    success: function (res) {
+                      console.log('已付费')
+                      console.log(res.data)
+                      that.setData({
+                        paidInfo:[...res.data.data.major],
+                        major_count:res.data.data.count,
+                        showFreeInfo: false,
+                        showPayButton: false,
+                        showPaidInfo: true,
+                      })
+                      console.log(that.data.paidInfo)
+                    }
+                  })
                 }
               })
             }
           })
-        }else{
+        } else {
           console.log('已付费')
+          that.setData({
+            paidInfo: [...res.data.data.major],
+            major_count: res.data.data.count,
+            showFreeInfo: false,
+            showPayButton: false,
+            showPaidInfo: true,
+          })
+          console.log(that.data.paidInfo)
         }
       }
     })
   },
-  showRechargeableInfo: function () {
-
-  }
 }) 

+ 55 - 6
Gkzs/index/result/result.wxml

xqd
@@ -2,15 +2,64 @@
 
 <view class='page'>
   <view class="page__bd">
+
     <view class = "baseInfo">
-    <label class = "score">您输入的成绩为:{{grade}}分</label>
-    <label class = "rank">全省排名{{rank}}名</label>
+    <view class="weui-flex">
+      <view class="weui-flex__item">
+        <view class="left">您输入的成绩为:{{grade}}分</view>
+      </view>
+      <view class="weui-flex__item">
+        <view class="right">全省排名{{rank}}名</view>
+      </view>
     </view>
-    <view class = "baseInfo">
-    <label class = "score">为您匹配到的保底大学</label> <label class = "rank">{{college_count}}所</label>
     </view>
+
+<view class = "baseInfo">
+    <view class="weui-flex" wx:if="{{showFreeInfo}}">
+      <view class="weui-flex__item">
+        <view class="left">为您匹配到的保底大学</view>
+      </view>
+      <view class="weui-flex__item">
+        <view class="right">{{college_count}}所</view>
+      </view>
+    </view>
+    </view>
+
+
+    <view class="major" wx:if="{{showPaidInfo}}">
+      为您匹配到{{major_count}}条高校(专业)
+    </view>
+
+    <view class='baseInfo' wx:if="{{showPaidInfo}}" wx:for="{{paidInfo}}">
+      <view class='weui-flex'>
+        <view class='weui-flex__item'>{{item.college}}</view>
+        <view class='weui-flex__item'>{{item.province}}</view>
+      </view>
+      <view class='weui-flex'>
+        <view class='weui-flex__item'>专业:{{item.major}} {{item.type}}</view>
+      </view>
+      <view class='weui-flex'>
+        <view class='weui-flex__item'>{{item.year}}年</view>
+      </view>
+      <view class='weui-flex'>
+        <view class='weui-flex__item'>最低分 {{item.miss_grade}}</view>
+        <view class='weui-flex__item'>最高分 {{item.max_grade}}</view>
+        <view class='weui-flex__item'>平均分 {{item.avg_grade}}</view>
+      </view>
+
+      <view class='weui-flex'>
+        <view class='weui-flex__item'>最低位次 {{item.miss_rank}}</view>
+        <view class='weui-flex__item'>最高位次 {{item.max_rank}}</view>
+        <view class='weui-flex__item'>平均位次 {{item.avg_rank}}</view>
+      </view>
+    </view>
+
+
+
+
   </view>
   <view class="weui-btn-area">
-      <button class="weui-btn" type="primary" bindtap="getRechargeableInfo">付费查看详细资料</button>
-    </view>
+    <button class="weui-btn" type="primary" bindtap="getRechargeableInfo" wx:if="{{showPayButton}}">付费查看详细资料</button>
+
+  </view>
 </view>

+ 10 - 4
Gkzs/index/result/result.wxss

xqd
@@ -1,11 +1,17 @@
 /* index/result/result.wxss */
-.score{
-  float: left
+.left{
+  text-align: left
 }
-.rank{
-  float: right
+.right{
+ text-align: right
 }
+
 .baseInfo{
   margin: 20rpx;
   background-color: #999
+}
+.major{
+  margin: 20rpx;
+  background-color: #999;
+  text-align: center
 }

+ 2 - 0
Gkzs/login/login.js

xqd
@@ -70,6 +70,8 @@ Page({
         success: function (res) {
           let code = res.code
           console.log(code)
+          var c = getApp()
+          c.userinfo.usercode = res.code
           wx.getUserInfo({
             success: function (res) {
               //let encrypted_data = res.encryptedData