chroe: adjust page js code

This commit is contained in:
engigu
2024-01-18 21:38:16 +08:00
parent b20279860a
commit c3c5acd585
15 changed files with 28 additions and 165 deletions
+12 -31
View File
@@ -1,38 +1,19 @@
class CommonUtils { class CommonUtils {
static formatInsConfigDisplay = (scope) => {
// static getCurlString(task_id, options) { if (!scope.row.config) {
// let data = { task_id: task_id }; return ""
// data.title = 'message title'; }
// data.text = 'Hello World!'; if (scope.row.way_type == "Email") {
// if (options.html) { let config = JSON.parse(scope.row.config)
// data.html = '<h1> Hello World! </h1>'; let info = `发送账号:${config.to_account}`
// } return info
// if (options.markdown) { } else {
// data.html = '**Hello World!**'; return "暂无"
// } }
// let dataStr = JSON.stringify(data, null, 4); }
// let example = `curl -X POST --location '${gethttpOrigin()}/api/v1/message/send' \\
// --header 'Content-Type: application/json' \\
// --data '${dataStr}'`;
// return example;
// }
static formatInsConfigDisplay = (scope) => {
if (!scope.row.config) {
return ""
}
if (scope.row.way_type == "Email") {
let config = JSON.parse(scope.row.config)
let info = `发送账号:${config.to_account}`
return info
} else {
return "暂无"
}
}
} }
@@ -14,7 +14,6 @@ import { defineComponent } from 'vue';
export default defineComponent({ export default defineComponent({
methods: { methods: {
handleDelete() { handleDelete() {
// 触发自定义事件
this.$emit('customHandleDelete'); this.$emit('customHandleDelete');
} }
} }
+8 -21
View File
@@ -3,7 +3,6 @@
<el-menu :collapse="isCollapse" breakpoint="768px" mode="horizontal" @select="handleSelect()" <el-menu :collapse="isCollapse" breakpoint="768px" mode="horizontal" @select="handleSelect()"
:default-active="currActivate()" :ellipsis="false" :menu-width="'auto'"> :default-active="currActivate()" :ellipsis="false" :menu-width="'auto'">
<el-menu-item index="0" :disabled="false"> <el-menu-item index="0" :disabled="false">
<!-- <div class="title-logo" v-html="titleLogo"></div> -->
<img style="width: 60px" class="title-logo" :src="titleLogo" alt="Message logo" /> <img style="width: 60px" class="title-logo" :src="titleLogo" alt="Message logo" />
</el-menu-item> </el-menu-item>
@@ -34,23 +33,10 @@ export default {
titleLogo: '', titleLogo: '',
}); });
const menuData = reactive([ const menuData = reactive([
{ { id: '1', title: '发信日志', path: '/sendlogs' },
id: '1', { id: '2', title: '发信任务', path: '/sendtasks' },
title: '发信日志', { id: '3', title: '发信渠道', path: '/sendways' },
path: '/sendlogs', { id: '4', title: '设置', path: '/settings' },
}, {
id: '2',
title: '发信任务',
path: '/sendtasks',
}, {
id: '3',
title: '发信渠道',
path: '/sendways',
}, {
id: '4',
title: '设置',
path: '/settings',
},
]); ]);
const checkIsLogin = () => { const checkIsLogin = () => {
@@ -118,7 +104,6 @@ export default {
font-size: 15px; font-size: 15px;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.el-menu-item li { .el-menu-item li {
@@ -132,7 +117,8 @@ export default {
.logout-btn { .logout-btn {
margin: auto 40px auto 40px; margin: auto 40px auto 40px;
float: right; float: right;
/* background-color: #f7efee; /*
background-color: #f7efee;
border: none; border: none;
padding: 10px 20px; padding: 10px 20px;
text-align: center; text-align: center;
@@ -140,6 +126,7 @@ export default {
font-size: 16px; font-size: 16px;
cursor: pointer; cursor: pointer;
border-radius: 5px; border-radius: 5px;
transition: background-color 0.3s ease; */ transition: background-color 0.3s ease;
*/
} }
</style> </style>
-1
View File
@@ -71,7 +71,6 @@ export default {
// 注册 // 注册
const clickRegister = () => { const clickRegister = () => {
ElMessage({ message: `暂未开放注册!`, type: 'error' }) ElMessage({ message: `暂未开放注册!`, type: 'error' })
}; };
return { ...toRefs(state), clickLogin, clickRegister, pageState }; return { ...toRefs(state), clickLogin, clickRegister, pageState };
@@ -138,7 +138,6 @@ hr {
margin-top: -10vh; margin-top: -10vh;
} }
.pagination-block { .pagination-block {
margin-top: 30px; margin-top: 30px;
display: flex; display: flex;
@@ -51,7 +51,6 @@
<script > <script >
import { computed, ref, reactive, toRefs, onMounted } from 'vue' import { computed, ref, reactive, toRefs, onMounted } from 'vue'
// import { InfoFilled } from '@element-plus/icons-vue'
import { usePageState } from '@/store/page_sate'; import { usePageState } from '@/store/page_sate';
import { request } from '@/api/api' import { request } from '@/api/api'
import addTaskPopUpComponent from './view/addTaskPopUp.vue' import addTaskPopUpComponent from './view/addTaskPopUp.vue'
@@ -67,7 +66,6 @@ export default {
editTaskPopUpComponent, editTaskPopUpComponent,
tableDeleteButton, tableDeleteButton,
viewTaskAPIPopUpComponent, viewTaskAPIPopUpComponent,
// InfoFilled,
}, },
setup() { setup() {
const pageState = usePageState(); const pageState = usePageState();
@@ -125,6 +123,7 @@ export default {
await queryListData(pageNum, state.pageSize); await queryListData(pageNum, state.pageSize);
} }
const rowStyle = () => { const rowStyle = () => {
return { return {
'font-size': '13px', 'font-size': '13px',
@@ -139,6 +138,7 @@ export default {
await queryListData(state.currPage, state.pageSize, state.search, state.optionValue); await queryListData(state.currPage, state.pageSize, state.search, state.optionValue);
} }
const clickAdd = () => { const clickAdd = () => {
pageState.ShowDialogData[state.addTaskPopUpComponentName] = {}; pageState.ShowDialogData[state.addTaskPopUpComponentName] = {};
pageState.ShowDialogData[state.addTaskPopUpComponentName].isShow = true; pageState.ShowDialogData[state.addTaskPopUpComponentName].isShow = true;
@@ -155,7 +155,6 @@ export default {
await queryListData(1, state.pageSize); await queryListData(1, state.pageSize);
}); });
return { return {
...toRefs(state), handleEdit, handleDelete, handleViewAPI, handleViewLogs, ...toRefs(state), handleEdit, handleDelete, handleViewAPI, handleViewLogs,
clickAdd, rowStyle, handPageChange, filterFunc clickAdd, rowStyle, handPageChange, filterFunc
@@ -164,7 +163,6 @@ export default {
} }
</script> </script>
<style scoped> <style scoped>
hr { hr {
color: #FAFCFF; color: #FAFCFF;
@@ -19,7 +19,6 @@
<el-button @click="handleEditTask()" size="small" type="primary" style="margin-left: 20px;">修改</el-button> <el-button @click="handleEditTask()" size="small" type="primary" style="margin-left: 20px;">修改</el-button>
</div> </div>
<div class="dashed" /> <div class="dashed" />
<div class="ins-area"> <div class="ins-area">
@@ -101,7 +100,7 @@
<script> <script>
import { defineComponent, onMounted, watch, reactive, toRefs } from 'vue'; import { defineComponent, onMounted, watch, reactive, toRefs } from 'vue';
import { _, intersection } from 'lodash'; import { _ } from 'lodash';
import { QuestionFilled } from '@element-plus/icons-vue' import { QuestionFilled } from '@element-plus/icons-vue'
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { usePageState } from '@/store/page_sate.js'; import { usePageState } from '@/store/page_sate.js';
@@ -101,7 +101,7 @@ export default defineComponent({
}); });
setTimeout(() => { setTimeout(() => {
Prism.highlightAll() Prism.highlightAll()
}, 10) }, 100)
} }
return { return {
@@ -115,51 +115,5 @@ export default defineComponent({
.language-javascript { .language-javascript {
background-color: #f0f0f0; background-color: #f0f0f0;
} }
/* pre {
overflow: hidden !important;
code{
display: inline-block;
padding-bottom: 20px;
position: relative;
top: 20px;
}
&::before {
content: "";
position: absolute;
background: red;
width: 10px;
height: 10px;
border-radius: 50%;
top: 10px;
left: 15px;
transform: translate(-50%);
}
&::after {
content: "";
position: absolute;
background: sandybrown;
width: 10px;
height: 10px;
border-radius: 50%;
top: 10px;
left: 30px;
transform: translate(-50%);
}
code:first-child{
&::after{
content: "";
position: absolute;
background: limegreen;
width: 10px;
height: 10px;
border-radius: 50%;
top: -24px;
left: -7px;
transform: translate(-50%);
}
}
} */
</style> </style>
@@ -49,7 +49,6 @@
<addWayComponent :componentName="addWayComponentName" /> <addWayComponent :componentName="addWayComponentName" />
<editWayComponent :componentName="editWayComponentName" /> <editWayComponent :componentName="editWayComponentName" />
</div> </div>
</div> </div>
</template> </template>
@@ -117,20 +116,20 @@ export default {
await queryListData(pageNum, state.pageSize); await queryListData(pageNum, state.pageSize);
} }
const rowStyle = () => { const rowStyle = () => {
return { return {
'font-size': '13px', 'font-size': '13px',
} }
} }
const filterFunc = async () => { const filterFunc = async () => {
// console.log('state.optionValue', state.optionValue);
await queryListData(state.currPage, state.pageSize, state.search, state.optionValue); await queryListData(state.currPage, state.pageSize, state.search, state.optionValue);
} }
const clickAdd = () => { const clickAdd = () => {
pageState.ShowDialogData[state.addWayComponentName] = {}; pageState.ShowDialogData[state.addWayComponentName] = {};
pageState.ShowDialogData[state.addWayComponentName].isShow = true; pageState.ShowDialogData[state.addWayComponentName].isShow = true;
// console.log('clickAdd', pageState.ShowDialogData[state.addWayComponentName].isShow)
} }
const queryListData = async (page, size, name = '', type = '') => { const queryListData = async (page, size, name = '', type = '') => {
@@ -114,7 +114,6 @@ export default defineComponent({
handleCancer(); handleCancer();
window.location.reload(); window.location.reload();
} }
} }
return { return {
@@ -125,15 +124,5 @@ export default defineComponent({
</script> </script>
<style scoped> <style scoped>
/* :global(.el-dialog) {
width: 500px;
} */
/* :global(.el-dialog__title) {
font-size: 14px;
}
:global(.el-dialog label) {
font-size: 13px;
} */
</style> </style>
@@ -7,13 +7,11 @@
<el-tabs class="demo-tabs" @tab-click="handleClick"> <el-tabs class="demo-tabs" @tab-click="handleClick">
<el-form label-width="100px" v-for="item in waysLabelData"> <el-form label-width="100px" v-for="item in waysLabelData">
<!-- <el-tab-pane :label="item.label" :name="item.type"> -->
<el-form-item :label="one.subLabel" v-for="one in item.inputs"> <el-form-item :label="one.subLabel" v-for="one in item.inputs">
<el-input v-if="one.isTextArea != true" size="small" v-model="one.value" :placeholder="one.desc" /> <el-input v-if="one.isTextArea != true" size="small" v-model="one.value" :placeholder="one.desc" />
<el-input v-if="one.isTextArea == true" size="small" type="textarea" v-model="one.value" <el-input v-if="one.isTextArea == true" size="small" type="textarea" v-model="one.value"
:placeholder="one.desc" :autosize="{ minRows: 4, maxRows: 10 }" /> :placeholder="one.desc" :autosize="{ minRows: 4, maxRows: 10 }" />
</el-form-item> </el-form-item>
<!-- </el-tab-pane> -->
</el-form> </el-form>
</el-tabs> </el-tabs>
@@ -53,14 +51,8 @@ export default defineComponent({
isShow: false, isShow: false,
waysLabelData: [], waysLabelData: [],
editData: {}, editData: {},
}); });
const dealDisplayData = () => {
}
// 监测父页面传过来的数据
watch(pageState.ShowDialogData, (newValue, oldValue) => { watch(pageState.ShowDialogData, (newValue, oldValue) => {
if (newValue[props.componentName]) { if (newValue[props.componentName]) {
// 弹出编辑框 // 弹出编辑框
@@ -88,26 +80,22 @@ export default defineComponent({
}; };
}); });
const handleCancer = () => { const handleCancer = () => {
if (pageState.ShowDialogData[props.componentName]) { if (pageState.ShowDialogData[props.componentName]) {
pageState.ShowDialogData[props.componentName].isShow = false; pageState.ShowDialogData[props.componentName].isShow = false;
} }
} }
const handleClick = () => { const handleClick = () => {
} }
const getEditData = (type) => { const getEditData = (type) => {
for (const element of state.waysLabelData) { for (const element of state.waysLabelData) {
// if (element.type == type) {
const data = {}; const data = {};
for (const item of element.inputs) { for (const item of element.inputs) {
data[item.col] = item.value; data[item.col] = item.value;
} }
return data; return data;
// }
} }
return {}; return {};
} }
@@ -136,7 +124,6 @@ export default defineComponent({
const handleSubmit = async () => { const handleSubmit = async () => {
let postData = getFinalData(); let postData = getFinalData();
const rsp = await request.post('/sendways/edit', postData); const rsp = await request.post('/sendways/edit', postData);
// console.log('edit res',rsp)
if (await rsp.data.code == 200) { if (await rsp.data.code == 200) {
handleCancer(); handleCancer();
} }
@@ -147,18 +134,9 @@ export default defineComponent({
}; };
}, },
}); });
</script> </script>
<style scoped> <style scoped>
/* :global(.el-dialog) {
width: 500px;
} */
/* :global(.el-dialog__title) {
font-size: 14px;
} */
/* :global(.el-dialog label) {
font-size: 13px;
} */
</style> </style>
@@ -27,10 +27,6 @@ export default defineComponent({
components: { components: {
QuestionFilled, QuestionFilled,
}, },
props: {
},
methods: {
},
setup() { setup() {
const state = reactive({ const state = reactive({
version: '', version: '',
@@ -44,10 +44,6 @@ export default defineComponent({
</script> </script>
<style scoped> <style scoped>
/* :deep(.el-input .el-input__wrapper) {
margin-top: 10px;
} */
:deep(.el-button) { :deep(.el-button) {
float: right !important; float: right !important;
margin-top: 10px; margin-top: 10px;
@@ -40,10 +40,6 @@ export default defineComponent({
components: { components: {
QuestionFilled, QuestionFilled,
}, },
props: {
},
methods: {
},
setup() { setup() {
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
@@ -66,6 +62,7 @@ export default defineComponent({
ElMessage({ message: msg, type: 'success' }) ElMessage({ message: msg, type: 'success' })
} }
} }
const handleView = async () => { const handleView = async () => {
router.push('/sendlogs?taskid=' + CONSTANT.LOG_TASK_ID, { replace: true }); router.push('/sendlogs?taskid=' + CONSTANT.LOG_TASK_ID, { replace: true });
} }
@@ -93,9 +90,6 @@ export default defineComponent({
</script> </script>
<style scoped> <style scoped>
/* :deep(.el-input .el-input__wrapper) {
margin-top: 10px;
} */
:deep(.el-button) { :deep(.el-button) {
float: right !important; float: right !important;
@@ -52,12 +52,7 @@ export default defineComponent({
components: { components: {
QuestionFilled, QuestionFilled,
}, },
props: {
},
methods: {
},
setup() { setup() {
const router = useRouter();
const state = reactive({ const state = reactive({
title: '', title: '',
slogan: '', slogan: '',