Przeglądaj źródła

修复测评题目选中bug

shmily1213 1 miesiąc temu
rodzic
commit
9957206ef4

+ 2 - 2
src/api/modules/login.ts

@@ -13,11 +13,11 @@ export function login(params: LoginRequestDTO) {
 }
 
 export function wxLogin(params: WxLoginRequestDTO) {
-  return flyio.post('/front/loginByCode', params) as Promise<ApiResponse<any>>;
+  return flyio.post('/front/user/loginByCode', params) as Promise<ApiResponse<any>>;
 }
 
 export function bindOpenId(code: string) {
-  return flyio.post('/front/loginByCode', { loginCode: code }) as Promise<ApiResponse<any>>;
+  return flyio.post('/front/user/loginByCode', { loginCode: code }) as Promise<ApiResponse<any>>;
 }
 
 /**

+ 8 - 1
src/pagesOther/pages/test-center/components/test-tabs.vue

@@ -6,7 +6,7 @@
         <view class="px-20 py-12 text-24 relative"
           :class="[index === questionIndex ? 'bg-primary-light text-primary' : 'bg-back']">
           第{{ index + 1 }}题
-          <view v-if="item.answer !== undefined" class="absolute top-0 right-0 w-12 h-12 bg-success rounded-full">
+          <view v-if="isAnswered(item)" class="absolute top-0 right-0 w-12 h-12 bg-success rounded-full">
           </view>
         </view>
       </template>
@@ -20,6 +20,7 @@ defineOptions({
     virtualHost: true,
   }
 });
+import { TestCenter } from '@/types';
 import { SYMBOL_TEST_DATA, useTest } from '../components/useTest';
 
 const tabItemStyle = {
@@ -34,5 +35,11 @@ const questionList = computed(() => {
 const handleTabChange = (e: any) => {
   setQuestionIndex?.(e.index);
 }
+const isAnswered = (item: TestCenter.TestQuestionVO) => {
+  if (Array.isArray(item.answer)) {
+    return item.answer.length !== 0;
+  }
+  return item.answer !== undefined && item.answer !== '';
+}
 </script>
 <style lang="scss" scoped></style>