<template>
	<view>
		<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">个人信息</block>
		</cu-custom>
		<view class="cu-list menu">
			<view class="cu-item arrow">
				<navigator class="content" hover-class="none" :url="'/pages/basics/basic-info/user-info?APPLY_STATUS=' + pd.APPLY_STATUS" open-type="redirect">
					<text class="text-semi">注册信息</text>
				</navigator>
			</view>
      <view v-if="loginCorpId && pd.APPLY_STATUS === '1'" class="cu-item arrow">
        <navigator class="content" hover-class="none" url="/pages/basics/basic-info/resignation" open-type="redirect">
          <text class="text-semi">离职申请</text>
        </navigator>
      </view>
      <view v-if="!loginCorpId && pd.APPLY_STATUS === ''" class="cu-item arrow">
        <navigator class="content" hover-class="none" url="/pages/basics/basic-info/entry" open-type="redirect">
          <text class="text-semi">入职申请</text>
        </navigator>·
      </view>
      <view v-if="!loginCorpId && pd.APPLY_STATUS === '0' && (pd.APPLY_TYPE ==='2' || pd.APPLY_TYPE ==='4')" class="cu-item arrow">
        <navigator class="content" hover-class="none" url="/pages/basics/basic-info/confirm" open-type="redirect">
          <text class="text-semi">信息确认</text>
        </navigator>
      </view>
			<view class="cu-item arrow">
				<view class="content" @tap.stop="openAuth('CAMERA')">
					<text class="text-semi">更新人脸信息</text>
				</view>
			</view>
			<view class="cu-item arrow">
				<navigator class="content" hover-class="none" url="/pages/my/updateSignature/index" open-type="redirect">
					<text class="text-semi">更新签字信息</text>
				</navigator>
			</view>
		</view>
    <yk-authpup ref="authpup" type="top" @changeAuth="openAuthAudio('RECORD_AUDIO')" :permissionID="permissionID"></yk-authpup>
    <yk-authpup ref="authpup_audio" type="top" @changeAuth="naviFace" :permissionID="permissionID"></yk-authpup>
	</view>
</template>

<script>
	import {
		basePath,
    loginUser
	} from '@/common/tool.js';
  import ykAuthpup from "@/components/yk-authpup/yk-authpup"
	export default {
    components: {
      ykAuthpup
    },
		data() {
			return {
        permissionID: '',
        loginUserId: '',
        loginCorpId: '',
        pd: {
          APPLY_TYPE: '',
          APPLY_STATUS: '',
        }
			}
		},
    onLoad(event){
      this.LoginUserId = loginUser.USER_ID
      this.loginCorpId = loginUser.CORPINFO_ID
      this.getData()
    },
		methods: {
      getData() {
        var _this = this;
        uni.showLoading({
          title: '请稍候'
        })
        uni.request({
          url: basePath + '/app/user/getPractitionerEmploymentCorp',
          method: 'POST',
          dataType: 'json',
          header:{
            'Content-type':'application/x-www-form-urlencoded'
          },
          data: {
            USER_ID:loginUser.USER_ID,
            ISDELETE: '0',
          },
          success: (res) => {
            uni.hideLoading();
            if (res.data.pd) {  //已有申请
              _this.pd = res.data.pd;
            }
          }
        });
      },
      openAuth(permissionID){
        this.permissionID = permissionID;
        setTimeout(()=>{
          this.$refs['authpup'].open();
        },200)
      },

      openAuthAudio(permissionID){
        this.permissionID = permissionID;
        setTimeout(()=>{
          this.$refs['authpup_audio'].open();
        },200)
      },

      naviFace(){
        uni.navigateTo({
          url: '/pages/my/face/index'
        })
      }
		}
	}
</script>

<style>

</style>

