|
|
@@ -33,41 +33,30 @@
|
|
|
</view>
|
|
|
</ie-safe-toolbar>
|
|
|
</ie-page>
|
|
|
- <!-- #ifdef H5 -->
|
|
|
- <teleport to="body">
|
|
|
- <!-- #endif -->
|
|
|
- <!-- #ifdef MP-WEIXIN -->
|
|
|
- <root-portal externalClass="theme-ie">
|
|
|
- <!-- #endif -->
|
|
|
- <uv-popup ref="popupRef" mode="bottom" :round="16" popup-class="theme-ie" :close-on-click-overlay="false">
|
|
|
- <ie-popup-toolbar title="选择专业" @cancel="handleCancel" @confirm="handleConfirm" />
|
|
|
- <view class="h-[50vh] bg-white px-30 pt-20 flex flex-col">
|
|
|
- <view>
|
|
|
- <uv-search v-model="keyword" shape="square" :showAction="false" placeholder="请输入专业名称" />
|
|
|
- </view>
|
|
|
- <view class="mt-20 flex-1 min-h-1">
|
|
|
- <scroll-view scroll-y class="h-full">
|
|
|
- <view v-for="item in filteredMajorList" :key="item.id"
|
|
|
- class="px-20 py-16 bg-white sibling-border-top flex items-center" @click="handleSelect(item)">
|
|
|
- <view class="flex-1 min-w-1 flex-shrink-0">
|
|
|
- <view class="text-30 text-fore-title" :class="[isActive(item) ? 'text-primary' : 'text-fore-title']">
|
|
|
- {{ item.name }}
|
|
|
- </view>
|
|
|
- <view class="mt-6 text-22 text-fore-light"
|
|
|
- :class="[isActive(item) ? 'text-primary' : 'text-fore-light']">{{ item.ancestors }}</view>
|
|
|
- </view>
|
|
|
- <uv-icon v-if="isActive(item)" name="checkmark" size="20" color="#31A0FC" />
|
|
|
+ <ie-popup ref="popupRef" title="选择专业" @confirm="handleConfirm">
|
|
|
+ <view class="h-[50vh] bg-white px-30 pt-20 flex flex-col">
|
|
|
+ <view>
|
|
|
+ <uv-search v-model="keyword" shape="square" :showAction="false" placeholder="请输入专业名称" />
|
|
|
+ </view>
|
|
|
+ <view class="mt-20 flex-1 min-h-1">
|
|
|
+ <scroll-view scroll-y class="h-full">
|
|
|
+ <view v-for="item in filteredMajorList" :key="item.id"
|
|
|
+ class="px-20 py-16 bg-white sibling-border-top flex items-center gap-x-20" @click="handleSelect(item)">
|
|
|
+ <view class="flex-1 min-w-1 flex-shrink-0">
|
|
|
+ <view class="flex items-center gap-x-10 text-fore-title">
|
|
|
+ <span class="text-30 " :class="[isActive(item) ? 'text-primary' : 'text-fore-title']">{{ item.name }}</span>
|
|
|
+ <span v-if="item.notice" class="text-22 text-fore-light flex-1 min-w-1 ellipsis-1" :class="[isActive(item) ? 'text-primary' : 'text-fore-title']">{{ `(${item.notice})` }}</span>
|
|
|
</view>
|
|
|
- </scroll-view>
|
|
|
+ <view class="mt-6 text-22 text-fore-light" :class="[isActive(item) ? 'text-primary' : 'text-fore-light']">
|
|
|
+ {{
|
|
|
+ item.ancestors }}</view>
|
|
|
+ </view>
|
|
|
+ <uv-icon v-if="isActive(item)" name="checkmark" size="20" color="#31A0FC" />
|
|
|
</view>
|
|
|
- </view>
|
|
|
- </uv-popup>
|
|
|
- <!-- #ifdef MP-WEIXIN -->
|
|
|
- </root-portal>
|
|
|
- <!-- #endif -->
|
|
|
- <!-- #ifdef H5 -->
|
|
|
- </teleport>
|
|
|
- <!-- #endif -->
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </ie-popup>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
@@ -112,18 +101,26 @@ const handleUniversitySelect = () => {
|
|
|
}
|
|
|
|
|
|
const popupRef = ref();
|
|
|
-const selectedMajor = ref<UniversityMajor | null>(null);
|
|
|
+const selectedMajor = ref<Pick<UniversityMajor, 'ancestors' | 'code' | 'id' | 'name'> | null>(null);
|
|
|
const handleMajorSelect = () => {
|
|
|
if (!form.value.universityId) {
|
|
|
uni.$ie.showToast('请选择院校');
|
|
|
return;
|
|
|
}
|
|
|
keyword.value = '';
|
|
|
+ if (form.value.majorId) {
|
|
|
+ selectedMajor.value = {
|
|
|
+ ancestors: form.value.majorAncestors || '',
|
|
|
+ code: form.value.majorId || '',
|
|
|
+ id: Number(form.value.majorId),
|
|
|
+ name: form.value.majorName || ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedMajor.value = null;
|
|
|
+ }
|
|
|
popupRef.value.open();
|
|
|
}
|
|
|
-const handleCancel = () => {
|
|
|
- popupRef.value.close();
|
|
|
-}
|
|
|
+
|
|
|
const handleConfirm = () => {
|
|
|
if (!selectedMajor.value) {
|
|
|
uni.$ie.showToast('请选择专业');
|
|
|
@@ -134,7 +131,7 @@ const handleConfirm = () => {
|
|
|
form.value.majorName = selectedMajor.value.name;
|
|
|
popupRef.value.close();
|
|
|
}
|
|
|
-const handleSelect = (item: any) => {
|
|
|
+const handleSelect = (item: UniversityMajor) => {
|
|
|
selectedMajor.value = item;
|
|
|
}
|
|
|
|