var app = getApp();
var that;
Page({
  data: {
    items:{
        work_id:'',
        progress:''
    },
  },
  onLoad(e) {
    that = this;
    dd.setNavigationBar({ title: "更新进度" });
    if (e.id) {
      this.setData({
        [`items.work_id`]:e.id,
        [`items.progress`]:e.progress
      })
    }
  },
  slider4change(e){
    this.setData({
        [`items.progress`]:e.detail.value
    })
  },
  formSubmit() {
    var page = getCurrentPages()[getCurrentPages().length - 2]//上一个页面的数据
    var data=this.data.items;
    this.setData({disabled:true})
    app.$post('api/integral/work',data).then(res => {
      page.getDetail(data.work_id,function(){
        app.globalData.showToast(res.data.msg);
        setTimeout(() => {
          dd.navigateBack({ delta: 1 })
        }, 1000);
      })
    }).finally(e=>{
       this.setData({disabled:false})
    })

  },
});
