abpcoder 5 hodín pred
rodič
commit
30799d7d01

+ 5 - 1
src/api/modules/university.ts

@@ -1,6 +1,6 @@
 import { ApiResponse, ApiResponseList } from "@/types";
 import flyio from "../flyio";
-import { University, UniversityDetail, UniversityFilter, UniversityTier } from "@/types/university";
+import {University, UniversityDetail, UniversityFilter, UniversityStyle, UniversityTier} from "@/types/university";
 import { Major } from "@/types";
 // import {sleep} from "@/uni_modules/uv-ui-tools/libs/function";
 
@@ -440,6 +440,10 @@ export function universityDetail(params: any) {
   return flyio.get('/front/university/detail', params) as Promise<ApiResponse<UniversityDetail>>
 }
 
+export function getUniversitiesStyle(params: any) {
+  return flyio.get('/front/university/getUniversitiesStyle', params) as Promise<ApiResponse<UniversityStyle[]>>
+}
+
 /**
  * 获取院校列表
  * @param params

+ 23 - 1
src/pagesOther/pages/university/detail/components/college-profile.vue

@@ -14,6 +14,19 @@
                 <text class="text-primary">招生电话</text>
             </view>
         </view>
+        <view v-if="baseInfo.images?.length" class="mt-30">
+            <view class="flex justify-between items-center">
+                <view class="text-32 font-bold text-fore-title">院校风采</view>
+                <view class="flex items-center text-24 text-fore-tip" @click="handlePreview(4)">
+                    查看更多
+                    <uv-icon name="arrow-right" color="info"/>
+                </view>
+            </view>
+            <view class="mt-28 grid grid-cols-2 gap-28">
+                <ie-image v-for="(item,i) in baseInfo.images.slice(0,4)" :key="i" :src="item.url" mode="aspectFill" :round="6"
+                          custom-class="w-335 h-200" @click="handlePreview(i)" />
+            </view>
+        </view>
         <view class="mt-30">
             <view class="text-32 font-bold text-fore-title">开设专业</view>
             <uv-gap v-if="loading" height="15"/>
@@ -35,7 +48,7 @@
                 <scroll-view scroll-y :style="{maxHeight: '50vh', backgroundColor: 'var(--back-light)'}">
                     <uv-cell-group v-for="(g,i) in popupGroup.subGroups" :key="i" title="1">
                         <template #title>
-                            <text class="text-24 text-fore-tip">{{g.parent.name}}</text>
+                            <text class="text-24 text-fore-tip">{{ g.parent.name }}</text>
                         </template>
                         <uv-cell v-for="p in g.list" :title="p.name" custom-class="bg-white"/>
                     </uv-cell-group>
@@ -201,6 +214,15 @@ const handlePhone = () => {
     }
 }
 
+const handlePreview = (index: number) => {
+    if (!baseInfo.value.images?.length) return
+    uni.previewImage({
+        urls: baseInfo.value.images.map(i => i.url),
+        current: index,
+        indicator: "number"
+    })
+}
+
 const handleActionSelect = (e: ActionItem) => {
     if (e.id == 'call') {
         uni.makePhoneCall({phoneNumber: baseInfo.value.tel})

+ 8 - 2
src/pagesOther/pages/university/detail/detail.vue

@@ -34,7 +34,7 @@
 import {useTransferPage} from "@/hooks/useTransferPage";
 import {UniversityDetail, University} from "@/types/university";
 import {MajorItem} from "@/types/major";
-import {universityDetail} from "@/api/modules/university";
+import {getUniversitiesStyle, universityDetail} from "@/api/modules/university";
 import {getMajorTree} from "@/api/modules/major";
 import CollegeInfo from "@/pagesOther/pages/university/detail/components/college-info.vue";
 import {SwiperTabItem} from "@/types";
@@ -91,9 +91,15 @@ onMounted(() => {
     universityDetail({code: prevData.value.code})
         .then(res => {
             detail.value = res.data
+            return getUniversitiesStyle({code: prevData.value.code})
+        })
+        .then(res => {
+            baseInfo.value.images = res.data
             return getMajorTree({})
         })
-        .then(res => majorTree.value = res.data)
+        .then(res => {
+            majorTree.value = res.data
+        })
         .finally(() => {
             uni.$ie.hideLoading()
             loading.value = false

+ 114 - 95
src/types/university.ts

@@ -1,73 +1,75 @@
-import { EnumBrochureType } from "@/common/enum";
+import {EnumBrochureType} from "@/common/enum";
 
 export interface University {
-  bannerUrl: string;
-  address: string;
-  area: string | number;
-  bxLevel: string;
-  bxType: string; // 现在似乎没有值
-  cityName: string;
-  code: string;
-  collect: string | number;
-  collected: boolean;
-  comScore: string | number;
-  enrollLocation: string;
-  features: string;
-  hits: number;
-  id: number;
-  location: string;
-  logo: string;
-  name: string;
-  natureTypeCN: string;
-  star: string;
-  type: string;
-  webSite: string;
-  tier: string;
-  tierName: string;
-  introduction: string;
-  tel: string;
+    bannerUrl: string;
+    address: string;
+    area: string | number;
+    bxLevel: string;
+    bxType: string; // 现在似乎没有值
+    cityName: string;
+    code: string;
+    collect: string | number;
+    collected: boolean;
+    comScore: string | number;
+    enrollLocation: string;
+    features: string;
+    hits: number;
+    id: number;
+    location: string;
+    logo: string;
+    name: string;
+    natureTypeCN: string;
+    star: string;
+    type: string;
+    webSite: string;
+    tier: string;
+    tierName: string;
+    introduction: string;
+    tel: string;
+    
+    images?: UniversityStyle[]; 
 }
 
 export interface UniversityProfession {
-  "remark": string;
-  "id": string | number;
-  "collegeCode": string;
-  "type": string;
-  "code": string;
-  "name": string;
-  "ranking": number | null;
-  "count": number | null;
-  "hot": number | null;
-  "examType": string;
-  "enrollCode": string;
-  "majorDirection": string;
+    "remark": string;
+    "id": string | number;
+    "collegeCode": string;
+    "type": string;
+    "code": string;
+    "name": string;
+    "ranking": number | null;
+    "count": number | null;
+    "hot": number | null;
+    "examType": string;
+    "enrollCode": string;
+    "majorDirection": string;
 }
 
 export interface UniversityBrochure {
-  "createBy": string;
-  "createTime": string;
-  "updateBy": string;
-  "updateTime": string;
-  "remark": string;
-  "id": number;
-  "year": string;
-  "collegeCode": string;
-  "collegeName": string;
-  "editor": string;
-  "url": string;
-  "summary": string;
-  "title": string;
-  "isArt": boolean | null;
-  "type": EnumBrochureType;
-  "metaDescription": string;
-  "content": string;
-  "tags": string;
-  "isShow": number;
-  "hits": number;
-  "createTime2": string;
-  "typeName": string;
+    "createBy": string;
+    "createTime": string;
+    "updateBy": string;
+    "updateTime": string;
+    "remark": string;
+    "id": number;
+    "year": string;
+    "collegeCode": string;
+    "collegeName": string;
+    "editor": string;
+    "url": string;
+    "summary": string;
+    "title": string;
+    "isArt": boolean | null;
+    "type": EnumBrochureType;
+    "metaDescription": string;
+    "content": string;
+    "tags": string;
+    "isShow": number;
+    "hits": number;
+    "createTime2": string;
+    "typeName": string;
 
-  "logo"?: string;
+    "logo"?: string;
 }
 
 export type HistoryMode = 'plan' | 'enroll';
@@ -88,63 +90,80 @@ export interface IPlanEnrollHistory {
 }
 
 export interface UniversityPlanHistory extends IPlanEnrollHistory {
-    "planNum": number|null;
+    "planNum": number | null;
     "fee": string;
     "xueZhi": string;
     "acceptanceRate": string;
 }
 
 export interface UniversityEnrollHistory extends IPlanEnrollHistory {
-    "minScore": number|null;
-    "minSeat": number|null;
-    "realNum": number|null;
+    "minScore": number | null;
+    "minSeat": number | null;
+    "realNum": number | null;
 }
 
 export interface IPlanEnrollDescriptor {
     prop?: string;
     title?: string;
-    value?: string|number;
+    value?: string | number;
     titleOnly?: boolean;
 }
 
 export interface UniversityDetail {
-  baseInfo: University;
-  enrollBrochures: UniversityBrochure[];
-  enrollHistories: [];
-  planHistories: [];
-  professions: UniversityProfession[];
+    baseInfo: University;
+    enrollBrochures: UniversityBrochure[];
+    enrollHistories: [];
+    planHistories: [];
+    professions: UniversityProfession[];
+}
+
+export interface UniversityStyle {
+    "searchValue": string;
+    "createBy": string;
+    "createTime": string;
+    "updateBy": string;
+    "updateTime": string;
+    "remark": string;
+    "id": string;
+    "collegeCode": string;
+    "description": string;
+    "isBanner": boolean | null;
+    "url": string;
+    "type": string | number;
+    "coverUrl": string;
+    "sort": number;
 }
 
 export interface UniversityQueryDto {
-  name: string;
-  features: string[];
-  type: string[];
-  natureTypeCN: string[];
-  location: string[];
-  level: string[];
-  tier: string[];
+    name: string;
+    features: string[];
+    type: string[];
+    natureTypeCN: string[];
+    location: string[];
+    level: string[];
+    tier: string[];
 }
 
 export interface UniversityTier {
-  typeName: string;
-  typeValue: string | number;
-  desc: string;
-  list: University[];
+    typeName: string;
+    typeValue: string | number;
+    desc: string;
+    list: University[];
 
-  /*UI props begin 后台不用管*/
-  colorFrom?: string;
-  colorTo?: string;
-  colorText?: string;
-  icon?: string;
-  /*UI props end*/
+    /*UI props begin 后台不用管*/
+    colorFrom?: string;
+    colorTo?: string;
+    colorText?: string;
+    icon?: string;
+    /*UI props end*/
 }
 
 export interface UniversityFilter {
-  features: string[];
-  types: string[];
-  natureTypes: string[];
-  bxTypes: string[];
-  locations: string[];
-  tiers: Record<number, string>;
-  stars: Record<number, string>;
+    features: string[];
+    types: string[];
+    natureTypes: string[];
+    bxTypes: string[];
+    locations: string[];
+    tiers: Record<number, string>;
+    stars: Record<number, string>;
 }