Commit 3825f097 authored by 姚广胤's avatar 姚广胤

更新构建

parent dc959f54
{
"env": {
"node": true,
"browser": true,
"es6": true,
"mocha": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true,
"arrowFunctions": true,
"binaryLiterals": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"octalLiterals": true,
"regexUFlag": true,
"regexYFlag": true,
"restParams": true,
"spread": true,
"superInFunctions": true,
"templateStrings": true,
"unicodeCodePointEscapes": true,
"globalReturn": true,
"experimentalObjectRestSpread": true
}
},
"rules": {
"comma-dangle": [2, "never"],
"no-cond-assign": 0,
"no-console": 0,
"no-constant-condition": 0,
"no-control-regex": 0,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 1,
"no-empty": 0,
"no-ex-assign": 1,
"no-extra-boolean-cast": 0,
"no-extra-parens": [1, functions],
"no-extra-semi": 1,
"no-func-assign": 2,
"no-inner-declarations": 0,
"no-invalid-regexp": 1,
"no-irregular-whitespace": 2,
"no-negated-in-lhs": 2,
"no-obj-calls": 2,
"no-regex-spaces": 1,
"no-reserved-keys": 0,
"no-sparse-arrays": 2,
"no-unexpected-multiline": 0,
"no-unreachable": 2,
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
"accessor-pairs": [1, {setWithoutGet: true}],
"block-scoped-var": 0,
"complexity": 0,
"consistent-return": 0,
"curly": [2, multi-line],
"default-case": 0,
"dot-notation": 0,
"dot-location": 0,
"eqeqeq": [0, allow-null],
"guard-for-in": 0,
"no-alert": 0,
"no-caller": 2,
"no-div-regex": 0,
"no-else-return": 0,
"no-eq-null": 0,
"no-eval": 2,
"no-extend-native": 1,
"no-extra-bind": 1,
"no-fallthrough": 1,
"no-floating-decimal": 2,
"no-implicit-coercion": 0,
"no-implied-eval": 2,
"no-invalid-this": 0,
"no-iterator": 0,
"no-labels": [2, { "allowLoop": true, "allowSwitch": true }],
"no-lone-blocks": 1,
"no-loop-func": 0,
"no-magic-numbers": 0,
"no-multi-spaces": 0,
"no-multi-str": 0,
"no-native-reassign": [2, {exceptions: [Map, Set, console]}],
"no-new-func": 2,
"no-new-wrappers": 1,
"no-new": 0,
"no-octal-escape": 1,
"no-octal": 1,
"no-param-reassign": 0,
"no-process-env": 0,
"no-proto": 2,
"no-redeclare": 0,
"no-return-assign": 0,
"no-script-url": 0,
"no-self-compare": 1,
"no-sequences": 1,
"no-throw-literal": 0,
"no-unused-expressions": 0,
"no-useless-call": 1,
"no-useless-concat": 1,
"no-void": 0,
"no-warning-comments": 0,
"no-with": 2,
"radix": 2,
"vars-on-top": 0,
"wrap-iife": 0,
"yoda": 0,
"strict": 0,
"init-declarations": 0,
"no-catch-shadow": 0,
"no-delete-var": 2,
"no-label-var": 1,
"no-shadow-restricted-names": 2,
"no-shadow": 0,
"no-undef-init": 0,
"no-undef": "off",
"no-undefined": 0,
"no-unused-vars": [1, {args: none}],
"no-use-before-define": 0,
"callback-return": 0,
"global-require": 0,
"handle-callback-err": 0,
"no-mixed-requires": 0,
"no-new-require": 0,
"no-path-concat": 0,
"no-process-exit": 0,
"no-restricted-modules": 0,
"no-sync": 0,
"array-bracket-spacing": 2,
"block-spacing": 0,
"brace-style": [1, 1tbs, {allowSingleLine: true}],
"camelcase": [1, {"properties": "never"}],
"comma-spacing": [1, {before: false, after: true}],
"comma-style": [1, last],
"computed-property-spacing": [1, never],
"consistent-this": [1, _this],
"eol-last": 0,
"func-names": 0,
"func-style": [0, declaration],
"id-length": 0,
"id-match": 0,
"indent": [1, 2, {"SwitchCase": 1}],
"jsx-quotes": 0,
"key-spacing": [2, {beforeColon: false, afterColon: true}],
"linebreak-style": [0, unix],
"lines-around-comment": 0,
"max-nested-callbacks": 0,
"new-cap": 1,
"new-parens": 2,
"newline-after-var": 0,
"no-array-constructor": 2,
"no-continue": 0,
"no-inline-comments": 1,
"no-lonely-if": 0,
"no-mixed-spaces-and-tabs": 2,
"no-multiple-empty-lines": [2, {max: 2}],
"no-negated-condition": 0,
"no-nested-ternary": 0,
"no-new-object": 2,
"no-restricted-syntax": 0,
"no-spaced-func": 2,
"no-ternary": 0,
"no-trailing-spaces": [1, { "skipBlankLines": true }],
"no-underscore-dangle": 0,
"no-unneeded-ternary": 1,
"object-curly-spacing": 0,
"one-var": [0, never],
"operator-assignment": [1, always],
"operator-linebreak": 0,
"padded-blocks": 0,
"quote-props": [0, as-needed],
"quotes": [2, single, avoid-escape],
"require-jsdoc": 0,
"semi-spacing": [1, {before: false, after: true}],
"semi": 0,
"sort-vars": 0,
"space-before-blocks": [2, always],
"space-before-function-paren": [1, {anonymous: never, named: never}],
"keyword-spacing": [2, {"before": true, "after": true}],
"space-in-parens": [2, never],
"space-infix-ops": [2, {"int32Hint": false}],
"space-unary-ops": [1, {words: true, nonwords: false}],
"spaced-comment": [1, always],
"wrap-regex": 0,
"arrow-spacing": [1, {before: true, after: true}],
"no-const-assign": 2,
"no-this-before-super": 2
},
"globals": {
"$": true,
"jQuery": true
}
}
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn"
}
}
\ No newline at end of file
{
"compilerOptions": {
"lib": ["es6"]
}
}
\ No newline at end of file
{
"name": "warden",
"description": "an automate performance watcher",
"version": "1.0.0",
"author": "jsholic <junhe0723@gmail.com>",
"contributors": [
{
"email": "ygy@duiba.com.cn",
"name": "ygy"
}
],
"scripts": {
"dev": "cd server && npm run dev && cd ../web && npm run dev",
"install": "cd web && yarn install && cd ../server && yarn install",
"prod": "cd server && npm run prod"
},
"devDependencies": {
"babel-eslint": "^8.2.2",
"eslint": "^4.19.1",
"eslint-config-standard": "^5.1.0",
"eslint-friendly-formatter": "^2.0.5",
"eslint-loader": "^1.3.0",
"eslint-plugin-html": "^1.3.0",
"eslint-plugin-promise": "^1.0.8",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-standard": "^1.3.2"
},
"license": "MIT"
}
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
* @Author: ygy * @Author: ygy
* @Date: 2018-03-14 19:40:01 * @Date: 2018-03-14 19:40:01
* @Last Modified by: ygy * @Last Modified by: ygy
* @Last Modified time: 2018-03-26 09:43:45 * @Last Modified time: 2018-03-26 14:36:17
*/ */
const Koa = require('koa'); const Koa = require('koa');
const send = require('koa-send'); const send = require('koa-send');
const bodyParser = require('koa-bodyparser'); const bodyParser = require('koa-bodyparser');
const cors = require('koa-cors');
const path = require('path'); const path = require('path');
const router = require('./router'); const router = require('./router');
...@@ -19,8 +18,6 @@ const schedule = require('node-schedule'); ...@@ -19,8 +18,6 @@ const schedule = require('node-schedule');
const app = new Koa(); const app = new Koa();
app.use(cors());
// log request URL: // log request URL:
app.use(async (ctx, next) => { app.use(async (ctx, next) => {
console.log(`Process ${ctx.request.method} ${ctx.request.url}...`); console.log(`Process ${ctx.request.method} ${ctx.request.url}...`);
...@@ -28,7 +25,7 @@ app.use(async (ctx, next) => { ...@@ -28,7 +25,7 @@ app.use(async (ctx, next) => {
}); });
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
//chek user's login state,except index,login,signin pages // chek user's login state,except index,login,signin pages
app.use(filter.checkLogin); app.use(filter.checkLogin);
} }
...@@ -37,7 +34,8 @@ app.use(bodyParser()); ...@@ -37,7 +34,8 @@ app.use(bodyParser());
// add nunjucks as view: // add nunjucks as view:
app.use(templating('views', { app.use(templating('views', {
noCache: true, //in production ENV,noCache should be changed to false. // in production ENV,noCache should be changed to false.
noCache: true,
watch: true watch: true
})); }));
......
...@@ -3,8 +3,6 @@ const devConfig = './config-dev.js'; ...@@ -3,8 +3,6 @@ const devConfig = './config-dev.js';
var config = null; var config = null;
console.log('===process.env.NODE_ENV***', process.env.NODE_ENV);
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
console.log(`Load DBconfig ${prodConfig}...`); console.log(`Load DBconfig ${prodConfig}...`);
config = require(prodConfig); config = require(prodConfig);
......
...@@ -5,7 +5,7 @@ let History = model.History; ...@@ -5,7 +5,7 @@ let History = model.History;
// History.sync(); // History.sync();
module.exports = { module.exports = {
createOne: async(fileObj = {}) => { createOne: async (fileObj = {}) => {
const { const {
result, result,
type, type,
......
{ {
"restartable": "rs", "restartable": "rs",
"ignore": [ "ignore": [".git", "upload_store/", "node_modules/**/node_modules"],
".git",
"upload_store/",
"node_modules/**/node_modules"
],
"verbose": true, "verbose": true,
"execMap": { "execMap": {
"js": "node --harmony" "js": "node --harmony"
......
...@@ -4,10 +4,8 @@ ...@@ -4,10 +4,8 @@
"version": "1.0.0", "version": "1.0.0",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"dev": "export NODE_ENV=development&& nodemon --harmony app.js", "dev": "cross-env NODE_ENV=development&& nodemon --harmony app.js",
"devwin": "set NODE_ENV=development&& nodemon --harmony app.js", "prod": "cross-env NODE_ENV=production&& pm2 start pm2.json --env production"
"prod": "pm2 start pm2.json --env production",
"prodwin": "set NODE_ENV=production&& nodemon --harmony app.js"
}, },
"keywords": [ "keywords": [
"koa", "koa",
...@@ -28,9 +26,9 @@ ...@@ -28,9 +26,9 @@
"dependencies": { "dependencies": {
"koa": "^2.3.0", "koa": "^2.3.0",
"koa-bodyparser": "^3.2.0", "koa-bodyparser": "^3.2.0",
"koa-cors": "0.0.16",
"koa-router": "^7.2.1", "koa-router": "^7.2.1",
"koa-send": "^4.1.0", "koa-send": "^4.1.0",
"koa-static": "^4.0.2",
"mime": "^1.3.6", "mime": "^1.3.6",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"mysql": "^2.14.1", "mysql": "^2.14.1",
...@@ -42,6 +40,7 @@ ...@@ -42,6 +40,7 @@
"sequelize": "^3.24.1" "sequelize": "^3.24.1"
}, },
"devDependencies": { "devDependencies": {
"cross-env": "^5.1.4",
"nodemon": "^1.11.0" "nodemon": "^1.11.0"
} }
} }
{ {
"apps" : [{ "apps": [
"name" : "warden", {
"script" : "./app.js", "name": "warden",
"watch" : false, "script": "./app.js",
"node_args": ["--harmony"], "watch": false,
"env": { "node_args": ["--harmony"],
"NODE_ENV": "default" "env": {
}, "NODE_ENV": "default"
"env_production" : { },
"NODE_ENV": "production" "env_production": {
"NODE_ENV": "production"
}
} }
}] ]
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<body style="background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302);"> <body style="background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302);">
<div id="app"></div> <div id="app"></div>
<script src="http://localhost:5001/dist/public.js"></script> <script src="/dist/public.js"></script>
</body> </body>
</html> </html>
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
<title>守望</title> <title>守望</title>
<link rel="shortcut icon" type="image/x-icon" href="//yun.tuiapple.com/tuia/cdn/heaven.ico"> <link rel="shortcut icon" type="image/x-icon" href="//yun.tuiapple.com/tuia/cdn/heaven.ico">
<link rel="stylesheet" href="//yun.tuiapple.com/tuia/tuia-advertiser/bower_components/bootstrap/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="//yun.tuiapple.com/tuia/tuia-advertiser/bower_components/bootstrap/dist/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/3.8.5/echarts-en.common.min.js"></script> <script src="//yun.duiba.com.cn/tuia/warden/echarts.common.min.js"></script>
</head> </head>
<body style="background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(//yun.duiba.com.cn/tuia/cdn/background-logo.jpg);"> <body style="background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(//yun.duiba.com.cn/tuia/cdn/background-logo.jpg);">
<div id="app"></div> <div id="app"></div>
<script src="http://localhost:5001/dist/private.js"></script> <script src="/dist/private.js"></script>
</body> </body>
</html> </html>
...@@ -442,7 +442,14 @@ cron-parser@^2.4.0: ...@@ -442,7 +442,14 @@ cron-parser@^2.4.0:
is-nan "^1.2.1" is-nan "^1.2.1"
moment-timezone "^0.5.0" moment-timezone "^0.5.0"
cross-spawn@^5.0.1: cross-env@^5.1.4:
version "5.1.4"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.1.4.tgz#f61c14291f7cc653bb86457002ea80a04699d022"
dependencies:
cross-spawn "^5.1.0"
is-windows "^1.0.0"
cross-spawn@^5.0.1, cross-spawn@^5.1.0:
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
dependencies: dependencies:
...@@ -1202,7 +1209,7 @@ is-typedarray@~1.0.0: ...@@ -1202,7 +1209,7 @@ is-typedarray@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
is-windows@^1.0.2: is-windows@^1.0.0, is-windows@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
...@@ -1310,10 +1317,6 @@ koa-convert@^1.2.0: ...@@ -1310,10 +1317,6 @@ koa-convert@^1.2.0:
co "^4.6.0" co "^4.6.0"
koa-compose "^3.0.0" koa-compose "^3.0.0"
koa-cors@0.0.16:
version "0.0.16"
resolved "https://registry.yarnpkg.com/koa-cors/-/koa-cors-0.0.16.tgz#98107993a7909e34c042986c5ec6156d77f3432e"
koa-is-json@^1.0.0: koa-is-json@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/koa-is-json/-/koa-is-json-1.0.0.tgz#273c07edcdcb8df6a2c1ab7d59ee76491451ec14" resolved "https://registry.yarnpkg.com/koa-is-json/-/koa-is-json-1.0.0.tgz#273c07edcdcb8df6a2c1ab7d59ee76491451ec14"
...@@ -1338,6 +1341,13 @@ koa-send@^4.1.0: ...@@ -1338,6 +1341,13 @@ koa-send@^4.1.0:
mz "^2.6.0" mz "^2.6.0"
resolve-path "^1.4.0" resolve-path "^1.4.0"
koa-static@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/koa-static/-/koa-static-4.0.2.tgz#6cda92d88d771dcaad9f0d825cd94a631c861a1a"
dependencies:
debug "^2.6.8"
koa-send "^4.1.0"
koa@^2.3.0: koa@^2.3.0:
version "2.5.0" version "2.5.0"
resolved "https://registry.yarnpkg.com/koa/-/koa-2.5.0.tgz#b0fbe1e195e43b27588a04fd0be0ddaeca2c154c" resolved "https://registry.yarnpkg.com/koa/-/koa-2.5.0.tgz#b0fbe1e195e43b27588a04fd0be0ddaeca2c154c"
......
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# web
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
```
For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
rm -rf ../server/static/*
cp -r ./dist ../server/static/dist/
var path = require('path'); var path = require('path');
var glob = require('glob'); var glob = require('glob');
const isProd = process.env.NODE_ENV === 'production';
// ----- 动态查找所有入口entry文件 ----- // // ----- 动态查找所有入口entry文件 ----- //
var files = glob.sync('./src/containers/*/main.js'); var files = glob.sync('./src/containers/*/main.js');
var entryList = {}; var entryList = {};
// 匹配入口文件 // 匹配入口文件
files.forEach(function (f) { files.forEach(function(f) {
var mainName = /.*\/(containers\/.*?\/main)\.js/.exec(f)[1]; // 得到containers/mobile/main.js这样的文件名 var mainName = /.*\/(containers\/.*?\/main)\.js/.exec(f)[1];
var mainPath = mainName.split('main')[0]; // 得到containers/mobile/这样的文件名 var mainPath = mainName.split('main')[0];
var fileName = mainPath.split('/')[1]; var fileName = mainPath.split('/')[1];
// 记录入口文件 // 记录入口文件
entryList[fileName] = f; entryList[fileName] = f;
}); });
Object.keys(entryList).forEach(function (k) { Object.keys(entryList).forEach(function(k) {
var arr = []; var arr = [];
arr.push(entryList[k]); arr.push(entryList[k]);
entryList[k] = arr; entryList[k] = arr;
...@@ -25,18 +24,23 @@ module.exports = { ...@@ -25,18 +24,23 @@ module.exports = {
entry: entryList, entry: entryList,
output: { output: {
path: path.resolve(__dirname, '../dist'), path: path.resolve(__dirname, '../dist'),
publicPath: process.env.NODE_ENV === 'production' ? 'http://yun.dui88.com/tuia/cdn/' : '/dist/' , publicPath:
process.env.NODE_ENV === 'production'
? 'http://yun.dui88.com/tuia/cdn/'
: '/dist/',
filename: '[name].js' filename: '[name].js'
}, },
resolve: { resolve: {
extensions: ['.js', '.vue'], extensions: ['.js', '.vue'],
alias: { alias: {
'comcomp': path.resolve(__dirname, '../src/components'), comcomp: path.resolve(__dirname, '../src/components'),
'comstyle': path.resolve(__dirname, '../src/styles') comstyle: path.resolve(__dirname, '../src/styles'),
utils: path.resolve(__dirname, '../src/utils')
} }
}, },
module: { module: {
rules: [{ rules: [
{
test: /\.vue$/, test: /\.vue$/,
loader: 'vue-loader', loader: 'vue-loader',
options: { options: {
...@@ -70,18 +74,4 @@ module.exports = { ...@@ -70,18 +74,4 @@ module.exports = {
} }
] ]
} }
} };
function getIPAdress() {
var interfaces = require('os').networkInterfaces();
for (var devName in interfaces) {
var iface = interfaces[devName];
for (var i = 0; i < iface.length; i++) {
var alias = iface[i];
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
return alias.address;
}
}
}
}
const webpackBaseConfig = require('./webpack.base'); const webpackBaseConfig = require('./webpack.base');
const webpack = require('webpack') const webpack = require('webpack')
Object.keys(webpackBaseConfig.entry).forEach(function (name) { Object.keys(webpackBaseConfig.entry).forEach((name) => {
webpackBaseConfig.entry[name] = webpackBaseConfig.entry[name].concat('webpack-hot-middleware/client?reload=true') webpackBaseConfig.entry[name] = webpackBaseConfig.entry[name].concat('webpack-hot-middleware/client?reload=true')
}) })
......
var webpack = require('webpack'); var webpack = require('webpack');
var base = require('./webpack.base'); var base = require('./webpack.base');
module.exports = Object.assign(base, { module.exports = Object.assign(base, {
performance: { performance: {
hints: false hints: false
}, },
devtool: '#source-map', devtool: '#source-map',
// http://vue-loader.vuejs.org/en/workflow/production.html // http://vue-loader.vuejs.org/en/workflow/production.html
plugins : [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
NODE_ENV: '"production"' NODE_ENV: '"production"'
......
{
"code": 0,
"msg": "success",
"dirs": [
"DS-online/",
"activity/",
"admin/",
"aerosol/",
"aerosolXml/",
"apk/",
"apks/",
"app/",
"asdfasdf/",
"baidu/",
"couponcode_daily/",
"couponcode_dev/",
"coupons/",
"db-m/",
"db_games/",
"developer/",
"developer_new/",
"ds/",
"duibaFloorCofig/",
"duibaManagerWeb/",
"egret/",
"floorCode/",
"floorSkin/",
"game/",
"h5-tuia/",
"h5/",
"http:/",
"hwqtest/",
"images/",
"layui/",
"lib/",
"maila/",
"mainMeet/",
"mainmeet/",
"mobile/",
"node_test/",
"node_test_img/",
"pcduiba/",
"pptv/",
"resource/",
"simple-dev/",
"static/",
"test/",
"tuia-media/",
"tuia/",
"upload/",
"webapp/"
],
"files": [
"1.png",
"125_599_Tue Aug 16 18:25:46 CST 2016.txt",
"2.png",
"2016-152-5-jxwy.mp4",
"3.png",
"370-230.jpg",
"462_568_Tue Aug 16 18:38:20 CST 2016.txt",
"640-280-yuan.jpg",
"addObject.js",
"address-v12.24.css",
"bundle.js",
"christmasinfo.min.js",
"coolgirl.jpg",
"coupon-code-template.txt",
"dailyduiba-oss-logdaily-duiba2016-09-22-11-00-00-0001",
"dui88",
"duiba-oss-logduiba2016-09-22-11-00-00-0001",
"face.jpg",
"fd1e859a.library_class.min.js",
"file.js",
"gift.png",
"hwq-test.html",
"hwq-test.js",
"import_log",
"kuyin.css",
"lantern.css",
"node_test1.png",
"pptvIframeHack.min.js",
"rem-responsive.js",
"shot.png",
"shot1.png",
"statistics.js",
"test.js",
"user.js",
"webp4.jpg"
]
}
{
"success": "true",
"code": 0
}
{
"code": 0,
"prefix": "//yun.duiba.com.cn"
}
{
"success": "true",
"code": "0",
"path": "h5-tuia/YJk3a1474684409537.png"
}
{
"success": "true",
"code": 0
}
{
"code": 0,
"desc": "查询成功!",
"totalCount": 26,
"data": [
{
"id": "2f2bb8ae-f4a1-4542-bb9c-e2dc0c101b61",
"name": "1.jpeg",
"path": "tuia/test/1.jpeg",
"type": "image/jpeg",
"size": 4831,
"owner": "管理员",
"sync": false,
"createdAt": 1514964614241,
"updatedAt": 1514964614241,
"version": 0
},
{
"id": "9f824ea1-fc43-49f4-ae92-f3c73c0fb080",
"name": "a336845a2e965ca587a0.codemirror.js",
"path": "tuia/tuia-admin/dist/a336845a2e965ca587a0.codemirror.js",
"type": "text/javascript",
"size": 225070,
"owner": "周成",
"sync": true,
"createdAt": 1513583609452,
"updatedAt": 1513583609452,
"version": 0
},
{
"id": "4c8bf8ff-4cbd-41fd-b85f-d5c77a6c8134",
"name": "dd04863ca08f21d3972f.iScroll.js",
"path": "tuia/tuia-admin/dist/dd04863ca08f21d3972f.iScroll.js",
"type": "text/javascript",
"size": 32949,
"owner": "周成",
"sync": true,
"createdAt": 1513583609065,
"updatedAt": 1513583609065,
"version": 0
},
{
"id": "d606abca-b7e1-4bb9-89dd-923bd04fb8e4",
"name": "vendors.js",
"path": "tuia/media-internal/dist/vendors.js",
"type": "text/javascript",
"size": 1599092,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134800634,
"updatedAt": 1513134800634,
"version": 0
},
{
"id": "0a7b1c91-4ffb-48ed-b2f6-1f11f41ed61c",
"name": "Simditor.js",
"path": "tuia/media-internal/dist/Simditor.js",
"type": "text/javascript",
"size": 454689,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134797785,
"updatedAt": 1513134797785,
"version": 0
},
{
"id": "95e1d860-c959-4bb1-8e5a-bc2c1dee110e",
"name": "Spectrum.js",
"path": "tuia/media-internal/dist/Spectrum.js",
"type": "text/javascript",
"size": 28189,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134797138,
"updatedAt": 1513134797138,
"version": 0
},
{
"id": "9b634012-c56d-420f-b586-353e4a46e6da",
"name": "Sortable.js",
"path": "tuia/media-internal/dist/Sortable.js",
"type": "text/javascript",
"size": 12717,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134797096,
"updatedAt": 1513134797096,
"version": 0
},
{
"id": "65e07794-ae28-44c6-9dd3-23cb102a2ef9",
"name": "private.js",
"path": "tuia/media-internal/dist/private.js",
"type": "text/javascript",
"size": 1798600,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134796992,
"updatedAt": 1513134796992,
"version": 0
},
{
"id": "6d00dce1-946a-4d38-bce7-17693392c16b",
"name": "DateRangePicker.js",
"path": "tuia/media-internal/dist/DateRangePicker.js",
"type": "text/javascript",
"size": 122351,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134796920,
"updatedAt": 1513134796920,
"version": 0
},
{
"id": "caf12054-1134-42a8-bac0-a044d75c9813",
"name": "codemirror.js",
"path": "tuia/media-internal/dist/codemirror.js",
"type": "text/javascript",
"size": 213398,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134796766,
"updatedAt": 1513134796766,
"version": 0
},
{
"id": "979fa3d9-b17c-4e01-a7e4-8d4341ca85bd",
"name": "iScroll.js",
"path": "tuia/media-internal/dist/iScroll.js",
"type": "text/javascript",
"size": 33028,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134796731,
"updatedAt": 1513134796731,
"version": 0
},
{
"id": "c14c22d1-81b9-47f2-84ac-267add30e429",
"name": "public.js",
"path": "tuia/media-internal/dist/public.js",
"type": "text/javascript",
"size": 15261,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134796710,
"updatedAt": 1513134796710,
"version": 0
},
{
"id": "a7c630a7-837b-4400-a758-44c0108303d7",
"name": "html2canvas.js",
"path": "tuia/media-internal/dist/html2canvas.js",
"type": "text/javascript",
"size": 63428,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134796531,
"updatedAt": 1513134796531,
"version": 0
},
{
"id": "042db5ac-12c3-4a0c-8add-9d438c2ba71b",
"name": "Jquery.QrCode.js",
"path": "tuia/media-internal/dist/Jquery.QrCode.js",
"type": "text/javascript",
"size": 14025,
"owner": "顾灿灿",
"sync": true,
"createdAt": 1513134796438,
"updatedAt": 1513134796438,
"version": 0
},
{
"id": "b0f68ed6-65b7-442e-801a-8d42cba0c10e",
"name": "detail_dev.css",
"path": "qiho-h5/order/detail_dev.css",
"type": "text/css",
"size": 42614,
"owner": "卢静",
"sync": true,
"createdAt": 1500989998801,
"updatedAt": 1500989998801,
"version": 0
},
{
"id": "2ce1e040-ec4d-4518-a873-6b5a000844fc",
"name": "detail_dev.js",
"path": "qiho-h5/order/detail_dev.js",
"type": "application/javascript",
"size": 27140,
"owner": "卢静",
"sync": true,
"createdAt": 1500989965985,
"updatedAt": 1500989965985,
"version": 0
},
{
"id": "9320dc47-0ab3-4b69-ab84-cd25f47ca224",
"name": "cashier_dev.css",
"path": "qiho-h5/order/cashier_dev.css",
"type": "text/css",
"size": 35531,
"owner": "卢静",
"sync": false,
"createdAt": 1500989952207,
"updatedAt": 1500989952207,
"version": 0
},
{
"id": "f1e84548-89f9-494f-ba23-de03219d53b8",
"name": "success_dev.js",
"path": "qiho-h5/goods/success_dev.js",
"type": "application/javascript",
"size": 47889,
"owner": "卢静",
"sync": true,
"createdAt": 1500946474262,
"updatedAt": 1500946474262,
"version": 0
},
{
"id": "81800d85-90d3-4340-98ee-375b54028744",
"name": "vg_201707241656.css",
"path": "h5-tuia/insurance/shajin/vg_201707241656.css",
"type": "text/css",
"size": 13095,
"owner": "邓沁",
"sync": false,
"createdAt": 1500886594580,
"updatedAt": 1500886594580,
"version": 0
},
{
"id": "654c5f98-a39a-430b-8d9a-b1dab28186c2",
"name": "vg_201707241656.js",
"path": "h5-tuia/insurance/shajin/vg_201707241656.js",
"type": "text/javascript",
"size": 48577,
"owner": "邓沁",
"sync": false,
"createdAt": 1500886593569,
"updatedAt": 1500886593569,
"version": 0
}
]
}
{
"success": "true",
"code": 0
}
{ {
"/todo/list": "/todo/list",
"/todo/delete": "/todo/delete",
"/todo/sync": "/todo/sync",
"/todo/batchDelete": "/todo/delete",
"/todo/batchSync": "/todo/sync",
"/history/list": "/history/list", "/history/list": "/history/list",
"/oss/prefix": "/oss/prefix",
"/oss/list": "/oss/list",
"/oss/newFolder": "/oss/newFolder",
"/oss/upload": "/oss/upload",
"/user/signin": "/user/signin", "/user/signin": "/user/signin",
"/user/signup": "/user/signup", "/user/signup": "/user/signup",
"/user/id": "/user/id", "/user/id": "/user/id",
......
...@@ -10,10 +10,8 @@ ...@@ -10,10 +10,8 @@
} }
], ],
"scripts": { "scripts": {
"start": "cross-env NODE_ENV=development node ./bin/www", "dev": "cross-env NODE_ENV=development node ./bin/www",
"build": "cross-env NODE_ENV=production webpack -p --progress --hide-modules --config build/webpack.prod.config.js", "build": "cross-env NODE_ENV=production webpack -p --progress --hide-modules --config build/webpack.prod.config.js && sh ./build/index.sh"
"taobao": "npm install --registry=https://registry.npm.taobao.org",
"taobaodev": "npm install --only=dev --registry=https://registry.npm.taobao.org"
}, },
"dependencies": { "dependencies": {
"axios": "^0.18.0", "axios": "^0.18.0",
...@@ -32,7 +30,7 @@ ...@@ -32,7 +30,7 @@
"babel-plugin-transform-vue-jsx": "^3.3.0", "babel-plugin-transform-vue-jsx": "^3.3.0",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babel-preset-latest": "^6.0.0", "babel-preset-latest": "^6.0.0",
"cross-env": "^3.0.0", "cross-env": "^5.1.4",
"css-loader": "^0.25.0", "css-loader": "^0.25.0",
"ejs": "^2.5.7", "ejs": "^2.5.7",
"file-loader": "^0.9.0", "file-loader": "^0.9.0",
...@@ -47,5 +45,6 @@ ...@@ -47,5 +45,6 @@
"webpack-dev-server": "^2.9.3", "webpack-dev-server": "^2.9.3",
"webpack-hot-middleware": "^2.20.0", "webpack-hot-middleware": "^2.20.0",
"webpack-merge": "^4.1.0" "webpack-merge": "^4.1.0"
} },
"license": "MIT"
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<title>守望</title> <title>守望</title>
<link rel="shortcut icon" type="image/x-icon" href="//yun.tuiapple.com/tuia/cdn/heaven.ico"> <link rel="shortcut icon" type="image/x-icon" href="//yun.tuiapple.com/tuia/cdn/heaven.ico">
<link rel="stylesheet" href="//yun.tuiapple.com/tuia/tuia-advertiser/bower_components/bootstrap/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="//yun.tuiapple.com/tuia/tuia-advertiser/bower_components/bootstrap/dist/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/3.8.5/echarts-en.common.min.js"></script> <script src="//yun.duiba.com.cn/tuia/warden/echarts.common.min.js"></script>
</head> </head>
<body style="background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(//yun.duiba.com.cn/tuia/cdn/background-logo.jpg);"> <body style="background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(//yun.duiba.com.cn/tuia/cdn/background-logo.jpg);">
......
<template>
<div class="oss-list wrap">
<NavHeader></NavHeader>
<div class="oss-container">
<el-form :model="ruleForm" :inline="true" :rules="rules" ref="ruleForm" class="search-tool">
<el-form-item label="资源路径" prop="path" class="itemtext">
<el-input type="textarea" v-model="ruleForm.path" placeholder="请输入资源路径,一行一个,回车分隔" class="texturl" :autosize="{ minRows: 20}" required></el-input>
</el-form-item>
<el-button type="primary" @click="_submitForm('ruleForm')" icon="search" size="small" class='submit'>提交</el-button>
<div class='tip'>此过程较慢,请耐心等待</div>
</el-form>
</div>
</div>
</template>
<script>
import NavHeader from '../NavHeader.vue';
import { Message, Loading } from 'element-ui';
import DateUtil from 'comcomp/utils/DateUtil.js';
var checkUrl = (rule, value, callback) => {
let regexp = new RegExp(/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?$/);
var arr=value.split("\n")
const valArr = arr.map(item => {return regexp.test(item)});
if (valArr.indexOf(false)!== -1) {
callback(new Error('url格式不正确'));
} else {
callback();
}
};
export default {
data() {
return {
ruleForm: {
path: ''
},
rules: {
path: [
{ validator: checkUrl, message: '格式不正确',required: true,trigger: 'blur' }
]
},
tableData: [],
domainPrefix: null
}
},
mounted() {
},
methods: {
_submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
  console.log(valid);
this.refresh();
} else {
console.log('error submit!!');
return false;
}
});
},
refresh() {
this.fetch(this.ruleForm.path);
},
fetch(path = '') {
const loadingInstance = Loading.service({ fullscreen: true });
this.$http.post('/cdn/flush', { urls: path }, {
emulateJSON: true
}).then((response) => {
const {
success,
code
} = response.data;
if (code === 0) {
this.$message.success('刷新成功');
} else {
console.log(desc);
}
loadingInstance.close();
}, (error) => {
console.log(error)
loadingInstance.close();
});
}
},
components: {
NavHeader
}
}
</script>
<style scoped>
.search-tool {
float: left;
margin-left: 100px;
margin-top: 20px;
width: 900px;
}
.itemtext {
width: 750px;
}
.texturl {
width: 350% !important;
}
.submit {
margin-left: 20px;
}
.tip {
margin-top: 20px;
color:#409EFF;
}
</style>
<template>
<div class="oss-list wrap">
<NavHeader></NavHeader>
<div class="oss-container">
<el-form :model="ruleForm" :inline="true" :rules="rules" ref="ruleForm" class="search-tool">
<el-form-item label="路径" prop="path">
<el-input v-model="ruleForm.path" placeholder="请输入路径" size="small"></el-input>
</el-form-item>
<el-button type="primary" @click="_submitForm('ruleForm')" icon="search" size="small">搜索</el-button>
</el-form>
<el-table :data="tableData" highlight-current-row @current-change="_currentChange" stripe style="width: 100%" height="800">
<el-table-column prop="name" label="文件名" width="150">
</el-table-column>
<el-table-column prop="path" label="路径">
</el-table-column>
<el-table-column prop="path" label="复制" width="65">
<template slot-scope="scope">
<el-tooltip class="item" effect="light" :enterable="false" content="点击复制完整路径" placement="top-start">
<button class="btn" data-clipboard-snippet="" v-bind:data-clipboard-text="domainPrefix + scope.row.path">
<img class="clippy" width="13" src="//yun.duiba.com.cn/tuia/cdn/clippy.svg">
</button>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="type" label="类型" width="125">
</el-table-column>
<el-table-column prop="action" label="操作类型" width="100">
</el-table-column>
<el-table-column prop="owner" label="操作者" width="100">
</el-table-column>
<el-table-column prop="createdAt" label="操作时间" width="200">
</el-table-column>
</el-table>
<el-pagination @size-change="_sizeChange" @current-change="_pageChange" :current-page="currentPage" :page-size="pageSize" :page-sizes="[20, 50, 100, 200]" layout="total, sizes, prev, pager, next, jumper" :total="totalCount">
</el-pagination>
</div>
</div>
</template>
<script>
import NavHeader from '../NavHeader.vue';
import { Message, Loading } from 'element-ui';
import Clipboard from 'clipboard';
import DateUtil from 'comcomp/utils/DateUtil.js';
let clipboard;
export default {
data() {
return {
ruleForm: {
path: ''
},
rules: {
path: [
{ min: 0, max: 99, message: '不超过99', trigger: 'blur' }
]
},
currentPage: 1,
pageSize: 20,
totalCount: 0,
tableData: [],
domainPrefix: null
}
},
mounted() {
this.refresh();
this.getPrefix();
clipboard = new Clipboard('.btn');
clipboard.on('success', (e) => {
this.$message('已复制到剪贴板');
e.clearSelection();
});
clipboard.on('error', (e) => {
this.$message.error('复制失败');
});
},
beforeDestroy() {
clipboard.destroy();
},
methods: {
_currentChange(val) {
this.currentRow = val;
},
_submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
console.log(this.ruleForm.path);
this.currentPage = 1;
this.refresh();
} else {
console.log('error submit!!');
return false;
}
});
},
_pageChange(val) {
this.currentPage = val;
this.refresh();
},
_sizeChange(val) {
this.pageSize = val;
this.refresh();
},
refresh() {
this.fetch(this.currentPage, this.pageSize, this.ruleForm.path);
},
getPrefix() {
this.$http.get('/oss/prefix?env=online', {}, {
emulateJSON: true
}).then((response) => {
this.domainPrefix = response.data.prefix + '/';
}, (error) => {
console.log(error)
});
},
fetch(currentPage, pageSize, path = '') {
const loadingInstance = Loading.service({ fullscreen: true });
this.$http.get('/history/list', { params: { currentPage, pageSize, path } }, {
emulateJSON: true
}).then((response) => {
const {
data,
code,
totalCount,
desc
} = response.data;
if (code === 0) {
data.map((item) => {
const format = 'yyyy/MM/dd hh:mm:ss';
item.createdAt = DateUtil.dateFormat(item.createdAt, format);
return item;
});
} else {
console.log(desc);
}
this.totalCount = totalCount;
this.tableData = data;
loadingInstance.close();
}, (error) => {
console.log(error)
loadingInstance.close();
});
}
},
components: {
NavHeader
}
}
</script>
<style>
.el-pagination {
float: right;
margin-top: 20px;
}
.search-tool {
float: right;
}
</style>
<template lang="html">
<div class="oss-container">
<div class="row oss-path">
<div class="col-sm-12">
<div class="current-path">
当前路径:
</div>
<ul>
<li class="inline">
<a @click="_rootClick()">root</a>
</li>
<li class="inline" v-for="dir in path.split('/').filter((item)=>{ return !!item;})">
<i class="el-icon-arrow-right el-icon--left"></i><a @click="_pathClick(dir)">{{dir ? dir : ''}}&nbsp;</a>
</li>
</ul>
</div>
</div>
<div class="row mar-top-30">
<div class="col-sm-6">
<div class="row current-path">
<span class="col-sm-4">
<NewFolder :prop="pathObj" :cbRefresh="fetch"> </NewFolder>
</span>
</div>
<div class="row">
<span class="col-sm-6">名称</span>
<span class="col-sm-2">大小</span>
<span class="col-sm-4">最后修改</span>
</div>
<ul id="list">
<li class="oss-item row" v-for="dir in dirs">
<a class="col-sm-6 dir-name" @click="_enterDir(dir)"><img class="folder" width="16" src="//yun.dui88.com/tuia/cdn/folder.svg">{{dir.replace('/', '')}}</a>
<span class="col-sm-2">-</span>
<span class="col-sm-4">-</span>
</li>
<li class="oss-item row" v-for="file in files">
<span class="col-sm-6 file-name"><i class="el-icon-document el-icon--left"></i>{{file}}</span>
<span class="col-sm-2">
<el-tooltip class="item" effect="light" :enterable="false" content="点击复制路径" placement="top-start">
<button class="btn copy-urls-btn" v-bind:data-clipboard-text="domainPrefix + path.replace('/', '') + file">
<img class="clippy" width="14" src="//yun.duiba.com.cn/tuia/cdn/clippy.svg">
</button>
</el-tooltip>
</span>
<span class="col-sm-4">-</span>
</li>
</ul>
</div>
<div class="col-sm-6">
<my-upload
class="upload-demo"
ref="upload"
action="/oss/upload"
:drag="true"
:multiple="true"
:data="pathObj"
:on-preview="_preview"
:on-remove="_remove"
:before-upload="_beforeUpload"
:on-success="_uploadSuccess"
:file-list="fileList"
:auto-upload="false">
<el-button slot="trigger" icon="el-icon-view" type="primary" size="small">选取文件</el-button>
<el-button slot="uploadstart" style="margin-left: 10px;" icon="el-icon-upload" type="success" @click="_submitUpload" size="small">上传到服务器</el-button>
<div slot="tip" class="el-upload__tip">不支持文件夹上传</div>
</my-upload>
<br>
<p>已上传文件URL:</p>
<ul>
<li v-for="file in uploadedFiles">
<div><i class="el-icon-document"></i> <span>{{file.name}}</span></div>
<div><span style="color:#1D8CE0;padding:0 10px;">{{domainPrefix + file.response.path}}</span>
<el-tooltip class="item" effect="light" :enterable="false" content="点击复制完整路径" placement="top-start">
<button class="btn copy-urls-btn" v-bind:data-clipboard-text="domainPrefix + file.response.path">
<img class="clippy" width="12" src="//yun.duiba.com.cn/tuia/cdn/clippy.svg">
</button>
</el-tooltip></div>
</li>
</ul>
<!--<button id="copy-uploadUrls" class="el-button el-button--success is-plain el-button--small copy-urls-btn" v-bind:data-clipboard-text="uploadedUrls">
复制最近上传的URL
</button>-->
</div>
</div>
</div>
</template>
<script>
import NewFolder from './NewFolder.vue';
import {
Loading
} from 'element-ui';
import URLUtil from 'comcomp/utils/URLUtil.js';
import Clipboard from 'clipboard';
import MyUpload from 'comcomp/upload/index.vue';
let clipboard;
let hash;
const SLASH = '/';
function findPrefix(dir, path) {
return path.split(dir)[0];
};
export default {
data() {
hash = window.location.hash.split('?')[0];
const paramPath = URLUtil.getParameterByName('path', window.location.hash);
const path = decodeURIComponent(paramPath ? paramPath : SLASH);
console.log(paramPath);
return {
dirs: [],
files: [],
path,
fileList: [],
pathObj: {},
uploadedUrls: [],
uploadedFiles: [],
domainPrefix: null
}
},
mounted() {
this.fetch(this.path);
this.getPrefix();
clipboard = new Clipboard('.copy-urls-btn');
clipboard.on('success', (e) => {
this.$message('已复制到剪贴板');
this.$refs.upload.clearFiles();
e.clearSelection();
});
clipboard.on('error', (e) => {
this.$message.error('复制失败');
});
},
beforeDestroy() {
clipboard.destroy();
},
methods: {
_enterDir(dir) {
this.path = this.path + dir;
this.fetch(this.path);
},
_pathClick(dir) {
const prefix = findPrefix(dir, this.path);
this.path = prefix + dir + SLASH;
this.fetch(this.path);
},
_rootClick() {
this.path = SLASH;
this.fetch(this.path);
},
_submitUpload(e) {
e.stopPropagation();
this.$refs.upload.submit();
},
_remove(file, fileList) {
console.log(file, fileList);
},
_preview(file) {
console.log(file);
},
_beforeUpload(file) {},
_uploadSuccess(response, file, fileList) {
//等所有上传完成
const filters = fileList.filter(item => {
return item.status === 'success' || item.status === 'error';
});
if (filters.length !== fileList.length) {
return;
}
const uploadedUrls = filters.map((item) => {
return item.response.path;
});
this.uploadedFiles = filters;
console.log(filters);
this.uploadedUrls = uploadedUrls;
this.fetch(this.path);
console.log(this.fileList)
},
getPrefix() {
this.$http.get('/oss/prefix?env=test', {}, {
emulateJSON: true
}).then((response) => {
this.domainPrefix = response.data.prefix + '/';
}, (error) => {
console.log(error)
});
},
fetch(path) {
console.log(path);
const loadingInstance = Loading.service({
fullscreen: true
});
window.location.hash = `${hash}?path=${path}`;
this.pathObj = {
path
};
this.$http.get('/oss/list', {
params: {
path
}
}, {
emulateJSON: true
}).then((response) => {
const {
dirs,
files
} = response.data;
this.dirs = dirs;
this.files = files;
loadingInstance.close();
}, (error) => {
console.log(error)
loadingInstance.close();
});
}
},
components: {
NewFolder,
MyUpload
}
}
</script>
<style lang="css">
a {
cursor: pointer;
}
.inline {
display: inline;
margin: 0 0px;
}
.oss-item {
padding-top: 8px;
padding-bottom: 8px;
border-bottom: 1px solid #f2f6fd;
}
.file-name i{
font-size: 16px;
}
#copy-uploadUrls {
margin-top: 10px;
}
.current-path {
margin-bottom: 8px;
}
.folder {
margin-right: 5px;
position: relative;
top: -2px;
}
.el-upload-dragger {
overflow: auto !important;
position: fixed !important;
width: 100% !important;
height: 100% !important;
cursor: auto !important;
z-index: -1;
top: 0;
left: 0;
background-color: transparent !important;
}
.el-upload-dragger:hover {
border-color: transparent !important;
}
</style>
<template lang="html">
<div class="wrap" @drop.prevent @dragover.prevent @dragleave.prevent>
<NavHeader></NavHeader>
<DirTree></DirTree>
</div>
</template>
<script>
import NavHeader from '../NavHeader.vue'
import DirTree from './DirTree.vue'
export default {
data: () => ({
msg: 'OSS文件管理'
}),
components: {
NavHeader,
DirTree
}
}
</script>
<style lang="css">
.content {
padding: 20px 50px;
}
.button-group {
margin-bottom: 15px;
}
</style>
<template>
<div>
<el-button type="primary" @click="dialogFormVisible = true" icon="el-icon-plus" size="small">新建文件夹</el-button>
<el-dialog title="新建文件夹" :visible.sync="dialogFormVisible">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm">
<el-form-item label="名称" :label-width="formLabelWidth" prop="name">
<el-input v-model="ruleForm.name" placeholder="请输入文件夹名称" auto-complete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="_new('ruleForm')">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
props: ['prop', 'cbRefresh'],
data() {
const validateName = (rule, value, callback) => {
if (value === '') {
callback(new Error('必填项'));
} else if (!value.match(/^[0-9a-zA-Z]{1,10}$/)) {
callback(new Error('1-10字,数字和字母'));
} else {
callback();
}
};
return {
dialogFormVisible: false,
ruleForm: {
name: ''
},
rules: {
name: [
{ validator: validateName, trigger: 'blur' }
]
},
formLabelWidth: '120px'
};
},
methods: {
_new(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.post(this.ruleForm.name);
this.dialogFormVisible = false;
} else {
console.log('error submit!!');
return false;
}
});
},
post(name) {
const {
path
} = this.prop;
this.$http.post('/oss/newFolder', { name, path }).then((response) => {
const {
dirs,
files,
code
} = response.data;
if (code === '0') {
this.$message.success('创建文件夹成功');
this.cbRefresh(path);
this.dirs = dirs;
this.files = files;
} else {
this.$message.error('创建文件夹失败');
}
}, (error) => {
console.log(error)
});
}
}
};
</script>
...@@ -11,16 +11,16 @@ ...@@ -11,16 +11,16 @@
</template> </template>
<script> <script>
import CookieUtil from "comcomp/utils/CookieUtil"; import cookie from 'utils/cookie';
export default { export default {
data() { data() {
const hrefArray = window.location.href.split("/"); const hrefArray = window.location.href.split('/');
const activeIndex = hrefArray[hrefArray.length - 1]; const activeIndex = hrefArray[hrefArray.length - 1];
return { return {
activeIndex, activeIndex,
userName: "", userName: '',
user: "" user: ''
}; };
}, },
mounted() { mounted() {
...@@ -29,11 +29,11 @@ export default { ...@@ -29,11 +29,11 @@ export default {
}, },
methods: { methods: {
logout() { logout() {
CookieUtil.clearCookie("wdata-oss"); cookie.clearCookie('wdata-oss');
window.location.replace("/"); window.location.replace('/');
}, },
fetch() { fetch() {
this.$http.get("/user/info").then( this.$http.get('/user/info').then(
response => { response => {
const { data } = response.data; const { data } = response.data;
this.userName = data; this.userName = data;
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
); );
}, },
fetchUser() { fetchUser() {
this.$http.get("/user/id").then( this.$http.get('/user/id').then(
response => { response => {
const { data } = response.data; const { data } = response.data;
this.user = data; this.user = data;
......
This diff is collapsed.
<template lang="html"> <template lang="html">
<div class="wrap" @drop.prevent @dragover.prevent @dragleave.prevent> <div class="wrap" @drop.prevent @dragover.prevent @dragleave.prevent>
<NavHeader></NavHeader> <Nav></Nav>
<DirTree></DirTree> <Chart></Chart>
</div> </div>
</template> </template>
<script> <script>
import DirTree from './DirTree.vue' import Chart from './chart.vue';
import NavHeader from '../NavHeader.vue'; import Nav from '../nav.vue';
export default { export default {
data: () => ({ components: {
msg: 'OSS文件管理' Chart,
}), Nav
components: { }
DirTree, };
NavHeader
}
}
</script> </script>
<style lang="css"> <style lang="css">
.content { .content {
padding: 20px 50px; padding: 20px 50px;
} }
.button-group { .button-group {
margin-bottom: 15px; margin-bottom: 15px;
} }
</style> </style>
import Vue from 'vue' import Vue from 'vue';
import VueRouter from "vue-router" import VueRouter from 'vue-router';
import VueResource from 'vue-resource' import VueResource from 'vue-resource';
import ElementUI from 'element-ui' import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css' import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue' import App from './App.vue';
import Index from './components/trend/Index.vue' import Index from './components/trend/index.vue';
import Todo from './components/todo/Index.vue'
import History from './components/history/Index.vue'
import Force from './components/force/Index.vue'
import 'comstyle/layout.less'; import 'comstyle/layout.less';
Vue.use(VueRouter) Vue.use(VueRouter);
Vue.use(VueResource) Vue.use(VueResource);
Vue.use(ElementUI) Vue.use(ElementUI);
const router = new VueRouter({ const router = new VueRouter({
base: __dirname, base: __dirname,
routes: [{ routes: [
path: '/', {
redirect: '/home' path: '/',
}, { redirect: '/home'
path: '/home', },
component: Index, {
meta: { path: '/home',
// 需要补全链接 component: Index,
shouldComplementary: true meta: {
// 需要补全链接
shouldComplementary: true
}
} }
}, ]
{ });
path: '/list',
component: Todo
}, {
path: '/log',
component: History
}, {
path: '/force',
component: Force
}]
})
new Vue({ new Vue({
el: '#app', el: '#app',
router: router, router: router,
render: h => h(App) render: h => h(App)
}) });
...@@ -8,39 +8,39 @@ ...@@ -8,39 +8,39 @@
<script> <script>
export default { export default {
data() { data() {
const hrefArray = window.location.href.split('/'); const hrefArray = window.location.href.split('/');
const activeIndex = hrefArray[hrefArray.length - 1]; const activeIndex = hrefArray[hrefArray.length - 1];
return { return {
activeIndex activeIndex
}; };
}, },
methods: { methods: {
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
console.log(key, keyPath); console.log(key, keyPath);
}
} }
} }
};
</script> </script>
<style lang="css"> <style lang="css">
.nav-title { .nav-title {
position: relative; position: relative;
float: left; float: left;
margin: 13px; margin: 13px;
color: #fff; color: #fff;
} }
.el-menu { .el-menu {
padding: 0 20px; padding: 0 20px;
} }
.el-menu-item { .el-menu-item {
font-size: 16px; font-size: 16px;
color: #fff !important; color: #fff !important;
} }
.el-menu-item:hover { .el-menu-item:hover {
background-color: transparent !important; background-color: transparent !important;
} }
</style> </style>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</template> </template>
<script> <script>
import NavHeader from '../NavHeader.vue'; import Nav from '../nav.vue';
import { Message, Loading } from 'element-ui'; import { Message, Loading } from 'element-ui';
export default { export default {
...@@ -96,7 +96,7 @@ export default { ...@@ -96,7 +96,7 @@ export default {
} }
}, },
components: { components: {
NavHeader Nav
} }
} }
</script> </script>
......
<template lang="html"> <template lang="html">
<div> <div>
<!-- <NavHeader /> --> <!-- <Nav /> -->
<div class="login-wrap"> <div class="login-wrap">
<el-form :model="ruleForm" label-position="top" :rules="rules" ref="ruleForm" label-width="100px" class="signin-ruleForm"> <el-form :model="ruleForm" label-position="top" :rules="rules" ref="ruleForm" label-width="100px" class="signin-ruleForm">
<el-form-item style="text-align:center;"> <el-form-item style="text-align:center;">
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</template> </template>
<script> <script>
import NavHeader from '../NavHeader.vue'; import Nav from '../nav.vue';
import { Message, Loading } from 'element-ui'; import { Message, Loading } from 'element-ui';
export default { export default {
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
} }
}, },
components: { components: {
NavHeader Nav
} }
} }
</script> </script>
......
import Vue from 'vue' import Vue from 'vue';
import VueRouter from "vue-router" import VueRouter from 'vue-router';
import VueResource from 'vue-resource' import VueResource from 'vue-resource';
import ElementUI from 'element-ui' import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css' import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue' import App from './App.vue';
import Signin from './components/signin/Signin.vue' import Signin from './components/signin';
import Signup from './components/signup/Signup.vue' import Signup from './components/signup';
Vue.use(VueRouter) Vue.use(VueRouter);
Vue.use(VueResource) Vue.use(VueResource);
Vue.use(ElementUI) Vue.use(ElementUI);
const router = new VueRouter({ const router = new VueRouter({
// mode: 'history', // mode: 'history',
base: __dirname, base: __dirname,
routes: [{ routes: [
path: '/', {
redirect: '/signin' path: '/',
}, { redirect: '/signin'
path: '/signin', },
component: Signin {
}, { path: '/signin',
path: '/signup', component: Signin
component: Signup },
}] {
}) path: '/signup',
component: Signup
}
]
});
new Vue({ new Vue({
el: '#app', el: '#app',
router: router, router: router,
render: h => h(App) render: h => h(App)
}) });
.oss-container { .total-container {
padding: 30px 50px 0; padding: 30px 50px 0;
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
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