New Huajishe Check ChaoXing
This commit is contained in:
1
HuajisheCheckChaoXing/utils/api.js
Normal file
1
HuajisheCheckChaoXing/utils/api.js
Normal file
File diff suppressed because one or more lines are too long
17
HuajisheCheckChaoXing/utils/config.js
Normal file
17
HuajisheCheckChaoXing/utils/config.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const config = {
|
||||
baseUrl: "https://cx.micono.eu.org/edge/proxy", // 公益反代服务器(腾讯 EdgeOne),有条件请更换为你的反代域名
|
||||
repository: "", // 开源仓库地址
|
||||
|
||||
baiduMapKey: 'YbQ8KF8skZdmR7AylIBpnmX9J6t1mw87', // 百度地图开发平台
|
||||
tianMapKey: '6ed873d52ecdbf77d52b5acc5de44e07', // 天地图开放平台
|
||||
|
||||
notice: "免费提供,谨防倒卖!",
|
||||
|
||||
swiperList: [
|
||||
"/static/swiper/1.png",
|
||||
"/static/swiper/2.png",
|
||||
"/static/swiper/3.png",
|
||||
"/static/swiper/4.png",
|
||||
],
|
||||
}
|
||||
module.exports = config;
|
||||
126
HuajisheCheckChaoXing/utils/http.js
Normal file
126
HuajisheCheckChaoXing/utils/http.js
Normal file
@@ -0,0 +1,126 @@
|
||||
import util from 'util';
|
||||
import log from 'log';
|
||||
|
||||
/**
|
||||
* HTTP请求
|
||||
* @param {*} method
|
||||
* @param {*} url
|
||||
* @param {*} data
|
||||
* @param {*} cookies
|
||||
* @param {*} timeout
|
||||
* @param {*} showLoading
|
||||
*/
|
||||
const request = (method, url, data, cookies, timeout, showLoading) => {
|
||||
if (showLoading)
|
||||
util.showLoading("请稍候")
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
method: method,
|
||||
url: url,
|
||||
data: data,
|
||||
timeout: timeout,
|
||||
header: {
|
||||
'cookie': stringifyCookie(cookies),
|
||||
},
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(err) {
|
||||
reject(err)
|
||||
},
|
||||
complete() {
|
||||
util.hideLoading();
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* GET请求
|
||||
* @param {string} url
|
||||
* @param {object} data
|
||||
* @param {object} cookies
|
||||
*/
|
||||
const get = (url, data = {}, cookies = {}, timeout = 15 * 1000, showLoading = true) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
request("GET", url, data, cookies, timeout, showLoading)
|
||||
.then(res => {
|
||||
if (res.statusCode != 200) throw `HTTP ERROR ${res.statusCode}`;
|
||||
resolve(Object.assign(res.data, {
|
||||
'cookies': parseCookie(res.cookies)
|
||||
}));
|
||||
})
|
||||
.catch(e => reject(e))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* GET请求Text
|
||||
* @param {string} url
|
||||
* @param {object} data
|
||||
* @param {object} cookies
|
||||
*/
|
||||
const getText = (url, data = {}, cookies = {}, timeout = 15 * 1000, showLoading = true) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
request("GET", url, data, cookies, timeout, showLoading)
|
||||
.then(res => {
|
||||
if (res.statusCode != 200) throw `HTTP ERROR ${res.statusCode}`;
|
||||
resolve(res.data);
|
||||
})
|
||||
.catch(e => reject(e))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* POST请求
|
||||
* @param {string} url
|
||||
* @param {object} data
|
||||
* @param {object} cookies
|
||||
*/
|
||||
const post = (url, data = {}, cookies = {}, timeout = 15000, showLoading = true) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
request("POST", url, data, cookies, timeout, showLoading)
|
||||
.then(res => {
|
||||
if (res.statusCode != 200) throw `HTTP ERROR ${res.statusCode}`;
|
||||
resolve(Object.assign(res.data, {
|
||||
'cookies': parseCookie(res.cookies)
|
||||
}));
|
||||
})
|
||||
.catch(e => reject(e))
|
||||
})
|
||||
}
|
||||
|
||||
// ------ 依赖函数 ------
|
||||
|
||||
/**
|
||||
* 解析返回的cookies
|
||||
* @param {string[]} cookieList wx.request返回的cookies列表
|
||||
*/
|
||||
const parseCookie = (cookieList = []) => {
|
||||
let cookies = {};
|
||||
for (let i = 0; i < cookieList.length; i++) {
|
||||
const parts = cookieList[i].split(';');
|
||||
const nameValue = parts[0].split('=');
|
||||
const name = nameValue[0].trim();
|
||||
const value = decodeURIComponent(nameValue[1]);
|
||||
cookies[name] = value;
|
||||
}
|
||||
return cookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把cookies列表编码成header中的格式
|
||||
* @param {string[]} cookieObject 编码cookies
|
||||
*/
|
||||
const stringifyCookie = (cookieObject = {}) => {
|
||||
return Object.entries(cookieObject).map(
|
||||
([name, value]) => `${name}=${encodeURIComponent(value)}`).join(';');
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
get,
|
||||
post,
|
||||
getText,
|
||||
}
|
||||
19
HuajisheCheckChaoXing/utils/log.js
Normal file
19
HuajisheCheckChaoXing/utils/log.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const log = wx.getRealtimeLogManager();
|
||||
|
||||
module.exports = {
|
||||
debug() {
|
||||
if (!log) return
|
||||
log.debug.apply(log, arguments)
|
||||
console.info(...arguments)
|
||||
},
|
||||
info() {
|
||||
if (!log) return
|
||||
log.info.apply(log, arguments)
|
||||
console.info(...arguments)
|
||||
},
|
||||
error() {
|
||||
if (!log) return
|
||||
log.error.apply(log, arguments)
|
||||
console.error(...arguments)
|
||||
}
|
||||
}
|
||||
1
HuajisheCheckChaoXing/utils/lz-string.min.js
vendored
Normal file
1
HuajisheCheckChaoXing/utils/lz-string.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var LZString=function(){var r=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",e={};function t(r,o){if(!e[r]){e[r]={};for(var n=0;n<r.length;n++)e[r][r.charAt(n)]=n}return e[r][o]}var i={compressToBase64:function(r){if(null==r)return"";var n=i._compress(r,6,function(r){return o.charAt(r)});switch(n.length%4){default:case 0:return n;case 1:return n+"===";case 2:return n+"==";case 3:return n+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(n){return t(o,r.charAt(n))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompressFromUTF16:function(r){return null==r?"":""==r?null:i._decompress(r.length,16384,function(o){return r.charCodeAt(o)-32})},compressToUint8Array:function(r){for(var o=i.compress(r),n=new Uint8Array(2*o.length),e=0,t=o.length;e<t;e++){var s=o.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null==o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;e<t;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(""))},compressToEncodedURIComponent:function(r){return null==r?"":i._compress(r,6,function(r){return n.charAt(r)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(o){return t(n,r.charAt(o))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(r,o,n){if(null==r)return"";var e,t,i,s={},u={},a="",p="",c="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<r.length;i+=1)if(a=r.charAt(i),Object.prototype.hasOwnProperty.call(s,a)||(s[a]=f++,u[a]=!0),p=c+a,Object.prototype.hasOwnProperty.call(s,p))c=p;else{if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),s[p]=f++,c=String(a)}if(""!==c){if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==o-1){d.push(n(m));break}v++}return d.join("")},decompress:function(r){return null==r?"":""==r?null:i._decompress(r.length,32768,function(o){return r.charCodeAt(o)})},_decompress:function(o,n,e){var t,i,s,u,a,p,c,l=[],f=4,h=4,d=3,m="",v=[],g={val:e(0),position:n,index:1};for(t=0;t<3;t+=1)l[t]=t;for(s=0,a=Math.pow(2,2),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 2:return""}for(l[3]=c,i=c,v.push(c);;){if(g.index>o)return"";for(s=0,a=Math.pow(2,d),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(c=s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 2:return v.join("")}if(0==f&&(f=Math.pow(2,d),d++),l[c])m=l[c];else{if(c!==h)return null;m=i+i.charAt(0)}v.push(m),l[h++]=i+m.charAt(0),i=m,0==--f&&(f=Math.pow(2,d),d++)}}};return i}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module?module.exports=LZString:"undefined"!=typeof angular&&null!=angular&&angular.module("LZString",[]).factory("LZString",function(){return LZString});
|
||||
39
HuajisheCheckChaoXing/utils/sdk/mtj-wx-sdk.config.js
Normal file
39
HuajisheCheckChaoXing/utils/sdk/mtj-wx-sdk.config.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file 百度移动统计配置文件
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* 从百度移动统计获取的AppKey
|
||||
* @type {string}
|
||||
*/
|
||||
appKey: '2770bfeafe',
|
||||
|
||||
/**
|
||||
* 是否使用了插件
|
||||
* @type {boolean}
|
||||
*/
|
||||
hasPlugin: false,
|
||||
|
||||
/**
|
||||
* 是否获取当前的地理位置和速度信息
|
||||
* @type {boolean}
|
||||
*/
|
||||
getLocation: false,
|
||||
|
||||
/**
|
||||
* 是否获取组件滚动信息
|
||||
* @type {boolean}
|
||||
*/
|
||||
getComponentScroll: false,
|
||||
/**
|
||||
* 是否开启了A/B 测试
|
||||
* @type {boolean}
|
||||
*/
|
||||
hasABTest: false,
|
||||
/**
|
||||
* 是否开启热力图功能
|
||||
* @type {boolean}
|
||||
*/
|
||||
hasHeatmap: false,
|
||||
};
|
||||
1
HuajisheCheckChaoXing/utils/sdk/mtj-wx-sdk.js
Normal file
1
HuajisheCheckChaoXing/utils/sdk/mtj-wx-sdk.js
Normal file
File diff suppressed because one or more lines are too long
52
HuajisheCheckChaoXing/utils/util.js
Normal file
52
HuajisheCheckChaoXing/utils/util.js
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
/**
|
||||
* 写入缓存
|
||||
* @param {string} key
|
||||
* @param {object} value
|
||||
*/
|
||||
const setStorage = (key, value) => {
|
||||
wx.setStorageSync(key, value)
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取缓存
|
||||
* @param {string} key
|
||||
* @param {*} defaultValue
|
||||
*/
|
||||
const getStorage = (key, defaultValue = null) => {
|
||||
const value = wx.getStorageSync(key);
|
||||
if (value === '')
|
||||
return defaultValue;
|
||||
return value;
|
||||
}
|
||||
|
||||
const showLoading = (msg) => {
|
||||
wx.showLoading({
|
||||
title: msg,
|
||||
mask: true,
|
||||
})
|
||||
}
|
||||
|
||||
const hideLoading = () => {
|
||||
wx.hideLoading({
|
||||
noConflict: true,
|
||||
});
|
||||
}
|
||||
|
||||
const showInfo = (msg, icon = "none", mask = false) => {
|
||||
wx.showToast({
|
||||
title: msg,
|
||||
mask: mask,
|
||||
icon: icon,
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setStorage,
|
||||
getStorage,
|
||||
info: wx.getAccountInfoSync(),
|
||||
device: wx.getDeviceInfo(),
|
||||
showLoading,
|
||||
hideLoading,
|
||||
showInfo,
|
||||
}
|
||||
Reference in New Issue
Block a user