From 7b5c06c845f2d829079acef13dfe54bed897c785 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Thu, 8 Oct 2020 20:28:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/www | 2 +- package.json | 1 + routes/main/project.js | 90 +++++++++++++++++++++++++++++------------- yarn.lock | 83 +++++++++++++++++++++++++++++++++++++- 4 files changed, 146 insertions(+), 30 deletions(-) diff --git a/bin/www b/bin/www index 6b6f176..eb5720c 100644 --- a/bin/www +++ b/bin/www @@ -12,7 +12,7 @@ var http = require('http'); * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '4000'); +var port = normalizePort(process.env.PORT); app.set('port', port); /** diff --git a/package.json b/package.json index 84d8d60..459a240 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "start": "node ./bin/www" }, "dependencies": { + "connect-multiparty": "^2.2.0", "cookie-parser": "~1.4.4", "cors": "^2.8.5", "debug": "~2.6.9", diff --git a/routes/main/project.js b/routes/main/project.js index b7440a5..239de01 100644 --- a/routes/main/project.js +++ b/routes/main/project.js @@ -3,12 +3,13 @@ var router = express.Router(); var Mock = require("mockjs") var util=require('../../public/javascripts/util') var moment = require('moment') +var multipart = require('connect-multiparty'); +var multipartMiddleware = multipart(); -//项目分组信息 -router.get('/project/group',function(req, res, next) { +function groupJson(message,req, res, next){ var data=Mock.mock({ code:200, - message:'获取项目分组信息成功', + message:message, result:'OK', body: { total:0, @@ -20,6 +21,7 @@ router.get('/project/group',function(req, res, next) { let obj do{ obj={ + id:i, name: Mock.mock('@first'), count:Mock.Random.natural(1,100) } @@ -34,26 +36,45 @@ router.get('/project/group',function(req, res, next) { } }) return res.json(data) +} + +//项目分组信息 +router.get('/project/group',function(req, res, next) { + return groupJson('获取项目分组信息成功',req,res,next) }) -//项目列表数据 -router.get('/project',function(req, res, next) { - var data=Mock.mock({ - code:200, - message:'获取项目列表信息成功', - result:'OK', - body:{ - 'totalCount|10-100':0, - pageSize:10, - totalPage:function (){ - return Math.ceil(this.totalCount/this.pageSize) - }, - currentPage:function (){ - return Mock.Random.natural(1,this.totalPage) - }, - project:function (){ - let arr=[] - for(let i=0;i= 1.0.0" +connect-multiparty@^2.2.0: + version "2.2.0" + resolved "https://registry.npm.taobao.org/connect-multiparty/download/connect-multiparty-2.2.0.tgz#b4932482dba298f82b8a54b70fb60ec5d72393c3" + integrity sha1-tJMkgtuimPgrilS3D7YOxdcjk8M= + dependencies: + http-errors "~1.7.0" + multiparty "~4.2.1" + on-finished "~2.3.0" + qs "~6.5.2" + type-is "~1.6.16" + constantinople@^3.0.1: version "3.1.2" resolved "https://registry.npm.taobao.org/constantinople/download/constantinople-3.1.2.tgz#d45ed724f57d3d10500017a7d3a889c1381ae647" @@ -350,6 +361,28 @@ http-errors@1.6.3, http-errors@~1.6.2, http-errors@~1.6.3: setprototypeof "1.1.0" statuses ">= 1.4.0 < 2" +http-errors@~1.7.0: + version "1.7.3" + resolved "https://registry.npm.taobao.org/http-errors/download/http-errors-1.7.3.tgz?cache=0&sync_timestamp=1593407858306&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhttp-errors%2Fdownload%2Fhttp-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" + integrity sha1-bGGeT5xgMIw4UZSYwU+7EKrOuwY= + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + +http-errors@~1.8.0: + version "1.8.0" + resolved "https://registry.npm.taobao.org/http-errors/download/http-errors-1.8.0.tgz?cache=0&sync_timestamp=1593407858306&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhttp-errors%2Fdownload%2Fhttp-errors-1.8.0.tgz#75d1bbe497e1044f51e4ee9e704a62f28d336507" + integrity sha1-ddG75JfhBE9R5O6ecEpi8o0zZQc= + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + iconv-lite@0.4.23: version "0.4.23" resolved "https://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" @@ -362,6 +395,11 @@ inherits@2.0.3: resolved "https://registry.npm.taobao.org/inherits/download/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= +inherits@2.0.4: + version "2.0.4" + resolved "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w= + ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.npm.taobao.org/ipaddr.js/download/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" @@ -487,6 +525,15 @@ ms@2.0.0: resolved "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= +multiparty@~4.2.1: + version "4.2.2" + resolved "https://registry.npm.taobao.org/multiparty/download/multiparty-4.2.2.tgz#bee5fb5737247628d39dab4979ffd6d57bf60ef6" + integrity sha1-vuX7VzckdijTnatJef/W1Xv2DvY= + dependencies: + http-errors "~1.8.0" + safe-buffer "5.2.1" + uid-safe "2.1.5" + negotiator@0.6.2: version "0.6.2" resolved "https://registry.npm.taobao.org/negotiator/download/negotiator-0.6.2.tgz?cache=0&sync_timestamp=1589682752355&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnegotiator%2Fdownload%2Fnegotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" @@ -644,11 +691,16 @@ pug@2.0.0-beta11: pug-runtime "^2.0.3" pug-strip-comments "^1.0.2" -qs@6.5.2: +qs@6.5.2, qs@~6.5.2: version "6.5.2" resolved "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha1-yzroBuh0BERYTvFUzo7pjUA/PjY= +random-bytes@~1.0.0: + version "1.0.0" + resolved "https://registry.npm.taobao.org/random-bytes/download/random-bytes-1.0.0.tgz#4f68a1dc0ae58bd3fb95848c30324db75d64360b" + integrity sha1-T2ih3Arli9P7lYSMMDJNt11kNgs= + range-parser@~1.2.0: version "1.2.1" resolved "https://registry.npm.taobao.org/range-parser/download/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" @@ -693,6 +745,11 @@ safe-buffer@5.1.2: resolved "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz?cache=0&sync_timestamp=1589682795646&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafe-buffer%2Fdownload%2Fsafe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha1-mR7GnSluAxN0fVm9/St0XDX4go0= +safe-buffer@5.2.1: + version "5.2.1" + resolved "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.2.1.tgz?cache=0&sync_timestamp=1589682795646&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafe-buffer%2Fdownload%2Fsafe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY= + "safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.npm.taobao.org/safer-buffer/download/safer-buffer-2.1.2.tgz?cache=0&sync_timestamp=1589682784154&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafer-buffer%2Fdownload%2Fsafer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -732,6 +789,16 @@ setprototypeof@1.1.0: resolved "https://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" integrity sha1-0L2FU2iHtv58DYGMuWLZ2RxU5lY= +setprototypeof@1.1.1: + version "1.1.1" + resolved "https://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" + integrity sha1-fpWsskqpL1iF4KvvW6ExMw1K5oM= + +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha1-ZsmiSnP5/CjL5msJ/tPTPcrxtCQ= + source-map@0.4.x: version "0.4.4" resolved "https://registry.npm.taobao.org/source-map/download/source-map-0.4.4.tgz?cache=0&sync_timestamp=1589682764497&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsource-map%2Fdownload%2Fsource-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" @@ -744,7 +811,7 @@ source-map@~0.5.1: resolved "https://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz?cache=0&sync_timestamp=1589682764497&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsource-map%2Fdownload%2Fsource-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= -"statuses@>= 1.4.0 < 2": +"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2": version "1.5.0" resolved "https://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz?cache=0&sync_timestamp=1589682739548&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstatuses%2Fdownload%2Fstatuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= @@ -759,6 +826,11 @@ to-fast-properties@^1.0.3: resolved "https://registry.npm.taobao.org/to-fast-properties/download/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= +toidentifier@1.0.0: + version "1.0.0" + resolved "https://registry.npm.taobao.org/toidentifier/download/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" + integrity sha1-fhvjRw8ed5SLxD2Uo8j013UrpVM= + token-stream@0.0.1: version "0.0.1" resolved "https://registry.npm.taobao.org/token-stream/download/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a" @@ -787,6 +859,13 @@ uglify-to-browserify@~1.0.0: resolved "https://registry.npm.taobao.org/uglify-to-browserify/download/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc= +uid-safe@2.1.5: + version "2.1.5" + resolved "https://registry.npm.taobao.org/uid-safe/download/uid-safe-2.1.5.tgz#2b3d5c7240e8fc2e58f8aa269e5ee49c0857bd3a" + integrity sha1-Kz1cckDo/C5Y+Komnl7knAhXvTo= + dependencies: + random-bytes "~1.0.0" + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.npm.taobao.org/unpipe/download/unpipe-1.0.0.tgz?cache=0&sync_timestamp=1589682745059&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Funpipe%2Fdownload%2Funpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"