Commit 79553021 authored by 郝聪敏's avatar 郝聪敏

添加prettierrc配置文件

parent 68a2195c
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
...@@ -15,3 +15,5 @@ selenium-debug.log ...@@ -15,3 +15,5 @@ selenium-debug.log
*.ntvs* *.ntvs*
*.njsproj *.njsproj
*.sln *.sln
.eslintcache
\ No newline at end of file
module.exports = {
"printWidth": 200,
"trailingComma": "es5",
"singleQuote": true,
}
\ No newline at end of file
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
<script> <script>
export default { export default {
name: "App" name: 'App',
}; };
</script> </script>
<style> <style>
#app { #app {
font-family: "Avenir", Helvetica, Arial, sans-serif; font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
/* text-align: center; /* text-align: center;
......
import axios from "../services/http.service"; import axios from '../services/http.service';
import { sapi } from "../config"; import { sapi } from '../config';
import qs from "qs"; import qs from 'qs';
// 获取服务列表 // 获取服务列表
export function getservicelist() { export function getservicelist() {
return axios.get(`/heimdallr/service/list`); return axios.get(`/heimdallr/service/list`);
...@@ -11,33 +11,23 @@ export function getkey(key) { ...@@ -11,33 +11,23 @@ export function getkey(key) {
} }
// 获取配置列表 // 获取配置列表
export function getconfigurelist(data) { export function getconfigurelist(data) {
return axios.get( return axios.get(`/heimdallr/config/service/${data.key}/${data.service_name}`);
`/heimdallr/config/service/${data.key}/${data.service_name}`
);
} }
// 发布 // 发布
export function postconfigurelist(data, params) { export function postconfigurelist(data, params) {
return axios.post( return axios.post(`/heimdallr/config/service/${data.key}/${data.service_name}`, params, {
`/heimdallr/config/service/${data.key}/${data.service_name}`,
params,
{
headers: { headers: {
"Content-Type": "application/json" 'Content-Type': 'application/json',
} },
} });
);
} }
// 获取版本 // 获取版本
export function getVersionnumber(data) { export function getVersionnumber(data) {
return axios.get( return axios.get(`/heimdallr/config-version/service/${data.key}/${data.service_name}/list`);
`/heimdallr/config-version/service/${data.key}/${data.service_name}/list`
);
} }
// 回滚版本 // 回滚版本
export function rollbacknum(data) { export function rollbacknum(data) {
return axios.get( return axios.get(`/heimdallr/config-version/service/${data.key}/${data.service_name}/set/${data.version}`);
`/heimdallr/config-version/service/${data.key}/${data.service_name}/set/${data.version}`
);
} }
// 获取节点列表 // 获取节点列表
export function getnodelist(data) { export function getnodelist(data) {
...@@ -45,19 +35,13 @@ export function getnodelist(data) { ...@@ -45,19 +35,13 @@ export function getnodelist(data) {
} }
// 获取节点配置 // 获取节点配置
export function getnodeconfig(data) { export function getnodeconfig(data) {
return axios.get( return axios.get(`/heimdallr/config/node/${data.service_name}/${data.node_id}`);
`/heimdallr/config/node/${data.service_name}/${data.node_id}`
);
} }
// 设置节点配置 // 设置节点配置
export function nodeconfig(data, weight) { export function nodeconfig(data, weight) {
return axios.post( return axios.post(`/heimdallr/config/node/${data.service_name}/${data.node_id}`, weight, {
`/heimdallr/config/node/${data.service_name}/${data.node_id}`,
weight,
{
headers: { headers: {
"Content-Type": "application/json" 'Content-Type': 'application/json',
} },
} });
);
} }
import axios from "../services/http.service"; import axios from '../services/http.service';
import { sapi } from "../config"; import { sapi } from '../config';
export function login(data) { export function login(data) {
return axios.get(`/heimdallr/login`, { return axios.get(`/heimdallr/login`, {
headers: { headers: {
"heimdallr-user": data 'heimdallr-user': data,
} },
}); });
} }
export function logout() { export function logout() {
......
<template> <template>
<div class="layout"> <div class="layout">
<Layout class="layout_content"> <Layout class="layout_content">
<Sider <Sider breakpoint="md" collapsible :collapsed-width="78" v-model="isCollapsed">
breakpoint="md"
collapsible
:collapsed-width="78"
v-model="isCollapsed"
>
<div class="title"> <div class="title">
Quantgroup Quantgroup
</div> </div>
<Menu <Menu active-name="1-2" theme="dark" width="auto" :class="menuitemClasses">
active-name="1-2"
theme="dark"
width="auto"
:class="menuitemClasses"
>
<MenuItem name="1-1"> <MenuItem name="1-1">
<Icon type="ios-navigate"></Icon> <Icon type="ios-navigate"></Icon>
<span @click="go">网关配置</span> <span @click="go">网关配置</span>
...@@ -35,9 +25,7 @@ ...@@ -35,9 +25,7 @@
<Header class="layout-header-bar"> <Header class="layout-header-bar">
<span class="signout" @click="logOut">退出</span> <span class="signout" @click="logOut">退出</span>
</Header> </Header>
<Content <Content :style="{ margin: '20px', background: '#fff', minHeight: '220px' }">
:style="{ margin: '20px', background: '#fff', minHeight: '220px' }"
>
<router-view></router-view> <router-view></router-view>
</Content> </Content>
</Layout> </Layout>
...@@ -45,28 +33,28 @@ ...@@ -45,28 +33,28 @@
</div> </div>
</template> </template>
<script> <script>
import { logout } from "../api/user.api"; import { logout } from '../api/user.api';
export default { export default {
data() { data() {
return { return {
isCollapsed: false isCollapsed: false,
}; };
}, },
computed: { computed: {
menuitemClasses: function() { menuitemClasses: function() {
return ["menu-item", this.isCollapsed ? "collapsed-menu" : ""]; return ['menu-item', this.isCollapsed ? 'collapsed-menu' : ''];
} },
}, },
methods: { methods: {
go() { go() {
this.$router.push("/mainconfiguration"); this.$router.push('/mainconfiguration');
}, },
logOut() { logOut() {
logout().then(data => { logout().then(data => {
this.$router.push("/"); this.$router.push('/');
}); });
} },
} },
}; };
</script> </script>
<style scoped> <style scoped>
......
...@@ -4,20 +4,12 @@ ...@@ -4,20 +4,12 @@
<div class="login"> <div class="login">
<Form ref="loginForm" :model="loginForm" :rules="ruleLoginForm"> <Form ref="loginForm" :model="loginForm" :rules="ruleLoginForm">
<FormItem prop="loginName"> <FormItem prop="loginName">
<Input <Input v-model="loginForm.loginName" type="text" placeholder="Username">
v-model="loginForm.loginName"
type="text"
placeholder="Username"
>
<Icon type="ios-person-outline" slot="prepend"></Icon> <Icon type="ios-person-outline" slot="prepend"></Icon>
</Input> </Input>
</FormItem> </FormItem>
<FormItem prop="password"> <FormItem prop="password">
<Input <Input type="password" v-model="loginForm.password" placeholder="Password">
type="password"
v-model="loginForm.password"
placeholder="Password"
>
<Icon type="ios-lock-outline" slot="prepend"></Icon> <Icon type="ios-lock-outline" slot="prepend"></Icon>
</Input> </Input>
</FormItem> </FormItem>
...@@ -30,14 +22,14 @@ ...@@ -30,14 +22,14 @@
</div> </div>
</template> </template>
<script> <script>
import { login } from "../api/user.api"; import { login } from '../api/user.api';
import localStorage from "../services/localStorage.service.js"; import localStorage from '../services/localStorage.service.js';
export default { export default {
data() { data() {
var that = this; var that = this;
const validateMenuClassifyId = (rule, value, callback) => { const validateMenuClassifyId = (rule, value, callback) => {
if (this.status) { if (this.status) {
callback(new Error("用户名或密码错误")); callback(new Error('用户名或密码错误'));
this.status = false; this.status = false;
} else { } else {
callback(); callback();
...@@ -45,45 +37,41 @@ export default { ...@@ -45,45 +37,41 @@ export default {
}; };
return { return {
loginForm: { loginForm: {
loginName: "", loginName: '',
password: "" password: '',
}, },
error: "", error: '',
status: false, status: false,
ruleLoginForm: { ruleLoginForm: {
loginName: [ loginName: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
{ required: true, message: "请输入用户名", trigger: "blur" }
],
password: [ password: [
{ required: true, message: "请输入密码", trigger: "blur" }, { required: true, message: '请输入密码', trigger: 'blur' },
{ required: true, validator: validateMenuClassifyId, trigger: "blur" } { required: true, validator: validateMenuClassifyId, trigger: 'blur' },
] ],
} },
}; };
}, },
methods: { methods: {
login() { login() {
this.$refs["loginForm"].validate(valid => { this.$refs['loginForm'].validate(valid => {
if (valid) { if (valid) {
let data = btoa( let data = btoa(`${this.loginForm.loginName}:${this.loginForm.password}`);
`${this.loginForm.loginName}:${this.loginForm.password}`
);
login(data).then(data => { login(data).then(data => {
if (data.code === 400) { if (data.code === 400) {
this.error = data.body; this.error = data.body;
this.status = true; this.status = true;
this.$refs["loginForm"].validate(); this.$refs['loginForm'].validate();
} else { } else {
this.status = false; this.status = false;
localStorage.set("heimdallr-token", data.body["heimdallr-token"]); localStorage.set('heimdallr-token', data.body['heimdallr-token']);
this.$Message.success("登陆成功"); this.$Message.success('登陆成功');
this.$router.push("/mainconfiguration"); this.$router.push('/mainconfiguration');
} }
}); });
} }
}); });
} },
} },
}; };
</script> </script>
<style scoped> <style scoped>
......
const sapi = "http://heimdallr-arch.liangkebang.net"; const sapi = 'http://heimdallr-arch.liangkebang.net';
// const sapi = 'http://192.168.29.88:5555' // const sapi = 'http://192.168.29.88:5555'
export { sapi }; export { sapi };
module.exports = module.exports = process.env.NODE_ENV === 'production' ? require('./prod.config.js') : require('./env.config.js');
process.env.NODE_ENV === "production"
? require("./prod.config.js")
: require("./env.config.js");
const sapi = "//api.stantoo.com"; const sapi = '//api.stantoo.com';
export { sapi }; export { sapi };
// The Vue build version to load with the `import` command // The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from "vue"; import Vue from 'vue';
import App from "./App"; import App from './App';
import router from "./router"; import router from './router';
import iView from "iview"; import iView from 'iview';
import "iview/dist/styles/iview.css"; import 'iview/dist/styles/iview.css';
Vue.use(iView); Vue.use(iView);
Vue.config.productionTip = false; Vue.config.productionTip = false;
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({
el: "#app", el: '#app',
router, router,
components: { App }, components: { App },
template: "<App/>" template: '<App/>',
}); });
import Vue from "vue"; import Vue from 'vue';
import Router from "vue-router"; import Router from 'vue-router';
import login from "@/components/login"; import login from '@/components/login';
import home from "@/components/home"; import home from '@/components/home';
import mainconfiguration from "../pages/mainconfiguration/mainconfiguration.vue"; import mainconfiguration from '../pages/mainconfiguration/mainconfiguration.vue';
Vue.use(Router); Vue.use(Router);
export default new Router({ export default new Router({
routes: [ routes: [
{ {
path: "/", path: '/',
name: "login", name: 'login',
component: login component: login,
}, },
{ {
path: "/home", path: '/home',
name: "home", name: 'home',
component: home, component: home,
children: [ children: [
{ {
path: "/mainconfiguration", path: '/mainconfiguration',
name: "mainconfiguration", name: 'mainconfiguration',
component: mainconfiguration component: mainconfiguration,
} },
] ],
} },
] ],
}); });
import axios from "axios"; import axios from 'axios';
import { Notice } from "iview"; import { Notice } from 'iview';
import localStorage from "./localStorage.service"; import localStorage from './localStorage.service';
// window.Promise = require('es6-promise').Promise // window.Promise = require('es6-promise').Promise
const config = { const config = {
timeout: 600000 timeout: 600000,
// withCredentials: true // 允许携带cookie // withCredentials: true // 允许携带cookie
}; };
const instance = axios.create(Object.assign({}, config)); const instance = axios.create(Object.assign({}, config));
instance._extend = {}; instance._extend = {};
function requestInterceptor(config) { function requestInterceptor(config) {
config.headers["x-requested-with"] = "XMLHttpRequest"; config.headers['x-requested-with'] = 'XMLHttpRequest';
// if (!config.headers['Content-Type']) { // if (!config.headers['Content-Type']) {
// config.headers['Content-Type'] = 'application/x-www-form-urlencoded' // config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
// } // }
if (!config.headers["heimdallr-token"]) { if (!config.headers['heimdallr-token']) {
config.headers["heimdallr-token"] = config.headers['heimdallr-token'] = localStorage.get('heimdallr-token') || '';
localStorage.get("heimdallr-token") || "";
} }
return config; return config;
...@@ -29,10 +28,8 @@ function requestInterceptor(config) { ...@@ -29,10 +28,8 @@ function requestInterceptor(config) {
function responseInterceptor(response) { function responseInterceptor(response) {
if (response.status < 200 || response.status > 300) { if (response.status < 200 || response.status > 300) {
Notice.error({ Notice.error({
title: "请求发生错误", title: '请求发生错误',
desc: desc: (response && response.data && response.data.errorMsg) || '请联系系统管理员',
(response && response.data && response.data.errorMsg) ||
"请联系系统管理员"
}); });
return Promise.reject(response && response.data); return Promise.reject(response && response.data);
} }
...@@ -59,13 +56,13 @@ instance.interceptors.request.use(requestInterceptor, error => { ...@@ -59,13 +56,13 @@ instance.interceptors.request.use(requestInterceptor, error => {
instance.interceptors.response.use(responseInterceptor, error => { instance.interceptors.response.use(responseInterceptor, error => {
if (error.response && error.response.status === 401) { if (error.response && error.response.status === 401) {
window.location.href = window.location.origin + "/login"; window.location.href = window.location.origin + '/login';
} }
if (error.message.indexOf("timeout") !== -1) { if (error.message.indexOf('timeout') !== -1) {
Notice.error({ Notice.error({
title: "", title: '',
desc: "请求超时" desc: '请求超时',
}); });
} }
// return Promise.reject(error) // return Promise.reject(error)
......
...@@ -8,10 +8,7 @@ export default { ...@@ -8,10 +8,7 @@ export default {
}, },
set(key, value) { set(key, value) {
let toString = Object.prototype.toString; let toString = Object.prototype.toString;
if ( if (toString.call(value) === '[object Array]' || toString.call(value) === '[object Object]') {
toString.call(value) === "[object Array]" ||
toString.call(value) === "[object Object]"
) {
value = JSON.stringify(value); value = JSON.stringify(value);
} }
return localStorage.setItem(key, value); return localStorage.setItem(key, value);
...@@ -21,5 +18,5 @@ export default { ...@@ -21,5 +18,5 @@ export default {
}, },
clear() { clear() {
return localStorage.clear(); return localStorage.clear();
} },
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment