Forráskód Böngészése

tmp save for voluntary skill calc

abpcoder 1 hete
szülő
commit
974be8b79d

+ 13 - 1
src/common/routes.ts

@@ -38,7 +38,19 @@ export const routes = {
   /*
   * 测录取概率-结果
   * */
-  voluntaryResult: '/pagesOther/pages/voluntary/result/result'
+  voluntaryResult: '/pagesOther/pages/voluntary/result/result',
+  /*
+  * 测技能分
+  * */
+  skillIndex: '/pagesOther/pages/skill/index/index',
+  /*
+  * 测技能分-结果
+  * */
+  skillResult: '/pagesOther/pages/skill/result/result',
+  /*
+  * 志愿表
+  * */
+  voluntaryList: '/pagesOther/pages/voluntary/list/list'
 } as const;
 
 export type Routes = keyof typeof routes;

+ 19 - 2
src/pages.json

@@ -108,8 +108,25 @@
         {
           "path": "pages/voluntary/result/result",
           "style": {
-            "navigationBarTitleText": "",
-            "enablePullDownRefresh": true
+            "navigationBarTitleText": ""
+          }
+        },
+        {
+          "path": "pages/skill/index/index",
+          "style": {
+            "navigationBarTitleText": ""
+          }
+        },
+        {
+          "path": "pages/skill/result/result",
+          "style": {
+            "navigationBarTitleText": ""
+          }
+        },
+        {
+          "path": "pages/voluntary/list/list",
+          "style": {
+            "navigationBarTitleText": ""
           }
         }
       ]

+ 2 - 2
src/pagesMain/pages/volunteer/components/volunteer-banner.vue

@@ -21,10 +21,10 @@ const goRateCalc = function () {
     transferTo(routes.voluntaryIndex)
 }
 const goSkillCalc = function () {
-    console.log('goSkillCalc implement')
+    transferTo(routes.skillIndex)
 }
 const goVoluntaryList = function () {
-    console.log('goVoluntaryList implement')
+    transferTo(routes.voluntaryList)
 }
 </script>
 

+ 2 - 2
src/pagesOther/pages/major/index/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <id-page>
+  <ie-page>
     <z-paging ref="paging" v-model="list" :safe-area-inset-bottom="true" @query="handleQuery">
       <template #top>
         <ie-navbar title="专业库" />
@@ -22,7 +22,7 @@
         </uv-cell-group>
       </template>
     </z-paging>
-  </id-page>
+  </ie-page>
 </template>
 <script lang="ts" setup>
 import { getMajorTree, getMajorByName } from '@/api/modules/major';

+ 171 - 0
src/pagesOther/pages/skill/index/index.vue

