config.js 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. // 定义服务器端域名
  2. var javaApi = '/api/swagger/';
  3. // var mineName = '麦垛山煤矿';
  4. var mineName = '羊场湾煤矿';
  5. // var mineName = 'E信管理';
  6. var ossImgName = '羊场湾煤矿';
  7. // 视频类型
  8. var videoType = 2
  9. // 枣泉
  10. var URLjava = 'http://yangchangwan.nxjiewei.com:8011' + javaApi;
  11. var urlphp = 'http://yangchangwan.nxjiewei.com:8011/';
  12. var cloudUrl = 'http://wpan.nxjiewei.com:8012/';
  13. // var URLjava = 'http://colliery.nxjiewei.com'+javaApi;
  14. // var urlphp = 'http://colliery.nxjiewei.com/';
  15. // 工单上传图片和文件地址
  16. var ceshiUrl = 'http://47.105.143.227:8083/';//测试地址java
  17. // 设备物资,固定电缆
  18. // var urlJavaOld = 'http://nxjiewei.com/colliery-system/api/page/v1/eqByNameList.html'
  19. // var URLjava = 'http://apptest.jieweizhineng.com'+javaApi;
  20. // 麦陀山
  21. // var URLjava = 'http://maiduoshan.nxjiewei.com'+javaApi;
  22. // var urlphp = 'http://maiduoshan.nxjiewei.com/';
  23. // 宁东运营部
  24. // var URLjava = 'http://ningdongyunying.nxjiewei.com'+javaApi;
  25. // var urlphp = 'http://ningdongyunying.nxjiewei.com/';
  26. var pageIdConfig = {
  27. suggestionFeedback: '7e4aeb35f5d54815ad7e5069c279bb9f', // 建议反馈
  28. updateLog: 'f77e273c6cb542fdb6afa61c78f5fc95', // 更新日志
  29. userManual: 'e802728b889b42fb9bb405cacc7ae04c' // 使用手册
  30. }
  31. var UrlRouter = {
  32. loginApi: urlphp + 'api/oauth/token',//登录
  33. vcodeApi: urlphp + 'api/sms/vcode',//发送验证吗
  34. setApi: urlphp + 'api/user/mobile/set',//绑定手机号
  35. uploadFile: URLjava + 'api/common/v1/uploadFile',//上传
  36. addFile: URLjava + 'api/page/v1/addFile', //上传 PPT EXCEL等文件
  37. addPicture: URLjava + 'api/page/v1/addPicture',//上传图集
  38. addLinks: URLjava+ 'api/page/v1/addLinks', //上传链接
  39. repasswordApi: urlphp + 'api/user/repassword',//修改密码
  40. bannerApi: urlphp + 'api/scrollImg/list',//banner
  41. nwesApi: urlphp + 'api/article/list',//新闻
  42. NoticeApi: urlphp + 'api/notice/list',//公告
  43. ImgApi: urlphp + 'api/homeNav/list',//图片导航
  44. DistrictteamApi: urlphp + 'api/home/links',//区队
  45. userInfoApi: urlphp + 'api/user/info',//个人信息
  46. findMessageApi: URLjava + 'api/dynamic/v1/findMessage/',//消息列表 二维码 、 巡检记录
  47. getPageRecordInstaneClosedLoop: URLjava + 'api/record/v1/getPageRecordInstaneClosedLoop',// 查询二维码巡检的闭环列表
  48. getPageRecordInstanCreateBy: URLjava + 'api/record/v1/getPageRecordInstanCreateBy',// 我的记录列表
  49. getChangMessageDepartmentIdList: URLjava + 'api/dynamic/v1/changMessageDepartmentIdList', // 二维码已读
  50. getPageAndRecordDynamic: URLjava + "api/dynamic/v1/getPageAndRecordDynamic",//二维码和记录合并
  51. getPageDynamicApi: URLjava + 'api/dynamic/v1/getPageDynamic',//获取二维码列表
  52. getRecordDynamicApi: URLjava + 'api/dynamic/v1/getRecordDynamic',//获取巡检列表
  53. addPageDynamicApi: URLjava + 'api/dynamic/v1/addPageDynamic',//已读二维码
  54. addRecordDynamicApi: URLjava + 'api/dynamic/v1/addRecordDynamic',//已读巡检记录
  55. getPageRecordInstaneClosedLoop: URLjava + 'api/record/v1/getPageRecordInstaneClosedLoop',// 查询二维码巡检的闭环列表
  56. regionApi: urlphp + 'api/monitor/video/region',//监控列表权限
  57. // cameraApi:urlphp+'api/monitor/video/camera',//监控子项
  58. selectRootRequest: URLjava + 'api/resource/v1/selectRootRequest',//视频区域列表
  59. selectResourceList: URLjava + 'api/resource/v1/selectResourceList',//视频播放列表
  60. selectResourcePreviewURLs: URLjava + 'api/resource/v1/selectResourcePreviewURLs',//视频播放URl
  61. findMessageCount: URLjava + 'api/dynamic/v1/findMessageCount/',
  62. seachQrcode: URLjava + 'api/page/v1/getPageList',//查询二维码
  63. getDeviceValueTypeCode: ceshiUrl + 'api/device/v1/getDeviceValueTypeCode/',//查询传感器的数值信息
  64. getData: ceshiUrl + 'api/data/v1/getData',//实时数据查询
  65. getDeviceInfo: urlphp + 'api/safety/search',//查询传感器信息
  66. searchData: ceshiUrl + 'api/data/v1/searchData',//查询传感器实时数据详情
  67. securityJurisdiction: urlphp + 'api/detection/show',//安全监测权限
  68. getSafetyTotal: urlphp + 'api/safety/total',//704 安全监测
  69. getSafetyList: urlphp + 'api/safety/220704',//安全监测 列表
  70. getPersonalInfo: urlphp + 'api/personnel/people/now',//704人员定位
  71. getPersonalMap: urlphp + 'api/personnel/people/220704',//704人员定位详情
  72. getSafetyStatusList: urlphp + 'api/safety/220704/list',//704安全数据详情
  73. // 工单模块
  74. getGroupList: urlphp + "api/section/getGroupList",//获取部门列表
  75. getPersonalList: urlphp + 'api/user/list',//获取部门人员
  76. getList: urlphp + 'api/section/getlist',//部门列表接口
  77. getAlllist: urlphp + 'api/section/getalllist',//部门列表接口1
  78. searchPersonal: urlphp + 'api/user/search',//搜索人员
  79. wordOrderList: urlphp + 'api/worksheet/classify/list',//工单分类
  80. applyList: urlphp + 'api/worksheet/design/list',//可申请工单列表
  81. getApplyList: urlphp + 'api/worksheet/apply/list',// 自己审请的工单列表
  82. getApplyD: urlphp + 'api/worksheet/design/',//获取可申请工单详情
  83. submitApply: urlphp + 'api/worksheet/apply',//提交工单信息
  84. submitApplyDe: urlphp + 'api/worksheet/apply/',//提交工单详情
  85. getExamine: urlphp + 'api/worksheet/check/list',//待审核工单
  86. getExamineDe: urlphp + 'api/worksheet/check/', //待审核工单详情
  87. getAlreadyDe: urlphp + 'api/worksheet/checked/', //待审核工单详情
  88. submitAdopt: urlphp + 'api/worksheet/check/',//通过审核
  89. getAlreadyExamine: urlphp + 'api/worksheet/checked/list',//已审核
  90. getAll_list: urlphp + 'api/worksheet/design/all_list',//所有工单设计列表
  91. fill_order: urlphp + 'api/worksheet/fill_order/', //工单信息补充
  92. up_images: urlphp + 'api/worksheet/design/up_images', // 图片上传
  93. getNewsList: urlphp + 'api/message/list',//消息列表
  94. getRead: urlphp + 'api/message/read',//已读消息
  95. getNewsNum: urlphp + 'api/message/unread_num',//消息总数
  96. thumbs: urlphp + 'api/user/like/post',//点赞or取消点赞
  97. comment: urlphp + 'api/user/comment/post',//提交留言
  98. delComment: urlphp + 'api/user/comment/del',//删除留言
  99. simulationTotal: urlphp + 'api/safety/simulation/total',//模拟量统计
  100. sluicetTotal: urlphp + 'api/safety/sluice/total',//开关量统计
  101. safetyDetaile: urlphp + 'api/safety/info/total',//安全数据详情
  102. downWellTotal: urlphp + 'api/personnel/month/total',//一周下井趋势
  103. currentPersonalNum: urlphp + 'api/personnel/now',//一周下井趋势当前人数
  104. getBanNowDayTotal: URLjava + 'api/pdcban/v1/getBanNowDayTotal',//今日产量
  105. getBanDayList: URLjava + '/api/pdcban/v1/getBanDayList',//一周的产量
  106. getMonthSumByYear: URLjava + 'api/pdcban/v1/getMonthSumByYear',//一年的产量
  107. getBulletin: urlphp + 'api/dispatch/bulletin',//生产数据公告
  108. getSchedule: urlphp + 'api/dispatch/schedule',//调度统计
  109. getAlarmData: urlphp + 'api/safety/alarm',//报警分类
  110. getGasData: urlphp + 'api/safety/methane',//瓦斯异常情况
  111. getChangMessageList: URLjava + 'api/dynamic/v1/changMessageList/',//二维码和记录置为已读
  112. chartsJurisdiction: urlphp + 'api/dispatch/show',//图表权限
  113. personalLocation: urlphp + 'api/personnel/show',//人员定位权限
  114. getPersonnalList: urlphp + 'api/personnel/region/total',//人员定位列表
  115. getPersonnalDistributionList: urlphp + 'api/personnel/mine/total',//每个矿井人数统计
  116. getPersonnalDe: urlphp + 'api/personnel/mine/people',//人员详情
  117. searchPeople: urlphp + 'api/personnel/people/search',//查询人员定位
  118. peopleInfo: urlphp + 'api/personnel/people/info',//个人详情
  119. getDayHourTotal: URLjava + 'api/pdcban/v1/getDayHourTotal',//皮带称产量
  120. getPeopleNow: urlphp + 'api/personnel/people/now',//当前下井人数
  121. getOfficeTotal: urlphp + 'api/personnel/office/total',//井下人员(部门分布)
  122. getBasicTotal: urlphp + 'api/personnel/basic/total',//基层区队
  123. getWorkingTotal: urlphp + 'api/personnel/working/total',//工作面人数统计
  124. getDepartToday: urlphp + 'api/personnel/depart/today',//各部门人数统计
  125. getFacilityStatus: urlphp + 'api/personnel/facility/status',//人员定位系统设备运行状态
  126. getTimeout: urlphp + 'api/personnel/timeout/total',//人员超时统计
  127. getHelptotal: urlphp + 'api/personnel/help/total',//人员求救统计
  128. getPersonnelTimeoutDetails: urlphp + 'api/personnel/timeout/info',//人员超时统计详情
  129. getPersonnelHelpDetails: urlphp + 'api/personnel/help/info',//人员求救统计详情
  130. getPersonnelFacilityDetails: urlphp + 'api/personnel/facility/info',//人员求救统计详情
  131. getPersonnelWorkingDetails: urlphp + 'api/personnel/working/info',//工作面人员详情
  132. getPersonneldepartDetails: urlphp + 'api/personnel/depart/people',//井下部门分布列表
  133. getPersonneltodayDetails: urlphp + 'api/personnel/depart/people/today',//井下部门分布列表
  134. getBanDayThree: URLjava + 'api/pdcban/v1/getBanDayThree',//一周的产量列表
  135. getBanNowDayAllTotal: URLjava + 'api/pdcban/v1/getBanNowDayAllTotal',//今日产量
  136. getEfficacyCut: urlphp + 'api/dispatch/efficacy/cut',//割煤刀数
  137. getEfficacyCutMerge: urlphp + 'api/dispatch/efficacy/cut/merge',//割煤刀数和图表合并
  138. efficacyShow: urlphp + 'api/efficacy/show',//效能管控
  139. getEfficacyInfo: urlphp + 'api/dispatch/efficacy/cut/info',//割煤刀数工作面列表
  140. getFanStatus: urlphp + 'api/blower/status/now',//风机状态
  141. getFanData: urlphp + 'api/blower/chart/hour',//风量趋势
  142. getFanDatas: urlphp + 'api/blower/param/now',// 风量数据
  143. getGdWsclDataNewList: URLjava + 'api/gdwscldata/v1/getGdWsclDataNewList',//矿井水处理
  144. // getSelectWebSocketRequest:URLjava+'api/websocket/v1/selectWebSocketRequest',//采煤机
  145. getSelectWebSocketRequest: urlphp + '220704.php',//704 数据
  146. working220704: urlphp + 'api/working220704/show',//704权限
  147. getQrcodeDe: URLjava + 'api/page/v1/detailPage',//二维码详情
  148. addPageUser: URLjava + 'api/pageuser/v1/addPageUser',//添加浏览记录
  149. getPageUserByPageId: URLjava + 'api/pageuser/v1/getPageUserByPageId/',//获取浏览记录
  150. getPageRecordInstanceList: URLjava + 'api/record/v1/getPageRecordInstanceList',//记录列表
  151. selectRecordByGetPageId: URLjava + 'api/page/v1/selectRecordByGetPageId/',// 查询记录模版名称
  152. getInspection: URLjava + 'api/record/v1/getInspection',//记录模版内容
  153. addRecordInstance: URLjava + 'api/record/v1/addRecordInstance',//添加记录
  154. getRecordInstanceDetailList: URLjava + 'api/record/v1/getRecordInstanceDetailList',//记录详情
  155. addRecordUser: URLjava + 'api/recodeuser/v1/addRecordUser',//添加记录浏览人数
  156. getRecordUserById: URLjava + 'api/recodeuser/v1/getRecordUserById/',//获取记录浏览人数
  157. getSearchPageRecordInstance: URLjava + 'api/record/v1/searchPageRecordInstance/',//二维码统计标示
  158. getPageRecordInstanceListRadio: URLjava + 'api/record/v1/getPageRecordInstanceListRadio',//记录项统计 单选
  159. getRecordInstanceDetailListMobileExcel: URLjava + 'api/record/v1/getRecordInstanceDetailListMobileExcel',//记录导出
  160. selectPageStatusPercet: URLjava + 'api/record/v1/selectPageStatusPercet',//查询状态的比例
  161. selectPageRecodePercet: URLjava + 'api/record/v1/selectPageRecodePercet/',//查询记录项的比例
  162. getInvoice: urlphp + 'api/workbench/invoice/info',//发票
  163. getMymonth: urlphp + 'api/notice/my_list/month',//值班月份-个人
  164. getDutyMylist: urlphp + 'api/notice/my_list/list',//个人值班
  165. getAllmonth: urlphp + 'api/notice/all_list/month',//值班月份-所有人
  166. getDutyAlllist: urlphp + 'api/notice/all_list/list',//所有人值班
  167. getPassword: urlphp + 'api/workbench/salary/password',//工资权限验证
  168. getWagesDe: urlphp + 'api/workbench/salary/my_info',//工资详情
  169. getWagesChart: urlphp + 'api/workbench/salary/chart',//工资图表
  170. getAlllist: urlphp + 'api/section/getalllist',//部门列表接口1
  171. // 胶轮车
  172. rubberTyredCarList: urlphp + 'api/car/list', // 胶轮车列表
  173. rubberTyredcarDetails: urlphp + 'api/car/tra', // 车辆轨迹
  174. signalLampMsg: urlphp + 'api/car/signalNew',
  175. transparentShow: urlphp + '/api/transport/show', // 交通车权限
  176. getWorkbenchList: urlphp + 'api/workbench/index', // 工作台
  177. getPagebyNOAndName: URLjava + 'api/page/v1/getPagebyNOAndName',
  178. handleUpLoadSignature: urlphp + 'api/user/sign/upload', // 用户签名图片上传
  179. // 用户进 出浏览时间
  180. getAddPageUserTime: URLjava + 'api/pageusertime/v1/addPageUserTime', // 用户浏览信息开始
  181. getMonthlist: urlphp + 'api/personnel/downwell/monthlist/once', // 下井月份列表接口
  182. getMonthOnce: urlphp + 'api/personnel/downwell/month/once', // 需下井次数 和已下井次数 以及完成度
  183. getMonthInfo: urlphp + 'api/personnel/downwell/month/info', // 当月下井详细信息列表
  184. getOnceInfo: urlphp + 'api/personnel/downwell/once/info', // 当次信息的详细信息
  185. // 云盘
  186. loginExtends:cloudUrl+'netdisk-web-perpc/security/loginExtends',// 登陆
  187. findList: cloudUrl+'netdisk-web-perpc/disk/file/findList', // 文件列表
  188. delete:cloudUrl+'netdisk-web-perpc/disk/filecommon/delete', //删除文件
  189. fileSearch:cloudUrl+'netdisk-web-perpc/disk/file/newSearch', // 查询文件
  190. addFolder:cloudUrl+'netdisk-web-perpc/disk/filecommon/addFolder', // 添加文件夹
  191. mergeFilesNew:cloudUrl+'netdisk-web-perpc/disk/filedownload/mergeFilesNew',
  192. download:cloudUrl+'netdisk-web-perpc/disk/filedownload/download?', // 下载文件
  193. rename:cloudUrl+'netdisk-web-perpc/disk/filecommon/rename', //重命名
  194. // 收藏二维码
  195. handleAddPageCollect: URLjava + 'api/pageCollect/v1/addPageCollect', //收藏二维码
  196. handleDelPageCollect: URLjava + 'api/pageCollect/v1/delPageCollect', // 取消收藏
  197. getSelectPageCollect: URLjava + 'api/pageCollect/v1/selectPageCollect', //收藏二维码列表
  198. getPageCollectByPageIdAndUserNo: URLjava + 'api/pageCollect/v1/getPageCollectByPageIdAndUserNo' //查看二维码是否收藏
  199. };
  200. var mySwiper;//插件
  201. var loadingId = "";
  202. /**
  203. * 加载动画
  204. *
  205. */
  206. (function (window, undefined) {
  207. "use strict";
  208. var auiToast = function () {
  209. // this.create();
  210. };
  211. var isShow = false;
  212. auiToast.prototype = {
  213. create: function (params, callback) {
  214. var self = this;
  215. var toastHtml = '';
  216. switch (params.type) {
  217. case "success":
  218. var iconHtml = '<i class="aui-iconfont aui-icon-correct"></i>';
  219. break;
  220. case "fail":
  221. var iconHtml = '<i class="aui-iconfont aui-icon-close"></i>';
  222. break;
  223. case "custom":
  224. var iconHtml = params.html;
  225. break;
  226. case "loading":
  227. var iconHtml = '<div class="aui-toast-loading"></div>';
  228. break;
  229. }
  230. var titleHtml = params.title ? '<div class="aui-toast-content">' + params.title + '</div>' : '';
  231. toastHtml = `<div class="api-toast">
  232. <div class="aui-toast">${iconHtml + titleHtml}</div>
  233. </div>`
  234. if (document.querySelector(".aui-toast")) return;
  235. document.body.insertAdjacentHTML('beforeend', toastHtml);
  236. var duration = params.duration ? params.duration : "2000";
  237. self.show();
  238. if (params.type == 'loading') {
  239. if (callback) {
  240. callback({
  241. status: "success"
  242. });
  243. };
  244. } else {
  245. setTimeout(function () {
  246. self.hide();
  247. }, duration)
  248. }
  249. },
  250. show: function () {
  251. var self = this;
  252. document.querySelector(".aui-toast").style.display = "block";
  253. document.querySelector(".aui-toast").style.marginTop = "-" + Math.round(document.querySelector(".aui-toast").offsetHeight / 2) + "px";
  254. if (document.querySelector(".aui-toast")) return;
  255. },
  256. hide: function () {
  257. var self = this;
  258. if (document.querySelector(".aui-toast")) {
  259. document.querySelector(".api-toast").remove()
  260. }
  261. },
  262. remove: function () {
  263. if (document.querySelector(".aui-dialog")) document.querySelector(".aui-dialog").parentNode.removeChild(document.querySelector(".aui-dialog"));
  264. if (document.querySelector(".aui-mask")) {
  265. document.querySelector(".aui-mask").classList.remove("aui-mask-out");
  266. }
  267. return true;
  268. },
  269. success: function (params, callback) {
  270. var self = this;
  271. params.type = "success";
  272. return self.create(params, callback);
  273. },
  274. fail: function (params, callback) {
  275. var self = this;
  276. params.type = "fail";
  277. return self.create(params, callback);
  278. },
  279. custom: function (params, callback) {
  280. var self = this;
  281. params.type = "custom";
  282. return self.create(params, callback);
  283. },
  284. loading: function (params, callback) {
  285. var self = this;
  286. params.type = "loading";
  287. return self.create(params, callback);
  288. }
  289. };
  290. window.auiToast = auiToast;
  291. })(window);
  292. (function (window, undefined) {
  293. "use strict";
  294. var apiToast = function () {
  295. // this.create();
  296. };
  297. var isShow = false;
  298. apiToast.prototype = {
  299. create: function (params, callback) {
  300. var self = this;
  301. var toastHtml = '';
  302. switch (params.type) {
  303. case "success":
  304. var iconHtml = '<i class="aui-iconfont aui-icon-correct"></i>';
  305. break;
  306. case "fail":
  307. var iconHtml = '<i class="aui-iconfont aui-icon-close"></i>';
  308. break;
  309. case "custom":
  310. var iconHtml = params.html;
  311. break;
  312. case "loading":
  313. var iconHtml = '<div class="api-toast-loading"></div>';
  314. break;
  315. }
  316. var titleHtml = params.title ? '<div class="api-toast-content">' + params.title + '</div>' : '';
  317. toastHtml = `<div class="api-toast">${iconHtml + titleHtml}</div>`
  318. if (document.querySelector(".api-toast")) return;
  319. document.body.insertAdjacentHTML('beforeend', toastHtml);
  320. var duration = params.duration ? params.duration : "2000";
  321. self.show();
  322. if (params.type == 'loading') {
  323. if (callback) {
  324. callback({
  325. status: "success"
  326. });
  327. };
  328. } else {
  329. setTimeout(function () {
  330. self.hide();
  331. }, duration)
  332. }
  333. },
  334. show: function () {
  335. var self = this;
  336. document.querySelector(".api-toast").style.display = "block";
  337. document.querySelector(".api-toast").style.marginTop = "-" + Math.round(document.querySelector(".api-toast").offsetHeight / 2) + "px";
  338. if (document.querySelector(".api-toast")) return;
  339. },
  340. hide: function () {
  341. var self = this;
  342. if (document.querySelector(".api-toast")) {
  343. document.querySelector(".api-toast").parentNode.removeChild(document.querySelector(".api-toast"));
  344. }
  345. },
  346. remove: function () {
  347. if (document.querySelector(".api-dialog")) document.querySelector(".api-dialog").parentNode.removeChild(document.querySelector(".api-dialog"));
  348. if (document.querySelector(".api-mask")) {
  349. document.querySelector(".api-mask").classList.remove("api-mask-out");
  350. }
  351. return true;
  352. },
  353. success: function (params, callback) {
  354. var self = this;
  355. params.type = "success";
  356. return self.create(params, callback);
  357. },
  358. fail: function (params, callback) {
  359. var self = this;
  360. params.type = "fail";
  361. return self.create(params, callback);
  362. },
  363. custom: function (params, callback) {
  364. var self = this;
  365. params.type = "custom";
  366. return self.create(params, callback);
  367. },
  368. loading: function (params, callback) {
  369. var self = this;
  370. params.type = "loading";
  371. return self.create(params, callback);
  372. }
  373. };
  374. window.apiToast = apiToast;
  375. })(window);
  376. /**
  377. *
  378. */
  379. /**
  380. * ajax 封装
  381. */
  382. (function (window) {
  383. /**
  384. ** 不带加载效果
  385. ** Promise 形式的ajax
  386. **/
  387. var h = {};
  388. h.requestData = (url, method, values) => {
  389. return new Promise((resolve, reject) => {
  390. var info = $api.getStorage('data'),
  391. token = JSON.parse(info).data.access_token || "";
  392. var headers = {
  393. "Authorization": "Bearer " + token
  394. };
  395. var tAjax = {
  396. url,
  397. method,
  398. headers,
  399. dataType: 'json',
  400. data: {
  401. values
  402. },
  403. timeout: 30
  404. };
  405. api.ajax(tAjax, function (ret, err) {
  406. if (ret) {
  407. resolve(ret)
  408. } else {
  409. reject(err)
  410. }
  411. });
  412. })
  413. };
  414. /**
  415. ** 带加载效果
  416. ** Promise 形式的ajax
  417. **/
  418. h.requestDataLoging = (url, method, values) => {
  419. var toast = new auiToast();
  420. toast.loading({
  421. title: "加载中",
  422. duration: 2000
  423. });
  424. return new Promise((resolve, reject) => {
  425. var info = $api.getStorage('data'),
  426. token = JSON.parse(info).data.access_token || "";
  427. var headers = {
  428. "Authorization": "Bearer " + token
  429. };
  430. var tAjax = {
  431. url,
  432. method,
  433. headers,
  434. dataType: 'json',
  435. data: {
  436. values
  437. },
  438. timeout: 30
  439. };
  440. api.ajax(tAjax, function (ret, err) {
  441. if (ret) {
  442. resolve(ret)
  443. } else {
  444. reject(err)
  445. }
  446. toast.hide()
  447. });
  448. })
  449. };
  450. /**
  451. ** 带加载效果 (apicloud showProgress)
  452. ** Promise 形式的 ajax
  453. **/
  454. h.requestShowProgress = (url, method, values) => {
  455. api.showProgress({
  456. title: '加载中...',
  457. text: '',
  458. modal: true
  459. });
  460. return new Promise((resolve, reject) => {
  461. var info = $api.getStorage('data'),
  462. token = JSON.parse(info).data.access_token || "";
  463. var headers = {
  464. "Authorization": "Bearer " + token
  465. };
  466. var tAjax = {
  467. url,
  468. method,
  469. headers,
  470. dataType: 'json',
  471. data: {
  472. values
  473. },
  474. timeout: 30
  475. };
  476. api.ajax(tAjax, function (ret, err) {
  477. if (ret) {
  478. resolve(ret)
  479. } else {
  480. reject(err)
  481. }
  482. api.hideProgress()
  483. });
  484. })
  485. };
  486. /**
  487. ** 带加载效果
  488. ** Promise 形式的 文件上传ajax
  489. **/
  490. h.fileUploadRequest = (url, method, files) => {
  491. api.showProgress({
  492. title: '上传中...',
  493. text: '',
  494. modal: true
  495. });
  496. return new Promise((resolve, reject) => {
  497. var info = $api.getStorage('data'),
  498. token = JSON.parse(info).data.access_token || "";
  499. var headers = {
  500. "Authorization": "Bearer " + token
  501. };
  502. var tAjax = {
  503. url,
  504. method,
  505. headers,
  506. data: {
  507. files
  508. }
  509. };
  510. api.ajax(tAjax, function (ret, err) {
  511. if (ret) {
  512. resolve(ret)
  513. } else {
  514. reject(err)
  515. }
  516. api.hideProgress()
  517. });
  518. })
  519. };
  520. h.fnReuestData = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
  521. toast.loading({
  522. title: "加载中",
  523. duration: 2000
  524. });
  525. var tHeaders = pHeaders ? pHeaders : '';
  526. var tAjax = {
  527. url: pPartUrl,
  528. method: pMethod,
  529. headers: tHeaders,
  530. dataType: 'json',
  531. data: {
  532. values: pData
  533. },
  534. timeout: 30
  535. };
  536. api.ajax(tAjax, function (ret, err) {
  537. if ('function' === typeof pCallback) {
  538. pCallback(ret, err)
  539. }
  540. });
  541. };
  542. /**
  543. *不带低白加载效果
  544. **/
  545. h.fnReuestDataNoW = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
  546. apiToast.loading({
  547. title: "加载中",
  548. duration: 2000
  549. });
  550. var tHeaders = pHeaders ? pHeaders : '';
  551. var tAjax = {
  552. url: pPartUrl,
  553. method: pMethod,
  554. headers: tHeaders,
  555. dataType: 'json',
  556. data: {
  557. values: pData
  558. },
  559. timeout: 30
  560. };
  561. api.ajax(tAjax, function (ret, err) {
  562. if ('function' === typeof pCallback) {
  563. pCallback(ret, err)
  564. }
  565. });
  566. };
  567. /**
  568. ** 不带加载效果的ajax
  569. **/
  570. h.fnReuestDataNologing = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
  571. var tHeaders = pHeaders ? pHeaders : '';
  572. var tAjax = {
  573. url: pPartUrl,
  574. method: pMethod,
  575. headers: tHeaders,
  576. dataType: 'json',
  577. data: {
  578. values: pData
  579. },
  580. timeout: 30
  581. };
  582. api.ajax(tAjax, function (ret, err) {
  583. if ('function' === typeof pCallback) {
  584. pCallback(ret, err)
  585. }
  586. });
  587. };
  588. /**
  589. ** 加载效果的ajax
  590. ** 传JSON数据格式
  591. **/
  592. h.fnReuestDataJSON = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
  593. toast.loading({
  594. title: "加载中",
  595. duration: 2000
  596. });
  597. var tHeaders = pHeaders ? pHeaders : '';
  598. var tAjax = {
  599. url: pPartUrl,
  600. method: pMethod,
  601. contentType: 'application/json',
  602. headers: tHeaders,
  603. dataType: 'json',
  604. data: {
  605. values: pData
  606. },
  607. timeout: 30
  608. };
  609. api.ajax(tAjax, function (ret, err) {
  610. if ('function' === typeof pCallback) {
  611. pCallback(ret, err)
  612. }
  613. });
  614. };
  615. /**
  616. ** 不带加载效果的ajax
  617. ** 传JSON数据格式
  618. **/
  619. window.$http = h;
  620. }(window));
  621. /**
  622. * 常用方法
  623. */
  624. (function (window) {
  625. var e = {};
  626. /**
  627. * 封装消息发送时间
  628. */
  629. e.sendEvent = function (name, extra) {
  630. api.sendEvent({
  631. name: name,
  632. extra: extra
  633. });
  634. };
  635. /**
  636. * 消息监听事件
  637. */
  638. e.addEventListener = function (name, callback) {
  639. api.addEventListener({
  640. name: name
  641. }, function (ret, err) {
  642. callback(ret)
  643. });
  644. };
  645. /**
  646. *  滑动底部监听事件
  647. */
  648. e.scrollBottomListener = function (callback, threshold) {
  649. api.addEventListener({
  650. name: 'scrolltobottom',
  651. extra: {
  652. threshold: threshold || 0
  653. }
  654. }, function (ret, err) {
  655. callback(ret)
  656. });
  657. };
  658. /**
  659. * frame
  660. *
  661. */
  662. e.openFrame = function (name, headers, footer, pageParam, otherParam) {
  663. var headerH = headers ? $api.dom(headers).offsetHeight : 0;
  664. var footetH = footer ? $api.dom(footer).offsetHeight : 0;
  665. api.openFrame({
  666. name: name,
  667. url: name + '.html',
  668. bounces: true,
  669. scrollEnabled: false,
  670. hScrollBarEnabled: false,
  671. progress: {
  672. type: 'page'
  673. },
  674. animation: {
  675. type: 'fade'
  676. },
  677. rect: {
  678. x: 0,
  679. y: headerH,
  680. w: 'auto',
  681. h: 'auto'
  682. },
  683. pageParam: api.pageParam || {}
  684. });
  685. };
  686. /**
  687. *禁止页面弹动
  688. *
  689. **/
  690. e.openFrameBounces = function (name, headers, footer, pageParam, otherParam) {
  691. var headerH = headers ? $api.dom(headers).offsetHeight : 0;
  692. var footetH = footer ? $api.dom(footer).offsetHeight : 0;
  693. api.openFrame({
  694. name: name,
  695. url: name + '.html',
  696. bounces: false,
  697. scrollEnabled: false,
  698. hScrollBarEnabled: false,
  699. progress: {
  700. type: 'page'
  701. },
  702. animation: {
  703. type: 'fade'
  704. },
  705. rect: {
  706. x: 0,
  707. y: headerH,
  708. w: 'auto',
  709. h: 'auto'
  710. },
  711. pageParam: api.pageParam || {}
  712. });
  713. };
  714. /**
  715. *打开弹出框
  716. *
  717. **/
  718. e.openPopup = function (w, h, name, pageParam) {
  719. api.openFrame({
  720. name: name,
  721. url: name + '.html',
  722. bgColor: 'rgba(0,0,0,.6)',
  723. bounces: false,
  724. rect: {
  725. x: 0,
  726. y: 0,
  727. w: w,
  728. h: h
  729. },
  730. animation: {
  731. type: 'fade'
  732. },
  733. pageParam: pageParam
  734. });
  735. }
  736. /**
  737. * Win
  738. *
  739. */
  740. e.openWin = function (winName, winUrl, pageParam, otherParam) {
  741. var param = {
  742. name: winName,
  743. url: winUrl + '.html',
  744. scrollEnabled: false,
  745. hScrollBarEnabled: false,
  746. pageParam: pageParam,
  747. animation: {
  748. type: 'fade',
  749. duration: 450
  750. }
  751. }
  752. Object.assign(param, otherParam || {});
  753. api.openWin(param)
  754. }
  755. /**
  756. ** openTabLayout
  757. **/
  758. e.openTabLayout = function (name, url, title, value) {
  759. var param = {
  760. name: name,
  761. url: url + '.html',
  762. bgColor: 'rgba(0,159,232,1)',
  763. title: title,
  764. bounces: false,
  765. navigationBar: {
  766. height: '51',
  767. background: '#009fe8',
  768. color: '#fff',
  769. shadow: 'transparent'
  770. },
  771. pageParam: value
  772. }
  773. api.openTabLayout(param);
  774. }
  775. /**
  776. ** 提示框无网络
  777. **/
  778. e.tips = function (el, text) {
  779. var str = `<div id="tips">
  780. <p>
  781. <i></i>
  782. ${text}
  783. </p>
  784. </div>`;
  785. $api.append($api.dom(el), str);
  786. }
  787. e.removeTips = function (el) {
  788. $api.remove($api.byId(el));
  789. }
  790. /***
  791. 没有内容提示页面
  792. el = body
  793. Image显示图片路径
  794. ***/
  795. e.NotContent = function (el, elID, Image) {
  796. var html = `<div class="noText" id="${elID}">
  797. <img src="${Image}" alt="">
  798. </div>`;
  799. $api.append($api.dom(el), html);
  800. }
  801. /**
  802. *删除NotContent
  803. **/
  804. e.deletNotContent = function (elID) {
  805. $api.remove($api.byId(elID));
  806. }
  807. window.$event = e;
  808. }(window));
  809. /**
  810. * 工具类
  811. * */
  812. (function (window) {
  813. var d = {};
  814. /**
  815. * append
  816. * doT模版的封装
  817. * root DOM名称如ID 或class
  818. * doT template 名称
  819. * data ajax返回数据
  820. */
  821. d.append = function (root, template, data) {
  822. var evalText = doT.compile($api.html($api.dom(template)))
  823. if (typeof root == 'string') {
  824. $api.append($api.dom(root), evalText(data))
  825. } else {
  826. $api.append(root, evalText(data))
  827. }
  828. };
  829. /**
  830. * html
  831. * doT模版的封装
  832. * root DOM名称如ID 或class
  833. * doT template 名称
  834. * data ajax返回数据
  835. */
  836. d.html = function (root, template, data) {
  837. var evalText = doT.compile($api.html($api.dom(template)))
  838. if (typeof root == 'string') {
  839. $api.html($api.dom(root), evalText(data))
  840. } else {
  841. $api.html(root, evalText(data))
  842. }
  843. };
  844. /**
  845. * after
  846. * doT模版的封装
  847. * root DOM名称如ID 或class
  848. * doT template 名称
  849. * data ajax返回数据
  850. */
  851. d.after = function (root, template, data) {
  852. var evalText = doT.compile($api.html($api.dom(template)))
  853. if (typeof root == 'string') {
  854. $api.after($api.dom(root), evalText(data))
  855. } else {
  856. $api.after(root, evalText(data))
  857. }
  858. };
  859. /**
  860. ** 缓存路径 cache:协议对应的真实目录
  861. **/
  862. d.CACHE_DIR = function (url) {
  863. return api.cacheDir + '/' + url + '/' + api.frameName + '.json';
  864. }
  865. /**
  866. ** 缓存路径 box://协议对应的真实目录
  867. **/
  868. d.BOX_DIR = function () {
  869. return api.cacheDir + '/' + url + '/' + api.frameName + '.json';
  870. }
  871. /**
  872. **把数据也入文件做数据缓存处理
  873. **/
  874. d.writeFile = function (url, data) {
  875. api.writeFile({
  876. path: url,
  877. data: JSON.stringify(data)
  878. })
  879. };
  880. /**
  881. **读取文件中缓存的数据
  882. **/
  883. d.readFile = function (url, callback) {
  884. api.readFile({
  885. path: url
  886. }, function (ret, err) {
  887. callback(ret, err)
  888. });
  889. };
  890. /**轮播**/
  891. d.swiper = function (el, loops, type) {
  892. mySwiper = new Swiper(el, {
  893. pagination: {
  894. el: '.swiper-pagination',
  895. type: type,
  896. },
  897. loop: false,
  898. observer: true,
  899. observeSlideChildren: true,
  900. speed: 600,
  901. autoplay: {
  902. delay: 3000,
  903. disableOnInteraction: false,
  904. },
  905. on: {
  906. slideChangeTransitionEnd: function (e) {
  907. api.setFrameAttr({ bounces: true })
  908. },
  909. sliderMove: function (event) {
  910. api.setFrameAttr({ bounces: false })
  911. },
  912. touchEnd: function (event) {
  913. api.setFrameAttr({ bounces: true })
  914. }
  915. },
  916. });
  917. };
  918. /**
  919. ** Loading
  920. ** frameName frame名字
  921. ** mask 遮罩层 样式
  922. **/
  923. d.UILoading = function (frameName, mask) {
  924. var UILoading = api.require('UILoading');
  925. UILoading.flower({
  926. center: {
  927. x: api.winWidth / 2.0,
  928. y: api.winHeight / 2.0
  929. },
  930. size: 30,
  931. fixed: true,
  932. mask: mask == "" ? 'rgba(255,255,255,0' : mask,
  933. fixedOn: frameName
  934. }, function (ret) {
  935. loadingId = ret.id
  936. });
  937. };
  938. /**
  939. ** Loading
  940. ** 关闭Loading
  941. **
  942. **/
  943. d.CloseUILoading = function () {
  944. var uiloading = api.require('UILoading');
  945. uiloading.closeFlower({
  946. id: loadingId
  947. });
  948. };
  949. /**
  950. **
  951. ** 根据不同的数据来源 对应不用的pageId id等信息
  952. **
  953. **/
  954. d.differentPageParams = function (id, createDate, pageId) {
  955. let pageParams = {
  956. id: id,
  957. createDate: createDate,
  958. pageId: pageId
  959. }
  960. return pageParams
  961. }
  962. window.$apis = d
  963. }(window));
  964. /**
  965. * 面板
  966. *
  967. */
  968. (function (window, undefined) {
  969. "use strict";
  970. var auiCollapse = function (params) {
  971. this.init(params);
  972. };
  973. auiCollapse.prototype = {
  974. init: function (params, callback) {
  975. var collapseHeader = document.querySelectorAll(".aui-collapse-header");
  976. if (collapseHeader.length) {
  977. for (var i = 0; i < collapseHeader.length; i++) {
  978. (function (e) {
  979. collapseHeader[e].onclick = function () {
  980. if (collapseHeader[e].nextSibling.nextElementSibling.className.indexOf("aui-collapse-content") > -1) {
  981. if (collapseHeader[e].nextSibling.nextElementSibling.className.indexOf("aui-show") > -1) {
  982. collapseHeader[e].nextSibling.nextElementSibling.classList.remove("aui-show");
  983. collapseHeader[e].classList.remove("aui-active");
  984. } else {
  985. if (params.autoHide) {
  986. if (document.querySelector(".aui-collapse-header.aui-active")) {
  987. document.querySelector(".aui-collapse-header.aui-active").classList.remove("aui-active");
  988. }
  989. if (document.querySelector(".aui-collapse-content.aui-show")) {
  990. document.querySelector(".aui-collapse-content.aui-show").classList.remove("aui-show");
  991. }
  992. }
  993. collapseHeader[e].nextSibling.nextElementSibling.classList.toggle("aui-show");
  994. collapseHeader[e].classList.toggle("aui-active");
  995. }
  996. }
  997. }
  998. })(i)
  999. }
  1000. }
  1001. }
  1002. };
  1003. window.auiCollapse = auiCollapse;
  1004. })(window);
  1005. /**
  1006. *获取当前时间年月日 周 时 分 秒
  1007. *
  1008. **/
  1009. function getNowFormatDate() {
  1010. var now = new Date();
  1011. var year = now.getFullYear(); //获取年份
  1012. var month = now.getMonth(); //获取月份
  1013. var date = now.getDate(); //获取日期
  1014. var day = now.getDay(); //获取星期
  1015. var hour = now.getHours(); //获取小时
  1016. var minute = now.getMinutes(); //获取分钟
  1017. var seconds = now.getSeconds() < 10 ? '0' + now.getSeconds() : now.getSeconds(); //获取秒
  1018. month = month + 1;
  1019. var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  1020. var week = arr_week[day];
  1021. var time = year + "年" + month + "月" + date + "日 " + week + " " + hour + ":" + minute + ":" + seconds;
  1022. return time;
  1023. }
  1024. /**
  1025. *获取当前时间年月日
  1026. *
  1027. **/
  1028. function getYearMonthDate() {
  1029. var now = new Date();
  1030. var year = now.getFullYear(); //获取年份
  1031. var month = now.getMonth(); //获取月份
  1032. var date = now.getDate(); //获取日期
  1033. var hour = now.getHours(); //获取小时
  1034. var minute = now.getMinutes(); //获取分钟
  1035. month = month + 1;
  1036. month = month < 10 ? '0' + month : month
  1037. date = date < 10 ? '0' + date : date
  1038. var time = year + "-" + month + "-" + date
  1039. return time;
  1040. }
  1041. /**
  1042. *获取当前时间YYYY-MM-dd hh:mm
  1043. *
  1044. **/
  1045. function getYearMonthDateTime() {
  1046. var now = new Date();
  1047. var year = now.getFullYear(); //获取年份
  1048. var month = now.getMonth(); //获取月份
  1049. var date = now.getDate(); //获取日期
  1050. var hour = now.getHours(); //获取小时
  1051. var minute = now.getMinutes(); //获取分钟
  1052. month = month + 1;
  1053. month = month < 10 ? '0' + month : month
  1054. date = date < 10 ? '0' + date : date
  1055. hour = hour < 10 ? '0' + hour : hour
  1056. minute = minute < 10 ? '0' + minute : minute
  1057. var time = year + "-" + month + "-" + date + " " + hour + ":" + minute
  1058. return time;
  1059. }
  1060. // 把时间戳转为日期或者时间
  1061. function formatDateTime(inputTime) {
  1062. let date = new Date(inputTime);
  1063. let y = date.getFullYear();
  1064. let m = date.getMonth() + 1;
  1065. m = m < 10 ? ('0' + m) : m;
  1066. let d = date.getDate();
  1067. d = d < 10 ? ('0' + d) : d;
  1068. let h = date.getHours();
  1069. h = h < 10 ? ('0' + h) : h;
  1070. let minute = date.getMinutes();
  1071. let second = date.getSeconds();
  1072. minute = minute < 10 ? ('0' + minute) : minute;
  1073. second = second < 10 ? ('0' + second) : second;
  1074. return y + '-' + m + '-' + d;
  1075. }
  1076. // 计算时间天数差
  1077. function datedifference(sDate2) {
  1078. var date = new Date();
  1079. var year = date.getFullYear() - 1
  1080. var month = date.getMonth() + 1
  1081. var d = date.getDate()
  1082. var dateSpan,
  1083. tempDate,
  1084. iDays;
  1085. sDate1 = Date.parse(year + "-" + month + "-" + d);
  1086. dateSpan = sDate2 - sDate1;
  1087. dateSpan = Math.abs(dateSpan);
  1088. iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
  1089. return iDays
  1090. };
  1091. /**
  1092. *消除300ms延迟
  1093. ***/
  1094. !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 }();
  1095. /**
  1096. * fastclick 消除点击时间
  1097. */
  1098. if ('addEventListener' in document) {
  1099. document.addEventListener('DOMContentLoaded', function () {
  1100. FastClick.attach(document.body);
  1101. }, false)
  1102. };
  1103. // 数组删除元素
  1104. Array.prototype.remove = function (val) {
  1105. var index = this.indexOf(val);
  1106. if (index > -1) {
  1107. this.splice(index, 1);
  1108. }
  1109. };