Browse Source

问答管理

XMTT 7 years ago
parent
commit
43b6979b5a

+ 39 - 0
css/model/sys/answer.css

@ -0,0 +1,39 @@
1
@charset "utf-8";
2
.sys_answer_index .tpl-btns .row {
3
    padding-left: 10px;
4
}
5
6
.sys_answer_index th.opt-check {
7
    width: 35px;
8
}
9
10
.sys_answer_index .table {
11
    table-layout: fixed;
12
}
13
14
.sys_answer_index .orderBy .icon-close {
15
    display: none;
16
}
17
18
.sys_answer_index .number{
19
    width: 6%;
20
}
21
22
.sys_answer_index .table-opt .name,.sys_answer_index .author{
23
    cursor:pointer;
24
}
25
26
.sys_answer_edit {
27
    width: 700px;
28
    height: 450px;
29
}
30
31
.sys_answer_edit .content {
32
    font-size: 25px;
33
    font-weight: bold;
34
}
35
36
.sys_answer_edit .textarea > textarea {
37
    width: 350px;
38
    height: 180px;
39
}

+ 313 - 0
css/model/sys/question.css

@ -0,0 +1,313 @@
1
@charset "utf-8";
2
.sys_question_index .tpl-btns .row {
3
    padding-left: 10px;
4
}
5
6
.sys_question_index th.opt-check {
7
    width: 35px;
8
}
9
10
.sys_question_index .table {
11
    table-layout: fixed;
12
}
13
14
.sys_question_index .orderBy .icon-close {
15
    display: none;
16
}
17
18
.sys_question_index .number{
19
    width: 6%;
20
}
21
22
.sys_question_index .table-opt .name,.sys_question_index .author{
23
    cursor:pointer;
24
}
25
26
.sys_question_edit,.sys_question_edit2 {
27
    width: 700px;
28
    height: 450px;
29
}
30
31
.sys_question_edit .content,.sys_question_edit2 .content {
32
    font-size: 25px;
33
    font-weight: bold;
34
}
35
36
.sys_question_edit .textarea > textarea,.sys_question_edit2 .textarea > textarea {
37
    width: 350px;
38
    height: 100px;
39
}
40
41
.sys_question_keys {
42
    width: 600px;
43
    height: 250px;
44
}
45
46
.sys_question_keys .orgSize.dyn-mselect .icon-drop {
47
    display: none !important;
48
}
49
50
.sys_question_keys .orgSize.dyn-mselect .dd-drop {
51
    display: none !important;
52
}
53
54
.sys_question_keys .orgSize.dyn-mselect .placeholder {
55
    display: none !important;
56
}
57
58
/*region Description*/
59
.sys_question_edit .newForm .head-ctn .upload-btn {
60
    position: absolute;
61
    bottom: 10px;
62
    left: 40px;
63
    width: 110px;
64
    height: 36px;
65
    color: rgba(0, 0, 0, 1);
66
    font-size: 14px;
67
    text-align: center;
68
    border: 1px solid #555555;
69
    padding-top: 6px;
70
}
71
72
.sys_question_edit .newForm .head-ctn .upload-btn i {
73
    font-size: 16px;
74
    color: rgb(95, 184, 120);
75
}
76
77
.sys_question_edit .newForm .head-ctn img {
78
    width: 100%;
79
    height: 100%;
80
}
81
82
.sys_question_edit .upload-item {
83
    position: absolute;
84
    width: 100%;
85
    top: 50%;
86
    transform: translateY(-50%);
87
}
88
89
.sys_question_edit .upload-item .progress {
90
    width: 1px;
91
    height: 30px;
92
    background-color: #3280FC;
93
}
94
95
.sys_question_edit .webuploader-pick {
96
    position: relative;
97
    top: 32px;
98
    left: 10px;
99
    display: inline-block;
100
    cursor: pointer;
101
    background: #00b7ee;
102
    padding: 10px 15px;
103
    color: #fff;
104
    text-align: center;
105
    border-radius: 3px;
106
    overflow: hidden;
107
}
108
109
.sys_question_edit .webuploader-container {
110
    position: relative;
111
    float: left;
112
    top: 18%;
113
}
114
115
.sys_question_edit .webuploader-element-invisible {
116
    position: absolute !important;
117
    clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
118
    clip: rect(1px, 1px, 1px, 1px);
119
}
120
121
.sys_question_edit .webuploader-pick-hover {
122
    background: #00a2d4;
123
}
124
125
.sys_question_edit .webuploader-pick-disable {
126
    opacity: 0.6;
127
    pointer-events: none;
128
}
129
130
.sys_question_edit #picker {
131
    display: inline-block;
132
    line-height: 1.428571429;
133
    vertical-align: middle;
134
    margin: 0 12px 0 0;
135
}
136
137
.sys_question_edit #picker .webuploader-pick {
138
    position: relative;
139
    display: block;
140
    top: 50%;
141
    margin-top: -58px;
142
}
143
144
.sys_question_edit .head-ctn .thumbnail {
145
    width: 110px;
146
    height: 110px;
147
}
148
149
.sys_question_edit #uploader-demo .thumbnail img {
150
    width: 100%;
151
}
152
153
.sys_question_edit .uploader-list {
154
    width: auto;
155
    overflow: hidden;
156
    float: left;
157
}
158
159
.sys_question_edit .file-item {
160
    /*float: left;*/
161
    position: relative;
162
    margin: 0 20px 20px 0;
163
    padding: 4px;
164
    display: table-cell;
165
}
166
167
.sys_question_edit .file-item .error {
168
    position: absolute;
169
    top: 4px;
170
    left: 4px;
171
    right: 4px;
172
    background: red;
173
    color: white;
174
    text-align: center;
175
    height: 20px;
176
    font-size: 14px;
177
    line-height: 23px;
178
}
179
180
.sys_question_edit .file-item .info {
181
    position: absolute;
182
    left: 4px;
183
    bottom: 4px;
184
    right: 4px;
185
    height: 20px;
186
    line-height: 20px;
187
    text-indent: 5px;
188
    background: rgba(0, 0, 0, 0.6);
189
    color: white;
190
    overflow: hidden;
191
    white-space: nowrap;
192
    text-overflow: ellipsis;
193
    font-size: 12px;
194
    z-index: 10;
195
}
196
197
.sys_question_edit .file-item .progress {
198
    position: absolute;
199
    right: 4px;
200
    bottom: 4px;
201
    left: 4px;
202
    height: 4px;
203
    /*width: 110px;*/
204
    overflow: hidden;
205
    z-index: 15;
206
    margin: 0;
207
    padding: 0;
208
    border-radius: 0;
209
    background: transparent;
210
}
211
212
.sys_question_edit .file-item .progress span {
213
    display: block;
214
    overflow: hidden;
215
    width: 0;
216
    height: 100%;
217
    /*background: #d14 url(/images/progress.png) repeat-x;*/
218
    background: #d14;
219
    -webit-transition: width 200ms linear;
220
    -moz-transition: width 200ms linear;
221
    -o-transition: width 200ms linear;
222
    -ms-transition: width 200ms linear;
223
    transition: width 200ms linear;
224
    -webkit-animation: progressmove 2s linear infinite;
225
    -moz-animation: progressmove 2s linear infinite;
226
    -o-animation: progressmove 2s linear infinite;
227
    -ms-animation: progressmove 2s linear infinite;
228
    animation: progressmove 2s linear infinite;
229
    -webkit-transform: translateZ(0);
230
}
231
232
.sys_question_edit .filelist div.file-panel span.cancel {
233
    /* background-position: -48px -24px; */
234
}
235
236
.sys_question_edit .filelist div.file-panel span.cancel:hover {
237
    background-position: -48px 0;
238
}
239
/*endregion*/
240
241
242
.sys_question_edit2 .webuploader-pick {
243
    position: relative;
244
    top: 32px;
245
    left: 10px;
246
    display: inline-block;
247
    cursor: pointer;
248
    background: #00b7ee;
249
    padding: 10px 15px;
250
    color: #fff;
251
    text-align: center;
252
    border-radius: 3px;
253
    overflow: hidden;
254
}
255
256
.sys_question_edit2 .uploader-list {
257
    width:auto;
258
    overflow: hidden;
259
    float: left;
260
}
261
262
.sys_question_edit2 .head-ctn .thumbnail{
263
    width: 110px;
264
    height: 110px;
265
}
266
.sys_question_edit2 .file-item {
267
    /*float: left;*/
268
    position: relative;
269
    margin: 0 20px 20px 0;
270
    padding: 4px;
271
    display: table-cell;
272
}
273
274
275
.sys_question_edit2 .newForm .head-ctn {
276
    width: 80%;
277
    height: 190px;
278
    position: relative;
279
    margin:auto ;
280
}
281
.sys_question_edit2 .upload-form input{
282
    font-size: 26px;
283
}
284
285
.sys_question_edit2 .newForm .head-ctn .upload-btn {
286
    position: relative;
287
    top: 32px;
288
    left: 10px;
289
    display: inline-block;
290
    cursor: pointer;
291
    background: #00b7ee;
292
    padding: 10px 15px;
293
    color: #fff;
294
    text-align: center;
295
    border-radius: 3px;
296
    overflow: hidden;
297
    float: left;
298
}
299
300
.sys_question_edit2 .newForm .head-ctn .upload-btn i {
301
    font-size: 16px;
302
    color: rgb(95,184,120);
303
}
304
.sys_question_edit2 .newForm .head-ctn img {
305
    width: 100%;
306
    height: 100%;
307
}
308
.sys_question_edit2 .upload-item{
309
    position: absolute;
310
    width: 100%;
311
    top:50%;
312
    transform: translateY(-50%);
313
}