@@ -0,0 +1,171 @@
+<template>
+    <ie-page bg-color="#F6F8FA">
+        <ie-navbar title="职业技能分测算" transparent bg-color="#FFFFFF" title-color="black" keep-title-color/>
+        <!-- #ifdef MP-WEIXIN -->
+        <uv-gap height="44"/>
+        <!-- #endif -->
+        <ie-image is-oss src="/volunteer/skill/index/bg.png" custom-class="w-full h-600"/>
+        <view class="-mt-420 z-1">
+            <view class="px-36 flex justify-between items-center">
+                <view class="text-3xl text-primary keep-all">
+                    <view class="mb-10 font-bold">测职业技能分</view>
+                    <view class="text-base">输入分数,测算所需职业技能分</view>
+                </view>
+                <ie-image is-oss src="/volunteer/skill/index/banner.png" custom-class="w-208 h-208"/>
+            </view>
+            <view class="mt-60 mx-30 bg-white rounded-xl p-35">
+                <view class="flex justify-between items-center">
+                    <view class="text-lg text-fore-title">报考院校专业</view>
+                    <view class="text-base text-fore-placeholder flex items-center">
+                        <text>更多</text>
+                        <uv-icon name="arrow-right" color="info"/>
+                    </view>
+                </view>
+                <ie-empty v-if="!data.rules?.length" :image="emptyImg" text="请选择你的报考院校专业~"/>
+                <voluntary-form v-else ref="form" disable-simulate/>
+            </view>
+        </view>
+        <ie-safe-toolbar :height="84" :shadow="false">
+            <view class="px-30 py-16">
+                <ie-button @click="handleSubmit">开始计算</ie-button>
+            </view>
+        </ie-safe-toolbar>
+    </ie-page>
+</template>
+
+<script setup lang="ts">
+import VoluntaryForm from "@/pagesOther/pages/voluntary/index/components/voluntary-form.vue";
+import {SelectedCollegeMajorWithRules, VoluntaryDto, VoluntaryModel, VoluntaryResult} from "@/types/voluntary";
+import {useTransferPage} from "@/hooks/useTransferPage";
+import {routes} from "@/common/routes";
+import {VOLUNTARY_FORM, VOLUNTARY_MODEL} from "@/types/injectionSymbols";
+import config from "@/config";
+
+const emptyImg = computed(() => config.ossUrl + '/volunteer/voluntary/index/empty_data.png')
+
+const form = ref<InstanceType<typeof VoluntaryForm> | null>(null)
+const data = ref<SelectedCollegeMajorWithRules>({} as SelectedCollegeMajorWithRules)
+const model = ref<VoluntaryModel>({})
+const {transferTo} = useTransferPage<any, VoluntaryDto>()
+
+const handleSubmit = async () => {
+    await form.value?.validate()
+    // make request
+    await nextTick()
+    const result: VoluntaryResult = {
+        "universityCode": "12302",
+        "majorCode": "690390",
+        "majorEnrollCode": "68508",
+        "majorGroup": "专业B组",
+        "majorName": "集成电路技术",
+        "majorDirection": "",
+        "enumPickType": "Danger",
+        "enrollRate": 53,
+        "enrollRateText": "风险极高",
+        "tips": null,
+        "histories": [
+            {
+                "year": 2025,
+                "score": "489.0",
+                "plan": 15,
+                "enroll": 15,
+                "diff": -12,
+                "ruleContent": '语数外180(语100*0.6+数100*0.6+外100*0.6)+职业技能420(技能展示300*1.4)',
+                "application": 3.1,
+                "admission": 1
+            },
+            {
+                "year": 2024,
+                "score": "",
+                "plan": null,
+                "enroll": 20
+            },
+            {
+                "year": 2023,
+                "score": "504.0",
+                "plan": null,
+                "enroll": 32
+            }
+        ],
+        "skill": {
+            year: 2025,
+            cultureScore: 230,
+            cultureRule: "语数外",
+            enrollScore: 489,
+            skillScore: 259, // 反向测技能分
+            diff: -23 // 负数表示低于skillScore,正数高于
+        }
+    }
+    const bigData: VoluntaryDto = {data: data.value, model: model.value, result}
+    transferTo(routes.skillResult, {bigData})
+}
+
+onMounted(async () => {
+    // api get rules
+    await nextTick()
+    data.value = {
+        // code: "20949",
+        majorAncestors: "交通运输大类>铁道运输类",
+        majorId: "68526",
+        majorName: "铁道交通运营管理",
+        majorGroup: '专业组一',
+        // notice: "",
+        universityId: "20949",
+        universityLogo: "https://mingxuejingbang.oss-cn-beijing.aliyuncs.com/ie/universityLog/23b6da550a584ea6b60886c6ae97b610.jpg",
+        universityName: "湖南铁道职业技术学院",
+        rules: [{
+            category: '文化素质',
+            content: '语(100分)+数(100分)+外(100分)',
+            details: [{
+                enumRuleCategory: 'Enroll',
+                enumInputType: 'Score',
+                label: '语文',
+                options: ["100"],
+                fieldName: '语文',
+                required: true,
+                defaultValue: 80
+            }, {
+                enumRuleCategory: 'Enroll',
+                enumInputType: 'Score',
+                label: '数学',
+                options: ["100"],
+                fieldName: '数学',
+                required: true,
+                defaultValue: 84
+            }, {
+                enumRuleCategory: 'Enroll',
+                enumInputType: 'Score',
+                label: '外语',
+                options: ["100"],
+                fieldName: '外语',
+                required: true,
+                defaultValue: 88
+            }]
+        }, {
+            category: '职业技能',
+            content: '机试(200分)+ 技能展示(100分)',
+            details: []
+        }]
+    }
+    // init model
+    data.value.rules.forEach((r) => {
+        r.details.forEach((d) => {
+            if (d.options?.length) {
+                model.value[d.fieldName] = d.defaultValue ? d.defaultValue : ''
+                model.value[d.fieldName + 'Total'] = d.options ? d.options[0] : null
+            }
+        })
+    })
+})
+
+provide(VOLUNTARY_FORM, data)
+provide(VOLUNTARY_MODEL, model)
+
+// 为了让子组件触发页面滚动
+onPageScroll(() => {
+})
+</script>
+
+<style scoped>
+
+</style>

+ 42 - 0
src/pagesOther/pages/skill/result/result.vue

