app-service.js 306 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652
  1. if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
  2. Promise.prototype.finally = function(callback) {
  3. const promise = this.constructor;
  4. return this.then(
  5. (value) => promise.resolve(callback()).then(() => value),
  6. (reason) => promise.resolve(callback()).then(() => {
  7. throw reason;
  8. })
  9. );
  10. };
  11. }
  12. ;
  13. if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
  14. const global2 = uni.requireGlobal();
  15. ArrayBuffer = global2.ArrayBuffer;
  16. Int8Array = global2.Int8Array;
  17. Uint8Array = global2.Uint8Array;
  18. Uint8ClampedArray = global2.Uint8ClampedArray;
  19. Int16Array = global2.Int16Array;
  20. Uint16Array = global2.Uint16Array;
  21. Int32Array = global2.Int32Array;
  22. Uint32Array = global2.Uint32Array;
  23. Float32Array = global2.Float32Array;
  24. Float64Array = global2.Float64Array;
  25. BigInt64Array = global2.BigInt64Array;
  26. BigUint64Array = global2.BigUint64Array;
  27. }
  28. ;
  29. if (uni.restoreGlobal) {
  30. uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
  31. }
  32. (function(vue) {
  33. "use strict";
  34. function formatAppLog(type, filename, ...args) {
  35. if (uni.__log__) {
  36. uni.__log__(type, filename, ...args);
  37. } else {
  38. console[type].apply(console, [...args, filename]);
  39. }
  40. }
  41. function resolveEasycom(component, easycom) {
  42. return typeof component === "string" ? easycom : component;
  43. }
  44. const fontData = [
  45. {
  46. "font_class": "arrow-down",
  47. "unicode": ""
  48. },
  49. {
  50. "font_class": "arrow-left",
  51. "unicode": ""
  52. },
  53. {
  54. "font_class": "arrow-right",
  55. "unicode": ""
  56. },
  57. {
  58. "font_class": "arrow-up",
  59. "unicode": ""
  60. },
  61. {
  62. "font_class": "auth",
  63. "unicode": ""
  64. },
  65. {
  66. "font_class": "auth-filled",
  67. "unicode": ""
  68. },
  69. {
  70. "font_class": "back",
  71. "unicode": ""
  72. },
  73. {
  74. "font_class": "bars",
  75. "unicode": ""
  76. },
  77. {
  78. "font_class": "calendar",
  79. "unicode": ""
  80. },
  81. {
  82. "font_class": "calendar-filled",
  83. "unicode": ""
  84. },
  85. {
  86. "font_class": "camera",
  87. "unicode": ""
  88. },
  89. {
  90. "font_class": "camera-filled",
  91. "unicode": ""
  92. },
  93. {
  94. "font_class": "cart",
  95. "unicode": ""
  96. },
  97. {
  98. "font_class": "cart-filled",
  99. "unicode": ""
  100. },
  101. {
  102. "font_class": "chat",
  103. "unicode": ""
  104. },
  105. {
  106. "font_class": "chat-filled",
  107. "unicode": ""
  108. },
  109. {
  110. "font_class": "chatboxes",
  111. "unicode": ""
  112. },
  113. {
  114. "font_class": "chatboxes-filled",
  115. "unicode": ""
  116. },
  117. {
  118. "font_class": "chatbubble",
  119. "unicode": ""
  120. },
  121. {
  122. "font_class": "chatbubble-filled",
  123. "unicode": ""
  124. },
  125. {
  126. "font_class": "checkbox",
  127. "unicode": ""
  128. },
  129. {
  130. "font_class": "checkbox-filled",
  131. "unicode": ""
  132. },
  133. {
  134. "font_class": "checkmarkempty",
  135. "unicode": ""
  136. },
  137. {
  138. "font_class": "circle",
  139. "unicode": ""
  140. },
  141. {
  142. "font_class": "circle-filled",
  143. "unicode": ""
  144. },
  145. {
  146. "font_class": "clear",
  147. "unicode": ""
  148. },
  149. {
  150. "font_class": "close",
  151. "unicode": ""
  152. },
  153. {
  154. "font_class": "closeempty",
  155. "unicode": ""
  156. },
  157. {
  158. "font_class": "cloud-download",
  159. "unicode": ""
  160. },
  161. {
  162. "font_class": "cloud-download-filled",
  163. "unicode": ""
  164. },
  165. {
  166. "font_class": "cloud-upload",
  167. "unicode": ""
  168. },
  169. {
  170. "font_class": "cloud-upload-filled",
  171. "unicode": ""
  172. },
  173. {
  174. "font_class": "color",
  175. "unicode": ""
  176. },
  177. {
  178. "font_class": "color-filled",
  179. "unicode": ""
  180. },
  181. {
  182. "font_class": "compose",
  183. "unicode": ""
  184. },
  185. {
  186. "font_class": "contact",
  187. "unicode": ""
  188. },
  189. {
  190. "font_class": "contact-filled",
  191. "unicode": ""
  192. },
  193. {
  194. "font_class": "down",
  195. "unicode": ""
  196. },
  197. {
  198. "font_class": "bottom",
  199. "unicode": ""
  200. },
  201. {
  202. "font_class": "download",
  203. "unicode": ""
  204. },
  205. {
  206. "font_class": "download-filled",
  207. "unicode": ""
  208. },
  209. {
  210. "font_class": "email",
  211. "unicode": ""
  212. },
  213. {
  214. "font_class": "email-filled",
  215. "unicode": ""
  216. },
  217. {
  218. "font_class": "eye",
  219. "unicode": ""
  220. },
  221. {
  222. "font_class": "eye-filled",
  223. "unicode": ""
  224. },
  225. {
  226. "font_class": "eye-slash",
  227. "unicode": ""
  228. },
  229. {
  230. "font_class": "eye-slash-filled",
  231. "unicode": ""
  232. },
  233. {
  234. "font_class": "fire",
  235. "unicode": ""
  236. },
  237. {
  238. "font_class": "fire-filled",
  239. "unicode": ""
  240. },
  241. {
  242. "font_class": "flag",
  243. "unicode": ""
  244. },
  245. {
  246. "font_class": "flag-filled",
  247. "unicode": ""
  248. },
  249. {
  250. "font_class": "folder-add",
  251. "unicode": ""
  252. },
  253. {
  254. "font_class": "folder-add-filled",
  255. "unicode": ""
  256. },
  257. {
  258. "font_class": "font",
  259. "unicode": ""
  260. },
  261. {
  262. "font_class": "forward",
  263. "unicode": ""
  264. },
  265. {
  266. "font_class": "gear",
  267. "unicode": ""
  268. },
  269. {
  270. "font_class": "gear-filled",
  271. "unicode": ""
  272. },
  273. {
  274. "font_class": "gift",
  275. "unicode": ""
  276. },
  277. {
  278. "font_class": "gift-filled",
  279. "unicode": ""
  280. },
  281. {
  282. "font_class": "hand-down",
  283. "unicode": ""
  284. },
  285. {
  286. "font_class": "hand-down-filled",
  287. "unicode": ""
  288. },
  289. {
  290. "font_class": "hand-up",
  291. "unicode": ""
  292. },
  293. {
  294. "font_class": "hand-up-filled",
  295. "unicode": ""
  296. },
  297. {
  298. "font_class": "headphones",
  299. "unicode": ""
  300. },
  301. {
  302. "font_class": "heart",
  303. "unicode": ""
  304. },
  305. {
  306. "font_class": "heart-filled",
  307. "unicode": ""
  308. },
  309. {
  310. "font_class": "help",
  311. "unicode": ""
  312. },
  313. {
  314. "font_class": "help-filled",
  315. "unicode": ""
  316. },
  317. {
  318. "font_class": "home",
  319. "unicode": ""
  320. },
  321. {
  322. "font_class": "home-filled",
  323. "unicode": ""
  324. },
  325. {
  326. "font_class": "image",
  327. "unicode": ""
  328. },
  329. {
  330. "font_class": "image-filled",
  331. "unicode": ""
  332. },
  333. {
  334. "font_class": "images",
  335. "unicode": ""
  336. },
  337. {
  338. "font_class": "images-filled",
  339. "unicode": ""
  340. },
  341. {
  342. "font_class": "info",
  343. "unicode": ""
  344. },
  345. {
  346. "font_class": "info-filled",
  347. "unicode": ""
  348. },
  349. {
  350. "font_class": "left",
  351. "unicode": ""
  352. },
  353. {
  354. "font_class": "link",
  355. "unicode": ""
  356. },
  357. {
  358. "font_class": "list",
  359. "unicode": ""
  360. },
  361. {
  362. "font_class": "location",
  363. "unicode": ""
  364. },
  365. {
  366. "font_class": "location-filled",
  367. "unicode": ""
  368. },
  369. {
  370. "font_class": "locked",
  371. "unicode": ""
  372. },
  373. {
  374. "font_class": "locked-filled",
  375. "unicode": ""
  376. },
  377. {
  378. "font_class": "loop",
  379. "unicode": ""
  380. },
  381. {
  382. "font_class": "mail-open",
  383. "unicode": ""
  384. },
  385. {
  386. "font_class": "mail-open-filled",
  387. "unicode": ""
  388. },
  389. {
  390. "font_class": "map",
  391. "unicode": ""
  392. },
  393. {
  394. "font_class": "map-filled",
  395. "unicode": ""
  396. },
  397. {
  398. "font_class": "map-pin",
  399. "unicode": ""
  400. },
  401. {
  402. "font_class": "map-pin-ellipse",
  403. "unicode": ""
  404. },
  405. {
  406. "font_class": "medal",
  407. "unicode": ""
  408. },
  409. {
  410. "font_class": "medal-filled",
  411. "unicode": ""
  412. },
  413. {
  414. "font_class": "mic",
  415. "unicode": ""
  416. },
  417. {
  418. "font_class": "mic-filled",
  419. "unicode": ""
  420. },
  421. {
  422. "font_class": "micoff",
  423. "unicode": ""
  424. },
  425. {
  426. "font_class": "micoff-filled",
  427. "unicode": ""
  428. },
  429. {
  430. "font_class": "minus",
  431. "unicode": ""
  432. },
  433. {
  434. "font_class": "minus-filled",
  435. "unicode": ""
  436. },
  437. {
  438. "font_class": "more",
  439. "unicode": ""
  440. },
  441. {
  442. "font_class": "more-filled",
  443. "unicode": ""
  444. },
  445. {
  446. "font_class": "navigate",
  447. "unicode": ""
  448. },
  449. {
  450. "font_class": "navigate-filled",
  451. "unicode": ""
  452. },
  453. {
  454. "font_class": "notification",
  455. "unicode": ""
  456. },
  457. {
  458. "font_class": "notification-filled",
  459. "unicode": ""
  460. },
  461. {
  462. "font_class": "paperclip",
  463. "unicode": ""
  464. },
  465. {
  466. "font_class": "paperplane",
  467. "unicode": ""
  468. },
  469. {
  470. "font_class": "paperplane-filled",
  471. "unicode": ""
  472. },
  473. {
  474. "font_class": "person",
  475. "unicode": ""
  476. },
  477. {
  478. "font_class": "person-filled",
  479. "unicode": ""
  480. },
  481. {
  482. "font_class": "personadd",
  483. "unicode": ""
  484. },
  485. {
  486. "font_class": "personadd-filled",
  487. "unicode": ""
  488. },
  489. {
  490. "font_class": "personadd-filled-copy",
  491. "unicode": ""
  492. },
  493. {
  494. "font_class": "phone",
  495. "unicode": ""
  496. },
  497. {
  498. "font_class": "phone-filled",
  499. "unicode": ""
  500. },
  501. {
  502. "font_class": "plus",
  503. "unicode": ""
  504. },
  505. {
  506. "font_class": "plus-filled",
  507. "unicode": ""
  508. },
  509. {
  510. "font_class": "plusempty",
  511. "unicode": ""
  512. },
  513. {
  514. "font_class": "pulldown",
  515. "unicode": ""
  516. },
  517. {
  518. "font_class": "pyq",
  519. "unicode": ""
  520. },
  521. {
  522. "font_class": "qq",
  523. "unicode": ""
  524. },
  525. {
  526. "font_class": "redo",
  527. "unicode": ""
  528. },
  529. {
  530. "font_class": "redo-filled",
  531. "unicode": ""
  532. },
  533. {
  534. "font_class": "refresh",
  535. "unicode": ""
  536. },
  537. {
  538. "font_class": "refresh-filled",
  539. "unicode": ""
  540. },
  541. {
  542. "font_class": "refreshempty",
  543. "unicode": ""
  544. },
  545. {
  546. "font_class": "reload",
  547. "unicode": ""
  548. },
  549. {
  550. "font_class": "right",
  551. "unicode": ""
  552. },
  553. {
  554. "font_class": "scan",
  555. "unicode": ""
  556. },
  557. {
  558. "font_class": "search",
  559. "unicode": ""
  560. },
  561. {
  562. "font_class": "settings",
  563. "unicode": ""
  564. },
  565. {
  566. "font_class": "settings-filled",
  567. "unicode": ""
  568. },
  569. {
  570. "font_class": "shop",
  571. "unicode": ""
  572. },
  573. {
  574. "font_class": "shop-filled",
  575. "unicode": ""
  576. },
  577. {
  578. "font_class": "smallcircle",
  579. "unicode": ""
  580. },
  581. {
  582. "font_class": "smallcircle-filled",
  583. "unicode": ""
  584. },
  585. {
  586. "font_class": "sound",
  587. "unicode": ""
  588. },
  589. {
  590. "font_class": "sound-filled",
  591. "unicode": ""
  592. },
  593. {
  594. "font_class": "spinner-cycle",
  595. "unicode": ""
  596. },
  597. {
  598. "font_class": "staff",
  599. "unicode": ""
  600. },
  601. {
  602. "font_class": "staff-filled",
  603. "unicode": ""
  604. },
  605. {
  606. "font_class": "star",
  607. "unicode": ""
  608. },
  609. {
  610. "font_class": "star-filled",
  611. "unicode": ""
  612. },
  613. {
  614. "font_class": "starhalf",
  615. "unicode": ""
  616. },
  617. {
  618. "font_class": "trash",
  619. "unicode": ""
  620. },
  621. {
  622. "font_class": "trash-filled",
  623. "unicode": ""
  624. },
  625. {
  626. "font_class": "tune",
  627. "unicode": ""
  628. },
  629. {
  630. "font_class": "tune-filled",
  631. "unicode": ""
  632. },
  633. {
  634. "font_class": "undo",
  635. "unicode": ""
  636. },
  637. {
  638. "font_class": "undo-filled",
  639. "unicode": ""
  640. },
  641. {
  642. "font_class": "up",
  643. "unicode": ""
  644. },
  645. {
  646. "font_class": "top",
  647. "unicode": ""
  648. },
  649. {
  650. "font_class": "upload",
  651. "unicode": ""
  652. },
  653. {
  654. "font_class": "upload-filled",
  655. "unicode": ""
  656. },
  657. {
  658. "font_class": "videocam",
  659. "unicode": ""
  660. },
  661. {
  662. "font_class": "videocam-filled",
  663. "unicode": ""
  664. },
  665. {
  666. "font_class": "vip",
  667. "unicode": ""
  668. },
  669. {
  670. "font_class": "vip-filled",
  671. "unicode": ""
  672. },
  673. {
  674. "font_class": "wallet",
  675. "unicode": ""
  676. },
  677. {
  678. "font_class": "wallet-filled",
  679. "unicode": ""
  680. },
  681. {
  682. "font_class": "weibo",
  683. "unicode": ""
  684. },
  685. {
  686. "font_class": "weixin",
  687. "unicode": ""
  688. }
  689. ];
  690. const _export_sfc = (sfc, props) => {
  691. const target = sfc.__vccOpts || sfc;
  692. for (const [key, val] of props) {
  693. target[key] = val;
  694. }
  695. return target;
  696. };
  697. const getVal = (val) => {
  698. const reg = /^[0-9]*$/g;
  699. return typeof val === "number" || reg.test(val) ? val + "px" : val;
  700. };
  701. const _sfc_main$e = {
  702. name: "UniIcons",
  703. emits: ["click"],
  704. props: {
  705. type: {
  706. type: String,
  707. default: ""
  708. },
  709. color: {
  710. type: String,
  711. default: "#333333"
  712. },
  713. size: {
  714. type: [Number, String],
  715. default: 16
  716. },
  717. customPrefix: {
  718. type: String,
  719. default: ""
  720. },
  721. fontFamily: {
  722. type: String,
  723. default: ""
  724. }
  725. },
  726. data() {
  727. return {
  728. icons: fontData
  729. };
  730. },
  731. computed: {
  732. unicode() {
  733. let code = this.icons.find((v2) => v2.font_class === this.type);
  734. if (code) {
  735. return code.unicode;
  736. }
  737. return "";
  738. },
  739. iconSize() {
  740. return getVal(this.size);
  741. },
  742. styleObj() {
  743. if (this.fontFamily !== "") {
  744. return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`;
  745. }
  746. return `color: ${this.color}; font-size: ${this.iconSize};`;
  747. }
  748. },
  749. methods: {
  750. _onClick() {
  751. this.$emit("click");
  752. }
  753. }
  754. };
  755. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  756. return vue.openBlock(), vue.createElementBlock(
  757. "text",
  758. {
  759. style: vue.normalizeStyle($options.styleObj),
  760. class: vue.normalizeClass(["uni-icons", ["uniui-" + $props.type, $props.customPrefix, $props.customPrefix ? $props.type : ""]]),
  761. onClick: _cache[0] || (_cache[0] = (...args) => $options._onClick && $options._onClick(...args))
  762. },
  763. [
  764. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  765. ],
  766. 6
  767. /* CLASS, STYLE */
  768. );
  769. }
  770. const __easycom_0$3 = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$d], ["__scopeId", "data-v-d31e1c47"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-icons/components/uni-icons/uni-icons.vue"]]);
  771. const popup = {
  772. data() {
  773. return {};
  774. },
  775. created() {
  776. this.popup = this.getParent();
  777. },
  778. methods: {
  779. /**
  780. * 获取父元素实例
  781. */
  782. getParent(name = "uniPopup") {
  783. let parent = this.$parent;
  784. let parentName = parent.$options.name;
  785. while (parentName !== name) {
  786. parent = parent.$parent;
  787. if (!parent)
  788. return false;
  789. parentName = parent.$options.name;
  790. }
  791. return parent;
  792. }
  793. }
  794. };
  795. const _sfc_main$d = {
  796. name: "uniPopupMessage",
  797. mixins: [popup],
  798. props: {
  799. /**
  800. * 主题 success/warning/info/error 默认 success
  801. */
  802. type: {
  803. type: String,
  804. default: "success"
  805. },
  806. /**
  807. * 消息文字
  808. */
  809. message: {
  810. type: String,
  811. default: ""
  812. },
  813. /**
  814. * 显示时间,设置为 0 则不会自动关闭
  815. */
  816. duration: {
  817. type: Number,
  818. default: 3e3
  819. },
  820. maskShow: {
  821. type: Boolean,
  822. default: false
  823. }
  824. },
  825. data() {
  826. return {};
  827. },
  828. created() {
  829. this.popup.maskShow = this.maskShow;
  830. this.popup.messageChild = this;
  831. },
  832. methods: {
  833. timerClose() {
  834. if (this.duration === 0)
  835. return;
  836. clearTimeout(this.timer);
  837. this.timer = setTimeout(() => {
  838. this.popup.close();
  839. }, this.duration);
  840. }
  841. }
  842. };
  843. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  844. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-popup-message" }, [
  845. vue.createElementVNode(
  846. "view",
  847. {
  848. class: vue.normalizeClass(["uni-popup-message__box fixforpc-width", "uni-popup__" + $props.type])
  849. },
  850. [
  851. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  852. vue.createElementVNode(
  853. "text",
  854. {
  855. class: vue.normalizeClass(["uni-popup-message-text", "uni-popup__" + $props.type + "-text"])
  856. },
  857. vue.toDisplayString($props.message),
  858. 3
  859. /* TEXT, CLASS */
  860. )
  861. ], true)
  862. ],
  863. 2
  864. /* CLASS */
  865. )
  866. ]);
  867. }
  868. const __easycom_3 = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$c], ["__scopeId", "data-v-a4566996"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue"]]);
  869. class MPAnimation {
  870. constructor(options, _this) {
  871. this.options = options;
  872. this.animation = uni.createAnimation({
  873. ...options
  874. });
  875. this.currentStepAnimates = {};
  876. this.next = 0;
  877. this.$ = _this;
  878. }
  879. _nvuePushAnimates(type, args) {
  880. let aniObj = this.currentStepAnimates[this.next];
  881. let styles = {};
  882. if (!aniObj) {
  883. styles = {
  884. styles: {},
  885. config: {}
  886. };
  887. } else {
  888. styles = aniObj;
  889. }
  890. if (animateTypes1.includes(type)) {
  891. if (!styles.styles.transform) {
  892. styles.styles.transform = "";
  893. }
  894. let unit = "";
  895. if (type === "rotate") {
  896. unit = "deg";
  897. }
  898. styles.styles.transform += `${type}(${args + unit}) `;
  899. } else {
  900. styles.styles[type] = `${args}`;
  901. }
  902. this.currentStepAnimates[this.next] = styles;
  903. }
  904. _animateRun(styles = {}, config = {}) {
  905. let ref = this.$.$refs["ani"].ref;
  906. if (!ref)
  907. return;
  908. return new Promise((resolve, reject) => {
  909. nvueAnimation.transition(ref, {
  910. styles,
  911. ...config
  912. }, (res) => {
  913. resolve();
  914. });
  915. });
  916. }
  917. _nvueNextAnimate(animates, step = 0, fn) {
  918. let obj = animates[step];
  919. if (obj) {
  920. let {
  921. styles,
  922. config
  923. } = obj;
  924. this._animateRun(styles, config).then(() => {
  925. step += 1;
  926. this._nvueNextAnimate(animates, step, fn);
  927. });
  928. } else {
  929. this.currentStepAnimates = {};
  930. typeof fn === "function" && fn();
  931. this.isEnd = true;
  932. }
  933. }
  934. step(config = {}) {
  935. this.animation.step(config);
  936. return this;
  937. }
  938. run(fn) {
  939. this.$.animationData = this.animation.export();
  940. this.$.timer = setTimeout(() => {
  941. typeof fn === "function" && fn();
  942. }, this.$.durationTime);
  943. }
  944. }
  945. const animateTypes1 = [
  946. "matrix",
  947. "matrix3d",
  948. "rotate",
  949. "rotate3d",
  950. "rotateX",
  951. "rotateY",
  952. "rotateZ",
  953. "scale",
  954. "scale3d",
  955. "scaleX",
  956. "scaleY",
  957. "scaleZ",
  958. "skew",
  959. "skewX",
  960. "skewY",
  961. "translate",
  962. "translate3d",
  963. "translateX",
  964. "translateY",
  965. "translateZ"
  966. ];
  967. const animateTypes2 = ["opacity", "backgroundColor"];
  968. const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
  969. animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
  970. MPAnimation.prototype[type] = function(...args) {
  971. this.animation[type](...args);
  972. return this;
  973. };
  974. });
  975. function createAnimation(option, _this) {
  976. if (!_this)
  977. return;
  978. clearTimeout(_this.timer);
  979. return new MPAnimation(option, _this);
  980. }
  981. const _sfc_main$c = {
  982. name: "uniTransition",
  983. emits: ["click", "change"],
  984. props: {
  985. show: {
  986. type: Boolean,
  987. default: false
  988. },
  989. modeClass: {
  990. type: [Array, String],
  991. default() {
  992. return "fade";
  993. }
  994. },
  995. duration: {
  996. type: Number,
  997. default: 300
  998. },
  999. styles: {
  1000. type: Object,
  1001. default() {
  1002. return {};
  1003. }
  1004. },
  1005. customClass: {
  1006. type: String,
  1007. default: ""
  1008. },
  1009. onceRender: {
  1010. type: Boolean,
  1011. default: false
  1012. }
  1013. },
  1014. data() {
  1015. return {
  1016. isShow: false,
  1017. transform: "",
  1018. opacity: 1,
  1019. animationData: {},
  1020. durationTime: 300,
  1021. config: {}
  1022. };
  1023. },
  1024. watch: {
  1025. show: {
  1026. handler(newVal) {
  1027. if (newVal) {
  1028. this.open();
  1029. } else {
  1030. if (this.isShow) {
  1031. this.close();
  1032. }
  1033. }
  1034. },
  1035. immediate: true
  1036. }
  1037. },
  1038. computed: {
  1039. // 生成样式数据
  1040. stylesObject() {
  1041. let styles = {
  1042. ...this.styles,
  1043. "transition-duration": this.duration / 1e3 + "s"
  1044. };
  1045. let transform = "";
  1046. for (let i2 in styles) {
  1047. let line = this.toLine(i2);
  1048. transform += line + ":" + styles[i2] + ";";
  1049. }
  1050. return transform;
  1051. },
  1052. // 初始化动画条件
  1053. transformStyles() {
  1054. return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
  1055. }
  1056. },
  1057. created() {
  1058. this.config = {
  1059. duration: this.duration,
  1060. timingFunction: "ease",
  1061. transformOrigin: "50% 50%",
  1062. delay: 0
  1063. };
  1064. this.durationTime = this.duration;
  1065. },
  1066. methods: {
  1067. /**
  1068. * ref 触发 初始化动画
  1069. */
  1070. init(obj = {}) {
  1071. if (obj.duration) {
  1072. this.durationTime = obj.duration;
  1073. }
  1074. this.animation = createAnimation(Object.assign(this.config, obj), this);
  1075. },
  1076. /**
  1077. * 点击组件触发回调
  1078. */
  1079. onClick() {
  1080. this.$emit("click", {
  1081. detail: this.isShow
  1082. });
  1083. },
  1084. /**
  1085. * ref 触发 动画分组
  1086. * @param {Object} obj
  1087. */
  1088. step(obj, config = {}) {
  1089. if (!this.animation)
  1090. return;
  1091. for (let i2 in obj) {
  1092. try {
  1093. if (typeof obj[i2] === "object") {
  1094. this.animation[i2](...obj[i2]);
  1095. } else {
  1096. this.animation[i2](obj[i2]);
  1097. }
  1098. } catch (e2) {
  1099. formatAppLog("error", "at uni_modules/uni-transition/components/uni-transition/uni-transition.vue:148", `方法 ${i2} 不存在`);
  1100. }
  1101. }
  1102. this.animation.step(config);
  1103. return this;
  1104. },
  1105. /**
  1106. * ref 触发 执行动画
  1107. */
  1108. run(fn) {
  1109. if (!this.animation)
  1110. return;
  1111. this.animation.run(fn);
  1112. },
  1113. // 开始过度动画
  1114. open() {
  1115. clearTimeout(this.timer);
  1116. this.transform = "";
  1117. this.isShow = true;
  1118. let { opacity, transform } = this.styleInit(false);
  1119. if (typeof opacity !== "undefined") {
  1120. this.opacity = opacity;
  1121. }
  1122. this.transform = transform;
  1123. this.$nextTick(() => {
  1124. this.timer = setTimeout(() => {
  1125. this.animation = createAnimation(this.config, this);
  1126. this.tranfromInit(false).step();
  1127. this.animation.run();
  1128. this.$emit("change", {
  1129. detail: this.isShow
  1130. });
  1131. }, 20);
  1132. });
  1133. },
  1134. // 关闭过度动画
  1135. close(type) {
  1136. if (!this.animation)
  1137. return;
  1138. this.tranfromInit(true).step().run(() => {
  1139. this.isShow = false;
  1140. this.animationData = null;
  1141. this.animation = null;
  1142. let { opacity, transform } = this.styleInit(false);
  1143. this.opacity = opacity || 1;
  1144. this.transform = transform;
  1145. this.$emit("change", {
  1146. detail: this.isShow
  1147. });
  1148. });
  1149. },
  1150. // 处理动画开始前的默认样式
  1151. styleInit(type) {
  1152. let styles = {
  1153. transform: ""
  1154. };
  1155. let buildStyle = (type2, mode) => {
  1156. if (mode === "fade") {
  1157. styles.opacity = this.animationType(type2)[mode];
  1158. } else {
  1159. styles.transform += this.animationType(type2)[mode] + " ";
  1160. }
  1161. };
  1162. if (typeof this.modeClass === "string") {
  1163. buildStyle(type, this.modeClass);
  1164. } else {
  1165. this.modeClass.forEach((mode) => {
  1166. buildStyle(type, mode);
  1167. });
  1168. }
  1169. return styles;
  1170. },
  1171. // 处理内置组合动画
  1172. tranfromInit(type) {
  1173. let buildTranfrom = (type2, mode) => {
  1174. let aniNum = null;
  1175. if (mode === "fade") {
  1176. aniNum = type2 ? 0 : 1;
  1177. } else {
  1178. aniNum = type2 ? "-100%" : "0";
  1179. if (mode === "zoom-in") {
  1180. aniNum = type2 ? 0.8 : 1;
  1181. }
  1182. if (mode === "zoom-out") {
  1183. aniNum = type2 ? 1.2 : 1;
  1184. }
  1185. if (mode === "slide-right") {
  1186. aniNum = type2 ? "100%" : "0";
  1187. }
  1188. if (mode === "slide-bottom") {
  1189. aniNum = type2 ? "100%" : "0";
  1190. }
  1191. }
  1192. this.animation[this.animationMode()[mode]](aniNum);
  1193. };
  1194. if (typeof this.modeClass === "string") {
  1195. buildTranfrom(type, this.modeClass);
  1196. } else {
  1197. this.modeClass.forEach((mode) => {
  1198. buildTranfrom(type, mode);
  1199. });
  1200. }
  1201. return this.animation;
  1202. },
  1203. animationType(type) {
  1204. return {
  1205. fade: type ? 1 : 0,
  1206. "slide-top": `translateY(${type ? "0" : "-100%"})`,
  1207. "slide-right": `translateX(${type ? "0" : "100%"})`,
  1208. "slide-bottom": `translateY(${type ? "0" : "100%"})`,
  1209. "slide-left": `translateX(${type ? "0" : "-100%"})`,
  1210. "zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
  1211. "zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
  1212. };
  1213. },
  1214. // 内置动画类型与实际动画对应字典
  1215. animationMode() {
  1216. return {
  1217. fade: "opacity",
  1218. "slide-top": "translateY",
  1219. "slide-right": "translateX",
  1220. "slide-bottom": "translateY",
  1221. "slide-left": "translateX",
  1222. "zoom-in": "scale",
  1223. "zoom-out": "scale"
  1224. };
  1225. },
  1226. // 驼峰转中横线
  1227. toLine(name) {
  1228. return name.replace(/([A-Z])/g, "-$1").toLowerCase();
  1229. }
  1230. }
  1231. };
  1232. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  1233. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
  1234. ref: "ani",
  1235. animation: $data.animationData,
  1236. class: vue.normalizeClass($props.customClass),
  1237. style: vue.normalizeStyle($options.transformStyles),
  1238. onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
  1239. }, [
  1240. vue.renderSlot(_ctx.$slots, "default")
  1241. ], 14, ["animation"])), [
  1242. [vue.vShow, $data.isShow]
  1243. ]);
  1244. }
  1245. const __easycom_0$2 = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$b], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]);
  1246. const _sfc_main$b = {
  1247. name: "uniPopup",
  1248. components: {},
  1249. emits: ["change", "maskClick"],
  1250. props: {
  1251. // 开启动画
  1252. animation: {
  1253. type: Boolean,
  1254. default: true
  1255. },
  1256. // 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
  1257. // message: 消息提示 ; dialog : 对话框
  1258. type: {
  1259. type: String,
  1260. default: "center"
  1261. },
  1262. // maskClick
  1263. isMaskClick: {
  1264. type: Boolean,
  1265. default: null
  1266. },
  1267. // TODO 2 个版本后废弃属性 ,使用 isMaskClick
  1268. maskClick: {
  1269. type: Boolean,
  1270. default: null
  1271. },
  1272. backgroundColor: {
  1273. type: String,
  1274. default: "none"
  1275. },
  1276. safeArea: {
  1277. type: Boolean,
  1278. default: true
  1279. },
  1280. maskBackgroundColor: {
  1281. type: String,
  1282. default: "rgba(0, 0, 0, 0.4)"
  1283. }
  1284. },
  1285. watch: {
  1286. /**
  1287. * 监听type类型
  1288. */
  1289. type: {
  1290. handler: function(type) {
  1291. if (!this.config[type])
  1292. return;
  1293. this[this.config[type]](true);
  1294. },
  1295. immediate: true
  1296. },
  1297. isDesktop: {
  1298. handler: function(newVal) {
  1299. if (!this.config[newVal])
  1300. return;
  1301. this[this.config[this.type]](true);
  1302. },
  1303. immediate: true
  1304. },
  1305. /**
  1306. * 监听遮罩是否可点击
  1307. * @param {Object} val
  1308. */
  1309. maskClick: {
  1310. handler: function(val) {
  1311. this.mkclick = val;
  1312. },
  1313. immediate: true
  1314. },
  1315. isMaskClick: {
  1316. handler: function(val) {
  1317. this.mkclick = val;
  1318. },
  1319. immediate: true
  1320. },
  1321. // H5 下禁止底部滚动
  1322. showPopup(show) {
  1323. }
  1324. },
  1325. data() {
  1326. return {
  1327. duration: 300,
  1328. ani: [],
  1329. showPopup: false,
  1330. showTrans: false,
  1331. popupWidth: 0,
  1332. popupHeight: 0,
  1333. config: {
  1334. top: "top",
  1335. bottom: "bottom",
  1336. center: "center",
  1337. left: "left",
  1338. right: "right",
  1339. message: "top",
  1340. dialog: "center",
  1341. share: "bottom"
  1342. },
  1343. maskClass: {
  1344. position: "fixed",
  1345. bottom: 0,
  1346. top: 0,
  1347. left: 0,
  1348. right: 0,
  1349. backgroundColor: "rgba(0, 0, 0, 0.4)"
  1350. },
  1351. transClass: {
  1352. position: "fixed",
  1353. left: 0,
  1354. right: 0
  1355. },
  1356. maskShow: true,
  1357. mkclick: true,
  1358. popupstyle: "top"
  1359. };
  1360. },
  1361. computed: {
  1362. isDesktop() {
  1363. return this.popupWidth >= 500 && this.popupHeight >= 500;
  1364. },
  1365. bg() {
  1366. if (this.backgroundColor === "" || this.backgroundColor === "none") {
  1367. return "transparent";
  1368. }
  1369. return this.backgroundColor;
  1370. }
  1371. },
  1372. mounted() {
  1373. const fixSize = () => {
  1374. const {
  1375. windowWidth,
  1376. windowHeight,
  1377. windowTop,
  1378. safeArea,
  1379. screenHeight,
  1380. safeAreaInsets
  1381. } = uni.getSystemInfoSync();
  1382. this.popupWidth = windowWidth;
  1383. this.popupHeight = windowHeight + (windowTop || 0);
  1384. if (safeArea && this.safeArea) {
  1385. this.safeAreaInsets = safeAreaInsets.bottom;
  1386. } else {
  1387. this.safeAreaInsets = 0;
  1388. }
  1389. };
  1390. fixSize();
  1391. },
  1392. // TODO vue3
  1393. unmounted() {
  1394. this.setH5Visible();
  1395. },
  1396. created() {
  1397. if (this.isMaskClick === null && this.maskClick === null) {
  1398. this.mkclick = true;
  1399. } else {
  1400. this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
  1401. }
  1402. if (this.animation) {
  1403. this.duration = 300;
  1404. } else {
  1405. this.duration = 0;
  1406. }
  1407. this.messageChild = null;
  1408. this.clearPropagation = false;
  1409. this.maskClass.backgroundColor = this.maskBackgroundColor;
  1410. },
  1411. methods: {
  1412. setH5Visible() {
  1413. },
  1414. /**
  1415. * 公用方法,不显示遮罩层
  1416. */
  1417. closeMask() {
  1418. this.maskShow = false;
  1419. },
  1420. /**
  1421. * 公用方法,遮罩层禁止点击
  1422. */
  1423. disableMask() {
  1424. this.mkclick = false;
  1425. },
  1426. // TODO nvue 取消冒泡
  1427. clear(e2) {
  1428. e2.stopPropagation();
  1429. this.clearPropagation = true;
  1430. },
  1431. open(direction) {
  1432. if (this.showPopup) {
  1433. return;
  1434. }
  1435. let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
  1436. if (!(direction && innerType.indexOf(direction) !== -1)) {
  1437. direction = this.type;
  1438. }
  1439. if (!this.config[direction]) {
  1440. formatAppLog("error", "at uni_modules/uni-popup/components/uni-popup/uni-popup.vue:279", "缺少类型:", direction);
  1441. return;
  1442. }
  1443. this[this.config[direction]]();
  1444. this.$emit("change", {
  1445. show: true,
  1446. type: direction
  1447. });
  1448. },
  1449. close(type) {
  1450. this.showTrans = false;
  1451. this.$emit("change", {
  1452. show: false,
  1453. type: this.type
  1454. });
  1455. clearTimeout(this.timer);
  1456. this.timer = setTimeout(() => {
  1457. this.showPopup = false;
  1458. }, 300);
  1459. },
  1460. // TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
  1461. touchstart() {
  1462. this.clearPropagation = false;
  1463. },
  1464. onTap() {
  1465. if (this.clearPropagation) {
  1466. this.clearPropagation = false;
  1467. return;
  1468. }
  1469. this.$emit("maskClick");
  1470. if (!this.mkclick)
  1471. return;
  1472. this.close();
  1473. },
  1474. /**
  1475. * 顶部弹出样式处理
  1476. */
  1477. top(type) {
  1478. this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
  1479. this.ani = ["slide-top"];
  1480. this.transClass = {
  1481. position: "fixed",
  1482. left: 0,
  1483. right: 0,
  1484. backgroundColor: this.bg
  1485. };
  1486. if (type)
  1487. return;
  1488. this.showPopup = true;
  1489. this.showTrans = true;
  1490. this.$nextTick(() => {
  1491. if (this.messageChild && this.type === "message") {
  1492. this.messageChild.timerClose();
  1493. }
  1494. });
  1495. },
  1496. /**
  1497. * 底部弹出样式处理
  1498. */
  1499. bottom(type) {
  1500. this.popupstyle = "bottom";
  1501. this.ani = ["slide-bottom"];
  1502. this.transClass = {
  1503. position: "fixed",
  1504. left: 0,
  1505. right: 0,
  1506. bottom: 0,
  1507. paddingBottom: this.safeAreaInsets + "px",
  1508. backgroundColor: this.bg
  1509. };
  1510. if (type)
  1511. return;
  1512. this.showPopup = true;
  1513. this.showTrans = true;
  1514. },
  1515. /**
  1516. * 中间弹出样式处理
  1517. */
  1518. center(type) {
  1519. this.popupstyle = "center";
  1520. this.ani = ["zoom-out", "fade"];
  1521. this.transClass = {
  1522. position: "fixed",
  1523. display: "flex",
  1524. flexDirection: "column",
  1525. bottom: 0,
  1526. left: 0,
  1527. right: 0,
  1528. top: 0,
  1529. justifyContent: "center",
  1530. alignItems: "center"
  1531. };
  1532. if (type)
  1533. return;
  1534. this.showPopup = true;
  1535. this.showTrans = true;
  1536. },
  1537. left(type) {
  1538. this.popupstyle = "left";
  1539. this.ani = ["slide-left"];
  1540. this.transClass = {
  1541. position: "fixed",
  1542. left: 0,
  1543. bottom: 0,
  1544. top: 0,
  1545. backgroundColor: this.bg,
  1546. display: "flex",
  1547. flexDirection: "column"
  1548. };
  1549. if (type)
  1550. return;
  1551. this.showPopup = true;
  1552. this.showTrans = true;
  1553. },
  1554. right(type) {
  1555. this.popupstyle = "right";
  1556. this.ani = ["slide-right"];
  1557. this.transClass = {
  1558. position: "fixed",
  1559. bottom: 0,
  1560. right: 0,
  1561. top: 0,
  1562. backgroundColor: this.bg,
  1563. display: "flex",
  1564. flexDirection: "column"
  1565. };
  1566. if (type)
  1567. return;
  1568. this.showPopup = true;
  1569. this.showTrans = true;
  1570. }
  1571. }
  1572. };
  1573. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  1574. const _component_uni_transition = resolveEasycom(vue.resolveDynamicComponent("uni-transition"), __easycom_0$2);
  1575. return $data.showPopup ? (vue.openBlock(), vue.createElementBlock(
  1576. "view",
  1577. {
  1578. key: 0,
  1579. class: vue.normalizeClass(["uni-popup", [$data.popupstyle, $options.isDesktop ? "fixforpc-z-index" : ""]])
  1580. },
  1581. [
  1582. vue.createElementVNode(
  1583. "view",
  1584. {
  1585. onTouchstart: _cache[1] || (_cache[1] = (...args) => $options.touchstart && $options.touchstart(...args))
  1586. },
  1587. [
  1588. $data.maskShow ? (vue.openBlock(), vue.createBlock(_component_uni_transition, {
  1589. key: "1",
  1590. name: "mask",
  1591. "mode-class": "fade",
  1592. styles: $data.maskClass,
  1593. duration: $data.duration,
  1594. show: $data.showTrans,
  1595. onClick: $options.onTap
  1596. }, null, 8, ["styles", "duration", "show", "onClick"])) : vue.createCommentVNode("v-if", true),
  1597. vue.createVNode(_component_uni_transition, {
  1598. key: "2",
  1599. "mode-class": $data.ani,
  1600. name: "content",
  1601. styles: $data.transClass,
  1602. duration: $data.duration,
  1603. show: $data.showTrans,
  1604. onClick: $options.onTap
  1605. }, {
  1606. default: vue.withCtx(() => [
  1607. vue.createElementVNode(
  1608. "view",
  1609. {
  1610. class: vue.normalizeClass(["uni-popup__wrapper", [$data.popupstyle]]),
  1611. style: vue.normalizeStyle({ backgroundColor: $options.bg }),
  1612. onClick: _cache[0] || (_cache[0] = (...args) => $options.clear && $options.clear(...args))
  1613. },
  1614. [
  1615. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  1616. ],
  1617. 6
  1618. /* CLASS, STYLE */
  1619. )
  1620. ]),
  1621. _: 3
  1622. /* FORWARDED */
  1623. }, 8, ["mode-class", "styles", "duration", "show", "onClick"])
  1624. ],
  1625. 32
  1626. /* NEED_HYDRATION */
  1627. )
  1628. ],
  1629. 2
  1630. /* CLASS */
  1631. )) : vue.createCommentVNode("v-if", true);
  1632. }
  1633. const __easycom_4 = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$a], ["__scopeId", "data-v-4dd3c44b"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]);
  1634. var isIOS;
  1635. function album() {
  1636. var result = 0;
  1637. var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
  1638. var authStatus = PHPhotoLibrary.authorizationStatus();
  1639. if (authStatus === 0) {
  1640. result = null;
  1641. } else if (authStatus == 3) {
  1642. result = 1;
  1643. } else {
  1644. result = 0;
  1645. }
  1646. plus.ios.deleteObject(PHPhotoLibrary);
  1647. return result;
  1648. }
  1649. function camera() {
  1650. var result = 0;
  1651. var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
  1652. var authStatus = AVCaptureDevice.authorizationStatusForMediaType("vide");
  1653. if (authStatus === 0) {
  1654. result = null;
  1655. } else if (authStatus == 3) {
  1656. result = 1;
  1657. } else {
  1658. result = 0;
  1659. }
  1660. plus.ios.deleteObject(AVCaptureDevice);
  1661. return result;
  1662. }
  1663. function location$1() {
  1664. var result = 0;
  1665. var cllocationManger = plus.ios.import("CLLocationManager");
  1666. var enable = cllocationManger.locationServicesEnabled();
  1667. var status = cllocationManger.authorizationStatus();
  1668. if (!enable) {
  1669. result = 2;
  1670. } else if (status === 0) {
  1671. result = null;
  1672. } else if (status === 3 || status === 4) {
  1673. result = 1;
  1674. } else {
  1675. result = 0;
  1676. }
  1677. plus.ios.deleteObject(cllocationManger);
  1678. return result;
  1679. }
  1680. function push() {
  1681. var result = 0;
  1682. var UIApplication = plus.ios.import("UIApplication");
  1683. var app = UIApplication.sharedApplication();
  1684. var enabledTypes = 0;
  1685. if (app.currentUserNotificationSettings) {
  1686. var settings = app.currentUserNotificationSettings();
  1687. enabledTypes = settings.plusGetAttribute("types");
  1688. if (enabledTypes == 0) {
  1689. result = 0;
  1690. formatAppLog("log", "at common/permission.js:63", "推送权限没有开启");
  1691. } else {
  1692. result = 1;
  1693. formatAppLog("log", "at common/permission.js:66", "已经开启推送功能!");
  1694. }
  1695. plus.ios.deleteObject(settings);
  1696. } else {
  1697. enabledTypes = app.enabledRemoteNotificationTypes();
  1698. if (enabledTypes == 0) {
  1699. result = 3;
  1700. formatAppLog("log", "at common/permission.js:73", "推送权限没有开启!");
  1701. } else {
  1702. result = 4;
  1703. formatAppLog("log", "at common/permission.js:76", "已经开启推送功能!");
  1704. }
  1705. }
  1706. plus.ios.deleteObject(app);
  1707. plus.ios.deleteObject(UIApplication);
  1708. return result;
  1709. }
  1710. function contact() {
  1711. var result = 0;
  1712. var CNContactStore = plus.ios.import("CNContactStore");
  1713. var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
  1714. if (cnAuthStatus === 0) {
  1715. result = null;
  1716. } else if (cnAuthStatus == 3) {
  1717. result = 1;
  1718. } else {
  1719. result = 0;
  1720. }
  1721. plus.ios.deleteObject(CNContactStore);
  1722. return result;
  1723. }
  1724. function record() {
  1725. var result = null;
  1726. var avaudiosession = plus.ios.import("AVAudioSession");
  1727. var avaudio = avaudiosession.sharedInstance();
  1728. var status = avaudio.recordPermission();
  1729. formatAppLog("log", "at common/permission.js:104", "permissionStatus:" + status);
  1730. if (status === 1970168948) {
  1731. result = null;
  1732. } else if (status === 1735552628) {
  1733. result = 1;
  1734. } else {
  1735. result = 0;
  1736. }
  1737. plus.ios.deleteObject(avaudiosession);
  1738. return result;
  1739. }
  1740. function calendar() {
  1741. var result = null;
  1742. var EKEventStore = plus.ios.import("EKEventStore");
  1743. var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
  1744. if (ekAuthStatus == 3) {
  1745. result = 1;
  1746. formatAppLog("log", "at common/permission.js:122", "日历权限已经开启");
  1747. } else {
  1748. formatAppLog("log", "at common/permission.js:124", "日历权限没有开启");
  1749. }
  1750. plus.ios.deleteObject(EKEventStore);
  1751. return result;
  1752. }
  1753. function memo() {
  1754. var result = null;
  1755. var EKEventStore = plus.ios.import("EKEventStore");
  1756. var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
  1757. if (ekAuthStatus == 3) {
  1758. result = 1;
  1759. formatAppLog("log", "at common/permission.js:136", "备忘录权限已经开启");
  1760. } else {
  1761. formatAppLog("log", "at common/permission.js:138", "备忘录权限没有开启");
  1762. }
  1763. plus.ios.deleteObject(EKEventStore);
  1764. return result;
  1765. }
  1766. function requestIOS(permissionID) {
  1767. return new Promise((resolve, reject) => {
  1768. switch (permissionID) {
  1769. case "push":
  1770. resolve(push());
  1771. break;
  1772. case "location":
  1773. resolve(location$1());
  1774. break;
  1775. case "record":
  1776. resolve(record());
  1777. break;
  1778. case "camera":
  1779. resolve(camera());
  1780. break;
  1781. case "album":
  1782. resolve(album());
  1783. break;
  1784. case "contact":
  1785. resolve(contact());
  1786. break;
  1787. case "calendar":
  1788. resolve(calendar());
  1789. break;
  1790. case "memo":
  1791. resolve(memo());
  1792. break;
  1793. default:
  1794. resolve(0);
  1795. break;
  1796. }
  1797. });
  1798. }
  1799. function requestAndroid(permissionID) {
  1800. return new Promise((resolve, reject) => {
  1801. plus.android.requestPermissions(
  1802. [permissionID],
  1803. function(resultObj) {
  1804. var result = 0;
  1805. for (var i2 = 0; i2 < resultObj.granted.length; i2++) {
  1806. var grantedPermission = resultObj.granted[i2];
  1807. formatAppLog("log", "at common/permission.js:187", "已获取的权限:" + grantedPermission);
  1808. result = 1;
  1809. }
  1810. for (var i2 = 0; i2 < resultObj.deniedPresent.length; i2++) {
  1811. var deniedPresentPermission = resultObj.deniedPresent[i2];
  1812. formatAppLog("log", "at common/permission.js:192", "拒绝本次申请的权限:" + deniedPresentPermission);
  1813. result = 0;
  1814. }
  1815. for (var i2 = 0; i2 < resultObj.deniedAlways.length; i2++) {
  1816. var deniedAlwaysPermission = resultObj.deniedAlways[i2];
  1817. formatAppLog("log", "at common/permission.js:197", "永久拒绝申请的权限:" + deniedAlwaysPermission);
  1818. result = -1;
  1819. }
  1820. resolve(result);
  1821. },
  1822. function(error) {
  1823. formatAppLog("log", "at common/permission.js:203", "result error: " + error.message);
  1824. resolve({
  1825. code: error.code,
  1826. message: error.message
  1827. });
  1828. }
  1829. );
  1830. });
  1831. }
  1832. function gotoAppPermissionSetting() {
  1833. if (permission.isIOS) {
  1834. var UIApplication = plus.ios.import("UIApplication");
  1835. var application2 = UIApplication.sharedApplication();
  1836. var NSURL2 = plus.ios.import("NSURL");
  1837. var setting2 = NSURL2.URLWithString("app-settings:");
  1838. application2.openURL(setting2);
  1839. plus.ios.deleteObject(setting2);
  1840. plus.ios.deleteObject(NSURL2);
  1841. plus.ios.deleteObject(application2);
  1842. } else {
  1843. var Intent = plus.android.importClass("android.content.Intent");
  1844. var Settings = plus.android.importClass("android.provider.Settings");
  1845. var Uri = plus.android.importClass("android.net.Uri");
  1846. var mainActivity = plus.android.runtimeMainActivity();
  1847. var intent = new Intent();
  1848. intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
  1849. var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
  1850. intent.setData(uri);
  1851. mainActivity.startActivity(intent);
  1852. }
  1853. }
  1854. const permission = {
  1855. get isIOS() {
  1856. return typeof isIOS === "boolean" ? isIOS : isIOS = uni.getSystemInfoSync().platform === "ios";
  1857. },
  1858. requestIOS,
  1859. requestAndroid,
  1860. gotoAppSetting: gotoAppPermissionSetting
  1861. };
  1862. const baseURL = "https://api.ytdeals.co.uk";
  1863. const warehouseScanURL = baseURL + "/admin/order.sheetOrder/warehouseScan";
  1864. const instockScanURL = baseURL + "/admin/order.scanOrder/instock";
  1865. const weighScanURL = baseURL + "/admin/order.scanOrder/weigh";
  1866. const loginURL = baseURL + "/admin/index/login";
  1867. const getcaptchaURL = baseURL + "/api/common/captcha";
  1868. const _sfc_main$a = {
  1869. data() {
  1870. const valiFormData = vue.reactive({
  1871. code: ""
  1872. });
  1873. const token = vue.ref(null);
  1874. const user = vue.ref(null);
  1875. return {
  1876. messageType: "",
  1877. messageText: "",
  1878. valiFormData,
  1879. token,
  1880. user,
  1881. submitFail: false,
  1882. history: [],
  1883. focusType: true,
  1884. st: -1,
  1885. hidePage: false
  1886. };
  1887. },
  1888. onLoad() {
  1889. plus.key.addEventListener("keyup", this.keypress);
  1890. },
  1891. onUnload() {
  1892. plus.key.removeEventListener("keyup", this.keypress);
  1893. },
  1894. onShow() {
  1895. this.hidePage = false;
  1896. this.token = uni.getStorageSync("token");
  1897. this.user = uni.getStorageSync("user");
  1898. },
  1899. onHide() {
  1900. this.hidePage = true;
  1901. plus.key.removeEventListener("keyup", this.keypress);
  1902. },
  1903. onBackPress() {
  1904. plus.key.removeEventListener("keyup", this.keypress);
  1905. },
  1906. methods: {
  1907. async scan() {
  1908. let status = await this.checkPermission();
  1909. if (status !== 1) {
  1910. return;
  1911. }
  1912. uni.scanCode({
  1913. success: (res) => {
  1914. this.result = res.result;
  1915. this.valiFormData.code = res.result;
  1916. this.onsubmit();
  1917. },
  1918. fail: (err) => {
  1919. }
  1920. });
  1921. },
  1922. async checkPermission(code) {
  1923. let status = permission.isIOS ? await permission.requestIOS("camera") : await permission.requestAndroid("android.permission.CAMERA");
  1924. if (status === null || status === 1) {
  1925. status = 1;
  1926. } else {
  1927. uni.showModal({
  1928. content: "Camera permission required",
  1929. confirmText: "Setting",
  1930. success: function(res) {
  1931. if (res.confirm) {
  1932. permission.gotoAppSetting();
  1933. }
  1934. }
  1935. });
  1936. }
  1937. return status;
  1938. },
  1939. async warehouseScan(order_code) {
  1940. this.st && clearTimeout(this.st);
  1941. uni.request({
  1942. url: warehouseScanURL,
  1943. method: "POST",
  1944. header: {
  1945. batoken: this.token
  1946. },
  1947. data: {
  1948. order_code
  1949. },
  1950. success: (res) => {
  1951. if (res.data.code == 1) {
  1952. this.submitFail = false;
  1953. this.messageType = "success";
  1954. this.messageText = "Submit Successed!";
  1955. this.$refs.message.open();
  1956. const historyItem = {
  1957. code: this.valiFormData.code,
  1958. createTime: /* @__PURE__ */ new Date(),
  1959. status: true
  1960. };
  1961. this.history.unshift(historyItem);
  1962. this.history.length > 10 && (this.history.length = 10);
  1963. uni.setStorageSync("history", this.history);
  1964. this.getHistory();
  1965. } else {
  1966. this.submitFail = true;
  1967. this.messageType = "error";
  1968. this.messageText = res.data.msg;
  1969. this.$refs.message.open();
  1970. const historyItem = {
  1971. code: this.valiFormData.code,
  1972. createTime: /* @__PURE__ */ new Date(),
  1973. status: false
  1974. };
  1975. this.history.unshift(historyItem);
  1976. this.history.length > 10 && (this.history.length = 10);
  1977. uni.setStorageSync("history", this.history);
  1978. this.getHistory();
  1979. }
  1980. this.st = setTimeout(() => {
  1981. this.valiFormData.code = "";
  1982. this.st && clearTimeout(this.st);
  1983. }, 1e3);
  1984. }
  1985. });
  1986. },
  1987. onsubmit() {
  1988. this.warehouseScan(this.valiFormData.code);
  1989. },
  1990. getHistory() {
  1991. this.history = uni.getStorageSync("history");
  1992. },
  1993. keypress(e2) {
  1994. formatAppLog("log", "at pages/scan/index.vue:222", e2, "按键码");
  1995. if (e2.keyCode === 102 || e2.keyCode === 103 || e2.keyCode === 104)
  1996. ;
  1997. if (e2.keyCode == 66) {
  1998. this.onsubmit();
  1999. }
  2000. },
  2001. setfocus() {
  2002. if (this.hidePage) {
  2003. return;
  2004. }
  2005. this.focusType = false;
  2006. vue.nextTick(() => {
  2007. this.focusType = true;
  2008. });
  2009. }
  2010. }
  2011. };
  2012. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  2013. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
  2014. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_3);
  2015. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_4);
  2016. return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, [
  2017. vue.createElementVNode("view", { class: "content scan-view" }, [
  2018. vue.createElementVNode("view", { class: "scan-btn-view" }, [
  2019. vue.createElementVNode("view", { class: "border-wrapper" }, [
  2020. vue.createElementVNode("div", { class: "scan-btn first" }),
  2021. vue.createElementVNode("div", { class: "scan-btn second" })
  2022. ]),
  2023. vue.createElementVNode("button", {
  2024. class: "scan-btn",
  2025. onClick: _cache[0] || (_cache[0] = (...args) => $options.scan && $options.scan(...args))
  2026. }, [
  2027. vue.createVNode(_component_uni_icons, {
  2028. type: "scan",
  2029. size: "40",
  2030. color: "white"
  2031. })
  2032. ])
  2033. ]),
  2034. vue.createElementVNode("view", { class: "text-area" }, [
  2035. vue.createElementVNode("text", { class: "title" }, "Scan Code")
  2036. ]),
  2037. vue.withDirectives(vue.createElementVNode("input", {
  2038. class: "inputSty",
  2039. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.valiFormData.code = $event),
  2040. focus: $data.focusType,
  2041. onBlur: _cache[2] || (_cache[2] = (...args) => $options.setfocus && $options.setfocus(...args)),
  2042. onConfirm: _cache[3] || (_cache[3] = (...args) => $options.onsubmit && $options.onsubmit(...args)),
  2043. placeholder: "Please enter the tracking number",
  2044. "placeholder-style": "font-size:12px"
  2045. }, null, 40, ["focus"]), [
  2046. [vue.vModelText, $data.valiFormData.code]
  2047. ]),
  2048. vue.createElementVNode("view", { class: "input-view" }, [
  2049. vue.createCommentVNode(' <text v-if="valiFormData.code">\r\n Scan Result: {{valiFormData.code}}\r\n </text> '),
  2050. vue.createElementVNode("button", {
  2051. disabled: $data.valiFormData.code.length === 0,
  2052. class: "submit-btn",
  2053. onClick: _cache[4] || (_cache[4] = (...args) => $options.onsubmit && $options.onsubmit(...args)),
  2054. size: "mini"
  2055. }, [
  2056. vue.createVNode(_component_uni_icons, {
  2057. type: "checkmarkempty",
  2058. size: "12",
  2059. color: $data.valiFormData.code.length === 0 ? "gray" : "white"
  2060. }, null, 8, ["color"]),
  2061. vue.createElementVNode(
  2062. "text",
  2063. {
  2064. style: vue.normalizeStyle({ color: $data.valiFormData.code.length === 0 ? "gray" : "white" })
  2065. },
  2066. " Submit ",
  2067. 4
  2068. /* STYLE */
  2069. )
  2070. ], 8, ["disabled"])
  2071. ]),
  2072. $data.history.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  2073. key: 0,
  2074. class: "history"
  2075. }, [
  2076. vue.createElementVNode("text", { class: "title" }, " History ")
  2077. ])) : vue.createCommentVNode("v-if", true)
  2078. ]),
  2079. vue.createElementVNode("view", { class: "history" }, [
  2080. (vue.openBlock(true), vue.createElementBlock(
  2081. vue.Fragment,
  2082. null,
  2083. vue.renderList($data.history, (item, i2) => {
  2084. return vue.openBlock(), vue.createElementBlock("view", { class: "item" }, [
  2085. vue.createElementVNode(
  2086. "text",
  2087. {
  2088. class: "code",
  2089. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  2090. },
  2091. vue.toDisplayString(item.code),
  2092. 5
  2093. /* TEXT, STYLE */
  2094. ),
  2095. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  2096. key: 0,
  2097. type: "checkmarkempty",
  2098. class: "status",
  2099. size: "16",
  2100. color: "green"
  2101. })) : (vue.openBlock(), vue.createElementBlock("text", {
  2102. key: 1,
  2103. class: "status fail"
  2104. }, "F")),
  2105. vue.createElementVNode(
  2106. "text",
  2107. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  2108. vue.toDisplayString("\r\n" + item.createTime),
  2109. 1
  2110. /* TEXT */
  2111. )
  2112. ]);
  2113. }),
  2114. 256
  2115. /* UNKEYED_FRAGMENT */
  2116. ))
  2117. ]),
  2118. vue.createVNode(
  2119. _component_uni_popup,
  2120. {
  2121. ref: "message",
  2122. type: "message"
  2123. },
  2124. {
  2125. default: vue.withCtx(() => [
  2126. vue.createVNode(_component_uni_popup_message, {
  2127. type: $data.messageType,
  2128. message: $data.messageText,
  2129. duration: 2e3
  2130. }, null, 8, ["type", "message"])
  2131. ]),
  2132. _: 1
  2133. /* STABLE */
  2134. },
  2135. 512
  2136. /* NEED_PATCH */
  2137. )
  2138. ]);
  2139. }
  2140. const PagesScanIndex = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$9], ["__file", "E:/HBuilderProjects/yta/pages/scan/index.vue"]]);
  2141. function obj2strClass(obj) {
  2142. let classess = "";
  2143. for (let key in obj) {
  2144. const val = obj[key];
  2145. if (val) {
  2146. classess += `${key} `;
  2147. }
  2148. }
  2149. return classess;
  2150. }
  2151. function obj2strStyle(obj) {
  2152. let style = "";
  2153. for (let key in obj) {
  2154. const val = obj[key];
  2155. style += `${key}:${val};`;
  2156. }
  2157. return style;
  2158. }
  2159. const _sfc_main$9 = {
  2160. name: "uni-easyinput",
  2161. emits: ["click", "iconClick", "update:modelValue", "input", "focus", "blur", "confirm", "clear", "eyes", "change", "keyboardheightchange"],
  2162. model: {
  2163. prop: "modelValue",
  2164. event: "update:modelValue"
  2165. },
  2166. options: {
  2167. virtualHost: true
  2168. },
  2169. inject: {
  2170. form: {
  2171. from: "uniForm",
  2172. default: null
  2173. },
  2174. formItem: {
  2175. from: "uniFormItem",
  2176. default: null
  2177. }
  2178. },
  2179. props: {
  2180. name: String,
  2181. value: [Number, String],
  2182. modelValue: [Number, String],
  2183. type: {
  2184. type: String,
  2185. default: "text"
  2186. },
  2187. clearable: {
  2188. type: Boolean,
  2189. default: true
  2190. },
  2191. autoHeight: {
  2192. type: Boolean,
  2193. default: false
  2194. },
  2195. placeholder: {
  2196. type: String,
  2197. default: " "
  2198. },
  2199. placeholderStyle: String,
  2200. focus: {
  2201. type: Boolean,
  2202. default: false
  2203. },
  2204. disabled: {
  2205. type: Boolean,
  2206. default: false
  2207. },
  2208. maxlength: {
  2209. type: [Number, String],
  2210. default: 140
  2211. },
  2212. confirmType: {
  2213. type: String,
  2214. default: "done"
  2215. },
  2216. clearSize: {
  2217. type: [Number, String],
  2218. default: 24
  2219. },
  2220. inputBorder: {
  2221. type: Boolean,
  2222. default: true
  2223. },
  2224. prefixIcon: {
  2225. type: String,
  2226. default: ""
  2227. },
  2228. suffixIcon: {
  2229. type: String,
  2230. default: ""
  2231. },
  2232. trim: {
  2233. type: [Boolean, String],
  2234. default: false
  2235. },
  2236. cursorSpacing: {
  2237. type: Number,
  2238. default: 0
  2239. },
  2240. passwordIcon: {
  2241. type: Boolean,
  2242. default: true
  2243. },
  2244. primaryColor: {
  2245. type: String,
  2246. default: "#2979ff"
  2247. },
  2248. styles: {
  2249. type: Object,
  2250. default() {
  2251. return {
  2252. color: "#333",
  2253. backgroundColor: "#fff",
  2254. disableColor: "#F7F6F6",
  2255. borderColor: "#e5e5e5"
  2256. };
  2257. }
  2258. },
  2259. errorMessage: {
  2260. type: [String, Boolean],
  2261. default: ""
  2262. }
  2263. },
  2264. data() {
  2265. return {
  2266. focused: false,
  2267. val: "",
  2268. showMsg: "",
  2269. border: false,
  2270. isFirstBorder: false,
  2271. showClearIcon: false,
  2272. showPassword: false,
  2273. focusShow: false,
  2274. localMsg: "",
  2275. isEnter: false
  2276. // 用于判断当前是否是使用回车操作
  2277. };
  2278. },
  2279. computed: {
  2280. // 输入框内是否有值
  2281. isVal() {
  2282. const val = this.val;
  2283. if (val || val === 0) {
  2284. return true;
  2285. }
  2286. return false;
  2287. },
  2288. msg() {
  2289. return this.localMsg || this.errorMessage;
  2290. },
  2291. // 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
  2292. inputMaxlength() {
  2293. return Number(this.maxlength);
  2294. },
  2295. // 处理外层样式的style
  2296. boxStyle() {
  2297. return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`;
  2298. },
  2299. // input 内容的类和样式处理
  2300. inputContentClass() {
  2301. return obj2strClass({
  2302. "is-input-border": this.inputBorder,
  2303. "is-input-error-border": this.inputBorder && this.msg,
  2304. "is-textarea": this.type === "textarea",
  2305. "is-disabled": this.disabled,
  2306. "is-focused": this.focusShow
  2307. });
  2308. },
  2309. inputContentStyle() {
  2310. const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor;
  2311. const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor;
  2312. return obj2strStyle({
  2313. "border-color": borderColor || "#e5e5e5",
  2314. "background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor
  2315. });
  2316. },
  2317. // input右侧样式
  2318. inputStyle() {
  2319. const paddingRight = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px";
  2320. return obj2strStyle({
  2321. "padding-right": paddingRight,
  2322. "padding-left": this.prefixIcon ? "" : "10px"
  2323. });
  2324. }
  2325. },
  2326. watch: {
  2327. value(newVal) {
  2328. this.val = newVal;
  2329. },
  2330. modelValue(newVal) {
  2331. this.val = newVal;
  2332. },
  2333. focus(newVal) {
  2334. this.$nextTick(() => {
  2335. this.focused = this.focus;
  2336. this.focusShow = this.focus;
  2337. });
  2338. }
  2339. },
  2340. created() {
  2341. this.init();
  2342. if (this.form && this.formItem) {
  2343. this.$watch("formItem.errMsg", (newVal) => {
  2344. this.localMsg = newVal;
  2345. });
  2346. }
  2347. },
  2348. mounted() {
  2349. this.$nextTick(() => {
  2350. this.focused = this.focus;
  2351. this.focusShow = this.focus;
  2352. });
  2353. },
  2354. methods: {
  2355. /**
  2356. * 初始化变量值
  2357. */
  2358. init() {
  2359. if (this.value || this.value === 0) {
  2360. this.val = this.value;
  2361. } else if (this.modelValue || this.modelValue === 0 || this.modelValue === "") {
  2362. this.val = this.modelValue;
  2363. } else {
  2364. this.val = null;
  2365. }
  2366. },
  2367. /**
  2368. * 点击图标时触发
  2369. * @param {Object} type
  2370. */
  2371. onClickIcon(type) {
  2372. this.$emit("iconClick", type);
  2373. },
  2374. /**
  2375. * 显示隐藏内容,密码框时生效
  2376. */
  2377. onEyes() {
  2378. this.showPassword = !this.showPassword;
  2379. this.$emit("eyes", this.showPassword);
  2380. },
  2381. /**
  2382. * 输入时触发
  2383. * @param {Object} event
  2384. */
  2385. onInput(event) {
  2386. let value = event.detail.value;
  2387. if (this.trim) {
  2388. if (typeof this.trim === "boolean" && this.trim) {
  2389. value = this.trimStr(value);
  2390. }
  2391. if (typeof this.trim === "string") {
  2392. value = this.trimStr(value, this.trim);
  2393. }
  2394. }
  2395. if (this.errMsg)
  2396. this.errMsg = "";
  2397. this.val = value;
  2398. this.$emit("input", value);
  2399. this.$emit("update:modelValue", value);
  2400. },
  2401. /**
  2402. * 外部调用方法
  2403. * 获取焦点时触发
  2404. * @param {Object} event
  2405. */
  2406. onFocus() {
  2407. this.$nextTick(() => {
  2408. this.focused = true;
  2409. });
  2410. this.$emit("focus", null);
  2411. },
  2412. _Focus(event) {
  2413. this.focusShow = true;
  2414. this.$emit("focus", event);
  2415. },
  2416. /**
  2417. * 外部调用方法
  2418. * 失去焦点时触发
  2419. * @param {Object} event
  2420. */
  2421. onBlur() {
  2422. this.focused = false;
  2423. this.$emit("focus", null);
  2424. },
  2425. _Blur(event) {
  2426. event.detail.value;
  2427. this.focusShow = false;
  2428. this.$emit("blur", event);
  2429. if (this.isEnter === false) {
  2430. this.$emit("change", this.val);
  2431. }
  2432. if (this.form && this.formItem) {
  2433. const { validateTrigger } = this.form;
  2434. if (validateTrigger === "blur") {
  2435. this.formItem.onFieldChange();
  2436. }
  2437. }
  2438. },
  2439. /**
  2440. * 按下键盘的发送键
  2441. * @param {Object} e
  2442. */
  2443. onConfirm(e2) {
  2444. this.$emit("confirm", this.val);
  2445. this.isEnter = true;
  2446. this.$emit("change", this.val);
  2447. this.$nextTick(() => {
  2448. this.isEnter = false;
  2449. });
  2450. },
  2451. /**
  2452. * 清理内容
  2453. * @param {Object} event
  2454. */
  2455. onClear(event) {
  2456. this.val = "";
  2457. this.$emit("input", "");
  2458. this.$emit("update:modelValue", "");
  2459. this.$emit("clear");
  2460. },
  2461. /**
  2462. * 键盘高度发生变化的时候触发此事件
  2463. * 兼容性:微信小程序2.7.0+、App 3.1.0+
  2464. * @param {Object} event
  2465. */
  2466. onkeyboardheightchange(event) {
  2467. this.$emit("keyboardheightchange", event);
  2468. },
  2469. /**
  2470. * 去除空格
  2471. */
  2472. trimStr(str, pos = "both") {
  2473. if (pos === "both") {
  2474. return str.trim();
  2475. } else if (pos === "left") {
  2476. return str.trimLeft();
  2477. } else if (pos === "right") {
  2478. return str.trimRight();
  2479. } else if (pos === "start") {
  2480. return str.trimStart();
  2481. } else if (pos === "end") {
  2482. return str.trimEnd();
  2483. } else if (pos === "all") {
  2484. return str.replace(/\s+/g, "");
  2485. } else if (pos === "none") {
  2486. return str;
  2487. }
  2488. return str;
  2489. }
  2490. }
  2491. };
  2492. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  2493. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
  2494. return vue.openBlock(), vue.createElementBlock(
  2495. "view",
  2496. {
  2497. class: vue.normalizeClass(["uni-easyinput", { "uni-easyinput-error": $options.msg }]),
  2498. style: vue.normalizeStyle($options.boxStyle)
  2499. },
  2500. [
  2501. vue.createElementVNode(
  2502. "view",
  2503. {
  2504. class: vue.normalizeClass(["uni-easyinput__content", $options.inputContentClass]),
  2505. style: vue.normalizeStyle($options.inputContentStyle)
  2506. },
  2507. [
  2508. $props.prefixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  2509. key: 0,
  2510. class: "content-clear-icon",
  2511. type: $props.prefixIcon,
  2512. color: "#c0c4cc",
  2513. onClick: _cache[0] || (_cache[0] = ($event) => $options.onClickIcon("prefix")),
  2514. size: "22"
  2515. }, null, 8, ["type"])) : vue.createCommentVNode("v-if", true),
  2516. $props.type === "textarea" ? (vue.openBlock(), vue.createElementBlock("textarea", {
  2517. key: 1,
  2518. class: vue.normalizeClass(["uni-easyinput__content-textarea", { "input-padding": $props.inputBorder }]),
  2519. name: $props.name,
  2520. value: $data.val,
  2521. placeholder: $props.placeholder,
  2522. placeholderStyle: $props.placeholderStyle,
  2523. disabled: $props.disabled,
  2524. "placeholder-class": "uni-easyinput__placeholder-class",
  2525. maxlength: $options.inputMaxlength,
  2526. focus: $data.focused,
  2527. autoHeight: $props.autoHeight,
  2528. "cursor-spacing": $props.cursorSpacing,
  2529. onInput: _cache[1] || (_cache[1] = (...args) => $options.onInput && $options.onInput(...args)),
  2530. onBlur: _cache[2] || (_cache[2] = (...args) => $options._Blur && $options._Blur(...args)),
  2531. onFocus: _cache[3] || (_cache[3] = (...args) => $options._Focus && $options._Focus(...args)),
  2532. onConfirm: _cache[4] || (_cache[4] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
  2533. onKeyboardheightchange: _cache[5] || (_cache[5] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
  2534. }, null, 42, ["name", "value", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "autoHeight", "cursor-spacing"])) : (vue.openBlock(), vue.createElementBlock("input", {
  2535. key: 2,
  2536. type: $props.type === "password" ? "text" : $props.type,
  2537. class: "uni-easyinput__content-input",
  2538. style: vue.normalizeStyle($options.inputStyle),
  2539. name: $props.name,
  2540. value: $data.val,
  2541. password: !$data.showPassword && $props.type === "password",
  2542. placeholder: $props.placeholder,
  2543. placeholderStyle: $props.placeholderStyle,
  2544. "placeholder-class": "uni-easyinput__placeholder-class",
  2545. disabled: $props.disabled,
  2546. maxlength: $options.inputMaxlength,
  2547. focus: $data.focused,
  2548. confirmType: $props.confirmType,
  2549. "cursor-spacing": $props.cursorSpacing,
  2550. onFocus: _cache[6] || (_cache[6] = (...args) => $options._Focus && $options._Focus(...args)),
  2551. onBlur: _cache[7] || (_cache[7] = (...args) => $options._Blur && $options._Blur(...args)),
  2552. onInput: _cache[8] || (_cache[8] = (...args) => $options.onInput && $options.onInput(...args)),
  2553. onConfirm: _cache[9] || (_cache[9] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
  2554. onKeyboardheightchange: _cache[10] || (_cache[10] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
  2555. }, null, 44, ["type", "name", "value", "password", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "confirmType", "cursor-spacing"])),
  2556. $props.type === "password" && $props.passwordIcon ? (vue.openBlock(), vue.createElementBlock(
  2557. vue.Fragment,
  2558. { key: 3 },
  2559. [
  2560. vue.createCommentVNode(" 开启密码时显示小眼睛 "),
  2561. $options.isVal ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  2562. key: 0,
  2563. class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
  2564. type: $data.showPassword ? "eye-slash-filled" : "eye-filled",
  2565. size: 22,
  2566. color: $data.focusShow ? $props.primaryColor : "#c0c4cc",
  2567. onClick: $options.onEyes
  2568. }, null, 8, ["class", "type", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
  2569. ],
  2570. 64
  2571. /* STABLE_FRAGMENT */
  2572. )) : $props.suffixIcon ? (vue.openBlock(), vue.createElementBlock(
  2573. vue.Fragment,
  2574. { key: 4 },
  2575. [
  2576. $props.suffixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  2577. key: 0,
  2578. class: "content-clear-icon",
  2579. type: $props.suffixIcon,
  2580. color: "#c0c4cc",
  2581. onClick: _cache[11] || (_cache[11] = ($event) => $options.onClickIcon("suffix")),
  2582. size: "22"
  2583. }, null, 8, ["type"])) : vue.createCommentVNode("v-if", true)
  2584. ],
  2585. 64
  2586. /* STABLE_FRAGMENT */
  2587. )) : (vue.openBlock(), vue.createElementBlock(
  2588. vue.Fragment,
  2589. { key: 5 },
  2590. [
  2591. $props.clearable && $options.isVal && !$props.disabled && $props.type !== "textarea" ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  2592. key: 0,
  2593. class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
  2594. type: "clear",
  2595. size: $props.clearSize,
  2596. color: $options.msg ? "#dd524d" : $data.focusShow ? $props.primaryColor : "#c0c4cc",
  2597. onClick: $options.onClear
  2598. }, null, 8, ["class", "size", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
  2599. ],
  2600. 64
  2601. /* STABLE_FRAGMENT */
  2602. )),
  2603. vue.renderSlot(_ctx.$slots, "right", {}, void 0, true)
  2604. ],
  2605. 6
  2606. /* CLASS, STYLE */
  2607. )
  2608. ],
  2609. 6
  2610. /* CLASS, STYLE */
  2611. );
  2612. }
  2613. const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$8], ["__scopeId", "data-v-09fd5285"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue"]]);
  2614. const _sfc_main$8 = {
  2615. name: "uniFormsItem",
  2616. options: {
  2617. virtualHost: true
  2618. },
  2619. provide() {
  2620. return {
  2621. uniFormItem: this
  2622. };
  2623. },
  2624. inject: {
  2625. form: {
  2626. from: "uniForm",
  2627. default: null
  2628. }
  2629. },
  2630. props: {
  2631. // 表单校验规则
  2632. rules: {
  2633. type: Array,
  2634. default() {
  2635. return null;
  2636. }
  2637. },
  2638. // 表单域的属性名,在使用校验规则时必填
  2639. name: {
  2640. type: [String, Array],
  2641. default: ""
  2642. },
  2643. required: {
  2644. type: Boolean,
  2645. default: false
  2646. },
  2647. label: {
  2648. type: String,
  2649. default: ""
  2650. },
  2651. // label的宽度
  2652. labelWidth: {
  2653. type: [String, Number],
  2654. default: ""
  2655. },
  2656. // label 居中方式,默认 left 取值 left/center/right
  2657. labelAlign: {
  2658. type: String,
  2659. default: ""
  2660. },
  2661. // 强制显示错误信息
  2662. errorMessage: {
  2663. type: [String, Boolean],
  2664. default: ""
  2665. },
  2666. // 1.4.0 弃用,统一使用 form 的校验时机
  2667. // validateTrigger: {
  2668. // type: String,
  2669. // default: ''
  2670. // },
  2671. // 1.4.0 弃用,统一使用 form 的label 位置
  2672. // labelPosition: {
  2673. // type: String,
  2674. // default: ''
  2675. // },
  2676. // 1.4.0 以下属性已经废弃,请使用 #label 插槽代替
  2677. leftIcon: String,
  2678. iconColor: {
  2679. type: String,
  2680. default: "#606266"
  2681. }
  2682. },
  2683. data() {
  2684. return {
  2685. errMsg: "",
  2686. userRules: null,
  2687. localLabelAlign: "left",
  2688. localLabelWidth: "70px",
  2689. localLabelPos: "left",
  2690. border: false,
  2691. isFirstBorder: false
  2692. };
  2693. },
  2694. computed: {
  2695. // 处理错误信息
  2696. msg() {
  2697. return this.errorMessage || this.errMsg;
  2698. }
  2699. },
  2700. watch: {
  2701. // 规则发生变化通知子组件更新
  2702. "form.formRules"(val) {
  2703. this.init();
  2704. },
  2705. "form.labelWidth"(val) {
  2706. this.localLabelWidth = this._labelWidthUnit(val);
  2707. },
  2708. "form.labelPosition"(val) {
  2709. this.localLabelPos = this._labelPosition();
  2710. },
  2711. "form.labelAlign"(val) {
  2712. }
  2713. },
  2714. created() {
  2715. this.init(true);
  2716. if (this.name && this.form) {
  2717. this.$watch(
  2718. () => {
  2719. const val = this.form._getDataValue(this.name, this.form.localData);
  2720. return val;
  2721. },
  2722. (value, oldVal) => {
  2723. const isEqual2 = this.form._isEqual(value, oldVal);
  2724. if (!isEqual2) {
  2725. const val = this.itemSetValue(value);
  2726. this.onFieldChange(val, false);
  2727. }
  2728. },
  2729. {
  2730. immediate: false
  2731. }
  2732. );
  2733. }
  2734. },
  2735. unmounted() {
  2736. this.__isUnmounted = true;
  2737. this.unInit();
  2738. },
  2739. methods: {
  2740. /**
  2741. * 外部调用方法
  2742. * 设置规则 ,主要用于小程序自定义检验规则
  2743. * @param {Array} rules 规则源数据
  2744. */
  2745. setRules(rules = null) {
  2746. this.userRules = rules;
  2747. this.init(false);
  2748. },
  2749. // 兼容老版本表单组件
  2750. setValue() {
  2751. },
  2752. /**
  2753. * 外部调用方法
  2754. * 校验数据
  2755. * @param {any} value 需要校验的数据
  2756. * @param {boolean} 是否立即校验
  2757. * @return {Array|null} 校验内容
  2758. */
  2759. async onFieldChange(value, formtrigger = true) {
  2760. const {
  2761. formData,
  2762. localData,
  2763. errShowType,
  2764. validateCheck,
  2765. validateTrigger,
  2766. _isRequiredField,
  2767. _realName
  2768. } = this.form;
  2769. const name = _realName(this.name);
  2770. if (!value) {
  2771. value = this.form.formData[name];
  2772. }
  2773. const ruleLen = this.itemRules.rules && this.itemRules.rules.length;
  2774. if (!this.validator || !ruleLen || ruleLen === 0)
  2775. return;
  2776. const isRequiredField2 = _isRequiredField(this.itemRules.rules || []);
  2777. let result = null;
  2778. if (validateTrigger === "bind" || formtrigger) {
  2779. result = await this.validator.validateUpdate(
  2780. {
  2781. [name]: value
  2782. },
  2783. formData
  2784. );
  2785. if (!isRequiredField2 && (value === void 0 || value === "")) {
  2786. result = null;
  2787. }
  2788. if (result && result.errorMessage) {
  2789. if (errShowType === "undertext") {
  2790. this.errMsg = !result ? "" : result.errorMessage;
  2791. }
  2792. if (errShowType === "toast") {
  2793. uni.showToast({
  2794. title: result.errorMessage || "校验错误",
  2795. icon: "none"
  2796. });
  2797. }
  2798. if (errShowType === "modal") {
  2799. uni.showModal({
  2800. title: "提示",
  2801. content: result.errorMessage || "校验错误"
  2802. });
  2803. }
  2804. } else {
  2805. this.errMsg = "";
  2806. }
  2807. validateCheck(result ? result : null);
  2808. } else {
  2809. this.errMsg = "";
  2810. }
  2811. return result ? result : null;
  2812. },
  2813. /**
  2814. * 初始组件数据
  2815. */
  2816. init(type = false) {
  2817. const {
  2818. validator,
  2819. formRules,
  2820. childrens,
  2821. formData,
  2822. localData,
  2823. _realName,
  2824. labelWidth,
  2825. _getDataValue,
  2826. _setDataValue
  2827. } = this.form || {};
  2828. this.localLabelAlign = this._justifyContent();
  2829. this.localLabelWidth = this._labelWidthUnit(labelWidth);
  2830. this.localLabelPos = this._labelPosition();
  2831. this.form && type && childrens.push(this);
  2832. if (!validator || !formRules)
  2833. return;
  2834. if (!this.form.isFirstBorder) {
  2835. this.form.isFirstBorder = true;
  2836. this.isFirstBorder = true;
  2837. }
  2838. if (this.group) {
  2839. if (!this.group.isFirstBorder) {
  2840. this.group.isFirstBorder = true;
  2841. this.isFirstBorder = true;
  2842. }
  2843. }
  2844. this.border = this.form.border;
  2845. const name = _realName(this.name);
  2846. const itemRule = this.userRules || this.rules;
  2847. if (typeof formRules === "object" && itemRule) {
  2848. formRules[name] = {
  2849. rules: itemRule
  2850. };
  2851. validator.updateSchema(formRules);
  2852. }
  2853. const itemRules = formRules[name] || {};
  2854. this.itemRules = itemRules;
  2855. this.validator = validator;
  2856. this.itemSetValue(_getDataValue(this.name, localData));
  2857. },
  2858. unInit() {
  2859. if (this.form) {
  2860. const {
  2861. childrens,
  2862. formData,
  2863. _realName
  2864. } = this.form;
  2865. childrens.forEach((item, index) => {
  2866. if (item === this) {
  2867. this.form.childrens.splice(index, 1);
  2868. delete formData[_realName(item.name)];
  2869. }
  2870. });
  2871. }
  2872. },
  2873. // 设置item 的值
  2874. itemSetValue(value) {
  2875. const name = this.form._realName(this.name);
  2876. const rules = this.itemRules.rules || [];
  2877. const val = this.form._getValue(name, value, rules);
  2878. this.form._setDataValue(name, this.form.formData, val);
  2879. return val;
  2880. },
  2881. /**
  2882. * 移除该表单项的校验结果
  2883. */
  2884. clearValidate() {
  2885. this.errMsg = "";
  2886. },
  2887. // 是否显示星号
  2888. _isRequired() {
  2889. return this.required;
  2890. },
  2891. // 处理对齐方式
  2892. _justifyContent() {
  2893. if (this.form) {
  2894. const {
  2895. labelAlign
  2896. } = this.form;
  2897. let labelAli = this.labelAlign ? this.labelAlign : labelAlign;
  2898. if (labelAli === "left")
  2899. return "flex-start";
  2900. if (labelAli === "center")
  2901. return "center";
  2902. if (labelAli === "right")
  2903. return "flex-end";
  2904. }
  2905. return "flex-start";
  2906. },
  2907. // 处理 label宽度单位 ,继承父元素的值
  2908. _labelWidthUnit(labelWidth) {
  2909. return this.num2px(this.labelWidth ? this.labelWidth : labelWidth || (this.label ? 70 : "auto"));
  2910. },
  2911. // 处理 label 位置
  2912. _labelPosition() {
  2913. if (this.form)
  2914. return this.form.labelPosition || "left";
  2915. return "left";
  2916. },
  2917. /**
  2918. * 触发时机
  2919. * @param {Object} rule 当前规则内时机
  2920. * @param {Object} itemRlue 当前组件时机
  2921. * @param {Object} parentRule 父组件时机
  2922. */
  2923. isTrigger(rule, itemRlue, parentRule) {
  2924. if (rule === "submit" || !rule) {
  2925. if (rule === void 0) {
  2926. if (itemRlue !== "bind") {
  2927. if (!itemRlue) {
  2928. return parentRule === "" ? "bind" : "submit";
  2929. }
  2930. return "submit";
  2931. }
  2932. return "bind";
  2933. }
  2934. return "submit";
  2935. }
  2936. return "bind";
  2937. },
  2938. num2px(num) {
  2939. if (typeof num === "number") {
  2940. return `${num}px`;
  2941. }
  2942. return num;
  2943. }
  2944. }
  2945. };
  2946. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  2947. return vue.openBlock(), vue.createElementBlock(
  2948. "view",
  2949. {
  2950. class: vue.normalizeClass(["uni-forms-item", ["is-direction-" + $data.localLabelPos, $data.border ? "uni-forms-item--border" : "", $data.border && $data.isFirstBorder ? "is-first-border" : ""]])
  2951. },
  2952. [
  2953. vue.renderSlot(_ctx.$slots, "label", {}, () => [
  2954. vue.createElementVNode(
  2955. "view",
  2956. {
  2957. class: vue.normalizeClass(["uni-forms-item__label", { "no-label": !$props.label && !$props.required }]),
  2958. style: vue.normalizeStyle({ width: $data.localLabelWidth, justifyContent: $data.localLabelAlign })
  2959. },
  2960. [
  2961. $props.required ? (vue.openBlock(), vue.createElementBlock("text", {
  2962. key: 0,
  2963. class: "is-required"
  2964. }, "*")) : vue.createCommentVNode("v-if", true),
  2965. vue.createElementVNode(
  2966. "text",
  2967. null,
  2968. vue.toDisplayString($props.label),
  2969. 1
  2970. /* TEXT */
  2971. )
  2972. ],
  2973. 6
  2974. /* CLASS, STYLE */
  2975. )
  2976. ], true),
  2977. vue.createElementVNode("view", { class: "uni-forms-item__content" }, [
  2978. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
  2979. vue.createElementVNode(
  2980. "view",
  2981. {
  2982. class: vue.normalizeClass(["uni-forms-item__error", { "msg--active": $options.msg }])
  2983. },
  2984. [
  2985. vue.createElementVNode(
  2986. "text",
  2987. null,
  2988. vue.toDisplayString($options.msg),
  2989. 1
  2990. /* TEXT */
  2991. )
  2992. ],
  2993. 2
  2994. /* CLASS */
  2995. )
  2996. ])
  2997. ],
  2998. 2
  2999. /* CLASS */
  3000. );
  3001. }
  3002. const __easycom_1 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7], ["__scopeId", "data-v-462874dd"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue"]]);
  3003. const pages = [
  3004. {
  3005. path: "pages/scan/index",
  3006. style: {
  3007. navigationBarTitleText: "WAREHOUSE SCANNING"
  3008. }
  3009. },
  3010. {
  3011. path: "pages/instock/index",
  3012. style: {
  3013. navigationBarTitleText: "SCAN INSTOCK"
  3014. }
  3015. },
  3016. {
  3017. path: "pages/profile/index",
  3018. style: {
  3019. navigationBarTitleText: "PROFILE"
  3020. }
  3021. },
  3022. {
  3023. path: "pages/login/index",
  3024. style: {
  3025. navigationBarTitleText: "LOGIN"
  3026. }
  3027. }
  3028. ];
  3029. const globalStyle = {
  3030. navigationBarTextStyle: "black",
  3031. navigationBarTitleText: "uni-app",
  3032. navigationBarBackgroundColor: "#F8F8F8",
  3033. backgroundColor: "#F8F8F8"
  3034. };
  3035. const tabBar = {
  3036. color: "#7A7E83",
  3037. selectedColor: "#007AFF",
  3038. borderStyle: "black",
  3039. backgroundColor: "#F8F8F8",
  3040. list: [
  3041. {
  3042. pagePath: "pages/scan/index",
  3043. iconPath: "static/scan.png",
  3044. selectedIconPath: "static/scan_fill.png",
  3045. text: "Scan"
  3046. },
  3047. {
  3048. pagePath: "pages/instock/index",
  3049. iconPath: "static/weigh.png",
  3050. selectedIconPath: "static/weigh_fill.png",
  3051. text: "Instock"
  3052. },
  3053. {
  3054. pagePath: "pages/profile/index",
  3055. iconPath: "static/people.png",
  3056. selectedIconPath: "static/people_fill.png",
  3057. text: "Profile"
  3058. }
  3059. ]
  3060. };
  3061. const uniIdRouter = {};
  3062. const e = {
  3063. pages,
  3064. globalStyle,
  3065. tabBar,
  3066. uniIdRouter
  3067. };
  3068. var define_process_env_UNI_SECURE_NETWORK_CONFIG_default = [];
  3069. function t$2(e2) {
  3070. return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
  3071. }
  3072. function n(e2, t2, n2) {
  3073. return e2(n2 = { path: t2, exports: {}, require: function(e3, t3) {
  3074. return function() {
  3075. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  3076. }(null == t3 && n2.path);
  3077. } }, n2.exports), n2.exports;
  3078. }
  3079. var s = n(function(e2, t2) {
  3080. var n2;
  3081. e2.exports = (n2 = n2 || function(e3, t3) {
  3082. var n3 = Object.create || /* @__PURE__ */ function() {
  3083. function e4() {
  3084. }
  3085. return function(t4) {
  3086. var n4;
  3087. return e4.prototype = t4, n4 = new e4(), e4.prototype = null, n4;
  3088. };
  3089. }(), s2 = {}, r2 = s2.lib = {}, i2 = r2.Base = { extend: function(e4) {
  3090. var t4 = n3(this);
  3091. return e4 && t4.mixIn(e4), t4.hasOwnProperty("init") && this.init !== t4.init || (t4.init = function() {
  3092. t4.$super.init.apply(this, arguments);
  3093. }), t4.init.prototype = t4, t4.$super = this, t4;
  3094. }, create: function() {
  3095. var e4 = this.extend();
  3096. return e4.init.apply(e4, arguments), e4;
  3097. }, init: function() {
  3098. }, mixIn: function(e4) {
  3099. for (var t4 in e4)
  3100. e4.hasOwnProperty(t4) && (this[t4] = e4[t4]);
  3101. e4.hasOwnProperty("toString") && (this.toString = e4.toString);
  3102. }, clone: function() {
  3103. return this.init.prototype.extend(this);
  3104. } }, o2 = r2.WordArray = i2.extend({ init: function(e4, n4) {
  3105. e4 = this.words = e4 || [], this.sigBytes = n4 != t3 ? n4 : 4 * e4.length;
  3106. }, toString: function(e4) {
  3107. return (e4 || c2).stringify(this);
  3108. }, concat: function(e4) {
  3109. var t4 = this.words, n4 = e4.words, s3 = this.sigBytes, r3 = e4.sigBytes;
  3110. if (this.clamp(), s3 % 4)
  3111. for (var i3 = 0; i3 < r3; i3++) {
  3112. var o3 = n4[i3 >>> 2] >>> 24 - i3 % 4 * 8 & 255;
  3113. t4[s3 + i3 >>> 2] |= o3 << 24 - (s3 + i3) % 4 * 8;
  3114. }
  3115. else
  3116. for (i3 = 0; i3 < r3; i3 += 4)
  3117. t4[s3 + i3 >>> 2] = n4[i3 >>> 2];
  3118. return this.sigBytes += r3, this;
  3119. }, clamp: function() {
  3120. var t4 = this.words, n4 = this.sigBytes;
  3121. t4[n4 >>> 2] &= 4294967295 << 32 - n4 % 4 * 8, t4.length = e3.ceil(n4 / 4);
  3122. }, clone: function() {
  3123. var e4 = i2.clone.call(this);
  3124. return e4.words = this.words.slice(0), e4;
  3125. }, random: function(t4) {
  3126. for (var n4, s3 = [], r3 = function(t5) {
  3127. t5 = t5;
  3128. var n5 = 987654321, s4 = 4294967295;
  3129. return function() {
  3130. var r4 = ((n5 = 36969 * (65535 & n5) + (n5 >> 16) & s4) << 16) + (t5 = 18e3 * (65535 & t5) + (t5 >> 16) & s4) & s4;
  3131. return r4 /= 4294967296, (r4 += 0.5) * (e3.random() > 0.5 ? 1 : -1);
  3132. };
  3133. }, i3 = 0; i3 < t4; i3 += 4) {
  3134. var a3 = r3(4294967296 * (n4 || e3.random()));
  3135. n4 = 987654071 * a3(), s3.push(4294967296 * a3() | 0);
  3136. }
  3137. return new o2.init(s3, t4);
  3138. } }), a2 = s2.enc = {}, c2 = a2.Hex = { stringify: function(e4) {
  3139. for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) {
  3140. var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255;
  3141. s3.push((i3 >>> 4).toString(16)), s3.push((15 & i3).toString(16));
  3142. }
  3143. return s3.join("");
  3144. }, parse: function(e4) {
  3145. for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3 += 2)
  3146. n4[s3 >>> 3] |= parseInt(e4.substr(s3, 2), 16) << 24 - s3 % 8 * 4;
  3147. return new o2.init(n4, t4 / 2);
  3148. } }, u2 = a2.Latin1 = { stringify: function(e4) {
  3149. for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) {
  3150. var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255;
  3151. s3.push(String.fromCharCode(i3));
  3152. }
  3153. return s3.join("");
  3154. }, parse: function(e4) {
  3155. for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3++)
  3156. n4[s3 >>> 2] |= (255 & e4.charCodeAt(s3)) << 24 - s3 % 4 * 8;
  3157. return new o2.init(n4, t4);
  3158. } }, h2 = a2.Utf8 = { stringify: function(e4) {
  3159. try {
  3160. return decodeURIComponent(escape(u2.stringify(e4)));
  3161. } catch (e5) {
  3162. throw new Error("Malformed UTF-8 data");
  3163. }
  3164. }, parse: function(e4) {
  3165. return u2.parse(unescape(encodeURIComponent(e4)));
  3166. } }, l2 = r2.BufferedBlockAlgorithm = i2.extend({ reset: function() {
  3167. this._data = new o2.init(), this._nDataBytes = 0;
  3168. }, _append: function(e4) {
  3169. "string" == typeof e4 && (e4 = h2.parse(e4)), this._data.concat(e4), this._nDataBytes += e4.sigBytes;
  3170. }, _process: function(t4) {
  3171. var n4 = this._data, s3 = n4.words, r3 = n4.sigBytes, i3 = this.blockSize, a3 = r3 / (4 * i3), c3 = (a3 = t4 ? e3.ceil(a3) : e3.max((0 | a3) - this._minBufferSize, 0)) * i3, u3 = e3.min(4 * c3, r3);
  3172. if (c3) {
  3173. for (var h3 = 0; h3 < c3; h3 += i3)
  3174. this._doProcessBlock(s3, h3);
  3175. var l3 = s3.splice(0, c3);
  3176. n4.sigBytes -= u3;
  3177. }
  3178. return new o2.init(l3, u3);
  3179. }, clone: function() {
  3180. var e4 = i2.clone.call(this);
  3181. return e4._data = this._data.clone(), e4;
  3182. }, _minBufferSize: 0 });
  3183. r2.Hasher = l2.extend({ cfg: i2.extend(), init: function(e4) {
  3184. this.cfg = this.cfg.extend(e4), this.reset();
  3185. }, reset: function() {
  3186. l2.reset.call(this), this._doReset();
  3187. }, update: function(e4) {
  3188. return this._append(e4), this._process(), this;
  3189. }, finalize: function(e4) {
  3190. return e4 && this._append(e4), this._doFinalize();
  3191. }, blockSize: 16, _createHelper: function(e4) {
  3192. return function(t4, n4) {
  3193. return new e4.init(n4).finalize(t4);
  3194. };
  3195. }, _createHmacHelper: function(e4) {
  3196. return function(t4, n4) {
  3197. return new d2.HMAC.init(e4, n4).finalize(t4);
  3198. };
  3199. } });
  3200. var d2 = s2.algo = {};
  3201. return s2;
  3202. }(Math), n2);
  3203. }), r = s, i = (n(function(e2, t2) {
  3204. var n2;
  3205. e2.exports = (n2 = r, function(e3) {
  3206. var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = [];
  3207. !function() {
  3208. for (var t4 = 0; t4 < 64; t4++)
  3209. a2[t4] = 4294967296 * e3.abs(e3.sin(t4 + 1)) | 0;
  3210. }();
  3211. var c2 = o2.MD5 = i2.extend({ _doReset: function() {
  3212. this._hash = new r2.init([1732584193, 4023233417, 2562383102, 271733878]);
  3213. }, _doProcessBlock: function(e4, t4) {
  3214. for (var n3 = 0; n3 < 16; n3++) {
  3215. var s3 = t4 + n3, r3 = e4[s3];
  3216. e4[s3] = 16711935 & (r3 << 8 | r3 >>> 24) | 4278255360 & (r3 << 24 | r3 >>> 8);
  3217. }
  3218. var i3 = this._hash.words, o3 = e4[t4 + 0], c3 = e4[t4 + 1], p2 = e4[t4 + 2], f2 = e4[t4 + 3], g2 = e4[t4 + 4], m2 = e4[t4 + 5], y2 = e4[t4 + 6], _2 = e4[t4 + 7], w2 = e4[t4 + 8], v2 = e4[t4 + 9], I2 = e4[t4 + 10], S2 = e4[t4 + 11], b2 = e4[t4 + 12], k2 = e4[t4 + 13], A2 = e4[t4 + 14], P2 = e4[t4 + 15], T2 = i3[0], C2 = i3[1], x2 = i3[2], O2 = i3[3];
  3219. T2 = u2(T2, C2, x2, O2, o3, 7, a2[0]), O2 = u2(O2, T2, C2, x2, c3, 12, a2[1]), x2 = u2(x2, O2, T2, C2, p2, 17, a2[2]), C2 = u2(C2, x2, O2, T2, f2, 22, a2[3]), T2 = u2(T2, C2, x2, O2, g2, 7, a2[4]), O2 = u2(O2, T2, C2, x2, m2, 12, a2[5]), x2 = u2(x2, O2, T2, C2, y2, 17, a2[6]), C2 = u2(C2, x2, O2, T2, _2, 22, a2[7]), T2 = u2(T2, C2, x2, O2, w2, 7, a2[8]), O2 = u2(O2, T2, C2, x2, v2, 12, a2[9]), x2 = u2(x2, O2, T2, C2, I2, 17, a2[10]), C2 = u2(C2, x2, O2, T2, S2, 22, a2[11]), T2 = u2(T2, C2, x2, O2, b2, 7, a2[12]), O2 = u2(O2, T2, C2, x2, k2, 12, a2[13]), x2 = u2(x2, O2, T2, C2, A2, 17, a2[14]), T2 = h2(T2, C2 = u2(C2, x2, O2, T2, P2, 22, a2[15]), x2, O2, c3, 5, a2[16]), O2 = h2(O2, T2, C2, x2, y2, 9, a2[17]), x2 = h2(x2, O2, T2, C2, S2, 14, a2[18]), C2 = h2(C2, x2, O2, T2, o3, 20, a2[19]), T2 = h2(T2, C2, x2, O2, m2, 5, a2[20]), O2 = h2(O2, T2, C2, x2, I2, 9, a2[21]), x2 = h2(x2, O2, T2, C2, P2, 14, a2[22]), C2 = h2(C2, x2, O2, T2, g2, 20, a2[23]), T2 = h2(T2, C2, x2, O2, v2, 5, a2[24]), O2 = h2(O2, T2, C2, x2, A2, 9, a2[25]), x2 = h2(x2, O2, T2, C2, f2, 14, a2[26]), C2 = h2(C2, x2, O2, T2, w2, 20, a2[27]), T2 = h2(T2, C2, x2, O2, k2, 5, a2[28]), O2 = h2(O2, T2, C2, x2, p2, 9, a2[29]), x2 = h2(x2, O2, T2, C2, _2, 14, a2[30]), T2 = l2(T2, C2 = h2(C2, x2, O2, T2, b2, 20, a2[31]), x2, O2, m2, 4, a2[32]), O2 = l2(O2, T2, C2, x2, w2, 11, a2[33]), x2 = l2(x2, O2, T2, C2, S2, 16, a2[34]), C2 = l2(C2, x2, O2, T2, A2, 23, a2[35]), T2 = l2(T2, C2, x2, O2, c3, 4, a2[36]), O2 = l2(O2, T2, C2, x2, g2, 11, a2[37]), x2 = l2(x2, O2, T2, C2, _2, 16, a2[38]), C2 = l2(C2, x2, O2, T2, I2, 23, a2[39]), T2 = l2(T2, C2, x2, O2, k2, 4, a2[40]), O2 = l2(O2, T2, C2, x2, o3, 11, a2[41]), x2 = l2(x2, O2, T2, C2, f2, 16, a2[42]), C2 = l2(C2, x2, O2, T2, y2, 23, a2[43]), T2 = l2(T2, C2, x2, O2, v2, 4, a2[44]), O2 = l2(O2, T2, C2, x2, b2, 11, a2[45]), x2 = l2(x2, O2, T2, C2, P2, 16, a2[46]), T2 = d2(T2, C2 = l2(C2, x2, O2, T2, p2, 23, a2[47]), x2, O2, o3, 6, a2[48]), O2 = d2(O2, T2, C2, x2, _2, 10, a2[49]), x2 = d2(x2, O2, T2, C2, A2, 15, a2[50]), C2 = d2(C2, x2, O2, T2, m2, 21, a2[51]), T2 = d2(T2, C2, x2, O2, b2, 6, a2[52]), O2 = d2(O2, T2, C2, x2, f2, 10, a2[53]), x2 = d2(x2, O2, T2, C2, I2, 15, a2[54]), C2 = d2(C2, x2, O2, T2, c3, 21, a2[55]), T2 = d2(T2, C2, x2, O2, w2, 6, a2[56]), O2 = d2(O2, T2, C2, x2, P2, 10, a2[57]), x2 = d2(x2, O2, T2, C2, y2, 15, a2[58]), C2 = d2(C2, x2, O2, T2, k2, 21, a2[59]), T2 = d2(T2, C2, x2, O2, g2, 6, a2[60]), O2 = d2(O2, T2, C2, x2, S2, 10, a2[61]), x2 = d2(x2, O2, T2, C2, p2, 15, a2[62]), C2 = d2(C2, x2, O2, T2, v2, 21, a2[63]), i3[0] = i3[0] + T2 | 0, i3[1] = i3[1] + C2 | 0, i3[2] = i3[2] + x2 | 0, i3[3] = i3[3] + O2 | 0;
  3220. }, _doFinalize: function() {
  3221. var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes;
  3222. n3[r3 >>> 5] |= 128 << 24 - r3 % 32;
  3223. var i3 = e3.floor(s3 / 4294967296), o3 = s3;
  3224. n3[15 + (r3 + 64 >>> 9 << 4)] = 16711935 & (i3 << 8 | i3 >>> 24) | 4278255360 & (i3 << 24 | i3 >>> 8), n3[14 + (r3 + 64 >>> 9 << 4)] = 16711935 & (o3 << 8 | o3 >>> 24) | 4278255360 & (o3 << 24 | o3 >>> 8), t4.sigBytes = 4 * (n3.length + 1), this._process();
  3225. for (var a3 = this._hash, c3 = a3.words, u3 = 0; u3 < 4; u3++) {
  3226. var h3 = c3[u3];
  3227. c3[u3] = 16711935 & (h3 << 8 | h3 >>> 24) | 4278255360 & (h3 << 24 | h3 >>> 8);
  3228. }
  3229. return a3;
  3230. }, clone: function() {
  3231. var e4 = i2.clone.call(this);
  3232. return e4._hash = this._hash.clone(), e4;
  3233. } });
  3234. function u2(e4, t4, n3, s3, r3, i3, o3) {
  3235. var a3 = e4 + (t4 & n3 | ~t4 & s3) + r3 + o3;
  3236. return (a3 << i3 | a3 >>> 32 - i3) + t4;
  3237. }
  3238. function h2(e4, t4, n3, s3, r3, i3, o3) {
  3239. var a3 = e4 + (t4 & s3 | n3 & ~s3) + r3 + o3;
  3240. return (a3 << i3 | a3 >>> 32 - i3) + t4;
  3241. }
  3242. function l2(e4, t4, n3, s3, r3, i3, o3) {
  3243. var a3 = e4 + (t4 ^ n3 ^ s3) + r3 + o3;
  3244. return (a3 << i3 | a3 >>> 32 - i3) + t4;
  3245. }
  3246. function d2(e4, t4, n3, s3, r3, i3, o3) {
  3247. var a3 = e4 + (n3 ^ (t4 | ~s3)) + r3 + o3;
  3248. return (a3 << i3 | a3 >>> 32 - i3) + t4;
  3249. }
  3250. t3.MD5 = i2._createHelper(c2), t3.HmacMD5 = i2._createHmacHelper(c2);
  3251. }(Math), n2.MD5);
  3252. }), n(function(e2, t2) {
  3253. var n2;
  3254. e2.exports = (n2 = r, void function() {
  3255. var e3 = n2, t3 = e3.lib.Base, s2 = e3.enc.Utf8;
  3256. e3.algo.HMAC = t3.extend({ init: function(e4, t4) {
  3257. e4 = this._hasher = new e4.init(), "string" == typeof t4 && (t4 = s2.parse(t4));
  3258. var n3 = e4.blockSize, r2 = 4 * n3;
  3259. t4.sigBytes > r2 && (t4 = e4.finalize(t4)), t4.clamp();
  3260. for (var i2 = this._oKey = t4.clone(), o2 = this._iKey = t4.clone(), a2 = i2.words, c2 = o2.words, u2 = 0; u2 < n3; u2++)
  3261. a2[u2] ^= 1549556828, c2[u2] ^= 909522486;
  3262. i2.sigBytes = o2.sigBytes = r2, this.reset();
  3263. }, reset: function() {
  3264. var e4 = this._hasher;
  3265. e4.reset(), e4.update(this._iKey);
  3266. }, update: function(e4) {
  3267. return this._hasher.update(e4), this;
  3268. }, finalize: function(e4) {
  3269. var t4 = this._hasher, n3 = t4.finalize(e4);
  3270. return t4.reset(), t4.finalize(this._oKey.clone().concat(n3));
  3271. } });
  3272. }());
  3273. }), n(function(e2, t2) {
  3274. e2.exports = r.HmacMD5;
  3275. })), o = n(function(e2, t2) {
  3276. e2.exports = r.enc.Utf8;
  3277. }), a = n(function(e2, t2) {
  3278. var n2;
  3279. e2.exports = (n2 = r, function() {
  3280. var e3 = n2, t3 = e3.lib.WordArray;
  3281. function s2(e4, n3, s3) {
  3282. for (var r2 = [], i2 = 0, o2 = 0; o2 < n3; o2++)
  3283. if (o2 % 4) {
  3284. var a2 = s3[e4.charCodeAt(o2 - 1)] << o2 % 4 * 2, c2 = s3[e4.charCodeAt(o2)] >>> 6 - o2 % 4 * 2;
  3285. r2[i2 >>> 2] |= (a2 | c2) << 24 - i2 % 4 * 8, i2++;
  3286. }
  3287. return t3.create(r2, i2);
  3288. }
  3289. e3.enc.Base64 = { stringify: function(e4) {
  3290. var t4 = e4.words, n3 = e4.sigBytes, s3 = this._map;
  3291. e4.clamp();
  3292. for (var r2 = [], i2 = 0; i2 < n3; i2 += 3)
  3293. for (var o2 = (t4[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255) << 16 | (t4[i2 + 1 >>> 2] >>> 24 - (i2 + 1) % 4 * 8 & 255) << 8 | t4[i2 + 2 >>> 2] >>> 24 - (i2 + 2) % 4 * 8 & 255, a2 = 0; a2 < 4 && i2 + 0.75 * a2 < n3; a2++)
  3294. r2.push(s3.charAt(o2 >>> 6 * (3 - a2) & 63));
  3295. var c2 = s3.charAt(64);
  3296. if (c2)
  3297. for (; r2.length % 4; )
  3298. r2.push(c2);
  3299. return r2.join("");
  3300. }, parse: function(e4) {
  3301. var t4 = e4.length, n3 = this._map, r2 = this._reverseMap;
  3302. if (!r2) {
  3303. r2 = this._reverseMap = [];
  3304. for (var i2 = 0; i2 < n3.length; i2++)
  3305. r2[n3.charCodeAt(i2)] = i2;
  3306. }
  3307. var o2 = n3.charAt(64);
  3308. if (o2) {
  3309. var a2 = e4.indexOf(o2);
  3310. -1 !== a2 && (t4 = a2);
  3311. }
  3312. return s2(e4, t4, r2);
  3313. }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" };
  3314. }(), n2.enc.Base64);
  3315. });
  3316. const c = "FUNCTION", u = "OBJECT", h = "CLIENT_DB", l = "pending", d = "fulfilled", p = "rejected";
  3317. function f(e2) {
  3318. return Object.prototype.toString.call(e2).slice(8, -1).toLowerCase();
  3319. }
  3320. function g(e2) {
  3321. return "object" === f(e2);
  3322. }
  3323. function m(e2) {
  3324. return "function" == typeof e2;
  3325. }
  3326. function y(e2) {
  3327. return function() {
  3328. try {
  3329. return e2.apply(e2, arguments);
  3330. } catch (e3) {
  3331. console.error(e3);
  3332. }
  3333. };
  3334. }
  3335. const _ = "REJECTED", w = "NOT_PENDING";
  3336. class v {
  3337. constructor({ createPromise: e2, retryRule: t2 = _ } = {}) {
  3338. this.createPromise = e2, this.status = null, this.promise = null, this.retryRule = t2;
  3339. }
  3340. get needRetry() {
  3341. if (!this.status)
  3342. return true;
  3343. switch (this.retryRule) {
  3344. case _:
  3345. return this.status === p;
  3346. case w:
  3347. return this.status !== l;
  3348. }
  3349. }
  3350. exec() {
  3351. return this.needRetry ? (this.status = l, this.promise = this.createPromise().then((e2) => (this.status = d, Promise.resolve(e2)), (e2) => (this.status = p, Promise.reject(e2))), this.promise) : this.promise;
  3352. }
  3353. }
  3354. function I(e2) {
  3355. return e2 && "string" == typeof e2 ? JSON.parse(e2) : e2;
  3356. }
  3357. const S = true, b = "app", A = I(define_process_env_UNI_SECURE_NETWORK_CONFIG_default), P = b, T = I(""), C = I("[]") || [];
  3358. let O = "";
  3359. try {
  3360. O = "__UNI__EE98A34";
  3361. } catch (e2) {
  3362. }
  3363. let E = {};
  3364. function L(e2, t2 = {}) {
  3365. var n2, s2;
  3366. return n2 = E, s2 = e2, Object.prototype.hasOwnProperty.call(n2, s2) || (E[e2] = t2), E[e2];
  3367. }
  3368. E = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {};
  3369. const R = ["invoke", "success", "fail", "complete"], U = L("_globalUniCloudInterceptor");
  3370. function N(e2, t2) {
  3371. U[e2] || (U[e2] = {}), g(t2) && Object.keys(t2).forEach((n2) => {
  3372. R.indexOf(n2) > -1 && function(e3, t3, n3) {
  3373. let s2 = U[e3][t3];
  3374. s2 || (s2 = U[e3][t3] = []), -1 === s2.indexOf(n3) && m(n3) && s2.push(n3);
  3375. }(e2, n2, t2[n2]);
  3376. });
  3377. }
  3378. function D(e2, t2) {
  3379. U[e2] || (U[e2] = {}), g(t2) ? Object.keys(t2).forEach((n2) => {
  3380. R.indexOf(n2) > -1 && function(e3, t3, n3) {
  3381. const s2 = U[e3][t3];
  3382. if (!s2)
  3383. return;
  3384. const r2 = s2.indexOf(n3);
  3385. r2 > -1 && s2.splice(r2, 1);
  3386. }(e2, n2, t2[n2]);
  3387. }) : delete U[e2];
  3388. }
  3389. function M(e2, t2) {
  3390. return e2 && 0 !== e2.length ? e2.reduce((e3, n2) => e3.then(() => n2(t2)), Promise.resolve()) : Promise.resolve();
  3391. }
  3392. function q(e2, t2) {
  3393. return U[e2] && U[e2][t2] || [];
  3394. }
  3395. function F(e2) {
  3396. N("callObject", e2);
  3397. }
  3398. const K = L("_globalUniCloudListener"), j = "response", $ = "needLogin", B = "refreshToken", W = "clientdb", H = "cloudfunction", z = "cloudobject";
  3399. function J(e2) {
  3400. return K[e2] || (K[e2] = []), K[e2];
  3401. }
  3402. function G(e2, t2) {
  3403. const n2 = J(e2);
  3404. n2.includes(t2) || n2.push(t2);
  3405. }
  3406. function V(e2, t2) {
  3407. const n2 = J(e2), s2 = n2.indexOf(t2);
  3408. -1 !== s2 && n2.splice(s2, 1);
  3409. }
  3410. function Y(e2, t2) {
  3411. const n2 = J(e2);
  3412. for (let e3 = 0; e3 < n2.length; e3++) {
  3413. (0, n2[e3])(t2);
  3414. }
  3415. }
  3416. let Q, X = false;
  3417. function Z() {
  3418. return Q || (Q = new Promise((e2) => {
  3419. X && e2(), function t2() {
  3420. if ("function" == typeof getCurrentPages) {
  3421. const t3 = getCurrentPages();
  3422. t3 && t3[0] && (X = true, e2());
  3423. }
  3424. X || setTimeout(() => {
  3425. t2();
  3426. }, 30);
  3427. }();
  3428. }), Q);
  3429. }
  3430. function ee(e2) {
  3431. const t2 = {};
  3432. for (const n2 in e2) {
  3433. const s2 = e2[n2];
  3434. m(s2) && (t2[n2] = y(s2));
  3435. }
  3436. return t2;
  3437. }
  3438. class te extends Error {
  3439. constructor(e2) {
  3440. super(e2.message), this.errMsg = e2.message || e2.errMsg || "unknown system error", this.code = this.errCode = e2.code || e2.errCode || "SYSTEM_ERROR", this.errSubject = this.subject = e2.subject || e2.errSubject, this.cause = e2.cause, this.requestId = e2.requestId;
  3441. }
  3442. toJson(e2 = 0) {
  3443. if (!(e2 >= 10))
  3444. return e2++, { errCode: this.errCode, errMsg: this.errMsg, errSubject: this.errSubject, cause: this.cause && this.cause.toJson ? this.cause.toJson(e2) : this.cause };
  3445. }
  3446. }
  3447. var ne = { request: (e2) => uni.request(e2), uploadFile: (e2) => uni.uploadFile(e2), setStorageSync: (e2, t2) => uni.setStorageSync(e2, t2), getStorageSync: (e2) => uni.getStorageSync(e2), removeStorageSync: (e2) => uni.removeStorageSync(e2), clearStorageSync: () => uni.clearStorageSync() };
  3448. function se(e2) {
  3449. return e2 && se(e2.__v_raw) || e2;
  3450. }
  3451. function re() {
  3452. return { token: ne.getStorageSync("uni_id_token") || ne.getStorageSync("uniIdToken"), tokenExpired: ne.getStorageSync("uni_id_token_expired") };
  3453. }
  3454. function ie({ token: e2, tokenExpired: t2 } = {}) {
  3455. e2 && ne.setStorageSync("uni_id_token", e2), t2 && ne.setStorageSync("uni_id_token_expired", t2);
  3456. }
  3457. let oe, ae;
  3458. function ce() {
  3459. return oe || (oe = uni.getSystemInfoSync()), oe;
  3460. }
  3461. function ue() {
  3462. let e2, t2;
  3463. try {
  3464. if (uni.getLaunchOptionsSync) {
  3465. if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1)
  3466. return;
  3467. const { scene: n2, channel: s2 } = uni.getLaunchOptionsSync();
  3468. e2 = s2, t2 = n2;
  3469. }
  3470. } catch (e3) {
  3471. }
  3472. return { channel: e2, scene: t2 };
  3473. }
  3474. function he() {
  3475. const e2 = uni.getLocale && uni.getLocale() || "en";
  3476. if (ae)
  3477. return { ...ae, locale: e2, LOCALE: e2 };
  3478. const t2 = ce(), { deviceId: n2, osName: s2, uniPlatform: r2, appId: i2 } = t2, o2 = ["pixelRatio", "brand", "model", "system", "language", "version", "platform", "host", "SDKVersion", "swanNativeVersion", "app", "AppPlatform", "fontSizeSetting"];
  3479. for (let e3 = 0; e3 < o2.length; e3++) {
  3480. delete t2[o2[e3]];
  3481. }
  3482. return ae = { PLATFORM: r2, OS: s2, APPID: i2, DEVICEID: n2, ...ue(), ...t2 }, { ...ae, locale: e2, LOCALE: e2 };
  3483. }
  3484. var le = { sign: function(e2, t2) {
  3485. let n2 = "";
  3486. return Object.keys(e2).sort().forEach(function(t3) {
  3487. e2[t3] && (n2 = n2 + "&" + t3 + "=" + e2[t3]);
  3488. }), n2 = n2.slice(1), i(n2, t2).toString();
  3489. }, wrappedRequest: function(e2, t2) {
  3490. return new Promise((n2, s2) => {
  3491. t2(Object.assign(e2, { complete(e3) {
  3492. e3 || (e3 = {});
  3493. const t3 = e3.data && e3.data.header && e3.data.header["x-serverless-request-id"] || e3.header && e3.header["request-id"];
  3494. if (!e3.statusCode || e3.statusCode >= 400) {
  3495. const n3 = e3.data && e3.data.error && e3.data.error.code || "SYS_ERR", r3 = e3.data && e3.data.error && e3.data.error.message || e3.errMsg || "request:fail";
  3496. return s2(new te({ code: n3, message: r3, requestId: t3 }));
  3497. }
  3498. const r2 = e3.data;
  3499. if (r2.error)
  3500. return s2(new te({ code: r2.error.code, message: r2.error.message, requestId: t3 }));
  3501. r2.result = r2.data, r2.requestId = t3, delete r2.data, n2(r2);
  3502. } }));
  3503. });
  3504. }, toBase64: function(e2) {
  3505. return a.stringify(o.parse(e2));
  3506. } };
  3507. var de = class {
  3508. constructor(e2) {
  3509. ["spaceId", "clientSecret"].forEach((t2) => {
  3510. if (!Object.prototype.hasOwnProperty.call(e2, t2))
  3511. throw new Error(`${t2} required`);
  3512. }), this.config = Object.assign({}, { endpoint: 0 === e2.spaceId.indexOf("mp-") ? "https://api.next.bspapp.com" : "https://api.bspapp.com" }, e2), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = ne, this._getAccessTokenPromiseHub = new v({ createPromise: () => this.requestAuth(this.setupRequest({ method: "serverless.auth.user.anonymousAuthorize", params: "{}" }, "auth")).then((e3) => {
  3513. if (!e3.result || !e3.result.accessToken)
  3514. throw new te({ code: "AUTH_FAILED", message: "获取accessToken失败" });
  3515. this.setAccessToken(e3.result.accessToken);
  3516. }), retryRule: w });
  3517. }
  3518. get hasAccessToken() {
  3519. return !!this.accessToken;
  3520. }
  3521. setAccessToken(e2) {
  3522. this.accessToken = e2;
  3523. }
  3524. requestWrapped(e2) {
  3525. return le.wrappedRequest(e2, this.adapter.request);
  3526. }
  3527. requestAuth(e2) {
  3528. return this.requestWrapped(e2);
  3529. }
  3530. request(e2, t2) {
  3531. return Promise.resolve().then(() => this.hasAccessToken ? t2 ? this.requestWrapped(e2) : this.requestWrapped(e2).catch((t3) => new Promise((e3, n2) => {
  3532. !t3 || "GATEWAY_INVALID_TOKEN" !== t3.code && "InvalidParameter.InvalidToken" !== t3.code ? n2(t3) : e3();
  3533. }).then(() => this.getAccessToken()).then(() => {
  3534. const t4 = this.rebuildRequest(e2);
  3535. return this.request(t4, true);
  3536. })) : this.getAccessToken().then(() => {
  3537. const t3 = this.rebuildRequest(e2);
  3538. return this.request(t3, true);
  3539. }));
  3540. }
  3541. rebuildRequest(e2) {
  3542. const t2 = Object.assign({}, e2);
  3543. return t2.data.token = this.accessToken, t2.header["x-basement-token"] = this.accessToken, t2.header["x-serverless-sign"] = le.sign(t2.data, this.config.clientSecret), t2;
  3544. }
  3545. setupRequest(e2, t2) {
  3546. const n2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), s2 = { "Content-Type": "application/json" };
  3547. return "auth" !== t2 && (n2.token = this.accessToken, s2["x-basement-token"] = this.accessToken), s2["x-serverless-sign"] = le.sign(n2, this.config.clientSecret), { url: this.config.requestUrl, method: "POST", data: n2, dataType: "json", header: s2 };
  3548. }
  3549. getAccessToken() {
  3550. return this._getAccessTokenPromiseHub.exec();
  3551. }
  3552. async authorize() {
  3553. await this.getAccessToken();
  3554. }
  3555. callFunction(e2) {
  3556. const t2 = { method: "serverless.function.runtime.invoke", params: JSON.stringify({ functionTarget: e2.name, functionArgs: e2.data || {} }) };
  3557. return this.request(this.setupRequest(t2));
  3558. }
  3559. getOSSUploadOptionsFromPath(e2) {
  3560. const t2 = { method: "serverless.file.resource.generateProximalSign", params: JSON.stringify(e2) };
  3561. return this.request(this.setupRequest(t2));
  3562. }
  3563. uploadFileToOSS({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, onUploadProgress: i2 }) {
  3564. return new Promise((o2, a2) => {
  3565. const c2 = this.adapter.uploadFile({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, header: { "X-OSS-server-side-encrpytion": "AES256" }, success(e3) {
  3566. e3 && e3.statusCode < 400 ? o2(e3) : a2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
  3567. }, fail(e3) {
  3568. a2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
  3569. } });
  3570. "function" == typeof i2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => {
  3571. i2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
  3572. });
  3573. });
  3574. }
  3575. reportOSSUpload(e2) {
  3576. const t2 = { method: "serverless.file.resource.report", params: JSON.stringify(e2) };
  3577. return this.request(this.setupRequest(t2));
  3578. }
  3579. async uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", cloudPathAsRealPath: s2 = false, onUploadProgress: r2, config: i2 }) {
  3580. if ("string" !== f(t2))
  3581. throw new te({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });
  3582. if (!(t2 = t2.trim()))
  3583. throw new te({ code: "INVALID_PARAM", message: "cloudPath不可为空" });
  3584. if (/:\/\//.test(t2))
  3585. throw new te({ code: "INVALID_PARAM", message: "cloudPath不合法" });
  3586. const o2 = i2 && i2.envType || this.config.envType;
  3587. if (s2 && ("/" !== t2[0] && (t2 = "/" + t2), t2.indexOf("\\") > -1))
  3588. throw new te({ code: "INVALID_PARAM", message: "使用cloudPath作为路径时,cloudPath不可包含“\\”" });
  3589. const a2 = (await this.getOSSUploadOptionsFromPath({ env: o2, filename: s2 ? t2.split("/").pop() : t2, fileId: s2 ? t2 : void 0 })).result, c2 = "https://" + a2.cdnDomain + "/" + a2.ossPath, { securityToken: u2, accessKeyId: h2, signature: l2, host: d2, ossPath: p2, id: g2, policy: m2, ossCallbackUrl: y2 } = a2, _2 = { "Cache-Control": "max-age=2592000", "Content-Disposition": "attachment", OSSAccessKeyId: h2, Signature: l2, host: d2, id: g2, key: p2, policy: m2, success_action_status: 200 };
  3590. if (u2 && (_2["x-oss-security-token"] = u2), y2) {
  3591. const e3 = JSON.stringify({ callbackUrl: y2, callbackBody: JSON.stringify({ fileId: g2, spaceId: this.config.spaceId }), callbackBodyType: "application/json" });
  3592. _2.callback = le.toBase64(e3);
  3593. }
  3594. const w2 = { url: "https://" + a2.host, formData: _2, fileName: "file", name: "file", filePath: e2, fileType: n2 };
  3595. if (await this.uploadFileToOSS(Object.assign({}, w2, { onUploadProgress: r2 })), y2)
  3596. return { success: true, filePath: e2, fileID: c2 };
  3597. if ((await this.reportOSSUpload({ id: g2 })).success)
  3598. return { success: true, filePath: e2, fileID: c2 };
  3599. throw new te({ code: "UPLOAD_FAILED", message: "文件上传失败" });
  3600. }
  3601. getTempFileURL({ fileList: e2 } = {}) {
  3602. return new Promise((t2, n2) => {
  3603. Array.isArray(e2) && 0 !== e2.length || n2(new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" })), t2({ fileList: e2.map((e3) => ({ fileID: e3, tempFileURL: e3 })) });
  3604. });
  3605. }
  3606. async getFileInfo({ fileList: e2 } = {}) {
  3607. if (!Array.isArray(e2) || 0 === e2.length)
  3608. throw new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
  3609. const t2 = { method: "serverless.file.resource.info", params: JSON.stringify({ id: e2.map((e3) => e3.split("?")[0]).join(",") }) };
  3610. return { fileList: (await this.request(this.setupRequest(t2))).result };
  3611. }
  3612. };
  3613. var pe = { init(e2) {
  3614. const t2 = new de(e2), n2 = { signInAnonymously: function() {
  3615. return t2.authorize();
  3616. }, getLoginState: function() {
  3617. return Promise.resolve(false);
  3618. } };
  3619. return t2.auth = function() {
  3620. return n2;
  3621. }, t2.customAuth = t2.auth, t2;
  3622. } };
  3623. const fe = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";
  3624. var ge;
  3625. !function(e2) {
  3626. e2.local = "local", e2.none = "none", e2.session = "session";
  3627. }(ge || (ge = {}));
  3628. var me = function() {
  3629. }, ye = n(function(e2, t2) {
  3630. var n2;
  3631. e2.exports = (n2 = r, function(e3) {
  3632. var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = [], c2 = [];
  3633. !function() {
  3634. function t4(t5) {
  3635. for (var n4 = e3.sqrt(t5), s4 = 2; s4 <= n4; s4++)
  3636. if (!(t5 % s4))
  3637. return false;
  3638. return true;
  3639. }
  3640. function n3(e4) {
  3641. return 4294967296 * (e4 - (0 | e4)) | 0;
  3642. }
  3643. for (var s3 = 2, r3 = 0; r3 < 64; )
  3644. t4(s3) && (r3 < 8 && (a2[r3] = n3(e3.pow(s3, 0.5))), c2[r3] = n3(e3.pow(s3, 1 / 3)), r3++), s3++;
  3645. }();
  3646. var u2 = [], h2 = o2.SHA256 = i2.extend({ _doReset: function() {
  3647. this._hash = new r2.init(a2.slice(0));
  3648. }, _doProcessBlock: function(e4, t4) {
  3649. for (var n3 = this._hash.words, s3 = n3[0], r3 = n3[1], i3 = n3[2], o3 = n3[3], a3 = n3[4], h3 = n3[5], l2 = n3[6], d2 = n3[7], p2 = 0; p2 < 64; p2++) {
  3650. if (p2 < 16)
  3651. u2[p2] = 0 | e4[t4 + p2];
  3652. else {
  3653. var f2 = u2[p2 - 15], g2 = (f2 << 25 | f2 >>> 7) ^ (f2 << 14 | f2 >>> 18) ^ f2 >>> 3, m2 = u2[p2 - 2], y2 = (m2 << 15 | m2 >>> 17) ^ (m2 << 13 | m2 >>> 19) ^ m2 >>> 10;
  3654. u2[p2] = g2 + u2[p2 - 7] + y2 + u2[p2 - 16];
  3655. }
  3656. var _2 = s3 & r3 ^ s3 & i3 ^ r3 & i3, w2 = (s3 << 30 | s3 >>> 2) ^ (s3 << 19 | s3 >>> 13) ^ (s3 << 10 | s3 >>> 22), v2 = d2 + ((a3 << 26 | a3 >>> 6) ^ (a3 << 21 | a3 >>> 11) ^ (a3 << 7 | a3 >>> 25)) + (a3 & h3 ^ ~a3 & l2) + c2[p2] + u2[p2];
  3657. d2 = l2, l2 = h3, h3 = a3, a3 = o3 + v2 | 0, o3 = i3, i3 = r3, r3 = s3, s3 = v2 + (w2 + _2) | 0;
  3658. }
  3659. n3[0] = n3[0] + s3 | 0, n3[1] = n3[1] + r3 | 0, n3[2] = n3[2] + i3 | 0, n3[3] = n3[3] + o3 | 0, n3[4] = n3[4] + a3 | 0, n3[5] = n3[5] + h3 | 0, n3[6] = n3[6] + l2 | 0, n3[7] = n3[7] + d2 | 0;
  3660. }, _doFinalize: function() {
  3661. var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes;
  3662. return n3[r3 >>> 5] |= 128 << 24 - r3 % 32, n3[14 + (r3 + 64 >>> 9 << 4)] = e3.floor(s3 / 4294967296), n3[15 + (r3 + 64 >>> 9 << 4)] = s3, t4.sigBytes = 4 * n3.length, this._process(), this._hash;
  3663. }, clone: function() {
  3664. var e4 = i2.clone.call(this);
  3665. return e4._hash = this._hash.clone(), e4;
  3666. } });
  3667. t3.SHA256 = i2._createHelper(h2), t3.HmacSHA256 = i2._createHmacHelper(h2);
  3668. }(Math), n2.SHA256);
  3669. }), _e = ye, we = n(function(e2, t2) {
  3670. e2.exports = r.HmacSHA256;
  3671. });
  3672. const ve = () => {
  3673. let e2;
  3674. if (!Promise) {
  3675. e2 = () => {
  3676. }, e2.promise = {};
  3677. const t3 = () => {
  3678. throw new te({ message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.' });
  3679. };
  3680. return Object.defineProperty(e2.promise, "then", { get: t3 }), Object.defineProperty(e2.promise, "catch", { get: t3 }), e2;
  3681. }
  3682. const t2 = new Promise((t3, n2) => {
  3683. e2 = (e3, s2) => e3 ? n2(e3) : t3(s2);
  3684. });
  3685. return e2.promise = t2, e2;
  3686. };
  3687. function Ie(e2) {
  3688. return void 0 === e2;
  3689. }
  3690. function Se(e2) {
  3691. return "[object Null]" === Object.prototype.toString.call(e2);
  3692. }
  3693. var be;
  3694. function ke(e2) {
  3695. const t2 = (n2 = e2, "[object Array]" === Object.prototype.toString.call(n2) ? e2 : [e2]);
  3696. var n2;
  3697. for (const e3 of t2) {
  3698. const { isMatch: t3, genAdapter: n3, runtime: s2 } = e3;
  3699. if (t3())
  3700. return { adapter: n3(), runtime: s2 };
  3701. }
  3702. }
  3703. !function(e2) {
  3704. e2.WEB = "web", e2.WX_MP = "wx_mp";
  3705. }(be || (be = {}));
  3706. const Ae = { adapter: null, runtime: void 0 }, Pe = ["anonymousUuidKey"];
  3707. class Te extends me {
  3708. constructor() {
  3709. super(), Ae.adapter.root.tcbObject || (Ae.adapter.root.tcbObject = {});
  3710. }
  3711. setItem(e2, t2) {
  3712. Ae.adapter.root.tcbObject[e2] = t2;
  3713. }
  3714. getItem(e2) {
  3715. return Ae.adapter.root.tcbObject[e2];
  3716. }
  3717. removeItem(e2) {
  3718. delete Ae.adapter.root.tcbObject[e2];
  3719. }
  3720. clear() {
  3721. delete Ae.adapter.root.tcbObject;
  3722. }
  3723. }
  3724. function Ce(e2, t2) {
  3725. switch (e2) {
  3726. case "local":
  3727. return t2.localStorage || new Te();
  3728. case "none":
  3729. return new Te();
  3730. default:
  3731. return t2.sessionStorage || new Te();
  3732. }
  3733. }
  3734. class xe {
  3735. constructor(e2) {
  3736. if (!this._storage) {
  3737. this._persistence = Ae.adapter.primaryStorage || e2.persistence, this._storage = Ce(this._persistence, Ae.adapter);
  3738. const t2 = `access_token_${e2.env}`, n2 = `access_token_expire_${e2.env}`, s2 = `refresh_token_${e2.env}`, r2 = `anonymous_uuid_${e2.env}`, i2 = `login_type_${e2.env}`, o2 = `user_info_${e2.env}`;
  3739. this.keys = { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2, anonymousUuidKey: r2, loginTypeKey: i2, userInfoKey: o2 };
  3740. }
  3741. }
  3742. updatePersistence(e2) {
  3743. if (e2 === this._persistence)
  3744. return;
  3745. const t2 = "local" === this._persistence;
  3746. this._persistence = e2;
  3747. const n2 = Ce(e2, Ae.adapter);
  3748. for (const e3 in this.keys) {
  3749. const s2 = this.keys[e3];
  3750. if (t2 && Pe.includes(e3))
  3751. continue;
  3752. const r2 = this._storage.getItem(s2);
  3753. Ie(r2) || Se(r2) || (n2.setItem(s2, r2), this._storage.removeItem(s2));
  3754. }
  3755. this._storage = n2;
  3756. }
  3757. setStore(e2, t2, n2) {
  3758. if (!this._storage)
  3759. return;
  3760. const s2 = { version: n2 || "localCachev1", content: t2 }, r2 = JSON.stringify(s2);
  3761. try {
  3762. this._storage.setItem(e2, r2);
  3763. } catch (e3) {
  3764. throw e3;
  3765. }
  3766. }
  3767. getStore(e2, t2) {
  3768. try {
  3769. if (!this._storage)
  3770. return;
  3771. } catch (e3) {
  3772. return "";
  3773. }
  3774. t2 = t2 || "localCachev1";
  3775. const n2 = this._storage.getItem(e2);
  3776. if (!n2)
  3777. return "";
  3778. if (n2.indexOf(t2) >= 0) {
  3779. return JSON.parse(n2).content;
  3780. }
  3781. return "";
  3782. }
  3783. removeStore(e2) {
  3784. this._storage.removeItem(e2);
  3785. }
  3786. }
  3787. const Oe = {}, Ee = {};
  3788. function Le(e2) {
  3789. return Oe[e2];
  3790. }
  3791. class Re {
  3792. constructor(e2, t2) {
  3793. this.data = t2 || null, this.name = e2;
  3794. }
  3795. }
  3796. class Ue extends Re {
  3797. constructor(e2, t2) {
  3798. super("error", { error: e2, data: t2 }), this.error = e2;
  3799. }
  3800. }
  3801. const Ne = new class {
  3802. constructor() {
  3803. this._listeners = {};
  3804. }
  3805. on(e2, t2) {
  3806. return function(e3, t3, n2) {
  3807. n2[e3] = n2[e3] || [], n2[e3].push(t3);
  3808. }(e2, t2, this._listeners), this;
  3809. }
  3810. off(e2, t2) {
  3811. return function(e3, t3, n2) {
  3812. if (n2 && n2[e3]) {
  3813. const s2 = n2[e3].indexOf(t3);
  3814. -1 !== s2 && n2[e3].splice(s2, 1);
  3815. }
  3816. }(e2, t2, this._listeners), this;
  3817. }
  3818. fire(e2, t2) {
  3819. if (e2 instanceof Ue)
  3820. return console.error(e2.error), this;
  3821. const n2 = "string" == typeof e2 ? new Re(e2, t2 || {}) : e2;
  3822. const s2 = n2.name;
  3823. if (this._listens(s2)) {
  3824. n2.target = this;
  3825. const e3 = this._listeners[s2] ? [...this._listeners[s2]] : [];
  3826. for (const t3 of e3)
  3827. t3.call(this, n2);
  3828. }
  3829. return this;
  3830. }
  3831. _listens(e2) {
  3832. return this._listeners[e2] && this._listeners[e2].length > 0;
  3833. }
  3834. }();
  3835. function De(e2, t2) {
  3836. Ne.on(e2, t2);
  3837. }
  3838. function Me(e2, t2 = {}) {
  3839. Ne.fire(e2, t2);
  3840. }
  3841. function qe(e2, t2) {
  3842. Ne.off(e2, t2);
  3843. }
  3844. const Fe = "loginStateChanged", Ke = "loginStateExpire", je = "loginTypeChanged", $e = "anonymousConverted", Be = "refreshAccessToken";
  3845. var We;
  3846. !function(e2) {
  3847. e2.ANONYMOUS = "ANONYMOUS", e2.WECHAT = "WECHAT", e2.WECHAT_PUBLIC = "WECHAT-PUBLIC", e2.WECHAT_OPEN = "WECHAT-OPEN", e2.CUSTOM = "CUSTOM", e2.EMAIL = "EMAIL", e2.USERNAME = "USERNAME", e2.NULL = "NULL";
  3848. }(We || (We = {}));
  3849. const He = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"], ze = { "X-SDK-Version": "1.3.5" };
  3850. function Je(e2, t2, n2) {
  3851. const s2 = e2[t2];
  3852. e2[t2] = function(t3) {
  3853. const r2 = {}, i2 = {};
  3854. n2.forEach((n3) => {
  3855. const { data: s3, headers: o3 } = n3.call(e2, t3);
  3856. Object.assign(r2, s3), Object.assign(i2, o3);
  3857. });
  3858. const o2 = t3.data;
  3859. return o2 && (() => {
  3860. var e3;
  3861. if (e3 = o2, "[object FormData]" !== Object.prototype.toString.call(e3))
  3862. t3.data = { ...o2, ...r2 };
  3863. else
  3864. for (const e4 in r2)
  3865. o2.append(e4, r2[e4]);
  3866. })(), t3.headers = { ...t3.headers || {}, ...i2 }, s2.call(e2, t3);
  3867. };
  3868. }
  3869. function Ge() {
  3870. const e2 = Math.random().toString(16).slice(2);
  3871. return { data: { seqId: e2 }, headers: { ...ze, "x-seqid": e2 } };
  3872. }
  3873. class Ve {
  3874. constructor(e2 = {}) {
  3875. var t2;
  3876. this.config = e2, this._reqClass = new Ae.adapter.reqClass({ timeout: this.config.timeout, timeoutMsg: `请求在${this.config.timeout / 1e3}s内未完成,已中断`, restrictedMethods: ["post"] }), this._cache = Le(this.config.env), this._localCache = (t2 = this.config.env, Ee[t2]), Je(this._reqClass, "post", [Ge]), Je(this._reqClass, "upload", [Ge]), Je(this._reqClass, "download", [Ge]);
  3877. }
  3878. async post(e2) {
  3879. return await this._reqClass.post(e2);
  3880. }
  3881. async upload(e2) {
  3882. return await this._reqClass.upload(e2);
  3883. }
  3884. async download(e2) {
  3885. return await this._reqClass.download(e2);
  3886. }
  3887. async refreshAccessToken() {
  3888. let e2, t2;
  3889. this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());
  3890. try {
  3891. e2 = await this._refreshAccessTokenPromise;
  3892. } catch (e3) {
  3893. t2 = e3;
  3894. }
  3895. if (this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t2)
  3896. throw t2;
  3897. return e2;
  3898. }
  3899. async _refreshAccessToken() {
  3900. const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2, loginTypeKey: s2, anonymousUuidKey: r2 } = this._cache.keys;
  3901. this._cache.removeStore(e2), this._cache.removeStore(t2);
  3902. let i2 = this._cache.getStore(n2);
  3903. if (!i2)
  3904. throw new te({ message: "未登录CloudBase" });
  3905. const o2 = { refresh_token: i2 }, a2 = await this.request("auth.fetchAccessTokenWithRefreshToken", o2);
  3906. if (a2.data.code) {
  3907. const { code: e3 } = a2.data;
  3908. if ("SIGN_PARAM_INVALID" === e3 || "REFRESH_TOKEN_EXPIRED" === e3 || "INVALID_REFRESH_TOKEN" === e3) {
  3909. if (this._cache.getStore(s2) === We.ANONYMOUS && "INVALID_REFRESH_TOKEN" === e3) {
  3910. const e4 = this._cache.getStore(r2), t3 = this._cache.getStore(n2), s3 = await this.send("auth.signInAnonymously", { anonymous_uuid: e4, refresh_token: t3 });
  3911. return this.setRefreshToken(s3.refresh_token), this._refreshAccessToken();
  3912. }
  3913. Me(Ke), this._cache.removeStore(n2);
  3914. }
  3915. throw new te({ code: a2.data.code, message: `刷新access token失败:${a2.data.code}` });
  3916. }
  3917. if (a2.data.access_token)
  3918. return Me(Be), this._cache.setStore(e2, a2.data.access_token), this._cache.setStore(t2, a2.data.access_token_expire + Date.now()), { accessToken: a2.data.access_token, accessTokenExpire: a2.data.access_token_expire };
  3919. a2.data.refresh_token && (this._cache.removeStore(n2), this._cache.setStore(n2, a2.data.refresh_token), this._refreshAccessToken());
  3920. }
  3921. async getAccessToken() {
  3922. const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2 } = this._cache.keys;
  3923. if (!this._cache.getStore(n2))
  3924. throw new te({ message: "refresh token不存在,登录状态异常" });
  3925. let s2 = this._cache.getStore(e2), r2 = this._cache.getStore(t2), i2 = true;
  3926. return this._shouldRefreshAccessTokenHook && !await this._shouldRefreshAccessTokenHook(s2, r2) && (i2 = false), (!s2 || !r2 || r2 < Date.now()) && i2 ? this.refreshAccessToken() : { accessToken: s2, accessTokenExpire: r2 };
  3927. }
  3928. async request(e2, t2, n2) {
  3929. const s2 = `x-tcb-trace_${this.config.env}`;
  3930. let r2 = "application/x-www-form-urlencoded";
  3931. const i2 = { action: e2, env: this.config.env, dataVersion: "2019-08-16", ...t2 };
  3932. if (-1 === He.indexOf(e2)) {
  3933. const { refreshTokenKey: e3 } = this._cache.keys;
  3934. this._cache.getStore(e3) && (i2.access_token = (await this.getAccessToken()).accessToken);
  3935. }
  3936. let o2;
  3937. if ("storage.uploadFile" === e2) {
  3938. o2 = new FormData();
  3939. for (let e3 in o2)
  3940. o2.hasOwnProperty(e3) && void 0 !== o2[e3] && o2.append(e3, i2[e3]);
  3941. r2 = "multipart/form-data";
  3942. } else {
  3943. r2 = "application/json", o2 = {};
  3944. for (let e3 in i2)
  3945. void 0 !== i2[e3] && (o2[e3] = i2[e3]);
  3946. }
  3947. let a2 = { headers: { "content-type": r2 } };
  3948. n2 && n2.onUploadProgress && (a2.onUploadProgress = n2.onUploadProgress);
  3949. const c2 = this._localCache.getStore(s2);
  3950. c2 && (a2.headers["X-TCB-Trace"] = c2);
  3951. const { parse: u2, inQuery: h2, search: l2 } = t2;
  3952. let d2 = { env: this.config.env };
  3953. u2 && (d2.parse = true), h2 && (d2 = { ...h2, ...d2 });
  3954. let p2 = function(e3, t3, n3 = {}) {
  3955. const s3 = /\?/.test(t3);
  3956. let r3 = "";
  3957. for (let e4 in n3)
  3958. "" === r3 ? !s3 && (t3 += "?") : r3 += "&", r3 += `${e4}=${encodeURIComponent(n3[e4])}`;
  3959. return /^http(s)?\:\/\//.test(t3 += r3) ? t3 : `${e3}${t3}`;
  3960. }(fe, "//tcb-api.tencentcloudapi.com/web", d2);
  3961. l2 && (p2 += l2);
  3962. const f2 = await this.post({ url: p2, data: o2, ...a2 }), g2 = f2.header && f2.header["x-tcb-trace"];
  3963. if (g2 && this._localCache.setStore(s2, g2), 200 !== Number(f2.status) && 200 !== Number(f2.statusCode) || !f2.data)
  3964. throw new te({ code: "NETWORK_ERROR", message: "network request error" });
  3965. return f2;
  3966. }
  3967. async send(e2, t2 = {}) {
  3968. const n2 = await this.request(e2, t2, { onUploadProgress: t2.onUploadProgress });
  3969. if ("ACCESS_TOKEN_EXPIRED" === n2.data.code && -1 === He.indexOf(e2)) {
  3970. await this.refreshAccessToken();
  3971. const n3 = await this.request(e2, t2, { onUploadProgress: t2.onUploadProgress });
  3972. if (n3.data.code)
  3973. throw new te({ code: n3.data.code, message: n3.data.message });
  3974. return n3.data;
  3975. }
  3976. if (n2.data.code)
  3977. throw new te({ code: n2.data.code, message: n2.data.message });
  3978. return n2.data;
  3979. }
  3980. setRefreshToken(e2) {
  3981. const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys;
  3982. this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2);
  3983. }
  3984. }
  3985. const Ye = {};
  3986. function Qe(e2) {
  3987. return Ye[e2];
  3988. }
  3989. class Xe {
  3990. constructor(e2) {
  3991. this.config = e2, this._cache = Le(e2.env), this._request = Qe(e2.env);
  3992. }
  3993. setRefreshToken(e2) {
  3994. const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys;
  3995. this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2);
  3996. }
  3997. setAccessToken(e2, t2) {
  3998. const { accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys;
  3999. this._cache.setStore(n2, e2), this._cache.setStore(s2, t2);
  4000. }
  4001. async refreshUserInfo() {
  4002. const { data: e2 } = await this._request.send("auth.getUserInfo", {});
  4003. return this.setLocalUserInfo(e2), e2;
  4004. }
  4005. setLocalUserInfo(e2) {
  4006. const { userInfoKey: t2 } = this._cache.keys;
  4007. this._cache.setStore(t2, e2);
  4008. }
  4009. }
  4010. class Ze {
  4011. constructor(e2) {
  4012. if (!e2)
  4013. throw new te({ code: "PARAM_ERROR", message: "envId is not defined" });
  4014. this._envId = e2, this._cache = Le(this._envId), this._request = Qe(this._envId), this.setUserInfo();
  4015. }
  4016. linkWithTicket(e2) {
  4017. if ("string" != typeof e2)
  4018. throw new te({ code: "PARAM_ERROR", message: "ticket must be string" });
  4019. return this._request.send("auth.linkWithTicket", { ticket: e2 });
  4020. }
  4021. linkWithRedirect(e2) {
  4022. e2.signInWithRedirect();
  4023. }
  4024. updatePassword(e2, t2) {
  4025. return this._request.send("auth.updatePassword", { oldPassword: t2, newPassword: e2 });
  4026. }
  4027. updateEmail(e2) {
  4028. return this._request.send("auth.updateEmail", { newEmail: e2 });
  4029. }
  4030. updateUsername(e2) {
  4031. if ("string" != typeof e2)
  4032. throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
  4033. return this._request.send("auth.updateUsername", { username: e2 });
  4034. }
  4035. async getLinkedUidList() {
  4036. const { data: e2 } = await this._request.send("auth.getLinkedUidList", {});
  4037. let t2 = false;
  4038. const { users: n2 } = e2;
  4039. return n2.forEach((e3) => {
  4040. e3.wxOpenId && e3.wxPublicId && (t2 = true);
  4041. }), { users: n2, hasPrimaryUid: t2 };
  4042. }
  4043. setPrimaryUid(e2) {
  4044. return this._request.send("auth.setPrimaryUid", { uid: e2 });
  4045. }
  4046. unlink(e2) {
  4047. return this._request.send("auth.unlink", { platform: e2 });
  4048. }
  4049. async update(e2) {
  4050. const { nickName: t2, gender: n2, avatarUrl: s2, province: r2, country: i2, city: o2 } = e2, { data: a2 } = await this._request.send("auth.updateUserInfo", { nickName: t2, gender: n2, avatarUrl: s2, province: r2, country: i2, city: o2 });
  4051. this.setLocalUserInfo(a2);
  4052. }
  4053. async refresh() {
  4054. const { data: e2 } = await this._request.send("auth.getUserInfo", {});
  4055. return this.setLocalUserInfo(e2), e2;
  4056. }
  4057. setUserInfo() {
  4058. const { userInfoKey: e2 } = this._cache.keys, t2 = this._cache.getStore(e2);
  4059. ["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach((e3) => {
  4060. this[e3] = t2[e3];
  4061. }), this.location = { country: t2.country, province: t2.province, city: t2.city };
  4062. }
  4063. setLocalUserInfo(e2) {
  4064. const { userInfoKey: t2 } = this._cache.keys;
  4065. this._cache.setStore(t2, e2), this.setUserInfo();
  4066. }
  4067. }
  4068. class et {
  4069. constructor(e2) {
  4070. if (!e2)
  4071. throw new te({ code: "PARAM_ERROR", message: "envId is not defined" });
  4072. this._cache = Le(e2);
  4073. const { refreshTokenKey: t2, accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys, r2 = this._cache.getStore(t2), i2 = this._cache.getStore(n2), o2 = this._cache.getStore(s2);
  4074. this.credential = { refreshToken: r2, accessToken: i2, accessTokenExpire: o2 }, this.user = new Ze(e2);
  4075. }
  4076. get isAnonymousAuth() {
  4077. return this.loginType === We.ANONYMOUS;
  4078. }
  4079. get isCustomAuth() {
  4080. return this.loginType === We.CUSTOM;
  4081. }
  4082. get isWeixinAuth() {
  4083. return this.loginType === We.WECHAT || this.loginType === We.WECHAT_OPEN || this.loginType === We.WECHAT_PUBLIC;
  4084. }
  4085. get loginType() {
  4086. return this._cache.getStore(this._cache.keys.loginTypeKey);
  4087. }
  4088. }
  4089. class tt extends Xe {
  4090. async signIn() {
  4091. this._cache.updatePersistence("local");
  4092. const { anonymousUuidKey: e2, refreshTokenKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2) || void 0, s2 = this._cache.getStore(t2) || void 0, r2 = await this._request.send("auth.signInAnonymously", { anonymous_uuid: n2, refresh_token: s2 });
  4093. if (r2.uuid && r2.refresh_token) {
  4094. this._setAnonymousUUID(r2.uuid), this.setRefreshToken(r2.refresh_token), await this._request.refreshAccessToken(), Me(Fe), Me(je, { env: this.config.env, loginType: We.ANONYMOUS, persistence: "local" });
  4095. const e3 = new et(this.config.env);
  4096. return await e3.user.refresh(), e3;
  4097. }
  4098. throw new te({ message: "匿名登录失败" });
  4099. }
  4100. async linkAndRetrieveDataWithTicket(e2) {
  4101. const { anonymousUuidKey: t2, refreshTokenKey: n2 } = this._cache.keys, s2 = this._cache.getStore(t2), r2 = this._cache.getStore(n2), i2 = await this._request.send("auth.linkAndRetrieveDataWithTicket", { anonymous_uuid: s2, refresh_token: r2, ticket: e2 });
  4102. if (i2.refresh_token)
  4103. return this._clearAnonymousUUID(), this.setRefreshToken(i2.refresh_token), await this._request.refreshAccessToken(), Me($e, { env: this.config.env }), Me(je, { loginType: We.CUSTOM, persistence: "local" }), { credential: { refreshToken: i2.refresh_token } };
  4104. throw new te({ message: "匿名转化失败" });
  4105. }
  4106. _setAnonymousUUID(e2) {
  4107. const { anonymousUuidKey: t2, loginTypeKey: n2 } = this._cache.keys;
  4108. this._cache.removeStore(t2), this._cache.setStore(t2, e2), this._cache.setStore(n2, We.ANONYMOUS);
  4109. }
  4110. _clearAnonymousUUID() {
  4111. this._cache.removeStore(this._cache.keys.anonymousUuidKey);
  4112. }
  4113. }
  4114. class nt extends Xe {
  4115. async signIn(e2) {
  4116. if ("string" != typeof e2)
  4117. throw new te({ code: "PARAM_ERROR", message: "ticket must be a string" });
  4118. const { refreshTokenKey: t2 } = this._cache.keys, n2 = await this._request.send("auth.signInWithTicket", { ticket: e2, refresh_token: this._cache.getStore(t2) || "" });
  4119. if (n2.refresh_token)
  4120. return this.setRefreshToken(n2.refresh_token), await this._request.refreshAccessToken(), Me(Fe), Me(je, { env: this.config.env, loginType: We.CUSTOM, persistence: this.config.persistence }), await this.refreshUserInfo(), new et(this.config.env);
  4121. throw new te({ message: "自定义登录失败" });
  4122. }
  4123. }
  4124. class st extends Xe {
  4125. async signIn(e2, t2) {
  4126. if ("string" != typeof e2)
  4127. throw new te({ code: "PARAM_ERROR", message: "email must be a string" });
  4128. const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: "EMAIL", email: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token: i2, access_token_expire: o2 } = s2;
  4129. if (r2)
  4130. return this.setRefreshToken(r2), i2 && o2 ? this.setAccessToken(i2, o2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), Me(Fe), Me(je, { env: this.config.env, loginType: We.EMAIL, persistence: this.config.persistence }), new et(this.config.env);
  4131. throw s2.code ? new te({ code: s2.code, message: `邮箱登录失败: ${s2.message}` }) : new te({ message: "邮箱登录失败" });
  4132. }
  4133. async activate(e2) {
  4134. return this._request.send("auth.activateEndUserMail", { token: e2 });
  4135. }
  4136. async resetPasswordWithToken(e2, t2) {
  4137. return this._request.send("auth.resetPasswordWithToken", { token: e2, newPassword: t2 });
  4138. }
  4139. }
  4140. class rt extends Xe {
  4141. async signIn(e2, t2) {
  4142. if ("string" != typeof e2)
  4143. throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
  4144. "string" != typeof t2 && (t2 = "", console.warn("password is empty"));
  4145. const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: We.USERNAME, username: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token_expire: i2, access_token: o2 } = s2;
  4146. if (r2)
  4147. return this.setRefreshToken(r2), o2 && i2 ? this.setAccessToken(o2, i2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), Me(Fe), Me(je, { env: this.config.env, loginType: We.USERNAME, persistence: this.config.persistence }), new et(this.config.env);
  4148. throw s2.code ? new te({ code: s2.code, message: `用户名密码登录失败: ${s2.message}` }) : new te({ message: "用户名密码登录失败" });
  4149. }
  4150. }
  4151. class it {
  4152. constructor(e2) {
  4153. this.config = e2, this._cache = Le(e2.env), this._request = Qe(e2.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), De(je, this._onLoginTypeChanged);
  4154. }
  4155. get currentUser() {
  4156. const e2 = this.hasLoginState();
  4157. return e2 && e2.user || null;
  4158. }
  4159. get loginType() {
  4160. return this._cache.getStore(this._cache.keys.loginTypeKey);
  4161. }
  4162. anonymousAuthProvider() {
  4163. return new tt(this.config);
  4164. }
  4165. customAuthProvider() {
  4166. return new nt(this.config);
  4167. }
  4168. emailAuthProvider() {
  4169. return new st(this.config);
  4170. }
  4171. usernameAuthProvider() {
  4172. return new rt(this.config);
  4173. }
  4174. async signInAnonymously() {
  4175. return new tt(this.config).signIn();
  4176. }
  4177. async signInWithEmailAndPassword(e2, t2) {
  4178. return new st(this.config).signIn(e2, t2);
  4179. }
  4180. signInWithUsernameAndPassword(e2, t2) {
  4181. return new rt(this.config).signIn(e2, t2);
  4182. }
  4183. async linkAndRetrieveDataWithTicket(e2) {
  4184. this._anonymousAuthProvider || (this._anonymousAuthProvider = new tt(this.config)), De($e, this._onAnonymousConverted);
  4185. return await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e2);
  4186. }
  4187. async signOut() {
  4188. if (this.loginType === We.ANONYMOUS)
  4189. throw new te({ message: "匿名用户不支持登出操作" });
  4190. const { refreshTokenKey: e2, accessTokenKey: t2, accessTokenExpireKey: n2 } = this._cache.keys, s2 = this._cache.getStore(e2);
  4191. if (!s2)
  4192. return;
  4193. const r2 = await this._request.send("auth.logout", { refresh_token: s2 });
  4194. return this._cache.removeStore(e2), this._cache.removeStore(t2), this._cache.removeStore(n2), Me(Fe), Me(je, { env: this.config.env, loginType: We.NULL, persistence: this.config.persistence }), r2;
  4195. }
  4196. async signUpWithEmailAndPassword(e2, t2) {
  4197. return this._request.send("auth.signUpWithEmailAndPassword", { email: e2, password: t2 });
  4198. }
  4199. async sendPasswordResetEmail(e2) {
  4200. return this._request.send("auth.sendPasswordResetEmail", { email: e2 });
  4201. }
  4202. onLoginStateChanged(e2) {
  4203. De(Fe, () => {
  4204. const t3 = this.hasLoginState();
  4205. e2.call(this, t3);
  4206. });
  4207. const t2 = this.hasLoginState();
  4208. e2.call(this, t2);
  4209. }
  4210. onLoginStateExpired(e2) {
  4211. De(Ke, e2.bind(this));
  4212. }
  4213. onAccessTokenRefreshed(e2) {
  4214. De(Be, e2.bind(this));
  4215. }
  4216. onAnonymousConverted(e2) {
  4217. De($e, e2.bind(this));
  4218. }
  4219. onLoginTypeChanged(e2) {
  4220. De(je, () => {
  4221. const t2 = this.hasLoginState();
  4222. e2.call(this, t2);
  4223. });
  4224. }
  4225. async getAccessToken() {
  4226. return { accessToken: (await this._request.getAccessToken()).accessToken, env: this.config.env };
  4227. }
  4228. hasLoginState() {
  4229. const { refreshTokenKey: e2 } = this._cache.keys;
  4230. return this._cache.getStore(e2) ? new et(this.config.env) : null;
  4231. }
  4232. async isUsernameRegistered(e2) {
  4233. if ("string" != typeof e2)
  4234. throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
  4235. const { data: t2 } = await this._request.send("auth.isUsernameRegistered", { username: e2 });
  4236. return t2 && t2.isRegistered;
  4237. }
  4238. getLoginState() {
  4239. return Promise.resolve(this.hasLoginState());
  4240. }
  4241. async signInWithTicket(e2) {
  4242. return new nt(this.config).signIn(e2);
  4243. }
  4244. shouldRefreshAccessToken(e2) {
  4245. this._request._shouldRefreshAccessTokenHook = e2.bind(this);
  4246. }
  4247. getUserInfo() {
  4248. return this._request.send("auth.getUserInfo", {}).then((e2) => e2.code ? e2 : { ...e2.data, requestId: e2.seqId });
  4249. }
  4250. getAuthHeader() {
  4251. const { refreshTokenKey: e2, accessTokenKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2);
  4252. return { "x-cloudbase-credentials": this._cache.getStore(t2) + "/@@/" + n2 };
  4253. }
  4254. _onAnonymousConverted(e2) {
  4255. const { env: t2 } = e2.data;
  4256. t2 === this.config.env && this._cache.updatePersistence(this.config.persistence);
  4257. }
  4258. _onLoginTypeChanged(e2) {
  4259. const { loginType: t2, persistence: n2, env: s2 } = e2.data;
  4260. s2 === this.config.env && (this._cache.updatePersistence(n2), this._cache.setStore(this._cache.keys.loginTypeKey, t2));
  4261. }
  4262. }
  4263. const ot = function(e2, t2) {
  4264. t2 = t2 || ve();
  4265. const n2 = Qe(this.config.env), { cloudPath: s2, filePath: r2, onUploadProgress: i2, fileType: o2 = "image" } = e2;
  4266. return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => {
  4267. const { data: { url: a2, authorization: c2, token: u2, fileId: h2, cosFileId: l2 }, requestId: d2 } = e3, p2 = { key: s2, signature: c2, "x-cos-meta-fileid": l2, success_action_status: "201", "x-cos-security-token": u2 };
  4268. n2.upload({ url: a2, data: p2, file: r2, name: s2, fileType: o2, onUploadProgress: i2 }).then((e4) => {
  4269. 201 === e4.statusCode ? t2(null, { fileID: h2, requestId: d2 }) : t2(new te({ code: "STORAGE_REQUEST_FAIL", message: `STORAGE_REQUEST_FAIL: ${e4.data}` }));
  4270. }).catch((e4) => {
  4271. t2(e4);
  4272. });
  4273. }).catch((e3) => {
  4274. t2(e3);
  4275. }), t2.promise;
  4276. }, at = function(e2, t2) {
  4277. t2 = t2 || ve();
  4278. const n2 = Qe(this.config.env), { cloudPath: s2 } = e2;
  4279. return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => {
  4280. t2(null, e3);
  4281. }).catch((e3) => {
  4282. t2(e3);
  4283. }), t2.promise;
  4284. }, ct = function({ fileList: e2 }, t2) {
  4285. if (t2 = t2 || ve(), !e2 || !Array.isArray(e2))
  4286. return { code: "INVALID_PARAM", message: "fileList必须是非空的数组" };
  4287. for (let t3 of e2)
  4288. if (!t3 || "string" != typeof t3)
  4289. return { code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" };
  4290. const n2 = { fileid_list: e2 };
  4291. return Qe(this.config.env).send("storage.batchDeleteFile", n2).then((e3) => {
  4292. e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.delete_list, requestId: e3.requestId });
  4293. }).catch((e3) => {
  4294. t2(e3);
  4295. }), t2.promise;
  4296. }, ut = function({ fileList: e2 }, t2) {
  4297. t2 = t2 || ve(), e2 && Array.isArray(e2) || t2(null, { code: "INVALID_PARAM", message: "fileList必须是非空的数组" });
  4298. let n2 = [];
  4299. for (let s3 of e2)
  4300. "object" == typeof s3 ? (s3.hasOwnProperty("fileID") && s3.hasOwnProperty("maxAge") || t2(null, { code: "INVALID_PARAM", message: "fileList的元素必须是包含fileID和maxAge的对象" }), n2.push({ fileid: s3.fileID, max_age: s3.maxAge })) : "string" == typeof s3 ? n2.push({ fileid: s3 }) : t2(null, { code: "INVALID_PARAM", message: "fileList的元素必须是字符串" });
  4301. const s2 = { file_list: n2 };
  4302. return Qe(this.config.env).send("storage.batchGetDownloadUrl", s2).then((e3) => {
  4303. e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.download_list, requestId: e3.requestId });
  4304. }).catch((e3) => {
  4305. t2(e3);
  4306. }), t2.promise;
  4307. }, ht = async function({ fileID: e2 }, t2) {
  4308. const n2 = (await ut.call(this, { fileList: [{ fileID: e2, maxAge: 600 }] })).fileList[0];
  4309. if ("SUCCESS" !== n2.code)
  4310. return t2 ? t2(n2) : new Promise((e3) => {
  4311. e3(n2);
  4312. });
  4313. const s2 = Qe(this.config.env);
  4314. let r2 = n2.download_url;
  4315. if (r2 = encodeURI(r2), !t2)
  4316. return s2.download({ url: r2 });
  4317. t2(await s2.download({ url: r2 }));
  4318. }, lt = function({ name: e2, data: t2, query: n2, parse: s2, search: r2 }, i2) {
  4319. const o2 = i2 || ve();
  4320. let a2;
  4321. try {
  4322. a2 = t2 ? JSON.stringify(t2) : "";
  4323. } catch (e3) {
  4324. return Promise.reject(e3);
  4325. }
  4326. if (!e2)
  4327. return Promise.reject(new te({ code: "PARAM_ERROR", message: "函数名不能为空" }));
  4328. const c2 = { inQuery: n2, parse: s2, search: r2, function_name: e2, request_data: a2 };
  4329. return Qe(this.config.env).send("functions.invokeFunction", c2).then((e3) => {
  4330. if (e3.code)
  4331. o2(null, e3);
  4332. else {
  4333. let t3 = e3.data.response_data;
  4334. if (s2)
  4335. o2(null, { result: t3, requestId: e3.requestId });
  4336. else
  4337. try {
  4338. t3 = JSON.parse(e3.data.response_data), o2(null, { result: t3, requestId: e3.requestId });
  4339. } catch (e4) {
  4340. o2(new te({ message: "response data must be json" }));
  4341. }
  4342. }
  4343. return o2.promise;
  4344. }).catch((e3) => {
  4345. o2(e3);
  4346. }), o2.promise;
  4347. }, dt = { timeout: 15e3, persistence: "session" }, pt = {};
  4348. class ft {
  4349. constructor(e2) {
  4350. this.config = e2 || this.config, this.authObj = void 0;
  4351. }
  4352. init(e2) {
  4353. switch (Ae.adapter || (this.requestClient = new Ae.adapter.reqClass({ timeout: e2.timeout || 5e3, timeoutMsg: `请求在${(e2.timeout || 5e3) / 1e3}s内未完成,已中断` })), this.config = { ...dt, ...e2 }, true) {
  4354. case this.config.timeout > 6e5:
  4355. console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = 6e5;
  4356. break;
  4357. case this.config.timeout < 100:
  4358. console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;
  4359. }
  4360. return new ft(this.config);
  4361. }
  4362. auth({ persistence: e2 } = {}) {
  4363. if (this.authObj)
  4364. return this.authObj;
  4365. const t2 = e2 || Ae.adapter.primaryStorage || dt.persistence;
  4366. var n2;
  4367. return t2 !== this.config.persistence && (this.config.persistence = t2), function(e3) {
  4368. const { env: t3 } = e3;
  4369. Oe[t3] = new xe(e3), Ee[t3] = new xe({ ...e3, persistence: "local" });
  4370. }(this.config), n2 = this.config, Ye[n2.env] = new Ve(n2), this.authObj = new it(this.config), this.authObj;
  4371. }
  4372. on(e2, t2) {
  4373. return De.apply(this, [e2, t2]);
  4374. }
  4375. off(e2, t2) {
  4376. return qe.apply(this, [e2, t2]);
  4377. }
  4378. callFunction(e2, t2) {
  4379. return lt.apply(this, [e2, t2]);
  4380. }
  4381. deleteFile(e2, t2) {
  4382. return ct.apply(this, [e2, t2]);
  4383. }
  4384. getTempFileURL(e2, t2) {
  4385. return ut.apply(this, [e2, t2]);
  4386. }
  4387. downloadFile(e2, t2) {
  4388. return ht.apply(this, [e2, t2]);
  4389. }
  4390. uploadFile(e2, t2) {
  4391. return ot.apply(this, [e2, t2]);
  4392. }
  4393. getUploadMetadata(e2, t2) {
  4394. return at.apply(this, [e2, t2]);
  4395. }
  4396. registerExtension(e2) {
  4397. pt[e2.name] = e2;
  4398. }
  4399. async invokeExtension(e2, t2) {
  4400. const n2 = pt[e2];
  4401. if (!n2)
  4402. throw new te({ message: `扩展${e2} 必须先注册` });
  4403. return await n2.invoke(t2, this);
  4404. }
  4405. useAdapters(e2) {
  4406. const { adapter: t2, runtime: n2 } = ke(e2) || {};
  4407. t2 && (Ae.adapter = t2), n2 && (Ae.runtime = n2);
  4408. }
  4409. }
  4410. var gt = new ft();
  4411. function mt(e2, t2, n2) {
  4412. void 0 === n2 && (n2 = {});
  4413. var s2 = /\?/.test(t2), r2 = "";
  4414. for (var i2 in n2)
  4415. "" === r2 ? !s2 && (t2 += "?") : r2 += "&", r2 += i2 + "=" + encodeURIComponent(n2[i2]);
  4416. return /^http(s)?:\/\//.test(t2 += r2) ? t2 : "" + e2 + t2;
  4417. }
  4418. class yt {
  4419. post(e2) {
  4420. const { url: t2, data: n2, headers: s2 } = e2;
  4421. return new Promise((e3, r2) => {
  4422. ne.request({ url: mt("https:", t2), data: n2, method: "POST", header: s2, success(t3) {
  4423. e3(t3);
  4424. }, fail(e4) {
  4425. r2(e4);
  4426. } });
  4427. });
  4428. }
  4429. upload(e2) {
  4430. return new Promise((t2, n2) => {
  4431. const { url: s2, file: r2, data: i2, headers: o2, fileType: a2 } = e2, c2 = ne.uploadFile({ url: mt("https:", s2), name: "file", formData: Object.assign({}, i2), filePath: r2, fileType: a2, header: o2, success(e3) {
  4432. const n3 = { statusCode: e3.statusCode, data: e3.data || {} };
  4433. 200 === e3.statusCode && i2.success_action_status && (n3.statusCode = parseInt(i2.success_action_status, 10)), t2(n3);
  4434. }, fail(e3) {
  4435. n2(new Error(e3.errMsg || "uploadFile:fail"));
  4436. } });
  4437. "function" == typeof e2.onUploadProgress && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((t3) => {
  4438. e2.onUploadProgress({ loaded: t3.totalBytesSent, total: t3.totalBytesExpectedToSend });
  4439. });
  4440. });
  4441. }
  4442. }
  4443. const _t = { setItem(e2, t2) {
  4444. ne.setStorageSync(e2, t2);
  4445. }, getItem: (e2) => ne.getStorageSync(e2), removeItem(e2) {
  4446. ne.removeStorageSync(e2);
  4447. }, clear() {
  4448. ne.clearStorageSync();
  4449. } };
  4450. var wt = { genAdapter: function() {
  4451. return { root: {}, reqClass: yt, localStorage: _t, primaryStorage: "local" };
  4452. }, isMatch: function() {
  4453. return true;
  4454. }, runtime: "uni_app" };
  4455. gt.useAdapters(wt);
  4456. const vt = gt, It = vt.init;
  4457. vt.init = function(e2) {
  4458. e2.env = e2.spaceId;
  4459. const t2 = It.call(this, e2);
  4460. t2.config.provider = "tencent", t2.config.spaceId = e2.spaceId;
  4461. const n2 = t2.auth;
  4462. return t2.auth = function(e3) {
  4463. const t3 = n2.call(this, e3);
  4464. return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach((e4) => {
  4465. var n3;
  4466. t3[e4] = (n3 = t3[e4], function(e5) {
  4467. e5 = e5 || {};
  4468. const { success: t4, fail: s2, complete: r2 } = ee(e5);
  4469. if (!(t4 || s2 || r2))
  4470. return n3.call(this, e5);
  4471. n3.call(this, e5).then((e6) => {
  4472. t4 && t4(e6), r2 && r2(e6);
  4473. }, (e6) => {
  4474. s2 && s2(e6), r2 && r2(e6);
  4475. });
  4476. }).bind(t3);
  4477. }), t3;
  4478. }, t2.customAuth = t2.auth, t2;
  4479. };
  4480. var St = vt;
  4481. var bt = class extends de {
  4482. getAccessToken() {
  4483. return new Promise((e2, t2) => {
  4484. const n2 = "Anonymous_Access_token";
  4485. this.setAccessToken(n2), e2(n2);
  4486. });
  4487. }
  4488. setupRequest(e2, t2) {
  4489. const n2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), s2 = { "Content-Type": "application/json" };
  4490. "auth" !== t2 && (n2.token = this.accessToken, s2["x-basement-token"] = this.accessToken), s2["x-serverless-sign"] = le.sign(n2, this.config.clientSecret);
  4491. const r2 = he();
  4492. s2["x-client-info"] = encodeURIComponent(JSON.stringify(r2));
  4493. const { token: i2 } = re();
  4494. return s2["x-client-token"] = i2, { url: this.config.requestUrl, method: "POST", data: n2, dataType: "json", header: JSON.parse(JSON.stringify(s2)) };
  4495. }
  4496. uploadFileToOSS({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, onUploadProgress: i2 }) {
  4497. return new Promise((o2, a2) => {
  4498. const c2 = this.adapter.uploadFile({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, success(e3) {
  4499. e3 && e3.statusCode < 400 ? o2(e3) : a2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
  4500. }, fail(e3) {
  4501. a2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
  4502. } });
  4503. "function" == typeof i2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => {
  4504. i2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
  4505. });
  4506. });
  4507. }
  4508. uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", onUploadProgress: s2 }) {
  4509. if (!t2)
  4510. throw new te({ code: "CLOUDPATH_REQUIRED", message: "cloudPath不可为空" });
  4511. let r2;
  4512. return this.getOSSUploadOptionsFromPath({ cloudPath: t2 }).then((t3) => {
  4513. const { url: i2, formData: o2, name: a2 } = t3.result;
  4514. r2 = t3.result.fileUrl;
  4515. const c2 = { url: i2, formData: o2, name: a2, filePath: e2, fileType: n2 };
  4516. return this.uploadFileToOSS(Object.assign({}, c2, { onUploadProgress: s2 }));
  4517. }).then(() => this.reportOSSUpload({ cloudPath: t2 })).then((t3) => new Promise((n3, s3) => {
  4518. t3.success ? n3({ success: true, filePath: e2, fileID: r2 }) : s3(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
  4519. }));
  4520. }
  4521. deleteFile({ fileList: e2 }) {
  4522. const t2 = { method: "serverless.file.resource.delete", params: JSON.stringify({ fileList: e2 }) };
  4523. return this.request(this.setupRequest(t2)).then((e3) => {
  4524. if (e3.success)
  4525. return e3.result;
  4526. throw new te({ code: "DELETE_FILE_FAILED", message: "删除文件失败" });
  4527. });
  4528. }
  4529. getTempFileURL({ fileList: e2, maxAge: t2 } = {}) {
  4530. if (!Array.isArray(e2) || 0 === e2.length)
  4531. throw new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
  4532. const n2 = { method: "serverless.file.resource.getTempFileURL", params: JSON.stringify({ fileList: e2, maxAge: t2 }) };
  4533. return this.request(this.setupRequest(n2)).then((e3) => {
  4534. if (e3.success)
  4535. return { fileList: e3.result.fileList.map((e4) => ({ fileID: e4.fileID, tempFileURL: e4.tempFileURL })) };
  4536. throw new te({ code: "GET_TEMP_FILE_URL_FAILED", message: "获取临时文件链接失败" });
  4537. });
  4538. }
  4539. };
  4540. var kt = { init(e2) {
  4541. const t2 = new bt(e2), n2 = { signInAnonymously: function() {
  4542. return t2.authorize();
  4543. }, getLoginState: function() {
  4544. return Promise.resolve(false);
  4545. } };
  4546. return t2.auth = function() {
  4547. return n2;
  4548. }, t2.customAuth = t2.auth, t2;
  4549. } }, At = n(function(e2, t2) {
  4550. e2.exports = r.enc.Hex;
  4551. });
  4552. function Pt(e2 = "", t2 = {}) {
  4553. const { data: n2, functionName: s2, method: r2, headers: i2, signHeaderKeys: o2 = [], config: a2 } = t2, c2 = Date.now(), u2 = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e3) {
  4554. var t3 = 16 * Math.random() | 0;
  4555. return ("x" === e3 ? t3 : 3 & t3 | 8).toString(16);
  4556. }), h2 = Object.assign({}, i2, { "x-from-app-id": a2.spaceAppId, "x-from-env-id": a2.spaceId, "x-to-env-id": a2.spaceId, "x-from-instance-id": c2, "x-from-function-name": s2, "x-client-timestamp": c2, "x-alipay-source": "client", "x-request-id": u2, "x-alipay-callid": u2, "x-trace-id": u2 }), l2 = ["x-from-app-id", "x-from-env-id", "x-to-env-id", "x-from-instance-id", "x-from-function-name", "x-client-timestamp"].concat(o2), [d2 = "", p2 = ""] = e2.split("?") || [], f2 = function(e3) {
  4557. const t3 = e3.signedHeaders.join(";"), n3 = e3.signedHeaders.map((t4) => `${t4.toLowerCase()}:${e3.headers[t4]}
  4558. `).join(""), s3 = _e(e3.body).toString(At), r3 = `${e3.method.toUpperCase()}
  4559. ${e3.path}
  4560. ${e3.query}
  4561. ${n3}
  4562. ${t3}
  4563. ${s3}
  4564. `, i3 = _e(r3).toString(At), o3 = `HMAC-SHA256
  4565. ${e3.timestamp}
  4566. ${i3}
  4567. `, a3 = we(o3, e3.secretKey).toString(At);
  4568. return `HMAC-SHA256 Credential=${e3.secretId}, SignedHeaders=${t3}, Signature=${a3}`;
  4569. }({ path: d2, query: p2, method: r2, headers: h2, timestamp: c2, body: JSON.stringify(n2), secretId: a2.accessKey, secretKey: a2.secretKey, signedHeaders: l2.sort() });
  4570. return { url: `${a2.endpoint}${e2}`, headers: Object.assign({}, h2, { Authorization: f2 }) };
  4571. }
  4572. function Tt({ url: e2, data: t2, method: n2 = "POST", headers: s2 = {} }) {
  4573. return new Promise((r2, i2) => {
  4574. ne.request({ url: e2, method: n2, data: t2, header: s2, dataType: "json", complete: (e3 = {}) => {
  4575. const t3 = s2["x-trace-id"] || "";
  4576. if (!e3.statusCode || e3.statusCode >= 400) {
  4577. const { message: n3, errMsg: s3, trace_id: r3 } = e3.data || {};
  4578. return i2(new te({ code: "SYS_ERR", message: n3 || s3 || "request:fail", requestId: r3 || t3 }));
  4579. }
  4580. r2({ status: e3.statusCode, data: e3.data, headers: e3.header, requestId: t3 });
  4581. } });
  4582. });
  4583. }
  4584. function Ct(e2, t2) {
  4585. const { path: n2, data: s2, method: r2 = "GET" } = e2, { url: i2, headers: o2 } = Pt(n2, { functionName: "", data: s2, method: r2, headers: { "x-alipay-cloud-mode": "oss", "x-data-api-type": "oss", "x-expire-timestamp": Date.now() + 6e4 }, signHeaderKeys: ["x-data-api-type", "x-expire-timestamp"], config: t2 });
  4586. return Tt({ url: i2, data: s2, method: r2, headers: o2 }).then((e3) => {
  4587. const t3 = e3.data || {};
  4588. if (!t3.success)
  4589. throw new te({ code: e3.errCode, message: e3.errMsg, requestId: e3.requestId });
  4590. return t3.data || {};
  4591. }).catch((e3) => {
  4592. throw new te({ code: e3.errCode, message: e3.errMsg, requestId: e3.requestId });
  4593. });
  4594. }
  4595. function xt(e2 = "") {
  4596. const t2 = e2.trim().replace(/^cloud:\/\//, ""), n2 = t2.indexOf("/");
  4597. if (n2 <= 0)
  4598. throw new te({ code: "INVALID_PARAM", message: "fileID不合法" });
  4599. const s2 = t2.substring(0, n2), r2 = t2.substring(n2 + 1);
  4600. return s2 !== this.config.spaceId && console.warn("file ".concat(e2, " does not belong to env ").concat(this.config.spaceId)), r2;
  4601. }
  4602. function Ot(e2 = "") {
  4603. return "cloud://".concat(this.config.spaceId, "/").concat(e2.replace(/^\/+/, ""));
  4604. }
  4605. var Et = class {
  4606. constructor(e2) {
  4607. if (["spaceId", "spaceAppId", "accessKey", "secretKey"].forEach((t2) => {
  4608. if (!Object.prototype.hasOwnProperty.call(e2, t2))
  4609. throw new Error(`${t2} required`);
  4610. }), e2.endpoint) {
  4611. if ("string" != typeof e2.endpoint)
  4612. throw new Error("endpoint must be string");
  4613. if (!/^https:\/\//.test(e2.endpoint))
  4614. throw new Error("endpoint must start with https://");
  4615. e2.endpoint = e2.endpoint.replace(/\/$/, "");
  4616. }
  4617. this.config = Object.assign({}, e2, { endpoint: e2.endpoint || `https://${e2.spaceId}.api-hz.cloudbasefunction.cn` });
  4618. }
  4619. callFunction(e2) {
  4620. return function(e3, t2) {
  4621. const { name: n2, data: s2 } = e3, r2 = "POST", { url: i2, headers: o2 } = Pt("/functions/invokeFunction", { functionName: n2, data: s2, method: r2, headers: { "x-to-function-name": n2 }, signHeaderKeys: ["x-to-function-name"], config: t2 });
  4622. return Tt({ url: i2, data: s2, method: r2, headers: o2 }).then((e4) => ({ errCode: 0, success: true, requestId: e4.requestId, result: e4.data })).catch((e4) => {
  4623. throw new te({ code: e4.errCode, message: e4.errMsg, requestId: e4.requestId });
  4624. });
  4625. }(e2, this.config);
  4626. }
  4627. uploadFileToOSS({ url: e2, filePath: t2, fileType: n2, formData: s2, onUploadProgress: r2 }) {
  4628. return new Promise((i2, o2) => {
  4629. const a2 = ne.uploadFile({ url: e2, filePath: t2, fileType: n2, formData: s2, name: "file", success(e3) {
  4630. e3 && e3.statusCode < 400 ? i2(e3) : o2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
  4631. }, fail(e3) {
  4632. o2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
  4633. } });
  4634. "function" == typeof r2 && a2 && "function" == typeof a2.onProgressUpdate && a2.onProgressUpdate((e3) => {
  4635. r2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
  4636. });
  4637. });
  4638. }
  4639. async uploadFile({ filePath: e2, cloudPath: t2 = "", fileType: n2 = "image", onUploadProgress: s2 }) {
  4640. if ("string" !== f(t2))
  4641. throw new te({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });
  4642. if (!(t2 = t2.trim()))
  4643. throw new te({ code: "INVALID_PARAM", message: "cloudPath不可为空" });
  4644. if (/:\/\//.test(t2))
  4645. throw new te({ code: "INVALID_PARAM", message: "cloudPath不合法" });
  4646. const r2 = await Ct({ path: "/".concat(t2.replace(/^\//, ""), "?post_url") }, this.config), { file_id: i2, upload_url: o2, form_data: a2 } = r2, c2 = a2 && a2.reduce((e3, t3) => (e3[t3.key] = t3.value, e3), {});
  4647. return this.uploadFileToOSS({ url: o2, filePath: e2, fileType: n2, formData: c2, onUploadProgress: s2 }).then(() => ({ fileID: i2 }));
  4648. }
  4649. async getTempFileURL({ fileList: e2 }) {
  4650. return new Promise((t2, n2) => {
  4651. (!e2 || e2.length < 0) && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList不能为空数组" })), e2.length > 50 && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList数组长度不能超过50" }));
  4652. const s2 = [];
  4653. for (const t3 of e2) {
  4654. "string" !== f(t3) && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList的元素必须是非空的字符串" }));
  4655. const e3 = xt.call(this, t3);
  4656. s2.push({ file_id: e3, expire: 600 });
  4657. }
  4658. Ct({ path: "/?download_url", data: { file_list: s2 }, method: "POST" }, this.config).then((e3) => {
  4659. const { file_list: n3 = [] } = e3;
  4660. t2({ fileList: n3.map((e4) => ({ fileID: Ot.call(this, e4.file_id), tempFileURL: e4.download_url })) });
  4661. }).catch((e3) => n2(e3));
  4662. });
  4663. }
  4664. };
  4665. var Lt = { init: (e2) => {
  4666. e2.provider = "alipay";
  4667. const t2 = new Et(e2);
  4668. return t2.auth = function() {
  4669. return { signInAnonymously: function() {
  4670. return Promise.resolve();
  4671. }, getLoginState: function() {
  4672. return Promise.resolve(true);
  4673. } };
  4674. }, t2;
  4675. } };
  4676. function Rt({ data: e2 }) {
  4677. let t2;
  4678. t2 = he();
  4679. const n2 = JSON.parse(JSON.stringify(e2 || {}));
  4680. if (Object.assign(n2, { clientInfo: t2 }), !n2.uniIdToken) {
  4681. const { token: e3 } = re();
  4682. e3 && (n2.uniIdToken = e3);
  4683. }
  4684. return n2;
  4685. }
  4686. async function Ut({ name: e2, data: t2 } = {}) {
  4687. await this.__dev__.initLocalNetwork();
  4688. const { localAddress: n2, localPort: s2 } = this.__dev__, r2 = { aliyun: "aliyun", tencent: "tcb", alipay: "alipay" }[this.config.provider], i2 = this.config.spaceId, o2 = `http://${n2}:${s2}/system/check-function`, a2 = `http://${n2}:${s2}/cloudfunctions/${e2}`;
  4689. return new Promise((t3, n3) => {
  4690. ne.request({ method: "POST", url: o2, data: { name: e2, platform: P, provider: r2, spaceId: i2 }, timeout: 3e3, success(e3) {
  4691. t3(e3);
  4692. }, fail() {
  4693. t3({ data: { code: "NETWORK_ERROR", message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。" } });
  4694. } });
  4695. }).then(({ data: e3 } = {}) => {
  4696. const { code: t3, message: n3 } = e3 || {};
  4697. return { code: 0 === t3 ? 0 : t3 || "SYS_ERR", message: n3 || "SYS_ERR" };
  4698. }).then(({ code: n3, message: s3 }) => {
  4699. if (0 !== n3) {
  4700. switch (n3) {
  4701. case "MODULE_ENCRYPTED":
  4702. console.error(`此云函数(${e2})依赖加密公共模块不可本地调试,自动切换为云端已部署的云函数`);
  4703. break;
  4704. case "FUNCTION_ENCRYPTED":
  4705. console.error(`此云函数(${e2})已加密不可本地调试,自动切换为云端已部署的云函数`);
  4706. break;
  4707. case "ACTION_ENCRYPTED":
  4708. console.error(s3 || "需要访问加密的uni-clientDB-action,自动切换为云端环境");
  4709. break;
  4710. case "NETWORK_ERROR": {
  4711. const e3 = "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下";
  4712. throw console.error(e3), new Error(e3);
  4713. }
  4714. case "SWITCH_TO_CLOUD":
  4715. break;
  4716. default: {
  4717. const e3 = `检测本地调试服务出现错误:${s3},请检查网络环境或重启客户端再试`;
  4718. throw console.error(e3), new Error(e3);
  4719. }
  4720. }
  4721. return this._callCloudFunction({ name: e2, data: t2 });
  4722. }
  4723. return new Promise((e3, n4) => {
  4724. const s4 = Rt.call(this, { data: t2 });
  4725. ne.request({ method: "POST", url: a2, data: { provider: r2, platform: P, param: s4 }, success: ({ statusCode: t3, data: s5 } = {}) => !t3 || t3 >= 400 ? n4(new te({ code: s5.code || "SYS_ERR", message: s5.message || "request:fail" })) : e3({ result: s5 }), fail(e4) {
  4726. n4(new te({ code: e4.code || e4.errCode || "SYS_ERR", message: e4.message || e4.errMsg || "request:fail" }));
  4727. } });
  4728. });
  4729. });
  4730. }
  4731. const Nt = [{ rule: /fc_function_not_found|FUNCTION_NOT_FOUND/, content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间", mode: "append" }];
  4732. var Dt = /[\\^$.*+?()[\]{}|]/g, Mt = RegExp(Dt.source);
  4733. function qt(e2, t2, n2) {
  4734. return e2.replace(new RegExp((s2 = t2) && Mt.test(s2) ? s2.replace(Dt, "\\$&") : s2, "g"), n2);
  4735. var s2;
  4736. }
  4737. const Kt = "request", jt = "response", $t = "both";
  4738. const An = { code: 2e4, message: "System error" }, Pn = { code: 20101, message: "Invalid client" };
  4739. function xn(e2) {
  4740. const { errSubject: t2, subject: n2, errCode: s2, errMsg: r2, code: i2, message: o2, cause: a2 } = e2 || {};
  4741. return new te({ subject: t2 || n2 || "uni-secure-network", code: s2 || i2 || An.code, message: r2 || o2, cause: a2 });
  4742. }
  4743. let En;
  4744. function Dn({ secretType: e2 } = {}) {
  4745. return e2 === Kt || e2 === jt || e2 === $t;
  4746. }
  4747. function Mn({ name: e2, data: t2 = {} } = {}) {
  4748. return "DCloud-clientDB" === e2 && "encryption" === t2.redirectTo && "getAppClientKey" === t2.action;
  4749. }
  4750. function qn({ provider: e2, spaceId: t2, functionName: n2 } = {}) {
  4751. const { appId: s2, uniPlatform: r2, osName: i2 } = ce();
  4752. let o2 = r2;
  4753. "app" === r2 && (o2 = i2);
  4754. const a2 = function({ provider: e3, spaceId: t3 } = {}) {
  4755. const n3 = A;
  4756. if (!n3)
  4757. return {};
  4758. e3 = /* @__PURE__ */ function(e4) {
  4759. return "tencent" === e4 ? "tcb" : e4;
  4760. }(e3);
  4761. const s3 = n3.find((n4) => n4.provider === e3 && n4.spaceId === t3);
  4762. return s3 && s3.config;
  4763. }({ provider: e2, spaceId: t2 });
  4764. if (!a2 || !a2.accessControl || !a2.accessControl.enable)
  4765. return false;
  4766. const c2 = a2.accessControl.function || {}, u2 = Object.keys(c2);
  4767. if (0 === u2.length)
  4768. return true;
  4769. const h2 = function(e3, t3) {
  4770. let n3, s3, r3;
  4771. for (let i3 = 0; i3 < e3.length; i3++) {
  4772. const o3 = e3[i3];
  4773. o3 !== t3 ? "*" !== o3 ? o3.split(",").map((e4) => e4.trim()).indexOf(t3) > -1 && (s3 = o3) : r3 = o3 : n3 = o3;
  4774. }
  4775. return n3 || s3 || r3;
  4776. }(u2, n2);
  4777. if (!h2)
  4778. return false;
  4779. if ((c2[h2] || []).find((e3 = {}) => e3.appId === s2 && (e3.platform || "").toLowerCase() === o2.toLowerCase()))
  4780. return true;
  4781. throw console.error(`此应用[appId: ${s2}, platform: ${o2}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`), xn(Pn);
  4782. }
  4783. function Fn({ functionName: e2, result: t2, logPvd: n2 }) {
  4784. if (this.__dev__.debugLog && t2 && t2.requestId) {
  4785. const s2 = JSON.stringify({ spaceId: this.config.spaceId, functionName: e2, requestId: t2.requestId });
  4786. console.log(`[${n2}-request]${s2}[/${n2}-request]`);
  4787. }
  4788. }
  4789. function Kn(e2) {
  4790. const t2 = e2.callFunction, n2 = function(n3) {
  4791. const s2 = n3.name;
  4792. n3.data = Rt.call(e2, { data: n3.data });
  4793. const r2 = { aliyun: "aliyun", tencent: "tcb", tcb: "tcb", alipay: "alipay" }[this.config.provider], i2 = Dn(n3), o2 = Mn(n3), a2 = i2 || o2;
  4794. return t2.call(this, n3).then((e3) => (e3.errCode = 0, !a2 && Fn.call(this, { functionName: s2, result: e3, logPvd: r2 }), Promise.resolve(e3)), (e3) => (!a2 && Fn.call(this, { functionName: s2, result: e3, logPvd: r2 }), e3 && e3.message && (e3.message = function({ message: e4 = "", extraInfo: t3 = {}, formatter: n4 = [] } = {}) {
  4795. for (let s3 = 0; s3 < n4.length; s3++) {
  4796. const { rule: r3, content: i3, mode: o3 } = n4[s3], a3 = e4.match(r3);
  4797. if (!a3)
  4798. continue;
  4799. let c2 = i3;
  4800. for (let e5 = 1; e5 < a3.length; e5++)
  4801. c2 = qt(c2, `{$${e5}}`, a3[e5]);
  4802. for (const e5 in t3)
  4803. c2 = qt(c2, `{${e5}}`, t3[e5]);
  4804. return "replace" === o3 ? c2 : e4 + c2;
  4805. }
  4806. return e4;
  4807. }({ message: `[${n3.name}]: ${e3.message}`, formatter: Nt, extraInfo: { functionName: s2 } })), Promise.reject(e3)));
  4808. };
  4809. e2.callFunction = function(t3) {
  4810. const { provider: s2, spaceId: r2 } = e2.config, i2 = t3.name;
  4811. let o2, a2;
  4812. if (t3.data = t3.data || {}, e2.__dev__.debugInfo && !e2.__dev__.debugInfo.forceRemote && C ? (e2._callCloudFunction || (e2._callCloudFunction = n2, e2._callLocalFunction = Ut), o2 = Ut) : o2 = n2, o2 = o2.bind(e2), Mn(t3))
  4813. a2 = n2.call(e2, t3);
  4814. else if (Dn(t3)) {
  4815. a2 = new En({ secretType: t3.secretType, uniCloudIns: e2 }).wrapEncryptDataCallFunction(n2.bind(e2))(t3);
  4816. } else if (qn({ provider: s2, spaceId: r2, functionName: i2 })) {
  4817. a2 = new En({ secretType: t3.secretType, uniCloudIns: e2 }).wrapVerifyClientCallFunction(n2.bind(e2))(t3);
  4818. } else
  4819. a2 = o2(t3);
  4820. return Object.defineProperty(a2, "result", { get: () => (console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {}) }), a2.then((e3) => ("undefined" != typeof UTSJSONObject && (e3.result = new UTSJSONObject(e3.result)), e3));
  4821. };
  4822. }
  4823. En = class {
  4824. constructor() {
  4825. throw xn({ message: `Platform ${P} is not enabled, please check whether secure network module is enabled in your manifest.json` });
  4826. }
  4827. };
  4828. const jn = Symbol("CLIENT_DB_INTERNAL");
  4829. function $n(e2, t2) {
  4830. return e2.then = "DoNotReturnProxyWithAFunctionNamedThen", e2._internalType = jn, e2.inspect = null, e2.__v_raw = void 0, new Proxy(e2, { get(e3, n2, s2) {
  4831. if ("_uniClient" === n2)
  4832. return null;
  4833. if ("symbol" == typeof n2)
  4834. return e3[n2];
  4835. if (n2 in e3 || "string" != typeof n2) {
  4836. const t3 = e3[n2];
  4837. return "function" == typeof t3 ? t3.bind(e3) : t3;
  4838. }
  4839. return t2.get(e3, n2, s2);
  4840. } });
  4841. }
  4842. function Bn(e2) {
  4843. return { on: (t2, n2) => {
  4844. e2[t2] = e2[t2] || [], e2[t2].indexOf(n2) > -1 || e2[t2].push(n2);
  4845. }, off: (t2, n2) => {
  4846. e2[t2] = e2[t2] || [];
  4847. const s2 = e2[t2].indexOf(n2);
  4848. -1 !== s2 && e2[t2].splice(s2, 1);
  4849. } };
  4850. }
  4851. const Wn = ["db.Geo", "db.command", "command.aggregate"];
  4852. function Hn(e2, t2) {
  4853. return Wn.indexOf(`${e2}.${t2}`) > -1;
  4854. }
  4855. function zn(e2) {
  4856. switch (f(e2 = se(e2))) {
  4857. case "array":
  4858. return e2.map((e3) => zn(e3));
  4859. case "object":
  4860. return e2._internalType === jn || Object.keys(e2).forEach((t2) => {
  4861. e2[t2] = zn(e2[t2]);
  4862. }), e2;
  4863. case "regexp":
  4864. return { $regexp: { source: e2.source, flags: e2.flags } };
  4865. case "date":
  4866. return { $date: e2.toISOString() };
  4867. default:
  4868. return e2;
  4869. }
  4870. }
  4871. function Jn(e2) {
  4872. return e2 && e2.content && e2.content.$method;
  4873. }
  4874. class Gn {
  4875. constructor(e2, t2, n2) {
  4876. this.content = e2, this.prevStage = t2 || null, this.udb = null, this._database = n2;
  4877. }
  4878. toJSON() {
  4879. let e2 = this;
  4880. const t2 = [e2.content];
  4881. for (; e2.prevStage; )
  4882. e2 = e2.prevStage, t2.push(e2.content);
  4883. return { $db: t2.reverse().map((e3) => ({ $method: e3.$method, $param: zn(e3.$param) })) };
  4884. }
  4885. toString() {
  4886. return JSON.stringify(this.toJSON());
  4887. }
  4888. getAction() {
  4889. const e2 = this.toJSON().$db.find((e3) => "action" === e3.$method);
  4890. return e2 && e2.$param && e2.$param[0];
  4891. }
  4892. getCommand() {
  4893. return { $db: this.toJSON().$db.filter((e2) => "action" !== e2.$method) };
  4894. }
  4895. get isAggregate() {
  4896. let e2 = this;
  4897. for (; e2; ) {
  4898. const t2 = Jn(e2), n2 = Jn(e2.prevStage);
  4899. if ("aggregate" === t2 && "collection" === n2 || "pipeline" === t2)
  4900. return true;
  4901. e2 = e2.prevStage;
  4902. }
  4903. return false;
  4904. }
  4905. get isCommand() {
  4906. let e2 = this;
  4907. for (; e2; ) {
  4908. if ("command" === Jn(e2))
  4909. return true;
  4910. e2 = e2.prevStage;
  4911. }
  4912. return false;
  4913. }
  4914. get isAggregateCommand() {
  4915. let e2 = this;
  4916. for (; e2; ) {
  4917. const t2 = Jn(e2), n2 = Jn(e2.prevStage);
  4918. if ("aggregate" === t2 && "command" === n2)
  4919. return true;
  4920. e2 = e2.prevStage;
  4921. }
  4922. return false;
  4923. }
  4924. getNextStageFn(e2) {
  4925. const t2 = this;
  4926. return function() {
  4927. return Vn({ $method: e2, $param: zn(Array.from(arguments)) }, t2, t2._database);
  4928. };
  4929. }
  4930. get count() {
  4931. return this.isAggregate ? this.getNextStageFn("count") : function() {
  4932. return this._send("count", Array.from(arguments));
  4933. };
  4934. }
  4935. get remove() {
  4936. return this.isCommand ? this.getNextStageFn("remove") : function() {
  4937. return this._send("remove", Array.from(arguments));
  4938. };
  4939. }
  4940. get() {
  4941. return this._send("get", Array.from(arguments));
  4942. }
  4943. get add() {
  4944. return this.isCommand ? this.getNextStageFn("add") : function() {
  4945. return this._send("add", Array.from(arguments));
  4946. };
  4947. }
  4948. update() {
  4949. return this._send("update", Array.from(arguments));
  4950. }
  4951. end() {
  4952. return this._send("end", Array.from(arguments));
  4953. }
  4954. get set() {
  4955. return this.isCommand ? this.getNextStageFn("set") : function() {
  4956. throw new Error("JQL禁止使用set方法");
  4957. };
  4958. }
  4959. _send(e2, t2) {
  4960. const n2 = this.getAction(), s2 = this.getCommand();
  4961. if (s2.$db.push({ $method: e2, $param: zn(t2) }), S) {
  4962. const e3 = s2.$db.find((e4) => "collection" === e4.$method), t3 = e3 && e3.$param;
  4963. t3 && 1 === t3.length && "string" == typeof e3.$param[0] && e3.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");
  4964. }
  4965. return this._database._callCloudFunction({ action: n2, command: s2 });
  4966. }
  4967. }
  4968. function Vn(e2, t2, n2) {
  4969. return $n(new Gn(e2, t2, n2), { get(e3, t3) {
  4970. let s2 = "db";
  4971. return e3 && e3.content && (s2 = e3.content.$method), Hn(s2, t3) ? Vn({ $method: t3 }, e3, n2) : function() {
  4972. return Vn({ $method: t3, $param: zn(Array.from(arguments)) }, e3, n2);
  4973. };
  4974. } });
  4975. }
  4976. function Yn({ path: e2, method: t2 }) {
  4977. return class {
  4978. constructor() {
  4979. this.param = Array.from(arguments);
  4980. }
  4981. toJSON() {
  4982. return { $newDb: [...e2.map((e3) => ({ $method: e3 })), { $method: t2, $param: this.param }] };
  4983. }
  4984. toString() {
  4985. return JSON.stringify(this.toJSON());
  4986. }
  4987. };
  4988. }
  4989. function Qn(e2, t2 = {}) {
  4990. return $n(new e2(t2), { get: (e3, t3) => Hn("db", t3) ? Vn({ $method: t3 }, null, e3) : function() {
  4991. return Vn({ $method: t3, $param: zn(Array.from(arguments)) }, null, e3);
  4992. } });
  4993. }
  4994. class Xn extends class {
  4995. constructor({ uniClient: e2 = {}, isJQL: t2 = false } = {}) {
  4996. this._uniClient = e2, this._authCallBacks = {}, this._dbCallBacks = {}, e2._isDefault && (this._dbCallBacks = L("_globalUniCloudDatabaseCallback")), t2 || (this.auth = Bn(this._authCallBacks)), this._isJQL = t2, Object.assign(this, Bn(this._dbCallBacks)), this.env = $n({}, { get: (e3, t3) => ({ $env: t3 }) }), this.Geo = $n({}, { get: (e3, t3) => Yn({ path: ["Geo"], method: t3 }) }), this.serverDate = Yn({ path: [], method: "serverDate" }), this.RegExp = Yn({ path: [], method: "RegExp" });
  4997. }
  4998. getCloudEnv(e2) {
  4999. if ("string" != typeof e2 || !e2.trim())
  5000. throw new Error("getCloudEnv参数错误");
  5001. return { $env: e2.replace("$cloudEnv_", "") };
  5002. }
  5003. _callback(e2, t2) {
  5004. const n2 = this._dbCallBacks;
  5005. n2[e2] && n2[e2].forEach((e3) => {
  5006. e3(...t2);
  5007. });
  5008. }
  5009. _callbackAuth(e2, t2) {
  5010. const n2 = this._authCallBacks;
  5011. n2[e2] && n2[e2].forEach((e3) => {
  5012. e3(...t2);
  5013. });
  5014. }
  5015. multiSend() {
  5016. const e2 = Array.from(arguments), t2 = e2.map((e3) => {
  5017. const t3 = e3.getAction(), n2 = e3.getCommand();
  5018. if ("getTemp" !== n2.$db[n2.$db.length - 1].$method)
  5019. throw new Error("multiSend只支持子命令内使用getTemp");
  5020. return { action: t3, command: n2 };
  5021. });
  5022. return this._callCloudFunction({ multiCommand: t2, queryList: e2 });
  5023. }
  5024. } {
  5025. _parseResult(e2) {
  5026. return this._isJQL ? e2.result : e2;
  5027. }
  5028. _callCloudFunction({ action: e2, command: t2, multiCommand: n2, queryList: s2 }) {
  5029. function r2(e3, t3) {
  5030. if (n2 && s2)
  5031. for (let n3 = 0; n3 < s2.length; n3++) {
  5032. const r3 = s2[n3];
  5033. r3.udb && "function" == typeof r3.udb.setResult && (t3 ? r3.udb.setResult(t3) : r3.udb.setResult(e3.result.dataList[n3]));
  5034. }
  5035. }
  5036. const i2 = this, o2 = this._isJQL ? "databaseForJQL" : "database";
  5037. function a2(e3) {
  5038. return i2._callback("error", [e3]), M(q(o2, "fail"), e3).then(() => M(q(o2, "complete"), e3)).then(() => (r2(null, e3), Y(j, { type: W, content: e3 }), Promise.reject(e3)));
  5039. }
  5040. const c2 = M(q(o2, "invoke")), u2 = this._uniClient;
  5041. return c2.then(() => u2.callFunction({ name: "DCloud-clientDB", type: h, data: { action: e2, command: t2, multiCommand: n2 } })).then((e3) => {
  5042. const { code: t3, message: n3, token: s3, tokenExpired: c3, systemInfo: u3 = [] } = e3.result;
  5043. if (u3)
  5044. for (let e4 = 0; e4 < u3.length; e4++) {
  5045. const { level: t4, message: n4, detail: s4 } = u3[e4], r3 = console["warn" === t4 ? "error" : t4] || console.log;
  5046. let i3 = "[System Info]" + n4;
  5047. s4 && (i3 = `${i3}
  5048. 详细信息:${s4}`), r3(i3);
  5049. }
  5050. if (t3) {
  5051. return a2(new te({ code: t3, message: n3, requestId: e3.requestId }));
  5052. }
  5053. e3.result.errCode = e3.result.errCode || e3.result.code, e3.result.errMsg = e3.result.errMsg || e3.result.message, s3 && c3 && (ie({ token: s3, tokenExpired: c3 }), this._callbackAuth("refreshToken", [{ token: s3, tokenExpired: c3 }]), this._callback("refreshToken", [{ token: s3, tokenExpired: c3 }]), Y(B, { token: s3, tokenExpired: c3 }));
  5054. const h2 = [{ prop: "affectedDocs", tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代" }, { prop: "code", tips: "code不再推荐使用,请使用errCode替代" }, { prop: "message", tips: "message不再推荐使用,请使用errMsg替代" }];
  5055. for (let t4 = 0; t4 < h2.length; t4++) {
  5056. const { prop: n4, tips: s4 } = h2[t4];
  5057. if (n4 in e3.result) {
  5058. const t5 = e3.result[n4];
  5059. Object.defineProperty(e3.result, n4, { get: () => (console.warn(s4), t5) });
  5060. }
  5061. }
  5062. return function(e4) {
  5063. return M(q(o2, "success"), e4).then(() => M(q(o2, "complete"), e4)).then(() => {
  5064. r2(e4, null);
  5065. const t4 = i2._parseResult(e4);
  5066. return Y(j, { type: W, content: t4 }), Promise.resolve(t4);
  5067. });
  5068. }(e3);
  5069. }, (e3) => {
  5070. /fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e3.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB");
  5071. return a2(new te({ code: e3.code || "SYSTEM_ERROR", message: e3.message, requestId: e3.requestId }));
  5072. });
  5073. }
  5074. }
  5075. const Zn = "token无效,跳转登录页面", es = "token过期,跳转登录页面", ts = { TOKEN_INVALID_TOKEN_EXPIRED: es, TOKEN_INVALID_INVALID_CLIENTID: Zn, TOKEN_INVALID: Zn, TOKEN_INVALID_WRONG_TOKEN: Zn, TOKEN_INVALID_ANONYMOUS_USER: Zn }, ns = { "uni-id-token-expired": es, "uni-id-check-token-failed": Zn, "uni-id-token-not-exist": Zn, "uni-id-check-device-feature-failed": Zn };
  5076. function ss(e2, t2) {
  5077. let n2 = "";
  5078. return n2 = e2 ? `${e2}/${t2}` : t2, n2.replace(/^\//, "");
  5079. }
  5080. function rs(e2 = [], t2 = "") {
  5081. const n2 = [], s2 = [];
  5082. return e2.forEach((e3) => {
  5083. true === e3.needLogin ? n2.push(ss(t2, e3.path)) : false === e3.needLogin && s2.push(ss(t2, e3.path));
  5084. }), { needLoginPage: n2, notNeedLoginPage: s2 };
  5085. }
  5086. function is(e2) {
  5087. return e2.split("?")[0].replace(/^\//, "");
  5088. }
  5089. function os() {
  5090. return function(e2) {
  5091. let t2 = e2 && e2.$page && e2.$page.fullPath || "";
  5092. return t2 ? ("/" !== t2.charAt(0) && (t2 = "/" + t2), t2) : t2;
  5093. }(function() {
  5094. const e2 = getCurrentPages();
  5095. return e2[e2.length - 1];
  5096. }());
  5097. }
  5098. function as() {
  5099. return is(os());
  5100. }
  5101. function cs(e2 = "", t2 = {}) {
  5102. if (!e2)
  5103. return false;
  5104. if (!(t2 && t2.list && t2.list.length))
  5105. return false;
  5106. const n2 = t2.list, s2 = is(e2);
  5107. return n2.some((e3) => e3.pagePath === s2);
  5108. }
  5109. const us = !!e.uniIdRouter;
  5110. const { loginPage: hs, routerNeedLogin: ls, resToLogin: ds, needLoginPage: ps, notNeedLoginPage: fs, loginPageInTabBar: gs } = function({ pages: t2 = [], subPackages: n2 = [], uniIdRouter: s2 = {}, tabBar: r2 = {} } = e) {
  5111. const { loginPage: i2, needLogin: o2 = [], resToLogin: a2 = true } = s2, { needLoginPage: c2, notNeedLoginPage: u2 } = rs(t2), { needLoginPage: h2, notNeedLoginPage: l2 } = function(e2 = []) {
  5112. const t3 = [], n3 = [];
  5113. return e2.forEach((e3) => {
  5114. const { root: s3, pages: r3 = [] } = e3, { needLoginPage: i3, notNeedLoginPage: o3 } = rs(r3, s3);
  5115. t3.push(...i3), n3.push(...o3);
  5116. }), { needLoginPage: t3, notNeedLoginPage: n3 };
  5117. }(n2);
  5118. return { loginPage: i2, routerNeedLogin: o2, resToLogin: a2, needLoginPage: [...c2, ...h2], notNeedLoginPage: [...u2, ...l2], loginPageInTabBar: cs(i2, r2) };
  5119. }();
  5120. if (ps.indexOf(hs) > -1)
  5121. throw new Error(`Login page [${hs}] should not be "needLogin", please check your pages.json`);
  5122. function ms(e2) {
  5123. const t2 = as();
  5124. if ("/" === e2.charAt(0))
  5125. return e2;
  5126. const [n2, s2] = e2.split("?"), r2 = n2.replace(/^\//, "").split("/"), i2 = t2.split("/");
  5127. i2.pop();
  5128. for (let e3 = 0; e3 < r2.length; e3++) {
  5129. const t3 = r2[e3];
  5130. ".." === t3 ? i2.pop() : "." !== t3 && i2.push(t3);
  5131. }
  5132. return "" === i2[0] && i2.shift(), "/" + i2.join("/") + (s2 ? "?" + s2 : "");
  5133. }
  5134. function ys(e2) {
  5135. const t2 = is(ms(e2));
  5136. return !(fs.indexOf(t2) > -1) && (ps.indexOf(t2) > -1 || ls.some((t3) => function(e3, t4) {
  5137. return new RegExp(t4).test(e3);
  5138. }(e2, t3)));
  5139. }
  5140. function _s({ redirect: e2 }) {
  5141. const t2 = is(e2), n2 = is(hs);
  5142. return as() !== n2 && t2 !== n2;
  5143. }
  5144. function ws({ api: e2, redirect: t2 } = {}) {
  5145. if (!t2 || !_s({ redirect: t2 }))
  5146. return;
  5147. const n2 = function(e3, t3) {
  5148. return "/" !== e3.charAt(0) && (e3 = "/" + e3), t3 ? e3.indexOf("?") > -1 ? e3 + `&uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3 + `?uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3;
  5149. }(hs, t2);
  5150. gs ? "navigateTo" !== e2 && "redirectTo" !== e2 || (e2 = "switchTab") : "switchTab" === e2 && (e2 = "navigateTo");
  5151. const s2 = { navigateTo: uni.navigateTo, redirectTo: uni.redirectTo, switchTab: uni.switchTab, reLaunch: uni.reLaunch };
  5152. setTimeout(() => {
  5153. s2[e2]({ url: n2 });
  5154. }, 0);
  5155. }
  5156. function vs({ url: e2 } = {}) {
  5157. const t2 = { abortLoginPageJump: false, autoToLoginPage: false }, n2 = function() {
  5158. const { token: e3, tokenExpired: t3 } = re();
  5159. let n3;
  5160. if (e3) {
  5161. if (t3 < Date.now()) {
  5162. const e4 = "uni-id-token-expired";
  5163. n3 = { errCode: e4, errMsg: ns[e4] };
  5164. }
  5165. } else {
  5166. const e4 = "uni-id-check-token-failed";
  5167. n3 = { errCode: e4, errMsg: ns[e4] };
  5168. }
  5169. return n3;
  5170. }();
  5171. if (ys(e2) && n2) {
  5172. n2.uniIdRedirectUrl = e2;
  5173. if (J($).length > 0)
  5174. return setTimeout(() => {
  5175. Y($, n2);
  5176. }, 0), t2.abortLoginPageJump = true, t2;
  5177. t2.autoToLoginPage = true;
  5178. }
  5179. return t2;
  5180. }
  5181. function Is() {
  5182. !function() {
  5183. const e3 = os(), { abortLoginPageJump: t2, autoToLoginPage: n2 } = vs({ url: e3 });
  5184. t2 || n2 && ws({ api: "redirectTo", redirect: e3 });
  5185. }();
  5186. const e2 = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
  5187. for (let t2 = 0; t2 < e2.length; t2++) {
  5188. const n2 = e2[t2];
  5189. uni.addInterceptor(n2, { invoke(e3) {
  5190. const { abortLoginPageJump: t3, autoToLoginPage: s2 } = vs({ url: e3.url });
  5191. return t3 ? e3 : s2 ? (ws({ api: n2, redirect: ms(e3.url) }), false) : e3;
  5192. } });
  5193. }
  5194. }
  5195. function Ss() {
  5196. this.onResponse((e2) => {
  5197. const { type: t2, content: n2 } = e2;
  5198. let s2 = false;
  5199. switch (t2) {
  5200. case "cloudobject":
  5201. s2 = function(e3) {
  5202. if ("object" != typeof e3)
  5203. return false;
  5204. const { errCode: t3 } = e3 || {};
  5205. return t3 in ns;
  5206. }(n2);
  5207. break;
  5208. case "clientdb":
  5209. s2 = function(e3) {
  5210. if ("object" != typeof e3)
  5211. return false;
  5212. const { errCode: t3 } = e3 || {};
  5213. return t3 in ts;
  5214. }(n2);
  5215. }
  5216. s2 && function(e3 = {}) {
  5217. const t3 = J($);
  5218. Z().then(() => {
  5219. const n3 = os();
  5220. if (n3 && _s({ redirect: n3 }))
  5221. return t3.length > 0 ? Y($, Object.assign({ uniIdRedirectUrl: n3 }, e3)) : void (hs && ws({ api: "navigateTo", redirect: n3 }));
  5222. });
  5223. }(n2);
  5224. });
  5225. }
  5226. function bs(e2) {
  5227. !function(e3) {
  5228. e3.onResponse = function(e4) {
  5229. G(j, e4);
  5230. }, e3.offResponse = function(e4) {
  5231. V(j, e4);
  5232. };
  5233. }(e2), function(e3) {
  5234. e3.onNeedLogin = function(e4) {
  5235. G($, e4);
  5236. }, e3.offNeedLogin = function(e4) {
  5237. V($, e4);
  5238. }, us && (L("_globalUniCloudStatus").needLoginInit || (L("_globalUniCloudStatus").needLoginInit = true, Z().then(() => {
  5239. Is.call(e3);
  5240. }), ds && Ss.call(e3)));
  5241. }(e2), function(e3) {
  5242. e3.onRefreshToken = function(e4) {
  5243. G(B, e4);
  5244. }, e3.offRefreshToken = function(e4) {
  5245. V(B, e4);
  5246. };
  5247. }(e2);
  5248. }
  5249. let ks;
  5250. const As = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", Ps = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  5251. function Ts() {
  5252. const e2 = re().token || "", t2 = e2.split(".");
  5253. if (!e2 || 3 !== t2.length)
  5254. return { uid: null, role: [], permission: [], tokenExpired: 0 };
  5255. let n2;
  5256. try {
  5257. n2 = JSON.parse((s2 = t2[1], decodeURIComponent(ks(s2).split("").map(function(e3) {
  5258. return "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2);
  5259. }).join(""))));
  5260. } catch (e3) {
  5261. throw new Error("获取当前用户信息出错,详细错误信息为:" + e3.message);
  5262. }
  5263. var s2;
  5264. return n2.tokenExpired = 1e3 * n2.exp, delete n2.exp, delete n2.iat, n2;
  5265. }
  5266. ks = "function" != typeof atob ? function(e2) {
  5267. if (e2 = String(e2).replace(/[\t\n\f\r ]+/g, ""), !Ps.test(e2))
  5268. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  5269. var t2;
  5270. e2 += "==".slice(2 - (3 & e2.length));
  5271. for (var n2, s2, r2 = "", i2 = 0; i2 < e2.length; )
  5272. t2 = As.indexOf(e2.charAt(i2++)) << 18 | As.indexOf(e2.charAt(i2++)) << 12 | (n2 = As.indexOf(e2.charAt(i2++))) << 6 | (s2 = As.indexOf(e2.charAt(i2++))), r2 += 64 === n2 ? String.fromCharCode(t2 >> 16 & 255) : 64 === s2 ? String.fromCharCode(t2 >> 16 & 255, t2 >> 8 & 255) : String.fromCharCode(t2 >> 16 & 255, t2 >> 8 & 255, 255 & t2);
  5273. return r2;
  5274. } : atob;
  5275. var Cs = n(function(e2, t2) {
  5276. Object.defineProperty(t2, "__esModule", { value: true });
  5277. const n2 = "chooseAndUploadFile:ok", s2 = "chooseAndUploadFile:fail";
  5278. function r2(e3, t3) {
  5279. return e3.tempFiles.forEach((e4, n3) => {
  5280. e4.name || (e4.name = e4.path.substring(e4.path.lastIndexOf("/") + 1)), t3 && (e4.fileType = t3), e4.cloudPath = Date.now() + "_" + n3 + e4.name.substring(e4.name.lastIndexOf("."));
  5281. }), e3.tempFilePaths || (e3.tempFilePaths = e3.tempFiles.map((e4) => e4.path)), e3;
  5282. }
  5283. function i2(e3, t3, { onChooseFile: s3, onUploadProgress: r3 }) {
  5284. return t3.then((e4) => {
  5285. if (s3) {
  5286. const t4 = s3(e4);
  5287. if (void 0 !== t4)
  5288. return Promise.resolve(t4).then((t5) => void 0 === t5 ? e4 : t5);
  5289. }
  5290. return e4;
  5291. }).then((t4) => false === t4 ? { errMsg: n2, tempFilePaths: [], tempFiles: [] } : function(e4, t5, s4 = 5, r4) {
  5292. (t5 = Object.assign({}, t5)).errMsg = n2;
  5293. const i3 = t5.tempFiles, o2 = i3.length;
  5294. let a2 = 0;
  5295. return new Promise((n3) => {
  5296. for (; a2 < s4; )
  5297. c2();
  5298. function c2() {
  5299. const s5 = a2++;
  5300. if (s5 >= o2)
  5301. return void (!i3.find((e5) => !e5.url && !e5.errMsg) && n3(t5));
  5302. const u2 = i3[s5];
  5303. e4.uploadFile({ provider: u2.provider, filePath: u2.path, cloudPath: u2.cloudPath, fileType: u2.fileType, cloudPathAsRealPath: u2.cloudPathAsRealPath, onUploadProgress(e5) {
  5304. e5.index = s5, e5.tempFile = u2, e5.tempFilePath = u2.path, r4 && r4(e5);
  5305. } }).then((e5) => {
  5306. u2.url = e5.fileID, s5 < o2 && c2();
  5307. }).catch((e5) => {
  5308. u2.errMsg = e5.errMsg || e5.message, s5 < o2 && c2();
  5309. });
  5310. }
  5311. });
  5312. }(e3, t4, 5, r3));
  5313. }
  5314. t2.initChooseAndUploadFile = function(e3) {
  5315. return function(t3 = { type: "all" }) {
  5316. return "image" === t3.type ? i2(e3, function(e4) {
  5317. const { count: t4, sizeType: n3, sourceType: i3 = ["album", "camera"], extension: o2 } = e4;
  5318. return new Promise((e5, a2) => {
  5319. uni.chooseImage({ count: t4, sizeType: n3, sourceType: i3, extension: o2, success(t5) {
  5320. e5(r2(t5, "image"));
  5321. }, fail(e6) {
  5322. a2({ errMsg: e6.errMsg.replace("chooseImage:fail", s2) });
  5323. } });
  5324. });
  5325. }(t3), t3) : "video" === t3.type ? i2(e3, function(e4) {
  5326. const { camera: t4, compressed: n3, maxDuration: i3, sourceType: o2 = ["album", "camera"], extension: a2 } = e4;
  5327. return new Promise((e5, c2) => {
  5328. uni.chooseVideo({ camera: t4, compressed: n3, maxDuration: i3, sourceType: o2, extension: a2, success(t5) {
  5329. const { tempFilePath: n4, duration: s3, size: i4, height: o3, width: a3 } = t5;
  5330. e5(r2({ errMsg: "chooseVideo:ok", tempFilePaths: [n4], tempFiles: [{ name: t5.tempFile && t5.tempFile.name || "", path: n4, size: i4, type: t5.tempFile && t5.tempFile.type || "", width: a3, height: o3, duration: s3, fileType: "video", cloudPath: "" }] }, "video"));
  5331. }, fail(e6) {
  5332. c2({ errMsg: e6.errMsg.replace("chooseVideo:fail", s2) });
  5333. } });
  5334. });
  5335. }(t3), t3) : i2(e3, function(e4) {
  5336. const { count: t4, extension: n3 } = e4;
  5337. return new Promise((e5, i3) => {
  5338. let o2 = uni.chooseFile;
  5339. if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o2 = wx.chooseMessageFile), "function" != typeof o2)
  5340. return i3({ errMsg: s2 + " 请指定 type 类型,该平台仅支持选择 image 或 video。" });
  5341. o2({ type: "all", count: t4, extension: n3, success(t5) {
  5342. e5(r2(t5));
  5343. }, fail(e6) {
  5344. i3({ errMsg: e6.errMsg.replace("chooseFile:fail", s2) });
  5345. } });
  5346. });
  5347. }(t3), t3);
  5348. };
  5349. };
  5350. }), xs = t$2(Cs);
  5351. const Os = "manual";
  5352. function Es(e2) {
  5353. return { props: { localdata: { type: Array, default: () => [] }, options: { type: [Object, Array], default: () => ({}) }, spaceInfo: { type: Object, default: () => ({}) }, collection: { type: [String, Array], default: "" }, action: { type: String, default: "" }, field: { type: String, default: "" }, orderby: { type: String, default: "" }, where: { type: [String, Object], default: "" }, pageData: { type: String, default: "add" }, pageCurrent: { type: Number, default: 1 }, pageSize: { type: Number, default: 20 }, getcount: { type: [Boolean, String], default: false }, gettree: { type: [Boolean, String], default: false }, gettreepath: { type: [Boolean, String], default: false }, startwith: { type: String, default: "" }, limitlevel: { type: Number, default: 10 }, groupby: { type: String, default: "" }, groupField: { type: String, default: "" }, distinct: { type: [Boolean, String], default: false }, foreignKey: { type: String, default: "" }, loadtime: { type: String, default: "auto" }, manual: { type: Boolean, default: false } }, data: () => ({ mixinDatacomLoading: false, mixinDatacomHasMore: false, mixinDatacomResData: [], mixinDatacomErrorMessage: "", mixinDatacomPage: {}, mixinDatacomError: null }), created() {
  5354. this.mixinDatacomPage = { current: this.pageCurrent, size: this.pageSize, count: 0 }, this.$watch(() => {
  5355. var e3 = [];
  5356. return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach((t2) => {
  5357. e3.push(this[t2]);
  5358. }), e3;
  5359. }, (e3, t2) => {
  5360. if (this.loadtime === Os)
  5361. return;
  5362. let n2 = false;
  5363. const s2 = [];
  5364. for (let r2 = 2; r2 < e3.length; r2++)
  5365. e3[r2] !== t2[r2] && (s2.push(e3[r2]), n2 = true);
  5366. e3[0] !== t2[0] && (this.mixinDatacomPage.current = this.pageCurrent), this.mixinDatacomPage.size = this.pageSize, this.onMixinDatacomPropsChange(n2, s2);
  5367. });
  5368. }, methods: { onMixinDatacomPropsChange(e3, t2) {
  5369. }, mixinDatacomEasyGet({ getone: e3 = false, success: t2, fail: n2 } = {}) {
  5370. this.mixinDatacomLoading || (this.mixinDatacomLoading = true, this.mixinDatacomErrorMessage = "", this.mixinDatacomError = null, this.mixinDatacomGet().then((n3) => {
  5371. this.mixinDatacomLoading = false;
  5372. const { data: s2, count: r2 } = n3.result;
  5373. this.getcount && (this.mixinDatacomPage.count = r2), this.mixinDatacomHasMore = s2.length < this.pageSize;
  5374. const i2 = e3 ? s2.length ? s2[0] : void 0 : s2;
  5375. this.mixinDatacomResData = i2, t2 && t2(i2);
  5376. }).catch((e4) => {
  5377. this.mixinDatacomLoading = false, this.mixinDatacomErrorMessage = e4, this.mixinDatacomError = e4, n2 && n2(e4);
  5378. }));
  5379. }, mixinDatacomGet(t2 = {}) {
  5380. let n2;
  5381. t2 = t2 || {}, n2 = "undefined" != typeof __uniX && __uniX ? e2.databaseForJQL(this.spaceInfo) : e2.database(this.spaceInfo);
  5382. const s2 = t2.action || this.action;
  5383. s2 && (n2 = n2.action(s2));
  5384. const r2 = t2.collection || this.collection;
  5385. n2 = Array.isArray(r2) ? n2.collection(...r2) : n2.collection(r2);
  5386. const i2 = t2.where || this.where;
  5387. i2 && Object.keys(i2).length && (n2 = n2.where(i2));
  5388. const o2 = t2.field || this.field;
  5389. o2 && (n2 = n2.field(o2));
  5390. const a2 = t2.foreignKey || this.foreignKey;
  5391. a2 && (n2 = n2.foreignKey(a2));
  5392. const c2 = t2.groupby || this.groupby;
  5393. c2 && (n2 = n2.groupBy(c2));
  5394. const u2 = t2.groupField || this.groupField;
  5395. u2 && (n2 = n2.groupField(u2));
  5396. true === (void 0 !== t2.distinct ? t2.distinct : this.distinct) && (n2 = n2.distinct());
  5397. const h2 = t2.orderby || this.orderby;
  5398. h2 && (n2 = n2.orderBy(h2));
  5399. const l2 = void 0 !== t2.pageCurrent ? t2.pageCurrent : this.mixinDatacomPage.current, d2 = void 0 !== t2.pageSize ? t2.pageSize : this.mixinDatacomPage.size, p2 = void 0 !== t2.getcount ? t2.getcount : this.getcount, f2 = void 0 !== t2.gettree ? t2.gettree : this.gettree, g2 = void 0 !== t2.gettreepath ? t2.gettreepath : this.gettreepath, m2 = { getCount: p2 }, y2 = { limitLevel: void 0 !== t2.limitlevel ? t2.limitlevel : this.limitlevel, startWith: void 0 !== t2.startwith ? t2.startwith : this.startwith };
  5400. return f2 && (m2.getTree = y2), g2 && (m2.getTreePath = y2), n2 = n2.skip(d2 * (l2 - 1)).limit(d2).get(m2), n2;
  5401. } } };
  5402. }
  5403. function Ls(e2) {
  5404. return function(t2, n2 = {}) {
  5405. n2 = function(e3, t3 = {}) {
  5406. return e3.customUI = t3.customUI || e3.customUI, e3.parseSystemError = t3.parseSystemError || e3.parseSystemError, Object.assign(e3.loadingOptions, t3.loadingOptions), Object.assign(e3.errorOptions, t3.errorOptions), "object" == typeof t3.secretMethods && (e3.secretMethods = t3.secretMethods), e3;
  5407. }({ customUI: false, loadingOptions: { title: "加载中...", mask: true }, errorOptions: { type: "modal", retry: false } }, n2);
  5408. const { customUI: s2, loadingOptions: r2, errorOptions: i2, parseSystemError: o2 } = n2, a2 = !s2;
  5409. return new Proxy({}, { get(s3, c2) {
  5410. switch (c2) {
  5411. case "toString":
  5412. return "[object UniCloudObject]";
  5413. case "toJSON":
  5414. return {};
  5415. }
  5416. return function({ fn: e3, interceptorName: t3, getCallbackArgs: n3 } = {}) {
  5417. return async function(...s4) {
  5418. const r3 = n3 ? n3({ params: s4 }) : {};
  5419. let i3, o3;
  5420. try {
  5421. return await M(q(t3, "invoke"), { ...r3 }), i3 = await e3(...s4), await M(q(t3, "success"), { ...r3, result: i3 }), i3;
  5422. } catch (e4) {
  5423. throw o3 = e4, await M(q(t3, "fail"), { ...r3, error: o3 }), o3;
  5424. } finally {
  5425. await M(q(t3, "complete"), o3 ? { ...r3, error: o3 } : { ...r3, result: i3 });
  5426. }
  5427. };
  5428. }({ fn: async function s4(...h2) {
  5429. let l2;
  5430. a2 && uni.showLoading({ title: r2.title, mask: r2.mask });
  5431. const d2 = { name: t2, type: u, data: { method: c2, params: h2 } };
  5432. "object" == typeof n2.secretMethods && function(e3, t3) {
  5433. const n3 = t3.data.method, s5 = e3.secretMethods || {}, r3 = s5[n3] || s5["*"];
  5434. r3 && (t3.secretType = r3);
  5435. }(n2, d2);
  5436. let p2 = false;
  5437. try {
  5438. l2 = await e2.callFunction(d2);
  5439. } catch (e3) {
  5440. p2 = true, l2 = { result: new te(e3) };
  5441. }
  5442. const { errSubject: f2, errCode: g2, errMsg: m2, newToken: y2 } = l2.result || {};
  5443. if (a2 && uni.hideLoading(), y2 && y2.token && y2.tokenExpired && (ie(y2), Y(B, { ...y2 })), g2) {
  5444. let e3 = m2;
  5445. if (p2 && o2) {
  5446. e3 = (await o2({ objectName: t2, methodName: c2, params: h2, errSubject: f2, errCode: g2, errMsg: m2 })).errMsg || m2;
  5447. }
  5448. if (a2)
  5449. if ("toast" === i2.type)
  5450. uni.showToast({ title: e3, icon: "none" });
  5451. else {
  5452. if ("modal" !== i2.type)
  5453. throw new Error(`Invalid errorOptions.type: ${i2.type}`);
  5454. {
  5455. const { confirm: t3 } = await async function({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3 } = {}) {
  5456. return new Promise((i3, o3) => {
  5457. uni.showModal({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3, success(e5) {
  5458. i3(e5);
  5459. }, fail() {
  5460. i3({ confirm: false, cancel: true });
  5461. } });
  5462. });
  5463. }({ title: "提示", content: e3, showCancel: i2.retry, cancelText: "取消", confirmText: i2.retry ? "重试" : "确定" });
  5464. if (i2.retry && t3)
  5465. return s4(...h2);
  5466. }
  5467. }
  5468. const n3 = new te({ subject: f2, code: g2, message: m2, requestId: l2.requestId });
  5469. throw n3.detail = l2.result, Y(j, { type: z, content: n3 }), n3;
  5470. }
  5471. return Y(j, { type: z, content: l2.result }), l2.result;
  5472. }, interceptorName: "callObject", getCallbackArgs: function({ params: e3 } = {}) {
  5473. return { objectName: t2, methodName: c2, params: e3 };
  5474. } });
  5475. } });
  5476. };
  5477. }
  5478. function Rs(e2) {
  5479. return L("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}", e2.config.spaceId));
  5480. }
  5481. async function Us({ openid: e2, callLoginByWeixin: t2 = false } = {}) {
  5482. Rs(this);
  5483. throw new Error(`[SecureNetwork] API \`initSecureNetworkByWeixin\` is not supported on platform \`${P}\``);
  5484. }
  5485. async function Ns(e2) {
  5486. const t2 = Rs(this);
  5487. return t2.initPromise || (t2.initPromise = Us.call(this, e2).then((e3) => e3).catch((e3) => {
  5488. throw delete t2.initPromise, e3;
  5489. })), t2.initPromise;
  5490. }
  5491. function Ds(e2) {
  5492. return function({ openid: t2, callLoginByWeixin: n2 = false } = {}) {
  5493. return Ns.call(e2, { openid: t2, callLoginByWeixin: n2 });
  5494. };
  5495. }
  5496. function Ms(e2) {
  5497. const t2 = { getSystemInfo: uni.getSystemInfo, getPushClientId: uni.getPushClientId };
  5498. return function(n2) {
  5499. return new Promise((s2, r2) => {
  5500. t2[e2]({ ...n2, success(e3) {
  5501. s2(e3);
  5502. }, fail(e3) {
  5503. r2(e3);
  5504. } });
  5505. });
  5506. };
  5507. }
  5508. class qs extends class {
  5509. constructor() {
  5510. this._callback = {};
  5511. }
  5512. addListener(e2, t2) {
  5513. this._callback[e2] || (this._callback[e2] = []), this._callback[e2].push(t2);
  5514. }
  5515. on(e2, t2) {
  5516. return this.addListener(e2, t2);
  5517. }
  5518. removeListener(e2, t2) {
  5519. if (!t2)
  5520. throw new Error('The "listener" argument must be of type function. Received undefined');
  5521. const n2 = this._callback[e2];
  5522. if (!n2)
  5523. return;
  5524. const s2 = function(e3, t3) {
  5525. for (let n3 = e3.length - 1; n3 >= 0; n3--)
  5526. if (e3[n3] === t3)
  5527. return n3;
  5528. return -1;
  5529. }(n2, t2);
  5530. n2.splice(s2, 1);
  5531. }
  5532. off(e2, t2) {
  5533. return this.removeListener(e2, t2);
  5534. }
  5535. removeAllListener(e2) {
  5536. delete this._callback[e2];
  5537. }
  5538. emit(e2, ...t2) {
  5539. const n2 = this._callback[e2];
  5540. if (n2)
  5541. for (let e3 = 0; e3 < n2.length; e3++)
  5542. n2[e3](...t2);
  5543. }
  5544. } {
  5545. constructor() {
  5546. super(), this._uniPushMessageCallback = this._receivePushMessage.bind(this), this._currentMessageId = -1, this._payloadQueue = [];
  5547. }
  5548. init() {
  5549. return Promise.all([Ms("getSystemInfo")(), Ms("getPushClientId")()]).then(([{ appId: e2 } = {}, { cid: t2 } = {}] = []) => {
  5550. if (!e2)
  5551. throw new Error("Invalid appId, please check the manifest.json file");
  5552. if (!t2)
  5553. throw new Error("Invalid push client id");
  5554. this._appId = e2, this._pushClientId = t2, this._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), this.emit("open"), this._initMessageListener();
  5555. }, (e2) => {
  5556. throw this.emit("error", e2), this.close(), e2;
  5557. });
  5558. }
  5559. async open() {
  5560. return this.init();
  5561. }
  5562. _isUniCloudSSE(e2) {
  5563. if ("receive" !== e2.type)
  5564. return false;
  5565. const t2 = e2 && e2.data && e2.data.payload;
  5566. return !(!t2 || "UNI_CLOUD_SSE" !== t2.channel || t2.seqId !== this._seqId);
  5567. }
  5568. _receivePushMessage(e2) {
  5569. if (!this._isUniCloudSSE(e2))
  5570. return;
  5571. const t2 = e2 && e2.data && e2.data.payload, { action: n2, messageId: s2, message: r2 } = t2;
  5572. this._payloadQueue.push({ action: n2, messageId: s2, message: r2 }), this._consumMessage();
  5573. }
  5574. _consumMessage() {
  5575. for (; ; ) {
  5576. const e2 = this._payloadQueue.find((e3) => e3.messageId === this._currentMessageId + 1);
  5577. if (!e2)
  5578. break;
  5579. this._currentMessageId++, this._parseMessagePayload(e2);
  5580. }
  5581. }
  5582. _parseMessagePayload(e2) {
  5583. const { action: t2, messageId: n2, message: s2 } = e2;
  5584. "end" === t2 ? this._end({ messageId: n2, message: s2 }) : "message" === t2 && this._appendMessage({ messageId: n2, message: s2 });
  5585. }
  5586. _appendMessage({ messageId: e2, message: t2 } = {}) {
  5587. this.emit("message", t2);
  5588. }
  5589. _end({ messageId: e2, message: t2 } = {}) {
  5590. this.emit("end", t2), this.close();
  5591. }
  5592. _initMessageListener() {
  5593. uni.onPushMessage(this._uniPushMessageCallback);
  5594. }
  5595. _destroy() {
  5596. uni.offPushMessage(this._uniPushMessageCallback);
  5597. }
  5598. toJSON() {
  5599. return { appId: this._appId, pushClientId: this._pushClientId, seqId: this._seqId };
  5600. }
  5601. close() {
  5602. this._destroy(), this.emit("close");
  5603. }
  5604. }
  5605. async function Fs(e2, t2) {
  5606. const n2 = `http://${e2}:${t2}/system/ping`;
  5607. try {
  5608. const e3 = await (s2 = { url: n2, timeout: 500 }, new Promise((e4, t3) => {
  5609. ne.request({ ...s2, success(t4) {
  5610. e4(t4);
  5611. }, fail(e5) {
  5612. t3(e5);
  5613. } });
  5614. }));
  5615. return !(!e3.data || 0 !== e3.data.code);
  5616. } catch (e3) {
  5617. return false;
  5618. }
  5619. var s2;
  5620. }
  5621. async function Ks(e2) {
  5622. {
  5623. const { osName: e3, osVersion: t3 } = ce();
  5624. "ios" === e3 && function(e4) {
  5625. if (!e4 || "string" != typeof e4)
  5626. return 0;
  5627. const t4 = e4.match(/^(\d+)./);
  5628. return t4 && t4[1] ? parseInt(t4[1]) : 0;
  5629. }(t3) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备(仅开发期间需要,发行后不需要)");
  5630. }
  5631. const t2 = e2.__dev__;
  5632. if (!t2.debugInfo)
  5633. return;
  5634. const { address: n2, servePort: s2 } = t2.debugInfo, { address: r2 } = await async function(e3, t3) {
  5635. let n3;
  5636. for (let s3 = 0; s3 < e3.length; s3++) {
  5637. const r3 = e3[s3];
  5638. if (await Fs(r3, t3)) {
  5639. n3 = r3;
  5640. break;
  5641. }
  5642. }
  5643. return { address: n3, port: t3 };
  5644. }(n2, s2);
  5645. if (r2)
  5646. return t2.localAddress = r2, void (t2.localPort = s2);
  5647. const i2 = console["error"];
  5648. let o2 = "";
  5649. if ("remote" === t2.debugInfo.initialLaunchType ? (t2.debugInfo.forceRemote = true, o2 = "当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务,请直接忽略此信息。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。") : o2 = "无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。", o2 += "\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs\n- 检查是否错误的使用拦截器修改uni.request方法的参数", 0 === P.indexOf("mp-") && (o2 += "\n- 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t2.debugInfo.forceRemote)
  5650. throw new Error(o2);
  5651. i2(o2);
  5652. }
  5653. function js(e2) {
  5654. e2._initPromiseHub || (e2._initPromiseHub = new v({ createPromise: function() {
  5655. let t2 = Promise.resolve();
  5656. var n2;
  5657. n2 = 1, t2 = new Promise((e3) => {
  5658. setTimeout(() => {
  5659. e3();
  5660. }, n2);
  5661. });
  5662. const s2 = e2.auth();
  5663. return t2.then(() => s2.getLoginState()).then((e3) => e3 ? Promise.resolve() : s2.signInAnonymously());
  5664. } }));
  5665. }
  5666. const $s = { tcb: St, tencent: St, aliyun: pe, private: kt, alipay: Lt };
  5667. let Bs = new class {
  5668. init(e2) {
  5669. let t2 = {};
  5670. const n2 = $s[e2.provider];
  5671. if (!n2)
  5672. throw new Error("未提供正确的provider参数");
  5673. t2 = n2.init(e2), function(e3) {
  5674. const t3 = {};
  5675. e3.__dev__ = t3, t3.debugLog = "app" === P;
  5676. const n3 = T;
  5677. n3 && !n3.code && (t3.debugInfo = n3);
  5678. const s2 = new v({ createPromise: function() {
  5679. return Ks(e3);
  5680. } });
  5681. t3.initLocalNetwork = function() {
  5682. return s2.exec();
  5683. };
  5684. }(t2), js(t2), Kn(t2), function(e3) {
  5685. const t3 = e3.uploadFile;
  5686. e3.uploadFile = function(e4) {
  5687. return t3.call(this, e4);
  5688. };
  5689. }(t2), function(e3) {
  5690. e3.database = function(t3) {
  5691. if (t3 && Object.keys(t3).length > 0)
  5692. return e3.init(t3).database();
  5693. if (this._database)
  5694. return this._database;
  5695. const n3 = Qn(Xn, { uniClient: e3 });
  5696. return this._database = n3, n3;
  5697. }, e3.databaseForJQL = function(t3) {
  5698. if (t3 && Object.keys(t3).length > 0)
  5699. return e3.init(t3).databaseForJQL();
  5700. if (this._databaseForJQL)
  5701. return this._databaseForJQL;
  5702. const n3 = Qn(Xn, { uniClient: e3, isJQL: true });
  5703. return this._databaseForJQL = n3, n3;
  5704. };
  5705. }(t2), function(e3) {
  5706. e3.getCurrentUserInfo = Ts, e3.chooseAndUploadFile = xs.initChooseAndUploadFile(e3), Object.assign(e3, { get mixinDatacom() {
  5707. return Es(e3);
  5708. } }), e3.SSEChannel = qs, e3.initSecureNetworkByWeixin = Ds(e3), e3.importObject = Ls(e3);
  5709. }(t2);
  5710. return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach((e3) => {
  5711. if (!t2[e3])
  5712. return;
  5713. const n3 = t2[e3];
  5714. t2[e3] = function() {
  5715. return n3.apply(t2, Array.from(arguments));
  5716. }, t2[e3] = (/* @__PURE__ */ function(e4, t3) {
  5717. return function(n4) {
  5718. let s2 = false;
  5719. if ("callFunction" === t3) {
  5720. const e5 = n4 && n4.type || c;
  5721. s2 = e5 !== c;
  5722. }
  5723. const r2 = "callFunction" === t3 && !s2, i2 = this._initPromiseHub.exec();
  5724. n4 = n4 || {};
  5725. const { success: o2, fail: a2, complete: u2 } = ee(n4), h2 = i2.then(() => s2 ? Promise.resolve() : M(q(t3, "invoke"), n4)).then(() => e4.call(this, n4)).then((e5) => s2 ? Promise.resolve(e5) : M(q(t3, "success"), e5).then(() => M(q(t3, "complete"), e5)).then(() => (r2 && Y(j, { type: H, content: e5 }), Promise.resolve(e5))), (e5) => s2 ? Promise.reject(e5) : M(q(t3, "fail"), e5).then(() => M(q(t3, "complete"), e5)).then(() => (Y(j, { type: H, content: e5 }), Promise.reject(e5))));
  5726. if (!(o2 || a2 || u2))
  5727. return h2;
  5728. h2.then((e5) => {
  5729. o2 && o2(e5), u2 && u2(e5), r2 && Y(j, { type: H, content: e5 });
  5730. }, (e5) => {
  5731. a2 && a2(e5), u2 && u2(e5), r2 && Y(j, { type: H, content: e5 });
  5732. });
  5733. };
  5734. }(t2[e3], e3)).bind(t2);
  5735. }), t2.init = this.init, t2;
  5736. }
  5737. }();
  5738. (() => {
  5739. const e2 = C;
  5740. let t2 = {};
  5741. if (e2 && 1 === e2.length)
  5742. t2 = e2[0], Bs = Bs.init(t2), Bs._isDefault = true;
  5743. else {
  5744. const t3 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"];
  5745. let n2;
  5746. n2 = e2 && e2.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : "应用未关联服务空间,请在uniCloud目录右键关联服务空间", t3.forEach((e3) => {
  5747. Bs[e3] = function() {
  5748. return console.error(n2), Promise.reject(new te({ code: "SYS_ERR", message: n2 }));
  5749. };
  5750. });
  5751. }
  5752. Object.assign(Bs, { get mixinDatacom() {
  5753. return Es(Bs);
  5754. } }), bs(Bs), Bs.addInterceptor = N, Bs.removeInterceptor = D, Bs.interceptObject = F;
  5755. })();
  5756. var Ws = Bs;
  5757. const isObject = (val) => val !== null && typeof val === "object";
  5758. const defaultDelimiters = ["{", "}"];
  5759. class BaseFormatter {
  5760. constructor() {
  5761. this._caches = /* @__PURE__ */ Object.create(null);
  5762. }
  5763. interpolate(message, values, delimiters = defaultDelimiters) {
  5764. if (!values) {
  5765. return [message];
  5766. }
  5767. let tokens = this._caches[message];
  5768. if (!tokens) {
  5769. tokens = parse(message, delimiters);
  5770. this._caches[message] = tokens;
  5771. }
  5772. return compile(tokens, values);
  5773. }
  5774. }
  5775. const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  5776. const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  5777. function parse(format, [startDelimiter, endDelimiter]) {
  5778. const tokens = [];
  5779. let position = 0;
  5780. let text = "";
  5781. while (position < format.length) {
  5782. let char = format[position++];
  5783. if (char === startDelimiter) {
  5784. if (text) {
  5785. tokens.push({ type: "text", value: text });
  5786. }
  5787. text = "";
  5788. let sub = "";
  5789. char = format[position++];
  5790. while (char !== void 0 && char !== endDelimiter) {
  5791. sub += char;
  5792. char = format[position++];
  5793. }
  5794. const isClosed = char === endDelimiter;
  5795. const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown";
  5796. tokens.push({ value: sub, type });
  5797. } else {
  5798. text += char;
  5799. }
  5800. }
  5801. text && tokens.push({ type: "text", value: text });
  5802. return tokens;
  5803. }
  5804. function compile(tokens, values) {
  5805. const compiled = [];
  5806. let index = 0;
  5807. const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
  5808. if (mode === "unknown") {
  5809. return compiled;
  5810. }
  5811. while (index < tokens.length) {
  5812. const token = tokens[index];
  5813. switch (token.type) {
  5814. case "text":
  5815. compiled.push(token.value);
  5816. break;
  5817. case "list":
  5818. compiled.push(values[parseInt(token.value, 10)]);
  5819. break;
  5820. case "named":
  5821. if (mode === "named") {
  5822. compiled.push(values[token.value]);
  5823. } else {
  5824. {
  5825. console.warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`);
  5826. }
  5827. }
  5828. break;
  5829. case "unknown":
  5830. {
  5831. console.warn(`Detect 'unknown' type of token!`);
  5832. }
  5833. break;
  5834. }
  5835. index++;
  5836. }
  5837. return compiled;
  5838. }
  5839. const LOCALE_ZH_HANS = "zh-Hans";
  5840. const LOCALE_ZH_HANT = "zh-Hant";
  5841. const LOCALE_EN = "en";
  5842. const LOCALE_FR = "fr";
  5843. const LOCALE_ES = "es";
  5844. const hasOwnProperty = Object.prototype.hasOwnProperty;
  5845. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  5846. const defaultFormatter = new BaseFormatter();
  5847. function include(str, parts) {
  5848. return !!parts.find((part) => str.indexOf(part) !== -1);
  5849. }
  5850. function startsWith(str, parts) {
  5851. return parts.find((part) => str.indexOf(part) === 0);
  5852. }
  5853. function normalizeLocale(locale, messages2) {
  5854. if (!locale) {
  5855. return;
  5856. }
  5857. locale = locale.trim().replace(/_/g, "-");
  5858. if (messages2 && messages2[locale]) {
  5859. return locale;
  5860. }
  5861. locale = locale.toLowerCase();
  5862. if (locale === "chinese") {
  5863. return LOCALE_ZH_HANS;
  5864. }
  5865. if (locale.indexOf("zh") === 0) {
  5866. if (locale.indexOf("-hans") > -1) {
  5867. return LOCALE_ZH_HANS;
  5868. }
  5869. if (locale.indexOf("-hant") > -1) {
  5870. return LOCALE_ZH_HANT;
  5871. }
  5872. if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
  5873. return LOCALE_ZH_HANT;
  5874. }
  5875. return LOCALE_ZH_HANS;
  5876. }
  5877. let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  5878. if (messages2 && Object.keys(messages2).length > 0) {
  5879. locales = Object.keys(messages2);
  5880. }
  5881. const lang = startsWith(locale, locales);
  5882. if (lang) {
  5883. return lang;
  5884. }
  5885. }
  5886. class I18n {
  5887. constructor({ locale, fallbackLocale, messages: messages2, watcher, formater: formater2 }) {
  5888. this.locale = LOCALE_EN;
  5889. this.fallbackLocale = LOCALE_EN;
  5890. this.message = {};
  5891. this.messages = {};
  5892. this.watchers = [];
  5893. if (fallbackLocale) {
  5894. this.fallbackLocale = fallbackLocale;
  5895. }
  5896. this.formater = formater2 || defaultFormatter;
  5897. this.messages = messages2 || {};
  5898. this.setLocale(locale || LOCALE_EN);
  5899. if (watcher) {
  5900. this.watchLocale(watcher);
  5901. }
  5902. }
  5903. setLocale(locale) {
  5904. const oldLocale = this.locale;
  5905. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  5906. if (!this.messages[this.locale]) {
  5907. this.messages[this.locale] = {};
  5908. }
  5909. this.message = this.messages[this.locale];
  5910. if (oldLocale !== this.locale) {
  5911. this.watchers.forEach((watcher) => {
  5912. watcher(this.locale, oldLocale);
  5913. });
  5914. }
  5915. }
  5916. getLocale() {
  5917. return this.locale;
  5918. }
  5919. watchLocale(fn) {
  5920. const index = this.watchers.push(fn) - 1;
  5921. return () => {
  5922. this.watchers.splice(index, 1);
  5923. };
  5924. }
  5925. add(locale, message, override = true) {
  5926. const curMessages = this.messages[locale];
  5927. if (curMessages) {
  5928. if (override) {
  5929. Object.assign(curMessages, message);
  5930. } else {
  5931. Object.keys(message).forEach((key) => {
  5932. if (!hasOwn(curMessages, key)) {
  5933. curMessages[key] = message[key];
  5934. }
  5935. });
  5936. }
  5937. } else {
  5938. this.messages[locale] = message;
  5939. }
  5940. }
  5941. f(message, values, delimiters) {
  5942. return this.formater.interpolate(message, values, delimiters).join("");
  5943. }
  5944. t(key, locale, values) {
  5945. let message = this.message;
  5946. if (typeof locale === "string") {
  5947. locale = normalizeLocale(locale, this.messages);
  5948. locale && (message = this.messages[locale]);
  5949. } else {
  5950. values = locale;
  5951. }
  5952. if (!hasOwn(message, key)) {
  5953. console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`);
  5954. return key;
  5955. }
  5956. return this.formater.interpolate(message[key], values).join("");
  5957. }
  5958. }
  5959. function watchAppLocale(appVm, i18n) {
  5960. if (appVm.$watchLocale) {
  5961. appVm.$watchLocale((newLocale) => {
  5962. i18n.setLocale(newLocale);
  5963. });
  5964. } else {
  5965. appVm.$watch(() => appVm.$locale, (newLocale) => {
  5966. i18n.setLocale(newLocale);
  5967. });
  5968. }
  5969. }
  5970. function getDefaultLocale() {
  5971. if (typeof uni !== "undefined" && uni.getLocale) {
  5972. return uni.getLocale();
  5973. }
  5974. if (typeof global !== "undefined" && global.getLocale) {
  5975. return global.getLocale();
  5976. }
  5977. return LOCALE_EN;
  5978. }
  5979. function initVueI18n(locale, messages2 = {}, fallbackLocale, watcher) {
  5980. if (typeof locale !== "string") {
  5981. [locale, messages2] = [
  5982. messages2,
  5983. locale
  5984. ];
  5985. }
  5986. if (typeof locale !== "string") {
  5987. locale = getDefaultLocale();
  5988. }
  5989. if (typeof fallbackLocale !== "string") {
  5990. fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN;
  5991. }
  5992. const i18n = new I18n({
  5993. locale,
  5994. fallbackLocale,
  5995. messages: messages2,
  5996. watcher
  5997. });
  5998. let t2 = (key, values) => {
  5999. if (typeof getApp !== "function") {
  6000. t2 = function(key2, values2) {
  6001. return i18n.t(key2, values2);
  6002. };
  6003. } else {
  6004. let isWatchedAppLocale = false;
  6005. t2 = function(key2, values2) {
  6006. const appVm = getApp().$vm;
  6007. if (appVm) {
  6008. appVm.$locale;
  6009. if (!isWatchedAppLocale) {
  6010. isWatchedAppLocale = true;
  6011. watchAppLocale(appVm, i18n);
  6012. }
  6013. }
  6014. return i18n.t(key2, values2);
  6015. };
  6016. }
  6017. return t2(key, values);
  6018. };
  6019. return {
  6020. i18n,
  6021. f(message, values, delimiters) {
  6022. return i18n.f(message, values, delimiters);
  6023. },
  6024. t(key, values) {
  6025. return t2(key, values);
  6026. },
  6027. add(locale2, message, override = true) {
  6028. return i18n.add(locale2, message, override);
  6029. },
  6030. watch(fn) {
  6031. return i18n.watchLocale(fn);
  6032. },
  6033. getLocale() {
  6034. return i18n.getLocale();
  6035. },
  6036. setLocale(newLocale) {
  6037. return i18n.setLocale(newLocale);
  6038. }
  6039. };
  6040. }
  6041. const en$1 = {
  6042. "uni-load-more.contentdown": "Pull up to show more",
  6043. "uni-load-more.contentrefresh": "loading...",
  6044. "uni-load-more.contentnomore": "No more data"
  6045. };
  6046. const zhHans$1 = {
  6047. "uni-load-more.contentdown": "上拉显示更多",
  6048. "uni-load-more.contentrefresh": "正在加载...",
  6049. "uni-load-more.contentnomore": "没有更多数据了"
  6050. };
  6051. const zhHant$1 = {
  6052. "uni-load-more.contentdown": "上拉顯示更多",
  6053. "uni-load-more.contentrefresh": "正在加載...",
  6054. "uni-load-more.contentnomore": "沒有更多數據了"
  6055. };
  6056. const messages$1 = {
  6057. en: en$1,
  6058. "zh-Hans": zhHans$1,
  6059. "zh-Hant": zhHant$1
  6060. };
  6061. let platform;
  6062. setTimeout(() => {
  6063. platform = uni.getSystemInfoSync().platform;
  6064. }, 16);
  6065. const {
  6066. t: t$1
  6067. } = initVueI18n(messages$1);
  6068. const _sfc_main$7 = {
  6069. name: "UniLoadMore",
  6070. emits: ["clickLoadMore"],
  6071. props: {
  6072. status: {
  6073. // 上拉的状态:more-loading前;loading-loading中;noMore-没有更多了
  6074. type: String,
  6075. default: "more"
  6076. },
  6077. showIcon: {
  6078. type: Boolean,
  6079. default: true
  6080. },
  6081. iconType: {
  6082. type: String,
  6083. default: "auto"
  6084. },
  6085. iconSize: {
  6086. type: Number,
  6087. default: 24
  6088. },
  6089. color: {
  6090. type: String,
  6091. default: "#777777"
  6092. },
  6093. contentText: {
  6094. type: Object,
  6095. default() {
  6096. return {
  6097. contentdown: "",
  6098. contentrefresh: "",
  6099. contentnomore: ""
  6100. };
  6101. }
  6102. },
  6103. showText: {
  6104. type: Boolean,
  6105. default: true
  6106. }
  6107. },
  6108. data() {
  6109. return {
  6110. webviewHide: false,
  6111. platform,
  6112. imgBase64: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QzlBMzU3OTlEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QzlBMzU3OUFEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDOUEzNTc5N0Q5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDOUEzNTc5OEQ5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pt+ALSwAAA6CSURBVHja1FsLkFZVHb98LM+F5bHL8khA1iSeiyQBCRM+YGqKUnnJTDLGI0BGZlKDIU2MMglUiDApEZvSsZnQtBRJtKwQNKQMFYeRDR10WOLd8ljYXdh+v8v5fR3Od+797t1dnOnO/Ofce77z+J//+b/P+ZqtXbs2sJ9MJhNUV1cHJ06cCJo3bx7EPc2aNcvpy7pWrVoF+/fvDyoqKoI2bdoE9fX1F7TjN8a+EXBn/fkfvw942Tf+wYMHg9mzZwfjxo0LDhw4EPa1x2MbFw/fOGfPng1qa2tzcCkILsLDydq2bRsunpOTMM7TD/W/tZDZhPdeKD+yGxHhdu3aBV27dg3OnDlzMVANMheLAO3btw8KCwuDmpoaX5OxbgUIMEq7K8IcPnw4KCsrC/r37x8cP378/4cAXAB3vqSkJMuiDhTkw+XcuXNhOWbMmKBly5YhUT8xArhyFvP0BfwRsAuwxJZJsm/nzp2DTp06he/OU+cZ64K6o0ePBkOHDg2GDx8e6gEbJ5Q/NHNuAJQ1hgBeHUDlR7nVTkY8rQAvAi4z34vR/mPs1FoRsaCgIJThI0eOBC1atEiFGGV+5MiRoS45efJkqFjJFXV1dQuA012m2WcwTw98fy6CqBdsaiIO4CScrGPHjvk4odhavPquRtFWXEC25VgkREKOCh/qDSq+vn37htzD/mZTOmOc5U7zKzBPEedygWshcDyWvs30igAbU+6oyMgJBCFhwQE0fccxN60Ay9iebbjoDh06hMowjQxT4fXq1SskArmHZpkArvixp/kWzHdMeArExSJEaiXIjjRjRJ4DaAGWpibLzXN3Fm1vA5teBgh3j1Rv3bp1YgKwPdmf2p9zcyNYYgPKMfY0T5f5nNYdw158nJ8QawW4CLKwiOBSEgO/hok2eBydR+3dYH+PLxA5J8Vv0KBBwenTp0P2JWAx6+yFEBfs8lMY+y0SWMBNI9E4ThKi58VKTg3FQZS1RQF1cz27eC0QHMu+3E0SkUowjhVt5VdaWhp07949ZHv2Qd1EjDXM2cla1M0nl3GxAs3J9yREzyTdFVKVFOaE9qRA8GM0WebRuo9JGZKA7Mv2SeS/Z8+eoQ9BArMfFrLGo6jvxbhHbJZnKX2Rzz1O7QhJJ9Cs2ZMaWIyq/zhdeqPNfIoHd58clIQD+JSXl4dKlyIAuBdVXZwFVWKspSSoxE++h8x4k3uCnEhE4I5KwRiFWGOU0QWKiCYLbdoRMRKAu2kQ9vkfLU6dOhX06NEjlH+yMRZSinnuyWnYosVcji8CEA/6Cg2JF+IIUBqnGKUTCNwtwBN4f89RiK1R96DEgO2o0NDmtEdvVFdVVYV+P3UAPUEs6GFwV3PHmXkD4vh74iDFJysVI/MlaQhwKeBNTLYX5VuA8T4/gZxA4MRGFxDB6R7OmYPfyykGRJbyie+XnGYnQIC/coH9+vULiYrxrkL9ZA9+0ykaHIfEpM7ge8TiJ2CsHYwyMfafAF1yCGBHYIbCVDjDjKt7BeB51D+LgQa6OkG7IDYEEtvQ7lnXLKLtLdLuJBpE4gPUXcW2+PkZwOex+4cGDhwYDBkyRL7/HFcEwUGPo/8uWRUpYnfxGHco8HkewLHLyYmAawAPuIFZxhOpDfJQ8gbUv41yORAptMWBNr6oqMhWird5+u+iHmBb2nhjDV7HWBNQTgK8y11l5NetWzc5ULscAtSj7nbNI0skhWeUZCc0W4nyH/jO4Vz0u1IeYhbk4AiwM6tjxIWByHsoZ9qcIBPJd/y+DwPfBESOmCa/QF3WiZHucLlEDpNxcNhmheEOPgdQNx6/VZFQzFZ5TN08AHXQt2Ii3EdyFuUsPtTcGPhW5iMiCNELvz+Gdn9huG4HUJaW/w3g0wxV0XaG7arG2WeKiUWYM4Y7GO5ezshTARbbWGw/DvXkpp/ivVvE0JVoMxN4rpGzJMhE5Pl+xlATsDIqikP9F9D2z3h9nOksEUFhK+qO4rcPkoalMQ/HqJLIyb3F3JdjrCcw1yZ8joyJLR5gCo54etlag7qIoeNh1N1BRYj3DTFJ0elotxPlVzkGuYAmL0VSJVGAJA41c4Z6A3BzTLfn0HYwYKEI6CUAMzZEWvLsIcQOo1AmmyyM72nHJCfYsogflGV6jEk9vyQZXSuq6w4c16NsGcGZbwOPr+H1RkOk2LEzjNepxQkihHSCQ4ynAYNRx2zMKV92CQMWqj8J0BRE8EShxRFN6YrfCRhC0x3r/Zm4IbQCcmJoV0kMamllccR6FjHqUC5F2R/wS2dcymOlfAKOS4KmzQb5cpNC2MC7JhVn5wjXoJ44rYhLh8n0eXOCorJxa7POjbSlCGVczr34/RsAmrcvo9s+wGp3tzVhntxiXiJ4nvEYb4FJkf0O8HocAePmLvCxnL0AORraVekJk6TYjDabRVXfRE2lCN1h6ZQRN1+InUbsCpKwoBZHh0dODN9JBCUffItXxEavTQkUtnfTVAplCWL3JISz29h4NjotnuSsQKJCk8dF+kJR6RARjrqFVmfPnj3ZbK8cIJ0msd6jgHPGtfVTQ8VLmlvh4mct9sobRmPic0DyDQQnx/NlfYUgyz59+oScsH379pAwXABD32nTpoUHIToESeI5mnbE/UqDdyLcafEBf2MCqgC7NwxIbMREJQ0g4D4sfJwnD+AmRrII05cfMWJE+L1169bQr+fip06dGp4oJ83lmYd5wj/EmMa4TaHivo4EeCguYZBnkB5g2aWA69OIEnUHOaGysjIYMGBAMGnSpODYsWPZwCpFmm4lNq+4gSLQA7jcX8DwtjEyRC8wjabnXEx9kfWnTJkSJkAo90xpJVV+FmcVNeYAF5zWngS4C4O91MBxmAv8blLEpbjI5sz9MTdAhcgkCT1RO8mZkAjfiYpTEvStAS53Uw1vAiUGgZ3GpuQEYvoiBqlIan7kSDHnTwJQFNiPu0+5VxCVYhcZIjNrdXUDdp+Eq5AZ3Gkg8QAyVZRZIk4Tl4QAbF9cXJxNYZMAtAokgs4BrNxEpCtteXg7DDTMDKYNSuQdKsnJBek7HxewvxaosWxLYXtw+cJp18217wql4aKCfBNoEu0O5VU+PhctJ0YeXD4C6JQpyrlpSLTojpGGGN5YwNziChdIZLk4lvLcFJ9jMX3QdiImY9bmGQU+TRUL5CHITTRlgF8D9ouD1MfmLoEPl5xokIumZ2cfgMpHt47IW9N64Hsh7wQYYjyIugWuF5fCqYncXRd5vPMWyizzvhi/32+nvG0dZc9vR6fZOu0md5e+uC408FvKSIOZwXlGvxPv95izA2Vtvg1xKFWARI+vMX66HUhpQQb643uW1bSjuTWyw2SBvDrBvjFic1eGGlz5esq3ko9uSIlBRqPuFcCv8F4WIcN12nVaBd0SaYwI6PDDImR11JkqgHcPmQssjxIn6bUshygDFJUTxPMpHk+jfjPgupgdnYV2R/g7xSjtpah8RJBewhwf0gGK6XI92u4wXFEU40afJ4DN4h5LcAd+40HI3JgJecuT0c062W0i2hQJUTcxan3/CMW1PF2K6bbA+Daz4xRs1D3Br1Cm0OihKCqizW78/nXAF/G5TXrEcVzaNMH6CyMswqsAHqDyDLEyou8lwOXnKF8DjI6KjV3KzMBiXkDH8ij/H214J5A596ekrZ3F0zXlWeL7+P5eUrNo3/QwC15uxthuzidy7DzKRwEDaAViiDgKbTbz7CJnzo0bN7pIfIiid8SuPwn25o3QCmpnyjlZkyxPP8EomCJzrGb7GJMx7tNsq4MT2xMUYaiErZOluTzKsnz3gwCeCZyVRZJfYplNEokEjwrPtxlxjeYAk+F1F74VAzPxQRNYYdtpOUvWs8J1sGhBJMNsb7igN8plJs1eSmLIhLKE4rvaCX27gOhLpLOsIzJ7qn/i+wZzcvSOZ23/du8TZjwV8zHIXoP4R3ifBxiFz1dcVpa3aPntPE+c6TmIWE9EtcMmAcPdWAhYhAXxcLOQi9L1WhD1Sc8p1d2oL7XGiRKp8F4A2i8K/nfI+y/gsTDJ/YC/8+AD5Uh04KHiGl+cIFPnBDDrPMjwRGkLXyxO4VGbfQWnDH2v0bVWE3C9QOXlepbgjEfIJQI6XDG3z5ahD9cw2pS78ipB85wyScNTvsVzlzzhL8/jRrnmVjfFJK/m3m4nj9vbgQTguT8XZTjsm672R5uJKEaQmBI/c58gyus8ZDagLpEVSJBIyHp4jn++xqPV71OgQgJYEWOtZ/haxRtKmWOBu8xdBLftWltsY84zE6WIEy/eIOWL+BaayMx+KHtL7EAkqdNDLiEXmEMUHniedtJqg9HmZtfvt26vNi0BdG3Ft3g8ZOf7PAu59TxtzivLNIekyi+wD1i8CuUiD9FXAa8C+/xS3JPmZnomyc7H+fb4/Se0bk41Fel621r4cgVxbq91V4jVqwB7HTe2M7jgB+QWHavZkDRPmZcASoZEmBx6i75bGjPcMdL4/VKGFAGWZkGzPG0XAbdL9A81G5LOmUnC9hHKJeO7dcUMjblSl12867ElFTtaGl20xvvLGPdVz/8TVuU7y0x1PG7vtNg24oz9Uo/Z412++VFWI7Fcog9tu9Lm6gvRmIPv9x1xmQAu6RDkXtbOtlGEmpgD5Nvnyc0dcv0EE6cfdi1HmhMf9wDF3k3gtRvEedhxjpgfqPb9PU9iEJHnyOUA7bQUXh6kq/D7l2iTjWv7XOD530BDr8jIrus+srXjt4MzumJMHuTsBa63YKE1+RR5lBjEikCCnWKWiHdzOgKO+nRIBAF88za/IFmJ3eMZov4CYxGBabcpGL8EYx+SeMXJeRwHNsV/h+vdxeuhEpN3ZyNY78Gm2fknJxVGhyjixPiQvVkNzT1elD9Py/aTAL64Hb9vcYmC9zfdXdT/C1LeGbg4rnBaAihDFJH12W5ulfNCNe/xTsP3bp8ikzJs5BF+5PNfAQYAPaseTdsEcaYAAAAASUVORK5CYII="
  6113. };
  6114. },
  6115. computed: {
  6116. iconSnowWidth() {
  6117. return (Math.floor(this.iconSize / 24) || 1) * 2;
  6118. },
  6119. contentdownText() {
  6120. return this.contentText.contentdown || t$1("uni-load-more.contentdown");
  6121. },
  6122. contentrefreshText() {
  6123. return this.contentText.contentrefresh || t$1("uni-load-more.contentrefresh");
  6124. },
  6125. contentnomoreText() {
  6126. return this.contentText.contentnomore || t$1("uni-load-more.contentnomore");
  6127. }
  6128. },
  6129. mounted() {
  6130. var pages2 = getCurrentPages();
  6131. var page = pages2[pages2.length - 1];
  6132. var currentWebview = page.$getAppWebview();
  6133. currentWebview.addEventListener("hide", () => {
  6134. this.webviewHide = true;
  6135. });
  6136. currentWebview.addEventListener("show", () => {
  6137. this.webviewHide = false;
  6138. });
  6139. },
  6140. methods: {
  6141. onClick() {
  6142. this.$emit("clickLoadMore", {
  6143. detail: {
  6144. status: this.status
  6145. }
  6146. });
  6147. }
  6148. }
  6149. };
  6150. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  6151. return vue.openBlock(), vue.createElementBlock("view", {
  6152. class: "uni-load-more",
  6153. onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
  6154. }, [
  6155. !$data.webviewHide && ($props.iconType === "circle" || $props.iconType === "auto" && $data.platform === "android") && $props.status === "loading" && $props.showIcon ? (vue.openBlock(), vue.createElementBlock(
  6156. "view",
  6157. {
  6158. key: 0,
  6159. style: vue.normalizeStyle({ width: $props.iconSize + "px", height: $props.iconSize + "px" }),
  6160. class: "uni-load-more__img uni-load-more__img--android-MP"
  6161. },
  6162. [
  6163. vue.createElementVNode(
  6164. "view",
  6165. {
  6166. class: "uni-load-more__img-icon",
  6167. style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
  6168. },
  6169. null,
  6170. 4
  6171. /* STYLE */
  6172. ),
  6173. vue.createElementVNode(
  6174. "view",
  6175. {
  6176. class: "uni-load-more__img-icon",
  6177. style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
  6178. },
  6179. null,
  6180. 4
  6181. /* STYLE */
  6182. ),
  6183. vue.createElementVNode(
  6184. "view",
  6185. {
  6186. class: "uni-load-more__img-icon",
  6187. style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
  6188. },
  6189. null,
  6190. 4
  6191. /* STYLE */
  6192. )
  6193. ],
  6194. 4
  6195. /* STYLE */
  6196. )) : !$data.webviewHide && $props.status === "loading" && $props.showIcon ? (vue.openBlock(), vue.createElementBlock(
  6197. "view",
  6198. {
  6199. key: 1,
  6200. style: vue.normalizeStyle({ width: $props.iconSize + "px", height: $props.iconSize + "px" }),
  6201. class: "uni-load-more__img uni-load-more__img--ios-H5"
  6202. },
  6203. [
  6204. vue.createElementVNode("image", {
  6205. src: $data.imgBase64,
  6206. mode: "widthFix"
  6207. }, null, 8, ["src"])
  6208. ],
  6209. 4
  6210. /* STYLE */
  6211. )) : vue.createCommentVNode("v-if", true),
  6212. $props.showText ? (vue.openBlock(), vue.createElementBlock(
  6213. "text",
  6214. {
  6215. key: 2,
  6216. class: "uni-load-more__text",
  6217. style: vue.normalizeStyle({ color: $props.color })
  6218. },
  6219. vue.toDisplayString($props.status === "more" ? $options.contentdownText : $props.status === "loading" ? $options.contentrefreshText : $options.contentnomoreText),
  6220. 5
  6221. /* TEXT, STYLE */
  6222. )) : vue.createCommentVNode("v-if", true)
  6223. ]);
  6224. }
  6225. const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6], ["__scopeId", "data-v-9245e42c"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue"]]);
  6226. const _sfc_main$6 = {
  6227. name: "uniDataChecklist",
  6228. mixins: [Ws.mixinDatacom || {}],
  6229. emits: ["input", "update:modelValue", "change"],
  6230. props: {
  6231. mode: {
  6232. type: String,
  6233. default: "default"
  6234. },
  6235. multiple: {
  6236. type: Boolean,
  6237. default: false
  6238. },
  6239. value: {
  6240. type: [Array, String, Number],
  6241. default() {
  6242. return "";
  6243. }
  6244. },
  6245. // TODO vue3
  6246. modelValue: {
  6247. type: [Array, String, Number],
  6248. default() {
  6249. return "";
  6250. }
  6251. },
  6252. localdata: {
  6253. type: Array,
  6254. default() {
  6255. return [];
  6256. }
  6257. },
  6258. min: {
  6259. type: [Number, String],
  6260. default: ""
  6261. },
  6262. max: {
  6263. type: [Number, String],
  6264. default: ""
  6265. },
  6266. wrap: {
  6267. type: Boolean,
  6268. default: false
  6269. },
  6270. icon: {
  6271. type: String,
  6272. default: "left"
  6273. },
  6274. selectedColor: {
  6275. type: String,
  6276. default: ""
  6277. },
  6278. selectedTextColor: {
  6279. type: String,
  6280. default: ""
  6281. },
  6282. emptyText: {
  6283. type: String,
  6284. default: "暂无数据"
  6285. },
  6286. disabled: {
  6287. type: Boolean,
  6288. default: false
  6289. },
  6290. map: {
  6291. type: Object,
  6292. default() {
  6293. return {
  6294. text: "text",
  6295. value: "value"
  6296. };
  6297. }
  6298. }
  6299. },
  6300. watch: {
  6301. localdata: {
  6302. handler(newVal) {
  6303. this.range = newVal;
  6304. this.dataList = this.getDataList(this.getSelectedValue(newVal));
  6305. },
  6306. deep: true
  6307. },
  6308. mixinDatacomResData(newVal) {
  6309. this.range = newVal;
  6310. this.dataList = this.getDataList(this.getSelectedValue(newVal));
  6311. },
  6312. value(newVal) {
  6313. this.dataList = this.getDataList(newVal);
  6314. },
  6315. modelValue(newVal) {
  6316. this.dataList = this.getDataList(newVal);
  6317. }
  6318. },
  6319. data() {
  6320. return {
  6321. dataList: [],
  6322. range: [],
  6323. contentText: {
  6324. contentdown: "查看更多",
  6325. contentrefresh: "加载中",
  6326. contentnomore: "没有更多"
  6327. },
  6328. isLocal: true,
  6329. styles: {
  6330. selectedColor: "#2979ff",
  6331. selectedTextColor: "#666"
  6332. },
  6333. isTop: 0
  6334. };
  6335. },
  6336. computed: {
  6337. dataValue() {
  6338. if (this.value === "")
  6339. return this.modelValue;
  6340. if (this.modelValue === "")
  6341. return this.value;
  6342. return this.value;
  6343. }
  6344. },
  6345. created() {
  6346. if (this.localdata && this.localdata.length !== 0) {
  6347. this.isLocal = true;
  6348. this.range = this.localdata;
  6349. this.dataList = this.getDataList(this.getSelectedValue(this.range));
  6350. } else {
  6351. if (this.collection) {
  6352. this.isLocal = false;
  6353. this.loadData();
  6354. }
  6355. }
  6356. },
  6357. methods: {
  6358. loadData() {
  6359. this.mixinDatacomGet().then((res) => {
  6360. this.mixinDatacomResData = res.result.data;
  6361. if (this.mixinDatacomResData.length === 0) {
  6362. this.isLocal = false;
  6363. this.mixinDatacomErrorMessage = this.emptyText;
  6364. } else {
  6365. this.isLocal = true;
  6366. }
  6367. }).catch((err) => {
  6368. this.mixinDatacomErrorMessage = err.message;
  6369. });
  6370. },
  6371. /**
  6372. * 获取父元素实例
  6373. */
  6374. getForm(name = "uniForms") {
  6375. let parent = this.$parent;
  6376. let parentName = parent.$options.name;
  6377. while (parentName !== name) {
  6378. parent = parent.$parent;
  6379. if (!parent)
  6380. return false;
  6381. parentName = parent.$options.name;
  6382. }
  6383. return parent;
  6384. },
  6385. change(e2) {
  6386. const values = e2.detail.value;
  6387. let detail = {
  6388. value: [],
  6389. data: []
  6390. };
  6391. if (this.multiple) {
  6392. this.range.forEach((item) => {
  6393. if (values.includes(item[this.map.value] + "")) {
  6394. detail.value.push(item[this.map.value]);
  6395. detail.data.push(item);
  6396. }
  6397. });
  6398. } else {
  6399. const range = this.range.find((item) => item[this.map.value] + "" === values);
  6400. if (range) {
  6401. detail = {
  6402. value: range[this.map.value],
  6403. data: range
  6404. };
  6405. }
  6406. }
  6407. this.$emit("input", detail.value);
  6408. this.$emit("update:modelValue", detail.value);
  6409. this.$emit("change", {
  6410. detail
  6411. });
  6412. if (this.multiple) {
  6413. this.dataList = this.getDataList(detail.value, true);
  6414. } else {
  6415. this.dataList = this.getDataList(detail.value);
  6416. }
  6417. },
  6418. /**
  6419. * 获取渲染的新数组
  6420. * @param {Object} value 选中内容
  6421. */
  6422. getDataList(value) {
  6423. let dataList = JSON.parse(JSON.stringify(this.range));
  6424. let list = [];
  6425. if (this.multiple) {
  6426. if (!Array.isArray(value)) {
  6427. value = [];
  6428. }
  6429. }
  6430. dataList.forEach((item, index) => {
  6431. item.disabled = item.disable || item.disabled || false;
  6432. if (this.multiple) {
  6433. if (value.length > 0) {
  6434. let have = value.find((val) => val === item[this.map.value]);
  6435. item.selected = have !== void 0;
  6436. } else {
  6437. item.selected = false;
  6438. }
  6439. } else {
  6440. item.selected = value === item[this.map.value];
  6441. }
  6442. list.push(item);
  6443. });
  6444. return this.setRange(list);
  6445. },
  6446. /**
  6447. * 处理最大最小值
  6448. * @param {Object} list
  6449. */
  6450. setRange(list) {
  6451. let selectList = list.filter((item) => item.selected);
  6452. let min = Number(this.min) || 0;
  6453. let max = Number(this.max) || "";
  6454. list.forEach((item, index) => {
  6455. if (this.multiple) {
  6456. if (selectList.length <= min) {
  6457. let have = selectList.find((val) => val[this.map.value] === item[this.map.value]);
  6458. if (have !== void 0) {
  6459. item.disabled = true;
  6460. }
  6461. }
  6462. if (selectList.length >= max && max !== "") {
  6463. let have = selectList.find((val) => val[this.map.value] === item[this.map.value]);
  6464. if (have === void 0) {
  6465. item.disabled = true;
  6466. }
  6467. }
  6468. }
  6469. this.setStyles(item, index);
  6470. list[index] = item;
  6471. });
  6472. return list;
  6473. },
  6474. /**
  6475. * 设置 class
  6476. * @param {Object} item
  6477. * @param {Object} index
  6478. */
  6479. setStyles(item, index) {
  6480. item.styleBackgroud = this.setStyleBackgroud(item);
  6481. item.styleIcon = this.setStyleIcon(item);
  6482. item.styleIconText = this.setStyleIconText(item);
  6483. item.styleRightIcon = this.setStyleRightIcon(item);
  6484. },
  6485. /**
  6486. * 获取选中值
  6487. * @param {Object} range
  6488. */
  6489. getSelectedValue(range) {
  6490. if (!this.multiple)
  6491. return this.dataValue;
  6492. let selectedArr = [];
  6493. range.forEach((item) => {
  6494. if (item.selected) {
  6495. selectedArr.push(item[this.map.value]);
  6496. }
  6497. });
  6498. return this.dataValue.length > 0 ? this.dataValue : selectedArr;
  6499. },
  6500. /**
  6501. * 设置背景样式
  6502. */
  6503. setStyleBackgroud(item) {
  6504. let styles = {};
  6505. let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
  6506. if (this.selectedColor) {
  6507. if (this.mode !== "list") {
  6508. styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
  6509. }
  6510. if (this.mode === "tag") {
  6511. styles["background-color"] = item.selected ? selectedColor : "#f5f5f5";
  6512. }
  6513. }
  6514. let classles = "";
  6515. for (let i2 in styles) {
  6516. classles += `${i2}:${styles[i2]};`;
  6517. }
  6518. return classles;
  6519. },
  6520. setStyleIcon(item) {
  6521. let styles = {};
  6522. let classles = "";
  6523. if (this.selectedColor) {
  6524. let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
  6525. styles["background-color"] = item.selected ? selectedColor : "#fff";
  6526. styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
  6527. if (!item.selected && item.disabled) {
  6528. styles["background-color"] = "#F2F6FC";
  6529. styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
  6530. }
  6531. }
  6532. for (let i2 in styles) {
  6533. classles += `${i2}:${styles[i2]};`;
  6534. }
  6535. return classles;
  6536. },
  6537. setStyleIconText(item) {
  6538. let styles = {};
  6539. let classles = "";
  6540. if (this.selectedColor) {
  6541. let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
  6542. if (this.mode === "tag") {
  6543. styles.color = item.selected ? this.selectedTextColor ? this.selectedTextColor : "#fff" : "#666";
  6544. } else {
  6545. styles.color = item.selected ? this.selectedTextColor ? this.selectedTextColor : selectedColor : "#666";
  6546. }
  6547. if (!item.selected && item.disabled) {
  6548. styles.color = "#999";
  6549. }
  6550. }
  6551. for (let i2 in styles) {
  6552. classles += `${i2}:${styles[i2]};`;
  6553. }
  6554. return classles;
  6555. },
  6556. setStyleRightIcon(item) {
  6557. let styles = {};
  6558. let classles = "";
  6559. if (this.mode === "list") {
  6560. styles["border-color"] = item.selected ? this.styles.selectedColor : "#DCDFE6";
  6561. }
  6562. for (let i2 in styles) {
  6563. classles += `${i2}:${styles[i2]};`;
  6564. }
  6565. return classles;
  6566. }
  6567. }
  6568. };
  6569. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  6570. const _component_uni_load_more = resolveEasycom(vue.resolveDynamicComponent("uni-load-more"), __easycom_0$1);
  6571. return vue.openBlock(), vue.createElementBlock(
  6572. "view",
  6573. {
  6574. class: "uni-data-checklist",
  6575. style: vue.normalizeStyle({ "margin-top": $data.isTop + "px" })
  6576. },
  6577. [
  6578. !$data.isLocal ? (vue.openBlock(), vue.createElementBlock("view", {
  6579. key: 0,
  6580. class: "uni-data-loading"
  6581. }, [
  6582. !_ctx.mixinDatacomErrorMessage ? (vue.openBlock(), vue.createBlock(_component_uni_load_more, {
  6583. key: 0,
  6584. status: "loading",
  6585. iconType: "snow",
  6586. iconSize: 18,
  6587. "content-text": $data.contentText
  6588. }, null, 8, ["content-text"])) : (vue.openBlock(), vue.createElementBlock(
  6589. "text",
  6590. { key: 1 },
  6591. vue.toDisplayString(_ctx.mixinDatacomErrorMessage),
  6592. 1
  6593. /* TEXT */
  6594. ))
  6595. ])) : (vue.openBlock(), vue.createElementBlock(
  6596. vue.Fragment,
  6597. { key: 1 },
  6598. [
  6599. $props.multiple ? (vue.openBlock(), vue.createElementBlock(
  6600. "checkbox-group",
  6601. {
  6602. key: 0,
  6603. class: vue.normalizeClass(["checklist-group", { "is-list": $props.mode === "list" || $props.wrap }]),
  6604. onChange: _cache[0] || (_cache[0] = (...args) => $options.change && $options.change(...args))
  6605. },
  6606. [
  6607. (vue.openBlock(true), vue.createElementBlock(
  6608. vue.Fragment,
  6609. null,
  6610. vue.renderList($data.dataList, (item, index) => {
  6611. return vue.openBlock(), vue.createElementBlock(
  6612. "label",
  6613. {
  6614. class: vue.normalizeClass(["checklist-box", ["is--" + $props.mode, item.selected ? "is-checked" : "", $props.disabled || !!item.disabled ? "is-disable" : "", index !== 0 && $props.mode === "list" ? "is-list-border" : ""]]),
  6615. style: vue.normalizeStyle(item.styleBackgroud),
  6616. key: index
  6617. },
  6618. [
  6619. vue.createElementVNode("checkbox", {
  6620. class: "hidden",
  6621. hidden: "",
  6622. disabled: $props.disabled || !!item.disabled,
  6623. value: item[$props.map.value] + "",
  6624. checked: item.selected
  6625. }, null, 8, ["disabled", "value", "checked"]),
  6626. $props.mode !== "tag" && $props.mode !== "list" || $props.mode === "list" && $props.icon === "left" ? (vue.openBlock(), vue.createElementBlock(
  6627. "view",
  6628. {
  6629. key: 0,
  6630. class: "checkbox__inner",
  6631. style: vue.normalizeStyle(item.styleIcon)
  6632. },
  6633. [
  6634. vue.createElementVNode("view", { class: "checkbox__inner-icon" })
  6635. ],
  6636. 4
  6637. /* STYLE */
  6638. )) : vue.createCommentVNode("v-if", true),
  6639. vue.createElementVNode(
  6640. "view",
  6641. {
  6642. class: vue.normalizeClass(["checklist-content", { "list-content": $props.mode === "list" && $props.icon === "left" }])
  6643. },
  6644. [
  6645. vue.createElementVNode(
  6646. "text",
  6647. {
  6648. class: "checklist-text",
  6649. style: vue.normalizeStyle(item.styleIconText)
  6650. },
  6651. vue.toDisplayString(item[$props.map.text]),
  6652. 5
  6653. /* TEXT, STYLE */
  6654. ),
  6655. $props.mode === "list" && $props.icon === "right" ? (vue.openBlock(), vue.createElementBlock(
  6656. "view",
  6657. {
  6658. key: 0,
  6659. class: "checkobx__list",
  6660. style: vue.normalizeStyle(item.styleBackgroud)
  6661. },
  6662. null,
  6663. 4
  6664. /* STYLE */
  6665. )) : vue.createCommentVNode("v-if", true)
  6666. ],
  6667. 2
  6668. /* CLASS */
  6669. )
  6670. ],
  6671. 6
  6672. /* CLASS, STYLE */
  6673. );
  6674. }),
  6675. 128
  6676. /* KEYED_FRAGMENT */
  6677. ))
  6678. ],
  6679. 34
  6680. /* CLASS, NEED_HYDRATION */
  6681. )) : (vue.openBlock(), vue.createElementBlock(
  6682. "radio-group",
  6683. {
  6684. key: 1,
  6685. class: vue.normalizeClass(["checklist-group", { "is-list": $props.mode === "list", "is-wrap": $props.wrap }]),
  6686. onChange: _cache[1] || (_cache[1] = (...args) => $options.change && $options.change(...args))
  6687. },
  6688. [
  6689. (vue.openBlock(true), vue.createElementBlock(
  6690. vue.Fragment,
  6691. null,
  6692. vue.renderList($data.dataList, (item, index) => {
  6693. return vue.openBlock(), vue.createElementBlock(
  6694. "label",
  6695. {
  6696. class: vue.normalizeClass(["checklist-box", ["is--" + $props.mode, item.selected ? "is-checked" : "", $props.disabled || !!item.disabled ? "is-disable" : "", index !== 0 && $props.mode === "list" ? "is-list-border" : ""]]),
  6697. style: vue.normalizeStyle(item.styleBackgroud),
  6698. key: index
  6699. },
  6700. [
  6701. vue.createElementVNode("radio", {
  6702. class: "hidden",
  6703. hidden: "",
  6704. disabled: $props.disabled || item.disabled,
  6705. value: item[$props.map.value] + "",
  6706. checked: item.selected
  6707. }, null, 8, ["disabled", "value", "checked"]),
  6708. $props.mode !== "tag" && $props.mode !== "list" || $props.mode === "list" && $props.icon === "left" ? (vue.openBlock(), vue.createElementBlock(
  6709. "view",
  6710. {
  6711. key: 0,
  6712. class: "radio__inner",
  6713. style: vue.normalizeStyle(item.styleBackgroud)
  6714. },
  6715. [
  6716. vue.createElementVNode(
  6717. "view",
  6718. {
  6719. class: "radio__inner-icon",
  6720. style: vue.normalizeStyle(item.styleIcon)
  6721. },
  6722. null,
  6723. 4
  6724. /* STYLE */
  6725. )
  6726. ],
  6727. 4
  6728. /* STYLE */
  6729. )) : vue.createCommentVNode("v-if", true),
  6730. vue.createElementVNode(
  6731. "view",
  6732. {
  6733. class: vue.normalizeClass(["checklist-content", { "list-content": $props.mode === "list" && $props.icon === "left" }])
  6734. },
  6735. [
  6736. vue.createElementVNode(
  6737. "text",
  6738. {
  6739. class: "checklist-text",
  6740. style: vue.normalizeStyle(item.styleIconText)
  6741. },
  6742. vue.toDisplayString(item[$props.map.text]),
  6743. 5
  6744. /* TEXT, STYLE */
  6745. ),
  6746. $props.mode === "list" && $props.icon === "right" ? (vue.openBlock(), vue.createElementBlock(
  6747. "view",
  6748. {
  6749. key: 0,
  6750. style: vue.normalizeStyle(item.styleRightIcon),
  6751. class: "checkobx__list"
  6752. },
  6753. null,
  6754. 4
  6755. /* STYLE */
  6756. )) : vue.createCommentVNode("v-if", true)
  6757. ],
  6758. 2
  6759. /* CLASS */
  6760. )
  6761. ],
  6762. 6
  6763. /* CLASS, STYLE */
  6764. );
  6765. }),
  6766. 128
  6767. /* KEYED_FRAGMENT */
  6768. ))
  6769. ],
  6770. 34
  6771. /* CLASS, NEED_HYDRATION */
  6772. ))
  6773. ],
  6774. 64
  6775. /* STABLE_FRAGMENT */
  6776. ))
  6777. ],
  6778. 4
  6779. /* STYLE */
  6780. );
  6781. }
  6782. const __easycom_2$1 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5], ["__scopeId", "data-v-2f788efd"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue"]]);
  6783. var pattern = {
  6784. email: /^\S+?@\S+?\.\S+?$/,
  6785. idcard: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
  6786. url: new RegExp(
  6787. "^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$",
  6788. "i"
  6789. )
  6790. };
  6791. const FORMAT_MAPPING = {
  6792. "int": "integer",
  6793. "bool": "boolean",
  6794. "double": "number",
  6795. "long": "number",
  6796. "password": "string"
  6797. // "fileurls": 'array'
  6798. };
  6799. function formatMessage(args, resources = "") {
  6800. var defaultMessage = ["label"];
  6801. defaultMessage.forEach((item) => {
  6802. if (args[item] === void 0) {
  6803. args[item] = "";
  6804. }
  6805. });
  6806. let str = resources;
  6807. for (let key in args) {
  6808. let reg = new RegExp("{" + key + "}");
  6809. str = str.replace(reg, args[key]);
  6810. }
  6811. return str;
  6812. }
  6813. function isEmptyValue(value, type) {
  6814. if (value === void 0 || value === null) {
  6815. return true;
  6816. }
  6817. if (typeof value === "string" && !value) {
  6818. return true;
  6819. }
  6820. if (Array.isArray(value) && !value.length) {
  6821. return true;
  6822. }
  6823. if (type === "object" && !Object.keys(value).length) {
  6824. return true;
  6825. }
  6826. return false;
  6827. }
  6828. const types = {
  6829. integer(value) {
  6830. return types.number(value) && parseInt(value, 10) === value;
  6831. },
  6832. string(value) {
  6833. return typeof value === "string";
  6834. },
  6835. number(value) {
  6836. if (isNaN(value)) {
  6837. return false;
  6838. }
  6839. return typeof value === "number";
  6840. },
  6841. "boolean": function(value) {
  6842. return typeof value === "boolean";
  6843. },
  6844. "float": function(value) {
  6845. return types.number(value) && !types.integer(value);
  6846. },
  6847. array(value) {
  6848. return Array.isArray(value);
  6849. },
  6850. object(value) {
  6851. return typeof value === "object" && !types.array(value);
  6852. },
  6853. date(value) {
  6854. return value instanceof Date;
  6855. },
  6856. timestamp(value) {
  6857. if (!this.integer(value) || Math.abs(value).toString().length > 16) {
  6858. return false;
  6859. }
  6860. return true;
  6861. },
  6862. file(value) {
  6863. return typeof value.url === "string";
  6864. },
  6865. email(value) {
  6866. return typeof value === "string" && !!value.match(pattern.email) && value.length < 255;
  6867. },
  6868. url(value) {
  6869. return typeof value === "string" && !!value.match(pattern.url);
  6870. },
  6871. pattern(reg, value) {
  6872. try {
  6873. return new RegExp(reg).test(value);
  6874. } catch (e2) {
  6875. return false;
  6876. }
  6877. },
  6878. method(value) {
  6879. return typeof value === "function";
  6880. },
  6881. idcard(value) {
  6882. return typeof value === "string" && !!value.match(pattern.idcard);
  6883. },
  6884. "url-https"(value) {
  6885. return this.url(value) && value.startsWith("https://");
  6886. },
  6887. "url-scheme"(value) {
  6888. return value.startsWith("://");
  6889. },
  6890. "url-web"(value) {
  6891. return false;
  6892. }
  6893. };
  6894. class RuleValidator {
  6895. constructor(message) {
  6896. this._message = message;
  6897. }
  6898. async validateRule(fieldKey, fieldValue, value, data, allData) {
  6899. var result = null;
  6900. let rules = fieldValue.rules;
  6901. let hasRequired = rules.findIndex((item) => {
  6902. return item.required;
  6903. });
  6904. if (hasRequired < 0) {
  6905. if (value === null || value === void 0) {
  6906. return result;
  6907. }
  6908. if (typeof value === "string" && !value.length) {
  6909. return result;
  6910. }
  6911. }
  6912. var message = this._message;
  6913. if (rules === void 0) {
  6914. return message["default"];
  6915. }
  6916. for (var i2 = 0; i2 < rules.length; i2++) {
  6917. let rule = rules[i2];
  6918. let vt2 = this._getValidateType(rule);
  6919. Object.assign(rule, {
  6920. label: fieldValue.label || `["${fieldKey}"]`
  6921. });
  6922. if (RuleValidatorHelper[vt2]) {
  6923. result = RuleValidatorHelper[vt2](rule, value, message);
  6924. if (result != null) {
  6925. break;
  6926. }
  6927. }
  6928. if (rule.validateExpr) {
  6929. let now = Date.now();
  6930. let resultExpr = rule.validateExpr(value, allData, now);
  6931. if (resultExpr === false) {
  6932. result = this._getMessage(rule, rule.errorMessage || this._message["default"]);
  6933. break;
  6934. }
  6935. }
  6936. if (rule.validateFunction) {
  6937. result = await this.validateFunction(rule, value, data, allData, vt2);
  6938. if (result !== null) {
  6939. break;
  6940. }
  6941. }
  6942. }
  6943. if (result !== null) {
  6944. result = message.TAG + result;
  6945. }
  6946. return result;
  6947. }
  6948. async validateFunction(rule, value, data, allData, vt2) {
  6949. let result = null;
  6950. try {
  6951. let callbackMessage = null;
  6952. const res = await rule.validateFunction(rule, value, allData || data, (message) => {
  6953. callbackMessage = message;
  6954. });
  6955. if (callbackMessage || typeof res === "string" && res || res === false) {
  6956. result = this._getMessage(rule, callbackMessage || res, vt2);
  6957. }
  6958. } catch (e2) {
  6959. result = this._getMessage(rule, e2.message, vt2);
  6960. }
  6961. return result;
  6962. }
  6963. _getMessage(rule, message, vt2) {
  6964. return formatMessage(rule, message || rule.errorMessage || this._message[vt2] || message["default"]);
  6965. }
  6966. _getValidateType(rule) {
  6967. var result = "";
  6968. if (rule.required) {
  6969. result = "required";
  6970. } else if (rule.format) {
  6971. result = "format";
  6972. } else if (rule.arrayType) {
  6973. result = "arrayTypeFormat";
  6974. } else if (rule.range) {
  6975. result = "range";
  6976. } else if (rule.maximum !== void 0 || rule.minimum !== void 0) {
  6977. result = "rangeNumber";
  6978. } else if (rule.maxLength !== void 0 || rule.minLength !== void 0) {
  6979. result = "rangeLength";
  6980. } else if (rule.pattern) {
  6981. result = "pattern";
  6982. } else if (rule.validateFunction) {
  6983. result = "validateFunction";
  6984. }
  6985. return result;
  6986. }
  6987. }
  6988. const RuleValidatorHelper = {
  6989. required(rule, value, message) {
  6990. if (rule.required && isEmptyValue(value, rule.format || typeof value)) {
  6991. return formatMessage(rule, rule.errorMessage || message.required);
  6992. }
  6993. return null;
  6994. },
  6995. range(rule, value, message) {
  6996. const {
  6997. range,
  6998. errorMessage
  6999. } = rule;
  7000. let list = new Array(range.length);
  7001. for (let i2 = 0; i2 < range.length; i2++) {
  7002. const item = range[i2];
  7003. if (types.object(item) && item.value !== void 0) {
  7004. list[i2] = item.value;
  7005. } else {
  7006. list[i2] = item;
  7007. }
  7008. }
  7009. let result = false;
  7010. if (Array.isArray(value)) {
  7011. result = new Set(value.concat(list)).size === list.length;
  7012. } else {
  7013. if (list.indexOf(value) > -1) {
  7014. result = true;
  7015. }
  7016. }
  7017. if (!result) {
  7018. return formatMessage(rule, errorMessage || message["enum"]);
  7019. }
  7020. return null;
  7021. },
  7022. rangeNumber(rule, value, message) {
  7023. if (!types.number(value)) {
  7024. return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
  7025. }
  7026. let {
  7027. minimum,
  7028. maximum,
  7029. exclusiveMinimum,
  7030. exclusiveMaximum
  7031. } = rule;
  7032. let min = exclusiveMinimum ? value <= minimum : value < minimum;
  7033. let max = exclusiveMaximum ? value >= maximum : value > maximum;
  7034. if (minimum !== void 0 && min) {
  7035. return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMinimum ? "exclusiveMinimum" : "minimum"]);
  7036. } else if (maximum !== void 0 && max) {
  7037. return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMaximum ? "exclusiveMaximum" : "maximum"]);
  7038. } else if (minimum !== void 0 && maximum !== void 0 && (min || max)) {
  7039. return formatMessage(rule, rule.errorMessage || message["number"].range);
  7040. }
  7041. return null;
  7042. },
  7043. rangeLength(rule, value, message) {
  7044. if (!types.string(value) && !types.array(value)) {
  7045. return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
  7046. }
  7047. let min = rule.minLength;
  7048. let max = rule.maxLength;
  7049. let val = value.length;
  7050. if (min !== void 0 && val < min) {
  7051. return formatMessage(rule, rule.errorMessage || message["length"].minLength);
  7052. } else if (max !== void 0 && val > max) {
  7053. return formatMessage(rule, rule.errorMessage || message["length"].maxLength);
  7054. } else if (min !== void 0 && max !== void 0 && (val < min || val > max)) {
  7055. return formatMessage(rule, rule.errorMessage || message["length"].range);
  7056. }
  7057. return null;
  7058. },
  7059. pattern(rule, value, message) {
  7060. if (!types["pattern"](rule.pattern, value)) {
  7061. return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
  7062. }
  7063. return null;
  7064. },
  7065. format(rule, value, message) {
  7066. var customTypes = Object.keys(types);
  7067. var format = FORMAT_MAPPING[rule.format] ? FORMAT_MAPPING[rule.format] : rule.format || rule.arrayType;
  7068. if (customTypes.indexOf(format) > -1) {
  7069. if (!types[format](value)) {
  7070. return formatMessage(rule, rule.errorMessage || message.typeError);
  7071. }
  7072. }
  7073. return null;
  7074. },
  7075. arrayTypeFormat(rule, value, message) {
  7076. if (!Array.isArray(value)) {
  7077. return formatMessage(rule, rule.errorMessage || message.typeError);
  7078. }
  7079. for (let i2 = 0; i2 < value.length; i2++) {
  7080. const element = value[i2];
  7081. let formatResult = this.format(rule, element, message);
  7082. if (formatResult !== null) {
  7083. return formatResult;
  7084. }
  7085. }
  7086. return null;
  7087. }
  7088. };
  7089. class SchemaValidator extends RuleValidator {
  7090. constructor(schema, options) {
  7091. super(SchemaValidator.message);
  7092. this._schema = schema;
  7093. this._options = options || null;
  7094. }
  7095. updateSchema(schema) {
  7096. this._schema = schema;
  7097. }
  7098. async validate(data, allData) {
  7099. let result = this._checkFieldInSchema(data);
  7100. if (!result) {
  7101. result = await this.invokeValidate(data, false, allData);
  7102. }
  7103. return result.length ? result[0] : null;
  7104. }
  7105. async validateAll(data, allData) {
  7106. let result = this._checkFieldInSchema(data);
  7107. if (!result) {
  7108. result = await this.invokeValidate(data, true, allData);
  7109. }
  7110. return result;
  7111. }
  7112. async validateUpdate(data, allData) {
  7113. let result = this._checkFieldInSchema(data);
  7114. if (!result) {
  7115. result = await this.invokeValidateUpdate(data, false, allData);
  7116. }
  7117. return result.length ? result[0] : null;
  7118. }
  7119. async invokeValidate(data, all, allData) {
  7120. let result = [];
  7121. let schema = this._schema;
  7122. for (let key in schema) {
  7123. let value = schema[key];
  7124. let errorMessage = await this.validateRule(key, value, data[key], data, allData);
  7125. if (errorMessage != null) {
  7126. result.push({
  7127. key,
  7128. errorMessage
  7129. });
  7130. if (!all)
  7131. break;
  7132. }
  7133. }
  7134. return result;
  7135. }
  7136. async invokeValidateUpdate(data, all, allData) {
  7137. let result = [];
  7138. for (let key in data) {
  7139. let errorMessage = await this.validateRule(key, this._schema[key], data[key], data, allData);
  7140. if (errorMessage != null) {
  7141. result.push({
  7142. key,
  7143. errorMessage
  7144. });
  7145. if (!all)
  7146. break;
  7147. }
  7148. }
  7149. return result;
  7150. }
  7151. _checkFieldInSchema(data) {
  7152. var keys = Object.keys(data);
  7153. var keys2 = Object.keys(this._schema);
  7154. if (new Set(keys.concat(keys2)).size === keys2.length) {
  7155. return "";
  7156. }
  7157. var noExistFields = keys.filter((key) => {
  7158. return keys2.indexOf(key) < 0;
  7159. });
  7160. var errorMessage = formatMessage({
  7161. field: JSON.stringify(noExistFields)
  7162. }, SchemaValidator.message.TAG + SchemaValidator.message["defaultInvalid"]);
  7163. return [{
  7164. key: "invalid",
  7165. errorMessage
  7166. }];
  7167. }
  7168. }
  7169. function Message() {
  7170. return {
  7171. TAG: "",
  7172. default: "验证错误",
  7173. defaultInvalid: "提交的字段{field}在数据库中并不存在",
  7174. validateFunction: "验证无效",
  7175. required: "{label}必填",
  7176. "enum": "{label}超出范围",
  7177. timestamp: "{label}格式无效",
  7178. whitespace: "{label}不能为空",
  7179. typeError: "{label}类型无效",
  7180. date: {
  7181. format: "{label}日期{value}格式无效",
  7182. parse: "{label}日期无法解析,{value}无效",
  7183. invalid: "{label}日期{value}无效"
  7184. },
  7185. length: {
  7186. minLength: "{label}长度不能少于{minLength}",
  7187. maxLength: "{label}长度不能超过{maxLength}",
  7188. range: "{label}必须介于{minLength}和{maxLength}之间"
  7189. },
  7190. number: {
  7191. minimum: "{label}不能小于{minimum}",
  7192. maximum: "{label}不能大于{maximum}",
  7193. exclusiveMinimum: "{label}不能小于等于{minimum}",
  7194. exclusiveMaximum: "{label}不能大于等于{maximum}",
  7195. range: "{label}必须介于{minimum}and{maximum}之间"
  7196. },
  7197. pattern: {
  7198. mismatch: "{label}格式不匹配"
  7199. }
  7200. };
  7201. }
  7202. SchemaValidator.message = new Message();
  7203. const deepCopy = (val) => {
  7204. return JSON.parse(JSON.stringify(val));
  7205. };
  7206. const typeFilter = (format) => {
  7207. return format === "int" || format === "double" || format === "number" || format === "timestamp";
  7208. };
  7209. const getValue = (key, value, rules) => {
  7210. const isRuleNumType = rules.find((val) => val.format && typeFilter(val.format));
  7211. const isRuleBoolType = rules.find((val) => val.format && val.format === "boolean" || val.format === "bool");
  7212. if (!!isRuleNumType) {
  7213. if (!value && value !== 0) {
  7214. value = null;
  7215. } else {
  7216. value = isNumber(Number(value)) ? Number(value) : value;
  7217. }
  7218. }
  7219. if (!!isRuleBoolType) {
  7220. value = isBoolean(value) ? value : false;
  7221. }
  7222. return value;
  7223. };
  7224. const setDataValue = (field, formdata, value) => {
  7225. formdata[field] = value;
  7226. return value || "";
  7227. };
  7228. const getDataValue = (field, data) => {
  7229. return objGet(data, field);
  7230. };
  7231. const realName = (name, data = {}) => {
  7232. const base_name = _basePath(name);
  7233. if (typeof base_name === "object" && Array.isArray(base_name) && base_name.length > 1) {
  7234. const realname = base_name.reduce((a2, b2) => a2 += `#${b2}`, "_formdata_");
  7235. return realname;
  7236. }
  7237. return base_name[0] || name;
  7238. };
  7239. const isRealName = (name) => {
  7240. const reg = /^_formdata_#*/;
  7241. return reg.test(name);
  7242. };
  7243. const rawData = (object = {}, name) => {
  7244. let newData = JSON.parse(JSON.stringify(object));
  7245. let formData = {};
  7246. for (let i2 in newData) {
  7247. let path = name2arr(i2);
  7248. objSet(formData, path, newData[i2]);
  7249. }
  7250. return formData;
  7251. };
  7252. const name2arr = (name) => {
  7253. let field = name.replace("_formdata_#", "");
  7254. field = field.split("#").map((v2) => isNumber(v2) ? Number(v2) : v2);
  7255. return field;
  7256. };
  7257. const objSet = (object, path, value) => {
  7258. if (typeof object !== "object")
  7259. return object;
  7260. _basePath(path).reduce((o2, k, i2, _2) => {
  7261. if (i2 === _2.length - 1) {
  7262. o2[k] = value;
  7263. return null;
  7264. } else if (k in o2) {
  7265. return o2[k];
  7266. } else {
  7267. o2[k] = /^[0-9]{1,}$/.test(_2[i2 + 1]) ? [] : {};
  7268. return o2[k];
  7269. }
  7270. }, object);
  7271. return object;
  7272. };
  7273. function _basePath(path) {
  7274. if (Array.isArray(path))
  7275. return path;
  7276. return path.replace(/\[/g, ".").replace(/\]/g, "").split(".");
  7277. }
  7278. const objGet = (object, path, defaultVal = "undefined") => {
  7279. let newPath = _basePath(path);
  7280. let val = newPath.reduce((o2, k) => {
  7281. return (o2 || {})[k];
  7282. }, object);
  7283. return !val || val !== void 0 ? val : defaultVal;
  7284. };
  7285. const isNumber = (num) => {
  7286. return !isNaN(Number(num));
  7287. };
  7288. const isBoolean = (bool) => {
  7289. return typeof bool === "boolean";
  7290. };
  7291. const isRequiredField = (rules) => {
  7292. let isNoField = false;
  7293. for (let i2 = 0; i2 < rules.length; i2++) {
  7294. const ruleData = rules[i2];
  7295. if (ruleData.required) {
  7296. isNoField = true;
  7297. break;
  7298. }
  7299. }
  7300. return isNoField;
  7301. };
  7302. const isEqual = (a2, b2) => {
  7303. if (a2 === b2) {
  7304. return a2 !== 0 || 1 / a2 === 1 / b2;
  7305. }
  7306. if (a2 == null || b2 == null) {
  7307. return a2 === b2;
  7308. }
  7309. var classNameA = toString.call(a2), classNameB = toString.call(b2);
  7310. if (classNameA !== classNameB) {
  7311. return false;
  7312. }
  7313. switch (classNameA) {
  7314. case "[object RegExp]":
  7315. case "[object String]":
  7316. return "" + a2 === "" + b2;
  7317. case "[object Number]":
  7318. if (+a2 !== +a2) {
  7319. return +b2 !== +b2;
  7320. }
  7321. return +a2 === 0 ? 1 / +a2 === 1 / b2 : +a2 === +b2;
  7322. case "[object Date]":
  7323. case "[object Boolean]":
  7324. return +a2 === +b2;
  7325. }
  7326. if (classNameA == "[object Object]") {
  7327. var propsA = Object.getOwnPropertyNames(a2), propsB = Object.getOwnPropertyNames(b2);
  7328. if (propsA.length != propsB.length) {
  7329. return false;
  7330. }
  7331. for (var i2 = 0; i2 < propsA.length; i2++) {
  7332. var propName = propsA[i2];
  7333. if (a2[propName] !== b2[propName]) {
  7334. return false;
  7335. }
  7336. }
  7337. return true;
  7338. }
  7339. if (classNameA == "[object Array]") {
  7340. if (a2.toString() == b2.toString()) {
  7341. return true;
  7342. }
  7343. return false;
  7344. }
  7345. };
  7346. const _sfc_main$5 = {
  7347. name: "uniForms",
  7348. emits: ["validate", "submit"],
  7349. options: {
  7350. virtualHost: true
  7351. },
  7352. props: {
  7353. // 即将弃用
  7354. value: {
  7355. type: Object,
  7356. default() {
  7357. return null;
  7358. }
  7359. },
  7360. // vue3 替换 value 属性
  7361. modelValue: {
  7362. type: Object,
  7363. default() {
  7364. return null;
  7365. }
  7366. },
  7367. // 1.4.0 开始将不支持 v-model ,且废弃 value 和 modelValue
  7368. model: {
  7369. type: Object,
  7370. default() {
  7371. return null;
  7372. }
  7373. },
  7374. // 表单校验规则
  7375. rules: {
  7376. type: Object,
  7377. default() {
  7378. return {};
  7379. }
  7380. },
  7381. //校验错误信息提示方式 默认 undertext 取值 [undertext|toast|modal]
  7382. errShowType: {
  7383. type: String,
  7384. default: "undertext"
  7385. },
  7386. // 校验触发器方式 默认 bind 取值 [bind|submit]
  7387. validateTrigger: {
  7388. type: String,
  7389. default: "submit"
  7390. },
  7391. // label 位置,默认 left 取值 top/left
  7392. labelPosition: {
  7393. type: String,
  7394. default: "left"
  7395. },
  7396. // label 宽度
  7397. labelWidth: {
  7398. type: [String, Number],
  7399. default: ""
  7400. },
  7401. // label 居中方式,默认 left 取值 left/center/right
  7402. labelAlign: {
  7403. type: String,
  7404. default: "left"
  7405. },
  7406. border: {
  7407. type: Boolean,
  7408. default: false
  7409. }
  7410. },
  7411. provide() {
  7412. return {
  7413. uniForm: this
  7414. };
  7415. },
  7416. data() {
  7417. return {
  7418. // 表单本地值的记录,不应该与传如的值进行关联
  7419. formData: {},
  7420. formRules: {}
  7421. };
  7422. },
  7423. computed: {
  7424. // 计算数据源变化的
  7425. localData() {
  7426. const localVal = this.model || this.modelValue || this.value;
  7427. if (localVal) {
  7428. return deepCopy(localVal);
  7429. }
  7430. return {};
  7431. }
  7432. },
  7433. watch: {
  7434. // 监听数据变化 ,暂时不使用,需要单独赋值
  7435. // localData: {},
  7436. // 监听规则变化
  7437. rules: {
  7438. handler: function(val, oldVal) {
  7439. this.setRules(val);
  7440. },
  7441. deep: true,
  7442. immediate: true
  7443. }
  7444. },
  7445. created() {
  7446. let getbinddata = getApp().$vm.$.appContext.config.globalProperties.binddata;
  7447. if (!getbinddata) {
  7448. getApp().$vm.$.appContext.config.globalProperties.binddata = function(name, value, formName) {
  7449. if (formName) {
  7450. this.$refs[formName].setValue(name, value);
  7451. } else {
  7452. let formVm;
  7453. for (let i2 in this.$refs) {
  7454. const vm = this.$refs[i2];
  7455. if (vm && vm.$options && vm.$options.name === "uniForms") {
  7456. formVm = vm;
  7457. break;
  7458. }
  7459. }
  7460. if (!formVm)
  7461. return formatAppLog("error", "at uni_modules/uni-forms/components/uni-forms/uni-forms.vue:182", "当前 uni-froms 组件缺少 ref 属性");
  7462. formVm.setValue(name, value);
  7463. }
  7464. };
  7465. }
  7466. this.childrens = [];
  7467. this.inputChildrens = [];
  7468. this.setRules(this.rules);
  7469. },
  7470. methods: {
  7471. /**
  7472. * 外部调用方法
  7473. * 设置规则 ,主要用于小程序自定义检验规则
  7474. * @param {Array} rules 规则源数据
  7475. */
  7476. setRules(rules) {
  7477. this.formRules = Object.assign({}, this.formRules, rules);
  7478. this.validator = new SchemaValidator(rules);
  7479. },
  7480. /**
  7481. * 外部调用方法
  7482. * 设置数据,用于设置表单数据,公开给用户使用 , 不支持在动态表单中使用
  7483. * @param {Object} key
  7484. * @param {Object} value
  7485. */
  7486. setValue(key, value) {
  7487. let example = this.childrens.find((child) => child.name === key);
  7488. if (!example)
  7489. return null;
  7490. this.formData[key] = getValue(key, value, this.formRules[key] && this.formRules[key].rules || []);
  7491. return example.onFieldChange(this.formData[key]);
  7492. },
  7493. /**
  7494. * 外部调用方法
  7495. * 手动提交校验表单
  7496. * 对整个表单进行校验的方法,参数为一个回调函数。
  7497. * @param {Array} keepitem 保留不参与校验的字段
  7498. * @param {type} callback 方法回调
  7499. */
  7500. validate(keepitem, callback) {
  7501. return this.checkAll(this.formData, keepitem, callback);
  7502. },
  7503. /**
  7504. * 外部调用方法
  7505. * 部分表单校验
  7506. * @param {Array|String} props 需要校验的字段
  7507. * @param {Function} 回调函数
  7508. */
  7509. validateField(props = [], callback) {
  7510. props = [].concat(props);
  7511. let invalidFields = {};
  7512. this.childrens.forEach((item) => {
  7513. const name = realName(item.name);
  7514. if (props.indexOf(name) !== -1) {
  7515. invalidFields = Object.assign({}, invalidFields, {
  7516. [name]: this.formData[name]
  7517. });
  7518. }
  7519. });
  7520. return this.checkAll(invalidFields, [], callback);
  7521. },
  7522. /**
  7523. * 外部调用方法
  7524. * 移除表单项的校验结果。传入待移除的表单项的 prop 属性或者 prop 组成的数组,如不传则移除整个表单的校验结果
  7525. * @param {Array|String} props 需要移除校验的字段 ,不填为所有
  7526. */
  7527. clearValidate(props = []) {
  7528. props = [].concat(props);
  7529. this.childrens.forEach((item) => {
  7530. if (props.length === 0) {
  7531. item.errMsg = "";
  7532. } else {
  7533. const name = realName(item.name);
  7534. if (props.indexOf(name) !== -1) {
  7535. item.errMsg = "";
  7536. }
  7537. }
  7538. });
  7539. },
  7540. /**
  7541. * 外部调用方法 ,即将废弃
  7542. * 手动提交校验表单
  7543. * 对整个表单进行校验的方法,参数为一个回调函数。
  7544. * @param {Array} keepitem 保留不参与校验的字段
  7545. * @param {type} callback 方法回调
  7546. */
  7547. submit(keepitem, callback, type) {
  7548. for (let i2 in this.dataValue) {
  7549. const itemData = this.childrens.find((v2) => v2.name === i2);
  7550. if (itemData) {
  7551. if (this.formData[i2] === void 0) {
  7552. this.formData[i2] = this._getValue(i2, this.dataValue[i2]);
  7553. }
  7554. }
  7555. }
  7556. if (!type) {
  7557. formatAppLog("warn", "at uni_modules/uni-forms/components/uni-forms/uni-forms.vue:289", "submit 方法即将废弃,请使用validate方法代替!");
  7558. }
  7559. return this.checkAll(this.formData, keepitem, callback, "submit");
  7560. },
  7561. // 校验所有
  7562. async checkAll(invalidFields, keepitem, callback, type) {
  7563. if (!this.validator)
  7564. return;
  7565. let childrens = [];
  7566. for (let i2 in invalidFields) {
  7567. const item = this.childrens.find((v2) => realName(v2.name) === i2);
  7568. if (item) {
  7569. childrens.push(item);
  7570. }
  7571. }
  7572. if (!callback && typeof keepitem === "function") {
  7573. callback = keepitem;
  7574. }
  7575. let promise;
  7576. if (!callback && typeof callback !== "function" && Promise) {
  7577. promise = new Promise((resolve, reject) => {
  7578. callback = function(valid, invalidFields2) {
  7579. !valid ? resolve(invalidFields2) : reject(valid);
  7580. };
  7581. });
  7582. }
  7583. let results = [];
  7584. let tempFormData = JSON.parse(JSON.stringify(invalidFields));
  7585. for (let i2 in childrens) {
  7586. const child = childrens[i2];
  7587. let name = realName(child.name);
  7588. const result = await child.onFieldChange(tempFormData[name]);
  7589. if (result) {
  7590. results.push(result);
  7591. if (this.errShowType === "toast" || this.errShowType === "modal")
  7592. break;
  7593. }
  7594. }
  7595. if (Array.isArray(results)) {
  7596. if (results.length === 0)
  7597. results = null;
  7598. }
  7599. if (Array.isArray(keepitem)) {
  7600. keepitem.forEach((v2) => {
  7601. let vName = realName(v2);
  7602. let value = getDataValue(v2, this.localData);
  7603. if (value !== void 0) {
  7604. tempFormData[vName] = value;
  7605. }
  7606. });
  7607. }
  7608. if (type === "submit") {
  7609. this.$emit("submit", {
  7610. detail: {
  7611. value: tempFormData,
  7612. errors: results
  7613. }
  7614. });
  7615. } else {
  7616. this.$emit("validate", results);
  7617. }
  7618. let resetFormData = {};
  7619. resetFormData = rawData(tempFormData, this.name);
  7620. callback && typeof callback === "function" && callback(results, resetFormData);
  7621. if (promise && callback) {
  7622. return promise;
  7623. } else {
  7624. return null;
  7625. }
  7626. },
  7627. /**
  7628. * 返回validate事件
  7629. * @param {Object} result
  7630. */
  7631. validateCheck(result) {
  7632. this.$emit("validate", result);
  7633. },
  7634. _getValue: getValue,
  7635. _isRequiredField: isRequiredField,
  7636. _setDataValue: setDataValue,
  7637. _getDataValue: getDataValue,
  7638. _realName: realName,
  7639. _isRealName: isRealName,
  7640. _isEqual: isEqual
  7641. }
  7642. };
  7643. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  7644. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-forms" }, [
  7645. vue.createElementVNode("form", null, [
  7646. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  7647. ])
  7648. ]);
  7649. }
  7650. const __easycom_2 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__scopeId", "data-v-9a1e3c32"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-forms/components/uni-forms/uni-forms.vue"]]);
  7651. const _sfc_main$4 = {
  7652. data() {
  7653. const token = vue.ref(null);
  7654. const user = vue.ref(null);
  7655. const loading = vue.ref(false);
  7656. return {
  7657. token,
  7658. user,
  7659. messageType: "",
  7660. messageText: "",
  7661. instockHistory: [],
  7662. focusType: true,
  7663. loading,
  7664. // 校验表单数据
  7665. valiFormData: {
  7666. orderNum: "",
  7667. weight: "",
  7668. search_pkg: true,
  7669. typing: true,
  7670. search_order: true,
  7671. search_order_choice: 3
  7672. },
  7673. // 校验规则
  7674. rules: {
  7675. orderNum: {
  7676. rules: [{
  7677. required: true,
  7678. errorMessage: "单号不能为空"
  7679. }]
  7680. },
  7681. weight: {
  7682. rules: [{
  7683. required: true,
  7684. errorMessage: "重量不能为空"
  7685. }, {
  7686. format: "number",
  7687. errorMessage: "重量只能输入数字"
  7688. }]
  7689. }
  7690. },
  7691. searchOrderChoice: [
  7692. {
  7693. text: "更新为已入库,状态为【已入库】",
  7694. value: 1
  7695. },
  7696. {
  7697. text: "运单资料",
  7698. value: 2
  7699. },
  7700. {
  7701. text: "称重计费",
  7702. value: 3
  7703. }
  7704. ]
  7705. };
  7706. },
  7707. computed: {
  7708. // 处理表单排列切换
  7709. },
  7710. onShow() {
  7711. this.focusType = true;
  7712. this.loading = false;
  7713. this.token = uni.getStorageSync("token");
  7714. this.user = uni.getStorageSync("user");
  7715. },
  7716. onHide() {
  7717. this.focusType = false;
  7718. this.loading = false;
  7719. },
  7720. onReady() {
  7721. },
  7722. methods: {
  7723. searchPkgChange() {
  7724. this.valiFormData.search_pkg = !this.valiFormData.search_pkg;
  7725. this.valiFormData.typing = this.valiFormData.search_pkg;
  7726. },
  7727. searchOrderChoiceChange() {
  7728. this.valiFormData.search_order = !this.valiFormData.search_order;
  7729. this.valiFormData.search_order_choice = this.valiFormData.search_order ? 3 : "";
  7730. },
  7731. reset() {
  7732. this.loading = false;
  7733. this.valiFormData = {
  7734. orderNum: "",
  7735. weight: "",
  7736. search_pkg: true,
  7737. typing: true,
  7738. search_order: true,
  7739. search_order_choice: 3
  7740. };
  7741. },
  7742. async scan() {
  7743. let status = await this.checkPermission();
  7744. if (status !== 1) {
  7745. return;
  7746. }
  7747. uni.scanCode({
  7748. success: (res) => {
  7749. this.result = res.result;
  7750. this.valiFormData.orderNum = res.result;
  7751. },
  7752. fail: (err) => {
  7753. }
  7754. });
  7755. },
  7756. async checkPermission(code) {
  7757. let status = permission.isIOS ? await permission.requestIOS("camera") : await permission.requestAndroid("android.permission.CAMERA");
  7758. if (status === null || status === 1) {
  7759. status = 1;
  7760. } else {
  7761. uni.showModal({
  7762. content: "Camera permission required",
  7763. confirmText: "Setting",
  7764. success: function(res) {
  7765. if (res.confirm) {
  7766. permission.gotoAppSetting();
  7767. }
  7768. }
  7769. });
  7770. }
  7771. return status;
  7772. },
  7773. async warehouseScan() {
  7774. this.st && clearTimeout(this.st);
  7775. if (this.valiFormData.search_order_choice === 1) {
  7776. this.loading = true;
  7777. uni.request({
  7778. url: instockScanURL,
  7779. method: "POST",
  7780. header: {
  7781. batoken: this.token
  7782. },
  7783. data: {
  7784. order_no: this.valiFormData.orderNum
  7785. },
  7786. success: (res) => {
  7787. if (res.data.code == 1) {
  7788. this.messageType = "success";
  7789. this.messageText = res.data.msg;
  7790. this.$refs.message.open();
  7791. const historyItem = {
  7792. orderNum: this.valiFormData.orderNum,
  7793. createTime: /* @__PURE__ */ new Date(),
  7794. type: "入库",
  7795. status: true
  7796. };
  7797. this.instockHistory.unshift(historyItem);
  7798. this.instockHistory.length > 10 && (this.instockHistory.length = 10);
  7799. uni.setStorageSync("instockHistory", this.instockHistory);
  7800. this.getHistory();
  7801. } else {
  7802. this.messageType = "error";
  7803. this.messageText = res.data.msg;
  7804. this.$refs.message.open();
  7805. const historyItem = {
  7806. orderNum: this.valiFormData.orderNum,
  7807. createTime: /* @__PURE__ */ new Date(),
  7808. type: "入库",
  7809. status: false
  7810. };
  7811. this.instockHistory.unshift(historyItem);
  7812. this.instockHistory.length > 10 && (this.instockHistory.length = 10);
  7813. uni.setStorageSync("instockHistory", this.instockHistory);
  7814. this.getHistory();
  7815. }
  7816. this.st = setTimeout(() => {
  7817. this.reset();
  7818. this.st && clearTimeout(this.st);
  7819. }, 1e3);
  7820. }
  7821. });
  7822. } else if (this.valiFormData.search_order_choice === 3) {
  7823. this.loading = true;
  7824. uni.request({
  7825. url: weighScanURL,
  7826. method: "POST",
  7827. header: {
  7828. batoken: this.token
  7829. },
  7830. data: {
  7831. order_no: this.valiFormData.orderNum,
  7832. weight: this.valiFormData.weight
  7833. },
  7834. success: (res) => {
  7835. if (res.data.code == 1) {
  7836. this.messageType = "success";
  7837. this.messageText = res.data.msg;
  7838. this.$refs.message.open();
  7839. const historyItem = {
  7840. orderNum: this.valiFormData.orderNum,
  7841. createTime: /* @__PURE__ */ new Date(),
  7842. type: "称重",
  7843. status: true
  7844. };
  7845. this.instockHistory.unshift(historyItem);
  7846. this.instockHistory.length > 10 && (this.instockHistory.length = 10);
  7847. uni.setStorageSync("instockHistory", this.instockHistory);
  7848. this.getHistory();
  7849. } else {
  7850. this.messageType = "error";
  7851. this.messageText = res.data.msg;
  7852. this.$refs.message.open();
  7853. const historyItem = {
  7854. orderNum: this.valiFormData.orderNum,
  7855. createTime: /* @__PURE__ */ new Date(),
  7856. type: "称重",
  7857. status: false
  7858. };
  7859. this.instockHistory.unshift(historyItem);
  7860. this.instockHistory.length > 10 && (this.instockHistory.length = 10);
  7861. uni.setStorageSync("instockHistory", this.instockHistory);
  7862. this.getHistory();
  7863. }
  7864. this.st = setTimeout(() => {
  7865. this.reset();
  7866. this.st && clearTimeout(this.st);
  7867. }, 1e3);
  7868. }
  7869. });
  7870. }
  7871. },
  7872. onsubmit() {
  7873. this.$refs.valiForm.validate().then((res) => {
  7874. this.warehouseScan();
  7875. }).catch((err) => {
  7876. formatAppLog("log", "at pages/instock/index.vue:322", "err", err);
  7877. });
  7878. },
  7879. getHistory() {
  7880. }
  7881. }
  7882. };
  7883. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  7884. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  7885. const _component_uni_forms_item = resolveEasycom(vue.resolveDynamicComponent("uni-forms-item"), __easycom_1);
  7886. const _component_uni_data_checkbox = resolveEasycom(vue.resolveDynamicComponent("uni-data-checkbox"), __easycom_2$1);
  7887. const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_2);
  7888. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
  7889. const _component_uni_section = vue.resolveComponent("uni-section");
  7890. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_3);
  7891. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_4);
  7892. return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [
  7893. vue.createVNode(_component_uni_section, {
  7894. title: "表单校验",
  7895. type: "line"
  7896. }, {
  7897. default: vue.withCtx(() => [
  7898. vue.createElementVNode("view", { class: "example" }, [
  7899. vue.createCommentVNode(" 基础表单校验 "),
  7900. vue.createVNode(_component_uni_forms, {
  7901. ref: "valiForm",
  7902. rules: $data.rules,
  7903. modelValue: $data.valiFormData
  7904. }, {
  7905. default: vue.withCtx(() => [
  7906. vue.createVNode(_component_uni_forms_item, {
  7907. label: "单号",
  7908. required: "",
  7909. name: "orderNum"
  7910. }, {
  7911. default: vue.withCtx(() => [
  7912. vue.createVNode(_component_uni_easyinput, {
  7913. modelValue: $data.valiFormData.orderNum,
  7914. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.valiFormData.orderNum = $event),
  7915. placeholder: "请输入单号",
  7916. suffixIcon: "scan",
  7917. focus: $data.focusType,
  7918. onIconClick: $options.scan
  7919. }, null, 8, ["modelValue", "focus", "onIconClick"])
  7920. ]),
  7921. _: 1
  7922. /* STABLE */
  7923. }),
  7924. vue.createVNode(_component_uni_forms_item, {
  7925. label: "重量",
  7926. required: "",
  7927. name: "weight"
  7928. }, {
  7929. default: vue.withCtx(() => [
  7930. vue.createVNode(_component_uni_easyinput, {
  7931. modelValue: $data.valiFormData.weight,
  7932. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.valiFormData.weight = $event),
  7933. placeholder: "请输入重量",
  7934. oninput: "value=value.replace(/[^\\d.]/g,'').replace(/^\\./g, '').replace(/\\.{2,}/g, '').replace('.', '$#$').replace(/\\./g, '').replace('$#$', '.').match(/^\\d*(\\.?\\d{0,2})/g)[0] || null"
  7935. }, {
  7936. right: vue.withCtx(() => [
  7937. vue.createElementVNode("view", { class: "weight-right" }, "KG")
  7938. ]),
  7939. _: 1
  7940. /* STABLE */
  7941. }, 8, ["modelValue"])
  7942. ]),
  7943. _: 1
  7944. /* STABLE */
  7945. }),
  7946. vue.createVNode(_component_uni_forms_item, null, {
  7947. default: vue.withCtx(() => [
  7948. vue.createElementVNode(
  7949. "view",
  7950. {
  7951. onClick: _cache[3] || (_cache[3] = (...args) => $options.searchPkgChange && $options.searchPkgChange(...args)),
  7952. class: "checkbox-cum",
  7953. style: vue.normalizeStyle({ color: $data.valiFormData.search_pkg ? "#007AFF" : "gray" })
  7954. },
  7955. [
  7956. vue.createElementVNode("checkbox", {
  7957. checked: $data.valiFormData.search_pkg,
  7958. onClick: _cache[2] || (_cache[2] = (...args) => $options.searchPkgChange && $options.searchPkgChange(...args))
  7959. }, null, 8, ["checked"]),
  7960. vue.createTextVNode("搜索寄存包裹 ")
  7961. ],
  7962. 4
  7963. /* STYLE */
  7964. ),
  7965. vue.createElementVNode("view", { class: "sub-choice" }, [
  7966. vue.createElementVNode("checkbox", {
  7967. disabled: !$data.valiFormData.search_pkg,
  7968. checked: $data.valiFormData.typing
  7969. }, null, 8, ["disabled", "checked"]),
  7970. vue.createElementVNode(
  7971. "text",
  7972. {
  7973. onClick: _cache[4] || (_cache[4] = () => {
  7974. if ($data.valiFormData.search_pkg) {
  7975. $data.valiFormData.typing = !$data.valiFormData.typing;
  7976. }
  7977. }),
  7978. style: vue.normalizeStyle({ color: $data.valiFormData.search_pkg && $data.valiFormData.typing ? "#007AFF" : "gray" })
  7979. },
  7980. "包裹寄存、代购、运单都找不到时手工添加包裹",
  7981. 4
  7982. /* STYLE */
  7983. )
  7984. ]),
  7985. vue.createElementVNode(
  7986. "view",
  7987. {
  7988. onClick: _cache[6] || (_cache[6] = (...args) => $options.searchOrderChoiceChange && $options.searchOrderChoiceChange(...args)),
  7989. class: "checkbox-cum",
  7990. style: vue.normalizeStyle({ color: $data.valiFormData.search_order ? "#007AFF" : "gray" })
  7991. },
  7992. [
  7993. vue.createElementVNode("checkbox", {
  7994. checked: $data.valiFormData.search_order,
  7995. onClick: _cache[5] || (_cache[5] = (...args) => $options.searchOrderChoiceChange && $options.searchOrderChoiceChange(...args))
  7996. }, null, 8, ["checked"]),
  7997. vue.createTextVNode("搜索运单 ")
  7998. ],
  7999. 4
  8000. /* STYLE */
  8001. ),
  8002. vue.createElementVNode("view", null, [
  8003. vue.createVNode(_component_uni_data_checkbox, {
  8004. disabled: !$data.valiFormData.search_order,
  8005. modelValue: $data.valiFormData.search_order_choice,
  8006. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.valiFormData.search_order_choice = $event),
  8007. localdata: $data.searchOrderChoice
  8008. }, null, 8, ["disabled", "modelValue", "localdata"])
  8009. ])
  8010. ]),
  8011. _: 1
  8012. /* STABLE */
  8013. })
  8014. ]),
  8015. _: 1
  8016. /* STABLE */
  8017. }, 8, ["rules", "modelValue"]),
  8018. vue.createElementVNode("view", { class: "button-group" }, [
  8019. vue.createElementVNode("button", {
  8020. type: "info",
  8021. onClick: _cache[8] || (_cache[8] = (...args) => $options.reset && $options.reset(...args))
  8022. }, "重置"),
  8023. vue.createElementVNode("button", {
  8024. type: "primary",
  8025. onClick: _cache[9] || (_cache[9] = (...args) => $options.onsubmit && $options.onsubmit(...args)),
  8026. loading: $data.loading
  8027. }, [
  8028. !$data.loading ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  8029. key: 0,
  8030. type: "checkmarkempty",
  8031. size: "18",
  8032. color: "white"
  8033. })) : vue.createCommentVNode("v-if", true),
  8034. vue.createTextVNode(" 提交")
  8035. ], 8, ["loading"])
  8036. ])
  8037. ])
  8038. ]),
  8039. _: 1
  8040. /* STABLE */
  8041. }),
  8042. vue.createElementVNode("view", { class: "history" }, [
  8043. (vue.openBlock(true), vue.createElementBlock(
  8044. vue.Fragment,
  8045. null,
  8046. vue.renderList($data.instockHistory, (item, i2) => {
  8047. return vue.openBlock(), vue.createElementBlock("view", { class: "item" }, [
  8048. vue.createElementVNode(
  8049. "text",
  8050. {
  8051. class: "code",
  8052. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  8053. },
  8054. vue.toDisplayString(item.orderNum) + " " + vue.toDisplayString(item.type),
  8055. 5
  8056. /* TEXT, STYLE */
  8057. ),
  8058. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  8059. key: 0,
  8060. type: "checkmarkempty",
  8061. class: "status",
  8062. size: "16",
  8063. color: "green"
  8064. })) : (vue.openBlock(), vue.createElementBlock("text", {
  8065. key: 1,
  8066. class: "status fail"
  8067. }, "F")),
  8068. vue.createElementVNode(
  8069. "text",
  8070. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  8071. vue.toDisplayString("\r\n" + item.createTime),
  8072. 1
  8073. /* TEXT */
  8074. )
  8075. ]);
  8076. }),
  8077. 256
  8078. /* UNKEYED_FRAGMENT */
  8079. ))
  8080. ]),
  8081. vue.createVNode(
  8082. _component_uni_popup,
  8083. {
  8084. ref: "message",
  8085. type: "message"
  8086. },
  8087. {
  8088. default: vue.withCtx(() => [
  8089. vue.createVNode(_component_uni_popup_message, {
  8090. type: $data.messageType,
  8091. message: $data.messageText,
  8092. duration: 2e3
  8093. }, null, 8, ["type", "message"])
  8094. ]),
  8095. _: 1
  8096. /* STABLE */
  8097. },
  8098. 512
  8099. /* NEED_PATCH */
  8100. )
  8101. ]);
  8102. }
  8103. const PagesInstockIndex = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__file", "E:/HBuilderProjects/yta/pages/instock/index.vue"]]);
  8104. const en = {
  8105. "uni-popup.cancel": "cancel",
  8106. "uni-popup.ok": "ok",
  8107. "uni-popup.placeholder": "pleace enter",
  8108. "uni-popup.title": "Hint",
  8109. "uni-popup.shareTitle": "Share to"
  8110. };
  8111. const zhHans = {
  8112. "uni-popup.cancel": "取消",
  8113. "uni-popup.ok": "确定",
  8114. "uni-popup.placeholder": "请输入",
  8115. "uni-popup.title": "提示",
  8116. "uni-popup.shareTitle": "分享到"
  8117. };
  8118. const zhHant = {
  8119. "uni-popup.cancel": "取消",
  8120. "uni-popup.ok": "確定",
  8121. "uni-popup.placeholder": "請輸入",
  8122. "uni-popup.title": "提示",
  8123. "uni-popup.shareTitle": "分享到"
  8124. };
  8125. const messages = {
  8126. en,
  8127. "zh-Hans": zhHans,
  8128. "zh-Hant": zhHant
  8129. };
  8130. const { t } = initVueI18n(messages);
  8131. const _sfc_main$3 = {
  8132. name: "uniPopupDialog",
  8133. mixins: [popup],
  8134. emits: ["confirm", "close"],
  8135. props: {
  8136. inputType: {
  8137. type: String,
  8138. default: "text"
  8139. },
  8140. value: {
  8141. type: [String, Number],
  8142. default: ""
  8143. },
  8144. placeholder: {
  8145. type: [String, Number],
  8146. default: ""
  8147. },
  8148. type: {
  8149. type: String,
  8150. default: "error"
  8151. },
  8152. mode: {
  8153. type: String,
  8154. default: "base"
  8155. },
  8156. title: {
  8157. type: String,
  8158. default: ""
  8159. },
  8160. content: {
  8161. type: String,
  8162. default: ""
  8163. },
  8164. beforeClose: {
  8165. type: Boolean,
  8166. default: false
  8167. },
  8168. cancelText: {
  8169. type: String,
  8170. default: ""
  8171. },
  8172. confirmText: {
  8173. type: String,
  8174. default: ""
  8175. }
  8176. },
  8177. data() {
  8178. return {
  8179. dialogType: "error",
  8180. focus: false,
  8181. val: ""
  8182. };
  8183. },
  8184. computed: {
  8185. okText() {
  8186. return this.confirmText || t("uni-popup.ok");
  8187. },
  8188. closeText() {
  8189. return this.cancelText || t("uni-popup.cancel");
  8190. },
  8191. placeholderText() {
  8192. return this.placeholder || t("uni-popup.placeholder");
  8193. },
  8194. titleText() {
  8195. return this.title || t("uni-popup.title");
  8196. }
  8197. },
  8198. watch: {
  8199. type(val) {
  8200. this.dialogType = val;
  8201. },
  8202. mode(val) {
  8203. if (val === "input") {
  8204. this.dialogType = "info";
  8205. }
  8206. },
  8207. value(val) {
  8208. this.val = val;
  8209. }
  8210. },
  8211. created() {
  8212. this.popup.disableMask();
  8213. if (this.mode === "input") {
  8214. this.dialogType = "info";
  8215. this.val = this.value;
  8216. } else {
  8217. this.dialogType = this.type;
  8218. }
  8219. },
  8220. mounted() {
  8221. this.focus = true;
  8222. },
  8223. methods: {
  8224. /**
  8225. * 点击确认按钮
  8226. */
  8227. onOk() {
  8228. if (this.mode === "input") {
  8229. this.$emit("confirm", this.val);
  8230. } else {
  8231. this.$emit("confirm");
  8232. }
  8233. if (this.beforeClose)
  8234. return;
  8235. this.popup.close();
  8236. },
  8237. /**
  8238. * 点击取消按钮
  8239. */
  8240. closeDialog() {
  8241. this.$emit("close");
  8242. if (this.beforeClose)
  8243. return;
  8244. this.popup.close();
  8245. },
  8246. close() {
  8247. this.popup.close();
  8248. }
  8249. }
  8250. };
  8251. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  8252. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-popup-dialog" }, [
  8253. vue.createElementVNode("view", { class: "uni-dialog-title" }, [
  8254. vue.createElementVNode(
  8255. "text",
  8256. {
  8257. class: vue.normalizeClass(["uni-dialog-title-text", ["uni-popup__" + $data.dialogType]])
  8258. },
  8259. vue.toDisplayString($options.titleText),
  8260. 3
  8261. /* TEXT, CLASS */
  8262. )
  8263. ]),
  8264. $props.mode === "base" ? (vue.openBlock(), vue.createElementBlock("view", {
  8265. key: 0,
  8266. class: "uni-dialog-content"
  8267. }, [
  8268. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  8269. vue.createElementVNode(
  8270. "text",
  8271. { class: "uni-dialog-content-text" },
  8272. vue.toDisplayString($props.content),
  8273. 1
  8274. /* TEXT */
  8275. )
  8276. ], true)
  8277. ])) : (vue.openBlock(), vue.createElementBlock("view", {
  8278. key: 1,
  8279. class: "uni-dialog-content"
  8280. }, [
  8281. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  8282. vue.withDirectives(vue.createElementVNode("input", {
  8283. class: "uni-dialog-input",
  8284. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.val = $event),
  8285. type: $props.inputType,
  8286. placeholder: $options.placeholderText,
  8287. focus: $data.focus
  8288. }, null, 8, ["type", "placeholder", "focus"]), [
  8289. [vue.vModelDynamic, $data.val]
  8290. ])
  8291. ], true)
  8292. ])),
  8293. vue.createElementVNode("view", { class: "uni-dialog-button-group" }, [
  8294. vue.createElementVNode("view", {
  8295. class: "uni-dialog-button",
  8296. onClick: _cache[1] || (_cache[1] = (...args) => $options.closeDialog && $options.closeDialog(...args))
  8297. }, [
  8298. vue.createElementVNode(
  8299. "text",
  8300. { class: "uni-dialog-button-text" },
  8301. vue.toDisplayString($options.closeText),
  8302. 1
  8303. /* TEXT */
  8304. )
  8305. ]),
  8306. vue.createElementVNode("view", {
  8307. class: "uni-dialog-button uni-border-left",
  8308. onClick: _cache[2] || (_cache[2] = (...args) => $options.onOk && $options.onOk(...args))
  8309. }, [
  8310. vue.createElementVNode(
  8311. "text",
  8312. { class: "uni-dialog-button-text uni-button-color" },
  8313. vue.toDisplayString($options.okText),
  8314. 1
  8315. /* TEXT */
  8316. )
  8317. ])
  8318. ])
  8319. ]);
  8320. }
  8321. const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__scopeId", "data-v-d78c88b7"], ["__file", "E:/HBuilderProjects/yta/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue"]]);
  8322. const _sfc_main$2 = {
  8323. data() {
  8324. const token = vue.ref(null);
  8325. const user = vue.ref(null);
  8326. return {
  8327. token,
  8328. user
  8329. };
  8330. },
  8331. onLoad() {
  8332. },
  8333. onShow() {
  8334. this.token = uni.getStorageSync("token");
  8335. this.user = uni.getStorageSync("user");
  8336. },
  8337. methods: {
  8338. avatarClick() {
  8339. if (this.token)
  8340. ;
  8341. else {
  8342. uni.navigateTo({
  8343. url: "/pages/login/index"
  8344. });
  8345. }
  8346. },
  8347. logout() {
  8348. uni.removeStorageSync("token");
  8349. uni.removeStorageSync("user");
  8350. this.token = uni.getStorageSync("token");
  8351. this.user = uni.getStorageSync("user");
  8352. },
  8353. dialogToggle() {
  8354. this.$refs.alertDialog.open();
  8355. }
  8356. }
  8357. };
  8358. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  8359. const _component_uni_popup_dialog = resolveEasycom(vue.resolveDynamicComponent("uni-popup-dialog"), __easycom_0);
  8360. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_4);
  8361. return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, [
  8362. vue.createElementVNode("view", {
  8363. class: "user-v",
  8364. onClick: _cache[0] || (_cache[0] = (...args) => $options.avatarClick && $options.avatarClick(...args))
  8365. }, [
  8366. !$data.user.avatar ? (vue.openBlock(), vue.createElementBlock("image", {
  8367. key: 0,
  8368. class: "user-icon",
  8369. src: "/static/user.png"
  8370. })) : (vue.openBlock(), vue.createElementBlock("image", {
  8371. key: 1,
  8372. class: "user-icon",
  8373. src: $data.user.avatar
  8374. }, null, 8, ["src"]))
  8375. ]),
  8376. vue.createElementVNode("view", { class: "text-area" }, [
  8377. vue.createElementVNode(
  8378. "text",
  8379. { class: "title" },
  8380. vue.toDisplayString($data.user.username),
  8381. 1
  8382. /* TEXT */
  8383. )
  8384. ]),
  8385. vue.createElementVNode("view", { class: "login-btn" }, [
  8386. !$data.token ? (vue.openBlock(), vue.createElementBlock("button", {
  8387. key: 0,
  8388. type: "primary",
  8389. plain: "true",
  8390. size: "mini",
  8391. onClick: _cache[1] || (_cache[1] = (...args) => $options.avatarClick && $options.avatarClick(...args))
  8392. }, "Login")) : (vue.openBlock(), vue.createElementBlock("button", {
  8393. key: 1,
  8394. type: "default",
  8395. plain: "true",
  8396. size: "mini",
  8397. onClick: _cache[2] || (_cache[2] = (...args) => $options.dialogToggle && $options.dialogToggle(...args))
  8398. }, "Log Out"))
  8399. ]),
  8400. vue.createVNode(
  8401. _component_uni_popup,
  8402. {
  8403. ref: "alertDialog",
  8404. type: "dialog"
  8405. },
  8406. {
  8407. default: vue.withCtx(() => [
  8408. vue.createVNode(_component_uni_popup_dialog, {
  8409. type: "info",
  8410. cancelText: "Cancel",
  8411. confirmText: "Confirm",
  8412. title: "Log Out",
  8413. content: "Are you sure you want to LOG OUT?",
  8414. onConfirm: $options.logout
  8415. }, null, 8, ["onConfirm"])
  8416. ]),
  8417. _: 1
  8418. /* STABLE */
  8419. },
  8420. 512
  8421. /* NEED_PATCH */
  8422. )
  8423. ]);
  8424. }
  8425. const PagesProfileIndex = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "E:/HBuilderProjects/yta/pages/profile/index.vue"]]);
  8426. const _sfc_main$1 = {
  8427. data() {
  8428. return {
  8429. messageText: "",
  8430. captcha_id: "f2dd39ce-0d3e-4c1e-916c-b50090a7590s",
  8431. verifyCodeImg: "",
  8432. //验证码图片
  8433. verifyCodeToken: "",
  8434. //图形验证码的验证token
  8435. isVerifyCodeTure: false,
  8436. //验证码输入是否正确
  8437. valiFormData: {
  8438. account: "",
  8439. password: "",
  8440. captcha: ""
  8441. },
  8442. rules: {
  8443. name: {
  8444. rules: [{
  8445. required: true,
  8446. errorMessage: "姓名不能为空"
  8447. }]
  8448. },
  8449. age: {
  8450. rules: [{
  8451. required: true,
  8452. errorMessage: "年龄不能为空"
  8453. }, {
  8454. format: "number",
  8455. errorMessage: "年龄只能输入数字"
  8456. }]
  8457. }
  8458. }
  8459. };
  8460. },
  8461. onLoad() {
  8462. this.getVerifyCodeImg();
  8463. },
  8464. methods: {
  8465. getVerifyCodeImg() {
  8466. uni.request({
  8467. url: `${getcaptchaURL}?server=1&id=${this.captcha_id}&m=` + Math.random(),
  8468. method: "GET",
  8469. responseType: "arraybuffer",
  8470. //设置响应类型
  8471. success: (res) => {
  8472. const arrayBuffer = new Uint8Array(res.data);
  8473. const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(
  8474. arrayBuffer
  8475. );
  8476. this.verifyCodeImg = base64;
  8477. this.verifyCodeToken = res.header["Set-Cookie"];
  8478. }
  8479. });
  8480. },
  8481. formSubmit() {
  8482. uni.request({
  8483. //api地址
  8484. url: loginURL,
  8485. data: {
  8486. "username": this.valiFormData.account,
  8487. "password": this.valiFormData.password,
  8488. "captcha": this.valiFormData.captcha,
  8489. "keep": false,
  8490. "loading": true,
  8491. "captcha_id": this.captcha_id
  8492. },
  8493. //请求类型
  8494. method: "POST",
  8495. success: (res) => {
  8496. formatAppLog("log", "at pages/login/index.vue:109", res);
  8497. if (res.data.code == 1) {
  8498. const userInfo = res.data.data.userInfo;
  8499. uni.setStorage({
  8500. key: "token",
  8501. data: userInfo.token,
  8502. success() {
  8503. uni.setStorage({
  8504. key: "user",
  8505. data: userInfo,
  8506. success() {
  8507. uni.navigateBack();
  8508. }
  8509. });
  8510. }
  8511. });
  8512. } else {
  8513. formatAppLog("log", "at pages/login/index.vue:129", res);
  8514. this.messageText = res.data.msg;
  8515. this.$refs.message.open();
  8516. }
  8517. }
  8518. });
  8519. }
  8520. }
  8521. };
  8522. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  8523. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
  8524. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  8525. const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_2);
  8526. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_3);
  8527. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_4);
  8528. return vue.openBlock(), vue.createElementBlock("view", { class: "contaier" }, [
  8529. vue.createElementVNode("view", { class: "top-bg" }, [
  8530. vue.createElementVNode("image", {
  8531. class: "logo-icon",
  8532. src: "/static/logo.png"
  8533. })
  8534. ]),
  8535. vue.createElementVNode("view", { class: "input-box padding-lr" }, [
  8536. vue.createVNode(_component_uni_forms, {
  8537. ref: "valiForm",
  8538. rules: $data.rules,
  8539. modelValue: $data.valiFormData
  8540. }, {
  8541. default: vue.withCtx(() => [
  8542. vue.createElementVNode("view", { class: "cu-form-group margin-top" }, [
  8543. vue.createVNode(_component_uni_icons, {
  8544. class: "uni-icon",
  8545. type: "person",
  8546. size: "30",
  8547. color: "#999"
  8548. }),
  8549. vue.createVNode(_component_uni_easyinput, {
  8550. placeholder: "Account",
  8551. modelValue: $data.valiFormData.account,
  8552. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.valiFormData.account = $event)
  8553. }, null, 8, ["modelValue"])
  8554. ]),
  8555. vue.createElementVNode("view", { class: "cu-form-group" }, [
  8556. vue.createVNode(_component_uni_icons, {
  8557. class: "uni-icon",
  8558. type: "locked",
  8559. size: "30",
  8560. color: "#999"
  8561. }),
  8562. vue.createVNode(_component_uni_easyinput, {
  8563. placeholder: "Password",
  8564. type: "password",
  8565. modelValue: $data.valiFormData.password,
  8566. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.valiFormData.password = $event)
  8567. }, null, 8, ["modelValue"])
  8568. ]),
  8569. vue.createElementVNode("view", { class: "cu-form-group solid-bottom" }, [
  8570. vue.createVNode(_component_uni_icons, {
  8571. class: "uni-icon",
  8572. type: "more-filled",
  8573. size: "30",
  8574. color: "#999"
  8575. }),
  8576. vue.createVNode(_component_uni_easyinput, {
  8577. placeholder: "Captcha",
  8578. modelValue: $data.valiFormData.captcha,
  8579. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.valiFormData.captcha = $event)
  8580. }, null, 8, ["modelValue"]),
  8581. vue.createCommentVNode(" <button class='cu-btn bg-login-zl shadow'>验证码</button> "),
  8582. vue.createElementVNode("image", {
  8583. class: "cu-btn captchaImg",
  8584. src: $data.verifyCodeImg,
  8585. onClick: _cache[3] || (_cache[3] = (...args) => $options.getVerifyCodeImg && $options.getVerifyCodeImg(...args))
  8586. }, null, 8, ["src"])
  8587. ])
  8588. ]),
  8589. _: 1
  8590. /* STABLE */
  8591. }, 8, ["rules", "modelValue"])
  8592. ]),
  8593. vue.createElementVNode("view", { class: "padding-lr margin-top-xs" }, [
  8594. vue.createElementVNode("button", {
  8595. class: "cu-btn block round bg-login-zl margin-tb-sm lg",
  8596. onClick: _cache[4] || (_cache[4] = ($event) => $options.formSubmit("valiForm"))
  8597. }, "立即登录")
  8598. ]),
  8599. vue.createVNode(
  8600. _component_uni_popup,
  8601. {
  8602. ref: "message",
  8603. type: "message"
  8604. },
  8605. {
  8606. default: vue.withCtx(() => [
  8607. vue.createVNode(_component_uni_popup_message, {
  8608. type: "error",
  8609. message: $data.messageText,
  8610. duration: 2e3
  8611. }, null, 8, ["message"])
  8612. ]),
  8613. _: 1
  8614. /* STABLE */
  8615. },
  8616. 512
  8617. /* NEED_PATCH */
  8618. )
  8619. ]);
  8620. }
  8621. const PagesLoginIndex = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__scopeId", "data-v-d08ef7d4"], ["__file", "E:/HBuilderProjects/yta/pages/login/index.vue"]]);
  8622. __definePage("pages/scan/index", PagesScanIndex);
  8623. __definePage("pages/instock/index", PagesInstockIndex);
  8624. __definePage("pages/profile/index", PagesProfileIndex);
  8625. __definePage("pages/login/index", PagesLoginIndex);
  8626. const _sfc_main = {
  8627. onLaunch: function() {
  8628. formatAppLog("log", "at App.vue:4", "App Launch");
  8629. },
  8630. onShow: function() {
  8631. formatAppLog("log", "at App.vue:7", "App Show");
  8632. },
  8633. onHide: function() {
  8634. formatAppLog("log", "at App.vue:10", "App Hide");
  8635. }
  8636. };
  8637. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "E:/HBuilderProjects/yta/App.vue"]]);
  8638. function createApp() {
  8639. const app = vue.createVueApp(App);
  8640. return {
  8641. app
  8642. };
  8643. }
  8644. const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
  8645. uni.Vuex = __Vuex__;
  8646. uni.Pinia = __Pinia__;
  8647. __app__.provide("__globalStyles", __uniConfig.styles);
  8648. __app__._component.mpType = "app";
  8649. __app__._component.render = () => {
  8650. };
  8651. __app__.mount("#app");
  8652. })(Vue);