HuaJingwen 7 years ago
parent
commit
7a09a00a87

+ 39 - 1
app.js

@@ -24,7 +24,7 @@ App({
24 24
     userInfo: null,
25 25
     HOST: 'https://chaoshi.henhaojie.com'
26 26
   },
27
-  login: function () {
27
+  login: function (func) {
28 28
     let obj = {}, app = this, token = '';
29 29
     wx.login({
30 30
       success: function(res) {
@@ -44,9 +44,47 @@ App({
44 44
                   if (resLogin.data.errno == 0) {
45 45
                     token = resLogin.data.rst.token;
46 46
                     wx.setStorage({key:"token", data: token})
47
+                    if (func) {
48
+                      func();
49
+                    }
47 50
                   }
48 51
                 }
49 52
               })
53
+            },
54
+            fail: function () {
55
+              // 用户拒绝授权后再次确认
56
+              app.confirmModal('必须授权登录之后才正常使用,是否重新授权', function(){
57
+                if (wx.openSetting) {
58
+                    wx.openSetting({
59
+                        success: (ress) => {
60
+                            if (ress.authSetting["scope.userInfo"]) {
61
+                              wx.getUserInfo({
62
+                                success: function(resInfo) {
63
+                                  wx.request({
64
+                                    url: app.globalData.HOST + '/user/wx/login',
65
+                                    method: "POST",
66
+                                    data: {
67
+                                      code: res.code,
68
+                                      iv: resInfo.iv,
69
+                                      encryptedData: resInfo.encryptedData
70
+                                    },
71
+                                    success: function (resLogin) {
72
+                                      if (resLogin.data.errno == 0) {
73
+                                        token = resLogin.data.rst.token;
74
+                                        wx.setStorage({key:"token", data: token})
75
+                                        if (func) {
76
+                                          func();
77
+                                        }
78
+                                      }
79
+                                    }
80
+                                  })
81
+                                }
82
+                              })
83
+                            }
84
+                        }
85
+                    })
86
+                }
87
+              });
50 88
             }
51 89
           })
52 90
         } else {

+ 1 - 1
app.json

@@ -12,7 +12,7 @@
12 12
     "pages/feedback/feedback",
13 13
     "pages/application/application",
14 14
     "pages/getPhone/getPhone",
15
-    "pages/getPhone_to/getPhone_to",
15
+    "pages/getIt/getIt",
16 16
     "pages/register_phon/register_phon"
17 17
   ],
18 18
   "window": {

+ 15 - 0
app.wxss

@@ -85,6 +85,9 @@
85 85
   width: 100%;
86 86
   height: 100%;
87 87
 }
88
+.card-list-temp{
89
+  position: relative;
90
+}
88 91
 .card-list-temp .weui-cell__hd{
89 92
   width: 200rpx;
90 93
   height: 124rpx;
@@ -109,6 +112,18 @@
109 112
   font-size: 14px;
110 113
   color: #999;
111 114
 }
115
+.template .contact-btn{
116
+  /*display: none;*/
117
+  position: absolute;
118
+  top: 0;
119
+  left: 0;
120
+  width: 100%;
121
+  height: 100%;
122
+  background: transparent;
123
+}
124
+.template .contact-btn::after{
125
+  border: 0 none;
126
+}
112 127
 .template .weui-badge.other{
113 128
   background: #2893E9;
114 129
 }

+ 13 - 10
pages/application/application.js

@@ -10,7 +10,12 @@ Page({
10 10
     this.initApplication();
11 11
   },
12 12
   initApplication () {
13
-      var that = this, token = wx.getStorageSync('token');
13
+      var that = this, token = wx.getStorageSync('token'), list = [];
14
+      if (that.data.page) {
15
+        list = that.data.dataList
16
+      }else{
17
+        list = [];
18
+      }
14 19
       wx.request({
15 20
         url: app.globalData.HOST + '/user/wx/myapply',
16 21
         method: "POST",
@@ -19,11 +24,10 @@ Page({
19 24
           var data = res.data;
20 25
             // console.log(data);
21 26
           if (data.errno == '0') {
22
-            /*that.setData({
23
-              jobArr: data.userlist,
24
-              moneyArr: data.list,
25
-              timeArr: data.month
26
-            })*/
27
+            list = list.concat(data.rst.list)
28
+            that.setData({
29
+              dataList: list
30
+            })
27 31
           }else if(data.errno == '90001'){
28 32
             console.log('go');
29 33
             // wx.navigateTo({
@@ -39,12 +43,11 @@ Page({
39 43
   },
40 44
   onPullDownRefresh: function () {
41 45
     //下拉
42
-    var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
43
-    utils.initList(that, obj, 'top', ++that.data.page);
46
+    this.data.page = 0;
47
+    this.initApplication();
44 48
   },
45 49
   onReachBottom: function () {
46 50
     //上拉
47
-    var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
48
-    utils.initList(that, obj, 'bottom', ++that.data.page);
51
+    this.initApplication();
49 52
   }
50 53
 })

+ 1 - 1
pages/application/application.wxml

@@ -2,7 +2,7 @@
2 2
 <view class="content-wrapper">
3 3
   <block wx:for="{{dataList}}" wx:key="void">
4 4
      <!-- 使用热门推荐模板,传入当前循环对象item  -->
5
-    <template is="jiefItem1" data="{{...item}}"/>
5
+    <template is="jiefItem3" data="{{...item}}"/>
6 6
   </block>
7 7
 </view>
8 8
 <view class="body-view">

+ 2 - 1
pages/card/card.js

@@ -11,7 +11,8 @@ Page({
11 11
     duration: 1000,
12 12
     cardList: [],
13 13
     hasNext: true,
14
-    page: 0
14
+    page: 0,
15
+    hasPhone: true
15 16
   },
16 17
   onLoad: function () {
17 18
     this.initBanner();

+ 35 - 1
pages/details/details.wxml

@@ -14,8 +14,42 @@
14 14
     </view>
15 15
     <view class='slide'></view>
16 16
     <view class="cal-container">
17
-        <view class="loan-limit"><text class="fl">贷款额度(10000-500000元)</text><text class="fr">元</text><input class="fr" type="number"/></view>
17
+        <view class="loan-limit"><text class="fl">贷款额度(10000-500000元)</text><input class="fr" type="number"/><text class="fr">元</text></view>
18
+        <view class="loan-limit">
19
+          <text class="fl">贷款期限(10000-500000元)</text>
20
+          <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
21
+              <button type="default">单列选择器</button>
22
+          </picker>
23
+        </view>
24
+        <view class="cal-result">
25
+            <view class="result-item">
26
+              <view class="title">预计还款总额</view>
27
+              <view class="notice">10006元</view>
28
+            </view>
29
+            <view class="result-item">
30
+              <view class="title">参考月利率</view>
31
+              <view class="notice">0.01%</view>
32
+            </view>
33
+            <view class="result-item">
34
+              <view class="title">最快放款时间</view>
35
+              <view class="notice">1小时</view>
36
+            </view>
37
+        </view>
18 38
     </view>
19 39
     <view class="details-info">
40
+      <view class="intro">
41
+        <view class="title">申请条件</view>
42
+        <view class="content">1.年龄18(含)周岁-70(含)周岁2.名下有车且未抵押给其他个人及公司,法院未对该车辆执行过冻结、查封操作3.车辆购入时间大于1个月且小于10年,可贷额度大于1万4.身份证、行驶证、驾驶证、车辆登记证书、车辆保单、车辆备用钥匙等资料齐全</view>
43
+      </view>
44
+      <view class="more">查看更多</view>
45
+    </view>
46
+    <view class="recommend-wrapper">
47
+      <view class="recommend-app">
48
+        <view class="app-item">
49
+          <image></image>
50
+          <view class="title">筋斗快贷</view>
51
+        </view>
52
+      </view>
20 53
     </view>
54
+    <view class="button-wrapper"><button></button></view>
21 55
 </view>

+ 0 - 66
pages/getIt/logs_to.js

@@ -1,66 +0,0 @@
1
-// pages/logs_to/logs_to.js
2
-Page({
3
-
4
-  /**
5
-   * 页面的初始数据
6
-   */
7
-  data: {
8
-  
9
-  },
10
-
11
-  /**
12
-   * 生命周期函数--监听页面加载
13
-   */
14
-  onLoad: function (options) {
15
-  
16
-  },
17
-
18
-  /**
19
-   * 生命周期函数--监听页面初次渲染完成
20
-   */
21
-  onReady: function () {
22
-  
23
-  },
24
-
25
-  /**
26
-   * 生命周期函数--监听页面显示
27
-   */
28
-  onShow: function () {
29
-  
30
-  },
31
-
32
-  /**
33
-   * 生命周期函数--监听页面隐藏
34
-   */
35
-  onHide: function () {
36
-  
37
-  },
38
-
39
-  /**
40
-   * 生命周期函数--监听页面卸载
41
-   */
42
-  onUnload: function () {
43
-  
44
-  },
45
-
46
-  /**
47
-   * 页面相关事件处理函数--监听用户下拉动作
48
-   */
49
-  onPullDownRefresh: function () {
50
-  
51
-  },
52
-
53
-  /**
54
-   * 页面上拉触底事件的处理函数
55
-   */
56
-  onReachBottom: function () {
57
-  
58
-  },
59
-
60
-  /**
61
-   * 用户点击右上角分享
62
-   */
63
-  onShareAppMessage: function () {
64
-  
65
-  }
66
-})

+ 0 - 1
pages/getIt/logs_to.json

@@ -1 +0,0 @@
1
-{}

+ 0 - 5
pages/getIt/logs_to.wxml

@@ -1,5 +0,0 @@
1
-<view class='pd64'>
2
-  <button type="btn" class='wx_login_btn'> <image src='../img/wx_login.png'></image>微信快速登录</button>
3
-  <button type="btn" class='zfb_login_btn'> <image src='../img/zfb_login.png'></image>手机验证码注册 </button>
4
-</view>
5
-<view class='details'>同时申请<text>3</text>款以上产品,成功率提升90%</view>

+ 0 - 72
pages/getIt/logs_to.wxss

@@ -1,72 +0,0 @@
1
-page {
2
-  /* font-size: 100px; */
3
-  font-family: "PingFangSC-Regular, 微软雅黑, sans-serif";
4
-  background: #f5f4f9;
5
-}
6
-
7
-view {
8
-  /* font-size: 100px; */
9
-  border-top: 1px solid#f5f4f9;
10
-  background: #fff;
11
-}
12
-
13
-.pd64 {
14
-  padding-bottom: 64px;
15
-}
16
-
17
-.wx_login_btn {
18
-  width: 90%;
19
-  height: 45px;
20
-  /* margin: auto; */
21
-  display: block;
22
-  border-radius: 0;
23
-  margin-top: 34px;
24
-  background-color: #52a939;
25
-  font-size: 18px;
26
-  color: #fff;
27
-  line-height: 45px;
28
-}
29
-
30
-.wx_login_btn image {
31
-  width: 25px;
32
-  height: 25px;
33
-  line-height: 45px;
34
-  position: relative;
35
-  top: 5px;
36
-  margin-right: 8px;
37
-}
38
-
39
-.zfb_login_btn {
40
-  height: 45px;
41
-  width: 90%;
42
-  display: block;
43
-  border-radius: 0;
44
-  margin-top: 20px;
45
-  background-color: #6082f9;
46
-  font-size: 18px;
47
-  color: #fff;
48
-}
49
-
50
-.zfb_login_btn image {
51
-  width: 25px;
52
-  height: 25px;
53
-  position: relative;
54
-  top: 5px;
55
-  margin-right: 8px;
56
-}
57
-
58
-.details {
59
-  display: block;
60
-  height: 84px;
61
-  width: 100%;
62
-  font-size: 14px;
63
-  margin: auto;
64
-  text-align: center;
65
-  line-height: 84px;
66
-  margin-top: 10px;
67
-  color: #8c8c8c;
68
-}
69
-
70
-.details  text {
71
-  color: #db3232;
72
-}

+ 20 - 4
pages/getPhone/getPhone.js

@@ -2,10 +2,12 @@
2 2
 var app = getApp();
3 3
 Page({
4 4
   data: {
5
-
5
+    from: ''
6 6
   },
7 7
   onLoad: function (options) {
8
-
8
+    console.log(options.from);
9
+    var that = this;
10
+   that.setData({from: options.from});
9 11
   },
10 12
   getPhoneNumber: function(e) {
11 13
     var that = this;
@@ -20,15 +22,29 @@ Page({
20 22
     }
21 23
   },
22 24
   telHost (token, iv, encryptedData) {
25
+    var that = this;
23 26
     wx.request({
24 27
       url: app.globalData.HOST + '/user/wx/getUserPhone',
25 28
       method: 'POST',
26 29
       data: {token: token, iv: iv, encryptedData: encryptedData},
27 30
       success: function (res) {
28 31
         var data = res.data
29
-        console.log(data);
30
-        if (res.data.errno == '0'){
32
+        // console.log(data);
33
+        if (data.errno == '0'){
34
+          var tel = data.rst.phone_number
35
+          wx.setStorage({key:"tel", data: tel})
36
+          if (that.data.from === 'mine') {
37
+            wx.navigateTo({
38
+              url: '/pages/application/application?tel=' + tel
39
+            })
40
+          }else{
41
+            wx.navigateTo({
42
+              url: '/pages/getIt/getIt?tel=' + tel
43
+            })
44
+          }
45
+
31 46
         }else{
47
+          app.noticeModal(data.err);
32 48
         }
33 49
       }
34 50
     });

+ 0 - 5
pages/getPhone_to/getPhone.wxml

@@ -1,5 +0,0 @@
1
-<view class='pd64'>
2
-  <button type="btn" class='wx_login_btn'> <image src='../img/wx_login.png'></image>微信快速登录</button>
3
-  <button type="btn" class='zfb_login_btn'> <image src='../img/zfb_login.png'></image>手机验证码注册 </button>
4
-</view>
5
-<view class='details'>同时申请<text>3</text>款以上产品,成功率提升90%</view>

+ 0 - 66
pages/getPhone_to/getPhone_to.js

@@ -1,66 +0,0 @@
1
-// pages/logs_to/logs_to.js
2
-Page({
3
-
4
-  /**
5
-   * 页面的初始数据
6
-   */
7
-  data: {
8
-    phone_number:'18888888888'
9
-  },
10
-
11
-  /**
12
-   * 生命周期函数--监听页面加载
13
-   */
14
-  onLoad: function (options) {
15
-  
16
-  },
17
-
18
-  /**
19
-   * 生命周期函数--监听页面初次渲染完成
20
-   */
21
-  onReady: function () {
22
-  
23
-  },
24
-
25
-  /**
26
-   * 生命周期函数--监听页面显示
27
-   */
28
-  onShow: function () {
29
-  
30
-  },
31
-
32
-  /**
33
-   * 生命周期函数--监听页面隐藏
34
-   */
35
-  onHide: function () {
36
-  
37
-  },
38
-
39
-  /**
40
-   * 生命周期函数--监听页面卸载
41
-   */
42
-  onUnload: function () {
43
-  
44
-  },
45
-
46
-  /**
47
-   * 页面相关事件处理函数--监听用户下拉动作
48
-   */
49
-  onPullDownRefresh: function () {
50
-  
51
-  },
52
-
53
-  /**
54
-   * 页面上拉触底事件的处理函数
55
-   */
56
-  onReachBottom: function () {
57
-  
58
-  },
59
-
60
-  /**
61
-   * 用户点击右上角分享
62
-   */
63
-  onShareAppMessage: function () {
64
-  
65
-  }
66
-})

+ 0 - 1
pages/getPhone_to/getPhone_to.json

@@ -1 +0,0 @@
1
-{}

+ 0 - 5
pages/getPhone_to/getPhone_to.wxml

@@ -1,5 +0,0 @@
1
- <view class='pd64'> 
2
-  <image src='../resource/image/login_logo.png' class='logo_img'></image>
3
-  <view class='phone_number'>手机:<text>{{phone_number}}</text></view>
4
- </view> 
5
- <view class='details'>同时申请<text>3</text>款以上产品,成功率提升<text>90%</text></view> 

+ 0 - 50
pages/getPhone_to/getPhone_to.wxss

@@ -1,50 +0,0 @@
1
-page {
2
-  /* font-size: 100px; */
3
-  font-family: "PingFangSC-Regular, 微软雅黑, sans-serif";
4
-  background: #f5f4f9;
5
-}
6
-
7
-view {
8
-  background: #fff;
9
-}
10
-
11
-.pd64 {
12
-    border-top: 1px solid#f5f4f9;
13
-  padding-bottom: 46px;
14
-    text-align: center;
15
-}
16
-.phone_number{
17
-  display: block;
18
-  margin-top: 12px;
19
-  font-size: 18px;
20
-  color: #333;
21
-  text-align: center;
22
-}
23
-/* .phone_number text{
24
-  font-size: 18px;
25
-  color: #333;
26
-  text-align: center;
27
-} */
28
-.logo_img {
29
-  width: 68px;
30
-  height: 88px;
31
-  display: block;
32
-  margin: auto;
33
-  margin-top: 32px;
34
-}
35
-
36
-.details {
37
-  display: block;
38
-  height: 84px;
39
-  width: 100%;
40
-  font-size: 14px;
41
-  margin: auto;
42
-  text-align: center;
43
-  line-height: 84px;
44
-  margin-top: 10px;
45
-  color: #8c8c8c;
46
-}
47
-
48
-.details  text {
49
-  color: #db3232;
50
-}

+ 13 - 3
pages/mine/mine.js

@@ -4,13 +4,23 @@ const app = getApp()
4 4
 
5 5
 Page({
6 6
   data: {
7
-    userInfo: {}
7
+    userInfo: {},
8 8
   },
9 9
   onLoad: function () {
10 10
     this.initInfo();
11 11
   },
12 12
   initInfo () {
13 13
     var token = wx.getStorageSync('token'), data = {}, that = this;
14
+    console.log(token);
15
+    if (token) {
16
+      that.getInfo(token)
17
+    }else{
18
+
19
+      app.login(that.getInfo);
20
+    }
21
+  },
22
+  getInfo (token) {
23
+    var that = this, token = token || wx.getStorageSync('token'), data = null;
14 24
     wx.request({
15 25
       url: app.globalData.HOST + '/user/wx/personalCenter',
16 26
       method: 'POST',
@@ -28,11 +38,11 @@ Page({
28 38
     var tel = wx.getStorageSync('tel');
29 39
     if (tel) {
30 40
       wx.navigateTo({
31
-        url: '/pages/application/application'
41
+        url: "/pages/application/application"
32 42
       })
33 43
     }else{
34 44
       wx.navigateTo({
35
-        url: '/pages/getPhone/getPhone'
45
+        url: "/pages/getPhone/getPhone?from=mine"
36 46
       })
37 47
     }
38 48
   }

+ 20 - 1
pages/template/template.wxml

@@ -18,12 +18,13 @@
18 18
 
19 19
 <template name="jiefItem2">
20 20
   <view class="weui-cells weui-cells_after-title template" bindtap="checkPhone">
21
-    <!-- <navigator url="/pages/details/details?id={{id}}" id="{{id}}"  hover-class="navigator-hover"> -->
21
+    <!-- <navigator url="/pages/details/details?id={{id}}" id="{{id}}"  hover-class="navigator-hover">  -->
22 22
     <view class="weui-cell card-list-temp">
23 23
       <view class="weui-cell__hd">
24 24
           <image class="icon" src="{{card_icon}}"/>
25 25
       </view>
26 26
       <view class="weui-cell__bd">
27
+          <button class="contact-btn" open-type="contact" wx-if="{{hasPhone}}"/>
27 28
           <view>{{name}}<view wx:for="{{keywords}}" wx:for-item="word" wx:key="void" wx-if="{{word == '礼'}}" class="weui-badge">{{word}}</view><view wx:for="{{keywords}}" wx:for-item="word" wx:key="void" wx-if="{{word !== '礼'}}" class="weui-badge other">{{word}}</view></view>
28 29
           <view class="desc elli">{{desc}}</view>
29 30
           <view class="desc elli" >申请人数<text class="emphasize">{{apply_num}}</text></view>
@@ -33,3 +34,21 @@
33 34
     <!-- </navigator> -->
34 35
   </view>
35 36
 </template>
37
+
38
+<template name="jiefItem3">
39
+  <view class="weui-cells weui-cells_after-title template">
40
+    <!-- <navigator url="/pages/details/details?id={{id}}" id="{{id}}"  hover-class="navigator-hover"> -->
41
+    <view class="weui-cell borrow-list-temp">
42
+      <view class="weui-cell__hd">
43
+          <image class="icon" src="{{product_icon}}"/>
44
+      </view>
45
+      <view class="weui-cell__bd">
46
+          <view>{{name}}<view class="weui-badge" wx-if="{{prod_title != null}}">{{prod_title}}</view></view>
47
+          <view class="desc elli">{{create_time}}</view>
48
+          <view class="desc elli" >贷款金额<text class="emphasize">{{money}}</text>贷款期数<text class="emphasize">{{periods}}</text></view>
49
+      </view>
50
+    </view>
51
+    <!-- <view class="weui-cell__ft weui-cell__ft_in-access"></view> -->
52
+    <!-- </navigator> -->
53
+  </view>
54
+</template>

+ 4 - 4
project.config.json

@@ -24,7 +24,7 @@
24 24
 			"list": []
25 25
 		},
26 26
 		"miniprogram": {
27
-			"current": 4,
27
+			"current": -1,
28 28
 			"list": [
29 29
 				{
30 30
 					"id": -1,
@@ -105,9 +105,9 @@
105 105
 					"query": ""
106 106
 				},
107 107
 				{
108
-					"id": -1,
109
-					"name": "getPhone_to",
110
-					"pathName": "pages/getPhone_to/getPhone_to",
108
+					"id": 13,
109
+					"name": "getIt",
110
+					"pathName": "pages/getIt/getIt",
111 111
 					"query": ""
112 112
 				},
113 113
 				{