+ 6 - 0
html/model/sys/answer/count.html

@ -0,0 +1,6 @@
1
<div class="sys_answer_count centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div id="type" style="height: 400px;width: 850px"></div>
6
</div>

+ 28 - 0
html/model/sys/answer/edit.html

@ -0,0 +1,28 @@
1
<div class="sys_answer_edit centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container newForm">
6
        <div class="row">
7
            <div class="col-2"></div>
8
            <div class="col-4 item-caption content ">编辑回答内容</div>
9
10
        </div>
11
        <div class="row">
12
            <div class="col-2 item-caption">回答内容</div>
13
            <div class="col-6">
14
                <div class="form-item textarea" name="cnt"></div>
15
            </div>
16
        </div>
17
18
        <div class="row">
19
            <div class="col-10"></div>
20
            <div class="col-2">
21
                <div class="btn pull-right opt-save">
22
                    <i class="icon-check"></i> SAVE
23
                </div>
24
            </div>
25
        </div>
26
27
    </div>
28
</div>

+ 96 - 0
html/model/sys/answer/index.html

@ -0,0 +1,96 @@
1
<div class="sys_answer_index" loadUri="../ajax/qa/pqAnswer" pageSize="20" pageNo="1" pageIndex="pi">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container dt-form">
6
        <div class="row">
7
            <div class="col-1"></div>
8
            <div class="col-1 item-caption ">问题题目</div>
9
            <div class="col-4">
10
                <div class="form-item text" defVal="" name="questionTitle"></div>
11
            </div>
12
            <div class="col-1 item-caption">回答者</div>
13
            <div class="col-2">
14
                <div class="form-item text" defVal="" name="respondent"></div>
15
            </div>
16
        </div>
17
        <div class="row">
18
            <div class="col-1"></div>
19
            <div class="col-1 item-caption">回答内容</div>
20
            <div class="col-4">
21
                <div class="form-item text" defVal="" name="cnt"></div>
22
            </div>
23
            <div class="col-1 item-caption ">排序方式</div>
24
            <div class="col-2">
25
                <div class="form-item select orderBy" dictCode="sort_answer" defVal="1" name="orderBy"></div>
26
            </div>
27
        </div>
28
        <div class="row">
29
            <div class="col-8">
30
            </div>
31
            <div class="col-2">
32
                <div class="btn opt-query pull-right">
33
                    <i class="icon-search"></i> 查询
34
                </div>
35
            </div>
36
            <div class="col-2"></div>
37
38
        </div>
39
    </div>
40
41
    <div class="container page-split"></div>
42
    <div class="container tpl-btns">
43
        <div class="row">
44
            <div class="btn opt-view">
45
                查看
46
            </div>
47
            <div class="btn opt-edit">
48
                编辑文章内容
49
            </div>
50
            <div class="btn opt-count">
51
                流量统计
52
            </div>
53
            <div class="btn opt-del">
54
                删除
55
            </div>
56
        </div>
57
    </div>
58
    <div class="container dt-tpl">
59
        <table class="table table-bordered">
60
            <thead>
61
            <tr>
62
                <th class="opt-check" ><i class="icon icon-st-check"></i> </th>
63
                <th class="number">序号</th>
64
                <th>来自问题</th>
65
                <th>回答内容</th>
66
                <th class="number">回答者</th>
67
                <th>发布时间</th>
68
                <th class="number">点赞量</th>
69
                <th class="number">总投票量</th>
70
                <th class="number">留言量</th>
71
                <th class="number">收藏量</th>
72
            </tr>
73
            </thead>
74
            <tbody>
75
            <tr ch-dir="list">
76
                <td class="opt-check" ><i class="icon icon-st-check" aId="{{id}}" pId="{{pId}}"></i></td>
77
                <td>{{pi}}</td>
78
                <td class="table-opt" aId="{{id}}" pId="{{pid}}"><a class="name">{{questionTitle}}</a></td>
79
                <td>{{cnt}}</td>
80
                <td professorId="{{uid}}"><a class="author">{{respondent}}</a></td>
81
                <td>{{createTime-showDay}}</td>
82
                <td>{{agree}}</td>
83
                <td>{{ballot}}</td>
84
                <td class="hand-lm" aId="{{id}}"></td>
85
                <td class="hand-col" aId="{{id}}"></td>
86
            </tr>
87
            </tbody>
88
            <tbody ch-dir="array.empty">
89
            <tr>
90
                <td class="empty-desc" colspan="10">表格暂无数据</td>
91
            </tr>
92
            </tbody>
93
        </table>
94
    </div>
95
    <ul class="dt-pager"></ul>
96
</div>

+ 1 - 1
html/model/sys/feedback/index.html

@ -42,7 +42,7 @@
42 42
        <table class="table table-bordered">
43 43
            <thead>
44 44
            <tr>
45
                <th class="opt-check" ><i class="icon icon-st-check"></i> </th>
45
                <th class="opt-check" ></th>
46 46
                <th>序号</th>
47 47
                <th>反馈信息</th>
48 48
                <th>数据类型</th>

+ 6 - 0
html/model/sys/question/count.html

@ -0,0 +1,6 @@
1
<div class="sys_question_count centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div id="type" style="height: 400px;width: 850px"></div>
6
</div>

+ 41 - 0
html/model/sys/question/edit.html

@ -0,0 +1,41 @@
1
<div class="sys_question_edit centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container newForm">
6
        <div class="row">
7
            <div class="col-2"></div>
8
            <div class="col-4 item-caption content ">编辑问题内容</div>
9
10
        </div>
11
        <div class="row">
12
            <div class="col-2 item-caption">问题题目</div>
13
            <div class="col-6">
14
                <div class="form-item textarea" name="title"></div>
15
            </div>
16
        </div>
17
        <div class="row">
18
            <div class="col-2 item-caption">问题内容</div>
19
            <div class="col-6">
20
                <div class="form-item textarea" name="cnt"></div>
21
            </div>
22
        </div>
23
        <div class="row">
24
            <div class="col-2"></div>
25
            <div class="head-ctn">
26
                <div id="fileList" class="uploader-list"></div>
27
                <div id="filePicker">选择图片</div>
28
            </div>
29
        </div>
30
31
        <div class="row">
32
            <div class="col-10"></div>
33
            <div class="col-2">
34
                <div class="btn pull-right opt-save">
35
            <i class="icon-check"></i> SAVE
36
        </div>
