|
@@ -14,13 +14,18 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <el-input type="textarea" :rows="3" v-model="param.message" placeholder="在此输入要发送的消息。"></el-input>
|
|
|
- <div style="height: 10px"></div>
|
|
|
- <el-input type="number" size="small" v-model="param.refreshDelay" style="width: 150px"
|
|
|
- placeholder="不刷新请勿填写"></el-input> 秒后刷新全体连接
|
|
|
- <div style="margin-top: 12px">
|
|
|
- <el-button type="primary" icon="Upload" @click="beforeSend">发送消息</el-button>
|
|
|
- </div>
|
|
|
+ <el-input type="textarea"
|
|
|
+ :rows
|
|
|
+ @keydown.ctrl.enter="beforeSend"
|
|
|
+ v-model="param.message"
|
|
|
+ placeholder="在此输入要发送的消息。(发送快捷键 Ctrl + Enter)"></el-input>
|
|
|
+ <template #footer>
|
|
|
+ <el-button type="primary"
|
|
|
+ icon="Upload"
|
|
|
+ @click="beforeSend">
|
|
|
+ 发送消息
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
@@ -28,11 +33,14 @@
|
|
|
<template #header>
|
|
|
发送系统更新消息
|
|
|
</template>
|
|
|
- <el-input type="textarea" :rows="3" v-model="systemUpdatesMessage"
|
|
|
- placeholder="在此输入要发送的消息,如果不填写就是清空消息。"/>
|
|
|
- <div style="margin-top: 12px">
|
|
|
+ <el-input type="textarea"
|
|
|
+ @keydown.ctrl.enter="clickSendUpdateMessage"
|
|
|
+ :rows
|
|
|
+ v-model="systemUpdatesMessage"
|
|
|
+ placeholder="在此输入要发送的消息,如果不填写就是清空消息。(发送快捷键 Ctrl + Enter)"/>
|
|
|
+ <template #footer>
|
|
|
<el-button type="primary" icon="Upload" @click="clickSendUpdateMessage">发送消息</el-button>
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
<el-col :span="12" style="margin-top: 10px">
|
|
@@ -40,11 +48,14 @@
|
|
|
<template #header>
|
|
|
发送滚动通知
|
|
|
</template>
|
|
|
- <el-input type="textarea" :rows="3" v-model="scrollingMessage"
|
|
|
- placeholder="在此输入要发送的消息,如果不填写就是清空消息。"/>
|
|
|
- <div style="margin-top: 12px">
|
|
|
+ <el-input type="textarea"
|
|
|
+ :rows
|
|
|
+ v-model="scrollingMessage"
|
|
|
+ @keydown.ctrl.enter="clickSendScrollingMessages"
|
|
|
+ placeholder="在此输入要发送的消息,如果不填写就是清空消息。(发送快捷键 Ctrl + Enter)"/>
|
|
|
+ <template #footer>
|
|
|
<el-button type="primary" icon="Upload" @click="clickSendScrollingMessages">发送消息</el-button>
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -52,57 +63,62 @@
|
|
|
</el-container>
|
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
-import {onMounted, ref, computed, reactive} from 'vue'
|
|
|
+<script setup lang="tsx">
|
|
|
+import {onMounted, ref, reactive} from 'vue'
|
|
|
import {
|
|
|
getOnlineCount,
|
|
|
sendMessageToAll,
|
|
|
sendScrollingMessages,
|
|
|
sendSystemUpdatesMessage
|
|
|
} from '@/api/settings/send-notification'
|
|
|
-import {ElMessage, ElMessageBox} from 'element-plus'
|
|
|
+import {ElMessage} from 'element-plus'
|
|
|
import {getSystemAnnouncement} from "@/api/public-api";
|
|
|
-import {useSystemStore} from "@/pinia/system-store";
|
|
|
+import {CyMessageBox} from "@/components/cy/message-box";
|
|
|
+import XEUtils from "xe-utils";
|
|
|
+import {stringIsBlank} from "@/utils/blank-utils";
|
|
|
+import {xcMessage} from "@/utils/xiaochan-element-plus";
|
|
|
+
|
|
|
|
|
|
-const isCollapse = useSystemStore().getCollapse
|
|
|
-const left = computed(() => {
|
|
|
- return isCollapse.value ? '65px' : '220px'
|
|
|
-})
|
|
|
const onlineCount = ref(10)
|
|
|
-const param = reactive({
|
|
|
+const param = reactive<{
|
|
|
+ message: null | string,
|
|
|
+ refreshDelay: null | number,
|
|
|
+}>({
|
|
|
message: null,
|
|
|
refreshDelay: null,
|
|
|
})
|
|
|
|
|
|
+const rows = 7
|
|
|
+
|
|
|
const beforeSend = () => {
|
|
|
- if (!param.message) {
|
|
|
- ElMessage({
|
|
|
- message: '消息体不能为空!',
|
|
|
- type: 'warning',
|
|
|
- duration: 2500,
|
|
|
- showClose: true,
|
|
|
- })
|
|
|
+ if (stringIsBlank(param.message)) {
|
|
|
+ xcMessage.warning('消息体不能为空!')
|
|
|
} else {
|
|
|
- ElMessageBox.confirm('确定要发送以下消息吗:' + param.message, '提示', {
|
|
|
- type: 'info',
|
|
|
- confirmButtonText: '发送',
|
|
|
- cancelButtonText: '取消',
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- sendMessageToAll(param).then(() => {
|
|
|
- ElMessage({
|
|
|
- message: '发送成功。',
|
|
|
- type: 'success',
|
|
|
- duration: 2500,
|
|
|
- showClose: true,
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
+ CyMessageBox.prompt({
|
|
|
+ title: '是否发送以下消息',
|
|
|
+ message: (
|
|
|
+ <pre class={'pre-css'}>{param.message}</pre>
|
|
|
+ ),
|
|
|
+ inputAllowEmpty: true,
|
|
|
+ placeholder: '刷新页面秒数(不刷新请勿填写)'
|
|
|
+ }).then(({value}) => {
|
|
|
+ if (stringIsBlank(value)) {
|
|
|
+ param.refreshDelay = null;
|
|
|
+ } else {
|
|
|
+ param.refreshDelay = XEUtils.toNumber(value)
|
|
|
+ }
|
|
|
+ sendMessageToAll(param).then(() => {
|
|
|
+ ElMessage({
|
|
|
+ message: '发送成功。',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
})
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
-const dialogVisible = true
|
|
|
|
|
|
const systemUpdatesMessage = ref('')
|
|
|
const clickSendUpdateMessage = () => {
|
|
@@ -119,8 +135,8 @@ onMounted(() => {
|
|
|
onlineCount.value = res
|
|
|
})
|
|
|
getSystemAnnouncement().then((res) => {
|
|
|
- systemUpdatesMessage.value = res.systemUpdatesMessage
|
|
|
- scrollingMessage.value = res.scrollingMessages
|
|
|
+ systemUpdatesMessage.value = res['systemUpdatesMessage']
|
|
|
+ scrollingMessage.value = res['scrollingMessages']
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -133,17 +149,11 @@ onMounted(() => {
|
|
|
align-items: center;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-/* 去掉input number的上下箭头 */
|
|
|
-:deep(input::-webkit-outer-spin-button) {
|
|
|
- -webkit-appearance: none !important;
|
|
|
-}
|
|
|
-
|
|
|
-:deep(input::-webkit-inner-spin-button) {
|
|
|
- -webkit-appearance: none !important;
|
|
|
-}
|
|
|
-
|
|
|
-:deep(input[type='number']) {
|
|
|
- -moz-appearance: textfield !important;
|
|
|
+.pre-css {
|
|
|
+ margin-top: 16px;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #303133;
|
|
|
+ white-space: pre-wrap;
|
|
|
}
|
|
|
</style>
|