Showing
20 changed files
with
189 additions
and
11 deletions
1 | +'use strict'; | ||
2 | + | ||
1 | exports.page = (req, res, next) => { | 3 | exports.page = (req, res, next) => { |
4 | + | ||
5 | + res.locals.module = 'service'; | ||
6 | + res.locals.page = 'chat'; | ||
7 | + res.locals.pageStyle = 'service-chat'; | ||
8 | + res.locals.width750 = true; | ||
9 | + | ||
2 | res.render('chat/index'); | 10 | res.render('chat/index'); |
3 | -}; | ||
11 | +}; |
@@ -5,28 +5,28 @@ | @@ -5,28 +5,28 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var express = require('express'), | 7 | var express = require('express'), |
8 | - path = require('path'), | ||
9 | - hbs = require('express-handlebars'); | 8 | + path = require('path'); |
10 | 9 | ||
11 | var app = express(); | 10 | var app = express(); |
12 | 11 | ||
13 | // set view engin | 12 | // set view engin |
14 | -var doraemon = path.join(__dirname, '../../doraemon/views'); //parent view root | 13 | +var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root |
15 | 14 | ||
16 | app.on('mount', function(parent) { | 15 | app.on('mount', function(parent) { |
17 | delete parent.locals.settings; // 不继承父 App 的设置 | 16 | delete parent.locals.settings; // 不继承父 App 的设置 |
18 | Object.assign(app.locals, parent.locals); | 17 | Object.assign(app.locals, parent.locals); |
19 | }); | 18 | }); |
20 | 19 | ||
21 | -app.set('views', path.join(__dirname, 'views/action')); | ||
22 | -app.engine('.hbs', hbs({ | 20 | +app.use(global.yoho.hbs({ |
23 | extname: '.hbs', | 21 | extname: '.hbs', |
24 | defaultLayout: 'layout', | 22 | defaultLayout: 'layout', |
25 | layoutsDir: doraemon, | 23 | layoutsDir: doraemon, |
26 | - partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | 24 | + partialsDir: [path.join(__dirname, 'views/partial')], |
25 | + views: path.join(__dirname, 'views/action'), | ||
27 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
28 | })); | 27 | })); |
29 | 28 | ||
29 | + | ||
30 | // router | 30 | // router |
31 | app.use(require('./router')); | 31 | app.use(require('./router')); |
32 | 32 |
1 | -<header></header> | ||
2 | -<div></div> | ||
3 | -<footer></footer> | ||
1 | +<!--im 头部--> | ||
2 | +<header id="chat-header"> | ||
3 | + <h2></h2> | ||
4 | + <div class=""></div> | ||
5 | + <div></div> | ||
6 | +</header> | ||
7 | +<!--im 主体--> | ||
8 | +<div id="chat-window"></div> | ||
9 | +<!--im footer--> | ||
10 | +<footer id="chat-footer"> | ||
11 | + <div id="chat-send-box" class="table"> | ||
12 | + <span class="table-cell"> | ||
13 | + <a href="javascript:;" class="input-method input-text"></a> | ||
14 | + </span> | ||
15 | + <span class="table-cell cell-max"> | ||
16 | + <input type="text" class="input-in text-in"> | ||
17 | + </span> | ||
18 | + <span class="table-cell"> | ||
19 | + <a href="javascript:;" class="menu-trigger"></a> | ||
20 | + </span> | ||
21 | + </div> | ||
22 | +</footer> | ||
23 | +<div></div> |
@@ -69,7 +69,7 @@ module.exports = { | @@ -69,7 +69,7 @@ module.exports = { | ||
69 | port: '4444' // influxdb port | 69 | port: '4444' // influxdb port |
70 | }, | 70 | }, |
71 | console: { | 71 | console: { |
72 | - level: 'error', | 72 | + level: 'debug', |
73 | colorize: 'all', | 73 | colorize: 'all', |
74 | prettyPrint: true | 74 | prettyPrint: true |
75 | } | 75 | } |
No preview for this file type
public/img/service/chat/input-text.png
0 → 100644
![](/fe/yohobuywap-node/raw/b00a661bf7207d526864ac8715d4b0f7c6b72ff7/public/img/service/chat/input-text.png)
2.33 KB
public/img/service/chat/input-voice.png
0 → 100644
![](/fe/yohobuywap-node/raw/b00a661bf7207d526864ac8715d4b0f7c6b72ff7/public/img/service/chat/input-voice.png)
2.77 KB
public/img/service/chat/menu-trigger.png
0 → 100644
![](/fe/yohobuywap-node/raw/b00a661bf7207d526864ac8715d4b0f7c6b72ff7/public/img/service/chat/menu-trigger.png)
2.25 KB
public/js/service/chat.page.js
0 → 100644
1 | +'use strict'; |
public/js/service/chat/index.js
0 → 100644
public/js/service/chat/message.js
0 → 100644
public/js/service/chat/role.js
0 → 100644
1 | +/* | ||
2 | + yoho客服 im: 角色 | ||
3 | + @author xuan.chen@yoh.cn | ||
4 | +*/ | ||
5 | + | ||
6 | +'use strict'; | ||
7 | + | ||
8 | +class ChatRole { | ||
9 | + | ||
10 | + /* | ||
11 | + 发送消息 | ||
12 | + */ | ||
13 | + sendMessage() { | ||
14 | + // Todo | ||
15 | + } | ||
16 | +} | ||
17 | + | ||
18 | +class Customer extends ChatRole { | ||
19 | + | ||
20 | +} | ||
21 | + | ||
22 | +class Employee extends ChatRole { | ||
23 | + | ||
24 | +} | ||
25 | + | ||
26 | +class Robot extends ChatRole { | ||
27 | + | ||
28 | +} | ||
29 | + | ||
30 | +export {ChatRole, Customer, Employee, Robot}; | ||
31 | + |
public/js/service/chat/view.js
0 → 100644
public/scss/service/_index.css
0 → 100644
public/scss/service/chat/_chat.css
0 → 100644
1 | +.service-chat { | ||
2 | + #chat-send-box { | ||
3 | + border-top: 1PX solid #e5e5e5; | ||
4 | + padding: 16px 20px 14px; | ||
5 | + | ||
6 | + .input-method, | ||
7 | + .menu-trigger { | ||
8 | + display: block; | ||
9 | + width: 60px; | ||
10 | + height: 60px; | ||
11 | + background-repeat: no-repeat; | ||
12 | + background-size: 60px 60px; | ||
13 | + } | ||
14 | + | ||
15 | + /* 输入方式 */ | ||
16 | + .input-method { | ||
17 | + margin-right: 20px; | ||
18 | + } | ||
19 | + | ||
20 | + .input-text { | ||
21 | + background-image: resolve("service/chat/input-text.png"); | ||
22 | + } | ||
23 | + | ||
24 | + .input-voice { | ||
25 | + background-image: resolve("service/chat/input-voice.png"); | ||
26 | + } | ||
27 | + | ||
28 | + /* 输入框 */ | ||
29 | + .input-in { | ||
30 | + display: block; | ||
31 | + width: 100%; | ||
32 | + height: 70px; | ||
33 | + border: 1PX solid #e0e0e0; | ||
34 | + border-radius: 8px; | ||
35 | + } | ||
36 | + | ||
37 | + .menu-trigger { | ||
38 | + margin-left: 20px; | ||
39 | + background-image: resolve("service/chat/menu-trigger.png"); | ||
40 | + } | ||
41 | + } | ||
42 | +} |
public/scss/service/chat/_layout.css
0 → 100644
1 | +.service-chat { | ||
2 | + /* -------------------------------- *\ | ||
3 | + atom, util | ||
4 | + \* -------------------------------- */ | ||
5 | + .table { | ||
6 | + display: table; | ||
7 | + width: 100%; | ||
8 | + } | ||
9 | + | ||
10 | + .table-cell { | ||
11 | + display: table-cell; | ||
12 | + vertical-align: middle; | ||
13 | + | ||
14 | + &.cell-max { | ||
15 | + width: 6666px; | ||
16 | + } | ||
17 | + } | ||
18 | + | ||
19 | + .main-wrap { | ||
20 | + position: static; | ||
21 | + } | ||
22 | + | ||
23 | + #chat-window, | ||
24 | + #chat-footer { | ||
25 | + max-width: 750px; | ||
26 | + } | ||
27 | + | ||
28 | + #chat-header { | ||
29 | + height: 85px; | ||
30 | + background-color: #3e3e3e; | ||
31 | + } | ||
32 | + | ||
33 | + #chat-window { | ||
34 | + position: absolute; | ||
35 | + top: 85px; | ||
36 | + bottom: 100px; | ||
37 | + width: 100%; | ||
38 | + background-color: #f0f0f0; | ||
39 | + } | ||
40 | + | ||
41 | + #chat-footer { | ||
42 | + position: absolute; | ||
43 | + bottom: 0; | ||
44 | + width: 100%; | ||
45 | + height: 100px; | ||
46 | + background-color: #f7f7f7; | ||
47 | + } | ||
48 | +} |
public/scss/service/chat/_message.css
0 → 100644
public/scss/service/chat/_order.css
0 → 100644
public/scss/service/chat/_rating.css
0 → 100644
-
Please register or login to post a comment