config.js 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130
  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. getMaterial: urlphp + 'api/materials/goods/list',// 物资列表
  201. getMaterialStorageList: urlphp + 'api/materials/storage/list',//物资仓库列表
  202. getMaterialClassifyList: urlphp + 'api/materials/classify/list',
  203. };
  204. var mySwiper;//插件
  205. var loadingId = "";
  206. /**
  207. * 加载动画
  208. *
  209. */
  210. (function (window, undefined) {
  211. "use strict";
  212. var auiToast = function () {
  213. // this.create();
  214. };
  215. var isShow = false;
  216. auiToast.prototype = {
  217. create: function (params, callback) {
  218. var self = this;
  219. var toastHtml = '';
  220. switch (params.type) {
  221. case "success":
  222. var iconHtml = '<i class="aui-iconfont aui-icon-correct"></i>';
  223. break;
  224. case "fail":
  225. var iconHtml = '<i class="aui-iconfont aui-icon-close"></i>';
  226. break;
  227. case "custom":
  228. var iconHtml = params.html;
  229. break;
  230. case "loading":
  231. var iconHtml = '<div class="aui-toast-loading"></div>';
  232. break;
  233. }
  234. var titleHtml = params.title ? '<div class="aui-toast-content">' + params.title + '</div>' : '';
  235. toastHtml = `<div class="api-toast">
  236. <div class="aui-toast">${iconHtml + titleHtml}</div>
  237. </div>`
  238. if (document.querySelector(".aui-toast")) return;
  239. document.body.insertAdjacentHTML('beforeend', toastHtml);
  240. var duration = params.duration ? params.duration : "2000";
  241. self.show();
  242. if (params.type == 'loading') {
  243. if (callback) {
  244. callback({
  245. status: "success"
  246. });
  247. };
  248. } else {
  249. setTimeout(function () {
  250. self.hide();
  251. }, duration)
  252. }
  253. },
  254. show: function () {
  255. var self = this;
  256. document.querySelector(".aui-toast").style.display = "block";
  257. document.querySelector(".aui-toast").style.marginTop = "-" + Math.round(document.querySelector(".aui-toast").offsetHeight / 2) + "px";
  258. if (document.querySelector(".aui-toast")) return;
  259. },
  260. hide: function () {
  261. var self = this;
  262. if (document.querySelector(".aui-toast")) {
  263. document.querySelector(".api-toast").remove()
  264. }
  265. },
  266. remove: function () {
  267. if (document.querySelector(".aui-dialog")) document.querySelector(".aui-dialog").parentNode.removeChild(document.querySelector(".aui-dialog"));
  268. if (document.querySelector(".aui-mask")) {
  269. document.querySelector(".aui-mask").classList.remove("aui-mask-out");
  270. }
  271. return true;
  272. },
  273. success: function (params, callback) {
  274. var self = this;
  275. params.type = "success";
  276. return self.create(params, callback);
  277. },
  278. fail: function (params, callback) {
  279. var self = this;
  280. params.type = "fail";
  281. return self.create(params, callback);
  282. },
  283. custom: function (params, callback) {
  284. var self = this;
  285. params.type = "custom";
  286. return self.create(params, callback);
  287. },
  288. loading: function (params, callback) {
  289. var self = this;
  290. params.type = "loading";
  291. return self.create(params, callback);
  292. }
  293. };
  294. window.auiToast = auiToast;
  295. })(window);
  296. (function (window, undefined) {
  297. "use strict";
  298. var apiToast = function () {
  299. // this.create();
  300. };
  301. var isShow = false;
  302. apiToast.prototype = {
  303. create: function (params, callback) {
  304. var self = this;
  305. var toastHtml = '';
  306. switch (params.type) {
  307. case "success":
  308. var iconHtml = '<i class="aui-iconfont aui-icon-correct"></i>';
  309. break;
  310. case "fail":
  311. var iconHtml = '<i class="aui-iconfont aui-icon-close"></i>';
  312. break;
  313. case "custom":
  314. var iconHtml = params.html;
  315. break;
  316. case "loading":
  317. var iconHtml = '<div class="api-toast-loading"></div>';
  318. break;
  319. }
  320. var titleHtml = params.title ? '<div class="api-toast-content">' + params.title + '</div>' : '';
  321. toastHtml = `<div class="api-toast">${iconHtml + titleHtml}</div>`
  322. if (document.querySelector(".api-toast")) return;
  323. document.body.insertAdjacentHTML('beforeend', toastHtml);
  324. var duration = params.duration ? params.duration : "2000";
  325. self.show();
  326. if (params.type == 'loading') {
  327. if (callback) {
  328. callback({
  329. status: "success"
  330. });
  331. };
  332. } else {
  333. setTimeout(function () {
  334. self.hide();
  335. }, duration)
  336. }
  337. },
  338. show: function () {
  339. var self = this;
  340. document.querySelector(".api-toast").style.display = "block";
  341. document.querySelector(".api-toast").style.marginTop = "-" + Math.round(document.querySelector(".api-toast").offsetHeight / 2) + "px";
  342. if (document.querySelector(".api-toast")) return;
  343. },
  344. hide: function () {
  345. var self = this;
  346. if (document.querySelector(".api-toast")) {
  347. document.querySelector(".api-toast").parentNode.removeChild(document.querySelector(".api-toast"));
  348. }
  349. },
  350. remove: function () {
  351. if (document.querySelector(".api-dialog")) document.querySelector(".api-dialog").parentNode.removeChild(document.querySelector(".api-dialog"));
  352. if (document.querySelector(".api-mask")) {
  353. document.querySelector(".api-mask").classList.remove("api-mask-out");
  354. }
  355. return true;
  356. },
  357. success: function (params, callback) {
  358. var self = this;
  359. params.type = "success";
  360. return self.create(params, callback);
  361. },
  362. fail: function (params, callback) {
  363. var self = this;
  364. params.type = "fail";
  365. return self.create(params, callback);
  366. },
  367. custom: function (params, callback) {
  368. var self = this;
  369. params.type = "custom";
  370. return self.create(params, callback);
  371. },
  372. loading: function (params, callback) {
  373. var self = this;
  374. params.type = "loading";
  375. return self.create(params, callback);
  376. }
  377. };
  378. window.apiToast = apiToast;
  379. })(window);
  380. /**
  381. *
  382. */
  383. /**
  384. * ajax 封装
  385. */
  386. (function (window) {
  387. /**
  388. ** 不带加载效果
  389. ** Promise 形式的ajax
  390. **/
  391. var h = {};
  392. h.requestData = (url, method, values) => {
  393. return new Promise((resolve, reject) => {
  394. var info = $api.getStorage('data'),
  395. token = JSON.parse(info).data.access_token || "";
  396. var headers = {
  397. "Authorization": "Bearer " + token
  398. };
  399. var tAjax = {
  400. url,
  401. method,
  402. headers,
  403. dataType: 'json',
  404. data: {
  405. values
  406. },
  407. timeout: 30
  408. };
  409. api.ajax(tAjax, function (ret, err) {
  410. if (ret) {
  411. resolve(ret)
  412. } else {
  413. reject(err)
  414. }
  415. });
  416. })
  417. };
  418. /**
  419. ** 带加载效果
  420. ** Promise 形式的ajax
  421. **/
  422. h.requestDataLoging = (url, method, values) => {
  423. var toast = new auiToast();
  424. toast.loading({
  425. title: "加载中",
  426. duration: 2000
  427. });
  428. return new Promise((resolve, reject) => {
  429. var info = $api.getStorage('data'),
  430. token = JSON.parse(info).data.access_token || "";
  431. var headers = {
  432. "Authorization": "Bearer " + token
  433. };
  434. var tAjax = {
  435. url,
  436. method,
  437. headers,
  438. dataType: 'json',
  439. data: {
  440. values
  441. },
  442. timeout: 30
  443. };
  444. api.ajax(tAjax, function (ret, err) {
  445. if (ret) {
  446. resolve(ret)
  447. } else {
  448. reject(err)
  449. }
  450. toast.hide()
  451. });
  452. })
  453. };
  454. /**
  455. ** 带加载效果 (apicloud showProgress)
  456. ** Promise 形式的 ajax
  457. **/
  458. h.requestShowProgress = (url, method, values) => {
  459. api.showProgress({
  460. title: '加载中...',
  461. text: '',
  462. modal: true
  463. });
  464. return new Promise((resolve, reject) => {
  465. var info = $api.getStorage('data'),
  466. token = JSON.parse(info).data.access_token || "";
  467. var headers = {
  468. "Authorization": "Bearer " + token
  469. };
  470. var tAjax = {
  471. url,
  472. method,
  473. headers,
  474. dataType: 'json',
  475. data: {
  476. values
  477. },
  478. timeout: 30
  479. };
  480. api.ajax(tAjax, function (ret, err) {
  481. if (ret) {
  482. resolve(ret)
  483. } else {
  484. reject(err)
  485. }
  486. api.hideProgress()
  487. });
  488. })
  489. };
  490. /**
  491. ** 带加载效果
  492. ** Promise 形式的 文件上传ajax
  493. **/
  494. h.fileUploadRequest = (url, method, files) => {
  495. api.showProgress({
  496. title: '上传中...',
  497. text: '',
  498. modal: true
  499. });
  500. return new Promise((resolve, reject) => {
  501. var info = $api.getStorage('data'),
  502. token = JSON.parse(info).data.access_token || "";
  503. var headers = {
  504. "Authorization": "Bearer " + token
  505. };
  506. var tAjax = {
  507. url,
  508. method,
  509. headers,
  510. data: {
  511. files
  512. }
  513. };
  514. api.ajax(tAjax, function (ret, err) {
  515. if (ret) {
  516. resolve(ret)
  517. } else {
  518. reject(err)
  519. }
  520. api.hideProgress()
  521. });
  522. })
  523. };
  524. h.fnReuestData = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
  525. toast.loading({
  526. title: "加载中",
  527. duration: 2000
  528. });
  529. var tHeaders = pHeaders ? pHeaders : '';
  530. var tAjax = {
  531. url: pPartUrl,
  532. method: pMethod,
  533. headers: tHeaders,
  534. dataType: 'json',
  535. data: {
  536. values: pData
  537. },
  538. timeout: 30
  539. };
  540. api.ajax(tAjax, function (ret, err) {
  541. if ('function' === typeof pCallback) {
  542. pCallback(ret, err)
  543. }
  544. });
  545. };
  546. /**
  547. *不带低白加载效果
  548. **/
  549. h.fnReuestDataNoW = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
  550. apiToast.loading({
  551. title: "加载中",
  552. duration: 2000
  553. });
  554. var tHeaders = pHeaders ? pHeaders : '';
  555. var tAjax = {
  556. url: pPartUrl,
  557. method: pMethod,
  558. headers: tHeaders,
  559. dataType: 'json',
  560. data: {
  561. values: pData
  562. },
  563. timeout: 30
  564. };
  565. api.ajax(tAjax, function (ret, err) {
  566. if ('function' === typeof pCallback) {
  567. pCallback(ret, err)
  568. }
  569. });
  570. };
  571. /**
  572. ** 不带加载效果的ajax
  573. **/
  574. h.fnReuestDataNologing = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
  575. var tHeaders = pHeaders ? pHeaders : '';
  576. var tAjax = {
  577. url: pPartUrl,
  578. method: pMethod,
  579. headers: tHeaders,
  580. dataType: 'json',
  581. data: {
  582. values: pData
  583. },
  584. timeout: 30
  585. };
  586. api.ajax(tAjax, function (ret, err) {
  587. if ('function' === typeof pCallback) {
  588. pCallback(ret, err)
  589. }
  590. });
  591. };
  592. /**
  593. ** 加载效果的ajax
  594. ** 传JSON数据格式
  595. **/
  596. h.fnReuestDataJSON = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
  597. toast.loading({
  598. title: "加载中",
  599. duration: 2000
  600. });
  601. var tHeaders = pHeaders ? pHeaders : '';
  602. var tAjax = {
  603. url: pPartUrl,
  604. method: pMethod,
  605. contentType: 'application/json',
  606. headers: tHeaders,
  607. dataType: 'json',
  608. data: {
  609. values: pData
  610. },
  611. timeout: 30
  612. };
  613. api.ajax(tAjax, function (ret, err) {
  614. if ('function' === typeof pCallback) {
  615. pCallback(ret, err)
  616. }
  617. });
  618. };
  619. /**
  620. ** 不带加载效果的ajax
  621. ** 传JSON数据格式
  622. **/
  623. window.$http = h;
  624. }(window));
  625. /**
  626. * 常用方法
  627. */
  628. (function (window) {
  629. var e = {};
  630. /**
  631. * 封装消息发送时间
  632. */
  633. e.sendEvent = function (name, extra) {
  634. api.sendEvent({
  635. name: name,
  636. extra: extra
  637. });
  638. };
  639. /**
  640. * 消息监听事件
  641. */
  642. e.addEventListener = function (name, callback) {
  643. api.addEventListener({
  644. name: name
  645. }, function (ret, err) {
  646. callback(ret)
  647. });
  648. };
  649. /**
  650. *  滑动底部监听事件
  651. */
  652. e.scrollBottomListener = function (callback, threshold) {
  653. api.addEventListener({
  654. name: 'scrolltobottom',
  655. extra: {
  656. threshold: threshold || 0
  657. }
  658. }, function (ret, err) {
  659. callback(ret)
  660. });
  661. };
  662. /**
  663. * frame
  664. *
  665. */
  666. e.openFrame = function (name, headers, footer, pageParam, otherParam) {
  667. var headerH = headers ? $api.dom(headers).offsetHeight : 0;
  668. var footetH = footer ? $api.dom(footer).offsetHeight : 0;
  669. api.openFrame({
  670. name: name,
  671. url: name + '.html',
  672. bounces: true,
  673. scrollEnabled: false,
  674. hScrollBarEnabled: false,
  675. progress: {
  676. type: 'page'
  677. },
  678. animation: {
  679. type: 'fade'
  680. },
  681. rect: {
  682. x: 0,
  683. y: headerH,
  684. w: 'auto',
  685. h: 'auto'
  686. },
  687. pageParam: api.pageParam || {}
  688. });
  689. };
  690. /**
  691. *禁止页面弹动
  692. *
  693. **/
  694. e.openFrameBounces = function (name, headers, footer, pageParam, otherParam) {
  695. var headerH = headers ? $api.dom(headers).offsetHeight : 0;
  696. var footetH = footer ? $api.dom(footer).offsetHeight : 0;
  697. api.openFrame({
  698. name: name,
  699. url: name + '.html',
  700. bounces: false,
  701. scrollEnabled: false,
  702. hScrollBarEnabled: false,
  703. progress: {
  704. type: 'page'
  705. },
  706. animation: {
  707. type: 'fade'
  708. },
  709. rect: {
  710. x: 0,
  711. y: headerH,
  712. w: 'auto',
  713. h: 'auto'
  714. },
  715. pageParam: api.pageParam || {}
  716. });
  717. };
  718. /**
  719. *打开弹出框
  720. *
  721. **/
  722. e.openPopup = function (w, h, name, pageParam) {
  723. api.openFrame({
  724. name: name,
  725. url: name + '.html',
  726. bgColor: 'rgba(0,0,0,.6)',
  727. bounces: false,
  728. rect: {
  729. x: 0,
  730. y: 0,
  731. w: w,
  732. h: h
  733. },
  734. animation: {
  735. type: 'fade'
  736. },
  737. pageParam: pageParam
  738. });
  739. }
  740. /**
  741. * Win
  742. *
  743. */
  744. e.openWin = function (winName, winUrl, pageParam, otherParam) {
  745. var param = {
  746. name: winName,
  747. url: winUrl + '.html',
  748. scrollEnabled: false,
  749. hScrollBarEnabled: false,
  750. pageParam: pageParam,
  751. animation: {
  752. type: 'fade',
  753. duration: 450
  754. }
  755. }
  756. Object.assign(param, otherParam || {});
  757. api.openWin(param)
  758. }
  759. /**
  760. ** openTabLayout
  761. **/
  762. e.openTabLayout = function (name, url, title, value) {
  763. var param = {
  764. name: name,
  765. url: url + '.html',
  766. bgColor: 'rgba(0,159,232,1)',
  767. title: title,
  768. bounces: false,
  769. navigationBar: {
  770. height: '51',
  771. background: '#009fe8',
  772. color: '#fff',
  773. shadow: 'transparent'
  774. },
  775. pageParam: value
  776. }
  777. api.openTabLayout(param);
  778. }
  779. /**
  780. ** 提示框无网络
  781. **/
  782. e.tips = function (el, text) {
  783. var str = `<div id="tips">
  784. <p>
  785. <i></i>
  786. ${text}
  787. </p>
  788. </div>`;
  789. $api.append($api.dom(el), str);
  790. }
  791. e.removeTips = function (el) {
  792. $api.remove($api.byId(el));
  793. }
  794. /***
  795. 没有内容提示页面
  796. el = body
  797. Image显示图片路径
  798. ***/
  799. e.NotContent = function (el, elID, Image) {
  800. var html = `<div class="noText" id="${elID}">
  801. <img src="${Image}" alt="">
  802. </div>`;
  803. $api.append($api.dom(el), html);
  804. }
  805. /**
  806. *删除NotContent
  807. **/
  808. e.deletNotContent = function (elID) {
  809. $api.remove($api.byId(elID));
  810. }
  811. window.$event = e;
  812. }(window));
  813. /**
  814. * 工具类
  815. * */
  816. (function (window) {
  817. var d = {};
  818. /**
  819. * append
  820. * doT模版的封装
  821. * root DOM名称如ID 或class
  822. * doT template 名称
  823. * data ajax返回数据
  824. */
  825. d.append = function (root, template, data) {
  826. var evalText = doT.compile($api.html($api.dom(template)))
  827. if (typeof root == 'string') {
  828. $api.append($api.dom(root), evalText(data))
  829. } else {
  830. $api.append(root, evalText(data))
  831. }
  832. };
  833. /**
  834. * html
  835. * doT模版的封装
  836. * root DOM名称如ID 或class
  837. * doT template 名称
  838. * data ajax返回数据
  839. */
  840. d.html = function (root, template, data) {
  841. var evalText = doT.compile($api.html($api.dom(template)))
  842. if (typeof root == 'string') {
  843. $api.html($api.dom(root), evalText(data))
  844. } else {
  845. $api.html(root, evalText(data))
  846. }
  847. };
  848. /**
  849. * after
  850. * doT模版的封装
  851. * root DOM名称如ID 或class
  852. * doT template 名称
  853. * data ajax返回数据
  854. */
  855. d.after = function (root, template, data) {
  856. var evalText = doT.compile($api.html($api.dom(template)))
  857. if (typeof root == 'string') {
  858. $api.after($api.dom(root), evalText(data))
  859. } else {
  860. $api.after(root, evalText(data))
  861. }
  862. };
  863. /**
  864. ** 缓存路径 cache:协议对应的真实目录
  865. **/
  866. d.CACHE_DIR = function (url) {
  867. return api.cacheDir + '/' + url + '/' + api.frameName + '.json';
  868. }
  869. /**
  870. ** 缓存路径 box://协议对应的真实目录
  871. **/
  872. d.BOX_DIR = function () {
  873. return api.cacheDir + '/' + url + '/' + api.frameName + '.json';
  874. }
  875. /**
  876. **把数据也入文件做数据缓存处理
  877. **/
  878. d.writeFile = function (url, data) {
  879. api.writeFile({
  880. path: url,
  881. data: JSON.stringify(data)
  882. })
  883. };
  884. /**
  885. **读取文件中缓存的数据
  886. **/
  887. d.readFile = function (url, callback) {
  888. api.readFile({
  889. path: url
  890. }, function (ret, err) {
  891. callback(ret, err)
  892. });
  893. };
  894. /**轮播**/
  895. d.swiper = function (el, loops, type) {
  896. mySwiper = new Swiper(el, {
  897. pagination: {
  898. el: '.swiper-pagination',
  899. type: type,
  900. },
  901. loop: false,
  902. observer: true,
  903. observeSlideChildren: true,
  904. speed: 600,
  905. autoplay: {
  906. delay: 3000,
  907. disableOnInteraction: false,
  908. },
  909. on: {
  910. slideChangeTransitionEnd: function (e) {
  911. api.setFrameAttr({ bounces: true })
  912. },
  913. sliderMove: function (event) {
  914. api.setFrameAttr({ bounces: false })
  915. },
  916. touchEnd: function (event) {
  917. api.setFrameAttr({ bounces: true })
  918. }
  919. },
  920. });
  921. };
  922. /**
  923. ** Loading
  924. ** frameName frame名字
  925. ** mask 遮罩层 样式
  926. **/
  927. d.UILoading = function (frameName, mask) {
  928. var UILoading = api.require('UILoading');
  929. UILoading.flower({
  930. center: {
  931. x: api.winWidth / 2.0,
  932. y: api.winHeight / 2.0
  933. },
  934. size: 30,
  935. fixed: true,
  936. mask: mask == "" ? 'rgba(255,255,255,0' : mask,
  937. fixedOn: frameName
  938. }, function (ret) {
  939. loadingId = ret.id
  940. });
  941. };
  942. /**
  943. ** Loading
  944. ** 关闭Loading
  945. **
  946. **/
  947. d.CloseUILoading = function () {
  948. var uiloading = api.require('UILoading');
  949. uiloading.closeFlower({
  950. id: loadingId
  951. });
  952. };
  953. /**
  954. **
  955. ** 根据不同的数据来源 对应不用的pageId id等信息
  956. **
  957. **/
  958. d.differentPageParams = function (id, createDate, pageId) {
  959. let pageParams = {
  960. id: id,
  961. createDate: createDate,
  962. pageId: pageId
  963. }
  964. return pageParams
  965. }
  966. window.$apis = d
  967. }(window));
  968. /**
  969. * 面板
  970. *
  971. */
  972. (function (window, undefined) {
  973. "use strict";
  974. var auiCollapse = function (params) {
  975. this.init(params);
  976. };
  977. auiCollapse.prototype = {
  978. init: function (params, callback) {
  979. var collapseHeader = document.querySelectorAll(".aui-collapse-header");
  980. if (collapseHeader.length) {
  981. for (var i = 0; i < collapseHeader.length; i++) {
  982. (function (e) {
  983. collapseHeader[e].onclick = function () {
  984. if (collapseHeader[e].nextSibling.nextElementSibling.className.indexOf("aui-collapse-content") > -1) {
  985. if (collapseHeader[e].nextSibling.nextElementSibling.className.indexOf("aui-show") > -1) {
  986. collapseHeader[e].nextSibling.nextElementSibling.classList.remove("aui-show");
  987. collapseHeader[e].classList.remove("aui-active");
  988. } else {
  989. if (params.autoHide) {
  990. if (document.querySelector(".aui-collapse-header.aui-active")) {
  991. document.querySelector(".aui-collapse-header.aui-active").classList.remove("aui-active");
  992. }
  993. if (document.querySelector(".aui-collapse-content.aui-show")) {
  994. document.querySelector(".aui-collapse-content.aui-show").classList.remove("aui-show");
  995. }
  996. }
  997. collapseHeader[e].nextSibling.nextElementSibling.classList.toggle("aui-show");
  998. collapseHeader[e].classList.toggle("aui-active");
  999. }
  1000. }
  1001. }
  1002. })(i)
  1003. }
  1004. }
  1005. }
  1006. };
  1007. window.auiCollapse = auiCollapse;
  1008. })(window);
  1009. /**
  1010. *获取当前时间年月日 周 时 分 秒
  1011. *
  1012. **/
  1013. function getNowFormatDate() {
  1014. var now = new Date();
  1015. var year = now.getFullYear(); //获取年份
  1016. var month = now.getMonth(); //获取月份
  1017. var date = now.getDate(); //获取日期
  1018. var day = now.getDay(); //获取星期
  1019. var hour = now.getHours(); //获取小时
  1020. var minute = now.getMinutes(); //获取分钟
  1021. var seconds = now.getSeconds() < 10 ? '0' + now.getSeconds() : now.getSeconds(); //获取秒
  1022. month = month + 1;
  1023. var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
  1024. var week = arr_week[day];
  1025. var time = year + "年" + month + "月" + date + "日 " + week + " " + hour + ":" + minute + ":" + seconds;
  1026. return time;
  1027. }
  1028. /**
  1029. *获取当前时间年月日
  1030. *
  1031. **/
  1032. function getYearMonthDate() {
  1033. var now = new Date();
  1034. var year = now.getFullYear(); //获取年份
  1035. var month = now.getMonth(); //获取月份
  1036. var date = now.getDate(); //获取日期
  1037. var hour = now.getHours(); //获取小时
  1038. var minute = now.getMinutes(); //获取分钟
  1039. month = month + 1;
  1040. month = month < 10 ? '0' + month : month
  1041. date = date < 10 ? '0' + date : date
  1042. var time = year + "-" + month + "-" + date
  1043. return time;
  1044. }
  1045. /**
  1046. *获取当前时间YYYY-MM-dd hh:mm
  1047. *
  1048. **/
  1049. function getYearMonthDateTime() {
  1050. var now = new Date();
  1051. var year = now.getFullYear(); //获取年份
  1052. var month = now.getMonth(); //获取月份
  1053. var date = now.getDate(); //获取日期
  1054. var hour = now.getHours(); //获取小时
  1055. var minute = now.getMinutes(); //获取分钟
  1056. month = month + 1;
  1057. month = month < 10 ? '0' + month : month
  1058. date = date < 10 ? '0' + date : date
  1059. hour = hour < 10 ? '0' + hour : hour
  1060. minute = minute < 10 ? '0' + minute : minute
  1061. var time = year + "-" + month + "-" + date + " " + hour + ":" + minute
  1062. return time;
  1063. }
  1064. // 把时间戳转为日期或者时间
  1065. function formatDateTime(inputTime) {
  1066. let date = new Date(inputTime);
  1067. let y = date.getFullYear();
  1068. let m = date.getMonth() + 1;
  1069. m = m < 10 ? ('0' + m) : m;
  1070. let d = date.getDate();
  1071. d = d < 10 ? ('0' + d) : d;
  1072. let h = date.getHours();
  1073. h = h < 10 ? ('0' + h) : h;
  1074. let minute = date.getMinutes();
  1075. let second = date.getSeconds();
  1076. minute = minute < 10 ? ('0' + minute) : minute;
  1077. second = second < 10 ? ('0' + second) : second;
  1078. return y + '-' + m + '-' + d;
  1079. }
  1080. // 计算时间天数差
  1081. function datedifference(sDate2) {
  1082. var date = new Date();
  1083. var year = date.getFullYear() - 1
  1084. var month = date.getMonth() + 1
  1085. var d = date.getDate()
  1086. var dateSpan,
  1087. tempDate,
  1088. iDays;
  1089. sDate1 = Date.parse(year + "-" + month + "-" + d);
  1090. dateSpan = sDate2 - sDate1;
  1091. dateSpan = Math.abs(dateSpan);
  1092. iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
  1093. return iDays
  1094. };
  1095. /**
  1096. *消除300ms延迟
  1097. ***/
  1098. !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 }();
  1099. /**
  1100. * fastclick 消除点击时间
  1101. */
  1102. if ('addEventListener' in document) {
  1103. document.addEventListener('DOMContentLoaded', function () {
  1104. FastClick.attach(document.body);
  1105. }, false)
  1106. };
  1107. // 数组删除元素
  1108. Array.prototype.remove = function (val) {
  1109. var index = this.indexOf(val);
  1110. if (index > -1) {
  1111. this.splice(index, 1);
  1112. }
  1113. };