app-service.js 540 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717
  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. const _export_sfc = (sfc, props) => {
  35. const target = sfc.__vccOpts || sfc;
  36. for (const [key, val] of props) {
  37. target[key] = val;
  38. }
  39. return target;
  40. };
  41. const _sfc_main$D = {
  42. name: "UniGridItem",
  43. inject: ["grid"],
  44. props: {
  45. index: {
  46. type: Number,
  47. default: 0
  48. }
  49. },
  50. data() {
  51. return {
  52. column: 0,
  53. showBorder: true,
  54. square: true,
  55. highlight: true,
  56. left: 0,
  57. top: 0,
  58. openNum: 2,
  59. width: 0,
  60. borderColor: "#e5e5e5"
  61. };
  62. },
  63. created() {
  64. this.column = this.grid.column;
  65. this.showBorder = this.grid.showBorder;
  66. this.square = this.grid.square;
  67. this.highlight = this.grid.highlight;
  68. this.top = this.hor === 0 ? this.grid.hor : this.hor;
  69. this.left = this.ver === 0 ? this.grid.ver : this.ver;
  70. this.borderColor = this.grid.borderColor;
  71. this.grid.children.push(this);
  72. this.width = this.grid.width;
  73. },
  74. beforeDestroy() {
  75. this.grid.children.forEach((item, index) => {
  76. if (item === this) {
  77. this.grid.children.splice(index, 1);
  78. }
  79. });
  80. },
  81. methods: {
  82. _onClick() {
  83. this.grid.change({
  84. detail: {
  85. index: this.index
  86. }
  87. });
  88. }
  89. }
  90. };
  91. function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
  92. return $data.width ? (vue.openBlock(), vue.createElementBlock(
  93. "view",
  94. {
  95. key: 0,
  96. style: vue.normalizeStyle("width:" + $data.width + ";" + ($data.square ? "height:" + $data.width : "")),
  97. class: "uni-grid-item"
  98. },
  99. [
  100. vue.createElementVNode(
  101. "view",
  102. {
  103. class: vue.normalizeClass([{ "uni-grid-item--border": $data.showBorder, "uni-grid-item--border-top": $data.showBorder && $props.index < $data.column, "uni-highlight": $data.highlight }, "uni-grid-item__box"]),
  104. style: vue.normalizeStyle({ "border-right-color": $data.borderColor, "border-bottom-color": $data.borderColor, "border-top-color": $data.borderColor }),
  105. onClick: _cache[0] || (_cache[0] = (...args) => $options._onClick && $options._onClick(...args))
  106. },
  107. [
  108. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  109. ],
  110. 6
  111. /* CLASS, STYLE */
  112. )
  113. ],
  114. 4
  115. /* STYLE */
  116. )) : vue.createCommentVNode("v-if", true);
  117. }
  118. const __easycom_0$7 = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$C], ["__scopeId", "data-v-7a807eb7"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue"]]);
  119. const ON_SHOW = "onShow";
  120. const ON_HIDE = "onHide";
  121. const ON_LOAD = "onLoad";
  122. const ON_UNLOAD = "onUnload";
  123. const ON_BACK_PRESS = "onBackPress";
  124. const ON_NAVIGATION_BAR_BUTTON_TAP = "onNavigationBarButtonTap";
  125. function formatAppLog(type, filename, ...args) {
  126. if (uni.__log__) {
  127. uni.__log__(type, filename, ...args);
  128. } else {
  129. console[type].apply(console, [...args, filename]);
  130. }
  131. }
  132. function resolveEasycom(component, easycom) {
  133. return typeof component === "string" ? easycom : component;
  134. }
  135. const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => {
  136. !vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
  137. };
  138. const onShow = /* @__PURE__ */ createHook(ON_SHOW);
  139. const onHide = /* @__PURE__ */ createHook(ON_HIDE);
  140. const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
  141. const onUnload = /* @__PURE__ */ createHook(ON_UNLOAD);
  142. const onBackPress = /* @__PURE__ */ createHook(ON_BACK_PRESS);
  143. const onNavigationBarButtonTap = /* @__PURE__ */ createHook(ON_NAVIGATION_BAR_BUTTON_TAP);
  144. const _sfc_main$C = {
  145. name: "UniGrid",
  146. emits: ["change"],
  147. props: {
  148. // 每列显示个数
  149. column: {
  150. type: Number,
  151. default: 3
  152. },
  153. // 是否显示边框
  154. showBorder: {
  155. type: Boolean,
  156. default: true
  157. },
  158. // 边框颜色
  159. borderColor: {
  160. type: String,
  161. default: "#D2D2D2"
  162. },
  163. // 是否正方形显示,默认为 true
  164. square: {
  165. type: Boolean,
  166. default: true
  167. },
  168. highlight: {
  169. type: Boolean,
  170. default: true
  171. }
  172. },
  173. provide() {
  174. return {
  175. grid: this
  176. };
  177. },
  178. data() {
  179. const elId = `Uni_${Math.ceil(Math.random() * 1e6).toString(36)}`;
  180. return {
  181. elId,
  182. width: 0
  183. };
  184. },
  185. created() {
  186. this.children = [];
  187. },
  188. mounted() {
  189. this.$nextTick(() => {
  190. this.init();
  191. });
  192. },
  193. methods: {
  194. init() {
  195. setTimeout(() => {
  196. this._getSize((width) => {
  197. this.children.forEach((item, index) => {
  198. item.width = width;
  199. });
  200. });
  201. }, 50);
  202. },
  203. change(e2) {
  204. this.$emit("change", e2);
  205. },
  206. _getSize(fn) {
  207. uni.createSelectorQuery().in(this).select(`#${this.elId}`).boundingClientRect().exec((ret) => {
  208. this.width = parseInt((ret[0].width - 1) / this.column) + "px";
  209. fn(this.width);
  210. });
  211. }
  212. }
  213. };
  214. function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
  215. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-grid-wrap" }, [
  216. vue.createElementVNode("view", {
  217. id: $data.elId,
  218. ref: "uni-grid",
  219. class: vue.normalizeClass(["uni-grid", { "uni-grid--border": $props.showBorder }]),
  220. style: vue.normalizeStyle({ "border-left-color": $props.borderColor })
  221. }, [
  222. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  223. ], 14, ["id"])
  224. ]);
  225. }
  226. const __easycom_1$2 = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$B], ["__scopeId", "data-v-07acefee"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-grid/components/uni-grid/uni-grid.vue"]]);
  227. const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
  228. __name: "index",
  229. setup(__props, { expose: __expose }) {
  230. __expose();
  231. const token = vue.ref(null);
  232. const user = vue.ref(null);
  233. const list = vue.ref([
  234. // {
  235. // url: '/pages/scan/index',
  236. // src: '/static/scan_fill.png',
  237. // text: '扫描入库'
  238. // },
  239. {
  240. url: "/pages/instock/index",
  241. src: "/static/weigh_fill.png",
  242. text: "称重"
  243. },
  244. {
  245. url: "/pages/warehouseScan/index",
  246. src: "/static/houscan.png",
  247. text: "仓库扫描"
  248. },
  249. {
  250. url: "/pages/printer/index",
  251. src: "/static/houscan.png",
  252. text: "打印"
  253. },
  254. {
  255. url: "/pages/scanLotno/index",
  256. src: "/static/link.png",
  257. text: "托盘/批次"
  258. },
  259. {
  260. url: "/pages/waybillNo/index",
  261. src: "/static/link.png",
  262. text: "库位绑定"
  263. },
  264. {
  265. url: "/pages/waybillDeliveryOrder/index",
  266. src: "/static/dispatch.png",
  267. text: "派送单"
  268. }
  269. ]);
  270. onShow(() => {
  271. token.value = uni.getStorageSync("token");
  272. user.value = uni.getStorageSync("user");
  273. formatAppLog("log", "at pages/home/index.vue:60", "show---", { token: token.value, user: user.value });
  274. });
  275. const itemClick = (url) => {
  276. formatAppLog("log", "at pages/home/index.vue:63", url);
  277. if (token.value) {
  278. uni.navigateTo({
  279. url
  280. });
  281. } else {
  282. uni.navigateTo({
  283. url: "/pages/login/index"
  284. });
  285. }
  286. };
  287. const change = () => {
  288. };
  289. const logout = () => {
  290. uni.removeStorageSync("token");
  291. uni.removeStorageSync("user");
  292. token.value = uni.getStorageSync("token");
  293. user.value = uni.getStorageSync("user");
  294. };
  295. const __returned__ = { token, user, list, itemClick, change, logout };
  296. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  297. return __returned__;
  298. }
  299. });
  300. function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
  301. const _component_uni_grid_item = resolveEasycom(vue.resolveDynamicComponent("uni-grid-item"), __easycom_0$7);
  302. const _component_uni_grid = resolveEasycom(vue.resolveDynamicComponent("uni-grid"), __easycom_1$2);
  303. return vue.openBlock(), vue.createElementBlock("view", { class: "warp" }, [
  304. vue.createVNode(_component_uni_grid, {
  305. class: "grid",
  306. column: 3,
  307. "show-border": false,
  308. square: false,
  309. onChange: $setup.change
  310. }, {
  311. default: vue.withCtx(() => [
  312. (vue.openBlock(true), vue.createElementBlock(
  313. vue.Fragment,
  314. null,
  315. vue.renderList($setup.list, (item, index) => {
  316. return vue.openBlock(), vue.createBlock(_component_uni_grid_item, {
  317. index,
  318. key: index
  319. }, {
  320. default: vue.withCtx(() => [
  321. vue.createElementVNode("view", {
  322. class: "grid-item-box",
  323. onClick: ($event) => $setup.itemClick(item.url)
  324. }, [
  325. vue.createElementVNode("image", {
  326. class: "image",
  327. src: item.src,
  328. mode: "aspectFill"
  329. }, null, 8, ["src"]),
  330. vue.createElementVNode(
  331. "text",
  332. { class: "text" },
  333. vue.toDisplayString(item.text),
  334. 1
  335. /* TEXT */
  336. )
  337. ], 8, ["onClick"])
  338. ]),
  339. _: 2
  340. /* DYNAMIC */
  341. }, 1032, ["index"]);
  342. }),
  343. 128
  344. /* KEYED_FRAGMENT */
  345. ))
  346. ]),
  347. _: 1
  348. /* STABLE */
  349. })
  350. ]);
  351. }
  352. const PagesHomeIndex = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$A], ["__file", "E:/HBuilderProjects/YTAPP/pages/home/index.vue"]]);
  353. const fontData = [
  354. {
  355. "font_class": "arrow-down",
  356. "unicode": ""
  357. },
  358. {
  359. "font_class": "arrow-left",
  360. "unicode": ""
  361. },
  362. {
  363. "font_class": "arrow-right",
  364. "unicode": ""
  365. },
  366. {
  367. "font_class": "arrow-up",
  368. "unicode": ""
  369. },
  370. {
  371. "font_class": "auth",
  372. "unicode": ""
  373. },
  374. {
  375. "font_class": "auth-filled",
  376. "unicode": ""
  377. },
  378. {
  379. "font_class": "back",
  380. "unicode": ""
  381. },
  382. {
  383. "font_class": "bars",
  384. "unicode": ""
  385. },
  386. {
  387. "font_class": "calendar",
  388. "unicode": ""
  389. },
  390. {
  391. "font_class": "calendar-filled",
  392. "unicode": ""
  393. },
  394. {
  395. "font_class": "camera",
  396. "unicode": ""
  397. },
  398. {
  399. "font_class": "camera-filled",
  400. "unicode": ""
  401. },
  402. {
  403. "font_class": "cart",
  404. "unicode": ""
  405. },
  406. {
  407. "font_class": "cart-filled",
  408. "unicode": ""
  409. },
  410. {
  411. "font_class": "chat",
  412. "unicode": ""
  413. },
  414. {
  415. "font_class": "chat-filled",
  416. "unicode": ""
  417. },
  418. {
  419. "font_class": "chatboxes",
  420. "unicode": ""
  421. },
  422. {
  423. "font_class": "chatboxes-filled",
  424. "unicode": ""
  425. },
  426. {
  427. "font_class": "chatbubble",
  428. "unicode": ""
  429. },
  430. {
  431. "font_class": "chatbubble-filled",
  432. "unicode": ""
  433. },
  434. {
  435. "font_class": "checkbox",
  436. "unicode": ""
  437. },
  438. {
  439. "font_class": "checkbox-filled",
  440. "unicode": ""
  441. },
  442. {
  443. "font_class": "checkmarkempty",
  444. "unicode": ""
  445. },
  446. {
  447. "font_class": "circle",
  448. "unicode": ""
  449. },
  450. {
  451. "font_class": "circle-filled",
  452. "unicode": ""
  453. },
  454. {
  455. "font_class": "clear",
  456. "unicode": ""
  457. },
  458. {
  459. "font_class": "close",
  460. "unicode": ""
  461. },
  462. {
  463. "font_class": "closeempty",
  464. "unicode": ""
  465. },
  466. {
  467. "font_class": "cloud-download",
  468. "unicode": ""
  469. },
  470. {
  471. "font_class": "cloud-download-filled",
  472. "unicode": ""
  473. },
  474. {
  475. "font_class": "cloud-upload",
  476. "unicode": ""
  477. },
  478. {
  479. "font_class": "cloud-upload-filled",
  480. "unicode": ""
  481. },
  482. {
  483. "font_class": "color",
  484. "unicode": ""
  485. },
  486. {
  487. "font_class": "color-filled",
  488. "unicode": ""
  489. },
  490. {
  491. "font_class": "compose",
  492. "unicode": ""
  493. },
  494. {
  495. "font_class": "contact",
  496. "unicode": ""
  497. },
  498. {
  499. "font_class": "contact-filled",
  500. "unicode": ""
  501. },
  502. {
  503. "font_class": "down",
  504. "unicode": ""
  505. },
  506. {
  507. "font_class": "bottom",
  508. "unicode": ""
  509. },
  510. {
  511. "font_class": "download",
  512. "unicode": ""
  513. },
  514. {
  515. "font_class": "download-filled",
  516. "unicode": ""
  517. },
  518. {
  519. "font_class": "email",
  520. "unicode": ""
  521. },
  522. {
  523. "font_class": "email-filled",
  524. "unicode": ""
  525. },
  526. {
  527. "font_class": "eye",
  528. "unicode": ""
  529. },
  530. {
  531. "font_class": "eye-filled",
  532. "unicode": ""
  533. },
  534. {
  535. "font_class": "eye-slash",
  536. "unicode": ""
  537. },
  538. {
  539. "font_class": "eye-slash-filled",
  540. "unicode": ""
  541. },
  542. {
  543. "font_class": "fire",
  544. "unicode": ""
  545. },
  546. {
  547. "font_class": "fire-filled",
  548. "unicode": ""
  549. },
  550. {
  551. "font_class": "flag",
  552. "unicode": ""
  553. },
  554. {
  555. "font_class": "flag-filled",
  556. "unicode": ""
  557. },
  558. {
  559. "font_class": "folder-add",
  560. "unicode": ""
  561. },
  562. {
  563. "font_class": "folder-add-filled",
  564. "unicode": ""
  565. },
  566. {
  567. "font_class": "font",
  568. "unicode": ""
  569. },
  570. {
  571. "font_class": "forward",
  572. "unicode": ""
  573. },
  574. {
  575. "font_class": "gear",
  576. "unicode": ""
  577. },
  578. {
  579. "font_class": "gear-filled",
  580. "unicode": ""
  581. },
  582. {
  583. "font_class": "gift",
  584. "unicode": ""
  585. },
  586. {
  587. "font_class": "gift-filled",
  588. "unicode": ""
  589. },
  590. {
  591. "font_class": "hand-down",
  592. "unicode": ""
  593. },
  594. {
  595. "font_class": "hand-down-filled",
  596. "unicode": ""
  597. },
  598. {
  599. "font_class": "hand-up",
  600. "unicode": ""
  601. },
  602. {
  603. "font_class": "hand-up-filled",
  604. "unicode": ""
  605. },
  606. {
  607. "font_class": "headphones",
  608. "unicode": ""
  609. },
  610. {
  611. "font_class": "heart",
  612. "unicode": ""
  613. },
  614. {
  615. "font_class": "heart-filled",
  616. "unicode": ""
  617. },
  618. {
  619. "font_class": "help",
  620. "unicode": ""
  621. },
  622. {
  623. "font_class": "help-filled",
  624. "unicode": ""
  625. },
  626. {
  627. "font_class": "home",
  628. "unicode": ""
  629. },
  630. {
  631. "font_class": "home-filled",
  632. "unicode": ""
  633. },
  634. {
  635. "font_class": "image",
  636. "unicode": ""
  637. },
  638. {
  639. "font_class": "image-filled",
  640. "unicode": ""
  641. },
  642. {
  643. "font_class": "images",
  644. "unicode": ""
  645. },
  646. {
  647. "font_class": "images-filled",
  648. "unicode": ""
  649. },
  650. {
  651. "font_class": "info",
  652. "unicode": ""
  653. },
  654. {
  655. "font_class": "info-filled",
  656. "unicode": ""
  657. },
  658. {
  659. "font_class": "left",
  660. "unicode": ""
  661. },
  662. {
  663. "font_class": "link",
  664. "unicode": ""
  665. },
  666. {
  667. "font_class": "list",
  668. "unicode": ""
  669. },
  670. {
  671. "font_class": "location",
  672. "unicode": ""
  673. },
  674. {
  675. "font_class": "location-filled",
  676. "unicode": ""
  677. },
  678. {
  679. "font_class": "locked",
  680. "unicode": ""
  681. },
  682. {
  683. "font_class": "locked-filled",
  684. "unicode": ""
  685. },
  686. {
  687. "font_class": "loop",
  688. "unicode": ""
  689. },
  690. {
  691. "font_class": "mail-open",
  692. "unicode": ""
  693. },
  694. {
  695. "font_class": "mail-open-filled",
  696. "unicode": ""
  697. },
  698. {
  699. "font_class": "map",
  700. "unicode": ""
  701. },
  702. {
  703. "font_class": "map-filled",
  704. "unicode": ""
  705. },
  706. {
  707. "font_class": "map-pin",
  708. "unicode": ""
  709. },
  710. {
  711. "font_class": "map-pin-ellipse",
  712. "unicode": ""
  713. },
  714. {
  715. "font_class": "medal",
  716. "unicode": ""
  717. },
  718. {
  719. "font_class": "medal-filled",
  720. "unicode": ""
  721. },
  722. {
  723. "font_class": "mic",
  724. "unicode": ""
  725. },
  726. {
  727. "font_class": "mic-filled",
  728. "unicode": ""
  729. },
  730. {
  731. "font_class": "micoff",
  732. "unicode": ""
  733. },
  734. {
  735. "font_class": "micoff-filled",
  736. "unicode": ""
  737. },
  738. {
  739. "font_class": "minus",
  740. "unicode": ""
  741. },
  742. {
  743. "font_class": "minus-filled",
  744. "unicode": ""
  745. },
  746. {
  747. "font_class": "more",
  748. "unicode": ""
  749. },
  750. {
  751. "font_class": "more-filled",
  752. "unicode": ""
  753. },
  754. {
  755. "font_class": "navigate",
  756. "unicode": ""
  757. },
  758. {
  759. "font_class": "navigate-filled",
  760. "unicode": ""
  761. },
  762. {
  763. "font_class": "notification",
  764. "unicode": ""
  765. },
  766. {
  767. "font_class": "notification-filled",
  768. "unicode": ""
  769. },
  770. {
  771. "font_class": "paperclip",
  772. "unicode": ""
  773. },
  774. {
  775. "font_class": "paperplane",
  776. "unicode": ""
  777. },
  778. {
  779. "font_class": "paperplane-filled",
  780. "unicode": ""
  781. },
  782. {
  783. "font_class": "person",
  784. "unicode": ""
  785. },
  786. {
  787. "font_class": "person-filled",
  788. "unicode": ""
  789. },
  790. {
  791. "font_class": "personadd",
  792. "unicode": ""
  793. },
  794. {
  795. "font_class": "personadd-filled",
  796. "unicode": ""
  797. },
  798. {
  799. "font_class": "personadd-filled-copy",
  800. "unicode": ""
  801. },
  802. {
  803. "font_class": "phone",
  804. "unicode": ""
  805. },
  806. {
  807. "font_class": "phone-filled",
  808. "unicode": ""
  809. },
  810. {
  811. "font_class": "plus",
  812. "unicode": ""
  813. },
  814. {
  815. "font_class": "plus-filled",
  816. "unicode": ""
  817. },
  818. {
  819. "font_class": "plusempty",
  820. "unicode": ""
  821. },
  822. {
  823. "font_class": "pulldown",
  824. "unicode": ""
  825. },
  826. {
  827. "font_class": "pyq",
  828. "unicode": ""
  829. },
  830. {
  831. "font_class": "qq",
  832. "unicode": ""
  833. },
  834. {
  835. "font_class": "redo",
  836. "unicode": ""
  837. },
  838. {
  839. "font_class": "redo-filled",
  840. "unicode": ""
  841. },
  842. {
  843. "font_class": "refresh",
  844. "unicode": ""
  845. },
  846. {
  847. "font_class": "refresh-filled",
  848. "unicode": ""
  849. },
  850. {
  851. "font_class": "refreshempty",
  852. "unicode": ""
  853. },
  854. {
  855. "font_class": "reload",
  856. "unicode": ""
  857. },
  858. {
  859. "font_class": "right",
  860. "unicode": ""
  861. },
  862. {
  863. "font_class": "scan",
  864. "unicode": ""
  865. },
  866. {
  867. "font_class": "search",
  868. "unicode": ""
  869. },
  870. {
  871. "font_class": "settings",
  872. "unicode": ""
  873. },
  874. {
  875. "font_class": "settings-filled",
  876. "unicode": ""
  877. },
  878. {
  879. "font_class": "shop",
  880. "unicode": ""
  881. },
  882. {
  883. "font_class": "shop-filled",
  884. "unicode": ""
  885. },
  886. {
  887. "font_class": "smallcircle",
  888. "unicode": ""
  889. },
  890. {
  891. "font_class": "smallcircle-filled",
  892. "unicode": ""
  893. },
  894. {
  895. "font_class": "sound",
  896. "unicode": ""
  897. },
  898. {
  899. "font_class": "sound-filled",
  900. "unicode": ""
  901. },
  902. {
  903. "font_class": "spinner-cycle",
  904. "unicode": ""
  905. },
  906. {
  907. "font_class": "staff",
  908. "unicode": ""
  909. },
  910. {
  911. "font_class": "staff-filled",
  912. "unicode": ""
  913. },
  914. {
  915. "font_class": "star",
  916. "unicode": ""
  917. },
  918. {
  919. "font_class": "star-filled",
  920. "unicode": ""
  921. },
  922. {
  923. "font_class": "starhalf",
  924. "unicode": ""
  925. },
  926. {
  927. "font_class": "trash",
  928. "unicode": ""
  929. },
  930. {
  931. "font_class": "trash-filled",
  932. "unicode": ""
  933. },
  934. {
  935. "font_class": "tune",
  936. "unicode": ""
  937. },
  938. {
  939. "font_class": "tune-filled",
  940. "unicode": ""
  941. },
  942. {
  943. "font_class": "undo",
  944. "unicode": ""
  945. },
  946. {
  947. "font_class": "undo-filled",
  948. "unicode": ""
  949. },
  950. {
  951. "font_class": "up",
  952. "unicode": ""
  953. },
  954. {
  955. "font_class": "top",
  956. "unicode": ""
  957. },
  958. {
  959. "font_class": "upload",
  960. "unicode": ""
  961. },
  962. {
  963. "font_class": "upload-filled",
  964. "unicode": ""
  965. },
  966. {
  967. "font_class": "videocam",
  968. "unicode": ""
  969. },
  970. {
  971. "font_class": "videocam-filled",
  972. "unicode": ""
  973. },
  974. {
  975. "font_class": "vip",
  976. "unicode": ""
  977. },
  978. {
  979. "font_class": "vip-filled",
  980. "unicode": ""
  981. },
  982. {
  983. "font_class": "wallet",
  984. "unicode": ""
  985. },
  986. {
  987. "font_class": "wallet-filled",
  988. "unicode": ""
  989. },
  990. {
  991. "font_class": "weibo",
  992. "unicode": ""
  993. },
  994. {
  995. "font_class": "weixin",
  996. "unicode": ""
  997. }
  998. ];
  999. const getVal = (val) => {
  1000. const reg = /^[0-9]*$/g;
  1001. return typeof val === "number" || reg.test(val) ? val + "px" : val;
  1002. };
  1003. const _sfc_main$A = {
  1004. name: "UniIcons",
  1005. emits: ["click"],
  1006. props: {
  1007. type: {
  1008. type: String,
  1009. default: ""
  1010. },
  1011. color: {
  1012. type: String,
  1013. default: "#333333"
  1014. },
  1015. size: {
  1016. type: [Number, String],
  1017. default: 16
  1018. },
  1019. customPrefix: {
  1020. type: String,
  1021. default: ""
  1022. },
  1023. fontFamily: {
  1024. type: String,
  1025. default: ""
  1026. }
  1027. },
  1028. data() {
  1029. return {
  1030. icons: fontData
  1031. };
  1032. },
  1033. computed: {
  1034. unicode() {
  1035. let code = this.icons.find((v2) => v2.font_class === this.type);
  1036. if (code) {
  1037. return code.unicode;
  1038. }
  1039. return "";
  1040. },
  1041. iconSize() {
  1042. return getVal(this.size);
  1043. },
  1044. styleObj() {
  1045. if (this.fontFamily !== "") {
  1046. return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`;
  1047. }
  1048. return `color: ${this.color}; font-size: ${this.iconSize};`;
  1049. }
  1050. },
  1051. methods: {
  1052. _onClick() {
  1053. this.$emit("click");
  1054. }
  1055. }
  1056. };
  1057. function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
  1058. return vue.openBlock(), vue.createElementBlock(
  1059. "text",
  1060. {
  1061. style: vue.normalizeStyle($options.styleObj),
  1062. class: vue.normalizeClass(["uni-icons", ["uniui-" + $props.type, $props.customPrefix, $props.customPrefix ? $props.type : ""]]),
  1063. onClick: _cache[0] || (_cache[0] = (...args) => $options._onClick && $options._onClick(...args))
  1064. },
  1065. [
  1066. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  1067. ],
  1068. 6
  1069. /* CLASS, STYLE */
  1070. );
  1071. }
  1072. const __easycom_4 = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$z], ["__scopeId", "data-v-d31e1c47"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-icons/components/uni-icons/uni-icons.vue"]]);
  1073. function obj2strClass(obj) {
  1074. let classess = "";
  1075. for (let key in obj) {
  1076. const val = obj[key];
  1077. if (val) {
  1078. classess += `${key} `;
  1079. }
  1080. }
  1081. return classess;
  1082. }
  1083. function obj2strStyle(obj) {
  1084. let style = "";
  1085. for (let key in obj) {
  1086. const val = obj[key];
  1087. style += `${key}:${val};`;
  1088. }
  1089. return style;
  1090. }
  1091. const _sfc_main$z = {
  1092. name: "uni-easyinput",
  1093. emits: ["click", "iconClick", "update:modelValue", "input", "focus", "blur", "confirm", "clear", "eyes", "change", "keyboardheightchange"],
  1094. model: {
  1095. prop: "modelValue",
  1096. event: "update:modelValue"
  1097. },
  1098. options: {
  1099. virtualHost: true
  1100. },
  1101. inject: {
  1102. form: {
  1103. from: "uniForm",
  1104. default: null
  1105. },
  1106. formItem: {
  1107. from: "uniFormItem",
  1108. default: null
  1109. }
  1110. },
  1111. props: {
  1112. name: String,
  1113. value: [Number, String],
  1114. modelValue: [Number, String],
  1115. type: {
  1116. type: String,
  1117. default: "text"
  1118. },
  1119. clearable: {
  1120. type: Boolean,
  1121. default: true
  1122. },
  1123. autoHeight: {
  1124. type: Boolean,
  1125. default: false
  1126. },
  1127. placeholder: {
  1128. type: String,
  1129. default: " "
  1130. },
  1131. placeholderStyle: String,
  1132. focus: {
  1133. type: Boolean,
  1134. default: false
  1135. },
  1136. disabled: {
  1137. type: Boolean,
  1138. default: false
  1139. },
  1140. maxlength: {
  1141. type: [Number, String],
  1142. default: 140
  1143. },
  1144. confirmType: {
  1145. type: String,
  1146. default: "done"
  1147. },
  1148. clearSize: {
  1149. type: [Number, String],
  1150. default: 24
  1151. },
  1152. inputBorder: {
  1153. type: Boolean,
  1154. default: true
  1155. },
  1156. prefixIcon: {
  1157. type: String,
  1158. default: ""
  1159. },
  1160. suffixIcon: {
  1161. type: String,
  1162. default: ""
  1163. },
  1164. trim: {
  1165. type: [Boolean, String],
  1166. default: false
  1167. },
  1168. cursorSpacing: {
  1169. type: Number,
  1170. default: 0
  1171. },
  1172. passwordIcon: {
  1173. type: Boolean,
  1174. default: true
  1175. },
  1176. primaryColor: {
  1177. type: String,
  1178. default: "#2979ff"
  1179. },
  1180. styles: {
  1181. type: Object,
  1182. default() {
  1183. return {
  1184. color: "#333",
  1185. backgroundColor: "#fff",
  1186. disableColor: "#F7F6F6",
  1187. borderColor: "#e5e5e5"
  1188. };
  1189. }
  1190. },
  1191. errorMessage: {
  1192. type: [String, Boolean],
  1193. default: ""
  1194. }
  1195. },
  1196. data() {
  1197. return {
  1198. focused: false,
  1199. val: "",
  1200. showMsg: "",
  1201. border: false,
  1202. isFirstBorder: false,
  1203. showClearIcon: false,
  1204. showPassword: false,
  1205. focusShow: false,
  1206. localMsg: "",
  1207. isEnter: false
  1208. // 用于判断当前是否是使用回车操作
  1209. };
  1210. },
  1211. computed: {
  1212. // 输入框内是否有值
  1213. isVal() {
  1214. const val = this.val;
  1215. if (val || val === 0) {
  1216. return true;
  1217. }
  1218. return false;
  1219. },
  1220. msg() {
  1221. return this.localMsg || this.errorMessage;
  1222. },
  1223. // 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
  1224. inputMaxlength() {
  1225. return Number(this.maxlength);
  1226. },
  1227. // 处理外层样式的style
  1228. boxStyle() {
  1229. return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`;
  1230. },
  1231. // input 内容的类和样式处理
  1232. inputContentClass() {
  1233. return obj2strClass({
  1234. "is-input-border": this.inputBorder,
  1235. "is-input-error-border": this.inputBorder && this.msg,
  1236. "is-textarea": this.type === "textarea",
  1237. "is-disabled": this.disabled,
  1238. "is-focused": this.focusShow
  1239. });
  1240. },
  1241. inputContentStyle() {
  1242. const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor;
  1243. const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor;
  1244. return obj2strStyle({
  1245. "border-color": borderColor || "#e5e5e5",
  1246. "background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor
  1247. });
  1248. },
  1249. // input右侧样式
  1250. inputStyle() {
  1251. const paddingRight = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px";
  1252. return obj2strStyle({
  1253. "padding-right": paddingRight,
  1254. "padding-left": this.prefixIcon ? "" : "10px"
  1255. });
  1256. }
  1257. },
  1258. watch: {
  1259. value(newVal) {
  1260. this.val = newVal;
  1261. },
  1262. modelValue(newVal) {
  1263. this.val = newVal;
  1264. },
  1265. focus(newVal) {
  1266. this.$nextTick(() => {
  1267. this.focused = this.focus;
  1268. this.focusShow = this.focus;
  1269. });
  1270. }
  1271. },
  1272. created() {
  1273. this.init();
  1274. if (this.form && this.formItem) {
  1275. this.$watch("formItem.errMsg", (newVal) => {
  1276. this.localMsg = newVal;
  1277. });
  1278. }
  1279. },
  1280. mounted() {
  1281. this.$nextTick(() => {
  1282. this.focused = this.focus;
  1283. this.focusShow = this.focus;
  1284. });
  1285. },
  1286. methods: {
  1287. /**
  1288. * 初始化变量值
  1289. */
  1290. init() {
  1291. if (this.value || this.value === 0) {
  1292. this.val = this.value;
  1293. } else if (this.modelValue || this.modelValue === 0 || this.modelValue === "") {
  1294. this.val = this.modelValue;
  1295. } else {
  1296. this.val = null;
  1297. }
  1298. },
  1299. /**
  1300. * 点击图标时触发
  1301. * @param {Object} type
  1302. */
  1303. onClickIcon(type) {
  1304. this.$emit("iconClick", type);
  1305. },
  1306. /**
  1307. * 显示隐藏内容,密码框时生效
  1308. */
  1309. onEyes() {
  1310. this.showPassword = !this.showPassword;
  1311. this.$emit("eyes", this.showPassword);
  1312. },
  1313. /**
  1314. * 输入时触发
  1315. * @param {Object} event
  1316. */
  1317. onInput(event) {
  1318. let value = event.detail.value;
  1319. if (this.trim) {
  1320. if (typeof this.trim === "boolean" && this.trim) {
  1321. value = this.trimStr(value);
  1322. }
  1323. if (typeof this.trim === "string") {
  1324. value = this.trimStr(value, this.trim);
  1325. }
  1326. }
  1327. if (this.errMsg)
  1328. this.errMsg = "";
  1329. this.val = value;
  1330. this.$emit("input", value);
  1331. this.$emit("update:modelValue", value);
  1332. },
  1333. /**
  1334. * 外部调用方法
  1335. * 获取焦点时触发
  1336. * @param {Object} event
  1337. */
  1338. onFocus() {
  1339. this.$nextTick(() => {
  1340. this.focused = true;
  1341. });
  1342. this.$emit("focus", null);
  1343. },
  1344. _Focus(event) {
  1345. this.focusShow = true;
  1346. this.$emit("focus", event);
  1347. },
  1348. /**
  1349. * 外部调用方法
  1350. * 失去焦点时触发
  1351. * @param {Object} event
  1352. */
  1353. onBlur() {
  1354. this.focused = false;
  1355. this.$emit("focus", null);
  1356. },
  1357. _Blur(event) {
  1358. event.detail.value;
  1359. this.focusShow = false;
  1360. this.$emit("blur", event);
  1361. if (this.isEnter === false) {
  1362. this.$emit("change", this.val);
  1363. }
  1364. if (this.form && this.formItem) {
  1365. const { validateTrigger } = this.form;
  1366. if (validateTrigger === "blur") {
  1367. this.formItem.onFieldChange();
  1368. }
  1369. }
  1370. },
  1371. /**
  1372. * 按下键盘的发送键
  1373. * @param {Object} e
  1374. */
  1375. onConfirm(e2) {
  1376. this.$emit("confirm", this.val);
  1377. this.isEnter = true;
  1378. this.$emit("change", this.val);
  1379. this.$nextTick(() => {
  1380. this.isEnter = false;
  1381. });
  1382. },
  1383. /**
  1384. * 清理内容
  1385. * @param {Object} event
  1386. */
  1387. onClear(event) {
  1388. this.val = "";
  1389. this.$emit("input", "");
  1390. this.$emit("update:modelValue", "");
  1391. this.$emit("clear");
  1392. },
  1393. /**
  1394. * 键盘高度发生变化的时候触发此事件
  1395. * 兼容性:微信小程序2.7.0+、App 3.1.0+
  1396. * @param {Object} event
  1397. */
  1398. onkeyboardheightchange(event) {
  1399. this.$emit("keyboardheightchange", event);
  1400. },
  1401. /**
  1402. * 去除空格
  1403. */
  1404. trimStr(str, pos = "both") {
  1405. if (pos === "both") {
  1406. return str.trim();
  1407. } else if (pos === "left") {
  1408. return str.trimLeft();
  1409. } else if (pos === "right") {
  1410. return str.trimRight();
  1411. } else if (pos === "start") {
  1412. return str.trimStart();
  1413. } else if (pos === "end") {
  1414. return str.trimEnd();
  1415. } else if (pos === "all") {
  1416. return str.replace(/\s+/g, "");
  1417. } else if (pos === "none") {
  1418. return str;
  1419. }
  1420. return str;
  1421. }
  1422. }
  1423. };
  1424. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  1425. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  1426. return vue.openBlock(), vue.createElementBlock(
  1427. "view",
  1428. {
  1429. class: vue.normalizeClass(["uni-easyinput", { "uni-easyinput-error": $options.msg }]),
  1430. style: vue.normalizeStyle($options.boxStyle)
  1431. },
  1432. [
  1433. vue.createElementVNode(
  1434. "view",
  1435. {
  1436. class: vue.normalizeClass(["uni-easyinput__content", $options.inputContentClass]),
  1437. style: vue.normalizeStyle($options.inputContentStyle)
  1438. },
  1439. [
  1440. $props.prefixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  1441. key: 0,
  1442. class: "content-clear-icon",
  1443. type: $props.prefixIcon,
  1444. color: "#c0c4cc",
  1445. onClick: _cache[0] || (_cache[0] = ($event) => $options.onClickIcon("prefix")),
  1446. size: "22"
  1447. }, null, 8, ["type"])) : vue.createCommentVNode("v-if", true),
  1448. $props.type === "textarea" ? (vue.openBlock(), vue.createElementBlock("textarea", {
  1449. key: 1,
  1450. class: vue.normalizeClass(["uni-easyinput__content-textarea", { "input-padding": $props.inputBorder }]),
  1451. name: $props.name,
  1452. value: $data.val,
  1453. placeholder: $props.placeholder,
  1454. placeholderStyle: $props.placeholderStyle,
  1455. disabled: $props.disabled,
  1456. "placeholder-class": "uni-easyinput__placeholder-class",
  1457. maxlength: $options.inputMaxlength,
  1458. focus: $data.focused,
  1459. autoHeight: $props.autoHeight,
  1460. "cursor-spacing": $props.cursorSpacing,
  1461. onInput: _cache[1] || (_cache[1] = (...args) => $options.onInput && $options.onInput(...args)),
  1462. onBlur: _cache[2] || (_cache[2] = (...args) => $options._Blur && $options._Blur(...args)),
  1463. onFocus: _cache[3] || (_cache[3] = (...args) => $options._Focus && $options._Focus(...args)),
  1464. onConfirm: _cache[4] || (_cache[4] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
  1465. onKeyboardheightchange: _cache[5] || (_cache[5] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
  1466. }, null, 42, ["name", "value", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "autoHeight", "cursor-spacing"])) : (vue.openBlock(), vue.createElementBlock("input", {
  1467. key: 2,
  1468. type: $props.type === "password" ? "text" : $props.type,
  1469. class: "uni-easyinput__content-input",
  1470. style: vue.normalizeStyle($options.inputStyle),
  1471. name: $props.name,
  1472. value: $data.val,
  1473. password: !$data.showPassword && $props.type === "password",
  1474. placeholder: $props.placeholder,
  1475. placeholderStyle: $props.placeholderStyle,
  1476. "placeholder-class": "uni-easyinput__placeholder-class",
  1477. disabled: $props.disabled,
  1478. maxlength: $options.inputMaxlength,
  1479. focus: $data.focused,
  1480. confirmType: $props.confirmType,
  1481. "cursor-spacing": $props.cursorSpacing,
  1482. onFocus: _cache[6] || (_cache[6] = (...args) => $options._Focus && $options._Focus(...args)),
  1483. onBlur: _cache[7] || (_cache[7] = (...args) => $options._Blur && $options._Blur(...args)),
  1484. onInput: _cache[8] || (_cache[8] = (...args) => $options.onInput && $options.onInput(...args)),
  1485. onConfirm: _cache[9] || (_cache[9] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
  1486. onKeyboardheightchange: _cache[10] || (_cache[10] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
  1487. }, null, 44, ["type", "name", "value", "password", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "confirmType", "cursor-spacing"])),
  1488. $props.type === "password" && $props.passwordIcon ? (vue.openBlock(), vue.createElementBlock(
  1489. vue.Fragment,
  1490. { key: 3 },
  1491. [
  1492. vue.createCommentVNode(" 开启密码时显示小眼睛 "),
  1493. $options.isVal ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  1494. key: 0,
  1495. class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
  1496. type: $data.showPassword ? "eye-slash-filled" : "eye-filled",
  1497. size: 22,
  1498. color: $data.focusShow ? $props.primaryColor : "#c0c4cc",
  1499. onClick: $options.onEyes
  1500. }, null, 8, ["class", "type", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
  1501. ],
  1502. 64
  1503. /* STABLE_FRAGMENT */
  1504. )) : $props.suffixIcon ? (vue.openBlock(), vue.createElementBlock(
  1505. vue.Fragment,
  1506. { key: 4 },
  1507. [
  1508. $props.suffixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  1509. key: 0,
  1510. class: "content-clear-icon",
  1511. type: $props.suffixIcon,
  1512. color: "#c0c4cc",
  1513. onClick: _cache[11] || (_cache[11] = ($event) => $options.onClickIcon("suffix")),
  1514. size: "22"
  1515. }, null, 8, ["type"])) : vue.createCommentVNode("v-if", true)
  1516. ],
  1517. 64
  1518. /* STABLE_FRAGMENT */
  1519. )) : (vue.openBlock(), vue.createElementBlock(
  1520. vue.Fragment,
  1521. { key: 5 },
  1522. [
  1523. $props.clearable && $options.isVal && !$props.disabled && $props.type !== "textarea" ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  1524. key: 0,
  1525. class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
  1526. type: "clear",
  1527. size: $props.clearSize,
  1528. color: $options.msg ? "#dd524d" : $data.focusShow ? $props.primaryColor : "#c0c4cc",
  1529. onClick: $options.onClear
  1530. }, null, 8, ["class", "size", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
  1531. ],
  1532. 64
  1533. /* STABLE_FRAGMENT */
  1534. )),
  1535. vue.renderSlot(_ctx.$slots, "right", {}, void 0, true)
  1536. ],
  1537. 6
  1538. /* CLASS, STYLE */
  1539. )
  1540. ],
  1541. 6
  1542. /* CLASS, STYLE */
  1543. );
  1544. }
  1545. const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$y], ["__scopeId", "data-v-09fd5285"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue"]]);
  1546. const _sfc_main$y = {
  1547. name: "uniFormsItem",
  1548. options: {
  1549. virtualHost: true
  1550. },
  1551. provide() {
  1552. return {
  1553. uniFormItem: this
  1554. };
  1555. },
  1556. inject: {
  1557. form: {
  1558. from: "uniForm",
  1559. default: null
  1560. }
  1561. },
  1562. props: {
  1563. // 表单校验规则
  1564. rules: {
  1565. type: Array,
  1566. default() {
  1567. return null;
  1568. }
  1569. },
  1570. // 表单域的属性名,在使用校验规则时必填
  1571. name: {
  1572. type: [String, Array],
  1573. default: ""
  1574. },
  1575. required: {
  1576. type: Boolean,
  1577. default: false
  1578. },
  1579. label: {
  1580. type: String,
  1581. default: ""
  1582. },
  1583. // label的宽度
  1584. labelWidth: {
  1585. type: [String, Number],
  1586. default: ""
  1587. },
  1588. // label 居中方式,默认 left 取值 left/center/right
  1589. labelAlign: {
  1590. type: String,
  1591. default: ""
  1592. },
  1593. // 强制显示错误信息
  1594. errorMessage: {
  1595. type: [String, Boolean],
  1596. default: ""
  1597. },
  1598. // 1.4.0 弃用,统一使用 form 的校验时机
  1599. // validateTrigger: {
  1600. // type: String,
  1601. // default: ''
  1602. // },
  1603. // 1.4.0 弃用,统一使用 form 的label 位置
  1604. // labelPosition: {
  1605. // type: String,
  1606. // default: ''
  1607. // },
  1608. // 1.4.0 以下属性已经废弃,请使用 #label 插槽代替
  1609. leftIcon: String,
  1610. iconColor: {
  1611. type: String,
  1612. default: "#606266"
  1613. }
  1614. },
  1615. data() {
  1616. return {
  1617. errMsg: "",
  1618. userRules: null,
  1619. localLabelAlign: "left",
  1620. localLabelWidth: "70px",
  1621. localLabelPos: "left",
  1622. border: false,
  1623. isFirstBorder: false
  1624. };
  1625. },
  1626. computed: {
  1627. // 处理错误信息
  1628. msg() {
  1629. return this.errorMessage || this.errMsg;
  1630. }
  1631. },
  1632. watch: {
  1633. // 规则发生变化通知子组件更新
  1634. "form.formRules"(val) {
  1635. this.init();
  1636. },
  1637. "form.labelWidth"(val) {
  1638. this.localLabelWidth = this._labelWidthUnit(val);
  1639. },
  1640. "form.labelPosition"(val) {
  1641. this.localLabelPos = this._labelPosition();
  1642. },
  1643. "form.labelAlign"(val) {
  1644. }
  1645. },
  1646. created() {
  1647. this.init(true);
  1648. if (this.name && this.form) {
  1649. this.$watch(
  1650. () => {
  1651. const val = this.form._getDataValue(this.name, this.form.localData);
  1652. return val;
  1653. },
  1654. (value, oldVal) => {
  1655. const isEqual2 = this.form._isEqual(value, oldVal);
  1656. if (!isEqual2) {
  1657. const val = this.itemSetValue(value);
  1658. this.onFieldChange(val, false);
  1659. }
  1660. },
  1661. {
  1662. immediate: false
  1663. }
  1664. );
  1665. }
  1666. },
  1667. unmounted() {
  1668. this.__isUnmounted = true;
  1669. this.unInit();
  1670. },
  1671. methods: {
  1672. /**
  1673. * 外部调用方法
  1674. * 设置规则 ,主要用于小程序自定义检验规则
  1675. * @param {Array} rules 规则源数据
  1676. */
  1677. setRules(rules = null) {
  1678. this.userRules = rules;
  1679. this.init(false);
  1680. },
  1681. // 兼容老版本表单组件
  1682. setValue() {
  1683. },
  1684. /**
  1685. * 外部调用方法
  1686. * 校验数据
  1687. * @param {any} value 需要校验的数据
  1688. * @param {boolean} 是否立即校验
  1689. * @return {Array|null} 校验内容
  1690. */
  1691. async onFieldChange(value, formtrigger = true) {
  1692. const {
  1693. formData,
  1694. localData,
  1695. errShowType,
  1696. validateCheck,
  1697. validateTrigger,
  1698. _isRequiredField,
  1699. _realName
  1700. } = this.form;
  1701. const name = _realName(this.name);
  1702. if (!value) {
  1703. value = this.form.formData[name];
  1704. }
  1705. const ruleLen = this.itemRules.rules && this.itemRules.rules.length;
  1706. if (!this.validator || !ruleLen || ruleLen === 0)
  1707. return;
  1708. const isRequiredField2 = _isRequiredField(this.itemRules.rules || []);
  1709. let result = null;
  1710. if (validateTrigger === "bind" || formtrigger) {
  1711. result = await this.validator.validateUpdate(
  1712. {
  1713. [name]: value
  1714. },
  1715. formData
  1716. );
  1717. if (!isRequiredField2 && (value === void 0 || value === "")) {
  1718. result = null;
  1719. }
  1720. if (result && result.errorMessage) {
  1721. if (errShowType === "undertext") {
  1722. this.errMsg = !result ? "" : result.errorMessage;
  1723. }
  1724. if (errShowType === "toast") {
  1725. uni.showToast({
  1726. title: result.errorMessage || "校验错误",
  1727. icon: "none"
  1728. });
  1729. }
  1730. if (errShowType === "modal") {
  1731. uni.showModal({
  1732. title: "提示",
  1733. content: result.errorMessage || "校验错误"
  1734. });
  1735. }
  1736. } else {
  1737. this.errMsg = "";
  1738. }
  1739. validateCheck(result ? result : null);
  1740. } else {
  1741. this.errMsg = "";
  1742. }
  1743. return result ? result : null;
  1744. },
  1745. /**
  1746. * 初始组件数据
  1747. */
  1748. init(type = false) {
  1749. const {
  1750. validator,
  1751. formRules,
  1752. childrens,
  1753. formData,
  1754. localData,
  1755. _realName,
  1756. labelWidth,
  1757. _getDataValue,
  1758. _setDataValue
  1759. } = this.form || {};
  1760. this.localLabelAlign = this._justifyContent();
  1761. this.localLabelWidth = this._labelWidthUnit(labelWidth);
  1762. this.localLabelPos = this._labelPosition();
  1763. this.form && type && childrens.push(this);
  1764. if (!validator || !formRules)
  1765. return;
  1766. if (!this.form.isFirstBorder) {
  1767. this.form.isFirstBorder = true;
  1768. this.isFirstBorder = true;
  1769. }
  1770. if (this.group) {
  1771. if (!this.group.isFirstBorder) {
  1772. this.group.isFirstBorder = true;
  1773. this.isFirstBorder = true;
  1774. }
  1775. }
  1776. this.border = this.form.border;
  1777. const name = _realName(this.name);
  1778. const itemRule = this.userRules || this.rules;
  1779. if (typeof formRules === "object" && itemRule) {
  1780. formRules[name] = {
  1781. rules: itemRule
  1782. };
  1783. validator.updateSchema(formRules);
  1784. }
  1785. const itemRules = formRules[name] || {};
  1786. this.itemRules = itemRules;
  1787. this.validator = validator;
  1788. this.itemSetValue(_getDataValue(this.name, localData));
  1789. },
  1790. unInit() {
  1791. if (this.form) {
  1792. const {
  1793. childrens,
  1794. formData,
  1795. _realName
  1796. } = this.form;
  1797. childrens.forEach((item, index) => {
  1798. if (item === this) {
  1799. this.form.childrens.splice(index, 1);
  1800. delete formData[_realName(item.name)];
  1801. }
  1802. });
  1803. }
  1804. },
  1805. // 设置item 的值
  1806. itemSetValue(value) {
  1807. const name = this.form._realName(this.name);
  1808. const rules = this.itemRules.rules || [];
  1809. const val = this.form._getValue(name, value, rules);
  1810. this.form._setDataValue(name, this.form.formData, val);
  1811. return val;
  1812. },
  1813. /**
  1814. * 移除该表单项的校验结果
  1815. */
  1816. clearValidate() {
  1817. this.errMsg = "";
  1818. },
  1819. // 是否显示星号
  1820. _isRequired() {
  1821. return this.required;
  1822. },
  1823. // 处理对齐方式
  1824. _justifyContent() {
  1825. if (this.form) {
  1826. const {
  1827. labelAlign
  1828. } = this.form;
  1829. let labelAli = this.labelAlign ? this.labelAlign : labelAlign;
  1830. if (labelAli === "left")
  1831. return "flex-start";
  1832. if (labelAli === "center")
  1833. return "center";
  1834. if (labelAli === "right")
  1835. return "flex-end";
  1836. }
  1837. return "flex-start";
  1838. },
  1839. // 处理 label宽度单位 ,继承父元素的值
  1840. _labelWidthUnit(labelWidth) {
  1841. return this.num2px(this.labelWidth ? this.labelWidth : labelWidth || (this.label ? 70 : "auto"));
  1842. },
  1843. // 处理 label 位置
  1844. _labelPosition() {
  1845. if (this.form)
  1846. return this.form.labelPosition || "left";
  1847. return "left";
  1848. },
  1849. /**
  1850. * 触发时机
  1851. * @param {Object} rule 当前规则内时机
  1852. * @param {Object} itemRlue 当前组件时机
  1853. * @param {Object} parentRule 父组件时机
  1854. */
  1855. isTrigger(rule, itemRlue, parentRule) {
  1856. if (rule === "submit" || !rule) {
  1857. if (rule === void 0) {
  1858. if (itemRlue !== "bind") {
  1859. if (!itemRlue) {
  1860. return parentRule === "" ? "bind" : "submit";
  1861. }
  1862. return "submit";
  1863. }
  1864. return "bind";
  1865. }
  1866. return "submit";
  1867. }
  1868. return "bind";
  1869. },
  1870. num2px(num) {
  1871. if (typeof num === "number") {
  1872. return `${num}px`;
  1873. }
  1874. return num;
  1875. }
  1876. }
  1877. };
  1878. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  1879. return vue.openBlock(), vue.createElementBlock(
  1880. "view",
  1881. {
  1882. class: vue.normalizeClass(["uni-forms-item", ["is-direction-" + $data.localLabelPos, $data.border ? "uni-forms-item--border" : "", $data.border && $data.isFirstBorder ? "is-first-border" : ""]])
  1883. },
  1884. [
  1885. vue.renderSlot(_ctx.$slots, "label", {}, () => [
  1886. vue.createElementVNode(
  1887. "view",
  1888. {
  1889. class: vue.normalizeClass(["uni-forms-item__label", { "no-label": !$props.label && !$props.required }]),
  1890. style: vue.normalizeStyle({ width: $data.localLabelWidth, justifyContent: $data.localLabelAlign })
  1891. },
  1892. [
  1893. $props.required ? (vue.openBlock(), vue.createElementBlock("text", {
  1894. key: 0,
  1895. class: "is-required"
  1896. }, "*")) : vue.createCommentVNode("v-if", true),
  1897. vue.createElementVNode(
  1898. "text",
  1899. null,
  1900. vue.toDisplayString($props.label),
  1901. 1
  1902. /* TEXT */
  1903. )
  1904. ],
  1905. 6
  1906. /* CLASS, STYLE */
  1907. )
  1908. ], true),
  1909. vue.createElementVNode("view", { class: "uni-forms-item__content" }, [
  1910. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
  1911. vue.createElementVNode(
  1912. "view",
  1913. {
  1914. class: vue.normalizeClass(["uni-forms-item__error", { "msg--active": $options.msg }])
  1915. },
  1916. [
  1917. vue.createElementVNode(
  1918. "text",
  1919. null,
  1920. vue.toDisplayString($options.msg),
  1921. 1
  1922. /* TEXT */
  1923. )
  1924. ],
  1925. 2
  1926. /* CLASS */
  1927. )
  1928. ])
  1929. ],
  1930. 2
  1931. /* CLASS */
  1932. );
  1933. }
  1934. const __easycom_2$1 = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$x], ["__scopeId", "data-v-462874dd"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue"]]);
  1935. const pages = [
  1936. {
  1937. path: "pages/home/index",
  1938. style: {
  1939. navigationBarTitleText: "英途仓库"
  1940. }
  1941. },
  1942. {
  1943. path: "pages/instock/index",
  1944. style: {
  1945. navigationBarTitleText: "称重",
  1946. "app-plus": {
  1947. bounce: "none",
  1948. titleNView: {
  1949. buttons: [
  1950. {
  1951. fontSize: "16px",
  1952. text: "历史"
  1953. }
  1954. ],
  1955. backButton: {
  1956. background: "#00FF00"
  1957. }
  1958. }
  1959. }
  1960. }
  1961. },
  1962. {
  1963. path: "pages/instock/instockLog",
  1964. style: {
  1965. navigationBarTitleText: "录入历史"
  1966. }
  1967. },
  1968. {
  1969. path: "pages/profile/index",
  1970. style: {
  1971. navigationBarTitleText: "我的"
  1972. }
  1973. },
  1974. {
  1975. path: "pages/login/index",
  1976. style: {
  1977. navigationBarTitleText: "登录"
  1978. }
  1979. },
  1980. {
  1981. path: "pages/order/index",
  1982. style: {
  1983. navigationBarTitleText: "ORDER"
  1984. }
  1985. },
  1986. {
  1987. path: "pages/scanLotno/index",
  1988. style: {
  1989. navigationBarTitleText: "托盘/批次",
  1990. "app-plus": {
  1991. bounce: "none",
  1992. titleNView: {
  1993. buttons: [
  1994. {
  1995. fontSize: "16px",
  1996. text: "历史"
  1997. }
  1998. ],
  1999. backButton: {
  2000. background: "#00FF00"
  2001. }
  2002. }
  2003. }
  2004. }
  2005. },
  2006. {
  2007. path: "pages/scanLotno/lotnoLog",
  2008. style: {
  2009. navigationBarTitleText: "录入历史"
  2010. }
  2011. },
  2012. {
  2013. path: "pages/scanLotno/waybillsList",
  2014. style: {
  2015. navigationBarTitleText: "运单列表"
  2016. }
  2017. },
  2018. {
  2019. path: "pages/warehouseScan/index",
  2020. style: {
  2021. navigationBarTitleText: "仓库扫描",
  2022. "app-plus": {
  2023. bounce: "none",
  2024. titleNView: {
  2025. buttons: [
  2026. {
  2027. fontSize: "16px",
  2028. text: "历史"
  2029. }
  2030. ],
  2031. backButton: {
  2032. background: "#00FF00"
  2033. }
  2034. }
  2035. }
  2036. }
  2037. },
  2038. {
  2039. path: "pages/warehouseScan/warehouseLog",
  2040. style: {
  2041. navigationBarTitleText: "录入历史"
  2042. }
  2043. },
  2044. {
  2045. path: "pages/waybillNo/index",
  2046. style: {
  2047. navigationBarTitleText: "库位绑定",
  2048. "app-plus": {
  2049. bounce: "none",
  2050. titleNView: {
  2051. buttons: [
  2052. {
  2053. fontSize: "16px",
  2054. text: "历史"
  2055. }
  2056. ],
  2057. backButton: {
  2058. background: "#00FF00"
  2059. }
  2060. }
  2061. }
  2062. }
  2063. },
  2064. {
  2065. path: "pages/waybillNo/waybillNoLog",
  2066. style: {
  2067. navigationBarTitleText: "录入历史"
  2068. }
  2069. },
  2070. {
  2071. path: "pages/waybillDeliveryOrder/index",
  2072. style: {
  2073. navigationBarTitleText: "派送单",
  2074. "app-plus": {
  2075. bounce: "none",
  2076. titleNView: {
  2077. buttons: [
  2078. {
  2079. fontSize: "16px",
  2080. text: "筛选"
  2081. }
  2082. ],
  2083. backButton: {
  2084. background: "#00FF00"
  2085. }
  2086. }
  2087. }
  2088. }
  2089. },
  2090. {
  2091. path: "pages/waybillDeliveryOrder/orderInfo",
  2092. style: {
  2093. navigationBarTitleText: "派送详情"
  2094. }
  2095. },
  2096. {
  2097. path: "pages/printer/index",
  2098. style: {
  2099. navigationBarTitleText: "打印"
  2100. }
  2101. }
  2102. ];
  2103. const globalStyle = {
  2104. navigationBarTextStyle: "black",
  2105. navigationBarTitleText: "uni-app",
  2106. navigationBarBackgroundColor: "#F8F8F8",
  2107. backgroundColor: "#F8F8F8"
  2108. };
  2109. const tabBar = {
  2110. color: "#7A7E83",
  2111. selectedColor: "#007AFF",
  2112. borderStyle: "black",
  2113. backgroundColor: "#F8F8F8",
  2114. list: [
  2115. {
  2116. pagePath: "pages/home/index",
  2117. iconPath: "static/home.png",
  2118. selectedIconPath: "static/home_fill.png",
  2119. text: "首页"
  2120. },
  2121. {
  2122. pagePath: "pages/profile/index",
  2123. iconPath: "static/people.png",
  2124. selectedIconPath: "static/people_fill.png",
  2125. text: "我的"
  2126. }
  2127. ]
  2128. };
  2129. const uniIdRouter = {};
  2130. const e = {
  2131. pages,
  2132. globalStyle,
  2133. tabBar,
  2134. uniIdRouter
  2135. };
  2136. var define_process_env_UNI_SECURE_NETWORK_CONFIG_default = [];
  2137. function t$2(e2) {
  2138. return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
  2139. }
  2140. function n(e2, t2, n2) {
  2141. return e2(n2 = { path: t2, exports: {}, require: function(e3, t3) {
  2142. return function() {
  2143. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  2144. }(null == t3 && n2.path);
  2145. } }, n2.exports), n2.exports;
  2146. }
  2147. var s = n(function(e2, t2) {
  2148. var n2;
  2149. e2.exports = (n2 = n2 || function(e3, t3) {
  2150. var n3 = Object.create || /* @__PURE__ */ function() {
  2151. function e4() {
  2152. }
  2153. return function(t4) {
  2154. var n4;
  2155. return e4.prototype = t4, n4 = new e4(), e4.prototype = null, n4;
  2156. };
  2157. }(), s2 = {}, r2 = s2.lib = {}, i2 = r2.Base = { extend: function(e4) {
  2158. var t4 = n3(this);
  2159. return e4 && t4.mixIn(e4), t4.hasOwnProperty("init") && this.init !== t4.init || (t4.init = function() {
  2160. t4.$super.init.apply(this, arguments);
  2161. }), t4.init.prototype = t4, t4.$super = this, t4;
  2162. }, create: function() {
  2163. var e4 = this.extend();
  2164. return e4.init.apply(e4, arguments), e4;
  2165. }, init: function() {
  2166. }, mixIn: function(e4) {
  2167. for (var t4 in e4)
  2168. e4.hasOwnProperty(t4) && (this[t4] = e4[t4]);
  2169. e4.hasOwnProperty("toString") && (this.toString = e4.toString);
  2170. }, clone: function() {
  2171. return this.init.prototype.extend(this);
  2172. } }, o2 = r2.WordArray = i2.extend({ init: function(e4, n4) {
  2173. e4 = this.words = e4 || [], this.sigBytes = n4 != t3 ? n4 : 4 * e4.length;
  2174. }, toString: function(e4) {
  2175. return (e4 || c2).stringify(this);
  2176. }, concat: function(e4) {
  2177. var t4 = this.words, n4 = e4.words, s3 = this.sigBytes, r3 = e4.sigBytes;
  2178. if (this.clamp(), s3 % 4)
  2179. for (var i3 = 0; i3 < r3; i3++) {
  2180. var o3 = n4[i3 >>> 2] >>> 24 - i3 % 4 * 8 & 255;
  2181. t4[s3 + i3 >>> 2] |= o3 << 24 - (s3 + i3) % 4 * 8;
  2182. }
  2183. else
  2184. for (i3 = 0; i3 < r3; i3 += 4)
  2185. t4[s3 + i3 >>> 2] = n4[i3 >>> 2];
  2186. return this.sigBytes += r3, this;
  2187. }, clamp: function() {
  2188. var t4 = this.words, n4 = this.sigBytes;
  2189. t4[n4 >>> 2] &= 4294967295 << 32 - n4 % 4 * 8, t4.length = e3.ceil(n4 / 4);
  2190. }, clone: function() {
  2191. var e4 = i2.clone.call(this);
  2192. return e4.words = this.words.slice(0), e4;
  2193. }, random: function(t4) {
  2194. for (var n4, s3 = [], r3 = function(t5) {
  2195. t5 = t5;
  2196. var n5 = 987654321, s4 = 4294967295;
  2197. return function() {
  2198. var r4 = ((n5 = 36969 * (65535 & n5) + (n5 >> 16) & s4) << 16) + (t5 = 18e3 * (65535 & t5) + (t5 >> 16) & s4) & s4;
  2199. return r4 /= 4294967296, (r4 += 0.5) * (e3.random() > 0.5 ? 1 : -1);
  2200. };
  2201. }, i3 = 0; i3 < t4; i3 += 4) {
  2202. var a3 = r3(4294967296 * (n4 || e3.random()));
  2203. n4 = 987654071 * a3(), s3.push(4294967296 * a3() | 0);
  2204. }
  2205. return new o2.init(s3, t4);
  2206. } }), a2 = s2.enc = {}, c2 = a2.Hex = { stringify: function(e4) {
  2207. for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) {
  2208. var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255;
  2209. s3.push((i3 >>> 4).toString(16)), s3.push((15 & i3).toString(16));
  2210. }
  2211. return s3.join("");
  2212. }, parse: function(e4) {
  2213. for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3 += 2)
  2214. n4[s3 >>> 3] |= parseInt(e4.substr(s3, 2), 16) << 24 - s3 % 8 * 4;
  2215. return new o2.init(n4, t4 / 2);
  2216. } }, u2 = a2.Latin1 = { stringify: function(e4) {
  2217. for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) {
  2218. var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255;
  2219. s3.push(String.fromCharCode(i3));
  2220. }
  2221. return s3.join("");
  2222. }, parse: function(e4) {
  2223. for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3++)
  2224. n4[s3 >>> 2] |= (255 & e4.charCodeAt(s3)) << 24 - s3 % 4 * 8;
  2225. return new o2.init(n4, t4);
  2226. } }, l2 = a2.Utf8 = { stringify: function(e4) {
  2227. try {
  2228. return decodeURIComponent(escape(u2.stringify(e4)));
  2229. } catch (e5) {
  2230. throw new Error("Malformed UTF-8 data");
  2231. }
  2232. }, parse: function(e4) {
  2233. return u2.parse(unescape(encodeURIComponent(e4)));
  2234. } }, h2 = r2.BufferedBlockAlgorithm = i2.extend({ reset: function() {
  2235. this._data = new o2.init(), this._nDataBytes = 0;
  2236. }, _append: function(e4) {
  2237. "string" == typeof e4 && (e4 = l2.parse(e4)), this._data.concat(e4), this._nDataBytes += e4.sigBytes;
  2238. }, _process: function(t4) {
  2239. 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);
  2240. if (c3) {
  2241. for (var l3 = 0; l3 < c3; l3 += i3)
  2242. this._doProcessBlock(s3, l3);
  2243. var h3 = s3.splice(0, c3);
  2244. n4.sigBytes -= u3;
  2245. }
  2246. return new o2.init(h3, u3);
  2247. }, clone: function() {
  2248. var e4 = i2.clone.call(this);
  2249. return e4._data = this._data.clone(), e4;
  2250. }, _minBufferSize: 0 });
  2251. r2.Hasher = h2.extend({ cfg: i2.extend(), init: function(e4) {
  2252. this.cfg = this.cfg.extend(e4), this.reset();
  2253. }, reset: function() {
  2254. h2.reset.call(this), this._doReset();
  2255. }, update: function(e4) {
  2256. return this._append(e4), this._process(), this;
  2257. }, finalize: function(e4) {
  2258. return e4 && this._append(e4), this._doFinalize();
  2259. }, blockSize: 16, _createHelper: function(e4) {
  2260. return function(t4, n4) {
  2261. return new e4.init(n4).finalize(t4);
  2262. };
  2263. }, _createHmacHelper: function(e4) {
  2264. return function(t4, n4) {
  2265. return new d2.HMAC.init(e4, n4).finalize(t4);
  2266. };
  2267. } });
  2268. var d2 = s2.algo = {};
  2269. return s2;
  2270. }(Math), n2);
  2271. }), r = s, i = (n(function(e2, t2) {
  2272. var n2;
  2273. e2.exports = (n2 = r, function(e3) {
  2274. var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = [];
  2275. !function() {
  2276. for (var t4 = 0; t4 < 64; t4++)
  2277. a2[t4] = 4294967296 * e3.abs(e3.sin(t4 + 1)) | 0;
  2278. }();
  2279. var c2 = o2.MD5 = i2.extend({ _doReset: function() {
  2280. this._hash = new r2.init([1732584193, 4023233417, 2562383102, 271733878]);
  2281. }, _doProcessBlock: function(e4, t4) {
  2282. for (var n3 = 0; n3 < 16; n3++) {
  2283. var s3 = t4 + n3, r3 = e4[s3];
  2284. e4[s3] = 16711935 & (r3 << 8 | r3 >>> 24) | 4278255360 & (r3 << 24 | r3 >>> 8);
  2285. }
  2286. 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], C2 = e4[t4 + 15], P2 = i3[0], T2 = i3[1], x2 = i3[2], O2 = i3[3];
  2287. P2 = u2(P2, T2, x2, O2, o3, 7, a2[0]), O2 = u2(O2, P2, T2, x2, c3, 12, a2[1]), x2 = u2(x2, O2, P2, T2, p2, 17, a2[2]), T2 = u2(T2, x2, O2, P2, f2, 22, a2[3]), P2 = u2(P2, T2, x2, O2, g2, 7, a2[4]), O2 = u2(O2, P2, T2, x2, m2, 12, a2[5]), x2 = u2(x2, O2, P2, T2, y2, 17, a2[6]), T2 = u2(T2, x2, O2, P2, _2, 22, a2[7]), P2 = u2(P2, T2, x2, O2, w2, 7, a2[8]), O2 = u2(O2, P2, T2, x2, v2, 12, a2[9]), x2 = u2(x2, O2, P2, T2, I2, 17, a2[10]), T2 = u2(T2, x2, O2, P2, S2, 22, a2[11]), P2 = u2(P2, T2, x2, O2, b2, 7, a2[12]), O2 = u2(O2, P2, T2, x2, k2, 12, a2[13]), x2 = u2(x2, O2, P2, T2, A2, 17, a2[14]), P2 = l2(P2, T2 = u2(T2, x2, O2, P2, C2, 22, a2[15]), x2, O2, c3, 5, a2[16]), O2 = l2(O2, P2, T2, x2, y2, 9, a2[17]), x2 = l2(x2, O2, P2, T2, S2, 14, a2[18]), T2 = l2(T2, x2, O2, P2, o3, 20, a2[19]), P2 = l2(P2, T2, x2, O2, m2, 5, a2[20]), O2 = l2(O2, P2, T2, x2, I2, 9, a2[21]), x2 = l2(x2, O2, P2, T2, C2, 14, a2[22]), T2 = l2(T2, x2, O2, P2, g2, 20, a2[23]), P2 = l2(P2, T2, x2, O2, v2, 5, a2[24]), O2 = l2(O2, P2, T2, x2, A2, 9, a2[25]), x2 = l2(x2, O2, P2, T2, f2, 14, a2[26]), T2 = l2(T2, x2, O2, P2, w2, 20, a2[27]), P2 = l2(P2, T2, x2, O2, k2, 5, a2[28]), O2 = l2(O2, P2, T2, x2, p2, 9, a2[29]), x2 = l2(x2, O2, P2, T2, _2, 14, a2[30]), P2 = h2(P2, T2 = l2(T2, x2, O2, P2, b2, 20, a2[31]), x2, O2, m2, 4, a2[32]), O2 = h2(O2, P2, T2, x2, w2, 11, a2[33]), x2 = h2(x2, O2, P2, T2, S2, 16, a2[34]), T2 = h2(T2, x2, O2, P2, A2, 23, a2[35]), P2 = h2(P2, T2, x2, O2, c3, 4, a2[36]), O2 = h2(O2, P2, T2, x2, g2, 11, a2[37]), x2 = h2(x2, O2, P2, T2, _2, 16, a2[38]), T2 = h2(T2, x2, O2, P2, I2, 23, a2[39]), P2 = h2(P2, T2, x2, O2, k2, 4, a2[40]), O2 = h2(O2, P2, T2, x2, o3, 11, a2[41]), x2 = h2(x2, O2, P2, T2, f2, 16, a2[42]), T2 = h2(T2, x2, O2, P2, y2, 23, a2[43]), P2 = h2(P2, T2, x2, O2, v2, 4, a2[44]), O2 = h2(O2, P2, T2, x2, b2, 11, a2[45]), x2 = h2(x2, O2, P2, T2, C2, 16, a2[46]), P2 = d2(P2, T2 = h2(T2, x2, O2, P2, p2, 23, a2[47]), x2, O2, o3, 6, a2[48]), O2 = d2(O2, P2, T2, x2, _2, 10, a2[49]), x2 = d2(x2, O2, P2, T2, A2, 15, a2[50]), T2 = d2(T2, x2, O2, P2, m2, 21, a2[51]), P2 = d2(P2, T2, x2, O2, b2, 6, a2[52]), O2 = d2(O2, P2, T2, x2, f2, 10, a2[53]), x2 = d2(x2, O2, P2, T2, I2, 15, a2[54]), T2 = d2(T2, x2, O2, P2, c3, 21, a2[55]), P2 = d2(P2, T2, x2, O2, w2, 6, a2[56]), O2 = d2(O2, P2, T2, x2, C2, 10, a2[57]), x2 = d2(x2, O2, P2, T2, y2, 15, a2[58]), T2 = d2(T2, x2, O2, P2, k2, 21, a2[59]), P2 = d2(P2, T2, x2, O2, g2, 6, a2[60]), O2 = d2(O2, P2, T2, x2, S2, 10, a2[61]), x2 = d2(x2, O2, P2, T2, p2, 15, a2[62]), T2 = d2(T2, x2, O2, P2, v2, 21, a2[63]), i3[0] = i3[0] + P2 | 0, i3[1] = i3[1] + T2 | 0, i3[2] = i3[2] + x2 | 0, i3[3] = i3[3] + O2 | 0;
  2288. }, _doFinalize: function() {
  2289. var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes;
  2290. n3[r3 >>> 5] |= 128 << 24 - r3 % 32;
  2291. var i3 = e3.floor(s3 / 4294967296), o3 = s3;
  2292. 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();
  2293. for (var a3 = this._hash, c3 = a3.words, u3 = 0; u3 < 4; u3++) {
  2294. var l3 = c3[u3];
  2295. c3[u3] = 16711935 & (l3 << 8 | l3 >>> 24) | 4278255360 & (l3 << 24 | l3 >>> 8);
  2296. }
  2297. return a3;
  2298. }, clone: function() {
  2299. var e4 = i2.clone.call(this);
  2300. return e4._hash = this._hash.clone(), e4;
  2301. } });
  2302. function u2(e4, t4, n3, s3, r3, i3, o3) {
  2303. var a3 = e4 + (t4 & n3 | ~t4 & s3) + r3 + o3;
  2304. return (a3 << i3 | a3 >>> 32 - i3) + t4;
  2305. }
  2306. function l2(e4, t4, n3, s3, r3, i3, o3) {
  2307. var a3 = e4 + (t4 & s3 | n3 & ~s3) + r3 + o3;
  2308. return (a3 << i3 | a3 >>> 32 - i3) + t4;
  2309. }
  2310. function h2(e4, t4, n3, s3, r3, i3, o3) {
  2311. var a3 = e4 + (t4 ^ n3 ^ s3) + r3 + o3;
  2312. return (a3 << i3 | a3 >>> 32 - i3) + t4;
  2313. }
  2314. function d2(e4, t4, n3, s3, r3, i3, o3) {
  2315. var a3 = e4 + (n3 ^ (t4 | ~s3)) + r3 + o3;
  2316. return (a3 << i3 | a3 >>> 32 - i3) + t4;
  2317. }
  2318. t3.MD5 = i2._createHelper(c2), t3.HmacMD5 = i2._createHmacHelper(c2);
  2319. }(Math), n2.MD5);
  2320. }), n(function(e2, t2) {
  2321. var n2;
  2322. e2.exports = (n2 = r, void function() {
  2323. var e3 = n2, t3 = e3.lib.Base, s2 = e3.enc.Utf8;
  2324. e3.algo.HMAC = t3.extend({ init: function(e4, t4) {
  2325. e4 = this._hasher = new e4.init(), "string" == typeof t4 && (t4 = s2.parse(t4));
  2326. var n3 = e4.blockSize, r2 = 4 * n3;
  2327. t4.sigBytes > r2 && (t4 = e4.finalize(t4)), t4.clamp();
  2328. for (var i2 = this._oKey = t4.clone(), o2 = this._iKey = t4.clone(), a2 = i2.words, c2 = o2.words, u2 = 0; u2 < n3; u2++)
  2329. a2[u2] ^= 1549556828, c2[u2] ^= 909522486;
  2330. i2.sigBytes = o2.sigBytes = r2, this.reset();
  2331. }, reset: function() {
  2332. var e4 = this._hasher;
  2333. e4.reset(), e4.update(this._iKey);
  2334. }, update: function(e4) {
  2335. return this._hasher.update(e4), this;
  2336. }, finalize: function(e4) {
  2337. var t4 = this._hasher, n3 = t4.finalize(e4);
  2338. return t4.reset(), t4.finalize(this._oKey.clone().concat(n3));
  2339. } });
  2340. }());
  2341. }), n(function(e2, t2) {
  2342. e2.exports = r.HmacMD5;
  2343. })), o = n(function(e2, t2) {
  2344. e2.exports = r.enc.Utf8;
  2345. }), a = n(function(e2, t2) {
  2346. var n2;
  2347. e2.exports = (n2 = r, function() {
  2348. var e3 = n2, t3 = e3.lib.WordArray;
  2349. function s2(e4, n3, s3) {
  2350. for (var r2 = [], i2 = 0, o2 = 0; o2 < n3; o2++)
  2351. if (o2 % 4) {
  2352. var a2 = s3[e4.charCodeAt(o2 - 1)] << o2 % 4 * 2, c2 = s3[e4.charCodeAt(o2)] >>> 6 - o2 % 4 * 2;
  2353. r2[i2 >>> 2] |= (a2 | c2) << 24 - i2 % 4 * 8, i2++;
  2354. }
  2355. return t3.create(r2, i2);
  2356. }
  2357. e3.enc.Base64 = { stringify: function(e4) {
  2358. var t4 = e4.words, n3 = e4.sigBytes, s3 = this._map;
  2359. e4.clamp();
  2360. for (var r2 = [], i2 = 0; i2 < n3; i2 += 3)
  2361. 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++)
  2362. r2.push(s3.charAt(o2 >>> 6 * (3 - a2) & 63));
  2363. var c2 = s3.charAt(64);
  2364. if (c2)
  2365. for (; r2.length % 4; )
  2366. r2.push(c2);
  2367. return r2.join("");
  2368. }, parse: function(e4) {
  2369. var t4 = e4.length, n3 = this._map, r2 = this._reverseMap;
  2370. if (!r2) {
  2371. r2 = this._reverseMap = [];
  2372. for (var i2 = 0; i2 < n3.length; i2++)
  2373. r2[n3.charCodeAt(i2)] = i2;
  2374. }
  2375. var o2 = n3.charAt(64);
  2376. if (o2) {
  2377. var a2 = e4.indexOf(o2);
  2378. -1 !== a2 && (t4 = a2);
  2379. }
  2380. return s2(e4, t4, r2);
  2381. }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" };
  2382. }(), n2.enc.Base64);
  2383. });
  2384. const c = "FUNCTION", u = "OBJECT", l = "CLIENT_DB", h = "pending", d = "fulfilled", p = "rejected";
  2385. function f(e2) {
  2386. return Object.prototype.toString.call(e2).slice(8, -1).toLowerCase();
  2387. }
  2388. function g(e2) {
  2389. return "object" === f(e2);
  2390. }
  2391. function m(e2) {
  2392. return "function" == typeof e2;
  2393. }
  2394. function y(e2) {
  2395. return function() {
  2396. try {
  2397. return e2.apply(e2, arguments);
  2398. } catch (e3) {
  2399. console.error(e3);
  2400. }
  2401. };
  2402. }
  2403. const _ = "REJECTED", w = "NOT_PENDING";
  2404. class v {
  2405. constructor({ createPromise: e2, retryRule: t2 = _ } = {}) {
  2406. this.createPromise = e2, this.status = null, this.promise = null, this.retryRule = t2;
  2407. }
  2408. get needRetry() {
  2409. if (!this.status)
  2410. return true;
  2411. switch (this.retryRule) {
  2412. case _:
  2413. return this.status === p;
  2414. case w:
  2415. return this.status !== h;
  2416. }
  2417. }
  2418. exec() {
  2419. return this.needRetry ? (this.status = h, this.promise = this.createPromise().then((e2) => (this.status = d, Promise.resolve(e2)), (e2) => (this.status = p, Promise.reject(e2))), this.promise) : this.promise;
  2420. }
  2421. }
  2422. function I(e2) {
  2423. return e2 && "string" == typeof e2 ? JSON.parse(e2) : e2;
  2424. }
  2425. const S = true, b = "app", A = I(define_process_env_UNI_SECURE_NETWORK_CONFIG_default), C = b, P = I(""), T = I("[]") || [];
  2426. let O = "";
  2427. try {
  2428. O = "__UNI__EE98A34";
  2429. } catch (e2) {
  2430. }
  2431. let E = {};
  2432. function L(e2, t2 = {}) {
  2433. var n2, s2;
  2434. return n2 = E, s2 = e2, Object.prototype.hasOwnProperty.call(n2, s2) || (E[e2] = t2), E[e2];
  2435. }
  2436. E = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {};
  2437. const R = ["invoke", "success", "fail", "complete"], U = L("_globalUniCloudInterceptor");
  2438. function N(e2, t2) {
  2439. U[e2] || (U[e2] = {}), g(t2) && Object.keys(t2).forEach((n2) => {
  2440. R.indexOf(n2) > -1 && function(e3, t3, n3) {
  2441. let s2 = U[e3][t3];
  2442. s2 || (s2 = U[e3][t3] = []), -1 === s2.indexOf(n3) && m(n3) && s2.push(n3);
  2443. }(e2, n2, t2[n2]);
  2444. });
  2445. }
  2446. function D(e2, t2) {
  2447. U[e2] || (U[e2] = {}), g(t2) ? Object.keys(t2).forEach((n2) => {
  2448. R.indexOf(n2) > -1 && function(e3, t3, n3) {
  2449. const s2 = U[e3][t3];
  2450. if (!s2)
  2451. return;
  2452. const r2 = s2.indexOf(n3);
  2453. r2 > -1 && s2.splice(r2, 1);
  2454. }(e2, n2, t2[n2]);
  2455. }) : delete U[e2];
  2456. }
  2457. function M(e2, t2) {
  2458. return e2 && 0 !== e2.length ? e2.reduce((e3, n2) => e3.then(() => n2(t2)), Promise.resolve()) : Promise.resolve();
  2459. }
  2460. function q(e2, t2) {
  2461. return U[e2] && U[e2][t2] || [];
  2462. }
  2463. function F(e2) {
  2464. N("callObject", e2);
  2465. }
  2466. const K = L("_globalUniCloudListener"), j = "response", $ = "needLogin", B = "refreshToken", W = "clientdb", H = "cloudfunction", J = "cloudobject";
  2467. function z(e2) {
  2468. return K[e2] || (K[e2] = []), K[e2];
  2469. }
  2470. function V(e2, t2) {
  2471. const n2 = z(e2);
  2472. n2.includes(t2) || n2.push(t2);
  2473. }
  2474. function G(e2, t2) {
  2475. const n2 = z(e2), s2 = n2.indexOf(t2);
  2476. -1 !== s2 && n2.splice(s2, 1);
  2477. }
  2478. function Y(e2, t2) {
  2479. const n2 = z(e2);
  2480. for (let e3 = 0; e3 < n2.length; e3++) {
  2481. (0, n2[e3])(t2);
  2482. }
  2483. }
  2484. let Q, X = false;
  2485. function Z() {
  2486. return Q || (Q = new Promise((e2) => {
  2487. X && e2(), function t2() {
  2488. if ("function" == typeof getCurrentPages) {
  2489. const t3 = getCurrentPages();
  2490. t3 && t3[0] && (X = true, e2());
  2491. }
  2492. X || setTimeout(() => {
  2493. t2();
  2494. }, 30);
  2495. }();
  2496. }), Q);
  2497. }
  2498. function ee(e2) {
  2499. const t2 = {};
  2500. for (const n2 in e2) {
  2501. const s2 = e2[n2];
  2502. m(s2) && (t2[n2] = y(s2));
  2503. }
  2504. return t2;
  2505. }
  2506. class te extends Error {
  2507. constructor(e2) {
  2508. 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;
  2509. }
  2510. toJson(e2 = 0) {
  2511. if (!(e2 >= 10))
  2512. return e2++, { errCode: this.errCode, errMsg: this.errMsg, errSubject: this.errSubject, cause: this.cause && this.cause.toJson ? this.cause.toJson(e2) : this.cause };
  2513. }
  2514. }
  2515. 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(), connectSocket: (e2) => uni.connectSocket(e2) };
  2516. function se(e2) {
  2517. return e2 && se(e2.__v_raw) || e2;
  2518. }
  2519. function re() {
  2520. return { token: ne.getStorageSync("uni_id_token") || ne.getStorageSync("uniIdToken"), tokenExpired: ne.getStorageSync("uni_id_token_expired") };
  2521. }
  2522. function ie({ token: e2, tokenExpired: t2 } = {}) {
  2523. e2 && ne.setStorageSync("uni_id_token", e2), t2 && ne.setStorageSync("uni_id_token_expired", t2);
  2524. }
  2525. let oe, ae;
  2526. function ce() {
  2527. return oe || (oe = uni.getSystemInfoSync()), oe;
  2528. }
  2529. function ue() {
  2530. let e2, t2;
  2531. try {
  2532. if (uni.getLaunchOptionsSync) {
  2533. if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1)
  2534. return;
  2535. const { scene: n2, channel: s2 } = uni.getLaunchOptionsSync();
  2536. e2 = s2, t2 = n2;
  2537. }
  2538. } catch (e3) {
  2539. }
  2540. return { channel: e2, scene: t2 };
  2541. }
  2542. let le = {};
  2543. function he() {
  2544. const e2 = uni.getLocale && uni.getLocale() || "en";
  2545. if (ae)
  2546. return { ...le, ...ae, locale: e2, LOCALE: e2 };
  2547. const t2 = ce(), { deviceId: n2, osName: s2, uniPlatform: r2, appId: i2 } = t2, o2 = ["appId", "appLanguage", "appName", "appVersion", "appVersionCode", "appWgtVersion", "browserName", "browserVersion", "deviceBrand", "deviceId", "deviceModel", "deviceType", "osName", "osVersion", "romName", "romVersion", "ua", "hostName", "hostVersion", "uniPlatform", "uniRuntimeVersion", "uniRuntimeVersionCode", "uniCompilerVersion", "uniCompilerVersionCode"];
  2548. for (const e3 in t2)
  2549. Object.hasOwnProperty.call(t2, e3) && -1 === o2.indexOf(e3) && delete t2[e3];
  2550. return ae = { PLATFORM: r2, OS: s2, APPID: i2, DEVICEID: n2, ...ue(), ...t2 }, { ...le, ...ae, locale: e2, LOCALE: e2 };
  2551. }
  2552. var de = { sign: function(e2, t2) {
  2553. let n2 = "";
  2554. return Object.keys(e2).sort().forEach(function(t3) {
  2555. e2[t3] && (n2 = n2 + "&" + t3 + "=" + e2[t3]);
  2556. }), n2 = n2.slice(1), i(n2, t2).toString();
  2557. }, wrappedRequest: function(e2, t2) {
  2558. return new Promise((n2, s2) => {
  2559. t2(Object.assign(e2, { complete(e3) {
  2560. e3 || (e3 = {});
  2561. const t3 = e3.data && e3.data.header && e3.data.header["x-serverless-request-id"] || e3.header && e3.header["request-id"];
  2562. if (!e3.statusCode || e3.statusCode >= 400) {
  2563. 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";
  2564. return s2(new te({ code: n3, message: r3, requestId: t3 }));
  2565. }
  2566. const r2 = e3.data;
  2567. if (r2.error)
  2568. return s2(new te({ code: r2.error.code, message: r2.error.message, requestId: t3 }));
  2569. r2.result = r2.data, r2.requestId = t3, delete r2.data, n2(r2);
  2570. } }));
  2571. });
  2572. }, toBase64: function(e2) {
  2573. return a.stringify(o.parse(e2));
  2574. } };
  2575. var pe = class {
  2576. constructor(e2) {
  2577. ["spaceId", "clientSecret"].forEach((t2) => {
  2578. if (!Object.prototype.hasOwnProperty.call(e2, t2))
  2579. throw new Error(`${t2} required`);
  2580. }), 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) => {
  2581. if (!e3.result || !e3.result.accessToken)
  2582. throw new te({ code: "AUTH_FAILED", message: "获取accessToken失败" });
  2583. this.setAccessToken(e3.result.accessToken);
  2584. }), retryRule: w });
  2585. }
  2586. get hasAccessToken() {
  2587. return !!this.accessToken;
  2588. }
  2589. setAccessToken(e2) {
  2590. this.accessToken = e2;
  2591. }
  2592. requestWrapped(e2) {
  2593. return de.wrappedRequest(e2, this.adapter.request);
  2594. }
  2595. requestAuth(e2) {
  2596. return this.requestWrapped(e2);
  2597. }
  2598. request(e2, t2) {
  2599. return Promise.resolve().then(() => this.hasAccessToken ? t2 ? this.requestWrapped(e2) : this.requestWrapped(e2).catch((t3) => new Promise((e3, n2) => {
  2600. !t3 || "GATEWAY_INVALID_TOKEN" !== t3.code && "InvalidParameter.InvalidToken" !== t3.code ? n2(t3) : e3();
  2601. }).then(() => this.getAccessToken()).then(() => {
  2602. const t4 = this.rebuildRequest(e2);
  2603. return this.request(t4, true);
  2604. })) : this.getAccessToken().then(() => {
  2605. const t3 = this.rebuildRequest(e2);
  2606. return this.request(t3, true);
  2607. }));
  2608. }
  2609. rebuildRequest(e2) {
  2610. const t2 = Object.assign({}, e2);
  2611. return t2.data.token = this.accessToken, t2.header["x-basement-token"] = this.accessToken, t2.header["x-serverless-sign"] = de.sign(t2.data, this.config.clientSecret), t2;
  2612. }
  2613. setupRequest(e2, t2) {
  2614. const n2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), s2 = { "Content-Type": "application/json" };
  2615. return "auth" !== t2 && (n2.token = this.accessToken, s2["x-basement-token"] = this.accessToken), s2["x-serverless-sign"] = de.sign(n2, this.config.clientSecret), { url: this.config.requestUrl, method: "POST", data: n2, dataType: "json", header: s2 };
  2616. }
  2617. getAccessToken() {
  2618. return this._getAccessTokenPromiseHub.exec();
  2619. }
  2620. async authorize() {
  2621. await this.getAccessToken();
  2622. }
  2623. callFunction(e2) {
  2624. const t2 = { method: "serverless.function.runtime.invoke", params: JSON.stringify({ functionTarget: e2.name, functionArgs: e2.data || {} }) };
  2625. return this.request({ ...this.setupRequest(t2), timeout: e2.timeout });
  2626. }
  2627. getOSSUploadOptionsFromPath(e2) {
  2628. const t2 = { method: "serverless.file.resource.generateProximalSign", params: JSON.stringify(e2) };
  2629. return this.request(this.setupRequest(t2));
  2630. }
  2631. uploadFileToOSS({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, onUploadProgress: i2 }) {
  2632. return new Promise((o2, a2) => {
  2633. const c2 = this.adapter.uploadFile({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, header: { "X-OSS-server-side-encrpytion": "AES256" }, success(e3) {
  2634. e3 && e3.statusCode < 400 ? o2(e3) : a2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
  2635. }, fail(e3) {
  2636. a2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
  2637. } });
  2638. "function" == typeof i2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => {
  2639. i2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
  2640. });
  2641. });
  2642. }
  2643. reportOSSUpload(e2) {
  2644. const t2 = { method: "serverless.file.resource.report", params: JSON.stringify(e2) };
  2645. return this.request(this.setupRequest(t2));
  2646. }
  2647. async uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", cloudPathAsRealPath: s2 = false, onUploadProgress: r2, config: i2 }) {
  2648. if ("string" !== f(t2))
  2649. throw new te({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });
  2650. if (!(t2 = t2.trim()))
  2651. throw new te({ code: "INVALID_PARAM", message: "cloudPath不可为空" });
  2652. if (/:\/\//.test(t2))
  2653. throw new te({ code: "INVALID_PARAM", message: "cloudPath不合法" });
  2654. const o2 = i2 && i2.envType || this.config.envType;
  2655. if (s2 && ("/" !== t2[0] && (t2 = "/" + t2), t2.indexOf("\\") > -1))
  2656. throw new te({ code: "INVALID_PARAM", message: "使用cloudPath作为路径时,cloudPath不可包含“\\”" });
  2657. 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: l2, signature: h2, host: d2, ossPath: p2, id: g2, policy: m2, ossCallbackUrl: y2 } = a2, _2 = { "Cache-Control": "max-age=2592000", "Content-Disposition": "attachment", OSSAccessKeyId: l2, Signature: h2, host: d2, id: g2, key: p2, policy: m2, success_action_status: 200 };
  2658. if (u2 && (_2["x-oss-security-token"] = u2), y2) {
  2659. const e3 = JSON.stringify({ callbackUrl: y2, callbackBody: JSON.stringify({ fileId: g2, spaceId: this.config.spaceId }), callbackBodyType: "application/json" });
  2660. _2.callback = de.toBase64(e3);
  2661. }
  2662. const w2 = { url: "https://" + a2.host, formData: _2, fileName: "file", name: "file", filePath: e2, fileType: n2 };
  2663. if (await this.uploadFileToOSS(Object.assign({}, w2, { onUploadProgress: r2 })), y2)
  2664. return { success: true, filePath: e2, fileID: c2 };
  2665. if ((await this.reportOSSUpload({ id: g2 })).success)
  2666. return { success: true, filePath: e2, fileID: c2 };
  2667. throw new te({ code: "UPLOAD_FAILED", message: "文件上传失败" });
  2668. }
  2669. getTempFileURL({ fileList: e2 } = {}) {
  2670. return new Promise((t2, n2) => {
  2671. Array.isArray(e2) && 0 !== e2.length || n2(new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" })), t2({ fileList: e2.map((e3) => ({ fileID: e3, tempFileURL: e3 })) });
  2672. });
  2673. }
  2674. async getFileInfo({ fileList: e2 } = {}) {
  2675. if (!Array.isArray(e2) || 0 === e2.length)
  2676. throw new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
  2677. const t2 = { method: "serverless.file.resource.info", params: JSON.stringify({ id: e2.map((e3) => e3.split("?")[0]).join(",") }) };
  2678. return { fileList: (await this.request(this.setupRequest(t2))).result };
  2679. }
  2680. };
  2681. var fe = { init(e2) {
  2682. const t2 = new pe(e2), n2 = { signInAnonymously: function() {
  2683. return t2.authorize();
  2684. }, getLoginState: function() {
  2685. return Promise.resolve(false);
  2686. } };
  2687. return t2.auth = function() {
  2688. return n2;
  2689. }, t2.customAuth = t2.auth, t2;
  2690. } };
  2691. const ge = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";
  2692. var me;
  2693. !function(e2) {
  2694. e2.local = "local", e2.none = "none", e2.session = "session";
  2695. }(me || (me = {}));
  2696. var ye = function() {
  2697. }, _e = n(function(e2, t2) {
  2698. var n2;
  2699. e2.exports = (n2 = r, function(e3) {
  2700. var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = [], c2 = [];
  2701. !function() {
  2702. function t4(t5) {
  2703. for (var n4 = e3.sqrt(t5), s4 = 2; s4 <= n4; s4++)
  2704. if (!(t5 % s4))
  2705. return false;
  2706. return true;
  2707. }
  2708. function n3(e4) {
  2709. return 4294967296 * (e4 - (0 | e4)) | 0;
  2710. }
  2711. for (var s3 = 2, r3 = 0; r3 < 64; )
  2712. t4(s3) && (r3 < 8 && (a2[r3] = n3(e3.pow(s3, 0.5))), c2[r3] = n3(e3.pow(s3, 1 / 3)), r3++), s3++;
  2713. }();
  2714. var u2 = [], l2 = o2.SHA256 = i2.extend({ _doReset: function() {
  2715. this._hash = new r2.init(a2.slice(0));
  2716. }, _doProcessBlock: function(e4, t4) {
  2717. for (var n3 = this._hash.words, s3 = n3[0], r3 = n3[1], i3 = n3[2], o3 = n3[3], a3 = n3[4], l3 = n3[5], h2 = n3[6], d2 = n3[7], p2 = 0; p2 < 64; p2++) {
  2718. if (p2 < 16)
  2719. u2[p2] = 0 | e4[t4 + p2];
  2720. else {
  2721. 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;
  2722. u2[p2] = g2 + u2[p2 - 7] + y2 + u2[p2 - 16];
  2723. }
  2724. 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 & l3 ^ ~a3 & h2) + c2[p2] + u2[p2];
  2725. d2 = h2, h2 = l3, l3 = a3, a3 = o3 + v2 | 0, o3 = i3, i3 = r3, r3 = s3, s3 = v2 + (w2 + _2) | 0;
  2726. }
  2727. 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] + l3 | 0, n3[6] = n3[6] + h2 | 0, n3[7] = n3[7] + d2 | 0;
  2728. }, _doFinalize: function() {
  2729. var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes;
  2730. 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;
  2731. }, clone: function() {
  2732. var e4 = i2.clone.call(this);
  2733. return e4._hash = this._hash.clone(), e4;
  2734. } });
  2735. t3.SHA256 = i2._createHelper(l2), t3.HmacSHA256 = i2._createHmacHelper(l2);
  2736. }(Math), n2.SHA256);
  2737. }), we = _e, ve = n(function(e2, t2) {
  2738. e2.exports = r.HmacSHA256;
  2739. });
  2740. const Ie = () => {
  2741. let e2;
  2742. if (!Promise) {
  2743. e2 = () => {
  2744. }, e2.promise = {};
  2745. const t3 = () => {
  2746. throw new te({ message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.' });
  2747. };
  2748. return Object.defineProperty(e2.promise, "then", { get: t3 }), Object.defineProperty(e2.promise, "catch", { get: t3 }), e2;
  2749. }
  2750. const t2 = new Promise((t3, n2) => {
  2751. e2 = (e3, s2) => e3 ? n2(e3) : t3(s2);
  2752. });
  2753. return e2.promise = t2, e2;
  2754. };
  2755. function Se(e2) {
  2756. return void 0 === e2;
  2757. }
  2758. function be(e2) {
  2759. return "[object Null]" === Object.prototype.toString.call(e2);
  2760. }
  2761. var ke;
  2762. function Ae(e2) {
  2763. const t2 = (n2 = e2, "[object Array]" === Object.prototype.toString.call(n2) ? e2 : [e2]);
  2764. var n2;
  2765. for (const e3 of t2) {
  2766. const { isMatch: t3, genAdapter: n3, runtime: s2 } = e3;
  2767. if (t3())
  2768. return { adapter: n3(), runtime: s2 };
  2769. }
  2770. }
  2771. !function(e2) {
  2772. e2.WEB = "web", e2.WX_MP = "wx_mp";
  2773. }(ke || (ke = {}));
  2774. const Ce = { adapter: null, runtime: void 0 }, Pe = ["anonymousUuidKey"];
  2775. class Te extends ye {
  2776. constructor() {
  2777. super(), Ce.adapter.root.tcbObject || (Ce.adapter.root.tcbObject = {});
  2778. }
  2779. setItem(e2, t2) {
  2780. Ce.adapter.root.tcbObject[e2] = t2;
  2781. }
  2782. getItem(e2) {
  2783. return Ce.adapter.root.tcbObject[e2];
  2784. }
  2785. removeItem(e2) {
  2786. delete Ce.adapter.root.tcbObject[e2];
  2787. }
  2788. clear() {
  2789. delete Ce.adapter.root.tcbObject;
  2790. }
  2791. }
  2792. function xe(e2, t2) {
  2793. switch (e2) {
  2794. case "local":
  2795. return t2.localStorage || new Te();
  2796. case "none":
  2797. return new Te();
  2798. default:
  2799. return t2.sessionStorage || new Te();
  2800. }
  2801. }
  2802. class Oe {
  2803. constructor(e2) {
  2804. if (!this._storage) {
  2805. this._persistence = Ce.adapter.primaryStorage || e2.persistence, this._storage = xe(this._persistence, Ce.adapter);
  2806. 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}`;
  2807. this.keys = { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2, anonymousUuidKey: r2, loginTypeKey: i2, userInfoKey: o2 };
  2808. }
  2809. }
  2810. updatePersistence(e2) {
  2811. if (e2 === this._persistence)
  2812. return;
  2813. const t2 = "local" === this._persistence;
  2814. this._persistence = e2;
  2815. const n2 = xe(e2, Ce.adapter);
  2816. for (const e3 in this.keys) {
  2817. const s2 = this.keys[e3];
  2818. if (t2 && Pe.includes(e3))
  2819. continue;
  2820. const r2 = this._storage.getItem(s2);
  2821. Se(r2) || be(r2) || (n2.setItem(s2, r2), this._storage.removeItem(s2));
  2822. }
  2823. this._storage = n2;
  2824. }
  2825. setStore(e2, t2, n2) {
  2826. if (!this._storage)
  2827. return;
  2828. const s2 = { version: n2 || "localCachev1", content: t2 }, r2 = JSON.stringify(s2);
  2829. try {
  2830. this._storage.setItem(e2, r2);
  2831. } catch (e3) {
  2832. throw e3;
  2833. }
  2834. }
  2835. getStore(e2, t2) {
  2836. try {
  2837. if (!this._storage)
  2838. return;
  2839. } catch (e3) {
  2840. return "";
  2841. }
  2842. t2 = t2 || "localCachev1";
  2843. const n2 = this._storage.getItem(e2);
  2844. if (!n2)
  2845. return "";
  2846. if (n2.indexOf(t2) >= 0) {
  2847. return JSON.parse(n2).content;
  2848. }
  2849. return "";
  2850. }
  2851. removeStore(e2) {
  2852. this._storage.removeItem(e2);
  2853. }
  2854. }
  2855. const Ee = {}, Le = {};
  2856. function Re(e2) {
  2857. return Ee[e2];
  2858. }
  2859. class Ue {
  2860. constructor(e2, t2) {
  2861. this.data = t2 || null, this.name = e2;
  2862. }
  2863. }
  2864. class Ne extends Ue {
  2865. constructor(e2, t2) {
  2866. super("error", { error: e2, data: t2 }), this.error = e2;
  2867. }
  2868. }
  2869. const De = new class {
  2870. constructor() {
  2871. this._listeners = {};
  2872. }
  2873. on(e2, t2) {
  2874. return function(e3, t3, n2) {
  2875. n2[e3] = n2[e3] || [], n2[e3].push(t3);
  2876. }(e2, t2, this._listeners), this;
  2877. }
  2878. off(e2, t2) {
  2879. return function(e3, t3, n2) {
  2880. if (n2 && n2[e3]) {
  2881. const s2 = n2[e3].indexOf(t3);
  2882. -1 !== s2 && n2[e3].splice(s2, 1);
  2883. }
  2884. }(e2, t2, this._listeners), this;
  2885. }
  2886. fire(e2, t2) {
  2887. if (e2 instanceof Ne)
  2888. return console.error(e2.error), this;
  2889. const n2 = "string" == typeof e2 ? new Ue(e2, t2 || {}) : e2;
  2890. const s2 = n2.name;
  2891. if (this._listens(s2)) {
  2892. n2.target = this;
  2893. const e3 = this._listeners[s2] ? [...this._listeners[s2]] : [];
  2894. for (const t3 of e3)
  2895. t3.call(this, n2);
  2896. }
  2897. return this;
  2898. }
  2899. _listens(e2) {
  2900. return this._listeners[e2] && this._listeners[e2].length > 0;
  2901. }
  2902. }();
  2903. function Me(e2, t2) {
  2904. De.on(e2, t2);
  2905. }
  2906. function qe(e2, t2 = {}) {
  2907. De.fire(e2, t2);
  2908. }
  2909. function Fe(e2, t2) {
  2910. De.off(e2, t2);
  2911. }
  2912. const Ke = "loginStateChanged", je = "loginStateExpire", $e = "loginTypeChanged", Be = "anonymousConverted", We = "refreshAccessToken";
  2913. var He;
  2914. !function(e2) {
  2915. 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";
  2916. }(He || (He = {}));
  2917. const Je = ["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" };
  2918. function Ve(e2, t2, n2) {
  2919. const s2 = e2[t2];
  2920. e2[t2] = function(t3) {
  2921. const r2 = {}, i2 = {};
  2922. n2.forEach((n3) => {
  2923. const { data: s3, headers: o3 } = n3.call(e2, t3);
  2924. Object.assign(r2, s3), Object.assign(i2, o3);
  2925. });
  2926. const o2 = t3.data;
  2927. return o2 && (() => {
  2928. var e3;
  2929. if (e3 = o2, "[object FormData]" !== Object.prototype.toString.call(e3))
  2930. t3.data = { ...o2, ...r2 };
  2931. else
  2932. for (const e4 in r2)
  2933. o2.append(e4, r2[e4]);
  2934. })(), t3.headers = { ...t3.headers || {}, ...i2 }, s2.call(e2, t3);
  2935. };
  2936. }
  2937. function Ge() {
  2938. const e2 = Math.random().toString(16).slice(2);
  2939. return { data: { seqId: e2 }, headers: { ...ze, "x-seqid": e2 } };
  2940. }
  2941. class Ye {
  2942. constructor(e2 = {}) {
  2943. var t2;
  2944. this.config = e2, this._reqClass = new Ce.adapter.reqClass({ timeout: this.config.timeout, timeoutMsg: `请求在${this.config.timeout / 1e3}s内未完成,已中断`, restrictedMethods: ["post"] }), this._cache = Re(this.config.env), this._localCache = (t2 = this.config.env, Le[t2]), Ve(this._reqClass, "post", [Ge]), Ve(this._reqClass, "upload", [Ge]), Ve(this._reqClass, "download", [Ge]);
  2945. }
  2946. async post(e2) {
  2947. return await this._reqClass.post(e2);
  2948. }
  2949. async upload(e2) {
  2950. return await this._reqClass.upload(e2);
  2951. }
  2952. async download(e2) {
  2953. return await this._reqClass.download(e2);
  2954. }
  2955. async refreshAccessToken() {
  2956. let e2, t2;
  2957. this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());
  2958. try {
  2959. e2 = await this._refreshAccessTokenPromise;
  2960. } catch (e3) {
  2961. t2 = e3;
  2962. }
  2963. if (this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t2)
  2964. throw t2;
  2965. return e2;
  2966. }
  2967. async _refreshAccessToken() {
  2968. const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2, loginTypeKey: s2, anonymousUuidKey: r2 } = this._cache.keys;
  2969. this._cache.removeStore(e2), this._cache.removeStore(t2);
  2970. let i2 = this._cache.getStore(n2);
  2971. if (!i2)
  2972. throw new te({ message: "未登录CloudBase" });
  2973. const o2 = { refresh_token: i2 }, a2 = await this.request("auth.fetchAccessTokenWithRefreshToken", o2);
  2974. if (a2.data.code) {
  2975. const { code: e3 } = a2.data;
  2976. if ("SIGN_PARAM_INVALID" === e3 || "REFRESH_TOKEN_EXPIRED" === e3 || "INVALID_REFRESH_TOKEN" === e3) {
  2977. if (this._cache.getStore(s2) === He.ANONYMOUS && "INVALID_REFRESH_TOKEN" === e3) {
  2978. const e4 = this._cache.getStore(r2), t3 = this._cache.getStore(n2), s3 = await this.send("auth.signInAnonymously", { anonymous_uuid: e4, refresh_token: t3 });
  2979. return this.setRefreshToken(s3.refresh_token), this._refreshAccessToken();
  2980. }
  2981. qe(je), this._cache.removeStore(n2);
  2982. }
  2983. throw new te({ code: a2.data.code, message: `刷新access token失败:${a2.data.code}` });
  2984. }
  2985. if (a2.data.access_token)
  2986. return qe(We), 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 };
  2987. a2.data.refresh_token && (this._cache.removeStore(n2), this._cache.setStore(n2, a2.data.refresh_token), this._refreshAccessToken());
  2988. }
  2989. async getAccessToken() {
  2990. const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2 } = this._cache.keys;
  2991. if (!this._cache.getStore(n2))
  2992. throw new te({ message: "refresh token不存在,登录状态异常" });
  2993. let s2 = this._cache.getStore(e2), r2 = this._cache.getStore(t2), i2 = true;
  2994. return this._shouldRefreshAccessTokenHook && !await this._shouldRefreshAccessTokenHook(s2, r2) && (i2 = false), (!s2 || !r2 || r2 < Date.now()) && i2 ? this.refreshAccessToken() : { accessToken: s2, accessTokenExpire: r2 };
  2995. }
  2996. async request(e2, t2, n2) {
  2997. const s2 = `x-tcb-trace_${this.config.env}`;
  2998. let r2 = "application/x-www-form-urlencoded";
  2999. const i2 = { action: e2, env: this.config.env, dataVersion: "2019-08-16", ...t2 };
  3000. if (-1 === Je.indexOf(e2)) {
  3001. const { refreshTokenKey: e3 } = this._cache.keys;
  3002. this._cache.getStore(e3) && (i2.access_token = (await this.getAccessToken()).accessToken);
  3003. }
  3004. let o2;
  3005. if ("storage.uploadFile" === e2) {
  3006. o2 = new FormData();
  3007. for (let e3 in o2)
  3008. o2.hasOwnProperty(e3) && void 0 !== o2[e3] && o2.append(e3, i2[e3]);
  3009. r2 = "multipart/form-data";
  3010. } else {
  3011. r2 = "application/json", o2 = {};
  3012. for (let e3 in i2)
  3013. void 0 !== i2[e3] && (o2[e3] = i2[e3]);
  3014. }
  3015. let a2 = { headers: { "content-type": r2 } };
  3016. n2 && n2.timeout && (a2.timeout = n2.timeout), n2 && n2.onUploadProgress && (a2.onUploadProgress = n2.onUploadProgress);
  3017. const c2 = this._localCache.getStore(s2);
  3018. c2 && (a2.headers["X-TCB-Trace"] = c2);
  3019. const { parse: u2, inQuery: l2, search: h2 } = t2;
  3020. let d2 = { env: this.config.env };
  3021. u2 && (d2.parse = true), l2 && (d2 = { ...l2, ...d2 });
  3022. let p2 = function(e3, t3, n3 = {}) {
  3023. const s3 = /\?/.test(t3);
  3024. let r3 = "";
  3025. for (let e4 in n3)
  3026. "" === r3 ? !s3 && (t3 += "?") : r3 += "&", r3 += `${e4}=${encodeURIComponent(n3[e4])}`;
  3027. return /^http(s)?\:\/\//.test(t3 += r3) ? t3 : `${e3}${t3}`;
  3028. }(ge, "//tcb-api.tencentcloudapi.com/web", d2);
  3029. h2 && (p2 += h2);
  3030. const f2 = await this.post({ url: p2, data: o2, ...a2 }), g2 = f2.header && f2.header["x-tcb-trace"];
  3031. if (g2 && this._localCache.setStore(s2, g2), 200 !== Number(f2.status) && 200 !== Number(f2.statusCode) || !f2.data)
  3032. throw new te({ code: "NETWORK_ERROR", message: "network request error" });
  3033. return f2;
  3034. }
  3035. async send(e2, t2 = {}, n2 = {}) {
  3036. const s2 = await this.request(e2, t2, { ...n2, onUploadProgress: t2.onUploadProgress });
  3037. if ("ACCESS_TOKEN_EXPIRED" === s2.data.code && -1 === Je.indexOf(e2)) {
  3038. await this.refreshAccessToken();
  3039. const s3 = await this.request(e2, t2, { ...n2, onUploadProgress: t2.onUploadProgress });
  3040. if (s3.data.code)
  3041. throw new te({ code: s3.data.code, message: s3.data.message });
  3042. return s3.data;
  3043. }
  3044. if (s2.data.code)
  3045. throw new te({ code: s2.data.code, message: s2.data.message });
  3046. return s2.data;
  3047. }
  3048. setRefreshToken(e2) {
  3049. const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys;
  3050. this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2);
  3051. }
  3052. }
  3053. const Qe = {};
  3054. function Xe(e2) {
  3055. return Qe[e2];
  3056. }
  3057. class Ze {
  3058. constructor(e2) {
  3059. this.config = e2, this._cache = Re(e2.env), this._request = Xe(e2.env);
  3060. }
  3061. setRefreshToken(e2) {
  3062. const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys;
  3063. this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2);
  3064. }
  3065. setAccessToken(e2, t2) {
  3066. const { accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys;
  3067. this._cache.setStore(n2, e2), this._cache.setStore(s2, t2);
  3068. }
  3069. async refreshUserInfo() {
  3070. const { data: e2 } = await this._request.send("auth.getUserInfo", {});
  3071. return this.setLocalUserInfo(e2), e2;
  3072. }
  3073. setLocalUserInfo(e2) {
  3074. const { userInfoKey: t2 } = this._cache.keys;
  3075. this._cache.setStore(t2, e2);
  3076. }
  3077. }
  3078. class et {
  3079. constructor(e2) {
  3080. if (!e2)
  3081. throw new te({ code: "PARAM_ERROR", message: "envId is not defined" });
  3082. this._envId = e2, this._cache = Re(this._envId), this._request = Xe(this._envId), this.setUserInfo();
  3083. }
  3084. linkWithTicket(e2) {
  3085. if ("string" != typeof e2)
  3086. throw new te({ code: "PARAM_ERROR", message: "ticket must be string" });
  3087. return this._request.send("auth.linkWithTicket", { ticket: e2 });
  3088. }
  3089. linkWithRedirect(e2) {
  3090. e2.signInWithRedirect();
  3091. }
  3092. updatePassword(e2, t2) {
  3093. return this._request.send("auth.updatePassword", { oldPassword: t2, newPassword: e2 });
  3094. }
  3095. updateEmail(e2) {
  3096. return this._request.send("auth.updateEmail", { newEmail: e2 });
  3097. }
  3098. updateUsername(e2) {
  3099. if ("string" != typeof e2)
  3100. throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
  3101. return this._request.send("auth.updateUsername", { username: e2 });
  3102. }
  3103. async getLinkedUidList() {
  3104. const { data: e2 } = await this._request.send("auth.getLinkedUidList", {});
  3105. let t2 = false;
  3106. const { users: n2 } = e2;
  3107. return n2.forEach((e3) => {
  3108. e3.wxOpenId && e3.wxPublicId && (t2 = true);
  3109. }), { users: n2, hasPrimaryUid: t2 };
  3110. }
  3111. setPrimaryUid(e2) {
  3112. return this._request.send("auth.setPrimaryUid", { uid: e2 });
  3113. }
  3114. unlink(e2) {
  3115. return this._request.send("auth.unlink", { platform: e2 });
  3116. }
  3117. async update(e2) {
  3118. 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 });
  3119. this.setLocalUserInfo(a2);
  3120. }
  3121. async refresh() {
  3122. const { data: e2 } = await this._request.send("auth.getUserInfo", {});
  3123. return this.setLocalUserInfo(e2), e2;
  3124. }
  3125. setUserInfo() {
  3126. const { userInfoKey: e2 } = this._cache.keys, t2 = this._cache.getStore(e2);
  3127. ["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach((e3) => {
  3128. this[e3] = t2[e3];
  3129. }), this.location = { country: t2.country, province: t2.province, city: t2.city };
  3130. }
  3131. setLocalUserInfo(e2) {
  3132. const { userInfoKey: t2 } = this._cache.keys;
  3133. this._cache.setStore(t2, e2), this.setUserInfo();
  3134. }
  3135. }
  3136. class tt {
  3137. constructor(e2) {
  3138. if (!e2)
  3139. throw new te({ code: "PARAM_ERROR", message: "envId is not defined" });
  3140. this._cache = Re(e2);
  3141. 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);
  3142. this.credential = { refreshToken: r2, accessToken: i2, accessTokenExpire: o2 }, this.user = new et(e2);
  3143. }
  3144. get isAnonymousAuth() {
  3145. return this.loginType === He.ANONYMOUS;
  3146. }
  3147. get isCustomAuth() {
  3148. return this.loginType === He.CUSTOM;
  3149. }
  3150. get isWeixinAuth() {
  3151. return this.loginType === He.WECHAT || this.loginType === He.WECHAT_OPEN || this.loginType === He.WECHAT_PUBLIC;
  3152. }
  3153. get loginType() {
  3154. return this._cache.getStore(this._cache.keys.loginTypeKey);
  3155. }
  3156. }
  3157. class nt extends Ze {
  3158. async signIn() {
  3159. this._cache.updatePersistence("local");
  3160. 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 });
  3161. if (r2.uuid && r2.refresh_token) {
  3162. this._setAnonymousUUID(r2.uuid), this.setRefreshToken(r2.refresh_token), await this._request.refreshAccessToken(), qe(Ke), qe($e, { env: this.config.env, loginType: He.ANONYMOUS, persistence: "local" });
  3163. const e3 = new tt(this.config.env);
  3164. return await e3.user.refresh(), e3;
  3165. }
  3166. throw new te({ message: "匿名登录失败" });
  3167. }
  3168. async linkAndRetrieveDataWithTicket(e2) {
  3169. 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 });
  3170. if (i2.refresh_token)
  3171. return this._clearAnonymousUUID(), this.setRefreshToken(i2.refresh_token), await this._request.refreshAccessToken(), qe(Be, { env: this.config.env }), qe($e, { loginType: He.CUSTOM, persistence: "local" }), { credential: { refreshToken: i2.refresh_token } };
  3172. throw new te({ message: "匿名转化失败" });
  3173. }
  3174. _setAnonymousUUID(e2) {
  3175. const { anonymousUuidKey: t2, loginTypeKey: n2 } = this._cache.keys;
  3176. this._cache.removeStore(t2), this._cache.setStore(t2, e2), this._cache.setStore(n2, He.ANONYMOUS);
  3177. }
  3178. _clearAnonymousUUID() {
  3179. this._cache.removeStore(this._cache.keys.anonymousUuidKey);
  3180. }
  3181. }
  3182. class st extends Ze {
  3183. async signIn(e2) {
  3184. if ("string" != typeof e2)
  3185. throw new te({ code: "PARAM_ERROR", message: "ticket must be a string" });
  3186. const { refreshTokenKey: t2 } = this._cache.keys, n2 = await this._request.send("auth.signInWithTicket", { ticket: e2, refresh_token: this._cache.getStore(t2) || "" });
  3187. if (n2.refresh_token)
  3188. return this.setRefreshToken(n2.refresh_token), await this._request.refreshAccessToken(), qe(Ke), qe($e, { env: this.config.env, loginType: He.CUSTOM, persistence: this.config.persistence }), await this.refreshUserInfo(), new tt(this.config.env);
  3189. throw new te({ message: "自定义登录失败" });
  3190. }
  3191. }
  3192. class rt extends Ze {
  3193. async signIn(e2, t2) {
  3194. if ("string" != typeof e2)
  3195. throw new te({ code: "PARAM_ERROR", message: "email must be a string" });
  3196. 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;
  3197. if (r2)
  3198. return this.setRefreshToken(r2), i2 && o2 ? this.setAccessToken(i2, o2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), qe(Ke), qe($e, { env: this.config.env, loginType: He.EMAIL, persistence: this.config.persistence }), new tt(this.config.env);
  3199. throw s2.code ? new te({ code: s2.code, message: `邮箱登录失败: ${s2.message}` }) : new te({ message: "邮箱登录失败" });
  3200. }
  3201. async activate(e2) {
  3202. return this._request.send("auth.activateEndUserMail", { token: e2 });
  3203. }
  3204. async resetPasswordWithToken(e2, t2) {
  3205. return this._request.send("auth.resetPasswordWithToken", { token: e2, newPassword: t2 });
  3206. }
  3207. }
  3208. class it extends Ze {
  3209. async signIn(e2, t2) {
  3210. if ("string" != typeof e2)
  3211. throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
  3212. "string" != typeof t2 && (t2 = "", console.warn("password is empty"));
  3213. const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: He.USERNAME, username: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token_expire: i2, access_token: o2 } = s2;
  3214. if (r2)
  3215. return this.setRefreshToken(r2), o2 && i2 ? this.setAccessToken(o2, i2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), qe(Ke), qe($e, { env: this.config.env, loginType: He.USERNAME, persistence: this.config.persistence }), new tt(this.config.env);
  3216. throw s2.code ? new te({ code: s2.code, message: `用户名密码登录失败: ${s2.message}` }) : new te({ message: "用户名密码登录失败" });
  3217. }
  3218. }
  3219. class ot {
  3220. constructor(e2) {
  3221. this.config = e2, this._cache = Re(e2.env), this._request = Xe(e2.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), Me($e, this._onLoginTypeChanged);
  3222. }
  3223. get currentUser() {
  3224. const e2 = this.hasLoginState();
  3225. return e2 && e2.user || null;
  3226. }
  3227. get loginType() {
  3228. return this._cache.getStore(this._cache.keys.loginTypeKey);
  3229. }
  3230. anonymousAuthProvider() {
  3231. return new nt(this.config);
  3232. }
  3233. customAuthProvider() {
  3234. return new st(this.config);
  3235. }
  3236. emailAuthProvider() {
  3237. return new rt(this.config);
  3238. }
  3239. usernameAuthProvider() {
  3240. return new it(this.config);
  3241. }
  3242. async signInAnonymously() {
  3243. return new nt(this.config).signIn();
  3244. }
  3245. async signInWithEmailAndPassword(e2, t2) {
  3246. return new rt(this.config).signIn(e2, t2);
  3247. }
  3248. signInWithUsernameAndPassword(e2, t2) {
  3249. return new it(this.config).signIn(e2, t2);
  3250. }
  3251. async linkAndRetrieveDataWithTicket(e2) {
  3252. this._anonymousAuthProvider || (this._anonymousAuthProvider = new nt(this.config)), Me(Be, this._onAnonymousConverted);
  3253. return await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e2);
  3254. }
  3255. async signOut() {
  3256. if (this.loginType === He.ANONYMOUS)
  3257. throw new te({ message: "匿名用户不支持登出操作" });
  3258. const { refreshTokenKey: e2, accessTokenKey: t2, accessTokenExpireKey: n2 } = this._cache.keys, s2 = this._cache.getStore(e2);
  3259. if (!s2)
  3260. return;
  3261. const r2 = await this._request.send("auth.logout", { refresh_token: s2 });
  3262. return this._cache.removeStore(e2), this._cache.removeStore(t2), this._cache.removeStore(n2), qe(Ke), qe($e, { env: this.config.env, loginType: He.NULL, persistence: this.config.persistence }), r2;
  3263. }
  3264. async signUpWithEmailAndPassword(e2, t2) {
  3265. return this._request.send("auth.signUpWithEmailAndPassword", { email: e2, password: t2 });
  3266. }
  3267. async sendPasswordResetEmail(e2) {
  3268. return this._request.send("auth.sendPasswordResetEmail", { email: e2 });
  3269. }
  3270. onLoginStateChanged(e2) {
  3271. Me(Ke, () => {
  3272. const t3 = this.hasLoginState();
  3273. e2.call(this, t3);
  3274. });
  3275. const t2 = this.hasLoginState();
  3276. e2.call(this, t2);
  3277. }
  3278. onLoginStateExpired(e2) {
  3279. Me(je, e2.bind(this));
  3280. }
  3281. onAccessTokenRefreshed(e2) {
  3282. Me(We, e2.bind(this));
  3283. }
  3284. onAnonymousConverted(e2) {
  3285. Me(Be, e2.bind(this));
  3286. }
  3287. onLoginTypeChanged(e2) {
  3288. Me($e, () => {
  3289. const t2 = this.hasLoginState();
  3290. e2.call(this, t2);
  3291. });
  3292. }
  3293. async getAccessToken() {
  3294. return { accessToken: (await this._request.getAccessToken()).accessToken, env: this.config.env };
  3295. }
  3296. hasLoginState() {
  3297. const { refreshTokenKey: e2 } = this._cache.keys;
  3298. return this._cache.getStore(e2) ? new tt(this.config.env) : null;
  3299. }
  3300. async isUsernameRegistered(e2) {
  3301. if ("string" != typeof e2)
  3302. throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
  3303. const { data: t2 } = await this._request.send("auth.isUsernameRegistered", { username: e2 });
  3304. return t2 && t2.isRegistered;
  3305. }
  3306. getLoginState() {
  3307. return Promise.resolve(this.hasLoginState());
  3308. }
  3309. async signInWithTicket(e2) {
  3310. return new st(this.config).signIn(e2);
  3311. }
  3312. shouldRefreshAccessToken(e2) {
  3313. this._request._shouldRefreshAccessTokenHook = e2.bind(this);
  3314. }
  3315. getUserInfo() {
  3316. return this._request.send("auth.getUserInfo", {}).then((e2) => e2.code ? e2 : { ...e2.data, requestId: e2.seqId });
  3317. }
  3318. getAuthHeader() {
  3319. const { refreshTokenKey: e2, accessTokenKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2);
  3320. return { "x-cloudbase-credentials": this._cache.getStore(t2) + "/@@/" + n2 };
  3321. }
  3322. _onAnonymousConverted(e2) {
  3323. const { env: t2 } = e2.data;
  3324. t2 === this.config.env && this._cache.updatePersistence(this.config.persistence);
  3325. }
  3326. _onLoginTypeChanged(e2) {
  3327. const { loginType: t2, persistence: n2, env: s2 } = e2.data;
  3328. s2 === this.config.env && (this._cache.updatePersistence(n2), this._cache.setStore(this._cache.keys.loginTypeKey, t2));
  3329. }
  3330. }
  3331. const at = function(e2, t2) {
  3332. t2 = t2 || Ie();
  3333. const n2 = Xe(this.config.env), { cloudPath: s2, filePath: r2, onUploadProgress: i2, fileType: o2 = "image" } = e2;
  3334. return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => {
  3335. const { data: { url: a2, authorization: c2, token: u2, fileId: l2, cosFileId: h2 }, requestId: d2 } = e3, p2 = { key: s2, signature: c2, "x-cos-meta-fileid": h2, success_action_status: "201", "x-cos-security-token": u2 };
  3336. n2.upload({ url: a2, data: p2, file: r2, name: s2, fileType: o2, onUploadProgress: i2 }).then((e4) => {
  3337. 201 === e4.statusCode ? t2(null, { fileID: l2, requestId: d2 }) : t2(new te({ code: "STORAGE_REQUEST_FAIL", message: `STORAGE_REQUEST_FAIL: ${e4.data}` }));
  3338. }).catch((e4) => {
  3339. t2(e4);
  3340. });
  3341. }).catch((e3) => {
  3342. t2(e3);
  3343. }), t2.promise;
  3344. }, ct = function(e2, t2) {
  3345. t2 = t2 || Ie();
  3346. const n2 = Xe(this.config.env), { cloudPath: s2 } = e2;
  3347. return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => {
  3348. t2(null, e3);
  3349. }).catch((e3) => {
  3350. t2(e3);
  3351. }), t2.promise;
  3352. }, ut = function({ fileList: e2 }, t2) {
  3353. if (t2 = t2 || Ie(), !e2 || !Array.isArray(e2))
  3354. return { code: "INVALID_PARAM", message: "fileList必须是非空的数组" };
  3355. for (let t3 of e2)
  3356. if (!t3 || "string" != typeof t3)
  3357. return { code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" };
  3358. const n2 = { fileid_list: e2 };
  3359. return Xe(this.config.env).send("storage.batchDeleteFile", n2).then((e3) => {
  3360. e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.delete_list, requestId: e3.requestId });
  3361. }).catch((e3) => {
  3362. t2(e3);
  3363. }), t2.promise;
  3364. }, lt = function({ fileList: e2 }, t2) {
  3365. t2 = t2 || Ie(), e2 && Array.isArray(e2) || t2(null, { code: "INVALID_PARAM", message: "fileList必须是非空的数组" });
  3366. let n2 = [];
  3367. for (let s3 of e2)
  3368. "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的元素必须是字符串" });
  3369. const s2 = { file_list: n2 };
  3370. return Xe(this.config.env).send("storage.batchGetDownloadUrl", s2).then((e3) => {
  3371. e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.download_list, requestId: e3.requestId });
  3372. }).catch((e3) => {
  3373. t2(e3);
  3374. }), t2.promise;
  3375. }, ht = async function({ fileID: e2 }, t2) {
  3376. const n2 = (await lt.call(this, { fileList: [{ fileID: e2, maxAge: 600 }] })).fileList[0];
  3377. if ("SUCCESS" !== n2.code)
  3378. return t2 ? t2(n2) : new Promise((e3) => {
  3379. e3(n2);
  3380. });
  3381. const s2 = Xe(this.config.env);
  3382. let r2 = n2.download_url;
  3383. if (r2 = encodeURI(r2), !t2)
  3384. return s2.download({ url: r2 });
  3385. t2(await s2.download({ url: r2 }));
  3386. }, dt = function({ name: e2, data: t2, query: n2, parse: s2, search: r2, timeout: i2 }, o2) {
  3387. const a2 = o2 || Ie();
  3388. let c2;
  3389. try {
  3390. c2 = t2 ? JSON.stringify(t2) : "";
  3391. } catch (e3) {
  3392. return Promise.reject(e3);
  3393. }
  3394. if (!e2)
  3395. return Promise.reject(new te({ code: "PARAM_ERROR", message: "函数名不能为空" }));
  3396. const u2 = { inQuery: n2, parse: s2, search: r2, function_name: e2, request_data: c2 };
  3397. return Xe(this.config.env).send("functions.invokeFunction", u2, { timeout: i2 }).then((e3) => {
  3398. if (e3.code)
  3399. a2(null, e3);
  3400. else {
  3401. let t3 = e3.data.response_data;
  3402. if (s2)
  3403. a2(null, { result: t3, requestId: e3.requestId });
  3404. else
  3405. try {
  3406. t3 = JSON.parse(e3.data.response_data), a2(null, { result: t3, requestId: e3.requestId });
  3407. } catch (e4) {
  3408. a2(new te({ message: "response data must be json" }));
  3409. }
  3410. }
  3411. return a2.promise;
  3412. }).catch((e3) => {
  3413. a2(e3);
  3414. }), a2.promise;
  3415. }, pt = { timeout: 15e3, persistence: "session" }, ft = {};
  3416. class gt {
  3417. constructor(e2) {
  3418. this.config = e2 || this.config, this.authObj = void 0;
  3419. }
  3420. init(e2) {
  3421. switch (Ce.adapter || (this.requestClient = new Ce.adapter.reqClass({ timeout: e2.timeout || 5e3, timeoutMsg: `请求在${(e2.timeout || 5e3) / 1e3}s内未完成,已中断` })), this.config = { ...pt, ...e2 }, true) {
  3422. case this.config.timeout > 6e5:
  3423. console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = 6e5;
  3424. break;
  3425. case this.config.timeout < 100:
  3426. console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;
  3427. }
  3428. return new gt(this.config);
  3429. }
  3430. auth({ persistence: e2 } = {}) {
  3431. if (this.authObj)
  3432. return this.authObj;
  3433. const t2 = e2 || Ce.adapter.primaryStorage || pt.persistence;
  3434. var n2;
  3435. return t2 !== this.config.persistence && (this.config.persistence = t2), function(e3) {
  3436. const { env: t3 } = e3;
  3437. Ee[t3] = new Oe(e3), Le[t3] = new Oe({ ...e3, persistence: "local" });
  3438. }(this.config), n2 = this.config, Qe[n2.env] = new Ye(n2), this.authObj = new ot(this.config), this.authObj;
  3439. }
  3440. on(e2, t2) {
  3441. return Me.apply(this, [e2, t2]);
  3442. }
  3443. off(e2, t2) {
  3444. return Fe.apply(this, [e2, t2]);
  3445. }
  3446. callFunction(e2, t2) {
  3447. return dt.apply(this, [e2, t2]);
  3448. }
  3449. deleteFile(e2, t2) {
  3450. return ut.apply(this, [e2, t2]);
  3451. }
  3452. getTempFileURL(e2, t2) {
  3453. return lt.apply(this, [e2, t2]);
  3454. }
  3455. downloadFile(e2, t2) {
  3456. return ht.apply(this, [e2, t2]);
  3457. }
  3458. uploadFile(e2, t2) {
  3459. return at.apply(this, [e2, t2]);
  3460. }
  3461. getUploadMetadata(e2, t2) {
  3462. return ct.apply(this, [e2, t2]);
  3463. }
  3464. registerExtension(e2) {
  3465. ft[e2.name] = e2;
  3466. }
  3467. async invokeExtension(e2, t2) {
  3468. const n2 = ft[e2];
  3469. if (!n2)
  3470. throw new te({ message: `扩展${e2} 必须先注册` });
  3471. return await n2.invoke(t2, this);
  3472. }
  3473. useAdapters(e2) {
  3474. const { adapter: t2, runtime: n2 } = Ae(e2) || {};
  3475. t2 && (Ce.adapter = t2), n2 && (Ce.runtime = n2);
  3476. }
  3477. }
  3478. var mt = new gt();
  3479. function yt(e2, t2, n2) {
  3480. void 0 === n2 && (n2 = {});
  3481. var s2 = /\?/.test(t2), r2 = "";
  3482. for (var i2 in n2)
  3483. "" === r2 ? !s2 && (t2 += "?") : r2 += "&", r2 += i2 + "=" + encodeURIComponent(n2[i2]);
  3484. return /^http(s)?:\/\//.test(t2 += r2) ? t2 : "" + e2 + t2;
  3485. }
  3486. class _t {
  3487. post(e2) {
  3488. const { url: t2, data: n2, headers: s2, timeout: r2 } = e2;
  3489. return new Promise((e3, i2) => {
  3490. ne.request({ url: yt("https:", t2), data: n2, method: "POST", header: s2, timeout: r2, success(t3) {
  3491. e3(t3);
  3492. }, fail(e4) {
  3493. i2(e4);
  3494. } });
  3495. });
  3496. }
  3497. upload(e2) {
  3498. return new Promise((t2, n2) => {
  3499. const { url: s2, file: r2, data: i2, headers: o2, fileType: a2 } = e2, c2 = ne.uploadFile({ url: yt("https:", s2), name: "file", formData: Object.assign({}, i2), filePath: r2, fileType: a2, header: o2, success(e3) {
  3500. const n3 = { statusCode: e3.statusCode, data: e3.data || {} };
  3501. 200 === e3.statusCode && i2.success_action_status && (n3.statusCode = parseInt(i2.success_action_status, 10)), t2(n3);
  3502. }, fail(e3) {
  3503. n2(new Error(e3.errMsg || "uploadFile:fail"));
  3504. } });
  3505. "function" == typeof e2.onUploadProgress && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((t3) => {
  3506. e2.onUploadProgress({ loaded: t3.totalBytesSent, total: t3.totalBytesExpectedToSend });
  3507. });
  3508. });
  3509. }
  3510. }
  3511. const wt = { setItem(e2, t2) {
  3512. ne.setStorageSync(e2, t2);
  3513. }, getItem: (e2) => ne.getStorageSync(e2), removeItem(e2) {
  3514. ne.removeStorageSync(e2);
  3515. }, clear() {
  3516. ne.clearStorageSync();
  3517. } };
  3518. var vt = { genAdapter: function() {
  3519. return { root: {}, reqClass: _t, localStorage: wt, primaryStorage: "local" };
  3520. }, isMatch: function() {
  3521. return true;
  3522. }, runtime: "uni_app" };
  3523. mt.useAdapters(vt);
  3524. const It = mt, St = It.init;
  3525. It.init = function(e2) {
  3526. e2.env = e2.spaceId;
  3527. const t2 = St.call(this, e2);
  3528. t2.config.provider = "tencent", t2.config.spaceId = e2.spaceId;
  3529. const n2 = t2.auth;
  3530. return t2.auth = function(e3) {
  3531. const t3 = n2.call(this, e3);
  3532. return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach((e4) => {
  3533. var n3;
  3534. t3[e4] = (n3 = t3[e4], function(e5) {
  3535. e5 = e5 || {};
  3536. const { success: t4, fail: s2, complete: r2 } = ee(e5);
  3537. if (!(t4 || s2 || r2))
  3538. return n3.call(this, e5);
  3539. n3.call(this, e5).then((e6) => {
  3540. t4 && t4(e6), r2 && r2(e6);
  3541. }, (e6) => {
  3542. s2 && s2(e6), r2 && r2(e6);
  3543. });
  3544. }).bind(t3);
  3545. }), t3;
  3546. }, t2.customAuth = t2.auth, t2;
  3547. };
  3548. var bt = It;
  3549. async function kt(e2, t2) {
  3550. const n2 = `http://${e2}:${t2}/system/ping`;
  3551. try {
  3552. const e3 = await (s2 = { url: n2, timeout: 500 }, new Promise((e4, t3) => {
  3553. ne.request({ ...s2, success(t4) {
  3554. e4(t4);
  3555. }, fail(e5) {
  3556. t3(e5);
  3557. } });
  3558. }));
  3559. return !(!e3.data || 0 !== e3.data.code);
  3560. } catch (e3) {
  3561. return false;
  3562. }
  3563. var s2;
  3564. }
  3565. async function At(e2, t2) {
  3566. let n2;
  3567. for (let s2 = 0; s2 < e2.length; s2++) {
  3568. const r2 = e2[s2];
  3569. if (await kt(r2, t2)) {
  3570. n2 = r2;
  3571. break;
  3572. }
  3573. }
  3574. return { address: n2, port: t2 };
  3575. }
  3576. const Ct = { "serverless.file.resource.generateProximalSign": "storage/generate-proximal-sign", "serverless.file.resource.report": "storage/report", "serverless.file.resource.delete": "storage/delete", "serverless.file.resource.getTempFileURL": "storage/get-temp-file-url" };
  3577. var Pt = class {
  3578. constructor(e2) {
  3579. if (["spaceId", "clientSecret"].forEach((t2) => {
  3580. if (!Object.prototype.hasOwnProperty.call(e2, t2))
  3581. throw new Error(`${t2} required`);
  3582. }), !e2.endpoint)
  3583. throw new Error("集群空间未配置ApiEndpoint,配置后需要重新关联服务空间后生效");
  3584. this.config = Object.assign({}, e2), this.config.provider = "dcloud", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.adapter = ne;
  3585. }
  3586. async request(e2, t2 = true) {
  3587. const n2 = t2;
  3588. return e2 = n2 ? await this.setupLocalRequest(e2) : this.setupRequest(e2), Promise.resolve().then(() => n2 ? this.requestLocal(e2) : de.wrappedRequest(e2, this.adapter.request));
  3589. }
  3590. requestLocal(e2) {
  3591. return new Promise((t2, n2) => {
  3592. this.adapter.request(Object.assign(e2, { complete(e3) {
  3593. if (e3 || (e3 = {}), !e3.statusCode || e3.statusCode >= 400) {
  3594. const t3 = e3.data && e3.data.code || "SYS_ERR", s2 = e3.data && e3.data.message || "request:fail";
  3595. return n2(new te({ code: t3, message: s2 }));
  3596. }
  3597. t2({ success: true, result: e3.data });
  3598. } }));
  3599. });
  3600. }
  3601. setupRequest(e2) {
  3602. const t2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), n2 = { "Content-Type": "application/json" };
  3603. n2["x-serverless-sign"] = de.sign(t2, this.config.clientSecret);
  3604. const s2 = he();
  3605. n2["x-client-info"] = encodeURIComponent(JSON.stringify(s2));
  3606. const { token: r2 } = re();
  3607. return n2["x-client-token"] = r2, { url: this.config.requestUrl, method: "POST", data: t2, dataType: "json", header: JSON.parse(JSON.stringify(n2)) };
  3608. }
  3609. async setupLocalRequest(e2) {
  3610. const t2 = he(), { token: n2 } = re(), s2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now(), clientInfo: t2, token: n2 }), { address: r2, servePort: i2 } = Ys.__dev__.debugInfo, { address: o2 } = await At(r2, i2);
  3611. return { url: `http://${o2}:${i2}/${Ct[e2.method]}`, method: "POST", data: s2, dataType: "json", header: JSON.parse(JSON.stringify({ "Content-Type": "application/json" })) };
  3612. }
  3613. callFunction(e2) {
  3614. const t2 = { method: "serverless.function.runtime.invoke", params: JSON.stringify({ functionTarget: e2.name, functionArgs: e2.data || {} }) };
  3615. return this.request(t2, false);
  3616. }
  3617. getUploadFileOptions(e2) {
  3618. const t2 = { method: "serverless.file.resource.generateProximalSign", params: JSON.stringify(e2) };
  3619. return this.request(t2);
  3620. }
  3621. reportUploadFile(e2) {
  3622. const t2 = { method: "serverless.file.resource.report", params: JSON.stringify(e2) };
  3623. return this.request(t2);
  3624. }
  3625. uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", onUploadProgress: s2 }) {
  3626. if (!t2)
  3627. throw new te({ code: "CLOUDPATH_REQUIRED", message: "cloudPath不可为空" });
  3628. let r2;
  3629. return this.getUploadFileOptions({ cloudPath: t2 }).then((t3) => {
  3630. const { url: i2, formData: o2, name: a2 } = t3.result;
  3631. return r2 = t3.result.fileUrl, new Promise((t4, r3) => {
  3632. const c2 = this.adapter.uploadFile({ url: i2, formData: o2, name: a2, filePath: e2, fileType: n2, success(e3) {
  3633. e3 && e3.statusCode < 400 ? t4(e3) : r3(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
  3634. }, fail(e3) {
  3635. r3(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
  3636. } });
  3637. "function" == typeof s2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => {
  3638. s2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
  3639. });
  3640. });
  3641. }).then(() => this.reportUploadFile({ cloudPath: t2 })).then((t3) => new Promise((n3, s3) => {
  3642. t3.success ? n3({ success: true, filePath: e2, fileID: r2 }) : s3(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
  3643. }));
  3644. }
  3645. deleteFile({ fileList: e2 }) {
  3646. const t2 = { method: "serverless.file.resource.delete", params: JSON.stringify({ fileList: e2 }) };
  3647. return this.request(t2).then((e3) => {
  3648. if (e3.success)
  3649. return e3.result;
  3650. throw new te({ code: "DELETE_FILE_FAILED", message: "删除文件失败" });
  3651. });
  3652. }
  3653. getTempFileURL({ fileList: e2, maxAge: t2 } = {}) {
  3654. if (!Array.isArray(e2) || 0 === e2.length)
  3655. throw new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
  3656. const n2 = { method: "serverless.file.resource.getTempFileURL", params: JSON.stringify({ fileList: e2, maxAge: t2 }) };
  3657. return this.request(n2).then((e3) => {
  3658. if (e3.success)
  3659. return { fileList: e3.result.fileList.map((e4) => ({ fileID: e4.fileID, tempFileURL: e4.tempFileURL })) };
  3660. throw new te({ code: "GET_TEMP_FILE_URL_FAILED", message: "获取临时文件链接失败" });
  3661. });
  3662. }
  3663. };
  3664. var Tt = { init(e2) {
  3665. const t2 = new Pt(e2), n2 = { signInAnonymously: function() {
  3666. return Promise.resolve();
  3667. }, getLoginState: function() {
  3668. return Promise.resolve(false);
  3669. } };
  3670. return t2.auth = function() {
  3671. return n2;
  3672. }, t2.customAuth = t2.auth, t2;
  3673. } }, xt = n(function(e2, t2) {
  3674. e2.exports = r.enc.Hex;
  3675. });
  3676. function Ot() {
  3677. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e2) {
  3678. var t2 = 16 * Math.random() | 0;
  3679. return ("x" === e2 ? t2 : 3 & t2 | 8).toString(16);
  3680. });
  3681. }
  3682. function Et(e2 = "", t2 = {}) {
  3683. const { data: n2, functionName: s2, method: r2, headers: i2, signHeaderKeys: o2 = [], config: a2 } = t2, c2 = Date.now(), u2 = Ot(), l2 = 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 }), h2 = ["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) {
  3684. const t3 = e3.signedHeaders.join(";"), n3 = e3.signedHeaders.map((t4) => `${t4.toLowerCase()}:${e3.headers[t4]}
  3685. `).join(""), s3 = we(e3.body).toString(xt), r3 = `${e3.method.toUpperCase()}
  3686. ${e3.path}
  3687. ${e3.query}
  3688. ${n3}
  3689. ${t3}
  3690. ${s3}
  3691. `, i3 = we(r3).toString(xt), o3 = `HMAC-SHA256
  3692. ${e3.timestamp}
  3693. ${i3}
  3694. `, a3 = ve(o3, e3.secretKey).toString(xt);
  3695. return `HMAC-SHA256 Credential=${e3.secretId}, SignedHeaders=${t3}, Signature=${a3}`;
  3696. }({ path: d2, query: p2, method: r2, headers: l2, timestamp: c2, body: JSON.stringify(n2), secretId: a2.accessKey, secretKey: a2.secretKey, signedHeaders: h2.sort() });
  3697. return { url: `${a2.endpoint}${e2}`, headers: Object.assign({}, l2, { Authorization: f2 }) };
  3698. }
  3699. function Lt({ url: e2, data: t2, method: n2 = "POST", headers: s2 = {}, timeout: r2 }) {
  3700. return new Promise((i2, o2) => {
  3701. ne.request({ url: e2, method: n2, data: "object" == typeof t2 ? JSON.stringify(t2) : t2, header: s2, dataType: "json", timeout: r2, complete: (e3 = {}) => {
  3702. const t3 = s2["x-trace-id"] || "";
  3703. if (!e3.statusCode || e3.statusCode >= 400) {
  3704. const { message: n3, errMsg: s3, trace_id: r3 } = e3.data || {};
  3705. return o2(new te({ code: "SYS_ERR", message: n3 || s3 || "request:fail", requestId: r3 || t3 }));
  3706. }
  3707. i2({ status: e3.statusCode, data: e3.data, headers: e3.header, requestId: t3 });
  3708. } });
  3709. });
  3710. }
  3711. function Rt(e2, t2) {
  3712. const { path: n2, data: s2, method: r2 = "GET" } = e2, { url: i2, headers: o2 } = Et(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 });
  3713. return Lt({ url: i2, data: s2, method: r2, headers: o2 }).then((e3) => {
  3714. const t3 = e3.data || {};
  3715. if (!t3.success)
  3716. throw new te({ code: e3.errCode, message: e3.errMsg, requestId: e3.requestId });
  3717. return t3.data || {};
  3718. }).catch((e3) => {
  3719. throw new te({ code: e3.errCode, message: e3.errMsg, requestId: e3.requestId });
  3720. });
  3721. }
  3722. function Ut(e2 = "") {
  3723. const t2 = e2.trim().replace(/^cloud:\/\//, ""), n2 = t2.indexOf("/");
  3724. if (n2 <= 0)
  3725. throw new te({ code: "INVALID_PARAM", message: "fileID不合法" });
  3726. const s2 = t2.substring(0, n2), r2 = t2.substring(n2 + 1);
  3727. return s2 !== this.config.spaceId && console.warn("file ".concat(e2, " does not belong to env ").concat(this.config.spaceId)), r2;
  3728. }
  3729. function Nt(e2 = "") {
  3730. return "cloud://".concat(this.config.spaceId, "/").concat(e2.replace(/^\/+/, ""));
  3731. }
  3732. class Dt {
  3733. constructor(e2) {
  3734. this.config = e2;
  3735. }
  3736. signedURL(e2, t2 = {}) {
  3737. const n2 = `/ws/function/${e2}`, s2 = this.config.wsEndpoint.replace(/^ws(s)?:\/\//, ""), r2 = Object.assign({}, t2, { accessKeyId: this.config.accessKey, signatureNonce: Ot(), timestamp: "" + Date.now() }), i2 = [n2, ["accessKeyId", "authorization", "signatureNonce", "timestamp"].sort().map(function(e3) {
  3738. return r2[e3] ? "".concat(e3, "=").concat(r2[e3]) : null;
  3739. }).filter(Boolean).join("&"), `host:${s2}`].join("\n"), o2 = ["HMAC-SHA256", we(i2).toString(xt)].join("\n"), a2 = ve(o2, this.config.secretKey).toString(xt), c2 = Object.keys(r2).map((e3) => `${e3}=${encodeURIComponent(r2[e3])}`).join("&");
  3740. return `${this.config.wsEndpoint}${n2}?${c2}&signature=${a2}`;
  3741. }
  3742. }
  3743. var Mt = class {
  3744. constructor(e2) {
  3745. if (["spaceId", "spaceAppId", "accessKey", "secretKey"].forEach((t2) => {
  3746. if (!Object.prototype.hasOwnProperty.call(e2, t2))
  3747. throw new Error(`${t2} required`);
  3748. }), e2.endpoint) {
  3749. if ("string" != typeof e2.endpoint)
  3750. throw new Error("endpoint must be string");
  3751. if (!/^https:\/\//.test(e2.endpoint))
  3752. throw new Error("endpoint must start with https://");
  3753. e2.endpoint = e2.endpoint.replace(/\/$/, "");
  3754. }
  3755. this.config = Object.assign({}, e2, { endpoint: e2.endpoint || `https://${e2.spaceId}.api-hz.cloudbasefunction.cn`, wsEndpoint: e2.wsEndpoint || `wss://${e2.spaceId}.api-hz.cloudbasefunction.cn` }), this._websocket = new Dt(this.config);
  3756. }
  3757. callFunction(e2) {
  3758. return function(e3, t2) {
  3759. const { name: n2, data: s2, async: r2 = false, timeout: i2 } = e3, o2 = "POST", a2 = { "x-to-function-name": n2 };
  3760. r2 && (a2["x-function-invoke-type"] = "async");
  3761. const { url: c2, headers: u2 } = Et("/functions/invokeFunction", { functionName: n2, data: s2, method: o2, headers: a2, signHeaderKeys: ["x-to-function-name"], config: t2 });
  3762. return Lt({ url: c2, data: s2, method: o2, headers: u2, timeout: i2 }).then((e4) => {
  3763. let t3 = 0;
  3764. if (r2) {
  3765. const n3 = e4.data || {};
  3766. t3 = "200" === n3.errCode ? 0 : n3.errCode, e4.data = n3.data || {}, e4.errMsg = n3.errMsg;
  3767. }
  3768. if (0 !== t3)
  3769. throw new te({ code: t3, message: e4.errMsg, requestId: e4.requestId });
  3770. return { errCode: t3, success: 0 === t3, requestId: e4.requestId, result: e4.data };
  3771. }).catch((e4) => {
  3772. throw new te({ code: e4.errCode, message: e4.errMsg, requestId: e4.requestId });
  3773. });
  3774. }(e2, this.config);
  3775. }
  3776. uploadFileToOSS({ url: e2, filePath: t2, fileType: n2, formData: s2, onUploadProgress: r2 }) {
  3777. return new Promise((i2, o2) => {
  3778. const a2 = ne.uploadFile({ url: e2, filePath: t2, fileType: n2, formData: s2, name: "file", success(e3) {
  3779. e3 && e3.statusCode < 400 ? i2(e3) : o2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
  3780. }, fail(e3) {
  3781. o2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
  3782. } });
  3783. "function" == typeof r2 && a2 && "function" == typeof a2.onProgressUpdate && a2.onProgressUpdate((e3) => {
  3784. r2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
  3785. });
  3786. });
  3787. }
  3788. async uploadFile({ filePath: e2, cloudPath: t2 = "", fileType: n2 = "image", onUploadProgress: s2 }) {
  3789. if ("string" !== f(t2))
  3790. throw new te({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });
  3791. if (!(t2 = t2.trim()))
  3792. throw new te({ code: "INVALID_PARAM", message: "cloudPath不可为空" });
  3793. if (/:\/\//.test(t2))
  3794. throw new te({ code: "INVALID_PARAM", message: "cloudPath不合法" });
  3795. const r2 = await Rt({ 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), {});
  3796. return this.uploadFileToOSS({ url: o2, filePath: e2, fileType: n2, formData: c2, onUploadProgress: s2 }).then(() => ({ fileID: i2 }));
  3797. }
  3798. async getTempFileURL({ fileList: e2 }) {
  3799. return new Promise((t2, n2) => {
  3800. (!e2 || e2.length < 0) && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList不能为空数组" })), e2.length > 50 && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList数组长度不能超过50" }));
  3801. const s2 = [];
  3802. for (const t3 of e2) {
  3803. "string" !== f(t3) && n2(new te({ errCode: "INVALID_PARAM", errMsg: "fileList的元素必须是非空的字符串" }));
  3804. const e3 = Ut.call(this, t3);
  3805. s2.push({ file_id: e3, expire: 600 });
  3806. }
  3807. Rt({ path: "/?download_url", data: { file_list: s2 }, method: "POST" }, this.config).then((e3) => {
  3808. const { file_list: n3 = [] } = e3;
  3809. t2({ fileList: n3.map((e4) => ({ fileID: Nt.call(this, e4.file_id), tempFileURL: e4.download_url })) });
  3810. }).catch((e3) => n2(e3));
  3811. });
  3812. }
  3813. async connectWebSocket(e2) {
  3814. const { name: t2, query: n2 } = e2;
  3815. return ne.connectSocket({ url: this._websocket.signedURL(t2, n2), complete: () => {
  3816. } });
  3817. }
  3818. };
  3819. var qt = { init: (e2) => {
  3820. e2.provider = "alipay";
  3821. const t2 = new Mt(e2);
  3822. return t2.auth = function() {
  3823. return { signInAnonymously: function() {
  3824. return Promise.resolve();
  3825. }, getLoginState: function() {
  3826. return Promise.resolve(true);
  3827. } };
  3828. }, t2;
  3829. } };
  3830. function Ft({ data: e2 }) {
  3831. let t2;
  3832. t2 = he();
  3833. const n2 = JSON.parse(JSON.stringify(e2 || {}));
  3834. if (Object.assign(n2, { clientInfo: t2 }), !n2.uniIdToken) {
  3835. const { token: e3 } = re();
  3836. e3 && (n2.uniIdToken = e3);
  3837. }
  3838. return n2;
  3839. }
  3840. async function Kt(e2 = {}) {
  3841. await this.__dev__.initLocalNetwork();
  3842. const { localAddress: t2, localPort: n2 } = this.__dev__, s2 = { aliyun: "aliyun", tencent: "tcb", alipay: "alipay", dcloud: "dcloud" }[this.config.provider], r2 = this.config.spaceId, i2 = `http://${t2}:${n2}/system/check-function`, o2 = `http://${t2}:${n2}/cloudfunctions/${e2.name}`;
  3843. return new Promise((t3, n3) => {
  3844. ne.request({ method: "POST", url: i2, data: { name: e2.name, platform: C, provider: s2, spaceId: r2 }, timeout: 3e3, success(e3) {
  3845. t3(e3);
  3846. }, fail() {
  3847. t3({ data: { code: "NETWORK_ERROR", message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。" } });
  3848. } });
  3849. }).then(({ data: e3 } = {}) => {
  3850. const { code: t3, message: n3 } = e3 || {};
  3851. return { code: 0 === t3 ? 0 : t3 || "SYS_ERR", message: n3 || "SYS_ERR" };
  3852. }).then(({ code: t3, message: n3 }) => {
  3853. if (0 !== t3) {
  3854. switch (t3) {
  3855. case "MODULE_ENCRYPTED":
  3856. console.error(`此云函数(${e2.name})依赖加密公共模块不可本地调试,自动切换为云端已部署的云函数`);
  3857. break;
  3858. case "FUNCTION_ENCRYPTED":
  3859. console.error(`此云函数(${e2.name})已加密不可本地调试,自动切换为云端已部署的云函数`);
  3860. break;
  3861. case "ACTION_ENCRYPTED":
  3862. console.error(n3 || "需要访问加密的uni-clientDB-action,自动切换为云端环境");
  3863. break;
  3864. case "NETWORK_ERROR":
  3865. console.error(n3 || "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下");
  3866. break;
  3867. case "SWITCH_TO_CLOUD":
  3868. break;
  3869. default: {
  3870. const e3 = `检测本地调试服务出现错误:${n3},请检查网络环境或重启客户端再试`;
  3871. throw console.error(e3), new Error(e3);
  3872. }
  3873. }
  3874. return this._callCloudFunction(e2);
  3875. }
  3876. return new Promise((t4, n4) => {
  3877. const r3 = Ft.call(this, { data: e2.data });
  3878. ne.request({ method: "POST", url: o2, data: { provider: s2, platform: C, param: r3 }, timeout: e2.timeout, success: ({ statusCode: e3, data: s3 } = {}) => !e3 || e3 >= 400 ? n4(new te({ code: s3.code || "SYS_ERR", message: s3.message || "request:fail" })) : t4({ result: s3 }), fail(e3) {
  3879. n4(new te({ code: e3.code || e3.errCode || "SYS_ERR", message: e3.message || e3.errMsg || "request:fail" }));
  3880. } });
  3881. });
  3882. });
  3883. }
  3884. const jt = [{ rule: /fc_function_not_found|FUNCTION_NOT_FOUND/, content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间", mode: "append" }];
  3885. var $t = /[\\^$.*+?()[\]{}|]/g, Bt = RegExp($t.source);
  3886. function Wt(e2, t2, n2) {
  3887. return e2.replace(new RegExp((s2 = t2) && Bt.test(s2) ? s2.replace($t, "\\$&") : s2, "g"), n2);
  3888. var s2;
  3889. }
  3890. const Jt = "request", zt = "response", Vt = "both";
  3891. const En = { code: 2e4, message: "System error" }, Ln = { code: 20101, message: "Invalid client" };
  3892. function Nn(e2) {
  3893. const { errSubject: t2, subject: n2, errCode: s2, errMsg: r2, code: i2, message: o2, cause: a2 } = e2 || {};
  3894. return new te({ subject: t2 || n2 || "uni-secure-network", code: s2 || i2 || En.code, message: r2 || o2, cause: a2 });
  3895. }
  3896. let Mn;
  3897. function $n({ secretType: e2 } = {}) {
  3898. return e2 === Jt || e2 === zt || e2 === Vt;
  3899. }
  3900. function Bn({ name: e2, data: t2 = {} } = {}) {
  3901. return "DCloud-clientDB" === e2 && "encryption" === t2.redirectTo && "getAppClientKey" === t2.action;
  3902. }
  3903. function Wn({ provider: e2, spaceId: t2, functionName: n2 } = {}) {
  3904. const { appId: s2, uniPlatform: r2, osName: i2 } = ce();
  3905. let o2 = r2;
  3906. "app" === r2 && (o2 = i2);
  3907. const a2 = function({ provider: e3, spaceId: t3 } = {}) {
  3908. const n3 = A;
  3909. if (!n3)
  3910. return {};
  3911. e3 = /* @__PURE__ */ function(e4) {
  3912. return "tencent" === e4 ? "tcb" : e4;
  3913. }(e3);
  3914. const s3 = n3.find((n4) => n4.provider === e3 && n4.spaceId === t3);
  3915. return s3 && s3.config;
  3916. }({ provider: e2, spaceId: t2 });
  3917. if (!a2 || !a2.accessControl || !a2.accessControl.enable)
  3918. return false;
  3919. const c2 = a2.accessControl.function || {}, u2 = Object.keys(c2);
  3920. if (0 === u2.length)
  3921. return true;
  3922. const l2 = function(e3, t3) {
  3923. let n3, s3, r3;
  3924. for (let i3 = 0; i3 < e3.length; i3++) {
  3925. const o3 = e3[i3];
  3926. o3 !== t3 ? "*" !== o3 ? o3.split(",").map((e4) => e4.trim()).indexOf(t3) > -1 && (s3 = o3) : r3 = o3 : n3 = o3;
  3927. }
  3928. return n3 || s3 || r3;
  3929. }(u2, n2);
  3930. if (!l2)
  3931. return false;
  3932. if ((c2[l2] || []).find((e3 = {}) => e3.appId === s2 && (e3.platform || "").toLowerCase() === o2.toLowerCase()))
  3933. return true;
  3934. throw console.error(`此应用[appId: ${s2}, platform: ${o2}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`), Nn(Ln);
  3935. }
  3936. function Hn({ functionName: e2, result: t2, logPvd: n2 }) {
  3937. if (this.__dev__.debugLog && t2 && t2.requestId) {
  3938. const s2 = JSON.stringify({ spaceId: this.config.spaceId, functionName: e2, requestId: t2.requestId });
  3939. console.log(`[${n2}-request]${s2}[/${n2}-request]`);
  3940. }
  3941. }
  3942. function Jn(e2) {
  3943. const t2 = e2.callFunction, n2 = function(n3) {
  3944. const s2 = n3.name;
  3945. n3.data = Ft.call(e2, { data: n3.data });
  3946. const r2 = { aliyun: "aliyun", tencent: "tcb", tcb: "tcb", alipay: "alipay", dcloud: "dcloud" }[this.config.provider], i2 = $n(n3), o2 = Bn(n3), a2 = i2 || o2;
  3947. return t2.call(this, n3).then((e3) => (e3.errCode = 0, !a2 && Hn.call(this, { functionName: s2, result: e3, logPvd: r2 }), Promise.resolve(e3)), (e3) => (!a2 && Hn.call(this, { functionName: s2, result: e3, logPvd: r2 }), e3 && e3.message && (e3.message = function({ message: e4 = "", extraInfo: t3 = {}, formatter: n4 = [] } = {}) {
  3948. for (let s3 = 0; s3 < n4.length; s3++) {
  3949. const { rule: r3, content: i3, mode: o3 } = n4[s3], a3 = e4.match(r3);
  3950. if (!a3)
  3951. continue;
  3952. let c2 = i3;
  3953. for (let e5 = 1; e5 < a3.length; e5++)
  3954. c2 = Wt(c2, `{$${e5}}`, a3[e5]);
  3955. for (const e5 in t3)
  3956. c2 = Wt(c2, `{${e5}}`, t3[e5]);
  3957. return "replace" === o3 ? c2 : e4 + c2;
  3958. }
  3959. return e4;
  3960. }({ message: `[${n3.name}]: ${e3.message}`, formatter: jt, extraInfo: { functionName: s2 } })), Promise.reject(e3)));
  3961. };
  3962. e2.callFunction = function(t3) {
  3963. const { provider: s2, spaceId: r2 } = e2.config, i2 = t3.name;
  3964. let o2, a2;
  3965. if (t3.data = t3.data || {}, e2.__dev__.debugInfo && !e2.__dev__.debugInfo.forceRemote && T ? (e2._callCloudFunction || (e2._callCloudFunction = n2, e2._callLocalFunction = Kt), o2 = Kt) : o2 = n2, o2 = o2.bind(e2), Bn(t3))
  3966. a2 = n2.call(e2, t3);
  3967. else if ($n(t3)) {
  3968. a2 = new Mn({ secretType: t3.secretType, uniCloudIns: e2 }).wrapEncryptDataCallFunction(n2.bind(e2))(t3);
  3969. } else if (Wn({ provider: s2, spaceId: r2, functionName: i2 })) {
  3970. a2 = new Mn({ secretType: t3.secretType, uniCloudIns: e2 }).wrapVerifyClientCallFunction(n2.bind(e2))(t3);
  3971. } else
  3972. a2 = o2(t3);
  3973. 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));
  3974. };
  3975. }
  3976. Mn = class {
  3977. constructor() {
  3978. throw Nn({ message: `Platform ${C} is not enabled, please check whether secure network module is enabled in your manifest.json` });
  3979. }
  3980. };
  3981. const zn = Symbol("CLIENT_DB_INTERNAL");
  3982. function Vn(e2, t2) {
  3983. return e2.then = "DoNotReturnProxyWithAFunctionNamedThen", e2._internalType = zn, e2.inspect = null, e2.__v_raw = void 0, new Proxy(e2, { get(e3, n2, s2) {
  3984. if ("_uniClient" === n2)
  3985. return null;
  3986. if ("symbol" == typeof n2)
  3987. return e3[n2];
  3988. if (n2 in e3 || "string" != typeof n2) {
  3989. const t3 = e3[n2];
  3990. return "function" == typeof t3 ? t3.bind(e3) : t3;
  3991. }
  3992. return t2.get(e3, n2, s2);
  3993. } });
  3994. }
  3995. function Gn(e2) {
  3996. return { on: (t2, n2) => {
  3997. e2[t2] = e2[t2] || [], e2[t2].indexOf(n2) > -1 || e2[t2].push(n2);
  3998. }, off: (t2, n2) => {
  3999. e2[t2] = e2[t2] || [];
  4000. const s2 = e2[t2].indexOf(n2);
  4001. -1 !== s2 && e2[t2].splice(s2, 1);
  4002. } };
  4003. }
  4004. const Yn = ["db.Geo", "db.command", "command.aggregate"];
  4005. function Qn(e2, t2) {
  4006. return Yn.indexOf(`${e2}.${t2}`) > -1;
  4007. }
  4008. function Xn(e2) {
  4009. switch (f(e2 = se(e2))) {
  4010. case "array":
  4011. return e2.map((e3) => Xn(e3));
  4012. case "object":
  4013. return e2._internalType === zn || Object.keys(e2).forEach((t2) => {
  4014. e2[t2] = Xn(e2[t2]);
  4015. }), e2;
  4016. case "regexp":
  4017. return { $regexp: { source: e2.source, flags: e2.flags } };
  4018. case "date":
  4019. return { $date: e2.toISOString() };
  4020. default:
  4021. return e2;
  4022. }
  4023. }
  4024. function Zn(e2) {
  4025. return e2 && e2.content && e2.content.$method;
  4026. }
  4027. class es {
  4028. constructor(e2, t2, n2) {
  4029. this.content = e2, this.prevStage = t2 || null, this.udb = null, this._database = n2;
  4030. }
  4031. toJSON() {
  4032. let e2 = this;
  4033. const t2 = [e2.content];
  4034. for (; e2.prevStage; )
  4035. e2 = e2.prevStage, t2.push(e2.content);
  4036. return { $db: t2.reverse().map((e3) => ({ $method: e3.$method, $param: Xn(e3.$param) })) };
  4037. }
  4038. toString() {
  4039. return JSON.stringify(this.toJSON());
  4040. }
  4041. getAction() {
  4042. const e2 = this.toJSON().$db.find((e3) => "action" === e3.$method);
  4043. return e2 && e2.$param && e2.$param[0];
  4044. }
  4045. getCommand() {
  4046. return { $db: this.toJSON().$db.filter((e2) => "action" !== e2.$method) };
  4047. }
  4048. get isAggregate() {
  4049. let e2 = this;
  4050. for (; e2; ) {
  4051. const t2 = Zn(e2), n2 = Zn(e2.prevStage);
  4052. if ("aggregate" === t2 && "collection" === n2 || "pipeline" === t2)
  4053. return true;
  4054. e2 = e2.prevStage;
  4055. }
  4056. return false;
  4057. }
  4058. get isCommand() {
  4059. let e2 = this;
  4060. for (; e2; ) {
  4061. if ("command" === Zn(e2))
  4062. return true;
  4063. e2 = e2.prevStage;
  4064. }
  4065. return false;
  4066. }
  4067. get isAggregateCommand() {
  4068. let e2 = this;
  4069. for (; e2; ) {
  4070. const t2 = Zn(e2), n2 = Zn(e2.prevStage);
  4071. if ("aggregate" === t2 && "command" === n2)
  4072. return true;
  4073. e2 = e2.prevStage;
  4074. }
  4075. return false;
  4076. }
  4077. getNextStageFn(e2) {
  4078. const t2 = this;
  4079. return function() {
  4080. return ts({ $method: e2, $param: Xn(Array.from(arguments)) }, t2, t2._database);
  4081. };
  4082. }
  4083. get count() {
  4084. return this.isAggregate ? this.getNextStageFn("count") : function() {
  4085. return this._send("count", Array.from(arguments));
  4086. };
  4087. }
  4088. get remove() {
  4089. return this.isCommand ? this.getNextStageFn("remove") : function() {
  4090. return this._send("remove", Array.from(arguments));
  4091. };
  4092. }
  4093. get() {
  4094. return this._send("get", Array.from(arguments));
  4095. }
  4096. get add() {
  4097. return this.isCommand ? this.getNextStageFn("add") : function() {
  4098. return this._send("add", Array.from(arguments));
  4099. };
  4100. }
  4101. update() {
  4102. return this._send("update", Array.from(arguments));
  4103. }
  4104. end() {
  4105. return this._send("end", Array.from(arguments));
  4106. }
  4107. get set() {
  4108. return this.isCommand ? this.getNextStageFn("set") : function() {
  4109. throw new Error("JQL禁止使用set方法");
  4110. };
  4111. }
  4112. _send(e2, t2) {
  4113. const n2 = this.getAction(), s2 = this.getCommand();
  4114. if (s2.$db.push({ $method: e2, $param: Xn(t2) }), S) {
  4115. const e3 = s2.$db.find((e4) => "collection" === e4.$method), t3 = e3 && e3.$param;
  4116. 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- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");
  4117. }
  4118. return this._database._callCloudFunction({ action: n2, command: s2 });
  4119. }
  4120. }
  4121. function ts(e2, t2, n2) {
  4122. return Vn(new es(e2, t2, n2), { get(e3, t3) {
  4123. let s2 = "db";
  4124. return e3 && e3.content && (s2 = e3.content.$method), Qn(s2, t3) ? ts({ $method: t3 }, e3, n2) : function() {
  4125. return ts({ $method: t3, $param: Xn(Array.from(arguments)) }, e3, n2);
  4126. };
  4127. } });
  4128. }
  4129. function ns({ path: e2, method: t2 }) {
  4130. return class {
  4131. constructor() {
  4132. this.param = Array.from(arguments);
  4133. }
  4134. toJSON() {
  4135. return { $newDb: [...e2.map((e3) => ({ $method: e3 })), { $method: t2, $param: this.param }] };
  4136. }
  4137. toString() {
  4138. return JSON.stringify(this.toJSON());
  4139. }
  4140. };
  4141. }
  4142. function ss(e2, t2 = {}) {
  4143. return Vn(new e2(t2), { get: (e3, t3) => Qn("db", t3) ? ts({ $method: t3 }, null, e3) : function() {
  4144. return ts({ $method: t3, $param: Xn(Array.from(arguments)) }, null, e3);
  4145. } });
  4146. }
  4147. class rs extends class {
  4148. constructor({ uniClient: e2 = {}, isJQL: t2 = false } = {}) {
  4149. this._uniClient = e2, this._authCallBacks = {}, this._dbCallBacks = {}, e2._isDefault && (this._dbCallBacks = L("_globalUniCloudDatabaseCallback")), t2 || (this.auth = Gn(this._authCallBacks)), this._isJQL = t2, Object.assign(this, Gn(this._dbCallBacks)), this.env = Vn({}, { get: (e3, t3) => ({ $env: t3 }) }), this.Geo = Vn({}, { get: (e3, t3) => ns({ path: ["Geo"], method: t3 }) }), this.serverDate = ns({ path: [], method: "serverDate" }), this.RegExp = ns({ path: [], method: "RegExp" });
  4150. }
  4151. getCloudEnv(e2) {
  4152. if ("string" != typeof e2 || !e2.trim())
  4153. throw new Error("getCloudEnv参数错误");
  4154. return { $env: e2.replace("$cloudEnv_", "") };
  4155. }
  4156. _callback(e2, t2) {
  4157. const n2 = this._dbCallBacks;
  4158. n2[e2] && n2[e2].forEach((e3) => {
  4159. e3(...t2);
  4160. });
  4161. }
  4162. _callbackAuth(e2, t2) {
  4163. const n2 = this._authCallBacks;
  4164. n2[e2] && n2[e2].forEach((e3) => {
  4165. e3(...t2);
  4166. });
  4167. }
  4168. multiSend() {
  4169. const e2 = Array.from(arguments), t2 = e2.map((e3) => {
  4170. const t3 = e3.getAction(), n2 = e3.getCommand();
  4171. if ("getTemp" !== n2.$db[n2.$db.length - 1].$method)
  4172. throw new Error("multiSend只支持子命令内使用getTemp");
  4173. return { action: t3, command: n2 };
  4174. });
  4175. return this._callCloudFunction({ multiCommand: t2, queryList: e2 });
  4176. }
  4177. } {
  4178. _parseResult(e2) {
  4179. return this._isJQL ? e2.result : e2;
  4180. }
  4181. _callCloudFunction({ action: e2, command: t2, multiCommand: n2, queryList: s2 }) {
  4182. function r2(e3, t3) {
  4183. if (n2 && s2)
  4184. for (let n3 = 0; n3 < s2.length; n3++) {
  4185. const r3 = s2[n3];
  4186. r3.udb && "function" == typeof r3.udb.setResult && (t3 ? r3.udb.setResult(t3) : r3.udb.setResult(e3.result.dataList[n3]));
  4187. }
  4188. }
  4189. const i2 = this, o2 = this._isJQL ? "databaseForJQL" : "database";
  4190. function a2(e3) {
  4191. 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)));
  4192. }
  4193. const c2 = M(q(o2, "invoke")), u2 = this._uniClient;
  4194. return c2.then(() => u2.callFunction({ name: "DCloud-clientDB", type: l, data: { action: e2, command: t2, multiCommand: n2 } })).then((e3) => {
  4195. const { code: t3, message: n3, token: s3, tokenExpired: c3, systemInfo: u3 = [] } = e3.result;
  4196. if (u3)
  4197. for (let e4 = 0; e4 < u3.length; e4++) {
  4198. const { level: t4, message: n4, detail: s4 } = u3[e4], r3 = console["warn" === t4 ? "error" : t4] || console.log;
  4199. let i3 = "[System Info]" + n4;
  4200. s4 && (i3 = `${i3}
  4201. 详细信息:${s4}`), r3(i3);
  4202. }
  4203. if (t3) {
  4204. return a2(new te({ code: t3, message: n3, requestId: e3.requestId }));
  4205. }
  4206. 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 }));
  4207. const l2 = [{ prop: "affectedDocs", tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代" }, { prop: "code", tips: "code不再推荐使用,请使用errCode替代" }, { prop: "message", tips: "message不再推荐使用,请使用errMsg替代" }];
  4208. for (let t4 = 0; t4 < l2.length; t4++) {
  4209. const { prop: n4, tips: s4 } = l2[t4];
  4210. if (n4 in e3.result) {
  4211. const t5 = e3.result[n4];
  4212. Object.defineProperty(e3.result, n4, { get: () => (console.warn(s4), t5) });
  4213. }
  4214. }
  4215. return function(e4) {
  4216. return M(q(o2, "success"), e4).then(() => M(q(o2, "complete"), e4)).then(() => {
  4217. r2(e4, null);
  4218. const t4 = i2._parseResult(e4);
  4219. return Y(j, { type: W, content: t4 }), Promise.resolve(t4);
  4220. });
  4221. }(e3);
  4222. }, (e3) => {
  4223. /fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e3.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB");
  4224. return a2(new te({ code: e3.code || "SYSTEM_ERROR", message: e3.message, requestId: e3.requestId }));
  4225. });
  4226. }
  4227. }
  4228. const is = "token无效,跳转登录页面", os = "token过期,跳转登录页面", as = { TOKEN_INVALID_TOKEN_EXPIRED: os, TOKEN_INVALID_INVALID_CLIENTID: is, TOKEN_INVALID: is, TOKEN_INVALID_WRONG_TOKEN: is, TOKEN_INVALID_ANONYMOUS_USER: is }, cs = { "uni-id-token-expired": os, "uni-id-check-token-failed": is, "uni-id-token-not-exist": is, "uni-id-check-device-feature-failed": is };
  4229. function us(e2, t2) {
  4230. let n2 = "";
  4231. return n2 = e2 ? `${e2}/${t2}` : t2, n2.replace(/^\//, "");
  4232. }
  4233. function ls(e2 = [], t2 = "") {
  4234. const n2 = [], s2 = [];
  4235. return e2.forEach((e3) => {
  4236. true === e3.needLogin ? n2.push(us(t2, e3.path)) : false === e3.needLogin && s2.push(us(t2, e3.path));
  4237. }), { needLoginPage: n2, notNeedLoginPage: s2 };
  4238. }
  4239. function hs(e2) {
  4240. return e2.split("?")[0].replace(/^\//, "");
  4241. }
  4242. function ds() {
  4243. return function(e2) {
  4244. let t2 = e2 && e2.$page && e2.$page.fullPath || "";
  4245. return t2 ? ("/" !== t2.charAt(0) && (t2 = "/" + t2), t2) : t2;
  4246. }(function() {
  4247. const e2 = getCurrentPages();
  4248. return e2[e2.length - 1];
  4249. }());
  4250. }
  4251. function ps() {
  4252. return hs(ds());
  4253. }
  4254. function fs(e2 = "", t2 = {}) {
  4255. if (!e2)
  4256. return false;
  4257. if (!(t2 && t2.list && t2.list.length))
  4258. return false;
  4259. const n2 = t2.list, s2 = hs(e2);
  4260. return n2.some((e3) => e3.pagePath === s2);
  4261. }
  4262. const gs = !!e.uniIdRouter;
  4263. const { loginPage: ms, routerNeedLogin: ys, resToLogin: _s, needLoginPage: ws, notNeedLoginPage: vs, loginPageInTabBar: Is } = function({ pages: t2 = [], subPackages: n2 = [], uniIdRouter: s2 = {}, tabBar: r2 = {} } = e) {
  4264. const { loginPage: i2, needLogin: o2 = [], resToLogin: a2 = true } = s2, { needLoginPage: c2, notNeedLoginPage: u2 } = ls(t2), { needLoginPage: l2, notNeedLoginPage: h2 } = function(e2 = []) {
  4265. const t3 = [], n3 = [];
  4266. return e2.forEach((e3) => {
  4267. const { root: s3, pages: r3 = [] } = e3, { needLoginPage: i3, notNeedLoginPage: o3 } = ls(r3, s3);
  4268. t3.push(...i3), n3.push(...o3);
  4269. }), { needLoginPage: t3, notNeedLoginPage: n3 };
  4270. }(n2);
  4271. return { loginPage: i2, routerNeedLogin: o2, resToLogin: a2, needLoginPage: [...c2, ...l2], notNeedLoginPage: [...u2, ...h2], loginPageInTabBar: fs(i2, r2) };
  4272. }();
  4273. if (ws.indexOf(ms) > -1)
  4274. throw new Error(`Login page [${ms}] should not be "needLogin", please check your pages.json`);
  4275. function Ss(e2) {
  4276. const t2 = ps();
  4277. if ("/" === e2.charAt(0))
  4278. return e2;
  4279. const [n2, s2] = e2.split("?"), r2 = n2.replace(/^\//, "").split("/"), i2 = t2.split("/");
  4280. i2.pop();
  4281. for (let e3 = 0; e3 < r2.length; e3++) {
  4282. const t3 = r2[e3];
  4283. ".." === t3 ? i2.pop() : "." !== t3 && i2.push(t3);
  4284. }
  4285. return "" === i2[0] && i2.shift(), "/" + i2.join("/") + (s2 ? "?" + s2 : "");
  4286. }
  4287. function bs(e2) {
  4288. const t2 = hs(Ss(e2));
  4289. return !(vs.indexOf(t2) > -1) && (ws.indexOf(t2) > -1 || ys.some((t3) => function(e3, t4) {
  4290. return new RegExp(t4).test(e3);
  4291. }(e2, t3)));
  4292. }
  4293. function ks({ redirect: e2 }) {
  4294. const t2 = hs(e2), n2 = hs(ms);
  4295. return ps() !== n2 && t2 !== n2;
  4296. }
  4297. function As({ api: e2, redirect: t2 } = {}) {
  4298. if (!t2 || !ks({ redirect: t2 }))
  4299. return;
  4300. const n2 = function(e3, t3) {
  4301. return "/" !== e3.charAt(0) && (e3 = "/" + e3), t3 ? e3.indexOf("?") > -1 ? e3 + `&uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3 + `?uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3;
  4302. }(ms, t2);
  4303. Is ? "navigateTo" !== e2 && "redirectTo" !== e2 || (e2 = "switchTab") : "switchTab" === e2 && (e2 = "navigateTo");
  4304. const s2 = { navigateTo: uni.navigateTo, redirectTo: uni.redirectTo, switchTab: uni.switchTab, reLaunch: uni.reLaunch };
  4305. setTimeout(() => {
  4306. s2[e2]({ url: n2 });
  4307. }, 0);
  4308. }
  4309. function Cs({ url: e2 } = {}) {
  4310. const t2 = { abortLoginPageJump: false, autoToLoginPage: false }, n2 = function() {
  4311. const { token: e3, tokenExpired: t3 } = re();
  4312. let n3;
  4313. if (e3) {
  4314. if (t3 < Date.now()) {
  4315. const e4 = "uni-id-token-expired";
  4316. n3 = { errCode: e4, errMsg: cs[e4] };
  4317. }
  4318. } else {
  4319. const e4 = "uni-id-check-token-failed";
  4320. n3 = { errCode: e4, errMsg: cs[e4] };
  4321. }
  4322. return n3;
  4323. }();
  4324. if (bs(e2) && n2) {
  4325. n2.uniIdRedirectUrl = e2;
  4326. if (z($).length > 0)
  4327. return setTimeout(() => {
  4328. Y($, n2);
  4329. }, 0), t2.abortLoginPageJump = true, t2;
  4330. t2.autoToLoginPage = true;
  4331. }
  4332. return t2;
  4333. }
  4334. function Ps() {
  4335. !function() {
  4336. const e3 = ds(), { abortLoginPageJump: t2, autoToLoginPage: n2 } = Cs({ url: e3 });
  4337. t2 || n2 && As({ api: "redirectTo", redirect: e3 });
  4338. }();
  4339. const e2 = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
  4340. for (let t2 = 0; t2 < e2.length; t2++) {
  4341. const n2 = e2[t2];
  4342. uni.addInterceptor(n2, { invoke(e3) {
  4343. const { abortLoginPageJump: t3, autoToLoginPage: s2 } = Cs({ url: e3.url });
  4344. return t3 ? e3 : s2 ? (As({ api: n2, redirect: Ss(e3.url) }), false) : e3;
  4345. } });
  4346. }
  4347. }
  4348. function Ts() {
  4349. this.onResponse((e2) => {
  4350. const { type: t2, content: n2 } = e2;
  4351. let s2 = false;
  4352. switch (t2) {
  4353. case "cloudobject":
  4354. s2 = function(e3) {
  4355. if ("object" != typeof e3)
  4356. return false;
  4357. const { errCode: t3 } = e3 || {};
  4358. return t3 in cs;
  4359. }(n2);
  4360. break;
  4361. case "clientdb":
  4362. s2 = function(e3) {
  4363. if ("object" != typeof e3)
  4364. return false;
  4365. const { errCode: t3 } = e3 || {};
  4366. return t3 in as;
  4367. }(n2);
  4368. }
  4369. s2 && function(e3 = {}) {
  4370. const t3 = z($);
  4371. Z().then(() => {
  4372. const n3 = ds();
  4373. if (n3 && ks({ redirect: n3 }))
  4374. return t3.length > 0 ? Y($, Object.assign({ uniIdRedirectUrl: n3 }, e3)) : void (ms && As({ api: "navigateTo", redirect: n3 }));
  4375. });
  4376. }(n2);
  4377. });
  4378. }
  4379. function xs(e2) {
  4380. !function(e3) {
  4381. e3.onResponse = function(e4) {
  4382. V(j, e4);
  4383. }, e3.offResponse = function(e4) {
  4384. G(j, e4);
  4385. };
  4386. }(e2), function(e3) {
  4387. e3.onNeedLogin = function(e4) {
  4388. V($, e4);
  4389. }, e3.offNeedLogin = function(e4) {
  4390. G($, e4);
  4391. }, gs && (L("_globalUniCloudStatus").needLoginInit || (L("_globalUniCloudStatus").needLoginInit = true, Z().then(() => {
  4392. Ps.call(e3);
  4393. }), _s && Ts.call(e3)));
  4394. }(e2), function(e3) {
  4395. e3.onRefreshToken = function(e4) {
  4396. V(B, e4);
  4397. }, e3.offRefreshToken = function(e4) {
  4398. G(B, e4);
  4399. };
  4400. }(e2);
  4401. }
  4402. let Os;
  4403. const Es = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", Ls = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  4404. function Rs() {
  4405. const e2 = re().token || "", t2 = e2.split(".");
  4406. if (!e2 || 3 !== t2.length)
  4407. return { uid: null, role: [], permission: [], tokenExpired: 0 };
  4408. let n2;
  4409. try {
  4410. n2 = JSON.parse((s2 = t2[1], decodeURIComponent(Os(s2).split("").map(function(e3) {
  4411. return "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2);
  4412. }).join(""))));
  4413. } catch (e3) {
  4414. throw new Error("获取当前用户信息出错,详细错误信息为:" + e3.message);
  4415. }
  4416. var s2;
  4417. return n2.tokenExpired = 1e3 * n2.exp, delete n2.exp, delete n2.iat, n2;
  4418. }
  4419. Os = "function" != typeof atob ? function(e2) {
  4420. if (e2 = String(e2).replace(/[\t\n\f\r ]+/g, ""), !Ls.test(e2))
  4421. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  4422. var t2;
  4423. e2 += "==".slice(2 - (3 & e2.length));
  4424. for (var n2, s2, r2 = "", i2 = 0; i2 < e2.length; )
  4425. t2 = Es.indexOf(e2.charAt(i2++)) << 18 | Es.indexOf(e2.charAt(i2++)) << 12 | (n2 = Es.indexOf(e2.charAt(i2++))) << 6 | (s2 = Es.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);
  4426. return r2;
  4427. } : atob;
  4428. var Us = n(function(e2, t2) {
  4429. Object.defineProperty(t2, "__esModule", { value: true });
  4430. const n2 = "chooseAndUploadFile:ok", s2 = "chooseAndUploadFile:fail";
  4431. function r2(e3, t3) {
  4432. return e3.tempFiles.forEach((e4, n3) => {
  4433. 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("."));
  4434. }), e3.tempFilePaths || (e3.tempFilePaths = e3.tempFiles.map((e4) => e4.path)), e3;
  4435. }
  4436. function i2(e3, t3, { onChooseFile: s3, onUploadProgress: r3 }) {
  4437. return t3.then((e4) => {
  4438. if (s3) {
  4439. const t4 = s3(e4);
  4440. if (void 0 !== t4)
  4441. return Promise.resolve(t4).then((t5) => void 0 === t5 ? e4 : t5);
  4442. }
  4443. return e4;
  4444. }).then((t4) => false === t4 ? { errMsg: n2, tempFilePaths: [], tempFiles: [] } : function(e4, t5, s4 = 5, r4) {
  4445. (t5 = Object.assign({}, t5)).errMsg = n2;
  4446. const i3 = t5.tempFiles, o2 = i3.length;
  4447. let a2 = 0;
  4448. return new Promise((n3) => {
  4449. for (; a2 < s4; )
  4450. c2();
  4451. function c2() {
  4452. const s5 = a2++;
  4453. if (s5 >= o2)
  4454. return void (!i3.find((e5) => !e5.url && !e5.errMsg) && n3(t5));
  4455. const u2 = i3[s5];
  4456. e4.uploadFile({ provider: u2.provider, filePath: u2.path, cloudPath: u2.cloudPath, fileType: u2.fileType, cloudPathAsRealPath: u2.cloudPathAsRealPath, onUploadProgress(e5) {
  4457. e5.index = s5, e5.tempFile = u2, e5.tempFilePath = u2.path, r4 && r4(e5);
  4458. } }).then((e5) => {
  4459. u2.url = e5.fileID, s5 < o2 && c2();
  4460. }).catch((e5) => {
  4461. u2.errMsg = e5.errMsg || e5.message, s5 < o2 && c2();
  4462. });
  4463. }
  4464. });
  4465. }(e3, t4, 5, r3));
  4466. }
  4467. t2.initChooseAndUploadFile = function(e3) {
  4468. return function(t3 = { type: "all" }) {
  4469. return "image" === t3.type ? i2(e3, function(e4) {
  4470. const { count: t4, sizeType: n3, sourceType: i3 = ["album", "camera"], extension: o2 } = e4;
  4471. return new Promise((e5, a2) => {
  4472. uni.chooseImage({ count: t4, sizeType: n3, sourceType: i3, extension: o2, success(t5) {
  4473. e5(r2(t5, "image"));
  4474. }, fail(e6) {
  4475. a2({ errMsg: e6.errMsg.replace("chooseImage:fail", s2) });
  4476. } });
  4477. });
  4478. }(t3), t3) : "video" === t3.type ? i2(e3, function(e4) {
  4479. const { camera: t4, compressed: n3, maxDuration: i3, sourceType: o2 = ["album", "camera"], extension: a2 } = e4;
  4480. return new Promise((e5, c2) => {
  4481. uni.chooseVideo({ camera: t4, compressed: n3, maxDuration: i3, sourceType: o2, extension: a2, success(t5) {
  4482. const { tempFilePath: n4, duration: s3, size: i4, height: o3, width: a3 } = t5;
  4483. 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"));
  4484. }, fail(e6) {
  4485. c2({ errMsg: e6.errMsg.replace("chooseVideo:fail", s2) });
  4486. } });
  4487. });
  4488. }(t3), t3) : i2(e3, function(e4) {
  4489. const { count: t4, extension: n3 } = e4;
  4490. return new Promise((e5, i3) => {
  4491. let o2 = uni.chooseFile;
  4492. if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o2 = wx.chooseMessageFile), "function" != typeof o2)
  4493. return i3({ errMsg: s2 + " 请指定 type 类型,该平台仅支持选择 image 或 video。" });
  4494. o2({ type: "all", count: t4, extension: n3, success(t5) {
  4495. e5(r2(t5));
  4496. }, fail(e6) {
  4497. i3({ errMsg: e6.errMsg.replace("chooseFile:fail", s2) });
  4498. } });
  4499. });
  4500. }(t3), t3);
  4501. };
  4502. };
  4503. }), Ns = t$2(Us);
  4504. const Ds = "manual";
  4505. function Ms(e2) {
  4506. 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() {
  4507. this.mixinDatacomPage = { current: this.pageCurrent, size: this.pageSize, count: 0 }, this.$watch(() => {
  4508. var e3 = [];
  4509. return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach((t2) => {
  4510. e3.push(this[t2]);
  4511. }), e3;
  4512. }, (e3, t2) => {
  4513. if (this.loadtime === Ds)
  4514. return;
  4515. let n2 = false;
  4516. const s2 = [];
  4517. for (let r2 = 2; r2 < e3.length; r2++)
  4518. e3[r2] !== t2[r2] && (s2.push(e3[r2]), n2 = true);
  4519. e3[0] !== t2[0] && (this.mixinDatacomPage.current = this.pageCurrent), this.mixinDatacomPage.size = this.pageSize, this.onMixinDatacomPropsChange(n2, s2);
  4520. });
  4521. }, methods: { onMixinDatacomPropsChange(e3, t2) {
  4522. }, mixinDatacomEasyGet({ getone: e3 = false, success: t2, fail: n2 } = {}) {
  4523. this.mixinDatacomLoading || (this.mixinDatacomLoading = true, this.mixinDatacomErrorMessage = "", this.mixinDatacomError = null, this.mixinDatacomGet().then((n3) => {
  4524. this.mixinDatacomLoading = false;
  4525. const { data: s2, count: r2 } = n3.result;
  4526. this.getcount && (this.mixinDatacomPage.count = r2), this.mixinDatacomHasMore = s2.length < this.pageSize;
  4527. const i2 = e3 ? s2.length ? s2[0] : void 0 : s2;
  4528. this.mixinDatacomResData = i2, t2 && t2(i2);
  4529. }).catch((e4) => {
  4530. this.mixinDatacomLoading = false, this.mixinDatacomErrorMessage = e4, this.mixinDatacomError = e4, n2 && n2(e4);
  4531. }));
  4532. }, mixinDatacomGet(t2 = {}) {
  4533. let n2;
  4534. t2 = t2 || {}, n2 = "undefined" != typeof __uniX && __uniX ? e2.databaseForJQL(this.spaceInfo) : e2.database(this.spaceInfo);
  4535. const s2 = t2.action || this.action;
  4536. s2 && (n2 = n2.action(s2));
  4537. const r2 = t2.collection || this.collection;
  4538. n2 = Array.isArray(r2) ? n2.collection(...r2) : n2.collection(r2);
  4539. const i2 = t2.where || this.where;
  4540. i2 && Object.keys(i2).length && (n2 = n2.where(i2));
  4541. const o2 = t2.field || this.field;
  4542. o2 && (n2 = n2.field(o2));
  4543. const a2 = t2.foreignKey || this.foreignKey;
  4544. a2 && (n2 = n2.foreignKey(a2));
  4545. const c2 = t2.groupby || this.groupby;
  4546. c2 && (n2 = n2.groupBy(c2));
  4547. const u2 = t2.groupField || this.groupField;
  4548. u2 && (n2 = n2.groupField(u2));
  4549. true === (void 0 !== t2.distinct ? t2.distinct : this.distinct) && (n2 = n2.distinct());
  4550. const l2 = t2.orderby || this.orderby;
  4551. l2 && (n2 = n2.orderBy(l2));
  4552. const h2 = 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 };
  4553. return f2 && (m2.getTree = y2), g2 && (m2.getTreePath = y2), n2 = n2.skip(d2 * (h2 - 1)).limit(d2).get(m2), n2;
  4554. } } };
  4555. }
  4556. function qs(e2) {
  4557. return function(t2, n2 = {}) {
  4558. n2 = function(e3, t3 = {}) {
  4559. 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;
  4560. }({ customUI: false, loadingOptions: { title: "加载中...", mask: true }, errorOptions: { type: "modal", retry: false } }, n2);
  4561. const { customUI: s2, loadingOptions: r2, errorOptions: i2, parseSystemError: o2 } = n2, a2 = !s2;
  4562. return new Proxy({}, { get(s3, c2) {
  4563. switch (c2) {
  4564. case "toString":
  4565. return "[object UniCloudObject]";
  4566. case "toJSON":
  4567. return {};
  4568. }
  4569. return function({ fn: e3, interceptorName: t3, getCallbackArgs: n3 } = {}) {
  4570. return async function(...s4) {
  4571. const r3 = n3 ? n3({ params: s4 }) : {};
  4572. let i3, o3;
  4573. try {
  4574. return await M(q(t3, "invoke"), { ...r3 }), i3 = await e3(...s4), await M(q(t3, "success"), { ...r3, result: i3 }), i3;
  4575. } catch (e4) {
  4576. throw o3 = e4, await M(q(t3, "fail"), { ...r3, error: o3 }), o3;
  4577. } finally {
  4578. await M(q(t3, "complete"), o3 ? { ...r3, error: o3 } : { ...r3, result: i3 });
  4579. }
  4580. };
  4581. }({ fn: async function s4(...l2) {
  4582. let h2;
  4583. a2 && uni.showLoading({ title: r2.title, mask: r2.mask });
  4584. const d2 = { name: t2, type: u, data: { method: c2, params: l2 } };
  4585. "object" == typeof n2.secretMethods && function(e3, t3) {
  4586. const n3 = t3.data.method, s5 = e3.secretMethods || {}, r3 = s5[n3] || s5["*"];
  4587. r3 && (t3.secretType = r3);
  4588. }(n2, d2);
  4589. let p2 = false;
  4590. try {
  4591. h2 = await e2.callFunction(d2);
  4592. } catch (e3) {
  4593. p2 = true, h2 = { result: new te(e3) };
  4594. }
  4595. const { errSubject: f2, errCode: g2, errMsg: m2, newToken: y2 } = h2.result || {};
  4596. if (a2 && uni.hideLoading(), y2 && y2.token && y2.tokenExpired && (ie(y2), Y(B, { ...y2 })), g2) {
  4597. let e3 = m2;
  4598. if (p2 && o2) {
  4599. e3 = (await o2({ objectName: t2, methodName: c2, params: l2, errSubject: f2, errCode: g2, errMsg: m2 })).errMsg || m2;
  4600. }
  4601. if (a2)
  4602. if ("toast" === i2.type)
  4603. uni.showToast({ title: e3, icon: "none" });
  4604. else {
  4605. if ("modal" !== i2.type)
  4606. throw new Error(`Invalid errorOptions.type: ${i2.type}`);
  4607. {
  4608. const { confirm: t3 } = await async function({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3 } = {}) {
  4609. return new Promise((i3, o3) => {
  4610. uni.showModal({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3, success(e5) {
  4611. i3(e5);
  4612. }, fail() {
  4613. i3({ confirm: false, cancel: true });
  4614. } });
  4615. });
  4616. }({ title: "提示", content: e3, showCancel: i2.retry, cancelText: "取消", confirmText: i2.retry ? "重试" : "确定" });
  4617. if (i2.retry && t3)
  4618. return s4(...l2);
  4619. }
  4620. }
  4621. const n3 = new te({ subject: f2, code: g2, message: m2, requestId: h2.requestId });
  4622. throw n3.detail = h2.result, Y(j, { type: J, content: n3 }), n3;
  4623. }
  4624. return Y(j, { type: J, content: h2.result }), h2.result;
  4625. }, interceptorName: "callObject", getCallbackArgs: function({ params: e3 } = {}) {
  4626. return { objectName: t2, methodName: c2, params: e3 };
  4627. } });
  4628. } });
  4629. };
  4630. }
  4631. function Fs(e2) {
  4632. return L("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}", e2.config.spaceId));
  4633. }
  4634. async function Ks({ openid: e2, callLoginByWeixin: t2 = false } = {}) {
  4635. Fs(this);
  4636. throw new Error(`[SecureNetwork] API \`initSecureNetworkByWeixin\` is not supported on platform \`${C}\``);
  4637. }
  4638. async function js(e2) {
  4639. const t2 = Fs(this);
  4640. return t2.initPromise || (t2.initPromise = Ks.call(this, e2).then((e3) => e3).catch((e3) => {
  4641. throw delete t2.initPromise, e3;
  4642. })), t2.initPromise;
  4643. }
  4644. function $s(e2) {
  4645. return function({ openid: t2, callLoginByWeixin: n2 = false } = {}) {
  4646. return js.call(e2, { openid: t2, callLoginByWeixin: n2 });
  4647. };
  4648. }
  4649. function Bs(e2) {
  4650. !function(e3) {
  4651. le = e3;
  4652. }(e2);
  4653. }
  4654. function Ws(e2) {
  4655. const t2 = { getSystemInfo: uni.getSystemInfo, getPushClientId: uni.getPushClientId };
  4656. return function(n2) {
  4657. return new Promise((s2, r2) => {
  4658. t2[e2]({ ...n2, success(e3) {
  4659. s2(e3);
  4660. }, fail(e3) {
  4661. r2(e3);
  4662. } });
  4663. });
  4664. };
  4665. }
  4666. class Hs extends class {
  4667. constructor() {
  4668. this._callback = {};
  4669. }
  4670. addListener(e2, t2) {
  4671. this._callback[e2] || (this._callback[e2] = []), this._callback[e2].push(t2);
  4672. }
  4673. on(e2, t2) {
  4674. return this.addListener(e2, t2);
  4675. }
  4676. removeListener(e2, t2) {
  4677. if (!t2)
  4678. throw new Error('The "listener" argument must be of type function. Received undefined');
  4679. const n2 = this._callback[e2];
  4680. if (!n2)
  4681. return;
  4682. const s2 = function(e3, t3) {
  4683. for (let n3 = e3.length - 1; n3 >= 0; n3--)
  4684. if (e3[n3] === t3)
  4685. return n3;
  4686. return -1;
  4687. }(n2, t2);
  4688. n2.splice(s2, 1);
  4689. }
  4690. off(e2, t2) {
  4691. return this.removeListener(e2, t2);
  4692. }
  4693. removeAllListener(e2) {
  4694. delete this._callback[e2];
  4695. }
  4696. emit(e2, ...t2) {
  4697. const n2 = this._callback[e2];
  4698. if (n2)
  4699. for (let e3 = 0; e3 < n2.length; e3++)
  4700. n2[e3](...t2);
  4701. }
  4702. } {
  4703. constructor() {
  4704. super(), this._uniPushMessageCallback = this._receivePushMessage.bind(this), this._currentMessageId = -1, this._payloadQueue = [];
  4705. }
  4706. init() {
  4707. return Promise.all([Ws("getSystemInfo")(), Ws("getPushClientId")()]).then(([{ appId: e2 } = {}, { cid: t2 } = {}] = []) => {
  4708. if (!e2)
  4709. throw new Error("Invalid appId, please check the manifest.json file");
  4710. if (!t2)
  4711. throw new Error("Invalid push client id");
  4712. this._appId = e2, this._pushClientId = t2, this._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), this.emit("open"), this._initMessageListener();
  4713. }, (e2) => {
  4714. throw this.emit("error", e2), this.close(), e2;
  4715. });
  4716. }
  4717. async open() {
  4718. return this.init();
  4719. }
  4720. _isUniCloudSSE(e2) {
  4721. if ("receive" !== e2.type)
  4722. return false;
  4723. const t2 = e2 && e2.data && e2.data.payload;
  4724. return !(!t2 || "UNI_CLOUD_SSE" !== t2.channel || t2.seqId !== this._seqId);
  4725. }
  4726. _receivePushMessage(e2) {
  4727. if (!this._isUniCloudSSE(e2))
  4728. return;
  4729. const t2 = e2 && e2.data && e2.data.payload, { action: n2, messageId: s2, message: r2 } = t2;
  4730. this._payloadQueue.push({ action: n2, messageId: s2, message: r2 }), this._consumMessage();
  4731. }
  4732. _consumMessage() {
  4733. for (; ; ) {
  4734. const e2 = this._payloadQueue.find((e3) => e3.messageId === this._currentMessageId + 1);
  4735. if (!e2)
  4736. break;
  4737. this._currentMessageId++, this._parseMessagePayload(e2);
  4738. }
  4739. }
  4740. _parseMessagePayload(e2) {
  4741. const { action: t2, messageId: n2, message: s2 } = e2;
  4742. "end" === t2 ? this._end({ messageId: n2, message: s2 }) : "message" === t2 && this._appendMessage({ messageId: n2, message: s2 });
  4743. }
  4744. _appendMessage({ messageId: e2, message: t2 } = {}) {
  4745. this.emit("message", t2);
  4746. }
  4747. _end({ messageId: e2, message: t2 } = {}) {
  4748. this.emit("end", t2), this.close();
  4749. }
  4750. _initMessageListener() {
  4751. uni.onPushMessage(this._uniPushMessageCallback);
  4752. }
  4753. _destroy() {
  4754. uni.offPushMessage(this._uniPushMessageCallback);
  4755. }
  4756. toJSON() {
  4757. return { appId: this._appId, pushClientId: this._pushClientId, seqId: this._seqId };
  4758. }
  4759. close() {
  4760. this._destroy(), this.emit("close");
  4761. }
  4762. }
  4763. async function Js(e2) {
  4764. {
  4765. const { osName: e3, osVersion: t3 } = ce();
  4766. "ios" === e3 && function(e4) {
  4767. if (!e4 || "string" != typeof e4)
  4768. return 0;
  4769. const t4 = e4.match(/^(\d+)./);
  4770. return t4 && t4[1] ? parseInt(t4[1]) : 0;
  4771. }(t3) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备(仅开发期间需要,发行后不需要)");
  4772. }
  4773. const t2 = e2.__dev__;
  4774. if (!t2.debugInfo)
  4775. return;
  4776. const { address: n2, servePort: s2 } = t2.debugInfo, { address: r2 } = await At(n2, s2);
  4777. if (r2)
  4778. return t2.localAddress = r2, void (t2.localPort = s2);
  4779. const i2 = console["error"];
  4780. let o2 = "";
  4781. 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 === C.indexOf("mp-") && (o2 += "\n- 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t2.debugInfo.forceRemote)
  4782. throw new Error(o2);
  4783. i2(o2);
  4784. }
  4785. function zs(e2) {
  4786. e2._initPromiseHub || (e2._initPromiseHub = new v({ createPromise: function() {
  4787. let t2 = Promise.resolve();
  4788. var n2;
  4789. n2 = 1, t2 = new Promise((e3) => {
  4790. setTimeout(() => {
  4791. e3();
  4792. }, n2);
  4793. });
  4794. const s2 = e2.auth();
  4795. return t2.then(() => s2.getLoginState()).then((e3) => e3 ? Promise.resolve() : s2.signInAnonymously());
  4796. } }));
  4797. }
  4798. const Vs = { tcb: bt, tencent: bt, aliyun: fe, private: Tt, dcloud: Tt, alipay: qt };
  4799. let Gs = new class {
  4800. init(e2) {
  4801. let t2 = {};
  4802. const n2 = Vs[e2.provider];
  4803. if (!n2)
  4804. throw new Error("未提供正确的provider参数");
  4805. t2 = n2.init(e2), function(e3) {
  4806. const t3 = {};
  4807. e3.__dev__ = t3, t3.debugLog = "app" === C;
  4808. const n3 = P;
  4809. n3 && !n3.code && (t3.debugInfo = n3);
  4810. const s2 = new v({ createPromise: function() {
  4811. return Js(e3);
  4812. } });
  4813. t3.initLocalNetwork = function() {
  4814. return s2.exec();
  4815. };
  4816. }(t2), zs(t2), Jn(t2), function(e3) {
  4817. const t3 = e3.uploadFile;
  4818. e3.uploadFile = function(e4) {
  4819. return t3.call(this, e4);
  4820. };
  4821. }(t2), function(e3) {
  4822. e3.database = function(t3) {
  4823. if (t3 && Object.keys(t3).length > 0)
  4824. return e3.init(t3).database();
  4825. if (this._database)
  4826. return this._database;
  4827. const n3 = ss(rs, { uniClient: e3 });
  4828. return this._database = n3, n3;
  4829. }, e3.databaseForJQL = function(t3) {
  4830. if (t3 && Object.keys(t3).length > 0)
  4831. return e3.init(t3).databaseForJQL();
  4832. if (this._databaseForJQL)
  4833. return this._databaseForJQL;
  4834. const n3 = ss(rs, { uniClient: e3, isJQL: true });
  4835. return this._databaseForJQL = n3, n3;
  4836. };
  4837. }(t2), function(e3) {
  4838. e3.getCurrentUserInfo = Rs, e3.chooseAndUploadFile = Ns.initChooseAndUploadFile(e3), Object.assign(e3, { get mixinDatacom() {
  4839. return Ms(e3);
  4840. } }), e3.SSEChannel = Hs, e3.initSecureNetworkByWeixin = $s(e3), e3.setCustomClientInfo = Bs, e3.importObject = qs(e3);
  4841. }(t2);
  4842. return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach((e3) => {
  4843. if (!t2[e3])
  4844. return;
  4845. const n3 = t2[e3];
  4846. t2[e3] = function() {
  4847. return n3.apply(t2, Array.from(arguments));
  4848. }, t2[e3] = (/* @__PURE__ */ function(e4, t3) {
  4849. return function(n4) {
  4850. let s2 = false;
  4851. if ("callFunction" === t3) {
  4852. const e5 = n4 && n4.type || c;
  4853. s2 = e5 !== c;
  4854. }
  4855. const r2 = "callFunction" === t3 && !s2, i2 = this._initPromiseHub.exec();
  4856. n4 = n4 || {};
  4857. const { success: o2, fail: a2, complete: u2 } = ee(n4), l2 = 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))));
  4858. if (!(o2 || a2 || u2))
  4859. return l2;
  4860. l2.then((e5) => {
  4861. o2 && o2(e5), u2 && u2(e5), r2 && Y(j, { type: H, content: e5 });
  4862. }, (e5) => {
  4863. a2 && a2(e5), u2 && u2(e5), r2 && Y(j, { type: H, content: e5 });
  4864. });
  4865. };
  4866. }(t2[e3], e3)).bind(t2);
  4867. }), t2.init = this.init, t2;
  4868. }
  4869. }();
  4870. (() => {
  4871. const e2 = T;
  4872. let t2 = {};
  4873. if (e2 && 1 === e2.length)
  4874. t2 = e2[0], Gs = Gs.init(t2), Gs._isDefault = true;
  4875. else {
  4876. const t3 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"];
  4877. let n2;
  4878. n2 = e2 && e2.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : "应用未关联服务空间,请在uniCloud目录右键关联服务空间", t3.forEach((e3) => {
  4879. Gs[e3] = function() {
  4880. return console.error(n2), Promise.reject(new te({ code: "SYS_ERR", message: n2 }));
  4881. };
  4882. });
  4883. }
  4884. Object.assign(Gs, { get mixinDatacom() {
  4885. return Ms(Gs);
  4886. } }), xs(Gs), Gs.addInterceptor = N, Gs.removeInterceptor = D, Gs.interceptObject = F;
  4887. })();
  4888. var Ys = Gs;
  4889. const _sfc_main$x = {
  4890. name: "uni-data-select",
  4891. mixins: [Ys.mixinDatacom || {}],
  4892. props: {
  4893. localdata: {
  4894. type: Array,
  4895. default() {
  4896. return [];
  4897. }
  4898. },
  4899. value: {
  4900. type: [String, Number],
  4901. default: ""
  4902. },
  4903. modelValue: {
  4904. type: [String, Number],
  4905. default: ""
  4906. },
  4907. label: {
  4908. type: String,
  4909. default: ""
  4910. },
  4911. placeholder: {
  4912. type: String,
  4913. default: "请选择"
  4914. },
  4915. emptyTips: {
  4916. type: String,
  4917. default: "无选项"
  4918. },
  4919. clear: {
  4920. type: Boolean,
  4921. default: true
  4922. },
  4923. defItem: {
  4924. type: Number,
  4925. default: 0
  4926. },
  4927. disabled: {
  4928. type: Boolean,
  4929. default: false
  4930. },
  4931. // 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
  4932. format: {
  4933. type: String,
  4934. default: ""
  4935. },
  4936. placement: {
  4937. type: String,
  4938. default: "bottom"
  4939. }
  4940. },
  4941. data() {
  4942. return {
  4943. showSelector: false,
  4944. current: "",
  4945. mixinDatacomResData: [],
  4946. apps: [],
  4947. channels: [],
  4948. cacheKey: "uni-data-select-lastSelectedValue"
  4949. };
  4950. },
  4951. created() {
  4952. this.debounceGet = this.debounce(() => {
  4953. this.query();
  4954. }, 300);
  4955. if (this.collection && !this.localdata.length) {
  4956. this.debounceGet();
  4957. }
  4958. },
  4959. computed: {
  4960. typePlaceholder() {
  4961. const text = {
  4962. "opendb-stat-app-versions": "版本",
  4963. "opendb-app-channels": "渠道",
  4964. "opendb-app-list": "应用"
  4965. };
  4966. const common = this.placeholder;
  4967. const placeholder = text[this.collection];
  4968. return placeholder ? common + placeholder : common;
  4969. },
  4970. valueCom() {
  4971. return this.modelValue;
  4972. },
  4973. textShow() {
  4974. let text = this.current;
  4975. if (text.length > 10) {
  4976. return text.slice(0, 25) + "...";
  4977. }
  4978. return text;
  4979. },
  4980. getOffsetByPlacement() {
  4981. switch (this.placement) {
  4982. case "top":
  4983. return "bottom:calc(100% + 12px);";
  4984. case "bottom":
  4985. return "top:calc(100% + 12px);";
  4986. }
  4987. }
  4988. },
  4989. watch: {
  4990. localdata: {
  4991. immediate: true,
  4992. handler(val, old) {
  4993. if (Array.isArray(val) && old !== val) {
  4994. this.mixinDatacomResData = val;
  4995. }
  4996. }
  4997. },
  4998. valueCom(val, old) {
  4999. this.initDefVal();
  5000. },
  5001. mixinDatacomResData: {
  5002. immediate: true,
  5003. handler(val) {
  5004. if (val.length) {
  5005. this.initDefVal();
  5006. }
  5007. }
  5008. }
  5009. },
  5010. methods: {
  5011. debounce(fn, time = 100) {
  5012. let timer = null;
  5013. return function(...args) {
  5014. if (timer)
  5015. clearTimeout(timer);
  5016. timer = setTimeout(() => {
  5017. fn.apply(this, args);
  5018. }, time);
  5019. };
  5020. },
  5021. // 执行数据库查询
  5022. query() {
  5023. this.mixinDatacomEasyGet();
  5024. },
  5025. // 监听查询条件变更事件
  5026. onMixinDatacomPropsChange() {
  5027. if (this.collection) {
  5028. this.debounceGet();
  5029. }
  5030. },
  5031. initDefVal() {
  5032. let defValue = "";
  5033. if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
  5034. defValue = this.valueCom;
  5035. } else {
  5036. let strogeValue;
  5037. if (this.collection) {
  5038. strogeValue = this.getCache();
  5039. }
  5040. if (strogeValue || strogeValue === 0) {
  5041. defValue = strogeValue;
  5042. } else {
  5043. let defItem = "";
  5044. if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
  5045. defItem = this.mixinDatacomResData[this.defItem - 1].value;
  5046. }
  5047. defValue = defItem;
  5048. }
  5049. if (defValue || defValue === 0) {
  5050. this.emit(defValue);
  5051. }
  5052. }
  5053. const def = this.mixinDatacomResData.find((item) => item.value === defValue);
  5054. this.current = def ? this.formatItemName(def) : "";
  5055. },
  5056. /**
  5057. * @param {[String, Number]} value
  5058. * 判断用户给的 value 是否同时为禁用状态
  5059. */
  5060. isDisabled(value) {
  5061. let isDisabled = false;
  5062. this.mixinDatacomResData.forEach((item) => {
  5063. if (item.value === value) {
  5064. isDisabled = item.disable;
  5065. }
  5066. });
  5067. return isDisabled;
  5068. },
  5069. clearVal() {
  5070. this.emit("");
  5071. if (this.collection) {
  5072. this.removeCache();
  5073. }
  5074. },
  5075. change(item) {
  5076. if (!item.disable) {
  5077. this.showSelector = false;
  5078. this.current = this.formatItemName(item);
  5079. this.emit(item.value);
  5080. }
  5081. },
  5082. emit(val) {
  5083. this.$emit("input", val);
  5084. this.$emit("update:modelValue", val);
  5085. this.$emit("change", val);
  5086. if (this.collection) {
  5087. this.setCache(val);
  5088. }
  5089. },
  5090. toggleSelector() {
  5091. if (this.disabled) {
  5092. return;
  5093. }
  5094. this.showSelector = !this.showSelector;
  5095. },
  5096. formatItemName(item) {
  5097. let {
  5098. text,
  5099. value,
  5100. channel_code
  5101. } = item;
  5102. channel_code = channel_code ? `(${channel_code})` : "";
  5103. if (this.format) {
  5104. let str = "";
  5105. str = this.format;
  5106. for (let key in item) {
  5107. str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
  5108. }
  5109. return str;
  5110. } else {
  5111. return this.collection.indexOf("app-list") > 0 ? `${text}(${value})` : text ? text : `未命名${channel_code}`;
  5112. }
  5113. },
  5114. // 获取当前加载的数据
  5115. getLoadData() {
  5116. return this.mixinDatacomResData;
  5117. },
  5118. // 获取当前缓存key
  5119. getCurrentCacheKey() {
  5120. return this.collection;
  5121. },
  5122. // 获取缓存
  5123. getCache(name = this.getCurrentCacheKey()) {
  5124. let cacheData = uni.getStorageSync(this.cacheKey) || {};
  5125. return cacheData[name];
  5126. },
  5127. // 设置缓存
  5128. setCache(value, name = this.getCurrentCacheKey()) {
  5129. let cacheData = uni.getStorageSync(this.cacheKey) || {};
  5130. cacheData[name] = value;
  5131. uni.setStorageSync(this.cacheKey, cacheData);
  5132. },
  5133. // 删除缓存
  5134. removeCache(name = this.getCurrentCacheKey()) {
  5135. let cacheData = uni.getStorageSync(this.cacheKey) || {};
  5136. delete cacheData[name];
  5137. uni.setStorageSync(this.cacheKey, cacheData);
  5138. }
  5139. }
  5140. };
  5141. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  5142. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  5143. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-stat__select" }, [
  5144. $props.label ? (vue.openBlock(), vue.createElementBlock(
  5145. "span",
  5146. {
  5147. key: 0,
  5148. class: "uni-label-text hide-on-phone"
  5149. },
  5150. vue.toDisplayString($props.label + ":"),
  5151. 1
  5152. /* TEXT */
  5153. )) : vue.createCommentVNode("v-if", true),
  5154. vue.createElementVNode(
  5155. "view",
  5156. {
  5157. class: vue.normalizeClass(["uni-stat-box", { "uni-stat__actived": $data.current }])
  5158. },
  5159. [
  5160. vue.createElementVNode(
  5161. "view",
  5162. {
  5163. class: vue.normalizeClass(["uni-select", { "uni-select--disabled": $props.disabled }])
  5164. },
  5165. [
  5166. vue.createElementVNode("view", {
  5167. class: "uni-select__input-box",
  5168. onClick: _cache[1] || (_cache[1] = (...args) => $options.toggleSelector && $options.toggleSelector(...args))
  5169. }, [
  5170. $data.current ? (vue.openBlock(), vue.createElementBlock(
  5171. "view",
  5172. {
  5173. key: 0,
  5174. class: "uni-select__input-text"
  5175. },
  5176. vue.toDisplayString($options.textShow),
  5177. 1
  5178. /* TEXT */
  5179. )) : (vue.openBlock(), vue.createElementBlock(
  5180. "view",
  5181. {
  5182. key: 1,
  5183. class: "uni-select__input-text uni-select__input-placeholder"
  5184. },
  5185. vue.toDisplayString($options.typePlaceholder),
  5186. 1
  5187. /* TEXT */
  5188. )),
  5189. $data.current && $props.clear && !$props.disabled ? (vue.openBlock(), vue.createElementBlock("view", {
  5190. key: 2,
  5191. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.clearVal && $options.clearVal(...args), ["stop"]))
  5192. }, [
  5193. vue.createVNode(_component_uni_icons, {
  5194. type: "clear",
  5195. color: "#c0c4cc",
  5196. size: "24"
  5197. })
  5198. ])) : (vue.openBlock(), vue.createElementBlock("view", { key: 3 }, [
  5199. vue.createVNode(_component_uni_icons, {
  5200. type: $data.showSelector ? "top" : "bottom",
  5201. size: "14",
  5202. color: "#999"
  5203. }, null, 8, ["type"])
  5204. ]))
  5205. ]),
  5206. $data.showSelector ? (vue.openBlock(), vue.createElementBlock("view", {
  5207. key: 0,
  5208. class: "uni-select--mask",
  5209. onClick: _cache[2] || (_cache[2] = (...args) => $options.toggleSelector && $options.toggleSelector(...args))
  5210. })) : vue.createCommentVNode("v-if", true),
  5211. $data.showSelector ? (vue.openBlock(), vue.createElementBlock(
  5212. "view",
  5213. {
  5214. key: 1,
  5215. class: "uni-select__selector",
  5216. style: vue.normalizeStyle($options.getOffsetByPlacement)
  5217. },
  5218. [
  5219. vue.createElementVNode(
  5220. "view",
  5221. {
  5222. class: vue.normalizeClass($props.placement == "bottom" ? "uni-popper__arrow_bottom" : "uni-popper__arrow_top")
  5223. },
  5224. null,
  5225. 2
  5226. /* CLASS */
  5227. ),
  5228. vue.createElementVNode("scroll-view", {
  5229. "scroll-y": "true",
  5230. class: "uni-select__selector-scroll"
  5231. }, [
  5232. $data.mixinDatacomResData.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  5233. key: 0,
  5234. class: "uni-select__selector-empty"
  5235. }, [
  5236. vue.createElementVNode(
  5237. "text",
  5238. null,
  5239. vue.toDisplayString($props.emptyTips),
  5240. 1
  5241. /* TEXT */
  5242. )
  5243. ])) : (vue.openBlock(true), vue.createElementBlock(
  5244. vue.Fragment,
  5245. { key: 1 },
  5246. vue.renderList($data.mixinDatacomResData, (item, index) => {
  5247. return vue.openBlock(), vue.createElementBlock("view", {
  5248. class: "uni-select__selector-item",
  5249. key: index,
  5250. onClick: ($event) => $options.change(item)
  5251. }, [
  5252. vue.createElementVNode(
  5253. "text",
  5254. {
  5255. class: vue.normalizeClass({ "uni-select__selector__disabled": item.disable })
  5256. },
  5257. vue.toDisplayString($options.formatItemName(item)),
  5258. 3
  5259. /* TEXT, CLASS */
  5260. )
  5261. ], 8, ["onClick"]);
  5262. }),
  5263. 128
  5264. /* KEYED_FRAGMENT */
  5265. ))
  5266. ])
  5267. ],
  5268. 4
  5269. /* STYLE */
  5270. )) : vue.createCommentVNode("v-if", true)
  5271. ],
  5272. 2
  5273. /* CLASS */
  5274. )
  5275. ],
  5276. 2
  5277. /* CLASS */
  5278. )
  5279. ]);
  5280. }
  5281. const __easycom_0$6 = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$w], ["__scopeId", "data-v-ddf9e0a2"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue"]]);
  5282. const ERR_MSG_OK = "chooseAndUploadFile:ok";
  5283. const ERR_MSG_FAIL = "chooseAndUploadFile:fail";
  5284. function chooseImage(opts) {
  5285. const {
  5286. count,
  5287. sizeType = ["original", "compressed"],
  5288. sourceType,
  5289. extension
  5290. } = opts;
  5291. return new Promise((resolve, reject) => {
  5292. uni.chooseImage({
  5293. count,
  5294. sizeType,
  5295. sourceType,
  5296. extension,
  5297. success(res) {
  5298. resolve(normalizeChooseAndUploadFileRes(res, "image"));
  5299. },
  5300. fail(res) {
  5301. reject({
  5302. errMsg: res.errMsg.replace("chooseImage:fail", ERR_MSG_FAIL)
  5303. });
  5304. }
  5305. });
  5306. });
  5307. }
  5308. function chooseVideo(opts) {
  5309. const {
  5310. count,
  5311. camera: camera2,
  5312. compressed,
  5313. maxDuration,
  5314. sourceType,
  5315. extension
  5316. } = opts;
  5317. return new Promise((resolve, reject) => {
  5318. uni.chooseVideo({
  5319. camera: camera2,
  5320. compressed,
  5321. maxDuration,
  5322. sourceType,
  5323. extension,
  5324. success(res) {
  5325. const {
  5326. tempFilePath,
  5327. duration,
  5328. size,
  5329. height,
  5330. width
  5331. } = res;
  5332. resolve(normalizeChooseAndUploadFileRes({
  5333. errMsg: "chooseVideo:ok",
  5334. tempFilePaths: [tempFilePath],
  5335. tempFiles: [{
  5336. name: res.tempFile && res.tempFile.name || "",
  5337. path: tempFilePath,
  5338. size,
  5339. type: res.tempFile && res.tempFile.type || "",
  5340. width,
  5341. height,
  5342. duration,
  5343. fileType: "video",
  5344. cloudPath: ""
  5345. }]
  5346. }, "video"));
  5347. },
  5348. fail(res) {
  5349. reject({
  5350. errMsg: res.errMsg.replace("chooseVideo:fail", ERR_MSG_FAIL)
  5351. });
  5352. }
  5353. });
  5354. });
  5355. }
  5356. function chooseAll(opts) {
  5357. const {
  5358. count,
  5359. extension
  5360. } = opts;
  5361. return new Promise((resolve, reject) => {
  5362. let chooseFile = uni.chooseFile;
  5363. if (typeof wx !== "undefined" && typeof wx.chooseMessageFile === "function") {
  5364. chooseFile = wx.chooseMessageFile;
  5365. }
  5366. if (typeof chooseFile !== "function") {
  5367. return reject({
  5368. errMsg: ERR_MSG_FAIL + " 请指定 type 类型,该平台仅支持选择 image 或 video。"
  5369. });
  5370. }
  5371. chooseFile({
  5372. type: "all",
  5373. count,
  5374. extension,
  5375. success(res) {
  5376. resolve(normalizeChooseAndUploadFileRes(res));
  5377. },
  5378. fail(res) {
  5379. reject({
  5380. errMsg: res.errMsg.replace("chooseFile:fail", ERR_MSG_FAIL)
  5381. });
  5382. }
  5383. });
  5384. });
  5385. }
  5386. function normalizeChooseAndUploadFileRes(res, fileType) {
  5387. res.tempFiles.forEach((item, index) => {
  5388. if (!item.name) {
  5389. item.name = item.path.substring(item.path.lastIndexOf("/") + 1);
  5390. }
  5391. if (fileType) {
  5392. item.fileType = fileType;
  5393. }
  5394. item.cloudPath = Date.now() + "_" + index + item.name.substring(item.name.lastIndexOf("."));
  5395. });
  5396. if (!res.tempFilePaths) {
  5397. res.tempFilePaths = res.tempFiles.map((file) => file.path);
  5398. }
  5399. return res;
  5400. }
  5401. function uploadCloudFiles(files, max = 5, onUploadProgress) {
  5402. files = JSON.parse(JSON.stringify(files));
  5403. const len = files.length;
  5404. let count = 0;
  5405. let self = this;
  5406. return new Promise((resolve) => {
  5407. while (count < max) {
  5408. next();
  5409. }
  5410. function next() {
  5411. let cur = count++;
  5412. if (cur >= len) {
  5413. !files.find((item) => !item.url && !item.errMsg) && resolve(files);
  5414. return;
  5415. }
  5416. const fileItem = files[cur];
  5417. const index = self.files.findIndex((v2) => v2.uuid === fileItem.uuid);
  5418. fileItem.url = "";
  5419. delete fileItem.errMsg;
  5420. Ys.uploadFile({
  5421. filePath: fileItem.path,
  5422. cloudPath: fileItem.cloudPath,
  5423. fileType: fileItem.fileType,
  5424. onUploadProgress: (res) => {
  5425. res.index = index;
  5426. onUploadProgress && onUploadProgress(res);
  5427. }
  5428. }).then((res) => {
  5429. fileItem.url = res.fileID;
  5430. fileItem.index = index;
  5431. if (cur < len) {
  5432. next();
  5433. }
  5434. }).catch((res) => {
  5435. fileItem.errMsg = res.errMsg || res.message;
  5436. fileItem.index = index;
  5437. if (cur < len) {
  5438. next();
  5439. }
  5440. });
  5441. }
  5442. });
  5443. }
  5444. function uploadFiles(choosePromise, {
  5445. onChooseFile,
  5446. onUploadProgress
  5447. }) {
  5448. return choosePromise.then((res) => {
  5449. if (onChooseFile) {
  5450. const customChooseRes = onChooseFile(res);
  5451. if (typeof customChooseRes !== "undefined") {
  5452. return Promise.resolve(customChooseRes).then((chooseRes) => typeof chooseRes === "undefined" ? res : chooseRes);
  5453. }
  5454. }
  5455. return res;
  5456. }).then((res) => {
  5457. if (res === false) {
  5458. return {
  5459. errMsg: ERR_MSG_OK,
  5460. tempFilePaths: [],
  5461. tempFiles: []
  5462. };
  5463. }
  5464. return res;
  5465. });
  5466. }
  5467. function chooseAndUploadFile(opts = {
  5468. type: "all"
  5469. }) {
  5470. if (opts.type === "image") {
  5471. return uploadFiles(chooseImage(opts), opts);
  5472. } else if (opts.type === "video") {
  5473. return uploadFiles(chooseVideo(opts), opts);
  5474. }
  5475. return uploadFiles(chooseAll(opts), opts);
  5476. }
  5477. const get_file_ext = (name) => {
  5478. const last_len = name.lastIndexOf(".");
  5479. const len = name.length;
  5480. return {
  5481. name: name.substring(0, last_len),
  5482. ext: name.substring(last_len + 1, len)
  5483. };
  5484. };
  5485. const get_extname = (fileExtname) => {
  5486. if (!Array.isArray(fileExtname)) {
  5487. let extname = fileExtname.replace(/(\[|\])/g, "");
  5488. return extname.split(",");
  5489. } else {
  5490. return fileExtname;
  5491. }
  5492. };
  5493. const get_files_and_is_max = (res, _extname) => {
  5494. let filePaths = [];
  5495. let files = [];
  5496. if (!_extname || _extname.length === 0) {
  5497. return {
  5498. filePaths,
  5499. files
  5500. };
  5501. }
  5502. res.tempFiles.forEach((v2) => {
  5503. let fileFullName = get_file_ext(v2.name);
  5504. const extname = fileFullName.ext.toLowerCase();
  5505. if (_extname.indexOf(extname) !== -1) {
  5506. files.push(v2);
  5507. filePaths.push(v2.path);
  5508. }
  5509. });
  5510. if (files.length !== res.tempFiles.length) {
  5511. uni.showToast({
  5512. title: `当前选择了${res.tempFiles.length}个文件 ,${res.tempFiles.length - files.length} 个文件格式不正确`,
  5513. icon: "none",
  5514. duration: 5e3
  5515. });
  5516. }
  5517. return {
  5518. filePaths,
  5519. files
  5520. };
  5521. };
  5522. const get_file_info = (filepath) => {
  5523. return new Promise((resolve, reject) => {
  5524. uni.getImageInfo({
  5525. src: filepath,
  5526. success(res) {
  5527. resolve(res);
  5528. },
  5529. fail(err) {
  5530. reject(err);
  5531. }
  5532. });
  5533. });
  5534. };
  5535. const get_file_data = async (files, type = "image") => {
  5536. let fileFullName = get_file_ext(files.name);
  5537. const extname = fileFullName.ext.toLowerCase();
  5538. let filedata = {
  5539. name: files.name,
  5540. uuid: files.uuid,
  5541. extname: extname || "",
  5542. cloudPath: files.cloudPath,
  5543. fileType: files.fileType,
  5544. thumbTempFilePath: files.thumbTempFilePath,
  5545. url: files.path || files.path,
  5546. size: files.size,
  5547. //单位是字节
  5548. image: {},
  5549. path: files.path,
  5550. video: {}
  5551. };
  5552. if (type === "image") {
  5553. const imageinfo = await get_file_info(files.path);
  5554. delete filedata.video;
  5555. filedata.image.width = imageinfo.width;
  5556. filedata.image.height = imageinfo.height;
  5557. filedata.image.location = imageinfo.path;
  5558. } else {
  5559. delete filedata.image;
  5560. }
  5561. return filedata;
  5562. };
  5563. const _sfc_main$w = {
  5564. name: "uploadImage",
  5565. emits: ["uploadFiles", "choose", "delFile"],
  5566. props: {
  5567. filesList: {
  5568. type: Array,
  5569. default() {
  5570. return [];
  5571. }
  5572. },
  5573. disabled: {
  5574. type: Boolean,
  5575. default: false
  5576. },
  5577. disablePreview: {
  5578. type: Boolean,
  5579. default: false
  5580. },
  5581. limit: {
  5582. type: [Number, String],
  5583. default: 9
  5584. },
  5585. imageStyles: {
  5586. type: Object,
  5587. default() {
  5588. return {
  5589. width: "auto",
  5590. height: "auto",
  5591. border: {}
  5592. };
  5593. }
  5594. },
  5595. delIcon: {
  5596. type: Boolean,
  5597. default: true
  5598. },
  5599. readonly: {
  5600. type: Boolean,
  5601. default: false
  5602. }
  5603. },
  5604. computed: {
  5605. styles() {
  5606. let styles = {
  5607. width: "auto",
  5608. height: "auto",
  5609. border: {}
  5610. };
  5611. return Object.assign(styles, this.imageStyles);
  5612. },
  5613. boxStyle() {
  5614. const {
  5615. width = "auto",
  5616. height = "auto"
  5617. } = this.styles;
  5618. let obj = {};
  5619. if (height === "auto") {
  5620. if (width !== "auto") {
  5621. obj.height = this.value2px(width);
  5622. obj["padding-top"] = 0;
  5623. } else {
  5624. obj.height = 0;
  5625. }
  5626. } else {
  5627. obj.height = this.value2px(height);
  5628. obj["padding-top"] = 0;
  5629. }
  5630. if (width === "auto") {
  5631. if (height !== "auto") {
  5632. obj.width = this.value2px(height);
  5633. } else {
  5634. obj.width = "33.3%";
  5635. }
  5636. } else {
  5637. obj.width = this.value2px(width);
  5638. }
  5639. let classles = "";
  5640. for (let i2 in obj) {
  5641. classles += `${i2}:${obj[i2]};`;
  5642. }
  5643. return classles;
  5644. },
  5645. borderStyle() {
  5646. let {
  5647. border
  5648. } = this.styles;
  5649. let obj = {};
  5650. const widthDefaultValue = 1;
  5651. const radiusDefaultValue = 3;
  5652. if (typeof border === "boolean") {
  5653. obj.border = border ? "1px #eee solid" : "none";
  5654. } else {
  5655. let width = border && border.width || widthDefaultValue;
  5656. width = this.value2px(width);
  5657. let radius = border && border.radius || radiusDefaultValue;
  5658. radius = this.value2px(radius);
  5659. obj = {
  5660. "border-width": width,
  5661. "border-style": border && border.style || "solid",
  5662. "border-color": border && border.color || "#eee",
  5663. "border-radius": radius
  5664. };
  5665. }
  5666. let classles = "";
  5667. for (let i2 in obj) {
  5668. classles += `${i2}:${obj[i2]};`;
  5669. }
  5670. return classles;
  5671. }
  5672. },
  5673. methods: {
  5674. uploadFiles(item, index) {
  5675. this.$emit("uploadFiles", item);
  5676. },
  5677. choose() {
  5678. this.$emit("choose");
  5679. },
  5680. delFile(index) {
  5681. this.$emit("delFile", index);
  5682. },
  5683. prviewImage(img, index) {
  5684. let urls = [];
  5685. if (Number(this.limit) === 1 && this.disablePreview && !this.disabled) {
  5686. this.$emit("choose");
  5687. }
  5688. if (this.disablePreview)
  5689. return;
  5690. this.filesList.forEach((i2) => {
  5691. urls.push(i2.url);
  5692. });
  5693. uni.previewImage({
  5694. urls,
  5695. current: index
  5696. });
  5697. },
  5698. value2px(value) {
  5699. if (typeof value === "number") {
  5700. value += "px";
  5701. } else {
  5702. if (value.indexOf("%") === -1) {
  5703. value = value.indexOf("px") !== -1 ? value : value + "px";
  5704. }
  5705. }
  5706. return value;
  5707. }
  5708. }
  5709. };
  5710. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  5711. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker__container" }, [
  5712. (vue.openBlock(true), vue.createElementBlock(
  5713. vue.Fragment,
  5714. null,
  5715. vue.renderList($props.filesList, (item, index) => {
  5716. return vue.openBlock(), vue.createElementBlock(
  5717. "view",
  5718. {
  5719. class: "file-picker__box",
  5720. key: index,
  5721. style: vue.normalizeStyle($options.boxStyle)
  5722. },
  5723. [
  5724. vue.createElementVNode(
  5725. "view",
  5726. {
  5727. class: "file-picker__box-content",
  5728. style: vue.normalizeStyle($options.borderStyle)
  5729. },
  5730. [
  5731. vue.createElementVNode("image", {
  5732. class: "file-image",
  5733. src: item.url,
  5734. mode: "aspectFill",
  5735. onClick: vue.withModifiers(($event) => $options.prviewImage(item, index), ["stop"])
  5736. }, null, 8, ["src", "onClick"]),
  5737. $props.delIcon && !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", {
  5738. key: 0,
  5739. class: "icon-del-box",
  5740. onClick: vue.withModifiers(($event) => $options.delFile(index), ["stop"])
  5741. }, [
  5742. vue.createElementVNode("view", { class: "icon-del" }),
  5743. vue.createElementVNode("view", { class: "icon-del rotate" })
  5744. ], 8, ["onClick"])) : vue.createCommentVNode("v-if", true),
  5745. item.progress && item.progress !== 100 || item.progress === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  5746. key: 1,
  5747. class: "file-picker__progress"
  5748. }, [
  5749. vue.createElementVNode("progress", {
  5750. class: "file-picker__progress-item",
  5751. percent: item.progress === -1 ? 0 : item.progress,
  5752. "stroke-width": "4",
  5753. backgroundColor: item.errMsg ? "#ff5a5f" : "#EBEBEB"
  5754. }, null, 8, ["percent", "backgroundColor"])
  5755. ])) : vue.createCommentVNode("v-if", true),
  5756. item.errMsg ? (vue.openBlock(), vue.createElementBlock("view", {
  5757. key: 2,
  5758. class: "file-picker__mask",
  5759. onClick: vue.withModifiers(($event) => $options.uploadFiles(item, index), ["stop"])
  5760. }, " 点击重试 ", 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
  5761. ],
  5762. 4
  5763. /* STYLE */
  5764. )
  5765. ],
  5766. 4
  5767. /* STYLE */
  5768. );
  5769. }),
  5770. 128
  5771. /* KEYED_FRAGMENT */
  5772. )),
  5773. $props.filesList.length < $props.limit && !$props.readonly ? (vue.openBlock(), vue.createElementBlock(
  5774. "view",
  5775. {
  5776. key: 0,
  5777. class: "file-picker__box",
  5778. style: vue.normalizeStyle($options.boxStyle)
  5779. },
  5780. [
  5781. vue.createElementVNode(
  5782. "view",
  5783. {
  5784. class: "file-picker__box-content is-add",
  5785. style: vue.normalizeStyle($options.borderStyle),
  5786. onClick: _cache[0] || (_cache[0] = (...args) => $options.choose && $options.choose(...args))
  5787. },
  5788. [
  5789. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  5790. vue.createElementVNode("view", { class: "icon-add" }),
  5791. vue.createElementVNode("view", { class: "icon-add rotate" })
  5792. ], true)
  5793. ],
  5794. 4
  5795. /* STYLE */
  5796. )
  5797. ],
  5798. 4
  5799. /* STYLE */
  5800. )) : vue.createCommentVNode("v-if", true)
  5801. ]);
  5802. }
  5803. const uploadImage = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$v], ["__scopeId", "data-v-bdfc07e0"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue"]]);
  5804. const _sfc_main$v = {
  5805. name: "uploadFile",
  5806. emits: ["uploadFiles", "choose", "delFile"],
  5807. props: {
  5808. filesList: {
  5809. type: Array,
  5810. default() {
  5811. return [];
  5812. }
  5813. },
  5814. delIcon: {
  5815. type: Boolean,
  5816. default: true
  5817. },
  5818. limit: {
  5819. type: [Number, String],
  5820. default: 9
  5821. },
  5822. showType: {
  5823. type: String,
  5824. default: ""
  5825. },
  5826. listStyles: {
  5827. type: Object,
  5828. default() {
  5829. return {
  5830. // 是否显示边框
  5831. border: true,
  5832. // 是否显示分隔线
  5833. dividline: true,
  5834. // 线条样式
  5835. borderStyle: {}
  5836. };
  5837. }
  5838. },
  5839. readonly: {
  5840. type: Boolean,
  5841. default: false
  5842. }
  5843. },
  5844. computed: {
  5845. list() {
  5846. let files = [];
  5847. this.filesList.forEach((v2) => {
  5848. files.push(v2);
  5849. });
  5850. return files;
  5851. },
  5852. styles() {
  5853. let styles = {
  5854. border: true,
  5855. dividline: true,
  5856. "border-style": {}
  5857. };
  5858. return Object.assign(styles, this.listStyles);
  5859. },
  5860. borderStyle() {
  5861. let {
  5862. borderStyle,
  5863. border
  5864. } = this.styles;
  5865. let obj = {};
  5866. if (!border) {
  5867. obj.border = "none";
  5868. } else {
  5869. let width = borderStyle && borderStyle.width || 1;
  5870. width = this.value2px(width);
  5871. let radius = borderStyle && borderStyle.radius || 5;
  5872. radius = this.value2px(radius);
  5873. obj = {
  5874. "border-width": width,
  5875. "border-style": borderStyle && borderStyle.style || "solid",
  5876. "border-color": borderStyle && borderStyle.color || "#eee",
  5877. "border-radius": radius
  5878. };
  5879. }
  5880. let classles = "";
  5881. for (let i2 in obj) {
  5882. classles += `${i2}:${obj[i2]};`;
  5883. }
  5884. return classles;
  5885. },
  5886. borderLineStyle() {
  5887. let obj = {};
  5888. let {
  5889. borderStyle
  5890. } = this.styles;
  5891. if (borderStyle && borderStyle.color) {
  5892. obj["border-color"] = borderStyle.color;
  5893. }
  5894. if (borderStyle && borderStyle.width) {
  5895. let width = borderStyle && borderStyle.width || 1;
  5896. let style = borderStyle && borderStyle.style || 0;
  5897. if (typeof width === "number") {
  5898. width += "px";
  5899. } else {
  5900. width = width.indexOf("px") ? width : width + "px";
  5901. }
  5902. obj["border-width"] = width;
  5903. if (typeof style === "number") {
  5904. style += "px";
  5905. } else {
  5906. style = style.indexOf("px") ? style : style + "px";
  5907. }
  5908. obj["border-top-style"] = style;
  5909. }
  5910. let classles = "";
  5911. for (let i2 in obj) {
  5912. classles += `${i2}:${obj[i2]};`;
  5913. }
  5914. return classles;
  5915. }
  5916. },
  5917. methods: {
  5918. uploadFiles(item, index) {
  5919. this.$emit("uploadFiles", {
  5920. item,
  5921. index
  5922. });
  5923. },
  5924. choose() {
  5925. this.$emit("choose");
  5926. },
  5927. delFile(index) {
  5928. this.$emit("delFile", index);
  5929. },
  5930. value2px(value) {
  5931. if (typeof value === "number") {
  5932. value += "px";
  5933. } else {
  5934. value = value.indexOf("px") !== -1 ? value : value + "px";
  5935. }
  5936. return value;
  5937. }
  5938. }
  5939. };
  5940. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  5941. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker__files" }, [
  5942. !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", {
  5943. key: 0,
  5944. class: "files-button",
  5945. onClick: _cache[0] || (_cache[0] = (...args) => $options.choose && $options.choose(...args))
  5946. }, [
  5947. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  5948. ])) : vue.createCommentVNode("v-if", true),
  5949. vue.createCommentVNode(` :class="{'is-text-box':showType === 'list'}" `),
  5950. $options.list.length > 0 ? (vue.openBlock(), vue.createElementBlock(
  5951. "view",
  5952. {
  5953. key: 1,
  5954. class: "uni-file-picker__lists is-text-box",
  5955. style: vue.normalizeStyle($options.borderStyle)
  5956. },
  5957. [
  5958. vue.createCommentVNode(" ,'is-list-card':showType === 'list-card' "),
  5959. (vue.openBlock(true), vue.createElementBlock(
  5960. vue.Fragment,
  5961. null,
  5962. vue.renderList($options.list, (item, index) => {
  5963. return vue.openBlock(), vue.createElementBlock(
  5964. "view",
  5965. {
  5966. class: vue.normalizeClass(["uni-file-picker__lists-box", {
  5967. "files-border": index !== 0 && $options.styles.dividline
  5968. }]),
  5969. key: index,
  5970. style: vue.normalizeStyle(index !== 0 && $options.styles.dividline && $options.borderLineStyle)
  5971. },
  5972. [
  5973. vue.createElementVNode("view", { class: "uni-file-picker__item" }, [
  5974. vue.createCommentVNode(` :class="{'is-text-image':showType === 'list'}" `),
  5975. vue.createCommentVNode(' <view class="files__image is-text-image">\r\n <image class="header-image" :src="item.logo" mode="aspectFit"></image>\r\n </view> '),
  5976. vue.createElementVNode(
  5977. "view",
  5978. { class: "files__name" },
  5979. vue.toDisplayString(item.name),
  5980. 1
  5981. /* TEXT */
  5982. ),
  5983. $props.delIcon && !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", {
  5984. key: 0,
  5985. class: "icon-del-box icon-files",
  5986. onClick: ($event) => $options.delFile(index)
  5987. }, [
  5988. vue.createElementVNode("view", { class: "icon-del icon-files" }),
  5989. vue.createElementVNode("view", { class: "icon-del rotate" })
  5990. ], 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
  5991. ]),
  5992. item.progress && item.progress !== 100 || item.progress === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  5993. key: 0,
  5994. class: "file-picker__progress"
  5995. }, [
  5996. vue.createElementVNode("progress", {
  5997. class: "file-picker__progress-item",
  5998. percent: item.progress === -1 ? 0 : item.progress,
  5999. "stroke-width": "4",
  6000. backgroundColor: item.errMsg ? "#ff5a5f" : "#EBEBEB"
  6001. }, null, 8, ["percent", "backgroundColor"])
  6002. ])) : vue.createCommentVNode("v-if", true),
  6003. item.status === "error" ? (vue.openBlock(), vue.createElementBlock("view", {
  6004. key: 1,
  6005. class: "file-picker__mask",
  6006. onClick: vue.withModifiers(($event) => $options.uploadFiles(item, index), ["stop"])
  6007. }, " 点击重试 ", 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
  6008. ],
  6009. 6
  6010. /* CLASS, STYLE */
  6011. );
  6012. }),
  6013. 128
  6014. /* KEYED_FRAGMENT */
  6015. ))
  6016. ],
  6017. 4
  6018. /* STYLE */
  6019. )) : vue.createCommentVNode("v-if", true)
  6020. ]);
  6021. }
  6022. const uploadFile = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$u], ["__scopeId", "data-v-a54939c6"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue"]]);
  6023. const _sfc_main$u = {
  6024. name: "uniFilePicker",
  6025. components: {
  6026. uploadImage,
  6027. uploadFile
  6028. },
  6029. options: {
  6030. virtualHost: true
  6031. },
  6032. emits: ["select", "success", "fail", "progress", "delete", "update:modelValue", "input"],
  6033. props: {
  6034. modelValue: {
  6035. type: [Array, Object],
  6036. default() {
  6037. return [];
  6038. }
  6039. },
  6040. value: {
  6041. type: [Array, Object],
  6042. default() {
  6043. return [];
  6044. }
  6045. },
  6046. disabled: {
  6047. type: Boolean,
  6048. default: false
  6049. },
  6050. disablePreview: {
  6051. type: Boolean,
  6052. default: false
  6053. },
  6054. delIcon: {
  6055. type: Boolean,
  6056. default: true
  6057. },
  6058. // 自动上传
  6059. autoUpload: {
  6060. type: Boolean,
  6061. default: true
  6062. },
  6063. // 最大选择个数 ,h5只能限制单选或是多选
  6064. limit: {
  6065. type: [Number, String],
  6066. default: 9
  6067. },
  6068. // 列表样式 grid | list | list-card
  6069. mode: {
  6070. type: String,
  6071. default: "grid"
  6072. },
  6073. // 选择文件类型 image/video/all
  6074. fileMediatype: {
  6075. type: String,
  6076. default: "image"
  6077. },
  6078. // 文件类型筛选
  6079. fileExtname: {
  6080. type: [Array, String],
  6081. default() {
  6082. return [];
  6083. }
  6084. },
  6085. title: {
  6086. type: String,
  6087. default: ""
  6088. },
  6089. listStyles: {
  6090. type: Object,
  6091. default() {
  6092. return {
  6093. // 是否显示边框
  6094. border: true,
  6095. // 是否显示分隔线
  6096. dividline: true,
  6097. // 线条样式
  6098. borderStyle: {}
  6099. };
  6100. }
  6101. },
  6102. imageStyles: {
  6103. type: Object,
  6104. default() {
  6105. return {
  6106. width: "auto",
  6107. height: "auto"
  6108. };
  6109. }
  6110. },
  6111. readonly: {
  6112. type: Boolean,
  6113. default: false
  6114. },
  6115. returnType: {
  6116. type: String,
  6117. default: "array"
  6118. },
  6119. sizeType: {
  6120. type: Array,
  6121. default() {
  6122. return ["original", "compressed"];
  6123. }
  6124. },
  6125. sourceType: {
  6126. type: Array,
  6127. default() {
  6128. return ["album", "camera"];
  6129. }
  6130. },
  6131. provider: {
  6132. type: String,
  6133. default: ""
  6134. // 默认上传到 unicloud 内置存储 extStorage 扩展存储
  6135. }
  6136. },
  6137. data() {
  6138. return {
  6139. files: [],
  6140. localValue: []
  6141. };
  6142. },
  6143. watch: {
  6144. value: {
  6145. handler(newVal, oldVal) {
  6146. this.setValue(newVal, oldVal);
  6147. },
  6148. immediate: true
  6149. },
  6150. modelValue: {
  6151. handler(newVal, oldVal) {
  6152. this.setValue(newVal, oldVal);
  6153. },
  6154. immediate: true
  6155. }
  6156. },
  6157. computed: {
  6158. filesList() {
  6159. let files = [];
  6160. this.files.forEach((v2) => {
  6161. files.push(v2);
  6162. });
  6163. return files;
  6164. },
  6165. showType() {
  6166. if (this.fileMediatype === "image") {
  6167. return this.mode;
  6168. }
  6169. return "list";
  6170. },
  6171. limitLength() {
  6172. if (this.returnType === "object") {
  6173. return 1;
  6174. }
  6175. if (!this.limit) {
  6176. return 1;
  6177. }
  6178. if (this.limit >= 9) {
  6179. return 9;
  6180. }
  6181. return this.limit;
  6182. }
  6183. },
  6184. created() {
  6185. if (!(Ys.config && Ys.config.provider)) {
  6186. this.noSpace = true;
  6187. Ys.chooseAndUploadFile = chooseAndUploadFile;
  6188. }
  6189. this.form = this.getForm("uniForms");
  6190. this.formItem = this.getForm("uniFormsItem");
  6191. if (this.form && this.formItem) {
  6192. if (this.formItem.name) {
  6193. this.rename = this.formItem.name;
  6194. this.form.inputChildrens.push(this);
  6195. }
  6196. }
  6197. },
  6198. methods: {
  6199. /**
  6200. * 公开用户使用,清空文件
  6201. * @param {Object} index
  6202. */
  6203. clearFiles(index) {
  6204. if (index !== 0 && !index) {
  6205. this.files = [];
  6206. this.$nextTick(() => {
  6207. this.setEmit();
  6208. });
  6209. } else {
  6210. this.files.splice(index, 1);
  6211. }
  6212. this.$nextTick(() => {
  6213. this.setEmit();
  6214. });
  6215. },
  6216. /**
  6217. * 公开用户使用,继续上传
  6218. */
  6219. upload() {
  6220. let files = [];
  6221. this.files.forEach((v2, index) => {
  6222. if (v2.status === "ready" || v2.status === "error") {
  6223. files.push(Object.assign({}, v2));
  6224. }
  6225. });
  6226. return this.uploadFiles(files);
  6227. },
  6228. async setValue(newVal, oldVal) {
  6229. const newData = async (v2) => {
  6230. const reg = /cloud:\/\/([\w.]+\/?)\S*/;
  6231. let url = "";
  6232. if (v2.fileID) {
  6233. url = v2.fileID;
  6234. } else {
  6235. url = v2.url;
  6236. }
  6237. if (reg.test(url)) {
  6238. v2.fileID = url;
  6239. v2.url = await this.getTempFileURL(url);
  6240. }
  6241. if (v2.url)
  6242. v2.path = v2.url;
  6243. return v2;
  6244. };
  6245. if (this.returnType === "object") {
  6246. if (newVal) {
  6247. await newData(newVal);
  6248. } else {
  6249. newVal = {};
  6250. }
  6251. } else {
  6252. if (!newVal)
  6253. newVal = [];
  6254. for (let i2 = 0; i2 < newVal.length; i2++) {
  6255. let v2 = newVal[i2];
  6256. await newData(v2);
  6257. }
  6258. }
  6259. this.localValue = newVal;
  6260. if (this.form && this.formItem && !this.is_reset) {
  6261. this.is_reset = false;
  6262. this.formItem.setValue(this.localValue);
  6263. }
  6264. let filesData = Object.keys(newVal).length > 0 ? newVal : [];
  6265. this.files = [].concat(filesData);
  6266. },
  6267. /**
  6268. * 选择文件
  6269. */
  6270. choose() {
  6271. if (this.disabled)
  6272. return;
  6273. if (this.files.length >= Number(this.limitLength) && this.showType !== "grid" && this.returnType === "array") {
  6274. uni.showToast({
  6275. title: `您最多选择 ${this.limitLength} 个文件`,
  6276. icon: "none"
  6277. });
  6278. return;
  6279. }
  6280. this.chooseFiles();
  6281. },
  6282. /**
  6283. * 选择文件并上传
  6284. */
  6285. chooseFiles() {
  6286. const _extname = get_extname(this.fileExtname);
  6287. Ys.chooseAndUploadFile({
  6288. type: this.fileMediatype,
  6289. compressed: false,
  6290. sizeType: this.sizeType,
  6291. sourceType: this.sourceType,
  6292. // TODO 如果为空,video 有问题
  6293. extension: _extname.length > 0 ? _extname : void 0,
  6294. count: this.limitLength - this.files.length,
  6295. //默认9
  6296. onChooseFile: this.chooseFileCallback,
  6297. onUploadProgress: (progressEvent) => {
  6298. this.setProgress(progressEvent, progressEvent.index);
  6299. }
  6300. }).then((result) => {
  6301. this.setSuccessAndError(result.tempFiles);
  6302. }).catch((err) => {
  6303. formatAppLog("log", "at uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue:364", "选择失败", err);
  6304. });
  6305. },
  6306. /**
  6307. * 选择文件回调
  6308. * @param {Object} res
  6309. */
  6310. async chooseFileCallback(res) {
  6311. const _extname = get_extname(this.fileExtname);
  6312. const is_one = Number(this.limitLength) === 1 && this.disablePreview && !this.disabled || this.returnType === "object";
  6313. if (is_one) {
  6314. this.files = [];
  6315. }
  6316. let {
  6317. filePaths,
  6318. files
  6319. } = get_files_and_is_max(res, _extname);
  6320. if (!(_extname && _extname.length > 0)) {
  6321. filePaths = res.tempFilePaths;
  6322. files = res.tempFiles;
  6323. }
  6324. let currentData = [];
  6325. for (let i2 = 0; i2 < files.length; i2++) {
  6326. if (this.limitLength - this.files.length <= 0)
  6327. break;
  6328. files[i2].uuid = Date.now();
  6329. let filedata = await get_file_data(files[i2], this.fileMediatype);
  6330. filedata.progress = 0;
  6331. filedata.status = "ready";
  6332. this.files.push(filedata);
  6333. currentData.push({
  6334. ...filedata,
  6335. file: files[i2]
  6336. });
  6337. }
  6338. this.$emit("select", {
  6339. tempFiles: currentData,
  6340. tempFilePaths: filePaths
  6341. });
  6342. res.tempFiles = files;
  6343. if (!this.autoUpload || this.noSpace) {
  6344. res.tempFiles = [];
  6345. }
  6346. res.tempFiles.forEach((fileItem, index) => {
  6347. this.provider && (fileItem.provider = this.provider);
  6348. const fileNameSplit = fileItem.name.split(".");
  6349. const ext = fileNameSplit.pop();
  6350. const fileName = fileNameSplit.join(".").replace(/[\s\/\?<>\\:\*\|":]/g, "_");
  6351. fileItem.cloudPath = fileName + "_" + Date.now() + "_" + index + "." + ext;
  6352. });
  6353. },
  6354. /**
  6355. * 批传
  6356. * @param {Object} e
  6357. */
  6358. uploadFiles(files) {
  6359. files = [].concat(files);
  6360. return uploadCloudFiles.call(this, files, 5, (res) => {
  6361. this.setProgress(res, res.index, true);
  6362. }).then((result) => {
  6363. this.setSuccessAndError(result);
  6364. return result;
  6365. }).catch((err) => {
  6366. formatAppLog("log", "at uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue:437", err);
  6367. });
  6368. },
  6369. /**
  6370. * 成功或失败
  6371. */
  6372. async setSuccessAndError(res, fn) {
  6373. let successData = [];
  6374. let errorData = [];
  6375. let tempFilePath = [];
  6376. let errorTempFilePath = [];
  6377. for (let i2 = 0; i2 < res.length; i2++) {
  6378. const item = res[i2];
  6379. const index = item.uuid ? this.files.findIndex((p2) => p2.uuid === item.uuid) : item.index;
  6380. if (index === -1 || !this.files)
  6381. break;
  6382. if (item.errMsg === "request:fail") {
  6383. this.files[index].url = item.path;
  6384. this.files[index].status = "error";
  6385. this.files[index].errMsg = item.errMsg;
  6386. errorData.push(this.files[index]);
  6387. errorTempFilePath.push(this.files[index].url);
  6388. } else {
  6389. this.files[index].errMsg = "";
  6390. this.files[index].fileID = item.url;
  6391. const reg = /cloud:\/\/([\w.]+\/?)\S*/;
  6392. if (reg.test(item.url)) {
  6393. this.files[index].url = await this.getTempFileURL(item.url);
  6394. } else {
  6395. this.files[index].url = item.url;
  6396. }
  6397. this.files[index].status = "success";
  6398. this.files[index].progress += 1;
  6399. successData.push(this.files[index]);
  6400. tempFilePath.push(this.files[index].fileID);
  6401. }
  6402. }
  6403. if (successData.length > 0) {
  6404. this.setEmit();
  6405. this.$emit("success", {
  6406. tempFiles: this.backObject(successData),
  6407. tempFilePaths: tempFilePath
  6408. });
  6409. }
  6410. if (errorData.length > 0) {
  6411. this.$emit("fail", {
  6412. tempFiles: this.backObject(errorData),
  6413. tempFilePaths: errorTempFilePath
  6414. });
  6415. }
  6416. },
  6417. /**
  6418. * 获取进度
  6419. * @param {Object} progressEvent
  6420. * @param {Object} index
  6421. * @param {Object} type
  6422. */
  6423. setProgress(progressEvent, index, type) {
  6424. this.files.length;
  6425. const percentCompleted = Math.round(progressEvent.loaded * 100 / progressEvent.total);
  6426. let idx = index;
  6427. if (!type) {
  6428. idx = this.files.findIndex((p2) => p2.uuid === progressEvent.tempFile.uuid);
  6429. }
  6430. if (idx === -1 || !this.files[idx])
  6431. return;
  6432. this.files[idx].progress = percentCompleted - 1;
  6433. this.$emit("progress", {
  6434. index: idx,
  6435. progress: parseInt(percentCompleted),
  6436. tempFile: this.files[idx]
  6437. });
  6438. },
  6439. /**
  6440. * 删除文件
  6441. * @param {Object} index
  6442. */
  6443. delFile(index) {
  6444. this.$emit("delete", {
  6445. index,
  6446. tempFile: this.files[index],
  6447. tempFilePath: this.files[index].url
  6448. });
  6449. this.files.splice(index, 1);
  6450. this.$nextTick(() => {
  6451. this.setEmit();
  6452. });
  6453. },
  6454. /**
  6455. * 获取文件名和后缀
  6456. * @param {Object} name
  6457. */
  6458. getFileExt(name) {
  6459. const last_len = name.lastIndexOf(".");
  6460. const len = name.length;
  6461. return {
  6462. name: name.substring(0, last_len),
  6463. ext: name.substring(last_len + 1, len)
  6464. };
  6465. },
  6466. /**
  6467. * 处理返回事件
  6468. */
  6469. setEmit() {
  6470. let data = [];
  6471. if (this.returnType === "object") {
  6472. data = this.backObject(this.files)[0];
  6473. this.localValue = data ? data : null;
  6474. } else {
  6475. data = this.backObject(this.files);
  6476. if (!this.localValue) {
  6477. this.localValue = [];
  6478. }
  6479. this.localValue = [...data];
  6480. }
  6481. this.$emit("update:modelValue", this.localValue);
  6482. },
  6483. /**
  6484. * 处理返回参数
  6485. * @param {Object} files
  6486. */
  6487. backObject(files) {
  6488. let newFilesData = [];
  6489. files.forEach((v2) => {
  6490. newFilesData.push({
  6491. extname: v2.extname,
  6492. fileType: v2.fileType,
  6493. image: v2.image,
  6494. name: v2.name,
  6495. path: v2.path,
  6496. size: v2.size,
  6497. fileID: v2.fileID,
  6498. url: v2.url,
  6499. // 修改删除一个文件后不能再上传的bug, #694
  6500. uuid: v2.uuid,
  6501. status: v2.status,
  6502. cloudPath: v2.cloudPath
  6503. });
  6504. });
  6505. return newFilesData;
  6506. },
  6507. async getTempFileURL(fileList) {
  6508. fileList = {
  6509. fileList: [].concat(fileList)
  6510. };
  6511. const urls = await Ys.getTempFileURL(fileList);
  6512. return urls.fileList[0].tempFileURL || "";
  6513. },
  6514. /**
  6515. * 获取父元素实例
  6516. */
  6517. getForm(name = "uniForms") {
  6518. let parent = this.$parent;
  6519. let parentName = parent.$options.name;
  6520. while (parentName !== name) {
  6521. parent = parent.$parent;
  6522. if (!parent)
  6523. return false;
  6524. parentName = parent.$options.name;
  6525. }
  6526. return parent;
  6527. }
  6528. }
  6529. };
  6530. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  6531. const _component_upload_image = vue.resolveComponent("upload-image");
  6532. const _component_upload_file = vue.resolveComponent("upload-file");
  6533. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-file-picker" }, [
  6534. $props.title ? (vue.openBlock(), vue.createElementBlock("view", {
  6535. key: 0,
  6536. class: "uni-file-picker__header"
  6537. }, [
  6538. vue.createElementVNode(
  6539. "text",
  6540. { class: "file-title" },
  6541. vue.toDisplayString($props.title),
  6542. 1
  6543. /* TEXT */
  6544. ),
  6545. vue.createElementVNode(
  6546. "text",
  6547. { class: "file-count" },
  6548. vue.toDisplayString($options.filesList.length) + "/" + vue.toDisplayString($options.limitLength),
  6549. 1
  6550. /* TEXT */
  6551. )
  6552. ])) : vue.createCommentVNode("v-if", true),
  6553. $props.fileMediatype === "image" && $options.showType === "grid" ? (vue.openBlock(), vue.createBlock(_component_upload_image, {
  6554. key: 1,
  6555. readonly: $props.readonly,
  6556. "image-styles": $props.imageStyles,
  6557. "files-list": $options.filesList,
  6558. limit: $options.limitLength,
  6559. disablePreview: $props.disablePreview,
  6560. delIcon: $props.delIcon,
  6561. onUploadFiles: $options.uploadFiles,
  6562. onChoose: $options.choose,
  6563. onDelFile: $options.delFile
  6564. }, {
  6565. default: vue.withCtx(() => [
  6566. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  6567. vue.createElementVNode("view", { class: "is-add" }, [
  6568. vue.createElementVNode("view", { class: "icon-add" }),
  6569. vue.createElementVNode("view", { class: "icon-add rotate" })
  6570. ])
  6571. ], true)
  6572. ]),
  6573. _: 3
  6574. /* FORWARDED */
  6575. }, 8, ["readonly", "image-styles", "files-list", "limit", "disablePreview", "delIcon", "onUploadFiles", "onChoose", "onDelFile"])) : vue.createCommentVNode("v-if", true),
  6576. $props.fileMediatype !== "image" || $options.showType !== "grid" ? (vue.openBlock(), vue.createBlock(_component_upload_file, {
  6577. key: 2,
  6578. readonly: $props.readonly,
  6579. "list-styles": $props.listStyles,
  6580. "files-list": $options.filesList,
  6581. showType: $options.showType,
  6582. delIcon: $props.delIcon,
  6583. onUploadFiles: $options.uploadFiles,
  6584. onChoose: $options.choose,
  6585. onDelFile: $options.delFile
  6586. }, {
  6587. default: vue.withCtx(() => [
  6588. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  6589. vue.createElementVNode("button", {
  6590. type: "primary",
  6591. size: "mini"
  6592. }, "选择文件")
  6593. ], true)
  6594. ]),
  6595. _: 3
  6596. /* FORWARDED */
  6597. }, 8, ["readonly", "list-styles", "files-list", "showType", "delIcon", "onUploadFiles", "onChoose", "onDelFile"])) : vue.createCommentVNode("v-if", true)
  6598. ]);
  6599. }
  6600. const __easycom_3$3 = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$t], ["__scopeId", "data-v-6223573f"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue"]]);
  6601. const isObject = (val) => val !== null && typeof val === "object";
  6602. const defaultDelimiters = ["{", "}"];
  6603. class BaseFormatter {
  6604. constructor() {
  6605. this._caches = /* @__PURE__ */ Object.create(null);
  6606. }
  6607. interpolate(message, values, delimiters = defaultDelimiters) {
  6608. if (!values) {
  6609. return [message];
  6610. }
  6611. let tokens = this._caches[message];
  6612. if (!tokens) {
  6613. tokens = parse(message, delimiters);
  6614. this._caches[message] = tokens;
  6615. }
  6616. return compile(tokens, values);
  6617. }
  6618. }
  6619. const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  6620. const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  6621. function parse(format, [startDelimiter, endDelimiter]) {
  6622. const tokens = [];
  6623. let position = 0;
  6624. let text = "";
  6625. while (position < format.length) {
  6626. let char = format[position++];
  6627. if (char === startDelimiter) {
  6628. if (text) {
  6629. tokens.push({ type: "text", value: text });
  6630. }
  6631. text = "";
  6632. let sub = "";
  6633. char = format[position++];
  6634. while (char !== void 0 && char !== endDelimiter) {
  6635. sub += char;
  6636. char = format[position++];
  6637. }
  6638. const isClosed = char === endDelimiter;
  6639. const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown";
  6640. tokens.push({ value: sub, type });
  6641. } else {
  6642. text += char;
  6643. }
  6644. }
  6645. text && tokens.push({ type: "text", value: text });
  6646. return tokens;
  6647. }
  6648. function compile(tokens, values) {
  6649. const compiled = [];
  6650. let index = 0;
  6651. const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
  6652. if (mode === "unknown") {
  6653. return compiled;
  6654. }
  6655. while (index < tokens.length) {
  6656. const token = tokens[index];
  6657. switch (token.type) {
  6658. case "text":
  6659. compiled.push(token.value);
  6660. break;
  6661. case "list":
  6662. compiled.push(values[parseInt(token.value, 10)]);
  6663. break;
  6664. case "named":
  6665. if (mode === "named") {
  6666. compiled.push(values[token.value]);
  6667. } else {
  6668. {
  6669. console.warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`);
  6670. }
  6671. }
  6672. break;
  6673. case "unknown":
  6674. {
  6675. console.warn(`Detect 'unknown' type of token!`);
  6676. }
  6677. break;
  6678. }
  6679. index++;
  6680. }
  6681. return compiled;
  6682. }
  6683. const LOCALE_ZH_HANS = "zh-Hans";
  6684. const LOCALE_ZH_HANT = "zh-Hant";
  6685. const LOCALE_EN = "en";
  6686. const LOCALE_FR = "fr";
  6687. const LOCALE_ES = "es";
  6688. const hasOwnProperty = Object.prototype.hasOwnProperty;
  6689. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  6690. const defaultFormatter = new BaseFormatter();
  6691. function include(str, parts) {
  6692. return !!parts.find((part) => str.indexOf(part) !== -1);
  6693. }
  6694. function startsWith(str, parts) {
  6695. return parts.find((part) => str.indexOf(part) === 0);
  6696. }
  6697. function normalizeLocale(locale, messages2) {
  6698. if (!locale) {
  6699. return;
  6700. }
  6701. locale = locale.trim().replace(/_/g, "-");
  6702. if (messages2 && messages2[locale]) {
  6703. return locale;
  6704. }
  6705. locale = locale.toLowerCase();
  6706. if (locale === "chinese") {
  6707. return LOCALE_ZH_HANS;
  6708. }
  6709. if (locale.indexOf("zh") === 0) {
  6710. if (locale.indexOf("-hans") > -1) {
  6711. return LOCALE_ZH_HANS;
  6712. }
  6713. if (locale.indexOf("-hant") > -1) {
  6714. return LOCALE_ZH_HANT;
  6715. }
  6716. if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
  6717. return LOCALE_ZH_HANT;
  6718. }
  6719. return LOCALE_ZH_HANS;
  6720. }
  6721. let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  6722. if (messages2 && Object.keys(messages2).length > 0) {
  6723. locales = Object.keys(messages2);
  6724. }
  6725. const lang = startsWith(locale, locales);
  6726. if (lang) {
  6727. return lang;
  6728. }
  6729. }
  6730. class I18n {
  6731. constructor({ locale, fallbackLocale, messages: messages2, watcher, formater: formater2 }) {
  6732. this.locale = LOCALE_EN;
  6733. this.fallbackLocale = LOCALE_EN;
  6734. this.message = {};
  6735. this.messages = {};
  6736. this.watchers = [];
  6737. if (fallbackLocale) {
  6738. this.fallbackLocale = fallbackLocale;
  6739. }
  6740. this.formater = formater2 || defaultFormatter;
  6741. this.messages = messages2 || {};
  6742. this.setLocale(locale || LOCALE_EN);
  6743. if (watcher) {
  6744. this.watchLocale(watcher);
  6745. }
  6746. }
  6747. setLocale(locale) {
  6748. const oldLocale = this.locale;
  6749. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  6750. if (!this.messages[this.locale]) {
  6751. this.messages[this.locale] = {};
  6752. }
  6753. this.message = this.messages[this.locale];
  6754. if (oldLocale !== this.locale) {
  6755. this.watchers.forEach((watcher) => {
  6756. watcher(this.locale, oldLocale);
  6757. });
  6758. }
  6759. }
  6760. getLocale() {
  6761. return this.locale;
  6762. }
  6763. watchLocale(fn) {
  6764. const index = this.watchers.push(fn) - 1;
  6765. return () => {
  6766. this.watchers.splice(index, 1);
  6767. };
  6768. }
  6769. add(locale, message, override = true) {
  6770. const curMessages = this.messages[locale];
  6771. if (curMessages) {
  6772. if (override) {
  6773. Object.assign(curMessages, message);
  6774. } else {
  6775. Object.keys(message).forEach((key) => {
  6776. if (!hasOwn(curMessages, key)) {
  6777. curMessages[key] = message[key];
  6778. }
  6779. });
  6780. }
  6781. } else {
  6782. this.messages[locale] = message;
  6783. }
  6784. }
  6785. f(message, values, delimiters) {
  6786. return this.formater.interpolate(message, values, delimiters).join("");
  6787. }
  6788. t(key, locale, values) {
  6789. let message = this.message;
  6790. if (typeof locale === "string") {
  6791. locale = normalizeLocale(locale, this.messages);
  6792. locale && (message = this.messages[locale]);
  6793. } else {
  6794. values = locale;
  6795. }
  6796. if (!hasOwn(message, key)) {
  6797. console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`);
  6798. return key;
  6799. }
  6800. return this.formater.interpolate(message[key], values).join("");
  6801. }
  6802. }
  6803. function watchAppLocale(appVm, i18n) {
  6804. if (appVm.$watchLocale) {
  6805. appVm.$watchLocale((newLocale) => {
  6806. i18n.setLocale(newLocale);
  6807. });
  6808. } else {
  6809. appVm.$watch(() => appVm.$locale, (newLocale) => {
  6810. i18n.setLocale(newLocale);
  6811. });
  6812. }
  6813. }
  6814. function getDefaultLocale() {
  6815. if (typeof uni !== "undefined" && uni.getLocale) {
  6816. return uni.getLocale();
  6817. }
  6818. if (typeof global !== "undefined" && global.getLocale) {
  6819. return global.getLocale();
  6820. }
  6821. return LOCALE_EN;
  6822. }
  6823. function initVueI18n(locale, messages2 = {}, fallbackLocale, watcher) {
  6824. if (typeof locale !== "string") {
  6825. const options = [
  6826. messages2,
  6827. locale
  6828. ];
  6829. locale = options[0];
  6830. messages2 = options[1];
  6831. }
  6832. if (typeof locale !== "string") {
  6833. locale = getDefaultLocale();
  6834. }
  6835. if (typeof fallbackLocale !== "string") {
  6836. fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN;
  6837. }
  6838. const i18n = new I18n({
  6839. locale,
  6840. fallbackLocale,
  6841. messages: messages2,
  6842. watcher
  6843. });
  6844. let t2 = (key, values) => {
  6845. if (typeof getApp !== "function") {
  6846. t2 = function(key2, values2) {
  6847. return i18n.t(key2, values2);
  6848. };
  6849. } else {
  6850. let isWatchedAppLocale = false;
  6851. t2 = function(key2, values2) {
  6852. const appVm = getApp().$vm;
  6853. if (appVm) {
  6854. appVm.$locale;
  6855. if (!isWatchedAppLocale) {
  6856. isWatchedAppLocale = true;
  6857. watchAppLocale(appVm, i18n);
  6858. }
  6859. }
  6860. return i18n.t(key2, values2);
  6861. };
  6862. }
  6863. return t2(key, values);
  6864. };
  6865. return {
  6866. i18n,
  6867. f(message, values, delimiters) {
  6868. return i18n.f(message, values, delimiters);
  6869. },
  6870. t(key, values) {
  6871. return t2(key, values);
  6872. },
  6873. add(locale2, message, override = true) {
  6874. return i18n.add(locale2, message, override);
  6875. },
  6876. watch(fn) {
  6877. return i18n.watchLocale(fn);
  6878. },
  6879. getLocale() {
  6880. return i18n.getLocale();
  6881. },
  6882. setLocale(newLocale) {
  6883. return i18n.setLocale(newLocale);
  6884. }
  6885. };
  6886. }
  6887. const en$1 = {
  6888. "uni-load-more.contentdown": "Pull up to show more",
  6889. "uni-load-more.contentrefresh": "loading...",
  6890. "uni-load-more.contentnomore": "No more data"
  6891. };
  6892. const zhHans$1 = {
  6893. "uni-load-more.contentdown": "上拉显示更多",
  6894. "uni-load-more.contentrefresh": "正在加载...",
  6895. "uni-load-more.contentnomore": "没有更多数据了"
  6896. };
  6897. const zhHant$1 = {
  6898. "uni-load-more.contentdown": "上拉顯示更多",
  6899. "uni-load-more.contentrefresh": "正在加載...",
  6900. "uni-load-more.contentnomore": "沒有更多數據了"
  6901. };
  6902. const messages$1 = {
  6903. en: en$1,
  6904. "zh-Hans": zhHans$1,
  6905. "zh-Hant": zhHant$1
  6906. };
  6907. let platform;
  6908. setTimeout(() => {
  6909. platform = uni.getSystemInfoSync().platform;
  6910. }, 16);
  6911. const {
  6912. t: t$1
  6913. } = initVueI18n(messages$1);
  6914. const _sfc_main$t = {
  6915. name: "UniLoadMore",
  6916. emits: ["clickLoadMore"],
  6917. props: {
  6918. status: {
  6919. // 上拉的状态:more-loading前;loading-loading中;noMore-没有更多了
  6920. type: String,
  6921. default: "more"
  6922. },
  6923. showIcon: {
  6924. type: Boolean,
  6925. default: true
  6926. },
  6927. iconType: {
  6928. type: String,
  6929. default: "auto"
  6930. },
  6931. iconSize: {
  6932. type: Number,
  6933. default: 24
  6934. },
  6935. color: {
  6936. type: String,
  6937. default: "#777777"
  6938. },
  6939. contentText: {
  6940. type: Object,
  6941. default() {
  6942. return {
  6943. contentdown: "",
  6944. contentrefresh: "",
  6945. contentnomore: ""
  6946. };
  6947. }
  6948. },
  6949. showText: {
  6950. type: Boolean,
  6951. default: true
  6952. }
  6953. },
  6954. data() {
  6955. return {
  6956. webviewHide: false,
  6957. platform,
  6958. 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="
  6959. };
  6960. },
  6961. computed: {
  6962. iconSnowWidth() {
  6963. return (Math.floor(this.iconSize / 24) || 1) * 2;
  6964. },
  6965. contentdownText() {
  6966. return this.contentText.contentdown || t$1("uni-load-more.contentdown");
  6967. },
  6968. contentrefreshText() {
  6969. return this.contentText.contentrefresh || t$1("uni-load-more.contentrefresh");
  6970. },
  6971. contentnomoreText() {
  6972. return this.contentText.contentnomore || t$1("uni-load-more.contentnomore");
  6973. }
  6974. },
  6975. mounted() {
  6976. var pages2 = getCurrentPages();
  6977. var page = pages2[pages2.length - 1];
  6978. var currentWebview = page.$getAppWebview();
  6979. currentWebview.addEventListener("hide", () => {
  6980. this.webviewHide = true;
  6981. });
  6982. currentWebview.addEventListener("show", () => {
  6983. this.webviewHide = false;
  6984. });
  6985. },
  6986. methods: {
  6987. onClick() {
  6988. this.$emit("clickLoadMore", {
  6989. detail: {
  6990. status: this.status
  6991. }
  6992. });
  6993. }
  6994. }
  6995. };
  6996. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  6997. return vue.openBlock(), vue.createElementBlock("view", {
  6998. class: "uni-load-more",
  6999. onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
  7000. }, [
  7001. !$data.webviewHide && ($props.iconType === "circle" || $props.iconType === "auto" && $data.platform === "android") && $props.status === "loading" && $props.showIcon ? (vue.openBlock(), vue.createElementBlock(
  7002. "view",
  7003. {
  7004. key: 0,
  7005. style: vue.normalizeStyle({ width: $props.iconSize + "px", height: $props.iconSize + "px" }),
  7006. class: "uni-load-more__img uni-load-more__img--android-MP"
  7007. },
  7008. [
  7009. vue.createElementVNode(
  7010. "view",
  7011. {
  7012. class: "uni-load-more__img-icon",
  7013. style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
  7014. },
  7015. null,
  7016. 4
  7017. /* STYLE */
  7018. ),
  7019. vue.createElementVNode(
  7020. "view",
  7021. {
  7022. class: "uni-load-more__img-icon",
  7023. style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
  7024. },
  7025. null,
  7026. 4
  7027. /* STYLE */
  7028. ),
  7029. vue.createElementVNode(
  7030. "view",
  7031. {
  7032. class: "uni-load-more__img-icon",
  7033. style: vue.normalizeStyle({ borderTopColor: $props.color, borderTopWidth: $props.iconSize / 12 })
  7034. },
  7035. null,
  7036. 4
  7037. /* STYLE */
  7038. )
  7039. ],
  7040. 4
  7041. /* STYLE */
  7042. )) : !$data.webviewHide && $props.status === "loading" && $props.showIcon ? (vue.openBlock(), vue.createElementBlock(
  7043. "view",
  7044. {
  7045. key: 1,
  7046. style: vue.normalizeStyle({ width: $props.iconSize + "px", height: $props.iconSize + "px" }),
  7047. class: "uni-load-more__img uni-load-more__img--ios-H5"
  7048. },
  7049. [
  7050. vue.createElementVNode("image", {
  7051. src: $data.imgBase64,
  7052. mode: "widthFix"
  7053. }, null, 8, ["src"])
  7054. ],
  7055. 4
  7056. /* STYLE */
  7057. )) : vue.createCommentVNode("v-if", true),
  7058. $props.showText ? (vue.openBlock(), vue.createElementBlock(
  7059. "text",
  7060. {
  7061. key: 2,
  7062. class: "uni-load-more__text",
  7063. style: vue.normalizeStyle({ color: $props.color })
  7064. },
  7065. vue.toDisplayString($props.status === "more" ? $options.contentdownText : $props.status === "loading" ? $options.contentrefreshText : $options.contentnomoreText),
  7066. 5
  7067. /* TEXT, STYLE */
  7068. )) : vue.createCommentVNode("v-if", true)
  7069. ]);
  7070. }
  7071. const __easycom_0$5 = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$s], ["__scopeId", "data-v-9245e42c"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue"]]);
  7072. const _sfc_main$s = {
  7073. name: "uniDataChecklist",
  7074. mixins: [Ys.mixinDatacom || {}],
  7075. emits: ["input", "update:modelValue", "change"],
  7076. props: {
  7077. mode: {
  7078. type: String,
  7079. default: "default"
  7080. },
  7081. multiple: {
  7082. type: Boolean,
  7083. default: false
  7084. },
  7085. value: {
  7086. type: [Array, String, Number],
  7087. default() {
  7088. return "";
  7089. }
  7090. },
  7091. // TODO vue3
  7092. modelValue: {
  7093. type: [Array, String, Number],
  7094. default() {
  7095. return "";
  7096. }
  7097. },
  7098. localdata: {
  7099. type: Array,
  7100. default() {
  7101. return [];
  7102. }
  7103. },
  7104. min: {
  7105. type: [Number, String],
  7106. default: ""
  7107. },
  7108. max: {
  7109. type: [Number, String],
  7110. default: ""
  7111. },
  7112. wrap: {
  7113. type: Boolean,
  7114. default: false
  7115. },
  7116. icon: {
  7117. type: String,
  7118. default: "left"
  7119. },
  7120. selectedColor: {
  7121. type: String,
  7122. default: ""
  7123. },
  7124. selectedTextColor: {
  7125. type: String,
  7126. default: ""
  7127. },
  7128. emptyText: {
  7129. type: String,
  7130. default: "暂无数据"
  7131. },
  7132. disabled: {
  7133. type: Boolean,
  7134. default: false
  7135. },
  7136. map: {
  7137. type: Object,
  7138. default() {
  7139. return {
  7140. text: "text",
  7141. value: "value"
  7142. };
  7143. }
  7144. }
  7145. },
  7146. watch: {
  7147. localdata: {
  7148. handler(newVal) {
  7149. this.range = newVal;
  7150. this.dataList = this.getDataList(this.getSelectedValue(newVal));
  7151. },
  7152. deep: true
  7153. },
  7154. mixinDatacomResData(newVal) {
  7155. this.range = newVal;
  7156. this.dataList = this.getDataList(this.getSelectedValue(newVal));
  7157. },
  7158. value(newVal) {
  7159. this.dataList = this.getDataList(newVal);
  7160. },
  7161. modelValue(newVal) {
  7162. this.dataList = this.getDataList(newVal);
  7163. }
  7164. },
  7165. data() {
  7166. return {
  7167. dataList: [],
  7168. range: [],
  7169. contentText: {
  7170. contentdown: "查看更多",
  7171. contentrefresh: "加载中",
  7172. contentnomore: "没有更多"
  7173. },
  7174. isLocal: true,
  7175. styles: {
  7176. selectedColor: "#2979ff",
  7177. selectedTextColor: "#666"
  7178. },
  7179. isTop: 0
  7180. };
  7181. },
  7182. computed: {
  7183. dataValue() {
  7184. if (this.value === "")
  7185. return this.modelValue;
  7186. if (this.modelValue === "")
  7187. return this.value;
  7188. return this.value;
  7189. }
  7190. },
  7191. created() {
  7192. if (this.localdata && this.localdata.length !== 0) {
  7193. this.isLocal = true;
  7194. this.range = this.localdata;
  7195. this.dataList = this.getDataList(this.getSelectedValue(this.range));
  7196. } else {
  7197. if (this.collection) {
  7198. this.isLocal = false;
  7199. this.loadData();
  7200. }
  7201. }
  7202. },
  7203. methods: {
  7204. loadData() {
  7205. this.mixinDatacomGet().then((res) => {
  7206. this.mixinDatacomResData = res.result.data;
  7207. if (this.mixinDatacomResData.length === 0) {
  7208. this.isLocal = false;
  7209. this.mixinDatacomErrorMessage = this.emptyText;
  7210. } else {
  7211. this.isLocal = true;
  7212. }
  7213. }).catch((err) => {
  7214. this.mixinDatacomErrorMessage = err.message;
  7215. });
  7216. },
  7217. /**
  7218. * 获取父元素实例
  7219. */
  7220. getForm(name = "uniForms") {
  7221. let parent = this.$parent;
  7222. let parentName = parent.$options.name;
  7223. while (parentName !== name) {
  7224. parent = parent.$parent;
  7225. if (!parent)
  7226. return false;
  7227. parentName = parent.$options.name;
  7228. }
  7229. return parent;
  7230. },
  7231. change(e2) {
  7232. const values = e2.detail.value;
  7233. let detail = {
  7234. value: [],
  7235. data: []
  7236. };
  7237. if (this.multiple) {
  7238. this.range.forEach((item) => {
  7239. if (values.includes(item[this.map.value] + "")) {
  7240. detail.value.push(item[this.map.value]);
  7241. detail.data.push(item);
  7242. }
  7243. });
  7244. } else {
  7245. const range = this.range.find((item) => item[this.map.value] + "" === values);
  7246. if (range) {
  7247. detail = {
  7248. value: range[this.map.value],
  7249. data: range
  7250. };
  7251. }
  7252. }
  7253. this.$emit("input", detail.value);
  7254. this.$emit("update:modelValue", detail.value);
  7255. this.$emit("change", {
  7256. detail
  7257. });
  7258. if (this.multiple) {
  7259. this.dataList = this.getDataList(detail.value, true);
  7260. } else {
  7261. this.dataList = this.getDataList(detail.value);
  7262. }
  7263. },
  7264. /**
  7265. * 获取渲染的新数组
  7266. * @param {Object} value 选中内容
  7267. */
  7268. getDataList(value) {
  7269. let dataList = JSON.parse(JSON.stringify(this.range));
  7270. let list = [];
  7271. if (this.multiple) {
  7272. if (!Array.isArray(value)) {
  7273. value = [];
  7274. }
  7275. }
  7276. dataList.forEach((item, index) => {
  7277. item.disabled = item.disable || item.disabled || false;
  7278. if (this.multiple) {
  7279. if (value.length > 0) {
  7280. let have = value.find((val) => val === item[this.map.value]);
  7281. item.selected = have !== void 0;
  7282. } else {
  7283. item.selected = false;
  7284. }
  7285. } else {
  7286. item.selected = value === item[this.map.value];
  7287. }
  7288. list.push(item);
  7289. });
  7290. return this.setRange(list);
  7291. },
  7292. /**
  7293. * 处理最大最小值
  7294. * @param {Object} list
  7295. */
  7296. setRange(list) {
  7297. let selectList = list.filter((item) => item.selected);
  7298. let min = Number(this.min) || 0;
  7299. let max = Number(this.max) || "";
  7300. list.forEach((item, index) => {
  7301. if (this.multiple) {
  7302. if (selectList.length <= min) {
  7303. let have = selectList.find((val) => val[this.map.value] === item[this.map.value]);
  7304. if (have !== void 0) {
  7305. item.disabled = true;
  7306. }
  7307. }
  7308. if (selectList.length >= max && max !== "") {
  7309. let have = selectList.find((val) => val[this.map.value] === item[this.map.value]);
  7310. if (have === void 0) {
  7311. item.disabled = true;
  7312. }
  7313. }
  7314. }
  7315. this.setStyles(item, index);
  7316. list[index] = item;
  7317. });
  7318. return list;
  7319. },
  7320. /**
  7321. * 设置 class
  7322. * @param {Object} item
  7323. * @param {Object} index
  7324. */
  7325. setStyles(item, index) {
  7326. item.styleBackgroud = this.setStyleBackgroud(item);
  7327. item.styleIcon = this.setStyleIcon(item);
  7328. item.styleIconText = this.setStyleIconText(item);
  7329. item.styleRightIcon = this.setStyleRightIcon(item);
  7330. },
  7331. /**
  7332. * 获取选中值
  7333. * @param {Object} range
  7334. */
  7335. getSelectedValue(range) {
  7336. if (!this.multiple)
  7337. return this.dataValue;
  7338. let selectedArr = [];
  7339. range.forEach((item) => {
  7340. if (item.selected) {
  7341. selectedArr.push(item[this.map.value]);
  7342. }
  7343. });
  7344. return this.dataValue.length > 0 ? this.dataValue : selectedArr;
  7345. },
  7346. /**
  7347. * 设置背景样式
  7348. */
  7349. setStyleBackgroud(item) {
  7350. let styles = {};
  7351. let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
  7352. if (this.selectedColor) {
  7353. if (this.mode !== "list") {
  7354. styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
  7355. }
  7356. if (this.mode === "tag") {
  7357. styles["background-color"] = item.selected ? selectedColor : "#f5f5f5";
  7358. }
  7359. }
  7360. let classles = "";
  7361. for (let i2 in styles) {
  7362. classles += `${i2}:${styles[i2]};`;
  7363. }
  7364. return classles;
  7365. },
  7366. setStyleIcon(item) {
  7367. let styles = {};
  7368. let classles = "";
  7369. if (this.selectedColor) {
  7370. let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
  7371. styles["background-color"] = item.selected ? selectedColor : "#fff";
  7372. styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
  7373. if (!item.selected && item.disabled) {
  7374. styles["background-color"] = "#F2F6FC";
  7375. styles["border-color"] = item.selected ? selectedColor : "#DCDFE6";
  7376. }
  7377. }
  7378. for (let i2 in styles) {
  7379. classles += `${i2}:${styles[i2]};`;
  7380. }
  7381. return classles;
  7382. },
  7383. setStyleIconText(item) {
  7384. let styles = {};
  7385. let classles = "";
  7386. if (this.selectedColor) {
  7387. let selectedColor = this.selectedColor ? this.selectedColor : "#2979ff";
  7388. if (this.mode === "tag") {
  7389. styles.color = item.selected ? this.selectedTextColor ? this.selectedTextColor : "#fff" : "#666";
  7390. } else {
  7391. styles.color = item.selected ? this.selectedTextColor ? this.selectedTextColor : selectedColor : "#666";
  7392. }
  7393. if (!item.selected && item.disabled) {
  7394. styles.color = "#999";
  7395. }
  7396. }
  7397. for (let i2 in styles) {
  7398. classles += `${i2}:${styles[i2]};`;
  7399. }
  7400. return classles;
  7401. },
  7402. setStyleRightIcon(item) {
  7403. let styles = {};
  7404. let classles = "";
  7405. if (this.mode === "list") {
  7406. styles["border-color"] = item.selected ? this.styles.selectedColor : "#DCDFE6";
  7407. }
  7408. for (let i2 in styles) {
  7409. classles += `${i2}:${styles[i2]};`;
  7410. }
  7411. return classles;
  7412. }
  7413. }
  7414. };
  7415. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  7416. const _component_uni_load_more = resolveEasycom(vue.resolveDynamicComponent("uni-load-more"), __easycom_0$5);
  7417. return vue.openBlock(), vue.createElementBlock(
  7418. "view",
  7419. {
  7420. class: "uni-data-checklist",
  7421. style: vue.normalizeStyle({ "margin-top": $data.isTop + "px" })
  7422. },
  7423. [
  7424. !$data.isLocal ? (vue.openBlock(), vue.createElementBlock("view", {
  7425. key: 0,
  7426. class: "uni-data-loading"
  7427. }, [
  7428. !_ctx.mixinDatacomErrorMessage ? (vue.openBlock(), vue.createBlock(_component_uni_load_more, {
  7429. key: 0,
  7430. status: "loading",
  7431. iconType: "snow",
  7432. iconSize: 18,
  7433. "content-text": $data.contentText
  7434. }, null, 8, ["content-text"])) : (vue.openBlock(), vue.createElementBlock(
  7435. "text",
  7436. { key: 1 },
  7437. vue.toDisplayString(_ctx.mixinDatacomErrorMessage),
  7438. 1
  7439. /* TEXT */
  7440. ))
  7441. ])) : (vue.openBlock(), vue.createElementBlock(
  7442. vue.Fragment,
  7443. { key: 1 },
  7444. [
  7445. $props.multiple ? (vue.openBlock(), vue.createElementBlock(
  7446. "checkbox-group",
  7447. {
  7448. key: 0,
  7449. class: vue.normalizeClass(["checklist-group", { "is-list": $props.mode === "list" || $props.wrap }]),
  7450. onChange: _cache[0] || (_cache[0] = (...args) => $options.change && $options.change(...args))
  7451. },
  7452. [
  7453. (vue.openBlock(true), vue.createElementBlock(
  7454. vue.Fragment,
  7455. null,
  7456. vue.renderList($data.dataList, (item, index) => {
  7457. return vue.openBlock(), vue.createElementBlock(
  7458. "label",
  7459. {
  7460. 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" : ""]]),
  7461. style: vue.normalizeStyle(item.styleBackgroud),
  7462. key: index
  7463. },
  7464. [
  7465. vue.createElementVNode("checkbox", {
  7466. class: "hidden",
  7467. hidden: "",
  7468. disabled: $props.disabled || !!item.disabled,
  7469. value: item[$props.map.value] + "",
  7470. checked: item.selected
  7471. }, null, 8, ["disabled", "value", "checked"]),
  7472. $props.mode !== "tag" && $props.mode !== "list" || $props.mode === "list" && $props.icon === "left" ? (vue.openBlock(), vue.createElementBlock(
  7473. "view",
  7474. {
  7475. key: 0,
  7476. class: "checkbox__inner",
  7477. style: vue.normalizeStyle(item.styleIcon)
  7478. },
  7479. [
  7480. vue.createElementVNode("view", { class: "checkbox__inner-icon" })
  7481. ],
  7482. 4
  7483. /* STYLE */
  7484. )) : vue.createCommentVNode("v-if", true),
  7485. vue.createElementVNode(
  7486. "view",
  7487. {
  7488. class: vue.normalizeClass(["checklist-content", { "list-content": $props.mode === "list" && $props.icon === "left" }])
  7489. },
  7490. [
  7491. vue.createElementVNode(
  7492. "text",
  7493. {
  7494. class: "checklist-text",
  7495. style: vue.normalizeStyle(item.styleIconText)
  7496. },
  7497. vue.toDisplayString(item[$props.map.text]),
  7498. 5
  7499. /* TEXT, STYLE */
  7500. ),
  7501. $props.mode === "list" && $props.icon === "right" ? (vue.openBlock(), vue.createElementBlock(
  7502. "view",
  7503. {
  7504. key: 0,
  7505. class: "checkobx__list",
  7506. style: vue.normalizeStyle(item.styleBackgroud)
  7507. },
  7508. null,
  7509. 4
  7510. /* STYLE */
  7511. )) : vue.createCommentVNode("v-if", true)
  7512. ],
  7513. 2
  7514. /* CLASS */
  7515. )
  7516. ],
  7517. 6
  7518. /* CLASS, STYLE */
  7519. );
  7520. }),
  7521. 128
  7522. /* KEYED_FRAGMENT */
  7523. ))
  7524. ],
  7525. 34
  7526. /* CLASS, NEED_HYDRATION */
  7527. )) : (vue.openBlock(), vue.createElementBlock(
  7528. "radio-group",
  7529. {
  7530. key: 1,
  7531. class: vue.normalizeClass(["checklist-group", { "is-list": $props.mode === "list", "is-wrap": $props.wrap }]),
  7532. onChange: _cache[1] || (_cache[1] = (...args) => $options.change && $options.change(...args))
  7533. },
  7534. [
  7535. (vue.openBlock(true), vue.createElementBlock(
  7536. vue.Fragment,
  7537. null,
  7538. vue.renderList($data.dataList, (item, index) => {
  7539. return vue.openBlock(), vue.createElementBlock(
  7540. "label",
  7541. {
  7542. 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" : ""]]),
  7543. style: vue.normalizeStyle(item.styleBackgroud),
  7544. key: index
  7545. },
  7546. [
  7547. vue.createElementVNode("radio", {
  7548. class: "hidden",
  7549. hidden: "",
  7550. disabled: $props.disabled || item.disabled,
  7551. value: item[$props.map.value] + "",
  7552. checked: item.selected
  7553. }, null, 8, ["disabled", "value", "checked"]),
  7554. $props.mode !== "tag" && $props.mode !== "list" || $props.mode === "list" && $props.icon === "left" ? (vue.openBlock(), vue.createElementBlock(
  7555. "view",
  7556. {
  7557. key: 0,
  7558. class: "radio__inner",
  7559. style: vue.normalizeStyle(item.styleBackgroud)
  7560. },
  7561. [
  7562. vue.createElementVNode(
  7563. "view",
  7564. {
  7565. class: "radio__inner-icon",
  7566. style: vue.normalizeStyle(item.styleIcon)
  7567. },
  7568. null,
  7569. 4
  7570. /* STYLE */
  7571. )
  7572. ],
  7573. 4
  7574. /* STYLE */
  7575. )) : vue.createCommentVNode("v-if", true),
  7576. vue.createElementVNode(
  7577. "view",
  7578. {
  7579. class: vue.normalizeClass(["checklist-content", { "list-content": $props.mode === "list" && $props.icon === "left" }])
  7580. },
  7581. [
  7582. vue.createElementVNode(
  7583. "text",
  7584. {
  7585. class: "checklist-text",
  7586. style: vue.normalizeStyle(item.styleIconText)
  7587. },
  7588. vue.toDisplayString(item[$props.map.text]),
  7589. 5
  7590. /* TEXT, STYLE */
  7591. ),
  7592. $props.mode === "list" && $props.icon === "right" ? (vue.openBlock(), vue.createElementBlock(
  7593. "view",
  7594. {
  7595. key: 0,
  7596. style: vue.normalizeStyle(item.styleRightIcon),
  7597. class: "checkobx__list"
  7598. },
  7599. null,
  7600. 4
  7601. /* STYLE */
  7602. )) : vue.createCommentVNode("v-if", true)
  7603. ],
  7604. 2
  7605. /* CLASS */
  7606. )
  7607. ],
  7608. 6
  7609. /* CLASS, STYLE */
  7610. );
  7611. }),
  7612. 128
  7613. /* KEYED_FRAGMENT */
  7614. ))
  7615. ],
  7616. 34
  7617. /* CLASS, NEED_HYDRATION */
  7618. ))
  7619. ],
  7620. 64
  7621. /* STABLE_FRAGMENT */
  7622. ))
  7623. ],
  7624. 4
  7625. /* STYLE */
  7626. );
  7627. }
  7628. const __easycom_0$4 = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$r], ["__scopeId", "data-v-2f788efd"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue"]]);
  7629. var pattern = {
  7630. email: /^\S+?@\S+?\.\S+?$/,
  7631. 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]$/,
  7632. url: new RegExp(
  7633. "^(?!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]*)?$",
  7634. "i"
  7635. )
  7636. };
  7637. const FORMAT_MAPPING = {
  7638. "int": "integer",
  7639. "bool": "boolean",
  7640. "double": "number",
  7641. "long": "number",
  7642. "password": "string"
  7643. // "fileurls": 'array'
  7644. };
  7645. function formatMessage(args, resources = "") {
  7646. var defaultMessage = ["label"];
  7647. defaultMessage.forEach((item) => {
  7648. if (args[item] === void 0) {
  7649. args[item] = "";
  7650. }
  7651. });
  7652. let str = resources;
  7653. for (let key in args) {
  7654. let reg = new RegExp("{" + key + "}");
  7655. str = str.replace(reg, args[key]);
  7656. }
  7657. return str;
  7658. }
  7659. function isEmptyValue(value, type) {
  7660. if (value === void 0 || value === null) {
  7661. return true;
  7662. }
  7663. if (typeof value === "string" && !value) {
  7664. return true;
  7665. }
  7666. if (Array.isArray(value) && !value.length) {
  7667. return true;
  7668. }
  7669. if (type === "object" && !Object.keys(value).length) {
  7670. return true;
  7671. }
  7672. return false;
  7673. }
  7674. const types = {
  7675. integer(value) {
  7676. return types.number(value) && parseInt(value, 10) === value;
  7677. },
  7678. string(value) {
  7679. return typeof value === "string";
  7680. },
  7681. number(value) {
  7682. if (isNaN(value)) {
  7683. return false;
  7684. }
  7685. return typeof value === "number";
  7686. },
  7687. "boolean": function(value) {
  7688. return typeof value === "boolean";
  7689. },
  7690. "float": function(value) {
  7691. return types.number(value) && !types.integer(value);
  7692. },
  7693. array(value) {
  7694. return Array.isArray(value);
  7695. },
  7696. object(value) {
  7697. return typeof value === "object" && !types.array(value);
  7698. },
  7699. date(value) {
  7700. return value instanceof Date;
  7701. },
  7702. timestamp(value) {
  7703. if (!this.integer(value) || Math.abs(value).toString().length > 16) {
  7704. return false;
  7705. }
  7706. return true;
  7707. },
  7708. file(value) {
  7709. return typeof value.url === "string";
  7710. },
  7711. email(value) {
  7712. return typeof value === "string" && !!value.match(pattern.email) && value.length < 255;
  7713. },
  7714. url(value) {
  7715. return typeof value === "string" && !!value.match(pattern.url);
  7716. },
  7717. pattern(reg, value) {
  7718. try {
  7719. return new RegExp(reg).test(value);
  7720. } catch (e2) {
  7721. return false;
  7722. }
  7723. },
  7724. method(value) {
  7725. return typeof value === "function";
  7726. },
  7727. idcard(value) {
  7728. return typeof value === "string" && !!value.match(pattern.idcard);
  7729. },
  7730. "url-https"(value) {
  7731. return this.url(value) && value.startsWith("https://");
  7732. },
  7733. "url-scheme"(value) {
  7734. return value.startsWith("://");
  7735. },
  7736. "url-web"(value) {
  7737. return false;
  7738. }
  7739. };
  7740. class RuleValidator {
  7741. constructor(message) {
  7742. this._message = message;
  7743. }
  7744. async validateRule(fieldKey, fieldValue, value, data, allData) {
  7745. var result = null;
  7746. let rules = fieldValue.rules;
  7747. let hasRequired = rules.findIndex((item) => {
  7748. return item.required;
  7749. });
  7750. if (hasRequired < 0) {
  7751. if (value === null || value === void 0) {
  7752. return result;
  7753. }
  7754. if (typeof value === "string" && !value.length) {
  7755. return result;
  7756. }
  7757. }
  7758. var message = this._message;
  7759. if (rules === void 0) {
  7760. return message["default"];
  7761. }
  7762. for (var i2 = 0; i2 < rules.length; i2++) {
  7763. let rule = rules[i2];
  7764. let vt2 = this._getValidateType(rule);
  7765. Object.assign(rule, {
  7766. label: fieldValue.label || `["${fieldKey}"]`
  7767. });
  7768. if (RuleValidatorHelper[vt2]) {
  7769. result = RuleValidatorHelper[vt2](rule, value, message);
  7770. if (result != null) {
  7771. break;
  7772. }
  7773. }
  7774. if (rule.validateExpr) {
  7775. let now = Date.now();
  7776. let resultExpr = rule.validateExpr(value, allData, now);
  7777. if (resultExpr === false) {
  7778. result = this._getMessage(rule, rule.errorMessage || this._message["default"]);
  7779. break;
  7780. }
  7781. }
  7782. if (rule.validateFunction) {
  7783. result = await this.validateFunction(rule, value, data, allData, vt2);
  7784. if (result !== null) {
  7785. break;
  7786. }
  7787. }
  7788. }
  7789. if (result !== null) {
  7790. result = message.TAG + result;
  7791. }
  7792. return result;
  7793. }
  7794. async validateFunction(rule, value, data, allData, vt2) {
  7795. let result = null;
  7796. try {
  7797. let callbackMessage = null;
  7798. const res = await rule.validateFunction(rule, value, allData || data, (message) => {
  7799. callbackMessage = message;
  7800. });
  7801. if (callbackMessage || typeof res === "string" && res || res === false) {
  7802. result = this._getMessage(rule, callbackMessage || res, vt2);
  7803. }
  7804. } catch (e2) {
  7805. result = this._getMessage(rule, e2.message, vt2);
  7806. }
  7807. return result;
  7808. }
  7809. _getMessage(rule, message, vt2) {
  7810. return formatMessage(rule, message || rule.errorMessage || this._message[vt2] || message["default"]);
  7811. }
  7812. _getValidateType(rule) {
  7813. var result = "";
  7814. if (rule.required) {
  7815. result = "required";
  7816. } else if (rule.format) {
  7817. result = "format";
  7818. } else if (rule.arrayType) {
  7819. result = "arrayTypeFormat";
  7820. } else if (rule.range) {
  7821. result = "range";
  7822. } else if (rule.maximum !== void 0 || rule.minimum !== void 0) {
  7823. result = "rangeNumber";
  7824. } else if (rule.maxLength !== void 0 || rule.minLength !== void 0) {
  7825. result = "rangeLength";
  7826. } else if (rule.pattern) {
  7827. result = "pattern";
  7828. } else if (rule.validateFunction) {
  7829. result = "validateFunction";
  7830. }
  7831. return result;
  7832. }
  7833. }
  7834. const RuleValidatorHelper = {
  7835. required(rule, value, message) {
  7836. if (rule.required && isEmptyValue(value, rule.format || typeof value)) {
  7837. return formatMessage(rule, rule.errorMessage || message.required);
  7838. }
  7839. return null;
  7840. },
  7841. range(rule, value, message) {
  7842. const {
  7843. range,
  7844. errorMessage
  7845. } = rule;
  7846. let list = new Array(range.length);
  7847. for (let i2 = 0; i2 < range.length; i2++) {
  7848. const item = range[i2];
  7849. if (types.object(item) && item.value !== void 0) {
  7850. list[i2] = item.value;
  7851. } else {
  7852. list[i2] = item;
  7853. }
  7854. }
  7855. let result = false;
  7856. if (Array.isArray(value)) {
  7857. result = new Set(value.concat(list)).size === list.length;
  7858. } else {
  7859. if (list.indexOf(value) > -1) {
  7860. result = true;
  7861. }
  7862. }
  7863. if (!result) {
  7864. return formatMessage(rule, errorMessage || message["enum"]);
  7865. }
  7866. return null;
  7867. },
  7868. rangeNumber(rule, value, message) {
  7869. if (!types.number(value)) {
  7870. return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
  7871. }
  7872. let {
  7873. minimum,
  7874. maximum,
  7875. exclusiveMinimum,
  7876. exclusiveMaximum
  7877. } = rule;
  7878. let min = exclusiveMinimum ? value <= minimum : value < minimum;
  7879. let max = exclusiveMaximum ? value >= maximum : value > maximum;
  7880. if (minimum !== void 0 && min) {
  7881. return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMinimum ? "exclusiveMinimum" : "minimum"]);
  7882. } else if (maximum !== void 0 && max) {
  7883. return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMaximum ? "exclusiveMaximum" : "maximum"]);
  7884. } else if (minimum !== void 0 && maximum !== void 0 && (min || max)) {
  7885. return formatMessage(rule, rule.errorMessage || message["number"].range);
  7886. }
  7887. return null;
  7888. },
  7889. rangeLength(rule, value, message) {
  7890. if (!types.string(value) && !types.array(value)) {
  7891. return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
  7892. }
  7893. let min = rule.minLength;
  7894. let max = rule.maxLength;
  7895. let val = value.length;
  7896. if (min !== void 0 && val < min) {
  7897. return formatMessage(rule, rule.errorMessage || message["length"].minLength);
  7898. } else if (max !== void 0 && val > max) {
  7899. return formatMessage(rule, rule.errorMessage || message["length"].maxLength);
  7900. } else if (min !== void 0 && max !== void 0 && (val < min || val > max)) {
  7901. return formatMessage(rule, rule.errorMessage || message["length"].range);
  7902. }
  7903. return null;
  7904. },
  7905. pattern(rule, value, message) {
  7906. if (!types["pattern"](rule.pattern, value)) {
  7907. return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
  7908. }
  7909. return null;
  7910. },
  7911. format(rule, value, message) {
  7912. var customTypes = Object.keys(types);
  7913. var format = FORMAT_MAPPING[rule.format] ? FORMAT_MAPPING[rule.format] : rule.format || rule.arrayType;
  7914. if (customTypes.indexOf(format) > -1) {
  7915. if (!types[format](value)) {
  7916. return formatMessage(rule, rule.errorMessage || message.typeError);
  7917. }
  7918. }
  7919. return null;
  7920. },
  7921. arrayTypeFormat(rule, value, message) {
  7922. if (!Array.isArray(value)) {
  7923. return formatMessage(rule, rule.errorMessage || message.typeError);
  7924. }
  7925. for (let i2 = 0; i2 < value.length; i2++) {
  7926. const element = value[i2];
  7927. let formatResult = this.format(rule, element, message);
  7928. if (formatResult !== null) {
  7929. return formatResult;
  7930. }
  7931. }
  7932. return null;
  7933. }
  7934. };
  7935. class SchemaValidator extends RuleValidator {
  7936. constructor(schema, options) {
  7937. super(SchemaValidator.message);
  7938. this._schema = schema;
  7939. this._options = options || null;
  7940. }
  7941. updateSchema(schema) {
  7942. this._schema = schema;
  7943. }
  7944. async validate(data, allData) {
  7945. let result = this._checkFieldInSchema(data);
  7946. if (!result) {
  7947. result = await this.invokeValidate(data, false, allData);
  7948. }
  7949. return result.length ? result[0] : null;
  7950. }
  7951. async validateAll(data, allData) {
  7952. let result = this._checkFieldInSchema(data);
  7953. if (!result) {
  7954. result = await this.invokeValidate(data, true, allData);
  7955. }
  7956. return result;
  7957. }
  7958. async validateUpdate(data, allData) {
  7959. let result = this._checkFieldInSchema(data);
  7960. if (!result) {
  7961. result = await this.invokeValidateUpdate(data, false, allData);
  7962. }
  7963. return result.length ? result[0] : null;
  7964. }
  7965. async invokeValidate(data, all, allData) {
  7966. let result = [];
  7967. let schema = this._schema;
  7968. for (let key in schema) {
  7969. let value = schema[key];
  7970. let errorMessage = await this.validateRule(key, value, data[key], data, allData);
  7971. if (errorMessage != null) {
  7972. result.push({
  7973. key,
  7974. errorMessage
  7975. });
  7976. if (!all)
  7977. break;
  7978. }
  7979. }
  7980. return result;
  7981. }
  7982. async invokeValidateUpdate(data, all, allData) {
  7983. let result = [];
  7984. for (let key in data) {
  7985. let errorMessage = await this.validateRule(key, this._schema[key], data[key], data, allData);
  7986. if (errorMessage != null) {
  7987. result.push({
  7988. key,
  7989. errorMessage
  7990. });
  7991. if (!all)
  7992. break;
  7993. }
  7994. }
  7995. return result;
  7996. }
  7997. _checkFieldInSchema(data) {
  7998. var keys = Object.keys(data);
  7999. var keys2 = Object.keys(this._schema);
  8000. if (new Set(keys.concat(keys2)).size === keys2.length) {
  8001. return "";
  8002. }
  8003. var noExistFields = keys.filter((key) => {
  8004. return keys2.indexOf(key) < 0;
  8005. });
  8006. var errorMessage = formatMessage({
  8007. field: JSON.stringify(noExistFields)
  8008. }, SchemaValidator.message.TAG + SchemaValidator.message["defaultInvalid"]);
  8009. return [{
  8010. key: "invalid",
  8011. errorMessage
  8012. }];
  8013. }
  8014. }
  8015. function Message() {
  8016. return {
  8017. TAG: "",
  8018. default: "验证错误",
  8019. defaultInvalid: "提交的字段{field}在数据库中并不存在",
  8020. validateFunction: "验证无效",
  8021. required: "{label}必填",
  8022. "enum": "{label}超出范围",
  8023. timestamp: "{label}格式无效",
  8024. whitespace: "{label}不能为空",
  8025. typeError: "{label}类型无效",
  8026. date: {
  8027. format: "{label}日期{value}格式无效",
  8028. parse: "{label}日期无法解析,{value}无效",
  8029. invalid: "{label}日期{value}无效"
  8030. },
  8031. length: {
  8032. minLength: "{label}长度不能少于{minLength}",
  8033. maxLength: "{label}长度不能超过{maxLength}",
  8034. range: "{label}必须介于{minLength}和{maxLength}之间"
  8035. },
  8036. number: {
  8037. minimum: "{label}不能小于{minimum}",
  8038. maximum: "{label}不能大于{maximum}",
  8039. exclusiveMinimum: "{label}不能小于等于{minimum}",
  8040. exclusiveMaximum: "{label}不能大于等于{maximum}",
  8041. range: "{label}必须介于{minimum}and{maximum}之间"
  8042. },
  8043. pattern: {
  8044. mismatch: "{label}格式不匹配"
  8045. }
  8046. };
  8047. }
  8048. SchemaValidator.message = new Message();
  8049. const deepCopy = (val) => {
  8050. return JSON.parse(JSON.stringify(val));
  8051. };
  8052. const typeFilter = (format) => {
  8053. return format === "int" || format === "double" || format === "number" || format === "timestamp";
  8054. };
  8055. const getValue = (key, value, rules) => {
  8056. const isRuleNumType = rules.find((val) => val.format && typeFilter(val.format));
  8057. const isRuleBoolType = rules.find((val) => val.format && val.format === "boolean" || val.format === "bool");
  8058. if (!!isRuleNumType) {
  8059. if (!value && value !== 0) {
  8060. value = null;
  8061. } else {
  8062. value = isNumber(Number(value)) ? Number(value) : value;
  8063. }
  8064. }
  8065. if (!!isRuleBoolType) {
  8066. value = isBoolean(value) ? value : false;
  8067. }
  8068. return value;
  8069. };
  8070. const setDataValue = (field, formdata, value) => {
  8071. formdata[field] = value;
  8072. return value || "";
  8073. };
  8074. const getDataValue = (field, data) => {
  8075. return objGet(data, field);
  8076. };
  8077. const realName = (name, data = {}) => {
  8078. const base_name = _basePath(name);
  8079. if (typeof base_name === "object" && Array.isArray(base_name) && base_name.length > 1) {
  8080. const realname = base_name.reduce((a2, b2) => a2 += `#${b2}`, "_formdata_");
  8081. return realname;
  8082. }
  8083. return base_name[0] || name;
  8084. };
  8085. const isRealName = (name) => {
  8086. const reg = /^_formdata_#*/;
  8087. return reg.test(name);
  8088. };
  8089. const rawData = (object = {}, name) => {
  8090. let newData = JSON.parse(JSON.stringify(object));
  8091. let formData = {};
  8092. for (let i2 in newData) {
  8093. let path = name2arr(i2);
  8094. objSet(formData, path, newData[i2]);
  8095. }
  8096. return formData;
  8097. };
  8098. const name2arr = (name) => {
  8099. let field = name.replace("_formdata_#", "");
  8100. field = field.split("#").map((v2) => isNumber(v2) ? Number(v2) : v2);
  8101. return field;
  8102. };
  8103. const objSet = (object, path, value) => {
  8104. if (typeof object !== "object")
  8105. return object;
  8106. _basePath(path).reduce((o2, k, i2, _2) => {
  8107. if (i2 === _2.length - 1) {
  8108. o2[k] = value;
  8109. return null;
  8110. } else if (k in o2) {
  8111. return o2[k];
  8112. } else {
  8113. o2[k] = /^[0-9]{1,}$/.test(_2[i2 + 1]) ? [] : {};
  8114. return o2[k];
  8115. }
  8116. }, object);
  8117. return object;
  8118. };
  8119. function _basePath(path) {
  8120. if (Array.isArray(path))
  8121. return path;
  8122. return path.replace(/\[/g, ".").replace(/\]/g, "").split(".");
  8123. }
  8124. const objGet = (object, path, defaultVal = "undefined") => {
  8125. let newPath = _basePath(path);
  8126. let val = newPath.reduce((o2, k) => {
  8127. return (o2 || {})[k];
  8128. }, object);
  8129. return !val || val !== void 0 ? val : defaultVal;
  8130. };
  8131. const isNumber = (num) => {
  8132. return !isNaN(Number(num));
  8133. };
  8134. const isBoolean = (bool) => {
  8135. return typeof bool === "boolean";
  8136. };
  8137. const isRequiredField = (rules) => {
  8138. let isNoField = false;
  8139. for (let i2 = 0; i2 < rules.length; i2++) {
  8140. const ruleData = rules[i2];
  8141. if (ruleData.required) {
  8142. isNoField = true;
  8143. break;
  8144. }
  8145. }
  8146. return isNoField;
  8147. };
  8148. const isEqual = (a2, b2) => {
  8149. if (a2 === b2) {
  8150. return a2 !== 0 || 1 / a2 === 1 / b2;
  8151. }
  8152. if (a2 == null || b2 == null) {
  8153. return a2 === b2;
  8154. }
  8155. var classNameA = toString.call(a2), classNameB = toString.call(b2);
  8156. if (classNameA !== classNameB) {
  8157. return false;
  8158. }
  8159. switch (classNameA) {
  8160. case "[object RegExp]":
  8161. case "[object String]":
  8162. return "" + a2 === "" + b2;
  8163. case "[object Number]":
  8164. if (+a2 !== +a2) {
  8165. return +b2 !== +b2;
  8166. }
  8167. return +a2 === 0 ? 1 / +a2 === 1 / b2 : +a2 === +b2;
  8168. case "[object Date]":
  8169. case "[object Boolean]":
  8170. return +a2 === +b2;
  8171. }
  8172. if (classNameA == "[object Object]") {
  8173. var propsA = Object.getOwnPropertyNames(a2), propsB = Object.getOwnPropertyNames(b2);
  8174. if (propsA.length != propsB.length) {
  8175. return false;
  8176. }
  8177. for (var i2 = 0; i2 < propsA.length; i2++) {
  8178. var propName = propsA[i2];
  8179. if (a2[propName] !== b2[propName]) {
  8180. return false;
  8181. }
  8182. }
  8183. return true;
  8184. }
  8185. if (classNameA == "[object Array]") {
  8186. if (a2.toString() == b2.toString()) {
  8187. return true;
  8188. }
  8189. return false;
  8190. }
  8191. };
  8192. const _sfc_main$r = {
  8193. name: "uniForms",
  8194. emits: ["validate", "submit"],
  8195. options: {
  8196. virtualHost: true
  8197. },
  8198. props: {
  8199. // 即将弃用
  8200. value: {
  8201. type: Object,
  8202. default() {
  8203. return null;
  8204. }
  8205. },
  8206. // vue3 替换 value 属性
  8207. modelValue: {
  8208. type: Object,
  8209. default() {
  8210. return null;
  8211. }
  8212. },
  8213. // 1.4.0 开始将不支持 v-model ,且废弃 value 和 modelValue
  8214. model: {
  8215. type: Object,
  8216. default() {
  8217. return null;
  8218. }
  8219. },
  8220. // 表单校验规则
  8221. rules: {
  8222. type: Object,
  8223. default() {
  8224. return {};
  8225. }
  8226. },
  8227. //校验错误信息提示方式 默认 undertext 取值 [undertext|toast|modal]
  8228. errShowType: {
  8229. type: String,
  8230. default: "undertext"
  8231. },
  8232. // 校验触发器方式 默认 bind 取值 [bind|submit]
  8233. validateTrigger: {
  8234. type: String,
  8235. default: "submit"
  8236. },
  8237. // label 位置,默认 left 取值 top/left
  8238. labelPosition: {
  8239. type: String,
  8240. default: "left"
  8241. },
  8242. // label 宽度
  8243. labelWidth: {
  8244. type: [String, Number],
  8245. default: ""
  8246. },
  8247. // label 居中方式,默认 left 取值 left/center/right
  8248. labelAlign: {
  8249. type: String,
  8250. default: "left"
  8251. },
  8252. border: {
  8253. type: Boolean,
  8254. default: false
  8255. }
  8256. },
  8257. provide() {
  8258. return {
  8259. uniForm: this
  8260. };
  8261. },
  8262. data() {
  8263. return {
  8264. // 表单本地值的记录,不应该与传如的值进行关联
  8265. formData: {},
  8266. formRules: {}
  8267. };
  8268. },
  8269. computed: {
  8270. // 计算数据源变化的
  8271. localData() {
  8272. const localVal = this.model || this.modelValue || this.value;
  8273. if (localVal) {
  8274. return deepCopy(localVal);
  8275. }
  8276. return {};
  8277. }
  8278. },
  8279. watch: {
  8280. // 监听数据变化 ,暂时不使用,需要单独赋值
  8281. // localData: {},
  8282. // 监听规则变化
  8283. rules: {
  8284. handler: function(val, oldVal) {
  8285. this.setRules(val);
  8286. },
  8287. deep: true,
  8288. immediate: true
  8289. }
  8290. },
  8291. created() {
  8292. let getbinddata = getApp().$vm.$.appContext.config.globalProperties.binddata;
  8293. if (!getbinddata) {
  8294. getApp().$vm.$.appContext.config.globalProperties.binddata = function(name, value, formName) {
  8295. if (formName) {
  8296. this.$refs[formName].setValue(name, value);
  8297. } else {
  8298. let formVm;
  8299. for (let i2 in this.$refs) {
  8300. const vm = this.$refs[i2];
  8301. if (vm && vm.$options && vm.$options.name === "uniForms") {
  8302. formVm = vm;
  8303. break;
  8304. }
  8305. }
  8306. if (!formVm)
  8307. return formatAppLog("error", "at uni_modules/uni-forms/components/uni-forms/uni-forms.vue:182", "当前 uni-froms 组件缺少 ref 属性");
  8308. formVm.setValue(name, value);
  8309. }
  8310. };
  8311. }
  8312. this.childrens = [];
  8313. this.inputChildrens = [];
  8314. this.setRules(this.rules);
  8315. },
  8316. methods: {
  8317. /**
  8318. * 外部调用方法
  8319. * 设置规则 ,主要用于小程序自定义检验规则
  8320. * @param {Array} rules 规则源数据
  8321. */
  8322. setRules(rules) {
  8323. this.formRules = Object.assign({}, this.formRules, rules);
  8324. this.validator = new SchemaValidator(rules);
  8325. },
  8326. /**
  8327. * 外部调用方法
  8328. * 设置数据,用于设置表单数据,公开给用户使用 , 不支持在动态表单中使用
  8329. * @param {Object} key
  8330. * @param {Object} value
  8331. */
  8332. setValue(key, value) {
  8333. let example = this.childrens.find((child) => child.name === key);
  8334. if (!example)
  8335. return null;
  8336. this.formData[key] = getValue(key, value, this.formRules[key] && this.formRules[key].rules || []);
  8337. return example.onFieldChange(this.formData[key]);
  8338. },
  8339. /**
  8340. * 外部调用方法
  8341. * 手动提交校验表单
  8342. * 对整个表单进行校验的方法,参数为一个回调函数。
  8343. * @param {Array} keepitem 保留不参与校验的字段
  8344. * @param {type} callback 方法回调
  8345. */
  8346. validate(keepitem, callback) {
  8347. return this.checkAll(this.formData, keepitem, callback);
  8348. },
  8349. /**
  8350. * 外部调用方法
  8351. * 部分表单校验
  8352. * @param {Array|String} props 需要校验的字段
  8353. * @param {Function} 回调函数
  8354. */
  8355. validateField(props = [], callback) {
  8356. props = [].concat(props);
  8357. let invalidFields = {};
  8358. this.childrens.forEach((item) => {
  8359. const name = realName(item.name);
  8360. if (props.indexOf(name) !== -1) {
  8361. invalidFields = Object.assign({}, invalidFields, {
  8362. [name]: this.formData[name]
  8363. });
  8364. }
  8365. });
  8366. return this.checkAll(invalidFields, [], callback);
  8367. },
  8368. /**
  8369. * 外部调用方法
  8370. * 移除表单项的校验结果。传入待移除的表单项的 prop 属性或者 prop 组成的数组,如不传则移除整个表单的校验结果
  8371. * @param {Array|String} props 需要移除校验的字段 ,不填为所有
  8372. */
  8373. clearValidate(props = []) {
  8374. props = [].concat(props);
  8375. this.childrens.forEach((item) => {
  8376. if (props.length === 0) {
  8377. item.errMsg = "";
  8378. } else {
  8379. const name = realName(item.name);
  8380. if (props.indexOf(name) !== -1) {
  8381. item.errMsg = "";
  8382. }
  8383. }
  8384. });
  8385. },
  8386. /**
  8387. * 外部调用方法 ,即将废弃
  8388. * 手动提交校验表单
  8389. * 对整个表单进行校验的方法,参数为一个回调函数。
  8390. * @param {Array} keepitem 保留不参与校验的字段
  8391. * @param {type} callback 方法回调
  8392. */
  8393. submit(keepitem, callback, type) {
  8394. for (let i2 in this.dataValue) {
  8395. const itemData = this.childrens.find((v2) => v2.name === i2);
  8396. if (itemData) {
  8397. if (this.formData[i2] === void 0) {
  8398. this.formData[i2] = this._getValue(i2, this.dataValue[i2]);
  8399. }
  8400. }
  8401. }
  8402. if (!type) {
  8403. formatAppLog("warn", "at uni_modules/uni-forms/components/uni-forms/uni-forms.vue:289", "submit 方法即将废弃,请使用validate方法代替!");
  8404. }
  8405. return this.checkAll(this.formData, keepitem, callback, "submit");
  8406. },
  8407. // 校验所有
  8408. async checkAll(invalidFields, keepitem, callback, type) {
  8409. if (!this.validator)
  8410. return;
  8411. let childrens = [];
  8412. for (let i2 in invalidFields) {
  8413. const item = this.childrens.find((v2) => realName(v2.name) === i2);
  8414. if (item) {
  8415. childrens.push(item);
  8416. }
  8417. }
  8418. if (!callback && typeof keepitem === "function") {
  8419. callback = keepitem;
  8420. }
  8421. let promise;
  8422. if (!callback && typeof callback !== "function" && Promise) {
  8423. promise = new Promise((resolve, reject) => {
  8424. callback = function(valid, invalidFields2) {
  8425. !valid ? resolve(invalidFields2) : reject(valid);
  8426. };
  8427. });
  8428. }
  8429. let results = [];
  8430. let tempFormData = JSON.parse(JSON.stringify(invalidFields));
  8431. for (let i2 in childrens) {
  8432. const child = childrens[i2];
  8433. let name = realName(child.name);
  8434. const result = await child.onFieldChange(tempFormData[name]);
  8435. if (result) {
  8436. results.push(result);
  8437. if (this.errShowType === "toast" || this.errShowType === "modal")
  8438. break;
  8439. }
  8440. }
  8441. if (Array.isArray(results)) {
  8442. if (results.length === 0)
  8443. results = null;
  8444. }
  8445. if (Array.isArray(keepitem)) {
  8446. keepitem.forEach((v2) => {
  8447. let vName = realName(v2);
  8448. let value = getDataValue(v2, this.localData);
  8449. if (value !== void 0) {
  8450. tempFormData[vName] = value;
  8451. }
  8452. });
  8453. }
  8454. if (type === "submit") {
  8455. this.$emit("submit", {
  8456. detail: {
  8457. value: tempFormData,
  8458. errors: results
  8459. }
  8460. });
  8461. } else {
  8462. this.$emit("validate", results);
  8463. }
  8464. let resetFormData = {};
  8465. resetFormData = rawData(tempFormData, this.name);
  8466. callback && typeof callback === "function" && callback(results, resetFormData);
  8467. if (promise && callback) {
  8468. return promise;
  8469. } else {
  8470. return null;
  8471. }
  8472. },
  8473. /**
  8474. * 返回validate事件
  8475. * @param {Object} result
  8476. */
  8477. validateCheck(result) {
  8478. this.$emit("validate", result);
  8479. },
  8480. _getValue: getValue,
  8481. _isRequiredField: isRequiredField,
  8482. _setDataValue: setDataValue,
  8483. _getDataValue: getDataValue,
  8484. _realName: realName,
  8485. _isRealName: isRealName,
  8486. _isEqual: isEqual
  8487. }
  8488. };
  8489. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  8490. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-forms" }, [
  8491. vue.createElementVNode("form", null, [
  8492. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  8493. ])
  8494. ]);
  8495. }
  8496. const __easycom_3$2 = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$q], ["__scopeId", "data-v-9a1e3c32"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-forms/components/uni-forms/uni-forms.vue"]]);
  8497. const popup = {
  8498. data() {
  8499. return {};
  8500. },
  8501. created() {
  8502. this.popup = this.getParent();
  8503. },
  8504. methods: {
  8505. /**
  8506. * 获取父元素实例
  8507. */
  8508. getParent(name = "uniPopup") {
  8509. let parent = this.$parent;
  8510. let parentName = parent.$options.name;
  8511. while (parentName !== name) {
  8512. parent = parent.$parent;
  8513. if (!parent)
  8514. return false;
  8515. parentName = parent.$options.name;
  8516. }
  8517. return parent;
  8518. }
  8519. }
  8520. };
  8521. const _sfc_main$q = {
  8522. name: "uniPopupMessage",
  8523. mixins: [popup],
  8524. props: {
  8525. /**
  8526. * 主题 success/warning/info/error 默认 success
  8527. */
  8528. type: {
  8529. type: String,
  8530. default: "success"
  8531. },
  8532. /**
  8533. * 消息文字
  8534. */
  8535. message: {
  8536. type: String,
  8537. default: ""
  8538. },
  8539. /**
  8540. * 显示时间,设置为 0 则不会自动关闭
  8541. */
  8542. duration: {
  8543. type: Number,
  8544. default: 3e3
  8545. },
  8546. maskShow: {
  8547. type: Boolean,
  8548. default: false
  8549. }
  8550. },
  8551. data() {
  8552. return {};
  8553. },
  8554. created() {
  8555. this.popup.maskShow = this.maskShow;
  8556. this.popup.messageChild = this;
  8557. },
  8558. methods: {
  8559. timerClose() {
  8560. if (this.duration === 0)
  8561. return;
  8562. clearTimeout(this.timer);
  8563. this.timer = setTimeout(() => {
  8564. this.popup.close();
  8565. }, this.duration);
  8566. }
  8567. }
  8568. };
  8569. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  8570. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-popup-message" }, [
  8571. vue.createElementVNode(
  8572. "view",
  8573. {
  8574. class: vue.normalizeClass(["uni-popup-message__box fixforpc-width", "uni-popup__" + $props.type])
  8575. },
  8576. [
  8577. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  8578. vue.createElementVNode(
  8579. "text",
  8580. {
  8581. class: vue.normalizeClass(["uni-popup-message-text", "uni-popup__" + $props.type + "-text"])
  8582. },
  8583. vue.toDisplayString($props.message),
  8584. 3
  8585. /* TEXT, CLASS */
  8586. )
  8587. ], true)
  8588. ],
  8589. 2
  8590. /* CLASS */
  8591. )
  8592. ]);
  8593. }
  8594. const __easycom_5 = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$p], ["__scopeId", "data-v-a4566996"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue"]]);
  8595. class MPAnimation {
  8596. constructor(options, _this) {
  8597. this.options = options;
  8598. this.animation = uni.createAnimation({
  8599. ...options
  8600. });
  8601. this.currentStepAnimates = {};
  8602. this.next = 0;
  8603. this.$ = _this;
  8604. }
  8605. _nvuePushAnimates(type, args) {
  8606. let aniObj = this.currentStepAnimates[this.next];
  8607. let styles = {};
  8608. if (!aniObj) {
  8609. styles = {
  8610. styles: {},
  8611. config: {}
  8612. };
  8613. } else {
  8614. styles = aniObj;
  8615. }
  8616. if (animateTypes1.includes(type)) {
  8617. if (!styles.styles.transform) {
  8618. styles.styles.transform = "";
  8619. }
  8620. let unit = "";
  8621. if (type === "rotate") {
  8622. unit = "deg";
  8623. }
  8624. styles.styles.transform += `${type}(${args + unit}) `;
  8625. } else {
  8626. styles.styles[type] = `${args}`;
  8627. }
  8628. this.currentStepAnimates[this.next] = styles;
  8629. }
  8630. _animateRun(styles = {}, config = {}) {
  8631. let ref = this.$.$refs["ani"].ref;
  8632. if (!ref)
  8633. return;
  8634. return new Promise((resolve, reject) => {
  8635. nvueAnimation.transition(ref, {
  8636. styles,
  8637. ...config
  8638. }, (res) => {
  8639. resolve();
  8640. });
  8641. });
  8642. }
  8643. _nvueNextAnimate(animates, step = 0, fn) {
  8644. let obj = animates[step];
  8645. if (obj) {
  8646. let {
  8647. styles,
  8648. config
  8649. } = obj;
  8650. this._animateRun(styles, config).then(() => {
  8651. step += 1;
  8652. this._nvueNextAnimate(animates, step, fn);
  8653. });
  8654. } else {
  8655. this.currentStepAnimates = {};
  8656. typeof fn === "function" && fn();
  8657. this.isEnd = true;
  8658. }
  8659. }
  8660. step(config = {}) {
  8661. this.animation.step(config);
  8662. return this;
  8663. }
  8664. run(fn) {
  8665. this.$.animationData = this.animation.export();
  8666. this.$.timer = setTimeout(() => {
  8667. typeof fn === "function" && fn();
  8668. }, this.$.durationTime);
  8669. }
  8670. }
  8671. const animateTypes1 = [
  8672. "matrix",
  8673. "matrix3d",
  8674. "rotate",
  8675. "rotate3d",
  8676. "rotateX",
  8677. "rotateY",
  8678. "rotateZ",
  8679. "scale",
  8680. "scale3d",
  8681. "scaleX",
  8682. "scaleY",
  8683. "scaleZ",
  8684. "skew",
  8685. "skewX",
  8686. "skewY",
  8687. "translate",
  8688. "translate3d",
  8689. "translateX",
  8690. "translateY",
  8691. "translateZ"
  8692. ];
  8693. const animateTypes2 = ["opacity", "backgroundColor"];
  8694. const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
  8695. animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
  8696. MPAnimation.prototype[type] = function(...args) {
  8697. this.animation[type](...args);
  8698. return this;
  8699. };
  8700. });
  8701. function createAnimation(option, _this) {
  8702. if (!_this)
  8703. return;
  8704. clearTimeout(_this.timer);
  8705. return new MPAnimation(option, _this);
  8706. }
  8707. const _sfc_main$p = {
  8708. name: "uniTransition",
  8709. emits: ["click", "change"],
  8710. props: {
  8711. show: {
  8712. type: Boolean,
  8713. default: false
  8714. },
  8715. modeClass: {
  8716. type: [Array, String],
  8717. default() {
  8718. return "fade";
  8719. }
  8720. },
  8721. duration: {
  8722. type: Number,
  8723. default: 300
  8724. },
  8725. styles: {
  8726. type: Object,
  8727. default() {
  8728. return {};
  8729. }
  8730. },
  8731. customClass: {
  8732. type: String,
  8733. default: ""
  8734. },
  8735. onceRender: {
  8736. type: Boolean,
  8737. default: false
  8738. }
  8739. },
  8740. data() {
  8741. return {
  8742. isShow: false,
  8743. transform: "",
  8744. opacity: 1,
  8745. animationData: {},
  8746. durationTime: 300,
  8747. config: {}
  8748. };
  8749. },
  8750. watch: {
  8751. show: {
  8752. handler(newVal) {
  8753. if (newVal) {
  8754. this.open();
  8755. } else {
  8756. if (this.isShow) {
  8757. this.close();
  8758. }
  8759. }
  8760. },
  8761. immediate: true
  8762. }
  8763. },
  8764. computed: {
  8765. // 生成样式数据
  8766. stylesObject() {
  8767. let styles = {
  8768. ...this.styles,
  8769. "transition-duration": this.duration / 1e3 + "s"
  8770. };
  8771. let transform = "";
  8772. for (let i2 in styles) {
  8773. let line = this.toLine(i2);
  8774. transform += line + ":" + styles[i2] + ";";
  8775. }
  8776. return transform;
  8777. },
  8778. // 初始化动画条件
  8779. transformStyles() {
  8780. return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
  8781. }
  8782. },
  8783. created() {
  8784. this.config = {
  8785. duration: this.duration,
  8786. timingFunction: "ease",
  8787. transformOrigin: "50% 50%",
  8788. delay: 0
  8789. };
  8790. this.durationTime = this.duration;
  8791. },
  8792. methods: {
  8793. /**
  8794. * ref 触发 初始化动画
  8795. */
  8796. init(obj = {}) {
  8797. if (obj.duration) {
  8798. this.durationTime = obj.duration;
  8799. }
  8800. this.animation = createAnimation(Object.assign(this.config, obj), this);
  8801. },
  8802. /**
  8803. * 点击组件触发回调
  8804. */
  8805. onClick() {
  8806. this.$emit("click", {
  8807. detail: this.isShow
  8808. });
  8809. },
  8810. /**
  8811. * ref 触发 动画分组
  8812. * @param {Object} obj
  8813. */
  8814. step(obj, config = {}) {
  8815. if (!this.animation)
  8816. return;
  8817. for (let i2 in obj) {
  8818. try {
  8819. if (typeof obj[i2] === "object") {
  8820. this.animation[i2](...obj[i2]);
  8821. } else {
  8822. this.animation[i2](obj[i2]);
  8823. }
  8824. } catch (e2) {
  8825. formatAppLog("error", "at uni_modules/uni-transition/components/uni-transition/uni-transition.vue:148", `方法 ${i2} 不存在`);
  8826. }
  8827. }
  8828. this.animation.step(config);
  8829. return this;
  8830. },
  8831. /**
  8832. * ref 触发 执行动画
  8833. */
  8834. run(fn) {
  8835. if (!this.animation)
  8836. return;
  8837. this.animation.run(fn);
  8838. },
  8839. // 开始过度动画
  8840. open() {
  8841. clearTimeout(this.timer);
  8842. this.transform = "";
  8843. this.isShow = true;
  8844. let { opacity, transform } = this.styleInit(false);
  8845. if (typeof opacity !== "undefined") {
  8846. this.opacity = opacity;
  8847. }
  8848. this.transform = transform;
  8849. this.$nextTick(() => {
  8850. this.timer = setTimeout(() => {
  8851. this.animation = createAnimation(this.config, this);
  8852. this.tranfromInit(false).step();
  8853. this.animation.run();
  8854. this.$emit("change", {
  8855. detail: this.isShow
  8856. });
  8857. }, 20);
  8858. });
  8859. },
  8860. // 关闭过度动画
  8861. close(type) {
  8862. if (!this.animation)
  8863. return;
  8864. this.tranfromInit(true).step().run(() => {
  8865. this.isShow = false;
  8866. this.animationData = null;
  8867. this.animation = null;
  8868. let { opacity, transform } = this.styleInit(false);
  8869. this.opacity = opacity || 1;
  8870. this.transform = transform;
  8871. this.$emit("change", {
  8872. detail: this.isShow
  8873. });
  8874. });
  8875. },
  8876. // 处理动画开始前的默认样式
  8877. styleInit(type) {
  8878. let styles = {
  8879. transform: ""
  8880. };
  8881. let buildStyle = (type2, mode) => {
  8882. if (mode === "fade") {
  8883. styles.opacity = this.animationType(type2)[mode];
  8884. } else {
  8885. styles.transform += this.animationType(type2)[mode] + " ";
  8886. }
  8887. };
  8888. if (typeof this.modeClass === "string") {
  8889. buildStyle(type, this.modeClass);
  8890. } else {
  8891. this.modeClass.forEach((mode) => {
  8892. buildStyle(type, mode);
  8893. });
  8894. }
  8895. return styles;
  8896. },
  8897. // 处理内置组合动画
  8898. tranfromInit(type) {
  8899. let buildTranfrom = (type2, mode) => {
  8900. let aniNum = null;
  8901. if (mode === "fade") {
  8902. aniNum = type2 ? 0 : 1;
  8903. } else {
  8904. aniNum = type2 ? "-100%" : "0";
  8905. if (mode === "zoom-in") {
  8906. aniNum = type2 ? 0.8 : 1;
  8907. }
  8908. if (mode === "zoom-out") {
  8909. aniNum = type2 ? 1.2 : 1;
  8910. }
  8911. if (mode === "slide-right") {
  8912. aniNum = type2 ? "100%" : "0";
  8913. }
  8914. if (mode === "slide-bottom") {
  8915. aniNum = type2 ? "100%" : "0";
  8916. }
  8917. }
  8918. this.animation[this.animationMode()[mode]](aniNum);
  8919. };
  8920. if (typeof this.modeClass === "string") {
  8921. buildTranfrom(type, this.modeClass);
  8922. } else {
  8923. this.modeClass.forEach((mode) => {
  8924. buildTranfrom(type, mode);
  8925. });
  8926. }
  8927. return this.animation;
  8928. },
  8929. animationType(type) {
  8930. return {
  8931. fade: type ? 1 : 0,
  8932. "slide-top": `translateY(${type ? "0" : "-100%"})`,
  8933. "slide-right": `translateX(${type ? "0" : "100%"})`,
  8934. "slide-bottom": `translateY(${type ? "0" : "100%"})`,
  8935. "slide-left": `translateX(${type ? "0" : "-100%"})`,
  8936. "zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
  8937. "zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
  8938. };
  8939. },
  8940. // 内置动画类型与实际动画对应字典
  8941. animationMode() {
  8942. return {
  8943. fade: "opacity",
  8944. "slide-top": "translateY",
  8945. "slide-right": "translateX",
  8946. "slide-bottom": "translateY",
  8947. "slide-left": "translateX",
  8948. "zoom-in": "scale",
  8949. "zoom-out": "scale"
  8950. };
  8951. },
  8952. // 驼峰转中横线
  8953. toLine(name) {
  8954. return name.replace(/([A-Z])/g, "-$1").toLowerCase();
  8955. }
  8956. }
  8957. };
  8958. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  8959. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
  8960. ref: "ani",
  8961. animation: $data.animationData,
  8962. class: vue.normalizeClass($props.customClass),
  8963. style: vue.normalizeStyle($options.transformStyles),
  8964. onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
  8965. }, [
  8966. vue.renderSlot(_ctx.$slots, "default")
  8967. ], 14, ["animation"])), [
  8968. [vue.vShow, $data.isShow]
  8969. ]);
  8970. }
  8971. const __easycom_0$3 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$o], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]);
  8972. const _sfc_main$o = {
  8973. name: "uniPopup",
  8974. components: {},
  8975. emits: ["change", "maskClick"],
  8976. props: {
  8977. // 开启动画
  8978. animation: {
  8979. type: Boolean,
  8980. default: true
  8981. },
  8982. // 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
  8983. // message: 消息提示 ; dialog : 对话框
  8984. type: {
  8985. type: String,
  8986. default: "center"
  8987. },
  8988. // maskClick
  8989. isMaskClick: {
  8990. type: Boolean,
  8991. default: null
  8992. },
  8993. // TODO 2 个版本后废弃属性 ,使用 isMaskClick
  8994. maskClick: {
  8995. type: Boolean,
  8996. default: null
  8997. },
  8998. backgroundColor: {
  8999. type: String,
  9000. default: "none"
  9001. },
  9002. safeArea: {
  9003. type: Boolean,
  9004. default: true
  9005. },
  9006. maskBackgroundColor: {
  9007. type: String,
  9008. default: "rgba(0, 0, 0, 0.4)"
  9009. }
  9010. },
  9011. watch: {
  9012. /**
  9013. * 监听type类型
  9014. */
  9015. type: {
  9016. handler: function(type) {
  9017. if (!this.config[type])
  9018. return;
  9019. this[this.config[type]](true);
  9020. },
  9021. immediate: true
  9022. },
  9023. isDesktop: {
  9024. handler: function(newVal) {
  9025. if (!this.config[newVal])
  9026. return;
  9027. this[this.config[this.type]](true);
  9028. },
  9029. immediate: true
  9030. },
  9031. /**
  9032. * 监听遮罩是否可点击
  9033. * @param {Object} val
  9034. */
  9035. maskClick: {
  9036. handler: function(val) {
  9037. this.mkclick = val;
  9038. },
  9039. immediate: true
  9040. },
  9041. isMaskClick: {
  9042. handler: function(val) {
  9043. this.mkclick = val;
  9044. },
  9045. immediate: true
  9046. },
  9047. // H5 下禁止底部滚动
  9048. showPopup(show) {
  9049. }
  9050. },
  9051. data() {
  9052. return {
  9053. duration: 300,
  9054. ani: [],
  9055. showPopup: false,
  9056. showTrans: false,
  9057. popupWidth: 0,
  9058. popupHeight: 0,
  9059. config: {
  9060. top: "top",
  9061. bottom: "bottom",
  9062. center: "center",
  9063. left: "left",
  9064. right: "right",
  9065. message: "top",
  9066. dialog: "center",
  9067. share: "bottom"
  9068. },
  9069. maskClass: {
  9070. position: "fixed",
  9071. bottom: 0,
  9072. top: 0,
  9073. left: 0,
  9074. right: 0,
  9075. backgroundColor: "rgba(0, 0, 0, 0.4)"
  9076. },
  9077. transClass: {
  9078. position: "fixed",
  9079. left: 0,
  9080. right: 0
  9081. },
  9082. maskShow: true,
  9083. mkclick: true,
  9084. popupstyle: "top"
  9085. };
  9086. },
  9087. computed: {
  9088. isDesktop() {
  9089. return this.popupWidth >= 500 && this.popupHeight >= 500;
  9090. },
  9091. bg() {
  9092. if (this.backgroundColor === "" || this.backgroundColor === "none") {
  9093. return "transparent";
  9094. }
  9095. return this.backgroundColor;
  9096. }
  9097. },
  9098. mounted() {
  9099. const fixSize = () => {
  9100. const {
  9101. windowWidth,
  9102. windowHeight,
  9103. windowTop,
  9104. safeArea,
  9105. screenHeight,
  9106. safeAreaInsets
  9107. } = uni.getSystemInfoSync();
  9108. this.popupWidth = windowWidth;
  9109. this.popupHeight = windowHeight + (windowTop || 0);
  9110. if (safeArea && this.safeArea) {
  9111. this.safeAreaInsets = safeAreaInsets.bottom;
  9112. } else {
  9113. this.safeAreaInsets = 0;
  9114. }
  9115. };
  9116. fixSize();
  9117. },
  9118. // TODO vue3
  9119. unmounted() {
  9120. this.setH5Visible();
  9121. },
  9122. created() {
  9123. if (this.isMaskClick === null && this.maskClick === null) {
  9124. this.mkclick = true;
  9125. } else {
  9126. this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
  9127. }
  9128. if (this.animation) {
  9129. this.duration = 300;
  9130. } else {
  9131. this.duration = 0;
  9132. }
  9133. this.messageChild = null;
  9134. this.clearPropagation = false;
  9135. this.maskClass.backgroundColor = this.maskBackgroundColor;
  9136. },
  9137. methods: {
  9138. setH5Visible() {
  9139. },
  9140. /**
  9141. * 公用方法,不显示遮罩层
  9142. */
  9143. closeMask() {
  9144. this.maskShow = false;
  9145. },
  9146. /**
  9147. * 公用方法,遮罩层禁止点击
  9148. */
  9149. disableMask() {
  9150. this.mkclick = false;
  9151. },
  9152. // TODO nvue 取消冒泡
  9153. clear(e2) {
  9154. e2.stopPropagation();
  9155. this.clearPropagation = true;
  9156. },
  9157. open(direction) {
  9158. if (this.showPopup) {
  9159. return;
  9160. }
  9161. let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
  9162. if (!(direction && innerType.indexOf(direction) !== -1)) {
  9163. direction = this.type;
  9164. }
  9165. if (!this.config[direction]) {
  9166. formatAppLog("error", "at uni_modules/uni-popup/components/uni-popup/uni-popup.vue:279", "缺少类型:", direction);
  9167. return;
  9168. }
  9169. this[this.config[direction]]();
  9170. this.$emit("change", {
  9171. show: true,
  9172. type: direction
  9173. });
  9174. },
  9175. close(type) {
  9176. this.showTrans = false;
  9177. this.$emit("change", {
  9178. show: false,
  9179. type: this.type
  9180. });
  9181. clearTimeout(this.timer);
  9182. this.timer = setTimeout(() => {
  9183. this.showPopup = false;
  9184. }, 300);
  9185. },
  9186. // TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
  9187. touchstart() {
  9188. this.clearPropagation = false;
  9189. },
  9190. onTap() {
  9191. if (this.clearPropagation) {
  9192. this.clearPropagation = false;
  9193. return;
  9194. }
  9195. this.$emit("maskClick");
  9196. if (!this.mkclick)
  9197. return;
  9198. this.close();
  9199. },
  9200. /**
  9201. * 顶部弹出样式处理
  9202. */
  9203. top(type) {
  9204. this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
  9205. this.ani = ["slide-top"];
  9206. this.transClass = {
  9207. position: "fixed",
  9208. left: 0,
  9209. right: 0,
  9210. backgroundColor: this.bg
  9211. };
  9212. if (type)
  9213. return;
  9214. this.showPopup = true;
  9215. this.showTrans = true;
  9216. this.$nextTick(() => {
  9217. if (this.messageChild && this.type === "message") {
  9218. this.messageChild.timerClose();
  9219. }
  9220. });
  9221. },
  9222. /**
  9223. * 底部弹出样式处理
  9224. */
  9225. bottom(type) {
  9226. this.popupstyle = "bottom";
  9227. this.ani = ["slide-bottom"];
  9228. this.transClass = {
  9229. position: "fixed",
  9230. left: 0,
  9231. right: 0,
  9232. bottom: 0,
  9233. paddingBottom: this.safeAreaInsets + "px",
  9234. backgroundColor: this.bg
  9235. };
  9236. if (type)
  9237. return;
  9238. this.showPopup = true;
  9239. this.showTrans = true;
  9240. },
  9241. /**
  9242. * 中间弹出样式处理
  9243. */
  9244. center(type) {
  9245. this.popupstyle = "center";
  9246. this.ani = ["zoom-out", "fade"];
  9247. this.transClass = {
  9248. position: "fixed",
  9249. display: "flex",
  9250. flexDirection: "column",
  9251. bottom: 0,
  9252. left: 0,
  9253. right: 0,
  9254. top: 0,
  9255. justifyContent: "center",
  9256. alignItems: "center"
  9257. };
  9258. if (type)
  9259. return;
  9260. this.showPopup = true;
  9261. this.showTrans = true;
  9262. },
  9263. left(type) {
  9264. this.popupstyle = "left";
  9265. this.ani = ["slide-left"];
  9266. this.transClass = {
  9267. position: "fixed",
  9268. left: 0,
  9269. bottom: 0,
  9270. top: 0,
  9271. backgroundColor: this.bg,
  9272. display: "flex",
  9273. flexDirection: "column"
  9274. };
  9275. if (type)
  9276. return;
  9277. this.showPopup = true;
  9278. this.showTrans = true;
  9279. },
  9280. right(type) {
  9281. this.popupstyle = "right";
  9282. this.ani = ["slide-right"];
  9283. this.transClass = {
  9284. position: "fixed",
  9285. bottom: 0,
  9286. right: 0,
  9287. top: 0,
  9288. backgroundColor: this.bg,
  9289. display: "flex",
  9290. flexDirection: "column"
  9291. };
  9292. if (type)
  9293. return;
  9294. this.showPopup = true;
  9295. this.showTrans = true;
  9296. }
  9297. }
  9298. };
  9299. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  9300. const _component_uni_transition = resolveEasycom(vue.resolveDynamicComponent("uni-transition"), __easycom_0$3);
  9301. return $data.showPopup ? (vue.openBlock(), vue.createElementBlock(
  9302. "view",
  9303. {
  9304. key: 0,
  9305. class: vue.normalizeClass(["uni-popup", [$data.popupstyle, $options.isDesktop ? "fixforpc-z-index" : ""]])
  9306. },
  9307. [
  9308. vue.createElementVNode(
  9309. "view",
  9310. {
  9311. onTouchstart: _cache[1] || (_cache[1] = (...args) => $options.touchstart && $options.touchstart(...args))
  9312. },
  9313. [
  9314. $data.maskShow ? (vue.openBlock(), vue.createBlock(_component_uni_transition, {
  9315. key: "1",
  9316. name: "mask",
  9317. "mode-class": "fade",
  9318. styles: $data.maskClass,
  9319. duration: $data.duration,
  9320. show: $data.showTrans,
  9321. onClick: $options.onTap
  9322. }, null, 8, ["styles", "duration", "show", "onClick"])) : vue.createCommentVNode("v-if", true),
  9323. vue.createVNode(_component_uni_transition, {
  9324. key: "2",
  9325. "mode-class": $data.ani,
  9326. name: "content",
  9327. styles: $data.transClass,
  9328. duration: $data.duration,
  9329. show: $data.showTrans,
  9330. onClick: $options.onTap
  9331. }, {
  9332. default: vue.withCtx(() => [
  9333. vue.createElementVNode(
  9334. "view",
  9335. {
  9336. class: vue.normalizeClass(["uni-popup__wrapper", [$data.popupstyle]]),
  9337. style: vue.normalizeStyle({ backgroundColor: $options.bg }),
  9338. onClick: _cache[0] || (_cache[0] = (...args) => $options.clear && $options.clear(...args))
  9339. },
  9340. [
  9341. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  9342. ],
  9343. 6
  9344. /* CLASS, STYLE */
  9345. )
  9346. ]),
  9347. _: 3
  9348. /* FORWARDED */
  9349. }, 8, ["mode-class", "styles", "duration", "show", "onClick"])
  9350. ],
  9351. 32
  9352. /* NEED_HYDRATION */
  9353. )
  9354. ],
  9355. 2
  9356. /* CLASS */
  9357. )) : vue.createCommentVNode("v-if", true);
  9358. }
  9359. const __easycom_6 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$n], ["__scopeId", "data-v-4dd3c44b"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]);
  9360. const en = {
  9361. "uni-popup.cancel": "cancel",
  9362. "uni-popup.ok": "ok",
  9363. "uni-popup.placeholder": "pleace enter",
  9364. "uni-popup.title": "Hint",
  9365. "uni-popup.shareTitle": "Share to"
  9366. };
  9367. const zhHans = {
  9368. "uni-popup.cancel": "取消",
  9369. "uni-popup.ok": "确定",
  9370. "uni-popup.placeholder": "请输入",
  9371. "uni-popup.title": "提示",
  9372. "uni-popup.shareTitle": "分享到"
  9373. };
  9374. const zhHant = {
  9375. "uni-popup.cancel": "取消",
  9376. "uni-popup.ok": "確定",
  9377. "uni-popup.placeholder": "請輸入",
  9378. "uni-popup.title": "提示",
  9379. "uni-popup.shareTitle": "分享到"
  9380. };
  9381. const messages = {
  9382. en,
  9383. "zh-Hans": zhHans,
  9384. "zh-Hant": zhHant
  9385. };
  9386. const { t } = initVueI18n(messages);
  9387. const _sfc_main$n = {
  9388. name: "uniPopupDialog",
  9389. mixins: [popup],
  9390. emits: ["confirm", "close"],
  9391. props: {
  9392. inputType: {
  9393. type: String,
  9394. default: "text"
  9395. },
  9396. value: {
  9397. type: [String, Number],
  9398. default: ""
  9399. },
  9400. placeholder: {
  9401. type: [String, Number],
  9402. default: ""
  9403. },
  9404. type: {
  9405. type: String,
  9406. default: "error"
  9407. },
  9408. mode: {
  9409. type: String,
  9410. default: "base"
  9411. },
  9412. title: {
  9413. type: String,
  9414. default: ""
  9415. },
  9416. content: {
  9417. type: String,
  9418. default: ""
  9419. },
  9420. beforeClose: {
  9421. type: Boolean,
  9422. default: false
  9423. },
  9424. cancelText: {
  9425. type: String,
  9426. default: ""
  9427. },
  9428. confirmText: {
  9429. type: String,
  9430. default: ""
  9431. }
  9432. },
  9433. data() {
  9434. return {
  9435. dialogType: "error",
  9436. focus: false,
  9437. val: ""
  9438. };
  9439. },
  9440. computed: {
  9441. okText() {
  9442. return this.confirmText || t("uni-popup.ok");
  9443. },
  9444. closeText() {
  9445. return this.cancelText || t("uni-popup.cancel");
  9446. },
  9447. placeholderText() {
  9448. return this.placeholder || t("uni-popup.placeholder");
  9449. },
  9450. titleText() {
  9451. return this.title || t("uni-popup.title");
  9452. }
  9453. },
  9454. watch: {
  9455. type(val) {
  9456. this.dialogType = val;
  9457. },
  9458. mode(val) {
  9459. if (val === "input") {
  9460. this.dialogType = "info";
  9461. }
  9462. },
  9463. value(val) {
  9464. this.val = val;
  9465. }
  9466. },
  9467. created() {
  9468. this.popup.disableMask();
  9469. if (this.mode === "input") {
  9470. this.dialogType = "info";
  9471. this.val = this.value;
  9472. } else {
  9473. this.dialogType = this.type;
  9474. }
  9475. },
  9476. mounted() {
  9477. this.focus = true;
  9478. },
  9479. methods: {
  9480. /**
  9481. * 点击确认按钮
  9482. */
  9483. onOk() {
  9484. if (this.mode === "input") {
  9485. this.$emit("confirm", this.val);
  9486. } else {
  9487. this.$emit("confirm");
  9488. }
  9489. if (this.beforeClose)
  9490. return;
  9491. this.popup.close();
  9492. },
  9493. /**
  9494. * 点击取消按钮
  9495. */
  9496. closeDialog() {
  9497. this.$emit("close");
  9498. if (this.beforeClose)
  9499. return;
  9500. this.popup.close();
  9501. },
  9502. close() {
  9503. this.popup.close();
  9504. }
  9505. }
  9506. };
  9507. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  9508. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-popup-dialog" }, [
  9509. vue.createElementVNode("view", { class: "uni-dialog-title" }, [
  9510. vue.createElementVNode(
  9511. "text",
  9512. {
  9513. class: vue.normalizeClass(["uni-dialog-title-text", ["uni-popup__" + $data.dialogType]])
  9514. },
  9515. vue.toDisplayString($options.titleText),
  9516. 3
  9517. /* TEXT, CLASS */
  9518. )
  9519. ]),
  9520. $props.mode === "base" ? (vue.openBlock(), vue.createElementBlock("view", {
  9521. key: 0,
  9522. class: "uni-dialog-content"
  9523. }, [
  9524. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  9525. vue.createElementVNode(
  9526. "text",
  9527. { class: "uni-dialog-content-text" },
  9528. vue.toDisplayString($props.content),
  9529. 1
  9530. /* TEXT */
  9531. )
  9532. ], true)
  9533. ])) : (vue.openBlock(), vue.createElementBlock("view", {
  9534. key: 1,
  9535. class: "uni-dialog-content"
  9536. }, [
  9537. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  9538. vue.withDirectives(vue.createElementVNode("input", {
  9539. class: "uni-dialog-input",
  9540. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.val = $event),
  9541. type: $props.inputType,
  9542. placeholder: $options.placeholderText,
  9543. focus: $data.focus
  9544. }, null, 8, ["type", "placeholder", "focus"]), [
  9545. [vue.vModelDynamic, $data.val]
  9546. ])
  9547. ], true)
  9548. ])),
  9549. vue.createElementVNode("view", { class: "uni-dialog-button-group" }, [
  9550. vue.createElementVNode("view", {
  9551. class: "uni-dialog-button",
  9552. onClick: _cache[1] || (_cache[1] = (...args) => $options.closeDialog && $options.closeDialog(...args))
  9553. }, [
  9554. vue.createElementVNode(
  9555. "text",
  9556. { class: "uni-dialog-button-text" },
  9557. vue.toDisplayString($options.closeText),
  9558. 1
  9559. /* TEXT */
  9560. )
  9561. ]),
  9562. vue.createElementVNode("view", {
  9563. class: "uni-dialog-button uni-border-left",
  9564. onClick: _cache[2] || (_cache[2] = (...args) => $options.onOk && $options.onOk(...args))
  9565. }, [
  9566. vue.createElementVNode(
  9567. "text",
  9568. { class: "uni-dialog-button-text uni-button-color" },
  9569. vue.toDisplayString($options.okText),
  9570. 1
  9571. /* TEXT */
  9572. )
  9573. ])
  9574. ])
  9575. ]);
  9576. }
  9577. const __easycom_0$2 = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$m], ["__scopeId", "data-v-d78c88b7"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue"]]);
  9578. var isIOS;
  9579. function album() {
  9580. var result = 0;
  9581. var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
  9582. var authStatus = PHPhotoLibrary.authorizationStatus();
  9583. if (authStatus === 0) {
  9584. result = null;
  9585. } else if (authStatus == 3) {
  9586. result = 1;
  9587. } else {
  9588. result = 0;
  9589. }
  9590. plus.ios.deleteObject(PHPhotoLibrary);
  9591. return result;
  9592. }
  9593. function camera() {
  9594. var result = 0;
  9595. var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
  9596. var authStatus = AVCaptureDevice.authorizationStatusForMediaType("vide");
  9597. if (authStatus === 0) {
  9598. result = null;
  9599. } else if (authStatus == 3) {
  9600. result = 1;
  9601. } else {
  9602. result = 0;
  9603. }
  9604. plus.ios.deleteObject(AVCaptureDevice);
  9605. return result;
  9606. }
  9607. function location$1() {
  9608. var result = 0;
  9609. var cllocationManger = plus.ios.import("CLLocationManager");
  9610. var enable = cllocationManger.locationServicesEnabled();
  9611. var status = cllocationManger.authorizationStatus();
  9612. if (!enable) {
  9613. result = 2;
  9614. } else if (status === 0) {
  9615. result = null;
  9616. } else if (status === 3 || status === 4) {
  9617. result = 1;
  9618. } else {
  9619. result = 0;
  9620. }
  9621. plus.ios.deleteObject(cllocationManger);
  9622. return result;
  9623. }
  9624. function push() {
  9625. var result = 0;
  9626. var UIApplication = plus.ios.import("UIApplication");
  9627. var app = UIApplication.sharedApplication();
  9628. var enabledTypes = 0;
  9629. if (app.currentUserNotificationSettings) {
  9630. var settings = app.currentUserNotificationSettings();
  9631. enabledTypes = settings.plusGetAttribute("types");
  9632. if (enabledTypes == 0) {
  9633. result = 0;
  9634. formatAppLog("log", "at common/permission.js:63", "推送权限没有开启");
  9635. } else {
  9636. result = 1;
  9637. formatAppLog("log", "at common/permission.js:66", "已经开启推送功能!");
  9638. }
  9639. plus.ios.deleteObject(settings);
  9640. } else {
  9641. enabledTypes = app.enabledRemoteNotificationTypes();
  9642. if (enabledTypes == 0) {
  9643. result = 3;
  9644. formatAppLog("log", "at common/permission.js:73", "推送权限没有开启!");
  9645. } else {
  9646. result = 4;
  9647. formatAppLog("log", "at common/permission.js:76", "已经开启推送功能!");
  9648. }
  9649. }
  9650. plus.ios.deleteObject(app);
  9651. plus.ios.deleteObject(UIApplication);
  9652. return result;
  9653. }
  9654. function contact() {
  9655. var result = 0;
  9656. var CNContactStore = plus.ios.import("CNContactStore");
  9657. var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
  9658. if (cnAuthStatus === 0) {
  9659. result = null;
  9660. } else if (cnAuthStatus == 3) {
  9661. result = 1;
  9662. } else {
  9663. result = 0;
  9664. }
  9665. plus.ios.deleteObject(CNContactStore);
  9666. return result;
  9667. }
  9668. function record() {
  9669. var result = null;
  9670. var avaudiosession = plus.ios.import("AVAudioSession");
  9671. var avaudio = avaudiosession.sharedInstance();
  9672. var status = avaudio.recordPermission();
  9673. formatAppLog("log", "at common/permission.js:104", "permissionStatus:" + status);
  9674. if (status === 1970168948) {
  9675. result = null;
  9676. } else if (status === 1735552628) {
  9677. result = 1;
  9678. } else {
  9679. result = 0;
  9680. }
  9681. plus.ios.deleteObject(avaudiosession);
  9682. return result;
  9683. }
  9684. function calendar() {
  9685. var result = null;
  9686. var EKEventStore = plus.ios.import("EKEventStore");
  9687. var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
  9688. if (ekAuthStatus == 3) {
  9689. result = 1;
  9690. formatAppLog("log", "at common/permission.js:122", "日历权限已经开启");
  9691. } else {
  9692. formatAppLog("log", "at common/permission.js:124", "日历权限没有开启");
  9693. }
  9694. plus.ios.deleteObject(EKEventStore);
  9695. return result;
  9696. }
  9697. function memo() {
  9698. var result = null;
  9699. var EKEventStore = plus.ios.import("EKEventStore");
  9700. var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
  9701. if (ekAuthStatus == 3) {
  9702. result = 1;
  9703. formatAppLog("log", "at common/permission.js:136", "备忘录权限已经开启");
  9704. } else {
  9705. formatAppLog("log", "at common/permission.js:138", "备忘录权限没有开启");
  9706. }
  9707. plus.ios.deleteObject(EKEventStore);
  9708. return result;
  9709. }
  9710. function requestIOS(permissionID) {
  9711. return new Promise((resolve, reject) => {
  9712. switch (permissionID) {
  9713. case "push":
  9714. resolve(push());
  9715. break;
  9716. case "location":
  9717. resolve(location$1());
  9718. break;
  9719. case "record":
  9720. resolve(record());
  9721. break;
  9722. case "camera":
  9723. resolve(camera());
  9724. break;
  9725. case "album":
  9726. resolve(album());
  9727. break;
  9728. case "contact":
  9729. resolve(contact());
  9730. break;
  9731. case "calendar":
  9732. resolve(calendar());
  9733. break;
  9734. case "memo":
  9735. resolve(memo());
  9736. break;
  9737. default:
  9738. resolve(0);
  9739. break;
  9740. }
  9741. });
  9742. }
  9743. function requestAndroid(permissionID) {
  9744. return new Promise((resolve, reject) => {
  9745. plus.android.requestPermissions(
  9746. [permissionID],
  9747. function(resultObj) {
  9748. var result = 0;
  9749. for (var i2 = 0; i2 < resultObj.granted.length; i2++) {
  9750. var grantedPermission = resultObj.granted[i2];
  9751. formatAppLog("log", "at common/permission.js:187", "已获取的权限:" + grantedPermission);
  9752. result = 1;
  9753. }
  9754. for (var i2 = 0; i2 < resultObj.deniedPresent.length; i2++) {
  9755. var deniedPresentPermission = resultObj.deniedPresent[i2];
  9756. formatAppLog("log", "at common/permission.js:192", "拒绝本次申请的权限:" + deniedPresentPermission);
  9757. result = 0;
  9758. }
  9759. for (var i2 = 0; i2 < resultObj.deniedAlways.length; i2++) {
  9760. var deniedAlwaysPermission = resultObj.deniedAlways[i2];
  9761. formatAppLog("log", "at common/permission.js:197", "永久拒绝申请的权限:" + deniedAlwaysPermission);
  9762. result = -1;
  9763. }
  9764. resolve(result);
  9765. },
  9766. function(error) {
  9767. formatAppLog("log", "at common/permission.js:203", "result error: " + error.message);
  9768. resolve({
  9769. code: error.code,
  9770. message: error.message
  9771. });
  9772. }
  9773. );
  9774. });
  9775. }
  9776. function gotoAppPermissionSetting() {
  9777. if (permission.isIOS) {
  9778. var UIApplication = plus.ios.import("UIApplication");
  9779. var application2 = UIApplication.sharedApplication();
  9780. var NSURL2 = plus.ios.import("NSURL");
  9781. var setting2 = NSURL2.URLWithString("app-settings:");
  9782. application2.openURL(setting2);
  9783. plus.ios.deleteObject(setting2);
  9784. plus.ios.deleteObject(NSURL2);
  9785. plus.ios.deleteObject(application2);
  9786. } else {
  9787. var Intent = plus.android.importClass("android.content.Intent");
  9788. var Settings = plus.android.importClass("android.provider.Settings");
  9789. var Uri = plus.android.importClass("android.net.Uri");
  9790. var mainActivity = plus.android.runtimeMainActivity();
  9791. var intent = new Intent();
  9792. intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
  9793. var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
  9794. intent.setData(uri);
  9795. mainActivity.startActivity(intent);
  9796. }
  9797. }
  9798. const permission = {
  9799. get isIOS() {
  9800. return typeof isIOS === "boolean" ? isIOS : isIOS = uni.getSystemInfoSync().platform === "ios";
  9801. },
  9802. requestIOS,
  9803. requestAndroid,
  9804. gotoAppSetting: gotoAppPermissionSetting
  9805. };
  9806. const baseURL = "http://dsg.tms.api.aibasil.cn";
  9807. const warehouseScanURL = baseURL + "/admin/order.sheetOrder/warehouseScan";
  9808. const instockScanURL = baseURL + "/admin/order.scanOrder/instock";
  9809. const outStockScanURL = baseURL + "/admin/order.scanOrder/outStock";
  9810. const checkWaybillGoodsURL = baseURL + "/admin/order.scanOrder/checkWaybillGoods";
  9811. const getWarehouseSpaceURL = baseURL + "/admin/order.ScanOrder/getWarehouseSpace";
  9812. const weighScanURL = baseURL + "/admin/order.scanOrder/weigh";
  9813. const getBindParamsURL = baseURL + "/admin/order.scanOrder/getBindParams";
  9814. const getPrinterListURL = baseURL + "/admin/printer//getPrinterList";
  9815. const bindShippingURL = baseURL + "/admin/order.scanOrder/bindShipping";
  9816. const getWaybillsURL = baseURL + "/admin/order.scanOrder/getWaybills";
  9817. const printWaybillLabelURL = baseURL + "/admin/order.ScanOrder/printWaybillLabel";
  9818. const printCustomerLabelURL = baseURL + "/admin/order.ScanOrder/printCustomerLabel";
  9819. const loginURL = baseURL + "/admin/index/login";
  9820. const getcaptchaURL = baseURL + "/api/common/captcha";
  9821. const pickupWaybillDeliveryOrderURL = baseURL + "/admin/pickup.waybillDeliveryOrder";
  9822. const addWaybillNoURL = baseURL + "/admin/warehouse.waybillNo/add";
  9823. const waybillNoOptions = baseURL + "/admin/warehouse.waybillNo/getOptions";
  9824. const sendOutURL = baseURL + "/admin/pickup.waybillDeliveryOrder/sendOut";
  9825. const deliveredURL = baseURL + "/admin/pickup.waybillDeliveryOrder/delivered";
  9826. const refuseURL = baseURL + "/admin/pickup.waybillDeliveryOrder/refuse";
  9827. const createTrackPodURL = baseURL + "/admin/pickup.waybillDeliveryOrder/createTrackPod";
  9828. const cancelFedExPickUpURL = baseURL + "/admin/pickup.waybillDeliveryOrder/cancelFedExPickUp";
  9829. const _sfc_main$m = {
  9830. data() {
  9831. const token = vue.ref(null);
  9832. const user = vue.ref(null);
  9833. const loading = vue.ref(false);
  9834. return {
  9835. token,
  9836. user,
  9837. messageType: "",
  9838. messageText: "",
  9839. batchOptions: [],
  9840. spaces: [],
  9841. printerList: {},
  9842. instockHistory: [],
  9843. printers: [],
  9844. downloadFile: [],
  9845. sendToPeinter: [1],
  9846. selectPrinter: 0,
  9847. subLoading: false,
  9848. focusType: true,
  9849. loading,
  9850. // 校验表单数据
  9851. valiFormData: {
  9852. images: [],
  9853. orderNum: "",
  9854. batch_number: "",
  9855. space_code: "",
  9856. weight: "",
  9857. search_pkg: true,
  9858. typing: true,
  9859. search_order: true,
  9860. search_order_choice: 1
  9861. },
  9862. searchOrderChoice: [
  9863. {
  9864. text: "更新为已入库,状态为【已入库】",
  9865. value: 1
  9866. },
  9867. {
  9868. text: "更新为已出库,状态为【已出库】",
  9869. value: 2
  9870. },
  9871. {
  9872. text: "称重计费",
  9873. value: 3
  9874. }
  9875. ]
  9876. };
  9877. },
  9878. computed: {
  9879. rules: function() {
  9880. return {
  9881. orderNum: {
  9882. rules: [{
  9883. required: this.valiFormData.search_order_choice !== 2,
  9884. errorMessage: "单号不能为空"
  9885. }]
  9886. },
  9887. weight: {
  9888. rules: [
  9889. {
  9890. required: true,
  9891. errorMessage: "重量不能为空"
  9892. },
  9893. {
  9894. format: "number",
  9895. errorMessage: "重量只能输入数字"
  9896. }
  9897. ]
  9898. }
  9899. };
  9900. },
  9901. spaceRes: function() {
  9902. try {
  9903. const res = this.spaces.find((item) => item.value === this.valiFormData.space_code);
  9904. return res == null ? void 0 : res.text;
  9905. } catch (e2) {
  9906. formatAppLog("log", "at pages/instock/index.vue:234", e2);
  9907. return "";
  9908. }
  9909. }
  9910. },
  9911. onShow() {
  9912. this.focusType = true;
  9913. this.loading = false;
  9914. this.token = uni.getStorageSync("token");
  9915. this.user = uni.getStorageSync("user");
  9916. this.getWarehouseSpace();
  9917. this.getBindParams();
  9918. this.getPrinterList();
  9919. },
  9920. onHide() {
  9921. this.focusType = false;
  9922. this.loading = false;
  9923. },
  9924. onReady() {
  9925. },
  9926. onNavigationBarButtonTap(event) {
  9927. if (event.index === 0) {
  9928. uni.navigateTo({
  9929. url: "/pages/instock/instockLog"
  9930. });
  9931. }
  9932. },
  9933. methods: {
  9934. getWarehouseSpace() {
  9935. uni.request({
  9936. url: getWarehouseSpaceURL,
  9937. method: "POST",
  9938. header: {
  9939. batoken: this.token
  9940. },
  9941. data: {
  9942. code: ""
  9943. },
  9944. success: (res) => {
  9945. if (res.data.code === 1) {
  9946. this.spaces = res.data.data.spaces.map((item) => {
  9947. return {
  9948. text: item.name,
  9949. value: item.code
  9950. };
  9951. });
  9952. }
  9953. }
  9954. });
  9955. },
  9956. getBindParams() {
  9957. uni.request({
  9958. url: getBindParamsURL,
  9959. method: "GET",
  9960. header: {
  9961. batoken: this.token
  9962. },
  9963. success: (res) => {
  9964. if (res.data.code === 1) {
  9965. this.batchOptions = res.data.data.batch_number.map((item) => {
  9966. return {
  9967. text: item.name,
  9968. value: item.id
  9969. };
  9970. });
  9971. }
  9972. },
  9973. fail(e2) {
  9974. formatAppLog("log", "at pages/instock/index.vue:301", "fail--", e2);
  9975. }
  9976. });
  9977. },
  9978. getPrinterList() {
  9979. uni.request({
  9980. url: getPrinterListURL,
  9981. method: "GET",
  9982. header: {
  9983. batoken: this.token
  9984. },
  9985. success: (res) => {
  9986. if (res.data.code === 1) {
  9987. this.printerList = res.data.data.printers;
  9988. this.printers = Object.values(this.printerList).map((item) => {
  9989. return {
  9990. text: item.name,
  9991. value: item.value
  9992. };
  9993. });
  9994. }
  9995. },
  9996. fail(e2) {
  9997. formatAppLog("log", "at pages/instock/index.vue:324", "fail--", e2);
  9998. }
  9999. });
  10000. },
  10001. batchText(batch_number) {
  10002. var _a;
  10003. return (_a = this.batchOptions.find((item) => item.value === batch_number)) == null ? void 0 : _a.text;
  10004. },
  10005. searchPkgChange() {
  10006. this.valiFormData.search_pkg = !this.valiFormData.search_pkg;
  10007. this.valiFormData.typing = this.valiFormData.search_pkg;
  10008. },
  10009. searchOrderChoiceChange() {
  10010. this.valiFormData.search_order = !this.valiFormData.search_order;
  10011. this.valiFormData.search_order_choice = this.valiFormData.search_order ? 3 : "";
  10012. },
  10013. reset() {
  10014. this.loading = false;
  10015. this.focusType = false;
  10016. this.valiFormData = {
  10017. ...this.valiFormData,
  10018. orderNum: "",
  10019. // space_code: '',
  10020. batch_number: "",
  10021. weight: "",
  10022. search_pkg: true,
  10023. typing: true,
  10024. search_order: true
  10025. };
  10026. vue.nextTick(() => {
  10027. this.focusType = true;
  10028. });
  10029. },
  10030. async scan() {
  10031. let status = await this.checkPermission();
  10032. if (status !== 1) {
  10033. return;
  10034. }
  10035. uni.scanCode({
  10036. success: (res) => {
  10037. this.result = res.result;
  10038. this.valiFormData.orderNum = res.result;
  10039. },
  10040. fail: (err) => {
  10041. }
  10042. });
  10043. },
  10044. async checkPermission(code) {
  10045. let status = permission.isIOS ? await permission.requestIOS("camera") : await permission.requestAndroid(
  10046. "android.permission.CAMERA"
  10047. );
  10048. if (status === null || status === 1) {
  10049. status = 1;
  10050. } else {
  10051. uni.showModal({
  10052. content: "Camera permission required",
  10053. confirmText: "Setting",
  10054. success: function(res) {
  10055. if (res.confirm) {
  10056. permission.gotoAppSetting();
  10057. }
  10058. }
  10059. });
  10060. }
  10061. return status;
  10062. },
  10063. async warehouseScan() {
  10064. this.st && clearTimeout(this.st);
  10065. if (this.valiFormData.search_order_choice === 1) {
  10066. await this.checkWaybillGoods();
  10067. } else if (this.valiFormData.search_order_choice === 2) {
  10068. await this.scanOutstock();
  10069. } else if (this.valiFormData.search_order_choice === 3) {
  10070. await this.weighScan();
  10071. }
  10072. },
  10073. async checkWaybillGoods() {
  10074. this.loading = true;
  10075. uni.request({
  10076. url: checkWaybillGoodsURL,
  10077. method: "POST",
  10078. header: {
  10079. batoken: this.token
  10080. },
  10081. data: {
  10082. order_no: this.valiFormData.orderNum
  10083. },
  10084. success: (res) => {
  10085. if (res.data.code === 1 && res.data.data.is_goods_empty) {
  10086. this.$refs.alertDialog.open();
  10087. } else {
  10088. this.instockScan(0);
  10089. }
  10090. }
  10091. });
  10092. },
  10093. instockScan(is_save_goods) {
  10094. uni.request({
  10095. url: instockScanURL,
  10096. method: "POST",
  10097. header: {
  10098. batoken: this.token
  10099. },
  10100. data: {
  10101. order_no: this.valiFormData.orderNum,
  10102. weight: this.valiFormData.weight,
  10103. space_code: this.valiFormData.space_code,
  10104. is_save_goods
  10105. },
  10106. success: (res) => {
  10107. this.loading = false;
  10108. if (res.data.code == 1) {
  10109. this.messageType = "success";
  10110. this.messageText = res.data.msg;
  10111. this.$refs.message.open();
  10112. formatAppLog("log", "at pages/instock/index.vue:446", "res.data.data---", res.data.data);
  10113. const historyItem = {
  10114. orderNum: this.valiFormData.orderNum,
  10115. createTime: /* @__PURE__ */ new Date(),
  10116. space: this.spaceRes,
  10117. type: "入库",
  10118. status: true
  10119. };
  10120. this.instockHistory.unshift(historyItem);
  10121. uni.setStorageSync("instockHistory", this.instockHistory);
  10122. this.getHistory();
  10123. if (res.data.data.express_label) {
  10124. formatAppLog("log", "at pages/instock/index.vue:460", "有打印面单");
  10125. this.selectPrinter = this.sendToPeinter.length > 0 ? this.printers[0].value : 0;
  10126. this.$refs.printerDialog.open();
  10127. } else {
  10128. this.st = setTimeout(() => {
  10129. this.reset();
  10130. this.st && clearTimeout(this.st);
  10131. }, 1e3);
  10132. }
  10133. } else {
  10134. this.messageType = "error";
  10135. this.messageText = res.data.msg;
  10136. this.$refs.message.open();
  10137. const historyItem = {
  10138. orderNum: this.valiFormData.orderNum,
  10139. createTime: /* @__PURE__ */ new Date(),
  10140. space: this.spaceRes,
  10141. type: "入库",
  10142. status: false
  10143. };
  10144. this.instockHistory.unshift(historyItem);
  10145. uni.setStorageSync("instockHistory", this.instockHistory);
  10146. this.getHistory();
  10147. this.st = setTimeout(() => {
  10148. this.reset();
  10149. this.st && clearTimeout(this.st);
  10150. }, 1e3);
  10151. }
  10152. }
  10153. });
  10154. },
  10155. scanOutstock() {
  10156. formatAppLog("log", "at pages/instock/index.vue:493", this.valiFormData.orderNum, this.valiFormData.batch_number);
  10157. if (this.valiFormData.orderNum.length === 0 && this.valiFormData.batch_number.length === 0) {
  10158. this.messageType = "error";
  10159. this.messageText = "单号或批次号至少填一个";
  10160. this.$refs.message.open();
  10161. return;
  10162. }
  10163. this.loading = true;
  10164. uni.request({
  10165. url: outStockScanURL,
  10166. method: "POST",
  10167. header: {
  10168. batoken: this.token
  10169. },
  10170. data: {
  10171. order_no: this.valiFormData.orderNum,
  10172. batch_number: this.valiFormData.batch_number
  10173. },
  10174. success: (res) => {
  10175. this.loading = false;
  10176. if (res.data.code == 1) {
  10177. this.messageType = "success";
  10178. this.messageText = res.data.msg;
  10179. this.$refs.message.open();
  10180. const historyItem = {
  10181. orderNum: this.valiFormData.orderNum,
  10182. batch_text: this.batchText(this.valiFormData.batch_number),
  10183. createTime: /* @__PURE__ */ new Date(),
  10184. type: "出库",
  10185. status: true
  10186. };
  10187. this.instockHistory.unshift(historyItem);
  10188. this.instockHistory.length > 10 && (this.instockHistory.length = 10);
  10189. uni.setStorageSync("instockHistory", this.instockHistory);
  10190. this.getHistory();
  10191. if (res.data.data.labels && res.data.data.labels.length > 0) {
  10192. formatAppLog("log", "at pages/instock/index.vue:530", "有打印面单");
  10193. this.selectPrinter = this.sendToPeinter.length > 0 ? this.printers[0].value : 0;
  10194. this.$refs.printerDialog.open();
  10195. } else {
  10196. this.st = setTimeout(() => {
  10197. this.reset();
  10198. this.st && clearTimeout(this.st);
  10199. }, 700);
  10200. }
  10201. } else {
  10202. this.messageType = "error";
  10203. this.messageText = res.data.msg;
  10204. this.$refs.message.open();
  10205. const historyItem = {
  10206. orderNum: this.valiFormData.orderNum,
  10207. batch_text: this.batchText(this.valiFormData.batch_number),
  10208. createTime: /* @__PURE__ */ new Date(),
  10209. type: "出库",
  10210. status: false
  10211. };
  10212. this.instockHistory.unshift(historyItem);
  10213. this.instockHistory.length > 10 && (this.instockHistory.length = 10);
  10214. uni.setStorageSync("instockHistory", this.instockHistory);
  10215. this.getHistory();
  10216. this.st = setTimeout(() => {
  10217. this.reset();
  10218. this.st && clearTimeout(this.st);
  10219. }, 700);
  10220. }
  10221. }
  10222. });
  10223. },
  10224. weighScan() {
  10225. this.loading = true;
  10226. uni.request({
  10227. url: weighScanURL,
  10228. method: "POST",
  10229. header: {
  10230. batoken: this.token
  10231. },
  10232. data: {
  10233. order_no: this.valiFormData.orderNum,
  10234. weight: this.valiFormData.weight
  10235. },
  10236. success: (res) => {
  10237. this.loading = false;
  10238. if (res.data.code == 1) {
  10239. this.messageType = "success";
  10240. this.messageText = res.data.msg;
  10241. this.$refs.message.open();
  10242. const historyItem = {
  10243. orderNum: this.valiFormData.orderNum,
  10244. createTime: /* @__PURE__ */ new Date(),
  10245. type: "称重",
  10246. status: true
  10247. };
  10248. this.instockHistory.unshift(historyItem);
  10249. this.instockHistory.length > 10 && (this.instockHistory.length = 10);
  10250. uni.setStorageSync("instockHistory", this.instockHistory);
  10251. this.getHistory();
  10252. } else {
  10253. this.messageType = "error";
  10254. this.messageText = res.data.msg;
  10255. this.$refs.message.open();
  10256. const historyItem = {
  10257. orderNum: this.valiFormData.orderNum,
  10258. createTime: /* @__PURE__ */ new Date(),
  10259. type: "称重",
  10260. status: false
  10261. };
  10262. this.instockHistory.unshift(historyItem);
  10263. this.instockHistory.length > 10 && (this.instockHistory.length = 10);
  10264. uni.setStorageSync("instockHistory", this.instockHistory);
  10265. this.getHistory();
  10266. }
  10267. this.st = setTimeout(() => {
  10268. this.reset();
  10269. this.st && clearTimeout(this.st);
  10270. }, 700);
  10271. }
  10272. });
  10273. },
  10274. isNotGoods() {
  10275. this.instockScan(0);
  10276. },
  10277. close() {
  10278. this.$refs.printerDialog.close();
  10279. this.st = setTimeout(() => {
  10280. this.reset();
  10281. this.st && clearTimeout(this.st);
  10282. }, 700);
  10283. },
  10284. dialogConfirm() {
  10285. this.instockScan(1);
  10286. },
  10287. dialogClose() {
  10288. this.instockScan(0);
  10289. },
  10290. sendToPeinterFun(res) {
  10291. if (!res.detail.value.length > 0) {
  10292. this.selectPrinter = 0;
  10293. } else {
  10294. this.selectPrinter = this.printers[0].value;
  10295. }
  10296. },
  10297. printConfirm() {
  10298. this.subLoading = true;
  10299. uni.request({
  10300. url: printWaybillLabelURL,
  10301. method: "POST",
  10302. header: {
  10303. batoken: this.token
  10304. },
  10305. data: {
  10306. order_no: this.valiFormData.orderNum,
  10307. printer_code: this.selectPrinter
  10308. },
  10309. success: (res) => {
  10310. this.close();
  10311. this.subLoading = false;
  10312. formatAppLog("log", "at pages/instock/index.vue:651", "打印成功", res);
  10313. this.messageType = "success";
  10314. this.messageText = "打印成功";
  10315. this.$refs.message.open();
  10316. }
  10317. });
  10318. },
  10319. onsubmit() {
  10320. this.$refs.valiForm.validate().then((res) => {
  10321. this.warehouseScan();
  10322. }).catch((err) => {
  10323. formatAppLog("log", "at pages/instock/index.vue:665", "err", err);
  10324. });
  10325. },
  10326. getHistory() {
  10327. },
  10328. instockScan(is_save_goods) {
  10329. uni.request({
  10330. url: instockScanURL,
  10331. method: "GET",
  10332. header: {
  10333. batoken: this.token
  10334. },
  10335. success: (res) => {
  10336. }
  10337. });
  10338. },
  10339. // 获取上传状态
  10340. select(e2) {
  10341. formatAppLog("log", "at pages/instock/index.vue:686", "选择文件:", e2);
  10342. },
  10343. // 获取上传进度
  10344. progress(e2) {
  10345. formatAppLog("log", "at pages/instock/index.vue:690", "上传进度:", e2);
  10346. },
  10347. // 上传成功
  10348. success(e2) {
  10349. formatAppLog("log", "at pages/instock/index.vue:695", "上传成功");
  10350. },
  10351. // 上传失败
  10352. fail(e2) {
  10353. formatAppLog("log", "at pages/instock/index.vue:700", "上传失败:", e2);
  10354. }
  10355. }
  10356. };
  10357. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  10358. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  10359. const _component_uni_forms_item = resolveEasycom(vue.resolveDynamicComponent("uni-forms-item"), __easycom_2$1);
  10360. const _component_uni_data_select = resolveEasycom(vue.resolveDynamicComponent("uni-data-select"), __easycom_0$6);
  10361. const _component_uni_file_picker = resolveEasycom(vue.resolveDynamicComponent("uni-file-picker"), __easycom_3$3);
  10362. const _component_uni_data_checkbox = resolveEasycom(vue.resolveDynamicComponent("uni-data-checkbox"), __easycom_0$4);
  10363. const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_3$2);
  10364. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  10365. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_5);
  10366. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  10367. const _component_uni_popup_dialog = resolveEasycom(vue.resolveDynamicComponent("uni-popup-dialog"), __easycom_0$2);
  10368. return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [
  10369. vue.createElementVNode("view", { class: "example" }, [
  10370. vue.createCommentVNode(" 基础表单校验 "),
  10371. vue.createVNode(_component_uni_forms, {
  10372. ref: "valiForm",
  10373. "label-align": "right",
  10374. rules: $options.rules,
  10375. modelValue: $data.valiFormData
  10376. }, {
  10377. default: vue.withCtx(() => [
  10378. vue.createVNode(_component_uni_forms_item, {
  10379. label: "单号",
  10380. required: $data.valiFormData.search_order_choice !== 2,
  10381. name: "orderNum"
  10382. }, {
  10383. default: vue.withCtx(() => [
  10384. vue.createVNode(_component_uni_easyinput, {
  10385. modelValue: $data.valiFormData.orderNum,
  10386. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.valiFormData.orderNum = $event),
  10387. placeholder: "请输入单号",
  10388. suffixIcon: "scan",
  10389. focus: $data.focusType,
  10390. onIconClick: $options.scan
  10391. }, null, 8, ["modelValue", "focus", "onIconClick"])
  10392. ]),
  10393. _: 1
  10394. /* STABLE */
  10395. }, 8, ["required"]),
  10396. $data.valiFormData.search_order_choice === 2 ? (vue.openBlock(), vue.createBlock(_component_uni_forms_item, {
  10397. key: 0,
  10398. label: "批次号",
  10399. name: "batch_number"
  10400. }, {
  10401. default: vue.withCtx(() => [
  10402. vue.createVNode(_component_uni_data_select, {
  10403. modelValue: $data.valiFormData.batch_number,
  10404. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.valiFormData.batch_number = $event),
  10405. localdata: $data.batchOptions,
  10406. placeholder: "请选择批次号"
  10407. }, null, 8, ["modelValue", "localdata"])
  10408. ]),
  10409. _: 1
  10410. /* STABLE */
  10411. })) : vue.createCommentVNode("v-if", true),
  10412. $data.valiFormData.search_order_choice === 1 ? (vue.openBlock(), vue.createBlock(_component_uni_forms_item, {
  10413. key: 1,
  10414. label: "仓位编码",
  10415. name: "space_code"
  10416. }, {
  10417. default: vue.withCtx(() => [
  10418. vue.createVNode(_component_uni_data_select, {
  10419. modelValue: $data.valiFormData.space_code,
  10420. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.valiFormData.space_code = $event),
  10421. localdata: $data.spaces,
  10422. placeholder: "请选择仓位编码"
  10423. }, null, 8, ["modelValue", "localdata"])
  10424. ]),
  10425. _: 1
  10426. /* STABLE */
  10427. })) : vue.createCommentVNode("v-if", true),
  10428. $data.valiFormData.search_order_choice !== 2 ? (vue.openBlock(), vue.createBlock(_component_uni_forms_item, {
  10429. key: 2,
  10430. label: "重量",
  10431. required: "",
  10432. name: "weight"
  10433. }, {
  10434. default: vue.withCtx(() => [
  10435. vue.createVNode(_component_uni_easyinput, {
  10436. modelValue: $data.valiFormData.weight,
  10437. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.valiFormData.weight = $event),
  10438. placeholder: "请输入重量",
  10439. oninput: "value=value.replace(/[^\\d.]/g,'').replace(/^\\./g, '').replace(/\\.{2,}/g, '').replace('.', '$#$').replace(/\\./g, '').replace('$#$', '.').match(/^\\d*(\\.?\\d{0,2})/g)[0] || null"
  10440. }, {
  10441. right: vue.withCtx(() => [
  10442. vue.createElementVNode("view", { class: "weight-right" }, "KG")
  10443. ]),
  10444. _: 1
  10445. /* STABLE */
  10446. }, 8, ["modelValue"])
  10447. ]),
  10448. _: 1
  10449. /* STABLE */
  10450. })) : vue.createCommentVNode("v-if", true),
  10451. $data.valiFormData.search_order_choice === 1 ? (vue.openBlock(), vue.createBlock(_component_uni_forms_item, {
  10452. key: 3,
  10453. label: "图片",
  10454. name: "images"
  10455. }, {
  10456. default: vue.withCtx(() => [
  10457. vue.createCommentVNode(' <uni-data-select v-model="valiFormData.images" :localdata="spaces" placeholder="请选择仓位编码"></uni-data-select> '),
  10458. vue.createVNode(_component_uni_file_picker, {
  10459. limit: "6",
  10460. title: "最多选择6张图片",
  10461. onSelect: $options.select,
  10462. onProgress: $options.progress,
  10463. onSuccess: $options.success,
  10464. onFail: $options.fail
  10465. }, null, 8, ["onSelect", "onProgress", "onSuccess", "onFail"])
  10466. ]),
  10467. _: 1
  10468. /* STABLE */
  10469. })) : vue.createCommentVNode("v-if", true),
  10470. vue.createVNode(_component_uni_forms_item, null, {
  10471. default: vue.withCtx(() => [
  10472. vue.createElementVNode(
  10473. "view",
  10474. {
  10475. onClick: _cache[5] || (_cache[5] = (...args) => $options.searchPkgChange && $options.searchPkgChange(...args)),
  10476. class: "checkbox-cum",
  10477. style: vue.normalizeStyle({ color: $data.valiFormData.search_pkg ? "#007AFF" : "gray" })
  10478. },
  10479. [
  10480. vue.createElementVNode("checkbox", {
  10481. checked: $data.valiFormData.search_pkg,
  10482. onClick: _cache[4] || (_cache[4] = (...args) => $options.searchPkgChange && $options.searchPkgChange(...args))
  10483. }, null, 8, ["checked"]),
  10484. vue.createTextVNode(" 搜索寄存包裹 ")
  10485. ],
  10486. 4
  10487. /* STYLE */
  10488. ),
  10489. vue.createElementVNode("view", { class: "sub-choice" }, [
  10490. vue.createElementVNode("checkbox", {
  10491. disabled: !$data.valiFormData.search_pkg,
  10492. checked: $data.valiFormData.typing
  10493. }, null, 8, ["disabled", "checked"]),
  10494. vue.createElementVNode(
  10495. "text",
  10496. {
  10497. onClick: _cache[6] || (_cache[6] = () => {
  10498. if ($data.valiFormData.search_pkg) {
  10499. $data.valiFormData.typing = !$data.valiFormData.typing;
  10500. }
  10501. }),
  10502. style: vue.normalizeStyle({ color: $data.valiFormData.search_pkg && $data.valiFormData.typing ? "#007AFF" : "gray" })
  10503. },
  10504. " 包裹寄存、代购、运单都找不到时手工添加包裹 ",
  10505. 4
  10506. /* STYLE */
  10507. )
  10508. ]),
  10509. vue.createElementVNode(
  10510. "view",
  10511. {
  10512. onClick: _cache[8] || (_cache[8] = (...args) => $options.searchOrderChoiceChange && $options.searchOrderChoiceChange(...args)),
  10513. class: "checkbox-cum",
  10514. style: vue.normalizeStyle({ color: $data.valiFormData.search_order ? "#007AFF" : "gray" })
  10515. },
  10516. [
  10517. vue.createElementVNode("checkbox", {
  10518. checked: $data.valiFormData.search_order,
  10519. onClick: _cache[7] || (_cache[7] = (...args) => $options.searchOrderChoiceChange && $options.searchOrderChoiceChange(...args))
  10520. }, null, 8, ["checked"]),
  10521. vue.createTextVNode(" 搜索运单 ")
  10522. ],
  10523. 4
  10524. /* STYLE */
  10525. ),
  10526. vue.createElementVNode("view", null, [
  10527. vue.createVNode(_component_uni_data_checkbox, {
  10528. disabled: !$data.valiFormData.search_order,
  10529. modelValue: $data.valiFormData.search_order_choice,
  10530. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.valiFormData.search_order_choice = $event),
  10531. localdata: $data.searchOrderChoice
  10532. }, null, 8, ["disabled", "modelValue", "localdata"])
  10533. ])
  10534. ]),
  10535. _: 1
  10536. /* STABLE */
  10537. })
  10538. ]),
  10539. _: 1
  10540. /* STABLE */
  10541. }, 8, ["rules", "modelValue"]),
  10542. vue.createElementVNode("view", { class: "button-group" }, [
  10543. vue.createElementVNode("button", {
  10544. type: "info",
  10545. onClick: _cache[10] || (_cache[10] = (...args) => $options.reset && $options.reset(...args))
  10546. }, "重置"),
  10547. vue.createElementVNode("button", {
  10548. type: "primary",
  10549. onClick: _cache[11] || (_cache[11] = (...args) => $options.onsubmit && $options.onsubmit(...args)),
  10550. loading: $data.loading
  10551. }, [
  10552. !$data.loading ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  10553. key: 0,
  10554. type: "checkmarkempty",
  10555. size: "18",
  10556. color: "white"
  10557. })) : vue.createCommentVNode("v-if", true),
  10558. vue.createTextVNode(" 提交 ")
  10559. ], 8, ["loading"])
  10560. ])
  10561. ]),
  10562. vue.createElementVNode("view", { class: "history" }, [
  10563. (vue.openBlock(true), vue.createElementBlock(
  10564. vue.Fragment,
  10565. null,
  10566. vue.renderList($data.instockHistory.slice(0, 5), (item, i2) => {
  10567. return vue.openBlock(), vue.createElementBlock("view", {
  10568. class: "item",
  10569. key: i2
  10570. }, [
  10571. vue.createElementVNode(
  10572. "text",
  10573. {
  10574. class: "code",
  10575. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  10576. },
  10577. [
  10578. vue.createTextVNode(
  10579. vue.toDisplayString(item.orderNum) + " ",
  10580. 1
  10581. /* TEXT */
  10582. ),
  10583. item.batch_text ? (vue.openBlock(), vue.createElementBlock(
  10584. "text",
  10585. { key: 0 },
  10586. "批次号: " + vue.toDisplayString(item.batch_text),
  10587. 1
  10588. /* TEXT */
  10589. )) : vue.createCommentVNode("v-if", true),
  10590. item.space ? (vue.openBlock(), vue.createElementBlock(
  10591. "text",
  10592. { key: 1 },
  10593. "仓位编码: " + vue.toDisplayString(item.space),
  10594. 1
  10595. /* TEXT */
  10596. )) : vue.createCommentVNode("v-if", true),
  10597. vue.createTextVNode(
  10598. " " + vue.toDisplayString(item.type),
  10599. 1
  10600. /* TEXT */
  10601. )
  10602. ],
  10603. 4
  10604. /* STYLE */
  10605. ),
  10606. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  10607. key: 0,
  10608. type: "checkmarkempty",
  10609. class: "status",
  10610. size: "16",
  10611. color: "green"
  10612. })) : (vue.openBlock(), vue.createElementBlock("text", {
  10613. key: 1,
  10614. class: "status fail"
  10615. }, "F")),
  10616. vue.createElementVNode(
  10617. "text",
  10618. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  10619. vue.toDisplayString("\r\n" + item.createTime),
  10620. 1
  10621. /* TEXT */
  10622. )
  10623. ]);
  10624. }),
  10625. 128
  10626. /* KEYED_FRAGMENT */
  10627. ))
  10628. ]),
  10629. vue.createVNode(
  10630. _component_uni_popup,
  10631. {
  10632. ref: "message",
  10633. type: "message"
  10634. },
  10635. {
  10636. default: vue.withCtx(() => [
  10637. vue.createVNode(_component_uni_popup_message, {
  10638. type: $data.messageType,
  10639. message: $data.messageText,
  10640. duration: 2e3
  10641. }, null, 8, ["type", "message"])
  10642. ]),
  10643. _: 1
  10644. /* STABLE */
  10645. },
  10646. 512
  10647. /* NEED_PATCH */
  10648. ),
  10649. vue.createVNode(
  10650. _component_uni_popup,
  10651. {
  10652. ref: "alertDialog",
  10653. type: "dialog"
  10654. },
  10655. {
  10656. default: vue.withCtx(() => [
  10657. vue.createVNode(_component_uni_popup_dialog, {
  10658. type: "info",
  10659. cancelText: "否",
  10660. confirmText: "是",
  10661. title: "提示",
  10662. content: "是否按默认申报(默认申报为:衣服,10件,单价1)",
  10663. onConfirm: $options.dialogConfirm,
  10664. onClose: $options.dialogClose
  10665. }, null, 8, ["onConfirm", "onClose"])
  10666. ]),
  10667. _: 1
  10668. /* STABLE */
  10669. },
  10670. 512
  10671. /* NEED_PATCH */
  10672. ),
  10673. vue.createVNode(
  10674. _component_uni_popup,
  10675. {
  10676. ref: "printerDialog",
  10677. type: "dialog",
  10678. "is-mask-click": false
  10679. },
  10680. {
  10681. default: vue.withCtx(() => [
  10682. vue.createElementVNode("view", { style: { "width": "90%", "margin": "0 auto", "min-height": "250px", "background-color": "#fff", "border-radius": "5px" } }, [
  10683. vue.createElementVNode("view", {
  10684. class: "",
  10685. style: { "font-size": "20px", "border-bottom": "1px solid #e1e1e1", "padding": "15px 10px" }
  10686. }, [
  10687. vue.createElementVNode("view", null, [
  10688. vue.createElementVNode("view", { style: { "margin-bottom": "20px" } }, [
  10689. vue.createElementVNode("text", null, "打印尾程面单")
  10690. ]),
  10691. vue.createElementVNode("view", null, [
  10692. $data.printerList ? (vue.openBlock(), vue.createElementBlock("view", { key: 0 }, [
  10693. vue.createElementVNode("view", null, [
  10694. vue.createVNode(_component_uni_data_checkbox, {
  10695. multiple: "",
  10696. modelValue: $data.sendToPeinter,
  10697. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.sendToPeinter = $event),
  10698. localdata: [
  10699. {
  10700. text: "发送到标签打印机打印",
  10701. value: 1
  10702. }
  10703. ],
  10704. onChange: $options.sendToPeinterFun
  10705. }, {
  10706. default: vue.withCtx(() => [
  10707. vue.createTextVNode(" > ")
  10708. ]),
  10709. _: 1
  10710. /* STABLE */
  10711. }, 8, ["modelValue", "onChange"]),
  10712. vue.createVNode(_component_uni_data_checkbox, {
  10713. disabled: $data.sendToPeinter.length === 0,
  10714. modelValue: $data.selectPrinter,
  10715. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => $data.selectPrinter = $event),
  10716. localdata: $data.printers
  10717. }, null, 8, ["disabled", "modelValue", "localdata"])
  10718. ])
  10719. ])) : vue.createCommentVNode("v-if", true)
  10720. ])
  10721. ]),
  10722. vue.createElementVNode("view", { style: { "text-align": "center", "position": "absolute", "bottom": "10px", "width": "90%", "display": "flex", "margin": "0 auto", "left": "0", "right": "0" } }, [
  10723. vue.createElementVNode("button", {
  10724. onClick: _cache[14] || (_cache[14] = (...args) => $options.close && $options.close(...args)),
  10725. style: { "width": "35%" }
  10726. }, "关闭"),
  10727. vue.createElementVNode("button", {
  10728. onClick: _cache[15] || (_cache[15] = (...args) => $options.printConfirm && $options.printConfirm(...args)),
  10729. "hover-stay-time": 500,
  10730. loading: $data.subLoading,
  10731. disabled: $data.sendToPeinter.length === 0 || $data.subLoading,
  10732. class: "my-bt-bg",
  10733. style: { "width": "35%" }
  10734. }, " 打印 ", 8, ["loading", "disabled"])
  10735. ])
  10736. ])
  10737. ])
  10738. ]),
  10739. _: 1
  10740. /* STABLE */
  10741. },
  10742. 512
  10743. /* NEED_PATCH */
  10744. )
  10745. ]);
  10746. }
  10747. const PagesInstockIndex = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$l], ["__file", "E:/HBuilderProjects/YTAPP/pages/instock/index.vue"]]);
  10748. const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
  10749. __name: "instockLog",
  10750. setup(__props, { expose: __expose }) {
  10751. __expose();
  10752. const instockHistory = vue.ref([]);
  10753. const getHistory = () => {
  10754. instockHistory.value = uni.getStorageSync("instockHistory");
  10755. };
  10756. onLoad(() => {
  10757. getHistory();
  10758. });
  10759. const __returned__ = { instockHistory, getHistory };
  10760. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  10761. return __returned__;
  10762. }
  10763. });
  10764. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  10765. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  10766. return vue.openBlock(), vue.createElementBlock("view", { class: "history" }, [
  10767. (vue.openBlock(true), vue.createElementBlock(
  10768. vue.Fragment,
  10769. null,
  10770. vue.renderList($setup.instockHistory, (item, i2) => {
  10771. return vue.openBlock(), vue.createElementBlock("view", { class: "item" }, [
  10772. vue.createElementVNode(
  10773. "text",
  10774. {
  10775. class: "code",
  10776. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  10777. },
  10778. [
  10779. vue.createTextVNode(
  10780. vue.toDisplayString(item.orderNum) + " ",
  10781. 1
  10782. /* TEXT */
  10783. ),
  10784. item.batch_text ? (vue.openBlock(), vue.createElementBlock(
  10785. "text",
  10786. { key: 0 },
  10787. "批次号: " + vue.toDisplayString(item.batch_text),
  10788. 1
  10789. /* TEXT */
  10790. )) : vue.createCommentVNode("v-if", true),
  10791. item.space ? (vue.openBlock(), vue.createElementBlock(
  10792. "text",
  10793. { key: 1 },
  10794. "仓位编码: " + vue.toDisplayString(item.space),
  10795. 1
  10796. /* TEXT */
  10797. )) : vue.createCommentVNode("v-if", true),
  10798. vue.createTextVNode(
  10799. " " + vue.toDisplayString(item.type),
  10800. 1
  10801. /* TEXT */
  10802. )
  10803. ],
  10804. 4
  10805. /* STYLE */
  10806. ),
  10807. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  10808. key: 0,
  10809. type: "checkmarkempty",
  10810. class: "status",
  10811. size: "16",
  10812. color: "green"
  10813. })) : (vue.openBlock(), vue.createElementBlock("text", {
  10814. key: 1,
  10815. class: "status fail"
  10816. }, "F")),
  10817. vue.createElementVNode(
  10818. "text",
  10819. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  10820. vue.toDisplayString("\r\n" + item.createTime),
  10821. 1
  10822. /* TEXT */
  10823. )
  10824. ]);
  10825. }),
  10826. 256
  10827. /* UNKEYED_FRAGMENT */
  10828. )),
  10829. $setup.instockHistory.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  10830. key: 0,
  10831. class: "is-empty"
  10832. }, "暂无历史")) : vue.createCommentVNode("v-if", true)
  10833. ]);
  10834. }
  10835. const PagesInstockInstockLog = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$k], ["__scopeId", "data-v-02f20d50"], ["__file", "E:/HBuilderProjects/YTAPP/pages/instock/instockLog.vue"]]);
  10836. const _imports_0$2 = "/static/user.png";
  10837. const _sfc_main$k = {
  10838. data() {
  10839. const token = vue.ref(null);
  10840. const user = vue.ref(null);
  10841. return {
  10842. token,
  10843. user
  10844. };
  10845. },
  10846. onLoad() {
  10847. },
  10848. onShow() {
  10849. this.token = uni.getStorageSync("token");
  10850. this.user = uni.getStorageSync("user");
  10851. },
  10852. methods: {
  10853. avatarClick() {
  10854. if (this.token)
  10855. ;
  10856. else {
  10857. uni.navigateTo({
  10858. url: "/pages/login/index"
  10859. });
  10860. }
  10861. },
  10862. logout() {
  10863. uni.removeStorageSync("token");
  10864. uni.removeStorageSync("user");
  10865. this.token = uni.getStorageSync("token");
  10866. this.user = uni.getStorageSync("user");
  10867. },
  10868. dialogToggle() {
  10869. this.$refs.alertDialog.open();
  10870. }
  10871. }
  10872. };
  10873. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  10874. const _component_uni_popup_dialog = resolveEasycom(vue.resolveDynamicComponent("uni-popup-dialog"), __easycom_0$2);
  10875. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  10876. return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, [
  10877. vue.createElementVNode("view", {
  10878. class: "user-v",
  10879. onClick: _cache[0] || (_cache[0] = (...args) => $options.avatarClick && $options.avatarClick(...args))
  10880. }, [
  10881. !$data.user.avatar ? (vue.openBlock(), vue.createElementBlock("image", {
  10882. key: 0,
  10883. class: "user-icon",
  10884. src: _imports_0$2
  10885. })) : (vue.openBlock(), vue.createElementBlock("image", {
  10886. key: 1,
  10887. class: "user-icon",
  10888. src: $data.user.avatar
  10889. }, null, 8, ["src"]))
  10890. ]),
  10891. vue.createElementVNode("view", { class: "text-area" }, [
  10892. vue.createElementVNode(
  10893. "text",
  10894. { class: "title" },
  10895. vue.toDisplayString($data.user.username),
  10896. 1
  10897. /* TEXT */
  10898. )
  10899. ]),
  10900. vue.createElementVNode("view", { class: "login-btn" }, [
  10901. !$data.token ? (vue.openBlock(), vue.createElementBlock("button", {
  10902. key: 0,
  10903. type: "primary",
  10904. plain: "true",
  10905. size: "mini",
  10906. onClick: _cache[1] || (_cache[1] = (...args) => $options.avatarClick && $options.avatarClick(...args))
  10907. }, "登录")) : (vue.openBlock(), vue.createElementBlock("button", {
  10908. key: 1,
  10909. type: "default",
  10910. plain: "true",
  10911. size: "mini",
  10912. onClick: _cache[2] || (_cache[2] = (...args) => $options.dialogToggle && $options.dialogToggle(...args))
  10913. }, "注销"))
  10914. ]),
  10915. vue.createVNode(
  10916. _component_uni_popup,
  10917. {
  10918. ref: "alertDialog",
  10919. type: "dialog"
  10920. },
  10921. {
  10922. default: vue.withCtx(() => [
  10923. vue.createVNode(_component_uni_popup_dialog, {
  10924. type: "info",
  10925. cancelText: "取消",
  10926. confirmText: "注销",
  10927. title: "注销",
  10928. content: "确定是要注销吗?",
  10929. onConfirm: $options.logout
  10930. }, null, 8, ["onConfirm"])
  10931. ]),
  10932. _: 1
  10933. /* STABLE */
  10934. },
  10935. 512
  10936. /* NEED_PATCH */
  10937. )
  10938. ]);
  10939. }
  10940. const PagesProfileIndex = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$j], ["__file", "E:/HBuilderProjects/YTAPP/pages/profile/index.vue"]]);
  10941. const _imports_0$1 = "/static/logo.png";
  10942. const _sfc_main$j = {
  10943. data() {
  10944. return {
  10945. messageText: "",
  10946. captcha_id: "f2dd39ce-0d3e-4c1e-916c-b50090a7590s",
  10947. verifyCodeImg: "",
  10948. //验证码图片
  10949. verifyCodeToken: "",
  10950. //图形验证码的验证token
  10951. isVerifyCodeTure: false,
  10952. //验证码输入是否正确
  10953. valiFormData: {
  10954. account: "",
  10955. password: "",
  10956. captcha: ""
  10957. },
  10958. rules: {
  10959. name: {
  10960. rules: [{
  10961. required: true,
  10962. errorMessage: "姓名不能为空"
  10963. }]
  10964. }
  10965. }
  10966. };
  10967. },
  10968. onLoad() {
  10969. this.getVerifyCodeImg();
  10970. },
  10971. methods: {
  10972. getVerifyCodeImg() {
  10973. uni.request({
  10974. url: `${getcaptchaURL}?server=1&id=${this.captcha_id}&m=` + Math.random(),
  10975. method: "GET",
  10976. responseType: "arraybuffer",
  10977. //设置响应类型
  10978. success: (res) => {
  10979. const arrayBuffer = new Uint8Array(res.data);
  10980. const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(
  10981. arrayBuffer
  10982. );
  10983. this.verifyCodeImg = base64;
  10984. this.verifyCodeToken = res.header["Set-Cookie"];
  10985. }
  10986. });
  10987. },
  10988. formSubmit() {
  10989. uni.request({
  10990. //api地址
  10991. url: loginURL,
  10992. data: {
  10993. "username": this.valiFormData.account,
  10994. "password": this.valiFormData.password,
  10995. "captcha": this.valiFormData.captcha,
  10996. "keep": false,
  10997. "loading": true,
  10998. "captcha_id": this.captcha_id
  10999. },
  11000. //请求类型
  11001. method: "POST",
  11002. success: (res) => {
  11003. formatAppLog("log", "at pages/login/index.vue:100", res);
  11004. if (res.data.code == 1) {
  11005. const userInfo = res.data.data.userInfo;
  11006. uni.setStorage({
  11007. key: "token",
  11008. data: userInfo.token,
  11009. success() {
  11010. uni.setStorage({
  11011. key: "user",
  11012. data: userInfo,
  11013. success() {
  11014. uni.navigateBack();
  11015. }
  11016. });
  11017. }
  11018. });
  11019. } else {
  11020. formatAppLog("log", "at pages/login/index.vue:120", res);
  11021. this.messageText = res.data.msg;
  11022. this.$refs.message.open();
  11023. }
  11024. }
  11025. });
  11026. }
  11027. }
  11028. };
  11029. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  11030. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  11031. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  11032. const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_3$2);
  11033. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_5);
  11034. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  11035. return vue.openBlock(), vue.createElementBlock("view", { class: "contaier" }, [
  11036. vue.createElementVNode("view", { class: "top-bg" }, [
  11037. vue.createElementVNode("image", {
  11038. class: "logo-icon",
  11039. src: _imports_0$1
  11040. })
  11041. ]),
  11042. vue.createElementVNode("view", { class: "input-box padding-lr" }, [
  11043. vue.createVNode(_component_uni_forms, {
  11044. ref: "valiForm",
  11045. rules: $data.rules,
  11046. modelValue: $data.valiFormData
  11047. }, {
  11048. default: vue.withCtx(() => [
  11049. vue.createElementVNode("view", { class: "cu-form-group margin-top" }, [
  11050. vue.createVNode(_component_uni_icons, {
  11051. class: "uni-icon",
  11052. type: "person",
  11053. size: "30",
  11054. color: "#999"
  11055. }),
  11056. vue.createVNode(_component_uni_easyinput, {
  11057. placeholder: "账号",
  11058. modelValue: $data.valiFormData.account,
  11059. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.valiFormData.account = $event)
  11060. }, null, 8, ["modelValue"])
  11061. ]),
  11062. vue.createElementVNode("view", { class: "cu-form-group" }, [
  11063. vue.createVNode(_component_uni_icons, {
  11064. class: "uni-icon",
  11065. type: "locked",
  11066. size: "30",
  11067. color: "#999"
  11068. }),
  11069. vue.createVNode(_component_uni_easyinput, {
  11070. placeholder: "密码",
  11071. type: "password",
  11072. modelValue: $data.valiFormData.password,
  11073. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.valiFormData.password = $event)
  11074. }, null, 8, ["modelValue"])
  11075. ]),
  11076. vue.createElementVNode("view", { class: "cu-form-group solid-bottom" }, [
  11077. vue.createVNode(_component_uni_icons, {
  11078. class: "uni-icon",
  11079. type: "more-filled",
  11080. size: "30",
  11081. color: "#999"
  11082. }),
  11083. vue.createVNode(_component_uni_easyinput, {
  11084. placeholder: "验证码",
  11085. modelValue: $data.valiFormData.captcha,
  11086. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.valiFormData.captcha = $event)
  11087. }, null, 8, ["modelValue"]),
  11088. vue.createCommentVNode(" <button class='cu-btn bg-login-zl shadow'>验证码</button> "),
  11089. vue.createElementVNode("image", {
  11090. class: "cu-btn captchaImg",
  11091. src: $data.verifyCodeImg,
  11092. onClick: _cache[3] || (_cache[3] = (...args) => $options.getVerifyCodeImg && $options.getVerifyCodeImg(...args))
  11093. }, null, 8, ["src"])
  11094. ])
  11095. ]),
  11096. _: 1
  11097. /* STABLE */
  11098. }, 8, ["rules", "modelValue"])
  11099. ]),
  11100. vue.createElementVNode("view", { class: "padding-lr margin-top-xs" }, [
  11101. vue.createElementVNode("button", {
  11102. class: "cu-btn block round bg-login-zl margin-tb-sm lg",
  11103. onClick: _cache[4] || (_cache[4] = ($event) => $options.formSubmit("valiForm"))
  11104. }, "立即登录")
  11105. ]),
  11106. vue.createVNode(
  11107. _component_uni_popup,
  11108. {
  11109. ref: "message",
  11110. type: "message"
  11111. },
  11112. {
  11113. default: vue.withCtx(() => [
  11114. vue.createVNode(_component_uni_popup_message, {
  11115. type: "error",
  11116. message: $data.messageText,
  11117. duration: 2e3
  11118. }, null, 8, ["message"])
  11119. ]),
  11120. _: 1
  11121. /* STABLE */
  11122. },
  11123. 512
  11124. /* NEED_PATCH */
  11125. )
  11126. ]);
  11127. }
  11128. const PagesLoginIndex = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$i], ["__scopeId", "data-v-d08ef7d4"], ["__file", "E:/HBuilderProjects/YTAPP/pages/login/index.vue"]]);
  11129. const _sfc_main$i = {
  11130. data() {
  11131. const token = vue.ref(null);
  11132. const user = vue.ref(null);
  11133. return {
  11134. token,
  11135. user
  11136. };
  11137. },
  11138. onLoad() {
  11139. },
  11140. onShow() {
  11141. this.token = uni.getStorageSync("token");
  11142. this.user = uni.getStorageSync("user");
  11143. },
  11144. methods: {
  11145. avatarClick() {
  11146. if (this.token)
  11147. ;
  11148. else {
  11149. uni.navigateTo({
  11150. url: "/pages/login/index"
  11151. });
  11152. }
  11153. },
  11154. logout() {
  11155. uni.removeStorageSync("token");
  11156. uni.removeStorageSync("user");
  11157. this.token = uni.getStorageSync("token");
  11158. this.user = uni.getStorageSync("user");
  11159. },
  11160. dialogToggle() {
  11161. this.$refs.alertDialog.open();
  11162. }
  11163. }
  11164. };
  11165. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  11166. return vue.openBlock(), vue.createElementBlock("view", { class: "content" });
  11167. }
  11168. const PagesOrderIndex = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$h], ["__file", "E:/HBuilderProjects/YTAPP/pages/order/index.vue"]]);
  11169. const dataPicker = {
  11170. props: {
  11171. localdata: {
  11172. type: [Array, Object],
  11173. default() {
  11174. return [];
  11175. }
  11176. },
  11177. spaceInfo: {
  11178. type: Object,
  11179. default() {
  11180. return {};
  11181. }
  11182. },
  11183. collection: {
  11184. type: String,
  11185. default: ""
  11186. },
  11187. action: {
  11188. type: String,
  11189. default: ""
  11190. },
  11191. field: {
  11192. type: String,
  11193. default: ""
  11194. },
  11195. orderby: {
  11196. type: String,
  11197. default: ""
  11198. },
  11199. where: {
  11200. type: [String, Object],
  11201. default: ""
  11202. },
  11203. pageData: {
  11204. type: String,
  11205. default: "add"
  11206. },
  11207. pageCurrent: {
  11208. type: Number,
  11209. default: 1
  11210. },
  11211. pageSize: {
  11212. type: Number,
  11213. default: 500
  11214. },
  11215. getcount: {
  11216. type: [Boolean, String],
  11217. default: false
  11218. },
  11219. getone: {
  11220. type: [Boolean, String],
  11221. default: false
  11222. },
  11223. gettree: {
  11224. type: [Boolean, String],
  11225. default: false
  11226. },
  11227. manual: {
  11228. type: Boolean,
  11229. default: false
  11230. },
  11231. value: {
  11232. type: [Array, String, Number],
  11233. default() {
  11234. return [];
  11235. }
  11236. },
  11237. modelValue: {
  11238. type: [Array, String, Number],
  11239. default() {
  11240. return [];
  11241. }
  11242. },
  11243. preload: {
  11244. type: Boolean,
  11245. default: false
  11246. },
  11247. stepSearh: {
  11248. type: Boolean,
  11249. default: true
  11250. },
  11251. selfField: {
  11252. type: String,
  11253. default: ""
  11254. },
  11255. parentField: {
  11256. type: String,
  11257. default: ""
  11258. },
  11259. multiple: {
  11260. type: Boolean,
  11261. default: false
  11262. },
  11263. map: {
  11264. type: Object,
  11265. default() {
  11266. return {
  11267. text: "text",
  11268. value: "value"
  11269. };
  11270. }
  11271. }
  11272. },
  11273. data() {
  11274. return {
  11275. loading: false,
  11276. errorMessage: "",
  11277. loadMore: {
  11278. contentdown: "",
  11279. contentrefresh: "",
  11280. contentnomore: ""
  11281. },
  11282. dataList: [],
  11283. selected: [],
  11284. selectedIndex: 0,
  11285. page: {
  11286. current: this.pageCurrent,
  11287. size: this.pageSize,
  11288. count: 0
  11289. }
  11290. };
  11291. },
  11292. computed: {
  11293. isLocalData() {
  11294. return !this.collection.length;
  11295. },
  11296. isCloudData() {
  11297. return this.collection.length > 0;
  11298. },
  11299. isCloudDataList() {
  11300. return this.isCloudData && (!this.parentField && !this.selfField);
  11301. },
  11302. isCloudDataTree() {
  11303. return this.isCloudData && this.parentField && this.selfField;
  11304. },
  11305. dataValue() {
  11306. let isModelValue = Array.isArray(this.modelValue) ? this.modelValue.length > 0 : this.modelValue !== null || this.modelValue !== void 0;
  11307. return isModelValue ? this.modelValue : this.value;
  11308. },
  11309. hasValue() {
  11310. if (typeof this.dataValue === "number") {
  11311. return true;
  11312. }
  11313. return this.dataValue != null && this.dataValue.length > 0;
  11314. }
  11315. },
  11316. created() {
  11317. this.$watch(() => {
  11318. var al = [];
  11319. [
  11320. "pageCurrent",
  11321. "pageSize",
  11322. "spaceInfo",
  11323. "value",
  11324. "modelValue",
  11325. "localdata",
  11326. "collection",
  11327. "action",
  11328. "field",
  11329. "orderby",
  11330. "where",
  11331. "getont",
  11332. "getcount",
  11333. "gettree"
  11334. ].forEach((key) => {
  11335. al.push(this[key]);
  11336. });
  11337. return al;
  11338. }, (newValue, oldValue) => {
  11339. for (let i2 = 2; i2 < newValue.length; i2++) {
  11340. if (newValue[i2] != oldValue[i2]) {
  11341. break;
  11342. }
  11343. }
  11344. if (newValue[0] != oldValue[0]) {
  11345. this.page.current = this.pageCurrent;
  11346. }
  11347. this.page.size = this.pageSize;
  11348. this.onPropsChange();
  11349. });
  11350. this._treeData = [];
  11351. },
  11352. methods: {
  11353. onPropsChange() {
  11354. this._treeData = [];
  11355. },
  11356. // 填充 pickview 数据
  11357. async loadData() {
  11358. if (this.isLocalData) {
  11359. this.loadLocalData();
  11360. } else if (this.isCloudDataList) {
  11361. this.loadCloudDataList();
  11362. } else if (this.isCloudDataTree) {
  11363. this.loadCloudDataTree();
  11364. }
  11365. },
  11366. // 加载本地数据
  11367. async loadLocalData() {
  11368. this._treeData = [];
  11369. this._extractTree(this.localdata, this._treeData);
  11370. let inputValue = this.dataValue;
  11371. if (inputValue === void 0) {
  11372. return;
  11373. }
  11374. if (Array.isArray(inputValue)) {
  11375. inputValue = inputValue[inputValue.length - 1];
  11376. if (typeof inputValue === "object" && inputValue[this.map.value]) {
  11377. inputValue = inputValue[this.map.value];
  11378. }
  11379. }
  11380. this.selected = this._findNodePath(inputValue, this.localdata);
  11381. },
  11382. // 加载 Cloud 数据 (单列)
  11383. async loadCloudDataList() {
  11384. if (this.loading) {
  11385. return;
  11386. }
  11387. this.loading = true;
  11388. try {
  11389. let response = await this.getCommand();
  11390. let responseData = response.result.data;
  11391. this._treeData = responseData;
  11392. this._updateBindData();
  11393. this._updateSelected();
  11394. this.onDataChange();
  11395. } catch (e2) {
  11396. this.errorMessage = e2;
  11397. } finally {
  11398. this.loading = false;
  11399. }
  11400. },
  11401. // 加载 Cloud 数据 (树形)
  11402. async loadCloudDataTree() {
  11403. if (this.loading) {
  11404. return;
  11405. }
  11406. this.loading = true;
  11407. try {
  11408. let commandOptions = {
  11409. field: this._cloudDataPostField(),
  11410. where: this._cloudDataTreeWhere()
  11411. };
  11412. if (this.gettree) {
  11413. commandOptions.startwith = `${this.selfField}=='${this.dataValue}'`;
  11414. }
  11415. let response = await this.getCommand(commandOptions);
  11416. let responseData = response.result.data;
  11417. this._treeData = responseData;
  11418. this._updateBindData();
  11419. this._updateSelected();
  11420. this.onDataChange();
  11421. } catch (e2) {
  11422. this.errorMessage = e2;
  11423. } finally {
  11424. this.loading = false;
  11425. }
  11426. },
  11427. // 加载 Cloud 数据 (节点)
  11428. async loadCloudDataNode(callback) {
  11429. if (this.loading) {
  11430. return;
  11431. }
  11432. this.loading = true;
  11433. try {
  11434. let commandOptions = {
  11435. field: this._cloudDataPostField(),
  11436. where: this._cloudDataNodeWhere()
  11437. };
  11438. let response = await this.getCommand(commandOptions);
  11439. let responseData = response.result.data;
  11440. callback(responseData);
  11441. } catch (e2) {
  11442. this.errorMessage = e2;
  11443. } finally {
  11444. this.loading = false;
  11445. }
  11446. },
  11447. // 回显 Cloud 数据
  11448. getCloudDataValue() {
  11449. if (this.isCloudDataList) {
  11450. return this.getCloudDataListValue();
  11451. }
  11452. if (this.isCloudDataTree) {
  11453. return this.getCloudDataTreeValue();
  11454. }
  11455. },
  11456. // 回显 Cloud 数据 (单列)
  11457. getCloudDataListValue() {
  11458. let where = [];
  11459. let whereField = this._getForeignKeyByField();
  11460. if (whereField) {
  11461. where.push(`${whereField} == '${this.dataValue}'`);
  11462. }
  11463. where = where.join(" || ");
  11464. if (this.where) {
  11465. where = `(${this.where}) && (${where})`;
  11466. }
  11467. return this.getCommand({
  11468. field: this._cloudDataPostField(),
  11469. where
  11470. }).then((res) => {
  11471. this.selected = res.result.data;
  11472. return res.result.data;
  11473. });
  11474. },
  11475. // 回显 Cloud 数据 (树形)
  11476. getCloudDataTreeValue() {
  11477. return this.getCommand({
  11478. field: this._cloudDataPostField(),
  11479. getTreePath: {
  11480. startWith: `${this.selfField}=='${this.dataValue}'`
  11481. }
  11482. }).then((res) => {
  11483. let treePath = [];
  11484. this._extractTreePath(res.result.data, treePath);
  11485. this.selected = treePath;
  11486. return treePath;
  11487. });
  11488. },
  11489. getCommand(options = {}) {
  11490. let db = Ys.database(this.spaceInfo);
  11491. const action = options.action || this.action;
  11492. if (action) {
  11493. db = db.action(action);
  11494. }
  11495. const collection = options.collection || this.collection;
  11496. db = db.collection(collection);
  11497. const where = options.where || this.where;
  11498. if (!(!where || !Object.keys(where).length)) {
  11499. db = db.where(where);
  11500. }
  11501. const field = options.field || this.field;
  11502. if (field) {
  11503. db = db.field(field);
  11504. }
  11505. const orderby = options.orderby || this.orderby;
  11506. if (orderby) {
  11507. db = db.orderBy(orderby);
  11508. }
  11509. const current = options.pageCurrent !== void 0 ? options.pageCurrent : this.page.current;
  11510. const size = options.pageSize !== void 0 ? options.pageSize : this.page.size;
  11511. const getCount = options.getcount !== void 0 ? options.getcount : this.getcount;
  11512. const getTree = options.gettree !== void 0 ? options.gettree : this.gettree;
  11513. const getOptions = {
  11514. getCount,
  11515. getTree
  11516. };
  11517. if (options.getTreePath) {
  11518. getOptions.getTreePath = options.getTreePath;
  11519. }
  11520. db = db.skip(size * (current - 1)).limit(size).get(getOptions);
  11521. return db;
  11522. },
  11523. _cloudDataPostField() {
  11524. let fields = [this.field];
  11525. if (this.parentField) {
  11526. fields.push(`${this.parentField} as parent_value`);
  11527. }
  11528. return fields.join(",");
  11529. },
  11530. _cloudDataTreeWhere() {
  11531. let result = [];
  11532. let selected = this.selected;
  11533. let parentField = this.parentField;
  11534. if (parentField) {
  11535. result.push(`${parentField} == null || ${parentField} == ""`);
  11536. }
  11537. if (selected.length) {
  11538. for (var i2 = 0; i2 < selected.length - 1; i2++) {
  11539. result.push(`${parentField} == '${selected[i2].value}'`);
  11540. }
  11541. }
  11542. let where = [];
  11543. if (this.where) {
  11544. where.push(`(${this.where})`);
  11545. }
  11546. if (result.length) {
  11547. where.push(`(${result.join(" || ")})`);
  11548. }
  11549. return where.join(" && ");
  11550. },
  11551. _cloudDataNodeWhere() {
  11552. let where = [];
  11553. let selected = this.selected;
  11554. if (selected.length) {
  11555. where.push(`${this.parentField} == '${selected[selected.length - 1].value}'`);
  11556. }
  11557. where = where.join(" || ");
  11558. if (this.where) {
  11559. return `(${this.where}) && (${where})`;
  11560. }
  11561. return where;
  11562. },
  11563. _getWhereByForeignKey() {
  11564. let result = [];
  11565. let whereField = this._getForeignKeyByField();
  11566. if (whereField) {
  11567. result.push(`${whereField} == '${this.dataValue}'`);
  11568. }
  11569. if (this.where) {
  11570. return `(${this.where}) && (${result.join(" || ")})`;
  11571. }
  11572. return result.join(" || ");
  11573. },
  11574. _getForeignKeyByField() {
  11575. let fields = this.field.split(",");
  11576. let whereField = null;
  11577. for (let i2 = 0; i2 < fields.length; i2++) {
  11578. const items = fields[i2].split("as");
  11579. if (items.length < 2) {
  11580. continue;
  11581. }
  11582. if (items[1].trim() === "value") {
  11583. whereField = items[0].trim();
  11584. break;
  11585. }
  11586. }
  11587. return whereField;
  11588. },
  11589. _updateBindData(node) {
  11590. const {
  11591. dataList,
  11592. hasNodes
  11593. } = this._filterData(this._treeData, this.selected);
  11594. let isleaf = this._stepSearh === false && !hasNodes;
  11595. if (node) {
  11596. node.isleaf = isleaf;
  11597. }
  11598. this.dataList = dataList;
  11599. this.selectedIndex = dataList.length - 1;
  11600. if (!isleaf && this.selected.length < dataList.length) {
  11601. this.selected.push({
  11602. value: null,
  11603. text: "请选择"
  11604. });
  11605. }
  11606. return {
  11607. isleaf,
  11608. hasNodes
  11609. };
  11610. },
  11611. _updateSelected() {
  11612. let dl = this.dataList;
  11613. let sl = this.selected;
  11614. let textField = this.map.text;
  11615. let valueField = this.map.value;
  11616. for (let i2 = 0; i2 < sl.length; i2++) {
  11617. let value = sl[i2].value;
  11618. let dl2 = dl[i2];
  11619. for (let j2 = 0; j2 < dl2.length; j2++) {
  11620. let item2 = dl2[j2];
  11621. if (item2[valueField] === value) {
  11622. sl[i2].text = item2[textField];
  11623. break;
  11624. }
  11625. }
  11626. }
  11627. },
  11628. _filterData(data, paths) {
  11629. let dataList = [];
  11630. let hasNodes = true;
  11631. dataList.push(data.filter((item) => {
  11632. return item.parent_value === null || item.parent_value === void 0 || item.parent_value === "";
  11633. }));
  11634. for (let i2 = 0; i2 < paths.length; i2++) {
  11635. let value = paths[i2].value;
  11636. let nodes = data.filter((item) => {
  11637. return item.parent_value === value;
  11638. });
  11639. if (nodes.length) {
  11640. dataList.push(nodes);
  11641. } else {
  11642. hasNodes = false;
  11643. }
  11644. }
  11645. return {
  11646. dataList,
  11647. hasNodes
  11648. };
  11649. },
  11650. _extractTree(nodes, result, parent_value) {
  11651. let valueField = this.map.value;
  11652. for (let i2 = 0; i2 < nodes.length; i2++) {
  11653. let node = nodes[i2];
  11654. let child = {};
  11655. for (let key in node) {
  11656. if (key !== "children") {
  11657. child[key] = node[key];
  11658. }
  11659. }
  11660. if (parent_value !== null && parent_value !== void 0 && parent_value !== "") {
  11661. child.parent_value = parent_value;
  11662. }
  11663. result.push(child);
  11664. let children = node.children;
  11665. if (children) {
  11666. this._extractTree(children, result, node[valueField]);
  11667. }
  11668. }
  11669. },
  11670. _extractTreePath(nodes, result) {
  11671. for (let i2 = 0; i2 < nodes.length; i2++) {
  11672. let node = nodes[i2];
  11673. let child = {};
  11674. for (let key in node) {
  11675. if (key !== "children") {
  11676. child[key] = node[key];
  11677. }
  11678. }
  11679. result.push(child);
  11680. let children = node.children;
  11681. if (children) {
  11682. this._extractTreePath(children, result);
  11683. }
  11684. }
  11685. },
  11686. _findNodePath(key, nodes, path = []) {
  11687. let textField = this.map.text;
  11688. let valueField = this.map.value;
  11689. for (let i2 = 0; i2 < nodes.length; i2++) {
  11690. let node = nodes[i2];
  11691. let children = node.children;
  11692. let text = node[textField];
  11693. let value = node[valueField];
  11694. path.push({
  11695. value,
  11696. text
  11697. });
  11698. if (value === key) {
  11699. return path;
  11700. }
  11701. if (children) {
  11702. const p2 = this._findNodePath(key, children, path);
  11703. if (p2.length) {
  11704. return p2;
  11705. }
  11706. }
  11707. path.pop();
  11708. }
  11709. return [];
  11710. }
  11711. }
  11712. };
  11713. const _sfc_main$h = {
  11714. name: "UniDataPickerView",
  11715. emits: ["nodeclick", "change", "datachange", "update:modelValue"],
  11716. mixins: [dataPicker],
  11717. props: {
  11718. managedMode: {
  11719. type: Boolean,
  11720. default: false
  11721. },
  11722. ellipsis: {
  11723. type: Boolean,
  11724. default: true
  11725. }
  11726. },
  11727. created() {
  11728. if (!this.managedMode) {
  11729. this.$nextTick(() => {
  11730. this.loadData();
  11731. });
  11732. }
  11733. },
  11734. methods: {
  11735. onPropsChange() {
  11736. this._treeData = [];
  11737. this.selectedIndex = 0;
  11738. this.$nextTick(() => {
  11739. this.loadData();
  11740. });
  11741. },
  11742. handleSelect(index) {
  11743. this.selectedIndex = index;
  11744. },
  11745. handleNodeClick(item, i2, j2) {
  11746. if (item.disable) {
  11747. return;
  11748. }
  11749. const node = this.dataList[i2][j2];
  11750. const text = node[this.map.text];
  11751. const value = node[this.map.value];
  11752. if (i2 < this.selected.length - 1) {
  11753. this.selected.splice(i2, this.selected.length - i2);
  11754. this.selected.push({
  11755. text,
  11756. value
  11757. });
  11758. } else if (i2 === this.selected.length - 1) {
  11759. this.selected.splice(i2, 1, {
  11760. text,
  11761. value
  11762. });
  11763. }
  11764. if (node.isleaf) {
  11765. this.onSelectedChange(node, node.isleaf);
  11766. return;
  11767. }
  11768. const {
  11769. isleaf,
  11770. hasNodes
  11771. } = this._updateBindData();
  11772. if (this.isLocalData) {
  11773. this.onSelectedChange(node, !hasNodes || isleaf);
  11774. } else if (this.isCloudDataList) {
  11775. this.onSelectedChange(node, true);
  11776. } else if (this.isCloudDataTree) {
  11777. if (isleaf) {
  11778. this.onSelectedChange(node, node.isleaf);
  11779. } else if (!hasNodes) {
  11780. this.loadCloudDataNode((data) => {
  11781. if (!data.length) {
  11782. node.isleaf = true;
  11783. } else {
  11784. this._treeData.push(...data);
  11785. this._updateBindData(node);
  11786. }
  11787. this.onSelectedChange(node, node.isleaf);
  11788. });
  11789. }
  11790. }
  11791. },
  11792. updateData(data) {
  11793. this._treeData = data.treeData;
  11794. this.selected = data.selected;
  11795. if (!this._treeData.length) {
  11796. this.loadData();
  11797. } else {
  11798. this._updateBindData();
  11799. }
  11800. },
  11801. onDataChange() {
  11802. this.$emit("datachange");
  11803. },
  11804. onSelectedChange(node, isleaf) {
  11805. if (isleaf) {
  11806. this._dispatchEvent();
  11807. }
  11808. if (node) {
  11809. this.$emit("nodeclick", node);
  11810. }
  11811. },
  11812. _dispatchEvent() {
  11813. this.$emit("change", this.selected.slice(0));
  11814. }
  11815. }
  11816. };
  11817. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  11818. const _component_uni_load_more = resolveEasycom(vue.resolveDynamicComponent("uni-load-more"), __easycom_0$5);
  11819. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-data-pickerview" }, [
  11820. !_ctx.isCloudDataList ? (vue.openBlock(), vue.createElementBlock("scroll-view", {
  11821. key: 0,
  11822. class: "selected-area",
  11823. "scroll-x": "true"
  11824. }, [
  11825. vue.createElementVNode("view", { class: "selected-list" }, [
  11826. (vue.openBlock(true), vue.createElementBlock(
  11827. vue.Fragment,
  11828. null,
  11829. vue.renderList(_ctx.selected, (item, index) => {
  11830. return vue.openBlock(), vue.createElementBlock("view", {
  11831. class: vue.normalizeClass(["selected-item", {
  11832. "selected-item-active": index == _ctx.selectedIndex
  11833. }]),
  11834. key: index,
  11835. onClick: ($event) => $options.handleSelect(index)
  11836. }, [
  11837. vue.createElementVNode(
  11838. "text",
  11839. null,
  11840. vue.toDisplayString(item.text || ""),
  11841. 1
  11842. /* TEXT */
  11843. )
  11844. ], 10, ["onClick"]);
  11845. }),
  11846. 128
  11847. /* KEYED_FRAGMENT */
  11848. ))
  11849. ])
  11850. ])) : vue.createCommentVNode("v-if", true),
  11851. vue.createElementVNode("view", { class: "tab-c" }, [
  11852. vue.createElementVNode("scroll-view", {
  11853. class: "list",
  11854. "scroll-y": true
  11855. }, [
  11856. (vue.openBlock(true), vue.createElementBlock(
  11857. vue.Fragment,
  11858. null,
  11859. vue.renderList(_ctx.dataList[_ctx.selectedIndex], (item, j2) => {
  11860. return vue.openBlock(), vue.createElementBlock("view", {
  11861. class: vue.normalizeClass(["item", { "is-disabled": !!item.disable }]),
  11862. key: j2,
  11863. onClick: ($event) => $options.handleNodeClick(item, _ctx.selectedIndex, j2)
  11864. }, [
  11865. vue.createElementVNode(
  11866. "text",
  11867. { class: "item-text" },
  11868. vue.toDisplayString(item[_ctx.map.text]),
  11869. 1
  11870. /* TEXT */
  11871. ),
  11872. _ctx.selected.length > _ctx.selectedIndex && item[_ctx.map.value] == _ctx.selected[_ctx.selectedIndex].value ? (vue.openBlock(), vue.createElementBlock("view", {
  11873. key: 0,
  11874. class: "check"
  11875. })) : vue.createCommentVNode("v-if", true)
  11876. ], 10, ["onClick"]);
  11877. }),
  11878. 128
  11879. /* KEYED_FRAGMENT */
  11880. ))
  11881. ]),
  11882. _ctx.loading ? (vue.openBlock(), vue.createElementBlock("view", {
  11883. key: 0,
  11884. class: "loading-cover"
  11885. }, [
  11886. vue.createVNode(_component_uni_load_more, {
  11887. class: "load-more",
  11888. contentText: _ctx.loadMore,
  11889. status: "loading"
  11890. }, null, 8, ["contentText"])
  11891. ])) : vue.createCommentVNode("v-if", true),
  11892. _ctx.errorMessage ? (vue.openBlock(), vue.createElementBlock("view", {
  11893. key: 1,
  11894. class: "error-message"
  11895. }, [
  11896. vue.createElementVNode(
  11897. "text",
  11898. { class: "error-text" },
  11899. vue.toDisplayString(_ctx.errorMessage),
  11900. 1
  11901. /* TEXT */
  11902. )
  11903. ])) : vue.createCommentVNode("v-if", true)
  11904. ])
  11905. ]);
  11906. }
  11907. const DataPickerView = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$g], ["__scopeId", "data-v-91ec6a82"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue"]]);
  11908. const _sfc_main$g = {
  11909. name: "UniDataPicker",
  11910. emits: ["popupopened", "popupclosed", "nodeclick", "input", "change", "update:modelValue", "inputclick"],
  11911. mixins: [dataPicker],
  11912. components: {
  11913. DataPickerView
  11914. },
  11915. props: {
  11916. options: {
  11917. type: [Object, Array],
  11918. default() {
  11919. return {};
  11920. }
  11921. },
  11922. popupTitle: {
  11923. type: String,
  11924. default: "请选择"
  11925. },
  11926. placeholder: {
  11927. type: String,
  11928. default: "请选择"
  11929. },
  11930. heightMobile: {
  11931. type: String,
  11932. default: ""
  11933. },
  11934. readonly: {
  11935. type: Boolean,
  11936. default: false
  11937. },
  11938. clearIcon: {
  11939. type: Boolean,
  11940. default: true
  11941. },
  11942. border: {
  11943. type: Boolean,
  11944. default: true
  11945. },
  11946. split: {
  11947. type: String,
  11948. default: "/"
  11949. },
  11950. ellipsis: {
  11951. type: Boolean,
  11952. default: true
  11953. }
  11954. },
  11955. data() {
  11956. return {
  11957. isOpened: false,
  11958. inputSelected: []
  11959. };
  11960. },
  11961. created() {
  11962. this.$nextTick(() => {
  11963. this.load();
  11964. });
  11965. },
  11966. watch: {
  11967. localdata: {
  11968. handler() {
  11969. this.load();
  11970. },
  11971. deep: true
  11972. }
  11973. },
  11974. methods: {
  11975. clear() {
  11976. this._dispatchEvent([]);
  11977. },
  11978. onPropsChange() {
  11979. this._treeData = [];
  11980. this.selectedIndex = 0;
  11981. this.load();
  11982. },
  11983. load() {
  11984. if (this.readonly) {
  11985. this._processReadonly(this.localdata, this.dataValue);
  11986. return;
  11987. }
  11988. if (this.isLocalData) {
  11989. this.loadData();
  11990. this.inputSelected = this.selected.slice(0);
  11991. } else if (this.isCloudDataList || this.isCloudDataTree) {
  11992. this.loading = true;
  11993. this.getCloudDataValue().then((res) => {
  11994. this.loading = false;
  11995. this.inputSelected = res;
  11996. }).catch((err) => {
  11997. this.loading = false;
  11998. this.errorMessage = err;
  11999. });
  12000. }
  12001. },
  12002. show() {
  12003. this.isOpened = true;
  12004. setTimeout(() => {
  12005. this.$refs.pickerView.updateData({
  12006. treeData: this._treeData,
  12007. selected: this.selected,
  12008. selectedIndex: this.selectedIndex
  12009. });
  12010. }, 200);
  12011. this.$emit("popupopened");
  12012. },
  12013. hide() {
  12014. this.isOpened = false;
  12015. this.$emit("popupclosed");
  12016. },
  12017. handleInput() {
  12018. if (this.readonly) {
  12019. this.$emit("inputclick");
  12020. return;
  12021. }
  12022. this.show();
  12023. },
  12024. handleClose(e2) {
  12025. this.hide();
  12026. },
  12027. onnodeclick(e2) {
  12028. this.$emit("nodeclick", e2);
  12029. },
  12030. ondatachange(e2) {
  12031. this._treeData = this.$refs.pickerView._treeData;
  12032. },
  12033. onchange(e2) {
  12034. this.hide();
  12035. this.$nextTick(() => {
  12036. this.inputSelected = e2;
  12037. });
  12038. this._dispatchEvent(e2);
  12039. },
  12040. _processReadonly(dataList, value) {
  12041. var isTree = dataList.findIndex((item2) => {
  12042. return item2.children;
  12043. });
  12044. if (isTree > -1) {
  12045. let inputValue;
  12046. if (Array.isArray(value)) {
  12047. inputValue = value[value.length - 1];
  12048. if (typeof inputValue === "object" && inputValue.value) {
  12049. inputValue = inputValue.value;
  12050. }
  12051. } else {
  12052. inputValue = value;
  12053. }
  12054. this.inputSelected = this._findNodePath(inputValue, this.localdata);
  12055. return;
  12056. }
  12057. if (!this.hasValue) {
  12058. this.inputSelected = [];
  12059. return;
  12060. }
  12061. let result = [];
  12062. for (let i2 = 0; i2 < value.length; i2++) {
  12063. var val = value[i2];
  12064. var item = dataList.find((v2) => {
  12065. return v2.value == val;
  12066. });
  12067. if (item) {
  12068. result.push(item);
  12069. }
  12070. }
  12071. if (result.length) {
  12072. this.inputSelected = result;
  12073. }
  12074. },
  12075. _filterForArray(data, valueArray) {
  12076. var result = [];
  12077. for (let i2 = 0; i2 < valueArray.length; i2++) {
  12078. var value = valueArray[i2];
  12079. var found = data.find((item) => {
  12080. return item.value == value;
  12081. });
  12082. if (found) {
  12083. result.push(found);
  12084. }
  12085. }
  12086. return result;
  12087. },
  12088. _dispatchEvent(selected) {
  12089. let item = {};
  12090. if (selected.length) {
  12091. var value = new Array(selected.length);
  12092. for (var i2 = 0; i2 < selected.length; i2++) {
  12093. value[i2] = selected[i2].value;
  12094. }
  12095. item = selected[selected.length - 1];
  12096. } else {
  12097. item.value = "";
  12098. }
  12099. if (this.formItem) {
  12100. this.formItem.setValue(item.value);
  12101. }
  12102. this.$emit("input", item.value);
  12103. this.$emit("update:modelValue", item.value);
  12104. this.$emit("change", {
  12105. detail: {
  12106. value: selected
  12107. }
  12108. });
  12109. }
  12110. }
  12111. };
  12112. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  12113. const _component_uni_load_more = resolveEasycom(vue.resolveDynamicComponent("uni-load-more"), __easycom_0$5);
  12114. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  12115. const _component_data_picker_view = vue.resolveComponent("data-picker-view");
  12116. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-data-tree" }, [
  12117. vue.createElementVNode("view", {
  12118. class: "uni-data-tree-input",
  12119. onClick: _cache[1] || (_cache[1] = (...args) => $options.handleInput && $options.handleInput(...args))
  12120. }, [
  12121. vue.renderSlot(_ctx.$slots, "default", {
  12122. options: $props.options,
  12123. data: $data.inputSelected,
  12124. error: _ctx.errorMessage
  12125. }, () => [
  12126. vue.createElementVNode(
  12127. "view",
  12128. {
  12129. class: vue.normalizeClass(["input-value", { "input-value-border": $props.border }])
  12130. },
  12131. [
  12132. _ctx.errorMessage ? (vue.openBlock(), vue.createElementBlock(
  12133. "text",
  12134. {
  12135. key: 0,
  12136. class: "selected-area error-text"
  12137. },
  12138. vue.toDisplayString(_ctx.errorMessage),
  12139. 1
  12140. /* TEXT */
  12141. )) : _ctx.loading && !$data.isOpened ? (vue.openBlock(), vue.createElementBlock("view", {
  12142. key: 1,
  12143. class: "selected-area"
  12144. }, [
  12145. vue.createVNode(_component_uni_load_more, {
  12146. class: "load-more",
  12147. contentText: _ctx.loadMore,
  12148. status: "loading"
  12149. }, null, 8, ["contentText"])
  12150. ])) : $data.inputSelected.length ? (vue.openBlock(), vue.createElementBlock("scroll-view", {
  12151. key: 2,
  12152. class: "selected-area",
  12153. "scroll-x": "true"
  12154. }, [
  12155. vue.createElementVNode("view", { class: "selected-list" }, [
  12156. (vue.openBlock(true), vue.createElementBlock(
  12157. vue.Fragment,
  12158. null,
  12159. vue.renderList($data.inputSelected, (item, index) => {
  12160. return vue.openBlock(), vue.createElementBlock("view", {
  12161. class: "selected-item",
  12162. key: index
  12163. }, [
  12164. vue.createElementVNode(
  12165. "text",
  12166. { class: "text-color" },
  12167. vue.toDisplayString(item.text),
  12168. 1
  12169. /* TEXT */
  12170. ),
  12171. index < $data.inputSelected.length - 1 ? (vue.openBlock(), vue.createElementBlock(
  12172. "text",
  12173. {
  12174. key: 0,
  12175. class: "input-split-line"
  12176. },
  12177. vue.toDisplayString($props.split),
  12178. 1
  12179. /* TEXT */
  12180. )) : vue.createCommentVNode("v-if", true)
  12181. ]);
  12182. }),
  12183. 128
  12184. /* KEYED_FRAGMENT */
  12185. ))
  12186. ])
  12187. ])) : (vue.openBlock(), vue.createElementBlock(
  12188. "text",
  12189. {
  12190. key: 3,
  12191. class: "selected-area placeholder"
  12192. },
  12193. vue.toDisplayString($props.placeholder),
  12194. 1
  12195. /* TEXT */
  12196. )),
  12197. $props.clearIcon && !$props.readonly && $data.inputSelected.length ? (vue.openBlock(), vue.createElementBlock("view", {
  12198. key: 4,
  12199. class: "icon-clear",
  12200. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.clear && $options.clear(...args), ["stop"]))
  12201. }, [
  12202. vue.createVNode(_component_uni_icons, {
  12203. type: "clear",
  12204. color: "#c0c4cc",
  12205. size: "24"
  12206. })
  12207. ])) : vue.createCommentVNode("v-if", true),
  12208. (!$props.clearIcon || !$data.inputSelected.length) && !$props.readonly ? (vue.openBlock(), vue.createElementBlock("view", {
  12209. key: 5,
  12210. class: "arrow-area"
  12211. }, [
  12212. vue.createElementVNode("view", { class: "input-arrow" })
  12213. ])) : vue.createCommentVNode("v-if", true)
  12214. ],
  12215. 2
  12216. /* CLASS */
  12217. )
  12218. ], true)
  12219. ]),
  12220. $data.isOpened ? (vue.openBlock(), vue.createElementBlock("view", {
  12221. key: 0,
  12222. class: "uni-data-tree-cover",
  12223. onClick: _cache[2] || (_cache[2] = (...args) => $options.handleClose && $options.handleClose(...args))
  12224. })) : vue.createCommentVNode("v-if", true),
  12225. $data.isOpened ? (vue.openBlock(), vue.createElementBlock("view", {
  12226. key: 1,
  12227. class: "uni-data-tree-dialog"
  12228. }, [
  12229. vue.createElementVNode("view", { class: "uni-popper__arrow" }),
  12230. vue.createElementVNode("view", { class: "dialog-caption" }, [
  12231. vue.createElementVNode("view", { class: "title-area" }, [
  12232. vue.createElementVNode(
  12233. "text",
  12234. { class: "dialog-title" },
  12235. vue.toDisplayString($props.popupTitle),
  12236. 1
  12237. /* TEXT */
  12238. )
  12239. ]),
  12240. vue.createElementVNode("view", {
  12241. class: "dialog-close",
  12242. onClick: _cache[3] || (_cache[3] = (...args) => $options.handleClose && $options.handleClose(...args))
  12243. }, [
  12244. vue.createElementVNode("view", {
  12245. class: "dialog-close-plus",
  12246. "data-id": "close"
  12247. }),
  12248. vue.createElementVNode("view", {
  12249. class: "dialog-close-plus dialog-close-rotate",
  12250. "data-id": "close"
  12251. })
  12252. ])
  12253. ]),
  12254. vue.createVNode(_component_data_picker_view, {
  12255. class: "picker-view",
  12256. ref: "pickerView",
  12257. modelValue: _ctx.dataValue,
  12258. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.dataValue = $event),
  12259. localdata: _ctx.localdata,
  12260. preload: _ctx.preload,
  12261. collection: _ctx.collection,
  12262. field: _ctx.field,
  12263. orderby: _ctx.orderby,
  12264. where: _ctx.where,
  12265. "step-searh": _ctx.stepSearh,
  12266. "self-field": _ctx.selfField,
  12267. "parent-field": _ctx.parentField,
  12268. "managed-mode": true,
  12269. map: _ctx.map,
  12270. ellipsis: $props.ellipsis,
  12271. onChange: $options.onchange,
  12272. onDatachange: $options.ondatachange,
  12273. onNodeclick: $options.onnodeclick
  12274. }, null, 8, ["modelValue", "localdata", "preload", "collection", "field", "orderby", "where", "step-searh", "self-field", "parent-field", "map", "ellipsis", "onChange", "onDatachange", "onNodeclick"])
  12275. ])) : vue.createCommentVNode("v-if", true)
  12276. ]);
  12277. }
  12278. const __easycom_3$1 = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$f], ["__scopeId", "data-v-2653531e"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue"]]);
  12279. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  12280. __name: "index",
  12281. setup(__props, { expose: __expose }) {
  12282. __expose();
  12283. const token = vue.ref();
  12284. const loading = vue.ref(false);
  12285. const hidePage = vue.ref(false);
  12286. const focusType = vue.ref(true);
  12287. const editBatchNum = vue.ref(false);
  12288. const editPalletNum = vue.ref(false);
  12289. const lotnoLogHistory = vue.ref([]);
  12290. const messageRef = vue.ref();
  12291. const messageType = vue.ref();
  12292. const messageText = vue.ref();
  12293. let st2;
  12294. const valiFormData = vue.ref({
  12295. orderNum: "",
  12296. weight: "",
  12297. batchNum: "",
  12298. palletNum: ""
  12299. });
  12300. const rules = vue.reactive({
  12301. orderNum: {
  12302. rules: [
  12303. {
  12304. required: true,
  12305. errorMessage: "单号不能为空"
  12306. }
  12307. ]
  12308. }
  12309. });
  12310. const options = vue.reactive({
  12311. batch: [],
  12312. pallet: []
  12313. });
  12314. const onnodeclick = () => {
  12315. };
  12316. const onpopupopened = () => {
  12317. };
  12318. const onpopupclosed = () => {
  12319. };
  12320. const onchange = () => {
  12321. };
  12322. const checkPermission = async () => {
  12323. let status = permission.isIOS ? await permission.requestIOS("camera") : await permission.requestAndroid("android.permission.CAMERA");
  12324. if (status === null || status === 1) {
  12325. status = 1;
  12326. } else {
  12327. uni.showModal({
  12328. content: "Camera permission required",
  12329. confirmText: "Setting",
  12330. success: function(res) {
  12331. if (res.confirm) {
  12332. permission.gotoAppSetting();
  12333. }
  12334. }
  12335. });
  12336. }
  12337. return status;
  12338. };
  12339. const scanInput = async () => {
  12340. let status = await checkPermission();
  12341. if (status !== 1) {
  12342. return;
  12343. }
  12344. uni.scanCode({
  12345. success: (res) => {
  12346. valiFormData.value.orderNum = res.result;
  12347. },
  12348. fail: (err) => {
  12349. }
  12350. });
  12351. };
  12352. const reset = () => {
  12353. loading.value = false;
  12354. valiFormData.value.orderNum = "";
  12355. valiFormData.value.weight = "";
  12356. };
  12357. const submitBatchNum = () => {
  12358. if (valiFormData.value.batchNum) {
  12359. editBatchNum.value = true;
  12360. } else {
  12361. messageType.value = "error";
  12362. messageText.value = "请选择批次号";
  12363. messageRef.value.open();
  12364. }
  12365. };
  12366. const batchNum = vue.computed(() => {
  12367. const res = options.batch.find((item) => item.value === valiFormData.value.batchNum);
  12368. return res == null ? void 0 : res.text;
  12369. });
  12370. const submitPalletNum = () => {
  12371. if (valiFormData.value.palletNum) {
  12372. editPalletNum.value = true;
  12373. } else {
  12374. messageType.value = "error";
  12375. messageText.value = "请选择托盘号";
  12376. messageRef.value.open();
  12377. }
  12378. };
  12379. const palletNum = vue.computed(() => {
  12380. function findTextByValue(arr, targetValue) {
  12381. for (let item of arr) {
  12382. if (item.value === targetValue) {
  12383. return item.text;
  12384. }
  12385. if (item.children && item.children.length > 0) {
  12386. const result = findTextByValue(item.children, targetValue);
  12387. if (result) {
  12388. return `${item.text}/${result}`;
  12389. }
  12390. }
  12391. }
  12392. return null;
  12393. }
  12394. const textPath = findTextByValue(options.pallet, valiFormData.value.palletNum);
  12395. return textPath;
  12396. });
  12397. const checkOrder = () => {
  12398. loading.value = true;
  12399. uni.setStorageSync("waybills", []);
  12400. uni.request({
  12401. url: getWaybillsURL,
  12402. method: "POST",
  12403. header: {
  12404. batoken: token.value
  12405. },
  12406. data: {
  12407. order_no: valiFormData.value.orderNum,
  12408. batch_number: valiFormData.value.batchNum,
  12409. pallet_number: valiFormData.value.palletNum ? findPalletNumIdByValue(options.pallet, valiFormData.value.palletNum) : ""
  12410. },
  12411. success: (res) => {
  12412. loading.value = false;
  12413. if (res.data.code == 1) {
  12414. messageType.value = "success";
  12415. messageText.value = res.data.msg;
  12416. messageRef.value.open();
  12417. uni.setStorageSync("waybills", res.data.data.waybills);
  12418. uni.navigateTo({
  12419. url: "/pages/scanLotno/waybillsList"
  12420. });
  12421. } else {
  12422. messageType.value = "error";
  12423. messageText.value = res.data.msg;
  12424. messageRef.value.open();
  12425. }
  12426. }
  12427. });
  12428. };
  12429. const findPalletNumIdByValue = (data, targetValue) => {
  12430. for (let i2 = 0; i2 < data.length; i2++) {
  12431. const item = data[i2];
  12432. if (item.id === targetValue || item.value === targetValue) {
  12433. return [item.id];
  12434. } else if (item.children && item.children.length > 0) {
  12435. const childId = findPalletNumIdByValue(item.children, targetValue);
  12436. if (childId !== null) {
  12437. return childId;
  12438. }
  12439. }
  12440. }
  12441. return null;
  12442. };
  12443. const onsubmit = () => {
  12444. st2 && clearTimeout(st2);
  12445. loading.value = true;
  12446. uni.request({
  12447. url: bindShippingURL,
  12448. method: "POST",
  12449. header: {
  12450. batoken: token.value
  12451. },
  12452. data: {
  12453. order_no: valiFormData.value.orderNum,
  12454. reweighting: valiFormData.value.weight,
  12455. batch_number: valiFormData.value.batchNum,
  12456. pallet_number: valiFormData.value.palletNum ? findPalletNumIdByValue(options.pallet, valiFormData.value.palletNum) : ""
  12457. },
  12458. success: (res) => {
  12459. loading.value = false;
  12460. if (res.data.code == 1) {
  12461. messageType.value = "success";
  12462. messageText.value = res.data.msg;
  12463. messageRef.value.open();
  12464. if (res.data.data.labels && res.data.data.labels.length > 0) {
  12465. formatAppLog("log", "at pages/scanLotno/index.vue:278", "有打印面单");
  12466. }
  12467. const historyItem = {
  12468. orderNum: valiFormData.value.orderNum,
  12469. createTime: /* @__PURE__ */ new Date(),
  12470. type: valiFormData.value.batchNum ? "绑定批次" : "绑定托盘",
  12471. status: true
  12472. };
  12473. formatAppLog("log", "at pages/scanLotno/index.vue:290", "lotnoLogHistory--", lotnoLogHistory);
  12474. lotnoLogHistory.value.unshift(historyItem);
  12475. uni.setStorageSync("lotnoLogHistory", lotnoLogHistory.value);
  12476. getHistory();
  12477. } else {
  12478. messageType.value = "error";
  12479. messageText.value = res.data.msg;
  12480. messageRef.value.open();
  12481. const historyItem = {
  12482. orderNum: valiFormData.value.orderNum,
  12483. createTime: /* @__PURE__ */ new Date(),
  12484. type: valiFormData.value.batchNum ? "绑定批次" : "绑定托盘",
  12485. status: false
  12486. };
  12487. lotnoLogHistory.value.unshift(historyItem);
  12488. uni.setStorageSync("lotnoLogHistory", lotnoLogHistory.value);
  12489. getHistory();
  12490. }
  12491. st2 = setTimeout(() => {
  12492. reset();
  12493. setFocus();
  12494. st2 && clearTimeout(st2);
  12495. }, 1e3);
  12496. }
  12497. });
  12498. };
  12499. const getHistory = () => {
  12500. lotnoLogHistory.value = uni.getStorageSync("lotnoLogHistory") || [];
  12501. };
  12502. const keypress = (e2) => {
  12503. formatAppLog("log", "at pages/scanLotno/index.vue:321", e2, "按键码");
  12504. if (e2.keyCode === 102 || e2.keyCode === 103 || e2.keyCode === 104)
  12505. ;
  12506. if (e2.keyCode == 66) {
  12507. onsubmit();
  12508. }
  12509. };
  12510. onLoad(() => {
  12511. plus.key.addEventListener("keyup", keypress);
  12512. });
  12513. onUnload(() => {
  12514. plus.key.removeEventListener("keyup", keypress);
  12515. });
  12516. onHide(() => {
  12517. hidePage.value = true;
  12518. plus.key.removeEventListener("keyup", keypress);
  12519. });
  12520. onBackPress(() => {
  12521. plus.key.removeEventListener("keyup", keypress);
  12522. });
  12523. onShow(() => {
  12524. hidePage.value = false;
  12525. token.value = uni.getStorageSync("token");
  12526. getBindParams();
  12527. getHistory();
  12528. });
  12529. const setFocus = () => {
  12530. if (hidePage.value) {
  12531. return;
  12532. }
  12533. focusType.value = false;
  12534. vue.nextTick(() => {
  12535. focusType.value = true;
  12536. });
  12537. };
  12538. const getBindParams = () => {
  12539. uni.request({
  12540. url: getBindParamsURL,
  12541. method: "GET",
  12542. header: {
  12543. batoken: token.value
  12544. },
  12545. success: (res) => {
  12546. if (res.data.code === 1) {
  12547. let transformData = function(data) {
  12548. return data.map((item) => {
  12549. const { id, value, label, ...rest } = item;
  12550. return {
  12551. id: id || value,
  12552. value,
  12553. text: label,
  12554. ...rest,
  12555. children: item.children ? transformData(item.children) : []
  12556. };
  12557. });
  12558. };
  12559. options.batch = res.data.data.batch_number.map((item) => {
  12560. return { text: item.name, value: item.id };
  12561. });
  12562. const shipping = transformData(res.data.data.shipping);
  12563. options.pallet = shipping;
  12564. }
  12565. },
  12566. fail(e2) {
  12567. formatAppLog("log", "at pages/scanLotno/index.vue:411", "fail--", e2);
  12568. }
  12569. });
  12570. };
  12571. onNavigationBarButtonTap((event) => {
  12572. if (event.index === 0) {
  12573. uni.navigateTo({
  12574. url: "/pages/scanLotno/lotnoLog"
  12575. });
  12576. }
  12577. });
  12578. const __returned__ = { token, loading, hidePage, focusType, editBatchNum, editPalletNum, lotnoLogHistory, messageRef, messageType, messageText, get st() {
  12579. return st2;
  12580. }, set st(v2) {
  12581. st2 = v2;
  12582. }, valiFormData, rules, options, onnodeclick, onpopupopened, onpopupclosed, onchange, checkPermission, scanInput, reset, submitBatchNum, batchNum, submitPalletNum, palletNum, checkOrder, findPalletNumIdByValue, onsubmit, getHistory, keypress, setFocus, getBindParams };
  12583. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  12584. return __returned__;
  12585. }
  12586. });
  12587. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  12588. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  12589. const _component_uni_forms_item = resolveEasycom(vue.resolveDynamicComponent("uni-forms-item"), __easycom_2$1);
  12590. const _component_uni_data_select = resolveEasycom(vue.resolveDynamicComponent("uni-data-select"), __easycom_0$6);
  12591. const _component_uni_data_picker = resolveEasycom(vue.resolveDynamicComponent("uni-data-picker"), __easycom_3$1);
  12592. const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_3$2);
  12593. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  12594. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_5);
  12595. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  12596. return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [
  12597. vue.createVNode(_component_uni_forms, {
  12598. ref: "valiForm",
  12599. "label-align": "right",
  12600. "label-width": 80,
  12601. rules: $setup.rules,
  12602. modelValue: $setup.valiFormData
  12603. }, {
  12604. default: vue.withCtx(() => [
  12605. vue.createVNode(_component_uni_forms_item, {
  12606. label: "运单号码",
  12607. required: "",
  12608. name: "orderNum"
  12609. }, {
  12610. default: vue.withCtx(() => [
  12611. vue.createVNode(_component_uni_easyinput, {
  12612. modelValue: $setup.valiFormData.orderNum,
  12613. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.valiFormData.orderNum = $event),
  12614. placeholder: "请输入单号",
  12615. suffixIcon: "scan",
  12616. focus: $setup.focusType,
  12617. onIconClick: $setup.scanInput
  12618. }, null, 8, ["modelValue", "focus"])
  12619. ]),
  12620. _: 1
  12621. /* STABLE */
  12622. }),
  12623. vue.createVNode(_component_uni_forms_item, {
  12624. label: "复称重量",
  12625. name: "weight"
  12626. }, {
  12627. default: vue.withCtx(() => [
  12628. vue.createVNode(_component_uni_easyinput, {
  12629. modelValue: $setup.valiFormData.weight,
  12630. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.valiFormData.weight = $event),
  12631. placeholder: "请输入复称重量",
  12632. oninput: "value=value.replace(/[^\\d.]/g,'').replace(/^\\./g, '').replace(/\\.{2,}/g, '').replace('.', '$#$').replace(/\\./g, '').replace('$#$', '.').match(/^\\d*(\\.?\\d{0,2})/g)[0] || null"
  12633. }, {
  12634. right: vue.withCtx(() => [
  12635. vue.createElementVNode("view", { class: "weight-right" }, "KG")
  12636. ]),
  12637. _: 1
  12638. /* STABLE */
  12639. }, 8, ["modelValue"])
  12640. ]),
  12641. _: 1
  12642. /* STABLE */
  12643. }),
  12644. vue.createCommentVNode(" <text class='weight-tip'>复称重量作用是确保句惠完整,防止工作人员计费称車后进行的其他操作引起的物品丢失问题</text> "),
  12645. vue.createCommentVNode(' <uni-section title="绑定批托盘号" type="line" padding style="height: calc(100vh - 100px)"> '),
  12646. vue.createVNode(_component_uni_forms_item, {
  12647. label: "绑定批次号",
  12648. name: "batchNum",
  12649. class: "select-item"
  12650. }, {
  12651. default: vue.withCtx(() => [
  12652. !$setup.editBatchNum ? (vue.openBlock(), vue.createBlock(_component_uni_data_select, {
  12653. key: 0,
  12654. modelValue: $setup.valiFormData.batchNum,
  12655. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $setup.valiFormData.batchNum = $event),
  12656. placeholder: "请选择批次号",
  12657. localdata: $setup.options.batch,
  12658. clear: false
  12659. }, null, 8, ["modelValue", "localdata"])) : vue.createCommentVNode("v-if", true),
  12660. $setup.editBatchNum ? (vue.openBlock(), vue.createBlock(_component_uni_easyinput, {
  12661. key: 1,
  12662. value: $setup.batchNum,
  12663. disabled: $setup.editBatchNum
  12664. }, null, 8, ["value", "disabled"])) : vue.createCommentVNode("v-if", true),
  12665. !$setup.editBatchNum ? (vue.openBlock(), vue.createElementBlock("button", {
  12666. key: 2,
  12667. type: "primary",
  12668. onClick: $setup.submitBatchNum
  12669. }, "确认")) : vue.createCommentVNode("v-if", true),
  12670. $setup.editBatchNum ? (vue.openBlock(), vue.createElementBlock("button", {
  12671. key: 3,
  12672. type: "primary",
  12673. onClick: _cache[3] || (_cache[3] = ($event) => $setup.editBatchNum = false)
  12674. }, "修改")) : vue.createCommentVNode("v-if", true)
  12675. ]),
  12676. _: 1
  12677. /* STABLE */
  12678. }),
  12679. vue.createVNode(_component_uni_forms_item, {
  12680. label: "绑定托盘号",
  12681. name: "palletNum",
  12682. class: "select-item"
  12683. }, {
  12684. default: vue.withCtx(() => [
  12685. !$setup.editPalletNum ? (vue.openBlock(), vue.createBlock(_component_uni_data_picker, {
  12686. key: 0,
  12687. placeholder: "请选择托盘号",
  12688. "popup-title": "绑定托盘号",
  12689. localdata: $setup.options.pallet,
  12690. modelValue: $setup.valiFormData.palletNum,
  12691. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $setup.valiFormData.palletNum = $event),
  12692. onChange: $setup.onchange,
  12693. onNodeclick: $setup.onnodeclick,
  12694. onPopupopened: $setup.onpopupopened,
  12695. onPopupclosed: $setup.onpopupclosed
  12696. }, null, 8, ["localdata", "modelValue"])) : vue.createCommentVNode("v-if", true),
  12697. $setup.editPalletNum ? (vue.openBlock(), vue.createBlock(_component_uni_easyinput, {
  12698. key: 1,
  12699. value: $setup.palletNum,
  12700. disabled: $setup.editPalletNum
  12701. }, null, 8, ["value", "disabled"])) : vue.createCommentVNode("v-if", true),
  12702. !$setup.editPalletNum ? (vue.openBlock(), vue.createElementBlock("button", {
  12703. key: 2,
  12704. type: "primary",
  12705. onClick: $setup.submitPalletNum
  12706. }, "确认")) : vue.createCommentVNode("v-if", true),
  12707. $setup.editPalletNum ? (vue.openBlock(), vue.createElementBlock("button", {
  12708. key: 3,
  12709. type: "primary",
  12710. onClick: _cache[5] || (_cache[5] = ($event) => $setup.editPalletNum = false)
  12711. }, "修改")) : vue.createCommentVNode("v-if", true)
  12712. ]),
  12713. _: 1
  12714. /* STABLE */
  12715. }),
  12716. vue.createCommentVNode(" </uni-section> ")
  12717. ]),
  12718. _: 1
  12719. /* STABLE */
  12720. }, 8, ["rules", "modelValue"]),
  12721. vue.createElementVNode("view", { class: "button-group" }, [
  12722. vue.createElementVNode("button", {
  12723. type: "info",
  12724. onClick: $setup.reset
  12725. }, "重置"),
  12726. vue.createElementVNode("button", {
  12727. type: "default",
  12728. onClick: $setup.checkOrder,
  12729. loading: $setup.loading
  12730. }, [
  12731. !$setup.loading ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  12732. key: 0,
  12733. type: "search",
  12734. size: "18"
  12735. })) : vue.createCommentVNode("v-if", true),
  12736. vue.createTextVNode(" 查看运单 ")
  12737. ], 8, ["loading"]),
  12738. vue.createElementVNode("button", {
  12739. type: "primary",
  12740. onClick: $setup.onsubmit,
  12741. loading: $setup.loading
  12742. }, [
  12743. !$setup.loading ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  12744. key: 0,
  12745. type: "checkmarkempty",
  12746. size: "18",
  12747. color: "white"
  12748. })) : vue.createCommentVNode("v-if", true),
  12749. vue.createTextVNode(" 提交 ")
  12750. ], 8, ["loading"])
  12751. ]),
  12752. $setup.lotnoLogHistory.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  12753. key: 0,
  12754. class: "history"
  12755. }, [
  12756. vue.createElementVNode("text", { class: "title" }, "记录(最近5条)")
  12757. ])) : vue.createCommentVNode("v-if", true),
  12758. vue.createElementVNode("view", { class: "history" }, [
  12759. (vue.openBlock(true), vue.createElementBlock(
  12760. vue.Fragment,
  12761. null,
  12762. vue.renderList($setup.lotnoLogHistory.slice(0, 5), (item, i2) => {
  12763. return vue.openBlock(), vue.createElementBlock("view", {
  12764. class: "item",
  12765. key: i2
  12766. }, [
  12767. vue.createElementVNode(
  12768. "text",
  12769. { class: "type" },
  12770. vue.toDisplayString(item.type),
  12771. 1
  12772. /* TEXT */
  12773. ),
  12774. vue.createElementVNode(
  12775. "text",
  12776. {
  12777. class: "code",
  12778. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  12779. },
  12780. vue.toDisplayString(item.orderNum),
  12781. 5
  12782. /* TEXT, STYLE */
  12783. ),
  12784. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  12785. key: 0,
  12786. type: "checkmarkempty",
  12787. class: "status",
  12788. size: "16",
  12789. color: "green"
  12790. })) : (vue.openBlock(), vue.createElementBlock("text", {
  12791. key: 1,
  12792. class: "status fail"
  12793. }, "F")),
  12794. vue.createElementVNode(
  12795. "text",
  12796. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  12797. vue.toDisplayString("\r\n" + item.createTime),
  12798. 1
  12799. /* TEXT */
  12800. )
  12801. ]);
  12802. }),
  12803. 128
  12804. /* KEYED_FRAGMENT */
  12805. ))
  12806. ]),
  12807. vue.createVNode(
  12808. _component_uni_popup,
  12809. {
  12810. ref: "messageRef",
  12811. type: "message"
  12812. },
  12813. {
  12814. default: vue.withCtx(() => [
  12815. vue.createVNode(_component_uni_popup_message, {
  12816. type: $setup.messageType,
  12817. message: $setup.messageText,
  12818. duration: 2e3
  12819. }, null, 8, ["type", "message"])
  12820. ]),
  12821. _: 1
  12822. /* STABLE */
  12823. },
  12824. 512
  12825. /* NEED_PATCH */
  12826. )
  12827. ]);
  12828. }
  12829. const PagesScanLotnoIndex = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$e], ["__file", "E:/HBuilderProjects/YTAPP/pages/scanLotno/index.vue"]]);
  12830. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  12831. __name: "lotnoLog",
  12832. setup(__props, { expose: __expose }) {
  12833. __expose();
  12834. const lotnoLogHistory = vue.ref([]);
  12835. const getHistory = () => {
  12836. lotnoLogHistory.value = uni.getStorageSync("lotnoLogHistory");
  12837. };
  12838. onLoad(() => {
  12839. getHistory();
  12840. });
  12841. const __returned__ = { lotnoLogHistory, getHistory };
  12842. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  12843. return __returned__;
  12844. }
  12845. });
  12846. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  12847. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  12848. return vue.openBlock(), vue.createElementBlock("view", { class: "history" }, [
  12849. (vue.openBlock(true), vue.createElementBlock(
  12850. vue.Fragment,
  12851. null,
  12852. vue.renderList($setup.lotnoLogHistory, (item, i2) => {
  12853. return vue.openBlock(), vue.createElementBlock("view", {
  12854. class: "item",
  12855. key: i2
  12856. }, [
  12857. vue.createElementVNode(
  12858. "text",
  12859. { class: "type" },
  12860. vue.toDisplayString(item.type),
  12861. 1
  12862. /* TEXT */
  12863. ),
  12864. vue.createElementVNode(
  12865. "text",
  12866. {
  12867. class: "code",
  12868. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  12869. },
  12870. vue.toDisplayString(item.orderNum),
  12871. 5
  12872. /* TEXT, STYLE */
  12873. ),
  12874. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  12875. key: 0,
  12876. type: "checkmarkempty",
  12877. class: "status",
  12878. size: "16",
  12879. color: "green"
  12880. })) : (vue.openBlock(), vue.createElementBlock("text", {
  12881. key: 1,
  12882. class: "status fail"
  12883. }, "F")),
  12884. vue.createElementVNode(
  12885. "text",
  12886. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  12887. vue.toDisplayString("\r\n" + item.createTime),
  12888. 1
  12889. /* TEXT */
  12890. )
  12891. ]);
  12892. }),
  12893. 128
  12894. /* KEYED_FRAGMENT */
  12895. )),
  12896. $setup.lotnoLogHistory.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  12897. key: 0,
  12898. class: "is-empty"
  12899. }, "暂无历史")) : vue.createCommentVNode("v-if", true)
  12900. ]);
  12901. }
  12902. const PagesScanLotnoLotnoLog = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$d], ["__scopeId", "data-v-d86d23fe"], ["__file", "E:/HBuilderProjects/YTAPP/pages/scanLotno/lotnoLog.vue"]]);
  12903. const _sfc_main$d = {
  12904. name: "UniSection",
  12905. emits: ["click"],
  12906. props: {
  12907. type: {
  12908. type: String,
  12909. default: ""
  12910. },
  12911. title: {
  12912. type: String,
  12913. required: true,
  12914. default: ""
  12915. },
  12916. titleFontSize: {
  12917. type: String,
  12918. default: "14px"
  12919. },
  12920. titleColor: {
  12921. type: String,
  12922. default: "#333"
  12923. },
  12924. subTitle: {
  12925. type: String,
  12926. default: ""
  12927. },
  12928. subTitleFontSize: {
  12929. type: String,
  12930. default: "12px"
  12931. },
  12932. subTitleColor: {
  12933. type: String,
  12934. default: "#999"
  12935. },
  12936. padding: {
  12937. type: [Boolean, String],
  12938. default: false
  12939. }
  12940. },
  12941. computed: {
  12942. _padding() {
  12943. if (typeof this.padding === "string") {
  12944. return this.padding;
  12945. }
  12946. return this.padding ? "10px" : "";
  12947. }
  12948. },
  12949. watch: {
  12950. title(newVal) {
  12951. if (uni.report && newVal !== "") {
  12952. uni.report("title", newVal);
  12953. }
  12954. }
  12955. },
  12956. methods: {
  12957. onClick() {
  12958. this.$emit("click");
  12959. }
  12960. }
  12961. };
  12962. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  12963. return vue.openBlock(), vue.createElementBlock("view", { class: "uni-section" }, [
  12964. vue.createElementVNode("view", {
  12965. class: "uni-section-header",
  12966. onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
  12967. }, [
  12968. $props.type ? (vue.openBlock(), vue.createElementBlock(
  12969. "view",
  12970. {
  12971. key: 0,
  12972. class: vue.normalizeClass(["uni-section-header__decoration", $props.type])
  12973. },
  12974. null,
  12975. 2
  12976. /* CLASS */
  12977. )) : vue.renderSlot(_ctx.$slots, "decoration", { key: 1 }, void 0, true),
  12978. vue.createElementVNode("view", { class: "uni-section-header__content" }, [
  12979. vue.createElementVNode(
  12980. "text",
  12981. {
  12982. style: vue.normalizeStyle({ "font-size": $props.titleFontSize, "color": $props.titleColor }),
  12983. class: vue.normalizeClass(["uni-section__content-title", { "distraction": !$props.subTitle }])
  12984. },
  12985. vue.toDisplayString($props.title),
  12986. 7
  12987. /* TEXT, CLASS, STYLE */
  12988. ),
  12989. $props.subTitle ? (vue.openBlock(), vue.createElementBlock(
  12990. "text",
  12991. {
  12992. key: 0,
  12993. style: vue.normalizeStyle({ "font-size": $props.subTitleFontSize, "color": $props.subTitleColor }),
  12994. class: "uni-section-header__content-sub"
  12995. },
  12996. vue.toDisplayString($props.subTitle),
  12997. 5
  12998. /* TEXT, STYLE */
  12999. )) : vue.createCommentVNode("v-if", true)
  13000. ]),
  13001. vue.createElementVNode("view", { class: "uni-section-header__slot-right" }, [
  13002. vue.renderSlot(_ctx.$slots, "right", {}, void 0, true)
  13003. ])
  13004. ]),
  13005. vue.createElementVNode(
  13006. "view",
  13007. {
  13008. class: "uni-section-content",
  13009. style: vue.normalizeStyle({ padding: $options._padding })
  13010. },
  13011. [
  13012. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  13013. ],
  13014. 4
  13015. /* STYLE */
  13016. )
  13017. ]);
  13018. }
  13019. const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$c], ["__scopeId", "data-v-637fd36b"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-section/components/uni-section/uni-section.vue"]]);
  13020. const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
  13021. __name: "waybillsList",
  13022. setup(__props, { expose: __expose }) {
  13023. __expose();
  13024. const waybills = vue.ref([]);
  13025. const getHistory = () => {
  13026. waybills.value = uni.getStorageSync("waybills");
  13027. };
  13028. onLoad(() => {
  13029. getHistory();
  13030. });
  13031. const __returned__ = { waybills, getHistory };
  13032. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  13033. return __returned__;
  13034. }
  13035. });
  13036. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  13037. const _component_uni_section = resolveEasycom(vue.resolveDynamicComponent("uni-section"), __easycom_0$1);
  13038. return vue.openBlock(), vue.createElementBlock("view", { class: "history" }, [
  13039. vue.createVNode(_component_uni_section, {
  13040. title: "数量: " + $setup.waybills.length
  13041. }, null, 8, ["title"]),
  13042. (vue.openBlock(true), vue.createElementBlock(
  13043. vue.Fragment,
  13044. null,
  13045. vue.renderList($setup.waybills, (item, i2) => {
  13046. return vue.openBlock(), vue.createElementBlock("view", {
  13047. class: "item",
  13048. key: i2
  13049. }, [
  13050. vue.createElementVNode(
  13051. "text",
  13052. {
  13053. class: "code",
  13054. style: { color: "#666" }
  13055. },
  13056. vue.toDisplayString(item.order_box_no),
  13057. 1
  13058. /* TEXT */
  13059. ),
  13060. vue.createElementVNode(
  13061. "text",
  13062. { class: "type" },
  13063. "重量: " + vue.toDisplayString(item.weight) + "KG",
  13064. 1
  13065. /* TEXT */
  13066. ),
  13067. vue.createElementVNode("view", { class: "sub-items" }, [
  13068. vue.createElementVNode("view", { class: "sub-item" }, [
  13069. vue.createElementVNode("text", { class: "type" }, "批次/船航/托盘"),
  13070. vue.createElementVNode(
  13071. "text",
  13072. { class: "type" },
  13073. vue.toDisplayString(item.batch_shipping_pallet),
  13074. 1
  13075. /* TEXT */
  13076. )
  13077. ]),
  13078. vue.createElementVNode("view", { class: "sub-item" }, [
  13079. vue.createElementVNode("text", { class: "type" }, "末公里运单号"),
  13080. vue.createElementVNode(
  13081. "text",
  13082. { class: "type" },
  13083. vue.toDisplayString(item.tracking_number || "无"),
  13084. 1
  13085. /* TEXT */
  13086. )
  13087. ])
  13088. ])
  13089. ]);
  13090. }),
  13091. 128
  13092. /* KEYED_FRAGMENT */
  13093. )),
  13094. $setup.waybills.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  13095. key: 0,
  13096. class: "is-empty"
  13097. }, "暂无运单")) : vue.createCommentVNode("v-if", true)
  13098. ]);
  13099. }
  13100. const PagesScanLotnoWaybillsList = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$b], ["__scopeId", "data-v-ef3fda20"], ["__file", "E:/HBuilderProjects/YTAPP/pages/scanLotno/waybillsList.vue"]]);
  13101. const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
  13102. __name: "index",
  13103. setup(__props, { expose: __expose }) {
  13104. __expose();
  13105. const token = vue.ref();
  13106. const loading = vue.ref(false);
  13107. const hidePage = vue.ref(false);
  13108. const focusType = vue.ref(true);
  13109. const warehouseLogHistory = vue.ref([]);
  13110. const messageRef = vue.ref();
  13111. const messageType = vue.ref();
  13112. const messageText = vue.ref();
  13113. let st2;
  13114. const valiFormData = vue.ref({
  13115. order_code: ""
  13116. });
  13117. const rules = vue.reactive({
  13118. order_code: {
  13119. rules: [
  13120. {
  13121. required: true,
  13122. errorMessage: "单据编号不能为空"
  13123. }
  13124. ]
  13125. }
  13126. });
  13127. const checkPermission = async () => {
  13128. let status = permission.isIOS ? await permission.requestIOS("camera") : await permission.requestAndroid("android.permission.CAMERA");
  13129. if (status === null || status === 1) {
  13130. status = 1;
  13131. } else {
  13132. uni.showModal({
  13133. content: "Camera permission required",
  13134. confirmText: "Setting",
  13135. success: function(res) {
  13136. if (res.confirm) {
  13137. permission.gotoAppSetting();
  13138. }
  13139. }
  13140. });
  13141. }
  13142. return status;
  13143. };
  13144. const scanInput = async () => {
  13145. let status = await checkPermission();
  13146. if (status !== 1) {
  13147. return;
  13148. }
  13149. uni.scanCode({
  13150. success: (res) => {
  13151. valiFormData.value.order_code = res.result;
  13152. onsubmit();
  13153. },
  13154. fail: (err) => {
  13155. }
  13156. });
  13157. };
  13158. const reset = () => {
  13159. loading.value = false;
  13160. valiFormData.value.order_code = "";
  13161. };
  13162. const setfocus = () => {
  13163. if (hidePage.value) {
  13164. return;
  13165. }
  13166. focusType.value = false;
  13167. vue.nextTick(() => {
  13168. focusType.value = true;
  13169. });
  13170. };
  13171. const onsubmit = () => {
  13172. st2 && clearTimeout(st2);
  13173. loading.value = true;
  13174. uni.request({
  13175. url: warehouseScanURL,
  13176. method: "POST",
  13177. header: {
  13178. batoken: token.value
  13179. },
  13180. data: {
  13181. order_code: valiFormData.value.order_code
  13182. },
  13183. success: (res) => {
  13184. loading.value = false;
  13185. if (res.data.code == 1) {
  13186. messageType.value = "success";
  13187. messageText.value = res.data.msg;
  13188. messageRef.value.open();
  13189. const historyItem = {
  13190. order_code: valiFormData.value.order_code,
  13191. createTime: /* @__PURE__ */ new Date(),
  13192. type: "单据扫描",
  13193. status: true
  13194. };
  13195. warehouseLogHistory.value.unshift(historyItem);
  13196. uni.setStorageSync("warehouseLogHistory", warehouseLogHistory.value);
  13197. getHistory();
  13198. } else {
  13199. messageType.value = "error";
  13200. messageText.value = res.data.msg;
  13201. messageRef.value.open();
  13202. const historyItem = {
  13203. order_code: valiFormData.value.order_code,
  13204. createTime: /* @__PURE__ */ new Date(),
  13205. type: "单据扫描",
  13206. status: false
  13207. };
  13208. warehouseLogHistory.value.unshift(historyItem);
  13209. uni.setStorageSync("warehouseLogHistory", warehouseLogHistory.value);
  13210. getHistory();
  13211. }
  13212. st2 = setTimeout(() => {
  13213. reset();
  13214. st2 && clearTimeout(st2);
  13215. }, 1e3);
  13216. }
  13217. });
  13218. };
  13219. const getHistory = () => {
  13220. warehouseLogHistory.value = uni.getStorageSync("warehouseLogHistory") || [];
  13221. };
  13222. const keypress = (e2) => {
  13223. formatAppLog("log", "at pages/warehouseScan/index.vue:179", e2, "按键码");
  13224. if (e2.keyCode === 102 || e2.keyCode === 103 || e2.keyCode === 104)
  13225. ;
  13226. if (e2.keyCode == 66) {
  13227. onsubmit();
  13228. }
  13229. };
  13230. onLoad(() => {
  13231. plus.key.addEventListener("keyup", keypress);
  13232. });
  13233. onUnload(() => {
  13234. plus.key.removeEventListener("keyup", keypress);
  13235. });
  13236. onHide(() => {
  13237. hidePage.value = true;
  13238. plus.key.removeEventListener("keyup", keypress);
  13239. });
  13240. onBackPress(() => {
  13241. plus.key.removeEventListener("keyup", keypress);
  13242. });
  13243. onShow(() => {
  13244. token.value = uni.getStorageSync("token");
  13245. hidePage.value = false;
  13246. getHistory();
  13247. });
  13248. onNavigationBarButtonTap((event) => {
  13249. if (event.index === 0) {
  13250. uni.navigateTo({
  13251. url: "/pages/warehouseScan/warehouseLog"
  13252. });
  13253. }
  13254. });
  13255. const __returned__ = { token, loading, hidePage, focusType, warehouseLogHistory, messageRef, messageType, messageText, get st() {
  13256. return st2;
  13257. }, set st(v2) {
  13258. st2 = v2;
  13259. }, valiFormData, rules, checkPermission, scanInput, reset, setfocus, onsubmit, getHistory, keypress };
  13260. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  13261. return __returned__;
  13262. }
  13263. });
  13264. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  13265. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  13266. const _component_uni_forms_item = resolveEasycom(vue.resolveDynamicComponent("uni-forms-item"), __easycom_2$1);
  13267. const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_3$2);
  13268. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  13269. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_5);
  13270. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  13271. return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [
  13272. vue.createVNode(_component_uni_forms, {
  13273. ref: "valiForm",
  13274. "label-align": "right",
  13275. "label-width": 80,
  13276. rules: $setup.rules,
  13277. modelValue: $setup.valiFormData
  13278. }, {
  13279. default: vue.withCtx(() => [
  13280. vue.createVNode(_component_uni_forms_item, {
  13281. label: "单据编号",
  13282. required: "",
  13283. name: "order_code"
  13284. }, {
  13285. default: vue.withCtx(() => [
  13286. vue.createVNode(_component_uni_easyinput, {
  13287. modelValue: $setup.valiFormData.order_code,
  13288. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.valiFormData.order_code = $event),
  13289. placeholder: "请输入单据编号",
  13290. suffixIcon: "scan",
  13291. focus: $setup.focusType,
  13292. onIconClick: $setup.scanInput,
  13293. onBlur: $setup.setfocus,
  13294. onConfirm: $setup.onsubmit
  13295. }, null, 8, ["modelValue", "focus"])
  13296. ]),
  13297. _: 1
  13298. /* STABLE */
  13299. })
  13300. ]),
  13301. _: 1
  13302. /* STABLE */
  13303. }, 8, ["rules", "modelValue"]),
  13304. vue.createElementVNode("view", { class: "button-group" }, [
  13305. vue.createElementVNode("button", {
  13306. type: "info",
  13307. onClick: $setup.reset
  13308. }, "重置"),
  13309. vue.createElementVNode("button", {
  13310. type: "primary",
  13311. onClick: $setup.onsubmit,
  13312. loading: $setup.loading
  13313. }, [
  13314. !$setup.loading ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  13315. key: 0,
  13316. type: "checkmarkempty",
  13317. size: "18",
  13318. color: "white"
  13319. })) : vue.createCommentVNode("v-if", true),
  13320. vue.createTextVNode(" 提交 ")
  13321. ], 8, ["loading"])
  13322. ]),
  13323. $setup.warehouseLogHistory.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  13324. key: 0,
  13325. class: "history"
  13326. }, [
  13327. vue.createElementVNode("text", { class: "title" }, "记录(最近5条)")
  13328. ])) : vue.createCommentVNode("v-if", true),
  13329. vue.createElementVNode("view", { class: "history" }, [
  13330. (vue.openBlock(true), vue.createElementBlock(
  13331. vue.Fragment,
  13332. null,
  13333. vue.renderList($setup.warehouseLogHistory.slice(0, 5), (item, i2) => {
  13334. return vue.openBlock(), vue.createElementBlock("view", {
  13335. class: "item",
  13336. key: i2
  13337. }, [
  13338. vue.createElementVNode(
  13339. "text",
  13340. {
  13341. class: "code",
  13342. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  13343. },
  13344. vue.toDisplayString(item.order_code),
  13345. 5
  13346. /* TEXT, STYLE */
  13347. ),
  13348. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  13349. key: 0,
  13350. type: "checkmarkempty",
  13351. class: "status",
  13352. size: "16",
  13353. color: "green"
  13354. })) : (vue.openBlock(), vue.createElementBlock("text", {
  13355. key: 1,
  13356. class: "status fail"
  13357. }, "F")),
  13358. vue.createElementVNode(
  13359. "text",
  13360. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  13361. vue.toDisplayString("\r\n" + item.createTime),
  13362. 1
  13363. /* TEXT */
  13364. )
  13365. ]);
  13366. }),
  13367. 128
  13368. /* KEYED_FRAGMENT */
  13369. ))
  13370. ]),
  13371. vue.createVNode(
  13372. _component_uni_popup,
  13373. {
  13374. ref: "messageRef",
  13375. type: "message"
  13376. },
  13377. {
  13378. default: vue.withCtx(() => [
  13379. vue.createVNode(_component_uni_popup_message, {
  13380. type: $setup.messageType,
  13381. message: $setup.messageText,
  13382. duration: 2e3
  13383. }, null, 8, ["type", "message"])
  13384. ]),
  13385. _: 1
  13386. /* STABLE */
  13387. },
  13388. 512
  13389. /* NEED_PATCH */
  13390. )
  13391. ]);
  13392. }
  13393. const PagesWarehouseScanIndex = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$a], ["__scopeId", "data-v-c64ca80c"], ["__file", "E:/HBuilderProjects/YTAPP/pages/warehouseScan/index.vue"]]);
  13394. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  13395. __name: "warehouseLog",
  13396. setup(__props, { expose: __expose }) {
  13397. __expose();
  13398. const warehouseLogHistory = vue.ref([]);
  13399. const getHistory = () => {
  13400. warehouseLogHistory.value = uni.getStorageSync("warehouseLogHistory");
  13401. };
  13402. onLoad(() => {
  13403. getHistory();
  13404. });
  13405. const __returned__ = { warehouseLogHistory, getHistory };
  13406. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  13407. return __returned__;
  13408. }
  13409. });
  13410. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  13411. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  13412. return vue.openBlock(), vue.createElementBlock("view", { class: "history" }, [
  13413. (vue.openBlock(true), vue.createElementBlock(
  13414. vue.Fragment,
  13415. null,
  13416. vue.renderList($setup.warehouseLogHistory, (item, i2) => {
  13417. return vue.openBlock(), vue.createElementBlock("view", {
  13418. class: "item",
  13419. key: i2
  13420. }, [
  13421. vue.createElementVNode(
  13422. "text",
  13423. { class: "type" },
  13424. vue.toDisplayString(item.type),
  13425. 1
  13426. /* TEXT */
  13427. ),
  13428. vue.createElementVNode(
  13429. "text",
  13430. {
  13431. class: "code",
  13432. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  13433. },
  13434. vue.toDisplayString(item.order_code),
  13435. 5
  13436. /* TEXT, STYLE */
  13437. ),
  13438. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  13439. key: 0,
  13440. type: "checkmarkempty",
  13441. class: "status",
  13442. size: "16",
  13443. color: "green"
  13444. })) : (vue.openBlock(), vue.createElementBlock("text", {
  13445. key: 1,
  13446. class: "status fail"
  13447. }, "F")),
  13448. vue.createElementVNode(
  13449. "text",
  13450. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  13451. vue.toDisplayString("\r\n" + item.createTime),
  13452. 1
  13453. /* TEXT */
  13454. )
  13455. ]);
  13456. }),
  13457. 128
  13458. /* KEYED_FRAGMENT */
  13459. )),
  13460. $setup.warehouseLogHistory.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  13461. key: 0,
  13462. class: "is-empty"
  13463. }, "暂无历史")) : vue.createCommentVNode("v-if", true)
  13464. ]);
  13465. }
  13466. const PagesWarehouseScanWarehouseLog = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$9], ["__scopeId", "data-v-dadaa086"], ["__file", "E:/HBuilderProjects/YTAPP/pages/warehouseScan/warehouseLog.vue"]]);
  13467. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  13468. __name: "index",
  13469. setup(__props, { expose: __expose }) {
  13470. __expose();
  13471. const token = vue.ref();
  13472. const editSpaceNo = vue.ref(false);
  13473. const loading = vue.ref(false);
  13474. const hidePage = vue.ref(false);
  13475. const focusType = vue.ref(true);
  13476. const waybillNoHistory = vue.ref([]);
  13477. const messageRef = vue.ref();
  13478. const messageType = vue.ref();
  13479. const messageText = vue.ref();
  13480. let st2;
  13481. const valiFormData = vue.ref({
  13482. code: "",
  13483. space_id: ""
  13484. });
  13485. const rules = vue.reactive({
  13486. code: {
  13487. rules: [
  13488. {
  13489. required: true,
  13490. errorMessage: "单号不能为空"
  13491. }
  13492. ]
  13493. }
  13494. });
  13495. const options = vue.reactive({
  13496. space: []
  13497. });
  13498. const checkPermission = async () => {
  13499. let status = permission.isIOS ? await permission.requestIOS("camera") : await permission.requestAndroid("android.permission.CAMERA");
  13500. if (status === null || status === 1) {
  13501. status = 1;
  13502. } else {
  13503. uni.showModal({
  13504. content: "Camera permission required",
  13505. confirmText: "Setting",
  13506. success: function(res) {
  13507. if (res.confirm) {
  13508. permission.gotoAppSetting();
  13509. }
  13510. }
  13511. });
  13512. }
  13513. return status;
  13514. };
  13515. const scanInput = async () => {
  13516. let status = await checkPermission();
  13517. if (status !== 1) {
  13518. return;
  13519. }
  13520. uni.scanCode({
  13521. success: (res) => {
  13522. valiFormData.value.code = res.result;
  13523. },
  13524. fail: (err) => {
  13525. }
  13526. });
  13527. };
  13528. const reset = () => {
  13529. loading.value = false;
  13530. valiFormData.value.code = "";
  13531. };
  13532. const submitSpace = () => {
  13533. if (valiFormData.value.space_id) {
  13534. editSpaceNo.value = true;
  13535. setFocus();
  13536. } else {
  13537. messageType.value = "error";
  13538. messageText.value = "请选择库位";
  13539. messageRef.value.open();
  13540. }
  13541. };
  13542. const space = vue.computed(() => {
  13543. const res = options.space.find((item) => item.value === valiFormData.value.space_id);
  13544. return res == null ? void 0 : res.text;
  13545. });
  13546. const findPalletNumIdByValue = (data, targetValue) => {
  13547. for (let i2 = 0; i2 < data.length; i2++) {
  13548. const item = data[i2];
  13549. if (item.id === targetValue || item.value === targetValue) {
  13550. return [item.id];
  13551. } else if (item.children && item.children.length > 0) {
  13552. const childId = findPalletNumIdByValue(item.children, targetValue);
  13553. if (childId !== null) {
  13554. return childId;
  13555. }
  13556. }
  13557. }
  13558. return null;
  13559. };
  13560. const onsubmit = () => {
  13561. if (valiFormData.value.space_id && valiFormData.value.code) {
  13562. st2 && clearTimeout(st2);
  13563. loading.value = true;
  13564. uni.request({
  13565. url: addWaybillNoURL,
  13566. method: "POST",
  13567. header: {
  13568. batoken: token.value
  13569. },
  13570. data: {
  13571. code: valiFormData.value.code,
  13572. space_id: valiFormData.value.space_id
  13573. },
  13574. success: (res) => {
  13575. loading.value = false;
  13576. const space2 = options.space.find((item) => item.value === valiFormData.value.space_id);
  13577. if (res.data.code == 1) {
  13578. messageType.value = "success";
  13579. messageText.value = res.data.msg;
  13580. messageRef.value.open();
  13581. const historyItem = {
  13582. code: valiFormData.value.code,
  13583. createTime: /* @__PURE__ */ new Date(),
  13584. type: "运单号",
  13585. space: space2.text,
  13586. status: true
  13587. };
  13588. waybillNoHistory.value.unshift(historyItem);
  13589. uni.setStorageSync("waybillNoHistory", waybillNoHistory.value);
  13590. getHistory();
  13591. } else {
  13592. messageType.value = "error";
  13593. messageText.value = res.data.msg;
  13594. messageRef.value.open();
  13595. const historyItem = {
  13596. code: valiFormData.value.code,
  13597. createTime: /* @__PURE__ */ new Date(),
  13598. type: "运单号",
  13599. space: space2.text,
  13600. status: false
  13601. };
  13602. waybillNoHistory.value.unshift(historyItem);
  13603. uni.setStorageSync("waybillNoHistory", waybillNoHistory.value);
  13604. getHistory();
  13605. }
  13606. st2 = setTimeout(() => {
  13607. reset();
  13608. setFocus();
  13609. st2 && clearTimeout(st2);
  13610. }, 1e3);
  13611. }
  13612. });
  13613. } else {
  13614. if (!valiFormData.value.space_id) {
  13615. messageType.value = "error";
  13616. messageText.value = "请选择库位";
  13617. messageRef.value.open();
  13618. }
  13619. if (!valiFormData.value.code) {
  13620. messageType.value = "error";
  13621. messageText.value = "请填写运单号";
  13622. messageRef.value.open();
  13623. }
  13624. }
  13625. };
  13626. const getHistory = () => {
  13627. waybillNoHistory.value = uni.getStorageSync("waybillNoHistory") || [];
  13628. };
  13629. const keypress = (e2) => {
  13630. formatAppLog("log", "at pages/waybillNo/index.vue:240", e2, "按键码");
  13631. if (e2.keyCode === 102 || e2.keyCode === 103 || e2.keyCode === 104)
  13632. ;
  13633. if (e2.keyCode == 66) {
  13634. onsubmit();
  13635. }
  13636. };
  13637. onLoad(() => {
  13638. plus.key.addEventListener("keyup", keypress);
  13639. });
  13640. onUnload(() => {
  13641. plus.key.removeEventListener("keyup", keypress);
  13642. });
  13643. onHide(() => {
  13644. hidePage.value = true;
  13645. plus.key.removeEventListener("keyup", keypress);
  13646. });
  13647. onBackPress(() => {
  13648. plus.key.removeEventListener("keyup", keypress);
  13649. });
  13650. onShow(() => {
  13651. hidePage.value = false;
  13652. token.value = uni.getStorageSync("token");
  13653. getOptions();
  13654. getHistory();
  13655. });
  13656. const getOptions = () => {
  13657. uni.request({
  13658. url: waybillNoOptions,
  13659. method: "GET",
  13660. header: {
  13661. batoken: token.value
  13662. },
  13663. success: (res) => {
  13664. formatAppLog("log", "at pages/waybillNo/index.vue:300", res);
  13665. if (res.data.code === 1) {
  13666. for (let key in res.data.data.space_id) {
  13667. if (res.data.data.space_id.hasOwnProperty(key)) {
  13668. options.space.push({ text: res.data.data.space_id[key], value: key });
  13669. }
  13670. }
  13671. }
  13672. },
  13673. fail(e2) {
  13674. formatAppLog("log", "at pages/waybillNo/index.vue:310", "fail--", e2);
  13675. }
  13676. });
  13677. };
  13678. const setFocus = () => {
  13679. if (hidePage.value) {
  13680. return;
  13681. }
  13682. focusType.value = false;
  13683. vue.nextTick(() => {
  13684. focusType.value = true;
  13685. });
  13686. };
  13687. onNavigationBarButtonTap((event) => {
  13688. if (event.index === 0) {
  13689. uni.navigateTo({
  13690. url: "/pages/waybillNo/waybillNoLog"
  13691. });
  13692. }
  13693. });
  13694. const __returned__ = { token, editSpaceNo, loading, hidePage, focusType, waybillNoHistory, messageRef, messageType, messageText, get st() {
  13695. return st2;
  13696. }, set st(v2) {
  13697. st2 = v2;
  13698. }, valiFormData, rules, options, checkPermission, scanInput, reset, submitSpace, space, findPalletNumIdByValue, onsubmit, getHistory, keypress, getOptions, setFocus };
  13699. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  13700. return __returned__;
  13701. }
  13702. });
  13703. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  13704. const _component_uni_data_select = resolveEasycom(vue.resolveDynamicComponent("uni-data-select"), __easycom_0$6);
  13705. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  13706. const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_3$2);
  13707. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  13708. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_5);
  13709. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  13710. return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [
  13711. vue.createVNode(_component_uni_forms, {
  13712. ref: "valiForm",
  13713. "label-align": "right",
  13714. "label-width": 80,
  13715. rules: $setup.rules,
  13716. modelValue: $setup.valiFormData
  13717. }, {
  13718. default: vue.withCtx(() => [
  13719. vue.createElementVNode("view", { class: "space-select" }, [
  13720. !$setup.editSpaceNo ? (vue.openBlock(), vue.createBlock(_component_uni_data_select, {
  13721. key: 0,
  13722. modelValue: $setup.valiFormData.space_id,
  13723. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.valiFormData.space_id = $event),
  13724. placeholder: "请选择库位",
  13725. localdata: $setup.options.space,
  13726. clear: false
  13727. }, null, 8, ["modelValue", "localdata"])) : vue.createCommentVNode("v-if", true),
  13728. $setup.editSpaceNo ? (vue.openBlock(), vue.createBlock(_component_uni_easyinput, {
  13729. key: 1,
  13730. value: $setup.space,
  13731. disabled: $setup.editSpaceNo
  13732. }, null, 8, ["value", "disabled"])) : vue.createCommentVNode("v-if", true),
  13733. !$setup.editSpaceNo ? (vue.openBlock(), vue.createElementBlock("button", {
  13734. key: 2,
  13735. type: "primary",
  13736. onClick: $setup.submitSpace
  13737. }, "确认")) : vue.createCommentVNode("v-if", true),
  13738. $setup.editSpaceNo ? (vue.openBlock(), vue.createElementBlock("button", {
  13739. key: 3,
  13740. type: "primary",
  13741. onClick: _cache[1] || (_cache[1] = ($event) => $setup.editSpaceNo = false)
  13742. }, "修改")) : vue.createCommentVNode("v-if", true)
  13743. ]),
  13744. vue.createElementVNode("view", null, [
  13745. vue.createVNode(_component_uni_easyinput, {
  13746. modelValue: $setup.valiFormData.code,
  13747. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $setup.valiFormData.code = $event),
  13748. placeholder: "请输入运单号",
  13749. suffixIcon: "scan",
  13750. focus: $setup.focusType,
  13751. onIconClick: $setup.scanInput
  13752. }, null, 8, ["modelValue", "focus"])
  13753. ])
  13754. ]),
  13755. _: 1
  13756. /* STABLE */
  13757. }, 8, ["rules", "modelValue"]),
  13758. vue.createElementVNode("view", { class: "button-group" }, [
  13759. vue.createElementVNode("button", {
  13760. type: "info",
  13761. onClick: $setup.reset
  13762. }, "重置"),
  13763. vue.createElementVNode("button", {
  13764. type: "primary",
  13765. onClick: $setup.onsubmit,
  13766. loading: $setup.loading
  13767. }, [
  13768. !$setup.loading ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  13769. key: 0,
  13770. type: "checkmarkempty",
  13771. size: "18",
  13772. color: "white"
  13773. })) : vue.createCommentVNode("v-if", true),
  13774. vue.createTextVNode(" 提交 ")
  13775. ], 8, ["loading"])
  13776. ]),
  13777. $setup.waybillNoHistory.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  13778. key: 0,
  13779. class: "history"
  13780. }, [
  13781. vue.createElementVNode("text", { class: "title" }, "记录(最近5条)")
  13782. ])) : vue.createCommentVNode("v-if", true),
  13783. vue.createElementVNode("view", { class: "history" }, [
  13784. (vue.openBlock(true), vue.createElementBlock(
  13785. vue.Fragment,
  13786. null,
  13787. vue.renderList($setup.waybillNoHistory.slice(0, 5), (item, i2) => {
  13788. return vue.openBlock(), vue.createElementBlock("view", {
  13789. class: "item",
  13790. key: i2
  13791. }, [
  13792. vue.createElementVNode("view", null, [
  13793. vue.createElementVNode("view", null, [
  13794. vue.createElementVNode("text", { class: "type" }, "库位"),
  13795. vue.createElementVNode(
  13796. "text",
  13797. {
  13798. class: "code",
  13799. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  13800. },
  13801. vue.toDisplayString(item.space),
  13802. 5
  13803. /* TEXT, STYLE */
  13804. )
  13805. ]),
  13806. vue.createElementVNode("view", null, [
  13807. vue.createElementVNode("text", { class: "type" }, "单号"),
  13808. vue.createElementVNode(
  13809. "text",
  13810. {
  13811. class: "code",
  13812. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  13813. },
  13814. vue.toDisplayString(item.code),
  13815. 5
  13816. /* TEXT, STYLE */
  13817. )
  13818. ]),
  13819. vue.createElementVNode("view", { class: "space-time" }, [
  13820. vue.createElementVNode(
  13821. "text",
  13822. null,
  13823. vue.toDisplayString(item.createTime),
  13824. 1
  13825. /* TEXT */
  13826. )
  13827. ])
  13828. ]),
  13829. vue.createElementVNode("view", null, [
  13830. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  13831. key: 0,
  13832. type: "checkmarkempty",
  13833. class: "status",
  13834. size: "16",
  13835. color: "green"
  13836. })) : (vue.openBlock(), vue.createElementBlock("text", {
  13837. key: 1,
  13838. class: "status fail"
  13839. }, "F"))
  13840. ])
  13841. ]);
  13842. }),
  13843. 128
  13844. /* KEYED_FRAGMENT */
  13845. ))
  13846. ]),
  13847. vue.createVNode(
  13848. _component_uni_popup,
  13849. {
  13850. ref: "messageRef",
  13851. type: "message"
  13852. },
  13853. {
  13854. default: vue.withCtx(() => [
  13855. vue.createVNode(_component_uni_popup_message, {
  13856. type: $setup.messageType,
  13857. message: $setup.messageText,
  13858. duration: 2e3
  13859. }, null, 8, ["type", "message"])
  13860. ]),
  13861. _: 1
  13862. /* STABLE */
  13863. },
  13864. 512
  13865. /* NEED_PATCH */
  13866. )
  13867. ]);
  13868. }
  13869. const PagesWaybillNoIndex = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$8], ["__file", "E:/HBuilderProjects/YTAPP/pages/waybillNo/index.vue"]]);
  13870. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  13871. __name: "waybillNoLog",
  13872. setup(__props, { expose: __expose }) {
  13873. __expose();
  13874. const waybillNoHistory = vue.ref([]);
  13875. const getHistory = async () => {
  13876. waybillNoHistory.value = await uni.getStorageSync("waybillNoHistory");
  13877. };
  13878. onLoad(async () => {
  13879. await getHistory();
  13880. });
  13881. const __returned__ = { waybillNoHistory, getHistory };
  13882. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  13883. return __returned__;
  13884. }
  13885. });
  13886. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  13887. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  13888. return vue.openBlock(), vue.createElementBlock("view", { class: "history" }, [
  13889. (vue.openBlock(true), vue.createElementBlock(
  13890. vue.Fragment,
  13891. null,
  13892. vue.renderList($setup.waybillNoHistory, (item, i2) => {
  13893. return vue.openBlock(), vue.createElementBlock("view", {
  13894. class: "item",
  13895. key: i2
  13896. }, [
  13897. vue.createElementVNode("view", null, [
  13898. vue.createElementVNode("view", null, [
  13899. vue.createElementVNode("text", { class: "type" }, "库位"),
  13900. vue.createElementVNode(
  13901. "text",
  13902. {
  13903. class: "code",
  13904. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  13905. },
  13906. vue.toDisplayString(item.space),
  13907. 5
  13908. /* TEXT, STYLE */
  13909. )
  13910. ]),
  13911. vue.createElementVNode("view", null, [
  13912. vue.createElementVNode("text", { class: "type" }, "单号"),
  13913. vue.createElementVNode(
  13914. "text",
  13915. {
  13916. class: "code",
  13917. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  13918. },
  13919. vue.toDisplayString(item.code),
  13920. 5
  13921. /* TEXT, STYLE */
  13922. )
  13923. ]),
  13924. vue.createElementVNode("view", { class: "space-time" }, [
  13925. vue.createElementVNode(
  13926. "text",
  13927. null,
  13928. vue.toDisplayString(item.createTime),
  13929. 1
  13930. /* TEXT */
  13931. )
  13932. ])
  13933. ]),
  13934. vue.createElementVNode("view", null, [
  13935. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  13936. key: 0,
  13937. type: "checkmarkempty",
  13938. class: "status",
  13939. size: "16",
  13940. color: "green"
  13941. })) : (vue.openBlock(), vue.createElementBlock("text", {
  13942. key: 1,
  13943. class: "status fail"
  13944. }, "F"))
  13945. ])
  13946. ]);
  13947. }),
  13948. 128
  13949. /* KEYED_FRAGMENT */
  13950. )),
  13951. $setup.waybillNoHistory.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  13952. key: 0,
  13953. class: "is-empty"
  13954. }, "暂无历史")) : vue.createCommentVNode("v-if", true)
  13955. ]);
  13956. }
  13957. const PagesWaybillNoWaybillNoLog = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7], ["__scopeId", "data-v-2f55e896"], ["__file", "E:/HBuilderProjects/YTAPP/pages/waybillNo/waybillNoLog.vue"]]);
  13958. const _sfc_main$7 = {
  13959. name: "UniDrawer",
  13960. components: {},
  13961. emits: ["change"],
  13962. props: {
  13963. /**
  13964. * 显示模式(左、右),只在初始化生效
  13965. */
  13966. mode: {
  13967. type: String,
  13968. default: ""
  13969. },
  13970. /**
  13971. * 蒙层显示状态
  13972. */
  13973. mask: {
  13974. type: Boolean,
  13975. default: true
  13976. },
  13977. /**
  13978. * 遮罩是否可点击关闭
  13979. */
  13980. maskClick: {
  13981. type: Boolean,
  13982. default: true
  13983. },
  13984. /**
  13985. * 抽屉宽度
  13986. */
  13987. width: {
  13988. type: Number,
  13989. default: 220
  13990. }
  13991. },
  13992. data() {
  13993. return {
  13994. visibleSync: false,
  13995. showDrawer: false,
  13996. rightMode: false,
  13997. watchTimer: null,
  13998. drawerWidth: 220
  13999. };
  14000. },
  14001. created() {
  14002. this.drawerWidth = this.width;
  14003. this.rightMode = this.mode === "right";
  14004. },
  14005. methods: {
  14006. clear() {
  14007. },
  14008. close(type) {
  14009. if (type === "mask" && !this.maskClick || !this.visibleSync)
  14010. return;
  14011. this._change("showDrawer", "visibleSync", false);
  14012. },
  14013. open() {
  14014. if (this.visibleSync)
  14015. return;
  14016. this._change("visibleSync", "showDrawer", true);
  14017. },
  14018. _change(param1, param2, status) {
  14019. this[param1] = status;
  14020. if (this.watchTimer) {
  14021. clearTimeout(this.watchTimer);
  14022. }
  14023. this.watchTimer = setTimeout(() => {
  14024. this[param2] = status;
  14025. this.$emit("change", status);
  14026. }, status ? 50 : 300);
  14027. }
  14028. }
  14029. };
  14030. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  14031. return $data.visibleSync ? (vue.openBlock(), vue.createElementBlock(
  14032. "view",
  14033. {
  14034. key: 0,
  14035. class: vue.normalizeClass([{ "uni-drawer--visible": $data.showDrawer }, "uni-drawer"]),
  14036. onTouchmove: _cache[1] || (_cache[1] = vue.withModifiers((...args) => $options.clear && $options.clear(...args), ["stop", "prevent"]))
  14037. },
  14038. [
  14039. vue.createElementVNode(
  14040. "view",
  14041. {
  14042. class: vue.normalizeClass(["uni-drawer__mask", { "uni-drawer__mask--visible": $data.showDrawer && $props.mask }]),
  14043. onClick: _cache[0] || (_cache[0] = ($event) => $options.close("mask"))
  14044. },
  14045. null,
  14046. 2
  14047. /* CLASS */
  14048. ),
  14049. vue.createElementVNode(
  14050. "view",
  14051. {
  14052. class: vue.normalizeClass(["uni-drawer__content", { "uni-drawer--right": $data.rightMode, "uni-drawer--left": !$data.rightMode, "uni-drawer__content--visible": $data.showDrawer }]),
  14053. style: vue.normalizeStyle({ width: $data.drawerWidth + "px" })
  14054. },
  14055. [
  14056. vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
  14057. ],
  14058. 6
  14059. /* CLASS, STYLE */
  14060. )
  14061. ],
  14062. 34
  14063. /* CLASS, NEED_HYDRATION */
  14064. )) : vue.createCommentVNode("v-if", true);
  14065. }
  14066. const __easycom_3 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6], ["__scopeId", "data-v-f7c32d22"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue"]]);
  14067. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  14068. __name: "index",
  14069. setup(__props, { expose: __expose }) {
  14070. __expose();
  14071. const loading = vue.ref(false);
  14072. const loadingBtn = vue.ref(false);
  14073. const token = vue.ref();
  14074. const searchValue = vue.ref();
  14075. const waybillDelivery = vue.ref([]);
  14076. const messageType = vue.ref();
  14077. const messageText = vue.ref();
  14078. const messageRef = vue.ref();
  14079. const showRightRef = vue.ref();
  14080. const resetForm = () => {
  14081. };
  14082. const confirmForm = () => {
  14083. showRightRef.value.close();
  14084. };
  14085. const copyOrderNo = (order_no) => {
  14086. uni.setClipboardData({
  14087. data: order_no,
  14088. success: function() {
  14089. uni.showToast({
  14090. title: "复制成功",
  14091. icon: "success",
  14092. duration: 2e3
  14093. });
  14094. },
  14095. fail: function() {
  14096. formatAppLog("log", "at pages/waybillDeliveryOrder/index.vue:85", "复制失败");
  14097. }
  14098. });
  14099. };
  14100. const callPhone = (phoneNumber) => {
  14101. formatAppLog("log", "at pages/waybillDeliveryOrder/index.vue:91", phoneNumber);
  14102. uni.makePhoneCall({
  14103. phoneNumber,
  14104. success: function() {
  14105. formatAppLog("log", "at pages/waybillDeliveryOrder/index.vue:96", "拨打电话成功!");
  14106. },
  14107. fail: function() {
  14108. formatAppLog("log", "at pages/waybillDeliveryOrder/index.vue:99", "拨打电话失败!");
  14109. }
  14110. });
  14111. };
  14112. const checkPermission = async () => {
  14113. let status = permission.isIOS ? await permission.requestIOS("camera") : await permission.requestAndroid("android.permission.CAMERA");
  14114. if (status === null || status === 1) {
  14115. status = 1;
  14116. } else {
  14117. uni.showModal({
  14118. content: "Camera permission required",
  14119. confirmText: "Setting",
  14120. success: function(res) {
  14121. if (res.confirm) {
  14122. permission.gotoAppSetting();
  14123. }
  14124. }
  14125. });
  14126. }
  14127. return status;
  14128. };
  14129. const scanInput = async () => {
  14130. let status = await checkPermission();
  14131. if (status !== 1) {
  14132. return;
  14133. }
  14134. uni.scanCode({
  14135. success: (res) => {
  14136. },
  14137. fail: (err) => {
  14138. }
  14139. });
  14140. };
  14141. const itemClick = (item) => {
  14142. uni.setStorageSync("selectItem", item);
  14143. uni.navigateTo({
  14144. url: "/pages/waybillDeliveryOrder/orderInfo?id=" + item.id
  14145. });
  14146. };
  14147. const onButtonClick = async (row, value) => {
  14148. if (value === "send_out") {
  14149. sendOut({ id: row.id });
  14150. } else if (value === "delivered") {
  14151. updateDelivered({ id: row.id });
  14152. } else if (value === "refuse") {
  14153. updateRefuse({ id: row.id });
  14154. } else if (value === "create_track_pod") {
  14155. createTrackPod({ id: row.id });
  14156. } else if (value === "edit")
  14157. ;
  14158. else if (value === "generate_label")
  14159. ;
  14160. else if (value === "fedex_appointment_pick_up")
  14161. ;
  14162. else if (value === "print_get_back_label")
  14163. ;
  14164. else if (value === "fedex_cancel_pick_up") {
  14165. cancelFedExPickUp({ id: row.id });
  14166. }
  14167. };
  14168. const sendOut = (data) => {
  14169. loadingBtn.value = true;
  14170. uni.request({
  14171. url: sendOutURL,
  14172. method: "POST",
  14173. header: {
  14174. batoken: token.value
  14175. },
  14176. data,
  14177. success: ({ data: data2 }) => {
  14178. loadingBtn.value = false;
  14179. messageType.value = "success";
  14180. messageText.value = "发出成功";
  14181. messageRef.value.open();
  14182. },
  14183. fail: (err) => {
  14184. loadingBtn.value = false;
  14185. messageType.value = "error";
  14186. messageText.value = "发出失败,请稍后重试";
  14187. messageRef.value.open();
  14188. }
  14189. });
  14190. };
  14191. const updateDelivered = (data) => {
  14192. loadingBtn.value = true;
  14193. uni.request({
  14194. url: deliveredURL,
  14195. method: "POST",
  14196. header: {
  14197. batoken: token.value
  14198. },
  14199. data,
  14200. success: ({ data: data2 }) => {
  14201. loadingBtn.value = false;
  14202. messageType.value = "success";
  14203. messageText.value = "确认送达成功";
  14204. messageRef.value.open();
  14205. },
  14206. fail: (err) => {
  14207. loadingBtn.value = false;
  14208. messageType.value = "error";
  14209. messageText.value = "确认送达失败,请稍后重试";
  14210. messageRef.value.open();
  14211. }
  14212. });
  14213. };
  14214. const updateRefuse = (data) => {
  14215. loadingBtn.value = true;
  14216. uni.request({
  14217. url: refuseURL,
  14218. method: "POST",
  14219. header: {
  14220. batoken: token.value
  14221. },
  14222. data,
  14223. success: ({ data: data2 }) => {
  14224. loadingBtn.value = false;
  14225. messageType.value = "success";
  14226. messageText.value = "已拒绝签收";
  14227. messageRef.value.open();
  14228. },
  14229. fail: (err) => {
  14230. loadingBtn.value = false;
  14231. messageType.value = "error";
  14232. messageText.value = "修改失败,请稍后重试";
  14233. messageRef.value.open();
  14234. }
  14235. });
  14236. };
  14237. const createTrackPod = (data) => {
  14238. loadingBtn.value = true;
  14239. uni.request({
  14240. url: createTrackPodURL,
  14241. method: "POST",
  14242. header: {
  14243. batoken: token.value
  14244. },
  14245. data,
  14246. success: ({ data: data2 }) => {
  14247. loadingBtn.value = false;
  14248. messageType.value = "success";
  14249. messageText.value = "同步成功";
  14250. messageRef.value.open();
  14251. },
  14252. fail: (err) => {
  14253. loadingBtn.value = false;
  14254. messageType.value = "error";
  14255. messageText.value = "同步失败,请稍后重试";
  14256. messageRef.value.open();
  14257. }
  14258. });
  14259. };
  14260. const cancelFedExPickUp = (data) => {
  14261. loadingBtn.value = true;
  14262. uni.request({
  14263. url: cancelFedExPickUpURL,
  14264. method: "POST",
  14265. header: {
  14266. batoken: token.value
  14267. },
  14268. data,
  14269. success: ({ data: data2 }) => {
  14270. loadingBtn.value = false;
  14271. messageType.value = "success";
  14272. messageText.value = "操作成功";
  14273. messageRef.value.open();
  14274. },
  14275. fail: (err) => {
  14276. loadingBtn.value = false;
  14277. messageType.value = "error";
  14278. messageText.value = "操作失败,请稍后重试";
  14279. messageRef.value.open();
  14280. }
  14281. });
  14282. };
  14283. const getList = () => {
  14284. loading.value = true;
  14285. uni.request({
  14286. url: pickupWaybillDeliveryOrderURL + "/index",
  14287. method: "GET",
  14288. header: {
  14289. batoken: token.value
  14290. },
  14291. success: ({ data }) => {
  14292. loading.value = false;
  14293. formatAppLog("log", "at pages/waybillDeliveryOrder/index.vue:319", data);
  14294. if (data.code == 1) {
  14295. waybillDelivery.value = data.data.list;
  14296. } else {
  14297. messageType.value = "error";
  14298. messageText.value = data.msg;
  14299. messageRef.value.open();
  14300. }
  14301. },
  14302. fail: (err) => {
  14303. loading.value = false;
  14304. }
  14305. });
  14306. };
  14307. onLoad(() => {
  14308. token.value = uni.getStorageSync("token");
  14309. getList();
  14310. });
  14311. onNavigationBarButtonTap((event) => {
  14312. if (event.index === 0) {
  14313. showRightRef.value.open();
  14314. }
  14315. });
  14316. const __returned__ = { loading, loadingBtn, token, searchValue, waybillDelivery, messageType, messageText, messageRef, showRightRef, resetForm, confirmForm, copyOrderNo, callPhone, checkPermission, scanInput, itemClick, onButtonClick, sendOut, updateDelivered, updateRefuse, createTrackPod, cancelFedExPickUp, getList };
  14317. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  14318. return __returned__;
  14319. }
  14320. });
  14321. const _imports_0 = "/static/copy.png";
  14322. const _imports_1 = "/static/call.png";
  14323. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  14324. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  14325. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_5);
  14326. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  14327. const _component_uni_drawer = resolveEasycom(vue.resolveDynamicComponent("uni-drawer"), __easycom_3);
  14328. return vue.openBlock(), vue.createElementBlock("view", { class: "list" }, [
  14329. vue.createCommentVNode(' <uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear"></uni-search-bar> '),
  14330. vue.createVNode(_component_uni_easyinput, {
  14331. modelValue: $setup.searchValue,
  14332. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.searchValue = $event),
  14333. placeholder: "请输入单号",
  14334. suffixIcon: "scan",
  14335. onIconClick: $setup.scanInput
  14336. }, null, 8, ["modelValue"]),
  14337. (vue.openBlock(true), vue.createElementBlock(
  14338. vue.Fragment,
  14339. null,
  14340. vue.renderList($setup.waybillDelivery, (item, i2) => {
  14341. return vue.openBlock(), vue.createElementBlock("view", {
  14342. class: "item",
  14343. key: i2,
  14344. onClick: ($event) => $setup.itemClick(item)
  14345. }, [
  14346. vue.createElementVNode("view", { class: "order-no" }, [
  14347. vue.createElementVNode(
  14348. "text",
  14349. null,
  14350. " 派送单号: " + vue.toDisplayString(item.order_no),
  14351. 1
  14352. /* TEXT */
  14353. ),
  14354. vue.createElementVNode("image", {
  14355. onClick: ($event) => $setup.copyOrderNo(item.order_no),
  14356. class: "icon",
  14357. src: _imports_0,
  14358. mode: "aspectFill"
  14359. }, null, 8, ["onClick"])
  14360. ]),
  14361. vue.createElementVNode("view", { class: "address-info" }, [
  14362. vue.createElementVNode("view", { class: "info" }, [
  14363. vue.createElementVNode("view", { class: "user" }, [
  14364. vue.createElementVNode(
  14365. "text",
  14366. null,
  14367. vue.toDisplayString(item.address.first_name + " " + item.address.last_name) + " " + vue.toDisplayString("+" + item.address.mobile_code + " " + item.address.mobile),
  14368. 1
  14369. /* TEXT */
  14370. ),
  14371. vue.createElementVNode("image", {
  14372. onClick: ($event) => $setup.callPhone(item.address.mobile_code + " " + item.address.mobile),
  14373. class: "icon",
  14374. src: _imports_1,
  14375. mode: "aspectFill"
  14376. }, null, 8, ["onClick"])
  14377. ]),
  14378. vue.createElementVNode("view", null, [
  14379. vue.createElementVNode("text", { class: "address" }, [
  14380. vue.createElementVNode(
  14381. "text",
  14382. { class: "city" },
  14383. vue.toDisplayString(item.address.city),
  14384. 1
  14385. /* TEXT */
  14386. ),
  14387. vue.createTextVNode(
  14388. " " + vue.toDisplayString(item.address.zip_code),
  14389. 1
  14390. /* TEXT */
  14391. )
  14392. ]),
  14393. vue.createElementVNode("image", {
  14394. onClick: ($event) => $setup.copyOrderNo(item.address.zip_code),
  14395. class: "icon",
  14396. src: _imports_0,
  14397. mode: "aspectFill"
  14398. }, null, 8, ["onClick"])
  14399. ])
  14400. ]),
  14401. vue.createElementVNode("view", { class: "info" })
  14402. ]),
  14403. vue.createElementVNode("view"),
  14404. vue.createElementVNode("view", { class: "operations" }, [
  14405. (vue.openBlock(true), vue.createElementBlock(
  14406. vue.Fragment,
  14407. null,
  14408. vue.renderList(item.operations, (operation, i22) => {
  14409. return vue.openBlock(), vue.createElementBlock("button", {
  14410. key: i22,
  14411. onClick: ($event) => $setup.onButtonClick(item, operation.value),
  14412. type: "info",
  14413. size: "mini"
  14414. }, vue.toDisplayString(operation.text), 9, ["onClick"]);
  14415. }),
  14416. 128
  14417. /* KEYED_FRAGMENT */
  14418. ))
  14419. ])
  14420. ], 8, ["onClick"]);
  14421. }),
  14422. 128
  14423. /* KEYED_FRAGMENT */
  14424. )),
  14425. $setup.waybillDelivery.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  14426. key: 0,
  14427. class: "is-empty"
  14428. }, "暂无派送单")) : vue.createCommentVNode("v-if", true),
  14429. vue.createVNode(
  14430. _component_uni_popup,
  14431. {
  14432. ref: "messageRef",
  14433. type: "message"
  14434. },
  14435. {
  14436. default: vue.withCtx(() => [
  14437. vue.createVNode(_component_uni_popup_message, {
  14438. type: $setup.messageType,
  14439. message: $setup.messageText,
  14440. duration: 2e3
  14441. }, null, 8, ["type", "message"])
  14442. ]),
  14443. _: 1
  14444. /* STABLE */
  14445. },
  14446. 512
  14447. /* NEED_PATCH */
  14448. ),
  14449. vue.createVNode(
  14450. _component_uni_drawer,
  14451. {
  14452. ref: "showRightRef",
  14453. mode: "right",
  14454. "mask-click": true
  14455. },
  14456. {
  14457. default: vue.withCtx(() => [
  14458. vue.createElementVNode("scroll-view", {
  14459. style: { "height": "100%" },
  14460. "scroll-y": "true"
  14461. }, [
  14462. vue.createElementVNode("view", { class: "button-group" }, [
  14463. vue.createElementVNode("button", {
  14464. onClick: $setup.resetForm,
  14465. type: "info"
  14466. }, "重置"),
  14467. vue.createElementVNode("button", {
  14468. onClick: $setup.confirmForm,
  14469. type: "primary"
  14470. }, "确认")
  14471. ])
  14472. ])
  14473. ]),
  14474. _: 1
  14475. /* STABLE */
  14476. },
  14477. 512
  14478. /* NEED_PATCH */
  14479. )
  14480. ]);
  14481. }
  14482. const PagesWaybillDeliveryOrderIndex = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5], ["__scopeId", "data-v-e43ee4da"], ["__file", "E:/HBuilderProjects/YTAPP/pages/waybillDeliveryOrder/index.vue"]]);
  14483. const _sfc_main$5 = {
  14484. name: "UniSegmentedControl",
  14485. emits: ["clickItem"],
  14486. props: {
  14487. current: {
  14488. type: Number,
  14489. default: 0
  14490. },
  14491. values: {
  14492. type: Array,
  14493. default() {
  14494. return [];
  14495. }
  14496. },
  14497. activeColor: {
  14498. type: String,
  14499. default: "#2979FF"
  14500. },
  14501. inActiveColor: {
  14502. type: String,
  14503. default: "transparent"
  14504. },
  14505. styleType: {
  14506. type: String,
  14507. default: "button"
  14508. }
  14509. },
  14510. data() {
  14511. return {
  14512. currentIndex: 0
  14513. };
  14514. },
  14515. watch: {
  14516. current(val) {
  14517. if (val !== this.currentIndex) {
  14518. this.currentIndex = val;
  14519. }
  14520. }
  14521. },
  14522. computed: {},
  14523. created() {
  14524. this.currentIndex = this.current;
  14525. },
  14526. methods: {
  14527. _onClick(index) {
  14528. if (this.currentIndex !== index) {
  14529. this.currentIndex = index;
  14530. this.$emit("clickItem", {
  14531. currentIndex: index
  14532. });
  14533. }
  14534. }
  14535. }
  14536. };
  14537. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  14538. return vue.openBlock(), vue.createElementBlock(
  14539. "view",
  14540. {
  14541. class: vue.normalizeClass([[$props.styleType === "text" ? "segmented-control--text" : "segmented-control--button"], "segmented-control"]),
  14542. style: vue.normalizeStyle({ borderColor: $props.styleType === "text" ? "" : $props.activeColor })
  14543. },
  14544. [
  14545. (vue.openBlock(true), vue.createElementBlock(
  14546. vue.Fragment,
  14547. null,
  14548. vue.renderList($props.values, (item, index) => {
  14549. return vue.openBlock(), vue.createElementBlock("view", {
  14550. class: vue.normalizeClass([[
  14551. $props.styleType === "text" ? "" : "segmented-control__item--button",
  14552. index === 0 && $props.styleType === "button" ? "segmented-control__item--button--first" : "",
  14553. index === $props.values.length - 1 && $props.styleType === "button" ? "segmented-control__item--button--last" : ""
  14554. ], "segmented-control__item"]),
  14555. key: index,
  14556. style: vue.normalizeStyle({ backgroundColor: index === $data.currentIndex && $props.styleType === "button" ? $props.activeColor : $props.styleType === "button" ? $props.inActiveColor : "transparent", borderColor: index === $data.currentIndex && $props.styleType === "text" || $props.styleType === "button" ? $props.activeColor : $props.inActiveColor }),
  14557. onClick: ($event) => $options._onClick(index)
  14558. }, [
  14559. vue.createElementVNode("view", null, [
  14560. vue.createElementVNode(
  14561. "text",
  14562. {
  14563. style: vue.normalizeStyle({ color: index === $data.currentIndex ? $props.styleType === "text" ? $props.activeColor : "#fff" : $props.styleType === "text" ? "#000" : $props.activeColor }),
  14564. class: vue.normalizeClass(["segmented-control__text", $props.styleType === "text" && index === $data.currentIndex ? "segmented-control__item--text" : ""])
  14565. },
  14566. vue.toDisplayString(item),
  14567. 7
  14568. /* TEXT, CLASS, STYLE */
  14569. )
  14570. ])
  14571. ], 14, ["onClick"]);
  14572. }),
  14573. 128
  14574. /* KEYED_FRAGMENT */
  14575. ))
  14576. ],
  14577. 6
  14578. /* CLASS, STYLE */
  14579. );
  14580. }
  14581. const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__scopeId", "data-v-86aa1171"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.vue"]]);
  14582. const _sfc_main$4 = {
  14583. name: "UniTag",
  14584. emits: ["click"],
  14585. props: {
  14586. type: {
  14587. // 标签类型default、primary、success、warning、error、royal
  14588. type: String,
  14589. default: "default"
  14590. },
  14591. size: {
  14592. // 标签大小 normal, small
  14593. type: String,
  14594. default: "normal"
  14595. },
  14596. // 标签内容
  14597. text: {
  14598. type: String,
  14599. default: ""
  14600. },
  14601. disabled: {
  14602. // 是否为禁用状态
  14603. type: [Boolean, String],
  14604. default: false
  14605. },
  14606. inverted: {
  14607. // 是否为空心
  14608. type: [Boolean, String],
  14609. default: false
  14610. },
  14611. circle: {
  14612. // 是否为圆角样式
  14613. type: [Boolean, String],
  14614. default: false
  14615. },
  14616. mark: {
  14617. // 是否为标记样式
  14618. type: [Boolean, String],
  14619. default: false
  14620. },
  14621. customStyle: {
  14622. type: String,
  14623. default: ""
  14624. }
  14625. },
  14626. computed: {
  14627. classes() {
  14628. const {
  14629. type,
  14630. disabled,
  14631. inverted,
  14632. circle,
  14633. mark,
  14634. size,
  14635. isTrue
  14636. } = this;
  14637. const classArr = [
  14638. "uni-tag--" + type,
  14639. "uni-tag--" + size,
  14640. isTrue(disabled) ? "uni-tag--disabled" : "",
  14641. isTrue(inverted) ? "uni-tag--" + type + "--inverted" : "",
  14642. isTrue(circle) ? "uni-tag--circle" : "",
  14643. isTrue(mark) ? "uni-tag--mark" : "",
  14644. // type === 'default' ? 'uni-tag--default' : 'uni-tag-text',
  14645. isTrue(inverted) ? "uni-tag--inverted uni-tag-text--" + type : "",
  14646. size === "small" ? "uni-tag-text--small" : ""
  14647. ];
  14648. return classArr.join(" ");
  14649. }
  14650. },
  14651. methods: {
  14652. isTrue(value) {
  14653. return value === true || value === "true";
  14654. },
  14655. onClick() {
  14656. if (this.isTrue(this.disabled))
  14657. return;
  14658. this.$emit("click");
  14659. }
  14660. }
  14661. };
  14662. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  14663. return $props.text ? (vue.openBlock(), vue.createElementBlock(
  14664. "text",
  14665. {
  14666. key: 0,
  14667. class: vue.normalizeClass(["uni-tag", $options.classes]),
  14668. style: vue.normalizeStyle($props.customStyle),
  14669. onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
  14670. },
  14671. vue.toDisplayString($props.text),
  14672. 7
  14673. /* TEXT, CLASS, STYLE */
  14674. )) : vue.createCommentVNode("v-if", true);
  14675. }
  14676. const __easycom_1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__scopeId", "data-v-1f94d070"], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-tag/components/uni-tag/uni-tag.vue"]]);
  14677. function pad(str, length = 2) {
  14678. str += "";
  14679. while (str.length < length) {
  14680. str = "0" + str;
  14681. }
  14682. return str.slice(-length);
  14683. }
  14684. const parser = {
  14685. yyyy: (dateObj) => {
  14686. return pad(dateObj.year, 4);
  14687. },
  14688. yy: (dateObj) => {
  14689. return pad(dateObj.year);
  14690. },
  14691. MM: (dateObj) => {
  14692. return pad(dateObj.month);
  14693. },
  14694. M: (dateObj) => {
  14695. return dateObj.month;
  14696. },
  14697. dd: (dateObj) => {
  14698. return pad(dateObj.day);
  14699. },
  14700. d: (dateObj) => {
  14701. return dateObj.day;
  14702. },
  14703. hh: (dateObj) => {
  14704. return pad(dateObj.hour);
  14705. },
  14706. h: (dateObj) => {
  14707. return dateObj.hour;
  14708. },
  14709. mm: (dateObj) => {
  14710. return pad(dateObj.minute);
  14711. },
  14712. m: (dateObj) => {
  14713. return dateObj.minute;
  14714. },
  14715. ss: (dateObj) => {
  14716. return pad(dateObj.second);
  14717. },
  14718. s: (dateObj) => {
  14719. return dateObj.second;
  14720. },
  14721. SSS: (dateObj) => {
  14722. return pad(dateObj.millisecond, 3);
  14723. },
  14724. S: (dateObj) => {
  14725. return dateObj.millisecond;
  14726. }
  14727. };
  14728. function getDate(time) {
  14729. if (time instanceof Date) {
  14730. return time;
  14731. }
  14732. switch (typeof time) {
  14733. case "string": {
  14734. if (time.indexOf("T") > -1) {
  14735. return new Date(time);
  14736. }
  14737. return new Date(time.replace(/-/g, "/"));
  14738. }
  14739. default:
  14740. return new Date(time);
  14741. }
  14742. }
  14743. function formatDate(date, format = "yyyy/MM/dd hh:mm:ss") {
  14744. if (!date && date !== 0) {
  14745. return "";
  14746. }
  14747. date = getDate(date);
  14748. const dateObj = {
  14749. year: date.getFullYear(),
  14750. month: date.getMonth() + 1,
  14751. day: date.getDate(),
  14752. hour: date.getHours(),
  14753. minute: date.getMinutes(),
  14754. second: date.getSeconds(),
  14755. millisecond: date.getMilliseconds()
  14756. };
  14757. const tokenRegExp = /yyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S/;
  14758. let flag = true;
  14759. let result = format;
  14760. while (flag) {
  14761. flag = false;
  14762. result = result.replace(tokenRegExp, function(matched) {
  14763. flag = true;
  14764. return parser[matched](dateObj);
  14765. });
  14766. }
  14767. return result;
  14768. }
  14769. function friendlyDate(time, {
  14770. locale = "zh",
  14771. threshold = [6e4, 36e5],
  14772. format = "yyyy/MM/dd hh:mm:ss"
  14773. }) {
  14774. if (time === "-") {
  14775. return time;
  14776. }
  14777. if (!time && time !== 0) {
  14778. return "";
  14779. }
  14780. const localeText = {
  14781. zh: {
  14782. year: "年",
  14783. month: "月",
  14784. day: "天",
  14785. hour: "小时",
  14786. minute: "分钟",
  14787. second: "秒",
  14788. ago: "前",
  14789. later: "后",
  14790. justNow: "刚刚",
  14791. soon: "马上",
  14792. template: "{num}{unit}{suffix}"
  14793. },
  14794. en: {
  14795. year: "year",
  14796. month: "month",
  14797. day: "day",
  14798. hour: "hour",
  14799. minute: "minute",
  14800. second: "second",
  14801. ago: "ago",
  14802. later: "later",
  14803. justNow: "just now",
  14804. soon: "soon",
  14805. template: "{num} {unit} {suffix}"
  14806. }
  14807. };
  14808. const text = localeText[locale] || localeText.zh;
  14809. let date = getDate(time);
  14810. let ms2 = date.getTime() - Date.now();
  14811. let absMs = Math.abs(ms2);
  14812. if (absMs < threshold[0]) {
  14813. return ms2 < 0 ? text.justNow : text.soon;
  14814. }
  14815. if (absMs >= threshold[1]) {
  14816. return formatDate(date, format);
  14817. }
  14818. let num;
  14819. let unit;
  14820. let suffix = text.later;
  14821. if (ms2 < 0) {
  14822. suffix = text.ago;
  14823. ms2 = -ms2;
  14824. }
  14825. const seconds = Math.floor(ms2 / 1e3);
  14826. const minutes = Math.floor(seconds / 60);
  14827. const hours = Math.floor(minutes / 60);
  14828. const days = Math.floor(hours / 24);
  14829. const months = Math.floor(days / 30);
  14830. const years = Math.floor(months / 12);
  14831. switch (true) {
  14832. case years > 0:
  14833. num = years;
  14834. unit = text.year;
  14835. break;
  14836. case months > 0:
  14837. num = months;
  14838. unit = text.month;
  14839. break;
  14840. case days > 0:
  14841. num = days;
  14842. unit = text.day;
  14843. break;
  14844. case hours > 0:
  14845. num = hours;
  14846. unit = text.hour;
  14847. break;
  14848. case minutes > 0:
  14849. num = minutes;
  14850. unit = text.minute;
  14851. break;
  14852. default:
  14853. num = seconds;
  14854. unit = text.second;
  14855. break;
  14856. }
  14857. if (locale === "en") {
  14858. if (num === 1) {
  14859. num = "a";
  14860. } else {
  14861. unit += "s";
  14862. }
  14863. }
  14864. return text.template.replace(/{\s*num\s*}/g, num + "").replace(/{\s*unit\s*}/g, unit).replace(
  14865. /{\s*suffix\s*}/g,
  14866. suffix
  14867. );
  14868. }
  14869. const _sfc_main$3 = {
  14870. name: "uniDateformat",
  14871. props: {
  14872. date: {
  14873. type: [Object, String, Number],
  14874. default() {
  14875. return "-";
  14876. }
  14877. },
  14878. locale: {
  14879. type: String,
  14880. default: "zh"
  14881. },
  14882. threshold: {
  14883. type: Array,
  14884. default() {
  14885. return [0, 0];
  14886. }
  14887. },
  14888. format: {
  14889. type: String,
  14890. default: "yyyy/MM/dd hh:mm:ss"
  14891. },
  14892. // refreshRate使用不当可能导致性能问题,谨慎使用
  14893. refreshRate: {
  14894. type: [Number, String],
  14895. default: 0
  14896. }
  14897. },
  14898. data() {
  14899. return {
  14900. refreshMark: 0
  14901. };
  14902. },
  14903. computed: {
  14904. dateShow() {
  14905. this.refreshMark;
  14906. return friendlyDate(this.date, {
  14907. locale: this.locale,
  14908. threshold: this.threshold,
  14909. format: this.format
  14910. });
  14911. }
  14912. },
  14913. watch: {
  14914. refreshRate: {
  14915. handler() {
  14916. this.setAutoRefresh();
  14917. },
  14918. immediate: true
  14919. }
  14920. },
  14921. methods: {
  14922. refresh() {
  14923. this.refreshMark++;
  14924. },
  14925. setAutoRefresh() {
  14926. clearInterval(this.refreshInterval);
  14927. if (this.refreshRate) {
  14928. this.refreshInterval = setInterval(() => {
  14929. this.refresh();
  14930. }, parseInt(this.refreshRate));
  14931. }
  14932. }
  14933. }
  14934. };
  14935. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  14936. return vue.openBlock(), vue.createElementBlock(
  14937. "text",
  14938. null,
  14939. vue.toDisplayString($options.dateShow),
  14940. 1
  14941. /* TEXT */
  14942. );
  14943. }
  14944. const __easycom_2 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "E:/HBuilderProjects/YTAPP/uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.vue"]]);
  14945. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  14946. __name: "orderInfo",
  14947. setup(__props, { expose: __expose }) {
  14948. __expose();
  14949. const current = vue.ref(0);
  14950. const items = vue.ref(["基本信息", "运单详情"]);
  14951. const loading = vue.ref(false);
  14952. const token = vue.ref();
  14953. const waybillDelivery = vue.ref([]);
  14954. const messageType = vue.ref();
  14955. const messageText = vue.ref();
  14956. const messageRef = vue.ref();
  14957. const item = vue.ref();
  14958. const deliveryOrderOptions = vue.ref({});
  14959. const delivery_type = vue.ref({
  14960. "1": "英途派送",
  14961. "2": "第三方物流"
  14962. });
  14963. onLoad((query) => {
  14964. token.value = uni.getStorageSync("token");
  14965. item.value = uni.getStorageSync("selectItem");
  14966. deliveryOrderOptions.value = uni.getStorageSync("deliveryOrderOptions");
  14967. formatAppLog("log", "at pages/waybillDeliveryOrder/orderInfo.vue:128", item.value);
  14968. });
  14969. const onClickItem = (e2) => {
  14970. if (current.value != e2.currentIndex) {
  14971. current.value = e2.currentIndex;
  14972. }
  14973. };
  14974. const copyString = (str) => {
  14975. uni.setClipboardData({
  14976. data: str,
  14977. success: function() {
  14978. uni.showToast({
  14979. title: "复制成功",
  14980. icon: "success",
  14981. duration: 2e3
  14982. });
  14983. },
  14984. fail: function() {
  14985. formatAppLog("log", "at pages/waybillDeliveryOrder/orderInfo.vue:149", "复制失败");
  14986. }
  14987. });
  14988. };
  14989. const __returned__ = { current, items, loading, token, waybillDelivery, messageType, messageText, messageRef, item, deliveryOrderOptions, delivery_type, onClickItem, copyString };
  14990. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  14991. return __returned__;
  14992. }
  14993. });
  14994. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  14995. const _component_uni_segmented_control = resolveEasycom(vue.resolveDynamicComponent("uni-segmented-control"), __easycom_0);
  14996. const _component_uni_tag = resolveEasycom(vue.resolveDynamicComponent("uni-tag"), __easycom_1);
  14997. const _component_uni_dateformat = resolveEasycom(vue.resolveDynamicComponent("uni-dateformat"), __easycom_2);
  14998. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_5);
  14999. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  15000. return vue.openBlock(), vue.createElementBlock("view", { class: "info" }, [
  15001. vue.createVNode(_component_uni_segmented_control, {
  15002. current: $setup.current,
  15003. values: $setup.items,
  15004. onClickItem: $setup.onClickItem,
  15005. styleType: "text",
  15006. activeColor: "#007aff"
  15007. }, null, 8, ["current", "values"]),
  15008. vue.createElementVNode("view", { class: "content" }, [
  15009. vue.withDirectives(vue.createElementVNode(
  15010. "view",
  15011. null,
  15012. [
  15013. vue.createElementVNode("view", { class: "order-no" }, [
  15014. vue.createElementVNode("view", null, [
  15015. vue.createElementVNode(
  15016. "text",
  15017. null,
  15018. "派送单号: " + vue.toDisplayString($setup.item.order_no),
  15019. 1
  15020. /* TEXT */
  15021. ),
  15022. vue.createElementVNode("image", {
  15023. onClick: _cache[0] || (_cache[0] = ($event) => $setup.copyString($setup.item.order_no)),
  15024. class: "icon",
  15025. src: _imports_0,
  15026. mode: "aspectFill"
  15027. })
  15028. ]),
  15029. vue.createVNode(_component_uni_tag, {
  15030. text: $setup.item.status_text,
  15031. type: "primary",
  15032. circle: ""
  15033. }, null, 8, ["text"])
  15034. ]),
  15035. vue.createElementVNode("view", { class: "box-card" }, [
  15036. vue.createElementVNode("view", { class: "label-icon" }, [
  15037. vue.createElementVNode("text", { class: "label-title" }, "地址信息")
  15038. ]),
  15039. vue.createElementVNode("view", { class: "label-content" }, [
  15040. vue.createElementVNode(
  15041. "text",
  15042. null,
  15043. vue.toDisplayString($setup.item.address.first_name + " " + $setup.item.address.last_name),
  15044. 1
  15045. /* TEXT */
  15046. ),
  15047. $setup.item.address.mobile ? (vue.openBlock(), vue.createElementBlock("text", { key: 0 }, [
  15048. vue.createTextVNode(
  15049. " +" + vue.toDisplayString($setup.item.address.mobile_code + " " + $setup.item.address.mobile) + " ",
  15050. 1
  15051. /* TEXT */
  15052. ),
  15053. vue.createElementVNode("br")
  15054. ])) : vue.createCommentVNode("v-if", true),
  15055. $setup.item.address.email ? (vue.openBlock(), vue.createElementBlock("text", { key: 1 }, [
  15056. vue.createTextVNode(
  15057. vue.toDisplayString($setup.item.address.email) + " ",
  15058. 1
  15059. /* TEXT */
  15060. ),
  15061. vue.createElementVNode("br")
  15062. ])) : vue.createCommentVNode("v-if", true),
  15063. vue.createElementVNode("text", null, [
  15064. vue.createTextVNode(
  15065. vue.toDisplayString($setup.item.address.address_line_1) + " ",
  15066. 1
  15067. /* TEXT */
  15068. ),
  15069. vue.createElementVNode("br")
  15070. ]),
  15071. $setup.item.address.address_line_2 ? (vue.openBlock(), vue.createElementBlock("text", { key: 2 }, [
  15072. vue.createTextVNode(
  15073. vue.toDisplayString($setup.item.address.address_line_2) + " ",
  15074. 1
  15075. /* TEXT */
  15076. ),
  15077. vue.createElementVNode("br")
  15078. ])) : vue.createCommentVNode("v-if", true),
  15079. $setup.item.address.address_line_3 ? (vue.openBlock(), vue.createElementBlock("text", { key: 3 }, [
  15080. vue.createTextVNode(
  15081. vue.toDisplayString($setup.item.address.address_line_3) + " ",
  15082. 1
  15083. /* TEXT */
  15084. ),
  15085. vue.createElementVNode("br")
  15086. ])) : vue.createCommentVNode("v-if", true),
  15087. vue.createElementVNode("text", null, [
  15088. vue.createTextVNode(
  15089. vue.toDisplayString($setup.item.address.city + " " + $setup.item.address.district) + " ",
  15090. 1
  15091. /* TEXT */
  15092. ),
  15093. vue.createElementVNode("br")
  15094. ]),
  15095. vue.createElementVNode("text", null, [
  15096. vue.createTextVNode(
  15097. vue.toDisplayString($setup.item.address.province) + " ",
  15098. 1
  15099. /* TEXT */
  15100. ),
  15101. vue.createElementVNode("br")
  15102. ]),
  15103. vue.createElementVNode("text", null, [
  15104. vue.createTextVNode(
  15105. vue.toDisplayString($setup.item.address.zip_code) + " ",
  15106. 1
  15107. /* TEXT */
  15108. ),
  15109. vue.createElementVNode("br")
  15110. ])
  15111. ])
  15112. ]),
  15113. vue.createElementVNode("view", { class: "box-card" }, [
  15114. vue.createElementVNode("text", null, [
  15115. vue.createTextVNode("客户派送日期: "),
  15116. $setup.item.delivery_date ? (vue.openBlock(), vue.createBlock(_component_uni_dateformat, {
  15117. key: 0,
  15118. date: $setup.item.delivery_date,
  15119. format: "yyyy-MM-dd"
  15120. }, null, 8, ["date"])) : (vue.openBlock(), vue.createElementBlock("text", { key: 1 }, "无")),
  15121. vue.createElementVNode("br")
  15122. ]),
  15123. vue.createElementVNode(
  15124. "text",
  15125. null,
  15126. "备注: " + vue.toDisplayString($setup.item.remark || "无"),
  15127. 1
  15128. /* TEXT */
  15129. )
  15130. ]),
  15131. vue.createElementVNode("view", { class: "box-card" }, [
  15132. vue.createElementVNode("view", { class: "label-icon" }, [
  15133. vue.createElementVNode("text", { class: "label-title" }, "物流信息")
  15134. ]),
  15135. vue.createElementVNode("view", { class: "label-content" }, [
  15136. vue.createElementVNode("text", null, [
  15137. vue.createTextVNode("派送渠道类型: "),
  15138. vue.createVNode(_component_uni_tag, {
  15139. text: $setup.delivery_type[$setup.item.delivery_type],
  15140. type: "primary"
  15141. }, null, 8, ["text"]),
  15142. vue.createElementVNode("br")
  15143. ]),
  15144. Number($setup.item.delivery_type) === 1 ? (vue.openBlock(), vue.createElementBlock("text", { key: 0 }, [
  15145. vue.createTextVNode(
  15146. "司机: " + vue.toDisplayString($setup.deliveryOrderOptions["driver_id"][$setup.item.driver_id] || "无") + " ",
  15147. 1
  15148. /* TEXT */
  15149. ),
  15150. vue.createElementVNode("br")
  15151. ])) : vue.createCommentVNode("v-if", true),
  15152. Number($setup.item.delivery_type) === 2 ? (vue.openBlock(), vue.createElementBlock("text", { key: 1 }, [
  15153. vue.createTextVNode("快递公司: "),
  15154. vue.createVNode(_component_uni_tag, {
  15155. text: $setup.item.express.name || "无",
  15156. type: "success",
  15157. size: "small",
  15158. circle: ""
  15159. }, null, 8, ["text"]),
  15160. vue.createElementVNode("br")
  15161. ])) : vue.createCommentVNode("v-if", true),
  15162. vue.createElementVNode("text", null, [
  15163. vue.createTextVNode(
  15164. "物流单号: " + vue.toDisplayString($setup.item.express_no || "无") + " ",
  15165. 1
  15166. /* TEXT */
  15167. ),
  15168. vue.createElementVNode("br")
  15169. ]),
  15170. vue.createElementVNode(
  15171. "text",
  15172. null,
  15173. "追踪单号: " + vue.toDisplayString($setup.item.express_tracking_number || "无"),
  15174. 1
  15175. /* TEXT */
  15176. )
  15177. ])
  15178. ])
  15179. ],
  15180. 512
  15181. /* NEED_PATCH */
  15182. ), [
  15183. [vue.vShow, $setup.current === 0]
  15184. ]),
  15185. vue.withDirectives(vue.createElementVNode(
  15186. "view",
  15187. null,
  15188. " 选项卡2的内容 ",
  15189. 512
  15190. /* NEED_PATCH */
  15191. ), [
  15192. [vue.vShow, $setup.current === 1]
  15193. ])
  15194. ]),
  15195. vue.createVNode(
  15196. _component_uni_popup,
  15197. {
  15198. ref: "messageRef",
  15199. type: "message"
  15200. },
  15201. {
  15202. default: vue.withCtx(() => [
  15203. vue.createVNode(_component_uni_popup_message, {
  15204. type: $setup.messageType,
  15205. message: $setup.messageText,
  15206. duration: 2e3
  15207. }, null, 8, ["type", "message"])
  15208. ]),
  15209. _: 1
  15210. /* STABLE */
  15211. },
  15212. 512
  15213. /* NEED_PATCH */
  15214. )
  15215. ]);
  15216. }
  15217. const PagesWaybillDeliveryOrderOrderInfo = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__scopeId", "data-v-a28459fe"], ["__file", "E:/HBuilderProjects/YTAPP/pages/waybillDeliveryOrder/orderInfo.vue"]]);
  15218. const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
  15219. __name: "index",
  15220. setup(__props, { expose: __expose }) {
  15221. __expose();
  15222. const token = vue.ref();
  15223. const loading = vue.ref(false);
  15224. const hidePage = vue.ref(false);
  15225. const focusType = vue.ref(true);
  15226. const selectType = vue.ref(1);
  15227. const printType = vue.ref([
  15228. {
  15229. text: "打印尾程面单",
  15230. value: 1
  15231. },
  15232. {
  15233. text: "打印客户联(详细)",
  15234. value: 2
  15235. },
  15236. {
  15237. text: "打印客户联(简单)",
  15238. value: 3
  15239. }
  15240. ]);
  15241. const printerDialog = vue.ref();
  15242. const subLoading = vue.ref(false);
  15243. const printerList = vue.ref([]);
  15244. const printers = vue.ref([]);
  15245. const downloadFile = vue.ref([]);
  15246. const sendToPeinter = vue.ref([1]);
  15247. const selectPrinter = vue.ref(0);
  15248. const printLogHistory = vue.ref([]);
  15249. const messageRef = vue.ref();
  15250. const messageType = vue.ref();
  15251. const messageText = vue.ref();
  15252. let st2;
  15253. const valiFormData = vue.ref({
  15254. order_code: ""
  15255. });
  15256. const rules = vue.reactive({
  15257. order_code: {
  15258. rules: [
  15259. {
  15260. required: true,
  15261. errorMessage: "单据编号不能为空"
  15262. }
  15263. ]
  15264. }
  15265. });
  15266. const checkPermission = async () => {
  15267. let status = permission.isIOS ? await permission.requestIOS("camera") : await permission.requestAndroid("android.permission.CAMERA");
  15268. if (status === null || status === 1) {
  15269. status = 1;
  15270. } else {
  15271. uni.showModal({
  15272. content: "Camera permission required",
  15273. confirmText: "Setting",
  15274. success: function(res) {
  15275. if (res.confirm) {
  15276. permission.gotoAppSetting();
  15277. }
  15278. }
  15279. });
  15280. }
  15281. return status;
  15282. };
  15283. const scanInput = async () => {
  15284. let status = await checkPermission();
  15285. if (status !== 1) {
  15286. return;
  15287. }
  15288. uni.scanCode({
  15289. success: (res) => {
  15290. valiFormData.value.order_code = res.result;
  15291. onsubmit();
  15292. },
  15293. fail: (err) => {
  15294. }
  15295. });
  15296. };
  15297. const reset = () => {
  15298. loading.value = false;
  15299. valiFormData.value.order_code = "";
  15300. };
  15301. const setfocus = () => {
  15302. if (hidePage.value) {
  15303. return;
  15304. }
  15305. focusType.value = false;
  15306. vue.nextTick(() => {
  15307. focusType.value = true;
  15308. });
  15309. };
  15310. const close = () => {
  15311. printerDialog.value.close();
  15312. st2 = setTimeout(() => {
  15313. reset();
  15314. st2 && clearTimeout(st2);
  15315. }, 700);
  15316. };
  15317. const sendToPeinterFun = (res) => {
  15318. if (res.detail.value.length === 0) {
  15319. selectPrinter.value = 0;
  15320. } else {
  15321. selectPrinter.value = printers.value[0].value;
  15322. }
  15323. };
  15324. const printConfirm = () => {
  15325. subLoading.value = true;
  15326. const url = selectType.value === 1 ? printWaybillLabelURL : printCustomerLabelURL;
  15327. let data = {
  15328. order_no: valiFormData.value.order_code,
  15329. printer_code: selectPrinter.value
  15330. };
  15331. let type = "尾程面单打印";
  15332. if (selectType.value === 2) {
  15333. data.style = "detail";
  15334. type = "打印客户联(详细)";
  15335. }
  15336. if (selectType.value === 3) {
  15337. data.style = "simple";
  15338. type = "打印客户联(简单)";
  15339. }
  15340. uni.request({
  15341. url,
  15342. method: "POST",
  15343. header: {
  15344. batoken: token.value
  15345. },
  15346. data,
  15347. success: (res) => {
  15348. subLoading.value = false;
  15349. formatAppLog("log", "at pages/printer/index.vue:233", "打印成功", res);
  15350. messageType.value = res.data.code ? "success" : "error";
  15351. messageText.value = res.data.msg;
  15352. messageRef.value.open();
  15353. const historyItem = {
  15354. order_code: valiFormData.value.order_code,
  15355. createTime: /* @__PURE__ */ new Date(),
  15356. type,
  15357. status: res.data.code
  15358. };
  15359. printLogHistory.value.unshift(historyItem);
  15360. uni.setStorageSync("printLogHistory", printLogHistory.value);
  15361. getHistory();
  15362. close();
  15363. },
  15364. fail: (err) => {
  15365. subLoading.value = false;
  15366. formatAppLog("log", "at pages/printer/index.vue:251", "打印失败", err);
  15367. messageType.value = "error";
  15368. messageText.value = "打印失败";
  15369. messageRef.value.open();
  15370. const historyItem = {
  15371. order_code: valiFormData.value.order_code,
  15372. createTime: /* @__PURE__ */ new Date(),
  15373. type,
  15374. status: false
  15375. };
  15376. printLogHistory.value.unshift(historyItem);
  15377. uni.setStorageSync("printLogHistory", printLogHistory.value);
  15378. getHistory();
  15379. close();
  15380. }
  15381. });
  15382. };
  15383. const getPrinterList = () => {
  15384. uni.request({
  15385. url: getPrinterListURL,
  15386. method: "GET",
  15387. header: {
  15388. batoken: token.value
  15389. },
  15390. success: (res) => {
  15391. if (res.data.code === 1) {
  15392. printerList.value = res.data.data.printers;
  15393. printers.value = Object.values(printerList.value).map((item) => {
  15394. return {
  15395. text: item.name,
  15396. value: item.value
  15397. };
  15398. });
  15399. }
  15400. },
  15401. fail(e2) {
  15402. formatAppLog("log", "at pages/printer/index.vue:288", "fail--", e2);
  15403. }
  15404. });
  15405. };
  15406. const onsubmit = () => {
  15407. if (valiFormData.value.order_code) {
  15408. loading.value = true;
  15409. st2 && clearTimeout(st2);
  15410. selectPrinter.value = sendToPeinter.value.length > 0 ? printers.value[0].value : 0;
  15411. printerDialog.value.open();
  15412. loading.value = false;
  15413. } else {
  15414. messageType.value = "error";
  15415. messageText.value = "请填写运单号";
  15416. messageRef.value.open();
  15417. }
  15418. };
  15419. const getHistory = () => {
  15420. printLogHistory.value = uni.getStorageSync("printLogHistory") || [];
  15421. };
  15422. const keypress = (e2) => {
  15423. formatAppLog("log", "at pages/printer/index.vue:311", e2, "按键码");
  15424. if (e2.keyCode === 102 || e2.keyCode === 103 || e2.keyCode === 104)
  15425. ;
  15426. if (e2.keyCode == 66) {
  15427. onsubmit();
  15428. }
  15429. };
  15430. onLoad(() => {
  15431. plus.key.addEventListener("keyup", keypress);
  15432. });
  15433. onUnload(() => {
  15434. plus.key.removeEventListener("keyup", keypress);
  15435. });
  15436. onHide(() => {
  15437. hidePage.value = true;
  15438. plus.key.removeEventListener("keyup", keypress);
  15439. });
  15440. onBackPress(() => {
  15441. plus.key.removeEventListener("keyup", keypress);
  15442. });
  15443. onShow(() => {
  15444. token.value = uni.getStorageSync("token");
  15445. hidePage.value = false;
  15446. getHistory();
  15447. getPrinterList();
  15448. });
  15449. onNavigationBarButtonTap((event) => {
  15450. if (event.index === 0) {
  15451. uni.navigateTo({
  15452. url: "/pages/warehouseScan/warehouseLog"
  15453. });
  15454. }
  15455. });
  15456. const __returned__ = { token, loading, hidePage, focusType, selectType, printType, printerDialog, subLoading, printerList, printers, downloadFile, sendToPeinter, selectPrinter, printLogHistory, messageRef, messageType, messageText, get st() {
  15457. return st2;
  15458. }, set st(v2) {
  15459. st2 = v2;
  15460. }, valiFormData, rules, checkPermission, scanInput, reset, setfocus, close, sendToPeinterFun, printConfirm, getPrinterList, onsubmit, getHistory, keypress };
  15461. Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
  15462. return __returned__;
  15463. }
  15464. });
  15465. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  15466. const _component_uni_data_checkbox = resolveEasycom(vue.resolveDynamicComponent("uni-data-checkbox"), __easycom_0$4);
  15467. const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_1$1);
  15468. const _component_uni_forms_item = resolveEasycom(vue.resolveDynamicComponent("uni-forms-item"), __easycom_2$1);
  15469. const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_3$2);
  15470. const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_4);
  15471. const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_5);
  15472. const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_6);
  15473. return vue.openBlock(), vue.createElementBlock("view", { class: "container" }, [
  15474. vue.createElementVNode("view", { class: "checkbox" }, [
  15475. vue.createVNode(_component_uni_data_checkbox, {
  15476. modelValue: $setup.selectType,
  15477. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.selectType = $event),
  15478. localdata: $setup.printType
  15479. }, null, 8, ["modelValue", "localdata"])
  15480. ]),
  15481. vue.createVNode(_component_uni_forms, {
  15482. ref: "valiForm",
  15483. "label-align": "right",
  15484. "label-width": 80,
  15485. rules: $setup.rules,
  15486. modelValue: $setup.valiFormData
  15487. }, {
  15488. default: vue.withCtx(() => [
  15489. vue.createVNode(_component_uni_forms_item, {
  15490. label: "单据编号",
  15491. required: "",
  15492. name: "order_code"
  15493. }, {
  15494. default: vue.withCtx(() => [
  15495. vue.createVNode(_component_uni_easyinput, {
  15496. modelValue: $setup.valiFormData.order_code,
  15497. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.valiFormData.order_code = $event),
  15498. placeholder: "请输入单据编号",
  15499. suffixIcon: "scan",
  15500. focus: $setup.focusType,
  15501. onIconClick: $setup.scanInput,
  15502. onBlur: $setup.setfocus,
  15503. onConfirm: $setup.onsubmit
  15504. }, null, 8, ["modelValue", "focus"])
  15505. ]),
  15506. _: 1
  15507. /* STABLE */
  15508. })
  15509. ]),
  15510. _: 1
  15511. /* STABLE */
  15512. }, 8, ["rules", "modelValue"]),
  15513. vue.createElementVNode("view", { class: "button-group" }, [
  15514. vue.createElementVNode("button", {
  15515. type: "info",
  15516. onClick: $setup.reset
  15517. }, "重置"),
  15518. vue.createElementVNode("button", {
  15519. type: "primary",
  15520. onClick: $setup.onsubmit,
  15521. loading: $setup.loading
  15522. }, [
  15523. !$setup.loading ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  15524. key: 0,
  15525. type: "checkmarkempty",
  15526. size: "18",
  15527. color: "white"
  15528. })) : vue.createCommentVNode("v-if", true),
  15529. vue.createTextVNode(" 打印 ")
  15530. ], 8, ["loading"])
  15531. ]),
  15532. $setup.printLogHistory.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", {
  15533. key: 0,
  15534. class: "history"
  15535. }, [
  15536. vue.createElementVNode("text", { class: "title" }, "记录(最近5条)")
  15537. ])) : vue.createCommentVNode("v-if", true),
  15538. vue.createElementVNode("view", { class: "history" }, [
  15539. (vue.openBlock(true), vue.createElementBlock(
  15540. vue.Fragment,
  15541. null,
  15542. vue.renderList($setup.printLogHistory.slice(0, 5), (item, i2) => {
  15543. return vue.openBlock(), vue.createElementBlock("view", {
  15544. class: "item",
  15545. key: i2
  15546. }, [
  15547. vue.createElementVNode(
  15548. "text",
  15549. {
  15550. class: "code",
  15551. style: vue.normalizeStyle({ color: item.status ? "green" : "#666" })
  15552. },
  15553. vue.toDisplayString(item.type) + " " + vue.toDisplayString(item.order_code),
  15554. 5
  15555. /* TEXT, STYLE */
  15556. ),
  15557. item.status ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
  15558. key: 0,
  15559. type: "checkmarkempty",
  15560. class: "status",
  15561. size: "16",
  15562. color: "green"
  15563. })) : (vue.openBlock(), vue.createElementBlock("text", {
  15564. key: 1,
  15565. class: "status fail"
  15566. }, "F")),
  15567. vue.createElementVNode(
  15568. "text",
  15569. { style: { "margin-left": "10rpx", "font-weight": "300" } },
  15570. vue.toDisplayString("\r\n" + item.createTime),
  15571. 1
  15572. /* TEXT */
  15573. )
  15574. ]);
  15575. }),
  15576. 128
  15577. /* KEYED_FRAGMENT */
  15578. ))
  15579. ]),
  15580. vue.createVNode(
  15581. _component_uni_popup,
  15582. {
  15583. ref: "messageRef",
  15584. type: "message"
  15585. },
  15586. {
  15587. default: vue.withCtx(() => [
  15588. vue.createVNode(_component_uni_popup_message, {
  15589. type: $setup.messageType,
  15590. message: $setup.messageText,
  15591. duration: 2e3
  15592. }, null, 8, ["type", "message"])
  15593. ]),
  15594. _: 1
  15595. /* STABLE */
  15596. },
  15597. 512
  15598. /* NEED_PATCH */
  15599. ),
  15600. vue.createVNode(
  15601. _component_uni_popup,
  15602. {
  15603. ref: "printerDialog",
  15604. type: "dialog",
  15605. "is-mask-click": false
  15606. },
  15607. {
  15608. default: vue.withCtx(() => [
  15609. vue.createElementVNode("view", { style: { "width": "90%", "margin": "0 auto", "min-height": "250px", "background-color": "#fff", "border-radius": "5px" } }, [
  15610. vue.createElementVNode("view", {
  15611. class: "",
  15612. style: { "font-size": "20px", "border-bottom": "1px solid #e1e1e1", "padding": "15px 10px" }
  15613. }, [
  15614. vue.createElementVNode("view", null, [
  15615. vue.createElementVNode("view", { style: { "margin-bottom": "20px" } }, [
  15616. vue.createElementVNode("text", null, "打印尾程面单")
  15617. ]),
  15618. vue.createElementVNode("view", null, [
  15619. $setup.printerList ? (vue.openBlock(), vue.createElementBlock("view", { key: 0 }, [
  15620. vue.createElementVNode("view", null, [
  15621. vue.createVNode(_component_uni_data_checkbox, {
  15622. multiple: "",
  15623. modelValue: $setup.sendToPeinter,
  15624. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $setup.sendToPeinter = $event),
  15625. localdata: [
  15626. {
  15627. text: "发送到标签打印机打印",
  15628. value: 1
  15629. }
  15630. ],
  15631. onChange: $setup.sendToPeinterFun
  15632. }, {
  15633. default: vue.withCtx(() => [
  15634. vue.createTextVNode(" > ")
  15635. ]),
  15636. _: 1
  15637. /* STABLE */
  15638. }, 8, ["modelValue"]),
  15639. vue.createVNode(_component_uni_data_checkbox, {
  15640. disabled: $setup.sendToPeinter.length === 0,
  15641. modelValue: $setup.selectPrinter,
  15642. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.selectPrinter = $event),
  15643. localdata: $setup.printers
  15644. }, null, 8, ["disabled", "modelValue", "localdata"])
  15645. ])
  15646. ])) : vue.createCommentVNode("v-if", true)
  15647. ])
  15648. ]),
  15649. vue.createElementVNode("view", { style: { "text-align": "center", "position": "absolute", "bottom": "10px", "width": "90%", "display": "flex", "margin": "0 auto", "left": "0", "right": "0" } }, [
  15650. vue.createElementVNode("button", {
  15651. onClick: $setup.close,
  15652. style: { "width": "35%" }
  15653. }, "关闭"),
  15654. vue.createElementVNode("button", {
  15655. onClick: $setup.printConfirm,
  15656. "hover-stay-time": 500,
  15657. loading: $setup.subLoading,
  15658. disabled: $setup.sendToPeinter.length === 0 || $setup.subLoading,
  15659. class: "my-bt-bg",
  15660. style: { "width": "35%" }
  15661. }, " 打印 ", 8, ["loading", "disabled"])
  15662. ])
  15663. ])
  15664. ])
  15665. ]),
  15666. _: 1
  15667. /* STABLE */
  15668. },
  15669. 512
  15670. /* NEED_PATCH */
  15671. )
  15672. ]);
  15673. }
  15674. const PagesPrinterIndex = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__scopeId", "data-v-b2c0c306"], ["__file", "E:/HBuilderProjects/YTAPP/pages/printer/index.vue"]]);
  15675. __definePage("pages/home/index", PagesHomeIndex);
  15676. __definePage("pages/instock/index", PagesInstockIndex);
  15677. __definePage("pages/instock/instockLog", PagesInstockInstockLog);
  15678. __definePage("pages/profile/index", PagesProfileIndex);
  15679. __definePage("pages/login/index", PagesLoginIndex);
  15680. __definePage("pages/order/index", PagesOrderIndex);
  15681. __definePage("pages/scanLotno/index", PagesScanLotnoIndex);
  15682. __definePage("pages/scanLotno/lotnoLog", PagesScanLotnoLotnoLog);
  15683. __definePage("pages/scanLotno/waybillsList", PagesScanLotnoWaybillsList);
  15684. __definePage("pages/warehouseScan/index", PagesWarehouseScanIndex);
  15685. __definePage("pages/warehouseScan/warehouseLog", PagesWarehouseScanWarehouseLog);
  15686. __definePage("pages/waybillNo/index", PagesWaybillNoIndex);
  15687. __definePage("pages/waybillNo/waybillNoLog", PagesWaybillNoWaybillNoLog);
  15688. __definePage("pages/waybillDeliveryOrder/index", PagesWaybillDeliveryOrderIndex);
  15689. __definePage("pages/waybillDeliveryOrder/orderInfo", PagesWaybillDeliveryOrderOrderInfo);
  15690. __definePage("pages/printer/index", PagesPrinterIndex);
  15691. const _sfc_main = {
  15692. onLaunch: function() {
  15693. formatAppLog("log", "at App.vue:4", "App Launch");
  15694. },
  15695. onShow: function() {
  15696. formatAppLog("log", "at App.vue:7", "App Show");
  15697. },
  15698. onHide: function() {
  15699. formatAppLog("log", "at App.vue:10", "App Hide");
  15700. }
  15701. };
  15702. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "E:/HBuilderProjects/YTAPP/App.vue"]]);
  15703. function createApp() {
  15704. const app = vue.createVueApp(App);
  15705. return {
  15706. app
  15707. };
  15708. }
  15709. const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
  15710. uni.Vuex = __Vuex__;
  15711. uni.Pinia = __Pinia__;
  15712. __app__.provide("__globalStyles", __uniConfig.styles);
  15713. __app__._component.mpType = "app";
  15714. __app__._component.render = () => {
  15715. };
  15716. __app__.mount("#app");
  15717. })(Vue);