邮件模板设置
This commit is contained in:
parent
178551efba
commit
71bbeb1c94
|
|
@ -15,7 +15,7 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications'
|
|||
VITE_APP_SNAILJOB_ADMIN = '/snail-job'
|
||||
|
||||
# 生产环境
|
||||
VITE_APP_BASE_API = '/prod-api'
|
||||
VITE_APP_BASE_API = '/twk71hc7r9khxy2026v1'
|
||||
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
VITE_BUILD_COMPRESS = gzip
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
"image-conversion": "2.1.1",
|
||||
"js-cookie": "3.0.5",
|
||||
"jsencrypt": "3.5.4",
|
||||
"monaco-editor": "^0.55.1",
|
||||
"nprogress": "0.2.0",
|
||||
"pinia": "3.0.3",
|
||||
"screenfull": "6.0.2",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { IdeaVO, IdeaForm, IdeaQuery } from '@/api/net/idea/types';
|
||||
|
||||
/**
|
||||
* 查询用户反馈列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listIdea = (query?: IdeaQuery): AxiosPromise<IdeaVO[]> => {
|
||||
return request({
|
||||
url: '/net/idea/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询用户反馈详细
|
||||
* @param id
|
||||
*/
|
||||
export const getIdea = (id: string | number): AxiosPromise<IdeaVO> => {
|
||||
return request({
|
||||
url: '/net/idea/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增用户反馈
|
||||
* @param data
|
||||
*/
|
||||
export const addIdea = (data: IdeaForm) => {
|
||||
return request({
|
||||
url: '/net/idea',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改用户反馈
|
||||
* @param data
|
||||
*/
|
||||
export const updateIdea = (data: IdeaForm) => {
|
||||
return request({
|
||||
url: '/net/idea',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除用户反馈
|
||||
* @param id
|
||||
*/
|
||||
export const delIdea = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/net/idea/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
export interface IdeaVO {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
userId: string | number;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
score: number;
|
||||
|
||||
/**
|
||||
* 反馈意见
|
||||
*/
|
||||
ideaContent: string;
|
||||
|
||||
}
|
||||
|
||||
export interface IdeaForm extends BaseEntity {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
userId?: string | number;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
score?: number;
|
||||
|
||||
/**
|
||||
* 反馈意见
|
||||
*/
|
||||
ideaContent?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface IdeaQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
userId?: string | number;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
score?: number;
|
||||
|
||||
/**
|
||||
* 反馈意见
|
||||
*/
|
||||
ideaContent?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
|
@ -14,6 +14,16 @@ export interface InvitationVO {
|
|||
*/
|
||||
invitationName: string;
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*/
|
||||
smsTemplate?: string;
|
||||
|
||||
/**
|
||||
* 邮件模板
|
||||
*/
|
||||
emailTemplate?: string;
|
||||
|
||||
/**
|
||||
* 加速计划ID
|
||||
*/
|
||||
|
|
@ -77,6 +87,11 @@ export interface InvitationForm extends BaseEntity {
|
|||
*/
|
||||
smsTemplate?: string;
|
||||
|
||||
/**
|
||||
* 邮件模板
|
||||
*/
|
||||
emailTemplate?: string;
|
||||
|
||||
/**
|
||||
* 加速计划ID
|
||||
*/
|
||||
|
|
@ -155,162 +170,4 @@ export interface InvitationQuery extends PageQuery {
|
|||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
export interface InvitationVO {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 渠道编号
|
||||
*/
|
||||
invitationCode: string;
|
||||
|
||||
/**
|
||||
* 渠道名称
|
||||
*/
|
||||
invitationName: string;
|
||||
|
||||
/**
|
||||
* 加速计划ID
|
||||
*/
|
||||
planId: string | number;
|
||||
|
||||
/**
|
||||
* 最近多少天
|
||||
*/
|
||||
ipRegisterDay: number;
|
||||
|
||||
/**
|
||||
* 注册多少个
|
||||
*/
|
||||
ipRegisterNum: number;
|
||||
|
||||
/**
|
||||
* 邮箱绑定赠送分钟数
|
||||
*/
|
||||
emailBindGift: number;
|
||||
|
||||
/**
|
||||
* 签到赠送分钟数
|
||||
*/
|
||||
signInGift: number;
|
||||
|
||||
/**
|
||||
* 保护地区
|
||||
*/
|
||||
protectedArea: string;
|
||||
|
||||
/**
|
||||
* 节点选择
|
||||
*/
|
||||
nodeFlag: number;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
}
|
||||
|
||||
export interface InvitationForm extends BaseEntity {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 渠道编号
|
||||
*/
|
||||
invitationCode?: string;
|
||||
|
||||
/**
|
||||
* 渠道名称
|
||||
*/
|
||||
invitationName?: string;
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*/
|
||||
smsTemplate?: string;
|
||||
|
||||
/**
|
||||
* 加速计划ID
|
||||
*/
|
||||
planId?: string | number;
|
||||
|
||||
/**
|
||||
* 最近多少天
|
||||
*/
|
||||
ipRegisterDay?: number;
|
||||
|
||||
/**
|
||||
* 注册多少个
|
||||
*/
|
||||
ipRegisterNum?: number;
|
||||
|
||||
/**
|
||||
* 注册赠送分钟数
|
||||
*/
|
||||
registerGift?: number;
|
||||
|
||||
/**
|
||||
* 绑定手机号赠送分钟数
|
||||
*/
|
||||
phoneBindGift?: number;
|
||||
|
||||
/**
|
||||
* 邮箱绑定赠送分钟数
|
||||
*/
|
||||
emailBindGift?: number;
|
||||
|
||||
/**
|
||||
* 签到赠送分钟数
|
||||
*/
|
||||
signInGift?: number;
|
||||
|
||||
/**
|
||||
* 保护地区
|
||||
*/
|
||||
protectedArea?: string;
|
||||
|
||||
/**
|
||||
* 节点选择
|
||||
*/
|
||||
nodeFlag?: number;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface InvitationQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 渠道编号
|
||||
*/
|
||||
invitationCode?: string;
|
||||
|
||||
/**
|
||||
* 渠道名称
|
||||
*/
|
||||
invitationName?: string;
|
||||
|
||||
/**
|
||||
* 加速计划ID
|
||||
*/
|
||||
planId?: string | number;
|
||||
|
||||
/**
|
||||
* 保护地区
|
||||
*/
|
||||
protectedArea?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +50,18 @@ export const updatePlan = (data: PlanForm) => {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改加速计划
|
||||
* @param data
|
||||
*/
|
||||
export const configVm = (data: PlanForm) => {
|
||||
return request({
|
||||
url: '/net/plan/configVm',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除加速计划
|
||||
* @param id
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@ export interface PlanVO {
|
|||
*/
|
||||
groupIds?: string | number;
|
||||
|
||||
/**
|
||||
* 配置模板
|
||||
*/
|
||||
configVm?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface PlanForm extends BaseEntity {
|
||||
|
|
@ -77,6 +82,11 @@ export interface PlanForm extends BaseEntity {
|
|||
*/
|
||||
groupIds?: string | number;
|
||||
|
||||
/**
|
||||
* 配置模板
|
||||
*/
|
||||
configVm?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface PlanQuery extends PageQuery {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,226 @@
|
|||
<template>
|
||||
<div class="p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input v-model="queryParams.userId" placeholder="请输入用户ID" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分数" prop="score">
|
||||
<el-input v-model="queryParams.score" placeholder="请输入分数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['net:idea:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['net:idea:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['net:idea:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['net:idea:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="ideaList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="ID" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="用户ID" align="center" prop="userId" />
|
||||
<el-table-column label="分数" align="center" prop="score" />
|
||||
<el-table-column label="反馈意见" align="center" prop="ideaContent" />
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['net:idea:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['net:idea:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
<!-- 添加或修改用户反馈对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="ideaFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分数" prop="score">
|
||||
<el-input v-model="form.score" placeholder="请输入分数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="反馈意见">
|
||||
<editor v-model="form.ideaContent" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Idea" lang="ts">
|
||||
import { listIdea, getIdea, delIdea, addIdea, updateIdea } from '@/api/net/idea';
|
||||
import { IdeaVO, IdeaQuery, IdeaForm } from '@/api/net/idea/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const ideaList = ref<IdeaVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const ideaFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: IdeaForm = {
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
score: undefined,
|
||||
ideaContent: undefined,
|
||||
}
|
||||
const data = reactive<PageData<IdeaForm, IdeaQuery>>({
|
||||
form: {...initFormData},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
userId: undefined,
|
||||
score: undefined,
|
||||
ideaContent: undefined,
|
||||
params: {
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询用户反馈列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listIdea(queryParams.value);
|
||||
ideaList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
ideaFormRef.value?.resetFields();
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: IdeaVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加用户反馈";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: IdeaVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const res = await getIdea(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改用户反馈";
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
ideaFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateIdea(form.value).finally(() => buttonLoading.value = false);
|
||||
} else {
|
||||
await addIdea(form.value).finally(() => buttonLoading.value = false);
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: IdeaVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除用户反馈编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await delIdea(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
await getList();
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('net/idea/export', {
|
||||
...queryParams.value
|
||||
}, `idea_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -92,6 +92,9 @@
|
|||
<el-form-item label="短信模板" prop="smsTemplate">
|
||||
<el-input v-model="form.smsTemplate" placeholder="请输入短信模板" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮件模板" prop="emailTemplate">
|
||||
<el-input v-model="form.emailTemplate" placeholder="请输入邮件模板" />
|
||||
</el-form-item>
|
||||
<el-form-item label="加速计划" prop="planId">
|
||||
<el-select v-model="form.planId" placeholder="加速计划" clearable>
|
||||
<el-option v-for="plan in planList" :key="plan.id" :label="plan.planName" :value="plan.id" />
|
||||
|
|
|
|||
|
|
@ -181,16 +181,6 @@
|
|||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="UDP支持" prop="udpFlag">
|
||||
<el-select v-model="form.udpFlag" placeholder="请选择UDP支持">
|
||||
<el-option
|
||||
v-for="dict in net_true_false"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开启状态" prop="enableFlag">
|
||||
<el-radio-group v-model="form.enableFlag">
|
||||
<el-radio
|
||||
|
|
@ -213,7 +203,27 @@
|
|||
<el-form-item label="带宽(Mb)" prop="bandWidth">
|
||||
<el-input v-model="form.bandWidth" placeholder="请输入带宽(Mb)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="网络协议" prop="streamType">
|
||||
<el-form-item label="加密算法" prop="encAlg" v-if="form.protocolType=='shadowsocks'">
|
||||
<el-select v-model="form.encAlg" placeholder="请选择加密算法">
|
||||
<el-option
|
||||
v-for="dict in net_enc_alg"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="UDP支持" prop="udpFlag" v-if="form.protocolType=='vless'">
|
||||
<el-select v-model="form.udpFlag" placeholder="请选择UDP支持">
|
||||
<el-option
|
||||
v-for="dict in net_true_false"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="网络协议" prop="streamType" v-if="form.protocolType=='vless'">
|
||||
<el-select v-model="form.streamType" placeholder="请选择网络协议">
|
||||
<el-option
|
||||
v-for="dict in net_stream_type"
|
||||
|
|
@ -223,7 +233,7 @@
|
|||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="加密方式" prop="tlsType">
|
||||
<el-form-item label="加密方式" prop="tlsType" v-if="form.protocolType=='vless'">
|
||||
<el-select v-model="form.tlsType" placeholder="请选择加密方式">
|
||||
<el-option
|
||||
v-for="dict in net_tls_type"
|
||||
|
|
@ -270,9 +280,6 @@
|
|||
<el-form-item label="grpc名称" prop="serviceName" v-if="form.streamType=='grpc'">
|
||||
<el-input v-model="form.serviceName" placeholder="请输入grpc服务名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="加密算法" prop="encAlg" v-if="false">
|
||||
<el-input v-model="form.encAlg" placeholder="请输入加密算法" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
|
|
@ -291,7 +298,7 @@ import { listAll } from '@/api/net/serverRoute';
|
|||
import { ServerRouteVO } from '@/api/net/serverRoute/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { net_tls_type, net_stream_type, net_enable_flag, net_true_false, net_flow, net_protocol_type, net_flow_type } = toRefs<any>(proxy?.useDict('net_tls_type', 'net_stream_type', 'net_enable_flag', 'net_true_false', 'net_flow', 'net_protocol_type', 'net_flow_type'));
|
||||
const { net_tls_type, net_stream_type, net_enable_flag, net_true_false, net_flow, net_protocol_type, net_flow_type, net_enc_alg } = toRefs<any>(proxy?.useDict('net_tls_type', 'net_stream_type', 'net_enable_flag', 'net_true_false', 'net_flow', 'net_protocol_type', 'net_flow_type', 'net_enc_alg'));
|
||||
|
||||
const nodeList = ref<NodeVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
|
|
@ -403,9 +410,6 @@ const data = reactive<PageData<NodeForm, NodeQuery>>({
|
|||
protocolType: [
|
||||
{ required: true, message: "加速协议不能为空", trigger: "change" }
|
||||
],
|
||||
udpFlag: [
|
||||
{ required: true, message: "UDP支持不能为空", trigger: "change" }
|
||||
],
|
||||
enableFlag: [
|
||||
{ required: true, message: "开启状态不能为空", trigger: "change" }
|
||||
],
|
||||
|
|
|
|||
|
|
@ -18,31 +18,86 @@
|
|||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="panel" style="margin-top: 20px;">
|
||||
<h4 class="panel-title">clash配置模板(https://clash.wiki/configuration/introduction.html)</h4>
|
||||
<el-form :model="planInfo">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="24">
|
||||
<div ref="editorContainer" style="height: 600px; border: 1px solid #ddd;"></div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PlanRule" lang="ts">
|
||||
import { getPlan } from '@/api/net/plan';
|
||||
import { PlanVO, PlanQuery, PlanForm } from '@/api/net/plan/types';
|
||||
import { getPlan, configVm } from '@/api/net/plan';
|
||||
import { PlanVO } from '@/api/net/plan/types';
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const route = useRoute();
|
||||
|
||||
let planIdParam = "";
|
||||
let editor: monaco.editor.IStandaloneCodeEditor | null = null;
|
||||
const editorContainer = ref<HTMLElement>();
|
||||
|
||||
const planInfo = ref<PlanVO>({
|
||||
id: ''
|
||||
});
|
||||
|
||||
const initEditor = () => {
|
||||
if (editorContainer.value && !editor) {
|
||||
editor = monaco.editor.create(editorContainer.value, {
|
||||
value: planInfo.value.configVm || '',
|
||||
language: 'yaml',
|
||||
theme: 'vs-light',
|
||||
automaticLayout: true,
|
||||
minimap: { enabled: false },
|
||||
scrollBeyondLastLine: false,
|
||||
});
|
||||
|
||||
editor.onDidChangeModelContent(() => {
|
||||
planInfo.value.configVm = editor?.getValue() || '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const getPlanInfo = async () => {
|
||||
const planId = route.params && route.params.planId;
|
||||
if (planId) {
|
||||
const res = await getPlan(planId as string);
|
||||
planInfo.value = res.data;
|
||||
|
||||
nextTick(() => {
|
||||
initEditor();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const saveClick = async () => {
|
||||
if (!planInfo.value.id) {
|
||||
proxy?.$modal.msgError('计划ID不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
await configVm({
|
||||
id: planInfo.value.id,
|
||||
configVm: planInfo.value.configVm
|
||||
});
|
||||
proxy?.$modal.msgSuccess('保存成功');
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getPlanInfo();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (editor) {
|
||||
editor.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue