<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/login/forget/forget-reset" 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 class="cu-item">
				<view class="content">
					<text class="text-semi">检查更新</text>
				</view>
			</view>
			<view class="cu-item margin-top text-center" @click="unlogin()">
				<view class="content">
					<text class="text-semi">退出当前账户</text>
				</view>
			</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,
		setloginUserId,
		setCorpinfoId,
		setloginUser,
		setDeptId,
		setIsRest,
    setPremission
	} from '@/common/tool.js';
  import ykAuthpup from "@/components/yk-authpup/yk-authpup"
	export default {
    components: {
      ykAuthpup
    },
		data() {
			return {
        permissionID:'',
			}
		},
		methods: {
      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'
        })
      },

			unlogin(){
				uni.showModal({
					title: '提示',
					cancelText: '确认',
					confirmText: '取消',
					content: '确定退出当前账户？',
					success: (res) => {
						if (res.cancel) {
						  this.updatePushCid()
							setloginUserId(null);
							setCorpinfoId(null);
							setDeptId(null);
							setloginUser(null);
							setIsRest(null);
              				setPremission(null)
							uni.removeStorage({key: 'USER'});
							uni.reLaunch({
								url: '/pages/login/home'
							});
						}
					}
				});
			},
      updatePushCid(){
        uni.request({
          url: basePath + '/app/user/updatePushCid',
          method: 'POST',
          dataType: 'json',
          header: {
            'Content-type':'application/x-www-form-urlencoded'
          },
          data: {
            USER_ID:loginUser.USER_ID,
            PUSH_CID:""
          }
        })
      }
		}
	}
</script>

<style>

</style>

