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