37
    </div>
38
        </div>
39
40
    </div>
41
</div>

+ 41 - 0
html/model/sys/question/edit2.html

@ -0,0 +1,41 @@
1
<div class="sys_question_edit2 centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container newForm">
6
        <div class="row">
7
            <div class="col-2"></div>
8
            <div class="col-4 item-caption content ">编辑问题内容</div>
9
10
        </div>
11
        <div class="row">
12
            <div class="col-2 item-caption">问题题目</div>
13
            <div class="col-6">
14
                <div class="form-item textarea" name="title"></div>
15
            </div>
16
        </div>
17
        <div class="row">
18
            <div class="col-2 item-caption">问题内容</div>
19
            <div class="col-6">
20
                <div class="form-item textarea" name="cnt"></div>
21
            </div>
22
        </div>
23
        <div class="row">
24
            <div class="col-2 item-caption">问题图片</div>
25
            <div class="head-ctn">
26
                <div id="fileList" class="uploader-list"></div>
27
                <div class="upload-btn" id="filePicker">上传头像</div>
28
            </div>
29
        </div>
30
31
        <div class="row">
32
            <div class="col-10"></div>
33
            <div class="col-2">
34
                <div class="btn pull-right opt-save">
35
                    <i class="icon-check"></i> SAVE
36
                </div>
37
            </div>
38
        </div>
39
40
    </div>
41
</div>

+ 98 - 0
html/model/sys/question/index.html

@ -0,0 +1,98 @@
1
<div class="sys_question_index" loadUri="../ajax/qa/pqQuestion" pageSize="20" pageNo="1" pageIndex="pi">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container dt-form">
6
        <div class="row">
7
            <div class="col-1"></div>
8
            <div class="col-1 item-caption ">问题题目</div>
9
            <div class="col-4">
10
                <div class="form-item text" defVal="" name="title"></div>
11
            </div>
12
            <div class="col-1 item-caption">回答者</div>
13
            <div class="col-2">
14
                <div class="form-item text" defVal="" name="requester"></div>
15
            </div>
16
        </div>
17
        <div class="row">
18
            <div class="col-6"></div>
19
            <div class="col-1 item-caption ">排序方式</div>
20
            <div class="col-2">
21
                <div class="form-item select orderBy" dictCode="sort_question" defVal="1" name="orderBy"></div>
22
            </div>
23
        </div>
24
        <div class="row">
25
            <div class="col-8">
26
            </div>
27
            <div class="col-2">
28
                <div class="btn opt-query pull-right">
29
                    <i class="icon-search"></i> 查询
30
                </div>
31
            </div>
32
            <div class="col-2"></div>
33
34
        </div>
35
    </div>
36
37
    <div class="container page-split"></div>
38
    <div class="container tpl-btns">
39
        <div class="row">
40
            <div class="btn opt-view">
41
                查看
42
            </div>
43
            <!--<div class="btn opt-edit">-->
44
            <!--编辑问题内容-->
45
            <!--</div>-->
46
            <div class="btn opt-edit2">
47
                编辑问题内容
48
            </div>
49
            <div class="btn opt-keys">
50
                设置关键词
51
            </div>
52
            <div class="btn opt-count">
53
                流量统计
54
            </div>
55
            <div class="btn opt-del">
56
                删除
57
            </div>
58
        </div>
59
    </div>
60
    <div class="container dt-tpl">
61
        <table class="table table-bordered">
62
            <thead>
63
            <tr>
64
                <th class="opt-check"><i class="icon icon-st-check"></i></th>
65
                <th class="number">序号</th>
66
                <th>问题题目</th>
67
                <th>发布者</th>
68
                <th>关键词</th>
69
                <th>发布时间</th>
70
                <th>最后回答时间</th>
71
                <th class="number">阅读量</th>
72
                <th class="number">回答量</th>
73
                <th class="number">关注量</th>
74
            </tr>
75
            </thead>
76
            <tbody>
77
            <tr ch-dir="list">
78
                <td class="opt-check"><i class="icon icon-st-check" qId="{{id}}"></i></td>
79
                <td>{{pi}}</td>
80
                <td class="table-opt" qId="{{id}}"><a class="name">{{title}}</a></td>
81
                <td professorId="{{uid}}"><a class="author">{{requester}}</a></td>
82
                <td>{{keys}}</td>
83
                <td>{{createTime-showDay}}</td>
84
                <td>{{lastReplyTime-showDay}}</td>
85
                <td>{{pageViews}}</td>
86
                <td>{{replyCount}}</td>
87
                <td class="hand-col" qId="{{id}}"></td>
88
            </tr>
89
            </tbody>
90
            <tbody ch-dir="array.empty">
91
            <tr>
92
                <td class="empty-desc" colspan="10">表格暂无数据</td>
93
            </tr>
94
            </tbody>
95
        </table>
96
    </div>
97
    <ul class="dt-pager"></ul>
98
</div>

+ 38 - 0
html/model/sys/question/keys.html

@ -0,0 +1,38 @@
1
<div class="sys_question_keys centerModal">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
    <div class="container newForm">
6
        <div class="row">
7
            <div class="col-2"></div>
8
            <div class="col-4 item-caption content ">设置关键词</div>
9
10
        </div>
11
        <div class="row">
12
            <div class="col-2 item-caption">关键词</div>
13
            <div class="col-4">
14
                <div class="form-item text trim" placeholder="添加内容不能超过15个字" name="newKey"></div>
15
            </div>
16
            <div class="col-2">
17
                <div class="btn pull-right opt-key">
18
                    <i class="icon-check"></i> 添加
19
                </div>
20
            </div>
21
        </div>
22
        <div class="row">
23
            <div class="col-2"></div>
24
            <div class="col-6">
25
                <div class="form-item dyn-mselect orgSize" name="keyList"></div>
26
            </div>
27
        </div>
28
        <div class="row">
29
            <div class="col-10"></div>
30
            <div class="col-2">
31
                <div class="btn pull-right opt-save">
32
                    <i class="icon-check"></i> SAVE
33
                </div>
34
            </div>
35
        </div>
36
37
    </div>
38
</div>

+ 4 - 4
html/model/sys/resresult/new.html

@ -150,10 +150,10 @@
150 150
        </div>
151 151
        <div class="row">
152 152
            <div class="col-2"></div>
153
        <div class="head-ctn">
154
            <div id="fileList" class="uploader-list"></div>
155
            <div id="filePicker">选择图片</div>
156
        </div>
153
            <div class="head-ctn">
154
                <div id="fileList" class="uploader-list"></div>
155
                <div id="filePicker">选择图片</div>
156
            </div>
157 157
        </div>
158 158
        <div class="row">
159 159
            <div class="col-10"></div>

+ 171 - 0
js/model/sys/answer/count.js

