12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- 'use strict';
- /**
- * 待办页js
- *
- * @author EllisRan.
- * @date 2019/3/19
- * @version
- */
- $(document).ready(() => {
- // $('a[href="#view-msg"]').on('click', function () {
- // const id = $(this).attr('msg-id');
- // const msgInfo = _.find(msgList,{ id: parseInt(id) });
- // $('#title').html(msgInfo.title);
- // $('#creator').html(msgInfo.creator);
- // $('#release_time').html(moment(msgInfo.release_time*1000).format('YYYY-MM-DD'));
- // $('#content').html(msgInfo.content);
- // $('#user_permission').html('');
- // if (userMsgPermission && parseInt(uid) === msgInfo.create_uid ) {
- // const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id +'" class="btn btn-sm btn-outline-primary">编辑</a>';
- // $('#user_permission').html(permissionHtml);
- // }
- // });
- $('.list-group-item a').on('click', function () {
- const id = $(this).attr('msg-id');
- const msgInfo = _.find(msgList, {id: parseInt(id)});
- $('.msg-height-list li').removeClass('list-waring');
- $(this).parents('.list-group-item').addClass('list-waring');
- $('#title').html(msgInfo.title);
- $('#release_time').html(moment(msgInfo.release_time * 1000).format('YYYY-MM-DD'));
- $('#content').html(msgInfo.content);
- $('#user_permission').html('');
- if (type && parseInt(type) === 1) {
- $('#creator').html(msgInfo.creator);
- $('#view-msg .modal-title').text('项目通知');
- if (userMsgPermission && parseInt(uid) === msgInfo.create_uid) {
- const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id + '" class="btn btn-sm btn-outline-primary">编辑</a>';
- $('#user_permission').html(permissionHtml);
- }
- } else {
- $('#creator').html('');
- $('#view-msg .modal-title').text('系统通知');
- }
- setFiles(msgInfo.files);
- });
- $('.system-msg').on('click', function () {
- const id = $(this).attr('msg-id');
- const msgInfo = _.find(sysMsgList, {id: parseInt(id)});
- $('#title').html(msgInfo.title);
- $('#creator').html('');
- $('#release_time').html(moment(msgInfo.release_time * 1000).format('YYYY-MM-DD'));
- $('#content').html(msgInfo.content);
- $('#view-msg .modal-title').text('系统通知');
- $('#user_permission').html('');
- setFiles(msgInfo.files);
- });
- function setFiles(files) {
- $('#files-list').html('');
- if (files && files.length > 0) {
- let html = '<h5>附件</h5>';
- for (const file of files) {
- html += `<a href="${file.viewpath ? file.viewpath : '/wap/message/download/file/' + file.id}" target="_blank">
- <div class="card my-1" style="cursor: pointer">
- <div class="card-body"><i class="fa fa-file"></i> ${file.filename}<span class="pull-right text-secondary">${file.filesize}</span></div>
- </div>
- </a>`;
- }
- $('#files-list').html(html);
- }
- }
- // $('#notice').on('click', 'li a', function() {
- // const id = $(this).data('id')
- // postData(window.location.pathname + '/push', {id}, function() {
- // return
- // })
- // })
- });
|