getDuty0.html 5.4 KB

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