chore: install prettier

This commit is contained in:
Viet An
2026-05-04 15:22:27 +07:00
parent 93d29ca7d8
commit bd58e2b847
267 changed files with 22950 additions and 13581 deletions

View File

@@ -1,10 +1,20 @@
<template>
<div>
<Caption v-bind="{title: 'Nhập mã duyệt'}"></Caption>
<Caption v-bind="{ title: 'Nhập mã duyệt' }"></Caption>
<div class="field is-grouped mt-5">
<div class="control mr-5" v-for="v in [1,2,3,4]">
<input class="input is-dark" style="font-size: 18px; max-width: 40px; font-weight:bold; text-align: center;" type="password"
maxlength="1" :id="`input${v}`" v-model="data[v]" @keyup="changeNext(v)" />
<div
class="control mr-5"
v-for="v in [1, 2, 3, 4]"
>
<input
class="input is-dark"
style="font-size: 18px; max-width: 40px; font-weight: bold; text-align: center"
type="password"
maxlength="1"
:id="`input${v}`"
v-model="data[v]"
@keyup="changeNext(v)"
/>
</div>
</div>
<div class="mt-4">
@@ -17,53 +27,58 @@ export default {
data() {
return {
data: {},
code: undefined
}
code: undefined,
};
},
async created() {
if(!this.approvalcode && this.$store.state.login.approval_code) this.approvalcode = this.$store.state.login.approval_code
if(!this.approvalcode) {
let user = await this.$getdata('user', {id: this.$store.state.login.id}, undefined, true)
this.approvalcode = user.approval_code
if (!this.approvalcode && this.$store.state.login.approval_code)
this.approvalcode = this.$store.state.login.approval_code;
if (!this.approvalcode) {
let user = await this.$getdata("user", { id: this.$store.state.login.id }, undefined, true);
this.approvalcode = user.approval_code;
}
},
mounted() {
this.reset()
this.reset();
},
computed: {
approvalcode: {
get: function() {return this.$store.state['approvalcode']},
set: function(val) {this.$store.commit('updateStore', {name: 'approvalcode', data: val})}
}
get: function () {
return this.$store.state["approvalcode"];
},
set: function (val) {
this.$store.commit("updateStore", { name: "approvalcode", data: val });
},
},
},
methods: {
checkError() {
if(Object.keys(this.data).length<4) return true
let code = ''
if (Object.keys(this.data).length < 4) return true;
let code = "";
for (const [key, value] of Object.entries(this.data)) {
if(!this.$empty(value)) code += value.toString()
if (!this.$empty(value)) code += value.toString();
}
if(this.$empty(code) || !this.$isNumber(code)) return true
this.code = code
return false
if (this.$empty(code) || !this.$isNumber(code)) return true;
this.code = code;
return false;
},
checkValid() {
if(this.checkError()) return this.$snackbar(' phê duyệt không hợp lệ')
if(this.code!==this.approvalcode) return this.$snackbar(' phê duyệt không chính xác')
this.$emit('modalevent', {name: 'approvalcode', data: this.code})
this.$emit('close')
if (this.checkError()) return this.$snackbar("Mã phê duyệt không hợp lệ");
if (this.code !== this.approvalcode) return this.$snackbar("Mã phê duyệt không chính xác");
this.$emit("modalevent", { name: "approvalcode", data: this.code });
this.$emit("close");
},
changeNext(v) {
if(this.$empty(this.data[v])) return
else if(v===4) return this.checkValid()
let doc = document.getElementById(`input${v+1}`)
if(doc) doc.focus()
if (this.$empty(this.data[v])) return;
else if (v === 4) return this.checkValid();
let doc = document.getElementById(`input${v + 1}`);
if (doc) doc.focus();
},
reset() {
this.data = {}
let doc = document.getElementById(`input1`)
if(doc) doc.focus()
}
}
}
</script>
this.data = {};
let doc = document.getElementById(`input1`);
if (doc) doc.focus();
},
},
};
</script>