yangyin
2024-07-03 e5501ada6eb3794251457f36a11b38c1e98a3d18
修改定时任务
已修改4个文件
85 ■■■■ 文件已修改
app.js 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
login/login/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
other/alarm/index.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
other/alarm/index.wxml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.js
@@ -19,10 +19,10 @@
      this.globalData.userInfo = null;
    }
  },
  //获取报警记录
  getAllAlarmList() {
    var that=this
    var that = this
    // that.cancelTimer()
    Request({
      url: Constant.BASE_SERVER_URL + 'Monitor/Value/Alarm/Record/Std/GetFluzzyPageList@V1.0',
@@ -40,13 +40,12 @@
      }, //请求失败
      success: (res) => {
        var result = res.data
        if(res.statusCode==404){
        if (res.statusCode == 404) {
          wx.showModal({
            title: '',
            content: '通讯失败',
          })
          that.globalData.alarmTotal=0
          that.globalData.alarmTotal = 0
          return
        }
        if (result.Code != 0) {
@@ -58,51 +57,59 @@
          return;
        }
        // result.Data.Total=1
        if(result.Data.Total==0){
          that.globalData.monitorDataTimeOut=false
          that.startTimer()
        if (result.Data.Total == 0) {
          that.globalData.monitorDataTimeOut = false
          that.startTimer()
          return;
        }
        that.getMonitorDialog()
        that.startTimer()
          that.getMonitorDialog()
          that.startTimer()
      }
    })
  },
  //初始化时打开报警消息通知弹窗
 getMonitorDialog(){
   var that=this
  if(that.globalData.monitorModalName) return
  wx.showModal({
    title: '消息报警',
    content: '您有新的报警消息需要处理,点击前往报警处理查看',
  getMonitorDialog() {
    var that = this
    if (that.globalData.monitorModalName) return
    wx.showModal({
      title: '消息报警',
      content: '您有新的报警消息需要处理,点击前往报警处理查看',
      success: function (res) {
        if (res.confirm) {
          that.workMonitorSure()
          that.globalData.monitorModalName=false
          that.globalData.monitorModalName = true
          that.globalData.monitorDataTimeOut = true
        } else {
          that.globalData.monitorModalName=false
          that.globalData.monitorModalName = false
          that.globalData.monitorDataTimeOut = false
          that.startTimer()
        }
      }
    })
    that.globalData.monitorModalName=true
    that.globalData.monitorDataTimeOut=true
    that.globalData.monitorModalName = true
    that.globalData.monitorDataTimeOut = true
    that.cancelTimer()
  },
  onReset(){
    this.globalData.monitorDataTimeOut=false
  onStartAlarm(){
    this.globalData.monitorDataTimeOut = false
    this.globalData.monitorModalName = false
    this.startTimer()
  },
  onReset() {
    this.globalData.monitorDataTimeOut = true
    this.cancelTimer()
  },
  startTimer() {
        var that=this
        that.cancelTimer()
        if(that.globalData.monitorDataTimeOut) return
      that.globalData.timer = setInterval(() => {
    var that = this
    that.cancelTimer()
    if (that.globalData.monitorDataTimeOut) return
    that.globalData.timer = setInterval(() => {
      console.log(102)
      that.getAllAlarmList()
      },300000)
    }, 3000)
  },
  cancelTimer () {
  cancelTimer() {
    var that = this;
    // 取消定时器
    if (that.globalData.timer) {
@@ -231,6 +238,7 @@
    alarmList: [],
    alarmTotal: 0,
    monitorModalName: false, //是否显示报警提示
    monitorDataTimeOut:false
    monitorDataTimeOut: false,
    mockData: []
  }
})
login/login/index.js
@@ -304,7 +304,7 @@
          that.setData({
            userInfo: res.userInfo,
          })
          app.startTimer()
          that.getWxUserLoginCodeCb().then((loginParas) => {
            // console.log(loginParas.code)
            var jsCode = loginParas.code;
@@ -387,7 +387,8 @@
      inputWidth: screenWidth,
      inputHeight: screenHightScale * 177,
    });
    console.log(111)
    app.onReset()
  },
  onShareAppMessage: function () {
other/alarm/index.js
@@ -336,8 +336,7 @@
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    app.onReset()
    app.startTimer()
    app.onStartAlarm()
  },
  /**
other/alarm/index.wxml
@@ -49,15 +49,6 @@
 
</view>
</scroll-view>
<!-- <view class="paging">
        <view class="page_btn">
          <view wx:if="{{frontPage}}" bindtap="clickFront">上一页</view>
        </view>
        <view class="page_num">第{{thisPages}}页 共{{pages}}页</view>
        <view class="page_btn">
          <view wx:if="{{nextPage}}" bindtap="clickNext">下一页</view>
        </view>
      </view> -->
<icon class="setIcon_pos iconfont icon-wancheng2" bindtap="showModalInput"></icon>
<!--弹窗-->
<view class="modal-mask" bindtap="hideModal" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view>