wangxin 5 years ago
parent
commit
e364c223eb
43 changed files with 1169 additions and 576 deletions
  1. BIN
      .DS_Store
  2. 34 12
      app.js
  3. 1 0
      app.json
  4. 10 0
      app.wxss
  5. 1 1
      component/select-district/select-district.wxml
  6. 5 0
      component/select-district/select-district.wxss
  7. 8 2
      config.js
  8. BIN
      images/.DS_Store
  9. BIN
      images/icon/.DS_Store
  10. BIN
      images/icon/logo.png
  11. BIN
      images/icon/yibaoming.png
  12. 40 16
      pages/common-setting/common-setting.js
  13. 43 26
      pages/common-setting/common-setting.wxml
  14. 23 4
      pages/common-setting/common-setting.wxss
  15. 190 59
      pages/detail/detail.js
  16. 128 84
      pages/detail/detail.wxml
  17. 131 5
      pages/detail/detail.wxss
  18. 121 94
      pages/index/index.js
  19. 2 1
      pages/index/index.wxml
  20. 20 5
      pages/index/index.wxss
  21. 112 79
      pages/login/login.js
  22. 24 20
      pages/login/login.wxml
  23. 29 8
      pages/my-apply/my-apply.js
  24. 37 31
      pages/my-apply/my-apply.wxml
  25. 3 3
      pages/my-apply/my-apply.wxs
  26. 32 1
      pages/my-apply/my-apply.wxss
  27. 16 16
      pages/my-order/my-order.js
  28. 1 1
      pages/my-order/my-order.wxml
  29. 3 3
      pages/payment-records-detail/payment-records-detail.wxml
  30. 2 2
      pages/payment-records/payment-records.wxml
  31. 18 13
      pages/person/person.js
  32. 5 6
      pages/person/person.wxml
  33. 1 1
      pages/service_agreement/service_agreement.wxml
  34. 1 1
      pages/userinfo/userinfo.wxml
  35. 1 1
      pages/version/version.wxml
  36. 8 7
      pages/web-view/web-view.js
  37. 1 1
      pages/web-view/web-view.wxml
  38. 14 6
      project.config.json
  39. 3 3
      template/button/button.wxml
  40. 3 3
      utils/api.js
  41. 6 2
      utils/config_api.js
  42. 74 50
      utils/util.js
  43. 18 9
      utils/watch.js

BIN
.DS_Store


+ 34 - 12
app.js

@@ -1,18 +1,37 @@
 //app.js
 const utils = require('/utils/util.js').Utils; //载入模块
