home.ftl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <#assign title="我的家"/>
  2. <#include "/home/frag.head.ftl" />
  3. <div class="weui-tab">
  4. <input id="userId" type="text" hidden="hidden" value=${user_id!}/>
  5. <input id="uptownId" type="text" hidden="hidden" value=${uptown_id!}/>
  6. <div class="weui-tab__bd">
  7. <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
  8. <#include "/home/ribao.ftl" /></div>
  9. <#if uptownId != 1238790987234 && uptownId != 5 && uptownId != 100000002>
  10. <div id="tab2" class="weui-tab__bd-item">
  11. <#include "/home/qiuzhu.ftl" /></div>
  12. <div id="tab3" class="weui-tab__bd-item">
  13. <#include "/home/buy.ftl" /></div>
  14. </#if>
  15. <#--<div id="tab4" class="weui-tab__bd-item">-->
  16. <#--<h1>页面四</h1> </div>-->
  17. </div>
  18. <div class="weui-tabbar">
  19. <a id="jt1" href="#tab1" class="weui-tabbar__item weui-bar__item--on">
  20. <div class="weui-tabbar__icon"><img src="/static/images/wx/order.png" alt=""></div>
  21. <p class="weui-tabbar__label">健康日报</p>
  22. </a>
  23. <#if uptownId != 1238790987234 && uptownId != 5 && uptownId != 100000002>
  24. <a id="jt2" href="#tab2" class="weui-tabbar__item" onclick="familyClick()">
  25. <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
  26. <p class="weui-tabbar__label">家庭求助</p>
  27. </a>
  28. <a id="jt3" href="#tab3" class="weui-tabbar__item" onclick="buyGroup()">
  29. <div class="weui-tabbar__icon"><img src="/static/images/wx/upload.png" alt=""></div>
  30. <p class="weui-tabbar__label">团购</p>
  31. </a>
  32. </#if>
  33. <#--<a href="#tab4" class="weui-tabbar__item">-->
  34. <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_cell.png" alt=""> </div>-->
  35. <#--<p class="weui-tabbar__label">我</p>-->
  36. <#--</a>-->
  37. </div>
  38. </div>
  39. </body>
  40. <#include "/home/frag.foot.ftl" />
  41. <script>
  42. var xiaoquId = '1238790987234'; //1238790987234
  43. var ceshixiaoquId = '5';
  44. var canSahngbao = true;
  45. var cantijiao = true;
  46. var autoLocal='';
  47. var autoAddr='';
  48. <#include "/home/ribao.js" />
  49. <#include "/home/qiuzhu.js" />
  50. <#include "/home/getLocation.js" />
  51. (function ($) {
  52. $(function () {
  53. $('.weui-navbar__item').on('click', function () {
  54. $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
  55. //内容切换
  56. var moduleClass = jQuery(this).attr("module");
  57. var ss = ".weui-tab__panel ." + moduleClass + "_weui_tab_bd_item_active";
  58. $(ss).removeClass(moduleClass + '_weui_tab_bd_item_active');
  59. var data_toggle = jQuery(this).attr("target");
  60. $(data_toggle).addClass(moduleClass + "_weui_tab_bd_item_active");
  61. });
  62. });
  63. var uptownId = $("#uptownId").val();
  64. if (uptownId == xiaoquId || uptownId == ceshixiaoquId) {
  65. $('#ribao_trip')[0].style.display = '';
  66. // $('#ribao_djgl')[0].style.display = 'none';
  67. $('#ribao_jbqk')[0].style.display = '';
  68. // $('#qz_nav1_t')[0].style.display = 'none';
  69. // $('#qz_nav1')[0].style.display = 'none';
  70. } else {
  71. $('#ribao_trip')[0].style.display = 'none';
  72. // $('#ribao_djgl')[0].style.display = '';
  73. $('#ribao_jbqk')[0].style.display = '';
  74. if ($('#qz_nav1_t') && $('#qz_nav1_t').length > 0) {
  75. $('#qz_nav1_t')[0].style.display = '';
  76. $('#qz_nav1')[0].style.display = '';
  77. qiuzhu_init();
  78. }
  79. }
  80. ribao_init();
  81. family_init();
  82. ribao_add();
  83. ribao_cancel();
  84. getUptownUnitLY();
  85. $("#newUnitId").on("change", function () {
  86. var unitId = $("#newUnitId").val()
  87. $("#newDepartmentId").empty();
  88. getDepartmentIdLY(unitId);
  89. });
  90. var msReport = {};
  91. <#if msReport ??> msReport = ${msReport!{}}</#if>;
  92. $('#ribao_jinrijujian').append(msReport.safetyNum);
  93. if (msReport.reportStatus == 1) {
  94. var date = new Date(msReport.timeUpdate * 1);
  95. var Y = date.getFullYear() + '-';
  96. var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  97. var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
  98. var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
  99. var m = (date.getMinutes()<10?'0'+(date.getMinutes()):date.getMinutes())+':';
  100. var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
  101. var time = Y + M + D + h + m + s;
  102. canSahngbao = false;
  103. document.getElementById("btn_shangbao").style['background-color'] = "#D9D9D9";
  104. document.getElementById("txt_shangbao").style['color'] = "#0bb20c";
  105. document.getElementById("txt_shangbaotime").style['color'] = "#0bb20c";
  106. $('#txt_shangbao').empty();
  107. $('#txt_shangbao').append("今日已上报");
  108. $('#txt_shangbaotime').empty();
  109. $('#txt_shangbaotime').append("上报时间:" + time);
  110. }
  111. else {
  112. canSahngbao = true;
  113. document.getElementById("btn_shangbao").style['background-color'] = "#0bb20c";
  114. document.getElementById("txt_shangbao").style['color'] = "red";
  115. $('#txt_shangbao').empty();
  116. $('#txt_shangbao').append("今日未上报");
  117. $('#txt_shangbaotime').empty();
  118. }
  119. ribaoInitialization(msReport.reportId);
  120. $("#my-input-ribao").calendar();
  121. /*submit_back();*/
  122. familyClick();
  123. $(function () {
  124. $("#ground").bind("click", function () {
  125. if ($("#Gj").val() == "off") {
  126. $("#Gj").val("on");
  127. console.log("关闭查看所有");
  128. qzMy_help('', $("#quetyFamily").val());
  129. } else {
  130. $("#Gj").val("off");
  131. console.log("查看已解决的");
  132. qzMy_help(3, $("#quetyFamily").val());
  133. }
  134. });
  135. });
  136. function selectTab() {
  137. $("#tab1").removeClass('weui-tab__bd-item--active');
  138. $("#jt1").removeClass('weui-bar__item--on');
  139. $("#tab3").addClass('weui-tab__bd-item--active');
  140. $("#jt3").addClass('weui-bar__item--on');
  141. buyGroup();
  142. }
  143. function selectqiuzhu() {
  144. $("#tab1").removeClass('weui-tab__bd-item--active');
  145. $("#jt1").removeClass('weui-bar__item--on');
  146. $("#tab2").addClass('weui-tab__bd-item--active');
  147. $("#jt2").addClass('weui-bar__item--on');
  148. familyClick();
  149. }
  150. var show = ${show!'"-"'};
  151. if (show == 'tuangou') {
  152. selectTab();
  153. } else if (show == 'qiuzhu') {
  154. selectqiuzhu();
  155. }
  156. })(jQuery);
  157. // 凌云更换单位
  158. function getUptownUnitLY() {
  159. $.ajax({
  160. type: "GET",
  161. url: "/home/getUptownUnitLY.json?uptownId=" + $("#uptownId").val(),
  162. data: {},
  163. dataType: "json",
  164. success: function (data) {
  165. if (data.length > 0) {
  166. $("#newUnitId").empty();
  167. $('#newUnitId').append("<option>请选择</option>");
  168. var html = "";
  169. for (var i = 0; i < data.length; i++) {
  170. html += '<option value="' + data[i].unitId + '">' + data[i].ridgepole + data[i].unit + '</option>';
  171. }
  172. $('#newUnitId').append(html);
  173. $("#newUnitId").val('0');
  174. }
  175. }
  176. });
  177. }
  178. var isAll = false;
  179. // 更换二级单位
  180. function getDepartmentIdLY(unitId) {
  181. $.ajax({
  182. type: "GET",
  183. url: "/home/getDepartmentIdLY.json?unitId=" + unitId,
  184. data: {},
  185. dataType: "json",
  186. success: function (data) {
  187. if (data.length > 0) {
  188. isAll = true;
  189. $("#newDepartmentId").empty();
  190. $('#newDepartmentId').append("<option>请选择</option>");
  191. var html = "";
  192. for (var i = 0; i < data.length; i++) {
  193. html += '<option value="' + data[i].departmentId + '">' + data[i].departmentName + '</option>';
  194. }
  195. $('#newDepartmentId').append(html);
  196. $("#newDepartmentId").val('0');
  197. } else {
  198. isAll = false;
  199. }
  200. }
  201. });
  202. }
  203. // 凌云更换单位后保存
  204. function changeDepartmentId() {
  205. console.log(isAll);
  206. var unitId = $("#unitId").val();
  207. var newUnitId = $("#newUnitId").val();
  208. var newUnitText = $("#newUnitId").find("option:selected").text();
  209. if (!newUnitId || newUnitId == "请选择") {
  210. $.alert("请选择部门")
  211. return false;
  212. }
  213. // if (newUnitId == unitId) {
  214. // $.alert("您选择的部门和原来的部门一样")
  215. // return false;
  216. // }
  217. var departmentId = $("#departmentId").val();
  218. var newDepartmentId = $("#newDepartmentId").val();
  219. var newDepartmentText = $("#newDepartmentId").find("option:selected").text();
  220. if (isAll) {
  221. if (!newDepartmentId || newDepartmentId == "请选择") {
  222. $.alert("请选择二级部门")
  223. return false;
  224. }
  225. if (newDepartmentId == departmentId) {
  226. $.alert("您选择的二级部门和原来的二级部门一样")
  227. return false;
  228. }
  229. } else {
  230. newDepartmentId = 0;
  231. }
  232. $.ajax({
  233. url: '/home/changeUnitId.json',
  234. type: "post",
  235. data: {
  236. userId: $('#userId').val(),
  237. newUnitId: newUnitId,
  238. newDepartmentId: newDepartmentId,
  239. }, success: function (date) {
  240. $("#unitId").val(newUnitId);
  241. $("#unitMsg").text(newUnitText);
  242. $("#departmentId").val(newDepartmentId);
  243. $("#departmentMsg").text(newDepartmentText);
  244. $.alert("更改成功")
  245. return false;
  246. }
  247. });
  248. }
  249. function changeUnitId() {
  250. var unitId = $("#unitId").val();
  251. var newUnitId = $("#newUnitId").val();
  252. var newUnitText = $("#newUnitId").find("option:selected").text();
  253. if (!newUnitId || newUnitId == "请选择") {
  254. $.alert("请选择部门")
  255. return false;
  256. }
  257. if (newUnitId == unitId) {
  258. $.alert("您选择的部门和原来的部门一样")
  259. return false;
  260. }
  261. $.ajax({
  262. url: '/home/changeUnitId.json',
  263. type: "post",
  264. data: {
  265. userId: $('#userId').val(),
  266. newUnitId: newUnitId,
  267. newDepartmentId: 0,
  268. }, success: function (date) {
  269. $("#unitId").val(newUnitId);
  270. $("#unitMsg").text(newUnitText);
  271. $.alert("更改成功")
  272. return false;
  273. }
  274. });
  275. }
  276. // 凌云更换工号后保存
  277. function changeDoorplate() {
  278. var doorplate = $("#doorplateMsg").text();
  279. var newDoorplate = $("#newDoorplate").val().trim();
  280. if (!newDoorplate) {
  281. $.alert("请输入工号或身份证号")
  282. return false;
  283. }
  284. if (doorplate == newDoorplate) {
  285. $.alert("您输入的工号和原本的工号一样")
  286. return false;
  287. }
  288. $.ajax({
  289. url: '/home/changeDoorplate.json',
  290. type: "post",
  291. data: {
  292. userId: $('#userId').val(),
  293. newDoorplate: newDoorplate,
  294. }, success: function (date) {
  295. $("#doorplateMsg").text(newDoorplate);
  296. $.alert("更改成功")
  297. return false;
  298. }
  299. });
  300. }
  301. //小区求助信息的展示
  302. function familyClick() {
  303. $('#notitle').empty();//清除节点
  304. $.ajax({
  305. url: '/home/home/queryQzTaskxq',
  306. data: {userId: $('#userId').val()},
  307. type: 'GET',
  308. async: false,
  309. success: function (data) {
  310. console.log(data);
  311. if (data.data.length > 0) {
  312. hasData = true;
  313. data.data.forEach(function (v) {
  314. familyValue(v);
  315. });
  316. } else {
  317. }
  318. },
  319. error: function () {
  320. }
  321. });
  322. }
  323. function familyValue(v) {
  324. $('#notitle').append($('<a class="weui-cell weui-cell_active weui-cell_access js_item" data-id="form" ' +
  325. ' onclick=\'xiaoQuItemClick(' + JSON.stringify(v) + ')\'>\n' +
  326. ' <div class="weui-cell__bd" taskId="1212>\n' +
  327. ' <div class="weui-media-box weui-media-box_text" id="title">\n' +
  328. ' <p class="weui-media-box__desc" >' + v.taskTitle + '</p>\n' +
  329. ' </div>\n' +
  330. ' </div>\n' +
  331. ' <div class="weui-cell__ft">' + conversion(v.taskStatus) + '</div>\n' +
  332. ' </a>\n<br/>'));
  333. }
  334. function xiaoQuItemClick(v) {
  335. window.location.href = "/quzhu/home/quxiao.html?taskId=" + v.taskId + "&userId=" + $('#userId').val();
  336. /*familyClick();*/
  337. /* $.ajax({
  338. url: '/home/home/taskQuery',
  339. data: {taskId: v.taskId},
  340. type: 'GET',
  341. success: function (data) {
  342. console.log(data);
  343. if ($('#userId').val() != data.data.userId) {
  344. $.alert('当前求助信息不是你的')
  345. return;
  346. } else {
  347. window.location.href = "/quzhu/home/quxiao.html?taskId=" + v.taskId + "&userId=" + v.userId;
  348. familyClick()
  349. }
  350. },
  351. error: function () {
  352. }
  353. });*/
  354. }
  355. //完成 已解决 为完成的方法
  356. function conversion(a) {
  357. if (a == 1) {
  358. return "<span style='color:red;'>未解决</span>";
  359. } else if (a == 2) {
  360. return "<span style='color:Black;'>处理中</span>";
  361. } else {
  362. return "<span style='color:green;'>已完成</span>";
  363. }
  364. }
  365. </script>