Commit 181d93fc by liuwange1

测试通讯

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