forked from nsjcy/frontEnd/nsjcy

Mr Ke
2020-05-27 0ec802e93557b2b1422ddbd68aafa994fa68f455
SunshineLnsMinApp/app.js
@@ -10,11 +10,12 @@
  globalData: {
    userInfo: null,
    pageData: {},
    // url: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge',
    //url: 'http://192.168.0.31:8085/nsjc-charge',
    //imgUrl: 'https://hugeinfo.com.cn/nsjc-charge',
    url: 'http://nsjc.vaiwan.com/nsjc-charge',
    imgUrl: 'http://nsjc.vaiwan.com/nsjc-charge'
     url: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge',
    // url: 'http://1p885086k1.iok.la/nsjc-charge',
    //url: 'http://localhost:6060/nsjc-charge',
    imgUrl: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge',
    // url: 'http://nsjc.vaiwan.com/nsjc-charge',
    // imgUrl: 'http://nsjc.vaiwan.com/nsjc-charge'
  },
  // 过滤数组
  where: (collection, source) => {
@@ -92,6 +93,11 @@
  },
  //上传文件
  upload: function(these, path, associateTypeId, way, id) {
    console.log(these)
    console.log(path)
    console.log(associateTypeId)
    console.log(way)
    console.log(id)
    var status = these.data['status'];
    var batch;
    if (status == 4) {
@@ -99,6 +105,7 @@
    } else {
      batch = 0
    }
    console.log(batch)
    wx.showToast({
      icon: "loading",
      title: "正在上传"
@@ -116,9 +123,14 @@
        batch
      },
      success: function(res) {
        console.log(res)
        var evalList = these.data.evalList;
        var evalListType = 'evalList' + associateTypeId;
        var data = JSON.parse(res.data)
        console.log(data)
        console.log('path', path)
        console.log('evalList', evalList)
        console.log('associateTypeId', associateTypeId)
        these.setData({
          evalList: {
            ...evalList,
@@ -188,6 +200,18 @@
    return year + "-" + month + "-" + date + " " + hour + ":" + minute;
  },
  //转换时间戳
  formatDateday: function(ts) {
    var now = new Date(ts);
    var year = now.getFullYear();
    var month = now.getMonth() + 1;
    var date = now.getDate();
    var hour = now.getHours() < 10 ? '0' + now.getHours() : now.getHours();
    var minute = now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes();
    var second = now.getSeconds();
    return year + "-" + month + "-" + date;
  },
  // 页面正在开发中
  developIng: function() {
    wx.navigateTo({
@@ -248,6 +272,63 @@
      }
      return age;
    }
  },
  getPermission: function(url) {
    wx.getLocation({
      success: function(res) {
        wx.navigateTo({
          url,
        })
      },
      fail: function() {
        wx.getSetting({
          success: function(res) {
            var statu = res.authSetting;
            if (!statu['scope.userLocation']) {
              wx.showModal({
                title: '是否授权当前位置',
                content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用',
                success: function(tip) {
                  if (tip.confirm) {
                    wx.openSetting({
                      success: function(data) {
                        if (data.authSetting["scope.userLocation"] === true) {
                          wx.showToast({
                            title: '授权成功',
                            icon: 'success',
                            duration: 1000
                          })
                          //授权成功之后,再调用chooseLocation选择地方
                          wx.getLocation({
                            success: function(res) {
                              wx.navigateTo({
                                url,
                              })
                            },
                          })
                        } else {
                          wx.showToast({
                            title: '授权失败',
                            icon: 'success',
                            duration: 1000
                          })
                        }
                      }
                    })
                  }
                }
              })
            }
          },
          fail: function(res) {
            wx.showToast({
              title: '调用授权窗口失败',
              icon: 'success',
              duration: 1000
            })
          }
        })
      }
    })
  }
})