可信代码库-订阅操作添加预警手机号和预警邮件地址
This commit is contained in:
@@ -40,12 +40,12 @@
|
||||
<!-- <span>API接口</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </d-button>-->
|
||||
<!-- <d-button class="jyh-button1" variant="solid" @click="handleLogin('login')">-->
|
||||
<!-- <div class="flex flex-center">-->
|
||||
<!-- <img style="height: 15px;margin-right: 8px" width="16" :src="icon_helper" />-->
|
||||
<!-- <span>帮助文档</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </d-button>-->
|
||||
<d-button class="jyh-button1" variant="solid" @click="handleHelp">
|
||||
<div class="flex flex-center">
|
||||
<img style="height: 15px;margin-right: 8px" width="16" :src="icon_helper" />
|
||||
<span>帮助文档</span>
|
||||
</div>
|
||||
</d-button>
|
||||
|
||||
<template v-if="!isLogin">
|
||||
<d-button @click="handleLogin('register')" class="min-w-[64px]">注册</d-button>
|
||||
@@ -126,6 +126,23 @@ const gotoAIHome = (row) => {
|
||||
router.push({ name: 'aihome' });
|
||||
};
|
||||
|
||||
const handleHelp = () => {
|
||||
// 方法功能:跳转到帮助页面
|
||||
try {
|
||||
// 使用 window.location.href 实现页面跳转
|
||||
// window.location.href = 'http://222.20.126.208:4399/';
|
||||
|
||||
// 或者使用 window.open 打开新标签页
|
||||
window.open('http://222.20.126.208:4399/', '_blank');
|
||||
|
||||
console.log('正在跳转到帮助页面');
|
||||
} catch (error) {
|
||||
console.error('跳转失败:', error);
|
||||
// 可以在此处添加错误提示(如使用 Message 组件)
|
||||
// Message.error('跳转帮助页面失败,请手动访问该链接');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* store 用户信息 */
|
||||
/* @test 后面将清除 */
|
||||
|
||||
@@ -6,6 +6,16 @@
|
||||
<d-form-item field="subscribeType" label="通知方式">
|
||||
<d-checkbox-group name="subscribeType" v-model="formData.subscribeType" :options="subscribeTypeOptions" direction="row"></d-checkbox-group>
|
||||
</d-form-item>
|
||||
|
||||
<!-- 预警手机号 - 当选择短信时显示 -->
|
||||
<d-form-item field="warningMobile" label="预警手机号" v-if="showWarningMobile">
|
||||
<d-input v-model="formData.warningMobile" placeholder="请输入接收短信的手机号" />
|
||||
</d-form-item>
|
||||
|
||||
<!-- 预警邮箱 - 当选择邮件时显示 -->
|
||||
<d-form-item field="warningEmail" label="预警邮箱" v-if="showWarningEmail">
|
||||
<d-input v-model="formData.warningEmail" placeholder="请输入接收邮件的邮箱" />
|
||||
</d-form-item>
|
||||
</d-form>
|
||||
</div>
|
||||
<div class="subscribe-operation mt-5">
|
||||
@@ -19,6 +29,7 @@
|
||||
import { subscribeSoftware } from '@/api/jyh';
|
||||
import { computed, ref } from 'vue';
|
||||
import { Message } from 'vue-devui';
|
||||
import { useAccountStore } from '@/stores/user';
|
||||
const subscribeTypeOptions = [
|
||||
{ name: '短信', value: 'mobileSwitch', id: 1 },
|
||||
{ name: '邮件', value: 'emailSwitch', id: 2 },
|
||||
@@ -26,13 +37,40 @@ const subscribeTypeOptions = [
|
||||
];
|
||||
const props = defineProps(['softwareData']);
|
||||
const emit = defineEmits(['close','closeSub']);
|
||||
|
||||
const userInfo = useAccountStore();
|
||||
const {accountInfo} = userInfo;
|
||||
debugger
|
||||
|
||||
const formRef = ref(null);
|
||||
const formData = ref({
|
||||
subscribeType: [],
|
||||
warningMobile: accountInfo.warningMobile||'',
|
||||
warningEmail: accountInfo.warningEmail||'',
|
||||
});
|
||||
|
||||
const rules = {
|
||||
subscribeType: [{ type: 'array', required: true, message: '请至少选择一种通知方式', trigger: 'change' }],
|
||||
warningMobile: [
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的11位手机号码', trigger: 'blur' },
|
||||
{ required: true, message: '请输入预警手机号', trigger: 'blur' }
|
||||
],
|
||||
warningEmail: [
|
||||
{ type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' },
|
||||
{ required: true, message: '请输入预警邮箱', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
|
||||
// 计算属性 - 控制输入框显示
|
||||
const showWarningMobile = computed(() => {
|
||||
return formData.value.subscribeType.some(item => item.value === 'mobileSwitch');
|
||||
});
|
||||
|
||||
const showWarningEmail = computed(() => {
|
||||
return formData.value.subscribeType.some(item => item.value === 'emailSwitch');
|
||||
});
|
||||
|
||||
|
||||
const sendSubscribe = async () => {
|
||||
let alertType = {};
|
||||
formData.value.subscribeType.forEach(item => {
|
||||
@@ -42,6 +80,8 @@ const sendSubscribe = async () => {
|
||||
softwareId: props.softwareData.id,
|
||||
status: '1',
|
||||
alertType,
|
||||
warningMobile: formData.value.warningMobile,
|
||||
warningEmail: formData.value.warningEmail
|
||||
}).catch(err => {
|
||||
Message({
|
||||
message: err.error,
|
||||
|
||||
Reference in New Issue
Block a user