|
@@ -42,7 +42,7 @@
|
|
|
<Button
|
|
|
size="large"
|
|
|
type="primary"
|
|
|
- :disabled="isSubmit"
|
|
|
+ :disabled="isSubmit || !encryptValid"
|
|
|
@click="submit"
|
|
|
style="width: 120px"
|
|
|
>登录</Button
|
|
@@ -51,6 +51,8 @@
|
|
|
</Form>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div class="login-tips" v-if="tips">{{ tips }}</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -59,6 +61,7 @@ import { username, password } from "@/plugins/formRules";
|
|
|
import initStoreMixin from "../mixins/initStoreMixin";
|
|
|
import { formatDate } from "../plugins/utils";
|
|
|
import { $get } from "@/plugins/axios";
|
|
|
+import { mapState, mapActions } from "vuex";
|
|
|
const { ipcRenderer } = require("electron");
|
|
|
|
|
|
export default {
|
|
@@ -74,14 +77,32 @@ export default {
|
|
|
loginname: username,
|
|
|
password
|
|
|
},
|
|
|
- isSubmit: false
|
|
|
+ isSubmit: false,
|
|
|
+ encryptValid: false,
|
|
|
+ loading: false,
|
|
|
+ tips: "",
|
|
|
+ exceptionIsConfirm: true
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapState("client", ["encryptResult"])
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ encryptResult(val, oldval) {
|
|
|
+ if (val.success) {
|
|
|
+ this.encryptSuccess();
|
|
|
+ } else {
|
|
|
+ this.encryptError(val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.$ls.clear();
|
|
|
this.initData();
|
|
|
+ this.tocCheckEncrypt();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapActions("client", ["checkEncrypt"]),
|
|
|
minWin() {
|
|
|
ipcRenderer.send("minimize-window");
|
|
|
},
|
|
@@ -134,6 +155,47 @@ export default {
|
|
|
// this.$router.push({
|
|
|
// name: "PaperExport"
|
|
|
// });
|
|
|
+ },
|
|
|
+ tocCheckEncrypt() {
|
|
|
+ this.exceptionIsConfirm = true;
|
|
|
+ this.loading = true;
|
|
|
+ this.tips = "正在检测加密狗,请稍后……";
|
|
|
+ this.checkEncrypt();
|
|
|
+ },
|
|
|
+ encryptSuccess() {
|
|
|
+ if (!this.exceptionIsConfirm) return;
|
|
|
+ this.exceptionIsConfirm = false;
|
|
|
+
|
|
|
+ this.loading = false;
|
|
|
+ this.tips = "";
|
|
|
+ this.encryptValid = true;
|
|
|
+ this.$Modal.success({
|
|
|
+ content: "加密狗检测成功!",
|
|
|
+ onOk: () => {
|
|
|
+ this.exceptionIsConfirm = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ encryptError(error) {
|
|
|
+ if (!this.exceptionIsConfirm) return;
|
|
|
+ this.exceptionIsConfirm = false;
|
|
|
+
|
|
|
+ this.loading = false;
|
|
|
+ this.encryptValid = false;
|
|
|
+ this.tips = "校验失败!";
|
|
|
+ this.$Modal.confirm({
|
|
|
+ content: error.msg,
|
|
|
+ okText: "关闭程序",
|
|
|
+ cancelText: "重新检测",
|
|
|
+ onOk: () => {
|
|
|
+ ipcRenderer.send("close-window");
|
|
|
+ },
|
|
|
+ onCancel: () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.tocCheckEncrypt();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|