feat:管理后台系统设置页面 + 小程序登录页条件渲染
This commit is contained in:
@@ -30,13 +30,13 @@
|
||||
<text v-else>微信一键登录</text>
|
||||
</view>
|
||||
|
||||
<view class="login-divider">
|
||||
<view class="login-divider" v-if="loginConfig.smsLoginEnabled">
|
||||
<view></view>
|
||||
<text>或使用手机号登录</text>
|
||||
<view></view>
|
||||
</view>
|
||||
|
||||
<view class="form">
|
||||
<view class="form" v-if="loginConfig.smsLoginEnabled">
|
||||
<view class="input-group">
|
||||
<text class="input-label">手机号码</text>
|
||||
<input
|
||||
@@ -73,6 +73,7 @@
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-if="loginConfig.smsLoginEnabled"
|
||||
class="btn-primary login-btn"
|
||||
:class="{ disabled: !canSubmit || loading }"
|
||||
@click="handleLogin"
|
||||
@@ -92,7 +93,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useAppStore } from '../../stores/app.js'
|
||||
import { getSmsCode } from '../../services/auth.js'
|
||||
import { getSmsCode, getLoginConfig } from '../../services/auth.js'
|
||||
|
||||
const store = useAppStore()
|
||||
|
||||
@@ -100,11 +101,21 @@ const statusBarHeight = ref(uni.getStorageSync('statusBarHeight') || 20)
|
||||
const safeAreaTop = ref(uni.getStorageSync('safeAreaTop') || 20)
|
||||
const safeAreaBottom = ref(uni.getStorageSync('safeAreaBottom') || 0)
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
const windowInfo = uni.getWindowInfo()
|
||||
statusBarHeight.value = windowInfo.statusBarHeight || 20
|
||||
safeAreaTop.value = windowInfo.safeAreaInsets?.top || windowInfo.statusBarHeight || 20
|
||||
safeAreaBottom.value = windowInfo.safeAreaInsets?.bottom || 0
|
||||
|
||||
try {
|
||||
const res = await getLoginConfig()
|
||||
if (res.data) {
|
||||
loginConfig.value = res.data
|
||||
}
|
||||
} catch (e) {
|
||||
// 接口失败时默认只显示微信登录
|
||||
loginConfig.value = { wechatLoginEnabled: true, smsLoginEnabled: false }
|
||||
}
|
||||
})
|
||||
|
||||
const phone = ref('')
|
||||
@@ -114,6 +125,8 @@ const activeMethod = ref('')
|
||||
const countdown = ref(60)
|
||||
const isCountingDown = ref(false)
|
||||
|
||||
const loginConfig = ref({ wechatLoginEnabled: true, smsLoginEnabled: false })
|
||||
|
||||
const canSubmit = computed(() => {
|
||||
return phone.value.length === 11 && code.value.length === 6
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user