Commit c6ec73e5 by 匡雅琴

页面开发

1 parent 836f8b97
// Generated by 'unplugin-auto-import' // Generated by 'unplugin-auto-import'
// We suggest you to commit this file into source control // We suggest you to commit this file into source control
declare global { declare global {
const ElAside: typeof import('element-plus/es')['ElAside']
const ElButton: typeof import('element-plus/es')['ElButton'] const ElButton: typeof import('element-plus/es')['ElButton']
const ElCard: typeof import('element-plus/es')['ElCard'] const ElCard: typeof import('element-plus/es')['ElCard']
const ElCol: typeof import('element-plus/es')['ElCol'] const ElCol: typeof import('element-plus/es')['ElCol']
const ElContainer: typeof import('element-plus/es')['ElContainer']
const ElDialog: typeof import('element-plus/es')['ElDialog'] const ElDialog: typeof import('element-plus/es')['ElDialog']
const ElDropdown: typeof import('element-plus/es')['ElDropdown'] const ElDropdown: typeof import('element-plus/es')['ElDropdown']
const ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] const ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
const ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] const ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
const ElForm: typeof import('element-plus/es')['ElForm'] const ElForm: typeof import('element-plus/es')['ElForm']
const ElFormItem: typeof import('element-plus/es')['ElFormItem'] const ElFormItem: typeof import('element-plus/es')['ElFormItem']
const ElIcon: typeof import('element-plus/es')['ElIcon']
const ElInput: typeof import('element-plus/es')['ElInput'] const ElInput: typeof import('element-plus/es')['ElInput']
const ElMain: typeof import('element-plus/es')['ElMain']
const ElMenu: typeof import('element-plus/es')['ElMenu']
const ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
const ElOption: typeof import('element-plus/es')['ElOption'] const ElOption: typeof import('element-plus/es')['ElOption']
const ElPagination: typeof import('element-plus/es')['ElPagination'] const ElPagination: typeof import('element-plus/es')['ElPagination']
const ElRow: typeof import('element-plus/es')['ElRow'] const ElRow: typeof import('element-plus/es')['ElRow']
...@@ -18,5 +24,7 @@ declare global { ...@@ -18,5 +24,7 @@ declare global {
const ElSwitch: typeof import('element-plus/es')['ElSwitch'] const ElSwitch: typeof import('element-plus/es')['ElSwitch']
const ElTable: typeof import('element-plus/es')['ElTable'] const ElTable: typeof import('element-plus/es')['ElTable']
const ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] const ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
const ElTabPane: typeof import('element-plus/es')['ElTabPane']
const ElTabs: typeof import('element-plus/es')['ElTabs']
} }
export {} export {}
// generated by unplugin-vue-components // generated by unplugin-vue-components
// We suggest you to commit this file into source control // We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/vue-next/pull/3399 // Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core' import '@vue/runtime-core'
declare module '@vue/runtime-core' { declare module '@vue/runtime-core' {
...@@ -8,16 +8,22 @@ declare module '@vue/runtime-core' { ...@@ -8,16 +8,22 @@ declare module '@vue/runtime-core' {
AceEditor: typeof import('./src/components/AceEditor.vue')['default'] AceEditor: typeof import('./src/components/AceEditor.vue')['default']
AddButton: typeof import('./src/components/AddButton.vue')['default'] AddButton: typeof import('./src/components/AddButton.vue')['default']
BackButton: typeof import('./src/components/BackButton.vue')['default'] BackButton: typeof import('./src/components/BackButton.vue')['default']
ElAside: typeof import('element-plus/es')['ElAside']
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard'] ElCard: typeof import('element-plus/es')['ElCard']
ElCol: typeof import('element-plus/es')['ElCol'] ElCol: typeof import('element-plus/es')['ElCol']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElDialog: typeof import('element-plus/es')['ElDialog'] ElDialog: typeof import('element-plus/es')['ElDialog']
ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElForm: typeof import('element-plus/es')['ElForm'] ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElInput: typeof import('element-plus/es')['ElInput'] ElInput: typeof import('element-plus/es')['ElInput']
ElMain: typeof import('element-plus/es')['ElMain']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption'] ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination'] ElPagination: typeof import('element-plus/es')['ElPagination']
ElRow: typeof import('element-plus/es')['ElRow'] ElRow: typeof import('element-plus/es')['ElRow']
...@@ -25,6 +31,8 @@ declare module '@vue/runtime-core' { ...@@ -25,6 +31,8 @@ declare module '@vue/runtime-core' {
ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable'] ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"lint": "vue-cli-service lint --fix" "lint": "vue-cli-service lint --fix"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons": "0.0.11",
"axios": "^0.27.2", "axios": "^0.27.2",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"element-plus": "^2.1.11", "element-plus": "^2.1.11",
......
<template> <template>
<div class="back-btn"> <div class="back-btn">
<el-button type="success" :icon="Back"> <el-button type="info" plain>
<!-- <Back /> --> <el-icon><DArrowLeft /></el-icon>返回
</el-button> </el-button>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { DArrowLeft } from '@element-plus/icons'
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import { Back } from "@element-plus/icons-vue"; import { Back } from "@element-plus/icons-vue";
export default defineComponent({ export default defineComponent({
name: "BackButton", name: "BackButton",
// components: { Back }, components: { DArrowLeft },
setup() { setup() {
return { return {
Back, Back,
...@@ -22,10 +23,13 @@ export default defineComponent({ ...@@ -22,10 +23,13 @@ export default defineComponent({
<!-- <script lang="ts" setup> <!-- <script lang="ts" setup>
import { Back } from "@element-plus/icons-vue"; import { Back } from "@element-plus/icons-vue";
</script> --> </script> -->
<style lang="scss"> <style lang="scss" scoped>
.back-btn { .back-btn {
position: fixed; // position: fixed;
top: 80px; // top: 80px;
left: 100px; // left: 100px;
}
.el-button {
border-radius: 15px;
} }
</style> </style>
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
export default { export default {
baseUrl: { baseUrl: {
dev: "/api", dev: "/api",
pro: "https://config-center-backend.glsx.com.cn", //生产环境 // pro: "https://config-center-backend.glsx.com.cn", //生产环境
// pro: "https://config-center-backend.test.glsx.com.cn", //test环境 // pro: "https://config-center-backend.test.glsx.com.cn", //test环境
pro: "http://192.168.1.68:7003"
}, },
}; };
...@@ -144,6 +144,21 @@ const routes: Array<RouteRecordRaw> = [ ...@@ -144,6 +144,21 @@ const routes: Array<RouteRecordRaw> = [
}, },
], ],
}, },
{
path: "/publickconfig",
name: "",
component: layout,
children: [
{
path: "/publickconfig",
name: "publickconfig",
component: () =>
import(
/* webpackChunkName: "project" */ "../views/publicConfig/index.vue"
),
},
],
}
]; ];
const router = createRouter({ const router = createRouter({
......
...@@ -72,3 +72,11 @@ export interface CopyProject { ...@@ -72,3 +72,11 @@ export interface CopyProject {
moduleUrl?: string; moduleUrl?: string;
env?: string; env?: string;
} }
export interface ConfigList {
id?: number,
name: string,
identify: string,
content: string,
desc: string
}
\ No newline at end of file \ No newline at end of file
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
@click="goPage" @click="goPage"
class="logo" class="logo"
/> />
<div class="wrap-right">
<div class="right-menu" @click="goConfigPage">公共配置项</div>
<span class="right-menu">|</span>
<div class="right-menu" @click="goModelPage">公共模板</div>
<el-dropdown> <el-dropdown>
<span class="el-dropdown-link"> <span class="el-dropdown-link">
{{ userName }} {{ userName }}
...@@ -34,6 +38,7 @@ ...@@ -34,6 +38,7 @@
</template> </template>
</el-dropdown> </el-dropdown>
</div> </div>
</div>
<editUerMessage <editUerMessage
v-if="editUerMessageModalVisible" v-if="editUerMessageModalVisible"
v-model="editUerMessageModalVisible" v-model="editUerMessageModalVisible"
...@@ -83,6 +88,16 @@ const account = () => { ...@@ -83,6 +88,16 @@ const account = () => {
}); });
}; };
// 跳往公共配置项页面
const goConfigPage = () => {
router.replace({ name: "publickconfig" });
}
// 跳往公共模板页面
const goModelPage = () => {
router.replace({ name: "model" });
}
// 注销账号 // 注销账号
const delUser = async () => { const delUser = async () => {
ElMessageBox.confirm("您确定要注销当前账号吗?", "Warning", { ElMessageBox.confirm("您确定要注销当前账号吗?", "Warning", {
...@@ -147,5 +162,16 @@ const delUser = async () => { ...@@ -147,5 +162,16 @@ const delUser = async () => {
overflow-y: auto; overflow-y: auto;
flex: 1; flex: 1;
} }
&-right {
display: flex;
.right-menu {
margin-right: 8px;
line-height: 30px;
&:hover {
color: var(--el-color-primary-light-3);
cursor: pointer;
}
}
}
} }
</style> </style>
<script setup lang="ts">
import { ref, reactive } from "vue";
import BackButton from "@/components/BackButton.vue";
import type { FormInstance, FormRules } from "element-plus";
import { onBeforeRouteLeave, useRouter } from "vue-router";
const router = useRouter();
const ruleFormRef = ref<FormInstance>();
const ruleForm = reactive({
name: "",
identify: "",
content: "",
desc: "",
});
const rules = reactive<FormRules>({
name: [{ required: true, message: "请输入公共配置项名称", trigger: "blur" }],
identify: { required: true, message: "请输入公共配置项标识", trigger: "blur" },
content: { required: true, message: "请输入公共配置项内容", trigger: "blur" },
desc: { required: true, message: "请输入描述", trigger: "blur" },
});
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.resetFields();
};
const goBack = () => {
router.go(-1);
};
onBeforeRouteLeave(() => {
sessionStorage.removeItem("editConfigItem");
});
</script>
<template>
<div class="add-config">
<div class="add-top">
<BackButton v-preventReClick @click="goBack" />
<h3>项目环境配置添加</h3>
</div>
<el-form
ref="ruleFormRef"
:model="ruleForm"
:rules="rules"
label-width="120px"
class="demo-ruleForm"
>
<el-form-item label="公共配置项名称" prop="name">
<el-input v-model="ruleForm.name" />
</el-form-item>
<el-form-item label="公共配置项标识" prop="identify">
<el-input v-model="ruleForm.identify">
<template #prepend>@</template>
</el-input>
</el-form-item>
<el-form-item label="公共配置项内容" prop="content">
<el-input v-model="ruleForm.content" type="textarea" />
</el-form-item>
<el-form-item label="描述" prop="desc">
<el-input v-model="ruleForm.desc" type="textarea" />
</el-form-item>
<el-form-item>
<el-button
type="primary"
v-preventReClick
@click="submitForm(ruleFormRef)"
>{{ keysLength > 0 ? "编辑" : "创建" }}</el-button
>
<el-button v-preventReClick @click="resetForm(ruleFormRef)"
>重置</el-button
>
</el-form-item>
</el-form>
</div>
</template>
<style lang="scss" scoped>
.add-config {
// margin: 0 auto;
// width: 1000px;
// text-align: center;
.add-top {
display: flex;
padding: 10px 20px;
border-bottom: 1px solid #ccc;
}
h3 {
margin-left: 10px;
}
.el-form {
width: 800px;
padding: 30px 104px 0 104px;
}
}
</style>
<script setup lang="ts">
import { ref, reactive } from "vue";
import BackButton from "@/components/BackButton.vue";
import type { FormInstance, FormRules } from "element-plus";
import { onBeforeRouteLeave, useRouter } from "vue-router";
const router = useRouter();
const ruleFormRef = ref<FormInstance>();
const ruleForm = reactive({
name: "",
content: "",
desc: "",
});
const rules = reactive<FormRules>({
name: [{ required: true, message: "请输入模板名称", trigger: "blur" }],
content: { required: true, message: "请输入模板内容", trigger: "blur" },
desc: { required: true, message: "请输入描述", trigger: "blur" },
});
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.resetFields();
};
const goBack = () => {
router.go(-1);
};
onBeforeRouteLeave(() => {
sessionStorage.removeItem("editModelItem");
});
</script>
<template>
<div class="add-model">
<div class="add-top">
<BackButton v-preventReClick @click="goBack" />
<h3>新建模板</h3>
</div>
<el-form
ref="ruleFormRef"
:model="ruleForm"
:rules="rules"
label-width="120px"
class="demo-ruleForm"
>
<el-form-item label="模板名称" prop="name">
<el-input v-model="ruleForm.name" />
</el-form-item>
<el-form-item label="模板内容" prop="content">
<el-input v-model="ruleForm.content" type="textarea" />
</el-form-item>
<el-form-item label="描述" prop="desc">
<el-input v-model="ruleForm.desc" type="textarea" />
</el-form-item>
<el-form-item>
<el-button
type="primary"
v-preventReClick
@click="submitForm(ruleFormRef)"
>{{ keysLength > 0 ? "编辑" : "创建" }}</el-button
>
<el-button v-preventReClick @click="resetForm(ruleFormRef)"
>重置</el-button
>
</el-form-item>
</el-form>
</div>
</template>
<style lang="scss" scoped>
.add-model {
.add-top {
display: flex;
padding: 10px 20px;
border-bottom: 1px solid #ccc;
}
h3 {
margin-left: 10px;
}
.el-form {
width: 800px;
padding: 30px 104px 0 104px;
}
}
</style>
<script setup lang="ts">
import AddButton from "@/components/AddButton.vue";
import { reactive, ref } from "vue";
import { ConfigList } from "@/type/index";
import router from "@/router";
const state: {
configList: ConfigList[]
} = reactive({
configList: []
})
const addFn = (flag = true, editorItem?: ConfigList) => {
// 判断是编辑还是新增
if (flag) {
//新增
router.push({ name: "addconfig" });
} else {
//编辑
router.push({ name: "addconfig", params: { ...editorItem } });
window.sessionStorage.setItem(
"editConfigItem",
JSON.stringify(editorItem)
);
}
};
const editFn = (item:ConfigList) => {
console.log(item);
addFn(false, item);
}
const deleteFn = (item:ConfigList) => {
console.log(item);
}
const handerAddFn = () => {
addFn();
};
</script>
<template>
<h3>公共配置项配置</h3>
<el-row :gutter="20">
<el-col
v-for="item in configList"
:key="item.id"
:xs="12"
:sm="9"
:md="8"
:lg="6"
:xl="4"
>
<el-card
:body-style="{ padding: '0px' }"
shadow="hover"
v-preventReClick
>
<img
style="width: 100%; height: 240px"
src="../../assets/project.png"
class="image"
/>
<div style="padding: 14px; position: relative">
<span>项目名称:{{ item.name }}</span>
<div>项目描述:{{ item.desc }}</div>
<div class="bottom">
<el-button
class="button"
v-preventReClick
type="text"
@click.stop="editFn(item)"
>编辑</el-button
>
<el-button
class="button"
v-preventReClick
type="text"
@click.stop="deleteFn(item)"
>删除</el-button
>
</div>
</div>
</el-card>
</el-col>
</el-row>
<AddButton @click="handerAddFn" />
</template>
<style lang="scss" scoped>
h3 {
text-align: center;
margin: 20px 0;
}
</style>
<script setup lang="ts">
import { reactive, markRaw } from "vue";
import ConfigIndex from "./configIndex.vue";
import ModelIndex from "./modelIndex.vue";
type tabType = {
name: string;
tabComp: any;
};
type Comp = Pick<tabType, "tabComp">;
const tabData = reactive<tabType[]>([
{
name: "公共配置项",
// proxy会代理reactive中的所有内容
// 无需对组件进行proxy代理
// 必须使用markRaw跳过对组件的代理,否则vue会给警告
tabComp: markRaw(ConfigIndex),
},
{
name: "公共模板",
tabComp: markRaw(ModelIndex),
},
]);
let currentTab = reactive<Comp>({
tabComp: tabData[0].tabComp,
});
const switchTab = (tab: number) => {
currentTab.tabComp = tabData[tab].tabComp;
};
</script>
<template>
<el-container>
<el-aside width="200px">
<el-tabs
:tab-position="'left'"
style="height: 200px"
class="demo-tabs"
@tab-change="switchTab"
>
<el-tab-pane label="公共配置项配置"></el-tab-pane>
<el-tab-pane label="公共模板配置"></el-tab-pane>
</el-tabs>
</el-aside>
<el-main>
<component :is="currentTab.tabComp"></component>
</el-main>
</el-container>
</template>
<style lang="scss" scoped></style>
<script setup lang="ts">
import AddButton from "@/components/AddButton.vue";
import { reactive, ref } from "vue";
import { ConfigList } from "@/type/index";
import router from "@/router";
const state: {
configList: ConfigList[]
} = reactive({
configList: []
})
const addFn = (flag = true, editorItem?: ConfigList) => {
// 判断是编辑还是新增
if (flag) {
//新增
router.push({ name: "addconfig" });
} else {
//编辑
router.push({ name: "addconfig", params: { ...editorItem } });
window.sessionStorage.setItem(
"editModelItem",
JSON.stringify(editorItem)
);
}
};
const editFn = (item:ConfigList) => {
console.log(item);
addFn(false, item);
}
const deleteFn = (item:ConfigList) => {
console.log(item);
}
const handerAddFn = () => {
addFn();
};
</script>
<template>
<h3>公共模板配置</h3>
<el-row :gutter="20">
<el-col
v-for="item in configList"
:key="item.id"
:xs="12"
:sm="9"
:md="8"
:lg="6"
:xl="4"
>
<el-card
:body-style="{ padding: '0px' }"
shadow="hover"
v-preventReClick
>
<img
style="width: 100%; height: 240px"
src="../../assets/project.png"
class="image"
/>
<div style="padding: 14px; position: relative">
<span>项目名称:{{ item.name }}</span>
<div>项目描述:{{ item.desc }}</div>
<div class="bottom">
<el-button
class="button"
v-preventReClick
type="text"
@click.stop="editFn(item)"
>编辑</el-button
>
<el-button
class="button"
v-preventReClick
type="text"
@click.stop="deleteFn(item)"
>删除</el-button
>
</div>
</div>
</el-card>
</el-col>
</el-row>
<AddButton @click="handerAddFn" />
</template>
<style lang="scss" scoped>
h3 {
text-align: center;
margin: 20px 0;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!