Skip to content

Commit

Permalink
Merge pull request #162 from j10ccc/fix/rest-type-error
Browse files Browse the repository at this point in the history
fix(my): type error on new feature badge
  • Loading branch information
j10ccc authored Nov 15, 2024
2 parents e55ea69 + 771b423 commit 11c6d39
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 99 deletions.
19 changes: 7 additions & 12 deletions src/components/My/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ import Taro from "@tarojs/taro";
import { computed } from "vue";
import "./index.scss";
import { storeToRefs } from "pinia";
import useNewFeatureStore from "@/store/service/newFeature";
import useNewFeatureStore, { FeatureNode } from "@/store/service/newFeature";
import useUserStore from "@/store/service/user";
import { Image as TaroImage } from "@tarojs/components";
Expand All @@ -85,10 +85,11 @@ const { getWXProfile } = userStore;
const { isActive, wxProfile, info: userInfo } = storeToRefs(userStore);
const options = computed(() => {
const data = [
const newFeaturesInMinePage = newFeatureStore.tree?.my as FeatureNode;
return [
[
// TODO: 修复类型问题
{ title: "绑定", url: "/pages/bind/index", badge: newFeatureStore.tree?.my?.bind },
{ title: "绑定", url: "/pages/bind/index", badge: newFeaturesInMinePage.bind as string },
{ title: "主题", url: "/pages/theme/index" }
],
[
Expand All @@ -99,20 +100,14 @@ const options = computed(() => {
{ title: "设置", url: "/pages/setting/index" }
]
];
return data;
});
function nav2activation() {
Taro.navigateTo({
url: "/pages/activation/index"
});
Taro.navigateTo({ url: "/pages/activation/index" });
}
function nav2url(url: string | undefined) {
if (url)
Taro.navigateTo({
url: url
});
if (url) Taro.navigateTo({ url });
}
</script>
9 changes: 5 additions & 4 deletions src/pages/lostfound/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import { LostfoundService } from "@/services";
import { LostfoundRecord } from "@/types/Lostfound";
import { ref } from "vue";
import PreviewCard from "./PreviewCard/index.vue";
import { omit } from "lodash-es";
import "./index.scss";
import WModal from "../../components/Modal/index.vue";
import { helpText } from "@/constants/copywriting";
Expand Down Expand Up @@ -127,7 +126,7 @@ const { data: kindList } = useRequestNext(
}
);
const { loading, run } = useRequestNext(
const { loading, run: fetchRecords } = useRequestNext(
LostfoundService.getRecords, {
defaultParams: {
campus: selectCampus.value,
Expand Down Expand Up @@ -161,8 +160,10 @@ const getRecords = (data: {
lost_or_found?: string;
}) => {
isEmpty.value = false;
// TODO: 修复类型问题
run(omit(data, [data.kind === "全部" ? "kind" : null, data.lost_or_found === "全部" ? "lost_or_found" : ""]));
if (data.kind === "全部")
fetchRecords({ campus: data.campus, page_num: data.page_num, page_size: data.page_size });
else
fetchRecords(data);
};
const handleSelectCampus = (campus: string) => {
Expand Down
2 changes: 0 additions & 2 deletions src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import LibraryService from "./services/libraryService";
import YxyService from "./services/yxyService";
import LostfoundService from "./services/lostfoundService";
import SuitService from "./services/suitService";
import errCodeHandler from "./utils/errHandler";
import { api } from "./api/apiList";

export {
Expand All @@ -16,6 +15,5 @@ export {
YxyService,
LostfoundService,
SuitService,
errCodeHandler,
api
};
80 changes: 0 additions & 80 deletions src/services/utils/errHandler.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/store/service/newFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { persistedStorage } from "@/utils";
import { defineStore } from "pinia";
import { computed, ref } from "vue";

type FeatureNode = {
export type FeatureNode = {
[key: string]: string | null | FeatureNode;
};

Expand Down

0 comments on commit 11c6d39

Please sign in to comment.