Эх сурвалжийг харах

添加评价码手机端访问H5页面和评价码登录的接口调用

lm 2 долоо хоног өмнө
parent
commit
bbb42c0b79

+ 14 - 0
src/api/studentEntry.ts

@@ -0,0 +1,14 @@
+// src/api/login.ts
+import request from '../utils/request.ts'
+
+
+let studentPrefix = import.meta.env.VITE_API_STUDENT_PRE 
+
+
+// 评价码登录 
+export const reviewCodeLoginApi = (evaluationCode: any) => {
+  return request({
+    url: `${studentPrefix}/api/v1/assessment/center/evaluation/code/${evaluationCode}`,
+    method: 'get',
+  })
+}

BIN
src/assets/appImg/app_entry_bg.png


+ 1 - 6
src/layout/components/header.vue

@@ -15,14 +15,9 @@
 
 
     <div class="head_content_right">
-      <!-- <span class="schoolName"> -->
-        <!-- {{userInfo.schoolName}} -->
-        <!-- {{userInfo?.userName}} -->
-      <!-- </span> -->
       <el-dropdown trigger="click" @command="UserCommand" placement="bottom-end">
         <span class="userName">
-          {{userInfo?.userName}}
-          <!-- {{ userInfo?.nickname }} -->
+          {{userInfo?.schoolName}}
           <el-icon class="el-icon--right">
             <arrow-down />
           </el-icon>

+ 15 - 0
src/router/index.ts

@@ -44,6 +44,21 @@ const routes: Array<RouteRecordRaw> = [
       },
     ]
   },