@ -0,0 +1,171 @@
1
/**
2
 * Created by TT on 2018/2/1.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "code", "form", "util", "dict"], function (spa, code, form, util, dict) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_answer_count");
10
                // var cr = code.parseCode(root.find(".dt-tpl"));
11
                var myChart = echarts.init(document.getElementById('type'));
12
                var tableData = {data: []},
13
                    allData = [];
14
                var $data = {tn: "answer", id:data.id};
15
16
                root.find(".modal-ctrl .icon-times").on("click", function () {
17
                    spa.closeModal();
18
                });
19
20
                var dayList = function () {
21
                    var dayList = [];
22
                    var now = new Date();
23
                    var day1 = new Date();
24
                    day1.setMonth(now.getMonth() - 1);
25
                    day1.setDate(1);
26
                    var day2 = new Date();
27
                    day2.setDate(day2.getDate());
28
//                    var s1 = day1.format("yyyy-MM-dd");
29
//                    var s2 = day2.format("yyyy-MM-dd");
30
//                    console.log(s1, s2);
31
                    var days = (day2 - day1) / (24 * 60 * 60 * 1000);
32
                    dayList[0] = {time: day1.format("yyyy-MM-dd")};
33
                    for (var i = 1; i < days + 1; i++) {
34
                        day1.setDate(day1.getDate() + 1);
35
                        dayList[i] = {time: day1.format("yyyy-MM-dd")};
36
                    }
37
                    return dayList;
38
                };
39
                var load = function () {
40
                    $.ajax({
41
                        type: "GET",
42
                        url: "http://192.168.3.233:8080/log/jsonp/qm",
43
                        data:$data,
44
                        dataType: "jsonp",
45
                        success: function (data) {
46
                            allData = dayList();
47
                            allData.forEach(function (day) {
48
                                var time = (JSON.stringify(day.time)).replace(/\-|^\"|\"$/g, "");
49
                                day.pc = 0;
50
                                day.app = 0;
51
                                day.h5 = 0;
52
                                day.wx = 0;
53
                                data.data.forEach(function (log) {
54
                                    if (time == log.day) {
55
                                        if (log.source == 1) {
56
                                            day.pc = log.pv;
57
                                        }
58
                                        if (log.source == 2) {
59
                                            day.app = log.pv;
60
                                        }
61
                                        if (log.source == 3) {
62
                                            day.h5 = log.pv;
63
                                        }
64
                                        if (log.source == 4) {
65
                                            day.wx = log.pv;
66
                                        }
67
                                    }
68
                                    day.num = day.pc + day.app + day.h5 + day.wx;
69
                                })
70
                            });
71
                            var colors = ["#660099", '#c23531', "#91C7AE",'#FFDE33','#003366'];
72
                            var option = {
73
74
                                color: colors,
75
                                title: {
76
                                    text: '回答流量分析',
77
                                    subtext: '分渠道'
78
                                },
79
                                tooltip: {
80
                                    trigger: 'axis'
81
                                },
82
                                legend: {
83
                                    data: ['PC端', '移动端APP', '移动端H5','小程序','合计']
84
                                },
85
                                xAxis: {
86
                                    data: allData.map(function (item) {
87
                                        return item.time;
88
                                    }),
89
                                    boundaryGap: false
90
                                },
91
                                yAxis: {
92
                                    splitLine: {
93
                                        show: false
94
                                    },
95
                                    boundaryGap: false,
96
                                    type: "value",
97
                                    // interval: 1,
98
                                    min: 0
99
                                },
100
                                toolbox: {
101
                                    show: true,
102
                                    feature: {
103
                                        dataZoom: {
104
                                            yAxisIndex: 'none'
105
                                        },
106
                                        dataView: {readOnly: false},
107
                                        magicType: {type: ['line', 'bar']},
108
                                        restore: {},
109
                                        saveAsImage: {}
110
                                    }
111
                                },
112
                                dataZoom: [{
113
                                    startValue: allData[allData.length - 7].time
114
                                }, {
115
                                    type: 'inside'
116
                                }],
117
                                visualMap: {
118
                                    top: 10,
119
                                    right: 10
120
                                },
121
                                series: [
122
                                    {
123
                                        name: 'PC端',
124
                                        type: 'line',
125
                                        data: allData.map(function (item) {
126
                                            return item.pc;
127
                                        })
128
                                    }, {
129
                                        name: '移动端APP',
130
                                        type: 'line',
131
                                        data: allData.map(function (item) {
132
                                            return item.app;
133
                                        })
134
                                    }, {
135
                                        name: '移动端H5',
136
                                        type: 'line',
137
                                        data: allData.map(function (item) {
138
                                            return item.h5;
139
                                        })
140
                                    },{
141
                                        name:'小程序',
142
                                        type:'line',
143
                                        data:allData.map(function (item) {
144
                                            return item.wx;
145
                                        })
146
                                    }, {
147
                                        name: '合计',
148
                                        type: 'line',
149
                                        label: {
150
                                            normal: {
151
                                                show: true,
152
                                                position: 'top'
153
                                            }
154
                                        },
155
                                        data: allData.map(function (item) {
156
                                            return item.num;
157
                                        })
158
                                    }
159
                                ]
160
                            };
161
                            myChart.setOption(option);
162
                        }
163
                    });
164
                };
165
                // cr.listen(dict.doTransfer);
166
                load();
167
            }
168
        };
169
    });
170
});
171

+ 36 - 0
js/model/sys/answer/edit.js

@ -0,0 +1,36 @@
1
/**
2
 * Created by TT on 2018/1/29.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "util", "form"], function (spa, util, fb) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_answer_edit");
10
                var form = fb.build(root.find(".newForm"));
11
                root.find(".modal-ctrl .icon-times").on("click", function () {
12
                    spa.closeModal();
13
                });
14
                util.get("../ajax/qa/answer?id=" + data.id, null, function (answer) {
15
                    if (answer) {
16
                        form.val({cnt: answer.cnt});
17
                    } else {
18
                        util.alert("此回答不存在");
19
                    }
20
                });
21
22
                root.find(".opt-save").on("click", function () {
23
                    util.post("../ajax/qa/answer/modify", {
24
                        cnt:form.val().cnt,
25
                        id:data.id
26
                    }, function () {
27
                        spa.closeModal();
28
                        if (data.hand) {
29
                            data.hand();
30
                        }
31
                    }, {});
32
                });
33
            }
34
        }
35
    });
36
});

+ 147 - 0
js/model/sys/answer/index.js

@ -0,0 +1,147 @@
1
/**
2
 * Created by TT on 2018/1/26.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "pagedatagrid", "util"], function (spa, pdgf, util) {
7
        return {
8
            main: function () {
9
                var root = spa.findInMain(".sys_answer_index");
10
                var pdg = pdgf.build(root);
11
                pdg.code.shell("showDay", function (env) {
12
                    if (env.cd && env.cd[this.k]) {
13
                        var day = env.cd[this.k];
14
                        return day.substring(0, 4) + "年" + day.substring(4, 6) + "月" + day.substring(6, 8) + "日  " + day.substring(8, 10) + ":" + day.substring(10, 12);
15
                    }
16
                    return "";
17
                });
18
                pdg.code.listen($.dict.doTransfer);
19
                pdg.code.listen(function(){
20
                    root.find(".hand-lm").each(function() {
21
                        var $e = $(this);
22
                        var aId = $e.attr("aId");
23
                        if (aId) {
24
                            util.get("http://192.168.3.233:81/ajax/leavemsg/count", {sid: aId,stype:4}, function (data) {
25
                                $e.text(data);
26
                            }, {});
27
                            $e.removeClass("hand-lm");
28
                        }
29
                    });
30
                    root.find(".hand-col").each(function() {
31
                        var $e = $(this);
32
                        var aId = $e.attr("aId");
33
                        util.get("/ajax/content/countProfessor",{id:aId,type:9},function(data){
34
                            $e.text(data);
35
                        },{});
36
                        $e.removeClass("hand-col");
37
                    });
38
                    root.find(".table-opt a.name").on("click",function () {
39
                        var aId = $(this).parent().attr("aId");
40
                        var pId = $(this).parent().attr("pId");
41
                        // window.open('http://www.ekexiu.com/articalShow.html?articleId=' + articleId);
42
                        window.open('http://www.ekexiu.com/qa-show.html?id='+aId+'&topid=' + pId);
43
                    });
44
                    root.find("a.author").on("click",function () {
45
                        var professorId = $(this).parent().attr("professorId");
46
                        if(professorId){
47
                            window.open('http://www.ekexiu.com/userInforShow.html?professorId='+professorId);
48
                        }
49
                    })
50
                });
51
52
                root.find(".opt-query").on("click", function () {
53
                    pdg.load();
54
                });
55
                pdg.load();
56
                root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
57
                    var $this = $(this);
58
                    $this.toggleClass("checked");
59
                    if ($this.hasClass("checked")) {
60
                        root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
61
                    } else {
62
                        root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
63
                    }
64
                });
65
                root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
66
                    var $this = $(this);
67
                    $this.toggleClass("checked");
68
                });
69
                root.find(".opt-del").on("click", function() {
70
                    var $answer = root.find("td.opt-check>i.checked");
71
                    if($answer.length) {
72
                        if($answer.length > 1) {
73
                            util.alert("只能选择一篇回答");
74
                        } else {
75
                            util.boxMsg({
76
                                title: "删除回答",
77
                                content: "您是否要删除选中的回答!删除后不可恢复",
78
                                btns: [{
79
                                    caption: "确认",
80
                                    hand: function() {
81
                                        util.del("../ajax/qa/deleteAnswer", { id: $answer.attr("aId") }, function() { pdg.reload() }, {});
82
                                    }
83
                                },
84
                                    { caption: "取消" }
85
                                ]
86
                            });
87
                        }
88
                    } else {
89
                        util.alert("请选择一篇回答");
90
                    }
91
                });
92
                root.find(".opt-edit").on("click", function() {
93
                    var $answer = root.find("td.opt-check>i.checked");
94
                    if ($answer.length) {
95
                        if ($answer.length>1) {
96
                            util.alert("只能选择一篇回答");
97
                        }else {
98
                            spa.showModal("sys_answer_edit", {
99
                                id: $answer.attr("aId"),
100
                                hand: function () {
101
                                    pdg.reload();
102
                                }
103
                            });
104
                        }
105
                    }else {
106
                        util.alert("请选择一篇文章");
107
                    }
108
                });
109
                root.find(".opt-view").on("click", function () {
110
                    var $answer = root.find("td.opt-check>i.checked");
111
                    if ($answer.length) {
112
                        if ($answer.length > 1) {
113
                            util.alert("只能选择一篇回答");
114
                        } else {
115
                            var aId = $answer.attr("aId");
116
                            var pId = $answer.attr("pId");
117
                            window.open('http://www.ekexiu.com/qa-show.html?id='+aId+'&topid=' + pId);
118
                        }
119
                    } else {
120
                        util.alert("请选择一篇回答");
121
                    }
122
                });
123
                root.find(".opt-count").on("click", function () {
124
                    var $answer = root.find("td.opt-check>i.checked");
125
                    if ($answer.length) {
126
                        if ($answer.length>1) {
127
                            util.alert("只能选择一篇回答");
128
                        }else {
129
                            spa.showModal("sys_answer_count", {
130
                                id: $answer.attr("aId"),
131
                                hand: function () {
132
                                    pdg.reload();
133
                                }
134
                            });
135
                        }
136
                    }else {
137
                        util.alert("请选择一篇回答");
138
                    }
139
                });
140
141
142
            }, mainDestory: function () {
143
144
            }
145
        };
146
    });
147
});

+ 3 - 0
js/model/sys/feedback/index.js

@ -31,6 +31,9 @@ spa_define(function () {
31 31
                });
32 32
                root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
33 33
                    var $this = $(this);
34
                    if (!$this.hasClass("checked")&&!root.find("th.opt-check>i.icon-st-check").hasClass("checked")) {
35
                        root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
36
                    }
34 37
                    $this.toggleClass("checked");
35 38
                });
36 39
                root.find(".opt-edit").on("click", function () {

+ 171 - 0
js/model/sys/question/count.js

@ -0,0 +1,171 @@
1
/**
2
 * Created by TT on 2018/2/1.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "code", "form", "util", "dict"], function (spa, code, form, util, dict) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_question_count");
10
                // var cr = code.parseCode(root.find(".dt-tpl"));
11
                var myChart = echarts.init(document.getElementById('type'));
12
                var tableData = {data: []},
13
                    allData = [];
14
                var $data = {tn: "question", id:data.id};
15
16
                root.find(".modal-ctrl .icon-times").on("click", function () {
17
                    spa.closeModal();
18
                });
19
20
                var dayList = function () {
21
                    var dayList = [];
22
                    var now = new Date();
23
                    var day1 = new Date();
24
                    day1.setMonth(now.getMonth() - 1);
25
                    day1.setDate(1);
26
                    var day2 = new Date();
27
                    day2.setDate(day2.getDate());
28
//                    var s1 = day1.format("yyyy-MM-dd");
29
//                    var s2 = day2.format("yyyy-MM-dd");
30
//                    console.log(s1, s2);
31
                    var days = (day2 - day1) / (24 * 60 * 60 * 1000);
32
                    dayList[0] = {time: day1.format("yyyy-MM-dd")};
33
                    for (var i = 1; i < days + 1; i++) {
34
                        day1.setDate(day1.getDate() + 1);
35
                        dayList[i] = {time: day1.format("yyyy-MM-dd")};
36
                    }
37
                    return dayList;
38
                };
39
                var load = function () {
40
                    $.ajax({
41
                        type: "GET",
42
                        url: "http://192.168.3.233:8080/log/jsonp/qm",
43
                        data:$data,
44
                        dataType: "jsonp",
45
                        success: function (data) {
46
                            allData = dayList();
47
                            allData.forEach(function (day) {
48
                                var time = (JSON.stringify(day.time)).replace(/\-|^\"|\"$/g, "");
49
                                day.pc = 0;
50
                                day.app = 0;
51
                                day.h5 = 0;
52
                                day.wx = 0;
53
                                data.data.forEach(function (log) {
54
                                    if (time == log.day) {
55
                                        if (log.source == 1) {
56
                                            day.pc = log.pv;
57
                                        }
58
                                        if (log.source == 2) {
59
                                            day.app = log.pv;
60
                                        }
61
                                        if (log.source == 3) {
62
                                            day.h5 = log.pv;
63
                                        }
64
                                        if (log.source == 4) {
65
                                            day.wx = log.pv;
66
                                        }
67
                                    }
68
                                    day.num = day.pc + day.app + day.h5 + day.wx;
69
                                })
70
                            });
71
                            var colors = ["#660099", '#c23531', "#91C7AE",'#FFDE33','#003366'];
72
                            var option = {
73
74
                                color: colors,
75
                                title: {
76
                                    text: '问题流量分析',
77
                                    subtext: '分渠道'
78
                                },
79
                                tooltip: {
80
                                    trigger: 'axis'
81
                                },
82
                                legend: {
83
                                    data: ['PC端', '移动端APP', '移动端H5','小程序','合计']
84
                                },
85
                                xAxis: {
86
                                    data: allData.map(function (item) {
87
                                        return item.time;
88
                                    }),
89
                                    boundaryGap: false
90
                                },
91
                                yAxis: {
92
                                    splitLine: {
93
                                        show: false
94
                                    },
95
                                    boundaryGap: false,
96
                                    type: "value",
97
                                    // interval: 1,
98
                                    min: 0
99
                                },
100
                                toolbox: {
101
                                    show: true,
102
                                    feature: {
103
                                        dataZoom: {
104
                                            yAxisIndex: 'none'
105
                                        },
106
                                        dataView: {readOnly: false},
107
                                        magicType: {type: ['line', 'bar']},
108
                                        restore: {},
109
                                        saveAsImage: {}
110
                                    }
111
                                },
112
                                dataZoom: [{
113
                                    startValue: allData[allData.length - 7].time
114
                                }, {
115
                                    type: 'inside'
116
                                }],
117
                                visualMap: {
118
                                    top: 10,
119
                                    right: 10
120
                                },
121
                                series: [
122
                                    {
123
                                        name: 'PC端',
124
                                        type: 'line',
125
                                        data: allData.map(function (item) {
126
                                            return item.pc;
127
                                        })
128
                                    }, {
129
                                        name: '移动端APP',
130
                                        type: 'line',
131
                                        data: allData.map(function (item) {
132
                                            return item.app;
133
                                        })
134
                                    }, {
135
                                        name: '移动端H5',
136
                                        type: 'line',
137
                                        data: allData.map(function (item) {
138
                                            return item.h5;
139
                                        })
140
                                    },{
141
                                        name:'小程序',
142
                                        type:'line',
143
                                        data:allData.map(function (item) {
144
                                            return item.wx;
145
                                        })
146
                                    }, {
147
                                        name: '合计',
148
                                        type: 'line',
149
                                        label: {
150
                                            normal: {
151
                                                show: true,
152
                                                position: 'top'
153
                                            }
154
                                        },
155
                                        data: allData.map(function (item) {
156
                                            return item.num;
157
                                        })
158
                                    }
159
                                ]
160
                            };
161
                            myChart.setOption(option);
162
                        }
163
                    });
164
                };
165
                // cr.listen(dict.doTransfer);
166
                load();
167
            }
168
        };
169
    });
170
});
171

+ 175 - 0
js/model/sys/question/edit.js

@ -0,0 +1,175 @@
1
/**
2
 * Created by TT on 2018/1/30.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "util", "form"], function (spa, util, fb) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_question_edit");
10
                var form = fb.build(root.find(".newForm"));
11
                root.find(".modal-ctrl .icon-times").on("click", function () {
12
                    spa.closeModal();
13
                });
14
                form.val({cnt: data.data.cnt,title:data.data.title});
15
                var saveBtn = root.find(".opt-save"),
16
                    save = function () {
17
                        var img = [];
18
                        $('#fileList').find('img').each(function () {
19
                            img.push($(this).attr("name"));
20
                        });
21
                        util.post("../ajax/qa/question/modify", {
22
                            img: img.join(","),
23
                            title: form.val().title,
24
                            cnt: form.val().cnt,
25
                            id: data.data.id
26
                        }, function () {
27
                            spa.closeModal();
28
                            if (data.hand) {
29
                                data.hand();
30
                            }
31
                        }, {});
32
                    };
33
34
                var $list = $('#fileList'),
35
                    ratio = window.devicePixelRatio || 1,
36
                    thumbnailWidth = 100 * ratio,
37
                    thumbnailHeight = 100 * ratio,
38
                    uploader;
39
                uploader = WebUploader.create({
40
                    auto: true,
41
                    server: 'http://192.168.3.233:81/ajax/question/upload',
42
                    pick: {
43
                        id: "#filePicker",
44
                        multiple: false
45
                    },
46
                    duplicate: true,
47
                    // fileNumLimit:5,
48
                    // fileSingleSizeLimit: 2*1024*1024,
49
                    accept: {
50
                        title: 'Images',
51
                        extensions: 'gif,jpg,jpeg,bmp,png',
52
                        mimeTypes: 'image/jpg,image/jpeg,image/png'
53
                    }
54
                });
55
                uploader.on('fileQueued', function (file) {
56
                    if ($(".file-item").length < 3) {
57
58
                        var $li = $(
59
                                '<div id="' + file.id + '" class="file-item thumbnail">' +
60
                                '<img>' +
61
                                '</div>'
62
                            ),
63
                            $img = $li.find('img');
64
65
                        $list.append($li);
66
67
                        if ($('#fileList').find('img').length > 2) {
68
                            $('#filePicker').hide();
69
                        }
70
                    }
71
                });
72
                uploader.on('uploadSuccess', function (file, data) {
73
                    console.log(data);
74
                    $('#' + file.id).addClass('upload-state-done');
75
                    if (data.success) {
76
                        $('#' + file.id).find('img').attr('name', data.data[0].uri);
77
                    }
78
                    uploader.makeThumb(file, function (error, src) {
79
                        var $img = $("#" + file.id).find('img');
80
                        if (error) {
81
                            $img.replaceWith('<span>不能预览</span>');
82
                            return;
83
                        }
84
85
                        $img.attr('src', src);
86
                    }, thumbnailWidth, thumbnailHeight);
87
                    if ($('#fileList').find('img').length < 3) {
88
                        $('#filePicker').show();
89
                    }
90
                    if (uploader.getStats().progressNum == 0 || uploader.getStats().queueNum == 0) {
91
                        saveBtn.on("click", save);
92
                    }
93
                });
94
                uploader.on('uploadComplete', function (file) {
95
                    var $li = $('#' + file.id);
96
                    $li.find('.progress').remove();
97
                    $('<div class="file-panel">' +
98
                        '<span class="cancel icon-remove-sign">删除</span>' +
99
                        '</div>').appendTo($li);
100
                });
101
                $list.on("click", ".cancel", function () {
102
                    $(this).parent().parent().remove();
103
                    if ($('#fileList').find('img').length < 3) {
104
                        $('#filePicker').show();
105
                    }
106
                    uploader.refresh();
107
                });
108
                uploader.on('uploadProgress', function (file, percentage) {
109
                    var $li = $('#' + file.id),
110
                        $percent = $li.find('.progress span');
111
112
                    // 避免重复创建
113
                    if (!$percent.length) {
114
                        $percent = $('<p class="progress"><span></span></p>')
115
                            .appendTo($li)
116
                            .find('span');
117
                    }
118
                    $percent.css('width', percentage * 100 + '%');
119
                    $('#filePicker').hide();
120
                    saveBtn.unbind("click");
121
                });
122
                uploader.on('error', function (type) {
123
                    switch (type) {
124
                        case 'Q_EXCEED_NUM_LIMIT':
125
                            alert("错误:上传文件数量过多!");
126
                            break;
127
                        case 'Q_EXCEED_SIZE_LIMIT':
128
                            alert("错误:文件总大小超出限制!");
129
                            break;
130
                        case 'F_EXCEED_SIZE':
131
                            alert("错误:文件大小超出限制!");
132
                            break;
133
                        case 'Q_TYPE_DENIED':
134
                            alert("错误:禁止上传该类型文件!");
135
                            break;
136
                        default:
137
                            alert('错误代码:' + type);
138
                            break;
139
                    }
140
                });
141
                if (data.data.img) {
142
                    var image = split1(data.data.img);
143
                    for (var i = 0; i < image.length; i++) {
144
                        var $li = $(
145
                                '<div class="file-item thumbnail">' +
146
                                '<img  src="http://www.ekexiu.com/data/question/" id="oimg" />' +
147
                                '</div>'
148
                            ),
149
                            $btn = $('<div class="file-panel">' +
150
                                '<span class="cancel icon-remove-sign">删除</span>' +
151
                                '</div>').appendTo($li),
152
                            $img = $li.find('img');
153
                        $list.append($li);
154
                        $img.attr('src', "http://192.168.3.233:81/data/question" + image[i]);
155
                        // $img.attr('src', "../data/images/researchResult/" + image[i]+".jpg");
156
                        $img.attr('name', image[i]);
157
                    }
158
                    if ($('#fileList').find('img').length > 2) {
159
                        $('#filePicker').hide();
160
                    }
161
                }
162
163
                function split1(data) {
164
                    var index = data.split(",");
165
                    var arr = [];
166
                    for (var m = 0; m < index.length; m++) {
167
                        arr.push(index[m]);
168
                    }
169
                    return arr;
170
                }
171
172
            }
173
        }
174
    });
175
});

+ 120 - 0
js/model/sys/question/edit2.js

@ -0,0 +1,120 @@
1
/**
2
 * Created by TT on 2018/1/31.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "util", "form", "upload"], function (spa, util, fb, upload) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_question_edit2");
10
                var form = fb.build(root.find(".newForm"));
11
                root.find(".modal-ctrl .icon-times").on("click", function () {
12
                    spa.closeModal();
13
                });
14
                form.val({cnt: data.data.cnt, title: data.data.title});
15
                var saveBtn = root.find(".opt-save"),
16
                    headArea = root.find(".head-ctn"),
17
                    $list = $('#fileList'),
18
                    save = function () {
19
                        var img = [];
20
                        $('#fileList').find('img').each(function () {
21
                            img.push($(this).attr("name"));
22
                        });
23
                        util.post("../ajax/qa/question/modify", {
24
                            img: img.join(","),
25
                            title: form.val().title,
26
                            cnt: form.val().cnt,
27
                            id: data.data.id
28
                        }, function () {
29
                            spa.closeModal();
30
                            if (data.hand) {
31
                                data.hand();
32
                            }
33
                        }, {});
34
                    };
35
36
                upload.build({
37
                    render: root.find(".upload-btn"),
38
                    accept: "image/gif, image/jpeg",
39
                    fail: function (errType, errData) {
40
                        /*this ={id,name,size,type,abort=function}*/
