正在显示
41 个修改的文件
包含
1981 行增加
和
1814 行删除
@@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
24 | "service:settlemgmIterative": "better-npm-run service-settlemgmIterative", | 24 | "service:settlemgmIterative": "better-npm-run service-settlemgmIterative", |
25 | "service:hroSettlemgm": "better-npm-run service-hroSettlemgm", | 25 | "service:hroSettlemgm": "better-npm-run service-hroSettlemgm", |
26 | "service:hroTemp": "better-npm-run service-hroTemp", | 26 | "service:hroTemp": "better-npm-run service-hroTemp", |
27 | + "service:hroEngma": "better-npm-run service-hroEngma", | ||
27 | "service:developTest": "better-npm-run service-developTest", | 28 | "service:developTest": "better-npm-run service-developTest", |
28 | "dev-start": "node-debug ./app.js", | 29 | "dev-start": "node-debug ./app.js", |
29 | "prepublish": "npm prune", | 30 | "prepublish": "npm prune", |
@@ -93,7 +94,7 @@ | @@ -93,7 +94,7 @@ | ||
93 | } | 94 | } |
94 | }, | 95 | }, |
95 | "service": { | 96 | "service": { |
96 | - "command": "babel-node server/app.js", | 97 | + "command": "pm2 start server/app.js -i max --name web-hro", |
97 | "env": { | 98 | "env": { |
98 | "NODE_ENV": "production", | 99 | "NODE_ENV": "production", |
99 | "DEBUG": "app:*" | 100 | "DEBUG": "app:*" |
@@ -154,6 +155,13 @@ | @@ -154,6 +155,13 @@ | ||
154 | "NODE_ENV": "test", | 155 | "NODE_ENV": "test", |
155 | "DEBUG": "app:*" | 156 | "DEBUG": "app:*" |
156 | } | 157 | } |
158 | + }, | ||
159 | + "service-hroEngma": { | ||
160 | + "command": "pm2 start server/app.js -i 2 --name web-hro-engma", | ||
161 | + "env": { | ||
162 | + "NODE_ENV": "hroEngma", | ||
163 | + "DEBUG": "app:*" | ||
164 | + } | ||
157 | } | 165 | } |
158 | }, | 166 | }, |
159 | "keywords": [ | 167 | "keywords": [ |
@@ -369,4 +377,4 @@ | @@ -369,4 +377,4 @@ | ||
369 | }, | 377 | }, |
370 | "author": "fan", | 378 | "author": "fan", |
371 | "license": "ISC" | 379 | "license": "ISC" |
372 | -} | ||
380 | +} |
@@ -165,12 +165,14 @@ exports = module.exports = function () { | @@ -165,12 +165,14 @@ exports = module.exports = function () { | ||
165 | port: 35729 | 165 | port: 35729 |
166 | }, | 166 | }, |
167 | restful: { | 167 | restful: { |
168 | - url: 'http://47.110.158.110:20000/', | ||
169 | - ossUrl: 'http://47.110.158.110:20000/', | ||
170 | - version: '/v1', | ||
171 | - host: '47.110.158.110', | ||
172 | - port: 20000 | 168 | + url: 'http://154.8.229.55:20000/', |
169 | + // url:'http://192.144.144.220:20000/', | ||
170 | + //url:'http://127.0.0.1:20000/', | ||
171 | + // url:'http://140.143.196.80:20000/', | ||
172 | + ossUrl: 'http://192.168.2.72:20000/', | ||
173 | + version: '/v1' | ||
173 | }, | 174 | }, |
175 | + prefix: '/', | ||
174 | localStrategy: { | 176 | localStrategy: { |
175 | usernameField: 'username', | 177 | usernameField: 'username', |
176 | passwordField: 'password', | 178 | passwordField: 'password', |
@@ -251,10 +253,10 @@ exports = module.exports = function () { | @@ -251,10 +253,10 @@ exports = module.exports = function () { | ||
251 | enabled: false, | 253 | enabled: false, |
252 | }, | 254 | }, |
253 | restful: { | 255 | restful: { |
254 | - url: 'http://47.110.158.110:20000/', | ||
255 | - ossUrl: 'http://47.110.158.110:20000/', | 256 | + url: 'http://192.168.2.72:20000/', |
257 | + ossUrl: 'http://192.168.2.72:20000/', | ||
256 | version: '/v1', | 258 | version: '/v1', |
257 | - host: '47.110.158.110', | 259 | + host: '192.168.2.72', |
258 | port: 20000 | 260 | port: 20000 |
259 | }, | 261 | }, |
260 | server: { | 262 | server: { |
@@ -278,8 +280,8 @@ exports = module.exports = function () { | @@ -278,8 +280,8 @@ exports = module.exports = function () { | ||
278 | redis: { | 280 | redis: { |
279 | prefix: 'igloo_production', | 281 | prefix: 'igloo_production', |
280 | host: '127.0.0.1', | 282 | host: '127.0.0.1', |
281 | - port: 6379, | ||
282 | - pass: '', | 283 | + port: 38888, |
284 | + pass: 'Q*Kr4?#Rg!' | ||
283 | }, | 285 | }, |
284 | csrf: { | 286 | csrf: { |
285 | enabled: true, | 287 | enabled: true, |
@@ -300,10 +302,10 @@ exports = module.exports = function () { | @@ -300,10 +302,10 @@ exports = module.exports = function () { | ||
300 | 'console': true, | 302 | 'console': true, |
301 | requests: true, | 303 | requests: true, |
302 | mongo: false, | 304 | mongo: false, |
303 | - // file: { | ||
304 | - // filename: '/opt/work/hro/frontend/hro/igloo.log', | ||
305 | - // timestamp: true | ||
306 | - // } | 305 | + file: { |
306 | + filename: '/opt/work/hro/frontend/hro/igloo.log', | ||
307 | + timestamp: true | ||
308 | + } | ||
307 | } | 309 | } |
308 | } | 310 | } |
309 | }; | 311 | }; |
@@ -91,6 +91,9 @@ exports = module.exports = function (logger, rest, settings) { | @@ -91,6 +91,9 @@ exports = module.exports = function (logger, rest, settings) { | ||
91 | } | 91 | } |
92 | 92 | ||
93 | function splitUrl(fullUrl) { | 93 | function splitUrl(fullUrl) { |
94 | + if(settings.prefix&&settings.prefix.length>1){ | ||
95 | + fullUrl=fullUrl.substring(settings.prefix.length-1); | ||
96 | + } | ||
94 | var url = fullUrl.substring(4); | 97 | var url = fullUrl.substring(4); |
95 | return url; | 98 | return url; |
96 | } | 99 | } |
1 | var passport = require('passport'); | 1 | var passport = require('passport'); |
2 | var clientRest = require('restler'); | 2 | var clientRest = require('restler'); |
3 | -var urlencode= require('urlencode'); | ||
4 | -exports=module.exports=function(logger,rest,settings){ | ||
5 | - function index(req,res,next){ | 3 | +var urlencode = require('urlencode'); |
4 | +var async = require('async'); | ||
5 | +var crypto = require('crypto'); | ||
6 | + | ||
7 | + | ||
8 | +exports = module.exports = function (logger, rest, settings) { | ||
9 | + function index(req, res, next) { | ||
6 | logger.info(req.user); | 10 | logger.info(req.user); |
7 | - if(req.csrfToken) | ||
8 | - res.render('index',{'csrfToken':req.csrfToken()}); | ||
9 | - else | ||
10 | - res.render('index',{'csrfToken':''}); | 11 | + if (req.csrfToken) { |
12 | + res.render('index', { 'csrfToken': req.csrfToken() }); | ||
13 | + } else | ||
14 | + res.render('index', { 'csrfToken': '' }); | ||
11 | } | 15 | } |
12 | 16 | ||
13 | - function productDes(req,res,next){ | ||
14 | - if(req.csrfToken) | ||
15 | - res.render('chat/new-chat',{'csrfToken':req.csrfToken()}); | 17 | + function indexPrefix(req, res, next) { |
18 | + logger.info(req.user); | ||
19 | + if (req.csrfToken) { | ||
20 | + if (settings.prefix && settings.prefix.length > 1) { | ||
21 | + res.redirect(settings.prefix.substring(0, settings.prefix.length - 1)); | ||
22 | + } else { | ||
23 | + res.render('index', { 'csrfToken': req.csrfToken() }); | ||
24 | + } | ||
25 | + } else | ||
26 | + res.render('index', { 'csrfToken': '' }); | ||
27 | + } | ||
28 | + | ||
29 | + function productDes(req, res, next) { | ||
30 | + if (req.csrfToken) | ||
31 | + res.render('chat/new-chat', { 'csrfToken': req.csrfToken() }); | ||
16 | else | 32 | else |
17 | - res.render('chat/new-chat',{'csrfToken':''}); | 33 | + res.render('chat/new-chat', { 'csrfToken': '' }); |
18 | } | 34 | } |
19 | 35 | ||
20 | - function recharge(req,res,next){ | 36 | + function recharge(req, res, next) { |
21 | 37 | ||
22 | - var params=JSON.parse(urlencode.decode(req.query.params)); | 38 | + var params = JSON.parse(urlencode.decode(req.query.params)); |
23 | console.log(params); | 39 | console.log(params); |
24 | - if(req.csrfToken) | ||
25 | - res.render('recharge',{'recharge':params,'csrfToken':req.csrfToken()}); | 40 | + if (req.csrfToken) |
41 | + res.render('recharge', { 'recharge': params, 'csrfToken': req.csrfToken() }); | ||
26 | else | 42 | else |
27 | - res.render('recharge',{'recharge':params,'csrfToken':''}); | ||
28 | - | 43 | + res.render('recharge', { 'recharge': params, 'csrfToken': '' }); |
44 | + | ||
29 | } | 45 | } |
30 | 46 | ||
31 | - function register(req,res,next){ | ||
32 | - if(req.csrfToken) | ||
33 | - res.render('newRegister',{'csrfToken':req.csrfToken()}); | ||
34 | - else | ||
35 | - res.render('newRegister',{'csrfToken':''}); | 47 | + function register(req, res, next) { |
48 | + if (req.csrfToken) | ||
49 | + res.render('newRegister', { 'csrfToken': req.csrfToken() }); | ||
50 | + else | ||
51 | + res.render('newRegister', { 'csrfToken': '' }); | ||
36 | } | 52 | } |
37 | 53 | ||
38 | - function mobileRegister (req,res,next) { | ||
39 | - if(req.csrfToken) | ||
40 | - res.render('registerMobile',{'csrfToken':req.csrfToken()}); | ||
41 | - else | ||
42 | - res.render('registerMobile',{'csrfToken':''}); | 54 | + function mobileRegister(req, res, next) { |
55 | + if (req.csrfToken) | ||
56 | + res.render('registerMobile', { 'csrfToken': req.csrfToken() }); | ||
57 | + else | ||
58 | + res.render('registerMobile', { 'csrfToken': '' }); | ||
43 | } | 59 | } |
44 | 60 | ||
45 | - function mobileRegisterSuccess (req,res,next) { | ||
46 | - if(req.csrfToken) | ||
47 | - res.render('registerMobileSuccess',{'csrfToken':req.csrfToken()}); | ||
48 | - else | ||
49 | - res.render('registerMobileSuccess',{'csrfToken':''}); | 61 | + function mobileRegisterSuccess(req, res, next) { |
62 | + if (req.csrfToken) | ||
63 | + res.render('registerMobileSuccess', { 'csrfToken': req.csrfToken() }); | ||
64 | + else | ||
65 | + res.render('registerMobileSuccess', { 'csrfToken': '' }); | ||
50 | } | 66 | } |
51 | 67 | ||
52 | - function signIn(req,res,next){ | ||
53 | - // console.log(req); | ||
54 | - if(req.csrfToken) | ||
55 | - res.render('newLogin',{'csrfToken':req.csrfToken()}); | ||
56 | - else | ||
57 | - res.render('newLogin',{'csrfToken':''}); | ||
58 | - | 68 | + function signIn(req, res, next) { |
69 | + // console.log(req); | ||
70 | + if (req.csrfToken) | ||
71 | + res.render('newLogin', { 'csrfToken': req.csrfToken() }); | ||
72 | + else | ||
73 | + res.render('newLogin', { 'csrfToken': '' }); | ||
74 | + | ||
59 | } | 75 | } |
60 | 76 | ||
61 | - function doLogin(req,res,next){ | ||
62 | - passport.authenticate('local', function(err, user, info) { | ||
63 | - console.log("doLogin:",err,user,info) | 77 | + function doLogin(req, res, next) { |
78 | + passport.authenticate('local', function (err, user, info) { | ||
79 | + console.log("doLogin:", err, user, info) | ||
64 | if (err) { return next(err); } | 80 | if (err) { return next(err); } |
65 | if (!user) { return res.send(info); } | 81 | if (!user) { return res.send(info); } |
66 | - req.logIn(user, function(err) { | 82 | + req.logIn(user, function (err) { |
67 | if (err) { return next(err); } | 83 | if (err) { return next(err); } |
68 | - return res.send({'ok':'登录成功',user_info:req.session.passport.user.user_info}); | 84 | + return res.send({ 'ok': '登录成功', user_info: req.session.passport.user.user_info }); |
69 | }); | 85 | }); |
70 | - })(req, res, next); | 86 | + })(req, res, next); |
71 | } | 87 | } |
72 | 88 | ||
73 | - function signOut(req,res,next){ | ||
74 | - if(req.session.passport&&req.session.passport.user&&req.session.passport.user.user_info&&req.session.passport.user.user_info.user) | ||
75 | - logger.info(req.session.passport.user.user_info.user,'You have successfully logged out'); | 89 | + function signOut(req, res, next) { |
90 | + if (req.session.passport && req.session.passport.user && req.session.passport.user.user_info && req.session.passport.user.user_info.user) | ||
91 | + logger.info(req.session.passport.user.user_info.user, 'You have successfully logged out'); | ||
76 | req.logout(); | 92 | req.logout(); |
77 | - req.flash('success', 'You have successfully logged out'); | ||
78 | - res.redirect('/'); | ||
79 | - } | ||
80 | - | ||
81 | - function smsCodes(req,res,next){ | ||
82 | - rest.postJson({ | ||
83 | - 'baseUrl':'url', | ||
84 | - 'url':'auth/smscodes', | ||
85 | - 'params':req.body, | ||
86 | - 'callback':_cb, | ||
87 | - 'req':req, | ||
88 | - 'res':res, | ||
89 | - 'options':{}, | ||
90 | - 'excludeToken':true | 93 | + req.flash('success', 'You have successfully logged out'); |
94 | + res.redirect('/'); | ||
95 | + } | ||
96 | + | ||
97 | + function smsCodes(req, res, next) { | ||
98 | + rest.postJson({ | ||
99 | + 'baseUrl': 'url', | ||
100 | + 'url': 'auth/smscodes', | ||
101 | + 'params': req.body, | ||
102 | + 'callback': _cb, | ||
103 | + 'req': req, | ||
104 | + 'res': res, | ||
105 | + 'options': {}, | ||
106 | + 'excludeToken': true | ||
91 | }) | 107 | }) |
92 | - function _cb(data,response){ | ||
93 | - logger.info("back data:",data); | ||
94 | - if(response.statusCode<300){ | ||
95 | - res.send({"code":200,"message":"发送成功"}); | ||
96 | - }else{ | ||
97 | - res.send(data); | ||
98 | - } | 108 | + function _cb(data, response) { |
109 | + logger.info("back data:", data); | ||
110 | + if (response.statusCode < 300) { | ||
111 | + res.send({ "code": 200, "message": "发送成功" }); | ||
112 | + } else { | ||
113 | + res.send(data); | ||
114 | + } | ||
99 | }; | 115 | }; |
100 | } | 116 | } |
101 | 117 | ||
102 | - function tenants(req,res,next){ | 118 | + function tenants(req, res, next) { |
103 | rest.register({ | 119 | rest.register({ |
104 | - 'baseUrl':'url', | ||
105 | - 'url':'tenants', | ||
106 | - 'params':req.body, | ||
107 | - 'callback':_cb, | ||
108 | - 'req':req, | ||
109 | - 'res':res, | ||
110 | - 'options':{}, | ||
111 | - 'excludeToken':true | ||
112 | - }); | ||
113 | - function _cb(data,response){ | ||
114 | - logger.info("back data:",data); | ||
115 | - res.send(data); | 120 | + 'baseUrl': 'url', |
121 | + 'url': 'tenants', | ||
122 | + 'params': req.body, | ||
123 | + 'callback': _cb, | ||
124 | + 'req': req, | ||
125 | + 'res': res, | ||
126 | + 'options': {}, | ||
127 | + 'excludeToken': true | ||
128 | + }); | ||
129 | + function _cb(data, response) { | ||
130 | + logger.info("back data:", data); | ||
131 | + res.send(data); | ||
116 | }; | 132 | }; |
117 | } | 133 | } |
118 | 134 | ||
119 | - function resetPass(req,res){ | ||
120 | - rest.putJson({ | ||
121 | - 'baseUrl':'url', | ||
122 | - 'url':'auth/user', | ||
123 | - 'params':{ | ||
124 | - 'user':req.body.user, | ||
125 | - 'password':req.body.password, | ||
126 | - 'again_password':req.body.again_password | 135 | + function resetPass(req, res) { |
136 | + rest.putJson({ | ||
137 | + 'baseUrl': 'url', | ||
138 | + 'url': 'auth/user', | ||
139 | + 'params': { | ||
140 | + 'user': req.body.user, | ||
141 | + 'password': req.body.password, | ||
142 | + 'again_password': req.body.again_password | ||
127 | }, | 143 | }, |
128 | - 'callback':_cb, | ||
129 | - 'req':req, | ||
130 | - 'res':res, | ||
131 | - 'options':{} | 144 | + 'callback': _cb, |
145 | + 'req': req, | ||
146 | + 'res': res, | ||
147 | + 'options': {} | ||
132 | }) | 148 | }) |
133 | - function _cb(data,response){ | ||
134 | - logger.info("back data:",data); | ||
135 | - res.send(data); | 149 | + function _cb(data, response) { |
150 | + logger.info("back data:", data); | ||
151 | + res.send(data); | ||
136 | }; | 152 | }; |
137 | } | 153 | } |
138 | 154 | ||
139 | - function updatePassword(req,res){ | ||
140 | - rest.patchJson({ | ||
141 | - 'baseUrl':'url', | ||
142 | - 'url':'users/'+req.body.userId, | ||
143 | - 'params':{ | 155 | + function updatePassword(req, res) { |
156 | + rest.patchJson({ | ||
157 | + 'baseUrl': 'url', | ||
158 | + 'url': 'users/' + req.body.userId, | ||
159 | + 'params': { | ||
144 | 'password': req.body.password | 160 | 'password': req.body.password |
145 | }, | 161 | }, |
146 | - 'callback':_cb, | ||
147 | - 'req':req, | ||
148 | - 'res':res, | ||
149 | - 'options':{} | 162 | + 'callback': _cb, |
163 | + 'req': req, | ||
164 | + 'res': res, | ||
165 | + 'options': {} | ||
150 | }) | 166 | }) |
151 | - function _cb(data,response){ | ||
152 | - logger.info("back data:",data); | ||
153 | - res.send(data); | 167 | + function _cb(data, response) { |
168 | + logger.info("back data:", data); | ||
169 | + res.send(data); | ||
154 | }; | 170 | }; |
155 | } | 171 | } |
156 | - | ||
157 | 172 | ||
158 | - function loadUserInfo(req,res){ | ||
159 | - if(req.session.passport.user&&req.session.passport.user.user_info){ | ||
160 | - res.send({user_info:req.session.passport.user.user_info}); | ||
161 | - }else{ | ||
162 | - res.send({user_info:null}); | 173 | + |
174 | + function loadUserInfo(req, res) { | ||
175 | + settings | ||
176 | + if (req.session.passport.user && req.session.passport.user.user_info) { | ||
177 | + res.send({ user_info: req.session.passport.user.user_info, prefix: settings.prefix }); | ||
178 | + } else { | ||
179 | + res.send({ user_info: null, prefix: settings.prefix }); | ||
163 | } | 180 | } |
164 | } | 181 | } |
165 | 182 | ||
166 | - function getUploaderToken(req,res){ | ||
167 | - rest.postJson({ | ||
168 | - 'baseUrl':'ossUrl', | ||
169 | - 'url':'inits', | ||
170 | - 'params':req.body, | ||
171 | - 'callback':_cb, | ||
172 | - 'req':req, | ||
173 | - 'res':res, | ||
174 | - 'options':{} | 183 | + function getUploaderToken(req, res) { |
184 | + rest.postJson({ | ||
185 | + 'baseUrl': 'ossUrl', | ||
186 | + 'url': 'inits', | ||
187 | + 'params': req.body, | ||
188 | + 'callback': _cb, | ||
189 | + 'req': req, | ||
190 | + 'res': res, | ||
191 | + 'options': {} | ||
175 | }) | 192 | }) |
176 | - function _cb(data,response){ | ||
177 | - logger.info("back data:",data); | ||
178 | - res.send(data); | ||
179 | - }; | ||
180 | - } | ||
181 | - | ||
182 | - function getObjectTokenByID(req,res){ | ||
183 | - rest.get({ | ||
184 | - 'baseUrl':'ossUrl', | ||
185 | - 'url':'objects/'+req.body.file_id, | ||
186 | - 'params':{}, | ||
187 | - 'callback':_cb, | ||
188 | - 'req':req, | ||
189 | - 'res':res, | ||
190 | - 'options':{} | 193 | + function _cb(data, response) { |
194 | + logger.info("back data:", data); | ||
195 | + res.send(data); | ||
196 | + }; | ||
197 | + } | ||
198 | + | ||
199 | + function getObjectTokenByID(req, res) { | ||
200 | + rest.get({ | ||
201 | + 'baseUrl': 'ossUrl', | ||
202 | + 'url': 'objects/' + req.body.file_id, | ||
203 | + 'params': {}, | ||
204 | + 'callback': _cb, | ||
205 | + 'req': req, | ||
206 | + 'res': res, | ||
207 | + 'options': {} | ||
191 | }) | 208 | }) |
192 | - function _cb(data,response){ | ||
193 | - logger.info("back data:",data); | ||
194 | - res.send(data); | ||
195 | - }; | ||
196 | - } | ||
197 | - | ||
198 | - function delOSSObject(req,res){ | ||
199 | - rest.del({ | ||
200 | - 'baseUrl':'ossUrl', | ||
201 | - 'url':'s3objects/'+req.body.request_id+'?bucket='+req.body.bucket+'&file='+req.body.name, | ||
202 | - 'params':{}, | ||
203 | - 'callback':_cb, | ||
204 | - 'req':req, | ||
205 | - 'res':res, | ||
206 | - 'options':{} | 209 | + function _cb(data, response) { |
210 | + logger.info("back data:", data); | ||
211 | + res.send(data); | ||
212 | + }; | ||
213 | + } | ||
214 | + | ||
215 | + function delOSSObject(req, res) { | ||
216 | + rest.del({ | ||
217 | + 'baseUrl': 'ossUrl', | ||
218 | + 'url': 's3objects/' + req.body.request_id + '?bucket=' + req.body.bucket + '&file=' + req.body.name, | ||
219 | + 'params': {}, | ||
220 | + 'callback': _cb, | ||
221 | + 'req': req, | ||
222 | + 'res': res, | ||
223 | + 'options': {} | ||
207 | }) | 224 | }) |
208 | - function _cb(data,response){ | ||
209 | - logger.info("back data:",data); | ||
210 | - console.log(response.statusCode) | ||
211 | - if(response.statusCode<300){ | ||
212 | - res.send({'delete':'ok'}); | ||
213 | - } | 225 | + function _cb(data, response) { |
226 | + logger.info("back data:", data); | ||
227 | + console.log(response.statusCode) | ||
228 | + if (response.statusCode < 300) { | ||
229 | + res.send({ 'delete': 'ok' }); | ||
230 | + } | ||
214 | }; | 231 | }; |
215 | } | 232 | } |
216 | 233 | ||
217 | - function smsVerification(req,res,next){ | ||
218 | - rest.postJson({ | ||
219 | - 'baseUrl':'url', | ||
220 | - 'url':'auth/sms_verification', | ||
221 | - 'params':req.body, | ||
222 | - 'callback':_cb, | ||
223 | - 'req':req, | ||
224 | - 'res':res, | ||
225 | - 'options':{}, | ||
226 | - 'excludeToken':true | 234 | + function smsVerification(req, res, next) { |
235 | + rest.postJson({ | ||
236 | + 'baseUrl': 'url', | ||
237 | + 'url': 'auth/sms_verification', | ||
238 | + 'params': req.body, | ||
239 | + 'callback': _cb, | ||
240 | + 'req': req, | ||
241 | + 'res': res, | ||
242 | + 'options': {}, | ||
243 | + 'excludeToken': true | ||
227 | }) | 244 | }) |
228 | - function _cb(data,response){ | ||
229 | - logger.info("back data:",data); | ||
230 | - if(response.statusCode<300){ | ||
231 | - res.send({"code":200,"message":"发送成功"}); | ||
232 | - }else{ | ||
233 | - res.send({"code":response.statusCode,"message":data.message,'errors':data.errors}); | ||
234 | - } | 245 | + function _cb(data, response) { |
246 | + logger.info("back data:", data); | ||
247 | + if (response.statusCode < 300) { | ||
248 | + res.send({ "code": 200, "message": "发送成功" }); | ||
249 | + } else { | ||
250 | + res.send({ "code": response.statusCode, "message": data.message, 'errors': data.errors }); | ||
251 | + } | ||
235 | }; | 252 | }; |
236 | } | 253 | } |
237 | 254 | ||
238 | - function healthMonitor(req,res){ | 255 | + function healthMonitor(req, res) { |
239 | res.statusCode = 200; | 256 | res.statusCode = 200; |
240 | - return res.send('status ok'); | 257 | + return res.send('status ok'); |
241 | } | 258 | } |
242 | 259 | ||
243 | 260 | ||
244 | - function updateUserRoles(req,res){ | ||
245 | - rest.putJson({ | ||
246 | - 'baseUrl':'url', | ||
247 | - 'url':'user_roles/'+req.body.user_id, | ||
248 | - 'params':req.body.roles, | ||
249 | - 'callback':_cb, | ||
250 | - 'req':req, | ||
251 | - 'res':res, | ||
252 | - 'options':{} | 261 | + function updateUserRoles(req, res) { |
262 | + rest.putJson({ | ||
263 | + 'baseUrl': 'url', | ||
264 | + 'url': 'user_roles/' + req.body.user_id, | ||
265 | + 'params': req.body.roles, | ||
266 | + 'callback': _cb, | ||
267 | + 'req': req, | ||
268 | + 'res': res, | ||
269 | + 'options': {} | ||
253 | }) | 270 | }) |
254 | - function _cb(data,response){ | ||
255 | - logger.info("back data:",data); | ||
256 | - if(response.statusCode<300){ | ||
257 | - res.send({'back':'ok'}); | ||
258 | - }else{ | 271 | + function _cb(data, response) { |
272 | + logger.info("back data:", data); | ||
273 | + if (response.statusCode < 300) { | ||
274 | + res.send({ 'back': 'ok' }); | ||
275 | + } else { | ||
259 | res.send(data); | 276 | res.send(data); |
260 | - } | 277 | + } |
261 | }; | 278 | }; |
262 | } | 279 | } |
263 | 280 | ||
264 | - function getRoles(req,res,next){ | ||
265 | - rest.get({ | ||
266 | - 'baseUrl':'url', | ||
267 | - 'url':'roles', | ||
268 | - 'params':{}, | ||
269 | - 'callback':_cb, | ||
270 | - 'req':req, | ||
271 | - 'res':res, | ||
272 | - 'options':{} | 281 | + function getRoles(req, res, next) { |
282 | + rest.get({ | ||
283 | + 'baseUrl': 'url', | ||
284 | + 'url': 'roles', | ||
285 | + 'params': {}, | ||
286 | + 'callback': _cb, | ||
287 | + 'req': req, | ||
288 | + 'res': res, | ||
289 | + 'options': {} | ||
273 | }) | 290 | }) |
274 | - function _cb(data,response){ | ||
275 | - logger.info("back data:",data); | ||
276 | - res.send(data); | 291 | + function _cb(data, response) { |
292 | + logger.info("back data:", data); | ||
293 | + res.send(data); | ||
277 | }; | 294 | }; |
278 | } | 295 | } |
279 | 296 | ||
280 | 297 | ||
281 | - function getUserRoles(req,res,next){ | ||
282 | - rest.get({ | ||
283 | - 'baseUrl':'url', | ||
284 | - 'url':'user_roles?user='+urlencode(req.body.user)+'&limit='+req.body.limit+'&offset='+req.body.offset, | ||
285 | - 'params':{}, | ||
286 | - 'callback':_cb, | ||
287 | - 'req':req, | ||
288 | - 'res':res, | ||
289 | - 'options':{} | 298 | + function getUserRoles(req, res, next) { |
299 | + rest.get({ | ||
300 | + 'baseUrl': 'url', | ||
301 | + 'url': 'user_roles?user=' + urlencode(req.body.user) + '&limit=' + req.body.limit + '&offset=' + req.body.offset, | ||
302 | + 'params': {}, | ||
303 | + 'callback': _cb, | ||
304 | + 'req': req, | ||
305 | + 'res': res, | ||
306 | + 'options': {} | ||
290 | }) | 307 | }) |
291 | - function _cb(data,response){ | ||
292 | - logger.info("back data:",data); | ||
293 | - res.send(data); | 308 | + function _cb(data, response) { |
309 | + logger.info("back data:", data); | ||
310 | + res.send(data); | ||
294 | }; | 311 | }; |
295 | } | 312 | } |
296 | 313 | ||
297 | - function getTenant(req,res){ | ||
298 | - rest.get({ | ||
299 | - 'baseUrl':'url', | ||
300 | - 'url':'tenants/'+req.body.tenant_id, | ||
301 | - 'params':{}, | ||
302 | - 'callback':_cb, | ||
303 | - 'req':req, | ||
304 | - 'res':res, | ||
305 | - 'options':{} | 314 | + function getTenant(req, res) { |
315 | + rest.get({ | ||
316 | + 'baseUrl': 'url', | ||
317 | + 'url': 'tenants/' + req.body.tenant_id, | ||
318 | + 'params': {}, | ||
319 | + 'callback': _cb, | ||
320 | + 'req': req, | ||
321 | + 'res': res, | ||
322 | + 'options': {} | ||
306 | }) | 323 | }) |
307 | - function _cb(data,response){ | ||
308 | - logger.info("back data:",data); | ||
309 | - res.send(data); | 324 | + function _cb(data, response) { |
325 | + logger.info("back data:", data); | ||
326 | + res.send(data); | ||
310 | }; | 327 | }; |
311 | } | 328 | } |
312 | 329 | ||
313 | - function updateTenant(req,res){ | ||
314 | - rest.putJson({ | ||
315 | - 'baseUrl':'url', | ||
316 | - 'url':'tenants/'+req.body.tenant_id, | ||
317 | - 'params':req.body.tenant, | ||
318 | - 'callback':_cb, | ||
319 | - 'req':req, | ||
320 | - 'res':res, | ||
321 | - 'options':{} | 330 | + function updateTenant(req, res) { |
331 | + rest.putJson({ | ||
332 | + 'baseUrl': 'url', | ||
333 | + 'url': 'tenants/' + req.body.tenant_id, | ||
334 | + 'params': req.body.tenant, | ||
335 | + 'callback': _cb, | ||
336 | + 'req': req, | ||
337 | + 'res': res, | ||
338 | + 'options': {} | ||
322 | }) | 339 | }) |
323 | - function _cb(data,response){ | ||
324 | - logger.info("back data:",data); | ||
325 | - res.send(data); | 340 | + function _cb(data, response) { |
341 | + logger.info("back data:", data); | ||
342 | + res.send(data); | ||
326 | }; | 343 | }; |
327 | } | 344 | } |
328 | 345 | ||
329 | - function offer(req,res){ | ||
330 | - rest.get({ | ||
331 | - 'baseUrl':'hrUrl', | ||
332 | - 'url':'offers/'+req.params.requestId+'?tenant_id='+req.query.tenant_id, | ||
333 | - 'params':{}, | ||
334 | - 'callback':_cb, | ||
335 | - 'req':req, | ||
336 | - 'res':res, | ||
337 | - 'options':{}, | ||
338 | - 'excludeToken':true | 346 | + function offer(req, res) { |
347 | + rest.get({ | ||
348 | + 'baseUrl': 'hrUrl', | ||
349 | + 'url': 'offers/' + req.params.requestId + '?tenant_id=' + req.query.tenant_id, | ||
350 | + 'params': {}, | ||
351 | + 'callback': _cb, | ||
352 | + 'req': req, | ||
353 | + 'res': res, | ||
354 | + 'options': {}, | ||
355 | + 'excludeToken': true | ||
339 | }) | 356 | }) |
340 | - function _cb(data,response){ | ||
341 | - logger.info("back data:",data); | ||
342 | - //res.send(data); | ||
343 | - console.log(data); | ||
344 | - data['offerId']=req.params.requestId; | ||
345 | - data['tenantId']=req.query.tenant_id; | ||
346 | - res.render('offer',data); | ||
347 | - }; | ||
348 | - } | ||
349 | - | ||
350 | - function onboardStatus(req,res){ | ||
351 | - rest.get({ | ||
352 | - 'baseUrl':'hrUrl', | ||
353 | - 'url':'onboard-status', | ||
354 | - 'params':{}, | ||
355 | - 'callback':_cb, | ||
356 | - 'req':req, | ||
357 | - 'res':res, | ||
358 | - 'options':{}, | ||
359 | - 'useUrl':true | 357 | + function _cb(data, response) { |
358 | + logger.info("back data:", data); | ||
359 | + //res.send(data); | ||
360 | + console.log(data); | ||
361 | + data['offerId'] = req.params.requestId; | ||
362 | + data['tenantId'] = req.query.tenant_id; | ||
363 | + res.render('offer', data); | ||
364 | + }; | ||
365 | + } | ||
366 | + | ||
367 | + function onboardStatus(req, res) { | ||
368 | + rest.get({ | ||
369 | + 'baseUrl': 'hrUrl', | ||
370 | + 'url': 'onboard-status', | ||
371 | + 'params': {}, | ||
372 | + 'callback': _cb, | ||
373 | + 'req': req, | ||
374 | + 'res': res, | ||
375 | + 'options': {}, | ||
376 | + 'useUrl': true | ||
360 | }) | 377 | }) |
361 | - function _cb(data,response){ | ||
362 | - logger.info("back data:",data); | ||
363 | - res.send(data); | 378 | + function _cb(data, response) { |
379 | + logger.info("back data:", data); | ||
380 | + res.send(data); | ||
364 | }; | 381 | }; |
365 | } | 382 | } |
366 | 383 | ||
367 | - function dowloadApp(req,res){ | ||
368 | - var mobileAgent=req.headers['user-agent'].toLowerCase(); | ||
369 | - var agent={ | 384 | + function dowloadApp(req, res) { |
385 | + var mobileAgent = req.headers['user-agent'].toLowerCase(); | ||
386 | + var agent = { | ||
370 | android: mobileAgent.indexOf('android') > -1 || mobileAgent.indexOf('Adr') > -1, | 387 | android: mobileAgent.indexOf('android') > -1 || mobileAgent.indexOf('Adr') > -1, |
371 | - iPhone:mobileAgent.indexOf('iphone') > -1, | 388 | + iPhone: mobileAgent.indexOf('iphone') > -1, |
372 | iPad: mobileAgent.indexOf('ipad') > -1 | 389 | iPad: mobileAgent.indexOf('ipad') > -1 |
373 | } | 390 | } |
374 | - if(agent.iPhone||agent.iPad){ | 391 | + if (agent.iPhone || agent.iPad) { |
375 | res.redirect(301, 'https://itunes.apple.com/cn/app/%E8%96%AA%E5%91%97/id1140779439?l=en&mt=8'); | 392 | res.redirect(301, 'https://itunes.apple.com/cn/app/%E8%96%AA%E5%91%97/id1140779439?l=en&mt=8'); |
376 | - }else if(agent.android){ | 393 | + } else if (agent.android) { |
377 | res.redirect(301, 'http://krhrimg.oss-cn-beijing.aliyuncs.com/appdownload/production/android/krhr-android.apk'); | 394 | res.redirect(301, 'http://krhrimg.oss-cn-beijing.aliyuncs.com/appdownload/production/android/krhr-android.apk'); |
378 | - }else{ | 395 | + } else { |
379 | res.redirect(301, 'http://krhrimg.oss-cn-beijing.aliyuncs.com/appdownload/production/android/krhr-android.apk'); | 396 | res.redirect(301, 'http://krhrimg.oss-cn-beijing.aliyuncs.com/appdownload/production/android/krhr-android.apk'); |
380 | - } | 397 | + } |
381 | } | 398 | } |
382 | 399 | ||
383 | - function softwareLicense (req,res,next) { | 400 | + function softwareLicense(req, res, next) { |
384 | res.render('softwareLicense'); | 401 | res.render('softwareLicense'); |
385 | } | 402 | } |
386 | 403 | ||
387 | - function changePassForRegister(req,res,next){ | ||
388 | - var options={ | ||
389 | - 'baseUrl':'url', | ||
390 | - 'url':'users/'+req.body.user_id, | ||
391 | - 'params':{ | 404 | + function changePassForRegister(req, res, next) { |
405 | + var options = { | ||
406 | + 'baseUrl': 'url', | ||
407 | + 'url': 'users/' + req.body.user_id, | ||
408 | + 'params': { | ||
392 | 'password': req.body.password | 409 | 'password': req.body.password |
393 | }, | 410 | }, |
394 | - 'callback':_cb, | ||
395 | - 'req':req, | ||
396 | - 'res':res, | ||
397 | - 'options':{} | 411 | + 'callback': _cb, |
412 | + 'req': req, | ||
413 | + 'res': res, | ||
414 | + 'options': {} | ||
398 | }; | 415 | }; |
399 | - if(req.body.access_token){ | 416 | + if (req.body.access_token) { |
400 | console.log("@@@!!!!!!!!!!!!!!!!"); | 417 | console.log("@@@!!!!!!!!!!!!!!!!"); |
401 | - options.options={ | ||
402 | - "accessToken":req.body.access_token | 418 | + options.options = { |
419 | + "accessToken": req.body.access_token | ||
403 | }; | 420 | }; |
404 | - options['excludeToken']=true; | ||
405 | - } | 421 | + options['excludeToken'] = true; |
422 | + } | ||
406 | rest.patchJson(options) | 423 | rest.patchJson(options) |
407 | - function _cb(data,response){ | ||
408 | - logger.info("back data:",data); | ||
409 | - res.send(data); | 424 | + function _cb(data, response) { |
425 | + logger.info("back data:", data); | ||
426 | + res.send(data); | ||
410 | }; | 427 | }; |
411 | } | 428 | } |
412 | 429 | ||
413 | - function changeTenant(req,res,next){ | ||
414 | - var params={ | ||
415 | - grant_type:'refresh_token', | ||
416 | - scope:'global_access:tenant_admin,tenant:'+req.body.id, | ||
417 | - refresh_token:req.session.passport.user.refreshToken | ||
418 | - } | ||
419 | - req.session.passport.user.token=''; | ||
420 | - rest.postJson({ | ||
421 | - 'baseUrl':'url', | ||
422 | - 'url':settings.restful.url+'uaa'+settings.restful.version+'/auth/tokens', | ||
423 | - 'useUrl':true, | ||
424 | - 'params':params, | ||
425 | - 'callback':_cb, | ||
426 | - 'req':req, | ||
427 | - 'res':res, | ||
428 | - 'options':{}, | ||
429 | - 'excludeToken':true | 430 | + function changeTenant(req, res, next) { |
431 | + var params = { | ||
432 | + grant_type: 'refresh_token', | ||
433 | + scope: 'global_access:tenant_admin,tenant:' + req.body.id, | ||
434 | + refresh_token: req.session.passport.user.refreshToken | ||
435 | + } | ||
436 | + req.session.passport.user.token = ''; | ||
437 | + rest.postJson({ | ||
438 | + 'baseUrl': 'url', | ||
439 | + 'url': settings.restful.url + 'uaa' + settings.restful.version + '/auth/tokens', | ||
440 | + 'useUrl': true, | ||
441 | + 'params': params, | ||
442 | + 'callback': _cb, | ||
443 | + 'req': req, | ||
444 | + 'res': res, | ||
445 | + 'options': {}, | ||
446 | + 'excludeToken': true | ||
430 | }) | 447 | }) |
431 | - function _cb(data,response){ | ||
432 | - console.log(data); | ||
433 | - logger.info("back data:",data); | ||
434 | - if(response.statusCode<300){ | ||
435 | - req.session.passport.user.token=data.access_token; | ||
436 | - req.session.passport.user.refreshToken=data.refresh_token; | ||
437 | - req.session.passport.user.user_info={ | ||
438 | - 'user':data.user, | ||
439 | - 'perms':[], | ||
440 | - 'tenant':data.tenant, | ||
441 | - 'scope':data.scope, | 448 | + function _cb(data, response) { |
449 | + console.log(data); | ||
450 | + logger.info("back data:", data); | ||
451 | + if (response.statusCode < 300) { | ||
452 | + req.session.passport.user.token = data.access_token; | ||
453 | + req.session.passport.user.refreshToken = data.refresh_token; | ||
454 | + req.session.passport.user.user_info = { | ||
455 | + 'user': data.user, | ||
456 | + 'perms': [], | ||
457 | + 'tenant': data.tenant, | ||
458 | + 'scope': data.scope, | ||
442 | 'oss': req.session.passport.user.user_info.oss | 459 | 'oss': req.session.passport.user.user_info.oss |
443 | - }; | ||
444 | - req.session.save(function(err) { | 460 | + }; |
461 | + req.session.save(function (err) { | ||
445 | rest.get({ | 462 | rest.get({ |
446 | - 'baseUrl':'url', | ||
447 | - 'url': settings.restful.url+'uaa'+settings.restful.version+'/perms/detail', | ||
448 | - 'useUrl':true, | ||
449 | - 'params':{}, | ||
450 | - 'callback':_scb, | ||
451 | - 'req':req, | ||
452 | - 'res':res, | ||
453 | - 'options':{} | ||
454 | - }); | ||
455 | - }) | ||
456 | - }else{ | ||
457 | - res.send({"code":response.statusCode,"message":data.message,initialize_done:"n"}); | ||
458 | - } | 463 | + 'baseUrl': 'url', |
464 | + 'url': settings.restful.url + 'uaa' + settings.restful.version + '/perms/detail', | ||
465 | + 'useUrl': true, | ||
466 | + 'params': {}, | ||
467 | + 'callback': _scb, | ||
468 | + 'req': req, | ||
469 | + 'res': res, | ||
470 | + 'options': {} | ||
471 | + }); | ||
472 | + }) | ||
473 | + } else { | ||
474 | + res.send({ "code": response.statusCode, "message": data.message, initialize_done: "n" }); | ||
475 | + } | ||
459 | }; | 476 | }; |
460 | - function _scb(data1,response){ | ||
461 | - if(response.statusCode<300&&data1.items){ | ||
462 | - req.session.passport.user.user_info.perms=data1.items; | ||
463 | - req.session.save(function(err) { | 477 | + function _scb(data1, response) { |
478 | + if (response.statusCode < 300 && data1.items) { | ||
479 | + req.session.passport.user.user_info.perms = data1.items; | ||
480 | + req.session.save(function (err) { | ||
464 | // res.send({"code":200,"message":"切换租户成功"}); | 481 | // res.send({"code":200,"message":"切换租户成功"}); |
465 | rest.get({ | 482 | rest.get({ |
466 | - 'baseUrl':'url', | ||
467 | - 'url': settings.restful.url+'filemeta'+settings.restful.version+'/config', | ||
468 | - 'useUrl':true, | ||
469 | - 'params':{}, | ||
470 | - 'callback':_scb1, | ||
471 | - 'req':req, | ||
472 | - 'res':res, | ||
473 | - 'options':{} | ||
474 | - }); | ||
475 | - }) | ||
476 | - }else{ | ||
477 | - res.send({"code":response.statusCode,"message":data1.message}); | ||
478 | - } | ||
479 | - } | ||
480 | - function _scb1(data2,response){ | ||
481 | - if(response.statusCode<300&&data2&&data2.bucket){ | ||
482 | - req.session.passport.user.user_info.oss=data2; | ||
483 | - req.session.save(function(err) { | ||
484 | - res.send({"code":200,"message":"切换租户成功"}); | ||
485 | - }); | ||
486 | - }else { | ||
487 | - res.send({"code":200,"message":"切换租户失败"}); | ||
488 | - } | 483 | + 'baseUrl': 'url', |
484 | + 'url': settings.restful.url + 'filemeta' + settings.restful.version + '/config', | ||
485 | + 'useUrl': true, | ||
486 | + 'params': {}, | ||
487 | + 'callback': _scb1, | ||
488 | + 'req': req, | ||
489 | + 'res': res, | ||
490 | + 'options': {} | ||
491 | + }); | ||
492 | + }) | ||
493 | + } else { | ||
494 | + res.send({ "code": response.statusCode, "message": data1.message }); | ||
495 | + } | ||
496 | + } | ||
497 | + function _scb1(data2, response) { | ||
498 | + if (response.statusCode < 300 && data2 && data2.bucket) { | ||
499 | + req.session.passport.user.user_info.oss = data2; | ||
500 | + req.session.save(function (err) { | ||
501 | + res.send({ "code": 200, "message": "切换租户成功" }); | ||
502 | + }); | ||
503 | + } else { | ||
504 | + res.send({ "code": 200, "message": "切换租户失败" }); | ||
505 | + } | ||
489 | } | 506 | } |
490 | } | 507 | } |
491 | 508 | ||
492 | 509 | ||
493 | - function sendRejectOffer(req,res){ | ||
494 | - rest.get({ | ||
495 | - 'baseUrl':'hrUrl', | ||
496 | - 'url':req.body.url, //传一个参数 | ||
497 | - 'params':{}, | ||
498 | - 'callback':_cb, | ||
499 | - 'req':req, | ||
500 | - 'res':res, | ||
501 | - 'options':{}, | ||
502 | - 'excludeToken':true, | ||
503 | - 'useUrl':true | 510 | + function sendRejectOffer(req, res) { |
511 | + rest.get({ | ||
512 | + 'baseUrl': 'hrUrl', | ||
513 | + 'url': req.body.url, //传一个参数 | ||
514 | + 'params': {}, | ||
515 | + 'callback': _cb, | ||
516 | + 'req': req, | ||
517 | + 'res': res, | ||
518 | + 'options': {}, | ||
519 | + 'excludeToken': true, | ||
520 | + 'useUrl': true | ||
504 | }); | 521 | }); |
505 | - function _cb(data,response){ | ||
506 | - logger.info("back data:",data); | ||
507 | - if(response.statusCode<300){ | ||
508 | - res.send({'action':'ok'}); | ||
509 | - }else{ | 522 | + function _cb(data, response) { |
523 | + logger.info("back data:", data); | ||
524 | + if (response.statusCode < 300) { | ||
525 | + res.send({ 'action': 'ok' }); | ||
526 | + } else { | ||
510 | res.send(data); | 527 | res.send(data); |
511 | - } | 528 | + } |
512 | }; | 529 | }; |
513 | - } | ||
514 | - | ||
515 | - function acceptOffer(req,res){ | ||
516 | - rest.get({ | ||
517 | - 'baseUrl':'hrUrl', | ||
518 | - 'url':req.body.url, //传一个参数 | ||
519 | - 'params':{}, | ||
520 | - 'callback':_cb, | ||
521 | - 'req':req, | ||
522 | - 'res':res, | ||
523 | - 'options':{}, | ||
524 | - 'excludeToken':true, | ||
525 | - 'useUrl':true | 530 | + } |
531 | + | ||
532 | + function acceptOffer(req, res) { | ||
533 | + rest.get({ | ||
534 | + 'baseUrl': 'hrUrl', | ||
535 | + 'url': req.body.url, //传一个参数 | ||
536 | + 'params': {}, | ||
537 | + 'callback': _cb, | ||
538 | + 'req': req, | ||
539 | + 'res': res, | ||
540 | + 'options': {}, | ||
541 | + 'excludeToken': true, | ||
542 | + 'useUrl': true | ||
526 | }); | 543 | }); |
527 | - function _cb(data,response){ | ||
528 | - logger.info("back data:",data); | ||
529 | - if(response.statusCode<300){ | ||
530 | - res.send({'action':'ok'}); | ||
531 | - }else{ | 544 | + function _cb(data, response) { |
545 | + logger.info("back data:", data); | ||
546 | + if (response.statusCode < 300) { | ||
547 | + res.send({ 'action': 'ok' }); | ||
548 | + } else { | ||
532 | res.send(data); | 549 | res.send(data); |
533 | - } | 550 | + } |
534 | }; | 551 | }; |
535 | } | 552 | } |
536 | 553 | ||
537 | - function imTokens(req,res){ | ||
538 | - rest.post({ | ||
539 | - 'url':'auth/im_tokens', | ||
540 | - 'params':req.body, | ||
541 | - 'callback':_cb, | ||
542 | - 'req':req, | ||
543 | - 'res':res, | ||
544 | - 'options':{} | 554 | + function imTokens(req, res) { |
555 | + rest.post({ | ||
556 | + 'url': 'auth/im_tokens', | ||
557 | + 'params': req.body, | ||
558 | + 'callback': _cb, | ||
559 | + 'req': req, | ||
560 | + 'res': res, | ||
561 | + 'options': {} | ||
545 | }); | 562 | }); |
546 | - function _cb(data,response){ | ||
547 | - logger.info("back data:",data); | ||
548 | - res.send(data); | 563 | + function _cb(data, response) { |
564 | + logger.info("back data:", data); | ||
565 | + res.send(data); | ||
549 | }; | 566 | }; |
550 | } | 567 | } |
551 | 568 | ||
552 | - function listChannels(req,res,next){ | ||
553 | - rest.get({ | ||
554 | - 'baseUrl':'chatUrl', | ||
555 | - 'url':'channels?page_size=10&page=0&status=active', | ||
556 | - 'params':req.body, | ||
557 | - 'callback':_cb, | ||
558 | - 'req':req, | ||
559 | - 'res':res, | ||
560 | - 'options':{} | 569 | + function listChannels(req, res, next) { |
570 | + rest.get({ | ||
571 | + 'baseUrl': 'chatUrl', | ||
572 | + 'url': 'channels?page_size=10&page=0&status=active', | ||
573 | + 'params': req.body, | ||
574 | + 'callback': _cb, | ||
575 | + 'req': req, | ||
576 | + 'res': res, | ||
577 | + 'options': {} | ||
561 | }) | 578 | }) |
562 | - function _cb(data,response){ | ||
563 | - logger.info("back data:",data); | ||
564 | - res.send(data); | 579 | + function _cb(data, response) { |
580 | + logger.info("back data:", data); | ||
581 | + res.send(data); | ||
565 | }; | 582 | }; |
566 | } | 583 | } |
567 | 584 | ||
568 | - function filemeta(req,res,next){ | ||
569 | - var fullPath=settings.restful.url+'filemeta'+settings.restful.version+'/object-redirect'; | ||
570 | - fullPath=fullPath+"?"+"bucket="+req.query.bucket+"&object="+encodeURIComponent(req.query.object); | ||
571 | - var options={ | ||
572 | - 'service_catalog':'', | ||
573 | - 'url':fullPath, | ||
574 | - 'useUrl':true, | ||
575 | - 'params':req.body, | ||
576 | - 'callback':_cb, | ||
577 | - 'req':req, | ||
578 | - 'res':res, | ||
579 | - 'options':{} | 585 | + function filemeta(req, res, next) { |
586 | + var fullPath = settings.restful.url + 'filemeta' + settings.restful.version + '/object-redirect'; | ||
587 | + fullPath = fullPath + "?" + "bucket=" + req.query.bucket + "&object=" + encodeURIComponent(req.query.object); | ||
588 | + var options = { | ||
589 | + 'service_catalog': '', | ||
590 | + 'url': fullPath, | ||
591 | + 'useUrl': true, | ||
592 | + 'params': req.body, | ||
593 | + 'callback': _cb, | ||
594 | + 'req': req, | ||
595 | + 'res': res, | ||
596 | + 'options': {} | ||
580 | }; | 597 | }; |
581 | - rest.get(options); | ||
582 | - function _cb(data,response){ | ||
583 | - if(data&&data.download_url){ | ||
584 | - if(req.query.type&&'json'==req.query.type){ | 598 | + rest.get(options); |
599 | + function _cb(data, response) { | ||
600 | + if (data && data.download_url) { | ||
601 | + if (req.query.type && 'json' == req.query.type) { | ||
585 | res.send(data); | 602 | res.send(data); |
586 | - }else{ | ||
587 | - res.redirect(301, data.download_url); | 603 | + } else { |
604 | + res.redirect(301, data.download_url); | ||
588 | } | 605 | } |
589 | - }else { | 606 | + } else { |
590 | res.send(data); | 607 | res.send(data); |
591 | - } | ||
592 | - } | ||
593 | - } | ||
594 | - | ||
595 | - | ||
596 | - function getCustomerQrcode(req,res,next){ | ||
597 | - var fullPath=settings.restful.url+'crm'+settings.restful.version+'/customers/'+req.query.id+'/qrcode'; | ||
598 | - var options={ | ||
599 | - 'service_catalog':'', | ||
600 | - 'url':fullPath, | ||
601 | - 'useUrl':true, | ||
602 | - 'params':req.body, | ||
603 | - 'callback':_cb, | ||
604 | - 'req':req, | ||
605 | - 'res':res, | ||
606 | - 'options':{} | 608 | + } |
609 | + } | ||
610 | + } | ||
611 | + | ||
612 | + | ||
613 | + function getCustomerQrcode(req, res, next) { | ||
614 | + var fullPath = settings.restful.url + 'crm' + settings.restful.version + '/customers/' + req.query.id + '/qrcode'; | ||
615 | + var options = { | ||
616 | + 'service_catalog': '', | ||
617 | + 'url': fullPath, | ||
618 | + 'useUrl': true, | ||
619 | + 'params': req.body, | ||
620 | + 'callback': _cb, | ||
621 | + 'req': req, | ||
622 | + 'res': res, | ||
623 | + 'options': {} | ||
607 | }; | 624 | }; |
608 | - rest.get(options); | ||
609 | - function _cb(data,response){ | ||
610 | - if(data&&data.url_path){ | ||
611 | - res.redirect(301, data.url_path); | ||
612 | - }else { | 625 | + rest.get(options); |
626 | + function _cb(data, response) { | ||
627 | + if (data && data.url_path) { | ||
628 | + res.redirect(301, data.url_path); | ||
629 | + } else { | ||
613 | res.send(data); | 630 | res.send(data); |
614 | - } | ||
615 | - } | ||
616 | - } | ||
617 | - | ||
618 | - function getPositionQrcode(req,res,next){ | ||
619 | - var fullPath=settings.restful.url+'recruit'+settings.restful.version+'/positions/'+req.query.id+'/qrcode'; | ||
620 | - var options={ | ||
621 | - 'service_catalog':'', | ||
622 | - 'url':fullPath, | ||
623 | - 'useUrl':true, | ||
624 | - 'params':req.body, | ||
625 | - 'callback':_cb, | ||
626 | - 'req':req, | ||
627 | - 'res':res, | ||
628 | - 'options':{} | 631 | + } |
632 | + } | ||
633 | + } | ||
634 | + | ||
635 | + function getPositionQrcode(req, res, next) { | ||
636 | + var fullPath = settings.restful.url + 'recruit' + settings.restful.version + '/positions/' + req.query.id + '/qrcode'; | ||
637 | + var options = { | ||
638 | + 'service_catalog': '', | ||
639 | + 'url': fullPath, | ||
640 | + 'useUrl': true, | ||
641 | + 'params': req.body, | ||
642 | + 'callback': _cb, | ||
643 | + 'req': req, | ||
644 | + 'res': res, | ||
645 | + 'options': {} | ||
629 | }; | 646 | }; |
630 | - rest.get(options); | ||
631 | - function _cb(data,response){ | ||
632 | - if(data&&data.url_path){ | ||
633 | - res.redirect(301, data.url_path); | ||
634 | - }else { | 647 | + rest.get(options); |
648 | + function _cb(data, response) { | ||
649 | + if (data && data.url_path) { | ||
650 | + res.redirect(301, data.url_path); | ||
651 | + } else { | ||
635 | res.send(data); | 652 | res.send(data); |
636 | - } | 653 | + } |
637 | } | 654 | } |
638 | } | 655 | } |
639 | 656 | ||
640 | - function getOSSConfig(req,res,next){ | ||
641 | - var fullPath=settings.restful.url+'filemeta'+settings.restful.version+'/config'; | ||
642 | - var options={ | ||
643 | - 'service_catalog':'', | ||
644 | - 'url':fullPath, | ||
645 | - 'useUrl':true, | ||
646 | - 'params':req.body, | ||
647 | - 'callback':_cb, | ||
648 | - 'req':req, | ||
649 | - 'res':res, | ||
650 | - 'options':{} | 657 | + function getOSSConfig(req, res, next) { |
658 | + var fullPath = settings.restful.url + 'filemeta' + settings.restful.version + '/config'; | ||
659 | + var options = { | ||
660 | + 'service_catalog': '', | ||
661 | + 'url': fullPath, | ||
662 | + 'useUrl': true, | ||
663 | + 'params': req.body, | ||
664 | + 'callback': _cb, | ||
665 | + 'req': req, | ||
666 | + 'res': res, | ||
667 | + 'options': {} | ||
651 | }; | 668 | }; |
652 | - rest.get(options); | ||
653 | - function _cb(data,response){ | ||
654 | - if(data&&data.bucket){ | ||
655 | - req.session.passport.user.user_info.oss=data; | ||
656 | - req.session.save(function(err) { | ||
657 | - res.send({"code":200,"message":"oss配置加载成功"}); | ||
658 | - }); | ||
659 | - }else { | ||
660 | - res.send({"code":200,"message":"oss配置加载失败"}); | ||
661 | - } | ||
662 | - } | ||
663 | - } | ||
664 | - | ||
665 | - function weidianTempLate(req,res,next){ | 669 | + rest.get(options); |
670 | + function _cb(data, response) { | ||
671 | + if (data && data.bucket) { | ||
672 | + req.session.passport.user.user_info.oss = data; | ||
673 | + req.session.save(function (err) { | ||
674 | + res.send({ "code": 200, "message": "oss配置加载成功" }); | ||
675 | + }); | ||
676 | + } else { | ||
677 | + res.send({ "code": 200, "message": "oss配置加载失败" }); | ||
678 | + } | ||
679 | + } | ||
680 | + } | ||
681 | + | ||
682 | + function weidianTempLate(req, res, next) { | ||
666 | const { params } = req; | 683 | const { params } = req; |
667 | - var fullPath=settings.restful.url + 'socialwork/internal/minishop/' + params.id; | ||
668 | - var options={ | ||
669 | - 'service_catalog':'', | ||
670 | - 'url':fullPath, | ||
671 | - 'useUrl':true, | ||
672 | - 'params':req.body, | ||
673 | - 'callback':_cb, | ||
674 | - 'req':req, | ||
675 | - 'res':res, | ||
676 | - 'options':{}, | ||
677 | - 'excludeToken':true, | 684 | + var fullPath = settings.restful.url + 'socialwork/internal/minishop/' + params.id; |
685 | + var options = { | ||
686 | + 'service_catalog': '', | ||
687 | + 'url': fullPath, | ||
688 | + 'useUrl': true, | ||
689 | + 'params': req.body, | ||
690 | + 'callback': _cb, | ||
691 | + 'req': req, | ||
692 | + 'res': res, | ||
693 | + 'options': {}, | ||
694 | + 'excludeToken': true, | ||
678 | }; | 695 | }; |
679 | - rest.get(options); | ||
680 | - function _cb(data,response){ | ||
681 | - logger.info("back data:",data); | ||
682 | - if(response.statusCode<300){ | ||
683 | - const { shop_logo=[], shop_name='', shop_comment='' } = data; | ||
684 | - let imgUrl = ''; | ||
685 | - if (shop_logo.length > 0) { | ||
686 | - imgUrl = 'http://oss.workai.com.cn/public/' + shop_logo[0].object; | ||
687 | - } | ||
688 | - res.render('template/weiDian',{ | ||
689 | - imgUrl: imgUrl, | ||
690 | - shop_name: shop_name, | ||
691 | - shop_comment: shop_comment, | ||
692 | - }) | ||
693 | - }else{ | ||
694 | - res.render('template/weiDian') | ||
695 | - } | 696 | + rest.get(options); |
697 | + function _cb(data, response) { | ||
698 | + logger.info("back data:", data); | ||
699 | + if (response.statusCode < 300) { | ||
700 | + const { shop_logo = [], shop_name = '', shop_comment = '' } = data; | ||
701 | + let imgUrl = ''; | ||
702 | + if (shop_logo.length > 0) { | ||
703 | + imgUrl = 'http://oss.workai.com.cn/public/' + shop_logo[0].object; | ||
704 | + } | ||
705 | + res.render('template/weiDian', { | ||
706 | + imgUrl: imgUrl, | ||
707 | + shop_name: shop_name, | ||
708 | + shop_comment: shop_comment, | ||
709 | + }) | ||
710 | + } else { | ||
711 | + res.render('template/weiDian') | ||
712 | + } | ||
696 | }; | 713 | }; |
697 | - | 714 | + |
715 | + } | ||
716 | + | ||
717 | + | ||
718 | + function workaiSecurityOAuth(req, res, next) { | ||
719 | + var params = req.query; | ||
720 | + if (params.authorization_code) { | ||
721 | + var passport = { | ||
722 | + user: { | ||
723 | + refreshToken: "", | ||
724 | + token: "", | ||
725 | + service_catalog: {}, | ||
726 | + user_info: {}, | ||
727 | + err: null | ||
728 | + } | ||
729 | + }; | ||
730 | + async.waterfall([ | ||
731 | + function (callback) {//第三方登录 | ||
732 | + var tempParams = { | ||
733 | + "grant_type": 'authorization_code_v1', | ||
734 | + "code": params.authorization_code | ||
735 | + }; | ||
736 | + // var tempParams={ | ||
737 | + // "grant_type":"password", | ||
738 | + // "username":"18510929499", | ||
739 | + // "scope":"global_access:tenant_admin", | ||
740 | + // "password":"a123456" | ||
741 | + // }; | ||
742 | + rest.restful.postJson(settings.restful.url + 'uaa/v1/auth/tokens', tempParams, { | ||
743 | + headers: { 'Content-Type': 'application/json', "Accept": "application/json" } | ||
744 | + }) | ||
745 | + .on('success', function (data, response) { | ||
746 | + logger.info("Third login json:", data); | ||
747 | + if (data.access_token) { | ||
748 | + var scopes = data.scope.split(","); | ||
749 | + passport.user.token = data.access_token; | ||
750 | + passport.user.refreshToken = data.refresh_token; | ||
751 | + passport.user.user_info = data.user; | ||
752 | + passport.user.tenant_info = data.tenant; | ||
753 | + passport.user.customer_info = data.customer; | ||
754 | + passport.user.user_info.perms = data.perms; | ||
755 | + passport.user.type = data.user.type; | ||
756 | + passport.user.real_auth_status = data.user.real_auth_status; | ||
757 | + passport.user.credential_status = data.user.credential_status; | ||
758 | + passport.user.user_info.scope = scopes[0]; | ||
759 | + callback(null, data) | ||
760 | + } else { | ||
761 | + var err = new Error('Third login err'); | ||
762 | + passport.user.err = data.message; | ||
763 | + callback(err, data); | ||
764 | + } | ||
765 | + }).on('error', function (err, response) { | ||
766 | + logger.error("Third login error", err); | ||
767 | + var err = new Error('Third login err'); | ||
768 | + callback(err, response); | ||
769 | + }).on('fail', function (data, response) { | ||
770 | + logger.error("Third login fail", data); | ||
771 | + var err = new Error('Third login err'); | ||
772 | + callback(data, response); | ||
773 | + }); | ||
774 | + }, function (data, callback) { //获取机构列表 | ||
775 | + var tempHead = {}; | ||
776 | + var ip = req.ip.match(/\d+\.\d+\.\d+\.\d+/)[0]; | ||
777 | + var user_agent = req.headers['user-agent'] || ''; | ||
778 | + tempHead['SXClientIP'] = ip; | ||
779 | + tempHead['User-Agent'] = user_agent; | ||
780 | + rest.restful.get(settings.restful.url + 'uaa/v1/tenants?all=true', { accessToken: data.access_token, headers: tempHead }) | ||
781 | + .on('success', function (data1, response) { | ||
782 | + logger.info("Third login tenants list:", data1); | ||
783 | + if (data1 && data1.items && data1.items.length > 0) { | ||
784 | + callback(null, data1.items) | ||
785 | + } else { | ||
786 | + var err = new Error('Third login tenants list err'); | ||
787 | + passport.user.err = data.message; | ||
788 | + callback(err, data); | ||
789 | + } | ||
790 | + }).on('error', function (err, response) { | ||
791 | + var err = new Error('Third login tenants list err'); | ||
792 | + callback(err, response); | ||
793 | + }).on('fail', function (data, response) { | ||
794 | + var err = new Error('Third login tenants list fail'); | ||
795 | + callback(data, response); | ||
796 | + }); | ||
797 | + }, function (data, callback) { //刷新token | ||
798 | + if (data && data.length == 1) { | ||
799 | + var params = { | ||
800 | + grant_type: 'refresh_token', | ||
801 | + scope: 'global_access:tenant_admin,tenant:' + data[0].id, | ||
802 | + refresh_token: passport.user.refreshToken | ||
803 | + } | ||
804 | + passport.user.token = ''; | ||
805 | + rest.restful.postJson(settings.restful.url + 'uaa/v1/auth/tokens', params, { | ||
806 | + headers: { 'Content-Type': 'application/json', "Accept": "application/json" } | ||
807 | + }) | ||
808 | + .on('success', function (data2, response) { | ||
809 | + logger.info("Third login json:", data2); | ||
810 | + if (data2.access_token) { | ||
811 | + var scopes = data2.scope.split(","); | ||
812 | + passport.user.token = data2.access_token; | ||
813 | + passport.user.refreshToken = data2.refresh_token; | ||
814 | + passport.user.user_info = data2.user; | ||
815 | + passport.user.tenant_info = data2.tenant; | ||
816 | + passport.user.customer_info = data2.customer; | ||
817 | + passport.user.user_info.perms = data2.perms; | ||
818 | + passport.user.type = data2.user.type; | ||
819 | + passport.user.real_auth_status = data2.user.real_auth_status; | ||
820 | + passport.user.credential_status = data2.user.credential_status; | ||
821 | + passport.user.user_info.scope = scopes[0]; | ||
822 | + callback(null, data2) | ||
823 | + } else { | ||
824 | + var err = new Error('Third login err'); | ||
825 | + passport.user.err = data2.message; | ||
826 | + callback(err, data2); | ||
827 | + } | ||
828 | + }).on('error', function (err, response) { | ||
829 | + logger.error("Third login error", err); | ||
830 | + var err = new Error('Third login err'); | ||
831 | + callback(err, response); | ||
832 | + }).on('fail', function (data2, response) { | ||
833 | + logger.error("Third login fail", data2); | ||
834 | + var err = new Error('Third login err'); | ||
835 | + callback(data2, response); | ||
836 | + }); | ||
837 | + } else if (data && data.length > 1) {// #/login/choose-tenant | ||
838 | + callback(null, data) | ||
839 | + } else { | ||
840 | + var err = new Error('Third login tenants list item error'); | ||
841 | + callback(err, data); | ||
842 | + } | ||
843 | + }], function (err, result) { | ||
844 | + if (err) {//登陆失败跳转失败页 | ||
845 | + res.render('loginerr', { 'err': err }); | ||
846 | + } else if (result instanceof Array && result.length > 1) {//登陆成功跳转选择机构页 | ||
847 | + req.session.passport = passport; | ||
848 | + req.session.save(function (err) { | ||
849 | + res.redirect(301, '/#login/choose-tenant'); | ||
850 | + }); | ||
851 | + } else { | ||
852 | + req.session.passport = passport; | ||
853 | + req.session.save(function (err) { | ||
854 | + res.redirect(301, '/#container/home'); //登陆成功跳转首页 | ||
855 | + }); | ||
856 | + } | ||
857 | + }); | ||
858 | + } | ||
859 | + | ||
860 | + } | ||
861 | + | ||
862 | + function getTastLink(req, res, next) { | ||
863 | + var url = crypto.createHash('md5').update(req.body.id).digest('hex'); | ||
864 | + if (settings.prefix && settings.prefix.length > 1) { | ||
865 | + res.send(req.protocol + '://' + req.get('host') + settings.prefix.substring(0, settings.prefix.length - 1) + "/socialwork/freedom-jobs/emps/" + req.body.id + "/" + url); | ||
866 | + } else { | ||
867 | + res.send({ 'url': req.protocol + '://' + req.get('host') + "/socialwork/freedom-jobs/emps/" + req.body.id + "/" + url }); | ||
868 | + } | ||
869 | + } | ||
870 | + | ||
871 | + function freedomJobsEmp(req, res, next) { | ||
872 | + var id = req.params.id; | ||
873 | + var verification = req.params.verification; | ||
874 | + var url = crypto.createHash('md5').update(id).digest('hex'); | ||
875 | + if (verification != url) {//验证未通过 | ||
876 | + if (settings.prefix && settings.prefix.length > 1) { | ||
877 | + res.redirect(settings.prefix.substring(0, settings.prefix.length - 1)); | ||
878 | + } else { | ||
879 | + res.redirect('/'); | ||
880 | + } | ||
881 | + } else {//验证通过跳转,获取token存到session里 | ||
882 | + var passport = { | ||
883 | + user: { | ||
884 | + refreshToken: "", | ||
885 | + token: "", | ||
886 | + service_catalog: {}, | ||
887 | + user_info: {}, | ||
888 | + err: null | ||
889 | + } | ||
890 | + }; | ||
891 | + var tempParams = { | ||
892 | + "grant_type": "client_credential", | ||
893 | + "client_id": "340161778618994688",//多宝鱼环境 | ||
894 | + "client_secret": "0f8c30aa3d15332652f62c3eaf22fdea" | ||
895 | + }; | ||
896 | + rest.restful.postJson(settings.restful.url + 'uaa/v1/auth/tokens', tempParams, { | ||
897 | + headers: { 'Content-Type': 'application/json', "Accept": "application/json" } | ||
898 | + }).on('success', function (data, response) { | ||
899 | + if (data.access_token) { | ||
900 | + var scopes = data.scope.split(","); | ||
901 | + passport.user.token = data.access_token; | ||
902 | + passport.user.refreshToken = data.refresh_token; | ||
903 | + passport.user.user_info = data.user; | ||
904 | + passport.user.tenant_info = data.tenant; | ||
905 | + passport.user.customer_info = data.customer; | ||
906 | + passport.user.user_info.perms = data.perms; | ||
907 | + passport.user.type = data.user.type; | ||
908 | + passport.user.real_auth_status = data.user.real_auth_status; | ||
909 | + passport.user.credential_status = data.user.credential_status; | ||
910 | + passport.user.user_info.scope = scopes[0]; | ||
911 | + req.session.passport = passport; | ||
912 | + req.session.save(function (err) { | ||
913 | + if (settings.prefix && settings.prefix.length > 1) { | ||
914 | + res.redirect(301, settings.prefix.substring(0, settings.prefix.length - 1) + '/#task_assign/' + id); | ||
915 | + } else { | ||
916 | + res.redirect(301, '/#task_assign/' + id); | ||
917 | + } | ||
918 | + }); | ||
919 | + } else { | ||
920 | + var err = new Error('Third login err'); | ||
921 | + passport.user.err = data.message; | ||
922 | + } | ||
923 | + }).on('error', function (err, response) { | ||
924 | + logger.error("Third login error", err); | ||
925 | + var err = new Error('Third login err'); | ||
926 | + callback(err, response); | ||
927 | + }).on('fail', function (data, response) { | ||
928 | + logger.error("Third login fail", data); | ||
929 | + var err = new Error('Third login err'); | ||
930 | + }); | ||
931 | + } | ||
932 | + | ||
698 | } | 933 | } |
699 | 934 | ||
700 | return { | 935 | return { |
701 | - index:index, | ||
702 | - register:register, | ||
703 | - signIn:signIn, | ||
704 | - doLogin:doLogin, | ||
705 | - signOut:signOut, | ||
706 | - smsCodes:smsCodes, | ||
707 | - tenants:tenants, | ||
708 | - productDes:productDes, | ||
709 | - resetPass:resetPass, | ||
710 | - updatePassword:updatePassword, | ||
711 | - loadUserInfo:loadUserInfo, | ||
712 | - getUploaderToken:getUploaderToken, | 936 | + index: index, |
937 | + indexPrefix, | ||
938 | + register: register, | ||
939 | + signIn: signIn, | ||
940 | + doLogin: doLogin, | ||
941 | + signOut: signOut, | ||
942 | + smsCodes: smsCodes, | ||
943 | + tenants: tenants, | ||
944 | + productDes: productDes, | ||
945 | + resetPass: resetPass, | ||
946 | + updatePassword: updatePassword, | ||
947 | + loadUserInfo: loadUserInfo, | ||
948 | + getUploaderToken: getUploaderToken, | ||
713 | getObjectTokenByID, | 949 | getObjectTokenByID, |
714 | - delOSSObject:delOSSObject, | 950 | + delOSSObject: delOSSObject, |
715 | healthMonitor, | 951 | healthMonitor, |
716 | smsVerification, | 952 | smsVerification, |
717 | updateUserRoles, | 953 | updateUserRoles, |
@@ -736,9 +972,12 @@ exports=module.exports=function(logger,rest,settings){ | @@ -736,9 +972,12 @@ exports=module.exports=function(logger,rest,settings){ | ||
736 | getCustomerQrcode, | 972 | getCustomerQrcode, |
737 | getPositionQrcode, | 973 | getPositionQrcode, |
738 | getOSSConfig, | 974 | getOSSConfig, |
739 | - weidianTempLate | 975 | + weidianTempLate, |
976 | + workaiSecurityOAuth, | ||
977 | + getTastLink, | ||
978 | + freedomJobsEmp | ||
740 | }; | 979 | }; |
741 | }; | 980 | }; |
742 | 981 | ||
743 | -exports['@singleton']=true; | ||
744 | -exports['@require']=['igloo/logger','utils/rest','igloo/settings']; | 982 | +exports['@singleton'] = true; |
983 | +exports['@require'] = ['igloo/logger', 'utils/rest', 'igloo/settings']; |
server/controllers/authed.js
已删除
100644 → 0
1 | -var urlencode = require('urlencode'); | ||
2 | -var passport = require('passport'); | ||
3 | - | ||
4 | -exports=module.exports=function(logger,rest,settings){ | ||
5 | - function encodeUrl(url){ | ||
6 | - return urlencode(url); | ||
7 | - } | ||
8 | - | ||
9 | - function encodePamars(params){ | ||
10 | - var temp=[]; | ||
11 | - for(var i=0;i<params.length;i++){ | ||
12 | - var param=params[i]; | ||
13 | - var tempParam=param.split("=") | ||
14 | - tempParam[1]=urlencode.decode(tempParam[1], 'utf8'); | ||
15 | - tempParam[1]=tempParam[1].replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); | ||
16 | - console.log(tempParam[1]); | ||
17 | - if(i<(params.length-1)){ | ||
18 | - if(/[:&+/?%#=]/g.test(tempParam[1])){ | ||
19 | - temp.push(tempParam[0]+"="+encodeUrl(tempParam[1])+"&"); | ||
20 | - }else{ | ||
21 | - temp.push(tempParam[0]+"="+tempParam[1]+"&"); | ||
22 | - } | ||
23 | - }else{ | ||
24 | - if(/[:&+/?%#=]/g.test(tempParam[1])){ | ||
25 | - temp.push(tempParam[0]+"="+encodeUrl(tempParam[1])); | ||
26 | - }else{ | ||
27 | - temp.push(tempParam[0]+"="+tempParam[1]); | ||
28 | - } | ||
29 | - } | ||
30 | - } | ||
31 | - return temp.join(""); | ||
32 | - } | ||
33 | - | ||
34 | - function handlePamars(url){ | ||
35 | - var tempUrl=url; | ||
36 | - // if(url.indexOf("?")!=-1){ | ||
37 | - // var temp=url.split("?"); | ||
38 | - // var params=""; | ||
39 | - // if(temp[1]&&temp[1].indexOf("&")!=-1){ | ||
40 | - // params=encodePamars(temp[1].split("&")); | ||
41 | - // }else{ | ||
42 | - // params=encodePamars([temp[1]]); | ||
43 | - // } | ||
44 | - // return temp[0]+"?"+params; | ||
45 | - // }else { | ||
46 | - // return tempUrl; | ||
47 | - // } | ||
48 | - return tempUrl; | ||
49 | - } | ||
50 | - | ||
51 | - function splitServiceFromUrl(url){ | ||
52 | - var catalog=url.substring(1,url.indexOf('/',1)); | ||
53 | - var pathUrl=url.substring(url.indexOf('/',1)); | ||
54 | - var fullPath=settings.restful.url+catalog+settings.restful.version+pathUrl; | ||
55 | - return fullPath | ||
56 | - } | ||
57 | - | ||
58 | - function splitUrl(fullUrl){ | ||
59 | - var url=fullUrl.substring(9); | ||
60 | - return url; | ||
61 | - } | ||
62 | - | ||
63 | - function searchService(services,name){ | ||
64 | - if(services[name]){ | ||
65 | - console.log(services[name]); | ||
66 | - return false; | ||
67 | - }else{ | ||
68 | - return true; | ||
69 | - } | ||
70 | - } | ||
71 | - | ||
72 | - function checkReq(req,res){ | ||
73 | - var flag=true; | ||
74 | - // if(flag&&req.headers&&!req.headers['service-catalog']){ | ||
75 | - // res.status(400); | ||
76 | - // res.send({"errors":{},"message":"缺少必要请求参数,服务目录名称是必填项"}); | ||
77 | - // flag=false; | ||
78 | - // } | ||
79 | - // if(flag&&req.session.passport&&req.session.passport.user&&!req.session.passport.user.service_catalog){ | ||
80 | - // res.status(404); | ||
81 | - // res.send({"errors":{},"message":"服务目录未加载,请重新登录"}); | ||
82 | - // flag=false; | ||
83 | - // } | ||
84 | - // if(flag&&searchService(req.session.passport.user.service_catalog,req.headers['service-catalog'])){ | ||
85 | - // res.status(404); | ||
86 | - // res.send({"errors":{},"message":"服务目录未查询到请求服务,请确认参数正确"}); | ||
87 | - // flag=false; | ||
88 | - // } | ||
89 | - return flag; | ||
90 | - } | ||
91 | - | ||
92 | - function checkJson(req){ | ||
93 | - if(req.headers&&req.headers['content-type']=='application/json'){ | ||
94 | - return true; | ||
95 | - }else{ | ||
96 | - return false; | ||
97 | - } | ||
98 | - } | ||
99 | - | ||
100 | - function get(req,res,next){ | ||
101 | - var url=splitUrl(req.originalUrl); | ||
102 | - url=handlePamars(url); | ||
103 | - url=splitServiceFromUrl(url); | ||
104 | - if(checkReq(req,res)){ | ||
105 | - var options={ | ||
106 | - 'service_catalog':'', | ||
107 | - 'url': url, | ||
108 | - 'useUrl':true, | ||
109 | - 'params':req.body, | ||
110 | - 'callback':_cb, | ||
111 | - 'req':req, | ||
112 | - 'res':res, | ||
113 | - 'options':{}, | ||
114 | - 'excludeToken':true | ||
115 | - }; | ||
116 | - // if(checkJson(req)){ | ||
117 | - // rest.json(options); | ||
118 | - // }else{ | ||
119 | - // rest.get(options); | ||
120 | - // } | ||
121 | - rest.get(options); | ||
122 | - } | ||
123 | - function _cb(data,response){ | ||
124 | - logger.info('back data:',data); | ||
125 | - if(response.statusCode<300&&!data){ | ||
126 | - res.send({ | ||
127 | - code:200, | ||
128 | - message:'操作成功!' | ||
129 | - }); | ||
130 | - }else { | ||
131 | - res.send(data); | ||
132 | - } | ||
133 | - } | ||
134 | - } | ||
135 | - | ||
136 | - function post(req,res,next){ | ||
137 | - var url=splitUrl(req.originalUrl); | ||
138 | - url=splitServiceFromUrl(url); | ||
139 | - if(checkReq(req,res)){ | ||
140 | - var options={ | ||
141 | - 'service_catalog':'', | ||
142 | - 'url': url, | ||
143 | - 'useUrl':true, | ||
144 | - 'params':req.body, | ||
145 | - 'callback':_cb, | ||
146 | - 'req':req, | ||
147 | - 'res':res, | ||
148 | - 'options':{}, | ||
149 | - 'excludeToken':true | ||
150 | - }; | ||
151 | - if(checkJson(req)){ | ||
152 | - rest.postJson(options); | ||
153 | - }else{ | ||
154 | - rest.post(options); | ||
155 | - } | ||
156 | - } | ||
157 | - function _cb(data,response){ | ||
158 | - logger.info('back data:',data); | ||
159 | - if(response.statusCode<300&&!data){ | ||
160 | - res.send({ | ||
161 | - code:200, | ||
162 | - message:'操作成功!' | ||
163 | - }); | ||
164 | - }else{ | ||
165 | - res.send(data); | ||
166 | - } | ||
167 | - } | ||
168 | - } | ||
169 | - | ||
170 | - function put(req,res,next){ | ||
171 | - var url=splitUrl(req.originalUrl); | ||
172 | - url=splitServiceFromUrl(url); | ||
173 | - if(checkReq(req,res)){ | ||
174 | - var options={ | ||
175 | - 'service_catalog':'', | ||
176 | - 'url':url, | ||
177 | - 'useUrl':true, | ||
178 | - 'params':req.body, | ||
179 | - 'callback':_cb, | ||
180 | - 'req':req, | ||
181 | - 'res':res, | ||
182 | - 'options':{}, | ||
183 | - 'excludeToken':true | ||
184 | - }; | ||
185 | - if(checkJson(req)){ | ||
186 | - rest.putJson(options); | ||
187 | - }else{ | ||
188 | - rest.put(options); | ||
189 | - } | ||
190 | - } | ||
191 | - function _cb(data,response){ | ||
192 | - logger.info('back data:',data); | ||
193 | - if(response.statusCode<300&&!data){ | ||
194 | - res.send({ | ||
195 | - code:200, | ||
196 | - message:'操作成功!' | ||
197 | - }); | ||
198 | - }else{ | ||
199 | - res.send(data); | ||
200 | - } | ||
201 | - } | ||
202 | - } | ||
203 | - | ||
204 | - function patch(req,res,next){ | ||
205 | - var url=splitUrl(req.originalUrl); | ||
206 | - url=splitServiceFromUrl(url); | ||
207 | - if(checkReq(req,res)){ | ||
208 | - var options={ | ||
209 | - 'service_catalog':'', | ||
210 | - 'url': url, | ||
211 | - 'useUrl':true, | ||
212 | - 'params':req.body, | ||
213 | - 'callback':_cb, | ||
214 | - 'req':req, | ||
215 | - 'res':res, | ||
216 | - 'options':{}, | ||
217 | - 'excludeToken':true | ||
218 | - }; | ||
219 | - if(checkJson(req)){ | ||
220 | - rest.patchJson(options); | ||
221 | - }else{ | ||
222 | - rest.patch(options); | ||
223 | - } | ||
224 | - } | ||
225 | - function _cb(data,response){ | ||
226 | - logger.info('back data:',data); | ||
227 | - res.send(data); | ||
228 | - } | ||
229 | - } | ||
230 | - | ||
231 | - function head(req,res,next){ | ||
232 | - var url=splitUrl(req.originalUrl); | ||
233 | - url=splitServiceFromUrl(url); | ||
234 | - if(checkReq(req,res)){ | ||
235 | - var options={ | ||
236 | - 'service_catalog':'', | ||
237 | - 'url': url, | ||
238 | - 'useUrl':true, | ||
239 | - 'params':req.body, | ||
240 | - 'callback':_cb, | ||
241 | - 'req':req, | ||
242 | - 'res':res, | ||
243 | - 'options':{}, | ||
244 | - 'excludeToken':true | ||
245 | - }; | ||
246 | - rest.get(options); | ||
247 | - } | ||
248 | - function _cb(data,response){ | ||
249 | - logger.info('back data:',data); | ||
250 | - res.send(data); | ||
251 | - } | ||
252 | - } | ||
253 | - | ||
254 | - function del(req,res,next){ | ||
255 | - var url=splitUrl(req.originalUrl); | ||
256 | - url=splitServiceFromUrl(url); | ||
257 | - if(checkReq(req,res)){ | ||
258 | - var options={ | ||
259 | - 'service_catalog':'', | ||
260 | - 'url': url, | ||
261 | - 'useUrl':true, | ||
262 | - 'params':req.body, | ||
263 | - 'callback':_cb, | ||
264 | - 'req':req, | ||
265 | - 'res':res, | ||
266 | - 'options':{}, | ||
267 | - 'excludeToken':true | ||
268 | - }; | ||
269 | - rest.del(options); | ||
270 | - } | ||
271 | - function _cb(data,response){ | ||
272 | - logger.info('back data:',data); | ||
273 | - if(response.statusCode<300){ | ||
274 | - res.send({'action':'delete',"message":"删除成功"}); | ||
275 | - }else{ | ||
276 | - res.send(data); | ||
277 | - } | ||
278 | - } | ||
279 | - } | ||
280 | - | ||
281 | - function doLogin(req,res,next){ | ||
282 | - passport.authenticate('local', function(err, user, info) { | ||
283 | - if (err) { return next(err); } | ||
284 | - if (!user) { return res.send({'error':'用户名或密码错误!'}); } | ||
285 | - req.logIn(user, function(err) { | ||
286 | - if (err) { return next(err); } | ||
287 | - return res.send({'ok':'登录成功',user_info:req.session.passport.user.user_info}); | ||
288 | - }); | ||
289 | - })(req, res, next); | ||
290 | - } | ||
291 | - | ||
292 | - return { | ||
293 | - 'get':get, | ||
294 | - 'post':post, | ||
295 | - 'put':put, | ||
296 | - 'patch':patch, | ||
297 | - 'head':head, | ||
298 | - 'delete':del | ||
299 | - }; | ||
300 | -}; | ||
301 | - | ||
302 | -exports['@singleton']=true; | ||
303 | -exports['@require']=['igloo/logger','utils/rest','igloo/settings']; |
server/controllers/file.js
已删除
100644 → 0
1 | -var urlencode = require('urlencode'); | ||
2 | -exports=module.exports=function(logger,rest,settings){ | ||
3 | - function encodeUrl(url){ | ||
4 | - return urlencode(url); | ||
5 | - } | ||
6 | - | ||
7 | - function encodePamars(params){ | ||
8 | - var temp=[]; | ||
9 | - for(var i=0;i<params.length;i++){ | ||
10 | - var param=params[i]; | ||
11 | - var tempParam=param.split("=") | ||
12 | - tempParam[1]=urlencode.decode(tempParam[1], 'utf8'); | ||
13 | - tempParam[1]=tempParam[1].replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); | ||
14 | - console.log(tempParam[1]); | ||
15 | - if(i<(params.length-1)){ | ||
16 | - if(/[:&+/?%#=]/g.test(tempParam[1])){ | ||
17 | - temp.push(tempParam[0]+"="+encodeUrl(tempParam[1])+"&"); | ||
18 | - }else{ | ||
19 | - temp.push(tempParam[0]+"="+tempParam[1]+"&"); | ||
20 | - } | ||
21 | - }else{ | ||
22 | - if(/[:&+/?%#=]/g.test(tempParam[1])){ | ||
23 | - temp.push(tempParam[0]+"="+encodeUrl(tempParam[1])); | ||
24 | - }else{ | ||
25 | - temp.push(tempParam[0]+"="+tempParam[1]); | ||
26 | - } | ||
27 | - } | ||
28 | - } | ||
29 | - return temp.join(""); | ||
30 | - } | ||
31 | - | ||
32 | - function handlePamars(url){ | ||
33 | - var tempUrl=url; | ||
34 | - // if(url.indexOf("?")!=-1){ | ||
35 | - // var temp=url.split("?"); | ||
36 | - // var params=""; | ||
37 | - // if(temp[1]&&temp[1].indexOf("&")!=-1){ | ||
38 | - // params=encodePamars(temp[1].split("&")); | ||
39 | - // }else{ | ||
40 | - // params=encodePamars([temp[1]]); | ||
41 | - // } | ||
42 | - // return temp[0]+"?"+params; | ||
43 | - // }else { | ||
44 | - // return tempUrl; | ||
45 | - // } | ||
46 | - return tempUrl; | ||
47 | - } | ||
48 | - | ||
49 | - function splitServiceFromUrl(url){ | ||
50 | - var catalog=url.substring(1,url.indexOf('/',1)); | ||
51 | - var pathUrl=url.substring(url.indexOf('/',1)); | ||
52 | - var fullPath=settings.restful.url+catalog+settings.restful.version+pathUrl; | ||
53 | - if(pathUrl&&pathUrl.indexOf('inits')!=-1){ | ||
54 | - fullPath=settings.restful.url+catalog+'/v2'+pathUrl; | ||
55 | - } | ||
56 | - return fullPath | ||
57 | - } | ||
58 | - | ||
59 | - function splitUrl(fullUrl){ | ||
60 | - var url=fullUrl.substring(9); | ||
61 | - return url; | ||
62 | - } | ||
63 | - | ||
64 | - function searchService(services,name){ | ||
65 | - if(services[name]){ | ||
66 | - console.log(services[name]); | ||
67 | - return false; | ||
68 | - }else{ | ||
69 | - return true; | ||
70 | - } | ||
71 | - } | ||
72 | - | ||
73 | - function checkReq(req,res){ | ||
74 | - var flag=true; | ||
75 | - // if(flag&&req.headers&&!req.headers['service-catalog']){ | ||
76 | - // res.status(400); | ||
77 | - // res.send({"errors":{},"message":"缺少必要请求参数,服务目录名称是必填项"}); | ||
78 | - // flag=false; | ||
79 | - // } | ||
80 | - // if(flag&&req.session.passport&&req.session.passport.user&&!req.session.passport.user.service_catalog){ | ||
81 | - // res.status(404); | ||
82 | - // res.send({"errors":{},"message":"服务目录未加载,请重新登录"}); | ||
83 | - // flag=false; | ||
84 | - // } | ||
85 | - // if(flag&&searchService(req.session.passport.user.service_catalog,req.headers['service-catalog'])){ | ||
86 | - // res.status(404); | ||
87 | - // res.send({"errors":{},"message":"服务目录未查询到请求服务,请确认参数正确"}); | ||
88 | - // flag=false; | ||
89 | - // } | ||
90 | - return flag; | ||
91 | - } | ||
92 | - | ||
93 | - function checkJson(req){ | ||
94 | - if(req.headers&&req.headers['content-type']=='application/json'){ | ||
95 | - return true; | ||
96 | - }else{ | ||
97 | - return false; | ||
98 | - } | ||
99 | - } | ||
100 | - | ||
101 | - function get(req,res,next){ | ||
102 | - var url=splitUrl(req.originalUrl); | ||
103 | - url=handlePamars(url); | ||
104 | - url=splitServiceFromUrl(url); | ||
105 | - if(checkReq(req,res)){ | ||
106 | - var options={ | ||
107 | - 'service_catalog':'', | ||
108 | - 'url':url, | ||
109 | - 'useUrl':true, | ||
110 | - 'params':req.body, | ||
111 | - 'callback':_cb, | ||
112 | - 'req':req, | ||
113 | - 'res':res, | ||
114 | - 'options':{} | ||
115 | - }; | ||
116 | - rest.get(options); | ||
117 | - } | ||
118 | - function _cb(data,response){ | ||
119 | - logger.info('back data:',data); | ||
120 | - if(response.statusCode<300&&!data){ | ||
121 | - res.send({ | ||
122 | - code:200, | ||
123 | - message:'操作成功!' | ||
124 | - }); | ||
125 | - }else { | ||
126 | - res.send(data); | ||
127 | - } | ||
128 | - } | ||
129 | - } | ||
130 | - | ||
131 | - function post(req,res,next){ | ||
132 | - var url=splitUrl(req.originalUrl); | ||
133 | - url=splitServiceFromUrl(url); | ||
134 | - if(checkReq(req,res)){ | ||
135 | - var options={ | ||
136 | - 'service_catalog':'services[catalog].public_endpoint', | ||
137 | - 'url':url, | ||
138 | - 'useUrl':true, | ||
139 | - 'params':req.body, | ||
140 | - 'callback':_cb, | ||
141 | - 'req':req, | ||
142 | - 'res':res, | ||
143 | - 'options':{} | ||
144 | - }; | ||
145 | - if(checkJson(req)){ | ||
146 | - rest.postJson(options); | ||
147 | - }else{ | ||
148 | - rest.post(options); | ||
149 | - } | ||
150 | - } | ||
151 | - function _cb(data,response){ | ||
152 | - logger.info('back data:',data); | ||
153 | - if(response.statusCode<300&&!data){ | ||
154 | - res.send({ | ||
155 | - code:200, | ||
156 | - message:'操作成功!' | ||
157 | - }); | ||
158 | - }else{ | ||
159 | - res.send(data); | ||
160 | - } | ||
161 | - } | ||
162 | - } | ||
163 | - | ||
164 | - function put(req,res,next){ | ||
165 | - var url=splitUrl(req.originalUrl); | ||
166 | - url=splitServiceFromUrl(url); | ||
167 | - if(checkReq(req,res)){ | ||
168 | - var options={ | ||
169 | - 'service_catalog':'services[catalog].public_endpoint', | ||
170 | - 'url': url, | ||
171 | - 'useUrl':true, | ||
172 | - 'params':req.body, | ||
173 | - 'callback':_cb, | ||
174 | - 'req':req, | ||
175 | - 'res':res, | ||
176 | - 'options':{} | ||
177 | - }; | ||
178 | - if(checkJson(req)){ | ||
179 | - rest.putJson(options); | ||
180 | - }else{ | ||
181 | - rest.put(options); | ||
182 | - } | ||
183 | - } | ||
184 | - function _cb(data,response){ | ||
185 | - logger.info('back data:',data); | ||
186 | - if(response.statusCode<300&&!data){ | ||
187 | - res.send({ | ||
188 | - code:200, | ||
189 | - message:'操作成功!' | ||
190 | - }); | ||
191 | - }else{ | ||
192 | - res.send(data); | ||
193 | - } | ||
194 | - } | ||
195 | - } | ||
196 | - | ||
197 | - function patch(req,res,next){ | ||
198 | - var url=splitUrl(req.originalUrl); | ||
199 | - url=splitServiceFromUrl(url); | ||
200 | - if(checkReq(req,res)){ | ||
201 | - var options={ | ||
202 | - 'service_catalog':'services[catalog].public_endpoint', | ||
203 | - 'url': url, | ||
204 | - 'useUrl':true, | ||
205 | - 'params':req.body, | ||
206 | - 'callback':_cb, | ||
207 | - 'req':req, | ||
208 | - 'res':res, | ||
209 | - 'options':{} | ||
210 | - }; | ||
211 | - if(checkJson(req)){ | ||
212 | - rest.patchJson(options); | ||
213 | - }else{ | ||
214 | - rest.patch(options); | ||
215 | - } | ||
216 | - } | ||
217 | - function _cb(data,response){ | ||
218 | - logger.info('back data:',data); | ||
219 | - res.send(data); | ||
220 | - } | ||
221 | - } | ||
222 | - | ||
223 | - function head(req,res,next){ | ||
224 | - var url=splitUrl(req.originalUrl); | ||
225 | - url=splitServiceFromUrl(url); | ||
226 | - if(checkReq(req,res)){ | ||
227 | - var options={ | ||
228 | - 'service_catalog':'services[catalog].public_endpoint', | ||
229 | - 'url': url, | ||
230 | - 'useUrl':true, | ||
231 | - 'params':req.body, | ||
232 | - 'callback':_cb, | ||
233 | - 'req':req, | ||
234 | - 'res':res, | ||
235 | - 'options':{} | ||
236 | - }; | ||
237 | - rest.get(options); | ||
238 | - } | ||
239 | - function _cb(data,response){ | ||
240 | - logger.info('back data:',data); | ||
241 | - res.send(data); | ||
242 | - } | ||
243 | - } | ||
244 | - | ||
245 | - function del(req,res,next){ | ||
246 | - var url=splitUrl(req.originalUrl); | ||
247 | - url=splitServiceFromUrl(url); | ||
248 | - if(checkReq(req,res)){ | ||
249 | - var options={ | ||
250 | - 'service_catalog':'services[catalog].public_endpoint', | ||
251 | - 'url': url, | ||
252 | - 'useUrl':true, | ||
253 | - 'params':req.body, | ||
254 | - 'callback':_cb, | ||
255 | - 'req':req, | ||
256 | - 'res':res, | ||
257 | - 'options':{} | ||
258 | - }; | ||
259 | - rest.del(options); | ||
260 | - } | ||
261 | - function _cb(data,response){ | ||
262 | - logger.info('back data:',data); | ||
263 | - if(response.statusCode<300){ | ||
264 | - res.send({'action':'delete',"message":"删除成功"}); | ||
265 | - }else{ | ||
266 | - res.send(data); | ||
267 | - } | ||
268 | - } | ||
269 | - } | ||
270 | - | ||
271 | - return { | ||
272 | - 'get':get, | ||
273 | - 'post':post, | ||
274 | - 'put':put, | ||
275 | - 'patch':patch, | ||
276 | - 'head':head, | ||
277 | - 'delete':del | ||
278 | - }; | ||
279 | -}; | ||
280 | - | ||
281 | -exports['@singleton']=true; | ||
282 | -exports['@require']=['igloo/logger','utils/rest','igloo/settings']; |
server/controllers/mock.js
已删除
100644 → 0
1 | -var urlencode = require('urlencode'); | ||
2 | -var mockData = require('../json/mockDate.json'); | ||
3 | -exports=module.exports=function(logger,rest,settings){ | ||
4 | - | ||
5 | - function getJson(url,method){ | ||
6 | - var backData={}; | ||
7 | - for(var i=0;i<mockData.length;i++){ | ||
8 | - var urlRegex=new RegExp(mockData[i].url,'g'); | ||
9 | - if(urlRegex.test(url)){ | ||
10 | - backData=mockData[i][method+'_data']; | ||
11 | - return backData; | ||
12 | - } | ||
13 | - } | ||
14 | - return backData; | ||
15 | - } | ||
16 | - | ||
17 | - function get(req,res,next){ | ||
18 | - console.log(req.path); | ||
19 | - res.send(getJson(req.path,'get')); | ||
20 | - } | ||
21 | - | ||
22 | - function post(req,res,next){ | ||
23 | - console.log(req.path); | ||
24 | - res.send(getJson(req.path,'post')); | ||
25 | - } | ||
26 | - | ||
27 | - function put(req,res,next){ | ||
28 | - console.log(req.path); | ||
29 | - res.send(getJson(req.path,'put')); | ||
30 | - } | ||
31 | - | ||
32 | - function patch(req,res,next){ | ||
33 | - console.log(req.path); | ||
34 | - res.send(getJson(req.path,'patch')); | ||
35 | - } | ||
36 | - | ||
37 | - function head(req,res,next){ | ||
38 | - console.log(req.path); | ||
39 | - res.send(getJson(req.path,'head')); | ||
40 | - } | ||
41 | - | ||
42 | - function del(req,res,next){ | ||
43 | - console.log(req.path); | ||
44 | - res.send(getJson(req.path,'del')); | ||
45 | - } | ||
46 | - | ||
47 | - return { | ||
48 | - 'get':get, | ||
49 | - 'post':post, | ||
50 | - 'put':put, | ||
51 | - 'patch':patch, | ||
52 | - 'head':head, | ||
53 | - 'delete':del | ||
54 | - }; | ||
55 | -}; | ||
56 | - | ||
57 | -exports['@singleton']=true; | ||
58 | -exports['@require']=['igloo/logger','utils/rest','igloo/settings']; |
server/controllers/robot.js
已删除
100644 → 0
1 | -var urlencode= require('urlencode'); | ||
2 | - | ||
3 | -exports=module.exports=function(logger,rest,settings){ | ||
4 | - var api_service_endpoint = 'http://47.98.198.227:59000/v1'; | ||
5 | - | ||
6 | - function index(req,res,next){ | ||
7 | - logger.info(req.user); | ||
8 | - res.render('robotMobile',{title:'外呼机器人'}); | ||
9 | - } | ||
10 | - | ||
11 | - function splitUrl(fullUrl){ | ||
12 | - var url=fullUrl.substring(9); | ||
13 | - return url; | ||
14 | - } | ||
15 | - | ||
16 | - function get(req,res,next){ | ||
17 | - var url=splitUrl(req.originalUrl); | ||
18 | - rest.get({ | ||
19 | - 'baseUrl':'url', | ||
20 | - 'url':api_service_endpoint+url, | ||
21 | - 'useUrl':true, | ||
22 | - 'params':req.body, | ||
23 | - 'callback':_cb, | ||
24 | - 'req':req, | ||
25 | - 'res':res, | ||
26 | - 'options':{}, | ||
27 | - 'excludeToken':true | ||
28 | - }); | ||
29 | - function _cb(data,response){ | ||
30 | - console.log(data); | ||
31 | - res.send(data); | ||
32 | - } | ||
33 | - // res.send({ | ||
34 | - // "total_count":20, | ||
35 | - // "items":[{ | ||
36 | - // "id":'001', | ||
37 | - // "call_out_number":'18501068035', | ||
38 | - // "call_out_time":2022222, | ||
39 | - // "status":"4", | ||
40 | - // "record_url":'xxxx' | ||
41 | - // }] | ||
42 | - // }) | ||
43 | - } | ||
44 | - | ||
45 | - function post(req,res,next){ | ||
46 | - var url=splitUrl(req.originalUrl); | ||
47 | - rest.postJson({ | ||
48 | - 'baseUrl':'url', | ||
49 | - 'url':api_service_endpoint+url, | ||
50 | - 'useUrl':true, | ||
51 | - 'params':req.body, | ||
52 | - 'callback':_cb, | ||
53 | - 'req':req, | ||
54 | - 'res':res, | ||
55 | - 'options':{}, | ||
56 | - 'excludeToken':true | ||
57 | - }); | ||
58 | - function _cb(data,response){ | ||
59 | - console.log(data); | ||
60 | - res.send(data); | ||
61 | - } | ||
62 | - } | ||
63 | - | ||
64 | - function put(req,res,next){ | ||
65 | - var url=splitUrl(req.originalUrl); | ||
66 | - rest.putJson({ | ||
67 | - 'baseUrl':'url', | ||
68 | - 'url':api_service_endpoint+url, | ||
69 | - 'useUrl':true, | ||
70 | - 'params':req.body, | ||
71 | - 'callback':_cb, | ||
72 | - 'req':req, | ||
73 | - 'res':res, | ||
74 | - 'options':{}, | ||
75 | - 'excludeToken':true | ||
76 | - }); | ||
77 | - function _cb(data,response){ | ||
78 | - res.send(data); | ||
79 | - } | ||
80 | - } | ||
81 | - | ||
82 | - function patch(req,res,next){ | ||
83 | - var url=splitUrl(req.originalUrl); | ||
84 | - rest.patchJson({ | ||
85 | - 'baseUrl':'url', | ||
86 | - 'url':api_service_endpoint+url, | ||
87 | - 'useUrl':true, | ||
88 | - 'params':req.body, | ||
89 | - 'callback':_cb, | ||
90 | - 'req':req, | ||
91 | - 'res':res, | ||
92 | - 'options':{}, | ||
93 | - 'excludeToken':true | ||
94 | - }); | ||
95 | - function _cb(data,response){ | ||
96 | - res.send(data); | ||
97 | - } | ||
98 | - } | ||
99 | - | ||
100 | - function head(req,res,next){ | ||
101 | - var url=splitUrl(req.originalUrl); | ||
102 | - rest.get({ | ||
103 | - 'baseUrl':'url', | ||
104 | - 'url':api_service_endpoint+url, | ||
105 | - 'useUrl':true, | ||
106 | - 'params':req.body, | ||
107 | - 'callback':_cb, | ||
108 | - 'req':req, | ||
109 | - 'res':res, | ||
110 | - 'options':{}, | ||
111 | - 'excludeToken':true | ||
112 | - }); | ||
113 | - function _cb(data,response){ | ||
114 | - res.send(data); | ||
115 | - } | ||
116 | - } | ||
117 | - | ||
118 | - function del(req,res,next){ | ||
119 | - var url=splitUrl(req.originalUrl); | ||
120 | - rest.del({ | ||
121 | - 'baseUrl':'url', | ||
122 | - 'url':api_service_endpoint+url, | ||
123 | - 'useUrl':true, | ||
124 | - 'params':req.body, | ||
125 | - 'callback':_cb, | ||
126 | - 'req':req, | ||
127 | - 'res':res, | ||
128 | - 'options':{}, | ||
129 | - 'excludeToken':true | ||
130 | - }); | ||
131 | - function _cb(data,response){ | ||
132 | - res.send(data); | ||
133 | - } | ||
134 | - } | ||
135 | - | ||
136 | - return { | ||
137 | - 'index':index, | ||
138 | - 'get':get, | ||
139 | - 'post':post, | ||
140 | - 'put':put, | ||
141 | - 'patch':patch, | ||
142 | - 'head':head, | ||
143 | - 'delete':del | ||
144 | - }; | ||
145 | -}; | ||
146 | - | ||
147 | -exports['@singleton']=true; | ||
148 | -exports['@require']=['igloo/logger','utils/rest','igloo/settings']; |
1 | -var express = require('express'); | 1 | +var express = require('express'); |
2 | 2 | ||
3 | -exports = module.exports = function(IoC,policies){ | 3 | +exports = module.exports = function (IoC, policies, settings) { |
4 | var app = this; | 4 | var app = this; |
5 | - var router= express.Router(); | ||
6 | - var controller = IoC.create('controllers/api'); | ||
7 | - | 5 | + var router = express.Router(); |
6 | + var controller = IoC.create('controllers/api'); | ||
7 | + | ||
8 | router.get( | 8 | router.get( |
9 | '/*', | 9 | '/*', |
10 | policies.ensureLoggedOut(), | 10 | policies.ensureLoggedOut(), |
@@ -15,13 +15,13 @@ exports = module.exports = function(IoC,policies){ | @@ -15,13 +15,13 @@ exports = module.exports = function(IoC,policies){ | ||
15 | '/*', | 15 | '/*', |
16 | policies.ensureLoggedOut(), | 16 | policies.ensureLoggedOut(), |
17 | controller.post | 17 | controller.post |
18 | - ); | 18 | + ); |
19 | 19 | ||
20 | router.put( | 20 | router.put( |
21 | '/*', | 21 | '/*', |
22 | policies.ensureLoggedOut(), | 22 | policies.ensureLoggedOut(), |
23 | controller.put | 23 | controller.put |
24 | - ); | 24 | + ); |
25 | 25 | ||
26 | router.patch( | 26 | router.patch( |
27 | '/*', | 27 | '/*', |
@@ -34,15 +34,15 @@ exports = module.exports = function(IoC,policies){ | @@ -34,15 +34,15 @@ exports = module.exports = function(IoC,policies){ | ||
34 | policies.ensureLoggedOut(), | 34 | policies.ensureLoggedOut(), |
35 | controller.head | 35 | controller.head |
36 | ); | 36 | ); |
37 | - | 37 | + |
38 | router.delete( | 38 | router.delete( |
39 | '/*', | 39 | '/*', |
40 | policies.ensureLoggedOut(), | 40 | policies.ensureLoggedOut(), |
41 | controller.delete | 41 | controller.delete |
42 | - ); | 42 | + ); |
43 | 43 | ||
44 | - app.use('/api', router); | 44 | + app.use(settings.prefix + 'api', router); |
45 | }; | 45 | }; |
46 | 46 | ||
47 | -exports['@require']=['$container','policies']; | ||
48 | -exports['@singleton']=true; | 47 | +exports['@require'] = ['$container', 'policies', 'igloo/settings']; |
48 | +exports['@singleton'] = true; |
1 | var express = require('express'); | 1 | var express = require('express'); |
2 | var payRoll = require('../json/payRoll.json'); | 2 | var payRoll = require('../json/payRoll.json'); |
3 | 3 | ||
4 | -exports = module.exports = function (IoC, policies) { | 4 | +exports = module.exports = function (IoC, policies, settings) { |
5 | var app = this; | 5 | var app = this; |
6 | var router = express.Router(); | 6 | var router = express.Router(); |
7 | + var router2 = express.Router(); | ||
7 | var controller = IoC.create('controllers/auth'); | 8 | var controller = IoC.create('controllers/auth'); |
8 | - router.get( | 9 | + if (settings.prefix.length > 0) { |
10 | + router.get( | ||
11 | + '/', | ||
12 | + controller.index | ||
13 | + ); | ||
14 | + router.get( | ||
15 | + '/signOut', | ||
16 | + controller.signOut | ||
17 | + ); | ||
18 | + } | ||
19 | + | ||
20 | + router2.get( | ||
9 | '/', | 21 | '/', |
10 | - controller.index | 22 | + controller.indexPrefix |
11 | ); | 23 | ); |
24 | + | ||
12 | router.get( | 25 | router.get( |
13 | '/productDes', | 26 | '/productDes', |
14 | controller.productDes | 27 | controller.productDes |
@@ -39,7 +52,8 @@ exports = module.exports = function (IoC, policies) { | @@ -39,7 +52,8 @@ exports = module.exports = function (IoC, policies) { | ||
39 | controller.doLogin | 52 | controller.doLogin |
40 | ); | 53 | ); |
41 | 54 | ||
42 | - router.get( | 55 | + |
56 | + router2.get( | ||
43 | '/signOut', | 57 | '/signOut', |
44 | controller.signOut | 58 | controller.signOut |
45 | ); | 59 | ); |
@@ -198,6 +212,12 @@ exports = module.exports = function (IoC, policies) { | @@ -198,6 +212,12 @@ exports = module.exports = function (IoC, policies) { | ||
198 | controller.listChannels | 212 | controller.listChannels |
199 | ); | 213 | ); |
200 | 214 | ||
215 | + router.post( | ||
216 | + '/getTastLink', | ||
217 | + policies.ensureLoggedOut(), | ||
218 | + controller.getTastLink | ||
219 | + ); | ||
220 | + | ||
201 | router.get( | 221 | router.get( |
202 | '/filemeta', | 222 | '/filemeta', |
203 | policies.ensureLoggedOut(), | 223 | policies.ensureLoggedOut(), |
@@ -220,8 +240,23 @@ exports = module.exports = function (IoC, policies) { | @@ -220,8 +240,23 @@ exports = module.exports = function (IoC, policies) { | ||
220 | controller.weidianTempLate | 240 | controller.weidianTempLate |
221 | ); | 241 | ); |
222 | 242 | ||
223 | - app.use('/', router); | 243 | + router.get( |
244 | + '/wso-workai', | ||
245 | + controller.workaiSecurityOAuth | ||
246 | + ); | ||
247 | + | ||
248 | + router.get( | ||
249 | + '/socialwork/freedom-jobs/emps/:id/:verification', | ||
250 | + controller.freedomJobsEmp | ||
251 | + ); | ||
252 | + | ||
253 | + settings.prefix.length > 1 ? | ||
254 | + app.use(settings.prefix.substring(0, settings.prefix.length - 1), router) : | ||
255 | + app.use('/', router); | ||
256 | + | ||
257 | + | ||
258 | + app.use('/', router2); | ||
224 | }; | 259 | }; |
225 | 260 | ||
226 | -exports['@require'] = ['$container', 'policies']; | 261 | +exports['@require'] = ['$container', 'policies', 'igloo/settings']; |
227 | exports['@singleton'] = true; | 262 | exports['@singleton'] = true; |
server/routes/authed.js
已删除
100644 → 0
1 | -var express = require('express'); | ||
2 | - | ||
3 | -exports = module.exports = function(IoC,policies){ | ||
4 | - var app = this; | ||
5 | - var router= express.Router(); | ||
6 | - var controller = IoC.create('controllers/authed'); | ||
7 | - | ||
8 | - router.get( | ||
9 | - '/*', | ||
10 | - controller.get | ||
11 | - ); | ||
12 | - | ||
13 | - router.post( | ||
14 | - '/*', | ||
15 | - controller.post | ||
16 | - ); | ||
17 | - | ||
18 | - router.put( | ||
19 | - '/*', | ||
20 | - controller.put | ||
21 | - ); | ||
22 | - | ||
23 | - router.patch( | ||
24 | - '/*', | ||
25 | - controller.patch | ||
26 | - ); | ||
27 | - | ||
28 | - router.head( | ||
29 | - '/*', | ||
30 | - controller.head | ||
31 | - ); | ||
32 | - | ||
33 | - router.delete( | ||
34 | - '/*', | ||
35 | - controller.delete | ||
36 | - ); | ||
37 | - | ||
38 | - app.use('/auth_api', router); | ||
39 | -}; | ||
40 | - | ||
41 | -exports['@require']=['$container','policies']; | ||
42 | -exports['@singleton']=true; |
@@ -3,34 +3,23 @@ | @@ -3,34 +3,23 @@ | ||
3 | 3 | ||
4 | var bootable = require('bootable'); | 4 | var bootable = require('bootable'); |
5 | 5 | ||
6 | -exports = module.exports = function(IoC, settings) { | 6 | +exports = module.exports = function (IoC, settings) { |
7 | 7 | ||
8 | - var app = this; | ||
9 | - | ||
10 | - //auth | ||
11 | - app.phase(bootable.di.routes('./routes/auth.js')); | ||
12 | - | ||
13 | - //mock | ||
14 | - app.phase(bootable.di.routes('./routes/mock.js')); | ||
15 | - //authed | 8 | + var app = this; |
16 | 9 | ||
17 | - app.phase(bootable.di.routes('./routes/authed.js')); | 10 | + //auth |
11 | + app.phase(bootable.di.routes('./routes/auth.js')); | ||
18 | 12 | ||
19 | //api | 13 | //api |
20 | app.phase(bootable.di.routes('./routes/api.js')); | 14 | app.phase(bootable.di.routes('./routes/api.js')); |
21 | 15 | ||
22 | - //file | ||
23 | - app.phase(bootable.di.routes('./routes/file.js')); | ||
24 | - | ||
25 | - //robot | ||
26 | - app.phase(bootable.di.routes('./routes/robot.js')); | ||
27 | 16 | ||
28 | // error handler (always keep this last) | 17 | // error handler (always keep this last) |
29 | - app.phase(function() { | 18 | + app.phase(function () { |
30 | var errorHandler = IoC.create('igloo/error-handler'); | 19 | var errorHandler = IoC.create('igloo/error-handler'); |
31 | app.use(errorHandler); | 20 | app.use(errorHandler); |
32 | }); | 21 | }); |
33 | 22 | ||
34 | }; | 23 | }; |
35 | 24 | ||
36 | -exports['@require'] = [ '$container', 'igloo/settings' ]; | 25 | +exports['@require'] = ['$container', 'igloo/settings']; |
server/routes/file.js
已删除
100644 → 0
1 | -var express = require('express'); | ||
2 | - | ||
3 | -exports = module.exports = function(IoC,policies){ | ||
4 | - var app = this; | ||
5 | - var router= express.Router(); | ||
6 | - var controller = IoC.create('controllers/file'); | ||
7 | - | ||
8 | - router.get( | ||
9 | - '/*', | ||
10 | - controller.get | ||
11 | - ); | ||
12 | - | ||
13 | - router.post( | ||
14 | - '/*', | ||
15 | - controller.post | ||
16 | - ); | ||
17 | - | ||
18 | - router.put( | ||
19 | - '/*', | ||
20 | - controller.put | ||
21 | - ); | ||
22 | - | ||
23 | - router.patch( | ||
24 | - '/*', | ||
25 | - controller.patch | ||
26 | - ); | ||
27 | - | ||
28 | - router.head( | ||
29 | - '/*', | ||
30 | - controller.head | ||
31 | - ); | ||
32 | - | ||
33 | - router.delete( | ||
34 | - '/*', | ||
35 | - controller.delete | ||
36 | - ); | ||
37 | - | ||
38 | - app.use('/file_api', router); | ||
39 | -}; | ||
40 | - | ||
41 | -exports['@require']=['$container','policies']; | ||
42 | -exports['@singleton']=true; |
server/routes/mock.js
已删除
100644 → 0
1 | -var express = require('express'); | ||
2 | - | ||
3 | -exports = module.exports = function(IoC,policies){ | ||
4 | - var app = this; | ||
5 | - var router= express.Router(); | ||
6 | - var controller = IoC.create('controllers/mock'); | ||
7 | - | ||
8 | - router.get( | ||
9 | - '/*', | ||
10 | - policies.ensureLoggedOut(), | ||
11 | - controller.get | ||
12 | - ); | ||
13 | - | ||
14 | - router.post( | ||
15 | - '/*', | ||
16 | - policies.ensureLoggedOut(), | ||
17 | - controller.post | ||
18 | - ); | ||
19 | - | ||
20 | - router.put( | ||
21 | - '/*', | ||
22 | - policies.ensureLoggedOut(), | ||
23 | - controller.put | ||
24 | - ); | ||
25 | - | ||
26 | - router.patch( | ||
27 | - '/*', | ||
28 | - policies.ensureLoggedOut(), | ||
29 | - controller.patch | ||
30 | - ); | ||
31 | - | ||
32 | - router.head( | ||
33 | - '/*', | ||
34 | - policies.ensureLoggedOut(), | ||
35 | - controller.head | ||
36 | - ); | ||
37 | - | ||
38 | - router.delete( | ||
39 | - '/*', | ||
40 | - policies.ensureLoggedOut(), | ||
41 | - controller.delete | ||
42 | - ); | ||
43 | - | ||
44 | - app.use('/mock/api', router); | ||
45 | -}; | ||
46 | - | ||
47 | -exports['@require']=['$container','policies']; | ||
48 | -exports['@singleton']=true; |
server/routes/robot.js
已删除
100644 → 0
1 | -var express = require('express'); | ||
2 | - | ||
3 | -exports = module.exports = function(IoC,policies){ | ||
4 | - var app = this; | ||
5 | - var router= express.Router(); | ||
6 | - var controller = IoC.create('controllers/robot'); | ||
7 | - router.get( | ||
8 | - '/robot', | ||
9 | - controller.index | ||
10 | - ); | ||
11 | - | ||
12 | - router.get( | ||
13 | - '/api/*', | ||
14 | - controller.get | ||
15 | - ); | ||
16 | - | ||
17 | - router.post( | ||
18 | - '/api/*', | ||
19 | - controller.post | ||
20 | - ); | ||
21 | - | ||
22 | - router.put( | ||
23 | - '/api/*', | ||
24 | - controller.put | ||
25 | - ); | ||
26 | - | ||
27 | - router.patch( | ||
28 | - '/api/*', | ||
29 | - controller.patch | ||
30 | - ); | ||
31 | - | ||
32 | - router.head( | ||
33 | - '/api/*', | ||
34 | - controller.head | ||
35 | - ); | ||
36 | - | ||
37 | - router.delete( | ||
38 | - '/api/*', | ||
39 | - controller.delete | ||
40 | - ); | ||
41 | - | ||
42 | - app.use('/demo', router); | ||
43 | -}; | ||
44 | - | ||
45 | -exports['@require']=['$container','policies']; | ||
46 | -exports['@singleton']=true; |
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | - <head> | ||
4 | - <title>企云在线</title> | ||
5 | - <% include utils.ejs %> | ||
6 | - <style type="text/css"> | ||
7 | - .pt-page { | ||
8 | - width: 100%; | ||
9 | - height: 100%; | ||
10 | - position: absolute; | ||
11 | - top: 0; | ||
12 | - left: 0; | ||
13 | - visibility: hidden; | ||
14 | - overflow: hidden; | ||
15 | - -webkit-backface-visibility: hidden; | ||
16 | - -moz-backface-visibility: hidden; | ||
17 | - backface-visibility: hidden; | ||
18 | - -webkit-transform: translate3d(0, 0, 0); | ||
19 | - -moz-transform: translate3d(0, 0, 0); | ||
20 | - transform: translate3d(0, 0, 0); | ||
21 | - -webkit-transform-style: preserve-3d; | ||
22 | - -moz-transform-style: preserve-3d; | ||
23 | - transform-style: preserve-3d; | ||
24 | - } | ||
25 | - .pt-page-current, | ||
26 | - .no-js .pt-page { | ||
27 | - visibility: visible; | ||
28 | - z-index: 1; | ||
29 | - } | ||
30 | - </style> | ||
31 | - </head> | ||
32 | - <body class="home-hr"> | ||
33 | - <div class="menu-hr "> | ||
34 | - <div class="menu-hr-wrap"> | ||
35 | - <div class="login-user" id="login-user-menu"> | ||
36 | - <img class="user-photo" src="imgs/touxiang.jpg" alt="头像" /> | ||
37 | - <h3>登录用户</h3> | ||
38 | - <span class="login-user-name">fanwh</span> | ||
39 | - </div> | 3 | + |
4 | +<head> | ||
5 | + <title>企云在线</title> | ||
6 | + <% include utils.ejs %> | ||
7 | + <style type="text/css"> | ||
8 | + .pt-page { | ||
9 | + width: 100%; | ||
10 | + height: 100%; | ||
11 | + position: absolute; | ||
12 | + top: 0; | ||
13 | + left: 0; | ||
14 | + visibility: hidden; | ||
15 | + overflow: hidden; | ||
16 | + -webkit-backface-visibility: hidden; | ||
17 | + -moz-backface-visibility: hidden; | ||
18 | + backface-visibility: hidden; | ||
19 | + -webkit-transform: translate3d(0, 0, 0); | ||
20 | + -moz-transform: translate3d(0, 0, 0); | ||
21 | + transform: translate3d(0, 0, 0); | ||
22 | + -webkit-transform-style: preserve-3d; | ||
23 | + -moz-transform-style: preserve-3d; | ||
24 | + transform-style: preserve-3d; | ||
25 | + } | ||
26 | + | ||
27 | + .pt-page-current, | ||
28 | + .no-js .pt-page { | ||
29 | + visibility: visible; | ||
30 | + z-index: 1; | ||
31 | + } | ||
32 | + </style> | ||
33 | +</head> | ||
34 | + | ||
35 | +<body class="home-hr"> | ||
36 | + <div class="menu-hr "> | ||
37 | + <div class="menu-hr-wrap"> | ||
38 | + <div class="login-user" id="login-user-menu"> | ||
39 | + <img class="user-photo" src="imgs/touxiang.jpg" alt="头像" /> | ||
40 | + <h3>登录用户</h3> | ||
41 | + <span class="login-user-name">fanwh</span> | ||
40 | </div> | 42 | </div> |
41 | - <div class="menu-items-wrap"> | ||
42 | - <ul class="primary-items"> | ||
43 | - <li><a href="#userInfo"><i class="fa fa-home blue-icon fa-fw"></i>主页</a></li> | ||
44 | - <li><a href="#formEditor"><i class="fa fa-user green-icon fa-fw"></i>表单设置</a></li> | ||
45 | - <li><a href="#approvalEditor"><i class="fa fa-plug yellow-icon fa-fw"></i>自动化</a></li> | ||
46 | - <li><a href="#"><i class="fa fa-inbox purple-icon fa-fw"></i>消息历史纪录</a></li> | ||
47 | - <li><a href="#"><i class="fa fa-file blue-icon fa-fw"></i>文件管理</a></li> | ||
48 | - <li><a href="#"><i class="fa fa-group red-icon fa-fw"></i>团队目录</a></li> | ||
49 | - <li><a href="#"><i class="fa fa-dashboard green-icon fa-fw"></i>统计资料</a></li> | ||
50 | - <li><a href="#"><i class="fa fa-magic yellow-icon fa-fw"></i>个性化设置</a></li> | ||
51 | - </ul> | ||
52 | - <h3>管理设置</h3> | ||
53 | - <ul class="secondary-items" > | ||
54 | - <li><a href="#">团队设置</a></li> | ||
55 | - <li><a href="#">团队管理</a></li> | ||
56 | - <li><a href="#">邀请他人</a></li> | ||
57 | - <li><a href="#">付费用户</a></li> | ||
58 | - <li><a href="#">认证</a></li> | ||
59 | - </ul> | 43 | + </div> |
44 | + <div class="menu-items-wrap"> | ||
45 | + <ul class="primary-items"> | ||
46 | + <li><a href="#userInfo"><i class="fa fa-home blue-icon fa-fw"></i>主页</a></li> | ||
47 | + <li><a href="#formEditor"><i class="fa fa-user green-icon fa-fw"></i>表单设置</a></li> | ||
48 | + <li><a href="#approvalEditor"><i class="fa fa-plug yellow-icon fa-fw"></i>自动化</a></li> | ||
49 | + <li><a href="#"><i class="fa fa-inbox purple-icon fa-fw"></i>消息历史纪录</a></li> | ||
50 | + <li><a href="#"><i class="fa fa-file blue-icon fa-fw"></i>文件管理</a></li> | ||
51 | + <li><a href="#"><i class="fa fa-group red-icon fa-fw"></i>团队目录</a></li> | ||
52 | + <li><a href="#"><i class="fa fa-dashboard green-icon fa-fw"></i>统计资料</a></li> | ||
53 | + <li><a href="#"><i class="fa fa-magic yellow-icon fa-fw"></i>个性化设置</a></li> | ||
54 | + </ul> | ||
55 | + <h3>管理设置</h3> | ||
56 | + <ul class="secondary-items"> | ||
57 | + <li><a href="#">团队设置</a></li> | ||
58 | + <li><a href="#">团队管理</a></li> | ||
59 | + <li><a href="#">邀请他人</a></li> | ||
60 | + <li><a href="#">付费用户</a></li> | ||
61 | + <li><a href="#">认证</a></li> | ||
62 | + </ul> | ||
63 | + </div> | ||
64 | + <div class="menu-footer"> | ||
65 | + <ul class="menu-footer-wrap"> | ||
66 | + <li><a href="#/is">产品介绍</a></li> | ||
67 | + <li><a href="#/apps">轻松HR Apps</a></li> | ||
68 | + <li><a href="#/brand-guidelines">品牌指导</a></li> | ||
69 | + <li><a href="#/help">帮助中心</a></li> | ||
70 | + <li><a target="_blank" href="#">应用接口<i | ||
71 | + class="ts_icon ts_icon_external_link small_left_margin ts_icon_inherit"></i></a></li> | ||
72 | + <li><a href="#/account/gateways">网关设置</a></li> | ||
73 | + </ul> | ||
74 | + </div> | ||
75 | + </div> | ||
76 | + <div class="container-hr"> | ||
77 | + <div class="head-hr z-depth-1"> | ||
78 | + <div class="menu-toggle" id="show-menu"> | ||
79 | + <span class="menu-icon fa fa-reorder"></span> | ||
80 | + <span class="menu-label">菜单</span> | ||
60 | </div> | 81 | </div> |
61 | - <div class="menu-footer"> | ||
62 | - <ul class="menu-footer-wrap"> | ||
63 | - <li><a href="#/is">产品介绍</a></li> | ||
64 | - <li><a href="#/apps">轻松HR Apps</a></li> | ||
65 | - <li><a href="#/brand-guidelines">品牌指导</a></li> | ||
66 | - <li><a href="#/help">帮助中心</a></li> | ||
67 | - <li><a target="_blank" href="#">应用接口<i class="ts_icon ts_icon_external_link small_left_margin ts_icon_inherit"></i></a></li> | ||
68 | - <li><a href="#/account/gateways">网关设置</a></li> | ||
69 | - </ul> | 82 | + <div class="vert-divider"></div> |
83 | + <div class="header-team-name" id="header-team-name"> | ||
84 | + <a href="#/home"> | ||
85 | + <i class="fa fa-home"></i> | ||
86 | + 谈华芳项目组 | ||
87 | + </a> | ||
70 | </div> | 88 | </div> |
71 | - </div> | ||
72 | - <div class="container-hr"> | ||
73 | - <div class="head-hr z-depth-1"> | ||
74 | - <div class="menu-toggle" id="show-menu"> | ||
75 | - <span class="menu-icon fa fa-reorder"></span> | ||
76 | - <span class="menu-label">菜单</span> | ||
77 | - </div> | ||
78 | - <div class="vert-divider"></div> | ||
79 | - <div class="header-team-name" id="header-team-name"> | ||
80 | - <a href="#/home"> | ||
81 | - <i class="fa fa-home"></i> | ||
82 | - 谈华芳项目组 | 89 | + <div class="header-nav"> |
90 | + <div class="header-btns float-right"> | ||
91 | + <a id="team-switcher" href={`${__PREFIX__}signOut`}> | ||
92 | + <i class="fa fa-sign-out"></i> | ||
93 | + <span class="block label">退出</span> | ||
94 | + </a> | ||
95 | + <a id="team-switcher"> | ||
96 | + <i class="fa fa-th-large"></i> | ||
97 | + <span class="block label">团队</span> | ||
98 | + </a> | ||
99 | + <a id="help-link" href="#/help"> | ||
100 | + <i class="fa fa-support"></i> | ||
101 | + <span class="block label">帮助</span> | ||
102 | + </a> | ||
103 | + <a href="/chat"> | ||
104 | + <img class="photo-sm" src="imgs/touxiang.jpg"> | ||
105 | + <span class="block label">企信</span> | ||
83 | </a> | 106 | </a> |
84 | </div> | 107 | </div> |
85 | - <div class="header-nav"> | ||
86 | - <div class="header-btns float-right"> | ||
87 | - <a id="team-switcher" href="/signOut"> | ||
88 | - <i class="fa fa-sign-out"></i> | ||
89 | - <span class="block label">退出</span> | ||
90 | - </a> | ||
91 | - <a id="team-switcher"> | ||
92 | - <i class="fa fa-th-large"></i> | ||
93 | - <span class="block label">团队</span> | ||
94 | - </a> | ||
95 | - <a id="help-link" href="#/help"> | ||
96 | - <i class="fa fa-support"></i> | ||
97 | - <span class="block label">帮助</span> | ||
98 | - </a> | ||
99 | - <a href="/chat"> | ||
100 | - <img class="photo-sm" src="imgs/touxiang.jpg" > | ||
101 | - <span class="block label">企信</span> | ||
102 | - </a> | ||
103 | - </div> | ||
104 | - </div> | ||
105 | </div> | 108 | </div> |
106 | - <div class="content-hr"> | ||
107 | - <!-- < include forms/editor.ejs%> --> | ||
108 | - <!-- < include forms/formOperation.ejs%> --> | ||
109 | - <!-- < include initialization/addEmployee.ejs%> --> | ||
110 | - <!-- < include initialization/importEmployee.ejs%> --> | ||
111 | - <div class="content-body pt-page pt-page-current"> | ||
112 | - </div> | ||
113 | - <div class="content-body pt-page pt-page-next"> | ||
114 | - </div> | ||
115 | - <div class="overlay hide"></div> | 109 | + </div> |
110 | + <div class="content-hr"> | ||
111 | + <!-- < include forms/editor.ejs%> --> | ||
112 | + <!-- < include forms/formOperation.ejs%> --> | ||
113 | + <!-- < include initialization/addEmployee.ejs%> --> | ||
114 | + <!-- < include initialization/importEmployee.ejs%> --> | ||
115 | + <div class="content-body pt-page pt-page-current"> | ||
116 | + </div> | ||
117 | + <div class="content-body pt-page pt-page-next"> | ||
116 | </div> | 118 | </div> |
119 | + <div class="overlay hide"></div> | ||
117 | </div> | 120 | </div> |
118 | - | ||
119 | - <script type="text/javascript"> | ||
120 | - $('#login-user-menu').click(function(e){ | ||
121 | - $('.menu-hr').removeClass("open-menu"); | ||
122 | - $('.container-hr').removeClass("open-container-menu"); | ||
123 | - $('#show-menu').removeClass("show-menu"); | ||
124 | - $('.overlay').removeClass('hide'); | ||
125 | - }); | ||
126 | - $('#show-menu').click(function(e){ | ||
127 | - if(!$('#show-menu').hasClass('show-menu')){ | ||
128 | - $('.menu-hr').addClass("open-menu"); | ||
129 | - $('.container-hr').addClass("open-container-menu"); | ||
130 | - $('#show-menu').addClass("show-menu"); | ||
131 | - $('.overlay').removeClass('hide'); | ||
132 | - }else{ | ||
133 | - $('.menu-hr').removeClass("open-menu"); | ||
134 | - $('.container-hr').removeClass("open-container-menu"); | ||
135 | - $('#show-menu').removeClass("show-menu"); | ||
136 | - $('.overlay').addClass('hide'); | ||
137 | - } | ||
138 | - }); | ||
139 | - $('.overlay').click(function(e){ | ||
140 | - $('.menu-hr').removeClass("open-menu"); | ||
141 | - $('.container-hr').removeClass("open-container-menu"); | ||
142 | - $('#show-menu').removeClass("show-menu"); | ||
143 | - $('.overlay').addClass('hide'); | ||
144 | - }); | ||
145 | - var loader=new Loader({ | ||
146 | - routes:{ | ||
147 | - '/userInfo':userInfo, | ||
148 | - '/formEditor':formEditor, | ||
149 | - '/approvalEditor':approvalEditor | ||
150 | - }, | ||
151 | - defaults:'/userInfo' | ||
152 | - }); | ||
153 | - loader.init(); | ||
154 | - function userInfo(){ | ||
155 | - loader.import('/views/hr/userInfo.html').then(function(p){ | ||
156 | - $('.pt-page-next').html(p); | ||
157 | - loader.page.nextPage(); | ||
158 | - }); | ||
159 | - } | ||
160 | - function approvalEditor(){ | ||
161 | - loader.import('/views/approval/editor.html').then(function(p){ | ||
162 | - $('.pt-page-next').html(p); | ||
163 | - loader.page.nextPage(); | ||
164 | - }); | ||
165 | - } | ||
166 | - function formEditor(){ | ||
167 | - loader.import('/views/form/editor.html').then(function(p){ | ||
168 | - $('.pt-page-next').html(p); | ||
169 | - loader.page.nextPage(); | ||
170 | - }); | ||
171 | - } | ||
172 | - | ||
173 | - </script> | ||
174 | - </body> | 121 | + </div> |
122 | + | ||
123 | + <script type="text/javascript"> | ||
124 | + $('#login-user-menu').click(function (e) { | ||
125 | + $('.menu-hr').removeClass("open-menu"); | ||
126 | + $('.container-hr').removeClass("open-container-menu"); | ||
127 | + $('#show-menu').removeClass("show-menu"); | ||
128 | + $('.overlay').removeClass('hide'); | ||
129 | + }); | ||
130 | + $('#show-menu').click(function (e) { | ||
131 | + if (!$('#show-menu').hasClass('show-menu')) { | ||
132 | + $('.menu-hr').addClass("open-menu"); | ||
133 | + $('.container-hr').addClass("open-container-menu"); | ||
134 | + $('#show-menu').addClass("show-menu"); | ||
135 | + $('.overlay').removeClass('hide'); | ||
136 | + } else { | ||
137 | + $('.menu-hr').removeClass("open-menu"); | ||
138 | + $('.container-hr').removeClass("open-container-menu"); | ||
139 | + $('#show-menu').removeClass("show-menu"); | ||
140 | + $('.overlay').addClass('hide'); | ||
141 | + } | ||
142 | + }); | ||
143 | + $('.overlay').click(function (e) { | ||
144 | + $('.menu-hr').removeClass("open-menu"); | ||
145 | + $('.container-hr').removeClass("open-container-menu"); | ||
146 | + $('#show-menu').removeClass("show-menu"); | ||
147 | + $('.overlay').addClass('hide'); | ||
148 | + }); | ||
149 | + var loader = new Loader({ | ||
150 | + routes: { | ||
151 | + '/userInfo': userInfo, | ||
152 | + '/formEditor': formEditor, | ||
153 | + '/approvalEditor': approvalEditor | ||
154 | + }, | ||
155 | + defaults: '/userInfo' | ||
156 | + }); | ||
157 | + loader.init(); | ||
158 | + function userInfo() { | ||
159 | + loader.import('/views/hr/userInfo.html').then(function (p) { | ||
160 | + $('.pt-page-next').html(p); | ||
161 | + loader.page.nextPage(); | ||
162 | + }); | ||
163 | + } | ||
164 | + function approvalEditor() { | ||
165 | + loader.import('/views/approval/editor.html').then(function (p) { | ||
166 | + $('.pt-page-next').html(p); | ||
167 | + loader.page.nextPage(); | ||
168 | + }); | ||
169 | + } | ||
170 | + function formEditor() { | ||
171 | + loader.import('/views/form/editor.html').then(function (p) { | ||
172 | + $('.pt-page-next').html(p); | ||
173 | + loader.page.nextPage(); | ||
174 | + }); | ||
175 | + } | ||
176 | + | ||
177 | + </script> | ||
178 | +</body> | ||
179 | + | ||
175 | </html> | 180 | </html> |
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | - <head> | ||
4 | - <title></title> | ||
5 | - <meta http-equiv="X-UA-Compatible" content="IE=10"> | ||
6 | - <meta name="csrf-token" content="<%=htmlWebpackPlugin.options.csrfToken%>"> | ||
7 | - <METAHTTP-EQUIV="Pragma"CONTENT="no-cache"> | ||
8 | - <METAHTTP-EQUIV="Cache-Control"CONTENT="no-cache"> | ||
9 | - <METAHTTP-EQUIV="Expires"CONTENT="0"> | ||
10 | - <link rel="stylesheet" type="text/css" href="css/core.css"> | ||
11 | - <link rel="stylesheet" type="text/css" href="css/antd.min.css"> | ||
12 | - <style type="text/css"> | ||
13 | - </style> | ||
14 | - <script src="//cdn.ronghub.com/RongIMLib-2.2.8.min.js"></script> | ||
15 | - <script src="/js/plupload.full.min.js"></script> | ||
16 | - <link rel="stylesheet" href="css/jquery-ui-1.10.4.custom.min.css"> | ||
17 | - <script type="text/javascript" src="/js/jquery-1.9.1.js"></script> | ||
18 | - <script type="text/javascript" src="/js/jquery-ui-1.10.4.custom.min.js"></script> | ||
19 | - <script type="text/javascript" src="/js/primitives.min.js"></script> | ||
20 | - <link href="/css/primitives.latest.css" media="screen" rel="stylesheet" type="text/css"> | ||
21 | - <script type="text/javascript" src="//webapi.amap.com/maps?v=1.3&key=8cb4df3e0698fa29ccbe07db325948cc"></script> | ||
22 | - <script src="//webapi.amap.com/ui/1.0/main.js"></script> | ||
23 | - <script src="//gosspublic.alicdn.com/aliyun-oss-sdk-4.3.0.min.js"></script> | ||
24 | - <script type="text/javascript" src="/js/getorgchart/getorgchart.js"></script> | ||
25 | - <link rel="stylesheet" href="/js/getorgchart/getorgchart.css"> | ||
26 | - <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1273424455'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s22.cnzz.com/z_stat.php%3Fid%3D1273424455%26show%3Dpic' type='text/javascript'%3E%3C/script%3E")); | ||
27 | - </script> | ||
28 | - </head> | ||
29 | - <body class="bootStrapShadow"> | ||
30 | - <div id="root" class="root"></div> | ||
31 | - <script> | ||
32 | - | ||
33 | - </script> | ||
34 | - </body> | 3 | + |
4 | +<head> | ||
5 | + <title></title> | ||
6 | + <meta http-equiv="X-UA-Compatible" content="IE=10"> | ||
7 | + <meta name="csrf-token" content="<%=htmlWebpackPlugin.options.csrfToken%>"> | ||
8 | + <METAHTTP-EQUIV="Pragma"CONTENT="no-cache"> | ||
9 | + <METAHTTP-EQUIV="Cache-Control"CONTENT="no-cache"> | ||
10 | + <METAHTTP-EQUIV="Expires"CONTENT="0"> | ||
11 | + <link rel="stylesheet" type="text/css" href="css/core.css"> | ||
12 | + <link rel="stylesheet" type="text/css" href="css/antd.min.css"> | ||
13 | + <style type="text/css"> | ||
14 | + </style> | ||
15 | + <script src="//cdn.ronghub.com/RongIMLib-2.2.8.min.js"></script> | ||
16 | + <script src="js/plupload.full.min.js"></script> | ||
17 | + <link rel="stylesheet" href="css/jquery-ui-1.10.4.custom.min.css"> | ||
18 | + <script type="text/javascript" src="js/jquery-1.9.1.js"></script> | ||
19 | + <script type="text/javascript" src="js/jquery-ui-1.10.4.custom.min.js"></script> | ||
20 | + <script type="text/javascript" src="js/primitives.min.js"></script> | ||
21 | + <link href="css/primitives.latest.css" media="screen" rel="stylesheet" type="text/css"> | ||
22 | + <script type="text/javascript" src="//webapi.amap.com/maps?v=1.3&key=8cb4df3e0698fa29ccbe07db325948cc"></script> | ||
23 | + <script src="//webapi.amap.com/ui/1.0/main.js"></script> | ||
24 | + <script src="//gosspublic.alicdn.com/aliyun-oss-sdk-4.3.0.min.js"></script> | ||
25 | + <script type="text/javascript" src="js/getorgchart/getorgchart.js"></script> | ||
26 | + <link rel="stylesheet" href="js/getorgchart/getorgchart.css"> | ||
27 | + <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://"); document.write(unescape("%3Cspan id='cnzz_stat_icon_1273424455'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s22.cnzz.com/z_stat.php%3Fid%3D1273424455%26show%3Dpic' type='text/javascript'%3E%3C/script%3E")); | ||
28 | + </script> | ||
29 | +</head> | ||
30 | + | ||
31 | +<body class="bootStrapShadow"> | ||
32 | + <div id="root" class="root"></div> | ||
33 | + <script> | ||
34 | + | ||
35 | + </script> | ||
36 | +</body> | ||
37 | + | ||
35 | </html> | 38 | </html> |
server/views/loginerr.ejs
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html > | ||
3 | + <head> | ||
4 | + <title></title> | ||
5 | + <style> | ||
6 | + #father { | ||
7 | + width: 100vw; | ||
8 | + height: 100vh; | ||
9 | + background-color: skyblue; | ||
10 | + position: relative; | ||
11 | + padding: 0; | ||
12 | + margin: 0; | ||
13 | + } | ||
14 | + | ||
15 | + #son { | ||
16 | + width: 200px; | ||
17 | + height: 200px; | ||
18 | + position: absolute; | ||
19 | + left: 50%; | ||
20 | + top: 50%; | ||
21 | + margin-left: -100px; | ||
22 | + margin-top: -100px; | ||
23 | + text-align: center; | ||
24 | + } | ||
25 | + </style> | ||
26 | + </head> | ||
27 | + <body id="father"> | ||
28 | + <div id="son" > | ||
29 | + <div> | ||
30 | + <svg t="1562047045753" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3393" width="100" height="100" data-spm-anchor-id="a313x.7781069.0.i3"><path d="M575.986694 832.039919C575.986694 867.356032 547.316113 896.026613 512 896.026613 476.683887 896.026613 448.013306 867.356032 448.013306 832.039919 448.013306 796.723806 476.683887 768.048156 512 768.048156 547.316113 768.048156 575.986694 796.64777 575.986694 832.039919ZM512 255.997465C476.683887 255.997465 448.013306 284.668046 448.013306 319.984159L448.013306 639.998733C448.013306 675.314846 476.683887 703.990496 512 703.990496 547.316113 703.990496 575.986694 675.314846 575.986694 639.998733L575.986694 319.984159C575.986694 284.668046 547.316113 255.997465 512 255.997465ZM1023.979724 896.026613C1023.979724 966.729805 966.709529 1024.005069 896.006336 1024.005069L127.993664 1024.005069C57.290471 1024.005069 0.020276 966.658839 0.020276 896.026613 0.020276 874.868373 5.216059 854.931776 14.39105 837.311737L14.320083 837.24077 398.250384 69.304133 398.392317 69.304133C419.626593 28.133261 462.455047 0.040552 512 0.040552 561.544953 0.040552 604.373407 28.209297 625.67865 69.3751L1008.311272 834.711311C1018.348003 852.838256 1023.979724 873.783595 1023.979724 896.026613ZM959.99303 896.026613C959.99303 885.123073 957.392604 874.868373 952.191753 865.404445L951.613881 864.319667 951.112044 863.239958 568.621355 98.405584C557.499847 77.171308 535.834701 64.027246 512 64.027246 488.023365 64.027246 466.282184 77.318311 455.160675 98.765487L452.12938 104.544211 92.175714 824.527578 92.677551 825.034483 71.154339 866.778159C66.389426 875.948082 64.00697 885.842879 64.00697 896.097579 64.00697 931.413692 92.748517 960.089342 127.993664 960.089342L896.006336 960.089342C931.322449 960.013306 959.99303 931.342726 959.99303 896.026613Z" p-id="3394" fill="#f4a251"></path></svg> | ||
31 | + </div> | ||
32 | + <div style="margin-top: 16px;"> | ||
33 | + 登陆失败,授权码无效 | ||
34 | + </div> | ||
35 | + </div> | ||
36 | + </body> | ||
37 | +</html> |
@@ -339,7 +339,7 @@ | @@ -339,7 +339,7 @@ | ||
339 | } | 339 | } |
340 | var isWeixin = is_weixin(); | 340 | var isWeixin = is_weixin(); |
341 | var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight; | 341 | var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight; |
342 | - var weixinTip = $('<div id="weixinTip"><p><img src="/img/live_weixin.png" alt="微信打开"/></p></div>'); | 342 | + var weixinTip = $('<div id="weixinTip"><p><img src="./img/live_weixin.png" alt="微信打开"/></p></div>'); |
343 | 343 | ||
344 | if(isWeixin){ | 344 | if(isWeixin){ |
345 | $("body").append(weixinTip); | 345 | $("body").append(weixinTip); |
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | <div class="container"> | 41 | <div class="container"> |
42 | <div class="row"> | 42 | <div class="row"> |
43 | <div id="bgImg" class="col-lg-12 col-sm-12 col-md-12 col-xs-12 text-center"> | 43 | <div id="bgImg" class="col-lg-12 col-sm-12 col-md-12 col-xs-12 text-center"> |
44 | - <img src="../img/Group.png" class="img-responsive"> | 44 | + <img src=".../img/Group.png" class="img-responsive"> |
45 | </div> | 45 | </div> |
46 | </div> | 46 | </div> |
47 | <div class="row"> | 47 | <div class="row"> |
1 | import React, { PropTypes } from 'react'; | 1 | import React, { PropTypes } from 'react'; |
2 | import { connect } from 'react-redux'; | 2 | import { connect } from 'react-redux'; |
3 | -import { Button, Tabs, Menu } from 'antd'; | 3 | +import { Button, Tabs, Menu, Icon } from 'antd'; |
4 | import cx from 'classnames'; | 4 | import cx from 'classnames'; |
5 | import s from './systemMenuLess.les'; | 5 | import s from './systemMenuLess.les'; |
6 | import { doLogin, sendQuickLoginSmsCode } from '../redux/actions/authed'; | 6 | import { doLogin, sendQuickLoginSmsCode } from '../redux/actions/authed'; |
@@ -68,14 +68,18 @@ class SystemMenu extends React.Component { | @@ -68,14 +68,18 @@ class SystemMenu extends React.Component { | ||
68 | dispatch(loadUnreadMessage()) | 68 | dispatch(loadUnreadMessage()) |
69 | } | 69 | } |
70 | render() { | 70 | render() { |
71 | - let { menus, userInfo, height, width } = this.props; | 71 | + let { menus, userInfo, height, width, collapsed } = this.props; |
72 | const { user = {}, tenant = {} } = userInfo; | 72 | const { user = {}, tenant = {} } = userInfo; |
73 | - const { collapsed, active, imageUrl, userImage, logoImage, defaultSelectedKeys, defaultOpenKeys } = this.state; | 73 | + const { active, imageUrl, userImage, logoImage, defaultSelectedKeys, defaultOpenKeys } = this.state; |
74 | const renderSubMenu = (subMenus) => { | 74 | const renderSubMenu = (subMenus) => { |
75 | return subMenus.map((subMenu, i) => { | 75 | return subMenus.map((subMenu, i) => { |
76 | return ( | 76 | return ( |
77 | <Menu.Item key={subMenu.module}> | 77 | <Menu.Item key={subMenu.module}> |
78 | - <span className="nav-text">{subMenu.display_name}{subMenu && subMenu.is_beta && subMenu.is_beta == 'y' && <span style={{ color: 'rgba(153, 169, 191,0.6)' }}>( 试用 )</span>}</span> | 78 | + <span>{subMenu.display_name}</span> |
79 | + { | ||
80 | + subMenu && subMenu.is_beta && subMenu.is_beta == 'y' && | ||
81 | + <span style={{ color: 'rgba(153, 169, 191,0.6)' }}>( 试用 )</span> | ||
82 | + } | ||
79 | </Menu.Item> | 83 | </Menu.Item> |
80 | ) | 84 | ) |
81 | }); | 85 | }); |
@@ -86,15 +90,22 @@ class SystemMenu extends React.Component { | @@ -86,15 +90,22 @@ class SystemMenu extends React.Component { | ||
86 | if (tenant.biz_type == '0' || tenant.biz_type == '1') { | 90 | if (tenant.biz_type == '0' || tenant.biz_type == '1') { |
87 | return ( | 91 | return ( |
88 | <div className={cx(s.system_menu_wrap, 'system_menu_wrap')} style={{ height: height - 160 }}> | 92 | <div className={cx(s.system_menu_wrap, 'system_menu_wrap')} style={{ height: height - 160 }}> |
89 | - <CustomScrollbars viewStyle={{ paddingRight: '10px' }} theme="white"> {/*onSelect*/} | ||
90 | - <Menu theme="dark" mode={this.state.mode} onClick={this.changeMenu} onOpenChange={this.changeOpenSubMenu} onCollapse={this.onCollapse} | ||
91 | - style={{ borderRight: '1px solid transparent', backgroundColor: '#0f2139' }} | 93 | + <CustomScrollbars viewStyle={{ paddingRight: '10px' }} theme="white"> |
94 | + <Menu theme="light" mode={'inline'} onClick={this.changeMenu} | ||
95 | + inlineCollapsed={this.props.collapsed} | ||
96 | + onOpenChange={this.changeOpenSubMenu} | ||
97 | + style={{ borderRight: '1px solid transparent', backgroundColor: '#fff' }} | ||
92 | selectedKeys={[defaultSelectedKeys]} openKeys={[defaultOpenKeys]}> | 98 | selectedKeys={[defaultSelectedKeys]} openKeys={[defaultOpenKeys]}> |
93 | {menus && menus.map((menu, i) => { | 99 | {menus && menus.map((menu, i) => { |
94 | if (menu.children) { | 100 | if (menu.children) { |
95 | return ( | 101 | return ( |
96 | <SubMenu key={menu.module} title={ | 102 | <SubMenu key={menu.module} title={ |
97 | - <span><img style={{ width: '12px', marginRight: '8px', verticalAlign: 'baseline' }} src={menuIconMap[menu.module]} alt="" />{menu.display_name}</span> | 103 | + <span> |
104 | + <img | ||
105 | + style={{ width: '20px', position: 'relative', top: '-2px', right: '5px' }} | ||
106 | + src={menuIconMap[menu.module]} alt="" /> | ||
107 | + <span>{collapsed ? '' : menu.display_name}</span> | ||
108 | + </span> | ||
98 | }> | 109 | }> |
99 | {renderSubMenu(menu.children)} | 110 | {renderSubMenu(menu.children)} |
100 | </SubMenu> | 111 | </SubMenu> |
@@ -102,13 +113,12 @@ class SystemMenu extends React.Component { | @@ -102,13 +113,12 @@ class SystemMenu extends React.Component { | ||
102 | } else { | 113 | } else { |
103 | return ( | 114 | return ( |
104 | <Menu.Item key={menu.module} > | 115 | <Menu.Item key={menu.module} > |
105 | - <span className="nav-text"> | ||
106 | - <img style={{ width: '12px', marginRight: '8px', verticalAlign: 'baseline' }} src={menuIconMap[menu.module]} alt="" /> | ||
107 | - {menu.display_name} | ||
108 | - {/* {menu && menu.is_beta && menu.is_beta == 'y' && <span style={{ color: 'rgba(153, 169, 191,0.6)' }}>( 试用 )</span>} */} | ||
109 | - {/* TODO: 先写死 */} | ||
110 | - {menu && menu.module && menu.module == 'persontax' && <span className={cx(s.menu_new)}></span>} | ||
111 | - </span> | 116 | + <img |
117 | + style={{ width: '20px', position: 'relative', top: '-2px', right: '5px' }} | ||
118 | + src={menuIconMap[menu.module]} alt="" /> | ||
119 | + <span>{menu.display_name}</span> | ||
120 | + {/* 自然人税收 new图标 */} | ||
121 | + {menu && menu.module && menu.module == 'persontax' && <span className={cx(s.menu_new)}></span>} | ||
112 | </Menu.Item> | 122 | </Menu.Item> |
113 | ) | 123 | ) |
114 | } | 124 | } |
1 | +import React, { PropTypes } from 'react'; | ||
2 | +import { connect } from 'react-redux'; | ||
3 | +import { Steps, Icon, Breadcrumb } from 'antd'; | ||
4 | +const Step = Steps.Step; | ||
5 | +import cx from 'classnames'; | ||
6 | +import s from './commond.les'; | ||
7 | + | ||
8 | + | ||
9 | +class BreadcrumbWarp extends React.Component { | ||
10 | + constructor(props) { | ||
11 | + super(props); | ||
12 | + this.state = { | ||
13 | + } | ||
14 | + } | ||
15 | + static propTypes = { | ||
16 | + crumbsData: PropTypes.array | ||
17 | + } | ||
18 | + | ||
19 | + componentDidMount() { | ||
20 | + } | ||
21 | + componentWillReceiveProps(nextProps) { | ||
22 | + } | ||
23 | + componentWillUnmount() { | ||
24 | + } | ||
25 | + render() { | ||
26 | + const { crumbsData = [] } = this.props; | ||
27 | + return ( | ||
28 | + <div className={cx(s.bread_crumb_warp)}> | ||
29 | + <span className={cx(s.bread_crumb_title)}>当前位置:</span> | ||
30 | + <ul className={cx(s.bread_crumb_con)}> | ||
31 | + { | ||
32 | + crumbsData.map((data, i) => { | ||
33 | + return ( | ||
34 | + <li onClick={() => { document.location.href = data.link }} key={i}><span className={cx(s.text)}>{data.name}</span></li> | ||
35 | + ) | ||
36 | + }) | ||
37 | + } | ||
38 | + </ul> | ||
39 | + </div> | ||
40 | + ) | ||
41 | + } | ||
42 | +} | ||
43 | + | ||
44 | +export default BreadcrumbWarp; |
src/components/commondComponents/commond.les
0 → 100644
1 | +@import "../../less/variables"; | ||
2 | +.new_steps_warp{ | ||
3 | + display :flex; | ||
4 | + text-align:center; | ||
5 | + position :relative; | ||
6 | + li{ | ||
7 | + flex:1; | ||
8 | + border-top:3px solid #efefef; | ||
9 | + .step_warp{ | ||
10 | + .step_num{ | ||
11 | + color :#fff; | ||
12 | + margin :16px auto 12px; | ||
13 | + width :24px; | ||
14 | + height :24px; | ||
15 | + line-height :24px; | ||
16 | + border-radius :50%; | ||
17 | + background-color:#bcc9d4; | ||
18 | + cursor :pointer; | ||
19 | + } | ||
20 | + .step_text{ | ||
21 | + font-size :14px; | ||
22 | + color :#333; | ||
23 | + font-weight:normal; | ||
24 | + } | ||
25 | + } | ||
26 | + } | ||
27 | + .beforeCurrent{ | ||
28 | + span:before{ | ||
29 | + content :' '; | ||
30 | + display :block; | ||
31 | + width :0; | ||
32 | + border-top :3px solid #519FF0; | ||
33 | + -webkit-transition:all .6s ease-in-out; | ||
34 | + transition :all .6s ease-in-out; | ||
35 | + box-shadow :0 0 0 0 #519FF0; | ||
36 | + -webkit-animation :tailEffect .6s; | ||
37 | + animation :tailEffect .6s; | ||
38 | + position :relative; | ||
39 | + top :-3px; | ||
40 | + } | ||
41 | + } | ||
42 | + .current{ | ||
43 | + .step_warp{ | ||
44 | + .step_num{ | ||
45 | + background-color:#519FF0; | ||
46 | + } | ||
47 | + } | ||
48 | + span:before{ | ||
49 | + content :' '; | ||
50 | + display :block; | ||
51 | + width :100%; | ||
52 | + border-top :3px solid #519FF0; | ||
53 | + -webkit-transition:all .6s ease-in-out; | ||
54 | + transition :all .6s ease-in-out; | ||
55 | + box-shadow :0 0 0 0 #519FF0; | ||
56 | + -webkit-animation :tailEffect .6s; | ||
57 | + animation :tailEffect .6s; | ||
58 | + position :relative; | ||
59 | + top :-3px; | ||
60 | + } | ||
61 | + } | ||
62 | +} | ||
63 | + | ||
64 | +.new_tabs_warp{ | ||
65 | + .new_tabs_head{ | ||
66 | + display:flex; | ||
67 | + //border :1px solid #E5E5E5; | ||
68 | + li{ | ||
69 | + flex :1; | ||
70 | + text-align :center; | ||
71 | + padding :16px 0; | ||
72 | + background-color:#f6f8fa; | ||
73 | + font-size :14px; | ||
74 | + a{ | ||
75 | + color : #333; | ||
76 | + padding:0 24px 16px; | ||
77 | + } | ||
78 | + } | ||
79 | + .current{ | ||
80 | + a{ | ||
81 | + color : #1089ee; | ||
82 | + border-bottom:3px solid #519FF0; | ||
83 | + } | ||
84 | + } | ||
85 | + li{ | ||
86 | + a:hover{ | ||
87 | + color:#1089ee; | ||
88 | + } | ||
89 | + } | ||
90 | + } | ||
91 | + .new_tabs_con{ | ||
92 | + padding:24px; | ||
93 | + } | ||
94 | +} | ||
95 | + | ||
96 | +.recomand_warp{ | ||
97 | + margin :32px; | ||
98 | + padding :10px 32px; | ||
99 | + background-color :#f8f8f8; | ||
100 | + border-top-left-radius:10px; | ||
101 | + border-bottom-right-radius:10px; | ||
102 | + | ||
103 | + .img{ | ||
104 | + width :18px; | ||
105 | + height :auto; | ||
106 | + margin-right :10px; | ||
107 | + vertical-align:middle; | ||
108 | + } | ||
109 | + .text{ | ||
110 | + vertical-align:middle; | ||
111 | + font-size :14px; | ||
112 | + color :#999; | ||
113 | + } | ||
114 | +} | ||
115 | +.bg_recomand_warp{ | ||
116 | + padding :12px 24px; | ||
117 | + background-color:#fff5d5; | ||
118 | + color :#f2942e; | ||
119 | + border-radius :4px; | ||
120 | +} | ||
121 | + | ||
122 | +.simple_tabs_warp{ | ||
123 | + .simple_tabs_head{ | ||
124 | + border-bottom :1px solid #E5E5E5; | ||
125 | + li{ | ||
126 | + display :inline-block; | ||
127 | + padding-bottom :16px; | ||
128 | + font-size :14px; | ||
129 | + a{ | ||
130 | + color :#333; | ||
131 | + padding :0 8px 16px; | ||
132 | + margin-right:32px; | ||
133 | + } | ||
134 | + } | ||
135 | + .current{ | ||
136 | + a{ | ||
137 | + color : #1089ee; | ||
138 | + border-bottom:2px solid #519FF0; | ||
139 | + } | ||
140 | + } | ||
141 | + li{ | ||
142 | + a:hover{ | ||
143 | + color:#1089ee; | ||
144 | + } | ||
145 | + } | ||
146 | + } | ||
147 | + .simple_tabs_con{ | ||
148 | + padding:24px 0; | ||
149 | + } | ||
150 | + .simple_tabs_btn_head{ | ||
151 | + text-align: center; | ||
152 | + li{ | ||
153 | + display :inline-block; | ||
154 | + font-size:14px; | ||
155 | + border :1px solid #E5E5E5; | ||
156 | + a{ | ||
157 | + display:inline-block; | ||
158 | + padding:8px 24px; | ||
159 | + color :#333; | ||
160 | + } | ||
161 | + } | ||
162 | + li{ | ||
163 | + border-right:none; | ||
164 | + } | ||
165 | + li:first-child{ | ||
166 | + border-top-left-radius :4px; | ||
167 | + border-bottom-left-radius:4px; | ||
168 | + } | ||
169 | + li:last-child{ | ||
170 | + border-right:1px solid #E5E5E5; | ||
171 | + border-top-right-radius :4px; | ||
172 | + border-bottom-right-radius:4px; | ||
173 | + } | ||
174 | + li:hover{ | ||
175 | + border :1px solid #E5E5E5; | ||
176 | + border-right:none; | ||
177 | + a{ | ||
178 | + color:#1089ee; | ||
179 | + } | ||
180 | + } | ||
181 | + li:last-child:hover{ | ||
182 | + border-right:1px solid #E5E5E5; | ||
183 | + } | ||
184 | + .current{ | ||
185 | + border :1px solid #1089ee; | ||
186 | + border-right :none; | ||
187 | + background-color:#1089ee; | ||
188 | + a{ | ||
189 | + color : #fff; | ||
190 | + } | ||
191 | + } | ||
192 | + .current:hover{ | ||
193 | + border : 1px solid #1089ee; | ||
194 | + border-right :none; | ||
195 | + a{ | ||
196 | + color : #fff; | ||
197 | + } | ||
198 | + } | ||
199 | + } | ||
200 | + .simple_tabs_bg_head{ | ||
201 | + //background-color:#f0f0f0; | ||
202 | + border-bottom:1px solid #EDEFF2; | ||
203 | + li{ | ||
204 | + display :inline-block; | ||
205 | + font-size:14px; | ||
206 | + position : relative; | ||
207 | + -webkit-transition: all 0.4s ease-in-out 0s; | ||
208 | + -moz-transition: all 0.4s ease-in-out 0s; | ||
209 | + -o-transition: all 0.4s ease-in-out 0s; | ||
210 | + -ms-transition: all 0.4s ease-in-out 0s; | ||
211 | + a{ | ||
212 | + display:inline-block; | ||
213 | + padding:12px 32px 14px; | ||
214 | + color :#333; | ||
215 | + } | ||
216 | + } | ||
217 | + .current{ | ||
218 | + background-color:#fff; | ||
219 | + a{ | ||
220 | + color : #1089ee; | ||
221 | + } | ||
222 | + } | ||
223 | + .current:before{ | ||
224 | + content : ' '; | ||
225 | + border-top: 3px solid #1089ee; | ||
226 | + transition: width 1s linear; | ||
227 | + width : 100%; | ||
228 | + display : inline-block; | ||
229 | + position : absolute; | ||
230 | + bottom : 0; | ||
231 | + } | ||
232 | + li:hover{ | ||
233 | + a{ | ||
234 | + color:#1089ee; | ||
235 | + } | ||
236 | + } | ||
237 | + } | ||
238 | +} | ||
239 | + | ||
240 | +.info_img{ | ||
241 | + width :32px; | ||
242 | + height:32px; | ||
243 | +} | ||
244 | + | ||
245 | +.map_warp{ | ||
246 | + position: relative; | ||
247 | + .search_input_wrap{ | ||
248 | + width: 240px; | ||
249 | + position: absolute; | ||
250 | + z-index: 1000; | ||
251 | + left: 5px; | ||
252 | + top: 5px; | ||
253 | + } | ||
254 | +} | ||
255 | + | ||
256 | +.textAlign{ | ||
257 | + text-align:center; | ||
258 | + margin:10px 0 30px 0; | ||
259 | +} | ||
260 | +.all_map_warp{ | ||
261 | + position: fixed; | ||
262 | + top: 0; | ||
263 | + left: 0; | ||
264 | + right: 0; | ||
265 | + bottom: 0; | ||
266 | + z-index: 99999; | ||
267 | + .search_input_wrap{ | ||
268 | + width: 240px; | ||
269 | + position: absolute; | ||
270 | + z-index: 1000; | ||
271 | + left: 5px; | ||
272 | + top: 5px; | ||
273 | + } | ||
274 | +} | ||
275 | +.full_screen_btn{ | ||
276 | + position: absolute; | ||
277 | + z-index: 1000; | ||
278 | + right:16px; | ||
279 | + top:8px; | ||
280 | + cursor:pointer; | ||
281 | + color: @link-color; | ||
282 | +} | ||
283 | +.upload_warp_style_con{ | ||
284 | + //font-size:13px; | ||
285 | + color :#333; | ||
286 | + .upload_warp_style{ | ||
287 | + width : 100%; | ||
288 | + border : 1px solid #e9e9e9; | ||
289 | + background: #F9FAFC; | ||
290 | + .upload_file{ | ||
291 | + text-align : center; | ||
292 | + margin : 8px; | ||
293 | + height : 235px; | ||
294 | + border : 1px dashed #e9e9e9; | ||
295 | + } | ||
296 | + .upload_file.upload_file_new{ | ||
297 | + height : 160px; | ||
298 | + } | ||
299 | + .request_text_warp{ | ||
300 | + padding : 24px 24px 16px; | ||
301 | + background-color: #f9fafc; | ||
302 | + position :relative; | ||
303 | + .text_title{ | ||
304 | + font-weight:bold; | ||
305 | + } | ||
306 | + .text_con{ | ||
307 | + margin-top :8px; | ||
308 | + color :#999; | ||
309 | + line-height:2; | ||
310 | + } | ||
311 | + } | ||
312 | + } | ||
313 | + .upload_file_name{ | ||
314 | + margin:16px 0 0 4px; | ||
315 | + .img{ | ||
316 | + vertical-align:middle; | ||
317 | + } | ||
318 | + .name{ | ||
319 | + color :#7e7e7e; | ||
320 | + margin-left :8px; | ||
321 | + vertical-align:middle; | ||
322 | + } | ||
323 | + } | ||
324 | +} | ||
325 | + | ||
326 | +.info_img{ | ||
327 | + width :32px; | ||
328 | + height:32px; | ||
329 | +} | ||
330 | + | ||
331 | +.map_warp{ | ||
332 | + position: relative; | ||
333 | + .search_input_wrap{ | ||
334 | + width: 240px; | ||
335 | + position: absolute; | ||
336 | + z-index: 1000; | ||
337 | + left: 5px; | ||
338 | + top: 5px; | ||
339 | + } | ||
340 | +} | ||
341 | +.bread_crumb_warp{ | ||
342 | + font-size:14px; | ||
343 | + color :rgba(0, 0, 0, 0.45); | ||
344 | + background:#fff; | ||
345 | + .bread_crumb_title{ | ||
346 | + display:inline-block; | ||
347 | + margin-right:8px; | ||
348 | + } | ||
349 | + .bread_crumb_con{ | ||
350 | + display:inline-block; | ||
351 | + li{ | ||
352 | + display:inline-block; | ||
353 | + cursor :pointer; | ||
354 | + } | ||
355 | + li:hover{ | ||
356 | + .text{ | ||
357 | + color:@light-text-blue-color; | ||
358 | + } | ||
359 | + } | ||
360 | + .isLink{ | ||
361 | + cursor :pointer; | ||
362 | + &:hover{ | ||
363 | + color:@light-text-blue-color; | ||
364 | + } | ||
365 | + } | ||
366 | + .notLink{ | ||
367 | + cursor :text; | ||
368 | + &:hover{ | ||
369 | + //color:@text-blue-color; | ||
370 | + } | ||
371 | + } | ||
372 | + | ||
373 | + li:after{ | ||
374 | + content :'>'; | ||
375 | + width :24px; | ||
376 | + margin :0 6px; | ||
377 | + font-size:16px; | ||
378 | + color:#999; | ||
379 | + } | ||
380 | + li:last-child:after{ | ||
381 | + content:' '; | ||
382 | + } | ||
383 | + li:last-child{ | ||
384 | + cursor:text; | ||
385 | + color:@light-text-blue-color; | ||
386 | + .text{ | ||
387 | + color:@light-text-blue-color; | ||
388 | + } | ||
389 | + } | ||
390 | + } | ||
391 | +} | ||
392 | + | ||
393 | +.mapping_excel_columns_wrp{ | ||
394 | + border :1px dashed transparent; | ||
395 | + display :inline-block; | ||
396 | + margin :0 8px 8px 0; | ||
397 | + padding :2px 8px; | ||
398 | + text-align :center; | ||
399 | + .border_style{ | ||
400 | + display :inline-block; | ||
401 | + border :1px dashed #d9d9d9; | ||
402 | + border-radius:2px; | ||
403 | + padding :2px 8px; | ||
404 | + margin-bottom:8px; | ||
405 | + min-width :130px; | ||
406 | + background-color:#fff; | ||
407 | + } | ||
408 | +} | ||
409 | +.mapping_excel_columns_wrp_drop{ | ||
410 | + border :1px dashed #008dff; | ||
411 | + border-radius:2px; | ||
412 | +} | ||
413 | +.mapping_tag_warp{ | ||
414 | + min-width :130px; | ||
415 | + cursor :move; | ||
416 | + display :inline-block; | ||
417 | + margin :0 8px 8px 0; | ||
418 | + border :1px dashed #d9d9d9; | ||
419 | + padding :2px 8px; | ||
420 | + text-align :center; | ||
421 | + background-color:#fff; | ||
422 | + border-radius:2px; | ||
423 | +} | ||
424 | + | ||
425 | +.mapping_columns_warp{ | ||
426 | + .column_title{ | ||
427 | + min-width:1000px; | ||
428 | + margin : 8px 0 24px; | ||
429 | + color : #1F2D3D; | ||
430 | + .mapping_tip_warp{ | ||
431 | + min-width : 130px; | ||
432 | + display : inline-block; | ||
433 | + margin-left: 8px; | ||
434 | + color : #999; | ||
435 | + font-size : 12px; | ||
436 | + font-weight:normal; | ||
437 | + .tip_img{ | ||
438 | + width : 16px; | ||
439 | + vertical-align: middle; | ||
440 | + margin-right : 6px; | ||
441 | + margin-top : -4px; | ||
442 | + } | ||
443 | + } | ||
444 | + } | ||
445 | + .excel_column_wrap{ | ||
446 | + max-height: 170px; | ||
447 | + overflow: auto; | ||
448 | + } | ||
449 | + .excel_column_wrap,.sys_column_wrap{ | ||
450 | + border : 1px solid #efefef; | ||
451 | + border-radius: 5px; | ||
452 | + padding : 8px 16px; | ||
453 | + background : #EEF4F8; | ||
454 | + .inline_block{ | ||
455 | + display : inline-block; | ||
456 | + text-align : center; | ||
457 | + min-height : 47px; | ||
458 | + margin-bottom : 13px; | ||
459 | + vertical-align: top; | ||
460 | + position : relative; | ||
461 | + .drop_mapping_tag_warp{ | ||
462 | + .drop_mapping_tag{ | ||
463 | + position :relative; | ||
464 | + min-width :130px; | ||
465 | + cursor :move; | ||
466 | + display :block; | ||
467 | + border :1px dashed #d9d9d9; | ||
468 | + padding :2px 8px; | ||
469 | + border-radius:2px; | ||
470 | + background-color:#fff; | ||
471 | + .icon_style{ | ||
472 | + color :#f81d22; | ||
473 | + position:absolute; | ||
474 | + right :-2px; | ||
475 | + top :-2px; | ||
476 | + cursor :pointer; | ||
477 | + } | ||
478 | + } | ||
479 | + } | ||
480 | + } | ||
481 | + } | ||
482 | +} |
1 | +import React, { PropTypes } from 'react'; | ||
2 | +import { connect } from 'react-redux'; | ||
3 | +import { Steps, Icon, Breadcrumb } from 'antd'; | ||
4 | +const Step = Steps.Step; | ||
5 | +import cx from 'classnames'; | ||
6 | +import s from './commond.les'; | ||
7 | + | ||
8 | + | ||
9 | +class BreadcrumbWarp extends React.Component { | ||
10 | + constructor(props) { | ||
11 | + super(props); | ||
12 | + this.state = { | ||
13 | + } | ||
14 | + } | ||
15 | + static propTypes = { | ||
16 | + crumbsData: PropTypes.array | ||
17 | + } | ||
18 | + | ||
19 | + componentDidMount() { | ||
20 | + } | ||
21 | + componentWillReceiveProps(nextProps) { | ||
22 | + } | ||
23 | + componentWillUnmount() { | ||
24 | + } | ||
25 | + render() { | ||
26 | + const { crumbsData = [] } = this.props; | ||
27 | + return ( | ||
28 | + <div className={cx(s.bread_crumb_warp)}> | ||
29 | + <span className={cx(s.bread_crumb_title)}>当前位置:</span> | ||
30 | + <ul className={cx(s.bread_crumb_con)}> | ||
31 | + { | ||
32 | + crumbsData.map((data, i) => { | ||
33 | + return ( | ||
34 | + <li onClick={() => { document.location.href = data.link }} key={i} className={data.isLink ? cx(s.isLink) : cx(s.notLink)}> | ||
35 | + <span className={data.isLink ? cx(s.text) : null}>{data.name}</span> | ||
36 | + </li> | ||
37 | + ) | ||
38 | + }) | ||
39 | + } | ||
40 | + </ul> | ||
41 | + </div> | ||
42 | + ) | ||
43 | + } | ||
44 | +} | ||
45 | + | ||
46 | +export default BreadcrumbWarp; |
@@ -11,6 +11,10 @@ | @@ -11,6 +11,10 @@ | ||
11 | height: 14px; | 11 | height: 14px; |
12 | top: -4px; | 12 | top: -4px; |
13 | left: 4px; | 13 | left: 4px; |
14 | - background: url(./img/menu_new.png) no-repeat; | 14 | + background: url(../img/menu_new.png) no-repeat; |
15 | background-size: 100% 100%; | 15 | background-size: 100% 100%; |
16 | +} | ||
17 | + | ||
18 | +:global .ant-menu-inline-collapsed-tooltip { | ||
19 | + min-width: 160px; | ||
16 | } | 20 | } |
@@ -188,7 +188,7 @@ | @@ -188,7 +188,7 @@ | ||
188 | } | 188 | } |
189 | 189 | ||
190 | .task_node_wrap{ | 190 | .task_node_wrap{ |
191 | - background: url($http+"/img/line-bg.png") repeat-y 30px 0; | 191 | + background: url($http+"./img/line-bg.png") repeat-y 30px 0; |
192 | } | 192 | } |
193 | .task_node_icon{ | 193 | .task_node_icon{ |
194 | width: 30px; | 194 | width: 30px; |
@@ -94,7 +94,7 @@ | @@ -94,7 +94,7 @@ | ||
94 | border-radius: 5px; | 94 | border-radius: 5px; |
95 | padding:13px 5px 10px 26px; | 95 | padding:13px 5px 10px 26px; |
96 | color: #a5a5a5; | 96 | color: #a5a5a5; |
97 | - background: url($http+"/img/icon-support.png") no-repeat 5px 50%; | 97 | + background: url($http+"./img/icon-support.png") no-repeat 5px 50%; |
98 | } | 98 | } |
99 | .ui_btn{ | 99 | .ui_btn{ |
100 | cursor: pointer; | 100 | cursor: pointer; |
@@ -42,7 +42,7 @@ class Member extends React.Component { | @@ -42,7 +42,7 @@ class Member extends React.Component { | ||
42 | return( | 42 | return( |
43 | <div className={cx(s.member_token)} onClick={this.onClick}> | 43 | <div className={cx(s.member_token)} onClick={this.onClick}> |
44 | {choiceType=='multi'&&<input type="checkbox" checked={checked} onChange={this.onChange}/>} | 44 | {choiceType=='multi'&&<input type="checkbox" checked={checked} onChange={this.onChange}/>} |
45 | - <Gravatar path={imageUrl||'/img/user.jpg'} size='60'></Gravatar> | 45 | + <Gravatar path={imageUrl||'./img/user.jpg'} size='60'></Gravatar> |
46 | <div className={cx(s.member_info)}> | 46 | <div className={cx(s.member_info)}> |
47 | <div className={cx(s.member_info_item)}>{name}</div> | 47 | <div className={cx(s.member_info_item)}>{name}</div> |
48 | </div> | 48 | </div> |
@@ -40,7 +40,7 @@ class MyList extends React.Component { | @@ -40,7 +40,7 @@ class MyList extends React.Component { | ||
40 | </a> | 40 | </a> |
41 | } | 41 | } |
42 | <Member checked={false} myself={false} | 42 | <Member checked={false} myself={false} |
43 | - imageUrl='http://localhost:3001//img/user.jpg' name={item.name} uuid={item.uuid} onClick={onChoose} onChange={onChange} choiceType={choiceType}/> | 43 | + imageUrl='http://localhost:3001/./img/user.jpg' name={item.name} uuid={item.uuid} onClick={onChoose} onChange={onChange} choiceType={choiceType}/> |
44 | </div>); | 44 | </div>); |
45 | 45 | ||
46 | // return <div {...props}> {item.name} </div> | 46 | // return <div {...props}> {item.name} </div> |
@@ -92,7 +92,7 @@ | @@ -92,7 +92,7 @@ | ||
92 | border-radius: 5px; | 92 | border-radius: 5px; |
93 | padding:13px 5px 10px 26px; | 93 | padding:13px 5px 10px 26px; |
94 | color: #a5a5a5; | 94 | color: #a5a5a5; |
95 | - background: url($http+"/img/icon-support.png") no-repeat 5px 50%; | 95 | + background: url($http+"./img/icon-support.png") no-repeat 5px 50%; |
96 | } | 96 | } |
97 | .ui_btn{ | 97 | .ui_btn{ |
98 | cursor: pointer; | 98 | cursor: pointer; |
此 diff 太大无法显示。
@@ -154,7 +154,7 @@ export class RongClundWrap extends React.Component { | @@ -154,7 +154,7 @@ export class RongClundWrap extends React.Component { | ||
154 | return ( | 154 | return ( |
155 | <li key={i} className={cx(user.senderUserId==selecedUser?s.seleced:null)} onClick={this.selecedUser.bind(this,user)}> | 155 | <li key={i} className={cx(user.senderUserId==selecedUser?s.seleced:null)} onClick={this.selecedUser.bind(this,user)}> |
156 | <Badge count={user.count}> | 156 | <Badge count={user.count}> |
157 | - <img src="/img/招聘头像.png" alt=""/> | 157 | + <img src="./img/招聘头像.png" alt=""/> |
158 | </Badge> | 158 | </Badge> |
159 | <span>{user.name}</span> | 159 | <span>{user.name}</span> |
160 | </li> | 160 | </li> |
@@ -180,7 +180,7 @@ export class RongClundWrap extends React.Component { | @@ -180,7 +180,7 @@ export class RongClundWrap extends React.Component { | ||
180 | return ( | 180 | return ( |
181 | <div className={cx(s.messages_item_wrap,s.left)} key={i}> | 181 | <div className={cx(s.messages_item_wrap,s.left)} key={i}> |
182 | <img style={{width:'24px',height:'24px',borderRadius:'50%',marginRight:'4px'}} | 182 | <img style={{width:'24px',height:'24px',borderRadius:'50%',marginRight:'4px'}} |
183 | - onError={()=>{this.setState({userImg:'/img/招聘头像.png'})}} src={userImg?userImg:`https://hropublic.oss-cn-beijing.aliyuncs.com/user_image/users/${msg.senderUserId}?t=${new Date().getTime()}`} | 183 | + onError={()=>{this.setState({userImg:'./img/招聘头像.png'})}} src={userImg?userImg:`https://hropublic.oss-cn-beijing.aliyuncs.com/user_image/users/${msg.senderUserId}?t=${new Date().getTime()}`} |
184 | alt=""/> | 184 | alt=""/> |
185 | <span className={cx(s.messages_item_body)}>{msg.content}</span> | 185 | <span className={cx(s.messages_item_body)}>{msg.content}</span> |
186 | </div> | 186 | </div> |
@@ -422,7 +422,7 @@ class SimpEditor extends React.Component { | @@ -422,7 +422,7 @@ class SimpEditor extends React.Component { | ||
422 | 'alignment' | 422 | 'alignment' |
423 | ], | 423 | ], |
424 | emoji: { | 424 | emoji: { |
425 | - imagePath: '/img/emoji/' | 425 | + imagePath: './img/emoji/' |
426 | }, | 426 | }, |
427 | defaultImage: '/content/images/empty.png', | 427 | defaultImage: '/content/images/empty.png', |
428 | upload: { | 428 | upload: { |
@@ -5,6 +5,7 @@ import s from './uploader.les'; | @@ -5,6 +5,7 @@ import s from './uploader.les'; | ||
5 | import * as fetch from '../../utils/fetch'; | 5 | import * as fetch from '../../utils/fetch'; |
6 | import { getTokenForFile } from '../../utils/fileUtil'; | 6 | import { getTokenForFile } from '../../utils/fileUtil'; |
7 | import { notification } from 'antd'; | 7 | import { notification } from 'antd'; |
8 | +import customer from '../../containers/customer'; | ||
8 | import { extractResumeAct, analyzeCandidateResume, startAnalyze, cleanAnalyze } from '../../redux/actions/recruit'; | 9 | import { extractResumeAct, analyzeCandidateResume, startAnalyze, cleanAnalyze } from '../../redux/actions/recruit'; |
9 | 10 | ||
10 | let max_file_size_props = "20mb" | 11 | let max_file_size_props = "20mb" |
@@ -39,6 +40,7 @@ export class UploadWrap extends React.Component { | @@ -39,6 +40,7 @@ export class UploadWrap extends React.Component { | ||
39 | keyNum: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | 40 | keyNum: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), |
40 | max_file_size: PropTypes.string, | 41 | max_file_size: PropTypes.string, |
41 | maskShow: PropTypes.bool, | 42 | maskShow: PropTypes.bool, |
43 | + completeCallBack:PropTypes.func | ||
42 | } | 44 | } |
43 | static defaultProps = { | 45 | static defaultProps = { |
44 | maxFileSize: 10, | 46 | maxFileSize: 10, |
@@ -59,6 +61,7 @@ export class UploadWrap extends React.Component { | @@ -59,6 +61,7 @@ export class UploadWrap extends React.Component { | ||
59 | errorCallBack: () => { }, | 61 | errorCallBack: () => { }, |
60 | max_file_size: '20mb', | 62 | max_file_size: '20mb', |
61 | addFileName: false, | 63 | addFileName: false, |
64 | + completeCallBack: () => {} | ||
62 | } | 65 | } |
63 | uploadBtn() { | 66 | uploadBtn() { |
64 | const self = this; | 67 | const self = this; |
@@ -193,13 +196,13 @@ export class UploadWrap extends React.Component { | @@ -193,13 +196,13 @@ export class UploadWrap extends React.Component { | ||
193 | self.props.backResult(file); | 196 | self.props.backResult(file); |
194 | }, | 197 | }, |
195 | FileUploaded: function (up, file, info) { | 198 | FileUploaded: function (up, file, info) { |
196 | - | 199 | + // console.log('upupupupupu',up) |
197 | const { files = [] } = up; | 200 | const { files = [] } = up; |
198 | - console.log('filesfilesfilesfilesfiles', info, info.response); | 201 | + // console.log('filesfilesfilesfilesfiles', info, info.response); |
199 | if (info && info.response) { | 202 | if (info && info.response) { |
200 | const backInfo = JSON.parse(info.response); | 203 | const backInfo = JSON.parse(info.response); |
201 | if ('${filename}' == backInfo.name) { | 204 | if ('${filename}' == backInfo.name) { |
202 | - backInfo.name = backInfo.object.substring(backInfo.object.lastIndexOf('/') + 1); | 205 | + backInfo.name = backInfo.object.substring(backInfo.object.lastIndexOf('/')+1); |
203 | } | 206 | } |
204 | if (backInfo && backInfo.path) { | 207 | if (backInfo && backInfo.path) { |
205 | const name = backInfo.path.substring(backInfo.path.lastIndexOf('/') + 1); // '/' 换成 '.'' | 208 | const name = backInfo.path.substring(backInfo.path.lastIndexOf('/') + 1); // '/' 换成 '.'' |
@@ -210,7 +213,11 @@ export class UploadWrap extends React.Component { | @@ -210,7 +213,11 @@ export class UploadWrap extends React.Component { | ||
210 | self.props.endCallBack({ 'err': 'upload fail' }); | 213 | self.props.endCallBack({ 'err': 'upload fail' }); |
211 | } | 214 | } |
212 | }, | 215 | }, |
213 | - UploadComplete: function (up, files) { }, | 216 | + UploadComplete: function (up, files) { |
217 | + console.log('upupupup',up) | ||
218 | + console.log('filesfilesfilesfiles',files) | ||
219 | + self.props.completeCallBack() | ||
220 | + }, | ||
214 | Error: function (up, err) { | 221 | Error: function (up, err) { |
215 | 222 | ||
216 | // 上传过程中 如果有任何报错,将上传成功的文件保留,其余的剔除出上传队列 | 223 | // 上传过程中 如果有任何报错,将上传成功的文件保留,其余的剔除出上传队列 |
src/components/widget/UploadWrap备份.js
0 → 100644
1 | +import React,{PropTypes} from 'react'; | ||
2 | +import { connect } from 'react-redux'; | ||
3 | +import cx from 'classnames'; | ||
4 | +import s from './uploader.les'; | ||
5 | +import * as fetch from '../../utils/fetch'; | ||
6 | +import { getTokenForFile } from '../../utils/fileUtil'; | ||
7 | +import { notification } from 'antd'; | ||
8 | +import customer from '../../containers/customer'; | ||
9 | + | ||
10 | +export class UploadWrap extends React.Component { | ||
11 | + constructor(props) { | ||
12 | + super(props); | ||
13 | + this.removeAllFile = this.removeAllFile.bind(this); | ||
14 | + this.removeFile = this.removeFile.bind(this); | ||
15 | + this.upload = this.upload.bind(this); | ||
16 | + this.transformModel = this.transformModel.bind(this); | ||
17 | + this.state={ | ||
18 | + timeStamp:Date.parse(new Date()) | ||
19 | + } | ||
20 | + } | ||
21 | + static propTypes = { | ||
22 | + type : PropTypes.string, | ||
23 | + maxFileSize: PropTypes.number, | ||
24 | + onChange : PropTypes.func, | ||
25 | + backResult : PropTypes.func, | ||
26 | + endCallBack: PropTypes.func, | ||
27 | + autoUpload : PropTypes.bool, | ||
28 | + style : PropTypes.object, | ||
29 | + extra : PropTypes.object, | ||
30 | + single : PropTypes.bool, | ||
31 | + extension : PropTypes.bool, | ||
32 | + useFileName: PropTypes.bool, | ||
33 | + autoName : PropTypes.bool, | ||
34 | + mimeTypes : PropTypes.object, | ||
35 | + multiple : PropTypes.bool, | ||
36 | + keyNum : PropTypes.oneOfType([ PropTypes.string,PropTypes.number ]), | ||
37 | + max_file_size: PropTypes.string, | ||
38 | + maskShow: PropTypes.bool, | ||
39 | + } | ||
40 | + static defaultProps = { | ||
41 | + maxFileSize:10, | ||
42 | + autoUpload :false, | ||
43 | + single :true, | ||
44 | + extra :{}, | ||
45 | + extension :true, | ||
46 | + useFileName:false, | ||
47 | + autoName :false, | ||
48 | + multiple :false, | ||
49 | + mimeTypes :{}, | ||
50 | + keyNum :'1', | ||
51 | + maskShow:false, | ||
52 | + backResult :()=>{ }, | ||
53 | + onChange :()=>{ }, | ||
54 | + endCallBack:()=>{ }, | ||
55 | + max_file_size:'10mb' | ||
56 | + } | ||
57 | + uploadBtn(){ | ||
58 | + const self=this; | ||
59 | + const {only=false, type,extra,name='${filename}',extension,useFileName,autoName,multiple, customerUrl = '',}=this.props; | ||
60 | + const maskShow = self.props.maskShow | ||
61 | + self.props.dispatch({ type: 'MASK_SHOW', maskShow }) | ||
62 | + getTokenForFile(type,'web_upload').then(data=>{ | ||
63 | + let Name,fileName,extensionName; | ||
64 | + if(only){ | ||
65 | + Name=name; | ||
66 | + }else{ | ||
67 | + const last=self.uploader.files[0]['name'] | ||
68 | + const num=last.lastIndexOf('.'); | ||
69 | + const lastName=last.substring(num); | ||
70 | + Name=name+lastName; | ||
71 | + fileName=last; | ||
72 | + extensionName=lastName | ||
73 | + } | ||
74 | + let url = autoName?data.object_path+'/'+Date.parse(new Date()):useFileName?data.object_path+'/'+fileName:extension?data.object_path+extensionName:data.object_path | ||
75 | + if (customerUrl) { | ||
76 | + url = customerUrl | ||
77 | + } | ||
78 | + | ||
79 | + self.uploader.ossToken=data; | ||
80 | + const optionParam = { | ||
81 | + 'url' :'https://'+data.bucket+"."+data.domain+'/', | ||
82 | + // 'multi_selection' : multiple, | ||
83 | + 'multipart_params' :{ | ||
84 | + 'Filename' : Name, | ||
85 | + OSSAccessKeyId :data.access_key_id, | ||
86 | + key : url, | ||
87 | + policy :data.policy, | ||
88 | + signature :data.signature, | ||
89 | + callback :data.callback_body, | ||
90 | + 'x:access_token': data.callback_token, | ||
91 | + 'x:name' : fileName, | ||
92 | + success_action_status:'200' | ||
93 | + } | ||
94 | + } | ||
95 | + if(multiple){ | ||
96 | + optionParam.multipart_params.key=data.object_path+'/${filename}'; | ||
97 | + optionParam.multipart_params['x:name']='${filename}'; | ||
98 | + optionParam.multipart_params.Filename='${filename}'; | ||
99 | + } | ||
100 | + self.uploader.setOption(optionParam); | ||
101 | + self.uploader.start(); | ||
102 | + }).catch(err => { throw err; }); | ||
103 | + } | ||
104 | + upload(){ | ||
105 | + this.uploadBtn(); | ||
106 | + } | ||
107 | + removeAllFile(files){ | ||
108 | + const self = this; | ||
109 | + let delFiles = this.uploader.files; | ||
110 | + if(files){ | ||
111 | + delFiles = files; | ||
112 | + } | ||
113 | + if(delFiles){ | ||
114 | + delFiles.map((file,i)=>{ | ||
115 | + self.uploader.removeFile(file); | ||
116 | + }) | ||
117 | + } | ||
118 | + } | ||
119 | + removeFile(file){ | ||
120 | + this.uploader.removeFile(file); | ||
121 | + } | ||
122 | + transformModel(backInfo){ | ||
123 | + const modal = Object.assign({}, backInfo, { | ||
124 | + "file_id" : backInfo.uuid, | ||
125 | + "target_type": backInfo.type, | ||
126 | + "created_by" : backInfo.resource_owner_id, | ||
127 | + "target_id" : backInfo.InstanceId, | ||
128 | + "type" : backInfo.mime_type | ||
129 | + }) | ||
130 | + return backInfo; | ||
131 | + } | ||
132 | + componentDidUpdate(prevProps, prevState){ } | ||
133 | + componentDidMount(){ | ||
134 | + const self=this; | ||
135 | + const { single,keyNum,typeName,mimeTypes,max_file_size }=this.props; | ||
136 | + const dropId=this.props.dropId || ''; | ||
137 | + const { timeStamp }=this.state; | ||
138 | + this.uploader = new plupload.Uploader({ | ||
139 | + runtimes : 'html5,flash,silverlight,html4', | ||
140 | + browse_button : 'selectfiles'+keyNum+timeStamp, | ||
141 | + container : self.refs['file_uploader_wrap'], | ||
142 | + url : '//oss.aliyuncs.com', | ||
143 | + drop_element : dropId,//filelist 放入id 拖拽文本框的id | ||
144 | + filters:{ | ||
145 | + | ||
146 | + max_file_size: max_file_size, | ||
147 | + | ||
148 | + mime_types:mimeTypes.extensions?[ | ||
149 | + mimeTypes | ||
150 | + ]:[] | ||
151 | + }, | ||
152 | + init: { | ||
153 | + PostInit: function() { | ||
154 | + | ||
155 | + }, | ||
156 | + FileFiltered:function(uploader,file){ | ||
157 | + | ||
158 | + }, | ||
159 | + FilesAdded: function(up, files) { | ||
160 | + if(up.files&&up.files.length>0&&single){ | ||
161 | + const removeFiles=up.files.slice(0,up.files.length-1); | ||
162 | + self.props.onChange(up.files[up.files.length-1]); | ||
163 | + self.removeAllFile(removeFiles); | ||
164 | + } | ||
165 | + if(self.props.autoUpload){ | ||
166 | + self.uploadBtn(); | ||
167 | + } | ||
168 | + }, | ||
169 | + UploadProgress: function(up, file) { | ||
170 | + self.props.backResult(file); | ||
171 | + }, | ||
172 | + FileUploaded: function(up, file, info) { | ||
173 | + if(info&&info.response){ | ||
174 | + const backInfo=JSON.parse(info.response); | ||
175 | + if('${filename}'==backInfo.name){ | ||
176 | + backInfo.name=backInfo.object.substring( backInfo.object.lastIndexOf('/')); | ||
177 | + } | ||
178 | + if(backInfo&&backInfo.path){ | ||
179 | + const name=backInfo.path.substring(backInfo.path.lastIndexOf('/')+1); // '/' 换成 '.'' | ||
180 | + self.props.endCallBack(self.transformModel({name,...backInfo}),typeName); | ||
181 | + }else | ||
182 | + self.props.endCallBack(self.transformModel(backInfo),typeName); | ||
183 | + }else{ | ||
184 | + self.props.endCallBack({'err':'upload fail'}); | ||
185 | + } | ||
186 | + }, | ||
187 | + UploadComplete:function(up, files){ }, | ||
188 | + Error: function(up, err){ | ||
189 | + notification.error({ | ||
190 | + message: '错误提示', | ||
191 | + description: err.code, | ||
192 | + }); | ||
193 | + } | ||
194 | + } | ||
195 | + }); | ||
196 | + this.uploader.init(); | ||
197 | + plupload.FILE_SIZE_ERROR = `上传文件过大,请小于${max_file_size}。`; | ||
198 | + } | ||
199 | + componentWillUnmount(){ | ||
200 | + console.log("12111111111111111113") | ||
201 | + this.uploader.destroy(); | ||
202 | + } | ||
203 | + render(){ | ||
204 | + const { style, keyNum, max_file_size} = this.props; | ||
205 | + const { timeStamp } = this.state; | ||
206 | + console.log(max_file_size) | ||
207 | + return ( | ||
208 | + <div className={cx(s.upload_wrap)} style={style} ref='file_upload_wrap' id={"selectfiles"+keyNum+timeStamp}> | ||
209 | + {this.props.children} | ||
210 | + </div> | ||
211 | + ) | ||
212 | + } | ||
213 | +} | ||
214 | + | ||
215 | + | ||
216 | + | ||
217 | +// export default UploadWrap; | ||
218 | +const mapState = (state) => { | ||
219 | + return { | ||
220 | + }; | ||
221 | +} | ||
222 | +export default connect(mapState)(UploadWrap); |
@@ -45,7 +45,7 @@ export class OssImg extends React.Component { | @@ -45,7 +45,7 @@ export class OssImg extends React.Component { | ||
45 | render() { | 45 | render() { |
46 | const {url,id}=this.state; | 46 | const {url,id}=this.state; |
47 | return ( | 47 | return ( |
48 | - <img src={url?url:'/img/电子文件.png'} alt="电子文件"/> | 48 | + <img src={url?url:'./img/电子文件.png'} alt="电子文件"/> |
49 | ); | 49 | ); |
50 | } | 50 | } |
51 | } | 51 | } |
@@ -91,7 +91,7 @@ class MentionsInput extends React.Component { | @@ -91,7 +91,7 @@ class MentionsInput extends React.Component { | ||
91 | return ( | 91 | return ( |
92 | <div className={cx(s.suggestion_overlay)} ref='suggestion_overlay'> | 92 | <div className={cx(s.suggestion_overlay)} ref='suggestion_overlay'> |
93 | { fileterEmoji.map((emoji,i)=>{ | 93 | { fileterEmoji.map((emoji,i)=>{ |
94 | - const url=`/img/emoji/${emoji}.png`; | 94 | + const url=`./img/emoji/${emoji}.png`; |
95 | return ( | 95 | return ( |
96 | <div key={i} onClick={self.choseEmoji.bind(self,i)} className={cx(s.banner,s.contact_name,s.item,s.line,i==shiftFocus?s.active:'')}> | 96 | <div key={i} onClick={self.choseEmoji.bind(self,i)} className={cx(s.banner,s.contact_name,s.item,s.line,i==shiftFocus?s.active:'')}> |
97 | <span> | 97 | <span> |
@@ -111,7 +111,7 @@ class MentionsInput extends React.Component { | @@ -111,7 +111,7 @@ class MentionsInput extends React.Component { | ||
111 | fileterMention.map((mention,i)=>{ | 111 | fileterMention.map((mention,i)=>{ |
112 | return( | 112 | return( |
113 | <div key={i} onClick={self.choseMention.bind(self,i)} className={cx(s.banner,s.contact_name,s.item,s.line,i==shiftFocus?s.active:'')}> | 113 | <div key={i} onClick={self.choseMention.bind(self,i)} className={cx(s.banner,s.contact_name,s.item,s.line,i==shiftFocus?s.active:'')}> |
114 | - <img className={cx(s.is_leading,s.avatar,s.img_circle,s.img_24)} src="/img/user.jpg" /> | 114 | + <img className={cx(s.is_leading,s.avatar,s.img_circle,s.img_24)} src="./img/user.jpg" /> |
115 | <span className={cx(s.name,s.text_overflow)}>{mention.name}</span> | 115 | <span className={cx(s.name,s.text_overflow)}>{mention.name}</span> |
116 | </div> | 116 | </div> |
117 | ) | 117 | ) |
@@ -223,7 +223,7 @@ const replaceEmoji=(content='')=>{ | @@ -223,7 +223,7 @@ const replaceEmoji=(content='')=>{ | ||
223 | results.map((result,i)=>{ | 223 | results.map((result,i)=>{ |
224 | const imgName=result.substring(1,result.lastIndexOf(":")); | 224 | const imgName=result.substring(1,result.lastIndexOf(":")); |
225 | if(allEmojiSheet.indexOf(imgName)!=-1){ | 225 | if(allEmojiSheet.indexOf(imgName)!=-1){ |
226 | - const imgTag='<img class="emoji_link" src="/img/emoji/'+imgName+'.png"> </img>'; | 226 | + const imgTag='<img class="emoji_link" src="./img/emoji/'+imgName+'.png"> </img>'; |
227 | backHtml=backHtml.replace(result,imgTag); | 227 | backHtml=backHtml.replace(result,imgTag); |
228 | } | 228 | } |
229 | }) | 229 | }) |
@@ -21,7 +21,7 @@ class RplyTextarea extends React.Component { | @@ -21,7 +21,7 @@ class RplyTextarea extends React.Component { | ||
21 | } | 21 | } |
22 | static defaultProps={ | 22 | static defaultProps={ |
23 | use:{ | 23 | use:{ |
24 | - user_image:"/img/user.jpg" | 24 | + user_image:"./img/user.jpg" |
25 | } | 25 | } |
26 | } | 26 | } |
27 | changeMessage(e){ | 27 | changeMessage(e){ |
@@ -69,7 +69,7 @@ class HRHead extends React.Component { | @@ -69,7 +69,7 @@ class HRHead extends React.Component { | ||
69 | window.location.href='#/user/hrboard/personal/'+userInfo.user_id; | 69 | window.location.href='#/user/hrboard/personal/'+userInfo.user_id; |
70 | } | 70 | } |
71 | goSignOut(){ | 71 | goSignOut(){ |
72 | - window.location.href='/signOut'; | 72 | + window.location.href =`${__PREFIX__}signOut`; |
73 | } | 73 | } |
74 | goIntelligentPay(){ | 74 | goIntelligentPay(){ |
75 | // window.location.href='#/user/hrboard/intelligentPay'; | 75 | // window.location.href='#/user/hrboard/intelligentPay'; |
@@ -135,7 +135,7 @@ class ElasticCheckboxGroupField extends React.Component { | @@ -135,7 +135,7 @@ class ElasticCheckboxGroupField extends React.Component { | ||
135 | 135 | ||
136 | }} style={{display:'inline-block',float:'left' ,cursor:'pointer'}} > | 136 | }} style={{display:'inline-block',float:'left' ,cursor:'pointer'}} > |
137 | {/*<Icon type="plus" />*/} | 137 | {/*<Icon type="plus" />*/} |
138 | - <img src="/img/add.png" alt="" style={{ width:'46px', height:'17px'}}/> | 138 | + <img src="./img/add.png" alt="" style={{ width:'46px', height:'17px'}}/> |
139 | </div> | 139 | </div> |
140 | </Tooltip> | 140 | </Tooltip> |
141 | {showInput&&<div style={{display:'inline-block', float: 'left', marginLeft: '8px' ,marginTop: '5px'}}> | 141 | {showInput&&<div style={{display:'inline-block', float: 'left', marginLeft: '8px' ,marginTop: '5px'}}> |
请
注册
或
登录
后发表评论