@@ -0,0 +1,42 @@
+<template>
+    <ie-page bg-color="#F6F8FA">
+        <ie-navbar title="测职业技能分"/>
+        <ie-image is-oss src="/volunteer/skill/index/bg.png" custom-class="w-full h-600 absolute"/>
+        <view class="p-28 z-2">
+            <voluntary-form-major custom-class="bg-white !mt-0"/>
+        </view>
+        <ie-safe-toolbar :height="84" :shadow="false">
+            <view class="px-30 py-16">
+                <ie-button @click="handleSubmit">加入志愿表</ie-button>
+            </view>
+        </ie-safe-toolbar>
+    </ie-page>
+</template>
+
+<script setup lang="ts">
+
+import {VOLUNTARY_FORM, VOLUNTARY_MODEL, VOLUNTARY_RESULT} from "@/types/injectionSymbols";
+import {useTransferPage} from "@/hooks/useTransferPage";
+import {VoluntaryDto} from "@/types/voluntary";
+import VoluntaryFormMajor from "@/pagesOther/pages/voluntary/index/components/voluntary-form-major.vue";
+
+const {prevData} = useTransferPage<VoluntaryDto, any>()
+const data = computed(() => prevData.value.data || {})
+const model = computed(() => prevData.value.model || {})
+const result = computed(() => prevData.value.result || {})
+
+const handleSubmit = () => {
+
+}
+
+provide(VOLUNTARY_FORM, data)
+provide(VOLUNTARY_MODEL, model)
+provide(VOLUNTARY_RESULT, result)
+// 为了让子组件触发页面滚动
+onPageScroll(() => {
+})
+</script>
+
+<style lang="scss">
+
+</style>

+ 1 - 1
src/pagesOther/pages/voluntary/index/components/voluntary-form-core.vue

@@ -1,6 +1,6 @@
 <template>
     <view v-if="rulesInit" class="mt-40 flex flex-col gap-30">
-        <view v-for="(r,i) in data.rules" :key="i" class="flex flex-col gap-30">
+        <view v-for="(r,i) in data.rules.filter(i => i.details?.length)" :key="i" class="flex flex-col gap-30">
             <view class="text-32 font-bold">{{ r.category }}</view>
             <uv-form ref="form" :model="model" :rules="rules" label-position="top">
                 <uv-form-item v-for="d in r.details" :key="d.fieldName" :prop="d.fieldName">

+ 7 - 2
src/pagesOther/pages/voluntary/index/components/voluntary-form.vue

@@ -1,7 +1,7 @@
 <template>
     <voluntary-form-major/>
-    <voluntary-form-rule/>
-    <voluntary-form-simulate/>
+    <voluntary-form-rule v-if="!disableRule"/>
+    <voluntary-form-simulate v-if="!disableSimulate"/>
     <voluntary-form-core ref="form"/>
 </template>
 
@@ -11,6 +11,11 @@ import VoluntaryFormRule from "@/pagesOther/pages/voluntary/index/components/vol
 import VoluntaryFormSimulate from "@/pagesOther/pages/voluntary/index/components/voluntary-form-simulate.vue";
 import VoluntaryFormCore from "@/pagesOther/pages/voluntary/index/components/voluntary-form-core.vue";
 
+defineProps({
+    disableRule: Boolean,
+    disableSimulate: Boolean
+})
+
 const form = ref<InstanceType<typeof VoluntaryFormCore> | null>(null)
 const validate = () => {
     return form.value?.validate()

+ 2 - 2
src/pagesOther/pages/voluntary/index/index.vue

@@ -1,6 +1,6 @@
 <template>
     <ie-page bg-color="#F6F8FA">
-        <ie-navbar title="测录取概率" transparent bg-color="#FFFFFF" title-color="black" :keep-title-color="true"/>
+        <ie-navbar title="测录取概率" transparent bg-color="#FFFFFF" title-color="black" keep-title-color/>
         <!-- #ifdef MP-WEIXIN -->
         <view class="h-90 bg-gradient-to-r from-white to-cyan-100"/>
         <!-- #endif -->
@@ -85,7 +85,7 @@ const handleSubmit = async () => {
             cultureRule: "语数外",
             enrollScore: 489,
             skillScore: 259, // 反向测技能分
-            diff: -23 // 负数表示低于skillScore,正数高于
+            diff: 0 // 负数表示低于skillScore,正数高于
         }
     }
     const bigData: VoluntaryDto = {data: data.value, model: model.value, result}

+ 25 - 0
src/pagesOther/pages/voluntary/list/list.vue

@@ -0,0 +1,25 @@
+<template>
+    <ie-page>
+        <z-paging ref="paging" v-model="list" :safe-area-inset-bottom="true" @query="handleQuery">
+            <template #top>
+                <ie-navbar title="志愿表"/>
+                <view class="bg-warning-light p-28 text-20 text-fore-tip">
+                    <text class="font-bold text-fore-title">说明</text>
+                    排序前两个即为第一、二志愿,可以通过修改排序重新选择第一、二志愿
+                </view>
+            </template>
+        </z-paging>
+    </ie-page>
+</template>
+
+<script setup lang="ts">
+const list = ref([])
+
+const handleQuery = async () => {
+
+}
+</script>
+
+<style lang="scss">
+
+</style>