41
                        util.errMsg(this.name + "上传文件错误:" + errType);
42
                        this.ele.remove();
43
                        saveBtn.on("click", save);
44
                    },
45
                    async: false,
46
                    // maxSize: 1024 * 1024 * 10,
47
                    done: function (data) {
48
                        /*this ={id,name,size,type,abort=function}*/
49
                        this.ele.remove();
50
                        // headArea.find("img").remove();
51
                        $('<div class="file-item thumbnail"><img src="../data/question' + data[0].uri + '"' +
52
                            'name="' + data[0].uri + '">' +
53
                            '<div class="file-panel">' +
54
                            '<span class="cancel icon-remove-sign">删除</span>' +
55
                            '</div>' +
56
                            '</div>').appendTo($list);
57
                        form.val({"head": data.uri});
58
                        if ($('#fileList').find('img').length > 2) {
59
                            $('.upload-btn').hide();
60
                        }
61
                        saveBtn.on("click", save);
62
                    },
63
                    start: function () {
64
                        /*this ={id,name,size,type,abort=function}*/
65
                        // this.ele = $("<div class='upload-item'><div class='progress'></div><span>" + this.name + "</span><div>");
66
                        // this.ele.appendTo(headArea);
67
                        // this.progress = this.ele.find(".progress");
68
                        saveBtn.off("click");
69
                    },
