Commit 181d93fc by liuwange1

测试通讯

parent b40b4441
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<title> <title>
<%= htmlWebpackPlugin.options.title %> <%= htmlWebpackPlugin.options.title %>
</title> </title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head> </head>
<body> <body>
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="right"> <div class="right" v-if="showRight">
<router-view /> <router-view />
</div> </div>
</main> </main>
...@@ -126,13 +126,11 @@ export default { ...@@ -126,13 +126,11 @@ export default {
activeIndex: 0, activeIndex: 0,
pageY: 0, pageY: 0,
top: "90vh", top: "90vh",
showRight: false,
}; };
}, },
created() { created() {
this.$axios.get("/smartOperation/workOrderList").then((e) => { this.getBuildListData();
console.log(e);
console.log(JSON.stringify(e.data[0]));
});
// this.$axios.get("/building/getBuildingList").then((e) => { // this.$axios.get("/building/getBuildingList").then((e) => {
// console.log(e); // console.log(e);
// }); // });
...@@ -154,6 +152,12 @@ export default { ...@@ -154,6 +152,12 @@ export default {
// }); // });
}, },
methods: { methods: {
getBuildListData() {
this.$axios.get("/building/getBuildingList").then((e) => {
this.$store.commit("setBuildList", e.data);
this.showRight = true;
});
},
getLeftDistance(index) { getLeftDistance(index) {
if (index <= 2) { if (index <= 2) {
return index * 10; return index * 10;
...@@ -201,9 +205,7 @@ export default { ...@@ -201,9 +205,7 @@ export default {
// 总时长 300ms // 总时长 300ms
// let time1 = time || 300; // let time1 = time || 300;
let sp = (newTop - oldTop) / count; let sp = (newTop - oldTop) / count;
console.log("sp: ", sp);
let timer = setInterval(() => { let timer = setInterval(() => {
console.log(this.top);
this.top = Number(this.top.replace("px", "")) + Number(sp) + "px"; this.top = Number(this.top.replace("px", "")) + Number(sp) + "px";
count--; count--;
if (count == 0) { if (count == 0) {
......
...@@ -5,8 +5,12 @@ Vue.use(Vuex) ...@@ -5,8 +5,12 @@ Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
buildList: []
}, },
mutations: { mutations: {
setBuildList(state, data) {
state.buildList = data
}
}, },
actions: { actions: {
}, },
......
...@@ -10,8 +10,14 @@ ...@@ -10,8 +10,14 @@
<div class="select-item select-left"> <div class="select-item select-left">
<div class="select-title">楼栋</div> <div class="select-title">楼栋</div>
<div class="select-options"> <div class="select-options">
<gaojing v-for="item in 10" :key="item" :number="4"> <gaojing v-for="(item, index) in listL" :key="index">
<div class="btn1">{{ item }}</div> <div
class="btn1"
:class="{ active: activeIndex == index }"
@click="buildClickHandle(index)"
>
{{ item.buildingName }}
</div>
</gaojing> </gaojing>
</div> </div>
</div> </div>
...@@ -19,7 +25,13 @@ ...@@ -19,7 +25,13 @@
<div class="select-item select-right"> <div class="select-item select-right">
<div class="select-title">楼层</div> <div class="select-title">楼层</div>
<div class="select-options"> <div class="select-options">
<div class="btn2" v-for="item in 10" :key="item">{{ item }}</div> <div
class="btn2"
v-for="(item, index) in listR"
:key="index + 'a'"
>
{{ item.name }}
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -55,7 +67,36 @@ export default { ...@@ -55,7 +67,36 @@ export default {
name: "xiaofang", name: "xiaofang",
components: { gaojing }, components: { gaojing },
data() { data() {
return {}; return {
listL: [],
listR: [],
activeIndex: 0,
};
},
created() {
this.init();
},
methods: {
init() {
let buildList = this.$store.state.buildList;
buildList.unshift({
buildingName: "全部楼栋",
});
this.listL = buildList;
},
buildClickHandle(index) {
this.activeIndex = index;
this.$axios.post("/osc/sendInt", {
arg: 1,
name: "/EZ_XF",
});
},
},
watch: {
activeIndex(n) {
console.log(n);
this.listR = this.listL[n].subList || [];
},
}, },
}; };
</script> </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 sign in to comment