Browse Source

七牛地址传递

dev
巴林闲侠 2 years ago
parent
commit
8603d77a9d
  1. 1
      web/client/src/layout/actions/global.js
  2. 3
      web/config.js
  3. 2
      web/package.json
  4. 4
      web/routes/attachment/index.js

1
web/client/src/layout/actions/global.js

@ -31,6 +31,7 @@ export function initApiRoot () {
return dispatch => {
RouteRequest.get(RouteTable.apiRoot).then(res => {
localStorage.setItem('tyApiRoot', res.root);
localStorage.setItem('qndmn', res.qndmn);
dispatch({
type: INIT_API_ROOT,
payload: {

3
web/config.js

@ -16,7 +16,7 @@ dev && console.log('\x1B[33m%s\x1b[0m', '请遵循并及时更新 readme.md,
args.option(['p', 'port'], '启动端口');
args.option(['u', 'api-url'], 'webapi的URL');
args.option(['r', 'report-node'], '报表进程地址');
args.option(['r', 'report-node'], '报表进程地址');
args.option('qndmn', '七牛');
const flags = args.parse(process.argv);
const FS_UNIAPP_API = process.env.FS_UNIAPP_API || flags.apiUrl;
@ -53,6 +53,7 @@ const product = {
entry: require('./routes').entry,
opts: {
apiUrl: FS_UNIAPP_API,
qndmn: QINIU_DOMAIN_QNDMN_RESOURCE,
staticRoot: './client',
}
}, {

2
web/package.json

@ -6,7 +6,7 @@
"scripts": {
"test": "mocha",
"start": "cross-env NODE_ENV=development npm run start-params",
"start-params": "node server -p 5000 -u http://10.8.30.7:14000",
"start-params": "node server -p 5000 -u http://10.8.30.7:14000 --qndmn http://rfkimpwbb.hn-bkt.clouddn.com",
"deploy": "export NODE_ENV=production&&npm run color && npm run build && node server",
"build-dev": "export NODE_ENV=development&&webpack --config webpack.config.js",
"build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js",

4
web/routes/attachment/index.js

@ -18,9 +18,9 @@ const ext = {
module.exports = {
entry: function (app, router, opts) {
const getApiRoot = async function (ctx) {
const { apiUrl } = opts;
const { apiUrl, qndmn } = opts;
ctx.status = 200;
ctx.body = { root: apiUrl };
ctx.body = { root: apiUrl, qndmn };
};
let upload = async function (ctx, next) {

Loading…
Cancel
Save