frame0.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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" type="text/css" href="../../css/swiper.css">
  10. <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
  11. <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
  12. <link rel="stylesheet" href="../../css/projeck.css">
  13. <style>
  14. body{
  15. /*background: #fff;*/
  16. background: url("../../image/top.png") no-repeat;
  17. background-size: 100%;
  18. /*padding-top: 40px;*/
  19. }
  20. .aui-grid-label{
  21. font-size: 14px !important;
  22. width: 90%;
  23. margin: auto;
  24. overflow: hidden;
  25. text-overflow: ellipsis;
  26. white-space: nowrap;
  27. }
  28. .swiper-slide{
  29. height: 200px
  30. }
  31. .swiper-slide img{
  32. -webkit-border-radius: 10px;
  33. -moz-border-radius: 10px;
  34. border-radius: 10px;
  35. width: 100%;
  36. height: 200px;
  37. object-fit: cover;
  38. }
  39. .api_swiper_wrap .swiper-pagination-fraction{
  40. bottom:1px;
  41. }
  42. .api_page_text{
  43. bottom:0;
  44. }
  45. .api_grids{
  46. padding: 0 20px 0 10px;
  47. }
  48. .api_grids .aui-col-xs-3{
  49. font-size: 12px;
  50. display: inline-block;
  51. height: 42px;
  52. line-height: 42px;
  53. text-align: center;
  54. color: #009fe8;
  55. border: 1px solid #009fe8;
  56. border-radius: 10px;
  57. width: auto;
  58. padding: 0;
  59. margin-bottom:20px;
  60. }
  61. .api_grids .aui-grid-label{
  62. margin-top: 0;
  63. overflow: hidden;
  64. text-overflow: ellipsis;
  65. white-space: nowrap;
  66. }
  67. .height_duty{
  68. height: 45px;
  69. overflow: hidden;
  70. -webkit-box-sizing: border-box;
  71. -moz-box-sizing: border-box;
  72. box-sizing: border-box;
  73. }
  74. .aui-grid [class*=aui-col-]{
  75. padding: 0
  76. }
  77. .api_intelligence{
  78. margin-top: 20px;
  79. }
  80. </style>
  81. </head>
  82. <body>
  83. <div class="api_layout" id="api_layout">
  84. <div>
  85. <div class="duty">
  86. <p class="duty_title"><span id="duty_title"></span> <i class="duty_icon icon"></i></p>
  87. <div class="height_duty" id="box">
  88. <p class="duty_content" id="ul1"></p>
  89. <p class="duty_content" id="ul2"></p>
  90. </div>
  91. </div>
  92. <!--banner-->
  93. <div class="api_swiper_wrap">
  94. <div class="swiper-container">
  95. <div class="swiper-wrapper" id="age_list">
  96. </div>
  97. <div class="swiper-pagination swiper-pagination-fraction" id="api_page"></div>
  98. </div>
  99. </div>
  100. <!--新闻-->
  101. <div class="api_news">
  102. <h1 class="api_title">
  103. 新闻动态
  104. <i class="icon News_icon"></i>
  105. <span class="api_more" onclick="openNewsList('')">更多</span>
  106. </h1>
  107. <ul class="api_newsList" id="api_newsList"></ul>
  108. </div>
  109. <div class="api_line"></div>
  110. <!--智慧-->
  111. <div class="api_intelligence">
  112. <section class="aui-grid" id="api_grid">
  113. <div class="aui-row" style="padding:0 10px;" id="imgNav">
  114. </div>
  115. </section>
  116. </div>
  117. <div class="api_line"></div>
  118. <!-- 基层区队 -->
  119. <div id="DistrictTeam"></div>
  120. </div>
  121. </div>
  122. </body>
  123. </html>
  124. <!-- 轮播 -->
  125. <script type="text/template" id="template">
  126. {{~it:value}}
  127. <div class="swiper-slide" onclick="openUrlBanner('{{=value.jumpURL}}')">
  128. <a href="javascript:;" >
  129. <img src="{{=value.imgURL}}" alt="">
  130. </a>
  131. <div class="api_page_text">
  132. <p class="api_banner_info">{{=value.title}}</p>
  133. </div>
  134. </div>
  135. {{~}}
  136. </script>
  137. <!-- 新闻 -->
  138. <script type="text/template" id="templateNews">
  139. {{~it:value}}
  140. <li onclick="openURl('{{=value.detail_url}}','{{=value.title}}')">
  141. <img src="{{=value.main_img}}" alt="">
  142. <p>{{=value.title}}</p>
  143. </li>
  144. {{~}}
  145. </script>
  146. <!-- 智慧枣圈 -->
  147. <!-- 3 -->
  148. <script type="text/template" id="templateNav">
  149. {{~it:value}}
  150. <div class="aui-col-xs-4 item" onclick="openURl('{{=value.link}}','{{=value.title}}');">
  151. <img src="{{=value.icon}}" alt="">
  152. <div class="aui-grid-label">{{=value.title}}</div>
  153. </div>
  154. {{~}}
  155. </script>
  156. <!-- 4 -->
  157. <script type="text/template" id="templateNav_Four">
  158. {{~it:value}}
  159. <div class="aui-col-xs-3 item" onclick="openURl('{{=value.link}}','{{=value.title}}');">
  160. <img src="{{=value.icon}}" alt="">
  161. <div class="aui-grid-label">{{=value.title}}</div>
  162. </div>
  163. {{~}}
  164. </script>
  165. <!-- 区队 -->
  166. <script type="text/template" id="templateDistrict">
  167. {{ for (var i = 0;i<it.length;i++) { }}
  168. <div class="api_office">
  169. <h1 class="api_title" style="margin-bottom: 13px">
  170. {{=it[i].title}}
  171. <img src="{{=i%2 == 0?'../../image/icon01.png':'../../image/edit.png'}}" alt="">
  172. </h1>
  173. <section class="aui-grid api_grids">
  174. <div class="aui-row">
  175. {{ for (var j =0 ;j<it[i].children.length;j++) { }}
  176. <div class="aui-col-xs-3 api_col" onclick="openURl('{{=it[i].children[j].link}}','{{=it[i].children[j].title}}');">
  177. <div class="aui-grid-label">{{=it[i].children[j].title}}</div>
  178. </div>
  179. {{ } }}
  180. </div>
  181. </section>
  182. </div>
  183. {{ } }}
  184. </script>
  185. <script type="text/javascript" src="../../script/api.js"></script>
  186. <script type="text/javascript" src="../../script/swiper.min.js"></script>
  187. <!-- <script src="../../script/aui-toast.js" charset="utf-8"></script> -->
  188. <!-- <script src="../../script/fastclick.min.js" charset="utf-8"></script> -->
  189. <script src="../../script/doT.min.js" charset="utf-8"></script>
  190. <script src="../../script/config.js" charset="utf-8"></script>
  191. <script type="text/javascript">
  192. var toast = new auiToast(),isFlat = true;
  193. $apis.swiper('.swiper-container',true,'fraction');
  194. apiready = function () {
  195. api.closeFrame({
  196. name: 'frame3'
  197. });
  198. //token
  199. var info = $api.getStorage('data'),
  200. token = JSON.parse(info).data.access_token;
  201. var headers = {
  202. "Authorization": "Bearer " + token
  203. };
  204. // 监听app从后台返回前台刷新
  205. api.addEventListener({
  206. name:'resume'
  207. }, function(ret, err){
  208. $http.fnReuestDataNologing(UrlRouter.bannerApi,headers,'get','',bannerData);
  209. $http.fnReuestDataNologing(UrlRouter.nwesApi,headers,'get','',nwesData);
  210. $http.fnReuestDataNologing(UrlRouter.NoticeApi,headers,'get','',NoticeData);
  211. $http.fnReuestDataNologing(UrlRouter.ImgApi,headers,'get','',ImgNavData);
  212. $http.fnReuestDataNologing(UrlRouter.DistrictteamApi,headers,'get','',DistrictteamData);
  213. });
  214. // 每次打开app刷新一次
  215. if(isFlat){
  216. $http.fnReuestDataNologing(UrlRouter.bannerApi,headers,'get','',bannerData);
  217. $http.fnReuestDataNologing(UrlRouter.nwesApi,headers,'get','',nwesData);
  218. $http.fnReuestDataNologing(UrlRouter.NoticeApi,headers,'get','',NoticeData);
  219. $http.fnReuestDataNologing(UrlRouter.ImgApi,headers,'get','',ImgNavData);
  220. $http.fnReuestDataNologing(UrlRouter.DistrictteamApi,headers,'get','',DistrictteamData);
  221. isFlat =false;
  222. }
  223. // banner
  224. bannerCache(headers);
  225. // 公告
  226. NoticeDataCache(headers);
  227. //news
  228. newsDataCache(headers);
  229. //图片nav
  230. ImgNavDataCache(headers);
  231. //区队
  232. DistrictteamDataCache(headers);
  233. // 下拉刷新
  234. setCustomRefreshHeader(headers);
  235. };
  236. // 下拉刷新
  237. function setCustomRefreshHeader(headers) {
  238. api.setRefreshHeaderInfo({
  239. bgColor: '#f2f2f2',
  240. textColor: '#000',
  241. textDown: '下拉刷新...',
  242. textUp: '松开刷新...'
  243. }, function(ret, err) {
  244. $http.fnReuestDataNologing(UrlRouter.bannerApi,headers,'get','',bannerData);
  245. $http.fnReuestDataNologing(UrlRouter.nwesApi,headers,'get','',nwesData);
  246. $http.fnReuestDataNologing(UrlRouter.NoticeApi,headers,'get','',NoticeData);
  247. $http.fnReuestDataNologing(UrlRouter.ImgApi,headers,'get','',ImgNavData);
  248. $http.fnReuestDataNologing(UrlRouter.DistrictteamApi,headers,'get','',DistrictteamData);
  249. });
  250. }
  251. function flexWidth(){
  252. var cols=document.getElementsByClassName('api_col');
  253. for (var i = 0; i < cols.length; i++) {
  254. cols[i].style.width = (api.frameWidth / 4 -19) + 'px';
  255. cols[i].style.marginLeft = 10 + 'px'
  256. }
  257. }
  258. // openUrlBanner
  259. function openUrlBanner(urls,titles){
  260. $event.openWin('openURlId1','openUrlBanner',{url:urls,title:titles},'');
  261. }
  262. // openURl
  263. function openURl(urls,titles){
  264. var appU = urls.split('//');
  265. if (appU && appU[1] == 'app:') {
  266. $event.openWin('organization_win',appU[2],'','');
  267. }else {
  268. $event.openWin('openURlId','openUrl',{url:urls,title:titles},'');
  269. }
  270. }
  271. // banner
  272. function bannerCache(headers) {
  273. $apis.readFile($apis.CACHE_DIR('banner'),function (ret,err) {
  274. if( ret.status ){
  275. $apis.html(age_list,'#template',JSON.parse(ret.data));
  276. mySwiper.destroy(true,true);
  277. $apis.swiper('.swiper-container',true,'fraction');
  278. mySwiper.init();
  279. }else{
  280. $http.fnReuestDataNologing(UrlRouter.bannerApi,headers,'get','',bannerData);
  281. }
  282. });
  283. }
  284. function bannerData(ret,err) {
  285. if (ret.code === 0) {
  286. $apis.html(age_list,'#template',ret.data.data);
  287. $apis.writeFile($apis.CACHE_DIR('banner'),ret.data.data);
  288. mySwiper.destroy(true,true);
  289. $apis.swiper('.swiper-container',true,'fraction');
  290. mySwiper.init();
  291. }else if (ret.code === 401) {
  292. api.alert({
  293. title: '提示',
  294. msg: '登录过期,重新登录',
  295. }, function(ret, err) {
  296. var index = ret.buttonIndex;
  297. if (index == 1) {
  298. $api.clearStorage ();
  299. api.setStatusBarStyle({
  300. color: 'rgba(0,0,0,0)',
  301. style: 'light'
  302. });
  303. api.closeWin({
  304. name:'index'
  305. });
  306. }
  307. });
  308. }
  309. }
  310. // 新闻
  311. function newsDataCache(headers) {
  312. $apis.readFile($apis.CACHE_DIR('news'),function (ret,err) {
  313. if( ret.status ){
  314. $apis.html(api_newsList,'#templateNews',JSON.parse(ret.data));
  315. }else{
  316. $http.fnReuestDataNologing(UrlRouter.nwesApi,headers,'get','',nwesData);
  317. }
  318. })
  319. }
  320. function nwesData(ret,err) {
  321. if (ret.code === 0) {
  322. api.refreshHeaderLoadDone();
  323. $apis.html(api_newsList,'#templateNews',ret.data.data);
  324. $apis.writeFile($apis.CACHE_DIR('news'),ret.data.data);
  325. }
  326. }
  327. //公告
  328. function NoticeDataCache(headers) {
  329. $apis.readFile($apis.CACHE_DIR('Notice'),function (ret,err) {
  330. if( ret.status ){
  331. if (JSON.parse(ret.data).message == "暂无公告") {
  332. $api.html($api.byId('duty_title'),JSON.parse(ret.data).title);
  333. $api.html($api.dom('#ul1'), JSON.parse(ret.data).message);
  334. }else {
  335. $api.html($api.byId('duty_title'),JSON.parse(ret.data).title );
  336. $api.html($api.dom('#ul1'), JSON.parse(ret.data).content);
  337. textRoll(200);
  338. }
  339. }else{
  340. $http.fnReuestDataNologing(UrlRouter.NoticeApi,headers,'get','',NoticeData);
  341. }
  342. })
  343. }
  344. function NoticeData(ret,err) {
  345. if (ret.code === 0) {
  346. if (ret.data.message == "暂无公告") {
  347. $api.html($api.byId('duty_title'),ret.data.title );
  348. api.refreshHeaderLoadDone();
  349. $api.html($api.dom('#ul1'), ret.data.message);
  350. $apis.writeFile($apis.CACHE_DIR('Notice'),ret.data)
  351. }else {
  352. $api.html($api.byId('duty_title'),ret.data.title );
  353. $api.html($api.dom('#ul1'), ret.data.content);
  354. $apis.writeFile($apis.CACHE_DIR('Notice'),ret.data)
  355. }
  356. }
  357. }
  358. textRoll(200);
  359. // 图片导航
  360. function ImgNavDataCache(headers) {
  361. $apis.readFile($apis.CACHE_DIR('ImgNav'),function (ret,err) {
  362. if (ret.status) {
  363. if (JSON.parse(ret.data).index_link_num == 3 ) {
  364. $apis.html(imgNav,'#templateNav',JSON.parse(ret.data).data);
  365. }else {
  366. $apis.html(imgNav,'#templateNav_Four',JSON.parse(ret.data).data);
  367. }
  368. }else {
  369. $http.fnReuestDataNologing(UrlRouter.ImgApi,headers,'get','',ImgNavData);
  370. }
  371. })
  372. }
  373. function ImgNavData(ret,err) {
  374. if (ret.code === 0) {
  375. api.refreshHeaderLoadDone();
  376. if (ret.data.index_link_num == 3) {
  377. $apis.html(imgNav,'#templateNav',ret.data.data);
  378. } else {
  379. $apis.html(imgNav,'#templateNav_Four',ret.data.data);
  380. }
  381. $apis.writeFile($apis.CACHE_DIR('ImgNav'),ret.data);
  382. }
  383. }
  384. // 区队
  385. function DistrictteamDataCache(headers) {
  386. $apis.readFile($apis.CACHE_DIR('District'),function (ret,err) {
  387. if (ret.status) {
  388. $apis.html(DistrictTeam,'#templateDistrict',JSON.parse(ret.data));
  389. flexWidth();
  390. }else {
  391. $http.fnReuestDataNologing(UrlRouter.DistrictteamApi,headers,'get','',DistrictteamData);
  392. }
  393. })
  394. }
  395. function DistrictteamData(ret,err) {
  396. if (ret.code === 0) {
  397. api.refreshHeaderLoadDone();
  398. $apis.html(DistrictTeam,'#templateDistrict',ret.data);
  399. $apis.writeFile($apis.CACHE_DIR('District'),ret.data);
  400. flexWidth();
  401. }
  402. }
  403. // 文字无缝滚动
  404. function textRoll(t) {
  405. var ul1 = document.getElementById("ul1");
  406. var ul2 = document.getElementById("ul2");
  407. var box = document.getElementById("box");
  408. var timer = '';
  409. if (ul1.offsetHeight > box.offsetHeight) {
  410. ul2.innerText = ul1.innerText;
  411. }
  412. box.scrollTop = 0;
  413. timer = setInterval(rollStart, t);
  414. }
  415. function rollStart() {
  416. if (document.getElementById("box").scrollTop > document.getElementById("ul1").scrollHeight) {
  417. document.getElementById("box").scrollTop = 0;
  418. } else {
  419. document.getElementById("box").scrollTop++;
  420. }
  421. }
  422. // open新文列表
  423. function openNewsList(urls){
  424. $event.openWin('openNews','openNews',{url:urls},'');
  425. }
  426. </script>