uformd.js 697 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839
  1. ///<jscompress sourcefile="Onload.js" />
  2. //------------------------------------------------------------------------------------用户桌面和程序数据初始化区域----------------------------------------------------------------------------------------------------------------
  3. Namespace.register("U.MD.D"); //桌面onload和桌面总控的命名空间
  4. /*
  5. window.onload的流程:
  6. 1、自由属性的设置,例如:页面识别id。允许浏览器多页面浏览www.1473.cn
  7. 2、加载各种事件绑定,如:页面大小监视,不允许选择桌面文字,ie7以下浏览器页面提示
  8. 3、加载桌面图标。
  9. 4、加载跨域设置,如果没有跨域,首页数据无法获取
  10. 4、加载首页
  11. 5、加载广告,QQ登录等外链。
  12. UD和UC区别 uc是框架函数 ud为操作系统原壳 这里的简化的目标很简单 只要有人应用ud 就会引用一个web操作系统 提供操作系统的功能应用
  13. 难题 :
  14. 1、命名和用户冲突 会导致原web系统不可使用
  15. 2、函数冲突 如 用户自带window.resize这样的函数 我们提供了接口 但是这个接口的的暴露性可见性体现出文档的重要 宣传文档也就是文宣的重要性高了
  16. 3、有参数注释的都为暴露接口类型 其他都为内部使用 更好的体现方式
  17. */
  18. //#region 配置区域,相当于全局变量定义
  19. U.MD.D.IsUseStudio = (window.location.host.indexOf("www.1473.cn") > -1 ||
  20. window.location.host.indexOf("m.1473.cn") > -1 ||
  21. window.location.host == "1473.cn" ||
  22. window.location.host.indexOf("www.boomyun.com") > -1 ||
  23. window.location.host == "boomyun.com"); //此处为判断是否是我们主域名 我们分为两个域名 一个为www.1473.cn 一个为www.bomyun.com
  24. //本地存储类
  25. U.MD.D.LocalStorage = null;
  26. //#endregion
  27. //#region onload处理
  28. /**
  29. * 系统初始化处理
  30. *
  31. * @param {function} 在外部项目应用该项目的时候 可以传入cb这个参数,如果传入了这个参数在回调跨域main.1473.cn加载成功会就会直接回调
  32. */
  33. window.onload = function () {
  34. U.MD.D.Load();
  35. }
  36. /**
  37. * 供外部调用的window.onload函数云端系统启动项
  38. *
  39. * @param {function} 在外部项目应用该项目的时候 可以传入cb这个参数,如果传入了这个参数在回调跨域main.1473.cn加载成功会就会直接回调
  40. */
  41. U.MD.D.Load = U.MD.D.FLoad = function (cb) {
  42. //这里判断是如果是www.1473.cn 或者 www.boomyun.com项目的时候 或者是 通过ufrom的跨域函数加载成功页面时候可以执行window.onload, 添加判断的目的主要是反正 其他项目引用uformd的时候自动执行window.onload报错。
  43. //当引用云端硬盘,好友模块时需要在自己的js文件中添加window.onload入口函数,否则会触发云端的window.onload,导致系统报错,
  44. //初始化桌面,如果是1473主站点那么初始化桌面系统,否则外部引入1473不加载桌面
  45. //系统初始化、第一个就是加载桌面,然后初始化全局变量、绑定事件、最后加载数据(加载数据需要跨域加载,因为项目分离的原因,我们有disk.1473.cn、user.1473.cn、firend.1473.cn里面有静态数据,还有动态的后台)
  46. if (U.MD.D.IsUseStudio) {
  47. //桌面初始化弹出
  48. U.selectEl("#UD_Dtop")[0].style.display = "block";
  49. //桌面做为一个置底的窗体
  50. new U.UF.UI.form(false, U.selectEl("#UD_Dtop")[0], { onresize: false, style: { "cssText": "width:100%;height:100%;padding:0;border:0;border-radius:0;box-shadow:0;position:static;" }, "className": "" },
  51. { istop: false, isdrag: false, isdrag: false, isstretching: false, isenlarge: false, isnarrow: false, isclose: false }, null, { style: { "padding": "0" } });
  52. }
  53. //这里加判断的原因是怕有开发者开发的过程中直接调用uformd.js没有写跨域加载,没有写window.onload导致再运行的过程中找不到元素报错
  54. if ($("#U_MD_Home")[0]) {
  55. //设置页面大小等的全局变量
  56. U.MD.D.settingGlobalVariables();
  57. //浏览器事件监视及处理
  58. U.MD.D.addEvents();
  59. var _browserinfo = U.UF.CI.getBrowser(); //获取浏览器
  60. //ie7以下的浏览器弹出不兼容的处理
  61. if (_browserinfo["browser"] == "msie" && parseInt(_browserinfo["ver"]) < 7) {
  62. //弹出不兼容的处理
  63. U.MD.D.A.browserCompatibleForm();
  64. }
  65. }
  66. //跨域加载
  67. U.MD.D.crossDomain(cb); //跨域初始化,里面包含了用户登录
  68. }
  69. /**
  70. * 设置当前使用页面大小
  71. */
  72. U.MD.D.settingGlobalVariables = function () {
  73. //获取页面的大小
  74. var _size = U.selectEl("body").getElementInfo();
  75. US.height = _size["CH"]; //获取高度
  76. US.width = _size["CW"]; //获取宽度
  77. //1473的登录识别id
  78. US.systemId = 1;
  79. //页面识别id 页面唯一的识别 作为用户访问1473的唯一识别码,在之前用户获取聊天室的信息的唯一识别码
  80. US.pageId = Guid.newGuid();
  81. }
  82. /**
  83. * 系统监视
  84. */
  85. U.MD.D.addEvents = function () {
  86. //页面活动状态监视,失焦的时候停止五秒刷新,聚焦的时候开始刷新
  87. U.UF.EV.IsActivity(U.MD.D.focus, U.MD.D.blur);
  88. //监视页面的点击 使得窗体点击为顶部
  89. U.UF.F.clickTopWindow();
  90. //页面大小变化监视
  91. window.onresize = U.MD.D.reSize;
  92. //如果是云端1473则屏蔽菜单和错误弹框
  93. if (U.MD.D.IsUseStudio) {
  94. if (window.print) { //判断是否有右键菜单
  95. document.oncontextmenu = U.UF.EV.stopDefault; //阻止桌面右键默认菜单
  96. }
  97. document.onselectstart = U.UF.C.shieldedSelect; //禁止文本选择处理
  98. U.UF.EV.addElementEvent("keydown", document, U.UF.C.shieldedBackspace); //禁止浏览器回退
  99. window.onerror = U.MD.D.error; //错误提示屏蔽
  100. }
  101. //允许错误提示和右键菜单
  102. else {
  103. window.onerror = null;
  104. }
  105. //页面路由事件处理
  106. U.UF.N.route(U.MD.N.urlGuide);
  107. }
  108. /**
  109. * 页面大小变化时,需要重新排列图标及任务栏大小的变化.
  110. */
  111. U.MD.D.reSize = function () {
  112. //处理窗体区域 随着页面大小变化而变化
  113. U.UF.UI.form.windowResize();
  114. //页面变化处理
  115. //获取页面的大小
  116. var _size = U.selectEl("body").getElementInfo();
  117. US.height = _size["CH"]; //获取高度
  118. US.width = _size["CW"]; //获取宽度;
  119. //任务栏处理
  120. if ($("#U_MD_D_RW")) {
  121. U.selectEl("#U_MD_D_RW").css("width", US.width - 165 + "px");
  122. U.MD.D.T.taskbar.multitask($("#U_MD_D_RW")[0]);
  123. //桌面图标处理
  124. U.MD.D.iconPostion($("#U_MD_D_K").Child());
  125. }
  126. }
  127. /**
  128. * 跨域引入1473
  129. * @param {function} 跨域加载成功后的回调函数
  130. */
  131. U.MD.D.crossDomain = function (cb) {
  132. //跨域加载,如果是1473的跨域,那么则添加跨域的iframe处理
  133. if (document.domain == "1473.cn") {
  134. U.UF.CD.loadAjaxCrossDomain(function () {
  135. U.MD.D.loadApplication(cb);
  136. });
  137. }
  138. //如果是非1473的跨域,添加跨域的iframe
  139. else {
  140. U.UF.CD.thirdPartyLoadAjaxCrossDomain(function () {
  141. U.MD.D.loadApplication(cb);
  142. });
  143. }
  144. }
  145. /**
  146. * 加载user 、 friend 、disk的js
  147. */
  148. U.MD.D.loadApplication = function (cb) {
  149. U.UF.CD.loadApplication(function () {
  150. U.MD.D.asynCrossDomain(cb);
  151. });
  152. }
  153. /**
  154. * 域名加载成功后异步 此处可正式获取数据
  155. * @param {function} 跨域加载成功后的回调函数
  156. */
  157. U.MD.D.asynCrossDomain = function (cb) {
  158. //初始化url的处理
  159. U.MD.N.urlGuide();
  160. //通过cookie登录
  161. U.MD.U.L.cookieLogin();
  162. //如果是1473则弹出1473的首页
  163. if (U.MD.D.IsUseStudio) {
  164. U.MD.D.I.openApplication("boomYun");
  165. }
  166. //其它模块加载处理
  167. U.MD.D.otherModularLoad();
  168. //添加用户访问记录
  169. U.UF.CI.getUserLocation(U.MD.D.visitLog);
  170. //桌面开始点,起始函数
  171. if ($("#UD_Dtop")[0]) {
  172. U.MD.D.I.init();
  173. }
  174. //如果其他站点进入1473,这里是引入成功的回调处理
  175. if (U.UF.C.isFunction(cb)) {
  176. cb(); //回调处理
  177. }
  178. }
  179. /**
  180. * 其它模块的加载
  181. */
  182. U.MD.D.otherModularLoad = function () {
  183. //计时器消息初始化 每个3秒刷一次消息
  184. U.MD.C.T.onesetInterval();
  185. //加载如广告 各模块加载
  186. U.MD.D.thirdPartyLoad(); //页面插件加载
  187. //html5本地存储,暂时用来完成本地页面交互消息 作用共享页面信息,还未完善。
  188. //U.MD.D.record();
  189. }
  190. /**
  191. * 第三方广告和登录加载处理
  192. */
  193. U.MD.D.thirdPartyLoad = function () {
  194. //阿里巴巴广告加载
  195. // U.UF.DL.C.AD.alimama([
  196. // { pid: "mm_32325420_3265865_24254681", appkey: "", unid: "" },
  197. // { pid: "mm_32325420_3265865_14752067", appkey: "", unid: "" },
  198. // { pid: "mm_32325420_3265865_24246760", appkey: "", unid: "" },
  199. // { pid: "mm_32325420_3265865_24254681", appkey: "", unid: ""}]);
  200. //qq登录加载按钮
  201. // U.MD.U.OT.qqLoadJs({ btnId: "U_MD_U_L_login_O_T_app_QQ", size: "C_S" });
  202. //微博登录加载按钮
  203. // U.MD.U.OT.weiboLoadJs({ id: "U_MD_U_L_login_O_T_app_I", type: "3,2", show_head: false, show_name: false, show_cancel: false,
  204. // callback: { login: U.MD.U.OT.weiboLoginCallBack }
  205. // });
  206. //百度统计加载
  207. // U.UF.DL.C.AD.onloadBaiduJs("1fce47ee7e8655ddd108fca7116f0752");
  208. // U.UF.DL.C.AD.onloadBaiduJs("f0ececeb4f687bc4d4ffb7719f4cf6a7");
  209. }
  210. /**
  211. * 写入访问用户信息
  212. */
  213. U.MD.D.visitLog = function () {
  214. U.A.Request(US.USER, ["AddToLoginLog", US.userInfo.UserId || US.EMPTYGUID, US.city.userAllLocation || ""], function () { }); //访问日志添加消息
  215. }
  216. //#endregion
  217. //#region 页面事件处理
  218. //关闭页面处理 把页面的活动数-1
  219. window.onunload = function () {
  220. try {
  221. var _userinfo = US.userInfo;
  222. if (U.MD.D.LocalStorage) {
  223. var _count = U.MD.D.LocalStorage.get("ati") || 0;
  224. if (_count > 0) { _count-- };
  225. U.MD.D.LocalStorage.set("ati", _count); //这是活动用户-1
  226. }
  227. if (_userinfo.UserId && U.A) { //在状态中让这个活动用户下线
  228. U.A.Request(US.USER, ["UserOffline", _userinfo.UserId], function () { }, []);
  229. }
  230. }
  231. catch (e) { }
  232. }
  233. //错误处理,前端错误需要在控制台输出,同时提交到错误数据库
  234. //window.onerror = function(sMessage,sUrl,sLine,columnNumber,errorObj){};
  235. //onerror函数的五个参数用于确定错误确切的信息,代表的意思依次为:
  236. //* @param {String} errorMessage errorMessage 错误信息
  237. //* @param {String} scriptURI 出错的文件
  238. //* @param {Long} lineNumber 出错代码的行号
  239. //* @param {Long} columnNumber 出错代码的列号
  240. //* @param {Object} errorObj 错误的详细信息,Anything
  241. U.MD.D.error = function (errorMessage, scripturi, linenumber, columnnumber, errorobj) {
  242. errorobj = errorobj || {}; //屏蔽js错误
  243. U.A.Request(US.USER, ["SetError", 0, (event.errorMessage || event || errorMessage), (scripturi || event.filename || event.errorUr) + "。行号:" + (linenumber || event.lineno || event.errorLine)], function () { }, []); //错误消息发送到数据库
  244. U.UF.C.console(event.errorMessage || event || errorobj); //console 输出错误信息
  245. return true; //不让浏览器弹出错误报告,浏览器会弹出一个comfirm的错误。
  246. }
  247. //#endregion
  248. //#region 获取ifram下的html
  249. U.MD.D.getIfraemHtml = function (src) {
  250. var _iframe = $$("iframe", { src: src, style: { display: "none" } });
  251. //跨域回调设置
  252. U.UF.DL.iframeLoad(_iframe, function () {
  253. var _html = _iframe.contentWindow.document.body.innerHTML;
  254. console.log(_html);
  255. U.selectEl(_iframe).remove();
  256. });
  257. U.selectEl(_iframe).appendTo($('body')[0]);
  258. };
  259. //#endregion
  260. ;
  261. ///<jscompress sourcefile="Desktop.js" />
  262. /*
  263. 此处为桌面系统启动应用区域
  264. */
  265. Namespace.register("U.MD.D.I"); //桌面应用处理
  266. //判断图片是否在拖拽,如果是拖拽图标的过程是不会打开图片的
  267. U.MD.D.I.IsDrag;
  268. //桌面图标的全局变量
  269. U.MD.D.I.DeskIcon = [
  270. // { "Name": "我的云盘", "Url": "disk", "Img": { "x": "-15", "y": "-296"} },
  271. // { "Name": "互联办公", "Url": "boomYun", "Img": { "x": "-844", "y": "-419"} },
  272. // { "Name": "Word", "Url": "word", "Img": { "x": "-462", "y": "-296"} },
  273. // { "Name": "Execl", "Url": "excel", "Img": { "x": "-523", "y": "-296"} },
  274. // { "Name": "文本文件", "Url": "txt", "Img": { "x": "-267", "y": "-413"} },
  275. // { "Name": "我的好友", "Url": "friend", "Img": { "x": "-648", "y": "-297"} },
  276. // { "Name": "查找好友", "Url": "lookupFriend", "Img": { "x": "-85", "y": "-413"} },
  277. // { "Name": "我的设置", "Url": "set", "Img": { "x": "-400", "y": "-296"} },
  278. // { "Name": "系统设置", "Url": "systemSet", "Img": { "x": "-144", "y": "-413"} },
  279. // { "Name": "云端下载", "Url": "client", "Img": { "x": "-648", "y": "-357"} },
  280. // { "Name": "云端产品", "Url": "xz", "Img": { "x": "-24", "y": "-413"} }
  281. // { "Name": "FTP", "Url": "ftp", "Img": { "x": "-24", "y": "-413"} },
  282. // { "Name": "群文档", "Url": "group", "Img": { "x": "-85", "y": "-413"} },
  283. // { "Name": "web编程", "Url": "frontEndProgramming", "Img": { "x": "-275", "y": "-297"} },
  284. // { "Name": "后端编程", "Url": "backEndProgramming", "Img": { "x": "-275", "y": "-297"} },
  285. { "Name": "项目管理", "Url": "projectList", "style": { "backgroud": "url(../img/icon/project.png)" } },
  286. { "Name": "学生列表", "Url": "studentList", "style": { "backgroud": "url(../img/icon/student.png)" } },
  287. ];
  288. //#region 桌面初始化
  289. /**
  290. * 初始化桌面的起始函数
  291. *
  292. */
  293. U.MD.D.I.init = function () {
  294. if ($("#U_MD_D_K")[0]) {
  295. //初始化桌面图标
  296. U.MD.D.I.initDesktopIcons($("#U_MD_D_K")[0]);
  297. //初始化任务栏,因为是静态的,所以直接改变样式即可.
  298. U.selectEl("#U_MD_D_RW").css("width", US.width - 165 + "px");
  299. }
  300. }
  301. /**
  302. * 隐藏任务栏
  303. *
  304. * @param {element} 桌面元素
  305. */
  306. U.MD.D.I.hiddenTaskbar = function (el) {
  307. //任务栏位置变小
  308. U.selectEl(el).parentElement(3).css({ "bottom": "-63px" });
  309. //桌面的位置变大
  310. // U.selectEl("#U_MD_D_K").css({ "left": "5px" });
  311. }
  312. /**
  313. * 初始化打印桌面图标
  314. *
  315. * @param {element} 桌面元素
  316. */
  317. U.MD.D.I.initDesktopIcons = function (el) {
  318. var i, //用于循环
  319. _content, //桌面图标元素
  320. _iconcontent, //桌面图标元素
  321. _frag = $$("frag"), //定义一个碎片元素
  322. _DesktopIconInfo = U.MD.D.I.DeskIcon; //获取桌面图标
  323. //清楚桌面图标
  324. el.innerHTML = "";
  325. //循环创建桌面图标
  326. for (i = 0; i < _DesktopIconInfo.length; i++) {
  327. _content = $$("div", {
  328. className: "U_MD_D_KO",
  329. "onmousedown": U.UF.C.closure(function (obj) {
  330. //防止拖动图标即打开了桌面应用
  331. U.MD.D.click(this, obj);
  332. }, [_DesktopIconInfo[i]]),
  333. "onclick": U.UF.C.closure(function (obj) {
  334. //防止拖动图标即打开了桌面应用
  335. U.MD.D.click(this, obj);
  336. }, [_DesktopIconInfo[i]])
  337. }, _frag); //
  338. _iconcontent = $$("div", { className: "U_MD_D_KOA" }, _content);
  339. $$("div", { className: "U_MD_D_KOS U_Img", "style": { "backgroundPosition": _DesktopIconInfo[i].Img.x + "px " + _DesktopIconInfo[i].Img.y + "px" } }, _iconcontent);
  340. $$("div", { className: "U_MD_D_KOX", "style": { "cssText": "text-shadow: #000 2px 1px 3px,#666 0 1px 0,#555 -1px 0 0,#999 0 -1px 0; -webkit-text-shadow: #333 1px 0 0,#666 0 1px 0,#555 -1px 0 0,#999 0 -1px 0; -moz-text-shadow: #333 1px 0 0,#666 0 1px 0,#555 -1px 0 0,#999 0 -1px 0; filter: Glow(color=#777777, strength=1)\9;" }, "innerHTML": _DesktopIconInfo[i].Name }, _iconcontent);
  341. }
  342. //加载好后给图标定位
  343. U.MD.D.iconPostion($(_frag).Child());
  344. //把图标加载到页面
  345. el.appendChild(_frag);
  346. }
  347. /**
  348. * 显示任务栏
  349. *
  350. * @param {element} 桌面元素
  351. */
  352. U.MD.D.I.displayTaskbar = function (el) {
  353. //判断是否需要形式任务栏,由于用了mouseover事件会冒泡响应多次,这里做了过滤
  354. if (!U.UF.EV.stopBubbleMouseOutOrOver(el) && U.selectEl(el).css("bottom") != "0px") {
  355. //任务栏位置变化
  356. U.selectEl(el).css({ "bottom": "0px" });
  357. //桌面位置变话
  358. // U.selectEl("#U_MD_D_K").css({ "left": "70px" });
  359. }
  360. }
  361. //#region 桌面图标拖动逻辑
  362. /**
  363. * 桌面排列图标
  364. *
  365. * @param {element} 桌面元素
  366. * @param {object} 上下相距的距离
  367. * @param {object} 左右相距的距离
  368. * @return {object} 命名空间
  369. */
  370. U.MD.D.iconPostion = function (childs, top, left) {
  371. var i; //用于循环处理
  372. top = top || 15; //如果没有设置元素的间距处理默认上间距为15
  373. left = left || 20; //如果没有设置元素的间距处理默认左间距为15
  374. //循环所有的图标,设置每个图标的间距,打印顺序是竖排打印的方式
  375. for (i = 0; i < childs.length; i++) {
  376. //如果竖排top超过了范围处理
  377. if (top + 95 > US.height - 85) {
  378. //left超过了页面范围处理,则向上重叠打印处理
  379. if ((left + 180) > US.width) {
  380. top -= 115;
  381. left -= 90;
  382. }
  383. //没有超过范围,那么left+90添加到下一个竖排打印
  384. else {
  385. left += 90;
  386. top = 15;
  387. };
  388. }
  389. //给图标的位置赋值
  390. U.selectEl(childs[i]).css({ top: top + "px", left: left + "px" });
  391. if (i < childs.length - 1) {
  392. //页面图标每次向下加115
  393. top += 115;
  394. }
  395. }
  396. //返回最后调用的图标的位置
  397. return [top, left];
  398. }
  399. /**
  400. * 桌面点击事件逻辑
  401. *
  402. * @param {element} 桌面元素
  403. * @param {object} 上下相距的距离
  404. * @param {object} 左右相距的距离
  405. * @return {object} 命名空间
  406. */
  407. U.MD.D.click = function (el, obj) {
  408. var _buttonnumber = event.button; //点击的按钮的事件值
  409. U.UF.EV.stopBubble(); //阻止向上冒泡
  410. //onmousedown 包含了左键和右键 这里大于2是为了兼容 所有浏览器的右键处理
  411. if (_buttonnumber < 2) {
  412. //如果是click事件的处理
  413. if (event.type == "click") {
  414. //如果元素在mousemove事件中没有移动则出发click事件
  415. if (!U.MD.D.I.IsDrag) {
  416. //打开应用处理
  417. U.MD.D.I.openApplication(obj.Url, { "userid": US.userInfo.UserId, "directoryid": US.FTPFOLDERID });
  418. }
  419. }
  420. //如果是mouse事件的处理
  421. else {
  422. //拖动处理,添加拖动和拖动结束事件
  423. U.UF.F.drag(el, U.MD.D.iconMove, U.MD.D.iconUp);
  424. }
  425. U.MD.D.I.IsDrag = false;
  426. }
  427. }
  428. /**
  429. * 拖动的处理
  430. *
  431. */
  432. U.MD.D.iconMove = function () {
  433. //如果当前位置点击初始化的位置出现了变化,则设置是否拖动的属性 U.MD.D.I.IsDrag为true
  434. U.MD.D.I.IsDrag = true;
  435. }
  436. /**
  437. * 拖动结束后,这里是定位处理,以网状的形式定位
  438. *
  439. * @param {element} 拖动的元素
  440. * @return {object} 命名空间
  441. */
  442. U.MD.D.iconUp = function (el) {
  443. var _top = 15,
  444. _left = 20,
  445. _margin,
  446. _childs = U.selectEl("#U_MD_D_K").Child(), //桌面所有的图标
  447. _positioninfo = U.UF.EL.getElementInfo(el); //获取拖动结束的元素的位置
  448. if (_positioninfo["OT"] > 15) {
  449. //网状的形式定位,如果差超过了55,那么向下定位,否则向上定位
  450. _margin = ((_positioninfo["OT"] - 15) % 115 > 55 && _positioninfo["OT"] + 115 < US.height) ? 1 : 0;
  451. _top = (Math.floor((_positioninfo["OT"] - 15) / 115) + _margin) * 115 + 15;
  452. }
  453. if (_positioninfo["OL"] > 20) {
  454. //网状的形式定位,如果差超过了90,那么向右定位,否则向左定位
  455. _margin = ((_positioninfo["OL"] - 20) % 90 > 45 && _positioninfo["OL"] + 90 < US.width) ? 1 : 0;
  456. _left = (Math.floor((_positioninfo["OL"] - 20) / 90) + _margin) * 90 + 20
  457. }
  458. //while循环判断么一个重叠的元素
  459. do {
  460. _positioninfo = U.MD.D.iconPostion([el], _top, _left); //给重叠的元素向下定位
  461. _top = _positioninfo[0] + 115; //得到定位后的top
  462. _left = _positioninfo[1]; //得到定位后的left
  463. } while (el = U.MD.D.isOverlap(el, _childs, _positioninfo))
  464. }
  465. /**
  466. * 判断拖动后图标是否重叠
  467. *
  468. * @param {element} 拖动的元素
  469. * @param {element} 桌面所有的元素
  470. * @param {array} 拖动元素的位置
  471. ----------[0] 上 top
  472. ----------[1] 左 left
  473. * @return {object} 命名空间
  474. */
  475. U.MD.D.isOverlap = function (el, childs, postionarray) {
  476. //循环所有的图标
  477. for (var i = 0; i < childs.length; i++) {
  478. //判断有没有和该图标诶子重叠的元素
  479. if (el != childs[i] && (childs[i].offsetTop == postionarray[0] && childs[i].offsetLeft == postionarray[1])) {
  480. return childs[i]; //如果有返回
  481. }
  482. }
  483. }
  484. //#endregion
  485. //#endregion
  486. //#region 桌面应用
  487. /**
  488. * 打开应用
  489. *
  490. * @param {string} 类型
  491. -----------------Disk 网盘系统
  492. -----------------PDisk 学习系统网盘
  493. -----------------Poto 图片
  494. -----------------Video 视频
  495. -----------------Music 音乐
  496. -----------------Word word
  497. -----------------Excel excel
  498. -----------------Txt 记事本
  499. -----------------PB 学习系统
  500. -----------------Blog 朋友圈系统
  501. -----------------FTP ftp系统
  502. -----------------Group 好友群
  503. -----------------SY 首页系统
  504. -----------------Set 个人设置
  505. -----------------XSet 系统设置
  506. -----------------App 我们所有的app
  507. -----------------BC c.1473.cn 平台
  508. -----------------CWeb d.1473.cn 变成平台
  509. -----------------其他的外联系统 我们统一用iframe打开
  510. * @param {array} 类型
  511. 如果第一个参数为"disk",则第二个参数为object,里面包含了用户id和目录id{userid:"",directoryid:""}
  512. 如果第一个参数为"word"或者"excel","txt",则第二个参数为文件信息fileinfo。
  513. 如果第一个参数为"blog"或者"PDisk"。建议删除。
  514. 如果第一个参数为其他,则无第二个参数
  515. * @returns {array}
  516. */
  517. U.MD.D.I.openApplication = function (str, obj, info) {
  518. obj = obj || {};
  519. var _taskbar, //_taskbar 作为任务栏显示的元素,包含图标和名字
  520. _formdiv, //创建任务栏时同时弹出的窗体元素。
  521. _userinfo = US.userInfo, //登录用户信息
  522. _userid = obj.userid || _userinfo.UserId //登录用户id
  523. ;
  524. //选择应用处理
  525. switch (str) {
  526. case "friend": //好友打开
  527. U.MD.D.I.IsDrag = true;
  528. U.MD.F.W.viewFriend(info); //打开好友
  529. // U.MD.N.urlWrite("friend/" + obj.directoryid, "好友"); //好友的url重写
  530. break;
  531. case "domain":
  532. var _iframe = $$('iframe', { src: '//domain.1473.cn/DomainSystem.aspx/?fileId=' + info.fileId + '&type=' + info.type + '&mode=' + info.mode, frameborder: "0", style: { cssText: "width:100%;height:100%;border:0px" } });
  533. _formdiv = new U.UF.UI.form("域名管理", _iframe, { id: "U_MD_DS_DomainShare", style: { "width": "370px", "height": "390px" } }).form;
  534. if (_formdiv) {
  535. //生成任务栏的变量
  536. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-15px -296px", "name": "网盘", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj, info); } }
  537. }
  538. break;
  539. case "disk": //个人网盘查看
  540. _formdiv = U.MD.DK.initDisk(_userid, obj.directoryid); //根据网盘数据,并加载网盘,里面包含了url重写
  541. if (_formdiv) {
  542. //生成任务栏的变量
  543. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-15px -296px", "name": "网盘", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  544. }
  545. break;
  546. case "word": //Word打开
  547. var _wordinfo = U.MD.O.word(_userinfo, obj, arguments[2]); //初始化word的处理
  548. _formdiv = _wordinfo[0];
  549. if (_formdiv) {
  550. //生成任务栏的变量
  551. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-462px -296px", "name": "文档", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, _wordinfo[1]); } }
  552. }
  553. if (obj.UrlType != 'join') {
  554. U.MD.N.urlWrite("word/" + _formdiv.id.substr(-36), "在线文档"); //word的url重写
  555. }
  556. break;
  557. case "excel": //Excel打开
  558. _formdiv = U.MD.O.excel(_userinfo, obj);
  559. if (_formdiv) {
  560. //生成任务栏的变量
  561. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-523px -296px", "name": "在线表格", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  562. }
  563. U.MD.N.urlWrite("excel/" + _formdiv.id.substr(-36), "在线表格");
  564. break;
  565. case "txt": //Txt打开
  566. _formdiv = U.MD.D.Txt.textCreate();
  567. if (_formdiv) {
  568. //生成任务栏的变量
  569. _taskbar = { "id": str + obj.directoryid, "backgroundPostion": "-267px -413px", "name": "在线文本", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  570. }
  571. U.MD.N.urlWrite("txt/" + _formdiv.id.substr(-36), "在线文本");
  572. break;
  573. case "lookupFriend":
  574. _formdiv = U.MD.F.S.popSearchFriendsOrGroupForm(0);
  575. //生成任务栏的变量
  576. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-85px -413px", "name": "查找好友", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  577. U.MD.N.urlWrite("lookupfriend/" + obj.directoryid.substr(-36), "查找好友"); //查找好友的url重写
  578. break;
  579. case "ftp": //Ftp
  580. _formdiv = U.MD.F.S.popupsSearchFtp();
  581. //生成任务栏的变量
  582. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-144px -413px", "name": "FTP", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  583. break;
  584. case "group": //群组
  585. _formdiv = U.MD.F.S.popupsSearchGroups(0);
  586. //生成任务栏的变量
  587. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-85px -413px", "name": "群组", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  588. break;
  589. case "set": //个人设置
  590. _formdiv = U.MD.U.P.userDataSet();
  591. if (_formdiv) {
  592. //生成任务栏的变量
  593. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-400px -296px", "name": "个人设置", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  594. }
  595. break;
  596. case "systemSet": //系统设置
  597. _formdiv = U.MD.D.B.init();
  598. //生成任务栏的变量
  599. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-400px -296px", "name": "系统设置", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  600. break;
  601. case "boomYun": //BoomYun
  602. _formdiv = U.Boom.I.onload();
  603. //生成任务栏的变量
  604. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-844px -419px", "name": "互联办公", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  605. U.MD.N.urlWrite("boomyun", "互联办公"); //boomyun的url重写
  606. break;
  607. case "xz": //App下载
  608. window.open("http://xz.1473.cn");
  609. break;
  610. case "client": //App下载
  611. window.open("http://client.1473.cn");
  612. break;
  613. case "backEndProgramming": //在线编程平台打开
  614. window.open("http://c.1473.cn");
  615. break;
  616. case "frontEndProgramming": //在线web编程
  617. window.open("http://d.1473.cn");
  618. break;
  619. default: break;
  620. }
  621. //如果有任务栏信息
  622. if (_taskbar) {
  623. U.MD.D.T.taskbar(_taskbar); //创建任务处理
  624. }
  625. }
  626. //#endregion
  627. ;
  628. ///<jscompress sourcefile="taskbar.js" />
  629. /**
  630. * 任务栏管理系统
  631. */
  632. Namespace.register("U.MD.D.T.taskbar"); //任务栏 命名空间
  633. /**
  634. * 任务管理函数
  635. * @param applyinfo {object} 任务信息
  636. * 形如:{
  637. * id: _taskId, //任务识别id
  638. * backgroundPostion: _taskbar[0], //任务图标定位
  639. * name: _taskbar[1], //任务名称
  640. * forms: _taskbar[2], //任务所在的窗体
  641. * click: function () { U.MD.D.I.openApplication(str, obj); } //任务点击打开的函数
  642. * }
  643. * @param taskbarEle 任务管理器所在的元素 默认为$("#U_MD_D_T_taskbar_Bar_Main")[0]元素
  644. */
  645. U.MD.D.T.taskbar = function (applyinfo, taskbarEle) {
  646. taskbarEle = taskbarEle || U.selectEl("#U_MD_D_RW")[0]; //任务管理器所在的元素
  647. var _tasks = U.selectEl('#U_MD_D_T_taskbar_' + applyinfo.id, taskbarEle)[0]; //查找当前任务是否存在
  648. //如果不存在则创建任务
  649. if (!_tasks) {
  650. //创建任务
  651. U.MD.D.T.taskbar.create(applyinfo, taskbarEle);
  652. //检查任务是否过多
  653. U.MD.D.T.taskbar.multitask(taskbarEle);
  654. }
  655. else {
  656. _tasks.forms = applyinfo.forms;
  657. }
  658. }
  659. //是否触发拖动监听变量
  660. U.MD.D.T.taskbar.drag = 0;
  661. /**
  662. * 任务创建函数
  663. * @param applyinfo {object} 任务信息 与任务管理函数参数相同
  664. * @param taskbarEle {element} 任务管理器所在的元素 默认为$("#U_MD_D_T_taskbar_Bar_Main")[0]元素 与任务管理函数参数相同
  665. */
  666. U.MD.D.T.taskbar.create = function (applyinfo, taskbarEle) {
  667. //动态创建任务
  668. var _task = $$("div", { id: "U_MD_D_T_taskbar_" + applyinfo.id, className: "U_MD_D_BZMO", title: applyinfo.name, "forms": applyinfo.forms });
  669. var _taskMain = $$("div", {
  670. className: "U_MD_D_BZMOA",
  671. //绑定点下事件 勇于拖动监听
  672. onmousedown: U.UF.C.apply(null, function () { U.MD.D.T.taskbar.dragClose(_taskMain); }),
  673. //绑定点击事件 需判断是否在拖动状态
  674. onclick: function () {
  675. if (!(U.MD.D.T.taskbar.drag > 1)) {
  676. applyinfo.click();
  677. }
  678. U.MD.D.T.taskbar.drag = 0;
  679. }
  680. }, _task);
  681. //动态创建任务图标
  682. $$("div", { className: "U_MD_D_BZMOI U_Img", style: { backgroundPosition: applyinfo.backgroundPostion } }, _taskMain);
  683. //动态创建任务名称
  684. // $$("div", { className: "U_MD_D_BZMON U_MD_D_Text_Abbreviation", innerHTML: applyinfo.name }, _taskMain);
  685. var _taskName = $$("div", {
  686. className: "U_MD_D_T_taskbar_Name",
  687. style: { "position": "absolute", "left": "-26px", "bottom": "83px" }/*,
  688. innerHTML: applyinfo.name*/
  689. }, _task);
  690. $$("div", {
  691. className: "U_MD_D_BZMON U_MD_D_Text_Abbreviation",
  692. style: { "float": "left", "width": "100px", "margin-top": "7%", "color": "#FFFFFF", "font-family": "MicrosoftYaHei" },
  693. innerHTML: applyinfo.name
  694. }, _taskName);
  695. $$("div", { className: "U_MD_D_T_taskbar_Close", style: { "display": "none" }, innerHTML: "x", onclick: function () { U.UF.EV.stopBubble(); U.MD.D.T.taskbar.close(applyinfo) } }, _taskMain);
  696. $$("div", { className: "U_MD_D_T_taskbar_Close", innerHTML: "x", onclick: function () { U.UF.EV.stopBubble(); U.MD.D.T.taskbar.close(applyinfo) } }, _taskName);
  697. //添加到任务栏的最前面
  698. if (taskbarEle) {
  699. U.selectEl(taskbarEle).append(_task, 0, taskbarEle.firstChild);
  700. }
  701. //任务栏中大于或等于28个时,才出现上下分页按钮;
  702. if ($(".U_MD_D_BZMOA").length >= 28) {
  703. U.selectEl(".U_MD_D_RW_R")[0].style.display = "block";
  704. } else {
  705. U.selectEl(".U_MD_D_RW_R")[0].style.display = "none";
  706. }
  707. }
  708. //当前页监听
  709. U.MD.D.T.taskbar.page = 1;
  710. //最大页码
  711. U.MD.D.T.taskbar.maxPage = 1;
  712. //每页最多放置任务数
  713. U.MD.D.T.taskbar.pageNum = 1;
  714. /**
  715. * 检查任务过多情况
  716. * @param taskbarEle {element} 任务管理器所在的元素 默认为$("#U_MD_D_T_taskbar_Bar_Main")[0]元素 与任务管理函数参数相同
  717. */
  718. U.MD.D.T.taskbar.multitask = function (taskbarEle) {
  719. //每页最多放置任务数
  720. U.MD.D.T.taskbar.pageNum = Math.floor($(taskbarEle).width() / 65);
  721. //获取所有任务
  722. var _tasks = U.selectEl(taskbarEle).Child();
  723. //获取任务总数
  724. var _tasksTotal = _tasks.length;
  725. //判断是否为多页情况
  726. if (_tasksTotal > U.MD.D.T.taskbar.pageNum) {
  727. //计算最大总共有多少页
  728. U.MD.D.T.taskbar.maxPage = Math.ceil(_tasksTotal / U.MD.D.T.taskbar.pageNum);
  729. }
  730. U.MD.D.T.taskbar.page = 1;
  731. U.MD.D.T.taskbar.switchPage(0);
  732. }
  733. /**
  734. * 多任务切换页面
  735. * @param mark {number} 页码标记 在前台页上加或者减多少页
  736. * @param taskbarEle {element} 任务管理器所在的元素 默认为$("#U_MD_D_T_taskbar_Bar_Main")[0]元素 与任务管理函数参数相同
  737. */
  738. U.MD.D.T.taskbar.switchPage = function (mark, taskbarEle) {
  739. //任务管理器位置
  740. taskbarEle = taskbarEle || U.selectEl("#U_MD_D_RW")[0];
  741. //页面切换设置
  742. U.MD.D.T.taskbar.page += mark;
  743. //页面最小值限制
  744. if (U.MD.D.T.taskbar.page < 1) { U.MD.D.T.taskbar.page = 1; }
  745. //页面最大值限制
  746. if (U.MD.D.T.taskbar.page > U.MD.D.T.taskbar.maxPage) { U.MD.D.T.taskbar.page = U.MD.D.T.taskbar.maxPage; }
  747. //获取所有任务
  748. var _tasks = U.selectEl(taskbarEle).Child();
  749. //计算当前页面从第几个任务开始显示
  750. var _startLength = (U.MD.D.T.taskbar.page - 1) * U.MD.D.T.taskbar.pageNum;
  751. //计算当前页面从第几个任务结束显示
  752. var _endLength = Math.min(U.MD.D.T.taskbar.page * U.MD.D.T.taskbar.pageNum, _tasks.length);
  753. //影藏所有任务
  754. U.selectEl($(taskbarEle).Child()).css('display', 'none');
  755. //循环显示当前页面的任务
  756. var i;
  757. for (_startLength; _startLength < _endLength; _startLength++) {
  758. U.selectEl(_tasks[_startLength]).css('display', 'block');
  759. }
  760. }
  761. /**
  762. * 任务关闭函数
  763. * @param applyinfo {object} 任务信息
  764. */
  765. U.MD.D.T.taskbar.close = function (applyinfo) {
  766. var i,
  767. _child = U.selectEl("#U_MD_D_RW").Child(),
  768. _form = U.UF.C.isElement(applyinfo.forms) ? applyinfo.forms : applyinfo.forms.form;
  769. //执行窗体关闭函数
  770. if (applyinfo.forms) {
  771. U.UF.F.closeWindow(_form, "remove");
  772. }
  773. //通过applyinfo删除的模式
  774. if (applyinfo.id) {
  775. //删除任务
  776. U.selectEl('#U_MD_D_T_taskbar_' + applyinfo.id).remove();
  777. }
  778. else {
  779. //循环找出需要移除的form窗体
  780. for (i = 0; i < _child.length; i++) {
  781. if (_child[i].forms == _form) {
  782. U.selectEl(_child[i]).remove();
  783. }
  784. }
  785. }
  786. }
  787. /**
  788. * 清空任务管理器
  789. * @param taskEle {Element} 任务管理器位置
  790. */
  791. U.MD.D.T.taskbar.clear = function (taskEle) {
  792. //任务管理器位置
  793. taskEle = taskEle || U.selectEl("#U_MD_D_RW")[0];
  794. //循环执行所有任务的关闭点击事件
  795. var _i, _tasksClose = U.selectEl('.U_MD_D_T_taskbar_Close', taskEle);
  796. for (_i = 0; _i < _tasksClose.length; _i++) {
  797. _tasksClose[_i].onclick();
  798. }
  799. }
  800. /**
  801. * 任务拖拽关闭函数
  802. * @param taskEle {Element} 被操作任务的元素
  803. */
  804. U.MD.D.T.taskbar.dragClose = function (taskEle) {
  805. U.MD.D.T.taskbar.drag = 0;
  806. //获取鼠标位置 定义该位置为起始位置
  807. //U.MD.D.T.taskbar.stratX = U.UF.EL.getMousePosition().x;
  808. U.MD.D.T.taskbar.stratY = U.UF.EL.getMousePosition().y;
  809. //记录当前样式
  810. U.MD.D.T.taskbar.preStyle = U.selectEl(taskEle).css('cssText');
  811. //设置元素绝对定位
  812. var _taskEleCssPostion = U.selectEl(taskEle).css("postion");
  813. if (_taskEleCssPostion == "static" || !_taskEleCssPostion) { U.selectEl(taskEle).css("position", "absolute") };//改G
  814. //设置置顶
  815. U.selectEl(taskEle).css("z-index", 9999);
  816. //绑定事件
  817. U.MD.D.T.taskbar.bindDragEvent(taskEle);
  818. }
  819. /**
  820. * 拖拽事件绑定
  821. */
  822. U.MD.D.T.taskbar.bindDragEvent = function (taskEle) {
  823. var _event = {
  824. "mousemove": function () {
  825. //执行拖拽事件
  826. U.MD.D.T.taskbar.dragMove(taskEle);
  827. //绑定鼠标离开元素事件,防止失焦后元素不受控制
  828. U.selectEl(taskEle).mouseleave(function () {
  829. U.MD.D.T.taskbar.dragEnd(taskEle);
  830. });
  831. //设置拖拽开始
  832. U.MD.D.T.taskbar.drag++;
  833. },
  834. "mouseup": function () {
  835. //执行拖拽结束函数
  836. U.MD.D.T.taskbar.dragEnd(taskEle);
  837. //解绑当前绑定的函数
  838. U.selectEl(taskEle).unbind(_event);
  839. //清楚
  840. U.selectEl(taskEle).mouseleave(null);
  841. }
  842. };
  843. //绑定事件
  844. U.selectEl(taskEle).bind(_event);
  845. }
  846. /**
  847. * 拖拽函数
  848. */
  849. U.MD.D.T.taskbar.dragMove = function (taskEle) {
  850. //计算拖动距离
  851. //U.MD.D.T.taskbar.dragX = U.UF.EL.getMousePosition().x - U.MD.D.T.taskbar.stratX;
  852. U.MD.D.T.taskbar.dragY = U.MD.D.T.taskbar.stratY - U.UF.EL.getMousePosition().y;
  853. //根据拖动距离计算透明度 最大拖动距离为100
  854. //var _opacity = 100 - U.MD.D.T.taskbar.dragX;
  855. var _opacity = 100 - U.MD.D.T.taskbar.dragY;
  856. //限制透明度值最小为1
  857. if (_opacity < 1) { _opacity = 1 };
  858. //设置CSS透明度属性
  859. U.selectEl(taskEle).css({
  860. //left: U.MD.D.T.taskbar.dragX + "px",
  861. bottom: U.MD.D.T.taskbar.dragY + "px",
  862. filter: "alpha(opacity=" + _opacity + ")",
  863. "-ms-filter": "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + _opacity + ")", //ie兼容设置
  864. "-moz-opacity": _opacity / 100,
  865. "-khtml-opacity": _opacity / 100, //其他浏览器兼容 firefox safari、chrome
  866. "opacity": _opacity / 100
  867. });
  868. }
  869. /**
  870. * 拖拽结束函数
  871. */
  872. U.MD.D.T.taskbar.dragEnd = function (taskEle) {
  873. if (U.MD.D.T.taskbar.dragY > 50) {
  874. //若拖动距离大于40则执行关闭任务函数
  875. U.selectEl('.U_MD_D_T_taskbar_Close', taskEle)[0].onclick();
  876. }
  877. else {
  878. //否则执行打开函数,并设置回元素的样式
  879. U.selectEl(taskEle).css("cssText", U.MD.D.T.taskbar.preStyle);
  880. //taskEle.click();
  881. }
  882. }
  883. $(window).bind('onsize', U.MD.D.T.taskbar.multitask);;
  884. ///<jscompress sourcefile="Background.js" />
  885. Namespace.register("U.MD.D.B"); //背景设置
  886. U.MD.D.B.url = "/img/background/ZMYT.jpg"; //默认背景设计图
  887. U.MD.D.B.backUrl = ""; //存放默认壁纸的全局变量
  888. /*
  889. * 作用: 弹出桌面背景框
  890. *
  891. */
  892. U.MD.D.B.init = function () {
  893. if ($("#U_MD_D_A_A")[0]) {//判断是否有系统图片
  894. return U.selectEl("#U_MD_D_A_A").css("display", "block")//显示系统图片
  895. }
  896. var _systemimg = U.selectEl("#U_MD_D_Set_BG").css("display", "block")[0]//显示系统图片
  897. //创建系统设置的弹窗
  898. var _system = new U.UF.UI.form("<div class='U_MD_F_S_TI'>系统设置</div>",
  899. _systemimg,
  900. {
  901. "id": "U_MD_D_A_A",
  902. "style": {
  903. "width": "746px",
  904. "height": "500px"
  905. }
  906. },
  907. {
  908. isnarrow: false,
  909. isenlarge: false
  910. }).form;
  911. U.MD.D.B.look(); //添加图片到_el
  912. return _system; //返回父级元素
  913. }
  914. /*
  915. * 作用: 打印默认可选择的背景图片
  916. *
  917. */
  918. U.MD.D.B.look = function () {
  919. var i, _img, _imgparent, //i循环所有图片 _img获取显示图片的div _imgparent获取创建包含图片的div层
  920. _frag = $$("frag"), //创建图片的最高级元素
  921. _url = "/img/background/", //图片地址
  922. _pchild = U.selectEl($("#U_MD_D_Set_BG").childs()[0]).Child(), //获取父级元素的第一个子元素,并且获取默认壁纸div
  923. _imgname = ["3DBox", "cloud", "fruit", "green", "userbackgound", "Dream_train", "ZMYT"], //建立包含图片名称的对象
  924. _img = U.selectEl(_pchild[0]).Child()[1]; //获取显示图片的div
  925. _img.innerText = ""; //清空显示图片的div
  926. if (_imgname.hasOwnProperty) {//忽略从原型链继承的属性
  927. for (i = 0; i < _imgname.length; i++) {
  928. _imgparent = $$("div", {
  929. "className": "U_MD_D_Set_BG_OCO", "title": "设为背景",
  930. "onclick": U.UF.C.closure(function (i) {//U.UF.C.closure 解决闭包问题
  931. U.MD.D.B.setBackgroundImage(_url + _imgname[i] + ".jpg"); //给每一个默认壁纸图片添加点击事件
  932. }, [i])
  933. }, _frag); //创建包含图片的div
  934. _imgparent = $$("div", {}, _imgparent); ////创建包含图片的div的下层div_url + _imgname[i][j] + "(1)." + i
  935. var _addimg = U.UF.IMG.imgReady(_url + _imgname[i] + "(1).jpg", null, function () { /**U.MD.D.H.DYWPTP(_imgparent);*/ }, function () { U.MD.C.imgError(this); }); //获取图片 添加图片
  936. _imgparent.appendChild(_addimg); //添加图片到父级元素中,并显示出来
  937. }
  938. }
  939. _img.appendChild(_frag); //图片添加到默认图片
  940. }
  941. /*
  942. * 作用: 切割图片的路径包括图片文件夹和图片的名称的字符串数组
  943. * @param {array} imageurl 图片路径
  944. * return {array} 返回切割好的数组
  945. */
  946. U.MD.D.B.split = function (imageurl) {
  947. if (imageurl) {//参数有值
  948. var _i = imageurl.lastIndexOf("/"); //获取/最后出现的位置
  949. return [imageurl.substr(0, _i), imageurl.substr(_i + 1)]; //图片文件夹 和 图片的名称 的字符串数组
  950. }
  951. return ["", ""]; //返回切割好的数组
  952. }
  953. /*
  954. * 作用:同作用于服务器,通过数据库修改,完成壁纸的更改
  955. * @param {array} url 图片的路径
  956. * @param {string} str 图片的标识
  957. */
  958. U.MD.D.B.asyn = function (url, str) {
  959. if (!U.MD.U.L.isLogin()) {//判断用户是否登录,如果未登录,则弹出登录窗体
  960. url = url || U.MD.D.B.backUrl[0]; //获取图片的地址
  961. str = str || U.MD.D.B.backUrl[1]; //获取图片的标识
  962. US.userInfo.UserBackGroundImage = url; //讲图片的地址传入服务器中
  963. U.alert("修改中.."); //弹出提示框
  964. //插入数据库,并且通过数据返回数据出来。
  965. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "UpdateUserDesktopInfo", US.userInfo.UserId, url + "/" + str, "", ""],
  966. function () { U.alert("设置成功"); }); //对调函数,弹出提示框
  967. // U.A.Request('UseStudioManage.SetUserBackgroudnImage', [US.userInfo.UserId, url, str], function(){U.alert("设置成功");}, []);
  968. }
  969. }
  970. /*
  971. * 作用:点击网盘上传图片
  972. * @param {element} el 图片的元素
  973. * @param {array} url 图片的路径
  974. * @param {string} str 图片的标识
  975. */
  976. U.MD.D.B.disk = function (el, url, str) {
  977. U.MD.D.B.setBackgroundImage(url, "S"); //调用设置用户点击的背景图片的功能函数
  978. }
  979. /*
  980. * 作用:设置用户点击的背景图片
  981. * @param {array} imageurl 图片的地址
  982. * @param {string} typename 图片的标识
  983. */
  984. U.MD.D.B.setBackgroundImage = function (imageurl, typename) {
  985. var _el = U.selectEl("#U_MD_D_BG")[0]; //需要设置背景图片的地方
  986. typename = typename || "S"; //设置背景时 undefined 所以值是 "S"
  987. //如果没有传递需要设置的背景图片,那么就设置默认的背景图片
  988. if (imageurl == null) {//判断图片的路径是否正确
  989. imageurl = U.MD.D.B.url; //如果图片的路径传值为空的话,则图片路径为默认图片路径
  990. //判断是否有用户设置的图片路径,如果有,则改变全局变量的图片路径为用户设置的图片路径,如果没有,则用默认图片路径。
  991. U.MD.D.B.backUrl = US.userInfo.UserBackGroundImage ? U.MD.D.B.split(US.userInfo.UserBackGroundImage) : [U.MD.D.B.url, typename];
  992. } else {//如果图片的路径不为空
  993. U.MD.D.B.backUrl = [imageurl, typename]; //则全局变量为图片的路径的传值,以及图片的标识传值
  994. }
  995. //各种背景设置
  996. switch (typename) {
  997. case "T": //标识为T时
  998. //重叠出现
  999. U.selectEl(el).addAttrArray({//改变图片路径
  1000. style: {
  1001. background: "#F0F0F0 url(" + imageurl + ")"
  1002. }
  1003. });
  1004. break; //跳出循环
  1005. case "M": //标识为M时
  1006. //原图大小
  1007. U.selectEl(el).addAttrArray({//改变图片为原图大小
  1008. style: {
  1009. background: "#F0F0F0 url(" + imageurl + ") 0 0 no-repeat"
  1010. }
  1011. });
  1012. break; //跳出循环
  1013. case "S": //标识为S时
  1014. //全屏展示
  1015. if (imageurl) {
  1016. U.selectEl(_el).addAttrArray({
  1017. style: {
  1018. filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + imageurl + ",sizingMethod=scale)",
  1019. background: "#F0F0F0 url(" + imageurl + ") 0 0 no-repeat",
  1020. backgroundSize: "100% 100%",
  1021. MozBackgroundSize: "100% 100%"
  1022. }
  1023. });
  1024. }
  1025. break; //全屏
  1026. default: break;
  1027. }
  1028. }
  1029. /*
  1030. * 作用:上传本地图片的设置
  1031. * @param {element} el 图片元素
  1032. */
  1033. U.MD.D.B.upload = function (el) { //上传图片设置
  1034. if (U.UF.UP.isImg(el.value)) {//判断是否是图片
  1035. //上传图片 调用上传函数,传入图片元素,上传地址,上传成功的回调函数,回调函数的传参
  1036. U.UF.UP.inputUpload([el], "http://disk.1473.cn/USUpfile.ashx?typename=UploadWallpaper", U.MD.D.B.asynUp, [el]);
  1037. }
  1038. }
  1039. /*
  1040. * 作用:上传背景的设置
  1041. * @param {element} url 图片的元素
  1042. */
  1043. U.MD.D.B.asynUp = function (url) { //上传背景设置
  1044. var i, _userchild, _imginfo, //i 循环图片文件信息的长度;_userchild 获取用户id的子元素;_imginfo获取图片的信息
  1045. _userinfo = US.userInfo; //用户信息
  1046. _userid = _userinfo.BHID, //用户的BHID?
  1047. _userchange = U.MD.DK.M.diskOperatingSwitch(_userinfo.UserId); //用户操作切换,可以查看多个用户的硬盘,所以需要切换。登录用户和非登录用户有不同权限。
  1048. r = url.value; //图片文件信息?
  1049. if (_userid && _userchange[_userid] && (_userchild = _userchange[_userid].Child)) {//false 不进去???
  1050. for (i = 0; i < r.length; i++) {//循环图片文件信息的长度
  1051. _imginfo = r[i]; //获取图片的信息
  1052. //上传文件成功后,由前端的数据结构生成一个数据实体,实际传参请参考函数里面的数据结构
  1053. _imginfo = new U.MD.DK.M.entity(_imginfo.UserFilesID, _imginfo.UserFilesSize, _imginfo.UserDirectoryID, _imginfo.UserFilesName, _imginfo.UserFilesName, _imginfo.UserFilesExtendName, US.FILESYSTEMURL + _imginfo.UserFilesServerName, _imginfo.UserFilesAddTime, _imginfo.UseFilesServerThumbnailName, 9999, null, "", 1, _imginfo.UserFilesDescript, "", null)
  1054. _userchange[_userid].Child.push(_imginfo); //把上传文件成功的数据结构插入数组中
  1055. }
  1056. }
  1057. U.MD.D.B.setBackgroundImage(U.MD.C.getHeadImage(r[0].UserFilesServerName)); //设置背景
  1058. }
  1059. /*
  1060. * 作用:从网盘上传图片
  1061. * @param {element} url 图片的元素
  1062. */
  1063. U.MD.D.B.uploadByPan = function () {
  1064. U.MD.DK.VW.choseFile(function (obj) {
  1065. U.MD.D.B.setBackgroundImage('http://fs.1473.cn/' + obj.UserDirectoryUrl, 'S'); //给每一个默认壁纸图片添加点击事件
  1066. });
  1067. };
  1068. ///<jscompress sourcefile="AboutUs.js" />
  1069. Namespace.register("U.MD.D.A"); //桌面提示框
  1070. //#region 用户协议
  1071. /*
  1072. * 用户协议
  1073. *
  1074. * @param {element} 用户协议内容元素
  1075. */
  1076. U.MD.D.A.agreement = function (_el) {
  1077. return new U.UF.UI.form("<div class='U_MD_F_S_TI'>安全协议</div>",
  1078. U.selectEl(_el).parentElement().css("display", "block")[0],
  1079. {
  1080. "id": "U_MD_UI_UP_O",
  1081. "style": {
  1082. "width": "600px",
  1083. "height": "452px"
  1084. }
  1085. },
  1086. {
  1087. isnarrow: false,
  1088. isenlarge: false
  1089. }).form;
  1090. }
  1091. //#endregion
  1092. //#region 关于我们
  1093. /*
  1094. * 打开关于我们窗体
  1095. *
  1096. */
  1097. U.MD.D.A.aboutUs = function () {
  1098. var _el = U.selectEl("#U_MD_D_A_OT");
  1099. _el.css("display", "block");
  1100. new U.UF.UI.form("<div class='U_MD_F_S_TI'>关于我们</div>", _el[0],
  1101. {
  1102. "id": "U_MD_D_A_OT_A",
  1103. "style": {
  1104. "width": "920px",
  1105. "height": "600px"
  1106. }
  1107. },
  1108. {
  1109. isnarrow: false,
  1110. isenlarge: false
  1111. });
  1112. }
  1113. //#endregion
  1114. /*
  1115. * 浏览器更新窗体
  1116. *
  1117. */
  1118. U.MD.D.A.browserCompatibleForm = function () {
  1119. new U.UF.UI.form("<div class='U_MD_F_S_TI'>浏览器更新</div>",
  1120. U.selectEl("#U_MD_D_A")[0],
  1121. {
  1122. "id": "U_MD_D_A_A",
  1123. "style": {
  1124. "width": "970px",
  1125. "height": "605px"
  1126. }
  1127. },
  1128. {
  1129. isnarrow: false,
  1130. isenlarge: false
  1131. });
  1132. }
  1133. //#endregion;
  1134. ///<jscompress sourcefile="Disk.js" />
  1135. ///<jscompress sourcefile="Disk.js" />
  1136. Namespace.register("U.MD.DK"); //Disk的主命名空间
  1137. //#region 初始化网盘
  1138. //初始化网盘
  1139. //
  1140. //* @param {string} 用户id,可以是自己的用户id或者其他人的用户id。当为其他人的用户id时,为查看其他人的网盘信息
  1141. //* @param {string} 目录id
  1142. //* @returns {} 无
  1143. //
  1144. U.MD.DK.initDisk = function (userid, dirid) {
  1145. //判断用户id是否存在,如果不存在说明是桌面的点击,那么就必须要求用户登录
  1146. if (userid) {
  1147. //获取网盘弹窗
  1148. var _formdiv = U.selectEl("#U_D_" + userid)[0],
  1149. _diskinfo = US.disk.Disks[userid];
  1150. //如果网盘已经弹出,直接定位
  1151. if (_formdiv) {
  1152. U.UF.F.windowTopCenter(_formdiv);
  1153. U.selectEl("#U_MD_DK_LTXO", _formdiv)[0].innerHTML = ""; //清除树状图
  1154. //判断是否为本人网盘
  1155. //如果是的话则显示完整的左侧树目录
  1156. if (userid == US.userInfo.UserId) {
  1157. U.MD.DK.LL.printLeftTreeDirectory(_diskinfo.directoryOrFiles.slice(0, 5), U.selectEl("#U_MD_DK_LTXO", _formdiv)[0], userid, ["U_MD_DK_LCD", "U_MD_DK_LCS", "U_MD_DK_LCD", "U_MD_DK_LCB", "U_MD_DK_LCF", "U_MD_DK_LCT", "U_MD_DK_LCP", "U_MD_DK_LCY"])
  1158. }
  1159. //非本人操作的处理
  1160. else {
  1161. U.MD.DK.LL.printLeftTreeDirectory(_diskinfo.directoryOrFiles.slice(4, 5), U.selectEl("#U_MD_DK_LTXO", _formdiv)[0], userid, ["U_MD_DK_LCD", "U_MD_DK_LCS", "U_MD_DK_LCD", "U_MD_DK_LCB", "U_MD_DK_LCF", "U_MD_DK_LCT", "U_MD_DK_LCP", "U_MD_DK_LCY"])
  1162. }
  1163. U.MD.DK.openDirByDirID(userid, dirid); //导航到制定目录
  1164. }
  1165. //如果网盘没有弹出的处理
  1166. else if (!_diskinfo) {
  1167. var _diskel = U.selectEl("#U_MD_DK").clone(true)[0],
  1168. _loginuserid = US.userInfo.UserId || US.EMPTYGUID; //网盘内容元素
  1169. _diskel.id = "U_MD_DK__" + userid; //网盘内容的元素id设置为U_MD_DK__加上用户id
  1170. _diskel.style.display = "block"; //显示
  1171. //云盘拖拽
  1172. //$('.U_MD_DK_RZA', _diskel).bind('mousedown', function () { console.log(0); })
  1173. //窗体的事件处理,api中没有,需要补充。
  1174. _formdiv = new U.UF.UI.form("<div class='U_MD_F_S_TI'>网盘</div>",
  1175. _diskel, {
  1176. "onmousedown": function () {
  1177. U.MD.DK.M.diskOperatingSwitch(userid);
  1178. }, //鼠标单击事件。打开多个网盘时,切换网盘数据,此处需要修正,并删除.
  1179. "onresize": function () {
  1180. U.MD.DK.size(_diskel);
  1181. }, //窗体放大缩小时的处理。
  1182. "id": "U_D_" + userid,
  1183. "style": {
  1184. "width": "80%",
  1185. "height": "85%"
  1186. }
  1187. }).form;
  1188. //数据库获取指定用户指定目录下的网盘数据
  1189. U.A.Request(US.DISK, ["InitDisk", _loginuserid, userid, dirid], U.MD.DK.asynInitDisk, [_diskel, userid, dirid, US.userInfo.UserId || US.EMPTYGUID, _formdiv]); //服务器加载
  1190. }
  1191. return _formdiv;
  1192. //没有用户id说明用户没有登录点击桌面的网盘。
  1193. }
  1194. else {
  1195. U.MD.U.L.login();
  1196. }
  1197. }
  1198. /**
  1199. * 得到后台获取的用户数据
  1200. *
  1201. * @param {object} request返回值
  1202. * context 上下文之间的传参
  1203. * value服务器返回值 0 用户初始化定位到指定文件夹下面的所有文件和文件夹 1 用户的信息 2 用户的网盘信息
  1204. **/
  1205. U.MD.DK.asynInitDisk = function (r) {
  1206. var _dirinfo,
  1207. _context = r.context, //获取上下文传参
  1208. _diskel = _context[0], //disk内容元素
  1209. _userid = _context[1], //用户的id
  1210. _dirid = _context[2], //目录id
  1211. _loginuserid = _context[3], //用户登录id
  1212. _formdiv = _context[4], //网盘窗体元素
  1213. _value = r.value //数据库返回的值
  1214. ;
  1215. //判断根据用户id是否能获取到用户的资料
  1216. if (_value) {
  1217. //设置用户全局变量
  1218. var _diskinfo = U.MD.DK.setUserGlobalVariable(_userid, _dirid, _value);
  1219. //初始化左侧的头部样式
  1220. U.MD.DK.VW.followState(_formdiv, _userid, _loginuserid);
  1221. //初始化当前用户网盘前进后退
  1222. U.UF.N.createNav("disk" + _userid);
  1223. //初始化按钮点击事件
  1224. U.MD.DK.initDiskButton(_diskinfo);
  1225. //网盘大小初始化设置
  1226. U.MD.DK.size(_diskinfo.formel);
  1227. //初始化用户信息
  1228. U.MD.DK.initDiskUserInfo(_diskinfo);
  1229. //打印左边树目录信息
  1230. if (_diskinfo.userInfo.UserId == _diskinfo.operator) {
  1231. U.MD.DK.LL.printLeftTreeDirectory(_diskinfo.directoryOrFiles.slice(0, 5), U.selectEl("#U_MD_DK_LTXO", _diskinfo.formel)[0], _userid, ["U_MD_DK_LCD", "U_MD_DK_LCS", "U_MD_DK_LCD", "U_MD_DK_LCB", "U_MD_DK_LCF", "U_MD_DK_LCT", "U_MD_DK_LCP", "U_MD_DK_LCY"])
  1232. }
  1233. else {
  1234. U.MD.DK.LL.printLeftTreeDirectory(_diskinfo.directoryOrFiles.slice(4, 5), U.selectEl("#U_MD_DK_LTXO", _diskinfo.formel)[0], _userid, ["U_MD_DK_LCD", "U_MD_DK_LCS", "U_MD_DK_LCD", "U_MD_DK_LCB", "U_MD_DK_LCF", "U_MD_DK_LCT", "U_MD_DK_LCP", "U_MD_DK_LCY"])
  1235. }
  1236. U.MD.DK.openDirByDirID(_userid, _dirid); //导航到制定目录上
  1237. }
  1238. //获取用户资料失败
  1239. else {
  1240. U.alert("帐号不存在...");
  1241. //移除网盘窗体
  1242. U.selectEl(_diskinfo.formel).remove();
  1243. }
  1244. }
  1245. /**
  1246. * 根据目录id打开目录
  1247. *
  1248. * @param {string} 目录id
  1249. **/
  1250. U.MD.DK.openDirByDirID = function (userid, dirid) {
  1251. var _diskinfo = US.disk.Disks[userid];
  1252. if (_diskinfo) {
  1253. //导航到达指定的目录
  1254. //打开文件,目录及导航到达区域。因为现在是按需加载数据,不可能完全导航到达指定位置,则不做左边树目录展开功能
  1255. var _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { "UserDirectoryID": dirid })[0]; //获取当前需要打开的文件夹信息
  1256. //如果目录存在的处理
  1257. if (_dirinfo) {
  1258. //如果左边的目录可以输出的处理
  1259. if ($("#L" + _dirinfo["UserDirectoryID"], _diskinfo.formel)[0]) {
  1260. U.MD.DK.LL.leftTreeClick(_dirinfo, U.selectEl("#L" + _dirinfo["UserDirectoryID"], _diskinfo.formel)[0], userid); //打开该文件夹
  1261. }
  1262. //否则直接打印数据
  1263. else {
  1264. U.MD.DK.LE.openFileDirectory(_dirinfo, userid);
  1265. }
  1266. }
  1267. //目录查看不了或者是不允许查看
  1268. else {
  1269. //打印数据
  1270. U.MD.DK.VW.printContent([], U.selectEl("#U_MD_DK_RZ", _diskinfo.formel)[0]);
  1271. }
  1272. }
  1273. }
  1274. /**
  1275. * 打开应用
  1276. *
  1277. * @param {string} 用户id
  1278. * @param {string} 目录id
  1279. * @param {object} directoryOrFiles是dirid目录下所有的文件和文件夹 userInfo是用户的信息+用户的网盘信息
  1280. **/
  1281. U.MD.DK.setUserGlobalVariable = function (userid, dirid, diskinfo) {
  1282. var _dirinfo,
  1283. _basicdirectory = U.MD.DK.getBasicDirectory(diskinfo), //获取一级目录
  1284. _groupdirectory = U.MD.DK.getGroupDirectory(diskinfo.groups, _basicdirectory, diskinfo.userInfo.UserId) //获取群目录
  1285. ;
  1286. _basicdirectory = _basicdirectory.concat(_groupdirectory); //群和一级目录合并生成初始化目录
  1287. //_basicdirectory[1].Child = _groupdirectory; //把群添加到文档群的的下面,作为文件夹
  1288. //diskinfo.directoryOrFile是第一次进入的时候获取的文件夹下面的文件,那么这个时候就要添加到指定的目录的child里面
  1289. _dirinfo = U.Json.select(_basicdirectory, { "UserDirectoryID": dirid }, 1)[0];
  1290. if (!_dirinfo && diskinfo.currentdirectory[0]) {
  1291. _dirinfo = diskinfo.currentdirectory[0]; //获取服务器返回的当前目录
  1292. _dirinfo = new U.MD.DK.M.entity(_dirinfo.UserDirectoryID, 0,
  1293. _dirinfo.UserDirectoryParentID, _dirinfo.UserDirectoryName, _dirinfo.UserDirectoryName, _dirinfo.UserDirectoryExtendType,
  1294. "", _dirinfo.UserDirectoryAddTime, _dirinfo.UserDirectoryUrl, _dirinfo.UserDirectoryDeep, _dirinfo.UserDirectoryModifyTime,
  1295. _dirinfo.UserDirectoryEncrypt, 0, "", _dirinfo.GroupID);
  1296. _basicdirectory.push(_dirinfo);
  1297. }
  1298. //判断是在制定的以及目录下的子文件的处理
  1299. if (_dirinfo) {
  1300. _dirinfo.Child = diskinfo.directoryOrFiles;
  1301. U.Json.add(diskinfo.directoryOrFiles, { "Parent": _dirinfo });
  1302. }
  1303. diskinfo.directoryOrFiles = _basicdirectory.concat(diskinfo.directoryOrFiles); //基础目录加上dirid获取的数据
  1304. //设置用户的全局变量
  1305. US.disk.Disks[userid] = diskinfo; //diskinfo.directoryOrFiles是dirid目录下所有的文件和文件夹 userInfo是用户的信息+用户的网盘信息
  1306. US.disk.Disks[userid].formel = U.selectEl("#U_D_" + userid)[0]; //对应的网盘窗体元素
  1307. US.disk.Disks[userid].directoryid = dirid; //当前打开的目录id
  1308. US.disk.Disks[userid].currentDirectoryFile = []; //当前目录下所有的文件
  1309. US.disk.Disks[userid].operator = US.userInfo.UserId; //操作用户id
  1310. return US.disk.Disks[userid]; //返回用户网盘的信息
  1311. }
  1312. /**
  1313. * 获取一个一级目录
  1314. *
  1315. **/
  1316. U.MD.DK.getBasicDirectory = function (diskinfo) {
  1317. var i,
  1318. _diskdir = US.disk.initTree.concat(); //concat相当于数组的克隆,克隆一个一级目录数组
  1319. //补充disk网盘的全局变量数据 补充左边初始化目录数据我的电脑等
  1320. for (i = 0; i < _diskdir.length; i++) { //初始化查看
  1321. //创建一个一级目录对象
  1322. _diskdir[i] = new U.MD.DK.M.entity(_diskdir[i][0], _diskdir[i][1], _diskdir[i][2], _diskdir[i][3], _diskdir[i][4],
  1323. _diskdir[i][5], _diskdir[i][6], _diskdir[i][7], _diskdir[i][8], _diskdir[i][9],
  1324. _diskdir[i][10], _diskdir[i][11], _diskdir[i][12], _diskdir[i][13], _diskdir[i][14],
  1325. _diskdir[i][15], diskinfo.userInfo.UserId, diskinfo.userInfo.UserNickName, diskinfo.userInfo.UserName, diskinfo.userInfo.UserThumbnailImageHead);
  1326. };
  1327. //返回一级目录
  1328. return _diskdir;
  1329. }
  1330. /**
  1331. * 生成群目录
  1332. * @param {array} 群数组
  1333. * @param {array} 目录id
  1334. * @param {string} 用户id
  1335. *
  1336. **/
  1337. U.MD.DK.getGroupDirectory = function (groups, basicdirectory, userid) {
  1338. if (groups != null) {
  1339. var i, _diskgroupinfo; //concat相当于数组的克隆,克隆一个一级目录数组
  1340. //还没有初始化群的处理
  1341. if (!basicdirectory[1].Child) {
  1342. basicdirectory[1].Child = [];
  1343. }
  1344. //还没有初始化群的处理
  1345. if (!basicdirectory[2].Child) {
  1346. basicdirectory[2].Child = [];
  1347. }
  1348. //补充disk网盘的全局变量数据 补充左边初始化目录数据我的电脑等
  1349. for (i = 0; i < groups.length; i++) { //初始化查看
  1350. _diskgroupinfo = groups[i];
  1351. //创建一个一级目录对象
  1352. groups[i] = new U.MD.DK.M.entity(groups[i].GroupManageID, 0, US.EMPTYGUID, groups[i].GroupManageName,
  1353. groups[i].GroupManageName, "folder", null, U.UF.D.toTimeStamp(new Date()), U.MD.DK.C.getIcon("folder")[1],
  1354. 1, null, null, 0, "", groups[i].GroupManageID, null, groups[i].GroupManageUserID, groups[i].GroupManageName, groups[i].GroupManageName);
  1355. //如果是群主的处理,那么就做为协同文件
  1356. if (_diskgroupinfo.GroupManageCreateUserID == userid) {
  1357. basicdirectory[1].Child.push(groups[i]);
  1358. groups[i].Parent = basicdirectory[1];
  1359. }
  1360. //非群主的,作为协同他人的处理
  1361. else {
  1362. basicdirectory[2].Child.push(groups[i]);
  1363. groups[i].Parent = basicdirectory[2];
  1364. }
  1365. };
  1366. }
  1367. //返回一级目录
  1368. return groups || [];
  1369. }
  1370. /**
  1371. * 初始化硬盘点击按钮
  1372. *
  1373. * @param {string} 用户网盘信息
  1374. **/
  1375. U.MD.DK.initDiskButton = function (diskinfo) {
  1376. var _navchildel = U.selectEl("#U_MD_DK_RKZ", diskinfo.formel).Child(),
  1377. _viewchildel = U.selectEl("#U_MD_DK_RM", diskinfo.formel).Child(),
  1378. _child = U.selectEl("#U_MD_DK_RY", diskinfo.formel).Child(),
  1379. _headchild = U.selectEl("#U_MD_DK_RT", diskinfo.formel).Child(),
  1380. _userid = diskinfo.userInfo.UserId,
  1381. _el = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0]
  1382. ; //头部新建文件夹等按钮
  1383. //上传事件
  1384. _headchild[0].onclick = function () {
  1385. U.MD.DK.C.upload(diskinfo);
  1386. }
  1387. //新建目录事件
  1388. _headchild[1].onclick = function () {
  1389. U.MD.DK.RE.newFolder(diskinfo);
  1390. }
  1391. //新建文本事件
  1392. _headchild[2].onclick = function () {
  1393. U.MD.DK.RE.newText(diskinfo);
  1394. }
  1395. //新建文档事件
  1396. _headchild[3].onclick = function () {
  1397. U.MD.DK.RE.newDocument(diskinfo);
  1398. }
  1399. //新建导航文档事件
  1400. _headchild[4].onclick = function () {
  1401. U.MD.DK.RE.newopenApplication(diskinfo);
  1402. }
  1403. //新建表格事件
  1404. _headchild[5].onclick = function () {
  1405. U.MD.DK.RE.newExcel(diskinfo);
  1406. }
  1407. //创建站点
  1408. _headchild[6].onclick = function () {
  1409. var _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": diskinfo.directoryid })[0];
  1410. //如果是初始化目录的处理
  1411. if (_dirinfo.UserDirectoryDeep == 0) {
  1412. window.open('http://' + diskinfo.directoryid + '.1473.cn?userid=' + diskinfo.userInfo.UserId);
  1413. }
  1414. //非初始化目录
  1415. else if (_dirinfo.UserDirectoryDeep == 1) {
  1416. window.open('http://' + diskinfo.directoryid + '.1473.cn?userid=' + _dirinfo.UserId);
  1417. } else {
  1418. window.open('http://' + diskinfo.directoryid + '.1473.cn');
  1419. }
  1420. }
  1421. //前进事件
  1422. _child[0].onclick = function () {
  1423. U.UF.N.backOff("disk" + _userid); //前进事件
  1424. }
  1425. //后退事件
  1426. _child[1].onclick = function () {
  1427. U.UF.N.goAhead("disk" + _userid); //后退事件
  1428. }
  1429. //刷新按钮
  1430. _child[2].onclick = function () {
  1431. U.MD.DK.RE.refresh(_userid, U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": diskinfo.directoryid })[0], diskinfo); //刷新函数
  1432. }
  1433. //右键菜单点击处理
  1434. _el.oncontextmenu = function () {
  1435. U.MD.DK.RM.rightMenu(null, null, diskinfo);
  1436. };
  1437. //拖选元素处理
  1438. _el.onmousedown = function () {
  1439. U.MD.DK.C.selectElement(_el, diskinfo);
  1440. };
  1441. //左键点击空白处理
  1442. U.UF.EV.addElementEvent("mousedown", window, function () {
  1443. U.selectEl("#U_MD_DK_M", diskinfo.formel)[0].style.display = "none";
  1444. });
  1445. //时间排序按钮
  1446. _navchildel[0].onclick = function () {
  1447. U.MD.DK.VW.SortView(diskinfo, "UserDirectoryAddTime", function (timeone, timetwo) {
  1448. return U.UF.D.sizeComparison(timeone, timetwo) == false;
  1449. }); //时间排序处理
  1450. }
  1451. //普通视图
  1452. _navchildel[1].onclick = function () {
  1453. //视图按钮切换
  1454. _navchildel[1].className = "U_MD_DK_RKZOI U_MD_DK_Img U_MD_DK_RKZOS U_MD_DK_RKZOSI";
  1455. _navchildel[2].className = "U_MD_DK_RKZOI U_MD_DK_Img U_MD_DK_RKZOP";
  1456. //普通视图
  1457. U.MD.DK.VW.viewsSwitch("Normal", diskinfo);
  1458. }
  1459. //详细视图
  1460. _navchildel[2].onclick = function () {
  1461. //视图按钮切换
  1462. _navchildel[1].className = "U_MD_DK_RKZOI U_MD_DK_Img U_MD_DK_RKZOS";
  1463. _navchildel[2].className = "U_MD_DK_RKZOI U_MD_DK_Img U_MD_DK_RKZOP U_MD_DK_RKZOPI";
  1464. //详细视图
  1465. U.MD.DK.VW.viewsSwitch("Detailed", diskinfo);
  1466. }
  1467. //文件名排序
  1468. _viewchildel[2].onclick = function () {
  1469. U.MD.DK.VW.SortView(diskinfo, "UserallDirectoryName", function (dirnameone, dirnametwo) { //时间排序处理
  1470. return dirnameone.localeCompare(dirnametwo, "zh") == 1;
  1471. });
  1472. }
  1473. //分享次数排序,暂时分享次数没有用处
  1474. // _child[2].onclick = function () {
  1475. // U.MD.DK.VW.SortView(diskinfo, "", function (timeone, timetwo) {
  1476. // return U.UF.D.sizeComparison(timeone, timetwo) == false;
  1477. // }); //时间排序处理
  1478. // }
  1479. //来源名字排序
  1480. _viewchildel[6].onclick = function () {
  1481. U.MD.DK.VW.SortView(diskinfo, "UserNickName", function (nameone, nametwo) { //根据用户名排序
  1482. return nameone.localeCompare(nametwo, "zh") == 1;
  1483. });
  1484. }
  1485. //类型排序
  1486. _viewchildel[8].onclick = function () {
  1487. U.MD.DK.VW.SortView(diskinfo, "UserDirectoryExtendType", function (typeone, typetwo) { //根据类型排序
  1488. return typeone.localeCompare(typetwo, "zh") == 1;
  1489. });
  1490. }
  1491. //大小排序排序
  1492. _viewchildel[10].onclick = function () {
  1493. U.MD.DK.VW.SortView(diskinfo, "UserDirectorySize", function (sizeone, sizetwo) { //根据文件大小排序
  1494. return sizeone > sizetwo;
  1495. });
  1496. }
  1497. //时间排序排序
  1498. _viewchildel[12].onclick = function () {
  1499. U.MD.DK.VW.SortView(diskinfo, "UserDirectoryAddTime", function (timeone, timetwo) { //根据添加事件排序
  1500. return U.UF.D.sizeComparison(timeone, timetwo) == 1;
  1501. });
  1502. }
  1503. }
  1504. /**
  1505. * 打印网盘用户资料
  1506. *
  1507. * @param {string} 用户网盘信息
  1508. **/
  1509. U.MD.DK.initDiskUserInfo = function (diskinfo) {
  1510. var _formel = diskinfo.formel,
  1511. _userinfo = diskinfo.userInfo,
  1512. _child
  1513. ;
  1514. //用户头像
  1515. $$("img", {
  1516. "onerror": U.MD.C.imgError,
  1517. "onerror": U.MD.C.imgError,
  1518. "title": "点击查看",
  1519. "src": U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead)
  1520. }, U.selectEl("#U_MD_DK_LIL", _formel)[0]);
  1521. //用户名
  1522. U.selectEl("#U_MD_DK_LIRN", _formel)[0].innerText = _userinfo.UserNickName || _userinfo.UserName;
  1523. //用户个人简介
  1524. U.selectEl("#U_MD_DK_LIRZ", _formel)[0].innerText = _userinfo.UserIndividualitysignature || "暂无个人简介";
  1525. //用户硬盘信息打印
  1526. _child = U.selectEl("#U_MD_DK_LS", _formel).find("div");
  1527. _child[4].innerText = U.UF.UP.minUnitToMaxUnit(_userinfo.UserDiskSpace + "M"); //用户有多少网盘空间
  1528. _child[7].innerText = U.UF.UP.minUnitToMaxUnit(_userinfo.FileSize + "B"); //用户用了多少网盘空间
  1529. }
  1530. /**
  1531. * 网盘大小调整
  1532. *
  1533. * @param {element} 网盘窗体元素
  1534. **/
  1535. U.MD.DK.size = function (formel) {
  1536. var _contentel = U.selectEl("#U_MD_DK_RZ", formel); //获取中间显示内容区域的大小
  1537. _contentel.css("height", _contentel.Parent(2).offsetHeight - 79 + "px"); //设置内容区域的大小
  1538. }
  1539. //#endregion
  1540. ;
  1541. ///<jscompress sourcefile="DiskCommon.js" />
  1542. Namespace.register("U.MD.DK.C"); //网盘功能使用区域
  1543. /**
  1544. * 获取目录树的一条线上的所有祖先
  1545. * @param {string} 操作的目录id
  1546. * @param {array} 用户的网盘信息
  1547. * @param {object} 在该目录下操作的文件
  1548. * @return {array} 得到操作权限数组
  1549. */
  1550. U.MD.DK.C.getAncestors = function (fileinfo, diskinfo) {
  1551. var _dirinfo = fileinfo, //目录数据
  1552. _ancestors = [] //这里是需要返回的祖先
  1553. ;
  1554. //不断的循环寻找自己的祖先
  1555. while (_dirinfo) {
  1556. _ancestors.push(_dirinfo); //找到后追加
  1557. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": _dirinfo.UserDirectoryParentID }, 1)[0]; //设置搜索的目录id为上级的id不断的向上搜索祖先
  1558. }
  1559. return _ancestors; //返回自己的祖先元素
  1560. }
  1561. /**
  1562. * 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1563. * @param {string} 操作的目录id
  1564. * @param {array} 用户的网盘信息
  1565. * @return {array} 文件的权限信息
  1566. * 0 目录id
  1567. * 1-n 所有涉及到权限信息 (1只允许上传 2只允许下载)
  1568. **/
  1569. U.MD.DK.C.readWritePermission = function (dirid, diskinfo) {
  1570. var i,
  1571. _permi,
  1572. _dirs = [],
  1573. _returns = [],
  1574. _fileinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": dirid }, 1)[0] //获取当前操作目录的目录信息
  1575. ;
  1576. //该目录未加载或者该目录id加载的不是目录,如我的协同、最近文件等
  1577. if (_fileinfo) {
  1578. //获取当前操作的目录所有的祖先文件夹
  1579. _dirs = U.MD.DK.C.getAncestors(_fileinfo, diskinfo);
  1580. _returns.push(_dirs);
  1581. //循环所有的祖先集,找出读写权限
  1582. for (i = 0; i < _dirs.length; i++) {
  1583. _permi = _dirs[i].UserDirectoryEncrypt; //获取该目录的操作权限的方式
  1584. if (_permi == "1" || _permi == "2") { //判断是否有上传下载权限
  1585. _returns.push(_permi); break;
  1586. }
  1587. } //获取权限
  1588. }
  1589. return _returns;
  1590. }
  1591. /**
  1592. * 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1593. * @param {string} 操作的目录id
  1594. * @param {array} 用户的网盘信息
  1595. * @param {object} 在该目录下操作的文件
  1596. * @return {array} 得到操作权限数组
  1597. * 0 判断该目录是否允许上传 1、自己建立的目录是可以下载的 2、没有限制只允许上传的可以下载
  1598. * 1 判断该目录是否允许下载 1、自己建立的目录是可以上传的 2、ftp中没有限制只允许上传的是可以下载
  1599. * 2 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1600. * 3 获取上传的目录用户对应的临时目录
  1601. * 4 判断操作的文件是否有本人有关 包含是本人创建、本人网盘里、在本人创建的群里
  1602. */
  1603. U.MD.DK.C.getDirectoryPermissions = function (fileordirid, diskinfo) {
  1604. diskinfo = diskinfo || US.disk.UserDisk; //需要操作的当前用户的网盘信息
  1605. var _isftp, //是否操作ftp
  1606. _ismyself, //是否操作本人网盘内容
  1607. _isuserdisk, //是否在自己的网盘中
  1608. _isgroup, //是否在群里
  1609. _isgroupmain,
  1610. _permissions = US.permission.getDiskPermission(), //调用方法,从权限变量文件中获取克隆一份权限
  1611. _permissioninfo = U.MD.DK.C.readWritePermission(fileordirid, diskinfo), //获取权限
  1612. _dirinfo = _permissioninfo[0][_permissioninfo[0].length - 1], //所操作的文件或者是文件夹所操作的目录
  1613. _currentfileordir = _permissioninfo[0][0], //当前操作的文件或者文件夹
  1614. _readwrite = _permissioninfo.splice(1) //得到文件的读写权限和祖先元素
  1615. ;
  1616. //如果是未登录、群、最新文档,协同文档,则没有权限操作
  1617. if (_currentfileordir && !US.userInfo.UserId || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[0].UserDirectoryID || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[1].UserDirectoryID || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[2].UserDirectoryID) {
  1618. _permissions.isopen = false; //是否允许打开, 现在所有的文件都有打开权限
  1619. _permissions.isupadte = false; //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1620. _permissions.isdelete = false; //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1621. _permissions.iscopy = false; //是否允许复制,现在所有的文件都有复制权限
  1622. _permissions.isshear = false; //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1623. _permissions.isencryption = false; //是否允许加密,展示取消这个功能。
  1624. _permissions.isreply = false; //是否允许加密,展示取消这个功能。
  1625. _permissions.isdownload = false; //是否允许下载,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1626. _permissions.isnew = false; //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1627. _permissions.ispaste = false; //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1628. _permissions.isrefresh = false; //是否允许刷新, 现在所有的文件都有刷新权限
  1629. _permissions.isupload = false; //是否允许上传,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  1630. _permissions.isview = false; //是否允许视图切换,所有的文件夹都支持
  1631. _permissions.isedit = false; //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  1632. }
  1633. else {
  1634. //在我的ftp中,我可以操作所有人的东西,我具备所有的权限
  1635. _isgroup = _dirinfo.GroupID != ""; //是否是群文件
  1636. _isftp = _currentfileordir.GroupID == ""; //判断是否为ftp目录下的文件
  1637. //_isftp = diskinfo.userInfo.UserId == _currentfileordir.UserId; //判断是否为ftp目录下的文件
  1638. _isuserdisk = (diskinfo.userInfo.UserId == diskinfo.operator); //是否是属于自己的网盘
  1639. _isgroupmain = U.Json.select(diskinfo.groups, { "UserDirectoryID": _dirinfo.GroupID, "UserId": diskinfo.operator }).length > 0; //判断自己是否是群主
  1640. _ismyself = _currentfileordir.UserId == diskinfo.operator; //判断是否是操作本人的文件,群里的文件非本人创建的或者不是自己的群都不为自己的文件
  1641. //在我的ftp中,我可以操作所有人的东西,我具备所有的权限
  1642. //判断是否为本人操作
  1643. if (!_isuserdisk) {
  1644. //如果不是,为外来访客
  1645. //判断是否为ftp文件,如果不是
  1646. if (!_isftp) {
  1647. _permissions.isnew = false; //不允许新建
  1648. _permissions.isopen = false; //不允许打开
  1649. }
  1650. //判断是否为本人文件,如果不是
  1651. if (!_ismyself) {
  1652. _permissions.isupadte = false; //不允许修改
  1653. _permissions.isdelete = false; //不允许删除
  1654. _permissions.isshear = false; //不允许剪切
  1655. _permissions.isencryption = false; //不允许加密
  1656. _permissions.ispaste = false; //不允许粘贴
  1657. _permissions.isedit = false; //不允许编辑
  1658. }
  1659. } else {
  1660. //如果是自己的文件夹中
  1661. //判断是否为他人邀请文件夹,如果是
  1662. //判断是否为自己的文件,如果不是
  1663. if (_isgroup && !_ismyself && !_isgroupmain) {
  1664. _permissions.isupadte = false; //不允许修改
  1665. _permissions.isdelete = false; //不允许删除
  1666. _permissions.isshear = false; //不允许剪切
  1667. _permissions.isencryption = false; //不允许加密
  1668. _permissions.ispaste = false; //不允许粘贴
  1669. _permissions.isedit = false; //不允许编辑
  1670. }
  1671. //判断是否为协同文档的第一层,协同群,如果是
  1672. if (_isgroup && _currentfileordir.UserDirectoryDeep == 1) {
  1673. _permissions.isupadte = false; //不允许修改
  1674. _permissions.isdelete = false; //不允许删除
  1675. _permissions.isshear = false; //不允许剪切
  1676. _permissions.isencryption = false; //不允许加密
  1677. _permissions.ispaste = false; //不允许粘贴
  1678. _permissions.isedit = false; //不允许编辑
  1679. _permissions.iscopy = false; //不予许复制
  1680. _permissions.isdownload = false; //不予许下载
  1681. if (_currentfileordir.UserDirectoryName == "我的协同" || _currentfileordir.UserDirectoryName == "他人邀请") {
  1682. _permissions.isnew = false; //不允许新建
  1683. }
  1684. }
  1685. }
  1686. //1只允许上传
  1687. if (!_ismyself && _readwrite.indexOf("1") > -1) {
  1688. _permissions.isdownload = false; //不允许下载
  1689. _permissions.copy = false; //不允许复制
  1690. _permissions.isshear = false; //不允许剪切
  1691. }
  1692. //2只允许下载
  1693. if (!_ismyself && _readwrite.indexOf("2") > -1) {
  1694. _permissions.isnew = false; //不允许新建
  1695. _permissions.isupload = false; //不允许上传
  1696. _permissions.ispaste = false; //不允许粘贴
  1697. }
  1698. //如果是文件的话就没有视图模式
  1699. if (fileordirid && fileordirid.filetype == 1) {
  1700. _permissions.isview = false;
  1701. }
  1702. else {
  1703. _permissions.isreply = false;
  1704. }
  1705. if (!diskinfo.pasteDirOrFile) {
  1706. _permissions.ispaste = false; //不允许粘贴
  1707. }
  1708. }
  1709. //选择了多目录的处理
  1710. if (diskinfo.selectElement && diskinfo.selectElement.length > 1) {
  1711. _permissions.isopen = false; //取消同时打开的功能
  1712. _permissions.isupadte = false; //取消修改的功能
  1713. }
  1714. diskinfo.permissions = _permissions; //设置权限
  1715. return _permissions;
  1716. }
  1717. /**
  1718. * 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1719. * @param {string} 操作的目录id
  1720. * @param {array} 用户的网盘信息
  1721. * @param {object} 在该目录下操作的文件
  1722. * @return {array} 得到操作权限数组
  1723. * 0 判断该目录是否允许上传 1、自己建立的目录是可以下载的 2、没有限制只允许上传的可以下载
  1724. * 1 判断该目录是否允许下载 1、自己建立的目录是可以上传的 2、ftp中没有限制只允许上传的是可以下载
  1725. * 2 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1726. * 3 获取上传的目录用户对应的临时目录
  1727. * 4 判断操作的文件是否有本人有关 包含是本人创建、本人网盘里、在本人创建的群里
  1728. U.MD.DK.C.getDirectoryPermissions = function (fileordirid, diskinfo) {
  1729. diskinfo = diskinfo || US.disk.UserDisk; //需要操作的当前用户的网盘信息
  1730. var _isftp, //是否操作ftp
  1731. _ismyself, //是否操作本人网盘内容
  1732. _isuserdisk, //是否在自己的网盘中
  1733. _isgroup, //是否在群里
  1734. _isgroupmain,
  1735. _permissions = { //所有的权限
  1736. "isopen": true, //是否允许打开, 现在所有的文件都有打开权限
  1737. "isupadte": true, //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1738. "isdelete": true, //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1739. "iscopy": true, //是否允许复制,现在所有的文件都有复制权限
  1740. "isshear": true, //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1741. "isencryption": false, //是否允许加密,展示取消这个功能。
  1742. "isreply": true, //是否允许加密,展示取消这个功能。
  1743. "isdownload": true, //是否允许下载,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1744. "isnew": true, //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1745. "ispaste": true, //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1746. "isrefresh": true, //是否允许刷新, 现在所有的文件都有刷新权限
  1747. "isupload": true, //是否允许上传,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  1748. "isview": true, //是否允许视图切换,所有的文件夹都支持
  1749. "isedit": true //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  1750. },
  1751. _permissioninfo = U.MD.DK.C.readWritePermission(fileordirid, diskinfo), //获取权限
  1752. _dirinfo = _permissioninfo[0][_permissioninfo[0].length - 1], //所操作的文件或者是文件夹所操作的目录
  1753. _currentfileordir = _permissioninfo[0][0], //当前操作的文件或者文件夹
  1754. _readwrite = _permissioninfo.splice(1) //得到文件的读写权限和祖先元素
  1755. ;
  1756. //如果是未登录、群、最新文档,协同文档,则没有权限操作
  1757. if (_currentfileordir && !US.userInfo.UserId || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[0].UserDirectoryID || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[1].UserDirectoryID || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[2].UserDirectoryID) {
  1758. _permissions = { //所有的权限
  1759. "isopen": false, //是否允许打开, 现在所有的文件都有打开权限
  1760. "isupadte": false, //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1761. "isdelete": false, //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1762. "iscopy": false, //是否允许复制,现在所有的文件都有复制权限
  1763. "isshear": false, //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1764. "isencryption": false, //是否允许加密,展示取消这个功能。
  1765. "isreply": false, //是否允许加密,展示取消这个功能。
  1766. "isdownload": false, //是否允许上传,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1767. "isnew": false, //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1768. "ispaste": false, //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1769. "isrefresh": false, //是否允许刷新, 现在所有的文件都有刷新权限
  1770. "isupload": false, //是否允许下载,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  1771. "isview": false, //是否允许视图切换,所有的文件夹都支持
  1772. "isedit": false //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  1773. }
  1774. }
  1775. // //如果是群目录下的处理
  1776. // else if (_currentfileordir.filetype == 0 && _dirinfo.GroupID == _currentfileordir.GroupID) {
  1777. // _permissions = { //所有的权限
  1778. // "isopen": false, //是否允许打开, 现在所有的文件都有打开权限
  1779. // "isupadte": false, //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1780. // "isdelete": false, //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1781. // "iscopy": false, //是否允许复制,现在所有的文件都有复制权限
  1782. // "isshear": false, //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1783. // "isencryption": false, //是否允许加密,展示取消这个功能。
  1784. // "isreply": true, //是否允许加密,展示取消这个功能。
  1785. // "isdownload": false, //是否允许上传,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1786. // "isnew": true, //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1787. // "ispaste": true, //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1788. // "isrefresh": true, //是否允许刷新, 现在所有的文件都有刷新权限
  1789. // "isupload": true, //是否允许下载,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  1790. // "isview": true, //是否允许视图切换,所有的文件夹都支持
  1791. // "isedit": true //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  1792. // }
  1793. // }
  1794. else {
  1795. //在我的ftp中,我可以操作所有人的东西,我具备所有的权限
  1796. _isgroup = _dirinfo.GroupID != null; //是否是群文件
  1797. _isftp = _dirinfo.GroupID == _currentfileordir.GroupID; //判断是否为ftp目录下的文件
  1798. _isuserdisk = (diskinfo.userInfo.UserId == diskinfo.operator); //是否是属于自己的网盘
  1799. _isgroupmain = U.Json.select(diskinfo.groups, { "UserDirectoryID": _dirinfo.GroupID, "UserId": diskinfo.operator }).length > 0; //判断自己是否是群主
  1800. _ismyself = _currentfileordir.UserId == diskinfo.operator; //判断是否是操作本人的文件,群里的文件非本人创建的或者不是自己的群都不为自己的文件
  1801. //不是自己的文件,同时不是在ftp,或者不是群主的处理
  1802. if (!_ismyself && !_isftp && !_isgroupmain) {
  1803. _permissions.isupadte = false; //不允许修改
  1804. _permissions.isdelete = false; //不允许删除
  1805. _permissions.isshear = false; //不允许剪切
  1806. _permissions.isencryption = false; //不允许加密
  1807. _permissions.ispaste = false; //不允许粘贴
  1808. _permissions.isedit = false; //不允许编辑
  1809. //如果不是ftp连新建的权限也取消
  1810. if (!_isftp) {
  1811. _permissions.isnew = false; //不允许新建
  1812. }
  1813. }
  1814. //1只允许上传
  1815. if (!_ismyself && _readwrite.indexOf("1") > -1) {
  1816. _permissions.isdownload = false; //不允许下载
  1817. _permissions.copy = false; //不允许复制
  1818. _permissions.isshear = false; //不允许剪切
  1819. }
  1820. //2只允许下载
  1821. if (!_ismyself && _readwrite.indexOf("2") > -1) {
  1822. _permissions.isnew = false; //不允许新建
  1823. _permissions.isupload = false; //不允许上传
  1824. _permissions.ispaste = false; //不允许粘贴
  1825. }
  1826. //如果是文件的话就没有视图模式
  1827. if (fileordirid && fileordirid.filetype == 1) {
  1828. _permissions.isview = false;
  1829. }
  1830. else {
  1831. _permissions.isreply = false;
  1832. }
  1833. if (!diskinfo.pasteDirOrFile) {
  1834. _permissions.ispaste = false; //不允许粘贴
  1835. }
  1836. }
  1837. //选择了多目录的处理
  1838. if (diskinfo.selectElement && diskinfo.selectElement.length > 1) {
  1839. _permissions.isopen = false; //取消同时打开的功能
  1840. _permissions.isupadte = false; //取消修改的功能
  1841. }
  1842. diskinfo.permissions = _permissions; //设置权限
  1843. return _permissions;
  1844. }
  1845. */
  1846. /**
  1847. * 弹出选择网盘还是上传
  1848. *
  1849. * @param {string} 文件的后缀
  1850. * @return {object}
  1851. */
  1852. U.MD.DK.C.getIcon = function (extendtype) {
  1853. var i,
  1854. _application = US.disk.applicationTypes //获取所有打开应用的信息
  1855. ;
  1856. if (extendtype) {
  1857. //循环信息中找到指定的应用的信息
  1858. for (i in _application) {
  1859. //找到后缀名对应的程序信息
  1860. if (_application[i].types.indexOf(extendtype.toLowerCase()) > -1) {
  1861. return _application[i]; //返回应用的信息
  1862. }
  1863. }
  1864. }
  1865. return _application["unknownfile"]; //如果是本站未知的后缀直接归属于文件
  1866. }
  1867. /**
  1868. * 网盘上传的处理
  1869. * @param {object} 获取服务器返回值
  1870. * @param {string} 上传文件的唯一识别id
  1871. */
  1872. U.MD.DK.C.upload = function (diskinfo) {
  1873. //判断该目录是否允许上传的处理
  1874. if (diskinfo.permissions.isupload) {
  1875. var _groupid,
  1876. _ancestors,
  1877. _directoryid = diskinfo.directoryid,
  1878. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": _directoryid })[0]
  1879. ;
  1880. //获取粘贴到制定目录的群id
  1881. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  1882. //如果是ftp目录,那么groupid就是用户id
  1883. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  1884. _groupid = diskinfo.userInfo.UserId;
  1885. }
  1886. //否则就是对应的群id,如果不存在那么就是""
  1887. else {
  1888. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  1889. }
  1890. //调用上传处理
  1891. U.MD.UI.upload(
  1892. "http://disk.1473.cn/USUpfile.ashx?typename=UploadFlashfile&DirectoryId=" + _directoryid + "&Encrypt=" + _groupid + "&UserId=" + US.userInfo.UserId + "&IsF=true", //上传的地址
  1893. //上传成功的回调函数
  1894. function (r, fileinfo) {
  1895. var _data = r.data //获取服务器返回值
  1896. ; //根据文件的唯一识别id获取文件的信息
  1897. //获取从服务器获取的值,这里加一个错误处理,因为如果后台出现了错误,那么eval的过程就会失败
  1898. try {
  1899. _data = eval("0," + _data);
  1900. }
  1901. catch (e) { }
  1902. //文件上传成功
  1903. if (_data) {
  1904. U.MD.DK.C.success({
  1905. "UserFilesServerName": _data[0], //上传成功后存在fs.1473.cn的地址
  1906. "UseFilesServerThumbnailName": _data[1], //如果是图片上传,那么这里有缩略图的地址
  1907. "UserFilesID": _data[2], //文件在数据的id
  1908. "size": _data[3], //文件的大小
  1909. "UserDirectoryEncrypt": _data[4], //文件的加密情况,这里和分组id是一样的
  1910. "UserDirectoryID": _data[5], //文件归属的目录id
  1911. "UserDirectoryName": fileinfo.name
  1912. }, _dirinfo, diskinfo);
  1913. }
  1914. },
  1915. //得到md5的回调函数
  1916. function (md5, fileinfo, cb) {
  1917. //根据用户的md5值判断用户是否需要上传,如果需要上传则需要执行上传处理,如果已经存在后台直接给用户生成文件路径等录入数据库
  1918. U.A.Request(US.DISK, ["IfFileExistInsertDB", US.userInfo.UserId, _directoryid, _groupid, fileinfo.size, md5, U.UF.UP.getFileNameAndExtension(fileinfo.name)[1], fileinfo.name],
  1919. //判断上传文件是否存在
  1920. function (r) {
  1921. var _userid = US.userInfo.UserId; //当前登录用户的id
  1922. r = r.value;
  1923. //获取服务器返回的值,如果服务器响应出问题了,eval的时候就会报错。
  1924. try {
  1925. r = eval(r)[0];
  1926. }
  1927. catch (e) { }
  1928. //当用户想上传的文件已经在数据库里存在了,那么后台会执行复制数据的操作。
  1929. if (r) {
  1930. U.MD.DK.C.success({
  1931. "UserFilesServerName": r.UserFilesServerName, //上传成功后存在fs.1473.cn的地址
  1932. "UseFilesServerThumbnailName": r.UserDirectoryUrl, //如果是图片上传,那么这里有缩略图的地址
  1933. "UserFilesID": r.UserDirectoryID, //文件在数据的id
  1934. "size": r.UserDirectorySize, //文件的大小
  1935. "UserDirectoryEncrypt": r.UserDirectoryEncrypt, //文件的加密情况,这里和分组id是一样的
  1936. "UserDirectoryID": r.UserDirectoryParentID, //文件归属的目录id
  1937. "UserDirectoryName": r.UserDirectoryName
  1938. }, _dirinfo, diskinfo);
  1939. cb(false);
  1940. }
  1941. //否则调用flash里面的函数执行用户的上传操作。
  1942. else {
  1943. cb(true);
  1944. }
  1945. });
  1946. });
  1947. }
  1948. }
  1949. /**
  1950. * 上传成功直接添加
  1951. * @param {object} 获取服务器返回值
  1952. * @param {string} 上传文件的唯一识别id
  1953. */
  1954. U.MD.DK.C.success = function (uploadinfo, dirinfo, diskinfo) {
  1955. var _userinfo = US.userInfo, //上传用户的信息
  1956. _extendtype = U.UF.UP.getFileNameAndExtension(uploadinfo.UserDirectoryName)[1], //上传文件的后缀名
  1957. _img = uploadinfo.UseFilesServerThumbnailName, //上传文件展示到网盘的图片
  1958. _groupid = uploadinfo.GroupID,
  1959. //上传文件成功后,由前端的数据结构生成一个数据实体,实际传参请参考函数里面的数据结构
  1960. _fileinfo = new U.MD.DK.M.entity(
  1961. uploadinfo.UserFilesID, //上传文件的id
  1962. uploadinfo.size, //上传文件的大小
  1963. uploadinfo.UserDirectoryID, //上传文件对应的目录id
  1964. uploadinfo.UserDirectoryName.addEllipsis(20), //上传文件的简写名
  1965. uploadinfo.UserDirectoryName, //上传文件的名字
  1966. _extendtype, //上传文件的后缀
  1967. uploadinfo.UserFilesServerName, //上传文件的服务器地址
  1968. U.UF.D.toTimeStamp(new Date()), //上传文件成功的时间
  1969. _img ? _img : U.MD.DK.C.getIcon(_extendtype)[1], //上传文件展示到网盘的图片
  1970. 9999, //上传文件的层次,这里文件是没有层次的,所以以9999区表达
  1971. null, //文件的修改时间
  1972. uploadinfo.UserDirectoryEncrypt, //上传文件的加密或者是限制
  1973. 1, //标识该文件在网盘中识别为文件
  1974. "", //上传文件的描述
  1975. _groupid, //归属的群id
  1976. "", //uw office内容
  1977. _userinfo.UserId, //归属用户的id
  1978. _userinfo.UserNickName, //归属用户的名字
  1979. _userinfo.UserName, //归属用户的用户名
  1980. _userinfo.UserThumbnailImageHead //归属用户的头像
  1981. );
  1982. //如果是上传到网盘的处理
  1983. if (_fileinfo) {
  1984. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, dirinfo); //添加值
  1985. diskinfo && U.Alert("文件: " + _fileinfo.UserDirectoryName + " 已上传至" + dirinfo.UserallDirectoryName + "目录下");
  1986. }
  1987. return _fileinfo;
  1988. }
  1989. /**
  1990. * 拖动选择多个元素的处理
  1991. * @param {element} 拖动的区域元素
  1992. */
  1993. U.MD.DK.C.selectElement = function (el, diskinfo) {
  1994. var i, classname, hoverclass,
  1995. _viewtype = diskinfo.viewtype || "Normal",
  1996. _child = U.selectEl(el).Child(),
  1997. _fileinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": diskinfo.directoryid })[0];
  1998. diskinfo.selectElement = []; //清空所有的选择元素
  1999. //如果是在他人邀请 最新文档 我的协同里 则没有拖选按钮
  2000. if (_fileinfo && _fileinfo.GroupID !== true) {
  2001. //普通视图的处理
  2002. if (_viewtype == "Normal") {
  2003. classname = "U_MD_DK_RZO";
  2004. hoverclass = "U_MD_DK_RZO U_MD_DK_RZOI";
  2005. }
  2006. //详细视图的处理
  2007. else {
  2008. classname = "U_MD_DK_RZS U_MD_DK_RZXO";
  2009. hoverclass = "U_MD_DK_RZS U_MD_DK_RZXO U_MD_DK_RZXOO";
  2010. }
  2011. //如果不是空文件状态下的处理
  2012. if (_child[0].className != "U_MD_DK_RZF") {
  2013. //点击的时候循环清空所有元素选择状态
  2014. for (i = 0; i < _child.length; i++) {
  2015. //如果元素状态是选中状态的处理
  2016. if (_child[i].className == hoverclass) {
  2017. _child[i].className = classname;
  2018. }
  2019. }
  2020. //拖动选择处理
  2021. U.UF.F.dragSelect(el, function (arr) {
  2022. var i,
  2023. _isclass;
  2024. //循环元素的处理
  2025. for (i = 0; i < _child.length; i++) {
  2026. _isclass = arr.indexOf(_child[i]);
  2027. //判断元素是否
  2028. if (_isclass == -1 && _child[i].className == hoverclass) {
  2029. _child[i].className = classname;
  2030. }
  2031. //判断
  2032. else if (_isclass > -1) {
  2033. _child[i].className = hoverclass;
  2034. }
  2035. }
  2036. diskinfo.selectElement = arr; //得到所有的选择元素
  2037. });
  2038. }
  2039. }
  2040. };
  2041. ///<jscompress sourcefile="DiskData.js" />
  2042. Namespace.register("U.MD.DK.M"); //Disk树操作
  2043. //disk变量使用区域
  2044. //硬盘里面复制粘贴的全局变量。,暂未整理。
  2045. //US.disk.DiskDaren = {};
  2046. //包含了当前所有用户的硬盘目录文件等数据的信息.
  2047. US.disk.Disks = {};
  2048. //当前操作用户的网盘数据,相当于US.disk.Disks[userid]。
  2049. US.disk.UserDisk = null;
  2050. // US.disk.Disks 用户网盘数据前台存储的全局变量 该全局变量为一个数组
  2051. // US.disk.Disks[userid].directoryOrFiles 0为该userid用户下面的所有网盘目录及文件的数据信息。以数组形式展示
  2052. // US.disk.Disks[userid].userInfo 用户信息,包含了用户在网盘的信息
  2053. // US.disk.Disks[userid].directoryid 1为当前打开目录的id
  2054. // US.disk.Disks[userid].currentDirectoryFile 当前打开目录下面所有的文件和文件夹
  2055. // US.disk.Disks[userid].formel formel为当前网盘用户的弹框,这个是唯一的。
  2056. // US.disk.Disks[userid].operator 使用该用户网盘的用户id,为登录用户的id或者是全0的guid
  2057. //例:US.disk.Disks["张三"]; //张三的网盘信息,张三需要用guid表示,US.disk.Disks["95f7bacc-0b3a-4265-a2ea-15e066b97bf7"]
  2058. //例:US.disk.Disks["李四"]; //李四的网盘信息,李四需要用guid表示。US.disk.Disks["f6d7a4b6-e34c-4964-beed-24187b2cb1ba"]
  2059. //
  2060. //disk文件和文件夹实体,US.disk.Disks里面的内容的数据结构。
  2061. U.MD.DK.M.entity = function (directoryid, size, parentid, shortname, name, extendtype, serverurl, addtime, iconurl, deep, modifytime, encryt, filetype, descript, groupid, officevalue, userid, usernickname, username, imagehead) {
  2062. this.UserDirectoryID = directoryid; //文件id或者目录id
  2063. this.UserDirectorySize = size; //文件大小。
  2064. this.UserDirectoryParentID = parentid; //父亲id
  2065. this.UserDirectoryName = shortname; //文件名或者文件夹名,
  2066. this.UserallDirectoryName = name; //文件名或者文件夹名,会删除不要
  2067. this.UserDirectoryExtendType = extendtype; //文件扩展名,目录扩展名为folder,加密的目录也有一个标识。
  2068. this.UserFilesServerName = serverurl; //文件服务器链接地址,需要统一加US.FILESYSTEMURL + filesinfo.UserDirectoryUrl
  2069. this.UserDirectoryAddTime = addtime; //文件或者文件夹添加时间
  2070. this.UserDirectoryUrl = iconurl; //文件服务器链接地址,缩略图,需要统一加US.FILESYSTEMURL + filesinfo.UserDirectoryUrl
  2071. this.UserDirectoryDeep = deep; //文件夹深度
  2072. this.UserDirectoryModifyTime = modifytime; //文件或者文件夹修改时间
  2073. this.UserDirectoryEncrypt = encryt; //文件夹加密
  2074. this.filetype = filetype; //文件类型,文件夹为1,文件为0
  2075. this.Descript = descript; //文件描述。例如图片,声音,视频的描述
  2076. this.GroupID = groupid; //群id,用于群文件
  2077. this.UsOffice = officevalue; //文件内容。
  2078. this.UserId = userid; //文件或者文件夹所属用户id
  2079. this.UserNickName = usernickname; //文件或者文件夹所属用户昵称
  2080. this.UserName = username; //文件或者文件夹所属用户账号
  2081. this.UserThumbnailImageHead = imagehead; //文件或者文件夹所属用户头像
  2082. this.Child = null; //文件夹中的子文件夹数组。
  2083. this.Parent = null; //文件或者文件夹的父亲
  2084. }
  2085. //初始化一级目录的全局变量。即左边树目录结构。
  2086. US.disk.initTree = [
  2087. [Guid.newGuid(), 0, US.MYDISK, "最新文档", "最新文档", "folder", null, null, null, 0, null, null, 0, "", true],
  2088. [Guid.newGuid(), 0, US.MYDISK, "我的协同", "我的协同", "folder", null, null, null, 0, null, null, 0, "", true],
  2089. [Guid.newGuid(), 0, US.MYDISK, "他人邀请", "他人邀请", "folder", null, null, null, 0, null, null, 0, "", true],
  2090. [US.MYFOLDERID, 0, US.MYDISK, "电脑", "我的文档(私密)", "folder", null, null, null, 0, null, null, 0, ""],
  2091. [US.FTPFOLDERID, 0, US.MYDISK, "ftp", "共享文档", "folder", null, null, null, 0, null, null, 0, "", ""]
  2092. ];
  2093. // [US.VIDEOFOLDERID, 0, US.MYDISK, "视频", "在线视频", "folder", null, null, null, 1, null, null, 0, ""],
  2094. // [US.IMAGEFOLDERID, 0, US.MYDISK, "相册", "图片、相册", "folder", null, null, null, 1, null, null, 0, ""],
  2095. // [US.MUSICEFOLDERID, 0, US.MYDISK, "音乐", "音乐收听", "folder", null, null, null, 1, null, null, 0, ""]
  2096. //文件类型全局变量。
  2097. US.disk.fileType = {
  2098. "image": ["jpg", "gif", "png", "bmp", "jpeg", "JPG", "GIF", "BMP", "PNG", "JPEG"],
  2099. "music": ["mp3"],
  2100. "video": ["wmv", "video", "ogg", "webm", "mp4"],
  2101. "usword": ["uw"],
  2102. "word": ["doc", "docx"],
  2103. "usnav": ["un"],
  2104. "usexcel": ["ue"],
  2105. "text": ["rtf", "mht", "txt", "htm", "html", "wsh", "wsf", "cpp", "c", "css", "txt", "php", "cs", "java", "log", "sql", "jsp"]
  2106. }
  2107. //全局变量,应用程序类型,包含了应用扩展名,id,中文描述,图标的css名。
  2108. US.disk.applicationTypes = {
  2109. "image": {
  2110. //图片类型的后缀
  2111. "types": US.disk.fileType.image,
  2112. //该格式对应在网盘的目录id
  2113. "directoryid": US.IMAGEFOLDERID,
  2114. //格式对应的名字
  2115. "name": "图片",
  2116. //格式对应的样式
  2117. "classname": ["U_MD_UI_UP_COIT"]
  2118. },
  2119. "music": {
  2120. //音乐类型的后缀
  2121. "types": US.disk.fileType.music,
  2122. //该格式对应在网盘的目录id
  2123. "directoryid": US.MUSICEFOLDERID,
  2124. //格式对应的名字
  2125. "name": "音乐",
  2126. //格式对应的样式
  2127. "classname": ["U_MD_UI_UP_COIY", "U_MD_DK_RZOY", "U_MD_DK_LCY"]
  2128. },
  2129. "video": {
  2130. //视频类型的后缀
  2131. "types": US.disk.fileType.video,
  2132. //该格式对应在网盘的目录id
  2133. "directoryid": US.VIDEOFOLDERID,
  2134. //格式对应的名字
  2135. "name": "视频",
  2136. //格式对应的样式
  2137. "classname": ["U_MD_UI_UP_COIS", "U_MD_DK_RZOP", "U_MD_DK_LCP"]
  2138. },
  2139. "word": {
  2140. //互联办公word文档格式
  2141. "types": US.disk.fileType.word,
  2142. //该格式对应在网盘的目录id
  2143. "directoryid": US.MYFOLDERID,
  2144. //格式对应的名字
  2145. "name": "Office文档",
  2146. //格式对应的样式
  2147. "classname": ["U_MD_UI_UP_COIW", "U_MD_DK_REODW", "U_MD_DK_LCD"]
  2148. },
  2149. "uw": {
  2150. //互联办公word文档格式
  2151. "types": US.disk.fileType.usword,
  2152. //该格式对应在网盘的目录id
  2153. "directoryid": US.MYFOLDERID,
  2154. //格式对应的名字
  2155. "name": "文档",
  2156. //格式对应的样式
  2157. "classname": ["U_MD_UI_UP_COIW", "U_MD_DK_RZOD", "U_MD_DK_LCD"]
  2158. },
  2159. "un": {
  2160. //互联办公word文档格式
  2161. "types": US.disk.fileType.usnav,
  2162. //该格式对应在网盘的目录id
  2163. "directoryid": US.MYFOLDERID,
  2164. //格式对应的名字
  2165. "name": "建站文档",
  2166. //格式对应的样式
  2167. "classname": ["U_MD_UI_UP_COIW", "U_MD_DK_REODN", "U_MD_DK_LCD"]
  2168. },
  2169. "ue": {
  2170. //互联办公Excel文档格式
  2171. //视频类型的后缀
  2172. "types": US.disk.fileType.usexcel,
  2173. //该格式对应在网盘的目录id
  2174. "directoryid": US.EMPTYGUID,
  2175. //格式对应的名字
  2176. "name": "文档",
  2177. //格式对应的样式
  2178. "classname": ["U_MD_UI_UP_COIE", "U_MD_DK_RZOE", "U_MD_DK_LCE"]
  2179. },
  2180. "text": {
  2181. //可以通过记事本打开的文件格式
  2182. "types": US.disk.fileType.text,
  2183. //该格式对应在网盘的目录id
  2184. "directoryid": US.EMPTYGUID,
  2185. //格式对应的名字
  2186. "name": "文件",
  2187. //格式对应的样式
  2188. "classname": ["U_MD_UI_UP_COIT", "downel_content_a_r", "U_MD_DK_LCB"]
  2189. },
  2190. "folder": {
  2191. //文件夹处理,一种是加密文件夹,一种是不加密
  2192. "types": ["folder", "folderencrypt"],
  2193. //该格式对应在网盘的目录id
  2194. "directoryid": US.EMPTYGUID,
  2195. //格式对应的名字
  2196. "name": "文件夹",
  2197. //格式对应的样式
  2198. "classname": ["", "U_MD_DK_RZOW", "U_MD_DK_LCW"]
  2199. },
  2200. "group": {
  2201. //文件夹处理,一种是加密文件夹,一种是不加密
  2202. "types": ["group"],
  2203. //该格式对应在网盘的目录id
  2204. "directoryid": US.EMPTYGUID,
  2205. //格式对应的名字
  2206. "name": "群",
  2207. //格式对应的样式
  2208. "classname": ["", "U_MD_DK_RZOG", "U_MD_DK_LCW"]
  2209. },
  2210. "unknownfile": {
  2211. //无法用应用打开的文件类型
  2212. "types": [],
  2213. //该格式对应在网盘的目录id
  2214. "directoryid": US.MYFOLDERID,
  2215. //格式对应的名字
  2216. "name": "文件",
  2217. //格式对应的样式
  2218. "classname": ["U_MD_UI_UP_COIT", "downel_content_a_r", "U_MD_DK_LCB"]
  2219. }
  2220. }
  2221. /**
  2222. * 循环添加文件到全局树里
  2223. * @param {array} 文件数组
  2224. * @param {object} 网盘全局信息
  2225. * @param {object} 添加文件是否具有群id
  2226. */
  2227. U.MD.DK.M.entity.add = function (filesinfo, diskinfo, isgroup) {
  2228. var i;
  2229. for (i = 0; i < filesinfo.length; i++) {
  2230. //如果是新建群文件,则通过放在前面,这样的话查询方便
  2231. if (isgroup) {
  2232. diskinfo.directoryOrFiles.splice(5, 0, filesinfo[i]);
  2233. }
  2234. //普通文件添加处理
  2235. else {
  2236. diskinfo.directoryOrFiles.push(filesinfo[i]);
  2237. }
  2238. }
  2239. }
  2240. /**
  2241. * 循环添加文件到全局树里
  2242. * @param {array} 文件数组
  2243. * @param {object} 制定的文件夹的信息
  2244. */
  2245. U.MD.DK.M.entity.addChild = function (filesinfo, dirinfo) {
  2246. //在指定的目录下的文件添子文件或者文件夹
  2247. if (!dirinfo.Child) { //如果有子目录那么就直接添加
  2248. dirinfo.Child = [];
  2249. }
  2250. //循环文件处理
  2251. for (var i = 0; i < filesinfo.length; i++) {
  2252. dirinfo.Child.push(filesinfo[i]);
  2253. filesinfo[i].Parent = dirinfo;
  2254. }
  2255. }
  2256. /**
  2257. * 循环添加文件到全局树里
  2258. * @param {array} 文件数组
  2259. * @param {object} 制定文件夹的信息
  2260. * @param {object} 添加文件是否具有群id
  2261. */
  2262. U.MD.DK.M.entity.del = function (filesinfo, diskinfo) {
  2263. var i,
  2264. j,
  2265. _parent,
  2266. // _delfilesize = 0, //删除的文件大小
  2267. // _delfilenum = 0, //删除的文件数量
  2268. _diskfileanddir = diskinfo.directoryOrFiles //网盘
  2269. ;
  2270. //文件信息
  2271. for (i = 0; i < filesinfo.length; i++) {
  2272. //网盘所有的文件信息
  2273. for (j = 0; j < _diskfileanddir.length; j++) {
  2274. //找到指定需要删除的文件
  2275. if (_diskfileanddir[j].UserDirectoryID == filesinfo[i].UserDirectoryID) {
  2276. _diskfileanddir.splice(j, 1); //在disk里面删除文件或者文件夹
  2277. break;
  2278. }
  2279. }
  2280. _parent = filesinfo[i].Parent; //获取移除目录的上级目录
  2281. //循环移除子元素
  2282. for (j = 0; j < _parent.Child.length; j++) {
  2283. //找到指定需要删除的文件
  2284. if (_parent.Child[j].UserDirectoryID == filesinfo[i].UserDirectoryID) {
  2285. _parent.Child.splice(j, 1); //在disk里面删除文件或者文件夹
  2286. }
  2287. }
  2288. }
  2289. }
  2290. /**
  2291. * 递归修改所有的子目录文件的Id
  2292. * @param {array} 文件数组
  2293. * @param {object} 修改的属性 例:{groupid:a} //修改所有的群id
  2294. */
  2295. U.MD.DK.M.recursionUpdateDirectory = function (filesinfo, attribute) {
  2296. //循环所有的文件修改
  2297. for (i = 0; i < filesinfo.length; i++) {
  2298. //修改文件的属性
  2299. U.UF.C.AddObj(filesinfo[i], attribute);
  2300. //如果文件是文件夹,那么查找自己节点元素,不断的递归修改
  2301. if (!filesinfo[i].fileType && filesinfo[i].Child) {
  2302. //递归修改
  2303. U.MD.DK.M.recursionUpdateDirectory(filesinfo[i].Child, attribute);
  2304. }
  2305. }
  2306. }
  2307. /**
  2308. * 用户操作切换,可以查看多个用户的硬盘,所以需要切换。登录用户和非登录用户有不同权限。
  2309. * @param {string} 用户id
  2310. * @param {string} 用户名
  2311. * @return {object} 用户在网盘的全局变量。
  2312. */
  2313. U.MD.DK.M.diskOperatingSwitch = function (userid, username) {
  2314. userid = userid || US.userInfo.UserId; //如果有用户id,则userid为用户id,否则为登录用户id。
  2315. if (userid) {
  2316. var i, _userinfo, //需要返回的用户网盘信息
  2317. _diskinfo = US.disk.Disks; //_UCE为包含了所有用户硬盘信息的集合。
  2318. if (_diskinfo && !_diskinfo[userid]) { //判断用户的网盘信息是否可以通过userid找到
  2319. for (i in _diskinfo) { //循环网盘信息
  2320. if (_diskinfo[i] && _diskinfo[i][1] && _diskinfo[i][1][0] && _diskinfo[i][1][0].UserName == username) { //这里也会有null情况,因为这个变量的定义在U.A.Request之前,所以可能会存在还没有获取数据就在此进入这个函数的情况
  2321. userid = _diskinfo[i][1][0].UserId;
  2322. }
  2323. }
  2324. }
  2325. US.disk.UserDisk = _diskinfo[userid]; //设置当前使用的网盘用户的信息为得到的用户id
  2326. return _diskinfo[userid];
  2327. }
  2328. }
  2329. /**
  2330. * 通过用户名搜索用户网盘信息
  2331. * @param {string} 用户名
  2332. * @return {object} 用户在网盘的全局变量。
  2333. */
  2334. U.MD.DK.getUserDiskByName = function (username) {
  2335. var i,
  2336. _userdisk, //获取的用户硬盘信息
  2337. _diskinfo = US.disk.Disks; //存储打开用户的网盘的信息
  2338. for (i in _diskinfo) { //循环获取
  2339. _userdisk = _diskinfo[i][1]; //查看用户网盘信息
  2340. if (_userdisk && _userdisk[0].UserName == username) { //判断网盘信息的用户名是否等于传入的用户名
  2341. return _userdisk[0];
  2342. }
  2343. }
  2344. return {};
  2345. }
  2346. ;
  2347. ///<jscompress sourcefile="DiskHome.js" />
  2348. ;
  2349. ///<jscompress sourcefile="DiskSearch.js" />
  2350. //---------------------------------------------------------------------------网络硬盘搜索------------------------------------------------------------------------------
  2351. Namespace.register("U.MD.DK.S"); //Disk搜索的命名空间
  2352. //#region 本地搜索
  2353. /**
  2354. * 自己的网盘搜索
  2355. *
  2356. * @param {element} 输入的元素
  2357. * @param {element} 输入的元素
  2358. **/
  2359. U.MD.DK.S.search = function (inputel, diskinfo) {
  2360. var _value = inputel.value, //搜索框内容
  2361. _diskinfo = diskinfo || US.disk.UserDisk, //网盘信息
  2362. _searchfileordir = []; //搜索文件或目录
  2363. if (_value == "") {//如果没有搜索内容
  2364. _searchfileordir = _diskinfo.currentDirectoryFile; //显示当前所有文件
  2365. }
  2366. else {
  2367. for (var i = 0; i < _diskinfo.directoryOrFiles.length; i++) {//模糊搜索
  2368. if (_diskinfo.directoryOrFiles[i].UserallDirectoryName.indexOf(_value) >= 0) {//如果文件夹名包含搜索框的内容
  2369. _searchfileordir.push(_diskinfo.directoryOrFiles[i]); //则显示到网盘中
  2370. }
  2371. }
  2372. }
  2373. //以后做新窗口弹出。
  2374. _content = U.selectEl("#U_MD_DK_RZ", _diskinfo.formel)[0]; //用户的网盘打印内容
  2375. _content.innerText = "";
  2376. U.selectEl(".U_MD_DK_RKR")[1].innerHTML = "当前文件的数量:" + (_searchfileordir.length); //当前文件的数量
  2377. U.MD.DK.VW.printContent(_searchfileordir, _content); //打印搜索的结果。
  2378. }
  2379. //#endregion
  2380. ;
  2381. ///<jscompress sourcefile="DiskView.js" />
  2382. Namespace.register("U.MD.DK.VW"); //Disk视图操作命名空间
  2383. //#region 追随设置
  2384. /* 跟新追随信息
  2385. *
  2386. * @param diskel {element} 网盘窗体元素
  2387. * @param userid {string} 用户id
  2388. **/
  2389. U.MD.DK.VW.followState = function (diskel, userid) {
  2390. var _followbutton = U.selectEl(".U_MD_DK_LIRS", diskel);
  2391. _followbutton.attr("user", userid);
  2392. if (userid == US.userInfo.UserId) {
  2393. _followbutton[0].innerHTML = "本人";
  2394. }
  2395. else if (US.friend.friends && U.Json.select(US.friend.friends, { UserId: userid })[0]) {
  2396. _followbutton[0].innerHTML = "已追随";
  2397. _followbutton.addClass("U_MD_DK_LIRSED");
  2398. } else {
  2399. _followbutton[0].innerHTML = "追随";
  2400. _followbutton.removeClass("U_MD_DK_LIRSED");
  2401. }
  2402. }
  2403. /* 追随按钮点击事件
  2404. *
  2405. **/
  2406. U.MD.DK.VW.followState.click = function (button) {
  2407. var _userid = U.selectEl(button).attr("user");
  2408. var _userinfo;
  2409. if (_userid == US.userInfo.UserId) {
  2410. return;
  2411. } else if (US.friend.friends && (_userinfo = U.Json.select(US.friend.friends, { UserId: _userid })[0])) {
  2412. U.MD.F.M.deleteFriend(_userinfo, function () {
  2413. button.innerHTML = "追随";
  2414. U.selectEl(button).removeClass("U_MD_DK_LIRSED");
  2415. });
  2416. } else {
  2417. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserId", _userid], function (r) {//根据用户名获取用户信息
  2418. if (r.value && r.value[0]) {
  2419. U.MD.F.M.addFriend(r.value[0], function () {
  2420. button.innerHTML = "已追随";
  2421. U.selectEl(button).addClass("U_MD_DK_LIRSED");
  2422. });
  2423. } else {
  2424. U.Alert("用户信息有误,请稍后尝试...");
  2425. }
  2426. });
  2427. }
  2428. }
  2429. //#endregin
  2430. //#region 目录文件打印
  2431. /**
  2432. * 打印网盘视图输出判断的地方 分为普通视图输出和详细视图输出
  2433. * @param {array} 需要输出的文件或者文件夹信息
  2434. * @param {element} 输出到那个区域
  2435. **/
  2436. U.MD.DK.VW.viewsSwitch = function (viewtype, diskinfo) {
  2437. var _contentel = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0], //内容元素
  2438. _viewnav = U.selectEl(_contentel).prev()[0] //导航元素
  2439. ;
  2440. diskinfo.viewtype = _contentel.viewtype = viewtype; //视图
  2441. if (diskinfo.currentDirectoryFile.length) {
  2442. _contentel.innerHTML = ""; //先清空处理
  2443. U.MD.DK.VW.printContent(diskinfo.currentDirectoryFile, _contentel); //打印内容
  2444. //这里是普通视图处理
  2445. if (viewtype == "Normal") {
  2446. _contentel.style.width = ""; //普通视图不修改大小
  2447. _viewnav.style.display = "none";
  2448. _contentel.style.height = U.selectEl(_contentel).Parent(2).offsetHeight - 79 + "px"
  2449. }
  2450. //详细视图处理
  2451. else {
  2452. U.MD.DK.VW.size(diskinfo); //详细视图的时候需要设置大小和样式,这里统一处理
  2453. }
  2454. }
  2455. }
  2456. /**
  2457. * 根据时间排序
  2458. * @param {object} 用户网盘信息
  2459. **/
  2460. U.MD.DK.VW.SortView = function (diskinfo, type, cb) {
  2461. var _filesinfo = diskinfo.currentDirectoryFile, //用户展示在改文件夹下所有的文件
  2462. _contentel = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0]
  2463. ;
  2464. //判断文件是否存在,如果有打印文件,那么就进行文件的打印,否则不做任何处理
  2465. if (_filesinfo.length) {
  2466. //判断头两个文件的创建时间,进行排序处理
  2467. if (_filesinfo[0].UserDirectoryAddTime > _filesinfo[1].UserDirectoryAddTime) {
  2468. //文件降序处理
  2469. U.UF.Math.sequence(_filesinfo, type, cb, 1);
  2470. } else {
  2471. //文件升序处理
  2472. U.UF.Math.sequence(_filesinfo, type, cb, -1);
  2473. }
  2474. //重新打印内容
  2475. _contentel.innerHTML = "";
  2476. U.MD.DK.VW.printContent(_filesinfo, _contentel); //打印
  2477. }
  2478. }
  2479. /**
  2480. * 打印网盘视图输出判断的地方 分为普通视图输出和详细视图输出
  2481. * @param {array} 需要输出的文件或者文件夹信息
  2482. * @param {element} 输出到那个区域
  2483. **/
  2484. U.MD.DK.VW.printContent = function (filesinfo, el) {
  2485. var _diskinfo = US.disk.UserDisk, //用户网盘的数据
  2486. _viewtype = el.viewtype || "Normal", //打印的格式
  2487. _viewnav = U.selectEl(el).prev()[0] //视图导航
  2488. ;
  2489. //判断是否有需要输出的文件信息
  2490. if (filesinfo.length) {
  2491. //打印的模式 这里是普通视图输出
  2492. if (_viewtype == "Normal") {
  2493. U.MD.DK.VW.printNormalView(filesinfo, el); //输出
  2494. }
  2495. //详细视图输出
  2496. else {
  2497. U.MD.DK.VW.printDetailedView(filesinfo, el); //详细视图输出
  2498. }
  2499. }
  2500. //如果还有输出的信息在div上面那么不输出空文件的提示
  2501. else if (!$(el).Child().length) {
  2502. U.MD.DK.VW.printNullView(el); //没有文件的时候样式输出
  2503. }
  2504. }
  2505. /**
  2506. * 空文件提示信息输出
  2507. * @param {element} 输出到那个区域
  2508. **/
  2509. U.MD.DK.VW.printNullView = function (el) {
  2510. var _viewel,
  2511. _infoel,
  2512. _promptel,
  2513. _viewel = $$("div", { "className": "U_MD_DK_RZF" }, el);
  2514. _infoel = $$("div", { "className": "U_MD_DK_RZFS" }, _viewel);
  2515. $$("div", { "className": "U_MD_DK_RZTSL U_MD_DK_RZFSL", "innerHTML": "!" }, _infoel);
  2516. _promptel = $$("div", { "className": "U_MD_DK_RZFSR" }, _infoel);
  2517. //提示信息
  2518. _infoel = $$("div", { "className": "U_MD_DK_RZFSRS" }, _promptel);
  2519. $$("div", { "className": "U_MD_DK_RZFSRS", "innerHTML": "这地方暂时" }, _infoel);
  2520. $$("div", { "className": "U_MD_DK_RZFSRS", "innerHTML": " 没有资源哦。" }, _infoel);
  2521. $$("div", { "className": "U_MD_DK_RZTSRX U_MD_DK_RZFSRX", "innerHTML": "Nothing!!" }, _promptel);
  2522. }
  2523. /**
  2524. * 普通视图打印
  2525. * @param {array} 需要输出的文件或者文件夹信息
  2526. * @param {element} 输出到那个区域
  2527. **/
  2528. U.MD.DK.VW.printNormalView = function (filesinfo, el) {
  2529. //变量定义区域
  2530. var i, //用于循环
  2531. _isencryp, //判断文件夹是否加密处理
  2532. _date, //文件当前使用时间
  2533. _icon, //获取文件的icon样式,包含多种
  2534. _imgicon, //打印给用户看到的文件类型对应的图标的样式,上面的是
  2535. _iconel, //图标元素
  2536. _imgeel, //输入给用户看到的元素
  2537. _infoel, //信息输出元素
  2538. _userimg, //用户头像
  2539. _frag = $$("frag"), //临时panel
  2540. _diskinfo = US.disk.UserDisk, //用户网盘信息
  2541. _userid = _diskinfo.userInfo.UserId //当前使用用户的id
  2542. ;
  2543. //逻辑输出区域
  2544. for (i = 0; i < filesinfo.length; i++) {
  2545. //获取文件的信息
  2546. _isencryp = (filesinfo[i]["UserDirectoryEncrypt"] && filesinfo[i]["UserDirectoryEncrypt"] != _userid); //判断文件夹是否是加密属性
  2547. _date = U.UF.D.formatDateToArray(filesinfo[i]["UserDirectoryAddTime"], "Array"); //获取文件的创建时间数组 返回值包含 [年, 月, 日]
  2548. //判断是否为协同群文件
  2549. if (U.MD.DK.VW.collaborativeFileJudgment(filesinfo[i]) == true && filesinfo[i].UserDirectoryExtendType == "folder" && filesinfo[i].Parent.UserDirectoryName == "我的协同" || U.MD.DK.VW.collaborativeFileJudgment(filesinfo[i]) == true && filesinfo[i].UserDirectoryExtendType == "folder" && filesinfo[i].Parent.UserDirectoryName == "他人邀请") {
  2550. filesinfo[i].UserDirectoryExtendType = "group";
  2551. }
  2552. _icon = U.MD.DK.C.getIcon(filesinfo[i].UserDirectoryExtendType); //根据文件扩展名,得到图标的样式
  2553. //创建一个文件夹图标或者文件图标。
  2554. _viewel = $$("div", {
  2555. "title": filesinfo[i]["UserallDirectoryName"],
  2556. "className": "U_MD_DK_RZO",
  2557. "id": "R" + (filesinfo[i].UserDirectoryID),
  2558. "onmousedown": function () {
  2559. var _isindex = _diskinfo.selectElement.indexOf(this); //元素是否在多选元素的位置
  2560. if (_isindex > -1) {
  2561. U.UF.EV.stopBubble(); //onmousedown设置阻止冒泡
  2562. }
  2563. },
  2564. "oncontextmenu": U.UF.C.closure(function (fileinfo) {
  2565. U.UF.EV.stopBubble();
  2566. U.UF.EV.stopDefault();
  2567. U.MD.DK.RM.rightMenu(this, fileinfo, US.disk.UserDisk); //右键菜单
  2568. }, [filesinfo[i]])
  2569. }, _frag);
  2570. //设置点击事件
  2571. if (filesinfo[i].filetype == "1") { //普通文件的处理
  2572. _viewel.onclick = U.UF.C.closure(function (fileinfo) {
  2573. U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
  2574. }, [filesinfo[i]]);
  2575. }
  2576. else { //文件夹的处理,文件夹的处理这里加一个前进后退的添加
  2577. _viewel.onclick = U.UF.C.closure(function (fileinfo) {
  2578. U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
  2579. }, [filesinfo[i]]);
  2580. }
  2581. //图标处理
  2582. _imgicon = "";
  2583. _iconel = $$("div", { "className": "U_MD_DK_RZOA" }, _viewel);
  2584. //文件夹处理
  2585. if (filesinfo[i].filetype != 1) {
  2586. //加密的处理
  2587. if (_isencryp) {
  2588. _imgicon = "U_MD_DK_Img U_MD_DK_RZOM";
  2589. }
  2590. //未加密的处理
  2591. else {
  2592. _imgicon = _icon.classname[1] ? "U_MD_DK_Img " + _icon.classname[1] : "U_MD_DK_Img U_MD_DK_RZOW";
  2593. }
  2594. }
  2595. //根据上面根据类型获取的图标输出图标样式
  2596. else if (_icon.classname[1]) {
  2597. _imgicon = "U_MD_DK_Img " + _icon.classname[1];
  2598. }
  2599. _imgeel = $$("div", { "className": "U_MD_DK_RZOS " + _imgicon }, _iconel);
  2600. //如果图标是空图标,给空图标写入后缀名
  2601. if (_icon.name == "文件") {
  2602. $$("div", { "className": "U_MD_DK_RZOSZ", "innerHTML": filesinfo[i].UserDirectoryExtendType || "" }, _imgeel);
  2603. }
  2604. else if (!_icon.classname[1]) {
  2605. $$("img", {
  2606. "onerror": U.MD.C.imgError,
  2607. "onerror": function () {
  2608. U.MD.C.imgError(this, 1);
  2609. },
  2610. "title": "点击查看",
  2611. "src": U.MD.C.getHeadImage(filesinfo[i].UserDirectoryUrl)
  2612. }, _imgeel);
  2613. }
  2614. //目录名输出
  2615. _infoel = $$("div", { "className": "U_MD_DK_RZOZO" }, _iconel);
  2616. $$("div", { "className": "U_MD_DK_RZOZ", "innerHTML": filesinfo[i]["UserallDirectoryName"] }, _infoel);
  2617. //大小
  2618. _infoel = $$("div", { "className": "U_MD_DK_RZOFXJ U_MD_D_Text_Abbreviation" }, _infoel);
  2619. $$("span", { "className": "U_MD_DK_RZOFXJO", "innerHTML": _date[0] + "-" + _date[1] + "-" + _date[2] }, _infoel);
  2620. if (filesinfo[i].filetype != 0) {
  2621. $$("span", { "className": "U_MD_DK_RZOFXJT", "innerHTML": U.UF.UP.minUnitToMaxUnit(filesinfo[i]["UserDirectorySize"]) }, _infoel);
  2622. }
  2623. //线面输入文件归属用户的信息 头像和名字
  2624. _infoel = $$("div", { "className": "U_MD_DK_RZOF" }, _viewel);
  2625. _infoel = $$("div", { "className": "U_MD_DK_RZOFD" }, _infoel);
  2626. _userimg = $$("div", { "className": "U_MD_DK_RZOFDI" }, _infoel);
  2627. //用户头像输出
  2628. $$("img", {
  2629. "onerror": U.MD.C.imgError,
  2630. "onerror": U.MD.C.imgError, "title": "点击查看",
  2631. "src": U.MD.C.getHeadImage(filesinfo[i].UserThumbnailImageHead),
  2632. "onclick": function () {
  2633. U.UF.EV.stopBubble(); U.MD.U.V.ViewOtherUserInfo(filesinfo[i].UserId);
  2634. }
  2635. }, _userimg);
  2636. //归属用户名输出
  2637. $$("div", { "className": "U_MD_DK_RZOFDN U_MD_D_Text_Abbreviation", "innerHTML": filesinfo[i].UserNickName || filesinfo[i]["UserallDirectoryName"] }, _infoel);
  2638. }
  2639. //追加元素
  2640. U.selectEl(el).append(_frag); // , 0, el.firstChild
  2641. }
  2642. /**
  2643. * 详细视图输出
  2644. * @param {array} 需要输出的文件或者文件夹信息
  2645. * @param {element} 输出到那个区域
  2646. **/
  2647. U.MD.DK.VW.printDetailedView = function (filesinfo, el) {
  2648. //变量定义区域
  2649. var i, //用于循环
  2650. _isencryp, //判断文件夹是否加密处理
  2651. _date, //文件当前使用时间
  2652. _icon, //获取文件的icon样式,包含多种
  2653. _iconandnameel, //图标和名字展示的区域
  2654. _ischecked = false, //判断文件是否给选中
  2655. _userimg, //用户头像
  2656. _frag = $$("frag"), //临时panel
  2657. _userid = US.disk.UserDisk.userInfo.UserId //当前使用用户的id
  2658. ;
  2659. //逻辑输出区域
  2660. for (i = 0; i < filesinfo.length; i++) {
  2661. //获取文件的信息
  2662. _isencryp = (filesinfo[i]["UserDirectoryEncrypt"] && filesinfo[i]["UserDirectoryEncrypt"] != _userid); //判断文件夹是否是加密属性
  2663. _date = U.UF.D.formatDateToArray(filesinfo[i]["UserDirectoryAddTime"]); //获取文件的创建时间数组 返回值包含 [年, 月, 日]
  2664. _icon = U.MD.DK.C.getIcon(filesinfo[i].UserDirectoryExtendType); //根据文件扩展名,得到图标的样式
  2665. //创建一个文件夹图标或者文件图标。
  2666. _viewel = $$("div", { "title": filesinfo[i]["UserallDirectoryName"], "className": "U_MD_DK_RZS U_MD_DK_RZXO", "id": "R" + (filesinfo[i].UserDirectoryID) }, _frag);
  2667. //设置右键按钮的处理
  2668. _viewel.oncontextmenu = function () {
  2669. U.UF.EV.stopBubble();
  2670. U.MD.DK.RM.rightMenu(_viewel, filesinfo[i], US.disk.UserDisk);
  2671. };
  2672. _viewel.onmousedown = function () {
  2673. var _isindex = _diskinfo.selectElement.indexOf(this); //元素是否在多选元素的位置
  2674. if (_isindex > -1) {
  2675. U.UF.EV.stopBubble(); //onmousedown设置阻止冒泡
  2676. }
  2677. }
  2678. //设置点击事件
  2679. _viewel.onclick = U.UF.C.closure(function (fileinfo) {
  2680. U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
  2681. }, [filesinfo[i]]);
  2682. _iconandnameel = $$("div", { "className": "U_MD_DK_RZSO", "style": { "marginLeft": "0px" } }, _viewel);
  2683. //多选的按钮设置
  2684. $$("input", {
  2685. "className": "U_MD_DK_RZSOI",
  2686. "checked": _ischecked,
  2687. "type": "checkbox",
  2688. "onclick": function () {
  2689. U.UF.EV.stopBubble();
  2690. U.MD.DK.VW.checkFile(this);
  2691. }
  2692. }, _iconandnameel);
  2693. _iconandnameel = $$("div", { "className": "U_MD_DK_RZSM U_MD_D_Text_Abbreviation" }, _viewel);
  2694. //设置图标如果有图标设置图标,没有图标的是图片
  2695. if (_icon.classname[2]) {
  2696. $$("span", { "className": _icon.classname[2] + " U_MD_DK_RZSMI U_MD_DK_Img U_MD_D_Text_Abbreviation", "innerHTML": " &nbsp; &nbsp; &nbsp;" }, _iconandnameel);
  2697. }
  2698. else {
  2699. $$("img", {
  2700. "onerror": U.MD.C.imgError,
  2701. "onerror": function () {
  2702. U.MD.C.imgError(this, 1);
  2703. },
  2704. "title": "点击查看",
  2705. "src": U.MD.C.getHeadImage(filesinfo[i].UserDirectoryUrl || (US.FILESYSTEMURL + filesinfo[i].UseFilesServerThumbnailName))
  2706. }, _iconandnameel);
  2707. }
  2708. //文件名
  2709. $$("span", { "className": "U_MD_DK_RZSMN", "innerHTML": filesinfo[i]["UserallDirectoryName"] }, _iconandnameel);
  2710. //引用次数,暂时没有功能
  2711. $$("div", { "className": "U_MD_DK_RZSF U_MD_DK_RZSFO U_MD_D_Text_Abbreviation", "innerHTML": 0 }, _viewel);
  2712. //归属用户名字
  2713. $$("div", { "className": "U_MD_DK_RZSL U_MD_D_Text_Abbreviation", "innerHTML": filesinfo[i]["UserNickName"] }, _viewel);
  2714. //文件类别名字,如文件夹、图片等等
  2715. $$("div", { "className": "U_MD_DK_RZSX U_MD_D_Text_Abbreviation", "innerHTML": _icon.name }, _viewel);
  2716. //文件大小
  2717. $$("div", { "className": "U_MD_DK_RZSD U_MD_D_Text_Abbreviation", "innerHTML": U.UF.UP.minUnitToMaxUnit(filesinfo[i]["UserDirectorySize"]) }, _viewel);
  2718. //时间
  2719. $$("div", { "className": "U_MD_DK_RZST U_MD_D_Text_Abbreviation", "innerHTML": _date[0] + "-" + _date[1] + "-" + _date[2] + " " + _date[3] + ":" + _date[4] }, _viewel);
  2720. }
  2721. //追加元素
  2722. el.appendChild(_frag);
  2723. }
  2724. /**
  2725. * 判断文件是否为群文件
  2726. * @param {array} 文件夹信息
  2727. **/
  2728. U.MD.DK.VW.collaborativeFileJudgment = function (filesinfo) {
  2729. if (filesinfo.Parent != null) {//判断文件是否为最高及,如果不是
  2730. return U.MD.DK.VW.collaborativeFileJudgment(filesinfo.Parent); //获取它的高级,进行自循环
  2731. }
  2732. if (filesinfo.GroupID == true && filesinfo.UserDirectoryName == "我的协同" || filesinfo.GroupID == true && filesinfo.UserDirectoryName == "他人邀请") {//判断文件是否为我的协同或他人邀请,如果是
  2733. return true; //返回true
  2734. }
  2735. return false; //如果不是,返回false
  2736. }
  2737. /**
  2738. * 详细视图的大小变化使用
  2739. * @param {array} 需要输出的文件或者文件夹信息
  2740. * @param {element} 输出到那个区域
  2741. **/
  2742. U.MD.DK.VW.size = function (diskinfo) {
  2743. var i, j, k, //循环变量
  2744. _childel,
  2745. _size = [0.1, 0.2, 0.1, 0.15, 0.15, 0.15, 0.14], //详细视图每一格的大小
  2746. _contentel = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0], //内容元素
  2747. _contentchildel = U.selectEl(_contentel).Child(), //内容的子元素
  2748. _navel = U.selectEl(_contentel).prev()[0], //导航元素
  2749. _navchildel = U.selectEl(_navel).Child(), //导航的子元素
  2750. _width = U.selectEl(_contentel).width(), //获取编辑区域的长度
  2751. _height = U.selectEl(_contentel).height() //获取编辑区域的高度
  2752. ;
  2753. _navel.style.display = "block"; //导航按钮出现
  2754. //视图格式处理,要满足有数据,没有数据不做任何处理
  2755. if (_contentel.viewtype === "Detailed" && diskinfo.currentDirectoryFile.length) {
  2756. for (i = 0; i < _size.length; i++) {
  2757. //导航按钮区域处理
  2758. for (j = 0; j < _navchildel.length; j += 2) {
  2759. _navchildel[j].style.width = _width * _size[j / 2] + "px"; //导航按钮带下处理
  2760. }
  2761. //内容区域处理
  2762. for (j = 0; j < _contentchildel.length; j++) {
  2763. _childel = U.selectEl(_contentchildel).Child();
  2764. for (k = 0; k < _childel.length; k++) {
  2765. _childel[k].style.width = _width * _size[k] + "px"; //内容区域大小处理
  2766. }
  2767. }
  2768. }
  2769. _navel.style.width = _width + "px"; //导航区域设置大小
  2770. _contentel.style.height = _height + "px";
  2771. }
  2772. }
  2773. /**
  2774. * 全选文件
  2775. * @param {element} 输出到那个区域
  2776. * @param {string} 输出到那个区域
  2777. **/
  2778. U.MD.DK.VW.checkAllFile = function (el) {
  2779. var i,
  2780. _ischeck = el.checked, //选择的状态
  2781. _classname = "U_MD_DK_RZS U_MD_DK_RZXO" + (_ischeck ? " U_MD_DK_RZXOO" : ""), //选择或者取消选择的样式
  2782. _contentel = U.selectEl($(el).Parent(2)).next()[0], //内容区域的元素
  2783. _childel = U.selectEl(_contentel).Child() //所有输出的文件或者文件夹
  2784. ;
  2785. for (i = 0; i < _childel.length; i++) {
  2786. _childel[i].className = _classname; //样式处理
  2787. U.selectEl("input", _childel[i])[0].checked = _ischeck; //选中状态
  2788. }
  2789. }
  2790. /**
  2791. * 再详细视图下选择文件
  2792. * @param {element} 输出到那个区域
  2793. * @param {string} 输出到那个区域
  2794. **/
  2795. U.MD.DK.VW.checkFile = function (el) {
  2796. var _ischeck = el.checked; //获取文件是选择还是取消选择
  2797. //选择或者取消选择的处理
  2798. U.selectEl(el).Parent(2).className = "U_MD_DK_RZS U_MD_DK_RZXO" + (_ischeck ? " U_MD_DK_RZXOO" : "");
  2799. }
  2800. //#endregion
  2801. //#region 选择保存位置窗口
  2802. /**
  2803. * 选择文件保存位置窗口打印
  2804. * @param postfix {string} 文件后缀 文件类型
  2805. * @param filename {string} 文件名
  2806. * @param callback {function} 回调函数
  2807. * @param formtitle {string} 窗体名称
  2808. * @param extendtype {string} 显示的文件属性
  2809. **/
  2810. U.MD.DK.VW.chosenSaveFile = function (postfix, fileid, filename, callback, formtitle, extendtype) {
  2811. if (!U.MD.U.L.isLogin()) {//是否登录
  2812. extendtype = extendtype || "folder"; //默认只显示文件夹
  2813. var _diskinfo = US.disk.Disks[US.userInfo.UserId]; //获取当前登录用户的网盘信息
  2814. var _formel = U.selectEl('#U_MD_DK_VW_ChosenSaveFile')[0]; //获取窗体元素
  2815. var _file; //定义变量
  2816. if (_formel) { //判断窗体是否存在
  2817. //存在则居中显示
  2818. U.UF.F.windowTopCenter(_formel);
  2819. //获取文件区域
  2820. _file = U.selectEl('#U_MD_DK_VW_ChosenSaveFile_File')[0];
  2821. _file.innerHTML = "";
  2822. U.selectEl('.U_MD_DK_VW_ChosenSaveFile button', _formel)[1].onclick = function () {
  2823. U.MD.DK.VW.chosenSaveFile.ensure(_formel, U.selectEl('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0], postfix, fileid, callback);
  2824. }
  2825. U.selectEl('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0].value = "";
  2826. }
  2827. else {
  2828. var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" }); //创建文件区域容器
  2829. var _newfolder = $$('button', { style: { position: "absolute", right: "0", top: "2px" }, innerHTML: "新建文件夹" }, _box); //创建新建文件夹按钮
  2830. $$("div", { style: { "font-size": "16px", padding: "12px 10px 2px" }, innerHTML: "选择文件夹" }, _box); //创建标题
  2831. $$("hr", {}, _box); //创建分割线
  2832. _file = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_DK_VW_ChosenSaveFile_File" }, _box); //创建文件区域
  2833. var _inputarea = $$('div', {}, _box); //创建填写文件名区域
  2834. $$('span', { 'innerHTML': '文件名:' }, _inputarea); //标题
  2835. var _input = $$('input', { placeholder: filename || "请输入文件名...", style: { width: "89%", "text-indent": "5px", "line-height": "26px" } }, _inputarea); //文件名输入框
  2836. var _ensure = $$('button', { innerHTML: "确定" }, _box); //确定按钮
  2837. var _cancel = $$('button', { innerHTML: "取消" }, _box); //取消按钮
  2838. //创建窗体
  2839. _formel = new U.UF.UI.form(
  2840. "<span id='U_MD_DK_VW_ChosenSaveFile_Title'>" + (formtitle || "新建文件") + "</span>",
  2841. _box, {
  2842. "id": "U_MD_DK_VW_ChosenSaveFile",
  2843. "style": {
  2844. "width": "600px",
  2845. "height": "450px"
  2846. }
  2847. }).form;
  2848. //绑定新建文件夹事件
  2849. _newfolder.onclick = function () {
  2850. U.MD.DK.VW.chosenSaveFile.newFolder();
  2851. }
  2852. //绑定确定按钮事件
  2853. _ensure.onclick = function () {
  2854. U.MD.DK.VW.chosenSaveFile.ensure(_formel, _input, postfix, fileid, callback);
  2855. }
  2856. //取消函数
  2857. _cancel.onclick = function () {
  2858. U.UF.F.windowMinimize(_formel);
  2859. }
  2860. }
  2861. //默认创建初始化目录
  2862. U.MD.DK.VW.chosenSaveFile.printFolder(_diskinfo.directoryOrFiles.slice(1, 5), _file, 0, ["U_MD_DK_LCD", "U_MD_DK_LCS", "U_MD_DK_LCD", "U_MD_DK_LCB", "U_MD_DK_LCF", "U_MD_DK_LCT", "U_MD_DK_LCP", "U_MD_DK_LCY"], _file, extendtype);
  2863. }
  2864. }
  2865. /**
  2866. * 答应文件夹函数
  2867. * @param data {array} 数据源
  2868. * @param filearea {Element} 创建文件位置
  2869. * @param deviant {int} 偏移值
  2870. * @param iconclass {array} 文件图标class
  2871. * @param extendtype {string} 显示的文件属性
  2872. **/
  2873. U.MD.DK.VW.chosenSaveFile.printFolder = function (data, filearea, deviant, iconclass, topfilearea, extendtype) {
  2874. extendtype = extendtype || "folder";
  2875. var i, //定义循环变量
  2876. _class; //定义样式记录属性
  2877. for (i = 0; i < data.length; i++) { //循环答应
  2878. _class = null;
  2879. if (extendtype == "*" || extendtype.indexOf(extendtype) > -1) { //判断文件类型为文件夹才打印
  2880. if ((iconclass || "").length) { //判断文件图片class是否有传入
  2881. _class = iconclass[i] || iconclass; //设置样式名
  2882. } else if (data[i].UserDirectoryExtendType == extendtype || extendtype == "*") { //判断其能否显示,是不是想要的文件类型
  2883. switch (data[i].UserDirectoryExtendType) {
  2884. case "folder":
  2885. _class = "U_MD_DK_LCW"; //设置默样式名
  2886. break;
  2887. case "UW": case "txt": case "html": case "uw":
  2888. _class = "U_MD_DK_LCB";
  2889. break;
  2890. case "jpg": case "png":
  2891. _class = "U_MD_DK_LCT";
  2892. break;
  2893. case "mp4":
  2894. _class = "U_MD_DK_LCP";
  2895. break;
  2896. }
  2897. }
  2898. if (_class) { //判断其是否有样式,没有就不打印
  2899. U.MD.DK.VW.chosenSaveFile.Print(data[i], filearea, deviant, _class, topfilearea, extendtype); //调用单个打印函数
  2900. }
  2901. }
  2902. }
  2903. }
  2904. /**
  2905. * 打印文件夹函数
  2906. * @param data {object} 数据源
  2907. * @param filearea {Element} 创建文件位置
  2908. * @param deviant {int} 偏移值
  2909. * @param iconclass {string} 文件图标class
  2910. * @param extendtype {string} 显示的文件属性
  2911. **/
  2912. U.MD.DK.VW.chosenSaveFile.Print = function (data, filearea, deviant, iconclass, topfilearea, extendtype) {
  2913. var _filediv, _fileel, _folder; //设置变量
  2914. _folder = false; //
  2915. if (data.UserDirectoryExtendType == "folder") {//判断文件是否是文件夹
  2916. _folder = true;
  2917. };
  2918. _filediv = $$('div', { "className": "U_MD_DK_VW_ChosenSaveFile_File_Box" }, filearea); //创建单个文件区域
  2919. _fileel = $$('div', {
  2920. id: data["UserDirectoryID"] ? "CS" + data["UserDirectoryID"] : "",
  2921. "className": "U_MD_DK_LTXOS",
  2922. style: { 'padding-left': deviant + 'px' },
  2923. onclick: U.UF.C.closure(function (directoryinfo, el) { //设置点击事件
  2924. var _thisdate = data;
  2925. var _thisfolder = _folder;
  2926. U.UF.EV.stopBubble();
  2927. if (_thisfolder) {//判断点击的是否是文件夹
  2928. //如果是文件夹,就打开文件夹
  2929. U.MD.DK.VW.chosenSaveFile.forderClick(directoryinfo, el, topfilearea, extendtype);
  2930. //并且在选择该文件夹
  2931. if ($('.U_MD_DK_VW_ChosenSaveFileName')[0]) {
  2932. U.selectEl('.U_MD_DK_VW_ChosenSaveFileName')[0].value = data.UserallDirectoryName;
  2933. U.selectEl('.U_MD_DK_VW_ChosenSaveFileName')[0].data = data;
  2934. }
  2935. } else {
  2936. //不是文件夹就选择该文件
  2937. if ($('.U_MD_DK_VW_ChosenSaveFileName')[0]) {
  2938. U.selectEl('.U_MD_DK_VW_ChosenSaveFileName')[0].value = data.UserallDirectoryName;
  2939. U.selectEl('.U_MD_DK_VW_ChosenSaveFileName')[0].data = data;
  2940. }
  2941. }
  2942. }, [data, _filediv])
  2943. }, _filediv); //创建文件
  2944. if (_folder) {
  2945. $$('div', { className: "U_MD_DK_LTXOSI U_MD_DK_Img" }, _fileel); //创建文件角标
  2946. } else {
  2947. $$('div', { className: "U_MD_DK_LTXOSI" }, _fileel); //不创建文件角标
  2948. }
  2949. $$('div', { className: "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img " + iconclass }, _fileel); //创建文件icon
  2950. $$('span', { innerHTML: data.UserallDirectoryName }, _fileel); //创建文件名
  2951. return _filediv; //返回创建的文件元素
  2952. }
  2953. /**
  2954. * 文件夹展开关闭函数
  2955. * @param directoryinfo {object} 文件夹信息
  2956. * @param el {Element} 文件位置
  2957. * @param extendtype {string} 显示的文件属性
  2958. **/
  2959. U.MD.DK.VW.chosenSaveFile.forderClick = function (directoryinfo, el, topfilearea, extendtype) {
  2960. var //_filearea = U.selectEl('.U_MD_DK_VW_ChosenSaveFile_File')[0], //获取文件区域
  2961. _folder = U.selectEl(el).Child()[0], //获取每个文件
  2962. _deviant = parseInt(_folder.style.paddingLeft || 0) + 5; //计算偏移值
  2963. var _icon = U.selectEl('.U_MD_DK_LTXOSI', _folder); //获取角标
  2964. U.selectEl('.U_MD_DK_LTXOSO', topfilearea).removeClass('U_MD_DK_LTXOSO'); //清楚上一个选择的文件背景
  2965. U.selectEl(_folder).addClass('U_MD_DK_LTXOSO'); //设置当前文件背景为选中
  2966. if (_icon.hasClass('U_MD_DK_LTXOSIO')) { //判断文件是否展开
  2967. //已展开
  2968. _icon.removeClass('U_MD_DK_LTXOSIO'); //清楚展开角标样式
  2969. var _nextlevel = U.selectEl(_folder).next(); //判断是否加载了子文件夹
  2970. U.selectEl(_nextlevel).remove(); //删除子文件夹
  2971. } else {
  2972. //未展开
  2973. _icon.addClass('U_MD_DK_LTXOSIO'); //添加角标打开class
  2974. if (directoryinfo.Child) { //判断是否已获取子文件数据
  2975. //已获取
  2976. U.MD.DK.VW.chosenSaveFile.printFolder(directoryinfo.Child, $$('div', {}, el), _deviant, null, null, extendtype); //打印子级文件夹
  2977. } else {
  2978. //未获取则去数据库获取
  2979. U.MD.DK.LE.getChildsByDirectoryId(US.userInfo.UserId, directoryinfo, topfilearea, function () {
  2980. //打印文件夹
  2981. U.MD.DK.VW.chosenSaveFile.printFolder(directoryinfo.Child, $$('div', {}, el), _deviant, null, null, extendtype);
  2982. });
  2983. }
  2984. }
  2985. }
  2986. /**
  2987. * 确定按钮函数
  2988. * @param formel {object} 文件夹信息
  2989. * @param input {Element} 文件名输入框
  2990. * @param postfix {string} 文件后缀名
  2991. * @param callback {function} 回调函数
  2992. **/
  2993. U.MD.DK.VW.chosenSaveFile.ensure = function (formel, input, postfix, fileid, callback) {
  2994. var _name = input.value; //获取文件名
  2995. if (_name.trim() == "") { //判断是否为空
  2996. return U.Alert('请填写文件名!');
  2997. }
  2998. //判断文件名是否符合规范
  2999. if (U.UF.S.ZWFileName.test(_name)) {
  3000. var _nowfile = U.selectEl('.U_MD_DK_LTXOSO', formel)[0]; //获取当前选择的文件夹
  3001. if (!_nowfile) { //如果获取不到则为未选择
  3002. U.Alert('请选择文件夹新建的目录!'); //提示未选择文件
  3003. } else {
  3004. var _parentid = _nowfile.id.replace('CS', ''); //获取文件目录ID
  3005. var _userid = US.userInfo.UserId; //获取用户ID
  3006. var _diskinfo = US.disk.Disks[_userid]; //获取用户网盘信息
  3007. var _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0]; //获取文件夹信息
  3008. if (!U.MD.DK.C.getDirectoryPermissions(_dirinfo.UserDirectoryID, _diskinfo).isnew) {
  3009. return U.Alert(_dirinfo.Child.length ? '分类目录无法操作,请选择群文件或文件夹!' : '分类目录无法操作,请新建群或者选择其他群文件夹'); //提示未选择文件
  3010. }
  3011. //获取粘贴到制定目录的群id
  3012. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo); //获取所有的祖先
  3013. //如果是ftp目录,那么groupid就是用户id
  3014. if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
  3015. _groupid = _diskinfo.userInfo.UserId;
  3016. }
  3017. //否则就是对应的群id,如果不存在那么就是""
  3018. else {
  3019. _groupid = _ancestors[0].GroupID || "";
  3020. }
  3021. var _newfileid = fileid || Guid.newGuid();
  3022. //去数据库添加文件
  3023. U.A.Request(US.DISK, ["CreateFile", _userid, _newfileid, _parentid, _name, "", "", "", postfix, _groupid], function (r) {
  3024. //创建文件
  3025. var _fileinfo = new U.MD.DK.M.entity(_newfileid, 0, _parentid, _name, _name, postfix, "", U.UF.D.toTimeStamp(), "", "9999", null, "", 1, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  3026. U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, _dirinfo); //添加到页面上中
  3027. U.UF.F.windowMinimize(formel);
  3028. //如果存在就执行
  3029. if (U.UF.C.isFunction(callback)) {//判断是否有点击事件的方法,如果有,运行它
  3030. callback(_fileinfo);
  3031. }
  3032. }, []);
  3033. }
  3034. } else {
  3035. //不符合规范
  3036. U.Alert('请填写文件名符合规范!');
  3037. }
  3038. }
  3039. /**
  3040. * 新建文件夹函数
  3041. *
  3042. **/
  3043. U.MD.DK.VW.chosenSaveFile.newFolder = function () {
  3044. var _nowfile = U.selectEl('.U_MD_DK_VW_ChosenSaveFile_File .U_MD_DK_LTXOSO')[0]; //获取当前选择的文件夹
  3045. if (!_nowfile) { //如果获取不到则为未选择
  3046. return U.Alert('请选择文件夹新建的目录!'); //提示未选择文件
  3047. }
  3048. var _userid = US.userInfo.UserId; //获取用户ID
  3049. var _parentid = _nowfile.id.replace('CS', ''); //获取文件目录ID
  3050. var _diskinfo = US.disk.Disks[_userid]; //获取用户网盘信息
  3051. if (_diskinfo.directoryOrFiles[0].UserDirectoryID == _parentid || _diskinfo.directoryOrFiles[1].UserDirectoryID == _parentid || _diskinfo.directoryOrFiles[2].UserDirectoryID == _parentid) {//新建文件权限
  3052. U.Alert('该目录下无法新建文件夹,请重新选择目录!');
  3053. } else {
  3054. //创建新建文件名输入框
  3055. var _input = $$('input', { placeholder: "请输入文件夹名字...", style: { width: '180px', height: "25px", margin: "30px auto", display: "block", "text-indent": "5px" } });
  3056. //创建提示框
  3057. U.UF.UI.confirm(_input, function () {
  3058. //确定函数
  3059. var _name = _input.value; //获取输入文件夹名字
  3060. if (U.UF.S.ZWFileName.test(_name)) { //判断文件名是否符合规范
  3061. var _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0]; //获取文件夹信息
  3062. //获取粘贴到制定目录的群id
  3063. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo); //获取所有的祖先
  3064. //如果是ftp目录,那么groupid就是用户id
  3065. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  3066. _groupid = _diskinfo.userInfo.UserId;
  3067. }
  3068. //否则就是对应的群id,如果不存在那么就是""
  3069. else {
  3070. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  3071. }
  3072. var _newfolderid = Guid.newGuid(); //随机生成文件夹ID
  3073. //填写文件名符合规范 将文件夹以及文件夹名字保存到数据库
  3074. U.A.Request(US.DISK, ["CreateDirectory", _userid, _newfolderid, _dirinfo.UserDirectoryDeep + 1, _name, _parentid, "", _groupid, ""], //保存到数据库
  3075. function (r) {
  3076. //异步回调函数
  3077. var _nextlevel = U.selectEl(_nowfile).next()[0] || $$('div', {}, U.selectEl(_nowfile).Parent()); //获取或选择自己文件夹创建位置
  3078. var _fileinfo = new U.MD.DK.M.entity(_newfolderid, 0, _parentid, _name, _name, "folder", "", U.UF.D.toTimeStamp(), "", _dirinfo.UserDirectoryDeep + 1,
  3079. null, "", 0, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead); //创建本地文件信息
  3080. U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, _dirinfo); //添加到页面上中
  3081. _filediv = U.MD.DK.VW.chosenSaveFile.Print(_fileinfo, _nextlevel, parseInt(_nowfile.style.paddingLeft || 0) + 6, "U_MD_DK_LCW"); //打印新建文件夹
  3082. _nextlevel.insertBefore(_filediv, U.selectEl(_nextlevel).Child()[0]); //在最前方插入
  3083. });
  3084. } else {
  3085. //提示文件名不符合规范
  3086. U.Alert('请填写文件名符合规范!');
  3087. return false;
  3088. }
  3089. });
  3090. }
  3091. }
  3092. //#endregion
  3093. //#region 保存到指定协同群窗口
  3094. /**
  3095. * 保存到指定协同群窗口
  3096. *
  3097. * @param postfix {string} 文件后缀 文件类型
  3098. * @param fileinfo {object} 文件信息
  3099. * @param filename {string} 文件名
  3100. * @param type {string} 操作类型 move 移动 new 新建
  3101. * @param callback {function} 回调函数
  3102. *
  3103. **/
  3104. U.MD.DK.VW.saveSynergy = function (postfix, fileinfo, filename, type, callback) {
  3105. if (!U.MD.U.L.isLogin()) {//是否登录
  3106. var _grouplistarr = US.disk.Disks[US.userInfo.UserId]; //获取当前登录用户的网盘信息
  3107. var _formel = U.selectEl('#U_MD_O_SaveSynergy')[0]; //获取窗体元素
  3108. var _grouplist; //定义变量
  3109. if (_formel) { //判断窗体是否存在
  3110. //存在则居中显示
  3111. U.UF.F.windowTopCenter(_formel);
  3112. //获取文件区域
  3113. _grouplist = U.selectEl('#U_MD_O_SaveSynergy_GroupList')[0];
  3114. _grouplist.innerHTML = "";
  3115. U.selectEl('.U_MD_DK_VW_ChosenSaveFile button', _formel)[1].onclick = function () {
  3116. U.MD.DK.VW.saveSynergy.ensure(_formel, U.selectEl('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0], postfix, fileinfo, type, callback);
  3117. }
  3118. U.selectEl('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0].value = "";
  3119. }
  3120. else {
  3121. var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" }); //创建文件区域容器
  3122. var _creategroup = $$('button', { style: { position: "absolute", right: "0", top: "-2px" }, innerHTML: "新建群", id: "U_MD_O_SaveSynergy_CreateGroup", onclick: 'U.MD.DK.VW.saveSynergy.swith()' }, _box); //创建新建文件夹按钮
  3123. $$("div", { style: { "font-size": "16px", padding: "6px 10px 7px" }, innerHTML: "群列表" }, _box); //创建标题
  3124. $$("hr", {}, _box); //创建分割线
  3125. var _newgroup = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_O_SaveSynergy_NewGroup", style: { display: 'none', overflow: 'hidden' } }, _box); //创建文件区域
  3126. _grouplist = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_O_SaveSynergy_GroupList" }, _box); //创建文件区域
  3127. var _inputarea = $$('div', {}, _box); //创建填写文件名区域
  3128. $$('span', { 'innerHTML': '文件名:' }, _inputarea); //标题
  3129. var _input = $$('input', {
  3130. placeholder: "请输入文件名...",
  3131. value: filename == "未命名文档(点击编辑)..." ? "" : filename,
  3132. //onfocus: "U.UF.MR.inputPlaceholder(this,'未命名文档(点击编辑)...','')",
  3133. //onblur: "U.UF.MR.inputPlaceholder(this,'','未命名文档(点击编辑)...');",
  3134. style: { width: "89%", "text-indent": "5px", "line-height": "26px" }
  3135. }, _inputarea); //文件名输入框
  3136. var _ensure = $$('button', { innerHTML: "确定" }, _box); //确定按钮
  3137. var _cancel = $$('button', { innerHTML: "取消" }, _box); //取消按钮
  3138. //创建窗体
  3139. _formel = new U.UF.UI.form(
  3140. "<span id='U_MD_O_SaveSynergy_Title'>" + (type == 'move' ? "将文档移动到" : "选择保存到") + "指定群</span>",
  3141. _box, {
  3142. "id": "U_MD_O_SaveSynergy",
  3143. "style": {
  3144. "width": "600px",
  3145. "height": "450px"
  3146. }
  3147. }).form;
  3148. //绑定确定按钮事件
  3149. _ensure.onclick = function () {
  3150. U.MD.DK.VW.saveSynergy.ensure(_formel, _input, postfix, fileinfo, type, callback);
  3151. }
  3152. //取消函数
  3153. _cancel.onclick = function () {
  3154. U.UF.F.windowMinimize(_formel);
  3155. }
  3156. }
  3157. //打印文件
  3158. U.MD.DK.VW.chosenSaveFile.printFolder(_grouplistarr.directoryOrFiles.slice(1, 3), _grouplist, 0, ["U_MD_DK_LCD", "U_MD_DK_LCS"]);
  3159. //默认切换 选择群状态
  3160. U.MD.DK.VW.saveSynergy.swith(true);
  3161. }
  3162. };
  3163. /**
  3164. * 保存到指定协同群窗口 确定函数
  3165. *
  3166. * @param formel {element} 窗体元素
  3167. * @param input {element} 文件名输入框
  3168. * @param postfix {string} 文件后缀 文件类型
  3169. * @param fileinfo {object} 文件信息
  3170. * @param type {string} 操作类型 move 移动 new 新建
  3171. * @param callback {function} 回调函数
  3172. *
  3173. **/
  3174. U.MD.DK.VW.saveSynergy.ensure = function (formel, input, postfix, fileinfo, type, callback) {
  3175. var _name = input.value; //获取文件名
  3176. if (_name.trim() == "") { //判断是否为空
  3177. return U.Alert('请填写文件名!');
  3178. }
  3179. //判断文件名是否符合规范
  3180. if (U.UF.S.ZWFileName.test(_name)) {
  3181. var _dirinfo;
  3182. var _userid = US.userInfo.UserId; //获取用户ID
  3183. var _diskinfo = US.disk.Disks[_userid]; //获取用户网盘信息
  3184. if ($('#U_MD_O_SaveSynergy_GroupList').css('display') == 'none') {
  3185. var _groupName = '协同文档群--' + new Date().getHours() + ":" + new Date().getMinutes(), //默认群名/也是文档名
  3186. _groupDesc = "由" + US.userInfo.UserName + "发起的互联办公群组。";
  3187. U.MD.F.J.determineCreateGroupAndAddGroupUser(false, null, null, false, _groupName, _groupDesc, function (groupid) {
  3188. _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: groupid })[0]; //获取文件夹信息
  3189. U.MD.DK.VW.saveSynergy.ensure.operate(formel, _dirinfo, fileinfo, groupid, groupid, type, postfix, _name, callback);
  3190. });
  3191. } else {
  3192. var _groupid, _parentid;
  3193. var _nowfile = U.selectEl('.U_MD_DK_LTXOSO', formel)[0]; //获取当前选择的文件夹
  3194. _parentid = _nowfile.id.replace('CS', ''); //获取文件目录ID
  3195. _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0]; //获取文件夹信息
  3196. if (!U.MD.DK.C.getDirectoryPermissions(_dirinfo.UserDirectoryID, _diskinfo).isnew) {
  3197. return U.Alert(_dirinfo.Child.length ? '分类目录无法操作,请选择群文件或文件夹!' : '分类目录无法操作,请新建群或者选择其他群文件夹'); //提示未选择文件
  3198. }
  3199. //获取粘贴到制定目录的群id
  3200. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo); //获取所有的祖先
  3201. //如果是ftp目录,那么groupid就是用户id
  3202. if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
  3203. _groupid = _diskinfo.userInfo.UserId;
  3204. }
  3205. //否则就是对应的群id,如果不存在那么就是""
  3206. else {
  3207. _groupid = _ancestors[0].GroupID || "";
  3208. }
  3209. U.MD.DK.VW.saveSynergy.ensure.operate(formel, _dirinfo, fileinfo, _parentid, _groupid, type, postfix, _name, callback);
  3210. }
  3211. } else {
  3212. U.Alert('请填写文件名符合规范!');
  3213. }
  3214. }
  3215. /**
  3216. * 执行对应操作函数
  3217. *
  3218. * @param formel {element} 窗体元素
  3219. * @param dirinfo {object} 文件夹信息
  3220. * @param fileinfo {object} 文件信息
  3221. * @param parentid {string} 文件目录ID
  3222. * @param groupid {string} 群ID
  3223. * @param type {string} 操作类型 move 移动 new 新建
  3224. * @param postfix {string} 文件后缀 文件类型
  3225. * @param name {string} 文件名
  3226. * @param callback {function} 回调函数
  3227. *
  3228. **/
  3229. U.MD.DK.VW.saveSynergy.ensure.operate = function (formel, dirinfo, fileinfo, parentid, groupid, type, postfix, name, callback) {
  3230. var _fileid = fileinfo.UserDirectoryID;
  3231. var _userid = US.userInfo.UserId; //获取用户ID
  3232. var _diskinfo = US.disk.Disks[_userid]; //获取用户网盘信息
  3233. if (type == "move") {
  3234. var _pastecontent = US.disk.Disks[_userid].pasteDirOrFile = {
  3235. "type": "shear", //复制或者剪切 "copy" || "shear"
  3236. "UserDirectoryID": groupid, //在哪个目录复制或者剪切
  3237. "dirorfile": fileinfo, //复制的内容
  3238. "userid": _userid //用户id
  3239. }
  3240. U.A.Request(US.DISK, ["CutAndPasteFiles", fileinfo.UserId, groupid, fileinfo.UserDirectoryID, groupid, groupid],
  3241. top.U.MD.DK.RE.asynPaste, ["", dirinfo, groupid, _pastecontent, _diskinfo]);
  3242. U.A.Request(US.DISK, ["UpdateFileInfo", _fileid, name], function () {
  3243. fileinfo.UserallDirectoryName = name; //文件全写的名字
  3244. fileinfo.UserDirectoryName = name.addEllipsis(20); //文件的缩略名
  3245. fileinfo.GroupId = fileinfo.UserDirectoryEncrypt = groupid;
  3246. //如果存在就执行
  3247. if (U.UF.C.isFunction(callback)) {//判断是否有点击事件的方法,如果有,运行它
  3248. callback(fileinfo);
  3249. }
  3250. U.UF.F.windowMinimize(formel);
  3251. });
  3252. } else {
  3253. //去数据库添加文件
  3254. U.A.Request(US.DISK, ["CreateFile", _userid, _fileid, parentid, name, "", "", "", postfix, groupid], function (r) {
  3255. //创建文件
  3256. var _fileinfo = new U.MD.DK.M.entity(_fileid, 0, parentid, name, name, postfix, "", U.UF.D.toTimeStamp(), "", "9999", null, "", 1, "", groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  3257. U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, dirinfo); //添加到页面上中
  3258. U.UF.F.windowMinimize(formel);
  3259. //如果存在就执行
  3260. if (U.UF.C.isFunction(callback)) {//判断是否有点击事件的方法,如果有,运行它
  3261. callback(_fileinfo);
  3262. }
  3263. U.UF.F.windowMinimize(formel);
  3264. }, []);
  3265. }
  3266. }
  3267. /**
  3268. * 选择群、新建群方式切换
  3269. *
  3270. * @param init {boole} 是否为默认状态 选择群状态
  3271. *
  3272. **/
  3273. U.MD.DK.VW.saveSynergy.swith = function (init) {
  3274. var _newgroup = U.selectEl('#U_MD_O_SaveSynergy_NewGroup'); //新建群元素
  3275. var _grouplist = U.selectEl('#U_MD_O_SaveSynergy_GroupList'); //群列表
  3276. var _creategroup = U.selectEl('#U_MD_O_SaveSynergy_CreateGroup'); //按钮
  3277. if (_newgroup.css('display') == 'none' && !init) { //是否为新建群状态
  3278. _newgroup.css('display', 'block'); //新建群元素显示
  3279. _grouplist.css('display', 'none'); //选择群元素影藏
  3280. _creategroup[0].innerHTML = "返回群列表"; //修改按钮提示字
  3281. _creategroup[0].nextElementSibling.innerHTML = "选择联系人"; //修改标题
  3282. if (_newgroup.Child().length == 0) { //判断初始化窗体是否打印
  3283. U.MD.DK.VW.saveSynergy.createGroupInit(); //未打印则执行打印
  3284. }
  3285. U.MD.DK.VW.saveSynergy.Friends(); //打印可选好友
  3286. } else {
  3287. _newgroup.css('display', 'none'); //新建群元素显隐藏
  3288. _grouplist.css('display', 'block'); //选择群元素显示
  3289. _creategroup[0].innerHTML = "新建群"; //修改按钮提示字
  3290. _creategroup[0].nextElementSibling.innerHTML = "群列表"; //修改标题
  3291. }
  3292. }
  3293. /**
  3294. * 新建群区域初始化
  3295. *
  3296. **/
  3297. U.MD.DK.VW.saveSynergy.createGroupInit = function () {
  3298. var _newgroup = U.selectEl('#U_MD_O_SaveSynergy_NewGroup')[0];
  3299. var _left = $$('div', { style: { borderRight: "1px solid #ccc", position: "relative" } }, _newgroup);
  3300. var _right = $$('div', { style: { overflow: "hidden" } }, _newgroup);
  3301. var _count = $$('div', { style: { lineHeight: '30px' }, innerHTML: '已选择联系人:<span>1</span>' }, _right);
  3302. var _select = $$('div', { id: "U_MD_O_SaveSynergy_NewGroup_Select", style: { height: '265px', overflow: 'auto' } }, _right);
  3303. var _box = $$('div', { "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', style: { paddingLeft: '5px' } }, _select);
  3304. $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(US.userInfo.UserThumbnailImageHead) }, _box);
  3305. $$('span', { innerHTML: US.userInfo.UserNickName || US.userInfo.UserName }, _box);
  3306. }
  3307. /**
  3308. * 打印好友列表
  3309. *
  3310. **/
  3311. U.MD.DK.VW.saveSynergy.Friends = function () {
  3312. var i, _box, //定义变量
  3313. _friends = US.friend.friends; //好友列表
  3314. var _child = U.selectEl('#U_MD_O_SaveSynergy_NewGroup').Child(); //获取新建群区域的子级
  3315. var _friendel = _child[0]; //获取好友列表区域
  3316. var _countel = U.selectEl('span', U.selectEl(_child[1]).Child()[0])[0]; //获取选择计数元素
  3317. var _selectel = U.selectEl("#U_MD_O_SaveSynergy_NewGroup_Select"); //获取选中好友列表
  3318. _friendel.innerHTML = ""; //清空好友列表
  3319. _countel.innerHTML = "1"; //设置默认选择人数为1 默认选择自己
  3320. U.MD.F.J.selectUserInfo.NeedUser = []; //清空选中全局
  3321. var _oldfriend = _selectel.Child(); //获取遗留选中好友
  3322. //清除遗留选中好友
  3323. for (i = 1; i < _oldfriend.length; i++) {
  3324. U.selectEl(_oldfriend[i]).remove();
  3325. }
  3326. //如果存在好友
  3327. if (_friends.length > 0) {
  3328. //循环打印好友
  3329. for (i = 0; i < _friends.length; i++) {
  3330. //创建好友盒子
  3331. var _box = $$('div', {
  3332. "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', onclick: U.UF.C.closure(function (friendinfo) {
  3333. U.MD.DK.VW.saveSynergy.Friends.Select(friendinfo, _selectel[0], _countel);
  3334. }, [_friends[i]]), friendid: _friends[i].FriendsID
  3335. }, _friendel);
  3336. //创建头像
  3337. $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(_friends[i].UserThumbnailImageHead) }, _box);
  3338. //创建用户名
  3339. $$('span', { innerHTML: _friends[i].UserNickName || _friends[i].UserName }, _box);
  3340. }
  3341. }
  3342. //如果不存在好友
  3343. else {
  3344. //创建提示字
  3345. $$('p', {
  3346. style: { cssText: "font-weight: bold; font-size: 14px;padding-left:60px;padding-top:60px;" },
  3347. innerHTML: '您暂无添加好友,</br> 快去<span style="cursor:pointer;color:rgb(41, 103, 167);" onclick="U.MD.F.S.popSearchFriendsOrGroupForm(0);">添加你的好友</span>吧。 </br>'
  3348. }, _friendel);
  3349. //创建刷新按钮
  3350. $$('span', {
  3351. innerHTML: "已添加完好友点击刷新好友列表", onclick: function () {
  3352. U.UF.DL.loading(_friendel);
  3353. setTimeout(function () { U.MD.DK.VW.saveSynergy.Friends(); U.UF.DL.uploading(_friendel); }, 300);
  3354. }, style: { color: "red", cursor: "pointer", position: "absolute", bottom: "0px", fontSize: "12px" }
  3355. }, _friendel);
  3356. }
  3357. }
  3358. /**
  3359. * 选择好友操作
  3360. *
  3361. * @param friendinfo {object} 好友信息
  3362. * @param selectel {element} 选中好友列表区域
  3363. * @param countel {element} 计数元素
  3364. *
  3365. **/
  3366. U.MD.DK.VW.saveSynergy.Friends.Select = function (friendinfo, selectel, countel) {
  3367. var i, //定义变量
  3368. _isselect = U.Json.select(U.MD.F.J.selectUserInfo.NeedUser, { UserId: friendinfo.UserId })[0]; //判断是否已选中
  3369. if (!_isselect) { //如果未选中
  3370. countel.innerHTML = parseInt(countel.innerHTML) + 1; //计数+1
  3371. U.MD.F.J.selectUserInfo.NeedUser.push(friendinfo); //加入选中好友全局
  3372. //打印选择好友
  3373. var _box = $$('div', {
  3374. "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', style: { paddingLeft: '5px' }, onclick: function () {
  3375. U.selectEl(this).remove();
  3376. U.Json.del(U.MD.F.J.selectUserInfo.NeedUser, { "UserId": friendinfo.UserId });
  3377. countel.innerHTML = parseInt(countel.innerHTML) - 1;
  3378. }
  3379. }, selectel);
  3380. //打印头像
  3381. $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(friendinfo.UserThumbnailImageHead) }, _box);
  3382. //打印姓名
  3383. $$('span', { innerHTML: friendinfo.UserNickName || friendinfo.UserName }, _box);
  3384. }
  3385. }
  3386. /*
  3387. U.MD.DK.VW.choseFile
  3388. 参数一:选择文件
  3389. 参数二: 显示文件类型
  3390. */
  3391. U.MD.DK.VW.choseFile = function (cb, type) {
  3392. var _diskinfo = US.disk.Disks[US.userInfo.UserId]; //获取当前登录用户的网盘信息
  3393. var _formel = U.selectEl('#U_MD_DK_VW_ChosenSaveFile')[0]; //获取窗体元素
  3394. var _file; //定义变量
  3395. type = type ? type : "*"; //默认为全部
  3396. if (_formel) { //判断窗体是否存在
  3397. //存在则居中显示
  3398. U.UF.F.windowTopCenter(_formel);
  3399. //获取文件区域
  3400. _file = U.selectEl('#U_MD_DK_VW_ChosenSaveFile_File')[0];
  3401. _file.innerHTML = "";
  3402. }
  3403. else {
  3404. var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" }); //创建文件区域容器
  3405. var _newfolder = $$('button', { style: { position: "absolute", right: "0", top: "2px" }, innerHTML: "新建文件夹" }, _box); //创建新建文件夹按钮
  3406. $$("div", { style: { "font-size": "16px", padding: "12px 10px 2px" }, innerHTML: "文件名称" }, _box); //创建标题
  3407. $$("hr", {}, _box); //创建分割线
  3408. _file = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_DK_VW_ChosenSaveFile_File" }, _box); //创建文件区域
  3409. var _inputarea = $$('div', {}, _box); //创建填写文件名区域
  3410. $$('span', { 'innerHTML': '文件名:' }, _inputarea); //标题
  3411. var _input = $$('input', { "className": "U_MD_DK_VW_ChosenSaveFileName", placeholder: "请输入文件名...", style: { width: "89%", "text-indent": "5px", "line-height": "26px" } }, _inputarea); //文件名输入框
  3412. var _ensure = $$('button', { innerHTML: "确定" }, _box); //确定按钮
  3413. var _cancel = $$('button', { innerHTML: "取消" }, _box); //取消按钮
  3414. //创建窗体
  3415. _formel = new U.UF.UI.form(
  3416. "<span id='U_MD_DK_VW_ChosenSaveFile_Title'>选择文件</span>",
  3417. _box, {
  3418. "id": "U_MD_DK_VW_ChosenSaveFile",
  3419. "style": {
  3420. "width": "600px",
  3421. "height": "450px"
  3422. }
  3423. }).form;
  3424. //绑定新建文件夹事件
  3425. _newfolder.onclick = function () {
  3426. U.MD.DK.VW.chosenSaveFile.newFolder();
  3427. }
  3428. //绑定确定按钮事件
  3429. _ensure.onclick = function () {
  3430. cb($('.U_MD_DK_VW_ChosenSaveFileName')[0].data); //回调
  3431. U.UF.F.windowMinimize(_formel); //隐藏弹框
  3432. _input.value = ""; //清空显示
  3433. _input.data = null; //清空数据
  3434. }
  3435. //取消函数
  3436. _cancel.onclick = function () {
  3437. U.UF.F.windowMinimize(_formel);
  3438. }
  3439. }
  3440. //默认创建初始化目录
  3441. U.MD.DK.VW.chosenSaveFile.printFolder(_diskinfo.directoryOrFiles.slice(1, 5), _file, 0, ["U_MD_DK_LCD", "U_MD_DK_LCS", "U_MD_DK_LCD", "U_MD_DK_LCB", "U_MD_DK_LCF", "U_MD_DK_LCT", "U_MD_DK_LCP", "U_MD_DK_LCY"], _file, type);
  3442. }
  3443. //#endregion;
  3444. ///<jscompress sourcefile="LeftClick.js" />
  3445. /*
  3446. 存在问题
  3447. 1、非能打开文件处理
  3448. */
  3449. Namespace.register("U.MD.DK.LE"); //Disk左键事件命名空间
  3450. //#region 左键事件处理
  3451. //#region 当前网盘打开
  3452. //文件点击,文件夹点击,及url导航到达区域。
  3453. /*
  3454. 文件管理区域点击事件,暂时分为:音乐、图片、视频、文件。
  3455. 参数一:fileinfo为单击的文件对象
  3456. 参数四:userid为用户id。
  3457. */
  3458. U.MD.DK.LE.openFileDirectory = function (fileinfo, userid) {
  3459. var i,
  3460. _content,
  3461. _div,
  3462. _apptype, //打开应用的名字
  3463. _applicationame, //应用的名字
  3464. _types = US.disk.applicationTypes, //所有的文件类型
  3465. _navarray, //导航数组
  3466. _extension, //文件扩展名
  3467. _diskinfo = U.MD.DK.M.diskOperatingSwitch(userid); //根据用户id找到其所有硬盘数据。
  3468. U.UF.EV.stopBubble(); //阻止冒泡
  3469. //fileinfo.filetype == 1是文件 == 0 是文件夹
  3470. //如果是文件的情况下的处理
  3471. if (fileinfo.filetype) {
  3472. _extension = fileinfo["UserDirectoryExtendType"].toLocaleLowerCase(); //得到文件扩展名
  3473. //根据文件类型进入不同的应用。
  3474. _types = US.disk.applicationTypes;
  3475. _applicationame;
  3476. //判断后缀名归属于哪一个应用程序。得到应用程序的名称。
  3477. for (i in _types) {
  3478. if (_types[i].types.indexOf(_extension) > -1) { //判断文件类型是否归属该应用
  3479. _applicationame = i;
  3480. break;
  3481. }
  3482. }
  3483. //根据应用名称打开不同的应用。
  3484. switch (_applicationame) {
  3485. case "music": //播放制定的音乐,需要流程图
  3486. U.MD.DK.LE.music(fileinfo); //音乐控件
  3487. break;
  3488. case "image": //图片查看,需要流程图
  3489. U.MD.DK.LE.img(fileinfo); //图片控件
  3490. break;
  3491. case "video": //视频处理 需要流程图
  3492. U.MD.DK.LE.video(fileinfo); //视频控件
  3493. break;
  3494. case "text": //文本文件需要流程图
  3495. U.MD.D.Txt.textCreate(fileinfo);
  3496. break;
  3497. case "usoffice": //如果是云端系统自有格式文件。 需要流程图
  3498. //excel处理
  3499. case "ue": //word处理
  3500. U.MD.D.I.openApplication("excel", fileinfo); //弹出应用处理
  3501. break;
  3502. case "uw": case "un": //word处理
  3503. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  3504. break;
  3505. case "word":
  3506. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  3507. break;
  3508. case "txt": //txt处理
  3509. U.MD.D.I.openApplication("txt", fileinfo); //弹出应用处理
  3510. break;
  3511. //windows上传的不可识别的文件打开,直接跳转到下载页面。
  3512. default:
  3513. U.MD.DK.RE.downloadFile(fileinfo.UserDirectoryID, false);
  3514. break;
  3515. }
  3516. }
  3517. //打印目录信息
  3518. else {
  3519. //添加前进后退事件
  3520. U.UF.N.addEvent(function () {
  3521. U.MD.DK.LE.openDirectory(fileinfo, userid); //打开目录
  3522. }, "disk" + userid);
  3523. }
  3524. //设置文件及文件夹的修改时间,打开文件或者文件夹时,把打开文件的时间记录到数据库。以实现最近访问文件,最近访问文件夹的功能。fileinfo.filetype == 0 表示文件夹 fileinfo.filetype == 1表示文件
  3525. if (fileinfo.UserDirectoryDeep > 1) {
  3526. //filetype = 0的情况是文件夹的处理
  3527. if (fileinfo.filetype == 0) {
  3528. U.A.Request(US.DISK, ["UpdateDirectoryInfo", fileinfo.UserDirectoryID, ""], function () { });
  3529. }
  3530. //文件的处理
  3531. else {
  3532. U.A.Request(US.DISK, ["UpdateFileInfo", fileinfo.UserDirectoryID, ""], function () { });
  3533. }
  3534. //设置文件更新时间
  3535. fileinfo["UserDirectoryModifyTime"] = U.UF.D.toTimeStamp(); //修改前台的时间
  3536. }
  3537. }
  3538. /**
  3539. * 打开目录
  3540. * @param {array} 需要输出的文件或者文件夹信息
  3541. * @param {element} 输出到那个区域
  3542. **/
  3543. U.MD.DK.LE.openDirectory = function (fileinfo, userid) {
  3544. var _groupinfo,
  3545. _groupdirectory,
  3546. _leftel, //左边元素
  3547. _diskinfo = U.MD.DK.M.diskOperatingSwitch(userid), //获取网盘信息
  3548. _content = U.selectEl("#U_MD_DK_RZ", _diskinfo.formel)[0]; //获取打印内容的元素
  3549. _diskinfo.selectElement = []; //切换文件夹修改选择文件
  3550. _content.innerText = ""; //清空内容
  3551. _diskinfo.directoryid = fileinfo["UserDirectoryID"]; //设置当前打开目录的id.看全集变量US.disk.Disks
  3552. //设置url重写
  3553. U.MD.N.urlWrite("disk/" + _diskinfo.userInfo.UserId + "/" + _diskinfo.directoryid, _diskinfo.userInfo.UserNickName + "的网盘");
  3554. //判断这个目录下面有没有孩子节点,如果有就可以直接打印,如果没有那么需要去数据库取数据
  3555. if (fileinfo.Child) { //已加载文件
  3556. U.MD.DK.LE.loadDirectory(fileinfo, _diskinfo, userid);
  3557. }
  3558. //去数据库取文件夹及文件信息,异步加载
  3559. else {
  3560. //如果是最新文档的数据处理
  3561. if (_diskinfo.directoryOrFiles[0].UserDirectoryID == fileinfo.UserDirectoryID) {
  3562. U.MD.DK.LE.getNewDocument(userid, fileinfo, _content);
  3563. }
  3564. //如果是点击他人邀请或者是我的协同的处理
  3565. else if (_diskinfo.directoryOrFiles[1].UserDirectoryID == fileinfo.UserDirectoryID || _diskinfo.directoryOrFiles[2].UserDirectoryID == fileinfo.UserDirectoryID) {
  3566. if (US.friend.group) {
  3567. _groupinfo = US.friend.group.concat();
  3568. _diskinfo.groups = _groupdirectory = U.MD.DK.getGroupDirectory(_groupinfo, _diskinfo.directoryOrFiles, userid); //初始化
  3569. _diskinfo.directoryOrFiles = _diskinfo.directoryOrFiles.concat(_groupdirectory); //合并数组
  3570. }
  3571. U.MD.DK.LE.loadDirectory(fileinfo, _diskinfo, userid); //打印目录信息
  3572. }
  3573. //获取文件夹下面的文件或者文件夹
  3574. else {
  3575. U.MD.DK.LE.getChildsByDirectoryId(userid, fileinfo, _content);
  3576. }
  3577. }
  3578. }
  3579. /**
  3580. * 初始化目录
  3581. * @param {object} 文档信息
  3582. * @param {object} 网盘信息
  3583. * @param {string} 用户id
  3584. **/
  3585. U.MD.DK.LE.loadDirectory = function (fileinfo, diskinfo, userid) {
  3586. //展开下级文件夹
  3587. var _childs = fileinfo.Child || [],
  3588. _leftel = U.selectEl("#L" + fileinfo["UserDirectoryID"], diskinfo.formel)[0],
  3589. _content = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0];
  3590. //左边树目录处理
  3591. if (_leftel) {
  3592. U.MD.DK.LL.printLeftTreeDirectory(U.Json.select(_childs, { "filetype": 0 }), _leftel, userid); //如果左边数目显示了
  3593. }
  3594. U.selectEl("#U_MD_DK_RKR", diskinfo.formel)[0].innerHTML = "当前文件的数量:" + _childs.length;
  3595. diskinfo.currentDirectoryFile = _childs; //把当前显示打印的资料显示到网盘中。
  3596. //头部导航打印
  3597. var _navarray = U.MD.DK.C.getAncestors(fileinfo, diskinfo); //获取需要输出的导航信息,这里直接获取这个目录一条线上的祖先元素
  3598. U.MD.DK.LL.printNavigation(_navarray, U.selectEl("#U_MD_DK_RYB", diskinfo.formel)[0], userid); //打印出导航数据
  3599. //打印数据
  3600. U.MD.DK.VW.printContent(_childs, _content);
  3601. //给当前目录设置权限
  3602. var _permissions = U.MD.DK.C.getDirectoryPermissions(fileinfo.UserDirectoryID, diskinfo);
  3603. var _permissioninfo = U.MD.DK.C.readWritePermission(fileinfo.UserDirectoryID, diskinfo)
  3604. U.MD.DK.LE.myCollJudgment(_permissions, _permissioninfo[0][0]);
  3605. }
  3606. /**
  3607. * 权限按钮显示方法
  3608. * @param {object} 权限数据
  3609. * @param {object} 文件信息
  3610. **/
  3611. U.MD.DK.LE.myCollJudgment = function (permissions, permissioninfo) {
  3612. var _div = U.selectEl(".U_MD_DK_RT")[1].children; //获取上边所有按钮
  3613. if (permissions.isupadte == false && permissions.isdownload == false && permissions.isnew == false) {//判断是否为我的协同或他人邀请,如果是
  3614. _div[0].style.display = "none"; //修改上传按钮的显示,为隐藏
  3615. _div[1].style.display = "none"; //修改新建文件夹按钮的显示,为隐藏
  3616. _div[2].style.display = "none"; //修改新建文件按钮的显示,为隐藏
  3617. _div[3].style.display = "none"; //修改新建文档按钮的显示,为隐藏
  3618. _div[4].style.display = "none"; //修改导航文档按钮的显示,为隐藏
  3619. _div[5].style.display = "none"; //修改新建工作表按钮的显示,为隐藏
  3620. _div[6].style.display = "none"; //修改建立网站按钮的显示,为隐藏
  3621. _div[7].style.display = "none"; //隐藏新建协同按钮
  3622. if (permissioninfo.UserDirectoryName == "我的协同") {//进行判断,如为我的协同文件夹
  3623. _div[7].style.display = "block"; //显示新建协同按钮
  3624. _div[7].onclick = function () {//赋予点击事件
  3625. U.MD.F.J.groupInfoForm(); //调用方法,添加协同文件
  3626. }
  3627. }
  3628. } else {//如果不是
  3629. _div[0].style.display = "block"; //修改上传按钮的显示,为显示
  3630. _div[1].style.display = "block"; //修改新建文件夹按钮的显示,为显示
  3631. _div[2].style.display = "block"; //修改新建文件按钮的显示,为显示
  3632. _div[3].style.display = "block"; //修改新建文档按钮的显示,为显示
  3633. _div[4].style.display = "block"; //修改导航文档按钮的显示,为显示
  3634. _div[5].style.display = "block"; //修改新建工作表按钮的显示,为显示
  3635. _div[6].style.display = "block"; //修改建立网站按钮的显示,为显示
  3636. _div[7].style.display = "none"; //隐藏新建协同按钮
  3637. }
  3638. }
  3639. //加载当前网盘内容
  3640. //
  3641. //* @param {string} 用户id
  3642. //* @param {object} 目录信息
  3643. //* @param {element} loading的元素。
  3644. //* @param {callback} 回调函数
  3645. //* @returns {} 无
  3646. //
  3647. U.MD.DK.LE.getChildsByDirectoryId = function (userid, fileinfo, loading, cb) {
  3648. //如果没有孩子节点,则去数据库取数据。
  3649. U.A.Request(US.DISK, ["GetChildsByDirectoryId", userid, fileinfo.UserDirectoryID, fileinfo.GroupID], U.MD.DK.LE.asynGetChildsByDirectoryId, [loading, userid, fileinfo, cb]);
  3650. }
  3651. //加载当前网盘内容
  3652. //
  3653. //* @param {string} 用户id
  3654. //* @param {object} 目录信息
  3655. //* @param {element} loading的元素。
  3656. //* @param {callback} 回调函数
  3657. //* @returns {} 无
  3658. //
  3659. U.MD.DK.LE.getNewDocument = function (userid, fileinfo, loading, cb) {
  3660. //用户必须登录才能查看自己网盘的内容
  3661. if (US.userInfo.UserId) {
  3662. //如果没有孩子节点,则去数据库取数据。
  3663. U.A.Request(US.CD, [US.DB, "UseStudio_Office", "GetCollaborativeDocument", US.userInfo.UserId, "00000000-0000-0000-0000-000000000000", "", 0, 0, 100], function (r) {
  3664. var i;
  3665. for (i = 0; i < r.value.length; i++) {
  3666. r.value[i] = new U.MD.DK.M.entity(r.value[i].UserFilesID, r.value[i].UserFilesSize, r.value[i].UserDirectoryID, r.value[i].UserFilesName, r.value[i].UserFilesName, r.value[i].UserFilesExtendName, r.value[i].UserFilesServerName, r.value[i].UserFilesAddTime, "", "9999", r.value[i].UserFilesModifyTime, r.value[i].UserDirectoryEncrypt, 1, r.value[i].UserFilesDescript, r.value[i].UserDirectoryEncrypt, "", r.value[i].UserID, r.value[i].UserName, r.value[i].UserName, r.value[i].UserThumbnailImageHead);
  3667. }
  3668. U.MD.DK.LE.asynGetChildsByDirectoryId(r);
  3669. }, [loading, userid, fileinfo, cb]);
  3670. }
  3671. //直接打印空数据
  3672. else {
  3673. U.MD.DK.LE.asynGetChildsByDirectoryId({ "context": [loading, userid, fileinfo, cb], "value": [] });
  3674. }
  3675. }
  3676. /**
  3677. * 获取网盘数据异步,这里处理了后台数据返回后吧数据写到了全局变量US.disk.Disks[userid][0]和US.disk.Disks[userid][4]中
  3678. *
  3679. * @param {object} ajax异步数据
  3680. */
  3681. U.MD.DK.LE.asynGetChildsByDirectoryId = function (r) {
  3682. var _context = r.context, //获取异步的传参
  3683. _userid = _context[1], //用户的id
  3684. _fileinfo = _context[2], //文件的信息
  3685. _cb = _context[3], //回调函数
  3686. _dirid = _fileinfo.UserDirectoryID, //当前获取数据的目录id
  3687. _diskinfo = U.MD.DK.M.diskOperatingSwitch(_userid); //获取用户的disk信息
  3688. r = r.value;
  3689. //把获取的数据设置到网盘全局变量中,为啥有两种数据结构?
  3690. U.Json.del(_diskinfo.directoryOrFiles, { "UserDirectoryParentID": _dirid }); //移除原本有的目录文件
  3691. _fileinfo.Child = r; //设置目录的子目录或者文件
  3692. U.Json.add(r, { "Parent": _fileinfo });
  3693. //添加文件
  3694. U.MD.DK.M.entity.add(r, _diskinfo); //把文件写入到全局变量中 在_diskinfo[0]和_diskinfo[4]写入获取文件的信息
  3695. //执行回调处理
  3696. if (U.UF.C.isFunction(_cb)) {
  3697. _cb();
  3698. }
  3699. //否则执行获取数据后打开文件的处理
  3700. else if (_fileinfo.UserDirectoryID == _diskinfo.directoryid) {
  3701. //如果用户还在等待当前目录信息出现,那么就展示,如果用户在loading的时候已经切换到其他地方去查看,那么则不展示数据更新
  3702. U.MD.DK.LE.openDirectory(_fileinfo, _userid); //打开目录操作
  3703. }
  3704. }
  3705. /**
  3706. * 根据应用名称打开音乐播放器
  3707. *
  3708. *参数一:fileinfo为单击的文件对象
  3709. */
  3710. U.MD.DK.LE.music = function (fileinfo) {
  3711. var _mp3arr, i,
  3712. _num = 0, //索引位置
  3713. _diskinfo = US.disk.UserDisk,
  3714. _arr = []; //空数组
  3715. //判断是否单独打开还是打开文件夹下所有的音乐
  3716. if (fileinfo.UserDirectoryParentID) {
  3717. _mp3arr = U.Json.select(_diskinfo.currentDirectoryFile, { "UserDirectoryExtendType": "mp3", "UserDirectoryParentID": fileinfo.UserDirectoryParentID });
  3718. //当前打开的文件夹的所有音乐文件信息
  3719. for (i = 0; i < _mp3arr.length; i++) {
  3720. _arr[i] = {
  3721. "title": _mp3arr[i].UserallDirectoryName, //音乐名
  3722. "author": "", //歌手名
  3723. "src": "http://fs.1473.cn/" + _mp3arr[i].UserFilesServerName, //音乐播放路径
  3724. "cover": _mp3arr[i].UserThumbnailImageHead, //音乐封面路径
  3725. "lrc": ""//歌词
  3726. }
  3727. if (_mp3arr[i].UserDirectoryID == fileinfo.UserDirectoryID) {//判断在哪个音乐文件打开的
  3728. _num = i; //索引位置
  3729. }
  3730. }
  3731. }
  3732. else {
  3733. _arr[0] = {
  3734. "title": fileinfo.UserallDirectoryName, //音乐名
  3735. "author": "", //歌手名
  3736. "src": "http://fs.1473.cn/" + fileinfo.UserFilesServerName, //音乐播放路径
  3737. "cover": fileinfo.UserThumbnailImageHead, //音乐封面路径
  3738. "lrc": ""//歌词
  3739. }
  3740. }
  3741. U.MD.UI.music(_arr, _num, true); //音乐控件
  3742. U.MD.D.T.taskbar({ "id": "music", "backgroundPostion": "-144px -296px", "name": "音乐播放器", "forms": U.MD.UI.music.player, "click": function () { U.UF.F.topWindow(U.MD.UI.music.player.form); } });
  3743. // var _userid = US.disk.UserDisk.userInfo.UserId; //当前打开网盘ID
  3744. // var _diskinfo = U.MD.DK.M.diskOperatingSwitch(_userid); //磁盘信息
  3745. // var _music = U.Json.select(_diskinfo.currentDirectoryFile, { "UserDirectoryExtendType": "mp3" }); //获取当前打开的文件夹的所有音乐文件信息
  3746. // var _arr = []; //空数组
  3747. // var _num1 = 0; //索引位置
  3748. // for (var _num = 0; _num < _music.length; _num++) {//当前打开的文件夹的所有音乐文件信息
  3749. // _arr[_num] = { title: _music[_num].UserallDirectoryName, //音乐名
  3750. // author: "", //歌手名
  3751. // src: "http://fs.1473.cn/" + _music[_num].UserFilesServerName, //音乐播放路径
  3752. // cover: _music[_num].UserThumbnailImageHead, //音乐封面路径
  3753. // lrc: ""//歌词
  3754. // }
  3755. // if (_music[_num].UserDirectoryID == fileinfo.UserDirectoryID) {//判断在哪个音乐文件打开的
  3756. // _num1 = _num; //索引位置
  3757. // }
  3758. // }
  3759. // U.MD.UI.music(_arr, _num1, true); //音乐控件
  3760. // if (!$('#U_MD_D_T_taskbar_music')[0]) {
  3761. // U.MD.UI.music.player.id = "music";
  3762. // U.MD.D.T.taskbar({ "id": "music", "backgroundPostion": "-144px -296px", "name": "音乐播放器", "forms": U.MD.UI.music.player, "click": function () { U.UF.F.topWindow(U.MD.UI.music.player.form); } });
  3763. // }
  3764. // U.MD.UI.music(_arr, _num1, true); //音乐控件
  3765. // U.MD.D.T.taskbar({ "id": "music", "backgroundPostion": "-144px -296px", "name": "音乐播放器", "forms": U.MD.UI.music.player, "click": function () { U.UF.F.topWindow(U.MD.UI.music.player.form); } });
  3766. }
  3767. /**
  3768. * 根据应用名称打开图片
  3769. *
  3770. *参数一:fileinfo为单击的文件对象
  3771. */
  3772. U.MD.DK.LE.img = function (fileinfo) {
  3773. var _diskinfo = US.disk.UserDisk;
  3774. U.UF.DL.asynLoadCss({ "href": "/css/Controls/Basic/Picture.css", type: "text/css", rel: "stylesheet" }); //动态添加css文件
  3775. U.UF.DL.asynLoadJs({ type: "text/javascript", src: "/js/Controls/Basic/Picture.js" }, function () {
  3776. var i,
  3777. j = 0,
  3778. _arr = [], //空数组
  3779. _num = 0;
  3780. //判断打开的图片是在自己本地下的
  3781. if (_diskinfo && fileinfo.UserDirectoryParentID && _diskinfo.userInfo.UserId == fileinfo.UserId) {
  3782. for (i = 0; i < _diskinfo.currentDirectoryFile.length; i++) {//当前打开文件夹的文件
  3783. if (fileinfo.UserDirectoryParentID == _diskinfo.currentDirectoryFile[i].UserDirectoryParentID && U.UF.UP.isImg(_diskinfo.currentDirectoryFile[i].UserDirectoryExtendType)) {
  3784. _arr[j] = "http://fs.1473.cn/" + _diskinfo.currentDirectoryFile[i].UserFilesServerName; //图片地址
  3785. if (_diskinfo.currentDirectoryFile[i].UserDirectoryID == fileinfo.UserDirectoryID) {//判断在哪个音乐文件打开的
  3786. _num = j; //索引位置
  3787. }
  3788. j++;
  3789. }
  3790. }
  3791. }
  3792. if (_arr.length == 0) {
  3793. _arr.push("http://fs.1473.cn/" + fileinfo.UserFilesServerName);
  3794. }
  3795. U.MD.UI.picture(_arr, _num)//图片控件
  3796. U.UF.F.topWindow($('#U_MD_UI_PictureForm')[0], true); //窗体置顶
  3797. });
  3798. }
  3799. /**
  3800. * 根据应用名称打开视频
  3801. *
  3802. *参数一:fileinfo为单击的文件对象
  3803. */
  3804. U.MD.DK.LE.video = function (fileinfo) {
  3805. var _form = new U.UF.UI.form(fileinfo.UserallDirectoryName, "", { "style": { "width": "780px", "height": "330px", "margin": "0" } }, { istop: true, isstretching: false, isenlarge: false, isnarrow: false }); //窗体
  3806. U.UF.DL.asynLoadCss({ rel: "stylesheet", type: "text/css", href: "/css/Controls/Basic/Video.css" }); //动态添加css文件
  3807. U.UF.DL.asynLoadJs({ src: "/js/Controls/Basic/Video.js", "charset": "utf-8", "type": "text/javascript" }, function () {//动态添加js文件
  3808. var _video = U.MD.UI.video(("http://fs.1473.cn/" + fileinfo.UserFilesServerName), 780, 300, false, _form.middle); //视频控件
  3809. //窗体关闭,声音停止
  3810. _form.closecallback = function () {
  3811. _video.video.pause();
  3812. }
  3813. // U.selectEl(".U_MD_UI_video_VideoDiv")[$(".U_MD_UI_video_VideoDiv").length - 1].style.position = "absolute"; //视频的位置
  3814. // U.selectEl(".U_MD_UI_video_VideoDiv")[$(".U_MD_UI_video_VideoDiv").length - 1].style.top = "0px"; //视频的定位高低
  3815. // U.selectEl(".U_MD_UI_video_VideoDiv")[$(".U_MD_UI_video_VideoDiv").length - 1].style.left = "0px"; //视频的定位左右
  3816. });
  3817. }
  3818. //#endregion
  3819. ;
  3820. ///<jscompress sourcefile="LeftTree.js" />
  3821. Namespace.register("U.MD.DK.LL"); //Disk导航命名空间
  3822. //#region 导航
  3823. /**
  3824. * 导航打印(树导航)
  3825. * @param {object} 左边一级层级树目录的相关信息
  3826. * @param {element} 输出到那个区域
  3827. * @param {array} 树目录的class样式数组
  3828. * @param {element} 树目录区域
  3829. * @param {str} 当前用户ID
  3830. **/
  3831. U.MD.DK.LL.printLeftTreeDirectory = function (directorys, el, userid, classes) {
  3832. var _dtorydiv, //目录元素
  3833. _namediv, //名字元素
  3834. _frag = $$("div"), //临时块元素
  3835. _padding = 3 //左对齐
  3836. ;
  3837. //判断展开的基本是否大于二级,大于二级则设置padding
  3838. if ($(el).Child()[0]) {
  3839. _padding = parseInt($(el).Child()[0].style.paddingLeft || 0) + 5;
  3840. //如果不展开的处理
  3841. if ($($(el).Child()[0]).Child()[0].className.indexOf("U_MD_DK_LTXOSIO") == -1) {
  3842. return;
  3843. }
  3844. }
  3845. //如果已经展开的处理
  3846. if ($(el).Child()[1]) {
  3847. el.removeChild($(el).Child()[1]);
  3848. }
  3849. //打印所有需要打印的目录信息
  3850. for (i = 0; i < directorys.length; i++) {
  3851. if (directorys[i].filetype == 0) {
  3852. //得到打印文件夹的图标样式
  3853. if ((classes || "").length) {
  3854. _Img = classes[i] || classes;
  3855. }
  3856. else {
  3857. if ((directorys[i]["UserDirectoryEncrypt"] && directorys[i]["UserDirectoryEncrypt"] != userid)) {
  3858. _Img = "U_MD_DK_LCJ";
  3859. }
  3860. else {
  3861. _Img = "U_MD_DK_LCW";
  3862. }
  3863. }
  3864. //创建左边树目录
  3865. _dtorydiv = $$("div", { "id": directorys[i]["UserDirectoryID"] ? "L" + directorys[i]["UserDirectoryID"] : "", "className": "U_MD_DK_LTXOA" }, _frag);
  3866. _namediv = $$("div", {
  3867. "className": "U_MD_DK_LTXOS",
  3868. "style": {
  3869. "paddingLeft": _padding + "px"
  3870. },
  3871. //导航点击事件的处理
  3872. "onclick": U.UF.C.closure(function (directoryinfo, el) {
  3873. U.UF.EV.stopBubble();
  3874. U.MD.DK.LL.leftTreeClick(directoryinfo, el, userid)
  3875. }, [directorys[i], _dtorydiv]),
  3876. //右键处理
  3877. "oncontextmenu": U.UF.C.closure(function (directoryinfo) {
  3878. U.UF.EV.stopBubble();
  3879. U.UF.EV.stopDefault();
  3880. U.MD.DK.RM.rightMenu(this, directoryinfo, US.disk.UserDisk);
  3881. }, [directorys[i]])
  3882. }, _dtorydiv);
  3883. $$("div", {
  3884. "className": "U_MD_DK_LTXOSI U_MD_DK_Img"
  3885. }, _namediv);
  3886. $$("div", { "className": "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img " + _Img }, _namediv);
  3887. //文件名
  3888. $$("div", {
  3889. "className": "U_MD_DK_LTXOSN U_MD_D_Text_Abbreviation",
  3890. "innerHTML": directorys[i].UserallDirectoryName,
  3891. "ondblclick": U.UF.C.closure(function (directoryinfo) {
  3892. U.UF.EV.stopBubble();
  3893. U.MD.DK.RE.rename(this, directoryinfo);
  3894. }, [directorys[i]])
  3895. }, _namediv);
  3896. }
  3897. }
  3898. el.appendChild(_frag);
  3899. }
  3900. /**
  3901. * 导航点击处理
  3902. * @param {object} 左边一级层级树目录的相关信息
  3903. * @param {element} 输出到那个区域
  3904. * @param {string} 当前用户ID
  3905. **/
  3906. U.MD.DK.LL.leftTreeClick = function (fileinfo, el, userid) {
  3907. var _childel = U.selectEl(el).Child()[0];
  3908. //权限判断
  3909. //打开文件夹的图标高亮处理
  3910. if ($(_childel).Child()[0].className.indexOf("U_MD_DK_LTXOSIO") > -1) {
  3911. U.selectEl(_childel).Child()[0].className = "U_MD_DK_LTXOSI U_MD_DK_Img"; //图标展开的形式
  3912. //打开文件夹处理
  3913. var _contentel = U.selectEl(_childel).next();
  3914. // _childel.className = "U_MD_DK_LTXOS"//重新设置class
  3915. if (_contentel[0]) {
  3916. el.removeChild(_contentel[0]); //清除元素
  3917. }
  3918. }
  3919. else {
  3920. // U.MD.DK.LL.leftTreeHighlight(el); //左边树点击处理
  3921. U.selectEl(_childel).Child()[0].className = "U_MD_DK_LTXOSI U_MD_DK_Img U_MD_DK_LTXOSIO"; //图标展开的形式
  3922. }
  3923. U.selectEl(".U_MD_DK_LTXOSO").removeClass('U_MD_DK_LTXOSO');
  3924. U.selectEl(_childel).addClass('U_MD_DK_LTXOSO');
  3925. //打开文件夹处理
  3926. U.MD.DK.LE.openFileDirectory(fileinfo, userid);
  3927. }
  3928. /**
  3929. * 导航点击处理
  3930. * @param {object} 左边一级层级树目录的相关信息
  3931. * @param {element} 输出到那个区域
  3932. * @param {string} 当前用户ID
  3933. **/
  3934. U.MD.DK.LL.leftTreeHighlight = function (el) {
  3935. var i,
  3936. _childel,
  3937. _parentel = el
  3938. ;
  3939. //递归处理上级高亮处理
  3940. do {
  3941. _parentel = el.parentNode; //获取高亮元素的上级父亲
  3942. _childel = U.selectEl(_parentel).Child(); //获取该级的所有子节点
  3943. //如果在同一个文件夹下只能高亮一个文件目录,这样看起来才能显示当前点击的文件夹
  3944. for (i = 0; i < _childel.length; i++) {
  3945. U.selectEl(_childel[i]).Child()[0].className = el == _childel[i] ? "U_MD_DK_LTXOS U_MD_DK_LTXOSO" : "U_MD_DK_LTXOS";
  3946. }
  3947. } while ((el = _parentel.parentNode) && el.id != "U_MD_DK_LTXO")
  3948. }
  3949. /**
  3950. * 生成导航(面包屑导航)
  3951. * @param {array} 所有要追加的导航元素
  3952. * @param {element} 导航的元素
  3953. * @param {string} 用户的id
  3954. */
  3955. U.MD.DK.LL.printNavigation = function (navarray, el, userid) {
  3956. var i, //用于循环
  3957. _frag = $$("frag"), //临时的panel
  3958. _click //导航点击事件处理
  3959. ;
  3960. el.innerText = ""; //清空导航区域
  3961. //循环打印导航
  3962. for (i = navarray.length - 1; i > -1; i--) {
  3963. //创建一个导航, 如果导航是目录的导航,则点击的时候可以跳到指定的导航中
  3964. $$("div", {
  3965. "className": "U_MD_DK_RYBO", "innerHTML": navarray[i]["UserallDirectoryName"],
  3966. "onclick": U.UF.C.closure(function (nav) {
  3967. U.MD.DK.LE.openFileDirectory(nav, userid);
  3968. }, [navarray[i]])
  3969. }, _frag);
  3970. }
  3971. el.appendChild(_frag); //添加导航
  3972. //每一次导航追加的时候需要如果超过了大小则需要隐藏前面的导航
  3973. var _navchild = U.selectEl(el).Child(); //导航元素
  3974. while (el.scrollHeight > 30) {
  3975. _navchild[i].style.display = "none";
  3976. }
  3977. }
  3978. //#endregion
  3979. ;
  3980. ///<jscompress sourcefile="RightClick.js" />
  3981. Namespace.register("U.MD.DK.RE"); //Disk右键功能命名空间
  3982. //#region 文件属性
  3983. /**
  3984. * 用户属性框的样式
  3985. * @param {object} 目录目录或者文件信息
  3986. * @param {string} 用户id
  3987. */
  3988. U.MD.DK.RE.attribute = function (fileordir, userid) {
  3989. var _diskinfo = U.MD.DK.M.diskOperatingSwitch(userid),
  3990. _attributeel = U.MD.DK.RE.attributeStyle(fileordir, true, _diskinfo); //用户属性框的样式
  3991. U.UF.UI.alertClick(_attributeel);
  3992. }
  3993. /**
  3994. * 用户属性框的样式
  3995. * @param {object} 目录目录或者文件信息
  3996. * @param {bool} 是否需要设置权限
  3997. */
  3998. U.MD.DK.RE.attributeStyle = function (fileordir, issetpermissions, diskinfo) {
  3999. var _selected = 2;
  4000. var _icon = U.MD.DK.C.getIcon(fileordir.UserDirectoryExtendType.toLowerCase())
  4001. var _box = $$("div", { className: "U_MD_DK_fileInfo" });
  4002. var _head = $$("div", { className: "U_MD_DK_fileInfo_head" }, _box);
  4003. $$("div", { className: "U_MD_DK_fileInfo_line" }, _box);
  4004. var _info = $$("div", { className: "U_MD_DK_fileInfo_info" }, _box);
  4005. //图片样式设置
  4006. if (U.UF.UP.isImg(fileordir.UserDirectoryExtendType)) {
  4007. var _img = $$("div", { className: "U_MD_DK_fileInfo_img" }, _head);
  4008. $$("img", { "onerror": U.MD.C.imgError, "src": U.MD.C.getHeadImage(fileordir.UserDirectoryUrl) }, _img);
  4009. }
  4010. else {
  4011. $$("div", { className: "U_MD_DK_fileInfo_icon U_MD_DK_Img " + _icon.classname[1] }, _head);
  4012. }
  4013. $$("div", { style: { "cssText": "overflow:hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 42px;padding-left:10px;" }, innerHTML: fileordir.UserallDirectoryName, "title": fileordir.UserallDirectoryName }, _head);
  4014. //文件处理
  4015. if (fileordir.filetype) {
  4016. $$("div", { "innerHTML": "<span>类型:</span>文件" }, _info);
  4017. $$("div", {
  4018. "spellcheck": "false", "onselectstart": U.UF.EV.stopBubble,
  4019. "innerHTML": "<span>路径:</span>" + "http://fs.1473.cn/" + fileordir["UserDirectoryID"] + ""
  4020. }, _info);
  4021. }
  4022. else if (issetpermissions) {
  4023. $$("div", { "innerHTML": "<span>类型:</span>" + "文件夹" }, _info);
  4024. var _permission = $$("div", { "className": "", "innerHTML": "<span>权限选择:</span>" }, _info);
  4025. var _select = $$("select", { "onchange": function () { U.MD.DK.RE.setpermissions(this, fileordir, diskinfo); } }, _permission);
  4026. $$('option', { value: "1", innerHTML: "只允许上传" }, _select);
  4027. $$('option', { value: "2", innerHTML: "只允许下载" }, _select);
  4028. $$('option', { value: "", innerHTML: "无限制" }, _select);
  4029. if (fileordir.UserDirectoryEncrypt == "1") {
  4030. _selected = 0;
  4031. }
  4032. else if (fileordir.UserDirectoryEncrypt == "2") {
  4033. _selected = 1;
  4034. }
  4035. U.selectEl('option', _select)[_selected].selected = true; //选中
  4036. }
  4037. $$("div", { "innerHTML": "<span>大小:</span>" + U.UF.UP.minUnitToMaxUnit(fileordir.UserDirectorySize) }, _info);
  4038. $$("div", { "innerHTML": "<span>创建时间:</span>" + U.UF.D.getYearMonthDay(fileordir.UserDirectoryAddTime) }, _info);
  4039. return _box;
  4040. }
  4041. /**
  4042. * 共享文件夹设置权限
  4043. * @param {element} 目录目录或者文件信息
  4044. * @param {object} 是否需要设置权限
  4045. */
  4046. U.MD.DK.RE.setpermissions = function (selectel, dirinfo, diskinfo) {
  4047. var _value = selectel.options[selectel.selectedIndex].value; //获取设置权限的值
  4048. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "SetFtpPriviledge", dirinfo.UserDirectoryID, _value], U.MD.DK.RE.asynSetPermissions, ["", dirinfo, _value, diskinfo]);
  4049. U.alert("权限设置中...");
  4050. }
  4051. /**
  4052. * 共享文件夹设置权限
  4053. * @param {element} 目录目录或者文件信息
  4054. * @param {object} 是否需要设置权限
  4055. */
  4056. U.MD.DK.RE.asynSetPermissions = function (r) {
  4057. var _leftel,
  4058. _rightel,
  4059. _imgicon,
  4060. _context = r.context,
  4061. _dirinfo = _context[1], //文件夹信息
  4062. _value = _context[2],
  4063. _diskinfo = _context[3]; //加密的值
  4064. r = r.value;
  4065. //判断设置操作
  4066. if (r) {
  4067. _dirinfo.UserDirectoryEncrypt = _value; //设置加密的值
  4068. _leftel = U.selectEl("#L" + _dirinfo.UserDirectoryID, _diskinfo.formel)[0]; //左边的导航,文件夹同时展开的时候会存在
  4069. _rightel = U.selectEl("#R" + _dirinfo.UserDirectoryID, _diskinfo.formel)[0]; //右边文件或者文件夹的处理
  4070. //左边的目录处理
  4071. if (_leftel) {
  4072. //加密的处理
  4073. if (_value != "") {
  4074. _imgicon = "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img U_MD_DK_LCJ";
  4075. }
  4076. //未加密的处理
  4077. else {
  4078. _imgicon = "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img U_MD_DK_LCW";
  4079. }
  4080. U.selectEl("div", _leftel)[2].className = _imgicon;
  4081. }
  4082. //右边的目录处理
  4083. if (_rightel) {
  4084. //加密的处理
  4085. if (_value != "") {
  4086. _imgicon = "U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOM";
  4087. }
  4088. //未加密的处理
  4089. else {
  4090. _imgicon = "U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOW";
  4091. }
  4092. U.selectEl("div", _rightel)[1].className = _imgicon;
  4093. }
  4094. }
  4095. //设置权限或者加密解密
  4096. else {
  4097. U.alert("设置失败");
  4098. }
  4099. }
  4100. //#endregion
  4101. //#region 新建文件夹
  4102. /**
  4103. * 新建文件夹处理的新建提示框
  4104. * @param {array} 需要删除文件的数组
  4105. * @param {string} 用户id
  4106. **/
  4107. U.MD.DK.RE.addFileOrFolder = function (fileordirinfo, diskinfo, dirinfo) {
  4108. var _nowdiskinfo = US.disk.UserDisk, //当前使用用户的网盘
  4109. _leftel = U.selectEl("#L" + dirinfo["UserDirectoryID"], diskinfo.formel)[0],
  4110. _el = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0];
  4111. //在粘贴网盘的数组目录中添加值
  4112. U.MD.DK.M.entity.add(fileordirinfo, diskinfo); //添加到用户disk全局变量中
  4113. U.MD.DK.M.entity.addChild(fileordirinfo, dirinfo); //添加到子节点中
  4114. //操作的文件夹是否在异步结束后还在同一个文件夹下,如果是那么就添加
  4115. if (fileordirinfo[0].UserDirectoryParentID == _nowdiskinfo.directoryid && diskinfo == _nowdiskinfo && _nowdiskinfo.directoryid == diskinfo.directoryid) {
  4116. //如果里面没有内容是展示没有资源的处理
  4117. if ($(_el).Child()[0].className == "U_MD_DK_RZF") {
  4118. _el.innerText = "";
  4119. }
  4120. U.MD.DK.VW.printContent(fileordirinfo, _el); //打印到网盘中
  4121. //添加到侧边栏
  4122. if (_leftel) {
  4123. U.MD.DK.LL.printLeftTreeDirectory(fileordirinfo, _leftel, diskinfo.userInfo.UserId); //如果左边数目显示了
  4124. }
  4125. }
  4126. _el.scrollTop = _el.offsetHeight;
  4127. U.selectEl(_el.lastChild).addClass("U_MD_DK_RZOI");
  4128. }
  4129. /**
  4130. * 新建文件夹处理
  4131. **/
  4132. U.MD.DK.RE.newFolder = function (diskinfo) {
  4133. if (!U.MD.U.L.isLogin()) {//是否登录
  4134. var _directoryid = diskinfo.directoryid//目录id
  4135. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建文件权限
  4136. U.MD.DK.RE.newFolder.confirm(diskinfo, _directoryid); //新建提示框
  4137. }
  4138. else { U.alert("无权限访问此文件夹"); }; /// <reference path="../../robots.txt" />
  4139. }
  4140. }
  4141. /**
  4142. * 新建文件夹处理的新建提示框
  4143. * @param {array} 需要删除文件的数组
  4144. * @param {string} 用户id
  4145. **/
  4146. U.MD.DK.RE.newFolder.confirm = function (diskinfo, directoryid) {
  4147. var _ancestors, //目录的祖先元素
  4148. _groupid, //群id
  4149. _newguid = Guid.newGuid(), //新建文件夹的id
  4150. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": directoryid })[0], //目录网盘信息
  4151. _userid = US.userInfo.UserId, //新建用户id
  4152. _input = $$("input", { "placeholder": "请输入文件夹名字", "style": { "width": "180px", "height": "25px" } }) //输入的名字
  4153. //弹出comfir
  4154. U.MD.DK.RE.newconfirm(
  4155. _input,
  4156. function () {
  4157. var _name = _input.value;
  4158. //获取粘贴到制定目录的群id
  4159. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4160. //如果是ftp目录,那么groupid就是用户id
  4161. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  4162. _groupid = diskinfo.userInfo.UserId;
  4163. }
  4164. //否则就是对应的群id,如果不存在那么就是""
  4165. else {
  4166. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  4167. }
  4168. //文件名判断
  4169. if (U.UF.S.ZWFileName.test(_input.value)) {
  4170. //填写文件名符合规范 将文件夹以及文件夹名字保存到数据库
  4171. U.A.Request(US.DISK, ["CreateDirectory", _userid, _newguid, _dirinfo.UserDirectoryDeep + 1, _input.value, directoryid, "", _groupid, ""], //保存到数据库
  4172. function (r) {
  4173. var _fileinfo = new U.MD.DK.M.entity(_newguid, 0, directoryid, _name, _name, "folder", "", U.UF.D.toTimeStamp(), "", _dirinfo.UserDirectoryDeep + 1,
  4174. null, "", 0, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  4175. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4176. }, []);
  4177. }
  4178. else {
  4179. U.alert("文件名过长或者为空");
  4180. return false;
  4181. }
  4182. },
  4183. function () { },
  4184. "新建文件夹"
  4185. );
  4186. }
  4187. /**
  4188. * 新建文件处理
  4189. **/
  4190. U.MD.DK.RE.newText = function (diskinfo, fun) {
  4191. if (!U.MD.U.L.isLogin()) {//是否登录
  4192. var _directoryid = diskinfo.directoryid; //目录id
  4193. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建文件权限
  4194. top.U.MD.DK.VW.chosenSaveFile('txt', null, '新建文件', fun); //新建提示框
  4195. }
  4196. else { U.alert("无权限访问此文件"); };
  4197. }
  4198. }
  4199. /**
  4200. * 新建文件处理的新建提示框
  4201. **/
  4202. U.MD.DK.RE.newText.confirm = function (diskinfo, directoryid, fun) {
  4203. var _ancestors, //目录的祖先元素
  4204. _groupid, //群id
  4205. _newguid = Guid.newGuid(), //新建文件夹的id
  4206. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": directoryid })[0], //目录网盘信息
  4207. _userid = US.userInfo.UserId, //新建用户id
  4208. _input = $$("input", { "placeholder": "请输入新文本文档的命名", "style": { "width": "180px", "height": "25px", "padding-left": "7px" } }); //输入的名字
  4209. //弹出comfirm
  4210. U.MD.DK.RE.newconfirm(_input,
  4211. function () {
  4212. var _name = _input.value;
  4213. //获取粘贴到制定目录的群id
  4214. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4215. //如果是ftp目录,那么groupid就是用户id
  4216. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  4217. _groupid = diskinfo.userInfo.UserId;
  4218. }
  4219. //否则就是对应的群id,如果不存在那么就是""
  4220. else {
  4221. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  4222. }
  4223. //文件名判断
  4224. if (U.UF.S.ZWFileName.test(_input.value)) {
  4225. //去数据库添加文件
  4226. U.A.Request(US.DISK, ["CreateFile", _userid, _newguid, directoryid, _input.value, "", "", "", "txt", _groupid], function (r) {
  4227. //创建文件
  4228. var _fileinfo = new U.MD.DK.M.entity(_newguid, 0, directoryid, _name, _name, "txt", "", U.UF.D.toTimeStamp(), "", "9999", null, "", 1, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  4229. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4230. //如果存在就执行
  4231. if (fun) {//判断是否有点击事件的方法,如果有,运行它
  4232. fun(_fileinfo);
  4233. }
  4234. }, []);
  4235. }
  4236. else {
  4237. U.alert("文件名过长或者为空");
  4238. return false;
  4239. }
  4240. },
  4241. function () { }, "新建文本文件");
  4242. }
  4243. /**
  4244. * 新建文档处理
  4245. **/
  4246. U.MD.DK.RE.newDocument = function (diskinfo, fun, fileid) {
  4247. if (!U.MD.U.L.isLogin()) {//是否登录
  4248. var _directoryid = diskinfo.directoryid; //目录id
  4249. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建文档权限
  4250. return U.MD.DK.RE.newDocument.confirm(diskinfo, _directoryid, fun, fileid);
  4251. }
  4252. else { U.alert("无权限访问此文档"); };
  4253. }
  4254. }
  4255. /**
  4256. * 新建文档处理的新建提示框
  4257. **/
  4258. U.MD.DK.RE.newDocument.confirm = function (diskinfo, directoryid, fun, fileid) {
  4259. var _ancestors, //目录的祖先元素
  4260. _groupid, //群id
  4261. _newguid = fileid || Guid.newGuid(), //新建文件夹的id
  4262. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": directoryid })[0], //目录网盘信息
  4263. _userid = US.userInfo.UserId, //新建用户id
  4264. _input = $$("input", { "placeholder": "请输入文档名字", "style": { "width": "180px", "height": "25px" } }); //输入的名字
  4265. return U.MD.DK.RE.newconfirm(_input, //创建文档的框
  4266. function () {
  4267. var _name = _input.value;
  4268. //获取粘贴到制定目录的群id
  4269. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4270. //如果是ftp目录,那么groupid就是用户id
  4271. if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
  4272. _groupid = diskinfo.userInfo.UserId;
  4273. }
  4274. //否则就是对应的群id,如果不存在那么就是""
  4275. else {
  4276. _groupid = _ancestors[0].GroupID || "";
  4277. }
  4278. //文件名判断
  4279. if (U.UF.S.ZWFileName.test(_input.value)) {
  4280. //去数据库添加文件
  4281. U.A.Request(US.DISK, ["CreateFile", _userid, _newguid, directoryid, _input.value, "", "", "", "uw", _groupid], function (r) {
  4282. //创建文件
  4283. var _fileinfo = new U.MD.DK.M.entity(_newguid, 0, directoryid, _name, _name, "uw", "", U.UF.D.toTimeStamp(), "", "9999", null, "", 1, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  4284. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4285. //如果存在就执行
  4286. if (fun) {//判断是否保存到数据库
  4287. fun(_fileinfo);
  4288. }
  4289. }, []);
  4290. }
  4291. else {
  4292. U.alert("文件名过长或者为空");
  4293. return false;
  4294. }
  4295. }, function () { }, "新建文档");
  4296. }
  4297. U.MD.DK.RE.newopenApplication = function (diskinfo, fun, fileid) {
  4298. if (!U.MD.U.L.isLogin()) {//是否登录
  4299. var _directoryid = diskinfo.directoryid; //目录id
  4300. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建文档权限
  4301. return U.MD.DK.RE.newopenApplication.confirm(diskinfo, _directoryid, fun, fileid);
  4302. }
  4303. else { U.alert("无权限访问此文档"); };
  4304. }
  4305. }
  4306. U.MD.DK.RE.newopenApplication.confirm = function (diskinfo, _directoryid, fun, fileid) {
  4307. var _ancestors, //目录的祖先元素
  4308. _groupid, //群id
  4309. _taskbar, //_taskbar 作为任务栏显示的元素,包含图标和名字
  4310. _formdiv, //创建任务栏时同时弹出的窗体元素。
  4311. _newguid = fileid || Guid.newGuid(), //新建文件夹的id
  4312. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": _directoryid })[0], //目录网盘信息
  4313. _userid = US.userInfo.UserId, //新建用户id
  4314. _input = $$("input", { "placeholder": "请输入文档名字", "style": { "width": "180px", "height": "25px" } }); //输入的名字
  4315. U.MD.DK.RE.newconfirm(_input, //创建文档的框
  4316. function () {
  4317. var _name = _input.value;
  4318. //获取粘贴到制定目录的群id
  4319. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4320. //如果是ftp目录,那么groupid就是用户id
  4321. if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
  4322. _groupid = diskinfo.userInfo.UserId;
  4323. }
  4324. //否则就是对应的群id,如果不存在那么就是""
  4325. else {
  4326. _groupid = _ancestors[0].GroupID || "";
  4327. }
  4328. //文件名判断
  4329. if (U.UF.S.ZWFileName.test(_input.value)) {
  4330. //去数据库添加文件
  4331. U.A.Request(US.DISK, ["CreateFile", _userid, _newguid, _directoryid, _input.value, "", "", "", "un", _groupid], function (r) {
  4332. //创建文件
  4333. var _fileinfo = new U.MD.DK.M.entity(_newguid, 0, _directoryid, _name, _name, "un", "", U.UF.D.toTimeStamp(), "", "9999", null, "", 1, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  4334. _fileinfo.UserDirectoryExtendType = 'un';
  4335. _fileinfo.UsOffice = U.A.Request(US.CD, ([US.DB, "UseStudio_Disk",
  4336. "GetFileContent", "6a8a235a-41c4-c3d2-8dd5-b6ee851e1967"])).value[0].UsOffice.unEscapeQuotes();
  4337. _fileinfo.newfile = true;
  4338. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4339. //U.MD.D.I.openApplication("word",{ UserDirectoryExtendType: "un" });
  4340. //如果存在就执行
  4341. if (fun) {//判断是否保存到数据库
  4342. fun(_fileinfo);
  4343. }
  4344. }, []);
  4345. }
  4346. else {
  4347. U.alert("文件名过长或者为空");
  4348. return false;
  4349. }
  4350. }, function () { }, "新建导航文档");
  4351. }
  4352. /**
  4353. * 新建工作表处理
  4354. **/
  4355. U.MD.DK.RE.newExcel = function (diskinfo) {
  4356. if (!U.MD.U.L.isLogin()) {//是否登录
  4357. var _directoryid = diskinfo.directoryid; //目录id
  4358. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建工作表权限
  4359. U.MD.DK.RE.newExcel.confirm(diskinfo, _directoryid); //新建提示框
  4360. }
  4361. else { U.alert("无权限访问此工作表"); };
  4362. }
  4363. }
  4364. /**
  4365. * 新建工作表处理的新建提示框
  4366. **/
  4367. U.MD.DK.RE.newExcel.confirm = function (diskinfo, directoryid) {
  4368. var _ancestors, //目录的祖先元素
  4369. _groupid, //群id
  4370. _newguid = Guid.newGuid(), //新建文件夹的id
  4371. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": directoryid })[0], //目录网盘信息
  4372. _userid = US.userInfo.UserId, //新建用户id
  4373. _input = $$("input", { "placeholder": "请输入表格名字", "style": { "width": "180px", "height": "25px" } }); //输入的名字
  4374. U.MD.DK.RE.newconfirm(_input, //创建文档的框
  4375. function () {
  4376. var _name = _input.value;
  4377. //获取粘贴到制定目录的群id
  4378. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4379. //如果是ftp目录,那么groupid就是用户id
  4380. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  4381. _groupid = diskinfo.userInfo.UserId;
  4382. }
  4383. //否则就是对应的群id,如果不存在那么就是""
  4384. else {
  4385. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  4386. }
  4387. //文件名判断
  4388. if (U.UF.S.ZWFileName.test(_input.value)) {
  4389. //去数据库添加文件
  4390. U.A.Request(US.DISK, ["CreateFile", _userid, _newguid, directoryid, _input.value, "", "", "", "ue", _groupid], function (r) {
  4391. //创建文件
  4392. var _fileinfo = new U.MD.DK.M.entity(_newguid, 0, directoryid, _name, _name, "ue", "", U.UF.D.toTimeStamp(), "", "9999", null, "", 1, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  4393. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4394. }, []);
  4395. }
  4396. else {
  4397. U.alert("文件名过长或者为空");
  4398. return false;
  4399. }
  4400. }, function () { }, "新建工作表");
  4401. }
  4402. /**
  4403. * 新建文件对话框
  4404. * @content {string/elemnet} 内容
  4405. * @determineFun {function} 确认回调函数
  4406. * @cancelFun {function} 取消回调函数
  4407. * @string {string} 对话框的标题名字
  4408. */
  4409. U.MD.DK.RE.newconfirm = function (content, determineFun, cancelFun, str) {
  4410. //创建对话框主体元素
  4411. var _confirm = $$("div", { "style": { "cssText": "width: 100%; background: rgb(255,255,255); overflow:hidden; " }, id: "123133456" });
  4412. var _string = str || "提示框";
  4413. //创建内容区域
  4414. var _content = $$("div", { "style": { "cssText": "text-align: center; margin: 30px 20px 30px 20px; " } }, _confirm);
  4415. //判断内容是否为元素
  4416. if (U.UF.C.isElement(content)) {
  4417. //如果为元素则动态添加到对话框中
  4418. U.selectEl(_content).append(content);
  4419. } else {
  4420. //如果为文字则修改inerHTML。
  4421. _content.innerHTML = content || '内容';
  4422. }
  4423. //创建页脚部分
  4424. var _footer = $$("div", { "style": { "cssText": " height:45px;" } }, _confirm);
  4425. //调用Uform窗体创建函数将主体内容添加到窗体中
  4426. var _form = new U.UF.UI.form(
  4427. _string,
  4428. _confirm,
  4429. {
  4430. 'className': 'U_MD_DK_RE_confirmForm',
  4431. "style": {
  4432. "cssText": "font-size: 16px; background: rgb(255,255,255); width: 300px; position: fixed; box-shadow: 0 0 10px 3px rgb(0,0,0); border-radius: 5px;"
  4433. }
  4434. },
  4435. {
  4436. "istop": true,
  4437. "isenlarge": false,
  4438. "isstretching": false,
  4439. "isnarrow": false
  4440. },
  4441. {
  4442. "style": {
  4443. "cssText": " background: rgb(59,88,120); padding: 10px;padding-left: 20px; color: rgb(255,255,255); "
  4444. }
  4445. });
  4446. //创建确定按钮 绑定点击事件,默认点击后执行关闭窗体函数
  4447. $$("div", {
  4448. "style": {
  4449. "cssText": "text-align: center; color: rgb(255,255,255); width: 30%; padding: 5px; background: rgb(48,126,208); border-radius: 5px;float: right; margin-right:35px;"
  4450. },
  4451. innerHTML: "确定",
  4452. onclick: function () {
  4453. var _bool = true;
  4454. if (U.UF.C.isFunction(determineFun)) {
  4455. _bool = determineFun(); //判断是否存在回调 有则执行。
  4456. }
  4457. if (_bool !== false) {
  4458. U.UF.F.closeWindow(_form.form); //关闭窗口函数
  4459. }
  4460. }
  4461. }, _footer);
  4462. content.onkeydown = function (e) { //input键盘按键事件
  4463. var ev = document.all ? window.event : e;
  4464. if (ev.keyCode == 13) { //当按下回车时触发 确定按钮点击事件
  4465. if ($('.U_MD_DK_RE_confirmForm').length > 0) {
  4466. for (var i = 0; i < U.selectEl('.U_MD_DK_RE_confirmForm').length; i++) {
  4467. if ($('.U_MD_DK_RE_confirmForm')[i].style.display == "block") { //检查新建文档窗体是否显示
  4468. var _bool = true;
  4469. if (U.UF.C.isFunction(determineFun)) {
  4470. _bool = determineFun(); //判断是否存在回调 有则执行。
  4471. }
  4472. if (_bool !== false) {
  4473. U.UF.F.closeWindow(_form.form); //关闭窗口函数
  4474. }
  4475. }
  4476. }
  4477. }
  4478. }
  4479. }
  4480. //创建取消按钮 绑定点击事件,默认点击后执行关闭窗体函数
  4481. $$("div", {
  4482. "style": {
  4483. "cssText": "text-align: center; color: rgb(255,255,255); width: 30%; padding: 5px; background: rgb(48,126,208); border-radius: 5px;background: rgb(170,170,170); float: left; margin-left:35px;"
  4484. },
  4485. "innerHTML": "取消",
  4486. "onclick": function () {
  4487. U.UF.C.isFunction(cancelFun) && cancelFun(); //判断是否存在回调 有则执行。
  4488. U.UF.F.closeWindow(_form.form); //关闭窗口函数
  4489. }
  4490. }, _footer);
  4491. content.focus(); //输入框焦点聚集
  4492. return _form;
  4493. }
  4494. /**
  4495. * 新建互联办公文件对话框
  4496. * @determineFun {function} 确认回调函数
  4497. * @cancelFun {function} 取消回调函数
  4498. */
  4499. U.MD.DK.RE.newDocConfirm = function (diskinfo/*determineFun cancelFun*/) {
  4500. if (!U.MD.U.L.isLogin()) {//是否登录
  4501. var _directoryid = diskinfo.directoryid; //目录id
  4502. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建工作表权限
  4503. var _confirm = $$('div'),
  4504. _pickarea = $$("div", { "style": { "cssText": "display:table; width: 100%; height: auto; " } }, _confirm),
  4505. _picklocal = $$("div", { "id": "U_MD_DK_RE_localDoc", "style": { "cssText": "display:table-cell; width:235px; height:170px; background-color:#f5f5f5;text-align:center; vertical-align: middle;cursor: pointer;" } }, _pickarea),
  4506. _pickline = $$("div", { "style": { "cssText": "display:table-cell; width:1px; height: 100%; background-color:#cecece;" } }, _pickarea),
  4507. _pickoa = $$("div", { "style": { "cssText": "display:table-cell; width:234px; height:100%; background-color:#f5f5f5;text-align:center; vertical-align: middle;cursor: pointer;" } }, _pickarea);
  4508. $$("img", { "onerror": U.MD.C.imgError, src: "/img/officefileicon.png", style: { "vertical-align": "middle" } }, _picklocal);
  4509. $$("img", { "onerror": U.MD.C.imgError, src: "/img/oaofficeicon.png", style: { "vertical-align": "middle" } }, _pickoa);
  4510. $$('span', { innerText: '互联文档', style: { "margin-left": "10px" } }, _pickoa);
  4511. $$('span', { innerText: '本地文档', style: { "margin-left": "10px" } }, _picklocal);
  4512. //创建对话框主体元素
  4513. var _enter = $$("div", { "style": { "cssText": "width: 100%; background: rgb(255,255,255); overflow:hidden; display:none" }, id: "123133456" }, _confirm);
  4514. var _string = "新建文档";
  4515. //创建内容区域
  4516. var _content = $$("div", { "style": { "cssText": "text-align: center; margin: 30px 20px 30px 20px;" } }, _enter)
  4517. //创建页脚部分
  4518. var _footer = $$("div", { "style": { "cssText": " height:45px;" } }, _enter);
  4519. //调用Uform窗体创建函数将主体内容添加到窗体中
  4520. var _form = new U.UF.UI.form(
  4521. _string,
  4522. _confirm,
  4523. {
  4524. "style": {
  4525. "cssText": "font-size: 16px; background: rgb(255,255,255); width: 470px; position: fixed; box-shadow: rgb(0, 0, 0) 2px 1px 5px; "
  4526. }
  4527. },
  4528. {
  4529. "istop": true,
  4530. "isenlarge": false,
  4531. "isstretching": false,
  4532. "isnarrow": false
  4533. },
  4534. {
  4535. "style": {
  4536. "cssText": " background: #3c475b;padding:4px 0 ; color: rgb(255,255,255); "
  4537. }
  4538. });
  4539. U.selectEl(_picklocal).bind({
  4540. "mouseover": function () { _picklocal.style.backgroundColor = "#dcdcdc"; }, "mouseout": function () { _picklocal.style.backgroundColor = "#f5f5f5"; }, "click": function () {
  4541. U.MD.DK.RE.newDocument(diskinfo);
  4542. U.UF.F.closeWindow(_form.form, "remove");
  4543. }
  4544. })
  4545. U.selectEl(_pickoa).bind({
  4546. "mouseover": function () { _pickoa.style.backgroundColor = "#dcdcdc"; }, "mouseout": function () { _pickoa.style.backgroundColor = "#f5f5f5"; }, "click": function () {
  4547. // U.selectEl('#U_UF_UI_confirm')[0].style.display = "none";
  4548. var _docId = Guid.newGuid();
  4549. U.MD.O.word(US.userInfo, { 'UserDirectoryID': _docId }, function () {
  4550. var _iframe = U.selectEl('#UD_Word' + _docId).find('iframe')[0].contentWindow;
  4551. _iframe.document.getElementById('U_MD_O_H_body_left_invite_user').children[0].click();
  4552. U.UF.F.closeWindow(_form.form, "remove");
  4553. });
  4554. }
  4555. })
  4556. return _form;
  4557. }
  4558. else { U.alert("无权限访问此工作表"); };
  4559. }
  4560. }
  4561. //#endregion
  4562. //#region 删除文件
  4563. /**
  4564. * 删除文件
  4565. *
  4566. * @param {array} 需要删除文件的数组
  4567. * @param {string} 用户id
  4568. */
  4569. U.MD.DK.RE.deleteFileOrDir = function (fileordirs, userid, diskinfo) {
  4570. var _contentel, _fileordir;
  4571. //多文件删除
  4572. if (fileordirs.length > 1) {
  4573. _contentel = $$("div", { "style": { "cssText": "text-align:center;width:100%;height:30px;padding:5% 0 0% 0;" } });
  4574. $$("span", { "style": { "cssText": "font-weight:bold;" }, "innerHTML": "你确定要删除这" + fileordirs.length + "项吗?" }, _contentel);
  4575. U.UF.UI.confirm(_contentel, function () {//弹出多选判断框
  4576. _fileordir = true; //定义变量_fileordir的初始值,为true
  4577. for (var i = 0; i < fileordirs.length; i++) {//开始循环,循环对象为多选后的文件对象
  4578. if (fileordirs[i].UserDirectoryExtendType == "folder") {//判断是否有文件夹,如果有
  4579. U.alert("删除失败,多选无法删除文件夹"); //弹出提示,方法结束
  4580. _fileordir = false; //修改变量的值
  4581. }
  4582. }
  4583. if (_fileordir == true) {//通过判断变量_fileordir的值,判断是否可以删除,如果可以
  4584. U.MD.DK.RE.deleteDirectoryOrFile(fileordirs, userid); //调用接口,进行删除
  4585. }
  4586. })
  4587. }
  4588. //单文件处理
  4589. else {
  4590. U.A.Request(US.DISK, ["GetChildsByDirectoryId", userid, fileordirs.UserDirectoryID, ""], function (r) {//调用接口,在后台查找这个文件有没有附属文件
  4591. if (r.value.length == 0) {//如果没有
  4592. _contentel = U.MD.DK.RE.attributeStyle(fileordirs, null, diskinfo);
  4593. fileordirs = [fileordirs];
  4594. //弹出提示框,确认后删除文件
  4595. U.UF.UI.confirm(_contentel, function () {
  4596. U.MD.DK.RE.deleteDirectoryOrFile(fileordirs, userid);
  4597. });
  4598. } else {//如果有
  4599. U.alert("删除失败,请先清除文件夹中的文件"); //弹出提示,方法结束
  4600. }
  4601. });
  4602. }
  4603. }
  4604. /**
  4605. * 删除文件接口
  4606. *
  4607. * @param {array} 需要删除文件的数组
  4608. * @param {string} 用户id
  4609. */
  4610. U.MD.DK.RE.deleteDirectoryOrFile = function (fileordirs, userid) {
  4611. var _allfileordirid = U.Json.toKeyArray(fileordirs, "UserDirectoryID").join(","); //所有删除的文件和文件夹的合并id
  4612. U.A.Request(US.DISK, ["DeleteDirectoryOrFile", _allfileordirid, fileordirs[0].GroupID || ""], U.MD.DK.RE.asynDeleteDirectoryOrFile, ["", fileordirs, userid]); //文件夹和文件同时删除
  4613. }
  4614. /**
  4615. * 删除文件异步
  4616. *
  4617. * @param {array} 需要删除文件的数组
  4618. * @param {string} 用户id
  4619. */
  4620. U.MD.DK.RE.asynDeleteDirectoryOrFile = function (r) {
  4621. var i,
  4622. _dirid,
  4623. _context = r.context,
  4624. _fileordirs = _context[1], //文件或者是文件夹信息
  4625. _userid = _context[2], //用户id
  4626. _diskinfo = U.MD.DK.M.diskOperatingSwitch(_userid) //获取用户硬盘的信息
  4627. ;
  4628. r = r.value;
  4629. //允许删除
  4630. if (r) {
  4631. U.MD.DK.M.entity.del(_fileordirs, _diskinfo); //删除diskinfo数组里面的文件或者文件夹
  4632. U.MD.DK.RE.delPageFileOrDir(_fileordirs, _diskinfo); //删除文件在页面上的元素
  4633. }
  4634. else {
  4635. U.alert("操作失败!"); //弹出操作失败
  4636. }
  4637. }
  4638. /**
  4639. * 删除文件在页面上的显示
  4640. *
  4641. * @param {array} 文件或者是目录
  4642. * @param {string} 删除用户网盘的信息
  4643. */
  4644. U.MD.DK.RE.delPageFileOrDir = function (fileordirs, diskinfo) {
  4645. var i,
  4646. _parentdirinfo,
  4647. _contentel = U.selectEl("#U_MD_DK_RZ", diskinfo.formel); //中间的内容
  4648. //循环文件或者文件夹处理
  4649. for (i = 0; i < fileordirs.length; i++) {
  4650. U.selectEl("#L" + fileordirs[i].UserDirectoryID, diskinfo.formel).remove(); //移除左边的导航
  4651. U.selectEl("#R" + fileordirs[i].UserDirectoryID, diskinfo.formel).remove(); //移除右边的文件或者文件夹
  4652. //判断删除的位置是否是当前打开的位置,如果是则保持
  4653. if (fileordirs[i].UserDirectoryID == diskinfo.directoryid) {
  4654. _parentdirinfo = fileordirs[i].Parent;
  4655. }
  4656. }
  4657. //如果删除的位置是当前打开的位置
  4658. if (_parentdirinfo) {
  4659. //重新打印
  4660. U.MD.DK.LE.openFileDirectory(_parentdirinfo, diskinfo.userInfo.UserId);
  4661. }
  4662. //如果文件或者文件夹给全部删除,那么就打印空视图
  4663. else if (_contentel.Child() == 0) {
  4664. U.MD.DK.VW.printNullView(_contentel[0]); //重新打印空视图
  4665. }
  4666. U.selectEl('#U_MD_DK_RKR', diskinfo.formel)[0].innerHTML = '当前文件的数量:' + U.selectEl('.U_MD_DK_RZO').length//删除之后当前文件的数量正确显示
  4667. }
  4668. //#endregion
  4669. //#region 重命名
  4670. /**
  4671. * 删除文件在页面上的元素
  4672. *
  4673. * @param {element} 元素
  4674. * @param {string} 用户id
  4675. */
  4676. U.MD.DK.RE.rename = function (el, fileordir, diskinfo) {
  4677. var _input, _el; //创建一个可输入的input标签
  4678. if (el.firstChild.children[1]) {//判断是否在左边菜单栏插入
  4679. _el = el.firstChild.children[1].children[0]; //插入地方
  4680. _el.innerText = ""//清除原文件名,并在上面设置一个input输出框
  4681. } else {
  4682. _el = el.lastElementChild; //插入地方
  4683. _el.innerText = ""//清除原文件名,并在上面设置一个input输出框
  4684. }
  4685. _input = $$("input", {//创建input框
  4686. "ondblclick": U.UF.EV.stopBubble, //阻止冒泡
  4687. "onblur": function () {//失焦
  4688. U.MD.DK.RE.detemineReName(this, fileordir, diskinfo); //确定修改
  4689. },
  4690. //回车会理
  4691. "onkeyup": function () {
  4692. if (event.keyCode == 13 || event.keyCode == 10) {
  4693. this.onblur(); //失焦
  4694. }
  4695. },
  4696. "onclick": U.UF.EV.stopBubble, //阻止冒泡
  4697. "className": "U_MD_U_P_C_P_N_I", //设置class
  4698. "value": fileordir.UserallDirectoryName.replace("." + fileordir.UserDirectoryExtendType, "")//文件名+后缀
  4699. }, _el); //在哪里插入
  4700. _input.focus(); //聚焦到重命名的input框上面
  4701. }
  4702. /**
  4703. * 確定修改文件名
  4704. *
  4705. * @param {element} 元素
  4706. * @param {string} 用户id
  4707. */
  4708. U.MD.DK.RE.detemineReName = function (inputel, fileordir, diskinfo) {
  4709. var _leftel,
  4710. _rightel,
  4711. _extendtype = fileordir.UserDirectoryExtendType, //文件扩展名
  4712. _name = inputel.value.replaceHtmlSign() + (fileordir.filetype ? "." + _extendtype : ""); //文件或者文件夹的名字
  4713. //修改的名字没有变化
  4714. if (_name != fileordir.UserallDirectoryName) {
  4715. //判断文件名输入符不符合规范
  4716. if (U.UF.S.FileName.test(_name)) {
  4717. //目录的处理
  4718. if (_extendtype == "folder") {
  4719. U.A.Request(US.DISK, ["UpdateDirectoryInfo", fileordir.UserDirectoryID, _name], U.MD.DK.RE.asynDetemineReName, ["", fileordir, _name, diskinfo]);
  4720. }
  4721. //文件的处理
  4722. else {
  4723. U.A.Request(US.DISK, ["UpdateFileInfo", fileordir.UserDirectoryID, _name], U.MD.DK.RE.asynDetemineReName, ["", fileordir, _name, diskinfo]);
  4724. }
  4725. _leftel = U.selectEl("#L" + fileordir.UserDirectoryID, diskinfo.formel)[0]; //左边的导航,文件夹同时展开的时候会存在
  4726. _rightel = U.selectEl("#R" + fileordir.UserDirectoryID, diskinfo.formel)[0]; //右边文件或者文件夹的处理
  4727. //左边的目录处理
  4728. if (_leftel) {
  4729. U.selectEl("div", _leftel)[3].innerText = _name;
  4730. }
  4731. //右边的目录处理
  4732. if (_rightel) {
  4733. U.selectEl("div", _rightel)[3].innerText = _name;
  4734. }
  4735. }
  4736. }
  4737. }
  4738. /**
  4739. * 確定修改文件名
  4740. *
  4741. * @param {element} 元素
  4742. * @param {string} 用户id
  4743. */
  4744. U.MD.DK.RE.asynDetemineReName = function (r) {
  4745. var _context = r.context,
  4746. _fileordir = _context[1], //文件或者文件夹信息
  4747. _name = _context[2] //文件名
  4748. ;
  4749. r = r.value;
  4750. //判断服务器修改是否成功的处理,处理成功后修改文件的信息
  4751. if (r) {
  4752. _fileordir.UserallDirectoryName = _name; //文件全写的名字
  4753. _fileordir.UserDirectoryName = _name.addEllipsis(20); //文件的缩略名
  4754. }
  4755. }
  4756. //#endregion
  4757. //#region 复制 剪切 粘贴
  4758. /**
  4759. * 删除文件在页面上的元素
  4760. *
  4761. * @param {array} 复制粘贴的元素
  4762. * @param {string} 粘贴的格式
  4763. */
  4764. U.MD.DK.RE.copyorshear = function (dirorfile, type, diskinfo) {
  4765. var _userid = US.disk.UserDisk.userInfo.UserId, //用户id
  4766. _dirid = dirorfile.UserDirectoryParentID //复制的目录id
  4767. ;
  4768. //复制的目录转化成数组
  4769. if (!Array.isArray(dirorfile)) {
  4770. dirorfile = [dirorfile];
  4771. }
  4772. //添加复制的全局变量
  4773. US.disk.Disks[_userid].pasteDirOrFile = {
  4774. "type": type, //复制或者剪切 "copy" || "shear"
  4775. "UserDirectoryID": _dirid, //在哪个目录复制或者剪切
  4776. "dirorfile": dirorfile, //复制的内容
  4777. "userid": _userid //用户id
  4778. };
  4779. }
  4780. /**
  4781. * 粘贴文件
  4782. *
  4783. * @param {array} 复制粘贴的元素
  4784. * @param {string} 粘贴的格式
  4785. */
  4786. U.MD.DK.RE.paste = function (diskinfo) {
  4787. var _ancestors, //祖先元素
  4788. _groupid, //群元素
  4789. _fileordirids, //文件和目录的id集合
  4790. _dirid = diskinfo.directoryid, //当前目录id
  4791. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": _dirid }, 1)[0], //当前目录的信息
  4792. _userid = US.disk.UserDisk.userInfo.UserId, //用户id
  4793. _pastecontent = US.disk.Disks[_userid].pasteDirOrFile, //粘贴的内容
  4794. _type = _pastecontent.type, //粘贴的格式
  4795. _pastedirid = _pastecontent.UserDirectoryID, //粘贴目录id
  4796. _dirorfile = _pastecontent.dirorfile, //粘贴文件和目录的数组
  4797. _pasteuserid = _pastecontent.userid //祖先元素
  4798. ;
  4799. //需要剪切的内容存在,无需判断权限了,能触发改函数说明是有权限的。 如果剪切文件,同时不是剪切到同一个目录里
  4800. if (_pastecontent && (_type == "copy" || _dirid != _pastedirid || _pasteuserid != _userid)) { // && (_dirid != _pastedirid || _pasteuserid != _userid)
  4801. //获取粘贴到制定目录的群id
  4802. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4803. //如果是ftp目录,那么groupid就是用户id
  4804. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  4805. _groupid = diskinfo.userInfo.UserId;
  4806. }
  4807. //否则就是对应的群id,如果不存在那么就是""
  4808. else {
  4809. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  4810. }
  4811. _fileordirids = U.Json.toKeyArray(_dirorfile, "UserDirectoryID").join(","); //文件
  4812. //处理粘贴在数据库的过程
  4813. //剪切的处理
  4814. if (_type == "shear") {
  4815. //调用剪切的函数 用户ID 粘贴目录id 文件和目录的id集合 群元素
  4816. U.A.Request(US.DISK, ["CutAndPasteFiles", US.userInfo.UserId, _dirid, _fileordirids, _groupid, _dirorfile[0].GroupID], U.MD.DK.RE.asynPaste, ["", _dirinfo, _groupid, _pastecontent, diskinfo, _pastecontent.type]);
  4817. _pastecontent.type = "copy";
  4818. }
  4819. //复制的处理
  4820. else {
  4821. //调用复制的函数
  4822. U.A.Request(US.DISK, ["CopyAndPasteFiles", US.userInfo.UserId, _dirid, _fileordirids, _groupid], U.MD.DK.RE.asynPaste, ["", _dirinfo, _groupid, _pastecontent, diskinfo, _pastecontent.type]);
  4823. }
  4824. }
  4825. }
  4826. /**
  4827. * 粘贴文件
  4828. *
  4829. * @param {object} ajax的传参处理
  4830. */
  4831. U.MD.DK.RE.asynPaste = function (r) {
  4832. var i,
  4833. _context = r.context, //上线文的传参
  4834. _dirinfo = _context[1], //粘贴到制定的目录
  4835. _groupid = _context[2], //粘贴的群id
  4836. _pastecontent = _context[3], //粘贴的文件或者文件夹内容
  4837. _diskinfo = _context[4], //粘贴的网盘信息
  4838. _type = _context[5], //判断是复制还是剪切
  4839. _copyorshearinfo = US.disk.Disks[_pastecontent.userid], //粘贴网盘的信息
  4840. _pasteinfo = r.value //目录信息
  4841. ;
  4842. //剪切处理的话,先要移除原本的文件,然后在重新处理
  4843. if (_type == "shear") {
  4844. U.MD.DK.M.entity.del(_pastecontent.dirorfile, _copyorshearinfo); //在制定的用户中移除
  4845. U.MD.DK.RE.delPageFileOrDir(_pastecontent.dirorfile, _copyorshearinfo); //剪切的话会在之前目录里面删除
  4846. }
  4847. //循环设置粘贴文件的属性
  4848. for (i = 0; i < _pasteinfo.length; i++) {
  4849. _pasteinfo[i] = new U.MD.DK.M.entity(_pasteinfo[i].UserDirectoryID, _pasteinfo[i].UserDirectorySize, _pasteinfo[i].UserDirectoryParentID, _pasteinfo[i].UserDirectoryName, _pasteinfo[i].UserDirectoryName, _pasteinfo[i].UserDirectoryExtendType, _pasteinfo[i].UserDirectoryUrl, _pasteinfo[i].UserDirectoryAddTime, _pasteinfo[i].UserDirectoryUrl, _pasteinfo[i].UserDirectoryDeep, null, _pasteinfo[i].UserDirectoryEncrypt, _pasteinfo[i].UserDirectoryExtendType == "folder" ? 0 : 1, "", _pasteinfo[i].UserDirectoryEncrypt, "", US.userInfo.UserId, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  4850. }
  4851. //在粘贴网盘的数组目录中添加值
  4852. U.MD.DK.RE.addFileOrFolder(_pasteinfo, _diskinfo, _dirinfo);
  4853. }
  4854. //#endregion
  4855. //#region 文件下载
  4856. //弹出下载的处理
  4857. U.MD.DK.RE.downloadFile = function (dirorfileid, isdir) {
  4858. window.open("/Pages/Download.htm?id=" + dirorfileid + "&type=" + (isdir || ""));
  4859. }
  4860. //#endregion
  4861. //#region 查看评论
  4862. /**
  4863. * 查看评论
  4864. *
  4865. * @param {object} 文件信息
  4866. */
  4867. U.MD.DK.RE.replay = function (fileinfo) {
  4868. // U.MD.I.Img(UDE, UDE);
  4869. // U.MD.D.CM.CKPLXS(UDE.UserDirectoryID, UDE.UserallDirectoryName);
  4870. }
  4871. //#endregion
  4872. //#region 刷新
  4873. /**
  4874. * 刷新
  4875. *
  4876. * @param {string} 用户id
  4877. * @param {object} 目录信息
  4878. */
  4879. U.MD.DK.RE.refresh = function (userid, fileinfo, diskinfo) {
  4880. //如果文档不是最新文档、我的协同、他人邀请的处理
  4881. if (fileinfo.GroupID !== true) {
  4882. U.MD.DK.LE.getChildsByDirectoryId(userid, fileinfo, U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0]); //加载当前网盘内容
  4883. }
  4884. }
  4885. //#endregion
  4886. ;
  4887. ///<jscompress sourcefile="RightMenu.js" />
  4888. //--------------------------------------------------------------右键菜单----------------------------------------------------------------------
  4889. Namespace.register("U.MD.DK.RM"); //Disk的右键命名空间
  4890. //#region 右键查看处理
  4891. /**
  4892. * 右键菜单弹出
  4893. *
  4894. **/
  4895. U.MD.DK.RM.rightMenu = function (el, fileordir, diskinfo) {
  4896. var _ids,
  4897. _diskinfo = diskinfo || US.disk.UserDisk, //网盘信息
  4898. _selectElement = diskinfo.selectElement, //多选的元素
  4899. _userid = _diskinfo.userInfo.UserId, //用户ID
  4900. _fileordir = fileordir || U.Json.select(_diskinfo.directoryOrFiles, { "UserDirectoryID": _diskinfo.directoryid })[0], //右键的文件或者文件夹
  4901. _permissions = U.MD.DK.C.getDirectoryPermissions(_fileordir.UserDirectoryID, _diskinfo), //获取操作的权限
  4902. _rightel = U.selectEl("#U_MD_DK_M", _diskinfo.formel)[0], //右键菜单
  4903. _childel = U.selectEl(_rightel).Child() //右键的菜单节点
  4904. ;
  4905. if (_selectElement.length > 1) {
  4906. _ids = U.Json.toKeyArray(_selectElement, "id").join(",");
  4907. fileordir = U.Json.like(diskinfo.currentDirectoryFile, { "UserDirectoryID": _ids });
  4908. }
  4909. //打开权限的处理
  4910. if (_permissions.isopen && fileordir) {
  4911. _childel[0].style.display = "block";
  4912. _childel[0].onclick = function () {
  4913. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4914. U.MD.DK.LE.openFileDirectory(fileordir, _userid); //打开文件或者文件夹
  4915. };
  4916. }
  4917. else {
  4918. _childel[0].style.display = "none";
  4919. }
  4920. //修改权限的处理 重命名
  4921. if (_permissions.isupadte && fileordir) {
  4922. _childel[1].style.display = "block";
  4923. _childel[1].onclick = function () {
  4924. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4925. U.MD.DK.RE.rename(el, fileordir, _diskinfo); //打开文件或者文件夹
  4926. };
  4927. }
  4928. else {
  4929. _childel[1].style.display = "none";
  4930. }
  4931. //删除权限的处理
  4932. if (_permissions.isdelete && fileordir) {
  4933. _childel[2].style.display = "block";
  4934. _childel[2].onclick = function () {
  4935. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4936. U.MD.DK.RE.deleteFileOrDir(fileordir, _userid, _diskinfo); //删除文件或者文件夹
  4937. }
  4938. }
  4939. else {
  4940. _childel[2].style.display = "none";
  4941. }
  4942. //复制权限的处理
  4943. if (_permissions.iscopy && fileordir) {
  4944. _childel[3].style.display = "block";
  4945. _childel[3].onclick = function () {
  4946. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4947. U.MD.DK.RE.copyorshear(fileordir, "copy", _diskinfo); //复制文件或者文件夹
  4948. }
  4949. }
  4950. else {
  4951. _childel[3].style.display = "none";
  4952. }
  4953. //剪切权限的处理
  4954. if (_permissions.isshear && fileordir) {
  4955. _childel[4].style.display = "block";
  4956. _childel[4].onclick = function () {
  4957. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4958. U.MD.DK.RE.copyorshear(fileordir, "shear", _diskinfo); //剪贴文件或者文件夹
  4959. }
  4960. }
  4961. else {
  4962. _childel[4].style.display = "none";
  4963. }
  4964. //加密权限的处理
  4965. if (_permissions.isencryption && fileordir) {
  4966. _childel[5].style.display = "block";
  4967. _childel[5].onclick = function () {
  4968. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4969. U.MD.DK.RE.asynSetPermissions(fileordir);
  4970. }
  4971. }
  4972. else {
  4973. _childel[5].style.display = "none";
  4974. }
  4975. //下载权限的处理
  4976. if (_permissions.isdownload && fileordir) {
  4977. _childel[6].style.display = "block";
  4978. _childel[6].onclick = function () {
  4979. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4980. U.MD.DK.RE.downloadFile(fileordir.UserDirectoryID || U.Json.toKeyArray(fileordir, "UserDirectoryID").join(","), fileordir.filetype == 0); //弹出下载的处理
  4981. }
  4982. }
  4983. else {
  4984. _childel[6].style.display = "none";
  4985. }
  4986. //新建权限的处理
  4987. if (_permissions.isnew && !fileordir) {
  4988. _childel[7].style.display = "block";
  4989. _childel[8].style.display = "block";
  4990. _childel[9].style.display = "block";
  4991. _childel[10].style.display = "block";
  4992. _childel[7].onclick = function () {
  4993. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4994. U.MD.DK.RE.newFolder(_diskinfo); //新建文件夹
  4995. }
  4996. _childel[8].onclick = function () {
  4997. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4998. U.MD.DK.RE.newText(_diskinfo); //新建txt文件
  4999. }
  5000. _childel[9].onclick = function () {
  5001. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5002. U.MD.DK.RE.newDocument(_diskinfo); //新建word文件
  5003. }
  5004. _childel[10].onclick = function () {
  5005. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5006. U.MD.DK.RE.newExcel(_diskinfo); //新建excel文件
  5007. }
  5008. }
  5009. else {
  5010. _childel[7].style.display = "none";
  5011. _childel[8].style.display = "none";
  5012. _childel[9].style.display = "none";
  5013. _childel[10].style.display = "none";
  5014. }
  5015. //评论权限的处理
  5016. if (_permissions.isreply && !fileordir) {
  5017. _childel[11].style.display = "block";
  5018. _childel[11].onclick = function () {
  5019. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5020. U.MD.DK.RE.replay(fileordir);
  5021. }
  5022. }
  5023. else {
  5024. _childel[11].style.display = "none";
  5025. }
  5026. //粘贴权限处理
  5027. if (_permissions.ispaste && !fileordir) {
  5028. _childel[12].style.display = "block";
  5029. _childel[12].onclick = function () {
  5030. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5031. U.MD.DK.RE.paste(_diskinfo); //粘贴函数
  5032. }
  5033. }
  5034. else {
  5035. _childel[12].style.display = "none";
  5036. }
  5037. //刷新权限处理
  5038. if (_permissions.isrefresh && !fileordir) {
  5039. _childel[13].style.display = "block";
  5040. _childel[13].onclick = function () {
  5041. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5042. U.MD.DK.RE.refresh(_userid, _fileordir, _diskinfo); //刷新函数
  5043. }
  5044. }
  5045. else {
  5046. _childel[13].style.display = "none";
  5047. }
  5048. //上传权限的处理
  5049. if (_permissions.isupload && !fileordir) {
  5050. _childel[14].style.display = "block";
  5051. _childel[14].onclick = function () {
  5052. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5053. U.MD.DK.C.upload(_diskinfo); //文件上传
  5054. }
  5055. }
  5056. else {
  5057. _childel[14].style.display = "none";
  5058. }
  5059. //视图权限的处理
  5060. if (_permissions.isview && !fileordir) {
  5061. _childel[15].style.display = "block";
  5062. _childel[16].style.display = "block";
  5063. _childel[15].onclick = function () {
  5064. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5065. U.MD.DK.VW.viewsSwitch("Normal", _diskinfo); //普通视图
  5066. }
  5067. _childel[16].onclick = function () {
  5068. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5069. U.MD.DK.VW.viewsSwitch("Detailed", _diskinfo); //详细视图
  5070. }
  5071. }
  5072. else {
  5073. _childel[15].style.display = "none";
  5074. _childel[16].style.display = "none";
  5075. }
  5076. //允许查看属性
  5077. if (fileordir && _permissions.isopen) {
  5078. _childel[17].style.display = "block";
  5079. _childel[17].onclick = function () {
  5080. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5081. U.MD.DK.RE.attribute(fileordir);
  5082. }
  5083. }
  5084. else {
  5085. _childel[17].style.display = "none";
  5086. }
  5087. //编辑权限的处理
  5088. if (_permissions.isedit && US.disk.fileType.text.indexOf(_fileordir.UserDirectoryExtendType) > -1) {
  5089. _childel[18].style.display = "block";
  5090. _childel[18].onclick = function () {
  5091. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5092. U.MD.D.I.openApplication("txt", _fileordir); //弹出应用处理
  5093. }
  5094. }
  5095. else {
  5096. _childel[18].style.display = "none";
  5097. }
  5098. //显示右键菜单
  5099. _rightel.style.display = "block";
  5100. if (_rightel.offsetHeight < 10) { //判断是否需要展开右键菜单的处理
  5101. _rightel.style.display = "none"
  5102. }
  5103. else {
  5104. //给右键菜单定位
  5105. U.UF.C.rightClickMenuLocation(_rightel);
  5106. }
  5107. }
  5108. /**
  5109. * 隐藏右键菜单
  5110. * @param {object} 网盘的值
  5111. *
  5112. **/
  5113. U.MD.DK.RM.hiddenRightMenu = function (diskinfo) {
  5114. U.selectEl("#U_MD_DK_M", diskinfo.formel)[0].style.display = "none";
  5115. }
  5116. /**
  5117. * 多文件右键菜单的显示
  5118. * @param {object} 网盘的值
  5119. *
  5120. **/
  5121. U.MD.DK.RM.getSelectionFilesOrDir = function (el) {
  5122. // var i, _UCE = [];
  5123. // for (i = 0; i < UDAD.length; i++) {
  5124. // _UCE.push(UDAD[i].id);
  5125. // };
  5126. // return U.Json.Like(UGE, { "UserDirectoryID": _UCE.join(",") });
  5127. }
  5128. //#endregion
  5129. ;
  5130. ///<jscompress sourcefile="SitePreview.js" />
  5131. /*
  5132. 网站预览 目录展示
  5133. */
  5134. Namespace.register("U.MD.DK.SP"); //Disk左键事件命名空间
  5135. //window.onload = function () {
  5136. // U.MD.DK.SP.getDirectioryInfo(directoryid);
  5137. //}
  5138. /**
  5139. *获取用户信息
  5140. *
  5141. *
  5142. */
  5143. U.MD.DK.SP.getUser = function (userid) {
  5144. var _userid = userid;
  5145. if (userid) {
  5146. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserId", _userid], function (r) {//根据用户名获取用户信息
  5147. console.log(r.value);
  5148. U.selectEl('.U_MD_DK_SP_Head_Logo_name')[0].innerHTML = r.value[0].UserNickName + '的云盘';
  5149. if (r.value[0].UserImageHead) {
  5150. U.selectEl('.U_MD_DK_SP_Head_UImg')[0].src = "http://fs.1473.cn/" + r.value[0].UserImageHead;
  5151. }
  5152. U.selectEl('.U_MD_DK_SP_Head_UImg')[0].title = r.value[0].UserNickName;
  5153. });
  5154. }
  5155. }
  5156. /**
  5157. * 获取目录信息
  5158. * @param {guid} directoryid 目录ID
  5159. */
  5160. U.MD.DK.SP.getDirectioryInfo = function (directoryid, userid) {
  5161. U.UF.CD.loadPageCrossDomain(function () {
  5162. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "GetDirectroyById", directoryid], U.MD.DK.SP.getDirectioryInfo.asyn, [null, userid, directoryid]);
  5163. });
  5164. }
  5165. /**
  5166. * 获取目录信息异步
  5167. *
  5168. */
  5169. U.MD.DK.SP.getDirectioryInfo.asyn = function (r) {
  5170. var _directioryinfo = r.value[0],
  5171. _userid = r.context[1],
  5172. _dirid = r.context[2];
  5173. U.MD.DK.SP.getUser(_userid);
  5174. U.MD.DK.SP.getAllFileInfo(_dirid, _userid, _directioryinfo ? _directioryinfo.GroupID : "");
  5175. }
  5176. /**
  5177. * 获取目录下的文件
  5178. *
  5179. */
  5180. U.MD.DK.SP.getAllFileInfo = function (directoryid, userid, groupid) {
  5181. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "GetChildsByDirectoryId", userid, directoryid, groupid || directoryid], U.MD.DK.SP.getAllFileInfo.asyn);
  5182. }
  5183. /**
  5184. * 获取目录下的文件 异步
  5185. *
  5186. */
  5187. U.MD.DK.SP.getAllFileInfo.asyn = function (r) {
  5188. console.log(r.value);
  5189. var _contentBox = U.selectEl('.U_MD_DK_SP_ContentList')[0];
  5190. U.MD.DK.SP.getParentFile(r.value[0].UserDirectoryParentID);
  5191. for (var i = 0; i < r.value.length; i++) {
  5192. var _fileli = $$('div', { 'className': 'U_MD_DK_SP_Li', 'id': 'U_MD_DK_SP_Li' + i }, _contentBox);
  5193. $$('div', { 'className': 'U_MD_DK_SP_CTopNum', 'innerHTML': i > 8 ? (i + 1) : '0' + (i + 1) }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5194. var _icon = U.MD.DK.SP.getIcon(r.value[i].UserDirectoryExtendType); //根据文件扩展名,得到图标的样式
  5195. if (!_icon.classname[2]) {
  5196. _icon.classname[2] = 'U_MD_DK_SP_unfile';
  5197. }
  5198. var _filename = $$('div', { 'className': 'U_MD_DK_SP_CTopFileName', 'title': r.value[i].UserallDirectoryName }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5199. $$('span', { 'className': _icon.classname[2] + ' U_MD_DK_SP_Img U_MD_DK_SP_RZSMI ', 'innerHTML': '&nbsp;&nbsp;&nbsp;&nbsp;' }, _filename);
  5200. _filename.innerHTML += r.value[i].UserallDirectoryName;
  5201. $$('div', { 'className': 'U_MD_DK_SP_CTopFileType', 'innerHTML': r.value[i].UserDirectoryExtendType }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5202. $$('div', { 'className': 'U_MD_DK_SP_CTopFileSize', 'innerHTML': U.UF.UP.minUnitToMaxUnit(r.value[i].UserDirectorySize) }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5203. $$('div', { 'className': 'U_MD_DK_SP_CTopFileAuthor', 'innerHTML': r.value[i].UserNickName }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5204. var _date = U.UF.D.formatDateToArray(r.value[i].UserDirectoryAddTime);
  5205. $$('div', { 'className': 'U_MD_DK_SP_CTopFileUpdateTime', 'innerHTML': _date[0] + "-" + _date[1] + "-" + _date[2] + " " + _date[3] + ":" + _date[4] }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5206. _fileli.onclick = U.UF.C.closure(function (fileinfo) {
  5207. console.log(fileinfo);
  5208. if (fileinfo.UserDirectoryExtendType == 'folder') {
  5209. window.location.href = window.location.origin + window.location.pathname + window.location.search + "/" + fileinfo.UserallDirectoryName;
  5210. }
  5211. else {
  5212. //window.open(window.location.origin + window.location.pathname + "/" + fileinfo.UserallDirectoryName + window.location.search);
  5213. var i,
  5214. _applicationame,
  5215. _types = US.disk.applicationTypes,
  5216. _extension = fileinfo["UserDirectoryExtendType"].toLocaleLowerCase();
  5217. for (i in _types) {
  5218. if (_types[i].types.indexOf(_extension) > -1) { //判断文件类型是否归属该应用
  5219. _applicationame = i;
  5220. break;
  5221. }
  5222. }
  5223. console.log(_applicationame);
  5224. switch (_applicationame) {
  5225. case "music": //播放制定的音乐,需要流程图
  5226. U.MD.DK.LE.music(fileinfo); //音乐控件
  5227. break;
  5228. case "image": //图片查看,需要流程图
  5229. U.MD.DK.LE.img(fileinfo); //图片控件
  5230. break;
  5231. case "video": //视频处理 需要流程图
  5232. U.MD.DK.LE.video(fileinfo); //视频控件
  5233. break;
  5234. case "text": //文本文件需要流程图
  5235. U.MD.D.Txt.textCreate(fileinfo);
  5236. break;
  5237. case "usoffice": //如果是云端系统自有格式文件。 需要流程图
  5238. //excel处理
  5239. case "ue": //word处理
  5240. U.MD.D.I.openApplication("excel", fileinfo); //弹出应用处理
  5241. break;
  5242. case "uw": case "un": //word处理
  5243. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  5244. break;
  5245. case "word":
  5246. U.A.Request(US.DISK, ["GetFileContent", fileinfo.UserDirectoryID], function (r) {
  5247. //获取word内容
  5248. if (r.value && r.value.UsOffice !== undefined && r.value.UsOffice != null) {
  5249. fileinfo.UsOffice = r.value.UsOffice.unEscapeQuotes();
  5250. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  5251. }
  5252. //如果内容不存在则去office系统中获取
  5253. else {
  5254. U.A.Request("http://office.1473.cn/Officetohtml.ashx", ["Open", fileinfo.UserDirectoryExtendType, fileinfo.UserFilesServerName], function (r) {
  5255. if (r.value.value != undefined) {
  5256. r = r.value;
  5257. fileinfo.UsOffice = r.value.getBodyHtml().replace(/src=[\'\"]?([^\'\"]*)[\'\"]?/ig, function (str1, str2) {
  5258. return "src=\"http://office.1473.cn/usoffice/" + str2 + "\"";
  5259. });
  5260. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  5261. } else {
  5262. U.Alert('文档已丢失。。。');
  5263. }
  5264. });
  5265. }
  5266. });
  5267. break;
  5268. case "txt": //txt处理
  5269. U.MD.D.I.openApplication("txt", fileinfo); //弹出应用处理
  5270. break;
  5271. //windows上传的不可识别的文件打开,直接跳转到下载页面。
  5272. default:
  5273. U.MD.DK.RE.downloadFile(fileinfo.UserDirectoryID, false);
  5274. break;
  5275. }
  5276. }
  5277. }, [r.value[i]]);
  5278. }
  5279. }
  5280. /***
  5281. *获取图标
  5282. *extendtype {string} 文件种类
  5283. */
  5284. U.MD.DK.SP.getIcon = function (extendtype) {
  5285. var i,
  5286. _application = US.disk.applicationTypes //获取所有打开应用的信息
  5287. ;
  5288. if (extendtype) {
  5289. //循环信息中找到指定的应用的信息
  5290. for (i in _application) {
  5291. //找到后缀名对应的程序信息
  5292. if (_application[i].types.indexOf(extendtype.toLowerCase()) > -1) {
  5293. return _application[i]; //返回应用的信息
  5294. }
  5295. }
  5296. }
  5297. return _application["unknownfile"]; //如果是本站未知的后缀直接归属于文件
  5298. }
  5299. /***
  5300. *获取上一次文件夹
  5301. *extendtype {string} 文件种类
  5302. */
  5303. U.MD.DK.SP.getParentFile = function (parentid) {
  5304. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "GetDirectroyById", parentid], function (r) {
  5305. if (r.value[0]) {
  5306. U.selectEl('.U_MD_DK_SP_Head_Logo_name')[0].innerHTML += '-' + r.value[0].UserDirectoryName + '文档详细列表';
  5307. }
  5308. }, []);
  5309. }
  5310. ;
  5311. ;
  5312. ///<jscompress sourcefile="Friend.js" />
  5313. ///<jscompress sourcefile="Add.js" />
  5314. Namespace.register("U.MD.F.J"); //好友加群加好友的命名空间
  5315. /*
  5316. * U.MD.F.J.groupInfoForm 显示添加群的窗口(创建一个群添加的窗口)
  5317. */
  5318. //#region 创建群组
  5319. //听见群用户的信息
  5320. U.MD.F.J.selectUserInfo = {
  5321. NeedUser: [], //需要添加的群用户
  5322. SelectUser: [], //已经选择过的用户
  5323. CallBack: null //添加后的回调
  5324. };
  5325. /**
  5326. * 显示添加群窗口
  5327. *
  5328. * @param {object} 群信息
  5329. * @param {element} 元素处理
  5330. * @param {boolean}
  5331. */
  5332. U.MD.F.J.groupInfoForm = function (groupinfo, chatel) {
  5333. var _formel, //窗体
  5334. _groupuserinfo, //获取所有的群好友
  5335. _determinebottom,
  5336. _closebottom,
  5337. _isgroupmain,
  5338. _isdeletegroup,
  5339. _groupinfoel = U.selectEl("#U_MD_F_Add"), //添加群的窗体
  5340. _addgroupuserel = U.selectEl("#U_MD_F_RC_C")[0], //内容区域
  5341. _groupinfochildsel = _groupinfoel.Child(), //群信息窗体子元素
  5342. _inputel = U.selectEl("input,textarea", _groupinfochildsel[0]); //内容输出
  5343. //清空群用户
  5344. U.MD.F.J.selectUserInfo.NeedUser.splice(0, U.MD.F.J.selectUserInfo.NeedUser.length);
  5345. //设置该联系人进入群
  5346. _groupinfochildsel[1].innerHTML = "";
  5347. //如果群存在的处理
  5348. if (groupinfo) {
  5349. //是否是新建群或者是群主,
  5350. if ($('.U_MD_F_Add_TNM_ADD2')[0]) {
  5351. U.selectEl('.U_MD_F_Add_TNM_ADD2')[0].style.display = "none";
  5352. }
  5353. if ($('.U_MD_F_Add_TNMO')[0]) {
  5354. U.selectEl('.U_MD_F_Add_TNMO')[0].style.display = "block";
  5355. }
  5356. if ($('.U_MD_F_Add_C_D')[0]) {
  5357. U.selectEl('.U_MD_F_Add_C_D')[0].style.display = "block";
  5358. }
  5359. if (groupinfo) {
  5360. _isgroupmain = groupinfo.GroupManageCreateUserID == US.userInfo.UserId; //群主
  5361. } else {
  5362. _isgroupmain = !groupinfo; //新建群
  5363. }
  5364. //判断是否是群主还是群成员
  5365. if (_isgroupmain) {
  5366. _isdeletegroup = "解散该群"; //群主
  5367. } else {
  5368. _isdeletegroup = "退出该群"; //群成员
  5369. }
  5370. //设置是否显示解散该群还是退出该群
  5371. U.selectEl(_groupinfoel[0]).Child()[2].style.display = "block";
  5372. //设置群名,群描述等
  5373. _inputel[0].value = groupinfo.GroupManageName;
  5374. _inputel[1].value = groupinfo.GroupManageDescript;
  5375. //获取群用户的信息
  5376. _groupuserinfo = U.Json.select(US.friend.groupusers, { "GroupManageID": groupinfo.GroupManageID });
  5377. //获取群成员人数
  5378. U.selectEl('.U_MD_F_Add_TNM_Number')[0].innerHTML = _groupuserinfo.length + "人";
  5379. //设置已经选择过的用户
  5380. U.MD.F.J.selectUserInfo.SelectUser = _groupuserinfo;
  5381. //打印当前群的用户
  5382. U.MD.F.J.printGroupUserInfo(_groupinfochildsel[1], _groupuserinfo, groupinfo);
  5383. //点击退出按钮事件设置
  5384. U.selectEl(_groupinfochildsel[2]).addAttrArray({
  5385. "onclick": function () {
  5386. U.MD.F.J.groupExit(groupinfo, U.Json.selectOne(_groupuserinfo, { "UserId": US.userInfo.UserId }), _groupinfoel);
  5387. },
  5388. "innerHTML": _isdeletegroup
  5389. });
  5390. }
  5391. //创建新群,清空数据
  5392. else {
  5393. //设置群名,群描述等
  5394. _inputel[0].value = "";
  5395. _inputel[1].value = "";
  5396. U.selectEl(_groupinfoel[0]).Child()[2].style.display = "none";
  5397. U.selectEl('.U_MD_F_Add_TNMO')[0].style.display = "none";
  5398. U.selectEl('.U_MD_F_Add_C_D')[0].style.display = "none";
  5399. U.selectEl('.U_MD_F_Add_TNM_ADD2')[0].style.display = "block";
  5400. }
  5401. _groupinfoel[0].style.display = "block";
  5402. //弹出窗体
  5403. _formel = new U.UF.UI.form("群聊信息", _groupinfoel[0], { "id": "U_MD_F_Add_O", "style": { "width": "480px" } }, { isnarrow: false, isenlarge: false }).form;
  5404. if (!groupinfo) {
  5405. U.selectEl($(_formel).Child()[2]).Child()[0].style.MaxHeight = "650px";
  5406. U.selectEl(_formel)[0].style.Maxheight = "650px";
  5407. }
  5408. //确定添加群处理
  5409. _determinebottom = U.selectEl(_groupinfochildsel[3]).Child()[0];
  5410. _determinebottom.onclick = function () {
  5411. if ($('#U_MD_F_addFriendorGroup')[0]) {
  5412. U.selectEl('#U_MD_F_addFriendorGroup')[0].style.display = "none";
  5413. }
  5414. U.MD.F.J.determineCreateGroupAndAddGroupUser(groupinfo ? groupinfo.GroupManageID : null, _groupinfochildsel[0], chatel);
  5415. };
  5416. //邀请好友处理
  5417. _invitationbottom = U.selectEl($(_groupinfochildsel[0]).Child()[1]).Child()[1];
  5418. _invitationbottom.onclick = function () {
  5419. U.MD.F.J.selectFriendForm(function () {
  5420. U.MD.F.J.determineCreateGroupAndAddGroupUser(groupinfo ? groupinfo.GroupManageID : null, _groupinfochildsel[0], chatel, true);
  5421. }, 'friend', "", 1);
  5422. }
  5423. U.selectEl('#U_MD_F_Add_TNM_ADD2_add')[0].onclick = function () {
  5424. U.MD.F.J.selectFriendForm(function () {
  5425. U.MD.F.J.determineCreateGroupAndAddGroupUser(groupinfo ? groupinfo.GroupManageID : null, _groupinfochildsel[0], chatel, true);
  5426. }, 'friend', "", 0);
  5427. }
  5428. //确定取消群处理
  5429. _closebottom = U.selectEl(_groupinfochildsel[3]).Child()[1];
  5430. _closebottom.onclick = function () {
  5431. U.UF.F.windowMinimize(_formel);
  5432. }
  5433. return _formel;
  5434. }
  5435. /**
  5436. * 打印群用户
  5437. *
  5438. * @param {element} 添加进入的元素
  5439. * @param {object} 添加的用户信息
  5440. */
  5441. U.MD.F.J.printGroupUserInfo = function (el, groupuserinfo, groupinfo) {
  5442. var i,
  5443. //临时元素变量
  5444. _tempel,
  5445. _temponeel,
  5446. _temptwoel,
  5447. _tempname,
  5448. _frag = $$("frag"),
  5449. _childsel = U.selectEl(el).Child(),
  5450. _isgroupmain;
  5451. //判断是否是群主
  5452. if (groupinfo) {
  5453. _isgroupmain = groupinfo.GroupManageCreateUserID == US.userInfo.UserId;
  5454. }
  5455. else {
  5456. _isgroupmain = !groupuserinfo;
  5457. }
  5458. //获取不同的classname
  5459. if (_isgroupmain) {
  5460. _tempname = "U_MD_F_Add_R" + " U_MD_F_Add_RS"
  5461. }
  5462. else {
  5463. _tempname = "U_MD_F_Add_R" + ""
  5464. }
  5465. //打印群用户显示的样式
  5466. for (i = 0; i < groupuserinfo.length; i++) { //循环添加
  5467. _tempel = $$("div", { "className": "U_MD_F_Add_CO" }, _frag);
  5468. _tempell = $$("div", { "style": { "width": "32%", "height": "30px", "float": "left" } }, _tempel);
  5469. $$("img", { "onerror": U.MD.C.imgError, "onerror": U.MD.C.imgError, "title": "点击查看", "src": U.MD.C.getHeadImage(groupuserinfo[i].UserThumbnailImageHead) }, _tempell);
  5470. $$("div", { "className": "U_MD_F_Add_COM U_MD_D_Text_Abbreviation", "innerHTML": groupuserinfo[i].UserName }, _tempell);
  5471. _temponeel = $$("div", { "className": "U_MD_F_Add_COM U_MD_D_Text_Abbreviation UD_UserName", "style": { "width": "32%", "margin-left": "2%" }, "innerHTML": groupuserinfo[i].GroupUsersDescript || groupuserinfo[i].UserNickName || groupuserinfo[i].UserName }, _tempel);
  5472. _temptwoel = $$("div", { "className": _tempname }, _tempel);
  5473. //这有已经新建的群
  5474. if (groupinfo) {
  5475. //只有本人或者群主才能修改群名片
  5476. if (_isgroupmain || groupuserinfo[i].UserId == US.userInfo.UserId) {
  5477. $$("img", {
  5478. "src": "/img/Edit1.png",
  5479. "title": "修改群名片",
  5480. "onclick": (function (i) {
  5481. return U.UF.C.closure(U.MD.F.J.upateGroupUserDescriptForm, [groupuserinfo[i], _temponeel]);
  5482. })(i)
  5483. }, _temptwoel);
  5484. }
  5485. $$("img", {
  5486. "src": "/img/personalCard1.png", "title": "查看用户资料",
  5487. "onclick": (function (i) {
  5488. return U.UF.C.closure(U.MD.U.V.ViewOtherUserInfo, [groupuserinfo[i].UserId]);
  5489. })(i)
  5490. }, _temptwoel);
  5491. $$("img", {
  5492. "src": "/img/Add1.png", "title": "添加好友",
  5493. "onclick": (function (i) {
  5494. return U.UF.C.closure(U.MD.F.M.addFriend, [groupuserinfo[i], null, _tempel]);
  5495. })(i)
  5496. }, _temptwoel);
  5497. }
  5498. //如果是群主有移除权限
  5499. if (_isgroupmain) {
  5500. $$("img", {
  5501. "src": "/img/exit1.png", "title": "移除",
  5502. "onclick": (function (i) {
  5503. return U.UF.C.closure(U.MD.F.J.groupExit, [groupinfo, groupuserinfo[i], _tempel]);
  5504. })(i)
  5505. }, _temptwoel);
  5506. }
  5507. }
  5508. //判断元素是否存在,如果存在则,追加元素,如果不存在则添加到最后面
  5509. if (_childsel.length) {
  5510. el.insertBefore(_frag, _childsel[_childsel.length - 1]);
  5511. }
  5512. else {
  5513. el.appendChild(_frag);
  5514. }
  5515. }
  5516. /**
  5517. * 显示添加群窗口
  5518. *
  5519. * @param {object} 群好友信息
  5520. */
  5521. U.MD.F.J.upateGroupUserDescriptForm = function (groupuserinfo, el) {
  5522. var _tempel,
  5523. _temponeel,
  5524. _temptwoel,
  5525. _groupname = groupuserinfo.GroupUsersDescript || groupuserinfo.UserName
  5526. ;
  5527. if (groupuserinfo) {
  5528. //创建好友分组的样式
  5529. _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNL U_MD_F_G" });
  5530. _temponeel = $$("div", {}, _tempel)
  5531. _temptwoel = $$("input",
  5532. {
  5533. "value": _groupname,
  5534. "onfocus": function () {
  5535. U.UF.MR.inputPlaceholder(this, _groupname, "");
  5536. },
  5537. "onblur": function () {
  5538. U.UF.MR.inputPlaceholder(this, "", _groupname);
  5539. }
  5540. }, _temponeel);
  5541. //弹出好友对话框
  5542. U.UF.UI.confirm(_tempel, function () {
  5543. U.MD.F.J.determineUpateGroupUserDescript(groupuserinfo, _temptwoel, el);
  5544. });
  5545. }
  5546. else {
  5547. U.alert("暂无群信息");
  5548. }
  5549. }
  5550. /**
  5551. * 确定设置群信息
  5552. *
  5553. * @param {object} 群好友信息
  5554. */
  5555. U.MD.F.J.determineUpateGroupUserDescript = function (groupuserinfo, inputel, el) {
  5556. //判断用户是否输入正确的备注名
  5557. if (inputel.value && U.UF.S.NickName.test(inputel.value)) {
  5558. U.A.Request(US.FRIEND, ["UpdateGroupMemberInfo", US.userInfo.UserId, groupuserinfo.GroupManageID, groupuserinfo.UserId, inputel.value],
  5559. U.MD.F.J.asynDetermineUpateGroupUserDescript, [null, groupuserinfo, inputel.value, el]);
  5560. }
  5561. else {
  5562. U.alert("备注名格式不对");
  5563. return true;
  5564. }
  5565. }
  5566. /**
  5567. * 修改群备注异步
  5568. *
  5569. * @param {object} 群好友信息
  5570. */
  5571. U.MD.F.J.asynDetermineUpateGroupUserDescript = function (r) {
  5572. var _context = r.context,
  5573. _groupuserinfo = _context[1], //群用户信息
  5574. _descriptname = _context[2], //修改后的备注名
  5575. _el = _context[3]; //元素
  5576. //修改groupuserinfo里面的用户备注的变量和修改显示给用户看到的备注
  5577. _el.innerText = _groupuserinfo.GroupUsersDescript = _descriptname;
  5578. U.alert("修改备注成功!");
  5579. }
  5580. /**
  5581. * 退出或者踢人
  5582. *
  5583. * @param {object} 群信息
  5584. * @param {object} 好友信息
  5585. */
  5586. U.MD.F.J.groupExit = function (groupinfo, userinfo, el) {
  5587. var _userid = US.userInfo.UserId, //用户id
  5588. _isgroupmain = groupinfo.GroupManageCreateUserID == _userid //判断用户是否是群主
  5589. ;
  5590. //如果推出群的是群主处理
  5591. if (_isgroupmain) {
  5592. //如果群主自己推出,则解散群
  5593. if (userinfo.UserId == _userid) {
  5594. U.UF.UI.confirm("是否解散该群", function () {
  5595. U.MD.F.J.enterGroupExit(groupinfo, userinfo, true, el);
  5596. }); //创建提示框 提示是否删除备份
  5597. }
  5598. //否则则移除群好友
  5599. else {
  5600. //创建提示框 提示是否删除备份
  5601. U.UF.UI.confirm("是否移除该群用户", function () {
  5602. U.MD.F.J.enterGroupExit(groupinfo, userinfo, false, el);
  5603. });
  5604. }
  5605. }
  5606. //不是群主的处理
  5607. else {
  5608. U.UF.UI.confirm("是否确定退出该群", function () { U.MD.F.J.enterGroupExit(groupinfo, userinfo, false, el); }); //创建提示框 提示是否删除备份
  5609. }
  5610. }
  5611. /**
  5612. * 移除群异步
  5613. *
  5614. * @param {object} 群信息
  5615. * @param {object} 好友信息
  5616. * @param {bool} 是否为删除群
  5617. */
  5618. U.MD.F.J.enterGroupExit = function (groupinfo, userinfo, isdelete, el) {
  5619. if (isdelete === true) {
  5620. U.A.Request(US.FRIEND, ["DeleteGroup", US.userInfo.UserId, groupinfo.GroupManageID], U.MD.F.J.asynGroupExit, ["", groupinfo, userinfo, isdelete, el]); //解散群
  5621. }
  5622. else {
  5623. U.A.Request(US.FRIEND, ["ExitGroup", US.userInfo.UserId, groupinfo.GroupManageID, userinfo.UserId], U.MD.F.J.asynGroupExit, ["", groupinfo, userinfo, isdelete, el]);
  5624. }
  5625. }
  5626. /**
  5627. * 群移除异步
  5628. *
  5629. * @param {object} 群信息
  5630. * @param {object} 好友信息
  5631. * @param {bool} 是否为删除群
  5632. */
  5633. U.MD.F.J.asynGroupExit = function (r) {
  5634. var _context = r.context,
  5635. _chatfrom,
  5636. _groupinfo = _context[1], //群信息
  5637. _friendinfo = _context[2], //自己在群里的信息
  5638. _isdelete = _context[3], //是解散群还是退出(移除)群用户
  5639. _el = _context[4], //弹出的群窗体
  5640. _chatformel = U.selectEl("#U_MD_F")[0]; //聊天框元素
  5641. //删除群处理 或者退出群
  5642. if (_isdelete) {
  5643. //清空用户在群的数据
  5644. U.Json.del(US.friend.group, { "GroupManageID": _groupinfo.GroupManageID }); //删除群
  5645. U.Json.del(US.friend.groupusers, { "GroupManageID": _friendinfo.GroupManageID }); //删除群用户
  5646. //用户面板里是否存在群,存在删除
  5647. U.selectEl("#U_MD_F_H_ZLZ").find("[tid='" + _groupinfo.GroupManageID + "']").remove(); //删除群
  5648. //判断好友是否出现在聊天框里,如果是则移除聊天框
  5649. if (U.MD.F.W.isCreateForm(_groupinfo.GroupManageID)) {
  5650. U.MD.F.W.delteFriendChat(_groupinfo.GroupManageID, _chatformel);
  5651. }
  5652. //弹出群消息的弹窗
  5653. if (_el) {
  5654. _el = U.selectEl(_el).Parent({ usform: "true" });
  5655. _el.close();
  5656. }
  5657. U.alert('解散群成功');
  5658. }
  5659. //群主删除好友处理
  5660. else if (_groupinfo.GroupManageUserID == US.userInfo.UserId && _isdelete == false) {
  5661. U.selectEl(_el).remove(); //删除好友
  5662. U.Json.del(US.friend.groupusers, { "GroupManageID": _friendinfo.GroupManageID, "UserId": _friendinfo.UserId }); //删除群指定的用户
  5663. U.Json.del(U.MD.F.J.selectUserInfo.SelectUser, { "UserId": _friendinfo.UserId }); //删除群指定的用户
  5664. U.alert('已将成员移除群聊');
  5665. }
  5666. //自己退出群处理
  5667. else {
  5668. //移除群好友
  5669. U.MD.F.W.delteFriendChat(_friendinfo.GroupManageID, _chatformel);
  5670. U.selectEl("#U_MD_F_H_ZLZ").find("[tid='" + _groupinfo.GroupManageID + "']").remove(); //删除群
  5671. U.Json.del(US.friend.group, { "GroupManageID": _friendinfo.GroupManageID }); //删除群指定的用户
  5672. U.Json.del(US.friend.recentcontacts, { "GroupManageID": _friendinfo.GroupManageID }); //删除最近聊天中被删除的群
  5673. //弹出群消息的弹窗
  5674. if (_el) {
  5675. _el = U.selectEl(_el).Parent({ usform: "true" });
  5676. _el.close();
  5677. }
  5678. U.alert('已退出群聊');
  5679. }
  5680. }
  5681. /**
  5682. * 选择联系人弹框
  5683. *
  5684. * @param {object} 添加进入的元素
  5685. * @param {function} 添加的用户信息
  5686. * @param {number} 0 新创群 1邀请好友
  5687. */
  5688. U.MD.F.J.selectFriendForm = function (cb, type, fileinfo, group) {
  5689. //添加好友弹框调用,用户必须登录和已经加载了好友数据
  5690. if (!U.MD.U.L.isLogin() && US.friend.friends) {
  5691. var i, //用于循环所有的是否在群里的人
  5692. _formel, //用于存储创建群选择好友的弹框
  5693. _gel = U.selectEl("#U_MD_F_RC_G_C")[0], //获取组元素
  5694. _fel = U.selectEl("#U_MD_F_RC_F_C")[0], //获取好友元素
  5695. _elparent = U.selectEl("#U_MD_F_RC")[0], //获取存放该元素的父级元素
  5696. _clone = _elparent.cloneNode(true), //克隆元素
  5697. _allfriendinfo = U.Json.select(US.friend.friends.concat([])), //所有的联系人
  5698. _addfriendinfo = U.MD.F.J.selectUserInfo, //选择用户的信息
  5699. _selectfriend = _addfriendinfo.SelectUser, //添加好友信息
  5700. _clickEl = U.selectEl('#U_MD_F_RC_Friend')[0],
  5701. _groupEl = U.selectEl('#U_MD_F_RC_Group')[0],
  5702. _joinEl = U.selectEl('#U_MD_F_RC_Join')[0]
  5703. if (group == 1) {
  5704. //已经在群里的就不添加了
  5705. for (i = 0; i < _selectfriend.length; i++) {
  5706. U.Json.del(_allfriendinfo, { "UserId": _selectfriend[i].UserId }); //删除所有在群里的用户id
  5707. }
  5708. }
  5709. //弹出创建群选择好友的框
  5710. var _form = new U.UF.UI.form("选择联系人",
  5711. _elparent,
  5712. {
  5713. "id": "U_MD_F_RC_O",
  5714. "style": {
  5715. "width": "480px",
  5716. "height": "530px",
  5717. "min-width": "480px"
  5718. }
  5719. },
  5720. {
  5721. isnarrow: false,
  5722. isenlarge: false
  5723. });
  5724. //_formel = _form.form;
  5725. _addfriendinfo.CallBack = cb; //回调函数
  5726. if (US.friend.friends.length) {
  5727. //打印可以选择的联系人
  5728. if (!type || type == 'friend') {
  5729. U.MD.F.J.printSelectFriend(_fel, _allfriendinfo, _elparent);
  5730. _clickEl.onclick = function () {
  5731. _clickEl = U.MD.F.J.alterNately($(_elparent).find('#U_MD_F_RC_F_C')[0], U.selectEl(_elparent).find('#U_MD_F_RC_G_C')[0], _elparent, _clickEl, this)
  5732. }
  5733. }
  5734. //打印可以选择的群
  5735. if (!type || type == 'group') {
  5736. U.MD.F.J.printSelectGroupUser(_gel, US.friend.group, _elparent);
  5737. _groupEl.onclick = function () {
  5738. _clickEl = U.MD.F.J.alterNately($(_elparent).find('#U_MD_F_RC_G_C')[0], U.selectEl(_elparent).find('#U_MD_F_RC_F_C')[0], _elparent, _clickEl, this)
  5739. }
  5740. }
  5741. if (type == 'friend' || type == 'group') {
  5742. _clickEl.style.display = 'none';
  5743. _groupEl.style.display = 'none';
  5744. } else {
  5745. _clickEl.style.display = 'block';
  5746. _groupEl.style.display = 'block';
  5747. }
  5748. } else {
  5749. _clickEl.style.display = 'none';
  5750. _groupEl.style.display = 'none';
  5751. _joinEl.style.display = 'block';
  5752. U.selectEl('.U_MD_F_RC_Join_btn')[0].onclick = function () {
  5753. var _input = $$('input', {}, _joinEl),
  5754. _fileType = fileinfo.UserDirectoryExtendType == 'uw' ? 'word' : 'execl';
  5755. _input.value = "/" + _fileType + '/join/' + fileinfo.UserDirectoryID;
  5756. _input.select();
  5757. document.execCommand("Copy");
  5758. U.selectEl(_input).remove();
  5759. U.Alert('复制成功,赶快分享给小伙伴吧!');
  5760. }
  5761. }
  5762. _addfriendinfo.NeedUser = [];
  5763. _elparent.parentNode.style.backgroundColor = "#f3f3f3"
  5764. U.selectEl(_elparent)[0].style.display = "block"; //显示出添加好友的信息
  5765. U.selectEl("#U_MD_Home")[0].appendChild(_clone); //把克隆的元素打印出来
  5766. return _formel; //返回窗体元素
  5767. }
  5768. }
  5769. /**
  5770. * 打印可以添加的用户
  5771. *
  5772. * @param {object} 添加联系人的元素
  5773. * @param {function} 选择的好友
  5774. */
  5775. U.MD.F.J.printSelectFriend = function (el, friendinfo, boxele) {
  5776. var i, //用于循环所有联系人打印
  5777. _tempel, //用于创建元素
  5778. _temponeel, //用于创建元素
  5779. _frag = $$("frag"); //创建新的元素
  5780. //联系人打印,循环所有还有信息的长度
  5781. for (i = 0; i < friendinfo.length; i++) {
  5782. _tempel = $$("div",
  5783. {
  5784. "className": "U_MD_F_RC_CO",
  5785. "FID": friendinfo[i].UserId,
  5786. "onclick": U.UF.C.closure(function (firendinfo) {
  5787. U.MD.F.J.clickSelectFriend(this, firendinfo); //选择后的点击事件
  5788. U.MD.F.J.showChoose(firendinfo, U.selectEl(this).find('.U_MD_F_RC_COC ')[0], boxele, 'friend')
  5789. }, [friendinfo[i]])
  5790. },
  5791. _frag);
  5792. $$("div", { "className": "U_MD_F_RC_COI U_Img" }, _tempel); //创建元素
  5793. _temponeel = $$("div", { "className": "U_MD_F_RC_COC U_MD_D_Text_Abbreviation" }, _tempel); //创建元素
  5794. $$("img",
  5795. {
  5796. "onerror": U.MD.C.imgError,
  5797. "title": "点击查看",
  5798. "onclick": function (n) {
  5799. return function () {
  5800. U.UF.EV.stopBubble(); //阻止冒泡时间
  5801. U.MD.U.V.ViewOtherUserInfo(friendinfo[n].UserId); //打印个人用户信息
  5802. }
  5803. }(i),
  5804. "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead), //获取好友头像img
  5805. "alt": friendinfo[i].FriendsDescript//获取好友描述
  5806. },
  5807. _temponeel);
  5808. $$("div", { "className": "U_MD_F_RC_COCN", "innerHTML": friendinfo[i].UserNickName }, _temponeel); //创建元素,获取好友用户名
  5809. }
  5810. //显示到框
  5811. el.innerHTML = ""; //清空数据
  5812. el.appendChild(_frag); //获取所有的打印的用户到显示框内
  5813. }
  5814. /**
  5815. * 打印可以添加的群用户
  5816. *
  5817. * @param {object} 添加联系人的元素
  5818. * @param {function} 选择的好友
  5819. */
  5820. U.MD.F.J.printSelectGroupUser = function (el, groupinfo, boxele) {
  5821. var i, //获取循环的元素
  5822. _tempel, //创建元素
  5823. _temponeel, //创建元素
  5824. _frag = $$("frag"); //创建元素的父级元素
  5825. //循环打印,循环所有群信息的长度
  5826. for (i = 0; i < groupinfo.length; i++) {
  5827. _tempel = $$("div",
  5828. {
  5829. "className": "U_MD_F_RC_CO",
  5830. "FID": groupinfo[i].GroupManageID, //fid为群的群id
  5831. "onclick": function (n) {
  5832. return function () {
  5833. U.MD.F.J.showChoose(firendinfo, U.selectEl(this).find('.U_MD_F_RC_COC ')[0], boxele, 'group', this)
  5834. U.MD.F.J.clickSelectGroup(this, groupinfo[n]); //选择群后的点击事件
  5835. }
  5836. }(i)
  5837. }, _frag);
  5838. $$("div", { "className": "U_MD_F_RC_COI U_Img" }, _tempel); //创建元素
  5839. _temponeel = $$("div", { "className": "U_MD_F_RC_COC U_MD_D_Text_Abbreviation" }, _tempel); //创建元素
  5840. $$("img",
  5841. {
  5842. "title": "点击查看",
  5843. "onclick": function (n) {
  5844. return function () {
  5845. U.UF.EV.stopBubble(); //阻止冒泡事件
  5846. U.MD.U.V.GroupInfo(groupinfo[n]); //打印群的所有信息
  5847. }
  5848. }(i),
  5849. "src": "/img/chatgroup.png"//显示群的群头像
  5850. }, _temponeel);
  5851. $$("div", { "className": "U_MD_F_RC_COCN", "innerHTML": groupinfo[i].GroupManageName }, _temponeel); //获取群的群名
  5852. }
  5853. el.appendChild(_frag); //打印群信息
  5854. }
  5855. /**
  5856. * 搜索联系人
  5857. *
  5858. * @param {object} 用户信息
  5859. */
  5860. U.MD.F.J.searchSelectFriend = function (groupinfo) {
  5861. var _searchel = U.selectEl("#U_MD_F_RC_C")[0],
  5862. _UDTD = U.selectEl("div@FID=" + groupinfo.UserId)[0]; //获取选中的添加的元素
  5863. if (_UDTD) {
  5864. _UDTD.onclick();
  5865. U.UF.EV.scrollToPosition(_UDTD); //滚动到指定的位置
  5866. }
  5867. else { U.alert("好友已经添加到群组里~"); }
  5868. }
  5869. /**
  5870. * 选择添加后的效果
  5871. *
  5872. * @param {element} 添加好友的元素
  5873. * @param {object} 好友信息
  5874. */
  5875. U.MD.F.J.clickSelectFriend = function (el, friendinfo) {
  5876. var _selectel = U.selectEl("div", el)[0]; //选择的元素
  5877. //如果元素没有给选择,那么点击选择
  5878. if (_selectel.className == "U_MD_F_RC_COI U_Img") {
  5879. _selectel.className += " U_MD_F_RC_COIO"; //设置点击后的效果样式
  5880. U.MD.F.J.selectUserInfo.NeedUser.push(friendinfo); //最后需要添加的用户
  5881. }
  5882. //如果元素已经是选择的状态,那么点击后则取消选择
  5883. else {
  5884. _selectel.className = "U_MD_F_RC_COI U_Img"; //设置点击后的效果样式
  5885. U.Json.del(U.MD.F.J.selectUserInfo.NeedUser, { "UserId": friendinfo.UserId }); //删除最后需要添加的用户
  5886. }
  5887. }
  5888. /**
  5889. * 选择添加群后的效果
  5890. *
  5891. * @param {element} 添加群的元素
  5892. * @param {object} 群的信息 U.Json()
  5893. */
  5894. U.MD.F.J.clickSelectGroup = function (el, groupinfo) {
  5895. var i,
  5896. _selectel = U.selectEl("div", el)[0], //点击的元素
  5897. _needuser = U.MD.F.J.selectUserInfo.NeedUser, //最后需要添加的用户
  5898. _groupuser = U.Json.select(US.friend.groupusers, { "GroupManageID": groupinfo.GroupManageID }); //选择群里所有的群用户
  5899. //如果元素没有给选择,那么点击选择
  5900. if (_selectel.className == "U_MD_F_RC_COI U_Img") {
  5901. _selectel.className += " U_MD_F_RC_COIO"; //设置点击后的效果样式
  5902. _needuser = _needuser.concat(_groupuser); //把群用户添加到需要添加的用户集合里
  5903. }
  5904. //如果元素已经是选择的状态,那么点击后则取消选择
  5905. else { //添加删除效果
  5906. _selectel.className = "U_MD_F_RC_COI U_Img"; //设置点击后的效果样式
  5907. //移除群里的每一个用户
  5908. for (i = 0; i < _groupuser.length; i++) {
  5909. U.Json.del(_needuser, { "UserId": _groupuser[i].UserId });
  5910. }
  5911. }
  5912. }
  5913. /**
  5914. * 创建群取消按钮
  5915. *
  5916. * @param {element} 添加好友窗体
  5917. */
  5918. U.MD.F.J.closeSelectFriendForm = function (el) {
  5919. U.UF.F.closeWindow($(el).Parent({ usform: "true" }), "remove"); //移除创建群的弹窗
  5920. }
  5921. /**
  5922. * 确定添加按钮
  5923. *
  5924. * @param {element} 添加好友窗体
  5925. */
  5926. U.MD.F.J.determineSelectFriend = function (el) {
  5927. var _selectuserinfo = U.MD.F.J.selectUserInfo, //获取所有选择信息
  5928. _groupid = U.selectEl(el).find('.U_MD_F_RC_COIO')[0] && U.selectEl(el).find('.U_MD_F_RC_COIO')[0].parentNode.getAttribute('fid');
  5929. _groupid = U.Json.select(US.friend.group, { "GroupManageID": _groupid })[0] ? _groupid : false;
  5930. //回调函数处理
  5931. if (_selectuserinfo.CallBack) {
  5932. _selectuserinfo.CallBack(_groupid);
  5933. _selectuserinfo.CallBack = null;
  5934. }
  5935. U.UF.F.closeWindow(el, "remove"); //取消窗口
  5936. }
  5937. /**
  5938. * 显示输入文档名对话框
  5939. *
  5940. */
  5941. U.MD.F.J.inputDocName = function () {
  5942. var _confirmEl = U.selectEl('#U_UF_UI_confirm')
  5943. U.UF.F.topWindow(_confirmEl[0])
  5944. U.selectEl(_confirmEl).find('#U_MD_DK_RE_localDoc')[0].click()
  5945. }
  5946. /**
  5947. * 确定添加按钮
  5948. * 点击好友添加确定按钮,去数据库创建一个群
  5949. * @param {element} 添加好友窗体
  5950. * @param {string} 群id
  5951. * @param {boolean} 是否是新建
  5952. */
  5953. U.MD.F.J.determineCreateGroupAndAddGroupUser = function (groupid, el, chatel, update, groupname, groupdescript, cb) {
  5954. var i,
  5955. _groupinfo, //群信息
  5956. _inputs = U.selectEl("input,textarea", el), //输入的群信息
  5957. _adduserinfo = U.MD.F.J.selectUserInfo.NeedUser, //需要添加用户的集合
  5958. _userid = US.userInfo.UserId, //用户的id
  5959. _groupname = groupname == undefined ? _inputs[0].value : groupname, //创建的群名
  5960. _groupdescript = groupdescript == undefined ? _inputs[1].value : groupdescript, //创建的群描述
  5961. _groupuserids = U.Json.toKeyArray(_adduserinfo, "UserId").join(",") //添加进入群所有好友的id
  5962. ;
  5963. //如果群不存在则创建
  5964. if (!groupid) {
  5965. if (_groupname == "") {
  5966. for (var i = 0; i < _adduserinfo.length; i++) {
  5967. _groupname = _groupname + "、" + _adduserinfo[i].UserNickName;
  5968. }
  5969. _groupname = _groupname + "、" + US.userInfo.UserNickName;
  5970. _groupname = _groupname.substr(1, _groupname.length);
  5971. }
  5972. groupid = Guid.newGuid(); //新建一个群id
  5973. _groupinfo = new U.MD.F.T.groupEntity(groupid, _groupname, new Date(), _userid, _groupdescript, null); //添加群实体
  5974. //获取创建群后,拉进群用户里包括自己
  5975. _adduserinfo.push(US.userInfo);
  5976. if (_groupuserids) {
  5977. _groupuserids = _userid + "," + _groupuserids;
  5978. } else {
  5979. _groupuserids = _userid;
  5980. }
  5981. //关闭弹框
  5982. U.UF.F.closeWindow($(el).Parent({ usform: "true" }), "remove");
  5983. }
  5984. //群存在操作
  5985. else {
  5986. _groupinfo = U.Json.select(US.friend.group, { "GroupManageID": groupid })[0]; //获取群
  5987. }
  5988. // _adduserinfo = _adduserinfo.splice(0, _adduserinfo.length); //移除全局变量,把需要添加的用户删除
  5989. //创建群成员,给每个群成员发送一条建立群给拉入群的消息
  5990. U.A.Request(US.FRIEND, ["CreateGroupAndAddUser", _userid, groupid, _groupname, _groupdescript, _groupuserids],
  5991. U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser, ["", _groupinfo, _adduserinfo, groupid, _groupname, _groupdescript, el, chatel, _groupuserids, update, cb]); //添加到数据库
  5992. }
  5993. /**
  5994. * 异步创建群
  5995. * @param {object} 服务器返回的值
  5996. */
  5997. U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser = function (r) {
  5998. var i,
  5999. _context = r.context, //回调函数的值
  6000. _directory,
  6001. _diskinfo,
  6002. _groupuser,
  6003. _userinfo = US.userInfo, //回调的用户信息
  6004. _groupinfo = _context[1], //当前群信息
  6005. _groupuserinfo = _context[2], //用户信息集合
  6006. _groupid = _context[3], //群id
  6007. _groupname = _context[4], //群名
  6008. _groupdescript = _context[5] //群描述
  6009. ;
  6010. r = r.value; //获取服务器的返回值
  6011. //创建群或者修改群成功o
  6012. if (r !== false) {
  6013. //如果新建的群不存在全局变量中,则新建一个
  6014. if (!U.Json.select(US.friend.group, { "GroupManageID": _groupid })[0]) {
  6015. US.friend.group.unshift(_groupinfo); //把群插入全局变量中
  6016. //新建一个群目录
  6017. _directory = new U.MD.DK.M.entity(_groupinfo.GroupManageID, 0, US.userInfo.UserId, _groupinfo.GroupManageName, _groupinfo.GroupManageName,
  6018. "folder", null, new Date(), U.MD.DK.C.getIcon("folder")[1], 1, null, null, 0, "", _groupinfo.GroupManageID);
  6019. //调用添加文件到disk全局的方法
  6020. _diskinfo = U.MD.DK.M.diskOperatingSwitch(_userinfo.UserId); //根据userid获取网盘的信息
  6021. U.MD.DK.M.entity.add([_directory], _diskinfo); //添加到disk全局里
  6022. }
  6023. //如果群已经存在了,那么修改群名和群描述
  6024. else {
  6025. _groupinfo.GroupManageName = _groupname; //群名
  6026. _groupinfo.GroupManageDescript = _groupdescript; //群描述
  6027. }
  6028. //把群的用户添加到群用户数组里
  6029. for (i = 0; i < _groupuserinfo.length; i++) {
  6030. _groupuser = new U.MD.F.T.groupUserEntity(_groupuserinfo[i].UserId, _groupuserinfo[i].UserImageHead,
  6031. _groupuserinfo[i].UserNickName, _groupuserinfo[i].UserName, _groupuserinfo[i].UserThumbnailImageHead,
  6032. _groupuserinfo[i].UserNickName, _groupid, 1); //新建一个群用户
  6033. US.friend.groupusers.push(_groupuser); //添加到群用户里
  6034. }
  6035. //创建群成功后,直接点击查看群。
  6036. U.selectEl($("#U_MD_F_H_ZLTA").Child()[2]).Child()[0].onclick();
  6037. //提示语
  6038. if (_groupinfo && _groupuserinfo.length > 0) { //判断是否有邀请好友
  6039. if (_groupinfo) {
  6040. var _alert = _groupname + "邀请成功";
  6041. } else {
  6042. var _alert = "邀请好友请入群成功~";
  6043. }
  6044. //清空群用户
  6045. U.MD.F.J.selectUserInfo.NeedUser.splice(0, U.MD.F.J.selectUserInfo.NeedUser.length);
  6046. U.Alert(_alert);
  6047. //点击'确定'按钮
  6048. } else {
  6049. U.selectEl('#U_MD_F_Add_O')[0].style.display = "none";//隐藏群组信息窗口
  6050. }
  6051. }
  6052. //创建失败的提示
  6053. else {
  6054. U.Alert("服务器繁忙,请从新创建!!");
  6055. }
  6056. }
  6057. /*
  6058. * 弹框询问用户是否创建这个群
  6059. * @param groupid 群的id
  6060. * @param groupname 群名
  6061. * @param groups 群的描述
  6062. * @param fileid 文件id
  6063. * @param cb 回调函数 点击确定后的回调函数
  6064. */
  6065. U.MD.F.J.isCreateGroup = function (groupid, groupname, groupds, fileid, cb) {
  6066. _isgroup = U.Json.select(US.friend.group, { "GroupManageID": groupid })[0]; //判断群是否已经存在在列表中
  6067. //判断是否存在这个群
  6068. if (!_isgroup) {
  6069. var _elparent = $$("div", {}); //创建父级元素
  6070. var _elcontent = $$("div",
  6071. {
  6072. "className": "U_MD_F_A_T",
  6073. "innerHTML": "您的文档将移至新建群里(" + groupds + "),是否新建群组?"
  6074. }, //创建弹窗内容
  6075. _elparent);
  6076. var _elall = $$("div",
  6077. {
  6078. "className": "U_MD_F_A_T_All"
  6079. }, //创建信息父级元素
  6080. _elparent);
  6081. var _elbutton = $$("div",
  6082. {
  6083. "className": "U_MD_F_A_T_OFF",
  6084. "innerHTML": "取消"
  6085. }, //取消按钮
  6086. _elall);
  6087. $$("div",
  6088. {
  6089. "className": "U_MD_F_A_T_OUT",
  6090. "innerHTML": "确认",
  6091. "onclick": function () {
  6092. U.MD.F.J.changeInfo(groupid, groupname, groupds, fileid, cb); //点击确定后的点击事件
  6093. }
  6094. }, //确定按钮
  6095. _elall);
  6096. _elbutton.onclick = function () {
  6097. U.selectEl("#U_MD_D_emp_CK")[0].close()
  6098. } //点击取消按钮后关闭窗口
  6099. new U.UF.UI.form("提示",
  6100. _elparent,
  6101. {
  6102. "id": "U_MD_D_emp_CK",
  6103. "style": {
  6104. "width": "250px",
  6105. "height": "170px"
  6106. }
  6107. },
  6108. {
  6109. istop: true,
  6110. isdrag: false,
  6111. isnarrow: false,
  6112. isenlarge: false
  6113. }).form;
  6114. } else {
  6115. U.MD.F.J.changeInfo(groupid, groupname, groupds, fileid, cb)//判断群存在时,默认执行点击确定后的点击事件
  6116. }
  6117. }
  6118. /*
  6119. * 获取所选择的联系人,发送消息
  6120. * @param groupid 群id
  6121. * @param grouopname 群名
  6122. * @param groupds 群描述
  6123. * @param fileid 文件id
  6124. * @param cb 回调函数
  6125. */
  6126. U.MD.F.J.changeInfo = function (groupid, groupname, groupds, fileid, cb) {
  6127. var i, _isgroup,
  6128. // _UCB = U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser, //创建群异步回调
  6129. _groupsign = 1, //判断是否已经创建。如果没有创建,就把_UTF的值设置为0,0在存储过程的传参作用是创建群, 1是不创建直接修改群名
  6130. _userid = US.userInfo.UserId, //当前用户id 也是群主id
  6131. _groupinfo = [groupname, groupds], //群名和群描述的数组 [0]群名 [1]群描述
  6132. _groupfriend = U.MD.F.J.selectUserInfo.NeedUser, //需要添加用户的集合(群用户)
  6133. _grouparr = new Array(); //创建一个新的数组
  6134. //循环所有需要添加用户的集合
  6135. for (var i = 0; i < _groupfriend.length; i++) {
  6136. var pd = 0;
  6137. //循环群数组里是否有内容
  6138. for (var u = 0; u < _grouparr.length; u++) {
  6139. if (_grouparr[u].UserId == _groupfriend[i].UserId || _groupfriend[i].UserId == US.userInfo.UserId) {//判断群数组是否存有需要添加到群的用户
  6140. pd++
  6141. }
  6142. }
  6143. if (pd == 0) {
  6144. _grouparr.push(_groupfriend[i]); //把需要添加的用户信息存入数组中
  6145. }
  6146. }
  6147. _frienduser = U.Json.toKeyArray(_grouparr, "UserId").join(","), //用,分割群用户的id 例: userid,userid
  6148. _useridarr = U.Json.toKeyArray(_grouparr, "UserId").join(","); //用,分割群用户的id 例: userid,userid
  6149. _isgroup = U.Json.select(US.friend.group, { "GroupManageID": groupid })[0]; //判断群是否已经存在在列表中
  6150. if (!_isgroup) { //判断群是否存在
  6151. _groupsign = 0;
  6152. groupid = groupid || Guid.newGuid(); //没有群id创建一个群id
  6153. //创建群的实体,主要是用于添加到US.friend[2]这个群集合里面
  6154. _isgroup = new U.MD.F.T.groupEntity((groupid = groupid || Guid.newGuid()), _groupinfo[0], new Date(), _userid, _groupinfo[1], null); //拼接群用户id 把本人也添加到这个群里
  6155. //判断是否有分割群用户的id,如果有,就拼接起来
  6156. if (_useridarr) {
  6157. _useridarr = _userid + "," + _useridarr
  6158. } else { //如果没有,就直接添加
  6159. _useridarr = _userid + "" + _useridarr
  6160. }
  6161. }
  6162. // _groupfriend.splice(0, _groupfriend.length); //添加成功后移除用户
  6163. //创建群成员,给每个群成员发送一条建立群给拉入群的消息
  6164. U.A.Request(US.FRIEND, ["CreateGroupAndAddUser", _userid, groupid, _groupinfo[0], _groupinfo[1], _useridarr], U.MD.F.J.asynChangeInfo, ["", _isgroup, _grouparr.splice(0, _grouparr.length), groupid, _groupinfo[0], _groupinfo[1], cb, _frienduser, groupid, _groupinfo[0]]); //添加到数据库
  6165. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "CreateGroupAndAddUser", _userid, _groupinfo[0], _groupinfo[1], groupid, _useridarr, _groupsign], U.MD.F.J.asynChangeInfo, ["", _isgroup, _grouparr.splice(0, _grouparr.length), groupid, _groupinfo[0], _groupinfo[1], cb, _frienduser, groupid, _groupinfo[0]]); //添加到数据库
  6166. //给每个群成员发送一条有关于这个uw文件的消息
  6167. // U.A.Request(US.CD, ([US.DB, "UseStudio_Friends", "SentMessageToFriend", US.userInfo.UserId, _frienduser, US.userInfo.UserNickName || US.userInfo.UserName, '' + groupid + ',' + _groupinfo[0] + ',' + _isgroup.GroupManageCreateDate + ',' + fileid + ',' + _isgroup.GroupManageName + '.UW', 5, false]), function(){}, [""]);
  6168. U.selectEl("#U_MD_D_emp_CK").hide()//隐藏元素
  6169. }
  6170. /**
  6171. * 确定添加按钮
  6172. *点击好友添加确定按钮,去数据库创建一个群
  6173. * @param {object} 添加好友窗体
  6174. */
  6175. U.MD.F.J.asynChangeInfo = function (r) {
  6176. U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser(r); //回调原本创建群的流程函数 这里地方不调用的话 会导致原本在好友聊天中创建群成员和群用不了
  6177. var _context = r.context; //获取信息
  6178. _context[6](_context[1], _context[7], _context[8], _context[9]); //回调群id
  6179. }
  6180. /**
  6181. * 无认证直接加入群
  6182. *
  6183. * @param {object} 群信息
  6184. * @param {function} 群id
  6185. */
  6186. U.MD.F.J.addUsersToGroup = function (groupinfo, cb) {
  6187. if (!U.MD.U.L.isLogin()) {//判断是否登录
  6188. var _userinfo = US.userInfo, //用户信息表
  6189. _userid = _userinfo.UserId, //用户id
  6190. _groups = US.friend.group, //用户群
  6191. _group = U.Json.select(_groups, { "GroupManageID": groupinfo.GroupManageID })[0]; //用户群
  6192. //判断用户是否已经加入群组
  6193. if (!_group) {
  6194. U.alert("正在加入,请稍等..");
  6195. //加入群组处理
  6196. U.A.Request(US.FRIEND, ["AddUsersToGroup", US.userInfo.UserId, groupinfo.GroupManageID, _userid], U.MD.F.J.asynAddUsersToGroup, ["", { MessageContent: groupinfo.GroupManageID, MessageDescript: groupinfo.GroupManageName, UserId: groupinfo.UserId },]);
  6197. }
  6198. //否则直接查看群消息
  6199. else {
  6200. if (cb) {
  6201. cb();
  6202. }
  6203. else { U.MD.F.W.viewFriend(_group); }
  6204. }
  6205. }
  6206. }
  6207. //用户直接进入群异步
  6208. U.MD.F.J.asynAddUsersToGroup = function (r) {
  6209. var _context = r.context,
  6210. _cb = _context[2], //回调函数
  6211. _userid = US.userInfo.UserId, //用户id
  6212. _diskinfo = US.disk.Disks[_userid], //网盘信息
  6213. _groupinfo = U.MD.F.N.asynPulledIntoGroups(r); //添加群文件
  6214. //回调函数处理
  6215. if (_cb) {
  6216. U.UF.C.apply(this, _cb)();
  6217. }
  6218. //查看用户信息
  6219. else {
  6220. U.MD.F.W.viewFriend(_groupinfo);
  6221. }
  6222. U.selectEl($("#U_MD_F_H_ZLTA").Child()[2]).Child()[0].onclick();
  6223. U.alert("成功加入该群");
  6224. }
  6225. //#endregion
  6226. /**
  6227. * 弹出好友添加使用
  6228. *
  6229. * @param {object} 群信息
  6230. */
  6231. U.MD.F.J.addPopup = function () {
  6232. var _el;
  6233. _el = $$("div", { "className": "U_MD_F_A" });
  6234. $$("div", { "className": "U_MD_F_RA", "onclick": U.MD.F.M.createFriendGroupPopup, "innerHTML": "添加分组" }, _el); //添加分组按钮
  6235. $$("div", { "className": "U_MD_F_RA_E", "onclick": "U.MD.F.S.popSearchFriendsOrGroupForm(0);", "innerHTML": "添加/<br>查找好友" }, _el); //查找好友
  6236. $$("div", { "className": "U_MD_F_RA", "onclick": "U.MD.F.S.popSearchFriendsOrGroupForm(1)", "innerHTML": "加入群组" }, _el); //加入群聊 U.MD.F.S.popupsSearchGroups
  6237. $$("div", { "className": "U_MD_F_RA", "onclick": "U.MD.F.J.groupInfoForm();", "innerHTML": "创建群组" }, _el); //创建群聊
  6238. new U.UF.UI.form("添加好友/群聊", _el, { 'id': 'U_MD_F_addFriendorGroup', "style": { "width": "390px", "height": "220px" } }, { isenlarge: false, isnarrow: false });
  6239. };
  6240. /**
  6241. *
  6242. * @param el 准备隐藏的元素
  6243. * @param nel 准备显示的元素
  6244. * @param elparent 准备隐藏的元素的父亲元素
  6245. * @param clickel 上一次点击的元素
  6246. * @param thisel 点击的元素
  6247. * @returns {*} 返回这次点击的元素
  6248. */
  6249. U.MD.F.J.alterNately = function (el, nel, elparent, clickel, thisel) {
  6250. if (thisel != clickel) {
  6251. nel.style.display = 'none';
  6252. nel.previousElementSibling.children[0].src = "/img/arrowR.png";
  6253. var con = U.selectEl(nel).find('.U_MD_F_RC_COIO');
  6254. for (var i = 0; i < con.length; i++) {
  6255. con[i].className = "U_MD_F_RC_COI U_Img"
  6256. }
  6257. U.MD.F.J.selectUserInfo.NeedUser = [];
  6258. U.selectEl(elparent).find('.U_MD_F_RC_C_C')[0].innerHTML = "";
  6259. U.selectEl(elparent).find('.U_MD_F_RC_C_T')[0].innerText = 0;
  6260. }
  6261. if (el.style.display == 'none') {
  6262. el.style.display = 'block';
  6263. el.previousElementSibling.children[0].src = "/img/arrowB.png";
  6264. } else {
  6265. el.style.display = 'none';
  6266. el.previousElementSibling.children[0].src = "/img/arrowR.png";
  6267. }
  6268. return thisel
  6269. }
  6270. /**
  6271. * 选择联系人选择功能
  6272. * @param el 用户信息元素
  6273. * @param boxele 选择联系人大元素
  6274. * @param type 点击的类型 分为'group'和'friend'
  6275. * @param cthis 选中的元素
  6276. */
  6277. U.MD.F.J.showChoose = function (firendinfo, el, boxele, type, cthis) {
  6278. var _fel = U.selectEl($(boxele).find('.U_MD_F_RC_C_C')[0]).find("div[fid='" + U.selectEl(el.parentNode).attr('fid') + "']")[0],
  6279. _leftShowEl = U.selectEl(boxele).find('.U_MD_F_RC_C_C')[0],
  6280. _cNam = cthis && U.selectEl(cthis.parentNode).find('.U_MD_F_RC_COIO') || []
  6281. if (_cNam.length && _cNam[0].parentNode.getAttribute('fid') != U.selectEl(cthis).attr('fid')) {
  6282. var _delElFid = U.selectEl($(_cNam)[0].parentNode).attr('fid')
  6283. _cNam[0].className = _cNam[0].className.replace(' U_MD_F_RC_COIO', '');
  6284. U.selectEl($(boxele).find("div[fid='" + _delElFid + "']")[1]).remove()
  6285. U.MD.F.J.selectUserInfo.NeedUser = []
  6286. }
  6287. if (!_fel) {
  6288. var addel = $$('div', { className: "U_MD_F_RC_C_C_A", fid: U.selectEl(el.parentNode).attr('fid') });
  6289. $$('img', { "onerror": U.MD.C.imgError, src: el.firstElementChild.src }, addel);
  6290. $$('span', { innerText: el.lastElementChild.innerText }, addel)
  6291. addel.onclick = function () {
  6292. U.MD.F.J.clearDefaultStyle();
  6293. addel.className += " U_MD_F_A_AddNewGrouper";
  6294. $$("div", {
  6295. "id": "U_MD_F_A_XX",
  6296. "style": {
  6297. "width": "19px",
  6298. "height": "19px",
  6299. "background-image": "url('/img/YS2017.png')",
  6300. "display": "inline-block",
  6301. "background-repeat": "no-repeat",
  6302. "background-position": "-984px -407px",
  6303. "float": "right",
  6304. "margin": "12px",
  6305. "cursor": "pointer"
  6306. },
  6307. "onclick": function () {
  6308. U.MD.F.J.deleteClick(this, firendinfo, boxele);
  6309. }
  6310. }, addel);
  6311. }
  6312. if (type == "friend") {
  6313. U.selectEl(boxele).find('.U_MD_F_RC_C_C')[0].appendChild(addel);
  6314. } else if (type == "group") {
  6315. _leftShowEl.innerHTML = "";
  6316. if (!cthis.firstChild.className.match('U_MD_F_RC_COIO')) {
  6317. var _groupFid = U.selectEl(el.parentNode).attr('fid'),
  6318. _groupFriends = U.Json.select(US.friend.groupusers, { "GroupManageID": _groupFid })
  6319. _newEl = $$('div');
  6320. for (var i = 0; i < _groupFriends.length; i++) {
  6321. var _cloneEl = addel.cloneNode(true);
  6322. _cloneEl.setAttribute('fid', _groupFriends[i].UserId)
  6323. _cloneEl.fid = _groupFriends[i].UserId;
  6324. _cloneEl.firstChild.src = U.MD.C.getHeadImage(_groupFriends[i].UserImageHead) || "/img/UserHead/UseHead.jpg";
  6325. _cloneEl.lastChild.innerText = _groupFriends[i].UserName;
  6326. _newEl.appendChild(_cloneEl);
  6327. }
  6328. _leftShowEl.appendChild(_newEl);
  6329. U.MD.F.J.selectUserInfo.NeedUser = _groupFriends;
  6330. }
  6331. U.selectEl(boxele).find('.U_MD_F_RC_C_T')[0].innerText = _leftShowEl.children[0] ? _leftShowEl.children[0].children.length : 0;
  6332. return;
  6333. }
  6334. } else {
  6335. U.selectEl(_fel).remove()
  6336. }
  6337. U.MD.F.J.clearDefaultStyle();
  6338. var _lastChild = U.selectEl(".U_MD_F_RC_C_C.U_MD_F_RC_C")[1].lastChild;
  6339. _lastChild.className += " U_MD_F_A_AddNewGrouper";
  6340. $$("div", {
  6341. "id": "U_MD_F_A_XX",
  6342. "style": {
  6343. "width": "19px",
  6344. "height": "19px",
  6345. "background-image": "url('/img/YS2017.png')",
  6346. "display": "inline-block",
  6347. "background-repeat": "no-repeat",
  6348. "background-position": "-984px -407px",
  6349. "float": "right",
  6350. "margin": "12px"
  6351. },
  6352. "onclick": function () {
  6353. U.MD.F.J.deleteClick(this, firendinfo, boxele);
  6354. }
  6355. }, _lastChild);
  6356. U.selectEl(boxele).find('.U_MD_F_RC_C_T')[0].innerText = _leftShowEl.children.length;
  6357. }
  6358. /**
  6359. * 清空默认选中样式功能
  6360. */
  6361. U.MD.F.J.clearDefaultStyle = function () {
  6362. var targerList = U.selectEl(".U_MD_F_RC_C_C.U_MD_F_RC_C")[1].children//已选择联系人的列表
  6363. for (var i = 0; i < targerList.length; i++) {
  6364. targerList[i].className = "U_MD_F_RC_C_C_A"; //修改所有已选择联系人className
  6365. U.selectEl("#U_MD_F_A_XX")[0] ? U.selectEl("#U_MD_F_A_XX")[0].remove() : ""; //判断是否含有删除按钮
  6366. };
  6367. }
  6368. /**
  6369. * 删除已选择联系人功能
  6370. * @param div 选中元素
  6371. * @param firendinfo 用户信息元素
  6372. * @param boxele 选择联系人窗口
  6373. */
  6374. U.MD.F.J.deleteClick = function (div, firendinfo, boxele) {
  6375. window.event ? window.event.cancelBubble = true : e.stopPropagation();
  6376. var _fid = div.parentNode.fid; //该联系人fid
  6377. U.Json.del(U.MD.F.J.selectUserInfo.NeedUser, { "UserId": firendinfo.UserId }); //从json数组中删除该联系人
  6378. div.parentNode.remove(); //从已选择联系人列表里删除该联系人
  6379. U.selectEl(boxele).find('.U_MD_F_RC_C_T')[0].innerText = U.selectEl(boxele).find('.U_MD_F_RC_C_C')[0].children.length; //更改已选择联系人的数量
  6380. var _list = U.selectEl(".U_MD_F_RC_CO"); //好友列表
  6381. for (var x = 0; x < _list.length; x++) {
  6382. if (_list[x].FID == _fid) {//判断是否等于该联系人fid
  6383. _list[x].children[0].className = "U_MD_F_RC_COI U_Img"; //修改该联系人已选中的按钮样式
  6384. }
  6385. }
  6386. }
  6387. /**
  6388. * 一键创建群聊
  6389. * @param div 选中元素
  6390. */
  6391. U.MD.F.J.oneKeyCreateGroup = function (groupid, el, chatel, update, cb) {
  6392. var i,
  6393. _groupinfo, //群信息
  6394. //_inputs = U.selectEl("input,textarea", el), //输入的群信息
  6395. _adduserinfo = U.MD.F.J.selectUserInfo.NeedUser, //需要添加用户的集合
  6396. _userid = US.userInfo.UserId, //用户的id
  6397. _groupname = "协同文档群-" + (new Date().getHours().toString()[1] ? new Date().getHours() : "0" + new Date().getHours()) + ":" + (new Date().getMinutes().toString()[1] ? new Date().getMinutes() : "0" + new Date().getMinutes()), //创建的群名
  6398. _groupdescript = "", //创建的群描述
  6399. _groupuserids = U.Json.toKeyArray(_adduserinfo, "UserId").join(",") //添加进入群所有好友的id
  6400. ;
  6401. //如果群不存在则创建
  6402. if (!groupid) {
  6403. if (_groupname == "") {
  6404. for (var i = 0; i < _adduserinfo.length; i++) {
  6405. _groupname = _groupname + "、" + _adduserinfo[i].UserNickName;
  6406. }
  6407. _groupname = _groupname + "、" + US.userInfo.UserNickName;
  6408. _groupname = _groupname.substr(1, _groupname.length);
  6409. }
  6410. groupid = Guid.newGuid(); //新建一个群id
  6411. _groupinfo = new U.MD.F.T.groupEntity(groupid, _groupname, new Date(), _userid, _groupdescript, null); //添加群实体
  6412. //获取创建群后,拉进群用户里包括自己
  6413. _adduserinfo.push(US.userInfo);
  6414. if (_groupuserids) {
  6415. _groupuserids = _userid + "," + _groupuserids;
  6416. } else {
  6417. _groupuserids = _userid;
  6418. }
  6419. //关闭弹框
  6420. //U.UF.F.closeWindow($(el).Parent({ usform: "true" }), "remove");
  6421. }
  6422. // _adduserinfo = _adduserinfo.splice(0, _adduserinfo.length); //移除全局变量,把需要添加的用户删除
  6423. //创建群成员,给每个群成员发送一条建立群给拉入群的消息
  6424. U.A.Request(US.FRIEND, ["CreateGroupAndAddUser", _userid, groupid, _groupname, _groupdescript, _groupuserids],
  6425. U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser, ["", _groupinfo, _adduserinfo, groupid, _groupname, _groupdescript, el, chatel, _groupuserids, update, cb]); //添加到数据库
  6426. };
  6427. ///<jscompress sourcefile="Friend.js" />
  6428. /*
  6429. 问题:
  6430. 1、整套好友的功能流程图
  6431. 2、设计缺少流程 只有大流程 没有那个按钮的细节流程
  6432. */
  6433. Namespace.register("U.MD.F"); //好友主命名空间
  6434. /*
  6435. * U.MD.F.initFriend 初始化加载好友(初始化好友模块)判断好友窗体是否创建,创建了则初始化创建消息提示图标,点击好友窗体的最近功能按钮
  6436. * U.MD.F.newFriendTips 创建用户提示图标 (在桌面创建一个企鹅图标) 添加用户提示区域
  6437. * U.MD.F.printFriendGroupOrFriend 用户列表好友打印 (点击左上好友功能打印好友列表) 清空好友窗体左边列表内容,判断用户是否拥有好友,有则先创建好友分组,然后根据好友分组打印好友,最后添加进好友窗体。如果没有好友窗体,则触发U.MD.F.printHasNoFriend(_frag)向用户推荐好友
  6438. * U.MD.F.printFriendOrGroup 好友和群样式输出 (打印好友或群的样式在左边聊天列表) 根据用户好友或群数量打印在左边列表,并添加好友或群头像,名字等样式,然后根据UserId和GroupManageID区分好友和群分别添加点击事件,鼠标右击事件,
  6439. * U.MD.F.openOrCloseFriendClass 好友功能下点击分组 (显示或隐藏好友分组下的好友列表) 获取您点击的分组的好友列表元素,判断它的状态(style.display)是隐藏还是显示。隐藏则显示,显示就隐藏
  6440. *
  6441. */
  6442. //#region 初始化好友
  6443. //初始化好友函数
  6444. /**
  6445. * 初始化加载好友
  6446. */
  6447. U.MD.F.initFriend = U.MD.F.CSHFG = function () {
  6448. //如果第三方应用1473,包含了好友窗体。
  6449. if ($("#U_MD_F_H_Z")[0]) {
  6450. var i,
  6451. _friendinfo,
  6452. _selectbottomel,
  6453. _childsel,
  6454. _chatform = U.selectEl("#U_MD_F_H_Z")[0], //好友窗体
  6455. _userinfoel = U.selectEl("#U_MD_F_H_ZLTI", _chatform)[0]; //多好友分栏
  6456. //初始化出现右边的好友聊天
  6457. U.MD.F.W.friendDisplayAndNone([{
  6458. "display": "none",
  6459. "left": "auto"
  6460. },
  6461. {
  6462. "display": "block",
  6463. "top": (US.height - 530) / 2,
  6464. "right": "0px"
  6465. }], true);
  6466. //添加当前使用用户的头像
  6467. U.selectEl($("img", _userinfoel)[0] || $$("img")).addAttrArray({
  6468. "onerror": U.MD.C.imgError,
  6469. "src": U.MD.C.getHeadImage(US.userInfo.UserThumbnailImageHead),
  6470. "onclick": U.MD.U.P.userDataSet
  6471. }).appendTo(_userinfoel);
  6472. if (US.friend.recentcontacts.length) {
  6473. _friendinfo = US.friend.recentcontacts;
  6474. }
  6475. else {
  6476. _friendinfo = US.friend.friends;
  6477. }
  6478. U.MD.F.printRightFormFriend(_friendinfo, U.selectEl("#U_MD_F_H_RC")[0]); //右侧好友最近联系人
  6479. U.MD.F.newFriendTips(); //初始化好友提示
  6480. //我的好友、我的群组等按钮,默认显示我的好友 所以找到我的好友的按钮,并且默认调用onclick
  6481. _selectbottomel = U.selectEl("#U_MD_F_H_ZLTA").Child()[0];
  6482. U.selectEl(_selectbottomel).Child()[0].onclick();
  6483. }
  6484. }
  6485. /**
  6486. * 初始化右边好友出现
  6487. *
  6488. * @param {object} 好友头像处理
  6489. * @param {element} 元素处理
  6490. */
  6491. U.MD.F.printRightFormFriend = function (friendinfo, el) {
  6492. var i,
  6493. _tempel,
  6494. _temponeel,
  6495. _frag = $$("frag"),
  6496. _childs = U.selectEl(el).Child();
  6497. //如果是用户登录多次,移除之前残留的信息
  6498. for (i = 1; i < _childs.length; i++) {
  6499. el.removeChild(_childs[i]);
  6500. }
  6501. //如果有好友资料输出
  6502. if (friendinfo.length) {
  6503. //循环打印好友资料
  6504. for (i = 0; (i < friendinfo.length && i < 11); i++) {
  6505. //群信息打印
  6506. if (friendinfo[i].tf == 1) {
  6507. friendinfo[i] = U.Json.select(US.friend.group, { "GroupManageID": friendinfo[i].UserId })[0];
  6508. _friendoneel = $$("div", {
  6509. "className": "U_MD_F_H_ZLZOCOI", "style": { "margin": "9px 0 0 10px" }, "title": friendinfo[i].GroupManageName, "onclick": U.UF.C.closure(function (friendinfo) {
  6510. U.UF.EV.stopBubble();
  6511. U.MD.F.W.popupFriendsForm(friendinfo);
  6512. }, [friendinfo[i]])
  6513. }, _frag);
  6514. U.MD.F.printGroupHeadImage(friendinfo[i], _friendoneel, 4, [35, 35]);
  6515. }
  6516. //用户打印
  6517. else {
  6518. $$("img", {
  6519. "onerror": U.MD.C.imgError,
  6520. "title": friendinfo[i]["FriendsDescript"],
  6521. "className": "U_MD_F_H_RCI",
  6522. "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead),
  6523. "alt": friendinfo[i].FriendsDescript || friendinfo[i].UserNickName,
  6524. "onclick": U.UF.C.closure(function (friendinfo) {
  6525. U.UF.EV.stopBubble();
  6526. U.MD.F.W.popupFriendsForm(friendinfo);
  6527. U.MD.F.N.canelMarkMessage(friendinfo);
  6528. }, [friendinfo[i]])
  6529. }, _frag);
  6530. }
  6531. }
  6532. }
  6533. //暂无好友追随
  6534. else {
  6535. _tempel = $$("div", { "className": "U_MD_F_H_RCT" }, _frag);
  6536. _temponeel = $$("div", { "className": "U_MD_F_H_RCTS" }, _tempel);
  6537. $$("img", { "onerror": U.MD.C.imgError, "src": "/img/YSUN.png" }, _temponeel);
  6538. $$("div", { "className": "U_MD_F_H_RCTZ U_Img" }, _tempel);
  6539. $$("div", { "className": "U_MD_F_H_RCTX", "innerHTML": "暂时无追随" }, _tempel);
  6540. }
  6541. el.appendChild(_frag);
  6542. }
  6543. /**
  6544. * 用户提示区域
  6545. *
  6546. */
  6547. U.MD.F.newFriendTips = function () {
  6548. if (!$('.U_MD_D_NewsTipsIcon')[0]) {//判断图标是否已经存在
  6549. var _tipsicon = $$("div", { className: "U_MD_D_NewsTipsIcon" }, U.selectEl("#U_MD_F_H_R")[0]);
  6550. _tipsicon.onmousedown = function () { U.UF.F.drag(_tipsicon); };
  6551. }
  6552. }
  6553. /**
  6554. * 用户列表好友打印
  6555. *
  6556. * @param {element} 元素11
  6557. */
  6558. U.MD.F.printFriendGroupOrFriend = function (el) {
  6559. var i,
  6560. _tempel,
  6561. _temponeel,
  6562. _classinfo,
  6563. _friendinfo = US.friend.allclass,
  6564. _frag = $$("frag");
  6565. el.innerText = "";
  6566. //如果用户有好友则打印
  6567. if (US.friend.friends.length) {
  6568. //循环打印好友分组
  6569. for (i = 0; i < _friendinfo.length; i++) {
  6570. _classinfo = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo[i].FriendsGroupID }); //根据好友分组获取好友
  6571. //打印好友分组
  6572. _tempel = $$("div", { id: "g" + _friendinfo[i].FriendsGroupID, "tid": _friendinfo[i].FriendsGroupID, "className": "U_MD_F_H_ZLZO" }, _frag);
  6573. U_MD_F_H_ZLZOT_Img = '<div class="U_MD_F_H_ZLZOT_img"></div>';//插入分组前图标样式
  6574. $$("div", {
  6575. "className": "U_MD_F_H_ZLZOT",
  6576. "innerHTML": U_MD_F_H_ZLZOT_Img + _friendinfo[i].FriendsGroupName + "(" + _classinfo.length + ")",
  6577. "onclick": U.UF.C.closure(function (i) {
  6578. U.MD.F.openOrCloseFriendClass(this);
  6579. }, [i]),
  6580. "oncontextmenu": U.UF.C.closure(function (i) {
  6581. U.MD.F.R.friendClassRightClickMenu(US.friend.allclass[i], this);
  6582. }, [i])
  6583. }, _tempel);
  6584. _temponeel = $$("div", { "className": "U_MD_F_H_ZLZOC" }, _tempel);
  6585. //打印好友
  6586. U.MD.F.printFriendOrGroup(_temponeel, _classinfo);
  6587. }
  6588. }
  6589. //无好友打印提示
  6590. else {
  6591. U.MD.F.printHasNoFriend(_frag);
  6592. }
  6593. el.appendChild(_frag);
  6594. }
  6595. /**
  6596. * 好友和群样式输出
  6597. *
  6598. * @param {element} 元素
  6599. * @param {array} 好友数组
  6600. */
  6601. U.MD.F.printFriendOrGroup = function (el, friendorgroupinfo, isinsert) {
  6602. var i,
  6603. _isfront,
  6604. _friendel,
  6605. _friendoneel,
  6606. _friendtwoel,
  6607. _onlinefrag = $$("frag"),
  6608. _offlinefrag = $$("frag");
  6609. //循环所有的好友或者群,打印到左边好友或群面板中
  6610. if (friendorgroupinfo.length == 0) {
  6611. $$("div", { "class": "U_MD_F_H_ZLZOCO_under", "style": { "margin": "9px 0 0 10px" }, "innerHTML": "该分组暂无好友" }, el);
  6612. }
  6613. else {
  6614. for (i = 0; i < friendorgroupinfo.length; i++) {
  6615. if (friendorgroupinfo[i].tf == 1) {
  6616. friendorgroupinfo[i] = U.Json.select(US.friend.group, { "GroupManageID": friendorgroupinfo[i].UserId })[0]
  6617. }
  6618. _friendel = $$("div", {
  6619. "className": "U_MD_F_H_ZLZOCO",
  6620. "onclick": U.UF.C.closure(function (friendorgroupinfo) {
  6621. U.MD.F.N.canelMarkMessage(friendorgroupinfo);
  6622. U.MD.F.N.cancelNewsMessage(friendorgroupinfo); //点击删除新消息提示图标的提示
  6623. U.MD.F.W.popupFriendsForm(friendorgroupinfo, this);
  6624. }, [friendorgroupinfo[i]]),
  6625. "tid": friendorgroupinfo[i].GroupManageID || friendorgroupinfo[i].UserId,
  6626. "oncontextmenu": U.UF.C.closure(function (friendorgroupinfo) {
  6627. if (friendorgroupinfo.UserId) {
  6628. U.MD.F.R.friendsRightClickMenu(this, friendorgroupinfo);
  6629. U_MD_F_G_Group.style.display = "none";
  6630. }
  6631. else if (friendorgroupinfo.GroupManageID) {
  6632. U.MD.F.R.GroupRightClickMenu(this, friendorgroupinfo);
  6633. U_MD_F_G_Div.style.display = "none";
  6634. }
  6635. }, [friendorgroupinfo[i]])
  6636. });
  6637. _friendoneel = $$("div", { "className": "U_MD_F_H_ZLZOCOI" }, _friendel);
  6638. //如果是群的处理,群的头像输出
  6639. if (friendorgroupinfo[i].GroupManageID) {
  6640. U.MD.F.printGroupHeadImage(U.Json.select(US.friend.group, { "GroupManageID": friendorgroupinfo[i].GroupManageID || friendorgroupinfo[i].UserId })[0], _friendoneel, 4, [35, 35]);
  6641. }
  6642. //好友头像输出
  6643. else {
  6644. $$("img", { "onerror": U.MD.C.imgError, "title": "点击查看", "src": U.MD.C.getHeadImage(friendorgroupinfo[i].UserThumbnailImageHead) }, _friendoneel);
  6645. }
  6646. _friendtwoel = $$("div", { "className": "U_MD_F_H_ZLZOCOR U_MD_D_Text_Abbreviation" }, _friendel);
  6647. $$("div", { "className": "U_MD_F_H_ZLZOCORN U_MD_D_Text_Abbreviation", "innerHTML": friendorgroupinfo[i].FriendsDescript || friendorgroupinfo[i].UserNickName || friendorgroupinfo[i].GroupManageName }, _friendtwoel);
  6648. $$("div", { "className": "U_MD_F_H_ZLZOCORT U_MD_D_Text_Abbreviation", "innerHTML": friendorgroupinfo[i].UserIndividualitysignature || (friendorgroupinfo[i].GroupManageDescript == friendorgroupinfo[i].GroupManageName ? "" : friendorgroupinfo[i].GroupManageDescript) || "" }, _friendtwoel);
  6649. //如果用户在线那么插入到最前面
  6650. if (friendorgroupinfo[i].IsLogin == 1) {
  6651. _onlinefrag.appendChild(_friendel);
  6652. }
  6653. //否则插入到后面
  6654. else {
  6655. _offlinefrag.appendChild(_friendel);
  6656. }
  6657. }
  6658. el.insertBefore(_onlinefrag, el.firstChild); //在线用户插入到最前面
  6659. //如果需要插入到最前面,那么则不管在不在线的用户都插入到最前面
  6660. if (isinsert) {
  6661. el.insertBefore(_offlinefrag, el.firstChild); //用户插入到最前面
  6662. }
  6663. else {
  6664. el.appendChild(_offlinefrag); //非在线用户插入到最后米娜
  6665. }
  6666. }
  6667. }
  6668. /**
  6669. * 打开分组展开好友
  6670. *
  6671. * @param {element} 展开好友的区域
  6672. */
  6673. U.MD.F.openOrCloseFriendClass = function (el) {
  6674. var _firendel = U.selectEl($(el).Parent()).Child()[1]; //获取好友分组对应的好友元素
  6675. //如果现在隐藏了则打开
  6676. if (_firendel.style.display == "none") {
  6677. U.selectEl($($(el).Parent()).Child()[0]).Child()[0].style.cssText += "height:6px;width:10px;background:url(/BoomYun/img/pc/U_MD_F_H_ZLZOT_Open.png)";
  6678. _firendel.style.display = "block";
  6679. }
  6680. //如果是显示则隐藏
  6681. else {
  6682. U.selectEl($($(el).Parent()).Child()[0]).Child()[0].style.cssText += "height:10px;width:6px;background:url(/BoomYun/img/pc/U_MD_F_H_ZLZOT_Retract.png)";
  6683. _firendel.style.display = "none";
  6684. }
  6685. }
  6686. /**
  6687. * 打印空好友
  6688. *
  6689. * @param {element} 打印的区域
  6690. */
  6691. U.MD.F.printHasNoFriend = function (el) {
  6692. var _tempel,
  6693. _temponeel
  6694. ;
  6695. _tempel = $$("div", { "className": "U_MD_F_H_ZLZT" }, el);
  6696. _temponeel = $$("div", { "className": "U_MD_F_H_ZLZTS" }, _tempel);
  6697. $$("img", { "onerror": U.MD.C.imgError, "src": "/img/YSUN.png" }, _temponeel);
  6698. $$("div", { "className": "U_MD_F_H_ZLZTZ U_Img" }, _tempel);
  6699. $$("div", { "className": "U_MD_F_H_ZLZTX", "innerHTML": "暂时没有添加追随!!" }, _tempel);
  6700. }
  6701. //#endregion
  6702. //#region 好友功能
  6703. /**
  6704. * 打印空好友
  6705. *
  6706. * @param {string} 切换类型
  6707. * @param {element} 点钱点击的区域
  6708. * @param {element} 变化的样式
  6709. */
  6710. U.MD.F.switchFriendOrGroup = function (typename, el, classname) {
  6711. var i,
  6712. _chatform = U.selectEl("#U_MD_F_H_ZLZ")[0], //打印内容区域
  6713. _childsel = U.selectEl(el).parentElement(2).Child(), //所有参与切换的元素
  6714. _classarray = ["U_MD_F_H_ZLTT", "U_MD_F_H_ZLTO", "U_MD_F_H_ZLTS", "U_MD_F_H_ZLTF"]; //切换样式数组
  6715. //切换按钮的样式,把样式改成用户默认按钮的样式
  6716. for (i = 0; i < _childsel.length; i++) {
  6717. U.selectEl(_childsel[i]).Child()[0].className = _classarray[i] + " U_Img U_MD_F_H_ZLTOK";
  6718. }
  6719. //设置选中的按钮样式
  6720. el.className = classname + " U_Img U_MD_F_H_ZLTOK";
  6721. //点击好友添加按钮
  6722. if (typename == "A") {
  6723. U.MD.F.M.createFriendGroupPopup(); //调用创建群弹框
  6724. }
  6725. else {
  6726. //群成员
  6727. if (typename == "H") {
  6728. var _grouparr = US.friend.group; //获取用户或有群信息
  6729. _chatform.innerText = ""; //清空展示区域的内容
  6730. U.MD.F.printFriendOrGroup(_chatform, _grouparr); //打印
  6731. }
  6732. //最近联系人
  6733. else if (typename == "G") {
  6734. var _recentcontacts = US.friend.recentcontacts;
  6735. _chatform.innerText = ""; //清空展示区域的内容
  6736. U.MD.F.printFriendOrGroup(_chatform, _recentcontacts); //打印
  6737. }
  6738. //打印好友,由于好友有好友分组,所以不能直接调用U.MD.F.printFriendOrGroup输出
  6739. else {
  6740. U.MD.F.printFriendGroupOrFriend(_chatform); //打印
  6741. }
  6742. }
  6743. }
  6744. /**
  6745. * 获取群里头像集
  6746. *
  6747. * @param {object} 群信息
  6748. * @param {element} 添加指定的元素
  6749. * @param {element} 变化的样式
  6750. * @param {element} 最大长度
  6751. */
  6752. U.MD.F.printGroupHeadImage = function (groupinfo, el, num, size) {
  6753. var i, j,
  6754. _groupnameel,
  6755. _horizontal,
  6756. _vertical,
  6757. _imageel,
  6758. _groupuserinfo = U.Json.select(US.friend.groupusers, { "GroupManageID": groupinfo.GroupManageID }, (num || 9)); //获取当前群
  6759. if (_groupuserinfo.length < 3) {
  6760. _horizontal = _groupuserinfo.length;
  6761. }
  6762. else {
  6763. if (_groupuserinfo.length > 6) {
  6764. _horizontal = 3;
  6765. } else {
  6766. _horizontal = 2;
  6767. }
  6768. }
  6769. //每排几个
  6770. if (_groupuserinfo.length > 4) {
  6771. _vertical = 3
  6772. }
  6773. else {
  6774. if (_groupuserinfo.length > 1) {
  6775. _vertical = 2
  6776. } else {
  6777. _vertical = 1
  6778. }
  6779. } //一共多少行
  6780. size = size || [el.offsetHeight || 40, el.offsetWidth || 40]; //最大长宽
  6781. _groupnameel = $$("div", { "className": "U_MD_HomeSSZFZAIO", "title": groupinfo.GroupManageName }); //群名
  6782. //打印所有群成员头像 横排打印
  6783. for (i = 0; i < _horizontal; i++) {
  6784. _imageel = $$("div", { "style": { "width": "100%", "height": Math.floor(size[0] / _horizontal) + "px" } }, _groupnameel);
  6785. //竖排打印
  6786. for (j = i * _vertical; j < i * _vertical + _vertical && j < _groupuserinfo.length; j++) {
  6787. $$("img",
  6788. {
  6789. "onerror": U.MD.C.imgError,
  6790. "src": U.MD.C.getHeadImage(_groupuserinfo[j].UserThumbnailImageHead),
  6791. "style":
  6792. {
  6793. "width": Math.floor(size[1] / _vertical) + "px",
  6794. "height": Math.floor(size[0] / _vertical) + "px"
  6795. }
  6796. }, _imageel);
  6797. }
  6798. };
  6799. //追加
  6800. el.appendChild(_groupnameel);
  6801. }
  6802. //#endregion
  6803. ;
  6804. ///<jscompress sourcefile="FriendData.js" />
  6805. /*
  6806. 此处为数据对应库
  6807. US.friend 集合,里面包含了好友分组,好友,群,群成员,最近联系人。
  6808. US.friend.allclass 数组 是所有的好友分组,结构参见好友分组实体U.MD.F.T.friendGroupEntity
  6809. US.friend.friends 数组 是所有的好友,结构参见好友实体U.MD.F.T.friendEntity
  6810. US.friend.group 数组 是所有的群,结构参见群实体U.MD.F.T.groupEntity
  6811. US.friend.groupusers 数组 是所有的群好友,结构参见群成员实体U.MD.F.T.groupUserEntity
  6812. US.friend.recentcontacts 数组 是所有的在线好友,结构为U.MD.F.T.recentContactsEntity
  6813. 从数据库中取出的数据都要放到此全局变量中,当新建好友,新建分组等时,需要用下面的结构生成新的实体。
  6814. */
  6815. Namespace.register("U.MD.F.T"); //好友数据源操作命名空间
  6816. /**
  6817. * 好友实体
  6818. *
  6819. * @param {array} 好友信息
  6820. ----------[0] 好友签名
  6821. ----------[1] 好友用户id
  6822. ----------[2] 好友原图
  6823. ----------[3] 好友小图
  6824. ----------[4] 好友别名
  6825. ----------[5] 好友用户名
  6826. ----------[6] 好友id
  6827. ----------[7] 好友备注
  6828. ----------[8] 好友分组id
  6829. ----------[9] 是否在线
  6830. */
  6831. U.MD.F.T.friendEntity = function (signature, userid, userimagehead, thumbnailheadimage, nickname, name, friendid, descript, groupid, islogin) {
  6832. this.UserIndividualitysignature = signature;
  6833. this.UserId = userid;
  6834. this.UserImageHead = userimagehead;
  6835. this.UserThumbnailImageHead = thumbnailheadimage;
  6836. this.UserNickName = nickname;
  6837. this.UserName = name;
  6838. this.FriendsID = friendid;
  6839. this.FriendsDescript = descript;
  6840. this.FriendsGroupID = groupid;
  6841. this.IsLogin = islogin;
  6842. }
  6843. /**
  6844. * 最近联系人
  6845. *
  6846. * @param {array} 在线好友信息
  6847. ----------[0] 好友用户id
  6848. ----------[1] 好友用户名
  6849. ----------[2] 好友大图
  6850. ----------[3] 好友昵称
  6851. ----------[4] 好友小图
  6852. ----------[5] 最后聊天时间
  6853. ----------[6] 好友备注
  6854. ----------[7] 好友签名
  6855. ----------[8] 是否在线
  6856. */
  6857. U.MD.F.T.recentContactsEntity = function (userid, username, userimagehead, usernickname, userthumbnailimagehead, sendtime, descript, signature, islogin) {
  6858. this.UserId = userid;
  6859. this.UserName = username;
  6860. this.UserImageHead = userimagehead;
  6861. this.UserNickName = usernickname;
  6862. this.UserThumbnailImageHead = userthumbnailimagehead;
  6863. this.maxMessageSendTime = sendtime;
  6864. this.FriendsDescript = descript;
  6865. this.UserIndividualitysignature = signature;
  6866. this.IsLogin = islogin;
  6867. }
  6868. /**
  6869. * 好友分组实体
  6870. *
  6871. * @param {array} 好友分组信息
  6872. ----------[0] 分组描述
  6873. ----------[1] 分组分组id
  6874. ----------[2] 分组名
  6875. */
  6876. U.MD.F.T.friendGroupEntity = function (groupid, groupname, descript) {
  6877. this.FriendsGroupID = groupid;
  6878. this.FriendsGroupName = groupname;
  6879. this.FriendsGroupDescript = descript;
  6880. }
  6881. /**
  6882. * 群实体
  6883. *
  6884. * @param {array} 群信息
  6885. ----------[0] 群id
  6886. ----------[1] 群名
  6887. ----------[2] 群创建时间
  6888. ----------[3] 群创建用户id
  6889. ----------[4] 群管理用户id
  6890. ----------[5] 群描述
  6891. ----------[6] 群备注
  6892. */
  6893. U.MD.F.T.groupEntity = function (groupid, name, date, userid, descript, remark) {
  6894. this.GroupManageID = groupid;
  6895. this.GroupManageName = name;
  6896. this.GroupManageCreateDate = date;
  6897. this.GroupManageCreateUserID = userid;
  6898. this.GroupManageUserID = userid;
  6899. this.GroupManageDescript = descript;
  6900. this.GroupManageRemark = remark;
  6901. }
  6902. /**
  6903. * 群成员实体
  6904. *
  6905. * @param {array} 群信息
  6906. ----------[0] 群用户id
  6907. ----------[1] 群用户头像
  6908. ----------[2] 群用户昵称
  6909. ----------[3] 群用户名
  6910. ----------[4] 群用户小图
  6911. ----------[5] 群用户描述
  6912. ----------[6] 群id
  6913. ----------[6] 群用户登录信息
  6914. */
  6915. U.MD.F.T.groupUserEntity = function (userid, userimagehead, nickname, name, thumbnailimagehead, descript, groupid, islogin) {
  6916. this.UserId = userid;
  6917. this.UserImageHead = userimagehead;
  6918. this.UserNickName = nickname;
  6919. this.UserName = name;
  6920. this.UserThumbnailImageHead = thumbnailimagehead;
  6921. this.GroupUsersDescript = descript;
  6922. this.GroupManageID = groupid;
  6923. this.IsLogin = islogin;
  6924. }
  6925. /**
  6926. * 循环所有好友,让在线用户都置顶在最上面。
  6927. *
  6928. */
  6929. U.MD.F.T.initFriendInfo = function () {
  6930. var i,
  6931. j,
  6932. _arr = ["friends", "groupusers", "recentcontacts"],
  6933. _userinfo;
  6934. //循环US.friend变量,修改里面的好友、群好友、在线联系人的信息为默认信息,同事设置用户是否在线
  6935. for (i = 0; i < _arr.length; i++) {
  6936. //0 好友分组 1好友信息 2群分组 3群用户 4最近联系人 5在线好友 这里只修改有用户信息的 所以修改为1、3、4
  6937. // if (i == 1 && i == 3 && i == 4) {
  6938. for (j = 0; j < US.friend[_arr[i]].length; j++) {
  6939. _userinfo = US.friend[_arr[i]][j];
  6940. //判断用户是否在线,如果在线设置在线属性为在线
  6941. if (US.friend.onlinefirendinfo.indexOf(_userinfo.UserId) > -1) {
  6942. _userinfo.IsLogin = 1; //设置在线
  6943. }
  6944. //如果是好友信息的修改,由于从数据库里面选出来的数据有null值,所以这里把null过滤了
  6945. if (i != 1) {
  6946. U.Json.Change(_userinfo, {
  6947. "UserIndividualitysignature": _userinfo["UserIndividualitysignature"] || "",
  6948. "UserNickName": _userinfo.UserName,
  6949. "FriendsDescript": _userinfo["FriendsDescript"] || _userinfo.UserName
  6950. });
  6951. }
  6952. //如果是群好友信息的修改,由于从数据库里面选出来的数据有null值,所以这里把null过滤了
  6953. else {
  6954. U.Json.Change(_userinfo, {
  6955. "UserNickName": _userinfo.UserName,
  6956. "GroupUsersDescript": _UFE[j]["GroupUsersDescript"] || _userinfo.UserName
  6957. });
  6958. }
  6959. }
  6960. //除了最近联系人以外,其他的都要重新排序
  6961. if (i != "recentcontacts") {
  6962. U.Json.Reset(US.friend[_arr[i]], "IsLogin", 1); //设置完在线后,把在线用户发在最前面,这里是根据IsLogin = 1的排序
  6963. }
  6964. }
  6965. // }
  6966. }
  6967. ;
  6968. ///<jscompress sourcefile="FriendSearch.js" />
  6969. Namespace.register("U.MD.F.S");
  6970. U.MD.F.S.SearchPostion; //搜索的时候判断位置
  6971. //#region 本地好友搜索处理
  6972. /**
  6973. * 搜索好友
  6974. *
  6975. * @param {object} 用户信息
  6976. * @param {element} 打印显示的元素
  6977. * @param {object} 回调函数
  6978. * @param {object} 搜索的类型
  6979. * F 好友
  6980. * G 群
  6981. * "" 好友和群
  6982. */
  6983. U.MD.F.S.searchFriendsOrGroupForm = function (inputs, el, cb, typename) {
  6984. var _searchfriendinfo = [], //搜索好友的数组
  6985. _searchvalue = inputs.value, //获取搜索的内容
  6986. _isserch = U.MD.F.S.searchFriendsKeyboardHandle(el, inputs) //是否允许搜索
  6987. ;
  6988. //判断用户键盘输入的内容,是否需要进行搜索
  6989. if (_isserch) {
  6990. //获取搜索好友的值
  6991. if (!typename || typename == "F") {
  6992. _searchfriendinfo = _searchfriendinfo.concat(U.Json.like(US.friend.friends, { "FriendsDescript": _searchvalue, "UserNickName": _searchvalue, "UserName": _searchvalue })); //获取用户好友
  6993. }
  6994. //获取搜索群的值
  6995. if (!typename || typename == "G") {
  6996. _searchfriendinfo = _searchfriendinfo.concat(U.Json.like(US.friend.group, { "GroupManageName": _searchvalue })); //获取好友群
  6997. }
  6998. //显示清空
  6999. el.style.display = "block";
  7000. el.innerText = "";
  7001. //搜索好友的打印
  7002. U.MD.F.S.printSearchFriends(_searchfriendinfo, el, cb);
  7003. };
  7004. }
  7005. /**
  7006. * 搜索键盘的处理
  7007. *
  7008. * @param {object} 用户信息
  7009. */
  7010. U.MD.F.S.searchFriendsKeyboardHandle = function (el, inputs) {
  7011. var _keycode;
  7012. //获取键盘的值
  7013. if (event) {
  7014. _keycode = event.keyCode
  7015. }
  7016. else {
  7017. _keycode = 0
  7018. }
  7019. _childs = U.selectEl(el).Child(), //搜索的内容子元素
  7020. _searchvalue = inputs.value, //搜索的值
  7021. _position = U.MD.F.S.SearchPostion, //搜索的位置
  7022. _searchel = _childs[_position] //搜索得到的元素
  7023. ;
  7024. //判断搜索的值是否存在,不存在则隐藏
  7025. if (_searchvalue == "" || _searchvalue == inputs.defaultValue) {
  7026. el.style.display = "none";
  7027. }
  7028. //如果搜索的内容存在,同时用户执行了回车处理
  7029. else if (_position > -1 && _keycode == 13 || _keycode == 10 && _childs[_position].onmousedown) {
  7030. _childs[_position].onclick();
  7031. }
  7032. //如果不是上下键,那么允许用户继续搜索
  7033. else if (_keycode != 38 && _keycode != 40) {
  7034. U.MD.F.S.SearchPostion = -1; //搜索选择的位置设置为-1
  7035. return true;
  7036. }
  7037. return false;
  7038. }
  7039. /**
  7040. * 打印搜索好友
  7041. *
  7042. * @param {object} 用户信息
  7043. */
  7044. U.MD.F.S.printSearchFriends = function (friendinfo, el, cb) {
  7045. var i,
  7046. _name,
  7047. _tempel,
  7048. _temponeel,
  7049. _temptwoel,
  7050. _frag = $$("frag"),
  7051. _childs = U.selectEl(el).Child();
  7052. //没有搜索到好友的提示
  7053. if (!friendinfo[0]) {
  7054. $$("div", { "className": "U_MD_F_S_Local_NoData", "innerText": "很抱歉,没有找到您搜索的好友" }, el);
  7055. }
  7056. else {
  7057. //循环打印搜索的好友
  7058. for (i = 0; i < friendinfo.length; i++) {
  7059. (function (i) {
  7060. //搜索的名字
  7061. _name = friendinfo[i].GroupManageName || friendinfo[i].FriendsDescript || friendinfo[i].UserNickName || friendinfo[i].UserName;
  7062. //打印的样式
  7063. _tempel = $$("div", {
  7064. "title": "点击查看",
  7065. "className": "U_MD_F_S_Local_Result",
  7066. // "onclick": function () {
  7067. // U.MD.F.S.switchSearchFriendsOrGroup(el, i);
  7068. // },
  7069. "onclick": function () {
  7070. U.MD.F.W.popupFriendsForm(friendinfo[i]);
  7071. U.MD.F.S.hideSearchFriendsOrGroupForm(el);
  7072. }
  7073. }, _frag);
  7074. _temptwoel = $$("div", { "className": "U_MD_F_H_ZLZOCOI", "title": _name }, _tempel);
  7075. if (friendinfo[i].GroupManageID) {
  7076. U.MD.F.printGroupHeadImage(friendinfo[i], _temptwoel, 4, [35, 35]);
  7077. }
  7078. else {
  7079. $$("img", { "onerror": U.MD.C.imgError, "className": "U_MD_HomeSSZJDAO", "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead) }, _temptwoel);
  7080. }
  7081. $$("span", { "className": "U_MD_F_S_Local_UserName", "innerHTML": _name }, _tempel);
  7082. })(i);
  7083. }
  7084. el.appendChild(_frag);
  7085. }
  7086. U.MD.F.S.SearchPostion = -1; //搜索选择的位置设置为-1
  7087. return _childs;
  7088. }
  7089. /**
  7090. * 上下切换搜索的好友或者群
  7091. *
  7092. * @param {element} 切换元素
  7093. * @param {number} 当前所在的位置
  7094. */
  7095. U.MD.F.S.switchSearchFriendsOrGroup = function (el, switchposition) {
  7096. var _switchel,
  7097. _top,
  7098. _scrolltop,
  7099. _isswitch = null,
  7100. _keycode = event.keyCode, //键盘码
  7101. _childs = U.selectEl(el).Child(), //获取所有搜索的值
  7102. _postion = U.MD.F.S.SearchPostion, //当前选择好友或者去的位置
  7103. _index = switchposition || U.MD.F.S.SearchPostion,
  7104. _nowswitchel = _index > -1 ? _childs[switchposition || U.MD.F.S.SearchPostion] : null //之前聚焦显示的元素
  7105. ;
  7106. if (_keycode == 38) {
  7107. _isswitch = -1
  7108. }
  7109. else if (_keycode == 40) {
  7110. _isswitch = 1
  7111. }
  7112. //判断是否需要重新选择
  7113. if (_isswitch || (switchposition != null && switchposition != _postion)) {
  7114. //如果需要指定切换到那个位置
  7115. if (switchposition != null) {
  7116. U.MD.F.S.SearchPostion = switchposition;
  7117. }
  7118. //上下切换的处理
  7119. else {
  7120. U.MD.F.S.SearchPostion += _isswitch; //加上上下的处理 如果键盘向上则-1 向下+1
  7121. }
  7122. //如果位置大于最后一个,则位置设置为最后一个
  7123. if (U.MD.F.S.SearchPostion > _childs.length - 1) {
  7124. U.MD.F.S.SearchPostion = 0; //设置位置
  7125. }
  7126. else if (U.MD.F.S.SearchPostion < 0) {
  7127. U.MD.F.S.SearchPostion = _childs.length - 1;
  7128. }
  7129. switchposition = U.MD.F.S.SearchPostion;
  7130. _switchel = _childs[switchposition]; //判断选择好友或者群有没有元素
  7131. //选择的位置
  7132. if (_switchel) {
  7133. U.selectEl('.U_MD_F_S_Local_Result_Hover').removeClass('U_MD_F_S_Local_Result_Hover')
  7134. _switchel.className = "U_MD_F_S_Local_Result U_MD_F_S_Local_Result_Hover"; //取消上一个
  7135. //下面计算需要显示的元素是否在滚动条可见范围,如果不在,那么滚动滚动条设置
  7136. _top = _switchel.offsetTop;
  7137. _scrolltop = el.scrollTop;
  7138. if (_top > el.offsetHeight + _scrolltop - 40) {
  7139. el.scrollTop = _top - el.offsetHeight;
  7140. }
  7141. if (_top < el.scrollTop) {
  7142. el.scrollTop = _top; //滚动条的位置
  7143. }
  7144. }
  7145. }
  7146. }
  7147. /**
  7148. * 隐藏
  7149. *
  7150. * @param {element} 切换元素
  7151. */
  7152. U.MD.F.S.hideSearchFriendsOrGroupForm = function (el) {
  7153. el.style.display = "none";
  7154. U.selectEl(el).prev().Child()[0].value = "联系人、好友讨论组";
  7155. }
  7156. //#endregion
  7157. //#region 窗体搜索
  7158. /**
  7159. * 弹出群搜索
  7160. *
  7161. */
  7162. U.MD.F.S.popupsSearchGroups = function () {
  7163. //弹出群搜索的窗体
  7164. var _form = new U.UF.UI.form('<div class="U_MD_F_S_TO U_MD_F_S_TR">群文档搜索查看区域</div><div class="U_MD_F_S_TD" onmousedown="U.UF.EV.stopBubble();"><div class="U_MD_F_S_TDL"><input id="U_MD_F_S_GF_Search" value="群文档搜索" onblur="U.UF.MR.inputPlaceholder(this,\'\',\'群文档搜索\');" onfocus="U.UF.MR.inputPlaceholder(this,\'群文档搜索\',\'\');" placeholder="群文档搜索" onkeyup="if (event.keyCode == 13 || event.keyCode == 10) {$(this).parentElement(2).Child()[1].onclick();}" /></div><div id="U_MD_F_S_TDR_GF" class="U_MD_F_S_TDR">搜索</div></div>',
  7165. "<div class='U_MD_F_S_CX'></div><div class='U_MD_F_S_CD'></div>", { "onresize": U.MD.F.S.searchGroupsFormSize, "id": "U_MD_F_S", "style": { "width": "71.5%", "height": "70%" } }, null, { "style": { "padding": "10px 0" } });
  7166. var _formel = _form.form; //获取整个窗体
  7167. U.selectEl(_formel).find("input")[0].focus(); //窗体头部的输入框聚焦
  7168. U.selectEl('#U_MD_F_S_TDR_GF')[0].onclick = function () {
  7169. U.MD.F.S.searchAjax(1, 1, _formel.children[2].children[0], U.selectEl('#U_MD_F_S_GF_Search')[0])
  7170. }
  7171. U.MD.F.S.searchGroupsFormSize(_formel); //窗体的大小设置
  7172. U.MD.F.S.searchAjax($(_form.middle).Child()[1], 1, _formel.children[2].children[0], U.selectEl('#U_MD_F_S_GF_Search')[0]); //初始化数据
  7173. return _formel;
  7174. }
  7175. /**
  7176. * 弹出Ftp搜索
  7177. *
  7178. */
  7179. U.MD.F.S.popupsSearchFtp = function () {
  7180. var _form = new U.UF.UI.form('<div class="U_MD_F_S_TO U_MD_F_S_TR">FTP共享区域查看</div><div class="U_MD_F_S_TD" onmousedown="U.UF.EV.stopBubble();"><div class="U_MD_F_S_TDL"><input id="U_MD_F_S_FTP_Search" value="FTP搜索" onblur="U.UF.MR.inputPlaceholder(this,\'\',\'FTP搜索\');" onfocus="U.UF.MR.inputPlaceholder(this,\'FTP搜索\',\'\');" placeholder="FTP搜索" onkeyup="if (event.keyCode == 13 || event.keyCode == 10) {$(this).parentElement(2).Child()[1].onclick();}" /></div><div id="U_MD_F_S_TDR" class="U_MD_F_S_TDR">搜索</div></div>',
  7181. "<div class='U_MD_F_S_CX'></div><div class='U_MD_F_S_CD'></div>", { "onresize": U.MD.F.S.searchGroupsFormSize, "id": "U_MD_F_F", "style": { "width": "70%", "height": "70%" } }, null, { "style": { "padding": "10px 0" } });
  7182. var _formel = _form.form; //获取整个窗体
  7183. U.selectEl('#U_MD_F_S_TDR')[0].onclick = function () {
  7184. U.MD.F.S.searchAjax(1, 0, U.selectEl("#U_MD_F_F")[0].children[2].children[0], U.selectEl("#U_MD_F_S_FTP_Search")[0])
  7185. }
  7186. U.selectEl(_formel).find("input")[0].focus(); //窗体头部的输入框聚焦
  7187. U.MD.F.S.searchGroupsFormSize(_formel); //窗体的大小设置
  7188. U.MD.F.S.searchAjax($(_form.middle).Child()[1], 0, _formel.children[2].children[0], U.selectEl('#U_MD_F_S_FTP_Search')[0]); //初始化数据
  7189. return _formel;
  7190. }
  7191. /**
  7192. * 搜索内容大小变化
  7193. *
  7194. */
  7195. U.MD.F.S.searchGroupsFormSize = function (contentel) {
  7196. var _parentel = U.selectEl(contentel).Parent(3);
  7197. contentel.style.width = Math.floor(_parentel.offsetWidth / 225) * 225 + "px";
  7198. U.selectEl(contentel).Parent().style.height = _parentel.offsetHeight - 125 + "px";
  7199. }
  7200. /**
  7201. * 搜索开始
  7202. *
  7203. */
  7204. U.MD.F.S.searchAjax = function (page, isgroupserch, contentel, inputel) {
  7205. var _searchvalue = inputel.value == inputel.defaultValue ? "" : inputel.value;
  7206. //判断是否
  7207. if (_searchvalue != "") {
  7208. U.MD.F.S.searchGroupOrFriend(page, isgroupserch, contentel, inputel);
  7209. }
  7210. //热门查看
  7211. else {
  7212. U.MD.F.S.getHotFriendOrGroup(1, isgroupserch, contentel);
  7213. }
  7214. }
  7215. /**
  7216. * 搜索开始
  7217. *
  7218. */
  7219. U.MD.F.S.searchGroupOrFriend = function (page, isgroupserch, contentel, inputel) {
  7220. var _searchvalue = inputel.value == inputel.defaultValue ? "" : inputel.value, //输入的内容
  7221. _end = page * 80, //结束的位置
  7222. _start = _end - 79, //开始的位置
  7223. _loadingel = page > 1 ? U.selectEl(contentel).parentElement(2).Child()[2] : U.selectEl(contentel).parentElement()[0]
  7224. ;
  7225. //群搜索的ajax处理
  7226. if (isgroupserch) {
  7227. //后台搜索群
  7228. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchGroupInfo", _searchvalue, _start, _end],
  7229. U.MD.F.S.ajaxSearchAjax, [_loadingel, page, _searchvalue, contentel, isgroupserch]);
  7230. }
  7231. //ftp搜索的ajax处理
  7232. else {
  7233. //后台搜索好友的ftp
  7234. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchFriendInfo", US.userInfo.UserId || US.EMPTYGUID, _searchvalue, _start, _end],
  7235. U.MD.F.S.ajaxSearchAjax, [_loadingel, page, _searchvalue, contentel, isgroupserch]);
  7236. }
  7237. //滚动加载设置
  7238. U.UF.EV.scrollLoad($(contentel).Parent(), function () {
  7239. U.MD.F.S.searchAjax(page + 1, isgroupserch, contentel, inputel);
  7240. });
  7241. }
  7242. /**
  7243. * 获取热门的群或者好友
  7244. *
  7245. */
  7246. U.MD.F.S.getHotFriendOrGroup = function (page, isgroup, el) {
  7247. var i,
  7248. _loadingel = page > 1 ? U.selectEl(el).parentElement(2).Child()[2] : U.selectEl(el).parentElement()[0],
  7249. _end = page * 80,
  7250. _start = _end - 79
  7251. ;
  7252. //滚动加载设置
  7253. if (page == 1) {
  7254. //设置滚动加载函数
  7255. U.UF.EV.scrollLoad($(el).Parent(), function () {
  7256. U.MD.F.S.getHotFriendOrGroup(page + 1, isgroup, el); //加载热门好友和群
  7257. });
  7258. }
  7259. //群的加载处理
  7260. if (isgroup) {
  7261. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "RecommendGroups", _start, _end],
  7262. U.MD.F.S.asynGetHotFriendOrGroup, [_loadingel, el, isgroup]);
  7263. }
  7264. //好友ftp加载处理
  7265. else {
  7266. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFtpHotUser", _start, _end],
  7267. U.MD.F.S.asynGetHotFriendOrGroup, [_loadingel, el, isgroup]);
  7268. }
  7269. }
  7270. /**
  7271. * 热门群或者好友获取异步
  7272. *
  7273. */
  7274. U.MD.F.S.asynGetHotFriendOrGroup = function (r) {
  7275. var _context = r.context,
  7276. _el = _context[1], //打印区域的元素
  7277. _isgroup = _context[2]; //是否是群的处理
  7278. r = r.value;
  7279. //打印内容
  7280. U.MD.F.S.printSearchContent(r, _el, _isgroup);
  7281. //如果搜索的内容已经不足的时候,那么就取消滚动加载函数
  7282. if (r.length < 80) {
  7283. U.selectEl(_el).Parent().onscroll = null;
  7284. }
  7285. }
  7286. /**
  7287. * 搜索异步
  7288. *
  7289. */
  7290. U.MD.F.S.ajaxSearchAjax = function (r) {
  7291. //参数处理
  7292. var _context = r.context,
  7293. _page = _context[1], //页码
  7294. _searchvalue = _context[2], //搜索内容
  7295. _el = _context[3],
  7296. _isgroup = _context[4]; //是否是群搜索
  7297. r = r.value;
  7298. //如果是第一页
  7299. if (_page == 1) {
  7300. _el.innerHTML = ""; //清空之前的数据
  7301. //如果获取的值不存在,那么就直接打印搜索是否为空
  7302. if (!r || !r.length) {
  7303. U.MD.F.S.printNullSearch(_el); //打印空搜索
  7304. }
  7305. }
  7306. //如果搜索有内容,那么打印内容
  7307. if (r && r.length) {
  7308. U.MD.F.S.printSearchContent(r, _el, _isgroup); //打印搜索营部
  7309. }
  7310. }
  7311. /**
  7312. * 打印搜索内容
  7313. *
  7314. */
  7315. U.MD.F.S.printSearchContent = function (friendsinfo, el, isgroup) {
  7316. var i, _el, _tempel, _tempela, _tempelb, _tempelc, _arr,
  7317. _userid = US.userInfo.UserId || "",
  7318. _frag = $$("frag");
  7319. if (isgroup) {
  7320. _arr = ["GroupManageName", "+加群"];
  7321. }
  7322. else {
  7323. _arr = ["UserNickName", "+好友"];
  7324. }
  7325. //循环打印好友数据
  7326. for (i = 0; i < friendsinfo.length; i++) {
  7327. _el = $$("div", {
  7328. "className": "U_MD_F_S_Pop_Content_G U_MD_D_Radius_5",
  7329. "onclick": U.UF.C.closure(function (friendinfo) {
  7330. if (isgroup) {
  7331. }
  7332. else {
  7333. U.MD.D.I.openApplication("disk", { "userid": friendinfo.UserId, "directoryid": US.FTPFOLDERID });
  7334. }
  7335. }, [friendsinfo[i]])
  7336. }, _frag);
  7337. _tempel = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T" }, _el);
  7338. _tempela = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_L" }, _tempel);
  7339. $$("img", {
  7340. "onerror": U.MD.C.imgError,
  7341. "onerror": U.MD.C.imgError,
  7342. "src": isgroup ? "" : U.MD.C.getHeadImage(friendsinfo[i]["UserThumbnailImageHead"]),
  7343. "title": friendsinfo[i][_arr[0]],
  7344. "onclick": U.UF.C.closure(function (friendinfo) {
  7345. U.UF.EV.stopBubble();
  7346. //群处理
  7347. if (isgroup) {
  7348. }
  7349. //好友处理
  7350. else {
  7351. U.MD.U.V.ViewOtherUserInfo(friendinfo.UserId);
  7352. }
  7353. }, [friendsinfo[i]])
  7354. }, _tempela);
  7355. _tempelb = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R" }, _tempel);
  7356. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_T U_MD_D_Text_Abbreviation", "innerHTML": friendsinfo[i][_arr[0]] }, _tempelb);
  7357. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_C U_MD_D_Text_Abbreviation", "innerHTML": (isgroup ? "目前人数:" : "目前好友:") + (friendsinfo[i].FCount || 0) }, _tempelb);
  7358. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_B U_MD_D_Text_Abbreviation", "innerHTML": "ftp文件:" + (friendsinfo[i].DCount || 0) }, _tempelb);
  7359. _tempelc = $$("div", { "className": "U_MD_F_S_Pop_Content_G_B" }, _el);
  7360. $$("div", {
  7361. "className": "U_MD_F_S_Pop_Content_G_B_A U_MD_D_Radius_5", "innerHTML": _arr[1],
  7362. "onclick": U.UF.C.closure(function (friendinfo) {
  7363. U.UF.EV.stopBubble();
  7364. //群的处理
  7365. if (isgroup) { U.MD.F.J.addUsersToGroup(friendinfo); }
  7366. //好友的处理
  7367. else { U.MD.F.M.addFriend(friendinfo); }
  7368. }, [friendsinfo[i]])
  7369. }, _tempelc);
  7370. }
  7371. el.appendChild(_frag);
  7372. }
  7373. /**
  7374. * 空查询
  7375. *
  7376. */
  7377. U.MD.F.S.printNullSearch = function (el) {
  7378. $$("div", { "className": "U_MD_F_S_CXT", "innerHTML": "暂无搜索消息, 请稍候搜索。" }, el);
  7379. }
  7380. //#endregion
  7381. //#region 新搜索
  7382. /**
  7383. * 搜索好友
  7384. *
  7385. * @param {object} 用户信息
  7386. * @param {element} 打印显示的元素
  7387. * @param {object} 回调函数
  7388. * @param {object} 搜索的类型
  7389. * @param {number} defaultindex 0好友 1群组 2ftp
  7390. */
  7391. U.MD.F.S.popSearchFriendsOrGroupForm = function (defaultindex) {
  7392. var _searchel = U.selectEl("#U_MD_F_S_Pop")[0],
  7393. _contentel = U.selectEl($(_searchel).Child()[1]).Child()[0],
  7394. _inputel = U.selectEl("input", _searchel)[0]
  7395. ;
  7396. _searchel.style.display = "block";
  7397. //弹出群搜索的窗体
  7398. var _form = new U.UF.UI.form("查找好友/群",
  7399. _searchel,
  7400. {
  7401. "onresize": function () { U.MD.F.S.searchGroupsFormSize(_contentel); },
  7402. "id": "U_MD_F_S",
  7403. "style": {
  7404. "width": "70%",
  7405. "height": "70%"
  7406. }
  7407. }, null);
  7408. var _formel = _form.form; //获取整个窗体
  7409. _inputel.focus(); //窗体头部的输入框聚焦
  7410. U.MD.F.S.searchGroupsFormSize(_contentel); //窗体的大小设置
  7411. U.MD.F.S.searchFriendsOrGroupFormClick($("span", _searchel)[defaultindex]); //默认选择查找用户
  7412. return _formel;
  7413. }
  7414. /**
  7415. * 搜索好友
  7416. *
  7417. * @param {object} 用户信息
  7418. */
  7419. U.MD.F.S.clickSearch = function (el) {
  7420. var i,
  7421. _changeel,
  7422. _topel = U.selectEl(el).Parent(2),
  7423. _childel = U.selectEl($(_topel).Child()[0]).Child();
  7424. ;
  7425. for (i = 0; i < _childel.length; i++) {
  7426. _changeel = U.selectEl(_childel[i]).Child()[0];
  7427. if (_changeel.className == "U_MD_F_S_Pop_Head_Nav_fonto") {
  7428. U.MD.F.S.searchFriendsOrGroupFormClick(_changeel);
  7429. return;
  7430. }
  7431. }
  7432. }
  7433. /**
  7434. * 搜索好友
  7435. *
  7436. * @param {object} 用户信息
  7437. */
  7438. U.MD.F.S.searchFriendsOrGroupFormClick = function (el) {
  7439. var i, j,
  7440. _changeel,
  7441. _parentel = U.selectEl(el).Parent(2),
  7442. _childel = U.selectEl(_parentel).Child(),
  7443. _topel = U.selectEl(_parentel).Parent(2),
  7444. _contentel = U.selectEl($(_topel).Child()[1]).Child()[0],
  7445. _inputel = U.selectEl("input", _topel)[0]
  7446. ;
  7447. //循环处理样式
  7448. for (i = 0; i < _childel.length; i++) {
  7449. _changeel = U.selectEl(_childel[i]).Child()[0];
  7450. //如果是点击的对象
  7451. if (_changeel == el) {
  7452. el.className = "U_MD_F_S_Pop_Head_Nav_fonto";
  7453. j = i;
  7454. }
  7455. //点击的对象
  7456. else {
  7457. _changeel.className = "";
  7458. }
  7459. }
  7460. _contentel.innerText = "";
  7461. U.MD.F.S.searchAjax(1, j == 1, _contentel, _inputel); //初始化数据
  7462. }
  7463. //#endregion;
  7464. ///<jscompress sourcefile="FriendWindow.js" />
  7465. /*
  7466. 好友初始化区域 此文件为好友窗体使用初始化窗体
  7467. */
  7468. Namespace.register("U.MD.F.W"); //好友和群窗口区域命名空间
  7469. //#region 好友聊天
  7470. /**
  7471. * 弹出好友窗体处理
  7472. *
  7473. * @param {object} 群信息
  7474. */
  7475. U.MD.F.W.viewFriend = U.MD.F.W.SLHCK = function (friendinfo) {
  7476. //使用好友系统必须登录
  7477. if (!(U.MD.U.L.isLogin())) {
  7478. var _childs, //所有的好友元素
  7479. _friendel; //好友的信息元素
  7480. //如果有传入好友的信息,则查看指定的好友的信息,否则弹出默认的好友窗体
  7481. if (friendinfo) {
  7482. //如果用户是和自己聊天,那么直接提示不允许,否则弹出好友聊天框
  7483. if (friendinfo.UserId == US.userInfo.UserId) {
  7484. U.alert("无法与本人聊天!");
  7485. }
  7486. else {
  7487. //获取制定好友的点击元素
  7488. _friendel = U.selectEl("#U_MD_F_H_RCO").find("[tid='" + friendinfo.UserId + "']")[0];
  7489. //如果查看的好友在好友列表里
  7490. if (_friendel) {
  7491. _friendel.onclick();
  7492. }
  7493. //弹出好有窗体
  7494. else {
  7495. U.MD.F.W.popupFriendsForm(friendinfo);
  7496. }
  7497. }
  7498. }
  7499. //弹出默认的好友窗体
  7500. else {
  7501. _childs = U.selectEl("#U_MD_F_H_RCO").Child(); //右侧栏
  7502. friendinfo = (US.friend.recentcontacts[0] || US.friend.friends[0]); //最近联系人、 我的好友列表
  7503. //如果有显示的好友,则弹出第一个好友聊天
  7504. if (_childs.length) {
  7505. _childs[0].onclick();
  7506. }
  7507. //查看好友
  7508. else {
  7509. //这里判断如果弹出的是群聊天框,则选择群信息,需要修改
  7510. if (friendinfo && friendinfo.tf) {
  7511. friendinfo = U.Json.select(US.friend.group, { "GroupManageID": friendinfo.UserId })[0];
  7512. }
  7513. U.selectEl("#U_MD_F_H_ZRO").remove(); //清除推荐元素
  7514. //弹出好友信息
  7515. U.MD.F.W.popupFriendsForm(friendinfo);
  7516. //如果用户没有好友和群,那么则直接弹出推荐好友
  7517. if (!friendinfo || (!friendinfo.UserId && !friendinfo.GroupManageID)) {
  7518. U.MD.F.W.recommendFriend($("#U_MD_F_H_ZR")[0], 0);
  7519. }
  7520. }
  7521. }
  7522. }
  7523. }
  7524. //#region 空好友提示
  7525. ///**
  7526. //* 空好友的提示
  7527. //*
  7528. //*/
  7529. //U.MD.F.W.recommendFriend = function () {
  7530. // U.MD.F.W.printRecommendFriend(US.userInfo.TJF.slice(0, 8), U.selectEl("#U_MD_F_H_ZR")[0], 1); //推荐好友提示
  7531. // U.MD.F.W.friendDisplayAndNone([{ "display": "block" }, { "display": "none"}], true); //弹出好友窗体,隐藏右边好友栏
  7532. //}
  7533. /**
  7534. * 空用户的提示
  7535. *
  7536. */
  7537. U.MD.F.W.printRecommendFriend = function (friendinfo, el, page) {
  7538. //变量定义
  7539. var _tempel, //临时元素变量
  7540. _temponeel, //临时元素变量
  7541. _temptwoel, //临时元素变量
  7542. _tempthreeel, //临时元素变量
  7543. _tempfourel, //临时元素变量
  7544. _tempfiveel //临时元素变量
  7545. ;
  7546. //清空内容
  7547. el.innerText = "";
  7548. //创建显示
  7549. _tempel = $$("div", { "className": "U_MD_F_H_ZRO", "id": "U_MD_F_H_ZRO", "onmousedown": U.UF.EV.stopBubble });
  7550. _temponeel = $$("div", { "className": "U_MD_F_H_ZROS" }, _tempel);
  7551. $$("div", { "className": "U_MD_F_H_ZROSS", "innerHTML": "这里暂时没有任何内容哦" }, _temponeel);
  7552. $$("div", { "className": "U_MD_F_H_ZROSZ", "innerHTML": "Nothing!!" }, _temponeel);
  7553. _temptwoel = $$("div", { "className": "U_MD_F_H_ZROSX" }, _temponeel);
  7554. $$("div", { "className": "U_MD_F_H_ZROSXL", "innerHTML": "可尝试点击左边的头像,或追随一下的用户!" }, _temptwoel);
  7555. $$("div", { "className": "U_MD_F_H_ZROSXR U_Img" }, _temptwoel);
  7556. _temponeel = $$("div", { "className": "U_MD_F_H_ZROX" }, _tempel);
  7557. _temptwoel = $$("div", { "className": "U_MD_F_H_ZROXT" }, _temponeel);
  7558. $$("div", { "className": "U_MD_HomeSXLTTO U_MD_HomeSXROHTO", "innerHTML": "推荐追随" }, _temptwoel);
  7559. $$("div",
  7560. {
  7561. "className": "U_MD_HomeSXLTTI U_Img",
  7562. "onclick": function () {
  7563. U.MD.F.W.recommendFriend(el, page);
  7564. }
  7565. }, _temptwoel);
  7566. _temptwoel = $$("div", { "className": "U_MD_F_H_ZROXX" }, _temponeel);
  7567. //推荐好友循环打印区域
  7568. for (i = 0; i < friendinfo.length; i++) {
  7569. _tempthreeel = $$("div", { "className": "U_MD_F_H_ZROXXO", "style": { "marginLeft": "65px" } }, _temptwoel);
  7570. _tempfourel = $$("div", { "className": "U_MD_F_H_ZROXXOS" }, _tempthreeel);
  7571. _tempfiveel = $$("div", { "className": "U_MD_F_H_ZROXXOSL" }, _tempfourel);
  7572. $$("img",
  7573. {
  7574. "onerror": U.MD.C.imgError,
  7575. "title": "点击查看",
  7576. "onclick": function () {
  7577. U.UF.EV.stopBubble();
  7578. U.MD.U.V.ViewOtherUserInfo(friendinfo[i].UserId);
  7579. },
  7580. "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead),
  7581. "alt": friendinfo[i].UserName
  7582. },
  7583. _tempfiveel);
  7584. $$("div", { "className": "U_MD_F_H_ZROXXOSN U_MD_D_Text_Abbreviation", "innerHTML": friendinfo[i].UserName }, _tempfourel);
  7585. $$("div",
  7586. {
  7587. "className": "U_MD_F_H_ZROXXOSR",
  7588. "title": "点击追随该用户",
  7589. "innerHTML": "追随",
  7590. "onclick": function () {
  7591. U.MD.F.M.addFriend(friendinfo[i]);
  7592. }
  7593. },
  7594. _tempfourel);
  7595. _tempfourel = $$("div", { "className": "U_MD_F_H_ZROXXOX U_MD_HomeSXZLLZOOX" }, _tempthreeel);
  7596. $$("div", { "className": "U_MD_F_W_S", "innerHTML": "▲" }, _tempfourel);
  7597. $$("div", {
  7598. "className": "U_MD_F_W_X",
  7599. "innerHTML": friendinfo[i].UserIndividualitysignature ? friendinfo[i].UserIndividualitysignature.substring(0, 15).trim() : ("添加我为好友吧,分享我们的信息,让我们距离更近一步").trim()
  7600. }, _tempfourel);
  7601. }
  7602. //添加内容
  7603. el.appendChild(_tempel);
  7604. }
  7605. //好友推荐变化
  7606. U.MD.F.W.recommendFriend = function (el, page) {
  7607. var _userinfo = US.userInfo, //登录用户资料
  7608. _start = page * 30, //分页的开始
  7609. _end = (page + 1) * 30, //分页的结束
  7610. _recommendfriend = US.friend.commonfriend.slice(_start, _end) //分页获取推荐的用户
  7611. ;
  7612. //获取的用户存在则打印
  7613. if (_recommendfriend.length) {
  7614. U.MD.F.W.printRecommendFriend(_recommendfriend, el, page + 1);
  7615. }
  7616. //否则去数据库取数
  7617. else {
  7618. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "RecommendFriends", _userinfo.UserId || US.EMPTYGUID, _userinfo.length, _userinfo.length + 4], U.MD.F.W.asynRecommendFriend, [el, el, page]);
  7619. }
  7620. }
  7621. //获取推荐好友
  7622. U.MD.F.W.asynRecommendFriend = function (r) {
  7623. var _userinfo = US.userInfo, //登录用户资料
  7624. _context = r.context, //回调的参数
  7625. _el = _context[1], //输出的内容区域
  7626. _page = _context[2] //输出的号码
  7627. ;
  7628. r = r.value; //获取推荐用户的返回值
  7629. _userinfo = US.friend.commonfriend.concat(r); //获取的推荐用户存储到用户推荐用户信息里
  7630. U.MD.F.W.printRecommendFriend(r, _el, _page + 1); //打印推荐好友
  7631. }
  7632. //#endregion
  7633. //#region
  7634. /**
  7635. * 好友聊天器里查看好友聊天
  7636. *
  7637. * @param {object} 群信息
  7638. */
  7639. U.MD.F.W.popupFriendsForm = function (friendinfo, el) {
  7640. //登录的用户才能弹出窗体
  7641. var _close;
  7642. if (!U.MD.U.L.isLogin()) {
  7643. var _friendform = U.selectEl("#U_MD_F_H_ZA")[0];
  7644. //判断窗体是否创建如果创建直接显示,如果没有则创建
  7645. if (!_friendform) {
  7646. U.selectEl("#U_MD_F_H_Z")[0].style.display = "block";
  7647. //创建窗体弹出窗体
  7648. var _window = new U.UF.UI.form("<div class='U_MD_F_S_TI'>聊天对话</div>", U.selectEl("#U_MD_F_H_Z")[0],
  7649. {
  7650. "onresize": U.MD.F.W.reSize,
  7651. "id": "U_MD_F_H_ZA",
  7652. "style": {
  7653. "display": "block",
  7654. "height": "80%",
  7655. "min-width": '882px'
  7656. }
  7657. },
  7658. {
  7659. isstretching: false,
  7660. isnarrow: false,
  7661. closecallback: function () {
  7662. U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block" }], { "left": "auto", "right": "0px" });
  7663. }
  7664. });
  7665. }
  7666. //指定元素
  7667. else {
  7668. U.UF.F.topWindow($("#U_MD_F_H_ZA")[0]);
  7669. }
  7670. if (friendinfo) {
  7671. U.MD.F.W.openFriendChat(friendinfo); //打开指定的好友聊天显示
  7672. U.MD.F.N.canelMarkMessage(friendinfo); //消除标记信息
  7673. U.MD.F.W.addChecked(friendinfo);
  7674. U.MD.F.W.reSize(); //好友聊天区域大小初始化
  7675. }
  7676. }
  7677. }
  7678. /**
  7679. * 根据群切换到好友或者群面板
  7680. *
  7681. * @param {object} 好友获取群信息
  7682. */
  7683. U.MD.F.W.switchFileOrGroup = function (friendinfo) {
  7684. var infotid = (friendinfo.UserId == null) ? friendinfo.GroupManageID : friendinfo.UserId;
  7685. if (infotid == friendinfo.UserId) {
  7686. U.selectEl($("#U_MD_F_H_ZLTA").Child()[1]).Child()[0].onclick();
  7687. }
  7688. else if (infotid == friendinfo.GroupManageID) {
  7689. U.selectEl($("#U_MD_F_H_ZLTA").Child()[2]).Child()[0].onclick();
  7690. }
  7691. }
  7692. /**
  7693. * 初始化好友聊天区域
  7694. *
  7695. * @param {object} 群信息
  7696. */
  7697. U.MD.F.W.openFriendChat = function (friendinfo) {
  7698. var _friendfromel = U.selectEl("#U_MD_F_H_ZR")[0], //整个好友窗体元素
  7699. _friendchatfrom = U.selectEl("#U_MD_F")[0], //好友聊天区域元素
  7700. _userid = friendinfo.GroupManageID || friendinfo.UserId, //打开群或者好友的窗体
  7701. _chatform = U.MD.F.W.isCreateForm(_userid), //判断窗体是否已经打开创建
  7702. _isgroup = friendinfo.GroupManageID != null
  7703. ;
  7704. _friendchatfrom.style.display = "block"; //默认是隐藏,这些显示
  7705. _friendfromel.appendChild(_friendchatfrom); //追加聊天区域
  7706. //如果好友聊天框不存在,则创建好友聊天框
  7707. if (!_chatform) {
  7708. _chatform = U.MD.F.W.createFriendChat(friendinfo);
  7709. }
  7710. //选择到指定的窗体
  7711. U.MD.F.W.switchFriendsChat(_chatform, friendinfo);
  7712. //好友聊天查看
  7713. U.MD.F.H.getFriendOrGroupNews(_userid, function (r) {
  7714. U.MD.F.N.asynReceiveMessages(_isgroup, _chatform[1], r.value);
  7715. }, _isgroup);
  7716. }
  7717. //大小变化处理
  7718. U.MD.F.W.reSize = function () {
  7719. U.MD.F.W.leftSize(); //左边的处理
  7720. if ($("#U_MD_F_H_ZA")[0]) {
  7721. U.MD.F.W.chatBoxSize($("#U_MD_F_H_ZA")[0], U.MD.F.W.switchFriendsChat.Ele || U.selectEl("#U_MD_F")[0].childs[0].element[1]); //右边聊天框处理
  7722. }
  7723. }
  7724. /**
  7725. * 好友聊天左边聊天框显示,主要是好友显示的区域的大小加上上面的导航等于整个左边的高
  7726. *
  7727. */
  7728. U.MD.F.W.leftSize = function () {
  7729. //获取容器DIV
  7730. var _content = U.selectEl("#U_MD_F_H_ZA")[0];
  7731. if (_content) {
  7732. //得到高度
  7733. var _height = _content.offsetHeight,
  7734. _childs = U.selectEl(".U_MD_F_H_ZL").Child(); //获取下面的所有的孩子节点
  7735. //设置下面的高度等于整个高度-导航的高度
  7736. U.selectEl("#U_MD_F_H_ZLZ")[0].style.height = _height - _childs[0].offsetHeight - _childs[1].offsetHeight - 30 + "px";
  7737. }
  7738. }
  7739. //调整好友聊天框
  7740. U.MD.F.W.chatBoxSize = function (el, chatel) {
  7741. var i, //用于循环
  7742. _childs, //0 聊天区域 1聊天记录区域
  7743. _rightchilds = U.selectEl(chatel).Child(), //获取整个右边好友聊天区域的子元素
  7744. _chatchilds = U.selectEl(chatel.parentNode).Child(), //获取聊天区域的子元素
  7745. _height = el.offsetHeight, //右边的高
  7746. _width = chatel.offsetWidth; //右边的长
  7747. //循环设置
  7748. for (i = 0; i < _chatchilds.length; i++) {
  7749. //聊天记录和聊天框的大小设置
  7750. _childs = U.selectEl(_chatchilds[i]).Child();
  7751. _childs[0].style.width = _width - _childs[1].offsetWidth - 1 + "px";
  7752. _childs[1].style.height = _height - 90 + "px";
  7753. //聊天框的大小设置
  7754. U.selectEl(".U_MD_F_CA", _chatchilds[i]).css("height", _height - 380 + "px");
  7755. }
  7756. }
  7757. /**
  7758. * 设置好友窗体打开和关闭的状态
  7759. *
  7760. * @param {array} 显示隐藏的集合
  7761. */
  7762. U.MD.F.W.friendDisplayAndNone = function (style) {
  7763. var _friendform = U.selectEl("#U_MD_F_H_ZA"), //好友窗体
  7764. _friendright = U.selectEl("#U_MD_F_H_R"); //好友右侧
  7765. _friendform.addAttrArray({ "style": style[0] }); //给窗体设置参入的css值
  7766. _friendright.addAttrArray({ "style": style[1] }); //给窗体设置参入的css值
  7767. }
  7768. //#endregion
  7769. //判断是否需要创建
  7770. /**
  7771. * 根据friendid判断好友窗体是否创建
  7772. *
  7773. * @param {object} 群信息
  7774. */
  7775. U.MD.F.W.isCreateForm = function (friendid) {
  7776. var i, //用于循环处理
  7777. _friendchatform = U.selectEl("#U_MD_F")[0]; //好友聊天框
  7778. if (_friendchatform.childs) { //判断是否打开了聊天
  7779. for (i = 0; i < _friendchatform.childs.length; i++) { //循环所有打开的聊天找到已经和friendid对应打开的好友聊天
  7780. if (_friendchatform.childs[i].formid == friendid) { //如果找到匹配的好友聊天框或者群聊天框,则直接返回
  7781. return _friendchatform.childs[i].element;
  7782. }
  7783. }
  7784. }
  7785. }
  7786. /**
  7787. * 生成统一的好友窗体区域
  7788. *
  7789. * @param {object} 好友或群信息
  7790. */
  7791. U.MD.F.W.createFriendChat = function (friendandgroupinfo) {
  7792. //变量定义
  7793. var _headel,
  7794. _headimageel,
  7795. _chatel,
  7796. _chatleftel,
  7797. _chatheadel,
  7798. _chatheadimageel,
  7799. _chatheadcontentel,
  7800. _chatheadpromptel,
  7801. _chatcontentel,
  7802. _chatcontentnewsel,
  7803. _chatnewsel,
  7804. _chatnewsoneel,
  7805. _chatnewstwoel,
  7806. _chateditel,
  7807. _chatbuttonel,
  7808. _chatbuttonsendel,
  7809. _chatrecordel,
  7810. _buttondiv,
  7811. _userid,
  7812. _name,
  7813. descript,
  7814. _chatformel,
  7815. _chatformchilds,
  7816. _navichilds;
  7817. //群id获取好友id,作为窗体的唯一识别id
  7818. _userid = friendandgroupinfo.GroupManageID ||
  7819. friendandgroupinfo.UserId;
  7820. //显示在聊天框的名字,群名、好友描述、好友名字
  7821. _name = friendandgroupinfo.GroupManageName ||
  7822. friendandgroupinfo.FriendsDescript ||
  7823. friendandgroupinfo.UserNickName;
  7824. //群描述、好友签名
  7825. descript = friendandgroupinfo.GroupManageDescript ||
  7826. friendandgroupinfo.UserIndividualitysignature ||
  7827. "暂时没有填写介绍..";
  7828. //聊天框元素
  7829. _chatformel = U.selectEl("#U_MD_F")[0];
  7830. //聊天区域的还在元素
  7831. _chatformchilds = U.selectEl(_chatformel).Child();
  7832. //头部切换导航区域的元素
  7833. _navichilds = U.selectEl(_chatformchilds[0]).Child();
  7834. //头部标签
  7835. _headel = $$("div", {
  7836. "className": "U_MD_F_TO",
  7837. "onmousedown": U.UF.EV.stopBubble
  7838. }, _navichilds[0], _navichilds[0].firstChild);
  7839. _headimageel = $$("div", { "className": "U_MD_F_TOI" }, _headel);
  7840. U.selectEl(_headel).attr("user", _userid);
  7841. //好友显示头像
  7842. if (friendandgroupinfo.UserId) {
  7843. $$("img", {
  7844. "onerror": U.MD.C.imgError,
  7845. "onerror": U.MD.C.imgError,
  7846. "title": "点击查看",
  7847. "src": U.MD.C.getHeadImage(friendandgroupinfo.UserThumbnailImageHead),
  7848. "alt": friendandgroupinfo.UserNickName
  7849. }, _headimageel);
  7850. }
  7851. //群显示头像
  7852. else {
  7853. U.MD.F.printGroupHeadImage(friendandgroupinfo, _headimageel, 4, [25, 25]);
  7854. }
  7855. $$("div", { "className": "U_MD_F_TON U_MD_D_Text_Abbreviation", "innerHTML": _name }, _headel);
  7856. $$("div", {
  7857. "className": "U_MD_F_TOC U_Img",
  7858. "onclick": function () {
  7859. U.MD.F.W.delteFriendChat(_userid, _chatformel, friendandgroupinfo);
  7860. }
  7861. }, _headel);
  7862. //聊天区
  7863. _chatel = $$("div", { "className": "U_MD_F_NA" });
  7864. _chatformchilds[1].insertBefore(_chatel, _chatformchilds[1].firstChild);
  7865. //左侧
  7866. _chatleftel = $$("div", { "className": "U_MD_F_N" }, _chatel);
  7867. //头部信息
  7868. _chatheadel = $$("div", { "className": "U_MD_F_H" }, _chatleftel);
  7869. _chatheadimageel = $$("div", { "className": "U_MD_F_HH" }, _chatheadel);
  7870. if (friendandgroupinfo.GroupManageID) {
  7871. U.MD.F.printGroupHeadImage(friendandgroupinfo, _chatheadimageel);
  7872. U.selectEl(_chatheadimageel).addAttrArray({ onclick: function () { U.MD.F.J.groupInfoForm(friendandgroupinfo, _chatleftel); }, title: friendandgroupinfo["GroupManageName"] });
  7873. }
  7874. else {
  7875. $$("img", {
  7876. "onerror": U.MD.C.imgError,
  7877. "onerror": U.MD.C.imgError,
  7878. "title": "点击查看",
  7879. "onclick": function () {
  7880. U.UF.EV.stopBubble();
  7881. if (U.MD.D.IsUseStudio) {
  7882. U.MD.U.V.ViewOtherUserInfo(_userid);
  7883. }
  7884. },
  7885. "src": U.MD.C.getHeadImage(friendandgroupinfo.UserThumbnailImageHead),
  7886. "alt": friendandgroupinfo.UserNickName
  7887. }, _chatheadimageel);
  7888. }
  7889. _chatheadcontentel = $$("div", { "className": "U_MD_F_HT U_MD_D_Text_Abbreviation" }, _chatheadel);
  7890. $$("div", { "className": "U_MD_F_HTN", "innerHTML": _name }, _chatheadcontentel);
  7891. $$("div", { "className": "U_MD_F_HTC", "innerHTML": (friendandgroupinfo.GroupManageDescript || friendandgroupinfo.UserIndividualitysignature || "暂时没有填写介绍..") }, _chatheadcontentel);
  7892. _chatheadpromptel = $$("div", { "className": "U_MD_F_HG" }, _chatleftel);
  7893. $$("div", { "className": "U_MD_F_GI U_Img" }, _chatheadpromptel);
  7894. $$("div", { "className": "U_MD_F_GC", "innerHTML": "交谈中请勿轻信汇款、中奖信息、陌生电话..." }, _chatheadpromptel);
  7895. $$("div", {
  7896. "style": {
  7897. "width": "10px",
  7898. "height": "10px",
  7899. "background-image": "url('/img/YS2017.png')",
  7900. "display": "inline-block",
  7901. "background-repeat": "no-repeat",
  7902. "background-position": "-817px -482px",
  7903. "float": "right",
  7904. "margin": "8px"
  7905. },
  7906. "onclick": function () { _chatheadpromptel.style.visibility = "hidden"; }
  7907. }, _chatheadpromptel);
  7908. //内容发布区
  7909. _chatcontentel = $$("div", { "className": "U_MD_F_CA" }, _chatleftel);
  7910. _chatcontentnewsel = $$("div", { "className": "U_MD_F_C" }, _chatcontentel);
  7911. //发布内容区域
  7912. _chatnewsel = $$("div", { "className": "U_MD_F_D", "style": { "position": "relative" } }, _chatleftel);
  7913. _chatnewsoneel = $$("div", { "className": "U_MD_F_DA" }, _chatnewsel);
  7914. _chatnewstwoel = $$("div", { "className": "U_MD_F_DT" }, _chatnewsoneel);
  7915. _chateditel = $$("div", { "className": "U_MD_F_DC", "contentEditable": "true" }, _chatnewsoneel);
  7916. $$("div", { "className": "U_MD_F_DJ U_Img" }, _chatnewsoneel);
  7917. // 按钮区域
  7918. _chatface = $$("div", { "style": { "margin-top": "-194px", "margin-left": "14px" } }, _chatformel);
  7919. _chatbuttonel = $$("div", { "className": "U_MD_F_X" }, _chatleftel);
  7920. _chatbuttonsendel = $$("div", {
  7921. "className": "U_MD_F_XE",
  7922. "innerHTML": "发送(Ctrl+Enter)",
  7923. "style": {
  7924. "marginRight": "15px"
  7925. },
  7926. "onclick": function () {
  7927. U.MD.F.H.sendFriendOrGroupChatMessage(friendandgroupinfo, _chateditel, _chatcontentnewsel, (friendandgroupinfo.UserId == null));
  7928. }
  7929. }, _chatbuttonel);
  7930. $$("div", {
  7931. "className": "U_MD_F_XC",
  7932. "innerHTML": "关闭(n)",
  7933. "onclick": function () {
  7934. U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block" }], { "left": "auto", "right": "0px" });
  7935. }
  7936. }, _chatbuttonel);
  7937. //右侧聊天记录
  7938. _chatrecordel = $$("div", { "className": "U_MD_F_L" }, _chatel);
  7939. $$("div", { "className": "U_MD_F_LA" }, _chatrecordel);
  7940. $$("div", { "className": "U_MD_F_LB" }, _chatrecordel);
  7941. //事件赋值
  7942. _buttondiv = $$("div", {
  7943. "className": "U_MD_F_DTF U_MD_F_W_Face",
  7944. "title": "发送表情",
  7945. "style": {
  7946. "margin": "0",
  7947. "position": "relative",
  7948. "background": "url(/img/face.png) no-repeat 0",
  7949. "background-size": "20px"
  7950. }
  7951. }, _chatnewstwoel);
  7952. $$("button", {
  7953. "style": {
  7954. "opacity": "0",
  7955. "width": "28px",
  7956. "height": "28px"
  7957. },
  7958. "onmousedown": function () {
  7959. U.MD.UI.face(_chatface, _chateditel);
  7960. },
  7961. "onclick": U.UF.EV.stopBubble
  7962. }, _buttondiv);
  7963. _chatheadimageel = $$("div", {
  7964. "className": "U_MD_F_UploadPng U_Img",
  7965. "title": "添加文件",
  7966. "style": { "cssText": "margin-left:5px" },
  7967. "onclick": function (e) {
  7968. if ($(".U_MD_F_UploadInput")[0]) {
  7969. //删除弹出框
  7970. U.selectEl(".U_MD_F_UploadInput")[0].remove();
  7971. return;
  7972. }
  7973. var _firendinfo = friendandgroupinfo;
  7974. var _div = $$("div", { "className": "U_MD_F_UploadInput", style: { "cssText": "width:154px;float:none;position:absolute;background-color:#fff;z-Index:999;border:1px solid #ccc;height:80px;text-align:center;top:26px;left:56px" } }, _chatheadimageel);
  7975. var _local = $$("div", {
  7976. "className": "U_MD_F_LoaclChose", innerHTML: "选择本地上传文件", style: { "cssText": "position:relative;float:none;width:100%;height:32px;margin:8px 0 0 0;line-height:32px" },
  7977. onclick: function () {
  7978. var _groupid,
  7979. _ancestors,
  7980. _directoryid = US.disk.Disks[US.userInfo.UserId].directoryid,
  7981. _dirinfo = U.Json.select(US.disk.Disks[US.userInfo.UserId].directoryOrFiles, { "UserDirectoryID": _directoryid })[0];
  7982. //获取粘贴到制定目录的群id
  7983. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, US.disk.Disks[US.userInfo.UserId]); //获取所有的祖先
  7984. //如果是ftp目录,那么groupid就是用户id
  7985. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  7986. _groupid = US.disk.Disks[US.userInfo.UserId].userInfo.UserId;
  7987. }
  7988. //否则就是对应的群id,如果不存在那么就是""
  7989. else {
  7990. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  7991. }
  7992. U.MD.UI.upload(
  7993. "http://disk.1473.cn/USUpfile.ashx?typename=UploadFlashfile&DirectoryId=" + _directoryid + "&Encrypt=" + _groupid + "&UserId=" + US.userInfo.UserId + "&IsF=true", //上传的地址
  7994. //上传成功的回调函数
  7995. function (r, fileinfo) {
  7996. var _data = r.data //获取服务器返回值
  7997. ; //根据文件的唯一识别id获取文件的信息
  7998. //获取从服务器获取的值,这里加一个错误处理,因为如果后台出现了错误,那么eval的过程就会失败
  7999. try {
  8000. _data = eval("0," + _data);
  8001. }
  8002. catch (e) { }
  8003. var _fileInfo = {
  8004. "UserFilesServerName": _data[0],
  8005. "UserallDirectoryName": fileinfo.name,
  8006. "UserDirectoryExtendType": U.UF.UP.getFileNameAndExtension(fileinfo.name)[1],
  8007. "UserDirectorySize": _data[3],
  8008. "UserDirectoryID": _data[2],
  8009. "UserDirectoryUrl": _data[1]
  8010. }
  8011. U.MD.F.W.printMessageContent(_fileInfo.UserDirectoryExtendType, _fileInfo, _chatcontentnewsel, true, _firendinfo);
  8012. },
  8013. //得到md5的回调函数
  8014. function (md5, fileinfo, cb) {
  8015. //根据用户的md5值判断用户是否需要上传,如果需要上传则需要执行上传处理,如果已经存在后台直接给用户生成文件路径等录入数据库
  8016. U.A.Request(US.DISK, ["IfFileExistInsertDB", US.userInfo.UserId, _directoryid, _groupid, fileinfo.size, md5, U.UF.UP.getFileNameAndExtension(fileinfo.name)[1], fileinfo.name],
  8017. //判断上传文件是否存在
  8018. function (r) {
  8019. var _userid = US.userInfo.UserId; //当前登录用户的id
  8020. r = r.value;
  8021. //获取服务器返回的值,如果服务器响应出问题了,eval的时候就会报错。
  8022. try {
  8023. r = eval(r)[0];
  8024. }
  8025. catch (e) { }
  8026. //当用户想上传的文件已经在数据库里存在了,那么后台会执行复制数据的操作。
  8027. if (r) {
  8028. var _fileInfo = {
  8029. "UserFilesServerName": r.UserFilesServerName,
  8030. "UserallDirectoryName": r.UserDirectoryName.addEllipsis(20),
  8031. "UserDirectoryExtendType": U.UF.UP.getFileNameAndExtension(r.UserDirectoryName)[1],
  8032. "UserDirectorySize": r.UserDirectorySize,
  8033. "UserDirectoryID": r.UserDirectoryID,
  8034. "UserDirectoryUrl": r.UserDirectoryUrl
  8035. }
  8036. U.MD.F.W.printMessageContent(_fileInfo.UserDirectoryExtendType, _fileInfo, _chatcontentnewsel, true, _firendinfo);
  8037. cb(false);
  8038. }
  8039. //否则调用flash里面的函数执行用户的上传操作。
  8040. else {
  8041. cb(true);
  8042. }
  8043. });
  8044. });
  8045. //阻止冒泡
  8046. U.UF.EV.stopBubble()
  8047. //删除弹出框
  8048. U.selectEl(".U_MD_F_UploadInput").remove();
  8049. }
  8050. }, _div);
  8051. // var _localinput = $$('input', { 'type': 'file', style: { "cssText": "position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0;" },
  8052. // onchange: function () {
  8053. // if (this.files.length) { //判断是否存在文件
  8054. // var _range = U.UF.E.getRangeAt(); //获取光标处理
  8055. // U.UF.UP.inputUpload([this], 'http://disk.1473.cn/USUpfile.ashx?typename=UseStudioEditor', function (r) { //调用统一上传处理
  8056. // var _file, _filetype, _input = r.context[0];
  8057. // var _imgtype = /.*(jpg|png|gif|jpeg|JPG|PNG|GIF|JPEG|bmp|BMP)$/;
  8058. // var _filearray = []; //记录上传图片的数组
  8059. // if (Object.prototype.toString.call(r.value[0]) != "[object Array]") { //根据返回值类型判断是否多图上传
  8060. // _filearray = [r.value]; //单图用数组则直接记录
  8061. // }
  8062. // else {
  8063. // _filearray = r.value; //多图则直接替换即可
  8064. // }
  8065. // var _el, _frag = $$('frag');
  8066. // for (i = 0; i < _filearray.length; i++) { //循环评接拼接
  8067. // _file = _input.files[i];
  8068. // _filetype = _file.name.substring(_file.name.lastIndexOf('.') + 1, _file.name.length); //获取文件后缀名
  8069. // if (_filetype.match(_imgtype)) {//图片类型处理
  8070. // _el = $$("div", {}, _frag); ;
  8071. // $$('span', { innerHTML: ' <img src="http://fs.1473.cn/' + _filearray[i][0] + '">' }, _el);
  8072. // }
  8073. // else { //其余文件类型处理
  8074. // _el = U.UF.E.attachment.create(_file, _filearray[i][2], _filetype);
  8075. // U.selectEl(_el).appendTo(_frag);
  8076. // }
  8077. // }
  8078. // var _filedata = { 'UserallDirectoryName': _file.name, 'UserDirectoryExtendType': _filetype, 'UserDirectorySize': _file.size, 'UserDirectoryID': r.value[2], 'UserDirectoryUrl': r.value[0] };
  8079. // U.MD.F.W.printMessageContent(_filetype, _filedata, _chatcontentnewsel, true, _firendinfo);
  8080. // }, [this]);
  8081. // }
  8082. // }
  8083. // }, _local);
  8084. var _disk = $$("div", {
  8085. "className": "U_MD_F_DiskChose", innerHTML: "选择网盘上传文件", style: { "cssText": "float:none;width:100%;height:32px;margin:0 0 0 0;line-height:32px" },
  8086. onclick: function () {
  8087. //阻止冒泡
  8088. U.UF.EV.stopBubble()
  8089. U.MD.DK.VW.choseFile(function (data) {
  8090. //根据选择的文件生成内容
  8091. U.MD.F.W.printMessageContent(data.UserDirectoryExtendType, data, _chatcontentnewsel, true, friendandgroupinfo);
  8092. //删除弹出框
  8093. U.selectEl(".U_MD_F_UploadInput").remove();
  8094. })
  8095. }
  8096. }, _div);
  8097. U.UF.EV.stopBubble();
  8098. }
  8099. }, _chatnewstwoel);
  8100. if (friendandgroupinfo.GroupManageID) {
  8101. $$("div", {
  8102. "className": "U_MD_F_DTS U_Img",
  8103. "title": "网盘提交",
  8104. "onclick": function () {
  8105. U.MD.D.I.openApplication("disk",
  8106. {
  8107. "userid": US.userInfo.UserId,
  8108. "directoryid": friendandgroupinfo.GroupManageID
  8109. });
  8110. }
  8111. }, _chatnewstwoel);
  8112. }
  8113. $$("div", {
  8114. "className": "U_MD_F_DTJ U_Img",
  8115. "title": "聊天记录",
  8116. "onclick": function () {
  8117. U.MD.F.H.viewFriendsChatRecords(_chatrecordel, friendandgroupinfo, 1, (friendandgroupinfo.UserId == null));
  8118. }
  8119. }, _chatnewstwoel);
  8120. U.selectEl(_chateditel).bind("keydown", function () {
  8121. if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) {
  8122. _chatbuttonsendel.onclick(); //发送消息
  8123. U.UF.EV.stopDefault(); //回车处理
  8124. }
  8125. });
  8126. U.UF.E.initEditor(_chateditel); //初始化编辑器处理
  8127. _headel.onclick = function () {
  8128. U.MD.F.W.switchFriendsChat([_headel, _chatel], friendandgroupinfo);
  8129. }; //切换事件
  8130. //设置光标处理
  8131. // U.UF.E.GetSelectionRange(window, _chateditel, { "TF": "Friend" });
  8132. //创建的好友窗体记录
  8133. if (_chatformel.childs == null) {
  8134. _chatformel.childs = [];
  8135. }
  8136. _chatformel.childs.unshift({ "formid": _userid, "element": [_headel, _chatel], "info": friendandgroupinfo }); //添加记录
  8137. return _chatformel.childs[0].element;
  8138. }
  8139. //
  8140. /**
  8141. * 好友聊天切换
  8142. *
  8143. * @param {string} 好友的id
  8144. * @param {element} 窗体元素
  8145. */
  8146. U.MD.F.W.switchFriendsChat = function (elements, friendorgroupinfo) {
  8147. var i,
  8148. _friendchatel,
  8149. _topleftbottom,
  8150. _chatel = U.selectEl(elements[1]).Parent(2),
  8151. _topbottom = U.selectEl($(_chatel).Child()[0]).Child()[2], //右上角功能按钮
  8152. _chatchilds = U.selectEl(_chatel)[0].childs;
  8153. //判断右上角功能按钮是否存在
  8154. if (_topbottom.children[0]) {
  8155. _topbottom.children[0].remove();
  8156. }
  8157. //显示当前elements的聊天窗体,其他的隐藏
  8158. for (i = 0; i < _chatchilds.length; i++) {
  8159. _friendchatel = _chatchilds[i].element;
  8160. if (_friendchatel[0] == elements[0] && _friendchatel[1] == elements[1]) { //需要显示的聊天框
  8161. U.MD.F.W.switchFriendsChat.Ele = elements[1];
  8162. U.selectEl(elements[0]).addClass("U_MD_F_TOT");
  8163. U.selectEl(elements[1]).css("display", "block");
  8164. //可编辑区域聚焦
  8165. U.selectEl(".U_MD_F_DC", elements[1])[0].focus();
  8166. }
  8167. else { //需要隐藏的聊天框
  8168. U.selectEl(_friendchatel[0]).removeClass("U_MD_F_TOT");
  8169. U.selectEl(_friendchatel[1]).css("display", "none");
  8170. }
  8171. }
  8172. //右上角功能点击处理处理
  8173. _topbottom.onclick = function () { U.MD.F.R.popupRightCornerMenu(friendorgroupinfo, _topbottom); };
  8174. if (friendorgroupinfo.UserId) {
  8175. _topleftbottom = "个人信息";
  8176. } else {
  8177. _topleftbottom = "创建群";
  8178. }
  8179. _topbottom.title = _topleftbottom;
  8180. //好友聊天框
  8181. U.MD.F.W.chatBoxSize($(elements[1]).Parent(7), elements[1]);
  8182. }
  8183. /**
  8184. * 删除单个好友聊天
  8185. *
  8186. * @param {string} 好友的id
  8187. * @param {element} 窗体元素
  8188. */
  8189. U.MD.F.W.delteFriendChat = function (friendid, el) {
  8190. var i, j, //循环处理
  8191. _chatinfo, //好友聊天的好友或者群信息
  8192. _elements, //好友聊天信息的框
  8193. _childs = U.selectEl(el)[0].childs; //获取所有的聊天框
  8194. U.UF.EV.stopBubble();
  8195. //剩下最后一个直接关闭聊天框
  8196. if (_childs.length == 1 && _childs[0].formid == friendid) {
  8197. U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block" }], { "left": "auto", "right": "0px" }); //移除
  8198. }
  8199. else {
  8200. //循环找到friendid对应的弹框
  8201. for (i = 0; i < _childs.length; i++) {
  8202. //判断窗体的id和好友的id是否一致
  8203. if (_childs[i].formid == friendid) {
  8204. _elements = _childs[i]["element"]; //获取根据friendid创建的所有的元素
  8205. for (j = 0; j < _elements.length; j++) { //循环所有的元素,然后全部删除
  8206. U.selectEl(_elements[j]).remove(); //移除元素处理
  8207. }
  8208. _childs.splice(i, 1); //在所有孩子元素中删除该元素
  8209. //判断当前窗体是否在正在进行的聊天窗体,如果是的话,删除了这个窗体后要把下面的窗体显示出来
  8210. if (_elements[0].className.indexOf("U_MD_F_TOT") > -1) {
  8211. //获取下一个要显示的聊天框
  8212. _chatinfo = _childs[i] || _childs[i - 1]; //下一个或者是上一个
  8213. //显示该聊天框
  8214. U.MD.F.W.switchFriendsChat(_chatinfo["element"], _chatinfo["info"]);
  8215. }
  8216. break;
  8217. }
  8218. }
  8219. }
  8220. }
  8221. /**
  8222. * 移除所有聊天窗体
  8223. *
  8224. */
  8225. U.MD.F.W.delteAllFriendChat = function () {
  8226. }
  8227. //生成发表聊天消息和获取聊天消息区域
  8228. /**
  8229. * 查看聊天好友
  8230. * @param {element} 打印的内容区域
  8231. * @param {array} 打印消息的数组
  8232. * @param {boolean} 判断消息是自己发送的还是获取的
  8233. ---------- true 自己发送的
  8234. ---------- flase 获取的带的
  8235. */
  8236. U.MD.F.W.printFriendChatMessage = function (el, newsinfo, issend) {
  8237. var i,
  8238. _mydate,
  8239. _month,
  8240. _date, //打印的时间
  8241. _contentel,
  8242. _content,
  8243. _chatcontentel,
  8244. _contentoneel,
  8245. _contentimgel,
  8246. _chatcontentoneel,
  8247. _chatcontentwordsel,
  8248. _chatel = el.parentNode, //聊天框
  8249. _frag = $$("frag");
  8250. //发送者和接受者的样式区分
  8251. //发送者的样式
  8252. if (issend) {
  8253. _stylearray = ["U_MD_F_CT", " U_MD_F_CTLC U_MD_F_GCTLC", " U_MD_F_COLCOO", " U_MD_F_CTTO", " "];
  8254. }
  8255. //接受者的样式
  8256. else {
  8257. _stylearray = ["U_MD_F_CO", "U_MD_F_CTLC_Receive U_MD_F_GCTLC", " U_MD_F_COLCOT", " U_MD_F_CTT"];
  8258. }
  8259. //打印的消息
  8260. var _el;
  8261. for (i = 0; i < newsinfo.length; i++) {
  8262. _mydate = new Date(); //获取时间
  8263. _month = _mydate.getMonth() + 1; //获取月份
  8264. _date = newsinfo[i]["Time"] || U.MD.F.N.getHoursMinutesSeconds(newsinfo[i]["GroupMessageSendTime"] || newsinfo[i]["MessageSendTime"], "Array");
  8265. _contentBox = $$("div", { "style": { "margin": " 0 10px" } }, _frag);
  8266. //没有打印任何消息,时间必须打印
  8267. if (el.innerText == "") {
  8268. _time = $$("div", { "className": "U_MD_F_COTO U_MD_F_CTO", "style": { "margin": " 0 10px", "text-align": "center", "color": "#aaaaaa", "font-size": "13px" }, "innerHTML": (_date) }, _contentBox); //el.innerText.slice(0,8)
  8269. }
  8270. //打印消息判断时间差,如果是在两分钟内的 则不添加新的时间提示
  8271. else {
  8272. _time = $$("div", { "className": "U_MD_F_COTO U_MD_F_CTO", "style": { "display": "none", "margin": " 0 10px", "text-align": "center", "color": "#aaaaaa", "font-size": "13px" }, "innerHTML": (_mydate.getFullYear() + "/" + _month + "/" + _mydate.getDate() + " " + _date) }, _contentBox);
  8273. var _pastTime = _chatel.firstChild.lastChild.firstChild.innerText;
  8274. if (_mydate.getTime() / 1000 - new Date(_pastTime).getTime() / 1000 >= 120) {
  8275. _time = $$("div", { "className": "U_MD_F_COTO U_MD_F_CTO", "style": { "margin": " 0 10px", "text-align": "center", "color": "#aaaaaa", "font-size": "13px" }, "innerHTML": (_date) }, _contentBox);
  8276. }
  8277. }
  8278. _contentel = $$("div", { "className": _stylearray[0], "title": newsinfo[i].GroupMessageSendUsername || newsinfo[i].MessageDescript || newsinfo[i].Name }, _contentBox);
  8279. _content = $$("div", {}, _contentel);
  8280. _contentoneel = $$("div", { "className": "U_MD_F_COLC" + " " + _stylearray[1] }, _content);
  8281. _contentimgel = $$("img",
  8282. {
  8283. "onerror": U.MD.C.imgError,
  8284. "title": "点击查看",
  8285. 'i': i,
  8286. "onclick": function () {
  8287. U.MD.U.V.ViewOtherUserInfo(newsinfo[this.i].GroupMessageSendUser || newsinfo[this.i].UserId || newsinfo[this.i].MessageSendUserID);
  8288. },
  8289. "src": U.MD.C.getHeadImage((newsinfo[i].IMG || newsinfo[i].UserThumbnailImageHead || '/img/UserHead/UseHead.jpg' || U.selectEl('.U_MD_F_HH')[0].children[0].src)),
  8290. "className": "U_MD_F_COLCI"
  8291. }, _contentel);
  8292. //如果消息类型为6,文件消息处理
  8293. if (newsinfo[i].MessageIsVerify == 6) {
  8294. var _filedata = JSON.parse(newsinfo[i].MessageContent),
  8295. //生成盒子,并且绑定点击事件
  8296. _filebox = $$('div', { style: { cssText: 'position:relative; padding: 10px; background-color: #fff; border:1px solid silver; overflow:hidden; cursor: pointer;' } }, _contentoneel)
  8297. U.MD.F.W.printFileContent(_filedata, _filebox)
  8298. }
  8299. else {
  8300. _el = newsinfo[i]["MessageContent"] || newsinfo[i]["GroupMessageContent"] || newsinfo[i]["Content"]
  8301. if (U.UF.C.isElement(_el)) {
  8302. _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2] }, _contentoneel);
  8303. U.selectEl(_el).appendTo(_contentwordsel);
  8304. }
  8305. else {
  8306. _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2], "innerHTML": _el }, _contentoneel);
  8307. }
  8308. }
  8309. if (issend) {
  8310. _contentoneimgel = $$("div", { "style": { "width": "6px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-984px -344px", "margin": "10px 4px 10px 0px" } }, _content);
  8311. _content.style.float = "right";
  8312. _contentel.insertBefore(_contentimgel, _content);
  8313. _contentimgel.style.float = "right";
  8314. _content.style.marginRight = "8px";
  8315. }
  8316. else {
  8317. _contentoneimgel = $$("div", { "style": { "width": "6px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-1004px -344px", "margin": "10px 0px 10px 4px" } }, _content);
  8318. _content.style.float = "left";
  8319. _contentel.insertBefore(_contentimgel, _content);
  8320. }
  8321. }
  8322. el.appendChild(_frag);
  8323. //消息定位到底部
  8324. _chatel.scrollTop = _chatel.scrollHeight - _chatel.offsetHeight;
  8325. }
  8326. /**
  8327. * 查看聊天 好友或者群
  8328. * @param {element} 打印的内容区域
  8329. * @param {array} 打印消息的数组
  8330. * @param {boolean} 判断消息是自己发送的还是获取的
  8331. ---------- true 自己发送的
  8332. ---------- flase 获取的带的
  8333. */
  8334. U.MD.F.W.printGroupChatMessage = function (el, newsinfo, issend) {
  8335. var i,
  8336. _date,
  8337. _contentel,
  8338. _contentoneel,
  8339. _contentwordsel,
  8340. _contentimgel,
  8341. _contentnameel,
  8342. _stylearray,
  8343. _chatcontentel = el.parentNode,
  8344. _frag = $$("frag");
  8345. //发送消息是自己和他人区别的样式
  8346. if (issend) {
  8347. _stylearray = ["U_MD_F_CT", " U_MD_F_CTLC U_MD_F_GCTLC", " U_MD_F_COLCOO", " U_MD_F_CTTO", " "];
  8348. }
  8349. else {
  8350. _stylearray = ["U_MD_F_CO", "U_MD_F_CTLC_Receive U_MD_F_GCTLC", " U_MD_F_COLCOT", " U_MD_F_CTT"];
  8351. }
  8352. //循环打印聊天消息
  8353. for (i = 0; i < newsinfo.length; i++) {
  8354. var _i = i;
  8355. var _isFile = true;
  8356. var _mydate = new Date(),
  8357. _month = _mydate.getMonth() + 1; //获取月份
  8358. _mydate.getHours(); //获取系统时,
  8359. _mydate.getMinutes(); //分
  8360. _mydate.getSeconds(); //秒
  8361. _date = newsinfo[i]["Time"] || U.MD.F.N.getHoursMinutesSeconds(newsinfo[i]["GroupMessageSendTime"]), "Array";
  8362. _contentBox = $$("div", { "style": { "margin": " 0 10px" } }, _frag);
  8363. if (el.innerText == "") {
  8364. _time = $$("div", { "className": "U_MD_F_COTO U_MD_F_CTO", "style": { "margin": " 0 10px", "text-align": "center", "color": "#aaaaaa", "font-size": "13px" }, "innerHTML": (_date) }, _contentBox);
  8365. } else {
  8366. _time = $$("div", { "className": "U_MD_F_COTO U_MD_F_CTO", "style": { "display": "none", "margin": " 0 10px", "text-align": "center", "color": "#aaaaaa", "font-size": "13px" }, "innerHTML": (_mydate.getFullYear() + "/" + _month + "/" + _mydate.getDate() + " " + _date) }, _contentBox);
  8367. var _pastTime = _chatcontentel.firstChild.lastChild.firstChild.innerText;
  8368. if (_mydate.getTime() / 1000 - new Date(_pastTime).getTime() / 1000 >= 120) {
  8369. _time = $$("div", { "className": "U_MD_F_COTO U_MD_F_CTO", "style": { "margin": " 0 10px", "text-align": "center", "color": "#aaaaaa", "font-size": "13px" }, "innerHTML": (_date) }, _contentBox);
  8370. }
  8371. }
  8372. _contentel = $$("div", { "className": _stylearray[0], "title": newsinfo[i].GroupMessageSendUsername || newsinfo[i].MessageDescript || newsinfo[i].Name }, _contentBox);
  8373. _content = $$("div", {}, _contentel);
  8374. _contentoneel = $$("div", { "className": "U_MD_F_COLC" + " " + _stylearray[1] }, _content);
  8375. _contentimgel = $$("img", {
  8376. "onerror": U.MD.C.imgError,
  8377. "title": "点击查看",
  8378. "onclick": function () {
  8379. U.MD.U.V.ViewOtherUserInfo(newsinfo[_i].GroupMessageSendUser || newsinfo[_i].UserId);
  8380. }, "src": U.MD.C.getHeadImage((newsinfo[i].IMG || newsinfo[i].UserThumbnailImageHead)), "className": "U_MD_F_COLCI"
  8381. }, _contentel);
  8382. if (_isFile) {
  8383. _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2], "innerHTML": newsinfo[i]["Content"] || newsinfo[i]["GroupMessageContent"] }, _contentoneel);
  8384. }
  8385. else {
  8386. var _filedata = newsinfo[i].Content,
  8387. _filebox = $$('div', {
  8388. style: { cssText: 'position:relative; padding: 10px; background-color: #fff; border:1px solid silver; overflow:hidden; cursor: pointer;' }, onclick: U.UF.C.closure(function (i, filedata) {
  8389. var _type = '';
  8390. switch (filedata.fileType) {
  8391. case "uw": _type = 'word'; break;
  8392. case "ue": _type = 'excel'; break;
  8393. }
  8394. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", filedata.fileID]), function (r) {
  8395. U.MD.D.I.openApplication(_type, r.value[0])
  8396. });
  8397. }, [i, _filedata])
  8398. }, _contentoneel)
  8399. $$('span', { className: 'U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOD' }, _filebox);
  8400. $$('span', { style: { cssText: 'vertical-align: top; padding-left: 20px; padding-right: 40px;' }, innerText: _filedata.fileName + '.' + _filedata.fileType }, _filebox);
  8401. $$('div', { style: { cssText: 'position: absolute; right: 10px; bottom: 10px;' }, innerText: '查看' }, _filebox)
  8402. }
  8403. if (issend) {
  8404. _contentoneimgel = $$("div", { "style": { "width": "6px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-984px -344px", "margin": "10px 4px 10px 0px" } }, _content);
  8405. _content.style.float = "right";
  8406. _contentel.insertBefore(_contentimgel, _content);
  8407. _contentimgel.style.float = "right";
  8408. _content.style.marginRight = "8px";
  8409. }
  8410. else {
  8411. _contentoneimgel = $$("div", { "style": { "width": "6px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-1004px -344px", "margin": "10px 0px 10px 4px" } }, _content);
  8412. _content.style.float = "left";
  8413. _contentel.insertBefore(_contentimgel, _content);
  8414. }
  8415. }
  8416. //追加消息
  8417. el.appendChild(_frag);
  8418. //消息定位到底部
  8419. _chatcontentel.scrollTop = _chatcontentel.scrollHeight - _chatcontentel.clientHeight;
  8420. }
  8421. /**
  8422. * 查看聊天好友
  8423. * @param {element} 打印的内容区域
  8424. * @param {array} 打印消息的数组
  8425. * @param {boolean} 判断消息是自己发送的还是获取的
  8426. ---------- true 自己发送的
  8427. ---------- flase 获取的带的
  8428. */
  8429. U.MD.F.W.addFile = function (friendinfo, el, thumbnail, fileurl, fileinfo) {
  8430. //临时元素变量
  8431. var _tempel,
  8432. _temponeel,
  8433. _temptwoel,
  8434. _tempthreeel,
  8435. _isgroup = friendinfo.UserId == null;
  8436. //图片发送方式
  8437. if (U.UF.UP.isImg(fileinfo.UserDirectoryExtendType)) {
  8438. //创建一个元素
  8439. _tempel = $$("div", {});
  8440. //创建一个图片标签,添加图片
  8441. $$("img", { "onerror": U.MD.C.imgError, "className": "U_MD_F_CI", "src": U.MD.C.getHeadImage(thumbnail), "title": U.MD.C.getHeadImage(fileurl) },
  8442. _messageel).onclick = "U.UF.EV.stopBubble();U.MD.I.Img(US.userInfo, { 'Thm': '" + fileurl + "', 'Img': '" + fileurl + "'})"; //图片内容
  8443. //发送图片
  8444. U.MD.F.H.sendFriendOrGroupChatMessage(friendinfo, _messageel, el, _isgroup, true);
  8445. }
  8446. //文件发送方式
  8447. else {
  8448. _tempthreeel = $$("div");
  8449. //发表文章样式
  8450. _tempel = $$("div", { "className": "U_MD_F_F" }, _tempthreeel);
  8451. _temponeel = $$("div", { "className": "U_MD_F_FS" }, _tempel);
  8452. _temptwoel = $$("div", { "className": "U_MD_F_FSS" }, _temponeel);
  8453. $$("div", { "innerHTML": fileinfo["UserDirectoryExtendType"] }, _temptwoel);
  8454. _temptwoel = $$("div", { "className": "U_MD_F_FSX" }, _temponeel);
  8455. $$("div", { "className": "U_MD_F_FSXN", "innerHTML": fileinfo["UserallDirectoryName"] }, _temptwoel);
  8456. $$("div", { "className": "U_MD_F_FSXS", "innerHTML": "已成功发送" }, _temptwoel);
  8457. _temponeel = $$("div", { "className": "U_MD_F_FX" }, _tempel);
  8458. //如果是在1473上看到该信息,则可以直接打开网盘到指定的地方
  8459. if (U.MD.D.IsUseStudio) {
  8460. _tempel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "', '" + fileinfo.UserDirectoryID + "'])"
  8461. _temptwoel = $$("div", { "innerHTML": "打开我的云盘", "title": "打开我的云盘" }, _temponeel);
  8462. _temptwoel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "','" + fileinfo.UserDirectoryParentID + "'])";
  8463. _temptwoel = $$("div", { "innerHTML": "打开", "title": "打开" }, _temponeel);
  8464. _temptwoel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "','" + fileinfo.UserDirectoryID + "'])";
  8465. }
  8466. //如果是第三方调用我们的好友,则出现下载
  8467. else {
  8468. _temptwoel = $$("div", { "innerHTML": "下载", "title": "下载" }, _temponeel);
  8469. _temptwoel.onclick = "U.UF.EV.stopBubble();U.UF.UP.download('" + fileinfo.UserallDirectoryName + "','" + fileinfo.UserFilesServerName + "')";
  8470. }
  8471. //显示出文件的样式
  8472. U.MD.F.H.sendFriendOrGroupChatMessage(friendinfo, _tempthreeel, el, _isgroup, true);
  8473. }
  8474. }
  8475. //#endregion
  8476. //右侧好友定位
  8477. U.MD.F.W.rightFormlocation = function () {
  8478. U.selectEl("#U_MD_F_H_R").addAttrArray({
  8479. "style":
  8480. {
  8481. "top": (US.height - 530) / 2,
  8482. "right": "0px"
  8483. }
  8484. }); //
  8485. }
  8486. /*
  8487. 打印消息内容
  8488. 参数一:type(string) 消息种类 例如 文件夹folder 图片 jpg 等
  8489. 参数二:data(json) 文件数据
  8490. 参数三:parent(element) 生成元素
  8491. 参数五:send(boolean) 发送消息为true ,接受消息为false
  8492. 参数四:friend(json) 好友数据
  8493. */
  8494. U.MD.F.W.printMessageContent = function (type, data, parent, send, friend) {
  8495. var _content = $$('div', {}),
  8496. _folder = $$("div", { style: { "cssText": "padding:8px;background:#fff;border-radius:2px;position:relative" } }, _content);
  8497. //创建文件信息类
  8498. var _message = {
  8499. UserFilesServerName: data.UserFilesServerName,
  8500. fileName: data.UserallDirectoryName,
  8501. fileType: data.UserDirectoryExtendType,
  8502. fileSize: data.UserDirectorySize,
  8503. fileID: data.UserDirectoryID,
  8504. fileUrl: data.UserDirectoryUrl,
  8505. filetype: fileType = "folder" ? 1 : 0,
  8506. UserDirectoryExtendType: data.UserDirectoryExtendType,
  8507. UserDirectoryID: data.UserDirectoryID,
  8508. UserallDirectoryName: data.UserallDirectoryName
  8509. };
  8510. U.MD.F.W.printFileContent(_message, _folder);
  8511. //生成消息数据
  8512. var _newsinfo = [{
  8513. "UserId": US.userInfo.UserId,
  8514. "Time": new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds(),
  8515. "Content": _content,
  8516. "IMG": US.userInfo.UserThumbnailImageHead,
  8517. "Name": US.userInfo.UserNickName
  8518. }];
  8519. //是否发送消息
  8520. if (send) {
  8521. //发送记录到数据库
  8522. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SentMessageToFriend", US.userInfo.UserId, friend.UserId, US.userInfo.UserNickName, JSON.stringify(_message), 6, false], function () { });
  8523. }
  8524. //打印在好友聊天
  8525. U.MD.F.W.printFriendChatMessage(parent, _newsinfo, true);
  8526. }
  8527. /*
  8528. 打印消息文件内容
  8529. 参数一:data(json) 文件数据
  8530. 参数二:parent(element) 生成元素
  8531. */
  8532. U.MD.F.W.printFileContent = function (data, parent) {
  8533. var _content, _titile, _icon,
  8534. _type = data.fileType.toLowerCase();
  8535. switch (data.fileType) {
  8536. case "folder": //打印文件夹类型的文件
  8537. _content = $$("div", { style: { "cssText": "width:100%" } }, parent);
  8538. $$("div", { "className": "U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOW", style: { "cssText": "float:none;display:inline-block;" } }, _content);
  8539. _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;" } }, _content);
  8540. $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000" } }, _titile);
  8541. $$("div", { innerHTML: "(" + U.UF.UP.minUnitToMaxUnit(data.fileSize) + ")", style: { "cssText": "color:#aaaaaa;font-size:10px;line-height:10px" } }, _titile);
  8542. $$("div", { onclick: function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.UserId) }, innerHTML: "打开", style: { "cssText": "color:#429bfe;margin-top:-20px;text-align: right;cursor: pointer;" } }, parent);
  8543. break;
  8544. case "txt": case "html": case "uw": case "ue": //打印文本文件
  8545. _content = $$("div", { style: { "cssText": "width:100%" } }, parent);
  8546. $$("div", { "className": "U_MD_DK_RZOD U_MD_DK_RZOS", style: { "cssText": "float:none;display:inline-block;" } }, _content);
  8547. _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;" } }, _content);
  8548. $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000" } }, _titile);
  8549. $$("div", { onclick: function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.UserId) }, innerHTML: "查看", style: { "cssText": "color:#429bfe;margin-top:-20px;text-align: right;cursor: pointer;" } }, parent);
  8550. break;
  8551. case "jpg": case "png": //打印图片文件
  8552. $$("img", { "onclick": function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.UserId) }, "onerror": U.MD.C.imgError, "src": "http://fs.1473.cn/" + data.fileUrl, "style": { "cssText": "width:100%;max-width:300px;min-width:30px;min-height:30px" } }, parent);
  8553. break;
  8554. case "mp4": //打印视频文件
  8555. if (parent.parentElement.className == "U_MD_F_LO") {
  8556. _content = $$("div", { style: { "cssText": "width:100%" } }, parent);
  8557. $$("div", { "className": "U_MD_DK_RZOS U_MD_DK_VIDEO", style: { "cssText": "float:none;display:inline-block;width:40px;height:40px;background-image:url('/img/YS2017.png');background-repeat:no-repeat;background-position:-1081px -527px;" } }, _content);
  8558. _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;" } }, _content);
  8559. $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000" } }, _titile);
  8560. $$("div", { onclick: function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.UserId) }, innerHTML: "查看", style: { "cssText": "color:#429bfe;margin-top:-20px;float:right" } }, parent);
  8561. }
  8562. else {
  8563. $$("img", { "onerror": U.MD.C.imgError, "src": "http://fs.1473.cn/" + data.fileUrl, "style": { "cssText": "width:100%;max-width:300px;" } }, parent);
  8564. _content = $$("div", {}, parent);
  8565. $$("div", { onclick: function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.UserId) }, "style": { "width": "97px", "height": "96px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-1015px -362px", "position": "absolute", "top": "25%", "left": "28%" } }, _content);
  8566. $$("div", { "innerHTML": data.fileName, "style": { "cssText": "color:white;font-size:16px;position: absolute;top: 137px;margin-left: 10px;" } }, _content);
  8567. $$("span", { "innerHTML": U.UF.UP.minUnitToMaxUnit(data.fileSize), "style": { "cssText": "color:#d4d3d1;font-size:14px;position: absolute;top: 155px;margin-left: 10px;" } }, _content);
  8568. $$("span", { "innerHTML": "已发送", "style": { "cssText": "color:#d4d3d1;font-size:14px;position: absolute;top: 155px;right:20px" } }, _content);
  8569. }
  8570. break;
  8571. default:
  8572. _content = $$("div", { style: { "cssText": "width:100%" } }, parent);
  8573. _icon = $$("div", { "className": "U_MD_DK_RZOS U_MD_DK_Img downel_content_a_r", style: { "cssText": "float:none;display:inline-block;" } }, _content);
  8574. $$("div", { "className": "U_MD_DK_RZOSZ", 'innerHTML': data.fileType }, _icon);
  8575. _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;" } }, _content);
  8576. $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000" } }, _titile);
  8577. $$("div", { innerHTML: "(" + U.UF.UP.minUnitToMaxUnit(data.fileSize) + ")", style: { "cssText": "color:#aaaaaa;font-size:10px;line-height:10px" } }, _titile);
  8578. $$("div", { "onclick": function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.UserId); }, innerHTML: "打开", style: { "cssText": "color:#429bfe;margin-top:-20px;text-align: right;cursor: pointer;" } }, parent);
  8579. break;
  8580. };
  8581. }
  8582. /**
  8583. *添加聚焦效果
  8584. *
  8585. */
  8586. U.MD.F.W.addChecked = function (friendinfo) {
  8587. var _infotid = friendinfo.UserId || friendinfo.GroupManageID;
  8588. if ($('.U_MD_F_H_ZLZOCOChecked')[0]) {
  8589. U.UF.EL.removeClass($('.U_MD_F_H_ZLZOCOChecked')[0], "U_MD_F_H_ZLZOCOChecked");
  8590. }
  8591. if ($("[tid='" + _infotid + "']")[0]) {
  8592. U.UF.EL.addClass($("[tid='" + _infotid + "']")[0], "U_MD_F_H_ZLZOCOChecked");
  8593. }
  8594. };
  8595. ///<jscompress sourcefile="HistroyMessage.js" />
  8596. Namespace.register("U.MD.F.H"); //好友聊天和群聊天消息命名空间
  8597. //#region 好友和群聊天记录
  8598. //#region 聊天记录
  8599. /**
  8600. * 好友或者群消息
  8601. * @param {element} 聊天框
  8602. * @param {object} 好友或者群信息
  8603. * @param {int} 第几页
  8604. * @param {string} 变化的样式
  8605. */
  8606. U.MD.F.H.viewFriendsChatRecords = function (el, friendandgroupinfo, page, isgroup) {
  8607. //如果聊天记录在显示,那么隐藏聊天记录
  8608. if (el.style.display == "block") {
  8609. el.style.display = "none";
  8610. U.MD.F.W.chatBoxSize($(el).Parent(3), U.selectEl(el).Parent()); //调整大小
  8611. }
  8612. //如果聊天记录没有打开,那么打开聊天记录
  8613. else {
  8614. U.selectEl(el).Child()[1].innerHTML = ""; //清空聊天记录
  8615. U.MD.F.H.chatRecord(el, friendandgroupinfo, page, isgroup);
  8616. el.style.display = "block"; //显示聊天记录框
  8617. }
  8618. U.MD.F.W.chatBoxSize($(el).Parent(8), U.selectEl(el).Parent()); //调整大小
  8619. }
  8620. //
  8621. /**
  8622. * 聊天记录分页
  8623. * @param {element} 聊天框
  8624. * @param {object} 好友或者群信息
  8625. * @param {int} 第几页
  8626. * @param {string} 变化的样式
  8627. */
  8628. U.MD.F.H.chatRecord = function (el, friendandgroupinfo, page, isgroup) {
  8629. var _end = page * 20, //分页的结束位置
  8630. _start = _end - 20; //分页的开始位置
  8631. //群的获取聊天记录
  8632. if (isgroup) {
  8633. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupChatHistory", friendandgroupinfo.GroupManageID, _start, _end], U.MD.F.H.asynChatRecord, ["", el, friendandgroupinfo, page, isgroup]);
  8634. }
  8635. //好友的获取聊天记录
  8636. else {
  8637. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendChatHistory", US.userInfo.UserId, friendandgroupinfo.UserId, _start, _end], U.MD.F.H.asynChatRecord, ["", el, friendandgroupinfo, page, isgroup]);
  8638. }
  8639. }
  8640. //获取聊天记录异步
  8641. U.MD.F.H.asynChatRecord = function (r) {
  8642. var _context = r.context,
  8643. _recentcontactsel = _context[1], //聊天记录元素
  8644. _friendandgroupinfo = _context[2], //好友或者群的信息
  8645. _page = _context[3], //页数
  8646. _isgroup = _context[4], //是否群聊天记录
  8647. _childs = U.selectEl(_recentcontactsel).Child(); //0 聊天记录查看区域 1 分页区域
  8648. r = r.value;
  8649. _childs[0].innerText = ""; //清空聊天记录
  8650. if (r.length) {
  8651. //打印聊天记录
  8652. U.MD.F.H.printChatRecord(_childs[0], r, _friendandgroupinfo);
  8653. //聊天记录到底部
  8654. _childs[0].scrollTop = _childs[0].scrollHeight;
  8655. //如果没有加载分页控件,则加载
  8656. // if (!$("div", _childs[1]).length) {
  8657. // //调用分页接口打印分页
  8658. // new U.UF.P.page(_childs[1], r[0].AllC, 50, _page,
  8659. // function (_page) { U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup); }, 1);
  8660. // }
  8661. //如果没有加载日历控件,则加载
  8662. if (!$("div", _childs[1]).length) {
  8663. var _calendarinput,
  8664. _date = new Date(),
  8665. _allpage = Math.ceil(r[0].AllC / 20),
  8666. _month = _date.getMonth() + 1;
  8667. $$("div", {
  8668. "style": { "width": "16px", "height": "17px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-855px -481px", "margin": "5px 0 5px 61px" },
  8669. "onclick": function () {
  8670. U.UF.EV.stopBubble();
  8671. U.selectEl(document).bind("click", function (e) {
  8672. U.selectEl(".U_MD_UI_calendar_bigboard")[0].style.cssText = "display:none";
  8673. })
  8674. U.MD.UI.calendar(_calendarinput, _calendarPlace, false);
  8675. }
  8676. }, _childs[1]); //日历按钮样式
  8677. $$("div", {
  8678. "className": "U_MD_F_H_checkAllCalendar", "style": { "width": "49px", "height": "19px", "position": "absolute", "bottom": "-1px", "right": "222px", "line-height": "19px", "display": "inline-block", "margin": "5px 0 7px 0px", "text-align": "center", "border-radius": "3px", "border": "1px solid #ccc", "cursor": "pointer" }, "innerHTML": "全部",
  8679. onclick: function () {
  8680. _calendarinput.value = '';
  8681. _childs[0].innerText = ""; //清空聊天记录
  8682. //打印聊天记录
  8683. U.MD.F.H.printChatRecord(_childs[0], r, _friendandgroupinfo);
  8684. //聊天记录到底部
  8685. _childs[0].scrollTop = _childs[0].scrollHeight;
  8686. }
  8687. }, _childs[1]); //全部按钮样式
  8688. _calendarinput = $$("input", { "value": _date.getFullYear() + "-" + _month + "-" + _date.getDate(), "readOnly": "true", "style": { "width": "68px", "height": "17px", "display": "block", "margin": "5px 0 5px 5px", "position": "absolute", 'bottom': '2px', 'left': "76px", 'border': '0px' } }, _childs[1]);
  8689. $$("div", {
  8690. "style": { "width": "13px", "height": "18px", "background-image": "url('/img/YS2017.png')", "background-position": "-891px -481px", "display": "inline-block", "margin": "5px 20px 4px 76px" },
  8691. onclick: function () {
  8692. // this.style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_firstPage.png)';
  8693. _page = Math.ceil(r[0].AllC / 20);
  8694. U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup);
  8695. }
  8696. }, _childs[1]);
  8697. $$("div", {
  8698. "style": { "width": "11px", "height": "18px", "background-image": "url('/img/YS2017.png')", "background-position": "-924px -481px", "display": "inline-block", "margin": "5px 20px 4px 0px" },
  8699. onclick: function () {
  8700. if (_page <= _allpage - 1) {
  8701. _page++;
  8702. U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup);
  8703. }
  8704. }
  8705. }, _childs[1]);
  8706. $$("div", {
  8707. "style": { "width": "10px", "height": "17px", "background-image": "url('/img/YS2017.png')", "background-position": "-957px -481px", "display": "inline-block", "margin": "5px 20px 4px 0px" },
  8708. onclick: function () {
  8709. if (_page > 1) {
  8710. _page--;
  8711. U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup);
  8712. }
  8713. }
  8714. }, _childs[1]);
  8715. $$("div", {
  8716. "style": { "width": "13px", "height": "18px", "background-image": "url('/img/YS2017.png')", "background-position": "-987px -481px", "display": "inline-block", "margin": "5px 13px 4px 0px" },
  8717. onclick: function () {
  8718. // this.style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_lastPage.png)'
  8719. _page = 1;
  8720. U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup);
  8721. }
  8722. }, _childs[1]);
  8723. _calendarPlace = $$('div', { "style": { cssText: "position:absolute; bottom: 400px; right:317px" } }, _childs[1]);
  8724. U.MD.UI.calendar.SetCallBack("CheckedDay", function () { U.MD.F.H.asynGetRecordByCalendar(_calendarinput.value, _friendandgroupinfo, _childs[0]); });
  8725. }
  8726. }
  8727. else {
  8728. U.alert("暂无消息记录");
  8729. }
  8730. }
  8731. /**
  8732. * 获取指定时间内的消息记录
  8733. * calenderday @param {string} 日历上点击的日期
  8734. * friendandgroupinfo @param {object} 好友或群信息
  8735. * contactsel {element} 消息记录显示位置
  8736. */
  8737. U.MD.F.H.asynGetRecordByCalendar = function (calenderday, friendandgroupinfo, contactsel) {
  8738. var _previousdate = calenderday,
  8739. _nextdate = U.MD.F.H.asynGetNextDay(_previousdate), //获取下一天的时间
  8740. _userid = friendandgroupinfo.UserId ? friendandgroupinfo.UserId : friendandgroupinfo.GroupManageID;
  8741. if (friendandgroupinfo.UserId) {//判断是好友或群的消息记录
  8742. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendChatHistoryByDate",
  8743. US.userInfo.UserId, _userid, _previousdate, _nextdate], function (r) {
  8744. contactsel.innerText = "";
  8745. U.MD.F.H.printChatRecord(contactsel, r.value, friendandgroupinfo);
  8746. }, [contactsel, friendandgroupinfo]);
  8747. } else {
  8748. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupChatHistoryByDate",
  8749. _userid, _previousdate, _nextdate], function (r) {
  8750. contactsel.innerText = "";
  8751. U.MD.F.H.printChatRecord(contactsel, r.value, friendandgroupinfo);
  8752. }, [contactsel, friendandgroupinfo]);
  8753. }
  8754. }
  8755. /**
  8756. * 获取指定时间的下一天
  8757. * date @param {string} 日历上点击的日期
  8758. *
  8759. */
  8760. U.MD.F.H.asynGetNextDay = function (date) {
  8761. var _currdate = new Date(date),
  8762. _nextdate = new Date(_currdate.getTime() + 24 * 60 * 60 * 1000),
  8763. _nextdateyear = (_nextdate.getFullYear().toString())[1] ? _nextdate.getFullYear() : '0' + _nextdate.getFullYear(),
  8764. _nextdatemonth = (_nextdate.getMonth().toString())[1] ? (_nextdate.getMonth() + 1) : '0' + (_nextdate.getMonth() + 1),
  8765. _nextdateday = (_nextdate.getDate().toString())[1] ? _nextdate.getDate() : '0' + _nextdate.getDate(),
  8766. _nextday = _nextdateyear + '-' + _nextdatemonth + '-' + _nextdateday;
  8767. return _nextday;
  8768. }
  8769. /**
  8770. * 聊天记录分页
  8771. * @param {element} 聊天框
  8772. * @param {object} 聊天信息
  8773. * @param {object} 好友信息
  8774. */
  8775. U.MD.F.H.printChatRecord = function (el, recordinfo, friendandgroupinfo) {
  8776. var _tempel,
  8777. _temponeel,
  8778. _temptwoel,
  8779. i = recordinfo.length,
  8780. _frag = $$("frag");
  8781. //循环打印群聊天记录
  8782. while (i--) {
  8783. //U.MD.F.W.printFileContent
  8784. if (recordinfo[i].MessageContent ? recordinfo[i].MessageContent.indexOf("fileName") != -1 : recordinfo[i].GroupMessageContent.indexOf("fileName") != -1) {
  8785. _tempel = $$("div", { "className": "U_MD_F_LO" }, _frag);
  8786. _temponeel = $$("div", { "className": "U_MD_F_LOT" }, _tempel);
  8787. $$("div", { "className": "U_MD_F_LOTN", "innerHTML": recordinfo[i].MessageDescript || recordinfo[i].GroupMessageSendUsername || friendandgroupinfo.FriendsDescript || friendandgroupinfo.GroupManageName }, _temponeel);
  8788. $$("div", { "className": "U_MD_F_LOTT", "innerHTML": U.UF.D.getDateInterval(recordinfo[i].MessageSendTime || recordinfo[i].GroupMessageSendTime) }, _temponeel);
  8789. var _data = JSON.parse(recordinfo[i].MessageContent);
  8790. if (_data.fileType == "jpg" || _data.fileType == "png" || _data.fileType == "mp4") { //判断文件格式是否为图片或者视频 , 不是的话加边框
  8791. var _content = $$("div", { "style": { "cssText": "padding:8px 8px 8px 8px;background:#fff;border-radius:2px;margin-top:12px;position:relative" } }, _tempel);
  8792. } else {
  8793. var _content = $$("div", { "style": { "cssText": "padding:8px 8px 8px 8px;background:#fff;border-radius:2px;margin-top:12px;border:1px #d3d3d3 solid;background:#f9f9f9;" } }, _tempel);
  8794. }
  8795. U.MD.F.W.printFileContent(_data, _content);
  8796. } else {
  8797. _tempel = $$("div", { "className": "U_MD_F_LO" }, _frag);
  8798. _temponeel = $$("div", { "className": "U_MD_F_LOT" }, _tempel);
  8799. $$("div", { "className": "U_MD_F_LOTN", "innerHTML": recordinfo[i].MessageDescript || recordinfo[i].GroupMessageSendUsername || friendandgroupinfo.FriendsDescript || friendandgroupinfo.GroupManageName }, _temponeel);
  8800. $$("div", { "className": "U_MD_F_LOTT", "innerHTML": U.UF.D.getDateInterval(recordinfo[i].MessageSendTime || recordinfo[i].GroupMessageSendTime) }, _temponeel);
  8801. $$("div", { "className": "U_MD_F_LOD", "innerHTML": recordinfo[i].MessageContent || recordinfo[i].GroupMessageContent }, _tempel);
  8802. }
  8803. }
  8804. el.appendChild(_frag);
  8805. }
  8806. //#endregion
  8807. /**
  8808. * 发送消息统一调用函数
  8809. * @param {object} 统一发送好友信息id
  8810. ----------好友id
  8811. ----------群id
  8812. ----------群发id
  8813. * @param {element} 发送信息原
  8814. * @param {element} 打印区域函数
  8815. * @param {boolean} 判断消息
  8816. ---------- true 获取群消息 或者发送 群消息
  8817. ---------- false 获取好友消息或者 获取好友消息
  8818. * @param {boolean} 是否清空发送
  8819. */
  8820. U.MD.F.H.sendFriendOrGroupChatMessage = function (friendandgroupinfo, chateditel, chatcontentnewsel, isgroup, isupload) {
  8821. var _newsinfo, //发送消息的打印的变量
  8822. _chatcontent = chateditel.innerHTML, //发送的内容
  8823. _hours = new Date().getHours().toString()[1] ? new Date().getHours() : '0' + new Date().getHours(), //判断时间是否是两位数不是则在前面加0
  8824. _minutes = new Date().getMinutes().toString()[1] ? new Date().getMinutes() : '0' + new Date().getMinutes(),
  8825. _seconds = new Date().getSeconds().toString()[1] ? new Date().getSeconds() : '0' + new Date().getSeconds(),
  8826. _friendid = friendandgroupinfo.UserId || friendandgroupinfo.GroupManageID; //发送给好友或者群的id
  8827. //不为空允许发送内容
  8828. if (_chatcontent.isHtmlNull()) {
  8829. U.MD.F.H.sendChatMessageToDb(_friendid, _chatcontent, null, isgroup); //调用发送数据库的函数
  8830. //发送消息的信息
  8831. _newsinfo = [{
  8832. "UserId": US.userInfo.UserId,
  8833. "Time": _hours + ":" + _minutes + ":" + _seconds,
  8834. "Content": _chatcontent,
  8835. "IMG": US.userInfo.UserThumbnailImageHead,
  8836. "Name": US.userInfo.UserNickName
  8837. }]
  8838. //内容显示在聊天区域
  8839. if (isgroup) {
  8840. U.MD.F.W.printGroupChatMessage(chatcontentnewsel, _newsinfo, true); //打印在群聊天
  8841. }
  8842. else {
  8843. U.MD.F.W.printFriendChatMessage(chatcontentnewsel, _newsinfo, true); //打印在好友聊天
  8844. }
  8845. //判断是否是上传文件,如果是上传文件,那么不清空输入区域的内容直接显示到聊天区域。
  8846. if (!isupload) {
  8847. chateditel.innerText = ""
  8848. }
  8849. }
  8850. }
  8851. /**
  8852. * 查看聊天 好友或者群
  8853. * @param {element} 发送好友的id
  8854. * @param {string} 发送的内容
  8855. ----------如果这里为空 那么就是获取好友信息
  8856. * @param {function} 发送成功回调函数
  8857. * @param {boolean} 判断消息
  8858. ---------- true 获取群消息 或者发送 群消息
  8859. ---------- flase 获取好友消息或者 获取好友消息
  8860. */
  8861. U.MD.F.H.sendChatMessageToDb = function (friendid, message, cb, isgroup) {
  8862. var _friendorgroupinfo, //好友或者群信息
  8863. _userinfo = US.userInfo; //用户的信息
  8864. //发送群消息到数据库
  8865. if (isgroup) {
  8866. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SendMessageToGroup", friendid, Guid.newGuid(), _userinfo.UserId, message, _userinfo.UserNickName], function () { }, [""]);
  8867. }
  8868. //发送好友消息到数据库
  8869. else {
  8870. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SentMessageToFriend", _userinfo.UserId, friendid, _userinfo.UserNickName, message, 0, false], function () { }, [""]);
  8871. }
  8872. //发送消息后根据id得到发送的消息的群或者用户id得到详细信息,然后把这个群或者用户的信息变成第一个最近联系人的第一个
  8873. //如果是群,则获取群用户信息
  8874. if (isgroup) {
  8875. _friendorgroupinfo = U.Json.select(US.friend.group, { "GroupManageID": friendid })[0];
  8876. }
  8877. //如果是聊天好友,则获取群用户信息
  8878. else {
  8879. //从最近聊天里面获取信息
  8880. _friendorgroupinfo = U.Json.select(US.friend.recentcontacts, { "UserId": friendid })[0];
  8881. //如果最近聊天里面没有获取用户的信息,那么就从好友里面获取
  8882. if (_friendorgroupinfo) {
  8883. //获取好友群消息
  8884. _friendorgroupinfo = U.Json.select(US.friend.friends, { "UserId": friendid })[0];
  8885. }
  8886. }
  8887. //如果判断发送的好友或者是群确实在用户好友里,则把该用户设置为最近联系人
  8888. if (_friendorgroupinfo) {
  8889. U.MD.F.H.recentContacts(_friendorgroupinfo); //设置最近联系人
  8890. }
  8891. }
  8892. /**
  8893. * 查看聊天 好友或者群
  8894. * @param {element} 发送好友的id
  8895. * @param {string} 发送的内容
  8896. ----------如果这里为空 那么就是获取好友信息
  8897. * @param {function} 发送成功回调函数
  8898. * @param {boolean} 判断消息
  8899. ---------- true 获取群消息 或者发送 群消息
  8900. ---------- flase 获取好友消息或者 获取好友消息
  8901. */
  8902. U.MD.F.H.getFriendOrGroupNews = function (friendid, cb, isgroup) {
  8903. var _userinfo = US.userInfo; //获取用户的资料
  8904. //如果是群信息获取
  8905. if (isgroup) {
  8906. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupUnreadMessage", _userinfo.UserId, friendid], cb, ["", friendid, isgroup]);
  8907. }
  8908. //如果是好友信息的获取
  8909. else {
  8910. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendUnreadMessage", _userinfo.UserId, friendid], cb, ["", friendid, isgroup]);
  8911. }
  8912. }
  8913. /**
  8914. * 生成最近联系人
  8915. * @param {object} 用户信息
  8916. */
  8917. U.MD.F.H.recentContacts = function (userinfo) {
  8918. var _recentcontactsel,
  8919. _num,
  8920. _recentcontactsinfo,
  8921. _contentel = U.selectEl("#U_MD_F_H_ZLZ")[0];
  8922. if (US.friend.recentcontacts) {
  8923. //判断联系人是否已经在最近联系人中
  8924. _num = US.friend.recentcontacts.objIndexOf({ "UserId": userinfo.UserId }) || US.friend.recentcontacts.objIndexOf({ "GroupManageID": userinfo.GroupManageID });
  8925. //如果存在最近联系人,那么直接从最近联系人中找到
  8926. if (_num > -1) {
  8927. _recentcontactsinfo = US.friend.recentcontacts.splice(_num, 1)[0];
  8928. }
  8929. //否则生成一个新的最近联系人
  8930. else {
  8931. //生成一个新的最近联系人
  8932. _recentcontactsinfo = new U.MD.F.T.recentContactsEntity(userinfo.GroupManageID || userinfo.UserId,
  8933. userinfo.GroupManageName || userinfo.UserName, userinfo.UserImageHead || "", userinfo.UserNickName || "",
  8934. userinfo.UserThumbnailImageHead || "", userinfo.maxMessageSendTime || new Date(),
  8935. userinfo.GroupManageDescript || userinfo.FriendsDescript, userinfo.GroupManageRemark || userinfo.UserIndividualitysignature || "",
  8936. userinfo.IsLogin || 3, userinfo.GroupManageID ? 1 : 0);
  8937. }
  8938. //如果存在就直接置顶 不存在添加新的
  8939. US.friend.recentcontacts.unshift(_recentcontactsinfo);
  8940. //找到最近联系人按钮
  8941. _recentcontactsel = U.selectEl("#U_MD_F_H_ZLTA").childs()[0];
  8942. _recentcontactsel = U.selectEl(_recentcontactsel).Child()[0];
  8943. //如果当前显示的不是好友、群而是最近联系人,那么则重新打印
  8944. if (_recentcontactsel.className.indexOf("U_MD_F_H_ZLTSO") > -1) {
  8945. _recentcontactsel = U.selectEl("[tid='" + (userinfo.GroupManageID || userinfo.UserId + "']"), U.selectEl("#U_MD_F_H_ZLZ")[0])[0]; //获取最近联系人
  8946. //如果最近联系人原本就存在,则直接追加到最前面
  8947. if (_recentcontactsel) {
  8948. ($(_recentcontactsel).appendTo(_contentel, 0, _contentel.firstChild)); //追加到第一个
  8949. }
  8950. //否则打印最近联系人
  8951. else {
  8952. U.MD.F.printFriendOrGroup(_contentel, US.friend.recentcontacts[0], true); //插入最新联系人在最前面
  8953. }
  8954. }
  8955. }
  8956. }
  8957. /**
  8958. *检查当前页数的前后两页是否有消息记录,没有则取消点击事件
  8959. *
  8960. *
  8961. */
  8962. //U.MD.F.H.nextOrPreviousNoRecord = function (el, friendandgroupinfo, page, isgroup) {
  8963. // var _previouspage = page - 1,
  8964. // _nextpage = page + 1,
  8965. // _recentcontactsel = el,
  8966. // _friendandgroupinfo = friendandgroupinfo,
  8967. // _previousend = _previouspage * 20, //分页的结束位置
  8968. // _previousstart = _previousend - 20, //分页的开始位置
  8969. // _nextend = _nextpage * 20, //分页的结束位置
  8970. // _nextstart = _nextend - 20; //分页的开始位置
  8971. // //群的获取聊天记录
  8972. // if (isgroup) {
  8973. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupChatHistory", friendandgroupinfo.GroupManageID, _previousstart, _previousend], function (r) {
  8974. // if (!r.value.length) {
  8975. // el.children[1].children[3].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_firstPage.png)';
  8976. // el.children[1].children[4].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_previousPage.png)'
  8977. // el.children[1].children[4].onclick = function () { };
  8978. // }
  8979. // else {
  8980. // el.children[1].children[3].style.cssText += 'background-position: -891px -481px;background-image: url(/img/YS2017.png)';
  8981. // el.children[1].children[4].style.cssText += 'background-position: -924px -481px;background-image: url(/img/YS2017.png);'
  8982. // el.children[1].children[4].onclick = function () {
  8983. // U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _previouspage, isgroup);
  8984. // };
  8985. // }
  8986. // }, ["", el, friendandgroupinfo, page, isgroup]);
  8987. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupChatHistory", friendandgroupinfo.GroupManageID, _nextstart, _nextend], function (r) {
  8988. // if (!r.value.length) {
  8989. // el.children[1].children[6].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_lastPage.png)'
  8990. // el.children[1].children[5].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_nextPage.png)'
  8991. // el.children[1].children[5].onclick = function () { };
  8992. // } else {
  8993. // el.children[1].children[6].style.cssText += 'background-position: -987px -481px;background-image: url(/img/YS2017.png);'
  8994. // el.children[1].children[5].style.cssText += 'background-position: -957px -481px;background-image: url(/img/YS2017.png);'
  8995. // el.children[1].children[5].onclick = function () {
  8996. // U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _nextpage, isgroup);
  8997. // };
  8998. // }
  8999. // }, ["", el, friendandgroupinfo, page, isgroup]);
  9000. // }
  9001. // //好友的获取聊天记录
  9002. // else {
  9003. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendChatHistory", US.userInfo.UserId, friendandgroupinfo.UserId, _previousstart, _previousend], function (r) {
  9004. // if (!r.value.length) {
  9005. // el.children[1].children[3].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_firstPage.png)';
  9006. // el.children[1].children[4].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_previousPage.png)'
  9007. // el.children[1].children[4].onclick = function () { };
  9008. // } else {
  9009. // el.children[1].children[3].style.cssText += 'background-position: -891px -481px;background-image: url(/img/YS2017.png)';
  9010. // el.children[1].children[4].style.cssText += 'background-position: -924px -481px;background-image: url(/img/YS2017.png);'
  9011. // el.children[1].children[4].onclick = function () {
  9012. // U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _previouspage, isgroup);
  9013. // };
  9014. // }
  9015. // }, ["", el, friendandgroupinfo, page, isgroup]);
  9016. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendChatHistory", US.userInfo.UserId, friendandgroupinfo.UserId, _nextstart, _nextend], function (r) {
  9017. // if (!r.value.length) {
  9018. // el.children[1].children[6].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_lastPage.png)'
  9019. // el.children[1].children[5].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_nextPage.png)'
  9020. // el.children[1].children[5].onclick = function () { };
  9021. // } else {
  9022. // el.children[1].children[6].style.cssText += 'background-position: -987px -481px;background-image: url(/img/YS2017.png);'
  9023. // el.children[1].children[5].style.cssText += 'background-position: -957px -481px;background-image: url(/img/YS2017.png);'
  9024. // el.children[1].children[5].onclick = function () {
  9025. // U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _nextpage, isgroup);
  9026. // };
  9027. // }
  9028. // }, ["", el, friendandgroupinfo, page, isgroup]);
  9029. // }
  9030. //}
  9031. //#endregion
  9032. ;
  9033. ///<jscompress sourcefile="Manage.js" />
  9034. /*
  9035. 好友管理器中心 包含了 删除好友 修改好友名字等接口
  9036. */
  9037. Namespace.register("U.MD.F.M"); //好友管理器的命名空间
  9038. //#region 添加好友分组
  9039. /**
  9040. * 弹出好友分组
  9041. *
  9042. */
  9043. U.MD.F.M.createFriendGroupPopup = function () {
  9044. var _tempel,
  9045. _temponeel,
  9046. _temptwoel;
  9047. //创建好友分组的样式
  9048. _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNLFZ U_MD_F_G" });
  9049. _temponeel = $$("div", {}, _tempel)
  9050. _temptwoel = $$("input",
  9051. {
  9052. "placeholder": "请输入你要创建的分组",
  9053. "onfocus": function () {
  9054. U.UF.MR.inputPlaceholder(this, '请输入你要创建的分组名', "")
  9055. },
  9056. "onblur": function () {
  9057. U.UF.MR.inputPlaceholder(this, "", '请输入你要创建的分组名');
  9058. }
  9059. }, _temponeel);
  9060. //弹出好友对话框
  9061. U.UF.UI.confirm(_tempel, function () {
  9062. U.MD.F.M.createFriendGroup(_temptwoel);
  9063. }); //创建一个对话框
  9064. }
  9065. /**
  9066. * 确定添加好友
  9067. *
  9068. * @param {string} 好友分组id
  9069. */
  9070. U.MD.F.M.createFriendGroup = function (inputel) {
  9071. var _value = inputel.value, //好友分组名字
  9072. _groupid = Guid.newGuid(); //好友分组id
  9073. //好友分组的名字不能大于20
  9074. if (_value.length > 20) {
  9075. U.alert("分组名不可超过20个字符");
  9076. }
  9077. //好友分组名字必须填写
  9078. else if (!_value.isStrNull() && _value != inputel.defaultValue) {
  9079. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "CreateFriendClass", _groupid, US.userInfo.UserId, _value, ""], U.MD.F.M.asynCreateFriendGroup, ["", _value, _groupid]); //发送添加分组的请求
  9080. }
  9081. //没有输入的提示
  9082. else {
  9083. U.alert("请输入正确的群名");
  9084. }
  9085. }
  9086. //添加好友分组异步
  9087. U.MD.F.M.asynCreateFriendGroup = function (r) {
  9088. var _groupinfo,
  9089. _context = r.context;
  9090. r = r.value; //得到服务器返回的值
  9091. _groupinfo = new U.MD.F.T.friendGroupEntity(_context[2], _context[1], ""); //初始化一个好友分组
  9092. //在好友数组的全局变量中添加好友分组的信息
  9093. US.friend.allclass.push(_groupinfo);
  9094. //重新点击打印好友分组,重新刷新分组
  9095. U.selectEl($("#U_MD_F_H_ZLTA").Child()[1]).Child()[0].onclick();
  9096. //提示创建成功
  9097. U.alert("创建" + _context[1] + "分组成功");
  9098. }
  9099. //#endregion
  9100. //#region 删除好友
  9101. /**
  9102. * 删除好友
  9103. *
  9104. * @param {object} 删除用户信息
  9105. */
  9106. U.MD.F.M.deleteFriend = function (friendinfo, callback) {
  9107. //数据库中删除好友
  9108. U.A.Request(US.FRIEND, ["DeleteFriend", US.userInfo.UserId, friendinfo.FriendsID, friendinfo.UserId], U.MD.F.M.asynDeleteFriend, ["", friendinfo, callback]); //ajax删除好友
  9109. }
  9110. /**
  9111. * 删除好友异步
  9112. *
  9113. * @param {object} 删除用户信息
  9114. */
  9115. U.MD.F.M.asynDeleteFriend = function (r) {
  9116. var _context = r.context,
  9117. _message = "好友已删除",
  9118. _friendinfo = _context[1]; //好友的信息;
  9119. U.Json.del(US.friend.friends, { "FriendsID": _friendinfo.FriendsID }); //好友集里删除好友
  9120. U.Json.del(US.friend.recentcontacts, { "UserId": _friendinfo.UserId }); //最近聊天集里删除好友
  9121. //判断是否在当前好友选取下
  9122. if ($('#U_MD_F_H_ZLTA .U_MD_F_H_ZLTOO')[0]) {
  9123. var _friendclassinfo = U.Json.select(US.friend.allclass, { "FriendsGroupID": _friendinfo.FriendsGroupID })[0], //好友分组的信息
  9124. _friendclassuserinfo = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo.FriendsGroupID }), //好友分组的信息
  9125. _el = U.selectEl(".U_MD_F_H_ZLZOCO"), //获取用户的所有好友
  9126. _friendel = U.selectEl('#g' + _friendclassinfo.FriendsGroupID).Child(),
  9127. _switchbootom = U.selectEl("#U_MD_F_H_ZLTA").Child(); //好友或者群切换按钮
  9128. //删除好友元素
  9129. for (var i = 0; i < _el.length; i++) {
  9130. if (_el[i].tid == _friendinfo.UserId) {//获取指定的删除的好友
  9131. U.selectEl(_el[i]).remove(); //删除指定的好友元素
  9132. U.MD.F.W.delteFriendChat(_el[i].tid, U.selectEl("#U_MD_F")[0]); //删除指定的好友聊天窗口
  9133. _friendel[0].innerHTML = _friendclassinfo.FriendsGroupName + "(" + (_friendclassuserinfo.length) + ")"; //修改分组长度
  9134. break;
  9135. }
  9136. }
  9137. //修改好友信息
  9138. //如果所有好友都清空了,那么则打印空好友的提示
  9139. if (US.friend.allclass.length == 1 && !_friendclassuserinfo.length) {
  9140. U.MD.F.printHasNoFriend(_friendel[1]);
  9141. }
  9142. _message = '好友' + (_friendinfo.UserNickName || _friendinfo.UserName) + '已从好友列表中删除';
  9143. }
  9144. //判断是否在最近聊天选取下
  9145. if ($('#U_MD_F_H_ZLTA .U_MD_F_H_ZLTTO')[0]) {
  9146. var _el = U.selectEl(".U_MD_F_H_ZLZOCO"); //获取用户的所有好友
  9147. //删除好友元素
  9148. for (var i = 0; i < _el.length; i++) {
  9149. if (_el[i].tid == _friendinfo.UserId) {//获取指定的删除的好友
  9150. U.selectEl(_el[i]).remove(); //删除指定的好友元素
  9151. U.MD.F.W.delteFriendChat(_el[i].tid, U.selectEl("#U_MD_F")[0]); //删除指定的好友聊天窗口
  9152. break;
  9153. }
  9154. }
  9155. }
  9156. var _win = U.selectEl('.U_MD_F_TO[user="9dff9339-2d37-4072-b62e-3b0a027ae997"]');
  9157. _win[0] && U.selectEl('.U_MD_F_TOC', _win)[0].onclick();
  9158. U.UF.C.isFunction(_context[2]) && _context[2]();
  9159. U.alert(_message);
  9160. };
  9161. //#endregion
  9162. //#region 添加好友
  9163. /**
  9164. * 添加好友
  9165. *
  9166. * @param {object} 用户信息
  9167. * @param {object} 回调函数
  9168. * @param {object} 删除用户信息
  9169. */
  9170. U.MD.F.M.addFriend = function (userinfo, cb, typename) {
  9171. if (!U.MD.U.L.isLogin()) {
  9172. typename = typename || "1"; //判断是添加直接对方为好友还是添加对方为好友需好友验证。
  9173. //无法加本人为好友 同时不可与本人对话
  9174. if (userinfo.UserId != US.userInfo.UserId) {
  9175. //在好友里获取用户
  9176. var _friendinfo = U.Json.select(US.friend.friends, { "UserId": userinfo.UserId })[0];
  9177. //判断是否已经添加了用户
  9178. if (!_friendinfo) {
  9179. U.MD.F.M.addFriendForm(userinfo, cb, typename); //弹出添加好友框
  9180. }
  9181. //如果用户已经是自己的好友,那么直接跳出聊天
  9182. else {
  9183. U.MD.F.W.popupFriendsForm(_friendinfo); //弹出聊天框
  9184. }
  9185. } else { U.Alert("不可以添加自己为好友哟!"); }
  9186. }
  9187. else { U.Alert("快速登录关注他(她)吧"); }
  9188. }
  9189. /**
  9190. * 添加好友
  9191. *
  9192. * @param {object} 用户信息
  9193. * @param {object} 删除用户信息
  9194. */
  9195. U.MD.F.M.addFriendForm = function (userinfo, cb, typename) {
  9196. var i,
  9197. _formel,
  9198. _tempel,
  9199. _temponeel,
  9200. _temptwoel,
  9201. _tempthreeel,
  9202. _tempfourel,
  9203. _friendgroupinfo = US.friend.allclass; //好友分组
  9204. var _date = new Date();
  9205. //创建添加好友信息分组信息
  9206. _tempel = $$("div", { "className": "U_MD_U_UV_IAC" });
  9207. _temponeel = $$("div", { "className": "U_MD_U_UV_IACA" }, _tempel);
  9208. _temptwoel = $$("div", { "className": "U_MD_U_UV_IACL" },
  9209. _temponeel); _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACLT" }, _temptwoel);
  9210. $$("img",
  9211. {
  9212. "onerror": U.MD.C.imgError,
  9213. "title": "点击查看",
  9214. "src": U.MD.C.getHeadImage(userinfo.UserThumbnailImageHead)
  9215. },
  9216. _tempthreeel);
  9217. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACLB" }, _temptwoel);
  9218. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": userinfo.UserNickName || userinfo.UserName }, _tempthreeel);
  9219. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": "性别:" + (userinfo.UserSex ? "男" : "女") }, _tempthreeel);
  9220. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": "年龄:" + (U.UF.D.getYearMonthDay(_date.toLocaleDateString())[3] - U.UF.D.getYearMonthDay(userinfo.Birthday)[3]) }, _tempthreeel);
  9221. _temptwoel = $$("div", { "className": "U_MD_U_UV_IACR" }, _temponeel);
  9222. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACRT" }, _temptwoel);
  9223. $$("div", { "className": "U_MD_U_UV_IACRTL", "innerHTML": "备注姓名:" }, _tempthreeel);
  9224. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACRTR" }, _tempthreeel);
  9225. _memoName = $$("input", { "value": userinfo.UserNickName || userinfo.UserName }, _tempthreeel);
  9226. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACRB" }, _temptwoel);
  9227. $$("div", { "className": "U_MD_U_UV_IACRBL", "innerHTML": "分&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp组:" }, _tempthreeel);
  9228. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACRBR" },
  9229. _tempthreeel);
  9230. _tempfourel = $$("select", {}, _tempthreeel);
  9231. //添加用户到制定的好友分组处理
  9232. _tempfourel.options.length = _friendgroupinfo.length;
  9233. for (i = 0; i < _friendgroupinfo.length; i++) {
  9234. _tempfourel.options[i].text = _friendgroupinfo[i].FriendsGroupName;
  9235. }
  9236. //创建好友分组的弹框
  9237. _formel = U.UF.UI.confirm(_tempel, function () {
  9238. U.MD.F.M.addFriendToDb(userinfo, cb, _tempfourel, _temponeel, typename, _memoName.value);
  9239. });
  9240. _formel.form.style.width = "400px";
  9241. }
  9242. /**
  9243. * 确定添加好友
  9244. *
  9245. * @param {object} 删除用户信息
  9246. * @param {function} 删除用户信息
  9247. */
  9248. U.MD.F.M.addFriendToDb = function (userinfo, cb, selectel, loadingel, typename, _memoName) {
  9249. var _friendgroupinfo = US.friend.allclass[selectel.selectedIndex], //获取用户选择的分组
  9250. _groupid = _friendgroupinfo.FriendsGroupID, //好友分组id
  9251. _friendid = Guid.newGuid(), //用户在分组里面的唯一识别id
  9252. _messageid = Guid.newGuid(); //用户发送的消息的唯一识别id
  9253. _descript = U.selectEl(".U_MD_U_UV_IACRTR")[0].childNodes[0].value; //用户备注
  9254. //添加好友分组的ajax
  9255. //对方发送添加好友信息给你,同意后把用户直接加到好友分组里
  9256. if (typename == "0") {
  9257. U.A.Request(US.FRIEND, ["AgreeAddFriend", US.userInfo.UserId, userinfo.UserId, _friendid, _groupid, (userinfo.UserNickName || userinfo.UserName), userinfo.MessageContent.toUpperCase()],
  9258. U.MD.F.M.asynAddFriendToDb, [loadingel, _groupid, userinfo, _friendgroupinfo, cb, _friendid]); //添加好友到默认分组
  9259. }
  9260. //添加用户为好友
  9261. else {
  9262. U.A.Request(US.CD, ([US.DB, "UseStudio_Friends", "AddFriend", US.userInfo.UserId, _friendid, userinfo.UserId, _groupid, _messageid, (userinfo.UserNickName || userinfo.UserName), ("" || _descript)]), U.MD.F.M.asynAddFriendToDb, [loadingel, _groupid, userinfo, _friendgroupinfo, cb, _friendid]); //添加好友到默认分组
  9263. }
  9264. //提示
  9265. //U.alert("正在添加中...");
  9266. return false;
  9267. }
  9268. /**
  9269. * 添加好友到分组异步
  9270. *
  9271. * @param {object} 添加成功后的信息
  9272. */
  9273. U.MD.F.M.asynAddFriendToDb = function (r) {
  9274. var _context = r.context,
  9275. _loadingel = _context[0], //loading元素
  9276. _groupid = _context[1], //群id
  9277. _userinfo = _context[2], //用户的信息
  9278. _friendgroupinfo = _context[3], //
  9279. _cb = _context[4],
  9280. _friendid = _context[5];
  9281. r = r.value;
  9282. //同意添加对方为好友的时候处理
  9283. if (r) {
  9284. //设置添加好友
  9285. U.MD.F.M.displayAddFriend(_userinfo, _friendid, _groupid, _friendgroupinfo, r);
  9286. //添加好友的回调处理
  9287. if (_cb) {
  9288. _cb();
  9289. }
  9290. U.alert('添加好友成功,快和他发起聊天吧');
  9291. }
  9292. //添加对方为好友,给对方发送消息处理
  9293. else {
  9294. U.alert("您的请求已经发送,请等待对方的同意。");
  9295. }
  9296. //关闭loading的弹窗
  9297. U.selectEl(_loadingel).Parent({ usform: "true" }).remove();
  9298. }
  9299. /**
  9300. * 添加好友成功后的处理
  9301. *
  9302. * @param {object} 添加成功后的信息
  9303. */
  9304. U.MD.F.M.displayAddFriend = function (userinfo, friendid, classid, friendgroupinfo, r) {
  9305. var _childs,
  9306. _groupel,
  9307. //好友分组的信息
  9308. _friendinfo = new U.MD.F.T.friendEntity(userinfo.UserIndividualitysignature, userinfo.UserId, userinfo.UserImageHead,
  9309. userinfo.UserThumbnailImageHead, userinfo.UserNickName || userinfo.UserName,
  9310. userinfo.UserName, friendid, userinfo.UserNickName || userinfo.UserName, classid, 0);
  9311. _friendinfo["IsLogin"] = r[1] == "True" ? 1 : 0; //设置用户在线
  9312. US.friend.friends.unshift(_friendinfo); //添加好友到好友列表里
  9313. //打印聊天显示窗体
  9314. _groupel = U.selectEl("#g" + classid);
  9315. if (_groupel[0]) {
  9316. _childs = U.selectEl(_groupel).Child(); //0 好友分组信息 1好友信息
  9317. //如果是第一次添加好友,那么提示好友的信息删除
  9318. if (US.friend.friends.length == 1) {
  9319. U.selectEl("#U_MD_F_H_ZR")[0].innerText = "";
  9320. };
  9321. //打印添加的好友信息
  9322. U.MD.F.printFriendOrGroup(_childs[1], [_friendinfo], true); //打印好友
  9323. //好友分组信息
  9324. _childs[0].innerText = friendgroupinfo["FriendsGroupName"] + "(" + (U.Json.select(US.friend.friends, { "FriendsGroupID": classid }).length) + ")";
  9325. };
  9326. //添加成功后打开好友聊天对话
  9327. U.MD.F.W.popupFriendsForm(_friendinfo);
  9328. //右边的好友窗体也重新打印
  9329. if (!US.friend.recentcontacts.length) {
  9330. U.MD.F.printRightFormFriend(US.friend.friends, U.selectEl("#U_MD_F_H_RC")[0]);
  9331. }
  9332. }
  9333. //#endregion
  9334. ;
  9335. ///<jscompress sourcefile="Message.js" />
  9336. Namespace.register("U.MD.F.N"); //好友消息命名空间
  9337. U.MD.F.N.news = []; //用户所有的消息数组
  9338. /**
  9339. * 好友消息服务
  9340. *
  9341. * @param {string} 用户id
  9342. */
  9343. U.MD.F.N.messageService = function (userid) {
  9344. if (US.friend.allclass && userid && userid.length == 36) {
  9345. //获取好友未读消息
  9346. U.A.Request(US.USER, ["GetAllUnreadMessage", userid], U.MD.F.N.asynMessageService);
  9347. }
  9348. }
  9349. /**
  9350. * 这个是消息的异步处理
  9351. *
  9352. * @param {object} 后台返回数据的ajax对象
  9353. * 0 好友未读消息 1 用户在服务器的状态
  9354. */
  9355. U.MD.F.N.asynMessageService = function (r) {
  9356. r = r.value;
  9357. if (r) { //如果后台有返回数据的处理
  9358. var i,
  9359. _userinfo = US.userInfo, //登录用户的信息
  9360. _statenew = r[1];
  9361. //如果状态服务器里返回的数据在前端最终生成是字符串,那么就是用户的登录状态的变化
  9362. if (typeof _statenew == "string") {
  9363. U.MD.F.N.inlineNotice(_statenew);
  9364. }
  9365. //否则就是用户获取到自己的好友和其他的信息
  9366. else {
  9367. U.MD.F.N.friendOnlineAndOffline(_statenew); //用户上下线设置
  9368. U.MD.F.N.messageHandle(r); //聊天消息的处理
  9369. }
  9370. }
  9371. }
  9372. /**
  9373. * 好友的上下线处理
  9374. *
  9375. * @param {object} 后台返回数据的ajax对象
  9376. * 0 好友未读消息 1 用户在服务器的状态
  9377. */
  9378. U.MD.F.N.friendOnlineAndOffline = function (statenew) {
  9379. var i,
  9380. j,
  9381. k,
  9382. _num,
  9383. _el,
  9384. _idarr,
  9385. _friendform = U.selectEl("#U_MD_F_H_ZLZ")[0], //好友窗体
  9386. _userid = US.userInfo.UserId, //登录用户id
  9387. _friendinfo = US.friend; //好友信息数组
  9388. //循环上下线通知 0是下线的用户,1是上线的用户
  9389. for (i = 0; i < statenew.length; i++) {
  9390. //如果有上线或者下线的用户
  9391. if (statenew[i].length) {
  9392. //获取所有上下线的数组
  9393. _idarr = statenew[i].join(",");
  9394. //循环好友的数组 0 好友分组 1 所有的好友 2 好友群 3 群好友 4 在线用户 中的 1 、 3 、4
  9395. for (j = 0; j < 3; j++) {
  9396. _num = j = 0 ? 1 : j + 2; //1、3、4的规律算法
  9397. for (k = 0; k < _friendinfo[_num].length; k++) {
  9398. //如果用户在上下线操作里面
  9399. if (_idarr.indexOf(_friendinfo[_num][k].UserId) > -1) {
  9400. _friendinfo[_num][k].IsLogin = i; //设置是否登录的处理
  9401. }
  9402. }
  9403. U.Json.sort(US.friend[_num], "IsLogin", 1); //上下线后重新排序
  9404. }
  9405. //把上线的用户置顶,下线的用户放在下面
  9406. for (j = 0; j < statenew[i].length; j++) {
  9407. _el = U.selectEl("[tid='" + statenew[i][j] + "']", _friendform); //找到指定的元素
  9408. if (_el[0]) {
  9409. U.selectEl(_el[0].Parent()).append(_el, null, i ? _el[0].Parent().firstChild : null);
  9410. }
  9411. }
  9412. }
  9413. }
  9414. }
  9415. /**
  9416. * 下线通知区域
  9417. *
  9418. * @param {object} 后台返回数据的ajax对象
  9419. * 0 好友未读消息 1 用户在服务器的状态
  9420. */
  9421. U.MD.F.N.inlineNotice = function (userstate) {
  9422. //其它地方登录
  9423. if (userstate == "upline") {
  9424. return; //前期允许多点登录
  9425. //其他地方登录弹出提示框
  9426. U.UF.UI.confirm($$("div", {
  9427. "style": {
  9428. "textAlign": "center",
  9429. "marginTop": "25px",
  9430. "padding": "10px 0",
  9431. "fontSize": "14px",
  9432. "color": "red"
  9433. },
  9434. "innerHTML": "您好, 您的账号在别处有登录!"
  9435. }));
  9436. U.MD.U.LO.logout(); //注销账号信息
  9437. }
  9438. //超时重新连接
  9439. else {
  9440. U.A.Request(US.FRIEND, ["UserStateLogin", US.userInfo.UserName, US.userInfo.UserPassword], function () { });
  9441. }
  9442. }
  9443. /**
  9444. * 消息查看
  9445. *
  9446. * @param {object} 0 好友和群消息 1 交互消息
  9447. */
  9448. U.MD.F.N.messageHandle = function (arr) {
  9449. //好友消息和群消息的处理
  9450. if (arr[0]) {
  9451. U.MD.F.N.friendMessageHandle(arr[0]);
  9452. }
  9453. if (arr[1]) {
  9454. U.MD.F.N.otherNews(arr[1]);
  9455. }
  9456. }
  9457. //点击查看消息
  9458. /**
  9459. * 消息查看
  9460. *
  9461. * @param {object} 0 好友和群消息 1 交互消息
  9462. */
  9463. U.MD.F.N.friendMessageHandle = function (newsarr) {
  9464. var i, j, k,
  9465. _issound,
  9466. _isnews,
  9467. _obj,
  9468. _form,
  9469. _news,
  9470. _isgroup, //是否是群消息
  9471. _verify, //消息类型
  9472. _allnews = U.MD.F.N.news //还有消息数组
  9473. ;
  9474. //循环消息数组 0 好友消息, 1群消息
  9475. for (j = 0; j < newsarr.length; j++) {
  9476. _news = newsarr[j]; //得到好友或者群消息
  9477. //判断是否存在
  9478. if (_news) {
  9479. //好友消息或者群消息循环处理 由于好友或者群消息有多种消息 如添加还有消息、好友聊天消息,进入群消息,群聊天消息等,
  9480. for (i = 0; i < _news.length; i++) {
  9481. _obj = null; //清空obj
  9482. _isgroup = _news[i].UserId == null; //判断消息是什么消息
  9483. _verify = _news[i].MessageIsVerify || 0; //如果没有消息的类型,暂时只有群消息的时候才会触发
  9484. _allnews[_verify] = _allnews[_verify] || []; //设置功能
  9485. // _verify = _verify == 6 ? 0 : _verify;
  9486. switch (_verify) {
  9487. //好友或者群聊天消息
  9488. case 0: case 6:
  9489. _news[i].MessageSendTime = U.UF.D.getYearMonthDay(_news[i].MessageSendTime) || U.UF.D.getYearMonthDay(_news[i].GroupMessageSendTime); //发送消息的时间
  9490. _form = U.MD.F.W.isCreateForm(_news[i].UserId || _news[i].GroupManageID); //判断好友消息窗口是否打开
  9491. //如果窗体存在的处理
  9492. if (_form && _form[1] && U.selectEl('#U_MD_F_H_ZA')[0].style.display == 'block' && _form[1].style.display != "none") {
  9493. //如果没有显示
  9494. U.MD.F.N.canelMarkMessage(_news[i]); //移除消息提示
  9495. //获取消息打印
  9496. U.MD.F.H.getFriendOrGroupNews(_news[i].UserId || _news[i].GroupManageID, function (r) {
  9497. U.MD.F.N.asynReceiveMessages(_isgroup, _form[1], r.value); //输出消息
  9498. }, _isgroup);
  9499. _issound = true;
  9500. continue;
  9501. }
  9502. U.MD.F.H.recentContacts(_news[i]); //生成最近联系人
  9503. break;
  9504. //1、对方添加我为好友的请求, 2、对方请求加入群, 3、用户给拉入群处理 这里不做处理下面统一处理, 4、请求对方进入群处理, 5、确认对方进入群处理
  9505. case 1: case 2: case 3: case 4: case 5:
  9506. //_allnews[_verify].push(_news[i]);
  9507. break;
  9508. }
  9509. //判断消息是否存在过
  9510. for (k = 0; k < _allnews[_verify].length; k++) {
  9511. //判断两个用户之间或者用户和群之间是否存在消息
  9512. if ((_allnews[_verify][k].GroupManageID != null && _allnews[_verify][k].GroupManageID == _news[i].GroupManageID) ||
  9513. (_allnews[_verify][k].UserId != null && _allnews[_verify][k].UserId == _news[i].UserId)) {
  9514. _obj = _allnews[_verify][k];
  9515. break;
  9516. }
  9517. }
  9518. //如果是聊天消息,存在的情况下,那么就直接添加消息总数
  9519. if ((_verify == 0 || _verify == 6) && _obj) {
  9520. //由于群的信息获取的时候都是有总数,所以不需要用叠加的方法
  9521. if (_news[i].GroupManageID) {
  9522. if (_news[i].count > _obj.count) {
  9523. _issound = true;
  9524. }
  9525. _obj.count = _news[i].count;
  9526. }
  9527. //消息的数量叠加
  9528. else {
  9529. _issound = true;
  9530. _obj.count += _news[i].count;
  9531. }
  9532. }
  9533. //添加好友消息等直接添加 if (!_obj || _verify != 2)
  9534. else {
  9535. _issound = true;
  9536. _allnews[_verify].push(_news[i]);
  9537. }
  9538. _isnews = true; //设置有消息提醒
  9539. }
  9540. }
  9541. }
  9542. //判断是否有新消息
  9543. if (_issound) {
  9544. U.MD.F.N.addNewsSound($('.U_MD_D_NewsTipsIcon')[0], _allnews);
  9545. }
  9546. //如果有消息的处理
  9547. if (_isnews) {
  9548. //弹出消息提醒
  9549. U.MD.F.N.tipsForm();
  9550. //消息提醒次数
  9551. U.MD.F.N.markUnreadMessage(newsarr);
  9552. //上面处理好信息后,重新的打印显示消息
  9553. for (i = 0; i <= 6; i++) { //消息处理
  9554. if (_allnews[i] && _allnews[i].length) { //消息存在的处理
  9555. U.MD.F.N.displayFriendMessage(_allnews[i], i); //弹出消息框
  9556. }
  9557. }
  9558. }
  9559. }
  9560. /**
  9561. * 消息提醒窗体
  9562. *
  9563. * @param {string} 时间字符串
  9564. */
  9565. U.MD.F.N.tipsForm = function () {
  9566. var _friendel = U.selectEl("#U_MD_D_MG_AFT")[0];
  9567. _friendel.innerText = "";
  9568. if (!$('.U_MD_F_N_IconAnimation')[0]) {
  9569. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className += ' U_MD_F_N_IconAnimation';
  9570. }
  9571. U.selectEl('.U_MD_D_NewsTipsIcon')[0].onmouseover = function () {
  9572. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className = 'U_MD_D_NewsTipsIcon';
  9573. if (!$("#U_MD_F_N_Message")[0]) {
  9574. //弹出消息的处理
  9575. new U.UF.UI.form(US.userInfo.UserNickName, _friendel,
  9576. {
  9577. "id": "U_MD_F_N_Message",
  9578. "style": { 'position': 'absolute', "width": "233px", "height": "343px", "left": "-100px", "bottom": "52px", "background": "#ffffff", "padding": "0", "border": "0", "maxWidth": "300px" }
  9579. },
  9580. {
  9581. "istop": true,
  9582. "isdrag": false,
  9583. "isstretching": false,
  9584. "isenlarge": false,
  9585. "isnarrow": false,
  9586. "isclose": false,
  9587. "closecallback": function () {
  9588. U.MD.F.N.clearAllNews();
  9589. }
  9590. }, { 'id': 'U_MD_F_N_MessageHead', 'style': { 'text-indent': '10px', 'height': '30px', 'line-height': '30px', 'background-color': '#fff', 'color': '#000', 'font-size': '14px', 'overflow': 'hidden', 'padding-top': '5px', 'margin-bottom': '5px' } },
  9591. '', '', U.selectEl('.U_MD_D_NewsTipsIcon')[0]);
  9592. if (!$('.U_MD_F_N_MessageTop')[0]) {
  9593. $$('div', {
  9594. 'innerHTML': '全部忽略', 'className': 'U_MD_F_N_MessageTop', 'onclick': function () {
  9595. U.UF.EV.stopBubble();
  9596. U.MD.F.N.clearAllNews();
  9597. U.MD.F.N.delAllNewsTips();
  9598. U.MD.F.N.canelAllMarkMessage();
  9599. }
  9600. }, U.selectEl('#U_MD_F_N_MessageHead')[0]);
  9601. }
  9602. }
  9603. else {
  9604. U.selectEl("#U_MD_F_N_Message")[0].style.display = "block";
  9605. U.MD.F.N.noNewsTips();
  9606. }
  9607. }
  9608. U.selectEl('.U_MD_D_NewsTipsIcon')[0].onmouseout = function () {
  9609. if ($("#U_MD_D_MG_AFT").Child().length != 0) {
  9610. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className += ' U_MD_F_N_IconAnimation';
  9611. };
  9612. U.selectEl("#U_MD_F_N_Message")[0].style.display = "none";
  9613. }
  9614. }
  9615. /**
  9616. * 发送消息时间处理
  9617. *
  9618. * @param {string} 时间字符串
  9619. */
  9620. U.MD.F.N.messagesendTime = function (time) {
  9621. var _reg = RegExp(/Date/); //检查字符串是不是时间戳
  9622. if (time.match(_reg)) {
  9623. time = time.replace(/[^0-9]/ig, ""); //提取数字
  9624. var _date = new Date(parseInt(time));
  9625. var _year = _date.getFullYear();
  9626. var _month = _date.getMonth() + 1;
  9627. var _day = _date.getDate();
  9628. return _year + '-' + _month + '-' + _day;
  9629. }
  9630. return time;
  9631. }
  9632. /**
  9633. * 发送消息时间处理
  9634. *
  9635. * @param {string} 时间字符串
  9636. */
  9637. U.MD.F.N.getHoursMinutesSeconds = function (time) {
  9638. var _reg = RegExp(/Date/); //检查字符串是不是时间戳
  9639. if (time && time.match(_reg)) {
  9640. time = time.replace(/[^0-9]/ig, ""); //提取数字
  9641. var _date = new Date(parseInt(time)),
  9642. _hours = _date.getHours().toString()[1] ? _date.getHours() : '0' + _date.getHours(), //判断时间是否是两位数不是则在前面加0
  9643. _minutes = _date.getMinutes().toString()[1] ? _date.getMinutes() : '0' + _date.getMinutes(),
  9644. _seconds = _date.getSeconds().toString()[1] ? _date.getSeconds() : '0' + _date.getSeconds();
  9645. return _hours + ':' + _minutes + ':' + _seconds;
  9646. }
  9647. return time;
  9648. }
  9649. /**
  9650. * 消息提示打印处理
  9651. *
  9652. * @param {array} 需要打印的消息数组
  9653. */
  9654. U.MD.F.N.displayFriendMessage = function (news, verify) {
  9655. var i,
  9656. _username,
  9657. _descript,
  9658. _newel,
  9659. _newael,
  9660. _cb,
  9661. _newcontent,
  9662. _frag = $$("frag");
  9663. //循环消息的处理
  9664. for (i = 0; i < news.length; i++) {
  9665. //创建消息元素
  9666. _newel = $$("div", { "className": "U_MD_D_MG_OO", "title": "消息", "tid": "O" + news[i].MessageID }, _frag);
  9667. _username = news[i].FriendsDescript || news[i].GroupManageName || news[i].UserNickName;
  9668. _newsenttime = U.MD.F.N.messagesendTime(news[i].MessageSendTime);
  9669. //消息类型的处理,设置消息的内容显示
  9670. switch (verify) {
  9671. //聊天消息处理
  9672. case 0:
  9673. _descript = news[i].count;
  9674. _newcontent = news[i].MessageContent || news[i].GroupMessageContent;
  9675. //添加好友点击的回调
  9676. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9677. U.MD.F.N.chatMessage(newsinfo, news, _newel); //聊天消息设置
  9678. U.UF.EV.stopBubble();
  9679. }, [news, news[i], _newel]);
  9680. break;
  9681. //添加好友消息的处理
  9682. case 1:
  9683. _username = news[i].UserNickName; //消息名字
  9684. _newcontent = "添加您为好友"; //消息描述
  9685. //添加好友点击的回调
  9686. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9687. U.MD.F.N.addFriendNewsHandle(newsinfo, news, _newel);
  9688. U.UF.EV.stopBubble();
  9689. }, [news, news[i], _newel]);
  9690. break;
  9691. //请求加入群消息处理
  9692. case 2:
  9693. _username = news[i].UserNickName; //消息名字
  9694. _newcontent = "请求加入该群"; //消息描述
  9695. //添加好友点击的回调
  9696. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9697. U.MD.F.N.entryGroup(newsinfo, news, _newel);
  9698. }, [news, news[i], _newel]);
  9699. break;
  9700. //邀请加入群处理
  9701. case 3:
  9702. _username = news[i].UserNickName; //消息名字
  9703. _newcontent = "邀请您加入讨论组"; //消息描述
  9704. //添加好友点击的回调
  9705. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9706. U.MD.F.N.pulledIntoGroups(newsinfo, news, _newel);
  9707. U.UF.EV.stopBubble();
  9708. }, [news, news[i], _newel])
  9709. break;
  9710. //对方同意添加好友
  9711. case 4:
  9712. _username = news[i].UserNickName; //消息名字
  9713. _newcontent = "同意添加你为好友"; //消息描述
  9714. //添加好友点击的回调
  9715. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9716. U.MD.F.N.confirmAddFriend(newsinfo, news, _newel);
  9717. }, [news, news[i], _newel]);
  9718. break;
  9719. //对方确认我加入群的处理
  9720. case 5:
  9721. _username = news[i].UserNickName; //消息名字
  9722. _newcontent = "加入讨论组"; //消息描述
  9723. //添加好友点击的回调
  9724. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9725. U.MD.F.N.pulledIntoGroups(newsinfo, news, _newel);
  9726. }, [news, news[i], _newel]);
  9727. break;
  9728. case 6:
  9729. _newcontent = "你的文件到了!!!"; //发送文件描述
  9730. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9731. U.MD.F.N.chatMessage(newsinfo, news, _newel); //聊天消息设置
  9732. U.UF.EV.stopBubble();
  9733. }, [news, news[i], _newel]);
  9734. break;
  9735. }
  9736. //点击处理
  9737. _newel.onclick = _cb;
  9738. _newael = $$("div", { "className": "U_MD_D_MG_OOI" }, _newel);
  9739. $$("img", {
  9740. "onerror": U.MD.C.imgError,
  9741. "onerror": U.MD.C.imgError, "alt": news[i].FriendsDescript || news[i].UserNickName || news[i].GroupManageName,
  9742. "src": U.MD.C.getHeadImage(news[i].UserThumbnailImageHead || "/img/UserHead/UseHead.jpg")
  9743. }, _newael);
  9744. $$("div", { "className": "U_MD_D_MG_OON U_MD_D_Text_Abbreviation", "innerHTML": _username }, _newel);
  9745. $$('div', { 'style': { 'float': 'none', 'text-align': 'end', 'color': '#737373', 'height': '15px', 'margin-right': '5px' }, 'innerHTML': _newsenttime }, _newel);
  9746. $$('div', { className: 'U_MD_D_MG_OONC', 'innerHTML': _newcontent, 'style': { 'margin-left': '10px', 'font-size': '14px', 'margin-top': '8px' } }, _newel);
  9747. if (verify != 0) {
  9748. _newel.children[3].style.color = '#2683f5';
  9749. }
  9750. if (verify == 0) {
  9751. $$("div", { "style": { "float": "right", 'margin-top': '9px', 'margin-right': '5px' }, "className": " U_MD_D_MG_Count", "innerHTML": _descript }, _newel);
  9752. }
  9753. }
  9754. U.selectEl("#U_MD_D_MG_AFT")[0].appendChild(_frag);
  9755. }
  9756. /**
  9757. * 提供好友和群统一接口实现信息回调
  9758. *
  9759. *
  9760. * @param {object} 当前的消息
  9761. * @param {array} 所有的消息
  9762. * @param {element} 消息元素
  9763. */
  9764. U.MD.F.N.chatMessage = function (newsinfo, news, el) {
  9765. var _chatinfo;
  9766. //如果是群聊天的处理
  9767. if (newsinfo.GroupManageID) {
  9768. _chatinfo = U.Json.select(US.friend.group, { "GroupManageID": newsinfo.GroupManageID })[0];
  9769. }
  9770. //如果是好友聊天的处理
  9771. else {
  9772. _chatinfo = U.Json.select(US.friend.friends, { "UserId": newsinfo.UserId })[0]
  9773. }
  9774. U.MD.F.W.viewFriend(_chatinfo); //查看消息
  9775. U.MD.F.N.clearNews(newsinfo, news, el); //清除
  9776. U.MD.F.N.delNewsTips(); //清除消息提示
  9777. }
  9778. /**
  9779. * 提供好友和群统一接口实现信息回调
  9780. *
  9781. * @param {bool} 接收的消息类型
  9782. * true 群消息
  9783. * false 好友消息
  9784. * @param {string} 好友或者群消息
  9785. * @param {object} 获取查看的好友消息
  9786. */
  9787. U.MD.F.N.asynReceiveMessages = function (isgroup, chatform, r) {
  9788. //如果是群消息查看
  9789. if (isgroup) {
  9790. U.MD.F.W.printGroupChatMessage($("div.U_MD_F_C", chatform)[0], r); //打印群消息
  9791. }
  9792. //好友消息的查看
  9793. else {
  9794. U.MD.F.W.printFriendChatMessage($("div.U_MD_F_C", chatform)[0], r); //打印好友消息
  9795. }
  9796. }
  9797. /**
  9798. * 添加好友的处理
  9799. *
  9800. * @param {object} 当前的消息
  9801. * @param {array} 所有的消息
  9802. * @param {element} 消息元素
  9803. */
  9804. U.MD.F.N.addFriendNewsHandle = function (newsinfo, news, el) {
  9805. var _friendinfo = U.Json.select(US.friend.friends, { "UserId": newsinfo.UserId }, null, 1)[0]; //判断用户是否在好友分组里
  9806. //好友不存在自己的列表
  9807. if (!_friendinfo) {
  9808. U.MD.F.M.addFriend(newsinfo, null, "0"); //添加他人进入群
  9809. }
  9810. //用户已经是自己的好友,那么直接弹出聊天
  9811. else {
  9812. U.MD.F.W.popupFriendsForm(_friendinfo);
  9813. }
  9814. U.MD.F.N.clearNews(newsinfo, news, el); //清除
  9815. }
  9816. /**
  9817. * 添加好友的处理
  9818. *
  9819. * @param {object} 当前的消息
  9820. * @param {array} 所有的消息
  9821. * @param {element} 消息元素
  9822. */
  9823. U.MD.F.N.entryGroup = function (newsinfo, news, el) {
  9824. var _groupuserid = Guid.newGuid(), //群用户id
  9825. _friendinfo = U.Json.select(US.friend.groupusers, { "GroupManageID": news.MessageContent, "UserId": news.UserId }, null, 1)[0]; //查找群
  9826. //如果群已经加载处理的处理
  9827. if (_friendinfo) {
  9828. U.alert("添加成功");
  9829. }
  9830. //添加用户进入群主
  9831. else {
  9832. U.A.Request(US.FRIEND, ["AddUsrsToGroup", US.userInfo.UserId, news.MessageID, news.UserId, news.MessageContent.toUpperCase(), _groupuserid, news.MessageDescript], U.MD.F.N.asynEntryGroup, ["", news, _groupuserid]);
  9833. }
  9834. U.MD.F.N.clearNews(newsinfo, news, el); //清除
  9835. }
  9836. /**
  9837. * 添加群进入
  9838. *
  9839. * @param {object} 服务器返回的信息
  9840. */
  9841. U.MD.F.N.asynEntryGroup = function (r) {
  9842. var _groupuserinfo,
  9843. _context = r.context,
  9844. _news = _context[1],
  9845. _groupuserid = _context[2];
  9846. //实例化用户
  9847. _groupuserinfo = U.MD.F.T.groupUserEntity(_news.UserId, _news.UserImageHead, _news.UserNickName, _news.UserNickName, _news.UserThumbnailImageHead, _news.MessageContent.toUpperCase(), _news.MessageID, 1)
  9848. //添加用户进入群
  9849. US.friend.groupusers.push(_groupuserinfo);
  9850. }
  9851. /**
  9852. * 被用户进入群处理
  9853. *
  9854. * @param {object} 消息信息
  9855. */
  9856. U.MD.F.N.pulledIntoGroups = function (newsinfo, news, el) {
  9857. var _groupinfo = U.Json.select(US.friend.group, { "GroupManageID": newsinfo.MessageContent.toLowerCase() })[0];
  9858. //判断群是否已经加载过,如果加载过那么就不重新加载
  9859. if (!_groupinfo) {
  9860. U.A.Request(US.FRIEND, ["GetJoinGroupNews", US.userInfo.UserId, newsinfo.MessageID, newsinfo.MessageContent], U.MD.F.N.asynPulledIntoGroups, ["", newsinfo]); //拉用户进入群组
  9861. }
  9862. else {
  9863. U.MD.F.W.viewFriend(_groupinfo); //查看消息
  9864. //如果是群的文件消息的处理
  9865. if (newsinfo.MessageContent.length == 36) {
  9866. }
  9867. }
  9868. U.MD.F.N.clearNews(newsinfo, news, el); //清除用户消息
  9869. U.MD.F.W.addChecked(newsinfo); //添加聚焦效果
  9870. U.MD.F.N.delNewsTips();
  9871. }
  9872. /**
  9873. * 拉用户进入群组异步
  9874. *
  9875. * @param {object} 小新信息
  9876. */
  9877. U.MD.F.N.asynPulledIntoGroups = function (r) {
  9878. //服务器返回成功
  9879. if (r.value) {
  9880. var _groupfriend,
  9881. _groupfriends,
  9882. _groupdiskarr,
  9883. _context = r.context,
  9884. _newinfo = _context[1],
  9885. _userid = US.userInfo.UserId, //用户id
  9886. _diskinfo = US.disk.Disks[_userid], //用户群信息
  9887. _groupinfo = new U.MD.F.T.groupEntity(_newinfo.MessageContent.toLocaleLowerCase(), _newinfo.MessageDescript, U.UF.D.toTimeStamp(new Date()), _newinfo.UserId, "", null) //群信息
  9888. ;
  9889. r = r.value; //服务器响应后返回的值
  9890. _groupfriends = r[0];
  9891. US.friend.group.unshift(_groupinfo); //插入新群
  9892. //添加群友
  9893. for (i = 0; i < _groupfriends.length; i++) {
  9894. //判断用户是否在群里,不重复添加
  9895. if (!U.Json.select(US.friend.groupusers, { "GroupManageID": _groupfriends[i].GroupManageID, "UserId": _groupfriends[i].UserId })[0]) {
  9896. //初始化生成群用户
  9897. _groupfriend = new U.MD.F.T.groupUserEntity(_groupfriends[i].UserId, U.MD.C.getHeadImage(_groupfriends[i].UserImageHead), _groupfriends[i].UserNickName || _groupfriends[i].UserName, _groupfriends[i].UserName, U.MD.C.getHeadImage(_groupfriends[i].UserThumbnailImageHead), _groupfriends[i].GroupUsersDescript || _groupfriends[i].UserNickName, _groupfriends[i].GroupManageID, 1);
  9898. //添加群用户到群里
  9899. US.friend.groupusers.push(_groupfriend);
  9900. }
  9901. }
  9902. _groupdiskarr = [new U.MD.DK.M.entity(_groupinfo.GroupManageID, 0, US.EMPTYGUID, _groupinfo.GroupManageName,
  9903. _groupinfo.GroupManageName, "folder", null, U.UF.D.toTimeStamp(new Date()), U.MD.DK.C.getIcon("folder")[1],
  9904. 1, null, null, 0, "", _groupinfo.GroupManageID)];
  9905. _diskinfo && U.MD.DK.RE.addFileOrFolder(_groupdiskarr, _diskinfo, _diskinfo.directoryOrFiles[2]) //添加文件或者文件夹
  9906. // _diskinfo && U.MD.DK.RE.addFileOrFolder(r[1], _diskinfo, _groupinfo) //群里的文件或者文件夹
  9907. //直接显示到群里
  9908. U.MD.F.W.viewFriend(_groupinfo); //查看消息
  9909. U.selectEl($("#U_MD_F_H_ZLTA").Child()[2]).Child()[0].onclick(); //刷新群组列表
  9910. //返回添加的群
  9911. return US.friend.group[0];
  9912. }
  9913. }
  9914. /**
  9915. * 确认添加对方为好友
  9916. *
  9917. * @param {object} 确定添加对方为好友
  9918. */
  9919. U.MD.F.N.confirmAddFriend = function (newsinfo, news, el) {
  9920. var _friendid = Guid.newGuid(), //好友id
  9921. _friendinfo = U.Json.select(US.friend.friends, { "UserId": news.UserId })[0] //用户是否已经在好友列表
  9922. ;
  9923. //如果好友没有添加处理
  9924. if (!_friendinfo) {
  9925. U.A.Request(US.FRIEND, ["AddFriend", US.userInfo.UserId, news.UserId, _friendid, news.MessageContent, news.MessageDescript], U.MD.F.N.asynAddFriend, [null, news, news.MessageContent, _friendid]); //添加好友到默认分组
  9926. }
  9927. //如果用户在好友列表,那么直接弹出
  9928. else {
  9929. U.MD.F.W.popupFriendsForm(_friendinfo);
  9930. }
  9931. U.MD.F.N.clearNews(newsinfo, news, el); //清除消息
  9932. }
  9933. /**
  9934. * 异步处理确定添加好友
  9935. *
  9936. * @param {object} 确定添加对方为好友
  9937. */
  9938. U.MD.F.N.asynAddFriend = function (r) {
  9939. var _context = r.context,
  9940. _new = _context[1],
  9941. _groupid = _context[2],
  9942. _friendid = _context[3];
  9943. r = r.value;
  9944. U.MD.F.M.displayAddFriend(r[0][0], _friendid, _groupid, r); //确定添加好友到好友分组里
  9945. }
  9946. /**
  9947. * 清除所有的消息
  9948. *
  9949. * @param {array} 所有的消息
  9950. */
  9951. U.MD.F.N.clearAllNews = function () {
  9952. var i, j,
  9953. _allids = "",
  9954. _allnews = U.MD.F.N.news
  9955. ;
  9956. //循环获取消息的id
  9957. for (i = 0; i < _allnews.length; i++) {
  9958. if (_allnews[i]) {
  9959. for (j = 0; j < _allnews[i].length; j++) {
  9960. _allids += (_allnews[i][j].GroupManageID || _allnews[i][j].MessageID) + ",";
  9961. }
  9962. _allnews[i].splice(0);
  9963. }
  9964. }
  9965. _allids = _allids.substring(0, _allids.length - 1); //去除最后一位的,
  9966. //数据库删除消息处理
  9967. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteMessageById", _allids, US.userInfo.UserId], function () { }, []);
  9968. U.selectEl("#U_MD_D_MG_AFT")[0].innerText = "";
  9969. }
  9970. /**
  9971. * 清除所有的的添加好友信息
  9972. *
  9973. * @param {array} 所有的消息
  9974. * @param {object} 当前的消息
  9975. * @param {element} 消息元素
  9976. * @param {number} 消息类型
  9977. */
  9978. U.MD.F.N.clearNews = function (newsinfo, news, el) {
  9979. var _pel = U.selectEl(el).Parent(),
  9980. _messageid = (newsinfo.MessageID || newsinfo.GroupMessageID); //元素的上级元素
  9981. //移除单挑消息
  9982. U.Json.del(news, { "MessageID": newsinfo.MessageID });
  9983. //清理消息
  9984. U.MD.F.N.canelMarkMessage(newsinfo);
  9985. U.selectEl(el).remove(); //移除消息
  9986. //如果消息已经全部点击完毕的处理
  9987. if ($(_pel).Child().length == 0 && U.selectEl("#U_MD_F_N_Message")[0]) {
  9988. U.selectEl("#U_MD_F_N_Message")[0].close(); //关闭的处理
  9989. }
  9990. //数据库删除消息处理
  9991. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteMessageById", _messageid, US.userInfo.UserId], function () { }, []);
  9992. }
  9993. /**
  9994. * 学习系统消息处理
  9995. *
  9996. * @param {array} 除了好友聊天消息,其他消息的处理
  9997. */
  9998. U.MD.F.N.otherNews = function (news) {
  9999. }
  10000. /*
  10001. 标记未读信息
  10002. @param {array} newsarr消息信息数组
  10003. */
  10004. U.MD.F.N.markUnreadMessage = function (newsarr) {
  10005. var i, j, _id, _el, _parentel;
  10006. for (i = 0; i < newsarr.length; i++) { //循环消息数组
  10007. for (j = 0; j < newsarr[i].length; j++) {
  10008. _id = newsarr[i][j].UserId || newsarr[i][j].GroupManageID; //获取消息id
  10009. if (_id) {
  10010. _el = U.selectEl("[tid='M" + _id + "']")[0]; //获取聊天次数元素
  10011. _parentel = U.selectEl("[tid='" + _id + "']")[0]; //获取添加到哪个父亲的元素
  10012. //如果可以添加
  10013. if (_parentel) {
  10014. if (_el) {
  10015. _el.innerHTML = newsarr[i][j].count;
  10016. }
  10017. else {
  10018. $$("div", { className: "U_Mark", innerHTML: newsarr[i][j].count, tid: "M" + _id, "style": { "cssText": "margin:0;position:absolute;left:48px" } }, _parentel); //生成红点
  10019. }
  10020. }
  10021. }
  10022. }
  10023. }
  10024. }
  10025. /*
  10026. 消除标记信息
  10027. @param {json} friendindo 好友信息
  10028. */
  10029. U.MD.F.N.canelMarkMessage = function (friendInfo) {
  10030. if (friendInfo) {
  10031. if (friendInfo.GroupManageID) {
  10032. U.selectEl("[tid='M" + friendInfo.GroupManageID + "']").remove(); //删除左边标记
  10033. }
  10034. else if (friendInfo.UserId) {
  10035. U.selectEl("[tid='M" + friendInfo.UserId + "']").remove(); //删除左边标记
  10036. }
  10037. else if (friendInfo.MessageSendUserID) {
  10038. U.selectEl("[tid='M" + friendInfo.MessageSendUserID + "']").remove(); //删除左边标记
  10039. }
  10040. }
  10041. }
  10042. /*
  10043. 消除所有标记信息
  10044. @param {json} friendindo 好友信息
  10045. */
  10046. U.MD.F.N.canelAllMarkMessage = function () {
  10047. U.selectEl(".U_Mark").remove();
  10048. }
  10049. /*
  10050. 移除单个消息提示动画
  10051. */
  10052. U.MD.F.N.delNewsTips = function () {
  10053. //删除消息提示
  10054. if ($("#U_MD_D_MG_AFT").Child().length == 0) {
  10055. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className = 'U_MD_D_NewsTipsIcon';
  10056. }
  10057. }
  10058. /*
  10059. 移除所有消息提示动画
  10060. */
  10061. U.MD.F.N.delAllNewsTips = function () {
  10062. //删除消息提示
  10063. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className = 'U_MD_D_NewsTipsIcon';
  10064. }
  10065. //#endregion
  10066. /*
  10067. 新消息提示图标沒有新消息的处理
  10068. */
  10069. U.MD.F.N.noNewsTips = function () {
  10070. //判断是否有新消息
  10071. if ($("#U_MD_D_MG_AFT").Child().length == 0) {
  10072. if (!$('.U_MD_F_N_NoNewsTips')[0]) {
  10073. $$('div', { 'className': 'U_MD_F_N_NoNewsTips', 'style': {}, 'innerHTML': '暂无消息' }, U.selectEl("#U_MD_F_N_Message")[0]);
  10074. } else {
  10075. U.selectEl('.U_MD_F_N_NoNewsTips')[0].style.display = "block";
  10076. }
  10077. U.MD.F.N.delAllNewsTips();
  10078. }
  10079. else {
  10080. if ($('.U_MD_F_N_NoNewsTips')[0]) {
  10081. U.selectEl('.U_MD_F_N_NoNewsTips')[0].style.display = "none";
  10082. }
  10083. }
  10084. }
  10085. /**
  10086. *添加消息提示音
  10087. *parentele {element} 添加到父亲元素
  10088. *allnews {array} 消息数组
  10089. */
  10090. U.MD.F.N.addNewsSound = function (parentele, allnews) {
  10091. //判断是否创建音频
  10092. if (!$('#U_MD_F_N_NewsAudio')[0]) {
  10093. $$('audio', { "id": "U_MD_F_N_NewsAudio", "src": "http://gddx.sc.chinaz.com/Files/DownLoad/sound1/201703/8407.wav", "autoplay": 'autoplay' }, parentele);
  10094. }
  10095. //创建了,则播放音频
  10096. else {
  10097. U.selectEl('#U_MD_F_N_NewsAudio')[0].play();
  10098. }
  10099. }
  10100. /**
  10101. *点击查看好友聊天移除企鹅图标新消息提示
  10102. *parentele {element} 添加到父亲元素
  10103. *allnews {array} 消息数组
  10104. */
  10105. U.MD.F.N.cancelNewsMessage = function (friendInfo) {
  10106. var i,
  10107. _news, //消息
  10108. _id = friendInfo.GroupManageID ? "GroupManageID" : "UserId",
  10109. _obj = {}, //查找条件
  10110. _child = U.selectEl("#U_MD_D_MG_AFT").Child(); //消息元素
  10111. _obj[_id] = friendInfo[_id]; //设置条件
  10112. _news = U.Json.select(U.MD.F.N.news[0], _obj)[0]; //查找消息
  10113. if (_news) {
  10114. //循环
  10115. for (i = 0; i < _child.length; i++) {
  10116. if (_child[i].tid == "O" + _news.MessageID) {
  10117. U.MD.F.N.chatMessage(_news, U.MD.F.N.news[0], _child[i]);
  10118. return;
  10119. }
  10120. }
  10121. }
  10122. };
  10123. ///<jscompress sourcefile="RightClick.js" />
  10124. Namespace.register("U.MD.F.R"); //好友和群窗口区域命名空间
  10125. //#region 右键菜单
  10126. /**
  10127. * 右键功能 显示[移动至][删除]窗体
  10128. * 参数说明 0 当前元素 1 用户信息
  10129. * @param {element} 右键好友的区域
  10130. * @param {object} 好友信息
  10131. */
  10132. U.MD.F.R.friendsRightClickMenu = function (el, friendinfo) {
  10133. var _friendmenuel = U.selectEl('#U_MD_F_G_Div')[0], //右键的菜单
  10134. _child = U.selectEl(_friendmenuel).Child(); //子菜单
  10135. //显示菜单,定位
  10136. U.selectEl(_friendmenuel).css({ "display": "block", "zIndex": "999" });
  10137. U.UF.C.rightClickMenuLocation(_friendmenuel); //右键菜单定位
  10138. //按钮功能赋值
  10139. _child[0].onclick = function () { U.MD.F.W.popupFriendsForm(friendinfo); }; //发送消息
  10140. _child[1].onclick = function () { U.MD.U.V.ViewOtherUserInfo(friendinfo.UserId); }; //查看个人资料
  10141. _child[2].onmouseover = function () { U.MD.F.R.moveFriendForm(friendinfo, el, _child[2]); }; //移动联系人至
  10142. _child[3].onclick = function () { U.MD.F.R.deleteFriendForm(friendinfo); }; //删除
  10143. //点击其它区域隐藏右键菜单
  10144. U.selectEl(document).bind("click", function () {
  10145. U.selectEl(_friendmenuel)[0].style.display = "none";
  10146. })
  10147. }
  10148. /**
  10149. * 鼠标移动到 联系人移动至制定的好友分组弹框
  10150. * @param {object} 好友信息
  10151. * @param {element} 右键好友的区域
  10152. * @param {element} onmouseover出发的按钮
  10153. */
  10154. U.MD.F.R.moveFriendForm = function (friendinfo, el, menubootom) {
  10155. var i,
  10156. _friendclassel = U.selectEl(menubootom).parentElement().Child()[4], //获取好友分组打印的元素
  10157. _friendclassinfo = US.friend.allclass; //获取用户所有的好友分组
  10158. _friendclassel.innerText = ""; //清空之前打印的好友分组
  10159. if (!friendinfo.FriendsGroupID) {//判断好友信息是否有好友分组id
  10160. friendinfo.FriendsGroupID = U.Json.select(US.friend.friends, { "UserId": friendinfo.UserId })[0].FriendsGroupID; //给好友信息添加好友分组id
  10161. }
  10162. //如果有好友分组可以移动的情况
  10163. if (_friendclassinfo.length > 1) {
  10164. //循环打印好友分组
  10165. for (i = 0; i < _friendclassinfo.length; i++) {
  10166. //如果是当前用户所在的好友分组不打印,否则都打印
  10167. if (_friendclassinfo[i].FriendsGroupID != friendinfo.FriendsGroupID) {
  10168. //创建好友分组元素
  10169. $$("div", {
  10170. "class": "U_MD_F_G_Div_Children_A", "innerText": _friendclassinfo[i]["FriendsGroupName"],
  10171. "onclick": U.UF.C.closure(function (i) {
  10172. U.MD.F.R.assignMoveFriend(friendinfo, _friendclassinfo[i], el);
  10173. }, [i])
  10174. }, _friendclassel);
  10175. }
  10176. }
  10177. _friendclassel.style.display = "block";
  10178. }
  10179. }
  10180. /**
  10181. * 触发移动好友
  10182. *
  10183. * @param {object} 好友信息
  10184. * @param {object} 群信息
  10185. * @param {element} 好友元素
  10186. */
  10187. U.MD.F.R.assignMoveFriend = function (friendinfo, groupinfo, el) {
  10188. var _friendsid;
  10189. //只有选择移动了触发
  10190. if (friendinfo) {
  10191. U.selectEl('#U_MD_F_G_Div')[0].style.display = "none"; //点击后隐藏右键
  10192. U.selectEl(".U_MD_F_G_Div_Children")[0].style.display = "none"; //隐藏右键后好友分组选择的菜单
  10193. if (friendinfo.FriendsID) {
  10194. _friendsid = friendinfo.FriendsID;
  10195. } else {
  10196. friendinfo.FriendsID = U.Json.select(US.friend.friends, { "UserId": friendinfo.UserId })[0].FriendsID;
  10197. friendinfo.FriendsGroupID = U.Json.select(US.friend.friends, { "UserId": friendinfo.UserId })[0].FriendsGroupID;
  10198. }
  10199. //数据库设置移动好友信息
  10200. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "MoveFriendToOtherClass", friendinfo.FriendsID, groupinfo["FriendsGroupID"]],
  10201. U.MD.F.R.asynAssignMoveFriend, ["", friendinfo, groupinfo, el]);
  10202. U.alert('修改成功');
  10203. }
  10204. }
  10205. /**
  10206. * 把相应的好友移动到指定的群组里
  10207. */
  10208. U.MD.F.R.asynAssignMoveFriend = function (r) {
  10209. var _child, //好友分组元素
  10210. _context = r.context, //异步传参
  10211. _friendinfo = _context[1], //移动好友实体
  10212. _groupinfo = _context[2], //好友分组字体
  10213. _el = _context[3], //移动的元素
  10214. _friendgroupel = U.selectEl("#g" + _groupinfo.FriendsGroupID)[0], //移动到的好友分组
  10215. _previousgroupinfo = U.Json.select(US.friend.allclass, { "FriendsGroupID": _friendinfo.FriendsGroupID })[0], //修改前的好友分组
  10216. _friendnum = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo.FriendsGroupID }).length - 1 //好友分组的数量
  10217. ;
  10218. //设置好友原本所在的分组信息
  10219. //判断是否处于好友聊天功能下
  10220. if ($('.U_MD_F_H_ZLTOO')[0]) {
  10221. U.selectEl(_el).parentElement(2).Child()[0].innerHTML = _previousgroupinfo.FriendsGroupName + "(" + _friendnum + ")"; //移动好友出去后需改数量显示
  10222. U.MD.F.R.assignNoFriendTips(_previousgroupinfo, _friendnum, U.selectEl(_el).parentElement(2).Child()[1], U.selectEl(_friendgroupel).Child()[1]);
  10223. }
  10224. //好友实体的id变化FriendsGroupID
  10225. _friendinfo.FriendsGroupID = _groupinfo.FriendsGroupID;
  10226. U.Json.select(US.friend.friends, { "UserId": _friendinfo.UserId })[0].FriendsGroupID = _groupinfo.FriendsGroupID;
  10227. //判断分组是否显示
  10228. if (_friendgroupel) {
  10229. _child = U.selectEl(_friendgroupel).Child();
  10230. _friendnum = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo.FriendsGroupID }).length;
  10231. _child[0].innerHTML = _groupinfo["FriendsGroupName"] + "(" + _friendnum + ")"; //新好友分组
  10232. _child[1].appendChild(_el); //添加移动的元素
  10233. }
  10234. }
  10235. /**
  10236. * 移动好友后,分组内是否显示没有好友跟随提示的异步
  10237. * previousgroupinfo {object} 好友移动后的前分组
  10238. * nowfriendnum {string} 好友移动后的现在好友分组的好友数量
  10239. * previousel {elementy} 前分组的元素
  10240. * nowel {element} 现分组的元素
  10241. */
  10242. U.MD.F.R.assignNoFriendTips = function (previousgroupinfo, nowfriendnum, previousel, nowel) {
  10243. var _previousfriendnum = U.Json.select(US.friend.friends, { "FriendsGroupID": previousgroupinfo.FriendsGroupID }).length;
  10244. if (_previousfriendnum == 0 && previousel.parentNode) {
  10245. $$("div", { "class": "U_MD_F_H_ZLZOCO_under", "style": { "margin": "9px 0 0 10px" }, "innerHTML": "该分组暂无好友" }, previousel);
  10246. }
  10247. if (nowel.parentNode && nowel.getElementsByClassName("U_MD_F_H_ZLZOCO_under")[0]) {
  10248. nowel.removeChild($('.U_MD_F_H_ZLZOCO_under')[0]);
  10249. }
  10250. }
  10251. /**
  10252. * 鼠标从 联系人移动至 移开
  10253. * 隐藏现有的好友分组 Jude
  10254. */
  10255. U.MD.F.R.moveFriendOver = function (isdisplay, friendgroupmenu, el) {
  10256. //判断是否是冒泡上来的,如果是冒泡的则不处理
  10257. if (!U.UF.EV.stopBubbleMouseOutOrOver(el)) {
  10258. //根据传参设置是否显示隐藏
  10259. friendgroupmenu.style.display = isdisplay ? "none" : "block";
  10260. }
  10261. }
  10262. /**
  10263. * 弹出移动好友分组
  10264. * 参数说明 0 要移动的对象的信息集合 1 右键区域
  10265. * @param {element} 点击移动至区域
  10266. */
  10267. U.MD.F.R.topMoveFriendForm = function (el, friendinfo) {
  10268. var _chooseGroupInfon = null;
  10269. //未创建
  10270. //if (!$(".U_MD_F_G_Y_D")[0]) {
  10271. var i, //循环
  10272. _tempel,
  10273. _friendclassel = $$("div", { "className": "U_MD_F_G_Y_D" }), //弹出框内容区域
  10274. _friendclassinfo = US.friend.allclass, //好友分组信息
  10275. _friendclassform = U.UF.UI.confirm(_friendclassel, function () { U.MD.F.R.assignMoveFriend(friendinfo, _chooseGroupInfon, el) }); //好友分组弹框
  10276. $$("div", { "innerText": "选择好友移动至", "className": "U_MD_F_G_Y_DT" }, _friendclassel);
  10277. _tempel = $$("div", { "className": "U_MD_F_G_Y_DS" }, _friendclassel);
  10278. //循环所有可以移动的分组
  10279. for (i = 0; i < _friendclassinfo.length; i++) {
  10280. $$("div", {
  10281. "innerHTML": _friendclassinfo[i].FriendsGroupName,
  10282. "className": "U_MD_F_G_Div_Q" + (friendinfo.FriendsGroupID == _friendclassinfo[i].FriendsGroupID ? " U_MD_F_G_Div_QO" : ""),
  10283. "onclick": U.UF.C.closure(function (i) {
  10284. _chooseGroupInfon = _friendclassinfo[i];
  10285. U.MD.F.R.topMoveFriendFormSwitch(this, friendinfo, _friendclassinfo[i], _friendclassform, el);
  10286. }, [i])
  10287. }, _tempel);
  10288. }
  10289. //自适应宽度
  10290. U.selectEl($(_friendclassform.content)[0]).Parent().style.height = "100%";
  10291. U.selectEl($($($($($(".U_MD_F_G_Y_D")[0]).Parent()).Parent()).Parent()).Parent()).Parent().style.zIndex = 100; //置顶好友分组弹窗
  10292. // } else {//已经创建
  10293. // var _formparent = U.selectEl($($($($($(".U_MD_F_G_Y_D")[0]).Parent()).Parent()).Parent()).Parent()).Parent(); //获取父级窗体元素
  10294. // if (_formparent.style.display == "none") {
  10295. // _formparent.style.display = "block";
  10296. // } else {
  10297. // _formparent.style.display = "none"
  10298. // }
  10299. // }
  10300. }
  10301. /**
  10302. * 右键功能 显示[移动至][删除]窗体
  10303. *
  10304. * @param {element} 选中变化的元素
  10305. * @param {object} 好友信息
  10306. * @param {object} 群信息
  10307. * @param {array} 对话框
  10308. ------------[0] 对话框
  10309. * @param {element} 好友元素
  10310. */
  10311. U.MD.F.R.topMoveFriendFormSwitch = function (groupel, friendinfo, friendclassinfo, friendclassform, el) {
  10312. var i, //用于循环
  10313. _child = U.selectEl(el).parentElement().Child(); //获取
  10314. //_group = U.selectEl(".U_MD_F_G_Y_DS").Child();
  10315. _group = groupel.parentNode.children;
  10316. for (i = 0; i < _group.length; i++) {
  10317. _group[i].className = U.selectEl(".U_MD_F_G_Y_DS").Child()[i].className == "U_MD_F_G_Div_Q U_MD_F_G_Div_QO" ? "U_MD_F_G_Div_Q" : "U_MD_F_G_Div_Q";
  10318. groupel.className = "U_MD_F_G_Div_Q U_MD_F_G_Div_QO";
  10319. }
  10320. //设置点击的效果
  10321. for (i = 0; i < _child.length; i++) {
  10322. _child[i].className = "U_MD_F_H_ZLZOCO" + (el == _child[i] ? " U_MD_F_G_Div_QQ" : "");
  10323. }
  10324. //设置确定按钮的事件,这里要结合窗体的api
  10325. // friendclassform.AddEvent({ Yes: [U.MD.F.R.assignMoveFriend, [friendinfo, friendclassinfo, el]] });
  10326. }
  10327. //#endregion
  10328. //#region 好友分组
  10329. /**
  10330. * 右键群显示
  10331. * @param object 右键元素的信息集合
  10332. */
  10333. U.MD.F.R.friendClassRightClickMenu = function (friendgroupinfo, el) {
  10334. var _el = U.selectEl('#U_MD_F_G_Qun')[0], //右键的菜单
  10335. _child = U.selectEl(_el).Child(); //子菜单
  10336. U.selectEl(_el).css({ "display": "block", "zIndex": "999" }); //显示右键菜单
  10337. U.UF.C.rightClickMenuLocation(_el); //右键菜单定位
  10338. //修改分组名字的点击处理
  10339. _child[0].onclick = function () { U.MD.F.R.popupUpdateFriendsClassForm(friendgroupinfo, el); };
  10340. _child[1].onclick = function () { U.MD.F.R.popupDeleteFriendsClassForm(friendgroupinfo, el); };
  10341. U.selectEl(document).bind("click", function () {
  10342. U.selectEl('#U_MD_F_G_Qun')[0].style.display = "none";
  10343. })
  10344. }
  10345. /**
  10346. * 修改分组昵称 弹框
  10347. * @param object 分组信息集合
  10348. * @param object 当前的el
  10349. */
  10350. U.MD.F.R.popupUpdateFriendsClassForm = function (friendgroupinfo, el) {
  10351. var _tempel,
  10352. _temponeel,
  10353. _temptwoel;
  10354. var _el = U.selectEl('#U_MD_F_G_Qun')[0]; //右键的菜单
  10355. U.selectEl(_el).css({ "display": "none" }); //显示右键菜单
  10356. if (friendgroupinfo) {
  10357. //创建好友分组的样式
  10358. _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNL U_MD_F_G" });
  10359. _temponeel = $$("div", {}, _tempel)
  10360. _temptwoel = $$("input", {
  10361. "value": friendgroupinfo.FriendsGroupName, "onfocus": function () { U.UF.MR.inputPlaceholder(this, friendgroupinfo.FriendsGroupName, ""); },
  10362. "onblur": function () { U.UF.MR.inputPlaceholder(this, "", friendgroupinfo.FriendsGroupName); }
  10363. }, _temponeel);
  10364. //弹出好友对话框
  10365. U.UF.UI.confirm(_tempel, function () { U.MD.F.R.assignUpdateFriendsClass(friendgroupinfo, _temptwoel, el); }); //创建一个对话框
  10366. }
  10367. else {
  10368. U.alert("暂无群信息");
  10369. }
  10370. }
  10371. /**
  10372. *
  10373. * 参数说明 0 群消息集合 1 更改的分组名称 3对应修改的el
  10374. * @param {object} 群信息
  10375. * @param {element} 输入框
  10376. * @param {object} 对应的el
  10377. */
  10378. U.MD.F.R.assignUpdateFriendsClass = function (friendgroupinfo, formel, el) {
  10379. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "UpdateClassNameAndDescription", friendgroupinfo["FriendsGroupID"], formel.value, ""],
  10380. function () {
  10381. U.selectEl(el)[0].innerText = formel.value;
  10382. U.alert("修改成功");
  10383. }, []);
  10384. U.alert("正在修改中");
  10385. }
  10386. /*
  10387. * 删除好友分组弹框
  10388. * @param object 分组信息集合
  10389. * @param object 当前的el
  10390. */
  10391. U.MD.F.R.popupDeleteFriendsClassForm = function (friendgroupinfo, el) {
  10392. var _content;
  10393. var _el = U.selectEl('#U_MD_F_G_Qun')[0]; //右键的菜单
  10394. U.selectEl(_el).css({ "display": "none" }); //显示右键菜单
  10395. if (friendgroupinfo) {
  10396. _content = "是否确定删除(" + friendgroupinfo.FriendsGroupName + ")该分组";
  10397. U.UF.UI.confirm(_content, function () { U.MD.F.R.assignDeleteFriendsClass(friendgroupinfo, el); });
  10398. }
  10399. }
  10400. /*
  10401. * 确定删除好友分组
  10402. * @param object 分组信息集合
  10403. * @param object 当前的el
  10404. */
  10405. U.MD.F.R.assignDeleteFriendsClass = function (friendgroupinfo, el) {
  10406. var _friendGroupLength = U.Json.select(US.friend.friends, { "FriendsGroupID": friendgroupinfo.FriendsGroupID }).length;
  10407. if (friendgroupinfo.FriendsGroupDescript != "自动创建") {
  10408. if (_friendGroupLength == 0) {
  10409. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteFriendClass", friendgroupinfo.FriendsGroupID],
  10410. function () {
  10411. U.selectEl(el).Parent().remove()
  10412. U.alert("删除成功");
  10413. //在好友数组的全局变量中删除好友分组的信息
  10414. for (i = 0; i < US.friend.allclass.length; i++) {
  10415. if (US.friend.allclass[i].FriendsGroupID == friendgroupinfo.FriendsGroupID) {
  10416. US.friend.allclass.splice(i, 1);
  10417. }
  10418. }
  10419. }, []);
  10420. U.alert("正在删除中");
  10421. } else {
  10422. U.alert(friendgroupinfo.FriendsGroupName + "该分组下有好友,无法删除");
  10423. }
  10424. } else {
  10425. U.alert("自动创建的分组不可删除");
  10426. }
  10427. }
  10428. //#endregion
  10429. /**
  10430. * 删除确定
  10431. * 参数说明 0 要删除的对象ID 1右键的区域
  10432. * @param {element} 右键好友的区域
  10433. */
  10434. U.MD.F.R.deleteFriendForm = function (friendinfo, callback) {
  10435. var _el;
  10436. U.MD.F.R.addFriendsId(friendinfo); //添加FriendsID
  10437. //创建删除好友的信息样式
  10438. _el = $$("div", { "class": "U_MD_F_G_D" });
  10439. $$("div", { "class": "U_MD_F_G_DelSpan", "innerText": "删除后对方将从好友列表中消失,无法进行发送以及接收消息。" }, _el);
  10440. //弹出删除好友的框
  10441. U.UF.UI.confirm(_el, function () {
  10442. U.MD.F.M.deleteFriend(friendinfo);
  10443. U.UF.C.isFunction(callback) && callback();
  10444. });
  10445. }
  10446. /**
  10447. * 右上角设置
  10448. * 参数说明 friendinfo对应的好友信息集合
  10449. * @param object 好友信息
  10450. *
  10451. */
  10452. U.MD.F.R.popupRightCornerMenu = function (friendinfo, el) {
  10453. var _tempel,
  10454. _friendclassinfo,
  10455. _isaddfriend,
  10456. _menuel = U.selectEl(el).Child()[0];
  10457. //如果菜单存在则删除
  10458. if (_menuel) {
  10459. U.selectEl(_menuel).remove();
  10460. }
  10461. else {
  10462. //好友查看
  10463. if (friendinfo.UserId) {
  10464. _isaddfriend = U.Json.selectOne(US.friend.friends, { "UserId": friendinfo.UserId }); //判断用户是否在好友列表里
  10465. //判断用户是否是自己的好友,是的话则操作好友信息
  10466. _tempel = $$("div", { "class": "U_MD_F_T_B", style: {} }, el);
  10467. if (_isaddfriend) {
  10468. //获取好友分组信息
  10469. _friendclassinfo = U.selectEl($("#g" + _isaddfriend.FriendsGroupID + " div")[1]).find('[tid="' + _isaddfriend["UserId"] + '"]')[0]; //好友分组信息
  10470. //创建菜单
  10471. //_tempel = $$("div", { "class": "U_MD_F_T_B", style: {} }, el);
  10472. $$("div",
  10473. {
  10474. "innerText": "修改备注姓名",
  10475. "onclick": function () {
  10476. U.MD.F.R.updateFriendDescriptForm(_isaddfriend);
  10477. }
  10478. },
  10479. _tempel);
  10480. $$("div",
  10481. {
  10482. "innerText": "修改好友分组",
  10483. "onclick": function () {
  10484. U.MD.F.R.topMoveFriendForm(_friendclassinfo, _isaddfriend);
  10485. }
  10486. },
  10487. _tempel);
  10488. $$("div",
  10489. {
  10490. "innerText": "删除好友",
  10491. "onclick": function () {
  10492. U.MD.F.R.deleteFriendForm(_isaddfriend);
  10493. }
  10494. },
  10495. _tempel);
  10496. U.UF.EV.stopBubble();
  10497. U.selectEl(document).bind("click", function (e) {
  10498. U.selectEl(".U_MD_F_T_B").remove();
  10499. })
  10500. }
  10501. //如果好友不是自己的好友,则菜单为添加好友
  10502. else {
  10503. $$("div", {
  10504. "innerText": "添加该好友", 'onclick': function () {
  10505. U.MD.F.M.addFriend(friendinfo);
  10506. }
  10507. }, _tempel);
  10508. }
  10509. }
  10510. //群菜单查看
  10511. else {
  10512. U.MD.F.J.groupInfoForm(friendinfo); //查看群 操作
  10513. }
  10514. }
  10515. }
  10516. /**
  10517. * 修改好友备注
  10518. * 参数说明 UGE对应的好友信息集合
  10519. * @param object
  10520. */
  10521. U.MD.F.R.updateFriendDescriptForm = function (_friendinfo) {
  10522. var _tempel,
  10523. _temponeel,
  10524. _temptwoel,
  10525. _descript;
  10526. _descript = _friendinfo.FriendsDescript || _friendinfo.UserNickName; //修改的好友昵称
  10527. //创建好友分组的样式
  10528. _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNL U_MD_F_G" });
  10529. _temponeel = $$("div", {}, _tempel)
  10530. _temptwoel = $$("input",
  10531. {
  10532. "value": _descript,
  10533. "onfocus": function () {
  10534. U.UF.MR.inputPlaceholder(this, _descript, "");
  10535. },
  10536. "onblur": function () {
  10537. U.UF.MR.inputPlaceholder(this, "", _descript);
  10538. }
  10539. }, _temponeel);
  10540. //弹出好友对话框
  10541. U.UF.UI.confirm(_tempel, function () {
  10542. U.MD.F.R.updateFriendDescript(_friendinfo, _temptwoel);
  10543. }); //创建一个对话框
  10544. }
  10545. /**
  10546. * 确认修改备注
  10547. * 参数说明 0 对应好友信息集合 1对应的el 用于静态改变当前的备注
  10548. * @param{object}群信息
  10549. * @{element}对应el
  10550. */
  10551. U.MD.F.R.updateFriendDescript = function (friendinfo, el) {
  10552. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "UpdateFriendDescription", friendinfo['FriendsID'], el.value],
  10553. U.MD.F.R.asynUpdateFriendDescript, [null, friendinfo, el.value]);
  10554. }
  10555. /**
  10556. * 好友备注修改异步
  10557. * @param{object} 异步服务器返回的信息
  10558. */
  10559. U.MD.F.R.asynUpdateFriendDescript = function (r) {
  10560. var _context = r.context,
  10561. _friendinfo = _context[1],
  10562. _descript = _context[2],
  10563. _el = U.selectEl($("#g" + _friendinfo.FriendsGroupID + " div")[1]).find('[tid="' + _friendinfo["UserId"] + '"]')[0];
  10564. _friendinfo.FriendsDescript = _descript; //在好友信息集合里修改用户描述
  10565. //在好友列表中修改好友
  10566. if (_el) {
  10567. U.selectEl("div", _el)[2].innerText = _context[2];
  10568. }
  10569. //在聊天窗口修改好友
  10570. U.selectEl("div", U.selectEl('.U_MD_F_TO.U_MD_F_TOT')[0])[1].innerText = _context[2];
  10571. var _obj = U.selectEl('.U_MD_F_TO.U_MD_F_TOT')[0],
  10572. _tags = U.selectEl(".U_MD_F_TA")[0].children;
  10573. for (var i = 0, len = _tags.length; i < len; i++) {
  10574. // 找到节点,返回下标
  10575. if (_tags[i] == _obj) {
  10576. U.selectEl("div", U.selectEl('.U_MD_F_H')[i])[2].innerText = _context[2];
  10577. }
  10578. }
  10579. }
  10580. //#region 群聊
  10581. /**
  10582. * 右键群聊显示
  10583. * @param object 右键元素的信息集合
  10584. */
  10585. U.MD.F.R.GroupRightClickMenu = function (el, friendgroupinfo) {
  10586. var _el = U.selectEl('#U_MD_F_G_Group')[0], //右键的菜单
  10587. _groupuserinfo = U.Json.select(US.friend.groupusers, { "GroupManageID": friendgroupinfo.GroupManageID }),
  10588. _child = U.selectEl(_el).Child(); //子菜单
  10589. U.selectEl(_el).css({ "display": "block", "zIndex": "999" }); //显示右键菜单
  10590. U.UF.C.rightClickMenuLocation(_el); //右键菜单定位
  10591. //修改分组名字的点击处理
  10592. _child[0].onclick = function () { U.MD.F.J.groupInfoForm(friendgroupinfo, el) };
  10593. _child[1].onclick = function () { U.MD.F.J.groupExit(friendgroupinfo, U.Json.selectOne(_groupuserinfo, { "UserId": US.userInfo.UserId })); };
  10594. U.selectEl(document).bind("click", function () {
  10595. U.selectEl('#U_MD_F_G_Group')[0].style.display = "none";
  10596. })
  10597. }
  10598. /**
  10599. *添加FriendsID
  10600. *friendinfo {object} 好友信息
  10601. */
  10602. U.MD.F.R.addFriendsId = function (friendinfo) {
  10603. var _userfriends = US.friend.friends;
  10604. if (!friendinfo.FriendsID) {//判断FriendsID是否存在
  10605. for (var i = 0; i < _userfriends.length; i++) {
  10606. if (friendinfo.UserId == _userfriends[i].UserId) {//对比好友的UserID
  10607. friendinfo.FriendsID = _userfriends[i].FriendsID; //给好友信息添加FriendsID
  10608. }
  10609. }
  10610. } else {
  10611. for (var i = 0; i < _userfriends.length; i++) {
  10612. if (friendinfo.UserId == _userfriends[i].UserId && friendinfo.FriendsID != _userfriends[i].FriendsID) {//对比好友的UserID
  10613. friendinfo.FriendsID = _userfriends[i].FriendsID; //给好友信息添加FriendsID
  10614. }
  10615. }
  10616. }
  10617. }
  10618. ;
  10619. ;
  10620. ///<jscompress sourcefile="User.js" />
  10621. ///<jscompress sourcefile="CityData.js" />
  10622. Namespace.register("U.MD.U.C"); //好友国家城市的命名空间
  10623. //国家省份城市的地址选择
  10624. U.MD.U.C.J = { "citylist": [{ "co": "中国", "cp": [{ "p": "北京市", "c": [{ "n": "东城" }, { "n": "西城" }, { "n": "崇文" }, { "n": "宣武" }, { "n": "朝阳" }, { "n": "丰台" }, { "n": "石景山" }, { "n": "海淀" }, { "n": "门头沟" }, { "n": "房山" }, { "n": "通州" }, { "n": "顺义" }, { "n": "昌平" }, { "n": "大兴" }, { "n": "怀柔" }, { "n": "平谷" }, { "n": "密云" }, { "n": "延庆" }] }, { "p": "天津市", "c": [{ "n": "和平" }, { "n": "河东" }, { "n": "河西" }, { "n": "南开" }, { "n": "河北" }, { "n": "红挢" }, { "n": "塘沽" }, { "n": "汉沽" }, { "n": "大港" }, { "n": "东丽" }, { "n": "西青" }, { "n": "津南" }, { "n": "北辰" }, { "n": "武清" }, { "n": "宝坻" }, { "n": "宁河" }, { "n": "静海" }, { "n": "蓟县" }] }, { "p": "河北省", "c": [{ "n": "石家庄" }, { "n": "唐山" }, { "n": "秦皇岛" }, { "n": "邯郸" }, { "n": "邢台" }, { "n": "保定" }, { "n": "张家口" }, { "n": "承德" }, { "n": "沧州" }, { "n": "廊坊" }, { "n": "衡水" }] }, { "p": "山西省", "c": [{ "n": "太原" }, { "n": "大同" }, { "n": "阳泉" }, { "n": "长治" }, { "n": "晋城" }, { "n": "朔州" }, { "n": "晋中" }, { "n": "运城" }, { "n": "忻州" }, { "n": "临汾" }, { "n": "吕梁" }] }, { "p": "内蒙古", "c": [{ "n": "呼和浩特" }, { "n": "包头" }, { "n": "乌海" }, { "n": "赤峰" }, { "n": "通辽" }, { "n": "鄂尔多斯" }, { "n": "呼伦贝尔" }, { "n": "巴彦淖尔" }, { "n": "乌兰察布" }, { "n": "兴安" }, { "n": "锡林郭勒" }, { "n": "阿拉善" }] }, { "p": "辽宁省", "c": [{ "n": "沈阳" }, { "n": "大连" }, { "n": "鞍山" }, { "n": "抚顺" }, { "n": "本溪" }, { "n": "丹东" }, { "n": "锦州" }, { "n": "营口" }, { "n": "阜新" }, { "n": "辽阳" }, { "n": "盘锦" }, { "n": "铁岭" }, { "n": "朝阳" }, { "n": "葫芦岛" }] }, { "p": "吉林省", "c": [{ "n": "长春" }, { "n": "吉林" }, { "n": "四平" }, { "n": "辽源" }, { "n": "通化" }, { "n": "白山" }, { "n": "松原" }, { "n": "白城" }, { "n": "延边" }] }, { "p": "黑龙江", "c": [{ "n": "哈尔滨" }, { "n": "齐齐哈尔" }, { "n": "鸡西" }, { "n": "鹤岗" }, { "n": "双鸭山" }, { "n": "大庆" }, { "n": "伊春" }, { "n": "佳木斯" }, { "n": "七台河" }, { "n": "牡丹江" }, { "n": "黑河" }, { "n": "绥化" }, { "n": "大兴安岭" }] }, { "p": "上海市", "c": [{ "n": "黄浦" }, { "n": "卢湾" }, { "n": "徐汇" }, { "n": "长宁" }, { "n": "静安" }, { "n": "普陀" }, { "n": "闸北" }, { "n": "虹口" }, { "n": "杨浦" }, { "n": "闵行" }, { "n": "宝山" }, { "n": "嘉定" }, { "n": "浦东新" }, { "n": "金山" }, { "n": "松江" }, { "n": "南汇" }, { "n": "奉贤" }, { "n": "青浦" }, { "n": "崇明" }] }, { "p": "江苏省", "c": [{ "n": "南京" }, { "n": "无锡" }, { "n": "徐州" }, { "n": "常州" }, { "n": "苏州" }, { "n": "南通" }, { "n": "连云港" }, { "n": "淮安" }, { "n": "盐城" }, { "n": "扬州" }, { "n": "镇江" }, { "n": "泰州" }, { "n": "宿迁" }] }, { "p": "浙江省", "c": [{ "n": "杭州" }, { "n": "宁波" }, { "n": "温州" }, { "n": "嘉兴" }, { "n": "湖州" }, { "n": "绍兴" }, { "n": "金华" }, { "n": "衢州" }, { "n": "舟山" }, { "n": "台州" }, { "n": "丽水" }] }, { "p": "安徽省", "c": [{ "n": "合肥" }, { "n": "芜湖" }, { "n": "蚌埠" }, { "n": "淮南" }, { "n": "马鞍山" }, { "n": "淮北" }, { "n": "铜陵" }, { "n": "安庆" }, { "n": "黄山" }, { "n": "滁州" }, { "n": "阜阳" }, { "n": "宿州" }, { "n": "巢湖" }, { "n": "六安" }, { "n": "亳州" }, { "n": "池州" }, { "n": "宣城" }] }, { "p": "福建省", "c": [{ "n": "福州" }, { "n": "厦门" }, { "n": "莆田" }, { "n": "三明" }, { "n": "泉州" }, { "n": "漳州" }, { "n": "南平" }, { "n": "龙岩" }, { "n": "宁德" }] }, { "p": "江西省", "c": [{ "n": "南昌" }, { "n": "景德镇" }, { "n": "萍乡" }, { "n": "九江" }, { "n": "新余" }, { "n": "鹰潭" }, { "n": "赣州" }, { "n": "宜春" }, { "n": "吉安" }, { "n": "抚州" }, { "n": "上饶" }] }, { "p": "山东省", "c": [{ "n": "济南" }, { "n": "青岛" }, { "n": "淄博" }, { "n": "枣庄" }, { "n": "东营" }, { "n": "烟台" }, { "n": "潍坊" }, { "n": "济宁" }, { "n": "泰安" }, { "n": "威海" }, { "n": "日照" }, { "n": "莱芜" }, { "n": "临沂" }, { "n": "德州" }, { "n": "聊城" }, { "n": "滨州" }, { "n": "菏泽" }] }, { "p": "河南省", "c": [{ "n": "郑州" }, { "n": "开封" }, { "n": "洛阳" }, { "n": "平顶山" }, { "n": "安阳" }, { "n": "鹤壁" }, { "n": "新乡" }, { "n": "焦作" }, { "n": "濮阳" }, { "n": "许昌" }, { "n": "漯河" }, { "n": "三门峡" }, { "n": "南阳" }, { "n": "商丘" }, { "n": "信阳" }, { "n": "周口" }, { "n": "驻马店" }, { "n": "济源" }] }, { "p": "湖北省", "c": [{ "n": "武汉" }, { "n": "黄石" }, { "n": "十堰" }, { "n": "宜昌" }, { "n": "襄樊" }, { "n": "鄂州" }, { "n": "荆门" }, { "n": "孝感" }, { "n": "荆州" }, { "n": "黄冈" }, { "n": "咸宁" }, { "n": "随州" }, { "n": "恩施" }, { "n": "仙桃" }, { "n": "潜江" }, { "n": "天门" }, { "n": "神农架" }] }, { "p": "湖南省", "c": [{ "n": "长沙" }, { "n": "株洲" }, { "n": "湘潭" }, { "n": "衡阳" }, { "n": "邵阳" }, { "n": "岳阳" }, { "n": "常德" }, { "n": "张家界" }, { "n": "益阳" }, { "n": "郴州" }, { "n": "永州" }, { "n": "怀化" }, { "n": "娄底" }, { "n": "湘西" }] }, { "p": "广东省", "c": [{ "n": "广州" }, { "n": "韶关" }, { "n": "深圳" }, { "n": "珠海" }, { "n": "汕头" }, { "n": "佛山" }, { "n": "江门" }, { "n": "湛江" }, { "n": "茂名" }, { "n": "肇庆" }, { "n": "惠州" }, { "n": "梅州" }, { "n": "汕尾" }, { "n": "河源" }, { "n": "阳江" }, { "n": "清远" }, { "n": "东莞" }, { "n": "中山" }, { "n": "潮州" }, { "n": "揭阳" }, { "n": "云浮" }] }, { "p": "广西省", "c": [{ "n": "南宁" }, { "n": "柳州" }, { "n": "桂林" }, { "n": "梧州" }, { "n": "北海" }, { "n": "防城港" }, { "n": "钦州" }, { "n": "贵港" }, { "n": "玉林" }, { "n": "百色" }, { "n": "贺州" }, { "n": "河池" }, { "n": "来宾" }, { "n": "崇左" }] }, { "p": "海南省", "c": [{ "n": "海口" }, { "n": "三亚" }, { "n": "五指山" }, { "n": "琼海" }, { "n": "儋州" }, { "n": "文昌" }, { "n": "万宁" }, { "n": "东方" }, { "n": "定安" }, { "n": "屯昌" }, { "n": "澄迈" }, { "n": "临高" }, { "n": "白沙" }, { "n": "昌江" }, { "n": "乐东" }, { "n": "陵水" }, { "n": "保亭" }, { "n": "琼中" }, { "n": "西沙" }, { "n": "南沙" }, { "n": "中沙" }] }, { "p": "重庆市", "c": [{ "n": "渝中" }, { "n": "大渡口" }, { "n": "江北" }, { "n": "沙坪坝" }, { "n": "九龙坡" }, { "n": "南岸" }, { "n": "北碚" }, { "n": "万盛" }, { "n": "双挢" }, { "n": "渝北" }, { "n": "巴南" }, { "n": "万州" }, { "n": "涪陵" }, { "n": "黔江" }, { "n": "长寿" }, { "n": "江津" }, { "n": "合川" }, { "n": "永川" }, { "n": "南川" }, { "n": "綦江" }, { "n": "潼南" }, { "n": "铜梁" }, { "n": "大足" }, { "n": "荣昌" }, { "n": "壁山" }, { "n": "垫江" }, { "n": "武隆" }, { "n": "丰都" }, { "n": "城口" }, { "n": "梁平" }, { "n": "开县" }, { "n": "巫溪" }, { "n": "巫山" }, { "n": "奉节" }, { "n": "云阳" }, { "n": "忠县" }, { "n": "石柱" }, { "n": "彭水" }, { "n": "酉阳" }, { "n": "秀山" }] }, { "p": "四川省", "c": [{ "n": "成都" }, { "n": "自贡" }, { "n": "攀枝花" }, { "n": "泸州" }, { "n": "德阳" }, { "n": "绵阳" }, { "n": "广元" }, { "n": "遂宁" }, { "n": "内江" }, { "n": "乐山" }, { "n": "南充" }, { "n": "眉山" }, { "n": "宜宾" }, { "n": "广安" }, { "n": "达川" }, { "n": "雅安" }, { "n": "巴中" }, { "n": "资阳" }, { "n": "阿坝" }, { "n": "甘孜" }, { "n": "凉山" }] }, { "p": "贵州省", "c": [{ "n": "贵阳" }, { "n": "六盘水" }, { "n": "遵义" }, { "n": "安顺" }, { "n": "铜仁" }, { "n": "黔西南" }, { "n": "毕节" }, { "n": "黔东南" }, { "n": "黔南" }] }, { "p": "云南省", "c": [{ "n": "昆明" }, { "n": "曲靖" }, { "n": "玉溪" }, { "n": "保山" }, { "n": "昭通" }, { "n": "丽江" }, { "n": "普洱" }, { "n": "临沧" }, { "n": "楚雄" }, { "n": "红河" }, { "n": "文山" }, { "n": "西双版纳" }, { "n": "大理" }, { "n": "德宏" }, { "n": "怒江" }, { "n": "迪庆" }] }, { "p": "西藏", "c": [{ "n": "拉萨" }, { "n": "昌都" }, { "n": "山南" }, { "n": "日喀则" }, { "n": "那曲" }, { "n": "阿里" }, { "n": "林芝" }] }, { "p": "陕西省", "c": [{ "n": "西安" }, { "n": "铜川" }, { "n": "宝鸡" }, { "n": "咸阳" }, { "n": "渭南" }, { "n": "延安" }, { "n": "汉中" }, { "n": "榆林" }, { "n": "安康" }, { "n": "商洛" }] }, { "p": "甘肃省", "c": [{ "n": "兰州" }, { "n": "嘉峪关" }, { "n": "金昌" }, { "n": "白银" }, { "n": "天水" }, { "n": "武威" }, { "n": "张掖" }, { "n": "平凉" }, { "n": "酒泉" }, { "n": "庆阳" }, { "n": "定西" }, { "n": "陇南" }, { "n": "临夏" }, { "n": "甘南" }] }, { "p": "青海省", "c": [{ "n": "西宁" }, { "n": "海东" }, { "n": "海北" }, { "n": "黄南" }, { "n": "海南" }, { "n": "果洛" }, { "n": "玉树" }, { "n": "梅西" }] }, { "p": "宁夏省", "c": [{ "n": "银川" }, { "n": "石嘴山" }, { "n": "吴忠" }, { "n": "固原" }, { "n": "中卫" }] }, { "p": "新疆", "c": [{ "n": "乌鲁木齐" }, { "n": "克拉玛依" }, { "n": "吐鲁番" }, { "n": "哈密" }, { "n": "昌吉" }, { "n": "博尔塔拉" }, { "n": "巴音郭楞" }, { "n": "阿克苏" }, { "n": "克孜勒苏" }, { "n": "喀什" }, { "n": "和田" }, { "n": "伊犁" }, { "n": "塔城" }, { "n": "阿勒泰" }, { "n": "石河子" }, { "n": "阿拉尔" }, { "n": "图木舒克" }, { "n": "五家渠" }] }, { "p": "台湾省", "c": [{ "n": "台北市" }, { "n": "高雄市" }, { "n": "基隆市" }, { "n": "台中市" }, { "n": "台南市" }, { "n": "新竹市" }, { "n": "嘉义市" }, { "n": "台北县" }, { "n": "宜兰县" }, { "n": "桃园县" }, { "n": "新竹县" }, { "n": "苗栗县" }, { "n": "台中县" }, { "n": "彰化县" }, { "n": "南投县" }, { "n": "云林县" }, { "n": "嘉义县" }, { "n": "台南县" }, { "n": "高雄县" }, { "n": "屏东县" }, { "n": "台东县" }, { "n": "花莲县" }, { "n": "澎湖县" }] }, { "p": "香港", "c": [{ "n": "香港" }] }, { "p": "澳门", "c": [{ "n": "澳门" }] }] }, { "co": "其它", "cp": [{ "p": "其它", "c": [{ "n": "其它" }] }] }] };;
  10625. ///<jscompress sourcefile="FindPassword.js" />
  10626. Namespace.register("U.MD.U.F"); //用户找回帐号
  10627. //#region 切换找回方式
  10628. /**
  10629. * 弹出密码找回
  10630. *
  10631. */
  10632. U.MD.U.F.findPassword = function () {
  10633. var _parent = U.selectEl("#U_MD_U_L_login"); //登录注册框
  10634. //弹出密码找回
  10635. var _child = _parent.Child(); //获取登录注册找回密码的div
  10636. _child[1].style.display = "none"; //隐藏注册
  10637. _child[2].style.display = "none"; //隐藏登录
  10638. U.selectEl("div", _child[0])[2].innerHTML = "找回密码";
  10639. //头部设置内容
  10640. var _head = U.selectEl(_child[0]).childs()[1];
  10641. U.selectEl(_head).addAttrArray({
  10642. "innerHTML": "",
  10643. "onclick": null,
  10644. "className": "",
  10645. "title": ""
  10646. });
  10647. //调用找回密码的上下部的处理,设置为第一步
  10648. U.MD.U.F.findPasswordProcessing($(_child[3]).Child()[1], 0);
  10649. //显示的默认密保找回处理
  10650. U.MD.U.F.switchEmailOrSecurityFind($("span", _child[3])[0], 'security');
  10651. _child[3].style.display = "block"; //显示找回密码
  10652. }
  10653. /**
  10654. * 手机号找回后的上下步操作处理
  10655. *
  10656. * @param {element} 找回密码元素
  10657. * @param {int} 第几步
  10658. */
  10659. U.MD.U.F.findPasswordProcessing = function (el, displaynum) {
  10660. var _inputs,
  10661. _len,
  10662. _bottom,
  10663. _child = U.selectEl(el).Child(), //获取找回和确认找回的两个步骤的元素
  10664. _parentel = U.selectEl(el).Parent();
  10665. //找回密码确认上下步处理
  10666. for (i = 0; i < _child.length; i++) {
  10667. //判断显示的隐藏的区域处理
  10668. if (i == displaynum) { //如果是显示
  10669. _child[i].style.display = "block";
  10670. _inputs = U.selectEl("input", _child[i]); //获取显示的元素下的input元素
  10671. _len = _inputs.length; //输入框的总长度
  10672. }
  10673. else { //隐藏
  10674. _child[i].style.display = "none";
  10675. }
  10676. }
  10677. //使用聚焦和释放的方式,重新设置input的初始化样式
  10678. while (_len--) {
  10679. _inputs[_len].value = "";
  10680. _inputs[_len].innerText = "6-20位字符或数字";
  10681. _inputs[_len].focus();
  10682. _inputs[_len].blur();
  10683. }
  10684. }
  10685. /**
  10686. * 切换找回的方式,邮箱,密保,手机切找回的方式
  10687. *
  10688. */
  10689. U.MD.U.F.switchEmailOrSecurityFind = function (el, typename) {
  10690. var _input,
  10691. _tempel,
  10692. _parentel = U.selectEl(el).Parent(2),
  10693. _childs = U.selectEl(_parentel).Child(),
  10694. _inputs = U.selectEl("input", _parentel),
  10695. _span = U.selectEl("span", _parentel),
  10696. _is = U.selectEl("i", _parentel),
  10697. _bottom = U.selectEl(_parentel).Child()[2],
  10698. _code = U.selectEl("#U_MD_U_L_Overflow_Code")[0]; //验证码框
  10699. //如果是邮箱找回处理
  10700. if (typename == "email") {
  10701. _input = _inputs[1];
  10702. _tempel = $$("input", {
  10703. "type": "text",
  10704. "onblur": function () {
  10705. U.MD.U.F.checkEmail(this); U.selectEl(this).parentElement(2).removeClass('U_MD_U_L_Box_Border');
  10706. },
  10707. "onfocus": _input.onfocus,
  10708. "onkeyup": _input.onkeyup
  10709. });
  10710. _input.parentNode.replaceChild(_tempel, _input);
  10711. _is[1].innerText = "请输入邮箱";
  10712. _span[1].className = "U_MD_U_F_T_Hover";
  10713. _span[0].className = "";
  10714. _code.style.display = "none"; //验证码框
  10715. _bottom.onclick = function () {
  10716. U.MD.U.F.findPasswordByEmail(_childs[1]);
  10717. }
  10718. }
  10719. //如果是手机找回处理
  10720. else if (typename == 'security') {//更改style
  10721. _input = _inputs[1];
  10722. _tempel = $$("input", {
  10723. "type": "text",
  10724. "onblur": function () {
  10725. U.MD.U.F.checkPhone(this); U.selectEl(this).parentElement(2).removeClass('U_MD_U_L_Box_Border');
  10726. }, //更改onblur事件
  10727. "onfocus": _input.onfocus, //更改onfocus事件
  10728. "onkeyup": _input.onkeyup//更改onkeyup事件
  10729. });
  10730. _input.parentNode.replaceChild(_tempel, _input); //替换
  10731. _is[1].innerText = "请输入手机号";
  10732. _span[0].className = "U_MD_U_F_T_Hover"; //更改class
  10733. _span[1].className = ""; //更改class
  10734. _code.style.display = "block"; //验证码框
  10735. _inputs[3].value = "发送"; //验证码框内的value
  10736. _inputs[3].onclick = function () {//验证码框的点击事件
  10737. U.MD.U.F.userName(U.MD.U.F.phoneSend); //验证用户名是否存在
  10738. }
  10739. _bottom.onclick = function () {//设定提交按钮的点击事件
  10740. U.MD.U.F.phoneConfirm(_childs[1]); //确认验证码
  10741. }
  10742. }
  10743. }
  10744. //#endregion
  10745. //#region 手机找回
  10746. /**
  10747. * 手机号设置
  10748. *
  10749. * @param {element} 手机号设置处理
  10750. */
  10751. U.MD.U.F.checkSecurityCode = function (el) {
  10752. var _inputs = U.selectEl("input", el), //输入框
  10753. _username = _inputs[0], //密码
  10754. _phone = _inputs[1]; //确认手机号
  10755. if (U.MD.U.F.checkUserName(_username) && U.MD.U.F.checkPhone(_phone)) {//判断账号和手机号是否输入指定格式
  10756. U.MD.U.F.phoneCheckSecurityCode(["", el, _username, _phone])//调用后台处理用户的修改密码
  10757. }
  10758. }
  10759. /**
  10760. * 手机发送验证码
  10761. *
  10762. */
  10763. U.MD.U.F.phoneSend = function () {
  10764. var _username = U.selectEl("#U_MD_U_L_Box_height")[0].children[0].children[0].value; //用户名
  10765. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserName", _username], function (r) {//根据用户名获取用户信息
  10766. if (r.value[0] == undefined) { //判断是否输入手机号
  10767. U.MD.U.R.setInputStyle($("#userphone")[0].children[0], {//给$("#userphone")[0].children[0] 设置 一个红色边框的样式 让用户知道你输入的手机号与账号设置的手机号不匹配
  10768. "color": "red",
  10769. "textAlign": "right",
  10770. "display": "block"
  10771. }, "输入的手机号与账号不匹配");
  10772. return false; //如果输入手机号与账号设置的手机号不匹配 return false
  10773. }
  10774. if (r.value[0].UserTelephoneNumber != U.selectEl("#userphone")[0].children[0].children[0].value) {//如果输入手机号与账号设置的手机号不匹配)
  10775. U.MD.U.R.setInputStyle($("#userphone")[0].children[0], {//给$("#userphone")[0].children[0] 设置 一个红色边框的样式 让用户知道你输入的手机号与账号设置的手机号不匹配
  10776. "color": "red",
  10777. "textAlign": "right",
  10778. "display": "block"
  10779. }, "输入的手机号与账号不匹配");
  10780. return false; //如果输入手机号与账号设置的手机号不匹配 return false
  10781. }
  10782. else {//如果输入手机号与账号匹配 向手机发送验证码
  10783. // U.A.Request("http://api.cloudsql.1473.cn/postnumber", [$("#userphone")[0].children[0].children[0].value], function (r) {
  10784. // console.log(r);
  10785. // });
  10786. var _xhttp = new XMLHttpRequest(); //XMLHttpRequest 对象用于在后台与服务器交换数据
  10787. _xhttp.onreadystatechange = function () {//每当 readyState 属性改变时,就会调用该函数。
  10788. if (this.readyState == 4) {//发送成功后
  10789. if (this.status == 201) {
  10790. U.Alert('发送成功'); //弹出发送成功
  10791. U.MD.U.F.setTime($("#U_MD_U_L_Overflow_Code")[0].children[1].children[0]); //60秒倒计时
  10792. } else {
  10793. U.Alert(JSON.parse(this.response).err || '验证码发送失败,请重新发送...');
  10794. }
  10795. }
  10796. };
  10797. _xhttp.open("POST", "http://api.cloudsql.1473.cn/postnumber", true); //指定和服务器端交互的HTTP方法,URL地址及其他请求信息
  10798. _xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //向一个打开但未发送的请求设置或添加一个 HTTP 请求
  10799. _xhttp.withCredentials = true; //发送cookie等认证信息到服务端
  10800. _xhttp.send("number=" + U.selectEl("#userphone")[0].children[0].children[0].value); //$("#userphone")[0].children[0].children[0].value 发送的手机号输入的框
  10801. // U.A.Request.Post("http://api.cloudsql.1473.cn/postnumber", { number: U.selectEl("#userphone")[0].children[0].children[0].value }, function () {
  10802. // U.MD.U.F.setTime($("#U_MD_U_L_Overflow_Code")[0].children[1].children[0]); //60秒倒计时
  10803. // U.Alert('发送成功'); //弹出发送成功
  10804. // });
  10805. }
  10806. })
  10807. }
  10808. /**
  10809. * 手机确认验证码
  10810. *
  10811. * @param {element} 确认验证码的按钮
  10812. */
  10813. U.MD.U.F.phoneConfirm = function (el) {
  10814. var _xhttp = new XMLHttpRequest(); //XMLHttpRequest 对象用于在后台与服务器交换数据
  10815. _xhttp.onreadystatechange = function () {//每当 readyState 属性改变时,就会调用该函数
  10816. if (this.readyState == 4) {//验证成功后
  10817. if (this.status == 201) {
  10818. U.MD.U.F.checkSecurityCode(el); //手机号设置
  10819. U.Alert("验证成功"); //弹出验证成功
  10820. } else {
  10821. U.Alert(JSON.parse(this.response).err || "验证码有误");
  10822. }
  10823. }
  10824. };
  10825. _xhttp.open("POST", "http://api.cloudsql.1473.cn/verifi", true); ////指定和服务器端交互的HTTP方法,URL地址及其他请求信息
  10826. _xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //向一个打开但未发送的请求设置或添加一个 HTTP 请求
  10827. _xhttp.withCredentials = true; //发送cookie等认证信息到服务端
  10828. _xhttp.send("code=" + U.selectEl("#U_MD_U_L_Overflow_Code")[0].children[0].children[0].value); //$("#U_MD_U_L_Overflow_Code")[0].children[0].children[0].value 验证码输入的框
  10829. }
  10830. /**
  10831. * 手机重新发送验证码倒计时
  10832. * @param {object} 倒计时的对象
  10833. * @param {number} 倒计时的时间(秒数)
  10834. */
  10835. U.MD.U.F.setTime = function (obj, countdown) {
  10836. var countdown = 60;
  10837. var _settime = setInterval(function () { //setInterval(需要执行的javascript代码,在执行代码前需等待的毫秒数)
  10838. if (countdown == 0) { //倒计时变量为0
  10839. obj.removeAttribute("disabled"); //让obj可以使用
  10840. obj.value = "重新获取验证码";
  10841. clearInterval(_settime); //停止倒计时
  10842. return;
  10843. } else {//如果countdown不等于零 每秒countdown会减少1
  10844. obj.setAttribute("disabled", true); //禁用obj
  10845. obj.value = "重新发送(" + countdown + ")"; //显示倒计时的事件
  10846. countdown--; //倒计时时间 -1S
  10847. }
  10848. }, 1000);
  10849. }
  10850. /**
  10851. * 验证用户名是否存在
  10852. *
  10853. * @param {function} cb 回调函数
  10854. */
  10855. U.MD.U.F.userName = function (cb) {
  10856. U.A.Request(US.USER, ["CheckUserName", U_MD_U_L_Box_height.children[0].children[0].value], //验证用户名是否存在
  10857. function (r) {//回调函数
  10858. var _str = U.UF.C.jsonToStr(r.value); //序列化json为字符串
  10859. if (_str == "false") {//如果用户名不存在
  10860. U.MD.U.R.setInputStyle(U_MD_U_L_Box_height, {//如果不存在 用户名的框变红色 并且提示 用户名不存在
  10861. "color": "red",
  10862. "textAlign": "right",
  10863. "display": "block"
  10864. }, "用户名不存在");
  10865. }
  10866. cb(); //回调函数
  10867. })
  10868. }
  10869. /**
  10870. * 手机号设置处理
  10871. *
  10872. * @param {object} 数据库匹配手机号是否正确
  10873. */
  10874. U.MD.U.F.phoneCheckSecurityCode = function (r) {
  10875. var _bottom,
  10876. _childs,
  10877. _username = r[2], //输入密码框
  10878. _enterpassword = r[3], //确认密码框
  10879. _el = U.selectEl(_username).Parent(4)
  10880. ;
  10881. //如果密保匹配成功处理
  10882. if (r) {
  10883. //如果账号和手机号匹配成功的处理
  10884. U.MD.U.F.findPasswordProcessing(_el, 1); //手机找回的步骤
  10885. _bottom = U.selectEl(_el.parentNode).Child()[2]; //得到确认框
  10886. _childs = U.selectEl("input", _el); //获取所有的输入
  10887. //点击事件处理
  10888. _bottom.onclick = function () {
  10889. U.MD.U.F.setNewUserPassword(r, _childs[1]); //新密码设置
  10890. };
  10891. }
  10892. else {
  10893. //账号或者密保错误
  10894. U.MD.U.R.setInputStyle(_enterpassword, {//给_enterpassword 设置 一个红色边框的样式 让用户知道用户输入账号或者密保错误
  10895. "color": "red",
  10896. "textAlign": "right",
  10897. "display": "block"
  10898. }, "账号或者密保错误");
  10899. }
  10900. }
  10901. /**
  10902. * 新密码设置
  10903. *
  10904. * @param {string} 用户id
  10905. * @param {string} 密码
  10906. * @param {string} 确认密码
  10907. * @param {string} 用户id
  10908. */
  10909. U.MD.U.F.setNewUserPassword = function (userinfo, phone) {
  10910. //判断用户输入的密码是否正确的处理
  10911. var _newpassword = userinfo[1].children[1].children[0].children[0].children[0].value; //密码
  10912. var _newpasswordt = userinfo[1].children[1].children[1].children[0].children[0].value; //再次输入密码
  10913. if (U.MD.U.F.checkConfirmPassword(_newpassword, _newpasswordt)) {//如果 密码和再次输入的密码 相同
  10914. U.A.Request(US.USER, ["UpdateUserPasswordByOldPhoneNumber", phone.value, _newpassword], //修改密码
  10915. U.MD.U.F.asynSetNewUserPassword); //修改密码成功后执行的函数
  10916. }
  10917. }
  10918. /**
  10919. * 新密码设置
  10920. *
  10921. * @param {object} 设置密码成功的异步ajax对象
  10922. */
  10923. U.MD.U.F.asynSetNewUserPassword = function (r) {
  10924. if (r.value) {
  10925. U.alert("修改密码成功,请登录");
  10926. U.MD.U.L.login(); //直接回到登录页面
  10927. };
  10928. }
  10929. //#endregion
  10930. //#region 通过邮箱找回
  10931. /**
  10932. * 通过邮箱找回
  10933. *
  10934. * @param {element} 输入框所在的位置
  10935. */
  10936. U.MD.U.F.findPasswordByEmail = function (el) {
  10937. var _inputs = U.selectEl("input", el),
  10938. _username = _inputs[0],
  10939. _email = _inputs[1];
  10940. //判断是否发送邮箱
  10941. if (U.MD.U.F.checkEmail(_email) && U.MD.U.F.checkUserName(_username)) {
  10942. U.A.Request(US.USER, ["FindPasswordByEmail", _username.value, _email.value], U.MD.U.F.asynFindPasswordByEmail);
  10943. }
  10944. }
  10945. /**
  10946. * 通过邮箱找回
  10947. *
  10948. * @param {object} ajax返回的值
  10949. */
  10950. U.MD.U.F.asynFindPasswordByEmail = function (r) {
  10951. //成功发送
  10952. if (r.value == "2") {
  10953. U.alert("已经发送邮箱,请及时查看密码");
  10954. U.MD.U.L.init();
  10955. //U.MD.U.L.login(); //直接回到登录页面
  10956. }
  10957. //账号不存在处理
  10958. else if (r.value == "0") {
  10959. U.alert("您输入的账号不存在");
  10960. }
  10961. //邮箱和账号不匹配处理
  10962. else if (r.value == "1") {
  10963. U.alert("邮箱账号不匹配");
  10964. }
  10965. }
  10966. //#endregion
  10967. //#region 密码和密保检查
  10968. /**
  10969. * 判断有限是否正确
  10970. *
  10971. * @param {object} 输入用户名的框
  10972. */
  10973. U.MD.U.F.checkEmail = function (inputel) {
  10974. var _email = inputel.value; //获取用户名
  10975. //输入为空不做变化
  10976. if (_email == "") {
  10977. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "请输入邮箱"); //输入的用户名为空的样式处理
  10978. }
  10979. //注册的用户不符合要求
  10980. else if (!U.UF.S.Email.test(_email)) {
  10981. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right' }, "请输入正确邮箱"); //注册用户名不符合提示
  10982. }
  10983. else {
  10984. return true;
  10985. }
  10986. return false;
  10987. }
  10988. /**
  10989. * 手机号输入格式检查
  10990. *
  10991. * @param {object} 输入手机号的框
  10992. */
  10993. U.MD.U.F.checkPhone = function (inputel) {
  10994. var _password = inputel.value; //输入手机号的value
  10995. //如果没有输入手机号
  10996. if (_password == "") {
  10997. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "请输入手机号"); //没有输入手机号的提示
  10998. }
  10999. //输入的手机号的格式不对
  11000. else if (!/^1[3|4|5|8][0-9]\d{4,8}$/.test(_password)) {
  11001. U.MD.U.R.setInputStyle(inputel, { "display": "block", "color": "red", 'textAlign': 'right' }, "请输入有效手机号"); //输入的手机号有问题
  11002. }
  11003. else {
  11004. return true;
  11005. }
  11006. return false;
  11007. }
  11008. /**
  11009. * 密码输入格式检查
  11010. *
  11011. * @param {object} 输入密码的框
  11012. */
  11013. U.MD.U.F.checkPass = function (inputel) {
  11014. var _password = inputel.value;
  11015. //如果没有输入密码
  11016. if (_password == "") {
  11017. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "6-20位字符或数字"); //没有输入密码的提示
  11018. }
  11019. //输入的密码的格式不对
  11020. else if (!U.UF.S.PassWord.test(_password)) {
  11021. U.MD.U.R.setInputStyle(inputel, { "display": "block", "color": "red", 'textAlign': 'right' }, "6-20位字符或数字"); //输入的密码有问题
  11022. }
  11023. else {
  11024. return true;
  11025. }
  11026. return false;
  11027. }
  11028. /**
  11029. * 验证码输入格式
  11030. *
  11031. */
  11032. U.MD.U.F.Verification = function (inputel) {
  11033. var _code = inputel.value;
  11034. //如果没有输入验证码
  11035. if (_code == "") {
  11036. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "请输入验证码"); //没有输入验证码的提示
  11037. }
  11038. //输入的验证码的格式不对
  11039. else if (!/^\d{4,6}$/.test(_code)) {
  11040. U.MD.U.R.setInputStyle(inputel, { "display": "block", "color": "red", 'textAlign': 'right' }, "请输入4-6位数的验证码"); //输入的验证码有问题
  11041. }
  11042. else {
  11043. return true;
  11044. }
  11045. return false;
  11046. }
  11047. /**
  11048. * 判断输入框的值是否是账号或者邮箱
  11049. *
  11050. */
  11051. U.MD.U.F.checkUserName = function (inputel) {
  11052. var _username = inputel.value; //获取用户名
  11053. //输入为空不做变化
  11054. if (_username == "") {
  11055. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "云端账号"); //输入的用户名为空的样式处理
  11056. }
  11057. //注册的用户不符合要求
  11058. else if (!U.UF.S.UserName.test(_username)) {
  11059. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right' }, "4-14位数字或者字母"); //注册用户名不符合提示
  11060. }
  11061. else {
  11062. return true;
  11063. }
  11064. return false;
  11065. }
  11066. /**
  11067. * 判断输入密码和确认密码是否一致处理
  11068. *
  11069. * @param {element} 密码
  11070. * @param {element} 确认密码
  11071. */
  11072. U.MD.U.F.checkConfirmPassword = function (inputo, inputt) {
  11073. var _password = inputt.value;
  11074. //如果没有输入密码
  11075. if (_password == "") {
  11076. U.MD.U.R.setInputStyle(inputt, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "6-20位字符或数字"); //没有输入密码的提示
  11077. }
  11078. //输入的密码的格式不对
  11079. else if (!U.UF.S.PassWord.test(_password)) {
  11080. U.MD.U.R.setInputStyle(inputt, { "display": "block", "color": "red", 'textAlign': 'right' }, "6-20位字符或数字"); //输入的密码有问题
  11081. }
  11082. //输入密码和确认密码不相同
  11083. else if (inputo.value != inputt.value) {
  11084. U.MD.U.R.setInputStyle(inputt, { "display": "block", "color": "red", 'textAlign': 'right' }, "密码不一致"); //输入的密码有问题
  11085. }
  11086. else {
  11087. return true;
  11088. }
  11089. return false;
  11090. }
  11091. //#endregion
  11092. ;
  11093. ///<jscompress sourcefile="Login.js" />
  11094. Namespace.register("U.MD.U.L"); //用户登录的命名空间
  11095. /*
  11096. 问题:
  11097. 1、验证码的接口问题
  11098. 2、无窗体的接口
  11099. */
  11100. //#region 配置数据
  11101. //U.MD.U.L.loginCallBack; //登录后的回调使用
  11102. //U.MD.U.L.isLogining = false; //判断用户登录状态。cookie登录状态为cookie,账号登录为true,没有登录为false
  11103. //#endregion
  11104. //#region 登录
  11105. U.MD.U.L.init = function () {
  11106. var _parent = U.selectEl("#U_MD_U_L_login"); //登录注册框
  11107. var _child = _parent.Child(); //获取登录注册找回密码的div
  11108. _child[1].style.display = "none"; //隐藏注册框
  11109. _child[2].style.display = "block"; //显示登录
  11110. _child[3].style.display = "none"; //隐藏找回密码
  11111. //标题修改
  11112. U.selectEl("div", _child[0])[2].innerHTML = "登录";
  11113. //头部设置内容
  11114. var _head = U.selectEl(_child[0]).childs()[1];
  11115. U.selectEl(_head).addAttrArray({
  11116. innerHTML: "",
  11117. "className": "",
  11118. title: ""
  11119. });
  11120. var _username = U.UF.Cookie.get("usestudiosso", "username")[0]; //上次登录的用户名
  11121. var _input = U.selectEl("input", _child[2]);
  11122. if (_username) { //cookie存在 登录处理
  11123. _input[0].focus(); //聚焦处理
  11124. _input[0].value = _username; //设置cookie用户名
  11125. _input = _input[1]; //当前需要聚焦
  11126. }
  11127. else { //注册 找回密码 聚焦元素处理
  11128. _input = _input[0];
  11129. }
  11130. _input.focus();
  11131. }
  11132. /**
  11133. * 判断用户是否登录如果未登陆则弹出登陆框
  11134. * @param {element} 输入框
  11135. * @param {element} 确定框
  11136. *
  11137. */
  11138. U.MD.U.L.loginEnter = function (inputel, bottomel) {
  11139. var i,
  11140. _parentel = U.selectEl(inputel).Parent(3), //获取父亲层
  11141. _inputs = U.selectEl("input", _parentel); //获取所有的输入框
  11142. //循环input
  11143. for (i = 0; i < _inputs.length; i++) {
  11144. if (_inputs[i].value == "") { //如果没有输入文字的处理
  11145. _inputs[i].focus();
  11146. return;
  11147. }
  11148. }
  11149. //回车处理
  11150. bottomel.onclick();
  11151. }
  11152. //#endregion
  11153. //#region 登录数据使用
  11154. /**
  11155. * 1473桌面直接登录,单击登录按钮时触发的函数
  11156. * @param {object} ajax返回值
  11157. *
  11158. */
  11159. U.MD.U.L.clickLogin = function (bottomel) {
  11160. var _parentel = U.selectEl(bottomel).Parent(), //类名为"U_MD_U_L_T"的div元素
  11161. _inputel = U.selectEl("input", _parentel), //获取里面的input,共三个
  11162. _username = _inputel[0].value, //第一个input为用户名
  11163. _password = _inputel[1].value, //第二个input为密码
  11164. _static = _inputel[2].checked ? "1" : "0"; //第三个input为状态
  11165. //以前已经登录过,则直接跳转回调函数
  11166. if (_username && _username == US.userInfo.UserName) {
  11167. U.selectEl("#U_MD_HomeC_Pop")[0].close(); //关闭登陆款
  11168. }
  11169. //以前没有登录过,则清空密码输入 等待用户登录
  11170. else if (U.MD.U.L.loginAjax(_username, _password, _static, U.selectEl(_parentel).Parent())) {
  11171. _inputel[1].value = ""; //密码清空
  11172. }
  11173. }
  11174. /*
  11175. 功能:用户登录云端接口,向后台发送请求,记录用户名和密码,后面还有一个登陆获取用户个人信息。好友信息,及消息通知
  11176. 参数一:用户名
  11177. 参数二:密码
  11178. 参数三:登录窗口div元素,做loading的位置
  11179. 参数四:回调函数
  11180. */
  11181. U.MD.U.L.loginAjax = function (username, password, staticm, loading, fun) {
  11182. var _logaddress = US.city.userAllLocation || ""; //登录地址;
  11183. //加载用户信息 且进行异步处理
  11184. if (username.removeP() && password.removeP()) {
  11185. if (fun) { U.MD.U.L.loginCallBack = fun; } //设置回调函数
  11186. U.MD.U.L.isLogining = true; //电脑卡的时候,用户一直点登录,此处判断用户是否已经按下了登录按钮。
  11187. //此处指返回用户基本信息
  11188. U.A.Request(US.USER, ["UserLogin", username, password, staticm], U.MD.U.L.asynLoginAjax, [loading, _logaddress, username, password]);
  11189. return true;
  11190. }
  11191. }
  11192. /**
  11193. * 用户登录执行事件
  11194. * @param {object} ajax返回的对象
  11195. * @param {boolean} 是否是cookie登陆
  11196. *
  11197. */
  11198. U.MD.U.L.asynLoginAjax = function (r, iscookie) {
  11199. if ($('#U_MD_U_L_Login_B')[0]) {
  11200. U.selectEl('#U_MD_U_L_Login_B')[0].innerHTML = '登录';
  11201. }
  11202. if (U.MD.U.L.loginCallBack) {
  11203. U.MD.U.L.loginCallBack(r, iscookie); //回调处理
  11204. }
  11205. }
  11206. /**
  11207. * 判断用户名是否符合要求
  11208. *
  11209. */
  11210. U.MD.U.L.checkUserName = function (inputel) {
  11211. var _username = inputel.value; //获取用户名
  11212. //输入为空不做变化
  11213. U.selectEl('.U_MD_U_L_Box_B').removeClass('U_MD_U_L_Box_mistakeBorder');
  11214. if ($('.U_MD_U_L_Box_checkUseNameFormat')[0]) {//检测账号格式提示是否存在
  11215. U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkUseNameFormat')[0]);
  11216. }
  11217. if (_username == "") {
  11218. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "用户账号"); //输入的用户名为空的样式处理
  11219. return false;
  11220. }
  11221. //注册的用户不符合要求
  11222. else if (!U.UF.S.UserName.test(_username)) {
  11223. $$("div", { className: 'checkUseNameFormat' }, U.selectEl(".U_MD_U_L_Box_B")[0]);
  11224. U.selectEl('.U_MD_U_L_Box_B').addClass(" U_MD_U_L_Box_mistakeBorder");
  11225. U_MD_U_L_createFormat($('.U_MD_U_L_LB')[1], U.selectEl('.U_MD_U_L_Box_P_B')[1]);
  11226. //U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right', 'marginRight': '15px' }, "2-10汉字或4-20字符"); //注册用户名不符合提示
  11227. return false;
  11228. }
  11229. return true;
  11230. }
  11231. /**
  11232. *创建用户账号是否标准提醒
  11233. *
  11234. */
  11235. U_MD_U_L_createFormat = function (parentnode, beforenode) {
  11236. if ($('.U_MD_U_L_Box_checkUseNameFormat')[0]) {
  11237. U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkUseNameFormat')[0]);
  11238. }
  11239. var _format = document.createElement('div');
  11240. _format.className = "U_MD_U_L_Box_checkUseNameFormat";
  11241. _format.innerText = "2-10汉字或4-20字符";
  11242. parentnode.insertBefore(_format, beforenode);
  11243. }
  11244. /**
  11245. * 判断用户名是否符合要求
  11246. *
  11247. */
  11248. U.MD.U.L.checkpassword = function (inputel) {
  11249. var _password = inputel.value; //获取用户名
  11250. //输入为空不做变化
  11251. if (_password == "") {
  11252. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "用户密码"); //输入的用户名为空的样式处理
  11253. }
  11254. }
  11255. //#endregion
  11256. ;
  11257. ///<jscompress sourcefile="Logout.js" />
  11258. Namespace.register("U.MD.U.LO"); //用户登录的命名空间
  11259. /**
  11260. * 退出登录提示
  11261. *
  11262. * @param callback {function} 登出回调函数
  11263. */
  11264. U.MD.U.LO.logoutSystem = function (callback) {
  11265. //如果用户登录的情况
  11266. if (US.userInfo.UserId) {
  11267. //弹出退出登录的提示
  11268. U.UF.UI.confirm("是否退出" + US.userInfo.UserName + "账号", function () {
  11269. U.MD.U.LO.logout(callback);
  11270. });
  11271. }
  11272. }
  11273. /**
  11274. * 退出登录的处理
  11275. *
  11276. */
  11277. U.MD.U.LO.logout = function (callback) {
  11278. U.MD.U.LO.clearCookie(function () {
  11279. U.MD.U.LO.emptyUserInfo(); //清楚用户的前端的数据
  11280. if ($('#UI_Login')[0]) {
  11281. U.selectEl('#UI_Login')[0].contentWindow.U.MD.U.OT.logout(); //如果是第三方平台登录的,在第三方平台进行下线
  11282. }
  11283. //清理图形界面的处理
  11284. if ($("#U_MD_D_BDI")[0]) {
  11285. //清空所有的应用
  11286. U.MD.U.LO.logoutStyle(); //清除注册样式
  11287. U.MD.D.T.taskbar.clear(); //任务栏清除
  11288. U.UF.UI.form.closeWindows(); //关闭所有的窗体
  11289. }
  11290. U.UF.C.isFunction(callback) && callback();
  11291. }); //退出账号的cookie
  11292. }
  11293. /**
  11294. * 用户退出指定帐号 清理cookie
  11295. *
  11296. */
  11297. U.MD.U.LO.clearCookie = function (callback) {
  11298. //判断用户是否登录
  11299. if (US.userInfo.UserId) {
  11300. var _iscookie = U.UF.Cookie.get("usestudiosso", "userid").indexOf(US.userInfo.UserId) > -1; //判断cookie是否还存在用户的id
  11301. //如果存在cookie的出力
  11302. if (_iscookie) {
  11303. //调用后台,让用户注销
  11304. U.A.Request(US.USER, ["UserOffline", US.userInfo.UserId], function () { U.UF.C.isFunction(callback) && callback(); });
  11305. }
  11306. else {
  11307. U.UF.C.isFunction(callback) && callback();
  11308. }
  11309. }
  11310. }
  11311. /**
  11312. * 清空用户前端的信息
  11313. *
  11314. */
  11315. U.MD.U.LO.emptyUserInfo = function () {
  11316. US.userInfo = {}; //用户数据清空
  11317. US.friend = {}; //用户好友信息清空
  11318. if ($("#U_MD_D_BG")[0]) {
  11319. U.MD.D.B.setBackgroundImage(U.MD.D.B.url); //设置默认背景
  11320. }
  11321. }
  11322. /**
  11323. * 注销样式
  11324. *
  11325. */
  11326. U.MD.U.LO.logoutStyle = function () {
  11327. //清楚登录用户的样式
  11328. U.selectEl("#U_MD_D_BDI").addAttrArray({
  11329. "innerHTML": "",
  11330. "className": "U_MD_D_BDI U_Img"
  11331. });
  11332. //获取子元素
  11333. var _childel = U.selectEl("#U_MD_D_BDL").childs();
  11334. _childel[0].style.display = _childel[1].style.display = "block"; //显示登录注册
  11335. _childel[2].style.display = "none"; //隐藏提出按钮
  11336. //右边好友框隐藏
  11337. U.selectEl("#U_MD_F_H_R").css("display", "none");
  11338. //隐藏消息提醒
  11339. U.selectEl("#U_MD_D_MG_OA").Parent(2).style.display = "none";
  11340. //隐藏所有的窗体
  11341. // U.selectEl("#U_MD_Home").childs().css("display", "none");
  11342. }
  11343. ;
  11344. ///<jscompress sourcefile="OutsideLogin.js" />
  11345. Namespace.register("U.MD.U.OT"); //用户登录的命名空间
  11346. //推送的广告词
  11347. U.MD.U.OT.advertisingLanguage = "最新科技:云操作系统,您也来加入吧!点击进入哦!";
  11348. //#region 加载外联登录
  11349. /**
  11350. * 异步加载qq登录的js
  11351. *
  11352. * @param {array} 加载按钮样式(参考qq登录api)
  11353. */
  11354. U.MD.U.OT.qqLoadJs = function (bottonstyle) {
  11355. //加载第三方登录的js
  11356. U.UF.DL.asynLoadJs({
  11357. "data-appid": "100584402",
  11358. "charset": "utf-8",
  11359. "src": "http://qzonestyle.gtimg.cn/qzone/openapi/qc-1.0.1.js"
  11360. },
  11361. function () {
  11362. U.MD.U.OT.asynQqLoadJs(bottonstyle); //腾讯登录加载
  11363. });
  11364. }
  11365. /**
  11366. * qq登录加载异步js成功处理
  11367. *
  11368. * @param {array} 加载按钮样式(参考qq登录api)
  11369. */
  11370. U.MD.U.OT.asynQqLoadJs = function (bottonstyle) {
  11371. //调用加载qq登录按钮加载函数
  11372. QC.Login(bottonstyle, function (qquserinfo) {
  11373. U.MD.U.OT.qqLoginCallBack(qquserinfo);
  11374. });
  11375. //由于qq登录按钮加载后会出现a标签,所以点击会出现错位于是会这里把a标签的href修改成"javascript:void(0)"
  11376. U.selectEl("a", U.selectEl("#" + bottonstyle["btnId"])[0]).addAttrArray({ "href": "javascript:void(0)" });
  11377. }
  11378. /**
  11379. * 异步加载微博登录的js
  11380. *
  11381. * @param {array} 加载按钮样式(参考微博登录api)
  11382. */
  11383. U.MD.U.OT.weiboLoadJs = function (bottonstyle) {
  11384. //异步加载使用,微博登录加载
  11385. U.UF.DL.asynLoadJs({
  11386. "charset": "utf-8",
  11387. "src": "http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=1242324937", //&i=" + Guid.newGuid()
  11388. "charset": "utf-8",
  11389. "type": "text/javascript"
  11390. },
  11391. function () {
  11392. //微博按钮加载处理
  11393. WB2.anyWhere(function (wb) {
  11394. wb.widget.connectButton(bottonstyle); //加载按钮
  11395. U.selectEl("a", U.selectEl("#" + bottonstyle["id"])[0]).addAttrArray({ "href": "javascript:void(0)" });
  11396. });
  11397. });
  11398. }
  11399. /**
  11400. * 异步加载微信登录js
  11401. *
  11402. * @param {array} 加载按钮样式(参考微信登录api)
  11403. */
  11404. U.MD.U.OT.weixinLoadJs = function (bottonstyle) {
  11405. //异步加载微信登录
  11406. U.UF.DL.asynLoadJs({
  11407. "charset": "utf-8",
  11408. "src": "http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js",
  11409. "charset": "utf-8",
  11410. "type": "text/javascript"
  11411. },
  11412. function () {
  11413. //初始化微信
  11414. new WxLogin({
  11415. id: bottonstyle.ID || "",
  11416. appid: "wxae62986df7490c49",
  11417. scope: "snsapi_login",
  11418. redirect_uri: "",
  11419. state: bottonstyle.state || Guid.newGuid(),
  11420. style: bottonstyle.style || "",
  11421. href: bottonstyle.href || ""
  11422. });
  11423. });
  11424. }
  11425. /**
  11426. * 注销第三方登录
  11427. *
  11428. */
  11429. U.MD.U.OT.logout = function () {
  11430. try {
  11431. //退出微博登陆
  11432. if (WB2 && WB2.checkLogin()) {
  11433. WB2.logout();
  11434. }
  11435. } catch (e) { }
  11436. try {
  11437. //退出qq登陆
  11438. if (QC && QC.Login.check()) {
  11439. QC.Login.signOut();
  11440. }
  11441. } catch (e) { }
  11442. }
  11443. //#endregion
  11444. //#region 腾讯登录
  11445. /**
  11446. * 腾讯登录回调
  11447. *
  11448. */
  11449. U.MD.U.OT.qqLoginCallBack = function () {
  11450. //如果用户已经通过qq登录的处理
  11451. if (QC.Login.check()) {
  11452. //获取用户登录openid
  11453. QC.Login.getMe(function (openid, token) {
  11454. var _qquserinfo = {}; //最终得到的qq信息
  11455. _qquserinfo.accessToken = token; //token
  11456. _qquserinfo.openID = openid; //openid
  11457. //获取用户信息
  11458. QC.api("get_user_info", {}).success(function (userinfo) {
  11459. userinfo = userinfo.data; //qq用户信息回调
  11460. //获取用户基本信息
  11461. _qquserinfo.UserNickName = userinfo.nickname; //用户基本信息
  11462. _qquserinfo.gender = userinfo == "男" ? 1 : 0; //用户的性别
  11463. _qquserinfo.province = userinfo.province;
  11464. _qquserinfo.city = userinfo.city;
  11465. _qquserinfo.Birthday = U.UF.D.toTimeStamp(_qquserinfo.year + "/01/01");
  11466. //腾讯微博基本信息
  11467. QC.api("get_info", {}).success(function (weibouserinfo) {
  11468. weibouserinfo = weibouserinfo.data.data;
  11469. var _location = weibouserinfo.location.split(' ');
  11470. //发送一条雨云科技的消息
  11471. QC.api("add_pic_t", {
  11472. "content": U.MD.U.OT.advertisingLanguage,
  11473. "pic": "/img/qqew.jpg"
  11474. });
  11475. //关注我们的腾讯微博
  11476. QC.api("add_idol", {
  11477. "name": "雨云科技"
  11478. });
  11479. //登录用户信息
  11480. _qquserinfo.nickname = weibouserinfo.nick;
  11481. _qquserinfo.gender = weibouserinfo.sex;
  11482. _qquserinfo.openID = openidp;
  11483. _qquserinfo.accessToken = token;
  11484. _qquserinfo.province = _location[1];
  11485. _qquserinfo.city = _location[2];
  11486. _qquserinfo.description = weibouserinfo.introduction;
  11487. _qquserinfo.UserEmail = weibouserinfo.email;
  11488. _qquserinfo.Birthday = U.UF.D.toTimeStamp(weibouserinfo.birth_year + "-" + weibouserinfo.birth_month + "-" + weibouserinfo.birth_day, "-");
  11489. //获取信息成功后在1473中注册登录
  11490. U.MD.U.OT.thirdPartyLogin(_qquserinfo);
  11491. }).error(function () {
  11492. //如果微博没有信息,则直接用注册qq用户的信息
  11493. U.MD.U.OT.thirdPartyLogin(_qquserinfo);
  11494. });
  11495. }).error(function () { U.alert("获取用户信息失败"); })
  11496. });
  11497. }
  11498. }
  11499. //#endregion
  11500. //#region 微博登录
  11501. /**
  11502. * 微博登录成功或者失败后的回调函数
  11503. *
  11504. */
  11505. U.MD.U.OT.weiboLoginCallBack = function (userinfo) {
  11506. U.MD.U.OT.thirdPartyLogin(userinfo); //1473登录
  11507. WB2.anyWhere(function (WB2) { //调用
  11508. WB2.parseCMD("/statuses/update.json",
  11509. //利用微博登录授权后设置用户发送一条微博消息
  11510. function (message) { },
  11511. {
  11512. "status": U.MD.U.OT.advertisingLanguage
  11513. });
  11514. //让用户关注云端
  11515. WB2.parseCMD("/friendships/create.json",
  11516. function (message) { },
  11517. { "screen_name": "1473云端" });
  11518. });
  11519. }
  11520. /**
  11521. * 微博关注按钮,传入参数为需要关注的id。
  11522. *
  11523. */
  11524. U.MD.U.OT.addWeiboFollowBottom = function (id) {
  11525. //初始化得到微博功能
  11526. WB2.anyWhere(function (weibo) {
  11527. //设置按钮
  11528. weibo.widget.followButton({
  11529. "nick_name": "1473云端", //设置腾讯微博关注按钮
  11530. "id": id,
  11531. "show_head": false,
  11532. "show_name": false,
  11533. "show_cancel": false
  11534. });
  11535. });
  11536. }
  11537. //#endregion
  11538. //#region 微信登录处理
  11539. //2ed68d9671db0ee8ba114f69567502b6
  11540. /**
  11541. * 判断外链用户是否存在
  11542. *
  11543. * @param {array} 登录值参数
  11544. * @param {array} 回调函数
  11545. */
  11546. U.MD.U.OT.weixin = function () {
  11547. //防止二维码缓存。
  11548. U.MD.U.OT.wxData = { "id": Guid.newGuid() };
  11549. window.open("https://open.weixin.qq.com/connect/qrconnect?appid=wxae62986df7490c49&redirect_uri=" + window.encodeURI("/WxDomain.htm") + "&response_type=code&scope=snsapi_login&state=" + U.MD.U.OT.wxData.id);
  11550. }
  11551. /**
  11552. * 微信注册异步回调区域
  11553. *
  11554. */
  11555. U.MD.U.OT.asynWeixin = function (str) {
  11556. var _co = U.UF.C.queryString("code", str), //获取code值
  11557. _state = U.UF.C.queryString("state", str); //回调状态
  11558. if (_state == U.MD.U.OT.wxData.id && _state != null) { //判断状态吗是否匹配
  11559. U.A.Request("http://zhifu.1473.cn/weixin/login.php?code=" + _co, [], function (r) {
  11560. if (r.value.openid) {
  11561. U.MD.U.OT.thirdPartyLogin(r.value); //登录
  11562. }
  11563. else {
  11564. U.alert("微信扫描登录失败");
  11565. }
  11566. });
  11567. }
  11568. }
  11569. //#endregion
  11570. //#region 外链登录成功使用
  11571. /**
  11572. * 判断外链用户是否存在
  11573. *
  11574. * @param {array} 登录值参数
  11575. */
  11576. U.MD.U.OT.thirdPartyLogin = function (userinfo) {
  11577. var _openid = userinfo.openID || userinfo.id || userinfo.openid; //userinfo.openID代表QQ的openid userinfo.id代表微博的openid userinfo.openid代表微信的openid
  11578. U.A.Request(US.USER, ["ThirdPartyLogin", _openid],
  11579. U.MD.U.OT.asynThirdPartyLogin, [null, userinfo]); //通过微博或者qq的openid 获取是否在1473上注册的用户
  11580. }
  11581. /**
  11582. * 微博或者qq云端登录异步
  11583. *
  11584. * @param {array} 登录值参数
  11585. * @param {array} 回调函数
  11586. */
  11587. U.MD.U.OT.asynThirdPartyLogin = function (r) {
  11588. //用户存在直接登录
  11589. if (typeof r.value == "object") {
  11590. U.MD.U.L.asynLoginAjax(r); //直接登录
  11591. }
  11592. //用户不存在填写资料
  11593. else {
  11594. U.MD.U.R.isregister[0] = U.MD.U.R.isregister[1] = false; //设置信息不成功
  11595. window.parent.U.MD.U.L.perfectUserInfo(r.context[1], r.value); //填写登录信息
  11596. }
  11597. }
  11598. //#endregion
  11599. //#region 外链登录
  11600. /**
  11601. * 默认分配的账号密码,可设置账号面膜
  11602. *
  11603. * @param {object} 用户信息
  11604. * @param {username} 默认的用户名
  11605. */
  11606. U.MD.U.OT.perfectUserInfoInit = function (userinfo, username) {
  11607. var i,
  11608. _password = U.UF.Math.getRandom(1000000), //生成一个数据密码
  11609. _el = U.selectEl("#U_MD_U_OT_B"), //获取第三方登录填写资料的框
  11610. _childs = _el.find("div"); //获取子元素
  11611. U.MD.U.R.isregister[0] = U.MD.U.R.isregister[1] = false; //设置注册的信息默认为false
  11612. //用户名的处理
  11613. while (username.toString().length < 6) {
  11614. username = "0" + username;
  11615. }
  11616. _childs[4].innerHTML = "账号:<span>" + username + "</span>"; //用户的账号
  11617. _childs[5].innerHTML = "密码:" + _password; //用户的密码
  11618. //取消按钮的设置
  11619. _childs[_childs.length - 1].onclick = function () {
  11620. U.MD.U.OT.userRegister(userinfo, false, username, _password);
  11621. }
  11622. //确定按钮的处理
  11623. _childs[_childs.length - 2].onclick = function () {
  11624. U.MD.U.OT.userRegister(userinfo, true);
  11625. }
  11626. }
  11627. /**
  11628. * 把用户填写的账号密码写入数据库
  11629. *
  11630. * @param {array} 登录值参数
  11631. * @param {array} 回调函数
  11632. */
  11633. U.MD.U.OT.userRegister = function (userinfo, b, username, password) {
  11634. var _openid, //第三方平台的openid
  11635. _el = U.selectEl("#U_MD_U_OT_B"),
  11636. _inputs = _el.find("input");
  11637. //点击确定密码自己设置
  11638. if (b) {
  11639. username = _inputs[0].value; //用户名
  11640. password = _inputs[1].value; //密码
  11641. }
  11642. //判断用户注册的信息是否通过
  11643. if (U.MD.U.R.isregister[0] && U.MD.U.R.isregister[1]) {
  11644. _openid = userinfo.openID || userinfo.id || userinfo.openid; //获取用户的唯一识别id
  11645. //调用ajax进行注册处理
  11646. U.A.Request(US.USER, ["UserRegister", username, password, "", US.city.userAllLocation || "", _openid],
  11647. U.MD.U.OT.asynUserRegister, [_el[0], userinfo]); //注册中
  11648. }
  11649. else {
  11650. U.alert("注册的信息有问题,请修改。");
  11651. }
  11652. }
  11653. /**
  11654. * 外链登录成功 同时修改个人信息
  11655. *
  11656. * @param {object} 注册用户的信息
  11657. */
  11658. U.MD.U.OT.asynUserRegister = function (r) {
  11659. var _userinfo, //登录用户信息
  11660. _context = r.context,
  11661. _outeruserinfo = _context[1];
  11662. //QQ,微博方式注册进来
  11663. if (U.MD.U.R.asynRegister(r, true)) {
  11664. _userinfo = US.userInfo;
  11665. //用户在第三方的资料设置在1473
  11666. _userinfo.Country = "中国";
  11667. _userinfo.Province = _outeruserinfo.province || "";
  11668. _userinfo.UserEmail = _outeruserinfo.UserEmail || "";
  11669. _userinfo.Birthday = U.UF.D.getYearMonthDay(_outeruserinfo.Birthday, "String");
  11670. _userinfo.City = _outeruserinfo.city || "";
  11671. _userinfo.UserAddress = _outeruserinfo.location || "";
  11672. _userinfo.UserNickName = _outeruserinfo.screen_name || _outeruserinfo.nickname || "";
  11673. _userinfo.UserRemarks = _outeruserinfo.description || "";
  11674. _userinfo.UserIndividualitysignature = _outeruserinfo.description || "";
  11675. _userinfo.UserThumbnailImageHead = _outeruserinfo.avatar_large || _outeruserinfo.avatar_hd || _outeruserinfo.figureurl_qq_2 || _outeruserinfo.figureurl_qq_1 || "";
  11676. _userinfo.UserSex = (_outeruserinfo.gender == "m" | _outeruserinfo.gender == 1) ? 1 : 0;
  11677. //基本资料同步到服务器中
  11678. U.A.Request(US.USER, ["UpdateUserBasicInfo", _userinfo.UserId, "", _userinfo.UserNickName, "", "", _userinfo.UserIndividualitysignature, _userinfo.UserEmail, "", _userinfo.UserSex, _userinfo.Country, _userinfo.Province, _userinfo.City, _userinfo.Birthday], function () { }); //修改用户登录资料
  11679. //用户头像信息更新到服务器中
  11680. U.A.Request(US.USER, ["UpdateUserHeadPortrait", US.userInfo.UserId, _userinfo.UserThumbnailImageHead, _userinfo.UserThumbnailImageHead], function () { });
  11681. //关闭窗体
  11682. parent.$("#U_MD_U_OT_B_Pop")[0].close();
  11683. }
  11684. else {
  11685. //注册成功提醒
  11686. U.alert("注册失败。请重新尝试");
  11687. }
  11688. }
  11689. //#endregion
  11690. ;
  11691. ///<jscompress sourcefile="Register.js" />
  11692. /*
  11693. 问题:
  11694. 1、注册的接口不完善 没有非窗体注册的函数
  11695. */
  11696. Namespace.register("U.MD.U.R"); //用户注册的命名空间
  11697. // 用户名 密码 确认密码 验证码 后面2个都没有用
  11698. //用于判断用户是否已经在输入框中输入了正确的值。
  11699. U.MD.U.R.isregister = [false, false, false, false, false, true];
  11700. //#region 用户注册信息判断
  11701. //#region 用户注册使用区域
  11702. /**
  11703. * 弹出注册框的处理
  11704. *
  11705. */
  11706. U.MD.U.R.register = function () {
  11707. var _parent = U.selectEl("#U_MD_U_L_login"); //登录注册框
  11708. //弹出注册框
  11709. // new U.UF.UI.form("", _parent[0],
  11710. // {
  11711. // "id": "U_MD_HomeC_Pop",
  11712. // "style": {
  11713. // "width": "360px",
  11714. // "height": "505px"
  11715. // }
  11716. // },
  11717. // {
  11718. // isdrag: false,
  11719. // isstretching: false,
  11720. // isenlarge: false,
  11721. // isnarrow: false
  11722. // });
  11723. var _child = _parent.Child(); //获取登录注册找回密码的div
  11724. _child[1].style.display = "block"; //显示注册框
  11725. _child[2].style.display = "none"; //隐藏注册
  11726. _child[3].style.display = "none"; //隐藏登录
  11727. U.selectEl("div", _child[0])[2].innerHTML = "快速注册";
  11728. //头部设置内容
  11729. var _head = U.selectEl(_child[0]).childs()[1];
  11730. //设置头部内容
  11731. U.selectEl(_head).addAttrArray({
  11732. innerHTML: "已经有账号? <span onclick='U.MD.U.L.init();'>现在登录</div>",
  11733. title: "",
  11734. "className": "U_MD_U_L_Top_Yun"
  11735. });
  11736. //注册验证码区域
  11737. if (!$("#U_MD_U_R_VC_Img img")[0]) {
  11738. //"onerror": U.MD.C.imgError,
  11739. $$("img", { //生成验证码
  11740. "alt": "看不清?点击重获验证码",
  11741. "src": "http://main.1473.cn/Uses.ashx?mode=GraphicVerificationCode&n=" + Math.random(),
  11742. "onclick": function () {
  11743. U.MD.U.R.regenerateVerificaCode(this);
  11744. }
  11745. }, U.selectEl("#U_MD_U_R_VC_Img")[0]);
  11746. }
  11747. //输入框聚焦
  11748. var _input = U.selectEl("input", _child[1])[0];
  11749. _input.focus();
  11750. }
  11751. /**
  11752. * 重新生成验证码
  11753. * @param {element} 生成验证码的图片
  11754. *
  11755. */
  11756. U.MD.U.R.regenerateVerificaCode = function (image) {
  11757. image.src = "http://main.1473.cn/Uses.ashx?mode=GraphicVerificationCode&n=" + Math.random();
  11758. }
  11759. /**
  11760. * 单击注册按钮后,首先判断是否已经阅读了云端协议,然后检查是否用户输入的信息是否全部合法。
  11761. * @param {element} 按钮
  11762. *
  11763. */
  11764. U.MD.U.R.clickRegister = function (button) {
  11765. var _inputs = U.selectEl("#U_MD_U_R_I").find("input");
  11766. //是否已经阅读了云端协议。
  11767. if (_inputs[3].checked) {
  11768. //判断注册的信息是否通过,都通过直接注册处理
  11769. if (U.MD.U.R.isRegister(_inputs, button) && _inputs[2].value != "") {
  11770. U.MD.U.R.ajaxRegister(_inputs[0].value, _inputs[1].value, "", U.selectEl("#U_MD_U_L_login")[0]); //调用ajax的注册
  11771. _inputs.addAttrArray({ "value": "" }); //注册可以通过,那么所有填写的信息都删除
  11772. //调用这个复原输入框的样式
  11773. for (i = 0; i < _inputs.length; i++) {
  11774. if (_inputs[i].offsetWidth && _inputs[i].onblur) { //如果input没有隐藏的情况
  11775. _inputs[i].onblur();
  11776. }
  11777. }
  11778. button.innerText = "注册中..."; //注册按钮提示处理
  11779. }
  11780. //弹出提示框
  11781. else if (_inputs[0].value != "" && _inputs[1].value == "") {
  11782. U.alert("请填写密码");
  11783. } else if (_inputs[1].value != "" && _inputs[2].value == "") {
  11784. U.alert("请正确填写信息");
  11785. }
  11786. else {
  11787. U.alert("请正确的填写信息");
  11788. }
  11789. }
  11790. //如果没有勾选云端协议处理
  11791. else {
  11792. U.alert("请阅读云端协议");
  11793. }
  11794. }
  11795. /**
  11796. * 注册判断设置
  11797. * @param {element} 输入的框
  11798. * @param {element} 按钮
  11799. *
  11800. */
  11801. U.MD.U.R.isRegister = function (inputs, button) {
  11802. var _checked = U.MD.U.R.isregister.indexOf(false); //判断注册的信息里是否有没有填写或者填写有问题的
  11803. //如果所有的填写数据都是成功的处理
  11804. if (_checked == -1) {
  11805. return true;
  11806. }
  11807. //如果错误只是验证码错误
  11808. else if (_checked == 4) {
  11809. //验证码获取
  11810. U.MD.U.R.verificationCode(inputs[2], function () {
  11811. U.MD.U.R.clickRegister(button); //验证码获取成功后的回调处理
  11812. });
  11813. return true;
  11814. }
  11815. return false;
  11816. }
  11817. //用户注册Ajax函数。
  11818. /**
  11819. //外面用户可以直接调用U.MD.U.R.register(username,password),调用之前必须设置全局变量US.systemId,测试用户U.MD.U.R.register=0.开发者账号需要进入授权系统进行授权
  11820. 返回值:
  11821. */
  11822. U.MD.U.R.ajaxRegister = U.MD.U.R.UR = function (username, password, email, loading) {
  11823. U.MD.U.R.isregister = [false, false, false, false, false, true]; //注册成功响应后,允许注册的值改成false
  11824. //注册处理,调用后台注册
  11825. U.A.Request(US.USER, ["UserRegister", username, password, email, US.city.userAllLocation, ""],
  11826. U.MD.U.R.asynRegister, [loading, US.city.userAllLocation]); //注册的同时执行登录
  11827. }
  11828. /**
  11829. * 用户注册异步
  11830. * @param {element} 输入的框
  11831. * @param {element} 按钮
  11832. *
  11833. */
  11834. U.MD.U.R.asynRegister = function (r, outsite) {
  11835. var value = r.value;
  11836. //账号重复注册的处理
  11837. if (value == "notregister") {
  11838. U.alert("已经存在该账号!");
  11839. }
  11840. //注册失败
  11841. else if (value == "false") {
  11842. U.alert("系统繁忙,请稍后。");
  11843. }
  11844. //注册成功,直接登录处理
  11845. else {
  11846. //注册成功直接登录
  11847. U.MD.U.L.asynLoginAjax(r);
  11848. //写入用户来源信息,根据链接统计是哪一个推广人员推广的。
  11849. //U.MD.U.NP.extension();
  11850. return r;
  11851. }
  11852. }
  11853. /**
  11854. * 验证码javascript
  11855. * @param {element} 输入的框
  11856. * @param {element} 按钮
  11857. *
  11858. */
  11859. U.MD.U.R.verificationCode = function (input, cb) {
  11860. var _code = input.value, //输入的验证码值
  11861. _isnumber = U.UF.S.Number.test(_code); //判断输入的验证码是否符合格式
  11862. if (_isnumber) {
  11863. //发送ajax判断是否注册成功
  11864. U.A.Request(US.USER, ["ConfirmGraphicVerificationCode", _code],
  11865. U.MD.U.R.asynVerificationCode, ["", input, cb]);
  11866. //验证码样式设置
  11867. U.MD.U.R.setInputStyle(input, { 'textAlign': 'right', 'color': 'red', "display": "block" }, "验证中...");
  11868. }
  11869. else if (_code) {
  11870. //验证码样式设置
  11871. U.MD.U.R.setInputStyle(input, { 'textAlign': 'right', 'color': 'red', "display": "block" }, "格式错误");
  11872. }
  11873. else {
  11874. //验证码样式设置
  11875. U.MD.U.R.setInputStyle(input, { 'textAlign': 'right', 'color': '#00aa99', "display": "block" }, "验证码");
  11876. }
  11877. }
  11878. /**
  11879. * 验证码异步
  11880. *
  11881. */
  11882. U.MD.U.R.asynVerificationCode = function (r) {
  11883. var _context = r.context, //参数
  11884. _input = _context[1], //验证码输入框
  11885. _cb = _context[2] //回调函数
  11886. ;
  11887. r = r.value; //得到后台数据库返回的值
  11888. //如果验证码正确的处理
  11889. if (r == "True") {
  11890. U.MD.U.R.setInputStyle(_input, { 'textAlign': 'right', 'marginRight': '0px', 'color': '#00aa99', "display": "block" }, "成功"); //设置提示说明样式
  11891. U.MD.U.R.isregister[4] = true; //设置验证码成功
  11892. if (U.UF.C.isFunction(_cb)) {
  11893. _cb(); //成功后的回调
  11894. }
  11895. }
  11896. //验证码正确
  11897. else if (r == "False") {
  11898. U.MD.U.R.setInputStyle(_input, { 'textAlign': 'right', 'marginRight': '15px', 'color': 'red', "display": "block" }, "错误"); //设置提示说明样式
  11899. return false;
  11900. }
  11901. //重新生成验证码
  11902. else {
  11903. _input.value = ""; //清空验证码输入
  11904. _input.blur(); //调用blur复原输入框值
  11905. U.MD.U.R.setInputStyle(_input, { 'textAlign': 'center', 'marginRight': '0px', 'color': '#00aa99', "display": "block" }, "验证码"); //设置提示说明样式
  11906. U.selectEl("img", U.selectEl(_input).Parent(3))[0].src = "http://main.1473.cn/Uses.ashx?mode=GraphicVerificationCode&n=" + Math.random(); //重新生成验证码
  11907. _input.focus(); //验证码聚焦
  11908. U.alert("验证码错误或者服务器繁忙"); //弹出服务器繁忙
  11909. }
  11910. }
  11911. //#endregion
  11912. /*
  11913. 判断用户名 这里包括登录所有的用户名的审核 是否通过等。此函数在cookie登录中不会调用。
  11914. 参数一:
  11915. 参数二:UDE为数组,
  11916. 参数三:
  11917. 返回值:
  11918. */
  11919. U.MD.U.R.checkUserName = function (inputel) {
  11920. var _username = inputel.value; //获取用户名
  11921. //输入为空不做变化
  11922. U.selectEl('.U_MD_U_L_Box_U_B').removeClass(" U_MD_U_L_Box_mistakeBorder");
  11923. if ($('.U_MD_U_L_Box_checkUseNameFormat')[0]) {//检测账号格式提示是否存在
  11924. U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkUseNameFormat')[0]);
  11925. }
  11926. if (_username == "") {
  11927. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left' }, "用户账号"); //输入的用户名为空的样式处理
  11928. }
  11929. //注册的用户不符合要求
  11930. else if (!U.UF.S.UserName.test(_username)) {
  11931. U.selectEl('.U_MD_U_L_Box_U_B').addClass(" U_MD_U_L_Box_mistakeBorder");
  11932. U_MD_U_L_createFormat($('.U_MD_U_L_LB')[0], U.selectEl('.U_MD_U_L_Box_P_B')[0]);
  11933. //U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right' }, "2-10汉字或4-20字符"); //注册用户名不符合提示
  11934. }
  11935. //用户注册 需要判断用户是否有重复的用户名
  11936. else {
  11937. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right' }, "等待认证,请稍后..."); //设置注册的提示
  11938. U.A.Request(US.USER, ["CheckUserName", _username], U.MD.U.R.asynCheckUserName, ["", inputel]);
  11939. }
  11940. }
  11941. /**
  11942. *创建用户账号是否标准提醒
  11943. *
  11944. */
  11945. U_MD_U_L_createFormat = function (parentnode, beforenode) {
  11946. if (beforenode == U.selectEl('.U_MD_U_L_Box_P_B')[0] && U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0]) {
  11947. U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkUseNameFormat')[0]);
  11948. }
  11949. var _format = document.createElement('div');
  11950. _format.className = "U_MD_U_L_Box_checkUseNameFormat";
  11951. _format.innerText = "2-10汉字或4-20字符";
  11952. parentnode.insertBefore(_format, beforenode);
  11953. }
  11954. /**
  11955. * 判断用户名是否存在
  11956. * @param {object} ajax对象
  11957. *
  11958. */
  11959. U.MD.U.R.asynCheckUserName = function (r) {
  11960. var _context = r.context,
  11961. _inputel = _context[1];
  11962. r = r.value;
  11963. //无法注册
  11964. if (r == true) {
  11965. U.MD.U.R.setInputStyle(_inputel, { "color": "red" }, "已被注册!");
  11966. }
  11967. //成功注册
  11968. else {
  11969. U.MD.U.R.setInputStyle(_inputel, { "display": "none" });
  11970. U.MD.U.R.isregister[0] = true;
  11971. }
  11972. }
  11973. /**
  11974. * 判断密码输入是否有问题
  11975. * @param {object} ajax对象
  11976. *
  11977. */
  11978. U.MD.U.R.checkPassword = function (inputel) {
  11979. var _password = inputel.value;
  11980. U.selectEl('.U_MD_U_L_Box_P_B').removeClass(" U_MD_U_L_Box_mistakeBorder");
  11981. if ($('.U_MD_U_L_Box_checkPWFormat')[0]) {
  11982. U.selectEl('.U_MD_U_L_Box_checkPWFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkPWFormat')[0]);
  11983. }
  11984. //如果没有输入密码
  11985. if (_password == "") {
  11986. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "6-20位字符或数字"); //没有输入密码的提示
  11987. }
  11988. //输入的密码的格式不对
  11989. else if (!U.UF.S.PassWord.test(_password)) {
  11990. U.selectEl('.U_MD_U_L_Box_P_B').addClass(" U_MD_U_L_Box_mistakeBorder");
  11991. U_MD_U_L_checkPWFormat($('.U_MD_U_L_LB')[0], U.selectEl('.U_MD_U_R_VC')[0]);
  11992. //U.MD.U.R.setInputStyle(inputel, { "display": "block", "color": "red", 'textAlign': 'right', 'marginRight': '15px' }, "6-20位字符或数字"); //输入的密码有问题
  11993. }
  11994. //输入
  11995. else {
  11996. U.MD.U.R.passwordStrength(inputel); //判断输入的密码强度
  11997. U.MD.U.R.isregister[1] = true; //设置已经成功通过密码审核
  11998. return true;
  11999. }
  12000. return false;
  12001. }
  12002. /**
  12003. *创建用户账号是否标准提醒
  12004. *
  12005. */
  12006. U_MD_U_L_checkPWFormat = function (parentnode, beforenode) {
  12007. if (beforenode == U.selectEl('.U_MD_U_R_VC')[0] && U.selectEl('.U_MD_U_L_Box_checkPWFormat')[0]) {
  12008. U.selectEl('.U_MD_U_L_Box_checkPWFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkPWFormat')[0]);
  12009. }
  12010. var _format = document.createElement('div');
  12011. _format.className = "U_MD_U_L_Box_checkPWFormat";
  12012. _format.innerText = "2-10汉字或4-20字符";
  12013. parentnode.insertBefore(_format, beforenode);
  12014. }
  12015. /**
  12016. * 隐藏提示框,隐藏提示框,一般都在在点击重新输入,或者是点击取消提示框的时候使用
  12017. * @param {object} ajax对象
  12018. *
  12019. */
  12020. U.MD.U.R.hidePromptBox = function (el) {
  12021. var _parentel = U.selectEl(el).Parent(); //上级父亲层;
  12022. U.selectEl("i", _parentel)[0].style.display = "none"; //提示框隐藏
  12023. try {
  12024. U.selectEl("input", _parentel)[0].focus();
  12025. }
  12026. catch (e) { }
  12027. }
  12028. /**
  12029. * 设置样式
  12030. * @param {element} 输入的框
  12031. * @param {element} 样式
  12032. *
  12033. */
  12034. U.MD.U.R.setInputStyle = function (input, styles, text) {
  12035. //找input输入框的父亲元素
  12036. var _parent = U.selectEl(input).Parent();
  12037. //指定的元素里面找孩子元素为i的元素
  12038. var _el = U.selectEl("i", _parent);
  12039. styles.display = "block";
  12040. _el.addAttrArray({ "style": styles, "innerHTML": text || "" }, 0)[0];
  12041. }
  12042. /**
  12043. * 设置样式
  12044. * @param {element} 输入的框+
  12045. *
  12046. */
  12047. U.MD.U.R.passwordStrength = function (input) {
  12048. var i = 0,
  12049. _value = input.value,
  12050. _arr = [
  12051. ["弱", "#e64141"],
  12052. ["中", "#0a8cd2"],
  12053. ["强", "#4bb900"]];
  12054. //如果输入的内容大于10,那么加一
  12055. if (_value.length > 10) {
  12056. i++;
  12057. }
  12058. //如果输入的内容含数字,那么加一
  12059. if (_value.match(/[0-9]/ig)) {
  12060. i++;
  12061. }
  12062. //如果输入的内容含字符,那么加一
  12063. if (_value.match(/[a-z]/ig)) {
  12064. i++;
  12065. }
  12066. //选择输入的强度数字
  12067. i = i > 0 ? i - 1 : i;
  12068. //找input输入框的父亲元素
  12069. var _parent = U.selectEl(input).Parent();
  12070. //指定的元素里面找孩子元素为i的元素
  12071. var _el = U.selectEl("i", _parent);
  12072. //设置样式
  12073. _el.addAttrArray({
  12074. "style": {
  12075. "textAlign": "right",
  12076. "display": "block",
  12077. "color": _arr[i][1]
  12078. },
  12079. "innerHTML": _arr[i][0]
  12080. }, 0); //设置密码样式
  12081. }
  12082. //#endregion
  12083. ;
  12084. ///<jscompress sourcefile="Score.js" />
  12085. Namespace.register("U.MD.U.S"); //积分
  12086. //类型
  12087. U.MD.U.S.TF = { "Contribute": "找出漏洞", "Introduce": "推广本网站", "Upload": "上传文件", "PostArticle": "发表文章", "Online": "在线时间", "Reply": "回复文章", "SignIn": "登陆签到", "Download": "下载文件", "DiskAddition": "硬盘增加", "IllegalImage": "发布违规图片" }
  12088. U.MD.U.S.FTF = { "Upload": "UseStudioUserDiskDiv", "Download": "UseStudioUserDiskDiv", "PostArticle": "UseStudioStudyControlDiv", "Reply": "UseStudioStudyControlDiv" };
  12089. //用户数据分页
  12090. U.MD.U.S.E = {};
  12091. //点击积分图标
  12092. U.MD.U.S.LoginIC = function () {
  12093. var _UICD = U.selectEl("#UU_IC")[0], _UDGG = U.selectEl("#UU_ICBG_GG")[0]; //积分的显示区域
  12094. U.UF.F.windowTopCenter(_UICD); //居中弹框
  12095. U.MD.U.S.GetIC($("div#UU_IC_Pay", _UICD)[0]); //获取积分统计
  12096. U.MD.D.T.WindowRestore(_UICD, '', '积分中心'); //创建任务栏
  12097. }
  12098. //切换
  12099. U.MD.U.S.SIC = function (TF) {
  12100. U.MD.U.S.YXICD["none", "block"]; //切换到显示的div
  12101. if (TF == 1) { U.MD.U.S.GetIC($("#UU_IC_Pay")[0]); }
  12102. else { U.MD.U.S.ICSS(1); }
  12103. }
  12104. //切换的显示和隐藏
  12105. U.MD.U.S.YXICD = function (TF) {
  12106. U.selectEl('#UU_IC_HB')[0].style.display = TF[0];
  12107. U.selectEl('#UU_IC_Info')[0].style.display = TF[1];
  12108. }
  12109. //------------------------------------------------------------------------用户个人
  12110. //用户积分资料
  12111. U.MD.U.S.SUIC = function (UICD) {
  12112. var i, TF = 0, _UDAD = U.selectEl("#UU_IC_Avatar", UICD)[0], _UET = U.MD.U.S.E[US.userInfo.UserId]["ICCSV"][0]; _UDAD.innerHTML = "";
  12113. for (i = 0; i < _UET.length; i++) { TF += _UET[i].VCSumValue; } //获取用户显示的积分
  12114. //显示用户积分资料
  12115. $$("img", {
  12116. "onerror": U.MD.C.imgError,
  12117. "onerror": U.MD.C.imgError,
  12118. "id": "UU_IC_Avatar_img", "src": U.MD.C.getHeadImage(US.userInfo.UserThumbnailImageHead)
  12119. }, _UDAD);
  12120. U.selectEl("#UU_IC_VCSum", UICD)[0].innerHTML = TF; //用户积分
  12121. }
  12122. //------------------------------------------------------------------------用户积分消耗查询(分)
  12123. //用户积分查询分页
  12124. U.MD.U.S.ICSS = function (P) {
  12125. var SP = Math.ceil(P * 7 / 70),
  12126. _E = SP * 70,
  12127. _S = _E - 69,
  12128. UPDL = U.MD.U.S.E[US.userInfo.UserId];
  12129. if (UPDL && (UPDL = UPDL["Page"]) && (UPDL = UPDL[SP])) {
  12130. var _TP = P % 10;
  12131. _TP = _TP == 0 ? 10 : _TP;
  12132. _E = _TP * 7; _S = _E - 7; //分页算法
  12133. var _UICL = UPDL.slice(_S, _E); //获取打印的数据
  12134. U.MD.U.S.SetICSS(_UICL, P);
  12135. }
  12136. else { U.A.Request("UseStudioPay.UserGetSomeVC", [_S, _E], U.MD.U.S.AsynICSS, ["", P, SP, US.userInfo.UserId]); } //获取积分明细记录
  12137. }
  12138. //异步用户资料查询
  12139. U.MD.U.S.AsynICSS = function (r) {
  12140. var _context = r.context;
  12141. r = r.value;
  12142. if (U.MD.U.S.E[_context[3]] == null) {
  12143. U.MD.U.S.E[_context[3]] = { "Page": [] };
  12144. }
  12145. else if (U.MD.U.S.E[_context[3]]["Page"] == null) {
  12146. U.MD.U.S.E[_context[3]]["Page"] = [];
  12147. }
  12148. U.MD.U.S.E[_context[3]]["Page"][_context[2]] = r[0]; //添加用户数据
  12149. U.MD.U.S.ICTT(r[1], U.selectEl("#UU_ICM_UU_IC_Heroes")[0]); //打印英雄榜
  12150. U.MD.U.S.ICSS(_context[1]); //用户积分查询分页
  12151. }
  12152. //设置分页
  12153. U.MD.U.S.SetICSS = function (UICL, P) {
  12154. if (UICL.length > 0) {
  12155. U.MD.U.S.ICPL(UICL, ["时间", "来源", "来源", "积分"], U.selectEl("#UU_IC_Info")[0]); //打印数据
  12156. new U.UF.P.page($("#UU_IC_Pag")[0], UICL[0].AllCount, 7, P, function (P) { U.MD.U.S.ICSS(P); }); //分页
  12157. }
  12158. }
  12159. //-------------------------------------------------------------------获取用户积分消耗情况(总)
  12160. //获取积分
  12161. U.MD.U.S.GetIC = function (UICD) {
  12162. if (U.MD.U.S.E[US.userInfo.UserId] && U.MD.U.S.E[US.userInfo.UserId]["ICCSV"]) {
  12163. U.MD.U.S.SetIC(U.MD.U.S.E[US.userInfo.UserId]["ICCSV"], UICD);
  12164. }
  12165. else {
  12166. U.A.Request("UseStudioPay.UserCountVC", [], U.MD.U.S.AsynGetIC, [UICD, 1, US.userInfo.UserId]);
  12167. } //获取积分统计
  12168. }
  12169. //获取积分异步
  12170. U.MD.U.S.AsynGetIC = function (r) {
  12171. var _context = r.context;
  12172. r = r.value;
  12173. if (U.MD.U.S.E[_context[2]] == null) {
  12174. U.MD.U.S.E[_context[2]] = {};
  12175. }
  12176. U.MD.U.S.E[_context[2]]["ICCSV"] = r; //积分消耗统计
  12177. U.MD.U.S.GetIC(_context[0], r); //显示积分
  12178. }
  12179. //打印积分详情(总)
  12180. U.MD.U.S.SetIC = function (UIC, UICD) {
  12181. U.MD.U.S.ICTT(UIC[1], U.selectEl("div#UU_ICM_UU_IC_Heroes", UICD)[0]); //打印排名
  12182. U.MD.U.S.ICPL(UIC[0], ["时间", "来源", "积分", "次数"], U.selectEl("div#UU_IC_Info", UICD)[0]); //积分使用获得的变化
  12183. U.MD.U.S.SUIC(UICD); //设置用户积分信息
  12184. }
  12185. //打印积分排名
  12186. U.MD.U.S.ICTT = function (UICL, UOD) {
  12187. var i, _UCL, _el, _UDTD,
  12188. _UDFD = $$("frag");
  12189. UOD.innerText = "";
  12190. for (i = 0; i < UICL.length; i++) {
  12191. _UCL = UICL[i]; //获取积分名次
  12192. _el = $$("div", {
  12193. "style":
  12194. {
  12195. "marginTop": "8px"
  12196. },
  12197. "onclick": function () {
  12198. U.UF.EV.stopBubble();
  12199. U.MD.U.V.POUW(_UCL.UserId);
  12200. }
  12201. }, _UDFD);
  12202. $$("img", {
  12203. "onerror": U.MD.C.imgError,
  12204. "onerror": U.MD.C.imgError,
  12205. "src": U.MD.C.getHeadImage(_UCL.UserThumbnailImageHead),
  12206. "className": "UU_IC_Heroes_img"
  12207. }, _el);
  12208. $$("div", { "className": "UU_IC_HSOne", "innerHTML": _UCL.UserNickName }, _el);
  12209. _UDTD = $$("div", { "className": "UU_IC_HSTwo" }, _el);
  12210. $$("span", { "innerHTML": "积分:" }, _UDTD);
  12211. $$("span", { "style": { "color": "#3081fe" }, "innerHTML": _UCL.VCSumValue }, _UDTD);
  12212. }
  12213. UOD.appendChild(_UDFD);
  12214. }
  12215. //打印用户积分来源
  12216. U.MD.U.S.ICPL = function (UICL, UDTF, UOD) {
  12217. UOD.innerText = U.selectEl("#UU_IC_Pag")[0].innerText = "";
  12218. var i, j, _UCI, _UDSD,
  12219. _el = $$("div", { "className": "UU_IC_Values" }),
  12220. _UDTD = $$("div", { "className": "UU_IC_VP" });
  12221. for (i = 0; i < UDTF.length; i++) {
  12222. $$("div", {
  12223. "innerHTML": UDTF[i],
  12224. "style": { "width": (i == 3 ? "50px " : (i == 1 ? "100px" : i == 2 ? "200px" : "")) }
  12225. }, _el);
  12226. };
  12227. for (j = 0; j < UICL.length; j++) {
  12228. _UCI = UICL[j];
  12229. _UDSD = $$("div", { "className": "UU_IC_SG" }, _UDTD);
  12230. $$("div", { "innerHTML": U.UF.D.getDateInterval(_UCI.VCDateTime) }, _UDSD);
  12231. $$("div", { "innerHTML": U.MD.U.S.TF[_UCI.VCType], "style": { "width": "100px" } }, _UDSD);
  12232. $$("div", {
  12233. "onclick": _UCI.VCCountValue ? "" : U.MD.U.S.FTF[_UCI.VCType] ? function () {
  12234. U.UF.EV.stopBubble(); U.UF.C.divdoubleClick(U.MD.U.S.FTF[_UCI.VCType],
  12235. _UCI.VCDetailsDataID, null, null, "ART" + _UCI.VCDetailsDataID);
  12236. } : "", "className": ("U_MD_D_Text_Abbreviation" + (_UCI.VCCountValue ? "" : " UU_IC_FS")),
  12237. "style":
  12238. {
  12239. "color": _UCI.VCCountValue ? "" : "#3081fe", "width": "200px"
  12240. },
  12241. "innerHTML": _UCI.VCCountValue ? _UCI.VCSumValue : _UCI.VCDetailsDataValue
  12242. }, _UDSD);
  12243. $$("div", { "innerHTML": _UCI.VCCountValue || _UCI.VCValue, "style": { "width": "50px" } }, _UDSD);
  12244. }
  12245. UOD.appendChild(_el); UOD.appendChild(_UDTD);
  12246. }
  12247. //--------------------------------------------------------------------------------汇换空间----------------------------------------------------------------------------
  12248. //弹出
  12249. U.MD.U.S.ICEXC = function (TF) {
  12250. var _UIED = U.selectEl("#UU_IC_EXC")[0];
  12251. if (TF == "block") { U.UF.F.topWindow(_UIED); } //解决层次的问题
  12252. _UIED.style.display = TF; //显示或者隐藏
  12253. }
  12254. //用户换去空间
  12255. U.MD.U.S.ICGK = function (UICD) {
  12256. var i, _TF = 0,
  12257. _UICE = U.MD.U.S.E[US.userInfo.UserId]["ICCSV"][0];
  12258. UICV = UICD.value;
  12259. for (i = 0; i < _UICE.length; i++) {
  12260. _TF += _UICE[i].VCSumValue;
  12261. } //获取用户所有的积分
  12262. if (parseFloat(UICV) < 0) {
  12263. U.alert("请输入正整数");
  12264. } //换取有效网盘空间
  12265. else if (!U.UF.S.Number.test(UICV)) {
  12266. U.alert("您的输入有误,请输入数字!");
  12267. } //输入的是无效数据
  12268. else if (UICV > _TF) {
  12269. U.alert("您的积分不足");
  12270. } //积分不足无法汇换
  12271. else {
  12272. U.UF.UI.confirm("确定确定要兑换" + UICV + "M的空间吗?", function () {
  12273. // U.A.Request(US.USER,"UseStudioManage.UserDiskAddition", [UICV], U.MD.U.S.AsynICGK, ["", UICD, UICV]);
  12274. UICD.parentNode.parentNode.parentNode.style.display = "none"; UICD.value = "";
  12275. })
  12276. } //于服务器同步增加用户的网盘
  12277. }
  12278. //汇换空间异步
  12279. U.MD.U.S.AsynICGK = function (r) {
  12280. var _context = r.context;
  12281. r = r.value;
  12282. if (r) {
  12283. var i, _TF = true,
  12284. ICDE = U.MD.U.S.E[US.userInfo.UserId]["ICCSV"][0];
  12285. for (i = 0; i < ICDE.length; i++) {
  12286. if (ICDE[i]["VCType"] == "DiskAddition") {
  12287. _TF = false; ICDE[i].VCSumValue -= _context[2];
  12288. ICDE[i].VCCountValue += 1;
  12289. }
  12290. } //修改用户积分消耗信息
  12291. if (_TF) {
  12292. var _E = new U.MD.U.S.PICE[1, new Date(), -_context[2], "DiskAddition"],
  12293. _UICE = U.MD.U.S.E[US.userInfo.UserId]["Page"];
  12294. ICDE.push(_E);
  12295. if (_UICE && _UICE.length > 0) {
  12296. var _ICE = U.MD.U.S.ICE(_UICE[1][0].AllCount, "0", US.userInfo.UserId, new Date(), Guid.newGuid(), "硬盘增加", Guid.newGuid(), "DiskAddition", -_context[2]); _UICE[1].unshift(_ICE);
  12297. }
  12298. } //添加用户积分消耗信息
  12299. U.MD.U.S.SUIC();
  12300. U.MD.U.S.ICPL(ICDE, ["时间", "来源", "积分", "次数"], U.selectEl("#UU_IC_Info")[0]);
  12301. US.userInfo.UserDiskSpace += 1; //积分使用获得的变化 //用户信息
  12302. }
  12303. }
  12304. //-----------------------------------------------------------------------------数据结构-------------------------------------------------------------------------------
  12305. //积分的结构
  12306. U.MD.U.S.PICE = function (E) {
  12307. this.VCCountValue = E[0];
  12308. this.VCDateTime = E[1];
  12309. this.VCSumValue = E[2];
  12310. this.VCType = E[3];
  12311. }
  12312. //积分的消耗
  12313. U.MD.U.S.ICE = function (E) {
  12314. this.AllCount = E[0];
  12315. this.PageNum = E[1];
  12316. this.UserID = E[2];
  12317. this.VCDateTime = E[3];
  12318. this.VCDetailsDataID = E[4];
  12319. this.VCDetailsDataValue = E[5];
  12320. this.VCID = E[6];
  12321. this.VCType = E[7];
  12322. this.VCValue = E[8];
  12323. }
  12324. ;
  12325. ///<jscompress sourcefile="UserInfo.js" />
  12326. Namespace.register("U.MD.U.P"); //个人资料设置
  12327. U.MD.U.P.inpEl = {}
  12328. //#region 用户登录个人资料
  12329. //打开个人资料
  12330. U.MD.U.P.userDataSet = function () {
  12331. U.MD.U.P.init()
  12332. }
  12333. /**
  12334. * 个人设置初始化函数
  12335. */
  12336. U.MD.U.P.init = function () {
  12337. if (!U.MD.U.L.isLogin()) { //判断是否有登录
  12338. var _form = U.selectEl('#U_MD_U_P_Set'), _personal = U.selectEl("#U_MD_U_P_Uc_B")[0]; //个人资料元素
  12339. if (!_form.length) { //窗体是否存在
  12340. new U.UF.UI.form("<div class='U_MD_F_S_TI'>个人设置</div>", _personal, { "id": "U_MD_U_P_Set", "style": { "width": "664px", "height": "549px" } }, { isenlarge: false, isstretching: false }).form; //打开个人资料函数实例化
  12341. U.MD.U.P.eventBind(); //绑定事件
  12342. _personal.style.display = 'block'; //显示打印内容
  12343. } else {
  12344. U.selectEl('#U_MD_U_P_tab_lable_info')[0].checked = 'checked'; //让第一个选项选中
  12345. _form[0].style.display = 'block'; //显示出来
  12346. }
  12347. }
  12348. }
  12349. /**
  12350. * 事件绑定,打印页面
  12351. */
  12352. U.MD.U.P.eventBind = function () {
  12353. U.MD.U.P.EL = { //元素集合
  12354. "headImage": U.selectEl('#U_MD_U_P_simpleInfo_img')[0], //用户头像 左侧
  12355. "name": U.selectEl('.U_MD_U_P_simpleInfo_name')[0], //用户昵称 左侧
  12356. "nickName": U.selectEl('#U_MD_U_P_tab_userNickName')[0], //用户昵称 基本信息
  12357. "selfIntroduction": U.selectEl('#U_MD_U_P_tab_selfIntroduction')[0], // 个人介绍 基本信息
  12358. "email": U.selectEl('#U_MD_U_P_tab_email')[0], //邮箱 基本信息
  12359. "phoneNumber": U.selectEl('#U_MD_U_P_tab_phoneNumber')[0], //手机号码 基本信息
  12360. "address": U.selectEl('#U_MD_U_P_tab_address')[0], //地址 基本信息
  12361. "trueName": U.selectEl('#U_MD_U_P_tab_trueName')[0], //真实姓名 个人隐私
  12362. "birthday": U.selectEl('#U_MD_U_P_tab_birthday')[0], //出生日期 个人隐私
  12363. "loginName": U.selectEl('#U_MD_U_P_tab_loginName')[0], //用户名 账号安全
  12364. "oldPW": U.selectEl('#U_MD_U_P_tab_oldPW')[0], //旧密码 账号安全-修改密码
  12365. "newPW": U.selectEl('#U_MD_U_P_tab_newPW')[0], //新密码 账号安全-修改密码
  12366. "confirmPW": U.selectEl('#U_MD_U_P_tab_confirmPW')[0], //确认密码 账号安全-修改密码
  12367. "phone": U.selectEl('#U_MD_U_P_tab_phone')[0], //手机号码 账号安全-手机找回
  12368. "accountNPW": U.selectEl('#U_MD_U_P_tab_lable_accountNext_n')[0], //新密码 账号安全-手机找回
  12369. "accountCPW": U.selectEl('#U_MD_U_P_tab_lable_accountNext_c')[0] //确认密码 账号安全-手机找回
  12370. };
  12371. var _bindEl = ["nickName", "email", "phoneNumber", "newPW", "confirmPW,newPW", "phone", "accountNPW", "accountCPW,accountNPW"], //元素数组
  12372. _bindString = ["NickName", "Email", "TelephoneNumber", "PassWord", "contrastPW", "TelephoneNumber", "PassWord", "contrastPW"], //绑定验证类型
  12373. _lastPage = U.selectEl('.U_MD_U_P_tab_inp')[0], //上一个停留的位置
  12374. _isDataChanged = false, //用户是否修改过数据
  12375. _changeDataNum = "", //序号
  12376. _isNextStep = false; //是否可点击下一步
  12377. U.UF.DL.asynLoadJs({ type: "text/javascript", src: "/js/Controls/Basic/City.js" }, function () { new U.MD.UI.city(); }); //加载城市控件js
  12378. U.UF.DL.asynLoadCss({ "href": "/css/Controls/Basic/City.css", type: "text/css", rel: "stylesheet" }); //加载城市控件css
  12379. U.selectEl('#U_MD_U_P_tab_address').bind({
  12380. click: function () {
  12381. U.MD.UI.city(this);
  12382. U.selectEl("#U_MD_UI_city_cityBox")[0].style.display = "block";
  12383. U.selectEl("#U_MD_UI_city_cityBox")[0].style.zIndex = "999";
  12384. }
  12385. });
  12386. U.selectEl('#U_MD_U_P_tab_birthday').bind({ //绑定生日的日历控件
  12387. click: function () {
  12388. U.MD.UI.calendar(this, U.selectEl('#U_MD_U_P_tab_calendar')[0], false);
  12389. }
  12390. })
  12391. U.selectEl('#U_MD_U_P_save').bind({ //绑定保存点击事件
  12392. click: function () {
  12393. switch (_lastPage.value) { //判断停留在那一页上
  12394. case "0": case "1":
  12395. U.MD.U.P.updateUserBasicInfo(_lastPage.value); break;
  12396. case "2":
  12397. if ($('.U_MD_U_P_tab_accountRadio:checked')[0].value == 0) {
  12398. U.MD.U.P.setPassword(_bindEl, _bindString);
  12399. } else if ($('.U_MD_U_P_tab_accountRadio:checked')[0].value == 1) {
  12400. U.MD.U.P.updatePassword();
  12401. }
  12402. break;
  12403. }
  12404. U.selectEl('.U_MD_U_P_simpleInfo_address')[0].innerText = U.selectEl("#U_MD_U_P_tab_address")[0].value;
  12405. }
  12406. })
  12407. U.selectEl('.U_MD_U_P_tab_inp').bind({ //绑定事件
  12408. change: function () {
  12409. U.MD.U.P.reset(_changeDataNum, _isDataChanged);
  12410. _lastPage = this;
  12411. _isDataChanged = false;
  12412. }
  12413. })
  12414. U.selectEl('.U_MD_U_P_tab_lable_content input').bind({ //判断某一页用户是否修改了数据
  12415. change: function () {
  12416. if (!_isDataChanged) {
  12417. _changeDataNum = _lastPage.value;
  12418. _isDataChanged = true;
  12419. }
  12420. }
  12421. })
  12422. U.selectEl('.U_MD_U_P_tab_accountRadio').bind({ //账号安全的‘下一步’与“保存设置”按钮的显示隐藏
  12423. change: function () {
  12424. if (this.value == 0) {
  12425. U.selectEl('#U_MD_U_P_save')[0].style.display = "inline-block";
  12426. U.selectEl('#U_MD_U_P_next')[0].style.display = "none";
  12427. } else {
  12428. U.selectEl('#U_MD_U_P_save')[0].style.display = "none";
  12429. U.selectEl('#U_MD_U_P_next')[0].style.display = "inline-block";
  12430. }
  12431. }
  12432. })
  12433. U.selectEl('#U_MD_U_P_authCodeBtn').bind({
  12434. click: function () { //发送验证码
  12435. _isNextStep = U.MD.U.P.sendAuthCode(_isNextStep);
  12436. }
  12437. })
  12438. U.selectEl('#U_MD_U_P_next').bind({
  12439. click: function () { //下一步
  12440. U.MD.U.P.phoneConfirm();
  12441. }
  12442. })
  12443. U.selectEl('#U_MD_U_P_authCodeInp').bind({
  12444. change: function () { //验证码文本框的不为空清除错误
  12445. if (this.value.trim().length > 0) {
  12446. U.selectEl(this).removeClass('U_MD_U_P_tab_user_emptyInp')
  12447. }
  12448. }
  12449. })
  12450. U.selectEl('#U_MD_U_P_cancel').bind({
  12451. click: function () { //关闭
  12452. U.selectEl('#U_MD_U_P_Set')[0].style.display = 'none';
  12453. }
  12454. })
  12455. U.selectEl('#U_MD_U_P_tab_oldPW').bind({
  12456. change: function () {
  12457. var _bool = U.MD.U.P.checkEmpty(this);
  12458. !_bool && U.selectEl(this).removeClass('U_MD_U_P_tab_user_emptyInp');
  12459. }
  12460. })
  12461. U.MD.U.P.dataPrint(); //数据打印
  12462. U.MD.U.P.bindCheckFormat(_bindEl, _bindString); //绑定文本框的格式
  12463. }
  12464. /**
  12465. * 绑定事件
  12466. * @param elarr {Array} 元素数组
  12467. * @param eventarr {Array} 绑定验证类型
  12468. */
  12469. U.MD.U.P.bindCheckFormat = function (elarr, eventarr) {
  12470. var _len = elarr.length;
  12471. for (var i = 0; i < _len; i++) {
  12472. var _el = U.MD.U.P.EL[elarr[i].split(',')[0]];
  12473. _el.i = i;
  12474. U.selectEl(_el).bind({
  12475. change: function () {
  12476. U.MD.U.P.inpFormatCheck(this, elarr, eventarr);
  12477. }
  12478. })
  12479. }
  12480. }
  12481. /**
  12482. * 数据重置
  12483. * @param that {string} 标记
  12484. * @param elarr {Array} 是否更改数据
  12485. * @param eventarr {Array} 是否更改数据
  12486. */
  12487. U.MD.U.P.inpFormatCheck = function (that, elarr, eventarr) {
  12488. var _bool = false;
  12489. if (U.UF.S[eventarr[that.i]]) {
  12490. _bool = U.UF.S[eventarr[that.i]].test(that.value.trim());
  12491. } else if (eventarr[that.i] == 'contrastPW') {
  12492. _bool = (U.MD.U.P.EL[elarr[that.i].split(',')[0]].value === U.MD.U.P.EL[elarr[that.i].split(',')[1]].value);
  12493. }
  12494. if (!_bool) {
  12495. if (!that.value.trim().length) {
  12496. U.selectEl(that).removeClass('U_MD_U_P_tab_user_errorInp');
  12497. U.selectEl(that).addClass('U_MD_U_P_tab_user_emptyInp');
  12498. U.selectEl(that).next().removeClass('U_MD_U_P_tab_errorAlear');
  12499. } else {
  12500. U.selectEl(that).removeClass('U_MD_U_P_tab_user_emptyInp');
  12501. U.selectEl(that).addClass('U_MD_U_P_tab_user_errorInp');
  12502. U.selectEl(that).next().addClass('U_MD_U_P_tab_errorAlear');
  12503. }
  12504. } else {
  12505. U.selectEl(that).removeClass('U_MD_U_P_tab_user_errorInp');
  12506. U.selectEl(that).removeClass('U_MD_U_P_tab_user_emptyInp');
  12507. U.selectEl(that).next().removeClass('U_MD_U_P_tab_errorAlear');
  12508. }
  12509. }
  12510. /**
  12511. * 数据重置
  12512. * @param mark {string} 标记
  12513. * @param flag {boolean} 是否更改数据
  12514. */
  12515. U.MD.U.P.reset = function (mark, flag) {
  12516. if (!flag)
  12517. return;
  12518. var _info = US.userInfo, _elObj = U.MD.U.P.EL;
  12519. switch (mark) {
  12520. case "0":
  12521. U.MD.U.P.dataPrint.simpleInfo(_info, _elObj);
  12522. break;
  12523. case "1":
  12524. U.MD.U.P.dataPrint.privacy(_info, _elObj);
  12525. break;
  12526. case "2":
  12527. U.MD.U.P.dataPrint.account(_info, _elObj);
  12528. break;
  12529. }
  12530. }
  12531. /**
  12532. * 打印数据
  12533. */
  12534. U.MD.U.P.dataPrint = function () {
  12535. var _info = US.userInfo, _elObj = U.MD.U.P.EL;
  12536. U.MD.U.P.dataPrint.privacy(_info, _elObj);
  12537. U.MD.U.P.dataPrint.simpleInfo(_info, _elObj);
  12538. U.MD.U.P.dataPrint.account(_info, _elObj);
  12539. U.MD.U.P.dataPrint.left(_info, _elObj);
  12540. }
  12541. /**
  12542. * 初始化左侧栏数据
  12543. * @param info {Array} 元素数组
  12544. * @param elobj {Array} 绑定验证类型
  12545. */
  12546. U.MD.U.P.dataPrint.left = function (info, elobj) {
  12547. elobj["headImage"].src = U.MD.C.getHeadImage(info.UserImageHead);
  12548. /*$('.U_MD_U_P_simpleInfo_address')[0].innerText = info.LoginAddress.slice(2, 6);*/
  12549. U.selectEl('.U_MD_U_P_simpleInfo_address')[0].innerText = elobj["address"].value;
  12550. elobj["name"].innerText = info.UserNickName || "";
  12551. elobj["name"].title = info.UserNickName || "";
  12552. }
  12553. /**
  12554. * 初始化个人隐私数据
  12555. * @param info {Array} 元素数组
  12556. * @param elobj {Array} 绑定验证类型
  12557. */
  12558. U.MD.U.P.dataPrint.privacy = function (info, elobj) {
  12559. elobj["trueName"].value = info.TrueName;
  12560. elobj["birthday"].value = U.UF.D.getYearMonthDay(info.Birthday);
  12561. }
  12562. /**
  12563. * 初始化基本信息数据
  12564. * @param info {Array} 元素数组
  12565. * @param elobj {Array} 绑定验证类型
  12566. */
  12567. U.MD.U.P.dataPrint.simpleInfo = function (info, elobj) {
  12568. U.selectEl(".U_MD_U_P_tab_user_radio[value$=" + (info.UserSex ? "'1'" : "'0'") + "]")[0].checked = true;
  12569. elobj["selfIntroduction"].value = info.UserIndividualitysignature;
  12570. elobj["address"].innerText = info.Province || "";
  12571. elobj["nickName"].value = info.UserNickName || "";
  12572. elobj["email"].value = info.UserEmail;
  12573. elobj["phoneNumber"].value = info.UserTelephoneNumber;
  12574. elobj["address"].value = info.City;
  12575. elobj["loginName"].innerText = info.UserName;
  12576. }
  12577. /**
  12578. * 初始化账号安全数据
  12579. * @param info {Array} 元素数组
  12580. * @param elobj {Array} 绑定验证类型
  12581. */
  12582. U.MD.U.P.dataPrint.account = function (info, elobj) {
  12583. U.selectEl('#U_MD_U_P_tab_lable_accountNext_t')[0].innerText = info.UserName;
  12584. U.selectEl('.U_MD_U_P_tab_lable_account').css('display', 'block');
  12585. U.selectEl('.U_MD_U_P_tab_lable_accountNext').css('display', 'none');
  12586. U.selectEl('.U_MD_U_P_tab_accountRadio')[0].checked = "checked";
  12587. var _arr = Array.prototype.slice.call($('.U_MD_U_P_tab_item')[2].querySelectorAll('[type="text"]')).concat(Array.prototype.slice.call($('.U_MD_U_P_tab_item')[2].querySelectorAll('[type="password"]')));
  12588. for (var i = 0; i < _arr.length; i++) {
  12589. _arr[i].value = "";
  12590. U.selectEl(_arr[i]).removeClass('U_MD_U_P_tab_user_errorInp');
  12591. U.selectEl(_arr[i]).removeClass('U_MD_U_P_tab_user_emptyInp');
  12592. U.selectEl(_arr[i]).next().removeClass('U_MD_U_P_tab_errorAlear');
  12593. }
  12594. U.selectEl('#U_MD_U_P_save').css('display', 'inline-block');
  12595. U.selectEl('#U_MD_U_P_next').css('display', 'none');
  12596. }
  12597. /**
  12598. * 更新用户基本信息
  12599. */
  12600. U.MD.U.P.updateUserBasicInfo = function (type) {
  12601. var _info = US.userInfo, _elObj = U.MD.U.P.EL, _sex = parseInt($('.U_MD_U_P_tab_user_radio:checked')[0].value);
  12602. if (!parseInt(type)) {
  12603. var _bool = U.MD.U.P.checkEmpty(_elObj['nickName']) || U.MD.U.P.checkEmpty(_elObj['email']) || U.MD.U.P.checkEmpty(_elObj['phoneNumber']) || U.MD.U.P.checkEmpty(_elObj['address']);
  12604. if ($('.U_MD_U_P_tab_user_errorInp').length || U.selectEl('.U_MD_U_P_tab_user_emptyInp').length || _bool) {
  12605. if ($(".U_MD_U_P_tab_user_errorInp")[0].id == "U_MD_U_P_tab_email" && U.selectEl(".U_MD_U_P_tab_user_errorInp").length == 1) {
  12606. U.Alert("邮箱填写错误!");
  12607. return;
  12608. } else if ($(".U_MD_U_P_tab_user_errorInp")[0].id == "U_MD_U_P_tab_phoneNumber" && U.selectEl(".U_MD_U_P_tab_user_errorInp").length == 1) {
  12609. U.Alert("手机号码填写错误!");
  12610. return;
  12611. } else {
  12612. U.Alert("信息录入错误!");
  12613. return;
  12614. }
  12615. }
  12616. }
  12617. U.A.Request(US.USER, ["UpdateUserBasicInfo", _info.UserId, _elObj["trueName"].value, _elObj["nickName"].value, _elObj["phoneNumber"].value, '', '', _elObj["selfIntroduction"].value, _sex, _elObj["email"].value,
  12618. "中国", _elObj["address"].textContent, _elObj["address"].value || "", _elObj["birthday"].value],
  12619. function (r) {
  12620. if (r.value) {//判断是否更改成功
  12621. US.userInfo.UserSex = _sex ? true : false;
  12622. US.userInfo.TrueName = _elObj["trueName"].value;
  12623. US.userInfo.UserNickName = _elObj["nickName"].value;
  12624. US.userInfo.UserTelephoneNumber = _elObj["phoneNumber"].value;
  12625. US.userInfo.UserIndividualitysignature = _elObj["selfIntroduction"].value;
  12626. US.userInfo.UserEmail = _elObj["email"];
  12627. US.userInfo.Province = _elObj["address"].value;
  12628. US.userInfo.City = _elObj["address"].value;
  12629. U.Alert("更改个人资料成功");
  12630. }
  12631. else {
  12632. U.alert("更改个人资料失败");
  12633. }
  12634. })
  12635. }
  12636. /**
  12637. * 设置密码
  12638. * @param elarr {Array} 元素数组
  12639. * @param eventarr {Array} 绑定验证类型
  12640. */
  12641. U.MD.U.P.setPassword = function (elarr, eventarr) {
  12642. var _elObj = U.MD.U.P.EL,
  12643. _emptyEl = U.selectEl($('.U_MD_U_P_tab_lable_content')[2]).find('.U_MD_U_P_tab_user_emptyInp'),
  12644. _errorEl = U.selectEl($('.U_MD_U_P_tab_lable_content')[2]).find('.U_MD_U_P_tab_user_errorInp');
  12645. if (!_emptyEl.length && !_errorEl.length) {
  12646. if (_elObj["oldPW"].value == "") {
  12647. U.MD.U.P.inpFormatCheck(_elObj["oldPW"], elarr, eventarr);
  12648. return;
  12649. } else if (_elObj["newPW"].value == "") {
  12650. U.MD.U.P.inpFormatCheck(_elObj["newPW"], elarr, eventarr);
  12651. return;
  12652. } else if (_elObj["confirmPW"].value == "") {
  12653. U.MD.U.P.inpFormatCheck(_elObj["confirmPW"], elarr, eventarr);
  12654. return;
  12655. }
  12656. U.A.Request(US.USER, ["UpdateUserPasswordByOldPassword", US.userInfo.UserId, _elObj["oldPW"].value, _elObj["confirmPW"].value], function (r) {
  12657. if (r.value) {
  12658. U.Alert("更改密码成功,请重新登录");
  12659. U.MD.U.LO.logout();
  12660. U.MD.U.L.login();
  12661. } else {
  12662. U.Alert("原密码错误");
  12663. U.selectEl(_elObj["oldPW"]).addClass("U_MD_U_P_tab_user_emptyInp");
  12664. }
  12665. });
  12666. }
  12667. }
  12668. /**
  12669. * 通过手机号码修改账户密码
  12670. */
  12671. U.MD.U.P.updatePassword = function () {
  12672. var _pw = U.selectEl('#U_MD_U_P_tab_lable_accountNext_n')[0];
  12673. var _pwconfirm = U.selectEl('#U_MD_U_P_tab_lable_accountNext_c')[0];
  12674. //判断用户密码是否正确
  12675. if (U.MD.U.F.checkConfirmPassword(_pw, _pwconfirm)) {
  12676. U.A.Request(US.USER, ["UpdateUserPassword", US.userInfo.UserId, _pw.value], function (r) {//更改密码存储过程
  12677. if (r.value) {//判断是否更改成功
  12678. U.Alert('更改密码成功');
  12679. }
  12680. else {
  12681. U.Alert('更改密码失败');
  12682. }
  12683. });
  12684. }
  12685. }
  12686. /**
  12687. * 发送验证码
  12688. * @param flag {boolean} 是否已发送
  12689. */
  12690. U.MD.U.P.sendAuthCode = function (flag) {
  12691. if (flag) {
  12692. U.Aleart('请在60秒后重试');
  12693. return;
  12694. }
  12695. var _phoneInp = U.MD.U.P.EL["phone"],
  12696. _bool = U.MD.U.P.checkEmpty(_phoneInp) || U.MD.U.P.isCanUse(_phoneInp);
  12697. if (_bool) {
  12698. U.Alert('信息录入错误!');
  12699. return;
  12700. }
  12701. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserName", US.userInfo.UserName], function (r) {//根据用户名获取用户信息
  12702. if (r.value[0].UserTelephoneNumber != _phoneInp.value) {//如果输入手机号与账号设置的手机号不匹配)
  12703. U.Alert('输入的手机号与账号不匹配');
  12704. } else {
  12705. var _xhttp = new XMLHttpRequest(); //XMLHttpRequest 对象用于在后台与服务器交换数据
  12706. _xhttp.onreadystatechange = function () {//每当 readyState 属性改变时,就会调用该函数。
  12707. if (this.readyState == 4) {//发送成功后
  12708. if (this.status == 201) {
  12709. U.Alert('发送成功'); //弹出发送成功
  12710. U.MD.U.P.setTime($('#U_MD_U_P_authCodeBtn')[0]);
  12711. return true;
  12712. } else {
  12713. U.Alert(JSON.parse(this.response).err || '验证码发送失败,请重新发送...');
  12714. }
  12715. }
  12716. };
  12717. _xhttp.open("POST", "http://api.cloudsql.1473.cn/postnumber", true); //指定和服务器端交互的HTTP方法,URL地址及其他请求信息
  12718. _xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //向一个打开但未发送的请求设置或添加一个 HTTP 请求
  12719. _xhttp.withCredentials = true; //发送cookie等认证信息到服务端
  12720. _xhttp.send("number=" + _phoneInp.value); //$("#userphone")[0].children[0].children[0].value 发送的手机号输入的框
  12721. }
  12722. });
  12723. }
  12724. /**
  12725. * 验证手机验证码
  12726. */
  12727. U.MD.U.P.phoneConfirm = function () {
  12728. var _input = U.selectEl('#U_MD_U_P_authCodeInp')[0];
  12729. if (U.MD.U.P.checkEmpty(_input)) {
  12730. U.Alert('验证码不为空');
  12731. return;
  12732. }
  12733. var _xhttp = new XMLHttpRequest(); //XMLHttpRequest 对象用于在后台与服务器交换数据
  12734. _xhttp.onreadystatechange = function (r) {//每当 readyState 属性改变时,就会调用该函数
  12735. if (this.readyState == 4) {//验证成功后
  12736. if (this.status == 201) {
  12737. U.selectEl('#U_MD_U_P_save').css('display', 'inline-block');
  12738. U.selectEl('#U_MD_U_P_next').css('display', 'none');
  12739. U.selectEl('.U_MD_U_P_tab_lable_account').css('display', 'none');
  12740. U.selectEl('.U_MD_U_P_tab_lable_accountNext').css('display', 'block');
  12741. U.Alert("验证成功"); //弹出验证成功
  12742. } else {
  12743. U.Alert(JSON.parse(this.response).err || "验证码有误");
  12744. }
  12745. }
  12746. };
  12747. _xhttp.open("POST", "http://api.cloudsql.1473.cn/verifi", true); ////指定和服务器端交互的HTTP方法,URL地址及其他请求信息
  12748. _xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //向一个打开但未发送的请求设置或添加一个 HTTP 请求
  12749. _xhttp.withCredentials = true; //发送cookie等认证信息到服务端
  12750. _xhttp.send("code=" + _input.value);
  12751. }
  12752. /**
  12753. * 设置验证码时间
  12754. * @param inp {elenemt} 元素
  12755. */
  12756. U.MD.U.P.setTime = function (inp) {
  12757. if (this._timer) {
  12758. U.Alert('请在60后重试!');
  12759. return;
  12760. }
  12761. var _second = 60,
  12762. _this = this;
  12763. this._timer = setInterval(function () {
  12764. inp.innerText = --_second + 's';
  12765. if (!_second) {
  12766. inp.innerText = '发送验证码';
  12767. clearInterval(_this._timer);
  12768. _this._timer = null;
  12769. }
  12770. }, 1000);
  12771. }
  12772. /**
  12773. * 重置文本框
  12774. * @param inp {elenemt} 元素
  12775. */
  12776. U.MD.U.P.restoreInp = function (el) {
  12777. el.value = "";
  12778. U.selectEl(el).removeClass('U_MD_U_P_tab_user_errorInp');
  12779. U.selectEl(el).removeClass('U_MD_U_P_tab_user_emptyInp');
  12780. }
  12781. /**
  12782. * 判断元素是否有错误
  12783. * @param inp {elenemt} 元素
  12784. */
  12785. U.MD.U.P.isCanUse = function (el) {
  12786. return U.selectEl(el).hasClass('U_MD_U_P_tab_user_emptyInp') || U.selectEl(el).hasClass('U_MD_U_P_tab_user_errorInp');
  12787. }
  12788. /**
  12789. * 判断元素是否为空
  12790. * @param inp {elenemt} 元素
  12791. */
  12792. U.MD.U.P.checkEmpty = function (el) {
  12793. if (el.value.trim() == "" || !!!el.value) {
  12794. U.selectEl(el).addClass('U_MD_U_P_tab_user_emptyInp');
  12795. return true;
  12796. }
  12797. return false;
  12798. }
  12799. /**
  12800. * 上传头像到服务器处理
  12801. * @param input {ele} 上传图片的input
  12802. */
  12803. U.MD.U.P.uploadUserHeadImg = function (input) {
  12804. //判断是否支持FileReader
  12805. //头像预览
  12806. if (window.FileReader) {
  12807. var reader = new FileReader();
  12808. } else {
  12809. U.alert("您的设备不支持图片预览功能,如需该功能请升级您的设备!");
  12810. }
  12811. //获取文件
  12812. var file = input.files[0];
  12813. var imageType = /^image\//;
  12814. //是否是图片
  12815. if (!imageType.test(file.type)) {
  12816. U.alert("请选择图片!");
  12817. return;
  12818. }
  12819. var img = U.selectEl('#U_MD_U_P_simpleInfo_img')[0];
  12820. //读取完成
  12821. reader.onload = function (e) {
  12822. //获取图片dom
  12823. //图片路径设置为读取的图片
  12824. img.src = e.target.result;
  12825. };
  12826. reader.readAsDataURL(file);
  12827. //上传图片
  12828. U.UF.UP.inputUpload([input], "http://disk.1473.cn/USUpfile.ashx?typename=UploadHeadImage", function (url) {
  12829. //console.log(url.value);
  12830. //修改头像
  12831. U.A.Request(US.USER, ["UpdateUserHeaderImage", US.userInfo.UserId, url.value.UserFilesServerName, url.value.UseFilesServerThumbnailName], function (r) {
  12832. if (r.value) {
  12833. //动态修改全局属性
  12834. US.userInfo.UserImageHead = url.value.UserFilesServerName;
  12835. US.userInfo.UserThumbnailImageHead = url.value.UseFilesServerThumbnailName;
  12836. U.Alert('头像修改成功!');
  12837. } else {
  12838. U.Alert('头像修改失败!');
  12839. }
  12840. });
  12841. }, []);
  12842. }
  12843. ;
  12844. ///<jscompress sourcefile="View.js" />
  12845. Namespace.register("U.MD.U.V"); //查看用户信息弹框
  12846. //#region 用户信息查看
  12847. //------------------------------------------------------------------------------用户个人信息
  12848. //个人信息
  12849. U.MD.U.V.UIFZX = U.MD.U.V.ViewOtherUserInfo = function (userid) {
  12850. var _userinfoel = U.selectEl("#U_MD_U_UV").clone(true), // 用户信息元素
  12851. _childs = U.selectEl(_userinfoel[0]).Child(),
  12852. _head = _childs[0],
  12853. _middle = _childs[1],
  12854. _aboutMe = _childs[2];
  12855. var _div = $$('div');
  12856. _div.appendChild(_head); //个人信息的头部
  12857. _div.appendChild(_middle); //个人信息的中间部分
  12858. _div.appendChild(_aboutMe); //个人信息的底部
  12859. //弹出好友信息弹框
  12860. if ($('#U_MD_F_S_TI_Info')[0])
  12861. document.body.removeChild($('#U_MD_F_S_TI_Info')[0])
  12862. var _form = new U.UF.UI.form("<div class='U_MD_F_S_TI'>个人信息</div>",
  12863. _div,
  12864. {
  12865. "style": {
  12866. "min-width": "460px",
  12867. "width": "480px",
  12868. "height": "400px"
  12869. },
  12870. id: "U_MD_F_S_TI_Info"
  12871. },
  12872. {
  12873. isenlarge: false,
  12874. isnarrow: false
  12875. }).form;
  12876. //信息加载
  12877. U.A.Request(US.USER, ["ViewOtherUserInfo", userid],
  12878. U.MD.U.V.ViewOtherUserInfoAsyn, ['', _head, _middle, _aboutMe, _form])
  12879. // U.MD.U.V.ViewUserBlogInfo(_bloginfoel, userid, 1, true); //查看用户最新表表的博客
  12880. }
  12881. //打印用户信息 function(){U.MD.U.L.setLoginCallBack(function(){();});}
  12882. U.MD.U.V.ViewOtherUserInfoAsyn = function (r) {
  12883. var _userinfo = r.value[0],
  12884. _context = r.context,
  12885. _form = _context[4],
  12886. TN = _userinfo.UserTelephoneNumber; //用户电话号码
  12887. U.selectEl(_context[1]).find('.U_MD_U_UV_Head_Left')[0].firstElementChild.src = U.MD.C.getHeadImage(_userinfo.UserImageHead || _userinfo.UserThumbnailImageHead); //打印用户头像
  12888. U.selectEl(_context[1]).find('.U_MD_U_UV_Name')[0].innerText = _userinfo.TrueName || _userinfo.UserName || "不详"; //打印用户名字
  12889. U.selectEl(_context[1]).find('.U_MD_U_UV_Desc')[0].innerText = _userinfo.UserIndividualitysignature || "不详"; //打印用户介绍
  12890. U.selectEl(_context[3]).find('.U_MD_U_UV_Place')[0].innerText = _userinfo.City || "不详"; //打印用户地址
  12891. U.selectEl(_context[3]).find('.U_MD_U_UV_MailBox')[0].innerText = _userinfo.UserEmail != "null" ? _userinfo.UserEmail : "不详"; //打印用户邮箱
  12892. U.selectEl(_context[3]).find('.U_MD_U_UV_PhoneNum')[0].innerText = TN ? (TN.substring(0, 3) + "****" + TN.substring(7, TN.length)) : "不详"; //打印用户的电话号码
  12893. U.selectEl(_context[3]).find('.U_MD_U_UV_Birthday')[0].innerText = _userinfo.Birthday ? U.UF.D.formatDateToArray(_userinfo.Birthday).slice(0, 3).join('-') : "不详"; //打印用户的出生日期
  12894. //获取文件统计数据
  12895. U.A.Request(US.CD, [US.DB, 'UseStudio_Users', 'GetStatisticData', _userinfo.UserId], function (data) {
  12896. U.selectEl('.U_MD_U_UV_Friend', _context[1])[0].innerText = data.value[0].friendCount;
  12897. U.selectEl('.U_MD_U_UV_Word', _context[1])[0].innerText = data.value[0].wrodCount;
  12898. U.selectEl('.U_MD_U_UV_Excel', _context[1])[0].innerText = data.value[0].excelCount;
  12899. U.selectEl('.U_MD_U_UV_Cloud', _context[1])[0].innerText = data.value[0].diskFileCount;
  12900. });
  12901. //添加好友事件处理
  12902. var _friendinfo,
  12903. _addbutton = U.selectEl('.U_MD_U_UV_Head_Right_Btn', _context[1])[0],
  12904. _functionbtn = U.selectEl(_context[2]).find('.U_MD_U_UV_FuncArea_MarginBox_Btn'); //获取三个按钮
  12905. _functionbtn[1].style.display = '';
  12906. if (_userinfo.UserId == US.userInfo.UserId) {
  12907. _addbutton.onclick = function () {
  12908. U.Alert("不可以添加自己为好友哟!");
  12909. };
  12910. _functionbtn[1].style.display = 'none';
  12911. }
  12912. else if (US.friend.friends && (_friendinfo = U.Json.select(US.friend.friends, { UserId: _userinfo.UserId })[0])) {
  12913. _addbutton.onclick = function () {
  12914. U.MD.F.R.deleteFriendForm(_friendinfo, function () {
  12915. U.UF.F.closeWindow(_form);
  12916. });
  12917. //U.MD.F.M.deleteFriend(_friendinfo);
  12918. //U.UF.F.closeWindow(_form); //关闭窗口函数
  12919. };
  12920. _addbutton.style.backgroundColor = '#e20f0f';
  12921. _addbutton.innerText = '删除好友';
  12922. } else {
  12923. _addbutton.style.backgroundColor = '';
  12924. _addbutton.onclick = function () {
  12925. U.MD.F.M.addFriend(_userinfo, function () {
  12926. U.UF.F.closeWindow(_form); //关闭窗口函数
  12927. });
  12928. }
  12929. }
  12930. //协同文档事件绑定
  12931. _functionbtn[0].onclick = function () {
  12932. U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.disk.initTree[4][0] });
  12933. }
  12934. //协同他人文档事件绑定
  12935. // _functionbtn[1].onclick = function () {
  12936. // U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.disk.initTree[2][0] });
  12937. // }
  12938. //发起对话事件绑定
  12939. _functionbtn[1].onclick = function () {
  12940. if (!U.MD.U.L.isLogin()) {
  12941. var _friendinfo = U.Json.select(US.friend.friends, { UserId: _userinfo.UserId })[0];
  12942. if (_friendinfo) {
  12943. U.MD.F.W.popupFriendsForm(_friendinfo);
  12944. U.UF.F.closeWindow(_form); //关闭窗口函数
  12945. } else {
  12946. U.UF.UI.confirm((_userinfo.UserNickName || _userinfo.UserName) + "还不是你的好友哟!是否添加" + (_userinfo.UserNickName || _userinfo.UserName) + "为好友呢。", function () {
  12947. U.MD.F.M.addFriend(_userinfo, function () {
  12948. U.UF.F.closeWindow(_form); //关闭窗口函数
  12949. });
  12950. });
  12951. }
  12952. }
  12953. }
  12954. }
  12955. /**
  12956. * 添加好友状态切换 暂无使用
  12957. * @param {element} button 点击元素
  12958. * @param {element} userinfo 用户信息
  12959. */
  12960. U.MD.U.V.AddFriend = function (button, userinfo) {
  12961. U.MD.F.M.addFriend(userinfo, function () {
  12962. button.innerText = '删除好友';
  12963. button.style.backgroundColor = '#e20f0f';
  12964. button.onclick = function () {
  12965. _friendinfo = U.Json.select(US.friend.friends, { UserId: userinfo.UserId })[0];
  12966. U.MD.F.M.deleteFriend(_friendinfo);
  12967. button.innerText = '+好友';
  12968. button.style.backgroundColor = '';
  12969. button.onclick = function () {
  12970. U.MD.U.V.AddFriend(button, userinfo);
  12971. }
  12972. };
  12973. });
  12974. }
  12975. //滚动加载
  12976. U.MD.U.V.GDCKYHDT = function (UDOD, userid) {
  12977. _UDFE = U.MD.D.H.ET["UIF"][userid][1];
  12978. U.MD.U.V.ViewUserBlogInfo(UDOD, _UDFE, userid, this.P + 2); //分页打印
  12979. }
  12980. //获取用户最新发表
  12981. U.MD.U.V.ViewUserBlogInfo = function (UDOD, UDPE, userid, P, TF) {
  12982. var _userinfoel = U.selectEl(UDOD).Child();
  12983. UDPE = U.MD.D.D.FYGBL(UDPE, P); //U.UF.EL.getChildrenNoText()
  12984. if (UDPE[0]) {
  12985. if (TF) { _userinfoel[1].innerText = ""; }
  12986. if (UDPE[0].length) { U.MD.D.Blog.PGBL(_userinfoel[1], UDPE[0], true); }
  12987. else if (P === 1) { U.MD.U.V.PCKYHDT(_userinfoel[1]); }
  12988. } //打印文章
  12989. else { U.A.Request(US.USER, ["GFA", US.EMPTYGUID, (UDPE[1] - 1) * 100, UDPE[1] * 100, userid, US.EMPTYGUID], U.MD.U.V.AsynCKYHDT, [(P == 1 ? [_userinfoel[1], true] : [$("#U_MD_U_UV_PL")[0], 1]), UDOD, userid, P, UDPE[1], _userinfoel]); }
  12990. //$("div#U_MD_U_UV_PC", _userinfoel[0])[0].onscroll = U.UF.EV.scrollLoad({ "AF": function () { U.MD.U.V.GDCKYHDT(_bloginfoel, userid); } }).SCH(); //滚动加载
  12991. U.UF.EV.scrollLoad($("div#U_MD_U_UV_PC", _userinfoel[0])[0], function () { U.MD.U.V.GDCKYHDT(_bloginfoel, userid); }); //滚动加载
  12992. }
  12993. //异步获取最新的文章
  12994. U.MD.U.V.AsynCKYHDT = function (r) {
  12995. var _context = r.context,
  12996. UPXD = U.MD.D.H.ET["UIF"][_context[2]];
  12997. r = r.value;
  12998. if (!UPXD) { UPXD = U.MD.D.H.ET["UIF"][_context[2]] = [], UPXD[1] = [] };
  12999. UPXD[1] = UPXD[1] || [];
  13000. UPXD[1][_context[4]] = U.MD.D.Blog.ZFSGBL(r);
  13001. _context[5][1].innerText = "";
  13002. _context[5][0].innerText = r[0] > 0 ? "动静..(" + r[0].SumNumber + ")" : "动静";
  13003. U.MD.U.V.ViewUserBlogInfo(_context[1], UPXD[1], _context[2], _context[3]); //打印用户的文章
  13004. }
  13005. //用户资料没有发表文章
  13006. U.MD.U.V.PCKYHDT = function (UDOD) {
  13007. var _userinfoel = $$("div", { "className": "U_MD_U_UV_T" }, UDOD);
  13008. $$("div", { "className": "U_MD_U_UV_TS", "innerHTML": "他暂时没有相关的消息呢!!稍后再来试试吧~" }, _userinfoel);
  13009. $$("div", { "className": "U_MD_U_UV_TX", "innerHTML": "Noting!!" }, _userinfoel);
  13010. }
  13011. //群介绍
  13012. U.MD.U.V.GroupInfo = function (groupinfo) {
  13013. var _userinfoel = U.selectEl("#U_MD_U_GV").clone(true), // 用户信息元素
  13014. _childs = U.selectEl(_userinfoel[0]).Child(),
  13015. _content = _childs[0];
  13016. U.MD.U.V.syncData(_content, groupinfo);
  13017. var _form = new U.UF.UI.form("<div class='U_MD_F_S_TI'>群信息</div>",
  13018. _content,
  13019. {
  13020. "style": {
  13021. "min-width": "480px",
  13022. "width": "480px",
  13023. "height": "340px"
  13024. },
  13025. id: "U_MD_G_Info"
  13026. },
  13027. {
  13028. isenlarge: false,
  13029. isnarrow: false
  13030. }).form;
  13031. }
  13032. //同步群介绍的数据
  13033. U.MD.U.V.syncData = function (el, groupinfo) {
  13034. var _head = el.children[0], //群介绍的头部
  13035. _middle = el.children[1], //群介绍的中间部分
  13036. _bottom = el.children[2], //群介绍的底部
  13037. _groupId = groupinfo.GroupManageID, //群的ID
  13038. _groupCreaterId = groupinfo.GroupManageCreateUserID, //群主的ID
  13039. _groupCreaterEl = U.selectEl(_bottom).find('.U_MD_U_GV_GroupInfo_ImgArea_Creater')[0], //群主显示的元素
  13040. _groupMember = U.Json.select(US.friend.groupusers, { GroupManageID: _groupId }), //群人数
  13041. _cloneEl = $$('img'), //创建图片
  13042. _createrImg = _cloneEl.cloneNode(), //克隆图片元素
  13043. _groupMemberEl = U.selectEl(_bottom).find('.U_MD_U_GV_GroupInfo_ImgArea_MemberImg')[0], //群人数显示的元素
  13044. _groupBtn = U.selectEl(_middle).find('.U_MD_U_GV_FuncArea_MarginBox_Btn'); //群的三个按钮
  13045. U.selectEl(_head).find('.U_MD_U_GV_HeadInfo_Name')[0].innerText = groupinfo.GroupManageName; //群的名字
  13046. U.selectEl(_head).find('.U_MD_U_GV_HeadInfo_Desc')[0].innerText = groupinfo.GroupManageDescript; //群的介绍
  13047. U.selectEl(_bottom).find('.U_MD_U_GV_GroupInfo_Img_TextNum')[0].innerText = _groupMember.length; //群的人数
  13048. _createrImg.src = U.MD.C.getHeadImage(U.Json.selectOne(US.friend.groupusers, { UserId: _groupCreaterId }).UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg"; //群头像
  13049. _groupCreaterEl.appendChild(_createrImg) //把群头像添加到元素里
  13050. _groupCreaterEl.onclick = function () {
  13051. U.MD.U.V.ViewOtherUserInfo(_groupCreaterId);
  13052. }
  13053. _groupBtn[2].onclick = function () {
  13054. top.U.MD.F.W.popupFriendsForm(groupinfo);
  13055. }
  13056. for (var i = 0; i < _groupMember.length; i++) {
  13057. if (i < 6) {
  13058. var _cloneImg = _cloneEl.cloneNode();
  13059. _cloneImg.src = U.MD.C.getHeadImage(_groupMember[i].UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg";
  13060. _cloneImg.onclick = U.UF.C.closure(function (i) {
  13061. U.MD.U.V.ViewOtherUserInfo(_groupMember[i].UserId);
  13062. }, [i])
  13063. _groupMemberEl.appendChild(_cloneImg);
  13064. } else {
  13065. $$('span', {
  13066. className: "U_MD_U_GV_GroupInfo_ImgArea_MemberMore", innerText: "···", onclick: function () {
  13067. U.MD.U.V.showAllGroupMember(_groupMember, this, _cloneEl, _groupMemberEl);
  13068. }
  13069. }, _groupMemberEl);
  13070. return;
  13071. }
  13072. }
  13073. }
  13074. U.MD.U.V.showAllGroupMember = function (groupmember, el, cloneel, addel) {
  13075. addel.style.display = "none";
  13076. addel.style.height = "82px";
  13077. for (var i = 6; i < groupmember.length; i++) {
  13078. var _cloneImg = cloneel.cloneNode();
  13079. _cloneImg.src = U.MD.C.getHeadImage(groupmember[i].UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg";
  13080. _cloneImg.onclick = U.UF.C.closure(function (i) {
  13081. U.MD.U.V.ViewOtherUserInfo(groupmember[i].UserId);
  13082. }, [i]);
  13083. addel.appendChild(_cloneImg);
  13084. }
  13085. addel.style.display = "block";
  13086. U.selectEl(el).remove();
  13087. }
  13088. //#endregion;
  13089. ///<jscompress sourcefile="ViewLogin.js" />
  13090. Namespace.register("U.MD.U.L"); //用户登录的命名空间
  13091. Namespace.register("U.MD.U.OT"); //用户登录的命名空间
  13092. //#region 登录
  13093. /*
  13094. 问题:
  13095. 1、验证码的接口问题
  13096. 2、无窗体的接口
  13097. */
  13098. //#region 配置数据
  13099. U.MD.U.L.loginCallBack; //登录后的回调使用
  13100. U.MD.U.L.isLogining = false; //判断用户登录状态。cookie登录状态为cookie,账号登录为true,没有登录为false
  13101. //#endregion
  13102. /**
  13103. * 弹出登录注册
  13104. *
  13105. * @param {int} type==3:登录页面,type==1:注册页面,type==2:找回密码页面
  13106. * @param {function} cb为回调函数
  13107. * @returns {boolean} 是否登录
  13108. */
  13109. U.MD.U.L.login = U.MD.U.L.DLTC = function (fun) {
  13110. var _iframe = U.selectEl("#U_MD_HomeC_Pop iframe")[0];
  13111. if ($("#U_MD_HomeC_Pop")[0]) {
  13112. U.UF.F.windowTopCenter($("#U_MD_HomeC_Pop")[0]);
  13113. try {
  13114. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13115. if (U.UF.C.isFunction(fun)) {
  13116. U.MD.U.L.loginCallBack = fun; //回调处理
  13117. }
  13118. U.selectEl("input", _iframe.contentWindow.document)[0].focus();
  13119. _iframe.contentWindow.U.MD.U.L.init();
  13120. }
  13121. catch (e) { }
  13122. }
  13123. else {
  13124. var _iframe = $$("iframe", { "style": { "border": "0", "float": "left" }, "id": "UI_Login", "name": "UI_Login", "frameborder": "no", "border": "0", "scrolling ": "no", "width": "360px", "height": "480px", "src": "//user.1473.cn/Login.htm" });
  13125. new U.UF.UI.form("", _iframe,
  13126. {
  13127. "id": "U_MD_HomeC_Pop",
  13128. "style": {
  13129. "width": "360px",
  13130. "height": "510px"
  13131. }
  13132. },
  13133. {
  13134. isdrag: false,
  13135. isstretching: false,
  13136. isenlarge: false,
  13137. isnarrow: false
  13138. });
  13139. //跨域回调设置
  13140. U.UF.DL.iframeLoad(_iframe, function () {
  13141. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13142. if (U.UF.C.isFunction(fun)) {
  13143. U.MD.U.L.loginCallBack = fun; //回调处理
  13144. }
  13145. _iframe.contentWindow.U.MD.U.L.loginCallBack = U.MD.U.L.defaultCallBack; //设置登录回调
  13146. });
  13147. }
  13148. return _iframe;
  13149. }
  13150. /**
  13151. * 打开注册窗体
  13152. */
  13153. U.MD.U.L.register = function (fun) {
  13154. var _iframe = U.MD.U.L.login();
  13155. try {
  13156. _iframe.contentWindow.U.MD.U.R.register();
  13157. }
  13158. catch (e) {
  13159. U.UF.DL.iframeLoad(_iframe, function () {
  13160. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13161. if (U.UF.C.isFunction(fun)) {
  13162. U.MD.U.L.loginCallBack = fun; //回调处理
  13163. }
  13164. _iframe.contentWindow.U.MD.U.L.loginCallBack = U.MD.U.L.defaultCallBack; //设置登录回调
  13165. _iframe.contentWindow.U.UF.N.addHash('register'); //添加hash的处理
  13166. });
  13167. }
  13168. }
  13169. /**
  13170. * 打开找回密码窗体
  13171. */
  13172. U.MD.U.L.retrieve = function () {
  13173. var _iframe = U.MD.U.L.login();
  13174. try {
  13175. _iframe.contentWindow.U.MD.U.F.findPassword();
  13176. }
  13177. catch (e) {
  13178. U.UF.DL.iframeLoad(_iframe, function () {
  13179. _iframe.contentWindow.U.UF.N.addHash('findPassword'); //添加hash的处理
  13180. });
  13181. }
  13182. }
  13183. /**
  13184. * 登录异步
  13185. *
  13186. * @param {object} 服务器返回的值
  13187. * @param {boolean} 是否是cookie登录
  13188. */
  13189. U.MD.U.L.defaultCallBack = function (r, iscookie) {
  13190. var _userinfo, //用户个人信息
  13191. _backgroudimage, //背景图片
  13192. _str, //输出的提示
  13193. _context = r.context, //回调参数
  13194. _address = _context[1], //触发函数的地址
  13195. _username = _context[2], //用户名
  13196. _password = _context[3]; //密码
  13197. //登录后台返回的数据
  13198. r = r.value;
  13199. //判断登录状态
  13200. switch (r) {
  13201. case null:
  13202. _str = "系统繁忙!请重试";
  13203. break; //系统繁忙
  13204. case 0:
  13205. _str = "帐号不存在!";
  13206. break;
  13207. case 1:
  13208. _str = "密码错误!";
  13209. break; //帐号密码错误
  13210. case 2:
  13211. _str = "该用户不允许被访问!请联系管理员";
  13212. break; //用户给禁用
  13213. default:
  13214. if (r) {
  13215. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13216. U.MD.U.LO.emptyUserInfo(); //登陆的时候先清空用户信息,防止前面登陆用户的信息有冲突
  13217. //如果刚刚登陆的时候没有用户的地址,这里重新获取,然后向后台发送
  13218. if (!_address) {
  13219. U.UF.CI.getUserLocation(U.MD.U.L.addUserAccess); //客户端信息加载,好像只加载了新浪ip地址?
  13220. }
  13221. _userinfo = U.MD.U.L.setUserInfo(r); //设置用户基本信息,包括用户信息,好友信息
  13222. U.MD.U.L.getLoginUserInfo(_username || US.userInfo.UserName); //去获取用户详细信息
  13223. if ($("#U_MD_D_BDI")[0] && U.selectEl('#U_MD_D_BG')[0]) {
  13224. //登录有用户的信息展示到页面中,包括背景图片、用户头像等
  13225. U.MD.U.L.printUserInfo(); //用户头部头像个人信息
  13226. _backgroudimage = U.MD.D.B.split(US.userInfo.UserBackGroundImage); //拆分用户的背景图片,里面包含了图片地址和展示的格式
  13227. U.MD.D.B.setBackgroundImage(_backgroudimage[0], _backgroudimage[1]); //设置用户背景图,以后需修改为设置用户桌面信息
  13228. }
  13229. //Cookie登录,即使密码错误也不弹出错误信息。
  13230. if (_str && iscookie !== true) {
  13231. U.alert(_str); //登录提示处理
  13232. }
  13233. //如果弹出了登录框,那么给登录框进行处理
  13234. if ($("#U_MD_HomeC_Pop")[0]) {
  13235. //登录框的样式还原
  13236. U.selectEl("#U_MD_HomeC_Pop")[0].close(); //关闭登陆款
  13237. }
  13238. U.MD.O && U.MD.O.P.connect();
  13239. }
  13240. // _str = "登录成功";
  13241. }
  13242. if (_str) {
  13243. U.alert(_str);
  13244. }
  13245. }
  13246. /**
  13247. * 判断用户是否登录如果未登陆则弹出登陆框
  13248. *
  13249. */
  13250. U.MD.U.L.isLogin = function (fun) {
  13251. if (!US.userInfo.UserId) { //判断用户id是否存在
  13252. U.MD.U.L.login(fun); //用户登录函数
  13253. return true; //用户未登录返回false
  13254. }
  13255. return false; //用户登录返回true
  13256. }
  13257. /**
  13258. * 登录调用回调使用
  13259. * @param {function} 回调函数
  13260. *
  13261. */
  13262. U.MD.U.L.setLoginCallBack = function (fun) {
  13263. //未登录要求登录
  13264. if (U.MD.U.L.isLogin()) {
  13265. U.MD.U.L.loginCallBack = fun;
  13266. }
  13267. //登录直接转发
  13268. else {
  13269. fun();
  13270. return true;
  13271. }
  13272. }
  13273. //#endregion
  13274. //#region cookie登录
  13275. /*
  13276. 功能:1473.cn域下各个应用的用户通过Cookie自动登录,Cookie登录入口。支持跨域
  13277. */
  13278. U.MD.U.L.cookieLogin = function () {
  13279. var _cookie = U.MD.U.L.getCookieByUserId(), //获取用户的云端Cookie,选取最后一个账号进行登录。
  13280. _address = US.city.userAllLocation || ""; //找到自己登陆用户的地址
  13281. //如果获取到cookie的值,那么就进行cookie登陆
  13282. if (_cookie && _cookie.userid && _cookie.userid.length == 36) {
  13283. U.MD.U.L.isLogining = "cookie"; //设置cookie登陆状态
  13284. U.A.Request(US.USER, ["LoginByCookie", _cookie.userid, _cookie.username], U.MD.U.L.defaultCallBack, ["", _address]); //调用cookie登陆处理
  13285. }
  13286. }
  13287. /*
  13288. 功能:获取用户cookie,云端cookie关键字为usestudiosso,格式为
  13289. Loginid:登录id
  13290. userstamp:账号13928417148的值为"1364812396"?奇怪?
  13291. userid:云端用户id
  13292. username:云端用户名
  13293. 如果不传入参数,默认获取最后一个,否则获取传入userid的账号进行登录。
  13294. 参数一:userid代表用户id。传入用户id,则判断cookie中是否有该账号,并使用该账号登录。
  13295. */
  13296. U.MD.U.L.getCookieByUserId = function (userid) {
  13297. var i, _cookiearr = U.MD.U.L.cookieToArray("usestudiosso"); //获取保存的cookie值。
  13298. //如果传入参数userid并且cookie中有userid。则判断是否是自己的账号登录。
  13299. if (_cookiearr.userid) {
  13300. //如果传了userid,那么就根据userid找
  13301. if (userid) {
  13302. //数组里匹配
  13303. for (i = 0; i < _cookiearr.userid.length; i++) {
  13304. if (_cookiearr.userid[i] == userid) {
  13305. break;
  13306. }
  13307. }
  13308. }
  13309. //否则找到最后一个登陆用户的信息
  13310. else {
  13311. //允许多用户登录,则用户id减少一?
  13312. i = _cookiearr.userid.length - 1;
  13313. }
  13314. //循环所有Cookie。
  13315. for (var c in _cookiearr) {
  13316. //对中文进行解密。_cookiearr[c]中可能有多个userid,只获取最后选中的第i个。返回的数据在这里做了处理。
  13317. _cookiearr[c] = decodeURIComponent(_cookiearr[c][i]);
  13318. }
  13319. }
  13320. //返回的集合包括了Loginid:登录iduserstamp:账号13928417148的值为"1364812396"?奇怪?userid:云端用户idusername:云端用户名
  13321. return _cookiearr;
  13322. }
  13323. /**
  13324. *1473cookie格式专用
  13325. * 把形如:"userid=72854d28-f45c-48d7-92b7-3cd933e03022&username=13928417148&Loginid=fd02976d-993b-4437-bbd9-5efa99802c8f&userstamp=1364812396"的cookie转换为json对象。函数名有问题。
  13326. 得到的形式为:_UAE.Loginid可得到用户id。
  13327. *
  13328. * @param {string} 获取cookie的key对应的值 如usestudio=aa=ff&ss=aa 的usestudio里的 aa=ff&ss=aa
  13329. * @return {object} {key:[value1,value2]}
  13330. */
  13331. U.MD.U.L.cookieToArray = function (key) { //获取cookie
  13332. var i, //循环初始化
  13333. _cookieobj = {}, //初始化对象 作为返回值
  13334. _cookie = U.UF.Cookie.get("usestudiosso"); //获取用户指定的Cookie值
  13335. if (_cookie) { //是否存在
  13336. _cookie = _cookie.split("&");
  13337. for (i = 0; i < _cookie.length; i++) { //循环对应的值
  13338. _cookie[i] = _cookie[i].split("="); //切分key和value
  13339. //如果定义了cookie值的接受数组,则不再重复定义。_cookie[i][0]相当于key,例如userid
  13340. if (!_cookieobj[_cookie[i][0]]) {
  13341. _cookieobj[_cookie[i][0]] = [];
  13342. }
  13343. _cookieobj[_cookie[i][0]].push(decodeURIComponent(_cookie[i][1])); //生成{key:[value1,value2]}
  13344. }
  13345. }
  13346. return _cookieobj;
  13347. }
  13348. //#endregion
  13349. //#region 登录数据使用
  13350. /**
  13351. * 为了以后的扩展,给其他系统获取完整的用户信息,获取用户登录数据,后面还有一个登陆获取用户个人信息。好友信息,及消息通知,逻辑有问题。
  13352. * @param {string} 用户名
  13353. *
  13354. */
  13355. U.MD.U.L.getLoginUserInfo = function (username) {
  13356. U.A.Request(US.USER, ["GetUserLoginData", username], U.MD.U.L.asynGetLoginUserInfo);
  13357. }
  13358. /**
  13359. * 异步获取数据
  13360. * @param {object} ajax返回的数据值
  13361. *
  13362. */
  13363. U.MD.U.L.asynGetLoginUserInfo = function (r) {
  13364. r = r.value; //得到登录用户的数据
  13365. US.friend = r; //返回的r里面是用户的好友信息 包括 {"className":好友分组信息,friends:好友信息,group:好友群,groupusers:群好友,recentcontacts:最近联系人,unreadfirendmessage:未读好友消息,unreadgroupmessage:未读群消息,commonfriend:推荐好友}
  13366. U.MD.U.L.initUserLogin(US.userInfo); //登录初始化应用
  13367. if (U.MD.D && U.MD.D.IsUseStudio || U.selectEl("#usestudio_server")[0]) {
  13368. U.MD.F && U.MD.F.N.friendMessageHandle([r.unreadfirendmessage, r.unreadgroupmessage]); //用户消息区域
  13369. }
  13370. }
  13371. /**
  13372. * 添加用户初始化资料信息
  13373. * @param {array} 登录用户的数据
  13374. *
  13375. */
  13376. U.MD.U.L.setUserInfo = function (userinfo) {
  13377. US.userInfo = userinfo[0]; //给用户信息全局变量赋值。
  13378. US.userInfo.LoginId = userinfo[2]; //用户前后台更新数据唯一识别id
  13379. US.friend.onlinefirendinfo = userinfo[1]; //添加在线信息。
  13380. return US.userInfo;
  13381. }
  13382. //登录成功执行事件
  13383. U.MD.U.L.initUserLogin = function () {
  13384. var _userinfo = US.userInfo; //初始化用户资料
  13385. U.MD.UI && U.MD.UI.flashEmptyUpload && U.MD.UI.flashEmptyUpload(); //清理上传文件
  13386. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13387. if (U.UF.C.isFunction(U.MD.U.L.loginCallBack)) {
  13388. U.MD.U.L.loginCallBack(_userinfo); //回调处理
  13389. }
  13390. U.MD.F && U.MD.F.initFriend(); //初始化好友
  13391. //如果没有用url指引,同时又是1473的项目,那么弹出云盘,否则只是加载数据
  13392. if (U.MD.D && U.MD.D.IsUseStudio) {
  13393. U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.FTPFOLDERID }); //弹出云盘的数据。
  13394. }
  13395. //外部加载1473框架的都会带有usestudio_server 这个元素,当用户没有填写邮箱信息的时候,同时是在1473主站点的,那么就弹出用户
  13396. if (!US.userInfo.UserEmail && !$("#usestudio_server")[0]) {
  13397. U.MD.U.P.userDataSet(); //用户数据加载
  13398. }
  13399. }
  13400. /**
  13401. * 添加用户登录信息
  13402. *
  13403. */
  13404. U.MD.U.L.addUserAccess = function () {
  13405. //如果用户的城市信息不存在,则添加用户用户城市信息,应该不只是单单判断地址,此处逻辑还需要整理!
  13406. if (US.city.userAllLocation) {
  13407. U.A.Request(US.USER, ["RecordUserClientInfo", US.userInfo.UserName, "", "", US.city.userAllLocation, ""],
  13408. function () { }); //异步添加地址信息
  13409. }
  13410. }
  13411. /**
  13412. * 打印用户的信息
  13413. *
  13414. */
  13415. U.MD.U.L.printUserInfo = function () {
  13416. var _childel,
  13417. _userinfo = US.userInfo, //用户的信息
  13418. _userimage = U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead), //获取用户头像
  13419. _el = U.selectEl("#U_MD_D_BDI"); //头像打印的区域
  13420. if (_el[0]) {
  13421. //设置头部的样式变化
  13422. _el.addAttrArray({
  13423. "className": "U_MD_D_BDI"
  13424. })[0];
  13425. //如果已经有头像了,那么直接修改头像
  13426. if (_el.find("img")[0]) {
  13427. //设置头像处理
  13428. _el.find("img").addAttrArray({
  13429. "onerror": U.MD.C.imgError,
  13430. "title": _userinfo.UserNickName,
  13431. "onclick": function () {
  13432. U.MD.D.I.openApplication("set");
  13433. },
  13434. "src": U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead)
  13435. });
  13436. }
  13437. //创建头像的处理
  13438. else {
  13439. $$("img", {
  13440. "onerror": U.MD.C.imgError,
  13441. "onerror": U.MD.C.imgError,
  13442. "title": _userinfo.UserNickName,
  13443. "onclick": function () {
  13444. U.MD.D.I.openApplication("set");
  13445. },
  13446. "src": U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead)
  13447. }, _el[0])
  13448. }
  13449. _childel = U.selectEl("#U_MD_D_BDL").Child();
  13450. _childel[0].style.display = _childel[1].style.display = "none";
  13451. _childel[2].style.display = "block";
  13452. }
  13453. }
  13454. //#endregion
  13455. //#region 外链登录
  13456. /**
  13457. * 填写登录信息
  13458. *
  13459. * @param {array} 登录值参数
  13460. * @param {array} 回调函数
  13461. */
  13462. U.MD.U.L.perfectUserInfo = function (userinfo, username) {
  13463. if ($("#U_MD_U_OT_B_Pop")[0]) {
  13464. U.UF.F.windowTopCenter($("#U_MD_U_OT_B_Pop")[0]);
  13465. }
  13466. else {
  13467. var _iframe = $$("iframe", { "style": { "border": "0", "float": "left" }, "id": "U_MD_U_OT_B_Iframe", "name": "UI_Login", "frameborder": "0", "width": "400px", "height": "290px", "src": "//user.1473.cn/CompleteInformation.htm" });
  13468. new U.UF.UI.form("", _iframe,
  13469. {
  13470. "id": "U_MD_U_OT_B_Pop",
  13471. "style": {
  13472. "width": "400px",
  13473. "height": "340px"
  13474. }
  13475. },
  13476. {
  13477. isdrag: false,
  13478. isstretching: false,
  13479. isenlarge: false,
  13480. isnarrow: false
  13481. });
  13482. //跨域回调设置
  13483. U.UF.DL.iframeLoad(_iframe, function () {
  13484. if ($("#U_MD_HomeC_Pop")[0]) {
  13485. U.selectEl("#U_MD_HomeC_Pop")[0].close();
  13486. }
  13487. _iframe.contentWindow.U.MD.U.L.loginCallBack = U.MD.U.L.defaultCallBack; //设置登录回调
  13488. _iframe.contentWindow.U.MD.U.OT.perfectUserInfoInit(userinfo, username); //设置登录回调
  13489. });
  13490. }
  13491. }
  13492. //#endregion
  13493. ;
  13494. ;
  13495. ///<jscompress sourcefile="Advertisement.js" />
  13496. /*
  13497. 广告使用区域
  13498. */
  13499. Namespace.register("U.UF.DL.C.AD"); //桌面广告命名空间
  13500. //#region 百度广告
  13501. /*
  13502. * 百度异步加载
  13503. *
  13504. * @param {string} 广告id
  13505. */
  13506. U.UF.DL.C.AD.onloadBaiduJs = function (baiduid) {
  13507. U.UF.DL.asynLoadJs({ "src": "//hm.baidu.com/hm.js?" + baiduid }); //加载广告
  13508. }
  13509. /*
  13510. * 百度异步加载
  13511. *
  13512. * @param {string} 广告位置id
  13513. * @param {string} 广告id
  13514. */
  13515. U.UF.DL.C.AD.baidu = function (elementid, baiduid) {
  13516. if (baiduid) { //异步加载
  13517. U.UF.DL.asynLoadJs({ type: "text/javascript", src: "http://cbjs.baidu.com/js/m.js" },
  13518. function () {
  13519. U.UF.DL.C.AD.asynBaidu(elementid, baiduid);
  13520. }); //异步加载
  13521. }
  13522. }
  13523. /*
  13524. * 异步广告
  13525. *
  13526. * @param {string} 广告位置id
  13527. * @param {string} 广告id
  13528. */
  13529. U.UF.DL.C.AD.asynBaidu = function (elementid, code) {
  13530. BAIDU_CLB_fillSlotAsync(code, elementid);
  13531. }
  13532. //#endregion
  13533. //#region
  13534. /*
  13535. * 异步阿里妈妈广告
  13536. *
  13537. * @param {string} 广告位置id
  13538. */
  13539. U.UF.DL.C.AD.alimama = function (obj) {
  13540. //阿里巴巴官网实例
  13541. var i,
  13542. _aliobj = window.alimamatk_onload = window.alimamatk_onload || [];
  13543. if (Array.isArray(obj)) {
  13544. for (i = 0; i < obj.length; i++) {
  13545. U.UF.DL.C.AD.alimama(obj[i]);
  13546. }
  13547. }
  13548. else {
  13549. _aliobj.push(U.UF.C.isObject(obj) ? obj : (obj = { pid: obj, appkey: "", unid: "", type: "click" }));
  13550. } //加载广告
  13551. if (!window.alimamatk_show) {
  13552. U.UF.DL.asynLoadJs({ type: "text/javascript", id: obj.pid, charset: "gbk", async: true, src: "http://a.alimama.cn/tkapi.js" });
  13553. }
  13554. }
  13555. /*
  13556. * 阿里妈妈广告异步
  13557. *
  13558. * @param {string} 广告位置id
  13559. */
  13560. U.UF.DL.C.AD.asynAlimama = function (el, id) {
  13561. $$("a", { style: { "display": "none!important" }, id: "tanx-a-" + id }, el); //显示元素
  13562. U.UF.DL.asynLoadJs({
  13563. type: "text/javascript", id: "tanx-s-" + id, async: true,
  13564. charset: "gbk", async: true, src: "http://p.tanx.com/ex?i=" + id
  13565. }); //加载广告
  13566. }
  13567. //#endregion
  13568. ;
  13569. ///<jscompress sourcefile="Common.js" />
  13570. Namespace.register("U.MD.C");
  13571. /**
  13572. * 图片错误处理
  13573. *
  13574. * @param {element} 图片元素
  13575. * @param {number} 判断的类型
  13576. */
  13577. U.MD.C.imgError = function (imgel, type) {
  13578. var _number, //存放参数
  13579. _url; //存放图片的src
  13580. //获取出错的对象
  13581. imgel = imgel && !imgel.srcElement ? imgel : (event ? event.srcElement || this : this);
  13582. //如果是错误图片就不执行
  13583. if (imgel.src != "/img/error.png") {
  13584. if (type == 2) { //重复请求图片 用于初始上传的图片
  13585. _url = imgel.src; //图片的路径
  13586. _number = _url.indexOf("?&n="); //判断是否添加获取
  13587. //允许文件同时获取10次
  13588. if (_number < 0 || _url.length - _number < 10) {
  13589. imgel.src += (_number == -1 ? "?&n=" : "") + 1; //添加缓存过滤
  13590. return
  13591. }
  13592. else {
  13593. type = 1;
  13594. }
  13595. }
  13596. if (type == 1) { //错误图像处理
  13597. U.selectEl(imgel).addAttrArray({ "src": "/img/error.png" });
  13598. }
  13599. else { //错误头像处理
  13600. imgel.src = type || "/img/UserHead/UseHead.jpg";
  13601. }
  13602. }
  13603. }
  13604. /**
  13605. * 获取头像图片的正确地址
  13606. *
  13607. * @param {string} 需要生成正常地址的 由于1473的地址 需要带上 http://fs.1473.cn 无需 这里同时处理了 1473和外链地址
  13608. * @return {string} 过滤过的
  13609. */
  13610. U.MD.C.getHeadImage = function (url) {
  13611. return (!url ? "/img/UserHead/UseHead.jpg" : !url.indexOf("http") ? url : ((url.indexOf("www.1473.cn") > -1 ? url : US.FILESYSTEMURL + url.replace(new RegExp(US.FILESYSTEMURL, "gm"), ""))));
  13612. };
  13613. ///<jscompress sourcefile="DataCrossdomain.js" />
  13614. Namespace.register("U.MD.CD"); //完全跨域的解决方案
  13615. //是否加载完成
  13616. U.MD.CD.isLoad;
  13617. //跨域传输的数据
  13618. U.MD.CD.data;
  13619. //如果不是1473的域名访问的处理
  13620. if (!window.location.host.indexOf("www.1473.cn")) {
  13621. //错误处理,前端错误需要在控制台输出,同时提交到错误数据库
  13622. //window.onerror = function(sMessage,sUrl,sLine,columnNumber,errorObj){};
  13623. //onerror函数的五个参数用于确定错误确切的信息,代表的意思依次为:
  13624. //* @param {String} errorMessage errorMessage 错误信息
  13625. //* @param {String} scriptURI 出错的文件
  13626. //* @param {Long} lineNumber 出错代码的行号
  13627. //* @param {Long} columnNumber 出错代码的列号
  13628. //* @param {Object} errorObj 错误的详细信息,Anything
  13629. window.onerror = function (errorMessage, scripturi, linenumber, columnnumber, errorobj) {
  13630. errorobj = errorobj || {}; //屏蔽js错误
  13631. U.A.Request(US.USER, ["SetError", 0, (event.errorMessage || event || errorMessage), (scripturi || event.filename || event.errorUr) + "。行号:" + (linenumber || event.lineno || event.errorLine)], function () { }, []); //错误消息发送到数据库
  13632. U.UF.C.console(event.errorMessage || event || errorobj); //console 输出错误信息
  13633. return true; //不让浏览器弹出错误报告,浏览器会弹出一个comfirm的错误。
  13634. }
  13635. //加载所有的跨域
  13636. U.UF.CD.loadAjaxCrossDomain(function () {
  13637. U.MD.CD.isLoad = true; //设置跨域加载成功处理
  13638. U.MD.CD.load(); //加载成功后的处理
  13639. });
  13640. //跨域执行ajax处理 fun, issender, iframeid, url, id
  13641. U.MD.CD.me = new U.UF.EV.message(function (data, id, cookie) {
  13642. U.MD.CD.data = [data, id]; //跨域传输的数据
  13643. U.MD.CD.load(); //加载的处理
  13644. }, false, "domain");
  13645. //发送请求获取数据
  13646. U.MD.CD.load = function () {
  13647. //如果加载完,同时有传输数据的处理
  13648. if (U.MD.CD.isLoad && U.MD.CD.data) {
  13649. var _data = U.MD.CD.data[0], //传参的值
  13650. _url = _data[0], //需要请求的url
  13651. _params = _data[1]; //需要请求的参数
  13652. try {
  13653. //做www.1473.cn的用户安全的。以后再扩展
  13654. US.userInfo = US.userInfo.UserId ? US.userInfo : {
  13655. "LoginId": U.UF.Cookie.get("usestudiosso", "loginid")[0],
  13656. "UserId": U.UF.Cookie.get("usestudiosso", "userid")[0]
  13657. };
  13658. }
  13659. catch (e) { }
  13660. //当a.com要调用b.com的时候,把a.com的ajax转向到b.com中去访问。boomyun是用到这里的.
  13661. U.A.Request(_url, _params, function (r) {
  13662. var _cookie = U.UF.Cookie.get("usestudiosso");
  13663. //设置登录信息
  13664. if ("LoginByCookie,uploadUserinfo".indexOf(_params[0]) > -1 && r.value && r.value[0]) {
  13665. US.userInfo = r.value[0];
  13666. US.userInfo.LoginId = r.value[2];
  13667. }
  13668. //数据发送获取
  13669. U.MD.CD.me.post(r.value, U.MD.CD.data[1], "usestudiosso=" + (_cookie || ""));
  13670. });
  13671. }
  13672. }
  13673. }
  13674. ;
  13675. ///<jscompress sourcefile="PageCrossdomain.js" />
  13676. Namespace.register("U.MD.CD");
  13677. //ui页面跨域处理 data[0] = 1473删除的data数据 [1] = 1473传输过来的函数唯一识别id [2] = cookie
  13678. U.MD.CD.me = new U.UF.EV.message(function (data, id) {
  13679. //获取加载1473 index.aspx里面的内容
  13680. U.UF.CD.loadPageCrossDomain(function () {
  13681. //把数据发送到发送者页面
  13682. U.MD.CD.me.post(document.body.innerHTML, id, "usestudiosso=" + (U.UF.Cookie.get("usestudiosso") || ""));
  13683. });
  13684. }, false, "pagedomain");
  13685. ;
  13686. ///<jscompress sourcefile="Switch.js" />
  13687. //#region 切换效果区域
  13688. Namespace.register("U.UF.MR");
  13689. /**
  13690. * input搜索框变化
  13691. *
  13692. * @param {element} 变化的input元素
  13693. * @param {array} 变化的数组 实现数组 0 、 1 切换
  13694. -----------[0] 变化前的值 如 "请输入内容"
  13695. -----------[1] 变化后的值 如 ""
  13696. */
  13697. U.UF.MR.inputPlaceholder = function (el, str, changestr) {
  13698. if (typeof str == "string") {
  13699. str = { color: "#999", value: str };
  13700. }
  13701. if (typeof changestr == "string") {
  13702. changestr = { color: "#000", value: changestr };
  13703. }
  13704. //聚焦操作
  13705. if (str.value == "") {
  13706. //当前value为默认提醒内容
  13707. if (el.value == "") {
  13708. el.value = changestr.value;
  13709. el.style.color = str.color;
  13710. }
  13711. }
  13712. //失焦操作
  13713. if (changestr.value == "") {
  13714. el.style.color = changestr.color;
  13715. if (el.value == str.value) {
  13716. el.value = "";
  13717. }
  13718. }
  13719. }
  13720. //#endregion
  13721. ;
  13722. ///<jscompress sourcefile="Permission.js" />
  13723. US.permission = {}; //所有的权限列表
  13724. //网盘所有的权限
  13725. US.permission.disk = {
  13726. "isopen": true, //是否允许打开, 现在所有的文件都有打开权限
  13727. "isupadte": true, //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  13728. "isdelete": true, //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  13729. "iscopy": true, //是否允许复制,现在所有的文件都有复制权限
  13730. "isshear": true, //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  13731. "isencryption": false, //是否允许加密,展示取消这个功能。
  13732. "isreply": true, //是否允许加密,展示取消这个功能。
  13733. "isdownload": true, //是否允许下载,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  13734. "isnew": true, //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  13735. "ispaste": true, //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  13736. "isrefresh": true, //是否允许刷新, 现在所有的文件都有刷新权限
  13737. "isupload": true, //是否允许上传,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  13738. "isview": true, //是否允许视图切换,所有的文件夹都支持
  13739. "isedit": true //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  13740. };
  13741. //网盘权限获取方法
  13742. US.permission.getDiskPermission = function () {
  13743. var i, _obj = {}, _p = US.permission.disk;//定义变量i,返回值对象_obj,获取全局的初始权限对象
  13744. for (i in _p) {//定义循环,将全局权限对象克隆给_obj
  13745. _obj[i] = _p[i]
  13746. }
  13747. return _obj;//返回_obj对象
  13748. };
  13749. ///<jscompress sourcefile="Timer.js" />
  13750. Namespace.register("U.MD.C.T"); //桌面计时器命名空间
  13751. U.MD.C.T.timer = null; //计时器
  13752. /*
  13753. * 计时器使用
  13754. *
  13755. */
  13756. U.MD.C.T.onesetInterval = function () {
  13757. var _num = 0; //定义一个时间计数变量
  13758. clearInterval(U.MD.C.T.timer); //防止多次启动计时器,这里是清除可能的计时器
  13759. //初始化计时器处理
  13760. U.MD.C.T.timer = setInterval(function () {
  13761. var _userid = US.userInfo.UserId; //登录用户的id
  13762. if (!(_num % 60)) { //每一分钟计数清空,防止页面运行太久计数太大,导致超过了js最大数
  13763. _num = 0;
  13764. }
  13765. //执行每隔五秒与服务器通讯一次
  13766. if (_userid) { //已经登录用户获取聊天消息
  13767. U.MD.F.N.messageService(_userid); //执行与服务器通讯函数
  13768. }
  13769. }, 5000); //执行计时消息
  13770. };
  13771. ///<jscompress sourcefile="Upload.js" />
  13772. Namespace.register("U.MD.UI"); //Disk上传的命名空间
  13773. //#region 上传区域 Html5 Flash html
  13774. //整个控件的名字规范函数名字
  13775. /**
  13776. * 上传带界面的函数
  13777. * @param {string} url为服务器地址
  13778. * @param {function} 回调函数
  13779. * @param {function} 判断hash值回调函数
  13780. * 回调函数返回结果:url为服务器地址返回的值。
  13781. */
  13782. U.MD.UI.upload = function (url, cb, hashcallback) {
  13783. //如果有flash,则走flash。
  13784. var _str = U.UF.CI.isSupportFlash(); //得到客户端支持html还是flash的处理
  13785. //_str = "Flash";
  13786. //html5的处理和html的处理,如果html,不能断点续传,不能解析md5.
  13787. if (_str == "HTML5") {
  13788. U.MD.UI.upload.html5(url, cb, hashcallback);
  13789. }
  13790. //flash的处理
  13791. else if (_str == "Flash") {
  13792. U.MD.UI.upload.flash(url, cb, hashcallback);
  13793. }
  13794. //只能通过input上传的处理
  13795. else {
  13796. U.MD.UI.upload.input(url, cb, hashcallback);
  13797. }
  13798. }
  13799. //所有的上传框选择的文件处理
  13800. U.MD.UI.upload.uploadFileInfo = [];
  13801. /**
  13802. * HTML5上传
  13803. * @param {string} url为服务器地址
  13804. * @param {function} 回调函数
  13805. * @param {function} 判断hash值回调函数
  13806. * 回调函数返回结果:url为服务器地址返回的值。
  13807. */
  13808. U.MD.UI.upload.html5 = function (url, cb, hashcallback) {
  13809. //如果是html5,走html5
  13810. U.MD.UI.create(); //创建传出上传框
  13811. var _clickuploadel = U.selectEl("#U_MD_UI_UP_DRT")[0]; //获取上传按钮的处理
  13812. _clickuploadel.innerText = "";
  13813. //创建一个input file
  13814. $$("input", {
  13815. "multiple": "true", "type": "file", "accept": "*/*", "onchange": function () {
  13816. U.MD.UI.inputSelect({
  13817. //错误处理
  13818. error: function (r) {
  13819. console.log("上传错误:" + r);
  13820. },
  13821. //获取hash回调
  13822. getHashCallBack: function (filehash, fileinfo, callback) {
  13823. //判断获取hash
  13824. hashcallback(filehash, fileinfo, function (isupload) {
  13825. //判断是否上传的处理
  13826. if (isupload) { //如果md5匹配后还是要求上传,那么这里就处理上传
  13827. //判断数据库是否有该文件hash值 回调参数(文件服务器名,服务器文件大小)
  13828. U.UF.UP.html5Upload.select(fileinfo, filehash, function (fileservername, filesize) {
  13829. //上传处理
  13830. U.UF.UP.html5Upload.loop(fileinfo, filehash, fileservername, filesize, function (value) {
  13831. //上传成功的处理
  13832. if (value == true) {
  13833. callback.getData(filehash, fileservername, fileinfo); //得到返回值处理
  13834. var _nextuploadfile = U.MD.UI.delUploadFile(fileinfo.fileel, fileinfo); //删除上传成功后的文件,得到下一个需要上传的文件
  13835. // 如果有下一个文件要上传的处理
  13836. if (_nextuploadfile) {
  13837. U.MD.UI.inputUpload(_nextuploadfile, callback);
  13838. }
  13839. }
  13840. //上传中的处理
  13841. else {
  13842. callback.progress(value, fileinfo.fileid, "上传中"); //生成进度条
  13843. }
  13844. });
  13845. });
  13846. }
  13847. else {
  13848. var _nextuploadfile = U.MD.UI.delUploadFile(fileinfo.fileel, fileinfo); //删除上传成功后的文件,得到下一个需要上传的文件
  13849. // 如果有下一个文件要上传的处理
  13850. if (_nextuploadfile) {
  13851. U.MD.UI.inputUpload(_nextuploadfile, callback);
  13852. }
  13853. }
  13854. });
  13855. },
  13856. //获取进度条
  13857. progress: U.MD.UI.progress, //上传文件的进度条处理
  13858. //得到服务器返回值的处理
  13859. getData: function (filehash, fileservername, file) {
  13860. var _type = file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length), //获取文件后缀名
  13861. _thumbnailname = 'gif|jpg|jpeg|png'.indexOf(_type.toLowerCase()) > -1 ? (Guid.newGuid() + "." + _type) : null; //判断是否为图片
  13862. //如果是图片则创建缩略图
  13863. if (_thumbnailname) {
  13864. U.A.Request(US.DISK, ['CreateThumbnail', fileservername, _thumbnailname], function (r) { });
  13865. }
  13866. //添加文件到数据库
  13867. U.A.Request(US.CD, [US.DB, 'UseStudio_Disk', 'CreateUploadFile', U.UF.C.queryString("UserId", url), file.fileid, U.UF.C.queryString("DirectoryId", url), file.name, fileservername, _thumbnailname, filehash, file.size, 1, file.name, _type, U.UF.C.queryString("Encrypt", url)],
  13868. function (request) {
  13869. cb({ data: [fileservername, fileservername, file.fileid, file.size, U.UF.C.queryString("Encrypt", url), U.UF.C.queryString("DirectoryId", url)] }, file);
  13870. });
  13871. }
  13872. });
  13873. this.value = "";
  13874. }, "style": { "cssText": "display: block; position: relative; width: 100%; height: 100%; cursor: pointer; border: 0; color: #666; background: #eee; -moz-user-select: -moz-none; -webkit-user-select: none; opacity: 0; filter: alpha(opacity=0); -moz-opacity: 0;" }
  13875. }, _clickuploadel);
  13876. }
  13877. /**
  13878. * Flash上传
  13879. * @param {string} url为服务器地址
  13880. * @param {function} 回调函数
  13881. * @param {function} 判断hash值回调函数
  13882. * 回调函数返回结果:url为服务器地址返回的值。
  13883. */
  13884. U.MD.UI.upload.flash = function (url, cb, hashcallback) {
  13885. U.MD.UI.create(); //创建传出上传框
  13886. var _url = url,
  13887. _cb = cb,
  13888. _hashcallback = hashcallback,
  13889. _clickuploadel = U.selectEl("#U_MD_UI_UP_DRT")[0]; //获取上传按钮的处理
  13890. _clickuploadel.innerText = "";
  13891. //添加flash按钮
  13892. U.UF.UP.addFlashUploadBottom(_clickuploadel, "flashupload", { "width": _clickuploadel.clientWidth, "height": _clickuploadel.offsetHeight }, {
  13893. error: U.MD.UI.flashError, //错误处理回调函数
  13894. /**
  13895. * 选择文件回调函数
  13896. * @param {array} filesinfo
  13897. */
  13898. select: function (filesinfo) {
  13899. U.MD.UI.flashSelect(filesinfo, _url, U.UF.C.isFunction(_hashcallback)); //选择文件的处理
  13900. },
  13901. /**
  13902. * 上传文件获取文件流后的处理
  13903. * @param {string} 文件的md5值
  13904. * @param {string} 需要上传的文件的唯一识别id
  13905. */
  13906. getHashCallBack: function (md5, fileid) {
  13907. var _fileinfo = U.MD.UI.getFileInfoById(fileid)[0];
  13908. //判断获取hash
  13909. _hashcallback(md5, _fileinfo, function (isupload) {
  13910. //判断是否上传的处理
  13911. if (isupload) { //如果md5匹配后还是要求上传,那么这里就处理上传
  13912. //直接执行文件的上传处理
  13913. U.UF.UP.flashUpload($("*flashupload")[0], fileid, _url);
  13914. }
  13915. else { //否则执行下一个上传的处理
  13916. U.MD.UI.flashContinueUpload(fileid, _url, U.UF.C.isFunction(_hashcallback));
  13917. }
  13918. });
  13919. },
  13920. progress: U.MD.UI.progress, //上传文件的进度条处理
  13921. uploadComplete: U.MD.UI.flashUploadComplete, //单个文件上传成功的回调函数
  13922. //单个文件上传成功后,得到服务器的响应值处理,和CP不一样的是这里是得到了返回值,上面的只是文件已经传输到服务器了。
  13923. /**
  13924. * 上传文件成功返回上传文件值
  13925. * @param {object} 获取服务器返回值
  13926. * @param {string} 上传文件的唯一识别id
  13927. */
  13928. getData: function (r, fileid) {
  13929. if (U.UF.C.isFunction(_cb)) {
  13930. _cb(r, U.MD.UI.getFileInfoById(fileid)[0]);
  13931. }
  13932. //否则执行下一个上传的处理
  13933. U.MD.UI.flashContinueUpload(fileid, _url, U.UF.C.isFunction(_hashcallback));
  13934. },
  13935. endUpload: U.MD.UI.deleteUploadAllFile //结束上传后释放资源
  13936. }, "*");
  13937. }
  13938. /**
  13939. * input上传
  13940. * @param {string} url为服务器地址
  13941. * @param {function} 回调函数
  13942. * @param {function} 判断hash值回调函数
  13943. * 回调函数返回结果:url为服务器地址返回的值。
  13944. */
  13945. U.MD.UI.upload.input = function (url, cb, hashcallback) {
  13946. U.MD.UI.create(); //创建传出上传框
  13947. var _clickuploadel = U.selectEl("#U_MD_UI_UP_DRT")[0]; //获取上传按钮的处理
  13948. _clickuploadel.innerText = "";
  13949. //创建一个input file
  13950. $$("input", {
  13951. "multiple": "true", "type": "file", "accept": "*/*", "onchange": U.MD.UI.inputSelect,
  13952. "style": { "cssText": "display: block; position: relative; width: 100%; height: 100%; cursor: pointer; border: 0; color: #666; background: #eee; -moz-user-select: -moz-none; -webkit-user-select: none; opacity: 0; filter: alpha(opacity=0); -moz-opacity: 0;" }
  13953. }, _clickuploadel);
  13954. }
  13955. /**
  13956. * 初始化创建上传弹框
  13957. */
  13958. U.MD.UI.create = function () {
  13959. var _flashtop = U.selectEl("#U_MD_UI_UP_O")[0];
  13960. if (_flashtop) {
  13961. U.UF.F.windowTopCenter(_flashtop); //居中弹出
  13962. }
  13963. else {
  13964. var _uploadel,
  13965. _topel,
  13966. _titleel,
  13967. _bottom,
  13968. _switchel;
  13969. _uploadel = $$("div", { "id": "U_MD_UI_UP", "className": "U_MD_UI_UP" });
  13970. _topel = $$("div", { "className": "U_MD_UI_UP_O" }, _uploadel);
  13971. //头部
  13972. _titleel = $$("div", { "className": "U_MD_UI_UP_T" }, _topel);
  13973. $$("div", { "className": "U_MD_UI_UP_TO", "innerHTML": "普通上传" }, _titleel);
  13974. $$("div", { "className": "U_MD_UI_UP_Z", "innerHTML": "提示声明: 严谨上传包括反动、暴力、色情、违法及侵权内容的文件;严格遵守保密法律法规,任何危害用户或犯法的行为,都必须受到法律追究。" }, _topel);
  13975. //文件上传区域
  13976. $$("div", { "id": "U_MD_UI_UP_C", "className": "U_MD_UI_UP_C" }, _topel);
  13977. //底部
  13978. _bottom = $$("div", { "className": "U_MD_UI_UP_D" }, _topel);
  13979. _switchel = $$("div", { "className": "U_MD_UI_UP_DR" }, _bottom);
  13980. $$("div", { "className": "U_MD_UI_UP_DRO", "innerHTML": "点击上传" }, _switchel);
  13981. $$("div", { "className": "U_MD_UI_UP_DRO U_MD_UI_UP_DRT", "id": "U_MD_UI_UP_DRT" }, _switchel);
  13982. //弹出上传框
  13983. return new U.UF.UI.form("<div class='U_MD_F_S_TI'>上传</div>", _uploadel, {
  13984. "id": "U_MD_UI_UP_O",
  13985. "style": { "width": "700px", "height": "560px" }
  13986. }, { isnarrow: false, isenlarge: false }).form;
  13987. }
  13988. }
  13989. /**
  13990. * 获取上传文件所在的位置
  13991. * @param {string} 上传文件的id
  13992. * @return {array} 上传文件的位置及信息
  13993. * 0 找到上传文件的信息
  13994. * 1 上传文件在一个flashfiles的位置
  13995. * 2 上传文件在多个flashfiles中其中一个flashfiles的位置
  13996. */
  13997. U.MD.UI.getFileInfoById = function (fileid) {
  13998. var i, j,
  13999. _allfiles = U.MD.UI.upload.uploadFileInfo; //用户需要上传的所有文件
  14000. for (i = 0; i < _allfiles.length; i++) {
  14001. j = _allfiles[i].objIndexOf({ "fileid": fileid }); //根据fileid在_allfiles[i]数组的查找获取fileid = fileid的上传文件信息
  14002. //找到该上传文件
  14003. if (j > -1) {
  14004. /*
  14005. * 0 找到上传文件的信息
  14006. * 1 上传文件在一个flashfiles的位置
  14007. * 2 上传文件在多个flashfiles中其中一个flashfiles的位置
  14008. */
  14009. return [_allfiles[i][j], j, i];
  14010. }
  14011. }
  14012. return [null, -1, -1]; //返回未找到的信息
  14013. }
  14014. //#endregion
  14015. //#region html5- input上传
  14016. U.MD.UI.inputSelect = function () {
  14017. }
  14018. //#endregion
  14019. //#region html5 input上传处理
  14020. /**
  14021. * 生成上传的点击框
  14022. * @param event 当input内容改变时触发函数
  14023. */
  14024. U.MD.UI.inputSelect = function (callback) {
  14025. //获取input控件
  14026. var event = window.event || arguments.callee.caller.arguments[0];
  14027. var _fileinfo,
  14028. _fileinfos = [],
  14029. _files = event.target.files; //所有上传的文件
  14030. //遍历input的文件
  14031. for (var i = 0; i < _files.length; i++) {
  14032. _fileinfos.push(_files[i]); //加入待上传文件信息
  14033. }
  14034. U.MD.UI.upload.uploadFileInfo.push(_fileinfos); //添加上传的处理
  14035. U.MD.UI.printUploadFiles(_fileinfos); //生成前台UI
  14036. U.MD.UI.inputUpload(_fileinfos[0], callback); //调用上传
  14037. }
  14038. /*
  14039. 生成文件信息
  14040. * @param {file} file文件
  14041. */
  14042. //U.MD.UI.inputFileInfo = function (input) {
  14043. // var _return = {
  14044. // "creationDate": input.lastModifiedDate,
  14045. // "creator": null,
  14046. // "data": null,
  14047. // "modificationData": input.lastModifiedDate,
  14048. // "name": input.name,
  14049. // "size": input.size,
  14050. // "type": U.UF.UP.getFileNameAndExtension(input.name)[1]
  14051. // }
  14052. // return _return;
  14053. //}
  14054. /**
  14055. * input上传处理的全过程
  14056. * @param event 当input内容改变时触发函数
  14057. */
  14058. U.MD.UI.inputUpload = function (file, callback) {
  14059. file.isupload = true; //设置上传状态为true
  14060. //进行文件加密 回调参数(进度,完成,文件hash)
  14061. U.UF.UP.html5Upload.fileMd5(file, function (progress, finish, filehash) {
  14062. //发生错误的处理
  14063. if (!progress) {
  14064. //错误处理
  14065. if (U.UF.C.isFunction(callback.error)) {
  14066. callback.error(finish);
  14067. }
  14068. }
  14069. //判断是否解析完成
  14070. else if (finish) {
  14071. callback.progress({ "Loaded": 1, "Total": 1 }, file.fileid, ""); //生成进度条
  14072. //获取hash后的回调处理
  14073. if (U.UF.C.isFunction(callback.getHashCallBack)) {
  14074. callback.getHashCallBack(filehash, file, callback);
  14075. }
  14076. }
  14077. //未解析完毕进度条处理
  14078. else {
  14079. if (U.UF.C.isFunction(callback.progress)) {
  14080. callback.progress(progress, file.fileid, "解析中"); //生成进度条
  14081. }
  14082. }
  14083. });
  14084. }
  14085. //#endregion
  14086. //#region flash上传处理的过程
  14087. /**
  14088. * 上传框用户选择完文件的处理
  14089. * @param {array} 需要加载上传框的元素
  14090. */
  14091. U.MD.UI.flashSelect = function (uploadfiles, url, isgethash) {
  14092. U.MD.UI.printUploadFiles(uploadfiles, true); //打印上传的内容
  14093. U.MD.UI.upload.uploadFileInfo.push(uploadfiles); //添加上传的信息处理
  14094. U.MD.UI.flashUpload(uploadfiles[0], url, isgethash); //上传处理
  14095. }
  14096. /**
  14097. * 上传的处理,如果有处理hash的那么就调用hash的回调
  14098. * @param {array} 需要加载上传框的元素
  14099. */
  14100. U.MD.UI.flashUpload = function (uploadfile, url, isgethash) {
  14101. var _flashbottom = U.selectEl("*flashupload")[0], //上传按钮
  14102. _fileid = uploadfile.fileid //上传文件的唯一识别id
  14103. ;
  14104. uploadfile.isupload = true; //设置上传状态为true
  14105. //如果需要处理获取hash值的处理
  14106. if (isgethash) {
  14107. //上传前,先得到hash的值,进行判断是否文件已经存在
  14108. U.UF.UP.generateFileHash($("*flashupload")[0], _fileid); //获取hash
  14109. }
  14110. //文件直接上传的处理
  14111. else {
  14112. //直接执行文件的上传处理
  14113. U.UF.UP.flashUpload(_flashbottom, _fileid, url);
  14114. }
  14115. }
  14116. /**
  14117. * 文件单个上传完毕
  14118. * @param {string} 上传文件的唯一识别id
  14119. */
  14120. U.MD.UI.flashUploadComplete = function (fileid) {
  14121. // U.alert("传输完成,等待返回。");
  14122. }
  14123. /**
  14124. * 所有文件上传完的处理
  14125. */
  14126. U.UF.UP.deleteUploadAllFile = function () {
  14127. }
  14128. /**
  14129. * 清空上传框处理
  14130. */
  14131. U.MD.UI.flashEmptyUpload = function (el) {
  14132. var _flashbottom = U.selectEl("*flashupload")[0];
  14133. if (_flashbottom) {
  14134. U.UF.UP.deleteUploadAllFile(_flashbottom); //清理flash上传的资源
  14135. }
  14136. }
  14137. /**
  14138. * 获取上传文件所在的位置
  14139. * @param {object} 错误消息
  14140. * @return {array} 上传文件的位置及信息
  14141. * 0 上传文件在一个flashfiles的位置
  14142. * 1 上传文件在多个flashfiles中其中一个flashfiles的位置
  14143. * 2 找到上传文件的信息
  14144. */
  14145. U.MD.UI.flashError = function (errorinfo) {
  14146. if (errorinfo.message) { //有错误消息
  14147. var _meeage = "上传处理失败:" + errorinfo.message; //上传错误信息
  14148. if (UE.errorID == 1502) { //当错误编码是1502时候我们弹出用户可理解的错误
  14149. _meeage = "文件太大,电脑内存不足";
  14150. }
  14151. U.alert(_meeage); //弹出错误
  14152. U.UF.C.console(errorinfo); //控制台输出错误
  14153. }
  14154. }
  14155. //#endregion
  14156. //#region 统一处理
  14157. /**
  14158. * 打印上传的信息
  14159. * @param {array} 上传的文件数组
  14160. */
  14161. U.MD.UI.printUploadFiles = function (uploadfiles, isflash) {
  14162. var _type,
  14163. _info,
  14164. _uploaddiv,
  14165. _panel,
  14166. _panel_one,
  14167. _progressel,
  14168. _uploadcontent = U.selectEl("#U_MD_UI_UP_C"),
  14169. _frag = $$("frag");
  14170. //循环打印上传的文件信息
  14171. for (i = 0; i < uploadfiles.length; i++) {
  14172. uploadfiles[i].fileid = Guid.newGuid(); //设置上传文件的id
  14173. _type = U.UF.UP.getFileNameAndExtension(uploadfiles[i]["name"])[1]; //获取上传文件的后缀
  14174. //创建上传文件的信息
  14175. _uploaddiv = $$("div", { "className": "U_MD_UI_UP_CO" }, _frag);
  14176. _panel = $$("div", { "className": "U_MD_UI_UP_COO" }, _uploaddiv);
  14177. _panel_one = $$("div", { "className": "U_MD_UI_UP_COI U_Img ", "style": { "cssText": "background-position:-12px 1px" } }, _panel);
  14178. $$("div", { "className": "U_MD_UI_UP_COION", "innerHTML": _type }, _panel_one);
  14179. _panel_one = $$("div", { "className": "U_MD_UI_UP_COT" }, _panel);
  14180. $$("div", { "className": "U_MD_UI_UP_COTS U_MD_D_Text_Abbreviation", "innerHTML": uploadfiles[i].name }, _panel_one);
  14181. $$("div", { "className": "U_MD_UI_UP_COTX", "innerHTML": "容量大小:" + U.UF.UP.minUnitToMaxUnit(uploadfiles[i]["size"]) }, _panel);
  14182. _panel_one = $$("div", { "className": "U_MD_UI_UP_COS U_MD_D_Text_Abbreviation" }, _panel);
  14183. $$("div", { "className": "U_MD_UI_UP_COSN", "innerHTML": "准备上传" }, _panel_one);
  14184. $$("div", { "className": "U_MD_UI_UP_COSI U_Img" }, _panel_one);
  14185. _panel_one = $$("div", { "className": "U_MD_UI_UP_COC U_MD_UI_UP_COX", "title": "等待响应..." }, _panel_one);
  14186. $$("img", { "onerror": U.MD.C.imgError, "src": US.DOMAIN + "img/ULG.gif" }, _panel_one);
  14187. $$("div", {
  14188. "className": "U_MD_UI_UP_COX", "titlle": "点击撤销删除上传", "innerHTML": "撤销",
  14189. "onclick": function () {
  14190. U.MD.UI.delUploadFile(_uploaddiv, uploadfiles[0], isflash); // 移除当前上传元素,排队向下上传处理
  14191. }
  14192. }, _panel);
  14193. _progressel = $$("div", { "className": "U_MD_UI_UP_COU" }, _uploaddiv);
  14194. uploadfiles[i].fileel = _uploaddiv; //记录上传元素的框
  14195. uploadfiles[i].progressel = _progressel; //进度条元素
  14196. }
  14197. //添加上传的文件信息在中间上传区域
  14198. _uploadcontent.append(_frag);
  14199. }
  14200. /**
  14201. * 移除当前上传元素,排队向下上传处理
  14202. * @param {element} 需要移除的元素
  14203. * @param {object} 上传文件的信息
  14204. */
  14205. U.MD.UI.delUploadFile = function (uploadel, uploadfile, isflash) {
  14206. var i, j,
  14207. _allfiles = U.MD.UI.upload.uploadFileInfo,
  14208. _fileinfo = U.MD.UI.getFileInfoById(uploadfile.fileid), //根据文件的id获取在U.MD.UI.FTF["FL"]中的位置及在U.MD.UI.FTF["FL"][i]中的位置
  14209. _allfilesnum = _fileinfo[2], //文件在U.MD.UI.FTF["FL"]中的位置
  14210. _filesnum = _fileinfo[1]; //文件在U.MD.UI.FTF["FL"][i]中的位置
  14211. U.selectEl(uploadel).remove(); //上传成功后删除上传的元素
  14212. if (_filesnum != -1) { //实体存在
  14213. //移除一个上传文件
  14214. _allfiles[_allfilesnum].splice(_filesnum, 1)[0];
  14215. //如果在移除的文件是该多个flash上传中的其中一个的最后一个上传,那么直接删除上传数组
  14216. if (!_allfiles[_allfilesnum].length) {
  14217. _allfiles.splice(_allfilesnum, 1);
  14218. }
  14219. //flash清楚上传处理
  14220. if (isflash) {
  14221. U.UF.UP.deleteUploadFile($("*flashupload")[0], _filesnum, _allfilesnum); //flash中删除上传。
  14222. }
  14223. //html5清除上传处理
  14224. else {
  14225. U.UF.UP.html5Upload.deleteUploadFile(uploadfile);
  14226. }
  14227. //判断上传文件的上传状态,如果是正在上传的文件删除,那么需要向下执行上传文件
  14228. if (uploadfile.isupload) {
  14229. //如果还有文件需要上传
  14230. if (_allfiles.length) {
  14231. //利用排队的方式执行文件上传
  14232. for (i = 0; i < _allfiles.length; i++) { //从所有的上传文件数组里排队
  14233. for (j = 0; j < _allfiles[i].length; j++) { //在fileslist中排队筛选
  14234. if (!_allfiles[i][j].isupload) { //如果该文件的状态没有在上传中,那么就直接上传
  14235. return _allfiles[i][j];
  14236. }
  14237. }
  14238. }
  14239. }
  14240. else {
  14241. //flash清理上传处理
  14242. if (isflash) {
  14243. U.MD.UI.flashEmptyUpload(); //清空上传框
  14244. }
  14245. else {
  14246. U.UF.UP.html5Upload.deleteUploadAllFile();
  14247. }
  14248. }
  14249. }
  14250. }
  14251. }
  14252. /**
  14253. * 上传文件进度条处理
  14254. * @param {object} 进度条的值 Loaded 现在的进度 Total 中进度
  14255. * @param {object} 上传文件的唯一识别id
  14256. * @param {object} 用md5去判断上传的文件是否需要上传
  14257. */
  14258. U.MD.UI.progress = function (progress, fileid, msg) {
  14259. var _fileinfo = U.MD.UI.getFileInfoById(fileid)[0], //根据上传文件唯一识别的id获取上传文件的信息
  14260. _progresschilds = U.selectEl($(_fileinfo.fileel).childs(0).childs(0)[3]).Child(), //获取上传文件进度条元素
  14261. _progress = Math.floor((progress.Loaded / progress.Total) * 100); //获取进度的百分比
  14262. _fileinfo.progressel.style.width = _progress + "%"; //上传的进度样式
  14263. _progresschilds[0].innerText = msg; //上传信息提醒,包括准备上传、正在解析、上传中
  14264. _progresschilds[1].style.display = "none"; //上传成功后的
  14265. _progresschilds[2].style.display = "block"; //loading
  14266. }
  14267. /**
  14268. * 接续上传的处理
  14269. * @param {string} 上传文件的唯一识别id
  14270. */
  14271. U.MD.UI.flashContinueUpload = function (fileid, url, isgethash) {
  14272. var _fileinfo = U.MD.UI.getFileInfoById(fileid)[0], //获取上传完的文件
  14273. _nextuploadfile = U.MD.UI.delUploadFile(_fileinfo.fileel, _fileinfo, true); //删除上传成功后的文件,得到下一个需要上传的文件
  14274. // 如果有下一个文件要上传的处理
  14275. if (_nextuploadfile) {
  14276. U.MD.UI.flashUpload(_nextuploadfile, url, isgethash); //调用上传,如果有hash的获取这里支持自动获取hash
  14277. }
  14278. }
  14279. //#endregion;
  14280. ///<jscompress sourcefile="Url.js" />
  14281. /*用户使用www.1473.cn时,我们需要设置成: /#!/word/guid
  14282. 用于推广运营时的链接如下:
  14283. 电脑端
  14284. word可编辑模式跳转 /word/guid。。
  14285. word不可编辑模式 http://guid.1473.cn 或者短域名访问 http://123.1473.cn
  14286. file的访问模式 /disk/guid
  14287. 手机端
  14288. word可编辑模式跳转: http://m.1473.cn/word/guid
  14289. */
  14290. Namespace.register("U.MD.N"); //Url执行区域
  14291. /**
  14292. * url指引函数
  14293. * 此函数需要修改。。参数urlinfo的类型需要固定。
  14294. */
  14295. U.MD.N.urlGuide = function () {
  14296. var _hash = U.UF.C.getUrlHash(), //获取传参
  14297. _type; //类型
  14298. //如果链接类型是 /#!/disk/13928417148/f6d7a4b6-e34c-4964-beed-24187b2cb1ba 的处理
  14299. if (_hash[0] == "#!") {
  14300. _hash.shift()
  14301. }
  14302. //链接类型是 /#disk/13928417148/f6d7a4b6-e34c-4964-beed-24187b2cb1ba 的处理
  14303. else {
  14304. _hash[0] = _hash[0].substr(1);
  14305. }
  14306. _type = _hash[0];
  14307. switch (_type) {
  14308. case "disk":
  14309. //打开网盘的处理
  14310. U.MD.D.I.openApplication(_type, { "userid": _hash[1], "directoryid": _hash[2] });
  14311. break;
  14312. case "file":
  14313. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", _hash[1]]), function (r) {
  14314. var _fileinfo = r.value[0];
  14315. _fileinfo = new U.MD.DK.M.entity(_fileinfo.UserFilesID, _fileinfo.UserFilesSize, _fileinfo.UserDirectoryID, _fileinfo.UserFilesName, _fileinfo.UserFilesName, //创建US.disk.Disks里面的内容的数据结构
  14316. _fileinfo.UserFilesExtendName, _fileinfo.UserFilesServerName, _fileinfo.UserFilesAddTime, null, 999, _fileinfo.UserFilesModifyTime, _fileinfo.UserDirectoryEncrypt,
  14317. 1, _fileinfo.UserFilesExtendName, _fileinfo.GroupID, _fileinfo.UsOffice, _fileinfo.UserID, US.userInfo.UserNikeName, _fileinfo.UserName, _fileinfo.UserThumbnailImageHead);
  14318. U.MD.DK.LE.openFileDirectory(_fileinfo);
  14319. });
  14320. break;
  14321. case "excel":
  14322. if (_hash[1] == 'join') { //如果地址栏有join进入加群流程
  14323. U.MD.N.joinGuide(_hash, _type);
  14324. }
  14325. else if (_hash[1].length == 36) { //正常调用
  14326. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", _hash[1]]), function (r) {
  14327. if (r.value[0]) {
  14328. //拼接word
  14329. var _fileinfo = {
  14330. UserDirectoryExtendType: r.value[0].UserFilesExtendName,
  14331. UsOffice: r.value[0].UsOffice ? r.value[0].UsOffice.unEscapeQuotes() : null,
  14332. UserId: r.value[0].UserID,
  14333. UserallDirectoryName: r.value[0].UserFilesName,
  14334. UserDirectoryID: r.value[0].UserFilesID,
  14335. GroupID: r.value[0].UserDirectoryEncrypt
  14336. };
  14337. //获取word内容
  14338. if (r.value && r.value.UsOffice !== undefined && r.value.UsOffice != null) {
  14339. U.MD.D.I.openApplication(_type, _fileinfo);
  14340. }
  14341. }
  14342. });
  14343. }
  14344. break
  14345. case "word":
  14346. if (_hash[1] == 'join') { //如果地址栏有join进入加群流程
  14347. U.MD.N.joinGuide(_hash, _type);
  14348. }
  14349. else if (_hash[1].length == 36) { //正常调用
  14350. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", _hash[1]]), function (r) {
  14351. if (r.value[0]) {
  14352. r = r.value[0];
  14353. //拼接word
  14354. var _fileinfo = {
  14355. UserFilesServerName: r.UserFilesServerName,
  14356. UserDirectoryExtendType: r.UserFilesExtendName,
  14357. UsOffice: r.UsOffice ? r.UsOffice.unEscapeQuotes() : null,
  14358. UserId: r.UserID,
  14359. UserallDirectoryName: r.UserFilesName,
  14360. UserDirectoryID: r.UserFilesID,
  14361. GroupID: r.UserDirectoryEncrypt
  14362. };
  14363. //获取word内容
  14364. if (r && r.UsOffice !== undefined && r.UsOffice != null) {
  14365. U.MD.D.I.openApplication(_type, _fileinfo);
  14366. }
  14367. //如果内容不存在则去office系统中获取
  14368. else {
  14369. U.A.Request("http://office.1473.cn/Officetohtml.ashx", ["Open", _fileinfo.UserDirectoryExtendType, _fileinfo.UserFilesServerName], function (r) {
  14370. if (r.value.value != undefined) {
  14371. r = r.value;
  14372. _fileinfo.UsOffice = r.value.getBodyHtml().replace(/src=[\'\"]?([^\'\"]*)[\'\"]?/ig, function (str1, str2) {
  14373. return "src=\"http://office.1473.cn/usoffice/" + str2 + "\"";
  14374. });
  14375. U.MD.D.I.openApplication(_type, _fileinfo);
  14376. } else {
  14377. U.Alert('文档已丢失。。。');
  14378. }
  14379. });
  14380. }
  14381. }
  14382. });
  14383. }
  14384. break;
  14385. case "boomYun": case "txt": case "friend": case "lookupfriend": case "set": case "systemset":
  14386. U.MD.D.I.openApplication(_type, { "directoryid": _hash[1] });
  14387. if (_hash[1] == "template") {
  14388. //打开模板函数
  14389. if (_hash[2] != "undefined") {
  14390. U.Boom.I.GetHomeTemp.particulars(_hash[2]);
  14391. U.MD.N.urlWrite("boomYun/template/" + _hash[2], "互联办公"); //boomyun的url重写
  14392. }
  14393. }
  14394. break;
  14395. default: break;
  14396. }
  14397. }
  14398. /**
  14399. * 分享邀请链接加入群组
  14400. * @param {hash} hash值
  14401. * @param {type} 文件类型
  14402. */
  14403. U.MD.N.joinGuide = function (hash, type) {
  14404. var _fileId = hash[2]; //获取文件id
  14405. U.MD.U.L.setLoginCallBack(function () { //当用户登录后
  14406. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", _fileId]), function (r) { //获取文档对的信息
  14407. var _docinfo = r.value[0]; //文档信息
  14408. if (!_docinfo) { //是否有文档信息
  14409. return U.Alert('添加协同链接有误,请联系群主获取最新协同链接。。。');
  14410. }
  14411. if (US.friend.group) { //判断是否有群
  14412. var _groupId = _docinfo.UserDirectoryEncrypt || _docinfo.UserDirectoryID, //获取群id
  14413. _groupinfo = U.Json.select(US.friend.group, { "GroupManageID": _groupId })[0], //判断用户是否加入了群
  14414. _docId = _docinfo.UserFilesID; //文档ID
  14415. if (!_groupinfo) { //如果没有加群
  14416. U.A.Request(US.CD, ([US.DB, "UseStudio_Friends", "GetGroupInfo", _groupId]), function (r) { //取数据库获取群的信息
  14417. U.MD.F.J.selectUserInfo.NeedUser = [US.userInfo]; //得到个人信息名并赋值NeeUser全局
  14418. US.friend.group.push(r.value[0]); //添加到用户的群
  14419. top.U.MD.F.J.determineCreateGroupAndAddGroupUser(r.value[0].GroupManageID, null, null, false, "", "", function (groupid, groupdata) { //添加群
  14420. U.Json.del(groupdata[0], { UserId: US.userInfo.UserId });
  14421. US.friend.groupusers.push.apply(US.friend.groupusers, groupdata[0]);
  14422. // US.disk.Disks[US.userInfo.UserId].directoryOrFiles.push.apply(US.disk.Disks[US.userInfo.UserId].directoryOrFiles, _groupuserinfo);
  14423. U.MD.D.I.openApplication(type, U.Json.select(groupdata[1], { UserDirectoryID: _docId })[0], function (contentwindow) { contentwindow.U.MD.O.W.Panel.addUser(US.userInfo.UserId); }); //打开应用
  14424. });
  14425. }); //获取群资料
  14426. } else { //加入了群
  14427. var _docdiskinfo = new U.MD.DK.M.entity(_docinfo.UserFilesID, _docinfo.UserFilesSize, _docinfo.UserDirectoryID, _docinfo.UserFilesName, _docinfo.UserFilesName, //创建US.disk.Disks里面的内容的数据结构
  14428. _docinfo.UserFilesExtendName, _docinfo.UserFilesServerName, _docinfo.UserFilesAddTime, null, 999, _docinfo.UserFilesModifyTime, _docinfo.UserDirectoryEncrypt,
  14429. 0, _docinfo.UserFilesExtendName, _groupId, _docinfo.UsOffice, _docinfo.UserID, US.userInfo.UserNikeName, _docinfo.UserName, _docinfo.UserThumbnailImageHead);
  14430. U.Alert("你已经在该文档的群里了!");
  14431. U.MD.D.I.openApplication(type, _docdiskinfo); //打开应用
  14432. }
  14433. }
  14434. })
  14435. });
  14436. }
  14437. //添加页面导航
  14438. /*
  14439. * @param {string} hash值
  14440. * @param {string} document.title变化
  14441. */
  14442. U.MD.N.urlWrite = function (hash, title) {
  14443. setTimeout(function () {
  14444. U.UF.N.addHash(hash); //添加hash的处理
  14445. document.title = title; //title的处理
  14446. }, 0);
  14447. }
  14448. //seo模块.现有访问网址。/
  14449. //论坛
  14450. // 目录: /#!/pb/afa8621d-de5a-44db-8338-7d36168e7446
  14451. // 文章:外网:/#!/pbt/e80c57a0-1c82-4f43-931d-b7c8fab982a8
  14452. //硬盘
  14453. // 目录: /#!/disk/13928417148/f6d7a4b6-e34c-4964-beed-24187b2cb1ba
  14454. // txt文件:/#!/txt/63e6b0c9-aa72-1ef5-a9c0-a9d19b2b4c39
  14455. // word文件:/#!/word/efb4be75-696b-27fe-f125-25eff5d2716f
  14456. // img文件:/#!/img/efb4be75-696b-27fe-f125-25eff5d2716f
  14457. //现有word直接查看形式。
  14458. //http://disk.1473.cn/efb4be75-696b-27fe-f125-25eff5d2716f/Word
  14459. //http://disk.1473.cn/efb4be75-696b-27fe-f125-25eff5d2716f/Txt
  14460. //http://disk.1473.cn/efb4be75-696b-27fe-f125-25eff5d2716f/Excel
  14461. //从这些网址派生短链接。
  14462. //10001.1473.cn
  14463. //网盘文件直接打开查看
  14464. ///#!/file/38807b15-e721-4820-88b2-5f88da69813b;
  14465. ///<jscompress sourcefile="NetworkPromotion.js" />
  14466. Namespace.register("U.MD.U.NP");
  14467. U.MD.U.NP.GN = { "2d9c5d2d-e6e5-4a40-8064-f93a98d0e647": { "Url": "http://pay.1473.cn/?f=hbt&=hbt", "TT": ["U_MD_U_NP_XI U_MD_U_NP_XIH", "", "好笔头", "云笔记产品", "好笔头业务云笔记专为企业团队量身打造,致力为企业团队提供最好、最适合的云笔记产品,记客户,记工作,记知识,重要工作备忘提醒,专为改善企业团队工作效率而生,同时团队围绕笔记交流协作,提高团队执行和分享效率。", "U_MD_U_NP_XWCB U_MD_U_NP_XWCBB"] }, "7bc6d08c-7db3-4ef4-8a39-595a4967a189": { "Url": "http://pay.1473.cn/?f=zh&zh=", "TT": ["U_MD_U_NP_XI U_MD_U_NP_XIZ", "", "中恒科技", "兼容生产CD", "深圳市中恒科技实业有限公司坐落于具有中国光盘生产基地之誉称的广东省深圳市,是一家兼容生产CD-R,DVD-R可录入式空白光盘的中外合资企业,总投资3千万美元。第一期拥有10条具有国际先进水平的生产线,年产量可达6千万元。", "U_MD_U_NP_XWCB U_MD_U_NP_XWCBD"] }, "ea0efe2e-9167-4698-b9b5-31c27ad5eb73": { "Url": "http://pay.1473.cn/?f=sp&sp=", "TT": ["U_MD_U_NP_XI U_MD_U_NP_XIB", "", "声博配音公司", "各个语种的深圳配音", "声博配音公司拥有全新数字专业录音棚,资深音频工程师、录音师、音乐制作人等。 成立以来,公司在一直致力于中文及各个语种的深圳配音业务、音乐制作等。 为国内外客户录制了大量影视动画、广告、专题等。在深圳配音行业内树立了良好的口碑。", "U_MD_U_NP_XWCB U_MD_U_NP_XWCBB"] }, "fd01dd1b-9c87-4e4f-a3fb-af1b91bf56f8": { "Url": "/#!/tg/", "TT": ["U_MD_U_NP_XI U_MD_U_NP_XIY", "", "云端桌面", "体验崭新的云服务", "云端桌面远离单机,基于互联网。提供免费存储,让你远离U盘,排除U盘丢失和携带的麻烦。云端的资源都是共享的,你可以随时获取好友共享的资源。", "U_MD_U_NP_XWCB U_MD_U_NP_XWCBY"] }, "ea0efe2e-9167-4698-b9b5-31c27ad5eb73": { "Url": "http://pay.1473.cn/?f=sp&sp=", "TT": ["U_MD_U_NP_XI U_MD_U_NP_XIB", "", "声博配音公司", "各个语种的深圳配音", "声博配音公司拥有全新数字专业录音棚,资深音频工程师、录音师、音乐制作人等。 成立以来,公司在一直致力于中文及各个语种的深圳配音业务、音乐制作等。 为国内外客户录制了大量影视动画、广告、专题等。在深圳配音行业内树立了良好的口碑。", "U_MD_U_NP_XWCB U_MD_U_NP_XWCBB"] }, "90f7c5ca-f7ab-4f31-8869-7275b8e8955c": { "Url": "http://pay.1473.cn/?f=bz&bz=", "TT": ["U_MD_U_NP_XI U_MD_U_NP_XID", "", "北京邮电大学", "高新技术产业发展", "北京邮电大学深圳研究院(简称深圳研究院)是依照国家有关法律、行政法规和深圳市人民政府深府办[2000]39号文件以及关于进一步扶持高新技术产业发展的若干规定成立的北京邮电大学全资事业法人机构。", "U_MD_U_NP_XWCB U_MD_U_NP_XWCBD"] } }
  14468. U.MD.U.NP.TF; //
  14469. //---------------------------------------------------------------------------用户数据加载----------------------------------------------------------------------------
  14470. //-------------------------------------------------------加载数据
  14471. U.MD.U.NP.DTG = function () {
  14472. var _UDPD = U.selectEl("#U_MD_U_NP")[0]; //推广框
  14473. U.UF.F.windowTopCenter(_UDPD); //居中
  14474. // U.MD.D.T.WindowRestore(_UDPD, null, "推广"); //创建任务栏链接
  14475. }
  14476. //-----------------------------------------------------推广介绍
  14477. U.MD.U.NP.DTGOD = function (TGID) {
  14478. var _UDTD = U.selectEl("#U_MD_U_NP_XW")[0],
  14479. _UDAD = U.selectEl("div", _UDTD),
  14480. _UGN = U.MD.U.NP.GN[TGID]["TT"];
  14481. for (var i = 0; i < _UGN.length; i++) {
  14482. if (i == 1) {
  14483. continue;
  14484. }
  14485. if (i > 0 && i < _UGN.length - 1) {
  14486. _UDAD[i].innerHTML = _UGN[i];
  14487. }
  14488. else {
  14489. _UDAD[i].className = _UGN[i] + " U_MD_U_NP_I";
  14490. }
  14491. }
  14492. _UDAD[_UDAD.length - 2].onclick = function () {
  14493. U.MD.U.NP.GTGURL(TGID);
  14494. }; //点击获取推广地址
  14495. }
  14496. //-----------------------------------------------------------------------------有效点击
  14497. //加载该用户已有的推广数据
  14498. U.MD.U.NP.NTG = function (T) {
  14499. if (!U.MD.U.L.isLogin()) {
  14500. if (US.userInfo.TGD && US.userInfo.TGD["NTG"] && T == null) {
  14501. U.MD.U.NP.PLTG(US.userInfo.TGD["NTG"]);
  14502. U.MD.U.NP.LTTG(US.userInfo.TGD["YXT"]);
  14503. U.selectEl("#U_MD_U_NP_DPI")[0].innerText = "";
  14504. U.MD.U.NP.GTGFW(0);
  14505. }
  14506. else {
  14507. U.A.Request("UseStudioPay.GetUserAllTG", [US.userInfo.UserId], U.MD.U.NP.AsynNTG, [$("#U_MD_U_NP_A")[0]]);
  14508. // U.selectEl("#U_MD_U_NP_A")[0].onscroll = U.UF.EV.scrollLoad({ 'AF': U.MD.U.NP.GFWTG }).SCH();
  14509. U.UF.EV.scrollLoad($("#U_MD_U_NP_A")[0], function () {
  14510. U.MD.U.NP.GFWTG
  14511. });
  14512. } //异步获取
  14513. }
  14514. }
  14515. //异步获取推广数据
  14516. U.MD.U.NP.AsynNTG = function (r) {
  14517. var _context = r.context;
  14518. r = r.value;
  14519. if (US.userInfo.TGD == null) { US.userInfo.TGD = {} };
  14520. US.userInfo.TGD["NTG"] = r[0];
  14521. US.userInfo.TGD["YXT"] = U.MD.U.NP.DT(r[1]); //区分有效统计和注册
  14522. US.userInfo.TGD["YXD"] = [r[2]];
  14523. U.MD.U.NP.NTG();
  14524. }
  14525. //区分有效统计 点击和注册
  14526. U.MD.U.NP.DT = function (UTL) {
  14527. var i, j, _TF = [];
  14528. for (i = 0; i < UTL.length; i++) {
  14529. _TF[i] = []; _TF[i].push(UTL[i]);
  14530. for (j = i + 1; j < UTL.length; j++) {
  14531. if (UTL[j]["TGUserInfoID"] == UTL[i]["TGUserInfoID"]) {
  14532. _TF[i].push(UTL[j]); UTL.splice(j, 1);
  14533. }
  14534. }
  14535. }
  14536. return _TF;
  14537. }
  14538. //用户已有的推广数据
  14539. U.MD.U.NP.PLTG = function (UTL) {
  14540. var i, j, k,
  14541. _UDPD = U.selectEl("#U_MD_U_NP_DTD")[0],
  14542. _el, _UDTD, _UDI,
  14543. _UDFD = $$("frag"),
  14544. _UAFD = [],
  14545. _UAT = ["disk", "photo", "music", "video", "blog"];
  14546. _UDPD.innerText = "";
  14547. if (UTL.length > 0) {
  14548. U.selectEl("#U_MD_U_NP_DUN")[0].innerHTML = US.userInfo.TrueName || US.userInfo.UserNickName; //用户推广名
  14549. for (i = 0; i < UTL.length; i++) {
  14550. _UAFD.push(UTL[i]["TY"] + UTL[i]["TGUserInfoID"]); //基础推广地址
  14551. if (UTL[i]["TGID"] == "fd01dd1b-9c87-4e4f-a3fb-af1b91bf56f8") {
  14552. for (j = 0; j < _UAT.length; j++) {
  14553. _UAFD.push(US.DOMAIN + "#!/" + _UAT[j] + "/" + US.userInfo.UserName);
  14554. }
  14555. }
  14556. _el = $$("div", { "className": "U_MD_U_NP_DTDD" }, _UDFD);
  14557. $$("div", { "className": "U_MD_U_NP_DTDDN", "innerHTML": U.MD.U.NP.GN[UTL[i]["TGID"]]["TT"][2] + ':' }, _el);
  14558. for (k = 0; k < _UAFD.length; k++) {
  14559. _UDTD = $$("div", { "className": "U_MD_U_NP_DTDDA" }, _el);
  14560. _UDI = $$("input",
  14561. {
  14562. "className": "U_MD_U_NP_DTDDS",
  14563. "readOnly": "true",
  14564. "value": _UAFD[k],
  14565. "oncopy": function () {
  14566. U.UF.EV.stopBubble();
  14567. U.UF.C.copy("retElement.value");
  14568. }
  14569. }, _UDTD);
  14570. $$("div",
  14571. {
  14572. "innerHTML": "复制",
  14573. "className": "U_MD_U_NP_DTDDF",
  14574. "style":
  14575. {
  14576. "cssText": "float:right"
  14577. },
  14578. "onclick": function () {
  14579. U.UF.EV.stopBubble();
  14580. U.UF.C.copy(_UDI.value);
  14581. }
  14582. }, _UDTD); //复制按钮
  14583. }
  14584. _UAFD.splice(0, _UAFD.length);
  14585. }
  14586. _UDPD.appendChild(_UDFD);
  14587. }
  14588. else { _UDPD.innerText = "没有推广分类文类"; }
  14589. }
  14590. //打印有效统计
  14591. U.MD.U.NP.LTTG = function (UTL) {
  14592. var _UDPD = U.selectEl("#U_MD_U_NP_DWP")[0],
  14593. _el, _UDTD, _UDSD,
  14594. _UDFD = $$("frag");
  14595. _UDPD.innerText = "";
  14596. for (var i = 0; i < UTL.length; i++) {
  14597. _el = $$("div", { "className": "U_MD_U_NP_DWP" }, _UDFD);
  14598. _UDTD = $$("div", { "className": "U_MD_U_NP_DWY" }, _el);
  14599. $$("div", { "className": "U_MD_U_NP_DWYN", "innerHTML": U.MD.U.NP.GN[UTL[i][0]["TGID"]]["TT"][2] + "点击次数" }, _UDTD);
  14600. $$("div", { "className": "U_MD_U_NP_DWYS", "innerHTML": UTL[i][0]["C"] }, _UDTD);
  14601. _UDSD = $$("div", { "className": "U_MD_U_NP_DWY" }, _el);
  14602. $$("div", { "className": "U_MD_U_NP_DWYN", "innerHTML": U.MD.U.NP.GN[UTL[i][0]["TGID"]]["TT"][2] + "成功注册" }, _UDSD);
  14603. $$("div", { "className": "U_MD_U_NP_DWYS", "innerHTML": UTL[i][1] ? UTL[i][1]["C"] : "0" }, _UDSD);
  14604. }
  14605. _UDPD.appendChild(_UDFD);
  14606. }
  14607. //---------------------------------------------------------------------有效地址
  14608. //滚动加载访问地址
  14609. U.MD.U.NP.GFWTG = function () {
  14610. if (U.MD.U.NP.GTGFW.call(this, (this.P + 1)).length == 0) {
  14611. this.P -= 1;
  14612. this.TF = false;
  14613. return false;
  14614. }
  14615. }
  14616. //获取打印有效数据
  14617. U.MD.U.NP.GTGFW = function (P) {
  14618. var _UTL = U.MD.U.NP.GYXFW(P);
  14619. if (_UTL) { U.MD.U.NP.FWTG(_UTL); }
  14620. else {
  14621. var _FP = Math.floor(P / 5);
  14622. U.A.Request("UseStudioPay.GetTGYXSL", [US.userInfo.UserId, _FP * 50, (_FP + 1) * 50 - 1], U.MD.U.NP.AsynGTGFW, ["", P, this]);
  14623. return [];
  14624. }
  14625. return _UTL;
  14626. }
  14627. //异步获取
  14628. U.MD.U.NP.AsynGTGFW = function (r) {
  14629. var _context = r.context;
  14630. r = r.value;
  14631. US.userInfo.TGD["YXD"].push(r);
  14632. U.MD.U.NP.GTGFW(_context[1]);
  14633. _context[2].TF = true;
  14634. }
  14635. //获取有效数据
  14636. U.MD.U.NP.GYXFW = function (P) {
  14637. if (US.userInfo.TGD) {
  14638. var _UTGP = US.userInfo.TGD["YXD"],
  14639. TP = Math.floor(P / 5), FP = (P - TP * 5);
  14640. if (_UTGP[TP]) {
  14641. return _UTGP[TP].slice(FP * 10, (FP + 1) * 10);
  14642. }
  14643. }
  14644. }
  14645. //访问地址打印
  14646. U.MD.U.NP.FWTG = function (UTL) {
  14647. if (UTL.length > 0) {
  14648. var _UDPD = U.selectEl("#U_MD_U_NP_DPI")[0],
  14649. _el,
  14650. _UTD,
  14651. _UDFD = $$("frag");
  14652. for (var i = 0; i < UTL.length; i++) {
  14653. eval("0,_UTD =" + UTL[i]["TGAdress"]);
  14654. _el = $$("div", { "className": "U_MD_U_NP_DPH U_MD_U_NP_DPIF", "style": { "backgroundColor": "White" } }, _UDPD);
  14655. $$("div", { "className": "U_MD_D_Text_Abbreviation", "style": { "marginLeft": "0px" }, "innerHTML": UTL[i]["UserIp"] }, _el);
  14656. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": _UTD["province"] + " " + _UTD["city"] }, _el);
  14657. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": U.UF.D.getYearMonthDay(UTL[i]["Time"], "String") }, _el);
  14658. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": U.MD.U.NP.GN[UTL[i]["TGID"]]["TT"][2] }, _el);
  14659. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": UTL[i]["IsRegistration"] ? "成功" : "失败", "style": { "color": UTL[i]["IsRegistration"] ? "Red" : "" } }, _el);
  14660. }
  14661. _UDPD.appendChild(_UDFD);
  14662. }
  14663. }
  14664. //-----------------------------------------------------------------排名
  14665. //获取排名
  14666. U.MD.U.NP.GPMTG = function (TF) {
  14667. if (US.userInfo.TGD && US.userInfo.TGD["TGP"] && TF == null) {
  14668. U.MD.U.NP.PMTG(US.userInfo.TGD["TGP"]);
  14669. }
  14670. else {
  14671. U.A.Request("UseStudioPay.GetTGPM", [], U.MD.U.NP.AsynGPMTG, [$("#U_MD_U_NP_A")[0]]);
  14672. }
  14673. }
  14674. //异步获取排名
  14675. U.MD.U.NP.AsynGPMTG = function (r) {
  14676. r = r.value;
  14677. if (US.userInfo.TGD == null) { US.userInfo.TGD = {} };
  14678. US.userInfo.TGD["TGP"] = r;
  14679. U.MD.U.NP.GPMTG(); //打印排名
  14680. }
  14681. //打印用户排名
  14682. U.MD.U.NP.PMTG = function (UTL) {
  14683. var _UDPD = U.selectEl("#U_MD_U_NP_PG")[0],
  14684. _el, _UDTD,
  14685. _UDFD = $$("frag");
  14686. _UDPD.innerText = "";
  14687. for (var i = 0; i < UTL.length; i++) {
  14688. _el = $$("div", { "className": "U_MD_U_NP_PH" + (i < 3 ? "" : " U_MD_U_NP_PHV") }, _UDFD);
  14689. $$("div", { "className": "U_MD_U_NP_PHM", "innerHTML": (i + 1 < 10 ? "0" : "") + (i + 1) + ".", "style": { "color": i == 0 ? "#e06767" : "" } }, _el);
  14690. _UDTD = $$("div", { "className": (i < 3 ? "U_MD_U_NP_PHH" : "U_MD_U_NP_PHHM") }, _el);
  14691. $$("img",
  14692. {
  14693. "className": (i < 3 ? "U_MD_U_NP_PHHI" : "U_MD_U_NP_PHHIO"),
  14694. "alt": UTL[i]["TrueName"] || UTL[i]["UserName"],
  14695. "src": U.MD.C.getHeadImage(UTL[i].UserThumbnailImageHead),
  14696. "onclick": [U.MD.U.V.POUW, [UTL[i]["UserID"]]]
  14697. }, _UDTD);
  14698. $$("div", { "className": "U_MD_U_NP_PHHS U_MD_D_Text_Abbreviation" + (i < 3 ? "" : " U_MD_U_NP_PHHSM"), "innerHTML": UTL[i]["TrueName"] || UTL[i]["UserName"] }, _UDTD);
  14699. $$("div", { "className": "U_MD_U_NP_PHHS U_MD_D_Text_Abbreviation" + (i < 3 ? "" : " U_MD_U_NP_PHHSM"), "innerHTML": U.MD.U.NP.GN[UTL[i]["TGID"]]["TT"][2] }, _UDTD);
  14700. }
  14701. _UDPD.appendChild(_UDFD);
  14702. }
  14703. //----------------------------------------------------------------------辅助功能
  14704. //添加用户访问地址
  14705. //例子:2013年的推广,暂时没有使用
  14706. U.MD.U.NP.AddUr = function (TGID) {
  14707. U.A.Request("UseStudioPay.SetYXTG", [TGID, U.UF.C.jsonToStr(US.city)], U.MD.U.NP.AsynAddUr, [""]);
  14708. }
  14709. //通过用户id添加用户访问地址
  14710. //例:
  14711. U.MD.U.NP.AddUrID = function (userid) {
  14712. U.A.Request("UseStudioPay.SetYXTGBYUID", [userid, U.UF.C.jsonToStr(US.city)], U.MD.U.NP.AsynAddUr, [""]);
  14713. }
  14714. //获取用户访问地址
  14715. U.MD.U.NP.AsynAddUr = function (r) {
  14716. r = r.value;
  14717. U.MD.U.NP.TF = r;
  14718. U.MD.U.NP.TGR(); //发送注册信息
  14719. }
  14720. //添加推广地址
  14721. U.MD.U.NP.GTGURL = function (TGID) {
  14722. if (!U.MD.U.L.isLogin()) {//必须登录获取用户信息
  14723. if (US.userInfo.TGD && US.userInfo.TGD["NTG"] && U.MD.U.NP.GISTGURL(TGID)) {
  14724. U.MD.U.NP.STG(1, U.selectEl("#U_MD_U_NP_A")[0]);
  14725. return false;
  14726. } //查看地址
  14727. U.alert("正在获取中..."); //提示用户等待
  14728. U.A.Request("UseStudioPay.SetUserTG", [US.userInfo.UserId, TGID], U.MD.U.NP.AsynGTGURL, ["", TGID]); //添加用户注册信息
  14729. }
  14730. }
  14731. //异步添加推广地址
  14732. U.MD.U.NP.AsynGTGURL = function (r) {
  14733. _context = r.context;
  14734. r = r.value
  14735. if (r) {
  14736. if (US.userInfo.TGD && US.userInfo.TGD["NTG"]) {
  14737. r = r.toLocaleLowerCase();
  14738. var _ET = new U.MD.U.NP.TGE[_context[1], r, U.MD.U.NP.GN[_context[1]]["Url"]];
  14739. };
  14740. US.userInfo.TGD["NTG"].push(_ET);
  14741. }
  14742. U.MD.U.NP.STG(1, U.selectEl("#U_MD_U_NP_A")[0]); //查看地址
  14743. }
  14744. //获取推广地址是否存在
  14745. U.MD.U.NP.GISTGURL = function (TGID) {
  14746. var _UNTG = US.userInfo.TGD["NTG"];
  14747. for (var i = 0; i < _UNTG.length; i++) {
  14748. if (_UNTG[i]["TGID"] == TGID) {
  14749. return _UNTG[i];
  14750. }
  14751. }
  14752. return false;
  14753. }
  14754. //成功注册,添加推广信息,
  14755. U.MD.U.NP.TGR = function () {
  14756. if (U.MD.U.NP.TF && US.userInfo.UserId) {//添加用户注册信息
  14757. U.A.Request("UseStudioPay.UpAddR", [U.MD.U.NP.TF], function () { }, []);
  14758. U.MD.U.NP.TF = false; //取消重复
  14759. }
  14760. }
  14761. //推广切换
  14762. U.MD.U.NP.STG = function (TF, UTFD) {
  14763. TF = TF + 1; //显示的div
  14764. var _UTAD = U.UF.EL.getChildrenNoText(UTFD.childNodes); //获取所有的子元素
  14765. for (var i = 1; i < _UTAD.length; i++) {
  14766. if (TF == 2 && US.userInfo.UserId == null) {
  14767. break;
  14768. };
  14769. if (TF == i) {
  14770. _UTAD[i].style.display = "block";
  14771. }
  14772. else {
  14773. _UTAD[i].style.display = "none";
  14774. }
  14775. }
  14776. if (TF == 3) {
  14777. U.MD.U.NP.GPMTG();
  14778. } //查看排名
  14779. else if (TF > 1) {
  14780. if (!U.MD.U.L.isLogin()) {
  14781. U.MD.U.NP.NTG();
  14782. }
  14783. } //用户推广资料
  14784. }
  14785. //-------------------------------------------------------------------辅助函数--------------------------------------------------------------
  14786. //用户推广的实体
  14787. U.MD.U.NP.TGE = function (E) {
  14788. this.TGID = E[0];
  14789. this.TGUserInfoID = E[1];
  14790. this.TY = E[2];
  14791. }
  14792. ;