text: /*!
   * weRequest 1.5.0
   * https://github.com/IvinWu/weRequest
   */
  module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=9)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={sessionName:"session",loginTrigger:function(){return!1},codeToSession:{url:"",success:function(){}},successTrigger:function(){return!0},setHeader:{},urlPerfix:"",doNotCheckSession:!1,errorTitle:"操作失败",errorContent:function(e){return e},errorRetryBtn:!1,reLoginLimit:3,errorCallback:null,reportCGI:!1,mockJson:!1,globalData:!1,sessionExpireKey:"sessionExpireKey",errorHandler:null,beforeSend:null}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={session:"",sessionExpire:1/0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3);t.default=function(e){return n.default.request(e)}},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),a=r(0),u=r(1),i=r(11),s=r(8),f=r(4),l=r(12),c=r(7),d=r(14),p=r(5),y=r(15);function g(e){if(e.startsWith("http"))return e;var t=a.default.urlPerfix;return"function"==typeof a.default.urlPerfix&&(t=a.default.urlPerfix()),t+e}function h(e,t,r){return"function"==typeof e.beforeSend&&e.beforeSend(),void 0===e.reLoginCount?e.reLoginCount=0:e.reLoginCount++,e.showLoading&&o.default.show(e.showLoading),e.originUrl||(e.originUrl=e.url,e.url=g(e.url)),e._resolve=t,e._reject=r,e}function v(){var e={};return"function"==typeof a.default.globalData?e=a.default.globalData():"object"==typeof a.default.globalData&&(e=a.default.globalData),e}function m(e){return e=function(e){var t;if(e.data||(e.data={}),e.header=e.header?e.header:{},"function"==typeof a.default.setHeader){var r=a.default.setHeader();"object"==typeof r&&(e.header=n(n({},e.header),r))}else"object"==typeof a.default.setHeader&&(e.header=n(n({},e.header),a.default.setHeader));e.token&&(e.header=n(n({},e.header),{"x-auth-token":u.default.session}));var o=v();return e.data=n(n({},o),e.data),e.method=e.method||"GET",e.dataType=e.dataType||"json",a.default.doNotUseQueryString||"GET"===e.method||(u.default.session&&(e.url=d.default.setParams(e.url,((t={})[a.default.sessionName]=u.default.session,t))),e.url=d.default.setParams(e.url,o)),c.default.start(e),e}(e),"function"==typeof a.default.beforeSend&&(e=a.default.beforeSend(e,u.default.session)),new Promise((function(t,r){wx.request({url:e.url,data:e.data,method:e.method,header:e.header||{},dataType:e.dataType||"json",success:function(e){return t(e)},fail:function(t){return p.default.systemError(e,t),r(t)},complete:function(){"function"==typeof e.complete&&e.complete(),e.showLoading&&o.default.hide()}})}))}function _(e){return e=function(e){var t,r;if(e.formData||(e.formData={}),e.header=e.header?e.header:{},"function"==typeof a.default.setHeader){var o=a.default.setHeader();"object"==typeof o&&(e.header=n(n({},e.header),o))}else"object"==typeof a.default.setHeader&&(e.header=n(n({},e.header),a.default.setHeader));e.originUrl!==a.default.codeToSession.url&&u.default.session&&(e.formData=n(n({},e.formData),((t={})[a.default.sessionName]=u.default.session,t)));var i=v();return e.formData=n(n({},i),e.formData),a.default.doNotUseQueryString||(u.default.session&&(e.url=d.default.setParams(e.url,((r={})[a.default.sessionName]=u.default.session,r))),e.url=d.default.setParams(e.url,i)),c.default.start(e),e}(e),"function"==typeof a.default.beforeSend&&(e=a.default.beforeSend(e,u.default.session)),new Promise((function(t,r){wx.uploadFile({url:e.url,filePath:e.filePath||"",name:e.name||"",formData:e.formData,success:function(e){return t(e)},fail:function(t){return p.default.systemError(e,t),r(t)},complete:function(){"function"==typeof e.complete&&e.complete(),e.showLoading&&o.default.hide()}})}))}t.default={format:g,request:function(e){return new Promise((function(t,r){if(e=h(e,t,r),a.default.mockJson){var n=i.default.get(e);if(n){var o=l.default.responseForRequest(n,e);return t(o)}}if(e.cache&&s.default.get(e),!1===e.token)return m(e).then((function(r){var n=l.default.responseForRequest(r,e);if(null!=n)return t(n)})).catch((function(t){return y.catchHandler(t,e,r)}));f.default.main(e).then((function(){return m(e)})).then((function(r){var n=l.default.responseForRequest(r,e);if(null!=n)return t(n)})).catch((function(t){return y.catchHandler(t,e,r)}))}))},uploadFile:function(e){return new Promise((function(t,r){if(e=h(e,t,r),a.default.mockJson){var n=i.default.get(e);if(n){var o=l.default.responseForUploadFile(n,e);return t(o)}}f.default.main(e).then((function(){return _(e)})).then((function(r){var n=l.default.responseForUploadFile(r,e);if(null!=n)return t(n)})).catch((function(t){y.catchHandler(t,e,r)}))}))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(0),a=r(5),u=r(7),i=r(3),s=r(6),f=r(2),l=null;function c(){return new Promise((function(e,t){return!n.default.session||o.default.sessionExpireTime&&(new Date).getTime()>n.default.sessionExpire&&(y(),1)?(o.default.doNotCheckSession=!0,p().then((function(){return e()}),(function(e){return t(e)}))):e()}))}var d=null;function p(){return d||(d=new Promise((function(e,t){new Promise((function(e,t){var r=(new Date).getTime();wx.login({success:function(r){if(!r.code)return console.log("2:"),t({title:"登录失败",content:"请稍后重试[code 获取失败]"});var s,f;(s=r.code,f="function"==typeof o.default.codeToSession.data?o.default.codeToSession.data():o.default.codeToSession.data||{},o.default.codeToSession.codeName?f[o.default.codeToSession.codeName]=s:f.code=s,new Promise((function(e,t){var r=(new Date).getTime();wx.request({url:i.default.format(o.default.codeToSession.url),data:f,method:o.default.codeToSession.method||"GET",header:"function"==typeof o.default.setHeader?o.default.setHeader():o.default.setHeader,success:function(i){if(200===i.statusCode){if(o.default.codeToSession.report){var s=(new Date).getTime();u.default.report(o.default.codeToSession.report,r,s)}var f=void 0;try{f=o.default.codeToSession.success(i.data)}catch(e){}return"string"==typeof f?(n.default.session=f,o.default.doNotCheckSession=!0,o.default.sessionExpireTime&&o.default.sessionExpireKey&&(n.default.sessionExpire=(new Date).getTime()+o.default.sessionExpireTime,wx.setStorage({key:o.default.sessionExpireKey,data:String(n.default.sessionExpire)})),wx.setStorage({key:o.default.sessionName,data:n.default.session}),e(f)):t(a.default.getErrorMsg(i))}return console.log("4:"),t({title:"登录失败",content:"请稍后重试"})},complete:function(){},fail:function(e){return console.log("3:",e),t({title:"登录失败",content:"请稍后重试"})}})}))).then((function(){return e()})).catch((function(e){return t(e)}))},complete:function(){var e=(new Date).getTime();u.default.report("wx_login",r,e)},fail:function(e){return console.log("1:",e),t({title:"登录失败",content:e.errMsg})}})})).then((function(){return d=null,e()})).catch((function(e){return d=null,s.default.hide(),t(e)}))}))),d}function y(){n.default.session="",wx.removeStorage({key:o.default.sessionName}),o.default.sessionExpireTime&&o.default.sessionExpireKey&&(n.default.sessionExpire=1/0,wx.removeStorage({key:o.default.sessionExpireKey}))}t.default={main:function e(t){return new Promise((function(r,n){var i=t?function(){return f.default(t).then(t._resolve).catch(t._reject)}:function(){return e().then(r).catch(n)};return c().then((function(){return o.default.doNotCheckSession?Promise.resolve():(l||(l=new Promise((function(e,t){var r=(new Date).getTime();wx.checkSession({success:function(){return e()},fail:function(){return y(),p().then((function(){return e()}),(function(e){return t(e)}))},complete:function(){var e=(new Date).getTime();u.default.report("wx_checkSession",r,e)}})}))),l)}),(function(e){var t=e.title,r=e.content;return a.default.doError(t,r,i),n({title:t,content:r})})).then((function(){return r()}),(function(e){var t=e.title,r=e.content;return a.default.doError(t,r,i),n({title:t,content:r})}))}))},setSession:function(e){n.default.session=e,o.default.doNotCheckSession=!0,o.default.sessionExpireTime&&o.default.sessionExpireKey&&(n.default.sessionExpire=(new Date).getTime()+o.default.sessionExpireTime,wx.setStorage({key:o.default.sessionExpireKey,data:String(n.default.sessionExpire)})),wx.setStorage({key:o.default.sessionName,data:n.default.session})},delSession:y}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(2);function a(e){var t="";if("function"==typeof n.default.errorTitle)try{t=n.default.errorTitle(e.data)}catch(e){}else"string"==typeof n.default.errorTitle&&(t=n.default.errorTitle);var r="";if("function"==typeof n.default.errorContent)try{r=n.default.errorContent(e.data)}catch(e){}else"string"==typeof n.default.errorContent&&(r=n.default.errorContent);return{title:t,content:r}}function u(e,t,r){var o=n.default.errorRetryBtn&&"function"==typeof r;wx.showModal(Object.assign({title:e,content:t||"网络或服务异常，请稍后重试"},o?{showCancel:!0,confirmText:"重试",success:function(e){e.confirm&&"function"==typeof r&&r()}}:{showCancel:!1}))}t.default={systemError:function(e,t){if("function"==typeof e.fail)e.fail(t);else{u("",t.errMsg,(function(){return o.default(e).then(e._resolve).catch(e._reject)}))}},logicError:function(e,t){if("function"==typeof e.fail)e.fail(t);else if("function"==typeof n.default.errorHandler)n.default.errorHandler(t.data);else{var r=a(t);u(r.title,r.content,(function(){return o.default(e).then(e._resolve).catch(e._reject)}))}},doError:u,getErrorMsg:a}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={show:function(e){wx.showToast({title:"boolean"==typeof e?"加载中":e,icon:"loading",mask:!0,duration:6e4})},hide:function(){wx.hideToast({})}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(2);function a(e,t,r){"function"==typeof n.default.reportCGI&&n.default.reportCGI(e,t,r,o.default)}t.default={start:function(e){e._reportStartTime=(new Date).getTime()},end:function(e){e._reportEndTime=(new Date).getTime(),e.report&&e._reportStartTime&&a(e.report,e._reportStartTime,e._reportEndTime)},report:a}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={get:function(e){e.originUrl&&wx.getStorage({key:e.originUrl,success:function(t){(!0===e.cache||"function"==typeof e.cache&&e.cache(t.data))&&"function"==typeof e.success&&e.success(t.data,{isCache:!0}),"function"==typeof e.complete&&e.complete()}})},set:function(e,t){e.originUrl&&(!0===e.cache||"function"==typeof e.cache&&e.cache(t))&&wx.setStorage({key:e.originUrl,data:t})}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(10),o=r(2),a=r(16),u=r(17),i=r(18),s=r(19),f=r(20),l=r(21),c={init:n.default,request:o.default,uploadFile:a.default,setSession:u.default,login:i.default,getSession:s.default,getConfig:f.default,version:l.version};t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(1);t.default=function(e){Object.assign(n.default,e),console.log(n.default.errorTitle);try{o.default.session=wx.getStorageSync(n.default.sessionName)||""}catch(e){}try{o.default.sessionExpire=wx.getStorageSync(n.default.sessionExpireKey||"sessionExpireKey")||1/0}catch(e){}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(6);t.default={get:function(e){if(!(n.default.mockJson[e.url]||e.originUrl&&n.default.mockJson[e.originUrl]))return!1;var t=n.default.mockJson[e.url]||(e.originUrl?n.default.mockJson[e.originUrl]:""),r={data:t=JSON.parse(JSON.stringify(t)),statusCode:200};return o.default.hide(),r}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(3),a=r(5),u=r(8),i=r(7),s=r(4),f=r(13);t.default={responseForRequest:function(e,t){if(200!==e.statusCode)throw{type:"http-error",res:e};if(i.default.end(t),"json"===t.dataType&&"string"==typeof e.data){e.data=f.default(e.data);try{e.data=JSON.parse(e.data)}catch(r){if(t.catchError)throw new Error(r);return void a.default.logicError(t,e)}}if(n.default.loginTrigger(e.data)&&void 0!==t.reLoginCount&&t.reLoginCount<n.default.reLoginLimit)return s.default.delSession(),o.default.request(t);if(!n.default.successTrigger(e.data))throw{type:"logic-error",res:e};var r="";try{r="function"==typeof n.default.successData?n.default.successData(e.data):e.data}catch(e){}if(!t.noCacheFlash){if("function"!=typeof t.success)return r;t.success(r)}u.default.set(t,r)},responseForUploadFile:function(e,t){if(200!==e.statusCode)throw{type:"http-error",res:e};if(i.default.end(t),"string"==typeof e.data){e.data=f.default(e.data);try{e.data=JSON.parse(e.data)}catch(r){if(t.catchError)throw new Error(r);return void a.default.logicError(t,e)}}if(n.default.loginTrigger(e.data)&&void 0!==t.reLoginCount&&t.reLoginCount<n.default.reLoginLimit)return s.default.delSession(),o.default.uploadFile(t);if(!n.default.successTrigger(e.data))throw{type:"logic-error",res:e};var r="";try{r="function"==typeof n.default.successData?n.default.successData(e.data):e.data}catch(e){}if("function"!=typeof t.success)return r;t.success(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=/\u000A/g,o=/\u000D/g,a=/\u2028/g,u=/\u2029/g;t.default=function(e){return e=(e=(e=(e=e.replace(n,"")).replace(o,"")).replace(a,"")).replace(u,"")}},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.default={setParams:function(e,t){void 0===e&&(e="");var r=e.indexOf("?"),o={};if(r>=0){var a=e.substr(r+1).split("&");a.forEach((function(e,t){var r=a[t].split("=");o[r[0]]=r[1]}))}o=n(n({},o),t);var u=Object.keys(o).map((function(e){return e+"="+encodeURI(o[e])})).join("&");return r>=0?e.substring(0,r+1)+u:e+"?"+u}}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.catchHandler=void 0;var a=r(5),u=r(0),i=function(e){function t(t,r){void 0===r&&(r={});var n=e.call(this,t)||this;return n.data=r,n}return o(t,e),t}(Error);t.catchHandler=function(e,t,r){var n=e.type,o=e.res;if("function"==typeof u.default.errorCallback&&"logic-error"===n&&u.default.errorCallback(t,o),t.catchError){if("http-error"===n)return r(new Error(o.statusCode.toString()));if("logic-error"===n){var s=a.default.getErrorMsg(o);return r(new i(s.content,o.data))}return r(e)}return n?a.default.logicError(t,o):r(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3);t.default=function(e){return n.default.uploadFile(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4);t.default=function(e){n.default.setSession(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4);t.default=function(){return n.default.main()}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t.default=function(){return n.default.session}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(1);t.default=function(){return{urlPerfix:n.default.urlPerfix,sessionExpireTime:n.default.sessionExpireTime,sessionExpireKey:n.default.sessionExpireKey,sessionExpire:o.default.sessionExpire}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0;t.version="1.5.0"}]).default;