Explorar o código

修改h5页面提示框样式

lm hai 2 semanas
pai
achega
f6f4740a36

+ 4 - 0
src/main.ts

@@ -11,6 +11,10 @@ import { setupStore } from './store' // 引入 store 初始化方法
 
 import './styles/common.scss'
 import './styles/page.scss'
+
+import './styles/appCommon.scss'
+
+
 const app = createApp(App)
 Object.keys(ElIcons).forEach((key) => {
   app.component(key, (ElIcons as Record<string, any>)[key])

+ 7 - 0
src/styles/appCommon.scss

@@ -0,0 +1,7 @@
+.app_el_message{
+    padding: calc(11 * var(--app-rpx)) calc(15 * var(--app-rpx));
+    font-size: calc(16 * var(--app-rpx));
+    .el-message__content{
+        font-size: calc(14 * var(--app-rpx));
+    }
+}

+ 6 - 3
src/utils/request.ts

@@ -36,9 +36,10 @@ service.interceptors.response.use(
       ElMessage({
         message: res.msg || '请求失败',
         type: 'error',
-        duration: 5 * 1000
+        duration: 5 * 1000,
+        // app 路由添加class类
+        customClass:window.location.hash.startsWith('#/main') ?  '' : 'app_el_message',
       })
-
       // 特殊状态码处理,如 token 失效等
       if (res.code === 401) {
         // 跳转登录页
@@ -62,7 +63,9 @@ service.interceptors.response.use(
     if(message){
         ElMessage({
           message,
-          type: 'error'
+          type: 'error',
+          // app 路由添加class类
+          customClass:window.location.hash.startsWith('#/main') ?  '' : 'app_el_message',
         })
     }
     return Promise.reject(error)

+ 17 - 5
src/views/appView/QuestionnaireElectiveSubject.vue

@@ -46,7 +46,7 @@
         </template>
         <!-- 底部确认按钮 -->
         <div class="bottom_action_bar">
-            <el-button class="button_background" @click="handle_confirm">确认</el-button>
+            <el-button class="button_background" @click="HandleConfirm">确认</el-button>
         </div>
     </div>
 
@@ -102,7 +102,7 @@ const handleSelectChange = (val)=>{
 
 
 // 点击确认
-const handle_confirm = async () => {
+const HandleConfirm = async () => {
     // 最终提交只保留 展示的项
     let exitstSelectedKeys = Object.keys(selectedTeachingClass.value)
     let fixedKeys= noElectiveTeachingSubjectFormItms.value?.map(item=>item.key)
@@ -117,14 +117,26 @@ const handle_confirm = async () => {
     // 添加选科校验
     let evaluationClassIds = Object.values(selectedTeachingClass.value)
     if(selectedElectives.value.length > electiveNeedCount.value){
-        ElMessage.warning(`选科数量最多为${electiveNeedCount.value}个`)
+        ElMessage({
+            message:`选科数量最多为${electiveNeedCount.value}个`,
+            type: 'warning',
+            customClass:'app_el_message',
+        })
         return
     }else if(selectedElectives.value.length < electiveNeedCount.value){
-        ElMessage.warning(`选科数量最少为${electiveNeedCount.value}个`)
+        ElMessage({
+            message:`选科数量最少为${electiveNeedCount.value}个`,
+            type: 'warning',
+            customClass:'app_el_message',
+        })
         return 
     }
     if(evaluationClassIds.length < (noElectiveTeachingSubjectFormItms.value.length + electiveTeachingSubjectFormItms.value.length)){
-        ElMessage.warning('请确保选科班级填写完整')
+        ElMessage({
+            message:'请确保选科班级填写完整',
+            type: 'warning',
+            customClass:'app_el_message',
+        })
         return
     }
 

+ 5 - 1
src/views/appView/StudentEntry.vue

@@ -34,7 +34,11 @@ const evaluationCode = ref(''); //评价码
 // 处理进入逻辑
 const handleEnter = async() => {
   if (!evaluationCode.value) {
-    ElMessage.warning('请输入评价码')
+    ElMessage({
+      message: '请输入评价码',
+      type: 'warning',
+      customClass:'app_el_message',
+    })
     return;
   }
   let res = await reviewCodeLoginApi(evaluationCode.value)