Browse Source

what a fuck today???????

FANGLH 7 years ago
parent
commit
d965cb20b4
7 changed files with 215 additions and 20 deletions
  1. 2 2
      app.json
  2. 24 2
      pages/pointapply/pointapply.js
  3. 1 1
      pages/pointapply/pointapply.wxml
  4. 46 0
      utils/DateTime.js
  5. 77 0
      utils/baseUtils.js
  6. 65 0
      utils/network.js
  7. 0 15
      utils/wxconstant.js

+ 2 - 2
app.json

@@ -1,9 +1,9 @@
 {
   "pages": [
     "pages/home/home",
+    "pages/pointapply/pointapply",
     "pages/applyjoinapprovel/applyjoinapprovel",
     "pages/minusapply/minusapply",
-    "pages/pointapply/pointapply",
     "pages/perinfo/perinfo",
     "pages/approval/approval",
     "pages/point/point",
@@ -18,7 +18,7 @@
   "tabBar": {
     "selectedColor": "#219bf3",
     "color": "#444",
-    "backgroundColor": "#DADADA",
+    "backgroundColor": "#FFF",
     "borderStyle": "white",
     "position": "bottom",
     "list": [

+ 24 - 2
pages/pointapply/pointapply.js

@@ -11,7 +11,8 @@ Page({
     isDetails: false, //加分申请详情时状态
     applyStatus:'待审批',
     applyTime:'2018-09-20',
-    applyNorm:'标准1'
+    applyNorm:'标准1',
+    applyReason:''
   },
   /**
     *修改Title
@@ -48,7 +49,28 @@ Page({
    */
   applySubmit: function (event) {
     var that = this
-    console.log(event.detail.value)
+    var object = event.detail.value
+    console.log(object)
+
+    var applyName = object.applyName
+    var applyJob = object.applyJob
+    var applyNorm = object.applyNorm
+    var applyReason = object.applyReason
+
+    var applyName = object.applyName
+
+    if (!applyReason){
+      that.comToast('请输入申请事由')
+      return
+    }
+  },
+
+  comToast: function (title) {
+    wx.showToast({
+      title: title,
+      icon: 'none',
+      duration: 2000
+    })
   },
   /**
    * 撤回

+ 1 - 1
pages/pointapply/pointapply.wxml

@@ -60,7 +60,7 @@
     事由
   </view>
    <view class='righttextarea' >
-        <textarea placeholder='请输入...' name='applyReason' maxlength='200' disabled='{{isDetails}}'> </textarea>
+        <textarea placeholder='请输入...' name='applyReason' maxlength='200' disabled='{{isDetails}}' value='{{applyReason}}'> </textarea>
     </view>
 </view>
 <view class='commonhline' style='height:20rpx;' ></view>

+ 46 - 0
utils/DateTime.js

@@ -0,0 +1,46 @@
+/**
+ * 根据date类型返回相应格式日期时间
+ */
+const getComDate = (date,dateType) =>{
+//null,ymdhms,yymmdd,yy-mm-dd,yy/mm/dd,yy,mm,dd,hhmmss
+  const year = date.getFullYear()
+  const month = date.getMonth() + 1
+  const day = date.getDate()
+  const hour = date.getHours()
+  const minute = date.getMinutes()
+  const second = date.getSeconds()
+  // console.log(year + ',' + month + ',' + day + ',' + hour + ',' + minute + ','+second)
+  var returnDate
+  if (dateType == 'null'){
+    returnDate = year + '年' + month + '月' + day + '日' + [hour, minute, second].map(formatNumber).join(':')
+  } 
+  else if (dateType == 'ymdhms'){
+    returnDate = [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
+  } else if (dateType == 'yymmdd') {
+    returnDate = [year, month, day].map(formatNumber).join('')
+  } else if (dateType == 'yy-mm-dd') {
+    returnDate = [year, month, day].map(formatNumber).join('-')
+  } else if (dateType == 'yy') {
+    returnDate = year
+  }else if (dateType == 'mm') {
+    returnDate = month
+  } else if (dateType == 'dd') {
+    returnDate = day
+  } else if (dateType == 'hhmmss'){
+    returnDate = [hour, minute, second].map(formatNumber).join(':')
+  } else if (dateType == 'yy/mm/dd hh:mm:ss'){
+    returnDate = [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
+  }else if(dateType == 'yy-mm'){
+    returnDate = [year, month].map(formatNumber).join('-')
+  }
+  return returnDate
+}
+
+const formatNumber = n => {
+  n = n.toString()
+  return n[1] ? n : '0' + n
+}
+
+module.exports = {
+  getComDate: getComDate
+}

+ 77 - 0
utils/baseUtils.js

@@ -0,0 +1,77 @@
+var netUtil = require('network.js')
+var baseUrl = require('wxconstant.js').BaseUrl()
+
+//判断是否进行注册
+function judgeisReg(openid){
+  var url = baseUrl + 'loan/enterprise/getEnterpriseDO'
+  var data = {
+    openid: openid
+  }
+  netUtil.requestLoading(url, data, '正在请求...', 'POST', function (res) {
+    if (res.data.data) {
+      var isFinancing = res.data.data.isFinancing
+      var isRegistered = res.data.data.isRegistered
+      if (isRegistered == false){
+        wx.showModal({
+          title: '提示',
+          content: '您当前尚未进行注册认证,是否立即前去认证',
+          success:function(res){
+            console.log(res)
+            if (res.confirm == true && res.cancel == false){
+              wx.navigateTo({
+                url: '../registered/registered',
+              })
+            }
+          }
+        })
+      }
+      try {
+        wx.setStorageSync('isFinancing', isFinancing)
+        wx.setStorageSync('isRegistered', isRegistered)
+      } catch (e) {
+
+      }
+    }
+  }, function (res) {
+    wx.showToast({
+      title: '数据获取失败',
+      icon: 'none',
+      duration: 2000
+    })
+  })
+
+}
+//公用获取openid方法
+function getComOpenid(){
+  var openid
+  wx.login({
+    success: function (res) {
+      var url = baseUrl + 'usr/getOpenid'
+      if (res.code) {
+        var data = {
+          code: res.code
+        }
+        netUtil.requestLoading(url, data, '正在请求...', 'GET', function (res) {
+          if (res.data) {
+            if (res.data.data.openid) {
+              wx.setStorageSync('openid', res.data.data.openid)
+              openid = res.data.data.openid
+            }
+          }
+        }, function (res) {
+          wx.showToast({
+            title: '数据获取失败',
+            icon: 'none',
+            duration: 2000
+          })
+        })
+      }
+    }
+  })
+
+  return openid
+}
+module.exports = {
+  judgeisReg: judgeisReg,
+  getComOpenid: getComOpenid
+}

+ 65 - 0
utils/network.js

@@ -0,0 +1,65 @@
+/**
+ * 网络请求公用方式,以后都这样用 
+ * 2018-5-10 16:57
+ */
+function request(url, params, success, fail) {
+  this.requestLoading(url, params, "", success, fail)
+}
+function requestLoading(url, params, message, method,success, fail) {
+  wx.showNavigationBarLoading()
+  if (message != "") {
+    wx.showLoading({
+      title: message,
+    })
+  }
+  wx.request({
+    url: url,
+    data: params,
+    header: {
+      //'Content-Type': 'application/json'
+      'content-type': 'application/x-www-form-urlencoded'
+    },
+    method: method,
+    success: function (res) {
+      console.log(url + JSON.stringify(params), res)
+      wx.hideNavigationBarLoading()
+      if (message != "") {
+        wx.hideLoading()
+      }
+      if (res.statusCode == 200) {
+        success(res)
+      } else {
+        fail()
+      }
+    },
+    fail: function (res) {
+      wx.hideNavigationBarLoading()
+      if (message != "") {
+        wx.hideLoading()
+      }
+      fail()
+    },
+    complete: function (res) {
+
+    },
+  })
+}
+module.exports = {
+  request: request,
+  requestLoading: requestLoading,
+}
+
+
+//引用:
+// var that = this
+// var data = { openid: wx.getStorageSync('openid') }
+// var url = baseUrl + 'usr/getUsr'
+// netUtil.requestLoading(url, data, '正在加载数据...', 'POST', function (res) {
+
+// }, function (res) {
+//   wx.showToast({
+//     title: '加载数据失败',
+//     icon: 'none',
+//     duration: 2000
+//   })
+// })

+ 0 - 15
utils/wxconstant.js

@@ -1,8 +1,5 @@
 function BaseUrl(){
-  // var baseUrl = 'http://nf20718343.iask.in:32004/'
-  // var baseUrl =  'http://192.168.0.111:8080/'
   var baseUrl = 'https://www.akuiguoshu.com/'
-  // var baseUrl = 'http://nf20718343.iask.in:32004/'
   return baseUrl
 }
 function getTXMapApiKay(){
@@ -11,18 +8,6 @@ function getTXMapApiKay(){
 const getUrl = {
   getOpenid:'fruits/wxpay/getOpenid',
   getAd: 'fruits/fruits/ad/getAd',
-  bindable:'fruits/fruits/usr/bindable',
-  sendVcode:'fruits/fruits/usr/sendVcode',
-  getBindable:'fruits/fruits/usr/getBindable',
-  list: 'fruits/fruits/order/list',
-  getBindable: 'fruits/fruits/usr/getBindable',
-  saveOrder:'fruits/fruits/order/saveOrder',
-  pay:'fruits/wxpay/pay',
-  getSign:'fruits/wxpay/getSign',
-  isPaydeposit: 'fruits/fruits/usr/isPaydeposit',
-  listBy:'fruits/fruits/order/listBy',
-  getByMachineId:'fruits/fruits/aisle/getByMachineId',
-  sendSocket:'fruits/fruits/aisle/sendSocket'
 }
 module.exports = {
   BaseUrl: BaseUrl,