config.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. // 定义服务器端域名
  2. var javaApi = '/api/swagger/';
  3. // var mineName = '麦垛山煤矿';
  4. // var mineName = '枣泉煤矿';
  5. // var mineName = 'E信管理';
  6. var mineName = '智慧洗煤厂';
  7. // 枣泉
  8. // var URLjava = 'http://zaoquan.nxjiewei.com:8011'+javaApi;
  9. // var URLjava = 'http://colliery.nxjiewei.com'+javaApi;
  10. // var URLjava = 'http://192.168.0.109:8080/';
  11. // var urlphp = 'http://colliery.nxjiewei.com/';
  12. // 工单上传图片和文件地址
  13. // var urlphp = 'http://zaoquan.nxjiewei.com:8011/';
  14. var ceshiUrl = 'http://47.105.143.227:8083/';//测试地址java
  15. // 设备物资,固定电缆
  16. // var urlJavaOld = 'http://nxjiewei.com/colliery-system/api/page/v1/eqByNameList.html'
  17. // var URLjava = 'http://apptest.jieweizhineng.com'+javaApi;
  18. // 麦陀山
  19. // var URLjava = 'http://maiduoshan.nxjiewei.com'+javaApi;
  20. // var urlphp = 'http://maiduoshan.nxjiewei.com/';
  21. // 宁东运营部
  22. // var URLjava = 'http://ningdongyunying.nxjiewei.com'+javaApi;
  23. // var urlphp = 'http://ningdongyunying.nxjiewei.com/';
  24. // 智慧洗煤厂
  25. var URLjava = 'http://xixuan.nxjiewei.com'+javaApi;
  26. var urlphp = 'http://xixuan.nxjiewei.com/';
  27. var UrlRouter = {
  28. loginApi:urlphp+'api/oauth/token',//登录
  29. vcodeApi:urlphp+'api/sms/vcode',//发送验证吗
  30. setApi:urlphp+'api/user/mobile/set',//绑定手机号
  31. repasswordApi:urlphp+'api/user/repassword',//修改密码
  32. bannerApi:urlphp+'api/scrollImg/list',//banner
  33. nwesApi:urlphp+'api/article/list',//新闻
  34. NoticeApi:urlphp+'api/notice/list',//公告
  35. ImgApi:urlphp+'api/homeNav/list',//图片导航
  36. DistrictteamApi:urlphp+'api/home/links',//区队
  37. userInfoApi:urlphp+'api/user/info',//个人信息
  38. findMessageApi:URLjava+'api/dynamic/v1/findMessage/',//消息列表 二维码 、 巡检记录
  39. getPageDynamicApi:URLjava+'api/dynamic/v1/getPageDynamic',//获取二维码列表
  40. getRecordDynamicApi:URLjava+'api/dynamic/v1/getRecordDynamic',//获取巡检列表
  41. addPageDynamicApi:URLjava+'api/dynamic/v1/addPageDynamic',//已读二维码
  42. addRecordDynamicApi:URLjava+'api/dynamic/v1/addRecordDynamic',//已读巡检记录
  43. regionApi:urlphp+'api/monitor/video/region',//监控列表权限
  44. // cameraApi:urlphp+'api/monitor/video/camera',//监控子项
  45. findMessageCount:URLjava+'api/dynamic/v1/findMessageCount/',
  46. seachQrcode:URLjava+'api/page/v1/getPageList',//查询二维码
  47. getDeviceValueTypeCode:ceshiUrl+'api/device/v1/getDeviceValueTypeCode/',//查询传感器的数值信息
  48. getData:ceshiUrl+'api/data/v1/getData',//实时数据查询
  49. getDeviceInfo:ceshiUrl+'api/device/v1/getDeviceInfo',//查询传感器信息
  50. searchData:ceshiUrl+'api/data/v1/searchData',//查询传感器实时数据详情
  51. securityJurisdiction:urlphp+'api/detection/show',//安全监测权限
  52. getGroupList:urlphp+"api/section/getGroupList",//获取部门列表
  53. getPersonalList:urlphp+'api/user/list',//获取部门人员
  54. searchPersonal:urlphp+'api/user/search',//搜索人员
  55. wordOrderList:urlphp+'api/worksheet/classify/list',//工单分类
  56. applyList:urlphp+'api/worksheet/design/list',//可申请工单列表
  57. getApplyD:urlphp+'api/worksheet/design/',//获取可申请工单详情
  58. submitApply:urlphp+'api/worksheet/apply',//提交工单信息
  59. getNewsList:urlphp+'api/message/list',//消息列表
  60. getRead:urlphp+'api/message/read',//已读消息
  61. getNewsNum:urlphp+'api/message/unread_num',//消息总数
  62. thumbs:urlphp+'api/user/like/post',//点赞or取消点赞
  63. comment:urlphp+'api/user/comment/post',//提交留言
  64. delComment:urlphp+'api/user/comment/del',//删除留言
  65. simulationTotal:urlphp+'api/safety/simulation/total',//模拟量统计
  66. sluicetTotal:urlphp+'api/safety/sluice/total',//开关量统计
  67. safetyDetaile:urlphp+'api/safety/info/total',//安全数据详情
  68. downWellTotal:urlphp+'api/personnel/month/total',//一周下井趋势
  69. currentPersonalNum:urlphp+'api/personnel/now',//一周下井趋势当前人数
  70. getBanNowDayTotal:URLjava+'api/pdcban/v1/getBanNowDayTotal',//今日产量
  71. getBanDayList:URLjava+'/api/pdcban/v1/getBanDayList',//一周的产量
  72. getMonthSumByYear:URLjava+'api/pdcban/v1/getMonthSumByYear',//一年的产量
  73. getBulletin:urlphp+'api/dispatch/bulletin',//生产数据公告
  74. getSchedule:urlphp+'api/dispatch/schedule',//调度统计
  75. getAlarmData:urlphp+'api/safety/alarm',//报警分类
  76. getGasData:urlphp+'api/safety/methane',//瓦斯异常情况
  77. getChangMessageList:URLjava+'api/dynamic/v1/changMessageList/',//二维码和记录置为已读
  78. chartsJurisdiction:urlphp+'api/dispatch/show',//图表权限
  79. personalLocation:urlphp+'api/personnel/show',//人员定位权限
  80. getPersonnalList:urlphp+'api/personnel/region/total',//人员定位列表
  81. getPersonnalDistributionList:urlphp+'api/personnel/mine/total',//每个矿井人数统计
  82. getPersonnalDe:urlphp+'api/personnel/mine/people',//人员详情
  83. searchPeople:urlphp+'api/personnel/people/search',//查询人员定位
  84. peopleInfo:urlphp+'api/personnel/people/info',//个人详情
  85. getDayHourTotal:URLjava+'api/pdcban/v1/getDayHourTotal',//皮带称产量
  86. getPeopleNow:urlphp+'api/personnel/people/now',//当前下井人数
  87. getOfficeTotal:urlphp+'api/personnel/office/total',//井下人员(部门分布)
  88. getBasicTotal:urlphp+'api/personnel/basic/total',//基层区队
  89. getWorkingTotal:urlphp+'api/personnel/working/total',//工作面人数统计
  90. getDepartToday:urlphp+'api/personnel/depart/today',//各部门人数统计
  91. getFacilityStatus:urlphp+'api/personnel/facility/status',//人员定位系统设备运行状态
  92. getTimeout:urlphp+'api/personnel/timeout/total',//人员超时统计
  93. getHelptotal:urlphp+'api/personnel/help/total',//人员求救统计
  94. getPersonnelTimeoutDetails:urlphp+'api/personnel/timeout/info',//人员超时统计详情
  95. getPersonnelHelpDetails:urlphp+'api/personnel/help/info',//人员求救统计详情
  96. getPersonnelFacilityDetails:urlphp+'api/personnel/facility/info',//人员求救统计详情
  97. getPersonnelWorkingDetails:urlphp+'api/personnel/working/info',//工作面人员详情
  98. getPersonneldepartDetails:urlphp+'api/personnel/depart/people',//井下部门分布列表
  99. getPersonneltodayDetails:urlphp+'api/personnel/depart/people/today',//井下部门分布列表
  100. getBanDayThree:URLjava+'api/pdcban/v1/getBanDayThree',//一周的产量列表
  101. getBanNowDayAllTotal:URLjava+'api/pdcban/v1/getBanNowDayAllTotal',//今日产量
  102. getEfficacyCut:urlphp+'api/dispatch/efficacy/cut',//割煤刀数
  103. efficacyShow:urlphp+'api/efficacy/show',//效能管控
  104. getEfficacyInfo:urlphp+'api/dispatch/efficacy/cut/info',//割煤刀数工作面列表
  105. };
  106. var mySwiper;//插件
  107. /**
  108. * 加载动画
  109. *
  110. */
  111. (function( window, undefined ) {
  112. "use strict";
  113. var auiToast = function() {
  114. // this.create();
  115. };
  116. var isShow = false;
  117. auiToast.prototype = {
  118. create: function(params,callback) {
  119. var self = this;
  120. var toastHtml = '';
  121. switch (params.type) {
  122. case "success":
  123. var iconHtml = '<i class="aui-iconfont aui-icon-correct"></i>';
  124. break;
  125. case "fail":
  126. var iconHtml = '<i class="aui-iconfont aui-icon-close"></i>';
  127. break;
  128. case "custom":
  129. var iconHtml = params.html;
  130. break;
  131. case "loading":
  132. var iconHtml = '<div class="aui-toast-loading"></div>';
  133. break;
  134. }
  135. var titleHtml = params.title ? '<div class="aui-toast-content">'+params.title+'</div>' : '';
  136. toastHtml = `<div class="api-toast">
  137. <div class="aui-toast">${iconHtml+titleHtml}</div>
  138. </div>`
  139. if(document.querySelector(".aui-toast"))return;
  140. document.body.insertAdjacentHTML('beforeend', toastHtml);
  141. var duration = params.duration ? params.duration : "2000";
  142. self.show();
  143. if(params.type == 'loading'){
  144. if(callback){
  145. callback({
  146. status: "success"
  147. });
  148. };
  149. }else{
  150. setTimeout(function(){
  151. self.hide();
  152. }, duration)
  153. }
  154. },
  155. show: function(){
  156. var self = this;
  157. document.querySelector(".aui-toast").style.display = "block";
  158. document.querySelector(".aui-toast").style.marginTop = "-"+Math.round(document.querySelector(".aui-toast").offsetHeight/2)+"px";
  159. if(document.querySelector(".aui-toast"))return;
  160. },
  161. hide: function(){
  162. var self = this;
  163. if(document.querySelector(".aui-toast")){
  164. document.querySelector(".api-toast").remove()
  165. }
  166. },
  167. remove: function(){
  168. if(document.querySelector(".aui-dialog"))document.querySelector(".aui-dialog").parentNode.removeChild(document.querySelector(".aui-dialog"));
  169. if(document.querySelector(".aui-mask")){
  170. document.querySelector(".aui-mask").classList.remove("aui-mask-out");
  171. }
  172. return true;
  173. },
  174. success: function(params,callback){
  175. var self = this;
  176. params.type = "success";
  177. return self.create(params,callback);
  178. },
  179. fail: function(params,callback){
  180. var self = this;
  181. params.type = "fail";
  182. return self.create(params,callback);
  183. },
  184. custom:function(params,callback){
  185. var self = this;
  186. params.type = "custom";
  187. return self.create(params,callback);
  188. },
  189. loading:function(params,callback){
  190. var self = this;
  191. params.type = "loading";
  192. return self.create(params,callback);
  193. }
  194. };
  195. window.auiToast = auiToast;
  196. })(window);
  197. (function( window, undefined ) {
  198. "use strict";
  199. var apiToast = function() {
  200. // this.create();
  201. };
  202. var isShow = false;
  203. apiToast.prototype = {
  204. create: function(params,callback) {
  205. var self = this;
  206. var toastHtml = '';
  207. switch (params.type) {
  208. case "success":
  209. var iconHtml = '<i class="aui-iconfont aui-icon-correct"></i>';
  210. break;
  211. case "fail":
  212. var iconHtml = '<i class="aui-iconfont aui-icon-close"></i>';
  213. break;
  214. case "custom":
  215. var iconHtml = params.html;
  216. break;
  217. case "loading":
  218. var iconHtml = '<div class="api-toast-loading"></div>';
  219. break;
  220. }
  221. var titleHtml = params.title ? '<div class="api-toast-content">'+params.title+'</div>' : '';
  222. toastHtml = `<div class="api-toast">${iconHtml+titleHtml}</div>`
  223. if(document.querySelector(".api-toast"))return;
  224. document.body.insertAdjacentHTML('beforeend', toastHtml);
  225. var duration = params.duration ? params.duration : "2000";
  226. self.show();
  227. if(params.type == 'loading'){
  228. if(callback){
  229. callback({
  230. status: "success"
  231. });
  232. };
  233. }else{
  234. setTimeout(function(){
  235. self.hide();
  236. }, duration)
  237. }
  238. },
  239. show: function(){
  240. var self = this;
  241. document.querySelector(".api-toast").style.display = "block";
  242. document.querySelector(".api-toast").style.marginTop = "-"+Math.round(document.querySelector(".api-toast").offsetHeight/2)+"px";
  243. if(document.querySelector(".api-toast"))return;
  244. },
  245. hide: function(){
  246. var self = this;
  247. if(document.querySelector(".api-toast")){
  248. document.querySelector(".api-toast").parentNode.removeChild(document.querySelector(".api-toast"));
  249. }
  250. },
  251. remove: function(){
  252. if(document.querySelector(".api-dialog"))document.querySelector(".api-dialog").parentNode.removeChild(document.querySelector(".api-dialog"));
  253. if(document.querySelector(".api-mask")){
  254. document.querySelector(".api-mask").classList.remove("api-mask-out");
  255. }
  256. return true;
  257. },
  258. success: function(params,callback){
  259. var self = this;
  260. params.type = "success";
  261. return self.create(params,callback);
  262. },
  263. fail: function(params,callback){
  264. var self = this;
  265. params.type = "fail";
  266. return self.create(params,callback);
  267. },
  268. custom:function(params,callback){
  269. var self = this;
  270. params.type = "custom";
  271. return self.create(params,callback);
  272. },
  273. loading:function(params,callback){
  274. var self = this;
  275. params.type = "loading";
  276. return self.create(params,callback);
  277. }
  278. };
  279. window.apiToast = apiToast;
  280. })(window);
  281. /**
  282. *
  283. */
  284. /**
  285. * ajax 封装
  286. */
  287. (function (window) {
  288. /**
  289. ** 带加载效果的ajax
  290. **/
  291. var h = {};
  292. h.fnReuestData = function (pPartUrl,pHeaders,pMethod,pData,pCallback) {
  293. toast.loading({
  294. title: "加载中",
  295. duration: 2000
  296. });
  297. var tHeaders = pHeaders? pHeaders :'';
  298. var tAjax = {
  299. url:pPartUrl,
  300. method:pMethod,
  301. headers:tHeaders,
  302. dataType:'json',
  303. data:{
  304. values:pData
  305. },
  306. timeout: 30
  307. };
  308. api.ajax(tAjax,function(ret,err){
  309. if ('function' === typeof pCallback) {
  310. pCallback(ret,err)
  311. }
  312. });
  313. };
  314. /**
  315. *不带低白加载效果
  316. **/
  317. h.fnReuestDataNoW = function (pPartUrl,pHeaders,pMethod,pData,pCallback) {
  318. apiToast.loading({
  319. title: "加载中",
  320. duration: 2000
  321. });
  322. var tHeaders = pHeaders? pHeaders :'';
  323. var tAjax = {
  324. url:pPartUrl,
  325. method:pMethod,
  326. headers:tHeaders,
  327. dataType:'json',
  328. data:{
  329. values:pData
  330. },
  331. timeout: 30
  332. };
  333. api.ajax(tAjax,function(ret,err){
  334. if ('function' === typeof pCallback) {
  335. pCallback(ret,err)
  336. }
  337. });
  338. };
  339. /**
  340. ** 不带加载效果的ajax
  341. **/
  342. h.fnReuestDataNologing = function (pPartUrl,pHeaders,pMethod,pData,pCallback) {
  343. var tHeaders = pHeaders? pHeaders :'';
  344. var tAjax = {
  345. url:pPartUrl,
  346. method:pMethod,
  347. headers:tHeaders,
  348. dataType:'json',
  349. data:{
  350. values:pData
  351. },
  352. timeout: 30
  353. };
  354. api.ajax(tAjax,function(ret,err){
  355. if ('function' === typeof pCallback) {
  356. pCallback(ret,err)
  357. }
  358. });
  359. };
  360. h.fnReuestDataJSON = function (pPartUrl,pHeaders,pMethod,pData,pCallback) {
  361. toast.loading({
  362. title: "加载中",
  363. duration: 2000
  364. });
  365. var tHeaders = pHeaders? pHeaders :'';
  366. var tAjax = {
  367. url:pPartUrl,
  368. method:pMethod,
  369. contentType:'application/json',
  370. headers:tHeaders,
  371. dataType:'json',
  372. data:{
  373. values:pData
  374. },
  375. timeout: 30
  376. };
  377. api.ajax(tAjax,function(ret,err){
  378. if ('function' === typeof pCallback) {
  379. pCallback(ret,err)
  380. }
  381. });
  382. };
  383. window.$http = h;
  384. }(window));
  385. /**
  386. * 常用方法
  387. */
  388. (function (window) {
  389. var e = {};
  390. /**
  391. * 封装消息发送时间
  392. */
  393. e.sendEvent = function (name,extra) {
  394. api.sendEvent({
  395. name: name,
  396. extra: extra
  397. });
  398. };
  399. /**
  400. * 消息监听事件
  401. */
  402. e.addEventListener = function (name,callback) {
  403. api.addEventListener({
  404. name: name
  405. }, function(ret, err){
  406. callback(ret)
  407. });
  408. };
  409. /**
  410. *  滑动底部监听事件
  411. */
  412. e.scrollBottomListener = function (callback,threshold) {
  413. api.addEventListener({
  414. name: 'scrolltobottom',
  415. extra:{
  416. threshold: threshold || 0
  417. }
  418. }, function(ret, err){
  419. callback(ret)
  420. });
  421. };
  422. /**
  423. * frame
  424. *
  425. */
  426. e.openFrame = function (name,headers,footer,pageParam,otherParam){
  427. var headerH = headers ? $api.dom(headers).offsetHeight : 0;
  428. var footetH = footer ? $api.dom(footer).offsetHeight : 0;
  429. api.openFrame({
  430. name: name,
  431. url: name + '.html',
  432. bounces: true,
  433. scrollEnabled:false,
  434. hScrollBarEnabled:false,
  435. progress:{
  436. type:'page'
  437. },
  438. animation:{
  439. type:'fade'
  440. },
  441. rect: {
  442. x: 0,
  443. y: headerH,
  444. w: 'auto',
  445. h: 'auto'
  446. },
  447. pageParam: api.pageParam || {}
  448. });
  449. };
  450. /**
  451. *打开弹出框
  452. *
  453. **/
  454. e.openPopup = function (w,h,name,pageParam) {
  455. api.openFrame({
  456. name: name,
  457. url: name + '.html',
  458. bgColor:'rgba(0,0,0,.6)',
  459. bounces: false,
  460. rect: {
  461. x: 0,
  462. y: 0,
  463. w: w,
  464. h: h
  465. },
  466. animation:{
  467. type:'fade'
  468. },
  469. pageParam: pageParam
  470. });
  471. }
  472. /**
  473. * Win
  474. *
  475. */
  476. e.openWin = function (winName,winUrl,pageParam,otherParam) {
  477. var param = {
  478. name:winName,
  479. url:winUrl+'.html',
  480. scrollEnabled:false,
  481. hScrollBarEnabled:false,
  482. pageParam:pageParam,
  483. animation: {
  484. type:'fade',
  485. duration:450
  486. }
  487. }
  488. Object.assign(param,otherParam|| {});
  489. api.openWin(param)
  490. }
  491. /**
  492. ** openTabLayout
  493. **/
  494. e.openTabLayout = function (name,url,title,value) {
  495. var param = {
  496. name: name,
  497. url: url+'.html',
  498. bgColor: '#fff',
  499. title: title,
  500. bounces: true,
  501. navigationBar: {
  502. height:'50',
  503. background:'#009fe8',
  504. color:'#fff'
  505. },
  506. pageParam:value
  507. }
  508. api.openTabLayout(param);
  509. }
  510. /**
  511. ** 提示框无网络
  512. **/
  513. e.tips = function (el,text) {
  514. var str = `<div id="tips">
  515. <p>
  516. <i></i>
  517. ${text}
  518. </p>
  519. </div>`;
  520. $api.append($api.dom(el),str);
  521. }
  522. e.removeTips = function (el) {
  523. $api.remove($api.byId(el));
  524. }
  525. /***
  526. 没有内容提示页面
  527. el = body
  528. Image显示图片路径
  529. ***/
  530. e.NotContent = function (el,elID,Image) {
  531. var html = `<div class="noText" id="${elID}">
  532. <img src="${Image}" alt="">
  533. </div>`;
  534. $api.append($api.dom(el),html);
  535. }
  536. /**
  537. *删除NotContent
  538. **/
  539. e.deletNotContent = function (elID) {
  540. $api.remove($api.byId(elID));
  541. }
  542. window.$event = e;
  543. }(window));
  544. /**
  545. * 工具累
  546. * */
  547. (function(window) {
  548. var d = {};
  549. /**
  550. * append
  551. * doT模版的封装
  552. * root DOM名称如ID 或class
  553. * doT template 名称
  554. * data ajax返回数据
  555. */
  556. d.append = function (root,template,data) {
  557. var evalText = doT.compile($api.html($api.dom(template)))
  558. if (typeof root == 'string'){
  559. $api.append($api.dom(root),evalText(data))
  560. }else{
  561. $api.append(root,evalText(data))
  562. }
  563. };
  564. /**
  565. * html
  566. * doT模版的封装
  567. * root DOM名称如ID 或class
  568. * doT template 名称
  569. * data ajax返回数据
  570. */
  571. d.html = function (root,template,data) {
  572. var evalText = doT.compile($api.html($api.dom(template)))
  573. if (typeof root == 'string'){
  574. $api.html($api.dom(root),evalText(data))
  575. }else{
  576. $api.html(root,evalText(data))
  577. }
  578. };
  579. /**
  580. * after
  581. * doT模版的封装
  582. * root DOM名称如ID 或class
  583. * doT template 名称
  584. * data ajax返回数据
  585. */
  586. d.after = function (root,template,data) {
  587. var evalText = doT.compile($api.html($api.dom(template)))
  588. if (typeof root == 'string'){
  589. $api.after($api.dom(root),evalText(data))
  590. }else{
  591. $api.after(root,evalText(data))
  592. }
  593. };
  594. /**
  595. ** 缓存路径 cache:协议对应的真实目录
  596. **/
  597. d.CACHE_DIR = function (url) {
  598. return api.cacheDir + '/'+ url + '/' + api.frameName + '.json';
  599. }
  600. /**
  601. ** 缓存路径 box://协议对应的真实目录
  602. **/
  603. d.BOX_DIR = function () {
  604. return api.cacheDir + '/'+ url + '/' + api.frameName + '.json';
  605. }
  606. /**
  607. **把数据也入文件做数据缓存处理
  608. **/
  609. d.writeFile = function (url,data) {
  610. api.writeFile({
  611. path:url,
  612. data:JSON.stringify(data)
  613. })
  614. };
  615. /**
  616. **读取文件中缓存的数据
  617. **/
  618. d.readFile = function (url,callback) {
  619. api.readFile({
  620. path: url
  621. }, function(ret, err){
  622. callback(ret,err)
  623. });
  624. };
  625. /**轮播**/
  626. d.swiper = function (el,loops,type) {
  627. mySwiper = new Swiper(el, {
  628. pagination: {
  629. el: '.swiper-pagination',
  630. type: type,
  631. },
  632. loop:false,
  633. observer:true,
  634. observeSlideChildren:true,
  635. speed:600,
  636. autoplay: {
  637. delay: 3000,
  638. disableOnInteraction: false,
  639. },
  640. });
  641. }
  642. window.$apis = d
  643. }(window));
  644. /**
  645. * 面板
  646. *
  647. */
  648. (function( window, undefined ) {
  649. "use strict";
  650. var auiCollapse = function(params) {
  651. this.init(params);
  652. };
  653. auiCollapse.prototype = {
  654. init: function(params,callback){
  655. var collapseHeader = document.querySelectorAll(".aui-collapse-header");
  656. if(collapseHeader.length){
  657. for(var i=0;i<collapseHeader.length;i++){
  658. (function(e){
  659. collapseHeader[e].onclick = function(){
  660. if(collapseHeader[e].nextSibling.nextElementSibling.className.indexOf("aui-collapse-content") > -1){
  661. if(collapseHeader[e].nextSibling.nextElementSibling.className.indexOf("aui-show") > -1){
  662. collapseHeader[e].nextSibling.nextElementSibling.classList.remove("aui-show");
  663. collapseHeader[e].classList.remove("aui-active");
  664. }else{
  665. if(params.autoHide){
  666. if(document.querySelector(".aui-collapse-header.aui-active")){
  667. document.querySelector(".aui-collapse-header.aui-active").classList.remove("aui-active");
  668. }
  669. if(document.querySelector(".aui-collapse-content.aui-show")){
  670. document.querySelector(".aui-collapse-content.aui-show").classList.remove("aui-show");
  671. }
  672. }
  673. collapseHeader[e].nextSibling.nextElementSibling.classList.toggle("aui-show");
  674. collapseHeader[e].classList.toggle("aui-active");
  675. }
  676. }
  677. }
  678. })(i)
  679. }
  680. }
  681. }
  682. };
  683. window.auiCollapse = auiCollapse;
  684. })(window);
  685. /**
  686. *获取当前时间
  687. *
  688. **/
  689. function getNowFormatDate() {
  690. var now = new Date();
  691. var year = now.getFullYear(); //获取年份
  692. var month = now.getMonth(); //获取月份
  693. var date = now.getDate(); //获取日期
  694. var day = now.getDay(); //获取星期
  695. var hour = now.getHours(); //获取小时
  696. var minute = now.getMinutes(); //获取分钟
  697. var seconds = now.getSeconds()<10?'0'+now.getSeconds():now.getSeconds(); //获取秒
  698. month = month + 1;
  699. var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  700. var week = arr_week[day];
  701. var time = year + "年" + month + "月" + date + "日 " + week + " " + hour + ":" + minute + ":" + seconds;
  702. return time;
  703. }
  704. // 把时间戳转为日期或者时间
  705. function formatDateTime(inputTime){
  706. let date = new Date(inputTime);
  707. let y = date.getFullYear();
  708. let m = date.getMonth() + 1;
  709. m = m < 10 ? ('0' + m) : m;
  710. let d = date.getDate();
  711. d = d < 10 ? ('0' + d) : d;
  712. let h = date.getHours();
  713. h = h < 10 ? ('0' + h) : h;
  714. let minute = date.getMinutes();
  715. let second = date.getSeconds();
  716. minute = minute < 10 ? ('0' + minute) : minute;
  717. second = second < 10 ? ('0' + second) : second;
  718. return y + '-' + m + '-' + d;
  719. }
  720. /**
  721. *消除300ms延迟
  722. ***/
  723. !function(){"use strict";function t(e,o){function i(t,e){return function(){return t.apply(e,arguments)}}var r;if(o=o||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=o.touchBoundary||10,this.layer=e,this.tapDelay=o.tapDelay||200,this.tapTimeout=o.tapTimeout||700,!t.notNeeded(e)){for(var a=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],c=0,s=a.length;c<s;c++)this[a[c]]=i(this[a[c]],this);n&&(e.addEventListener("mouseover",this.onMouse,!0),e.addEventListener("mousedown",this.onMouse,!0),e.addEventListener("mouseup",this.onMouse,!0)),e.addEventListener("click",this.onClick,!0),e.addEventListener("touchstart",this.onTouchStart,!1),e.addEventListener("touchmove",this.onTouchMove,!1),e.addEventListener("touchend",this.onTouchEnd,!1),e.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(e.removeEventListener=function(t,n,o){var i=Node.prototype.removeEventListener;"click"===t?i.call(e,t,n.hijacked||n,o):i.call(e,t,n,o)},e.addEventListener=function(t,n,o){var i=Node.prototype.addEventListener;"click"===t?i.call(e,t,n.hijacked||(n.hijacked=function(t){t.propagationStopped||n(t)}),o):i.call(e,t,n,o)}),"function"==typeof e.onclick&&(r=e.onclick,e.addEventListener("click",function(t){r(t)},!1),e.onclick=null)}}var e=navigator.userAgent.indexOf("Windows Phone")>=0,n=navigator.userAgent.indexOf("Android")>0&&!e,o=/iP(ad|hone|od)/.test(navigator.userAgent)&&!e,i=o&&/OS 4_\d(_\d)?/.test(navigator.userAgent),r=o&&/OS [6-7]_\d/.test(navigator.userAgent),a=navigator.userAgent.indexOf("BB10")>0;t.prototype.needsClick=function(t){switch(t.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(t.disabled)return!0;break;case"input":if(o&&"file"===t.type||t.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(t.className)},t.prototype.needsFocus=function(t){switch(t.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!n;case"input":switch(t.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!t.disabled&&!t.readOnly;default:return/\bneedsfocus\b/.test(t.className)}},t.prototype.sendClick=function(t,e){var n,o;document.activeElement&&document.activeElement!==t&&document.activeElement.blur(),o=e.changedTouches[0],(n=document.createEvent("MouseEvents")).initMouseEvent(this.determineEventType(t),!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,0,null),n.forwardedTouchEvent=!0,t.dispatchEvent(n)},t.prototype.determineEventType=function(t){return n&&"select"===t.tagName.toLowerCase()?"mousedown":"click"},t.prototype.focus=function(t){var e;o&&t.setSelectionRange&&0!==t.type.indexOf("date")&&"time"!==t.type&&"month"!==t.type?(e=t.value.length,t.setSelectionRange(e,e)):t.focus()},t.prototype.updateScrollParent=function(t){var e,n;if(!(e=t.fastClickScrollParent)||!e.contains(t)){n=t;do{if(n.scrollHeight>n.offsetHeight){e=n,t.fastClickScrollParent=n;break}n=n.parentElement}while(n)}e&&(e.fastClickLastScrollTop=e.scrollTop)},t.prototype.getTargetElementFromEventTarget=function(t){return t.nodeType===Node.TEXT_NODE?t.parentNode:t},t.prototype.onTouchStart=function(t){var e,n,r;if(t.targetTouches.length>1)return!0;if(e=this.getTargetElementFromEventTarget(t.target),n=t.targetTouches[0],o){if((r=window.getSelection()).rangeCount&&!r.isCollapsed)return!0;if(!i){if(n.identifier&&n.identifier===this.lastTouchIdentifier)return t.preventDefault(),!1;this.lastTouchIdentifier=n.identifier,this.updateScrollParent(e)}}return this.trackingClick=!0,this.trackingClickStart=t.timeStamp,this.targetElement=e,this.touchStartX=n.pageX,this.touchStartY=n.pageY,t.timeStamp-this.lastClickTime<this.tapDelay&&t.preventDefault(),!0},t.prototype.touchHasMoved=function(t){var e=t.changedTouches[0],n=this.touchBoundary;return Math.abs(e.pageX-this.touchStartX)>n||Math.abs(e.pageY-this.touchStartY)>n},t.prototype.onTouchMove=function(t){return!this.trackingClick||((this.targetElement!==this.getTargetElementFromEventTarget(t.target)||this.touchHasMoved(t))&&(this.trackingClick=!1,this.targetElement=null),!0)},t.prototype.findControl=function(t){return void 0!==t.control?t.control:t.htmlFor?document.getElementById(t.htmlFor):t.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},t.prototype.onTouchEnd=function(t){var e,a,c,s,u,l=this.targetElement;if(!this.trackingClick)return!0;if(t.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0,!0;if(t.timeStamp-this.trackingClickStart>this.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=t.timeStamp,a=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,r&&(u=t.changedTouches[0],(l=document.elementFromPoint(u.pageX-window.pageXOffset,u.pageY-window.pageYOffset)||l).fastClickScrollParent=this.targetElement.fastClickScrollParent),"label"===(c=l.tagName.toLowerCase())){if(e=this.findControl(l)){if(this.focus(l),n)return!1;l=e}}else if(this.needsFocus(l))return t.timeStamp-a>100||o&&window.top!==window&&"input"===c?(this.targetElement=null,!1):(this.focus(l),this.sendClick(l,t),o&&"select"===c||(this.targetElement=null,t.preventDefault()),!1);return!(!o||i||!(s=l.fastClickScrollParent)||s.fastClickLastScrollTop===s.scrollTop)||(this.needsClick(l)||(t.preventDefault(),this.sendClick(l,t)),!1)},t.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},t.prototype.onMouse=function(t){return!this.targetElement||(!!t.forwardedTouchEvent||(!t.cancelable||(!(!this.needsClick(this.targetElement)||this.cancelNextClick)||(t.stopImmediatePropagation?t.stopImmediatePropagation():t.propagationStopped=!0,t.stopPropagation(),t.preventDefault(),!1))))},t.prototype.onClick=function(t){var e;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===t.target.type&&0===t.detail||((e=this.onMouse(t))||(this.targetElement=null),e)},t.prototype.destroy=function(){var t=this.layer;n&&(t.removeEventListener("mouseover",this.onMouse,!0),t.removeEventListener("mousedown",this.onMouse,!0),t.removeEventListener("mouseup",this.onMouse,!0)),t.removeEventListener("click",this.onClick,!0),t.removeEventListener("touchstart",this.onTouchStart,!1),t.removeEventListener("touchmove",this.onTouchMove,!1),t.removeEventListener("touchend",this.onTouchEnd,!1),t.removeEventListener("touchcancel",this.onTouchCancel,!1)},t.notNeeded=function(t){var e,o,i;if(void 0===window.ontouchstart)return!0;if(o=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!n)return!0;if(e=document.querySelector("meta[name=viewport]")){if(-1!==e.content.indexOf("user-scalable=no"))return!0;if(o>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(a&&(i=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/))[1]>=10&&i[2]>=3&&(e=document.querySelector("meta[name=viewport]"))){if(-1!==e.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===t.style.msTouchAction||"manipulation"===t.style.touchAction||(!!(+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]>=27&&(e=document.querySelector("meta[name=viewport]"))&&(-1!==e.content.indexOf("user-scalable=no")||document.documentElement.scrollWidth<=window.outerWidth))||"none"===t.style.touchAction||"manipulation"===t.style.touchAction)},t.attach=function(e,n){return new t(e,n)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return t}):"undefined"!=typeof module&&module.exports?(module.exports=t.attach,module.exports.FastClick=t):window.FastClick=t}();
  724. /**
  725. * fastclick 消除点击时间
  726. */
  727. if ('addEventListener' in document) {
  728. document.addEventListener('DOMContentLoaded',function(){
  729. FastClick.attach(document.body);
  730. },false)
  731. };
  732. // 数组删除元素
  733. Array.prototype.remove = function(val) {
  734. var index = this.indexOf(val);
  735. if (index > -1) {
  736. this.splice(index, 1);
  737. }
  738. };