<template>
  <view>
    <cu-custom bgColor="bg-gradual-blueness" :isBack="true">
      <block slot="backText">返回</block>
      <block slot="content">隐患随手拍</block>
    </cu-custom>
    <hiddenAdd hidden_source="1"/>
  </view>
</template>

<script>
import {
  basePath, deptId, loginUser, formatDate, loginSession, baseImgPath
} from '@/common/tool.js';
import hiddenAdd from '@/components/hidden_add/index.vue';

export default {
  components: {
    hiddenAdd
  },
  data() {
    return {
      jsxx: 0
    }
  },
  onLoad(event) {

  },
  onShow(options) {
    console.log('mounted')

  },
  beforeDestroy() {
    uni.$off('submitByHiddenSource')
  },
  mounted() {
    uni.$on('submitByHiddenSource', (data) => {
      this.submitByHiddenSource(data)
    })
  },

  methods: {
    submitByHiddenSource(data) {
      if (data.info == 'success') {
        uni.showToast({
          icon: 'none',
          title: '提交成功',
          duration: 1500
        });
        setTimeout(() => {
          var pages = getCurrentPages();	// 获取当前页面栈
          var prePage = pages[pages.length - 1];	// 上一个页面
          // var task = prePage.$vm.list[_this.index];
          prePage.$vm.initflag = data.initflag;    // A 页面 init方法 为true
          uni.navigateBack({});
          uni.hideLoading();
        }, 1500)

      }
    }
  }
}
</script>

<style>

</style>
