Browse Source

定时删除

dev_230517
刘洪超 2 years ago
parent
commit
6a21c5b3d2
  1. 14
      index.html
  2. 828
      src/assets/libs/js/BBbundle.js
  3. 10
      src/assets/libs/js/vconsole.js
  4. 38
      src/view/tabs/fixed-time.vue
  5. 35
      src/view/timing/timing-sure-delete.vue

14
index.html

File diff suppressed because one or more lines are too long

828
src/assets/libs/js/BBbundle.js

File diff suppressed because one or more lines are too long

10
src/assets/libs/js/vconsole.js

File diff suppressed because one or more lines are too long

38
src/view/tabs/fixed-time.vue

@ -23,7 +23,7 @@
<div <div
v-for="(item, i) in navList" v-for="(item, i) in navList"
v-show="navList.length > 0" v-show="navList.length > 0"
:key="i" :key="item.id"
@click="onItemClick(item)" @click="onItemClick(item)"
> >
<div <div
@ -63,11 +63,19 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { ref } from "vue"; import { getCurrentInstance, onBeforeMount, ref } from "vue";
import { TimingDto } from "@/dto/timing-dto"; import { TimingDto } from "@/dto/timing-dto";
import { Toast } from "vant";
const { proxy } = getCurrentInstance() as any;
const router = useRouter(); const router = useRouter();
let isCreat = false;
const runFun = (index: any) => {
Toast("删除角标" + index);
navList.value.splice(index, 1);
};
/** /**
* 切换选中状态 * 切换选中状态
*/ */
@ -92,12 +100,21 @@ const onClickAdd = () => {
* 删除定时 * 删除定时
*/ */
const onItemDelete = (index: number) => { const onItemDelete = (index: number) => {
router.push("/timingSureDelete"); router.push({
path: "/timingSureDelete",
query: { pageType: "timingSureDelete", index: index }
});
// navList.value.splice(index, 1); // navList.value.splice(index, 1);
// if (navList.value.length === 0) { // if (navList.value.length === 0) {
// // // //
// } // }
}; };
onBeforeMount(() => {
if (!isCreat) {
isCreat = true;
proxy.$eventBusService.on("timingDelete", runFun);
}
});
const navList = ref([ const navList = ref([
{ {
@ -105,26 +122,31 @@ const navList = ref([
time: "2.5", time: "2.5",
name: "主卧空调", name: "主卧空调",
state: false, state: false,
selectState: false, selectState: false
}, },
{ {
id: 1, id: 1,
time: "3.0", time: "3.0",
name: "次卧空调", name: "次卧空调",
state: true, state: true,
selectState: false, selectState: false
}, },
{ {
id: 2, id: 2,
time: "4.0", time: "4.0",
name: "餐厅空调", name: "餐厅空调",
state: false, state: false,
selectState: false, selectState: false
}, }
]); ]);
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.sy {
width: 672px;
background-color: rebeccapurple;
}
.base-timing-card { .base-timing-card {
background-image: url("@/assets/imgs/show/bg_timing.png"); background-image: url("@/assets/imgs/show/bg_timing.png");
height: 100vh; height: 100vh;

35
src/view/timing/timing-sure-delete.vue

@ -15,32 +15,33 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { Toast } from "vant";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { onBeforeMount, ref } from "vue";
import { Toast } from "vant";
import { getCurrentInstance } from "vue";
const { proxy } = getCurrentInstance() as any;
const router = useRouter(); const router = useRouter();
let index = 0;
/** /**
* 删除定时 * 删除定时
* @param b * @param sure
*/ */
const onDeleteClick = (b: boolean) => { const onDeleteClick = (sure: boolean) => {
if (b) { router.back();
Toast("删除成功");
}
};
const onSelectClick = (sure: boolean) => {
if (sure) { if (sure) {
router.push({ proxy.$eventBusService.emit("timingDelete", index);
path: "/tabs",
query: { pageType: "tabs", isDelete: "1" }
});
} else {
router.push({
path: "/tabs",
query: { pageType: "tabs", isDelete: "0" }
});
} }
}; };
onBeforeMount(() => {
const query: any = router.currentRoute.value.query;
if (query && query.pageType === "timingSureDelete") {
index = query.index;
Toast("接收的角标:" + index);
}
});
</script> </script>
<style scoped> <style scoped>

Loading…
Cancel
Save