|
@@ -4,20 +4,20 @@
|
|
|
<div>
|
|
|
<img class="collectionHeader" :src="collectionHeader" />
|
|
|
</div>
|
|
|
- <div @click="goExercise('wrong')" class="choose">
|
|
|
- <div class="choose-img">
|
|
|
+ <div class="choose">
|
|
|
+ <div @click="goExercise('wrong')" class="choose-img">
|
|
|
<span class="choose-text1"> 做错题 </span>
|
|
|
<span class="choose-text2"> 共 {{ wrongList.length }} 题 </span>
|
|
|
<img class="" :src="wrongBg" />
|
|
|
<img class="goArrow" :src="goArrow" />
|
|
|
- <button @click="clearTopics('wrong')" style="color: #498ef5" class="clear">清空错题</button>
|
|
|
+ <button @click="clearTopicsWrong" style="color: #498ef5" class="clear">清空错题</button>
|
|
|
</div>
|
|
|
<div @click="goExercise('collection')" class="choose-img">
|
|
|
<span class="choose-text1">收藏题</span>
|
|
|
<span class="choose-text2"> 共 {{ collectionList.length }} 题 </span>
|
|
|
<img class="" :src="collectionBg" />
|
|
|
<img class="goArrow" :src="goArrow" />
|
|
|
- <button @click="clearTopics('collection')" style="color: #01c18d" class="clear">清空收藏</button>
|
|
|
+ <button @click="clearTopicsCollection" style="color: #01c18d" class="clear">清空收藏</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="bottom">
|
|
@@ -86,48 +86,69 @@ const gsMap: {
|
|
|
kc: "客车",
|
|
|
mtc: "摩托车",
|
|
|
};
|
|
|
-const clearTopics = (type: string) => {
|
|
|
- if (type == "wrong") {
|
|
|
- let collectionModel = new CollectionModel("wrong");
|
|
|
- Dialog.confirm({
|
|
|
- title: "清除错题",
|
|
|
- message: "是否清除错题",
|
|
|
+const clearTopicsCollection = (e: PointerEvent) => {
|
|
|
+ e.preventDefault();
|
|
|
+ e.stopPropagation();
|
|
|
+ let collectionModel = new CollectionModel("collection");
|
|
|
+ Dialog.confirm({
|
|
|
+ title: "清除收藏",
|
|
|
+ message: "是否清除收藏",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // on confirm
|
|
|
+ collectionModel
|
|
|
+ .deleteAll({
|
|
|
+ km: router.currentRoute.value.query.subject === "1" ? "科目一" : "科目四",
|
|
|
+ carType: gsMap[router.currentRoute.value.query.gs] as CollectionAndWrongType.CarType,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ Dialog.alert({ message: "清除成功" });
|
|
|
+ let collectionModel = new CollectionAndWrong("collection");
|
|
|
+ collectionModel
|
|
|
+ .getList({
|
|
|
+ km: router.currentRoute.value.query.subject === "1" ? "科目一" : "科目四",
|
|
|
+ carType: router.currentRoute.value.query.vehicle as CollectionAndWrongType.CarType,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ collectionList.value = res.rows;
|
|
|
+ });
|
|
|
+ });
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- // on confirm
|
|
|
- collectionModel
|
|
|
- .deleteAll({
|
|
|
- km: router.currentRoute.value.query.subject === "1" ? "科目一" : "科目四",
|
|
|
- carType: router.currentRoute.value.query.vehicle as CollectionAndWrongType.CarType,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- Dialog.alert({ message: "清除成功" });
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- // on cancel
|
|
|
- });
|
|
|
- } else if (type == "collection") {
|
|
|
- let collectionModel = new CollectionModel("collection");
|
|
|
- Dialog.confirm({
|
|
|
- title: "清除收藏",
|
|
|
- message: "是否清除收藏",
|
|
|
+ .catch(() => {
|
|
|
+ // on cancel
|
|
|
+ });
|
|
|
+};
|
|
|
+const clearTopicsWrong = (e: PointerEvent) => {
|
|
|
+ e.preventDefault();
|
|
|
+ e.stopPropagation();
|
|
|
+ let collectionModel = new CollectionModel("wrong");
|
|
|
+ Dialog.confirm({
|
|
|
+ title: "清除错题",
|
|
|
+ message: "是否清除错题",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // on confirm
|
|
|
+ collectionModel
|
|
|
+ .deleteAll({
|
|
|
+ km: router.currentRoute.value.query.subject === "1" ? "科目一" : "科目四",
|
|
|
+ carType: router.currentRoute.value.query.vehicle as CollectionAndWrongType.CarType,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ Dialog.alert({ message: "清除成功" });
|
|
|
+ let wrongModel = new CollectionAndWrong("wrong");
|
|
|
+ wrongModel
|
|
|
+ .getList({
|
|
|
+ km: router.currentRoute.value.query.subject === "1" ? "科目一" : "科目四",
|
|
|
+ carType: router.currentRoute.value.query.vehicle as CollectionAndWrongType.CarType,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ wrongList.value = res.rows;
|
|
|
+ });
|
|
|
+ });
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- // on confirm
|
|
|
- collectionModel
|
|
|
- .deleteAll({
|
|
|
- km: router.currentRoute.value.query.subject === "1" ? "科目一" : "科目四",
|
|
|
- carType: gsMap[router.currentRoute.value.query.gs] as CollectionAndWrongType.CarType,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- Dialog.alert({ message: "清除成功" });
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- // on cancel
|
|
|
- });
|
|
|
- }
|
|
|
+ .catch(() => {
|
|
|
+ // on cancel
|
|
|
+ });
|
|
|
};
|
|
|
const goExercise = (type: string) => {
|
|
|
switch (type) {
|