Commit e2ef7e9c by luyt

add: 静态站点完成

1 parent d98fe972
This diff could not be displayed because it is too large.
{ {
"name": "antd-demo", "name": "glsk-front",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
...@@ -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",
"moment": "^2.29.1",
"pubsub-js": "^1.9.4",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.5.2" "vue-router": "^3.5.2"
}, },
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<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="home" @click="handleTab('Home')"><a-icon type="home" />团队主页</a-menu-item> <a-menu-item key="home" @click="handleTab('Home')"><a-icon type="home" />项目主页</a-menu-item>
<a-menu-item key="documentation" @click="handleTab('Documentation')"><a-icon type="file-text" />开发者须知</a-menu-item> <a-menu-item key="documentation" @click="handleTab('Documentation')"><a-icon type="file-text" />项目文档描述</a-menu-item>
<a-menu-item key="record" @click="handleTab('Record')"><a-icon type="message" />问题记录</a-menu-item> <a-menu-item key="record" @click="handleTab('Record')"><a-icon type="message" />问题记录</a-menu-item>
</a-menu> </a-menu>
</div> </div>
......
...@@ -7,6 +7,8 @@ import '@/assets/css/common.css' ...@@ -7,6 +7,8 @@ import '@/assets/css/common.css'
import { components } from '@/plugins/ant' import { components } from '@/plugins/ant'
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import api from './api' import api from './api'
import PubSub from 'pubsub-js'
Vue.config.productionTip = false; Vue.config.productionTip = false;
components.forEach(component => Vue.use(component)) components.forEach(component => Vue.use(component))
...@@ -19,6 +21,7 @@ Vue.prototype.to = function (name, params) { ...@@ -19,6 +21,7 @@ Vue.prototype.to = function (name, params) {
router.push({ name, params}) router.push({ name, params})
} }
Vue.prototype.$message = message Vue.prototype.$message = message
Vue.prototype.$PubSub = PubSub
new Vue({ new Vue({
render: h => h(App), render: h => h(App),
router, router,
......
...@@ -9,9 +9,13 @@ import { ...@@ -9,9 +9,13 @@ import {
Input, Input,
Checkbox, Checkbox,
Button, Button,
Select Select,
Comment,
Tooltip,
} from 'ant-design-vue' } from 'ant-design-vue'
export const components = [ export const components = [
Menu, Menu,
Icon, Icon,
...@@ -23,5 +27,7 @@ export const components = [ ...@@ -23,5 +27,7 @@ export const components = [
Input, Input,
Checkbox, Checkbox,
Button, Button,
Select Select,
Comment,
Tooltip,
] ]
\ No newline at end of file \ No newline at end of file
...@@ -25,7 +25,7 @@ service.interceptors.request.use(function (config) { ...@@ -25,7 +25,7 @@ service.interceptors.request.use(function (config) {
service.interceptors.response.use(response => { service.interceptors.response.use(response => {
// 对响应数据做点什么 // 对响应数据做点什么
const { data: {status, msg} } = response const { data: {status, msg} } = response
console.log(response) // console.log(response)
if (status != 0) { if (status != 0) {
message.error(msg) message.error(msg)
return Promise.reject({status, msg}) return Promise.reject({status, msg})
......
...@@ -6,10 +6,8 @@ ...@@ -6,10 +6,8 @@
*/ */
const routes = Object.freeze([ const routes = Object.freeze([
{ {
name: 'Home',
path: '/', path: '/',
redirect: '/home', redirect: '/home',
component: resolve => require(['../views/home/index.vue'], resolve)
}, },
{ {
name: 'Home', name: 'Home',
...@@ -17,6 +15,11 @@ const routes = Object.freeze([ ...@@ -17,6 +15,11 @@ const routes = Object.freeze([
component: resolve => require(['../views/home/index.vue'], resolve) component: resolve => require(['../views/home/index.vue'], resolve)
}, },
{ {
name: 'HomeAdd',
path: '/home/add',
component: resolve => require(['../views/home/add/index.vue'], resolve)
},
{
name: 'Documentation', name: 'Documentation',
path: '/documentation', path: '/documentation',
component: resolve => require(['../views/documentation/index.vue'], resolve) component: resolve => require(['../views/documentation/index.vue'], resolve)
......
<template>
<div>
<a-form-model
ref="ruleForm"
:model="form"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-model-item label="项目名称" prop="project_title">
<a-input v-model="form.project_title" />
</a-form-model-item>
<a-form-model-item label="开发者名称" prop="developer_name">
<a-input v-model="form.developer_name" />
</a-form-model-item>
<a-form-model-item label="配置名称" prop="config_name">
<a-input v-model="form.config_name" />
</a-form-model-item>
<a-form-model-item label="测试环境地址" prop="test_url">
<a-input v-model="form.test_url" />
</a-form-model-item>
<a-form-model-item label="生产环境地址" prop="product_url">
<a-input v-model="form.product_url" />
</a-form-model-item>
<a-form-model-item label="相关技术栈" prop="technology">
<a-input v-model="form.technology" />
</a-form-model-item>
<a-form-model-item label="请输入项目描述" prop="project_description">
<a-input v-model="form.project_description" type="textarea" />
</a-form-model-item>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="onSubmit"> 创建 </a-button>
<a-button style="margin-left: 10px" @click="resetForm"> 重置 </a-button>
<a-button style="margin-left: 10px" @click="closeForm"> 关闭 </a-button>
</a-form-model-item>
</a-form-model>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: "",
data() {
return {
labelCol: { span: 4 },
wrapperCol: { span: 14 },
form: {
project_title: "",
project_description: "",
developer_name: "",
config_name: "",
test_url: "",
product_url: "",
technology: "",
},
rules: {
project_title: [
{ required: true, message: "请输入项目名称", trigger: "blur" },
{ min: 1, max: 30, message: "请输入字符1~50之间", trigger: "blur" },
],
project_description: [
{ required: true, message: "请输入项目描述", trigger: "blur" },
],
developer_name: [
{ required: true, message: "请输入开发者名称", trigger: "blur" },
],
config_name: [
{ required: true, message: "请输入配置名称", trigger: "blur" },
],
test_url: [
{ required: true, message: "请输入测试环境地址", trigger: "blur" },
],
product_url: [
{ required: true, message: "请输入生产环境地址", trigger: "blur" },
],
technology: [
{ required: true, message: "请输入相关技术栈", trigger: "blur" },
],
},
};
},
mounted() {
this.editeItemFn();
},
methods: {
onSubmit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
console.log(this.form);
// this.api.documentation.create(this.form).then((res) => {
// console.log(res);
// this.$message.success("添加成功");
// this.closeForm();
// });
} else {
return false;
}
});
},
resetForm() {
this.$refs.ruleForm.resetFields();
this.resetDate();
},
resetDate() {
this.form = {
project_title: "",
project_description: "",
developer_name: "",
config_name: "",
test_url: "",
product_url: "",
technology: "",
};
},
closeForm() {
this.to(-1);
},
//编辑项目
editeItemFn() {
const editeItem = this.$route.params;
if (!editeItem) return;
this.form = {
...editeItem,
};
},
},
};
</script>
<style scoped lang="scss"></style>
...@@ -2,44 +2,41 @@ ...@@ -2,44 +2,41 @@
<div> <div>
<a-list item-layout="horizontal" :data-source="projectData"> <a-list item-layout="horizontal" :data-source="projectData">
<a-list-item slot="renderItem" slot-scope="item"> <a-list-item slot="renderItem" slot-scope="item">
<a-list-item-meta> <a-list-item-meta>
<!-- <a slot="title" href="https://www.antdv.com/">{{ item.title }}</a> --> <!-- <a slot="title" href="https://www.antdv.com/">{{ item.title }}</a> -->
<a-avatar <a-avatar slot="avatar" :src="projectImgUrl" />
slot="avatar" </a-list-item-meta>
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" <div>
/> <a-descriptions :title="item.project_title" :bordered="false">
</a-list-item-meta> <a-descriptions-item label="开发人员">
<div> {{ item.developer_name }}
<a-descriptions :title="item.title" :bordered="false"> </a-descriptions-item>
<a-descriptions-item label="开发人员"> <a-descriptions-item label="测试项目地址">
{{ item.developer_name }} <a
</a-descriptions-item> :href="item.test_url"
<a-descriptions-item label="测试项目地址"> target="_blank"
<a rel="noopener noreferrer"
:href="item.test_url" >{{ item.test_url }}</a
target="_blank" >
rel="noopener noreferrer" </a-descriptions-item>
>{{ item.test_url }}</a <a-descriptions-item label="上产项目地址">
> <a
</a-descriptions-item> :href="item.test_url"
<a-descriptions-item label="上产项目地址"> target="_blank"
<a rel="noopener noreferrer"
:href="item.test_url" >{{ item.product_url }}</a
target="_blank" >
rel="noopener noreferrer" </a-descriptions-item>
>{{ item.product_url }}</a <a-descriptions-item label="使用技术">
> {{ item.technology }}
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="使用技术"> <a-descriptions-item label="配置名称">
{{ item.technology }} {{ item.config_name }}
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="配置名称"> </a-descriptions>
{{ item.config_name }} </div>
</a-descriptions-item> <a slot="actions" @click="editFn(item)">edit</a>
</a-descriptions> <a slot="actions" @click="commentsFn(item.comments)">comments</a>
</div>
<a slot="actions">edit</a>
<a slot="actions">comment</a>
</a-list-item> </a-list-item>
</a-list> </a-list>
<div class="icon-anticons" @click="add"> <div class="icon-anticons" @click="add">
...@@ -50,58 +47,64 @@ ...@@ -50,58 +47,64 @@
<script> <script>
const data = [ const data = [
{ {
title: "车联网支撑平台", id: 1,
developerName: "胡悦、陈婉清", project_title: "广联运营平台",
project_description: "广联运营平台",
developer_name: "胡悦、陈婉清",
config_name: "/admin_common",
test_url: "http://sso.test.glsx.com.cn/#/login", test_url: "http://sso.test.glsx.com.cn/#/login",
product_url: "http://sso.glsx.com.cn/#/login", product_url: "http://sso.glsx.com.cn/#/login",
technology: "vue", technology: "vue",
config_name: "/admin_common"
}, },
{ {
title: "车联网支撑平台", id: 2,
developerName: "胡悦、陈婉清", project_title: "账户管理",
test_url: "http://sso.test.glsx.com.cn/#/login", project_description: "商户、角色、员工管理",
product_url: "http://sso.glsx.com.cn/#/login", developer_name: "胡悦、陈婉清",
technology: "vue", config_name: "/glsx-oss-account-config",
config_name: "/admin_common" test_url: "http://glsx-account-merchants.test.glsx.com.cn",
}, product_url: "http://glsx-account.glsx.com.cn",
{
title: "车联网支撑平台",
developerName: "胡悦、陈婉清",
test_url: "http://sso.test.glsx.com.cn/#/login",
product_url: "http://sso.glsx.com.cn/#/login",
technology: "vue", technology: "vue",
config_name: "/admin_common"
}, },
{
title: "车联网支撑平台",
developerName: "胡悦、陈婉清",
test_url: "http://sso.test.glsx.com.cn/#/login",
product_url: "http://sso.glsx.com.cn/#/login",
technology: "vue",
config_name: "/admin_common"
}
]; ];
import projectImgUrl from "@/assets/project.jpg";
export default { export default {
name: "Home", name: "Home",
data() { data() {
return { return {
projectData: data projectData: data,
projectImgUrl,
}; };
}, },
mounted() { mounted() {
this.getList() this.getList();
}, },
methods: { methods: {
getList() { getList() {
this.api.project.getList().then(res => { this.api.project.getList().then((res) => {
console.log(res) // console.log(res);
this.projectData = res this.projectData = res;
}) });
}, },
add() { add() {
this.to('DocAdd') this.to("HomeAdd");
} },
editFn(item) {
console.log("item: ", item);
this.to("HomeAdd", item);
},
commentsFn(comments) {
this.to("Record", comments);
},
}, },
}; };
</script> </script>
<style>
.ant-list-split .ant-list-item{
transition: all 0.3s;
}
.ant-list-split .ant-list-item:hover {
border-color: rgba(0, 0, 0, 0.09);
box-shadow: 0 2px 8px rgb(0 0 0 / 9%);
}
</style>
<template> <template>
<div> <div>
记录 <div class="ant-result-title">项目名称</div>
<a-list
v-if="comments.length"
:data-source="comments"
:header="`${comments.length} ${
comments.length > 1 ? 'replies' : 'reply'
}`"
item-layout="horizontal"
>
<a-list-item slot="renderItem" slot-scope="item">
<a-comment
:author="item.author"
:avatar="item.avatar"
:content="item.content"
:datetime="item.datetime"
/>
</a-list-item>
</a-list>
<a-comment>
<a-avatar
slot="avatar"
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
alt="Han Solo"
/>
<div slot="content">
<a-form-item>
<a-textarea :rows="4" :value="value" @change="handleChange" />
</a-form-item>
<a-form-item>
<a-button
html-type="submit"
:loading="submitting"
type="primary"
@click="handleSubmit"
>
Add Comment
</a-button>
</a-form-item>
</div>
</a-comment>
</div> </div>
</template> </template>
<script> <script>
import moment from "moment";
import FormItem from "ant-design-vue/lib/form/FormItem";
export default { export default {
name: 'Record',
data() { data() {
return { return {
} comments: [],
} submitting: false,
value: "",
moment,
};
},
components: { [FormItem.name]: FormItem },
methods: {
handleSubmit() {
if (!this.value) {
return;
}
this.submitting = true;
setTimeout(() => {
this.submitting = false;
this.comments = [
{
author: "Han Solo",
avatar:
"https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png",
content: this.value,
datetime: moment().fromNow(),
},
...this.comments,
];
this.value = "";
}, 1000);
},
handleChange(e) {
this.value = e.target.value;
},
},
};
</script>
<style>
.ant-result-title {
margin-bottom: 50px;
color: rgba(0, 0, 0, 0.85);
font-size: 24px;
line-height: 1.8;
text-align: center;
} }
</script>
\ No newline at end of file \ No newline at end of file
</style>
\ No newline at end of file \ No newline at end of file
...@@ -4,7 +4,7 @@ module.exports = { ...@@ -4,7 +4,7 @@ module.exports = {
proxy: { proxy: {
//配置跨域 //配置跨域
"/api": { "/api": {
target: "http://192.168.2.9:7001", target: "http://192.168.2.24:7001",
// ws:true, // ws:true,
changOrigin: true, changOrigin: true,
pathRewrite: { pathRewrite: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!