Skip to content

Commit

Permalink
feat: use element-ui 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed Dec 11, 2017
1 parent e15d4b1 commit fa16771
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 72 deletions.
3 changes: 3 additions & 0 deletions client/assets/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ textarea {
}
}
}
.input-with-select .el-input-group__prepend {
width: auto
}
@media (max-width: 1440px) {
.container {
width: 100%;
Expand Down
6 changes: 3 additions & 3 deletions client/components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="navbar el-menu--dark">
<el-menu class="el-menu-demo"
:default-active="$route.path" theme="dark">
<div class="navbar">
<el-menu class="el-menu-demo" :default-active="$route.path"
background-color="#324157" text-color="#bfcbd9">
<header>
<el-row>
<el-col :span="20">
Expand Down
2 changes: 1 addition & 1 deletion client/components/activity/NewActivity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</el-col>
<el-col :xs="24" :sm="{span: 3, offset: 2}">
<el-form-item :label="$t('activity.instDist')" prop="delivery">
<el-switch on-text="" off-text="" v-model="formData.delivery"></el-switch>
<el-switch active-text="" inactive-text="" v-model="formData.delivery"></el-switch>
</el-form-item>
</el-col>
</el-row>
Expand Down
14 changes: 7 additions & 7 deletions client/pages/examples/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@
</el-input>
</el-col>
<el-col :offset="2" :span="6" :xs="22">
<!-- <el-input :placeholder="$t('example.inPh')" v-model="restaurant">
<el-select class="input-sel" v-model="restOptions" slot="prepend" :placeholder="$t('example.selPh')">
<el-input :placeholder="$t('example.inPh')" v-model="restaurant" class="input-with-select">
<el-select v-model="restOptions" slot="prepend" :placeholder="$t('example.selPh')">
<el-option label="餐厅名" value="1"></el-option>
<el-option label="订单号" value="2"></el-option>
<el-option label="用户电话" value="3"></el-option>
</el-select>
<el-button slot="append" icon="search"></el-button>
</el-input> -->
<el-button slot="append" icon="el-icon-search"></el-button>
</el-input>
</el-col>
<el-col :offset="2" :span="6" :xs="22">
<el-select v-model="multiFood" multiple :placeholder="$t('example.selPh')">
Expand Down Expand Up @@ -115,11 +115,11 @@
<el-col :offset="2" :span="6" :xs="22">
Switch:
<el-tooltip :content="'Switch value: ' + switcher" placement="top">
<el-switch v-model="switcher" on-color="#13ce66"
off-color="#ff4949" on-value="1" off-value="0">
<el-switch v-model="switcher" active-color="#13ce66"
inactive-color="#ff4949" active-value="1" inactive-value="0">
</el-switch>
</el-tooltip>
<el-switch value='0' off-value="0" disabled></el-switch>
<el-switch value='0' inactive-value="0" disabled></el-switch>
</el-col>
<el-col :offset="2" :span="6" :xs="22">
<el-slider v-model="slider" :max="30" :min="10" :step="5" show-stops show-input></el-slider>
Expand Down
2 changes: 1 addition & 1 deletion client/plugins/element-ui.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import Element from 'element-ui/lib/element-ui.common'
import Element from 'element-ui'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'

Expand Down
109 changes: 54 additions & 55 deletions dist/server-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
return t.d(o, "a", o), o;
}, t.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}, t.p = "", t(t.s = 6);
}, t.p = "", t(t.s = 5);
}([ function(e, t, o) {
"use strict";
function a(e) {
Expand All @@ -35,17 +35,15 @@
Object.defineProperty(t, "__esModule", {
value: !0
});
var n = a(o(3)), r = a(o(5)), s = a(o(24));
const i = process.env.HOST || "0.0.0.0", c = process.env.PORT || "3000";
var n = a(o(2)), r = a(o(4)), i = a(o(24));
const s = process.env.HOST || "0.0.0.0", c = process.env.PORT || "3000";
t.default = (0, r.default)((0, n.default)({
HOST: i,
HOST: s,
PORT: c,
LB_ADDR: process.env.LB_ADDR || `http://${i}:${c}/hpi`
}, s.default));
LB_ADDR: process.env.LB_ADDR || `http://${s}:${c}/hpi`
}, i.default));
}, function(e, t) {
e.exports = require("koa");
}, function(e, t) {
e.exports = require("axios");
}, function(e, t) {
e.exports = require("babel-runtime/helpers/extends");
}, function(e, t) {
Expand All @@ -59,67 +57,66 @@
default: e
};
}
var n = a(o(1)), r = o(7), s = a(o(2)), i = a(o(8)), c = a(o(9)), u = a(o(10)), l = a(o(11)), d = a(o(12)), p = a(o(13)), f = a(o(14)), y = a(o(15)), m = a(o(16)), h = a(o(17)), g = a(o(0)), x = a(o(26)), b = a(o(28)), v = a(o(29)), w = a(o(30));
var n = a(o(1)), r = o(6), i = a(o(7)), s = a(o(8)), c = a(o(9)), u = a(o(10)), l = a(o(11)), d = a(o(12)), p = a(o(13)), f = a(o(14)), y = a(o(15)), m = a(o(16)), h = a(o(0)), g = a(o(26)), x = a(o(28)), b = a(o(29)), v = a(o(30));
!async function() {
const e = /^win/.test(process.platform), t = g.default.HOST, o = g.default.PORT, a = (0,
v.default)("app"), k = new n.default();
k.keys = [ "hare-server" ], x.default.dev = !("production" === k.env), s.default.defaults.baseURL = `http://127.0.0.1:${o}`;
let j = process.env.LOG_DIR || (e ? "C:\\\\log" : "/var/tmp/log");
c.default.sync(j);
const _ = {
const e = /^win/.test(process.platform), t = h.default.HOST, o = h.default.PORT, a = (0,
b.default)("app"), w = new n.default();
w.keys = [ "hare-server" ], g.default.dev = !("production" === w.env);
let k = process.env.LOG_DIR || (e ? "C:\\\\log" : "/var/tmp/log");
s.default.sync(k);
const j = {
type: "rotating-file",
path: `${j = j.replace(/(\\|\/)+$/, "") + (e ? "\\\\" : "/")}hare-access.log`,
level: x.default.dev ? "debug" : "info",
path: `${k = k.replace(/(\\|\/)+$/, "") + (e ? "\\\\" : "/")}hare-access.log`,
level: g.default.dev ? "debug" : "info",
period: "1d",
count: 4
}, q = {
}, _ = {
type: "rotating-file",
path: `${j}hare-error.log`,
path: `${k}hare-error.log`,
level: "error",
period: "1d",
count: 4
}, I = i.default.createLogger({
}, q = i.default.createLogger({
name: "hare",
streams: [ _, q ]
streams: [ j, _ ]
});
k.use((0, u.default)(I, {
w.use((0, c.default)(q, {
level: "info"
})), k.use((0, l.default)(I)), k.use(async function(e, t) {
})), w.use((0, u.default)(q)), w.use(async function(e, t) {
e.state.subapp = e.url.split("/")[1], await t();
});
const O = new r.Nuxt(x.default);
if (O.showOpen = (() => {
const e = "0.0.0.0" === t ? "localhost" : t;
console.log("\n" + b.default.bgGreen.black(" OPEN ") + b.default.green(` http://${e}:${o}\n`));
}), x.default.dev) {
const e = x.default.development;
const I = new r.Nuxt(g.default);
if (g.default.dev) {
const e = g.default.development;
if (e && e.proxies) for (let t of e.proxies) console.log(`Active Proxy: path[${t.path}] target[${t.target}]`),
k.use((0, w.default)(t.path, t));
await new r.Builder(O).build();
w.use((0, v.default)(t.path, t));
await new r.Builder(I).build();
}
const z = (0, d.default)(O.render);
k.use(async (e, t) => {
await t(), e.state.subapp !== g.default.API && (e.status = 200, e.req.session = e.session,
const z = (0, l.default)(I.render);
w.use(async (e, t) => {
await t(), e.state.subapp !== h.default.API && (e.status = 200, e.req.session = e.session,
await z(e));
});
const D = {
key: g.default.SESS_KEY
key: h.default.SESS_KEY
};
k.use((0, m.default)(D, k)), k.use(async function(e, t) {
w.use((0, y.default)(D, w)), w.use(async function(e, t) {
const o = Date.now();
await t();
const a = Date.now();
e.set("X-Response-Time", Math.ceil(a - o) + "ms");
}), k.use((0, y.default)({})), k.use(async function(e, t) {
}), w.use((0, f.default)({})), w.use(async function(e, t) {
await t(), "www" !== e.hostname.slice(0, 3) && e.response.set("X-Robots-Tag", "noindex, nofollow");
}), k.use((0, p.default)()), k.use(async function(e, t) {
}), w.use((0, d.default)()), w.use(async function(e, t) {
a(e.method + " " + e.url), await t();
}), k.use(async function(e, t) {
}), w.use(async function(e, t) {
switch (e.state.subapp) {
case g.default.API:
await (0, f.default)(h.default.middleware)(e);
case h.default.API:
await (0, p.default)(m.default.middleware)(e);
}
}), k.listen(o, t);
}), w.listen(o, t);
const O = "0.0.0.0" === t ? "localhost" : t;
console.log("\n" + x.default.bgGreen.black(" OPEN ") + x.default.green(` http://${O}:${o}\n`));
}();
}, function(e, t) {
e.exports = require("nuxt");
Expand Down Expand Up @@ -151,7 +148,7 @@
Object.defineProperty(t, "__esModule", {
value: !0
});
var n = a(o(3)), r = a(o(1)), s = a(o(18)), i = a(o(19)), c = a(o(20)), u = a(o(25));
var n = a(o(2)), r = a(o(1)), i = a(o(17)), s = a(o(18)), c = a(o(19)), u = a(o(25));
const l = new r.default();
l.use(async function(e, t) {
if (await t(), !e.body) return;
Expand All @@ -165,12 +162,12 @@
case "xml":
e.type = o;
const t = e.body.root;
delete e.body.root, e.body = (0, s.default)(e.body, t);
delete e.body.root, e.body = (0, i.default)(e.body, t);
break;

case "yaml":
case "text":
delete e.body.root, e.type = "yaml", e.body = i.default.dump(e.body);
delete e.body.root, e.type = "yaml", e.body = s.default.dump(e.body);
break;

case !1:
Expand Down Expand Up @@ -213,8 +210,8 @@
default: e
};
}
var n = a(o(21)), r = a(o(2)), s = a(o(22)), i = a(o(4)), c = a(o(23)), u = a(o(0));
const l = (0, i.default)({
var n = a(o(20)), r = a(o(21)), i = a(o(22)), s = a(o(3)), c = a(o(23)), u = a(o(0));
const l = (0, s.default)({
prefix: u.default.BASE_API
});
var d = r.default.create({
Expand All @@ -229,7 +226,7 @@
const t = e.request.body;
t && t.userName && t.password || e.throw(401, "用户名/密码未填写"), e.session.captcha.toLowerCase() !== t.captcha.toLowerCase() && e.throw(401, "验证码输入错误");
try {
const o = await d.post("/platform/uaano/oauth/token", s.default.stringify({
const o = await d.post("/platform/uaano/oauth/token", i.default.stringify({
username: t.userName,
password: Buffer.from(t.password).toString("base64"),
grant_type: "password"
Expand Down Expand Up @@ -300,6 +297,8 @@
}), e.exports = l.routes();
}, function(e, t) {
e.exports = require("babel-runtime/core-js/object/assign");
}, function(e, t) {
e.exports = require("axios");
}, function(e, t) {
e.exports = require("querystring");
}, function(e, t) {
Expand All @@ -313,7 +312,7 @@
return e && e.__esModule ? e : {
default: e
};
}(o(5));
}(o(4));
t.default = (0, a.default)({
APP: "hare",
API: "hpi",
Expand All @@ -328,11 +327,11 @@
default: e
};
}
var n = a(o(4)), r = a(o(0));
const s = (0, n.default)({
var n = a(o(3)), r = a(o(0));
const i = (0, n.default)({
prefix: r.default.BASE_API
});
s.get("/activities", async function(e) {
i.get("/activities", async function(e) {
e.status = 200, e.body = [ {
account: "活动1",
date: "2017-1-1",
Expand Down Expand Up @@ -414,7 +413,7 @@
organizer: "销售部海外部",
desc: "Description example of activity in New York"
} ];
}), e.exports = s.routes();
}), e.exports = i.routes();
}, function(e, t, o) {
"use strict";
const a = o(27);
Expand Down Expand Up @@ -449,7 +448,7 @@
babel: {
plugins: [ "transform-decorators-legacy", "transform-class-properties" ]
},
extend(e, {dev: t, isClient: o}) {
extend(e, {isDev: t}) {
e.resolve.alias["class-component"] = "@/plugins/class-component";
},
vendor: [ "axios", "element-ui", "negotiator", "vue-class-component", "vuex-class", "vue-i18n", "vue-chartjs", "vue-clipboards", "moment", "chart.js", "deepmerge" ],
Expand All @@ -467,7 +466,7 @@
generate: {
dir: ".generated"
},
css: [ "normalize.css/normalize.css", "element-ui/lib/theme-default/index.css", {
css: [ "normalize.css/normalize.css", "element-ui/lib/theme-chalk/index.css", {
src: "@/assets/styles/main.scss",
lang: "scss"
} ],
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ module.exports = {
*/
css: [
'normalize.css/normalize.css',
'element-ui/lib/theme-default/index.css',
'element-ui/lib/theme-chalk/index.css',
{src: '@/assets/styles/main.scss', lang: 'scss'}
],
/*
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"bunyan": "^1.8.12",
"chart.js": "^2.7.1",
"cross-env": "^5.1.0",
"element-ui": "^1.4.12",
"element-ui": "^2.0.7",
"js-cookie": "^2.2.0",
"js-yaml": "^3.9.1",
"jwt-decode": "^2.2.0",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2873,9 +2873,9 @@ elegant-spinner@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e"

element-ui@^1.4.12:
version "1.4.12"
resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-1.4.12.tgz#a355358c708d78bb8a5b7ff8e5270bf747bb6103"
element-ui@^2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-2.0.7.tgz#29e6a156ff43b19a9eefcbf6c69999bd79662c8a"
dependencies:
async-validator "~1.8.1"
babel-helper-vue-jsx-merge-props "^2.0.0"
Expand Down

0 comments on commit fa16771

Please sign in to comment.