12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130 |
- // 定义服务器端域名
- var javaApi = '/api/swagger/';
- // var mineName = '麦垛山煤矿';
- var mineName = '羊场湾煤矿';
- // var mineName = 'E信管理';
- var ossImgName = '羊场湾煤矿';
- // 视频类型
- var videoType = 2
- // 枣泉
- var URLjava = 'http://yangchangwan.nxjiewei.com:8011' + javaApi;
- var urlphp = 'http://yangchangwan.nxjiewei.com:8011/';
- var cloudUrl = 'http://wpan.nxjiewei.com:8012/';
- // var URLjava = 'http://colliery.nxjiewei.com'+javaApi;
- // var urlphp = 'http://colliery.nxjiewei.com/';
- // 工单上传图片和文件地址
- var ceshiUrl = 'http://47.105.143.227:8083/';//测试地址java
- // 设备物资,固定电缆
- // var urlJavaOld = 'http://nxjiewei.com/colliery-system/api/page/v1/eqByNameList.html'
- // var URLjava = 'http://apptest.jieweizhineng.com'+javaApi;
- // 麦陀山
- // var URLjava = 'http://maiduoshan.nxjiewei.com'+javaApi;
- // var urlphp = 'http://maiduoshan.nxjiewei.com/';
- // 宁东运营部
- // var URLjava = 'http://ningdongyunying.nxjiewei.com'+javaApi;
- // var urlphp = 'http://ningdongyunying.nxjiewei.com/';
- var pageIdConfig = {
- suggestionFeedback: '7e4aeb35f5d54815ad7e5069c279bb9f', // 建议反馈
- updateLog: 'f77e273c6cb542fdb6afa61c78f5fc95', // 更新日志
- userManual: 'e802728b889b42fb9bb405cacc7ae04c' // 使用手册
- }
- var UrlRouter = {
- loginApi: urlphp + 'api/oauth/token',//登录
- vcodeApi: urlphp + 'api/sms/vcode',//发送验证吗
- setApi: urlphp + 'api/user/mobile/set',//绑定手机号
- uploadFile: URLjava + 'api/common/v1/uploadFile',//上传
- addFile: URLjava + 'api/page/v1/addFile', //上传 PPT EXCEL等文件
- addPicture: URLjava + 'api/page/v1/addPicture',//上传图集
- addLinks: URLjava+ 'api/page/v1/addLinks', //上传链接
- repasswordApi: urlphp + 'api/user/repassword',//修改密码
- bannerApi: urlphp + 'api/scrollImg/list',//banner
- nwesApi: urlphp + 'api/article/list',//新闻
- NoticeApi: urlphp + 'api/notice/list',//公告
- ImgApi: urlphp + 'api/homeNav/list',//图片导航
- DistrictteamApi: urlphp + 'api/home/links',//区队
- userInfoApi: urlphp + 'api/user/info',//个人信息
- findMessageApi: URLjava + 'api/dynamic/v1/findMessage/',//消息列表 二维码 、 巡检记录
- getPageRecordInstaneClosedLoop: URLjava + 'api/record/v1/getPageRecordInstaneClosedLoop',// 查询二维码巡检的闭环列表
- getPageRecordInstanCreateBy: URLjava + 'api/record/v1/getPageRecordInstanCreateBy',// 我的记录列表
- getChangMessageDepartmentIdList: URLjava + 'api/dynamic/v1/changMessageDepartmentIdList', // 二维码已读
- getPageAndRecordDynamic: URLjava + "api/dynamic/v1/getPageAndRecordDynamic",//二维码和记录合并
- getPageDynamicApi: URLjava + 'api/dynamic/v1/getPageDynamic',//获取二维码列表
- getRecordDynamicApi: URLjava + 'api/dynamic/v1/getRecordDynamic',//获取巡检列表
- addPageDynamicApi: URLjava + 'api/dynamic/v1/addPageDynamic',//已读二维码
- addRecordDynamicApi: URLjava + 'api/dynamic/v1/addRecordDynamic',//已读巡检记录
- getPageRecordInstaneClosedLoop: URLjava + 'api/record/v1/getPageRecordInstaneClosedLoop',// 查询二维码巡检的闭环列表
- regionApi: urlphp + 'api/monitor/video/region',//监控列表权限
- // cameraApi:urlphp+'api/monitor/video/camera',//监控子项
- selectRootRequest: URLjava + 'api/resource/v1/selectRootRequest',//视频区域列表
- selectResourceList: URLjava + 'api/resource/v1/selectResourceList',//视频播放列表
- selectResourcePreviewURLs: URLjava + 'api/resource/v1/selectResourcePreviewURLs',//视频播放URl
- findMessageCount: URLjava + 'api/dynamic/v1/findMessageCount/',
- seachQrcode: URLjava + 'api/page/v1/getPageList',//查询二维码
- getDeviceValueTypeCode: ceshiUrl + 'api/device/v1/getDeviceValueTypeCode/',//查询传感器的数值信息
- getData: ceshiUrl + 'api/data/v1/getData',//实时数据查询
- getDeviceInfo: urlphp + 'api/safety/search',//查询传感器信息
- searchData: ceshiUrl + 'api/data/v1/searchData',//查询传感器实时数据详情
- securityJurisdiction: urlphp + 'api/detection/show',//安全监测权限
- getSafetyTotal: urlphp + 'api/safety/total',//704 安全监测
- getSafetyList: urlphp + 'api/safety/220704',//安全监测 列表
- getPersonalInfo: urlphp + 'api/personnel/people/now',//704人员定位
- getPersonalMap: urlphp + 'api/personnel/people/220704',//704人员定位详情
- getSafetyStatusList: urlphp + 'api/safety/220704/list',//704安全数据详情
- // 工单模块
- getGroupList: urlphp + "api/section/getGroupList",//获取部门列表
- getPersonalList: urlphp + 'api/user/list',//获取部门人员
- getList: urlphp + 'api/section/getlist',//部门列表接口
- getAlllist: urlphp + 'api/section/getalllist',//部门列表接口1
- searchPersonal: urlphp + 'api/user/search',//搜索人员
- wordOrderList: urlphp + 'api/worksheet/classify/list',//工单分类
- applyList: urlphp + 'api/worksheet/design/list',//可申请工单列表
- getApplyList: urlphp + 'api/worksheet/apply/list',// 自己审请的工单列表
- getApplyD: urlphp + 'api/worksheet/design/',//获取可申请工单详情
- submitApply: urlphp + 'api/worksheet/apply',//提交工单信息
- submitApplyDe: urlphp + 'api/worksheet/apply/',//提交工单详情
- getExamine: urlphp + 'api/worksheet/check/list',//待审核工单
- getExamineDe: urlphp + 'api/worksheet/check/', //待审核工单详情
- getAlreadyDe: urlphp + 'api/worksheet/checked/', //待审核工单详情
- submitAdopt: urlphp + 'api/worksheet/check/',//通过审核
- getAlreadyExamine: urlphp + 'api/worksheet/checked/list',//已审核
- getAll_list: urlphp + 'api/worksheet/design/all_list',//所有工单设计列表
- fill_order: urlphp + 'api/worksheet/fill_order/', //工单信息补充
- up_images: urlphp + 'api/worksheet/design/up_images', // 图片上传
- getNewsList: urlphp + 'api/message/list',//消息列表
- getRead: urlphp + 'api/message/read',//已读消息
- getNewsNum: urlphp + 'api/message/unread_num',//消息总数
- thumbs: urlphp + 'api/user/like/post',//点赞or取消点赞
- comment: urlphp + 'api/user/comment/post',//提交留言
- delComment: urlphp + 'api/user/comment/del',//删除留言
- simulationTotal: urlphp + 'api/safety/simulation/total',//模拟量统计
- sluicetTotal: urlphp + 'api/safety/sluice/total',//开关量统计
- safetyDetaile: urlphp + 'api/safety/info/total',//安全数据详情
- downWellTotal: urlphp + 'api/personnel/month/total',//一周下井趋势
- currentPersonalNum: urlphp + 'api/personnel/now',//一周下井趋势当前人数
- getBanNowDayTotal: URLjava + 'api/pdcban/v1/getBanNowDayTotal',//今日产量
- getBanDayList: URLjava + '/api/pdcban/v1/getBanDayList',//一周的产量
- getMonthSumByYear: URLjava + 'api/pdcban/v1/getMonthSumByYear',//一年的产量
- getBulletin: urlphp + 'api/dispatch/bulletin',//生产数据公告
- getSchedule: urlphp + 'api/dispatch/schedule',//调度统计
- getAlarmData: urlphp + 'api/safety/alarm',//报警分类
- getGasData: urlphp + 'api/safety/methane',//瓦斯异常情况
- getChangMessageList: URLjava + 'api/dynamic/v1/changMessageList/',//二维码和记录置为已读
- chartsJurisdiction: urlphp + 'api/dispatch/show',//图表权限
- personalLocation: urlphp + 'api/personnel/show',//人员定位权限
- getPersonnalList: urlphp + 'api/personnel/region/total',//人员定位列表
- getPersonnalDistributionList: urlphp + 'api/personnel/mine/total',//每个矿井人数统计
- getPersonnalDe: urlphp + 'api/personnel/mine/people',//人员详情
- searchPeople: urlphp + 'api/personnel/people/search',//查询人员定位
- peopleInfo: urlphp + 'api/personnel/people/info',//个人详情
- getDayHourTotal: URLjava + 'api/pdcban/v1/getDayHourTotal',//皮带称产量
- getPeopleNow: urlphp + 'api/personnel/people/now',//当前下井人数
- getOfficeTotal: urlphp + 'api/personnel/office/total',//井下人员(部门分布)
- getBasicTotal: urlphp + 'api/personnel/basic/total',//基层区队
- getWorkingTotal: urlphp + 'api/personnel/working/total',//工作面人数统计
- getDepartToday: urlphp + 'api/personnel/depart/today',//各部门人数统计
- getFacilityStatus: urlphp + 'api/personnel/facility/status',//人员定位系统设备运行状态
- getTimeout: urlphp + 'api/personnel/timeout/total',//人员超时统计
- getHelptotal: urlphp + 'api/personnel/help/total',//人员求救统计
- getPersonnelTimeoutDetails: urlphp + 'api/personnel/timeout/info',//人员超时统计详情
- getPersonnelHelpDetails: urlphp + 'api/personnel/help/info',//人员求救统计详情
- getPersonnelFacilityDetails: urlphp + 'api/personnel/facility/info',//人员求救统计详情
- getPersonnelWorkingDetails: urlphp + 'api/personnel/working/info',//工作面人员详情
- getPersonneldepartDetails: urlphp + 'api/personnel/depart/people',//井下部门分布列表
- getPersonneltodayDetails: urlphp + 'api/personnel/depart/people/today',//井下部门分布列表
- getBanDayThree: URLjava + 'api/pdcban/v1/getBanDayThree',//一周的产量列表
- getBanNowDayAllTotal: URLjava + 'api/pdcban/v1/getBanNowDayAllTotal',//今日产量
- getEfficacyCut: urlphp + 'api/dispatch/efficacy/cut',//割煤刀数
- getEfficacyCutMerge: urlphp + 'api/dispatch/efficacy/cut/merge',//割煤刀数和图表合并
- efficacyShow: urlphp + 'api/efficacy/show',//效能管控
- getEfficacyInfo: urlphp + 'api/dispatch/efficacy/cut/info',//割煤刀数工作面列表
- getFanStatus: urlphp + 'api/blower/status/now',//风机状态
- getFanData: urlphp + 'api/blower/chart/hour',//风量趋势
- getFanDatas: urlphp + 'api/blower/param/now',// 风量数据
- getGdWsclDataNewList: URLjava + 'api/gdwscldata/v1/getGdWsclDataNewList',//矿井水处理
- // getSelectWebSocketRequest:URLjava+'api/websocket/v1/selectWebSocketRequest',//采煤机
- getSelectWebSocketRequest: urlphp + '220704.php',//704 数据
- working220704: urlphp + 'api/working220704/show',//704权限
- getQrcodeDe: URLjava + 'api/page/v1/detailPage',//二维码详情
- addPageUser: URLjava + 'api/pageuser/v1/addPageUser',//添加浏览记录
- getPageUserByPageId: URLjava + 'api/pageuser/v1/getPageUserByPageId/',//获取浏览记录
- getPageRecordInstanceList: URLjava + 'api/record/v1/getPageRecordInstanceList',//记录列表
- selectRecordByGetPageId: URLjava + 'api/page/v1/selectRecordByGetPageId/',// 查询记录模版名称
- getInspection: URLjava + 'api/record/v1/getInspection',//记录模版内容
- addRecordInstance: URLjava + 'api/record/v1/addRecordInstance',//添加记录
- getRecordInstanceDetailList: URLjava + 'api/record/v1/getRecordInstanceDetailList',//记录详情
- addRecordUser: URLjava + 'api/recodeuser/v1/addRecordUser',//添加记录浏览人数
- getRecordUserById: URLjava + 'api/recodeuser/v1/getRecordUserById/',//获取记录浏览人数
- getSearchPageRecordInstance: URLjava + 'api/record/v1/searchPageRecordInstance/',//二维码统计标示
- getPageRecordInstanceListRadio: URLjava + 'api/record/v1/getPageRecordInstanceListRadio',//记录项统计 单选
- getRecordInstanceDetailListMobileExcel: URLjava + 'api/record/v1/getRecordInstanceDetailListMobileExcel',//记录导出
- selectPageStatusPercet: URLjava + 'api/record/v1/selectPageStatusPercet',//查询状态的比例
- selectPageRecodePercet: URLjava + 'api/record/v1/selectPageRecodePercet/',//查询记录项的比例
- getInvoice: urlphp + 'api/workbench/invoice/info',//发票
- getMymonth: urlphp + 'api/notice/my_list/month',//值班月份-个人
- getDutyMylist: urlphp + 'api/notice/my_list/list',//个人值班
- getAllmonth: urlphp + 'api/notice/all_list/month',//值班月份-所有人
- getDutyAlllist: urlphp + 'api/notice/all_list/list',//所有人值班
- getPassword: urlphp + 'api/workbench/salary/password',//工资权限验证
- getWagesDe: urlphp + 'api/workbench/salary/my_info',//工资详情
- getWagesChart: urlphp + 'api/workbench/salary/chart',//工资图表
- getAlllist: urlphp + 'api/section/getalllist',//部门列表接口1
- // 胶轮车
- rubberTyredCarList: urlphp + 'api/car/list', // 胶轮车列表
- rubberTyredcarDetails: urlphp + 'api/car/tra', // 车辆轨迹
- signalLampMsg: urlphp + 'api/car/signalNew',
- transparentShow: urlphp + '/api/transport/show', // 交通车权限
- getWorkbenchList: urlphp + 'api/workbench/index', // 工作台
- getPagebyNOAndName: URLjava + 'api/page/v1/getPagebyNOAndName',
- handleUpLoadSignature: urlphp + 'api/user/sign/upload', // 用户签名图片上传
- // 用户进 出浏览时间
- getAddPageUserTime: URLjava + 'api/pageusertime/v1/addPageUserTime', // 用户浏览信息开始
- getMonthlist: urlphp + 'api/personnel/downwell/monthlist/once', // 下井月份列表接口
- getMonthOnce: urlphp + 'api/personnel/downwell/month/once', // 需下井次数 和已下井次数 以及完成度
- getMonthInfo: urlphp + 'api/personnel/downwell/month/info', // 当月下井详细信息列表
- getOnceInfo: urlphp + 'api/personnel/downwell/once/info', // 当次信息的详细信息
- // 云盘
- loginExtends:cloudUrl+'netdisk-web-perpc/security/loginExtends',// 登陆
- findList: cloudUrl+'netdisk-web-perpc/disk/file/findList', // 文件列表
- delete:cloudUrl+'netdisk-web-perpc/disk/filecommon/delete', //删除文件
- fileSearch:cloudUrl+'netdisk-web-perpc/disk/file/newSearch', // 查询文件
- addFolder:cloudUrl+'netdisk-web-perpc/disk/filecommon/addFolder', // 添加文件夹
- mergeFilesNew:cloudUrl+'netdisk-web-perpc/disk/filedownload/mergeFilesNew',
- download:cloudUrl+'netdisk-web-perpc/disk/filedownload/download?', // 下载文件
- rename:cloudUrl+'netdisk-web-perpc/disk/filecommon/rename', //重命名
- // 收藏二维码
- handleAddPageCollect: URLjava + 'api/pageCollect/v1/addPageCollect', //收藏二维码
- handleDelPageCollect: URLjava + 'api/pageCollect/v1/delPageCollect', // 取消收藏
- getSelectPageCollect: URLjava + 'api/pageCollect/v1/selectPageCollect', //收藏二维码列表
- getPageCollectByPageIdAndUserNo: URLjava + 'api/pageCollect/v1/getPageCollectByPageIdAndUserNo', //查看二维码是否收藏
- // 物资
- getMaterial: urlphp + 'api/materials/goods/list',// 物资列表
- getMaterialStorageList: urlphp + 'api/materials/storage/list',//物资仓库列表
- getMaterialClassifyList: urlphp + 'api/materials/classify/list',
- };
- var mySwiper;//插件
- var loadingId = "";
- /**
- * 加载动画
- *
- */
- (function (window, undefined) {
- "use strict";
- var auiToast = function () {
- // this.create();
- };
- var isShow = false;
- auiToast.prototype = {
- create: function (params, callback) {
- var self = this;
- var toastHtml = '';
- switch (params.type) {
- case "success":
- var iconHtml = '<i class="aui-iconfont aui-icon-correct"></i>';
- break;
- case "fail":
- var iconHtml = '<i class="aui-iconfont aui-icon-close"></i>';
- break;
- case "custom":
- var iconHtml = params.html;
- break;
- case "loading":
- var iconHtml = '<div class="aui-toast-loading"></div>';
- break;
- }
- var titleHtml = params.title ? '<div class="aui-toast-content">' + params.title + '</div>' : '';
- toastHtml = `<div class="api-toast">
- <div class="aui-toast">${iconHtml + titleHtml}</div>
- </div>`
- if (document.querySelector(".aui-toast")) return;
- document.body.insertAdjacentHTML('beforeend', toastHtml);
- var duration = params.duration ? params.duration : "2000";
- self.show();
- if (params.type == 'loading') {
- if (callback) {
- callback({
- status: "success"
- });
- };
- } else {
- setTimeout(function () {
- self.hide();
- }, duration)
- }
- },
- show: function () {
- var self = this;
- document.querySelector(".aui-toast").style.display = "block";
- document.querySelector(".aui-toast").style.marginTop = "-" + Math.round(document.querySelector(".aui-toast").offsetHeight / 2) + "px";
- if (document.querySelector(".aui-toast")) return;
- },
- hide: function () {
- var self = this;
- if (document.querySelector(".aui-toast")) {
- document.querySelector(".api-toast").remove()
- }
- },
- remove: function () {
- if (document.querySelector(".aui-dialog")) document.querySelector(".aui-dialog").parentNode.removeChild(document.querySelector(".aui-dialog"));
- if (document.querySelector(".aui-mask")) {
- document.querySelector(".aui-mask").classList.remove("aui-mask-out");
- }
- return true;
- },
- success: function (params, callback) {
- var self = this;
- params.type = "success";
- return self.create(params, callback);
- },
- fail: function (params, callback) {
- var self = this;
- params.type = "fail";
- return self.create(params, callback);
- },
- custom: function (params, callback) {
- var self = this;
- params.type = "custom";
- return self.create(params, callback);
- },
- loading: function (params, callback) {
- var self = this;
- params.type = "loading";
- return self.create(params, callback);
- }
- };
- window.auiToast = auiToast;
- })(window);
- (function (window, undefined) {
- "use strict";
- var apiToast = function () {
- // this.create();
- };
- var isShow = false;
- apiToast.prototype = {
- create: function (params, callback) {
- var self = this;
- var toastHtml = '';
- switch (params.type) {
- case "success":
- var iconHtml = '<i class="aui-iconfont aui-icon-correct"></i>';
- break;
- case "fail":
- var iconHtml = '<i class="aui-iconfont aui-icon-close"></i>';
- break;
- case "custom":
- var iconHtml = params.html;
- break;
- case "loading":
- var iconHtml = '<div class="api-toast-loading"></div>';
- break;
- }
- var titleHtml = params.title ? '<div class="api-toast-content">' + params.title + '</div>' : '';
- toastHtml = `<div class="api-toast">${iconHtml + titleHtml}</div>`
- if (document.querySelector(".api-toast")) return;
- document.body.insertAdjacentHTML('beforeend', toastHtml);
- var duration = params.duration ? params.duration : "2000";
- self.show();
- if (params.type == 'loading') {
- if (callback) {
- callback({
- status: "success"
- });
- };
- } else {
- setTimeout(function () {
- self.hide();
- }, duration)
- }
- },
- show: function () {
- var self = this;
- document.querySelector(".api-toast").style.display = "block";
- document.querySelector(".api-toast").style.marginTop = "-" + Math.round(document.querySelector(".api-toast").offsetHeight / 2) + "px";
- if (document.querySelector(".api-toast")) return;
- },
- hide: function () {
- var self = this;
- if (document.querySelector(".api-toast")) {
- document.querySelector(".api-toast").parentNode.removeChild(document.querySelector(".api-toast"));
- }
- },
- remove: function () {
- if (document.querySelector(".api-dialog")) document.querySelector(".api-dialog").parentNode.removeChild(document.querySelector(".api-dialog"));
- if (document.querySelector(".api-mask")) {
- document.querySelector(".api-mask").classList.remove("api-mask-out");
- }
- return true;
- },
- success: function (params, callback) {
- var self = this;
- params.type = "success";
- return self.create(params, callback);
- },
- fail: function (params, callback) {
- var self = this;
- params.type = "fail";
- return self.create(params, callback);
- },
- custom: function (params, callback) {
- var self = this;
- params.type = "custom";
- return self.create(params, callback);
- },
- loading: function (params, callback) {
- var self = this;
- params.type = "loading";
- return self.create(params, callback);
- }
- };
- window.apiToast = apiToast;
- })(window);
- /**
- *
- */
- /**
- * ajax 封装
- */
- (function (window) {
- /**
- ** 不带加载效果
- ** Promise 形式的ajax
- **/
- var h = {};
- h.requestData = (url, method, values) => {
- return new Promise((resolve, reject) => {
- var info = $api.getStorage('data'),
- token = JSON.parse(info).data.access_token || "";
- var headers = {
- "Authorization": "Bearer " + token
- };
- var tAjax = {
- url,
- method,
- headers,
- dataType: 'json',
- data: {
- values
- },
- timeout: 30
- };
- api.ajax(tAjax, function (ret, err) {
- if (ret) {
- resolve(ret)
- } else {
- reject(err)
- }
- });
- })
- };
- /**
- ** 带加载效果
- ** Promise 形式的ajax
- **/
- h.requestDataLoging = (url, method, values) => {
- var toast = new auiToast();
- toast.loading({
- title: "加载中",
- duration: 2000
- });
- return new Promise((resolve, reject) => {
- var info = $api.getStorage('data'),
- token = JSON.parse(info).data.access_token || "";
- var headers = {
- "Authorization": "Bearer " + token
- };
- var tAjax = {
- url,
- method,
- headers,
- dataType: 'json',
- data: {
- values
- },
- timeout: 30
- };
- api.ajax(tAjax, function (ret, err) {
- if (ret) {
- resolve(ret)
- } else {
- reject(err)
- }
- toast.hide()
- });
- })
- };
- /**
- ** 带加载效果 (apicloud showProgress)
- ** Promise 形式的 ajax
- **/
- h.requestShowProgress = (url, method, values) => {
- api.showProgress({
- title: '加载中...',
- text: '',
- modal: true
- });
- return new Promise((resolve, reject) => {
- var info = $api.getStorage('data'),
- token = JSON.parse(info).data.access_token || "";
- var headers = {
- "Authorization": "Bearer " + token
- };
- var tAjax = {
- url,
- method,
- headers,
- dataType: 'json',
- data: {
- values
- },
- timeout: 30
- };
- api.ajax(tAjax, function (ret, err) {
- if (ret) {
- resolve(ret)
- } else {
- reject(err)
- }
- api.hideProgress()
- });
- })
- };
- /**
- ** 带加载效果
- ** Promise 形式的 文件上传ajax
- **/
- h.fileUploadRequest = (url, method, files) => {
- api.showProgress({
- title: '上传中...',
- text: '',
- modal: true
- });
- return new Promise((resolve, reject) => {
- var info = $api.getStorage('data'),
- token = JSON.parse(info).data.access_token || "";
- var headers = {
- "Authorization": "Bearer " + token
- };
- var tAjax = {
- url,
- method,
- headers,
- data: {
- files
- }
- };
- api.ajax(tAjax, function (ret, err) {
- if (ret) {
- resolve(ret)
- } else {
- reject(err)
- }
- api.hideProgress()
- });
- })
- };
- h.fnReuestData = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
- toast.loading({
- title: "加载中",
- duration: 2000
- });
- var tHeaders = pHeaders ? pHeaders : '';
- var tAjax = {
- url: pPartUrl,
- method: pMethod,
- headers: tHeaders,
- dataType: 'json',
- data: {
- values: pData
- },
- timeout: 30
- };
- api.ajax(tAjax, function (ret, err) {
- if ('function' === typeof pCallback) {
- pCallback(ret, err)
- }
- });
- };
- /**
- *不带低白加载效果
- **/
- h.fnReuestDataNoW = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
- apiToast.loading({
- title: "加载中",
- duration: 2000
- });
- var tHeaders = pHeaders ? pHeaders : '';
- var tAjax = {
- url: pPartUrl,
- method: pMethod,
- headers: tHeaders,
- dataType: 'json',
- data: {
- values: pData
- },
- timeout: 30
- };
- api.ajax(tAjax, function (ret, err) {
- if ('function' === typeof pCallback) {
- pCallback(ret, err)
- }
- });
- };
- /**
- ** 不带加载效果的ajax
- **/
- h.fnReuestDataNologing = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
- var tHeaders = pHeaders ? pHeaders : '';
- var tAjax = {
- url: pPartUrl,
- method: pMethod,
- headers: tHeaders,
- dataType: 'json',
- data: {
- values: pData
- },
- timeout: 30
- };
- api.ajax(tAjax, function (ret, err) {
- if ('function' === typeof pCallback) {
- pCallback(ret, err)
- }
- });
- };
- /**
- ** 加载效果的ajax
- ** 传JSON数据格式
- **/
- h.fnReuestDataJSON = function (pPartUrl, pHeaders, pMethod, pData, pCallback) {
- toast.loading({
- title: "加载中",
- duration: 2000
- });
- var tHeaders = pHeaders ? pHeaders : '';
- var tAjax = {
- url: pPartUrl,
- method: pMethod,
- contentType: 'application/json',
- headers: tHeaders,
- dataType: 'json',
- data: {
- values: pData
- },
- timeout: 30
- };
- api.ajax(tAjax, function (ret, err) {
- if ('function' === typeof pCallback) {
- pCallback(ret, err)
- }
- });
- };
- /**
- ** 不带加载效果的ajax
- ** 传JSON数据格式
- **/
- window.$http = h;
- }(window));
- /**
- * 常用方法
- */
- (function (window) {
- var e = {};
- /**
- * 封装消息发送时间
- */
- e.sendEvent = function (name, extra) {
- api.sendEvent({
- name: name,
- extra: extra
- });
- };
- /**
- * 消息监听事件
- */
- e.addEventListener = function (name, callback) {
- api.addEventListener({
- name: name
- }, function (ret, err) {
- callback(ret)
- });
- };
- /**
- * 滑动底部监听事件
- */
- e.scrollBottomListener = function (callback, threshold) {
- api.addEventListener({
- name: 'scrolltobottom',
- extra: {
- threshold: threshold || 0
- }
- }, function (ret, err) {
- callback(ret)
- });
- };
- /**
- * frame
- *
- */
- e.openFrame = function (name, headers, footer, pageParam, otherParam) {
- var headerH = headers ? $api.dom(headers).offsetHeight : 0;
- var footetH = footer ? $api.dom(footer).offsetHeight : 0;
- api.openFrame({
- name: name,
- url: name + '.html',
- bounces: true,
- scrollEnabled: false,
- hScrollBarEnabled: false,
- progress: {
- type: 'page'
- },
- animation: {
- type: 'fade'
- },
- rect: {
- x: 0,
- y: headerH,
- w: 'auto',
- h: 'auto'
- },
- pageParam: api.pageParam || {}
- });
- };
- /**
- *禁止页面弹动
- *
- **/
- e.openFrameBounces = function (name, headers, footer, pageParam, otherParam) {
- var headerH = headers ? $api.dom(headers).offsetHeight : 0;
- var footetH = footer ? $api.dom(footer).offsetHeight : 0;
- api.openFrame({
- name: name,
- url: name + '.html',
- bounces: false,
- scrollEnabled: false,
- hScrollBarEnabled: false,
- progress: {
- type: 'page'
- },
- animation: {
- type: 'fade'
- },
- rect: {
- x: 0,
- y: headerH,
- w: 'auto',
- h: 'auto'
- },
- pageParam: api.pageParam || {}
- });
- };
- /**
- *打开弹出框
- *
- **/
- e.openPopup = function (w, h, name, pageParam) {
- api.openFrame({
- name: name,
- url: name + '.html',
- bgColor: 'rgba(0,0,0,.6)',
- bounces: false,
- rect: {
- x: 0,
- y: 0,
- w: w,
- h: h
- },
- animation: {
- type: 'fade'
- },
- pageParam: pageParam
- });
- }
- /**
- * Win
- *
- */
- e.openWin = function (winName, winUrl, pageParam, otherParam) {
- var param = {
- name: winName,
- url: winUrl + '.html',
- scrollEnabled: false,
- hScrollBarEnabled: false,
- pageParam: pageParam,
- animation: {
- type: 'fade',
- duration: 450
- }
- }
- Object.assign(param, otherParam || {});
- api.openWin(param)
- }
- /**
- ** openTabLayout
- **/
- e.openTabLayout = function (name, url, title, value) {
- var param = {
- name: name,
- url: url + '.html',
- bgColor: 'rgba(0,159,232,1)',
- title: title,
- bounces: false,
- navigationBar: {
- height: '51',
- background: '#009fe8',
- color: '#fff',
- shadow: 'transparent'
- },
- pageParam: value
- }
- api.openTabLayout(param);
- }
- /**
- ** 提示框无网络
- **/
- e.tips = function (el, text) {
- var str = `<div id="tips">
- <p>
- <i></i>
- ${text}
- </p>
- </div>`;
- $api.append($api.dom(el), str);
- }
- e.removeTips = function (el) {
- $api.remove($api.byId(el));
- }
- /***
- 没有内容提示页面
- el = body
- Image显示图片路径
- ***/
- e.NotContent = function (el, elID, Image) {
- var html = `<div class="noText" id="${elID}">
- <img src="${Image}" alt="">
- </div>`;
- $api.append($api.dom(el), html);
- }
- /**
- *删除NotContent
- **/
- e.deletNotContent = function (elID) {
- $api.remove($api.byId(elID));
- }
- window.$event = e;
- }(window));
- /**
- * 工具类
- * */
- (function (window) {
- var d = {};
- /**
- * append
- * doT模版的封装
- * root DOM名称如ID 或class
- * doT template 名称
- * data ajax返回数据
- */
- d.append = function (root, template, data) {
- var evalText = doT.compile($api.html($api.dom(template)))
- if (typeof root == 'string') {
- $api.append($api.dom(root), evalText(data))
- } else {
- $api.append(root, evalText(data))
- }
- };
- /**
- * html
- * doT模版的封装
- * root DOM名称如ID 或class
- * doT template 名称
- * data ajax返回数据
- */
- d.html = function (root, template, data) {
- var evalText = doT.compile($api.html($api.dom(template)))
- if (typeof root == 'string') {
- $api.html($api.dom(root), evalText(data))
- } else {
- $api.html(root, evalText(data))
- }
- };
- /**
- * after
- * doT模版的封装
- * root DOM名称如ID 或class
- * doT template 名称
- * data ajax返回数据
- */
- d.after = function (root, template, data) {
- var evalText = doT.compile($api.html($api.dom(template)))
- if (typeof root == 'string') {
- $api.after($api.dom(root), evalText(data))
- } else {
- $api.after(root, evalText(data))
- }
- };
- /**
- ** 缓存路径 cache:协议对应的真实目录
- **/
- d.CACHE_DIR = function (url) {
- return api.cacheDir + '/' + url + '/' + api.frameName + '.json';
- }
- /**
- ** 缓存路径 box://协议对应的真实目录
- **/
- d.BOX_DIR = function () {
- return api.cacheDir + '/' + url + '/' + api.frameName + '.json';
- }
- /**
- **把数据也入文件做数据缓存处理
- **/
- d.writeFile = function (url, data) {
- api.writeFile({
- path: url,
- data: JSON.stringify(data)
- })
- };
- /**
- **读取文件中缓存的数据
- **/
- d.readFile = function (url, callback) {
- api.readFile({
- path: url
- }, function (ret, err) {
- callback(ret, err)
- });
- };
- /**轮播**/
- d.swiper = function (el, loops, type) {
- mySwiper = new Swiper(el, {
- pagination: {
- el: '.swiper-pagination',
- type: type,
- },
- loop: false,
- observer: true,
- observeSlideChildren: true,
- speed: 600,
- autoplay: {
- delay: 3000,
- disableOnInteraction: false,
- },
- on: {
- slideChangeTransitionEnd: function (e) {
- api.setFrameAttr({ bounces: true })
- },
- sliderMove: function (event) {
- api.setFrameAttr({ bounces: false })
- },
- touchEnd: function (event) {
- api.setFrameAttr({ bounces: true })
- }
- },
- });
- };
- /**
- ** Loading
- ** frameName frame名字
- ** mask 遮罩层 样式
- **/
- d.UILoading = function (frameName, mask) {
- var UILoading = api.require('UILoading');
- UILoading.flower({
- center: {
- x: api.winWidth / 2.0,
- y: api.winHeight / 2.0
- },
- size: 30,
- fixed: true,
- mask: mask == "" ? 'rgba(255,255,255,0' : mask,
- fixedOn: frameName
- }, function (ret) {
- loadingId = ret.id
- });
- };
- /**
- ** Loading
- ** 关闭Loading
- **
- **/
- d.CloseUILoading = function () {
- var uiloading = api.require('UILoading');
- uiloading.closeFlower({
- id: loadingId
- });
- };
- /**
- **
- ** 根据不同的数据来源 对应不用的pageId id等信息
- **
- **/
- d.differentPageParams = function (id, createDate, pageId) {
- let pageParams = {
- id: id,
- createDate: createDate,
- pageId: pageId
- }
- return pageParams
- }
- window.$apis = d
- }(window));
- /**
- * 面板
- *
- */
- (function (window, undefined) {
- "use strict";
- var auiCollapse = function (params) {
- this.init(params);
- };
- auiCollapse.prototype = {
- init: function (params, callback) {
- var collapseHeader = document.querySelectorAll(".aui-collapse-header");
- if (collapseHeader.length) {
- for (var i = 0; i < collapseHeader.length; i++) {
- (function (e) {
- collapseHeader[e].onclick = function () {
- if (collapseHeader[e].nextSibling.nextElementSibling.className.indexOf("aui-collapse-content") > -1) {
- if (collapseHeader[e].nextSibling.nextElementSibling.className.indexOf("aui-show") > -1) {
- collapseHeader[e].nextSibling.nextElementSibling.classList.remove("aui-show");
- collapseHeader[e].classList.remove("aui-active");
- } else {
- if (params.autoHide) {
- if (document.querySelector(".aui-collapse-header.aui-active")) {
- document.querySelector(".aui-collapse-header.aui-active").classList.remove("aui-active");
- }
- if (document.querySelector(".aui-collapse-content.aui-show")) {
- document.querySelector(".aui-collapse-content.aui-show").classList.remove("aui-show");
- }
- }
- collapseHeader[e].nextSibling.nextElementSibling.classList.toggle("aui-show");
- collapseHeader[e].classList.toggle("aui-active");
- }
- }
- }
- })(i)
- }
- }
- }
- };
- window.auiCollapse = auiCollapse;
- })(window);
- /**
- *获取当前时间年月日 周 时 分 秒
- *
- **/
- function getNowFormatDate() {
- var now = new Date();
- var year = now.getFullYear(); //获取年份
- var month = now.getMonth(); //获取月份
- var date = now.getDate(); //获取日期
- var day = now.getDay(); //获取星期
- var hour = now.getHours(); //获取小时
- var minute = now.getMinutes(); //获取分钟
- var seconds = now.getSeconds() < 10 ? '0' + now.getSeconds() : now.getSeconds(); //获取秒
- month = month + 1;
- var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
- var week = arr_week[day];
- var time = year + "年" + month + "月" + date + "日 " + week + " " + hour + ":" + minute + ":" + seconds;
- return time;
- }
- /**
- *获取当前时间年月日
- *
- **/
- function getYearMonthDate() {
- var now = new Date();
- var year = now.getFullYear(); //获取年份
- var month = now.getMonth(); //获取月份
- var date = now.getDate(); //获取日期
- var hour = now.getHours(); //获取小时
- var minute = now.getMinutes(); //获取分钟
- month = month + 1;
- month = month < 10 ? '0' + month : month
- date = date < 10 ? '0' + date : date
- var time = year + "-" + month + "-" + date
- return time;
- }
- /**
- *获取当前时间YYYY-MM-dd hh:mm
- *
- **/
- function getYearMonthDateTime() {
- var now = new Date();
- var year = now.getFullYear(); //获取年份
- var month = now.getMonth(); //获取月份
- var date = now.getDate(); //获取日期
- var hour = now.getHours(); //获取小时
- var minute = now.getMinutes(); //获取分钟
- month = month + 1;
- month = month < 10 ? '0' + month : month
- date = date < 10 ? '0' + date : date
- hour = hour < 10 ? '0' + hour : hour
- minute = minute < 10 ? '0' + minute : minute
- var time = year + "-" + month + "-" + date + " " + hour + ":" + minute
- return time;
- }
- // 把时间戳转为日期或者时间
- function formatDateTime(inputTime) {
- let date = new Date(inputTime);
- let y = date.getFullYear();
- let m = date.getMonth() + 1;
- m = m < 10 ? ('0' + m) : m;
- let d = date.getDate();
- d = d < 10 ? ('0' + d) : d;
- let h = date.getHours();
- h = h < 10 ? ('0' + h) : h;
- let minute = date.getMinutes();
- let second = date.getSeconds();
- minute = minute < 10 ? ('0' + minute) : minute;
- second = second < 10 ? ('0' + second) : second;
- return y + '-' + m + '-' + d;
- }
- // 计算时间天数差
- function datedifference(sDate2) {
- var date = new Date();
- var year = date.getFullYear() - 1
- var month = date.getMonth() + 1
- var d = date.getDate()
- var dateSpan,
- tempDate,
- iDays;
- sDate1 = Date.parse(year + "-" + month + "-" + d);
- dateSpan = sDate2 - sDate1;
- dateSpan = Math.abs(dateSpan);
- iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
- return iDays
- };
- /**
- *消除300ms延迟
- ***/
- !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 }();
- /**
- * fastclick 消除点击时间
- */
- if ('addEventListener' in document) {
- document.addEventListener('DOMContentLoaded', function () {
- FastClick.attach(document.body);
- }, false)
- };
- // 数组删除元素
- Array.prototype.remove = function (val) {
- var index = this.indexOf(val);
- if (index > -1) {
- this.splice(index, 1);
- }
- };
|