Try to use vuex to store user profile and website config, upgrade some package

This commit is contained in:
zema1 2017-09-24 21:30:14 +08:00
parent 58c859db44
commit a4ff420f8e
15 changed files with 453 additions and 346 deletions

475
oj/package-lock.json generated
View File

@ -185,9 +185,9 @@
"dev": true "dev": true
}, },
"asap": { "asap": {
"version": "2.0.5", "version": "2.0.6",
"resolved": "http://registry.npm.taobao.org/asap/download/asap-2.0.5.tgz", "resolved": "http://registry.npm.taobao.org/asap/download/asap-2.0.6.tgz",
"integrity": "sha1-UidltQw1EEkOUtfc/ghe+bqWlY8=", "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
@ -219,11 +219,10 @@
} }
}, },
"assert-plus": { "assert-plus": {
"version": "0.2.0", "version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-0.2.0.tgz", "resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz",
"integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true, "dev": true
"optional": true
}, },
"async": { "async": {
"version": "2.4.1", "version": "2.4.1",
@ -270,9 +269,9 @@
} }
}, },
"aws-sign2": { "aws-sign2": {
"version": "0.6.0", "version": "0.7.0",
"resolved": "http://registry.npm.taobao.org/aws-sign2/download/aws-sign2-0.6.0.tgz", "resolved": "http://registry.npm.taobao.org/aws-sign2/download/aws-sign2-0.7.0.tgz",
"integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
@ -1509,12 +1508,13 @@
"dev": true "dev": true
}, },
"boom": { "boom": {
"version": "2.10.1", "version": "4.3.1",
"resolved": "http://registry.npm.taobao.org/boom/download/boom-2.10.1.tgz", "resolved": "http://registry.npm.taobao.org/boom/download/boom-4.3.1.tgz",
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"hoek": "2.16.3" "hoek": "4.2.0"
} }
}, },
"brace-expansion": { "brace-expansion": {
@ -2170,13 +2170,25 @@
} }
}, },
"cryptiles": { "cryptiles": {
"version": "2.0.5", "version": "3.1.2",
"resolved": "http://registry.npm.taobao.org/cryptiles/download/cryptiles-2.0.5.tgz", "resolved": "http://registry.npm.taobao.org/cryptiles/download/cryptiles-3.1.2.tgz",
"integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"boom": "2.10.1" "boom": "5.2.0"
},
"dependencies": {
"boom": {
"version": "5.2.0",
"resolved": "http://registry.npm.taobao.org/boom/download/boom-5.2.0.tgz",
"integrity": "sha1-XdnabuOl8wIHdDYpDLcX0/SlTgI=",
"dev": true,
"optional": true,
"requires": {
"hoek": "4.2.0"
}
}
} }
}, },
"crypto-browserify": { "crypto-browserify": {
@ -2204,9 +2216,9 @@
"dev": true "dev": true
}, },
"css-loader": { "css-loader": {
"version": "0.28.5", "version": "0.28.7",
"resolved": "http://registry.npm.taobao.org/css-loader/download/css-loader-0.28.5.tgz", "resolved": "http://registry.npm.taobao.org/css-loader/download/css-loader-0.28.7.tgz",
"integrity": "sha1-3QK7kblFRXECEu9/aqpmZjET11Q=", "integrity": "sha1-Xy7pid0y7dkHcX+VMxdlYWCZnBs=",
"dev": true, "dev": true,
"requires": { "requires": {
"babel-code-frame": "6.22.0", "babel-code-frame": "6.22.0",
@ -2360,15 +2372,6 @@
"optional": true, "optional": true,
"requires": { "requires": {
"assert-plus": "1.0.0" "assert-plus": "1.0.0"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true,
"optional": true
}
} }
}, },
"date-now": { "date-now": {
@ -2404,9 +2407,9 @@
"dev": true "dev": true
}, },
"deepmerge": { "deepmerge": {
"version": "1.5.1", "version": "1.5.2",
"resolved": "http://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.1.tgz", "resolved": "http://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz",
"integrity": "sha1-wFO/Bv1ydvGZT3DAmgdgy2GlYjc=" "integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M="
}, },
"defined": { "defined": {
"version": "1.0.0", "version": "1.0.0",
@ -3104,9 +3107,9 @@
} }
}, },
"extsprintf": { "extsprintf": {
"version": "1.0.2", "version": "1.3.0",
"resolved": "http://registry.npm.taobao.org/extsprintf/download/extsprintf-1.0.2.tgz", "resolved": "http://registry.npm.taobao.org/extsprintf/download/extsprintf-1.3.0.tgz",
"integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
"dev": true "dev": true
}, },
"fast-deep-equal": { "fast-deep-equal": {
@ -3266,9 +3269,9 @@
"optional": true "optional": true
}, },
"form-data": { "form-data": {
"version": "2.1.4", "version": "2.3.1",
"resolved": "http://registry.npm.taobao.org/form-data/download/form-data-2.1.4.tgz", "resolved": "http://registry.npm.taobao.org/form-data/download/form-data-2.3.1.tgz",
"integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
@ -4088,14 +4091,6 @@
} }
} }
}, },
"string_decoder": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
@ -4106,6 +4101,14 @@
"strip-ansi": "3.0.1" "strip-ansi": "3.0.1"
} }
}, },
"string_decoder": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"stringstream": { "stringstream": {
"version": "0.0.5", "version": "0.0.5",
"bundled": true, "bundled": true,
@ -4253,15 +4256,6 @@
"optional": true, "optional": true,
"requires": { "requires": {
"assert-plus": "1.0.0" "assert-plus": "1.0.0"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true,
"optional": true
}
} }
}, },
"glob": { "glob": {
@ -4388,21 +4382,43 @@
} }
}, },
"har-schema": { "har-schema": {
"version": "1.0.5", "version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/har-schema/download/har-schema-1.0.5.tgz", "resolved": "http://registry.npm.taobao.org/har-schema/download/har-schema-2.0.0.tgz",
"integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"har-validator": { "har-validator": {
"version": "4.2.1", "version": "5.0.3",
"resolved": "http://registry.npm.taobao.org/har-validator/download/har-validator-4.2.1.tgz", "resolved": "http://registry.npm.taobao.org/har-validator/download/har-validator-5.0.3.tgz",
"integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"ajv": "4.11.8", "ajv": "5.2.2",
"har-schema": "1.0.5" "har-schema": "2.0.0"
},
"dependencies": {
"ajv": {
"version": "5.2.2",
"resolved": "http://registry.npm.taobao.org/ajv/download/ajv-5.2.2.tgz",
"integrity": "sha1-R8aNaehvXZUxA7AHSpQw3GPaXjk=",
"dev": true,
"optional": true,
"requires": {
"co": "4.6.0",
"fast-deep-equal": "1.0.0",
"json-schema-traverse": "0.3.0",
"json-stable-stringify": "1.0.1"
}
},
"fast-deep-equal": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-1.0.0.tgz",
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=",
"dev": true,
"optional": true
}
} }
}, },
"has": { "has": {
@ -4455,16 +4471,16 @@
} }
}, },
"hawk": { "hawk": {
"version": "3.1.3", "version": "6.0.2",
"resolved": "http://registry.npm.taobao.org/hawk/download/hawk-3.1.3.tgz", "resolved": "http://registry.npm.taobao.org/hawk/download/hawk-6.0.2.tgz",
"integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", "integrity": "sha1-r02RTrBl+bXOTZ0RwcshJu7MMDg=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"boom": "2.10.1", "boom": "4.3.1",
"cryptiles": "2.0.5", "cryptiles": "3.1.2",
"hoek": "2.16.3", "hoek": "4.2.0",
"sntp": "1.0.9" "sntp": "2.0.2"
} }
}, },
"he": { "he": {
@ -4490,9 +4506,9 @@
} }
}, },
"hoek": { "hoek": {
"version": "2.16.3", "version": "4.2.0",
"resolved": "http://registry.npm.taobao.org/hoek/download/hoek-2.16.3.tgz", "resolved": "http://registry.npm.taobao.org/hoek/download/hoek-4.2.0.tgz",
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", "integrity": "sha1-ctnQdU9/4lyi0BrY+PmpRJqJUm0=",
"dev": true "dev": true
}, },
"home-or-tmp": { "home-or-tmp": {
@ -4630,14 +4646,14 @@
} }
}, },
"http-signature": { "http-signature": {
"version": "1.1.1", "version": "1.2.0",
"resolved": "http://registry.npm.taobao.org/http-signature/download/http-signature-1.1.1.tgz", "resolved": "http://registry.npm.taobao.org/http-signature/download/http-signature-1.2.0.tgz",
"integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"assert-plus": "0.2.0", "assert-plus": "1.0.0",
"jsprim": "1.4.0", "jsprim": "1.4.1",
"sshpk": "1.13.1" "sshpk": "1.13.1"
} }
}, },
@ -4664,7 +4680,7 @@
"integrity": "sha1-g/Cg7DeL8yRheLbCrZE28TWxyWI=", "integrity": "sha1-g/Cg7DeL8yRheLbCrZE28TWxyWI=",
"dev": true, "dev": true,
"requires": { "requires": {
"postcss": "6.0.9" "postcss": "6.0.11"
}, },
"dependencies": { "dependencies": {
"ansi-styles": { "ansi-styles": {
@ -4684,7 +4700,7 @@
"requires": { "requires": {
"ansi-styles": "3.2.0", "ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"has-flag": { "has-flag": {
@ -4694,20 +4710,26 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "6.0.9", "version": "6.0.11",
"resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.9.tgz", "resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.11.tgz",
"integrity": "sha1-VIGXZnhKUcZbHsTVTC+TdlQ4w1o=", "integrity": "sha1-9I2yELHTen96tkmbelSYKZerb3I=",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "2.1.0", "chalk": "2.1.0",
"source-map": "0.5.6", "source-map": "0.5.7",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"source-map": {
"version": "0.5.7",
"resolved": "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"supports-color": { "supports-color": {
"version": "4.2.1", "version": "4.4.0",
"resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.2.1.tgz", "resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.4.0.tgz",
"integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=",
"dev": true, "dev": true,
"requires": { "requires": {
"has-flag": "2.0.0" "has-flag": "2.0.0"
@ -5046,7 +5068,7 @@
"requires": { "requires": {
"async-validator": "1.8.1", "async-validator": "1.8.1",
"core-js": "2.5.1", "core-js": "2.5.1",
"deepmerge": "1.5.1", "deepmerge": "1.5.2",
"popper.js": "0.6.4", "popper.js": "0.6.4",
"tinycolor2": "1.4.1" "tinycolor2": "1.4.1"
}, },
@ -5065,9 +5087,9 @@
"dev": true "dev": true
}, },
"js-beautify": { "js-beautify": {
"version": "1.6.14", "version": "1.7.3",
"resolved": "http://registry.npm.taobao.org/js-beautify/download/js-beautify-1.6.14.tgz", "resolved": "http://registry.npm.taobao.org/js-beautify/download/js-beautify-1.7.3.tgz",
"integrity": "sha1-07j3Mi0CuSd9WL0jgmTDJ+WARM0=", "integrity": "sha1-P1YwZxYs0GNchhFobR+guxRIdzo=",
"dev": true, "dev": true,
"requires": { "requires": {
"config-chain": "1.1.11", "config-chain": "1.1.11",
@ -5168,25 +5190,16 @@
"dev": true "dev": true
}, },
"jsprim": { "jsprim": {
"version": "1.4.0", "version": "1.4.1",
"resolved": "http://registry.npm.taobao.org/jsprim/download/jsprim-1.4.0.tgz", "resolved": "http://registry.npm.taobao.org/jsprim/download/jsprim-1.4.1.tgz",
"integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"assert-plus": "1.0.0", "assert-plus": "1.0.0",
"extsprintf": "1.0.2", "extsprintf": "1.3.0",
"json-schema": "0.2.3", "json-schema": "0.2.3",
"verror": "1.3.6" "verror": "1.10.0"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true,
"optional": true
}
} }
}, },
"kind-of": { "kind-of": {
@ -5234,7 +5247,7 @@
"mime": "1.3.6", "mime": "1.3.6",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"promise": "7.3.1", "promise": "7.3.1",
"request": "2.81.0", "request": "2.82.0",
"source-map": "0.5.6" "source-map": "0.5.6"
} }
}, },
@ -6011,9 +6024,9 @@
} }
}, },
"performance-now": { "performance-now": {
"version": "0.2.0", "version": "2.1.0",
"resolved": "http://registry.npm.taobao.org/performance-now/download/performance-now-0.2.0.tgz", "resolved": "http://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz",
"integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
@ -6280,7 +6293,7 @@
"integrity": "sha1-thTJcgvmgW6u41+zpfqh26agXds=", "integrity": "sha1-thTJcgvmgW6u41+zpfqh26agXds=",
"dev": true, "dev": true,
"requires": { "requires": {
"postcss": "6.0.9" "postcss": "6.0.11"
}, },
"dependencies": { "dependencies": {
"ansi-styles": { "ansi-styles": {
@ -6300,7 +6313,7 @@
"requires": { "requires": {
"ansi-styles": "3.2.0", "ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"has-flag": { "has-flag": {
@ -6310,20 +6323,26 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "6.0.9", "version": "6.0.11",
"resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.9.tgz", "resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.11.tgz",
"integrity": "sha1-VIGXZnhKUcZbHsTVTC+TdlQ4w1o=", "integrity": "sha1-9I2yELHTen96tkmbelSYKZerb3I=",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "2.1.0", "chalk": "2.1.0",
"source-map": "0.5.6", "source-map": "0.5.7",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"source-map": {
"version": "0.5.7",
"resolved": "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"supports-color": { "supports-color": {
"version": "4.2.1", "version": "4.4.0",
"resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.2.1.tgz", "resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.4.0.tgz",
"integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=",
"dev": true, "dev": true,
"requires": { "requires": {
"has-flag": "2.0.0" "has-flag": "2.0.0"
@ -6338,7 +6357,7 @@
"dev": true, "dev": true,
"requires": { "requires": {
"css-selector-tokenizer": "0.7.0", "css-selector-tokenizer": "0.7.0",
"postcss": "6.0.9" "postcss": "6.0.11"
}, },
"dependencies": { "dependencies": {
"ansi-styles": { "ansi-styles": {
@ -6358,7 +6377,7 @@
"requires": { "requires": {
"ansi-styles": "3.2.0", "ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"has-flag": { "has-flag": {
@ -6368,20 +6387,26 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "6.0.9", "version": "6.0.11",
"resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.9.tgz", "resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.11.tgz",
"integrity": "sha1-VIGXZnhKUcZbHsTVTC+TdlQ4w1o=", "integrity": "sha1-9I2yELHTen96tkmbelSYKZerb3I=",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "2.1.0", "chalk": "2.1.0",
"source-map": "0.5.6", "source-map": "0.5.7",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"source-map": {
"version": "0.5.7",
"resolved": "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"supports-color": { "supports-color": {
"version": "4.2.1", "version": "4.4.0",
"resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.2.1.tgz", "resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.4.0.tgz",
"integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=",
"dev": true, "dev": true,
"requires": { "requires": {
"has-flag": "2.0.0" "has-flag": "2.0.0"
@ -6396,7 +6421,7 @@
"dev": true, "dev": true,
"requires": { "requires": {
"css-selector-tokenizer": "0.7.0", "css-selector-tokenizer": "0.7.0",
"postcss": "6.0.9" "postcss": "6.0.11"
}, },
"dependencies": { "dependencies": {
"ansi-styles": { "ansi-styles": {
@ -6416,7 +6441,7 @@
"requires": { "requires": {
"ansi-styles": "3.2.0", "ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"has-flag": { "has-flag": {
@ -6426,20 +6451,26 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "6.0.9", "version": "6.0.11",
"resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.9.tgz", "resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.11.tgz",
"integrity": "sha1-VIGXZnhKUcZbHsTVTC+TdlQ4w1o=", "integrity": "sha1-9I2yELHTen96tkmbelSYKZerb3I=",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "2.1.0", "chalk": "2.1.0",
"source-map": "0.5.6", "source-map": "0.5.7",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"source-map": {
"version": "0.5.7",
"resolved": "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"supports-color": { "supports-color": {
"version": "4.2.1", "version": "4.4.0",
"resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.2.1.tgz", "resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.4.0.tgz",
"integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=",
"dev": true, "dev": true,
"requires": { "requires": {
"has-flag": "2.0.0" "has-flag": "2.0.0"
@ -6454,7 +6485,7 @@
"dev": true, "dev": true,
"requires": { "requires": {
"icss-replace-symbols": "1.1.0", "icss-replace-symbols": "1.1.0",
"postcss": "6.0.9" "postcss": "6.0.11"
}, },
"dependencies": { "dependencies": {
"ansi-styles": { "ansi-styles": {
@ -6474,7 +6505,7 @@
"requires": { "requires": {
"ansi-styles": "3.2.0", "ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5", "escape-string-regexp": "1.0.5",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"has-flag": { "has-flag": {
@ -6484,20 +6515,26 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "6.0.9", "version": "6.0.11",
"resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.9.tgz", "resolved": "http://registry.npm.taobao.org/postcss/download/postcss-6.0.11.tgz",
"integrity": "sha1-VIGXZnhKUcZbHsTVTC+TdlQ4w1o=", "integrity": "sha1-9I2yELHTen96tkmbelSYKZerb3I=",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "2.1.0", "chalk": "2.1.0",
"source-map": "0.5.6", "source-map": "0.5.7",
"supports-color": "4.2.1" "supports-color": "4.4.0"
} }
}, },
"source-map": {
"version": "0.5.7",
"resolved": "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"supports-color": { "supports-color": {
"version": "4.2.1", "version": "4.4.0",
"resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.2.1.tgz", "resolved": "http://registry.npm.taobao.org/supports-color/download/supports-color-4.4.0.tgz",
"integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=",
"dev": true, "dev": true,
"requires": { "requires": {
"has-flag": "2.0.0" "has-flag": "2.0.0"
@ -6676,7 +6713,7 @@
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"asap": "2.0.5" "asap": "2.0.6"
} }
}, },
"proto-list": { "proto-list": {
@ -6733,9 +6770,9 @@
"dev": true "dev": true
}, },
"qs": { "qs": {
"version": "6.4.0", "version": "6.5.1",
"resolved": "http://registry.npm.taobao.org/qs/download/qs-6.4.0.tgz", "resolved": "http://registry.npm.taobao.org/qs/download/qs-6.5.1.tgz",
"integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", "integrity": "sha1-NJzfbu+J7EXBLX1es/wMhwNDptg=",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
@ -7096,34 +7133,53 @@
} }
}, },
"request": { "request": {
"version": "2.81.0", "version": "2.82.0",
"resolved": "http://registry.npm.taobao.org/request/download/request-2.81.0.tgz", "resolved": "http://registry.npm.taobao.org/request/download/request-2.82.0.tgz",
"integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", "integrity": "sha1-K6ipLNesRWYOorEKU65nzSR1Fuo=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"aws-sign2": "0.6.0", "aws-sign2": "0.7.0",
"aws4": "1.6.0", "aws4": "1.6.0",
"caseless": "0.12.0", "caseless": "0.12.0",
"combined-stream": "1.0.5", "combined-stream": "1.0.5",
"extend": "3.0.1", "extend": "3.0.1",
"forever-agent": "0.6.1", "forever-agent": "0.6.1",
"form-data": "2.1.4", "form-data": "2.3.1",
"har-validator": "4.2.1", "har-validator": "5.0.3",
"hawk": "3.1.3", "hawk": "6.0.2",
"http-signature": "1.1.1", "http-signature": "1.2.0",
"is-typedarray": "1.0.0", "is-typedarray": "1.0.0",
"isstream": "0.1.2", "isstream": "0.1.2",
"json-stringify-safe": "5.0.1", "json-stringify-safe": "5.0.1",
"mime-types": "2.1.15", "mime-types": "2.1.17",
"oauth-sign": "0.8.2", "oauth-sign": "0.8.2",
"performance-now": "0.2.0", "performance-now": "2.1.0",
"qs": "6.4.0", "qs": "6.5.1",
"safe-buffer": "5.1.1", "safe-buffer": "5.1.1",
"stringstream": "0.0.5", "stringstream": "0.0.5",
"tough-cookie": "2.3.2", "tough-cookie": "2.3.3",
"tunnel-agent": "0.6.0", "tunnel-agent": "0.6.0",
"uuid": "3.1.0" "uuid": "3.1.0"
},
"dependencies": {
"mime-db": {
"version": "1.30.0",
"resolved": "http://registry.npm.taobao.org/mime-db/download/mime-db-1.30.0.tgz",
"integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=",
"dev": true,
"optional": true
},
"mime-types": {
"version": "2.1.17",
"resolved": "http://registry.npm.taobao.org/mime-types/download/mime-types-2.1.17.tgz",
"integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=",
"dev": true,
"optional": true,
"requires": {
"mime-db": "1.30.0"
}
}
} }
}, },
"require-directory": { "require-directory": {
@ -7411,13 +7467,13 @@
"dev": true "dev": true
}, },
"sntp": { "sntp": {
"version": "1.0.9", "version": "2.0.2",
"resolved": "http://registry.npm.taobao.org/sntp/download/sntp-1.0.9.tgz", "resolved": "http://registry.npm.taobao.org/sntp/download/sntp-2.0.2.tgz",
"integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"hoek": "2.16.3" "hoek": "4.2.0"
} }
}, },
"sort-keys": { "sort-keys": {
@ -7492,15 +7548,6 @@
"getpass": "0.1.7", "getpass": "0.1.7",
"jsbn": "0.1.1", "jsbn": "0.1.1",
"tweetnacl": "0.14.5" "tweetnacl": "0.14.5"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true,
"optional": true
}
} }
}, },
"stackframe": { "stackframe": {
@ -7544,15 +7591,6 @@
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
"dev": true "dev": true
}, },
"string_decoder": {
"version": "1.0.3",
"resolved": "http://registry.npm.taobao.org/string_decoder/download/string_decoder-1.0.3.tgz",
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"string-length": { "string-length": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "http://registry.npm.taobao.org/string-length/download/string-length-1.0.1.tgz", "resolved": "http://registry.npm.taobao.org/string-length/download/string-length-1.0.1.tgz",
@ -7573,6 +7611,15 @@
"strip-ansi": "3.0.1" "strip-ansi": "3.0.1"
} }
}, },
"string_decoder": {
"version": "1.0.3",
"resolved": "http://registry.npm.taobao.org/string_decoder/download/string_decoder-1.0.3.tgz",
"integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"stringstream": { "stringstream": {
"version": "0.0.5", "version": "0.0.5",
"resolved": "http://registry.npm.taobao.org/stringstream/download/stringstream-0.0.5.tgz", "resolved": "http://registry.npm.taobao.org/stringstream/download/stringstream-0.0.5.tgz",
@ -7714,9 +7761,9 @@
"dev": true "dev": true
}, },
"tough-cookie": { "tough-cookie": {
"version": "2.3.2", "version": "2.3.3",
"resolved": "http://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.3.2.tgz", "resolved": "http://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.3.3.tgz",
"integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
@ -7955,13 +8002,15 @@
"dev": true "dev": true
}, },
"verror": { "verror": {
"version": "1.3.6", "version": "1.10.0",
"resolved": "http://registry.npm.taobao.org/verror/download/verror-1.3.6.tgz", "resolved": "http://registry.npm.taobao.org/verror/download/verror-1.10.0.tgz",
"integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"extsprintf": "1.0.2" "assert-plus": "1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "1.3.0"
} }
}, },
"vm-browserify": { "vm-browserify": {
@ -7974,9 +8023,9 @@
} }
}, },
"vue": { "vue": {
"version": "2.4.2", "version": "2.4.4",
"resolved": "http://registry.npm.taobao.org/vue/download/vue-2.4.2.tgz", "resolved": "http://registry.npm.taobao.org/vue/download/vue-2.4.4.tgz",
"integrity": "sha1-qYVSYfGRyXjMDcEVBTG40IFJtYw=" "integrity": "sha1-6pVQuWpxRl/SuLF7YWc7NWGGF4k="
}, },
"vue-codemirror": { "vue-codemirror": {
"version": "3.1.4", "version": "3.1.4",
@ -8014,11 +8063,6 @@
"integrity": "sha1-nKWKbg35B4VUzhcIaItleHVNht4=", "integrity": "sha1-nKWKbg35B4VUzhcIaItleHVNht4=",
"dev": true "dev": true
}, },
"vue-lazyload": {
"version": "1.1.3",
"resolved": "http://registry.npm.taobao.org/vue-lazyload/download/vue-lazyload-1.1.3.tgz",
"integrity": "sha1-UnoePmumUJ/icybTTwq5aHyaHpU="
},
"vue-loader": { "vue-loader": {
"version": "12.2.2", "version": "12.2.2",
"resolved": "http://registry.npm.taobao.org/vue-loader/download/vue-loader-12.2.2.tgz", "resolved": "http://registry.npm.taobao.org/vue-loader/download/vue-loader-12.2.2.tgz",
@ -8027,7 +8071,7 @@
"requires": { "requires": {
"consolidate": "0.14.5", "consolidate": "0.14.5",
"hash-sum": "1.0.2", "hash-sum": "1.0.2",
"js-beautify": "1.6.14", "js-beautify": "1.7.3",
"loader-utils": "1.1.0", "loader-utils": "1.1.0",
"lru-cache": "4.1.1", "lru-cache": "4.1.1",
"postcss": "5.2.17", "postcss": "5.2.17",
@ -8036,7 +8080,7 @@
"resolve": "1.3.3", "resolve": "1.3.3",
"source-map": "0.5.6", "source-map": "0.5.6",
"vue-hot-reload-api": "2.1.0", "vue-hot-reload-api": "2.1.0",
"vue-style-loader": "3.0.1", "vue-style-loader": "3.0.3",
"vue-template-es2015-compiler": "1.5.3" "vue-template-es2015-compiler": "1.5.3"
} }
}, },
@ -8046,9 +8090,9 @@
"integrity": "sha1-FtQkSTqlHDyMzot8chDqTDqJr/E=" "integrity": "sha1-FtQkSTqlHDyMzot8chDqTDqJr/E="
}, },
"vue-style-loader": { "vue-style-loader": {
"version": "3.0.1", "version": "3.0.3",
"resolved": "http://registry.npm.taobao.org/vue-style-loader/download/vue-style-loader-3.0.1.tgz", "resolved": "http://registry.npm.taobao.org/vue-style-loader/download/vue-style-loader-3.0.3.tgz",
"integrity": "sha1-yLY5uy8kuvnXgnTcF+TyZMHe2gg=", "integrity": "sha1-YjZY+BUGrvnRIc3BE6T1ycrDLfc=",
"dev": true, "dev": true,
"requires": { "requires": {
"hash-sum": "1.0.2", "hash-sum": "1.0.2",
@ -8056,9 +8100,9 @@
} }
}, },
"vue-template-compiler": { "vue-template-compiler": {
"version": "2.4.2", "version": "2.4.4",
"resolved": "http://registry.npm.taobao.org/vue-template-compiler/download/vue-template-compiler-2.4.2.tgz", "resolved": "http://registry.npm.taobao.org/vue-template-compiler/download/vue-template-compiler-2.4.4.tgz",
"integrity": "sha1-WkXYQ/FIsJj2wdHjWsIMSVbTCtE=", "integrity": "sha1-LN47cEEkmFwn1QtTh8lpG6UV+1c=",
"dev": true, "dev": true,
"requires": { "requires": {
"de-indent": "1.0.2", "de-indent": "1.0.2",
@ -8071,6 +8115,11 @@
"integrity": "sha1-Inh95ON+vZM5t0IjvEZ9Gt7jBUU=", "integrity": "sha1-Inh95ON+vZM5t0IjvEZ9Gt7jBUU=",
"dev": true "dev": true
}, },
"vuex": {
"version": "2.4.0",
"resolved": "http://registry.npm.taobao.org/vuex/download/vuex-2.4.0.tgz",
"integrity": "sha1-4dBDBkYoK0AAf90G7Groip9aHhQ="
},
"watchpack": { "watchpack": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "http://registry.npm.taobao.org/watchpack/download/watchpack-1.4.0.tgz", "resolved": "http://registry.npm.taobao.org/watchpack/download/watchpack-1.4.0.tgz",

View File

@ -17,13 +17,13 @@
"i": "^0.3.5", "i": "^0.3.5",
"iview": "^2.3.2", "iview": "^2.3.2",
"moment": "^2.18.1", "moment": "^2.18.1",
"vue": "^2.4.2", "vue": "^2.4.4",
"vue-codemirror": "^3.1.4", "vue-codemirror": "^3.1.4",
"vue-cropper": "^0.2.1", "vue-cropper": "^0.2.1",
"vue-echarts": "^2.4.0", "vue-echarts": "^2.4.0",
"vue-highlightjs": "^1.3.3", "vue-highlightjs": "^1.3.3",
"vue-lazyload": "^1.1.3", "vue-router": "^2.7.0",
"vue-router": "^2.7.0" "vuex": "^2.4.0"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^6.7.2", "autoprefixer": "^6.7.2",
@ -37,7 +37,7 @@
"chalk": "^1.1.3", "chalk": "^1.1.3",
"connect-history-api-fallback": "^1.3.0", "connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1", "copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.5", "css-loader": "^0.28.7",
"eslint": "^3.19.0", "eslint": "^3.19.0",
"eslint-config-standard": "^6.2.1", "eslint-config-standard": "^6.2.1",
"eslint-friendly-formatter": "^2.0.7", "eslint-friendly-formatter": "^2.0.7",
@ -48,7 +48,7 @@
"eventsource-polyfill": "^0.9.6", "eventsource-polyfill": "^0.9.6",
"express": "^4.15.4", "express": "^4.15.4",
"extract-text-webpack-plugin": "^2.0.0", "extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1", "file-loader": "^0.11.2",
"friendly-errors-webpack-plugin": "^1.1.3", "friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"http-proxy-middleware": "^0.17.3", "http-proxy-middleware": "^0.17.3",
@ -60,10 +60,10 @@
"rimraf": "^2.6.0", "rimraf": "^2.6.0",
"semver": "^5.4.1", "semver": "^5.4.1",
"shelljs": "^0.7.6", "shelljs": "^0.7.6",
"url-loader": "^0.5.8", "url-loader": "^0.5.9",
"vue-loader": "^12.2.2", "vue-loader": "^12.2.2",
"vue-style-loader": "^3.0.1", "vue-style-loader": "^3.0.3",
"vue-template-compiler": "^2.4.2", "vue-template-compiler": "^2.4.4",
"webpack": "^2.7.0", "webpack": "^2.7.0",
"webpack-bundle-analyzer": "^2.9.0", "webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-middleware": "^1.12.0", "webpack-dev-middleware": "^1.12.0",

View File

@ -1,39 +1,38 @@
<template> <template>
<div> <div>
<NavBar></NavBar> <NavBar></NavBar>
<!--<breadcrumb></breadcrumb>-->
<div class="content-app"> <div class="content-app">
<router-view></router-view> <router-view></router-view>
<div class="footer"> <div class="footer">
{{footer}} Build Version: {{ version }} {{website.footer}} Build Version: {{ version }}
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import api from '@/api' import {mapActions, mapState} from 'vuex'
import utils from '@/utils/utils'
import NavBar from './components/NavBar.vue' import NavBar from './components/NavBar.vue'
export default { export default {
name: 'app', name: 'app',
mounted() { mounted() {
api.getWebsiteConf().then(res => { this.getWebsiteConfig()
utils.setWebsiteConf(res.data.data)
this.footer = res.data.data.footer
})
}, },
data() { data() {
return { return {
version: process.env.VERSION, version: process.env.VERSION
footer: ''
} }
}, },
components: { components: {
NavBar NavBar
}, },
methods: {} methods: {
...mapActions(['getWebsiteConfig'])
},
computed: {
...mapState(['website'])
}
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div id="header"> <div id="header">
<Menu theme="light" mode="horizontal" @on-select="handleRoute" :active-name="activeMenu" class="oj-menu"> <Menu theme="light" mode="horizontal" @on-select="handleRoute" :active-name="activeMenu" class="oj-menu">
<div class="logo"><span>{{websiteConf.name}}</span></div> <div class="logo"><span>{{website.name}}</span></div>
<Menu-item name="/test"> <Menu-item name="/test">
<Icon type="home"></Icon> <Icon type="home"></Icon>
Home Home
@ -34,14 +34,14 @@
<Icon type="information-circled"></Icon> <Icon type="information-circled"></Icon>
About About
</Menu-item> </Menu-item>
<template v-if="!isAuthed"> <template v-if="!isAuthenticated">
<div class="btn-menu"> <div class="btn-menu">
<Button type="ghost" <Button type="ghost"
ref="loginBtn" ref="loginBtn"
shape="circle" shape="circle"
@click="handleBtnClick('login')">Login @click="handleBtnClick('login')">Login
</Button> </Button>
<Button v-if="websiteConf.allow_register" <Button v-if="website.allow_register"
type="ghost" type="ghost"
shape="circle" shape="circle"
@click="handleBtnClick('register')" @click="handleBtnClick('register')"
@ -63,16 +63,13 @@
</Dropdown> </Dropdown>
</template> </template>
</Menu> </Menu>
<LoginOrRegister :visible.sync="modalVisible" :mode.sync="modalMode"></LoginOrRegister> <LoginOrRegister></LoginOrRegister>
</div> </div>
</template> </template>
<script> <script>
import api from '@/api' import {mapGetters, mapActions} from 'vuex'
import auth from '../utils/auth'
import utils from '@/utils/utils'
import LoginOrRegister from '@/views/user/LoginOrRegister' import LoginOrRegister from '@/views/user/LoginOrRegister'
export default { export default {
@ -82,66 +79,32 @@
data() { data() {
return { return {
modalMode: 'login', modalMode: 'login',
modalVisible: false, modalVisible: false
isAuthed: false,
username: '',
websiteConf: {}
} }
}, },
mounted() { mounted() {
this.$bus.$on('login', () => { this.getProfile()
this.$refs['loginBtn'].handleClick()
})
this.$bus.$on('login-success', (res) => {
this.username = res.user.username
this.isAuthed = true
})
this.$bus.$on('logout', () => {
this.isAuthed = false
this.username = ''
})
this.getUserInfo()
this.websiteConf = utils.getWebsiteConf()
}, },
methods: { methods: {
getUserInfo() { ...mapActions(['getProfile', 'changeModalStatus']),
api.getUserInfo().then((res) => {
let data = res.data.data
if (data.hasOwnProperty('user')) {
this.username = data.user.username
this.isAuthed = true
auth.setUser(data)
} else {
this.isAuthed = false
this.username = ''
auth.clear()
}
}, (res) => {
})
},
handleRoute(route) { handleRoute(route) {
if (route) { if (route) {
this.$router.push(route) this.$router.push(route)
} }
}, },
handleBtnClick(mode) { handleBtnClick(mode) {
this.modalVisible = true this.changeModalStatus({
this.modalMode = mode visible: true,
mode: mode
})
} }
}, },
computed: { computed: {
...mapGetters(['website', 'username', 'isAuthenticated']),
// //
activeMenu() { activeMenu() {
return '/' + this.$route.path.split('/')[1] return '/' + this.$route.path.split('/')[1]
} }
},
watch: {
'$route'() {
if (!auth.isAuthicated()) {
this.username = ''
this.isAuthed = false
}
}
} }
} }
</script> </script>

View File

@ -1,6 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import router from './router/index' import router from './router'
import store from './store'
import iView from 'iview' import iView from 'iview'
import locale from 'iview/src/locale/lang/en-US' import locale from 'iview/src/locale/lang/en-US'
import VueHighlightJS from 'vue-highlightjs' import VueHighlightJS from 'vue-highlightjs'
@ -56,5 +57,6 @@ Vue.prototype.$Message.config({
Vue.prototype.$error = Vue.prototype.$Message.error Vue.prototype.$error = Vue.prototype.$Message.error
Vue.prototype.$info = Vue.prototype.$Message.info Vue.prototype.$info = Vue.prototype.$Message.info
Vue.prototype.$success = Vue.prototype.$Message.success Vue.prototype.$success = Vue.prototype.$Message.success
new Vue(Vue.util.extend({router}, App)).$mount('#app')
new Vue(Vue.util.extend({router, store}, App)).$mount('#app')

15
oj/src/store/actions.js Normal file
View File

@ -0,0 +1,15 @@
import api from '@/api'
import types from './types'
export default {
getWebsiteConfig({commit}) {
api.getWebsiteConf().then(res => {
commit(types.UPDATE_WEBSITE_CONF, {
websiteConfig: res.data.data
})
})
},
changeModalStatus({commit}, payload) {
commit(types.CHANGE_MODAL_STATUS, payload)
}
}

8
oj/src/store/getters.js Normal file
View File

@ -0,0 +1,8 @@
export default {
'website'(state) {
return state.website
},
'modalStatus'(state) {
return state.modalStatus
}
}

29
oj/src/store/index.js Normal file
View File

@ -0,0 +1,29 @@
import Vue from 'vue'
import Vuex from 'vuex'
import actions from './actions'
import getters from './getters'
import mutations from './mutations'
import user from './modules/user'
Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'
export default new Vuex.Store({
modules: {
user
},
state: {
website: {},
modalStatus: {
mode: 'login', // or register,
visible: false
}
},
getters,
mutations,
actions,
strict: debug
})
export {types} from './types'

View File

@ -0,0 +1,45 @@
import types from '../types'
import api from '@/api'
const state = {
profile: {}
}
const getters = {
user: state => state.profile.user || null,
username: (state, getters) => {
return getters.user && getters.user.username
},
isAuthenticated: (state, getters) => {
return !!getters.user
}
}
const mutations = {
[types.CHANGE_PROFILE](state, {profile}) {
state.profile = profile
}
}
const actions = {
getProfile({commit}) {
api.getUserInfo().then(res => {
commit(types.CHANGE_PROFILE, {
profile: res.data.data
})
})
},
clearProfile({commit}) {
commit(types.CHANGE_PROFILE, {
profile: {}
})
}
}
export default {
state,
getters,
actions,
mutations
}

15
oj/src/store/mutations.js Normal file
View File

@ -0,0 +1,15 @@
import types from './types'
export default {
[types.UPDATE_WEBSITE_CONF](state, payload) {
state.website = payload.websiteConfig
},
[types.CHANGE_MODAL_STATUS](state, {mode, visible}) {
if (mode !== undefined) {
state.modalStatus.mode = mode
}
if (visible !== undefined) {
state.modalStatus.visible = visible
}
}
}

16
oj/src/store/types.js Normal file
View File

@ -0,0 +1,16 @@
function keyMirror(obj) {
if (obj instanceof Object) {
var _obj = Object.assign({}, obj)
var _keyArray = Object.keys(obj)
_keyArray.forEach(key => {
_obj[key] = key
})
return _obj
}
}
export default keyMirror({
'CHANGE_PROFILE': null,
'CHANGE_MODAL_STATUS': null,
'UPDATE_WEBSITE_CONF': null
})

View File

@ -42,21 +42,11 @@ function filterEmptyValue(object) {
}) })
return query return query
} }
function setWebsiteConf(data) {
storage.set(STORAGE_KEY.websiteConf, data)
}
function getWebsiteConf() {
return storage.get(STORAGE_KEY.websiteConf)
}
export default { export default {
submissionMemoryFormat: submissionMemoryFormat, submissionMemoryFormat: submissionMemoryFormat,
submissionTimeFormat: submissionTimeFormat, submissionTimeFormat: submissionTimeFormat,
getACRate: getACRate, getACRate: getACRate,
loadContest: loadContest, loadContest: loadContest,
filterEmptyValue: filterEmptyValue, filterEmptyValue: filterEmptyValue
setWebsiteConf: setWebsiteConf,
getWebsiteConf: getWebsiteConf
} }

View File

@ -170,7 +170,7 @@
if (contest.contest_type !== 'Public') { if (contest.contest_type !== 'Public') {
if (!auth.isAuthicated()) { if (!auth.isAuthicated()) {
this.$error('Please login first.') this.$error('Please login first.')
this.$bus.$emit('login') this.$store.dispatch('changeModalStatus', {visible: true})
} else if (contest.created_by.id === auth.getUid()) { } else if (contest.created_by.id === auth.getUid()) {
// contest.created_by is user self. // contest.created_by is user self.
this.$router.push(route) this.$router.push(route)

View File

@ -1,9 +1,9 @@
<template> <template>
<Modal :value="visible" @on-cancel="handleUpdateProp('update:visible', false)" :width="400" className="modal"> <Modal v-model="visible" :width="400" className="modal">
<div slot="header"> <div slot="header">
<span class="title">Welcome to OJ</span> <span class="title">Welcome to OJ</span>
</div> </div>
<template v-if="mode === 'login'"> <template v-if="modalStatus.mode === 'login'">
<Form ref="formLogin" :model="formLogin" :rules="ruleLogin"> <Form ref="formLogin" :model="formLogin" :rules="ruleLogin">
<FormItem prop="username"> <FormItem prop="username">
<Input type="text" v-model="formLogin.username" placeholder="Username" size="large"> <Input type="text" v-model="formLogin.username" placeholder="Username" size="large">
@ -23,7 +23,7 @@
</Form> </Form>
</template> </template>
<template v-else> <template v-else>
<Form v-if="mode === 'register'" ref="formRegister" :model="formRegister" :rules="ruleRegister"> <Form v-if="modalStatus.mode === 'register'" ref="formRegister" :model="formRegister" :rules="ruleRegister">
<FormItem prop="username"> <FormItem prop="username">
<Input type="text" v-model="formRegister.username" placeholder="Username" size="large"> <Input type="text" v-model="formRegister.username" placeholder="Username" size="large">
<Icon type="ios-person-outline" slot="prepend"></Icon> <Icon type="ios-person-outline" slot="prepend"></Icon>
@ -61,7 +61,7 @@
</Form> </Form>
</template> </template>
<div slot="footer" class="footer"> <div slot="footer" class="footer">
<template v-if="mode === 'login'"> <template v-if="modalStatus.mode === 'login'">
<Button <Button
type="primary" type="primary"
@click="handleLogin()" @click="handleLogin()"
@ -69,7 +69,7 @@
:loading="btnLoginLoading"> :loading="btnLoginLoading">
Login Login
</Button> </Button>
<a v-if="websiteConf.allow_register" @click.stop="handleUpdateProp('update:mode', 'register')">No account? Register now!</a> <a v-if="website.allow_register" @click.stop="handleBtnClick('register')">No account? Register now!</a>
<a @click.stop="goResetPassword" style="float: right">Forget Password</a> <a @click.stop="goResetPassword" style="float: right">Forget Password</a>
</template> </template>
<template v-else> <template v-else>
@ -82,7 +82,7 @@
</Button> </Button>
<Button <Button
type="ghost" type="ghost"
@click="handleUpdateProp('update:mode', 'login')" @click="handleBtnClick('login')"
class="btn" long> class="btn" long>
Already registed? Login now! Already registed? Login now!
</Button> </Button>
@ -92,28 +92,13 @@
</template> </template>
<script> <script>
import {mapGetters, mapActions} from 'vuex'
import api from '@/api' import api from '@/api'
import auth from '@/utils/auth'
import utils from '@/utils/utils'
import {FormMixin} from '~/mixins' import {FormMixin} from '~/mixins'
export default { export default {
mixins: [FormMixin], mixins: [FormMixin],
props: {
visible: {
required: true,
type: Boolean,
default: true
},
mode: {
required: true,
type: String,
// login or register
default: 'login'
}
},
mounted() { mounted() {
this.websiteConf = utils.getWebsiteConf()
}, },
data() { data() {
const CheckUsernameNotExist = (rule, value, callback) => { const CheckUsernameNotExist = (rule, value, callback) => {
@ -161,7 +146,6 @@
tfaRequired: false, tfaRequired: false,
btnRegisterLoading: false, btnRegisterLoading: false,
btnLoginLoading: false, btnLoginLoading: false,
websiteConf: {},
formRegister: { formRegister: {
username: '', username: '',
password: '', password: '',
@ -206,8 +190,12 @@
} }
}, },
methods: { methods: {
handleUpdateProp(eventName, value) { ...mapActions(['changeModalStatus', 'getProfile']),
this.$emit(eventName, value) handleBtnClick(mode) {
this.changeModalStatus({
mode,
visible: true
})
}, },
handleRegister() { handleRegister() {
this.validateForm('formRegister').then(valid => { this.validateForm('formRegister').then(valid => {
@ -234,37 +222,27 @@
} }
api.login(formData).then(res => { api.login(formData).then(res => {
this.btnLoginLoading = false this.btnLoginLoading = false
api.getUserInfo().then(res => { this.changeModalStatus({visible: false})
auth.setUser(res.data.data) this.getProfile()
this.$bus.$emit('login-success', res.data.data) this.$success('Welcome back to OJ')
this.$success('Welcome back to OJ')
this.handleUpdateProp('update:visible', false)
})
}, _ => { }, _ => {
this.btnLoginLoading = false this.btnLoginLoading = false
}) })
}) })
}, },
goResetPassword() { goResetPassword() {
this.handleUpdateProp('update:visible', false) this.changeModalStatus({visible: false})
this.$router.push({name: 'apply-reset-password'}) this.$router.push({name: 'apply-reset-password'})
} }
}, },
watch: { computed: {
'mode'(newVal) { ...mapGetters(['website', 'modalStatus']),
if (newVal === 'login') { visible: {
this.$nextTick(() => { get() {
this.$refs['formLogin'].resetFields() return this.modalStatus.visible
}) },
} else { set(value) {
this.$nextTick(() => { this.changeModalStatus({visible: value})
this.$refs['formRegister'].resetFields()
})
}
},
'visible'(newVal) {
if (newVal === true && this.mode === 'register') {
this.getCaptchaSrc()
} }
} }
} }

View File

@ -3,14 +3,12 @@
<script> <script>
import api from '../../api.js' import api from '../../api.js'
import auth from '@/utils/auth'
export default { export default {
mounted() { mounted() {
api.logout().then(res => { api.logout().then(res => {
this.$success('logout succeeded') this.$success('logout succeeded')
auth.clear() this.$store.dispatch('clearProfile')
this.$bus.$emit('logout')
this.$router.replace({ this.$router.replace({
path: '/' path: '/'
}) })