You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB

var express = require('express');
var router = express.Router();
var mock = require('../../public/javascripts/mock')
var Mock = require("mockjs")
var multipart = require('connect-multiparty');
var multipartMiddleware = multipart();
var moment = require("moment")
var util=require("../../public/javascripts/util")
var route=require('../../public/javascripts/route')
//获取一般信息
router.get('/info', function (req, res, next) {
var data={
...mock.ok('成功获取项目一般信息')
,...{
body: {
companyName: Mock.Random.name(),
device: Mock.Random.name(),
unit: Mock.Random.name(),
projectNumber: Mock.Random.guid(),
startDate: Mock.Random.date(),
endDate: Mock.Random.date(),
analyticalMethod: Mock.Random.name(),
note: Mock.Random.name()
}
}}
res.json(data)
})
//保存一般信息
router.post('/info', multipartMiddleware,function (req, res, next) {
res.json(mock.ok(`数据自动保存成功,最后更新时间:${moment().format(util.dateFormat)}`))
})
//获取团队成员
router.get('/member', function (req, res, next) {
var data=mock.page(req,'获取团队成员成功',{
name:()=>Mock.Random.name(),
email:()=>Mock.Random.email(),
cellphone:/1[34578][0-9]{9}/,
post:()=>Mock.Random.word(),
company:()=>Mock.Random.word(),
department:()=>Mock.Random.word(),
specialty:()=>Mock.Random.word(),
time:()=>Mock.Random.datetime(),
note:()=>Mock.Random.sentence(3, 5)
})
res.json(data)
})
route.addContextMenu(router,'member','团队成员')
module.exports = router