| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- /**
- * 查看公告详情
- * */
- $(function() {
- var n_id = helper.request.queryString("edit_id");
- if(n_id){
- getDetails(n_id); //公告详情信息
- }
- });
- //获取详情
- function getDetails(ids) {
- $.getJSON(huayi.config.callcenter_url + "messageapi/api/News/getdetails", {
- id: ids,
- }, function(data) {
- if(data.state == "success") {
- $('#project_detail_title').html(data.data.title); //标题
- $('#project_detail_category').html(data.data.typename); //公告类型
-
- $('#news_level').text(formatterLevel(data.data.level).stateName);//紧急程度
- $('#news_level').addClass(formatterLevel(data.data.level).stateClass);
-
- $('#pro_location').html(data.data.provincename + (data.data.cityname == null ? '' : data.data.cityname)); //所在地
- $('#pro_title').html(data.data.projectname); //所属项目
- $('#pro_sort').html(data.data.sort); //排序编号
- $('#createtime').html(data.data.createtime); //创建时间
- //logo
- if(data.data.headimg) {
- $('#project_img').attr('src', data.data.headimg);
- } else {
- $('#project_img').attr('src', '');
- }
- $('#project_detail_content').html(helper.filter.content(decodeURIComponent(data.data.content))); //项目内容
- //项目图纸
- var EnclosureList = data.data.files;
- if(EnclosureList && EnclosureList.length > 0) {
- var $list = $("#fileList");
- $.each(EnclosureList, function(i, v) {
- if(v.filesmallurl) {
- //原来的图片
- var $li = $(
- '<li><span class="img_mask"><a href="' + v.fileurl + '" download="filename" title="点击下载"><i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i></a></span>' +
- '<img layer-src="' + v.fileurl + '" src="' + v.filesmallurl + '" title="图片" alt="' + v.filename + '"/>' +
- '<span class="file_name">' + v.filename + '</span>' +
- '</li>'
- );
- $list.append($li);
- } else {
- var $liFile = $(
- '<li><span class="img_mask"><a href="' + v.fileurl + '" download="filename" title="点击下载"><i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i></a></span>' +
- '<div class="noThumb" title="文件"><i class="glyphicon glyphicon-paperclip"></i><p>无法预览</p></div>' +
- '<span class="file_name">' + v.filename + '</span>' +
- '</li>'
- );
- $list.append($liFile);
- }
- });
- layer.photos({
- photos: '#fileList',
- anim: 5, //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
- title: '查看图片',
- move: '.layui-layer-title',
- shadeClose: false,
- closeBtn: 1,
- area: ['80%', '90%'],
- tab: function(pic, layero) {
- $('.layui-layer-content').on("mousewheel", function(e, d) {
- helper.methods.zoomImg($('#layui-layer-photos').find('img[alt="' + pic.alt + '"]'), d);
- $('#layui-layer-photos').find('img[alt="' + pic.alt + '"]').dragging({
- move: "both", //拖动方向,x y both
- randomPosition: false //初始位置是否随机
- });
- return false;
- });
- helper.methods.initLayerPhotos('#layui-layer-photos', pic, layero);
- },
- });
- } else {
- $("#fileList").html('<p>暂无内容。。。</p>');
- }
- }
- });
- }
- //格式化紧急程度
- function formatterLevel(val) {
- //1 非常紧急,2 紧急,3 较急, 4 一般
- var stateClass, stateName;
- switch(val) {
- case 1:
- stateClass = 'state_audit_termination';
- stateName = '非常紧急';
- break;
- case 2:
- stateClass = 'state_audit_refuse';
- stateName = '紧急';
- break;
- case 3:
- stateClass = 'state_audit_wait';
- stateName = '较急';
- break;
- case 4:
- stateClass = 'state_audit_done';
- stateName = '一般';
- break;
- default:
- stateClass = 'text-block';
- stateName = '-';
- break;
- }
- return {
- "stateClass": stateClass,
- "stateName": stateName
- }
- }
|