Commit 97e0fb09 by linjinhong

修改裁剪功能bug以及登录后网格消失问题

parent 08521d9f
{
"apiApiHost":"https://factory.jomalls.com/api",
"fileApiUrl":"https://factory.jomalls.com/upload/factory",
"apiApiHost":"http://10.168.31.142:8060/api",
"fileApiUrl":"http://10.168.31.142:80/upload/factory",
"visionUrl":"https://console.jomalls.com"
}
......@@ -26,6 +26,16 @@ export default new Vuex.Store({
autoPrint: false,
gridSpacing: 10,
},
grid: [
{
label: "16×18",
value: 1,
row: 16,
col: 18,
h: 0,
w: 0,
},
],
},
mutations: {
setDefaultSetting(state) {
......@@ -55,6 +65,10 @@ export default new Vuex.Store({
setIsPreView(state, value) {
state.isPreView = value;
},
setGrid(state, { h, w }) {
state.grid[0].h = h;
state.grid[0].w = w;
},
},
getters: {
systemSetting(state) {
......
<script>
const { ipcRenderer } = require("electron");
import { mapState } from "vuex";
export default {
data() {
return {
rules: {
factoryCode: [
{ message: "请输入工厂编码", required: true, trigger: "blur" }
{ message: "请输入工厂编码", required: true, trigger: "blur" },
],
account: [{ message: "请输入账号", required: true, trigger: "blur" }],
password: [{ message: "请输入密码", required: true, trigger: "blur" }]
password: [{ message: "请输入密码", required: true, trigger: "blur" }],
},
userList: [],
authorityVisible: false,
......@@ -17,12 +20,33 @@ export default {
form: {
factoryCode: "",
account: "",
password: ""
}
password: "",
},
};
},
computed: {
...mapState(["grid"]),
},
created() {
this.userList = this.$dataStore.get('userList') || []
this.userList = this.$dataStore.get("userList") || [];
ipcRenderer.on("window-size", (event, size) => {
const { width, height } = size;
console.log(`接收到窗口尺寸:${width}x${height}`);
let proportion;
if (height > 1000) {
proportion = 1.7;
} else if (height > 900 && height <= 1000) {
proportion = 1.5;
} else {
proportion = 1;
}
this.$store.commit("setWHproportion", proportion);
this.$store.commit("setGrid", {
h: 540 * proportion,
w: 480 * proportion,
});
console.log(this.grid);
});
},
mounted() {
document.addEventListener("keyup", this.keyUp);
......@@ -38,11 +62,14 @@ export default {
},
async login() {
this.$refs.formRef.validate(async valid => {
this.$refs.formRef.validate(async (valid) => {
if (valid) {
let f = JSON.parse(JSON.stringify(this.form));
let { data } = await this.$api.post("/login", f);
this.$dataStore.set("user", { ...data.sysUser,...{token:data.token} });
this.$dataStore.set("user", {
...data.sysUser,
...{ token: data.token },
});
console.log(this.$dataStore);
if (this.remember) {
let userList = this.$dataStore.get("userList");
......@@ -50,7 +77,7 @@ export default {
if (userList) {
if (
!userList.find(
el =>
(el) =>
el.account === f.account && el.factoryCode === f.factoryCode
)
) {
......@@ -70,8 +97,8 @@ export default {
this.form.account = this.userList[v].account;
this.form.factoryCode = this.userList[v].factoryCode;
this.form.password = this.userList[v].password;
}
}
},
},
};
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment