diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json
index 111cc41..e4f3b05 100644
--- a/.eslintrc-auto-import.json
+++ b/.eslintrc-auto-import.json
@@ -102,6 +102,12 @@
"useNavbarWeixin": true,
"cities": true,
"getCities": true,
- "useCityInfo": true
+ "useCityInfo": true,
+ "useRules": true,
+ "rules": true,
+ "optionalSubjectList": true,
+ "requireSubjectList": true,
+ "optionalSubject": true,
+ "requireSubject": true
}
}
diff --git a/README.md b/README.md
index 69d6de8..7e8bdbc 100644
--- a/README.md
+++ b/README.md
@@ -1,49 +1,6 @@
-
-
-
-
-
+# 六维志愿
-
-
-
-旧仓库 codercup 进不去了,star 也拿不回来,这里也展示一下那个地址的 star.
-
-[](https://github.com/codercup/unibest)
-[](https://github.com/codercup/unibest)
-
-
-
-
-
-[](https://github.com/feige996/unibest)
-[](https://github.com/feige996/unibest)
-[](https://gitee.com/feige996/unibest/stargazers)
-[](https://gitee.com/feige996/unibest/members)
-
-
-
-
-
-
-
-`unibest` —— 最好的 `uniapp` 开发模板,由 `uniapp` + `Vue3` + `Ts` + `Vite5` + `UnoCss` + `wot-ui` + `z-paging` 构成,使用了最新的前端技术栈,无需依靠 `HBuilderX`,通过命令行方式运行 `web`、`小程序` 和 `App`(编辑器推荐 `VSCode`,可选 `webstorm`)。
-
-`unibest` 内置了 `约定式路由`、`layout布局`、`请求封装`、`请求拦截`、`登录拦截`、`UnoCSS`、`i18n多语言` 等基础功能,提供了 `代码提示`、`自动格式化`、`统一配置`、`代码片段` 等辅助功能,让你编写 `uniapp` 拥有 `best` 体验 ( `unibest 的由来`)。
-
-
-
-
- 📖 文档地址(new)
- |
- 📱 DEMO 地址
-
-
----
-
-注意旧的地址 [codercup](https://github.com/codercup/unibest) 我进不去了,使用新的 [feige996](https://github.com/feige996/unibest)。PR和 issue 也请使用新地址,否则无法合并。
+六维志愿小程序
## 平台兼容性
@@ -79,16 +36,3 @@
- web平台: `pnpm build:h5`,打包后的文件在 `dist/build/h5`,可以放到web服务器,如nginx运行。如果最终不是放在根目录,可以在 `manifest.config.ts` 文件的 `h5.router.base` 属性进行修改。
- weixin平台:`pnpm build:mp-weixin`, 打包后的文件在 `dist/build/mp-weixin`,然后通过微信开发者工具导入,并点击右上角的“上传”按钮进行上传。
- APP平台:`pnpm build:app`, 然后打开 `HBuilderX`,导入刚刚生成的`dist/build/app` 文件夹,选择发行 - APP云打包。
-
-## 📄 License
-
-[MIT](https://opensource.org/license/mit/)
-
-Copyright (c) 2025 菲鸽
-
-## 捐赠
-
-
-
-
-
diff --git a/pages.config.ts b/pages.config.ts
index fa4a32d..34983d1 100644
--- a/pages.config.ts
+++ b/pages.config.ts
@@ -161,6 +161,14 @@ export default defineUniPages({
navigationBarTitleText: '城市',
},
},
+ {
+ path: 'pages/home/schoolRank/index',
+ type: 'page',
+ style: {
+ navigationStyle: 'custom',
+ navigationBarTitleText: '院校排行榜',
+ },
+ },
{
path: 'pages/customerService/index/index',
type: 'page',
diff --git a/src/components/bar/TabBar.vue b/src/components/bar/TabBar.vue
index e09a187..dd78a7c 100644
--- a/src/components/bar/TabBar.vue
+++ b/src/components/bar/TabBar.vue
@@ -1,32 +1,4 @@
-
-
import { TabesItem } from '@/service/app/types'
import { tabbarList } from '@/hooks/useTabbarList'
-import useNavbarWeixin from '@/hooks/useNavbarWeixin'
-
-const { safeAreaInsets } = useNavbarWeixin()
const tabbar = ref(1)
@@ -73,7 +42,7 @@ const changeItem = (item: TabesItem) => {
})
}
-onBeforeMount(() => {
+onMounted(() => {
uni.hideTabBar()
})
diff --git a/src/components/fab/Fab.vue b/src/components/fab/Fab.vue
index 38e288d..0028ec2 100644
--- a/src/components/fab/Fab.vue
+++ b/src/components/fab/Fab.vue
@@ -1,5 +1,5 @@
-
+
{{ item.name }}
@@ -57,6 +58,12 @@ const swiperList = [
{ id: 3, name: '软科', type: '3' },
{ id: 4, name: 'QS', type: '4' },
]
+
+const toSchool = (id: string) => {
+ uni.navigateTo({
+ url: `/pages/home/schoolRank/index?type=${id}`,
+ })
+}
diff --git a/src/hooks/useCityInfoHook.ts b/src/hooks/useCityInfoHook.ts
index aeb79a4..d0c000a 100644
--- a/src/hooks/useCityInfoHook.ts
+++ b/src/hooks/useCityInfoHook.ts
@@ -1,5 +1,7 @@
import { getVolunteerInitialization } from '@/service/index/api'
import { useCityStore } from '@/store/city'
+import { useUserStore } from '@/store/user'
+import { City } from '@/types/app-type'
import { pinyin } from 'pinyin-pro'
interface Province {
@@ -7,6 +9,7 @@ interface Province {
}
const cityStore = useCityStore()
+const userStore = useUserStore()
export const cities = []
export const useCityInfo = () => {
@@ -16,7 +19,9 @@ export const useCityInfo = () => {
const li = groupByFirstLetter(list)
cityStore.setCities(li)
const defaultCity = list.filter((item) => item.provincename === '山东省')[0] as City
- cityStore.setUserCity(defaultCity)
+ if (userStore.userInfo.city.code === '0') {
+ userStore.setUserCity(defaultCity)
+ }
}
})
}
diff --git a/src/hooks/useRules.ts b/src/hooks/useRules.ts
new file mode 100644
index 0000000..2d41d4e
--- /dev/null
+++ b/src/hooks/useRules.ts
@@ -0,0 +1,27 @@
+import { getCountryRules } from '@/service/index/api'
+import { useRulesStore } from '@/store/rules'
+import { useUserStore } from '@/store/user'
+import { RuleResult } from '@/types/app-type'
+
+const rulesStore = useRulesStore()
+const userStore = useUserStore()
+
+export const requireSubjectList = ref([])
+export const optionalSubjectList = ref([])
+// 单选 必选学科
+export const requireSubject = ref('')
+// 任意选择科目
+export const optionalSubject = ref([])
+
+export const useRules = () => {
+ getCountryRules().then((res) => {
+ if (res.code === 200) {
+ const results = res.result as RuleResult[]
+ rulesStore.setRules(results)
+ const matchRule = results.filter((item) => item.p === userStore.userInfo.city.policy)
+ const matchRules = matchRule.length > 0 ? matchRule[0].rule : []
+ requireSubjectList.value = matchRules.filter((item) => item?.isfirst === 'true')
+ optionalSubjectList.value = matchRules.filter((item) => !(item?.isfirst === 'true'))
+ }
+ })
+}
diff --git a/src/pages.json b/src/pages.json
index dbefa7f..16edbbe 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -159,6 +159,14 @@
"navigationBarTitleText": "排名"
}
},
+ {
+ "path": "pages/home/schoolRank/index",
+ "type": "page",
+ "style": {
+ "navigationStyle": "custom",
+ "navigationBarTitleText": "院校排行榜"
+ }
+ },
{
"path": "pages/news/index/index",
"type": "page",
diff --git a/src/pages/home/city/index.vue b/src/pages/home/city/index.vue
index c19f2d8..8c63932 100644
--- a/src/pages/home/city/index.vue
+++ b/src/pages/home/city/index.vue
@@ -19,8 +19,11 @@
diff --git a/src/pages/home/index/index.vue b/src/pages/home/index/index.vue
index cda73cc..73ae505 100644
--- a/src/pages/home/index/index.vue
+++ b/src/pages/home/index/index.vue
@@ -1,19 +1,15 @@
-
-{
- style: {
- navigationStyle: 'custom',
- },
-}
-
-
-
- {{ cityStore.userCity.city.provincename }}
+
+ {{ userStore.userInfo.city.provincename ?? '城市' }}
@@ -42,7 +38,7 @@
+
+
diff --git a/src/pages/home/schoolRank/index.vue b/src/pages/home/schoolRank/index.vue
new file mode 100644
index 0000000..e0126b5
--- /dev/null
+++ b/src/pages/home/schoolRank/index.vue
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/service/index/api.ts b/src/service/index/api.ts
index 1945df1..c8a7836 100644
--- a/src/service/index/api.ts
+++ b/src/service/index/api.ts
@@ -10,5 +10,9 @@ export const sysDictType = (params: any) => {
}
export const getVolunteerInitialization = () => {
- return http.get('/api/v1/base/volunteerInitialization.json', { staticType: 'static' })
+ return http.get('/api/busProvinceInitialization/list')
+}
+
+export const getCountryRules = () => {
+ return http.get('/api/v1/base/rules.json', { staticType: 'static' })
}
diff --git a/src/static/images/schoolRank/background.svg b/src/static/images/schoolRank/background.svg
new file mode 100644
index 0000000..3556d35
--- /dev/null
+++ b/src/static/images/schoolRank/background.svg
@@ -0,0 +1,9 @@
+
diff --git a/src/static/images/schoolRank/title.svg b/src/static/images/schoolRank/title.svg
new file mode 100644
index 0000000..5598713
--- /dev/null
+++ b/src/static/images/schoolRank/title.svg
@@ -0,0 +1,9 @@
+
diff --git a/src/static/images/schoolRank/trophy.svg b/src/static/images/schoolRank/trophy.svg
new file mode 100644
index 0000000..cb92b30
--- /dev/null
+++ b/src/static/images/schoolRank/trophy.svg
@@ -0,0 +1,9 @@
+
diff --git a/src/store/city.ts b/src/store/city.ts
index 3e67e53..7606d8e 100644
--- a/src/store/city.ts
+++ b/src/store/city.ts
@@ -1,16 +1,8 @@
+import { IUserCity } from '@/types/app-type'
import { defineStore } from 'pinia'
import { ref } from 'vue'
const initState = {
- city: {
- allscore: 0,
- code: '0',
- isopen: 0,
- lizations: [{ name: '0', policy: 0, code: 0 }],
- policy: 0,
- provincename: '',
- years: 0,
- },
cities: [],
}
@@ -19,10 +11,6 @@ export const useCityStore = defineStore(
() => {
const userCity = ref({ ...initState })
- const setUserCity = (val: City) => {
- userCity.value.city = val
- }
-
const setCities = (val: Array) => {
userCity.value.cities = val
}
@@ -37,7 +25,6 @@ export const useCityStore = defineStore(
return {
userCity,
- setUserCity,
clearUserCity,
setCities,
diff --git a/src/store/rules.ts b/src/store/rules.ts
new file mode 100644
index 0000000..d56c201
--- /dev/null
+++ b/src/store/rules.ts
@@ -0,0 +1,36 @@
+import { RulesStore } from '@/types/app-type'
+import { defineStore } from 'pinia'
+
+const initState = {
+ rules: [],
+}
+
+export const useRulesStore = defineStore(
+ 'rules',
+ () => {
+ const store = ref({ ...initState })
+
+ const setRules = (val: Array) => {
+ store.value.rules = val
+ }
+
+ const clearRules = () => {
+ store.value = { ...initState }
+ }
+ // 一般没有reset需求,不需要的可以删除
+ const reset = () => {
+ store.value = { ...initState }
+ }
+
+ return {
+ store,
+ clearRules,
+ setRules,
+
+ reset,
+ }
+ },
+ {
+ persist: true,
+ },
+)
diff --git a/src/store/user.ts b/src/store/user.ts
index 82bd873..082698a 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -1,17 +1,49 @@
+import { City, ExtraUserInfo } from '@/types/app-type'
import { defineStore } from 'pinia'
import { ref } from 'vue'
-const initState = { nickname: '', avatar: '' }
+const initState = {
+ nickname: '',
+ avatar: '',
+ city: {
+ allscore: 0,
+ code: '0',
+ isopen: 0,
+ lizations: [],
+ policy: 0,
+ provincename: '',
+ years: 0,
+ },
+ estimatedAchievement: {
+ year: 0, // 学期
+ score: 0, // 成绩
+ requireSubject: { code: 0, name: '', simplename: '' },
+ optionSubject: [],
+ cityCode: 0,
+ },
+}
export const useUserStore = defineStore(
'user',
() => {
- const userInfo = ref({ ...initState })
+ const userInfo = ref({ ...initState })
- const setUserInfo = (val: IUserInfo) => {
+ // 设置用户信息
+ const setUserInfo = (val: ExtraUserInfo) => {
userInfo.value = val
}
+ // 设置用户所在城市
+ const setUserCity = (val: City) => {
+ userInfo.value.city = val
+ }
+
+ // 设置预估成绩
+ const setEstimatedAchievement = (val: any) => {
+ userInfo.value.estimatedAchievement = val
+ }
+
+ // 清除用户信息
const clearUserInfo = () => {
userInfo.value = { ...initState }
}
@@ -27,6 +59,8 @@ export const useUserStore = defineStore(
clearUserInfo,
isLogined,
reset,
+ setUserCity,
+ setEstimatedAchievement,
}
},
{
diff --git a/src/types/app-type.d.ts b/src/types/app-type.d.ts
new file mode 100644
index 0000000..9e96c79
--- /dev/null
+++ b/src/types/app-type.d.ts
@@ -0,0 +1,35 @@
+export type Rule = {
+ code: number
+ name: string
+ simplename: string
+ isfirst?: string
+}
+
+export type RuleResult = { p: number; rule: Rule[] }
+
+export type RulesStore = {
+ rules: RuleResult[]
+}
+
+export type City = {
+ allscore: number
+ code: string
+ isopen: number
+ lizations: { name: string; policy: number; code: number }[]
+ policy: number
+ provincename: string
+ years: number
+}
+export type IUserCity = {
+ cities: Array<{ letter: string; provinces: { id: number; provincename: string } }>
+}
+
+export type ExtraUserInfo = {
+ city?: City
+ estimatedAchievement: {
+ year: number
+ score: number
+ requireSubject: Rule
+ optionSubject: Rule[]
+ }
+} & IUserInfo
diff --git a/src/types/auto-import.d.ts b/src/types/auto-import.d.ts
index 542e6f5..ac42837 100644
--- a/src/types/auto-import.d.ts
+++ b/src/types/auto-import.d.ts
@@ -63,11 +63,16 @@ declare global {
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
+ const optionalSubject: typeof import('../hooks/useRules')['optionalSubject']
+ const optionalSubjectList: typeof import('../hooks/useRules')['optionalSubjectList']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
+ const requireSubject: typeof import('../hooks/useRules')['requireSubject']
+ const requireSubjectList: typeof import('../hooks/useRules')['requireSubjectList']
const resolveComponent: typeof import('vue')['resolveComponent']
+ const rules: typeof import('../hooks/useRules')['rules']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
@@ -86,6 +91,7 @@ declare global {
const useModel: typeof import('vue')['useModel']
const useNavbarWeixin: typeof import('../hooks/useNavbarWeixin')['default']
const useRequest: typeof import('../hooks/useRequest')['default']
+ const useRules: typeof import('../hooks/useRules')['useRules']
const useSlots: typeof import('vue')['useSlots']
const useTemplateRef: typeof import('vue')['useTemplateRef']
const useUpload: typeof import('../hooks/useUpload')['default']
@@ -163,10 +169,14 @@ declare module 'vue' {
readonly onUnmounted: UnwrapRef
readonly onUpdated: UnwrapRef
readonly onWatcherCleanup: UnwrapRef
+ readonly optionalSubject: UnwrapRef
+ readonly optionalSubjectList: UnwrapRef
readonly provide: UnwrapRef
readonly reactive: UnwrapRef
readonly readonly: UnwrapRef
readonly ref: UnwrapRef
+ readonly requireSubject: UnwrapRef
+ readonly requireSubjectList: UnwrapRef
readonly resolveComponent: UnwrapRef
readonly shallowReactive: UnwrapRef
readonly shallowReadonly: UnwrapRef
@@ -186,6 +196,7 @@ declare module 'vue' {
readonly useModel: UnwrapRef
readonly useNavbarWeixin: UnwrapRef
readonly useRequest: UnwrapRef
+ readonly useRules: UnwrapRef
readonly useSlots: UnwrapRef
readonly useTemplateRef: UnwrapRef
readonly useUpload: UnwrapRef
diff --git a/src/types/uni-pages.d.ts b/src/types/uni-pages.d.ts
index 1aeed71..34838f1 100644
--- a/src/types/uni-pages.d.ts
+++ b/src/types/uni-pages.d.ts
@@ -19,6 +19,7 @@ interface NavigateToOptions {
"/pages/home/line/index" |
"/pages/home/major/index" |
"/pages/home/rank/index" |
+ "/pages/home/schoolRank/index" |
"/pages/news/index/index" |
"/pages/place/index/index" |
"/pages/ucenter/index/index";
diff --git a/src/typings.d.ts b/src/typings.d.ts
index c93bab1..0de7fea 100644
--- a/src/typings.d.ts
+++ b/src/typings.d.ts
@@ -23,20 +23,6 @@ declare global {
openid?: string
token?: string
}
-
- type City = {
- allscore: number
- code: string
- isopen: number
- lizations: { name: string; policy: number; code: number }[]
- policy: number
- provincename: string
- years: number
- }
- type IUserCity = {
- city: City
- cities: Array<{ letter: string; provinces: { id: number; provincename: string } }>
- }
}
export {} // 防止模块污染