mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-07 10:57:08 +08:00
feat(system/sms): 短信渠道支持数据字典配置 (#62)
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -19,7 +19,13 @@ coverage
|
||||
|
||||
# Editor directories and files
|
||||
# .vscode/*
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<a-input v-model="form.phone" placeholder="请输入手机号" :max-length="11" allow-clear />
|
||||
</a-form-item>
|
||||
<a-form-item field="captcha" hide-label>
|
||||
<a-input v-model="form.captcha" placeholder="请输入验证码" :max-length="4" allow-clear style="flex: 1 1" />
|
||||
<a-input v-model="form.captcha" placeholder="请输入验证码" :max-length="6" allow-clear style="flex: 1 1" />
|
||||
<a-button
|
||||
class="captcha-btn"
|
||||
:loading="captchaLoading"
|
||||
@@ -25,7 +25,7 @@
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space direction="vertical" fill class="w-full">
|
||||
<a-button disabled class="btn" type="primary" :loading="loading" html-type="submit" size="large" long>立即登录</a-button>
|
||||
<a-button class="btn" type="primary" :loading="loading" html-type="submit" size="large" long>立即登录</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<Verify
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { type FormInstance, Message } from '@arco-design/web-vue'
|
||||
import type { BehaviorCaptchaReq } from '@/apis'
|
||||
// import { type BehaviorCaptchaReq, getSmsCaptcha } from '@/apis'
|
||||
// import type { BehaviorCaptchaReq } from '@/apis'
|
||||
import { type BehaviorCaptchaReq, getSmsCaptcha } from '@/apis'
|
||||
import { useTabsStore, useUserStore } from '@/stores'
|
||||
import * as Regexp from '@/utils/regexp'
|
||||
|
||||
@@ -113,12 +113,12 @@ const resetCaptcha = () => {
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||
|
||||
const getCaptcha = async (captchaReq: BehaviorCaptchaReq) => {
|
||||
try {
|
||||
captchaLoading.value = true
|
||||
captchaBtnName.value = '发送中...'
|
||||
// await getSmsCaptcha(form.phone, captchaReq)
|
||||
await getSmsCaptcha(form.phone, captchaReq)
|
||||
captchaLoading.value = false
|
||||
captchaDisable.value = true
|
||||
captchaBtnName.value = `获取验证码(${(captchaTime.value -= 1)}s)`
|
||||
|
@@ -31,7 +31,7 @@ const visible = ref(false)
|
||||
const isUpdate = computed(() => !!dataId.value)
|
||||
const title = computed(() => (isUpdate.value ? '修改短信配置' : '新增短信配置'))
|
||||
const formRef = ref<InstanceType<typeof GiForm>>()
|
||||
const { dis_enable_status_enum, sms_supplier_enum } = useDict('dis_enable_status_enum', 'sms_supplier_enum')
|
||||
const { dis_enable_status_enum, sms_supplier_type } = useDict('dis_enable_status_enum', 'sms_supplier_type')
|
||||
|
||||
const [form, resetForm] = useResetReactive({
|
||||
status: 1,
|
||||
@@ -55,7 +55,7 @@ const columns: ColumnItem[] = reactive([
|
||||
span: 12,
|
||||
required: true,
|
||||
props: {
|
||||
options: sms_supplier_enum,
|
||||
options: sms_supplier_type,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<a-input-search v-model="queryForm.accessKey" placeholder="搜索 Access Key" allow-clear @search="search" />
|
||||
<a-select
|
||||
v-model="queryForm.supplier"
|
||||
:options="sms_supplier_enum"
|
||||
:options="sms_supplier_type"
|
||||
placeholder="请选择厂商"
|
||||
allow-clear
|
||||
style="width: 150px"
|
||||
@@ -34,7 +34,7 @@
|
||||
</a-button>
|
||||
</template>
|
||||
<template #supplier="{ record }">
|
||||
<GiCellTag :value="record.supplier" :dict="sms_supplier_enum" />
|
||||
<GiCellTag :value="record.supplier" :dict="sms_supplier_type" />
|
||||
</template>
|
||||
<template #accessKey="{ record }">
|
||||
<CellCopy :content="record.accessKey" />
|
||||
@@ -72,7 +72,7 @@ import GiCellStatus from '@/components/GiCell/GiCellStatus.vue'
|
||||
|
||||
defineOptions({ name: 'SystemSmsConfig' })
|
||||
|
||||
const { sms_supplier_enum } = useDict('sms_supplier_enum')
|
||||
const { sms_supplier_type } = useDict('sms_supplier_type')
|
||||
|
||||
const queryForm = reactive<SmsConfigQuery>({
|
||||
name: undefined,
|
||||
@@ -97,7 +97,16 @@ const columns: TableInstance['columns'] = [
|
||||
fixed: !isMobile() ? 'left' : undefined,
|
||||
},
|
||||
{ title: '名称', dataIndex: 'name', slotName: 'name', width: 120, fixed: !isMobile() ? 'left' : undefined },
|
||||
{ title: '厂商', dataIndex: 'supplier', slotName: 'supplier', width: 100 },
|
||||
{
|
||||
title: '厂商',
|
||||
dataIndex: 'supplier',
|
||||
slotName: 'supplier',
|
||||
width: 100,
|
||||
props: {
|
||||
options: sms_supplier_type,
|
||||
placeholder: '请选择厂商',
|
||||
},
|
||||
},
|
||||
{ title: 'Access Key', dataIndex: 'accessKey', slotName: 'accessKey', width: 200, ellipsis: true, tooltip: true },
|
||||
{ title: 'Secret Key', dataIndex: 'secretKey', slotName: 'secretKey', width: 200, ellipsis: true, tooltip: true },
|
||||
{ title: '短信签名', dataIndex: 'signature', slotName: 'signature', width: 200, ellipsis: true, tooltip: true },
|
||||
|
@@ -25,7 +25,7 @@
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import { Message } from '@arco-design/web-vue'
|
||||
import NProgress from 'nprogress'
|
||||
import { type BehaviorCaptchaReq, getEmailCaptcha, updateUserEmail, updateUserPassword, updateUserPhone } from '@/apis'
|
||||
import { type BehaviorCaptchaReq, getEmailCaptcha, getSmsCaptcha, updateUserEmail, updateUserPassword, updateUserPhone } from '@/apis'
|
||||
import { encryptByRsa } from '@/utils/encrypt'
|
||||
import { useUserStore } from '@/stores'
|
||||
import { type ColumnItem, GiForm } from '@/components/GiForm'
|
||||
@@ -188,15 +188,15 @@ const getCaptcha = async (captchaReq: BehaviorCaptchaReq) => {
|
||||
captchaLoading.value = true
|
||||
captchaBtnName.value = '发送中...'
|
||||
if (verifyType.value === 'phone') {
|
||||
// await getSmsCaptcha(form.phone, captchaReq)
|
||||
await getSmsCaptcha(form.phone, captchaReq)
|
||||
} else if (verifyType.value === 'email') {
|
||||
await getEmailCaptcha(form.email, captchaReq)
|
||||
}
|
||||
captchaLoading.value = false
|
||||
captchaDisable.value = true
|
||||
captchaBtnName.value = `获取验证码(${(captchaTime.value -= 1)}s)`
|
||||
// Message.success('发送成功')
|
||||
Message.success('仅提供效果演示,实际使用请查看代码取消相关注释')
|
||||
Message.success('发送成功')
|
||||
// Message.success('仅提供效果演示,实际使用请查看代码取消相关注释')
|
||||
captchaTimer.value = window.setInterval(() => {
|
||||
captchaTime.value -= 1
|
||||
captchaBtnName.value = `获取验证码(${captchaTime.value}s)`
|
||||
|
Reference in New Issue
Block a user