-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 修改历史小鱼干卡片 * feat: 动态增加校区图标 * perf: 增加getSchoolName函数
- Loading branch information
1 parent
571f95a
commit acbb95f
Showing
6 changed files
with
69 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Community } from "@/apis/schemas"; | ||
import { reactive, ref } from "vue"; | ||
import { listCommunity } from "@/apis/community/community"; | ||
|
||
const parentId = ref(""); | ||
const currentSchool = ref(""); | ||
const currentCampus = ref(""); | ||
|
||
const lists = reactive<{ data: Community[] }>({ data: [] }); | ||
async function schoolList() { | ||
lists.data = (await listCommunity({})).communities; | ||
} | ||
export const getSchoolName = (communityId: string) => { | ||
schoolList(); | ||
for (const data of lists.data) { | ||
if (data.id === communityId) { | ||
currentCampus.value = data.name; | ||
parentId.value = data.parentId || ""; | ||
} | ||
} | ||
for (const data of lists.data) { | ||
if (data.id === parentId.value) { | ||
currentSchool.value = data.name; | ||
} | ||
} | ||
return currentCampus.value != currentSchool.value | ||
? `${currentSchool.value}-${currentCampus.value}` | ||
: currentSchool.value; | ||
}; |