leftBase.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. var pagePath = $("meta[name='_ctx']").attr("content");
  2. pagePath = pagePath.substring(0, pagePath.length - 1);
  3. document.writeln("<div class=\"fixed-menu\">");
  4. document.writeln(" <div class=\"fixed-menu-nav\">");
  5. document.writeln(" <div class=\"fixed-menu-nav-title\">导航栏</div>");
  6. document.writeln(" <div class=\"fixed-menu-nav-list\">");
  7. document.writeln(" <ul>");
  8. document.writeln(" <li>");
  9. document.writeln(" <a href=\'"+pagePath+"/policy/toPolicyExamination\'>创新能力体检</a>");
  10. document.writeln(" </li>");
  11. document.writeln(" <li>");
  12. document.writeln(" <a href=\'"+pagePath+"/policy/toRecommendProject\'>项目能力申报</a>");
  13. document.writeln(" </li>");
  14. document.writeln(" </ul>");
  15. document.writeln(" </div>");
  16. document.writeln(" </div>");
  17. document.writeln(" <div class=\"fixed-menu-nav pj-link\">");
  18. document.writeln(" <p class=\"ft-color-blue\">诊断满意度</p>");
  19. document.writeln(" <p class=\"ft-12\"><a href=\"javascript:;\" onClick=\"modaldemo()\">您对本次诊断是否满意<br>点击这里进行评价</a></p>");
  20. document.writeln(" </div>");
  21. document.writeln(" </div>");
  22. document.writeln(" <!--评价弹出层-->");
  23. document.writeln(" <div id=\"modal-demo\" class=\"modal fade\">");
  24. document.writeln(" <div class=\"modal-dialog\">");
  25. document.writeln(" <div class=\"modal-content radius\">");
  26. document.writeln(" <div class=\"modal-header pingjia\">");
  27. document.writeln(" <h3 class=\"modal-title\">诊断满意度打分 :</h3>");
  28. document.writeln(" <a class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" href=\"javascript:;\">×</a>");
  29. document.writeln(" </div>");
  30. document.writeln(" <div class=\"modal-body\">");
  31. document.writeln(" <p>请针对页面下述诊断报告进行满意度打分及建议</p>");
  32. document.writeln(" <div class=\"clearfix\" style=\"margin: 30px;\">");
  33. document.writeln(" <span class=\"pull-left\" style=\"margin-top: 5px;\">打分:</span>");
  34. document.writeln(" <ul class=\"stars pull-left\">");
  35. document.writeln(" <li startVal=\"1\"><i class=\"iconfont\">&#xe610;</i></li>");
  36. document.writeln(" <li startVal=\"2\"><i class=\"iconfont\">&#xe610;</i></li>");
  37. document.writeln(" <li startVal=\"3\"><i class=\"iconfont\">&#xe610;</i></li>");
  38. document.writeln(" <li startVal=\"4\"><i class=\"iconfont\">&#xe610;</i></li>");
  39. document.writeln(" <li startVal=\"5\"><i class=\"iconfont\">&#xe610;</i></li>");
  40. document.writeln(" </ul>");
  41. document.writeln(" <span id=\"pjdj\" class=\"dj-style\"></span>");
  42. document.writeln(" </div>");
  43. document.writeln(" <div class=\"clearfix\" style=\"margin-top: 20px;\">");
  44. document.writeln(" <span class=\"pull-left\" style=\"margin-top: 5px;\">反馈和建议:</span>");
  45. document.writeln(" <div class=\"pull-left\" style=\"width: 480px;\">");
  46. document.writeln(" <textarea class=\"textarea-style\" id=\"feedback\" name=\"feedback\"></textarea>");
  47. document.writeln(" </div>");
  48. document.writeln(" </div>");
  49. document.writeln(" </div>");
  50. document.writeln(" <div class=\"modal-footer\">");
  51. document.writeln(" <button class=\"btn btn-primary\" onClick=\"modaldemo2()\">提交</button>");
  52. document.writeln(" <button class=\"btn\" data-dismiss=\"modal\" aria-hidden=\"true\">返回</button>");
  53. document.writeln(" </div>");
  54. document.writeln(" </div>");
  55. document.writeln(" </div>");
  56. document.writeln(" </div>");
  57. document.writeln(" <!--/评价弹出层-->");
  58. document.writeln(" <!--评价成功后弹出层-->");
  59. document.writeln(" <div id=\"evaluation\" class=\"modal fade\">");
  60. document.writeln(" <div class=\"modal-dialog\">");
  61. document.writeln(" <div class=\"modal-content radius\">");
  62. document.writeln(" <div class=\"modal-header pingjia\">");
  63. document.writeln(" <h3 class=\"modal-title\">提交成功</h3>");
  64. document.writeln(" <a class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" href=\"javascript:;\" onClick=\"modalHide()\">×</a>");
  65. document.writeln(" </div>");
  66. document.writeln(" <div class=\"modal-body\" style=\"text-align: center; line-height: 2;\">");
  67. document.writeln(" <p>满意度打分提交成功!</p>");
  68. document.writeln(" <p>报告详情与打分可前往后台政务服务管理-> <a href=\'"+pagePath+"/admin/home\' class=\"ft-color-blue\">政策雷达查看</a> </p>");
  69. document.writeln(" <p>点击“确定”返回门户</p>");
  70. document.writeln(" </div>");
  71. document.writeln(" <div class=\"modal-footer\">");
  72. document.writeln(" <a href=\'"+pagePath+"/home\' class=\"btn btn-primary\" onClick=\"modalHide()\">确定</a>");
  73. document.writeln(" </div>");
  74. document.writeln(" </div>");
  75. document.writeln(" </div>");
  76. document.writeln(" </div>");
  77. var star = $("#satisfaction_score").val();
  78. var feedback = $("#report_feedback").val();
  79. $(function() {
  80. var url = window.location.href
  81. if(star > 0) {
  82. $(".fixed-menu .pj-link").hide()
  83. }
  84. // 评价后显示状态
  85. $("#feedback").val(feedback);
  86. for (var i = 1; i <= star; i++) {
  87. $('.stars li:nth-child(' + i + ')').css('color', '#F0AD4E');
  88. if (star == 1) {
  89. $('#pjdj').text("不满意")
  90. }
  91. else if (star == 2) {
  92. $('#pjdj').text("不太满意")
  93. }
  94. else if (star == 3) {
  95. $('#pjdj').text("马马虎虎")
  96. }
  97. else if (star == 4) {
  98. $('#pjdj').text("比较满意")
  99. }
  100. else {
  101. $('#pjdj').text("满意")
  102. }
  103. }
  104. $(".fixed-menu-nav-list ul li a").each(function () {
  105. var menuUrl = $(this).attr("href")
  106. var urlIndex = menuUrl.lastIndexOf('/')
  107. var pathName = menuUrl.substring(urlIndex+1)
  108. if(url.indexOf(pathName) > -1){
  109. $(this).parent().addClass("active")
  110. }
  111. else {
  112. $(this).parent().removeClass("active")
  113. }
  114. });
  115. //为星星设置hover效果
  116. var isClicked = false;
  117. var beforeClickedIndex = -1;
  118. var clickNum = 0; //点击同一颗星次数
  119. $('.stars li').hover(
  120. function () {
  121. if (!isClicked && star<0) {
  122. $(this).css('color', '#F0AD4E');
  123. var index = $(this).index();
  124. for (var i = 0; i <= index; i++) {
  125. $('li:nth-child(' + i + ')').css('color', '#F0AD4E');
  126. }
  127. }
  128. },
  129. function () {
  130. if (!isClicked && star<0) {
  131. $('li').css('color', '#ADADAD');
  132. }
  133. }
  134. );
  135. //星星点击事件
  136. $('.stars li').click(function () {
  137. startVal = $(this).attr("startVal");
  138. $("#startVal").val(startVal);
  139. $('li').css('color', '#ADADAD');
  140. isClicked = true;
  141. var index = $(this).index()+1;
  142. for (var i = 1; i <= index; i++) {
  143. $('li:nth-child(' + i + ')').css('color', '#F0AD4E');
  144. star = index
  145. if (index == 1) {
  146. $('#pjdj').text("不满意")
  147. }
  148. else if (index == 2) {
  149. $('#pjdj').text("不太满意")
  150. }
  151. else if (index == 3) {
  152. $('#pjdj').text("马马虎虎")
  153. }
  154. else if (index == 4) {
  155. $('#pjdj').text("比较满意")
  156. }
  157. else {
  158. $('#pjdj').text("满意")
  159. }
  160. }
  161. // if (index == beforeClickedIndex) { //两次点击同一颗星星 该星星颜色变化
  162. // clickNum++;
  163. // if (clickNum % 2 == 1) {
  164. // $('li:nth-child(' + (index + 1) + ')').css('color', '#ADADAD');
  165. // if(startVal == 1) {
  166. // startVal = 0
  167. // star = 0
  168. // }
  169. // $('#pjdj').text("")
  170. // console.log("if")
  171. // } else {
  172. // $('li:nth-child(' + (index + 1) + ')').css('color', '#F0AD4E');
  173. // console.log("else")
  174. // }
  175. //
  176. // } else {
  177. // clickNum = 0;
  178. // beforeClickedIndex = index;
  179. // }
  180. // star = startVal
  181. });
  182. });
  183. // 评价弹出层
  184. function modaldemo(){
  185. $("#modal-demo").modal("show")
  186. };
  187. function modaldemo2(){
  188. // var data = $("#scoreForm").serializeArray();
  189. // data.feedback = "123456";
  190. // console.log(data);
  191. if(star > 0) {
  192. $("#scoreForm").ajaxSubmit({
  193. url: pagePath + "/policy/submitFeedback",
  194. type: "post",
  195. data: {
  196. feedback: $("#feedback").val()
  197. },
  198. dataType: "json",
  199. success: function (result) {
  200. $(".fixed-menu .pj-link").hide()
  201. },
  202. error: function () {
  203. errorMessage('系统错误!');
  204. }
  205. });
  206. $("#modal-demo").hide();
  207. $("#evaluation").modal("show");
  208. }
  209. else {
  210. errorMessage("请打分")
  211. // alert("请打分")
  212. }
  213. };
  214. function modalHide() {
  215. $("#modal-demo").modal("hide");
  216. $("#evaluation").modal("hide");
  217. }