123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <title></title>
- <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
- <link rel="stylesheet" type="text/css" href="../../css/swiper.css">
- <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
- <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
- <link rel="stylesheet" href="../../css/projeck.css">
- <style>
- body{
- /*background: #fff;*/
- background: url("../../image/top.png") no-repeat;
- background-size: 100%;
- /*padding-top: 40px;*/
- }
- .aui-grid-label{
- font-size: 14px !important;
- width: 90%;
- margin: auto;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .swiper-slide{
- height: 200px
- }
- .swiper-slide img{
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- width: 100%;
- height: 200px;
- object-fit: cover;
- }
- .api_swiper_wrap .swiper-pagination-fraction{
- bottom:1px;
- }
- .api_page_text{
- bottom:0;
- }
- .api_grids{
- padding: 0 20px 0 10px;
- }
- .api_grids .aui-col-xs-3{
- font-size: 12px;
- display: inline-block;
- height: 42px;
- line-height: 42px;
- text-align: center;
- color: #009fe8;
- border: 1px solid #009fe8;
- border-radius: 10px;
- width: auto;
- padding: 0;
- margin-bottom:20px;
- }
- .api_grids .aui-grid-label{
- margin-top: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .height_duty{
- height: 45px;
- overflow: hidden;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .aui-grid [class*=aui-col-]{
- padding: 0
- }
- .api_intelligence{
- margin-top: 20px;
- }
- </style>
- </head>
- <body>
- <div class="api_layout" id="api_layout">
- <div>
- <div class="duty">
- <p class="duty_title"><span id="duty_title"></span> <i class="duty_icon icon"></i></p>
- <div class="height_duty" id="box">
- <p class="duty_content" id="ul1"></p>
- <p class="duty_content" id="ul2"></p>
- </div>
- </div>
- <!--banner-->
- <div class="api_swiper_wrap">
- <div class="swiper-container">
- <div class="swiper-wrapper" id="age_list">
- </div>
- <div class="swiper-pagination swiper-pagination-fraction" id="api_page"></div>
- </div>
- </div>
- <!--新闻-->
- <div class="api_news">
- <h1 class="api_title">
- 新闻动态
- <i class="icon News_icon"></i>
- <span class="api_more" onclick="openNewsList('')">更多</span>
- </h1>
- <ul class="api_newsList" id="api_newsList"></ul>
- </div>
- <div class="api_line"></div>
- <!--智慧-->
- <div class="api_intelligence">
- <section class="aui-grid" id="api_grid">
- <div class="aui-row" style="padding:0 10px;" id="imgNav">
- </div>
- </section>
- </div>
- <div class="api_line"></div>
- <!-- 基层区队 -->
- <div id="DistrictTeam"></div>
- </div>
- </div>
- </body>
- </html>
- <!-- 轮播 -->
- <script type="text/template" id="template">
- {{~it:value}}
- <div class="swiper-slide" onclick="openUrlBanner('{{=value.jumpURL}}')">
- <a href="javascript:;" >
- <img src="{{=value.imgURL}}" alt="">
- </a>
- <div class="api_page_text">
- <p class="api_banner_info">{{=value.title}}</p>
- </div>
- </div>
- {{~}}
- </script>
- <!-- 新闻 -->
- <script type="text/template" id="templateNews">
- {{~it:value}}
- <li onclick="openURl('{{=value.detail_url}}','{{=value.title}}')">
- <img src="{{=value.main_img}}" alt="">
- <p>{{=value.title}}</p>
- </li>
- {{~}}
- </script>
- <!-- 智慧枣圈 -->
- <!-- 3 -->
- <script type="text/template" id="templateNav">
- {{~it:value}}
- <div class="aui-col-xs-4 item" onclick="openURl('{{=value.link}}','{{=value.title}}');">
- <img src="{{=value.icon}}" alt="">
- <div class="aui-grid-label">{{=value.title}}</div>
- </div>
- {{~}}
- </script>
- <!-- 4 -->
- <script type="text/template" id="templateNav_Four">
- {{~it:value}}
- <div class="aui-col-xs-3 item" onclick="openURl('{{=value.link}}','{{=value.title}}');">
- <img src="{{=value.icon}}" alt="">
- <div class="aui-grid-label">{{=value.title}}</div>
- </div>
- {{~}}
- </script>
- <!-- 区队 -->
- <script type="text/template" id="templateDistrict">
- {{ for (var i = 0;i<it.length;i++) { }}
- <div class="api_office">
- <h1 class="api_title" style="margin-bottom: 13px">
- {{=it[i].title}}
- <img src="{{=i%2 == 0?'../../image/icon01.png':'../../image/edit.png'}}" alt="">
- </h1>
- <section class="aui-grid api_grids">
- <div class="aui-row">
- {{ for (var j =0 ;j<it[i].children.length;j++) { }}
- <div class="aui-col-xs-3 api_col" onclick="openURl('{{=it[i].children[j].link}}','{{=it[i].children[j].title}}');">
- <div class="aui-grid-label">{{=it[i].children[j].title}}</div>
- </div>
- {{ } }}
- </div>
- </section>
- </div>
- {{ } }}
- </script>
- <script type="text/javascript" src="../../script/api.js"></script>
- <script type="text/javascript" src="../../script/swiper.min.js"></script>
- <!-- <script src="../../script/aui-toast.js" charset="utf-8"></script> -->
- <!-- <script src="../../script/fastclick.min.js" charset="utf-8"></script> -->
- <script src="../../script/doT.min.js" charset="utf-8"></script>
- <script src="../../script/config.js" charset="utf-8"></script>
- <script type="text/javascript">
- var toast = new auiToast(),isFlat = true;
- $apis.swiper('.swiper-container',true,'fraction');
- apiready = function () {
- api.closeFrame({
- name: 'frame3'
- });
- //token
- var info = $api.getStorage('data'),
- token = JSON.parse(info).data.access_token;
- var headers = {
- "Authorization": "Bearer " + token
- };
- // 监听app从后台返回前台刷新
- api.addEventListener({
- name:'resume'
- }, function(ret, err){
- $http.fnReuestDataNologing(UrlRouter.bannerApi,headers,'get','',bannerData);
- $http.fnReuestDataNologing(UrlRouter.nwesApi,headers,'get','',nwesData);
- $http.fnReuestDataNologing(UrlRouter.NoticeApi,headers,'get','',NoticeData);
- $http.fnReuestDataNologing(UrlRouter.ImgApi,headers,'get','',ImgNavData);
- $http.fnReuestDataNologing(UrlRouter.DistrictteamApi,headers,'get','',DistrictteamData);
- });
- // 每次打开app刷新一次
- if(isFlat){
- $http.fnReuestDataNologing(UrlRouter.bannerApi,headers,'get','',bannerData);
- $http.fnReuestDataNologing(UrlRouter.nwesApi,headers,'get','',nwesData);
- $http.fnReuestDataNologing(UrlRouter.NoticeApi,headers,'get','',NoticeData);
- $http.fnReuestDataNologing(UrlRouter.ImgApi,headers,'get','',ImgNavData);
- $http.fnReuestDataNologing(UrlRouter.DistrictteamApi,headers,'get','',DistrictteamData);
- isFlat =false;
- }
- // banner
- bannerCache(headers);
- // 公告
- NoticeDataCache(headers);
- //news
- newsDataCache(headers);
- //图片nav
- ImgNavDataCache(headers);
- //区队
- DistrictteamDataCache(headers);
- // 下拉刷新
- setCustomRefreshHeader(headers);
- };
- // 下拉刷新
- function setCustomRefreshHeader(headers) {
- api.setRefreshHeaderInfo({
- bgColor: '#f2f2f2',
- textColor: '#000',
- textDown: '下拉刷新...',
- textUp: '松开刷新...'
- }, function(ret, err) {
- $http.fnReuestDataNologing(UrlRouter.bannerApi,headers,'get','',bannerData);
- $http.fnReuestDataNologing(UrlRouter.nwesApi,headers,'get','',nwesData);
- $http.fnReuestDataNologing(UrlRouter.NoticeApi,headers,'get','',NoticeData);
- $http.fnReuestDataNologing(UrlRouter.ImgApi,headers,'get','',ImgNavData);
- $http.fnReuestDataNologing(UrlRouter.DistrictteamApi,headers,'get','',DistrictteamData);
- });
- }
- function flexWidth(){
- var cols=document.getElementsByClassName('api_col');
- for (var i = 0; i < cols.length; i++) {
- cols[i].style.width = (api.frameWidth / 4 -19) + 'px';
- cols[i].style.marginLeft = 10 + 'px'
- }
- }
- // openUrlBanner
- function openUrlBanner(urls,titles){
- $event.openWin('openURlId1','openUrlBanner',{url:urls,title:titles},'');
- }
- // openURl
- function openURl(urls,titles){
- var appU = urls.split('//');
- if (appU && appU[1] == 'app:') {
- $event.openWin('organization_win',appU[2],'','');
- }else {
- $event.openWin('openURlId','openUrl',{url:urls,title:titles},'');
- }
- }
- // banner
- function bannerCache(headers) {
- $apis.readFile($apis.CACHE_DIR('banner'),function (ret,err) {
- if( ret.status ){
- $apis.html(age_list,'#template',JSON.parse(ret.data));
- mySwiper.destroy(true,true);
- $apis.swiper('.swiper-container',true,'fraction');
- mySwiper.init();
- }else{
- $http.fnReuestDataNologing(UrlRouter.bannerApi,headers,'get','',bannerData);
- }
- });
- }
- function bannerData(ret,err) {
- if (ret.code === 0) {
- $apis.html(age_list,'#template',ret.data.data);
- $apis.writeFile($apis.CACHE_DIR('banner'),ret.data.data);
- mySwiper.destroy(true,true);
- $apis.swiper('.swiper-container',true,'fraction');
- mySwiper.init();
- }else if (ret.code === 401) {
- api.alert({
- title: '提示',
- msg: '登录过期,重新登录',
- }, function(ret, err) {
- var index = ret.buttonIndex;
- if (index == 1) {
- $api.clearStorage ();
- api.setStatusBarStyle({
- color: 'rgba(0,0,0,0)',
- style: 'light'
- });
- api.closeWin({
- name:'index'
- });
- }
- });
- }
- }
- // 新闻
- function newsDataCache(headers) {
- $apis.readFile($apis.CACHE_DIR('news'),function (ret,err) {
- if( ret.status ){
- $apis.html(api_newsList,'#templateNews',JSON.parse(ret.data));
- }else{
- $http.fnReuestDataNologing(UrlRouter.nwesApi,headers,'get','',nwesData);
- }
- })
- }
- function nwesData(ret,err) {
- if (ret.code === 0) {
- api.refreshHeaderLoadDone();
- $apis.html(api_newsList,'#templateNews',ret.data.data);
- $apis.writeFile($apis.CACHE_DIR('news'),ret.data.data);
- }
- }
- //公告
- function NoticeDataCache(headers) {
- $apis.readFile($apis.CACHE_DIR('Notice'),function (ret,err) {
- if( ret.status ){
- if (JSON.parse(ret.data).message == "暂无公告") {
- $api.html($api.byId('duty_title'),JSON.parse(ret.data).title);
- $api.html($api.dom('#ul1'), JSON.parse(ret.data).message);
- }else {
- $api.html($api.byId('duty_title'),JSON.parse(ret.data).title );
- $api.html($api.dom('#ul1'), JSON.parse(ret.data).content);
- textRoll(200);
- }
- }else{
- $http.fnReuestDataNologing(UrlRouter.NoticeApi,headers,'get','',NoticeData);
- }
- })
- }
- function NoticeData(ret,err) {
- if (ret.code === 0) {
- if (ret.data.message == "暂无公告") {
- $api.html($api.byId('duty_title'),ret.data.title );
- api.refreshHeaderLoadDone();
- $api.html($api.dom('#ul1'), ret.data.message);
- $apis.writeFile($apis.CACHE_DIR('Notice'),ret.data)
- }else {
- $api.html($api.byId('duty_title'),ret.data.title );
- $api.html($api.dom('#ul1'), ret.data.content);
- $apis.writeFile($apis.CACHE_DIR('Notice'),ret.data)
- }
- }
- }
- textRoll(200);
- // 图片导航
- function ImgNavDataCache(headers) {
- $apis.readFile($apis.CACHE_DIR('ImgNav'),function (ret,err) {
- if (ret.status) {
- if (JSON.parse(ret.data).index_link_num == 3 ) {
- $apis.html(imgNav,'#templateNav',JSON.parse(ret.data).data);
- }else {
- $apis.html(imgNav,'#templateNav_Four',JSON.parse(ret.data).data);
- }
- }else {
- $http.fnReuestDataNologing(UrlRouter.ImgApi,headers,'get','',ImgNavData);
- }
- })
- }
- function ImgNavData(ret,err) {
- if (ret.code === 0) {
- api.refreshHeaderLoadDone();
- if (ret.data.index_link_num == 3) {
- $apis.html(imgNav,'#templateNav',ret.data.data);
- } else {
- $apis.html(imgNav,'#templateNav_Four',ret.data.data);
- }
- $apis.writeFile($apis.CACHE_DIR('ImgNav'),ret.data);
- }
- }
- // 区队
- function DistrictteamDataCache(headers) {
- $apis.readFile($apis.CACHE_DIR('District'),function (ret,err) {
- if (ret.status) {
- $apis.html(DistrictTeam,'#templateDistrict',JSON.parse(ret.data));
- flexWidth();
- }else {
- $http.fnReuestDataNologing(UrlRouter.DistrictteamApi,headers,'get','',DistrictteamData);
- }
- })
- }
- function DistrictteamData(ret,err) {
- if (ret.code === 0) {
- api.refreshHeaderLoadDone();
- $apis.html(DistrictTeam,'#templateDistrict',ret.data);
- $apis.writeFile($apis.CACHE_DIR('District'),ret.data);
- flexWidth();
- }
- }
- // 文字无缝滚动
- function textRoll(t) {
- var ul1 = document.getElementById("ul1");
- var ul2 = document.getElementById("ul2");
- var box = document.getElementById("box");
- var timer = '';
- if (ul1.offsetHeight > box.offsetHeight) {
- ul2.innerText = ul1.innerText;
- }
- box.scrollTop = 0;
- timer = setInterval(rollStart, t);
- }
- function rollStart() {
- if (document.getElementById("box").scrollTop > document.getElementById("ul1").scrollHeight) {
- document.getElementById("box").scrollTop = 0;
- } else {
- document.getElementById("box").scrollTop++;
- }
- }
- // open新文列表
- function openNewsList(urls){
- $event.openWin('openNews','openNews',{url:urls},'');
- }
- </script>
|