فهرست منبع

vhs - form init

abpcoder 4 هفته پیش
والد
کامیت
1d4e9c15c9

+ 3 - 6
src/pagesOther/components/ie-condition-dropdown/ie-condition-dropdown-popup.vue

@@ -3,14 +3,10 @@
         <scroll-view scroll-y style="max-height: 35vh;">
         <scroll-view scroll-y style="max-height: 35vh;">
             <view class="w-screen px-30 py-10 box-border ie-condition-group" @touchmove.stop>
             <view class="w-screen px-30 py-10 box-border ie-condition-group" @touchmove.stop>
                 <uv-checkbox-group v-if="multiple" v-model="model[config.key]" placement="column" icon-placement="right">
                 <uv-checkbox-group v-if="multiple" v-model="model[config.key]" placement="column" icon-placement="right">
-                    <uv-checkbox v-for="i in list" :name="getValue(i)" :label="getLabel(i)" custom-style="padding-top: 20rpx;
-            padding-bottom: 20rpx;
-            border-bottom: 0.5px solid var(--border);"/>
+                    <uv-checkbox v-for="i in list" :name="getValue(i)" :label="getLabel(i)" :custom-style="optionStyle"/>
                 </uv-checkbox-group>
                 </uv-checkbox-group>
                 <uv-radio-group v-else v-model="model[config.key]" placement="column" icon-placement="right">
                 <uv-radio-group v-else v-model="model[config.key]" placement="column" icon-placement="right">
-                    <uv-radio v-for="i in list" :name="getValue(i)" :label="getLabel(i)" custom-style="padding-top: 20rpx;
-            padding-bottom: 20rpx;
-            border-bottom: 0.5px solid var(--border);"/>
+                    <uv-radio v-for="i in list" :name="getValue(i)" :label="getLabel(i)" :custom-style="optionStyle"/>
                 </uv-radio-group>
                 </uv-radio-group>
             </view>
             </view>
         </scroll-view>
         </scroll-view>
@@ -44,6 +40,7 @@ const condition = ref(null)
 const list = computed(() => condition.value?.list || [])
 const list = computed(() => condition.value?.list || [])
 const config = computed(() => condition.value?.config || {})
 const config = computed(() => condition.value?.config || {})
 const multiple = computed(() => config.value?.multiple)
 const multiple = computed(() => config.value?.multiple)
