2026-05-18 09:46:11 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="admin-page">
|
|
|
|
|
|
<div class="page-head">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h2>参数管理</h2>
|
|
|
|
|
|
<p>统一维护地图 Key、短信 MessageHub 对接参数等平台级配置,仅平台管理员可修改。</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<a-button type="primary" @click="openCreate">新增配置</a-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<a-card title="地图服务配置" :bordered="false">
|
|
|
|
|
|
<a-form layout="vertical">
|
2026-05-21 18:43:59 +08:00
|
|
|
|
<a-form-item label="当前地图渠道">
|
|
|
|
|
|
<a-radio-group v-model:value="mapProvider">
|
|
|
|
|
|
<a-radio-button value="TENCENT">腾讯地图</a-radio-button>
|
|
|
|
|
|
<a-radio-button value="AMAP">高德地图</a-radio-button>
|
|
|
|
|
|
</a-radio-group>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="腾讯 Web Key">
|
|
|
|
|
|
<a-input-password v-model:value="mapForms.tencentWeb.configValue" placeholder="用于后台腾讯地图选点和 Web 展示" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="高德 Web Key">
|
|
|
|
|
|
<a-input-password v-model:value="mapForms.amapWeb.configValue" placeholder="用于后台高德地图选点和 Web 展示" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="高德小程序 Key">
|
|
|
|
|
|
<a-input-password v-model:value="mapForms.amapMini.configValue" placeholder="用于后续小程序端高德 SDK / API 调用" />
|
2026-05-18 09:46:11 +08:00
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="备注">
|
2026-05-21 18:43:59 +08:00
|
|
|
|
<a-textarea v-model:value="mapRemark" :rows="2" placeholder="例如:默认使用腾讯地图,高德小程序 Key 单独申请填写" />
|
2026-05-18 09:46:11 +08:00
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item>
|
|
|
|
|
|
<a-space>
|
|
|
|
|
|
<a-switch v-model:checked="mapEnabled" checked-children="启用" un-checked-children="停用" />
|
|
|
|
|
|
<a-button type="primary" :loading="savingMap" @click="saveMapConfig">保存地图配置</a-button>
|
|
|
|
|
|
</a-space>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
</a-form>
|
|
|
|
|
|
</a-card>
|
|
|
|
|
|
|
2026-05-29 13:30:56 +08:00
|
|
|
|
<a-card title="用户默认密码" :bordered="false">
|
|
|
|
|
|
<a-form layout="vertical">
|
|
|
|
|
|
<a-alert
|
|
|
|
|
|
type="info"
|
|
|
|
|
|
show-icon
|
|
|
|
|
|
message="后台新增用户时,密码留空会自动使用这里配置的默认密码。"
|
|
|
|
|
|
class="inline-alert"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<a-form-item label="后台新增用户默认密码">
|
|
|
|
|
|
<a-input-password
|
|
|
|
|
|
v-model:value="defaultPasswordForm.configValue"
|
|
|
|
|
|
placeholder="请输入 8-32 位强密码"
|
|
|
|
|
|
autocomplete="new-password"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="备注">
|
|
|
|
|
|
<a-textarea v-model:value="defaultPasswordForm.remark" :rows="2" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item>
|
|
|
|
|
|
<a-space>
|
|
|
|
|
|
<a-switch v-model:checked="defaultPasswordEnabled" checked-children="启用" un-checked-children="停用" />
|
|
|
|
|
|
<a-button type="primary" :loading="savingDefaultPassword" @click="saveDefaultPasswordConfig">
|
|
|
|
|
|
保存默认密码
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</a-space>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
</a-form>
|
|
|
|
|
|
</a-card>
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
<a-alert
|
|
|
|
|
|
type="info"
|
|
|
|
|
|
show-icon
|
|
|
|
|
|
message="这里不配置 Spug、阿里云等供应商密钥;真实短信通道仍在 MessageHub 中独立管理。"
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
2026-05-29 13:30:56 +08:00
|
|
|
|
<a-table :columns="columns" :data-source="configs" :loading="loading" row-key="id" :scroll="{ x: 'max-content' }">
|
2026-05-18 09:46:11 +08:00
|
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
|
|
|
<template v-if="column.key === 'scene'">
|
|
|
|
|
|
<strong>{{ record.sceneName }}</strong>
|
|
|
|
|
|
<div class="muted">{{ record.sceneCode }}</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="column.key === 'messagehub'">
|
|
|
|
|
|
<div>队列:{{ record.queueName }}</div>
|
|
|
|
|
|
<div class="muted">来源:{{ record.sourceSystem }}</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="column.key === 'template'">
|
|
|
|
|
|
<div>{{ record.templateCode }}</div>
|
|
|
|
|
|
<div class="muted">通道ID:{{ record.channelId || '由 MessageHub 自动选择' }}</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="column.key === 'enabled'">
|
2026-05-21 18:43:59 +08:00
|
|
|
|
<a-switch :checked="record.enabled === 1" @change="(checked: any) => toggleStatus(record as MessageHubPushConfigVO, Boolean(checked))" />
|
2026-05-18 09:46:11 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="column.key === 'action'">
|
|
|
|
|
|
<a-space>
|
|
|
|
|
|
<a-button size="small" @click="openEdit(record as MessageHubPushConfigVO)">编辑</a-button>
|
|
|
|
|
|
<a-button size="small" @click="openTest(record as MessageHubPushConfigVO)">测试</a-button>
|
|
|
|
|
|
</a-space>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-table>
|
|
|
|
|
|
|
2026-05-29 13:30:56 +08:00
|
|
|
|
<a-modal v-model:open="formOpen" :title="editingId ? '编辑配置' : '新增配置'" :mask-closable="false" @ok="submit" :confirm-loading="saving">
|
2026-05-18 09:46:11 +08:00
|
|
|
|
<a-form layout="vertical">
|
|
|
|
|
|
<a-form-item label="业务场景">
|
|
|
|
|
|
<a-select v-model:value="form.sceneCode" :options="sceneOptions" show-search @change="handleSceneChange" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="场景名称">
|
|
|
|
|
|
<a-input v-model:value="form.sceneName" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="MessageHub 队列">
|
|
|
|
|
|
<a-input v-model:value="form.queueName" placeholder="smsQueue" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="来源系统">
|
2026-10-14 13:04:10 +08:00
|
|
|
|
<a-input v-model:value="form.sourceSystem" placeholder="jayucloud-salon" />
|
2026-05-18 09:46:11 +08:00
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="模板编码">
|
|
|
|
|
|
<a-input v-model:value="form.templateCode" placeholder="MessageHub 中维护的模板编码" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="指定通道 ID">
|
|
|
|
|
|
<a-input-number v-model:value="form.channelId" :min="1" style="width: 100%" placeholder="不填则由 MessageHub 选择" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="发送方式">
|
|
|
|
|
|
<a-select v-model:value="form.sendMethod" allow-clear :options="sendMethodOptions" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="备注">
|
|
|
|
|
|
<a-textarea v-model:value="form.remark" :rows="3" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
</a-form>
|
|
|
|
|
|
</a-modal>
|
|
|
|
|
|
|
2026-05-29 13:30:56 +08:00
|
|
|
|
<a-modal v-model:open="testOpen" title="测试投递" :mask-closable="false" @ok="submitTest" :confirm-loading="testing">
|
2026-05-18 09:46:11 +08:00
|
|
|
|
<a-form layout="vertical">
|
|
|
|
|
|
<a-form-item label="测试手机号">
|
|
|
|
|
|
<a-input v-model:value="testPhone" :maxlength="11" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
</a-form>
|
|
|
|
|
|
</a-modal>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
/**
|
|
|
|
|
|
* MessageHubPushConfigsView page script.
|
|
|
|
|
|
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
|
|
|
|
|
|
*/
|
|
|
|
|
|
import { onMounted, reactive, ref } from 'vue'
|
|
|
|
|
|
import { message } from 'ant-design-vue'
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: MessageHubPushConfigVO supports MessageHubPushConfigsView.vue by holding or executing the message hub push config vo page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-29 13:30:56 +08:00
|
|
|
|
import {
|
|
|
|
|
|
adminMessageHubPushConfigApi,
|
|
|
|
|
|
adminSystemParameterConfigApi,
|
|
|
|
|
|
type MessageHubPushConfigVO,
|
|
|
|
|
|
type SystemParameterConfigVO
|
|
|
|
|
|
} from '@/api/admin'
|
2026-05-18 09:46:11 +08:00
|
|
|
|
|
|
|
|
|
|
/** loading is a reactive state variable used by the template and event handlers. */
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
/** saving is a reactive state variable used by the template and event handlers. */
|
|
|
|
|
|
const saving = ref(false)
|
|
|
|
|
|
/** testing is a reactive state variable used by the template and event handlers. */
|
|
|
|
|
|
const testing = ref(false)
|
|
|
|
|
|
/** formOpen is a reactive state variable used by the template and event handlers. */
|
|
|
|
|
|
const formOpen = ref(false)
|
|
|
|
|
|
/** testOpen is a reactive state variable used by the template and event handlers. */
|
|
|
|
|
|
const testOpen = ref(false)
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: editingId supports MessageHubPushConfigsView.vue by holding or executing the editing id page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const editingId = ref<any>()
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: testingId supports MessageHubPushConfigsView.vue by holding or executing the testing id page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const testingId = ref<any>()
|
|
|
|
|
|
/** testPhone is a reactive state variable used by the template and event handlers. */
|
|
|
|
|
|
const testPhone = ref('')
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: configs supports MessageHubPushConfigsView.vue by holding or executing the configs page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const configs = ref<MessageHubPushConfigVO[]>([])
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: savingMap supports MessageHubPushConfigsView.vue by holding or executing the saving map page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const savingMap = ref(false)
|
2026-05-29 13:30:56 +08:00
|
|
|
|
const savingDefaultPassword = ref(false)
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: mapEnabled supports MessageHubPushConfigsView.vue by holding or executing the map enabled page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const mapEnabled = ref(true)
|
2026-05-29 13:30:56 +08:00
|
|
|
|
const defaultPasswordEnabled = ref(true)
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: mapProvider supports MessageHubPushConfigsView.vue by holding or executing the map provider page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-21 18:43:59 +08:00
|
|
|
|
const mapProvider = ref<'TENCENT' | 'AMAP'>('TENCENT')
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: mapRemark supports MessageHubPushConfigsView.vue by holding or executing the map remark page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-21 18:43:59 +08:00
|
|
|
|
const mapRemark = ref('地图渠道由平台管理员选择;高德 Web Key 与高德小程序 Key 分开填写。')
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: createMapForm supports MessageHubPushConfigsView.vue by holding or executing the create map form page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-21 18:43:59 +08:00
|
|
|
|
const createMapForm = (configKey: string, configName: string, remark: string) => ({
|
2026-05-18 09:46:11 +08:00
|
|
|
|
configGroup: 'MAP',
|
2026-05-21 18:43:59 +08:00
|
|
|
|
configKey,
|
|
|
|
|
|
configName,
|
2026-05-18 09:46:11 +08:00
|
|
|
|
configValue: '',
|
|
|
|
|
|
enabled: 1,
|
2026-05-21 18:43:59 +08:00
|
|
|
|
remark
|
|
|
|
|
|
})
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: mapForms supports MessageHubPushConfigsView.vue by holding or executing the map forms page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-21 18:43:59 +08:00
|
|
|
|
const mapForms = reactive({
|
|
|
|
|
|
provider: createMapForm('MAP_PROVIDER', '当前地图渠道', 'TENCENT 或 AMAP;决定后台店铺选点默认使用哪个地图渠道'),
|
|
|
|
|
|
tencentWeb: createMapForm('TENCENT_MAP_KEY', '腾讯 Web Key', '用于后台腾讯地图选点和 Web 展示'),
|
|
|
|
|
|
amapWeb: createMapForm('AMAP_WEB_KEY', '高德 Web Key', '用于后台高德地图选点和 Web 展示'),
|
|
|
|
|
|
amapMini: createMapForm('AMAP_MINI_KEY', '高德小程序 Key', '用于后续小程序端高德 SDK / API 调用')
|
2026-05-18 09:46:11 +08:00
|
|
|
|
})
|
2026-05-29 13:30:56 +08:00
|
|
|
|
const defaultPasswordForm = reactive<SystemParameterConfigVO>({
|
|
|
|
|
|
configGroup: 'USER',
|
|
|
|
|
|
configKey: 'DEFAULT_PASSWORD',
|
|
|
|
|
|
configName: '后台新增用户默认密码',
|
2026-06-10 00:19:49 +08:00
|
|
|
|
configValue: 'Fingertip@123',
|
2026-05-29 13:30:56 +08:00
|
|
|
|
enabled: 1,
|
|
|
|
|
|
remark: '后台新增用户不填写密码时使用;需满足 8-32 位且至少包含数字、小写字母、大写字母、特殊符号中的 3 类'
|
|
|
|
|
|
})
|
2026-05-18 09:46:11 +08:00
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: sceneOptions supports MessageHubPushConfigsView.vue by holding or executing the scene options page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const sceneOptions = [
|
|
|
|
|
|
{ label: '用户注册验证码', value: 'USER_REGISTER_SMS_CODE' },
|
|
|
|
|
|
{ label: '手机号登录验证码', value: 'USER_LOGIN_SMS_CODE' },
|
|
|
|
|
|
{ label: '找回密码验证码', value: 'USER_RESET_PASSWORD_SMS_CODE' },
|
|
|
|
|
|
{ label: '绑定手机号验证码', value: 'USER_BIND_PHONE_SMS_CODE' },
|
|
|
|
|
|
{ label: '修改手机号验证码', value: 'USER_CHANGE_PHONE_SMS_CODE' },
|
|
|
|
|
|
{ label: '修改密码验证码', value: 'USER_CHANGE_PASSWORD_SMS_CODE' }
|
|
|
|
|
|
]
|
|
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: sendMethodOptions supports MessageHubPushConfigsView.vue by holding or executing the send method options page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const sendMethodOptions = [
|
|
|
|
|
|
{ label: 'SPUG', value: 'SPUG' },
|
|
|
|
|
|
{ label: 'OTHER', value: 'OTHER' }
|
|
|
|
|
|
]
|
|
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: form supports MessageHubPushConfigsView.vue by holding or executing the form page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const form = reactive<any>({
|
|
|
|
|
|
sceneCode: 'USER_LOGIN_SMS_CODE',
|
|
|
|
|
|
sceneName: '手机号登录验证码',
|
|
|
|
|
|
platform: 'SMS',
|
|
|
|
|
|
msgType: 'VERIFICATION',
|
|
|
|
|
|
queueName: 'smsQueue',
|
2026-10-14 13:04:10 +08:00
|
|
|
|
sourceSystem: 'jayucloud-salon',
|
2026-05-18 09:46:11 +08:00
|
|
|
|
templateCode: 'SPUG0001',
|
|
|
|
|
|
channelId: undefined,
|
|
|
|
|
|
sendMethod: 'SPUG',
|
|
|
|
|
|
enabled: 1,
|
|
|
|
|
|
remark: ''
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: columns supports MessageHubPushConfigsView.vue by holding or executing the columns page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const columns = [
|
|
|
|
|
|
{ title: '业务场景', key: 'scene' },
|
|
|
|
|
|
{ title: 'MessageHub', key: 'messagehub' },
|
|
|
|
|
|
{ title: '模板/通道', key: 'template' },
|
|
|
|
|
|
{ title: '消息类型', dataIndex: 'msgType', key: 'msgType', width: 110 },
|
|
|
|
|
|
{ title: '启用', key: 'enabled', width: 90 },
|
|
|
|
|
|
{ title: '操作', key: 'action', width: 150 }
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
/** load is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
|
|
|
|
|
const load = async () => {
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
try {
|
2026-05-29 13:30:56 +08:00
|
|
|
|
const [messageConfigs, mapConfigs, userConfigs] = await Promise.all([
|
2026-05-18 09:46:11 +08:00
|
|
|
|
adminMessageHubPushConfigApi.listConfigs(),
|
2026-05-29 13:30:56 +08:00
|
|
|
|
adminSystemParameterConfigApi.listConfigs('MAP'),
|
|
|
|
|
|
adminSystemParameterConfigApi.listConfigs('USER')
|
2026-05-18 09:46:11 +08:00
|
|
|
|
])
|
|
|
|
|
|
configs.value = messageConfigs
|
2026-05-21 18:43:59 +08:00
|
|
|
|
const providerConfig = mapConfigs.find(item => item.configKey === 'MAP_PROVIDER')
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const tencentMapConfig = mapConfigs.find(item => item.configKey === 'TENCENT_MAP_KEY')
|
2026-05-21 18:43:59 +08:00
|
|
|
|
const amapWebConfig = mapConfigs.find(item => item.configKey === 'AMAP_WEB_KEY')
|
|
|
|
|
|
const amapMiniConfig = mapConfigs.find(item => item.configKey === 'AMAP_MINI_KEY')
|
|
|
|
|
|
if (providerConfig?.configValue) {
|
|
|
|
|
|
mapProvider.value = providerConfig.configValue === 'AMAP' ? 'AMAP' : 'TENCENT'
|
|
|
|
|
|
mapEnabled.value = providerConfig.enabled === 1
|
|
|
|
|
|
Object.assign(mapForms.provider, providerConfig)
|
2026-05-18 09:46:11 +08:00
|
|
|
|
}
|
2026-05-21 18:43:59 +08:00
|
|
|
|
if (tencentMapConfig) Object.assign(mapForms.tencentWeb, tencentMapConfig)
|
|
|
|
|
|
if (amapWebConfig) Object.assign(mapForms.amapWeb, amapWebConfig)
|
|
|
|
|
|
if (amapMiniConfig) Object.assign(mapForms.amapMini, amapMiniConfig)
|
2026-05-29 13:30:56 +08:00
|
|
|
|
const defaultPasswordConfig = userConfigs.find(item => item.configKey === 'DEFAULT_PASSWORD')
|
|
|
|
|
|
if (defaultPasswordConfig) {
|
|
|
|
|
|
Object.assign(defaultPasswordForm, defaultPasswordConfig)
|
|
|
|
|
|
defaultPasswordEnabled.value = defaultPasswordConfig.enabled === 1
|
|
|
|
|
|
}
|
2026-05-18 09:46:11 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: saveMapConfig supports MessageHubPushConfigsView.vue by holding or executing the save map config page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-05-18 09:46:11 +08:00
|
|
|
|
const saveMapConfig = async () => {
|
|
|
|
|
|
savingMap.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
await adminSystemParameterConfigApi.saveConfig({
|
2026-05-21 18:43:59 +08:00
|
|
|
|
...mapForms.provider,
|
|
|
|
|
|
configValue: mapProvider.value,
|
|
|
|
|
|
enabled: mapEnabled.value ? 1 : 0
|
|
|
|
|
|
})
|
|
|
|
|
|
await adminSystemParameterConfigApi.saveConfig({
|
|
|
|
|
|
...mapForms.tencentWeb,
|
|
|
|
|
|
enabled: mapEnabled.value ? 1 : 0
|
|
|
|
|
|
})
|
|
|
|
|
|
await adminSystemParameterConfigApi.saveConfig({
|
|
|
|
|
|
...mapForms.amapWeb,
|
|
|
|
|
|
enabled: mapEnabled.value ? 1 : 0
|
|
|
|
|
|
})
|
|
|
|
|
|
await adminSystemParameterConfigApi.saveConfig({
|
|
|
|
|
|
...mapForms.amapMini,
|
2026-05-18 09:46:11 +08:00
|
|
|
|
enabled: mapEnabled.value ? 1 : 0
|
|
|
|
|
|
})
|
|
|
|
|
|
message.success('地图配置已保存')
|
|
|
|
|
|
await load()
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
savingMap.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-29 13:30:56 +08:00
|
|
|
|
const validateDefaultPasswordInput = () => {
|
|
|
|
|
|
const password = defaultPasswordForm.configValue.trim()
|
|
|
|
|
|
if (password.length < 8 || password.length > 32) {
|
|
|
|
|
|
message.warning('默认密码长度需为 8-32 位')
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
const categoryCount = [
|
|
|
|
|
|
/\d/.test(password),
|
|
|
|
|
|
/[a-z]/.test(password),
|
|
|
|
|
|
/[A-Z]/.test(password),
|
|
|
|
|
|
/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)
|
|
|
|
|
|
].filter(Boolean).length
|
|
|
|
|
|
if (categoryCount < 3) {
|
|
|
|
|
|
message.warning('默认密码需至少包含数字、小写字母、大写字母、特殊符号中的 3 类')
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const saveDefaultPasswordConfig = async () => {
|
|
|
|
|
|
if (!validateDefaultPasswordInput()) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
savingDefaultPassword.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
await adminSystemParameterConfigApi.saveConfig({
|
|
|
|
|
|
...defaultPasswordForm,
|
|
|
|
|
|
configValue: defaultPasswordForm.configValue.trim(),
|
|
|
|
|
|
enabled: defaultPasswordEnabled.value ? 1 : 0
|
|
|
|
|
|
})
|
|
|
|
|
|
message.success('默认密码已保存')
|
|
|
|
|
|
await load()
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
savingDefaultPassword.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** resetForm is a local helper used by this page script. */
|
|
|
|
|
|
const resetForm = () => Object.assign(form, {
|
|
|
|
|
|
sceneCode: 'USER_LOGIN_SMS_CODE',
|
|
|
|
|
|
sceneName: '手机号登录验证码',
|
|
|
|
|
|
platform: 'SMS',
|
|
|
|
|
|
msgType: 'VERIFICATION',
|
|
|
|
|
|
queueName: 'smsQueue',
|
2026-10-14 13:04:10 +08:00
|
|
|
|
sourceSystem: 'jayucloud-salon',
|
2026-05-18 09:46:11 +08:00
|
|
|
|
templateCode: 'SPUG0001',
|
|
|
|
|
|
channelId: undefined,
|
|
|
|
|
|
sendMethod: 'SPUG',
|
|
|
|
|
|
enabled: 1,
|
|
|
|
|
|
remark: ''
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
/** handleSceneChange is a local helper used by this page script. */
|
|
|
|
|
|
const handleSceneChange = (value: any) => {
|
|
|
|
|
|
const option = sceneOptions.find(item => item.value === String(value || ''))
|
|
|
|
|
|
if (option) form.sceneName = option.label
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** openCreate is a local helper used by this page script. */
|
|
|
|
|
|
const openCreate = () => { editingId.value = undefined; resetForm(); formOpen.value = true }
|
|
|
|
|
|
/** openEdit is a local helper used by this page script. */
|
|
|
|
|
|
const openEdit = (record: MessageHubPushConfigVO) => {
|
|
|
|
|
|
editingId.value = record.id
|
|
|
|
|
|
Object.assign(form, record)
|
|
|
|
|
|
formOpen.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** submit is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
|
|
|
|
|
const submit = async () => {
|
|
|
|
|
|
if (!form.sceneCode || !form.sceneName || !form.queueName || !form.sourceSystem || !form.templateCode) {
|
|
|
|
|
|
message.warning('请填写场景、队列、来源系统和模板编码')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
saving.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (editingId.value) {
|
|
|
|
|
|
await adminMessageHubPushConfigApi.updateConfig(editingId.value, form)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
await adminMessageHubPushConfigApi.createConfig(form)
|
|
|
|
|
|
}
|
|
|
|
|
|
message.success('配置已保存')
|
|
|
|
|
|
formOpen.value = false
|
|
|
|
|
|
await load()
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
saving.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** toggleStatus is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
|
|
|
|
|
const toggleStatus = async (record: MessageHubPushConfigVO, checked: boolean) => {
|
|
|
|
|
|
await adminMessageHubPushConfigApi.updateStatus(record.id, checked ? 1 : 0)
|
|
|
|
|
|
record.enabled = checked ? 1 : 0
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** openTest is a local helper used by this page script. */
|
|
|
|
|
|
const openTest = (record: MessageHubPushConfigVO) => {
|
|
|
|
|
|
testingId.value = record.id
|
|
|
|
|
|
testPhone.value = ''
|
|
|
|
|
|
testOpen.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** submitTest is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
|
|
|
|
|
const submitTest = async () => {
|
|
|
|
|
|
if (!/^1[3-9]\d{9}$/.test(testPhone.value)) {
|
|
|
|
|
|
message.warning('请输入正确的测试手机号')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
testing.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
await adminMessageHubPushConfigApi.testConfig(testingId.value, testPhone.value)
|
|
|
|
|
|
message.success('测试消息已投递到 MessageHub')
|
|
|
|
|
|
testOpen.value = false
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
testing.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(load)
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.admin-page { display: grid; gap: 18px; }
|
|
|
|
|
|
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
|
|
|
|
|
|
.page-head h2 { margin: 0 0 4px; }
|
2026-05-29 13:30:56 +08:00
|
|
|
|
.page-head p, .muted { margin: 0; color: var(--text-secondary); }
|
|
|
|
|
|
.inline-alert { margin-bottom: 16px; }
|
2026-05-18 09:46:11 +08:00
|
|
|
|
</style>
|