Authored by 马力

Merge branch 'hotfix_资源位增加查看功能' into grey

@@ -14,7 +14,7 @@ module.exports=function(app) { @@ -14,7 +14,7 @@ module.exports=function(app) {
14 }); 14 });
15 15
16 /*资源内容管理页*/ 16 /*资源内容管理页*/
17 - app.get("/resource/content/index/:param","resource.resourceManage.ContentManage", "resourceManage_getUrlAction", function (response) { 17 + app.get("/resource/content/index/:param/:param","resource.resourceManage.ContentManage", "resourceManage_getUrlAction", function (response) {
18 this.$extend = { 18 this.$extend = {
19 data:response.data, 19 data:response.data,
20 moduleName: "资源管理", 20 moduleName: "资源管理",
@@ -13,6 +13,8 @@ var currIndex = 0; @@ -13,6 +13,8 @@ var currIndex = 0;
13 var lockStatus = 0; 13 var lockStatus = 0;
14 //资源id 14 //资源id
15 var param = location.href.substring(location.href.lastIndexOf("/") + 1); 15 var param = location.href.substring(location.href.lastIndexOf("/") + 1);
  16 +//0:查看1:编辑
  17 +var lock_type = location.href.substring(location.href.lastIndexOf("/")-1,location.href.lastIndexOf("/"));
16 common.util.__ajax({ 18 common.util.__ajax({
17 url: "/resources/resContentIndex", 19 url: "/resources/resContentIndex",
18 data: {id: param}, 20 data: {id: param},
@@ -21,13 +23,15 @@ common.util.__ajax({ @@ -21,13 +23,15 @@ common.util.__ajax({
21 resources = res.data; 23 resources = res.data;
22 console.log(resources); 24 console.log(resources);
23 }, true); 25 }, true);
24 -common.util.__ajax({  
25 - url: "/resources/updateLock",  
26 - data: {id: param, 26 +if(lock_type==1){
  27 + common.util.__ajax({
  28 + url: "/resources/updateLock",
  29 + data: {id: param,
27 status:1}, 30 status:1},
28 - async: false  
29 -}, function (res) {  
30 -}, true); 31 + async: false
  32 + }, function (res) {
  33 + }, true);
  34 +}
31 35
32 /*配置模块*/ 36 /*配置模块*/
33 var edit = new common.edit2(".modal-body", { 37 var edit = new common.edit2(".modal-body", {
@@ -449,6 +453,16 @@ $(document).on("change", ".observe", function () { @@ -449,6 +453,16 @@ $(document).on("change", ".observe", function () {
449 }); 453 });
450 }); 454 });
451 455
  456 +window.onbeforeunload = function(){
  457 + if(lock_type==1){
  458 + common.util.__ajax({
  459 + url: "/resources/updateLock",
  460 + data: {id: param,
  461 + status:0}
  462 + }, function () {
  463 + });
  464 + }
  465 +}
452 /*删除*/ 466 /*删除*/
453 $(document).on("click", ".del", function () {//删除 467 $(document).on("click", ".del", function () {//删除
454 if(!checkLockStatus()){ 468 if(!checkLockStatus()){
@@ -580,6 +594,10 @@ function dateStrToSeconds(date) { @@ -580,6 +594,10 @@ function dateStrToSeconds(date) {
580 594
581 595
582 function checkLockStatus(){ 596 function checkLockStatus(){
  597 + if(lock_type==0){
  598 + common.util.__tip("请点击内容编辑进行操作");
  599 + return false;
  600 + }
583 common.util.__ajax({ 601 common.util.__ajax({
584 url: "/resources/checkLock", 602 url: "/resources/checkLock",
585 data: {id: param}, 603 data: {id: param},
@@ -736,6 +754,9 @@ $(document).on("change", ".preTimes", function() { @@ -736,6 +754,9 @@ $(document).on("change", ".preTimes", function() {
736 }); 754 });
737 //删除tab 755 //删除tab
738 $(document).on("click", "#delTab", function() { 756 $(document).on("click", "#delTab", function() {
  757 + if(!checkLockStatus()){
  758 + return false;
  759 + }
739 if(times[currIndex].status == "进行中") { 760 if(times[currIndex].status == "进行中") {
740 common.util.__tip("进行中的页面不能删除"); 761 common.util.__tip("进行中的页面不能删除");
741 return false; 762 return false;
@@ -1594,4 +1615,4 @@ function validateRollingOverContent(data) { @@ -1594,4 +1615,4 @@ function validateRollingOverContent(data) {
1594 } 1615 }
1595 1616
1596 return errArr; 1617 return errArr;
1597 -}  
  1618 +}
@@ -58,7 +58,8 @@ var g = new common.grid({ @@ -58,7 +58,8 @@ var g = new common.grid({
58 }}, 58 }},
59 {display: "操作", name: "",render: function(item) { 59 {display: "操作", name: "",render: function(item) {
60 var arr = []; 60 var arr = [];
61 - arr.push('<a target="_blank" class="btn btn-xs btn-info contentManage" data-index="' + item.__index + '" href="/resource/content/index/' + item.id + '">内容管理</a>'); 61 + arr.push('<a target="_blank" class="btn btn-xs btn-info contentManage" data-index="' + item.__index + '" href="/resource/content/index/0/' + item.id + '">内容查看</a>');
  62 + arr.push('<a target="_blank" class="btn btn-xs btn-primary add" data-index="' + item.__index + '" href="/resource/content/index/1/' + item.id + '">内容编辑</a>');
62 arr.push('<a class="btn btn-xs btn-primary add2" data-index="' + item.__index + '">编辑</a>'); 63 arr.push('<a class="btn btn-xs btn-primary add2" data-index="' + item.__index + '">编辑</a>');
63 arr.push('<a class="btn btn-xs btn-danger delbtn" data-index="' + item.__index + '">删除</a>'); 64 arr.push('<a class="btn btn-xs btn-danger delbtn" data-index="' + item.__index + '">删除</a>');
64 if(item.lockPersonName !=''){ 65 if(item.lockPersonName !=''){