+ 3 - 3
src/pagesOther/pages/voluntary/result/components/voluntary-result-history.vue

@@ -55,7 +55,7 @@ const headerStyle = {
     backgroundColor: '#B2E7FF'
 }
 const cellStyle = {
-    fontSize: '28rpx',
+    fontSize: '26rpx',
     color: 'var(--fore-title)',
     paddingTop: '15rpx',
     paddingBottom: '15rpx'
@@ -66,8 +66,8 @@ const recentHistory = computed(() => _.first(list.value) || {} as VoluntaryResul
 
 const getDiffOpt = (item: VoluntaryResultHistory) => {
     if (item.diff === null || item.diff === undefined) return {text: '-'}
-    if (item.diff < 0) return {clazz: 'text-danger', text: '低' + Math.abs(item.diff) + '分'}
-    if (item.diff > 0) return {clazz: 'text-success', text: '高' + Math.abs(item.diff) + '分'}
+    if (item.diff < 0) return {clazz: 'text-primary', text: '低' + Math.abs(item.diff) + '分'}
+    if (item.diff > 0) return {clazz: 'text-primary', text: '高' + Math.abs(item.diff) + '分'}
     if (item.diff === 0) return {clazz: 'text-primary', text: '持平'}
 }
 </script>

+ 11 - 7
src/pagesOther/pages/voluntary/result/components/voluntary-result-skill.vue

@@ -3,9 +3,8 @@
         <voluntary-result-title title="职业技能分析"/>
         <view class="mt-20 flex flex-col gap-20">
             <view class="flex items-center justify-between gap-20">
-                <view class="flex-1 px-12 py-16 rounded-lg bg-sky-100 text-28 text-fore-title">{{
-                        skill.year
-                    }}录取分:{{ skill.enrollScore }}
+                <view class="flex-1 px-12 py-16 rounded-lg bg-sky-100 text-28 text-fore-title">
+                    {{ skill.year }}录取分:{{ skill.enrollScore }}
                 </view>
                 <view class="flex-1 px-12 py-16 rounded-lg bg-sky-100 text-28 text-fore-title flex items-center">
                     文化素质分
@@ -24,8 +23,8 @@
                         <text class="text-36 text-primary">{{ skill.skillScore }}</text>
                     </view>
-                    <view class="flex items-center gap-5">
-                        <uv-icon :name="passedOption.icon" :color="passedOption.color"/>
+                    <view v-if="passedOption" class="flex items-center gap-5">
+                        <uv-icon :name="passedOption.icon" :color="passedOption.color" size="14"/>
                         <text :class="passedOption.textColor">{{ passedOption.text }}</text>
                     </view>
                 </view>
@@ -47,12 +46,17 @@ const passedOption = computed(() => {
         color: 'error',
         text: '未达成',
         textColor: 'text-danger'
-    } : {
+    } : skill.value.diff > 0 ? {
         icon: 'checkmark-circle-fill',
         color: 'success',
         text: '已达成',
         textColor: 'text-success'
-    }
+    } : skill.value.diff === 0 ? {
+        icon: 'error-circle-fill',
+        color: 'warning',
+        text: '持平',
+        textColor: 'text-warning'
+    } : null
 })
 
 const handleCultureTip = () => {

+ 1 - 1
src/pagesOther/pages/voluntary/result/result.vue

@@ -1,6 +1,6 @@
 <template>
     <ie-page bg-color="#F6F8FA">
-        <ie-navbar title="院校概率分析" transparent bg-color="#FFFFFF" title-color="black" :keep-title-color="true"/>
+        <ie-navbar title="院校概率分析" transparent bg-color="#FFFFFF" title-color="black" keep-title-color/>
         <!-- #ifdef MP-WEIXIN -->
         <view class="h-90" style="background: linear-gradient(to Right, rgba(100, 200, 255, 1), rgba(165, 229, 255, 0.87))"/>
         <!-- #endif -->

+ 6 - 6
src/types/voluntary.ts

@@ -44,13 +44,13 @@ export interface VoluntaryModel extends Record<string, string | number | null> {
 
 export interface VoluntaryResultHistory {
     "year": string | number;
-    "score": string | number;
-    "plan"?: number | null;
-    "enroll"?: number | null;
+    "score": string | number; // 最低分
+    "plan"?: number | null; // 计划人数
+    "enroll"?: number | null; // 录取人数
     "diff"?: number | null; // 负表示低于录取分;正数表示高于录取分
-    "ruleContent"?: string;
-    "application"?: number | null;
-    "admission"?: number | null;
+    "ruleContent"?: string; // 招录规则
+    "application"?: number | null; // 报名人数比值
+    "admission"?: number | null; // 计划人数比值
 }
 
 export interface VoluntaryResultSkill {