Page({
  data: {
    // 列表数据筛选条件
    params: {
      openId: null
    },
    skip: false,
    queryId: null,
    list: [],
    current: "",
  },
  onLoad() {
    const openId = wx.getStorageSync('openid')
    this.setData(
        {
          params:{ openId },
          current:'/message/list' 
        }
      )
  },
  onShow(){
    if(this.data.skip){
      const {list,queryId} = this.data
      list.forEach((item)=>{
        if(item.id === queryId){
          item.status = 2
        }
      })
      this.setData({
        list,
        skip: false,
        queryId: null
      })
    }
  },
  /* 更新数据 */
  updateList(e) {
    let list = this.data.list.concat(e.detail || [])
    this.setData({ list })
  },
  /* 重置数据 */
  resetList() {
    this.setData({ list: [] })
  },
  handleDetail(e) {
    const {id} = e.currentTarget.dataset
    this.setData({
      skip: true,
      queryId: id
    })
    wx.navigateTo({
      url: '/package_mine/pages/noticeDetail/index?msgId=' + id,
    })
  }
})