const safeConfirm = {
template: `
{{lang.account_tips_text3}}
{{lang.account_tips_text13}}
`,
data() {
return {
visible: false,
submitLoading: false,
passData: "",
callbackFun: "",
home_enforce_safe_method: [],
dataForm: {
password: "",
},
rules: {
password: [
{required: true, message: lang.account_tips_text2, trigger: "blur"},
],
},
remember: false,
};
},
computed: {},
props: {
password: {
type: String,
default: "",
},
isLogin: {
type: Boolean,
default: false,
},
},
watch: {},
created() {
this.home_enforce_safe_method =
JSON.parse(localStorage.getItem("common_set_before"))
?.home_enforce_safe_method || [];
},
methods: {
/**
* @param {String} callbackFun 回调函数名称
*/
openDialog(callbackFun) {
this.callbackFun = callbackFun;
this.dataForm.password = "";
this.$emit("update:password", this.dataForm.password);
// if (
// !this.home_enforce_safe_method.includes("operate_password") &&
// !this.isLogin
// ) {
// this.$emit("update:password", "noNeed");
// // 执行父级方法
// this.$emit("confirm", this.callbackFun);
// } else {
// this.visible = true;
// setTimeout(() => {
// this.$refs.ruleForm.resetFields();
// }, 0);
// }
this.visible = true;
setTimeout(() => {
this.$refs.ruleForm.resetFields();
}, 0);
},
closeDialog() {
this.visible = false;
},
save() {
this.$refs.ruleForm.validate((valid) => {
if (!valid) {
return false;
}
this.$emit("update:password", this.dataForm.password);
// 执行父级方法
this.$emit("confirm", this.callbackFun, this.remember ? 1 : 0);
this.closeDialog();
});
},
},
};