70
                    notity: function (total, loaded) {
71
                        /*this ={id,name,size,type,abort=function}*/
72
                        // var vv = "" + Math.ceil(loaded * 100 / total) + "%;";
73
                        // this.progress.attr("style", "width:" + vv);
74
                        // this.progress.text(vv);
75
                    },
76
                    uri: "../ajax/qa/upload"
77
                });
78
                $list.on("click", ".cancel", function () {
79
                    $(this).parent().parent().remove();
80
                    if ($('#fileList').find('img').length < 3) {
81
                        $('.upload-btn').show();
82
                    }
83
                });
84
85
86
                if (data.data.img) {
87
                    var image = split1(data.data.img);
88
                    for (var i = 0; i < image.length; i++) {
89
                        var $li = $(
90
                                '<div class="file-item thumbnail">' +
91
                                '<img  src="http://www.ekexiu.com/data/question/" id="oimg" />' +
92
                                ' <div class="file-panel">' +
93
                                '<span class="cancel icon-remove-sign">删除</span>' +
94
                                '</div>' +
95
                                '</div>'
96
                            ),
97
                            $img = $li.find('img');
98
                        $list.append($li);
99
                        $img.attr('src', "http://192.168.3.233:81/data/question" + image[i]);
100
                        // $img.attr('src', "../data/images/researchResult/" + image[i]+".jpg");
101
                        $img.attr('name', image[i]);
102
                    }
103
                    if ($('#fileList').find('img').length > 2) {
104
                        $('.upload-btn').hide();
105
                    }
106
                }
