Commit 4a229f15 by 胡悦

优化

1 parent b0e485a3
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
"ant-design-vue": "^1.7.8", "ant-design-vue": "^1.7.8",
"axios": "^0.21.3", "axios": "^0.21.3",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"less": "^3.0.0",
"less-loader": "^6.0.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"pubsub-js": "^1.9.4", "pubsub-js": "^1.9.4",
"vue": "^2.6.11", "vue": "^2.6.11",
......
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
<div class="wrapper-header"> <div class="wrapper-header">
<img class="logo" src="./assets/logo.png" alt="" /> <img class="logo" src="./assets/logo.png" alt="" />
<a-menu v-model="current" mode="horizontal"> <a-menu v-model="current" mode="horizontal">
<a-menu-item key="folder" @click="handleTab('Folder')" <a-menu-item key="folder" @click="handleTab('Folder')">
><a-icon type="home" />项目主页</a-menu-item <a-icon type="home" />项目主页
> </a-menu-item>
<a-menu-item key="documentation" @click="handleTab('Documentation')" <a-menu-item key="documentation" @click="handleTab('Documentation')">
><a-icon type="file-text" />项目文档描述</a-menu-item <a-icon type="file-text" />项目文档描述
> </a-menu-item>
<a-menu-item key="record" @click="handleTab('Record')" <a-menu-item key="record" @click="handleTab('Record')">
><a-icon type="message" />问题记录</a-menu-item <a-icon type="message" />问题记录
> </a-menu-item>
</a-menu> </a-menu>
</div> </div>
<div class="wrapper-content"> <div class="wrapper-content">
...@@ -44,34 +44,4 @@ export default { ...@@ -44,34 +44,4 @@ export default {
</script> </script>
<style> <style>
.wrapper-header {
display: flex;
background-color: #2b303b;
}
.wrapper-header .logo {
display: inline-flex;
width: 50px;
height: 50px;
}
.wrapper-header .ant-menu {
display: inline-flex;
background-color: #2b303b;
color: #fff;
}
.wrapper-header .ant-menu-horizontal > .ant-menu-item:hover,
.wrapper-header .ant-menu-horizontal > .ant-menu-item-active,
.wrapper-header .ant-menu-horizontal > .ant-menu-item-selected {
border-bottom: none;
}
.wrapper-header .ant-menu-horizontal {
border-bottom: none;
}
.wrapper-header .ant-menu-horizontal > .ant-menu-item > a {
color: #fff;
}
.wrapper-content {
margin: 30px auto;
padding: 0 10px;
max-width: 1300px;
}
</style> </style>
...@@ -10,12 +10,14 @@ ...@@ -10,12 +10,14 @@
border-radius: 50%; border-radius: 50%;
box-shadow: 0 10px 30px rgb(45 140 240 / 40%); box-shadow: 0 10px 30px rgb(45 140 240 / 40%);
} }
.icon-anticons .anticon { .icon-anticons .anticon {
font-size: 36px; font-size: 36px;
color: #2d8cf0; color: #002FA7;
transition: transform 0.3s ease-in-out; transition: transform 0.3s ease-in-out;
will-change: transform; will-change: transform;
} }
.icon-anticons .anticon:hover { .icon-anticons .anticon:hover {
background: rgba(45, 140, 240, 0.2); background: rgba(0, 47, 167, 0.2);
} }
\ No newline at end of file \ No newline at end of file
@import '~ant-design-vue/dist/antd.less';
@import 'theme.less';
.icon {
margin-right: 4px;
color: @primary-color;
}
.wrapper-header {
display: flex;
background-color: @white-bg;
.logo {
display: inline-flex;
width: 50px;
height: 50px;
}
.ant-menu {
display: inline-flex;
background-color: @white-bg;
color: @text-color;
}
.ant-menu-horizontal>.ant-menu-item:hover,
.ant-menu-horizontal>.ant-menu-item-active,
.ant-menu-horizontal>.ant-menu-item-selected {
border-bottom: none;
}
.ant-menu-horizontal {
border-bottom: none;
}
.ant-menu-horizontal>.ant-menu-item>a {
color: @primary-color;
}
}
.wrapper-content {
margin: 30px auto;
padding: 0 10px;
max-width: 1300px;
}
\ No newline at end of file \ No newline at end of file
@primary-color: #002FA7;
@text-color: #333;
@white-bg: #fff;
\ No newline at end of file \ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-05-09 15:36:51
* @LastEditors: huyue
* @LastEditTime: 2022-05-10 00:02:51
*/
import Vue from 'vue'; import Vue from 'vue';
import App from './App.vue'; import App from './App.vue';
import router from './router'; import router from './router';
import 'ant-design-vue/dist/antd.css';
import '@/assets/css/common.css'
// 全局引入按需引入UI库 vant // 全局引入按需引入UI库 vant
import { components } from '@/plugins/ant' import { components } from '@/plugins/ant'
import { message,Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import '@/assets/css/common.css'
import '@/assets/css/style.less'
import api from './api' import api from './api'
import PubSub from 'pubsub-js' import PubSub from 'pubsub-js'
...@@ -18,7 +25,7 @@ Vue.prototype.to = function (name, params) { ...@@ -18,7 +25,7 @@ Vue.prototype.to = function (name, params) {
router.go(-1) router.go(-1)
return return
} }
router.push({ name, params}) router.push({ name, params })
} }
Vue.prototype.$message = message Vue.prototype.$message = message
Vue.prototype.$confirm = Modal.confirm Vue.prototype.$confirm = Modal.confirm
......
<template> <template>
<div> <div>
<a-form-model <a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
ref="ruleForm"
:model="form"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-model-item label="分类标题" prop="classify_title"> <a-form-model-item label="分类标题" prop="classify_title">
<a-input v-model="form.classify_title" /> <a-input v-model="form.classify_title" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="分类字段" prop="classify"> <a-form-model-item prop="classify">
<a-input v-model="form.classify" :disabled="!isNewAdd" /> <span slot="label">
<a-popover title="什么是分类字段?">
<template slot="content">
<p>项目分类的字段名,用来区分创建项目所属的类别</p>
</template>
<a-icon class="icon" type="question-circle" />分类字段
</a-popover>
</span>
<a-input v-model="form.classify" :disabled="!isNewAdd" />
<!-- <a-select v-model="form.classify" placeholder="请选择你的分类"> <!-- <a-select v-model="form.classify" placeholder="请选择你的分类">
<a-select-option <a-select-option
v-for="item in classifyList" v-for="item in classifyList"
...@@ -27,8 +29,7 @@ ...@@ -27,8 +29,7 @@
<a-input v-model="form.classify_description" type="textarea" /> <a-input v-model="form.classify_description" type="textarea" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }"> <a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="onSubmit" <a-button type="primary" @click="onSubmit">{{ isNewAdd ? "创建" : "提交" }}
>{{ isNewAdd ? "创建" : "提交" }}
</a-button> </a-button>
<a-button style="margin-left: 10px" @click="resetForm"> 重置 </a-button> <a-button style="margin-left: 10px" @click="resetForm"> 重置 </a-button>
<a-button style="margin-left: 10px" @click="closeForm"> 关闭 </a-button> <a-button style="margin-left: 10px" @click="closeForm"> 关闭 </a-button>
...@@ -91,7 +92,7 @@ export default { ...@@ -91,7 +92,7 @@ export default {
if (valid) { if (valid) {
if (this.isNewAdd) { if (this.isNewAdd) {
//新增 //新增
console.log('this.form',this.form) console.log('this.form', this.form)
this.api.classify.create(this.form).then((res) => { this.api.classify.create(this.form).then((res) => {
// console.log(res); // console.log(res);
if (res.id) { if (res.id) {
...@@ -148,4 +149,5 @@ export default { ...@@ -148,4 +149,5 @@ export default {
}; };
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss">
</style>
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
:label-col="labelCol" :label-col="labelCol"
:wrapper-col="wrapperCol" :wrapper-col="wrapperCol"
> >
<a-form-model-item label="项目分类">
{{ $route.params.classify }}
</a-form-model-item>
<a-form-model-item label="项目名称" prop="project_title"> <a-form-model-item label="项目名称" prop="project_title">
<a-input v-model="form.project_title" /> <a-input v-model="form.project_title" />
</a-form-model-item> </a-form-model-item>
...@@ -47,22 +50,23 @@ ...@@ -47,22 +50,23 @@
<script> <script>
export default { export default {
name: "", name: "HomeAdd",
data() { data() {
return { return {
isNewAdd: true, isNewAdd: true,
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
form: { form: {
project_title: "", classify: this.$route.params.classify,
project_description: "", project_title: '',
developer_name: "", project_description: '',
config_name: "", developer_name: '',
test_url: "", config_name: '',
product_url: "", test_url: '',
technology: "", product_url: '',
git_url: "", technology: '',
git_id: "", git_url: '',
git_id: '',
}, },
rules: { rules: {
project_title: [ project_title: [
...@@ -97,7 +101,11 @@ export default { ...@@ -97,7 +101,11 @@ export default {
}; };
}, },
mounted() { mounted() {
this.editeItemFn(); // this.editeItemFn();
if (this.$route.params.id) {
this.form = this.$route.params
this.$set(this, 'isNewAdd', false)
}
}, },
methods: { methods: {
onSubmit() { onSubmit() {
...@@ -105,16 +113,14 @@ export default { ...@@ -105,16 +113,14 @@ export default {
if (valid) { if (valid) {
// const classify = sessionStorage.getItem("classify"); // const classify = sessionStorage.getItem("classify");
const pramas = { const params = {
...this.form, ...this.form,
// classify, // classify,
}; };
console.log(this.isNewAdd, 'isNewAdd')
// console.log("pramas: " + JSON.stringify(pramas));
if (this.isNewAdd) { if (this.isNewAdd) {
//新增 //新增
this.api.project.create(pramas).then((res) => { this.api.project.create(params).then((res) => {
// console.log('res: ', res); // console.log('res: ', res);
if (res.id) { if (res.id) {
this.$message.success("添加成功"); this.$message.success("添加成功");
...@@ -126,7 +132,7 @@ export default { ...@@ -126,7 +132,7 @@ export default {
}); });
} else { } else {
//编辑 //编辑
this.api.project.update(pramas).then((res) => { this.api.project.update(params).then((res) => {
// console.log("res: ", res); // console.log("res: ", res);
if (res.id) { if (res.id) {
this.$message.success("编辑成功"); this.$message.success("编辑成功");
......
...@@ -59,8 +59,9 @@ ...@@ -59,8 +59,9 @@
<p>1.进入git仓库项目设置</p> <p>1.进入git仓库项目设置</p>
<p>2.查看 Project ID</p> <p>2.查看 Project ID</p>
</template> </template>
{{ item.git_id }} <a-icon type="question" /> <a-icon type="question-circle" />
</a-popover> </a-popover>
{{ item.git_id }}
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
</div> </div>
...@@ -146,11 +147,10 @@ export default { ...@@ -146,11 +147,10 @@ export default {
//设置 项目分类 //设置 项目分类
setClassifyFn() { setClassifyFn() {
const classify = this.$route.query.classify; const classify = this.$route.query.classify;
sessionStorage.setItem("classify", classify); sessionStorage.setItem("classify", classify);
}, },
add() { add() {
this.to("HomeAdd"); this.to("HomeAdd", { classify: this.$route.query.classify });
this.setClassifyFn(); this.setClassifyFn();
}, },
editFn(item) { editFn(item) {
...@@ -193,7 +193,7 @@ export default { ...@@ -193,7 +193,7 @@ export default {
// console.log('item: ', item); // console.log('item: ', item);
this.$router.push({ name: "GitLog", query: { projectId: item.git_id } }); this.$router.push({ name: "GitLog", query: { projectId: item.git_id } });
}, },
//h获取全部的分类 //获取全部的分类
getClassifyList() { getClassifyList() {
this.api.classify.getList().then((res) => { this.api.classify.getList().then((res) => {
console.log(res); console.log(res);
......
module.exports = { module.exports = {
css: {
loaderOptions: {
less: {
lessOptions: {
modifyvars: {
'primary-color': '#002FA7'
},
javascriptEnabled: true
}
}
}
},
devServer: { devServer: {
port: 8080, // 端口 port: 8080, // 端口
proxy: { proxy: {
//配置跨域 //配置跨域
"/api3": { "/api3": {
target: "http://192.168.2.24:7001", target: "http://192.168.1.68:7001",
ws:true, ws: true,
changOrigin: true, changOrigin: true,
pathRewrite: { pathRewrite: {
"^/api3": "/" "^/api3": "/"
} }
}, },
"/api2": { "/api2": {
// target: "http://192.168.3.233:8090/api/v4/projects", // target: "http://192.168.3.233:8090/api/v4/projects",
target: "http://192.168.1.16:8090/api/v4/projects", target: "http://192.168.1.16:8090/api/v4/projects",
ws:true, ws: true,
changOrigin: true, changOrigin: true,
pathRewrite: { pathRewrite: {
"^/api2": "/" "^/api2": "/"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!