getDuty1.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title></title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
  9. <link rel="stylesheet" href="../../css/style.css">
  10. <style>
  11. html,body{
  12. background: #F0F0F0;
  13. }
  14. .date-lists{
  15. width: 100%;
  16. padding: 10px 0;
  17. overflow-x: scroll;
  18. white-space: nowrap;
  19. box-sizing: border-box;
  20. }
  21. .date-lists::-webkit-scrollbar{
  22. display: none;
  23. }
  24. .date-wrap{
  25. padding: 0 10px;
  26. background: #F0F0F0;
  27. }
  28. .date-lists li{
  29. margin-right: 10px;
  30. border: 1px solid #009FE8;
  31. background: #f0f0f0;
  32. padding: 4px 10px;
  33. border-radius: 5px;
  34. color: #009FE8;
  35. }
  36. .date-lists .active{
  37. background: #009FE8;
  38. color: #fff;
  39. }
  40. /*list*/
  41. .duty-wrap{
  42. background: #fff;
  43. }
  44. .title-wrap{
  45. position: relative;
  46. }
  47. .title-wrap li{
  48. width: 70%;
  49. text-align: center;
  50. font-size: 14px;
  51. color: #009FE8;
  52. padding: 14px 0;
  53. }
  54. .title-wrap li:first-child{
  55. width: 30%;
  56. }
  57. .title-wrap:after{
  58. content: '';
  59. position: absolute;
  60. bottom: 0;
  61. left: 0;
  62. width: 100%;
  63. height: 2px;
  64. background: #009FE8;
  65. }
  66. /*list*/
  67. .duty-list li{
  68. font-size: 14px;
  69. color: #232627;
  70. padding: 10px 0;
  71. position: relative;
  72. }
  73. .duty-list li:after{
  74. content: '';
  75. position: absolute;
  76. bottom: 0;
  77. left: 0;
  78. width: 100%;
  79. height: 2px;
  80. background: #F0F0F0;
  81. }
  82. .duty-list .date-week{
  83. width: 35%;
  84. text-align: center;
  85. }
  86. .duty-list .duty-personal{
  87. width: 65%;
  88. padding:0 15px 0 10px;
  89. line-height: 1.7;
  90. }
  91. .date-week span{
  92. color: #6C6F74;
  93. margin-top: 3px;
  94. display: block;
  95. }
  96. </style>
  97. </head>
  98. <body>
  99. <div class="api_layout">
  100. <div class="date-wrap">
  101. <ul class="date-lists flex-start" id="date_list">
  102. </ul>
  103. </div>
  104. <!-- list-->
  105. <div class="duty-wrap" id="all_duty">
  106. </div>
  107. </div>
  108. </body>
  109. </html>
  110. <script type="text/template" id="monthTemplate">
  111. {{~it:value:index}}
  112. {{?index == 0}}
  113. <li class="active" onclick="randomSwitchBtn(this,'{{=value}}')">{{=value}}</li>
  114. {{??}}
  115. <li onclick="randomSwitchBtn(this,'{{=value}}')">{{=value}}</li>
  116. {{?}}
  117. {{~}}
  118. </script>
  119. <script type="text/template" id="allTemplate">
  120. <div class="duty-title">
  121. <ul class="flex-start title-wrap">
  122. <li>时间</li>
  123. <li>值班人</li>
  124. </ul>
  125. </div>
  126. <ul class="duty-list">
  127. {{~it:value:index}}
  128. <li class="flex-start">
  129. <div class="date-week">
  130. <label>{{=value.date}}</label>
  131. <span>{{=value.week}}</span>
  132. </div>
  133. <p class="duty-personal">{{=value.content}}</p>
  134. </li>
  135. {{~}}
  136. </ul>
  137. </script>
  138. <script type="text/javascript" src="../../script/api.js"></script>
  139. <script type="text/javascript" src="../../script/doT.min.js"></script>
  140. <script src="../../script/config.js" charset="utf-8"></script>
  141. <script type="text/javascript">
  142. apiready = function () {
  143. var info = $api.getStorage('data'),
  144. username = JSON.parse(info).data.user.name;
  145. getDutyDate(username)
  146. };
  147. function getDutyDate(name) {
  148. $http.fnReuestDataNologing(UrlRouter.getAllmonth,'','get',{name:name},function (ret, err) {
  149. if (ret.code === 0) {
  150. $apis.html(date_list,'#monthTemplate',ret.data);
  151. getDutyList(ret.data[0])
  152. }
  153. })
  154. }
  155. function getDutyList(month) {
  156. api.showProgress({
  157. title: '',
  158. text: '加载中...',
  159. modal: true
  160. });
  161. $http.fnReuestDataNologing(UrlRouter.getDutyAlllist,'','post',{month:month},function (ret, err) {
  162. $apis.html(all_duty,'#allTemplate',ret.data);
  163. api.hideProgress()
  164. })
  165. }
  166. // 点击日期
  167. function randomSwitchBtn( tag ,month) {
  168. if( tag == $api.dom('.date-lists li.active') )return;
  169. var eFootLis = $api.domAll('.date-lists li');
  170. index = 0;
  171. for (var i = 0,len = eFootLis.length; i < len; i++) {
  172. if( tag == eFootLis[i] ){
  173. index = i;
  174. }else{
  175. $api.removeCls(eFootLis[i], 'active');
  176. }
  177. }
  178. $api.addCls( eFootLis[index], 'active');
  179. getDutyList(month)
  180. }
  181. </script>