107
                function split1(data) {
108
                    var index = data.split(",");
109
                    var arr = [];
110
                    for (var m = 0; m < index.length; m++) {
111
                        arr.push(index[m]);
112
                    }
113
                    return arr;
114
                }
115
116
                saveBtn.on("click", save);
117
            }
118
        }
119
    });
120
});

+ 180 - 0
js/model/sys/question/index.js

@ -0,0 +1,180 @@
1
/**
2
 * Created by TT on 2018/1/29.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "pagedatagrid", "util"], function (spa, pdgf, util) {
7
        return {
8
            main: function () {
9
                var root = spa.findInMain(".sys_question_index");
10
                var pdg = pdgf.build(root);
11
                pdg.code.shell("showDay", function (env) {
12
                    if (env.cd && env.cd[this.k]) {
13
                        var day = env.cd[this.k];
14
                        return day.substring(0, 4) + "年" + day.substring(4, 6) + "月" + day.substring(6, 8) + "日  " + day.substring(8, 10) + ":" + day.substring(10, 12);
15
                    }
16
                    return "";
17
                });
18
                pdg.code.listen($.dict.doTransfer);
19
                pdg.code.listen(function(){
20
                    root.find(".hand-col").each(function() {
21
                        var $e = $(this);
22
                        var qId = $e.attr("qId");
23
                        util.get("/ajax/content/countProfessor",{id:qId,type:8},function(data){
24
                            $e.text(data);
25
                        },{});
26
                        $e.removeClass("hand-col");
27
                    });
28
                    root.find(".table-opt a.name").on("click",function () {
29
                        var qId = $(this).parent().attr("qId");
30
                        // window.open('http://www.ekexiu.com/articalShow.html?articleId=' + articleId);
31
                        window.open('http://www.ekexiu.com/qa-show.html?id='+qId);
32
                    });
33
                    root.find("a.author").on("click",function () {
34
                        var professorId = $(this).parent().attr("professorId");
35
                        if(professorId){
36
                            window.open('http://www.ekexiu.com/userInforShow.html?professorId='+professorId);
37
                        }
38
                    })
39
                });
40
41
                root.find(".opt-query").on("click", function () {
42
                    pdg.load();
43
                });
44
                pdg.load();
45
                root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
46
                    var $this = $(this);
47
                    $this.toggleClass("checked");
48
                    if ($this.hasClass("checked")) {
49
                        root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
50
                    } else {
51
                        root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
52
                    }
53
                });
54
                root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
55
                    var $this = $(this);
56
                    $this.toggleClass("checked");
57
                });
58
                root.find(".opt-del").on("click", function() {
59
                    var $question = root.find("td.opt-check>i.checked");
60
                    if($question.length) {
61
                        if($question.length > 1) {
62
                            util.alert("只能选择一个问题");
63
                        } else {
64
                            util.boxMsg({
65
                                title: "删除问题",
66
                                content: "您是否要删除选中的问题!删除后不可恢复",
67
                                btns: [{
68
                                    caption: "确认",
69
                                    hand: function() {
70
                                        util.del("../ajax/qa/deleteQuestion", { id: $question.attr("qId") }, function() { pdg.reload() }, {});
71
                                    }
72
                                },
73
                                    { caption: "取消" }
74
                                ]
75
                            });
76
                        }
77
                    } else {
78
                        util.alert("请选择一个问题");
79
                    }
80
                });
81
                root.find(".opt-edit").on("click", function() {
82
                    var $question = root.find("td.opt-check>i.checked");
83
                    if ($question.length) {
84
                        if ($question.length>1) {
85
                            util.alert("只能选择一个问题");
86
                        }else {
87
                            $.util.get("../ajax/qa/question?id="+$question.attr("qId"),null,function(rd){
88
                                if(rd){
89
                                    spa.showModal("sys_question_edit", {
90
                                        data:rd,
91
                                        hand: function () {
92
                                            pdg.reload();
93
                                        }
94
                                    });
95
                                }else{
96
                                    util.alert("问题不存在");
97
                                }
98
                            },{});
99
                        }
100
                    }else {
101
                        util.alert("请选择一个问题");
102
                    }
103
                });
104
                root.find(".opt-edit2").on("click", function() {
105
                    var $question = root.find("td.opt-check>i.checked");
106
                    if ($question.length) {
107
                        if ($question.length>1) {
108
                            util.alert("只能选择一个问题");
109
                        }else {
110
                            $.util.get("../ajax/qa/question?id="+$question.attr("qId"),null,function(rd){
111
                                if(rd){
112
                                    spa.showModal("sys_question_edit2", {
113
                                        data:rd,
114
                                        hand: function () {
115
                                            pdg.reload();
116
                                        }
117
                                    });
118
                                }else{
119
                                    util.alert("问题不存在");
120
                                }
121
                            },{});
122
                        }
123
                    }else {
124
                        util.alert("请选择一个问题");
125
                    }
126
                });
127
                root.find(".opt-view").on("click", function () {
128
                    var $question = root.find("td.opt-check>i.checked");
129
                    if ($question.length) {
130
                        if ($question.length > 1) {
131
                            util.alert("只能选择一个问题");
132
                        } else {
133
                            var qId = $question.attr("qId");
134
                            window.open('http://www.ekexiu.com/qa-show.html?id='+qId);
135
                        }
136
                    } else {
137
                        util.alert("请选择一个问题");
138
                    }
139
                });
140
                root.find(".opt-keys").on("click", function () {
141
                    var $question = root.find("td.opt-check>i.checked");
142
                    if ($question.length) {
143
                        if ($question.length>1) {
144
                            util.alert("只能选择一个问题");
145
                        }else {
146
                            spa.showModal("sys_question_keys", {
147
                                id: $question.attr("qId"),
148
                                hand: function () {
149
                                    pdg.reload();
150
                                }
151
                            });
152
                        }
153
                    }else {
154
                        util.alert("请选择一个问题");
155
                    }
156
                });
157
                root.find(".opt-count").on("click", function () {
158
                    var $question = root.find("td.opt-check>i.checked");
159
                    if ($question.length) {
160
                        if ($question.length>1) {
161
                            util.alert("只能选择一篇问题");
162
                        }else {
163
                            spa.showModal("sys_question_count", {
164
                                id: $question.attr("qId"),
165
                                hand: function () {
166
                                    pdg.reload();
167
                                }
168
                            });
169
                        }
170
                    }else {
171
                        util.alert("请选择一篇问题");
172
                    }
173
                });
174
175
            }, mainDestory: function () {
176
177
            }
178
        };
179
    });
180
});

+ 152 - 0
js/model/sys/question/keys.js

@ -0,0 +1,152 @@
1
/**
2
 * Created by TT on 2018/1/30.
3
 */
