408249787@qq.com 2 dias atrás
pai
commit
93d8eb7b2c
3 arquivos alterados com 47 adições e 7 exclusões
  1. 12 1
      pages/practice/detail.uvue
  2. 33 4
      pages/practice/index.uvue
  3. 2 2
      services/subject/info.ts

+ 12 - 1
pages/practice/detail.uvue

@@ -6,7 +6,18 @@ const progress = ref(1)
 const webviewSrc = ref('')
 var isLoading = ref(true)
 onMounted(() => {
-  webviewSrc.value = 'https://oss.xiaoxiongcode.com/physics-unit-practice/index.html?num=' + router.query().num
+  const unitType = router.query().unitType
+  switch (unitType) {
+    case 'course_unit':
+      webviewSrc.value = 'https://oss.xiaoxiongcode.com/physics-unit-practice/index.html?num=' + router.query().num
+      break;
+    case 'high_exam_view':
+      webviewSrc.value = 'https://oss.xiaoxiongcode.com/gaokao/index.html?num=' + router.query().num
+      break;
+    case 'middle_exam_view':
+      webviewSrc.value = 'https://oss.xiaoxiongcode.com/zhongkao/index.html?num=' + router.query().num
+      break;
+  }
 })
 function handleMessage(e) {
   var pages = getCurrentPages();

+ 33 - 4
pages/practice/index.uvue

@@ -4,13 +4,19 @@ import Back from '@/components/back.uvue'
 import { ref, onMounted } from 'vue'
 import { querySubjectInfo, querySubjectInfoNoLogin, querySubjectUnit } from '@/services/subject/info'
 import type { SubjectInfoResult } from '@/services/subject/info'
-import { router, debounce, user } from "@/.cool";
+import { router, debounce, user, dict } from "@/.cool";
 
 const isLoading = ref(true)
 const dataList = ref<any[]>([])
-
+const unitType = ref('course_unit')
+const visible = ref(false)
+const unitTypeMap = dict.getLabelByValueMapByType('subject_unit_type')
+console.log(unitTypeMap);
 async function getDataList() {
-  const res = await querySubjectUnit()
+  const res = await querySubjectUnit({
+    subjectId: '69c49329091547710d451f9d',
+    unitType: unitType.value,
+  })
   dataList.value = res || []
 }
 onMounted(async () => {
@@ -33,9 +39,15 @@ function handleDetail(item: any) {
     path: "/pages/practice/detail",
     query: {
       num: item.sortNum,
+      unitType: unitType.value,
     }
   });
 }
+async function handleSelect(val: any) {
+  unitType.value = val
+  visible.value = false
+  await getDataList()
+}
 </script>
 
 <template>
@@ -49,6 +61,10 @@ function handleDetail(item: any) {
     </view>
     <image mode="aspectFill" src="https://oss.xiaoxiongcode.com/static/home/2.jpg" alt=""
       class="w-full h-full object-cover" />
+    <view class="light-tag" @tap="visible = true">
+      <text class="light-text text-[#000]">{{ unitTypeMap[unitType] }}</text>
+      <cl-icon name="arrow-left-right-line" color="primary"></cl-icon>
+    </view>
     <!-- 顶部右侧光标签 -->
     <view class="boxs">
       <scroll-view class="scroll-view_H" direction="horizontal" :show-scrollbar="false" ref="cardsScrollView">
@@ -61,6 +77,19 @@ function handleDetail(item: any) {
         </view>
       </scroll-view>
     </view>
+    <cl-popup v-model="visible" :show-header="false" direction="center" :size="600">
+      <view class="p-4">
+        <cl-row :gutter="0">
+          <cl-col :span="8" v-for="(label, value) in unitTypeMap || []" :key="value" :pt="{
+            className: '!p-2'
+          }" @tap="handleSelect(value)">
+            <view class="select-item" :class="{ selected: value == unitType }">
+              <text class="text-[#000]">{{ label }}</text>
+            </view>
+          </cl-col>
+        </cl-row>
+      </view>
+    </cl-popup>
   </cl-page>
 </template>
 
@@ -85,7 +114,7 @@ function handleDetail(item: any) {
 }
 
 .light-tag {
-  @apply absolute top-3 left-1/2 z-[1] flex flex-row items-center bg-white px-3 py-2 font-bold rounded-full shadow-md;
+  @apply absolute top-3 left-1/2 z-[111] flex flex-row items-center bg-white px-3 py-2 font-bold rounded-full shadow-md;
   transform: translateX(-50%);
 
   .light-icon {

+ 2 - 2
services/subject/info.ts

@@ -58,6 +58,6 @@ export function querySubjectInfo(parameter: any) {
 export function querySubjectInfoNoLogin(parameter: any) {
     return useGet(`/subject/info/no/login`, parameter) as Promise<SubjectInfoResult[]>
 }
-export function querySubjectUnit() {
-    return useGet(`/subject/unit`) as Promise<any[]>
+export function querySubjectUnit(parameter: any) {
+    return useGet(`/subject/unit`, parameter) as Promise<any[]>
 }