فهرست منبع

feature:登录增加验证码是否使用配置、修复首页报名状态样式

liuzhenlin 3 روز پیش
والد
کامیت
ead6f5270d
2فایلهای تغییر یافته به همراه21 افزوده شده و 3 حذف شده
  1. 8 2
      src/view/home/index.vue
  2. 13 1
      src/view/login/index.vue

+ 8 - 2
src/view/home/index.vue

@@ -103,7 +103,7 @@
       <ul class="approval">
         <li v-for="item in trainingList" :key="item.id" @click="onRouterPush('/training/enroll', { state: item.id })">
           <div class="flex justify-between">
-            <van-text-ellipsis :content="`${item.title}`" />
+            <div class="item-title">{{ item.title }}</div>
             <van-tag v-if="item.status === '40'">已结束</van-tag>
             <van-tag v-if="item.status !== '40' && item.applyStatus === '10'" type="warning">未报名</van-tag>
             <van-tag v-else-if="item.status !== '40' && item.applyStatus === '20'" type="primary">已报名</van-tag>
@@ -329,9 +329,15 @@ onMounted(() => {
         margin-top: 8px;
         border-bottom: 1px solid #ecf5fa;
 
-        .van-text-ellipsis {
+        .item-title {
           font-weight: bold;
           font-size: 16px;
+          flex: 1;
+          width: 0;
+          margin-right: 8px;
+          white-space: nowrap;
+          overflow: hidden;
+          text-overflow: ellipsis;
         }
 
         footer {

+ 13 - 1
src/view/login/index.vue

@@ -22,7 +22,7 @@
         </template>
       </van-field>
 
-      <div class="mt10 input-box code">
+      <div class="mt10 input-box code" v-if="state.isCaptcha === '10'">
         <van-field v-model="state.form.idValueC" placeholder="验证码" />
         <div class="login-code">
           <img class="captcha-image" width="120" height="40" :src="state.captchaImage" @click="getCaptchaImage" />
@@ -69,6 +69,8 @@
 import { onMounted, reactive, ref } from 'vue'
 import to from 'await-to-js'
 import { useLoginApi } from '/@/api/login/index'
+import { useConfigApi } from '/@/api/system/config'
+
 import { Local } from '/@/utils/storage'
 import crypto from 'sm-crypto'
 import { useRouter, useRoute } from 'vue-router'
@@ -82,6 +84,7 @@ const router = useRouter()
 const route = useRoute()
 const sm3 = crypto.sm3
 const loginApi = useLoginApi()
+const configApi = useConfigApi()
 const storesUseUserInfo = useUserInfo()
 const { userInfos, openId, unionId } = storeToRefs(storesUseUserInfo)
 const showPassword = ref(false)
@@ -127,8 +130,16 @@ const state = reactive({
     idKeyC: '',
     saltValue: '',
   },
+  isCaptcha: '20',
 })
 
+// 获取基础配置 是否需要验证码
+const getBaseConfig = async () => {
+  const [err, res]: ToResponse = await to(configApi.getEntityMapByKeys({ configKeys: ['isCaptcha'] }));
+  if (err) return
+  state.isCaptcha = res.data.isCaptcha
+}
+
 const getCaptchaImage = async () => {
   const [err, res]: ToResponse = await to(loginApi.getCaptchaImg())
   if (err) return
@@ -220,6 +231,7 @@ const blueTooth = async () => {
   }
 }
 onMounted(async () => {
+  getBaseConfig()
   const code: string = route.query.code ? route.query.code.toString() : ''
   //  if (!code) {
   //       const appid = "wxdd446f7e55c80c16";