4
;
5
spa_define(function () {
6
    return $.use(["spa", "util", "form"], function (spa, util, fb) {
7
        return {
8
            modal: function (data) {
9
                var root = spa.findInModal(".sys_question_keys");
10
                var ca = {ready: true, items: []};
11
                var form = fb.build(root.find(".newForm"), {
12
                    keyList: ca
13
                });
14
                var oValue;
15
                var oJudge;
16
17
                util.get("../ajax/qa/question?id=" + data.id, null, function (data) {
18
                    if (data) {
19
                        if (data.keys) {
20
                            form.val({keyList: split(data.keys)});
21
                        }
22
                    } else {
23
                        util.alert("此问题不存在");
24
                    }
25
                });
26
27
                var saveBtn = root.find(".opt-save"),
28
                    save = function () {
29
                        if (form.val().keyList) {
30
                            form.val({
31
                                keys: oString(form.val().keyList)
32
                            });
33
                        } else {
34
                            util.alert("问题关键词不可为空");
35
                            return;
36
                        }
37
                        util.post("../ajax/qa/question/keys", {
38
                            id: data.id,
39
                            keys: form.val().keys
40
                        }, function () {
41
                            spa.closeModal();
42
                            if (data.hand) {
43
                                data.hand();
44
                            }
45
                        }, {});
46
                    };
47
                var trim = function (str) { //删除左右两端的空格
48
                    return str.replace(/(^\s*)|(\s*$)/g, "");
49
                };
50
                var part = function (one, list, num) {
51
                    oValue = one;
52
                    oJudge = list || [];
53
                    if (oJudge.length >= num) {
54
                        util.alert("最多" + num + "个");
55
                        return;
56
                    }
57
                    var repeat,
58
                        b;
59
                    if (!oValue) {
60
                        util.alert('提示', '请先填写内容');
61
                        return;
62
                    }
63
                    if (oValue.length > 15) {
64
                        util.alert('提示', '添加内容不能超过15个字');
65
                        return;
66
                    } else {
67
                        var oValueList = oValue.split(","),
68
                            length = oValueList.length;
69
                        for (var m = 0;m<oValueList.length;m++) {
70
                            oValueList[m] = trim(oValueList[m]);
71
                        }
72
                        for (var j = 0; j < length; j++) {
73
                            for (var n = j + 1; n < oValueList.length + 1;) {
74
                                if (oValueList[j] == oValueList[n]) {
75
                                    oValueList.remove(n);
76
                                    repeat = false;
77
                                } else {
78
                                    n++;
79
                                }
80
                            }
81
                        }
82
                        for (var j = 0; j < oValueList.length;) {
83
                            for (var i = 0; i < oJudge.length; i++) {
84
                                if (oValueList[j] == oJudge[i]) {
85
                                    oValueList.remove(j);
86
                                    repeat = false;
87
                                    b = true;
88
                                }
89
                            }
90
                            if (b) {
91
                                b = false
92
                            } else j++;
93
                        }
94
                        if (repeat == false) {
95
                            util.alert('提示', '添加内容不能重复');
96
                        }
97
                        for (var m = 0; m < oValueList.length; m++) {
98
                            ca.items.push({code: oValueList[m], caption: oValueList[m]});
99
                            oJudge.push(oValueList[m]);
100
                        }
101
                    }
102
                };
103
104
                Array.prototype.remove = function (obj) {
105
                    for (var i = 0; i < this.length; i++) {
106
                        var temp = this[i];
107
                        if (!isNaN(obj)) {
108
                            temp = i;
109
                        }
110
                        if (temp == obj) {
111
                            for (var j = i; j < this.length; j++) {
112
                                this[j] = this[j + 1];
113
                            }
114
                            this.length = this.length - 1;
115
                        }
116
                    }
117
                };
118
119
                function oString(data) {
120
                    var arry = new Array();
121
                    if (data) {
122
                        for (var i = 0; i < data.length; i++) {
123
                            arry.push(data[i]);
124
                        }
125
                    }
126
                    return arry.join(",");
127
                }
128
129
                var split = function (data) {
130
                    var index = data.split(",");
131
                    var arr = [];
132
                    for (var m = 0; m < index.length; m++) {
133
                        ca.items.push({code: index[m], caption: index[m]});
134
                        arr.push(index[m]);
135
                    }
136
                    return arr;
137
                };
138
139
                root.find(".opt-key").on("click", function () {
140
                    part(form.val().newKey, form.val().keyList, 5);
141
                    form.val({newKey: "", keyList: oJudge});
142
                });
143
144
                root.find(".modal-ctrl .icon-times").on("click", function () {
145
                    spa.closeModal();
146
                });
147
148
                saveBtn.on("click", save);
149
            }
150
        }
151
    });
152
});

+ 1 - 1
js/model/sys/resresult/edit.js

@ -428,7 +428,7 @@ spa_define(function () {
428 428
                                '</div>').appendTo($li),
429 429
                            $img = $li.find('img');
430 430
                        $list.append($li);
431
                        $img.attr('src', "http://www.ekexiu.com/data/researchResult/" + data.data.id + ".jpg");
431
                        $img.attr('src', "http://www.ekexiu.com/data/researchResult/"  + image[i]);
432 432
                        // $img.attr('src', "../data/images/researchResult/" + image[i]);
433 433
                        $img.attr('name', image[i]);
434 434
                    }

+ 22 - 0
js/static.js

@ -157,6 +157,22 @@
157 157
            code:"2",caption:"按浏览量由高到低排序",enabled:true
158 158
        }]);
159 159
160
        dict.set("sort_answer",[{
161
            code:"1",caption:"按创建时间由新到旧排序",enabled:true
162
        },{
163
            code:"2",caption:"按点赞量由高到低排序",enabled:true
164
        },{
165
            code:"3",caption:"按总投票量由高到低排序",enabled:true
166
        }]);
167
168
        dict.set("sort_question",[{
169
            code:"1",caption:"按创建时间由新到旧排序",enabled:true
170
        },{
171
            code:"2",caption:"按浏览量由高到低排序",enabled:true
172
        },{
173
            code:"3",caption:"按回答数由高到低排序",enabled:true
174
        }]);
175
160 176
        dict.set("feedback_schema",[{
161 177
            code:"1",caption:"论文",enabled:true
162 178
        },{
@ -169,6 +185,12 @@
169 185
            code:"5",caption:"资源",enabled:true
170 186
        },{
171 187
            code:"6",caption:"文章",enabled:true
188
        },{
189
            code:"7",caption:"需求",enabled:true
190
        },{
191
            code:"8",caption:"问题",enabled:true
192
        },{
193
            code:"9",caption:"回答",enabled:true
172 194
        }]);
173 195
174 196
        dict.set("feedback_state",[{