Browse Source

定时删除

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

2
src/view/tabs/tabs.vue

@ -147,4 +147,4 @@ const pullUp = () => { @@ -147,4 +147,4 @@ const pullUp = () => {
z-index: 999;
}
}
</style>
</style>

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

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

Loading…
Cancel
Save