+
+  {
+    path: '/app',
+    name: 'app',
+    children: [
+      {
+        path: '',
+        name: 'appStudentEntry',    //学生入口
+        component: () => import('@/views/appView/StudentEntry.vue')
+      },
+    ]
+
+  },
+
+
   {
     path: '/:pathMatch(.*)*', // 捕获所有未匹配路径
     name: 'NotFound',

+ 2 - 0
src/style.css

@@ -11,6 +11,8 @@
   text-rendering: optimizeLegibility;
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
+
+  --app-rpx:calc(100vw / 375);
 }
 
 a {

+ 106 - 0
src/views/appView/StudentEntry.vue

@@ -0,0 +1,106 @@
+<template>
+  <div class="main_container">
+    <img  class="banner-card" :src="studentEntryIcon" alt="评价系统图标" />
+    <!-- 底部操作区域 -->
+    <div class="action-area">
+      <div class="input-group">
+        <div class="label">请输入评价码:</div>
+        <el-input
+          v-model="evaluationCode"
+          placeholder="请输入评价码"
+          size="large"
+          clearable
+          class="code-input"
+        ></el-input>
+      </div>
+      <div class="button-wrapper">
+        <el-button class="button_background" @click="handleEnter"> 进入</el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue';
+import { useRouter } from 'vue-router';
+import studentEntryIcon from '@/assets/appImg/app_entry_bg.png';
+import { ElMessage } from 'element-plus';
+import { reviewCodeLoginApi } from '@/api/studentEntry';
+
+
+const router = useRouter()
+const evaluationCode = ref(''); //评价码
+
+// 处理进入逻辑
+const handleEnter = async() => {
+  if (!evaluationCode.value) {
+    ElMessage.warning('请输入评价码')
+    return;
+  }
+  let res = await reviewCodeLoginApi(evaluationCode.value)
+  if(res?.code == 200){
+    localStorage.setItem('userInfo', JSON.stringify(res.data))
+    localStorage.setItem('token', res.data.tokenValue)
+    router.push('/main/questionnaireTaskListPage')
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.main_container {
+    overflow: auto;
+    height: 100%;
+    background-color: #ffffff !important;
+    > *{
+        flex-shrink: 0;
+    }
+
+    .banner-card{
+      width: 100%;
+      height:calc(280 * var(--app-rpx)) ;
+    }
+        
+    /* 操作区域样式 */
+    .action-area {
+      position: relative;
+      top:calc(-40 * var(--app-rpx));
+      width: 100%;
+      border-radius: 20px 20px 0 0;
+      background-color: white;
+      padding:calc(80 * var(--app-rpx)) calc(24 * var(--app-rpx)) calc(40 * var(--app-rpx));
+
+      overflow: auto;
+        display: flex;
+        flex-direction: column;
+        gap: calc(80 * var(--app-rpx));
+       
+        .input-group {
+            display: flex;
+            flex-direction: column;
+            width: 100%;
+            gap:calc(16 * var(--app-rpx));
+            .label {
+                font-size: calc(16 * var(--app-rpx));
+                color: #000000;
+                white-space: nowrap;
+            }
+            .code-input {
+                :deep(.el-input__wrapper) {
+                    height: calc(48 * var(--app-rpx));
+                    font-size: calc(16 * var(--app-rpx));
+                }
+            }
+        }
+        .button-wrapper {
+            width: 100%;
+            display: flex;
+            justify-content: center;
+            .button_background {
+                width: 100%;
+                height: calc(48 * var(--app-rpx));
+                font-size: calc(16 * var(--app-rpx));
+            }
+        }
+    }
+}
+</style>

+ 18 - 23
src/views/questionnaireTaskListPage/QuestionnaireTaskListPage.vue

@@ -2,10 +2,10 @@
     <div class="main_container">
         <div class="questionnaire_list">
             <div class="questionnaire_card">
-                <div class="title">{{ questionnaire.title }}</div>
+                <div class="title">{{ questionnaire.evaluationName }}</div>
                 <div class="time_group">
-                    <span class="time">开始时间:{{ questionnaire.startTime }}</span>
-                    <span class="time">结束时间:{{ questionnaire.endTime }}</span>
+                    <span class="time">开始时间:{{ questionnaire.evaluationStartDatetime }}</span>
+                    <span class="time">结束时间:{{ questionnaire.evaluationEndDatetime }}</span>
                 </div>
                 <div class="operation">
                     <el-button class="button_border" @click="GoEnter(questionnaire)">进入</el-button>
@@ -21,38 +21,28 @@
 </template>   
 
 <script setup lang="ts">
-import { ref } from 'vue';
+import { onMounted, ref } from 'vue';
 
 import { useRouter } from 'vue-router';
-
 import SubjectAndClassChooseDialog from '@/components/subjectAndClassChooseDialog/SubjectAndClassChooseDialog.vue';
 
-
 const router = useRouter()
 
+interface QuestionnaireData {
+    id:string
+    evaluationName:string   //任务名称
+    evaluationStartDatetime:string  //任务开始时间
+    evaluationEndDatetime:string   //任务结束时间
+}
 // 问卷列表
-const questionnaire = ref(
-    // {
-    //     id:'1',
-    //     title:'食堂满意度调查问卷食堂满意度调查问卷食堂满意度调查问卷',
-    //     startTime:'2026-08-10 16:00',
-    //     endTime:'2026-09-10 16:00'
-    // },
-    {
-        id:'2',
-        title:'食堂满意度调查问卷食堂满意度调查问卷食堂满意度调查问卷',
-        startTime:'2026-08-10 16:00',
-        endTime:'2026-09-10 16:00'
-    },
-
-)
+const questionnaire = ref<QuestionnaireData|{}>({})
 
 
 // 处理进入问卷逻辑
 const GoEnter = (row)=>{
     console.log(row.id)
-
-    if(row.id == 2){
+    if(row.showSelectSubject){
+        // 需要调用弹窗接口
         OpenFormDialog()
     }else{
         router.push('/main/selfQuestionnaireProcess')
@@ -68,6 +58,11 @@ const OpenFormDialog = ()=>{
 const ConfirmFormDialog = (params)=>{
     router.push('/main/selfQuestionnaireProcess')
 }
+
+onMounted(()=>{
+    let userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
+    questionnaire.value = userInfo.evaluationBO
+})
 </script>
 
 

+ 8 - 3
src/views/studentEntry/StudentEntry.vue

@@ -28,18 +28,23 @@ import { ref } from 'vue';
 import { useRouter } from 'vue-router';
 import studentEntryIcon from '@/assets/studentQuestionnaire/entry_logo.png';
 import { ElMessage } from 'element-plus';
-
+import { reviewCodeLoginApi } from '@/api/studentEntry';
 
 const router = useRouter()
 const evaluationCode = ref(''); //评价码
 
 // 处理进入逻辑
-const handleEnter = () => {
+const handleEnter =  async() => {
   if (!evaluationCode.value) {
     ElMessage.warning('请输入评价码')
     return;
   }
-  router.push('/main/questionnaireTaskListPage')
+  let res = await reviewCodeLoginApi(evaluationCode.value)
+  if(res?.code == 200){
+    localStorage.setItem('userInfo', JSON.stringify(res.data))
+    localStorage.setItem('token', res.data.tokenValue)
+    router.push('/main/questionnaireTaskListPage')
+  }
 };
 </script>