-const MyWatch = require('./utils/watch.js').MyWatch;
+import { Watch } from './utils/watch'
 App({
 
   /**
    * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
    */
-  onLaunch: function() {
-    new MyWatch(wx, this.watchData);
+  onLaunch: function () {
+    new Watch(wx, this.watchData);
+    if (!wx.getStorageSync('hasClear')) {
+      wx.clearStorage({
+        success: (res) => {
+          wx.setStorageSync('hasClear', true)
+        },
+      })
+    }
   },
   /**
    * 当小程序启动,或从后台进入前台显示,会触发 onShow
    */
-  onShow: function(options) {
+  onShow: function (options) {
+    if (!this.captchaTicketExpire) this.captchaTicketExpire = {};
+
+    if (options.referrerInfo.appId === 'wx5a3a7366fd07e119') {
+      const result = options.referrerInfo.extraData;
+      if (result.ret === 0) {
+        const ticket = result.ticket;
+        if (!this.captchaTicketExpire[ticket]) {
+          this.captchaResult = result;
+          this.captchaTicketExpire[ticket] = true;
+        }
+      }
+    }
     if (wx.getUpdateManager) {
       const updateManager = wx.getUpdateManager();
       updateManager.onCheckForUpdate(res => {
@@ -44,18 +63,18 @@ App({
   /**
    * 当小程序从前台进入后台,会触发 onHide
    */
-  onHide: function() {
-    if (wx.getStorageSync('userinfo').registerFrom === 2) {
+  onHide: function () {
+    // if (wx.getStorageSync('userinfo').registerFrom === 2) {
 
-    } else {
-      wx.clearStorage();
-    }
+    // } else {
+    //   wx.clearStorage();
+    // }
   },
 
   /**
    * 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
    */
-  onError: function(msg) {
+  onError: function (msg) {
 
   },
   /**
@@ -68,12 +87,15 @@ App({
   globalData: {
     userInfo: null,
     phone_zz: /1[0-9]{10}/,
-    webview:null
+    webview: null,
+    version: '1.1.6',
+    platformId: 1
   },
   /**
    * 需要监测的全局变量
    */
   watchData: {
-    offline: false
+    offline: false,
+    is_login: Boolean(wx.getStorageSync('userid'))
   },
 })

+ 1 - 0
app.json

@@ -21,5 +21,6 @@
     "navigationBarBackgroundColor": "#fff",
     "navigationBarTextStyle": "black"
   },
+  "navigateToMiniProgramAppIdList": ["wx5a3a7366fd07e119"],
   "sitemapLocation": "sitemap.json"
 }

+ 10 - 0
app.wxss

@@ -3,6 +3,11 @@
 
 page {
   background: #f5f5f5;
+  font-family: PingFangSC-Regular, PingFang SC;
+}
+
+.global-family {
+  font-family: PingFangSC-Medium, PingFang SC;
 }
 
 .container {
@@ -10,3 +15,8 @@ page {
   flex-direction: column;
   box-sizing: border-box;
 }
+
+.safe-area {
+  padding-bottom: constant(safe-area-inset-bottom);
+  padding-bottom: env(safe-area-inset-bottom);
+}

+ 1 - 1
component/select-district/select-district.wxml

@@ -1,5 +1,5 @@
 <!--component/select-district/select-district.wxml-->
-<view class="cover">
+<view class="cover safe-area">
   <view class="district">
     <view class="district-title">
       <text>全部区域</text>

+ 5 - 0
component/select-district/select-district.wxss

@@ -105,3 +105,8 @@
   background: linear-gradient(135deg, rgba(85, 104, 240, 1) 0%, rgba(130, 59, 255, 1) 100%);
   border-radius: 10rpx;
 }
+
+.safe-area {
+  padding-bottom: constant(safe-area-inset-bottom);
+  padding-bottom: env(safe-area-inset-bottom);
+}

+ 8 - 2
config.js

@@ -1,15 +1,21 @@
 // 测试服
-const apiUrl = "https://hw.hap-job.com/happy-boot"
+// const apiUrl = "https://hw.hap-job.com/happy-boot"
+// const baseurl = "https://hw.hap-job.com"
+// const captcha = '2072736870'
 // const imgServerUrl = "https://hpjobtest.oss-cn-shanghai.aliyuncs.com/uploadfiles/mina"//图片服务器地址
 // const imgServerUrl_new = "https://hpjobtest.oss-cn-shanghai.aliyuncs.com"//图片服务器地址
 // 正式服
-// const apiUrl = "https://www.dal-pay.com/happy-boot"
+const apiUrl = "https://www.dal-pay.com/happy-boot"
+const baseurl = "https://www.dal-pay.com"
+const captcha = '2012155849'
 // const imgServerUrl = "https://happyjob.oss-cn-shanghai.aliyuncs.com/uploadfiles/mina"//图片服务器地址
 // const imgServerUrl_new = "https://happyjob.oss-cn-shanghai.aliyuncs.com"//图片服务器地址
 
 
 module.exports = {
   apiUrl,
+  baseurl,
+  captcha,
   // imgServerUrl,
   // imgServerUrl_new
 }

BIN
images/.DS_Store


BIN
images/icon/.DS_Store


BIN
images/icon/logo.png


BIN
images/icon/yibaoming.png


+ 40 - 16
pages/common-setting/common-setting.js

@@ -1,26 +1,41 @@
 // pages/common-setting/common-setting.js
+import { baseurl } from '../../config'
+const app = getApp()
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    logout: false,
-    url: encodeURIComponent('http://www.hap-job.com/privicy.html')
+    version: '',
+    cancellation: false,
+    userAgreement: encodeURIComponent(baseurl + '/uploadfile/userAgreement.html'),
+    privacyPolicy: encodeURIComponent(baseurl + '/uploadfile/privacyPolicy.html')
   },
-  showLogout() {
+  showCancellation() {
     this.setData({
-      logout: !this.data.logout
+      cancellation: !this.data.cancellation
     })
   },
-  logout() {
+  cancellation() {
     wx.clearStorage({
       success: res => {
         this.setData({
-          logout: false
+          cancellation: false
+        })
+        wx.$emit('is_login', false, () => {
+          wx.navigateBack({
+            delta: 2
+          })
         })
+      }
+    })
+  },
+  logout() {
+    wx.clearStorage({
+      success: res => {
         wx.reLaunch({
-          url: '/pages/login/login',
+          url: '/pages/index/index',
         })
       }
     })
@@ -28,56 +43,65 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function(options) {
-
+  onLoad: function (options) {
+    if (wx.getAccountInfoSync) {
+      const info = wx.getAccountInfoSync()
+      this.setData({
+        version: info.miniProgram.version || app.globalData.version
+      })
+    } else {
+      this.setData({
+        version: app.globalData.version
+      })
+    }
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function() {
+  onShow: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function() {
+  onHide: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function() {
+  onUnload: function () {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
+  onPullDownRefresh: function () {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function() {
+  onReachBottom: function () {
 
   },
 
   /**
    * 用户点击右上角分享
    */
-  onShareAppMessage: function() {
+  onShareAppMessage: function () {
 
   }
 })

+ 43 - 26
pages/common-setting/common-setting.wxml

@@ -1,38 +1,55 @@
 <!--pages/common-setting/common-setting.wxml-->
 <view class="container">
-  <!-- 个人信息 -->
-  <view class="cell-grounp">
-    <navigator class="cell" url="/pages/web-view/web-view?url={{url}}" hover-class="none">
-      <view class="content">
-        <image class="cell-pic" src="/images/icon/agreement-privacy.png"></image>
-        <text>用户协议与隐私政策</text>
-      </view>
-      <image src="/images/icon/right.png" class="right"></image>
-    </navigator>
-    <!-- <navigator class="cell" url="/pages/version/version" hover-class="none">
+
+	<view class="logo">
+		<image src="/images/icon/logo.png" class="logo-image"></image>
+		<text class="version">版本号 V{{version}}</text>
+	</view>
+
+
+
+
+	<!-- 个人信息 -->
+	<view class="cell-grounp">
+		<navigator class="cell" url="/pages/web-view/web-view?url={{userAgreement}}" hover-class="none">
+			<view class="content">
+				<image class="cell-pic" src="/images/icon/agreement-privacy.png"></image>
+				<text>用户协议</text>
+			</view>
+			<image src="/images/icon/right.png" class="right"></image>
+		</navigator>
+
+		<navigator class="cell" url="/pages/web-view/web-view?url={{privacyPolicy}}" hover-class="none">
+			<view class="content">
+				<image class="cell-pic" src="/images/icon/version.png"></image>
+				<text>隐私政策</text>
+			</view>
+			<image src="/images/icon/right.png" class="right"></image>
+		</navigator>
+		<!-- <navigator class="cell" url="/pages/version/version" hover-class="none">
       <view class="content">
         <image class="cell-pic" src="/images/icon/version.png"></image>
         <text>版本信息</text>
       </view>
       <image src="/images/icon/right.png" class="right"></image>
     </navigator> -->
-  </view>
-  <view class="quit" bindtap="showLogout">
-    注销账户
-  </view>
+	</view>
+	<view class="cancellation global-family" bindtap="showCancellation">
+		注销账户
+	</view>
 </view>
-<view class="cover" wx:if='{{logout}}'>
-
-  <view class="cover-content">
-
-    <view class="body">
-      注销账号是一个不可逆操作, 注销后会失去所有记录,请谨慎操作。
-    </view>
-    <view class="action">
-      <view class="cancel" bindtap="showLogout">取消</view>
-      <view class="confirm" bindtap="logout">确认</view>
-    </view>
-  </view>
+<view class="cover" wx:if='{{cancellation}}'>
+
+	<view class="cover-content">
+
+		<view class="body">
+			注销账号是一个不可逆操作, 注销后会失去所有记录,请谨慎操作。
+		</view>
+		<view class="action">
+			<view class="cancel" bindtap="showCancellation">取消</view>
+			<view class="confirm" bindtap="cancellation">确认</view>
+		</view>
+	</view>
 
 
 </view>

+ 23 - 4
pages/common-setting/common-setting.wxss

@@ -4,10 +4,28 @@ page {
   background: #f5f5f5;
 }
 
-.cell-grounp {
+.logo {
+  height: 320rpx;
+  background: #fff;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  margin-bottom: 1rpx;
   margin-top: 20rpx;
 }
 
+.logo-image {
+  height: 148rpx;
+  width: 148rpx;
+}
+
+.version {
+  font-size: 24rpx;
+  color: #31364C;
+  margin-top: 24rpx;
+}
+
 .cell {
   width: 750rpx;
   height: 148rpx;
@@ -19,7 +37,7 @@ page {
   display: flex;
   align-items: center;
   justify-content: space-between;
-  margin-bottom: 2rpx;
+  margin-bottom: 1rpx;
 }
 
 .cell .content {
@@ -39,7 +57,8 @@ page {
   height: 30rpx;
 }
 
-.quit {
+.cancellation,
+.logout {
   height: 100rpx;
   font-size: 32rpx;
   color: #31364c;
@@ -95,4 +114,4 @@ page {
 .cancel {
   color: #888a8e;
   border-right: 1rpx solid #cdcfd3;
-}
+}

+ 190 - 59
pages/detail/detail.js

@@ -1,5 +1,13 @@
 // pages/detail/detail.js
 const app = getApp();
+const errorMessage = {
+  info_name: '请填写姓名',
+  idcardNumber: '请填写身份证号码',
+}
+const errorKey = {
+  info_name: 'name_error',
+  idcardNumber: 'id_error',
+}
 Page({
 
   /**
@@ -7,6 +15,9 @@ Page({
    */
   data: {
     cover: true, // 蒙层
+    hasInfo: false, //是否拥有个人信息
+    info_name: '',
+    idcardNumber: '',
     bright_points: '', // 亮点
     message: { //订单状态映射
       '0': '确认订单',
@@ -15,8 +26,10 @@ Page({
       '3': '订单中止',
       '4': '订单完成'
     },
-    status: 0, //按钮状态 1 我要报名 2 已确认订单 3 订单待确认、订单进行中
+    status: 0, //按钮状态 1 需求 2 已报名 3 订单
     show: true,
+    name_error: false,
+    id_error: false,
     // btn_message: ''
   },
   /**
@@ -26,12 +39,41 @@ Page({
    * @enroll_from  {number} 报名来源(0:小程序  1:APP  2:后台)
    */
   apply() {
+    if (!this.data.hasInfo) {
+      for (const key in errorMessage) {
+        if (this.data.hasOwnProperty(key) && !this.data[key]) {
+          wx.showToast({
+            icon: 'none',
+            title: errorMessage[key],
+            success: _ => {
+              this.setData({
+                [errorKey[key]]: errorMessage[key]
+              })
+            }
+          })
+          return
+        }
+      }
+      if (this.data.idcardNumber.length !== 15 && this.data.idcardNumber.length !== 18) {
+        wx.showToast({
+          icon: 'none',
+          title: '身份证号码格式错误',
+          success: res => {
+            this.setData({
+              id_error: '身份证号码格式错误'
+            })
+          }
+        })
+      }
+    }
     wx.kx_request({
       url: wx.kx_api.hwRequirement.enrollmentRequire,
       model: true,
       type: 'post',
       data: {
         requirement_id: this.data.id,
+        name: this.data.info_name,
+        idcardNumber: this.data.idcardNumber,
         bright_points: this.data.bright_points,
         enroll_from: 0
       },
@@ -61,6 +103,47 @@ Page({
       }
     })
   },
+
+  /**
+   * 亮点输入
+   * @idcardNumber {string} 身份证
+   */
+  saveIdCardNumber(e) {
+    const idcardNumber = e.detail.value
+    if (idcardNumber) {
+      if (idcardNumber.length !== 15 && idcardNumber.length !== 18) {
+        this.setData({
+          id_error: '身份证号码格式错误'
+        })
+      } else {
+        this.setData({
+          idcardNumber,
+          id_error: false
+        })
+      }
+    } else {
+      this.setData({
+        id_error: '请填写身份证号码'
+      })
+    }
+  },
+  /**
+   * 亮点输入
+   * @name {string} 姓名
+   */
+  saveName(e) {
+    const info_name = e.detail.value
+    if (info_name) {
+      this.setData({
+        info_name,
+        name_error: false
+      })
+    } else {
+      this.setData({
+        name_error: '请填写姓名'
+      })
+    }
+  },
   /**
    * 亮点输入
    * @bright_points {string} 亮点
@@ -147,7 +230,7 @@ Page({
         }
       })
     }
-    if (contractType === 1 || contractType === 0 ) {
+    if (contractType === 1 || contractType === 0) {
       wx.kx_request({
         url: wx.kx_api.hwOrder.confirmOrder,
         type: 'post',
@@ -172,6 +255,21 @@ Page({
       })
     }
   },
+  async showCover() {
+    const userinfo = await app.utils.getHwUserInfo(this)
+    if (userinfo.idcardNumber && userinfo.name) {
+      this.setData({
+        cover: false,
+        hasInfo: true
+      })
+    } else {
+      this.setData({
+        cover: false,
+        hasInfo: false
+      })
+    }
+
+  },
   /**
    * 控制cover层的显示与隐藏
    */
@@ -182,6 +280,33 @@ Page({
     })
   },
   /**
+    * 取消报名
+    * @enroll_id {string} 报名id
+    */
+  cancelEnrollment() {
+    const id = this.data.enrollId
+    wx.kx_request({
+      url: wx.kx_api.hwRequirement.cancelEnrollment,
+      type: 'post',
+      data: {
+        enroll_id: id
+      },
+      success: res => {
+        wx.showToast({
+          icon: 'none',
+          title: '取消成功',
+          success: res => {
+            setTimeout(() => {
+              wx.navigateBack({
+                delta: 1
+              })
+            }, 1200)
+          }
+        })
+      }
+    })
+  },
+  /**
    * 
    */
   buttonRight() {
@@ -190,105 +315,111 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function(options) {
-    if (wx.getStorageSync('userid')) {
-      if (options.id && options.status) {
-        //  如果 状态为3  请求订单详情 ID为订单id
-        if (options.status === '3') {
-          wx.kx_request({
-            url: wx.kx_api.hwOrder.getOrderDetail,
-            data: {
-              orderId: options.id
-            },
-            success: res => {
-              if (res.errcode === 0) {
-                this.setData({
-                  ...res.data.hwRequirementAPI,
-                  hwOrderAPI: res.data.hwOrderAPI,
-                  // btn_message: res.data.hwOrderAPI.status === 2 && res.data.hwOrderAPI.serviceStage ? `第${res.data.hwOrderAPI.serviceStage}期服务中` : this.data.message[res.data.hwOrderAPI.status]
-                })
-              }
-            }
-          })
-        }
+  onLoad: function (options) {
+    this.setData({
+      options
+    })
 
-        // 如果状态为1或者2 请求需求详情 ID为需求id
-        if (options.status === '1' || options.status === '2') {
-          wx.kx_request({
-            url: wx.kx_api.hwRequirement.getRequirementDetail,
-            data: {
-              hwRequirementId: options.id
-            },
-            success: res => {
-              if (res.errcode === 0) {
-                this.setData({
-                  ...res.data.hwRequirementAPI
-                })
-              }
-            }
-          })
-        }
-      }
-      // 保存状态
-      if (options.status) {
-        this.setData({
-          status: Number(options.status),
-          show: false
-        })
-      }
-    } else {
-      wx.redirectTo({
-        url: `/pages/login/login?path=/pages/detail/detail&&id=${options.id}&&status=${options.status}`,
-      })
-    }
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function() {
+  onShow: function () {
+    const options = this.data.options
+    if (options.id && options.status) {
+      //  如果 状态为3  请求订单详情 ID为订单id
+      if (options.status === '2') {
+        wx.kx_request({
+          url: wx.kx_api.hwOrder.getOrderDetail,
+          data: {
+            orderId: options.id
+          },
+          success: res => {
+            if (res.errcode === 0) {
+              this.setData({
+                ...res.data.hwRequirementAPI,
+                hwOrderAPI: res.data.hwOrderAPI,
+                // btn_message: res.data.hwOrderAPI.status === 2 && res.data.hwOrderAPI.serviceStage ? `第${res.data.hwOrderAPI.serviceStage}期服务中` : this.data.message[res.data.hwOrderAPI.status]
+              })
+            }
+          }
+        })
+      }
 
+      // 如果状态为1 请求需求详情 ID为需求id
+      if (options.status === '1') {
+        wx.kx_request({
+          url: wx.kx_api.hwRequirement.getRequirementDetail,
+          data: {
+            user_id: wx.getStorageSync('userid'),
+            user_token: wx.getStorageSync('usertoken'),
+            hwRequirementId: options.id
+          },
+          success: res => {
+            if (res.errcode === 0) {
+              this.setData({
+                ...res.data.hwRequirementAPI,
+                displayCancel: res.data.displayCancel || null,
+                needEnrollment: res.data.needEnrollment || null,
+                enrollId: res.data.enrollId || null
+              })
+            }
+          }
+        })
+      }
+    }
+    // 保存状态
+    if (options.status) {
+      this.setData({
+        status: Number(options.status),
+        show: false
+      })
+    }
+    this.setData({
+      user_id: wx.getStorageSync('userid'),
+    })
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function() {
+  onHide: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function() {
+  onUnload: function () {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
+  onPullDownRefresh: function () {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function() {
+  onReachBottom: function () {
 
   },
 
   /**
    * 用户点击右上角分享
    */
-  onShareAppMessage: function() {
+  onShareAppMessage: function () {
     return {
       title: this.data.name,
       path: `/pages/detail/detail?id=${this.data.id}&&status=${this.data.status}`

+ 128 - 84
pages/detail/detail.wxml

@@ -1,90 +1,134 @@
 <!--pages/detail/detail.wxml-->
 <import src='/template/button/button.wxml' />
-<wxs src="../../app.wxs" module='app' />
-<view class="container" hidden="{{show}}">
-  <!-- 待遇详情 -->
-  <view class="header">
-    <view class="info">
-      <view class="name">{{name}}</view>
-      <view class="money">
-        <text>{{price}}元</text>
-        <text class="month" wx:if='{{settlementMethod===1 }}'>*{{stage || 0}}期</text>
-        <text class="month" wx:if='{{settlementMethod===0 }}'>*1次</text>
-      </view>
-    </view>
-    <view class="bottom">
-      <view class="time">
-        <image src="/images/icon/time.png"></image>
-        <text>{{expiryDate}}</text>
-      </view>
-      <view class="job-nums">
-        <image src="/images/icon/jobs.png"></image>
-        <text>任务数:{{number || '若干'}}</text>
-      </view>
-    </view>
-  </view>
-  <!-- 待遇详情结束 -->
-  <!-- 公司地址 -->
-  <view class="address" data-name="{{companyName}}" data-address="{{provinceCityCountry}}{{address || ''}}" bindtap="openMap">
-    <image src="/images/icon/tower.png"></image>
-    <view class="address-info">
-      <view class="address-info-text">{{companyName}}</view>
-      <view class="point">
-        <image src="/images/icon/address_for_detail.png"></image>
-        <text>{{provinceCityCountry}}{{address || ''}}</text>
-      </view>
-    </view>
-  </view>
-  <!-- 公司地址结束 -->
-  <!-- 需求详情 -->
-  <view class="detail">
-    <view class="cell">
-      <view class="cell-title">需求描述</view>
-      <view class="cell-content">
-        <text>{{description}}</text>
-      </view>
-    </view>
-    <view class="cell">
-      <view class="cell-title">资质要求</view>
-      <view class="cell-content">
-        <text>{{qualification}}</text>
-      </view>
-    </view>
-    <view class="cell">
-      <view class="cell-title">验收标准</view>
-      <view class="cell-content">
-        <text>{{acceptanceCriteria}}</text>
-      </view>
-    </view>
-  </view>
-  <!-- 需求详情结束 -->
-  <!-- 底部按钮开始 -->
-  <template is='button-fixed' wx:if='{{status === 1}}' data='{{text:"我要报名",func:"cover"}}' />
-  <template is='button-fixed' wx:if='{{status === 2}}' data='{{text:"已报名",background:"linear-gradient(135deg,#ECF0F3 0%,#E4E2E7 100%)"}}' />
-  <!-- 如果合同存在则显示查看合同 没有则显示不显示该字段-->
-  <template is='button-check' wx:if='{{status === 3}}' data='{{text:"查看合同",btn:message[hwOrderAPI.status],background:hwOrderAPI.status === 0?"":"linear-gradient(135deg,#ECF0F3 0%,#E4E2E7 100%)",buttonRight:hwOrderAPI.status === 0?"":"buttonRight",display:hwOrderAPI.workContract?"":"none"}}'
-  />
-  <!-- 底部按钮结束-->
+<wxs src="../../app.wxs" module='app'></wxs>
+<view class="container safe-area" hidden="{{show}}">
+	<!-- 待遇详情 -->
+	<view class="header">
+		<view class="info">
+			<view class="name global-family">{{name}}</view>
+			<view class="money">
+				<text>{{price}}元</text>
+				<text class="month" wx:if='{{settlementMethod===1 }}'>*{{stage || 0}}期</text>
+				<text class="month" wx:if='{{settlementMethod===0 }}'>*1次</text>
+			</view>
+		</view>
+		<view class="bottom">
+			<view class="time">
+				<!-- <image src="/images/icon/time.png"></image>
+        <text>{{expiryDate}}</text> -->
+			</view>
+			<view class="job-nums">
+				<image src="/images/icon/jobs.png"></image>
+				<text>任务数:{{number || '若干'}}</text>
+			</view>
+		</view>
+	</view>
+	<!-- 待遇详情结束 -->
+	<!-- 公司地址 -->
+	<view class="address" data-name="{{companyName}}" data-address="{{provinceCityCountry}}{{address || ''}}" bindtap="openMap">
+		<image src="/images/icon/tower.png"></image>
+		<view class="address-info">
+			<view class="address-info-text">{{companyName}}</view>
+			<view class="point">
+				<image src="/images/icon/address_for_detail.png"></image>
+				<text>{{provinceCityCountry}}{{address || ''}}</text>
+			</view>
+		</view>
+	</view>
+	<!-- 公司地址结束 -->
+	<!-- 需求详情 -->
+	<view class="detail">
+		<view class="cell">
+			<view class="cell-title">需求描述</view>
+			<view class="cell-content">
+				<text>{{description}}</text>
+			</view>
+		</view>
+		<view class="cell">
+			<view class="cell-title">资质要求</view>
+			<view class="cell-content">
+				<text>{{qualification}}</text>
+			</view>
+		</view>
+		<view class="cell">
+			<view class="cell-title">验收标准</view>
+			<view class="cell-content">
+				<text>{{acceptanceCriteria}}</text>
+			</view>
+		</view>
+	</view>
+	<!-- 需求详情结束 -->
+	<view class="isOn safe-area" wx:if='{{isOn === 0}}'>
+		<text>需求已经下架啦~</text>
+	</view>
+	<!-- 底部按钮开始 -->
+	<block wx:if='{{status === 1}}'>
+		<block wx:if='{{user_id}}'>
+			<template is='button-fixed' wx:if="{{displayCancel}}" data='{{text:"取消报名",func:"cancelEnrollment"}}' />
+			<template is='button-fixed' wx:if="{{!displayCancel&&needEnrollment}}" data='{{text:"我要报名",func:"showCover"}}' />
+			<template is='button-fixed' wx:if="{{!displayCancel&&!needEnrollment}}" data='{{text:"订单已生成",background:"linear-gradient(135deg,#ECF0F3 0%,#E4E2E7 100%)"}}' />
+		</block>
+		<block wx:else>
+			<template is='button-fixed' data='{{text:"我要报名",func:"showCover"}}' />
+		</block>
+	</block>
+	<!-- 如果合同存在则显示查看合同 没有则显示不显示该字段-->
+	<template is='button-check' wx:if='{{status === 2}}' data='{{text:"查看合同",btn:message[hwOrderAPI.status],background:hwOrderAPI.status === 0?"":"linear-gradient(135deg,#ECF0F3 0%,#E4E2E7 100%)",buttonRight:hwOrderAPI.status === 0?"":"buttonRight",display:hwOrderAPI.workContract?"":"none"}}' />
+	<!-- 底部按钮结束-->
 </view>
 
 <view class="cover" hidden="{{cover}}">
-  <view class="model">
-    <view class="cancel-icon">
-      <image src="/images/icon/cancel.png" class="cancel-img" bindtap="cover"></image>
-    </view>
-    <view class="model-title">
-      我的亮点
-    </view>
-    <view class="textarea">
-      <textarea placeholder="填写亮点更容易获得发布者的青睐,该项为选填项。" placeholder-style="color:#888A8E;" bindinput="input"></textarea>
-    </view>
-    <view class="model-action">
-      <view class="cancel" bindtap="cover">
-        取消
-      </view>
-      <view class="confirm" bindtap="apply">
-        确认报名
-      </view>
-    </view>
-  </view>
+
+	<view class="model" hidden="{{!hasInfo}}">
+		<view class="cancel-icon">
+			<image src="/images/icon/cancel.png" class="cancel-img" bindtap="cover"></image>
+		</view>
+		<view class="model-title">
+			我的亮点
+		</view>
+		<view class="textarea">
+			<textarea placeholder="填写亮点更容易获得发布者的青睐,该项为选填项。" placeholder-style="color:#888A8E;" bindinput="input"></textarea>
+		</view>
+		<view class="model-action">
+			<view class="cancel" bindtap="cover">
+				取消
+			</view>
+			<view class="confirm" bindtap="apply">
+				确认报名
+			</view>
+		</view>
+	</view>
+	<view class="supplement-info" hidden="{{hasInfo}}">
+		<image src="/images/icon/cancel.png" class="supplement-cancel-icon" bindtap="cover"></image>
+		<view class="supplement-header">
+			<text class="supplement-header-title global-family">提示</text>
+			<text class="supplement-header-content">为了保障真实性以便于发包方联系您,您需要完善个人信息。</text>
+		</view>
+		<view class="supplement-input {{!name_error||'border'}}">
+			<view class="labal">姓名:</view>
+			<input placeholder="请输入姓名" placeholder-class="placeholder" class="input" bindblur="saveName"></input>
+		</view>
+		<view class="error">
+			<text hidden="{{!name_error}}">{{name_error}}</text>
+		</view>
+		<view class="supplement-input {{!id_error||'border'}}">
+			<view class="labal">身份证号:</view>
+			<input placeholder="请输入身份证号" placeholder-class="placeholder" class="input" bindblur="saveIdCardNumber"></input>
+		</view>
+		<view class="error">
+			<text hidden="{{!id_error}}">{{id_error}}</text>
+		</view>
+		<view class="supplement-input-textarea">
+			<view class="labal">我的亮点:</view>
+			<textarea placeholder="填写亮点更容易获得发布者的青睐,该项为选填项。" placeholder-class="placeholder" class="input" bindinput="input"></textarea>
+		</view>
+		<view class="supplement-action">
+			<view class="cancel" bindtap="cover">
+				取消
+			</view>
+			<view class="confirm" bindtap="apply">
+				确认报名
+			</view>
+		</view>
+	</view>
 </view>

+ 131 - 5
pages/detail/detail.wxss

@@ -2,7 +2,7 @@
 
 page {
   background: #f5f5f5;
-  padding-bottom: 139rpx;
+  padding-bottom: 201rpx;
 }
 
 /* 待遇详情 */
@@ -24,8 +24,9 @@ page {
 }
 
 .name {
+  flex: 1;
   color: #31364c;
-  font-size: 48rpx;
+  font-size: 42rpx;
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
@@ -34,8 +35,8 @@ page {
 .money {
   color: #3243bd;
   font-size: 38rpx;
-  flex-basis:275rpx;
   text-align: right;
+  margin-left: 15rpx;
 }
 
 .month {
@@ -56,7 +57,7 @@ page {
   align-items: center;
 }
 
-.bottom  image {
+.bottom image {
   height: 25rpx;
   width: 25rpx;
   margin-right: 10rpx;
@@ -202,7 +203,8 @@ page {
   border-top: 1rpx solid #eaebee;
 }
 
-.cancel, .confirm {
+.cancel,
+.confirm {
   width: 50%;
   height: 100%;
   line-height: 110rpx;
@@ -219,3 +221,127 @@ page {
 /* .confirm {
   border-left: 1rpx solid #eaebee;
 } */
+
+.supplement-info {
+  height: 896rpx;
+  width: 670rpx;
+  background: #f5f5f5;
+  border-radius: 10rpx;
+  box-sizing: border-box;
+  position: relative;
+}
+
+.supplement-cancel-icon {
+  height: 24rpx;
+  width: 24rpx;
+  position: absolute;
+  right: 30rpx;
+  top: 30rpx;
+}
+
+.supplement-header {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  margin-top: 60rpx;
+}
+
+.supplement-header-title {
+  color: #31364C;
+  font-size: 38rpx;
+}
+
+.supplement-header-content {
+  width: 610rpx;
+  color: #31364C;
+  font-size: 24rpx;
+  padding: 20rpx;
+  box-sizing: border-box;
+  margin: 0 auto;
+  margin-bottom: 30rpx;
+}
+
+.supplement-input {
+  height: 88rpx;
+  width: 610rpx;
+  font-size: 28rpx;
+  background: #fff;
+  display: flex;
+  align-items: center;
+  padding: 24rpx 30rpx;
+  border: 1rpx solid #fff;
+  border-radius: 10rpx;
+  box-sizing: border-box;
+  margin: 0 auto;
+}
+
+.supplement-input-textarea {
+  height: 178rpx;
+  width: 610rpx;
+  font-size: 28rpx;
+  background: #fff;
+  display: flex;
+  padding: 24rpx 30rpx;
+  border-radius: 10rpx;
+  box-sizing: border-box;
+  margin: 0 auto;
+}
+
+.placeholder {
+  color: #888A8E;
+  font-size: 28rpx;
+}
+
+.labal {
+  margin-right: 10rpx;
+}
+
+.input {
+  flex: 1;
+  height: 100%;
+  color: #31364C;
+  font-size: 28rpx;
+}
+
+.error {
+  height: 59rpx;
+  width: 610rpx;
+  color: #D1213E;
+  font-size: 24rpx;
+  line-height: 59rpx;
+  padding: 0 15rpx;
+  box-sizing: border-box;
+  margin: 0 auto;
+}
+
+.supplement-action {
+  width: 100%;
+  height: 110rpx;
+  display: flex;
+  border-top: 1rpx solid #eaebee;
+  align-items: center;
+  position: absolute;
+  bottom: 0;
+}
+
+.supplement-action .cancel {
+  color: #888A8E;
+}
+
+.border {
+  border: 1rpx solid #D1213E;
+}
+
+.isOn {
+  width: 750rpx;
+  height: 62rpx;
+  font-size: 28rpx;
+  font-family: PingFangSC-Semibold, PingFang SC;
+  font-weight: 600;
+  color: #fff;
+  background: rgba(0, 0, 0, 0.4);
+  line-height: 62rpx;
+  text-align: center;
+  position: fixed;
+  bottom: 124rpx;
+}

+ 121 - 94
pages/index/index.js

@@ -31,82 +31,82 @@ Page({
     city_id: '', //城市ID
     area_id: '', //地区ID
     industryList: [{
-        id: '',
-        name: '不限行业'
-      },
-      {
-        id: 0,
-        name: '教育培训'
-      },
-      {
-        id: 1,
-        name: 'IT互联网'
-      },
-      {
-        id: 2,
-        name: '仓储物流'
-      },
-      {
-        id: 3,
-        name: '酒店餐饮'
-      },
-      {
-        id: 4,
-        name: '家政保洁'
-      },
-      {
-        id: 5,
-        name: '维修保养'
-      },
-      {
-        id: 6,
-        name: '会务会展'
-      },
-      {
-        id: 7,
-        name: '专业服务'
-      },
-      {
-        id: 8,
-        name: '生产制造'
-      },
-      {
-        id: 9,
-        name: '其他行业'
-      },
+      id: '',
+      name: '不限行业'
+    },
+    {
+      id: 0,
+      name: '教育培训'
+    },
+    {
+      id: 1,
+      name: 'IT互联网'
+    },
+    {
+      id: 2,
+      name: '仓储物流'
+    },
+    {
+      id: 3,
+      name: '酒店餐饮'
+    },
+    {
+      id: 4,
+      name: '家政保洁'
+    },
+    {
+      id: 5,
+      name: '维修保养'
+    },
+    {
+      id: 6,
+      name: '会务会展'
+    },
+    {
+      id: 7,
+      name: '专业服务'
+    },
+    {
+      id: 8,
+      name: '生产制造'
+    },
+    {
+      id: 9,
+      name: '其他行业'
+    },
     ], //行业列表
     priceList: [{
-        id: '',
-        name: '不限'
-      },
-      {
-        id: 1,
-        name: '3K以下'
-      },
-      {
-        id: 2,
-        name: '3K-5K'
-      },
-      {
-        id: 3,
-        name: '5K-8K'
-      },
-      {
-        id: 4,
-        name: '8K-12K'
-      },
-      {
-        id: 5,
-        name: '12K-20K'
-      },
-      {
-        id: 6,
-        name: '20K-30K'
-      },
-      {
-        id: 7,
-        name: '30K以上'
-      },
+      id: '',
+      name: '不限'
+    },
+    {
+      id: 1,
+      name: '3K以下'
+    },
+    {
+      id: 2,
+      name: '3K-5K'
+    },
+    {
+      id: 3,
+      name: '5K-8K'
+    },
+    {
+      id: 4,
+      name: '8K-12K'
+    },
+    {
+      id: 5,
+      name: '12K-20K'
+    },
+    {
+      id: 6,
+      name: '20K-30K'
+    },
+    {
+      id: 7,
+      name: '30K以上'
+    },
     ], // 单价列表
     list: [], //需求列表
     pageNo: 1,
@@ -114,7 +114,7 @@ Page({
     offline: false,
     loading: true,
     list_length: false,
-    show: true,
+    show: false,
     transition: true,
     fixTop: 0,
     scrollTop: 0,
@@ -227,9 +227,26 @@ Page({
    * 跳转个人中心
    */
   toPerson() {
-    wx.navigateTo({
-      url: '/pages/person/person',
-    })
+    if (wx.getStorageSync('userid') && wx.getStorageSync('usertoken')) {
+      wx.navigateTo({
+        url: '/pages/person/person',
+      })
+    } else {
+      wx.showModal({
+        title: '提示',
+        content: '你还未登陆,是否立即登录',
+        cancelColor: '#888A8E',
+        confirmColor: '#31364C',
+        success: res => {
+          if (res.confirm) {
+            wx.navigateTo({
+              url: '/pages/login/login',
+            })
+          }
+        }
+      })
+    }
+
   },
   /**
    * 跳转详情页
@@ -262,7 +279,9 @@ Page({
         country_code,
         trade_type,
         priceType,
-        platform_id: wx.getStorageSync('userinfo').platformId
+        user_id: wx.getStorageSync('userid'),
+        user_token: wx.getStorageSync('usertoken'),
+        platform_id: app.globalData.platformId
       },
       success: res => {
         // 如果没有网络  展示网络故障界面
@@ -331,13 +350,10 @@ Page({
     })
     // 获取首页banner图
     this.getBanner();
-    app.utils.getHwUserInfo();
+    // app.utils.getHwUserInfo();
   },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function(options) {
-    if (wx.getStorageSync('userid')) {
+  checkLogin() {
+    if (wx.getStorageSync('userid') && wx.getStorageSync('usertoken')) {
       if (wx.getStorageSync('userinfo').registerFrom === 0) {
         wx.reLaunch({
           url: '/pages/success/success',
@@ -349,23 +365,34 @@ Page({
         })
       }
     } else {
-      wx.redirectTo({
+      wx.navigateTo({
         url: '/pages/login/login',
       })
     }
   },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.reload()
+    wx.$watch('is_login', this, () => {
+      this.reload()
+    })
+  },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function() {
+  onShow: function () {
+    // this.checkLogin()
+
     /**
      * 初始化动画
      * @condition_animation 条件框动画
@@ -411,21 +438,21 @@ Page({
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function() {
+  onHide: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function() {
+  onUnload: function () {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
+  onPullDownRefresh: function () {
     this.setData({
       list: [],
       pageNo: 1,
@@ -438,7 +465,7 @@ Page({
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function() {
+  onReachBottom: function () {
     const isLast = this.data.isLast;
     if (isLast) {
       // wx.showToast({
@@ -453,10 +480,10 @@ Page({
   /**
    * 用户点击右上角分享
    */
-  onShareAppMessage: function() {
+  onShareAppMessage: function () {
 
   },
-  onPageScroll: function(res) {
+  onPageScroll: function (res) {
     let top = res.scrollTop;
     this.setData({
       scrollTop: top

+ 2 - 1
pages/index/index.wxml

@@ -54,7 +54,7 @@
     <block wx:for='{{list}}' wx:key="index">
       <view class="list-item" wx:for='{{item}}' wx:key="index" data-id="{{item.id}}" bindtap="toDetail">
         <view class="top">
-          <text class="name">{{item.name}}</text>
+          <view class="name global-family">{{item.name}}</view>
           <text class="payment">
           <text>{{item.price}}元*</text>
           <text wx:if='{{item.settlementMethod===1 }}'>{{item.stage || 0}}期</text>
@@ -75,6 +75,7 @@
             <text>任务数:{{item.number || '若干'}}</text>
           </view>
         </view>
+        <image src="/images/icon/yibaoming.png" class="icon" wx:if='{{item.isEnrollment}}'></image>
       </view>
     </block>
 

+ 20 - 5
pages/index/index.wxss

@@ -171,15 +171,26 @@ swiper-item image {
   box-sizing: border-box;
   background: #fff;
   margin-bottom: 15rpx;
+  position: relative;
+}
+
+.icon {
+  height: 106rpx;
+  width: 106rpx;
+  position: absolute;
+  right: 0;
+  bottom: 0;
 }
 
-.top, .midden {
+.top,
+.midden {
   display: flex;
   align-items: center;
   justify-content: space-between;
 }
 
 .name {
+  flex: 1;
   color: #31364c;
   font-size: 34rpx;
   overflow: hidden;
@@ -190,7 +201,7 @@ swiper-item image {
 .payment {
   color: #3243bd;
   font-size: 34rpx;
-  flex-basis: 265rpx;
+  max-width: 265rpx;
   text-align: right;
 }
 
@@ -246,7 +257,9 @@ swiper-item image {
   box-sizing: border-box;
 }
 
-.offline, .loading, .list-length {
+.offline,
+.loading,
+.list-length {
   height: calc(100vh - 628rpx);
   color: #cdcfd3;
   font-size: 28rpx;
@@ -286,16 +299,18 @@ swiper-item image {
   top: -413rpx;
 }
 
-.choose-area-content.nofixed {
+.choose-area-content {
   position: relative;
+  z-index: 1;
 }
 
 .choose-area-content.fixed {
   position: fixed;
   top: 0;
   left: 0;
+  z-index: 1;
 }
 
 .margin {
   margin-top: 142rpx;
-}
+}

+ 112 - 79
pages/login/login.js

@@ -5,6 +5,7 @@ const time = 60;
 const interval = 50;
 let phoneInter = false;
 let codeInter = false;
+import { baseurl, captcha } from '../../config'
 Page({
 
   /**
@@ -17,76 +18,95 @@ Page({
     canLogin: false, //是否可以登陆
     phone: '', // 手机
     code: '', // 验证码
+    userAgreement: encodeURIComponent(baseurl + '/uploadfile/userAgreement.html'),
+    privacyPolicy: encodeURIComponent(baseurl + '/uploadfile/privacyPolicy.html')
   },
   // 打开用户协议
-  openAgreement() {
+  openWebView(e) {
+    console.log(e)
     wx.navigateTo({
-      url: '/pages/service_agreement/service_agreement',
+      url: '/pages/web-view/web-view?url=' + e.currentTarget.dataset.url,
     })
   },
   /**
-   * 获取验证码
-   * @phone 电话号码
+   * 
+   * 时间倒计时
    */
-  getCode(e) {
-    if (this.data.time === time) {
-      if (app.globalData.phone_zz.test(this.data.phone)) {
-        this.setInter = setInterval(_ => {
-          let _time = this.data.time;
-          _time--;
-          if (_time > 0) {
-            this.setData({
-              code_message: `重新发送(${_time}s)`,
-              color: true,
-              time: _time
-            })
-          } else {
-            clearInterval(this.setInter);
+  countDown(options) {
+    const _time = --this.data.time;
+    this.setData({
+      code_message: `重新发送(${_time}s)`,
+      color: true,
+      time: _time
+    })
+    this.setInter = setInterval(_ => {
+      let _time = this.data.time;
+      _time--;
+      if (_time > 0) {
+        this.setData({
+          code_message: `重新发送(${_time}s)`,
+          color: true,
+          time: _time
+        })
+      } else {
+        clearInterval(this.setInter);
+        this.setData({
+          code_message: `重新发送`,
+          color: false,
+          time
+        });
+      }
+    }, speed)
+
+    wx.kx_request({
+      url: wx.kx_api.hwuser.getAuthCode,
+      data: {
+        phone: this.data.phone,
+        ...options
+      },
+      success: res => {
+        if (res.errcode === 0) {
+          wx.showToast({
+            icon: 'none',
+            title: '发送成功',
+          })
+        }
+      },
+      fail: res => {
+        clearInterval(this.setInter);
+        wx.showModal({
+          title: '提示',
+          content: '发送失败,请稍后重试',
+          showCancel: false,
+          success: () => {
             this.setData({
               code_message: `重新发送`,
               color: false,
               time
-            });
-            !this.data.tmp_code && wx.showModal({
-              title: '提示',
-              content: '发送失败,请稍后重试',
-              showCancel: false,
             })
           }
-        }, speed)
-
-        wx.kx_request({
-          url: wx.kx_api.hwuser.getAuthCode,
-          data: {
-            phone: this.data.phone
-          },
-          success: res => {
-            if (res.errcode === 0) {
-              this.setData({
-                tmp_code: res.data.code
-              })
-            }
-          },
-          fail: res => {
-            clearInterval(this.setInter);
-            wx.showModal({
-              title: '提示',
-              content: '发送失败,请稍后重试',
-              showCancel: false,
-              success: () => {
-                this.setData({
-                  code_message: `重新发送`,
-                  color: false,
-                  time
-                })
-              }
-            })
+        })
+      }
+    })
+  },
+  /**
+   * 获取验证码
+   * @phone 电话号码
+   */
+  getCode(e) {
+    if (this.data.time === time) {
+      if (app.globalData.phone_zz.test(this.data.phone)) {
+        wx.navigateToMiniProgram({
+          appId: 'wx5a3a7366fd07e119',
+          path: '/pages/captcha/index',
+          extraData: {
+            appId: captcha//您申请的验证码的 appId
           }
         })
       } else {
         wx.showToast({
           icon: 'none',
-          title: '手机号码格式错误!',
+          title: this.data.phone ? '手机号码格式错误!' : '请填写手机号码!',
         })
       }
     }
@@ -151,27 +171,33 @@ Page({
                   data: res.data.userInfo.userToken,
                   success: data => {
                     wx.setStorageSync('userinfo', res.data.userInfo)
-                    if (res.data.userInfo.registerFrom === 2) {
-                      if (this.options.path) {
-                        let _str = '';
-                        for (let key in this.options) {
-                          if (key !== 'path') {
-                            _str += `${key}=${this.options[key]}&&`
-                          }
-                        }
-                        wx.redirectTo({
-                          url: `${this.options.path}?${_str}`,
-                        })
-                      } else {
-                        wx.reLaunch({
-                          url: '/pages/index/index',
-                        })
-                      }
-                    } else {
-                      wx.redirectTo({
-                        url: '/pages/success/success?type=login_success',
+                    wx.$emit('is_login', true, () => {
+                      wx.navigateBack({
+                        delta: 1,
                       })
-                    }
+                    })
+                    // if (res.data.userInfo.registerFrom === 2) {
+                    //   if (this.options.path) {
+                    //     let _str = '';
+                    //     for (let key in this.options) {
+                    //       if (key !== 'path') {
+                    //         _str += `${key}=${this.options[key]}&&`
+                    //       }
+                    //     }
+                    //     wx.redirectTo({
+                    //       url: `${this.options.path}?${_str}`,
+                    //     })
+                    //   } else {
+                    // wx.reLaunch({
+                    //   url: '/pages/index/index',
+                    // })
+
+                    //   }
+                    // } else {
+                    //   wx.redirectTo({
+                    //     url: '/pages/success/success?type=login_success',
+                    //   })
+                    // }
                   }
                 })
               }
@@ -191,7 +217,7 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function(options) {
+  onLoad: function (options) {
     this.options = options;
     wx.$watch('offline', this, (value) => {
       if (value) {
@@ -203,35 +229,42 @@ Page({
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function() {
-
+  onShow: function () {
+    const captchaResult = app.captchaResult;
+    app.captchaResult = null; // 验证码的票据为一次性票据,取完需要置空
+    if (captchaResult && captchaResult.ret === 0) {
+      // 将验证码的结果返回至服务端校验
+      const ticket = captchaResult.ticket;
+      const randstr = captchaResult.randstr;
+      this.countDown({ ticket, randstr })
+    }
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function() {
+  onHide: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function() {
+  onUnload: function () {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
+  onPullDownRefresh: function () {
 
   }
 })

+ 24 - 20
pages/login/login.wxml

@@ -1,24 +1,28 @@
 <!--pages/login/login.wxml-->
 <import src='/template/button/button.wxml' />
 <view class="container">
-  <!-- 标题 -->
-  <view class="title">
-    登录/注册
-  </view>
-  <!-- 手机号 -->
-  <view class="cell">
-    <input class="input" type="number" placeholder="请输入手机号码" bindinput="checkPhone" name='phone' maxlength="11" placeholder-style="color:#CDCFD3;font-size:30rpx;"></input>
-  </view>
-  <!-- 短信验证码 -->
-  <view class="cell">
-    <input class="input" type="number" placeholder="请输入短信验证码" bindinput="checkcode" name='code' placeholder-style="color:#CDCFD3;font-size:30rpx;"></input>
-    <view class="code {{color&&'color'}}" bindtap="getCode">{{code_message || '获取短信验证码'}}</view>
-  </view>
-  <!-- 注册协议 -->
-  <view class="agreement">
-    <text>未注册开心灵工的手机号将自动注册,且代表您已经同意:</text>
-    <text class="agreement-link" catchtap="openAgreement">《用户注册协议》</text>
-  </view>
-  <!-- 登录 -->
-  <template is='button' data='{{text:"登录",func:"submit",background:canLogin?"linear-gradient(135deg, #5568F0 0%, #823BFF 100%)":"linear-gradient(135deg, #ECF0F3 0%, #E4E2E7 100%)",margin:50}}' />
+	<!-- 标题 -->
+	<view class="title">
+		登录/注册
+	</view>
+	<!-- 手机号 -->
+	<view class="cell">
+		<input class="input" type="number" placeholder="请输入手机号码" bindinput="checkPhone" name='phone' maxlength="11" placeholder-style="color:#CDCFD3;font-size:30rpx;"></input>
+	</view>
+	<!-- 短信验证码 -->
+	<view class="cell">
+		<input class="input" type="number" placeholder="请输入短信验证码" bindinput="checkcode" name='code' placeholder-style="color:#CDCFD3;font-size:30rpx;"></input>
+		<view class="code {{color&&'color'}}" bindtap="getCode">{{code_message || '获取短信验证码'}}</view>
+	</view>
+	<!-- 注册协议 -->
+	<view class="agreement">
+		<text>未注册开心灵工的手机号将自动注册,且代表您已经同意:</text>
+		<view>
+			<text class="agreement-link" data-url="{{userAgreement}}" catchtap="openWebView">《用户协议》</text>
+			与
+			<text class="agreement-link" data-url="{{privacyPolicy}}" catchtap="openWebView">《隐私政策》</text>
+		</view>
+	</view>
+	<!-- 登录 -->
+	<template is='button' data='{{text:"登录",func:"submit",background:canLogin?"linear-gradient(135deg, #5568F0 0%, #823BFF 100%)":"linear-gradient(135deg, #ECF0F3 0%, #E4E2E7 100%)",margin:50}}' />
 </view>

+ 29 - 8
pages/my-apply/my-apply.js

@@ -17,7 +17,7 @@ Page({
   toDetail(e) {
     const id = e.currentTarget.dataset.id;
     wx.navigateTo({
-      url: `/pages/detail/detail?id=${id}&&status=2`,
+      url: `/pages/detail/detail?id=${id}&&status=1`,
     })
   },
   /**
@@ -50,10 +50,31 @@ Page({
       }
     })
   },
+  cancelEnrollment(e) {
+    const { id } = e.currentTarget.dataset;
+    wx.kx_request({
+      url: wx.kx_api.hwRequirement.cancelEnrollment,
+      type: 'post',
+      data: {
+        enroll_id: id
+      },
+      success: res => {
+        wx.showToast({
+          icon: 'none',
+          title: '取消成功',
+          success: res => {
+            setTimeout(() => {
+              this.getList(1)
+            }, 1200)
+          }
+        })
+      }
+    })
+  },
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function(options) {
+  onLoad: function (options) {
     // 获取报名列表
     this.setData({
       list: [],
@@ -66,35 +87,35 @@ Page({
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function() {
+  onShow: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function() {
+  onHide: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function() {
+  onUnload: function () {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
+  onPullDownRefresh: function () {
     this.setData({
       list: [],
       pageNo: 1,
@@ -106,7 +127,7 @@ Page({
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function() {
+  onReachBottom: function () {
     const isLast = this.data.isLast;
     if (isLast) {
       // wx.showToast({

+ 37 - 31
pages/my-apply/my-apply.wxml

@@ -1,35 +1,41 @@
 <!--pages/my-apply/my-apply.wxml-->
-<wxs src="my-apply.wxs" module="tool" />
-<wxs src="../../app.wxs" module="getPriceForm" />
-<view class="container">
-  <block wx:for='{{list}}' wx:key="index">
-    <view class="cell" data-id="{{item.hwRequirement.id}}" bindtap="toDetail" wx:for='{{item}}' wx:key="index">
-      <view class="info">
-        <view class="name">{{item.hwRequirement.name}}</view>
-        <view class="money">
-          <text>{{item.hwRequirement.price}}元</text>
-          <text class="month" wx:if='{{item.hwRequirement.settlementMethod===1 }}'>*{{item.hwRequirement.stage}}期</text>
-          <text class="month" wx:if='{{item.hwRequirement.settlementMethod===0 }}'>*1次</text>
-        </view>
-      </view>
-      <view class="midden">
-        <view class="company">
-          <text>{{item.companyName}}</text>
-        </view>
-      </view>
-      <view class="bottom">
-        <view class="address">
-          <image src="/images/icon/address.png"></image>
-          <text>{{item.hwRequirement.provinceCityCountry || '暂无地址信息'}}</text>
-        </view>
-        <view class="status {{tool.status(item.orderNumber,item.hwRequirement.isOn).className}}">
-          <image src="{{tool.status(item.orderNumber,item.hwRequirement.isOn).src}}"></image>
-          <text>{{tool.status(item.orderNumber,item.hwRequirement.isOn).word}}</text>
-        </view>
-      </view>
-    </view>
+<wxs src="my-apply.wxs" module="tool"></wxs>
+<wxs src="../../app.wxs" module="getPriceForm"></wxs>
+<view class="container safe-area">
+	<block wx:for='{{list}}' wx:key="index">
+		<view class="cell" data-id="{{item.hwRequirement.id}}" bindtap="toDetail" wx:for='{{item}}' wx:key="index">
+			<view class="info">
+				<view class="name global-family">
+					<view class="name-content">{{item.hwRequirement.name}}</view>
+					<view class="icon" wx:if='{{!item.hwRequirement.isOn}}'>已下架</view>
+				</view>
+				<view class="money">
+					<text>{{item.hwRequirement.price}}元</text>
+					<text class="month" wx:if='{{item.hwRequirement.settlementMethod===1 }}'>*{{item.hwRequirement.stage}}期</text>
+					<text class="month" wx:if='{{item.hwRequirement.settlementMethod===0 }}'>*1次</text>
+				</view>
+			</view>
+			<view class="midden">
+				<view class="company">
+					<text>{{item.companyName}}</text>
+				</view>
+			</view>
+			<view class="bottom">
+				<view class="address">
+					<image src="/images/icon/address.png"></image>
+					<text>{{item.hwRequirement.provinceCityCountry || '暂无地址信息'}}</text>
+				</view>
+				<view wx:if='{{item.displayCancel}}' class="cancel-enrollment" data-id="{{item.id}}" catchtap="cancelEnrollment">
+					<text>取消报名</text>
+				</view>
+				<view wx:else class="status {{tool.status(item.orderNumber,item.hwRequirement.isOn).className}}">
+					<image src="{{tool.status(item.orderNumber,item.hwRequirement.isOn).src}}"></image>
+					<text>{{tool.status(item.orderNumber,item.hwRequirement.isOn).word}}</text>
+				</view>
+			</view>
+		</view>
 
-  </block>
+	</block>
 
-  <empty message='您目前没有需要发布人确认的报名' wx:if='{{show}}' />
+	<empty message='您目前没有需要发布人确认的报名' wx:if='{{show}}' />
 </view>

+ 3 - 3
pages/my-apply/my-apply.wxs

@@ -5,19 +5,19 @@ function status(ordernum, ison) {
   var word = {
     '1': '进行中',
     '2': '订单已生成',
-    '3': '已下架'
+    // '3': '已下架'
   }
   // 图标地址
   var src = {
     '1': '/images/icon/underway.png',
     '2': '/images/icon/already.png',
-    '3': '/images/icon/out.png'
+    // '3': '/images/icon/out.png'
   }
   // 相应的样式
   var className = {
     '1': 'underway',
     '2': 'already',
-    '3': 'out'
+    // '3': 'out'
   }
   // 进行中
   if (ordernum === null && ison === 1) {

+ 32 - 1
pages/my-apply/my-apply.wxss

@@ -22,17 +22,36 @@ page {
 }
 
 .name {
+  flex: 1;
   color: #31364c;
   font-size: 34rpx;
+  display: flex;
+  align-items: center;
+}
+
+.name-content {
+  max-width: 325rpx;
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
 }
 
+.icon {
+  height: 34rpx;
+  width: 100rpx;
+  font-size: 22rpx;
+  text-align: center;
+  line-height: 34rpx;
+  color: #fff;
+  background: #888A8E;
+  border-radius: 10rpx;
+  margin-left: 15rpx;
+}
+
 .money {
   color: #3243bd;
   font-size: 34rpx;
-  flex-basis: 300rpx;
+  max-width: 265rpx;
   text-align: right;
 }
 
@@ -115,3 +134,15 @@ page {
   font-size: #888a8e;
   background: #f5f5f5;
 }
+
+.cancel-enrollment {
+  width: 136rpx;
+  height: 48rpx;
+  font-size: 24rpx;
+  color: rgba(50, 67, 189, 1);
+  border-radius: 10rpx;
+  border: 2rpx solid rgba(50, 67, 189, 1);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}

+ 16 - 16
pages/my-order/my-order.js

@@ -18,7 +18,7 @@ Page({
   toDetail(e) {
     const id = e.currentTarget.dataset.id;
     wx.navigateTo({
-      url: `/pages/detail/detail?id=${id}&&status=3`,
+      url: `/pages/detail/detail?id=${id}&&status=2`,
     })
   },
   /**
@@ -128,48 +128,48 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function(options) {
-
+  onLoad: function (options) {
+    // 获取订单列表
+    this.setData({
+      list: [],
+      pageNo: 1
+    }, _ => {
+      this.getList()
+    })
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function() {
-    // 获取订单列表
-    this.setData({
-      list: [],
-      pageNo: 1
-    }, _ => {
-      this.getList()
-    })
+  onShow: function () {
+
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function() {
+  onHide: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function() {
+  onUnload: function () {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
+  onPullDownRefresh: function () {
     this.setData({
       list: [],
       pageNo: 1
@@ -181,7 +181,7 @@ Page({
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function() {
+  onReachBottom: function () {
     const isLast = this.data.isLast;
     if (isLast) {
       // wx.showToast({

+ 1 - 1
pages/my-order/my-order.wxml

@@ -2,7 +2,7 @@
 <wxs src="my-order.wxs" module="tool" />
 <wxs src="../../app.wxs" module="getPriceForm" />
 
-<view class="container">
+<view class="container safe-area">
 
   <block wx:for='{{list}}' wx:for-index='key' wx:key="index">
 

+ 3 - 3
pages/payment-records-detail/payment-records-detail.wxml

@@ -1,6 +1,6 @@
 <!--pages/payment-records-detail/payment-records-detail.wxml-->
 <wxs src="../../app.wxs" module='tool' />
-<view class="container">
+<view class="container safe-area">
   <view class="cell">
     <view class="left">
       <text>收款金额</text>
@@ -10,14 +10,14 @@
     </view>
   </view>
 
-  <view class="cell">
+  <!-- <view class="cell">
     <view class="left">
       <text>已扣税额</text>
     </view>
     <view class="right">
       <text>{{tool.formatMoney(taxFee)}}</text>
     </view>
-  </view>
+  </view> -->
 
   <view class="cell">
     <view class="left">

+ 2 - 2
pages/payment-records/payment-records.wxml

@@ -1,6 +1,6 @@
 <!--pages/payment-records/payment-records.wxml-->
 <wxs src="../../app.wxs" module='tool' />
-<view class="container">
+<view class="container safe-area">
   <block wx:for='{{list}}' wx:key='index'>
     <navigator url="/pages/payment-records-detail/payment-records-detail?id={{item.id}}" class="cell" hover-class="none" wx:for='{{item}}' wx:key="index">
       <view class="left">
@@ -9,7 +9,7 @@
       </view>
       <view class="right">
         <text>¥{{tool.formatMoney(item.netPayment)}}</text>
-        <text class="time">已扣税额:¥{{tool.formatMoney(item.taxFee)}}</text>
+        <!-- <text class="time">已扣税额:¥{{tool.formatMoney(item.taxFee)}}</text> -->
       </view>
     </navigator>
   </block>

+ 18 - 13
pages/person/person.js

@@ -29,9 +29,14 @@ Page({
       confirmColor: '#31364C',
       success: (res) => {
         if (res.confirm) {
-          wx.clearStorageSync();
-          wx.reLaunch({
-            url: '/pages/login/login',
+          wx.clearStorage({
+            success: (res) => {
+              wx.$emit('is_login', false, () => {
+                wx.navigateBack({
+                  delta: 1
+                })
+              })
+            },
           })
         }
       },
@@ -41,21 +46,21 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function(options) {
-    if (wx.getStorageSync('userid')) {
+  onLoad: function (options) {
+    if (wx.getStorageSync('userid') && wx.getStorageSync('usertoken')) {
       // 获取用户信息
       this.setData({
         userinfo: wx.getStorageSync('userinfo'),
       }, _ => {
         wx.$watch('userinfo', this, (data) => {
-         
+
           this.setData({
             userinfo: data
           })
         })
       })
     } else {
-      wx.reLaunch({
+      wx.navigateTo({
         url: '/pages/login/login',
       })
     }
@@ -64,42 +69,42 @@ Page({
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function() {
+  onShow: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function() {
+  onHide: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function() {
+  onUnload: function () {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
+  onPullDownRefresh: function () {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function() {
+  onReachBottom: function () {
 
   },
 })

+ 5 - 6
pages/person/person.wxml

@@ -1,13 +1,13 @@
 <!--pages/person/person.wxml-->
 <wxs src="../../app.wxs" module='tool' />
-<view class="container">
+<view class="container safe-area">
   <!-- 个人信息 -->
   <view class="userinfo">
     <view class="avatar" bindtap="toUserinfo">
       <image src="{{userinfo.avatar||'/images/icon/avatar.png'}}" class="avatar-pic"></image>
       <image src="/images/icon/setting.png" class="setting"></image>
     </view>
-    <view class="name">{{userinfo.name}}</view>
+    <view class="name">{{userinfo.name || ''}}</view>
     <view class="sign">
       {{userinfo.authenticationStatus===0?'未认证':userinfo.authenticationStatus===1?"已认证":"认证不通过"}}
     </view>
@@ -48,16 +48,15 @@
     </navigator>
   </view>
 
-
-  <!-- <view class="cell-grounp">
+  <view class="cell-grounp">
     <navigator class="cell" url="/pages/common-setting/common-setting" hover-class="none">
       <view class="content">
         <image class="cell-pic" src="/images/icon/common-setting.png"></image>
-        <text>通用设置</text>
+        <text>更多</text>
       </view>
       <image src="/images/icon/right.png" class="right"></image>
     </navigator>
-  </view> -->
+  </view>
   <view class="quit" bindtap="quit">
     退出登录
   </view>

+ 1 - 1
pages/service_agreement/service_agreement.wxml

@@ -1,6 +1,6 @@
 <!-- pages/service_agreement/service_agreement.wxml -->
 
-<view class="container">
+<view class="container safe-area">
   <view class="title">用户服务协议及隐私政策 — 个人用户</view>
   <view class="content">
     <text>“开心灵工”www.dal-pay.com 灵活用工服务平台(以下称“平台”)依照《电子商务法》在人力资源领域提供第三方电子商务平台服务,由企业用户发布项目服务需求,由个人用户(以下称“您”)自行与企业用户达成并履行合同,同时企业用户将通过平台对您进行款项结算服务。

+ 1 - 1
pages/userinfo/userinfo.wxml

@@ -1,5 +1,5 @@
 <!--pages/userinfo/userinfo.wxml-->
-<view class="container">
+<view class="container safe-area">
   <view class="cell-grounp">
     <view class="cell" style="height:140rpx">
       <view class="left">

+ 1 - 1
pages/version/version.wxml

@@ -5,7 +5,7 @@
 
   <view class="message" wx:if='{{!update}}'>您已是最新版本</view>
   <view wx:if='{{update}}' class="message">可升级至最新版本 v1.0.1</view>
-  <view class="button" bindtap="update" wx:if='{{update}}'>
+  <view class="button safe-area" bindtap="update" wx:if='{{update}}'>
     <view>立即升级</view>
   </view>
 </view>

+ 8 - 7
pages/web-view/web-view.js

@@ -10,8 +10,9 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function(options) {
+  onLoad: function (options) {
     if (options.url) {
+      console.log(decodeURIComponent(options.url))
       this.setData({
         url: decodeURIComponent(options.url)
       })
@@ -21,42 +22,42 @@ Page({
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function() {
+  onReady: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function() {
+  onShow: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function() {
+  onHide: function () {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function() {
+  onUnload: function () {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function() {
+  onPullDownRefresh: function () {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function() {
+  onReachBottom: function () {
 
   }
 })

+ 1 - 1
pages/web-view/web-view.wxml

@@ -1,2 +1,2 @@
 <!--pages/web-view/web-view.wxml-->
-<web-view src='{{url}}'></web-view>
+<web-view class="safe-area" src='{{url}}'></web-view>

+ 14 - 6
project.config.json

@@ -8,25 +8,33 @@
 		"es6": true,
 		"enhance": true,
 		"postcss": true,
+		"preloadBackgroundData": false,
 		"minified": true,
 		"newFeature": true,
 		"coverView": true,
-		"autoAudits": false,
+		"autoAudits": true,
 		"showShadowRootInWxmlPanel": true,
 		"scopeDataCheck": false,
 		"uglifyFileName": true,
 		"checkInvalidKey": true,
 		"checkSiteMap": true,
 		"uploadWithSourceMap": true,
+		"compileHotReLoad": false,
 		"babelSetting": {
 			"ignore": [],
 			"disablePlugins": [],
 			"outputPath": ""
-		}
+		},
+		"bundle": true,
+		"useIsolateContext": true,
+		"useCompilerModule": true,
+		"userConfirmedUseCompilerModuleSwitch": true,
+		"packNpmManually": false,
+		"packNpmRelationList": []
 	},
 	"compileType": "miniprogram",
-	"libVersion": "2.7.1",
-	"appid": "wx997164f2857c1a1d",
+	"libVersion": "2.7.7",
+	"appid": "wxb0f8f3f0de6e8f07",
 	"projectname": "Mina_B",
 	"debugOptions": {
 		"hidedInDevtools": []
@@ -76,7 +84,7 @@
 					"id": 2,
 					"name": "需求详情",
 					"pathName": "pages/detail/detail",
-					"query": "id=3",
+					"query": "id=113&status=1",
 					"scene": null
 				},
 				{
@@ -158,7 +166,7 @@
 				},
 				{
 					"id": 14,
-					"name": "通用设置",
+					"name": "更多",
 					"pathName": "pages/common-setting/common-setting",
 					"query": "",
 					"scene": null

+ 3 - 3
template/button/button.wxml

@@ -1,6 +1,6 @@
 <!--底部按钮 在表单最末尾出现的按钮。 -->
 <template name='button'>
-  <view class="button-default {{class}}" style="margin-top:{{margin}}rpx">
+  <view class="button-default {{class}} safe-area" style="margin-top:{{margin}}rpx">
     <view class="button-default-content" catchtap="{{func  || undefind}}" style="background:{{background||'linear-gradient(90deg,#5568F0 0%,#823BFF 100%)'}}">
       <text class="">{{text || '按钮'}}</text>
       <button form-type="submit" class="button-default-content-button"></button>
@@ -10,7 +10,7 @@
 
 <!--底部悬浮按钮  置于屏幕底部悬浮于页面上面的按钮。 -->
 <template name='button-fixed'>
-  <view class="button-fixed {{class}}">
+  <view class="button-fixed safe-area {{class}}">
     <view class="button-fixed-content" catchtap="{{func  || undefind}}" style="background:{{background||'linear-gradient(90deg,#5568F0 0%,#823BFF 100%)'}}">
       <text class="">{{text || '按钮'}}</text>
       <button form-type="submit" class="button-fixed-content-button"></button>
@@ -20,7 +20,7 @@
 
 <!--底部悬浮按钮  置于屏幕底部悬浮于页面上面的分开的按钮 -->
 <template name='button-check'>
-  <view class="button-check {{class}}">
+  <view class="button-check safe-area {{class}}">
     <view class="button-check-content">
       <view class="button-check-left"  style="border:2rpx solid {{color||'#3243BD'}};color:{{color || '#3243BD'}};display:{{display||'block'}}" bindtap="{{buttonLeft || 'buttonCheck'}}">{{text || '按钮'}}</view>
       <view class="button-check-right"  style="background:{{background||'linear-gradient(90deg,#5568F0 0%,#823BFF 100%)'}}" bindtap="{{buttonRight || 'buttonSubmit'}}">{{btn || '按钮'}}</view>

+ 3 - 3
utils/api.js

@@ -1,14 +1,13 @@
 /* api接口地址 */
-const apiUrl = require('../config.js').apiUrl;
 
 module.exports = {
   hwuser: {
-    getAuthCode: '/api/hwuser/getAuthCode', //获取验证码
+    getAuthCode: '/api/hwuser/getCaptchaCode', //获取验证码
     phoneLogin: '/api/hwuser/phoneLogin', //手机号登陆
   },
   hwUser: {
     getHwUserInfo: '/api/hwUser/getHwUserInfo', //获取个人信息
-    changeAvatar:  '/api/hwUser/changeAvatar', //更改头像
+    changeAvatar: '/api/hwUser/changeAvatar', //更改头像
     banner: '/api/hwUser/banner', //获取首页banner
   },
   hwOrder: {
@@ -21,6 +20,7 @@ module.exports = {
     getRequirements: '/api/hwRequirement/getRequirements', //需求列表
     getRequirementDetail: '/api/hwRequirement/getRequirementDetail', //需求详情
     enrollmentRequire: '/api/hwRequirement/enrollmentRequire', //需求报名
+    cancelEnrollment: '/api/hwRequirement/cancelEnrollment', //取消报名
   },
   hwEnrollment: {
     getEnrollments: '/api/hwEnrollment/getEnrollments', //我的报名列表

+ 6 - 2
utils/config_api.js

@@ -1,7 +1,11 @@
+const api = require('./api')
 module.exports = {
   dont_login: [
-    '/api/hwuser/getAuthCode', //获取验证码
-    '/api/hwuser/phoneLogin', //手机号登陆
+    api.hwuser.getAuthCode,//获取验证码
+    api.hwuser.phoneLogin,//手机号登陆
+    api.hwUser.banner,//获取首页banner
+    api.hwRequirement.getRequirementDetail,//需求详情
+    api.hwRequirement.getRequirements,//需求列表
   ],
   no_openid: []
 }

+ 74 - 50
utils/util.js

@@ -12,7 +12,7 @@ class Utils {
     // this.message_hint = {
     //   100: '继续发送请求'
     // };
-    that.kx_request = this.request.bind(this);
+    that.kx_request = this.$request.bind(this);
     that.kx_api = this.api;
   }
 
@@ -57,15 +57,18 @@ class Utils {
     根据URL是否有http或者https判断是否拼接字符串
   */
   getUrl(url) {
-    const apiUrl = require('../config.js').apiUrl; // 加载接口地址文件
-    if (url.indexOf('https://') === -1 && url.indexOf('http://') === -1) {
-      return apiUrl + url
-    } else {
-      if (url.indexOf('http://') === -1) {
-        return url
+    return new Promise(reslove => {
+      const apiUrl = require('../config.js').apiUrl; // 加载接口地址文件
+      if (url.indexOf('https://') === -1 && url.indexOf('http://') === -1) {
+        reslove(apiUrl + url)
+      } else {
+        if (url.indexOf('http://') === -1) {
+          reslove(url)
+          return
+        }
+        reslove(url.replace('http://', 'https://'))
       }
-      return url.replace('http://', 'https://')
-    }
+    })
   }
 
   /* 
@@ -82,7 +85,7 @@ class Utils {
         wx.login({
           success: (res) => {
             const code = res.code;
-            this.request({
+            this.$request({
               // url:'',
               data: {
                 code,
@@ -125,7 +128,7 @@ class Utils {
   getNetworkType() {
     return new Promise((reslove, reject) => {
       wx.getNetworkType({
-        success: function(res) {
+        success: function (res) {
           if (res.networkType === 'none') {
             wx.$emit('offline', true)
             reslove('offline')
@@ -134,7 +137,7 @@ class Utils {
             reslove(res.networkType)
           }
         },
-        fail: function(res) {
+        fail: function (res) {
           reject('fail')
         }
       })
@@ -146,7 +149,7 @@ class Utils {
     @options 请求参数
     @status 是否携带userID
   */
-  async request(options) {
+  async $request(options) {
     /**
      * 检测网络状况 并判断是否发起请求
      * 当无网络时传入 offline 并提示无网络
@@ -179,7 +182,7 @@ class Utils {
     }
 
     /* 设置URL */
-    options.url = this.getUrl(options.url);
+    options.url = await this.getUrl(options.url);
 
     /* 判断是否传入参数 */
     options.data = options.data ? options.data : {};
@@ -197,17 +200,16 @@ class Utils {
     options.responseType = options.responseType || 'text';
 
     /* 消除空值字段 */
-    // for (let key in options.data) {
-    //   if (!options.data[key] && options.data[key] !== 0) {
-    //     delete options.data[key]
-    //   }
-    // }
+    for (let key in options.data) {
+      if (!options.data[key] && options.data[key] !== 0) {
+        delete options.data[key]
+      }
+    }
 
     /**根据判断写入openid */
     // if (!options.no_openid) {
     //   options.data.openid = await this.getOpenid();
     // }
-
     /* 根据dont_login判断是否需要登录 */
     if (options.dont_login) {
       return this._request(options);
@@ -230,6 +232,7 @@ class Utils {
    */
   _request(opt) {
     let route = getCurrentPages();
+    const that = this;
     return new Promise((resolve, reject) => {
       !this._loading && wx.showLoading({
         mask: true,
@@ -245,11 +248,17 @@ class Utils {
         method: opt.method,
         dataType: opt.dataType,
         responseType: opt.responseType,
-        success: function(res) {
+        success: function (res) {
+          wx.hideLoading({
+            success: () => {
+              this._loading = false;
+            }
+          })
           // 判断是否含有成功方法并执行
           if (opt.success && typeof opt.success === 'function') {
             if (res.statusCode === 200) {
-              if (res.data.errcode === 0) {
+              const errcode = res.data.errcode;
+              if (errcode === 0) {
                 opt.success(res.data);
                 resolve(res.data);
               } else {
@@ -258,6 +267,15 @@ class Utils {
                   opt.fail(res.data);
                   reject(res.data);
                 }
+                if (errcode === 2008) {
+                  that._doLogin(res.data.errmsg + ',请重新登录')
+                  return
+                }
+                if (errcode === 2010) {
+                  that._doLogin(res.data.errmsg)
+                  return
+                }
+
                 // model 判断是否自定义模态框或者提示框
                 if (!opt.model) {
                   wx.showModal({
@@ -277,8 +295,13 @@ class Utils {
             }
           }
         },
-        fail: function(res) {
+        fail: function (res) {
           // 判断是否含有失败方法并执行
+          wx.hideLoading({
+            success: () => {
+              this._loading = false;
+            }
+          })
           if (opt.fail && typeof opt.fail === 'function') {
             opt.success && opt.success('offline')
             opt.fail(res.data);
@@ -297,11 +320,6 @@ class Utils {
           console.log('服务器响应结果=>', res);
           console.log('当前页面=>', route[route.length - 1].route);
           console.log(' ');
-          wx.hideLoading({
-            success: () => {
-              this._loading = false;
-            }
-          })
           wx.stopPullDownRefresh({
             success: () => {
               console.log(route[route.length - 1].route, '=> stopPullDownRefresh')
@@ -320,23 +338,26 @@ class Utils {
   /**
    * 执行跳转登录页面操作
    */
-  _doLogin() {
-    // wx.clearStorageSync();
+  _doLogin(message = '你还未登录,请立即登录') {
     if (!this._showModel) {
       this._showModel = true;
-      wx.reLaunch({
-        url: '/pages/login/login',
-        success: () => {
-          setTimeout(() => {
-            wx.showModal({
-              title: '提示',
-              content: '登陆状态失效,请重新登录',
-              showCancel: false,
+      wx.showModal({
+        title: '提示',
+        content: message,
+        cancelColor: '#888A8E',
+        confirmColor: '#31364C',
+        success: res => {
+          if (res.confirm) {
+            wx.navigateTo({
+              url: '/pages/login/login',
               success: () => {
                 this._showModel = false;
               }
             })
-          }, 300)
+          }
+          if (res.cancel) {
+            this._showModel = false;
+          }
         }
       })
     }
@@ -411,18 +432,21 @@ class Utils {
    * 获取用户信息
    */
   getHwUserInfo(that) {
-    wx.kx_request({
-      url: wx.kx_api.hwUser.getHwUserInfo,
-      success: res => {
-        if (res.data) {
-          //成功后存入缓存
-          wx.setStorageSync('userinfo', res.data.hwUser);
-          // 判断是否提交页面数据
-          that && that.setData({
-            userinfo: res.data.hwUser
-          })
+    return new Promise(reslove => {
+      wx.kx_request({
+        url: wx.kx_api.hwUser.getHwUserInfo,
+        success: res => {
+          if (res.data) {
+            //成功后存入缓存
+            wx.setStorageSync('userinfo', res.data.hwUser);
+            reslove(res.data.hwUser)
+            // 判断是否提交页面数据
+            that && that.setData({
+              userinfo: res.data.hwUser
+            })
+          }
         }
-      }
+      })
     })
   }
 }

+ 18 - 9
utils/watch.js

@@ -1,4 +1,4 @@
-class MyWatch {
+class Watch {
   constructor(that, watchData) {
     //  watch函数回调集合
     that.$_watchCallBack = {}
@@ -19,7 +19,11 @@ class MyWatch {
    * @watchData {object} 被监听的对象
    */
   _setWatchData(that, watchData) {
-    that.$watchData = watchData || {}
+    if (that && watchData) {
+      that.$watchData = Object.assign({}, watchData)
+    } else {
+      throw new Error('请输入正确的初始值')
+    }
   }
 
   /**
@@ -28,16 +32,18 @@ class MyWatch {
    * @callbackArray {Array} 回调函数集合
    * 
    */
-  $_watch(key, value) {
+  $_watch(key, value, callback) {
     const obj = this.$watchData;
     let _oldValue = obj[key];
     obj[key] = value;
     // 确认回调函数存在 循环执行回调数组的方法集合
     if (typeof _oldValue === 'object' && typeof value === 'object') {
-      this.$_watchCallBack[key] && this.$_watchCallBack[key].map(val => val && val.cb && val.cb.call(val.page, value, _oldValue))
+      this.$_watchCallBack[key] && this.$_watchCallBack[key].forEach(val => val && val.cb && val.cb.call(val.page, value, _oldValue))
     } else {
-      _oldValue !== value && this.$_watchCallBack[key] && this.$_watchCallBack[key].map(val => val && val.cb && val.cb.call(val.page, value, _oldValue))
+      // 两次相同的值不执行
+      _oldValue !== value && this.$_watchCallBack[key] && this.$_watchCallBack[key].forEach(val => val && val.cb && val.cb.call(val.page, value, _oldValue))
     }
+    callback && callback()
   }
   /**
    * 提交值
@@ -46,12 +52,15 @@ class MyWatch {
    * @callback {function}  执行之后完成回调
    */
   $emit(key, value, callback) {
+    // 不提交未设置字段  减少消耗
+    if (!this.$watchData.hasOwnProperty(key)) {
+      throw new Error('未设置此字段')
+    }
     // 不可传值为function、null、undefined以及NaN
     if (typeof value === 'function' || typeof value === 'undefined' || value === null || Number.isNaN(value)) {
-      throw new Error(`${value}为非法参数传值`)
+      throw new Error(`${key}-${value}为非法参数传值`)
     }
-    this.$_watch(key, value);
-    callback && callback()
+    this.$_watch(key, value, callback);
   }
   /**
    * 获取值
@@ -148,5 +157,5 @@ class MyWatch {
 }
 
 module.exports = {
-  MyWatch: MyWatch
+  Watch: Watch
 }