|
|
@@ -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";
|