vendor.js 414 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!*********************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
  6. \*********************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", {
  11. value: true
  12. });
  13. exports.default = void 0;
  14. var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
  15. var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
  16. var target = typeof globalThis !== 'undefined' ? globalThis : function () {
  17. return this;
  18. }();
  19. var key = ['w', 'x'].join('');
  20. var oldWx = target[key];
  21. var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
  22. function isWxKey(key) {
  23. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  24. return false;
  25. }
  26. return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
  27. }
  28. function initWx() {
  29. var newWx = {};
  30. for (var _key in oldWx) {
  31. if (isWxKey(_key)) {
  32. // TODO wrapper function
  33. newWx[_key] = oldWx[_key];
  34. }
  35. }
  36. return newWx;
  37. }
  38. target[key] = initWx();
  39. var _default = target[key];
  40. exports.default = _default;
  41. /***/ }),
  42. /* 2 */
  43. /*!************************************************************!*\
  44. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  45. \************************************************************/
  46. /*! no static exports found */
  47. /***/ (function(module, exports, __webpack_require__) {
  48. "use strict";
  49. /* WEBPACK VAR INJECTION */(function(wx, global) {
  50. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  51. Object.defineProperty(exports, "__esModule", {
  52. value: true
  53. });
  54. exports.createApp = createApp;
  55. exports.createComponent = createComponent;
  56. exports.createPage = createPage;
  57. exports.createPlugin = createPlugin;
  58. exports.createSubpackageApp = createSubpackageApp;
  59. exports.default = void 0;
  60. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  61. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  62. var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 15));
  63. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  64. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  65. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  66. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
  67. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  68. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  69. var realAtob;
  70. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  71. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  72. if (typeof atob !== 'function') {
  73. realAtob = function realAtob(str) {
  74. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  75. if (!b64re.test(str)) {
  76. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  77. }
  78. // Adding the padding if missing, for semplicity
  79. str += '=='.slice(2 - (str.length & 3));
  80. var bitmap;
  81. var result = '';
  82. var r1;
  83. var r2;
  84. var i = 0;
  85. for (; i < str.length;) {
  86. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  87. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  88. }
  89. return result;
  90. };
  91. } else {
  92. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  93. realAtob = atob;
  94. }
  95. function b64DecodeUnicode(str) {
  96. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  97. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  98. }).join(''));
  99. }
  100. function getCurrentUserInfo() {
  101. var token = wx.getStorageSync('uni_id_token') || '';
  102. var tokenArr = token.split('.');
  103. if (!token || tokenArr.length !== 3) {
  104. return {
  105. uid: null,
  106. role: [],
  107. permission: [],
  108. tokenExpired: 0
  109. };
  110. }
  111. var userInfo;
  112. try {
  113. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  114. } catch (error) {
  115. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  116. }
  117. userInfo.tokenExpired = userInfo.exp * 1000;
  118. delete userInfo.exp;
  119. delete userInfo.iat;
  120. return userInfo;
  121. }
  122. function uniIdMixin(Vue) {
  123. Vue.prototype.uniIDHasRole = function (roleId) {
  124. var _getCurrentUserInfo = getCurrentUserInfo(),
  125. role = _getCurrentUserInfo.role;
  126. return role.indexOf(roleId) > -1;
  127. };
  128. Vue.prototype.uniIDHasPermission = function (permissionId) {
  129. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  130. permission = _getCurrentUserInfo2.permission;
  131. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  132. };
  133. Vue.prototype.uniIDTokenValid = function () {
  134. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  135. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  136. return tokenExpired > Date.now();
  137. };
  138. }
  139. var _toString = Object.prototype.toString;
  140. var hasOwnProperty = Object.prototype.hasOwnProperty;
  141. function isFn(fn) {
  142. return typeof fn === 'function';
  143. }
  144. function isStr(str) {
  145. return typeof str === 'string';
  146. }
  147. function isObject(obj) {
  148. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  149. }
  150. function isPlainObject(obj) {
  151. return _toString.call(obj) === '[object Object]';
  152. }
  153. function hasOwn(obj, key) {
  154. return hasOwnProperty.call(obj, key);
  155. }
  156. function noop() {}
  157. /**
  158. * Create a cached version of a pure function.
  159. */
  160. function cached(fn) {
  161. var cache = Object.create(null);
  162. return function cachedFn(str) {
  163. var hit = cache[str];
  164. return hit || (cache[str] = fn(str));
  165. };
  166. }
  167. /**
  168. * Camelize a hyphen-delimited string.
  169. */
  170. var camelizeRE = /-(\w)/g;
  171. var camelize = cached(function (str) {
  172. return str.replace(camelizeRE, function (_, c) {
  173. return c ? c.toUpperCase() : '';
  174. });
  175. });
  176. function sortObject(obj) {
  177. var sortObj = {};
  178. if (isPlainObject(obj)) {
  179. Object.keys(obj).sort().forEach(function (key) {
  180. sortObj[key] = obj[key];
  181. });
  182. }
  183. return !Object.keys(sortObj) ? obj : sortObj;
  184. }
  185. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  186. var globalInterceptors = {};
  187. var scopedInterceptors = {};
  188. function mergeHook(parentVal, childVal) {
  189. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  190. return res ? dedupeHooks(res) : res;
  191. }
  192. function dedupeHooks(hooks) {
  193. var res = [];
  194. for (var i = 0; i < hooks.length; i++) {
  195. if (res.indexOf(hooks[i]) === -1) {
  196. res.push(hooks[i]);
  197. }
  198. }
  199. return res;
  200. }
  201. function removeHook(hooks, hook) {
  202. var index = hooks.indexOf(hook);
  203. if (index !== -1) {
  204. hooks.splice(index, 1);
  205. }
  206. }
  207. function mergeInterceptorHook(interceptor, option) {
  208. Object.keys(option).forEach(function (hook) {
  209. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  210. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  211. }
  212. });
  213. }
  214. function removeInterceptorHook(interceptor, option) {
  215. if (!interceptor || !option) {
  216. return;
  217. }
  218. Object.keys(option).forEach(function (hook) {
  219. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  220. removeHook(interceptor[hook], option[hook]);
  221. }
  222. });
  223. }
  224. function addInterceptor(method, option) {
  225. if (typeof method === 'string' && isPlainObject(option)) {
  226. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  227. } else if (isPlainObject(method)) {
  228. mergeInterceptorHook(globalInterceptors, method);
  229. }
  230. }
  231. function removeInterceptor(method, option) {
  232. if (typeof method === 'string') {
  233. if (isPlainObject(option)) {
  234. removeInterceptorHook(scopedInterceptors[method], option);
  235. } else {
  236. delete scopedInterceptors[method];
  237. }
  238. } else if (isPlainObject(method)) {
  239. removeInterceptorHook(globalInterceptors, method);
  240. }
  241. }
  242. function wrapperHook(hook, params) {
  243. return function (data) {
  244. return hook(data, params) || data;
  245. };
  246. }
  247. function isPromise(obj) {
  248. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  249. }
  250. function queue(hooks, data, params) {
  251. var promise = false;
  252. for (var i = 0; i < hooks.length; i++) {
  253. var hook = hooks[i];
  254. if (promise) {
  255. promise = Promise.resolve(wrapperHook(hook, params));
  256. } else {
  257. var res = hook(data, params);
  258. if (isPromise(res)) {
  259. promise = Promise.resolve(res);
  260. }
  261. if (res === false) {
  262. return {
  263. then: function then() {}
  264. };
  265. }
  266. }
  267. }
  268. return promise || {
  269. then: function then(callback) {
  270. return callback(data);
  271. }
  272. };
  273. }
  274. function wrapperOptions(interceptor) {
  275. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  276. ['success', 'fail', 'complete'].forEach(function (name) {
  277. if (Array.isArray(interceptor[name])) {
  278. var oldCallback = options[name];
  279. options[name] = function callbackInterceptor(res) {
  280. queue(interceptor[name], res, options).then(function (res) {
  281. /* eslint-disable no-mixed-operators */
  282. return isFn(oldCallback) && oldCallback(res) || res;
  283. });
  284. };
  285. }
  286. });
  287. return options;
  288. }
  289. function wrapperReturnValue(method, returnValue) {
  290. var returnValueHooks = [];
  291. if (Array.isArray(globalInterceptors.returnValue)) {
  292. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  293. }
  294. var interceptor = scopedInterceptors[method];
  295. if (interceptor && Array.isArray(interceptor.returnValue)) {
  296. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  297. }
  298. returnValueHooks.forEach(function (hook) {
  299. returnValue = hook(returnValue) || returnValue;
  300. });
  301. return returnValue;
  302. }
  303. function getApiInterceptorHooks(method) {
  304. var interceptor = Object.create(null);
  305. Object.keys(globalInterceptors).forEach(function (hook) {
  306. if (hook !== 'returnValue') {
  307. interceptor[hook] = globalInterceptors[hook].slice();
  308. }
  309. });
  310. var scopedInterceptor = scopedInterceptors[method];
  311. if (scopedInterceptor) {
  312. Object.keys(scopedInterceptor).forEach(function (hook) {
  313. if (hook !== 'returnValue') {
  314. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  315. }
  316. });
  317. }
  318. return interceptor;
  319. }
  320. function invokeApi(method, api, options) {
  321. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  322. params[_key - 3] = arguments[_key];
  323. }
  324. var interceptor = getApiInterceptorHooks(method);
  325. if (interceptor && Object.keys(interceptor).length) {
  326. if (Array.isArray(interceptor.invoke)) {
  327. var res = queue(interceptor.invoke, options);
  328. return res.then(function (options) {
  329. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  330. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  331. });
  332. } else {
  333. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  334. }
  335. }
  336. return api.apply(void 0, [options].concat(params));
  337. }
  338. var promiseInterceptor = {
  339. returnValue: function returnValue(res) {
  340. if (!isPromise(res)) {
  341. return res;
  342. }
  343. return new Promise(function (resolve, reject) {
  344. res.then(function (res) {
  345. if (res[0]) {
  346. reject(res[0]);
  347. } else {
  348. resolve(res[1]);
  349. }
  350. });
  351. });
  352. }
  353. };
  354. var SYNC_API_RE = /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting|initUTS|requireUTS|registerUTS/;
  355. var CONTEXT_API_RE = /^create|Manager$/;
  356. // Context例外情况
  357. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  358. // 同步例外情况
  359. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  360. var CALLBACK_API_RE = /^on|^off/;
  361. function isContextApi(name) {
  362. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  363. }
  364. function isSyncApi(name) {
  365. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  366. }
  367. function isCallbackApi(name) {
  368. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  369. }
  370. function handlePromise(promise) {
  371. return promise.then(function (data) {
  372. return [null, data];
  373. }).catch(function (err) {
  374. return [err];
  375. });
  376. }
  377. function shouldPromise(name) {
  378. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  379. return false;
  380. }
  381. return true;
  382. }
  383. /* eslint-disable no-extend-native */
  384. if (!Promise.prototype.finally) {
  385. Promise.prototype.finally = function (callback) {
  386. var promise = this.constructor;
  387. return this.then(function (value) {
  388. return promise.resolve(callback()).then(function () {
  389. return value;
  390. });
  391. }, function (reason) {
  392. return promise.resolve(callback()).then(function () {
  393. throw reason;
  394. });
  395. });
  396. };
  397. }
  398. function promisify(name, api) {
  399. if (!shouldPromise(name) || !isFn(api)) {
  400. return api;
  401. }
  402. return function promiseApi() {
  403. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  404. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  405. params[_key2 - 1] = arguments[_key2];
  406. }
  407. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  408. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  409. }
  410. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  411. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  412. success: resolve,
  413. fail: reject
  414. })].concat(params));
  415. })));
  416. };
  417. }
  418. var EPS = 1e-4;
  419. var BASE_DEVICE_WIDTH = 750;
  420. var isIOS = false;
  421. var deviceWidth = 0;
  422. var deviceDPR = 0;
  423. function checkDeviceWidth() {
  424. var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
  425. platform = _wx$getSystemInfoSync.platform,
  426. pixelRatio = _wx$getSystemInfoSync.pixelRatio,
  427. windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  428. deviceWidth = windowWidth;
  429. deviceDPR = pixelRatio;
  430. isIOS = platform === 'ios';
  431. }
  432. function upx2px(number, newDeviceWidth) {
  433. if (deviceWidth === 0) {
  434. checkDeviceWidth();
  435. }
  436. number = Number(number);
  437. if (number === 0) {
  438. return 0;
  439. }
  440. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  441. if (result < 0) {
  442. result = -result;
  443. }
  444. result = Math.floor(result + EPS);
  445. if (result === 0) {
  446. if (deviceDPR === 1 || !isIOS) {
  447. result = 1;
  448. } else {
  449. result = 0.5;
  450. }
  451. }
  452. return number < 0 ? -result : result;
  453. }
  454. var LOCALE_ZH_HANS = 'zh-Hans';
  455. var LOCALE_ZH_HANT = 'zh-Hant';
  456. var LOCALE_EN = 'en';
  457. var LOCALE_FR = 'fr';
  458. var LOCALE_ES = 'es';
  459. var messages = {};
  460. var locale;
  461. {
  462. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  463. }
  464. function initI18nMessages() {
  465. if (!isEnableLocale()) {
  466. return;
  467. }
  468. var localeKeys = Object.keys(__uniConfig.locales);
  469. if (localeKeys.length) {
  470. localeKeys.forEach(function (locale) {
  471. var curMessages = messages[locale];
  472. var userMessages = __uniConfig.locales[locale];
  473. if (curMessages) {
  474. Object.assign(curMessages, userMessages);
  475. } else {
  476. messages[locale] = userMessages;
  477. }
  478. });
  479. }
  480. }
  481. initI18nMessages();
  482. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  483. var t = i18n.t;
  484. var i18nMixin = i18n.mixin = {
  485. beforeCreate: function beforeCreate() {
  486. var _this = this;
  487. var unwatch = i18n.i18n.watchLocale(function () {
  488. _this.$forceUpdate();
  489. });
  490. this.$once('hook:beforeDestroy', function () {
  491. unwatch();
  492. });
  493. },
  494. methods: {
  495. $$t: function $$t(key, values) {
  496. return t(key, values);
  497. }
  498. }
  499. };
  500. var setLocale = i18n.setLocale;
  501. var getLocale = i18n.getLocale;
  502. function initAppLocale(Vue, appVm, locale) {
  503. var state = Vue.observable({
  504. locale: locale || i18n.getLocale()
  505. });
  506. var localeWatchers = [];
  507. appVm.$watchLocale = function (fn) {
  508. localeWatchers.push(fn);
  509. };
  510. Object.defineProperty(appVm, '$locale', {
  511. get: function get() {
  512. return state.locale;
  513. },
  514. set: function set(v) {
  515. state.locale = v;
  516. localeWatchers.forEach(function (watch) {
  517. return watch(v);
  518. });
  519. }
  520. });
  521. }
  522. function isEnableLocale() {
  523. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  524. }
  525. function include(str, parts) {
  526. return !!parts.find(function (part) {
  527. return str.indexOf(part) !== -1;
  528. });
  529. }
  530. function startsWith(str, parts) {
  531. return parts.find(function (part) {
  532. return str.indexOf(part) === 0;
  533. });
  534. }
  535. function normalizeLocale(locale, messages) {
  536. if (!locale) {
  537. return;
  538. }
  539. locale = locale.trim().replace(/_/g, '-');
  540. if (messages && messages[locale]) {
  541. return locale;
  542. }
  543. locale = locale.toLowerCase();
  544. if (locale === 'chinese') {
  545. // 支付宝
  546. return LOCALE_ZH_HANS;
  547. }
  548. if (locale.indexOf('zh') === 0) {
  549. if (locale.indexOf('-hans') > -1) {
  550. return LOCALE_ZH_HANS;
  551. }
  552. if (locale.indexOf('-hant') > -1) {
  553. return LOCALE_ZH_HANT;
  554. }
  555. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  556. return LOCALE_ZH_HANT;
  557. }
  558. return LOCALE_ZH_HANS;
  559. }
  560. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  561. if (lang) {
  562. return lang;
  563. }
  564. }
  565. // export function initI18n() {
  566. // const localeKeys = Object.keys(__uniConfig.locales || {})
  567. // if (localeKeys.length) {
  568. // localeKeys.forEach((locale) =>
  569. // i18n.add(locale, __uniConfig.locales[locale])
  570. // )
  571. // }
  572. // }
  573. function getLocale$1() {
  574. // 优先使用 $locale
  575. if (isFn(getApp)) {
  576. var app = getApp({
  577. allowDefault: true
  578. });
  579. if (app && app.$vm) {
  580. return app.$vm.$locale;
  581. }
  582. }
  583. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  584. }
  585. function setLocale$1(locale) {
  586. var app = isFn(getApp) ? getApp() : false;
  587. if (!app) {
  588. return false;
  589. }
  590. var oldLocale = app.$vm.$locale;
  591. if (oldLocale !== locale) {
  592. app.$vm.$locale = locale;
  593. onLocaleChangeCallbacks.forEach(function (fn) {
  594. return fn({
  595. locale: locale
  596. });
  597. });
  598. return true;
  599. }
  600. return false;
  601. }
  602. var onLocaleChangeCallbacks = [];
  603. function onLocaleChange(fn) {
  604. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  605. onLocaleChangeCallbacks.push(fn);
  606. }
  607. }
  608. if (typeof global !== 'undefined') {
  609. global.getLocale = getLocale$1;
  610. }
  611. var interceptors = {
  612. promiseInterceptor: promiseInterceptor
  613. };
  614. var baseApi = /*#__PURE__*/Object.freeze({
  615. __proto__: null,
  616. upx2px: upx2px,
  617. getLocale: getLocale$1,
  618. setLocale: setLocale$1,
  619. onLocaleChange: onLocaleChange,
  620. addInterceptor: addInterceptor,
  621. removeInterceptor: removeInterceptor,
  622. interceptors: interceptors
  623. });
  624. function findExistsPageIndex(url) {
  625. var pages = getCurrentPages();
  626. var len = pages.length;
  627. while (len--) {
  628. var page = pages[len];
  629. if (page.$page && page.$page.fullPath === url) {
  630. return len;
  631. }
  632. }
  633. return -1;
  634. }
  635. var redirectTo = {
  636. name: function name(fromArgs) {
  637. if (fromArgs.exists === 'back' && fromArgs.delta) {
  638. return 'navigateBack';
  639. }
  640. return 'redirectTo';
  641. },
  642. args: function args(fromArgs) {
  643. if (fromArgs.exists === 'back' && fromArgs.url) {
  644. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  645. if (existsPageIndex !== -1) {
  646. var delta = getCurrentPages().length - 1 - existsPageIndex;
  647. if (delta > 0) {
  648. fromArgs.delta = delta;
  649. }
  650. }
  651. }
  652. }
  653. };
  654. var previewImage = {
  655. args: function args(fromArgs) {
  656. var currentIndex = parseInt(fromArgs.current);
  657. if (isNaN(currentIndex)) {
  658. return;
  659. }
  660. var urls = fromArgs.urls;
  661. if (!Array.isArray(urls)) {
  662. return;
  663. }
  664. var len = urls.length;
  665. if (!len) {
  666. return;
  667. }
  668. if (currentIndex < 0) {
  669. currentIndex = 0;
  670. } else if (currentIndex >= len) {
  671. currentIndex = len - 1;
  672. }
  673. if (currentIndex > 0) {
  674. fromArgs.current = urls[currentIndex];
  675. fromArgs.urls = urls.filter(function (item, index) {
  676. return index < currentIndex ? item !== urls[currentIndex] : true;
  677. });
  678. } else {
  679. fromArgs.current = urls[0];
  680. }
  681. return {
  682. indicator: false,
  683. loop: false
  684. };
  685. }
  686. };
  687. var UUID_KEY = '__DC_STAT_UUID';
  688. var deviceId;
  689. function useDeviceId(result) {
  690. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  691. if (!deviceId) {
  692. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  693. wx.setStorage({
  694. key: UUID_KEY,
  695. data: deviceId
  696. });
  697. }
  698. result.deviceId = deviceId;
  699. }
  700. function addSafeAreaInsets(result) {
  701. if (result.safeArea) {
  702. var safeArea = result.safeArea;
  703. result.safeAreaInsets = {
  704. top: safeArea.top,
  705. left: safeArea.left,
  706. right: result.windowWidth - safeArea.right,
  707. bottom: result.screenHeight - safeArea.bottom
  708. };
  709. }
  710. }
  711. function populateParameters(result) {
  712. var _result$brand = result.brand,
  713. brand = _result$brand === void 0 ? '' : _result$brand,
  714. _result$model = result.model,
  715. model = _result$model === void 0 ? '' : _result$model,
  716. _result$system = result.system,
  717. system = _result$system === void 0 ? '' : _result$system,
  718. _result$language = result.language,
  719. language = _result$language === void 0 ? '' : _result$language,
  720. theme = result.theme,
  721. version = result.version,
  722. platform = result.platform,
  723. fontSizeSetting = result.fontSizeSetting,
  724. SDKVersion = result.SDKVersion,
  725. pixelRatio = result.pixelRatio,
  726. deviceOrientation = result.deviceOrientation;
  727. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  728. var extraParam = {};
  729. // osName osVersion
  730. var osName = '';
  731. var osVersion = '';
  732. {
  733. osName = system.split(' ')[0] || '';
  734. osVersion = system.split(' ')[1] || '';
  735. }
  736. var hostVersion = version;
  737. // deviceType
  738. var deviceType = getGetDeviceType(result, model);
  739. // deviceModel
  740. var deviceBrand = getDeviceBrand(brand);
  741. // hostName
  742. var _hostName = getHostName(result);
  743. // deviceOrientation
  744. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  745. // devicePixelRatio
  746. var _devicePixelRatio = pixelRatio;
  747. // SDKVersion
  748. var _SDKVersion = SDKVersion;
  749. // hostLanguage
  750. var hostLanguage = language.replace(/_/g, '-');
  751. // wx.getAccountInfoSync
  752. var parameters = {
  753. appId: "__UNI__C0ABCC1",
  754. appName: "chargingPile",
  755. appVersion: "1.0.0",
  756. appVersionCode: "100",
  757. appLanguage: getAppLanguage(hostLanguage),
  758. uniCompileVersion: "4.29",
  759. uniRuntimeVersion: "4.29",
  760. uniPlatform: undefined || "mp-weixin",
  761. deviceBrand: deviceBrand,
  762. deviceModel: model,
  763. deviceType: deviceType,
  764. devicePixelRatio: _devicePixelRatio,
  765. deviceOrientation: _deviceOrientation,
  766. osName: osName.toLocaleLowerCase(),
  767. osVersion: osVersion,
  768. hostTheme: theme,
  769. hostVersion: hostVersion,
  770. hostLanguage: hostLanguage,
  771. hostName: _hostName,
  772. hostSDKVersion: _SDKVersion,
  773. hostFontSizeSetting: fontSizeSetting,
  774. windowTop: 0,
  775. windowBottom: 0,
  776. // TODO
  777. osLanguage: undefined,
  778. osTheme: undefined,
  779. ua: undefined,
  780. hostPackageName: undefined,
  781. browserName: undefined,
  782. browserVersion: undefined
  783. };
  784. Object.assign(result, parameters, extraParam);
  785. }
  786. function getGetDeviceType(result, model) {
  787. var deviceType = result.deviceType || 'phone';
  788. {
  789. var deviceTypeMaps = {
  790. ipad: 'pad',
  791. windows: 'pc',
  792. mac: 'pc'
  793. };
  794. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  795. var _model = model.toLocaleLowerCase();
  796. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  797. var _m = deviceTypeMapsKeys[index];
  798. if (_model.indexOf(_m) !== -1) {
  799. deviceType = deviceTypeMaps[_m];
  800. break;
  801. }
  802. }
  803. }
  804. return deviceType;
  805. }
  806. function getDeviceBrand(brand) {
  807. var deviceBrand = brand;
  808. if (deviceBrand) {
  809. deviceBrand = brand.toLocaleLowerCase();
  810. }
  811. return deviceBrand;
  812. }
  813. function getAppLanguage(defaultLanguage) {
  814. return getLocale$1 ? getLocale$1() : defaultLanguage;
  815. }
  816. function getHostName(result) {
  817. var _platform = 'WeChat';
  818. var _hostName = result.hostName || _platform; // mp-jd
  819. {
  820. if (result.environment) {
  821. _hostName = result.environment;
  822. } else if (result.host && result.host.env) {
  823. _hostName = result.host.env;
  824. }
  825. }
  826. return _hostName;
  827. }
  828. var getSystemInfo = {
  829. returnValue: function returnValue(result) {
  830. useDeviceId(result);
  831. addSafeAreaInsets(result);
  832. populateParameters(result);
  833. }
  834. };
  835. var showActionSheet = {
  836. args: function args(fromArgs) {
  837. if ((0, _typeof2.default)(fromArgs) === 'object') {
  838. fromArgs.alertText = fromArgs.title;
  839. }
  840. }
  841. };
  842. var getAppBaseInfo = {
  843. returnValue: function returnValue(result) {
  844. var _result = result,
  845. version = _result.version,
  846. language = _result.language,
  847. SDKVersion = _result.SDKVersion,
  848. theme = _result.theme;
  849. var _hostName = getHostName(result);
  850. var hostLanguage = language.replace('_', '-');
  851. result = sortObject(Object.assign(result, {
  852. appId: "__UNI__C0ABCC1",
  853. appName: "chargingPile",
  854. appVersion: "1.0.0",
  855. appVersionCode: "100",
  856. appLanguage: getAppLanguage(hostLanguage),
  857. hostVersion: version,
  858. hostLanguage: hostLanguage,
  859. hostName: _hostName,
  860. hostSDKVersion: SDKVersion,
  861. hostTheme: theme
  862. }));
  863. }
  864. };
  865. var getDeviceInfo = {
  866. returnValue: function returnValue(result) {
  867. var _result2 = result,
  868. brand = _result2.brand,
  869. model = _result2.model;
  870. var deviceType = getGetDeviceType(result, model);
  871. var deviceBrand = getDeviceBrand(brand);
  872. useDeviceId(result);
  873. result = sortObject(Object.assign(result, {
  874. deviceType: deviceType,
  875. deviceBrand: deviceBrand,
  876. deviceModel: model
  877. }));
  878. }
  879. };
  880. var getWindowInfo = {
  881. returnValue: function returnValue(result) {
  882. addSafeAreaInsets(result);
  883. result = sortObject(Object.assign(result, {
  884. windowTop: 0,
  885. windowBottom: 0
  886. }));
  887. }
  888. };
  889. var getAppAuthorizeSetting = {
  890. returnValue: function returnValue(result) {
  891. var locationReducedAccuracy = result.locationReducedAccuracy;
  892. result.locationAccuracy = 'unsupported';
  893. if (locationReducedAccuracy === true) {
  894. result.locationAccuracy = 'reduced';
  895. } else if (locationReducedAccuracy === false) {
  896. result.locationAccuracy = 'full';
  897. }
  898. }
  899. };
  900. // import navigateTo from 'uni-helpers/navigate-to'
  901. var compressImage = {
  902. args: function args(fromArgs) {
  903. // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
  904. if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
  905. fromArgs.compressHeight = fromArgs.compressedHeight;
  906. }
  907. if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
  908. fromArgs.compressWidth = fromArgs.compressedWidth;
  909. }
  910. }
  911. };
  912. var protocols = {
  913. redirectTo: redirectTo,
  914. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  915. previewImage: previewImage,
  916. getSystemInfo: getSystemInfo,
  917. getSystemInfoSync: getSystemInfo,
  918. showActionSheet: showActionSheet,
  919. getAppBaseInfo: getAppBaseInfo,
  920. getDeviceInfo: getDeviceInfo,
  921. getWindowInfo: getWindowInfo,
  922. getAppAuthorizeSetting: getAppAuthorizeSetting,
  923. compressImage: compressImage
  924. };
  925. var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
  926. var canIUses = [];
  927. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  928. function processCallback(methodName, method, returnValue) {
  929. return function (res) {
  930. return method(processReturnValue(methodName, res, returnValue));
  931. };
  932. }
  933. function processArgs(methodName, fromArgs) {
  934. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  935. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  936. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  937. if (isPlainObject(fromArgs)) {
  938. // 一般 api 的参数解析
  939. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  940. if (isFn(argsOption)) {
  941. argsOption = argsOption(fromArgs, toArgs) || {};
  942. }
  943. for (var key in fromArgs) {
  944. if (hasOwn(argsOption, key)) {
  945. var keyOption = argsOption[key];
  946. if (isFn(keyOption)) {
  947. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  948. }
  949. if (!keyOption) {
  950. // 不支持的参数
  951. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  952. } else if (isStr(keyOption)) {
  953. // 重写参数 key
  954. toArgs[keyOption] = fromArgs[key];
  955. } else if (isPlainObject(keyOption)) {
  956. // {name:newName,value:value}可重新指定参数 key:value
  957. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  958. }
  959. } else if (CALLBACKS.indexOf(key) !== -1) {
  960. if (isFn(fromArgs[key])) {
  961. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  962. }
  963. } else {
  964. if (!keepFromArgs) {
  965. toArgs[key] = fromArgs[key];
  966. }
  967. }
  968. }
  969. return toArgs;
  970. } else if (isFn(fromArgs)) {
  971. fromArgs = processCallback(methodName, fromArgs, returnValue);
  972. }
  973. return fromArgs;
  974. }
  975. function processReturnValue(methodName, res, returnValue) {
  976. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  977. if (isFn(protocols.returnValue)) {
  978. // 处理通用 returnValue
  979. res = protocols.returnValue(methodName, res);
  980. }
  981. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  982. }
  983. function wrapper(methodName, method) {
  984. if (hasOwn(protocols, methodName)) {
  985. var protocol = protocols[methodName];
  986. if (!protocol) {
  987. // 暂不支持的 api
  988. return function () {
  989. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  990. };
  991. }
  992. return function (arg1, arg2) {
  993. // 目前 api 最多两个参数
  994. var options = protocol;
  995. if (isFn(protocol)) {
  996. options = protocol(arg1);
  997. }
  998. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  999. var args = [arg1];
  1000. if (typeof arg2 !== 'undefined') {
  1001. args.push(arg2);
  1002. }
  1003. if (isFn(options.name)) {
  1004. methodName = options.name(arg1);
  1005. } else if (isStr(options.name)) {
  1006. methodName = options.name;
  1007. }
  1008. var returnValue = wx[methodName].apply(wx, args);
  1009. if (isSyncApi(methodName)) {
  1010. // 同步 api
  1011. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1012. }
  1013. return returnValue;
  1014. };
  1015. }
  1016. return method;
  1017. }
  1018. var todoApis = Object.create(null);
  1019. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  1020. function createTodoApi(name) {
  1021. return function todoApi(_ref) {
  1022. var fail = _ref.fail,
  1023. complete = _ref.complete;
  1024. var res = {
  1025. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  1026. };
  1027. isFn(fail) && fail(res);
  1028. isFn(complete) && complete(res);
  1029. };
  1030. }
  1031. TODOS.forEach(function (name) {
  1032. todoApis[name] = createTodoApi(name);
  1033. });
  1034. var providers = {
  1035. oauth: ['weixin'],
  1036. share: ['weixin'],
  1037. payment: ['wxpay'],
  1038. push: ['weixin']
  1039. };
  1040. function getProvider(_ref2) {
  1041. var service = _ref2.service,
  1042. success = _ref2.success,
  1043. fail = _ref2.fail,
  1044. complete = _ref2.complete;
  1045. var res = false;
  1046. if (providers[service]) {
  1047. res = {
  1048. errMsg: 'getProvider:ok',
  1049. service: service,
  1050. provider: providers[service]
  1051. };
  1052. isFn(success) && success(res);
  1053. } else {
  1054. res = {
  1055. errMsg: 'getProvider:fail service not found'
  1056. };
  1057. isFn(fail) && fail(res);
  1058. }
  1059. isFn(complete) && complete(res);
  1060. }
  1061. var extraApi = /*#__PURE__*/Object.freeze({
  1062. __proto__: null,
  1063. getProvider: getProvider
  1064. });
  1065. var getEmitter = function () {
  1066. var Emitter;
  1067. return function getUniEmitter() {
  1068. if (!Emitter) {
  1069. Emitter = new _vue.default();
  1070. }
  1071. return Emitter;
  1072. };
  1073. }();
  1074. function apply(ctx, method, args) {
  1075. return ctx[method].apply(ctx, args);
  1076. }
  1077. function $on() {
  1078. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  1079. }
  1080. function $off() {
  1081. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  1082. }
  1083. function $once() {
  1084. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  1085. }
  1086. function $emit() {
  1087. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  1088. }
  1089. var eventApi = /*#__PURE__*/Object.freeze({
  1090. __proto__: null,
  1091. $on: $on,
  1092. $off: $off,
  1093. $once: $once,
  1094. $emit: $emit
  1095. });
  1096. /**
  1097. * 框架内 try-catch
  1098. */
  1099. /**
  1100. * 开发者 try-catch
  1101. */
  1102. function tryCatch(fn) {
  1103. return function () {
  1104. try {
  1105. return fn.apply(fn, arguments);
  1106. } catch (e) {
  1107. // TODO
  1108. console.error(e);
  1109. }
  1110. };
  1111. }
  1112. function getApiCallbacks(params) {
  1113. var apiCallbacks = {};
  1114. for (var name in params) {
  1115. var param = params[name];
  1116. if (isFn(param)) {
  1117. apiCallbacks[name] = tryCatch(param);
  1118. delete params[name];
  1119. }
  1120. }
  1121. return apiCallbacks;
  1122. }
  1123. var cid;
  1124. var cidErrMsg;
  1125. var enabled;
  1126. function normalizePushMessage(message) {
  1127. try {
  1128. return JSON.parse(message);
  1129. } catch (e) {}
  1130. return message;
  1131. }
  1132. function invokePushCallback(args) {
  1133. if (args.type === 'enabled') {
  1134. enabled = true;
  1135. } else if (args.type === 'clientId') {
  1136. cid = args.cid;
  1137. cidErrMsg = args.errMsg;
  1138. invokeGetPushCidCallbacks(cid, args.errMsg);
  1139. } else if (args.type === 'pushMsg') {
  1140. var message = {
  1141. type: 'receive',
  1142. data: normalizePushMessage(args.message)
  1143. };
  1144. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  1145. var callback = onPushMessageCallbacks[i];
  1146. callback(message);
  1147. // 该消息已被阻止
  1148. if (message.stopped) {
  1149. break;
  1150. }
  1151. }
  1152. } else if (args.type === 'click') {
  1153. onPushMessageCallbacks.forEach(function (callback) {
  1154. callback({
  1155. type: 'click',
  1156. data: normalizePushMessage(args.message)
  1157. });
  1158. });
  1159. }
  1160. }
  1161. var getPushCidCallbacks = [];
  1162. function invokeGetPushCidCallbacks(cid, errMsg) {
  1163. getPushCidCallbacks.forEach(function (callback) {
  1164. callback(cid, errMsg);
  1165. });
  1166. getPushCidCallbacks.length = 0;
  1167. }
  1168. function getPushClientId(args) {
  1169. if (!isPlainObject(args)) {
  1170. args = {};
  1171. }
  1172. var _getApiCallbacks = getApiCallbacks(args),
  1173. success = _getApiCallbacks.success,
  1174. fail = _getApiCallbacks.fail,
  1175. complete = _getApiCallbacks.complete;
  1176. var hasSuccess = isFn(success);
  1177. var hasFail = isFn(fail);
  1178. var hasComplete = isFn(complete);
  1179. Promise.resolve().then(function () {
  1180. if (typeof enabled === 'undefined') {
  1181. enabled = false;
  1182. cid = '';
  1183. cidErrMsg = 'uniPush is not enabled';
  1184. }
  1185. getPushCidCallbacks.push(function (cid, errMsg) {
  1186. var res;
  1187. if (cid) {
  1188. res = {
  1189. errMsg: 'getPushClientId:ok',
  1190. cid: cid
  1191. };
  1192. hasSuccess && success(res);
  1193. } else {
  1194. res = {
  1195. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  1196. };
  1197. hasFail && fail(res);
  1198. }
  1199. hasComplete && complete(res);
  1200. });
  1201. if (typeof cid !== 'undefined') {
  1202. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1203. }
  1204. });
  1205. }
  1206. var onPushMessageCallbacks = [];
  1207. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1208. var onPushMessage = function onPushMessage(fn) {
  1209. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1210. onPushMessageCallbacks.push(fn);
  1211. }
  1212. };
  1213. var offPushMessage = function offPushMessage(fn) {
  1214. if (!fn) {
  1215. onPushMessageCallbacks.length = 0;
  1216. } else {
  1217. var index = onPushMessageCallbacks.indexOf(fn);
  1218. if (index > -1) {
  1219. onPushMessageCallbacks.splice(index, 1);
  1220. }
  1221. }
  1222. };
  1223. var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
  1224. if (!baseInfo) {
  1225. baseInfo = wx.getSystemInfoSync();
  1226. }
  1227. var host = baseInfo ? baseInfo.host : null;
  1228. var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
  1229. var api = /*#__PURE__*/Object.freeze({
  1230. __proto__: null,
  1231. shareVideoMessage: shareVideoMessage,
  1232. getPushClientId: getPushClientId,
  1233. onPushMessage: onPushMessage,
  1234. offPushMessage: offPushMessage,
  1235. invokePushCallback: invokePushCallback
  1236. });
  1237. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1238. function findVmByVueId(vm, vuePid) {
  1239. var $children = vm.$children;
  1240. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1241. for (var i = $children.length - 1; i >= 0; i--) {
  1242. var childVm = $children[i];
  1243. if (childVm.$scope._$vueId === vuePid) {
  1244. return childVm;
  1245. }
  1246. }
  1247. // 反向递归查找
  1248. var parentVm;
  1249. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1250. parentVm = findVmByVueId($children[_i], vuePid);
  1251. if (parentVm) {
  1252. return parentVm;
  1253. }
  1254. }
  1255. }
  1256. function initBehavior(options) {
  1257. return Behavior(options);
  1258. }
  1259. function isPage() {
  1260. return !!this.route;
  1261. }
  1262. function initRelation(detail) {
  1263. this.triggerEvent('__l', detail);
  1264. }
  1265. function selectAllComponents(mpInstance, selector, $refs) {
  1266. var components = mpInstance.selectAllComponents(selector) || [];
  1267. components.forEach(function (component) {
  1268. var ref = component.dataset.ref;
  1269. $refs[ref] = component.$vm || toSkip(component);
  1270. {
  1271. if (component.dataset.vueGeneric === 'scoped') {
  1272. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1273. selectAllComponents(scopedComponent, selector, $refs);
  1274. });
  1275. }
  1276. }
  1277. });
  1278. }
  1279. function syncRefs(refs, newRefs) {
  1280. var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
  1281. var newKeys = Object.keys(newRefs);
  1282. newKeys.forEach(function (key) {
  1283. var oldValue = refs[key];
  1284. var newValue = newRefs[key];
  1285. if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
  1286. return oldValue.includes(value);
  1287. })) {
  1288. return;
  1289. }
  1290. refs[key] = newValue;
  1291. oldKeys.delete(key);
  1292. });
  1293. oldKeys.forEach(function (key) {
  1294. delete refs[key];
  1295. });
  1296. return refs;
  1297. }
  1298. function initRefs(vm) {
  1299. var mpInstance = vm.$scope;
  1300. var refs = {};
  1301. Object.defineProperty(vm, '$refs', {
  1302. get: function get() {
  1303. var $refs = {};
  1304. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1305. // TODO 暂不考虑 for 中的 scoped
  1306. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
  1307. forComponents.forEach(function (component) {
  1308. var ref = component.dataset.ref;
  1309. if (!$refs[ref]) {
  1310. $refs[ref] = [];
  1311. }
  1312. $refs[ref].push(component.$vm || toSkip(component));
  1313. });
  1314. return syncRefs(refs, $refs);
  1315. }
  1316. });
  1317. }
  1318. function handleLink(event) {
  1319. var _ref3 = event.detail || event.value,
  1320. vuePid = _ref3.vuePid,
  1321. vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
  1322. var parentVm;
  1323. if (vuePid) {
  1324. parentVm = findVmByVueId(this.$vm, vuePid);
  1325. }
  1326. if (!parentVm) {
  1327. parentVm = this.$vm;
  1328. }
  1329. vueOptions.parent = parentVm;
  1330. }
  1331. function markMPComponent(component) {
  1332. // 在 Vue 中标记为小程序组件
  1333. var IS_MP = '__v_isMPComponent';
  1334. Object.defineProperty(component, IS_MP, {
  1335. configurable: true,
  1336. enumerable: false,
  1337. value: true
  1338. });
  1339. return component;
  1340. }
  1341. function toSkip(obj) {
  1342. var OB = '__ob__';
  1343. var SKIP = '__v_skip';
  1344. if (isObject(obj) && Object.isExtensible(obj)) {
  1345. // 避免被 @vue/composition-api 观测
  1346. Object.defineProperty(obj, OB, {
  1347. configurable: true,
  1348. enumerable: false,
  1349. value: (0, _defineProperty2.default)({}, SKIP, true)
  1350. });
  1351. }
  1352. return obj;
  1353. }
  1354. var WORKLET_RE = /_(.*)_worklet_factory_/;
  1355. function initWorkletMethods(mpMethods, vueMethods) {
  1356. if (vueMethods) {
  1357. Object.keys(vueMethods).forEach(function (name) {
  1358. var matches = name.match(WORKLET_RE);
  1359. if (matches) {
  1360. var workletName = matches[1];
  1361. mpMethods[name] = vueMethods[name];
  1362. mpMethods[workletName] = vueMethods[workletName];
  1363. }
  1364. });
  1365. }
  1366. }
  1367. var MPPage = Page;
  1368. var MPComponent = Component;
  1369. var customizeRE = /:/g;
  1370. var customize = cached(function (str) {
  1371. return camelize(str.replace(customizeRE, '-'));
  1372. });
  1373. function initTriggerEvent(mpInstance) {
  1374. var oldTriggerEvent = mpInstance.triggerEvent;
  1375. var newTriggerEvent = function newTriggerEvent(event) {
  1376. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  1377. args[_key3 - 1] = arguments[_key3];
  1378. }
  1379. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  1380. if (this.$vm || this.dataset && this.dataset.comType) {
  1381. event = customize(event);
  1382. } else {
  1383. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  1384. var newEvent = customize(event);
  1385. if (newEvent !== event) {
  1386. oldTriggerEvent.apply(this, [newEvent].concat(args));
  1387. }
  1388. }
  1389. return oldTriggerEvent.apply(this, [event].concat(args));
  1390. };
  1391. try {
  1392. // 京东小程序 triggerEvent 为只读
  1393. mpInstance.triggerEvent = newTriggerEvent;
  1394. } catch (error) {
  1395. mpInstance._triggerEvent = newTriggerEvent;
  1396. }
  1397. }
  1398. function initHook(name, options, isComponent) {
  1399. var oldHook = options[name];
  1400. options[name] = function () {
  1401. markMPComponent(this);
  1402. initTriggerEvent(this);
  1403. if (oldHook) {
  1404. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1405. args[_key4] = arguments[_key4];
  1406. }
  1407. return oldHook.apply(this, args);
  1408. }
  1409. };
  1410. }
  1411. if (!MPPage.__$wrappered) {
  1412. MPPage.__$wrappered = true;
  1413. Page = function Page() {
  1414. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1415. initHook('onLoad', options);
  1416. return MPPage(options);
  1417. };
  1418. Page.after = MPPage.after;
  1419. Component = function Component() {
  1420. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1421. initHook('created', options);
  1422. return MPComponent(options);
  1423. };
  1424. }
  1425. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  1426. function initMocks(vm, mocks) {
  1427. var mpInstance = vm.$mp[vm.mpType];
  1428. mocks.forEach(function (mock) {
  1429. if (hasOwn(mpInstance, mock)) {
  1430. vm[mock] = mpInstance[mock];
  1431. }
  1432. });
  1433. }
  1434. function hasHook(hook, vueOptions) {
  1435. if (!vueOptions) {
  1436. return true;
  1437. }
  1438. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1439. return true;
  1440. }
  1441. vueOptions = vueOptions.default || vueOptions;
  1442. if (isFn(vueOptions)) {
  1443. if (isFn(vueOptions.extendOptions[hook])) {
  1444. return true;
  1445. }
  1446. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  1447. return true;
  1448. }
  1449. return false;
  1450. }
  1451. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  1452. return true;
  1453. }
  1454. var mixins = vueOptions.mixins;
  1455. if (Array.isArray(mixins)) {
  1456. return !!mixins.find(function (mixin) {
  1457. return hasHook(hook, mixin);
  1458. });
  1459. }
  1460. }
  1461. function initHooks(mpOptions, hooks, vueOptions) {
  1462. hooks.forEach(function (hook) {
  1463. if (hasHook(hook, vueOptions)) {
  1464. mpOptions[hook] = function (args) {
  1465. return this.$vm && this.$vm.__call_hook(hook, args);
  1466. };
  1467. }
  1468. });
  1469. }
  1470. function initUnknownHooks(mpOptions, vueOptions) {
  1471. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1472. findHooks(vueOptions).forEach(function (hook) {
  1473. return initHook$1(mpOptions, hook, excludes);
  1474. });
  1475. }
  1476. function findHooks(vueOptions) {
  1477. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1478. if (vueOptions) {
  1479. Object.keys(vueOptions).forEach(function (name) {
  1480. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  1481. hooks.push(name);
  1482. }
  1483. });
  1484. }
  1485. return hooks;
  1486. }
  1487. function initHook$1(mpOptions, hook, excludes) {
  1488. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  1489. mpOptions[hook] = function (args) {
  1490. return this.$vm && this.$vm.__call_hook(hook, args);
  1491. };
  1492. }
  1493. }
  1494. function initVueComponent(Vue, vueOptions) {
  1495. vueOptions = vueOptions.default || vueOptions;
  1496. var VueComponent;
  1497. if (isFn(vueOptions)) {
  1498. VueComponent = vueOptions;
  1499. } else {
  1500. VueComponent = Vue.extend(vueOptions);
  1501. }
  1502. vueOptions = VueComponent.options;
  1503. return [VueComponent, vueOptions];
  1504. }
  1505. function initSlots(vm, vueSlots) {
  1506. if (Array.isArray(vueSlots) && vueSlots.length) {
  1507. var $slots = Object.create(null);
  1508. vueSlots.forEach(function (slotName) {
  1509. $slots[slotName] = true;
  1510. });
  1511. vm.$scopedSlots = vm.$slots = $slots;
  1512. }
  1513. }
  1514. function initVueIds(vueIds, mpInstance) {
  1515. vueIds = (vueIds || '').split(',');
  1516. var len = vueIds.length;
  1517. if (len === 1) {
  1518. mpInstance._$vueId = vueIds[0];
  1519. } else if (len === 2) {
  1520. mpInstance._$vueId = vueIds[0];
  1521. mpInstance._$vuePid = vueIds[1];
  1522. }
  1523. }
  1524. function initData(vueOptions, context) {
  1525. var data = vueOptions.data || {};
  1526. var methods = vueOptions.methods || {};
  1527. if (typeof data === 'function') {
  1528. try {
  1529. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1530. } catch (e) {
  1531. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1532. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1533. }
  1534. }
  1535. } else {
  1536. try {
  1537. // 对 data 格式化
  1538. data = JSON.parse(JSON.stringify(data));
  1539. } catch (e) {}
  1540. }
  1541. if (!isPlainObject(data)) {
  1542. data = {};
  1543. }
  1544. Object.keys(methods).forEach(function (methodName) {
  1545. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1546. data[methodName] = methods[methodName];
  1547. }
  1548. });
  1549. return data;
  1550. }
  1551. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1552. function createObserver(name) {
  1553. return function observer(newVal, oldVal) {
  1554. if (this.$vm) {
  1555. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1556. }
  1557. };
  1558. }
  1559. function initBehaviors(vueOptions, initBehavior) {
  1560. var vueBehaviors = vueOptions.behaviors;
  1561. var vueExtends = vueOptions.extends;
  1562. var vueMixins = vueOptions.mixins;
  1563. var vueProps = vueOptions.props;
  1564. if (!vueProps) {
  1565. vueOptions.props = vueProps = [];
  1566. }
  1567. var behaviors = [];
  1568. if (Array.isArray(vueBehaviors)) {
  1569. vueBehaviors.forEach(function (behavior) {
  1570. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1571. if (behavior === 'uni://form-field') {
  1572. if (Array.isArray(vueProps)) {
  1573. vueProps.push('name');
  1574. vueProps.push('value');
  1575. } else {
  1576. vueProps.name = {
  1577. type: String,
  1578. default: ''
  1579. };
  1580. vueProps.value = {
  1581. type: [String, Number, Boolean, Array, Object, Date],
  1582. default: ''
  1583. };
  1584. }
  1585. }
  1586. });
  1587. }
  1588. if (isPlainObject(vueExtends) && vueExtends.props) {
  1589. behaviors.push(initBehavior({
  1590. properties: initProperties(vueExtends.props, true)
  1591. }));
  1592. }
  1593. if (Array.isArray(vueMixins)) {
  1594. vueMixins.forEach(function (vueMixin) {
  1595. if (isPlainObject(vueMixin) && vueMixin.props) {
  1596. behaviors.push(initBehavior({
  1597. properties: initProperties(vueMixin.props, true)
  1598. }));
  1599. }
  1600. });
  1601. }
  1602. return behaviors;
  1603. }
  1604. function parsePropType(key, type, defaultValue, file) {
  1605. // [String]=>String
  1606. if (Array.isArray(type) && type.length === 1) {
  1607. return type[0];
  1608. }
  1609. return type;
  1610. }
  1611. function initProperties(props) {
  1612. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1613. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  1614. var options = arguments.length > 3 ? arguments[3] : undefined;
  1615. var properties = {};
  1616. if (!isBehavior) {
  1617. properties.vueId = {
  1618. type: String,
  1619. value: ''
  1620. };
  1621. {
  1622. if (options.virtualHost) {
  1623. properties.virtualHostStyle = {
  1624. type: null,
  1625. value: ''
  1626. };
  1627. properties.virtualHostClass = {
  1628. type: null,
  1629. value: ''
  1630. };
  1631. }
  1632. }
  1633. // scopedSlotsCompiler auto
  1634. properties.scopedSlotsCompiler = {
  1635. type: String,
  1636. value: ''
  1637. };
  1638. properties.vueSlots = {
  1639. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1640. type: null,
  1641. value: [],
  1642. observer: function observer(newVal, oldVal) {
  1643. var $slots = Object.create(null);
  1644. newVal.forEach(function (slotName) {
  1645. $slots[slotName] = true;
  1646. });
  1647. this.setData({
  1648. $slots: $slots
  1649. });
  1650. }
  1651. };
  1652. }
  1653. if (Array.isArray(props)) {
  1654. // ['title']
  1655. props.forEach(function (key) {
  1656. properties[key] = {
  1657. type: null,
  1658. observer: createObserver(key)
  1659. };
  1660. });
  1661. } else if (isPlainObject(props)) {
  1662. // {title:{type:String,default:''},content:String}
  1663. Object.keys(props).forEach(function (key) {
  1664. var opts = props[key];
  1665. if (isPlainObject(opts)) {
  1666. // title:{type:String,default:''}
  1667. var value = opts.default;
  1668. if (isFn(value)) {
  1669. value = value();
  1670. }
  1671. opts.type = parsePropType(key, opts.type);
  1672. properties[key] = {
  1673. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1674. value: value,
  1675. observer: createObserver(key)
  1676. };
  1677. } else {
  1678. // content:String
  1679. var type = parsePropType(key, opts);
  1680. properties[key] = {
  1681. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1682. observer: createObserver(key)
  1683. };
  1684. }
  1685. });
  1686. }
  1687. return properties;
  1688. }
  1689. function wrapper$1(event) {
  1690. // TODO 又得兼容 mpvue 的 mp 对象
  1691. try {
  1692. event.mp = JSON.parse(JSON.stringify(event));
  1693. } catch (e) {}
  1694. event.stopPropagation = noop;
  1695. event.preventDefault = noop;
  1696. event.target = event.target || {};
  1697. if (!hasOwn(event, 'detail')) {
  1698. event.detail = {};
  1699. }
  1700. if (hasOwn(event, 'markerId')) {
  1701. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  1702. event.detail.markerId = event.markerId;
  1703. }
  1704. if (isPlainObject(event.detail)) {
  1705. event.target = Object.assign({}, event.target, event.detail);
  1706. }
  1707. return event;
  1708. }
  1709. function getExtraValue(vm, dataPathsArray) {
  1710. var context = vm;
  1711. dataPathsArray.forEach(function (dataPathArray) {
  1712. var dataPath = dataPathArray[0];
  1713. var value = dataPathArray[2];
  1714. if (dataPath || typeof value !== 'undefined') {
  1715. // ['','',index,'disable']
  1716. var propPath = dataPathArray[1];
  1717. var valuePath = dataPathArray[3];
  1718. var vFor;
  1719. if (Number.isInteger(dataPath)) {
  1720. vFor = dataPath;
  1721. } else if (!dataPath) {
  1722. vFor = context;
  1723. } else if (typeof dataPath === 'string' && dataPath) {
  1724. if (dataPath.indexOf('#s#') === 0) {
  1725. vFor = dataPath.substr(3);
  1726. } else {
  1727. vFor = vm.__get_value(dataPath, context);
  1728. }
  1729. }
  1730. if (Number.isInteger(vFor)) {
  1731. context = value;
  1732. } else if (!propPath) {
  1733. context = vFor[value];
  1734. } else {
  1735. if (Array.isArray(vFor)) {
  1736. context = vFor.find(function (vForItem) {
  1737. return vm.__get_value(propPath, vForItem) === value;
  1738. });
  1739. } else if (isPlainObject(vFor)) {
  1740. context = Object.keys(vFor).find(function (vForKey) {
  1741. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1742. });
  1743. } else {
  1744. console.error('v-for 暂不支持循环数据:', vFor);
  1745. }
  1746. }
  1747. if (valuePath) {
  1748. context = vm.__get_value(valuePath, context);
  1749. }
  1750. }
  1751. });
  1752. return context;
  1753. }
  1754. function processEventExtra(vm, extra, event, __args__) {
  1755. var extraObj = {};
  1756. if (Array.isArray(extra) && extra.length) {
  1757. /**
  1758. *[
  1759. * ['data.items', 'data.id', item.data.id],
  1760. * ['metas', 'id', meta.id]
  1761. *],
  1762. *[
  1763. * ['data.items', 'data.id', item.data.id],
  1764. * ['metas', 'id', meta.id]
  1765. *],
  1766. *'test'
  1767. */
  1768. extra.forEach(function (dataPath, index) {
  1769. if (typeof dataPath === 'string') {
  1770. if (!dataPath) {
  1771. // model,prop.sync
  1772. extraObj['$' + index] = vm;
  1773. } else {
  1774. if (dataPath === '$event') {
  1775. // $event
  1776. extraObj['$' + index] = event;
  1777. } else if (dataPath === 'arguments') {
  1778. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  1779. } else if (dataPath.indexOf('$event.') === 0) {
  1780. // $event.target.value
  1781. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1782. } else {
  1783. extraObj['$' + index] = vm.__get_value(dataPath);
  1784. }
  1785. }
  1786. } else {
  1787. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1788. }
  1789. });
  1790. }
  1791. return extraObj;
  1792. }
  1793. function getObjByArray(arr) {
  1794. var obj = {};
  1795. for (var i = 1; i < arr.length; i++) {
  1796. var element = arr[i];
  1797. obj[element[0]] = element[1];
  1798. }
  1799. return obj;
  1800. }
  1801. function processEventArgs(vm, event) {
  1802. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1803. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  1804. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  1805. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1806. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1807. // fixed 用户直接触发 mpInstance.triggerEvent
  1808. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  1809. if (isCustom) {
  1810. // 自定义事件
  1811. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  1812. if (!args.length) {
  1813. // 无参数,直接传入 event 或 detail 数组
  1814. if (isCustomMPEvent) {
  1815. return [event];
  1816. }
  1817. return __args__;
  1818. }
  1819. }
  1820. var extraObj = processEventExtra(vm, extra, event, __args__);
  1821. var ret = [];
  1822. args.forEach(function (arg) {
  1823. if (arg === '$event') {
  1824. if (methodName === '__set_model' && !isCustom) {
  1825. // input v-model value
  1826. ret.push(event.target.value);
  1827. } else {
  1828. if (isCustom && !isCustomMPEvent) {
  1829. ret.push(__args__[0]);
  1830. } else {
  1831. // wxcomponent 组件或内置组件
  1832. ret.push(event);
  1833. }
  1834. }
  1835. } else {
  1836. if (Array.isArray(arg) && arg[0] === 'o') {
  1837. ret.push(getObjByArray(arg));
  1838. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1839. ret.push(extraObj[arg]);
  1840. } else {
  1841. ret.push(arg);
  1842. }
  1843. }
  1844. });
  1845. return ret;
  1846. }
  1847. var ONCE = '~';
  1848. var CUSTOM = '^';
  1849. function isMatchEventType(eventType, optType) {
  1850. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  1851. }
  1852. function getContextVm(vm) {
  1853. var $parent = vm.$parent;
  1854. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1855. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1856. $parent = $parent.$parent;
  1857. }
  1858. return $parent && $parent.$parent;
  1859. }
  1860. function handleEvent(event) {
  1861. var _this2 = this;
  1862. event = wrapper$1(event);
  1863. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1864. var dataset = (event.currentTarget || event.target).dataset;
  1865. if (!dataset) {
  1866. return console.warn('事件信息不存在');
  1867. }
  1868. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1869. if (!eventOpts) {
  1870. return console.warn('事件信息不存在');
  1871. }
  1872. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1873. var eventType = event.type;
  1874. var ret = [];
  1875. eventOpts.forEach(function (eventOpt) {
  1876. var type = eventOpt[0];
  1877. var eventsArray = eventOpt[1];
  1878. var isCustom = type.charAt(0) === CUSTOM;
  1879. type = isCustom ? type.slice(1) : type;
  1880. var isOnce = type.charAt(0) === ONCE;
  1881. type = isOnce ? type.slice(1) : type;
  1882. if (eventsArray && isMatchEventType(eventType, type)) {
  1883. eventsArray.forEach(function (eventArray) {
  1884. var methodName = eventArray[0];
  1885. if (methodName) {
  1886. var handlerCtx = _this2.$vm;
  1887. if (handlerCtx.$options.generic) {
  1888. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1889. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1890. }
  1891. if (methodName === '$emit') {
  1892. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  1893. return;
  1894. }
  1895. var handler = handlerCtx[methodName];
  1896. if (!isFn(handler)) {
  1897. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  1898. var path = _this2.route || _this2.is;
  1899. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  1900. }
  1901. if (isOnce) {
  1902. if (handler.once) {
  1903. return;
  1904. }
  1905. handler.once = true;
  1906. }
  1907. var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  1908. params = Array.isArray(params) ? params : [];
  1909. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1910. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1911. // eslint-disable-next-line no-sparse-arrays
  1912. params = params.concat([,,,,,,,,,, event]);
  1913. }
  1914. ret.push(handler.apply(handlerCtx, params));
  1915. }
  1916. });
  1917. }
  1918. });
  1919. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  1920. return ret[0];
  1921. }
  1922. }
  1923. var eventChannels = {};
  1924. function getEventChannel(id) {
  1925. var eventChannel = eventChannels[id];
  1926. delete eventChannels[id];
  1927. return eventChannel;
  1928. }
  1929. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  1930. function initEventChannel() {
  1931. _vue.default.prototype.getOpenerEventChannel = function () {
  1932. // 微信小程序使用自身getOpenerEventChannel
  1933. {
  1934. return this.$scope.getOpenerEventChannel();
  1935. }
  1936. };
  1937. var callHook = _vue.default.prototype.__call_hook;
  1938. _vue.default.prototype.__call_hook = function (hook, args) {
  1939. if (hook === 'onLoad' && args && args.__id__) {
  1940. this.__eventChannel__ = getEventChannel(args.__id__);
  1941. delete args.__id__;
  1942. }
  1943. return callHook.call(this, hook, args);
  1944. };
  1945. }
  1946. function initScopedSlotsParams() {
  1947. var center = {};
  1948. var parents = {};
  1949. function currentId(fn) {
  1950. var vueIds = this.$options.propsData.vueId;
  1951. if (vueIds) {
  1952. var vueId = vueIds.split(',')[0];
  1953. fn(vueId);
  1954. }
  1955. }
  1956. _vue.default.prototype.$hasSSP = function (vueId) {
  1957. var slot = center[vueId];
  1958. if (!slot) {
  1959. parents[vueId] = this;
  1960. this.$on('hook:destroyed', function () {
  1961. delete parents[vueId];
  1962. });
  1963. }
  1964. return slot;
  1965. };
  1966. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  1967. var slot = center[vueId];
  1968. if (slot) {
  1969. var params = slot[name] || [];
  1970. if (needAll) {
  1971. return params;
  1972. }
  1973. return params[0];
  1974. }
  1975. };
  1976. _vue.default.prototype.$setSSP = function (name, value) {
  1977. var index = 0;
  1978. currentId.call(this, function (vueId) {
  1979. var slot = center[vueId];
  1980. var params = slot[name] = slot[name] || [];
  1981. params.push(value);
  1982. index = params.length - 1;
  1983. });
  1984. return index;
  1985. };
  1986. _vue.default.prototype.$initSSP = function () {
  1987. currentId.call(this, function (vueId) {
  1988. center[vueId] = {};
  1989. });
  1990. };
  1991. _vue.default.prototype.$callSSP = function () {
  1992. currentId.call(this, function (vueId) {
  1993. if (parents[vueId]) {
  1994. parents[vueId].$forceUpdate();
  1995. }
  1996. });
  1997. };
  1998. _vue.default.mixin({
  1999. destroyed: function destroyed() {
  2000. var propsData = this.$options.propsData;
  2001. var vueId = propsData && propsData.vueId;
  2002. if (vueId) {
  2003. delete center[vueId];
  2004. delete parents[vueId];
  2005. }
  2006. }
  2007. });
  2008. }
  2009. function parseBaseApp(vm, _ref4) {
  2010. var mocks = _ref4.mocks,
  2011. initRefs = _ref4.initRefs;
  2012. initEventChannel();
  2013. {
  2014. initScopedSlotsParams();
  2015. }
  2016. if (vm.$options.store) {
  2017. _vue.default.prototype.$store = vm.$options.store;
  2018. }
  2019. uniIdMixin(_vue.default);
  2020. _vue.default.prototype.mpHost = "mp-weixin";
  2021. _vue.default.mixin({
  2022. beforeCreate: function beforeCreate() {
  2023. if (!this.$options.mpType) {
  2024. return;
  2025. }
  2026. this.mpType = this.$options.mpType;
  2027. this.$mp = (0, _defineProperty2.default)({
  2028. data: {}
  2029. }, this.mpType, this.$options.mpInstance);
  2030. this.$scope = this.$options.mpInstance;
  2031. delete this.$options.mpType;
  2032. delete this.$options.mpInstance;
  2033. if (this.mpType === 'page' && typeof getApp === 'function') {
  2034. // hack vue-i18n
  2035. var app = getApp();
  2036. if (app.$vm && app.$vm.$i18n) {
  2037. this._i18n = app.$vm.$i18n;
  2038. }
  2039. }
  2040. if (this.mpType !== 'app') {
  2041. initRefs(this);
  2042. initMocks(this, mocks);
  2043. }
  2044. }
  2045. });
  2046. var appOptions = {
  2047. onLaunch: function onLaunch(args) {
  2048. if (this.$vm) {
  2049. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  2050. return;
  2051. }
  2052. {
  2053. if (wx.canIUse && !wx.canIUse('nextTick')) {
  2054. // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  2055. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  2056. }
  2057. }
  2058. this.$vm = vm;
  2059. this.$vm.$mp = {
  2060. app: this
  2061. };
  2062. this.$vm.$scope = this;
  2063. // vm 上也挂载 globalData
  2064. this.$vm.globalData = this.globalData;
  2065. this.$vm._isMounted = true;
  2066. this.$vm.__call_hook('mounted', args);
  2067. this.$vm.__call_hook('onLaunch', args);
  2068. }
  2069. };
  2070. // 兼容旧版本 globalData
  2071. appOptions.globalData = vm.$options.globalData || {};
  2072. // 将 methods 中的方法挂在 getApp() 中
  2073. var methods = vm.$options.methods;
  2074. if (methods) {
  2075. Object.keys(methods).forEach(function (name) {
  2076. appOptions[name] = methods[name];
  2077. });
  2078. }
  2079. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  2080. initHooks(appOptions, hooks);
  2081. initUnknownHooks(appOptions, vm.$options);
  2082. return appOptions;
  2083. }
  2084. function parseApp(vm) {
  2085. return parseBaseApp(vm, {
  2086. mocks: mocks,
  2087. initRefs: initRefs
  2088. });
  2089. }
  2090. function createApp(vm) {
  2091. App(parseApp(vm));
  2092. return vm;
  2093. }
  2094. var encodeReserveRE = /[!'()*]/g;
  2095. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  2096. return '%' + c.charCodeAt(0).toString(16);
  2097. };
  2098. var commaRE = /%2C/g;
  2099. // fixed encodeURIComponent which is more conformant to RFC3986:
  2100. // - escapes [!'()*]
  2101. // - preserve commas
  2102. var encode = function encode(str) {
  2103. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  2104. };
  2105. function stringifyQuery(obj) {
  2106. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  2107. var res = obj ? Object.keys(obj).map(function (key) {
  2108. var val = obj[key];
  2109. if (val === undefined) {
  2110. return '';
  2111. }
  2112. if (val === null) {
  2113. return encodeStr(key);
  2114. }
  2115. if (Array.isArray(val)) {
  2116. var result = [];
  2117. val.forEach(function (val2) {
  2118. if (val2 === undefined) {
  2119. return;
  2120. }
  2121. if (val2 === null) {
  2122. result.push(encodeStr(key));
  2123. } else {
  2124. result.push(encodeStr(key) + '=' + encodeStr(val2));
  2125. }
  2126. });
  2127. return result.join('&');
  2128. }
  2129. return encodeStr(key) + '=' + encodeStr(val);
  2130. }).filter(function (x) {
  2131. return x.length > 0;
  2132. }).join('&') : null;
  2133. return res ? "?".concat(res) : '';
  2134. }
  2135. function parseBaseComponent(vueComponentOptions) {
  2136. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  2137. isPage = _ref5.isPage,
  2138. initRelation = _ref5.initRelation;
  2139. var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
  2140. var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
  2141. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  2142. VueComponent = _initVueComponent2[0],
  2143. vueOptions = _initVueComponent2[1];
  2144. var options = _objectSpread({
  2145. multipleSlots: true,
  2146. // styleIsolation: 'apply-shared',
  2147. addGlobalClass: true
  2148. }, vueOptions.options || {});
  2149. {
  2150. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  2151. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  2152. Object.assign(options, vueOptions['mp-weixin'].options);
  2153. }
  2154. }
  2155. var componentOptions = {
  2156. options: options,
  2157. data: initData(vueOptions, _vue.default.prototype),
  2158. behaviors: initBehaviors(vueOptions, initBehavior),
  2159. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  2160. lifetimes: {
  2161. attached: function attached() {
  2162. var properties = this.properties;
  2163. var options = {
  2164. mpType: isPage.call(this) ? 'page' : 'component',
  2165. mpInstance: this,
  2166. propsData: properties
  2167. };
  2168. initVueIds(properties.vueId, this);
  2169. // 处理父子关系
  2170. initRelation.call(this, {
  2171. vuePid: this._$vuePid,
  2172. vueOptions: options
  2173. });
  2174. // 初始化 vue 实例
  2175. this.$vm = new VueComponent(options);
  2176. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  2177. initSlots(this.$vm, properties.vueSlots);
  2178. // 触发首次 setData
  2179. this.$vm.$mount();
  2180. },
  2181. ready: function ready() {
  2182. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  2183. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  2184. if (this.$vm) {
  2185. this.$vm._isMounted = true;
  2186. this.$vm.__call_hook('mounted');
  2187. this.$vm.__call_hook('onReady');
  2188. }
  2189. },
  2190. detached: function detached() {
  2191. this.$vm && this.$vm.$destroy();
  2192. }
  2193. },
  2194. pageLifetimes: {
  2195. show: function show(args) {
  2196. this.$vm && this.$vm.__call_hook('onPageShow', args);
  2197. },
  2198. hide: function hide() {
  2199. this.$vm && this.$vm.__call_hook('onPageHide');
  2200. },
  2201. resize: function resize(size) {
  2202. this.$vm && this.$vm.__call_hook('onPageResize', size);
  2203. }
  2204. },
  2205. methods: {
  2206. __l: handleLink,
  2207. __e: handleEvent
  2208. }
  2209. };
  2210. // externalClasses
  2211. if (vueOptions.externalClasses) {
  2212. componentOptions.externalClasses = vueOptions.externalClasses;
  2213. }
  2214. if (Array.isArray(vueOptions.wxsCallMethods)) {
  2215. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  2216. componentOptions.methods[callMethod] = function (args) {
  2217. return this.$vm[callMethod](args);
  2218. };
  2219. });
  2220. }
  2221. if (needVueOptions) {
  2222. return [componentOptions, vueOptions, VueComponent];
  2223. }
  2224. if (isPage) {
  2225. return componentOptions;
  2226. }
  2227. return [componentOptions, VueComponent];
  2228. }
  2229. function parseComponent(vueComponentOptions, needVueOptions) {
  2230. return parseBaseComponent(vueComponentOptions, {
  2231. isPage: isPage,
  2232. initRelation: initRelation
  2233. }, needVueOptions);
  2234. }
  2235. var hooks$1 = ['onShow', 'onHide', 'onUnload'];
  2236. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  2237. function parseBasePage(vuePageOptions) {
  2238. var _parseComponent = parseComponent(vuePageOptions, true),
  2239. _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
  2240. pageOptions = _parseComponent2[0],
  2241. vueOptions = _parseComponent2[1];
  2242. initHooks(pageOptions.methods, hooks$1, vueOptions);
  2243. pageOptions.methods.onLoad = function (query) {
  2244. this.options = query;
  2245. var copyQuery = Object.assign({}, query);
  2246. delete copyQuery.__id__;
  2247. this.$page = {
  2248. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  2249. };
  2250. this.$vm.$mp.query = query; // 兼容 mpvue
  2251. this.$vm.__call_hook('onLoad', query);
  2252. };
  2253. {
  2254. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  2255. }
  2256. {
  2257. initWorkletMethods(pageOptions.methods, vueOptions.methods);
  2258. }
  2259. return pageOptions;
  2260. }
  2261. function parsePage(vuePageOptions) {
  2262. return parseBasePage(vuePageOptions);
  2263. }
  2264. function createPage(vuePageOptions) {
  2265. {
  2266. return Component(parsePage(vuePageOptions));
  2267. }
  2268. }
  2269. function createComponent(vueOptions) {
  2270. {
  2271. return Component(parseComponent(vueOptions));
  2272. }
  2273. }
  2274. function createSubpackageApp(vm) {
  2275. var appOptions = parseApp(vm);
  2276. var app = getApp({
  2277. allowDefault: true
  2278. });
  2279. vm.$scope = app;
  2280. var globalData = app.globalData;
  2281. if (globalData) {
  2282. Object.keys(appOptions.globalData).forEach(function (name) {
  2283. if (!hasOwn(globalData, name)) {
  2284. globalData[name] = appOptions.globalData[name];
  2285. }
  2286. });
  2287. }
  2288. Object.keys(appOptions).forEach(function (name) {
  2289. if (!hasOwn(app, name)) {
  2290. app[name] = appOptions[name];
  2291. }
  2292. });
  2293. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2294. wx.onAppShow(function () {
  2295. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  2296. args[_key5] = arguments[_key5];
  2297. }
  2298. vm.__call_hook('onShow', args);
  2299. });
  2300. }
  2301. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2302. wx.onAppHide(function () {
  2303. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  2304. args[_key6] = arguments[_key6];
  2305. }
  2306. vm.__call_hook('onHide', args);
  2307. });
  2308. }
  2309. if (isFn(appOptions.onLaunch)) {
  2310. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2311. vm.__call_hook('onLaunch', args);
  2312. }
  2313. return vm;
  2314. }
  2315. function createPlugin(vm) {
  2316. var appOptions = parseApp(vm);
  2317. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2318. wx.onAppShow(function () {
  2319. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  2320. args[_key7] = arguments[_key7];
  2321. }
  2322. vm.__call_hook('onShow', args);
  2323. });
  2324. }
  2325. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2326. wx.onAppHide(function () {
  2327. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  2328. args[_key8] = arguments[_key8];
  2329. }
  2330. vm.__call_hook('onHide', args);
  2331. });
  2332. }
  2333. if (isFn(appOptions.onLaunch)) {
  2334. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2335. vm.__call_hook('onLaunch', args);
  2336. }
  2337. return vm;
  2338. }
  2339. todos.forEach(function (todoApi) {
  2340. protocols[todoApi] = false;
  2341. });
  2342. canIUses.forEach(function (canIUseApi) {
  2343. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  2344. if (!wx.canIUse(apiName)) {
  2345. protocols[canIUseApi] = false;
  2346. }
  2347. });
  2348. var uni = {};
  2349. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2350. uni = new Proxy({}, {
  2351. get: function get(target, name) {
  2352. if (hasOwn(target, name)) {
  2353. return target[name];
  2354. }
  2355. if (baseApi[name]) {
  2356. return baseApi[name];
  2357. }
  2358. if (api[name]) {
  2359. return promisify(name, api[name]);
  2360. }
  2361. {
  2362. if (extraApi[name]) {
  2363. return promisify(name, extraApi[name]);
  2364. }
  2365. if (todoApis[name]) {
  2366. return promisify(name, todoApis[name]);
  2367. }
  2368. }
  2369. if (eventApi[name]) {
  2370. return eventApi[name];
  2371. }
  2372. return promisify(name, wrapper(name, wx[name]));
  2373. },
  2374. set: function set(target, name, value) {
  2375. target[name] = value;
  2376. return true;
  2377. }
  2378. });
  2379. } else {
  2380. Object.keys(baseApi).forEach(function (name) {
  2381. uni[name] = baseApi[name];
  2382. });
  2383. {
  2384. Object.keys(todoApis).forEach(function (name) {
  2385. uni[name] = promisify(name, todoApis[name]);
  2386. });
  2387. Object.keys(extraApi).forEach(function (name) {
  2388. uni[name] = promisify(name, extraApi[name]);
  2389. });
  2390. }
  2391. Object.keys(eventApi).forEach(function (name) {
  2392. uni[name] = eventApi[name];
  2393. });
  2394. Object.keys(api).forEach(function (name) {
  2395. uni[name] = promisify(name, api[name]);
  2396. });
  2397. Object.keys(wx).forEach(function (name) {
  2398. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2399. uni[name] = promisify(name, wrapper(name, wx[name]));
  2400. }
  2401. });
  2402. }
  2403. wx.createApp = createApp;
  2404. wx.createPage = createPage;
  2405. wx.createComponent = createComponent;
  2406. wx.createSubpackageApp = createSubpackageApp;
  2407. wx.createPlugin = createPlugin;
  2408. var uni$1 = uni;
  2409. var _default = uni$1;
  2410. exports.default = _default;
  2411. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  2412. /***/ }),
  2413. /* 3 */
  2414. /*!***********************************!*\
  2415. !*** (webpack)/buildin/global.js ***!
  2416. \***********************************/
  2417. /*! no static exports found */
  2418. /***/ (function(module, exports) {
  2419. var g;
  2420. // This works in non-strict mode
  2421. g = (function() {
  2422. return this;
  2423. })();
  2424. try {
  2425. // This works if eval is allowed (see CSP)
  2426. g = g || new Function("return this")();
  2427. } catch (e) {
  2428. // This works if the window reference is available
  2429. if (typeof window === "object") g = window;
  2430. }
  2431. // g can still be undefined, but nothing to do about it...
  2432. // We return undefined, instead of nothing here, so it's
  2433. // easier to handle this case. if(!global) { ...}
  2434. module.exports = g;
  2435. /***/ }),
  2436. /* 4 */
  2437. /*!**********************************************************************!*\
  2438. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  2439. \**********************************************************************/
  2440. /*! no static exports found */
  2441. /***/ (function(module, exports) {
  2442. function _interopRequireDefault(obj) {
  2443. return obj && obj.__esModule ? obj : {
  2444. "default": obj
  2445. };
  2446. }
  2447. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2448. /***/ }),
  2449. /* 5 */
  2450. /*!**************************************************************!*\
  2451. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  2452. \**************************************************************/
  2453. /*! no static exports found */
  2454. /***/ (function(module, exports, __webpack_require__) {
  2455. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
  2456. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 7);
  2457. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  2458. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
  2459. function _slicedToArray(arr, i) {
  2460. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  2461. }
  2462. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2463. /***/ }),
  2464. /* 6 */
  2465. /*!***************************************************************!*\
  2466. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  2467. \***************************************************************/
  2468. /*! no static exports found */
  2469. /***/ (function(module, exports) {
  2470. function _arrayWithHoles(arr) {
  2471. if (Array.isArray(arr)) return arr;
  2472. }
  2473. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2474. /***/ }),
  2475. /* 7 */
  2476. /*!*********************************************************************!*\
  2477. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  2478. \*********************************************************************/
  2479. /*! no static exports found */
  2480. /***/ (function(module, exports) {
  2481. function _iterableToArrayLimit(r, l) {
  2482. var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  2483. if (null != t) {
  2484. var e,
  2485. n,
  2486. i,
  2487. u,
  2488. a = [],
  2489. f = !0,
  2490. o = !1;
  2491. try {
  2492. if (i = (t = t.call(r)).next, 0 === l) {
  2493. if (Object(t) !== t) return;
  2494. f = !1;
  2495. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) {
  2496. ;
  2497. }
  2498. } catch (r) {
  2499. o = !0, n = r;
  2500. } finally {
  2501. try {
  2502. if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
  2503. } finally {
  2504. if (o) throw n;
  2505. }
  2506. }
  2507. return a;
  2508. }
  2509. }
  2510. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2511. /***/ }),
  2512. /* 8 */
  2513. /*!***************************************************************************!*\
  2514. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  2515. \***************************************************************************/
  2516. /*! no static exports found */
  2517. /***/ (function(module, exports, __webpack_require__) {
  2518. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  2519. function _unsupportedIterableToArray(o, minLen) {
  2520. if (!o) return;
  2521. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  2522. var n = Object.prototype.toString.call(o).slice(8, -1);
  2523. if (n === "Object" && o.constructor) n = o.constructor.name;
  2524. if (n === "Map" || n === "Set") return Array.from(o);
  2525. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  2526. }
  2527. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2528. /***/ }),
  2529. /* 9 */
  2530. /*!*****************************************************************!*\
  2531. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  2532. \*****************************************************************/
  2533. /*! no static exports found */
  2534. /***/ (function(module, exports) {
  2535. function _arrayLikeToArray(arr, len) {
  2536. if (len == null || len > arr.length) len = arr.length;
  2537. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  2538. arr2[i] = arr[i];
  2539. }
  2540. return arr2;
  2541. }
  2542. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2543. /***/ }),
  2544. /* 10 */
  2545. /*!****************************************************************!*\
  2546. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  2547. \****************************************************************/
  2548. /*! no static exports found */
  2549. /***/ (function(module, exports) {
  2550. function _nonIterableRest() {
  2551. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2552. }
  2553. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2554. /***/ }),
  2555. /* 11 */
  2556. /*!***************************************************************!*\
  2557. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  2558. \***************************************************************/
  2559. /*! no static exports found */
  2560. /***/ (function(module, exports, __webpack_require__) {
  2561. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  2562. function _defineProperty(obj, key, value) {
  2563. key = toPropertyKey(key);
  2564. if (key in obj) {
  2565. Object.defineProperty(obj, key, {
  2566. value: value,
  2567. enumerable: true,
  2568. configurable: true,
  2569. writable: true
  2570. });
  2571. } else {
  2572. obj[key] = value;
  2573. }
  2574. return obj;
  2575. }
  2576. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2577. /***/ }),
  2578. /* 12 */
  2579. /*!**************************************************************!*\
  2580. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  2581. \**************************************************************/
  2582. /*! no static exports found */
  2583. /***/ (function(module, exports, __webpack_require__) {
  2584. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  2585. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
  2586. function toPropertyKey(t) {
  2587. var i = toPrimitive(t, "string");
  2588. return "symbol" == _typeof(i) ? i : i + "";
  2589. }
  2590. module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2591. /***/ }),
  2592. /* 13 */
  2593. /*!*******************************************************!*\
  2594. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  2595. \*******************************************************/
  2596. /*! no static exports found */
  2597. /***/ (function(module, exports) {
  2598. function _typeof(o) {
  2599. "@babel/helpers - typeof";
  2600. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  2601. return typeof o;
  2602. } : function (o) {
  2603. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  2604. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
  2605. }
  2606. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2607. /***/ }),
  2608. /* 14 */
  2609. /*!************************************************************!*\
  2610. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  2611. \************************************************************/
  2612. /*! no static exports found */
  2613. /***/ (function(module, exports, __webpack_require__) {
  2614. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  2615. function toPrimitive(t, r) {
  2616. if ("object" != _typeof(t) || !t) return t;
  2617. var e = t[Symbol.toPrimitive];
  2618. if (void 0 !== e) {
  2619. var i = e.call(t, r || "default");
  2620. if ("object" != _typeof(i)) return i;
  2621. throw new TypeError("@@toPrimitive must return a primitive value.");
  2622. }
  2623. return ("string" === r ? String : Number)(t);
  2624. }
  2625. module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2626. /***/ }),
  2627. /* 15 */
  2628. /*!**********************************************************!*\
  2629. !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
  2630. \**********************************************************/
  2631. /*! no static exports found */
  2632. /***/ (function(module, exports, __webpack_require__) {
  2633. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  2634. var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
  2635. function _construct(t, e, r) {
  2636. if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
  2637. var o = [null];
  2638. o.push.apply(o, e);
  2639. var p = new (t.bind.apply(t, o))();
  2640. return r && setPrototypeOf(p, r.prototype), p;
  2641. }
  2642. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2643. /***/ }),
  2644. /* 16 */
  2645. /*!***************************************************************!*\
  2646. !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
  2647. \***************************************************************/
  2648. /*! no static exports found */
  2649. /***/ (function(module, exports) {
  2650. function _setPrototypeOf(o, p) {
  2651. module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  2652. o.__proto__ = p;
  2653. return o;
  2654. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2655. return _setPrototypeOf(o, p);
  2656. }
  2657. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2658. /***/ }),
  2659. /* 17 */
  2660. /*!*************************************************************************!*\
  2661. !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
  2662. \*************************************************************************/
  2663. /*! no static exports found */
  2664. /***/ (function(module, exports) {
  2665. function _isNativeReflectConstruct() {
  2666. try {
  2667. var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  2668. } catch (t) {}
  2669. return (module.exports = _isNativeReflectConstruct = function _isNativeReflectConstruct() {
  2670. return !!t;
  2671. }, module.exports.__esModule = true, module.exports["default"] = module.exports)();
  2672. }
  2673. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2674. /***/ }),
  2675. /* 18 */
  2676. /*!******************************************************************!*\
  2677. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  2678. \******************************************************************/
  2679. /*! no static exports found */
  2680. /***/ (function(module, exports, __webpack_require__) {
  2681. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 19);
  2682. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
  2683. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  2684. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 21);
  2685. function _toConsumableArray(arr) {
  2686. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  2687. }
  2688. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2689. /***/ }),
  2690. /* 19 */
  2691. /*!******************************************************************!*\
  2692. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  2693. \******************************************************************/
  2694. /*! no static exports found */
  2695. /***/ (function(module, exports, __webpack_require__) {
  2696. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  2697. function _arrayWithoutHoles(arr) {
  2698. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  2699. }
  2700. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2701. /***/ }),
  2702. /* 20 */
  2703. /*!****************************************************************!*\
  2704. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  2705. \****************************************************************/
  2706. /*! no static exports found */
  2707. /***/ (function(module, exports) {
  2708. function _iterableToArray(iter) {
  2709. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  2710. }
  2711. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2712. /***/ }),
  2713. /* 21 */
  2714. /*!******************************************************************!*\
  2715. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  2716. \******************************************************************/
  2717. /*! no static exports found */
  2718. /***/ (function(module, exports) {
  2719. function _nonIterableSpread() {
  2720. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2721. }
  2722. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2723. /***/ }),
  2724. /* 22 */
  2725. /*!*************************************************************!*\
  2726. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  2727. \*************************************************************/
  2728. /*! no static exports found */
  2729. /***/ (function(module, exports, __webpack_require__) {
  2730. "use strict";
  2731. /* WEBPACK VAR INJECTION */(function(uni, global) {
  2732. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  2733. Object.defineProperty(exports, "__esModule", {
  2734. value: true
  2735. });
  2736. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  2737. exports.compileI18nJsonStr = compileI18nJsonStr;
  2738. exports.hasI18nJson = hasI18nJson;
  2739. exports.initVueI18n = initVueI18n;
  2740. exports.isI18nStr = isI18nStr;
  2741. exports.isString = void 0;
  2742. exports.normalizeLocale = normalizeLocale;
  2743. exports.parseI18nJson = parseI18nJson;
  2744. exports.resolveLocale = resolveLocale;
  2745. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  2746. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  2747. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  2748. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  2749. var isObject = function isObject(val) {
  2750. return val !== null && (0, _typeof2.default)(val) === 'object';
  2751. };
  2752. var defaultDelimiters = ['{', '}'];
  2753. var BaseFormatter = /*#__PURE__*/function () {
  2754. function BaseFormatter() {
  2755. (0, _classCallCheck2.default)(this, BaseFormatter);
  2756. this._caches = Object.create(null);
  2757. }
  2758. (0, _createClass2.default)(BaseFormatter, [{
  2759. key: "interpolate",
  2760. value: function interpolate(message, values) {
  2761. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  2762. if (!values) {
  2763. return [message];
  2764. }
  2765. var tokens = this._caches[message];
  2766. if (!tokens) {
  2767. tokens = parse(message, delimiters);
  2768. this._caches[message] = tokens;
  2769. }
  2770. return compile(tokens, values);
  2771. }
  2772. }]);
  2773. return BaseFormatter;
  2774. }();
  2775. exports.Formatter = BaseFormatter;
  2776. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  2777. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  2778. function parse(format, _ref) {
  2779. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  2780. startDelimiter = _ref2[0],
  2781. endDelimiter = _ref2[1];
  2782. var tokens = [];
  2783. var position = 0;
  2784. var text = '';
  2785. while (position < format.length) {
  2786. var char = format[position++];
  2787. if (char === startDelimiter) {
  2788. if (text) {
  2789. tokens.push({
  2790. type: 'text',
  2791. value: text
  2792. });
  2793. }
  2794. text = '';
  2795. var sub = '';
  2796. char = format[position++];
  2797. while (char !== undefined && char !== endDelimiter) {
  2798. sub += char;
  2799. char = format[position++];
  2800. }
  2801. var isClosed = char === endDelimiter;
  2802. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  2803. tokens.push({
  2804. value: sub,
  2805. type: type
  2806. });
  2807. }
  2808. // else if (char === '%') {
  2809. // // when found rails i18n syntax, skip text capture
  2810. // if (format[position] !== '{') {
  2811. // text += char
  2812. // }
  2813. // }
  2814. else {
  2815. text += char;
  2816. }
  2817. }
  2818. text && tokens.push({
  2819. type: 'text',
  2820. value: text
  2821. });
  2822. return tokens;
  2823. }
  2824. function compile(tokens, values) {
  2825. var compiled = [];
  2826. var index = 0;
  2827. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  2828. if (mode === 'unknown') {
  2829. return compiled;
  2830. }
  2831. while (index < tokens.length) {
  2832. var token = tokens[index];
  2833. switch (token.type) {
  2834. case 'text':
  2835. compiled.push(token.value);
  2836. break;
  2837. case 'list':
  2838. compiled.push(values[parseInt(token.value, 10)]);
  2839. break;
  2840. case 'named':
  2841. if (mode === 'named') {
  2842. compiled.push(values[token.value]);
  2843. } else {
  2844. if (true) {
  2845. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  2846. }
  2847. }
  2848. break;
  2849. case 'unknown':
  2850. if (true) {
  2851. console.warn("Detect 'unknown' type of token!");
  2852. }
  2853. break;
  2854. }
  2855. index++;
  2856. }
  2857. return compiled;
  2858. }
  2859. var LOCALE_ZH_HANS = 'zh-Hans';
  2860. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  2861. var LOCALE_ZH_HANT = 'zh-Hant';
  2862. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  2863. var LOCALE_EN = 'en';
  2864. exports.LOCALE_EN = LOCALE_EN;
  2865. var LOCALE_FR = 'fr';
  2866. exports.LOCALE_FR = LOCALE_FR;
  2867. var LOCALE_ES = 'es';
  2868. exports.LOCALE_ES = LOCALE_ES;
  2869. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2870. var hasOwn = function hasOwn(val, key) {
  2871. return hasOwnProperty.call(val, key);
  2872. };
  2873. var defaultFormatter = new BaseFormatter();
  2874. function include(str, parts) {
  2875. return !!parts.find(function (part) {
  2876. return str.indexOf(part) !== -1;
  2877. });
  2878. }
  2879. function startsWith(str, parts) {
  2880. return parts.find(function (part) {
  2881. return str.indexOf(part) === 0;
  2882. });
  2883. }
  2884. function normalizeLocale(locale, messages) {
  2885. if (!locale) {
  2886. return;
  2887. }
  2888. locale = locale.trim().replace(/_/g, '-');
  2889. if (messages && messages[locale]) {
  2890. return locale;
  2891. }
  2892. locale = locale.toLowerCase();
  2893. if (locale === 'chinese') {
  2894. // 支付宝
  2895. return LOCALE_ZH_HANS;
  2896. }
  2897. if (locale.indexOf('zh') === 0) {
  2898. if (locale.indexOf('-hans') > -1) {
  2899. return LOCALE_ZH_HANS;
  2900. }
  2901. if (locale.indexOf('-hant') > -1) {
  2902. return LOCALE_ZH_HANT;
  2903. }
  2904. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  2905. return LOCALE_ZH_HANT;
  2906. }
  2907. return LOCALE_ZH_HANS;
  2908. }
  2909. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  2910. if (messages && Object.keys(messages).length > 0) {
  2911. locales = Object.keys(messages);
  2912. }
  2913. var lang = startsWith(locale, locales);
  2914. if (lang) {
  2915. return lang;
  2916. }
  2917. }
  2918. var I18n = /*#__PURE__*/function () {
  2919. function I18n(_ref3) {
  2920. var locale = _ref3.locale,
  2921. fallbackLocale = _ref3.fallbackLocale,
  2922. messages = _ref3.messages,
  2923. watcher = _ref3.watcher,
  2924. formater = _ref3.formater;
  2925. (0, _classCallCheck2.default)(this, I18n);
  2926. this.locale = LOCALE_EN;
  2927. this.fallbackLocale = LOCALE_EN;
  2928. this.message = {};
  2929. this.messages = {};
  2930. this.watchers = [];
  2931. if (fallbackLocale) {
  2932. this.fallbackLocale = fallbackLocale;
  2933. }
  2934. this.formater = formater || defaultFormatter;
  2935. this.messages = messages || {};
  2936. this.setLocale(locale || LOCALE_EN);
  2937. if (watcher) {
  2938. this.watchLocale(watcher);
  2939. }
  2940. }
  2941. (0, _createClass2.default)(I18n, [{
  2942. key: "setLocale",
  2943. value: function setLocale(locale) {
  2944. var _this = this;
  2945. var oldLocale = this.locale;
  2946. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  2947. if (!this.messages[this.locale]) {
  2948. // 可能初始化时不存在
  2949. this.messages[this.locale] = {};
  2950. }
  2951. this.message = this.messages[this.locale];
  2952. // 仅发生变化时,通知
  2953. if (oldLocale !== this.locale) {
  2954. this.watchers.forEach(function (watcher) {
  2955. watcher(_this.locale, oldLocale);
  2956. });
  2957. }
  2958. }
  2959. }, {
  2960. key: "getLocale",
  2961. value: function getLocale() {
  2962. return this.locale;
  2963. }
  2964. }, {
  2965. key: "watchLocale",
  2966. value: function watchLocale(fn) {
  2967. var _this2 = this;
  2968. var index = this.watchers.push(fn) - 1;
  2969. return function () {
  2970. _this2.watchers.splice(index, 1);
  2971. };
  2972. }
  2973. }, {
  2974. key: "add",
  2975. value: function add(locale, message) {
  2976. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2977. var curMessages = this.messages[locale];
  2978. if (curMessages) {
  2979. if (override) {
  2980. Object.assign(curMessages, message);
  2981. } else {
  2982. Object.keys(message).forEach(function (key) {
  2983. if (!hasOwn(curMessages, key)) {
  2984. curMessages[key] = message[key];
  2985. }
  2986. });
  2987. }
  2988. } else {
  2989. this.messages[locale] = message;
  2990. }
  2991. }
  2992. }, {
  2993. key: "f",
  2994. value: function f(message, values, delimiters) {
  2995. return this.formater.interpolate(message, values, delimiters).join('');
  2996. }
  2997. }, {
  2998. key: "t",
  2999. value: function t(key, locale, values) {
  3000. var message = this.message;
  3001. if (typeof locale === 'string') {
  3002. locale = normalizeLocale(locale, this.messages);
  3003. locale && (message = this.messages[locale]);
  3004. } else {
  3005. values = locale;
  3006. }
  3007. if (!hasOwn(message, key)) {
  3008. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  3009. return key;
  3010. }
  3011. return this.formater.interpolate(message[key], values).join('');
  3012. }
  3013. }]);
  3014. return I18n;
  3015. }();
  3016. exports.I18n = I18n;
  3017. function watchAppLocale(appVm, i18n) {
  3018. // 需要保证 watch 的触发在组件渲染之前
  3019. if (appVm.$watchLocale) {
  3020. // vue2
  3021. appVm.$watchLocale(function (newLocale) {
  3022. i18n.setLocale(newLocale);
  3023. });
  3024. } else {
  3025. appVm.$watch(function () {
  3026. return appVm.$locale;
  3027. }, function (newLocale) {
  3028. i18n.setLocale(newLocale);
  3029. });
  3030. }
  3031. }
  3032. function getDefaultLocale() {
  3033. if (typeof uni !== 'undefined' && uni.getLocale) {
  3034. return uni.getLocale();
  3035. }
  3036. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  3037. if (typeof global !== 'undefined' && global.getLocale) {
  3038. return global.getLocale();
  3039. }
  3040. return LOCALE_EN;
  3041. }
  3042. function initVueI18n(locale) {
  3043. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3044. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3045. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3046. // 兼容旧版本入参
  3047. if (typeof locale !== 'string') {
  3048. var _ref4 = [messages, locale];
  3049. locale = _ref4[0];
  3050. messages = _ref4[1];
  3051. }
  3052. if (typeof locale !== 'string') {
  3053. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3054. locale = getDefaultLocale();
  3055. }
  3056. if (typeof fallbackLocale !== 'string') {
  3057. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3058. }
  3059. var i18n = new I18n({
  3060. locale: locale,
  3061. fallbackLocale: fallbackLocale,
  3062. messages: messages,
  3063. watcher: watcher
  3064. });
  3065. var _t = function t(key, values) {
  3066. if (typeof getApp !== 'function') {
  3067. // app view
  3068. /* eslint-disable no-func-assign */
  3069. _t = function t(key, values) {
  3070. return i18n.t(key, values);
  3071. };
  3072. } else {
  3073. var isWatchedAppLocale = false;
  3074. _t = function t(key, values) {
  3075. var appVm = getApp().$vm;
  3076. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3077. // options: {
  3078. // type: Array,
  3079. // default () {
  3080. // return [{
  3081. // icon: 'shop',
  3082. // text: t("uni-goods-nav.options.shop"),
  3083. // }, {
  3084. // icon: 'cart',
  3085. // text: t("uni-goods-nav.options.cart")
  3086. // }]
  3087. // }
  3088. // },
  3089. if (appVm) {
  3090. // 触发响应式
  3091. appVm.$locale;
  3092. if (!isWatchedAppLocale) {
  3093. isWatchedAppLocale = true;
  3094. watchAppLocale(appVm, i18n);
  3095. }
  3096. }
  3097. return i18n.t(key, values);
  3098. };
  3099. }
  3100. return _t(key, values);
  3101. };
  3102. return {
  3103. i18n: i18n,
  3104. f: function f(message, values, delimiters) {
  3105. return i18n.f(message, values, delimiters);
  3106. },
  3107. t: function t(key, values) {
  3108. return _t(key, values);
  3109. },
  3110. add: function add(locale, message) {
  3111. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3112. return i18n.add(locale, message, override);
  3113. },
  3114. watch: function watch(fn) {
  3115. return i18n.watchLocale(fn);
  3116. },
  3117. getLocale: function getLocale() {
  3118. return i18n.getLocale();
  3119. },
  3120. setLocale: function setLocale(newLocale) {
  3121. return i18n.setLocale(newLocale);
  3122. }
  3123. };
  3124. }
  3125. var isString = function isString(val) {
  3126. return typeof val === 'string';
  3127. };
  3128. exports.isString = isString;
  3129. var formater;
  3130. function hasI18nJson(jsonObj, delimiters) {
  3131. if (!formater) {
  3132. formater = new BaseFormatter();
  3133. }
  3134. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3135. var value = jsonObj[key];
  3136. if (isString(value)) {
  3137. if (isI18nStr(value, delimiters)) {
  3138. return true;
  3139. }
  3140. } else {
  3141. return hasI18nJson(value, delimiters);
  3142. }
  3143. });
  3144. }
  3145. function parseI18nJson(jsonObj, values, delimiters) {
  3146. if (!formater) {
  3147. formater = new BaseFormatter();
  3148. }
  3149. walkJsonObj(jsonObj, function (jsonObj, key) {
  3150. var value = jsonObj[key];
  3151. if (isString(value)) {
  3152. if (isI18nStr(value, delimiters)) {
  3153. jsonObj[key] = compileStr(value, values, delimiters);
  3154. }
  3155. } else {
  3156. parseI18nJson(value, values, delimiters);
  3157. }
  3158. });
  3159. return jsonObj;
  3160. }
  3161. function compileI18nJsonStr(jsonStr, _ref5) {
  3162. var locale = _ref5.locale,
  3163. locales = _ref5.locales,
  3164. delimiters = _ref5.delimiters;
  3165. if (!isI18nStr(jsonStr, delimiters)) {
  3166. return jsonStr;
  3167. }
  3168. if (!formater) {
  3169. formater = new BaseFormatter();
  3170. }
  3171. var localeValues = [];
  3172. Object.keys(locales).forEach(function (name) {
  3173. if (name !== locale) {
  3174. localeValues.push({
  3175. locale: name,
  3176. values: locales[name]
  3177. });
  3178. }
  3179. });
  3180. localeValues.unshift({
  3181. locale: locale,
  3182. values: locales[locale]
  3183. });
  3184. try {
  3185. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  3186. } catch (e) {}
  3187. return jsonStr;
  3188. }
  3189. function isI18nStr(value, delimiters) {
  3190. return value.indexOf(delimiters[0]) > -1;
  3191. }
  3192. function compileStr(value, values, delimiters) {
  3193. return formater.interpolate(value, values, delimiters).join('');
  3194. }
  3195. function compileValue(jsonObj, key, localeValues, delimiters) {
  3196. var value = jsonObj[key];
  3197. if (isString(value)) {
  3198. // 存在国际化
  3199. if (isI18nStr(value, delimiters)) {
  3200. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  3201. if (localeValues.length > 1) {
  3202. // 格式化国际化语言
  3203. var valueLocales = jsonObj[key + 'Locales'] = {};
  3204. localeValues.forEach(function (localValue) {
  3205. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  3206. });
  3207. }
  3208. }
  3209. } else {
  3210. compileJsonObj(value, localeValues, delimiters);
  3211. }
  3212. }
  3213. function compileJsonObj(jsonObj, localeValues, delimiters) {
  3214. walkJsonObj(jsonObj, function (jsonObj, key) {
  3215. compileValue(jsonObj, key, localeValues, delimiters);
  3216. });
  3217. return jsonObj;
  3218. }
  3219. function walkJsonObj(jsonObj, walk) {
  3220. if (Array.isArray(jsonObj)) {
  3221. for (var i = 0; i < jsonObj.length; i++) {
  3222. if (walk(jsonObj, i)) {
  3223. return true;
  3224. }
  3225. }
  3226. } else if (isObject(jsonObj)) {
  3227. for (var key in jsonObj) {
  3228. if (walk(jsonObj, key)) {
  3229. return true;
  3230. }
  3231. }
  3232. }
  3233. return false;
  3234. }
  3235. function resolveLocale(locales) {
  3236. return function (locale) {
  3237. if (!locale) {
  3238. return locale;
  3239. }
  3240. locale = normalizeLocale(locale) || locale;
  3241. return resolveLocaleChain(locale).find(function (locale) {
  3242. return locales.indexOf(locale) > -1;
  3243. });
  3244. };
  3245. }
  3246. function resolveLocaleChain(locale) {
  3247. var chain = [];
  3248. var tokens = locale.split('-');
  3249. while (tokens.length) {
  3250. chain.push(tokens.join('-'));
  3251. tokens.pop();
  3252. }
  3253. return chain;
  3254. }
  3255. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  3256. /***/ }),
  3257. /* 23 */
  3258. /*!***************************************************************!*\
  3259. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  3260. \***************************************************************/
  3261. /*! no static exports found */
  3262. /***/ (function(module, exports) {
  3263. function _classCallCheck(instance, Constructor) {
  3264. if (!(instance instanceof Constructor)) {
  3265. throw new TypeError("Cannot call a class as a function");
  3266. }
  3267. }
  3268. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3269. /***/ }),
  3270. /* 24 */
  3271. /*!************************************************************!*\
  3272. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  3273. \************************************************************/
  3274. /*! no static exports found */
  3275. /***/ (function(module, exports, __webpack_require__) {
  3276. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  3277. function _defineProperties(target, props) {
  3278. for (var i = 0; i < props.length; i++) {
  3279. var descriptor = props[i];
  3280. descriptor.enumerable = descriptor.enumerable || false;
  3281. descriptor.configurable = true;
  3282. if ("value" in descriptor) descriptor.writable = true;
  3283. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  3284. }
  3285. }
  3286. function _createClass(Constructor, protoProps, staticProps) {
  3287. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3288. if (staticProps) _defineProperties(Constructor, staticProps);
  3289. Object.defineProperty(Constructor, "prototype", {
  3290. writable: false
  3291. });
  3292. return Constructor;
  3293. }
  3294. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3295. /***/ }),
  3296. /* 25 */
  3297. /*!******************************************************************************************!*\
  3298. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  3299. \******************************************************************************************/
  3300. /*! exports provided: default */
  3301. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3302. "use strict";
  3303. __webpack_require__.r(__webpack_exports__);
  3304. /* WEBPACK VAR INJECTION */(function(global) {/*!
  3305. * Vue.js v2.6.11
  3306. * (c) 2014-2023 Evan You
  3307. * Released under the MIT License.
  3308. */
  3309. /* */
  3310. var emptyObject = Object.freeze({});
  3311. // These helpers produce better VM code in JS engines due to their
  3312. // explicitness and function inlining.
  3313. function isUndef (v) {
  3314. return v === undefined || v === null
  3315. }
  3316. function isDef (v) {
  3317. return v !== undefined && v !== null
  3318. }
  3319. function isTrue (v) {
  3320. return v === true
  3321. }
  3322. function isFalse (v) {
  3323. return v === false
  3324. }
  3325. /**
  3326. * Check if value is primitive.
  3327. */
  3328. function isPrimitive (value) {
  3329. return (
  3330. typeof value === 'string' ||
  3331. typeof value === 'number' ||
  3332. // $flow-disable-line
  3333. typeof value === 'symbol' ||
  3334. typeof value === 'boolean'
  3335. )
  3336. }
  3337. /**
  3338. * Quick object check - this is primarily used to tell
  3339. * Objects from primitive values when we know the value
  3340. * is a JSON-compliant type.
  3341. */
  3342. function isObject (obj) {
  3343. return obj !== null && typeof obj === 'object'
  3344. }
  3345. /**
  3346. * Get the raw type string of a value, e.g., [object Object].
  3347. */
  3348. var _toString = Object.prototype.toString;
  3349. function toRawType (value) {
  3350. return _toString.call(value).slice(8, -1)
  3351. }
  3352. /**
  3353. * Strict object type check. Only returns true
  3354. * for plain JavaScript objects.
  3355. */
  3356. function isPlainObject (obj) {
  3357. return _toString.call(obj) === '[object Object]'
  3358. }
  3359. function isRegExp (v) {
  3360. return _toString.call(v) === '[object RegExp]'
  3361. }
  3362. /**
  3363. * Check if val is a valid array index.
  3364. */
  3365. function isValidArrayIndex (val) {
  3366. var n = parseFloat(String(val));
  3367. return n >= 0 && Math.floor(n) === n && isFinite(val)
  3368. }
  3369. function isPromise (val) {
  3370. return (
  3371. isDef(val) &&
  3372. typeof val.then === 'function' &&
  3373. typeof val.catch === 'function'
  3374. )
  3375. }
  3376. /**
  3377. * Convert a value to a string that is actually rendered.
  3378. */
  3379. function toString (val) {
  3380. return val == null
  3381. ? ''
  3382. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  3383. ? JSON.stringify(val, null, 2)
  3384. : String(val)
  3385. }
  3386. /**
  3387. * Convert an input value to a number for persistence.
  3388. * If the conversion fails, return original string.
  3389. */
  3390. function toNumber (val) {
  3391. var n = parseFloat(val);
  3392. return isNaN(n) ? val : n
  3393. }
  3394. /**
  3395. * Make a map and return a function for checking if a key
  3396. * is in that map.
  3397. */
  3398. function makeMap (
  3399. str,
  3400. expectsLowerCase
  3401. ) {
  3402. var map = Object.create(null);
  3403. var list = str.split(',');
  3404. for (var i = 0; i < list.length; i++) {
  3405. map[list[i]] = true;
  3406. }
  3407. return expectsLowerCase
  3408. ? function (val) { return map[val.toLowerCase()]; }
  3409. : function (val) { return map[val]; }
  3410. }
  3411. /**
  3412. * Check if a tag is a built-in tag.
  3413. */
  3414. var isBuiltInTag = makeMap('slot,component', true);
  3415. /**
  3416. * Check if an attribute is a reserved attribute.
  3417. */
  3418. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  3419. /**
  3420. * Remove an item from an array.
  3421. */
  3422. function remove (arr, item) {
  3423. if (arr.length) {
  3424. var index = arr.indexOf(item);
  3425. if (index > -1) {
  3426. return arr.splice(index, 1)
  3427. }
  3428. }
  3429. }
  3430. /**
  3431. * Check whether an object has the property.
  3432. */
  3433. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3434. function hasOwn (obj, key) {
  3435. return hasOwnProperty.call(obj, key)
  3436. }
  3437. /**
  3438. * Create a cached version of a pure function.
  3439. */
  3440. function cached (fn) {
  3441. var cache = Object.create(null);
  3442. return (function cachedFn (str) {
  3443. var hit = cache[str];
  3444. return hit || (cache[str] = fn(str))
  3445. })
  3446. }
  3447. /**
  3448. * Camelize a hyphen-delimited string.
  3449. */
  3450. var camelizeRE = /-(\w)/g;
  3451. var camelize = cached(function (str) {
  3452. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  3453. });
  3454. /**
  3455. * Capitalize a string.
  3456. */
  3457. var capitalize = cached(function (str) {
  3458. return str.charAt(0).toUpperCase() + str.slice(1)
  3459. });
  3460. /**
  3461. * Hyphenate a camelCase string.
  3462. */
  3463. var hyphenateRE = /\B([A-Z])/g;
  3464. var hyphenate = cached(function (str) {
  3465. return str.replace(hyphenateRE, '-$1').toLowerCase()
  3466. });
  3467. /**
  3468. * Simple bind polyfill for environments that do not support it,
  3469. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  3470. * since native bind is now performant enough in most browsers.
  3471. * But removing it would mean breaking code that was able to run in
  3472. * PhantomJS 1.x, so this must be kept for backward compatibility.
  3473. */
  3474. /* istanbul ignore next */
  3475. function polyfillBind (fn, ctx) {
  3476. function boundFn (a) {
  3477. var l = arguments.length;
  3478. return l
  3479. ? l > 1
  3480. ? fn.apply(ctx, arguments)
  3481. : fn.call(ctx, a)
  3482. : fn.call(ctx)
  3483. }
  3484. boundFn._length = fn.length;
  3485. return boundFn
  3486. }
  3487. function nativeBind (fn, ctx) {
  3488. return fn.bind(ctx)
  3489. }
  3490. var bind = Function.prototype.bind
  3491. ? nativeBind
  3492. : polyfillBind;
  3493. /**
  3494. * Convert an Array-like object to a real Array.
  3495. */
  3496. function toArray (list, start) {
  3497. start = start || 0;
  3498. var i = list.length - start;
  3499. var ret = new Array(i);
  3500. while (i--) {
  3501. ret[i] = list[i + start];
  3502. }
  3503. return ret
  3504. }
  3505. /**
  3506. * Mix properties into target object.
  3507. */
  3508. function extend (to, _from) {
  3509. for (var key in _from) {
  3510. to[key] = _from[key];
  3511. }
  3512. return to
  3513. }
  3514. /**
  3515. * Merge an Array of Objects into a single Object.
  3516. */
  3517. function toObject (arr) {
  3518. var res = {};
  3519. for (var i = 0; i < arr.length; i++) {
  3520. if (arr[i]) {
  3521. extend(res, arr[i]);
  3522. }
  3523. }
  3524. return res
  3525. }
  3526. /* eslint-disable no-unused-vars */
  3527. /**
  3528. * Perform no operation.
  3529. * Stubbing args to make Flow happy without leaving useless transpiled code
  3530. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  3531. */
  3532. function noop (a, b, c) {}
  3533. /**
  3534. * Always return false.
  3535. */
  3536. var no = function (a, b, c) { return false; };
  3537. /* eslint-enable no-unused-vars */
  3538. /**
  3539. * Return the same value.
  3540. */
  3541. var identity = function (_) { return _; };
  3542. /**
  3543. * Check if two values are loosely equal - that is,
  3544. * if they are plain objects, do they have the same shape?
  3545. */
  3546. function looseEqual (a, b) {
  3547. if (a === b) { return true }
  3548. var isObjectA = isObject(a);
  3549. var isObjectB = isObject(b);
  3550. if (isObjectA && isObjectB) {
  3551. try {
  3552. var isArrayA = Array.isArray(a);
  3553. var isArrayB = Array.isArray(b);
  3554. if (isArrayA && isArrayB) {
  3555. return a.length === b.length && a.every(function (e, i) {
  3556. return looseEqual(e, b[i])
  3557. })
  3558. } else if (a instanceof Date && b instanceof Date) {
  3559. return a.getTime() === b.getTime()
  3560. } else if (!isArrayA && !isArrayB) {
  3561. var keysA = Object.keys(a);
  3562. var keysB = Object.keys(b);
  3563. return keysA.length === keysB.length && keysA.every(function (key) {
  3564. return looseEqual(a[key], b[key])
  3565. })
  3566. } else {
  3567. /* istanbul ignore next */
  3568. return false
  3569. }
  3570. } catch (e) {
  3571. /* istanbul ignore next */
  3572. return false
  3573. }
  3574. } else if (!isObjectA && !isObjectB) {
  3575. return String(a) === String(b)
  3576. } else {
  3577. return false
  3578. }
  3579. }
  3580. /**
  3581. * Return the first index at which a loosely equal value can be
  3582. * found in the array (if value is a plain object, the array must
  3583. * contain an object of the same shape), or -1 if it is not present.
  3584. */
  3585. function looseIndexOf (arr, val) {
  3586. for (var i = 0; i < arr.length; i++) {
  3587. if (looseEqual(arr[i], val)) { return i }
  3588. }
  3589. return -1
  3590. }
  3591. /**
  3592. * Ensure a function is called only once.
  3593. */
  3594. function once (fn) {
  3595. var called = false;
  3596. return function () {
  3597. if (!called) {
  3598. called = true;
  3599. fn.apply(this, arguments);
  3600. }
  3601. }
  3602. }
  3603. var ASSET_TYPES = [
  3604. 'component',
  3605. 'directive',
  3606. 'filter'
  3607. ];
  3608. var LIFECYCLE_HOOKS = [
  3609. 'beforeCreate',
  3610. 'created',
  3611. 'beforeMount',
  3612. 'mounted',
  3613. 'beforeUpdate',
  3614. 'updated',
  3615. 'beforeDestroy',
  3616. 'destroyed',
  3617. 'activated',
  3618. 'deactivated',
  3619. 'errorCaptured',
  3620. 'serverPrefetch'
  3621. ];
  3622. /* */
  3623. var config = ({
  3624. /**
  3625. * Option merge strategies (used in core/util/options)
  3626. */
  3627. // $flow-disable-line
  3628. optionMergeStrategies: Object.create(null),
  3629. /**
  3630. * Whether to suppress warnings.
  3631. */
  3632. silent: false,
  3633. /**
  3634. * Show production mode tip message on boot?
  3635. */
  3636. productionTip: "development" !== 'production',
  3637. /**
  3638. * Whether to enable devtools
  3639. */
  3640. devtools: "development" !== 'production',
  3641. /**
  3642. * Whether to record perf
  3643. */
  3644. performance: false,
  3645. /**
  3646. * Error handler for watcher errors
  3647. */
  3648. errorHandler: null,
  3649. /**
  3650. * Warn handler for watcher warns
  3651. */
  3652. warnHandler: null,
  3653. /**
  3654. * Ignore certain custom elements
  3655. */
  3656. ignoredElements: [],
  3657. /**
  3658. * Custom user key aliases for v-on
  3659. */
  3660. // $flow-disable-line
  3661. keyCodes: Object.create(null),
  3662. /**
  3663. * Check if a tag is reserved so that it cannot be registered as a
  3664. * component. This is platform-dependent and may be overwritten.
  3665. */
  3666. isReservedTag: no,
  3667. /**
  3668. * Check if an attribute is reserved so that it cannot be used as a component
  3669. * prop. This is platform-dependent and may be overwritten.
  3670. */
  3671. isReservedAttr: no,
  3672. /**
  3673. * Check if a tag is an unknown element.
  3674. * Platform-dependent.
  3675. */
  3676. isUnknownElement: no,
  3677. /**
  3678. * Get the namespace of an element
  3679. */
  3680. getTagNamespace: noop,
  3681. /**
  3682. * Parse the real tag name for the specific platform.
  3683. */
  3684. parsePlatformTagName: identity,
  3685. /**
  3686. * Check if an attribute must be bound using property, e.g. value
  3687. * Platform-dependent.
  3688. */
  3689. mustUseProp: no,
  3690. /**
  3691. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  3692. * This will significantly reduce performance if set to false.
  3693. */
  3694. async: true,
  3695. /**
  3696. * Exposed for legacy reasons
  3697. */
  3698. _lifecycleHooks: LIFECYCLE_HOOKS
  3699. });
  3700. /* */
  3701. /**
  3702. * unicode letters used for parsing html tags, component names and property paths.
  3703. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  3704. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  3705. */
  3706. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  3707. /**
  3708. * Check if a string starts with $ or _
  3709. */
  3710. function isReserved (str) {
  3711. var c = (str + '').charCodeAt(0);
  3712. return c === 0x24 || c === 0x5F
  3713. }
  3714. /**
  3715. * Define a property.
  3716. */
  3717. function def (obj, key, val, enumerable) {
  3718. Object.defineProperty(obj, key, {
  3719. value: val,
  3720. enumerable: !!enumerable,
  3721. writable: true,
  3722. configurable: true
  3723. });
  3724. }
  3725. /**
  3726. * Parse simple path.
  3727. */
  3728. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  3729. function parsePath (path) {
  3730. if (bailRE.test(path)) {
  3731. return
  3732. }
  3733. var segments = path.split('.');
  3734. return function (obj) {
  3735. for (var i = 0; i < segments.length; i++) {
  3736. if (!obj) { return }
  3737. obj = obj[segments[i]];
  3738. }
  3739. return obj
  3740. }
  3741. }
  3742. /* */
  3743. // can we use __proto__?
  3744. var hasProto = '__proto__' in {};
  3745. // Browser environment sniffing
  3746. var inBrowser = typeof window !== 'undefined';
  3747. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  3748. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  3749. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  3750. var isIE = UA && /msie|trident/.test(UA);
  3751. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  3752. var isEdge = UA && UA.indexOf('edge/') > 0;
  3753. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  3754. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  3755. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  3756. var isPhantomJS = UA && /phantomjs/.test(UA);
  3757. var isFF = UA && UA.match(/firefox\/(\d+)/);
  3758. // Firefox has a "watch" function on Object.prototype...
  3759. var nativeWatch = ({}).watch;
  3760. if (inBrowser) {
  3761. try {
  3762. var opts = {};
  3763. Object.defineProperty(opts, 'passive', ({
  3764. get: function get () {
  3765. }
  3766. })); // https://github.com/facebook/flow/issues/285
  3767. window.addEventListener('test-passive', null, opts);
  3768. } catch (e) {}
  3769. }
  3770. // this needs to be lazy-evaled because vue may be required before
  3771. // vue-server-renderer can set VUE_ENV
  3772. var _isServer;
  3773. var isServerRendering = function () {
  3774. if (_isServer === undefined) {
  3775. /* istanbul ignore if */
  3776. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  3777. // detect presence of vue-server-renderer and avoid
  3778. // Webpack shimming the process
  3779. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  3780. } else {
  3781. _isServer = false;
  3782. }
  3783. }
  3784. return _isServer
  3785. };
  3786. // detect devtools
  3787. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  3788. /* istanbul ignore next */
  3789. function isNative (Ctor) {
  3790. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  3791. }
  3792. var hasSymbol =
  3793. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  3794. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  3795. var _Set;
  3796. /* istanbul ignore if */ // $flow-disable-line
  3797. if (typeof Set !== 'undefined' && isNative(Set)) {
  3798. // use native Set when available.
  3799. _Set = Set;
  3800. } else {
  3801. // a non-standard Set polyfill that only works with primitive keys.
  3802. _Set = /*@__PURE__*/(function () {
  3803. function Set () {
  3804. this.set = Object.create(null);
  3805. }
  3806. Set.prototype.has = function has (key) {
  3807. return this.set[key] === true
  3808. };
  3809. Set.prototype.add = function add (key) {
  3810. this.set[key] = true;
  3811. };
  3812. Set.prototype.clear = function clear () {
  3813. this.set = Object.create(null);
  3814. };
  3815. return Set;
  3816. }());
  3817. }
  3818. /* */
  3819. var warn = noop;
  3820. var tip = noop;
  3821. var generateComponentTrace = (noop); // work around flow check
  3822. var formatComponentName = (noop);
  3823. if (true) {
  3824. var hasConsole = typeof console !== 'undefined';
  3825. var classifyRE = /(?:^|[-_])(\w)/g;
  3826. var classify = function (str) { return str
  3827. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  3828. .replace(/[-_]/g, ''); };
  3829. warn = function (msg, vm) {
  3830. var trace = vm ? generateComponentTrace(vm) : '';
  3831. if (config.warnHandler) {
  3832. config.warnHandler.call(null, msg, vm, trace);
  3833. } else if (hasConsole && (!config.silent)) {
  3834. console.error(("[Vue warn]: " + msg + trace));
  3835. }
  3836. };
  3837. tip = function (msg, vm) {
  3838. if (hasConsole && (!config.silent)) {
  3839. console.warn("[Vue tip]: " + msg + (
  3840. vm ? generateComponentTrace(vm) : ''
  3841. ));
  3842. }
  3843. };
  3844. formatComponentName = function (vm, includeFile) {
  3845. if (vm.$root === vm) {
  3846. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  3847. return ('') + vm.$options.__file
  3848. }
  3849. return '<Root>'
  3850. }
  3851. var options = typeof vm === 'function' && vm.cid != null
  3852. ? vm.options
  3853. : vm._isVue
  3854. ? vm.$options || vm.constructor.options
  3855. : vm;
  3856. var name = options.name || options._componentTag;
  3857. var file = options.__file;
  3858. if (!name && file) {
  3859. var match = file.match(/([^/\\]+)\.vue$/);
  3860. name = match && match[1];
  3861. }
  3862. return (
  3863. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  3864. (file && includeFile !== false ? (" at " + file) : '')
  3865. )
  3866. };
  3867. var repeat = function (str, n) {
  3868. var res = '';
  3869. while (n) {
  3870. if (n % 2 === 1) { res += str; }
  3871. if (n > 1) { str += str; }
  3872. n >>= 1;
  3873. }
  3874. return res
  3875. };
  3876. generateComponentTrace = function (vm) {
  3877. if (vm._isVue && vm.$parent) {
  3878. var tree = [];
  3879. var currentRecursiveSequence = 0;
  3880. while (vm && vm.$options.name !== 'PageBody') {
  3881. if (tree.length > 0) {
  3882. var last = tree[tree.length - 1];
  3883. if (last.constructor === vm.constructor) {
  3884. currentRecursiveSequence++;
  3885. vm = vm.$parent;
  3886. continue
  3887. } else if (currentRecursiveSequence > 0) {
  3888. tree[tree.length - 1] = [last, currentRecursiveSequence];
  3889. currentRecursiveSequence = 0;
  3890. }
  3891. }
  3892. !vm.$options.isReserved && tree.push(vm);
  3893. vm = vm.$parent;
  3894. }
  3895. return '\n\nfound in\n\n' + tree
  3896. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  3897. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  3898. : formatComponentName(vm))); })
  3899. .join('\n')
  3900. } else {
  3901. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  3902. }
  3903. };
  3904. }
  3905. /* */
  3906. var uid = 0;
  3907. /**
  3908. * A dep is an observable that can have multiple
  3909. * directives subscribing to it.
  3910. */
  3911. var Dep = function Dep () {
  3912. this.id = uid++;
  3913. this.subs = [];
  3914. };
  3915. Dep.prototype.addSub = function addSub (sub) {
  3916. this.subs.push(sub);
  3917. };
  3918. Dep.prototype.removeSub = function removeSub (sub) {
  3919. remove(this.subs, sub);
  3920. };
  3921. Dep.prototype.depend = function depend () {
  3922. if (Dep.SharedObject.target) {
  3923. Dep.SharedObject.target.addDep(this);
  3924. }
  3925. };
  3926. Dep.prototype.notify = function notify () {
  3927. // stabilize the subscriber list first
  3928. var subs = this.subs.slice();
  3929. if ( true && !config.async) {
  3930. // subs aren't sorted in scheduler if not running async
  3931. // we need to sort them now to make sure they fire in correct
  3932. // order
  3933. subs.sort(function (a, b) { return a.id - b.id; });
  3934. }
  3935. for (var i = 0, l = subs.length; i < l; i++) {
  3936. subs[i].update();
  3937. }
  3938. };
  3939. // The current target watcher being evaluated.
  3940. // This is globally unique because only one watcher
  3941. // can be evaluated at a time.
  3942. // fixed by xxxxxx (nvue shared vuex)
  3943. /* eslint-disable no-undef */
  3944. Dep.SharedObject = {};
  3945. Dep.SharedObject.target = null;
  3946. Dep.SharedObject.targetStack = [];
  3947. function pushTarget (target) {
  3948. Dep.SharedObject.targetStack.push(target);
  3949. Dep.SharedObject.target = target;
  3950. Dep.target = target;
  3951. }
  3952. function popTarget () {
  3953. Dep.SharedObject.targetStack.pop();
  3954. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  3955. Dep.target = Dep.SharedObject.target;
  3956. }
  3957. /* */
  3958. var VNode = function VNode (
  3959. tag,
  3960. data,
  3961. children,
  3962. text,
  3963. elm,
  3964. context,
  3965. componentOptions,
  3966. asyncFactory
  3967. ) {
  3968. this.tag = tag;
  3969. this.data = data;
  3970. this.children = children;
  3971. this.text = text;
  3972. this.elm = elm;
  3973. this.ns = undefined;
  3974. this.context = context;
  3975. this.fnContext = undefined;
  3976. this.fnOptions = undefined;
  3977. this.fnScopeId = undefined;
  3978. this.key = data && data.key;
  3979. this.componentOptions = componentOptions;
  3980. this.componentInstance = undefined;
  3981. this.parent = undefined;
  3982. this.raw = false;
  3983. this.isStatic = false;
  3984. this.isRootInsert = true;
  3985. this.isComment = false;
  3986. this.isCloned = false;
  3987. this.isOnce = false;
  3988. this.asyncFactory = asyncFactory;
  3989. this.asyncMeta = undefined;
  3990. this.isAsyncPlaceholder = false;
  3991. };
  3992. var prototypeAccessors = { child: { configurable: true } };
  3993. // DEPRECATED: alias for componentInstance for backwards compat.
  3994. /* istanbul ignore next */
  3995. prototypeAccessors.child.get = function () {
  3996. return this.componentInstance
  3997. };
  3998. Object.defineProperties( VNode.prototype, prototypeAccessors );
  3999. var createEmptyVNode = function (text) {
  4000. if ( text === void 0 ) text = '';
  4001. var node = new VNode();
  4002. node.text = text;
  4003. node.isComment = true;
  4004. return node
  4005. };
  4006. function createTextVNode (val) {
  4007. return new VNode(undefined, undefined, undefined, String(val))
  4008. }
  4009. // optimized shallow clone
  4010. // used for static nodes and slot nodes because they may be reused across
  4011. // multiple renders, cloning them avoids errors when DOM manipulations rely
  4012. // on their elm reference.
  4013. function cloneVNode (vnode) {
  4014. var cloned = new VNode(
  4015. vnode.tag,
  4016. vnode.data,
  4017. // #7975
  4018. // clone children array to avoid mutating original in case of cloning
  4019. // a child.
  4020. vnode.children && vnode.children.slice(),
  4021. vnode.text,
  4022. vnode.elm,
  4023. vnode.context,
  4024. vnode.componentOptions,
  4025. vnode.asyncFactory
  4026. );
  4027. cloned.ns = vnode.ns;
  4028. cloned.isStatic = vnode.isStatic;
  4029. cloned.key = vnode.key;
  4030. cloned.isComment = vnode.isComment;
  4031. cloned.fnContext = vnode.fnContext;
  4032. cloned.fnOptions = vnode.fnOptions;
  4033. cloned.fnScopeId = vnode.fnScopeId;
  4034. cloned.asyncMeta = vnode.asyncMeta;
  4035. cloned.isCloned = true;
  4036. return cloned
  4037. }
  4038. /*
  4039. * not type checking this file because flow doesn't play well with
  4040. * dynamically accessing methods on Array prototype
  4041. */
  4042. var arrayProto = Array.prototype;
  4043. var arrayMethods = Object.create(arrayProto);
  4044. var methodsToPatch = [
  4045. 'push',
  4046. 'pop',
  4047. 'shift',
  4048. 'unshift',
  4049. 'splice',
  4050. 'sort',
  4051. 'reverse'
  4052. ];
  4053. /**
  4054. * Intercept mutating methods and emit events
  4055. */
  4056. methodsToPatch.forEach(function (method) {
  4057. // cache original method
  4058. var original = arrayProto[method];
  4059. def(arrayMethods, method, function mutator () {
  4060. var args = [], len = arguments.length;
  4061. while ( len-- ) args[ len ] = arguments[ len ];
  4062. var result = original.apply(this, args);
  4063. var ob = this.__ob__;
  4064. var inserted;
  4065. switch (method) {
  4066. case 'push':
  4067. case 'unshift':
  4068. inserted = args;
  4069. break
  4070. case 'splice':
  4071. inserted = args.slice(2);
  4072. break
  4073. }
  4074. if (inserted) { ob.observeArray(inserted); }
  4075. // notify change
  4076. ob.dep.notify();
  4077. return result
  4078. });
  4079. });
  4080. /* */
  4081. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  4082. /**
  4083. * In some cases we may want to disable observation inside a component's
  4084. * update computation.
  4085. */
  4086. var shouldObserve = true;
  4087. function toggleObserving (value) {
  4088. shouldObserve = value;
  4089. }
  4090. /**
  4091. * Observer class that is attached to each observed
  4092. * object. Once attached, the observer converts the target
  4093. * object's property keys into getter/setters that
  4094. * collect dependencies and dispatch updates.
  4095. */
  4096. var Observer = function Observer (value) {
  4097. this.value = value;
  4098. this.dep = new Dep();
  4099. this.vmCount = 0;
  4100. def(value, '__ob__', this);
  4101. if (Array.isArray(value)) {
  4102. if (hasProto) {
  4103. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  4104. if(value.push !== value.__proto__.push){
  4105. copyAugment(value, arrayMethods, arrayKeys);
  4106. } else {
  4107. protoAugment(value, arrayMethods);
  4108. }
  4109. }
  4110. } else {
  4111. copyAugment(value, arrayMethods, arrayKeys);
  4112. }
  4113. this.observeArray(value);
  4114. } else {
  4115. this.walk(value);
  4116. }
  4117. };
  4118. /**
  4119. * Walk through all properties and convert them into
  4120. * getter/setters. This method should only be called when
  4121. * value type is Object.
  4122. */
  4123. Observer.prototype.walk = function walk (obj) {
  4124. var keys = Object.keys(obj);
  4125. for (var i = 0; i < keys.length; i++) {
  4126. defineReactive$$1(obj, keys[i]);
  4127. }
  4128. };
  4129. /**
  4130. * Observe a list of Array items.
  4131. */
  4132. Observer.prototype.observeArray = function observeArray (items) {
  4133. for (var i = 0, l = items.length; i < l; i++) {
  4134. observe(items[i]);
  4135. }
  4136. };
  4137. // helpers
  4138. /**
  4139. * Augment a target Object or Array by intercepting
  4140. * the prototype chain using __proto__
  4141. */
  4142. function protoAugment (target, src) {
  4143. /* eslint-disable no-proto */
  4144. target.__proto__ = src;
  4145. /* eslint-enable no-proto */
  4146. }
  4147. /**
  4148. * Augment a target Object or Array by defining
  4149. * hidden properties.
  4150. */
  4151. /* istanbul ignore next */
  4152. function copyAugment (target, src, keys) {
  4153. for (var i = 0, l = keys.length; i < l; i++) {
  4154. var key = keys[i];
  4155. def(target, key, src[key]);
  4156. }
  4157. }
  4158. /**
  4159. * Attempt to create an observer instance for a value,
  4160. * returns the new observer if successfully observed,
  4161. * or the existing observer if the value already has one.
  4162. */
  4163. function observe (value, asRootData) {
  4164. if (!isObject(value) || value instanceof VNode) {
  4165. return
  4166. }
  4167. var ob;
  4168. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  4169. ob = value.__ob__;
  4170. } else if (
  4171. shouldObserve &&
  4172. !isServerRendering() &&
  4173. (Array.isArray(value) || isPlainObject(value)) &&
  4174. Object.isExtensible(value) &&
  4175. !value._isVue &&
  4176. !value.__v_isMPComponent
  4177. ) {
  4178. ob = new Observer(value);
  4179. }
  4180. if (asRootData && ob) {
  4181. ob.vmCount++;
  4182. }
  4183. return ob
  4184. }
  4185. /**
  4186. * Define a reactive property on an Object.
  4187. */
  4188. function defineReactive$$1 (
  4189. obj,
  4190. key,
  4191. val,
  4192. customSetter,
  4193. shallow
  4194. ) {
  4195. var dep = new Dep();
  4196. var property = Object.getOwnPropertyDescriptor(obj, key);
  4197. if (property && property.configurable === false) {
  4198. return
  4199. }
  4200. // cater for pre-defined getter/setters
  4201. var getter = property && property.get;
  4202. var setter = property && property.set;
  4203. if ((!getter || setter) && arguments.length === 2) {
  4204. val = obj[key];
  4205. }
  4206. var childOb = !shallow && observe(val);
  4207. Object.defineProperty(obj, key, {
  4208. enumerable: true,
  4209. configurable: true,
  4210. get: function reactiveGetter () {
  4211. var value = getter ? getter.call(obj) : val;
  4212. if (Dep.SharedObject.target) { // fixed by xxxxxx
  4213. dep.depend();
  4214. if (childOb) {
  4215. childOb.dep.depend();
  4216. if (Array.isArray(value)) {
  4217. dependArray(value);
  4218. }
  4219. }
  4220. }
  4221. return value
  4222. },
  4223. set: function reactiveSetter (newVal) {
  4224. var value = getter ? getter.call(obj) : val;
  4225. /* eslint-disable no-self-compare */
  4226. if (newVal === value || (newVal !== newVal && value !== value)) {
  4227. return
  4228. }
  4229. /* eslint-enable no-self-compare */
  4230. if ( true && customSetter) {
  4231. customSetter();
  4232. }
  4233. // #7981: for accessor properties without setter
  4234. if (getter && !setter) { return }
  4235. if (setter) {
  4236. setter.call(obj, newVal);
  4237. } else {
  4238. val = newVal;
  4239. }
  4240. childOb = !shallow && observe(newVal);
  4241. dep.notify();
  4242. }
  4243. });
  4244. }
  4245. /**
  4246. * Set a property on an object. Adds the new property and
  4247. * triggers change notification if the property doesn't
  4248. * already exist.
  4249. */
  4250. function set (target, key, val) {
  4251. if ( true &&
  4252. (isUndef(target) || isPrimitive(target))
  4253. ) {
  4254. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  4255. }
  4256. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4257. target.length = Math.max(target.length, key);
  4258. target.splice(key, 1, val);
  4259. return val
  4260. }
  4261. if (key in target && !(key in Object.prototype)) {
  4262. target[key] = val;
  4263. return val
  4264. }
  4265. var ob = (target).__ob__;
  4266. if (target._isVue || (ob && ob.vmCount)) {
  4267. true && warn(
  4268. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  4269. 'at runtime - declare it upfront in the data option.'
  4270. );
  4271. return val
  4272. }
  4273. if (!ob) {
  4274. target[key] = val;
  4275. return val
  4276. }
  4277. defineReactive$$1(ob.value, key, val);
  4278. ob.dep.notify();
  4279. return val
  4280. }
  4281. /**
  4282. * Delete a property and trigger change if necessary.
  4283. */
  4284. function del (target, key) {
  4285. if ( true &&
  4286. (isUndef(target) || isPrimitive(target))
  4287. ) {
  4288. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  4289. }
  4290. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4291. target.splice(key, 1);
  4292. return
  4293. }
  4294. var ob = (target).__ob__;
  4295. if (target._isVue || (ob && ob.vmCount)) {
  4296. true && warn(
  4297. 'Avoid deleting properties on a Vue instance or its root $data ' +
  4298. '- just set it to null.'
  4299. );
  4300. return
  4301. }
  4302. if (!hasOwn(target, key)) {
  4303. return
  4304. }
  4305. delete target[key];
  4306. if (!ob) {
  4307. return
  4308. }
  4309. ob.dep.notify();
  4310. }
  4311. /**
  4312. * Collect dependencies on array elements when the array is touched, since
  4313. * we cannot intercept array element access like property getters.
  4314. */
  4315. function dependArray (value) {
  4316. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  4317. e = value[i];
  4318. e && e.__ob__ && e.__ob__.dep.depend();
  4319. if (Array.isArray(e)) {
  4320. dependArray(e);
  4321. }
  4322. }
  4323. }
  4324. /* */
  4325. /**
  4326. * Option overwriting strategies are functions that handle
  4327. * how to merge a parent option value and a child option
  4328. * value into the final value.
  4329. */
  4330. var strats = config.optionMergeStrategies;
  4331. /**
  4332. * Options with restrictions
  4333. */
  4334. if (true) {
  4335. strats.el = strats.propsData = function (parent, child, vm, key) {
  4336. if (!vm) {
  4337. warn(
  4338. "option \"" + key + "\" can only be used during instance " +
  4339. 'creation with the `new` keyword.'
  4340. );
  4341. }
  4342. return defaultStrat(parent, child)
  4343. };
  4344. }
  4345. /**
  4346. * Helper that recursively merges two data objects together.
  4347. */
  4348. function mergeData (to, from) {
  4349. if (!from) { return to }
  4350. var key, toVal, fromVal;
  4351. var keys = hasSymbol
  4352. ? Reflect.ownKeys(from)
  4353. : Object.keys(from);
  4354. for (var i = 0; i < keys.length; i++) {
  4355. key = keys[i];
  4356. // in case the object is already observed...
  4357. if (key === '__ob__') { continue }
  4358. toVal = to[key];
  4359. fromVal = from[key];
  4360. if (!hasOwn(to, key)) {
  4361. set(to, key, fromVal);
  4362. } else if (
  4363. toVal !== fromVal &&
  4364. isPlainObject(toVal) &&
  4365. isPlainObject(fromVal)
  4366. ) {
  4367. mergeData(toVal, fromVal);
  4368. }
  4369. }
  4370. return to
  4371. }
  4372. /**
  4373. * Data
  4374. */
  4375. function mergeDataOrFn (
  4376. parentVal,
  4377. childVal,
  4378. vm
  4379. ) {
  4380. if (!vm) {
  4381. // in a Vue.extend merge, both should be functions
  4382. if (!childVal) {
  4383. return parentVal
  4384. }
  4385. if (!parentVal) {
  4386. return childVal
  4387. }
  4388. // when parentVal & childVal are both present,
  4389. // we need to return a function that returns the
  4390. // merged result of both functions... no need to
  4391. // check if parentVal is a function here because
  4392. // it has to be a function to pass previous merges.
  4393. return function mergedDataFn () {
  4394. return mergeData(
  4395. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  4396. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  4397. )
  4398. }
  4399. } else {
  4400. return function mergedInstanceDataFn () {
  4401. // instance merge
  4402. var instanceData = typeof childVal === 'function'
  4403. ? childVal.call(vm, vm)
  4404. : childVal;
  4405. var defaultData = typeof parentVal === 'function'
  4406. ? parentVal.call(vm, vm)
  4407. : parentVal;
  4408. if (instanceData) {
  4409. return mergeData(instanceData, defaultData)
  4410. } else {
  4411. return defaultData
  4412. }
  4413. }
  4414. }
  4415. }
  4416. strats.data = function (
  4417. parentVal,
  4418. childVal,
  4419. vm
  4420. ) {
  4421. if (!vm) {
  4422. if (childVal && typeof childVal !== 'function') {
  4423. true && warn(
  4424. 'The "data" option should be a function ' +
  4425. 'that returns a per-instance value in component ' +
  4426. 'definitions.',
  4427. vm
  4428. );
  4429. return parentVal
  4430. }
  4431. return mergeDataOrFn(parentVal, childVal)
  4432. }
  4433. return mergeDataOrFn(parentVal, childVal, vm)
  4434. };
  4435. /**
  4436. * Hooks and props are merged as arrays.
  4437. */
  4438. function mergeHook (
  4439. parentVal,
  4440. childVal
  4441. ) {
  4442. var res = childVal
  4443. ? parentVal
  4444. ? parentVal.concat(childVal)
  4445. : Array.isArray(childVal)
  4446. ? childVal
  4447. : [childVal]
  4448. : parentVal;
  4449. return res
  4450. ? dedupeHooks(res)
  4451. : res
  4452. }
  4453. function dedupeHooks (hooks) {
  4454. var res = [];
  4455. for (var i = 0; i < hooks.length; i++) {
  4456. if (res.indexOf(hooks[i]) === -1) {
  4457. res.push(hooks[i]);
  4458. }
  4459. }
  4460. return res
  4461. }
  4462. LIFECYCLE_HOOKS.forEach(function (hook) {
  4463. strats[hook] = mergeHook;
  4464. });
  4465. /**
  4466. * Assets
  4467. *
  4468. * When a vm is present (instance creation), we need to do
  4469. * a three-way merge between constructor options, instance
  4470. * options and parent options.
  4471. */
  4472. function mergeAssets (
  4473. parentVal,
  4474. childVal,
  4475. vm,
  4476. key
  4477. ) {
  4478. var res = Object.create(parentVal || null);
  4479. if (childVal) {
  4480. true && assertObjectType(key, childVal, vm);
  4481. return extend(res, childVal)
  4482. } else {
  4483. return res
  4484. }
  4485. }
  4486. ASSET_TYPES.forEach(function (type) {
  4487. strats[type + 's'] = mergeAssets;
  4488. });
  4489. /**
  4490. * Watchers.
  4491. *
  4492. * Watchers hashes should not overwrite one
  4493. * another, so we merge them as arrays.
  4494. */
  4495. strats.watch = function (
  4496. parentVal,
  4497. childVal,
  4498. vm,
  4499. key
  4500. ) {
  4501. // work around Firefox's Object.prototype.watch...
  4502. if (parentVal === nativeWatch) { parentVal = undefined; }
  4503. if (childVal === nativeWatch) { childVal = undefined; }
  4504. /* istanbul ignore if */
  4505. if (!childVal) { return Object.create(parentVal || null) }
  4506. if (true) {
  4507. assertObjectType(key, childVal, vm);
  4508. }
  4509. if (!parentVal) { return childVal }
  4510. var ret = {};
  4511. extend(ret, parentVal);
  4512. for (var key$1 in childVal) {
  4513. var parent = ret[key$1];
  4514. var child = childVal[key$1];
  4515. if (parent && !Array.isArray(parent)) {
  4516. parent = [parent];
  4517. }
  4518. ret[key$1] = parent
  4519. ? parent.concat(child)
  4520. : Array.isArray(child) ? child : [child];
  4521. }
  4522. return ret
  4523. };
  4524. /**
  4525. * Other object hashes.
  4526. */
  4527. strats.props =
  4528. strats.methods =
  4529. strats.inject =
  4530. strats.computed = function (
  4531. parentVal,
  4532. childVal,
  4533. vm,
  4534. key
  4535. ) {
  4536. if (childVal && "development" !== 'production') {
  4537. assertObjectType(key, childVal, vm);
  4538. }
  4539. if (!parentVal) { return childVal }
  4540. var ret = Object.create(null);
  4541. extend(ret, parentVal);
  4542. if (childVal) { extend(ret, childVal); }
  4543. return ret
  4544. };
  4545. strats.provide = mergeDataOrFn;
  4546. /**
  4547. * Default strategy.
  4548. */
  4549. var defaultStrat = function (parentVal, childVal) {
  4550. return childVal === undefined
  4551. ? parentVal
  4552. : childVal
  4553. };
  4554. /**
  4555. * Validate component names
  4556. */
  4557. function checkComponents (options) {
  4558. for (var key in options.components) {
  4559. validateComponentName(key);
  4560. }
  4561. }
  4562. function validateComponentName (name) {
  4563. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  4564. warn(
  4565. 'Invalid component name: "' + name + '". Component names ' +
  4566. 'should conform to valid custom element name in html5 specification.'
  4567. );
  4568. }
  4569. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  4570. warn(
  4571. 'Do not use built-in or reserved HTML elements as component ' +
  4572. 'id: ' + name
  4573. );
  4574. }
  4575. }
  4576. /**
  4577. * Ensure all props option syntax are normalized into the
  4578. * Object-based format.
  4579. */
  4580. function normalizeProps (options, vm) {
  4581. var props = options.props;
  4582. if (!props) { return }
  4583. var res = {};
  4584. var i, val, name;
  4585. if (Array.isArray(props)) {
  4586. i = props.length;
  4587. while (i--) {
  4588. val = props[i];
  4589. if (typeof val === 'string') {
  4590. name = camelize(val);
  4591. res[name] = { type: null };
  4592. } else if (true) {
  4593. warn('props must be strings when using array syntax.');
  4594. }
  4595. }
  4596. } else if (isPlainObject(props)) {
  4597. for (var key in props) {
  4598. val = props[key];
  4599. name = camelize(key);
  4600. res[name] = isPlainObject(val)
  4601. ? val
  4602. : { type: val };
  4603. }
  4604. } else if (true) {
  4605. warn(
  4606. "Invalid value for option \"props\": expected an Array or an Object, " +
  4607. "but got " + (toRawType(props)) + ".",
  4608. vm
  4609. );
  4610. }
  4611. options.props = res;
  4612. }
  4613. /**
  4614. * Normalize all injections into Object-based format
  4615. */
  4616. function normalizeInject (options, vm) {
  4617. var inject = options.inject;
  4618. if (!inject) { return }
  4619. var normalized = options.inject = {};
  4620. if (Array.isArray(inject)) {
  4621. for (var i = 0; i < inject.length; i++) {
  4622. normalized[inject[i]] = { from: inject[i] };
  4623. }
  4624. } else if (isPlainObject(inject)) {
  4625. for (var key in inject) {
  4626. var val = inject[key];
  4627. normalized[key] = isPlainObject(val)
  4628. ? extend({ from: key }, val)
  4629. : { from: val };
  4630. }
  4631. } else if (true) {
  4632. warn(
  4633. "Invalid value for option \"inject\": expected an Array or an Object, " +
  4634. "but got " + (toRawType(inject)) + ".",
  4635. vm
  4636. );
  4637. }
  4638. }
  4639. /**
  4640. * Normalize raw function directives into object format.
  4641. */
  4642. function normalizeDirectives (options) {
  4643. var dirs = options.directives;
  4644. if (dirs) {
  4645. for (var key in dirs) {
  4646. var def$$1 = dirs[key];
  4647. if (typeof def$$1 === 'function') {
  4648. dirs[key] = { bind: def$$1, update: def$$1 };
  4649. }
  4650. }
  4651. }
  4652. }
  4653. function assertObjectType (name, value, vm) {
  4654. if (!isPlainObject(value)) {
  4655. warn(
  4656. "Invalid value for option \"" + name + "\": expected an Object, " +
  4657. "but got " + (toRawType(value)) + ".",
  4658. vm
  4659. );
  4660. }
  4661. }
  4662. /**
  4663. * Merge two option objects into a new one.
  4664. * Core utility used in both instantiation and inheritance.
  4665. */
  4666. function mergeOptions (
  4667. parent,
  4668. child,
  4669. vm
  4670. ) {
  4671. if (true) {
  4672. checkComponents(child);
  4673. }
  4674. if (typeof child === 'function') {
  4675. child = child.options;
  4676. }
  4677. normalizeProps(child, vm);
  4678. normalizeInject(child, vm);
  4679. normalizeDirectives(child);
  4680. // Apply extends and mixins on the child options,
  4681. // but only if it is a raw options object that isn't
  4682. // the result of another mergeOptions call.
  4683. // Only merged options has the _base property.
  4684. if (!child._base) {
  4685. if (child.extends) {
  4686. parent = mergeOptions(parent, child.extends, vm);
  4687. }
  4688. if (child.mixins) {
  4689. for (var i = 0, l = child.mixins.length; i < l; i++) {
  4690. parent = mergeOptions(parent, child.mixins[i], vm);
  4691. }
  4692. }
  4693. }
  4694. var options = {};
  4695. var key;
  4696. for (key in parent) {
  4697. mergeField(key);
  4698. }
  4699. for (key in child) {
  4700. if (!hasOwn(parent, key)) {
  4701. mergeField(key);
  4702. }
  4703. }
  4704. function mergeField (key) {
  4705. var strat = strats[key] || defaultStrat;
  4706. options[key] = strat(parent[key], child[key], vm, key);
  4707. }
  4708. return options
  4709. }
  4710. /**
  4711. * Resolve an asset.
  4712. * This function is used because child instances need access
  4713. * to assets defined in its ancestor chain.
  4714. */
  4715. function resolveAsset (
  4716. options,
  4717. type,
  4718. id,
  4719. warnMissing
  4720. ) {
  4721. /* istanbul ignore if */
  4722. if (typeof id !== 'string') {
  4723. return
  4724. }
  4725. var assets = options[type];
  4726. // check local registration variations first
  4727. if (hasOwn(assets, id)) { return assets[id] }
  4728. var camelizedId = camelize(id);
  4729. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  4730. var PascalCaseId = capitalize(camelizedId);
  4731. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  4732. // fallback to prototype chain
  4733. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  4734. if ( true && warnMissing && !res) {
  4735. warn(
  4736. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  4737. options
  4738. );
  4739. }
  4740. return res
  4741. }
  4742. /* */
  4743. function validateProp (
  4744. key,
  4745. propOptions,
  4746. propsData,
  4747. vm
  4748. ) {
  4749. var prop = propOptions[key];
  4750. var absent = !hasOwn(propsData, key);
  4751. var value = propsData[key];
  4752. // boolean casting
  4753. var booleanIndex = getTypeIndex(Boolean, prop.type);
  4754. if (booleanIndex > -1) {
  4755. if (absent && !hasOwn(prop, 'default')) {
  4756. value = false;
  4757. } else if (value === '' || value === hyphenate(key)) {
  4758. // only cast empty string / same name to boolean if
  4759. // boolean has higher priority
  4760. var stringIndex = getTypeIndex(String, prop.type);
  4761. if (stringIndex < 0 || booleanIndex < stringIndex) {
  4762. value = true;
  4763. }
  4764. }
  4765. }
  4766. // check default value
  4767. if (value === undefined) {
  4768. value = getPropDefaultValue(vm, prop, key);
  4769. // since the default value is a fresh copy,
  4770. // make sure to observe it.
  4771. var prevShouldObserve = shouldObserve;
  4772. toggleObserving(true);
  4773. observe(value);
  4774. toggleObserving(prevShouldObserve);
  4775. }
  4776. if (
  4777. true
  4778. ) {
  4779. assertProp(prop, key, value, vm, absent);
  4780. }
  4781. return value
  4782. }
  4783. /**
  4784. * Get the default value of a prop.
  4785. */
  4786. function getPropDefaultValue (vm, prop, key) {
  4787. // no default, return undefined
  4788. if (!hasOwn(prop, 'default')) {
  4789. return undefined
  4790. }
  4791. var def = prop.default;
  4792. // warn against non-factory defaults for Object & Array
  4793. if ( true && isObject(def)) {
  4794. warn(
  4795. 'Invalid default value for prop "' + key + '": ' +
  4796. 'Props with type Object/Array must use a factory function ' +
  4797. 'to return the default value.',
  4798. vm
  4799. );
  4800. }
  4801. // the raw prop value was also undefined from previous render,
  4802. // return previous default value to avoid unnecessary watcher trigger
  4803. if (vm && vm.$options.propsData &&
  4804. vm.$options.propsData[key] === undefined &&
  4805. vm._props[key] !== undefined
  4806. ) {
  4807. return vm._props[key]
  4808. }
  4809. // call factory function for non-Function types
  4810. // a value is Function if its prototype is function even across different execution context
  4811. return typeof def === 'function' && getType(prop.type) !== 'Function'
  4812. ? def.call(vm)
  4813. : def
  4814. }
  4815. /**
  4816. * Assert whether a prop is valid.
  4817. */
  4818. function assertProp (
  4819. prop,
  4820. name,
  4821. value,
  4822. vm,
  4823. absent
  4824. ) {
  4825. if (prop.required && absent) {
  4826. warn(
  4827. 'Missing required prop: "' + name + '"',
  4828. vm
  4829. );
  4830. return
  4831. }
  4832. if (value == null && !prop.required) {
  4833. return
  4834. }
  4835. var type = prop.type;
  4836. var valid = !type || type === true;
  4837. var expectedTypes = [];
  4838. if (type) {
  4839. if (!Array.isArray(type)) {
  4840. type = [type];
  4841. }
  4842. for (var i = 0; i < type.length && !valid; i++) {
  4843. var assertedType = assertType(value, type[i]);
  4844. expectedTypes.push(assertedType.expectedType || '');
  4845. valid = assertedType.valid;
  4846. }
  4847. }
  4848. if (!valid) {
  4849. warn(
  4850. getInvalidTypeMessage(name, value, expectedTypes),
  4851. vm
  4852. );
  4853. return
  4854. }
  4855. var validator = prop.validator;
  4856. if (validator) {
  4857. if (!validator(value)) {
  4858. warn(
  4859. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  4860. vm
  4861. );
  4862. }
  4863. }
  4864. }
  4865. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  4866. function assertType (value, type) {
  4867. var valid;
  4868. var expectedType = getType(type);
  4869. if (simpleCheckRE.test(expectedType)) {
  4870. var t = typeof value;
  4871. valid = t === expectedType.toLowerCase();
  4872. // for primitive wrapper objects
  4873. if (!valid && t === 'object') {
  4874. valid = value instanceof type;
  4875. }
  4876. } else if (expectedType === 'Object') {
  4877. valid = isPlainObject(value);
  4878. } else if (expectedType === 'Array') {
  4879. valid = Array.isArray(value);
  4880. } else {
  4881. valid = value instanceof type;
  4882. }
  4883. return {
  4884. valid: valid,
  4885. expectedType: expectedType
  4886. }
  4887. }
  4888. /**
  4889. * Use function string name to check built-in types,
  4890. * because a simple equality check will fail when running
  4891. * across different vms / iframes.
  4892. */
  4893. function getType (fn) {
  4894. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  4895. return match ? match[1] : ''
  4896. }
  4897. function isSameType (a, b) {
  4898. return getType(a) === getType(b)
  4899. }
  4900. function getTypeIndex (type, expectedTypes) {
  4901. if (!Array.isArray(expectedTypes)) {
  4902. return isSameType(expectedTypes, type) ? 0 : -1
  4903. }
  4904. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  4905. if (isSameType(expectedTypes[i], type)) {
  4906. return i
  4907. }
  4908. }
  4909. return -1
  4910. }
  4911. function getInvalidTypeMessage (name, value, expectedTypes) {
  4912. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  4913. " Expected " + (expectedTypes.map(capitalize).join(', '));
  4914. var expectedType = expectedTypes[0];
  4915. var receivedType = toRawType(value);
  4916. var expectedValue = styleValue(value, expectedType);
  4917. var receivedValue = styleValue(value, receivedType);
  4918. // check if we need to specify expected value
  4919. if (expectedTypes.length === 1 &&
  4920. isExplicable(expectedType) &&
  4921. !isBoolean(expectedType, receivedType)) {
  4922. message += " with value " + expectedValue;
  4923. }
  4924. message += ", got " + receivedType + " ";
  4925. // check if we need to specify received value
  4926. if (isExplicable(receivedType)) {
  4927. message += "with value " + receivedValue + ".";
  4928. }
  4929. return message
  4930. }
  4931. function styleValue (value, type) {
  4932. if (type === 'String') {
  4933. return ("\"" + value + "\"")
  4934. } else if (type === 'Number') {
  4935. return ("" + (Number(value)))
  4936. } else {
  4937. return ("" + value)
  4938. }
  4939. }
  4940. function isExplicable (value) {
  4941. var explicitTypes = ['string', 'number', 'boolean'];
  4942. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  4943. }
  4944. function isBoolean () {
  4945. var args = [], len = arguments.length;
  4946. while ( len-- ) args[ len ] = arguments[ len ];
  4947. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  4948. }
  4949. /* */
  4950. function handleError (err, vm, info) {
  4951. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  4952. // See: https://github.com/vuejs/vuex/issues/1505
  4953. pushTarget();
  4954. try {
  4955. if (vm) {
  4956. var cur = vm;
  4957. while ((cur = cur.$parent)) {
  4958. var hooks = cur.$options.errorCaptured;
  4959. if (hooks) {
  4960. for (var i = 0; i < hooks.length; i++) {
  4961. try {
  4962. var capture = hooks[i].call(cur, err, vm, info) === false;
  4963. if (capture) { return }
  4964. } catch (e) {
  4965. globalHandleError(e, cur, 'errorCaptured hook');
  4966. }
  4967. }
  4968. }
  4969. }
  4970. }
  4971. globalHandleError(err, vm, info);
  4972. } finally {
  4973. popTarget();
  4974. }
  4975. }
  4976. function invokeWithErrorHandling (
  4977. handler,
  4978. context,
  4979. args,
  4980. vm,
  4981. info
  4982. ) {
  4983. var res;
  4984. try {
  4985. res = args ? handler.apply(context, args) : handler.call(context);
  4986. if (res && !res._isVue && isPromise(res) && !res._handled) {
  4987. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  4988. // issue #9511
  4989. // avoid catch triggering multiple times when nested calls
  4990. res._handled = true;
  4991. }
  4992. } catch (e) {
  4993. handleError(e, vm, info);
  4994. }
  4995. return res
  4996. }
  4997. function globalHandleError (err, vm, info) {
  4998. if (config.errorHandler) {
  4999. try {
  5000. return config.errorHandler.call(null, err, vm, info)
  5001. } catch (e) {
  5002. // if the user intentionally throws the original error in the handler,
  5003. // do not log it twice
  5004. if (e !== err) {
  5005. logError(e, null, 'config.errorHandler');
  5006. }
  5007. }
  5008. }
  5009. logError(err, vm, info);
  5010. }
  5011. function logError (err, vm, info) {
  5012. if (true) {
  5013. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  5014. }
  5015. /* istanbul ignore else */
  5016. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  5017. console.error(err);
  5018. } else {
  5019. throw err
  5020. }
  5021. }
  5022. /* */
  5023. var callbacks = [];
  5024. var pending = false;
  5025. function flushCallbacks () {
  5026. pending = false;
  5027. var copies = callbacks.slice(0);
  5028. callbacks.length = 0;
  5029. for (var i = 0; i < copies.length; i++) {
  5030. copies[i]();
  5031. }
  5032. }
  5033. // Here we have async deferring wrappers using microtasks.
  5034. // In 2.5 we used (macro) tasks (in combination with microtasks).
  5035. // However, it has subtle problems when state is changed right before repaint
  5036. // (e.g. #6813, out-in transitions).
  5037. // Also, using (macro) tasks in event handler would cause some weird behaviors
  5038. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  5039. // So we now use microtasks everywhere, again.
  5040. // A major drawback of this tradeoff is that there are some scenarios
  5041. // where microtasks have too high a priority and fire in between supposedly
  5042. // sequential events (e.g. #4521, #6690, which have workarounds)
  5043. // or even between bubbling of the same event (#6566).
  5044. var timerFunc;
  5045. // The nextTick behavior leverages the microtask queue, which can be accessed
  5046. // via either native Promise.then or MutationObserver.
  5047. // MutationObserver has wider support, however it is seriously bugged in
  5048. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  5049. // completely stops working after triggering a few times... so, if native
  5050. // Promise is available, we will use it:
  5051. /* istanbul ignore next, $flow-disable-line */
  5052. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  5053. var p = Promise.resolve();
  5054. timerFunc = function () {
  5055. p.then(flushCallbacks);
  5056. // In problematic UIWebViews, Promise.then doesn't completely break, but
  5057. // it can get stuck in a weird state where callbacks are pushed into the
  5058. // microtask queue but the queue isn't being flushed, until the browser
  5059. // needs to do some other work, e.g. handle a timer. Therefore we can
  5060. // "force" the microtask queue to be flushed by adding an empty timer.
  5061. if (isIOS) { setTimeout(noop); }
  5062. };
  5063. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  5064. isNative(MutationObserver) ||
  5065. // PhantomJS and iOS 7.x
  5066. MutationObserver.toString() === '[object MutationObserverConstructor]'
  5067. )) {
  5068. // Use MutationObserver where native Promise is not available,
  5069. // e.g. PhantomJS, iOS7, Android 4.4
  5070. // (#6466 MutationObserver is unreliable in IE11)
  5071. var counter = 1;
  5072. var observer = new MutationObserver(flushCallbacks);
  5073. var textNode = document.createTextNode(String(counter));
  5074. observer.observe(textNode, {
  5075. characterData: true
  5076. });
  5077. timerFunc = function () {
  5078. counter = (counter + 1) % 2;
  5079. textNode.data = String(counter);
  5080. };
  5081. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  5082. // Fallback to setImmediate.
  5083. // Technically it leverages the (macro) task queue,
  5084. // but it is still a better choice than setTimeout.
  5085. timerFunc = function () {
  5086. setImmediate(flushCallbacks);
  5087. };
  5088. } else {
  5089. // Fallback to setTimeout.
  5090. timerFunc = function () {
  5091. setTimeout(flushCallbacks, 0);
  5092. };
  5093. }
  5094. function nextTick (cb, ctx) {
  5095. var _resolve;
  5096. callbacks.push(function () {
  5097. if (cb) {
  5098. try {
  5099. cb.call(ctx);
  5100. } catch (e) {
  5101. handleError(e, ctx, 'nextTick');
  5102. }
  5103. } else if (_resolve) {
  5104. _resolve(ctx);
  5105. }
  5106. });
  5107. if (!pending) {
  5108. pending = true;
  5109. timerFunc();
  5110. }
  5111. // $flow-disable-line
  5112. if (!cb && typeof Promise !== 'undefined') {
  5113. return new Promise(function (resolve) {
  5114. _resolve = resolve;
  5115. })
  5116. }
  5117. }
  5118. /* */
  5119. /* not type checking this file because flow doesn't play well with Proxy */
  5120. var initProxy;
  5121. if (true) {
  5122. var allowedGlobals = makeMap(
  5123. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5124. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5125. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5126. 'require' // for Webpack/Browserify
  5127. );
  5128. var warnNonPresent = function (target, key) {
  5129. warn(
  5130. "Property or method \"" + key + "\" is not defined on the instance but " +
  5131. 'referenced during render. Make sure that this property is reactive, ' +
  5132. 'either in the data option, or for class-based components, by ' +
  5133. 'initializing the property. ' +
  5134. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5135. target
  5136. );
  5137. };
  5138. var warnReservedPrefix = function (target, key) {
  5139. warn(
  5140. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5141. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  5142. 'prevent conflicts with Vue internals. ' +
  5143. 'See: https://vuejs.org/v2/api/#data',
  5144. target
  5145. );
  5146. };
  5147. var hasProxy =
  5148. typeof Proxy !== 'undefined' && isNative(Proxy);
  5149. if (hasProxy) {
  5150. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  5151. config.keyCodes = new Proxy(config.keyCodes, {
  5152. set: function set (target, key, value) {
  5153. if (isBuiltInModifier(key)) {
  5154. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  5155. return false
  5156. } else {
  5157. target[key] = value;
  5158. return true
  5159. }
  5160. }
  5161. });
  5162. }
  5163. var hasHandler = {
  5164. has: function has (target, key) {
  5165. var has = key in target;
  5166. var isAllowed = allowedGlobals(key) ||
  5167. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  5168. if (!has && !isAllowed) {
  5169. if (key in target.$data) { warnReservedPrefix(target, key); }
  5170. else { warnNonPresent(target, key); }
  5171. }
  5172. return has || !isAllowed
  5173. }
  5174. };
  5175. var getHandler = {
  5176. get: function get (target, key) {
  5177. if (typeof key === 'string' && !(key in target)) {
  5178. if (key in target.$data) { warnReservedPrefix(target, key); }
  5179. else { warnNonPresent(target, key); }
  5180. }
  5181. return target[key]
  5182. }
  5183. };
  5184. initProxy = function initProxy (vm) {
  5185. if (hasProxy) {
  5186. // determine which proxy handler to use
  5187. var options = vm.$options;
  5188. var handlers = options.render && options.render._withStripped
  5189. ? getHandler
  5190. : hasHandler;
  5191. vm._renderProxy = new Proxy(vm, handlers);
  5192. } else {
  5193. vm._renderProxy = vm;
  5194. }
  5195. };
  5196. }
  5197. /* */
  5198. var seenObjects = new _Set();
  5199. /**
  5200. * Recursively traverse an object to evoke all converted
  5201. * getters, so that every nested property inside the object
  5202. * is collected as a "deep" dependency.
  5203. */
  5204. function traverse (val) {
  5205. _traverse(val, seenObjects);
  5206. seenObjects.clear();
  5207. }
  5208. function _traverse (val, seen) {
  5209. var i, keys;
  5210. var isA = Array.isArray(val);
  5211. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  5212. return
  5213. }
  5214. if (val.__ob__) {
  5215. var depId = val.__ob__.dep.id;
  5216. if (seen.has(depId)) {
  5217. return
  5218. }
  5219. seen.add(depId);
  5220. }
  5221. if (isA) {
  5222. i = val.length;
  5223. while (i--) { _traverse(val[i], seen); }
  5224. } else {
  5225. keys = Object.keys(val);
  5226. i = keys.length;
  5227. while (i--) { _traverse(val[keys[i]], seen); }
  5228. }
  5229. }
  5230. var mark;
  5231. var measure;
  5232. if (true) {
  5233. var perf = inBrowser && window.performance;
  5234. /* istanbul ignore if */
  5235. if (
  5236. perf &&
  5237. perf.mark &&
  5238. perf.measure &&
  5239. perf.clearMarks &&
  5240. perf.clearMeasures
  5241. ) {
  5242. mark = function (tag) { return perf.mark(tag); };
  5243. measure = function (name, startTag, endTag) {
  5244. perf.measure(name, startTag, endTag);
  5245. perf.clearMarks(startTag);
  5246. perf.clearMarks(endTag);
  5247. // perf.clearMeasures(name)
  5248. };
  5249. }
  5250. }
  5251. /* */
  5252. var normalizeEvent = cached(function (name) {
  5253. var passive = name.charAt(0) === '&';
  5254. name = passive ? name.slice(1) : name;
  5255. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  5256. name = once$$1 ? name.slice(1) : name;
  5257. var capture = name.charAt(0) === '!';
  5258. name = capture ? name.slice(1) : name;
  5259. return {
  5260. name: name,
  5261. once: once$$1,
  5262. capture: capture,
  5263. passive: passive
  5264. }
  5265. });
  5266. function createFnInvoker (fns, vm) {
  5267. function invoker () {
  5268. var arguments$1 = arguments;
  5269. var fns = invoker.fns;
  5270. if (Array.isArray(fns)) {
  5271. var cloned = fns.slice();
  5272. for (var i = 0; i < cloned.length; i++) {
  5273. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  5274. }
  5275. } else {
  5276. // return handler return value for single handlers
  5277. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  5278. }
  5279. }
  5280. invoker.fns = fns;
  5281. return invoker
  5282. }
  5283. function updateListeners (
  5284. on,
  5285. oldOn,
  5286. add,
  5287. remove$$1,
  5288. createOnceHandler,
  5289. vm
  5290. ) {
  5291. var name, def$$1, cur, old, event;
  5292. for (name in on) {
  5293. def$$1 = cur = on[name];
  5294. old = oldOn[name];
  5295. event = normalizeEvent(name);
  5296. if (isUndef(cur)) {
  5297. true && warn(
  5298. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  5299. vm
  5300. );
  5301. } else if (isUndef(old)) {
  5302. if (isUndef(cur.fns)) {
  5303. cur = on[name] = createFnInvoker(cur, vm);
  5304. }
  5305. if (isTrue(event.once)) {
  5306. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  5307. }
  5308. add(event.name, cur, event.capture, event.passive, event.params);
  5309. } else if (cur !== old) {
  5310. old.fns = cur;
  5311. on[name] = old;
  5312. }
  5313. }
  5314. for (name in oldOn) {
  5315. if (isUndef(on[name])) {
  5316. event = normalizeEvent(name);
  5317. remove$$1(event.name, oldOn[name], event.capture);
  5318. }
  5319. }
  5320. }
  5321. /* */
  5322. /* */
  5323. // fixed by xxxxxx (mp properties)
  5324. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  5325. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  5326. if (isUndef(propOptions)) {
  5327. return res
  5328. }
  5329. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  5330. var attrs = data.attrs;
  5331. var props = data.props;
  5332. if (isDef(attrs) || isDef(props)) {
  5333. for (var key in propOptions) {
  5334. var altKey = hyphenate(key);
  5335. var result = checkProp(res, props, key, altKey, true) ||
  5336. checkProp(res, attrs, key, altKey, false);
  5337. // externalClass
  5338. if (
  5339. result &&
  5340. res[key] &&
  5341. externalClasses.indexOf(altKey) !== -1 &&
  5342. context[camelize(res[key])]
  5343. ) {
  5344. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  5345. res[key] = context[camelize(res[key])];
  5346. }
  5347. }
  5348. }
  5349. return res
  5350. }
  5351. function extractPropsFromVNodeData (
  5352. data,
  5353. Ctor,
  5354. tag,
  5355. context// fixed by xxxxxx
  5356. ) {
  5357. // we are only extracting raw values here.
  5358. // validation and default values are handled in the child
  5359. // component itself.
  5360. var propOptions = Ctor.options.props;
  5361. if (isUndef(propOptions)) {
  5362. // fixed by xxxxxx
  5363. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  5364. }
  5365. var res = {};
  5366. var attrs = data.attrs;
  5367. var props = data.props;
  5368. if (isDef(attrs) || isDef(props)) {
  5369. for (var key in propOptions) {
  5370. var altKey = hyphenate(key);
  5371. if (true) {
  5372. var keyInLowerCase = key.toLowerCase();
  5373. if (
  5374. key !== keyInLowerCase &&
  5375. attrs && hasOwn(attrs, keyInLowerCase)
  5376. ) {
  5377. tip(
  5378. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  5379. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  5380. " \"" + key + "\". " +
  5381. "Note that HTML attributes are case-insensitive and camelCased " +
  5382. "props need to use their kebab-case equivalents when using in-DOM " +
  5383. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  5384. );
  5385. }
  5386. }
  5387. checkProp(res, props, key, altKey, true) ||
  5388. checkProp(res, attrs, key, altKey, false);
  5389. }
  5390. }
  5391. // fixed by xxxxxx
  5392. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  5393. }
  5394. function checkProp (
  5395. res,
  5396. hash,
  5397. key,
  5398. altKey,
  5399. preserve
  5400. ) {
  5401. if (isDef(hash)) {
  5402. if (hasOwn(hash, key)) {
  5403. res[key] = hash[key];
  5404. if (!preserve) {
  5405. delete hash[key];
  5406. }
  5407. return true
  5408. } else if (hasOwn(hash, altKey)) {
  5409. res[key] = hash[altKey];
  5410. if (!preserve) {
  5411. delete hash[altKey];
  5412. }
  5413. return true
  5414. }
  5415. }
  5416. return false
  5417. }
  5418. /* */
  5419. // The template compiler attempts to minimize the need for normalization by
  5420. // statically analyzing the template at compile time.
  5421. //
  5422. // For plain HTML markup, normalization can be completely skipped because the
  5423. // generated render function is guaranteed to return Array<VNode>. There are
  5424. // two cases where extra normalization is needed:
  5425. // 1. When the children contains components - because a functional component
  5426. // may return an Array instead of a single root. In this case, just a simple
  5427. // normalization is needed - if any child is an Array, we flatten the whole
  5428. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  5429. // because functional components already normalize their own children.
  5430. function simpleNormalizeChildren (children) {
  5431. for (var i = 0; i < children.length; i++) {
  5432. if (Array.isArray(children[i])) {
  5433. return Array.prototype.concat.apply([], children)
  5434. }
  5435. }
  5436. return children
  5437. }
  5438. // 2. When the children contains constructs that always generated nested Arrays,
  5439. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  5440. // with hand-written render functions / JSX. In such cases a full normalization
  5441. // is needed to cater to all possible types of children values.
  5442. function normalizeChildren (children) {
  5443. return isPrimitive(children)
  5444. ? [createTextVNode(children)]
  5445. : Array.isArray(children)
  5446. ? normalizeArrayChildren(children)
  5447. : undefined
  5448. }
  5449. function isTextNode (node) {
  5450. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  5451. }
  5452. function normalizeArrayChildren (children, nestedIndex) {
  5453. var res = [];
  5454. var i, c, lastIndex, last;
  5455. for (i = 0; i < children.length; i++) {
  5456. c = children[i];
  5457. if (isUndef(c) || typeof c === 'boolean') { continue }
  5458. lastIndex = res.length - 1;
  5459. last = res[lastIndex];
  5460. // nested
  5461. if (Array.isArray(c)) {
  5462. if (c.length > 0) {
  5463. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  5464. // merge adjacent text nodes
  5465. if (isTextNode(c[0]) && isTextNode(last)) {
  5466. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  5467. c.shift();
  5468. }
  5469. res.push.apply(res, c);
  5470. }
  5471. } else if (isPrimitive(c)) {
  5472. if (isTextNode(last)) {
  5473. // merge adjacent text nodes
  5474. // this is necessary for SSR hydration because text nodes are
  5475. // essentially merged when rendered to HTML strings
  5476. res[lastIndex] = createTextVNode(last.text + c);
  5477. } else if (c !== '') {
  5478. // convert primitive to vnode
  5479. res.push(createTextVNode(c));
  5480. }
  5481. } else {
  5482. if (isTextNode(c) && isTextNode(last)) {
  5483. // merge adjacent text nodes
  5484. res[lastIndex] = createTextVNode(last.text + c.text);
  5485. } else {
  5486. // default key for nested array children (likely generated by v-for)
  5487. if (isTrue(children._isVList) &&
  5488. isDef(c.tag) &&
  5489. isUndef(c.key) &&
  5490. isDef(nestedIndex)) {
  5491. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  5492. }
  5493. res.push(c);
  5494. }
  5495. }
  5496. }
  5497. return res
  5498. }
  5499. /* */
  5500. function initProvide (vm) {
  5501. var provide = vm.$options.provide;
  5502. if (provide) {
  5503. vm._provided = typeof provide === 'function'
  5504. ? provide.call(vm)
  5505. : provide;
  5506. }
  5507. }
  5508. function initInjections (vm) {
  5509. var result = resolveInject(vm.$options.inject, vm);
  5510. if (result) {
  5511. toggleObserving(false);
  5512. Object.keys(result).forEach(function (key) {
  5513. /* istanbul ignore else */
  5514. if (true) {
  5515. defineReactive$$1(vm, key, result[key], function () {
  5516. warn(
  5517. "Avoid mutating an injected value directly since the changes will be " +
  5518. "overwritten whenever the provided component re-renders. " +
  5519. "injection being mutated: \"" + key + "\"",
  5520. vm
  5521. );
  5522. });
  5523. } else {}
  5524. });
  5525. toggleObserving(true);
  5526. }
  5527. }
  5528. function resolveInject (inject, vm) {
  5529. if (inject) {
  5530. // inject is :any because flow is not smart enough to figure out cached
  5531. var result = Object.create(null);
  5532. var keys = hasSymbol
  5533. ? Reflect.ownKeys(inject)
  5534. : Object.keys(inject);
  5535. for (var i = 0; i < keys.length; i++) {
  5536. var key = keys[i];
  5537. // #6574 in case the inject object is observed...
  5538. if (key === '__ob__') { continue }
  5539. var provideKey = inject[key].from;
  5540. var source = vm;
  5541. while (source) {
  5542. if (source._provided && hasOwn(source._provided, provideKey)) {
  5543. result[key] = source._provided[provideKey];
  5544. break
  5545. }
  5546. source = source.$parent;
  5547. }
  5548. if (!source) {
  5549. if ('default' in inject[key]) {
  5550. var provideDefault = inject[key].default;
  5551. result[key] = typeof provideDefault === 'function'
  5552. ? provideDefault.call(vm)
  5553. : provideDefault;
  5554. } else if (true) {
  5555. warn(("Injection \"" + key + "\" not found"), vm);
  5556. }
  5557. }
  5558. }
  5559. return result
  5560. }
  5561. }
  5562. /* */
  5563. /**
  5564. * Runtime helper for resolving raw children VNodes into a slot object.
  5565. */
  5566. function resolveSlots (
  5567. children,
  5568. context
  5569. ) {
  5570. if (!children || !children.length) {
  5571. return {}
  5572. }
  5573. var slots = {};
  5574. for (var i = 0, l = children.length; i < l; i++) {
  5575. var child = children[i];
  5576. var data = child.data;
  5577. // remove slot attribute if the node is resolved as a Vue slot node
  5578. if (data && data.attrs && data.attrs.slot) {
  5579. delete data.attrs.slot;
  5580. }
  5581. // named slots should only be respected if the vnode was rendered in the
  5582. // same context.
  5583. if ((child.context === context || child.fnContext === context) &&
  5584. data && data.slot != null
  5585. ) {
  5586. var name = data.slot;
  5587. var slot = (slots[name] || (slots[name] = []));
  5588. if (child.tag === 'template') {
  5589. slot.push.apply(slot, child.children || []);
  5590. } else {
  5591. slot.push(child);
  5592. }
  5593. } else {
  5594. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  5595. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  5596. (slots['page'] || (slots['page'] = [])).push(child);
  5597. }else{
  5598. (slots.default || (slots.default = [])).push(child);
  5599. }
  5600. }
  5601. }
  5602. // ignore slots that contains only whitespace
  5603. for (var name$1 in slots) {
  5604. if (slots[name$1].every(isWhitespace)) {
  5605. delete slots[name$1];
  5606. }
  5607. }
  5608. return slots
  5609. }
  5610. function isWhitespace (node) {
  5611. return (node.isComment && !node.asyncFactory) || node.text === ' '
  5612. }
  5613. /* */
  5614. function normalizeScopedSlots (
  5615. slots,
  5616. normalSlots,
  5617. prevSlots
  5618. ) {
  5619. var res;
  5620. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  5621. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  5622. var key = slots && slots.$key;
  5623. if (!slots) {
  5624. res = {};
  5625. } else if (slots._normalized) {
  5626. // fast path 1: child component re-render only, parent did not change
  5627. return slots._normalized
  5628. } else if (
  5629. isStable &&
  5630. prevSlots &&
  5631. prevSlots !== emptyObject &&
  5632. key === prevSlots.$key &&
  5633. !hasNormalSlots &&
  5634. !prevSlots.$hasNormal
  5635. ) {
  5636. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  5637. // only need to normalize once
  5638. return prevSlots
  5639. } else {
  5640. res = {};
  5641. for (var key$1 in slots) {
  5642. if (slots[key$1] && key$1[0] !== '$') {
  5643. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  5644. }
  5645. }
  5646. }
  5647. // expose normal slots on scopedSlots
  5648. for (var key$2 in normalSlots) {
  5649. if (!(key$2 in res)) {
  5650. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  5651. }
  5652. }
  5653. // avoriaz seems to mock a non-extensible $scopedSlots object
  5654. // and when that is passed down this would cause an error
  5655. if (slots && Object.isExtensible(slots)) {
  5656. (slots)._normalized = res;
  5657. }
  5658. def(res, '$stable', isStable);
  5659. def(res, '$key', key);
  5660. def(res, '$hasNormal', hasNormalSlots);
  5661. return res
  5662. }
  5663. function normalizeScopedSlot(normalSlots, key, fn) {
  5664. var normalized = function () {
  5665. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  5666. res = res && typeof res === 'object' && !Array.isArray(res)
  5667. ? [res] // single vnode
  5668. : normalizeChildren(res);
  5669. return res && (
  5670. res.length === 0 ||
  5671. (res.length === 1 && res[0].isComment) // #9658
  5672. ) ? undefined
  5673. : res
  5674. };
  5675. // this is a slot using the new v-slot syntax without scope. although it is
  5676. // compiled as a scoped slot, render fn users would expect it to be present
  5677. // on this.$slots because the usage is semantically a normal slot.
  5678. if (fn.proxy) {
  5679. Object.defineProperty(normalSlots, key, {
  5680. get: normalized,
  5681. enumerable: true,
  5682. configurable: true
  5683. });
  5684. }
  5685. return normalized
  5686. }
  5687. function proxyNormalSlot(slots, key) {
  5688. return function () { return slots[key]; }
  5689. }
  5690. /* */
  5691. /**
  5692. * Runtime helper for rendering v-for lists.
  5693. */
  5694. function renderList (
  5695. val,
  5696. render
  5697. ) {
  5698. var ret, i, l, keys, key;
  5699. if (Array.isArray(val) || typeof val === 'string') {
  5700. ret = new Array(val.length);
  5701. for (i = 0, l = val.length; i < l; i++) {
  5702. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  5703. }
  5704. } else if (typeof val === 'number') {
  5705. ret = new Array(val);
  5706. for (i = 0; i < val; i++) {
  5707. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  5708. }
  5709. } else if (isObject(val)) {
  5710. if (hasSymbol && val[Symbol.iterator]) {
  5711. ret = [];
  5712. var iterator = val[Symbol.iterator]();
  5713. var result = iterator.next();
  5714. while (!result.done) {
  5715. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  5716. result = iterator.next();
  5717. }
  5718. } else {
  5719. keys = Object.keys(val);
  5720. ret = new Array(keys.length);
  5721. for (i = 0, l = keys.length; i < l; i++) {
  5722. key = keys[i];
  5723. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  5724. }
  5725. }
  5726. }
  5727. if (!isDef(ret)) {
  5728. ret = [];
  5729. }
  5730. (ret)._isVList = true;
  5731. return ret
  5732. }
  5733. /* */
  5734. /**
  5735. * Runtime helper for rendering <slot>
  5736. */
  5737. function renderSlot (
  5738. name,
  5739. fallback,
  5740. props,
  5741. bindObject
  5742. ) {
  5743. var scopedSlotFn = this.$scopedSlots[name];
  5744. var nodes;
  5745. if (scopedSlotFn) { // scoped slot
  5746. props = props || {};
  5747. if (bindObject) {
  5748. if ( true && !isObject(bindObject)) {
  5749. warn(
  5750. 'slot v-bind without argument expects an Object',
  5751. this
  5752. );
  5753. }
  5754. props = extend(extend({}, bindObject), props);
  5755. }
  5756. // fixed by xxxxxx app-plus scopedSlot
  5757. nodes = scopedSlotFn(props, this, props._i) || fallback;
  5758. } else {
  5759. nodes = this.$slots[name] || fallback;
  5760. }
  5761. var target = props && props.slot;
  5762. if (target) {
  5763. return this.$createElement('template', { slot: target }, nodes)
  5764. } else {
  5765. return nodes
  5766. }
  5767. }
  5768. /* */
  5769. /**
  5770. * Runtime helper for resolving filters
  5771. */
  5772. function resolveFilter (id) {
  5773. return resolveAsset(this.$options, 'filters', id, true) || identity
  5774. }
  5775. /* */
  5776. function isKeyNotMatch (expect, actual) {
  5777. if (Array.isArray(expect)) {
  5778. return expect.indexOf(actual) === -1
  5779. } else {
  5780. return expect !== actual
  5781. }
  5782. }
  5783. /**
  5784. * Runtime helper for checking keyCodes from config.
  5785. * exposed as Vue.prototype._k
  5786. * passing in eventKeyName as last argument separately for backwards compat
  5787. */
  5788. function checkKeyCodes (
  5789. eventKeyCode,
  5790. key,
  5791. builtInKeyCode,
  5792. eventKeyName,
  5793. builtInKeyName
  5794. ) {
  5795. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  5796. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  5797. return isKeyNotMatch(builtInKeyName, eventKeyName)
  5798. } else if (mappedKeyCode) {
  5799. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  5800. } else if (eventKeyName) {
  5801. return hyphenate(eventKeyName) !== key
  5802. }
  5803. }
  5804. /* */
  5805. /**
  5806. * Runtime helper for merging v-bind="object" into a VNode's data.
  5807. */
  5808. function bindObjectProps (
  5809. data,
  5810. tag,
  5811. value,
  5812. asProp,
  5813. isSync
  5814. ) {
  5815. if (value) {
  5816. if (!isObject(value)) {
  5817. true && warn(
  5818. 'v-bind without argument expects an Object or Array value',
  5819. this
  5820. );
  5821. } else {
  5822. if (Array.isArray(value)) {
  5823. value = toObject(value);
  5824. }
  5825. var hash;
  5826. var loop = function ( key ) {
  5827. if (
  5828. key === 'class' ||
  5829. key === 'style' ||
  5830. isReservedAttribute(key)
  5831. ) {
  5832. hash = data;
  5833. } else {
  5834. var type = data.attrs && data.attrs.type;
  5835. hash = asProp || config.mustUseProp(tag, type, key)
  5836. ? data.domProps || (data.domProps = {})
  5837. : data.attrs || (data.attrs = {});
  5838. }
  5839. var camelizedKey = camelize(key);
  5840. var hyphenatedKey = hyphenate(key);
  5841. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  5842. hash[key] = value[key];
  5843. if (isSync) {
  5844. var on = data.on || (data.on = {});
  5845. on[("update:" + key)] = function ($event) {
  5846. value[key] = $event;
  5847. };
  5848. }
  5849. }
  5850. };
  5851. for (var key in value) loop( key );
  5852. }
  5853. }
  5854. return data
  5855. }
  5856. /* */
  5857. /**
  5858. * Runtime helper for rendering static trees.
  5859. */
  5860. function renderStatic (
  5861. index,
  5862. isInFor
  5863. ) {
  5864. var cached = this._staticTrees || (this._staticTrees = []);
  5865. var tree = cached[index];
  5866. // if has already-rendered static tree and not inside v-for,
  5867. // we can reuse the same tree.
  5868. if (tree && !isInFor) {
  5869. return tree
  5870. }
  5871. // otherwise, render a fresh tree.
  5872. tree = cached[index] = this.$options.staticRenderFns[index].call(
  5873. this._renderProxy,
  5874. null,
  5875. this // for render fns generated for functional component templates
  5876. );
  5877. markStatic(tree, ("__static__" + index), false);
  5878. return tree
  5879. }
  5880. /**
  5881. * Runtime helper for v-once.
  5882. * Effectively it means marking the node as static with a unique key.
  5883. */
  5884. function markOnce (
  5885. tree,
  5886. index,
  5887. key
  5888. ) {
  5889. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  5890. return tree
  5891. }
  5892. function markStatic (
  5893. tree,
  5894. key,
  5895. isOnce
  5896. ) {
  5897. if (Array.isArray(tree)) {
  5898. for (var i = 0; i < tree.length; i++) {
  5899. if (tree[i] && typeof tree[i] !== 'string') {
  5900. markStaticNode(tree[i], (key + "_" + i), isOnce);
  5901. }
  5902. }
  5903. } else {
  5904. markStaticNode(tree, key, isOnce);
  5905. }
  5906. }
  5907. function markStaticNode (node, key, isOnce) {
  5908. node.isStatic = true;
  5909. node.key = key;
  5910. node.isOnce = isOnce;
  5911. }
  5912. /* */
  5913. function bindObjectListeners (data, value) {
  5914. if (value) {
  5915. if (!isPlainObject(value)) {
  5916. true && warn(
  5917. 'v-on without argument expects an Object value',
  5918. this
  5919. );
  5920. } else {
  5921. var on = data.on = data.on ? extend({}, data.on) : {};
  5922. for (var key in value) {
  5923. var existing = on[key];
  5924. var ours = value[key];
  5925. on[key] = existing ? [].concat(existing, ours) : ours;
  5926. }
  5927. }
  5928. }
  5929. return data
  5930. }
  5931. /* */
  5932. function resolveScopedSlots (
  5933. fns, // see flow/vnode
  5934. res,
  5935. // the following are added in 2.6
  5936. hasDynamicKeys,
  5937. contentHashKey
  5938. ) {
  5939. res = res || { $stable: !hasDynamicKeys };
  5940. for (var i = 0; i < fns.length; i++) {
  5941. var slot = fns[i];
  5942. if (Array.isArray(slot)) {
  5943. resolveScopedSlots(slot, res, hasDynamicKeys);
  5944. } else if (slot) {
  5945. // marker for reverse proxying v-slot without scope on this.$slots
  5946. if (slot.proxy) {
  5947. slot.fn.proxy = true;
  5948. }
  5949. res[slot.key] = slot.fn;
  5950. }
  5951. }
  5952. if (contentHashKey) {
  5953. (res).$key = contentHashKey;
  5954. }
  5955. return res
  5956. }
  5957. /* */
  5958. function bindDynamicKeys (baseObj, values) {
  5959. for (var i = 0; i < values.length; i += 2) {
  5960. var key = values[i];
  5961. if (typeof key === 'string' && key) {
  5962. baseObj[values[i]] = values[i + 1];
  5963. } else if ( true && key !== '' && key !== null) {
  5964. // null is a special value for explicitly removing a binding
  5965. warn(
  5966. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  5967. this
  5968. );
  5969. }
  5970. }
  5971. return baseObj
  5972. }
  5973. // helper to dynamically append modifier runtime markers to event names.
  5974. // ensure only append when value is already string, otherwise it will be cast
  5975. // to string and cause the type check to miss.
  5976. function prependModifier (value, symbol) {
  5977. return typeof value === 'string' ? symbol + value : value
  5978. }
  5979. /* */
  5980. function installRenderHelpers (target) {
  5981. target._o = markOnce;
  5982. target._n = toNumber;
  5983. target._s = toString;
  5984. target._l = renderList;
  5985. target._t = renderSlot;
  5986. target._q = looseEqual;
  5987. target._i = looseIndexOf;
  5988. target._m = renderStatic;
  5989. target._f = resolveFilter;
  5990. target._k = checkKeyCodes;
  5991. target._b = bindObjectProps;
  5992. target._v = createTextVNode;
  5993. target._e = createEmptyVNode;
  5994. target._u = resolveScopedSlots;
  5995. target._g = bindObjectListeners;
  5996. target._d = bindDynamicKeys;
  5997. target._p = prependModifier;
  5998. }
  5999. /* */
  6000. function FunctionalRenderContext (
  6001. data,
  6002. props,
  6003. children,
  6004. parent,
  6005. Ctor
  6006. ) {
  6007. var this$1 = this;
  6008. var options = Ctor.options;
  6009. // ensure the createElement function in functional components
  6010. // gets a unique context - this is necessary for correct named slot check
  6011. var contextVm;
  6012. if (hasOwn(parent, '_uid')) {
  6013. contextVm = Object.create(parent);
  6014. // $flow-disable-line
  6015. contextVm._original = parent;
  6016. } else {
  6017. // the context vm passed in is a functional context as well.
  6018. // in this case we want to make sure we are able to get a hold to the
  6019. // real context instance.
  6020. contextVm = parent;
  6021. // $flow-disable-line
  6022. parent = parent._original;
  6023. }
  6024. var isCompiled = isTrue(options._compiled);
  6025. var needNormalization = !isCompiled;
  6026. this.data = data;
  6027. this.props = props;
  6028. this.children = children;
  6029. this.parent = parent;
  6030. this.listeners = data.on || emptyObject;
  6031. this.injections = resolveInject(options.inject, parent);
  6032. this.slots = function () {
  6033. if (!this$1.$slots) {
  6034. normalizeScopedSlots(
  6035. data.scopedSlots,
  6036. this$1.$slots = resolveSlots(children, parent)
  6037. );
  6038. }
  6039. return this$1.$slots
  6040. };
  6041. Object.defineProperty(this, 'scopedSlots', ({
  6042. enumerable: true,
  6043. get: function get () {
  6044. return normalizeScopedSlots(data.scopedSlots, this.slots())
  6045. }
  6046. }));
  6047. // support for compiled functional template
  6048. if (isCompiled) {
  6049. // exposing $options for renderStatic()
  6050. this.$options = options;
  6051. // pre-resolve slots for renderSlot()
  6052. this.$slots = this.slots();
  6053. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  6054. }
  6055. if (options._scopeId) {
  6056. this._c = function (a, b, c, d) {
  6057. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  6058. if (vnode && !Array.isArray(vnode)) {
  6059. vnode.fnScopeId = options._scopeId;
  6060. vnode.fnContext = parent;
  6061. }
  6062. return vnode
  6063. };
  6064. } else {
  6065. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  6066. }
  6067. }
  6068. installRenderHelpers(FunctionalRenderContext.prototype);
  6069. function createFunctionalComponent (
  6070. Ctor,
  6071. propsData,
  6072. data,
  6073. contextVm,
  6074. children
  6075. ) {
  6076. var options = Ctor.options;
  6077. var props = {};
  6078. var propOptions = options.props;
  6079. if (isDef(propOptions)) {
  6080. for (var key in propOptions) {
  6081. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6082. }
  6083. } else {
  6084. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  6085. if (isDef(data.props)) { mergeProps(props, data.props); }
  6086. }
  6087. var renderContext = new FunctionalRenderContext(
  6088. data,
  6089. props,
  6090. children,
  6091. contextVm,
  6092. Ctor
  6093. );
  6094. var vnode = options.render.call(null, renderContext._c, renderContext);
  6095. if (vnode instanceof VNode) {
  6096. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6097. } else if (Array.isArray(vnode)) {
  6098. var vnodes = normalizeChildren(vnode) || [];
  6099. var res = new Array(vnodes.length);
  6100. for (var i = 0; i < vnodes.length; i++) {
  6101. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6102. }
  6103. return res
  6104. }
  6105. }
  6106. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  6107. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6108. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6109. // that should not be matched to match.
  6110. var clone = cloneVNode(vnode);
  6111. clone.fnContext = contextVm;
  6112. clone.fnOptions = options;
  6113. if (true) {
  6114. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6115. }
  6116. if (data.slot) {
  6117. (clone.data || (clone.data = {})).slot = data.slot;
  6118. }
  6119. return clone
  6120. }
  6121. function mergeProps (to, from) {
  6122. for (var key in from) {
  6123. to[camelize(key)] = from[key];
  6124. }
  6125. }
  6126. /* */
  6127. /* */
  6128. /* */
  6129. /* */
  6130. // inline hooks to be invoked on component VNodes during patch
  6131. var componentVNodeHooks = {
  6132. init: function init (vnode, hydrating) {
  6133. if (
  6134. vnode.componentInstance &&
  6135. !vnode.componentInstance._isDestroyed &&
  6136. vnode.data.keepAlive
  6137. ) {
  6138. // kept-alive components, treat as a patch
  6139. var mountedNode = vnode; // work around flow
  6140. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6141. } else {
  6142. var child = vnode.componentInstance = createComponentInstanceForVnode(
  6143. vnode,
  6144. activeInstance
  6145. );
  6146. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  6147. }
  6148. },
  6149. prepatch: function prepatch (oldVnode, vnode) {
  6150. var options = vnode.componentOptions;
  6151. var child = vnode.componentInstance = oldVnode.componentInstance;
  6152. updateChildComponent(
  6153. child,
  6154. options.propsData, // updated props
  6155. options.listeners, // updated listeners
  6156. vnode, // new parent vnode
  6157. options.children // new children
  6158. );
  6159. },
  6160. insert: function insert (vnode) {
  6161. var context = vnode.context;
  6162. var componentInstance = vnode.componentInstance;
  6163. if (!componentInstance._isMounted) {
  6164. callHook(componentInstance, 'onServiceCreated');
  6165. callHook(componentInstance, 'onServiceAttached');
  6166. componentInstance._isMounted = true;
  6167. callHook(componentInstance, 'mounted');
  6168. }
  6169. if (vnode.data.keepAlive) {
  6170. if (context._isMounted) {
  6171. // vue-router#1212
  6172. // During updates, a kept-alive component's child components may
  6173. // change, so directly walking the tree here may call activated hooks
  6174. // on incorrect children. Instead we push them into a queue which will
  6175. // be processed after the whole patch process ended.
  6176. queueActivatedComponent(componentInstance);
  6177. } else {
  6178. activateChildComponent(componentInstance, true /* direct */);
  6179. }
  6180. }
  6181. },
  6182. destroy: function destroy (vnode) {
  6183. var componentInstance = vnode.componentInstance;
  6184. if (!componentInstance._isDestroyed) {
  6185. if (!vnode.data.keepAlive) {
  6186. componentInstance.$destroy();
  6187. } else {
  6188. deactivateChildComponent(componentInstance, true /* direct */);
  6189. }
  6190. }
  6191. }
  6192. };
  6193. var hooksToMerge = Object.keys(componentVNodeHooks);
  6194. function createComponent (
  6195. Ctor,
  6196. data,
  6197. context,
  6198. children,
  6199. tag
  6200. ) {
  6201. if (isUndef(Ctor)) {
  6202. return
  6203. }
  6204. var baseCtor = context.$options._base;
  6205. // plain options object: turn it into a constructor
  6206. if (isObject(Ctor)) {
  6207. Ctor = baseCtor.extend(Ctor);
  6208. }
  6209. // if at this stage it's not a constructor or an async component factory,
  6210. // reject.
  6211. if (typeof Ctor !== 'function') {
  6212. if (true) {
  6213. warn(("Invalid Component definition: " + (String(Ctor))), context);
  6214. }
  6215. return
  6216. }
  6217. // async component
  6218. var asyncFactory;
  6219. if (isUndef(Ctor.cid)) {
  6220. asyncFactory = Ctor;
  6221. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  6222. if (Ctor === undefined) {
  6223. // return a placeholder node for async component, which is rendered
  6224. // as a comment node but preserves all the raw information for the node.
  6225. // the information will be used for async server-rendering and hydration.
  6226. return createAsyncPlaceholder(
  6227. asyncFactory,
  6228. data,
  6229. context,
  6230. children,
  6231. tag
  6232. )
  6233. }
  6234. }
  6235. data = data || {};
  6236. // resolve constructor options in case global mixins are applied after
  6237. // component constructor creation
  6238. resolveConstructorOptions(Ctor);
  6239. // transform component v-model data into props & events
  6240. if (isDef(data.model)) {
  6241. transformModel(Ctor.options, data);
  6242. }
  6243. // extract props
  6244. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  6245. // functional component
  6246. if (isTrue(Ctor.options.functional)) {
  6247. return createFunctionalComponent(Ctor, propsData, data, context, children)
  6248. }
  6249. // extract listeners, since these needs to be treated as
  6250. // child component listeners instead of DOM listeners
  6251. var listeners = data.on;
  6252. // replace with listeners with .native modifier
  6253. // so it gets processed during parent component patch.
  6254. data.on = data.nativeOn;
  6255. if (isTrue(Ctor.options.abstract)) {
  6256. // abstract components do not keep anything
  6257. // other than props & listeners & slot
  6258. // work around flow
  6259. var slot = data.slot;
  6260. data = {};
  6261. if (slot) {
  6262. data.slot = slot;
  6263. }
  6264. }
  6265. // install component management hooks onto the placeholder node
  6266. installComponentHooks(data);
  6267. // return a placeholder vnode
  6268. var name = Ctor.options.name || tag;
  6269. var vnode = new VNode(
  6270. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  6271. data, undefined, undefined, undefined, context,
  6272. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  6273. asyncFactory
  6274. );
  6275. return vnode
  6276. }
  6277. function createComponentInstanceForVnode (
  6278. vnode, // we know it's MountedComponentVNode but flow doesn't
  6279. parent // activeInstance in lifecycle state
  6280. ) {
  6281. var options = {
  6282. _isComponent: true,
  6283. _parentVnode: vnode,
  6284. parent: parent
  6285. };
  6286. // check inline-template render functions
  6287. var inlineTemplate = vnode.data.inlineTemplate;
  6288. if (isDef(inlineTemplate)) {
  6289. options.render = inlineTemplate.render;
  6290. options.staticRenderFns = inlineTemplate.staticRenderFns;
  6291. }
  6292. return new vnode.componentOptions.Ctor(options)
  6293. }
  6294. function installComponentHooks (data) {
  6295. var hooks = data.hook || (data.hook = {});
  6296. for (var i = 0; i < hooksToMerge.length; i++) {
  6297. var key = hooksToMerge[i];
  6298. var existing = hooks[key];
  6299. var toMerge = componentVNodeHooks[key];
  6300. if (existing !== toMerge && !(existing && existing._merged)) {
  6301. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  6302. }
  6303. }
  6304. }
  6305. function mergeHook$1 (f1, f2) {
  6306. var merged = function (a, b) {
  6307. // flow complains about extra args which is why we use any
  6308. f1(a, b);
  6309. f2(a, b);
  6310. };
  6311. merged._merged = true;
  6312. return merged
  6313. }
  6314. // transform component v-model info (value and callback) into
  6315. // prop and event handler respectively.
  6316. function transformModel (options, data) {
  6317. var prop = (options.model && options.model.prop) || 'value';
  6318. var event = (options.model && options.model.event) || 'input'
  6319. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  6320. var on = data.on || (data.on = {});
  6321. var existing = on[event];
  6322. var callback = data.model.callback;
  6323. if (isDef(existing)) {
  6324. if (
  6325. Array.isArray(existing)
  6326. ? existing.indexOf(callback) === -1
  6327. : existing !== callback
  6328. ) {
  6329. on[event] = [callback].concat(existing);
  6330. }
  6331. } else {
  6332. on[event] = callback;
  6333. }
  6334. }
  6335. /* */
  6336. var SIMPLE_NORMALIZE = 1;
  6337. var ALWAYS_NORMALIZE = 2;
  6338. // wrapper function for providing a more flexible interface
  6339. // without getting yelled at by flow
  6340. function createElement (
  6341. context,
  6342. tag,
  6343. data,
  6344. children,
  6345. normalizationType,
  6346. alwaysNormalize
  6347. ) {
  6348. if (Array.isArray(data) || isPrimitive(data)) {
  6349. normalizationType = children;
  6350. children = data;
  6351. data = undefined;
  6352. }
  6353. if (isTrue(alwaysNormalize)) {
  6354. normalizationType = ALWAYS_NORMALIZE;
  6355. }
  6356. return _createElement(context, tag, data, children, normalizationType)
  6357. }
  6358. function _createElement (
  6359. context,
  6360. tag,
  6361. data,
  6362. children,
  6363. normalizationType
  6364. ) {
  6365. if (isDef(data) && isDef((data).__ob__)) {
  6366. true && warn(
  6367. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  6368. 'Always create fresh vnode data objects in each render!',
  6369. context
  6370. );
  6371. return createEmptyVNode()
  6372. }
  6373. // object syntax in v-bind
  6374. if (isDef(data) && isDef(data.is)) {
  6375. tag = data.is;
  6376. }
  6377. if (!tag) {
  6378. // in case of component :is set to falsy value
  6379. return createEmptyVNode()
  6380. }
  6381. // warn against non-primitive key
  6382. if ( true &&
  6383. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  6384. ) {
  6385. {
  6386. warn(
  6387. 'Avoid using non-primitive value as key, ' +
  6388. 'use string/number value instead.',
  6389. context
  6390. );
  6391. }
  6392. }
  6393. // support single function children as default scoped slot
  6394. if (Array.isArray(children) &&
  6395. typeof children[0] === 'function'
  6396. ) {
  6397. data = data || {};
  6398. data.scopedSlots = { default: children[0] };
  6399. children.length = 0;
  6400. }
  6401. if (normalizationType === ALWAYS_NORMALIZE) {
  6402. children = normalizeChildren(children);
  6403. } else if (normalizationType === SIMPLE_NORMALIZE) {
  6404. children = simpleNormalizeChildren(children);
  6405. }
  6406. var vnode, ns;
  6407. if (typeof tag === 'string') {
  6408. var Ctor;
  6409. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  6410. if (config.isReservedTag(tag)) {
  6411. // platform built-in elements
  6412. if ( true && isDef(data) && isDef(data.nativeOn)) {
  6413. warn(
  6414. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  6415. context
  6416. );
  6417. }
  6418. vnode = new VNode(
  6419. config.parsePlatformTagName(tag), data, children,
  6420. undefined, undefined, context
  6421. );
  6422. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  6423. // component
  6424. vnode = createComponent(Ctor, data, context, children, tag);
  6425. } else {
  6426. // unknown or unlisted namespaced elements
  6427. // check at runtime because it may get assigned a namespace when its
  6428. // parent normalizes children
  6429. vnode = new VNode(
  6430. tag, data, children,
  6431. undefined, undefined, context
  6432. );
  6433. }
  6434. } else {
  6435. // direct component options / constructor
  6436. vnode = createComponent(tag, data, context, children);
  6437. }
  6438. if (Array.isArray(vnode)) {
  6439. return vnode
  6440. } else if (isDef(vnode)) {
  6441. if (isDef(ns)) { applyNS(vnode, ns); }
  6442. if (isDef(data)) { registerDeepBindings(data); }
  6443. return vnode
  6444. } else {
  6445. return createEmptyVNode()
  6446. }
  6447. }
  6448. function applyNS (vnode, ns, force) {
  6449. vnode.ns = ns;
  6450. if (vnode.tag === 'foreignObject') {
  6451. // use default namespace inside foreignObject
  6452. ns = undefined;
  6453. force = true;
  6454. }
  6455. if (isDef(vnode.children)) {
  6456. for (var i = 0, l = vnode.children.length; i < l; i++) {
  6457. var child = vnode.children[i];
  6458. if (isDef(child.tag) && (
  6459. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  6460. applyNS(child, ns, force);
  6461. }
  6462. }
  6463. }
  6464. }
  6465. // ref #5318
  6466. // necessary to ensure parent re-render when deep bindings like :style and
  6467. // :class are used on slot nodes
  6468. function registerDeepBindings (data) {
  6469. if (isObject(data.style)) {
  6470. traverse(data.style);
  6471. }
  6472. if (isObject(data.class)) {
  6473. traverse(data.class);
  6474. }
  6475. }
  6476. /* */
  6477. function initRender (vm) {
  6478. vm._vnode = null; // the root of the child tree
  6479. vm._staticTrees = null; // v-once cached trees
  6480. var options = vm.$options;
  6481. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  6482. var renderContext = parentVnode && parentVnode.context;
  6483. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  6484. vm.$scopedSlots = emptyObject;
  6485. // bind the createElement fn to this instance
  6486. // so that we get proper render context inside it.
  6487. // args order: tag, data, children, normalizationType, alwaysNormalize
  6488. // internal version is used by render functions compiled from templates
  6489. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  6490. // normalization is always applied for the public version, used in
  6491. // user-written render functions.
  6492. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  6493. // $attrs & $listeners are exposed for easier HOC creation.
  6494. // they need to be reactive so that HOCs using them are always updated
  6495. var parentData = parentVnode && parentVnode.data;
  6496. /* istanbul ignore else */
  6497. if (true) {
  6498. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  6499. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  6500. }, true);
  6501. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  6502. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  6503. }, true);
  6504. } else {}
  6505. }
  6506. var currentRenderingInstance = null;
  6507. function renderMixin (Vue) {
  6508. // install runtime convenience helpers
  6509. installRenderHelpers(Vue.prototype);
  6510. Vue.prototype.$nextTick = function (fn) {
  6511. return nextTick(fn, this)
  6512. };
  6513. Vue.prototype._render = function () {
  6514. var vm = this;
  6515. var ref = vm.$options;
  6516. var render = ref.render;
  6517. var _parentVnode = ref._parentVnode;
  6518. if (_parentVnode) {
  6519. vm.$scopedSlots = normalizeScopedSlots(
  6520. _parentVnode.data.scopedSlots,
  6521. vm.$slots,
  6522. vm.$scopedSlots
  6523. );
  6524. }
  6525. // set parent vnode. this allows render functions to have access
  6526. // to the data on the placeholder node.
  6527. vm.$vnode = _parentVnode;
  6528. // render self
  6529. var vnode;
  6530. try {
  6531. // There's no need to maintain a stack because all render fns are called
  6532. // separately from one another. Nested component's render fns are called
  6533. // when parent component is patched.
  6534. currentRenderingInstance = vm;
  6535. vnode = render.call(vm._renderProxy, vm.$createElement);
  6536. } catch (e) {
  6537. handleError(e, vm, "render");
  6538. // return error render result,
  6539. // or previous vnode to prevent render error causing blank component
  6540. /* istanbul ignore else */
  6541. if ( true && vm.$options.renderError) {
  6542. try {
  6543. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  6544. } catch (e) {
  6545. handleError(e, vm, "renderError");
  6546. vnode = vm._vnode;
  6547. }
  6548. } else {
  6549. vnode = vm._vnode;
  6550. }
  6551. } finally {
  6552. currentRenderingInstance = null;
  6553. }
  6554. // if the returned array contains only a single node, allow it
  6555. if (Array.isArray(vnode) && vnode.length === 1) {
  6556. vnode = vnode[0];
  6557. }
  6558. // return empty vnode in case the render function errored out
  6559. if (!(vnode instanceof VNode)) {
  6560. if ( true && Array.isArray(vnode)) {
  6561. warn(
  6562. 'Multiple root nodes returned from render function. Render function ' +
  6563. 'should return a single root node.',
  6564. vm
  6565. );
  6566. }
  6567. vnode = createEmptyVNode();
  6568. }
  6569. // set parent
  6570. vnode.parent = _parentVnode;
  6571. return vnode
  6572. };
  6573. }
  6574. /* */
  6575. function ensureCtor (comp, base) {
  6576. if (
  6577. comp.__esModule ||
  6578. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  6579. ) {
  6580. comp = comp.default;
  6581. }
  6582. return isObject(comp)
  6583. ? base.extend(comp)
  6584. : comp
  6585. }
  6586. function createAsyncPlaceholder (
  6587. factory,
  6588. data,
  6589. context,
  6590. children,
  6591. tag
  6592. ) {
  6593. var node = createEmptyVNode();
  6594. node.asyncFactory = factory;
  6595. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  6596. return node
  6597. }
  6598. function resolveAsyncComponent (
  6599. factory,
  6600. baseCtor
  6601. ) {
  6602. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  6603. return factory.errorComp
  6604. }
  6605. if (isDef(factory.resolved)) {
  6606. return factory.resolved
  6607. }
  6608. var owner = currentRenderingInstance;
  6609. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  6610. // already pending
  6611. factory.owners.push(owner);
  6612. }
  6613. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  6614. return factory.loadingComp
  6615. }
  6616. if (owner && !isDef(factory.owners)) {
  6617. var owners = factory.owners = [owner];
  6618. var sync = true;
  6619. var timerLoading = null;
  6620. var timerTimeout = null
  6621. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  6622. var forceRender = function (renderCompleted) {
  6623. for (var i = 0, l = owners.length; i < l; i++) {
  6624. (owners[i]).$forceUpdate();
  6625. }
  6626. if (renderCompleted) {
  6627. owners.length = 0;
  6628. if (timerLoading !== null) {
  6629. clearTimeout(timerLoading);
  6630. timerLoading = null;
  6631. }
  6632. if (timerTimeout !== null) {
  6633. clearTimeout(timerTimeout);
  6634. timerTimeout = null;
  6635. }
  6636. }
  6637. };
  6638. var resolve = once(function (res) {
  6639. // cache resolved
  6640. factory.resolved = ensureCtor(res, baseCtor);
  6641. // invoke callbacks only if this is not a synchronous resolve
  6642. // (async resolves are shimmed as synchronous during SSR)
  6643. if (!sync) {
  6644. forceRender(true);
  6645. } else {
  6646. owners.length = 0;
  6647. }
  6648. });
  6649. var reject = once(function (reason) {
  6650. true && warn(
  6651. "Failed to resolve async component: " + (String(factory)) +
  6652. (reason ? ("\nReason: " + reason) : '')
  6653. );
  6654. if (isDef(factory.errorComp)) {
  6655. factory.error = true;
  6656. forceRender(true);
  6657. }
  6658. });
  6659. var res = factory(resolve, reject);
  6660. if (isObject(res)) {
  6661. if (isPromise(res)) {
  6662. // () => Promise
  6663. if (isUndef(factory.resolved)) {
  6664. res.then(resolve, reject);
  6665. }
  6666. } else if (isPromise(res.component)) {
  6667. res.component.then(resolve, reject);
  6668. if (isDef(res.error)) {
  6669. factory.errorComp = ensureCtor(res.error, baseCtor);
  6670. }
  6671. if (isDef(res.loading)) {
  6672. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  6673. if (res.delay === 0) {
  6674. factory.loading = true;
  6675. } else {
  6676. timerLoading = setTimeout(function () {
  6677. timerLoading = null;
  6678. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  6679. factory.loading = true;
  6680. forceRender(false);
  6681. }
  6682. }, res.delay || 200);
  6683. }
  6684. }
  6685. if (isDef(res.timeout)) {
  6686. timerTimeout = setTimeout(function () {
  6687. timerTimeout = null;
  6688. if (isUndef(factory.resolved)) {
  6689. reject(
  6690. true
  6691. ? ("timeout (" + (res.timeout) + "ms)")
  6692. : undefined
  6693. );
  6694. }
  6695. }, res.timeout);
  6696. }
  6697. }
  6698. }
  6699. sync = false;
  6700. // return in case resolved synchronously
  6701. return factory.loading
  6702. ? factory.loadingComp
  6703. : factory.resolved
  6704. }
  6705. }
  6706. /* */
  6707. function isAsyncPlaceholder (node) {
  6708. return node.isComment && node.asyncFactory
  6709. }
  6710. /* */
  6711. function getFirstComponentChild (children) {
  6712. if (Array.isArray(children)) {
  6713. for (var i = 0; i < children.length; i++) {
  6714. var c = children[i];
  6715. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  6716. return c
  6717. }
  6718. }
  6719. }
  6720. }
  6721. /* */
  6722. /* */
  6723. function initEvents (vm) {
  6724. vm._events = Object.create(null);
  6725. vm._hasHookEvent = false;
  6726. // init parent attached events
  6727. var listeners = vm.$options._parentListeners;
  6728. if (listeners) {
  6729. updateComponentListeners(vm, listeners);
  6730. }
  6731. }
  6732. var target;
  6733. function add (event, fn) {
  6734. target.$on(event, fn);
  6735. }
  6736. function remove$1 (event, fn) {
  6737. target.$off(event, fn);
  6738. }
  6739. function createOnceHandler (event, fn) {
  6740. var _target = target;
  6741. return function onceHandler () {
  6742. var res = fn.apply(null, arguments);
  6743. if (res !== null) {
  6744. _target.$off(event, onceHandler);
  6745. }
  6746. }
  6747. }
  6748. function updateComponentListeners (
  6749. vm,
  6750. listeners,
  6751. oldListeners
  6752. ) {
  6753. target = vm;
  6754. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  6755. target = undefined;
  6756. }
  6757. function eventsMixin (Vue) {
  6758. var hookRE = /^hook:/;
  6759. Vue.prototype.$on = function (event, fn) {
  6760. var vm = this;
  6761. if (Array.isArray(event)) {
  6762. for (var i = 0, l = event.length; i < l; i++) {
  6763. vm.$on(event[i], fn);
  6764. }
  6765. } else {
  6766. (vm._events[event] || (vm._events[event] = [])).push(fn);
  6767. // optimize hook:event cost by using a boolean flag marked at registration
  6768. // instead of a hash lookup
  6769. if (hookRE.test(event)) {
  6770. vm._hasHookEvent = true;
  6771. }
  6772. }
  6773. return vm
  6774. };
  6775. Vue.prototype.$once = function (event, fn) {
  6776. var vm = this;
  6777. function on () {
  6778. vm.$off(event, on);
  6779. fn.apply(vm, arguments);
  6780. }
  6781. on.fn = fn;
  6782. vm.$on(event, on);
  6783. return vm
  6784. };
  6785. Vue.prototype.$off = function (event, fn) {
  6786. var vm = this;
  6787. // all
  6788. if (!arguments.length) {
  6789. vm._events = Object.create(null);
  6790. return vm
  6791. }
  6792. // array of events
  6793. if (Array.isArray(event)) {
  6794. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  6795. vm.$off(event[i$1], fn);
  6796. }
  6797. return vm
  6798. }
  6799. // specific event
  6800. var cbs = vm._events[event];
  6801. if (!cbs) {
  6802. return vm
  6803. }
  6804. if (!fn) {
  6805. vm._events[event] = null;
  6806. return vm
  6807. }
  6808. // specific handler
  6809. var cb;
  6810. var i = cbs.length;
  6811. while (i--) {
  6812. cb = cbs[i];
  6813. if (cb === fn || cb.fn === fn) {
  6814. cbs.splice(i, 1);
  6815. break
  6816. }
  6817. }
  6818. return vm
  6819. };
  6820. Vue.prototype.$emit = function (event) {
  6821. var vm = this;
  6822. if (true) {
  6823. var lowerCaseEvent = event.toLowerCase();
  6824. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  6825. tip(
  6826. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  6827. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  6828. "Note that HTML attributes are case-insensitive and you cannot use " +
  6829. "v-on to listen to camelCase events when using in-DOM templates. " +
  6830. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  6831. );
  6832. }
  6833. }
  6834. var cbs = vm._events[event];
  6835. if (cbs) {
  6836. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  6837. var args = toArray(arguments, 1);
  6838. var info = "event handler for \"" + event + "\"";
  6839. for (var i = 0, l = cbs.length; i < l; i++) {
  6840. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  6841. }
  6842. }
  6843. return vm
  6844. };
  6845. }
  6846. /* */
  6847. var activeInstance = null;
  6848. var isUpdatingChildComponent = false;
  6849. function setActiveInstance(vm) {
  6850. var prevActiveInstance = activeInstance;
  6851. activeInstance = vm;
  6852. return function () {
  6853. activeInstance = prevActiveInstance;
  6854. }
  6855. }
  6856. function initLifecycle (vm) {
  6857. var options = vm.$options;
  6858. // locate first non-abstract parent
  6859. var parent = options.parent;
  6860. if (parent && !options.abstract) {
  6861. while (parent.$options.abstract && parent.$parent) {
  6862. parent = parent.$parent;
  6863. }
  6864. parent.$children.push(vm);
  6865. }
  6866. vm.$parent = parent;
  6867. vm.$root = parent ? parent.$root : vm;
  6868. vm.$children = [];
  6869. vm.$refs = {};
  6870. vm._watcher = null;
  6871. vm._inactive = null;
  6872. vm._directInactive = false;
  6873. vm._isMounted = false;
  6874. vm._isDestroyed = false;
  6875. vm._isBeingDestroyed = false;
  6876. }
  6877. function lifecycleMixin (Vue) {
  6878. Vue.prototype._update = function (vnode, hydrating) {
  6879. var vm = this;
  6880. var prevEl = vm.$el;
  6881. var prevVnode = vm._vnode;
  6882. var restoreActiveInstance = setActiveInstance(vm);
  6883. vm._vnode = vnode;
  6884. // Vue.prototype.__patch__ is injected in entry points
  6885. // based on the rendering backend used.
  6886. if (!prevVnode) {
  6887. // initial render
  6888. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  6889. } else {
  6890. // updates
  6891. vm.$el = vm.__patch__(prevVnode, vnode);
  6892. }
  6893. restoreActiveInstance();
  6894. // update __vue__ reference
  6895. if (prevEl) {
  6896. prevEl.__vue__ = null;
  6897. }
  6898. if (vm.$el) {
  6899. vm.$el.__vue__ = vm;
  6900. }
  6901. // if parent is an HOC, update its $el as well
  6902. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  6903. vm.$parent.$el = vm.$el;
  6904. }
  6905. // updated hook is called by the scheduler to ensure that children are
  6906. // updated in a parent's updated hook.
  6907. };
  6908. Vue.prototype.$forceUpdate = function () {
  6909. var vm = this;
  6910. if (vm._watcher) {
  6911. vm._watcher.update();
  6912. }
  6913. };
  6914. Vue.prototype.$destroy = function () {
  6915. var vm = this;
  6916. if (vm._isBeingDestroyed) {
  6917. return
  6918. }
  6919. callHook(vm, 'beforeDestroy');
  6920. vm._isBeingDestroyed = true;
  6921. // remove self from parent
  6922. var parent = vm.$parent;
  6923. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  6924. remove(parent.$children, vm);
  6925. }
  6926. // teardown watchers
  6927. if (vm._watcher) {
  6928. vm._watcher.teardown();
  6929. }
  6930. var i = vm._watchers.length;
  6931. while (i--) {
  6932. vm._watchers[i].teardown();
  6933. }
  6934. // remove reference from data ob
  6935. // frozen object may not have observer.
  6936. if (vm._data.__ob__) {
  6937. vm._data.__ob__.vmCount--;
  6938. }
  6939. // call the last hook...
  6940. vm._isDestroyed = true;
  6941. // invoke destroy hooks on current rendered tree
  6942. vm.__patch__(vm._vnode, null);
  6943. // fire destroyed hook
  6944. callHook(vm, 'destroyed');
  6945. // turn off all instance listeners.
  6946. vm.$off();
  6947. // remove __vue__ reference
  6948. if (vm.$el) {
  6949. vm.$el.__vue__ = null;
  6950. }
  6951. // release circular reference (#6759)
  6952. if (vm.$vnode) {
  6953. vm.$vnode.parent = null;
  6954. }
  6955. };
  6956. }
  6957. function updateChildComponent (
  6958. vm,
  6959. propsData,
  6960. listeners,
  6961. parentVnode,
  6962. renderChildren
  6963. ) {
  6964. if (true) {
  6965. isUpdatingChildComponent = true;
  6966. }
  6967. // determine whether component has slot children
  6968. // we need to do this before overwriting $options._renderChildren.
  6969. // check if there are dynamic scopedSlots (hand-written or compiled but with
  6970. // dynamic slot names). Static scoped slots compiled from template has the
  6971. // "$stable" marker.
  6972. var newScopedSlots = parentVnode.data.scopedSlots;
  6973. var oldScopedSlots = vm.$scopedSlots;
  6974. var hasDynamicScopedSlot = !!(
  6975. (newScopedSlots && !newScopedSlots.$stable) ||
  6976. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  6977. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  6978. );
  6979. // Any static slot children from the parent may have changed during parent's
  6980. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  6981. // update is necessary to ensure correctness.
  6982. var needsForceUpdate = !!(
  6983. renderChildren || // has new static slots
  6984. vm.$options._renderChildren || // has old static slots
  6985. hasDynamicScopedSlot
  6986. );
  6987. vm.$options._parentVnode = parentVnode;
  6988. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  6989. if (vm._vnode) { // update child tree's parent
  6990. vm._vnode.parent = parentVnode;
  6991. }
  6992. vm.$options._renderChildren = renderChildren;
  6993. // update $attrs and $listeners hash
  6994. // these are also reactive so they may trigger child update if the child
  6995. // used them during render
  6996. vm.$attrs = parentVnode.data.attrs || emptyObject;
  6997. vm.$listeners = listeners || emptyObject;
  6998. // update props
  6999. if (propsData && vm.$options.props) {
  7000. toggleObserving(false);
  7001. var props = vm._props;
  7002. var propKeys = vm.$options._propKeys || [];
  7003. for (var i = 0; i < propKeys.length; i++) {
  7004. var key = propKeys[i];
  7005. var propOptions = vm.$options.props; // wtf flow?
  7006. props[key] = validateProp(key, propOptions, propsData, vm);
  7007. }
  7008. toggleObserving(true);
  7009. // keep a copy of raw propsData
  7010. vm.$options.propsData = propsData;
  7011. }
  7012. // fixed by xxxxxx update properties(mp runtime)
  7013. vm._$updateProperties && vm._$updateProperties(vm);
  7014. // update listeners
  7015. listeners = listeners || emptyObject;
  7016. var oldListeners = vm.$options._parentListeners;
  7017. vm.$options._parentListeners = listeners;
  7018. updateComponentListeners(vm, listeners, oldListeners);
  7019. // resolve slots + force update if has children
  7020. if (needsForceUpdate) {
  7021. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  7022. vm.$forceUpdate();
  7023. }
  7024. if (true) {
  7025. isUpdatingChildComponent = false;
  7026. }
  7027. }
  7028. function isInInactiveTree (vm) {
  7029. while (vm && (vm = vm.$parent)) {
  7030. if (vm._inactive) { return true }
  7031. }
  7032. return false
  7033. }
  7034. function activateChildComponent (vm, direct) {
  7035. if (direct) {
  7036. vm._directInactive = false;
  7037. if (isInInactiveTree(vm)) {
  7038. return
  7039. }
  7040. } else if (vm._directInactive) {
  7041. return
  7042. }
  7043. if (vm._inactive || vm._inactive === null) {
  7044. vm._inactive = false;
  7045. for (var i = 0; i < vm.$children.length; i++) {
  7046. activateChildComponent(vm.$children[i]);
  7047. }
  7048. callHook(vm, 'activated');
  7049. }
  7050. }
  7051. function deactivateChildComponent (vm, direct) {
  7052. if (direct) {
  7053. vm._directInactive = true;
  7054. if (isInInactiveTree(vm)) {
  7055. return
  7056. }
  7057. }
  7058. if (!vm._inactive) {
  7059. vm._inactive = true;
  7060. for (var i = 0; i < vm.$children.length; i++) {
  7061. deactivateChildComponent(vm.$children[i]);
  7062. }
  7063. callHook(vm, 'deactivated');
  7064. }
  7065. }
  7066. function callHook (vm, hook) {
  7067. // #7573 disable dep collection when invoking lifecycle hooks
  7068. pushTarget();
  7069. var handlers = vm.$options[hook];
  7070. var info = hook + " hook";
  7071. if (handlers) {
  7072. for (var i = 0, j = handlers.length; i < j; i++) {
  7073. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7074. }
  7075. }
  7076. if (vm._hasHookEvent) {
  7077. vm.$emit('hook:' + hook);
  7078. }
  7079. popTarget();
  7080. }
  7081. /* */
  7082. var MAX_UPDATE_COUNT = 100;
  7083. var queue = [];
  7084. var activatedChildren = [];
  7085. var has = {};
  7086. var circular = {};
  7087. var waiting = false;
  7088. var flushing = false;
  7089. var index = 0;
  7090. /**
  7091. * Reset the scheduler's state.
  7092. */
  7093. function resetSchedulerState () {
  7094. index = queue.length = activatedChildren.length = 0;
  7095. has = {};
  7096. if (true) {
  7097. circular = {};
  7098. }
  7099. waiting = flushing = false;
  7100. }
  7101. // Async edge case #6566 requires saving the timestamp when event listeners are
  7102. // attached. However, calling performance.now() has a perf overhead especially
  7103. // if the page has thousands of event listeners. Instead, we take a timestamp
  7104. // every time the scheduler flushes and use that for all event listeners
  7105. // attached during that flush.
  7106. var currentFlushTimestamp = 0;
  7107. // Async edge case fix requires storing an event listener's attach timestamp.
  7108. var getNow = Date.now;
  7109. // Determine what event timestamp the browser is using. Annoyingly, the
  7110. // timestamp can either be hi-res (relative to page load) or low-res
  7111. // (relative to UNIX epoch), so in order to compare time we have to use the
  7112. // same timestamp type when saving the flush timestamp.
  7113. // All IE versions use low-res event timestamps, and have problematic clock
  7114. // implementations (#9632)
  7115. if (inBrowser && !isIE) {
  7116. var performance = window.performance;
  7117. if (
  7118. performance &&
  7119. typeof performance.now === 'function' &&
  7120. getNow() > document.createEvent('Event').timeStamp
  7121. ) {
  7122. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7123. // smaller than it, it means the event is using a hi-res timestamp,
  7124. // and we need to use the hi-res version for event listener timestamps as
  7125. // well.
  7126. getNow = function () { return performance.now(); };
  7127. }
  7128. }
  7129. /**
  7130. * Flush both queues and run the watchers.
  7131. */
  7132. function flushSchedulerQueue () {
  7133. currentFlushTimestamp = getNow();
  7134. flushing = true;
  7135. var watcher, id;
  7136. // Sort queue before flush.
  7137. // This ensures that:
  7138. // 1. Components are updated from parent to child. (because parent is always
  7139. // created before the child)
  7140. // 2. A component's user watchers are run before its render watcher (because
  7141. // user watchers are created before the render watcher)
  7142. // 3. If a component is destroyed during a parent component's watcher run,
  7143. // its watchers can be skipped.
  7144. queue.sort(function (a, b) { return a.id - b.id; });
  7145. // do not cache length because more watchers might be pushed
  7146. // as we run existing watchers
  7147. for (index = 0; index < queue.length; index++) {
  7148. watcher = queue[index];
  7149. if (watcher.before) {
  7150. watcher.before();
  7151. }
  7152. id = watcher.id;
  7153. has[id] = null;
  7154. watcher.run();
  7155. // in dev build, check and stop circular updates.
  7156. if ( true && has[id] != null) {
  7157. circular[id] = (circular[id] || 0) + 1;
  7158. if (circular[id] > MAX_UPDATE_COUNT) {
  7159. warn(
  7160. 'You may have an infinite update loop ' + (
  7161. watcher.user
  7162. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  7163. : "in a component render function."
  7164. ),
  7165. watcher.vm
  7166. );
  7167. break
  7168. }
  7169. }
  7170. }
  7171. // keep copies of post queues before resetting state
  7172. var activatedQueue = activatedChildren.slice();
  7173. var updatedQueue = queue.slice();
  7174. resetSchedulerState();
  7175. // call component updated and activated hooks
  7176. callActivatedHooks(activatedQueue);
  7177. callUpdatedHooks(updatedQueue);
  7178. // devtool hook
  7179. /* istanbul ignore if */
  7180. if (devtools && config.devtools) {
  7181. devtools.emit('flush');
  7182. }
  7183. }
  7184. function callUpdatedHooks (queue) {
  7185. var i = queue.length;
  7186. while (i--) {
  7187. var watcher = queue[i];
  7188. var vm = watcher.vm;
  7189. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  7190. callHook(vm, 'updated');
  7191. }
  7192. }
  7193. }
  7194. /**
  7195. * Queue a kept-alive component that was activated during patch.
  7196. * The queue will be processed after the entire tree has been patched.
  7197. */
  7198. function queueActivatedComponent (vm) {
  7199. // setting _inactive to false here so that a render function can
  7200. // rely on checking whether it's in an inactive tree (e.g. router-view)
  7201. vm._inactive = false;
  7202. activatedChildren.push(vm);
  7203. }
  7204. function callActivatedHooks (queue) {
  7205. for (var i = 0; i < queue.length; i++) {
  7206. queue[i]._inactive = true;
  7207. activateChildComponent(queue[i], true /* true */);
  7208. }
  7209. }
  7210. /**
  7211. * Push a watcher into the watcher queue.
  7212. * Jobs with duplicate IDs will be skipped unless it's
  7213. * pushed when the queue is being flushed.
  7214. */
  7215. function queueWatcher (watcher) {
  7216. var id = watcher.id;
  7217. if (has[id] == null) {
  7218. has[id] = true;
  7219. if (!flushing) {
  7220. queue.push(watcher);
  7221. } else {
  7222. // if already flushing, splice the watcher based on its id
  7223. // if already past its id, it will be run next immediately.
  7224. var i = queue.length - 1;
  7225. while (i > index && queue[i].id > watcher.id) {
  7226. i--;
  7227. }
  7228. queue.splice(i + 1, 0, watcher);
  7229. }
  7230. // queue the flush
  7231. if (!waiting) {
  7232. waiting = true;
  7233. if ( true && !config.async) {
  7234. flushSchedulerQueue();
  7235. return
  7236. }
  7237. nextTick(flushSchedulerQueue);
  7238. }
  7239. }
  7240. }
  7241. /* */
  7242. var uid$2 = 0;
  7243. /**
  7244. * A watcher parses an expression, collects dependencies,
  7245. * and fires callback when the expression value changes.
  7246. * This is used for both the $watch() api and directives.
  7247. */
  7248. var Watcher = function Watcher (
  7249. vm,
  7250. expOrFn,
  7251. cb,
  7252. options,
  7253. isRenderWatcher
  7254. ) {
  7255. this.vm = vm;
  7256. if (isRenderWatcher) {
  7257. vm._watcher = this;
  7258. }
  7259. vm._watchers.push(this);
  7260. // options
  7261. if (options) {
  7262. this.deep = !!options.deep;
  7263. this.user = !!options.user;
  7264. this.lazy = !!options.lazy;
  7265. this.sync = !!options.sync;
  7266. this.before = options.before;
  7267. } else {
  7268. this.deep = this.user = this.lazy = this.sync = false;
  7269. }
  7270. this.cb = cb;
  7271. this.id = ++uid$2; // uid for batching
  7272. this.active = true;
  7273. this.dirty = this.lazy; // for lazy watchers
  7274. this.deps = [];
  7275. this.newDeps = [];
  7276. this.depIds = new _Set();
  7277. this.newDepIds = new _Set();
  7278. this.expression = true
  7279. ? expOrFn.toString()
  7280. : undefined;
  7281. // parse expression for getter
  7282. if (typeof expOrFn === 'function') {
  7283. this.getter = expOrFn;
  7284. } else {
  7285. this.getter = parsePath(expOrFn);
  7286. if (!this.getter) {
  7287. this.getter = noop;
  7288. true && warn(
  7289. "Failed watching path: \"" + expOrFn + "\" " +
  7290. 'Watcher only accepts simple dot-delimited paths. ' +
  7291. 'For full control, use a function instead.',
  7292. vm
  7293. );
  7294. }
  7295. }
  7296. this.value = this.lazy
  7297. ? undefined
  7298. : this.get();
  7299. };
  7300. /**
  7301. * Evaluate the getter, and re-collect dependencies.
  7302. */
  7303. Watcher.prototype.get = function get () {
  7304. pushTarget(this);
  7305. var value;
  7306. var vm = this.vm;
  7307. try {
  7308. value = this.getter.call(vm, vm);
  7309. } catch (e) {
  7310. if (this.user) {
  7311. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  7312. } else {
  7313. throw e
  7314. }
  7315. } finally {
  7316. // "touch" every property so they are all tracked as
  7317. // dependencies for deep watching
  7318. if (this.deep) {
  7319. traverse(value);
  7320. }
  7321. popTarget();
  7322. this.cleanupDeps();
  7323. }
  7324. return value
  7325. };
  7326. /**
  7327. * Add a dependency to this directive.
  7328. */
  7329. Watcher.prototype.addDep = function addDep (dep) {
  7330. var id = dep.id;
  7331. if (!this.newDepIds.has(id)) {
  7332. this.newDepIds.add(id);
  7333. this.newDeps.push(dep);
  7334. if (!this.depIds.has(id)) {
  7335. dep.addSub(this);
  7336. }
  7337. }
  7338. };
  7339. /**
  7340. * Clean up for dependency collection.
  7341. */
  7342. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  7343. var i = this.deps.length;
  7344. while (i--) {
  7345. var dep = this.deps[i];
  7346. if (!this.newDepIds.has(dep.id)) {
  7347. dep.removeSub(this);
  7348. }
  7349. }
  7350. var tmp = this.depIds;
  7351. this.depIds = this.newDepIds;
  7352. this.newDepIds = tmp;
  7353. this.newDepIds.clear();
  7354. tmp = this.deps;
  7355. this.deps = this.newDeps;
  7356. this.newDeps = tmp;
  7357. this.newDeps.length = 0;
  7358. };
  7359. /**
  7360. * Subscriber interface.
  7361. * Will be called when a dependency changes.
  7362. */
  7363. Watcher.prototype.update = function update () {
  7364. /* istanbul ignore else */
  7365. if (this.lazy) {
  7366. this.dirty = true;
  7367. } else if (this.sync) {
  7368. this.run();
  7369. } else {
  7370. queueWatcher(this);
  7371. }
  7372. };
  7373. /**
  7374. * Scheduler job interface.
  7375. * Will be called by the scheduler.
  7376. */
  7377. Watcher.prototype.run = function run () {
  7378. if (this.active) {
  7379. var value = this.get();
  7380. if (
  7381. value !== this.value ||
  7382. // Deep watchers and watchers on Object/Arrays should fire even
  7383. // when the value is the same, because the value may
  7384. // have mutated.
  7385. isObject(value) ||
  7386. this.deep
  7387. ) {
  7388. // set new value
  7389. var oldValue = this.value;
  7390. this.value = value;
  7391. if (this.user) {
  7392. try {
  7393. this.cb.call(this.vm, value, oldValue);
  7394. } catch (e) {
  7395. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  7396. }
  7397. } else {
  7398. this.cb.call(this.vm, value, oldValue);
  7399. }
  7400. }
  7401. }
  7402. };
  7403. /**
  7404. * Evaluate the value of the watcher.
  7405. * This only gets called for lazy watchers.
  7406. */
  7407. Watcher.prototype.evaluate = function evaluate () {
  7408. this.value = this.get();
  7409. this.dirty = false;
  7410. };
  7411. /**
  7412. * Depend on all deps collected by this watcher.
  7413. */
  7414. Watcher.prototype.depend = function depend () {
  7415. var i = this.deps.length;
  7416. while (i--) {
  7417. this.deps[i].depend();
  7418. }
  7419. };
  7420. /**
  7421. * Remove self from all dependencies' subscriber list.
  7422. */
  7423. Watcher.prototype.teardown = function teardown () {
  7424. if (this.active) {
  7425. // remove self from vm's watcher list
  7426. // this is a somewhat expensive operation so we skip it
  7427. // if the vm is being destroyed.
  7428. if (!this.vm._isBeingDestroyed) {
  7429. remove(this.vm._watchers, this);
  7430. }
  7431. var i = this.deps.length;
  7432. while (i--) {
  7433. this.deps[i].removeSub(this);
  7434. }
  7435. this.active = false;
  7436. }
  7437. };
  7438. /* */
  7439. var sharedPropertyDefinition = {
  7440. enumerable: true,
  7441. configurable: true,
  7442. get: noop,
  7443. set: noop
  7444. };
  7445. function proxy (target, sourceKey, key) {
  7446. sharedPropertyDefinition.get = function proxyGetter () {
  7447. return this[sourceKey][key]
  7448. };
  7449. sharedPropertyDefinition.set = function proxySetter (val) {
  7450. this[sourceKey][key] = val;
  7451. };
  7452. Object.defineProperty(target, key, sharedPropertyDefinition);
  7453. }
  7454. function initState (vm) {
  7455. vm._watchers = [];
  7456. var opts = vm.$options;
  7457. if (opts.props) { initProps(vm, opts.props); }
  7458. if (opts.methods) { initMethods(vm, opts.methods); }
  7459. if (opts.data) {
  7460. initData(vm);
  7461. } else {
  7462. observe(vm._data = {}, true /* asRootData */);
  7463. }
  7464. if (opts.computed) { initComputed(vm, opts.computed); }
  7465. if (opts.watch && opts.watch !== nativeWatch) {
  7466. initWatch(vm, opts.watch);
  7467. }
  7468. }
  7469. function initProps (vm, propsOptions) {
  7470. var propsData = vm.$options.propsData || {};
  7471. var props = vm._props = {};
  7472. // cache prop keys so that future props updates can iterate using Array
  7473. // instead of dynamic object key enumeration.
  7474. var keys = vm.$options._propKeys = [];
  7475. var isRoot = !vm.$parent;
  7476. // root instance props should be converted
  7477. if (!isRoot) {
  7478. toggleObserving(false);
  7479. }
  7480. var loop = function ( key ) {
  7481. keys.push(key);
  7482. var value = validateProp(key, propsOptions, propsData, vm);
  7483. /* istanbul ignore else */
  7484. if (true) {
  7485. var hyphenatedKey = hyphenate(key);
  7486. if (isReservedAttribute(hyphenatedKey) ||
  7487. config.isReservedAttr(hyphenatedKey)) {
  7488. warn(
  7489. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  7490. vm
  7491. );
  7492. }
  7493. defineReactive$$1(props, key, value, function () {
  7494. if (!isRoot && !isUpdatingChildComponent) {
  7495. {
  7496. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  7497. return
  7498. }
  7499. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  7500. if(
  7501. key === 'value' &&
  7502. Array.isArray(vm.$options.behaviors) &&
  7503. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  7504. ){
  7505. return
  7506. }
  7507. if(vm._getFormData){
  7508. return
  7509. }
  7510. var $parent = vm.$parent;
  7511. while($parent){
  7512. if($parent.__next_tick_pending){
  7513. return
  7514. }
  7515. $parent = $parent.$parent;
  7516. }
  7517. }
  7518. warn(
  7519. "Avoid mutating a prop directly since the value will be " +
  7520. "overwritten whenever the parent component re-renders. " +
  7521. "Instead, use a data or computed property based on the prop's " +
  7522. "value. Prop being mutated: \"" + key + "\"",
  7523. vm
  7524. );
  7525. }
  7526. });
  7527. } else {}
  7528. // static props are already proxied on the component's prototype
  7529. // during Vue.extend(). We only need to proxy props defined at
  7530. // instantiation here.
  7531. if (!(key in vm)) {
  7532. proxy(vm, "_props", key);
  7533. }
  7534. };
  7535. for (var key in propsOptions) loop( key );
  7536. toggleObserving(true);
  7537. }
  7538. function initData (vm) {
  7539. var data = vm.$options.data;
  7540. data = vm._data = typeof data === 'function'
  7541. ? getData(data, vm)
  7542. : data || {};
  7543. if (!isPlainObject(data)) {
  7544. data = {};
  7545. true && warn(
  7546. 'data functions should return an object:\n' +
  7547. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  7548. vm
  7549. );
  7550. }
  7551. // proxy data on instance
  7552. var keys = Object.keys(data);
  7553. var props = vm.$options.props;
  7554. var methods = vm.$options.methods;
  7555. var i = keys.length;
  7556. while (i--) {
  7557. var key = keys[i];
  7558. if (true) {
  7559. if (methods && hasOwn(methods, key)) {
  7560. warn(
  7561. ("Method \"" + key + "\" has already been defined as a data property."),
  7562. vm
  7563. );
  7564. }
  7565. }
  7566. if (props && hasOwn(props, key)) {
  7567. true && warn(
  7568. "The data property \"" + key + "\" is already declared as a prop. " +
  7569. "Use prop default value instead.",
  7570. vm
  7571. );
  7572. } else if (!isReserved(key)) {
  7573. proxy(vm, "_data", key);
  7574. }
  7575. }
  7576. // observe data
  7577. observe(data, true /* asRootData */);
  7578. }
  7579. function getData (data, vm) {
  7580. // #7573 disable dep collection when invoking data getters
  7581. pushTarget();
  7582. try {
  7583. return data.call(vm, vm)
  7584. } catch (e) {
  7585. handleError(e, vm, "data()");
  7586. return {}
  7587. } finally {
  7588. popTarget();
  7589. }
  7590. }
  7591. var computedWatcherOptions = { lazy: true };
  7592. function initComputed (vm, computed) {
  7593. // $flow-disable-line
  7594. var watchers = vm._computedWatchers = Object.create(null);
  7595. // computed properties are just getters during SSR
  7596. var isSSR = isServerRendering();
  7597. for (var key in computed) {
  7598. var userDef = computed[key];
  7599. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  7600. if ( true && getter == null) {
  7601. warn(
  7602. ("Getter is missing for computed property \"" + key + "\"."),
  7603. vm
  7604. );
  7605. }
  7606. if (!isSSR) {
  7607. // create internal watcher for the computed property.
  7608. watchers[key] = new Watcher(
  7609. vm,
  7610. getter || noop,
  7611. noop,
  7612. computedWatcherOptions
  7613. );
  7614. }
  7615. // component-defined computed properties are already defined on the
  7616. // component prototype. We only need to define computed properties defined
  7617. // at instantiation here.
  7618. if (!(key in vm)) {
  7619. defineComputed(vm, key, userDef);
  7620. } else if (true) {
  7621. if (key in vm.$data) {
  7622. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  7623. } else if (vm.$options.props && key in vm.$options.props) {
  7624. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  7625. }
  7626. }
  7627. }
  7628. }
  7629. function defineComputed (
  7630. target,
  7631. key,
  7632. userDef
  7633. ) {
  7634. var shouldCache = !isServerRendering();
  7635. if (typeof userDef === 'function') {
  7636. sharedPropertyDefinition.get = shouldCache
  7637. ? createComputedGetter(key)
  7638. : createGetterInvoker(userDef);
  7639. sharedPropertyDefinition.set = noop;
  7640. } else {
  7641. sharedPropertyDefinition.get = userDef.get
  7642. ? shouldCache && userDef.cache !== false
  7643. ? createComputedGetter(key)
  7644. : createGetterInvoker(userDef.get)
  7645. : noop;
  7646. sharedPropertyDefinition.set = userDef.set || noop;
  7647. }
  7648. if ( true &&
  7649. sharedPropertyDefinition.set === noop) {
  7650. sharedPropertyDefinition.set = function () {
  7651. warn(
  7652. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  7653. this
  7654. );
  7655. };
  7656. }
  7657. Object.defineProperty(target, key, sharedPropertyDefinition);
  7658. }
  7659. function createComputedGetter (key) {
  7660. return function computedGetter () {
  7661. var watcher = this._computedWatchers && this._computedWatchers[key];
  7662. if (watcher) {
  7663. if (watcher.dirty) {
  7664. watcher.evaluate();
  7665. }
  7666. if (Dep.SharedObject.target) {// fixed by xxxxxx
  7667. watcher.depend();
  7668. }
  7669. return watcher.value
  7670. }
  7671. }
  7672. }
  7673. function createGetterInvoker(fn) {
  7674. return function computedGetter () {
  7675. return fn.call(this, this)
  7676. }
  7677. }
  7678. function initMethods (vm, methods) {
  7679. var props = vm.$options.props;
  7680. for (var key in methods) {
  7681. if (true) {
  7682. if (typeof methods[key] !== 'function') {
  7683. warn(
  7684. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  7685. "Did you reference the function correctly?",
  7686. vm
  7687. );
  7688. }
  7689. if (props && hasOwn(props, key)) {
  7690. warn(
  7691. ("Method \"" + key + "\" has already been defined as a prop."),
  7692. vm
  7693. );
  7694. }
  7695. if ((key in vm) && isReserved(key)) {
  7696. warn(
  7697. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  7698. "Avoid defining component methods that start with _ or $."
  7699. );
  7700. }
  7701. }
  7702. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  7703. }
  7704. }
  7705. function initWatch (vm, watch) {
  7706. for (var key in watch) {
  7707. var handler = watch[key];
  7708. if (Array.isArray(handler)) {
  7709. for (var i = 0; i < handler.length; i++) {
  7710. createWatcher(vm, key, handler[i]);
  7711. }
  7712. } else {
  7713. createWatcher(vm, key, handler);
  7714. }
  7715. }
  7716. }
  7717. function createWatcher (
  7718. vm,
  7719. expOrFn,
  7720. handler,
  7721. options
  7722. ) {
  7723. if (isPlainObject(handler)) {
  7724. options = handler;
  7725. handler = handler.handler;
  7726. }
  7727. if (typeof handler === 'string') {
  7728. handler = vm[handler];
  7729. }
  7730. return vm.$watch(expOrFn, handler, options)
  7731. }
  7732. function stateMixin (Vue) {
  7733. // flow somehow has problems with directly declared definition object
  7734. // when using Object.defineProperty, so we have to procedurally build up
  7735. // the object here.
  7736. var dataDef = {};
  7737. dataDef.get = function () { return this._data };
  7738. var propsDef = {};
  7739. propsDef.get = function () { return this._props };
  7740. if (true) {
  7741. dataDef.set = function () {
  7742. warn(
  7743. 'Avoid replacing instance root $data. ' +
  7744. 'Use nested data properties instead.',
  7745. this
  7746. );
  7747. };
  7748. propsDef.set = function () {
  7749. warn("$props is readonly.", this);
  7750. };
  7751. }
  7752. Object.defineProperty(Vue.prototype, '$data', dataDef);
  7753. Object.defineProperty(Vue.prototype, '$props', propsDef);
  7754. Vue.prototype.$set = set;
  7755. Vue.prototype.$delete = del;
  7756. Vue.prototype.$watch = function (
  7757. expOrFn,
  7758. cb,
  7759. options
  7760. ) {
  7761. var vm = this;
  7762. if (isPlainObject(cb)) {
  7763. return createWatcher(vm, expOrFn, cb, options)
  7764. }
  7765. options = options || {};
  7766. options.user = true;
  7767. var watcher = new Watcher(vm, expOrFn, cb, options);
  7768. if (options.immediate) {
  7769. try {
  7770. cb.call(vm, watcher.value);
  7771. } catch (error) {
  7772. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  7773. }
  7774. }
  7775. return function unwatchFn () {
  7776. watcher.teardown();
  7777. }
  7778. };
  7779. }
  7780. /* */
  7781. var uid$3 = 0;
  7782. function initMixin (Vue) {
  7783. Vue.prototype._init = function (options) {
  7784. var vm = this;
  7785. // a uid
  7786. vm._uid = uid$3++;
  7787. var startTag, endTag;
  7788. /* istanbul ignore if */
  7789. if ( true && config.performance && mark) {
  7790. startTag = "vue-perf-start:" + (vm._uid);
  7791. endTag = "vue-perf-end:" + (vm._uid);
  7792. mark(startTag);
  7793. }
  7794. // a flag to avoid this being observed
  7795. vm._isVue = true;
  7796. // merge options
  7797. if (options && options._isComponent) {
  7798. // optimize internal component instantiation
  7799. // since dynamic options merging is pretty slow, and none of the
  7800. // internal component options needs special treatment.
  7801. initInternalComponent(vm, options);
  7802. } else {
  7803. vm.$options = mergeOptions(
  7804. resolveConstructorOptions(vm.constructor),
  7805. options || {},
  7806. vm
  7807. );
  7808. }
  7809. /* istanbul ignore else */
  7810. if (true) {
  7811. initProxy(vm);
  7812. } else {}
  7813. // expose real self
  7814. vm._self = vm;
  7815. initLifecycle(vm);
  7816. initEvents(vm);
  7817. initRender(vm);
  7818. callHook(vm, 'beforeCreate');
  7819. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  7820. initState(vm);
  7821. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  7822. !vm._$fallback && callHook(vm, 'created');
  7823. /* istanbul ignore if */
  7824. if ( true && config.performance && mark) {
  7825. vm._name = formatComponentName(vm, false);
  7826. mark(endTag);
  7827. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  7828. }
  7829. if (vm.$options.el) {
  7830. vm.$mount(vm.$options.el);
  7831. }
  7832. };
  7833. }
  7834. function initInternalComponent (vm, options) {
  7835. var opts = vm.$options = Object.create(vm.constructor.options);
  7836. // doing this because it's faster than dynamic enumeration.
  7837. var parentVnode = options._parentVnode;
  7838. opts.parent = options.parent;
  7839. opts._parentVnode = parentVnode;
  7840. var vnodeComponentOptions = parentVnode.componentOptions;
  7841. opts.propsData = vnodeComponentOptions.propsData;
  7842. opts._parentListeners = vnodeComponentOptions.listeners;
  7843. opts._renderChildren = vnodeComponentOptions.children;
  7844. opts._componentTag = vnodeComponentOptions.tag;
  7845. if (options.render) {
  7846. opts.render = options.render;
  7847. opts.staticRenderFns = options.staticRenderFns;
  7848. }
  7849. }
  7850. function resolveConstructorOptions (Ctor) {
  7851. var options = Ctor.options;
  7852. if (Ctor.super) {
  7853. var superOptions = resolveConstructorOptions(Ctor.super);
  7854. var cachedSuperOptions = Ctor.superOptions;
  7855. if (superOptions !== cachedSuperOptions) {
  7856. // super option changed,
  7857. // need to resolve new options.
  7858. Ctor.superOptions = superOptions;
  7859. // check if there are any late-modified/attached options (#4976)
  7860. var modifiedOptions = resolveModifiedOptions(Ctor);
  7861. // update base extend options
  7862. if (modifiedOptions) {
  7863. extend(Ctor.extendOptions, modifiedOptions);
  7864. }
  7865. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  7866. if (options.name) {
  7867. options.components[options.name] = Ctor;
  7868. }
  7869. }
  7870. }
  7871. return options
  7872. }
  7873. function resolveModifiedOptions (Ctor) {
  7874. var modified;
  7875. var latest = Ctor.options;
  7876. var sealed = Ctor.sealedOptions;
  7877. for (var key in latest) {
  7878. if (latest[key] !== sealed[key]) {
  7879. if (!modified) { modified = {}; }
  7880. modified[key] = latest[key];
  7881. }
  7882. }
  7883. return modified
  7884. }
  7885. function Vue (options) {
  7886. if ( true &&
  7887. !(this instanceof Vue)
  7888. ) {
  7889. warn('Vue is a constructor and should be called with the `new` keyword');
  7890. }
  7891. this._init(options);
  7892. }
  7893. initMixin(Vue);
  7894. stateMixin(Vue);
  7895. eventsMixin(Vue);
  7896. lifecycleMixin(Vue);
  7897. renderMixin(Vue);
  7898. /* */
  7899. function initUse (Vue) {
  7900. Vue.use = function (plugin) {
  7901. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  7902. if (installedPlugins.indexOf(plugin) > -1) {
  7903. return this
  7904. }
  7905. // additional parameters
  7906. var args = toArray(arguments, 1);
  7907. args.unshift(this);
  7908. if (typeof plugin.install === 'function') {
  7909. plugin.install.apply(plugin, args);
  7910. } else if (typeof plugin === 'function') {
  7911. plugin.apply(null, args);
  7912. }
  7913. installedPlugins.push(plugin);
  7914. return this
  7915. };
  7916. }
  7917. /* */
  7918. function initMixin$1 (Vue) {
  7919. Vue.mixin = function (mixin) {
  7920. this.options = mergeOptions(this.options, mixin);
  7921. return this
  7922. };
  7923. }
  7924. /* */
  7925. function initExtend (Vue) {
  7926. /**
  7927. * Each instance constructor, including Vue, has a unique
  7928. * cid. This enables us to create wrapped "child
  7929. * constructors" for prototypal inheritance and cache them.
  7930. */
  7931. Vue.cid = 0;
  7932. var cid = 1;
  7933. /**
  7934. * Class inheritance
  7935. */
  7936. Vue.extend = function (extendOptions) {
  7937. extendOptions = extendOptions || {};
  7938. var Super = this;
  7939. var SuperId = Super.cid;
  7940. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  7941. if (cachedCtors[SuperId]) {
  7942. return cachedCtors[SuperId]
  7943. }
  7944. var name = extendOptions.name || Super.options.name;
  7945. if ( true && name) {
  7946. validateComponentName(name);
  7947. }
  7948. var Sub = function VueComponent (options) {
  7949. this._init(options);
  7950. };
  7951. Sub.prototype = Object.create(Super.prototype);
  7952. Sub.prototype.constructor = Sub;
  7953. Sub.cid = cid++;
  7954. Sub.options = mergeOptions(
  7955. Super.options,
  7956. extendOptions
  7957. );
  7958. Sub['super'] = Super;
  7959. // For props and computed properties, we define the proxy getters on
  7960. // the Vue instances at extension time, on the extended prototype. This
  7961. // avoids Object.defineProperty calls for each instance created.
  7962. if (Sub.options.props) {
  7963. initProps$1(Sub);
  7964. }
  7965. if (Sub.options.computed) {
  7966. initComputed$1(Sub);
  7967. }
  7968. // allow further extension/mixin/plugin usage
  7969. Sub.extend = Super.extend;
  7970. Sub.mixin = Super.mixin;
  7971. Sub.use = Super.use;
  7972. // create asset registers, so extended classes
  7973. // can have their private assets too.
  7974. ASSET_TYPES.forEach(function (type) {
  7975. Sub[type] = Super[type];
  7976. });
  7977. // enable recursive self-lookup
  7978. if (name) {
  7979. Sub.options.components[name] = Sub;
  7980. }
  7981. // keep a reference to the super options at extension time.
  7982. // later at instantiation we can check if Super's options have
  7983. // been updated.
  7984. Sub.superOptions = Super.options;
  7985. Sub.extendOptions = extendOptions;
  7986. Sub.sealedOptions = extend({}, Sub.options);
  7987. // cache constructor
  7988. cachedCtors[SuperId] = Sub;
  7989. return Sub
  7990. };
  7991. }
  7992. function initProps$1 (Comp) {
  7993. var props = Comp.options.props;
  7994. for (var key in props) {
  7995. proxy(Comp.prototype, "_props", key);
  7996. }
  7997. }
  7998. function initComputed$1 (Comp) {
  7999. var computed = Comp.options.computed;
  8000. for (var key in computed) {
  8001. defineComputed(Comp.prototype, key, computed[key]);
  8002. }
  8003. }
  8004. /* */
  8005. function initAssetRegisters (Vue) {
  8006. /**
  8007. * Create asset registration methods.
  8008. */
  8009. ASSET_TYPES.forEach(function (type) {
  8010. Vue[type] = function (
  8011. id,
  8012. definition
  8013. ) {
  8014. if (!definition) {
  8015. return this.options[type + 's'][id]
  8016. } else {
  8017. /* istanbul ignore if */
  8018. if ( true && type === 'component') {
  8019. validateComponentName(id);
  8020. }
  8021. if (type === 'component' && isPlainObject(definition)) {
  8022. definition.name = definition.name || id;
  8023. definition = this.options._base.extend(definition);
  8024. }
  8025. if (type === 'directive' && typeof definition === 'function') {
  8026. definition = { bind: definition, update: definition };
  8027. }
  8028. this.options[type + 's'][id] = definition;
  8029. return definition
  8030. }
  8031. };
  8032. });
  8033. }
  8034. /* */
  8035. function getComponentName (opts) {
  8036. return opts && (opts.Ctor.options.name || opts.tag)
  8037. }
  8038. function matches (pattern, name) {
  8039. if (Array.isArray(pattern)) {
  8040. return pattern.indexOf(name) > -1
  8041. } else if (typeof pattern === 'string') {
  8042. return pattern.split(',').indexOf(name) > -1
  8043. } else if (isRegExp(pattern)) {
  8044. return pattern.test(name)
  8045. }
  8046. /* istanbul ignore next */
  8047. return false
  8048. }
  8049. function pruneCache (keepAliveInstance, filter) {
  8050. var cache = keepAliveInstance.cache;
  8051. var keys = keepAliveInstance.keys;
  8052. var _vnode = keepAliveInstance._vnode;
  8053. for (var key in cache) {
  8054. var cachedNode = cache[key];
  8055. if (cachedNode) {
  8056. var name = getComponentName(cachedNode.componentOptions);
  8057. if (name && !filter(name)) {
  8058. pruneCacheEntry(cache, key, keys, _vnode);
  8059. }
  8060. }
  8061. }
  8062. }
  8063. function pruneCacheEntry (
  8064. cache,
  8065. key,
  8066. keys,
  8067. current
  8068. ) {
  8069. var cached$$1 = cache[key];
  8070. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8071. cached$$1.componentInstance.$destroy();
  8072. }
  8073. cache[key] = null;
  8074. remove(keys, key);
  8075. }
  8076. var patternTypes = [String, RegExp, Array];
  8077. var KeepAlive = {
  8078. name: 'keep-alive',
  8079. abstract: true,
  8080. props: {
  8081. include: patternTypes,
  8082. exclude: patternTypes,
  8083. max: [String, Number]
  8084. },
  8085. created: function created () {
  8086. this.cache = Object.create(null);
  8087. this.keys = [];
  8088. },
  8089. destroyed: function destroyed () {
  8090. for (var key in this.cache) {
  8091. pruneCacheEntry(this.cache, key, this.keys);
  8092. }
  8093. },
  8094. mounted: function mounted () {
  8095. var this$1 = this;
  8096. this.$watch('include', function (val) {
  8097. pruneCache(this$1, function (name) { return matches(val, name); });
  8098. });
  8099. this.$watch('exclude', function (val) {
  8100. pruneCache(this$1, function (name) { return !matches(val, name); });
  8101. });
  8102. },
  8103. render: function render () {
  8104. var slot = this.$slots.default;
  8105. var vnode = getFirstComponentChild(slot);
  8106. var componentOptions = vnode && vnode.componentOptions;
  8107. if (componentOptions) {
  8108. // check pattern
  8109. var name = getComponentName(componentOptions);
  8110. var ref = this;
  8111. var include = ref.include;
  8112. var exclude = ref.exclude;
  8113. if (
  8114. // not included
  8115. (include && (!name || !matches(include, name))) ||
  8116. // excluded
  8117. (exclude && name && matches(exclude, name))
  8118. ) {
  8119. return vnode
  8120. }
  8121. var ref$1 = this;
  8122. var cache = ref$1.cache;
  8123. var keys = ref$1.keys;
  8124. var key = vnode.key == null
  8125. // same constructor may get registered as different local components
  8126. // so cid alone is not enough (#3269)
  8127. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  8128. : vnode.key;
  8129. if (cache[key]) {
  8130. vnode.componentInstance = cache[key].componentInstance;
  8131. // make current key freshest
  8132. remove(keys, key);
  8133. keys.push(key);
  8134. } else {
  8135. cache[key] = vnode;
  8136. keys.push(key);
  8137. // prune oldest entry
  8138. if (this.max && keys.length > parseInt(this.max)) {
  8139. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8140. }
  8141. }
  8142. vnode.data.keepAlive = true;
  8143. }
  8144. return vnode || (slot && slot[0])
  8145. }
  8146. };
  8147. var builtInComponents = {
  8148. KeepAlive: KeepAlive
  8149. };
  8150. /* */
  8151. function initGlobalAPI (Vue) {
  8152. // config
  8153. var configDef = {};
  8154. configDef.get = function () { return config; };
  8155. if (true) {
  8156. configDef.set = function () {
  8157. warn(
  8158. 'Do not replace the Vue.config object, set individual fields instead.'
  8159. );
  8160. };
  8161. }
  8162. Object.defineProperty(Vue, 'config', configDef);
  8163. // exposed util methods.
  8164. // NOTE: these are not considered part of the public API - avoid relying on
  8165. // them unless you are aware of the risk.
  8166. Vue.util = {
  8167. warn: warn,
  8168. extend: extend,
  8169. mergeOptions: mergeOptions,
  8170. defineReactive: defineReactive$$1
  8171. };
  8172. Vue.set = set;
  8173. Vue.delete = del;
  8174. Vue.nextTick = nextTick;
  8175. // 2.6 explicit observable API
  8176. Vue.observable = function (obj) {
  8177. observe(obj);
  8178. return obj
  8179. };
  8180. Vue.options = Object.create(null);
  8181. ASSET_TYPES.forEach(function (type) {
  8182. Vue.options[type + 's'] = Object.create(null);
  8183. });
  8184. // this is used to identify the "base" constructor to extend all plain-object
  8185. // components with in Weex's multi-instance scenarios.
  8186. Vue.options._base = Vue;
  8187. extend(Vue.options.components, builtInComponents);
  8188. initUse(Vue);
  8189. initMixin$1(Vue);
  8190. initExtend(Vue);
  8191. initAssetRegisters(Vue);
  8192. }
  8193. initGlobalAPI(Vue);
  8194. Object.defineProperty(Vue.prototype, '$isServer', {
  8195. get: isServerRendering
  8196. });
  8197. Object.defineProperty(Vue.prototype, '$ssrContext', {
  8198. get: function get () {
  8199. /* istanbul ignore next */
  8200. return this.$vnode && this.$vnode.ssrContext
  8201. }
  8202. });
  8203. // expose FunctionalRenderContext for ssr runtime helper installation
  8204. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  8205. value: FunctionalRenderContext
  8206. });
  8207. Vue.version = '2.6.11';
  8208. /**
  8209. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  8210. */
  8211. var ARRAYTYPE = '[object Array]';
  8212. var OBJECTTYPE = '[object Object]';
  8213. var NULLTYPE = '[object Null]';
  8214. var UNDEFINEDTYPE = '[object Undefined]';
  8215. // const FUNCTIONTYPE = '[object Function]'
  8216. function diff(current, pre) {
  8217. var result = {};
  8218. syncKeys(current, pre);
  8219. _diff(current, pre, '', result);
  8220. return result
  8221. }
  8222. function syncKeys(current, pre) {
  8223. if (current === pre) { return }
  8224. var rootCurrentType = type(current);
  8225. var rootPreType = type(pre);
  8226. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  8227. if(Object.keys(current).length >= Object.keys(pre).length){
  8228. for (var key in pre) {
  8229. var currentValue = current[key];
  8230. if (currentValue === undefined) {
  8231. current[key] = null;
  8232. } else {
  8233. syncKeys(currentValue, pre[key]);
  8234. }
  8235. }
  8236. }
  8237. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  8238. if (current.length >= pre.length) {
  8239. pre.forEach(function (item, index) {
  8240. syncKeys(current[index], item);
  8241. });
  8242. }
  8243. }
  8244. }
  8245. function nullOrUndefined(currentType, preType) {
  8246. if(
  8247. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  8248. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  8249. ) {
  8250. return false
  8251. }
  8252. return true
  8253. }
  8254. function _diff(current, pre, path, result) {
  8255. if (current === pre) { return }
  8256. var rootCurrentType = type(current);
  8257. var rootPreType = type(pre);
  8258. if (rootCurrentType == OBJECTTYPE) {
  8259. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  8260. setResult(result, path, current);
  8261. } else {
  8262. var loop = function ( key ) {
  8263. var currentValue = current[key];
  8264. var preValue = pre[key];
  8265. var currentType = type(currentValue);
  8266. var preType = type(preValue);
  8267. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  8268. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  8269. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8270. }
  8271. } else if (currentType == ARRAYTYPE) {
  8272. if (preType != ARRAYTYPE) {
  8273. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8274. } else {
  8275. if (currentValue.length < preValue.length) {
  8276. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8277. } else {
  8278. currentValue.forEach(function (item, index) {
  8279. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  8280. });
  8281. }
  8282. }
  8283. } else if (currentType == OBJECTTYPE) {
  8284. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  8285. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8286. } else {
  8287. for (var subKey in currentValue) {
  8288. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  8289. }
  8290. }
  8291. }
  8292. };
  8293. for (var key in current) loop( key );
  8294. }
  8295. } else if (rootCurrentType == ARRAYTYPE) {
  8296. if (rootPreType != ARRAYTYPE) {
  8297. setResult(result, path, current);
  8298. } else {
  8299. if (current.length < pre.length) {
  8300. setResult(result, path, current);
  8301. } else {
  8302. current.forEach(function (item, index) {
  8303. _diff(item, pre[index], path + '[' + index + ']', result);
  8304. });
  8305. }
  8306. }
  8307. } else {
  8308. setResult(result, path, current);
  8309. }
  8310. }
  8311. function setResult(result, k, v) {
  8312. // if (type(v) != FUNCTIONTYPE) {
  8313. result[k] = v;
  8314. // }
  8315. }
  8316. function type(obj) {
  8317. return Object.prototype.toString.call(obj)
  8318. }
  8319. /* */
  8320. function flushCallbacks$1(vm) {
  8321. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  8322. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  8323. var mpInstance = vm.$scope;
  8324. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8325. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  8326. }
  8327. var copies = vm.__next_tick_callbacks.slice(0);
  8328. vm.__next_tick_callbacks.length = 0;
  8329. for (var i = 0; i < copies.length; i++) {
  8330. copies[i]();
  8331. }
  8332. }
  8333. }
  8334. function hasRenderWatcher(vm) {
  8335. return queue.find(function (watcher) { return vm._watcher === watcher; })
  8336. }
  8337. function nextTick$1(vm, cb) {
  8338. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  8339. //2.nextTick 之前存在 render watcher
  8340. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  8341. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  8342. var mpInstance = vm.$scope;
  8343. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8344. ']:nextVueTick');
  8345. }
  8346. return nextTick(cb, vm)
  8347. }else{
  8348. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  8349. var mpInstance$1 = vm.$scope;
  8350. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  8351. ']:nextMPTick');
  8352. }
  8353. }
  8354. var _resolve;
  8355. if (!vm.__next_tick_callbacks) {
  8356. vm.__next_tick_callbacks = [];
  8357. }
  8358. vm.__next_tick_callbacks.push(function () {
  8359. if (cb) {
  8360. try {
  8361. cb.call(vm);
  8362. } catch (e) {
  8363. handleError(e, vm, 'nextTick');
  8364. }
  8365. } else if (_resolve) {
  8366. _resolve(vm);
  8367. }
  8368. });
  8369. // $flow-disable-line
  8370. if (!cb && typeof Promise !== 'undefined') {
  8371. return new Promise(function (resolve) {
  8372. _resolve = resolve;
  8373. })
  8374. }
  8375. }
  8376. /* */
  8377. function clearInstance(key, value) {
  8378. // 简易去除 Vue 和小程序组件实例
  8379. if (value) {
  8380. if (value._isVue || value.__v_isMPComponent) {
  8381. return {}
  8382. }
  8383. }
  8384. return value
  8385. }
  8386. function cloneWithData(vm) {
  8387. // 确保当前 vm 所有数据被同步
  8388. var ret = Object.create(null);
  8389. var dataKeys = [].concat(
  8390. Object.keys(vm._data || {}),
  8391. Object.keys(vm._computedWatchers || {}));
  8392. dataKeys.reduce(function(ret, key) {
  8393. ret[key] = vm[key];
  8394. return ret
  8395. }, ret);
  8396. // vue-composition-api
  8397. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  8398. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  8399. if (rawBindings) {
  8400. Object.keys(rawBindings).forEach(function (key) {
  8401. ret[key] = vm[key];
  8402. });
  8403. }
  8404. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  8405. Object.assign(ret, vm.$mp.data || {});
  8406. if (
  8407. Array.isArray(vm.$options.behaviors) &&
  8408. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8409. ) { //form-field
  8410. ret['name'] = vm.name;
  8411. ret['value'] = vm.value;
  8412. }
  8413. return JSON.parse(JSON.stringify(ret, clearInstance))
  8414. }
  8415. var patch = function(oldVnode, vnode) {
  8416. var this$1 = this;
  8417. if (vnode === null) { //destroy
  8418. return
  8419. }
  8420. if (this.mpType === 'page' || this.mpType === 'component') {
  8421. var mpInstance = this.$scope;
  8422. var data = Object.create(null);
  8423. try {
  8424. data = cloneWithData(this);
  8425. } catch (err) {
  8426. console.error(err);
  8427. }
  8428. data.__webviewId__ = mpInstance.data.__webviewId__;
  8429. var mpData = Object.create(null);
  8430. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  8431. mpData[key] = mpInstance.data[key];
  8432. });
  8433. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  8434. if (Object.keys(diffData).length) {
  8435. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"chargingPile","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  8436. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  8437. ']差量更新',
  8438. JSON.stringify(diffData));
  8439. }
  8440. this.__next_tick_pending = true;
  8441. mpInstance.setData(diffData, function () {
  8442. this$1.__next_tick_pending = false;
  8443. flushCallbacks$1(this$1);
  8444. });
  8445. } else {
  8446. flushCallbacks$1(this);
  8447. }
  8448. }
  8449. };
  8450. /* */
  8451. function createEmptyRender() {
  8452. }
  8453. function mountComponent$1(
  8454. vm,
  8455. el,
  8456. hydrating
  8457. ) {
  8458. if (!vm.mpType) {//main.js 中的 new Vue
  8459. return vm
  8460. }
  8461. if (vm.mpType === 'app') {
  8462. vm.$options.render = createEmptyRender;
  8463. }
  8464. if (!vm.$options.render) {
  8465. vm.$options.render = createEmptyRender;
  8466. if (true) {
  8467. /* istanbul ignore if */
  8468. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  8469. vm.$options.el || el) {
  8470. warn(
  8471. 'You are using the runtime-only build of Vue where the template ' +
  8472. 'compiler is not available. Either pre-compile the templates into ' +
  8473. 'render functions, or use the compiler-included build.',
  8474. vm
  8475. );
  8476. } else {
  8477. warn(
  8478. 'Failed to mount component: template or render function not defined.',
  8479. vm
  8480. );
  8481. }
  8482. }
  8483. }
  8484. !vm._$fallback && callHook(vm, 'beforeMount');
  8485. var updateComponent = function () {
  8486. vm._update(vm._render(), hydrating);
  8487. };
  8488. // we set this to vm._watcher inside the watcher's constructor
  8489. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  8490. // component's mounted hook), which relies on vm._watcher being already defined
  8491. new Watcher(vm, updateComponent, noop, {
  8492. before: function before() {
  8493. if (vm._isMounted && !vm._isDestroyed) {
  8494. callHook(vm, 'beforeUpdate');
  8495. }
  8496. }
  8497. }, true /* isRenderWatcher */);
  8498. hydrating = false;
  8499. return vm
  8500. }
  8501. /* */
  8502. function renderClass (
  8503. staticClass,
  8504. dynamicClass
  8505. ) {
  8506. if (isDef(staticClass) || isDef(dynamicClass)) {
  8507. return concat(staticClass, stringifyClass(dynamicClass))
  8508. }
  8509. /* istanbul ignore next */
  8510. return ''
  8511. }
  8512. function concat (a, b) {
  8513. return a ? b ? (a + ' ' + b) : a : (b || '')
  8514. }
  8515. function stringifyClass (value) {
  8516. if (Array.isArray(value)) {
  8517. return stringifyArray(value)
  8518. }
  8519. if (isObject(value)) {
  8520. return stringifyObject(value)
  8521. }
  8522. if (typeof value === 'string') {
  8523. return value
  8524. }
  8525. /* istanbul ignore next */
  8526. return ''
  8527. }
  8528. function stringifyArray (value) {
  8529. var res = '';
  8530. var stringified;
  8531. for (var i = 0, l = value.length; i < l; i++) {
  8532. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  8533. if (res) { res += ' '; }
  8534. res += stringified;
  8535. }
  8536. }
  8537. return res
  8538. }
  8539. function stringifyObject (value) {
  8540. var res = '';
  8541. for (var key in value) {
  8542. if (value[key]) {
  8543. if (res) { res += ' '; }
  8544. res += key;
  8545. }
  8546. }
  8547. return res
  8548. }
  8549. /* */
  8550. var parseStyleText = cached(function (cssText) {
  8551. var res = {};
  8552. var listDelimiter = /;(?![^(]*\))/g;
  8553. var propertyDelimiter = /:(.+)/;
  8554. cssText.split(listDelimiter).forEach(function (item) {
  8555. if (item) {
  8556. var tmp = item.split(propertyDelimiter);
  8557. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8558. }
  8559. });
  8560. return res
  8561. });
  8562. // normalize possible array / string values into Object
  8563. function normalizeStyleBinding (bindingStyle) {
  8564. if (Array.isArray(bindingStyle)) {
  8565. return toObject(bindingStyle)
  8566. }
  8567. if (typeof bindingStyle === 'string') {
  8568. return parseStyleText(bindingStyle)
  8569. }
  8570. return bindingStyle
  8571. }
  8572. /* */
  8573. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  8574. function getTarget(obj, path) {
  8575. var parts = path.split('.');
  8576. var key = parts[0];
  8577. if (key.indexOf('__$n') === 0) { //number index
  8578. key = parseInt(key.replace('__$n', ''));
  8579. }
  8580. if (parts.length === 1) {
  8581. return obj[key]
  8582. }
  8583. return getTarget(obj[key], parts.slice(1).join('.'))
  8584. }
  8585. function internalMixin(Vue) {
  8586. Vue.config.errorHandler = function(err, vm, info) {
  8587. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  8588. console.error(err);
  8589. /* eslint-disable no-undef */
  8590. var app = typeof getApp === 'function' && getApp();
  8591. if (app && app.onError) {
  8592. app.onError(err);
  8593. }
  8594. };
  8595. var oldEmit = Vue.prototype.$emit;
  8596. Vue.prototype.$emit = function(event) {
  8597. if (this.$scope && event) {
  8598. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  8599. if (triggerEvent) {
  8600. try {
  8601. triggerEvent.call(this.$scope, event, {
  8602. __args__: toArray(arguments, 1)
  8603. });
  8604. } catch (error) {
  8605. }
  8606. }
  8607. }
  8608. return oldEmit.apply(this, arguments)
  8609. };
  8610. Vue.prototype.$nextTick = function(fn) {
  8611. return nextTick$1(this, fn)
  8612. };
  8613. MP_METHODS.forEach(function (method) {
  8614. Vue.prototype[method] = function(args) {
  8615. if (this.$scope && this.$scope[method]) {
  8616. return this.$scope[method](args)
  8617. }
  8618. // mp-alipay
  8619. if (typeof my === 'undefined') {
  8620. return
  8621. }
  8622. if (method === 'createSelectorQuery') {
  8623. /* eslint-disable no-undef */
  8624. return my.createSelectorQuery(args)
  8625. } else if (method === 'createIntersectionObserver') {
  8626. /* eslint-disable no-undef */
  8627. return my.createIntersectionObserver(args)
  8628. }
  8629. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  8630. };
  8631. });
  8632. Vue.prototype.__init_provide = initProvide;
  8633. Vue.prototype.__init_injections = initInjections;
  8634. Vue.prototype.__call_hook = function(hook, args) {
  8635. var vm = this;
  8636. // #7573 disable dep collection when invoking lifecycle hooks
  8637. pushTarget();
  8638. var handlers = vm.$options[hook];
  8639. var info = hook + " hook";
  8640. var ret;
  8641. if (handlers) {
  8642. for (var i = 0, j = handlers.length; i < j; i++) {
  8643. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  8644. }
  8645. }
  8646. if (vm._hasHookEvent) {
  8647. vm.$emit('hook:' + hook, args);
  8648. }
  8649. popTarget();
  8650. return ret
  8651. };
  8652. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  8653. if (Array.isArray(modifiers)) {
  8654. if (modifiers.indexOf('trim') !== -1) {
  8655. value = value.trim();
  8656. }
  8657. if (modifiers.indexOf('number') !== -1) {
  8658. value = this._n(value);
  8659. }
  8660. }
  8661. if (!target) {
  8662. target = this;
  8663. }
  8664. // 解决动态属性添加
  8665. Vue.set(target, key, value);
  8666. };
  8667. Vue.prototype.__set_sync = function(target, key, value) {
  8668. if (!target) {
  8669. target = this;
  8670. }
  8671. // 解决动态属性添加
  8672. Vue.set(target, key, value);
  8673. };
  8674. Vue.prototype.__get_orig = function(item) {
  8675. if (isPlainObject(item)) {
  8676. return item['$orig'] || item
  8677. }
  8678. return item
  8679. };
  8680. Vue.prototype.__get_value = function(dataPath, target) {
  8681. return getTarget(target || this, dataPath)
  8682. };
  8683. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  8684. return renderClass(staticClass, dynamicClass)
  8685. };
  8686. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  8687. if (!dynamicStyle && !staticStyle) {
  8688. return ''
  8689. }
  8690. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  8691. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  8692. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  8693. };
  8694. Vue.prototype.__map = function(val, iteratee) {
  8695. //TODO 暂不考虑 string
  8696. var ret, i, l, keys, key;
  8697. if (Array.isArray(val)) {
  8698. ret = new Array(val.length);
  8699. for (i = 0, l = val.length; i < l; i++) {
  8700. ret[i] = iteratee(val[i], i);
  8701. }
  8702. return ret
  8703. } else if (isObject(val)) {
  8704. keys = Object.keys(val);
  8705. ret = Object.create(null);
  8706. for (i = 0, l = keys.length; i < l; i++) {
  8707. key = keys[i];
  8708. ret[key] = iteratee(val[key], key, i);
  8709. }
  8710. return ret
  8711. } else if (typeof val === 'number') {
  8712. ret = new Array(val);
  8713. for (i = 0, l = val; i < l; i++) {
  8714. // 第一个参数暂时仍和小程序一致
  8715. ret[i] = iteratee(i, i);
  8716. }
  8717. return ret
  8718. }
  8719. return []
  8720. };
  8721. }
  8722. /* */
  8723. var LIFECYCLE_HOOKS$1 = [
  8724. //App
  8725. 'onLaunch',
  8726. 'onShow',
  8727. 'onHide',
  8728. 'onUniNViewMessage',
  8729. 'onPageNotFound',
  8730. 'onThemeChange',
  8731. 'onError',
  8732. 'onUnhandledRejection',
  8733. //Page
  8734. 'onInit',
  8735. 'onLoad',
  8736. // 'onShow',
  8737. 'onReady',
  8738. // 'onHide',
  8739. 'onUnload',
  8740. 'onPullDownRefresh',
  8741. 'onReachBottom',
  8742. 'onTabItemTap',
  8743. 'onAddToFavorites',
  8744. 'onShareTimeline',
  8745. 'onShareAppMessage',
  8746. 'onResize',
  8747. 'onPageScroll',
  8748. 'onNavigationBarButtonTap',
  8749. 'onBackPress',
  8750. 'onNavigationBarSearchInputChanged',
  8751. 'onNavigationBarSearchInputConfirmed',
  8752. 'onNavigationBarSearchInputClicked',
  8753. 'onUploadDouyinVideo',
  8754. 'onNFCReadMessage',
  8755. //Component
  8756. // 'onReady', // 兼容旧版本,应该移除该事件
  8757. 'onPageShow',
  8758. 'onPageHide',
  8759. 'onPageResize'
  8760. ];
  8761. function lifecycleMixin$1(Vue) {
  8762. //fixed vue-class-component
  8763. var oldExtend = Vue.extend;
  8764. Vue.extend = function(extendOptions) {
  8765. extendOptions = extendOptions || {};
  8766. var methods = extendOptions.methods;
  8767. if (methods) {
  8768. Object.keys(methods).forEach(function (methodName) {
  8769. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  8770. extendOptions[methodName] = methods[methodName];
  8771. delete methods[methodName];
  8772. }
  8773. });
  8774. }
  8775. return oldExtend.call(this, extendOptions)
  8776. };
  8777. var strategies = Vue.config.optionMergeStrategies;
  8778. var mergeHook = strategies.created;
  8779. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  8780. strategies[hook] = mergeHook;
  8781. });
  8782. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  8783. }
  8784. /* */
  8785. // install platform patch function
  8786. Vue.prototype.__patch__ = patch;
  8787. // public mount method
  8788. Vue.prototype.$mount = function(
  8789. el ,
  8790. hydrating
  8791. ) {
  8792. return mountComponent$1(this, el, hydrating)
  8793. };
  8794. lifecycleMixin$1(Vue);
  8795. internalMixin(Vue);
  8796. /* */
  8797. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  8798. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  8799. /***/ }),
  8800. /* 26 */
  8801. /*!*************************************************************!*\
  8802. !*** E:/zswl/code/charge_miniapp/charge_miniapp/pages.json ***!
  8803. \*************************************************************/
  8804. /*! no static exports found */
  8805. /***/ (function(module, exports) {
  8806. /***/ }),
  8807. /* 27 */,
  8808. /* 28 */,
  8809. /* 29 */,
  8810. /* 30 */
  8811. /*!*******************************************************************!*\
  8812. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/api.js ***!
  8813. \*******************************************************************/
  8814. /*! no static exports found */
  8815. /***/ (function(module, exports, __webpack_require__) {
  8816. "use strict";
  8817. /* WEBPACK VAR INJECTION */(function(uni) {
  8818. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  8819. Object.defineProperty(exports, "__esModule", {
  8820. value: true
  8821. });
  8822. exports.default = void 0;
  8823. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 31));
  8824. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  8825. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 33));
  8826. var _app = _interopRequireDefault(__webpack_require__(/*! ./app */ 34));
  8827. var _config = _interopRequireDefault(__webpack_require__(/*! ./config */ 35));
  8828. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  8829. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  8830. var api = {};
  8831. // 网络请求封装
  8832. var Request = function Request(opts) {
  8833. var originalComplete = opts.complete;
  8834. return new Promise(function (resolve, reject) {
  8835. uni.request(Object.assign({}, opts, {
  8836. complete: function complete(res) {
  8837. var hasSuccess = Boolean(res.errMsg == 'request:ok' && res.statusCode >= 200 && res.statusCode < 300);
  8838. hasSuccess ? resolve(res.data) : reject(res);
  8839. if (originalComplete && typeof originalComplete == 'function') originalComplete(res);
  8840. }
  8841. }));
  8842. });
  8843. };
  8844. // 路径拼接
  8845. var pathJoin = function pathJoin() {
  8846. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  8847. args[_key] = arguments[_key];
  8848. }
  8849. return args.join('/').replace(/(?<!:)(\/{2,})/g, '/');
  8850. };
  8851. // 显示LOADING
  8852. var showLoading = function showLoading() {
  8853. uni.showLoading({
  8854. title: '',
  8855. mask: true
  8856. });
  8857. };
  8858. // 关闭LOADING
  8859. var hideLoading = function hideLoading() {
  8860. uni.hideLoading();
  8861. };
  8862. // 获取用户TOKEN
  8863. var getUserToken = function getUserToken() {
  8864. return uni.getStorageSync(_config.default.keyname.userToken);
  8865. };
  8866. /**
  8867. * 基础请求
  8868. * @param {String} method 请求类型
  8869. * @param {String} url 请求地址
  8870. * @param {Object} data 请求数据
  8871. * @param {Object} opts 配置参数
  8872. */
  8873. api.base = function (method, url, data, opts) {
  8874. return new Promise( /*#__PURE__*/function () {
  8875. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  8876. var options;
  8877. return _regenerator.default.wrap(function _callee3$(_context3) {
  8878. while (1) {
  8879. switch (_context3.prev = _context3.next) {
  8880. case 0:
  8881. options = Object.assign({
  8882. // 请求地址
  8883. url: pathJoin(_config.default.url.request, url),
  8884. // 请求数据
  8885. data: data || {},
  8886. // 请求类型
  8887. method: method || 'post',
  8888. // 数据类型
  8889. dataType: 'json',
  8890. // 自动显示LOADING
  8891. loading: true,
  8892. // 启用错误自动拦截
  8893. error: true,
  8894. // 请求头设定
  8895. header: {
  8896. 'content-type': 'application/json',
  8897. 'token': getUserToken()
  8898. },
  8899. // 设置显示LOADING的方法
  8900. showLoading: showLoading,
  8901. // 设置关闭LOADING的方法
  8902. hideLoading: hideLoading
  8903. }, opts || {});
  8904. if (options.loading && typeof options.showLoading == 'function') {
  8905. options.showLoading();
  8906. }
  8907. Request(options).then( /*#__PURE__*/function () {
  8908. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(res) {
  8909. var db;
  8910. return _regenerator.default.wrap(function _callee$(_context) {
  8911. while (1) {
  8912. switch (_context.prev = _context.next) {
  8913. case 0:
  8914. if (options.loading && typeof options.hideLoading == 'function') {
  8915. options.hideLoading();
  8916. }
  8917. _context.t0 = res.code;
  8918. _context.next = _context.t0 === 0 ? 4 : _context.t0 === 201 ? 6 : 26;
  8919. break;
  8920. case 4:
  8921. resolve(res);
  8922. return _context.abrupt("break", 28);
  8923. case 6:
  8924. _context.prev = 6;
  8925. _context.next = 9;
  8926. return api.login();
  8927. case 9:
  8928. _context.next = 14;
  8929. break;
  8930. case 11:
  8931. _context.prev = 11;
  8932. _context.t1 = _context["catch"](6);
  8933. reject(_context.t1);
  8934. case 14:
  8935. options.header.token = getUserToken();
  8936. _context.prev = 15;
  8937. _context.next = 18;
  8938. return Request(options);
  8939. case 18:
  8940. db = _context.sent;
  8941. resolve(db);
  8942. _context.next = 25;
  8943. break;
  8944. case 22:
  8945. _context.prev = 22;
  8946. _context.t2 = _context["catch"](15);
  8947. reject(_context.t2);
  8948. case 25:
  8949. return _context.abrupt("break", 28);
  8950. case 26:
  8951. if (options.error) {
  8952. _app.default.popup.alert(res.msg || "".concat(url, "\r\n\u672A\u77E5\u9519\u8BEF"), '数据请求');
  8953. } else {
  8954. reject(res);
  8955. }
  8956. return _context.abrupt("break", 28);
  8957. case 28:
  8958. case "end":
  8959. return _context.stop();
  8960. }
  8961. }
  8962. }, _callee, null, [[6, 11], [15, 22]]);
  8963. }));
  8964. return function (_x3) {
  8965. return _ref2.apply(this, arguments);
  8966. };
  8967. }()).catch( /*#__PURE__*/function () {
  8968. var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(err) {
  8969. return _regenerator.default.wrap(function _callee2$(_context2) {
  8970. while (1) {
  8971. switch (_context2.prev = _context2.next) {
  8972. case 0:
  8973. /*失败处理,此处为非200状态码引起的错误*/
  8974. options.hideLoading();
  8975. _app.default.popup.alert("\u670D\u52A1\u5668\u54CD\u5E94\u5931\u8D25\r\n".concat(err.errMsg), '数据请求');
  8976. case 2:
  8977. case "end":
  8978. return _context2.stop();
  8979. }
  8980. }
  8981. }, _callee2);
  8982. }));
  8983. return function (_x4) {
  8984. return _ref3.apply(this, arguments);
  8985. };
  8986. }());
  8987. case 3:
  8988. case "end":
  8989. return _context3.stop();
  8990. }
  8991. }
  8992. }, _callee3);
  8993. }));
  8994. return function (_x, _x2) {
  8995. return _ref.apply(this, arguments);
  8996. };
  8997. }());
  8998. };
  8999. /**
  9000. * POST请求
  9001. * @param {String} url 请求地址
  9002. * @param {Object} data 请求数据
  9003. * @param {Object} opts 配置参数
  9004. */
  9005. api.post = function (url, data, opts) {
  9006. return api.base('post', url, data, Object.assign({}, opts));
  9007. };
  9008. /**
  9009. * GET请求
  9010. * @param {String} url 请求地址
  9011. * @param {Object} data 请求数据
  9012. * @param {Object} opts 配置参数
  9013. */
  9014. api.get = function (url, data, opts) {
  9015. return api.base('get', url, data, Object.assign({}, opts));
  9016. };
  9017. /**
  9018. * 获取静态数据
  9019. * @param {String} url 静态文件地址
  9020. * @param {Object} data 参数数据
  9021. * @param {Object} opts 配置参数
  9022. */
  9023. api.static = function (url, data, opts) {
  9024. return new Promise( /*#__PURE__*/function () {
  9025. var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resolve, reject) {
  9026. var _opts;
  9027. return _regenerator.default.wrap(function _callee4$(_context4) {
  9028. while (1) {
  9029. switch (_context4.prev = _context4.next) {
  9030. case 0:
  9031. // 设置选项
  9032. _opts = Object.assign({
  9033. url: /^http/.test(url) ? url : API_BASE + (url || ''),
  9034. data: Object.assign({
  9035. cache: Date.now()
  9036. }, data)
  9037. }, opts || {});
  9038. uni.request(_objectSpread(_objectSpread({}, _opts), {}, {
  9039. success: function success(res) {
  9040. resolve(res.data);
  9041. }
  9042. }));
  9043. case 2:
  9044. case "end":
  9045. return _context4.stop();
  9046. }
  9047. }
  9048. }, _callee4);
  9049. }));
  9050. return function (_x5, _x6) {
  9051. return _ref4.apply(this, arguments);
  9052. };
  9053. }());
  9054. };
  9055. /**
  9056. * 文件上传
  9057. * @param {String} file 文件临时路径
  9058. * @param {Object} opts 上传参数
  9059. */
  9060. api.upload = function (file, opts) {
  9061. return new Promise(function (resolve, reject) {
  9062. var options = Object.assign({
  9063. // 请求地址
  9064. url: pathJoin(_config.default.url.upload, (opts === null || opts === void 0 ? void 0 : opts.url) || ''),
  9065. // 请求数据
  9066. filePath: file,
  9067. // 自动显示LOADING
  9068. loading: true,
  9069. // 启用错误自动拦截
  9070. error: true,
  9071. // 请求头设定
  9072. header: {
  9073. 'token': uni.getStorageSync(_config.default.keyname.userToken)
  9074. },
  9075. // 设置显示LOADING的方法
  9076. showLoading: showLoading,
  9077. // 设置关闭LOADING的方法
  9078. hideLoading: hideLoading
  9079. }, opts || {});
  9080. });
  9081. };
  9082. /**
  9083. * 获取登录code
  9084. */
  9085. api.userCode = function () {
  9086. return new Promise(function (resolve, reject) {
  9087. uni.login({
  9088. provider: 'weixin',
  9089. success: function success(res) {
  9090. return resolve(res.code);
  9091. },
  9092. fail: function fail(err) {
  9093. return reject(err);
  9094. }
  9095. });
  9096. });
  9097. };
  9098. /**
  9099. * 自动登录
  9100. * @param {Object} data 登录数据(非必填)
  9101. */
  9102. api.login = function (data) {
  9103. return new Promise( /*#__PURE__*/function () {
  9104. var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(resolve, reject) {
  9105. var code;
  9106. return _regenerator.default.wrap(function _callee6$(_context6) {
  9107. while (1) {
  9108. switch (_context6.prev = _context6.next) {
  9109. case 0:
  9110. _context6.next = 2;
  9111. return api.userCode();
  9112. case 2:
  9113. code = _context6.sent;
  9114. api.post(_config.default.api.login, _objectSpread(_objectSpread({}, data || {}), {}, {
  9115. code: code
  9116. })).then( /*#__PURE__*/function () {
  9117. var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(res) {
  9118. return _regenerator.default.wrap(function _callee5$(_context5) {
  9119. while (1) {
  9120. switch (_context5.prev = _context5.next) {
  9121. case 0:
  9122. uni.setStorageSync(_config.default.keyname.userToken, res === null || res === void 0 ? void 0 : res.token);
  9123. uni.setStorageSync(_config.default.keyname.userInfo, res === null || res === void 0 ? void 0 : res.userInfo);
  9124. resolve(res.token);
  9125. case 3:
  9126. case "end":
  9127. return _context5.stop();
  9128. }
  9129. }
  9130. }, _callee5);
  9131. }));
  9132. return function (_x9) {
  9133. return _ref6.apply(this, arguments);
  9134. };
  9135. }()).catch(function (err) {
  9136. return reject(err);
  9137. });
  9138. case 4:
  9139. case "end":
  9140. return _context6.stop();
  9141. }
  9142. }
  9143. }, _callee6);
  9144. }));
  9145. return function (_x7, _x8) {
  9146. return _ref5.apply(this, arguments);
  9147. };
  9148. }());
  9149. };
  9150. var _default = api;
  9151. exports.default = _default;
  9152. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9153. /***/ }),
  9154. /* 31 */
  9155. /*!************************************************************************************************!*\
  9156. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
  9157. \************************************************************************************************/
  9158. /*! no static exports found */
  9159. /***/ (function(module, exports, __webpack_require__) {
  9160. // TODO(Babel 8): Remove this file.
  9161. var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 32)();
  9162. module.exports = runtime;
  9163. /***/ }),
  9164. /* 32 */
  9165. /*!*******************************************************************!*\
  9166. !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
  9167. \*******************************************************************/
  9168. /*! no static exports found */
  9169. /***/ (function(module, exports, __webpack_require__) {
  9170. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  9171. function _regeneratorRuntime() {
  9172. "use strict";
  9173. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  9174. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  9175. return e;
  9176. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  9177. var t,
  9178. e = {},
  9179. r = Object.prototype,
  9180. n = r.hasOwnProperty,
  9181. o = Object.defineProperty || function (t, e, r) {
  9182. t[e] = r.value;
  9183. },
  9184. i = "function" == typeof Symbol ? Symbol : {},
  9185. a = i.iterator || "@@iterator",
  9186. c = i.asyncIterator || "@@asyncIterator",
  9187. u = i.toStringTag || "@@toStringTag";
  9188. function define(t, e, r) {
  9189. return Object.defineProperty(t, e, {
  9190. value: r,
  9191. enumerable: !0,
  9192. configurable: !0,
  9193. writable: !0
  9194. }), t[e];
  9195. }
  9196. try {
  9197. define({}, "");
  9198. } catch (t) {
  9199. define = function define(t, e, r) {
  9200. return t[e] = r;
  9201. };
  9202. }
  9203. function wrap(t, e, r, n) {
  9204. var i = e && e.prototype instanceof Generator ? e : Generator,
  9205. a = Object.create(i.prototype),
  9206. c = new Context(n || []);
  9207. return o(a, "_invoke", {
  9208. value: makeInvokeMethod(t, r, c)
  9209. }), a;
  9210. }
  9211. function tryCatch(t, e, r) {
  9212. try {
  9213. return {
  9214. type: "normal",
  9215. arg: t.call(e, r)
  9216. };
  9217. } catch (t) {
  9218. return {
  9219. type: "throw",
  9220. arg: t
  9221. };
  9222. }
  9223. }
  9224. e.wrap = wrap;
  9225. var h = "suspendedStart",
  9226. l = "suspendedYield",
  9227. f = "executing",
  9228. s = "completed",
  9229. y = {};
  9230. function Generator() {}
  9231. function GeneratorFunction() {}
  9232. function GeneratorFunctionPrototype() {}
  9233. var p = {};
  9234. define(p, a, function () {
  9235. return this;
  9236. });
  9237. var d = Object.getPrototypeOf,
  9238. v = d && d(d(values([])));
  9239. v && v !== r && n.call(v, a) && (p = v);
  9240. var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
  9241. function defineIteratorMethods(t) {
  9242. ["next", "throw", "return"].forEach(function (e) {
  9243. define(t, e, function (t) {
  9244. return this._invoke(e, t);
  9245. });
  9246. });
  9247. }
  9248. function AsyncIterator(t, e) {
  9249. function invoke(r, o, i, a) {
  9250. var c = tryCatch(t[r], t, o);
  9251. if ("throw" !== c.type) {
  9252. var u = c.arg,
  9253. h = u.value;
  9254. return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
  9255. invoke("next", t, i, a);
  9256. }, function (t) {
  9257. invoke("throw", t, i, a);
  9258. }) : e.resolve(h).then(function (t) {
  9259. u.value = t, i(u);
  9260. }, function (t) {
  9261. return invoke("throw", t, i, a);
  9262. });
  9263. }
  9264. a(c.arg);
  9265. }
  9266. var r;
  9267. o(this, "_invoke", {
  9268. value: function value(t, n) {
  9269. function callInvokeWithMethodAndArg() {
  9270. return new e(function (e, r) {
  9271. invoke(t, n, e, r);
  9272. });
  9273. }
  9274. return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  9275. }
  9276. });
  9277. }
  9278. function makeInvokeMethod(e, r, n) {
  9279. var o = h;
  9280. return function (i, a) {
  9281. if (o === f) throw Error("Generator is already running");
  9282. if (o === s) {
  9283. if ("throw" === i) throw a;
  9284. return {
  9285. value: t,
  9286. done: !0
  9287. };
  9288. }
  9289. for (n.method = i, n.arg = a;;) {
  9290. var c = n.delegate;
  9291. if (c) {
  9292. var u = maybeInvokeDelegate(c, n);
  9293. if (u) {
  9294. if (u === y) continue;
  9295. return u;
  9296. }
  9297. }
  9298. if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
  9299. if (o === h) throw o = s, n.arg;
  9300. n.dispatchException(n.arg);
  9301. } else "return" === n.method && n.abrupt("return", n.arg);
  9302. o = f;
  9303. var p = tryCatch(e, r, n);
  9304. if ("normal" === p.type) {
  9305. if (o = n.done ? s : l, p.arg === y) continue;
  9306. return {
  9307. value: p.arg,
  9308. done: n.done
  9309. };
  9310. }
  9311. "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
  9312. }
  9313. };
  9314. }
  9315. function maybeInvokeDelegate(e, r) {
  9316. var n = r.method,
  9317. o = e.iterator[n];
  9318. if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
  9319. var i = tryCatch(o, e.iterator, r.arg);
  9320. if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
  9321. var a = i.arg;
  9322. return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
  9323. }
  9324. function pushTryEntry(t) {
  9325. var e = {
  9326. tryLoc: t[0]
  9327. };
  9328. 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
  9329. }
  9330. function resetTryEntry(t) {
  9331. var e = t.completion || {};
  9332. e.type = "normal", delete e.arg, t.completion = e;
  9333. }
  9334. function Context(t) {
  9335. this.tryEntries = [{
  9336. tryLoc: "root"
  9337. }], t.forEach(pushTryEntry, this), this.reset(!0);
  9338. }
  9339. function values(e) {
  9340. if (e || "" === e) {
  9341. var r = e[a];
  9342. if (r) return r.call(e);
  9343. if ("function" == typeof e.next) return e;
  9344. if (!isNaN(e.length)) {
  9345. var o = -1,
  9346. i = function next() {
  9347. for (; ++o < e.length;) {
  9348. if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
  9349. }
  9350. return next.value = t, next.done = !0, next;
  9351. };
  9352. return i.next = i;
  9353. }
  9354. }
  9355. throw new TypeError(_typeof(e) + " is not iterable");
  9356. }
  9357. return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
  9358. value: GeneratorFunctionPrototype,
  9359. configurable: !0
  9360. }), o(GeneratorFunctionPrototype, "constructor", {
  9361. value: GeneratorFunction,
  9362. configurable: !0
  9363. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
  9364. var e = "function" == typeof t && t.constructor;
  9365. return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
  9366. }, e.mark = function (t) {
  9367. return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
  9368. }, e.awrap = function (t) {
  9369. return {
  9370. __await: t
  9371. };
  9372. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
  9373. return this;
  9374. }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
  9375. void 0 === i && (i = Promise);
  9376. var a = new AsyncIterator(wrap(t, r, n, o), i);
  9377. return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
  9378. return t.done ? t.value : a.next();
  9379. });
  9380. }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
  9381. return this;
  9382. }), define(g, "toString", function () {
  9383. return "[object Generator]";
  9384. }), e.keys = function (t) {
  9385. var e = Object(t),
  9386. r = [];
  9387. for (var n in e) {
  9388. r.push(n);
  9389. }
  9390. return r.reverse(), function next() {
  9391. for (; r.length;) {
  9392. var t = r.pop();
  9393. if (t in e) return next.value = t, next.done = !1, next;
  9394. }
  9395. return next.done = !0, next;
  9396. };
  9397. }, e.values = values, Context.prototype = {
  9398. constructor: Context,
  9399. reset: function reset(e) {
  9400. if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) {
  9401. "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
  9402. }
  9403. },
  9404. stop: function stop() {
  9405. this.done = !0;
  9406. var t = this.tryEntries[0].completion;
  9407. if ("throw" === t.type) throw t.arg;
  9408. return this.rval;
  9409. },
  9410. dispatchException: function dispatchException(e) {
  9411. if (this.done) throw e;
  9412. var r = this;
  9413. function handle(n, o) {
  9414. return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
  9415. }
  9416. for (var o = this.tryEntries.length - 1; o >= 0; --o) {
  9417. var i = this.tryEntries[o],
  9418. a = i.completion;
  9419. if ("root" === i.tryLoc) return handle("end");
  9420. if (i.tryLoc <= this.prev) {
  9421. var c = n.call(i, "catchLoc"),
  9422. u = n.call(i, "finallyLoc");
  9423. if (c && u) {
  9424. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  9425. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  9426. } else if (c) {
  9427. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  9428. } else {
  9429. if (!u) throw Error("try statement without catch or finally");
  9430. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  9431. }
  9432. }
  9433. }
  9434. },
  9435. abrupt: function abrupt(t, e) {
  9436. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  9437. var o = this.tryEntries[r];
  9438. if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
  9439. var i = o;
  9440. break;
  9441. }
  9442. }
  9443. i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
  9444. var a = i ? i.completion : {};
  9445. return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
  9446. },
  9447. complete: function complete(t, e) {
  9448. if ("throw" === t.type) throw t.arg;
  9449. return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
  9450. },
  9451. finish: function finish(t) {
  9452. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  9453. var r = this.tryEntries[e];
  9454. if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
  9455. }
  9456. },
  9457. "catch": function _catch(t) {
  9458. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  9459. var r = this.tryEntries[e];
  9460. if (r.tryLoc === t) {
  9461. var n = r.completion;
  9462. if ("throw" === n.type) {
  9463. var o = n.arg;
  9464. resetTryEntry(r);
  9465. }
  9466. return o;
  9467. }
  9468. }
  9469. throw Error("illegal catch attempt");
  9470. },
  9471. delegateYield: function delegateYield(e, r, n) {
  9472. return this.delegate = {
  9473. iterator: values(e),
  9474. resultName: r,
  9475. nextLoc: n
  9476. }, "next" === this.method && (this.arg = t), y;
  9477. }
  9478. }, e;
  9479. }
  9480. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  9481. /***/ }),
  9482. /* 33 */
  9483. /*!*****************************************************************!*\
  9484. !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
  9485. \*****************************************************************/
  9486. /*! no static exports found */
  9487. /***/ (function(module, exports) {
  9488. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  9489. try {
  9490. var info = gen[key](arg);
  9491. var value = info.value;
  9492. } catch (error) {
  9493. reject(error);
  9494. return;
  9495. }
  9496. if (info.done) {
  9497. resolve(value);
  9498. } else {
  9499. Promise.resolve(value).then(_next, _throw);
  9500. }
  9501. }
  9502. function _asyncToGenerator(fn) {
  9503. return function () {
  9504. var self = this,
  9505. args = arguments;
  9506. return new Promise(function (resolve, reject) {
  9507. var gen = fn.apply(self, args);
  9508. function _next(value) {
  9509. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  9510. }
  9511. function _throw(err) {
  9512. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  9513. }
  9514. _next(undefined);
  9515. });
  9516. };
  9517. }
  9518. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  9519. /***/ }),
  9520. /* 34 */
  9521. /*!*******************************************************************!*\
  9522. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/app.js ***!
  9523. \*******************************************************************/
  9524. /*! no static exports found */
  9525. /***/ (function(module, exports, __webpack_require__) {
  9526. /* WEBPACK VAR INJECTION */(function(uni, wx) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23);
  9527. var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ 24);
  9528. var app = {};
  9529. app.sys = /*#__PURE__*/function () {
  9530. "use strict";
  9531. function appSystem() {
  9532. _classCallCheck(this, appSystem);
  9533. }
  9534. _createClass(appSystem, null, [{
  9535. key: "envVersion",
  9536. value:
  9537. /**
  9538. * 环境版本判定回调
  9539. * @param {Object.Function} callbacks 回调执行方法
  9540. */
  9541. function envVersion(callbacks) {
  9542. var _uni$getAccountInfoSy, _uni$getAccountInfoSy2;
  9543. if (!uni.getAccountInfoSync) return;
  9544. var current = (_uni$getAccountInfoSy = uni.getAccountInfoSync()) === null || _uni$getAccountInfoSy === void 0 ? void 0 : (_uni$getAccountInfoSy2 = _uni$getAccountInfoSy.miniProgram) === null || _uni$getAccountInfoSy2 === void 0 ? void 0 : _uni$getAccountInfoSy2.envVersion;
  9545. var fn = callbacks[current];
  9546. if (fn && typeof fn == 'function') fn();
  9547. }
  9548. }]);
  9549. return appSystem;
  9550. }();
  9551. app.url = /*#__PURE__*/function () {
  9552. "use strict";
  9553. function appUrl() {
  9554. _classCallCheck(this, appUrl);
  9555. }
  9556. _createClass(appUrl, null, [{
  9557. key: "goto",
  9558. value:
  9559. /**
  9560. * 跳转到地址
  9561. * @param {String} url path字符串
  9562. * @param {Boolean} mode 跳转模式; false时关闭当前窗口跳转 | null时关闭所有窗口跳转 | 默认为打开新窗口跳转(最多支持10层,页面栈超过10层后默认为false模式);
  9563. */
  9564. function goto(url, mode) {
  9565. return new Promise(function (resolve, reject) {
  9566. var fail = function fail(err) {
  9567. return uni.switchTab({
  9568. url: url,
  9569. success: success
  9570. });
  9571. };
  9572. var success = function success() {
  9573. return resolve();
  9574. };
  9575. if (mode === false) return uni.redirectTo({
  9576. url: url,
  9577. fail: fail
  9578. });
  9579. if (mode === null) return uni.reLaunch({
  9580. url: url,
  9581. fail: fail
  9582. });
  9583. if (getCurrentPages().length < 10) {
  9584. uni.navigateTo({
  9585. url: url,
  9586. fail: fail,
  9587. success: success
  9588. });
  9589. } else {
  9590. uni.redirectTo({
  9591. url: url,
  9592. fail: fail,
  9593. success: success
  9594. });
  9595. }
  9596. });
  9597. }
  9598. /**
  9599. * 返回页面
  9600. * @param {int} delta 返回级数
  9601. */
  9602. }, {
  9603. key: "back",
  9604. value: function back(delta) {
  9605. return uni.navigateBack({
  9606. delta: delta || 1
  9607. });
  9608. }
  9609. /**
  9610. * 刷新页面,会触发onLoad和onShow等钩子
  9611. */
  9612. }, {
  9613. key: "refresh",
  9614. value: function refresh() {
  9615. var pages = getCurrentPages();
  9616. var current = pages[pages.length - 1];
  9617. var url = current.$page.fullPath;
  9618. app.urlGoto(url, false);
  9619. }
  9620. /**
  9621. * 打开新窗口并传递数据
  9622. * @param {String} url path字符串
  9623. * @param {any} data 传递数据
  9624. */
  9625. }, {
  9626. key: "open",
  9627. value: function open(url, data) {
  9628. var pages = getCurrentPages();
  9629. var current = pages[pages.length - 1].$page.fullPath;
  9630. uni.navigateTo({
  9631. url: url,
  9632. success: function success(res) {
  9633. res.eventChannel.emit("OPEN-DATA[".concat(current, "]"), data);
  9634. }
  9635. });
  9636. }
  9637. /**
  9638. * 获取open方法发送到数据
  9639. * @param {Component} component 组件对象
  9640. */
  9641. }, {
  9642. key: "load",
  9643. value: function load(component) {
  9644. return new Promise(function (resolve, reject) {
  9645. var _pages, _pages$$page;
  9646. if (component == undefined) return console.error("app.url.load(this);");
  9647. var pages = getCurrentPages();
  9648. var current = (_pages = pages[pages.length - 2]) === null || _pages === void 0 ? void 0 : (_pages$$page = _pages.$page) === null || _pages$$page === void 0 ? void 0 : _pages$$page.fullPath;
  9649. var caller = component === null || component === void 0 ? void 0 : component.getOpenerEventChannel;
  9650. var channel = caller && caller.call(component);
  9651. if (channel && channel.on) channel.on("OPEN-DATA[".concat(current, "]"), function (data) {
  9652. return resolve(data);
  9653. });
  9654. });
  9655. }
  9656. /**
  9657. * 打开其他小程序
  9658. * @param {String} appid 小程序APPID
  9659. * @param {String} path 要打开的程序路径
  9660. * @param {Object} data 要传递给小程序狗子的参数
  9661. */
  9662. }, {
  9663. key: "applet",
  9664. value: function applet(appid, path, data) {
  9665. return new Promise(function (resolve, reject) {
  9666. uni.navigateToMiniProgram({
  9667. appId: appid,
  9668. path: path,
  9669. extraData: data || {},
  9670. success: function success(res) {
  9671. return resolve(res);
  9672. }
  9673. });
  9674. });
  9675. }
  9676. }]);
  9677. return appUrl;
  9678. }();
  9679. app.storage = /*#__PURE__*/function () {
  9680. "use strict";
  9681. function appStorage() {
  9682. _classCallCheck(this, appStorage);
  9683. }
  9684. _createClass(appStorage, null, [{
  9685. key: "set",
  9686. value:
  9687. /**
  9688. * 设置本地缓存数据
  9689. * @param {String} key 数据键名
  9690. * @param {any} data 存储数据,支持对象
  9691. */
  9692. function set(key, data) {
  9693. try {
  9694. uni.setStorageSync(key, data);
  9695. } catch (err) {
  9696. console.error('app.setStorageSync error: ', err);
  9697. }
  9698. }
  9699. /**
  9700. * 获取本地缓存数据
  9701. * @param {String} key 数据键名
  9702. */
  9703. }, {
  9704. key: "get",
  9705. value: function get(key) {
  9706. return uni.getStorageSync(key);
  9707. }
  9708. /**
  9709. * 清除键缓存数据
  9710. * @param {Object} key 数据键名
  9711. */
  9712. }, {
  9713. key: "remove",
  9714. value: function remove(key) {
  9715. uni.removeStorageSync(key);
  9716. }
  9717. /**
  9718. * 清理所有缓存数据
  9719. */
  9720. }, {
  9721. key: "clear",
  9722. value: function clear() {
  9723. uni.clearStorageSync();
  9724. }
  9725. }]);
  9726. return appStorage;
  9727. }();
  9728. app.math = /*#__PURE__*/function () {
  9729. "use strict";
  9730. function appMath() {
  9731. _classCallCheck(this, appMath);
  9732. }
  9733. _createClass(appMath, null, [{
  9734. key: "add",
  9735. value:
  9736. /**
  9737. * 浮点精确相加
  9738. * @param {Number} arg1 参数1
  9739. * @param {Number} arg2 参数2
  9740. */
  9741. function add(arg1, arg2) {
  9742. var r1, r2, m;
  9743. try {
  9744. r1 = arg1.toString().split(".")[1].length;
  9745. } catch (e) {
  9746. r1 = 0;
  9747. }
  9748. try {
  9749. r2 = arg2.toString().split(".")[1].length;
  9750. } catch (e) {
  9751. r2 = 0;
  9752. }
  9753. m = Math.pow(10, Math.max(r1, r2));
  9754. return (arg1 * m + arg2 * m) / m;
  9755. }
  9756. /**
  9757. * 浮点精确相减
  9758. * @param {Number} arg1 参数1
  9759. * @param {Number} arg2 参数2
  9760. */
  9761. }, {
  9762. key: "sub",
  9763. value: function sub(arg1, arg2) {
  9764. var r1, r2, m, n;
  9765. try {
  9766. r1 = arg1.toString().split(".")[1].length;
  9767. } catch (e) {
  9768. r1 = 0;
  9769. }
  9770. try {
  9771. r2 = arg2.toString().split(".")[1].length;
  9772. } catch (e) {
  9773. r2 = 0;
  9774. }
  9775. m = Math.pow(10, Math.max(r1, r2));
  9776. n = (r1 = r2) ? r1 : r2;
  9777. return ((arg1 * m - arg2 * m) / m).toFixed(n);
  9778. }
  9779. /**
  9780. * 浮点精确相乘
  9781. * @param {Number} arg1 参数1
  9782. * @param {Number} arg2 参数2
  9783. */
  9784. }, {
  9785. key: "mul",
  9786. value: function mul(arg1, arg2) {
  9787. var m = 0,
  9788. s1 = arg1.toString(),
  9789. s2 = arg2.toString();
  9790. try {
  9791. m += s1.split(".")[1].length;
  9792. } catch (e) {}
  9793. try {
  9794. m += s2.split(".")[1].length;
  9795. } catch (e) {}
  9796. return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
  9797. }
  9798. /**
  9799. * 浮点精确相除
  9800. * @param {Number} arg1 参数1
  9801. * @param {Number} arg2 参数2
  9802. */
  9803. }, {
  9804. key: "div",
  9805. value: function div(arg1, arg2) {
  9806. var t1 = 0,
  9807. t2 = 0,
  9808. r1,
  9809. r2;
  9810. try {
  9811. t1 = arg1.toString().split(".")[1].length;
  9812. } catch (e) {}
  9813. ;
  9814. try {
  9815. t2 = arg2.toString().split(".")[1].length;
  9816. } catch (e) {}
  9817. ;
  9818. r1 = Number(arg1.toString().replace(".", ""));
  9819. r2 = Number(arg2.toString().replace(".", ""));
  9820. return r1 / r2 * Math.pow(10, t2 - t1);
  9821. }
  9822. }]);
  9823. return appMath;
  9824. }();
  9825. app.date = /*#__PURE__*/function () {
  9826. "use strict";
  9827. function appDate() {
  9828. _classCallCheck(this, appDate);
  9829. }
  9830. _createClass(appDate, null, [{
  9831. key: "format",
  9832. value:
  9833. /**
  9834. * 日期格式化
  9835. * @param {String} fmt 格式规则
  9836. * @param {String | Date} date 需要格式化的日期
  9837. */
  9838. function format(fmt, date) {
  9839. if (!fmt) fmt = 'yyyy-MM-dd hh:mm:sss';
  9840. if (typeof date === 'string') date = new Date(date.replaceAll('-', '/'));
  9841. if (!date) date = new Date();
  9842. var o = {
  9843. "M+": date.getMonth() + 1,
  9844. //月份
  9845. "d+": date.getDate(),
  9846. //日
  9847. "h+": date.getHours(),
  9848. //小时
  9849. "m+": date.getMinutes(),
  9850. //分
  9851. "s+": date.getSeconds(),
  9852. //秒
  9853. "q+": Math.floor((date.getMonth() + 3) / 3),
  9854. //季度
  9855. "S": date.getMilliseconds() //毫秒
  9856. };
  9857. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  9858. for (var k in o) {
  9859. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  9860. }
  9861. return fmt;
  9862. }
  9863. }]);
  9864. return appDate;
  9865. }();
  9866. app.popup = /*#__PURE__*/function () {
  9867. "use strict";
  9868. function appPopup() {
  9869. _classCallCheck(this, appPopup);
  9870. }
  9871. _createClass(appPopup, null, [{
  9872. key: "confirm",
  9873. value:
  9874. /**
  9875. * 对话框
  9876. * @param {String} content 弹窗内容
  9877. * @param {String} title 弹窗标题
  9878. * @param {Object} opts 参数
  9879. */
  9880. function confirm(content, title, opts) {
  9881. return new Promise(function (resolve, reject) {
  9882. if (!title && title == null) title = '温馨提示';
  9883. opts = Object.assign({
  9884. title: title,
  9885. content: content,
  9886. success: function success(res) {
  9887. return resolve(res.confirm == true);
  9888. },
  9889. fail: function fail(err) {
  9890. return reject(err);
  9891. }
  9892. }, opts);
  9893. uni.showModal(opts);
  9894. });
  9895. }
  9896. /**
  9897. * 提示框
  9898. * @param {String} content 弹窗内容
  9899. * @param {String} title 弹窗标题
  9900. */
  9901. }, {
  9902. key: "alert",
  9903. value: function alert(content, title) {
  9904. return appPopup.confirm(content, title || null, {
  9905. showCancel: false
  9906. });
  9907. }
  9908. }, {
  9909. key: "toast",
  9910. value:
  9911. /**
  9912. * 轻提示
  9913. * @param {String} content 提示内容
  9914. * @param {Object} opts 参数
  9915. */
  9916. function toast(content, opts) {
  9917. uni.showToast(Object.assign({
  9918. title: content,
  9919. position: 'bottom',
  9920. duration: 2000,
  9921. icon: 'none'
  9922. }, opts));
  9923. }
  9924. /**
  9925. * 加载条
  9926. * @param {Boolean} visible 显示
  9927. * @param {Object} opts 参数
  9928. */
  9929. }, {
  9930. key: "loading",
  9931. value: function loading(visible, opts) {
  9932. if (visible) {
  9933. uni.showLoading(Object.assign({
  9934. title: '载入中',
  9935. mask: true
  9936. }, opts));
  9937. var timeout = (opts === null || opts === void 0 ? void 0 : opts.timeout) || 45 * 1000;
  9938. setTimeout(function () {
  9939. return appPopup.loading(false);
  9940. }, timeout);
  9941. } else {
  9942. uni.hideLoading();
  9943. }
  9944. }
  9945. /**
  9946. * 操作菜单
  9947. * @param {Array} data 列表数据
  9948. * @param {String} key 指定显示字段
  9949. * @param {Object} opts 参数
  9950. */
  9951. }, {
  9952. key: "sheet",
  9953. value: function sheet(data, key, opts) {
  9954. return new Promise(function (resolve, reject) {
  9955. uni.showActionSheet(Object.assign({
  9956. title: '',
  9957. itemList: data.map(function (item) {
  9958. return key ? item[key] || String(item) : String(item);
  9959. }),
  9960. success: function success(res) {
  9961. return resolve({
  9962. index: res.tapIndex,
  9963. data: data[res.tapIndex]
  9964. });
  9965. }
  9966. }, opts));
  9967. });
  9968. }
  9969. }]);
  9970. return appPopup;
  9971. }();
  9972. app.map = /*#__PURE__*/function () {
  9973. "use strict";
  9974. function appMap() {
  9975. _classCallCheck(this, appMap);
  9976. }
  9977. _createClass(appMap, null, [{
  9978. key: "get",
  9979. value:
  9980. /**
  9981. * 获取当前位置坐标
  9982. * @param {Boolean} high 是否调用高精度接口
  9983. * @param {Object} opts 参数
  9984. */
  9985. function get(high, opts) {
  9986. return new Promise(function (resolve, reject) {
  9987. var OPTS = Object.assign({
  9988. success: function success(res) {
  9989. console.log(res);
  9990. },
  9991. fail: function fail(err) {
  9992. console.log(err);
  9993. }
  9994. }, opts);
  9995. high ? uni.getLocation(OPTS) : uni.getFuzzyLocation(OPTS);
  9996. });
  9997. }
  9998. }]);
  9999. return appMap;
  10000. }();
  10001. app.act = /*#__PURE__*/function () {
  10002. "use strict";
  10003. function appAct() {
  10004. _classCallCheck(this, appAct);
  10005. }
  10006. _createClass(appAct, null, [{
  10007. key: "callPhone",
  10008. value:
  10009. /**
  10010. * 拨打电话
  10011. * @param {String} phone
  10012. */
  10013. function callPhone(phone) {
  10014. uni.makePhoneCall({
  10015. phoneNumber: phone
  10016. });
  10017. }
  10018. /**
  10019. * 调用扫描
  10020. * @param {Object} opts 参数配置,详细查看 https://uniapp.dcloud.net.cn/api/system/barcode.html
  10021. */
  10022. }, {
  10023. key: "scan",
  10024. value: function scan(opts) {
  10025. return new Promise(function (resolve, reject) {
  10026. uni.scanCode(Object.assign({}, {
  10027. success: function success(res) {
  10028. return resolve(res);
  10029. }
  10030. // fail: err=>reject(err),
  10031. }, opts));
  10032. });
  10033. }
  10034. /**
  10035. * 获取节点信息
  10036. * @param {Component} component 组件
  10037. * @param {String} selector 类似于 CSS 的选择器
  10038. * @param {Boolean} multi 是否多节点
  10039. */
  10040. }, {
  10041. key: "selectorQuery",
  10042. value: function selectorQuery(component, selector, multi) {
  10043. return new Promise(function (resolve, reject) {
  10044. var query = uni.createSelectorQuery().in(component)[multi ? 'selectAll' : 'select'](selector);
  10045. query.boundingClientRect(function (data) {
  10046. if (data) resolve(data);
  10047. }).exec();
  10048. });
  10049. }
  10050. /**
  10051. * 复制文本到剪贴板
  10052. * @param {String} str 需要复制的文本
  10053. */
  10054. }, {
  10055. key: "copy",
  10056. value: function copy(str) {
  10057. return new Promise(function (resolve, reject) {
  10058. uni.setClipboardData({
  10059. data: 'hello',
  10060. success: resolve(),
  10061. fail: function fail(err) {
  10062. return reject(err);
  10063. }
  10064. });
  10065. });
  10066. }
  10067. /**
  10068. * 客服服务
  10069. * @param {Object} id
  10070. * @param {Object} url
  10071. */
  10072. }, {
  10073. key: "customerService",
  10074. value: function customerService(id, url) {
  10075. return new Promise(function (resolve, reject) {
  10076. wx.openCustomerServiceChat({
  10077. extInfo: {
  10078. url: url
  10079. },
  10080. corpId: id,
  10081. success: function success(res) {
  10082. return resolve(res);
  10083. },
  10084. fail: function fail(err) {
  10085. return reject(err);
  10086. }
  10087. });
  10088. });
  10089. }
  10090. }]);
  10091. return appAct;
  10092. }();
  10093. module.exports = app;
  10094. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  10095. /***/ }),
  10096. /* 35 */
  10097. /*!**********************************************************************!*\
  10098. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/config.js ***!
  10099. \**********************************************************************/
  10100. /*! no static exports found */
  10101. /***/ (function(module, exports, __webpack_require__) {
  10102. "use strict";
  10103. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10104. Object.defineProperty(exports, "__esModule", {
  10105. value: true
  10106. });
  10107. exports.default = void 0;
  10108. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  10109. var _app = _interopRequireDefault(__webpack_require__(/*! ./app */ 34));
  10110. var _pages = _interopRequireDefault(__webpack_require__(/*! @/pages.json */ 36));
  10111. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  10112. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  10113. var config = {};
  10114. // 地址类
  10115. config.url = {
  10116. // API请求基础URL
  10117. // request : 'https://charge.hub.zswlgz.com/',
  10118. request: 'http://192.168.1.36:80/',
  10119. // request : 'http://120.78.228.211:8866/',
  10120. // request : 'https://charge.dev.hub.zswlgz.com/',
  10121. // 上传地址
  10122. upload: 'http://127.0.0.1:3000/upload/',
  10123. // 下载地址
  10124. download: 'http://oss.aabb.com/download/',
  10125. // 静态文件服务
  10126. static: 'http://oss.aabb.com/',
  10127. //配置文件地址
  10128. configUrl: 'http://bx.eomp.cn/adp/'
  10129. };
  10130. // 接口类
  10131. config.api = {
  10132. login: '/userApi/login'
  10133. };
  10134. // 键名类
  10135. config.keyname = {
  10136. userInfo: 'USER_INFO',
  10137. userToken: 'USER_TOKEN',
  10138. logs: 'LOGS_DATA'
  10139. };
  10140. // 事件名
  10141. config.eventName = {
  10142. setResult: 'SET-HOME-RESULT'
  10143. };
  10144. // 客服
  10145. config.customerService = {
  10146. id: 'wwfb3777bf94dcfaf1',
  10147. url: 'https://work.weixin.qq.com/kfid/kfc4feac060f5c1bc7e'
  10148. };
  10149. // pages.json 页面配置文件
  10150. config.pages = _pages.default.pages.map(function (i) {
  10151. i.style = _objectSpread(_objectSpread({}, _pages.default.globalStyle), i.style);
  10152. return i;
  10153. });
  10154. // 不同版本执行器
  10155. _app.default.sys.envVersion({
  10156. // 正式版
  10157. release: function release() {},
  10158. // 体验版
  10159. trial: function trial() {},
  10160. // 开发版
  10161. develop: function develop() {}
  10162. });
  10163. var _default = config;
  10164. exports.default = _default;
  10165. /***/ }),
  10166. /* 36 */
  10167. /*!******************************************************************************************!*\
  10168. !*** E:/zswl/code/charge_miniapp/charge_miniapp/pages.json?{"type":"origin-pages-json"} ***!
  10169. \******************************************************************************************/
  10170. /*! no static exports found */
  10171. /***/ (function(module, exports, __webpack_require__) {
  10172. "use strict";
  10173. Object.defineProperty(exports, "__esModule", {
  10174. value: true
  10175. });
  10176. exports.default = void 0;
  10177. var _default = {
  10178. "pages": [{
  10179. "path": "pages/index/index",
  10180. "style": {
  10181. "navigationBarTitleText": "首页"
  10182. }
  10183. }, {
  10184. "path": "pages/map/map",
  10185. "style": {
  10186. "navigationBarTitleText": "地图模式"
  10187. }
  10188. }, {
  10189. "path": "pages/my/my",
  10190. "style": {
  10191. "navigationBarTitleText": "个人中心"
  10192. }
  10193. }, {
  10194. "path": "pages/site/site",
  10195. "style": {
  10196. "navigationBarTitleText": "站点详情"
  10197. }
  10198. }, {
  10199. "path": "pages/site-more/site-more",
  10200. "style": {
  10201. "navigationBarTitleText": "电站价格"
  10202. }
  10203. }, {
  10204. "path": "pages/charging/charging",
  10205. "style": {
  10206. "navigationBarTitleText": "正在充电"
  10207. }
  10208. }, {
  10209. "path": "pages/order-detail/order-detail",
  10210. "style": {
  10211. "navigationBarTitleText": "订单详情"
  10212. }
  10213. }, {
  10214. "path": "pages/terminal/terminal",
  10215. "style": {
  10216. "navigationBarTitleText": "充电终端"
  10217. }
  10218. }, {
  10219. "path": "pages/coupon-buy/coupon-buy",
  10220. "style": {
  10221. "navigationBarTitleText": "购券中心"
  10222. }
  10223. }, {
  10224. "path": "pages/login/login",
  10225. "style": {
  10226. "navigationBarTitleText": "用户登录"
  10227. }
  10228. }, {
  10229. "path": "pages/recharge-log/recharge-log",
  10230. "style": {
  10231. "navigationBarTitleText": "购券记录"
  10232. }
  10233. }, {
  10234. "path": "pages/feedback/feedback",
  10235. "style": {
  10236. "navigationBarTitleText": ""
  10237. }
  10238. }, {
  10239. "path": "pages/order/order",
  10240. "style": {
  10241. "navigationBarTitleText": "充电订单"
  10242. }
  10243. }, {
  10244. "path": "pages/search/search",
  10245. "style": {
  10246. "navigationBarTitleText": "站点搜索"
  10247. }
  10248. }, {
  10249. "path": "pages/Invite-staff/Invite-staff",
  10250. "style": {
  10251. "navigationBarTitleText": "邀请员工"
  10252. }
  10253. }, {
  10254. "path": "pages/coupons/coupons",
  10255. "style": {
  10256. "navigationBarTitleText": "优惠券"
  10257. }
  10258. }, {
  10259. "path": "pages/web/web",
  10260. "style": {
  10261. "navigationBarTitleText": "",
  10262. "navigationStyle": "default",
  10263. "navigationBarBackgroundColor": "#fff",
  10264. "backgroundColor": "#fff"
  10265. }
  10266. }, {
  10267. "path": "pages/feedback-reply/feedback-reply",
  10268. "style": {
  10269. "navigationBarTitleText": "反馈答复"
  10270. }
  10271. }, {
  10272. "path": "pages/banner-page/banner-page",
  10273. "style": {
  10274. "navigationBarTitleText": "活动详情"
  10275. }
  10276. }],
  10277. "globalStyle": {
  10278. "navigationBarTextStyle": "black",
  10279. "navigationBarTitleText": "中数电动",
  10280. "navigationBarBackgroundColor": "#C7FFFD",
  10281. "backgroundColor": "#C7FFFD",
  10282. "navigationStyle": "custom"
  10283. },
  10284. "uniIdRouter": {}
  10285. };
  10286. exports.default = _default;
  10287. /***/ }),
  10288. /* 37 */,
  10289. /* 38 */,
  10290. /* 39 */
  10291. /*!**********************************************************************************************************!*\
  10292. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  10293. \**********************************************************************************************************/
  10294. /*! exports provided: default */
  10295. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10296. "use strict";
  10297. __webpack_require__.r(__webpack_exports__);
  10298. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  10299. /* globals __VUE_SSR_CONTEXT__ */
  10300. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  10301. // This module is a runtime utility for cleaner component module output and will
  10302. // be included in the final webpack user bundle.
  10303. function normalizeComponent (
  10304. scriptExports,
  10305. render,
  10306. staticRenderFns,
  10307. functionalTemplate,
  10308. injectStyles,
  10309. scopeId,
  10310. moduleIdentifier, /* server only */
  10311. shadowMode, /* vue-cli only */
  10312. components, // fixed by xxxxxx auto components
  10313. renderjs // fixed by xxxxxx renderjs
  10314. ) {
  10315. // Vue.extend constructor export interop
  10316. var options = typeof scriptExports === 'function'
  10317. ? scriptExports.options
  10318. : scriptExports
  10319. // fixed by xxxxxx auto components
  10320. if (components) {
  10321. if (!options.components) {
  10322. options.components = {}
  10323. }
  10324. var hasOwn = Object.prototype.hasOwnProperty
  10325. for (var name in components) {
  10326. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  10327. options.components[name] = components[name]
  10328. }
  10329. }
  10330. }
  10331. // fixed by xxxxxx renderjs
  10332. if (renderjs) {
  10333. if(typeof renderjs.beforeCreate === 'function'){
  10334. renderjs.beforeCreate = [renderjs.beforeCreate]
  10335. }
  10336. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  10337. this[renderjs.__module] = this
  10338. });
  10339. (options.mixins || (options.mixins = [])).push(renderjs)
  10340. }
  10341. // render functions
  10342. if (render) {
  10343. options.render = render
  10344. options.staticRenderFns = staticRenderFns
  10345. options._compiled = true
  10346. }
  10347. // functional template
  10348. if (functionalTemplate) {
  10349. options.functional = true
  10350. }
  10351. // scopedId
  10352. if (scopeId) {
  10353. options._scopeId = 'data-v-' + scopeId
  10354. }
  10355. var hook
  10356. if (moduleIdentifier) { // server build
  10357. hook = function (context) {
  10358. // 2.3 injection
  10359. context =
  10360. context || // cached call
  10361. (this.$vnode && this.$vnode.ssrContext) || // stateful
  10362. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  10363. // 2.2 with runInNewContext: true
  10364. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  10365. context = __VUE_SSR_CONTEXT__
  10366. }
  10367. // inject component styles
  10368. if (injectStyles) {
  10369. injectStyles.call(this, context)
  10370. }
  10371. // register component module identifier for async chunk inferrence
  10372. if (context && context._registeredComponents) {
  10373. context._registeredComponents.add(moduleIdentifier)
  10374. }
  10375. }
  10376. // used by ssr in case component is cached and beforeCreate
  10377. // never gets called
  10378. options._ssrRegister = hook
  10379. } else if (injectStyles) {
  10380. hook = shadowMode
  10381. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  10382. : injectStyles
  10383. }
  10384. if (hook) {
  10385. if (options.functional) {
  10386. // for template-only hot-reload because in that case the render fn doesn't
  10387. // go through the normalizer
  10388. options._injectStyles = hook
  10389. // register for functioal component in vue file
  10390. var originalRender = options.render
  10391. options.render = function renderWithStyleInjection (h, context) {
  10392. hook.call(context)
  10393. return originalRender(h, context)
  10394. }
  10395. } else {
  10396. // inject component registration as beforeCreate hook
  10397. var existing = options.beforeCreate
  10398. options.beforeCreate = existing
  10399. ? [].concat(existing, hook)
  10400. : [hook]
  10401. }
  10402. }
  10403. return {
  10404. exports: scriptExports,
  10405. options: options
  10406. }
  10407. }
  10408. /***/ }),
  10409. /* 40 */
  10410. /*!***************************************************************************!*\
  10411. !*** E:/zswl/code/charge_miniapp/charge_miniapp/uni.promisify.adaptor.js ***!
  10412. \***************************************************************************/
  10413. /*! no static exports found */
  10414. /***/ (function(module, exports, __webpack_require__) {
  10415. /* WEBPACK VAR INJECTION */(function(uni) {var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  10416. uni.addInterceptor({
  10417. returnValue: function returnValue(res) {
  10418. if (!(!!res && (_typeof(res) === "object" || typeof res === "function") && typeof res.then === "function")) {
  10419. return res;
  10420. }
  10421. return new Promise(function (resolve, reject) {
  10422. res.then(function (res) {
  10423. return res[0] ? reject(res[0]) : resolve(res[1]);
  10424. });
  10425. });
  10426. }
  10427. });
  10428. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10429. /***/ }),
  10430. /* 41 */
  10431. /*!*********************************************************************!*\
  10432. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/index.js ***!
  10433. \*********************************************************************/
  10434. /*! no static exports found */
  10435. /***/ (function(module, exports, __webpack_require__) {
  10436. "use strict";
  10437. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10438. Object.defineProperty(exports, "__esModule", {
  10439. value: true
  10440. });
  10441. Object.defineProperty(exports, "$Api", {
  10442. enumerable: true,
  10443. get: function get() {
  10444. return _api.default;
  10445. }
  10446. });
  10447. Object.defineProperty(exports, "$App", {
  10448. enumerable: true,
  10449. get: function get() {
  10450. return _app.default;
  10451. }
  10452. });
  10453. Object.defineProperty(exports, "$Config", {
  10454. enumerable: true,
  10455. get: function get() {
  10456. return _config.default;
  10457. }
  10458. });
  10459. Object.defineProperty(exports, "$Qrcode", {
  10460. enumerable: true,
  10461. get: function get() {
  10462. return _wxqrcode.default;
  10463. }
  10464. });
  10465. var _app = _interopRequireDefault(__webpack_require__(/*! ./app.js */ 34));
  10466. var _api = _interopRequireDefault(__webpack_require__(/*! ./api.js */ 30));
  10467. var _config = _interopRequireDefault(__webpack_require__(/*! ./config.js */ 35));
  10468. var _wxqrcode = _interopRequireDefault(__webpack_require__(/*! ./wxqrcode.js */ 42));
  10469. /***/ }),
  10470. /* 42 */
  10471. /*!************************************************************************!*\
  10472. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/wxqrcode.js ***!
  10473. \************************************************************************/
  10474. /*! no static exports found */
  10475. /***/ (function(module, exports) {
  10476. //---------------------------------------------------------------------
  10477. //
  10478. // QR Code Generator for JavaScript
  10479. //
  10480. // Copyright (c) 2009 Kazuhiko Arase
  10481. //
  10482. // URL: http://www.d-project.com/
  10483. //
  10484. // Licensed under the MIT license:
  10485. // http://www.opensource.org/licenses/mit-license.php
  10486. //
  10487. // The word 'QR Code' is registered trademark of
  10488. // DENSO WAVE INCORPORATED
  10489. // http://www.denso-wave.com/qrcode/faqpatent-e.html
  10490. //
  10491. //---------------------------------------------------------------------
  10492. //---------------------------------------------------------------------
  10493. // qrcode
  10494. //代码第1588行为补充代码
  10495. //修改人:chenxing
  10496. //2017-02-27 16:21:32
  10497. //---------------------------------------------------------------------
  10498. /**
  10499. * qrcode
  10500. * @param typeNumber 1 to 40
  10501. * @param errorCorrectLevel 'L','M','Q','H'
  10502. */
  10503. var qrcode = function qrcode(typeNumber, errorCorrectLevel) {
  10504. var PAD0 = 0xEC;
  10505. var PAD1 = 0x11;
  10506. var _typeNumber = typeNumber;
  10507. var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel];
  10508. var _modules = null;
  10509. var _moduleCount = 0;
  10510. var _dataCache = null;
  10511. var _dataList = new Array();
  10512. var _this = {};
  10513. var makeImpl = function makeImpl(test, maskPattern) {
  10514. _moduleCount = _typeNumber * 4 + 17;
  10515. _modules = function (moduleCount) {
  10516. var modules = new Array(moduleCount);
  10517. for (var row = 0; row < moduleCount; row += 1) {
  10518. modules[row] = new Array(moduleCount);
  10519. for (var col = 0; col < moduleCount; col += 1) {
  10520. modules[row][col] = null;
  10521. }
  10522. }
  10523. return modules;
  10524. }(_moduleCount);
  10525. setupPositionProbePattern(0, 0);
  10526. setupPositionProbePattern(_moduleCount - 7, 0);
  10527. setupPositionProbePattern(0, _moduleCount - 7);
  10528. setupPositionAdjustPattern();
  10529. setupTimingPattern();
  10530. setupTypeInfo(test, maskPattern);
  10531. if (_typeNumber >= 7) {
  10532. setupTypeNumber(test);
  10533. }
  10534. if (_dataCache == null) {
  10535. _dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList);
  10536. }
  10537. mapData(_dataCache, maskPattern);
  10538. };
  10539. var setupPositionProbePattern = function setupPositionProbePattern(row, col) {
  10540. for (var r = -1; r <= 7; r += 1) {
  10541. if (row + r <= -1 || _moduleCount <= row + r) continue;
  10542. for (var c = -1; c <= 7; c += 1) {
  10543. if (col + c <= -1 || _moduleCount <= col + c) continue;
  10544. if (0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
  10545. _modules[row + r][col + c] = true;
  10546. } else {
  10547. _modules[row + r][col + c] = false;
  10548. }
  10549. }
  10550. }
  10551. };
  10552. var getBestMaskPattern = function getBestMaskPattern() {
  10553. var minLostPoint = 0;
  10554. var pattern = 0;
  10555. for (var i = 0; i < 8; i += 1) {
  10556. makeImpl(true, i);
  10557. var lostPoint = QRUtil.getLostPoint(_this);
  10558. if (i == 0 || minLostPoint > lostPoint) {
  10559. minLostPoint = lostPoint;
  10560. pattern = i;
  10561. }
  10562. }
  10563. return pattern;
  10564. };
  10565. var setupTimingPattern = function setupTimingPattern() {
  10566. for (var r = 8; r < _moduleCount - 8; r += 1) {
  10567. if (_modules[r][6] != null) {
  10568. continue;
  10569. }
  10570. _modules[r][6] = r % 2 == 0;
  10571. }
  10572. for (var c = 8; c < _moduleCount - 8; c += 1) {
  10573. if (_modules[6][c] != null) {
  10574. continue;
  10575. }
  10576. _modules[6][c] = c % 2 == 0;
  10577. }
  10578. };
  10579. var setupPositionAdjustPattern = function setupPositionAdjustPattern() {
  10580. var pos = QRUtil.getPatternPosition(_typeNumber);
  10581. for (var i = 0; i < pos.length; i += 1) {
  10582. for (var j = 0; j < pos.length; j += 1) {
  10583. var row = pos[i];
  10584. var col = pos[j];
  10585. if (_modules[row][col] != null) {
  10586. continue;
  10587. }
  10588. for (var r = -2; r <= 2; r += 1) {
  10589. for (var c = -2; c <= 2; c += 1) {
  10590. if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
  10591. _modules[row + r][col + c] = true;
  10592. } else {
  10593. _modules[row + r][col + c] = false;
  10594. }
  10595. }
  10596. }
  10597. }
  10598. }
  10599. };
  10600. var setupTypeNumber = function setupTypeNumber(test) {
  10601. var bits = QRUtil.getBCHTypeNumber(_typeNumber);
  10602. for (var i = 0; i < 18; i += 1) {
  10603. var mod = !test && (bits >> i & 1) == 1;
  10604. _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
  10605. }
  10606. for (var i = 0; i < 18; i += 1) {
  10607. var mod = !test && (bits >> i & 1) == 1;
  10608. _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
  10609. }
  10610. };
  10611. var setupTypeInfo = function setupTypeInfo(test, maskPattern) {
  10612. var data = _errorCorrectLevel << 3 | maskPattern;
  10613. var bits = QRUtil.getBCHTypeInfo(data);
  10614. // vertical
  10615. for (var i = 0; i < 15; i += 1) {
  10616. var mod = !test && (bits >> i & 1) == 1;
  10617. if (i < 6) {
  10618. _modules[i][8] = mod;
  10619. } else if (i < 8) {
  10620. _modules[i + 1][8] = mod;
  10621. } else {
  10622. _modules[_moduleCount - 15 + i][8] = mod;
  10623. }
  10624. }
  10625. // horizontal
  10626. for (var i = 0; i < 15; i += 1) {
  10627. var mod = !test && (bits >> i & 1) == 1;
  10628. if (i < 8) {
  10629. _modules[8][_moduleCount - i - 1] = mod;
  10630. } else if (i < 9) {
  10631. _modules[8][15 - i - 1 + 1] = mod;
  10632. } else {
  10633. _modules[8][15 - i - 1] = mod;
  10634. }
  10635. }
  10636. // fixed module
  10637. _modules[_moduleCount - 8][8] = !test;
  10638. };
  10639. var mapData = function mapData(data, maskPattern) {
  10640. var inc = -1;
  10641. var row = _moduleCount - 1;
  10642. var bitIndex = 7;
  10643. var byteIndex = 0;
  10644. var maskFunc = QRUtil.getMaskFunction(maskPattern);
  10645. for (var col = _moduleCount - 1; col > 0; col -= 2) {
  10646. if (col == 6) col -= 1;
  10647. while (true) {
  10648. for (var c = 0; c < 2; c += 1) {
  10649. if (_modules[row][col - c] == null) {
  10650. var dark = false;
  10651. if (byteIndex < data.length) {
  10652. dark = (data[byteIndex] >>> bitIndex & 1) == 1;
  10653. }
  10654. var mask = maskFunc(row, col - c);
  10655. if (mask) {
  10656. dark = !dark;
  10657. }
  10658. _modules[row][col - c] = dark;
  10659. bitIndex -= 1;
  10660. if (bitIndex == -1) {
  10661. byteIndex += 1;
  10662. bitIndex = 7;
  10663. }
  10664. }
  10665. }
  10666. row += inc;
  10667. if (row < 0 || _moduleCount <= row) {
  10668. row -= inc;
  10669. inc = -inc;
  10670. break;
  10671. }
  10672. }
  10673. }
  10674. };
  10675. var createBytes = function createBytes(buffer, rsBlocks) {
  10676. var offset = 0;
  10677. var maxDcCount = 0;
  10678. var maxEcCount = 0;
  10679. var dcdata = new Array(rsBlocks.length);
  10680. var ecdata = new Array(rsBlocks.length);
  10681. for (var r = 0; r < rsBlocks.length; r += 1) {
  10682. var dcCount = rsBlocks[r].dataCount;
  10683. var ecCount = rsBlocks[r].totalCount - dcCount;
  10684. maxDcCount = Math.max(maxDcCount, dcCount);
  10685. maxEcCount = Math.max(maxEcCount, ecCount);
  10686. dcdata[r] = new Array(dcCount);
  10687. for (var i = 0; i < dcdata[r].length; i += 1) {
  10688. dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
  10689. }
  10690. offset += dcCount;
  10691. var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
  10692. var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
  10693. var modPoly = rawPoly.mod(rsPoly);
  10694. ecdata[r] = new Array(rsPoly.getLength() - 1);
  10695. for (var i = 0; i < ecdata[r].length; i += 1) {
  10696. var modIndex = i + modPoly.getLength() - ecdata[r].length;
  10697. ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
  10698. }
  10699. }
  10700. var totalCodeCount = 0;
  10701. for (var i = 0; i < rsBlocks.length; i += 1) {
  10702. totalCodeCount += rsBlocks[i].totalCount;
  10703. }
  10704. var data = new Array(totalCodeCount);
  10705. var index = 0;
  10706. for (var i = 0; i < maxDcCount; i += 1) {
  10707. for (var r = 0; r < rsBlocks.length; r += 1) {
  10708. if (i < dcdata[r].length) {
  10709. data[index] = dcdata[r][i];
  10710. index += 1;
  10711. }
  10712. }
  10713. }
  10714. for (var i = 0; i < maxEcCount; i += 1) {
  10715. for (var r = 0; r < rsBlocks.length; r += 1) {
  10716. if (i < ecdata[r].length) {
  10717. data[index] = ecdata[r][i];
  10718. index += 1;
  10719. }
  10720. }
  10721. }
  10722. return data;
  10723. };
  10724. var createData = function createData(typeNumber, errorCorrectLevel, dataList) {
  10725. var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
  10726. var buffer = qrBitBuffer();
  10727. for (var i = 0; i < dataList.length; i += 1) {
  10728. var data = dataList[i];
  10729. buffer.put(data.getMode(), 4);
  10730. buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber));
  10731. data.write(buffer);
  10732. }
  10733. // calc num max data.
  10734. var totalDataCount = 0;
  10735. for (var i = 0; i < rsBlocks.length; i += 1) {
  10736. totalDataCount += rsBlocks[i].dataCount;
  10737. }
  10738. if (buffer.getLengthInBits() > totalDataCount * 8) {
  10739. throw new Error('code length overflow. (' + buffer.getLengthInBits() + '>' + totalDataCount * 8 + ')');
  10740. }
  10741. // end code
  10742. if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
  10743. buffer.put(0, 4);
  10744. }
  10745. // padding
  10746. while (buffer.getLengthInBits() % 8 != 0) {
  10747. buffer.putBit(false);
  10748. }
  10749. // padding
  10750. while (true) {
  10751. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  10752. break;
  10753. }
  10754. buffer.put(PAD0, 8);
  10755. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  10756. break;
  10757. }
  10758. buffer.put(PAD1, 8);
  10759. }
  10760. return createBytes(buffer, rsBlocks);
  10761. };
  10762. _this.addData = function (data) {
  10763. var newData = qr8BitByte(data);
  10764. _dataList.push(newData);
  10765. _dataCache = null;
  10766. };
  10767. _this.isDark = function (row, col) {
  10768. if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
  10769. throw new Error(row + ',' + col);
  10770. }
  10771. return _modules[row][col];
  10772. };
  10773. _this.getModuleCount = function () {
  10774. return _moduleCount;
  10775. };
  10776. _this.make = function () {
  10777. makeImpl(false, getBestMaskPattern());
  10778. };
  10779. _this.createTableTag = function (cellSize, margin) {
  10780. cellSize = cellSize || 2;
  10781. margin = typeof margin == 'undefined' ? cellSize * 4 : margin;
  10782. var qrHtml = '';
  10783. qrHtml += '<table style="';
  10784. qrHtml += ' border-width: 0px; border-style: none;';
  10785. qrHtml += ' border-collapse: collapse;';
  10786. qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
  10787. qrHtml += '">';
  10788. qrHtml += '<tbody>';
  10789. for (var r = 0; r < _this.getModuleCount(); r += 1) {
  10790. qrHtml += '<tr>';
  10791. for (var c = 0; c < _this.getModuleCount(); c += 1) {
  10792. qrHtml += '<td style="';
  10793. qrHtml += ' border-width: 0px; border-style: none;';
  10794. qrHtml += ' border-collapse: collapse;';
  10795. qrHtml += ' padding: 0px; margin: 0px;';
  10796. qrHtml += ' width: ' + cellSize + 'px;';
  10797. qrHtml += ' height: ' + cellSize + 'px;';
  10798. qrHtml += ' background-color: ';
  10799. qrHtml += _this.isDark(r, c) ? '#000000' : '#ffffff';
  10800. qrHtml += ';';
  10801. qrHtml += '"/>';
  10802. }
  10803. qrHtml += '</tr>';
  10804. }
  10805. qrHtml += '</tbody>';
  10806. qrHtml += '</table>';
  10807. return qrHtml;
  10808. };
  10809. _this.createImgTag = function (cellSize, margin, size) {
  10810. cellSize = cellSize || 2;
  10811. margin = typeof margin == 'undefined' ? cellSize * 4 : margin;
  10812. var min = margin;
  10813. var max = _this.getModuleCount() * cellSize + margin;
  10814. return createImgTag(size, size, function (x, y) {
  10815. if (min <= x && x < max && min <= y && y < max) {
  10816. var c = Math.floor((x - min) / cellSize);
  10817. var r = Math.floor((y - min) / cellSize);
  10818. return _this.isDark(r, c) ? 0 : 1;
  10819. } else {
  10820. return 1;
  10821. }
  10822. });
  10823. };
  10824. return _this;
  10825. };
  10826. //---------------------------------------------------------------------
  10827. // qrcode.stringToBytes
  10828. //---------------------------------------------------------------------
  10829. qrcode.stringToBytes = function (s) {
  10830. var bytes = new Array();
  10831. for (var i = 0; i < s.length; i += 1) {
  10832. var c = s.charCodeAt(i);
  10833. bytes.push(c & 0xff);
  10834. }
  10835. return bytes;
  10836. };
  10837. //---------------------------------------------------------------------
  10838. // qrcode.createStringToBytes
  10839. //---------------------------------------------------------------------
  10840. /**
  10841. * @param unicodeData base64 string of byte array.
  10842. * [16bit Unicode],[16bit Bytes], ...
  10843. * @param numChars
  10844. */
  10845. qrcode.createStringToBytes = function (unicodeData, numChars) {
  10846. // create conversion map.
  10847. var unicodeMap = function () {
  10848. var bin = base64DecodeInputStream(unicodeData);
  10849. var read = function read() {
  10850. var b = bin.read();
  10851. if (b == -1) throw new Error();
  10852. return b;
  10853. };
  10854. var count = 0;
  10855. var unicodeMap = {};
  10856. while (true) {
  10857. var b0 = bin.read();
  10858. if (b0 == -1) break;
  10859. var b1 = read();
  10860. var b2 = read();
  10861. var b3 = read();
  10862. var k = String.fromCharCode(b0 << 8 | b1);
  10863. var v = b2 << 8 | b3;
  10864. unicodeMap[k] = v;
  10865. count += 1;
  10866. }
  10867. if (count != numChars) {
  10868. throw new Error(count + ' != ' + numChars);
  10869. }
  10870. return unicodeMap;
  10871. }();
  10872. var unknownChar = '?'.charCodeAt(0);
  10873. return function (s) {
  10874. var bytes = new Array();
  10875. for (var i = 0; i < s.length; i += 1) {
  10876. var c = s.charCodeAt(i);
  10877. if (c < 128) {
  10878. bytes.push(c);
  10879. } else {
  10880. var b = unicodeMap[s.charAt(i)];
  10881. if (typeof b == 'number') {
  10882. if ((b & 0xff) == b) {
  10883. // 1byte
  10884. bytes.push(b);
  10885. } else {
  10886. // 2bytes
  10887. bytes.push(b >>> 8);
  10888. bytes.push(b & 0xff);
  10889. }
  10890. } else {
  10891. bytes.push(unknownChar);
  10892. }
  10893. }
  10894. }
  10895. return bytes;
  10896. };
  10897. };
  10898. //---------------------------------------------------------------------
  10899. // QRMode
  10900. //---------------------------------------------------------------------
  10901. var QRMode = {
  10902. MODE_NUMBER: 1 << 0,
  10903. MODE_ALPHA_NUM: 1 << 1,
  10904. MODE_8BIT_BYTE: 1 << 2,
  10905. MODE_KANJI: 1 << 3
  10906. };
  10907. //---------------------------------------------------------------------
  10908. // QRErrorCorrectLevel
  10909. //---------------------------------------------------------------------
  10910. var QRErrorCorrectLevel = {
  10911. L: 1,
  10912. M: 0,
  10913. Q: 3,
  10914. H: 2
  10915. };
  10916. //---------------------------------------------------------------------
  10917. // QRMaskPattern
  10918. //---------------------------------------------------------------------
  10919. var QRMaskPattern = {
  10920. PATTERN000: 0,
  10921. PATTERN001: 1,
  10922. PATTERN010: 2,
  10923. PATTERN011: 3,
  10924. PATTERN100: 4,
  10925. PATTERN101: 5,
  10926. PATTERN110: 6,
  10927. PATTERN111: 7
  10928. };
  10929. //---------------------------------------------------------------------
  10930. // QRUtil
  10931. //---------------------------------------------------------------------
  10932. var QRUtil = function () {
  10933. var PATTERN_POSITION_TABLE = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]];
  10934. var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
  10935. var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
  10936. var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
  10937. var _this = {};
  10938. var getBCHDigit = function getBCHDigit(data) {
  10939. var digit = 0;
  10940. while (data != 0) {
  10941. digit += 1;
  10942. data >>>= 1;
  10943. }
  10944. return digit;
  10945. };
  10946. _this.getBCHTypeInfo = function (data) {
  10947. var d = data << 10;
  10948. while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
  10949. d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
  10950. }
  10951. return (data << 10 | d) ^ G15_MASK;
  10952. };
  10953. _this.getBCHTypeNumber = function (data) {
  10954. var d = data << 12;
  10955. while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
  10956. d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
  10957. }
  10958. return data << 12 | d;
  10959. };
  10960. _this.getPatternPosition = function (typeNumber) {
  10961. return PATTERN_POSITION_TABLE[typeNumber - 1];
  10962. };
  10963. _this.getMaskFunction = function (maskPattern) {
  10964. switch (maskPattern) {
  10965. case QRMaskPattern.PATTERN000:
  10966. return function (i, j) {
  10967. return (i + j) % 2 == 0;
  10968. };
  10969. case QRMaskPattern.PATTERN001:
  10970. return function (i, j) {
  10971. return i % 2 == 0;
  10972. };
  10973. case QRMaskPattern.PATTERN010:
  10974. return function (i, j) {
  10975. return j % 3 == 0;
  10976. };
  10977. case QRMaskPattern.PATTERN011:
  10978. return function (i, j) {
  10979. return (i + j) % 3 == 0;
  10980. };
  10981. case QRMaskPattern.PATTERN100:
  10982. return function (i, j) {
  10983. return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
  10984. };
  10985. case QRMaskPattern.PATTERN101:
  10986. return function (i, j) {
  10987. return i * j % 2 + i * j % 3 == 0;
  10988. };
  10989. case QRMaskPattern.PATTERN110:
  10990. return function (i, j) {
  10991. return (i * j % 2 + i * j % 3) % 2 == 0;
  10992. };
  10993. case QRMaskPattern.PATTERN111:
  10994. return function (i, j) {
  10995. return (i * j % 3 + (i + j) % 2) % 2 == 0;
  10996. };
  10997. default:
  10998. throw new Error('bad maskPattern:' + maskPattern);
  10999. }
  11000. };
  11001. _this.getErrorCorrectPolynomial = function (errorCorrectLength) {
  11002. var a = qrPolynomial([1], 0);
  11003. for (var i = 0; i < errorCorrectLength; i += 1) {
  11004. a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
  11005. }
  11006. return a;
  11007. };
  11008. _this.getLengthInBits = function (mode, type) {
  11009. if (1 <= type && type < 10) {
  11010. // 1 - 9
  11011. switch (mode) {
  11012. case QRMode.MODE_NUMBER:
  11013. return 10;
  11014. case QRMode.MODE_ALPHA_NUM:
  11015. return 9;
  11016. case QRMode.MODE_8BIT_BYTE:
  11017. return 8;
  11018. case QRMode.MODE_KANJI:
  11019. return 8;
  11020. default:
  11021. throw new Error('mode:' + mode);
  11022. }
  11023. } else if (type < 27) {
  11024. // 10 - 26
  11025. switch (mode) {
  11026. case QRMode.MODE_NUMBER:
  11027. return 12;
  11028. case QRMode.MODE_ALPHA_NUM:
  11029. return 11;
  11030. case QRMode.MODE_8BIT_BYTE:
  11031. return 16;
  11032. case QRMode.MODE_KANJI:
  11033. return 10;
  11034. default:
  11035. throw new Error('mode:' + mode);
  11036. }
  11037. } else if (type < 41) {
  11038. // 27 - 40
  11039. switch (mode) {
  11040. case QRMode.MODE_NUMBER:
  11041. return 14;
  11042. case QRMode.MODE_ALPHA_NUM:
  11043. return 13;
  11044. case QRMode.MODE_8BIT_BYTE:
  11045. return 16;
  11046. case QRMode.MODE_KANJI:
  11047. return 12;
  11048. default:
  11049. throw new Error('mode:' + mode);
  11050. }
  11051. } else {
  11052. throw new Error('type:' + type);
  11053. }
  11054. };
  11055. _this.getLostPoint = function (qrcode) {
  11056. var moduleCount = qrcode.getModuleCount();
  11057. var lostPoint = 0;
  11058. // LEVEL1
  11059. for (var row = 0; row < moduleCount; row += 1) {
  11060. for (var col = 0; col < moduleCount; col += 1) {
  11061. var sameCount = 0;
  11062. var dark = qrcode.isDark(row, col);
  11063. for (var r = -1; r <= 1; r += 1) {
  11064. if (row + r < 0 || moduleCount <= row + r) {
  11065. continue;
  11066. }
  11067. for (var c = -1; c <= 1; c += 1) {
  11068. if (col + c < 0 || moduleCount <= col + c) {
  11069. continue;
  11070. }
  11071. if (r == 0 && c == 0) {
  11072. continue;
  11073. }
  11074. if (dark == qrcode.isDark(row + r, col + c)) {
  11075. sameCount += 1;
  11076. }
  11077. }
  11078. }
  11079. if (sameCount > 5) {
  11080. lostPoint += 3 + sameCount - 5;
  11081. }
  11082. }
  11083. }
  11084. ;
  11085. // LEVEL2
  11086. for (var row = 0; row < moduleCount - 1; row += 1) {
  11087. for (var col = 0; col < moduleCount - 1; col += 1) {
  11088. var count = 0;
  11089. if (qrcode.isDark(row, col)) count += 1;
  11090. if (qrcode.isDark(row + 1, col)) count += 1;
  11091. if (qrcode.isDark(row, col + 1)) count += 1;
  11092. if (qrcode.isDark(row + 1, col + 1)) count += 1;
  11093. if (count == 0 || count == 4) {
  11094. lostPoint += 3;
  11095. }
  11096. }
  11097. }
  11098. // LEVEL3
  11099. for (var row = 0; row < moduleCount; row += 1) {
  11100. for (var col = 0; col < moduleCount - 6; col += 1) {
  11101. if (qrcode.isDark(row, col) && !qrcode.isDark(row, col + 1) && qrcode.isDark(row, col + 2) && qrcode.isDark(row, col + 3) && qrcode.isDark(row, col + 4) && !qrcode.isDark(row, col + 5) && qrcode.isDark(row, col + 6)) {
  11102. lostPoint += 40;
  11103. }
  11104. }
  11105. }
  11106. for (var col = 0; col < moduleCount; col += 1) {
  11107. for (var row = 0; row < moduleCount - 6; row += 1) {
  11108. if (qrcode.isDark(row, col) && !qrcode.isDark(row + 1, col) && qrcode.isDark(row + 2, col) && qrcode.isDark(row + 3, col) && qrcode.isDark(row + 4, col) && !qrcode.isDark(row + 5, col) && qrcode.isDark(row + 6, col)) {
  11109. lostPoint += 40;
  11110. }
  11111. }
  11112. }
  11113. // LEVEL4
  11114. var darkCount = 0;
  11115. for (var col = 0; col < moduleCount; col += 1) {
  11116. for (var row = 0; row < moduleCount; row += 1) {
  11117. if (qrcode.isDark(row, col)) {
  11118. darkCount += 1;
  11119. }
  11120. }
  11121. }
  11122. var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
  11123. lostPoint += ratio * 10;
  11124. return lostPoint;
  11125. };
  11126. return _this;
  11127. }();
  11128. //---------------------------------------------------------------------
  11129. // QRMath
  11130. //---------------------------------------------------------------------
  11131. var QRMath = function () {
  11132. var EXP_TABLE = new Array(256);
  11133. var LOG_TABLE = new Array(256);
  11134. // initialize tables
  11135. for (var i = 0; i < 8; i += 1) {
  11136. EXP_TABLE[i] = 1 << i;
  11137. }
  11138. for (var i = 8; i < 256; i += 1) {
  11139. EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
  11140. }
  11141. for (var i = 0; i < 255; i += 1) {
  11142. LOG_TABLE[EXP_TABLE[i]] = i;
  11143. }
  11144. var _this = {};
  11145. _this.glog = function (n) {
  11146. if (n < 1) {
  11147. throw new Error('glog(' + n + ')');
  11148. }
  11149. return LOG_TABLE[n];
  11150. };
  11151. _this.gexp = function (n) {
  11152. while (n < 0) {
  11153. n += 255;
  11154. }
  11155. while (n >= 256) {
  11156. n -= 255;
  11157. }
  11158. return EXP_TABLE[n];
  11159. };
  11160. return _this;
  11161. }();
  11162. //---------------------------------------------------------------------
  11163. // qrPolynomial
  11164. //---------------------------------------------------------------------
  11165. function qrPolynomial(num, shift) {
  11166. if (typeof num.length == 'undefined') {
  11167. throw new Error(num.length + '/' + shift);
  11168. }
  11169. var _num = function () {
  11170. var offset = 0;
  11171. while (offset < num.length && num[offset] == 0) {
  11172. offset += 1;
  11173. }
  11174. var _num = new Array(num.length - offset + shift);
  11175. for (var i = 0; i < num.length - offset; i += 1) {
  11176. _num[i] = num[i + offset];
  11177. }
  11178. return _num;
  11179. }();
  11180. var _this = {};
  11181. _this.getAt = function (index) {
  11182. return _num[index];
  11183. };
  11184. _this.getLength = function () {
  11185. return _num.length;
  11186. };
  11187. _this.multiply = function (e) {
  11188. var num = new Array(_this.getLength() + e.getLength() - 1);
  11189. for (var i = 0; i < _this.getLength(); i += 1) {
  11190. for (var j = 0; j < e.getLength(); j += 1) {
  11191. num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
  11192. }
  11193. }
  11194. return qrPolynomial(num, 0);
  11195. };
  11196. _this.mod = function (e) {
  11197. if (_this.getLength() - e.getLength() < 0) {
  11198. return _this;
  11199. }
  11200. var ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
  11201. var num = new Array(_this.getLength());
  11202. for (var i = 0; i < _this.getLength(); i += 1) {
  11203. num[i] = _this.getAt(i);
  11204. }
  11205. for (var i = 0; i < e.getLength(); i += 1) {
  11206. num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
  11207. }
  11208. // recursive call
  11209. return qrPolynomial(num, 0).mod(e);
  11210. };
  11211. return _this;
  11212. }
  11213. ;
  11214. //---------------------------------------------------------------------
  11215. // QRRSBlock
  11216. //---------------------------------------------------------------------
  11217. var QRRSBlock = function () {
  11218. // [1: [L, M, Q, H], ..]
  11219. var RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]];
  11220. var qrRSBlock = function qrRSBlock(totalCount, dataCount) {
  11221. var _this = {};
  11222. _this.totalCount = totalCount;
  11223. _this.dataCount = dataCount;
  11224. return _this;
  11225. };
  11226. var _this = {};
  11227. var getRsBlockTable = function getRsBlockTable(typeNumber, errorCorrectLevel) {
  11228. switch (errorCorrectLevel) {
  11229. case QRErrorCorrectLevel.L:
  11230. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
  11231. case QRErrorCorrectLevel.M:
  11232. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
  11233. case QRErrorCorrectLevel.Q:
  11234. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
  11235. case QRErrorCorrectLevel.H:
  11236. return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
  11237. default:
  11238. return undefined;
  11239. }
  11240. };
  11241. _this.getRSBlocks = function (typeNumber, errorCorrectLevel) {
  11242. var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel);
  11243. if (typeof rsBlock == 'undefined') {
  11244. throw new Error('bad rs block @ typeNumber:' + typeNumber + '/errorCorrectLevel:' + errorCorrectLevel);
  11245. }
  11246. var length = rsBlock.length / 3;
  11247. var list = new Array();
  11248. for (var i = 0; i < length; i += 1) {
  11249. var count = rsBlock[i * 3 + 0];
  11250. var totalCount = rsBlock[i * 3 + 1];
  11251. var dataCount = rsBlock[i * 3 + 2];
  11252. for (var j = 0; j < count; j += 1) {
  11253. list.push(qrRSBlock(totalCount, dataCount));
  11254. }
  11255. }
  11256. return list;
  11257. };
  11258. return _this;
  11259. }();
  11260. //---------------------------------------------------------------------
  11261. // qrBitBuffer
  11262. //---------------------------------------------------------------------
  11263. var qrBitBuffer = function qrBitBuffer() {
  11264. var _buffer = new Array();
  11265. var _length = 0;
  11266. var _this = {};
  11267. _this.getBuffer = function () {
  11268. return _buffer;
  11269. };
  11270. _this.getAt = function (index) {
  11271. var bufIndex = Math.floor(index / 8);
  11272. return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
  11273. };
  11274. _this.put = function (num, length) {
  11275. for (var i = 0; i < length; i += 1) {
  11276. _this.putBit((num >>> length - i - 1 & 1) == 1);
  11277. }
  11278. };
  11279. _this.getLengthInBits = function () {
  11280. return _length;
  11281. };
  11282. _this.putBit = function (bit) {
  11283. var bufIndex = Math.floor(_length / 8);
  11284. if (_buffer.length <= bufIndex) {
  11285. _buffer.push(0);
  11286. }
  11287. if (bit) {
  11288. _buffer[bufIndex] |= 0x80 >>> _length % 8;
  11289. }
  11290. _length += 1;
  11291. };
  11292. return _this;
  11293. };
  11294. //---------------------------------------------------------------------
  11295. // qr8BitByte
  11296. //---------------------------------------------------------------------
  11297. var qr8BitByte = function qr8BitByte(data) {
  11298. var _mode = QRMode.MODE_8BIT_BYTE;
  11299. var _data = data;
  11300. var _parsedData = [];
  11301. var _this = {};
  11302. // Added to support UTF-8 Characters
  11303. for (var i = 0, l = _data.length; i < l; i++) {
  11304. var byteArray = [];
  11305. var code = _data.charCodeAt(i);
  11306. if (code > 0x10000) {
  11307. byteArray[0] = 0xF0 | (code & 0x1C0000) >>> 18;
  11308. byteArray[1] = 0x80 | (code & 0x3F000) >>> 12;
  11309. byteArray[2] = 0x80 | (code & 0xFC0) >>> 6;
  11310. byteArray[3] = 0x80 | code & 0x3F;
  11311. } else if (code > 0x800) {
  11312. byteArray[0] = 0xE0 | (code & 0xF000) >>> 12;
  11313. byteArray[1] = 0x80 | (code & 0xFC0) >>> 6;
  11314. byteArray[2] = 0x80 | code & 0x3F;
  11315. } else if (code > 0x80) {
  11316. byteArray[0] = 0xC0 | (code & 0x7C0) >>> 6;
  11317. byteArray[1] = 0x80 | code & 0x3F;
  11318. } else {
  11319. byteArray[0] = code;
  11320. }
  11321. // Fix Unicode corruption bug
  11322. _parsedData.push(byteArray);
  11323. }
  11324. _parsedData = Array.prototype.concat.apply([], _parsedData);
  11325. if (_parsedData.length != _data.length) {
  11326. _parsedData.unshift(191);
  11327. _parsedData.unshift(187);
  11328. _parsedData.unshift(239);
  11329. }
  11330. var _bytes = _parsedData;
  11331. _this.getMode = function () {
  11332. return _mode;
  11333. };
  11334. _this.getLength = function (buffer) {
  11335. return _bytes.length;
  11336. };
  11337. _this.write = function (buffer) {
  11338. for (var i = 0; i < _bytes.length; i += 1) {
  11339. buffer.put(_bytes[i], 8);
  11340. }
  11341. };
  11342. return _this;
  11343. };
  11344. //=====================================================================
  11345. // GIF Support etc.
  11346. //
  11347. //---------------------------------------------------------------------
  11348. // byteArrayOutputStream
  11349. //---------------------------------------------------------------------
  11350. var byteArrayOutputStream = function byteArrayOutputStream() {
  11351. var _bytes = new Array();
  11352. var _this = {};
  11353. _this.writeByte = function (b) {
  11354. _bytes.push(b & 0xff);
  11355. };
  11356. _this.writeShort = function (i) {
  11357. _this.writeByte(i);
  11358. _this.writeByte(i >>> 8);
  11359. };
  11360. _this.writeBytes = function (b, off, len) {
  11361. off = off || 0;
  11362. len = len || b.length;
  11363. for (var i = 0; i < len; i += 1) {
  11364. _this.writeByte(b[i + off]);
  11365. }
  11366. };
  11367. _this.writeString = function (s) {
  11368. for (var i = 0; i < s.length; i += 1) {
  11369. _this.writeByte(s.charCodeAt(i));
  11370. }
  11371. };
  11372. _this.toByteArray = function () {
  11373. return _bytes;
  11374. };
  11375. _this.toString = function () {
  11376. var s = '';
  11377. s += '[';
  11378. for (var i = 0; i < _bytes.length; i += 1) {
  11379. if (i > 0) {
  11380. s += ',';
  11381. }
  11382. s += _bytes[i];
  11383. }
  11384. s += ']';
  11385. return s;
  11386. };
  11387. return _this;
  11388. };
  11389. //---------------------------------------------------------------------
  11390. // base64EncodeOutputStream
  11391. //---------------------------------------------------------------------
  11392. var base64EncodeOutputStream = function base64EncodeOutputStream() {
  11393. var _buffer = 0;
  11394. var _buflen = 0;
  11395. var _length = 0;
  11396. var _base64 = '';
  11397. var _this = {};
  11398. var writeEncoded = function writeEncoded(b) {
  11399. _base64 += String.fromCharCode(encode(b & 0x3f));
  11400. };
  11401. var encode = function encode(n) {
  11402. if (n < 0) {
  11403. // error.
  11404. } else if (n < 26) {
  11405. return 0x41 + n;
  11406. } else if (n < 52) {
  11407. return 0x61 + (n - 26);
  11408. } else if (n < 62) {
  11409. return 0x30 + (n - 52);
  11410. } else if (n == 62) {
  11411. return 0x2b;
  11412. } else if (n == 63) {
  11413. return 0x2f;
  11414. }
  11415. throw new Error('n:' + n);
  11416. };
  11417. _this.writeByte = function (n) {
  11418. _buffer = _buffer << 8 | n & 0xff;
  11419. _buflen += 8;
  11420. _length += 1;
  11421. while (_buflen >= 6) {
  11422. writeEncoded(_buffer >>> _buflen - 6);
  11423. _buflen -= 6;
  11424. }
  11425. };
  11426. _this.flush = function () {
  11427. if (_buflen > 0) {
  11428. writeEncoded(_buffer << 6 - _buflen);
  11429. _buffer = 0;
  11430. _buflen = 0;
  11431. }
  11432. if (_length % 3 != 0) {
  11433. // padding
  11434. var padlen = 3 - _length % 3;
  11435. for (var i = 0; i < padlen; i += 1) {
  11436. _base64 += '=';
  11437. }
  11438. }
  11439. };
  11440. _this.toString = function () {
  11441. return _base64;
  11442. };
  11443. return _this;
  11444. };
  11445. //---------------------------------------------------------------------
  11446. // base64DecodeInputStream
  11447. //---------------------------------------------------------------------
  11448. var base64DecodeInputStream = function base64DecodeInputStream(str) {
  11449. var _str = str;
  11450. var _pos = 0;
  11451. var _buffer = 0;
  11452. var _buflen = 0;
  11453. var _this = {};
  11454. _this.read = function () {
  11455. while (_buflen < 8) {
  11456. if (_pos >= _str.length) {
  11457. if (_buflen == 0) {
  11458. return -1;
  11459. }
  11460. throw new Error('unexpected end of file./' + _buflen);
  11461. }
  11462. var c = _str.charAt(_pos);
  11463. _pos += 1;
  11464. if (c == '=') {
  11465. _buflen = 0;
  11466. return -1;
  11467. } else if (c.match(/^\s$/)) {
  11468. // ignore if whitespace.
  11469. continue;
  11470. }
  11471. _buffer = _buffer << 6 | decode(c.charCodeAt(0));
  11472. _buflen += 6;
  11473. }
  11474. var n = _buffer >>> _buflen - 8 & 0xff;
  11475. _buflen -= 8;
  11476. return n;
  11477. };
  11478. var decode = function decode(c) {
  11479. if (0x41 <= c && c <= 0x5a) {
  11480. return c - 0x41;
  11481. } else if (0x61 <= c && c <= 0x7a) {
  11482. return c - 0x61 + 26;
  11483. } else if (0x30 <= c && c <= 0x39) {
  11484. return c - 0x30 + 52;
  11485. } else if (c == 0x2b) {
  11486. return 62;
  11487. } else if (c == 0x2f) {
  11488. return 63;
  11489. } else {
  11490. throw new Error('c:' + c);
  11491. }
  11492. };
  11493. return _this;
  11494. };
  11495. //---------------------------------------------------------------------
  11496. // gifImage (B/W)
  11497. //---------------------------------------------------------------------
  11498. var gifImage = function gifImage(width, height) {
  11499. var _width = width;
  11500. var _height = height;
  11501. var _data = new Array(width * height);
  11502. var _this = {};
  11503. _this.setPixel = function (x, y, pixel) {
  11504. _data[y * _width + x] = pixel;
  11505. };
  11506. _this.write = function (out) {
  11507. //---------------------------------
  11508. // GIF Signature
  11509. out.writeString('GIF87a');
  11510. //---------------------------------
  11511. // Screen Descriptor
  11512. out.writeShort(_width);
  11513. out.writeShort(_height);
  11514. out.writeByte(0x80); // 2bit
  11515. out.writeByte(0);
  11516. out.writeByte(0);
  11517. //---------------------------------
  11518. // Global Color Map
  11519. // black
  11520. out.writeByte(0x00);
  11521. out.writeByte(0x00);
  11522. out.writeByte(0x00);
  11523. // white
  11524. out.writeByte(0xff);
  11525. out.writeByte(0xff);
  11526. out.writeByte(0xff);
  11527. //---------------------------------
  11528. // Image Descriptor
  11529. out.writeString(',');
  11530. out.writeShort(0);
  11531. out.writeShort(0);
  11532. out.writeShort(_width);
  11533. out.writeShort(_height);
  11534. out.writeByte(0);
  11535. //---------------------------------
  11536. // Local Color Map
  11537. //---------------------------------
  11538. // Raster Data
  11539. var lzwMinCodeSize = 2;
  11540. var raster = getLZWRaster(lzwMinCodeSize);
  11541. out.writeByte(lzwMinCodeSize);
  11542. var offset = 0;
  11543. while (raster.length - offset > 255) {
  11544. out.writeByte(255);
  11545. out.writeBytes(raster, offset, 255);
  11546. offset += 255;
  11547. }
  11548. out.writeByte(raster.length - offset);
  11549. out.writeBytes(raster, offset, raster.length - offset);
  11550. out.writeByte(0x00);
  11551. //---------------------------------
  11552. // GIF Terminator
  11553. out.writeString(';');
  11554. };
  11555. var bitOutputStream = function bitOutputStream(out) {
  11556. var _out = out;
  11557. var _bitLength = 0;
  11558. var _bitBuffer = 0;
  11559. var _this = {};
  11560. _this.write = function (data, length) {
  11561. if (data >>> length != 0) {
  11562. throw new Error('length over');
  11563. }
  11564. while (_bitLength + length >= 8) {
  11565. _out.writeByte(0xff & (data << _bitLength | _bitBuffer));
  11566. length -= 8 - _bitLength;
  11567. data >>>= 8 - _bitLength;
  11568. _bitBuffer = 0;
  11569. _bitLength = 0;
  11570. }
  11571. _bitBuffer = data << _bitLength | _bitBuffer;
  11572. _bitLength = _bitLength + length;
  11573. };
  11574. _this.flush = function () {
  11575. if (_bitLength > 0) {
  11576. _out.writeByte(_bitBuffer);
  11577. }
  11578. };
  11579. return _this;
  11580. };
  11581. var getLZWRaster = function getLZWRaster(lzwMinCodeSize) {
  11582. var clearCode = 1 << lzwMinCodeSize;
  11583. var endCode = (1 << lzwMinCodeSize) + 1;
  11584. var bitLength = lzwMinCodeSize + 1;
  11585. // Setup LZWTable
  11586. var table = lzwTable();
  11587. for (var i = 0; i < clearCode; i += 1) {
  11588. table.add(String.fromCharCode(i));
  11589. }
  11590. table.add(String.fromCharCode(clearCode));
  11591. table.add(String.fromCharCode(endCode));
  11592. var byteOut = byteArrayOutputStream();
  11593. var bitOut = bitOutputStream(byteOut);
  11594. // clear code
  11595. bitOut.write(clearCode, bitLength);
  11596. var dataIndex = 0;
  11597. var s = String.fromCharCode(_data[dataIndex]);
  11598. dataIndex += 1;
  11599. while (dataIndex < _data.length) {
  11600. var c = String.fromCharCode(_data[dataIndex]);
  11601. dataIndex += 1;
  11602. if (table.contains(s + c)) {
  11603. s = s + c;
  11604. } else {
  11605. bitOut.write(table.indexOf(s), bitLength);
  11606. if (table.size() < 0xfff) {
  11607. if (table.size() == 1 << bitLength) {
  11608. bitLength += 1;
  11609. }
  11610. table.add(s + c);
  11611. }
  11612. s = c;
  11613. }
  11614. }
  11615. bitOut.write(table.indexOf(s), bitLength);
  11616. // end code
  11617. bitOut.write(endCode, bitLength);
  11618. bitOut.flush();
  11619. return byteOut.toByteArray();
  11620. };
  11621. var lzwTable = function lzwTable() {
  11622. var _map = {};
  11623. var _size = 0;
  11624. var _this = {};
  11625. _this.add = function (key) {
  11626. if (_this.contains(key)) {
  11627. throw new Error('dup key:' + key);
  11628. }
  11629. _map[key] = _size;
  11630. _size += 1;
  11631. };
  11632. _this.size = function () {
  11633. return _size;
  11634. };
  11635. _this.indexOf = function (key) {
  11636. return _map[key];
  11637. };
  11638. _this.contains = function (key) {
  11639. return typeof _map[key] != 'undefined';
  11640. };
  11641. return _this;
  11642. };
  11643. return _this;
  11644. };
  11645. var createImgTag = function createImgTag(width, height, getPixel, alt) {
  11646. var gif = gifImage(width, height);
  11647. for (var y = 0; y < height; y += 1) {
  11648. for (var x = 0; x < width; x += 1) {
  11649. gif.setPixel(x, y, getPixel(x, y));
  11650. }
  11651. }
  11652. var b = byteArrayOutputStream();
  11653. gif.write(b);
  11654. var base64 = base64EncodeOutputStream();
  11655. var bytes = b.toByteArray();
  11656. for (var i = 0; i < bytes.length; i += 1) {
  11657. base64.writeByte(bytes[i]);
  11658. }
  11659. base64.flush();
  11660. var img = '';
  11661. img += 'data:image/gif;base64,';
  11662. img += base64;
  11663. return img;
  11664. };
  11665. //---------------------------------------------------------------------
  11666. // returns qrcode function.
  11667. var createQrCodeImg = function createQrCodeImg(text, options) {
  11668. options = options || {};
  11669. var typeNumber = options.typeNumber || 4;
  11670. var errorCorrectLevel = options.errorCorrectLevel || 'M';
  11671. var size = options.size || 500;
  11672. var qr;
  11673. try {
  11674. qr = qrcode(typeNumber, errorCorrectLevel || 'M');
  11675. qr.addData(text);
  11676. qr.make();
  11677. } catch (e) {
  11678. if (typeNumber >= 40) {
  11679. throw new Error('Text too long to encode');
  11680. } else {
  11681. return createQrCodeImg(text, {
  11682. size: size,
  11683. errorCorrectLevel: errorCorrectLevel,
  11684. typeNumber: typeNumber + 1
  11685. });
  11686. }
  11687. }
  11688. // calc cellsize and margin
  11689. var cellsize = parseInt(size / qr.getModuleCount());
  11690. var margin = parseInt((size - qr.getModuleCount() * cellsize) / 2);
  11691. return qr.createImgTag(cellsize, margin, size);
  11692. };
  11693. module.exports = {
  11694. create: createQrCodeImg
  11695. };
  11696. /***/ }),
  11697. /* 43 */,
  11698. /* 44 */,
  11699. /* 45 */,
  11700. /* 46 */,
  11701. /* 47 */,
  11702. /* 48 */,
  11703. /* 49 */
  11704. /*!***********************************************************************!*\
  11705. !*** E:/zswl/code/charge_miniapp/charge_miniapp/static/js/bmap-wx.js ***!
  11706. \***********************************************************************/
  11707. /*! no static exports found */
  11708. /***/ (function(module, exports, __webpack_require__) {
  11709. /* WEBPACK VAR INJECTION */(function(wx) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23);
  11710. var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ 24);
  11711. /**
  11712. * @file 微信小程序JSAPI
  11713. * @author 崔健 cuijian03@baidu.com 2017.01.10
  11714. * @update 邓淑芳 623996689@qq.com 2019.07.03
  11715. */
  11716. /**
  11717. * 百度地图微信小程序API类
  11718. *
  11719. * @class
  11720. */
  11721. var BMapWX = /*#__PURE__*/function () {
  11722. "use strict";
  11723. /**
  11724. * 百度地图微信小程序API类
  11725. *
  11726. * @constructor
  11727. */
  11728. function BMapWX(param) {
  11729. _classCallCheck(this, BMapWX);
  11730. this.ak = param["ak"];
  11731. }
  11732. /**
  11733. * 使用微信接口进行定位
  11734. *
  11735. * @param {string} type 坐标类型
  11736. * @param {Function} success 成功执行
  11737. * @param {Function} fail 失败执行
  11738. * @param {Function} complete 完成后执行
  11739. */
  11740. _createClass(BMapWX, [{
  11741. key: "getWXLocation",
  11742. value: function getWXLocation(type, success, fail, complete) {
  11743. type = type || 'gcj02', success = success || function () {};
  11744. fail = fail || function () {};
  11745. complete = complete || function () {};
  11746. wx.getLocation({
  11747. type: type,
  11748. success: success,
  11749. fail: fail,
  11750. complete: complete
  11751. });
  11752. }
  11753. /**
  11754. * POI周边检索
  11755. *
  11756. * @param {Object} param 检索配置
  11757. * 参数对象结构可以参考
  11758. * http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi
  11759. */
  11760. }, {
  11761. key: "search",
  11762. value: function search(param) {
  11763. var that = this;
  11764. param = param || {};
  11765. var searchparam = {
  11766. query: param["query"] || '生活服务$美食&酒店',
  11767. scope: param["scope"] || 1,
  11768. filter: param["filter"] || '',
  11769. coord_type: param["coord_type"] || 2,
  11770. page_size: param["page_size"] || 10,
  11771. page_num: param["page_num"] || 0,
  11772. output: param["output"] || 'json',
  11773. ak: that.ak,
  11774. sn: param["sn"] || '',
  11775. timestamp: param["timestamp"] || '',
  11776. radius: param["radius"] || 2000,
  11777. ret_coordtype: 'gcj02ll'
  11778. };
  11779. var otherparam = {
  11780. iconPath: param["iconPath"],
  11781. iconTapPath: param["iconTapPath"],
  11782. width: param["width"],
  11783. height: param["height"],
  11784. alpha: param["alpha"] || 1,
  11785. success: param["success"] || function () {},
  11786. fail: param["fail"] || function () {}
  11787. };
  11788. var type = 'gcj02';
  11789. var locationsuccess = function locationsuccess(result) {
  11790. searchparam["location"] = result["latitude"] + ',' + result["longitude"];
  11791. wx.request({
  11792. url: 'https://api.map.baidu.com/place/v2/search',
  11793. data: searchparam,
  11794. header: {
  11795. "content-type": "application/json"
  11796. },
  11797. method: 'GET',
  11798. success: function success(data) {
  11799. var res = data["data"];
  11800. if (res["status"] === 0) {
  11801. var poiArr = res["results"];
  11802. // outputRes 包含两个对象,
  11803. // originalData为百度接口返回的原始数据
  11804. // wxMarkerData为小程序规范的marker格式
  11805. var outputRes = {};
  11806. outputRes["originalData"] = res;
  11807. outputRes["wxMarkerData"] = [];
  11808. for (var i = 0; i < poiArr.length; i++) {
  11809. outputRes["wxMarkerData"][i] = {
  11810. id: i,
  11811. latitude: poiArr[i]["location"]["lat"],
  11812. longitude: poiArr[i]["location"]["lng"],
  11813. title: poiArr[i]["name"],
  11814. iconPath: otherparam["iconPath"],
  11815. iconTapPath: otherparam["iconTapPath"],
  11816. address: poiArr[i]["address"],
  11817. telephone: poiArr[i]["telephone"],
  11818. alpha: otherparam["alpha"],
  11819. width: otherparam["width"],
  11820. height: otherparam["height"]
  11821. };
  11822. }
  11823. otherparam.success(outputRes);
  11824. } else {
  11825. otherparam.fail({
  11826. errMsg: res["message"],
  11827. statusCode: res["status"]
  11828. });
  11829. }
  11830. },
  11831. fail: function fail(data) {
  11832. otherparam.fail(data);
  11833. }
  11834. });
  11835. };
  11836. var locationfail = function locationfail(result) {
  11837. otherparam.fail(result);
  11838. };
  11839. var locationcomplete = function locationcomplete(result) {};
  11840. if (!param["location"]) {
  11841. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  11842. } else {
  11843. var longitude = param.location.split(',')[1];
  11844. var latitude = param.location.split(',')[0];
  11845. var errMsg = 'input location';
  11846. var res = {
  11847. errMsg: errMsg,
  11848. latitude: latitude,
  11849. longitude: longitude
  11850. };
  11851. locationsuccess(res);
  11852. }
  11853. }
  11854. /**
  11855. * sug模糊检索
  11856. *
  11857. * @param {Object} param 检索配置
  11858. * 参数对象结构可以参考
  11859. * http://lbsyun.baidu.com/index.php?title=webapi/place-suggestion-api
  11860. */
  11861. }, {
  11862. key: "suggestion",
  11863. value: function suggestion(param) {
  11864. var that = this;
  11865. param = param || {};
  11866. var suggestionparam = {
  11867. query: param["query"] || '',
  11868. region: param["region"] || '全国',
  11869. city_limit: param["city_limit"] || false,
  11870. output: param["output"] || 'json',
  11871. ak: that.ak,
  11872. sn: param["sn"] || '',
  11873. timestamp: param["timestamp"] || '',
  11874. ret_coordtype: 'gcj02ll'
  11875. };
  11876. var otherparam = {
  11877. success: param["success"] || function () {},
  11878. fail: param["fail"] || function () {}
  11879. };
  11880. wx.request({
  11881. url: 'https://api.map.baidu.com/place/v2/suggestion',
  11882. data: suggestionparam,
  11883. header: {
  11884. "content-type": "application/json"
  11885. },
  11886. method: 'GET',
  11887. success: function success(data) {
  11888. var res = data["data"];
  11889. if (res["status"] === 0) {
  11890. otherparam.success(res);
  11891. } else {
  11892. otherparam.fail({
  11893. errMsg: res["message"],
  11894. statusCode: res["status"]
  11895. });
  11896. }
  11897. },
  11898. fail: function fail(data) {
  11899. otherparam.fail(data);
  11900. }
  11901. });
  11902. }
  11903. /**
  11904. * rgc检索(逆地理编码:经纬度->地点描述)
  11905. *
  11906. * @param {Object} param 检索配置
  11907. * 参数对象结构可以参考
  11908. * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding-abroad
  11909. *
  11910. */
  11911. }, {
  11912. key: "regeocoding",
  11913. value: function regeocoding(param) {
  11914. var that = this;
  11915. param = param || {};
  11916. var regeocodingparam = {
  11917. coordtype: param["coordtype"] || 'gcj02ll',
  11918. ret_coordtype: 'gcj02ll',
  11919. radius: param["radius"] || 1000,
  11920. ak: that.ak,
  11921. sn: param["sn"] || '',
  11922. output: param["output"] || 'json',
  11923. callback: param["callback"] || function () {},
  11924. extensions_poi: param["extensions_poi"] || 1,
  11925. extensions_road: param["extensions_road"] || false,
  11926. extensions_town: param["extensions_town"] || false,
  11927. language: param["language"] || 'zh-CN',
  11928. language_auto: param["language_auto"] || 0
  11929. };
  11930. var otherparam = {
  11931. iconPath: param["iconPath"],
  11932. iconTapPath: param["iconTapPath"],
  11933. width: param["width"],
  11934. height: param["height"],
  11935. alpha: param["alpha"] || 1,
  11936. success: param["success"] || function () {},
  11937. fail: param["fail"] || function () {}
  11938. };
  11939. var type = 'gcj02';
  11940. var locationsuccess = function locationsuccess(result) {
  11941. regeocodingparam["location"] = result["latitude"] + ',' + result["longitude"];
  11942. wx.request({
  11943. url: 'https://api.map.baidu.com/reverse_geocoding/v3',
  11944. data: regeocodingparam,
  11945. header: {
  11946. "content-type": "application/json"
  11947. },
  11948. method: 'GET',
  11949. success: function success(data) {
  11950. var res = data["data"];
  11951. if (res["status"] === 0) {
  11952. var poiObj = res["result"];
  11953. // outputRes 包含两个对象:
  11954. // originalData为百度接口返回的原始数据
  11955. // wxMarkerData为小程序规范的marker格式
  11956. var outputRes = {};
  11957. outputRes["originalData"] = res;
  11958. outputRes["wxMarkerData"] = [];
  11959. outputRes["wxMarkerData"][0] = {
  11960. id: 0,
  11961. latitude: result["latitude"],
  11962. longitude: result["longitude"],
  11963. address: poiObj["formatted_address"],
  11964. iconPath: otherparam["iconPath"],
  11965. iconTapPath: otherparam["iconTapPath"],
  11966. desc: poiObj["sematic_description"],
  11967. business: poiObj["business"],
  11968. alpha: otherparam["alpha"],
  11969. width: otherparam["width"],
  11970. height: otherparam["height"]
  11971. };
  11972. otherparam.success(outputRes);
  11973. } else {
  11974. otherparam.fail({
  11975. errMsg: res["message"],
  11976. statusCode: res["status"]
  11977. });
  11978. }
  11979. },
  11980. fail: function fail(data) {
  11981. otherparam.fail(data);
  11982. }
  11983. });
  11984. };
  11985. var locationfail = function locationfail(result) {
  11986. otherparam.fail(result);
  11987. };
  11988. var locationcomplete = function locationcomplete(result) {};
  11989. if (!param["location"]) {
  11990. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  11991. } else {
  11992. var longitude = param.location.split(',')[1];
  11993. var latitude = param.location.split(',')[0];
  11994. var errMsg = 'input location';
  11995. var res = {
  11996. errMsg: errMsg,
  11997. latitude: latitude,
  11998. longitude: longitude
  11999. };
  12000. locationsuccess(res);
  12001. }
  12002. }
  12003. /**
  12004. * gc检索(地理编码:地点->经纬度)
  12005. *
  12006. * @param {Object} param 检索配置
  12007. * 参数对象结构可以参考
  12008. * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding
  12009. *
  12010. */
  12011. }, {
  12012. key: "geocoding",
  12013. value: function geocoding(param) {
  12014. var that = this;
  12015. param = param || {};
  12016. var geocodingparam = {
  12017. address: param["address"] || '',
  12018. city: param["city"] || '',
  12019. ret_coordtype: param["coordtype"] || 'gcj02ll',
  12020. ak: that.ak,
  12021. sn: param["sn"] || '',
  12022. output: param["output"] || 'json',
  12023. callback: param["callback"] || function () {}
  12024. };
  12025. var otherparam = {
  12026. iconPath: param["iconPath"],
  12027. iconTapPath: param["iconTapPath"],
  12028. width: param["width"],
  12029. height: param["height"],
  12030. alpha: param["alpha"] || 1,
  12031. success: param["success"] || function () {},
  12032. fail: param["fail"] || function () {}
  12033. };
  12034. if (param["address"]) {
  12035. wx.request({
  12036. url: 'https://api.map.baidu.com/geocoding/v3',
  12037. data: geocodingparam,
  12038. header: {
  12039. "content-type": "application/json"
  12040. },
  12041. method: 'GET',
  12042. success: function success(data) {
  12043. var res = data["data"];
  12044. if (res["status"] === 0) {
  12045. var poiObj = res["result"];
  12046. // outputRes 包含两个对象:
  12047. // originalData为百度接口返回的原始数据
  12048. // wxMarkerData为小程序规范的marker格式
  12049. var outputRes = res;
  12050. outputRes["originalData"] = res;
  12051. outputRes["wxMarkerData"] = [];
  12052. outputRes["wxMarkerData"][0] = {
  12053. id: 0,
  12054. latitude: poiObj["location"]["lat"],
  12055. longitude: poiObj["location"]["lng"],
  12056. iconPath: otherparam["iconPath"],
  12057. iconTapPath: otherparam["iconTapPath"],
  12058. alpha: otherparam["alpha"],
  12059. width: otherparam["width"],
  12060. height: otherparam["height"]
  12061. };
  12062. otherparam.success(outputRes);
  12063. } else {
  12064. otherparam.fail({
  12065. errMsg: res["message"],
  12066. statusCode: res["status"]
  12067. });
  12068. }
  12069. },
  12070. fail: function fail(data) {
  12071. otherparam.fail(data);
  12072. }
  12073. });
  12074. } else {
  12075. var errMsg = 'input address!';
  12076. var res = {
  12077. errMsg: errMsg
  12078. };
  12079. otherparam.fail(res);
  12080. }
  12081. }
  12082. /**
  12083. * 天气检索
  12084. *
  12085. * @param {Object} param 检索配置
  12086. */
  12087. }, {
  12088. key: "weather",
  12089. value: function weather(param) {
  12090. var that = this;
  12091. param = param || {};
  12092. var weatherparam = {
  12093. coord_type: param["coord_type"] || 'gcj02',
  12094. output: param["output"] || 'json',
  12095. ak: that.ak,
  12096. sn: param["sn"] || '',
  12097. timestamp: param["timestamp"] || ''
  12098. };
  12099. var otherparam = {
  12100. success: param["success"] || function () {},
  12101. fail: param["fail"] || function () {}
  12102. };
  12103. var type = 'gcj02';
  12104. var locationsuccess = function locationsuccess(result) {
  12105. weatherparam["location"] = result["longitude"] + ',' + result["latitude"];
  12106. wx.request({
  12107. url: 'https://api.map.baidu.com/telematics/v3/weather',
  12108. data: weatherparam,
  12109. header: {
  12110. "content-type": "application/json"
  12111. },
  12112. method: 'GET',
  12113. success: function success(data) {
  12114. var res = data["data"];
  12115. if (res["error"] === 0 && res["status"] === 'success') {
  12116. var weatherArr = res["results"];
  12117. // outputRes 包含两个对象,
  12118. // originalData为百度接口返回的原始数据
  12119. // wxMarkerData为小程序规范的marker格式
  12120. var outputRes = {};
  12121. outputRes["originalData"] = res;
  12122. outputRes["currentWeather"] = [];
  12123. outputRes["currentWeather"][0] = {
  12124. currentCity: weatherArr[0]["currentCity"],
  12125. pm25: weatherArr[0]["pm25"],
  12126. date: weatherArr[0]["weather_data"][0]["date"],
  12127. temperature: weatherArr[0]["weather_data"][0]["temperature"],
  12128. weatherDesc: weatherArr[0]["weather_data"][0]["weather"],
  12129. wind: weatherArr[0]["weather_data"][0]["wind"]
  12130. };
  12131. otherparam.success(outputRes);
  12132. } else {
  12133. otherparam.fail({
  12134. errMsg: res["message"],
  12135. statusCode: res["status"]
  12136. });
  12137. }
  12138. },
  12139. fail: function fail(data) {
  12140. otherparam.fail(data);
  12141. }
  12142. });
  12143. };
  12144. var locationfail = function locationfail(result) {
  12145. otherparam.fail(result);
  12146. };
  12147. var locationcomplete = function locationcomplete(result) {};
  12148. if (!param["location"]) {
  12149. that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
  12150. } else {
  12151. var longitude = param.location.split(',')[0];
  12152. var latitude = param.location.split(',')[1];
  12153. var errMsg = 'input location';
  12154. var res = {
  12155. errMsg: errMsg,
  12156. latitude: latitude,
  12157. longitude: longitude
  12158. };
  12159. locationsuccess(res);
  12160. }
  12161. }
  12162. }]);
  12163. return BMapWX;
  12164. }();
  12165. module.exports.BMapWX = BMapWX;
  12166. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  12167. /***/ }),
  12168. /* 50 */,
  12169. /* 51 */,
  12170. /* 52 */,
  12171. /* 53 */,
  12172. /* 54 */,
  12173. /* 55 */,
  12174. /* 56 */,
  12175. /* 57 */,
  12176. /* 58 */,
  12177. /* 59 */,
  12178. /* 60 */,
  12179. /* 61 */,
  12180. /* 62 */,
  12181. /* 63 */,
  12182. /* 64 */,
  12183. /* 65 */,
  12184. /* 66 */,
  12185. /* 67 */,
  12186. /* 68 */,
  12187. /* 69 */,
  12188. /* 70 */,
  12189. /* 71 */
  12190. /*!**********************************************************************************!*\
  12191. !*** E:/zswl/code/charge_miniapp/charge_miniapp/components/r-canvas/r-canvas.js ***!
  12192. \**********************************************************************************/
  12193. /*! no static exports found */
  12194. /***/ (function(module, exports, __webpack_require__) {
  12195. "use strict";
  12196. /* WEBPACK VAR INJECTION */(function(uni, wx) {
  12197. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12198. Object.defineProperty(exports, "__esModule", {
  12199. value: true
  12200. });
  12201. exports.default = void 0;
  12202. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 31));
  12203. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  12204. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 33));
  12205. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  12206. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  12207. var _default = {
  12208. data: function data() {
  12209. return {
  12210. system_info: {},
  12211. //system info
  12212. canvas_width: 0,
  12213. //canvas width px
  12214. canvas_height: 0,
  12215. //canvas height px
  12216. ctx: null,
  12217. //canvas object
  12218. canvas_id: null,
  12219. //canvas id
  12220. hidden: true,
  12221. //Whether to hide canvas
  12222. scale: 1,
  12223. //canvas scale
  12224. r_canvas_scale: 1,
  12225. if_ctx: true
  12226. };
  12227. },
  12228. methods: {
  12229. /**
  12230. * save r-canvas.vue object
  12231. * @param {Object} that
  12232. */
  12233. // saveThis(that){
  12234. // rCanvasThis = that
  12235. // },
  12236. /**
  12237. * Draw round rect text
  12238. * @param {Object} config
  12239. * @param {Number} config.x x坐标
  12240. * @param {Number} config.y y坐标
  12241. * @param {Number} config.w 宽度
  12242. * @param {Number} config.h 高度
  12243. * @param {Number} config.radius 圆角弧度
  12244. * @param {String} config.fill_color 矩形颜色
  12245. */
  12246. fillRoundRect: function fillRoundRect(config) {
  12247. var _this = this;
  12248. return new Promise(function (resolve, reject) {
  12249. var x = _this.compatibilitySize(parseFloat(config.x) * _this.scale);
  12250. var y = _this.compatibilitySize(parseFloat(config.y) * _this.scale);
  12251. var w = _this.compatibilitySize(parseFloat(config.w) * _this.scale);
  12252. var h = _this.compatibilitySize(parseFloat(config.h) * _this.scale);
  12253. var radius = config.radius ? parseFloat(config.radius) * _this.scale : 10 * _this.scale;
  12254. var fill_color = config.fill_color || "black";
  12255. // The diameter of the circle must be less than the width and height of the rectangle
  12256. if (2 * radius > w || 2 * radius > h) {
  12257. reject("The diameter of the circle must be less than the width and height of the rectangle");
  12258. return false;
  12259. }
  12260. _this.ctx.save();
  12261. _this.ctx.translate(x, y);
  12262. //
  12263. _this.drawRoundRectPath({
  12264. w: w,
  12265. h: h,
  12266. radius: radius
  12267. });
  12268. _this.ctx.fillStyle = fill_color;
  12269. _this.ctx.fill();
  12270. _this.ctx.restore();
  12271. resolve();
  12272. });
  12273. },
  12274. /**
  12275. * Draws the sides of a rounded rectangle
  12276. * @param {Object} config
  12277. * @param {Number} config.w 宽度
  12278. * @param {Number} config.h 高度
  12279. * @param {Number} config.radius 圆角弧度
  12280. */
  12281. drawRoundRectPath: function drawRoundRectPath(config) {
  12282. this.ctx.beginPath(0);
  12283. this.ctx.arc(config.w - config.radius, config.h - config.radius, config.radius, 0, Math.PI / 2);
  12284. this.ctx.lineTo(config.radius, config.h);
  12285. this.ctx.arc(config.radius, config.h - config.radius, config.radius, Math.PI / 2, Math.PI);
  12286. this.ctx.lineTo(0, config.radius);
  12287. this.ctx.arc(config.radius, config.radius, config.radius, Math.PI, Math.PI * 3 / 2);
  12288. this.ctx.lineTo(config.w - config.radius, 0);
  12289. this.ctx.arc(config.w - config.radius, config.radius, config.radius, Math.PI * 3 / 2, Math.PI * 2);
  12290. this.ctx.lineTo(config.w, config.h - config.radius);
  12291. this.ctx.closePath();
  12292. },
  12293. /**
  12294. * Draw special Text,line wrapping is not supported
  12295. * @param {Object} config
  12296. * @param {String} config.text 文字
  12297. * @param {Number} config.x x坐标
  12298. * @param {Number} config.y y坐标
  12299. * @param {String} config.font_color 文字颜色
  12300. * @param {String} config.font_family 文字字体
  12301. * @param {Number} config.font_size 文字大小(px)
  12302. */
  12303. drawSpecialText: function drawSpecialText(params) {
  12304. var _this2 = this;
  12305. var general = params.general;
  12306. var list = params.list;
  12307. return new Promise( /*#__PURE__*/function () {
  12308. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
  12309. var i, font_size;
  12310. return _regenerator.default.wrap(function _callee$(_context) {
  12311. while (1) {
  12312. switch (_context.prev = _context.next) {
  12313. case 0:
  12314. if (general) {
  12315. _context.next = 5;
  12316. break;
  12317. }
  12318. reject("general cannot be empty:101");
  12319. return _context.abrupt("return");
  12320. case 5:
  12321. if (!(list && list.length > 0)) {
  12322. _context.next = 19;
  12323. break;
  12324. }
  12325. _context.t0 = _regenerator.default.keys(list);
  12326. case 7:
  12327. if ((_context.t1 = _context.t0()).done) {
  12328. _context.next = 16;
  12329. break;
  12330. }
  12331. i = _context.t1.value;
  12332. if (i != 0) {
  12333. font_size = list[i - 1].font_size ? parseFloat(list[i - 1].font_size) : 20;
  12334. _this2.ctx.setFontSize(font_size);
  12335. general.x = parseFloat(general.x) + _this2.ctx.measureText(list[i - 1].text).width;
  12336. }
  12337. list[i].x = general.x;
  12338. list[i].y = general.y + (list[i].margin_top ? parseFloat(list[i].margin_top) : 0);
  12339. _context.next = 14;
  12340. return _this2.drawText(list[i]);
  12341. case 14:
  12342. _context.next = 7;
  12343. break;
  12344. case 16:
  12345. resolve();
  12346. _context.next = 21;
  12347. break;
  12348. case 19:
  12349. reject("The length of config arr is less than 0");
  12350. return _context.abrupt("return");
  12351. case 21:
  12352. case "end":
  12353. return _context.stop();
  12354. }
  12355. }
  12356. }, _callee);
  12357. }));
  12358. return function (_x, _x2) {
  12359. return _ref.apply(this, arguments);
  12360. };
  12361. }());
  12362. },
  12363. /**
  12364. * array delete empty
  12365. * @param {Object} arr
  12366. */
  12367. arrDeleteEmpty: function arrDeleteEmpty(arr) {
  12368. var newArr = [];
  12369. for (var i in arr) {
  12370. if (arr[i]) {
  12371. newArr.push(arr[i]);
  12372. }
  12373. }
  12374. return newArr;
  12375. },
  12376. /**
  12377. * Draw Text,support line
  12378. * @param {Object} config
  12379. * @param {String} config.text 文字
  12380. * @param {Number} config.max_width 文字最大宽度(大于宽度自动换行)
  12381. * @param {Number} config.line_height 文字上下行间距
  12382. * @param {Number} config.x x坐标
  12383. * @param {Number} config.y y坐标
  12384. * @param {String} config.font_color 文字颜色
  12385. * @param {String} config.font_family 文字字体 默认值:Arial
  12386. * @param {String} config.text_align 文字对齐方式(left/center/right)
  12387. * @param {Number} config.font_size 文字大小(px)
  12388. * @param {Boolean} config.line_through_height 中划线大小
  12389. * @param {Boolean} config.line_through_color 中划线颜色
  12390. * @param {String} config.font_style 规定文字样式
  12391. * @param {String} config.font_variant 规定字体变体
  12392. * @param {String} config.font_weight 规定字体粗细
  12393. * @param {String} config.line_through_cap 线末端类型
  12394. * @param {String} config.line_clamp 最大行数
  12395. * @param {String} config.line_clamp_hint 超过line_clamp后,尾部显示的自定义标识 如 ...
  12396. * @param {String} config.is_line_break 是否开启换行符换行
  12397. *
  12398. */
  12399. drawText: function drawText(config) {
  12400. var _this3 = this;
  12401. var configuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  12402. configuration['line_num'] = configuration.line_num ? configuration.line_num : 0;
  12403. configuration['text_width'] = configuration.text_width ? configuration.text_width : 0;
  12404. return new Promise( /*#__PURE__*/function () {
  12405. var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resolve, reject) {
  12406. var draw_width, draw_height, draw_x, draw_y, font_size, font_color, font_family, line_height, text_align, font_weight, font_variant, font_style, line_clamp_hint, lineBreakJoinText, max_width, splitTextArr, newSplitTextArr, current_text, text_arr, i, current_text_arr, json_current_text, x, w, y;
  12407. return _regenerator.default.wrap(function _callee2$(_context2) {
  12408. while (1) {
  12409. switch (_context2.prev = _context2.next) {
  12410. case 0:
  12411. if (!config.text) {
  12412. _context2.next = 85;
  12413. break;
  12414. }
  12415. draw_width = 0, draw_height = 0, draw_x = config.x, draw_y = config.y;
  12416. font_size = config.font_size ? parseFloat(config.font_size) * _this3.scale : 20 * _this3.scale;
  12417. font_color = config.font_color || "#000";
  12418. font_family = config.font_family || "Arial";
  12419. line_height = config.line_height || config.font_size || 20;
  12420. text_align = config.text_align || "left";
  12421. font_weight = config.font_weight || "normal";
  12422. font_variant = config.font_variant || "normal";
  12423. font_style = config.font_style || "normal";
  12424. line_clamp_hint = config.line_clamp_hint || '...';
  12425. lineBreakJoinText = "";
  12426. max_width = config.max_width ? parseFloat(config.max_width) * _this3.scale : 0; // checkout is line break
  12427. if (!config.is_line_break) {
  12428. _context2.next = 28;
  12429. break;
  12430. }
  12431. splitTextArr = config.text.split(/[\n]/g);
  12432. if (!(splitTextArr && splitTextArr.length > 0)) {
  12433. _context2.next = 26;
  12434. break;
  12435. }
  12436. newSplitTextArr = _this3.arrDeleteEmpty(splitTextArr);
  12437. if (!(newSplitTextArr && newSplitTextArr.length > 0)) {
  12438. _context2.next = 22;
  12439. break;
  12440. }
  12441. lineBreakJoinText = newSplitTextArr.slice(1).join("\n");
  12442. config.text = newSplitTextArr[0];
  12443. _context2.next = 24;
  12444. break;
  12445. case 22:
  12446. reject("Text cannot be empty:103");
  12447. return _context2.abrupt("return");
  12448. case 24:
  12449. _context2.next = 28;
  12450. break;
  12451. case 26:
  12452. reject("Text cannot be empty:102");
  12453. return _context2.abrupt("return");
  12454. case 28:
  12455. _this3.ctx.setFillStyle(font_color); // color
  12456. _this3.ctx.textAlign = text_align;
  12457. _this3.ctx.font = "".concat(font_style, " ").concat(font_variant, " ").concat(font_weight, " ").concat(parseInt(font_size), "px ").concat(font_family);
  12458. if (configuration.text_width >= _this3.ctx.measureText(config.text).width) {
  12459. draw_width = configuration.text_width;
  12460. } else if (max_width > 0) {
  12461. draw_width = max_width < _this3.ctx.measureText(config.text).width ? _this3.resetCompatibilitySize(max_width) : _this3.resetCompatibilitySize(_this3.ctx.measureText(config.text).width);
  12462. } else {
  12463. draw_width = _this3.ctx.measureText(config.text).width;
  12464. }
  12465. configuration.text_width = draw_width / _this3.scale;
  12466. if (!(max_width && _this3.compatibilitySize(_this3.ctx.measureText(config.text).width) > _this3.compatibilitySize(max_width))) {
  12467. _context2.next = 72;
  12468. break;
  12469. }
  12470. current_text = "";
  12471. text_arr = config.text.split("");
  12472. _context2.t0 = _regenerator.default.keys(text_arr);
  12473. case 37:
  12474. if ((_context2.t1 = _context2.t0()).done) {
  12475. _context2.next = 70;
  12476. break;
  12477. }
  12478. i = _context2.t1.value;
  12479. if (!(_this3.compatibilitySize(_this3.ctx.measureText(current_text + text_arr[i]).width) > _this3.compatibilitySize(max_width))) {
  12480. _context2.next = 67;
  12481. break;
  12482. }
  12483. if (!(config.line_clamp && parseInt(config.line_clamp) == 1)) {
  12484. _context2.next = 56;
  12485. break;
  12486. }
  12487. // Subtracting the current_text tail width from the line_clamp_hint width
  12488. current_text_arr = current_text.split('');
  12489. json_current_text = '';
  12490. case 43:
  12491. if (false) {}
  12492. current_text_arr = current_text_arr.slice(1);
  12493. json_current_text = current_text_arr.join('');
  12494. if (!(_this3.compatibilitySize(_this3.ctx.measureText(json_current_text).width) <= _this3.compatibilitySize(_this3.ctx.measureText(line_clamp_hint).width))) {
  12495. _context2.next = 49;
  12496. break;
  12497. }
  12498. current_text = current_text.replace(json_current_text, '');
  12499. return _context2.abrupt("break", 51);
  12500. case 49:
  12501. _context2.next = 43;
  12502. break;
  12503. case 51:
  12504. configuration.line_num += 1;
  12505. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  12506. _this3.ctx.fillText(current_text + line_clamp_hint, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  12507. _context2.next = 64;
  12508. break;
  12509. case 56:
  12510. configuration.line_num += 1;
  12511. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  12512. _this3.ctx.fillText(current_text, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  12513. config.text = text_arr.slice(i).join("");
  12514. config.y = config.y + line_height;
  12515. if (config.line_clamp) {
  12516. config.line_clamp = parseInt(config.line_clamp) - 1;
  12517. }
  12518. _context2.next = 64;
  12519. return _this3.drawText(config, configuration);
  12520. case 64:
  12521. return _context2.abrupt("break", 70);
  12522. case 67:
  12523. current_text = current_text + text_arr[i];
  12524. case 68:
  12525. _context2.next = 37;
  12526. break;
  12527. case 70:
  12528. _context2.next = 77;
  12529. break;
  12530. case 72:
  12531. if (config.line_through_height) {
  12532. x = parseFloat(config.x) * _this3.scale;
  12533. y = parseFloat(config.y) * _this3.scale - font_size / 2.6;
  12534. if (text_align == "left") {
  12535. w = _this3.ctx.measureText(config.text).width / 1.1 + parseFloat(config.x) * _this3.scale;
  12536. } else if (text_align == "right") {
  12537. w = parseFloat(config.x) * _this3.scale - _this3.ctx.measureText(config.text).width / 1.1;
  12538. } else if (text_align == "center") {
  12539. x = parseFloat(config.x) * _this3.scale - _this3.ctx.measureText(config.text).width / 1.1 / 2;
  12540. w = parseFloat(config.x) * _this3.scale + _this3.ctx.measureText(config.text).width / 1.1 / 2;
  12541. }
  12542. _this3.drawLineTo({
  12543. x: x,
  12544. y: y,
  12545. w: w,
  12546. h: y,
  12547. line_width: config.line_through_height,
  12548. line_color: config.line_through_color,
  12549. line_cap: config.line_through_cap
  12550. });
  12551. }
  12552. configuration.line_num += 1;
  12553. _this3.ctx.setFontSize(parseInt(_this3.compatibilitySize(font_size))); // font size
  12554. _this3.ctx.fillText(config.text, _this3.compatibilitySize(parseFloat(config.x) * _this3.scale), _this3.compatibilitySize(parseFloat(config.y) * _this3.scale));
  12555. if (config.line_clamp) {
  12556. config.line_clamp = parseInt(config.line_clamp) - 1;
  12557. }
  12558. case 77:
  12559. if (!lineBreakJoinText) {
  12560. _context2.next = 80;
  12561. break;
  12562. }
  12563. _context2.next = 80;
  12564. return _this3.drawText(_objectSpread(_objectSpread({}, config), {}, {
  12565. text: lineBreakJoinText,
  12566. y: config.y + line_height
  12567. }), configuration);
  12568. case 80:
  12569. draw_height = config.font_size * configuration.line_num;
  12570. draw_width = configuration.text_width;
  12571. resolve({
  12572. draw_width: draw_width,
  12573. draw_height: draw_height,
  12574. draw_x: draw_x,
  12575. draw_y: draw_y
  12576. });
  12577. _context2.next = 86;
  12578. break;
  12579. case 85:
  12580. reject("Text cannot be empty:101");
  12581. case 86:
  12582. case "end":
  12583. return _context2.stop();
  12584. }
  12585. }
  12586. }, _callee2);
  12587. }));
  12588. return function (_x3, _x4) {
  12589. return _ref2.apply(this, arguments);
  12590. };
  12591. }());
  12592. },
  12593. /**
  12594. * Draw Line
  12595. * @param {Object} config
  12596. * @param {Object} config.x x坐标
  12597. * @param {Object} config.y y坐标
  12598. * @param {Object} config.w 线的宽度
  12599. * @param {Object} config.h 线的高度
  12600. * @param {Object} config.line_width 线的宽度
  12601. * @param {Object} config.line_color 线条颜色
  12602. */
  12603. drawLineTo: function drawLineTo(config) {
  12604. var x = this.compatibilitySize(config.x);
  12605. var y = this.compatibilitySize(config.y);
  12606. var w = this.compatibilitySize(config.w);
  12607. var h = this.compatibilitySize(config.h);
  12608. var line_width = config.line_width ? parseFloat(config.line_width) * this.scale : 1 * this.scale;
  12609. var line_color = config.line_color || "black";
  12610. var line_cap = config.line_cap || "butt";
  12611. this.ctx.beginPath();
  12612. this.ctx.lineCap = line_cap;
  12613. this.ctx.lineWidth = line_width;
  12614. this.ctx.strokeStyle = line_color;
  12615. this.ctx.moveTo(x, y);
  12616. this.ctx.lineTo(w, h);
  12617. this.ctx.stroke();
  12618. },
  12619. /**
  12620. * Compatibility px
  12621. * @param {Object} size
  12622. */
  12623. compatibilitySize: function compatibilitySize(size) {
  12624. var canvasSize = parseFloat(size) / 750 * this.system_info.windowWidth;
  12625. canvasSize = parseFloat(canvasSize * 2);
  12626. return canvasSize;
  12627. },
  12628. /**
  12629. * Restore compatibility px
  12630. * @param {Object} size
  12631. */
  12632. resetCompatibilitySize: function resetCompatibilitySize(size) {
  12633. var canvasSize = parseFloat(size / 2) / this.system_info.windowWidth * 750;
  12634. return canvasSize;
  12635. },
  12636. /**
  12637. * Init canvas
  12638. */
  12639. init: function init(config) {
  12640. var _this4 = this;
  12641. return new Promise( /*#__PURE__*/function () {
  12642. var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  12643. var system_info;
  12644. return _regenerator.default.wrap(function _callee3$(_context3) {
  12645. while (1) {
  12646. switch (_context3.prev = _context3.next) {
  12647. case 0:
  12648. if (config.canvas_id) {
  12649. _context3.next = 3;
  12650. break;
  12651. }
  12652. reject("Canvas ID cannot be empty, please refer to the usage example");
  12653. return _context3.abrupt("return");
  12654. case 3:
  12655. _this4.hidden = config.hidden;
  12656. _this4.canvas_id = config.canvas_id;
  12657. _context3.next = 7;
  12658. return uni.getSystemInfoSync();
  12659. case 7:
  12660. system_info = _context3.sent;
  12661. _this4.system_info = system_info;
  12662. _this4.scale = config.scale && parseFloat(config.scale) > 0 ? parseInt(config.scale) : 1;
  12663. _this4.canvas_width = (config.canvas_width ? _this4.compatibilitySize(config.canvas_width) : system_info.windowWidth) * _this4.scale;
  12664. _this4.canvas_height = (config.canvas_height ? _this4.compatibilitySize(config.canvas_height) : system_info.windowHeight) * _this4.scale, _this4.r_canvas_scale = 1 / _this4.scale;
  12665. _this4.ctx = uni.createCanvasContext(_this4.canvas_id, _this4);
  12666. _this4.setCanvasConfig({
  12667. global_alpha: config.global_alpha ? parseFloat(config.global_alpha) : 1,
  12668. backgroundColor: config.background_color ? config.background_color : "transparent"
  12669. });
  12670. resolve();
  12671. case 15:
  12672. case "end":
  12673. return _context3.stop();
  12674. }
  12675. }
  12676. }, _callee3);
  12677. }));
  12678. return function (_x5, _x6) {
  12679. return _ref3.apply(this, arguments);
  12680. };
  12681. }());
  12682. },
  12683. /**
  12684. * clear canvas all path
  12685. */
  12686. clearCanvas: function clearCanvas() {
  12687. var _this5 = this;
  12688. return new Promise( /*#__PURE__*/function () {
  12689. var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(resolve, reject) {
  12690. return _regenerator.default.wrap(function _callee4$(_context4) {
  12691. while (1) {
  12692. switch (_context4.prev = _context4.next) {
  12693. case 0:
  12694. if (_this5.ctx) {
  12695. _context4.next = 5;
  12696. break;
  12697. }
  12698. reject("canvas is not initialized:101");
  12699. return _context4.abrupt("return");
  12700. case 5:
  12701. _this5.ctx.clearRect(0, 0, parseFloat(_this5.canvas_width) * _this5.scale, parseFloat(_this5.canvas_height) * _this5.scale);
  12702. _context4.next = 8;
  12703. return _this5.draw();
  12704. case 8:
  12705. resolve();
  12706. case 9:
  12707. case "end":
  12708. return _context4.stop();
  12709. }
  12710. }
  12711. }, _callee4);
  12712. }));
  12713. return function (_x7, _x8) {
  12714. return _ref4.apply(this, arguments);
  12715. };
  12716. }());
  12717. },
  12718. /**
  12719. * Set canvas config
  12720. * @param {Object} config
  12721. */
  12722. setCanvasConfig: function setCanvasConfig(config) {
  12723. this.ctx.globalAlpha = config.global_alpha;
  12724. this.ctx.fillStyle = config.backgroundColor;
  12725. this.ctx.fillRect(0, 0, parseFloat(this.canvas_width) * this.scale, parseFloat(this.canvas_height) * this.scale);
  12726. },
  12727. /**
  12728. * set canvas width
  12729. * @param {Object} width
  12730. */
  12731. setCanvasWidth: function setCanvasWidth(width) {
  12732. if (!width) {
  12733. uni.showToast({
  12734. title: 'setCanvasWidth:width error',
  12735. icon: 'none'
  12736. });
  12737. }
  12738. this.canvas_width = this.compatibilitySize(parseFloat(width)) * this.scale;
  12739. this.ctx.width = this.canvas_width;
  12740. },
  12741. /**
  12742. * set canvas height
  12743. * @param {Object} height
  12744. */
  12745. setCanvasHeight: function setCanvasHeight(height) {
  12746. if (!height) {
  12747. uni.showToast({
  12748. title: 'setCanvasWidth:height error',
  12749. icon: 'none'
  12750. });
  12751. }
  12752. this.canvas_height = this.compatibilitySize(parseFloat(height)) * this.scale;
  12753. this.ctx.height = this.canvas_height;
  12754. },
  12755. /**
  12756. * Draw to filepath
  12757. */
  12758. draw: function draw(callback) {
  12759. var _this6 = this;
  12760. return new Promise(function (resolve, reject) {
  12761. var stop = setTimeout(function () {
  12762. _this6.ctx.draw(false, setTimeout(function () {
  12763. uni.canvasToTempFilePath({
  12764. canvasId: _this6.canvas_id,
  12765. quality: 1,
  12766. success: function success(res) {
  12767. console.log('res', res);
  12768. resolve(res);
  12769. callback && callback(res);
  12770. },
  12771. fail: function fail(err) {
  12772. reject(JSON.stringify(err) || "Failed to generate poster:101");
  12773. }
  12774. }, _this6);
  12775. }, 300));
  12776. clearTimeout(stop);
  12777. }, 300);
  12778. });
  12779. },
  12780. /**
  12781. * draw rect
  12782. * @param {Number} config.x x坐标
  12783. * @param {Number} config.y y坐标
  12784. * @param {Number} config.w 图形宽度(px)
  12785. * @param {Number} config.h 图形高度(px)
  12786. * @param {Number} config.color 图形颜色
  12787. * @param {Number} config.is_radius 是否开启圆图(1.1.6及以下版本废弃,请使用border_radius)
  12788. * @param {Number} config.border_width 边框大小
  12789. * @param {Number} config.border_color 边框颜色
  12790. *
  12791. */
  12792. drawRect: function drawRect(config) {
  12793. var _this7 = this;
  12794. return new Promise( /*#__PURE__*/function () {
  12795. var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(resolve, reject) {
  12796. var sub_config, color;
  12797. return _regenerator.default.wrap(function _callee5$(_context5) {
  12798. while (1) {
  12799. switch (_context5.prev = _context5.next) {
  12800. case 0:
  12801. if (!config.border_width || config.border_width <= 0) {
  12802. config.border_width = 0;
  12803. } else {
  12804. config.border_width = parseFloat(config.border_width);
  12805. }
  12806. if (!(parseFloat(config.border_width) > 0)) {
  12807. _context5.next = 10;
  12808. break;
  12809. }
  12810. sub_config = JSON.parse(JSON.stringify(config));
  12811. sub_config.border_width = 0;
  12812. sub_config.w = config.w + config.border_width;
  12813. sub_config.h = config.h + config.border_width;
  12814. sub_config.color = config.border_color || 'black';
  12815. if (sub_config.border_radius) {
  12816. sub_config.border_radius = parseFloat(sub_config.border_radius) + parseFloat(config.border_width) / 2;
  12817. }
  12818. _context5.next = 10;
  12819. return _this7.drawRect(sub_config);
  12820. case 10:
  12821. color = config.color || 'white';
  12822. config.x = parseFloat(config.x) + config.border_width / 2;
  12823. config.y = parseFloat(config.y) + config.border_width / 2;
  12824. config['color'] = color;
  12825. _this7.ctx.fillStyle = color;
  12826. if (config.is_radius || config.border_radius) {
  12827. _this7.setNativeBorderRadius(config);
  12828. _this7.ctx.fill();
  12829. } else {
  12830. console.log('config.border_width', config.border_width);
  12831. _this7.ctx.fillRect(_this7.compatibilitySize(config.x * _this7.scale), _this7.compatibilitySize(config.y * _this7.scale), _this7.compatibilitySize(parseFloat(config.w) * _this7.scale), _this7.compatibilitySize(parseFloat(config.h) * _this7.scale));
  12832. }
  12833. resolve();
  12834. case 17:
  12835. case "end":
  12836. return _context5.stop();
  12837. }
  12838. }
  12839. }, _callee5);
  12840. }));
  12841. return function (_x9, _x10) {
  12842. return _ref5.apply(this, arguments);
  12843. };
  12844. }());
  12845. },
  12846. /**
  12847. * Draw image
  12848. * @param {Object} config
  12849. * @param {String} config.url 图片链接
  12850. * @param {Number} config.x x坐标
  12851. * @param {Number} config.y y坐标
  12852. * @param {Number} config.w 图片宽度(px)
  12853. * @param {Number} config.h 图片高度(px)
  12854. * @param {Number} config.border_width 边大小
  12855. * @param {Number} config.border_color 边颜色
  12856. * @param {Number} config.is_radius 是否开启圆图(1.1.6及以下版本废弃,请使用border_radius)
  12857. * @param {Number} config.border_radius 圆角弧度
  12858. */
  12859. drawImage: function drawImage(config) {
  12860. var _this8 = this;
  12861. return new Promise( /*#__PURE__*/function () {
  12862. var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(resolve, reject) {
  12863. var type, image_url, reg, imageInfoResult, base64, border_radius, multiple, err_msg;
  12864. return _regenerator.default.wrap(function _callee6$(_context6) {
  12865. while (1) {
  12866. switch (_context6.prev = _context6.next) {
  12867. case 0:
  12868. if (!config.url) {
  12869. _context6.next = 49;
  12870. break;
  12871. }
  12872. type = 0; // 1、network image 2、native image 3、base64 image
  12873. reg = /^https?/ig;
  12874. if (reg.test(config.url)) {
  12875. type = 1;
  12876. } else {
  12877. if (config.url.indexOf("data:image/png;base64") != -1 || config.url.indexOf("data:image/jpeg;base64") != -1 || config.url.indexOf("data:image/gif;base64") != -1) {
  12878. type = 3;
  12879. } else {
  12880. type = 2;
  12881. }
  12882. }
  12883. if (!(type == 1)) {
  12884. _context6.next = 9;
  12885. break;
  12886. }
  12887. _context6.next = 7;
  12888. return _this8.downLoadNetworkFile(config.url).then(function (res) {
  12889. // two function
  12890. image_url = res;
  12891. }).catch(function (err) {
  12892. reject(err);
  12893. return;
  12894. });
  12895. case 7:
  12896. _context6.next = 37;
  12897. break;
  12898. case 9:
  12899. if (!(type == 2)) {
  12900. _context6.next = 30;
  12901. break;
  12902. }
  12903. _context6.next = 12;
  12904. return uni.getImageInfo({
  12905. src: config.url
  12906. });
  12907. case 12:
  12908. imageInfoResult = _context6.sent;
  12909. _context6.prev = 13;
  12910. if (!(imageInfoResult.length <= 1)) {
  12911. _context6.next = 17;
  12912. break;
  12913. }
  12914. reject(imageInfoResult[0].errMsg + ':404');
  12915. return _context6.abrupt("return");
  12916. case 17:
  12917. _context6.next = 23;
  12918. break;
  12919. case 19:
  12920. _context6.prev = 19;
  12921. _context6.t0 = _context6["catch"](13);
  12922. reject(_context6.t0 + ':500');
  12923. return _context6.abrupt("return");
  12924. case 23:
  12925. _context6.next = 25;
  12926. return _this8.urlToBase64({
  12927. url: imageInfoResult[1].path
  12928. });
  12929. case 25:
  12930. base64 = _context6.sent;
  12931. _context6.next = 28;
  12932. return _this8.base64ToNative({
  12933. url: base64
  12934. }).then(function (res) {
  12935. image_url = res;
  12936. }).catch(function (err) {
  12937. reject(JSON.stringify(err) + ":501");
  12938. return;
  12939. });
  12940. case 28:
  12941. _context6.next = 37;
  12942. break;
  12943. case 30:
  12944. if (!(type == 3)) {
  12945. _context6.next = 35;
  12946. break;
  12947. }
  12948. _context6.next = 33;
  12949. return _this8.base64ToNative({
  12950. url: config.url
  12951. }).then(function (res) {
  12952. image_url = res;
  12953. }).catch(function (err) {
  12954. reject(JSON.stringify(err) + ":500");
  12955. return;
  12956. });
  12957. case 33:
  12958. _context6.next = 37;
  12959. break;
  12960. case 35:
  12961. reject("Other Type Errors:101");
  12962. return _context6.abrupt("return");
  12963. case 37:
  12964. if (!config.border_width) {
  12965. _context6.next = 42;
  12966. break;
  12967. }
  12968. border_radius = 0;
  12969. if (config.border_radius) {
  12970. multiple = config.w / config.border_radius;
  12971. border_radius = (parseFloat(config.w) + parseFloat(config.border_width)) / multiple;
  12972. }
  12973. // drawRect
  12974. _context6.next = 42;
  12975. return _this8.drawRect({
  12976. x: parseFloat(config.x) - parseFloat(config.border_width) / 2,
  12977. y: parseFloat(config.y) - parseFloat(config.border_width) / 2,
  12978. w: parseFloat(config.w) + parseFloat(config.border_width),
  12979. h: parseFloat(config.h) + parseFloat(config.border_width),
  12980. color: config.border_color,
  12981. border_radius: border_radius,
  12982. border_width: config.border_width,
  12983. is_radius: config.is_radius
  12984. });
  12985. case 42:
  12986. if (config.border_radius) {
  12987. config.color = config.color ? config.color : 'rgba(0,0,0,0)';
  12988. // 圆角有白边,+0.5的误差
  12989. config.w = config.w + 0.3;
  12990. config.h = config.h + 0.3;
  12991. _this8.setNativeBorderRadius(config);
  12992. } else if (config.is_radius) {
  12993. //已废弃 is_radius
  12994. _this8.ctx.setStrokeStyle("rgba(0,0,0,0)");
  12995. _this8.ctx.save();
  12996. _this8.ctx.beginPath();
  12997. _this8.ctx.arc(_this8.compatibilitySize(parseFloat(config.x) * _this8.scale + parseFloat(config.w) * _this8.scale / 2), _this8.compatibilitySize(parseFloat(config.y) * _this8.scale + parseFloat(config.h) * _this8.scale / 2), _this8.compatibilitySize(parseFloat(config.w) * _this8.scale / 2), 0, 2 * Math.PI, false);
  12998. _this8.ctx.stroke();
  12999. _this8.ctx.clip();
  13000. }
  13001. _context6.next = 45;
  13002. return _this8.ctx.drawImage(image_url, _this8.compatibilitySize(parseFloat(config.x) * _this8.scale), _this8.compatibilitySize(parseFloat(config.y) * _this8.scale), _this8.compatibilitySize(parseFloat(config.w) * _this8.scale), _this8.compatibilitySize(parseFloat(config.h) * _this8.scale));
  13003. case 45:
  13004. _this8.ctx.restore(); //Restore previously saved drawing context
  13005. resolve();
  13006. _context6.next = 51;
  13007. break;
  13008. case 49:
  13009. err_msg = "Links cannot be empty:101";
  13010. reject(err_msg);
  13011. case 51:
  13012. case "end":
  13013. return _context6.stop();
  13014. }
  13015. }
  13016. }, _callee6, null, [[13, 19]]);
  13017. }));
  13018. return function (_x11, _x12) {
  13019. return _ref6.apply(this, arguments);
  13020. };
  13021. }());
  13022. },
  13023. /**
  13024. * base64 to native available path
  13025. * @param {Object} config
  13026. */
  13027. base64ToNative: function base64ToNative(config) {
  13028. return new Promise(function (resolve, reject) {
  13029. var fileName = new Date().getTime();
  13030. var filePath = "".concat(wx.env.USER_DATA_PATH, "/").concat(fileName, "_rCanvas.png");
  13031. wx.getFileSystemManager().writeFile({
  13032. filePath: filePath,
  13033. data: config.url.replace(/^data:\S+\/\S+;base64,/, ''),
  13034. encoding: 'base64',
  13035. success: function success() {
  13036. resolve(filePath);
  13037. },
  13038. fail: function fail(error) {
  13039. reject(error);
  13040. }
  13041. });
  13042. });
  13043. },
  13044. /**
  13045. * native url to base64
  13046. * @param {Object} config
  13047. */
  13048. urlToBase64: function urlToBase64(config) {
  13049. var _this9 = this;
  13050. return new Promise( /*#__PURE__*/function () {
  13051. var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(resolve, reject) {
  13052. return _regenerator.default.wrap(function _callee7$(_context7) {
  13053. while (1) {
  13054. switch (_context7.prev = _context7.next) {
  13055. case 0:
  13056. if (!(typeof window != 'undefined')) {
  13057. _context7.next = 5;
  13058. break;
  13059. }
  13060. _context7.next = 3;
  13061. return _this9.downLoadNetworkFile(config.url).then(function (res) {
  13062. // two function
  13063. resolve(res);
  13064. }).catch(function (err) {
  13065. reject(err);
  13066. });
  13067. case 3:
  13068. _context7.next = 6;
  13069. break;
  13070. case 5:
  13071. if (typeof plus != 'undefined') {
  13072. plus.io.resolveLocalFileSystemURL(config.url, function (obj) {
  13073. obj.file(function (file) {
  13074. var fileReader = new plus.io.FileReader();
  13075. fileReader.onload = function (res) {
  13076. resolve(res.target.result);
  13077. };
  13078. fileReader.onerror = function (err) {
  13079. reject(err);
  13080. };
  13081. fileReader.readAsDataURL(file);
  13082. }, function (err) {
  13083. reject(err);
  13084. });
  13085. }, function (err) {
  13086. reject(err);
  13087. });
  13088. } else if (typeof wx != 'undefined') {
  13089. wx.getFileSystemManager().readFile({
  13090. filePath: config.url,
  13091. encoding: 'base64',
  13092. success: function success(res) {
  13093. resolve('data:image/png;base64,' + res.data);
  13094. },
  13095. fail: function fail(error) {
  13096. reject(error);
  13097. }
  13098. });
  13099. }
  13100. case 6:
  13101. case "end":
  13102. return _context7.stop();
  13103. }
  13104. }
  13105. }, _callee7);
  13106. }));
  13107. return function (_x13, _x14) {
  13108. return _ref7.apply(this, arguments);
  13109. };
  13110. }());
  13111. },
  13112. setNativeBorderRadius: function setNativeBorderRadius(config) {
  13113. var border_radius = config.border_radius ? parseFloat(config.border_radius) * this.scale : 20 * this.scale;
  13114. if (parseFloat(config.w) * this.scale < 2 * border_radius) border_radius = parseFloat(config.w) * this.scale / 2;
  13115. if (parseFloat(config.h) * this.scale < 2 * border_radius) border_radius = parseFloat(config.h) * this.scale / 2;
  13116. this.ctx.beginPath();
  13117. this.ctx.moveTo(this.compatibilitySize(parseFloat(config.x) * this.scale + border_radius), this.compatibilitySize(parseFloat(config.y) * this.scale));
  13118. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(border_radius));
  13119. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(border_radius));
  13120. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale + parseFloat(config.h) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(border_radius));
  13121. this.ctx.arcTo(this.compatibilitySize(parseFloat(config.x) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(parseFloat(config.x) * this.scale + parseFloat(config.w) * this.scale), this.compatibilitySize(parseFloat(config.y) * this.scale), this.compatibilitySize(border_radius));
  13122. this.ctx.closePath();
  13123. this.ctx.strokeStyle = config.color || config.border_color || 'rgba(0,0,0,0)'; // 设置绘制边框的颜色
  13124. this.ctx.stroke();
  13125. this.ctx.save();
  13126. this.ctx.clip();
  13127. },
  13128. /**
  13129. * Download network file
  13130. * @param {Object} url : download url
  13131. */
  13132. downLoadNetworkFile: function downLoadNetworkFile(url) {
  13133. return new Promise(function (resolve, reject) {
  13134. uni.downloadFile({
  13135. url: url,
  13136. success: function success(res) {
  13137. if (res.statusCode == 200) {
  13138. resolve(res.tempFilePath);
  13139. } else {
  13140. reject("Download Image Fail:102");
  13141. }
  13142. },
  13143. fail: function fail(err) {
  13144. reject("Download Image Fail:101");
  13145. }
  13146. });
  13147. });
  13148. },
  13149. /**
  13150. * Save image to natice
  13151. * @param {Object} filePath : native imageUrl
  13152. */
  13153. saveImage: function saveImage(filePath) {
  13154. return new Promise(function (resolve, reject) {
  13155. if (!filePath) {
  13156. reject("FilePath cannot be null:101");
  13157. return;
  13158. }
  13159. uni.saveImageToPhotosAlbum({
  13160. filePath: filePath,
  13161. success: function success(res) {
  13162. resolve(res);
  13163. },
  13164. fail: function fail(err) {
  13165. reject(err);
  13166. }
  13167. });
  13168. });
  13169. }
  13170. }
  13171. };
  13172. exports.default = _default;
  13173. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  13174. /***/ })
  13175. ]]);
  13176. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map