"use strict";var e=require("../common/vendor.js"),t=require("../api/user.js");exports.addHisSearch=function(t){var r=e.index.getStorageSync("hisSearch"),n=[];console.log(n),null!=r&&null!=r&&""!=r&&(n=JSON.parse(r)),n.push(t);const o=[...new Set(n)];e.index.setStorageSync("hisSearch",JSON.stringify(o))},exports.clearHisSearch=function(){e.index.setStorageSync("hisSearch",JSON.stringify([]))},exports.generateRandomString=function(e){let t="";const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;for(let o=0;o0)if(l==o)t=a-s<0?c-1:c;else t=l-o<0?c-1:c;else t=-1}return t},exports.getDictLabelName=function(e,t){if(null==t)return"";var r="";return e.forEach((function(e,n,o){t.toString()==e.dictValue.toString()&&(r=e.dictLabel)})),r},exports.getHisSearch=function(){var t;return null!=(t=e.index.getStorageSync("hisSearch"))&&null!=t&&""!=t?t=JSON.parse(t):[]},exports.getProvider=function(t){return new Promise(((r,n)=>{e.index.getProvider({service:t||"oauth",success:function(e){e.provider&&r(e.provider[0])},fail(){n("获取环境服务商失败")}})})).catch((e=>{console.log("167",e)}))},exports.isEmpty=function(e){return"undefined"==e||null==e||""==e},exports.isLogin=function(){return new Promise(((e,r)=>{t.checkLogin().then((t=>{200==t.code?e(!0):e(!1)}),(e=>{}))}))},exports.isLoginCourse=function(){return new Promise(((t,r)=>{let n=e.index.getStorageSync("AppTokenmini_RTCourse");t(null!=n&&null!=n&&""!=n)}))},exports.logout=function(){e.index.setStorageSync("AppToken",null)},exports.parseIDCardInfo=function(e){if(/^\d{17}[\dXx]$/.test(e)){var t=e.substring(6,14),r=t.substring(0,4);return{birthday:r+"-"+t.substring(4,6)+"-"+t.substring(6,8),age:(new Date).getFullYear()-parseInt(r),gender:parseInt(e.charAt(16))%2==0?"女":"男"}}return null},exports.parseIdCard=function(e){return e.substr(0,4)+"****"+e.substr(8)},exports.parsePhone=function(e){if(console.log(e),null!=e)return e.substr(0,3)+"****"+e.substr(7)},exports.parseText=function(e,t){return e.length>t?e.substr(0,t)+"...":e},exports.urlToObj=function(e){let t={},r=e.slice(e.indexOf("?")+1).split("&");for(let n=r.length,o=0;o