+const optionStyle = 'padding-top: 20rpx;padding-bottom: 20rpx;border-bottom: 0.5px solid var(--border);'
 
 
 const right = computed(() => {
 const right = computed(() => {
     if (!multiple.value) return '确定'
     if (!multiple.value) return '确定'

+ 18 - 0
src/pagesOther/components/vip-guide-more/vip-guide-more.vue

@@ -0,0 +1,18 @@
+<template>
+    <view class="fx-row fx-cen-cen">
+        <ie-image src="/nomore_unless_vip.png" is-oss @click="goBuyVip"/>
+    </view>
+</template>
+
+<script setup>
+import {OPEN_VIP_POPUP} from "@/types/injectionSymbols";
+
+const openVipPopup = inject(OPEN_VIP_POPUP);
+const goBuyVip = () => {
+    openVipPopup?.()
+}
+</script>
+
+<style scoped>
+
+</style>

+ 7 - 3
src/pagesOther/pages/vhs/hooks/useVoluntaryAssistantInjection.js

@@ -3,6 +3,7 @@ import {sleep} from "@/uni_modules/uv-ui-tools/libs/function";
 import {empty} from "@/uni_modules/uv-ui-tools/libs/function/test";
 import {empty} from "@/uni_modules/uv-ui-tools/libs/function/test";
 import {recommendMajorSortFn} from "@/utils/common";
 import {recommendMajorSortFn} from "@/utils/common";
 import {saveZhiyuan} from "@/api/modules/vhs";
 import {saveZhiyuan} from "@/api/modules/vhs";
+import {useTransferPage} from "@/hooks/useTransferPage";
 
 
 const key = Symbol('VOLUNTARY_ASSISTANT')
 const key = Symbol('VOLUNTARY_ASSISTANT')
 export const useProvideVoluntaryAssistant = function (stepSvc, dataSvc, formSvc, cartSvc, highlightSvc) {
 export const useProvideVoluntaryAssistant = function (stepSvc, dataSvc, formSvc, cartSvc, highlightSvc) {
@@ -12,6 +13,7 @@ export const useProvideVoluntaryAssistant = function (stepSvc, dataSvc, formSvc,
     const {voluntaryData} = dataSvc
     const {voluntaryData} = dataSvc
     const {batch, model, mode, batchesList} = formSvc
     const {batch, model, mode, batchesList} = formSvc
     const {formedMajors, resetHighlight} = highlightSvc
     const {formedMajors, resetHighlight} = highlightSvc
+    const {transferBack} = useTransferPage()
     const beforeBack = createEventHook()
     const beforeBack = createEventHook()
     const afterBack = createEventHook()
     const afterBack = createEventHook()
     const beforeForward = createEventHook()
     const beforeForward = createEventHook()
@@ -19,7 +21,9 @@ export const useProvideVoluntaryAssistant = function (stepSvc, dataSvc, formSvc,
     const complete = createEventHook()
     const complete = createEventHook()
 
 
     const handleBack = async function () {
     const handleBack = async function () {
-        if (currentStep.value == 0) return
+        if (currentStep.value == 0) {
+            return transferBack()
+        }
         await beforeBack.trigger()
         await beforeBack.trigger()
         currentStep.value -= 1
         currentStep.value -= 1
         await afterBack.trigger()
         await afterBack.trigger()
@@ -35,8 +39,8 @@ export const useProvideVoluntaryAssistant = function (stepSvc, dataSvc, formSvc,
     const navBinding = computed(() => ({
     const navBinding = computed(() => ({
         title: title.value,
         title: title.value,
         subTitle: name.value,
         subTitle: name.value,
-        leftIcon: currentStep.value > 0 ? 'arrow-left' : '',
-        onLeftClick: handleBack
+        // leftIcon: currentStep.value > 0 ? 'arrow-left' : '',
+        // onLeftClick: handleBack
     }))
     }))
 
 
     const voluntaryDataCalculate = computed(() => {
     const voluntaryDataCalculate = computed(() => {

+ 13 - 11
src/pagesOther/pages/vhs/index/components/cart-step.vue

@@ -1,5 +1,6 @@
 <template>
 <template>
-    <z-paging ref="paging" v-model="list" :auto="false" auto-show-system-loading @query="handleQuery">
+    <z-paging ref="paging" v-model="list" :auto="false" bg-color="#F6F8FA" safe-area-inset-bottom
+              auto-show-system-loading @query="handleQuery">
         <template #top>
         <template #top>
             <slot name="top"/>
             <slot name="top"/>
             <ie-condition-dropdown ref="dropdown" x layout="flex items-center gap-20 w-max"/>
             <ie-condition-dropdown ref="dropdown" x layout="flex items-center gap-20 w-max"/>
@@ -7,17 +8,17 @@
         <voluntary-search @search="handleSearch"/>
         <voluntary-search @search="handleSearch"/>
         <view class="flex flex-col p-20 gap-20">
         <view class="flex flex-col p-20 gap-20">
             <voluntary-item v-for="item in list" :item="item" @major="openMajorPopup(item)" @notify="showNotify"/>
             <voluntary-item v-for="item in list" :item="item" @major="openMajorPopup(item)" @notify="showNotify"/>
-<!--            <vip-guide-more v-if="isNotVip"/>-->
+            <vip-guide-more v-if="isNotVip"/>
         </view>
         </view>
         <template #bottom>
         <template #bottom>
-<!--            <voluntary-bottom @modify="$refs.modifyPopup.open()" @cart="$refs.cartPopup.open()"/>-->
+            <voluntary-bottom @modify="$refs.modifyPopup.open()" @cart="$refs.cartPopup.open()"/>
         </template>
         </template>
     </z-paging>
     </z-paging>
     <!--  这里渲染的弹窗不会被back-to-top遮挡  -->
     <!--  这里渲染的弹窗不会被back-to-top遮挡  -->
-<!--    <score-batch-popup ref="modifyPopup"/>-->
-<!--    <voluntary-cart-popup ref="cartPopup"/>-->
-<!--    <major-popup ref="majorPopup" @notify="showNotify"/>-->
-<!--    <uv-notify ref="notifier"/>-->
+    <score-batch-popup ref="modifyPopup"/>
+    <voluntary-cart-popup ref="cartPopup"/>
+    <major-popup ref="majorPopup" @notify="showNotify"/>
+    <uv-notify ref="notifier"/>
 </template>
 </template>
 
 
 <script setup>
 <script setup>
@@ -25,10 +26,11 @@ import {sleep} from "@/uni_modules/uv-ui-tools/libs/function";
 import {useUserStore} from "@/store/userStore";
 import {useUserStore} from "@/store/userStore";
 import VoluntaryItem from "@/pagesOther/pages/vhs/index/components/voluntary-item.vue";
 import VoluntaryItem from "@/pagesOther/pages/vhs/index/components/voluntary-item.vue";
 import IeConditionDropdown from "@/pagesOther/components/ie-condition-dropdown/ie-condition-dropdown.vue";
 import IeConditionDropdown from "@/pagesOther/components/ie-condition-dropdown/ie-condition-dropdown.vue";
-// import VoluntaryBottom from "@/pagesOther/pages/vhs/index/components/voluntary-bottom.vue";
-// import MajorPopup from "@/pagesOther/pages/vhs/index/components/major-popup.vue";
-// import ScoreBatchPopup from "@/pagesOther/pages/vhs/index/components/score-batch-popup.vue";
-// import VoluntaryCartPopup from "@/pagesOther/pages/vhs/index/components/voluntary-cart-popup.vue";
+import VipGuideMore from "@/pagesOther/components/vip-guide-more/vip-guide-more.vue";
+import VoluntaryBottom from "@/pagesOther/pages/vhs/index/components/voluntary-bottom.vue";
+import MajorPopup from "@/pagesOther/pages/vhs/index/components/major-popup.vue";
+import ScoreBatchPopup from "@/pagesOther/pages/vhs/index/components/score-batch-popup.vue";
+import VoluntaryCartPopup from "@/pagesOther/pages/vhs/index/components/voluntary-cart-popup.vue";
 import VoluntarySearch from "@/pagesOther/pages/vhs/index/components/voluntary-search.vue";
 import VoluntarySearch from "@/pagesOther/pages/vhs/index/components/voluntary-search.vue";
 import {useInjectVoluntaryForm} from "@/pagesOther/pages/vhs/hooks/useVoluntaryFormInjection";
 import {useInjectVoluntaryForm} from "@/pagesOther/pages/vhs/hooks/useVoluntaryFormInjection";
 import {useInjectVoluntaryStep} from "@/pagesOther/pages/vhs/hooks/useVoluntaryStepInjection";
 import {useInjectVoluntaryStep} from "@/pagesOther/pages/vhs/hooks/useVoluntaryStepInjection";

+ 12 - 14
src/pagesOther/pages/vhs/index/components/major-popup.vue

@@ -1,13 +1,13 @@
 <template>
 <template>
     <uv-popup ref="popup" mode="bottom" closeable round="16" @change="handleChange">
     <uv-popup ref="popup" mode="bottom" closeable round="16" @change="handleChange">
-        <view class="h-[50px] fx-row fx-cen-cen text-lg text-main font-bold">
-            {{ group.university.name }}
+        <view class="h-100 flex justify-center items-center text-lg text-main font-bold">
+            {{ group.university?.name }}
         </view>
         </view>
         <scroll-view scroll-y class="bg-bg" style="height: 50vh" lower-threshold="100"
         <scroll-view scroll-y class="bg-bg" style="height: 50vh" lower-threshold="100"
                      @scrolltolower="handleMajorScroll">
                      @scrolltolower="handleMajorScroll">
             <view class="p-30">
             <view class="p-30">
-                <view v-for="item in pagedMajors" class="fx-col">
-                    <view class="fx-row fx-bet-cen">
+                <view v-for="item in pagedMajors" class="flex flex-col">
+                    <view class="flex justify-between items-center">
                         <view class="flex-1 fx-row items-center">
                         <view class="flex-1 fx-row items-center">
                             <text :class="{'highlight-major': isSearchingMajorFired(item)}">
                             <text :class="{'highlight-major': isSearchingMajorFired(item)}">
                                 {{ item.marjorName }}
                                 {{ item.marjorName }}
@@ -24,7 +24,7 @@
                         {{ item.professionType }}
                         {{ item.professionType }}
                         {{ item.typeNames }}
                         {{ item.typeNames }}
                     </view>
                     </view>
-                    <view class="fx-row fx-sta-cen text-2xs mb-10">
+                    <view class="flex justify-start items-center text-2xs mb-10">
                         <text class="text-content mr-10">录取概率</text>
                         <text class="text-content mr-10">录取概率</text>
                         <text class="text-sm font-bold">{{ item.enrollRatio || '-' }}</text>
                         <text class="text-sm font-bold">{{ item.enrollRatio || '-' }}</text>
                         %
                         %
@@ -51,15 +51,13 @@
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import {ref, computed} from 'vue';
-import MxConst from "@/common/MxConst";
 import {createPropDefine} from "@/utils";
 import {createPropDefine} from "@/utils";
-import {toValue} from "@vueuse/core";
-import VoluntaryHistoryList from "@/pagesOther/pages/voluntary/index/components/voluntary-history-list.vue";
-import {useInjectVoluntaryHeader} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryHeaderInjection";
-import {useInjectVoluntaryMajorHighlight} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryMajorHighlightInjection";
-import {useInjectVoluntaryAssistant} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryAssistantInjection";
-import {useInjectVoluntaryCart} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryCartInjection";
+import {SimulatePickTypes} from "@/utils/common";
+import VoluntaryHistoryList from "@/pagesOther/pages/vhs/index/components/voluntary-history-list.vue";
+import {useInjectVoluntaryHeader} from "@/pagesOther/pages/vhs/hooks/useVoluntaryHeaderInjection";
+import {useInjectVoluntaryMajorHighlight} from "@/pagesOther/pages/vhs/hooks/useVoluntaryMajorHighlightInjection";
+import {useInjectVoluntaryAssistant} from "@/pagesOther/pages/vhs/hooks/useVoluntaryAssistantInjection";
+import {useInjectVoluntaryCart} from "@/pagesOther/pages/vhs/hooks/useVoluntaryCartInjection";
 
 
 const props = defineProps({
 const props = defineProps({
     readonly: createPropDefine(false, Boolean)
     readonly: createPropDefine(false, Boolean)
@@ -96,7 +94,7 @@ const formatXueZhi = (val) => {
 }
 }
 
 
 const getPickTypeColor = (pickType) => {
 const getPickTypeColor = (pickType) => {
-    return MxConst.enum.simulatePickTypes.find(t => t.value == pickType)?.color || ''
+    return SimulatePickTypes.find(t => t.value == pickType)?.color || ''
 }
 }
 
 
 const handleApply = async (major) => {
 const handleApply = async (major) => {

+ 11 - 66
src/pagesOther/pages/vhs/index/components/score-batch-popup.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
     <uv-popup ref="popup" mode="bottom" round="16" closeable @change="handleChange">
     <uv-popup ref="popup" mode="bottom" round="16" closeable @change="handleChange">
-        <view class="fx-row fx-cen-cen h-[50px]">
+        <view class="flex justify-center items-center h-100">
             <view class="text-lg font-bold text-main">修改分数/批次</view>
             <view class="text-lg font-bold text-main">修改分数/批次</view>
         </view>
         </view>
         <score-form ref="form" :model="modelCopy"/>
         <score-form ref="form" :model="modelCopy"/>
@@ -16,21 +16,19 @@
                 </template>
                 </template>
             </uv-cell>
             </uv-cell>
         </view>
         </view>
-        <view class="px-40 h-[60px] fx-row fx-cen-cen">
-            <uv-button class="!flex-1" shape="circle" type="primary" text="确认修改" @click="handleConfirm"/>
+        <view class="px-40 h-[60px] flex justify-center items-center">
+            <uv-button shape="circle" type="primary" text="确认修改" custom-class="w-full" @click="handleConfirm"/>
         </view>
         </view>
     </uv-popup>
     </uv-popup>
     <uv-action-sheet ref="actionSheet" :actions="formatList" @select="handleBatchSelection"/>
     <uv-action-sheet ref="actionSheet" :actions="formatList" @select="handleBatchSelection"/>
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import {ref, computed, watch} from 'vue';
 import _ from 'lodash';
 import _ from 'lodash';
-import ScoreForm from "@/pagesOther/pages/voluntary/index/components/score-form.vue";
-import {useInjectVoluntaryForm} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryFormInjection";
-import {useInjectVoluntaryCart} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryCartInjection";
-import {toast} from "@/uni_modules/uv-ui-tools/libs/function";
+import ScoreForm from "@/pagesOther/pages/vhs/index/components/score-form.vue";
 import {confirmAsync} from "@/utils/uni-helper";
 import {confirmAsync} from "@/utils/uni-helper";
+import {useInjectVoluntaryForm} from "@/pagesOther/pages/vhs/hooks/useVoluntaryFormInjection";
+import {useInjectVoluntaryCart} from "@/pagesOther/pages/vhs/hooks/useVoluntaryCartInjection";
 
 
 const emits = defineEmits(['change'])
 const emits = defineEmits(['change'])
 
 
@@ -68,12 +66,15 @@ const reloadBatchListDebounce = _.debounce(async (score) => {
 
 
 const handleConfirm = async () => {
 const handleConfirm = async () => {
     await form.value.validate()
     await form.value.validate()
-    if (!batchCopy.value?.batch) return toast('请选择批次')
+    if (!batchCopy.value?.batch) return uni.$ie.showToast('请选择批次')
     // wait user confirm
     // wait user confirm
     const change = batch.value.batch != batchCopy.value.batch ||
     const change = batch.value.batch != batchCopy.value.batch ||
         model.value.score != modelCopy.value.score ||
         model.value.score != modelCopy.value.score ||
         model.value.seatInput != modelCopy.value.seatInput
         model.value.seatInput != modelCopy.value.seatInput
-    if (change && selectedList.value.length) await confirmAsync('修改将清空当前志愿表')
+    if (change && selectedList.value.length) {
+        const confirm = await confirmAsync('修改将清空当前志愿表')
+        if (!confirm) return
+    }
     // apply to real models
     // apply to real models
     _.assign(model.value, modelCopy.value)
     _.assign(model.value, modelCopy.value)
     batch.value = batchCopy.value
     batch.value = batchCopy.value
@@ -102,62 +103,6 @@ watch(() => modelCopy.value.score, (score) => {
 })
 })
 
 
 defineExpose({open, close, show})
 defineExpose({open, close, show})
-// export default {
-//     name: "score-batch-popup",
-//     components: {ScoreStep},
-//     props: {
-//         show: {
-//             type: Boolean,
-//             default: false
-//         },
-//         form: {
-//             type: Object,
-//             default: () => {
-//             }
-//         },
-//         batch: {
-//             type: Number | String,
-//             default: ''
-//         },
-//         batchList: {
-//             type: Array,
-//             default: () => []
-//         }
-//     },
-//     data() {
-//         return {
-//             openBatchList: false
-//         }
-//     },
-//     computed: {
-//         firedBatch() {
-//             return this.batchList.find(b => this.batch == b.batch)
-//         },
-//         formatBatchList() {
-//             return this.batchList.map(b => ({
-//                 ...b,
-//                 subname: b.recommand ? '重点推荐' : ''
-//             }))
-//         }
-//     },
-//     methods: {
-//         handleBatchSelection(item) {
-//             this.$emit('update:batch', item.batch)
-//         },
-//         async validate() {
-//             await this.$refs.score.validate()
-//             if (!this.firedBatch) {
-//                 const error = '请选择批次'
-//                 this.$message.error(error)
-//                 return Promise.reject(error)
-//             }
-//         },
-//         async handleConfirm() {
-//             await this.validate()
-//             this.$emit('confirm')
-//         }
-//     }
-// }
 </script>
 </script>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">

+ 60 - 0
src/pagesOther/pages/vhs/index/components/vhs-majors-draggable-list.vue

@@ -0,0 +1,60 @@
+<template>
+  <view class="mt-10">
+    <l-drag ref="dragRef" :list="majors" :column="1" gridHeight="56px" :touchHandle="touchHandle" ghost handle
+      @change="changeSort">
+      <!-- // 每一项的插槽 grid 的 content 您传入的数据 -->
+      <template #grid="{ active, content, index }">
+        <!-- // grid.active 是否为当前拖拽项目 根据自己需要写样式 -->
+        <view
+          class="bg-back rounded-6 h-[44px] pl-30 pr-20 relative flex items-center gap-x-16 mb-[10px] border border-solid"
+          :class="[active ? 'border-primary' : 'border-transparent']">
+          <view class="text-32 text-fore-placeholder font-bold">{{ toFixedLen(index) }}</view>
+          <view class="flex-1 w-1 h-full leading-[44px] text-28 text-fore-title font-bold ellipsis-1">
+              {{ content.marjorName }}[{{ content.marjorBelongs }}]
+          </view>
+          <uv-icon name="trash" size="18" color="error" @click="handleDelete(content)" />
+          <view slot="handle" @touchstart="handleDragStart" @touchend="handleDragEnd">
+            <uv-icon name="list-dot" size="18" color="primary" />
+          </view>
+        </view>
+      </template>
+      <template #ghost></template>
+    </l-drag>
+  </view>
+</template>
+<script lang="ts" setup>
+import type { VHS } from '@/types';
+// import { VOLUNTARY_REFRESHER_ENABLED } from "@/types/injectionSymbols";
+
+const props = defineProps<{
+  majors: VHS.VoluntaryMajor[];
+}>();
+// const refresherEnabled = inject(VOLUNTARY_REFRESHER_ENABLED) || ref(false)
+const emits = defineEmits<{
+  (e: "delete", major: VHS.VoluntaryMajor): void;
+  (e: "update:majors", majors: VHS.VoluntaryMajor[]): void;
+  (e: "change", majors: VHS.VoluntaryMajor[]): void;
+}>();
+const touchHandle = ref(false)
+
+const handleDragStart = () => {
+  touchHandle.value = true;
+  // refresherEnabled.value = false;
+}
+const handleDragEnd = () => {
+  touchHandle.value = false;
+  // refresherEnabled.value = true;
+}
+const changeSort = (e: any) => {
+  const list = e.map((item: any) => item.content);
+  emits('update:majors', list);
+  emits('change', list);
+}
+const handleDelete = (major: VHS.VoluntaryMajor) => {
+  emits('delete', major);
+}
+const toFixedLen = (i: number, len: number = 1) => {
+  return String(i + 1).padStart(len, "0");
+}
+</script>
+<style lang="scss" scoped></style>

+ 8 - 10
src/pagesOther/pages/vhs/index/components/voluntary-bottom.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
-    <view class="h-[50px] bg-white px-20 fx-row fx-bet-cen mx-shadow-up">
-        <view class="flex-1 fx-row fx-sta-cen text-content text-2xs" @click="openModify">
+    <view class="h-100 bg-white px-20 flex justify-between items-center ie-shadow-up">
+        <view class="flex-1 flex justify-start items-center text-content text-2xs" @click="openModify">
             {{ `${model.score}分 ${model.seatInput || model.rank.lowestRank}位` }}
             {{ `${model.score}分 ${model.seatInput || model.rank.lowestRank}位` }}
             {{ batch.name }} {{ userSnapshot.examMajorName }}
             {{ batch.name }} {{ userSnapshot.examMajorName }}
             <uv-icon v-if="!id" name="edit-pen-fill" color="primary" class="ml-10"/>
             <uv-icon v-if="!id" name="edit-pen-fill" color="primary" class="ml-10"/>
@@ -10,17 +10,15 @@
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import {computed, ref} from 'vue';
-import {useInjectVoluntaryCart} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryCartInjection";
-import {useInjectVoluntaryForm} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryFormInjection";
-import {toast} from "@/uni_modules/uv-ui-tools/libs/function";
-import {useInjectUserSnapshot} from "@/pagesOther/pages/ie/hooks/useUserSnapshotInjection";
+import {useInjectVoluntaryForm} from "@/pagesOther/pages/vhs/hooks/useVoluntaryFormInjection";
+import {useInjectVoluntaryCart} from "@/pagesOther/pages/vhs/hooks/useVoluntaryCartInjection";
+import {useInjectUserSnapshot} from "@/pagesOther/hooks/useUserSnapshotInjection";
 
 
 const emits = defineEmits(['cart', 'modify'])
 const emits = defineEmits(['cart', 'modify'])
 
 
-const {model, batch, simpleMode} = useInjectVoluntaryForm()
+const {model, batch} = useInjectVoluntaryForm()
 const {id, selectedList} = useInjectVoluntaryCart()
 const {id, selectedList} = useInjectVoluntaryCart()
-const {userSnapshot} = useInjectUserSnapshot()
+const userSnapshot = useInjectUserSnapshot()
 
 
 const previewText = computed(() => {
 const previewText = computed(() => {
     const len = selectedList.value.length
     const len = selectedList.value.length
@@ -34,7 +32,7 @@ const openModify = () => {
 }
 }
 
 
 const openVolunteer = () => {
 const openVolunteer = () => {
-    if (!selectedList.value.length) return toast('至少选择1个专业组')
+    if (!selectedList.value.length) return uni.$ie.showToast('至少选择1个专业组')
     emits('cart')
     emits('cart')
 }
 }
 </script>
 </script>

+ 28 - 184
src/pagesOther/pages/vhs/index/components/voluntary-cart-popup.vue

@@ -1,10 +1,10 @@
 <template>
 <template>
     <uv-popup ref="popup" mode="bottom" round="16" closeable>
     <uv-popup ref="popup" mode="bottom" round="16" closeable>
-        <view class="h-[50px] px-40 fx-row fx-bet-cen text-main text-lg font-bold">
+        <view class="h-100 px-40 flex justify-between items-center text-main text-lg font-bold">
             <template v-if="!id">
             <template v-if="!id">
                 志愿表预览
                 志愿表预览
             </template>
             </template>
-            <view v-else class="fx-row flex-1 pr-30">
+            <view v-else class="flex flex-1 pr-30">
                 <text v-if="!nameEditing">{{ name }}</text>
                 <text v-if="!nameEditing">{{ name }}</text>
                 <uv-input v-else v-model="name" placeholder="志愿表名称"/>
                 <uv-input v-else v-model="name" placeholder="志愿表名称"/>
                 <uv-icon name="edit-pen" size="18" class="ml-10" @click="nameEditing=!nameEditing"/>
                 <uv-icon name="edit-pen" size="18" class="ml-10" @click="nameEditing=!nameEditing"/>
@@ -14,26 +14,26 @@
         <scroll-view :scroll-y="!anyDragging" class="bg-bg" style="height: 50vh" lower-threshold="100"
         <scroll-view :scroll-y="!anyDragging" class="bg-bg" style="height: 50vh" lower-threshold="100"
                      @scrolltolower="handleGroupScroll">
                      @scrolltolower="handleGroupScroll">
             <uv-sticky v-if="firedSorts.length" :offsetTop="-44">
             <uv-sticky v-if="firedSorts.length" :offsetTop="-44">
-                <view class="px-20 pb-20 fx-row bg-white">
+                <view class="px-20 pb-20 flex bg-white">
                     <uv-tags v-for="s in firedSorts" :key="s.name" :text="s.short" :icon="s.icon" size="mini"
                     <uv-tags v-for="s in firedSorts" :key="s.name" :text="s.short" :icon="s.icon" size="mini"
                              type="success" closable plain-fill @close="handleSortRemove(s)"/>
                              type="success" closable plain-fill @close="handleSortRemove(s)"/>
                 </view>
                 </view>
             </uv-sticky>
             </uv-sticky>
-            <view class="p-20 fx-col gap-20">
-                <view v-for="(college,index) in pagedSelectedList" class="fx-row fx-bet-sta bg-white mx-card">
+            <view class="p-20 flex flex-col gap-20">
+                <view v-for="(college,index) in pagedSelectedList" :key="index" class="flex justify-between items-start bg-white shadow-card">
                     <view class="ml-10 mb-10 text-sm">
                     <view class="ml-10 mb-10 text-sm">
-                        <text class="fx-row rounded-b-full px-15 pt-5 pb-10 text-white bg-primary">
+                        <text class="flex rounded-b-full px-15 pt-5 pb-10 text-white bg-primary">
                             {{ generateSeq(index) }}
                             {{ generateSeq(index) }}
                         </text>
                         </text>
                     </view>
                     </view>
-                    <view class="flex-1 p-20 fx-col">
+                    <view class="flex-1 p-20 flex flex-col">
                         <view class="font-bold">
                         <view class="font-bold">
                             {{ college.university.name }}
                             {{ college.university.name }}
                             <!-- TODO:志愿表还未保存group信息,所以这里显示会在编辑时表现不一致 -->
                             <!-- TODO:志愿表还未保存group信息,所以这里显示会在编辑时表现不一致 -->
                             <template v-if="false">({{ college.recruitPlan.group }})</template>
                             <template v-if="false">({{ college.recruitPlan.group }})</template>
                             ({{ college.recruitPlan.collegeCode }})
                             ({{ college.recruitPlan.collegeCode }})
                         </view>
                         </view>
-                        <view class="fx-row fx-bet-cen mt-10 text-content text-2xs gap-20">
+                        <view class="flex justify-between items-center mt-10 text-content text-2xs gap-20">
                             <view>录取概率:
                             <view>录取概率:
                                 <view class="font-bold text-main">
                                 <view class="font-bold text-main">
                                     {{ college.enrollRatio || '-' }}%
                                     {{ college.enrollRatio || '-' }}%
@@ -50,7 +50,7 @@
                                 </view>
                                 </view>
                             </view>
                             </view>
                         </view>
                         </view>
-                        <view class="fx-row gap-20 my-20">
+                        <view class="flex gap-20 my-20">
                             <uv-button :disabled="selectedList.length<2" type="primary" size="mini" plain
                             <uv-button :disabled="selectedList.length<2" type="primary" size="mini" plain
                                        shape="circle" icon="arrow-down-fill" :text="generateSeq(index)"
                                        shape="circle" icon="arrow-down-fill" :text="generateSeq(index)"
                                        icon-color="primary" @click="openSeqSelect(index)"/>
                                        icon-color="primary" @click="openSeqSelect(index)"/>
@@ -62,32 +62,15 @@
                             <uv-button type="primary" size="mini" plain shape="circle" icon="trash"
                             <uv-button type="primary" size="mini" plain shape="circle" icon="trash"
                                        icon-color="primary" @click="handleRemoveAll(college)"/>
                                        icon-color="primary" @click="handleRemoveAll(college)"/>
                         </view>
                         </view>
-                        <m-drag ref="drag" :list="getSelectedSortedMajors(college)" :item-height="44"
-                                @change="handleDragComplete">
-                            <template #default="{item:major,index:majorIndex}">
-                                <view class="fx-row items-center text-xs text-content h-[44px] box-border mx-border-b">
-                                    <view class="flex-1 truncate">
-                                        <text v-if="majorIndex>-1" class="mr-20">{{ majorIndex + 1 }}</text>
-                                        <text :class="{'highlight-major': isFormedMajorFired(major)}">
-                                            {{ major.marjorName }}[{{ major.marjorBelongs }}]
-                                        </text>
-                                    </view>
-                                    <!-- 因为手机上区域比较小,只保留了拖拽排序 -->
-                                    <uv-icon v-if="false" name="arrow-up" size="20px" class="mr10"
-                                             @click="handleMajorUp(major, college)"></uv-icon>
-                                    <uv-icon v-if="false" name="arrow-down" size="20px" class="mr10"
-                                             @click="handleMajorDown(major, college)"></uv-icon>
-                                    <uv-icon name="trash" size="20px" class="mr10"
-                                             @click="handleMajorDelete(major, college)"></uv-icon>
-                                </view>
-                            </template>
-                        </m-drag>
+                        <vhs-majors-draggable-list :majors="getSelectedSortedMajors(college)"
+                                                   @delete="handleMajorDelete($event, college)"
+                                                   @change="handleDragComplete($event, college)" />
                     </view>
                     </view>
                 </view>
                 </view>
             </view>
             </view>
         </scroll-view>
         </scroll-view>
-        <view class="h-[50px] px-40 fx-row items-center mx-border-t">
-            <uv-button type="primary" text="保存志愿表" shape="circle" :loading="locking"
+        <view class="h-100 px-40 flex items-center ie-border-t">
+            <uv-button type="primary" text="保存志愿表" shape="circle" :loading="locking" custom-class="w-full"
                        @click="handleSave"></uv-button>
                        @click="handleSave"></uv-button>
         </view>
         </view>
         <uv-action-sheet ref="actionSheet" :actions="sortList" :cancel-text="cancelSortText" @select="handleSort"
         <uv-action-sheet ref="actionSheet" :actions="sortList" :cancel-text="cancelSortText" @select="handleSort"
@@ -99,14 +82,13 @@
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import {ref, computed, watch} from 'vue';
-import {useInjectVoluntaryCart} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryCartInjection";
-import {toValue} from "@vueuse/core";
-import {useVoluntarySortService} from "@/pagesOther/pages/voluntary/hooks/useVoluntarySortService";
-import {useInjectVoluntaryMajorHighlight} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryMajorHighlightInjection";
 import {confirmAsync} from "@/utils/uni-helper";
 import {confirmAsync} from "@/utils/uni-helper";
-import {useInjectVoluntaryAssistant} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryAssistantInjection";
-import {useInjectVoluntaryHeader} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryHeaderInjection";
+import {useInjectVoluntaryCart} from "@/pagesOther/pages/vhs/hooks/useVoluntaryCartInjection";
+import {useInjectVoluntaryMajorHighlight} from "@/pagesOther/pages/vhs/hooks/useVoluntaryMajorHighlightInjection";
+import {useVoluntarySortService} from "@/pagesOther/pages/vhs/hooks/useVoluntarySortService";
+import {useInjectVoluntaryHeader} from "@/pagesOther/pages/vhs/hooks/useVoluntaryHeaderInjection";
+import {useInjectVoluntaryAssistant} from "@/pagesOther/pages/vhs/hooks/useVoluntaryAssistantInjection";
+import VhsMajorsDraggableList from "@/pagesOther/pages/vhs/index/components/vhs-majors-draggable-list.vue";
 
 
 const popup = ref(null)
 const popup = ref(null)
 const drag = ref(null)
 const drag = ref(null)
@@ -141,14 +123,16 @@ const openSortList = () => {
     actionSheet.value.open()
     actionSheet.value.open()
 }
 }
 
 
-const handleDragComplete = (newList, oldList) => {
+const handleDragComplete = (newList, college) => {
     // make localPriority exchange when drag complete.
     // make localPriority exchange when drag complete.
+    const oldList = getSelectedSortedMajors(college)
     const copyPriorities = oldList.map(i => i.localPriority)
     const copyPriorities = oldList.map(i => i.localPriority)
     copyPriorities.forEach((p, i) => newList[i].localPriority = p)
     copyPriorities.forEach((p, i) => newList[i].localPriority = p)
 }
 }
 
 
 const handleRemoveAll = async (college) => {
 const handleRemoveAll = async (college) => {
-    await confirmAsync('确认删除该专业组下的全部专业?')
+    const confirm = await confirmAsync('确认删除该专业组下的全部专业?')
+    if (!confirm) return
     college.majors.forEach(m => {
     college.majors.forEach(m => {
         m.selected = false
         m.selected = false
         snapshotSearchingMajorWhenApply(m)
         snapshotSearchingMajorWhenApply(m)
@@ -188,9 +172,10 @@ const handleMajorDown = (major, majorGroup) => {
         targetMajor.localPriority = temp
         targetMajor.localPriority = temp
     }
     }
 }
 }
-const handleMajorDelete = (major) => {
-    major.selected = false
-    snapshotSearchingMajorWhenApply(major)
+const handleMajorDelete = (major, majorGroup) => {
+    const rawMajor = getSelectedSortedMajors(majorGroup).find(m => m.id == major.id)
+    rawMajor.selected = false
+    snapshotSearchingMajorWhenApply(rawMajor)
     if (recalculatePureSelectedList()) sortInterrupt()
     if (recalculatePureSelectedList()) sortInterrupt()
 }
 }
 
 
@@ -223,147 +208,6 @@ const close = () => {
 }
 }
 
 
 defineExpose({open, close})
 defineExpose({open, close})
-// export default {
-//     props: {
-//         id: {
-//             type: String | Number,
-//             default: 0
-//         },
-//         name: {
-//             type: String,
-//             default: ''
-//         },
-//         show: {
-//             type: Boolean,
-//             default: false
-//         },
-//         selectedList: {
-//             type: Array,
-//             default: () => []
-//         },
-//         defaultSort: {
-//             type: Array,
-//             default: () => []
-//         },
-//         locking: {
-//             type: Boolean,
-//             default: false
-//         }
-//     },
-//     data() {
-//         return {
-//             nameEditing: false,
-//             confirmGroup: null,
-//             showConfirm: false,
-//             showSort: false,
-//             showSeq: false,
-//             seqIndex: 0,
-//         }
-//     },
-//     watch: {
-//         show: function (val) {
-//             // u-popup will release dom elements when not showing
-//             // so reset the current page number here
-//             if (val) this.localPageNum = 1
-//         }
-//     },
-//     methods: {
-//         getSelectedSortedMajors(group) {
-//             return group.majors.filter(m => m.selected).sort(MxConst.recommendMajorSortFn)
-//         },
-//         getGroupHeight(group) {
-//             const majors = this.getSelectedSortedMajors(group)
-//             return majors.length * 45
-//         },
-//         openSeqSelect(groupIndex) {
-//             this.seqIndex = groupIndex
-//             this.showSeq = true
-//         },
-//         handleSeq({indexs}) {
-//             const oldIndex = this.seqIndex
-//             const newIndex = indexs[0]
-//             if (oldIndex != newIndex) {
-//                 const seqGroup = this.selectedList[oldIndex]
-//                 this.selectedList.splice(oldIndex, 1)
-//                 this.selectedList.splice(newIndex, 0, seqGroup)
-//                 this.sortInterrupt()
-//             }
-//             this.showSeq = false
-//         },
-//         close() {
-//             this.$emit('closeVolunteer')
-//         },
-//         open() {
-//
-//         },
-//         save() {
-//             this.$emit('save')
-//         },
-//         handleRemoveAll() {
-//             this.confirmGroup.majors.forEach(m => {
-//                 m.selected = false
-//                 this.snapshotSearchingMajorWhenApply(m)
-//             })
-//             this.$emit('change')
-//             this.showConfirm = false
-//         },
-//         // sort for major item
-//         handleMajorUp(major, majorGroup) {
-//             const source = this.getSelectedSortedMajors(majorGroup)
-//             // HM-DragSorts clone element will cause index error
-//             const index = source.findIndex(s => s.marjorBelongs == major.marjorBelongs)
-//             const targetIndex = index - 1
-//             // exchange two majors' localPriority
-//             if (targetIndex >= 0) {
-//                 major = source[index] // this is the original major
-//                 const targetMajor = source[targetIndex]
-//                 const temp = major.localPriority
-//                 major.localPriority = targetMajor.localPriority
-//                 targetMajor.localPriority = temp
-//             }
-//         },
-//         handleMajorDown(major, majorGroup) {
-//             const source = this.getSelectedSortedMajors(majorGroup)
-//             // HM-DragSorts clone element will cause index error
-//             const index = source.findIndex(s => s.marjorBelongs == major.marjorBelongs)
-//             const targetIndex = index + 1
-//             // exchange two majors' localPriority
-//             if (targetIndex < source.length) {
-//                 major = source[index] // this is the original major
-//                 const targetMajor = source[targetIndex]
-//                 const temp = major.localPriority
-//                 major.localPriority = targetMajor.localPriority
-//                 targetMajor.localPriority = temp
-//             }
-//         },
-//         deleteMajor(major, majorGroup) {
-//             const source = this.getSelectedSortedMajors(majorGroup)
-//             // HM-DragSorts clone element will cause index error
-//             const index = source.findIndex(s => s.marjorBelongs == major.marjorBelongs)
-//             major = source[index] // this is the original major
-//             major.selected = false
-//             this.snapshotSearchingMajorWhenApply(major)
-//             this.$emit('change')
-//         },
-//         handleMajorDrag(group, event) {
-//             const source = this.getSelectedSortedMajors(group)
-//             const oldIndex = event.index * 1
-//             const newIndex = event.moveTo * 1
-//             if (oldIndex == newIndex) return
-//             // get localPriority one by one
-//             const oldSeq = source.map(m => m.localPriority)
-//             const oldMajor = source[oldIndex]
-//             const newMajor = source[newIndex]
-//             const newSource = [...source]
-//             newSource.splice(oldIndex, 1)
-//             newSource.splice(newIndex, 0, oldMajor)
-//             // assign oldSeq to newSource one by one
-//             newSource.forEach((m, idx) => {
-//                 m.localPriority = oldSeq[idx]
-//             })
-//         }
-//     }
-// }
 </script>
 </script>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">

+ 1 - 1
src/pagesOther/pages/vhs/index/components/voluntary-history-list.vue

@@ -6,7 +6,7 @@
             <uv-col :span="3">最低分</uv-col>
             <uv-col :span="3">最低分</uv-col>
             <uv-col :span="3">最低位次</uv-col>
             <uv-col :span="3">最低位次</uv-col>
         </uv-row>
         </uv-row>
-        <uv-row v-for="(history, idx) in list.filter(h => h)" class="mt-10 text-xs text-content">
+        <uv-row v-for="(history, idx) in list.filter(h => h)" :key="idx" class="mt-10 text-xs text-content">
             <uv-col :span="3">
             <uv-col :span="3">
                 <view v-if="history">{{ history.year }}</view>
                 <view v-if="history">{{ history.year }}</view>
                 <view v-else>{{ historyYears[idx] }}</view>
                 <view v-else>{{ historyYears[idx] }}</view>

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

@@ -1,6 +1,6 @@
 <template>
 <template>
     <ie-page fix-height :safe-area-inset-bottom="false">
     <ie-page fix-height :safe-area-inset-bottom="false">
-        <ie-navbar :title="navBinding.title"/>
+        <ie-navbar :title="navBinding.title" custom-back @leftClick="handleBack"/>
         <ie-auto-resizer>
         <ie-auto-resizer>
             <swiper :current="currentStep" disable-touch class="swiper h-full">
             <swiper :current="currentStep" disable-touch class="swiper h-full">
                 <swiper-item>
                 <swiper-item>
@@ -43,7 +43,7 @@ useProvideVoluntaryHeader()
 
 
 const {currentStep} = stepSvc
 const {currentStep} = stepSvc
 const assistantSvc = useProvideVoluntaryAssistant(stepSvc, dataSvc, formSvc, cartSvc, highlightSvc)
 const assistantSvc = useProvideVoluntaryAssistant(stepSvc, dataSvc, formSvc, cartSvc, highlightSvc)
-const {navBinding, onComplete, resetAll} = assistantSvc
+const {navBinding, handleBack, onComplete, resetAll} = assistantSvc
 
 
 onComplete((id) => {
 onComplete((id) => {
     transferTo(routes.VHSDetail, {data: {id}})
     transferTo(routes.VHSDetail, {data: {id}})

+ 3 - 2
src/pagesOther/pages/vhs/list/list.vue

@@ -55,9 +55,10 @@ export default {
             }).catch(e => this.$refs.paging.complete(false))
             }).catch(e => this.$refs.paging.complete(false))
         },
         },
         async handleDelete(item) {
         async handleDelete(item) {
-            await confirmAsync(`确认删除'${item.name}'`)
+            const confirm = await confirmAsync(`确认删除'${item.name}'`)
+            if (!confirm) return
             await delZytbRecord({id: item.id})
             await delZytbRecord({id: item.id})
-            toast('删除成功')
+            uni.$ie.showSuccess('删除成功')
             this.$refs.paging.reload()
             this.$refs.paging.reload()
         }
         }
     }
     }

+ 2 - 2
src/pagesOther/pages/voluntary/list/components/voluntary-majors-draggable-list.vue

@@ -10,13 +10,13 @@
           :class="[active ? 'border-primary' : 'border-transparent']">
           :class="[active ? 'border-primary' : 'border-transparent']">
           <view class="text-32 text-fore-placeholder font-bold">{{ toFixedLen(index) }}</view>
           <view class="text-32 text-fore-placeholder font-bold">{{ toFixedLen(index) }}</view>
           <view class="flex-1 w-1 h-full leading-[44px] text-28 text-fore-title font-bold ellipsis-1">{{ content.majorName }}</view>
           <view class="flex-1 w-1 h-full leading-[44px] text-28 text-fore-title font-bold ellipsis-1">{{ content.majorName }}</view>
-          <uv-icon name="trash" size="18" color="error" @click="handleDelete" />
+          <uv-icon name="trash" size="18" color="error" @click="handleDelete(content)" />
           <view slot="handle" @touchstart="handleDragStart" @touchend="handleDragEnd">
           <view slot="handle" @touchstart="handleDragStart" @touchend="handleDragEnd">
             <uv-icon name="list-dot" size="18" color="primary" />
             <uv-icon name="list-dot" size="18" color="primary" />
           </view>
           </view>
         </view>
         </view>
       </template>
       </template>
-      <template #ghots></template>
+      <template #ghost></template>
     </l-drag>
     </l-drag>
   </view>
   </view>
 </template>
 </template>

+ 8 - 0
src/static/style/tailwind.scss

@@ -67,4 +67,12 @@
 
 
 .ie-border-b {
 .ie-border-b {
   @apply border-0 border-b border-solid border-border;
   @apply border-0 border-b border-solid border-border;
+}
+
+.ie-shadow-up {
+  --tw-shadow: 0 -1px 3px 0 rgb(0 0 0 / 0.1), 0 -1px 2px -1px rgb(0 0 0 / 0.1);
+  --tw-shadow-colored: 0 -1px 3px 0 var(--tw-shadow-color), 0 -1px 2px -1px var(--tw-shadow-color);
+  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
+  --tw-shadow-color: #dbeafe;
+  --tw-shadow: var(--tw-shadow-colored)
 }
 }

+ 3 - 3
src/utils/uni-helper.js

@@ -8,9 +8,9 @@ export const confirmAsync = async (msgOrOptions) => {
         const inputOptions = string(msgOrOptions) ? {content: msgOrOptions} : msgOrOptions
         const inputOptions = string(msgOrOptions) ? {content: msgOrOptions} : msgOrOptions
         const defaultOptions = {
         const defaultOptions = {
             success: res => {
             success: res => {
-                if (res.confirm) resolve()
-                else reject('user cancelled')
-            }
+                resolve(res.confirm)
+            },
+            fail: reject
         }
         }
         const options = Object.assign({}, defaultOptions, inputOptions)
         const options = Object.assign({}, defaultOptions, inputOptions)
         uni.showModal(options)
         uni.showModal(options)