Переглянути джерело

test center - holland & mbti list init

abpcoder 1 місяць тому
батько
коміт
276ace615c

+ 4 - 4
src/api/modules/test-center.ts

@@ -1,6 +1,6 @@
 import flyio from "../flyio";
 import {ApiResponse, ApiResponseList} from "@/types";
-import {HollandEntity, HollandRecord} from "@/types/test-center";
+import {HollandEntity, HollandRecord, MbtiEntity, MbtiRecommendMajorCategory, MbtiRecord} from "@/types/test-center";
 
 //  职业兴趣测评 01 测试步骤
 export function hollSteps(params: any) {
@@ -44,15 +44,15 @@ export function mbtiSave(data: any) {
 
 //  职业性格测评 04 测评记录
 export function mbtiRecord(params: any) {
-    return flyio.get('/front/syzy/mbti/record', params)
+    return flyio.get('/front/syzy/mbti/record', params) as Promise<ApiResponseList<MbtiRecord>>
 }
 
 //  职业性格测评 05 测评详情
 export function mbtiDetail(params: any) {
-    return flyio.get('/front/syzy/mbti/record/detail', params)
+    return flyio.get('/front/syzy/mbti/record/detail', params) as Promise<ApiResponse<MbtiEntity>>
 }
 
 // 推荐专业
 export function mbtiRecommendMajors(params: any) {
-    return flyio.get('/front/syzy/mbti/majors', params)
+    return flyio.get('/front/syzy/mbti/majors', params) as Promise<ApiResponse<MbtiRecommendMajorCategory[]>>
 }

+ 1 - 1
src/pagesOther/pages/test-center/list/components/holland-list.vue

@@ -1,6 +1,6 @@
 <template>
     <z-paging ref="paging" v-model="list" bg-color="#F6F8FA" @query="handleQuery">
-        <view class="p-30 fx-col gap-30">
+        <view class="p-24 flex flex-col gap-24">
             <holland-list-item v-for="item in list" :item="item"/>
         </view>
     </z-paging>

+ 44 - 41
src/pagesOther/pages/test-center/list/components/mbti-list-item.vue

@@ -1,64 +1,65 @@
 <template>
     <view class="bg-white mx-card rounded-lg overflow-hidden">
-        <view class="p-30 fx-row fx-bet-cen">
-            <view class="text-main fx-row gap-8">
+        <view class="p-24 flex justify-between items-center">
+            <view class="text-fore-title flex gap-8">
                 <text class="text-orange-400">{{ item.ruleCode }}</text>
             </view>
             <uv-text type="tips" prefix-icon="clock" :text="reportDate" class="!justify-end"/>
         </view>
-        <view class="mx-20 grid grid-cols-4 text-sm mx-grid-border">
-            <view class="fx-row fx-cen-cen py-20">
-                <view class="text-content">外向(E)</view>
-                <view class="text-main">{{ item.scoreE }}</view>
+        <view class="mx-20 grid grid-cols-4 text-sm ie-grid-border">
+            <view class="flex justify-center items-center gap-5 py-20">
+                <view class="text-fore-content">外向(E)</view>
+                <view class="text-fore-title">{{ item.scoreE }}</view>
             </view>
-            <view class="fx-row fx-cen-cen py-20">
-                <view class="text-content">内向(I)</view>
-                <view class="text-main">{{ item.scoreI }}</view>
+            <view class="flex justify-center items-center gap-5 py-20">
+                <view class="text-fore-content">内向(I)</view>
+                <view class="text-fore-title">{{ item.scoreI }}</view>
             </view>
-            <view class="fx-row fx-cen-cen py-20">
-                <view class="text-content">实感(S)</view>
-                <view class="text-main">{{ item.scoreS }}</view>
+            <view class="flex justify-center items-center gap-5 py-20">
+                <view class="text-fore-content">实感(S)</view>
+                <view class="text-fore-title">{{ item.scoreS }}</view>
             </view>
-            <view class="fx-row fx-cen-cen py-20">
-                <view class="text-content">直觉(N)</view>
-                <view class="text-main">{{ item.scoreN }}</view>
+            <view class="flex justify-center items-center gap-5 py-20">
+                <view class="text-fore-content">直觉(N)</view>
+                <view class="text-fore-title">{{ item.scoreN }}</view>
             </view>
-            <view class="fx-row fx-cen-cen py-20">
-                <view class="text-content">思考(T)</view>
-                <view class="text-main">{{ item.scoreT }}</view>
+            <view class="flex justify-center items-center gap-5 py-20">
+                <view class="text-fore-content">思考(T)</view>
+                <view class="text-fore-title">{{ item.scoreT }}</view>
             </view>
-            <view class="fx-row fx-cen-cen py-20">
-                <view class="text-content">情感(F)</view>
-                <view class="text-main">{{ item.scoreF }}</view>
+            <view class="flex justify-center items-center gap-5 py-20">
+                <view class="text-fore-content">情感(F)</view>
+                <view class="text-fore-title">{{ item.scoreF }}</view>
             </view>
-            <view class="fx-row fx-cen-cen py-20">
-                <view class="text-content">判断(J)</view>
-                <view class="text-main">{{ item.scoreJ }}</view>
+            <view class="flex justify-center items-center gap-5 py-20">
+                <view class="text-fore-content">判断(J)</view>
+                <view class="text-fore-title">{{ item.scoreJ }}</view>
             </view>
-            <view class="fx-row fx-cen-cen py-20">
-                <view class="text-content">认知(P)</view>
-                <view class="text-main">{{ item.scoreP }}</view>
+            <view class="flex justify-center items-center gap-5 py-20">
+                <view class="text-fore-content">认知(P)</view>
+                <view class="text-fore-title">{{ item.scoreP }}</view>
             </view>
         </view>
-        <view class="py-20 fx-row justify-center">
-            <mx-tag-button text="查看报告" icon="arrow-right" reverse @click="handleReport"/>
+        <view class="py-20 flex justify-center">
+            <ie-tag-button text="查看报告" icon="arrow-right" reverse @click="handleReport"/>
         </view>
     </view>
 </template>
 
-<script setup>
-import _ from 'lodash'
-import {computed} from 'vue'
-import {createPropDefine} from "@/utils";
-import {useTransfer} from "@/hooks/useTransfer";
+<script setup lang="ts">
+import {routes} from "@/common/routes";
+import {MbtiRecord} from "@/types/test-center";
+import {useTransferPage} from "@/hooks/useTransferPage";
 
-const props = defineProps({
-    item: createPropDefine({}, Object)
+const props = withDefaults(defineProps<{
+    item: MbtiRecord
+}>(), {
+    item: () => ({} as MbtiRecord)
 })
 
-const {transferTo} = useTransfer()
+const {transferTo} = useTransferPage()
 
-const map = {
+const map: Record<string, string> = {
     R: '现实型',
     A: '艺术型',
     I: '研究型',
@@ -67,15 +68,17 @@ const map = {
     C: '传统型'
 }
 
-const typeName = computed(() => map[_.first(props.item.ruleCode)] || '')
+const typeName = computed(() => map[props.item.ruleCode ? props.item.ruleCode[0] : ''])
 const reportDate = computed(() => getDateStr(props.item.createTime))
 
-const getDateStr = (str) => {
+const getDateStr = (str: string) => {
     return str.substring(0, 10)
 }
 
 const handleReport = () => {
-    transferTo('/pagesOther/pages/test-center/mbti/mbti', {code: props.item.code})
+    transferTo(routes.pageMbti, {
+        data: {code: props.item.code}
+    })
 }
 </script>
 

+ 10 - 10
src/pagesOther/pages/test-center/list/components/mbti-list.vue

@@ -1,23 +1,23 @@
 <template>
-    <z-paging ref="paging" v-model="list" @query="handleQuery">
-        <view class="p-30 fx-col gap-30">
+    <z-paging ref="paging" v-model="list" bg-color="#F6F8FA" @query="handleQuery">
+        <view class="p-24 flex flex-col gap-24">
             <mbti-list-item v-for="item in list" :item="item"/>
         </view>
     </z-paging>
 </template>
 
-<script setup>
-import {ref} from 'vue'
-import {mbtiRecord} from "@/api/webApi/career-course";
+<script setup lang="ts">
+import {MbtiRecord} from "@/types/test-center";
+import {mbtiRecord} from "@/api/modules/test-center";
 import MbtiListItem from "@/pagesOther/pages/test-center/list/components/mbti-list-item.vue";
 
-const list = ref([])
-const paging = ref(null)
+const list = ref<MbtiRecord[]>([])
+const paging = ref<ZPagingInstance>()
 
-const handleQuery = (pageNum, pageSize) => {
+const handleQuery = (pageNum: number, pageSize: number) => {
     mbtiRecord({pageNum, pageSize})
-        .then(res => paging.value.completeByTotal(res.rows, res.total))
-        .catch(e => paging.value.complete(false))
+        .then(res => paging.value?.completeByTotal(res.rows, res.total))
+        .catch(e => paging.value?.complete(false))
 }
 </script>
 

+ 2 - 2
src/pagesOther/pages/test-center/list/list.vue

@@ -7,7 +7,7 @@
                     <holland-list />
                 </template>
                 <template #mbti>
-<!--                    <mbti-list/>-->
+                    <mbti-list/>
                 </template>
             </ie-tabs-swiper>
         </ie-auto-resizer>
@@ -19,7 +19,7 @@ import _ from "lodash";
 import {SwiperTabItem} from "@/types";
 import {useTransferPage} from "@/hooks/useTransferPage";
 import HollandList from "@/pagesOther/pages/test-center/list/components/holland-list.vue";
-// import MbtiList from "@/pagesOther/pages/test-center/list/components/mbti-list.vue";
+import MbtiList from "@/pagesOther/pages/test-center/list/components/mbti-list.vue";
 
 const {prevData} = useTransferPage()
 const current = ref(0);

+ 112 - 2
src/types/test-center.ts

@@ -21,14 +21,124 @@ export interface HollandRecord {
 }
 
 export interface HollandRule {
-
+    "createBy": string | null;
+    "createTime": string | null;
+    "updateBy": string | null;
+    "updateTime": string | null;
+    "remark": string | null;
+    "id": number;
+    "code": string;
+    "jobs": string;
+    "marjors": string;  // '多个用、号分隔'
+    "status": number;
 }
 
 export interface HollandDetail {
-
+    "createBy": string | null;
+    "createTime": string | null;
+    "updateBy": string | null;
+    "updateTime": string | null;
+    "remark": string | null;
+    "id": number;
+    "customerCode": string;
+    "recordCode": string;
+    "stepId": number;
+    "stepTitle": string;
+    "questionId": number;
+    "ruleCode": string;
+    "questionTitle": string;
+    "answer": string;
+    "options": string[];
+    "status": number;
 }
 
 export interface HollandEntity extends HollandRecord {
     rule: HollandRule;
     details: HollandDetail[];
+}
+
+export interface MbtiRecord {
+    "createBy": string | null;
+    "createTime": string;
+    "updateBy": string | null;
+    "updateTime": string | null;
+    "remark": string | null;
+    "id": number;
+    "customerCode": string;
+    "code": string;
+    "ruleCode": string;
+    "scoreE": number;
+    "scoreI": number;
+    "scoreS": number;
+    "scoreN": number;
+    "scoreT": number;
+    "scoreF": number;
+    "scoreJ": number;
+    "scoreP": number;
+    "status": number;
+}
+
+export interface MbtiRule {
+    "createBy": string | null;
+    "createTime": string | null;
+    "updateBy": string | null;
+    "updateTime": string | null;
+    "remark": string | null;
+    "id": number;
+    "code": string;
+    "name": string | null;
+    "title": string;
+    "status": number;
+}
+
+export interface MbtiDetail {
+    "createBy": string | null;
+    "createTime": string | null;
+    "updateBy": string | null;
+    "updateTime": string | null;
+    "remark": string | null;
+    "id": number;
+    "customerCode": string;
+    "recordCode": string;
+    "stepId": number;
+    "stepTitle": string;
+    "questionId": number;
+    "questionTitle": string;
+    "optionA": string;
+    "optionB": string;
+    "valueA": string;
+    "valueB": string;
+    "answer": string;
+    "status": number;
+}
+
+export interface MbtiEntity extends MbtiRecord {
+    "rule": MbtiRule;
+    "details": MbtiDetail[]
+}
+
+export interface MbtiRecommendMajor {
+    "createBy": string | null;
+    "createTime": string | null;
+    "updateBy": string | null;
+    "updateTime": string | null;
+    "remark": string | null;
+    "id": number;
+    "code": string | null;
+    "category": string | null;
+    "major": string | null;
+    "majors": string | null;
+}
+
+export interface MbtiRecommendMajorCategory {
+    "createBy": string | null;
+    "createTime": string | null;
+    "updateBy": string | null;
+    "updateTime": string | null;
+    "remark": string | null;
+    "id": number;
+    "code": string | null;
+    "category": string;
+    "major": string | null;
+    "majors": MbtiRecommendMajor[];
 }