import {departInterence } from "@/api/api.js";
export default {
    methods:{
        modelInit(){
            //重置表单
            this.form = this.$options.data().form
            //如果有图形验证码，重新请求
            this.hasPicCode && this.getCodePic()
        },
        //获取图片验证码
        getCodePic(){
            //存base64和id
            departInterence.getCodePic().then(res=>{
                if(res.Ret!==200) return 
                if(res.Data){
                    this.picSrc = res.Data.Base64Blob,
                    this.picId = res.Data.Id
                }
                
            })
        },
        countDown(){
            /* if(!this.timer) return */
            //console.log('click down')
            this.codeCountDown--
            this.codeStr=`重新获取（${this.codeCountDown}）秒`
            if(this.codeCountDown<=0){
                clearInterval(this.timer)
                this.codeStr = '重新获取'
                return
            }
        }
    }
}