uformd.js 699 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792
  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. ];
  286. //#region 桌面初始化
  287. /**
  288. * 初始化桌面的起始函数
  289. *
  290. */
  291. U.MD.D.I.init = function () {
  292. if ($("#U_MD_D_K")[0]) {
  293. //初始化桌面图标
  294. U.MD.D.I.initDesktopIcons($("#U_MD_D_K")[0]);
  295. //初始化任务栏,因为是静态的,所以直接改变样式即可.
  296. U.selectEl("#U_MD_D_RW").css("width", US.width - 165 + "px");
  297. }
  298. }
  299. /**
  300. * 隐藏任务栏
  301. *
  302. * @param {element} 桌面元素
  303. */
  304. U.MD.D.I.hiddenTaskbar = function (el) {
  305. //任务栏位置变小
  306. U.selectEl(el).parentElement(3).css({ "bottom": "-63px" });
  307. //桌面的位置变大
  308. // U.selectEl("#U_MD_D_K").css({ "left": "5px" });
  309. }
  310. /**
  311. * 初始化打印桌面图标
  312. *
  313. * @param {element} 桌面元素
  314. */
  315. U.MD.D.I.initDesktopIcons = function (el) {
  316. var i, //用于循环
  317. _content, //桌面图标元素
  318. _iconcontent, //桌面图标元素
  319. _frag = $$("frag"), //定义一个碎片元素
  320. _DesktopIconInfo = U.MD.D.I.DeskIcon; //获取桌面图标
  321. //清楚桌面图标
  322. el.innerHTML = "";
  323. //循环创建桌面图标
  324. for (i = 0; i < _DesktopIconInfo.length; i++) {
  325. _content = $$("div", {
  326. className: "U_MD_D_KO",
  327. "onmousedown": U.UF.C.closure(function (obj) {
  328. //防止拖动图标即打开了桌面应用
  329. U.MD.D.click(this, obj);
  330. }, [_DesktopIconInfo[i]]),
  331. "onclick": U.UF.C.closure(function (obj) {
  332. //防止拖动图标即打开了桌面应用
  333. U.MD.D.click(this, obj);
  334. }, [_DesktopIconInfo[i]])
  335. }, _frag); //
  336. _iconcontent = $$("div", { className: "U_MD_D_KOA" }, _content);
  337. $$("div", { className: "U_MD_D_KOS U_Img", "style": { "backgroundPosition": _DesktopIconInfo[i].Img.x + "px " + _DesktopIconInfo[i].Img.y + "px"} }, _iconcontent);
  338. $$("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);
  339. }
  340. //加载好后给图标定位
  341. U.MD.D.iconPostion($(_frag).Child());
  342. //把图标加载到页面
  343. el.appendChild(_frag);
  344. }
  345. /**
  346. * 显示任务栏
  347. *
  348. * @param {element} 桌面元素
  349. */
  350. U.MD.D.I.displayTaskbar = function (el) {
  351. //判断是否需要形式任务栏,由于用了mouseover事件会冒泡响应多次,这里做了过滤
  352. if (!U.UF.EV.stopBubbleMouseOutOrOver(el) && U.selectEl(el).css("bottom") != "0px") {
  353. //任务栏位置变化
  354. U.selectEl(el).css({ "bottom": "0px" });
  355. //桌面位置变话
  356. // U.selectEl("#U_MD_D_K").css({ "left": "70px" });
  357. }
  358. }
  359. //#region 桌面图标拖动逻辑
  360. /**
  361. * 桌面排列图标
  362. *
  363. * @param {element} 桌面元素
  364. * @param {object} 上下相距的距离
  365. * @param {object} 左右相距的距离
  366. * @return {object} 命名空间
  367. */
  368. U.MD.D.iconPostion = function (childs, top, left) {
  369. var i; //用于循环处理
  370. top = top || 15; //如果没有设置元素的间距处理默认上间距为15
  371. left = left || 20; //如果没有设置元素的间距处理默认左间距为15
  372. //循环所有的图标,设置每个图标的间距,打印顺序是竖排打印的方式
  373. for (i = 0; i < childs.length; i++) {
  374. //如果竖排top超过了范围处理
  375. if (top + 95 > US.height - 85) {
  376. //left超过了页面范围处理,则向上重叠打印处理
  377. if ((left + 180) > US.width) {
  378. top -= 115;
  379. left -= 90;
  380. }
  381. //没有超过范围,那么left+90添加到下一个竖排打印
  382. else {
  383. left += 90;
  384. top = 15;
  385. };
  386. }
  387. //给图标的位置赋值
  388. U.selectEl(childs[i]).css({ top: top + "px", left: left + "px" });
  389. if (i < childs.length - 1) {
  390. //页面图标每次向下加115
  391. top += 115;
  392. }
  393. }
  394. //返回最后调用的图标的位置
  395. return [top, left];
  396. }
  397. /**
  398. * 桌面点击事件逻辑
  399. *
  400. * @param {element} 桌面元素
  401. * @param {object} 上下相距的距离
  402. * @param {object} 左右相距的距离
  403. * @return {object} 命名空间
  404. */
  405. U.MD.D.click = function (el, obj) {
  406. var _buttonnumber = event.button; //点击的按钮的事件值
  407. U.UF.EV.stopBubble(); //阻止向上冒泡
  408. //onmousedown 包含了左键和右键 这里大于2是为了兼容 所有浏览器的右键处理
  409. if (_buttonnumber < 2) {
  410. //如果是click事件的处理
  411. if (event.type == "click") {
  412. //如果元素在mousemove事件中没有移动则出发click事件
  413. if (!U.MD.D.I.IsDrag) {
  414. //打开应用处理
  415. U.MD.D.I.openApplication(obj.Url, { "userid": US.userInfo.UserId, "directoryid": US.FTPFOLDERID });
  416. }
  417. }
  418. //如果是mouse事件的处理
  419. else {
  420. //拖动处理,添加拖动和拖动结束事件
  421. U.UF.F.drag(el, U.MD.D.iconMove, U.MD.D.iconUp);
  422. }
  423. U.MD.D.I.IsDrag = false;
  424. }
  425. }
  426. /**
  427. * 拖动的处理
  428. *
  429. */
  430. U.MD.D.iconMove = function () {
  431. //如果当前位置点击初始化的位置出现了变化,则设置是否拖动的属性 U.MD.D.I.IsDrag为true
  432. U.MD.D.I.IsDrag = true;
  433. }
  434. /**
  435. * 拖动结束后,这里是定位处理,以网状的形式定位
  436. *
  437. * @param {element} 拖动的元素
  438. * @return {object} 命名空间
  439. */
  440. U.MD.D.iconUp = function (el) {
  441. var _top = 15,
  442. _left = 20,
  443. _margin,
  444. _childs = U.selectEl("#U_MD_D_K").Child(), //桌面所有的图标
  445. _positioninfo = U.UF.EL.getElementInfo(el); //获取拖动结束的元素的位置
  446. if (_positioninfo["OT"] > 15) {
  447. //网状的形式定位,如果差超过了55,那么向下定位,否则向上定位
  448. _margin = ((_positioninfo["OT"] - 15) % 115 > 55 && _positioninfo["OT"] + 115 < US.height) ? 1 : 0;
  449. _top = (Math.floor((_positioninfo["OT"] - 15) / 115) + _margin) * 115 + 15;
  450. }
  451. if (_positioninfo["OL"] > 20) {
  452. //网状的形式定位,如果差超过了90,那么向右定位,否则向左定位
  453. _margin = ((_positioninfo["OL"] - 20) % 90 > 45 && _positioninfo["OL"] + 90 < US.width) ? 1 : 0;
  454. _left = (Math.floor((_positioninfo["OL"] - 20) / 90) + _margin) * 90 + 20
  455. }
  456. //while循环判断么一个重叠的元素
  457. do {
  458. _positioninfo = U.MD.D.iconPostion([el], _top, _left); //给重叠的元素向下定位
  459. _top = _positioninfo[0] + 115; //得到定位后的top
  460. _left = _positioninfo[1]; //得到定位后的left
  461. } while (el = U.MD.D.isOverlap(el, _childs, _positioninfo))
  462. }
  463. /**
  464. * 判断拖动后图标是否重叠
  465. *
  466. * @param {element} 拖动的元素
  467. * @param {element} 桌面所有的元素
  468. * @param {array} 拖动元素的位置
  469. ----------[0] 上 top
  470. ----------[1] 左 left
  471. * @return {object} 命名空间
  472. */
  473. U.MD.D.isOverlap = function (el, childs, postionarray) {
  474. //循环所有的图标
  475. for (var i = 0; i < childs.length; i++) {
  476. //判断有没有和该图标诶子重叠的元素
  477. if (el != childs[i] && (childs[i].offsetTop == postionarray[0] && childs[i].offsetLeft == postionarray[1])) {
  478. return childs[i]; //如果有返回
  479. }
  480. }
  481. }
  482. //#endregion
  483. //#endregion
  484. //#region 桌面应用
  485. /**
  486. * 打开应用
  487. *
  488. * @param {string} 类型
  489. -----------------Disk 网盘系统
  490. -----------------PDisk 学习系统网盘
  491. -----------------Poto 图片
  492. -----------------Video 视频
  493. -----------------Music 音乐
  494. -----------------Word word
  495. -----------------Excel excel
  496. -----------------Txt 记事本
  497. -----------------PB 学习系统
  498. -----------------Blog 朋友圈系统
  499. -----------------FTP ftp系统
  500. -----------------Group 好友群
  501. -----------------SY 首页系统
  502. -----------------Set 个人设置
  503. -----------------XSet 系统设置
  504. -----------------App 我们所有的app
  505. -----------------BC c.1473.cn 平台
  506. -----------------CWeb d.1473.cn 变成平台
  507. -----------------其他的外联系统 我们统一用iframe打开
  508. * @param {array} 类型
  509. 如果第一个参数为"disk",则第二个参数为object,里面包含了用户id和目录id{userid:"",directoryid:""}
  510. 如果第一个参数为"word"或者"excel","txt",则第二个参数为文件信息fileinfo。
  511. 如果第一个参数为"blog"或者"PDisk"。建议删除。
  512. 如果第一个参数为其他,则无第二个参数
  513. * @returns {array}
  514. */
  515. U.MD.D.I.openApplication = function (str, obj, info) {
  516. obj = obj || {};
  517. var _taskbar, //_taskbar 作为任务栏显示的元素,包含图标和名字
  518. _formdiv, //创建任务栏时同时弹出的窗体元素。
  519. _userinfo = US.userInfo, //登录用户信息
  520. _userid = obj.userid || _userinfo.UserId //登录用户id
  521. ;
  522. //选择应用处理
  523. switch (str) {
  524. case "friend": //好友打开
  525. U.MD.D.I.IsDrag = true;
  526. U.MD.F.W.viewFriend(info); //打开好友
  527. // U.MD.N.urlWrite("friend/" + obj.directoryid, "好友"); //好友的url重写
  528. break;
  529. case "domain":
  530. 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"} });
  531. _formdiv = new U.UF.UI.form("域名管理", _iframe, { id: "U_MD_DS_DomainShare", style: { "width": "370px", "height": "390px"} }).form;
  532. if (_formdiv) {
  533. //生成任务栏的变量
  534. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-15px -296px", "name": "网盘", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj, info); } }
  535. }
  536. break;
  537. case "disk": //个人网盘查看
  538. _formdiv = U.MD.DK.initDisk(_userid, obj.directoryid); //根据网盘数据,并加载网盘,里面包含了url重写
  539. if (_formdiv) {
  540. //生成任务栏的变量
  541. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-15px -296px", "name": "网盘", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  542. }
  543. break;
  544. case "word": //Word打开
  545. var _wordinfo = U.MD.O.word(_userinfo, obj, arguments[2]); //初始化word的处理
  546. _formdiv = _wordinfo[0];
  547. if (_formdiv) {
  548. //生成任务栏的变量
  549. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-462px -296px", "name": "文档", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, _wordinfo[1]); } }
  550. }
  551. if (obj.UrlType != 'join') {
  552. U.MD.N.urlWrite("word/" + _formdiv.id.substr(-36), "在线文档"); //word的url重写
  553. }
  554. break;
  555. case "excel": //Excel打开
  556. _formdiv = U.MD.O.excel(_userinfo, obj);
  557. if (_formdiv) {
  558. //生成任务栏的变量
  559. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-523px -296px", "name": "在线表格", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  560. }
  561. U.MD.N.urlWrite("excel/" + _formdiv.id.substr(-36), "在线表格");
  562. break;
  563. case "txt": //Txt打开
  564. _formdiv = U.MD.D.Txt.textCreate();
  565. if (_formdiv) {
  566. //生成任务栏的变量
  567. _taskbar = { "id": str + obj.directoryid, "backgroundPostion": "-267px -413px", "name": "在线文本", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  568. }
  569. U.MD.N.urlWrite("txt/" + _formdiv.id.substr(-36), "在线文本");
  570. break;
  571. case "lookupFriend":
  572. _formdiv = U.MD.F.S.popSearchFriendsOrGroupForm(0);
  573. //生成任务栏的变量
  574. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-85px -413px", "name": "查找好友", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  575. U.MD.N.urlWrite("lookupfriend/" + obj.directoryid.substr(-36), "查找好友"); //查找好友的url重写
  576. break;
  577. case "ftp": //Ftp
  578. _formdiv = U.MD.F.S.popupsSearchFtp();
  579. //生成任务栏的变量
  580. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-144px -413px", "name": "FTP", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  581. break;
  582. case "group": //群组
  583. _formdiv = U.MD.F.S.popupsSearchGroups(0);
  584. //生成任务栏的变量
  585. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-85px -413px", "name": "群组", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  586. break;
  587. case "set": //个人设置
  588. _formdiv = U.MD.U.P.userDataSet();
  589. if (_formdiv) {
  590. //生成任务栏的变量
  591. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-400px -296px", "name": "个人设置", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  592. }
  593. break;
  594. case "systemSet": //系统设置
  595. _formdiv = U.MD.D.B.init();
  596. //生成任务栏的变量
  597. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-400px -296px", "name": "系统设置", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  598. break;
  599. case "boomYun": //BoomYun
  600. _formdiv = U.Boom.I.onload();
  601. //生成任务栏的变量
  602. _taskbar = { "id": str + _formdiv.id, "backgroundPostion": "-844px -419px", "name": "互联办公", "forms": _formdiv, "click": function () { U.MD.D.I.openApplication(str, obj); } }
  603. U.MD.N.urlWrite("boomyun", "互联办公"); //boomyun的url重写
  604. break;
  605. case "xz": //App下载
  606. window.open("http://xz.1473.cn");
  607. break;
  608. case "client": //App下载
  609. window.open("http://client.1473.cn");
  610. break;
  611. case "backEndProgramming": //在线编程平台打开
  612. window.open("http://c.1473.cn");
  613. break;
  614. case "frontEndProgramming": //在线web编程
  615. window.open("http://d.1473.cn");
  616. break;
  617. default: break;
  618. }
  619. //如果有任务栏信息
  620. if (_taskbar) {
  621. U.MD.D.T.taskbar(_taskbar); //创建任务处理
  622. }
  623. }
  624. //#endregion
  625. ;
  626. ///<jscompress sourcefile="taskbar.js" />
  627. /**
  628. * 任务栏管理系统
  629. */
  630. Namespace.register("U.MD.D.T.taskbar"); //任务栏 命名空间
  631. /**
  632. * 任务管理函数
  633. * @param applyinfo {object} 任务信息
  634. * 形如:{
  635. * id: _taskId, //任务识别id
  636. * backgroundPostion: _taskbar[0], //任务图标定位
  637. * name: _taskbar[1], //任务名称
  638. * forms: _taskbar[2], //任务所在的窗体
  639. * click: function () { U.MD.D.I.openApplication(str, obj); } //任务点击打开的函数
  640. * }
  641. * @param taskbarEle 任务管理器所在的元素 默认为$("#U_MD_D_T_taskbar_Bar_Main")[0]元素
  642. */
  643. U.MD.D.T.taskbar = function (applyinfo, taskbarEle) {
  644. taskbarEle = taskbarEle || U.selectEl("#U_MD_D_RW")[0]; //任务管理器所在的元素
  645. var _tasks = U.selectEl('#U_MD_D_T_taskbar_' + applyinfo.id, taskbarEle)[0]; //查找当前任务是否存在
  646. //如果不存在则创建任务
  647. if (!_tasks) {
  648. //创建任务
  649. U.MD.D.T.taskbar.create(applyinfo, taskbarEle);
  650. //检查任务是否过多
  651. U.MD.D.T.taskbar.multitask(taskbarEle);
  652. }
  653. else {
  654. _tasks.forms = applyinfo.forms;
  655. }
  656. }
  657. //是否触发拖动监听变量
  658. U.MD.D.T.taskbar.drag = 0;
  659. /**
  660. * 任务创建函数
  661. * @param applyinfo {object} 任务信息 与任务管理函数参数相同
  662. * @param taskbarEle {element} 任务管理器所在的元素 默认为$("#U_MD_D_T_taskbar_Bar_Main")[0]元素 与任务管理函数参数相同
  663. */
  664. U.MD.D.T.taskbar.create = function (applyinfo, taskbarEle) {
  665. //动态创建任务
  666. var _task = $$("div", { id: "U_MD_D_T_taskbar_" + applyinfo.id, className: "U_MD_D_BZMO", title: applyinfo.name, "forms": applyinfo.forms });
  667. var _taskMain = $$("div", {
  668. className: "U_MD_D_BZMOA",
  669. //绑定点下事件 勇于拖动监听
  670. onmousedown: U.UF.C.apply(null, function () { U.MD.D.T.taskbar.dragClose(_taskMain); }),
  671. //绑定点击事件 需判断是否在拖动状态
  672. onclick: function () {
  673. if (!(U.MD.D.T.taskbar.drag > 1)) {
  674. applyinfo.click();
  675. }
  676. U.MD.D.T.taskbar.drag = 0;
  677. }
  678. }, _task);
  679. //动态创建任务图标
  680. $$("div", { className: "U_MD_D_BZMOI U_Img", style: { backgroundPosition: applyinfo.backgroundPostion} }, _taskMain);
  681. //动态创建任务名称
  682. // $$("div", { className: "U_MD_D_BZMON U_MD_D_Text_Abbreviation", innerHTML: applyinfo.name }, _taskMain);
  683. var _taskName = $$("div", {
  684. className: "U_MD_D_T_taskbar_Name",
  685. style: { "position": "absolute", "left": "-26px", "bottom": "83px"}/*,
  686. innerHTML: applyinfo.name*/
  687. }, _task);
  688. $$("div", {
  689. className: "U_MD_D_BZMON U_MD_D_Text_Abbreviation",
  690. style: { "float": "left", "width": "100px", "margin-top": "7%", "color": "#FFFFFF", "font-family": "MicrosoftYaHei" },
  691. innerHTML: applyinfo.name
  692. }, _taskName);
  693. $$("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);
  694. $$("div", { className: "U_MD_D_T_taskbar_Close", innerHTML: "x", onclick: function () { U.UF.EV.stopBubble(); U.MD.D.T.taskbar.close(applyinfo) } }, _taskName);
  695. //添加到任务栏的最前面
  696. if (taskbarEle) {
  697. U.selectEl(taskbarEle).append(_task, 0, taskbarEle.firstChild);
  698. }
  699. //任务栏中大于或等于28个时,才出现上下分页按钮;
  700. if ($(".U_MD_D_BZMOA").length >= 28) {
  701. U.selectEl(".U_MD_D_RW_R")[0].style.display = "block";
  702. } else {
  703. U.selectEl(".U_MD_D_RW_R")[0].style.display = "none";
  704. }
  705. }
  706. //当前页监听
  707. U.MD.D.T.taskbar.page = 1;
  708. //最大页码
  709. U.MD.D.T.taskbar.maxPage = 1;
  710. //每页最多放置任务数
  711. U.MD.D.T.taskbar.pageNum = 1;
  712. /**
  713. * 检查任务过多情况
  714. * @param taskbarEle {element} 任务管理器所在的元素 默认为$("#U_MD_D_T_taskbar_Bar_Main")[0]元素 与任务管理函数参数相同
  715. */
  716. U.MD.D.T.taskbar.multitask = function (taskbarEle) {
  717. //每页最多放置任务数
  718. U.MD.D.T.taskbar.pageNum = Math.floor($(taskbarEle).width() / 65);
  719. //获取所有任务
  720. var _tasks = U.selectEl(taskbarEle).Child();
  721. //获取任务总数
  722. var _tasksTotal = _tasks.length;
  723. //判断是否为多页情况
  724. if (_tasksTotal > U.MD.D.T.taskbar.pageNum) {
  725. //计算最大总共有多少页
  726. U.MD.D.T.taskbar.maxPage = Math.ceil(_tasksTotal / U.MD.D.T.taskbar.pageNum);
  727. }
  728. U.MD.D.T.taskbar.page = 1;
  729. U.MD.D.T.taskbar.switchPage(0);
  730. }
  731. /**
  732. * 多任务切换页面
  733. * @param mark {number} 页码标记 在前台页上加或者减多少页
  734. * @param taskbarEle {element} 任务管理器所在的元素 默认为$("#U_MD_D_T_taskbar_Bar_Main")[0]元素 与任务管理函数参数相同
  735. */
  736. U.MD.D.T.taskbar.switchPage = function (mark, taskbarEle) {
  737. //任务管理器位置
  738. taskbarEle = taskbarEle || U.selectEl("#U_MD_D_RW")[0];
  739. //页面切换设置
  740. U.MD.D.T.taskbar.page += mark;
  741. //页面最小值限制
  742. if (U.MD.D.T.taskbar.page < 1) { U.MD.D.T.taskbar.page = 1; }
  743. //页面最大值限制
  744. 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; }
  745. //获取所有任务
  746. var _tasks = U.selectEl(taskbarEle).Child();
  747. //计算当前页面从第几个任务开始显示
  748. var _startLength = (U.MD.D.T.taskbar.page - 1) * U.MD.D.T.taskbar.pageNum;
  749. //计算当前页面从第几个任务结束显示
  750. var _endLength = Math.min(U.MD.D.T.taskbar.page * U.MD.D.T.taskbar.pageNum, _tasks.length);
  751. //影藏所有任务
  752. U.selectEl($(taskbarEle).Child()).css('display', 'none');
  753. //循环显示当前页面的任务
  754. var i;
  755. for (_startLength; _startLength < _endLength; _startLength++) {
  756. U.selectEl(_tasks[_startLength]).css('display', 'block');
  757. }
  758. }
  759. /**
  760. * 任务关闭函数
  761. * @param applyinfo {object} 任务信息
  762. */
  763. U.MD.D.T.taskbar.close = function (applyinfo) {
  764. var i,
  765. _child = U.selectEl("#U_MD_D_RW").Child(),
  766. _form = U.UF.C.isElement(applyinfo.forms) ? applyinfo.forms : applyinfo.forms.form;
  767. //执行窗体关闭函数
  768. if (applyinfo.forms) {
  769. U.UF.F.closeWindow(_form, "remove");
  770. }
  771. //通过applyinfo删除的模式
  772. if (applyinfo.id) {
  773. //删除任务
  774. U.selectEl('#U_MD_D_T_taskbar_' + applyinfo.id).remove();
  775. }
  776. else {
  777. //循环找出需要移除的form窗体
  778. for (i = 0; i < _child.length; i++) {
  779. if (_child[i].forms == _form) {
  780. U.selectEl(_child[i]).remove();
  781. }
  782. }
  783. }
  784. }
  785. /**
  786. * 清空任务管理器
  787. * @param taskEle {Element} 任务管理器位置
  788. */
  789. U.MD.D.T.taskbar.clear = function (taskEle) {
  790. //任务管理器位置
  791. taskEle = taskEle || U.selectEl("#U_MD_D_RW")[0];
  792. //循环执行所有任务的关闭点击事件
  793. var _i, _tasksClose = U.selectEl('.U_MD_D_T_taskbar_Close', taskEle);
  794. for (_i = 0; _i < _tasksClose.length; _i++) {
  795. _tasksClose[_i].onclick();
  796. }
  797. }
  798. /**
  799. * 任务拖拽关闭函数
  800. * @param taskEle {Element} 被操作任务的元素
  801. */
  802. U.MD.D.T.taskbar.dragClose = function (taskEle) {
  803. U.MD.D.T.taskbar.drag = 0;
  804. //获取鼠标位置 定义该位置为起始位置
  805. //U.MD.D.T.taskbar.stratX = U.UF.EL.getMousePosition().x;
  806. U.MD.D.T.taskbar.stratY = U.UF.EL.getMousePosition().y;
  807. //记录当前样式
  808. U.MD.D.T.taskbar.preStyle = U.selectEl(taskEle).css('cssText');
  809. //设置元素绝对定位
  810. var _taskEleCssPostion = U.selectEl(taskEle).css("postion");
  811. if (_taskEleCssPostion == "static" || !_taskEleCssPostion) { U.selectEl(taskEle).css("position", "absolute") };//改G
  812. //设置置顶
  813. U.selectEl(taskEle).css("z-index", 9999);
  814. //绑定事件
  815. U.MD.D.T.taskbar.bindDragEvent(taskEle);
  816. }
  817. /**
  818. * 拖拽事件绑定
  819. */
  820. U.MD.D.T.taskbar.bindDragEvent = function (taskEle) {
  821. var _event = {
  822. "mousemove": function () {
  823. //执行拖拽事件
  824. U.MD.D.T.taskbar.dragMove(taskEle);
  825. //绑定鼠标离开元素事件,防止失焦后元素不受控制
  826. U.selectEl(taskEle).mouseleave(function () {
  827. U.MD.D.T.taskbar.dragEnd(taskEle);
  828. });
  829. //设置拖拽开始
  830. U.MD.D.T.taskbar.drag++;
  831. },
  832. "mouseup": function () {
  833. //执行拖拽结束函数
  834. U.MD.D.T.taskbar.dragEnd(taskEle);
  835. //解绑当前绑定的函数
  836. U.selectEl(taskEle).unbind(_event);
  837. //清楚
  838. U.selectEl(taskEle).mouseleave(null);
  839. }
  840. };
  841. //绑定事件
  842. U.selectEl(taskEle).bind(_event);
  843. }
  844. /**
  845. * 拖拽函数
  846. */
  847. U.MD.D.T.taskbar.dragMove = function (taskEle) {
  848. //计算拖动距离
  849. //U.MD.D.T.taskbar.dragX = U.UF.EL.getMousePosition().x - U.MD.D.T.taskbar.stratX;
  850. U.MD.D.T.taskbar.dragY = U.MD.D.T.taskbar.stratY - U.UF.EL.getMousePosition().y;
  851. //根据拖动距离计算透明度 最大拖动距离为100
  852. //var _opacity = 100 - U.MD.D.T.taskbar.dragX;
  853. var _opacity = 100 - U.MD.D.T.taskbar.dragY;
  854. //限制透明度值最小为1
  855. if (_opacity < 1) { _opacity = 1 };
  856. //设置CSS透明度属性
  857. U.selectEl(taskEle).css({
  858. //left: U.MD.D.T.taskbar.dragX + "px",
  859. bottom: U.MD.D.T.taskbar.dragY + "px",
  860. filter: "alpha(opacity=" + _opacity + ")",
  861. "-ms-filter": "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + _opacity + ")", //ie兼容设置
  862. "-moz-opacity": _opacity / 100,
  863. "-khtml-opacity": _opacity / 100, //其他浏览器兼容 firefox safari、chrome
  864. "opacity": _opacity / 100
  865. });
  866. }
  867. /**
  868. * 拖拽结束函数
  869. */
  870. U.MD.D.T.taskbar.dragEnd = function (taskEle) {
  871. if (U.MD.D.T.taskbar.dragY >50) {
  872. //若拖动距离大于40则执行关闭任务函数
  873. U.selectEl('.U_MD_D_T_taskbar_Close', taskEle)[0].onclick();
  874. }
  875. else {
  876. //否则执行打开函数,并设置回元素的样式
  877. U.selectEl(taskEle).css("cssText", U.MD.D.T.taskbar.preStyle);
  878. //taskEle.click();
  879. }
  880. }
  881. $(window).bind('onsize', U.MD.D.T.taskbar.multitask);;
  882. ///<jscompress sourcefile="Background.js" />
  883. Namespace.register("U.MD.D.B"); //背景设置
  884. U.MD.D.B.url = "/img/Background/ZMYT.jpg"; //默认背景设计图
  885. U.MD.D.B.backUrl = ""; //存放默认壁纸的全局变量
  886. /*
  887. * 作用: 弹出桌面背景框
  888. *
  889. */
  890. U.MD.D.B.init = function () {
  891. if ($("#U_MD_D_A_A")[0]) {//判断是否有系统图片
  892. return U.selectEl("#U_MD_D_A_A").css("display", "block")//显示系统图片
  893. }
  894. var _systemimg = U.selectEl("#U_MD_D_Set_BG").css("display", "block")[0]//显示系统图片
  895. //创建系统设置的弹窗
  896. var _system = new U.UF.UI.form("<div class='U_MD_F_S_TI'>系统设置</div>",
  897. _systemimg,
  898. {
  899. "id": "U_MD_D_A_A",
  900. "style": {
  901. "width": "746px",
  902. "height": "500px"
  903. }
  904. },
  905. {
  906. isnarrow: false,
  907. isenlarge: false
  908. }).form;
  909. U.MD.D.B.look(); //添加图片到_el
  910. return _system; //返回父级元素
  911. }
  912. /*
  913. * 作用: 打印默认可选择的背景图片
  914. *
  915. */
  916. U.MD.D.B.look = function () {
  917. var i, _img, _imgparent, //i循环所有图片 _img获取显示图片的div _imgparent获取创建包含图片的div层
  918. _frag = $$("frag"), //创建图片的最高级元素
  919. _url = "/img/Background/", //图片地址
  920. _pchild = U.selectEl($("#U_MD_D_Set_BG").childs()[0]).Child(), //获取父级元素的第一个子元素,并且获取默认壁纸div
  921. _imgname = ["3DBox", "cloud", "fruit", "green", "userbackgound", "Dream_train", "ZMYT"], //建立包含图片名称的对象
  922. _img = U.selectEl(_pchild[0]).Child()[1]; //获取显示图片的div
  923. _img.innerText = ""; //清空显示图片的div
  924. if (_imgname.hasOwnProperty) {//忽略从原型链继承的属性
  925. for (i = 0; i < _imgname.length; i++) {
  926. _imgparent = $$("div", { "className": "U_MD_D_Set_BG_OCO", "title": "设为背景",
  927. "onclick": U.UF.C.closure(function (i) {//U.UF.C.closure 解决闭包问题
  928. U.MD.D.B.setBackgroundImage(_url + _imgname[i] + ".jpg"); //给每一个默认壁纸图片添加点击事件
  929. }, [i])
  930. }, _frag); //创建包含图片的div
  931. _imgparent = $$("div", {}, _imgparent); ////创建包含图片的div的下层div_url + _imgname[i][j] + "(1)." + i
  932. 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); }); //获取图片 添加图片
  933. _imgparent.appendChild(_addimg); //添加图片到父级元素中,并显示出来
  934. }
  935. }
  936. _img.appendChild(_frag); //图片添加到默认图片
  937. }
  938. /*
  939. * 作用: 切割图片的路径包括图片文件夹和图片的名称的字符串数组
  940. * @param {array} imageurl 图片路径
  941. * return {array} 返回切割好的数组
  942. */
  943. U.MD.D.B.split = function (imageurl) {
  944. if (imageurl) {//参数有值
  945. var _i = imageurl.lastIndexOf("/"); //获取/最后出现的位置
  946. return [imageurl.substr(0, _i), imageurl.substr(_i + 1)]; //图片文件夹 和 图片的名称 的字符串数组
  947. }
  948. return ["", ""]; //返回切割好的数组
  949. }
  950. /*
  951. * 作用:同作用于服务器,通过数据库修改,完成壁纸的更改
  952. * @param {array} url 图片的路径
  953. * @param {string} str 图片的标识
  954. */
  955. U.MD.D.B.asyn = function (url, str) {
  956. if (!U.MD.U.L.isLogin()) {//判断用户是否登录,如果未登录,则弹出登录窗体
  957. url = url || U.MD.D.B.backUrl[0]; //获取图片的地址
  958. str = str || U.MD.D.B.backUrl[1]; //获取图片的标识
  959. US.userInfo.UserBackGroundImage = url; //讲图片的地址传入服务器中
  960. U.alert("修改中.."); //弹出提示框
  961. //插入数据库,并且通过数据返回数据出来。
  962. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "UpdateUserDesktopInfo", US.userInfo.UserId, url + "/" + str, "", ""],
  963. function () { U.alert("设置成功"); }); //对调函数,弹出提示框
  964. // U.A.Request('UseStudioManage.SetUserBackgroudnImage', [US.userInfo.UserId, url, str], function(){U.alert("设置成功");}, []);
  965. }
  966. }
  967. /*
  968. * 作用:点击网盘上传图片
  969. * @param {element} el 图片的元素
  970. * @param {array} url 图片的路径
  971. * @param {string} str 图片的标识
  972. */
  973. U.MD.D.B.disk = function (el, url, str) {
  974. U.MD.D.B.setBackgroundImage(url, "S"); //调用设置用户点击的背景图片的功能函数
  975. }
  976. /*
  977. * 作用:设置用户点击的背景图片
  978. * @param {array} imageurl 图片的地址
  979. * @param {string} typename 图片的标识
  980. */
  981. U.MD.D.B.setBackgroundImage = function (imageurl, typename) {
  982. var _el = U.selectEl("#U_MD_D_BG")[0]; //需要设置背景图片的地方
  983. typename = typename || "S"; //设置背景时 undefined 所以值是 "S"
  984. //如果没有传递需要设置的背景图片,那么就设置默认的背景图片
  985. if (imageurl == null) {//判断图片的路径是否正确
  986. imageurl = U.MD.D.B.url; //如果图片的路径传值为空的话,则图片路径为默认图片路径
  987. //判断是否有用户设置的图片路径,如果有,则改变全局变量的图片路径为用户设置的图片路径,如果没有,则用默认图片路径。
  988. U.MD.D.B.backUrl = US.userInfo.UserBackGroundImage ? U.MD.D.B.split(US.userInfo.UserBackGroundImage) : [U.MD.D.B.url, typename];
  989. } else {//如果图片的路径不为空
  990. U.MD.D.B.backUrl = [imageurl, typename]; //则全局变量为图片的路径的传值,以及图片的标识传值
  991. }
  992. //各种背景设置
  993. switch (typename) {
  994. case "T": //标识为T时
  995. //重叠出现
  996. U.selectEl(el).addAttrArray({//改变图片路径
  997. style: {
  998. background: "#F0F0F0 url(" + imageurl + ")"
  999. }
  1000. });
  1001. break; //跳出循环
  1002. case "M": //标识为M时
  1003. //原图大小
  1004. U.selectEl(el).addAttrArray({//改变图片为原图大小
  1005. style: {
  1006. background: "#F0F0F0 url(" + imageurl + ") 0 0 no-repeat"
  1007. }
  1008. });
  1009. break; //跳出循环
  1010. case "S": //标识为S时
  1011. //全屏展示
  1012. if (imageurl) {
  1013. U.selectEl(_el).addAttrArray({
  1014. style: {
  1015. filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + imageurl + ",sizingMethod=scale)",
  1016. background: "#F0F0F0 url(" + imageurl + ") 0 0 no-repeat",
  1017. backgroundSize: "100% 100%",
  1018. MozBackgroundSize: "100% 100%"
  1019. }
  1020. });
  1021. }
  1022. break; //全屏
  1023. default: break;
  1024. }
  1025. }
  1026. /*
  1027. * 作用:上传本地图片的设置
  1028. * @param {element} el 图片元素
  1029. */
  1030. U.MD.D.B.upload = function (el) { //上传图片设置
  1031. if (U.UF.UP.isImg(el.value)) {//判断是否是图片
  1032. //上传图片 调用上传函数,传入图片元素,上传地址,上传成功的回调函数,回调函数的传参
  1033. U.UF.UP.inputUpload([el], "http://disk.1473.cn/USUpfile.ashx?typename=UploadWallpaper", U.MD.D.B.asynUp, [el]);
  1034. }
  1035. }
  1036. /*
  1037. * 作用:上传背景的设置
  1038. * @param {element} url 图片的元素
  1039. */
  1040. U.MD.D.B.asynUp = function (url) { //上传背景设置
  1041. var i, _userchild, _imginfo, //i 循环图片文件信息的长度;_userchild 获取用户id的子元素;_imginfo获取图片的信息
  1042. _userinfo = US.userInfo; //用户信息
  1043. _userid = _userinfo.BHID, //用户的BHID?
  1044. _userchange = U.MD.DK.M.diskOperatingSwitch(_userinfo.UserId); //用户操作切换,可以查看多个用户的硬盘,所以需要切换。登录用户和非登录用户有不同权限。
  1045. r = url.value; //图片文件信息?
  1046. if (_userid && _userchange[_userid] && (_userchild = _userchange[_userid].Child)) {//false 不进去???
  1047. for (i = 0; i < r.length; i++) {//循环图片文件信息的长度
  1048. _imginfo = r[i]; //获取图片的信息
  1049. //上传文件成功后,由前端的数据结构生成一个数据实体,实际传参请参考函数里面的数据结构
  1050. _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)
  1051. _userchange[_userid].Child.push(_imginfo); //把上传文件成功的数据结构插入数组中
  1052. }
  1053. }
  1054. U.MD.D.B.setBackgroundImage(U.MD.C.getHeadImage(r[0].UserFilesServerName)); //设置背景
  1055. }
  1056. /*
  1057. * 作用:从网盘上传图片
  1058. * @param {element} url 图片的元素
  1059. */
  1060. U.MD.D.B.uploadByPan = function () {
  1061. U.MD.DK.VW.choseFile(function (obj) {
  1062. U.MD.D.B.setBackgroundImage('http://fs.1473.cn/' + obj.UserDirectoryUrl, 'S'); //给每一个默认壁纸图片添加点击事件
  1063. });
  1064. };
  1065. ///<jscompress sourcefile="AboutUs.js" />
  1066. Namespace.register("U.MD.D.A"); //桌面提示框
  1067. //#region 用户协议
  1068. /*
  1069. * 用户协议
  1070. *
  1071. * @param {element} 用户协议内容元素
  1072. */
  1073. U.MD.D.A.agreement = function (_el) {
  1074. return new U.UF.UI.form("<div class='U_MD_F_S_TI'>安全协议</div>",
  1075. U.selectEl(_el).parentElement().css("display", "block")[0],
  1076. {
  1077. "id": "U_MD_UI_UP_O",
  1078. "style": {
  1079. "width": "600px",
  1080. "height": "452px"
  1081. }
  1082. },
  1083. {
  1084. isnarrow: false,
  1085. isenlarge: false
  1086. }).form;
  1087. }
  1088. //#endregion
  1089. //#region 关于我们
  1090. /*
  1091. * 打开关于我们窗体
  1092. *
  1093. */
  1094. U.MD.D.A.aboutUs = function () {
  1095. var _el = U.selectEl("#U_MD_D_A_OT");
  1096. _el.css("display", "block");
  1097. new U.UF.UI.form("<div class='U_MD_F_S_TI'>关于我们</div>", _el[0],
  1098. {
  1099. "id": "U_MD_D_A_OT_A",
  1100. "style": {
  1101. "width": "920px",
  1102. "height": "600px"
  1103. }
  1104. },
  1105. {
  1106. isnarrow: false,
  1107. isenlarge: false
  1108. });
  1109. }
  1110. //#endregion
  1111. /*
  1112. * 浏览器更新窗体
  1113. *
  1114. */
  1115. U.MD.D.A.browserCompatibleForm = function () {
  1116. new U.UF.UI.form("<div class='U_MD_F_S_TI'>浏览器更新</div>",
  1117. U.selectEl("#U_MD_D_A")[0],
  1118. {
  1119. "id": "U_MD_D_A_A",
  1120. "style": {
  1121. "width": "970px",
  1122. "height": "605px"
  1123. }
  1124. },
  1125. {
  1126. isnarrow: false,
  1127. isenlarge: false
  1128. });
  1129. }
  1130. //#endregion;
  1131. ///<jscompress sourcefile="Disk.js" />
  1132. ///<jscompress sourcefile="Disk.js" />
  1133. Namespace.register("U.MD.DK"); //Disk的主命名空间
  1134. //#region 初始化网盘
  1135. //初始化网盘
  1136. //
  1137. //* @param {string} 用户id,可以是自己的用户id或者其他人的用户id。当为其他人的用户id时,为查看其他人的网盘信息
  1138. //* @param {string} 目录id
  1139. //* @returns {} 无
  1140. //
  1141. U.MD.DK.initDisk = function (userid, dirid) {
  1142. //判断用户id是否存在,如果不存在说明是桌面的点击,那么就必须要求用户登录
  1143. if (userid) {
  1144. //获取网盘弹窗
  1145. var _formdiv = U.selectEl("#U_D_" + userid)[0],
  1146. _diskinfo = US.disk.Disks[userid];
  1147. //如果网盘已经弹出,直接定位
  1148. if (_formdiv) {
  1149. U.UF.F.windowTopCenter(_formdiv);
  1150. U.selectEl("#U_MD_DK_LTXO", _formdiv)[0].innerHTML = ""; //清除树状图
  1151. //判断是否为本人网盘
  1152. //如果是的话则显示完整的左侧树目录
  1153. if (userid == US.userInfo.UserId) {
  1154. 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"])
  1155. }
  1156. //非本人操作的处理
  1157. else {
  1158. 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"])
  1159. }
  1160. U.MD.DK.openDirByDirID(userid, dirid); //导航到制定目录
  1161. }
  1162. //如果网盘没有弹出的处理
  1163. else if (!_diskinfo) {
  1164. var _diskel = U.selectEl("#U_MD_DK").clone(true)[0],
  1165. _loginuserid = US.userInfo.UserId || US.EMPTYGUID; //网盘内容元素
  1166. _diskel.id = "U_MD_DK__" + userid; //网盘内容的元素id设置为U_MD_DK__加上用户id
  1167. _diskel.style.display = "block"; //显示
  1168. //云盘拖拽
  1169. //$('.U_MD_DK_RZA', _diskel).bind('mousedown', function () { console.log(0); })
  1170. //窗体的事件处理,api中没有,需要补充。
  1171. _formdiv = new U.UF.UI.form("<div class='U_MD_F_S_TI'>网盘</div>",
  1172. _diskel, {
  1173. "onmousedown": function () {
  1174. U.MD.DK.M.diskOperatingSwitch(userid);
  1175. }, //鼠标单击事件。打开多个网盘时,切换网盘数据,此处需要修正,并删除.
  1176. "onresize": function () {
  1177. U.MD.DK.size(_diskel);
  1178. }, //窗体放大缩小时的处理。
  1179. "id": "U_D_" + userid,
  1180. "style": {
  1181. "width": "80%",
  1182. "height": "85%"
  1183. }
  1184. }).form;
  1185. //数据库获取指定用户指定目录下的网盘数据
  1186. U.A.Request(US.DISK, ["InitDisk", _loginuserid, userid, dirid], U.MD.DK.asynInitDisk, [_diskel, userid, dirid, US.userInfo.UserId || US.EMPTYGUID, _formdiv]); //服务器加载
  1187. }
  1188. return _formdiv;
  1189. //没有用户id说明用户没有登录点击桌面的网盘。
  1190. }
  1191. else {
  1192. U.MD.U.L.login();
  1193. }
  1194. }
  1195. /**
  1196. * 得到后台获取的用户数据
  1197. *
  1198. * @param {object} request返回值
  1199. * context 上下文之间的传参
  1200. * value服务器返回值 0 用户初始化定位到指定文件夹下面的所有文件和文件夹 1 用户的信息 2 用户的网盘信息
  1201. **/
  1202. U.MD.DK.asynInitDisk = function (r) {
  1203. var _dirinfo,
  1204. _context = r.context, //获取上下文传参
  1205. _diskel = _context[0], //disk内容元素
  1206. _userid = _context[1], //用户的id
  1207. _dirid = _context[2], //目录id
  1208. _loginuserid = _context[3], //用户登录id
  1209. _formdiv = _context[4], //网盘窗体元素
  1210. _value = r.value //数据库返回的值
  1211. ;
  1212. //判断根据用户id是否能获取到用户的资料
  1213. if (_value) {
  1214. //设置用户全局变量
  1215. var _diskinfo = U.MD.DK.setUserGlobalVariable(_userid, _dirid, _value);
  1216. //初始化左侧的头部样式
  1217. U.MD.DK.VW.followState(_formdiv, _userid, _loginuserid);
  1218. //初始化当前用户网盘前进后退
  1219. U.UF.N.createNav("disk" + _userid);
  1220. //初始化按钮点击事件
  1221. U.MD.DK.initDiskButton(_diskinfo);
  1222. //网盘大小初始化设置
  1223. U.MD.DK.size(_diskinfo.formel);
  1224. //初始化用户信息
  1225. U.MD.DK.initDiskUserInfo(_diskinfo);
  1226. //打印左边树目录信息
  1227. if (_diskinfo.userInfo.UserId == _diskinfo.operator) {
  1228. 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"])
  1229. }
  1230. else {
  1231. 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"])
  1232. }
  1233. U.MD.DK.openDirByDirID(_userid, _dirid); //导航到制定目录上
  1234. }
  1235. //获取用户资料失败
  1236. else {
  1237. U.alert("帐号不存在...");
  1238. //移除网盘窗体
  1239. U.selectEl(_diskinfo.formel).remove();
  1240. }
  1241. }
  1242. /**
  1243. * 根据目录id打开目录
  1244. *
  1245. * @param {string} 目录id
  1246. **/
  1247. U.MD.DK.openDirByDirID = function (userid, dirid) {
  1248. var _diskinfo = US.disk.Disks[userid];
  1249. if (_diskinfo) {
  1250. //导航到达指定的目录
  1251. //打开文件,目录及导航到达区域。因为现在是按需加载数据,不可能完全导航到达指定位置,则不做左边树目录展开功能
  1252. var _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { "UserDirectoryID": dirid })[0]; //获取当前需要打开的文件夹信息
  1253. //如果目录存在的处理
  1254. if (_dirinfo) {
  1255. //如果左边的目录可以输出的处理
  1256. if ($("#L" + _dirinfo["UserDirectoryID"], _diskinfo.formel)[0]) {
  1257. U.MD.DK.LL.leftTreeClick(_dirinfo, U.selectEl("#L" + _dirinfo["UserDirectoryID"], _diskinfo.formel)[0], userid); //打开该文件夹
  1258. }
  1259. //否则直接打印数据
  1260. else {
  1261. U.MD.DK.LE.openFileDirectory(_dirinfo, userid);
  1262. }
  1263. }
  1264. //目录查看不了或者是不允许查看
  1265. else {
  1266. //打印数据
  1267. U.MD.DK.VW.printContent([], U.selectEl("#U_MD_DK_RZ", _diskinfo.formel)[0]);
  1268. }
  1269. }
  1270. }
  1271. /**
  1272. * 打开应用
  1273. *
  1274. * @param {string} 用户id
  1275. * @param {string} 目录id
  1276. * @param {object} directoryOrFiles是dirid目录下所有的文件和文件夹 userInfo是用户的信息+用户的网盘信息
  1277. **/
  1278. U.MD.DK.setUserGlobalVariable = function (userid, dirid, diskinfo) {
  1279. var _dirinfo,
  1280. _basicdirectory = U.MD.DK.getBasicDirectory(diskinfo), //获取一级目录
  1281. _groupdirectory = U.MD.DK.getGroupDirectory(diskinfo.groups, _basicdirectory, diskinfo.userInfo.UserId) //获取群目录
  1282. ;
  1283. _basicdirectory = _basicdirectory.concat(_groupdirectory); //群和一级目录合并生成初始化目录
  1284. //_basicdirectory[1].Child = _groupdirectory; //把群添加到文档群的的下面,作为文件夹
  1285. //diskinfo.directoryOrFile是第一次进入的时候获取的文件夹下面的文件,那么这个时候就要添加到指定的目录的child里面
  1286. _dirinfo = U.Json.select(_basicdirectory, { "UserDirectoryID": dirid }, 1)[0];
  1287. if (!_dirinfo && diskinfo.currentdirectory[0]) {
  1288. _dirinfo = diskinfo.currentdirectory[0]; //获取服务器返回的当前目录
  1289. _dirinfo = new U.MD.DK.M.entity(_dirinfo.UserDirectoryID, 0,
  1290. _dirinfo.UserDirectoryParentID, _dirinfo.UserDirectoryName, _dirinfo.UserDirectoryName, _dirinfo.UserDirectoryExtendType,
  1291. "", _dirinfo.UserDirectoryAddTime, _dirinfo.UserDirectoryUrl, _dirinfo.UserDirectoryDeep, _dirinfo.UserDirectoryModifyTime,
  1292. _dirinfo.UserDirectoryEncrypt, 0, "", _dirinfo.GroupID);
  1293. _basicdirectory.push(_dirinfo);
  1294. }
  1295. //判断是在制定的以及目录下的子文件的处理
  1296. if (_dirinfo) {
  1297. _dirinfo.Child = diskinfo.directoryOrFiles;
  1298. U.Json.add(diskinfo.directoryOrFiles, { "Parent": _dirinfo });
  1299. }
  1300. diskinfo.directoryOrFiles = _basicdirectory.concat(diskinfo.directoryOrFiles); //基础目录加上dirid获取的数据
  1301. //设置用户的全局变量
  1302. US.disk.Disks[userid] = diskinfo; //diskinfo.directoryOrFiles是dirid目录下所有的文件和文件夹 userInfo是用户的信息+用户的网盘信息
  1303. US.disk.Disks[userid].formel = U.selectEl("#U_D_" + userid)[0]; //对应的网盘窗体元素
  1304. US.disk.Disks[userid].directoryid = dirid; //当前打开的目录id
  1305. US.disk.Disks[userid].currentDirectoryFile = []; //当前目录下所有的文件
  1306. US.disk.Disks[userid].operator = US.userInfo.UserId; //操作用户id
  1307. return US.disk.Disks[userid]; //返回用户网盘的信息
  1308. }
  1309. /**
  1310. * 获取一个一级目录
  1311. *
  1312. **/
  1313. U.MD.DK.getBasicDirectory = function (diskinfo) {
  1314. var i,
  1315. _diskdir = US.disk.initTree.concat(); //concat相当于数组的克隆,克隆一个一级目录数组
  1316. //补充disk网盘的全局变量数据 补充左边初始化目录数据我的电脑等
  1317. for (i = 0; i < _diskdir.length; i++) { //初始化查看
  1318. //创建一个一级目录对象
  1319. _diskdir[i] = new U.MD.DK.M.entity(_diskdir[i][0], _diskdir[i][1], _diskdir[i][2], _diskdir[i][3], _diskdir[i][4],
  1320. _diskdir[i][5], _diskdir[i][6], _diskdir[i][7], _diskdir[i][8], _diskdir[i][9],
  1321. _diskdir[i][10], _diskdir[i][11], _diskdir[i][12], _diskdir[i][13], _diskdir[i][14],
  1322. _diskdir[i][15], diskinfo.userInfo.UserId, diskinfo.userInfo.UserNickName, diskinfo.userInfo.UserName, diskinfo.userInfo.UserThumbnailImageHead);
  1323. };
  1324. //返回一级目录
  1325. return _diskdir;
  1326. }
  1327. /**
  1328. * 生成群目录
  1329. * @param {array} 群数组
  1330. * @param {array} 目录id
  1331. * @param {string} 用户id
  1332. *
  1333. **/
  1334. U.MD.DK.getGroupDirectory = function (groups, basicdirectory, userid) {
  1335. if (groups != null) {
  1336. var i, _diskgroupinfo; //concat相当于数组的克隆,克隆一个一级目录数组
  1337. //还没有初始化群的处理
  1338. if (!basicdirectory[1].Child) {
  1339. basicdirectory[1].Child = [];
  1340. }
  1341. //还没有初始化群的处理
  1342. if (!basicdirectory[2].Child) {
  1343. basicdirectory[2].Child = [];
  1344. }
  1345. //补充disk网盘的全局变量数据 补充左边初始化目录数据我的电脑等
  1346. for (i = 0; i < groups.length; i++) { //初始化查看
  1347. _diskgroupinfo = groups[i];
  1348. //创建一个一级目录对象
  1349. groups[i] = new U.MD.DK.M.entity(groups[i].GroupManageID, 0, US.EMPTYGUID, groups[i].GroupManageName,
  1350. groups[i].GroupManageName, "folder", null, U.UF.D.toTimeStamp(new Date()), U.MD.DK.C.getIcon("folder")[1],
  1351. 1, null, null, 0, "", groups[i].GroupManageID, null, groups[i].GroupManageUserID, groups[i].GroupManageName, groups[i].GroupManageName);
  1352. //如果是群主的处理,那么就做为协同文件
  1353. if (_diskgroupinfo.GroupManageCreateUserID == userid) {
  1354. basicdirectory[1].Child.push(groups[i]);
  1355. groups[i].Parent = basicdirectory[1];
  1356. }
  1357. //非群主的,作为协同他人的处理
  1358. else {
  1359. basicdirectory[2].Child.push(groups[i]);
  1360. groups[i].Parent = basicdirectory[2];
  1361. }
  1362. };
  1363. }
  1364. //返回一级目录
  1365. return groups || [];
  1366. }
  1367. /**
  1368. * 初始化硬盘点击按钮
  1369. *
  1370. * @param {string} 用户网盘信息
  1371. **/
  1372. U.MD.DK.initDiskButton = function (diskinfo) {
  1373. var _navchildel = U.selectEl("#U_MD_DK_RKZ", diskinfo.formel).Child(),
  1374. _viewchildel = U.selectEl("#U_MD_DK_RM", diskinfo.formel).Child(),
  1375. _child = U.selectEl("#U_MD_DK_RY", diskinfo.formel).Child(),
  1376. _headchild = U.selectEl("#U_MD_DK_RT", diskinfo.formel).Child(),
  1377. _userid = diskinfo.userInfo.UserId,
  1378. _el = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0]
  1379. ; //头部新建文件夹等按钮
  1380. //上传事件
  1381. _headchild[0].onclick = function () {
  1382. U.MD.DK.C.upload(diskinfo);
  1383. }
  1384. //新建目录事件
  1385. _headchild[1].onclick = function () {
  1386. U.MD.DK.RE.newFolder(diskinfo);
  1387. }
  1388. //新建文本事件
  1389. _headchild[2].onclick = function () {
  1390. U.MD.DK.RE.newText(diskinfo);
  1391. }
  1392. //新建文档事件
  1393. _headchild[3].onclick = function () {
  1394. U.MD.DK.RE.newDocument(diskinfo);
  1395. }
  1396. //新建导航文档事件
  1397. _headchild[4].onclick = function () {
  1398. U.MD.DK.RE.newopenApplication(diskinfo);
  1399. }
  1400. //新建表格事件
  1401. _headchild[5].onclick = function () {
  1402. U.MD.DK.RE.newExcel(diskinfo);
  1403. }
  1404. //创建站点
  1405. _headchild[6].onclick = function () {
  1406. var _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": diskinfo.directoryid })[0];
  1407. //如果是初始化目录的处理
  1408. if (_dirinfo.UserDirectoryDeep == 0) {
  1409. window.open('http://' + diskinfo.directoryid + '.1473.cn?userid=' + diskinfo.userInfo.UserId);
  1410. }
  1411. //非初始化目录
  1412. else if (_dirinfo.UserDirectoryDeep == 1) {
  1413. window.open('http://' + diskinfo.directoryid + '.1473.cn?userid=' + _dirinfo.UserId);
  1414. } else {
  1415. window.open('http://' + diskinfo.directoryid + '.1473.cn');
  1416. }
  1417. }
  1418. //前进事件
  1419. _child[0].onclick = function () {
  1420. U.UF.N.backOff("disk" + _userid); //前进事件
  1421. }
  1422. //后退事件
  1423. _child[1].onclick = function () {
  1424. U.UF.N.goAhead("disk" + _userid); //后退事件
  1425. }
  1426. //刷新按钮
  1427. _child[2].onclick = function () {
  1428. U.MD.DK.RE.refresh(_userid, U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": diskinfo.directoryid })[0], diskinfo); //刷新函数
  1429. }
  1430. //右键菜单点击处理
  1431. _el.oncontextmenu = function () {
  1432. U.MD.DK.RM.rightMenu(null, null, diskinfo);
  1433. };
  1434. //拖选元素处理
  1435. _el.onmousedown = function () {
  1436. U.MD.DK.C.selectElement(_el, diskinfo);
  1437. };
  1438. //左键点击空白处理
  1439. U.UF.EV.addElementEvent("mousedown", window, function () {
  1440. U.selectEl("#U_MD_DK_M", diskinfo.formel)[0].style.display = "none";
  1441. });
  1442. //时间排序按钮
  1443. _navchildel[0].onclick = function () {
  1444. U.MD.DK.VW.SortView(diskinfo, "UserDirectoryAddTime", function (timeone, timetwo) {
  1445. return U.UF.D.sizeComparison(timeone, timetwo) == false;
  1446. }); //时间排序处理
  1447. }
  1448. //普通视图
  1449. _navchildel[1].onclick = function () {
  1450. //视图按钮切换
  1451. _navchildel[1].className = "U_MD_DK_RKZOI U_MD_DK_Img U_MD_DK_RKZOS U_MD_DK_RKZOSI";
  1452. _navchildel[2].className = "U_MD_DK_RKZOI U_MD_DK_Img U_MD_DK_RKZOP";
  1453. //普通视图
  1454. U.MD.DK.VW.viewsSwitch("Normal", diskinfo);
  1455. }
  1456. //详细视图
  1457. _navchildel[2].onclick = function () {
  1458. //视图按钮切换
  1459. _navchildel[1].className = "U_MD_DK_RKZOI U_MD_DK_Img U_MD_DK_RKZOS";
  1460. _navchildel[2].className = "U_MD_DK_RKZOI U_MD_DK_Img U_MD_DK_RKZOP U_MD_DK_RKZOPI";
  1461. //详细视图
  1462. U.MD.DK.VW.viewsSwitch("Detailed", diskinfo);
  1463. }
  1464. //文件名排序
  1465. _viewchildel[2].onclick = function () {
  1466. U.MD.DK.VW.SortView(diskinfo, "UserallDirectoryName", function (dirnameone, dirnametwo) { //时间排序处理
  1467. return dirnameone.localeCompare(dirnametwo, "zh") == 1;
  1468. });
  1469. }
  1470. //分享次数排序,暂时分享次数没有用处
  1471. // _child[2].onclick = function () {
  1472. // U.MD.DK.VW.SortView(diskinfo, "", function (timeone, timetwo) {
  1473. // return U.UF.D.sizeComparison(timeone, timetwo) == false;
  1474. // }); //时间排序处理
  1475. // }
  1476. //来源名字排序
  1477. _viewchildel[6].onclick = function () {
  1478. U.MD.DK.VW.SortView(diskinfo, "UserNickName", function (nameone, nametwo) { //根据用户名排序
  1479. return nameone.localeCompare(nametwo, "zh") == 1;
  1480. });
  1481. }
  1482. //类型排序
  1483. _viewchildel[8].onclick = function () {
  1484. U.MD.DK.VW.SortView(diskinfo, "UserDirectoryExtendType", function (typeone, typetwo) { //根据类型排序
  1485. return typeone.localeCompare(typetwo, "zh") == 1;
  1486. });
  1487. }
  1488. //大小排序排序
  1489. _viewchildel[10].onclick = function () {
  1490. U.MD.DK.VW.SortView(diskinfo, "UserDirectorySize", function (sizeone, sizetwo) { //根据文件大小排序
  1491. return sizeone > sizetwo;
  1492. });
  1493. }
  1494. //时间排序排序
  1495. _viewchildel[12].onclick = function () {
  1496. U.MD.DK.VW.SortView(diskinfo, "UserDirectoryAddTime", function (timeone, timetwo) { //根据添加事件排序
  1497. return U.UF.D.sizeComparison(timeone, timetwo) == 1;
  1498. });
  1499. }
  1500. }
  1501. /**
  1502. * 打印网盘用户资料
  1503. *
  1504. * @param {string} 用户网盘信息
  1505. **/
  1506. U.MD.DK.initDiskUserInfo = function (diskinfo) {
  1507. var _formel = diskinfo.formel,
  1508. _userinfo = diskinfo.userInfo,
  1509. _child
  1510. ;
  1511. //用户头像
  1512. $$("img", { "onerror": U.MD.C.imgError,
  1513. "onerror": U.MD.C.imgError,
  1514. "title": "点击查看",
  1515. "src": U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead)
  1516. }, U.selectEl("#U_MD_DK_LIL", _formel)[0]);
  1517. //用户名
  1518. U.selectEl("#U_MD_DK_LIRN", _formel)[0].innerText = _userinfo.UserNickName || _userinfo.UserName;
  1519. //用户个人简介
  1520. U.selectEl("#U_MD_DK_LIRZ", _formel)[0].innerText = _userinfo.UserIndividualitysignature || "暂无个人简介";
  1521. //用户硬盘信息打印
  1522. _child = U.selectEl("#U_MD_DK_LS", _formel).find("div");
  1523. _child[4].innerText = U.UF.UP.minUnitToMaxUnit(_userinfo.UserDiskSpace + "M"); //用户有多少网盘空间
  1524. _child[7].innerText = U.UF.UP.minUnitToMaxUnit(_userinfo.FileSize + "B"); //用户用了多少网盘空间
  1525. }
  1526. /**
  1527. * 网盘大小调整
  1528. *
  1529. * @param {element} 网盘窗体元素
  1530. **/
  1531. U.MD.DK.size = function (formel) {
  1532. var _contentel = U.selectEl("#U_MD_DK_RZ", formel); //获取中间显示内容区域的大小
  1533. _contentel.css("height", _contentel.Parent(2).offsetHeight - 79 + "px"); //设置内容区域的大小
  1534. }
  1535. //#endregion
  1536. ;
  1537. ///<jscompress sourcefile="DiskCommon.js" />
  1538. Namespace.register("U.MD.DK.C"); //网盘功能使用区域
  1539. /**
  1540. * 获取目录树的一条线上的所有祖先
  1541. * @param {string} 操作的目录id
  1542. * @param {array} 用户的网盘信息
  1543. * @param {object} 在该目录下操作的文件
  1544. * @return {array} 得到操作权限数组
  1545. */
  1546. U.MD.DK.C.getAncestors = function (fileinfo, diskinfo) {
  1547. var _dirinfo = fileinfo, //目录数据
  1548. _ancestors = [] //这里是需要返回的祖先
  1549. ;
  1550. //不断的循环寻找自己的祖先
  1551. while (_dirinfo) {
  1552. _ancestors.push(_dirinfo); //找到后追加
  1553. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": _dirinfo.UserDirectoryParentID }, 1)[0]; //设置搜索的目录id为上级的id不断的向上搜索祖先
  1554. }
  1555. return _ancestors; //返回自己的祖先元素
  1556. }
  1557. /**
  1558. * 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1559. * @param {string} 操作的目录id
  1560. * @param {array} 用户的网盘信息
  1561. * @return {array} 文件的权限信息
  1562. * 0 目录id
  1563. * 1-n 所有涉及到权限信息 (1只允许上传 2只允许下载)
  1564. **/
  1565. U.MD.DK.C.readWritePermission = function (dirid, diskinfo) {
  1566. var i,
  1567. _permi,
  1568. _dirs = [],
  1569. _returns = [],
  1570. _fileinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": dirid }, 1)[0] //获取当前操作目录的目录信息
  1571. ;
  1572. //该目录未加载或者该目录id加载的不是目录,如我的协同、最近文件等
  1573. if (_fileinfo) {
  1574. //获取当前操作的目录所有的祖先文件夹
  1575. _dirs = U.MD.DK.C.getAncestors(_fileinfo, diskinfo);
  1576. _returns.push(_dirs);
  1577. //循环所有的祖先集,找出读写权限
  1578. for (i = 0; i < _dirs.length; i++) {
  1579. _permi = _dirs[i].UserDirectoryEncrypt; //获取该目录的操作权限的方式
  1580. if (_permi == "1" || _permi == "2") { //判断是否有上传下载权限
  1581. _returns.push(_permi); break;
  1582. }
  1583. } //获取权限
  1584. }
  1585. return _returns;
  1586. }
  1587. /**
  1588. * 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1589. * @param {string} 操作的目录id
  1590. * @param {array} 用户的网盘信息
  1591. * @param {object} 在该目录下操作的文件
  1592. * @return {array} 得到操作权限数组
  1593. * 0 判断该目录是否允许上传 1、自己建立的目录是可以下载的 2、没有限制只允许上传的可以下载
  1594. * 1 判断该目录是否允许下载 1、自己建立的目录是可以上传的 2、ftp中没有限制只允许上传的是可以下载
  1595. * 2 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1596. * 3 获取上传的目录用户对应的临时目录
  1597. * 4 判断操作的文件是否有本人有关 包含是本人创建、本人网盘里、在本人创建的群里
  1598. */
  1599. U.MD.DK.C.getDirectoryPermissions = function (fileordirid, diskinfo) {
  1600. diskinfo = diskinfo || US.disk.UserDisk; //需要操作的当前用户的网盘信息
  1601. var _isftp, //是否操作ftp
  1602. _ismyself, //是否操作本人网盘内容
  1603. _isuserdisk, //是否在自己的网盘中
  1604. _isgroup, //是否在群里
  1605. _isgroupmain,
  1606. _permissions = US.permission.getDiskPermission(), //调用方法,从权限变量文件中获取克隆一份权限
  1607. _permissioninfo = U.MD.DK.C.readWritePermission(fileordirid, diskinfo), //获取权限
  1608. _dirinfo = _permissioninfo[0][_permissioninfo[0].length - 1], //所操作的文件或者是文件夹所操作的目录
  1609. _currentfileordir = _permissioninfo[0][0], //当前操作的文件或者文件夹
  1610. _readwrite = _permissioninfo.splice(1) //得到文件的读写权限和祖先元素
  1611. ;
  1612. //如果是未登录、群、最新文档,协同文档,则没有权限操作
  1613. if (_currentfileordir && !US.userInfo.UserId || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[0].UserDirectoryID || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[1].UserDirectoryID || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[2].UserDirectoryID) {
  1614. _permissions.isopen = false; //是否允许打开, 现在所有的文件都有打开权限
  1615. _permissions.isupadte = false; //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1616. _permissions.isdelete = false; //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1617. _permissions.iscopy = false; //是否允许复制,现在所有的文件都有复制权限
  1618. _permissions.isshear = false; //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1619. _permissions.isencryption = false; //是否允许加密,展示取消这个功能。
  1620. _permissions.isreply = false; //是否允许加密,展示取消这个功能。
  1621. _permissions.isdownload = false; //是否允许下载,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1622. _permissions.isnew = false; //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1623. _permissions.ispaste = false; //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1624. _permissions.isrefresh = false; //是否允许刷新, 现在所有的文件都有刷新权限
  1625. _permissions.isupload = false; //是否允许上传,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  1626. _permissions.isview = false; //是否允许视图切换,所有的文件夹都支持
  1627. _permissions.isedit = false; //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  1628. }
  1629. else {
  1630. //在我的ftp中,我可以操作所有人的东西,我具备所有的权限
  1631. _isgroup = _dirinfo.GroupID != ""; //是否是群文件
  1632. _isftp = _currentfileordir.GroupID == ""; //判断是否为ftp目录下的文件
  1633. //_isftp = diskinfo.userInfo.UserId == _currentfileordir.UserId; //判断是否为ftp目录下的文件
  1634. _isuserdisk = (diskinfo.userInfo.UserId == diskinfo.operator); //是否是属于自己的网盘
  1635. _isgroupmain = U.Json.select(diskinfo.groups, { "UserDirectoryID": _dirinfo.GroupID, "UserId": diskinfo.operator }).length > 0; //判断自己是否是群主
  1636. _ismyself = _currentfileordir.UserId == diskinfo.operator; //判断是否是操作本人的文件,群里的文件非本人创建的或者不是自己的群都不为自己的文件
  1637. //在我的ftp中,我可以操作所有人的东西,我具备所有的权限
  1638. //判断是否为本人操作
  1639. if (!_isuserdisk) {
  1640. //如果不是,为外来访客
  1641. //判断是否为ftp文件,如果不是
  1642. if (!_isftp) {
  1643. _permissions.isnew = false; //不允许新建
  1644. _permissions.isopen = false; //不允许打开
  1645. }
  1646. //判断是否为本人文件,如果不是
  1647. if (!_ismyself) {
  1648. _permissions.isupadte = false; //不允许修改
  1649. _permissions.isdelete = false; //不允许删除
  1650. _permissions.isshear = false; //不允许剪切
  1651. _permissions.isencryption = false; //不允许加密
  1652. _permissions.ispaste = false; //不允许粘贴
  1653. _permissions.isedit = false; //不允许编辑
  1654. }
  1655. } else {
  1656. //如果是自己的文件夹中
  1657. //判断是否为他人邀请文件夹,如果是
  1658. //判断是否为自己的文件,如果不是
  1659. if (_isgroup && !_ismyself && !_isgroupmain) {
  1660. _permissions.isupadte = false; //不允许修改
  1661. _permissions.isdelete = false; //不允许删除
  1662. _permissions.isshear = false; //不允许剪切
  1663. _permissions.isencryption = false; //不允许加密
  1664. _permissions.ispaste = false; //不允许粘贴
  1665. _permissions.isedit = false; //不允许编辑
  1666. }
  1667. //判断是否为协同文档的第一层,协同群,如果是
  1668. if (_isgroup && _currentfileordir.UserDirectoryDeep == 1) {
  1669. _permissions.isupadte = false; //不允许修改
  1670. _permissions.isdelete = false; //不允许删除
  1671. _permissions.isshear = false; //不允许剪切
  1672. _permissions.isencryption = false; //不允许加密
  1673. _permissions.ispaste = false; //不允许粘贴
  1674. _permissions.isedit = false; //不允许编辑
  1675. _permissions.iscopy = false; //不予许复制
  1676. _permissions.isdownload = false; //不予许下载
  1677. if (_currentfileordir.UserDirectoryName == "我的协同" || _currentfileordir.UserDirectoryName == "他人邀请") {
  1678. _permissions.isnew = false; //不允许新建
  1679. }
  1680. }
  1681. }
  1682. //1只允许上传
  1683. if (!_ismyself && _readwrite.indexOf("1") > -1) {
  1684. _permissions.isdownload = false; //不允许下载
  1685. _permissions.copy = false; //不允许复制
  1686. _permissions.isshear = false; //不允许剪切
  1687. }
  1688. //2只允许下载
  1689. if (!_ismyself && _readwrite.indexOf("2") > -1) {
  1690. _permissions.isnew = false; //不允许新建
  1691. _permissions.isupload = false; //不允许上传
  1692. _permissions.ispaste = false; //不允许粘贴
  1693. }
  1694. //如果是文件的话就没有视图模式
  1695. if (fileordirid && fileordirid.filetype == 1) {
  1696. _permissions.isview = false;
  1697. }
  1698. else {
  1699. _permissions.isreply = false;
  1700. }
  1701. if (!diskinfo.pasteDirOrFile) {
  1702. _permissions.ispaste = false; //不允许粘贴
  1703. }
  1704. }
  1705. //选择了多目录的处理
  1706. if (diskinfo.selectElement && diskinfo.selectElement.length > 1) {
  1707. _permissions.isopen = false; //取消同时打开的功能
  1708. _permissions.isupadte = false; //取消修改的功能
  1709. }
  1710. diskinfo.permissions = _permissions; //设置权限
  1711. return _permissions;
  1712. }
  1713. /**
  1714. * 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1715. * @param {string} 操作的目录id
  1716. * @param {array} 用户的网盘信息
  1717. * @param {object} 在该目录下操作的文件
  1718. * @return {array} 得到操作权限数组
  1719. * 0 判断该目录是否允许上传 1、自己建立的目录是可以下载的 2、没有限制只允许上传的可以下载
  1720. * 1 判断该目录是否允许下载 1、自己建立的目录是可以上传的 2、ftp中没有限制只允许上传的是可以下载
  1721. * 2 判断是否具有添加网盘的操作权限 判断是否有添加的权限 和 获取的权限
  1722. * 3 获取上传的目录用户对应的临时目录
  1723. * 4 判断操作的文件是否有本人有关 包含是本人创建、本人网盘里、在本人创建的群里
  1724. U.MD.DK.C.getDirectoryPermissions = function (fileordirid, diskinfo) {
  1725. diskinfo = diskinfo || US.disk.UserDisk; //需要操作的当前用户的网盘信息
  1726. var _isftp, //是否操作ftp
  1727. _ismyself, //是否操作本人网盘内容
  1728. _isuserdisk, //是否在自己的网盘中
  1729. _isgroup, //是否在群里
  1730. _isgroupmain,
  1731. _permissions = { //所有的权限
  1732. "isopen": true, //是否允许打开, 现在所有的文件都有打开权限
  1733. "isupadte": true, //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1734. "isdelete": true, //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1735. "iscopy": true, //是否允许复制,现在所有的文件都有复制权限
  1736. "isshear": true, //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1737. "isencryption": false, //是否允许加密,展示取消这个功能。
  1738. "isreply": true, //是否允许加密,展示取消这个功能。
  1739. "isdownload": true, //是否允许下载,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1740. "isnew": true, //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1741. "ispaste": true, //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1742. "isrefresh": true, //是否允许刷新, 现在所有的文件都有刷新权限
  1743. "isupload": true, //是否允许上传,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  1744. "isview": true, //是否允许视图切换,所有的文件夹都支持
  1745. "isedit": true //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  1746. },
  1747. _permissioninfo = U.MD.DK.C.readWritePermission(fileordirid, diskinfo), //获取权限
  1748. _dirinfo = _permissioninfo[0][_permissioninfo[0].length - 1], //所操作的文件或者是文件夹所操作的目录
  1749. _currentfileordir = _permissioninfo[0][0], //当前操作的文件或者文件夹
  1750. _readwrite = _permissioninfo.splice(1) //得到文件的读写权限和祖先元素
  1751. ;
  1752. //如果是未登录、群、最新文档,协同文档,则没有权限操作
  1753. if (_currentfileordir && !US.userInfo.UserId || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[0].UserDirectoryID || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[1].UserDirectoryID || _currentfileordir.UserDirectoryID == diskinfo.directoryOrFiles[2].UserDirectoryID) {
  1754. _permissions = { //所有的权限
  1755. "isopen": false, //是否允许打开, 现在所有的文件都有打开权限
  1756. "isupadte": false, //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1757. "isdelete": false, //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1758. "iscopy": false, //是否允许复制,现在所有的文件都有复制权限
  1759. "isshear": false, //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1760. "isencryption": false, //是否允许加密,展示取消这个功能。
  1761. "isreply": false, //是否允许加密,展示取消这个功能。
  1762. "isdownload": false, //是否允许上传,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1763. "isnew": false, //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1764. "ispaste": false, //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1765. "isrefresh": false, //是否允许刷新, 现在所有的文件都有刷新权限
  1766. "isupload": false, //是否允许下载,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  1767. "isview": false, //是否允许视图切换,所有的文件夹都支持
  1768. "isedit": false //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  1769. }
  1770. }
  1771. // //如果是群目录下的处理
  1772. // else if (_currentfileordir.filetype == 0 && _dirinfo.GroupID == _currentfileordir.GroupID) {
  1773. // _permissions = { //所有的权限
  1774. // "isopen": false, //是否允许打开, 现在所有的文件都有打开权限
  1775. // "isupadte": false, //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1776. // "isdelete": false, //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1777. // "iscopy": false, //是否允许复制,现在所有的文件都有复制权限
  1778. // "isshear": false, //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  1779. // "isencryption": false, //是否允许加密,展示取消这个功能。
  1780. // "isreply": true, //是否允许加密,展示取消这个功能。
  1781. // "isdownload": false, //是否允许上传,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1782. // "isnew": true, //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1783. // "ispaste": true, //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  1784. // "isrefresh": true, //是否允许刷新, 现在所有的文件都有刷新权限
  1785. // "isupload": true, //是否允许下载,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  1786. // "isview": true, //是否允许视图切换,所有的文件夹都支持
  1787. // "isedit": true //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  1788. // }
  1789. // }
  1790. else {
  1791. //在我的ftp中,我可以操作所有人的东西,我具备所有的权限
  1792. _isgroup = _dirinfo.GroupID != null; //是否是群文件
  1793. _isftp = _dirinfo.GroupID == _currentfileordir.GroupID; //判断是否为ftp目录下的文件
  1794. _isuserdisk = (diskinfo.userInfo.UserId == diskinfo.operator); //是否是属于自己的网盘
  1795. _isgroupmain = U.Json.select(diskinfo.groups, { "UserDirectoryID": _dirinfo.GroupID, "UserId": diskinfo.operator }).length > 0; //判断自己是否是群主
  1796. _ismyself = _currentfileordir.UserId == diskinfo.operator; //判断是否是操作本人的文件,群里的文件非本人创建的或者不是自己的群都不为自己的文件
  1797. //不是自己的文件,同时不是在ftp,或者不是群主的处理
  1798. if (!_ismyself && !_isftp && !_isgroupmain) {
  1799. _permissions.isupadte = false; //不允许修改
  1800. _permissions.isdelete = false; //不允许删除
  1801. _permissions.isshear = false; //不允许剪切
  1802. _permissions.isencryption = false; //不允许加密
  1803. _permissions.ispaste = false; //不允许粘贴
  1804. _permissions.isedit = false; //不允许编辑
  1805. //如果不是ftp连新建的权限也取消
  1806. if (!_isftp) {
  1807. _permissions.isnew = false; //不允许新建
  1808. }
  1809. }
  1810. //1只允许上传
  1811. if (!_ismyself && _readwrite.indexOf("1") > -1) {
  1812. _permissions.isdownload = false; //不允许下载
  1813. _permissions.copy = false; //不允许复制
  1814. _permissions.isshear = false; //不允许剪切
  1815. }
  1816. //2只允许下载
  1817. if (!_ismyself && _readwrite.indexOf("2") > -1) {
  1818. _permissions.isnew = false; //不允许新建
  1819. _permissions.isupload = false; //不允许上传
  1820. _permissions.ispaste = false; //不允许粘贴
  1821. }
  1822. //如果是文件的话就没有视图模式
  1823. if (fileordirid && fileordirid.filetype == 1) {
  1824. _permissions.isview = false;
  1825. }
  1826. else {
  1827. _permissions.isreply = false;
  1828. }
  1829. if (!diskinfo.pasteDirOrFile) {
  1830. _permissions.ispaste = false; //不允许粘贴
  1831. }
  1832. }
  1833. //选择了多目录的处理
  1834. if (diskinfo.selectElement && diskinfo.selectElement.length > 1) {
  1835. _permissions.isopen = false; //取消同时打开的功能
  1836. _permissions.isupadte = false; //取消修改的功能
  1837. }
  1838. diskinfo.permissions = _permissions; //设置权限
  1839. return _permissions;
  1840. }
  1841. */
  1842. /**
  1843. * 弹出选择网盘还是上传
  1844. *
  1845. * @param {string} 文件的后缀
  1846. * @return {object}
  1847. */
  1848. U.MD.DK.C.getIcon = function (extendtype) {
  1849. var i,
  1850. _application = US.disk.applicationTypes //获取所有打开应用的信息
  1851. ;
  1852. if (extendtype) {
  1853. //循环信息中找到指定的应用的信息
  1854. for (i in _application) {
  1855. //找到后缀名对应的程序信息
  1856. if (_application[i].types.indexOf(extendtype.toLowerCase()) > -1) {
  1857. return _application[i]; //返回应用的信息
  1858. }
  1859. }
  1860. }
  1861. return _application["unknownfile"]; //如果是本站未知的后缀直接归属于文件
  1862. }
  1863. /**
  1864. * 网盘上传的处理
  1865. * @param {object} 获取服务器返回值
  1866. * @param {string} 上传文件的唯一识别id
  1867. */
  1868. U.MD.DK.C.upload = function (diskinfo) {
  1869. //判断该目录是否允许上传的处理
  1870. if (diskinfo.permissions.isupload) {
  1871. var _groupid,
  1872. _ancestors,
  1873. _directoryid = diskinfo.directoryid,
  1874. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": _directoryid })[0]
  1875. ;
  1876. //获取粘贴到制定目录的群id
  1877. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  1878. //如果是ftp目录,那么groupid就是用户id
  1879. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  1880. _groupid = diskinfo.userInfo.UserId;
  1881. }
  1882. //否则就是对应的群id,如果不存在那么就是""
  1883. else {
  1884. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  1885. }
  1886. //调用上传处理
  1887. U.MD.UI.upload(
  1888. "http://disk.1473.cn/USUpfile.ashx?typename=UploadFlashfile&DirectoryId=" + _directoryid + "&Encrypt=" + _groupid + "&UserId=" + US.userInfo.UserId + "&IsF=true", //上传的地址
  1889. //上传成功的回调函数
  1890. function (r, fileinfo) {
  1891. var _data = r.data //获取服务器返回值
  1892. ; //根据文件的唯一识别id获取文件的信息
  1893. //获取从服务器获取的值,这里加一个错误处理,因为如果后台出现了错误,那么eval的过程就会失败
  1894. try {
  1895. _data = eval("0," + _data);
  1896. }
  1897. catch (e) { }
  1898. //文件上传成功
  1899. if (_data) {
  1900. U.MD.DK.C.success({
  1901. "UserFilesServerName": _data[0], //上传成功后存在fs.1473.cn的地址
  1902. "UseFilesServerThumbnailName": _data[1], //如果是图片上传,那么这里有缩略图的地址
  1903. "UserFilesID": _data[2], //文件在数据的id
  1904. "size": _data[3], //文件的大小
  1905. "UserDirectoryEncrypt": _data[4], //文件的加密情况,这里和分组id是一样的
  1906. "UserDirectoryID": _data[5], //文件归属的目录id
  1907. "UserDirectoryName": fileinfo.name
  1908. }, _dirinfo, diskinfo);
  1909. }
  1910. },
  1911. //得到md5的回调函数
  1912. function (md5, fileinfo, cb) {
  1913. //根据用户的md5值判断用户是否需要上传,如果需要上传则需要执行上传处理,如果已经存在后台直接给用户生成文件路径等录入数据库
  1914. U.A.Request(US.DISK, ["IfFileExistInsertDB", US.userInfo.UserId, _directoryid, _groupid, fileinfo.size, md5, U.UF.UP.getFileNameAndExtension(fileinfo.name)[1], fileinfo.name],
  1915. //判断上传文件是否存在
  1916. function (r) {
  1917. var _userid = US.userInfo.UserId; //当前登录用户的id
  1918. r = r.value;
  1919. //获取服务器返回的值,如果服务器响应出问题了,eval的时候就会报错。
  1920. try {
  1921. r = eval(r)[0];
  1922. }
  1923. catch (e) { }
  1924. //当用户想上传的文件已经在数据库里存在了,那么后台会执行复制数据的操作。
  1925. if (r) {
  1926. U.MD.DK.C.success({
  1927. "UserFilesServerName": r.UserFilesServerName, //上传成功后存在fs.1473.cn的地址
  1928. "UseFilesServerThumbnailName": r.UserDirectoryUrl, //如果是图片上传,那么这里有缩略图的地址
  1929. "UserFilesID": r.UserDirectoryID, //文件在数据的id
  1930. "size": r.UserDirectorySize, //文件的大小
  1931. "UserDirectoryEncrypt": r.UserDirectoryEncrypt, //文件的加密情况,这里和分组id是一样的
  1932. "UserDirectoryID": r.UserDirectoryParentID, //文件归属的目录id
  1933. "UserDirectoryName": r.UserDirectoryName
  1934. }, _dirinfo, diskinfo);
  1935. cb(false);
  1936. }
  1937. //否则调用flash里面的函数执行用户的上传操作。
  1938. else {
  1939. cb(true);
  1940. }
  1941. });
  1942. });
  1943. }
  1944. }
  1945. /**
  1946. * 上传成功直接添加
  1947. * @param {object} 获取服务器返回值
  1948. * @param {string} 上传文件的唯一识别id
  1949. */
  1950. U.MD.DK.C.success = function (uploadinfo, dirinfo, diskinfo) {
  1951. var _userinfo = US.userInfo, //上传用户的信息
  1952. _extendtype = U.UF.UP.getFileNameAndExtension(uploadinfo.UserDirectoryName)[1], //上传文件的后缀名
  1953. _img = uploadinfo.UseFilesServerThumbnailName, //上传文件展示到网盘的图片
  1954. _groupid = uploadinfo.GroupID,
  1955. //上传文件成功后,由前端的数据结构生成一个数据实体,实际传参请参考函数里面的数据结构
  1956. _fileinfo = new U.MD.DK.M.entity(
  1957. uploadinfo.UserFilesID, //上传文件的id
  1958. uploadinfo.size, //上传文件的大小
  1959. uploadinfo.UserDirectoryID, //上传文件对应的目录id
  1960. uploadinfo.UserDirectoryName.addEllipsis(20), //上传文件的简写名
  1961. uploadinfo.UserDirectoryName, //上传文件的名字
  1962. _extendtype, //上传文件的后缀
  1963. uploadinfo.UserFilesServerName, //上传文件的服务器地址
  1964. U.UF.D.toTimeStamp(new Date()), //上传文件成功的时间
  1965. _img ? _img : U.MD.DK.C.getIcon(_extendtype)[1], //上传文件展示到网盘的图片
  1966. 9999, //上传文件的层次,这里文件是没有层次的,所以以9999区表达
  1967. null, //文件的修改时间
  1968. uploadinfo.UserDirectoryEncrypt, //上传文件的加密或者是限制
  1969. 1, //标识该文件在网盘中识别为文件
  1970. "", //上传文件的描述
  1971. _groupid, //归属的群id
  1972. "", //uw office内容
  1973. _userinfo.UserId, //归属用户的id
  1974. _userinfo.UserNickName, //归属用户的名字
  1975. _userinfo.UserName, //归属用户的用户名
  1976. _userinfo.UserThumbnailImageHead //归属用户的头像
  1977. );
  1978. //如果是上传到网盘的处理
  1979. if (_fileinfo) {
  1980. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, dirinfo); //添加值
  1981. diskinfo && U.Alert("文件: " + _fileinfo.UserDirectoryName + " 已上传至" + dirinfo.UserallDirectoryName + "目录下");
  1982. }
  1983. return _fileinfo;
  1984. }
  1985. /**
  1986. * 拖动选择多个元素的处理
  1987. * @param {element} 拖动的区域元素
  1988. */
  1989. U.MD.DK.C.selectElement = function (el, diskinfo) {
  1990. var i, classname, hoverclass,
  1991. _viewtype = diskinfo.viewtype || "Normal",
  1992. _child = U.selectEl(el).Child(),
  1993. _fileinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": diskinfo.directoryid })[0];
  1994. diskinfo.selectElement = []; //清空所有的选择元素
  1995. //如果是在他人邀请 最新文档 我的协同里 则没有拖选按钮
  1996. if (_fileinfo && _fileinfo.GroupID !== true) {
  1997. //普通视图的处理
  1998. if (_viewtype == "Normal") {
  1999. classname = "U_MD_DK_RZO";
  2000. hoverclass = "U_MD_DK_RZO U_MD_DK_RZOI";
  2001. }
  2002. //详细视图的处理
  2003. else {
  2004. classname = "U_MD_DK_RZS U_MD_DK_RZXO";
  2005. hoverclass = "U_MD_DK_RZS U_MD_DK_RZXO U_MD_DK_RZXOO";
  2006. }
  2007. //如果不是空文件状态下的处理
  2008. if (_child[0].className != "U_MD_DK_RZF") {
  2009. //点击的时候循环清空所有元素选择状态
  2010. for (i = 0; i < _child.length; i++) {
  2011. //如果元素状态是选中状态的处理
  2012. if (_child[i].className == hoverclass) {
  2013. _child[i].className = classname;
  2014. }
  2015. }
  2016. //拖动选择处理
  2017. U.UF.F.dragSelect(el, function (arr) {
  2018. var i,
  2019. _isclass;
  2020. //循环元素的处理
  2021. for (i = 0; i < _child.length; i++) {
  2022. _isclass = arr.indexOf(_child[i]);
  2023. //判断元素是否
  2024. if (_isclass == -1 && _child[i].className == hoverclass) {
  2025. _child[i].className = classname;
  2026. }
  2027. //判断
  2028. else if (_isclass > -1) {
  2029. _child[i].className = hoverclass;
  2030. }
  2031. }
  2032. diskinfo.selectElement = arr; //得到所有的选择元素
  2033. });
  2034. }
  2035. }
  2036. };
  2037. ///<jscompress sourcefile="DiskData.js" />
  2038. Namespace.register("U.MD.DK.M"); //Disk树操作
  2039. //disk变量使用区域
  2040. //硬盘里面复制粘贴的全局变量。,暂未整理。
  2041. //US.disk.DiskDaren = {};
  2042. //包含了当前所有用户的硬盘目录文件等数据的信息.
  2043. US.disk.Disks = {};
  2044. //当前操作用户的网盘数据,相当于US.disk.Disks[userid]。
  2045. US.disk.UserDisk = null;
  2046. // US.disk.Disks 用户网盘数据前台存储的全局变量 该全局变量为一个数组
  2047. // US.disk.Disks[userid].directoryOrFiles 0为该userid用户下面的所有网盘目录及文件的数据信息。以数组形式展示
  2048. // US.disk.Disks[userid].userInfo 用户信息,包含了用户在网盘的信息
  2049. // US.disk.Disks[userid].directoryid 1为当前打开目录的id
  2050. // US.disk.Disks[userid].currentDirectoryFile 当前打开目录下面所有的文件和文件夹
  2051. // US.disk.Disks[userid].formel formel为当前网盘用户的弹框,这个是唯一的。
  2052. // US.disk.Disks[userid].operator 使用该用户网盘的用户id,为登录用户的id或者是全0的guid
  2053. //例:US.disk.Disks["张三"]; //张三的网盘信息,张三需要用guid表示,US.disk.Disks["95f7bacc-0b3a-4265-a2ea-15e066b97bf7"]
  2054. //例:US.disk.Disks["李四"]; //李四的网盘信息,李四需要用guid表示。US.disk.Disks["f6d7a4b6-e34c-4964-beed-24187b2cb1ba"]
  2055. //
  2056. //disk文件和文件夹实体,US.disk.Disks里面的内容的数据结构。
  2057. 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) {
  2058. this.UserDirectoryID = directoryid; //文件id或者目录id
  2059. this.UserDirectorySize = size; //文件大小。
  2060. this.UserDirectoryParentID = parentid; //父亲id
  2061. this.UserDirectoryName = shortname; //文件名或者文件夹名,
  2062. this.UserallDirectoryName = name; //文件名或者文件夹名,会删除不要
  2063. this.UserDirectoryExtendType = extendtype; //文件扩展名,目录扩展名为folder,加密的目录也有一个标识。
  2064. this.UserFilesServerName = serverurl; //文件服务器链接地址,需要统一加US.FILESYSTEMURL + filesinfo.UserDirectoryUrl
  2065. this.UserDirectoryAddTime = addtime; //文件或者文件夹添加时间
  2066. this.UserDirectoryUrl = iconurl; //文件服务器链接地址,缩略图,需要统一加US.FILESYSTEMURL + filesinfo.UserDirectoryUrl
  2067. this.UserDirectoryDeep = deep; //文件夹深度
  2068. this.UserDirectoryModifyTime = modifytime; //文件或者文件夹修改时间
  2069. this.UserDirectoryEncrypt = encryt; //文件夹加密
  2070. this.filetype = filetype; //文件类型,文件夹为1,文件为0
  2071. this.Descript = descript; //文件描述。例如图片,声音,视频的描述
  2072. this.GroupID = groupid; //群id,用于群文件
  2073. this.UsOffice = officevalue; //文件内容。
  2074. this.UserId = userid; //文件或者文件夹所属用户id
  2075. this.UserNickName = usernickname; //文件或者文件夹所属用户昵称
  2076. this.UserName = username; //文件或者文件夹所属用户账号
  2077. this.UserThumbnailImageHead = imagehead; //文件或者文件夹所属用户头像
  2078. this.Child = null; //文件夹中的子文件夹数组。
  2079. this.Parent = null; //文件或者文件夹的父亲
  2080. }
  2081. //初始化一级目录的全局变量。即左边树目录结构。
  2082. US.disk.initTree = [
  2083. [Guid.newGuid(), 0, US.MYDISK, "最新文档", "最新文档", "folder", null, null, null, 0, null, null, 0, "", true],
  2084. [Guid.newGuid(), 0, US.MYDISK, "我的协同", "我的协同", "folder", null, null, null, 0, null, null, 0, "", true],
  2085. [Guid.newGuid(), 0, US.MYDISK, "他人邀请", "他人邀请", "folder", null, null, null, 0, null, null, 0, "", true],
  2086. [US.MYFOLDERID, 0, US.MYDISK, "电脑", "我的文档(私密)", "folder", null, null, null, 0, null, null, 0, ""],
  2087. [US.FTPFOLDERID, 0, US.MYDISK, "ftp", "共享文档", "folder", null, null, null, 0, null, null, 0, "", ""]
  2088. ];
  2089. // [US.VIDEOFOLDERID, 0, US.MYDISK, "视频", "在线视频", "folder", null, null, null, 1, null, null, 0, ""],
  2090. // [US.IMAGEFOLDERID, 0, US.MYDISK, "相册", "图片、相册", "folder", null, null, null, 1, null, null, 0, ""],
  2091. // [US.MUSICEFOLDERID, 0, US.MYDISK, "音乐", "音乐收听", "folder", null, null, null, 1, null, null, 0, ""]
  2092. //文件类型全局变量。
  2093. US.disk.fileType = {
  2094. "image": ["jpg", "gif", "png", "bmp", "jpeg", "JPG", "GIF", "BMP", "PNG", "JPEG"],
  2095. "music": ["mp3"],
  2096. "video": ["wmv", "video", "ogg", "webm", "mp4"],
  2097. "usword": ["uw"],
  2098. "word": ["doc", "docx"],
  2099. "usnav": ["un"],
  2100. "usexcel": ["ue"],
  2101. "text": ["rtf", "mht", "txt", "htm", "html", "wsh", "wsf", "cpp", "c", "css", "txt", "php", "cs", "java", "log", "sql", "jsp"]
  2102. }
  2103. //全局变量,应用程序类型,包含了应用扩展名,id,中文描述,图标的css名。
  2104. US.disk.applicationTypes = {
  2105. "image": {
  2106. //图片类型的后缀
  2107. "types": US.disk.fileType.image,
  2108. //该格式对应在网盘的目录id
  2109. "directoryid": US.IMAGEFOLDERID,
  2110. //格式对应的名字
  2111. "name": "图片",
  2112. //格式对应的样式
  2113. "classname": ["U_MD_UI_UP_COIT"]
  2114. },
  2115. "music": {
  2116. //音乐类型的后缀
  2117. "types": US.disk.fileType.music,
  2118. //该格式对应在网盘的目录id
  2119. "directoryid": US.MUSICEFOLDERID,
  2120. //格式对应的名字
  2121. "name": "音乐",
  2122. //格式对应的样式
  2123. "classname": ["U_MD_UI_UP_COIY", "U_MD_DK_RZOY", "U_MD_DK_LCY"]
  2124. },
  2125. "video": {
  2126. //视频类型的后缀
  2127. "types": US.disk.fileType.video,
  2128. //该格式对应在网盘的目录id
  2129. "directoryid": US.VIDEOFOLDERID,
  2130. //格式对应的名字
  2131. "name": "视频",
  2132. //格式对应的样式
  2133. "classname": ["U_MD_UI_UP_COIS", "U_MD_DK_RZOP", "U_MD_DK_LCP"]
  2134. },
  2135. "word": {
  2136. //互联办公word文档格式
  2137. "types": US.disk.fileType.word,
  2138. //该格式对应在网盘的目录id
  2139. "directoryid": US.MYFOLDERID,
  2140. //格式对应的名字
  2141. "name": "Office文档",
  2142. //格式对应的样式
  2143. "classname": ["U_MD_UI_UP_COIW", "U_MD_DK_REODW", "U_MD_DK_LCD"]
  2144. },
  2145. "uw": {
  2146. //互联办公word文档格式
  2147. "types": US.disk.fileType.usword,
  2148. //该格式对应在网盘的目录id
  2149. "directoryid": US.MYFOLDERID,
  2150. //格式对应的名字
  2151. "name": "文档",
  2152. //格式对应的样式
  2153. "classname": ["U_MD_UI_UP_COIW", "U_MD_DK_RZOD", "U_MD_DK_LCD"]
  2154. },
  2155. "un": {
  2156. //互联办公word文档格式
  2157. "types": US.disk.fileType.usnav,
  2158. //该格式对应在网盘的目录id
  2159. "directoryid": US.MYFOLDERID,
  2160. //格式对应的名字
  2161. "name": "建站文档",
  2162. //格式对应的样式
  2163. "classname": ["U_MD_UI_UP_COIW", "U_MD_DK_REODN", "U_MD_DK_LCD"]
  2164. },
  2165. "ue": {
  2166. //互联办公Excel文档格式
  2167. //视频类型的后缀
  2168. "types": US.disk.fileType.usexcel,
  2169. //该格式对应在网盘的目录id
  2170. "directoryid": US.EMPTYGUID,
  2171. //格式对应的名字
  2172. "name": "文档",
  2173. //格式对应的样式
  2174. "classname": ["U_MD_UI_UP_COIE", "U_MD_DK_RZOE", "U_MD_DK_LCE"]
  2175. },
  2176. "text": {
  2177. //可以通过记事本打开的文件格式
  2178. "types": US.disk.fileType.text,
  2179. //该格式对应在网盘的目录id
  2180. "directoryid": US.EMPTYGUID,
  2181. //格式对应的名字
  2182. "name": "文件",
  2183. //格式对应的样式
  2184. "classname": ["U_MD_UI_UP_COIT", "downel_content_a_r", "U_MD_DK_LCB"]
  2185. },
  2186. "folder": {
  2187. //文件夹处理,一种是加密文件夹,一种是不加密
  2188. "types": ["folder", "folderencrypt"],
  2189. //该格式对应在网盘的目录id
  2190. "directoryid": US.EMPTYGUID,
  2191. //格式对应的名字
  2192. "name": "文件夹",
  2193. //格式对应的样式
  2194. "classname": ["", "U_MD_DK_RZOW", "U_MD_DK_LCW"]
  2195. },
  2196. "group": {
  2197. //文件夹处理,一种是加密文件夹,一种是不加密
  2198. "types": ["group"],
  2199. //该格式对应在网盘的目录id
  2200. "directoryid": US.EMPTYGUID,
  2201. //格式对应的名字
  2202. "name": "群",
  2203. //格式对应的样式
  2204. "classname": ["", "U_MD_DK_RZOG", "U_MD_DK_LCW"]
  2205. },
  2206. "unknownfile": {
  2207. //无法用应用打开的文件类型
  2208. "types": [],
  2209. //该格式对应在网盘的目录id
  2210. "directoryid": US.MYFOLDERID,
  2211. //格式对应的名字
  2212. "name": "文件",
  2213. //格式对应的样式
  2214. "classname": ["U_MD_UI_UP_COIT", "downel_content_a_r", "U_MD_DK_LCB"]
  2215. }
  2216. }
  2217. /**
  2218. * 循环添加文件到全局树里
  2219. * @param {array} 文件数组
  2220. * @param {object} 网盘全局信息
  2221. * @param {object} 添加文件是否具有群id
  2222. */
  2223. U.MD.DK.M.entity.add = function (filesinfo, diskinfo, isgroup) {
  2224. var i;
  2225. for (i = 0; i < filesinfo.length; i++) {
  2226. //如果是新建群文件,则通过放在前面,这样的话查询方便
  2227. if (isgroup) {
  2228. diskinfo.directoryOrFiles.splice(5, 0, filesinfo[i]);
  2229. }
  2230. //普通文件添加处理
  2231. else {
  2232. diskinfo.directoryOrFiles.push(filesinfo[i]);
  2233. }
  2234. }
  2235. }
  2236. /**
  2237. * 循环添加文件到全局树里
  2238. * @param {array} 文件数组
  2239. * @param {object} 制定的文件夹的信息
  2240. */
  2241. U.MD.DK.M.entity.addChild = function (filesinfo, dirinfo) {
  2242. //在指定的目录下的文件添子文件或者文件夹
  2243. if (!dirinfo.Child) { //如果有子目录那么就直接添加
  2244. dirinfo.Child = [];
  2245. }
  2246. //循环文件处理
  2247. for (var i = 0; i < filesinfo.length; i++) {
  2248. dirinfo.Child.push(filesinfo[i]);
  2249. filesinfo[i].Parent = dirinfo;
  2250. }
  2251. }
  2252. /**
  2253. * 循环添加文件到全局树里
  2254. * @param {array} 文件数组
  2255. * @param {object} 制定文件夹的信息
  2256. * @param {object} 添加文件是否具有群id
  2257. */
  2258. U.MD.DK.M.entity.del = function (filesinfo, diskinfo) {
  2259. var i,
  2260. j,
  2261. _parent,
  2262. // _delfilesize = 0, //删除的文件大小
  2263. // _delfilenum = 0, //删除的文件数量
  2264. _diskfileanddir = diskinfo.directoryOrFiles //网盘
  2265. ;
  2266. //文件信息
  2267. for (i = 0; i < filesinfo.length; i++) {
  2268. //网盘所有的文件信息
  2269. for (j = 0; j < _diskfileanddir.length; j++) {
  2270. //找到指定需要删除的文件
  2271. if (_diskfileanddir[j].UserDirectoryID == filesinfo[i].UserDirectoryID) {
  2272. _diskfileanddir.splice(j, 1); //在disk里面删除文件或者文件夹
  2273. break;
  2274. }
  2275. }
  2276. _parent = filesinfo[i].Parent; //获取移除目录的上级目录
  2277. //循环移除子元素
  2278. for (j = 0; j < _parent.Child.length; j++) {
  2279. //找到指定需要删除的文件
  2280. if (_parent.Child[j].UserDirectoryID == filesinfo[i].UserDirectoryID) {
  2281. _parent.Child.splice(j, 1); //在disk里面删除文件或者文件夹
  2282. }
  2283. }
  2284. }
  2285. }
  2286. /**
  2287. * 递归修改所有的子目录文件的Id
  2288. * @param {array} 文件数组
  2289. * @param {object} 修改的属性 例:{groupid:a} //修改所有的群id
  2290. */
  2291. U.MD.DK.M.recursionUpdateDirectory = function (filesinfo, attribute) {
  2292. //循环所有的文件修改
  2293. for (i = 0; i < filesinfo.length; i++) {
  2294. //修改文件的属性
  2295. U.UF.C.AddObj(filesinfo[i], attribute);
  2296. //如果文件是文件夹,那么查找自己节点元素,不断的递归修改
  2297. if (!filesinfo[i].fileType && filesinfo[i].Child) {
  2298. //递归修改
  2299. U.MD.DK.M.recursionUpdateDirectory(filesinfo[i].Child, attribute);
  2300. }
  2301. }
  2302. }
  2303. /**
  2304. * 用户操作切换,可以查看多个用户的硬盘,所以需要切换。登录用户和非登录用户有不同权限。
  2305. * @param {string} 用户id
  2306. * @param {string} 用户名
  2307. * @return {object} 用户在网盘的全局变量。
  2308. */
  2309. U.MD.DK.M.diskOperatingSwitch = function (userid, username) {
  2310. userid = userid || US.userInfo.UserId; //如果有用户id,则userid为用户id,否则为登录用户id。
  2311. if (userid) {
  2312. var i, _userinfo, //需要返回的用户网盘信息
  2313. _diskinfo = US.disk.Disks; //_UCE为包含了所有用户硬盘信息的集合。
  2314. if (_diskinfo && !_diskinfo[userid]) { //判断用户的网盘信息是否可以通过userid找到
  2315. for (i in _diskinfo) { //循环网盘信息
  2316. if (_diskinfo[i] && _diskinfo[i][1] && _diskinfo[i][1][0] && _diskinfo[i][1][0].UserName == username) { //这里也会有null情况,因为这个变量的定义在U.A.Request之前,所以可能会存在还没有获取数据就在此进入这个函数的情况
  2317. userid = _diskinfo[i][1][0].UserId;
  2318. }
  2319. }
  2320. }
  2321. US.disk.UserDisk = _diskinfo[userid]; //设置当前使用的网盘用户的信息为得到的用户id
  2322. return _diskinfo[userid];
  2323. }
  2324. }
  2325. /**
  2326. * 通过用户名搜索用户网盘信息
  2327. * @param {string} 用户名
  2328. * @return {object} 用户在网盘的全局变量。
  2329. */
  2330. U.MD.DK.getUserDiskByName = function (username) {
  2331. var i,
  2332. _userdisk, //获取的用户硬盘信息
  2333. _diskinfo = US.disk.Disks; //存储打开用户的网盘的信息
  2334. for (i in _diskinfo) { //循环获取
  2335. _userdisk = _diskinfo[i][1]; //查看用户网盘信息
  2336. if (_userdisk && _userdisk[0].UserName == username) { //判断网盘信息的用户名是否等于传入的用户名
  2337. return _userdisk[0];
  2338. }
  2339. }
  2340. return {};
  2341. }
  2342. ;
  2343. ///<jscompress sourcefile="DiskHome.js" />
  2344. ;
  2345. ///<jscompress sourcefile="DiskSearch.js" />
  2346. //---------------------------------------------------------------------------网络硬盘搜索------------------------------------------------------------------------------
  2347. Namespace.register("U.MD.DK.S"); //Disk搜索的命名空间
  2348. //#region 本地搜索
  2349. /**
  2350. * 自己的网盘搜索
  2351. *
  2352. * @param {element} 输入的元素
  2353. * @param {element} 输入的元素
  2354. **/
  2355. U.MD.DK.S.search = function (inputel, diskinfo) {
  2356. var _value = inputel.value, //搜索框内容
  2357. _diskinfo = diskinfo || US.disk.UserDisk, //网盘信息
  2358. _searchfileordir = []; //搜索文件或目录
  2359. if ( _value == "") {//如果没有搜索内容
  2360. _searchfileordir = _diskinfo.currentDirectoryFile; //显示当前所有文件
  2361. }
  2362. else {
  2363. for (var i = 0; i < _diskinfo.directoryOrFiles.length; i++) {//模糊搜索
  2364. if (_diskinfo.directoryOrFiles[i].UserallDirectoryName.indexOf(_value) >= 0) {//如果文件夹名包含搜索框的内容
  2365. _searchfileordir.push(_diskinfo.directoryOrFiles[i]); //则显示到网盘中
  2366. }
  2367. }
  2368. }
  2369. //以后做新窗口弹出。
  2370. _content = U.selectEl("#U_MD_DK_RZ", _diskinfo.formel)[0]; //用户的网盘打印内容
  2371. _content.innerText = "";
  2372. U.selectEl(".U_MD_DK_RKR")[1].innerHTML = "当前文件的数量:" + (_searchfileordir.length); //当前文件的数量
  2373. U.MD.DK.VW.printContent(_searchfileordir, _content); //打印搜索的结果。
  2374. }
  2375. //#endregion
  2376. ;
  2377. ///<jscompress sourcefile="DiskView.js" />
  2378. Namespace.register("U.MD.DK.VW"); //Disk视图操作命名空间
  2379. //#region 追随设置
  2380. /* 跟新追随信息
  2381. *
  2382. * @param diskel {element} 网盘窗体元素
  2383. * @param userid {string} 用户id
  2384. **/
  2385. U.MD.DK.VW.followState = function (diskel, userid) {
  2386. var _followbutton = U.selectEl(".U_MD_DK_LIRS", diskel);
  2387. _followbutton.attr("user", userid);
  2388. if (userid == US.userInfo.UserId) {
  2389. _followbutton[0].innerHTML = "本人";
  2390. }
  2391. else if (US.friend.friends && U.Json.select(US.friend.friends, { UserId: userid })[0]) {
  2392. _followbutton[0].innerHTML = "已追随";
  2393. _followbutton.addClass("U_MD_DK_LIRSED");
  2394. } else {
  2395. _followbutton[0].innerHTML = "追随";
  2396. _followbutton.removeClass("U_MD_DK_LIRSED");
  2397. }
  2398. }
  2399. /* 追随按钮点击事件
  2400. *
  2401. **/
  2402. U.MD.DK.VW.followState.click = function (button) {
  2403. var _userid = U.selectEl(button).attr("user");
  2404. var _userinfo;
  2405. if (_userid == US.userInfo.UserId) {
  2406. return;
  2407. } else if (US.friend.friends && (_userinfo = U.Json.select(US.friend.friends, { UserId: _userid })[0])) {
  2408. U.MD.F.M.deleteFriend(_userinfo, function () {
  2409. button.innerHTML = "追随";
  2410. U.selectEl(button).removeClass("U_MD_DK_LIRSED");
  2411. });
  2412. } else {
  2413. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserId", _userid], function (r) {//根据用户名获取用户信息
  2414. if (r.value && r.value[0]) {
  2415. U.MD.F.M.addFriend(r.value[0], function () {
  2416. button.innerHTML = "已追随";
  2417. U.selectEl(button).addClass("U_MD_DK_LIRSED");
  2418. });
  2419. } else {
  2420. U.Alert("用户信息有误,请稍后尝试...");
  2421. }
  2422. });
  2423. }
  2424. }
  2425. //#endregin
  2426. //#region 目录文件打印
  2427. /**
  2428. * 打印网盘视图输出判断的地方 分为普通视图输出和详细视图输出
  2429. * @param {array} 需要输出的文件或者文件夹信息
  2430. * @param {element} 输出到那个区域
  2431. **/
  2432. U.MD.DK.VW.viewsSwitch = function (viewtype, diskinfo) {
  2433. var _contentel = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0], //内容元素
  2434. _viewnav = U.selectEl(_contentel).prev()[0] //导航元素
  2435. ;
  2436. diskinfo.viewtype = _contentel.viewtype = viewtype; //视图
  2437. if (diskinfo.currentDirectoryFile.length) {
  2438. _contentel.innerHTML = ""; //先清空处理
  2439. U.MD.DK.VW.printContent(diskinfo.currentDirectoryFile, _contentel); //打印内容
  2440. //这里是普通视图处理
  2441. if (viewtype == "Normal") {
  2442. _contentel.style.width = ""; //普通视图不修改大小
  2443. _viewnav.style.display = "none";
  2444. _contentel.style.height = U.selectEl(_contentel).Parent(2).offsetHeight - 79 + "px"
  2445. }
  2446. //详细视图处理
  2447. else {
  2448. U.MD.DK.VW.size(diskinfo); //详细视图的时候需要设置大小和样式,这里统一处理
  2449. }
  2450. }
  2451. }
  2452. /**
  2453. * 根据时间排序
  2454. * @param {object} 用户网盘信息
  2455. **/
  2456. U.MD.DK.VW.SortView = function (diskinfo, type, cb) {
  2457. var _filesinfo = diskinfo.currentDirectoryFile, //用户展示在改文件夹下所有的文件
  2458. _contentel = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0]
  2459. ;
  2460. //判断文件是否存在,如果有打印文件,那么就进行文件的打印,否则不做任何处理
  2461. if (_filesinfo.length) {
  2462. //判断头两个文件的创建时间,进行排序处理
  2463. if (_filesinfo[0].UserDirectoryAddTime > _filesinfo[1].UserDirectoryAddTime) {
  2464. //文件降序处理
  2465. U.UF.Math.sequence(_filesinfo, type, cb, 1);
  2466. } else {
  2467. //文件升序处理
  2468. U.UF.Math.sequence(_filesinfo, type, cb, -1);
  2469. }
  2470. //重新打印内容
  2471. _contentel.innerHTML = "";
  2472. U.MD.DK.VW.printContent(_filesinfo, _contentel); //打印
  2473. }
  2474. }
  2475. /**
  2476. * 打印网盘视图输出判断的地方 分为普通视图输出和详细视图输出
  2477. * @param {array} 需要输出的文件或者文件夹信息
  2478. * @param {element} 输出到那个区域
  2479. **/
  2480. U.MD.DK.VW.printContent = function (filesinfo, el) {
  2481. var _diskinfo = US.disk.UserDisk, //用户网盘的数据
  2482. _viewtype = el.viewtype || "Normal", //打印的格式
  2483. _viewnav = U.selectEl(el).prev()[0] //视图导航
  2484. ;
  2485. //判断是否有需要输出的文件信息
  2486. if (filesinfo.length) {
  2487. //打印的模式 这里是普通视图输出
  2488. if (_viewtype == "Normal") {
  2489. U.MD.DK.VW.printNormalView(filesinfo, el); //输出
  2490. }
  2491. //详细视图输出
  2492. else {
  2493. U.MD.DK.VW.printDetailedView(filesinfo, el); //详细视图输出
  2494. }
  2495. }
  2496. //如果还有输出的信息在div上面那么不输出空文件的提示
  2497. else if (!$(el).Child().length) {
  2498. U.MD.DK.VW.printNullView(el); //没有文件的时候样式输出
  2499. }
  2500. }
  2501. /**
  2502. * 空文件提示信息输出
  2503. * @param {element} 输出到那个区域
  2504. **/
  2505. U.MD.DK.VW.printNullView = function (el) {
  2506. var _viewel,
  2507. _infoel,
  2508. _promptel,
  2509. _viewel = $$("div", { "className": "U_MD_DK_RZF" }, el);
  2510. _infoel = $$("div", { "className": "U_MD_DK_RZFS" }, _viewel);
  2511. $$("div", { "className": "U_MD_DK_RZTSL U_MD_DK_RZFSL", "innerHTML": "!" }, _infoel);
  2512. _promptel = $$("div", { "className": "U_MD_DK_RZFSR" }, _infoel);
  2513. //提示信息
  2514. _infoel = $$("div", { "className": "U_MD_DK_RZFSRS" }, _promptel);
  2515. $$("div", { "className": "U_MD_DK_RZFSRS", "innerHTML": "这地方暂时" }, _infoel);
  2516. $$("div", { "className": "U_MD_DK_RZFSRS", "innerHTML": " 没有资源哦。" }, _infoel);
  2517. $$("div", { "className": "U_MD_DK_RZTSRX U_MD_DK_RZFSRX", "innerHTML": "Nothing!!" }, _promptel);
  2518. }
  2519. /**
  2520. * 普通视图打印
  2521. * @param {array} 需要输出的文件或者文件夹信息
  2522. * @param {element} 输出到那个区域
  2523. **/
  2524. U.MD.DK.VW.printNormalView = function (filesinfo, el) {
  2525. //变量定义区域
  2526. var i, //用于循环
  2527. _isencryp, //判断文件夹是否加密处理
  2528. _date, //文件当前使用时间
  2529. _icon, //获取文件的icon样式,包含多种
  2530. _imgicon, //打印给用户看到的文件类型对应的图标的样式,上面的是
  2531. _iconel, //图标元素
  2532. _imgeel, //输入给用户看到的元素
  2533. _infoel, //信息输出元素
  2534. _userimg, //用户头像
  2535. _frag = $$("frag"), //临时panel
  2536. _diskinfo = US.disk.UserDisk, //用户网盘信息
  2537. _userid = _diskinfo.userInfo.UserId //当前使用用户的id
  2538. ;
  2539. //逻辑输出区域
  2540. for (i = 0; i < filesinfo.length; i++) {
  2541. //获取文件的信息
  2542. _isencryp = (filesinfo[i]["UserDirectoryEncrypt"] && filesinfo[i]["UserDirectoryEncrypt"] != _userid); //判断文件夹是否是加密属性
  2543. _date = U.UF.D.formatDateToArray(filesinfo[i]["UserDirectoryAddTime"], "Array"); //获取文件的创建时间数组 返回值包含 [年, 月, 日]
  2544. //判断是否为协同群文件
  2545. 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 == "他人邀请") {
  2546. filesinfo[i].UserDirectoryExtendType = "group";
  2547. }
  2548. _icon = U.MD.DK.C.getIcon(filesinfo[i].UserDirectoryExtendType); //根据文件扩展名,得到图标的样式
  2549. //创建一个文件夹图标或者文件图标。
  2550. _viewel = $$("div", {
  2551. "title": filesinfo[i]["UserallDirectoryName"],
  2552. "className": "U_MD_DK_RZO",
  2553. "id": "R" + (filesinfo[i].UserDirectoryID),
  2554. "onmousedown": function () {
  2555. var _isindex = _diskinfo.selectElement.indexOf(this); //元素是否在多选元素的位置
  2556. if (_isindex > -1) {
  2557. U.UF.EV.stopBubble(); //onmousedown设置阻止冒泡
  2558. }
  2559. },
  2560. "oncontextmenu": U.UF.C.closure(function (fileinfo) {
  2561. U.UF.EV.stopBubble();
  2562. U.UF.EV.stopDefault();
  2563. U.MD.DK.RM.rightMenu(this, fileinfo, US.disk.UserDisk); //右键菜单
  2564. }, [filesinfo[i]])
  2565. }, _frag);
  2566. //设置点击事件
  2567. if (filesinfo[i].filetype == "1") { //普通文件的处理
  2568. _viewel.onclick = U.UF.C.closure(function (fileinfo) {
  2569. U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
  2570. }, [filesinfo[i]]);
  2571. }
  2572. else { //文件夹的处理,文件夹的处理这里加一个前进后退的添加
  2573. _viewel.onclick = U.UF.C.closure(function (fileinfo) {
  2574. U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
  2575. }, [filesinfo[i]]);
  2576. }
  2577. //图标处理
  2578. _imgicon = "";
  2579. _iconel = $$("div", { "className": "U_MD_DK_RZOA" }, _viewel);
  2580. //文件夹处理
  2581. if (filesinfo[i].filetype != 1) {
  2582. //加密的处理
  2583. if (_isencryp) {
  2584. _imgicon = "U_MD_DK_Img U_MD_DK_RZOM";
  2585. }
  2586. //未加密的处理
  2587. else {
  2588. _imgicon = _icon.classname[1] ? "U_MD_DK_Img " + _icon.classname[1] : "U_MD_DK_Img U_MD_DK_RZOW";
  2589. }
  2590. }
  2591. //根据上面根据类型获取的图标输出图标样式
  2592. else if (_icon.classname[1]) {
  2593. _imgicon = "U_MD_DK_Img " + _icon.classname[1];
  2594. }
  2595. _imgeel = $$("div", { "className": "U_MD_DK_RZOS " + _imgicon }, _iconel);
  2596. //如果图标是空图标,给空图标写入后缀名
  2597. if (_icon.name == "文件") {
  2598. $$("div", { "className": "U_MD_DK_RZOSZ", "innerHTML": filesinfo[i].UserDirectoryExtendType || "" }, _imgeel);
  2599. }
  2600. else if (!_icon.classname[1]) {
  2601. $$("img", { "onerror": U.MD.C.imgError,
  2602. "onerror": function () {
  2603. U.MD.C.imgError(this, 1);
  2604. },
  2605. "title": "点击查看",
  2606. "src": U.MD.C.getHeadImage(filesinfo[i].UserDirectoryUrl)
  2607. }, _imgeel);
  2608. }
  2609. //目录名输出
  2610. _infoel = $$("div", { "className": "U_MD_DK_RZOZO" }, _iconel);
  2611. $$("div", { "className": "U_MD_DK_RZOZ", "innerHTML": filesinfo[i]["UserallDirectoryName"] }, _infoel);
  2612. //大小
  2613. _infoel = $$("div", { "className": "U_MD_DK_RZOFXJ U_MD_D_Text_Abbreviation" }, _infoel);
  2614. $$("span", { "className": "U_MD_DK_RZOFXJO", "innerHTML": _date[0] + "-" + _date[1] + "-" + _date[2] }, _infoel);
  2615. if (filesinfo[i].filetype != 0) {
  2616. $$("span", { "className": "U_MD_DK_RZOFXJT", "innerHTML": U.UF.UP.minUnitToMaxUnit(filesinfo[i]["UserDirectorySize"]) }, _infoel);
  2617. }
  2618. //线面输入文件归属用户的信息 头像和名字
  2619. _infoel = $$("div", { "className": "U_MD_DK_RZOF" }, _viewel);
  2620. _infoel = $$("div", { "className": "U_MD_DK_RZOFD" }, _infoel);
  2621. _userimg = $$("div", { "className": "U_MD_DK_RZOFDI" }, _infoel);
  2622. //用户头像输出
  2623. $$("img", { "onerror": U.MD.C.imgError,
  2624. "onerror": U.MD.C.imgError, "title": "点击查看",
  2625. "src": U.MD.C.getHeadImage(filesinfo[i].UserThumbnailImageHead),
  2626. "onclick": function () {
  2627. U.UF.EV.stopBubble(); U.MD.U.V.ViewOtherUserInfo(filesinfo[i].UserId);
  2628. }
  2629. }, _userimg);
  2630. //归属用户名输出
  2631. $$("div", { "className": "U_MD_DK_RZOFDN U_MD_D_Text_Abbreviation", "innerHTML": filesinfo[i].UserNickName || filesinfo[i]["UserallDirectoryName"] }, _infoel);
  2632. }
  2633. //追加元素
  2634. U.selectEl(el).append(_frag); // , 0, el.firstChild
  2635. }
  2636. /**
  2637. * 详细视图输出
  2638. * @param {array} 需要输出的文件或者文件夹信息
  2639. * @param {element} 输出到那个区域
  2640. **/
  2641. U.MD.DK.VW.printDetailedView = function (filesinfo, el) {
  2642. //变量定义区域
  2643. var i, //用于循环
  2644. _isencryp, //判断文件夹是否加密处理
  2645. _date, //文件当前使用时间
  2646. _icon, //获取文件的icon样式,包含多种
  2647. _iconandnameel, //图标和名字展示的区域
  2648. _ischecked = false, //判断文件是否给选中
  2649. _userimg, //用户头像
  2650. _frag = $$("frag"), //临时panel
  2651. _userid = US.disk.UserDisk.userInfo.UserId //当前使用用户的id
  2652. ;
  2653. //逻辑输出区域
  2654. for (i = 0; i < filesinfo.length; i++) {
  2655. //获取文件的信息
  2656. _isencryp = (filesinfo[i]["UserDirectoryEncrypt"] && filesinfo[i]["UserDirectoryEncrypt"] != _userid); //判断文件夹是否是加密属性
  2657. _date = U.UF.D.formatDateToArray(filesinfo[i]["UserDirectoryAddTime"]); //获取文件的创建时间数组 返回值包含 [年, 月, 日]
  2658. _icon = U.MD.DK.C.getIcon(filesinfo[i].UserDirectoryExtendType); //根据文件扩展名,得到图标的样式
  2659. //创建一个文件夹图标或者文件图标。
  2660. _viewel = $$("div", { "title": filesinfo[i]["UserallDirectoryName"], "className": "U_MD_DK_RZS U_MD_DK_RZXO", "id": "R" + (filesinfo[i].UserDirectoryID) }, _frag);
  2661. //设置右键按钮的处理
  2662. _viewel.oncontextmenu = function () {
  2663. U.UF.EV.stopBubble();
  2664. U.MD.DK.RM.rightMenu(_viewel, filesinfo[i], US.disk.UserDisk);
  2665. };
  2666. _viewel.onmousedown = function () {
  2667. var _isindex = _diskinfo.selectElement.indexOf(this); //元素是否在多选元素的位置
  2668. if (_isindex > -1) {
  2669. U.UF.EV.stopBubble(); //onmousedown设置阻止冒泡
  2670. }
  2671. }
  2672. //设置点击事件
  2673. _viewel.onclick = U.UF.C.closure(function (fileinfo) {
  2674. U.MD.DK.LE.openFileDirectory(fileinfo, _userid);
  2675. }, [filesinfo[i]]);
  2676. _iconandnameel = $$("div", { "className": "U_MD_DK_RZSO", "style": { "marginLeft": "0px"} }, _viewel);
  2677. //多选的按钮设置
  2678. $$("input", { "className": "U_MD_DK_RZSOI",
  2679. "checked": _ischecked,
  2680. "type": "checkbox",
  2681. "onclick": function () {
  2682. U.UF.EV.stopBubble();
  2683. U.MD.DK.VW.checkFile(this);
  2684. }
  2685. }, _iconandnameel);
  2686. _iconandnameel = $$("div", { "className": "U_MD_DK_RZSM U_MD_D_Text_Abbreviation" }, _viewel);
  2687. //设置图标如果有图标设置图标,没有图标的是图片
  2688. if (_icon.classname[2]) {
  2689. $$("span", { "className": _icon.classname[2] + " U_MD_DK_RZSMI U_MD_DK_Img U_MD_D_Text_Abbreviation", "innerHTML": " &nbsp; &nbsp; &nbsp;" }, _iconandnameel);
  2690. }
  2691. else {
  2692. $$("img", { "onerror": U.MD.C.imgError,
  2693. "onerror": function () {
  2694. U.MD.C.imgError(this, 1);
  2695. },
  2696. "title": "点击查看",
  2697. "src": U.MD.C.getHeadImage(filesinfo[i].UserDirectoryUrl || (US.FILESYSTEMURL + filesinfo[i].UseFilesServerThumbnailName))
  2698. }, _iconandnameel);
  2699. }
  2700. //文件名
  2701. $$("span", { "className": "U_MD_DK_RZSMN", "innerHTML": filesinfo[i]["UserallDirectoryName"] }, _iconandnameel);
  2702. //引用次数,暂时没有功能
  2703. $$("div", { "className": "U_MD_DK_RZSF U_MD_DK_RZSFO U_MD_D_Text_Abbreviation", "innerHTML": 0 }, _viewel);
  2704. //归属用户名字
  2705. $$("div", { "className": "U_MD_DK_RZSL U_MD_D_Text_Abbreviation", "innerHTML": filesinfo[i]["UserNickName"] }, _viewel);
  2706. //文件类别名字,如文件夹、图片等等
  2707. $$("div", { "className": "U_MD_DK_RZSX U_MD_D_Text_Abbreviation", "innerHTML": _icon.name }, _viewel);
  2708. //文件大小
  2709. $$("div", { "className": "U_MD_DK_RZSD U_MD_D_Text_Abbreviation", "innerHTML": U.UF.UP.minUnitToMaxUnit(filesinfo[i]["UserDirectorySize"]) }, _viewel);
  2710. //时间
  2711. $$("div", { "className": "U_MD_DK_RZST U_MD_D_Text_Abbreviation", "innerHTML": _date[0] + "-" + _date[1] + "-" + _date[2] + " " + _date[3] + ":" + _date[4] }, _viewel);
  2712. }
  2713. //追加元素
  2714. el.appendChild(_frag);
  2715. }
  2716. /**
  2717. * 判断文件是否为群文件
  2718. * @param {array} 文件夹信息
  2719. **/
  2720. U.MD.DK.VW.collaborativeFileJudgment = function (filesinfo) {
  2721. if (filesinfo.Parent != null) {//判断文件是否为最高及,如果不是
  2722. return U.MD.DK.VW.collaborativeFileJudgment(filesinfo.Parent); //获取它的高级,进行自循环
  2723. }
  2724. if (filesinfo.GroupID == true && filesinfo.UserDirectoryName == "我的协同" || filesinfo.GroupID == true && filesinfo.UserDirectoryName == "他人邀请") {//判断文件是否为我的协同或他人邀请,如果是
  2725. return true; //返回true
  2726. }
  2727. return false; //如果不是,返回false
  2728. }
  2729. /**
  2730. * 详细视图的大小变化使用
  2731. * @param {array} 需要输出的文件或者文件夹信息
  2732. * @param {element} 输出到那个区域
  2733. **/
  2734. U.MD.DK.VW.size = function (diskinfo) {
  2735. var i, j, k, //循环变量
  2736. _childel,
  2737. _size = [0.1, 0.2, 0.1, 0.15, 0.15, 0.15, 0.14], //详细视图每一格的大小
  2738. _contentel = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0], //内容元素
  2739. _contentchildel = U.selectEl(_contentel).Child(), //内容的子元素
  2740. _navel = U.selectEl(_contentel).prev()[0], //导航元素
  2741. _navchildel = U.selectEl(_navel).Child(), //导航的子元素
  2742. _width = U.selectEl(_contentel).width(), //获取编辑区域的长度
  2743. _height = U.selectEl(_contentel).height() //获取编辑区域的高度
  2744. ;
  2745. _navel.style.display = "block"; //导航按钮出现
  2746. //视图格式处理,要满足有数据,没有数据不做任何处理
  2747. if (_contentel.viewtype === "Detailed" && diskinfo.currentDirectoryFile.length) {
  2748. for (i = 0; i < _size.length; i++) {
  2749. //导航按钮区域处理
  2750. for (j = 0; j < _navchildel.length; j += 2) {
  2751. _navchildel[j].style.width = _width * _size[j / 2] + "px"; //导航按钮带下处理
  2752. }
  2753. //内容区域处理
  2754. for (j = 0; j < _contentchildel.length; j++) {
  2755. _childel = U.selectEl(_contentchildel).Child();
  2756. for (k = 0; k < _childel.length; k++) {
  2757. _childel[k].style.width = _width * _size[k] + "px"; //内容区域大小处理
  2758. }
  2759. }
  2760. }
  2761. _navel.style.width = _width + "px"; //导航区域设置大小
  2762. _contentel.style.height = _height + "px";
  2763. }
  2764. }
  2765. /**
  2766. * 全选文件
  2767. * @param {element} 输出到那个区域
  2768. * @param {string} 输出到那个区域
  2769. **/
  2770. U.MD.DK.VW.checkAllFile = function (el) {
  2771. var i,
  2772. _ischeck = el.checked, //选择的状态
  2773. _classname = "U_MD_DK_RZS U_MD_DK_RZXO" + (_ischeck ? " U_MD_DK_RZXOO" : ""), //选择或者取消选择的样式
  2774. _contentel = U.selectEl($(el).Parent(2)).next()[0], //内容区域的元素
  2775. _childel = U.selectEl(_contentel).Child() //所有输出的文件或者文件夹
  2776. ;
  2777. for (i = 0; i < _childel.length; i++) {
  2778. _childel[i].className = _classname; //样式处理
  2779. U.selectEl("input", _childel[i])[0].checked = _ischeck; //选中状态
  2780. }
  2781. }
  2782. /**
  2783. * 再详细视图下选择文件
  2784. * @param {element} 输出到那个区域
  2785. * @param {string} 输出到那个区域
  2786. **/
  2787. U.MD.DK.VW.checkFile = function (el) {
  2788. var _ischeck = el.checked; //获取文件是选择还是取消选择
  2789. //选择或者取消选择的处理
  2790. U.selectEl(el).Parent(2).className = "U_MD_DK_RZS U_MD_DK_RZXO" + (_ischeck ? " U_MD_DK_RZXOO" : "");
  2791. }
  2792. //#endregion
  2793. //#region 选择保存位置窗口
  2794. /**
  2795. * 选择文件保存位置窗口打印
  2796. * @param postfix {string} 文件后缀 文件类型
  2797. * @param filename {string} 文件名
  2798. * @param callback {function} 回调函数
  2799. * @param formtitle {string} 窗体名称
  2800. * @param extendtype {string} 显示的文件属性
  2801. **/
  2802. U.MD.DK.VW.chosenSaveFile = function (postfix, fileid, filename, callback, formtitle, extendtype) {
  2803. if (!U.MD.U.L.isLogin()) {//是否登录
  2804. extendtype = extendtype || "folder"; //默认只显示文件夹
  2805. var _diskinfo = US.disk.Disks[US.userInfo.UserId]; //获取当前登录用户的网盘信息
  2806. var _formel = U.selectEl('#U_MD_DK_VW_ChosenSaveFile')[0]; //获取窗体元素
  2807. var _file; //定义变量
  2808. if (_formel) { //判断窗体是否存在
  2809. //存在则居中显示
  2810. U.UF.F.windowTopCenter(_formel);
  2811. //获取文件区域
  2812. _file = U.selectEl('#U_MD_DK_VW_ChosenSaveFile_File')[0];
  2813. _file.innerHTML = "";
  2814. U.selectEl('.U_MD_DK_VW_ChosenSaveFile button', _formel)[1].onclick = function () {
  2815. U.MD.DK.VW.chosenSaveFile.ensure(_formel, U.selectEl('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0], postfix, fileid, callback);
  2816. }
  2817. U.selectEl('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0].value = "";
  2818. }
  2819. else {
  2820. var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" }); //创建文件区域容器
  2821. var _newfolder = $$('button', { style: { position: "absolute", right: "0", top: "2px" }, innerHTML: "新建文件夹" }, _box); //创建新建文件夹按钮
  2822. $$("div", { style: { "font-size": "16px", padding: "12px 10px 2px" }, innerHTML: "选择文件夹" }, _box); //创建标题
  2823. $$("hr", {}, _box); //创建分割线
  2824. _file = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_DK_VW_ChosenSaveFile_File" }, _box); //创建文件区域
  2825. var _inputarea = $$('div', {}, _box); //创建填写文件名区域
  2826. $$('span', { 'innerHTML': '文件名:' }, _inputarea); //标题
  2827. var _input = $$('input', { placeholder: filename || "请输入文件名...", style: { width: "89%", "text-indent": "5px", "line-height": "26px"} }, _inputarea); //文件名输入框
  2828. var _ensure = $$('button', { innerHTML: "确定" }, _box); //确定按钮
  2829. var _cancel = $$('button', { innerHTML: "取消" }, _box); //取消按钮
  2830. //创建窗体
  2831. _formel = new U.UF.UI.form(
  2832. "<span id='U_MD_DK_VW_ChosenSaveFile_Title'>" + (formtitle || "新建文件") + "</span>",
  2833. _box, {
  2834. "id": "U_MD_DK_VW_ChosenSaveFile",
  2835. "style": {
  2836. "width": "600px",
  2837. "height": "450px"
  2838. }
  2839. }).form;
  2840. //绑定新建文件夹事件
  2841. _newfolder.onclick = function () {
  2842. U.MD.DK.VW.chosenSaveFile.newFolder();
  2843. }
  2844. //绑定确定按钮事件
  2845. _ensure.onclick = function () {
  2846. U.MD.DK.VW.chosenSaveFile.ensure(_formel, _input, postfix, fileid, callback);
  2847. }
  2848. //取消函数
  2849. _cancel.onclick = function () {
  2850. U.UF.F.windowMinimize(_formel);
  2851. }
  2852. }
  2853. //默认创建初始化目录
  2854. 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);
  2855. }
  2856. }
  2857. /**
  2858. * 答应文件夹函数
  2859. * @param data {array} 数据源
  2860. * @param filearea {Element} 创建文件位置
  2861. * @param deviant {int} 偏移值
  2862. * @param iconclass {array} 文件图标class
  2863. * @param extendtype {string} 显示的文件属性
  2864. **/
  2865. U.MD.DK.VW.chosenSaveFile.printFolder = function (data, filearea, deviant, iconclass, topfilearea, extendtype) {
  2866. extendtype = extendtype || "folder";
  2867. var i, //定义循环变量
  2868. _class; //定义样式记录属性
  2869. for (i = 0; i < data.length; i++) { //循环答应
  2870. _class = null;
  2871. if (extendtype == "*" || extendtype.indexOf(extendtype) > -1) { //判断文件类型为文件夹才打印
  2872. if ((iconclass || "").length) { //判断文件图片class是否有传入
  2873. _class = iconclass[i] || iconclass; //设置样式名
  2874. } else if (data[i].UserDirectoryExtendType == extendtype || extendtype == "*") { //判断其能否显示,是不是想要的文件类型
  2875. switch (data[i].UserDirectoryExtendType) {
  2876. case "folder":
  2877. _class = "U_MD_DK_LCW"; //设置默样式名
  2878. break;
  2879. case "UW": case "txt": case "html": case "uw":
  2880. _class = "U_MD_DK_LCB";
  2881. break;
  2882. case "jpg": case "png":
  2883. _class = "U_MD_DK_LCT";
  2884. break;
  2885. case "mp4":
  2886. _class = "U_MD_DK_LCP";
  2887. break;
  2888. }
  2889. }
  2890. if (_class) { //判断其是否有样式,没有就不打印
  2891. U.MD.DK.VW.chosenSaveFile.Print(data[i], filearea, deviant, _class, topfilearea, extendtype); //调用单个打印函数
  2892. }
  2893. }
  2894. }
  2895. }
  2896. /**
  2897. * 打印文件夹函数
  2898. * @param data {object} 数据源
  2899. * @param filearea {Element} 创建文件位置
  2900. * @param deviant {int} 偏移值
  2901. * @param iconclass {string} 文件图标class
  2902. * @param extendtype {string} 显示的文件属性
  2903. **/
  2904. U.MD.DK.VW.chosenSaveFile.Print = function (data, filearea, deviant, iconclass, topfilearea, extendtype) {
  2905. var _filediv, _fileel, _folder; //设置变量
  2906. _folder = false; //
  2907. if (data.UserDirectoryExtendType == "folder") {//判断文件是否是文件夹
  2908. _folder = true;
  2909. };
  2910. _filediv = $$('div', { "className": "U_MD_DK_VW_ChosenSaveFile_File_Box" }, filearea); //创建单个文件区域
  2911. _fileel = $$('div', {
  2912. id: data["UserDirectoryID"] ? "CS" + data["UserDirectoryID"] : "",
  2913. "className": "U_MD_DK_LTXOS",
  2914. style: { 'padding-left': deviant + 'px' },
  2915. onclick: U.UF.C.closure(function (directoryinfo, el) { //设置点击事件
  2916. var _thisdate = data;
  2917. var _thisfolder = _folder;
  2918. U.UF.EV.stopBubble();
  2919. if (_thisfolder) {//判断点击的是否是文件夹
  2920. //如果是文件夹,就打开文件夹
  2921. U.MD.DK.VW.chosenSaveFile.forderClick(directoryinfo, el, topfilearea, extendtype);
  2922. //并且在选择该文件夹
  2923. if ($('.U_MD_DK_VW_ChosenSaveFileName')[0]) {
  2924. U.selectEl('.U_MD_DK_VW_ChosenSaveFileName')[0].value = data.UserallDirectoryName;
  2925. U.selectEl('.U_MD_DK_VW_ChosenSaveFileName')[0].data = data;
  2926. }
  2927. } else {
  2928. //不是文件夹就选择该文件
  2929. if ($('.U_MD_DK_VW_ChosenSaveFileName')[0]) {
  2930. U.selectEl('.U_MD_DK_VW_ChosenSaveFileName')[0].value = data.UserallDirectoryName;
  2931. U.selectEl('.U_MD_DK_VW_ChosenSaveFileName')[0].data = data;
  2932. }
  2933. }
  2934. }, [data, _filediv])
  2935. }, _filediv); //创建文件
  2936. if (_folder) {
  2937. $$('div', { className: "U_MD_DK_LTXOSI U_MD_DK_Img" }, _fileel); //创建文件角标
  2938. } else {
  2939. $$('div', { className: "U_MD_DK_LTXOSI" }, _fileel); //不创建文件角标
  2940. }
  2941. $$('div', { className: "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img " + iconclass }, _fileel); //创建文件icon
  2942. $$('span', { innerHTML: data.UserallDirectoryName }, _fileel); //创建文件名
  2943. return _filediv; //返回创建的文件元素
  2944. }
  2945. /**
  2946. * 文件夹展开关闭函数
  2947. * @param directoryinfo {object} 文件夹信息
  2948. * @param el {Element} 文件位置
  2949. * @param extendtype {string} 显示的文件属性
  2950. **/
  2951. U.MD.DK.VW.chosenSaveFile.forderClick = function (directoryinfo, el, topfilearea, extendtype) {
  2952. var //_filearea = U.selectEl('.U_MD_DK_VW_ChosenSaveFile_File')[0], //获取文件区域
  2953. _folder = U.selectEl(el).Child()[0], //获取每个文件
  2954. _deviant = parseInt(_folder.style.paddingLeft || 0) + 5; //计算偏移值
  2955. var _icon = U.selectEl('.U_MD_DK_LTXOSI', _folder); //获取角标
  2956. U.selectEl('.U_MD_DK_LTXOSO', topfilearea).removeClass('U_MD_DK_LTXOSO'); //清楚上一个选择的文件背景
  2957. U.selectEl(_folder).addClass('U_MD_DK_LTXOSO'); //设置当前文件背景为选中
  2958. if (_icon.hasClass('U_MD_DK_LTXOSIO')) { //判断文件是否展开
  2959. //已展开
  2960. _icon.removeClass('U_MD_DK_LTXOSIO'); //清楚展开角标样式
  2961. var _nextlevel = U.selectEl(_folder).next(); //判断是否加载了子文件夹
  2962. U.selectEl(_nextlevel).remove(); //删除子文件夹
  2963. } else {
  2964. //未展开
  2965. _icon.addClass('U_MD_DK_LTXOSIO'); //添加角标打开class
  2966. if (directoryinfo.Child) { //判断是否已获取子文件数据
  2967. //已获取
  2968. U.MD.DK.VW.chosenSaveFile.printFolder(directoryinfo.Child, $$('div', {}, el), _deviant, null, null, extendtype); //打印子级文件夹
  2969. } else {
  2970. //未获取则去数据库获取
  2971. U.MD.DK.LE.getChildsByDirectoryId(US.userInfo.UserId, directoryinfo, topfilearea, function () {
  2972. //打印文件夹
  2973. U.MD.DK.VW.chosenSaveFile.printFolder(directoryinfo.Child, $$('div', {}, el), _deviant, null, null, extendtype);
  2974. });
  2975. }
  2976. }
  2977. }
  2978. /**
  2979. * 确定按钮函数
  2980. * @param formel {object} 文件夹信息
  2981. * @param input {Element} 文件名输入框
  2982. * @param postfix {string} 文件后缀名
  2983. * @param callback {function} 回调函数
  2984. **/
  2985. U.MD.DK.VW.chosenSaveFile.ensure = function (formel, input, postfix, fileid, callback) {
  2986. var _name = input.value; //获取文件名
  2987. if (_name.trim() == "") { //判断是否为空
  2988. return U.Alert('请填写文件名!');
  2989. }
  2990. //判断文件名是否符合规范
  2991. if (U.UF.S.ZWFileName.test(_name)) {
  2992. var _nowfile = U.selectEl('.U_MD_DK_LTXOSO', formel)[0]; //获取当前选择的文件夹
  2993. if (!_nowfile) { //如果获取不到则为未选择
  2994. U.Alert('请选择文件夹新建的目录!'); //提示未选择文件
  2995. } else {
  2996. var _parentid = _nowfile.id.replace('CS', ''); //获取文件目录ID
  2997. var _userid = US.userInfo.UserId; //获取用户ID
  2998. var _diskinfo = US.disk.Disks[_userid]; //获取用户网盘信息
  2999. var _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0]; //获取文件夹信息
  3000. if (!U.MD.DK.C.getDirectoryPermissions(_dirinfo.UserDirectoryID, _diskinfo).isnew) {
  3001. return U.Alert(_dirinfo.Child.length ? '分类目录无法操作,请选择群文件或文件夹!' : '分类目录无法操作,请新建群或者选择其他群文件夹'); //提示未选择文件
  3002. }
  3003. //获取粘贴到制定目录的群id
  3004. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo); //获取所有的祖先
  3005. //如果是ftp目录,那么groupid就是用户id
  3006. if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
  3007. _groupid = _diskinfo.userInfo.UserId;
  3008. }
  3009. //否则就是对应的群id,如果不存在那么就是""
  3010. else {
  3011. _groupid = _ancestors[0].GroupID || "";
  3012. }
  3013. var _newfileid = fileid || Guid.newGuid();
  3014. //去数据库添加文件
  3015. U.A.Request(US.DISK, ["CreateFile", _userid, _newfileid, _parentid, _name, "", "", "", postfix, _groupid], function (r) {
  3016. //创建文件
  3017. 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)
  3018. U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, _dirinfo); //添加到页面上中
  3019. U.UF.F.windowMinimize(formel);
  3020. //如果存在就执行
  3021. if (U.UF.C.isFunction(callback)) {//判断是否有点击事件的方法,如果有,运行它
  3022. callback(_fileinfo);
  3023. }
  3024. }, []);
  3025. }
  3026. } else {
  3027. //不符合规范
  3028. U.Alert('请填写文件名符合规范!');
  3029. }
  3030. }
  3031. /**
  3032. * 新建文件夹函数
  3033. *
  3034. **/
  3035. U.MD.DK.VW.chosenSaveFile.newFolder = function () {
  3036. var _nowfile = U.selectEl('.U_MD_DK_VW_ChosenSaveFile_File .U_MD_DK_LTXOSO')[0]; //获取当前选择的文件夹
  3037. if (!_nowfile) { //如果获取不到则为未选择
  3038. return U.Alert('请选择文件夹新建的目录!'); //提示未选择文件
  3039. }
  3040. var _userid = US.userInfo.UserId; //获取用户ID
  3041. var _parentid = _nowfile.id.replace('CS', ''); //获取文件目录ID
  3042. var _diskinfo = US.disk.Disks[_userid]; //获取用户网盘信息
  3043. if (_diskinfo.directoryOrFiles[0].UserDirectoryID == _parentid || _diskinfo.directoryOrFiles[1].UserDirectoryID == _parentid || _diskinfo.directoryOrFiles[2].UserDirectoryID == _parentid) {//新建文件权限
  3044. U.Alert('该目录下无法新建文件夹,请重新选择目录!');
  3045. } else {
  3046. //创建新建文件名输入框
  3047. var _input = $$('input', { placeholder: "请输入文件夹名字...", style: { width: '180px', height: "25px", margin: "30px auto", display: "block", "text-indent": "5px"} });
  3048. //创建提示框
  3049. U.UF.UI.confirm(_input, function () {
  3050. //确定函数
  3051. var _name = _input.value; //获取输入文件夹名字
  3052. if (U.UF.S.ZWFileName.test(_name)) { //判断文件名是否符合规范
  3053. var _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0]; //获取文件夹信息
  3054. //获取粘贴到制定目录的群id
  3055. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo); //获取所有的祖先
  3056. //如果是ftp目录,那么groupid就是用户id
  3057. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  3058. _groupid = _diskinfo.userInfo.UserId;
  3059. }
  3060. //否则就是对应的群id,如果不存在那么就是""
  3061. else {
  3062. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  3063. }
  3064. var _newfolderid = Guid.newGuid(); //随机生成文件夹ID
  3065. //填写文件名符合规范 将文件夹以及文件夹名字保存到数据库
  3066. U.A.Request(US.DISK, ["CreateDirectory", _userid, _newfolderid, _dirinfo.UserDirectoryDeep + 1, _name, _parentid, "", _groupid, ""], //保存到数据库
  3067. function (r) {
  3068. //异步回调函数
  3069. var _nextlevel = U.selectEl(_nowfile).next()[0] || $$('div', {}, U.selectEl(_nowfile).Parent()); //获取或选择自己文件夹创建位置
  3070. var _fileinfo = new U.MD.DK.M.entity(_newfolderid, 0, _parentid, _name, _name, "folder", "", U.UF.D.toTimeStamp(), "", _dirinfo.UserDirectoryDeep + 1,
  3071. null, "", 0, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead); //创建本地文件信息
  3072. U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, _dirinfo); //添加到页面上中
  3073. _filediv = U.MD.DK.VW.chosenSaveFile.Print(_fileinfo, _nextlevel, parseInt(_nowfile.style.paddingLeft || 0) + 6, "U_MD_DK_LCW"); //打印新建文件夹
  3074. _nextlevel.insertBefore(_filediv, U.selectEl(_nextlevel).Child()[0]); //在最前方插入
  3075. });
  3076. } else {
  3077. //提示文件名不符合规范
  3078. U.Alert('请填写文件名符合规范!');
  3079. return false;
  3080. }
  3081. });
  3082. }
  3083. }
  3084. //#endregion
  3085. //#region 保存到指定协同群窗口
  3086. /**
  3087. * 保存到指定协同群窗口
  3088. *
  3089. * @param postfix {string} 文件后缀 文件类型
  3090. * @param fileinfo {object} 文件信息
  3091. * @param filename {string} 文件名
  3092. * @param type {string} 操作类型 move 移动 new 新建
  3093. * @param callback {function} 回调函数
  3094. *
  3095. **/
  3096. U.MD.DK.VW.saveSynergy = function (postfix, fileinfo, filename, type, callback) {
  3097. if (!U.MD.U.L.isLogin()) {//是否登录
  3098. var _grouplistarr = US.disk.Disks[US.userInfo.UserId]; //获取当前登录用户的网盘信息
  3099. var _formel = U.selectEl('#U_MD_O_SaveSynergy')[0]; //获取窗体元素
  3100. var _grouplist; //定义变量
  3101. if (_formel) { //判断窗体是否存在
  3102. //存在则居中显示
  3103. U.UF.F.windowTopCenter(_formel);
  3104. //获取文件区域
  3105. _grouplist = U.selectEl('#U_MD_O_SaveSynergy_GroupList')[0];
  3106. _grouplist.innerHTML = "";
  3107. U.selectEl('.U_MD_DK_VW_ChosenSaveFile button', _formel)[1].onclick = function () {
  3108. U.MD.DK.VW.saveSynergy.ensure(_formel, U.selectEl('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0], postfix, fileinfo, type, callback);
  3109. }
  3110. U.selectEl('.U_MD_DK_VW_ChosenSaveFile input', _formel)[0].value = "";
  3111. }
  3112. else {
  3113. var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" }); //创建文件区域容器
  3114. 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); //创建新建文件夹按钮
  3115. $$("div", { style: { "font-size": "16px", padding: "6px 10px 7px" }, innerHTML: "群列表" }, _box); //创建标题
  3116. $$("hr", {}, _box); //创建分割线
  3117. var _newgroup = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_O_SaveSynergy_NewGroup", style: { display: 'none', overflow: 'hidden'} }, _box); //创建文件区域
  3118. _grouplist = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_O_SaveSynergy_GroupList" }, _box); //创建文件区域
  3119. var _inputarea = $$('div', {}, _box); //创建填写文件名区域
  3120. $$('span', { 'innerHTML': '文件名:' }, _inputarea); //标题
  3121. var _input = $$('input', {
  3122. placeholder: "请输入文件名...",
  3123. value: filename == "未命名文档(点击编辑)..." ? "" : filename,
  3124. //onfocus: "U.UF.MR.inputPlaceholder(this,'未命名文档(点击编辑)...','')",
  3125. //onblur: "U.UF.MR.inputPlaceholder(this,'','未命名文档(点击编辑)...');",
  3126. style: { width: "89%", "text-indent": "5px", "line-height": "26px" }
  3127. }, _inputarea); //文件名输入框
  3128. var _ensure = $$('button', { innerHTML: "确定" }, _box); //确定按钮
  3129. var _cancel = $$('button', { innerHTML: "取消" }, _box); //取消按钮
  3130. //创建窗体
  3131. _formel = new U.UF.UI.form(
  3132. "<span id='U_MD_O_SaveSynergy_Title'>" + (type == 'move' ? "将文档移动到" : "选择保存到") + "指定群</span>",
  3133. _box, {
  3134. "id": "U_MD_O_SaveSynergy",
  3135. "style": {
  3136. "width": "600px",
  3137. "height": "450px"
  3138. }
  3139. }).form;
  3140. //绑定确定按钮事件
  3141. _ensure.onclick = function () {
  3142. U.MD.DK.VW.saveSynergy.ensure(_formel, _input, postfix, fileinfo, type, callback);
  3143. }
  3144. //取消函数
  3145. _cancel.onclick = function () {
  3146. U.UF.F.windowMinimize(_formel);
  3147. }
  3148. }
  3149. //打印文件
  3150. U.MD.DK.VW.chosenSaveFile.printFolder(_grouplistarr.directoryOrFiles.slice(1, 3), _grouplist, 0, ["U_MD_DK_LCD", "U_MD_DK_LCS"]);
  3151. //默认切换 选择群状态
  3152. U.MD.DK.VW.saveSynergy.swith(true);
  3153. }
  3154. };
  3155. /**
  3156. * 保存到指定协同群窗口 确定函数
  3157. *
  3158. * @param formel {element} 窗体元素
  3159. * @param input {element} 文件名输入框
  3160. * @param postfix {string} 文件后缀 文件类型
  3161. * @param fileinfo {object} 文件信息
  3162. * @param type {string} 操作类型 move 移动 new 新建
  3163. * @param callback {function} 回调函数
  3164. *
  3165. **/
  3166. U.MD.DK.VW.saveSynergy.ensure = function (formel, input, postfix, fileinfo, type, callback) {
  3167. var _name = input.value; //获取文件名
  3168. if (_name.trim() == "") { //判断是否为空
  3169. return U.Alert('请填写文件名!');
  3170. }
  3171. //判断文件名是否符合规范
  3172. if (U.UF.S.ZWFileName.test(_name)) {
  3173. var _dirinfo;
  3174. var _userid = US.userInfo.UserId; //获取用户ID
  3175. var _diskinfo = US.disk.Disks[_userid]; //获取用户网盘信息
  3176. if ($('#U_MD_O_SaveSynergy_GroupList').css('display') == 'none') {
  3177. var _groupName = '协同文档群--' + new Date().getHours() + ":" + new Date().getMinutes(), //默认群名/也是文档名
  3178. _groupDesc = "由" + US.userInfo.UserName + "发起的互联办公群组。";
  3179. U.MD.F.J.determineCreateGroupAndAddGroupUser(false, null, null, false, _groupName, _groupDesc, function (groupid) {
  3180. _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: groupid })[0]; //获取文件夹信息
  3181. U.MD.DK.VW.saveSynergy.ensure.operate(formel, _dirinfo, fileinfo, groupid, groupid, type, postfix, _name, callback);
  3182. });
  3183. } else {
  3184. var _groupid, _parentid;
  3185. var _nowfile = U.selectEl('.U_MD_DK_LTXOSO', formel)[0]; //获取当前选择的文件夹
  3186. _parentid = _nowfile.id.replace('CS', ''); //获取文件目录ID
  3187. _dirinfo = U.Json.select(_diskinfo.directoryOrFiles, { UserDirectoryID: _parentid })[0]; //获取文件夹信息
  3188. if (!U.MD.DK.C.getDirectoryPermissions(_dirinfo.UserDirectoryID, _diskinfo).isnew) {
  3189. return U.Alert(_dirinfo.Child.length ? '分类目录无法操作,请选择群文件或文件夹!' : '分类目录无法操作,请新建群或者选择其他群文件夹'); //提示未选择文件
  3190. }
  3191. //获取粘贴到制定目录的群id
  3192. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, _diskinfo); //获取所有的祖先
  3193. //如果是ftp目录,那么groupid就是用户id
  3194. if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
  3195. _groupid = _diskinfo.userInfo.UserId;
  3196. }
  3197. //否则就是对应的群id,如果不存在那么就是""
  3198. else {
  3199. _groupid = _ancestors[0].GroupID || "";
  3200. }
  3201. U.MD.DK.VW.saveSynergy.ensure.operate(formel, _dirinfo, fileinfo, _parentid, _groupid, type, postfix, _name, callback);
  3202. }
  3203. } else {
  3204. U.Alert('请填写文件名符合规范!');
  3205. }
  3206. }
  3207. /**
  3208. * 执行对应操作函数
  3209. *
  3210. * @param formel {element} 窗体元素
  3211. * @param dirinfo {object} 文件夹信息
  3212. * @param fileinfo {object} 文件信息
  3213. * @param parentid {string} 文件目录ID
  3214. * @param groupid {string} 群ID
  3215. * @param type {string} 操作类型 move 移动 new 新建
  3216. * @param postfix {string} 文件后缀 文件类型
  3217. * @param name {string} 文件名
  3218. * @param callback {function} 回调函数
  3219. *
  3220. **/
  3221. U.MD.DK.VW.saveSynergy.ensure.operate = function (formel, dirinfo, fileinfo, parentid, groupid, type, postfix, name, callback) {
  3222. var _fileid = fileinfo.UserDirectoryID;
  3223. var _userid = US.userInfo.UserId; //获取用户ID
  3224. var _diskinfo = US.disk.Disks[_userid]; //获取用户网盘信息
  3225. if (type == "move") {
  3226. var _pastecontent = US.disk.Disks[_userid].pasteDirOrFile = {
  3227. "type": "shear", //复制或者剪切 "copy" || "shear"
  3228. "UserDirectoryID": groupid, //在哪个目录复制或者剪切
  3229. "dirorfile": fileinfo, //复制的内容
  3230. "userid": _userid //用户id
  3231. }
  3232. U.A.Request(US.DISK, ["CutAndPasteFiles", fileinfo.UserId, groupid, fileinfo.UserDirectoryID, groupid, groupid],
  3233. top.U.MD.DK.RE.asynPaste, ["", dirinfo, groupid, _pastecontent, _diskinfo]);
  3234. U.A.Request(US.DISK, ["UpdateFileInfo", _fileid, name], function () {
  3235. fileinfo.UserallDirectoryName = name; //文件全写的名字
  3236. fileinfo.UserDirectoryName = name.addEllipsis(20); //文件的缩略名
  3237. fileinfo.GroupId = fileinfo.UserDirectoryEncrypt = groupid;
  3238. //如果存在就执行
  3239. if (U.UF.C.isFunction(callback)) {//判断是否有点击事件的方法,如果有,运行它
  3240. callback(fileinfo);
  3241. }
  3242. U.UF.F.windowMinimize(formel);
  3243. });
  3244. } else {
  3245. //去数据库添加文件
  3246. U.A.Request(US.DISK, ["CreateFile", _userid, _fileid, parentid, name, "", "", "", postfix, groupid], function (r) {
  3247. //创建文件
  3248. 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)
  3249. U.MD.DK.RE.addFileOrFolder([_fileinfo], _diskinfo, dirinfo); //添加到页面上中
  3250. U.UF.F.windowMinimize(formel);
  3251. //如果存在就执行
  3252. if (U.UF.C.isFunction(callback)) {//判断是否有点击事件的方法,如果有,运行它
  3253. callback(_fileinfo);
  3254. }
  3255. U.UF.F.windowMinimize(formel);
  3256. }, []);
  3257. }
  3258. }
  3259. /**
  3260. * 选择群、新建群方式切换
  3261. *
  3262. * @param init {boole} 是否为默认状态 选择群状态
  3263. *
  3264. **/
  3265. U.MD.DK.VW.saveSynergy.swith = function (init) {
  3266. var _newgroup = U.selectEl('#U_MD_O_SaveSynergy_NewGroup'); //新建群元素
  3267. var _grouplist = U.selectEl('#U_MD_O_SaveSynergy_GroupList'); //群列表
  3268. var _creategroup = U.selectEl('#U_MD_O_SaveSynergy_CreateGroup'); //按钮
  3269. if (_newgroup.css('display') == 'none' && !init) { //是否为新建群状态
  3270. _newgroup.css('display', 'block'); //新建群元素显示
  3271. _grouplist.css('display', 'none'); //选择群元素影藏
  3272. _creategroup[0].innerHTML = "返回群列表"; //修改按钮提示字
  3273. _creategroup[0].nextElementSibling.innerHTML = "选择联系人"; //修改标题
  3274. if (_newgroup.Child().length == 0) { //判断初始化窗体是否打印
  3275. U.MD.DK.VW.saveSynergy.createGroupInit(); //未打印则执行打印
  3276. }
  3277. U.MD.DK.VW.saveSynergy.Friends(); //打印可选好友
  3278. } else {
  3279. _newgroup.css('display', 'none'); //新建群元素显隐藏
  3280. _grouplist.css('display', 'block'); //选择群元素显示
  3281. _creategroup[0].innerHTML = "新建群"; //修改按钮提示字
  3282. _creategroup[0].nextElementSibling.innerHTML = "群列表"; //修改标题
  3283. }
  3284. }
  3285. /**
  3286. * 新建群区域初始化
  3287. *
  3288. **/
  3289. U.MD.DK.VW.saveSynergy.createGroupInit = function () {
  3290. var _newgroup = U.selectEl('#U_MD_O_SaveSynergy_NewGroup')[0];
  3291. var _left = $$('div', { style: { borderRight: "1px solid #ccc", position: "relative"} }, _newgroup);
  3292. var _right = $$('div', { style: { overflow: "hidden"} }, _newgroup);
  3293. var _count = $$('div', { style: { lineHeight: '30px' }, innerHTML: '已选择联系人:<span>1</span>' }, _right);
  3294. var _select = $$('div', { id: "U_MD_O_SaveSynergy_NewGroup_Select", style: { height: '265px', overflow: 'auto'} }, _right);
  3295. var _box = $$('div', { "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', style: { paddingLeft: '5px'} }, _select);
  3296. $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(US.userInfo.UserThumbnailImageHead) }, _box);
  3297. $$('span', { innerHTML: US.userInfo.UserNickName || US.userInfo.UserName }, _box);
  3298. }
  3299. /**
  3300. * 打印好友列表
  3301. *
  3302. **/
  3303. U.MD.DK.VW.saveSynergy.Friends = function () {
  3304. var i, _box, //定义变量
  3305. _friends = US.friend.friends; //好友列表
  3306. var _child = U.selectEl('#U_MD_O_SaveSynergy_NewGroup').Child(); //获取新建群区域的子级
  3307. var _friendel = _child[0]; //获取好友列表区域
  3308. var _countel = U.selectEl('span', U.selectEl(_child[1]).Child()[0])[0]; //获取选择计数元素
  3309. var _selectel = U.selectEl("#U_MD_O_SaveSynergy_NewGroup_Select"); //获取选中好友列表
  3310. _friendel.innerHTML = ""; //清空好友列表
  3311. _countel.innerHTML = "1"; //设置默认选择人数为1 默认选择自己
  3312. U.MD.F.J.selectUserInfo.NeedUser = []; //清空选中全局
  3313. var _oldfriend = _selectel.Child(); //获取遗留选中好友
  3314. //清除遗留选中好友
  3315. for (i = 1; i < _oldfriend.length; i++) {
  3316. U.selectEl(_oldfriend[i]).remove();
  3317. }
  3318. //如果存在好友
  3319. if (_friends.length > 0) {
  3320. //循环打印好友
  3321. for (i = 0; i < _friends.length; i++) {
  3322. //创建好友盒子
  3323. var _box = $$('div', { "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', onclick: U.UF.C.closure(function (friendinfo) {
  3324. U.MD.DK.VW.saveSynergy.Friends.Select(friendinfo, _selectel[0], _countel);
  3325. }, [_friends[i]]), friendid: _friends[i].FriendsID
  3326. }, _friendel);
  3327. //创建头像
  3328. $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(_friends[i].UserThumbnailImageHead) }, _box);
  3329. //创建用户名
  3330. $$('span', { innerHTML: _friends[i].UserNickName || _friends[i].UserName }, _box);
  3331. }
  3332. }
  3333. //如果不存在好友
  3334. else {
  3335. //创建提示字
  3336. $$('p', { style: { cssText: "font-weight: bold; font-size: 14px;padding-left:60px;padding-top:60px;" },
  3337. innerHTML: '您暂无添加好友,</br> 快去<span style="cursor:pointer;color:rgb(41, 103, 167);" onclick="U.MD.F.S.popSearchFriendsOrGroupForm(0);">添加你的好友</span>吧。 </br>'
  3338. }, _friendel);
  3339. //创建刷新按钮
  3340. $$('span', { innerHTML: "已添加完好友点击刷新好友列表", onclick: function () {
  3341. U.UF.DL.loading(_friendel);
  3342. setTimeout(function () { U.MD.DK.VW.saveSynergy.Friends(); U.UF.DL.uploading(_friendel); }, 300);
  3343. }, style: { color: "red", cursor: "pointer", position: "absolute", bottom: "0px", fontSize: "12px" }
  3344. }, _friendel);
  3345. }
  3346. }
  3347. /**
  3348. * 选择好友操作
  3349. *
  3350. * @param friendinfo {object} 好友信息
  3351. * @param selectel {element} 选中好友列表区域
  3352. * @param countel {element} 计数元素
  3353. *
  3354. **/
  3355. U.MD.DK.VW.saveSynergy.Friends.Select = function (friendinfo, selectel, countel) {
  3356. var i, //定义变量
  3357. _isselect = U.Json.select(U.MD.F.J.selectUserInfo.NeedUser, { UserId: friendinfo.UserId })[0]; //判断是否已选中
  3358. if (!_isselect) { //如果未选中
  3359. countel.innerHTML = parseInt(countel.innerHTML) + 1; //计数+1
  3360. U.MD.F.J.selectUserInfo.NeedUser.push(friendinfo); //加入选中好友全局
  3361. //打印选择好友
  3362. var _box = $$('div', { "className": 'U_MD_O_SaveSynergy_NewGroup_Friend', style: { paddingLeft: '5px' }, onclick: function () {
  3363. U.selectEl(this).remove();
  3364. U.Json.del(U.MD.F.J.selectUserInfo.NeedUser, { "UserId": friendinfo.UserId });
  3365. countel.innerHTML = parseInt(countel.innerHTML) - 1;
  3366. }
  3367. }, selectel);
  3368. //打印头像
  3369. $$('img', { "onerror": U.MD.C.imgError, src: U.MD.C.getHeadImage(friendinfo.UserThumbnailImageHead) }, _box);
  3370. //打印姓名
  3371. $$('span', { innerHTML: friendinfo.UserNickName || friendinfo.UserName }, _box);
  3372. }
  3373. }
  3374. /*
  3375. U.MD.DK.VW.choseFile
  3376. 参数一:选择文件
  3377. 参数二: 显示文件类型
  3378. */
  3379. U.MD.DK.VW.choseFile = function (cb, type) {
  3380. var _diskinfo = US.disk.Disks[US.userInfo.UserId]; //获取当前登录用户的网盘信息
  3381. var _formel = U.selectEl('#U_MD_DK_VW_ChosenSaveFile')[0]; //获取窗体元素
  3382. var _file; //定义变量
  3383. type = type ? type : "*"; //默认为全部
  3384. if (_formel) { //判断窗体是否存在
  3385. //存在则居中显示
  3386. U.UF.F.windowTopCenter(_formel);
  3387. //获取文件区域
  3388. _file = U.selectEl('#U_MD_DK_VW_ChosenSaveFile_File')[0];
  3389. _file.innerHTML = "";
  3390. }
  3391. else {
  3392. var _box = $$('div', { style: { position: "relative", overflow: "hidden" }, "className": "U_MD_DK_VW_ChosenSaveFile" }); //创建文件区域容器
  3393. var _newfolder = $$('button', { style: { position: "absolute", right: "0", top: "2px" }, innerHTML: "新建文件夹" }, _box); //创建新建文件夹按钮
  3394. $$("div", { style: { "font-size": "16px", padding: "12px 10px 2px" }, innerHTML: "文件名称" }, _box); //创建标题
  3395. $$("hr", {}, _box); //创建分割线
  3396. _file = $$("div", { "className": "U_MD_DK_VW_ChosenSaveFile_File", id: "U_MD_DK_VW_ChosenSaveFile_File" }, _box); //创建文件区域
  3397. var _inputarea = $$('div', {}, _box); //创建填写文件名区域
  3398. $$('span', { 'innerHTML': '文件名:' }, _inputarea); //标题
  3399. var _input = $$('input', { "className": "U_MD_DK_VW_ChosenSaveFileName", placeholder: "请输入文件名...", style: { width: "89%", "text-indent": "5px", "line-height": "26px"} }, _inputarea); //文件名输入框
  3400. var _ensure = $$('button', { innerHTML: "确定" }, _box); //确定按钮
  3401. var _cancel = $$('button', { innerHTML: "取消" }, _box); //取消按钮
  3402. //创建窗体
  3403. _formel = new U.UF.UI.form(
  3404. "<span id='U_MD_DK_VW_ChosenSaveFile_Title'>选择文件</span>",
  3405. _box, {
  3406. "id": "U_MD_DK_VW_ChosenSaveFile",
  3407. "style": {
  3408. "width": "600px",
  3409. "height": "450px"
  3410. }
  3411. }).form;
  3412. //绑定新建文件夹事件
  3413. _newfolder.onclick = function () {
  3414. U.MD.DK.VW.chosenSaveFile.newFolder();
  3415. }
  3416. //绑定确定按钮事件
  3417. _ensure.onclick = function () {
  3418. cb($('.U_MD_DK_VW_ChosenSaveFileName')[0].data); //回调
  3419. U.UF.F.windowMinimize(_formel); //隐藏弹框
  3420. _input.value = ""; //清空显示
  3421. _input.data = null; //清空数据
  3422. }
  3423. //取消函数
  3424. _cancel.onclick = function () {
  3425. U.UF.F.windowMinimize(_formel);
  3426. }
  3427. }
  3428. //默认创建初始化目录
  3429. 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);
  3430. }
  3431. //#endregion;
  3432. ///<jscompress sourcefile="LeftClick.js" />
  3433. /*
  3434. 存在问题
  3435. 1、非能打开文件处理
  3436. */
  3437. Namespace.register("U.MD.DK.LE"); //Disk左键事件命名空间
  3438. //#region 左键事件处理
  3439. //#region 当前网盘打开
  3440. //文件点击,文件夹点击,及url导航到达区域。
  3441. /*
  3442. 文件管理区域点击事件,暂时分为:音乐、图片、视频、文件。
  3443. 参数一:fileinfo为单击的文件对象
  3444. 参数四:userid为用户id。
  3445. */
  3446. U.MD.DK.LE.openFileDirectory = function (fileinfo, userid) {
  3447. var i,
  3448. _content,
  3449. _div,
  3450. _apptype, //打开应用的名字
  3451. _applicationame, //应用的名字
  3452. _types = US.disk.applicationTypes, //所有的文件类型
  3453. _navarray, //导航数组
  3454. _extension, //文件扩展名
  3455. _diskinfo = U.MD.DK.M.diskOperatingSwitch(userid); //根据用户id找到其所有硬盘数据。
  3456. U.UF.EV.stopBubble(); //阻止冒泡
  3457. //fileinfo.filetype == 1是文件 == 0 是文件夹
  3458. //如果是文件的情况下的处理
  3459. if (fileinfo.filetype) {
  3460. _extension = fileinfo["UserDirectoryExtendType"].toLocaleLowerCase(); //得到文件扩展名
  3461. //根据文件类型进入不同的应用。
  3462. _types = US.disk.applicationTypes;
  3463. _applicationame;
  3464. //判断后缀名归属于哪一个应用程序。得到应用程序的名称。
  3465. for (i in _types) {
  3466. if (_types[i].types.indexOf(_extension) > -1) { //判断文件类型是否归属该应用
  3467. _applicationame = i;
  3468. break;
  3469. }
  3470. }
  3471. //根据应用名称打开不同的应用。
  3472. switch (_applicationame) {
  3473. case "music": //播放制定的音乐,需要流程图
  3474. U.MD.DK.LE.music(fileinfo); //音乐控件
  3475. break;
  3476. case "image": //图片查看,需要流程图
  3477. U.MD.DK.LE.img(fileinfo); //图片控件
  3478. break;
  3479. case "video": //视频处理 需要流程图
  3480. U.MD.DK.LE.video(fileinfo); //视频控件
  3481. break;
  3482. case "text": //文本文件需要流程图
  3483. U.MD.D.Txt.textCreate(fileinfo);
  3484. break;
  3485. case "usoffice": //如果是云端系统自有格式文件。 需要流程图
  3486. //excel处理
  3487. case "ue": //word处理
  3488. U.MD.D.I.openApplication("excel", fileinfo); //弹出应用处理
  3489. break;
  3490. case "uw": case "un": //word处理
  3491. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  3492. break;
  3493. case "word":
  3494. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  3495. break;
  3496. case "txt": //txt处理
  3497. U.MD.D.I.openApplication("txt", fileinfo); //弹出应用处理
  3498. break;
  3499. //windows上传的不可识别的文件打开,直接跳转到下载页面。
  3500. default:
  3501. U.MD.DK.RE.downloadFile(fileinfo.UserDirectoryID, false);
  3502. break;
  3503. }
  3504. }
  3505. //打印目录信息
  3506. else {
  3507. //添加前进后退事件
  3508. U.UF.N.addEvent(function () {
  3509. U.MD.DK.LE.openDirectory(fileinfo, userid); //打开目录
  3510. }, "disk" + userid);
  3511. }
  3512. //设置文件及文件夹的修改时间,打开文件或者文件夹时,把打开文件的时间记录到数据库。以实现最近访问文件,最近访问文件夹的功能。fileinfo.filetype == 0 表示文件夹 fileinfo.filetype == 1表示文件
  3513. if (fileinfo.UserDirectoryDeep > 1) {
  3514. //filetype = 0的情况是文件夹的处理
  3515. if (fileinfo.filetype == 0) {
  3516. U.A.Request(US.DISK, ["UpdateDirectoryInfo", fileinfo.UserDirectoryID, ""], function () { });
  3517. }
  3518. //文件的处理
  3519. else {
  3520. U.A.Request(US.DISK, ["UpdateFileInfo", fileinfo.UserDirectoryID, ""], function () { });
  3521. }
  3522. //设置文件更新时间
  3523. fileinfo["UserDirectoryModifyTime"] = U.UF.D.toTimeStamp(); //修改前台的时间
  3524. }
  3525. }
  3526. /**
  3527. * 打开目录
  3528. * @param {array} 需要输出的文件或者文件夹信息
  3529. * @param {element} 输出到那个区域
  3530. **/
  3531. U.MD.DK.LE.openDirectory = function (fileinfo, userid) {
  3532. var _groupinfo,
  3533. _groupdirectory,
  3534. _leftel, //左边元素
  3535. _diskinfo = U.MD.DK.M.diskOperatingSwitch(userid), //获取网盘信息
  3536. _content = U.selectEl("#U_MD_DK_RZ", _diskinfo.formel)[0]; //获取打印内容的元素
  3537. _diskinfo.selectElement = []; //切换文件夹修改选择文件
  3538. _content.innerText = ""; //清空内容
  3539. _diskinfo.directoryid = fileinfo["UserDirectoryID"]; //设置当前打开目录的id.看全集变量US.disk.Disks
  3540. //设置url重写
  3541. U.MD.N.urlWrite("disk/" + _diskinfo.userInfo.UserId + "/" + _diskinfo.directoryid, _diskinfo.userInfo.UserNickName + "的网盘");
  3542. //判断这个目录下面有没有孩子节点,如果有就可以直接打印,如果没有那么需要去数据库取数据
  3543. if (fileinfo.Child) { //已加载文件
  3544. U.MD.DK.LE.loadDirectory(fileinfo, _diskinfo, userid);
  3545. }
  3546. //去数据库取文件夹及文件信息,异步加载
  3547. else {
  3548. //如果是最新文档的数据处理
  3549. if (_diskinfo.directoryOrFiles[0].UserDirectoryID == fileinfo.UserDirectoryID) {
  3550. U.MD.DK.LE.getNewDocument(userid, fileinfo, _content);
  3551. }
  3552. //如果是点击他人邀请或者是我的协同的处理
  3553. else if (_diskinfo.directoryOrFiles[1].UserDirectoryID == fileinfo.UserDirectoryID || _diskinfo.directoryOrFiles[2].UserDirectoryID == fileinfo.UserDirectoryID) {
  3554. if (US.friend.group) {
  3555. _groupinfo = US.friend.group.concat();
  3556. _diskinfo.groups = _groupdirectory = U.MD.DK.getGroupDirectory(_groupinfo, _diskinfo.directoryOrFiles, userid); //初始化
  3557. _diskinfo.directoryOrFiles = _diskinfo.directoryOrFiles.concat(_groupdirectory); //合并数组
  3558. }
  3559. U.MD.DK.LE.loadDirectory(fileinfo, _diskinfo, userid); //打印目录信息
  3560. }
  3561. //获取文件夹下面的文件或者文件夹
  3562. else {
  3563. U.MD.DK.LE.getChildsByDirectoryId(userid, fileinfo, _content);
  3564. }
  3565. }
  3566. }
  3567. /**
  3568. * 初始化目录
  3569. * @param {object} 文档信息
  3570. * @param {object} 网盘信息
  3571. * @param {string} 用户id
  3572. **/
  3573. U.MD.DK.LE.loadDirectory = function (fileinfo, diskinfo, userid) {
  3574. //展开下级文件夹
  3575. var _childs = fileinfo.Child || [],
  3576. _leftel = U.selectEl("#L" + fileinfo["UserDirectoryID"], diskinfo.formel)[0],
  3577. _content = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0];
  3578. //左边树目录处理
  3579. if (_leftel) {
  3580. U.MD.DK.LL.printLeftTreeDirectory(U.Json.select(_childs, { "filetype": 0 }), _leftel, userid); //如果左边数目显示了
  3581. }
  3582. U.selectEl("#U_MD_DK_RKR", diskinfo.formel)[0].innerHTML = "当前文件的数量:" + _childs.length;
  3583. diskinfo.currentDirectoryFile = _childs; //把当前显示打印的资料显示到网盘中。
  3584. //头部导航打印
  3585. var _navarray = U.MD.DK.C.getAncestors(fileinfo, diskinfo); //获取需要输出的导航信息,这里直接获取这个目录一条线上的祖先元素
  3586. U.MD.DK.LL.printNavigation(_navarray, U.selectEl("#U_MD_DK_RYB", diskinfo.formel)[0], userid); //打印出导航数据
  3587. //打印数据
  3588. U.MD.DK.VW.printContent(_childs, _content);
  3589. //给当前目录设置权限
  3590. var _permissions = U.MD.DK.C.getDirectoryPermissions(fileinfo.UserDirectoryID, diskinfo);
  3591. var _permissioninfo = U.MD.DK.C.readWritePermission(fileinfo.UserDirectoryID, diskinfo)
  3592. U.MD.DK.LE.myCollJudgment(_permissions, _permissioninfo[0][0]);
  3593. }
  3594. /**
  3595. * 权限按钮显示方法
  3596. * @param {object} 权限数据
  3597. * @param {object} 文件信息
  3598. **/
  3599. U.MD.DK.LE.myCollJudgment = function (permissions, permissioninfo) {
  3600. var _div = U.selectEl(".U_MD_DK_RT")[1].children; //获取上边所有按钮
  3601. if (permissions.isupadte == false && permissions.isdownload == false && permissions.isnew == false) {//判断是否为我的协同或他人邀请,如果是
  3602. _div[0].style.display = "none"; //修改上传按钮的显示,为隐藏
  3603. _div[1].style.display = "none"; //修改新建文件夹按钮的显示,为隐藏
  3604. _div[2].style.display = "none"; //修改新建文件按钮的显示,为隐藏
  3605. _div[3].style.display = "none"; //修改新建文档按钮的显示,为隐藏
  3606. _div[4].style.display = "none"; //修改导航文档按钮的显示,为隐藏
  3607. _div[5].style.display = "none"; //修改新建工作表按钮的显示,为隐藏
  3608. _div[6].style.display = "none"; //修改建立网站按钮的显示,为隐藏
  3609. _div[7].style.display = "none"; //隐藏新建协同按钮
  3610. if (permissioninfo.UserDirectoryName == "我的协同") {//进行判断,如为我的协同文件夹
  3611. _div[7].style.display = "block"; //显示新建协同按钮
  3612. _div[7].onclick = function () {//赋予点击事件
  3613. U.MD.F.J.groupInfoForm(); //调用方法,添加协同文件
  3614. }
  3615. }
  3616. } else {//如果不是
  3617. _div[0].style.display = "block"; //修改上传按钮的显示,为显示
  3618. _div[1].style.display = "block"; //修改新建文件夹按钮的显示,为显示
  3619. _div[2].style.display = "block"; //修改新建文件按钮的显示,为显示
  3620. _div[3].style.display = "block"; //修改新建文档按钮的显示,为显示
  3621. _div[4].style.display = "block"; //修改导航文档按钮的显示,为显示
  3622. _div[5].style.display = "block"; //修改新建工作表按钮的显示,为显示
  3623. _div[6].style.display = "block"; //修改建立网站按钮的显示,为显示
  3624. _div[7].style.display = "none"; //隐藏新建协同按钮
  3625. }
  3626. }
  3627. //加载当前网盘内容
  3628. //
  3629. //* @param {string} 用户id
  3630. //* @param {object} 目录信息
  3631. //* @param {element} loading的元素。
  3632. //* @param {callback} 回调函数
  3633. //* @returns {} 无
  3634. //
  3635. U.MD.DK.LE.getChildsByDirectoryId = function (userid, fileinfo, loading, cb) {
  3636. //如果没有孩子节点,则去数据库取数据。
  3637. U.A.Request(US.DISK, ["GetChildsByDirectoryId", userid, fileinfo.UserDirectoryID, fileinfo.GroupID], U.MD.DK.LE.asynGetChildsByDirectoryId, [loading, userid, fileinfo, cb]);
  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.getNewDocument = function (userid, fileinfo, loading, cb) {
  3648. //用户必须登录才能查看自己网盘的内容
  3649. if (US.userInfo.UserId) {
  3650. //如果没有孩子节点,则去数据库取数据。
  3651. U.A.Request(US.CD, [US.DB, "UseStudio_Office", "GetCollaborativeDocument", US.userInfo.UserId, "00000000-0000-0000-0000-000000000000", "", 0, 0, 100], function (r) {
  3652. var i;
  3653. for (i = 0; i < r.value.length; i++) {
  3654. 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);
  3655. }
  3656. U.MD.DK.LE.asynGetChildsByDirectoryId(r);
  3657. }, [loading, userid, fileinfo, cb]);
  3658. }
  3659. //直接打印空数据
  3660. else {
  3661. U.MD.DK.LE.asynGetChildsByDirectoryId({ "context": [loading, userid, fileinfo, cb], "value": [] });
  3662. }
  3663. }
  3664. /**
  3665. * 获取网盘数据异步,这里处理了后台数据返回后吧数据写到了全局变量US.disk.Disks[userid][0]和US.disk.Disks[userid][4]中
  3666. *
  3667. * @param {object} ajax异步数据
  3668. */
  3669. U.MD.DK.LE.asynGetChildsByDirectoryId = function (r) {
  3670. var _context = r.context, //获取异步的传参
  3671. _userid = _context[1], //用户的id
  3672. _fileinfo = _context[2], //文件的信息
  3673. _cb = _context[3], //回调函数
  3674. _dirid = _fileinfo.UserDirectoryID, //当前获取数据的目录id
  3675. _diskinfo = U.MD.DK.M.diskOperatingSwitch(_userid); //获取用户的disk信息
  3676. r = r.value;
  3677. //把获取的数据设置到网盘全局变量中,为啥有两种数据结构?
  3678. U.Json.del(_diskinfo.directoryOrFiles, { "UserDirectoryParentID": _dirid }); //移除原本有的目录文件
  3679. _fileinfo.Child = r; //设置目录的子目录或者文件
  3680. U.Json.add(r, { "Parent": _fileinfo });
  3681. //添加文件
  3682. U.MD.DK.M.entity.add(r, _diskinfo); //把文件写入到全局变量中 在_diskinfo[0]和_diskinfo[4]写入获取文件的信息
  3683. //执行回调处理
  3684. if (U.UF.C.isFunction(_cb)) {
  3685. _cb();
  3686. }
  3687. //否则执行获取数据后打开文件的处理
  3688. else if (_fileinfo.UserDirectoryID == _diskinfo.directoryid) {
  3689. //如果用户还在等待当前目录信息出现,那么就展示,如果用户在loading的时候已经切换到其他地方去查看,那么则不展示数据更新
  3690. U.MD.DK.LE.openDirectory(_fileinfo, _userid); //打开目录操作
  3691. }
  3692. }
  3693. /**
  3694. * 根据应用名称打开音乐播放器
  3695. *
  3696. *参数一:fileinfo为单击的文件对象
  3697. */
  3698. U.MD.DK.LE.music = function (fileinfo) {
  3699. var _mp3arr, i,
  3700. _num = 0, //索引位置
  3701. _diskinfo = US.disk.UserDisk,
  3702. _arr = []; //空数组
  3703. //判断是否单独打开还是打开文件夹下所有的音乐
  3704. if (fileinfo.UserDirectoryParentID) {
  3705. _mp3arr = U.Json.select(_diskinfo.currentDirectoryFile, { "UserDirectoryExtendType": "mp3", "UserDirectoryParentID": fileinfo.UserDirectoryParentID });
  3706. //当前打开的文件夹的所有音乐文件信息
  3707. for (i = 0; i < _mp3arr.length; i++) {
  3708. _arr[i] = {
  3709. "title": _mp3arr[i].UserallDirectoryName, //音乐名
  3710. "author": "", //歌手名
  3711. "src": "http://fs.1473.cn/" + _mp3arr[i].UserFilesServerName, //音乐播放路径
  3712. "cover": _mp3arr[i].UserThumbnailImageHead, //音乐封面路径
  3713. "lrc": ""//歌词
  3714. }
  3715. if (_mp3arr[i].UserDirectoryID == fileinfo.UserDirectoryID) {//判断在哪个音乐文件打开的
  3716. _num = i; //索引位置
  3717. }
  3718. }
  3719. }
  3720. else {
  3721. _arr[0] = {
  3722. "title": fileinfo.UserallDirectoryName, //音乐名
  3723. "author": "", //歌手名
  3724. "src": "http://fs.1473.cn/" + fileinfo.UserFilesServerName, //音乐播放路径
  3725. "cover": fileinfo.UserThumbnailImageHead, //音乐封面路径
  3726. "lrc": ""//歌词
  3727. }
  3728. }
  3729. U.MD.UI.music(_arr, _num, true); //音乐控件
  3730. 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); } });
  3731. // var _userid = US.disk.UserDisk.userInfo.UserId; //当前打开网盘ID
  3732. // var _diskinfo = U.MD.DK.M.diskOperatingSwitch(_userid); //磁盘信息
  3733. // var _music = U.Json.select(_diskinfo.currentDirectoryFile, { "UserDirectoryExtendType": "mp3" }); //获取当前打开的文件夹的所有音乐文件信息
  3734. // var _arr = []; //空数组
  3735. // var _num1 = 0; //索引位置
  3736. // for (var _num = 0; _num < _music.length; _num++) {//当前打开的文件夹的所有音乐文件信息
  3737. // _arr[_num] = { title: _music[_num].UserallDirectoryName, //音乐名
  3738. // author: "", //歌手名
  3739. // src: "http://fs.1473.cn/" + _music[_num].UserFilesServerName, //音乐播放路径
  3740. // cover: _music[_num].UserThumbnailImageHead, //音乐封面路径
  3741. // lrc: ""//歌词
  3742. // }
  3743. // if (_music[_num].UserDirectoryID == fileinfo.UserDirectoryID) {//判断在哪个音乐文件打开的
  3744. // _num1 = _num; //索引位置
  3745. // }
  3746. // }
  3747. // U.MD.UI.music(_arr, _num1, true); //音乐控件
  3748. // if (!$('#U_MD_D_T_taskbar_music')[0]) {
  3749. // U.MD.UI.music.player.id = "music";
  3750. // 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); } });
  3751. // }
  3752. // U.MD.UI.music(_arr, _num1, true); //音乐控件
  3753. // 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); } });
  3754. }
  3755. /**
  3756. * 根据应用名称打开图片
  3757. *
  3758. *参数一:fileinfo为单击的文件对象
  3759. */
  3760. U.MD.DK.LE.img = function (fileinfo) {
  3761. var _diskinfo = US.disk.UserDisk;
  3762. U.UF.DL.asynLoadCss({ "href": "/css/Controls/Basic/Picture.css", type: "text/css", rel: "stylesheet" }); //动态添加css文件
  3763. U.UF.DL.asynLoadJs({ type: "text/javascript", src: "/js/Controls/Basic/Picture.js" }, function () {
  3764. var i,
  3765. j = 0,
  3766. _arr = [], //空数组
  3767. _num = 0;
  3768. //判断打开的图片是在自己本地下的
  3769. if (_diskinfo && fileinfo.UserDirectoryParentID && _diskinfo.userInfo.UserId == fileinfo.UserId) {
  3770. for (i = 0; i < _diskinfo.currentDirectoryFile.length; i++) {//当前打开文件夹的文件
  3771. if (fileinfo.UserDirectoryParentID == _diskinfo.currentDirectoryFile[i].UserDirectoryParentID && U.UF.UP.isImg(_diskinfo.currentDirectoryFile[i].UserDirectoryExtendType)) {
  3772. _arr[j] = "http://fs.1473.cn/" + _diskinfo.currentDirectoryFile[i].UserFilesServerName; //图片地址
  3773. if (_diskinfo.currentDirectoryFile[i].UserDirectoryID == fileinfo.UserDirectoryID) {//判断在哪个音乐文件打开的
  3774. _num = j; //索引位置
  3775. }
  3776. j++;
  3777. }
  3778. }
  3779. }
  3780. if (_arr.length == 0) {
  3781. _arr.push("http://fs.1473.cn/" + fileinfo.UserFilesServerName);
  3782. }
  3783. U.MD.UI.picture(_arr, _num)//图片控件
  3784. U.UF.F.topWindow($('#U_MD_UI_PictureForm')[0], true); //窗体置顶
  3785. });
  3786. }
  3787. /**
  3788. * 根据应用名称打开视频
  3789. *
  3790. *参数一:fileinfo为单击的文件对象
  3791. */
  3792. U.MD.DK.LE.video = function (fileinfo) {
  3793. var _form = new U.UF.UI.form(fileinfo.UserallDirectoryName, "", { "style": { "width": "780px", "height": "330px", "margin": "0"} }, { istop: true, isstretching: false, isenlarge: false, isnarrow: false }); //窗体
  3794. U.UF.DL.asynLoadCss({ rel: "stylesheet", type: "text/css", href: "/css/Controls/Basic/Video.css" }); //动态添加css文件
  3795. U.UF.DL.asynLoadJs({ src: "/js/Controls/Basic/Video.js", "charset": "utf-8", "type": "text/javascript" }, function () {//动态添加js文件
  3796. var _video = U.MD.UI.video(("http://fs.1473.cn/" + fileinfo.UserFilesServerName), 780, 300, false, _form.middle); //视频控件
  3797. //窗体关闭,声音停止
  3798. _form.closecallback = function () {
  3799. _video.video.pause();
  3800. }
  3801. // U.selectEl(".U_MD_UI_video_VideoDiv")[$(".U_MD_UI_video_VideoDiv").length - 1].style.position = "absolute"; //视频的位置
  3802. // U.selectEl(".U_MD_UI_video_VideoDiv")[$(".U_MD_UI_video_VideoDiv").length - 1].style.top = "0px"; //视频的定位高低
  3803. // U.selectEl(".U_MD_UI_video_VideoDiv")[$(".U_MD_UI_video_VideoDiv").length - 1].style.left = "0px"; //视频的定位左右
  3804. });
  3805. }
  3806. //#endregion
  3807. ;
  3808. ///<jscompress sourcefile="LeftTree.js" />
  3809. Namespace.register("U.MD.DK.LL"); //Disk导航命名空间
  3810. //#region 导航
  3811. /**
  3812. * 导航打印(树导航)
  3813. * @param {object} 左边一级层级树目录的相关信息
  3814. * @param {element} 输出到那个区域
  3815. * @param {array} 树目录的class样式数组
  3816. * @param {element} 树目录区域
  3817. * @param {str} 当前用户ID
  3818. **/
  3819. U.MD.DK.LL.printLeftTreeDirectory = function (directorys, el, userid, classes) {
  3820. var _dtorydiv, //目录元素
  3821. _namediv, //名字元素
  3822. _frag = $$("div"), //临时块元素
  3823. _padding = 3 //左对齐
  3824. ;
  3825. //判断展开的基本是否大于二级,大于二级则设置padding
  3826. if ($(el).Child()[0]) {
  3827. _padding = parseInt($(el).Child()[0].style.paddingLeft || 0) + 5;
  3828. //如果不展开的处理
  3829. if ($($(el).Child()[0]).Child()[0].className.indexOf("U_MD_DK_LTXOSIO") == -1) {
  3830. return;
  3831. }
  3832. }
  3833. //如果已经展开的处理
  3834. if ($(el).Child()[1]) {
  3835. el.removeChild($(el).Child()[1]);
  3836. }
  3837. //打印所有需要打印的目录信息
  3838. for (i = 0; i < directorys.length; i++) {
  3839. if (directorys[i].filetype == 0) {
  3840. //得到打印文件夹的图标样式
  3841. if ((classes || "").length) {
  3842. _Img = classes[i] || classes;
  3843. }
  3844. else {
  3845. if ((directorys[i]["UserDirectoryEncrypt"] && directorys[i]["UserDirectoryEncrypt"] != userid)) {
  3846. _Img = "U_MD_DK_LCJ";
  3847. }
  3848. else {
  3849. _Img = "U_MD_DK_LCW";
  3850. }
  3851. }
  3852. //创建左边树目录
  3853. _dtorydiv = $$("div", { "id": directorys[i]["UserDirectoryID"] ? "L" + directorys[i]["UserDirectoryID"] : "", "className": "U_MD_DK_LTXOA" }, _frag);
  3854. _namediv = $$("div", {
  3855. "className": "U_MD_DK_LTXOS",
  3856. "style": {
  3857. "paddingLeft": _padding + "px"
  3858. },
  3859. //导航点击事件的处理
  3860. "onclick": U.UF.C.closure(function (directoryinfo, el) {
  3861. U.UF.EV.stopBubble();
  3862. U.MD.DK.LL.leftTreeClick(directoryinfo, el, userid)
  3863. }, [directorys[i], _dtorydiv]),
  3864. //右键处理
  3865. "oncontextmenu": U.UF.C.closure(function (directoryinfo) {
  3866. U.UF.EV.stopBubble();
  3867. U.UF.EV.stopDefault();
  3868. U.MD.DK.RM.rightMenu(this, directoryinfo, US.disk.UserDisk);
  3869. }, [directorys[i]])
  3870. }, _dtorydiv);
  3871. $$("div", {
  3872. "className": "U_MD_DK_LTXOSI U_MD_DK_Img"
  3873. }, _namediv);
  3874. $$("div", { "className": "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img " + _Img }, _namediv);
  3875. //文件名
  3876. $$("div", {
  3877. "className": "U_MD_DK_LTXOSN U_MD_D_Text_Abbreviation",
  3878. "innerHTML": directorys[i].UserallDirectoryName,
  3879. "ondblclick": U.UF.C.closure(function (directoryinfo) {
  3880. U.UF.EV.stopBubble();
  3881. U.MD.DK.RE.rename(this, directoryinfo);
  3882. }, [directorys[i]])
  3883. }, _namediv);
  3884. }
  3885. }
  3886. el.appendChild(_frag);
  3887. }
  3888. /**
  3889. * 导航点击处理
  3890. * @param {object} 左边一级层级树目录的相关信息
  3891. * @param {element} 输出到那个区域
  3892. * @param {string} 当前用户ID
  3893. **/
  3894. U.MD.DK.LL.leftTreeClick = function (fileinfo, el, userid) {
  3895. var _childel = U.selectEl(el).Child()[0];
  3896. //权限判断
  3897. //打开文件夹的图标高亮处理
  3898. if ($(_childel).Child()[0].className.indexOf("U_MD_DK_LTXOSIO") > -1) {
  3899. U.selectEl(_childel).Child()[0].className = "U_MD_DK_LTXOSI U_MD_DK_Img"; //图标展开的形式
  3900. //打开文件夹处理
  3901. var _contentel = U.selectEl(_childel).next();
  3902. // _childel.className = "U_MD_DK_LTXOS"//重新设置class
  3903. if (_contentel[0]) {
  3904. el.removeChild(_contentel[0]); //清除元素
  3905. }
  3906. }
  3907. else {
  3908. // U.MD.DK.LL.leftTreeHighlight(el); //左边树点击处理
  3909. U.selectEl(_childel).Child()[0].className = "U_MD_DK_LTXOSI U_MD_DK_Img U_MD_DK_LTXOSIO"; //图标展开的形式
  3910. }
  3911. U.selectEl(".U_MD_DK_LTXOSO").removeClass('U_MD_DK_LTXOSO');
  3912. U.selectEl(_childel).addClass('U_MD_DK_LTXOSO');
  3913. //打开文件夹处理
  3914. U.MD.DK.LE.openFileDirectory(fileinfo, userid);
  3915. }
  3916. /**
  3917. * 导航点击处理
  3918. * @param {object} 左边一级层级树目录的相关信息
  3919. * @param {element} 输出到那个区域
  3920. * @param {string} 当前用户ID
  3921. **/
  3922. U.MD.DK.LL.leftTreeHighlight = function (el) {
  3923. var i,
  3924. _childel,
  3925. _parentel = el
  3926. ;
  3927. //递归处理上级高亮处理
  3928. do {
  3929. _parentel = el.parentNode; //获取高亮元素的上级父亲
  3930. _childel = U.selectEl(_parentel).Child(); //获取该级的所有子节点
  3931. //如果在同一个文件夹下只能高亮一个文件目录,这样看起来才能显示当前点击的文件夹
  3932. for (i = 0; i < _childel.length; i++) {
  3933. U.selectEl(_childel[i]).Child()[0].className = el == _childel[i] ? "U_MD_DK_LTXOS U_MD_DK_LTXOSO" : "U_MD_DK_LTXOS";
  3934. }
  3935. } while ((el = _parentel.parentNode) && el.id != "U_MD_DK_LTXO")
  3936. }
  3937. /**
  3938. * 生成导航(面包屑导航)
  3939. * @param {array} 所有要追加的导航元素
  3940. * @param {element} 导航的元素
  3941. * @param {string} 用户的id
  3942. */
  3943. U.MD.DK.LL.printNavigation = function (navarray, el, userid) {
  3944. var i, //用于循环
  3945. _frag = $$("frag"), //临时的panel
  3946. _click //导航点击事件处理
  3947. ;
  3948. el.innerText = ""; //清空导航区域
  3949. //循环打印导航
  3950. for (i = navarray.length - 1; i > -1; i--) {
  3951. //创建一个导航, 如果导航是目录的导航,则点击的时候可以跳到指定的导航中
  3952. $$("div", { "className": "U_MD_DK_RYBO", "innerHTML": navarray[i]["UserallDirectoryName"],
  3953. "onclick": U.UF.C.closure(function (nav) {
  3954. U.MD.DK.LE.openFileDirectory(nav, userid);
  3955. }, [navarray[i]])
  3956. }, _frag);
  3957. }
  3958. el.appendChild(_frag); //添加导航
  3959. //每一次导航追加的时候需要如果超过了大小则需要隐藏前面的导航
  3960. var _navchild = U.selectEl(el).Child(); //导航元素
  3961. while (el.scrollHeight > 30) {
  3962. _navchild[i].style.display = "none";
  3963. }
  3964. }
  3965. //#endregion
  3966. ;
  3967. ///<jscompress sourcefile="RightClick.js" />
  3968. Namespace.register("U.MD.DK.RE"); //Disk右键功能命名空间
  3969. //#region 文件属性
  3970. /**
  3971. * 用户属性框的样式
  3972. * @param {object} 目录目录或者文件信息
  3973. * @param {string} 用户id
  3974. */
  3975. U.MD.DK.RE.attribute = function (fileordir, userid) {
  3976. var _diskinfo = U.MD.DK.M.diskOperatingSwitch(userid),
  3977. _attributeel = U.MD.DK.RE.attributeStyle(fileordir, true, _diskinfo); //用户属性框的样式
  3978. U.UF.UI.alertClick(_attributeel);
  3979. }
  3980. /**
  3981. * 用户属性框的样式
  3982. * @param {object} 目录目录或者文件信息
  3983. * @param {bool} 是否需要设置权限
  3984. */
  3985. U.MD.DK.RE.attributeStyle = function (fileordir, issetpermissions, diskinfo) {
  3986. var _selected = 2;
  3987. var _icon = U.MD.DK.C.getIcon(fileordir.UserDirectoryExtendType.toLowerCase())
  3988. var _box = $$("div", { className: "U_MD_DK_fileInfo" });
  3989. var _head = $$("div", { className: "U_MD_DK_fileInfo_head" }, _box);
  3990. $$("div", { className: "U_MD_DK_fileInfo_line" }, _box);
  3991. var _info = $$("div", { className: "U_MD_DK_fileInfo_info" }, _box);
  3992. //图片样式设置
  3993. if (U.UF.UP.isImg(fileordir.UserDirectoryExtendType)) {
  3994. var _img = $$("div", { className: "U_MD_DK_fileInfo_img" }, _head);
  3995. $$("img", { "onerror": U.MD.C.imgError, "src": U.MD.C.getHeadImage(fileordir.UserDirectoryUrl) }, _img);
  3996. }
  3997. else {
  3998. $$("div", { className: "U_MD_DK_fileInfo_icon U_MD_DK_Img " + _icon.classname[1] }, _head);
  3999. }
  4000. $$("div", { style: { "cssText": "overflow:hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 42px;padding-left:10px;" }, innerHTML: fileordir.UserallDirectoryName, "title": fileordir.UserallDirectoryName }, _head);
  4001. //文件处理
  4002. if (fileordir.filetype) {
  4003. $$("div", { "innerHTML": "<span>类型:</span>文件" }, _info);
  4004. $$("div", { "spellcheck": "false", "onselectstart": U.UF.EV.stopBubble,
  4005. "innerHTML": "<span>路径:</span>" + "http://fs.1473.cn/" + fileordir["UserDirectoryID"] + ""
  4006. }, _info);
  4007. }
  4008. else if (issetpermissions) {
  4009. $$("div", { "innerHTML": "<span>类型:</span>" + "文件夹" }, _info);
  4010. var _permission = $$("div", { "className": "", "innerHTML": "<span>权限选择:</span>" }, _info);
  4011. var _select = $$("select", { "onchange": function () { U.MD.DK.RE.setpermissions(this, fileordir, diskinfo); } }, _permission);
  4012. $$('option', { value: "1", innerHTML: "只允许上传" }, _select);
  4013. $$('option', { value: "2", innerHTML: "只允许下载" }, _select);
  4014. $$('option', { value: "", innerHTML: "无限制" }, _select);
  4015. if (fileordir.UserDirectoryEncrypt == "1") {
  4016. _selected = 0;
  4017. }
  4018. else if (fileordir.UserDirectoryEncrypt == "2") {
  4019. _selected = 1;
  4020. }
  4021. U.selectEl('option', _select)[_selected].selected = true; //选中
  4022. }
  4023. $$("div", { "innerHTML": "<span>大小:</span>" + U.UF.UP.minUnitToMaxUnit(fileordir.UserDirectorySize) }, _info);
  4024. $$("div", { "innerHTML": "<span>创建时间:</span>" + U.UF.D.getYearMonthDay(fileordir.UserDirectoryAddTime) }, _info);
  4025. return _box;
  4026. }
  4027. /**
  4028. * 共享文件夹设置权限
  4029. * @param {element} 目录目录或者文件信息
  4030. * @param {object} 是否需要设置权限
  4031. */
  4032. U.MD.DK.RE.setpermissions = function (selectel, dirinfo, diskinfo) {
  4033. var _value = selectel.options[selectel.selectedIndex].value; //获取设置权限的值
  4034. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "SetFtpPriviledge", dirinfo.UserDirectoryID, _value], U.MD.DK.RE.asynSetPermissions, ["", dirinfo, _value, diskinfo]);
  4035. U.alert("权限设置中...");
  4036. }
  4037. /**
  4038. * 共享文件夹设置权限
  4039. * @param {element} 目录目录或者文件信息
  4040. * @param {object} 是否需要设置权限
  4041. */
  4042. U.MD.DK.RE.asynSetPermissions = function (r) {
  4043. var _leftel,
  4044. _rightel,
  4045. _imgicon,
  4046. _context = r.context,
  4047. _dirinfo = _context[1], //文件夹信息
  4048. _value = _context[2],
  4049. _diskinfo = _context[3]; //加密的值
  4050. r = r.value;
  4051. //判断设置操作
  4052. if (r) {
  4053. _dirinfo.UserDirectoryEncrypt = _value; //设置加密的值
  4054. _leftel = U.selectEl("#L" + _dirinfo.UserDirectoryID, _diskinfo.formel)[0]; //左边的导航,文件夹同时展开的时候会存在
  4055. _rightel = U.selectEl("#R" + _dirinfo.UserDirectoryID, _diskinfo.formel)[0]; //右边文件或者文件夹的处理
  4056. //左边的目录处理
  4057. if (_leftel) {
  4058. //加密的处理
  4059. if (_value != "") {
  4060. _imgicon = "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img U_MD_DK_LCJ";
  4061. }
  4062. //未加密的处理
  4063. else {
  4064. _imgicon = "U_MD_DK_LCOI U_MD_DK_LTXOST U_MD_DK_Img U_MD_DK_LCW";
  4065. }
  4066. U.selectEl("div", _leftel)[2].className = _imgicon;
  4067. }
  4068. //右边的目录处理
  4069. if (_rightel) {
  4070. //加密的处理
  4071. if (_value != "") {
  4072. _imgicon = "U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOM";
  4073. }
  4074. //未加密的处理
  4075. else {
  4076. _imgicon = "U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOW";
  4077. }
  4078. U.selectEl("div", _rightel)[1].className = _imgicon;
  4079. }
  4080. }
  4081. //设置权限或者加密解密
  4082. else {
  4083. U.alert("设置失败");
  4084. }
  4085. }
  4086. //#endregion
  4087. //#region 新建文件夹
  4088. /**
  4089. * 新建文件夹处理的新建提示框
  4090. * @param {array} 需要删除文件的数组
  4091. * @param {string} 用户id
  4092. **/
  4093. U.MD.DK.RE.addFileOrFolder = function (fileordirinfo, diskinfo, dirinfo) {
  4094. var _nowdiskinfo = US.disk.UserDisk, //当前使用用户的网盘
  4095. _leftel = U.selectEl("#L" + dirinfo["UserDirectoryID"], diskinfo.formel)[0],
  4096. _el = U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0];
  4097. //在粘贴网盘的数组目录中添加值
  4098. U.MD.DK.M.entity.add(fileordirinfo, diskinfo); //添加到用户disk全局变量中
  4099. U.MD.DK.M.entity.addChild(fileordirinfo, dirinfo); //添加到子节点中
  4100. //操作的文件夹是否在异步结束后还在同一个文件夹下,如果是那么就添加
  4101. if (fileordirinfo[0].UserDirectoryParentID == _nowdiskinfo.directoryid && diskinfo == _nowdiskinfo && _nowdiskinfo.directoryid == diskinfo.directoryid) {
  4102. //如果里面没有内容是展示没有资源的处理
  4103. if ($(_el).Child()[0].className == "U_MD_DK_RZF") {
  4104. _el.innerText = "";
  4105. }
  4106. U.MD.DK.VW.printContent(fileordirinfo, _el); //打印到网盘中
  4107. //添加到侧边栏
  4108. if (_leftel) {
  4109. U.MD.DK.LL.printLeftTreeDirectory(fileordirinfo, _leftel, diskinfo.userInfo.UserId); //如果左边数目显示了
  4110. }
  4111. }
  4112. _el.scrollTop = _el.offsetHeight;
  4113. U.selectEl(_el.lastChild).addClass("U_MD_DK_RZOI");
  4114. }
  4115. /**
  4116. * 新建文件夹处理
  4117. **/
  4118. U.MD.DK.RE.newFolder = function (diskinfo) {
  4119. if (!U.MD.U.L.isLogin()) {//是否登录
  4120. var _directoryid = diskinfo.directoryid//目录id
  4121. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建文件权限
  4122. U.MD.DK.RE.newFolder.confirm(diskinfo, _directoryid); //新建提示框
  4123. }
  4124. else { U.alert("无权限访问此文件夹"); }; /// <reference path="../../robots.txt" />
  4125. }
  4126. }
  4127. /**
  4128. * 新建文件夹处理的新建提示框
  4129. * @param {array} 需要删除文件的数组
  4130. * @param {string} 用户id
  4131. **/
  4132. U.MD.DK.RE.newFolder.confirm = function (diskinfo, directoryid) {
  4133. var _ancestors, //目录的祖先元素
  4134. _groupid, //群id
  4135. _newguid = Guid.newGuid(), //新建文件夹的id
  4136. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": directoryid })[0], //目录网盘信息
  4137. _userid = US.userInfo.UserId, //新建用户id
  4138. _input = $$("input", { "placeholder": "请输入文件夹名字", "style": { "width": "180px", "height": "25px"} }) //输入的名字
  4139. //弹出comfir
  4140. U.MD.DK.RE.newconfirm(
  4141. _input,
  4142. function () {
  4143. var _name = _input.value;
  4144. //获取粘贴到制定目录的群id
  4145. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4146. //如果是ftp目录,那么groupid就是用户id
  4147. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  4148. _groupid = diskinfo.userInfo.UserId;
  4149. }
  4150. //否则就是对应的群id,如果不存在那么就是""
  4151. else {
  4152. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  4153. }
  4154. //文件名判断
  4155. if (U.UF.S.ZWFileName.test(_input.value)) {
  4156. //填写文件名符合规范 将文件夹以及文件夹名字保存到数据库
  4157. U.A.Request(US.DISK, ["CreateDirectory", _userid, _newguid, _dirinfo.UserDirectoryDeep + 1, _input.value, directoryid, "", _groupid, ""], //保存到数据库
  4158. function (r) {
  4159. var _fileinfo = new U.MD.DK.M.entity(_newguid, 0, directoryid, _name, _name, "folder", "", U.UF.D.toTimeStamp(), "", _dirinfo.UserDirectoryDeep + 1,
  4160. null, "", 0, "", _groupid, "", _userid, US.userInfo.UserNickName, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead)
  4161. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4162. }, []);
  4163. }
  4164. else {
  4165. U.alert("文件名过长或者为空");
  4166. return false;
  4167. }
  4168. },
  4169. function () { },
  4170. "新建文件夹"
  4171. );
  4172. }
  4173. /**
  4174. * 新建文件处理
  4175. **/
  4176. U.MD.DK.RE.newText = function (diskinfo, fun) {
  4177. if (!U.MD.U.L.isLogin()) {//是否登录
  4178. var _directoryid = diskinfo.directoryid; //目录id
  4179. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建文件权限
  4180. top.U.MD.DK.VW.chosenSaveFile('txt', null, '新建文件', fun); //新建提示框
  4181. }
  4182. else { U.alert("无权限访问此文件"); };
  4183. }
  4184. }
  4185. /**
  4186. * 新建文件处理的新建提示框
  4187. **/
  4188. U.MD.DK.RE.newText.confirm = function (diskinfo, directoryid, fun) {
  4189. var _ancestors, //目录的祖先元素
  4190. _groupid, //群id
  4191. _newguid = Guid.newGuid(), //新建文件夹的id
  4192. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": directoryid })[0], //目录网盘信息
  4193. _userid = US.userInfo.UserId, //新建用户id
  4194. _input = $$("input", { "placeholder": "请输入新文本文档的命名", "style": { "width": "180px", "height": "25px", "padding-left": "7px"} }); //输入的名字
  4195. //弹出comfirm
  4196. U.MD.DK.RE.newconfirm(_input,
  4197. function () {
  4198. var _name = _input.value;
  4199. //获取粘贴到制定目录的群id
  4200. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4201. //如果是ftp目录,那么groupid就是用户id
  4202. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  4203. _groupid = diskinfo.userInfo.UserId;
  4204. }
  4205. //否则就是对应的群id,如果不存在那么就是""
  4206. else {
  4207. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  4208. }
  4209. //文件名判断
  4210. if (U.UF.S.ZWFileName.test(_input.value)) {
  4211. //去数据库添加文件
  4212. U.A.Request(US.DISK, ["CreateFile", _userid, _newguid, directoryid, _input.value, "", "", "", "txt", _groupid], function (r) {
  4213. //创建文件
  4214. 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)
  4215. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4216. //如果存在就执行
  4217. if (fun) {//判断是否有点击事件的方法,如果有,运行它
  4218. fun(_fileinfo);
  4219. }
  4220. }, []);
  4221. }
  4222. else {
  4223. U.alert("文件名过长或者为空");
  4224. return false;
  4225. }
  4226. },
  4227. function () { }, "新建文本文件");
  4228. }
  4229. /**
  4230. * 新建文档处理
  4231. **/
  4232. U.MD.DK.RE.newDocument = function (diskinfo, fun, fileid) {
  4233. if (!U.MD.U.L.isLogin()) {//是否登录
  4234. var _directoryid = diskinfo.directoryid; //目录id
  4235. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建文档权限
  4236. return U.MD.DK.RE.newDocument.confirm(diskinfo, _directoryid, fun, fileid);
  4237. }
  4238. else { U.alert("无权限访问此文档"); };
  4239. }
  4240. }
  4241. /**
  4242. * 新建文档处理的新建提示框
  4243. **/
  4244. U.MD.DK.RE.newDocument.confirm = function (diskinfo, directoryid, fun, fileid) {
  4245. var _ancestors, //目录的祖先元素
  4246. _groupid, //群id
  4247. _newguid = fileid || Guid.newGuid(), //新建文件夹的id
  4248. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": directoryid })[0], //目录网盘信息
  4249. _userid = US.userInfo.UserId, //新建用户id
  4250. _input = $$("input", { "placeholder": "请输入文档名字", "style": { "width": "180px", "height": "25px"} }); //输入的名字
  4251. return U.MD.DK.RE.newconfirm(_input, //创建文档的框
  4252. function () {
  4253. var _name = _input.value;
  4254. //获取粘贴到制定目录的群id
  4255. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4256. //如果是ftp目录,那么groupid就是用户id
  4257. if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
  4258. _groupid = diskinfo.userInfo.UserId;
  4259. }
  4260. //否则就是对应的群id,如果不存在那么就是""
  4261. else {
  4262. _groupid = _ancestors[0].GroupID || "";
  4263. }
  4264. //文件名判断
  4265. if (U.UF.S.ZWFileName.test(_input.value)) {
  4266. //去数据库添加文件
  4267. U.A.Request(US.DISK, ["CreateFile", _userid, _newguid, directoryid, _input.value, "", "", "", "uw", _groupid], function (r) {
  4268. //创建文件
  4269. 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)
  4270. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4271. //如果存在就执行
  4272. if (fun) {//判断是否保存到数据库
  4273. fun(_fileinfo);
  4274. }
  4275. }, []);
  4276. }
  4277. else {
  4278. U.alert("文件名过长或者为空");
  4279. return false;
  4280. }
  4281. }, function () { }, "新建文档");
  4282. }
  4283. U.MD.DK.RE.newopenApplication = function (diskinfo, fun, fileid) {
  4284. if (!U.MD.U.L.isLogin()) {//是否登录
  4285. var _directoryid = diskinfo.directoryid; //目录id
  4286. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建文档权限
  4287. return U.MD.DK.RE.newopenApplication.confirm(diskinfo, _directoryid, fun, fileid);
  4288. }
  4289. else { U.alert("无权限访问此文档"); };
  4290. }
  4291. }
  4292. U.MD.DK.RE.newopenApplication.confirm = function (diskinfo, _directoryid, fun, fileid) {
  4293. var _ancestors, //目录的祖先元素
  4294. _groupid, //群id
  4295. _taskbar, //_taskbar 作为任务栏显示的元素,包含图标和名字
  4296. _formdiv, //创建任务栏时同时弹出的窗体元素。
  4297. _newguid = fileid || Guid.newGuid(), //新建文件夹的id
  4298. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": _directoryid })[0], //目录网盘信息
  4299. _userid = US.userInfo.UserId, //新建用户id
  4300. _input = $$("input", { "placeholder": "请输入文档名字", "style": { "width": "180px", "height": "25px"} }); //输入的名字
  4301. U.MD.DK.RE.newconfirm(_input, //创建文档的框
  4302. function () {
  4303. var _name = _input.value;
  4304. //获取粘贴到制定目录的群id
  4305. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4306. //如果是ftp目录,那么groupid就是用户id
  4307. if (_ancestors[0].UserDirectoryID == US.FTPFOLDERID) {
  4308. _groupid = diskinfo.userInfo.UserId;
  4309. }
  4310. //否则就是对应的群id,如果不存在那么就是""
  4311. else {
  4312. _groupid = _ancestors[0].GroupID || "";
  4313. }
  4314. //文件名判断
  4315. if (U.UF.S.ZWFileName.test(_input.value)) {
  4316. //去数据库添加文件
  4317. U.A.Request(US.DISK, ["CreateFile", _userid, _newguid, _directoryid, _input.value, "", "", "", "un", _groupid], function (r) {
  4318. //创建文件
  4319. 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)
  4320. _fileinfo.UserDirectoryExtendType = 'un';
  4321. _fileinfo.UsOffice = U.A.Request(US.CD, ([US.DB, "UseStudio_Disk",
  4322. "GetFileContent", "6a8a235a-41c4-c3d2-8dd5-b6ee851e1967"])).value[0].UsOffice.unEscapeQuotes();
  4323. _fileinfo.newfile = true;
  4324. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4325. //U.MD.D.I.openApplication("word",{ UserDirectoryExtendType: "un" });
  4326. //如果存在就执行
  4327. if (fun) {//判断是否保存到数据库
  4328. fun(_fileinfo);
  4329. }
  4330. }, []);
  4331. }
  4332. else {
  4333. U.alert("文件名过长或者为空");
  4334. return false;
  4335. }
  4336. }, function () { }, "新建导航文档");
  4337. }
  4338. /**
  4339. * 新建工作表处理
  4340. **/
  4341. U.MD.DK.RE.newExcel = function (diskinfo) {
  4342. if (!U.MD.U.L.isLogin()) {//是否登录
  4343. var _directoryid = diskinfo.directoryid; //目录id
  4344. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建工作表权限
  4345. U.MD.DK.RE.newExcel.confirm(diskinfo, _directoryid); //新建提示框
  4346. }
  4347. else { U.alert("无权限访问此工作表"); };
  4348. }
  4349. }
  4350. /**
  4351. * 新建工作表处理的新建提示框
  4352. **/
  4353. U.MD.DK.RE.newExcel.confirm = function (diskinfo, directoryid) {
  4354. var _ancestors, //目录的祖先元素
  4355. _groupid, //群id
  4356. _newguid = Guid.newGuid(), //新建文件夹的id
  4357. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": directoryid })[0], //目录网盘信息
  4358. _userid = US.userInfo.UserId, //新建用户id
  4359. _input = $$("input", { "placeholder": "请输入表格名字", "style": { "width": "180px", "height": "25px"} }); //输入的名字
  4360. U.MD.DK.RE.newconfirm(_input, //创建文档的框
  4361. function () {
  4362. var _name = _input.value;
  4363. //获取粘贴到制定目录的群id
  4364. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4365. //如果是ftp目录,那么groupid就是用户id
  4366. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  4367. _groupid = diskinfo.userInfo.UserId;
  4368. }
  4369. //否则就是对应的群id,如果不存在那么就是""
  4370. else {
  4371. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  4372. }
  4373. //文件名判断
  4374. if (U.UF.S.ZWFileName.test(_input.value)) {
  4375. //去数据库添加文件
  4376. U.A.Request(US.DISK, ["CreateFile", _userid, _newguid, directoryid, _input.value, "", "", "", "ue", _groupid], function (r) {
  4377. //创建文件
  4378. 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)
  4379. U.MD.DK.RE.addFileOrFolder([_fileinfo], diskinfo, _dirinfo); //添加到页面上中
  4380. }, []);
  4381. }
  4382. else {
  4383. U.alert("文件名过长或者为空");
  4384. return false;
  4385. }
  4386. }, function () { }, "新建工作表");
  4387. }
  4388. /**
  4389. * 新建文件对话框
  4390. * @content {string/elemnet} 内容
  4391. * @determineFun {function} 确认回调函数
  4392. * @cancelFun {function} 取消回调函数
  4393. * @string {string} 对话框的标题名字
  4394. */
  4395. U.MD.DK.RE.newconfirm = function (content, determineFun, cancelFun, str) {
  4396. //创建对话框主体元素
  4397. var _confirm = $$("div", { "style": { "cssText": "width: 100%; background: rgb(255,255,255); overflow:hidden; " }, id: "123133456" });
  4398. var _string = str || "提示框";
  4399. //创建内容区域
  4400. var _content = $$("div", { "style": { "cssText": "text-align: center; margin: 30px 20px 30px 20px; "} }, _confirm);
  4401. //判断内容是否为元素
  4402. if (U.UF.C.isElement(content)) {
  4403. //如果为元素则动态添加到对话框中
  4404. U.selectEl(_content).append(content);
  4405. } else {
  4406. //如果为文字则修改inerHTML。
  4407. _content.innerHTML = content || '内容';
  4408. }
  4409. //创建页脚部分
  4410. var _footer = $$("div", { "style": { "cssText": " height:45px;"} }, _confirm);
  4411. //调用Uform窗体创建函数将主体内容添加到窗体中
  4412. var _form = new U.UF.UI.form(
  4413. _string,
  4414. _confirm,
  4415. {
  4416. 'className': 'U_MD_DK_RE_confirmForm',
  4417. "style": {
  4418. "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;"
  4419. }
  4420. },
  4421. {
  4422. "istop": true,
  4423. "isenlarge": false,
  4424. "isstretching": false,
  4425. "isnarrow": false
  4426. },
  4427. {
  4428. "style": {
  4429. "cssText": " background: rgb(59,88,120); padding: 10px;padding-left: 20px; color: rgb(255,255,255); "
  4430. }
  4431. });
  4432. //创建确定按钮 绑定点击事件,默认点击后执行关闭窗体函数
  4433. $$("div", {
  4434. "style": {
  4435. "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;"
  4436. },
  4437. innerHTML: "确定",
  4438. onclick: function () {
  4439. var _bool = true;
  4440. if (U.UF.C.isFunction(determineFun)) {
  4441. _bool = determineFun(); //判断是否存在回调 有则执行。
  4442. }
  4443. if (_bool !== false) {
  4444. U.UF.F.closeWindow(_form.form); //关闭窗口函数
  4445. }
  4446. }
  4447. }, _footer);
  4448. content.onkeydown = function (e) { //input键盘按键事件
  4449. var ev = document.all ? window.event : e;
  4450. if (ev.keyCode == 13) { //当按下回车时触发 确定按钮点击事件
  4451. if ($('.U_MD_DK_RE_confirmForm').length > 0) {
  4452. for (var i = 0; i < U.selectEl('.U_MD_DK_RE_confirmForm').length; i++) {
  4453. if ($('.U_MD_DK_RE_confirmForm')[i].style.display == "block") { //检查新建文档窗体是否显示
  4454. var _bool = true;
  4455. if (U.UF.C.isFunction(determineFun)) {
  4456. _bool = determineFun(); //判断是否存在回调 有则执行。
  4457. }
  4458. if (_bool !== false) {
  4459. U.UF.F.closeWindow(_form.form); //关闭窗口函数
  4460. }
  4461. }
  4462. }
  4463. }
  4464. }
  4465. }
  4466. //创建取消按钮 绑定点击事件,默认点击后执行关闭窗体函数
  4467. $$("div", {
  4468. "style": {
  4469. "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;"
  4470. },
  4471. "innerHTML": "取消",
  4472. "onclick": function () {
  4473. U.UF.C.isFunction(cancelFun) && cancelFun(); //判断是否存在回调 有则执行。
  4474. U.UF.F.closeWindow(_form.form); //关闭窗口函数
  4475. }
  4476. }, _footer);
  4477. content.focus(); //输入框焦点聚集
  4478. return _form;
  4479. }
  4480. /**
  4481. * 新建互联办公文件对话框
  4482. * @determineFun {function} 确认回调函数
  4483. * @cancelFun {function} 取消回调函数
  4484. */
  4485. U.MD.DK.RE.newDocConfirm = function (diskinfo/*determineFun cancelFun*/) {
  4486. if (!U.MD.U.L.isLogin()) {//是否登录
  4487. var _directoryid = diskinfo.directoryid; //目录id
  4488. if (U.MD.DK.C.getDirectoryPermissions(_directoryid, diskinfo).isnew) {//新建工作表权限
  4489. var _confirm = $$('div'),
  4490. _pickarea = $$("div", { "style": { "cssText": "display:table; width: 100%; height: auto; "} }, _confirm),
  4491. _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),
  4492. _pickline = $$("div", { "style": { "cssText": "display:table-cell; width:1px; height: 100%; background-color:#cecece;"} }, _pickarea),
  4493. _pickoa = $$("div", { "style": { "cssText": "display:table-cell; width:234px; height:100%; background-color:#f5f5f5;text-align:center; vertical-align: middle;cursor: pointer;"} }, _pickarea);
  4494. $$("img", { "onerror": U.MD.C.imgError, src: "/img/officefileicon.png", style: { "vertical-align": "middle"} }, _picklocal);
  4495. $$("img", { "onerror": U.MD.C.imgError, src: "/img/oaofficeicon.png", style: { "vertical-align": "middle"} }, _pickoa);
  4496. $$('span', { innerText: '互联文档', style: { "margin-left": "10px"} }, _pickoa);
  4497. $$('span', { innerText: '本地文档', style: { "margin-left": "10px"} }, _picklocal);
  4498. //创建对话框主体元素
  4499. var _enter = $$("div", { "style": { "cssText": "width: 100%; background: rgb(255,255,255); overflow:hidden; display:none" }, id: "123133456" }, _confirm);
  4500. var _string = "新建文档";
  4501. //创建内容区域
  4502. var _content = $$("div", { "style": { "cssText": "text-align: center; margin: 30px 20px 30px 20px;"} }, _enter)
  4503. //创建页脚部分
  4504. var _footer = $$("div", { "style": { "cssText": " height:45px;"} }, _enter);
  4505. //调用Uform窗体创建函数将主体内容添加到窗体中
  4506. var _form = new U.UF.UI.form(
  4507. _string,
  4508. _confirm,
  4509. {
  4510. "style": {
  4511. "cssText": "font-size: 16px; background: rgb(255,255,255); width: 470px; position: fixed; box-shadow: rgb(0, 0, 0) 2px 1px 5px; "
  4512. }
  4513. },
  4514. {
  4515. "istop": true,
  4516. "isenlarge": false,
  4517. "isstretching": false,
  4518. "isnarrow": false
  4519. },
  4520. {
  4521. "style": {
  4522. "cssText": " background: #3c475b;padding:4px 0 ; color: rgb(255,255,255); "
  4523. }
  4524. });
  4525. U.selectEl(_picklocal).bind({ "mouseover": function () { _picklocal.style.backgroundColor = "#dcdcdc"; }, "mouseout": function () { _picklocal.style.backgroundColor = "#f5f5f5"; }, "click": function () {
  4526. U.MD.DK.RE.newDocument(diskinfo);
  4527. U.UF.F.closeWindow(_form.form, "remove");
  4528. }
  4529. })
  4530. U.selectEl(_pickoa).bind({ "mouseover": function () { _pickoa.style.backgroundColor = "#dcdcdc"; }, "mouseout": function () { _pickoa.style.backgroundColor = "#f5f5f5"; }, "click": function () {
  4531. // U.selectEl('#U_UF_UI_confirm')[0].style.display = "none";
  4532. var _docId = Guid.newGuid();
  4533. U.MD.O.word(US.userInfo, { 'UserDirectoryID': _docId }, function () {
  4534. var _iframe = U.selectEl('#UD_Word' + _docId).find('iframe')[0].contentWindow;
  4535. _iframe.document.getElementById('U_MD_O_H_body_left_invite_user').children[0].click();
  4536. U.UF.F.closeWindow(_form.form, "remove");
  4537. });
  4538. }
  4539. })
  4540. return _form;
  4541. }
  4542. else { U.alert("无权限访问此工作表"); };
  4543. }
  4544. }
  4545. //#endregion
  4546. //#region 删除文件
  4547. /**
  4548. * 删除文件
  4549. *
  4550. * @param {array} 需要删除文件的数组
  4551. * @param {string} 用户id
  4552. */
  4553. U.MD.DK.RE.deleteFileOrDir = function (fileordirs, userid, diskinfo) {
  4554. var _contentel, _fileordir;
  4555. //多文件删除
  4556. if (fileordirs.length > 1) {
  4557. _contentel = $$("div", { "style": { "cssText": "text-align:center;width:100%;height:30px;padding:5% 0 0% 0;"} });
  4558. $$("span", { "style": { "cssText": "font-weight:bold;" }, "innerHTML": "你确定要删除这" + fileordirs.length + "项吗?" }, _contentel);
  4559. U.UF.UI.confirm(_contentel, function () {//弹出多选判断框
  4560. _fileordir = true; //定义变量_fileordir的初始值,为true
  4561. for (var i = 0; i < fileordirs.length; i++) {//开始循环,循环对象为多选后的文件对象
  4562. if (fileordirs[i].UserDirectoryExtendType == "folder") {//判断是否有文件夹,如果有
  4563. U.alert("删除失败,多选无法删除文件夹"); //弹出提示,方法结束
  4564. _fileordir = false; //修改变量的值
  4565. }
  4566. }
  4567. if (_fileordir == true) {//通过判断变量_fileordir的值,判断是否可以删除,如果可以
  4568. U.MD.DK.RE.deleteDirectoryOrFile(fileordirs, userid); //调用接口,进行删除
  4569. }
  4570. })
  4571. }
  4572. //单文件处理
  4573. else {
  4574. U.A.Request(US.DISK, ["GetChildsByDirectoryId", userid, fileordirs.UserDirectoryID, ""], function (r) {//调用接口,在后台查找这个文件有没有附属文件
  4575. if (r.value.length == 0) {//如果没有
  4576. _contentel = U.MD.DK.RE.attributeStyle(fileordirs, null, diskinfo);
  4577. fileordirs = [fileordirs];
  4578. //弹出提示框,确认后删除文件
  4579. U.UF.UI.confirm(_contentel, function () {
  4580. U.MD.DK.RE.deleteDirectoryOrFile(fileordirs, userid);
  4581. });
  4582. } else {//如果有
  4583. U.alert("删除失败,请先清除文件夹中的文件"); //弹出提示,方法结束
  4584. }
  4585. });
  4586. }
  4587. }
  4588. /**
  4589. * 删除文件接口
  4590. *
  4591. * @param {array} 需要删除文件的数组
  4592. * @param {string} 用户id
  4593. */
  4594. U.MD.DK.RE.deleteDirectoryOrFile = function (fileordirs, userid) {
  4595. var _allfileordirid = U.Json.toKeyArray(fileordirs, "UserDirectoryID").join(","); //所有删除的文件和文件夹的合并id
  4596. U.A.Request(US.DISK, ["DeleteDirectoryOrFile", _allfileordirid, fileordirs[0].GroupID || ""], U.MD.DK.RE.asynDeleteDirectoryOrFile, ["", fileordirs, userid]); //文件夹和文件同时删除
  4597. }
  4598. /**
  4599. * 删除文件异步
  4600. *
  4601. * @param {array} 需要删除文件的数组
  4602. * @param {string} 用户id
  4603. */
  4604. U.MD.DK.RE.asynDeleteDirectoryOrFile = function (r) {
  4605. var i,
  4606. _dirid,
  4607. _context = r.context,
  4608. _fileordirs = _context[1], //文件或者是文件夹信息
  4609. _userid = _context[2], //用户id
  4610. _diskinfo = U.MD.DK.M.diskOperatingSwitch(_userid) //获取用户硬盘的信息
  4611. ;
  4612. r = r.value;
  4613. //允许删除
  4614. if (r) {
  4615. U.MD.DK.M.entity.del(_fileordirs, _diskinfo); //删除diskinfo数组里面的文件或者文件夹
  4616. U.MD.DK.RE.delPageFileOrDir(_fileordirs, _diskinfo); //删除文件在页面上的元素
  4617. }
  4618. else {
  4619. U.alert("操作失败!"); //弹出操作失败
  4620. }
  4621. }
  4622. /**
  4623. * 删除文件在页面上的显示
  4624. *
  4625. * @param {array} 文件或者是目录
  4626. * @param {string} 删除用户网盘的信息
  4627. */
  4628. U.MD.DK.RE.delPageFileOrDir = function (fileordirs, diskinfo) {
  4629. var i,
  4630. _parentdirinfo,
  4631. _contentel = U.selectEl("#U_MD_DK_RZ", diskinfo.formel); //中间的内容
  4632. //循环文件或者文件夹处理
  4633. for (i = 0; i < fileordirs.length; i++) {
  4634. U.selectEl("#L" + fileordirs[i].UserDirectoryID, diskinfo.formel).remove(); //移除左边的导航
  4635. U.selectEl("#R" + fileordirs[i].UserDirectoryID, diskinfo.formel).remove(); //移除右边的文件或者文件夹
  4636. //判断删除的位置是否是当前打开的位置,如果是则保持
  4637. if (fileordirs[i].UserDirectoryID == diskinfo.directoryid) {
  4638. _parentdirinfo = fileordirs[i].Parent;
  4639. }
  4640. }
  4641. //如果删除的位置是当前打开的位置
  4642. if (_parentdirinfo) {
  4643. //重新打印
  4644. U.MD.DK.LE.openFileDirectory(_parentdirinfo, diskinfo.userInfo.UserId);
  4645. }
  4646. //如果文件或者文件夹给全部删除,那么就打印空视图
  4647. else if (_contentel.Child() == 0) {
  4648. U.MD.DK.VW.printNullView(_contentel[0]); //重新打印空视图
  4649. }
  4650. U.selectEl('#U_MD_DK_RKR', diskinfo.formel)[0].innerHTML = '当前文件的数量:' + U.selectEl('.U_MD_DK_RZO').length//删除之后当前文件的数量正确显示
  4651. }
  4652. //#endregion
  4653. //#region 重命名
  4654. /**
  4655. * 删除文件在页面上的元素
  4656. *
  4657. * @param {element} 元素
  4658. * @param {string} 用户id
  4659. */
  4660. U.MD.DK.RE.rename = function (el, fileordir, diskinfo) {
  4661. var _input, _el; //创建一个可输入的input标签
  4662. if (el.firstChild.children[1]) {//判断是否在左边菜单栏插入
  4663. _el = el.firstChild.children[1].children[0]; //插入地方
  4664. _el.innerText = ""//清除原文件名,并在上面设置一个input输出框
  4665. } else {
  4666. _el = el.lastElementChild; //插入地方
  4667. _el.innerText = ""//清除原文件名,并在上面设置一个input输出框
  4668. }
  4669. _input = $$("input", {//创建input框
  4670. "ondblclick": U.UF.EV.stopBubble, //阻止冒泡
  4671. "onblur": function () {//失焦
  4672. U.MD.DK.RE.detemineReName(this, fileordir, diskinfo); //确定修改
  4673. },
  4674. //回车会理
  4675. "onkeyup": function () {
  4676. if (event.keyCode == 13 || event.keyCode == 10) {
  4677. this.onblur(); //失焦
  4678. }
  4679. },
  4680. "onclick": U.UF.EV.stopBubble, //阻止冒泡
  4681. "className": "U_MD_U_P_C_P_N_I", //设置class
  4682. "value": fileordir.UserallDirectoryName.replace("." + fileordir.UserDirectoryExtendType, "")//文件名+后缀
  4683. }, _el); //在哪里插入
  4684. _input.focus(); //聚焦到重命名的input框上面
  4685. }
  4686. /**
  4687. * 確定修改文件名
  4688. *
  4689. * @param {element} 元素
  4690. * @param {string} 用户id
  4691. */
  4692. U.MD.DK.RE.detemineReName = function (inputel, fileordir, diskinfo) {
  4693. var _leftel,
  4694. _rightel,
  4695. _extendtype = fileordir.UserDirectoryExtendType, //文件扩展名
  4696. _name = inputel.value.replaceHtmlSign() + (fileordir.filetype ? "." + _extendtype : ""); //文件或者文件夹的名字
  4697. //修改的名字没有变化
  4698. if (_name != fileordir.UserallDirectoryName) {
  4699. //判断文件名输入符不符合规范
  4700. if (U.UF.S.FileName.test(_name)) {
  4701. //目录的处理
  4702. if (_extendtype == "folder") {
  4703. U.A.Request(US.DISK, ["UpdateDirectoryInfo", fileordir.UserDirectoryID, _name], U.MD.DK.RE.asynDetemineReName, ["", fileordir, _name, diskinfo]);
  4704. }
  4705. //文件的处理
  4706. else {
  4707. U.A.Request(US.DISK, ["UpdateFileInfo", fileordir.UserDirectoryID, _name], U.MD.DK.RE.asynDetemineReName, ["", fileordir, _name, diskinfo]);
  4708. }
  4709. _leftel = U.selectEl("#L" + fileordir.UserDirectoryID, diskinfo.formel)[0]; //左边的导航,文件夹同时展开的时候会存在
  4710. _rightel = U.selectEl("#R" + fileordir.UserDirectoryID, diskinfo.formel)[0]; //右边文件或者文件夹的处理
  4711. //左边的目录处理
  4712. if (_leftel) {
  4713. U.selectEl("div", _leftel)[3].innerText = _name;
  4714. }
  4715. //右边的目录处理
  4716. if (_rightel) {
  4717. U.selectEl("div", _rightel)[3].innerText = _name;
  4718. }
  4719. }
  4720. }
  4721. }
  4722. /**
  4723. * 確定修改文件名
  4724. *
  4725. * @param {element} 元素
  4726. * @param {string} 用户id
  4727. */
  4728. U.MD.DK.RE.asynDetemineReName = function (r) {
  4729. var _context = r.context,
  4730. _fileordir = _context[1], //文件或者文件夹信息
  4731. _name = _context[2] //文件名
  4732. ;
  4733. r = r.value;
  4734. //判断服务器修改是否成功的处理,处理成功后修改文件的信息
  4735. if (r) {
  4736. _fileordir.UserallDirectoryName = _name; //文件全写的名字
  4737. _fileordir.UserDirectoryName = _name.addEllipsis(20); //文件的缩略名
  4738. }
  4739. }
  4740. //#endregion
  4741. //#region 复制 剪切 粘贴
  4742. /**
  4743. * 删除文件在页面上的元素
  4744. *
  4745. * @param {array} 复制粘贴的元素
  4746. * @param {string} 粘贴的格式
  4747. */
  4748. U.MD.DK.RE.copyorshear = function (dirorfile, type, diskinfo) {
  4749. var _userid = US.disk.UserDisk.userInfo.UserId, //用户id
  4750. _dirid = dirorfile.UserDirectoryParentID //复制的目录id
  4751. ;
  4752. //复制的目录转化成数组
  4753. if (!Array.isArray(dirorfile)) {
  4754. dirorfile = [dirorfile];
  4755. }
  4756. //添加复制的全局变量
  4757. US.disk.Disks[_userid].pasteDirOrFile = {
  4758. "type": type, //复制或者剪切 "copy" || "shear"
  4759. "UserDirectoryID": _dirid, //在哪个目录复制或者剪切
  4760. "dirorfile": dirorfile, //复制的内容
  4761. "userid": _userid //用户id
  4762. };
  4763. }
  4764. /**
  4765. * 粘贴文件
  4766. *
  4767. * @param {array} 复制粘贴的元素
  4768. * @param {string} 粘贴的格式
  4769. */
  4770. U.MD.DK.RE.paste = function (diskinfo) {
  4771. var _ancestors, //祖先元素
  4772. _groupid, //群元素
  4773. _fileordirids, //文件和目录的id集合
  4774. _dirid = diskinfo.directoryid, //当前目录id
  4775. _dirinfo = U.Json.select(diskinfo.directoryOrFiles, { "UserDirectoryID": _dirid }, 1)[0], //当前目录的信息
  4776. _userid = US.disk.UserDisk.userInfo.UserId, //用户id
  4777. _pastecontent = US.disk.Disks[_userid].pasteDirOrFile, //粘贴的内容
  4778. _type = _pastecontent.type, //粘贴的格式
  4779. _pastedirid = _pastecontent.UserDirectoryID, //粘贴目录id
  4780. _dirorfile = _pastecontent.dirorfile, //粘贴文件和目录的数组
  4781. _pasteuserid = _pastecontent.userid //祖先元素
  4782. ;
  4783. //需要剪切的内容存在,无需判断权限了,能触发改函数说明是有权限的。 如果剪切文件,同时不是剪切到同一个目录里
  4784. if (_pastecontent && (_type == "copy" || _dirid != _pastedirid || _pasteuserid != _userid)) { // && (_dirid != _pastedirid || _pasteuserid != _userid)
  4785. //获取粘贴到制定目录的群id
  4786. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, diskinfo); //获取所有的祖先
  4787. //如果是ftp目录,那么groupid就是用户id
  4788. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  4789. _groupid = diskinfo.userInfo.UserId;
  4790. }
  4791. //否则就是对应的群id,如果不存在那么就是""
  4792. else {
  4793. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  4794. }
  4795. _fileordirids = U.Json.toKeyArray(_dirorfile, "UserDirectoryID").join(","); //文件
  4796. //处理粘贴在数据库的过程
  4797. //剪切的处理
  4798. if (_type == "shear") {
  4799. //调用剪切的函数 用户ID 粘贴目录id 文件和目录的id集合 群元素
  4800. 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]);
  4801. _pastecontent.type = "copy";
  4802. }
  4803. //复制的处理
  4804. else {
  4805. //调用复制的函数
  4806. U.A.Request(US.DISK, ["CopyAndPasteFiles", US.userInfo.UserId, _dirid, _fileordirids, _groupid], U.MD.DK.RE.asynPaste, ["", _dirinfo, _groupid, _pastecontent, diskinfo, _pastecontent.type]);
  4807. }
  4808. }
  4809. }
  4810. /**
  4811. * 粘贴文件
  4812. *
  4813. * @param {object} ajax的传参处理
  4814. */
  4815. U.MD.DK.RE.asynPaste = function (r) {
  4816. var i,
  4817. _context = r.context, //上线文的传参
  4818. _dirinfo = _context[1], //粘贴到制定的目录
  4819. _groupid = _context[2], //粘贴的群id
  4820. _pastecontent = _context[3], //粘贴的文件或者文件夹内容
  4821. _diskinfo = _context[4], //粘贴的网盘信息
  4822. _type = _context[5], //判断是复制还是剪切
  4823. _copyorshearinfo = US.disk.Disks[_pastecontent.userid], //粘贴网盘的信息
  4824. _pasteinfo = r.value //目录信息
  4825. ;
  4826. //剪切处理的话,先要移除原本的文件,然后在重新处理
  4827. if (_type == "shear") {
  4828. U.MD.DK.M.entity.del(_pastecontent.dirorfile, _copyorshearinfo); //在制定的用户中移除
  4829. U.MD.DK.RE.delPageFileOrDir(_pastecontent.dirorfile, _copyorshearinfo); //剪切的话会在之前目录里面删除
  4830. }
  4831. //循环设置粘贴文件的属性
  4832. for (i = 0; i < _pasteinfo.length; i++) {
  4833. _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)
  4834. }
  4835. //在粘贴网盘的数组目录中添加值
  4836. U.MD.DK.RE.addFileOrFolder(_pasteinfo, _diskinfo, _dirinfo);
  4837. }
  4838. //#endregion
  4839. //#region 文件下载
  4840. //弹出下载的处理
  4841. U.MD.DK.RE.downloadFile = function (dirorfileid, isdir) {
  4842. window.open("/Pages/Download.htm?id=" + dirorfileid + "&type=" + (isdir || ""));
  4843. }
  4844. //#endregion
  4845. //#region 查看评论
  4846. /**
  4847. * 查看评论
  4848. *
  4849. * @param {object} 文件信息
  4850. */
  4851. U.MD.DK.RE.replay = function (fileinfo) {
  4852. // U.MD.I.Img(UDE, UDE);
  4853. // U.MD.D.CM.CKPLXS(UDE.UserDirectoryID, UDE.UserallDirectoryName);
  4854. }
  4855. //#endregion
  4856. //#region 刷新
  4857. /**
  4858. * 刷新
  4859. *
  4860. * @param {string} 用户id
  4861. * @param {object} 目录信息
  4862. */
  4863. U.MD.DK.RE.refresh = function (userid, fileinfo, diskinfo) {
  4864. //如果文档不是最新文档、我的协同、他人邀请的处理
  4865. if (fileinfo.GroupID !== true) {
  4866. U.MD.DK.LE.getChildsByDirectoryId(userid, fileinfo, U.selectEl("#U_MD_DK_RZ", diskinfo.formel)[0]); //加载当前网盘内容
  4867. }
  4868. }
  4869. //#endregion
  4870. ;
  4871. ///<jscompress sourcefile="RightMenu.js" />
  4872. //--------------------------------------------------------------右键菜单----------------------------------------------------------------------
  4873. Namespace.register("U.MD.DK.RM"); //Disk的右键命名空间
  4874. //#region 右键查看处理
  4875. /**
  4876. * 右键菜单弹出
  4877. *
  4878. **/
  4879. U.MD.DK.RM.rightMenu = function (el, fileordir, diskinfo) {
  4880. var _ids,
  4881. _diskinfo = diskinfo || US.disk.UserDisk, //网盘信息
  4882. _selectElement = diskinfo.selectElement, //多选的元素
  4883. _userid = _diskinfo.userInfo.UserId, //用户ID
  4884. _fileordir = fileordir || U.Json.select(_diskinfo.directoryOrFiles, { "UserDirectoryID": _diskinfo.directoryid })[0], //右键的文件或者文件夹
  4885. _permissions = U.MD.DK.C.getDirectoryPermissions(_fileordir.UserDirectoryID, _diskinfo), //获取操作的权限
  4886. _rightel = U.selectEl("#U_MD_DK_M", _diskinfo.formel)[0], //右键菜单
  4887. _childel = U.selectEl(_rightel).Child() //右键的菜单节点
  4888. ;
  4889. if (_selectElement.length > 1) {
  4890. _ids = U.Json.toKeyArray(_selectElement, "id").join(",");
  4891. fileordir = U.Json.like(diskinfo.currentDirectoryFile, { "UserDirectoryID": _ids });
  4892. }
  4893. //打开权限的处理
  4894. if (_permissions.isopen && fileordir) {
  4895. _childel[0].style.display = "block";
  4896. _childel[0].onclick = function () {
  4897. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4898. U.MD.DK.LE.openFileDirectory(fileordir, _userid); //打开文件或者文件夹
  4899. };
  4900. }
  4901. else {
  4902. _childel[0].style.display = "none";
  4903. }
  4904. //修改权限的处理 重命名
  4905. if (_permissions.isupadte && fileordir) {
  4906. _childel[1].style.display = "block";
  4907. _childel[1].onclick = function () {
  4908. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4909. U.MD.DK.RE.rename(el, fileordir, _diskinfo); //打开文件或者文件夹
  4910. };
  4911. }
  4912. else {
  4913. _childel[1].style.display = "none";
  4914. }
  4915. //删除权限的处理
  4916. if (_permissions.isdelete && fileordir) {
  4917. _childel[2].style.display = "block";
  4918. _childel[2].onclick = function () {
  4919. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4920. U.MD.DK.RE.deleteFileOrDir(fileordir, _userid, _diskinfo); //删除文件或者文件夹
  4921. }
  4922. }
  4923. else {
  4924. _childel[2].style.display = "none";
  4925. }
  4926. //复制权限的处理
  4927. if (_permissions.iscopy && fileordir) {
  4928. _childel[3].style.display = "block";
  4929. _childel[3].onclick = function () {
  4930. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4931. U.MD.DK.RE.copyorshear(fileordir, "copy", _diskinfo); //复制文件或者文件夹
  4932. }
  4933. }
  4934. else {
  4935. _childel[3].style.display = "none";
  4936. }
  4937. //剪切权限的处理
  4938. if (_permissions.isshear && fileordir) {
  4939. _childel[4].style.display = "block";
  4940. _childel[4].onclick = function () {
  4941. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4942. U.MD.DK.RE.copyorshear(fileordir, "shear", _diskinfo); //剪贴文件或者文件夹
  4943. }
  4944. }
  4945. else {
  4946. _childel[4].style.display = "none";
  4947. }
  4948. //加密权限的处理
  4949. if (_permissions.isencryption && fileordir) {
  4950. _childel[5].style.display = "block";
  4951. _childel[5].onclick = function () {
  4952. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4953. U.MD.DK.RE.asynSetPermissions(fileordir);
  4954. }
  4955. }
  4956. else {
  4957. _childel[5].style.display = "none";
  4958. }
  4959. //下载权限的处理
  4960. if (_permissions.isdownload && fileordir) {
  4961. _childel[6].style.display = "block";
  4962. _childel[6].onclick = function () {
  4963. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4964. U.MD.DK.RE.downloadFile(fileordir.UserDirectoryID || U.Json.toKeyArray(fileordir, "UserDirectoryID").join(","), fileordir.filetype == 0); //弹出下载的处理
  4965. }
  4966. }
  4967. else {
  4968. _childel[6].style.display = "none";
  4969. }
  4970. //新建权限的处理
  4971. if (_permissions.isnew && !fileordir) {
  4972. _childel[7].style.display = "block";
  4973. _childel[8].style.display = "block";
  4974. _childel[9].style.display = "block";
  4975. _childel[10].style.display = "block";
  4976. _childel[7].onclick = function () {
  4977. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4978. U.MD.DK.RE.newFolder(_diskinfo); //新建文件夹
  4979. }
  4980. _childel[8].onclick = function () {
  4981. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4982. U.MD.DK.RE.newText(_diskinfo); //新建txt文件
  4983. }
  4984. _childel[9].onclick = function () {
  4985. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4986. U.MD.DK.RE.newDocument(_diskinfo); //新建word文件
  4987. }
  4988. _childel[10].onclick = function () {
  4989. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  4990. U.MD.DK.RE.newExcel(_diskinfo); //新建excel文件
  4991. }
  4992. }
  4993. else {
  4994. _childel[7].style.display = "none";
  4995. _childel[8].style.display = "none";
  4996. _childel[9].style.display = "none";
  4997. _childel[10].style.display = "none";
  4998. }
  4999. //评论权限的处理
  5000. if (_permissions.isreply && !fileordir) {
  5001. _childel[11].style.display = "block";
  5002. _childel[11].onclick = function () {
  5003. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5004. U.MD.DK.RE.replay(fileordir);
  5005. }
  5006. }
  5007. else {
  5008. _childel[11].style.display = "none";
  5009. }
  5010. //粘贴权限处理
  5011. if (_permissions.ispaste && !fileordir) {
  5012. _childel[12].style.display = "block";
  5013. _childel[12].onclick = function () {
  5014. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5015. U.MD.DK.RE.paste(_diskinfo); //粘贴函数
  5016. }
  5017. }
  5018. else {
  5019. _childel[12].style.display = "none";
  5020. }
  5021. //刷新权限处理
  5022. if (_permissions.isrefresh && !fileordir) {
  5023. _childel[13].style.display = "block";
  5024. _childel[13].onclick = function () {
  5025. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5026. U.MD.DK.RE.refresh(_userid, _fileordir, _diskinfo); //刷新函数
  5027. }
  5028. }
  5029. else {
  5030. _childel[13].style.display = "none";
  5031. }
  5032. //上传权限的处理
  5033. if (_permissions.isupload && !fileordir) {
  5034. _childel[14].style.display = "block";
  5035. _childel[14].onclick = function () {
  5036. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5037. U.MD.DK.C.upload(_diskinfo); //文件上传
  5038. }
  5039. }
  5040. else {
  5041. _childel[14].style.display = "none";
  5042. }
  5043. //视图权限的处理
  5044. if (_permissions.isview && !fileordir) {
  5045. _childel[15].style.display = "block";
  5046. _childel[16].style.display = "block";
  5047. _childel[15].onclick = function () {
  5048. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5049. U.MD.DK.VW.viewsSwitch("Normal", _diskinfo); //普通视图
  5050. }
  5051. _childel[16].onclick = function () {
  5052. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5053. U.MD.DK.VW.viewsSwitch("Detailed", _diskinfo); //详细视图
  5054. }
  5055. }
  5056. else {
  5057. _childel[15].style.display = "none";
  5058. _childel[16].style.display = "none";
  5059. }
  5060. //允许查看属性
  5061. if (fileordir && _permissions.isopen) {
  5062. _childel[17].style.display = "block";
  5063. _childel[17].onclick = function () {
  5064. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5065. U.MD.DK.RE.attribute(fileordir);
  5066. }
  5067. }
  5068. else {
  5069. _childel[17].style.display = "none";
  5070. }
  5071. //编辑权限的处理
  5072. if (_permissions.isedit && US.disk.fileType.text.indexOf(_fileordir.UserDirectoryExtendType) > -1) {
  5073. _childel[18].style.display = "block";
  5074. _childel[18].onclick = function () {
  5075. U.MD.DK.RM.hiddenRightMenu(_diskinfo); //隐藏右键菜单
  5076. U.MD.D.I.openApplication("txt", _fileordir); //弹出应用处理
  5077. }
  5078. }
  5079. else {
  5080. _childel[18].style.display = "none";
  5081. }
  5082. //显示右键菜单
  5083. _rightel.style.display = "block";
  5084. if (_rightel.offsetHeight < 10) { //判断是否需要展开右键菜单的处理
  5085. _rightel.style.display = "none"
  5086. }
  5087. else {
  5088. //给右键菜单定位
  5089. U.UF.C.rightClickMenuLocation(_rightel);
  5090. }
  5091. }
  5092. /**
  5093. * 隐藏右键菜单
  5094. * @param {object} 网盘的值
  5095. *
  5096. **/
  5097. U.MD.DK.RM.hiddenRightMenu = function (diskinfo) {
  5098. U.selectEl("#U_MD_DK_M", diskinfo.formel)[0].style.display = "none";
  5099. }
  5100. /**
  5101. * 多文件右键菜单的显示
  5102. * @param {object} 网盘的值
  5103. *
  5104. **/
  5105. U.MD.DK.RM.getSelectionFilesOrDir = function (el) {
  5106. // var i, _UCE = [];
  5107. // for (i = 0; i < UDAD.length; i++) {
  5108. // _UCE.push(UDAD[i].id);
  5109. // };
  5110. // return U.Json.Like(UGE, { "UserDirectoryID": _UCE.join(",") });
  5111. }
  5112. //#endregion
  5113. ;
  5114. ///<jscompress sourcefile="SitePreview.js" />
  5115. /*
  5116. 网站预览 目录展示
  5117. */
  5118. Namespace.register("U.MD.DK.SP"); //Disk左键事件命名空间
  5119. //window.onload = function () {
  5120. // U.MD.DK.SP.getDirectioryInfo(directoryid);
  5121. //}
  5122. /**
  5123. *获取用户信息
  5124. *
  5125. *
  5126. */
  5127. U.MD.DK.SP.getUser = function (userid) {
  5128. var _userid = userid;
  5129. if (userid) {
  5130. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserId", _userid], function (r) {//根据用户名获取用户信息
  5131. console.log(r.value);
  5132. U.selectEl('.U_MD_DK_SP_Head_Logo_name')[0].innerHTML = r.value[0].UserNickName + '的云盘';
  5133. if (r.value[0].UserImageHead) {
  5134. U.selectEl('.U_MD_DK_SP_Head_UImg')[0].src = "http://fs.1473.cn/" + r.value[0].UserImageHead;
  5135. }
  5136. U.selectEl('.U_MD_DK_SP_Head_UImg')[0].title = r.value[0].UserNickName;
  5137. });
  5138. }
  5139. }
  5140. /**
  5141. * 获取目录信息
  5142. * @param {guid} directoryid 目录ID
  5143. */
  5144. U.MD.DK.SP.getDirectioryInfo = function (directoryid, userid) {
  5145. U.UF.CD.loadPageCrossDomain(function () {
  5146. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "GetDirectroyById", directoryid], U.MD.DK.SP.getDirectioryInfo.asyn, [null, userid, directoryid]);
  5147. });
  5148. }
  5149. /**
  5150. * 获取目录信息异步
  5151. *
  5152. */
  5153. U.MD.DK.SP.getDirectioryInfo.asyn = function (r) {
  5154. var _directioryinfo = r.value[0],
  5155. _userid = r.context[1],
  5156. _dirid = r.context[2];
  5157. U.MD.DK.SP.getUser(_userid);
  5158. U.MD.DK.SP.getAllFileInfo(_dirid, _userid, _directioryinfo ? _directioryinfo.GroupID : "");
  5159. }
  5160. /**
  5161. * 获取目录下的文件
  5162. *
  5163. */
  5164. U.MD.DK.SP.getAllFileInfo = function (directoryid, userid, groupid) {
  5165. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "GetChildsByDirectoryId", userid, directoryid, groupid || directoryid], U.MD.DK.SP.getAllFileInfo.asyn);
  5166. }
  5167. /**
  5168. * 获取目录下的文件 异步
  5169. *
  5170. */
  5171. U.MD.DK.SP.getAllFileInfo.asyn = function (r) {
  5172. console.log(r.value);
  5173. var _contentBox = U.selectEl('.U_MD_DK_SP_ContentList')[0];
  5174. U.MD.DK.SP.getParentFile(r.value[0].UserDirectoryParentID);
  5175. for (var i = 0; i < r.value.length; i++) {
  5176. var _fileli = $$('div', { 'className': 'U_MD_DK_SP_Li', 'id': 'U_MD_DK_SP_Li' + i }, _contentBox);
  5177. $$('div', { 'className': 'U_MD_DK_SP_CTopNum', 'innerHTML': i > 8 ? (i + 1) : '0' + (i + 1) }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5178. var _icon = U.MD.DK.SP.getIcon(r.value[i].UserDirectoryExtendType); //根据文件扩展名,得到图标的样式
  5179. if (!_icon.classname[2]) {
  5180. _icon.classname[2] = 'U_MD_DK_SP_unfile';
  5181. }
  5182. var _filename = $$('div', { 'className': 'U_MD_DK_SP_CTopFileName', 'title': r.value[i].UserallDirectoryName }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5183. $$('span', { 'className': _icon.classname[2] + ' U_MD_DK_SP_Img U_MD_DK_SP_RZSMI ', 'innerHTML': '&nbsp;&nbsp;&nbsp;&nbsp;' }, _filename);
  5184. _filename.innerHTML += r.value[i].UserallDirectoryName;
  5185. $$('div', { 'className': 'U_MD_DK_SP_CTopFileType', 'innerHTML': r.value[i].UserDirectoryExtendType }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5186. $$('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]);
  5187. $$('div', { 'className': 'U_MD_DK_SP_CTopFileAuthor', 'innerHTML': r.value[i].UserNickName }, U.selectEl('#U_MD_DK_SP_Li' + i)[0]);
  5188. var _date = U.UF.D.formatDateToArray(r.value[i].UserDirectoryAddTime);
  5189. $$('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]);
  5190. _fileli.onclick = U.UF.C.closure(function (fileinfo) {
  5191. console.log(fileinfo);
  5192. if (fileinfo.UserDirectoryExtendType == 'folder') {
  5193. window.location.href = window.location.origin + window.location.pathname + window.location.search + "/" + fileinfo.UserallDirectoryName;
  5194. }
  5195. else {
  5196. //window.open(window.location.origin + window.location.pathname + "/" + fileinfo.UserallDirectoryName + window.location.search);
  5197. var i,
  5198. _applicationame,
  5199. _types = US.disk.applicationTypes,
  5200. _extension = fileinfo["UserDirectoryExtendType"].toLocaleLowerCase();
  5201. for (i in _types) {
  5202. if (_types[i].types.indexOf(_extension) > -1) { //判断文件类型是否归属该应用
  5203. _applicationame = i;
  5204. break;
  5205. }
  5206. }
  5207. console.log(_applicationame);
  5208. switch (_applicationame) {
  5209. case "music": //播放制定的音乐,需要流程图
  5210. U.MD.DK.LE.music(fileinfo); //音乐控件
  5211. break;
  5212. case "image": //图片查看,需要流程图
  5213. U.MD.DK.LE.img(fileinfo); //图片控件
  5214. break;
  5215. case "video": //视频处理 需要流程图
  5216. U.MD.DK.LE.video(fileinfo); //视频控件
  5217. break;
  5218. case "text": //文本文件需要流程图
  5219. U.MD.D.Txt.textCreate(fileinfo);
  5220. break;
  5221. case "usoffice": //如果是云端系统自有格式文件。 需要流程图
  5222. //excel处理
  5223. case "ue": //word处理
  5224. U.MD.D.I.openApplication("excel", fileinfo); //弹出应用处理
  5225. break;
  5226. case "uw": case "un": //word处理
  5227. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  5228. break;
  5229. case "word":
  5230. U.A.Request(US.DISK, ["GetFileContent", fileinfo.UserDirectoryID], function (r) {
  5231. //获取word内容
  5232. if (r.value && r.value.UsOffice !== undefined && r.value.UsOffice != null) {
  5233. fileinfo.UsOffice = r.value.UsOffice.unEscapeQuotes();
  5234. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  5235. }
  5236. //如果内容不存在则去office系统中获取
  5237. else {
  5238. U.A.Request("http://office.1473.cn/Officetohtml.ashx", ["Open", fileinfo.UserDirectoryExtendType, fileinfo.UserFilesServerName], function (r) {
  5239. if (r.value.value != undefined) {
  5240. r = r.value;
  5241. fileinfo.UsOffice = r.value.getBodyHtml().replace(/src=[\'\"]?([^\'\"]*)[\'\"]?/ig, function (str1, str2) {
  5242. return "src=\"http://office.1473.cn/usoffice/" + str2 + "\"";
  5243. });
  5244. U.MD.D.I.openApplication("word", fileinfo); //弹出应用处理
  5245. } else {
  5246. U.Alert('文档已丢失。。。');
  5247. }
  5248. });
  5249. }
  5250. });
  5251. break;
  5252. case "txt": //txt处理
  5253. U.MD.D.I.openApplication("txt", fileinfo); //弹出应用处理
  5254. break;
  5255. //windows上传的不可识别的文件打开,直接跳转到下载页面。
  5256. default:
  5257. U.MD.DK.RE.downloadFile(fileinfo.UserDirectoryID, false);
  5258. break;
  5259. }
  5260. }
  5261. }, [r.value[i]]);
  5262. }
  5263. }
  5264. /***
  5265. *获取图标
  5266. *extendtype {string} 文件种类
  5267. */
  5268. U.MD.DK.SP.getIcon = function (extendtype) {
  5269. var i,
  5270. _application = US.disk.applicationTypes //获取所有打开应用的信息
  5271. ;
  5272. if (extendtype) {
  5273. //循环信息中找到指定的应用的信息
  5274. for (i in _application) {
  5275. //找到后缀名对应的程序信息
  5276. if (_application[i].types.indexOf(extendtype.toLowerCase()) > -1) {
  5277. return _application[i]; //返回应用的信息
  5278. }
  5279. }
  5280. }
  5281. return _application["unknownfile"]; //如果是本站未知的后缀直接归属于文件
  5282. }
  5283. /***
  5284. *获取上一次文件夹
  5285. *extendtype {string} 文件种类
  5286. */
  5287. U.MD.DK.SP.getParentFile = function (parentid) {
  5288. U.A.Request(US.CD, [US.DB, "UseStudio_Disk", "GetDirectroyById", parentid], function (r) {
  5289. if (r.value[0]) {
  5290. U.selectEl('.U_MD_DK_SP_Head_Logo_name')[0].innerHTML += '-' + r.value[0].UserDirectoryName + '文档详细列表';
  5291. }
  5292. }, []);
  5293. }
  5294. ;
  5295. ;
  5296. ///<jscompress sourcefile="Friend.js" />
  5297. ///<jscompress sourcefile="Add.js" />
  5298. Namespace.register("U.MD.F.J"); //好友加群加好友的命名空间
  5299. /*
  5300. * U.MD.F.J.groupInfoForm 显示添加群的窗口(创建一个群添加的窗口)
  5301. */
  5302. //#region 创建群组
  5303. //听见群用户的信息
  5304. U.MD.F.J.selectUserInfo = {
  5305. NeedUser: [], //需要添加的群用户
  5306. SelectUser: [], //已经选择过的用户
  5307. CallBack: null //添加后的回调
  5308. };
  5309. /**
  5310. * 显示添加群窗口
  5311. *
  5312. * @param {object} 群信息
  5313. * @param {element} 元素处理
  5314. * @param {boolean}
  5315. */
  5316. U.MD.F.J.groupInfoForm = function (groupinfo, chatel) {
  5317. var _formel, //窗体
  5318. _groupuserinfo, //获取所有的群好友
  5319. _determinebottom,
  5320. _closebottom,
  5321. _isgroupmain,
  5322. _isdeletegroup,
  5323. _groupinfoel = U.selectEl("#U_MD_F_Add"), //添加群的窗体
  5324. _addgroupuserel = U.selectEl("#U_MD_F_RC_C")[0], //内容区域
  5325. _groupinfochildsel = _groupinfoel.Child(), //群信息窗体子元素
  5326. _inputel = U.selectEl("input,textarea", _groupinfochildsel[0]); //内容输出
  5327. //清空群用户
  5328. U.MD.F.J.selectUserInfo.NeedUser.splice(0, U.MD.F.J.selectUserInfo.NeedUser.length);
  5329. //设置该联系人进入群
  5330. _groupinfochildsel[1].innerHTML = "";
  5331. //如果群存在的处理
  5332. if (groupinfo) {
  5333. //是否是新建群或者是群主,
  5334. if ($('.U_MD_F_Add_TNM_ADD2')[0]) {
  5335. U.selectEl('.U_MD_F_Add_TNM_ADD2')[0].style.display = "none";
  5336. }
  5337. if ($('.U_MD_F_Add_TNMO')[0]) {
  5338. U.selectEl('.U_MD_F_Add_TNMO')[0].style.display = "block";
  5339. }
  5340. if ($('.U_MD_F_Add_C_D')[0]) {
  5341. U.selectEl('.U_MD_F_Add_C_D')[0].style.display = "block";
  5342. }
  5343. if (groupinfo) {
  5344. _isgroupmain = groupinfo.GroupManageCreateUserID == US.userInfo.UserId; //群主
  5345. } else {
  5346. _isgroupmain = !groupinfo; //新建群
  5347. }
  5348. //判断是否是群主还是群成员
  5349. if (_isgroupmain) {
  5350. _isdeletegroup = "解散该群"; //群主
  5351. } else {
  5352. _isdeletegroup = "退出该群"; //群成员
  5353. }
  5354. //设置是否显示解散该群还是退出该群
  5355. U.selectEl(_groupinfoel[0]).Child()[2].style.display = "block";
  5356. //设置群名,群描述等
  5357. _inputel[0].value = groupinfo.GroupManageName;
  5358. _inputel[1].value = groupinfo.GroupManageDescript;
  5359. //获取群用户的信息
  5360. _groupuserinfo = U.Json.select(US.friend.groupusers, { "GroupManageID": groupinfo.GroupManageID });
  5361. //获取群成员人数
  5362. U.selectEl('.U_MD_F_Add_TNM_Number')[0].innerHTML = _groupuserinfo.length + "人";
  5363. //设置已经选择过的用户
  5364. U.MD.F.J.selectUserInfo.SelectUser = _groupuserinfo;
  5365. //打印当前群的用户
  5366. U.MD.F.J.printGroupUserInfo(_groupinfochildsel[1], _groupuserinfo, groupinfo);
  5367. //点击退出按钮事件设置
  5368. U.selectEl(_groupinfochildsel[2]).addAttrArray({
  5369. "onclick": function () {
  5370. U.MD.F.J.groupExit(groupinfo, U.Json.selectOne(_groupuserinfo, { "UserId": US.userInfo.UserId }), _groupinfoel);
  5371. },
  5372. "innerHTML": _isdeletegroup
  5373. });
  5374. }
  5375. //创建新群,清空数据
  5376. else {
  5377. //设置群名,群描述等
  5378. _inputel[0].value = "";
  5379. _inputel[1].value = "";
  5380. U.selectEl(_groupinfoel[0]).Child()[2].style.display = "none";
  5381. U.selectEl('.U_MD_F_Add_TNMO')[0].style.display = "none";
  5382. U.selectEl('.U_MD_F_Add_C_D')[0].style.display = "none";
  5383. U.selectEl('.U_MD_F_Add_TNM_ADD2')[0].style.display = "block";
  5384. }
  5385. _groupinfoel[0].style.display = "block";
  5386. //弹出窗体
  5387. _formel = new U.UF.UI.form("群聊信息", _groupinfoel[0], { "id": "U_MD_F_Add_O", "style": { "width": "480px"} }, { isnarrow: false, isenlarge: false }).form;
  5388. if (!groupinfo) {
  5389. U.selectEl($(_formel).Child()[2]).Child()[0].style.MaxHeight = "650px";
  5390. U.selectEl(_formel)[0].style.Maxheight = "650px";
  5391. }
  5392. //确定添加群处理
  5393. _determinebottom = U.selectEl(_groupinfochildsel[3]).Child()[0];
  5394. _determinebottom.onclick = function () {
  5395. if ($('#U_MD_F_addFriendorGroup')[0]) {
  5396. U.selectEl('#U_MD_F_addFriendorGroup')[0].style.display = "none";
  5397. }
  5398. U.MD.F.J.determineCreateGroupAndAddGroupUser(groupinfo ? groupinfo.GroupManageID : null, _groupinfochildsel[0], chatel);
  5399. };
  5400. //邀请好友处理
  5401. _invitationbottom = U.selectEl($(_groupinfochildsel[0]).Child()[1]).Child()[1];
  5402. _invitationbottom.onclick = function () {
  5403. U.MD.F.J.selectFriendForm(function () {
  5404. U.MD.F.J.determineCreateGroupAndAddGroupUser(groupinfo ? groupinfo.GroupManageID : null, _groupinfochildsel[0], chatel, true);
  5405. }, 'friend', "", 1);
  5406. }
  5407. U.selectEl('#U_MD_F_Add_TNM_ADD2_add')[0].onclick = function () {
  5408. U.MD.F.J.selectFriendForm(function () {
  5409. U.MD.F.J.determineCreateGroupAndAddGroupUser(groupinfo ? groupinfo.GroupManageID : null, _groupinfochildsel[0], chatel, true);
  5410. }, 'friend', "", 0);
  5411. }
  5412. //确定取消群处理
  5413. _closebottom = U.selectEl(_groupinfochildsel[3]).Child()[1];
  5414. _closebottom.onclick = function () {
  5415. U.UF.F.windowMinimize(_formel);
  5416. }
  5417. return _formel;
  5418. }
  5419. /**
  5420. * 打印群用户
  5421. *
  5422. * @param {element} 添加进入的元素
  5423. * @param {object} 添加的用户信息
  5424. */
  5425. U.MD.F.J.printGroupUserInfo = function (el, groupuserinfo, groupinfo) {
  5426. var i,
  5427. //临时元素变量
  5428. _tempel,
  5429. _temponeel,
  5430. _temptwoel,
  5431. _tempname,
  5432. _frag = $$("frag"),
  5433. _childsel = U.selectEl(el).Child(),
  5434. _isgroupmain;
  5435. //判断是否是群主
  5436. if (groupinfo) {
  5437. _isgroupmain = groupinfo.GroupManageCreateUserID == US.userInfo.UserId;
  5438. }
  5439. else {
  5440. _isgroupmain = !groupuserinfo;
  5441. }
  5442. //获取不同的classname
  5443. if (_isgroupmain) {
  5444. _tempname = "U_MD_F_Add_R" + " U_MD_F_Add_RS"
  5445. }
  5446. else {
  5447. _tempname = "U_MD_F_Add_R" + ""
  5448. }
  5449. //打印群用户显示的样式
  5450. for (i = 0; i < groupuserinfo.length; i++) { //循环添加
  5451. _tempel = $$("div", { "className": "U_MD_F_Add_CO" }, _frag);
  5452. _tempell = $$("div", { "style": { "width": "32%", "height": "30px", "float": "left"} }, _tempel);
  5453. $$("img", { "onerror": U.MD.C.imgError, "onerror": U.MD.C.imgError, "title": "点击查看", "src": U.MD.C.getHeadImage(groupuserinfo[i].UserThumbnailImageHead) }, _tempell);
  5454. $$("div", { "className": "U_MD_F_Add_COM U_MD_D_Text_Abbreviation", "innerHTML": groupuserinfo[i].UserName }, _tempell);
  5455. _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);
  5456. _temptwoel = $$("div", { "className": _tempname }, _tempel);
  5457. //这有已经新建的群
  5458. if (groupinfo) {
  5459. //只有本人或者群主才能修改群名片
  5460. if (_isgroupmain || groupuserinfo[i].UserId == US.userInfo.UserId) {
  5461. $$("img", {
  5462. "src": "/img/Edit1.png",
  5463. "title": "修改群名片",
  5464. "onclick": (function (i) {
  5465. return U.UF.C.closure(U.MD.F.J.upateGroupUserDescriptForm, [groupuserinfo[i], _temponeel]);
  5466. })(i)
  5467. }, _temptwoel);
  5468. }
  5469. $$("img", {
  5470. "src": "/img/personalCard1.png", "title": "查看用户资料",
  5471. "onclick": (function (i) {
  5472. return U.UF.C.closure(U.MD.U.V.ViewOtherUserInfo, [groupuserinfo[i].UserId]);
  5473. })(i)
  5474. }, _temptwoel);
  5475. $$("img", {
  5476. "src": "/img/Add1.png", "title": "添加好友",
  5477. "onclick": (function (i) {
  5478. return U.UF.C.closure(U.MD.F.M.addFriend, [groupuserinfo[i], null, _tempel]);
  5479. })(i)
  5480. }, _temptwoel);
  5481. }
  5482. //如果是群主有移除权限
  5483. if (_isgroupmain) {
  5484. $$("img", {
  5485. "src": "/img/exit1.png", "title": "移除",
  5486. "onclick": (function (i) {
  5487. return U.UF.C.closure(U.MD.F.J.groupExit, [groupinfo, groupuserinfo[i], _tempel]);
  5488. })(i)
  5489. }, _temptwoel);
  5490. }
  5491. }
  5492. //判断元素是否存在,如果存在则,追加元素,如果不存在则添加到最后面
  5493. if (_childsel.length) {
  5494. el.insertBefore(_frag, _childsel[_childsel.length - 1]);
  5495. }
  5496. else {
  5497. el.appendChild(_frag);
  5498. }
  5499. }
  5500. /**
  5501. * 显示添加群窗口
  5502. *
  5503. * @param {object} 群好友信息
  5504. */
  5505. U.MD.F.J.upateGroupUserDescriptForm = function (groupuserinfo, el) {
  5506. var _tempel,
  5507. _temponeel,
  5508. _temptwoel,
  5509. _groupname = groupuserinfo.GroupUsersDescript || groupuserinfo.UserName
  5510. ;
  5511. if (groupuserinfo) {
  5512. //创建好友分组的样式
  5513. _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNL U_MD_F_G" });
  5514. _temponeel = $$("div", {}, _tempel)
  5515. _temptwoel = $$("input",
  5516. {
  5517. "value": _groupname,
  5518. "onfocus": function () {
  5519. U.UF.MR.inputPlaceholder(this, _groupname, "");
  5520. },
  5521. "onblur": function () {
  5522. U.UF.MR.inputPlaceholder(this, "", _groupname);
  5523. }
  5524. }, _temponeel);
  5525. //弹出好友对话框
  5526. U.UF.UI.confirm(_tempel, function () {
  5527. U.MD.F.J.determineUpateGroupUserDescript(groupuserinfo, _temptwoel, el);
  5528. });
  5529. }
  5530. else {
  5531. U.alert("暂无群信息");
  5532. }
  5533. }
  5534. /**
  5535. * 确定设置群信息
  5536. *
  5537. * @param {object} 群好友信息
  5538. */
  5539. U.MD.F.J.determineUpateGroupUserDescript = function (groupuserinfo, inputel, el) {
  5540. //判断用户是否输入正确的备注名
  5541. if (inputel.value && U.UF.S.NickName.test(inputel.value)) {
  5542. U.A.Request(US.FRIEND, ["UpdateGroupMemberInfo", US.userInfo.UserId, groupuserinfo.GroupManageID, groupuserinfo.UserId, inputel.value],
  5543. U.MD.F.J.asynDetermineUpateGroupUserDescript, [null, groupuserinfo, inputel.value, el]);
  5544. }
  5545. else {
  5546. U.alert("备注名格式不对");
  5547. return true;
  5548. }
  5549. }
  5550. /**
  5551. * 修改群备注异步
  5552. *
  5553. * @param {object} 群好友信息
  5554. */
  5555. U.MD.F.J.asynDetermineUpateGroupUserDescript = function (r) {
  5556. var _context = r.context,
  5557. _groupuserinfo = _context[1], //群用户信息
  5558. _descriptname = _context[2], //修改后的备注名
  5559. _el = _context[3]; //元素
  5560. //修改groupuserinfo里面的用户备注的变量和修改显示给用户看到的备注
  5561. _el.innerText = _groupuserinfo.GroupUsersDescript = _descriptname;
  5562. U.alert("修改备注成功!");
  5563. }
  5564. /**
  5565. * 退出或者踢人
  5566. *
  5567. * @param {object} 群信息
  5568. * @param {object} 好友信息
  5569. */
  5570. U.MD.F.J.groupExit = function (groupinfo, userinfo, el) {
  5571. var _userid = US.userInfo.UserId, //用户id
  5572. _isgroupmain = groupinfo.GroupManageCreateUserID == _userid //判断用户是否是群主
  5573. ;
  5574. //如果推出群的是群主处理
  5575. if (_isgroupmain) {
  5576. //如果群主自己推出,则解散群
  5577. if (userinfo.UserId == _userid) {
  5578. U.UF.UI.confirm("是否解散该群", function () {
  5579. U.MD.F.J.enterGroupExit(groupinfo, userinfo, true, el);
  5580. }); //创建提示框 提示是否删除备份
  5581. }
  5582. //否则则移除群好友
  5583. else {
  5584. //创建提示框 提示是否删除备份
  5585. U.UF.UI.confirm("是否移除该群用户", function () {
  5586. U.MD.F.J.enterGroupExit(groupinfo, userinfo, false, el);
  5587. });
  5588. }
  5589. }
  5590. //不是群主的处理
  5591. else {
  5592. U.UF.UI.confirm("是否确定退出该群", function () { U.MD.F.J.enterGroupExit(groupinfo, userinfo, false, el); }); //创建提示框 提示是否删除备份
  5593. }
  5594. }
  5595. /**
  5596. * 移除群异步
  5597. *
  5598. * @param {object} 群信息
  5599. * @param {object} 好友信息
  5600. * @param {bool} 是否为删除群
  5601. */
  5602. U.MD.F.J.enterGroupExit = function (groupinfo, userinfo, isdelete, el) {
  5603. if (isdelete === true) {
  5604. U.A.Request(US.FRIEND, ["DeleteGroup", US.userInfo.UserId, groupinfo.GroupManageID], U.MD.F.J.asynGroupExit, ["", groupinfo, userinfo, isdelete, el]); //解散群
  5605. }
  5606. else {
  5607. U.A.Request(US.FRIEND, ["ExitGroup", US.userInfo.UserId, groupinfo.GroupManageID, userinfo.UserId], U.MD.F.J.asynGroupExit, ["", groupinfo, userinfo, isdelete, el]);
  5608. }
  5609. }
  5610. /**
  5611. * 群移除异步
  5612. *
  5613. * @param {object} 群信息
  5614. * @param {object} 好友信息
  5615. * @param {bool} 是否为删除群
  5616. */
  5617. U.MD.F.J.asynGroupExit = function (r) {
  5618. var _context = r.context,
  5619. _chatfrom,
  5620. _groupinfo = _context[1], //群信息
  5621. _friendinfo = _context[2], //自己在群里的信息
  5622. _isdelete = _context[3], //是解散群还是退出(移除)群用户
  5623. _el = _context[4], //弹出的群窗体
  5624. _chatformel = U.selectEl("#U_MD_F")[0]; //聊天框元素
  5625. //删除群处理 或者退出群
  5626. if (_isdelete) {
  5627. //清空用户在群的数据
  5628. U.Json.del(US.friend.group, { "GroupManageID": _groupinfo.GroupManageID }); //删除群
  5629. U.Json.del(US.friend.groupusers, { "GroupManageID": _friendinfo.GroupManageID }); //删除群用户
  5630. //用户面板里是否存在群,存在删除
  5631. U.selectEl("#U_MD_F_H_ZLZ").find("[tid='" + _groupinfo.GroupManageID + "']").remove(); //删除群
  5632. //判断好友是否出现在聊天框里,如果是则移除聊天框
  5633. if (U.MD.F.W.isCreateForm(_groupinfo.GroupManageID)) {
  5634. U.MD.F.W.delteFriendChat(_groupinfo.GroupManageID, _chatformel);
  5635. }
  5636. //弹出群消息的弹窗
  5637. if (_el) {
  5638. _el = U.selectEl(_el).Parent({ usform: "true" });
  5639. _el.close();
  5640. }
  5641. U.alert('解散群成功');
  5642. }
  5643. //群主删除好友处理
  5644. else if (_groupinfo.GroupManageUserID == US.userInfo.UserId && _isdelete == false) {
  5645. U.selectEl(_el).remove(); //删除好友
  5646. U.Json.del(US.friend.groupusers, { "GroupManageID": _friendinfo.GroupManageID, "UserId": _friendinfo.UserId }); //删除群指定的用户
  5647. U.Json.del(U.MD.F.J.selectUserInfo.SelectUser, { "UserId": _friendinfo.UserId }); //删除群指定的用户
  5648. U.alert('已将成员移除群聊');
  5649. }
  5650. //自己退出群处理
  5651. else {
  5652. //移除群好友
  5653. U.MD.F.W.delteFriendChat(_friendinfo.GroupManageID, _chatformel);
  5654. U.selectEl("#U_MD_F_H_ZLZ").find("[tid='" + _groupinfo.GroupManageID + "']").remove(); //删除群
  5655. U.Json.del(US.friend.group, { "GroupManageID": _friendinfo.GroupManageID }); //删除群指定的用户
  5656. U.Json.del(US.friend.recentcontacts, { "GroupManageID": _friendinfo.GroupManageID }); //删除最近聊天中被删除的群
  5657. //弹出群消息的弹窗
  5658. if (_el) {
  5659. _el = U.selectEl(_el).Parent({ usform: "true" });
  5660. _el.close();
  5661. }
  5662. U.alert('已退出群聊');
  5663. }
  5664. }
  5665. /**
  5666. * 选择联系人弹框
  5667. *
  5668. * @param {object} 添加进入的元素
  5669. * @param {function} 添加的用户信息
  5670. * @param {number} 0 新创群 1邀请好友
  5671. */
  5672. U.MD.F.J.selectFriendForm = function (cb, type, fileinfo, group) {
  5673. //添加好友弹框调用,用户必须登录和已经加载了好友数据
  5674. if (!U.MD.U.L.isLogin() && US.friend.friends) {
  5675. var i, //用于循环所有的是否在群里的人
  5676. _formel, //用于存储创建群选择好友的弹框
  5677. _gel = U.selectEl("#U_MD_F_RC_G_C")[0], //获取组元素
  5678. _fel = U.selectEl("#U_MD_F_RC_F_C")[0], //获取好友元素
  5679. _elparent = U.selectEl("#U_MD_F_RC")[0], //获取存放该元素的父级元素
  5680. _clone = _elparent.cloneNode(true), //克隆元素
  5681. _allfriendinfo = U.Json.select(US.friend.friends.concat([])), //所有的联系人
  5682. _addfriendinfo = U.MD.F.J.selectUserInfo, //选择用户的信息
  5683. _selectfriend = _addfriendinfo.SelectUser, //添加好友信息
  5684. _clickEl = U.selectEl('#U_MD_F_RC_Friend')[0],
  5685. _groupEl = U.selectEl('#U_MD_F_RC_Group')[0],
  5686. _joinEl = U.selectEl('#U_MD_F_RC_Join')[0]
  5687. if (group == 1) {
  5688. //已经在群里的就不添加了
  5689. for (i = 0; i < _selectfriend.length; i++) {
  5690. U.Json.del(_allfriendinfo, { "UserId": _selectfriend[i].UserId }); //删除所有在群里的用户id
  5691. }
  5692. }
  5693. //弹出创建群选择好友的框
  5694. var _form = new U.UF.UI.form("选择联系人",
  5695. _elparent,
  5696. {
  5697. "id": "U_MD_F_RC_O",
  5698. "style": {
  5699. "width": "480px",
  5700. "height": "530px",
  5701. "min-width": "480px"
  5702. }
  5703. },
  5704. {
  5705. isnarrow: false,
  5706. isenlarge: false
  5707. });
  5708. //_formel = _form.form;
  5709. _addfriendinfo.CallBack = cb; //回调函数
  5710. if (US.friend.friends.length) {
  5711. //打印可以选择的联系人
  5712. if (!type || type == 'friend') {
  5713. U.MD.F.J.printSelectFriend(_fel, _allfriendinfo, _elparent);
  5714. _clickEl.onclick = function () {
  5715. _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)
  5716. }
  5717. }
  5718. //打印可以选择的群
  5719. if (!type || type == 'group') {
  5720. U.MD.F.J.printSelectGroupUser(_gel, US.friend.group, _elparent);
  5721. _groupEl.onclick = function () {
  5722. _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)
  5723. }
  5724. }
  5725. if (type == 'friend' || type == 'group') {
  5726. _clickEl.style.display = 'none';
  5727. _groupEl.style.display = 'none';
  5728. } else {
  5729. _clickEl.style.display = 'block';
  5730. _groupEl.style.display = 'block';
  5731. }
  5732. } else {
  5733. _clickEl.style.display = 'none';
  5734. _groupEl.style.display = 'none';
  5735. _joinEl.style.display = 'block';
  5736. U.selectEl('.U_MD_F_RC_Join_btn')[0].onclick = function () {
  5737. var _input = $$('input', {}, _joinEl),
  5738. _fileType = fileinfo.UserDirectoryExtendType == 'uw' ? 'word' : 'execl';
  5739. _input.value = "/" + _fileType + '/join/' + fileinfo.UserDirectoryID;
  5740. _input.select();
  5741. document.execCommand("Copy");
  5742. U.selectEl(_input).remove();
  5743. U.Alert('复制成功,赶快分享给小伙伴吧!');
  5744. }
  5745. }
  5746. _addfriendinfo.NeedUser = [];
  5747. _elparent.parentNode.style.backgroundColor = "#f3f3f3"
  5748. U.selectEl(_elparent)[0].style.display = "block"; //显示出添加好友的信息
  5749. U.selectEl("#U_MD_Home")[0].appendChild(_clone); //把克隆的元素打印出来
  5750. return _formel; //返回窗体元素
  5751. }
  5752. }
  5753. /**
  5754. * 打印可以添加的用户
  5755. *
  5756. * @param {object} 添加联系人的元素
  5757. * @param {function} 选择的好友
  5758. */
  5759. U.MD.F.J.printSelectFriend = function (el, friendinfo, boxele) {
  5760. var i, //用于循环所有联系人打印
  5761. _tempel, //用于创建元素
  5762. _temponeel, //用于创建元素
  5763. _frag = $$("frag"); //创建新的元素
  5764. //联系人打印,循环所有还有信息的长度
  5765. for (i = 0; i < friendinfo.length; i++) {
  5766. _tempel = $$("div",
  5767. {
  5768. "className": "U_MD_F_RC_CO",
  5769. "FID": friendinfo[i].UserId,
  5770. "onclick": U.UF.C.closure(function (firendinfo) {
  5771. U.MD.F.J.clickSelectFriend(this, firendinfo); //选择后的点击事件
  5772. U.MD.F.J.showChoose(firendinfo, U.selectEl(this).find('.U_MD_F_RC_COC ')[0], boxele, 'friend')
  5773. }, [friendinfo[i]])
  5774. },
  5775. _frag);
  5776. $$("div", { "className": "U_MD_F_RC_COI U_Img" }, _tempel); //创建元素
  5777. _temponeel = $$("div", { "className": "U_MD_F_RC_COC U_MD_D_Text_Abbreviation" }, _tempel); //创建元素
  5778. $$("img",
  5779. {
  5780. "onerror": U.MD.C.imgError,
  5781. "title": "点击查看",
  5782. "onclick": function (n) {
  5783. return function () {
  5784. U.UF.EV.stopBubble(); //阻止冒泡时间
  5785. U.MD.U.V.ViewOtherUserInfo(friendinfo[n].UserId); //打印个人用户信息
  5786. }
  5787. } (i),
  5788. "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead), //获取好友头像img
  5789. "alt": friendinfo[i].FriendsDescript//获取好友描述
  5790. },
  5791. _temponeel);
  5792. $$("div", { "className": "U_MD_F_RC_COCN", "innerHTML": friendinfo[i].UserNickName }, _temponeel); //创建元素,获取好友用户名
  5793. }
  5794. //显示到框
  5795. el.innerHTML = ""; //清空数据
  5796. el.appendChild(_frag); //获取所有的打印的用户到显示框内
  5797. }
  5798. /**
  5799. * 打印可以添加的群用户
  5800. *
  5801. * @param {object} 添加联系人的元素
  5802. * @param {function} 选择的好友
  5803. */
  5804. U.MD.F.J.printSelectGroupUser = function (el, groupinfo, boxele) {
  5805. var i, //获取循环的元素
  5806. _tempel, //创建元素
  5807. _temponeel, //创建元素
  5808. _frag = $$("frag"); //创建元素的父级元素
  5809. //循环打印,循环所有群信息的长度
  5810. for (i = 0; i < groupinfo.length; i++) {
  5811. _tempel = $$("div",
  5812. {
  5813. "className": "U_MD_F_RC_CO",
  5814. "FID": groupinfo[i].GroupManageID, //fid为群的群id
  5815. "onclick": function (n) {
  5816. return function () {
  5817. U.MD.F.J.showChoose(firendinfo, U.selectEl(this).find('.U_MD_F_RC_COC ')[0], boxele, 'group', this)
  5818. U.MD.F.J.clickSelectGroup(this, groupinfo[n]); //选择群后的点击事件
  5819. }
  5820. } (i)
  5821. }, _frag);
  5822. $$("div", { "className": "U_MD_F_RC_COI U_Img" }, _tempel); //创建元素
  5823. _temponeel = $$("div", { "className": "U_MD_F_RC_COC U_MD_D_Text_Abbreviation" }, _tempel); //创建元素
  5824. $$("img",
  5825. {
  5826. "title": "点击查看",
  5827. "onclick": function (n) {
  5828. return function () {
  5829. U.UF.EV.stopBubble(); //阻止冒泡事件
  5830. U.MD.U.V.GroupInfo(groupinfo[n]); //打印群的所有信息
  5831. }
  5832. } (i),
  5833. "src": "/img/chatgroup.png"//显示群的群头像
  5834. }, _temponeel);
  5835. $$("div", { "className": "U_MD_F_RC_COCN", "innerHTML": groupinfo[i].GroupManageName }, _temponeel); //获取群的群名
  5836. }
  5837. el.appendChild(_frag); //打印群信息
  5838. }
  5839. /**
  5840. * 搜索联系人
  5841. *
  5842. * @param {object} 用户信息
  5843. */
  5844. U.MD.F.J.searchSelectFriend = function (groupinfo) {
  5845. var _searchel = U.selectEl("#U_MD_F_RC_C")[0],
  5846. _UDTD = U.selectEl("div@FID=" + groupinfo.UserId)[0]; //获取选中的添加的元素
  5847. if (_UDTD) {
  5848. _UDTD.onclick();
  5849. U.UF.EV.scrollToPosition(_UDTD); //滚动到指定的位置
  5850. }
  5851. else { U.alert("好友已经添加到群组里~"); }
  5852. }
  5853. /**
  5854. * 选择添加后的效果
  5855. *
  5856. * @param {element} 添加好友的元素
  5857. * @param {object} 好友信息
  5858. */
  5859. U.MD.F.J.clickSelectFriend = function (el, friendinfo) {
  5860. var _selectel = U.selectEl("div", el)[0]; //选择的元素
  5861. //如果元素没有给选择,那么点击选择
  5862. if (_selectel.className == "U_MD_F_RC_COI U_Img") {
  5863. _selectel.className += " U_MD_F_RC_COIO"; //设置点击后的效果样式
  5864. U.MD.F.J.selectUserInfo.NeedUser.push(friendinfo); //最后需要添加的用户
  5865. }
  5866. //如果元素已经是选择的状态,那么点击后则取消选择
  5867. else {
  5868. _selectel.className = "U_MD_F_RC_COI U_Img"; //设置点击后的效果样式
  5869. U.Json.del(U.MD.F.J.selectUserInfo.NeedUser, { "UserId": friendinfo.UserId }); //删除最后需要添加的用户
  5870. }
  5871. }
  5872. /**
  5873. * 选择添加群后的效果
  5874. *
  5875. * @param {element} 添加群的元素
  5876. * @param {object} 群的信息 U.Json()
  5877. */
  5878. U.MD.F.J.clickSelectGroup = function (el, groupinfo) {
  5879. var i,
  5880. _selectel = U.selectEl("div", el)[0], //点击的元素
  5881. _needuser = U.MD.F.J.selectUserInfo.NeedUser, //最后需要添加的用户
  5882. _groupuser = U.Json.select(US.friend.groupusers, { "GroupManageID": groupinfo.GroupManageID }); //选择群里所有的群用户
  5883. //如果元素没有给选择,那么点击选择
  5884. if (_selectel.className == "U_MD_F_RC_COI U_Img") {
  5885. _selectel.className += " U_MD_F_RC_COIO"; //设置点击后的效果样式
  5886. _needuser = _needuser.concat(_groupuser); //把群用户添加到需要添加的用户集合里
  5887. }
  5888. //如果元素已经是选择的状态,那么点击后则取消选择
  5889. else { //添加删除效果
  5890. _selectel.className = "U_MD_F_RC_COI U_Img"; //设置点击后的效果样式
  5891. //移除群里的每一个用户
  5892. for (i = 0; i < _groupuser.length; i++) {
  5893. U.Json.del(_needuser, { "UserId": _groupuser[i].UserId });
  5894. }
  5895. }
  5896. }
  5897. /**
  5898. * 创建群取消按钮
  5899. *
  5900. * @param {element} 添加好友窗体
  5901. */
  5902. U.MD.F.J.closeSelectFriendForm = function (el) {
  5903. U.UF.F.closeWindow($(el).Parent({ usform: "true" }), "remove"); //移除创建群的弹窗
  5904. }
  5905. /**
  5906. * 确定添加按钮
  5907. *
  5908. * @param {element} 添加好友窗体
  5909. */
  5910. U.MD.F.J.determineSelectFriend = function (el) {
  5911. var _selectuserinfo = U.MD.F.J.selectUserInfo, //获取所有选择信息
  5912. _groupid = U.selectEl(el).find('.U_MD_F_RC_COIO')[0] && U.selectEl(el).find('.U_MD_F_RC_COIO')[0].parentNode.getAttribute('fid');
  5913. _groupid = U.Json.select(US.friend.group, { "GroupManageID": _groupid })[0] ? _groupid : false;
  5914. //回调函数处理
  5915. if (_selectuserinfo.CallBack) {
  5916. _selectuserinfo.CallBack(_groupid);
  5917. _selectuserinfo.CallBack = null;
  5918. }
  5919. U.UF.F.closeWindow(el, "remove"); //取消窗口
  5920. }
  5921. /**
  5922. * 显示输入文档名对话框
  5923. *
  5924. */
  5925. U.MD.F.J.inputDocName = function () {
  5926. var _confirmEl = U.selectEl('#U_UF_UI_confirm')
  5927. U.UF.F.topWindow(_confirmEl[0])
  5928. U.selectEl(_confirmEl).find('#U_MD_DK_RE_localDoc')[0].click()
  5929. }
  5930. /**
  5931. * 确定添加按钮
  5932. * 点击好友添加确定按钮,去数据库创建一个群
  5933. * @param {element} 添加好友窗体
  5934. * @param {string} 群id
  5935. * @param {boolean} 是否是新建
  5936. */
  5937. U.MD.F.J.determineCreateGroupAndAddGroupUser = function (groupid, el, chatel, update, groupname, groupdescript, cb) {
  5938. var i,
  5939. _groupinfo, //群信息
  5940. _inputs = U.selectEl("input,textarea", el), //输入的群信息
  5941. _adduserinfo = U.MD.F.J.selectUserInfo.NeedUser, //需要添加用户的集合
  5942. _userid = US.userInfo.UserId, //用户的id
  5943. _groupname = groupname == undefined ? _inputs[0].value : groupname, //创建的群名
  5944. _groupdescript = groupdescript == undefined ? _inputs[1].value : groupdescript, //创建的群描述
  5945. _groupuserids = U.Json.toKeyArray(_adduserinfo, "UserId").join(",") //添加进入群所有好友的id
  5946. ;
  5947. //如果群不存在则创建
  5948. if (!groupid) {
  5949. if (_groupname == "") {
  5950. for (var i = 0; i < _adduserinfo.length; i++) {
  5951. _groupname = _groupname + "、" + _adduserinfo[i].UserNickName;
  5952. }
  5953. _groupname = _groupname + "、" + US.userInfo.UserNickName;
  5954. _groupname = _groupname.substr(1, _groupname.length);
  5955. }
  5956. groupid = Guid.newGuid(); //新建一个群id
  5957. _groupinfo = new U.MD.F.T.groupEntity(groupid, _groupname, new Date(), _userid, _groupdescript, null); //添加群实体
  5958. //获取创建群后,拉进群用户里包括自己
  5959. _adduserinfo.push(US.userInfo);
  5960. if (_groupuserids) {
  5961. _groupuserids = _userid + "," + _groupuserids;
  5962. } else {
  5963. _groupuserids = _userid;
  5964. }
  5965. //关闭弹框
  5966. U.UF.F.closeWindow($(el).Parent({ usform: "true" }), "remove");
  5967. }
  5968. //群存在操作
  5969. else {
  5970. _groupinfo = U.Json.select(US.friend.group, { "GroupManageID": groupid })[0]; //获取群
  5971. }
  5972. // _adduserinfo = _adduserinfo.splice(0, _adduserinfo.length); //移除全局变量,把需要添加的用户删除
  5973. //创建群成员,给每个群成员发送一条建立群给拉入群的消息
  5974. U.A.Request(US.FRIEND, ["CreateGroupAndAddUser", _userid, groupid, _groupname, _groupdescript, _groupuserids],
  5975. U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser, ["", _groupinfo, _adduserinfo, groupid, _groupname, _groupdescript, el, chatel, _groupuserids, update, cb]); //添加到数据库
  5976. }
  5977. /**
  5978. * 异步创建群
  5979. * @param {object} 服务器返回的值
  5980. */
  5981. U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser = function (r) {
  5982. var i,
  5983. _context = r.context, //回调函数的值
  5984. _directory,
  5985. _diskinfo,
  5986. _groupuser,
  5987. _userinfo = US.userInfo, //回调的用户信息
  5988. _groupinfo = _context[1], //当前群信息
  5989. _groupuserinfo = _context[2], //用户信息集合
  5990. _groupid = _context[3], //群id
  5991. _groupname = _context[4], //群名
  5992. _groupdescript = _context[5] //群描述
  5993. ;
  5994. r = r.value; //获取服务器的返回值
  5995. //创建群或者修改群成功o
  5996. if (r !== false) {
  5997. //如果新建的群不存在全局变量中,则新建一个
  5998. if (!U.Json.select(US.friend.group, { "GroupManageID": _groupid })[0]) {
  5999. US.friend.group.unshift(_groupinfo); //把群插入全局变量中
  6000. //新建一个群目录
  6001. _directory = new U.MD.DK.M.entity(_groupinfo.GroupManageID, 0, US.userInfo.UserId, _groupinfo.GroupManageName, _groupinfo.GroupManageName,
  6002. "folder", null, new Date(), U.MD.DK.C.getIcon("folder")[1], 1, null, null, 0, "", _groupinfo.GroupManageID);
  6003. //调用添加文件到disk全局的方法
  6004. _diskinfo = U.MD.DK.M.diskOperatingSwitch(_userinfo.UserId); //根据userid获取网盘的信息
  6005. U.MD.DK.M.entity.add([_directory], _diskinfo); //添加到disk全局里
  6006. }
  6007. //如果群已经存在了,那么修改群名和群描述
  6008. else {
  6009. _groupinfo.GroupManageName = _groupname; //群名
  6010. _groupinfo.GroupManageDescript = _groupdescript; //群描述
  6011. }
  6012. //把群的用户添加到群用户数组里
  6013. for (i = 0; i < _groupuserinfo.length; i++) {
  6014. _groupuser = new U.MD.F.T.groupUserEntity(_groupuserinfo[i].UserId, _groupuserinfo[i].UserImageHead,
  6015. _groupuserinfo[i].UserNickName, _groupuserinfo[i].UserName, _groupuserinfo[i].UserThumbnailImageHead,
  6016. _groupuserinfo[i].UserNickName, _groupid, 1); //新建一个群用户
  6017. US.friend.groupusers.push(_groupuser); //添加到群用户里
  6018. }
  6019. //创建群成功后,直接点击查看群。
  6020. U.selectEl($("#U_MD_F_H_ZLTA").Child()[2]).Child()[0].onclick();
  6021. //提示语
  6022. if (_groupinfo && _groupuserinfo.length > 0) { //判断是否有邀请好友
  6023. if (_groupinfo) {
  6024. var _alert = _groupname + "邀请成功";
  6025. } else {
  6026. var _alert = "邀请好友请入群成功~";
  6027. }
  6028. //清空群用户
  6029. U.MD.F.J.selectUserInfo.NeedUser.splice(0, U.MD.F.J.selectUserInfo.NeedUser.length);
  6030. U.Alert(_alert);
  6031. //点击'确定'按钮
  6032. } else {
  6033. U.selectEl('#U_MD_F_Add_O')[0].style.display = "none";//隐藏群组信息窗口
  6034. }
  6035. }
  6036. //创建失败的提示
  6037. else {
  6038. U.Alert("服务器繁忙,请从新创建!!");
  6039. }
  6040. }
  6041. /*
  6042. * 弹框询问用户是否创建这个群
  6043. * @param groupid 群的id
  6044. * @param groupname 群名
  6045. * @param groups 群的描述
  6046. * @param fileid 文件id
  6047. * @param cb 回调函数 点击确定后的回调函数
  6048. */
  6049. U.MD.F.J.isCreateGroup = function (groupid, groupname, groupds, fileid, cb) {
  6050. _isgroup = U.Json.select(US.friend.group, { "GroupManageID": groupid })[0]; //判断群是否已经存在在列表中
  6051. //判断是否存在这个群
  6052. if (!_isgroup) {
  6053. var _elparent = $$("div", {}); //创建父级元素
  6054. var _elcontent = $$("div",
  6055. {
  6056. "className": "U_MD_F_A_T",
  6057. "innerHTML": "您的文档将移至新建群里(" + groupds + "),是否新建群组?"
  6058. }, //创建弹窗内容
  6059. _elparent);
  6060. var _elall = $$("div",
  6061. {
  6062. "className": "U_MD_F_A_T_All"
  6063. }, //创建信息父级元素
  6064. _elparent);
  6065. var _elbutton = $$("div",
  6066. {
  6067. "className": "U_MD_F_A_T_OFF",
  6068. "innerHTML": "取消"
  6069. }, //取消按钮
  6070. _elall);
  6071. $$("div",
  6072. {
  6073. "className": "U_MD_F_A_T_OUT",
  6074. "innerHTML": "确认",
  6075. "onclick": function () {
  6076. U.MD.F.J.changeInfo(groupid, groupname, groupds, fileid, cb); //点击确定后的点击事件
  6077. }
  6078. }, //确定按钮
  6079. _elall);
  6080. _elbutton.onclick = function () {
  6081. U.selectEl("#U_MD_D_emp_CK")[0].close()
  6082. } //点击取消按钮后关闭窗口
  6083. new U.UF.UI.form("提示",
  6084. _elparent,
  6085. {
  6086. "id": "U_MD_D_emp_CK",
  6087. "style": {
  6088. "width": "250px",
  6089. "height": "170px"
  6090. }
  6091. },
  6092. {
  6093. istop: true,
  6094. isdrag: false,
  6095. isnarrow: false,
  6096. isenlarge: false
  6097. }).form;
  6098. } else {
  6099. U.MD.F.J.changeInfo(groupid, groupname, groupds, fileid, cb)//判断群存在时,默认执行点击确定后的点击事件
  6100. }
  6101. }
  6102. /*
  6103. * 获取所选择的联系人,发送消息
  6104. * @param groupid 群id
  6105. * @param grouopname 群名
  6106. * @param groupds 群描述
  6107. * @param fileid 文件id
  6108. * @param cb 回调函数
  6109. */
  6110. U.MD.F.J.changeInfo = function (groupid, groupname, groupds, fileid, cb) {
  6111. var i, _isgroup,
  6112. // _UCB = U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser, //创建群异步回调
  6113. _groupsign = 1, //判断是否已经创建。如果没有创建,就把_UTF的值设置为0,0在存储过程的传参作用是创建群, 1是不创建直接修改群名
  6114. _userid = US.userInfo.UserId, //当前用户id 也是群主id
  6115. _groupinfo = [groupname, groupds], //群名和群描述的数组 [0]群名 [1]群描述
  6116. _groupfriend = U.MD.F.J.selectUserInfo.NeedUser, //需要添加用户的集合(群用户)
  6117. _grouparr = new Array(); //创建一个新的数组
  6118. //循环所有需要添加用户的集合
  6119. for (var i = 0; i < _groupfriend.length; i++) {
  6120. var pd = 0;
  6121. //循环群数组里是否有内容
  6122. for (var u = 0; u < _grouparr.length; u++) {
  6123. if (_grouparr[u].UserId == _groupfriend[i].UserId || _groupfriend[i].UserId == US.userInfo.UserId) {//判断群数组是否存有需要添加到群的用户
  6124. pd++
  6125. }
  6126. }
  6127. if (pd == 0) {
  6128. _grouparr.push(_groupfriend[i]); //把需要添加的用户信息存入数组中
  6129. }
  6130. }
  6131. _frienduser = U.Json.toKeyArray(_grouparr, "UserId").join(","), //用,分割群用户的id 例: userid,userid
  6132. _useridarr = U.Json.toKeyArray(_grouparr, "UserId").join(","); //用,分割群用户的id 例: userid,userid
  6133. _isgroup = U.Json.select(US.friend.group, { "GroupManageID": groupid })[0]; //判断群是否已经存在在列表中
  6134. if (!_isgroup) { //判断群是否存在
  6135. _groupsign = 0;
  6136. groupid = groupid || Guid.newGuid(); //没有群id创建一个群id
  6137. //创建群的实体,主要是用于添加到US.friend[2]这个群集合里面
  6138. _isgroup = new U.MD.F.T.groupEntity((groupid = groupid || Guid.newGuid()), _groupinfo[0], new Date(), _userid, _groupinfo[1], null); //拼接群用户id 把本人也添加到这个群里
  6139. //判断是否有分割群用户的id,如果有,就拼接起来
  6140. if (_useridarr) {
  6141. _useridarr = _userid + "," + _useridarr
  6142. } else { //如果没有,就直接添加
  6143. _useridarr = _userid + "" + _useridarr
  6144. }
  6145. }
  6146. // _groupfriend.splice(0, _groupfriend.length); //添加成功后移除用户
  6147. //创建群成员,给每个群成员发送一条建立群给拉入群的消息
  6148. 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]]); //添加到数据库
  6149. // 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]]); //添加到数据库
  6150. //给每个群成员发送一条有关于这个uw文件的消息
  6151. // 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(){}, [""]);
  6152. U.selectEl("#U_MD_D_emp_CK").hide()//隐藏元素
  6153. }
  6154. /**
  6155. * 确定添加按钮
  6156. *点击好友添加确定按钮,去数据库创建一个群
  6157. * @param {object} 添加好友窗体
  6158. */
  6159. U.MD.F.J.asynChangeInfo = function (r) {
  6160. U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser(r); //回调原本创建群的流程函数 这里地方不调用的话 会导致原本在好友聊天中创建群成员和群用不了
  6161. var _context = r.context; //获取信息
  6162. _context[6](_context[1], _context[7], _context[8], _context[9]); //回调群id
  6163. }
  6164. /**
  6165. * 无认证直接加入群
  6166. *
  6167. * @param {object} 群信息
  6168. * @param {function} 群id
  6169. */
  6170. U.MD.F.J.addUsersToGroup = function (groupinfo, cb) {
  6171. if (!U.MD.U.L.isLogin()) {//判断是否登录
  6172. var _userinfo = US.userInfo, //用户信息表
  6173. _userid = _userinfo.UserId, //用户id
  6174. _groups = US.friend.group, //用户群
  6175. _group = U.Json.select(_groups, { "GroupManageID": groupinfo.GroupManageID })[0]; //用户群
  6176. //判断用户是否已经加入群组
  6177. if (!_group) {
  6178. U.alert("正在加入,请稍等..");
  6179. //加入群组处理
  6180. 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 }, ]);
  6181. }
  6182. //否则直接查看群消息
  6183. else {
  6184. if (cb) {
  6185. cb();
  6186. }
  6187. else { U.MD.F.W.viewFriend(_group); }
  6188. }
  6189. }
  6190. }
  6191. //用户直接进入群异步
  6192. U.MD.F.J.asynAddUsersToGroup = function (r) {
  6193. var _context = r.context,
  6194. _cb = _context[2], //回调函数
  6195. _userid = US.userInfo.UserId, //用户id
  6196. _diskinfo = US.disk.Disks[_userid], //网盘信息
  6197. _groupinfo = U.MD.F.N.asynPulledIntoGroups(r); //添加群文件
  6198. //回调函数处理
  6199. if (_cb) {
  6200. U.UF.C.apply(this, _cb)();
  6201. }
  6202. //查看用户信息
  6203. else {
  6204. U.MD.F.W.viewFriend(_groupinfo);
  6205. }
  6206. U.selectEl($("#U_MD_F_H_ZLTA").Child()[2]).Child()[0].onclick();
  6207. U.alert("成功加入该群");
  6208. }
  6209. //#endregion
  6210. /**
  6211. * 弹出好友添加使用
  6212. *
  6213. * @param {object} 群信息
  6214. */
  6215. U.MD.F.J.addPopup = function () {
  6216. var _el;
  6217. _el = $$("div", { "className": "U_MD_F_A" });
  6218. $$("div", { "className": "U_MD_F_RA", "onclick": U.MD.F.M.createFriendGroupPopup, "innerHTML": "添加分组" }, _el); //添加分组按钮
  6219. $$("div", { "className": "U_MD_F_RA_E", "onclick": "U.MD.F.S.popSearchFriendsOrGroupForm(0);", "innerHTML": "添加/<br>查找好友" }, _el); //查找好友
  6220. $$("div", { "className": "U_MD_F_RA", "onclick": "U.MD.F.S.popSearchFriendsOrGroupForm(1)", "innerHTML": "加入群组" }, _el); //加入群聊 U.MD.F.S.popupsSearchGroups
  6221. $$("div", { "className": "U_MD_F_RA", "onclick": "U.MD.F.J.groupInfoForm();", "innerHTML": "创建群组" }, _el); //创建群聊
  6222. new U.UF.UI.form("添加好友/群聊", _el, { 'id': 'U_MD_F_addFriendorGroup', "style": { "width": "390px", "height": "220px"} }, { isenlarge: false, isnarrow: false });
  6223. };
  6224. /**
  6225. *
  6226. * @param el 准备隐藏的元素
  6227. * @param nel 准备显示的元素
  6228. * @param elparent 准备隐藏的元素的父亲元素
  6229. * @param clickel 上一次点击的元素
  6230. * @param thisel 点击的元素
  6231. * @returns {*} 返回这次点击的元素
  6232. */
  6233. U.MD.F.J.alterNately = function (el, nel, elparent, clickel, thisel) {
  6234. if (thisel != clickel) {
  6235. nel.style.display = 'none';
  6236. nel.previousElementSibling.children[0].src = "/img/arrowR.png";
  6237. var con = U.selectEl(nel).find('.U_MD_F_RC_COIO');
  6238. for (var i = 0; i < con.length; i++) {
  6239. con[i].className = "U_MD_F_RC_COI U_Img"
  6240. }
  6241. U.MD.F.J.selectUserInfo.NeedUser = [];
  6242. U.selectEl(elparent).find('.U_MD_F_RC_C_C')[0].innerHTML = "";
  6243. U.selectEl(elparent).find('.U_MD_F_RC_C_T')[0].innerText = 0;
  6244. }
  6245. if (el.style.display == 'none') {
  6246. el.style.display = 'block';
  6247. el.previousElementSibling.children[0].src = "/img/arrowB.png";
  6248. } else {
  6249. el.style.display = 'none';
  6250. el.previousElementSibling.children[0].src = "/img/arrowR.png";
  6251. }
  6252. return thisel
  6253. }
  6254. /**
  6255. * 选择联系人选择功能
  6256. * @param el 用户信息元素
  6257. * @param boxele 选择联系人大元素
  6258. * @param type 点击的类型 分为'group'和'friend'
  6259. * @param cthis 选中的元素
  6260. */
  6261. U.MD.F.J.showChoose = function (firendinfo, el, boxele, type, cthis) {
  6262. var _fel = U.selectEl($(boxele).find('.U_MD_F_RC_C_C')[0]).find("div[fid='" + U.selectEl(el.parentNode).attr('fid') + "']")[0],
  6263. _leftShowEl = U.selectEl(boxele).find('.U_MD_F_RC_C_C')[0],
  6264. _cNam = cthis && U.selectEl(cthis.parentNode).find('.U_MD_F_RC_COIO') || []
  6265. if (_cNam.length && _cNam[0].parentNode.getAttribute('fid') != U.selectEl(cthis).attr('fid')) {
  6266. var _delElFid = U.selectEl($(_cNam)[0].parentNode).attr('fid')
  6267. _cNam[0].className = _cNam[0].className.replace(' U_MD_F_RC_COIO', '');
  6268. U.selectEl($(boxele).find("div[fid='" + _delElFid + "']")[1]).remove()
  6269. U.MD.F.J.selectUserInfo.NeedUser = []
  6270. }
  6271. if (!_fel) {
  6272. var addel = $$('div', { className: "U_MD_F_RC_C_C_A", fid: U.selectEl(el.parentNode).attr('fid') });
  6273. $$('img', { "onerror": U.MD.C.imgError, src: el.firstElementChild.src }, addel);
  6274. $$('span', { innerText: el.lastElementChild.innerText }, addel)
  6275. addel.onclick = function () {
  6276. U.MD.F.J.clearDefaultStyle();
  6277. addel.className += " U_MD_F_A_AddNewGrouper";
  6278. $$("div", {
  6279. "id": "U_MD_F_A_XX",
  6280. "style": {
  6281. "width": "19px",
  6282. "height": "19px",
  6283. "background-image": "url('/img/YS2017.png')",
  6284. "display": "inline-block",
  6285. "background-repeat": "no-repeat",
  6286. "background-position": "-984px -407px",
  6287. "float": "right",
  6288. "margin": "12px",
  6289. "cursor": "pointer"
  6290. },
  6291. "onclick": function () {
  6292. U.MD.F.J.deleteClick(this, firendinfo, boxele);
  6293. }
  6294. }, addel);
  6295. }
  6296. if (type == "friend") {
  6297. U.selectEl(boxele).find('.U_MD_F_RC_C_C')[0].appendChild(addel);
  6298. } else if (type == "group") {
  6299. _leftShowEl.innerHTML = "";
  6300. if (!cthis.firstChild.className.match('U_MD_F_RC_COIO')) {
  6301. var _groupFid = U.selectEl(el.parentNode).attr('fid'),
  6302. _groupFriends = U.Json.select(US.friend.groupusers, { "GroupManageID": _groupFid })
  6303. _newEl = $$('div');
  6304. for (var i = 0; i < _groupFriends.length; i++) {
  6305. var _cloneEl = addel.cloneNode(true);
  6306. _cloneEl.setAttribute('fid', _groupFriends[i].UserId)
  6307. _cloneEl.fid = _groupFriends[i].UserId;
  6308. _cloneEl.firstChild.src = U.MD.C.getHeadImage(_groupFriends[i].UserImageHead) || "/img/UserHead/UseHead.jpg";
  6309. _cloneEl.lastChild.innerText = _groupFriends[i].UserName;
  6310. _newEl.appendChild(_cloneEl);
  6311. }
  6312. _leftShowEl.appendChild(_newEl);
  6313. U.MD.F.J.selectUserInfo.NeedUser = _groupFriends;
  6314. }
  6315. U.selectEl(boxele).find('.U_MD_F_RC_C_T')[0].innerText = _leftShowEl.children[0] ? _leftShowEl.children[0].children.length : 0;
  6316. return;
  6317. }
  6318. } else {
  6319. U.selectEl(_fel).remove()
  6320. }
  6321. U.MD.F.J.clearDefaultStyle();
  6322. var _lastChild = U.selectEl(".U_MD_F_RC_C_C.U_MD_F_RC_C")[1].lastChild;
  6323. _lastChild.className += " U_MD_F_A_AddNewGrouper";
  6324. $$("div", {
  6325. "id": "U_MD_F_A_XX",
  6326. "style": {
  6327. "width": "19px",
  6328. "height": "19px",
  6329. "background-image": "url('/img/YS2017.png')",
  6330. "display": "inline-block",
  6331. "background-repeat": "no-repeat",
  6332. "background-position": "-984px -407px",
  6333. "float": "right",
  6334. "margin": "12px"
  6335. },
  6336. "onclick": function () {
  6337. U.MD.F.J.deleteClick(this, firendinfo, boxele);
  6338. }
  6339. }, _lastChild);
  6340. U.selectEl(boxele).find('.U_MD_F_RC_C_T')[0].innerText = _leftShowEl.children.length;
  6341. }
  6342. /**
  6343. * 清空默认选中样式功能
  6344. */
  6345. U.MD.F.J.clearDefaultStyle = function () {
  6346. var targerList = U.selectEl(".U_MD_F_RC_C_C.U_MD_F_RC_C")[1].children//已选择联系人的列表
  6347. for (var i = 0; i < targerList.length; i++) {
  6348. targerList[i].className = "U_MD_F_RC_C_C_A"; //修改所有已选择联系人className
  6349. U.selectEl("#U_MD_F_A_XX")[0] ? U.selectEl("#U_MD_F_A_XX")[0].remove() : ""; //判断是否含有删除按钮
  6350. };
  6351. }
  6352. /**
  6353. * 删除已选择联系人功能
  6354. * @param div 选中元素
  6355. * @param firendinfo 用户信息元素
  6356. * @param boxele 选择联系人窗口
  6357. */
  6358. U.MD.F.J.deleteClick = function (div, firendinfo, boxele) {
  6359. window.event ? window.event.cancelBubble = true : e.stopPropagation();
  6360. var _fid = div.parentNode.fid; //该联系人fid
  6361. U.Json.del(U.MD.F.J.selectUserInfo.NeedUser, { "UserId": firendinfo.UserId }); //从json数组中删除该联系人
  6362. div.parentNode.remove(); //从已选择联系人列表里删除该联系人
  6363. 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; //更改已选择联系人的数量
  6364. var _list = U.selectEl(".U_MD_F_RC_CO"); //好友列表
  6365. for (var x = 0; x < _list.length; x++) {
  6366. if (_list[x].FID == _fid) {//判断是否等于该联系人fid
  6367. _list[x].children[0].className = "U_MD_F_RC_COI U_Img"; //修改该联系人已选中的按钮样式
  6368. }
  6369. }
  6370. }
  6371. /**
  6372. * 一键创建群聊
  6373. * @param div 选中元素
  6374. */
  6375. U.MD.F.J.oneKeyCreateGroup = function (groupid,el,chatel,update,cb) {
  6376. var i,
  6377. _groupinfo, //群信息
  6378. //_inputs = U.selectEl("input,textarea", el), //输入的群信息
  6379. _adduserinfo = U.MD.F.J.selectUserInfo.NeedUser, //需要添加用户的集合
  6380. _userid = US.userInfo.UserId, //用户的id
  6381. _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()), //创建的群名
  6382. _groupdescript = "", //创建的群描述
  6383. _groupuserids = U.Json.toKeyArray(_adduserinfo, "UserId").join(",") //添加进入群所有好友的id
  6384. ;
  6385. //如果群不存在则创建
  6386. if (!groupid) {
  6387. if (_groupname == "") {
  6388. for (var i = 0; i < _adduserinfo.length; i++) {
  6389. _groupname = _groupname + "、" + _adduserinfo[i].UserNickName;
  6390. }
  6391. _groupname = _groupname + "、" + US.userInfo.UserNickName;
  6392. _groupname = _groupname.substr(1, _groupname.length);
  6393. }
  6394. groupid = Guid.newGuid(); //新建一个群id
  6395. _groupinfo = new U.MD.F.T.groupEntity(groupid, _groupname, new Date(), _userid, _groupdescript, null); //添加群实体
  6396. //获取创建群后,拉进群用户里包括自己
  6397. _adduserinfo.push(US.userInfo);
  6398. if (_groupuserids) {
  6399. _groupuserids = _userid + "," + _groupuserids;
  6400. } else {
  6401. _groupuserids = _userid;
  6402. }
  6403. //关闭弹框
  6404. //U.UF.F.closeWindow($(el).Parent({ usform: "true" }), "remove");
  6405. }
  6406. // _adduserinfo = _adduserinfo.splice(0, _adduserinfo.length); //移除全局变量,把需要添加的用户删除
  6407. //创建群成员,给每个群成员发送一条建立群给拉入群的消息
  6408. U.A.Request(US.FRIEND, ["CreateGroupAndAddUser", _userid, groupid, _groupname, _groupdescript, _groupuserids],
  6409. U.MD.F.J.asynDetermineCreateGroupAndAddGroupUser, ["", _groupinfo, _adduserinfo, groupid, _groupname, _groupdescript, el, chatel, _groupuserids, update, cb]); //添加到数据库
  6410. };
  6411. ///<jscompress sourcefile="Friend.js" />
  6412. /*
  6413. 问题:
  6414. 1、整套好友的功能流程图
  6415. 2、设计缺少流程 只有大流程 没有那个按钮的细节流程
  6416. */
  6417. Namespace.register("U.MD.F"); //好友主命名空间
  6418. /*
  6419. * U.MD.F.initFriend 初始化加载好友(初始化好友模块)判断好友窗体是否创建,创建了则初始化创建消息提示图标,点击好友窗体的最近功能按钮
  6420. * U.MD.F.newFriendTips 创建用户提示图标 (在桌面创建一个企鹅图标) 添加用户提示区域
  6421. * U.MD.F.printFriendGroupOrFriend 用户列表好友打印 (点击左上好友功能打印好友列表) 清空好友窗体左边列表内容,判断用户是否拥有好友,有则先创建好友分组,然后根据好友分组打印好友,最后添加进好友窗体。如果没有好友窗体,则触发U.MD.F.printHasNoFriend(_frag)向用户推荐好友
  6422. * U.MD.F.printFriendOrGroup 好友和群样式输出 (打印好友或群的样式在左边聊天列表) 根据用户好友或群数量打印在左边列表,并添加好友或群头像,名字等样式,然后根据UserId和GroupManageID区分好友和群分别添加点击事件,鼠标右击事件,
  6423. * U.MD.F.openOrCloseFriendClass 好友功能下点击分组 (显示或隐藏好友分组下的好友列表) 获取您点击的分组的好友列表元素,判断它的状态(style.display)是隐藏还是显示。隐藏则显示,显示就隐藏
  6424. *
  6425. */
  6426. //#region 初始化好友
  6427. //初始化好友函数
  6428. /**
  6429. * 初始化加载好友
  6430. */
  6431. U.MD.F.initFriend = U.MD.F.CSHFG = function () {
  6432. //如果第三方应用1473,包含了好友窗体。
  6433. if ($("#U_MD_F_H_Z")[0]) {
  6434. var i,
  6435. _friendinfo,
  6436. _selectbottomel,
  6437. _childsel,
  6438. _chatform = U.selectEl("#U_MD_F_H_Z")[0], //好友窗体
  6439. _userinfoel = U.selectEl("#U_MD_F_H_ZLTI", _chatform)[0]; //多好友分栏
  6440. //初始化出现右边的好友聊天
  6441. U.MD.F.W.friendDisplayAndNone([{
  6442. "display": "none",
  6443. "left": "auto"
  6444. },
  6445. {
  6446. "display": "block",
  6447. "top": (US.height - 530) / 2,
  6448. "right": "0px"
  6449. }], true);
  6450. //添加当前使用用户的头像
  6451. U.selectEl($("img", _userinfoel)[0] || $$("img")).addAttrArray({
  6452. "onerror": U.MD.C.imgError,
  6453. "src": U.MD.C.getHeadImage(US.userInfo.UserThumbnailImageHead),
  6454. "onclick": U.MD.U.P.userDataSet
  6455. }).appendTo(_userinfoel);
  6456. if (US.friend.recentcontacts.length) {
  6457. _friendinfo = US.friend.recentcontacts;
  6458. }
  6459. else {
  6460. _friendinfo = US.friend.friends;
  6461. }
  6462. U.MD.F.printRightFormFriend(_friendinfo, U.selectEl("#U_MD_F_H_RC")[0]); //右侧好友最近联系人
  6463. U.MD.F.newFriendTips(); //初始化好友提示
  6464. //我的好友、我的群组等按钮,默认显示我的好友 所以找到我的好友的按钮,并且默认调用onclick
  6465. _selectbottomel = U.selectEl("#U_MD_F_H_ZLTA").Child()[0];
  6466. U.selectEl(_selectbottomel).Child()[0].onclick();
  6467. }
  6468. }
  6469. /**
  6470. * 初始化右边好友出现
  6471. *
  6472. * @param {object} 好友头像处理
  6473. * @param {element} 元素处理
  6474. */
  6475. U.MD.F.printRightFormFriend = function (friendinfo, el) {
  6476. var i,
  6477. _tempel,
  6478. _temponeel,
  6479. _frag = $$("frag"),
  6480. _childs = U.selectEl(el).Child();
  6481. //如果是用户登录多次,移除之前残留的信息
  6482. for (i = 1; i < _childs.length; i++) {
  6483. el.removeChild(_childs[i]);
  6484. }
  6485. //如果有好友资料输出
  6486. if (friendinfo.length) {
  6487. //循环打印好友资料
  6488. for (i = 0; (i < friendinfo.length && i < 11); i++) {
  6489. //群信息打印
  6490. if (friendinfo[i].tf == 1) {
  6491. friendinfo[i] = U.Json.select(US.friend.group, { "GroupManageID": friendinfo[i].UserId })[0];
  6492. _friendoneel = $$("div", { "className": "U_MD_F_H_ZLZOCOI", "style": { "margin": "9px 0 0 10px" }, "title": friendinfo[i].GroupManageName, "onclick": U.UF.C.closure(function (friendinfo) {
  6493. U.UF.EV.stopBubble();
  6494. U.MD.F.W.popupFriendsForm(friendinfo);
  6495. }, [friendinfo[i]])
  6496. }, _frag);
  6497. U.MD.F.printGroupHeadImage(friendinfo[i], _friendoneel, 4, [35, 35]);
  6498. }
  6499. //用户打印
  6500. else {
  6501. $$("img", {
  6502. "onerror": U.MD.C.imgError,
  6503. "title": friendinfo[i]["FriendsDescript"],
  6504. "className": "U_MD_F_H_RCI",
  6505. "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead),
  6506. "alt": friendinfo[i].FriendsDescript || friendinfo[i].UserNickName,
  6507. "onclick": U.UF.C.closure(function (friendinfo) {
  6508. U.UF.EV.stopBubble();
  6509. U.MD.F.W.popupFriendsForm(friendinfo);
  6510. U.MD.F.N.canelMarkMessage(friendinfo);
  6511. }, [friendinfo[i]])
  6512. }, _frag);
  6513. }
  6514. }
  6515. }
  6516. //暂无好友追随
  6517. else {
  6518. _tempel = $$("div", { "className": "U_MD_F_H_RCT" }, _frag);
  6519. _temponeel = $$("div", { "className": "U_MD_F_H_RCTS" }, _tempel);
  6520. $$("img", { "onerror": U.MD.C.imgError, "src": "/img/YSUN.png" }, _temponeel);
  6521. $$("div", { "className": "U_MD_F_H_RCTZ U_Img" }, _tempel);
  6522. $$("div", { "className": "U_MD_F_H_RCTX", "innerHTML": "暂时无追随" }, _tempel);
  6523. }
  6524. el.appendChild(_frag);
  6525. }
  6526. /**
  6527. * 用户提示区域
  6528. *
  6529. */
  6530. U.MD.F.newFriendTips = function () {
  6531. if (!$('.U_MD_D_NewsTipsIcon')[0]) {//判断图标是否已经存在
  6532. var _tipsicon = $$("div", { className: "U_MD_D_NewsTipsIcon" }, U.selectEl("#U_MD_F_H_R")[0]);
  6533. _tipsicon.onmousedown = function () { U.UF.F.drag(_tipsicon); };
  6534. }
  6535. }
  6536. /**
  6537. * 用户列表好友打印
  6538. *
  6539. * @param {element} 元素11
  6540. */
  6541. U.MD.F.printFriendGroupOrFriend = function (el) {
  6542. var i,
  6543. _tempel,
  6544. _temponeel,
  6545. _classinfo,
  6546. _friendinfo = US.friend.allclass,
  6547. _frag = $$("frag");
  6548. el.innerText = "";
  6549. //如果用户有好友则打印
  6550. if (US.friend.friends.length) {
  6551. //循环打印好友分组
  6552. for (i = 0; i < _friendinfo.length; i++) {
  6553. _classinfo = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo[i].FriendsGroupID }); //根据好友分组获取好友
  6554. //打印好友分组
  6555. _tempel = $$("div", { id: "g" + _friendinfo[i].FriendsGroupID, "tid": _friendinfo[i].FriendsGroupID, "className": "U_MD_F_H_ZLZO" }, _frag);
  6556. U_MD_F_H_ZLZOT_Img = '<div class="U_MD_F_H_ZLZOT_img"></div>';//插入分组前图标样式
  6557. $$("div", {
  6558. "className": "U_MD_F_H_ZLZOT",
  6559. "innerHTML": U_MD_F_H_ZLZOT_Img + _friendinfo[i].FriendsGroupName + "(" + _classinfo.length + ")",
  6560. "onclick": U.UF.C.closure(function (i) {
  6561. U.MD.F.openOrCloseFriendClass(this);
  6562. }, [i]),
  6563. "oncontextmenu": U.UF.C.closure(function (i) {
  6564. U.MD.F.R.friendClassRightClickMenu(US.friend.allclass[i], this);
  6565. }, [i])
  6566. }, _tempel);
  6567. _temponeel = $$("div", { "className": "U_MD_F_H_ZLZOC" }, _tempel);
  6568. //打印好友
  6569. U.MD.F.printFriendOrGroup(_temponeel, _classinfo);
  6570. }
  6571. }
  6572. //无好友打印提示
  6573. else {
  6574. U.MD.F.printHasNoFriend(_frag);
  6575. }
  6576. el.appendChild(_frag);
  6577. }
  6578. /**
  6579. * 好友和群样式输出
  6580. *
  6581. * @param {element} 元素
  6582. * @param {array} 好友数组
  6583. */
  6584. U.MD.F.printFriendOrGroup = function (el, friendorgroupinfo, isinsert) {
  6585. var i,
  6586. _isfront,
  6587. _friendel,
  6588. _friendoneel,
  6589. _friendtwoel,
  6590. _onlinefrag = $$("frag"),
  6591. _offlinefrag = $$("frag");
  6592. //循环所有的好友或者群,打印到左边好友或群面板中
  6593. if (friendorgroupinfo.length == 0) {
  6594. $$("div", { "class": "U_MD_F_H_ZLZOCO_under", "style": { "margin": "9px 0 0 10px" }, "innerHTML": "该分组暂无好友" }, el);
  6595. }
  6596. else {
  6597. for (i = 0; i < friendorgroupinfo.length; i++) {
  6598. if (friendorgroupinfo[i].tf == 1) {
  6599. friendorgroupinfo[i] = U.Json.select(US.friend.group, { "GroupManageID": friendorgroupinfo[i].UserId })[0]
  6600. }
  6601. _friendel = $$("div", {
  6602. "className": "U_MD_F_H_ZLZOCO",
  6603. "onclick": U.UF.C.closure(function (friendorgroupinfo) {
  6604. U.MD.F.N.canelMarkMessage(friendorgroupinfo);
  6605. U.MD.F.N.cancelNewsMessage(friendorgroupinfo); //点击删除新消息提示图标的提示
  6606. U.MD.F.W.popupFriendsForm(friendorgroupinfo, this);
  6607. }, [friendorgroupinfo[i]]),
  6608. "tid": friendorgroupinfo[i].GroupManageID || friendorgroupinfo[i].UserId,
  6609. "oncontextmenu": U.UF.C.closure(function (friendorgroupinfo) {
  6610. if (friendorgroupinfo.UserId) {
  6611. U.MD.F.R.friendsRightClickMenu(this, friendorgroupinfo);
  6612. U_MD_F_G_Group.style.display = "none";
  6613. }
  6614. else if (friendorgroupinfo.GroupManageID) {
  6615. U.MD.F.R.GroupRightClickMenu(this, friendorgroupinfo);
  6616. U_MD_F_G_Div.style.display = "none";
  6617. }
  6618. }, [friendorgroupinfo[i]])
  6619. });
  6620. _friendoneel = $$("div", { "className": "U_MD_F_H_ZLZOCOI" }, _friendel);
  6621. //如果是群的处理,群的头像输出
  6622. if (friendorgroupinfo[i].GroupManageID) {
  6623. U.MD.F.printGroupHeadImage(U.Json.select(US.friend.group, { "GroupManageID": friendorgroupinfo[i].GroupManageID || friendorgroupinfo[i].UserId })[0], _friendoneel, 4, [35, 35]);
  6624. }
  6625. //好友头像输出
  6626. else {
  6627. $$("img", { "onerror": U.MD.C.imgError, "title": "点击查看", "src": U.MD.C.getHeadImage(friendorgroupinfo[i].UserThumbnailImageHead) }, _friendoneel);
  6628. }
  6629. _friendtwoel = $$("div", { "className": "U_MD_F_H_ZLZOCOR U_MD_D_Text_Abbreviation" }, _friendel);
  6630. $$("div", { "className": "U_MD_F_H_ZLZOCORN U_MD_D_Text_Abbreviation", "innerHTML": friendorgroupinfo[i].FriendsDescript || friendorgroupinfo[i].UserNickName || friendorgroupinfo[i].GroupManageName }, _friendtwoel);
  6631. $$("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);
  6632. //如果用户在线那么插入到最前面
  6633. if (friendorgroupinfo[i].IsLogin == 1) {
  6634. _onlinefrag.appendChild(_friendel);
  6635. }
  6636. //否则插入到后面
  6637. else {
  6638. _offlinefrag.appendChild(_friendel);
  6639. }
  6640. }
  6641. el.insertBefore(_onlinefrag, el.firstChild); //在线用户插入到最前面
  6642. //如果需要插入到最前面,那么则不管在不在线的用户都插入到最前面
  6643. if (isinsert) {
  6644. el.insertBefore(_offlinefrag, el.firstChild); //用户插入到最前面
  6645. }
  6646. else {
  6647. el.appendChild(_offlinefrag); //非在线用户插入到最后米娜
  6648. }
  6649. }
  6650. }
  6651. /**
  6652. * 打开分组展开好友
  6653. *
  6654. * @param {element} 展开好友的区域
  6655. */
  6656. U.MD.F.openOrCloseFriendClass = function (el) {
  6657. var _firendel = U.selectEl($(el).Parent()).Child()[1]; //获取好友分组对应的好友元素
  6658. //如果现在隐藏了则打开
  6659. if (_firendel.style.display == "none") {
  6660. 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)";
  6661. _firendel.style.display = "block";
  6662. }
  6663. //如果是显示则隐藏
  6664. else {
  6665. 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)";
  6666. _firendel.style.display = "none";
  6667. }
  6668. }
  6669. /**
  6670. * 打印空好友
  6671. *
  6672. * @param {element} 打印的区域
  6673. */
  6674. U.MD.F.printHasNoFriend = function (el) {
  6675. var _tempel,
  6676. _temponeel
  6677. ;
  6678. _tempel = $$("div", { "className": "U_MD_F_H_ZLZT" }, el);
  6679. _temponeel = $$("div", { "className": "U_MD_F_H_ZLZTS" }, _tempel);
  6680. $$("img", { "onerror": U.MD.C.imgError, "src": "/img/YSUN.png" }, _temponeel);
  6681. $$("div", { "className": "U_MD_F_H_ZLZTZ U_Img" }, _tempel);
  6682. $$("div", { "className": "U_MD_F_H_ZLZTX", "innerHTML": "暂时没有添加追随!!" }, _tempel);
  6683. }
  6684. //#endregion
  6685. //#region 好友功能
  6686. /**
  6687. * 打印空好友
  6688. *
  6689. * @param {string} 切换类型
  6690. * @param {element} 点钱点击的区域
  6691. * @param {element} 变化的样式
  6692. */
  6693. U.MD.F.switchFriendOrGroup = function (typename, el, classname) {
  6694. var i,
  6695. _chatform = U.selectEl("#U_MD_F_H_ZLZ")[0], //打印内容区域
  6696. _childsel = U.selectEl(el).parentElement(2).Child(), //所有参与切换的元素
  6697. _classarray = ["U_MD_F_H_ZLTT", "U_MD_F_H_ZLTO", "U_MD_F_H_ZLTS", "U_MD_F_H_ZLTF"]; //切换样式数组
  6698. //切换按钮的样式,把样式改成用户默认按钮的样式
  6699. for (i = 0; i < _childsel.length; i++) {
  6700. U.selectEl(_childsel[i]).Child()[0].className = _classarray[i] + " U_Img U_MD_F_H_ZLTOK";
  6701. }
  6702. //设置选中的按钮样式
  6703. el.className = classname + " U_Img U_MD_F_H_ZLTOK";
  6704. //点击好友添加按钮
  6705. if (typename == "A") {
  6706. U.MD.F.M.createFriendGroupPopup(); //调用创建群弹框
  6707. }
  6708. else {
  6709. //群成员
  6710. if (typename == "H") {
  6711. var _grouparr = US.friend.group; //获取用户或有群信息
  6712. _chatform.innerText = ""; //清空展示区域的内容
  6713. U.MD.F.printFriendOrGroup(_chatform, _grouparr); //打印
  6714. }
  6715. //最近联系人
  6716. else if (typename == "G") {
  6717. var _recentcontacts = US.friend.recentcontacts;
  6718. _chatform.innerText = ""; //清空展示区域的内容
  6719. U.MD.F.printFriendOrGroup(_chatform, _recentcontacts); //打印
  6720. }
  6721. //打印好友,由于好友有好友分组,所以不能直接调用U.MD.F.printFriendOrGroup输出
  6722. else {
  6723. U.MD.F.printFriendGroupOrFriend(_chatform); //打印
  6724. }
  6725. }
  6726. }
  6727. /**
  6728. * 获取群里头像集
  6729. *
  6730. * @param {object} 群信息
  6731. * @param {element} 添加指定的元素
  6732. * @param {element} 变化的样式
  6733. * @param {element} 最大长度
  6734. */
  6735. U.MD.F.printGroupHeadImage = function (groupinfo, el, num, size) {
  6736. var i, j,
  6737. _groupnameel,
  6738. _horizontal,
  6739. _vertical,
  6740. _imageel,
  6741. _groupuserinfo = U.Json.select(US.friend.groupusers, { "GroupManageID": groupinfo.GroupManageID }, (num || 9)); //获取当前群
  6742. if (_groupuserinfo.length < 3) {
  6743. _horizontal = _groupuserinfo.length;
  6744. }
  6745. else {
  6746. if (_groupuserinfo.length > 6) {
  6747. _horizontal = 3;
  6748. } else {
  6749. _horizontal = 2;
  6750. }
  6751. }
  6752. //每排几个
  6753. if (_groupuserinfo.length > 4) {
  6754. _vertical = 3
  6755. }
  6756. else {
  6757. if (_groupuserinfo.length > 1) {
  6758. _vertical = 2
  6759. } else {
  6760. _vertical = 1
  6761. }
  6762. } //一共多少行
  6763. size = size || [el.offsetHeight || 40, el.offsetWidth || 40]; //最大长宽
  6764. _groupnameel = $$("div", { "className": "U_MD_HomeSSZFZAIO", "title": groupinfo.GroupManageName }); //群名
  6765. //打印所有群成员头像 横排打印
  6766. for (i = 0; i < _horizontal; i++) {
  6767. _imageel = $$("div", { "style": { "width": "100%", "height": Math.floor(size[0] / _horizontal) + "px"} }, _groupnameel);
  6768. //竖排打印
  6769. for (j = i * _vertical; j < i * _vertical + _vertical && j < _groupuserinfo.length; j++) {
  6770. $$("img",
  6771. {
  6772. "onerror": U.MD.C.imgError,
  6773. "src": U.MD.C.getHeadImage(_groupuserinfo[j].UserThumbnailImageHead),
  6774. "style":
  6775. {
  6776. "width": Math.floor(size[1] / _vertical) + "px",
  6777. "height": Math.floor(size[0] / _vertical) + "px"
  6778. }
  6779. }, _imageel);
  6780. }
  6781. };
  6782. //追加
  6783. el.appendChild(_groupnameel);
  6784. }
  6785. //#endregion
  6786. ;
  6787. ///<jscompress sourcefile="FriendData.js" />
  6788. /*
  6789. 此处为数据对应库
  6790. US.friend 集合,里面包含了好友分组,好友,群,群成员,最近联系人。
  6791. US.friend.allclass 数组 是所有的好友分组,结构参见好友分组实体U.MD.F.T.friendGroupEntity
  6792. US.friend.friends 数组 是所有的好友,结构参见好友实体U.MD.F.T.friendEntity
  6793. US.friend.group 数组 是所有的群,结构参见群实体U.MD.F.T.groupEntity
  6794. US.friend.groupusers 数组 是所有的群好友,结构参见群成员实体U.MD.F.T.groupUserEntity
  6795. US.friend.recentcontacts 数组 是所有的在线好友,结构为U.MD.F.T.recentContactsEntity
  6796. 从数据库中取出的数据都要放到此全局变量中,当新建好友,新建分组等时,需要用下面的结构生成新的实体。
  6797. */
  6798. Namespace.register("U.MD.F.T"); //好友数据源操作命名空间
  6799. /**
  6800. * 好友实体
  6801. *
  6802. * @param {array} 好友信息
  6803. ----------[0] 好友签名
  6804. ----------[1] 好友用户id
  6805. ----------[2] 好友原图
  6806. ----------[3] 好友小图
  6807. ----------[4] 好友别名
  6808. ----------[5] 好友用户名
  6809. ----------[6] 好友id
  6810. ----------[7] 好友备注
  6811. ----------[8] 好友分组id
  6812. ----------[9] 是否在线
  6813. */
  6814. U.MD.F.T.friendEntity = function (signature, userid, userimagehead, thumbnailheadimage, nickname, name, friendid, descript, groupid, islogin) {
  6815. this.UserIndividualitysignature = signature;
  6816. this.UserId = userid;
  6817. this.UserImageHead = userimagehead;
  6818. this.UserThumbnailImageHead = thumbnailheadimage;
  6819. this.UserNickName = nickname;
  6820. this.UserName = name;
  6821. this.FriendsID = friendid;
  6822. this.FriendsDescript = descript;
  6823. this.FriendsGroupID = groupid;
  6824. this.IsLogin = islogin;
  6825. }
  6826. /**
  6827. * 最近联系人
  6828. *
  6829. * @param {array} 在线好友信息
  6830. ----------[0] 好友用户id
  6831. ----------[1] 好友用户名
  6832. ----------[2] 好友大图
  6833. ----------[3] 好友昵称
  6834. ----------[4] 好友小图
  6835. ----------[5] 最后聊天时间
  6836. ----------[6] 好友备注
  6837. ----------[7] 好友签名
  6838. ----------[8] 是否在线
  6839. */
  6840. U.MD.F.T.recentContactsEntity = function (userid, username, userimagehead, usernickname, userthumbnailimagehead, sendtime, descript, signature, islogin) {
  6841. this.UserId = userid;
  6842. this.UserName = username;
  6843. this.UserImageHead = userimagehead;
  6844. this.UserNickName = usernickname;
  6845. this.UserThumbnailImageHead = userthumbnailimagehead;
  6846. this.maxMessageSendTime = sendtime;
  6847. this.FriendsDescript = descript;
  6848. this.UserIndividualitysignature = signature;
  6849. this.IsLogin = islogin;
  6850. }
  6851. /**
  6852. * 好友分组实体
  6853. *
  6854. * @param {array} 好友分组信息
  6855. ----------[0] 分组描述
  6856. ----------[1] 分组分组id
  6857. ----------[2] 分组名
  6858. */
  6859. U.MD.F.T.friendGroupEntity = function (groupid, groupname, descript) {
  6860. this.FriendsGroupID = groupid;
  6861. this.FriendsGroupName = groupname;
  6862. this.FriendsGroupDescript = descript;
  6863. }
  6864. /**
  6865. * 群实体
  6866. *
  6867. * @param {array} 群信息
  6868. ----------[0] 群id
  6869. ----------[1] 群名
  6870. ----------[2] 群创建时间
  6871. ----------[3] 群创建用户id
  6872. ----------[4] 群管理用户id
  6873. ----------[5] 群描述
  6874. ----------[6] 群备注
  6875. */
  6876. U.MD.F.T.groupEntity = function (groupid, name, date, userid, descript, remark) {
  6877. this.GroupManageID = groupid;
  6878. this.GroupManageName = name;
  6879. this.GroupManageCreateDate = date;
  6880. this.GroupManageCreateUserID = userid;
  6881. this.GroupManageUserID = userid;
  6882. this.GroupManageDescript = descript;
  6883. this.GroupManageRemark = remark;
  6884. }
  6885. /**
  6886. * 群成员实体
  6887. *
  6888. * @param {array} 群信息
  6889. ----------[0] 群用户id
  6890. ----------[1] 群用户头像
  6891. ----------[2] 群用户昵称
  6892. ----------[3] 群用户名
  6893. ----------[4] 群用户小图
  6894. ----------[5] 群用户描述
  6895. ----------[6] 群id
  6896. ----------[6] 群用户登录信息
  6897. */
  6898. U.MD.F.T.groupUserEntity = function (userid, userimagehead, nickname, name, thumbnailimagehead, descript, groupid, islogin) {
  6899. this.UserId = userid;
  6900. this.UserImageHead = userimagehead;
  6901. this.UserNickName = nickname;
  6902. this.UserName = name;
  6903. this.UserThumbnailImageHead = thumbnailimagehead;
  6904. this.GroupUsersDescript = descript;
  6905. this.GroupManageID = groupid;
  6906. this.IsLogin = islogin;
  6907. }
  6908. /**
  6909. * 循环所有好友,让在线用户都置顶在最上面。
  6910. *
  6911. */
  6912. U.MD.F.T.initFriendInfo = function () {
  6913. var i,
  6914. j,
  6915. _arr = ["friends", "groupusers", "recentcontacts"],
  6916. _userinfo;
  6917. //循环US.friend变量,修改里面的好友、群好友、在线联系人的信息为默认信息,同事设置用户是否在线
  6918. for (i = 0; i < _arr.length; i++) {
  6919. //0 好友分组 1好友信息 2群分组 3群用户 4最近联系人 5在线好友 这里只修改有用户信息的 所以修改为1、3、4
  6920. // if (i == 1 && i == 3 && i == 4) {
  6921. for (j = 0; j < US.friend[_arr[i]].length; j++) {
  6922. _userinfo = US.friend[_arr[i]][j];
  6923. //判断用户是否在线,如果在线设置在线属性为在线
  6924. if (US.friend.onlinefirendinfo.indexOf(_userinfo.UserId) > -1) {
  6925. _userinfo.IsLogin = 1; //设置在线
  6926. }
  6927. //如果是好友信息的修改,由于从数据库里面选出来的数据有null值,所以这里把null过滤了
  6928. if (i != 1) {
  6929. U.Json.Change(_userinfo, {
  6930. "UserIndividualitysignature": _userinfo["UserIndividualitysignature"] || "",
  6931. "UserNickName": _userinfo.UserName,
  6932. "FriendsDescript": _userinfo["FriendsDescript"] || _userinfo.UserName
  6933. });
  6934. }
  6935. //如果是群好友信息的修改,由于从数据库里面选出来的数据有null值,所以这里把null过滤了
  6936. else {
  6937. U.Json.Change(_userinfo, {
  6938. "UserNickName": _userinfo.UserName,
  6939. "GroupUsersDescript": _UFE[j]["GroupUsersDescript"] || _userinfo.UserName
  6940. });
  6941. }
  6942. }
  6943. //除了最近联系人以外,其他的都要重新排序
  6944. if (i != "recentcontacts") {
  6945. U.Json.Reset(US.friend[_arr[i]], "IsLogin", 1); //设置完在线后,把在线用户发在最前面,这里是根据IsLogin = 1的排序
  6946. }
  6947. }
  6948. // }
  6949. }
  6950. ;
  6951. ///<jscompress sourcefile="FriendSearch.js" />
  6952. Namespace.register("U.MD.F.S");
  6953. U.MD.F.S.SearchPostion; //搜索的时候判断位置
  6954. //#region 本地好友搜索处理
  6955. /**
  6956. * 搜索好友
  6957. *
  6958. * @param {object} 用户信息
  6959. * @param {element} 打印显示的元素
  6960. * @param {object} 回调函数
  6961. * @param {object} 搜索的类型
  6962. * F 好友
  6963. * G 群
  6964. * "" 好友和群
  6965. */
  6966. U.MD.F.S.searchFriendsOrGroupForm = function (inputs, el, cb, typename) {
  6967. var _searchfriendinfo = [], //搜索好友的数组
  6968. _searchvalue = inputs.value, //获取搜索的内容
  6969. _isserch = U.MD.F.S.searchFriendsKeyboardHandle(el, inputs) //是否允许搜索
  6970. ;
  6971. //判断用户键盘输入的内容,是否需要进行搜索
  6972. if (_isserch) {
  6973. //获取搜索好友的值
  6974. if (!typename || typename == "F") {
  6975. _searchfriendinfo = _searchfriendinfo.concat(U.Json.like(US.friend.friends, { "FriendsDescript": _searchvalue, "UserNickName": _searchvalue, "UserName": _searchvalue })); //获取用户好友
  6976. }
  6977. //获取搜索群的值
  6978. if (!typename || typename == "G") {
  6979. _searchfriendinfo = _searchfriendinfo.concat(U.Json.like(US.friend.group, { "GroupManageName": _searchvalue })); //获取好友群
  6980. }
  6981. //显示清空
  6982. el.style.display = "block";
  6983. el.innerText = "";
  6984. //搜索好友的打印
  6985. U.MD.F.S.printSearchFriends(_searchfriendinfo, el, cb);
  6986. };
  6987. }
  6988. /**
  6989. * 搜索键盘的处理
  6990. *
  6991. * @param {object} 用户信息
  6992. */
  6993. U.MD.F.S.searchFriendsKeyboardHandle = function (el, inputs) {
  6994. var _keycode;
  6995. //获取键盘的值
  6996. if (event) {
  6997. _keycode = event.keyCode
  6998. }
  6999. else {
  7000. _keycode = 0
  7001. }
  7002. _childs = U.selectEl(el).Child(), //搜索的内容子元素
  7003. _searchvalue = inputs.value, //搜索的值
  7004. _position = U.MD.F.S.SearchPostion, //搜索的位置
  7005. _searchel = _childs[_position] //搜索得到的元素
  7006. ;
  7007. //判断搜索的值是否存在,不存在则隐藏
  7008. if (_searchvalue == "" || _searchvalue == inputs.defaultValue) {
  7009. el.style.display = "none";
  7010. }
  7011. //如果搜索的内容存在,同时用户执行了回车处理
  7012. else if (_position > -1 && _keycode == 13 || _keycode == 10 && _childs[_position].onmousedown) {
  7013. _childs[_position].onclick();
  7014. }
  7015. //如果不是上下键,那么允许用户继续搜索
  7016. else if (_keycode != 38 && _keycode != 40) {
  7017. U.MD.F.S.SearchPostion = -1; //搜索选择的位置设置为-1
  7018. return true;
  7019. }
  7020. return false;
  7021. }
  7022. /**
  7023. * 打印搜索好友
  7024. *
  7025. * @param {object} 用户信息
  7026. */
  7027. U.MD.F.S.printSearchFriends = function (friendinfo, el, cb) {
  7028. var i,
  7029. _name,
  7030. _tempel,
  7031. _temponeel,
  7032. _temptwoel,
  7033. _frag = $$("frag"),
  7034. _childs = U.selectEl(el).Child();
  7035. //没有搜索到好友的提示
  7036. if (!friendinfo[0]) {
  7037. $$("div", { "className": "U_MD_F_S_Local_NoData", "innerText": "很抱歉,没有找到您搜索的好友" }, el);
  7038. }
  7039. else {
  7040. //循环打印搜索的好友
  7041. for (i = 0; i < friendinfo.length; i++) {
  7042. (function (i) {
  7043. //搜索的名字
  7044. _name = friendinfo[i].GroupManageName || friendinfo[i].FriendsDescript || friendinfo[i].UserNickName || friendinfo[i].UserName;
  7045. //打印的样式
  7046. _tempel = $$("div", {
  7047. "title": "点击查看",
  7048. "className": "U_MD_F_S_Local_Result",
  7049. // "onclick": function () {
  7050. // U.MD.F.S.switchSearchFriendsOrGroup(el, i);
  7051. // },
  7052. "onclick": function () {
  7053. U.MD.F.W.popupFriendsForm(friendinfo[i]);
  7054. U.MD.F.S.hideSearchFriendsOrGroupForm(el);
  7055. }
  7056. }, _frag);
  7057. _temptwoel = $$("div", { "className": "U_MD_F_H_ZLZOCOI", "title": _name }, _tempel);
  7058. if (friendinfo[i].GroupManageID) {
  7059. U.MD.F.printGroupHeadImage(friendinfo[i], _temptwoel, 4, [35, 35]);
  7060. }
  7061. else {
  7062. $$("img", { "onerror": U.MD.C.imgError, "className": "U_MD_HomeSSZJDAO", "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead) }, _temptwoel);
  7063. }
  7064. $$("span", { "className": "U_MD_F_S_Local_UserName", "innerHTML": _name }, _tempel);
  7065. })(i);
  7066. }
  7067. el.appendChild(_frag);
  7068. }
  7069. U.MD.F.S.SearchPostion = -1; //搜索选择的位置设置为-1
  7070. return _childs;
  7071. }
  7072. /**
  7073. * 上下切换搜索的好友或者群
  7074. *
  7075. * @param {element} 切换元素
  7076. * @param {number} 当前所在的位置
  7077. */
  7078. U.MD.F.S.switchSearchFriendsOrGroup = function (el, switchposition) {
  7079. var _switchel,
  7080. _top,
  7081. _scrolltop,
  7082. _isswitch = null,
  7083. _keycode = event.keyCode, //键盘码
  7084. _childs = U.selectEl(el).Child(), //获取所有搜索的值
  7085. _postion = U.MD.F.S.SearchPostion, //当前选择好友或者去的位置
  7086. _index = switchposition || U.MD.F.S.SearchPostion,
  7087. _nowswitchel = _index > -1 ? _childs[switchposition || U.MD.F.S.SearchPostion] : null //之前聚焦显示的元素
  7088. ;
  7089. if (_keycode == 38) {
  7090. _isswitch = -1
  7091. }
  7092. else if (_keycode == 40) {
  7093. _isswitch = 1
  7094. }
  7095. //判断是否需要重新选择
  7096. if (_isswitch || (switchposition != null && switchposition != _postion)) {
  7097. //如果需要指定切换到那个位置
  7098. if (switchposition != null) {
  7099. U.MD.F.S.SearchPostion = switchposition;
  7100. }
  7101. //上下切换的处理
  7102. else {
  7103. U.MD.F.S.SearchPostion += _isswitch; //加上上下的处理 如果键盘向上则-1 向下+1
  7104. }
  7105. //如果位置大于最后一个,则位置设置为最后一个
  7106. if (U.MD.F.S.SearchPostion > _childs.length - 1) {
  7107. U.MD.F.S.SearchPostion = 0; //设置位置
  7108. }
  7109. else if (U.MD.F.S.SearchPostion < 0) {
  7110. U.MD.F.S.SearchPostion = _childs.length - 1;
  7111. }
  7112. switchposition = U.MD.F.S.SearchPostion;
  7113. _switchel = _childs[switchposition]; //判断选择好友或者群有没有元素
  7114. //选择的位置
  7115. if (_switchel) {
  7116. U.selectEl('.U_MD_F_S_Local_Result_Hover').removeClass('U_MD_F_S_Local_Result_Hover')
  7117. _switchel.className = "U_MD_F_S_Local_Result U_MD_F_S_Local_Result_Hover"; //取消上一个
  7118. //下面计算需要显示的元素是否在滚动条可见范围,如果不在,那么滚动滚动条设置
  7119. _top = _switchel.offsetTop;
  7120. _scrolltop = el.scrollTop;
  7121. if (_top > el.offsetHeight + _scrolltop - 40) {
  7122. el.scrollTop = _top - el.offsetHeight;
  7123. }
  7124. if (_top < el.scrollTop) {
  7125. el.scrollTop = _top; //滚动条的位置
  7126. }
  7127. }
  7128. }
  7129. }
  7130. /**
  7131. * 隐藏
  7132. *
  7133. * @param {element} 切换元素
  7134. */
  7135. U.MD.F.S.hideSearchFriendsOrGroupForm = function (el) {
  7136. el.style.display = "none";
  7137. U.selectEl(el).prev().Child()[0].value = "联系人、好友讨论组";
  7138. }
  7139. //#endregion
  7140. //#region 窗体搜索
  7141. /**
  7142. * 弹出群搜索
  7143. *
  7144. */
  7145. U.MD.F.S.popupsSearchGroups = function () {
  7146. //弹出群搜索的窗体
  7147. 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>',
  7148. "<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"} });
  7149. var _formel = _form.form; //获取整个窗体
  7150. U.selectEl(_formel).find("input")[0].focus(); //窗体头部的输入框聚焦
  7151. U.selectEl('#U_MD_F_S_TDR_GF')[0].onclick = function () {
  7152. U.MD.F.S.searchAjax(1, 1, _formel.children[2].children[0], U.selectEl('#U_MD_F_S_GF_Search')[0])
  7153. }
  7154. U.MD.F.S.searchGroupsFormSize(_formel); //窗体的大小设置
  7155. U.MD.F.S.searchAjax($(_form.middle).Child()[1], 1, _formel.children[2].children[0], U.selectEl('#U_MD_F_S_GF_Search')[0]); //初始化数据
  7156. return _formel;
  7157. }
  7158. /**
  7159. * 弹出Ftp搜索
  7160. *
  7161. */
  7162. U.MD.F.S.popupsSearchFtp = function () {
  7163. 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>',
  7164. "<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"} });
  7165. var _formel = _form.form; //获取整个窗体
  7166. U.selectEl('#U_MD_F_S_TDR')[0].onclick = function () {
  7167. 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])
  7168. }
  7169. U.selectEl(_formel).find("input")[0].focus(); //窗体头部的输入框聚焦
  7170. U.MD.F.S.searchGroupsFormSize(_formel); //窗体的大小设置
  7171. U.MD.F.S.searchAjax($(_form.middle).Child()[1], 0, _formel.children[2].children[0], U.selectEl('#U_MD_F_S_FTP_Search')[0]); //初始化数据
  7172. return _formel;
  7173. }
  7174. /**
  7175. * 搜索内容大小变化
  7176. *
  7177. */
  7178. U.MD.F.S.searchGroupsFormSize = function (contentel) {
  7179. var _parentel = U.selectEl(contentel).Parent(3);
  7180. contentel.style.width = Math.floor(_parentel.offsetWidth / 225) * 225 + "px";
  7181. U.selectEl(contentel).Parent().style.height = _parentel.offsetHeight - 125 + "px";
  7182. }
  7183. /**
  7184. * 搜索开始
  7185. *
  7186. */
  7187. U.MD.F.S.searchAjax = function (page, isgroupserch, contentel, inputel) {
  7188. var _searchvalue = inputel.value == inputel.defaultValue ? "" : inputel.value;
  7189. //判断是否
  7190. if (_searchvalue != "") {
  7191. U.MD.F.S.searchGroupOrFriend(page, isgroupserch, contentel, inputel);
  7192. }
  7193. //热门查看
  7194. else {
  7195. U.MD.F.S.getHotFriendOrGroup(1, isgroupserch, contentel);
  7196. }
  7197. }
  7198. /**
  7199. * 搜索开始
  7200. *
  7201. */
  7202. U.MD.F.S.searchGroupOrFriend = function (page, isgroupserch, contentel, inputel) {
  7203. var _searchvalue = inputel.value == inputel.defaultValue ? "" : inputel.value, //输入的内容
  7204. _end = page * 80, //结束的位置
  7205. _start = _end - 79, //开始的位置
  7206. _loadingel = page > 1 ? U.selectEl(contentel).parentElement(2).Child()[2] : U.selectEl(contentel).parentElement()[0]
  7207. ;
  7208. //群搜索的ajax处理
  7209. if (isgroupserch) {
  7210. //后台搜索群
  7211. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchGroupInfo", _searchvalue, _start, _end],
  7212. U.MD.F.S.ajaxSearchAjax, [_loadingel, page, _searchvalue, contentel, isgroupserch]);
  7213. }
  7214. //ftp搜索的ajax处理
  7215. else {
  7216. //后台搜索好友的ftp
  7217. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SearchFriendInfo", US.userInfo.UserId || US.EMPTYGUID, _searchvalue, _start, _end],
  7218. U.MD.F.S.ajaxSearchAjax, [_loadingel, page, _searchvalue, contentel, isgroupserch]);
  7219. }
  7220. //滚动加载设置
  7221. U.UF.EV.scrollLoad($(contentel).Parent(), function () {
  7222. U.MD.F.S.searchAjax(page + 1, isgroupserch, contentel, inputel);
  7223. });
  7224. }
  7225. /**
  7226. * 获取热门的群或者好友
  7227. *
  7228. */
  7229. U.MD.F.S.getHotFriendOrGroup = function (page, isgroup, el) {
  7230. var i,
  7231. _loadingel = page > 1 ? U.selectEl(el).parentElement(2).Child()[2] : U.selectEl(el).parentElement()[0],
  7232. _end = page * 80,
  7233. _start = _end - 79
  7234. ;
  7235. //滚动加载设置
  7236. if (page == 1) {
  7237. //设置滚动加载函数
  7238. U.UF.EV.scrollLoad($(el).Parent(), function () {
  7239. U.MD.F.S.getHotFriendOrGroup(page + 1, isgroup, el); //加载热门好友和群
  7240. });
  7241. }
  7242. //群的加载处理
  7243. if (isgroup) {
  7244. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "RecommendGroups", _start, _end],
  7245. U.MD.F.S.asynGetHotFriendOrGroup, [_loadingel, el, isgroup]);
  7246. }
  7247. //好友ftp加载处理
  7248. else {
  7249. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFtpHotUser", _start, _end],
  7250. U.MD.F.S.asynGetHotFriendOrGroup, [_loadingel, el, isgroup]);
  7251. }
  7252. }
  7253. /**
  7254. * 热门群或者好友获取异步
  7255. *
  7256. */
  7257. U.MD.F.S.asynGetHotFriendOrGroup = function (r) {
  7258. var _context = r.context,
  7259. _el = _context[1], //打印区域的元素
  7260. _isgroup = _context[2]; //是否是群的处理
  7261. r = r.value;
  7262. //打印内容
  7263. U.MD.F.S.printSearchContent(r, _el, _isgroup);
  7264. //如果搜索的内容已经不足的时候,那么就取消滚动加载函数
  7265. if (r.length < 80) {
  7266. U.selectEl(_el).Parent().onscroll = null;
  7267. }
  7268. }
  7269. /**
  7270. * 搜索异步
  7271. *
  7272. */
  7273. U.MD.F.S.ajaxSearchAjax = function (r) {
  7274. //参数处理
  7275. var _context = r.context,
  7276. _page = _context[1], //页码
  7277. _searchvalue = _context[2], //搜索内容
  7278. _el = _context[3],
  7279. _isgroup = _context[4]; //是否是群搜索
  7280. r = r.value;
  7281. //如果是第一页
  7282. if (_page == 1) {
  7283. _el.innerHTML = ""; //清空之前的数据
  7284. //如果获取的值不存在,那么就直接打印搜索是否为空
  7285. if (!r || !r.length) {
  7286. U.MD.F.S.printNullSearch(_el); //打印空搜索
  7287. }
  7288. }
  7289. //如果搜索有内容,那么打印内容
  7290. if (r && r.length) {
  7291. U.MD.F.S.printSearchContent(r, _el, _isgroup); //打印搜索营部
  7292. }
  7293. }
  7294. /**
  7295. * 打印搜索内容
  7296. *
  7297. */
  7298. U.MD.F.S.printSearchContent = function (friendsinfo, el, isgroup) {
  7299. var i, _el, _tempel, _tempela, _tempelb, _tempelc, _arr,
  7300. _userid = US.userInfo.UserId || "",
  7301. _frag = $$("frag");
  7302. if (isgroup) {
  7303. _arr = ["GroupManageName", "+加群"];
  7304. }
  7305. else {
  7306. _arr = ["UserNickName", "+好友"];
  7307. }
  7308. //循环打印好友数据
  7309. for (i = 0; i < friendsinfo.length; i++) {
  7310. _el = $$("div", { "className": "U_MD_F_S_Pop_Content_G U_MD_D_Radius_5",
  7311. "onclick": U.UF.C.closure(function (friendinfo) {
  7312. if (isgroup) {
  7313. }
  7314. else {
  7315. U.MD.D.I.openApplication("disk", { "userid": friendinfo.UserId, "directoryid": US.FTPFOLDERID });
  7316. }
  7317. }, [friendsinfo[i]])
  7318. }, _frag);
  7319. _tempel = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T" }, _el);
  7320. _tempela = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_L" }, _tempel);
  7321. $$("img", { "onerror": U.MD.C.imgError,
  7322. "onerror": U.MD.C.imgError,
  7323. "src": isgroup ? "" : U.MD.C.getHeadImage(friendsinfo[i]["UserThumbnailImageHead"]),
  7324. "title": friendsinfo[i][_arr[0]],
  7325. "onclick": U.UF.C.closure(function (friendinfo) {
  7326. U.UF.EV.stopBubble();
  7327. //群处理
  7328. if (isgroup) {
  7329. }
  7330. //好友处理
  7331. else {
  7332. U.MD.U.V.ViewOtherUserInfo(friendinfo.UserId);
  7333. }
  7334. }, [friendsinfo[i]])
  7335. }, _tempela);
  7336. _tempelb = $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R" }, _tempel);
  7337. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_T U_MD_D_Text_Abbreviation", "innerHTML": friendsinfo[i][_arr[0]] }, _tempelb);
  7338. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_C U_MD_D_Text_Abbreviation", "innerHTML": (isgroup ? "目前人数:" : "目前好友:") + (friendsinfo[i].FCount || 0) }, _tempelb);
  7339. $$("div", { "className": "U_MD_F_S_Pop_Content_G_T_R_B U_MD_D_Text_Abbreviation", "innerHTML": "ftp文件:" + (friendsinfo[i].DCount || 0) }, _tempelb);
  7340. _tempelc = $$("div", { "className": "U_MD_F_S_Pop_Content_G_B" }, _el);
  7341. $$("div", { "className": "U_MD_F_S_Pop_Content_G_B_A U_MD_D_Radius_5", "innerHTML": _arr[1],
  7342. "onclick": U.UF.C.closure(function (friendinfo) {
  7343. U.UF.EV.stopBubble();
  7344. //群的处理
  7345. if (isgroup) { U.MD.F.J.addUsersToGroup(friendinfo); }
  7346. //好友的处理
  7347. else { U.MD.F.M.addFriend(friendinfo); }
  7348. }, [friendsinfo[i]])
  7349. }, _tempelc);
  7350. }
  7351. el.appendChild(_frag);
  7352. }
  7353. /**
  7354. * 空查询
  7355. *
  7356. */
  7357. U.MD.F.S.printNullSearch = function (el) {
  7358. $$("div", { "className": "U_MD_F_S_CXT", "innerHTML": "暂无搜索消息, 请稍候搜索。" }, el);
  7359. }
  7360. //#endregion
  7361. //#region 新搜索
  7362. /**
  7363. * 搜索好友
  7364. *
  7365. * @param {object} 用户信息
  7366. * @param {element} 打印显示的元素
  7367. * @param {object} 回调函数
  7368. * @param {object} 搜索的类型
  7369. * @param {number} defaultindex 0好友 1群组 2ftp
  7370. */
  7371. U.MD.F.S.popSearchFriendsOrGroupForm = function (defaultindex) {
  7372. var _searchel = U.selectEl("#U_MD_F_S_Pop")[0],
  7373. _contentel = U.selectEl($(_searchel).Child()[1]).Child()[0],
  7374. _inputel = U.selectEl("input", _searchel)[0]
  7375. ;
  7376. _searchel.style.display = "block";
  7377. //弹出群搜索的窗体
  7378. var _form = new U.UF.UI.form("查找好友/群",
  7379. _searchel,
  7380. {
  7381. "onresize": function () { U.MD.F.S.searchGroupsFormSize(_contentel); },
  7382. "id": "U_MD_F_S",
  7383. "style": {
  7384. "width": "70%",
  7385. "height": "70%"
  7386. }
  7387. }, null);
  7388. var _formel = _form.form; //获取整个窗体
  7389. _inputel.focus(); //窗体头部的输入框聚焦
  7390. U.MD.F.S.searchGroupsFormSize(_contentel); //窗体的大小设置
  7391. U.MD.F.S.searchFriendsOrGroupFormClick($("span", _searchel)[defaultindex]); //默认选择查找用户
  7392. return _formel;
  7393. }
  7394. /**
  7395. * 搜索好友
  7396. *
  7397. * @param {object} 用户信息
  7398. */
  7399. U.MD.F.S.clickSearch = function (el) {
  7400. var i,
  7401. _changeel,
  7402. _topel = U.selectEl(el).Parent(2),
  7403. _childel = U.selectEl($(_topel).Child()[0]).Child();
  7404. ;
  7405. for (i = 0; i < _childel.length; i++) {
  7406. _changeel = U.selectEl(_childel[i]).Child()[0];
  7407. if (_changeel.className == "U_MD_F_S_Pop_Head_Nav_fonto") {
  7408. U.MD.F.S.searchFriendsOrGroupFormClick(_changeel);
  7409. return;
  7410. }
  7411. }
  7412. }
  7413. /**
  7414. * 搜索好友
  7415. *
  7416. * @param {object} 用户信息
  7417. */
  7418. U.MD.F.S.searchFriendsOrGroupFormClick = function (el) {
  7419. var i, j,
  7420. _changeel,
  7421. _parentel = U.selectEl(el).Parent(2),
  7422. _childel = U.selectEl(_parentel).Child(),
  7423. _topel = U.selectEl(_parentel).Parent(2),
  7424. _contentel = U.selectEl($(_topel).Child()[1]).Child()[0],
  7425. _inputel = U.selectEl("input", _topel)[0]
  7426. ;
  7427. //循环处理样式
  7428. for (i = 0; i < _childel.length; i++) {
  7429. _changeel = U.selectEl(_childel[i]).Child()[0];
  7430. //如果是点击的对象
  7431. if (_changeel == el) {
  7432. el.className = "U_MD_F_S_Pop_Head_Nav_fonto";
  7433. j = i;
  7434. }
  7435. //点击的对象
  7436. else {
  7437. _changeel.className = "";
  7438. }
  7439. }
  7440. _contentel.innerText = "";
  7441. U.MD.F.S.searchAjax(1, j == 1, _contentel, _inputel); //初始化数据
  7442. }
  7443. //#endregion;
  7444. ///<jscompress sourcefile="FriendWindow.js" />
  7445. /*
  7446. 好友初始化区域 此文件为好友窗体使用初始化窗体
  7447. */
  7448. Namespace.register("U.MD.F.W"); //好友和群窗口区域命名空间
  7449. //#region 好友聊天
  7450. /**
  7451. * 弹出好友窗体处理
  7452. *
  7453. * @param {object} 群信息
  7454. */
  7455. U.MD.F.W.viewFriend = U.MD.F.W.SLHCK = function (friendinfo) {
  7456. //使用好友系统必须登录
  7457. if (!(U.MD.U.L.isLogin())) {
  7458. var _childs, //所有的好友元素
  7459. _friendel; //好友的信息元素
  7460. //如果有传入好友的信息,则查看指定的好友的信息,否则弹出默认的好友窗体
  7461. if (friendinfo) {
  7462. //如果用户是和自己聊天,那么直接提示不允许,否则弹出好友聊天框
  7463. if (friendinfo.UserId == US.userInfo.UserId) {
  7464. U.alert("无法与本人聊天!");
  7465. }
  7466. else {
  7467. //获取制定好友的点击元素
  7468. _friendel = U.selectEl("#U_MD_F_H_RCO").find("[tid='" + friendinfo.UserId + "']")[0];
  7469. //如果查看的好友在好友列表里
  7470. if (_friendel) {
  7471. _friendel.onclick();
  7472. }
  7473. //弹出好有窗体
  7474. else {
  7475. U.MD.F.W.popupFriendsForm(friendinfo);
  7476. }
  7477. }
  7478. }
  7479. //弹出默认的好友窗体
  7480. else {
  7481. _childs = U.selectEl("#U_MD_F_H_RCO").Child(); //右侧栏
  7482. friendinfo = (US.friend.recentcontacts[0] || US.friend.friends[0]); //最近联系人、 我的好友列表
  7483. //如果有显示的好友,则弹出第一个好友聊天
  7484. if (_childs.length) {
  7485. _childs[0].onclick();
  7486. }
  7487. //查看好友
  7488. else {
  7489. //这里判断如果弹出的是群聊天框,则选择群信息,需要修改
  7490. if (friendinfo && friendinfo.tf) {
  7491. friendinfo = U.Json.select(US.friend.group, { "GroupManageID": friendinfo.UserId })[0];
  7492. }
  7493. U.selectEl("#U_MD_F_H_ZRO").remove(); //清除推荐元素
  7494. //弹出好友信息
  7495. U.MD.F.W.popupFriendsForm(friendinfo);
  7496. //如果用户没有好友和群,那么则直接弹出推荐好友
  7497. if (!friendinfo || (!friendinfo.UserId && !friendinfo.GroupManageID)) {
  7498. U.MD.F.W.recommendFriend($("#U_MD_F_H_ZR")[0], 0);
  7499. }
  7500. }
  7501. }
  7502. }
  7503. }
  7504. //#region 空好友提示
  7505. ///**
  7506. //* 空好友的提示
  7507. //*
  7508. //*/
  7509. //U.MD.F.W.recommendFriend = function () {
  7510. // U.MD.F.W.printRecommendFriend(US.userInfo.TJF.slice(0, 8), U.selectEl("#U_MD_F_H_ZR")[0], 1); //推荐好友提示
  7511. // U.MD.F.W.friendDisplayAndNone([{ "display": "block" }, { "display": "none"}], true); //弹出好友窗体,隐藏右边好友栏
  7512. //}
  7513. /**
  7514. * 空用户的提示
  7515. *
  7516. */
  7517. U.MD.F.W.printRecommendFriend = function (friendinfo, el, page) {
  7518. //变量定义
  7519. var _tempel, //临时元素变量
  7520. _temponeel, //临时元素变量
  7521. _temptwoel, //临时元素变量
  7522. _tempthreeel, //临时元素变量
  7523. _tempfourel, //临时元素变量
  7524. _tempfiveel //临时元素变量
  7525. ;
  7526. //清空内容
  7527. el.innerText = "";
  7528. //创建显示
  7529. _tempel = $$("div", { "className": "U_MD_F_H_ZRO", "id": "U_MD_F_H_ZRO", "onmousedown": U.UF.EV.stopBubble });
  7530. _temponeel = $$("div", { "className": "U_MD_F_H_ZROS" }, _tempel);
  7531. $$("div", { "className": "U_MD_F_H_ZROSS", "innerHTML": "这里暂时没有任何内容哦" }, _temponeel);
  7532. $$("div", { "className": "U_MD_F_H_ZROSZ", "innerHTML": "Nothing!!" }, _temponeel);
  7533. _temptwoel = $$("div", { "className": "U_MD_F_H_ZROSX" }, _temponeel);
  7534. $$("div", { "className": "U_MD_F_H_ZROSXL", "innerHTML": "可尝试点击左边的头像,或追随一下的用户!" }, _temptwoel);
  7535. $$("div", { "className": "U_MD_F_H_ZROSXR U_Img" }, _temptwoel);
  7536. _temponeel = $$("div", { "className": "U_MD_F_H_ZROX" }, _tempel);
  7537. _temptwoel = $$("div", { "className": "U_MD_F_H_ZROXT" }, _temponeel);
  7538. $$("div", { "className": "U_MD_HomeSXLTTO U_MD_HomeSXROHTO", "innerHTML": "推荐追随" }, _temptwoel);
  7539. $$("div",
  7540. { "className": "U_MD_HomeSXLTTI U_Img",
  7541. "onclick": function () {
  7542. U.MD.F.W.recommendFriend(el, page);
  7543. }
  7544. }, _temptwoel);
  7545. _temptwoel = $$("div", { "className": "U_MD_F_H_ZROXX" }, _temponeel);
  7546. //推荐好友循环打印区域
  7547. for (i = 0; i < friendinfo.length; i++) {
  7548. _tempthreeel = $$("div", { "className": "U_MD_F_H_ZROXXO", "style": { "marginLeft": "65px"} }, _temptwoel);
  7549. _tempfourel = $$("div", { "className": "U_MD_F_H_ZROXXOS" }, _tempthreeel);
  7550. _tempfiveel = $$("div", { "className": "U_MD_F_H_ZROXXOSL" }, _tempfourel);
  7551. $$("img",
  7552. { "onerror": U.MD.C.imgError,
  7553. "title": "点击查看",
  7554. "onclick": function () {
  7555. U.UF.EV.stopBubble();
  7556. U.MD.U.V.ViewOtherUserInfo(friendinfo[i].UserId);
  7557. },
  7558. "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead),
  7559. "alt": friendinfo[i].UserName
  7560. },
  7561. _tempfiveel);
  7562. $$("div", { "className": "U_MD_F_H_ZROXXOSN U_MD_D_Text_Abbreviation", "innerHTML": friendinfo[i].UserName }, _tempfourel);
  7563. $$("div",
  7564. { "className": "U_MD_F_H_ZROXXOSR",
  7565. "title": "点击追随该用户",
  7566. "innerHTML": "追随",
  7567. "onclick": function () {
  7568. U.MD.F.M.addFriend(friendinfo[i]);
  7569. }
  7570. },
  7571. _tempfourel);
  7572. _tempfourel = $$("div", { "className": "U_MD_F_H_ZROXXOX U_MD_HomeSXZLLZOOX" }, _tempthreeel);
  7573. $$("div", { "className": "U_MD_F_W_S", "innerHTML": "▲" }, _tempfourel);
  7574. $$("div", {
  7575. "className": "U_MD_F_W_X",
  7576. "innerHTML": friendinfo[i].UserIndividualitysignature ? friendinfo[i].UserIndividualitysignature.substring(0, 15).trim() : ("添加我为好友吧,分享我们的信息,让我们距离更近一步").trim()
  7577. }, _tempfourel);
  7578. }
  7579. //添加内容
  7580. el.appendChild(_tempel);
  7581. }
  7582. //好友推荐变化
  7583. U.MD.F.W.recommendFriend = function (el, page) {
  7584. var _userinfo = US.userInfo, //登录用户资料
  7585. _start = page * 30, //分页的开始
  7586. _end = (page + 1) * 30, //分页的结束
  7587. _recommendfriend = US.friend.commonfriend.slice(_start, _end) //分页获取推荐的用户
  7588. ;
  7589. //获取的用户存在则打印
  7590. if (_recommendfriend.length) {
  7591. U.MD.F.W.printRecommendFriend(_recommendfriend, el, page + 1);
  7592. }
  7593. //否则去数据库取数
  7594. else {
  7595. 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]);
  7596. }
  7597. }
  7598. //获取推荐好友
  7599. U.MD.F.W.asynRecommendFriend = function (r) {
  7600. var _userinfo = US.userInfo, //登录用户资料
  7601. _context = r.context, //回调的参数
  7602. _el = _context[1], //输出的内容区域
  7603. _page = _context[2] //输出的号码
  7604. ;
  7605. r = r.value; //获取推荐用户的返回值
  7606. _userinfo = US.friend.commonfriend.concat(r); //获取的推荐用户存储到用户推荐用户信息里
  7607. U.MD.F.W.printRecommendFriend(r, _el, _page + 1); //打印推荐好友
  7608. }
  7609. //#endregion
  7610. //#region
  7611. /**
  7612. * 好友聊天器里查看好友聊天
  7613. *
  7614. * @param {object} 群信息
  7615. */
  7616. U.MD.F.W.popupFriendsForm = function (friendinfo, el) {
  7617. //登录的用户才能弹出窗体
  7618. var _close;
  7619. if (!U.MD.U.L.isLogin()) {
  7620. var _friendform = U.selectEl("#U_MD_F_H_ZA")[0];
  7621. //判断窗体是否创建如果创建直接显示,如果没有则创建
  7622. if (!_friendform) {
  7623. U.selectEl("#U_MD_F_H_Z")[0].style.display = "block";
  7624. //创建窗体弹出窗体
  7625. var _window = new U.UF.UI.form("<div class='U_MD_F_S_TI'>聊天对话</div>", U.selectEl("#U_MD_F_H_Z")[0],
  7626. {
  7627. "onresize": U.MD.F.W.reSize,
  7628. "id": "U_MD_F_H_ZA",
  7629. "style": {
  7630. "display": "block",
  7631. "height": "80%",
  7632. "min-width": '882px'
  7633. }
  7634. },
  7635. {
  7636. isstretching: false,
  7637. isnarrow: false,
  7638. closecallback: function () {
  7639. U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px" });
  7640. }
  7641. });
  7642. }
  7643. //指定元素
  7644. else {
  7645. U.UF.F.topWindow($("#U_MD_F_H_ZA")[0]);
  7646. }
  7647. if (friendinfo) {
  7648. U.MD.F.W.openFriendChat(friendinfo); //打开指定的好友聊天显示
  7649. U.MD.F.N.canelMarkMessage(friendinfo); //消除标记信息
  7650. U.MD.F.W.addChecked(friendinfo);
  7651. U.MD.F.W.reSize(); //好友聊天区域大小初始化
  7652. }
  7653. }
  7654. }
  7655. /**
  7656. * 根据群切换到好友或者群面板
  7657. *
  7658. * @param {object} 好友获取群信息
  7659. */
  7660. U.MD.F.W.switchFileOrGroup = function (friendinfo) {
  7661. var infotid = (friendinfo.UserId == null) ? friendinfo.GroupManageID : friendinfo.UserId;
  7662. if (infotid == friendinfo.UserId) {
  7663. U.selectEl($("#U_MD_F_H_ZLTA").Child()[1]).Child()[0].onclick();
  7664. }
  7665. else if (infotid == friendinfo.GroupManageID) {
  7666. U.selectEl($("#U_MD_F_H_ZLTA").Child()[2]).Child()[0].onclick();
  7667. }
  7668. }
  7669. /**
  7670. * 初始化好友聊天区域
  7671. *
  7672. * @param {object} 群信息
  7673. */
  7674. U.MD.F.W.openFriendChat = function (friendinfo) {
  7675. var _friendfromel = U.selectEl("#U_MD_F_H_ZR")[0], //整个好友窗体元素
  7676. _friendchatfrom = U.selectEl("#U_MD_F")[0], //好友聊天区域元素
  7677. _userid = friendinfo.GroupManageID || friendinfo.UserId, //打开群或者好友的窗体
  7678. _chatform = U.MD.F.W.isCreateForm(_userid), //判断窗体是否已经打开创建
  7679. _isgroup = friendinfo.GroupManageID != null
  7680. ;
  7681. _friendchatfrom.style.display = "block"; //默认是隐藏,这些显示
  7682. _friendfromel.appendChild(_friendchatfrom); //追加聊天区域
  7683. //如果好友聊天框不存在,则创建好友聊天框
  7684. if (!_chatform) {
  7685. _chatform = U.MD.F.W.createFriendChat(friendinfo);
  7686. }
  7687. //选择到指定的窗体
  7688. U.MD.F.W.switchFriendsChat(_chatform, friendinfo);
  7689. //好友聊天查看
  7690. U.MD.F.H.getFriendOrGroupNews(_userid, function (r) {
  7691. U.MD.F.N.asynReceiveMessages(_isgroup, _chatform[1], r.value);
  7692. }, _isgroup);
  7693. }
  7694. //大小变化处理
  7695. U.MD.F.W.reSize = function () {
  7696. U.MD.F.W.leftSize(); //左边的处理
  7697. if ($("#U_MD_F_H_ZA")[0]) {
  7698. 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]); //右边聊天框处理
  7699. }
  7700. }
  7701. /**
  7702. * 好友聊天左边聊天框显示,主要是好友显示的区域的大小加上上面的导航等于整个左边的高
  7703. *
  7704. */
  7705. U.MD.F.W.leftSize = function () {
  7706. //获取容器DIV
  7707. var _content = U.selectEl("#U_MD_F_H_ZA")[0];
  7708. if (_content) {
  7709. //得到高度
  7710. var _height = _content.offsetHeight,
  7711. _childs = U.selectEl(".U_MD_F_H_ZL").Child(); //获取下面的所有的孩子节点
  7712. //设置下面的高度等于整个高度-导航的高度
  7713. U.selectEl("#U_MD_F_H_ZLZ")[0].style.height = _height - _childs[0].offsetHeight - _childs[1].offsetHeight - 30 + "px";
  7714. }
  7715. }
  7716. //调整好友聊天框
  7717. U.MD.F.W.chatBoxSize = function (el, chatel) {
  7718. var i, //用于循环
  7719. _childs, //0 聊天区域 1聊天记录区域
  7720. _rightchilds = U.selectEl(chatel).Child(), //获取整个右边好友聊天区域的子元素
  7721. _chatchilds = U.selectEl(chatel.parentNode).Child(), //获取聊天区域的子元素
  7722. _height = el.offsetHeight, //右边的高
  7723. _width = chatel.offsetWidth; //右边的长
  7724. //循环设置
  7725. for (i = 0; i < _chatchilds.length; i++) {
  7726. //聊天记录和聊天框的大小设置
  7727. _childs = U.selectEl(_chatchilds[i]).Child();
  7728. _childs[0].style.width = _width - _childs[1].offsetWidth - 1 + "px";
  7729. _childs[1].style.height = _height - 90 + "px";
  7730. //聊天框的大小设置
  7731. U.selectEl(".U_MD_F_CA", _chatchilds[i]).css("height", _height - 380 + "px");
  7732. }
  7733. }
  7734. /**
  7735. * 设置好友窗体打开和关闭的状态
  7736. *
  7737. * @param {array} 显示隐藏的集合
  7738. */
  7739. U.MD.F.W.friendDisplayAndNone = function (style) {
  7740. var _friendform = U.selectEl("#U_MD_F_H_ZA"), //好友窗体
  7741. _friendright = U.selectEl("#U_MD_F_H_R"); //好友右侧
  7742. _friendform.addAttrArray({ "style": style[0] }); //给窗体设置参入的css值
  7743. _friendright.addAttrArray({ "style": style[1] }); //给窗体设置参入的css值
  7744. }
  7745. //#endregion
  7746. //判断是否需要创建
  7747. /**
  7748. * 根据friendid判断好友窗体是否创建
  7749. *
  7750. * @param {object} 群信息
  7751. */
  7752. U.MD.F.W.isCreateForm = function (friendid) {
  7753. var i, //用于循环处理
  7754. _friendchatform = U.selectEl("#U_MD_F")[0]; //好友聊天框
  7755. if (_friendchatform.childs) { //判断是否打开了聊天
  7756. for (i = 0; i < _friendchatform.childs.length; i++) { //循环所有打开的聊天找到已经和friendid对应打开的好友聊天
  7757. if (_friendchatform.childs[i].formid == friendid) { //如果找到匹配的好友聊天框或者群聊天框,则直接返回
  7758. return _friendchatform.childs[i].element;
  7759. }
  7760. }
  7761. }
  7762. }
  7763. /**
  7764. * 生成统一的好友窗体区域
  7765. *
  7766. * @param {object} 好友或群信息
  7767. */
  7768. U.MD.F.W.createFriendChat = function (friendandgroupinfo) {
  7769. //变量定义
  7770. var _headel,
  7771. _headimageel,
  7772. _chatel,
  7773. _chatleftel,
  7774. _chatheadel,
  7775. _chatheadimageel,
  7776. _chatheadcontentel,
  7777. _chatheadpromptel,
  7778. _chatcontentel,
  7779. _chatcontentnewsel,
  7780. _chatnewsel,
  7781. _chatnewsoneel,
  7782. _chatnewstwoel,
  7783. _chateditel,
  7784. _chatbuttonel,
  7785. _chatbuttonsendel,
  7786. _chatrecordel,
  7787. _buttondiv,
  7788. _userid,
  7789. _name,
  7790. descript,
  7791. _chatformel,
  7792. _chatformchilds,
  7793. _navichilds;
  7794. //群id获取好友id,作为窗体的唯一识别id
  7795. _userid = friendandgroupinfo.GroupManageID ||
  7796. friendandgroupinfo.UserId;
  7797. //显示在聊天框的名字,群名、好友描述、好友名字
  7798. _name = friendandgroupinfo.GroupManageName ||
  7799. friendandgroupinfo.FriendsDescript ||
  7800. friendandgroupinfo.UserNickName;
  7801. //群描述、好友签名
  7802. descript = friendandgroupinfo.GroupManageDescript ||
  7803. friendandgroupinfo.UserIndividualitysignature ||
  7804. "暂时没有填写介绍..";
  7805. //聊天框元素
  7806. _chatformel = U.selectEl("#U_MD_F")[0];
  7807. //聊天区域的还在元素
  7808. _chatformchilds = U.selectEl(_chatformel).Child();
  7809. //头部切换导航区域的元素
  7810. _navichilds = U.selectEl(_chatformchilds[0]).Child();
  7811. //头部标签
  7812. _headel = $$("div", {
  7813. "className": "U_MD_F_TO",
  7814. "onmousedown": U.UF.EV.stopBubble
  7815. }, _navichilds[0], _navichilds[0].firstChild);
  7816. _headimageel = $$("div", { "className": "U_MD_F_TOI" }, _headel);
  7817. U.selectEl(_headel).attr("user", _userid);
  7818. //好友显示头像
  7819. if (friendandgroupinfo.UserId) {
  7820. $$("img", { "onerror": U.MD.C.imgError,
  7821. "onerror": U.MD.C.imgError,
  7822. "title": "点击查看",
  7823. "src": U.MD.C.getHeadImage(friendandgroupinfo.UserThumbnailImageHead),
  7824. "alt": friendandgroupinfo.UserNickName
  7825. }, _headimageel);
  7826. }
  7827. //群显示头像
  7828. else {
  7829. U.MD.F.printGroupHeadImage(friendandgroupinfo, _headimageel, 4, [25, 25]);
  7830. }
  7831. $$("div", { "className": "U_MD_F_TON U_MD_D_Text_Abbreviation", "innerHTML": _name }, _headel);
  7832. $$("div", {
  7833. "className": "U_MD_F_TOC U_Img",
  7834. "onclick": function () {
  7835. U.MD.F.W.delteFriendChat(_userid, _chatformel, friendandgroupinfo);
  7836. }
  7837. }, _headel);
  7838. //聊天区
  7839. _chatel = $$("div", { "className": "U_MD_F_NA" });
  7840. _chatformchilds[1].insertBefore(_chatel, _chatformchilds[1].firstChild);
  7841. //左侧
  7842. _chatleftel = $$("div", { "className": "U_MD_F_N" }, _chatel);
  7843. //头部信息
  7844. _chatheadel = $$("div", { "className": "U_MD_F_H" }, _chatleftel);
  7845. _chatheadimageel = $$("div", { "className": "U_MD_F_HH" }, _chatheadel);
  7846. if (friendandgroupinfo.GroupManageID) {
  7847. U.MD.F.printGroupHeadImage(friendandgroupinfo, _chatheadimageel);
  7848. U.selectEl(_chatheadimageel).addAttrArray({ onclick: function () { U.MD.F.J.groupInfoForm(friendandgroupinfo, _chatleftel); }, title: friendandgroupinfo["GroupManageName"] });
  7849. }
  7850. else {
  7851. $$("img", { "onerror": U.MD.C.imgError,
  7852. "onerror": U.MD.C.imgError,
  7853. "title": "点击查看",
  7854. "onclick": function () {
  7855. U.UF.EV.stopBubble();
  7856. if (U.MD.D.IsUseStudio) {
  7857. U.MD.U.V.ViewOtherUserInfo(_userid);
  7858. }
  7859. },
  7860. "src": U.MD.C.getHeadImage(friendandgroupinfo.UserThumbnailImageHead),
  7861. "alt": friendandgroupinfo.UserNickName
  7862. }, _chatheadimageel);
  7863. }
  7864. _chatheadcontentel = $$("div", { "className": "U_MD_F_HT U_MD_D_Text_Abbreviation" }, _chatheadel);
  7865. $$("div", { "className": "U_MD_F_HTN", "innerHTML": _name }, _chatheadcontentel);
  7866. $$("div", { "className": "U_MD_F_HTC", "innerHTML": (friendandgroupinfo.GroupManageDescript || friendandgroupinfo.UserIndividualitysignature || "暂时没有填写介绍..") }, _chatheadcontentel);
  7867. _chatheadpromptel = $$("div", { "className": "U_MD_F_HG" }, _chatleftel);
  7868. $$("div", { "className": "U_MD_F_GI U_Img" }, _chatheadpromptel);
  7869. $$("div", { "className": "U_MD_F_GC", "innerHTML": "交谈中请勿轻信汇款、中奖信息、陌生电话..." }, _chatheadpromptel);
  7870. $$("div", { "style": {
  7871. "width": "10px",
  7872. "height": "10px",
  7873. "background-image": "url('/img/YS2017.png')",
  7874. "display": "inline-block",
  7875. "background-repeat": "no-repeat",
  7876. "background-position": "-817px -482px",
  7877. "float": "right",
  7878. "margin": "8px"
  7879. },
  7880. "onclick": function () { _chatheadpromptel.style.visibility = "hidden"; }
  7881. }, _chatheadpromptel);
  7882. //内容发布区
  7883. _chatcontentel = $$("div", { "className": "U_MD_F_CA" }, _chatleftel);
  7884. _chatcontentnewsel = $$("div", { "className": "U_MD_F_C" }, _chatcontentel);
  7885. //发布内容区域
  7886. _chatnewsel = $$("div", { "className": "U_MD_F_D", "style": { "position": "relative"} }, _chatleftel);
  7887. _chatnewsoneel = $$("div", { "className": "U_MD_F_DA" }, _chatnewsel);
  7888. _chatnewstwoel = $$("div", { "className": "U_MD_F_DT" }, _chatnewsoneel);
  7889. _chateditel = $$("div", { "className": "U_MD_F_DC", "contentEditable": "true" }, _chatnewsoneel);
  7890. $$("div", { "className": "U_MD_F_DJ U_Img" }, _chatnewsoneel);
  7891. // 按钮区域
  7892. _chatface = $$("div", { "style": { "margin-top": "-194px", "margin-left": "14px"} }, _chatformel);
  7893. _chatbuttonel = $$("div", { "className": "U_MD_F_X" }, _chatleftel);
  7894. _chatbuttonsendel = $$("div", {
  7895. "className": "U_MD_F_XE",
  7896. "innerHTML": "发送(Ctrl+Enter)",
  7897. "style": {
  7898. "marginRight": "15px"
  7899. },
  7900. "onclick": function () {
  7901. U.MD.F.H.sendFriendOrGroupChatMessage(friendandgroupinfo, _chateditel, _chatcontentnewsel, (friendandgroupinfo.UserId == null));
  7902. }
  7903. }, _chatbuttonel);
  7904. $$("div", {
  7905. "className": "U_MD_F_XC",
  7906. "innerHTML": "关闭(n)",
  7907. "onclick": function () {
  7908. U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px" });
  7909. }
  7910. }, _chatbuttonel);
  7911. //右侧聊天记录
  7912. _chatrecordel = $$("div", { "className": "U_MD_F_L" }, _chatel);
  7913. $$("div", { "className": "U_MD_F_LA" }, _chatrecordel);
  7914. $$("div", { "className": "U_MD_F_LB" }, _chatrecordel);
  7915. //事件赋值
  7916. _buttondiv = $$("div", {
  7917. "className": "U_MD_F_DTF U_MD_F_W_Face",
  7918. "title": "发送表情",
  7919. "style": {
  7920. "margin": "0",
  7921. "position": "relative",
  7922. "background": "url(/img/face.png) no-repeat 0",
  7923. "background-size": "20px"
  7924. }
  7925. }, _chatnewstwoel);
  7926. $$("button", {
  7927. "style": {
  7928. "opacity": "0",
  7929. "width": "28px",
  7930. "height": "28px"
  7931. },
  7932. "onmousedown": function () {
  7933. U.MD.UI.face(_chatface, _chateditel);
  7934. },
  7935. "onclick": U.UF.EV.stopBubble
  7936. }, _buttondiv);
  7937. _chatheadimageel = $$("div", {
  7938. "className": "U_MD_F_UploadPng U_Img",
  7939. "title": "添加文件",
  7940. "style": { "cssText": "margin-left:5px" },
  7941. "onclick": function (e) {
  7942. if ($(".U_MD_F_UploadInput")[0]) {
  7943. //删除弹出框
  7944. U.selectEl(".U_MD_F_UploadInput")[0].remove();
  7945. return;
  7946. }
  7947. var _firendinfo = friendandgroupinfo;
  7948. 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);
  7949. var _local = $$("div", { "className": "U_MD_F_LoaclChose", innerHTML: "选择本地上传文件", style: { "cssText": "position:relative;float:none;width:100%;height:32px;margin:8px 0 0 0;line-height:32px" },
  7950. onclick: function () {
  7951. var _groupid,
  7952. _ancestors,
  7953. _directoryid = US.disk.Disks[US.userInfo.UserId].directoryid,
  7954. _dirinfo = U.Json.select(US.disk.Disks[US.userInfo.UserId].directoryOrFiles, { "UserDirectoryID": _directoryid })[0];
  7955. //获取粘贴到制定目录的群id
  7956. _ancestors = U.MD.DK.C.getAncestors(_dirinfo, US.disk.Disks[US.userInfo.UserId]); //获取所有的祖先
  7957. //如果是ftp目录,那么groupid就是用户id
  7958. if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) {
  7959. _groupid = US.disk.Disks[US.userInfo.UserId].userInfo.UserId;
  7960. }
  7961. //否则就是对应的群id,如果不存在那么就是""
  7962. else {
  7963. _groupid = _ancestors[_ancestors.length - 1].GroupID || "";
  7964. }
  7965. U.MD.UI.upload(
  7966. "http://disk.1473.cn/USUpfile.ashx?typename=UploadFlashfile&DirectoryId=" + _directoryid + "&Encrypt=" + _groupid + "&UserId=" + US.userInfo.UserId + "&IsF=true", //上传的地址
  7967. //上传成功的回调函数
  7968. function (r, fileinfo) {
  7969. var _data = r.data //获取服务器返回值
  7970. ; //根据文件的唯一识别id获取文件的信息
  7971. //获取从服务器获取的值,这里加一个错误处理,因为如果后台出现了错误,那么eval的过程就会失败
  7972. try {
  7973. _data = eval("0," + _data);
  7974. }
  7975. catch (e) { }
  7976. var _fileInfo = {
  7977. "UserFilesServerName": _data[0],
  7978. "UserallDirectoryName": fileinfo.name,
  7979. "UserDirectoryExtendType": U.UF.UP.getFileNameAndExtension(fileinfo.name)[1],
  7980. "UserDirectorySize": _data[3],
  7981. "UserDirectoryID": _data[2],
  7982. "UserDirectoryUrl": _data[1]
  7983. }
  7984. U.MD.F.W.printMessageContent(_fileInfo.UserDirectoryExtendType, _fileInfo, _chatcontentnewsel, true, _firendinfo);
  7985. },
  7986. //得到md5的回调函数
  7987. function (md5, fileinfo, cb) {
  7988. //根据用户的md5值判断用户是否需要上传,如果需要上传则需要执行上传处理,如果已经存在后台直接给用户生成文件路径等录入数据库
  7989. U.A.Request(US.DISK, ["IfFileExistInsertDB", US.userInfo.UserId, _directoryid, _groupid, fileinfo.size, md5, U.UF.UP.getFileNameAndExtension(fileinfo.name)[1], fileinfo.name],
  7990. //判断上传文件是否存在
  7991. function (r) {
  7992. var _userid = US.userInfo.UserId; //当前登录用户的id
  7993. r = r.value;
  7994. //获取服务器返回的值,如果服务器响应出问题了,eval的时候就会报错。
  7995. try {
  7996. r = eval(r)[0];
  7997. }
  7998. catch (e) { }
  7999. //当用户想上传的文件已经在数据库里存在了,那么后台会执行复制数据的操作。
  8000. if (r) {
  8001. var _fileInfo = {
  8002. "UserFilesServerName": r.UserFilesServerName,
  8003. "UserallDirectoryName": r.UserDirectoryName.addEllipsis(20),
  8004. "UserDirectoryExtendType": U.UF.UP.getFileNameAndExtension(r.UserDirectoryName)[1],
  8005. "UserDirectorySize": r.UserDirectorySize,
  8006. "UserDirectoryID": r.UserDirectoryID,
  8007. "UserDirectoryUrl": r.UserDirectoryUrl
  8008. }
  8009. U.MD.F.W.printMessageContent(_fileInfo.UserDirectoryExtendType, _fileInfo, _chatcontentnewsel, true, _firendinfo);
  8010. cb(false);
  8011. }
  8012. //否则调用flash里面的函数执行用户的上传操作。
  8013. else {
  8014. cb(true);
  8015. }
  8016. });
  8017. });
  8018. //阻止冒泡
  8019. U.UF.EV.stopBubble()
  8020. //删除弹出框
  8021. U.selectEl(".U_MD_F_UploadInput").remove();
  8022. }
  8023. }, _div);
  8024. // var _localinput = $$('input', { 'type': 'file', style: { "cssText": "position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0;" },
  8025. // onchange: function () {
  8026. // if (this.files.length) { //判断是否存在文件
  8027. // var _range = U.UF.E.getRangeAt(); //获取光标处理
  8028. // U.UF.UP.inputUpload([this], 'http://disk.1473.cn/USUpfile.ashx?typename=UseStudioEditor', function (r) { //调用统一上传处理
  8029. // var _file, _filetype, _input = r.context[0];
  8030. // var _imgtype = /.*(jpg|png|gif|jpeg|JPG|PNG|GIF|JPEG|bmp|BMP)$/;
  8031. // var _filearray = []; //记录上传图片的数组
  8032. // if (Object.prototype.toString.call(r.value[0]) != "[object Array]") { //根据返回值类型判断是否多图上传
  8033. // _filearray = [r.value]; //单图用数组则直接记录
  8034. // }
  8035. // else {
  8036. // _filearray = r.value; //多图则直接替换即可
  8037. // }
  8038. // var _el, _frag = $$('frag');
  8039. // for (i = 0; i < _filearray.length; i++) { //循环评接拼接
  8040. // _file = _input.files[i];
  8041. // _filetype = _file.name.substring(_file.name.lastIndexOf('.') + 1, _file.name.length); //获取文件后缀名
  8042. // if (_filetype.match(_imgtype)) {//图片类型处理
  8043. // _el = $$("div", {}, _frag); ;
  8044. // $$('span', { innerHTML: ' <img src="http://fs.1473.cn/' + _filearray[i][0] + '">' }, _el);
  8045. // }
  8046. // else { //其余文件类型处理
  8047. // _el = U.UF.E.attachment.create(_file, _filearray[i][2], _filetype);
  8048. // U.selectEl(_el).appendTo(_frag);
  8049. // }
  8050. // }
  8051. // var _filedata = { 'UserallDirectoryName': _file.name, 'UserDirectoryExtendType': _filetype, 'UserDirectorySize': _file.size, 'UserDirectoryID': r.value[2], 'UserDirectoryUrl': r.value[0] };
  8052. // U.MD.F.W.printMessageContent(_filetype, _filedata, _chatcontentnewsel, true, _firendinfo);
  8053. // }, [this]);
  8054. // }
  8055. // }
  8056. // }, _local);
  8057. var _disk = $$("div", { "className": "U_MD_F_DiskChose", innerHTML: "选择网盘上传文件", style: { "cssText": "float:none;width:100%;height:32px;margin:0 0 0 0;line-height:32px" },
  8058. onclick: function () {
  8059. //阻止冒泡
  8060. U.UF.EV.stopBubble()
  8061. U.MD.DK.VW.choseFile(function (data) {
  8062. //根据选择的文件生成内容
  8063. U.MD.F.W.printMessageContent(data.UserDirectoryExtendType, data, _chatcontentnewsel, true, friendandgroupinfo);
  8064. //删除弹出框
  8065. U.selectEl(".U_MD_F_UploadInput").remove();
  8066. })
  8067. }
  8068. }, _div);
  8069. U.UF.EV.stopBubble();
  8070. }
  8071. }, _chatnewstwoel);
  8072. if (friendandgroupinfo.GroupManageID) {
  8073. $$("div", {
  8074. "className": "U_MD_F_DTS U_Img",
  8075. "title": "网盘提交",
  8076. "onclick": function () {
  8077. U.MD.D.I.openApplication("disk",
  8078. {
  8079. "userid": US.userInfo.UserId,
  8080. "directoryid": friendandgroupinfo.GroupManageID
  8081. });
  8082. }
  8083. }, _chatnewstwoel);
  8084. }
  8085. $$("div", {
  8086. "className": "U_MD_F_DTJ U_Img",
  8087. "title": "聊天记录",
  8088. "onclick": function () {
  8089. U.MD.F.H.viewFriendsChatRecords(_chatrecordel, friendandgroupinfo, 1, (friendandgroupinfo.UserId == null));
  8090. }
  8091. }, _chatnewstwoel);
  8092. U.selectEl(_chateditel).bind("keydown", function () {
  8093. if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) {
  8094. _chatbuttonsendel.onclick(); //发送消息
  8095. U.UF.EV.stopDefault(); //回车处理
  8096. }
  8097. });
  8098. U.UF.E.initEditor(_chateditel); //初始化编辑器处理
  8099. _headel.onclick = function () {
  8100. U.MD.F.W.switchFriendsChat([_headel, _chatel], friendandgroupinfo);
  8101. }; //切换事件
  8102. //设置光标处理
  8103. // U.UF.E.GetSelectionRange(window, _chateditel, { "TF": "Friend" });
  8104. //创建的好友窗体记录
  8105. if (_chatformel.childs == null) {
  8106. _chatformel.childs = [];
  8107. }
  8108. _chatformel.childs.unshift({ "formid": _userid, "element": [_headel, _chatel], "info": friendandgroupinfo }); //添加记录
  8109. return _chatformel.childs[0].element;
  8110. }
  8111. //
  8112. /**
  8113. * 好友聊天切换
  8114. *
  8115. * @param {string} 好友的id
  8116. * @param {element} 窗体元素
  8117. */
  8118. U.MD.F.W.switchFriendsChat = function (elements, friendorgroupinfo) {
  8119. var i,
  8120. _friendchatel,
  8121. _topleftbottom,
  8122. _chatel = U.selectEl(elements[1]).Parent(2),
  8123. _topbottom = U.selectEl($(_chatel).Child()[0]).Child()[2], //右上角功能按钮
  8124. _chatchilds = U.selectEl(_chatel)[0].childs;
  8125. //判断右上角功能按钮是否存在
  8126. if (_topbottom.children[0]) {
  8127. _topbottom.children[0].remove();
  8128. }
  8129. //显示当前elements的聊天窗体,其他的隐藏
  8130. for (i = 0; i < _chatchilds.length; i++) {
  8131. _friendchatel = _chatchilds[i].element;
  8132. if (_friendchatel[0] == elements[0] && _friendchatel[1] == elements[1]) { //需要显示的聊天框
  8133. U.MD.F.W.switchFriendsChat.Ele = elements[1];
  8134. U.selectEl(elements[0]).addClass("U_MD_F_TOT");
  8135. U.selectEl(elements[1]).css("display", "block");
  8136. //可编辑区域聚焦
  8137. U.selectEl(".U_MD_F_DC", elements[1])[0].focus();
  8138. }
  8139. else { //需要隐藏的聊天框
  8140. U.selectEl(_friendchatel[0]).removeClass("U_MD_F_TOT");
  8141. U.selectEl(_friendchatel[1]).css("display", "none");
  8142. }
  8143. }
  8144. //右上角功能点击处理处理
  8145. _topbottom.onclick = function () { U.MD.F.R.popupRightCornerMenu(friendorgroupinfo, _topbottom); };
  8146. if (friendorgroupinfo.UserId) {
  8147. _topleftbottom = "个人信息";
  8148. } else {
  8149. _topleftbottom = "创建群";
  8150. }
  8151. _topbottom.title = _topleftbottom;
  8152. //好友聊天框
  8153. U.MD.F.W.chatBoxSize($(elements[1]).Parent(7), elements[1]);
  8154. }
  8155. /**
  8156. * 删除单个好友聊天
  8157. *
  8158. * @param {string} 好友的id
  8159. * @param {element} 窗体元素
  8160. */
  8161. U.MD.F.W.delteFriendChat = function (friendid, el) {
  8162. var i, j, //循环处理
  8163. _chatinfo, //好友聊天的好友或者群信息
  8164. _elements, //好友聊天信息的框
  8165. _childs = U.selectEl(el)[0].childs; //获取所有的聊天框
  8166. U.UF.EV.stopBubble();
  8167. //剩下最后一个直接关闭聊天框
  8168. if (_childs.length == 1 && _childs[0].formid == friendid) {
  8169. U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px" }); //移除
  8170. }
  8171. else {
  8172. //循环找到friendid对应的弹框
  8173. for (i = 0; i < _childs.length; i++) {
  8174. //判断窗体的id和好友的id是否一致
  8175. if (_childs[i].formid == friendid) {
  8176. _elements = _childs[i]["element"]; //获取根据friendid创建的所有的元素
  8177. for (j = 0; j < _elements.length; j++) { //循环所有的元素,然后全部删除
  8178. U.selectEl(_elements[j]).remove(); //移除元素处理
  8179. }
  8180. _childs.splice(i, 1); //在所有孩子元素中删除该元素
  8181. //判断当前窗体是否在正在进行的聊天窗体,如果是的话,删除了这个窗体后要把下面的窗体显示出来
  8182. if (_elements[0].className.indexOf("U_MD_F_TOT") > -1) {
  8183. //获取下一个要显示的聊天框
  8184. _chatinfo = _childs[i] || _childs[i - 1]; //下一个或者是上一个
  8185. //显示该聊天框
  8186. U.MD.F.W.switchFriendsChat(_chatinfo["element"], _chatinfo["info"]);
  8187. }
  8188. break;
  8189. }
  8190. }
  8191. }
  8192. }
  8193. /**
  8194. * 移除所有聊天窗体
  8195. *
  8196. */
  8197. U.MD.F.W.delteAllFriendChat = function () {
  8198. }
  8199. //生成发表聊天消息和获取聊天消息区域
  8200. /**
  8201. * 查看聊天好友
  8202. * @param {element} 打印的内容区域
  8203. * @param {array} 打印消息的数组
  8204. * @param {boolean} 判断消息是自己发送的还是获取的
  8205. ---------- true 自己发送的
  8206. ---------- flase 获取的带的
  8207. */
  8208. U.MD.F.W.printFriendChatMessage = function (el, newsinfo, issend) {
  8209. var i,
  8210. _mydate,
  8211. _month,
  8212. _date, //打印的时间
  8213. _contentel,
  8214. _content,
  8215. _chatcontentel,
  8216. _contentoneel,
  8217. _contentimgel,
  8218. _chatcontentoneel,
  8219. _chatcontentwordsel,
  8220. _chatel = el.parentNode, //聊天框
  8221. _frag = $$("frag");
  8222. //发送者和接受者的样式区分
  8223. //发送者的样式
  8224. if (issend) {
  8225. _stylearray = ["U_MD_F_CT", " U_MD_F_CTLC U_MD_F_GCTLC", " U_MD_F_COLCOO", " U_MD_F_CTTO", " "];
  8226. }
  8227. //接受者的样式
  8228. else {
  8229. _stylearray = ["U_MD_F_CO", "U_MD_F_CTLC_Receive U_MD_F_GCTLC", " U_MD_F_COLCOT", " U_MD_F_CTT"];
  8230. }
  8231. //打印的消息
  8232. var _el;
  8233. for (i = 0; i < newsinfo.length; i++) {
  8234. _mydate = new Date(); //获取时间
  8235. _month = _mydate.getMonth() + 1; //获取月份
  8236. _date = newsinfo[i]["Time"] || U.MD.F.N.getHoursMinutesSeconds(newsinfo[i]["GroupMessageSendTime"] || newsinfo[i]["MessageSendTime"], "Array");
  8237. _contentBox = $$("div", { "style": { "margin": " 0 10px"} }, _frag);
  8238. //没有打印任何消息,时间必须打印
  8239. if (el.innerText == "") {
  8240. _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)
  8241. }
  8242. //打印消息判断时间差,如果是在两分钟内的 则不添加新的时间提示
  8243. else {
  8244. _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);
  8245. var _pastTime = _chatel.firstChild.lastChild.firstChild.innerText;
  8246. if (_mydate.getTime() / 1000 - new Date(_pastTime).getTime() / 1000 >= 120) {
  8247. _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);
  8248. }
  8249. }
  8250. _contentel = $$("div", { "className": _stylearray[0], "title": newsinfo[i].GroupMessageSendUsername || newsinfo[i].MessageDescript || newsinfo[i].Name }, _contentBox);
  8251. _content = $$("div", {}, _contentel);
  8252. _contentoneel = $$("div", { "className": "U_MD_F_COLC" + " " + _stylearray[1] }, _content);
  8253. _contentimgel = $$("img",
  8254. {
  8255. "onerror": U.MD.C.imgError,
  8256. "title": "点击查看",
  8257. 'i': i,
  8258. "onclick": function () {
  8259. U.MD.U.V.ViewOtherUserInfo(newsinfo[this.i].GroupMessageSendUser || newsinfo[this.i].UserId || newsinfo[this.i].MessageSendUserID);
  8260. },
  8261. "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)),
  8262. "className": "U_MD_F_COLCI"
  8263. }, _contentel);
  8264. //如果消息类型为6,文件消息处理
  8265. if (newsinfo[i].MessageIsVerify == 6) {
  8266. var _filedata = JSON.parse(newsinfo[i].MessageContent),
  8267. //生成盒子,并且绑定点击事件
  8268. _filebox = $$('div', { style: { cssText: 'position:relative; padding: 10px; background-color: #fff; border:1px solid silver; overflow:hidden; cursor: pointer;'} }, _contentoneel)
  8269. U.MD.F.W.printFileContent(_filedata, _filebox)
  8270. }
  8271. else {
  8272. _el = newsinfo[i]["MessageContent"] || newsinfo[i]["GroupMessageContent"] || newsinfo[i]["Content"]
  8273. if (U.UF.C.isElement(_el)) {
  8274. _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2] }, _contentoneel);
  8275. U.selectEl(_el).appendTo(_contentwordsel);
  8276. }
  8277. else {
  8278. _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2], "innerHTML": _el }, _contentoneel);
  8279. }
  8280. }
  8281. if (issend) {
  8282. _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);
  8283. _content.style.float = "right";
  8284. _contentel.insertBefore(_contentimgel, _content);
  8285. _contentimgel.style.float = "right";
  8286. _content.style.marginRight = "8px";
  8287. }
  8288. else {
  8289. _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);
  8290. _content.style.float = "left";
  8291. _contentel.insertBefore(_contentimgel, _content);
  8292. }
  8293. }
  8294. el.appendChild(_frag);
  8295. //消息定位到底部
  8296. _chatel.scrollTop = _chatel.scrollHeight - _chatel.offsetHeight;
  8297. }
  8298. /**
  8299. * 查看聊天 好友或者群
  8300. * @param {element} 打印的内容区域
  8301. * @param {array} 打印消息的数组
  8302. * @param {boolean} 判断消息是自己发送的还是获取的
  8303. ---------- true 自己发送的
  8304. ---------- flase 获取的带的
  8305. */
  8306. U.MD.F.W.printGroupChatMessage = function (el, newsinfo, issend) {
  8307. var i,
  8308. _date,
  8309. _contentel,
  8310. _contentoneel,
  8311. _contentwordsel,
  8312. _contentimgel,
  8313. _contentnameel,
  8314. _stylearray,
  8315. _chatcontentel = el.parentNode,
  8316. _frag = $$("frag");
  8317. //发送消息是自己和他人区别的样式
  8318. if (issend) {
  8319. _stylearray = ["U_MD_F_CT", " U_MD_F_CTLC U_MD_F_GCTLC", " U_MD_F_COLCOO", " U_MD_F_CTTO", " "];
  8320. }
  8321. else {
  8322. _stylearray = ["U_MD_F_CO", "U_MD_F_CTLC_Receive U_MD_F_GCTLC", " U_MD_F_COLCOT", " U_MD_F_CTT"];
  8323. }
  8324. //循环打印聊天消息
  8325. for (i = 0; i < newsinfo.length; i++) {
  8326. var _i = i;
  8327. var _isFile = true;
  8328. var _mydate = new Date(),
  8329. _month = _mydate.getMonth() + 1; //获取月份
  8330. _mydate.getHours(); //获取系统时,
  8331. _mydate.getMinutes(); //分
  8332. _mydate.getSeconds(); //秒
  8333. _date = newsinfo[i]["Time"] || U.MD.F.N.getHoursMinutesSeconds(newsinfo[i]["GroupMessageSendTime"]), "Array";
  8334. _contentBox = $$("div", { "style": { "margin": " 0 10px"} }, _frag);
  8335. if (el.innerText == "") {
  8336. _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);
  8337. } else {
  8338. _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);
  8339. var _pastTime = _chatcontentel.firstChild.lastChild.firstChild.innerText;
  8340. if (_mydate.getTime() / 1000 - new Date(_pastTime).getTime() / 1000 >= 120) {
  8341. _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);
  8342. }
  8343. }
  8344. _contentel = $$("div", { "className": _stylearray[0], "title": newsinfo[i].GroupMessageSendUsername || newsinfo[i].MessageDescript || newsinfo[i].Name }, _contentBox);
  8345. _content = $$("div", {}, _contentel);
  8346. _contentoneel = $$("div", { "className": "U_MD_F_COLC" + " " + _stylearray[1] }, _content);
  8347. _contentimgel = $$("img", {
  8348. "onerror": U.MD.C.imgError,
  8349. "title": "点击查看",
  8350. "onclick": function () {
  8351. U.MD.U.V.ViewOtherUserInfo(newsinfo[_i].GroupMessageSendUser || newsinfo[_i].UserId);
  8352. }, "src": U.MD.C.getHeadImage((newsinfo[i].IMG || newsinfo[i].UserThumbnailImageHead)), "className": "U_MD_F_COLCI"
  8353. }, _contentel);
  8354. if (_isFile) {
  8355. _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2], "innerHTML": newsinfo[i]["Content"] || newsinfo[i]["GroupMessageContent"] }, _contentoneel);
  8356. }
  8357. else {
  8358. var _filedata = newsinfo[i].Content,
  8359. _filebox = $$('div', { 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) {
  8360. var _type = '';
  8361. switch (filedata.fileType) {
  8362. case "uw": _type = 'word'; break;
  8363. case "ue": _type = 'excel'; break;
  8364. }
  8365. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", filedata.fileID]), function (r) {
  8366. U.MD.D.I.openApplication(_type, r.value[0])
  8367. });
  8368. }, [i, _filedata])
  8369. }, _contentoneel)
  8370. $$('span', { className: 'U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOD' }, _filebox);
  8371. $$('span', { style: { cssText: 'vertical-align: top; padding-left: 20px; padding-right: 40px;' }, innerText: _filedata.fileName + '.' + _filedata.fileType }, _filebox);
  8372. $$('div', { style: { cssText: 'position: absolute; right: 10px; bottom: 10px;' }, innerText: '查看' }, _filebox)
  8373. }
  8374. if (issend) {
  8375. _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);
  8376. _content.style.float = "right";
  8377. _contentel.insertBefore(_contentimgel, _content);
  8378. _contentimgel.style.float = "right";
  8379. _content.style.marginRight = "8px";
  8380. }
  8381. else {
  8382. _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);
  8383. _content.style.float = "left";
  8384. _contentel.insertBefore(_contentimgel, _content);
  8385. }
  8386. }
  8387. //追加消息
  8388. el.appendChild(_frag);
  8389. //消息定位到底部
  8390. _chatcontentel.scrollTop = _chatcontentel.scrollHeight - _chatcontentel.clientHeight;
  8391. }
  8392. /**
  8393. * 查看聊天好友
  8394. * @param {element} 打印的内容区域
  8395. * @param {array} 打印消息的数组
  8396. * @param {boolean} 判断消息是自己发送的还是获取的
  8397. ---------- true 自己发送的
  8398. ---------- flase 获取的带的
  8399. */
  8400. U.MD.F.W.addFile = function (friendinfo, el, thumbnail, fileurl, fileinfo) {
  8401. //临时元素变量
  8402. var _tempel,
  8403. _temponeel,
  8404. _temptwoel,
  8405. _tempthreeel,
  8406. _isgroup = friendinfo.UserId == null;
  8407. //图片发送方式
  8408. if (U.UF.UP.isImg(fileinfo.UserDirectoryExtendType)) {
  8409. //创建一个元素
  8410. _tempel = $$("div", {});
  8411. //创建一个图片标签,添加图片
  8412. $$("img", { "onerror": U.MD.C.imgError, "className": "U_MD_F_CI", "src": U.MD.C.getHeadImage(thumbnail), "title": U.MD.C.getHeadImage(fileurl) },
  8413. _messageel).onclick = "U.UF.EV.stopBubble();U.MD.I.Img(US.userInfo, { 'Thm': '" + fileurl + "', 'Img': '" + fileurl + "'})"; //图片内容
  8414. //发送图片
  8415. U.MD.F.H.sendFriendOrGroupChatMessage(friendinfo, _messageel, el, _isgroup, true);
  8416. }
  8417. //文件发送方式
  8418. else {
  8419. _tempthreeel = $$("div");
  8420. //发表文章样式
  8421. _tempel = $$("div", { "className": "U_MD_F_F" }, _tempthreeel);
  8422. _temponeel = $$("div", { "className": "U_MD_F_FS" }, _tempel);
  8423. _temptwoel = $$("div", { "className": "U_MD_F_FSS" }, _temponeel);
  8424. $$("div", { "innerHTML": fileinfo["UserDirectoryExtendType"] }, _temptwoel);
  8425. _temptwoel = $$("div", { "className": "U_MD_F_FSX" }, _temponeel);
  8426. $$("div", { "className": "U_MD_F_FSXN", "innerHTML": fileinfo["UserallDirectoryName"] }, _temptwoel);
  8427. $$("div", { "className": "U_MD_F_FSXS", "innerHTML": "已成功发送" }, _temptwoel);
  8428. _temponeel = $$("div", { "className": "U_MD_F_FX" }, _tempel);
  8429. //如果是在1473上看到该信息,则可以直接打开网盘到指定的地方
  8430. if (U.MD.D.IsUseStudio) {
  8431. _tempel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "', '" + fileinfo.UserDirectoryID + "'])"
  8432. _temptwoel = $$("div", { "innerHTML": "打开我的云盘", "title": "打开我的云盘" }, _temponeel);
  8433. _temptwoel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "','" + fileinfo.UserDirectoryParentID + "'])";
  8434. _temptwoel = $$("div", { "innerHTML": "打开", "title": "打开" }, _temponeel);
  8435. _temptwoel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "','" + fileinfo.UserDirectoryID + "'])";
  8436. }
  8437. //如果是第三方调用我们的好友,则出现下载
  8438. else {
  8439. _temptwoel = $$("div", { "innerHTML": "下载", "title": "下载" }, _temponeel);
  8440. _temptwoel.onclick = "U.UF.EV.stopBubble();U.UF.UP.download('" + fileinfo.UserallDirectoryName + "','" + fileinfo.UserFilesServerName + "')";
  8441. }
  8442. //显示出文件的样式
  8443. U.MD.F.H.sendFriendOrGroupChatMessage(friendinfo, _tempthreeel, el, _isgroup, true);
  8444. }
  8445. }
  8446. //#endregion
  8447. //右侧好友定位
  8448. U.MD.F.W.rightFormlocation = function () {
  8449. U.selectEl("#U_MD_F_H_R").addAttrArray({
  8450. "style":
  8451. {
  8452. "top": (US.height - 530) / 2,
  8453. "right": "0px"
  8454. }
  8455. }); //
  8456. }
  8457. /*
  8458. 打印消息内容
  8459. 参数一:type(string) 消息种类 例如 文件夹folder 图片 jpg 等
  8460. 参数二:data(json) 文件数据
  8461. 参数三:parent(element) 生成元素
  8462. 参数五:send(boolean) 发送消息为true ,接受消息为false
  8463. 参数四:friend(json) 好友数据
  8464. */
  8465. U.MD.F.W.printMessageContent = function (type, data, parent, send, friend) {
  8466. var _content = $$('div', {}),
  8467. _folder = $$("div", { style: { "cssText": "padding:8px;background:#fff;border-radius:2px;position:relative"} }, _content);
  8468. //创建文件信息类
  8469. var _message = {
  8470. UserFilesServerName: data.UserFilesServerName,
  8471. fileName: data.UserallDirectoryName,
  8472. fileType: data.UserDirectoryExtendType,
  8473. fileSize: data.UserDirectorySize,
  8474. fileID: data.UserDirectoryID,
  8475. fileUrl: data.UserDirectoryUrl,
  8476. filetype: fileType = "folder" ? 1 : 0,
  8477. UserDirectoryExtendType: data.UserDirectoryExtendType,
  8478. UserDirectoryID: data.UserDirectoryID,
  8479. UserallDirectoryName: data.UserallDirectoryName
  8480. };
  8481. U.MD.F.W.printFileContent(_message, _folder);
  8482. //生成消息数据
  8483. var _newsinfo = [{
  8484. "UserId": US.userInfo.UserId,
  8485. "Time": new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds(),
  8486. "Content": _content,
  8487. "IMG": US.userInfo.UserThumbnailImageHead,
  8488. "Name": US.userInfo.UserNickName
  8489. }];
  8490. //是否发送消息
  8491. if (send) {
  8492. //发送记录到数据库
  8493. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SentMessageToFriend", US.userInfo.UserId, friend.UserId, US.userInfo.UserNickName, JSON.stringify(_message), 6, false], function () { });
  8494. }
  8495. //打印在好友聊天
  8496. U.MD.F.W.printFriendChatMessage(parent, _newsinfo, true);
  8497. }
  8498. /*
  8499. 打印消息文件内容
  8500. 参数一:data(json) 文件数据
  8501. 参数二:parent(element) 生成元素
  8502. */
  8503. U.MD.F.W.printFileContent = function (data, parent) {
  8504. var _content, _titile, _icon,
  8505. _type = data.fileType.toLowerCase();
  8506. switch (data.fileType) {
  8507. case "folder": //打印文件夹类型的文件
  8508. _content = $$("div", { style: { "cssText": "width:100%"} }, parent);
  8509. $$("div", { "className": "U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOW", style: { "cssText": "float:none;display:inline-block;"} }, _content);
  8510. _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;"} }, _content);
  8511. $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000"} }, _titile);
  8512. $$("div", { innerHTML: "(" + U.UF.UP.minUnitToMaxUnit(data.fileSize) + ")", style: { "cssText": "color:#aaaaaa;font-size:10px;line-height:10px"} }, _titile);
  8513. $$("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);
  8514. break;
  8515. case "txt": case "html": case "uw": case "ue": //打印文本文件
  8516. _content = $$("div", { style: { "cssText": "width:100%"} }, parent);
  8517. $$("div", { "className": "U_MD_DK_RZOD U_MD_DK_RZOS", style: { "cssText": "float:none;display:inline-block;"} }, _content);
  8518. _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;"} }, _content);
  8519. $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000"} }, _titile);
  8520. $$("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);
  8521. break;
  8522. case "jpg": case "png": //打印图片文件
  8523. $$("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);
  8524. break;
  8525. case "mp4": //打印视频文件
  8526. if (parent.parentElement.className == "U_MD_F_LO") {
  8527. _content = $$("div", { style: { "cssText": "width:100%"} }, parent);
  8528. $$("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);
  8529. _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;"} }, _content);
  8530. $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000"} }, _titile);
  8531. $$("div", { onclick: function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.UserId) }, innerHTML: "查看", style: { "cssText": "color:#429bfe;margin-top:-20px;float:right"} }, parent);
  8532. }
  8533. else {
  8534. $$("img", { "onerror": U.MD.C.imgError, "src": "http://fs.1473.cn/" + data.fileUrl, "style": { "cssText": "width:100%;max-width:300px;"} }, parent);
  8535. _content = $$("div", {}, parent);
  8536. $$("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);
  8537. $$("div", { "innerHTML": data.fileName, "style": { "cssText": "color:white;font-size:16px;position: absolute;top: 137px;margin-left: 10px;"} }, _content);
  8538. $$("span", { "innerHTML": U.UF.UP.minUnitToMaxUnit(data.fileSize), "style": { "cssText": "color:#d4d3d1;font-size:14px;position: absolute;top: 155px;margin-left: 10px;"} }, _content);
  8539. $$("span", { "innerHTML": "已发送", "style": { "cssText": "color:#d4d3d1;font-size:14px;position: absolute;top: 155px;right:20px"} }, _content);
  8540. }
  8541. break;
  8542. default:
  8543. _content = $$("div", { style: { "cssText": "width:100%"} }, parent);
  8544. _icon = $$("div", { "className": "U_MD_DK_RZOS U_MD_DK_Img downel_content_a_r", style: { "cssText": "float:none;display:inline-block;"} }, _content);
  8545. $$("div", { "className": "U_MD_DK_RZOSZ", 'innerHTML': data.fileType }, _icon);
  8546. _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;"} }, _content);
  8547. $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000"} }, _titile);
  8548. $$("div", { innerHTML: "(" + U.UF.UP.minUnitToMaxUnit(data.fileSize) + ")", style: { "cssText": "color:#aaaaaa;font-size:10px;line-height:10px"} }, _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. };
  8552. }
  8553. /**
  8554. *添加聚焦效果
  8555. *
  8556. */
  8557. U.MD.F.W.addChecked = function (friendinfo) {
  8558. var _infotid = friendinfo.UserId || friendinfo.GroupManageID;
  8559. if ($('.U_MD_F_H_ZLZOCOChecked')[0]) {
  8560. U.UF.EL.removeClass($('.U_MD_F_H_ZLZOCOChecked')[0], "U_MD_F_H_ZLZOCOChecked");
  8561. }
  8562. if ($("[tid='" + _infotid + "']")[0]) {
  8563. U.UF.EL.addClass($("[tid='" + _infotid + "']")[0], "U_MD_F_H_ZLZOCOChecked");
  8564. }
  8565. };
  8566. ///<jscompress sourcefile="HistroyMessage.js" />
  8567. Namespace.register("U.MD.F.H"); //好友聊天和群聊天消息命名空间
  8568. //#region 好友和群聊天记录
  8569. //#region 聊天记录
  8570. /**
  8571. * 好友或者群消息
  8572. * @param {element} 聊天框
  8573. * @param {object} 好友或者群信息
  8574. * @param {int} 第几页
  8575. * @param {string} 变化的样式
  8576. */
  8577. U.MD.F.H.viewFriendsChatRecords = function (el, friendandgroupinfo, page, isgroup) {
  8578. //如果聊天记录在显示,那么隐藏聊天记录
  8579. if (el.style.display == "block") {
  8580. el.style.display = "none";
  8581. U.MD.F.W.chatBoxSize($(el).Parent(3), U.selectEl(el).Parent()); //调整大小
  8582. }
  8583. //如果聊天记录没有打开,那么打开聊天记录
  8584. else {
  8585. U.selectEl(el).Child()[1].innerHTML = ""; //清空聊天记录
  8586. U.MD.F.H.chatRecord(el, friendandgroupinfo, page, isgroup);
  8587. el.style.display = "block"; //显示聊天记录框
  8588. }
  8589. U.MD.F.W.chatBoxSize($(el).Parent(8), U.selectEl(el).Parent()); //调整大小
  8590. }
  8591. //
  8592. /**
  8593. * 聊天记录分页
  8594. * @param {element} 聊天框
  8595. * @param {object} 好友或者群信息
  8596. * @param {int} 第几页
  8597. * @param {string} 变化的样式
  8598. */
  8599. U.MD.F.H.chatRecord = function (el, friendandgroupinfo, page, isgroup) {
  8600. var _end = page * 20, //分页的结束位置
  8601. _start = _end - 20; //分页的开始位置
  8602. //群的获取聊天记录
  8603. if (isgroup) {
  8604. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupChatHistory", friendandgroupinfo.GroupManageID, _start, _end], U.MD.F.H.asynChatRecord, ["", el, friendandgroupinfo, page, isgroup]);
  8605. }
  8606. //好友的获取聊天记录
  8607. else {
  8608. 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]);
  8609. }
  8610. }
  8611. //获取聊天记录异步
  8612. U.MD.F.H.asynChatRecord = function (r) {
  8613. var _context = r.context,
  8614. _recentcontactsel = _context[1], //聊天记录元素
  8615. _friendandgroupinfo = _context[2], //好友或者群的信息
  8616. _page = _context[3], //页数
  8617. _isgroup = _context[4], //是否群聊天记录
  8618. _childs = U.selectEl(_recentcontactsel).Child(); //0 聊天记录查看区域 1 分页区域
  8619. r = r.value;
  8620. _childs[0].innerText = ""; //清空聊天记录
  8621. if (r.length) {
  8622. //打印聊天记录
  8623. U.MD.F.H.printChatRecord(_childs[0], r, _friendandgroupinfo);
  8624. //聊天记录到底部
  8625. _childs[0].scrollTop = _childs[0].scrollHeight;
  8626. //如果没有加载分页控件,则加载
  8627. // if (!$("div", _childs[1]).length) {
  8628. // //调用分页接口打印分页
  8629. // new U.UF.P.page(_childs[1], r[0].AllC, 50, _page,
  8630. // function (_page) { U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup); }, 1);
  8631. // }
  8632. //如果没有加载日历控件,则加载
  8633. if (!$("div", _childs[1]).length) {
  8634. var _calendarinput,
  8635. _date = new Date(),
  8636. _allpage = Math.ceil(r[0].AllC / 20),
  8637. _month = _date.getMonth() + 1;
  8638. $$("div", { "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" },
  8639. "onclick": function () {
  8640. U.UF.EV.stopBubble();
  8641. U.selectEl(document).bind("click", function (e) {
  8642. U.selectEl(".U_MD_UI_calendar_bigboard")[0].style.cssText = "display:none";
  8643. })
  8644. U.MD.UI.calendar(_calendarinput, _calendarPlace, false);
  8645. }
  8646. }, _childs[1]); //日历按钮样式
  8647. $$("div", { "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": "全部",
  8648. onclick: function () {
  8649. _calendarinput.value = '';
  8650. _childs[0].innerText = ""; //清空聊天记录
  8651. //打印聊天记录
  8652. U.MD.F.H.printChatRecord(_childs[0], r, _friendandgroupinfo);
  8653. //聊天记录到底部
  8654. _childs[0].scrollTop = _childs[0].scrollHeight;
  8655. }
  8656. }, _childs[1]); //全部按钮样式
  8657. _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]);
  8658. $$("div", { "style": { "width": "13px", "height": "18px", "background-image": "url('/img/YS2017.png')", "background-position": "-891px -481px", "display": "inline-block", "margin": "5px 20px 4px 76px" },
  8659. onclick: function () {
  8660. // this.style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_firstPage.png)';
  8661. _page = Math.ceil(r[0].AllC / 20);
  8662. U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup);
  8663. }
  8664. }, _childs[1]);
  8665. $$("div", { "style": { "width": "11px", "height": "18px", "background-image": "url('/img/YS2017.png')", "background-position": "-924px -481px", "display": "inline-block", "margin": "5px 20px 4px 0px" },
  8666. onclick: function () {
  8667. if (_page <= _allpage - 1) {
  8668. _page++;
  8669. U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup);
  8670. }
  8671. }
  8672. }, _childs[1]);
  8673. $$("div", { "style": { "width": "10px", "height": "17px", "background-image": "url('/img/YS2017.png')", "background-position": "-957px -481px", "display": "inline-block", "margin": "5px 20px 4px 0px" },
  8674. onclick: function () {
  8675. if (_page > 1) {
  8676. _page--;
  8677. U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup);
  8678. }
  8679. }
  8680. }, _childs[1]);
  8681. $$("div", { "style": { "width": "13px", "height": "18px", "background-image": "url('/img/YS2017.png')", "background-position": "-987px -481px", "display": "inline-block", "margin": "5px 13px 4px 0px" },
  8682. onclick: function () {
  8683. // this.style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_lastPage.png)'
  8684. _page = 1;
  8685. U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _page, _isgroup);
  8686. }
  8687. }, _childs[1]);
  8688. _calendarPlace = $$('div', { "style": { cssText: "position:absolute; bottom: 400px; right:317px"} }, _childs[1]);
  8689. U.MD.UI.calendar.SetCallBack("CheckedDay", function () { U.MD.F.H.asynGetRecordByCalendar(_calendarinput.value, _friendandgroupinfo, _childs[0]); });
  8690. }
  8691. }
  8692. else {
  8693. U.alert("暂无消息记录");
  8694. }
  8695. }
  8696. /**
  8697. * 获取指定时间内的消息记录
  8698. * calenderday @param {string} 日历上点击的日期
  8699. * friendandgroupinfo @param {object} 好友或群信息
  8700. * contactsel {element} 消息记录显示位置
  8701. */
  8702. U.MD.F.H.asynGetRecordByCalendar = function (calenderday, friendandgroupinfo, contactsel) {
  8703. var _previousdate = calenderday,
  8704. _nextdate = U.MD.F.H.asynGetNextDay(_previousdate), //获取下一天的时间
  8705. _userid = friendandgroupinfo.UserId ? friendandgroupinfo.UserId : friendandgroupinfo.GroupManageID;
  8706. if (friendandgroupinfo.UserId) {//判断是好友或群的消息记录
  8707. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendChatHistoryByDate",
  8708. US.userInfo.UserId, _userid, _previousdate, _nextdate], function (r) {
  8709. contactsel.innerText = "";
  8710. U.MD.F.H.printChatRecord(contactsel, r.value, friendandgroupinfo);
  8711. }, [contactsel, friendandgroupinfo]);
  8712. } else {
  8713. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupChatHistoryByDate",
  8714. _userid, _previousdate, _nextdate], function (r) {
  8715. contactsel.innerText = "";
  8716. U.MD.F.H.printChatRecord(contactsel, r.value, friendandgroupinfo);
  8717. }, [contactsel, friendandgroupinfo]);
  8718. }
  8719. }
  8720. /**
  8721. * 获取指定时间的下一天
  8722. * date @param {string} 日历上点击的日期
  8723. *
  8724. */
  8725. U.MD.F.H.asynGetNextDay = function (date) {
  8726. var _currdate = new Date(date),
  8727. _nextdate = new Date(_currdate.getTime() + 24 * 60 * 60 * 1000),
  8728. _nextdateyear = (_nextdate.getFullYear().toString())[1] ? _nextdate.getFullYear() : '0' + _nextdate.getFullYear(),
  8729. _nextdatemonth = (_nextdate.getMonth().toString())[1] ? (_nextdate.getMonth() + 1) : '0' + (_nextdate.getMonth() + 1),
  8730. _nextdateday = (_nextdate.getDate().toString())[1] ? _nextdate.getDate() : '0' + _nextdate.getDate(),
  8731. _nextday = _nextdateyear + '-' + _nextdatemonth + '-' + _nextdateday;
  8732. return _nextday;
  8733. }
  8734. /**
  8735. * 聊天记录分页
  8736. * @param {element} 聊天框
  8737. * @param {object} 聊天信息
  8738. * @param {object} 好友信息
  8739. */
  8740. U.MD.F.H.printChatRecord = function (el, recordinfo, friendandgroupinfo) {
  8741. var _tempel,
  8742. _temponeel,
  8743. _temptwoel,
  8744. i = recordinfo.length,
  8745. _frag = $$("frag");
  8746. //循环打印群聊天记录
  8747. while (i--) {
  8748. //U.MD.F.W.printFileContent
  8749. if (recordinfo[i].MessageContent ? recordinfo[i].MessageContent.indexOf("fileName") != -1 : recordinfo[i].GroupMessageContent.indexOf("fileName") != -1) {
  8750. _tempel = $$("div", { "className": "U_MD_F_LO" }, _frag);
  8751. _temponeel = $$("div", { "className": "U_MD_F_LOT" }, _tempel);
  8752. $$("div", { "className": "U_MD_F_LOTN", "innerHTML": recordinfo[i].MessageDescript || recordinfo[i].GroupMessageSendUsername || friendandgroupinfo.FriendsDescript || friendandgroupinfo.GroupManageName }, _temponeel);
  8753. $$("div", { "className": "U_MD_F_LOTT", "innerHTML": U.UF.D.getDateInterval(recordinfo[i].MessageSendTime || recordinfo[i].GroupMessageSendTime) }, _temponeel);
  8754. var _data = JSON.parse(recordinfo[i].MessageContent);
  8755. if (_data.fileType == "jpg" || _data.fileType == "png" || _data.fileType == "mp4") { //判断文件格式是否为图片或者视频 , 不是的话加边框
  8756. var _content = $$("div", { "style": { "cssText": "padding:8px 8px 8px 8px;background:#fff;border-radius:2px;margin-top:12px;position:relative"} }, _tempel);
  8757. } else {
  8758. 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);
  8759. }
  8760. U.MD.F.W.printFileContent(_data, _content);
  8761. } else {
  8762. _tempel = $$("div", { "className": "U_MD_F_LO" }, _frag);
  8763. _temponeel = $$("div", { "className": "U_MD_F_LOT" }, _tempel);
  8764. $$("div", { "className": "U_MD_F_LOTN", "innerHTML": recordinfo[i].MessageDescript || recordinfo[i].GroupMessageSendUsername || friendandgroupinfo.FriendsDescript || friendandgroupinfo.GroupManageName }, _temponeel);
  8765. $$("div", { "className": "U_MD_F_LOTT", "innerHTML": U.UF.D.getDateInterval(recordinfo[i].MessageSendTime || recordinfo[i].GroupMessageSendTime) }, _temponeel);
  8766. $$("div", { "className": "U_MD_F_LOD", "innerHTML": recordinfo[i].MessageContent || recordinfo[i].GroupMessageContent }, _tempel);
  8767. }
  8768. }
  8769. el.appendChild(_frag);
  8770. }
  8771. //#endregion
  8772. /**
  8773. * 发送消息统一调用函数
  8774. * @param {object} 统一发送好友信息id
  8775. ----------好友id
  8776. ----------群id
  8777. ----------群发id
  8778. * @param {element} 发送信息原
  8779. * @param {element} 打印区域函数
  8780. * @param {boolean} 判断消息
  8781. ---------- true 获取群消息 或者发送 群消息
  8782. ---------- false 获取好友消息或者 获取好友消息
  8783. * @param {boolean} 是否清空发送
  8784. */
  8785. U.MD.F.H.sendFriendOrGroupChatMessage = function (friendandgroupinfo, chateditel, chatcontentnewsel, isgroup, isupload) {
  8786. var _newsinfo, //发送消息的打印的变量
  8787. _chatcontent = chateditel.innerHTML, //发送的内容
  8788. _hours = new Date().getHours().toString()[1] ? new Date().getHours() : '0' + new Date().getHours(), //判断时间是否是两位数不是则在前面加0
  8789. _minutes = new Date().getMinutes().toString()[1] ? new Date().getMinutes() : '0' + new Date().getMinutes(),
  8790. _seconds = new Date().getSeconds().toString()[1] ? new Date().getSeconds() : '0' + new Date().getSeconds(),
  8791. _friendid = friendandgroupinfo.UserId || friendandgroupinfo.GroupManageID; //发送给好友或者群的id
  8792. //不为空允许发送内容
  8793. if (_chatcontent.isHtmlNull()) {
  8794. U.MD.F.H.sendChatMessageToDb(_friendid, _chatcontent, null, isgroup); //调用发送数据库的函数
  8795. //发送消息的信息
  8796. _newsinfo = [{
  8797. "UserId": US.userInfo.UserId,
  8798. "Time": _hours + ":" + _minutes + ":" + _seconds,
  8799. "Content": _chatcontent,
  8800. "IMG": US.userInfo.UserThumbnailImageHead,
  8801. "Name": US.userInfo.UserNickName
  8802. }]
  8803. //内容显示在聊天区域
  8804. if (isgroup) {
  8805. U.MD.F.W.printGroupChatMessage(chatcontentnewsel, _newsinfo, true); //打印在群聊天
  8806. }
  8807. else {
  8808. U.MD.F.W.printFriendChatMessage(chatcontentnewsel, _newsinfo, true); //打印在好友聊天
  8809. }
  8810. //判断是否是上传文件,如果是上传文件,那么不清空输入区域的内容直接显示到聊天区域。
  8811. if (!isupload) {
  8812. chateditel.innerText = ""
  8813. }
  8814. }
  8815. }
  8816. /**
  8817. * 查看聊天 好友或者群
  8818. * @param {element} 发送好友的id
  8819. * @param {string} 发送的内容
  8820. ----------如果这里为空 那么就是获取好友信息
  8821. * @param {function} 发送成功回调函数
  8822. * @param {boolean} 判断消息
  8823. ---------- true 获取群消息 或者发送 群消息
  8824. ---------- flase 获取好友消息或者 获取好友消息
  8825. */
  8826. U.MD.F.H.sendChatMessageToDb = function (friendid, message, cb, isgroup) {
  8827. var _friendorgroupinfo, //好友或者群信息
  8828. _userinfo = US.userInfo; //用户的信息
  8829. //发送群消息到数据库
  8830. if (isgroup) {
  8831. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SendMessageToGroup", friendid, Guid.newGuid(), _userinfo.UserId, message, _userinfo.UserNickName], function () { }, [""]);
  8832. }
  8833. //发送好友消息到数据库
  8834. else {
  8835. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SentMessageToFriend", _userinfo.UserId, friendid, _userinfo.UserNickName, message, 0, false], function () { }, [""]);
  8836. }
  8837. //发送消息后根据id得到发送的消息的群或者用户id得到详细信息,然后把这个群或者用户的信息变成第一个最近联系人的第一个
  8838. //如果是群,则获取群用户信息
  8839. if (isgroup) {
  8840. _friendorgroupinfo = U.Json.select(US.friend.group, { "GroupManageID": friendid })[0];
  8841. }
  8842. //如果是聊天好友,则获取群用户信息
  8843. else {
  8844. //从最近聊天里面获取信息
  8845. _friendorgroupinfo = U.Json.select(US.friend.recentcontacts, { "UserId": friendid })[0];
  8846. //如果最近聊天里面没有获取用户的信息,那么就从好友里面获取
  8847. if (_friendorgroupinfo) {
  8848. //获取好友群消息
  8849. _friendorgroupinfo = U.Json.select(US.friend.friends, { "UserId": friendid })[0];
  8850. }
  8851. }
  8852. //如果判断发送的好友或者是群确实在用户好友里,则把该用户设置为最近联系人
  8853. if (_friendorgroupinfo) {
  8854. U.MD.F.H.recentContacts(_friendorgroupinfo); //设置最近联系人
  8855. }
  8856. }
  8857. /**
  8858. * 查看聊天 好友或者群
  8859. * @param {element} 发送好友的id
  8860. * @param {string} 发送的内容
  8861. ----------如果这里为空 那么就是获取好友信息
  8862. * @param {function} 发送成功回调函数
  8863. * @param {boolean} 判断消息
  8864. ---------- true 获取群消息 或者发送 群消息
  8865. ---------- flase 获取好友消息或者 获取好友消息
  8866. */
  8867. U.MD.F.H.getFriendOrGroupNews = function (friendid, cb, isgroup) {
  8868. var _userinfo = US.userInfo; //获取用户的资料
  8869. //如果是群信息获取
  8870. if (isgroup) {
  8871. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupUnreadMessage", _userinfo.UserId, friendid], cb, ["", friendid, isgroup]);
  8872. }
  8873. //如果是好友信息的获取
  8874. else {
  8875. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendUnreadMessage", _userinfo.UserId, friendid], cb, ["", friendid, isgroup]);
  8876. }
  8877. }
  8878. /**
  8879. * 生成最近联系人
  8880. * @param {object} 用户信息
  8881. */
  8882. U.MD.F.H.recentContacts = function (userinfo) {
  8883. var _recentcontactsel,
  8884. _num,
  8885. _recentcontactsinfo,
  8886. _contentel = U.selectEl("#U_MD_F_H_ZLZ")[0];
  8887. if (US.friend.recentcontacts) {
  8888. //判断联系人是否已经在最近联系人中
  8889. _num = US.friend.recentcontacts.objIndexOf({ "UserId": userinfo.UserId }) || US.friend.recentcontacts.objIndexOf({ "GroupManageID": userinfo.GroupManageID });
  8890. //如果存在最近联系人,那么直接从最近联系人中找到
  8891. if (_num > -1) {
  8892. _recentcontactsinfo = US.friend.recentcontacts.splice(_num, 1)[0];
  8893. }
  8894. //否则生成一个新的最近联系人
  8895. else {
  8896. //生成一个新的最近联系人
  8897. _recentcontactsinfo = new U.MD.F.T.recentContactsEntity(userinfo.GroupManageID || userinfo.UserId,
  8898. userinfo.GroupManageName || userinfo.UserName, userinfo.UserImageHead || "", userinfo.UserNickName || "",
  8899. userinfo.UserThumbnailImageHead || "", userinfo.maxMessageSendTime || new Date(),
  8900. userinfo.GroupManageDescript || userinfo.FriendsDescript, userinfo.GroupManageRemark || userinfo.UserIndividualitysignature || "",
  8901. userinfo.IsLogin || 3, userinfo.GroupManageID ? 1 : 0);
  8902. }
  8903. //如果存在就直接置顶 不存在添加新的
  8904. US.friend.recentcontacts.unshift(_recentcontactsinfo);
  8905. //找到最近联系人按钮
  8906. _recentcontactsel = U.selectEl("#U_MD_F_H_ZLTA").childs()[0];
  8907. _recentcontactsel = U.selectEl(_recentcontactsel).Child()[0];
  8908. //如果当前显示的不是好友、群而是最近联系人,那么则重新打印
  8909. if (_recentcontactsel.className.indexOf("U_MD_F_H_ZLTSO") > -1) {
  8910. _recentcontactsel = U.selectEl("[tid='" + (userinfo.GroupManageID || userinfo.UserId + "']"), U.selectEl("#U_MD_F_H_ZLZ")[0])[0]; //获取最近联系人
  8911. //如果最近联系人原本就存在,则直接追加到最前面
  8912. if (_recentcontactsel) {
  8913. ($(_recentcontactsel).appendTo(_contentel, 0, _contentel.firstChild)); //追加到第一个
  8914. }
  8915. //否则打印最近联系人
  8916. else {
  8917. U.MD.F.printFriendOrGroup(_contentel, US.friend.recentcontacts[0], true); //插入最新联系人在最前面
  8918. }
  8919. }
  8920. }
  8921. }
  8922. /**
  8923. *检查当前页数的前后两页是否有消息记录,没有则取消点击事件
  8924. *
  8925. *
  8926. */
  8927. //U.MD.F.H.nextOrPreviousNoRecord = function (el, friendandgroupinfo, page, isgroup) {
  8928. // var _previouspage = page - 1,
  8929. // _nextpage = page + 1,
  8930. // _recentcontactsel = el,
  8931. // _friendandgroupinfo = friendandgroupinfo,
  8932. // _previousend = _previouspage * 20, //分页的结束位置
  8933. // _previousstart = _previousend - 20, //分页的开始位置
  8934. // _nextend = _nextpage * 20, //分页的结束位置
  8935. // _nextstart = _nextend - 20; //分页的开始位置
  8936. // //群的获取聊天记录
  8937. // if (isgroup) {
  8938. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupChatHistory", friendandgroupinfo.GroupManageID, _previousstart, _previousend], function (r) {
  8939. // if (!r.value.length) {
  8940. // el.children[1].children[3].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_firstPage.png)';
  8941. // el.children[1].children[4].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_previousPage.png)'
  8942. // el.children[1].children[4].onclick = function () { };
  8943. // }
  8944. // else {
  8945. // el.children[1].children[3].style.cssText += 'background-position: -891px -481px;background-image: url(/img/YS2017.png)';
  8946. // el.children[1].children[4].style.cssText += 'background-position: -924px -481px;background-image: url(/img/YS2017.png);'
  8947. // el.children[1].children[4].onclick = function () {
  8948. // U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _previouspage, isgroup);
  8949. // };
  8950. // }
  8951. // }, ["", el, friendandgroupinfo, page, isgroup]);
  8952. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetGroupChatHistory", friendandgroupinfo.GroupManageID, _nextstart, _nextend], function (r) {
  8953. // if (!r.value.length) {
  8954. // el.children[1].children[6].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_lastPage.png)'
  8955. // el.children[1].children[5].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_nextPage.png)'
  8956. // el.children[1].children[5].onclick = function () { };
  8957. // } else {
  8958. // el.children[1].children[6].style.cssText += 'background-position: -987px -481px;background-image: url(/img/YS2017.png);'
  8959. // el.children[1].children[5].style.cssText += 'background-position: -957px -481px;background-image: url(/img/YS2017.png);'
  8960. // el.children[1].children[5].onclick = function () {
  8961. // U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _nextpage, isgroup);
  8962. // };
  8963. // }
  8964. // }, ["", el, friendandgroupinfo, page, isgroup]);
  8965. // }
  8966. // //好友的获取聊天记录
  8967. // else {
  8968. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendChatHistory", US.userInfo.UserId, friendandgroupinfo.UserId, _previousstart, _previousend], function (r) {
  8969. // if (!r.value.length) {
  8970. // el.children[1].children[3].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_firstPage.png)';
  8971. // el.children[1].children[4].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_previousPage.png)'
  8972. // el.children[1].children[4].onclick = function () { };
  8973. // } else {
  8974. // el.children[1].children[3].style.cssText += 'background-position: -891px -481px;background-image: url(/img/YS2017.png)';
  8975. // el.children[1].children[4].style.cssText += 'background-position: -924px -481px;background-image: url(/img/YS2017.png);'
  8976. // el.children[1].children[4].onclick = function () {
  8977. // U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _previouspage, isgroup);
  8978. // };
  8979. // }
  8980. // }, ["", el, friendandgroupinfo, page, isgroup]);
  8981. // U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "GetFriendChatHistory", US.userInfo.UserId, friendandgroupinfo.UserId, _nextstart, _nextend], function (r) {
  8982. // if (!r.value.length) {
  8983. // el.children[1].children[6].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_lastPage.png)'
  8984. // el.children[1].children[5].style.cssText += 'background-position:0;background:url(/BoomYun/img/pc/U_MD_F_H_nextPage.png)'
  8985. // el.children[1].children[5].onclick = function () { };
  8986. // } else {
  8987. // el.children[1].children[6].style.cssText += 'background-position: -987px -481px;background-image: url(/img/YS2017.png);'
  8988. // el.children[1].children[5].style.cssText += 'background-position: -957px -481px;background-image: url(/img/YS2017.png);'
  8989. // el.children[1].children[5].onclick = function () {
  8990. // U.MD.F.H.chatRecord(_recentcontactsel, _friendandgroupinfo, _nextpage, isgroup);
  8991. // };
  8992. // }
  8993. // }, ["", el, friendandgroupinfo, page, isgroup]);
  8994. // }
  8995. //}
  8996. //#endregion
  8997. ;
  8998. ///<jscompress sourcefile="Manage.js" />
  8999. /*
  9000. 好友管理器中心 包含了 删除好友 修改好友名字等接口
  9001. */
  9002. Namespace.register("U.MD.F.M"); //好友管理器的命名空间
  9003. //#region 添加好友分组
  9004. /**
  9005. * 弹出好友分组
  9006. *
  9007. */
  9008. U.MD.F.M.createFriendGroupPopup = function () {
  9009. var _tempel,
  9010. _temponeel,
  9011. _temptwoel;
  9012. //创建好友分组的样式
  9013. _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNLFZ U_MD_F_G" });
  9014. _temponeel = $$("div", {}, _tempel)
  9015. _temptwoel = $$("input",
  9016. {
  9017. "placeholder": "请输入你要创建的分组",
  9018. "onfocus": function () {
  9019. U.UF.MR.inputPlaceholder(this, '请输入你要创建的分组名', "")
  9020. },
  9021. "onblur": function () {
  9022. U.UF.MR.inputPlaceholder(this, "", '请输入你要创建的分组名');
  9023. }
  9024. }, _temponeel);
  9025. //弹出好友对话框
  9026. U.UF.UI.confirm(_tempel, function () {
  9027. U.MD.F.M.createFriendGroup(_temptwoel);
  9028. }); //创建一个对话框
  9029. }
  9030. /**
  9031. * 确定添加好友
  9032. *
  9033. * @param {string} 好友分组id
  9034. */
  9035. U.MD.F.M.createFriendGroup = function (inputel) {
  9036. var _value = inputel.value, //好友分组名字
  9037. _groupid = Guid.newGuid(); //好友分组id
  9038. //好友分组的名字不能大于20
  9039. if (_value.length > 20) {
  9040. U.alert("分组名不可超过20个字符");
  9041. }
  9042. //好友分组名字必须填写
  9043. else if (!_value.isStrNull() && _value != inputel.defaultValue) {
  9044. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "CreateFriendClass", _groupid, US.userInfo.UserId, _value, ""], U.MD.F.M.asynCreateFriendGroup, ["", _value, _groupid]); //发送添加分组的请求
  9045. }
  9046. //没有输入的提示
  9047. else {
  9048. U.alert("请输入正确的群名");
  9049. }
  9050. }
  9051. //添加好友分组异步
  9052. U.MD.F.M.asynCreateFriendGroup = function (r) {
  9053. var _groupinfo,
  9054. _context = r.context;
  9055. r = r.value; //得到服务器返回的值
  9056. _groupinfo = new U.MD.F.T.friendGroupEntity(_context[2], _context[1], ""); //初始化一个好友分组
  9057. //在好友数组的全局变量中添加好友分组的信息
  9058. US.friend.allclass.push(_groupinfo);
  9059. //重新点击打印好友分组,重新刷新分组
  9060. U.selectEl($("#U_MD_F_H_ZLTA").Child()[1]).Child()[0].onclick();
  9061. //提示创建成功
  9062. U.alert("创建" + _context[1] + "分组成功");
  9063. }
  9064. //#endregion
  9065. //#region 删除好友
  9066. /**
  9067. * 删除好友
  9068. *
  9069. * @param {object} 删除用户信息
  9070. */
  9071. U.MD.F.M.deleteFriend = function (friendinfo, callback) {
  9072. //数据库中删除好友
  9073. U.A.Request(US.FRIEND, ["DeleteFriend", US.userInfo.UserId, friendinfo.FriendsID, friendinfo.UserId], U.MD.F.M.asynDeleteFriend, ["", friendinfo, callback]); //ajax删除好友
  9074. }
  9075. /**
  9076. * 删除好友异步
  9077. *
  9078. * @param {object} 删除用户信息
  9079. */
  9080. U.MD.F.M.asynDeleteFriend = function (r) {
  9081. var _context = r.context,
  9082. _message = "好友已删除",
  9083. _friendinfo = _context[1]; //好友的信息;
  9084. U.Json.del(US.friend.friends, { "FriendsID": _friendinfo.FriendsID }); //好友集里删除好友
  9085. U.Json.del(US.friend.recentcontacts, { "UserId": _friendinfo.UserId }); //最近聊天集里删除好友
  9086. //判断是否在当前好友选取下
  9087. if ($('#U_MD_F_H_ZLTA .U_MD_F_H_ZLTOO')[0]) {
  9088. var _friendclassinfo = U.Json.select(US.friend.allclass, { "FriendsGroupID": _friendinfo.FriendsGroupID })[0], //好友分组的信息
  9089. _friendclassuserinfo = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo.FriendsGroupID }), //好友分组的信息
  9090. _el = U.selectEl(".U_MD_F_H_ZLZOCO"), //获取用户的所有好友
  9091. _friendel = U.selectEl('#g' + _friendclassinfo.FriendsGroupID).Child(),
  9092. _switchbootom = U.selectEl("#U_MD_F_H_ZLTA").Child(); //好友或者群切换按钮
  9093. //删除好友元素
  9094. for (var i = 0; i < _el.length; i++) {
  9095. if (_el[i].tid == _friendinfo.UserId) {//获取指定的删除的好友
  9096. U.selectEl(_el[i]).remove(); //删除指定的好友元素
  9097. U.MD.F.W.delteFriendChat(_el[i].tid, U.selectEl("#U_MD_F")[0]); //删除指定的好友聊天窗口
  9098. _friendel[0].innerHTML = _friendclassinfo.FriendsGroupName + "(" + (_friendclassuserinfo.length) + ")"; //修改分组长度
  9099. break;
  9100. }
  9101. }
  9102. //修改好友信息
  9103. //如果所有好友都清空了,那么则打印空好友的提示
  9104. if (US.friend.allclass.length == 1 && !_friendclassuserinfo.length) {
  9105. U.MD.F.printHasNoFriend(_friendel[1]);
  9106. }
  9107. _message = '好友' + (_friendinfo.UserNickName || _friendinfo.UserName) + '已从好友列表中删除';
  9108. }
  9109. //判断是否在最近聊天选取下
  9110. if ($('#U_MD_F_H_ZLTA .U_MD_F_H_ZLTTO')[0]) {
  9111. var _el = U.selectEl(".U_MD_F_H_ZLZOCO"); //获取用户的所有好友
  9112. //删除好友元素
  9113. for (var i = 0; i < _el.length; i++) {
  9114. if (_el[i].tid == _friendinfo.UserId) {//获取指定的删除的好友
  9115. U.selectEl(_el[i]).remove(); //删除指定的好友元素
  9116. U.MD.F.W.delteFriendChat(_el[i].tid, U.selectEl("#U_MD_F")[0]); //删除指定的好友聊天窗口
  9117. break;
  9118. }
  9119. }
  9120. }
  9121. var _win = U.selectEl('.U_MD_F_TO[user="9dff9339-2d37-4072-b62e-3b0a027ae997"]');
  9122. _win[0] && U.selectEl('.U_MD_F_TOC', _win)[0].onclick();
  9123. U.UF.C.isFunction(_context[2]) && _context[2]();
  9124. U.alert(_message);
  9125. };
  9126. //#endregion
  9127. //#region 添加好友
  9128. /**
  9129. * 添加好友
  9130. *
  9131. * @param {object} 用户信息
  9132. * @param {object} 回调函数
  9133. * @param {object} 删除用户信息
  9134. */
  9135. U.MD.F.M.addFriend = function (userinfo, cb, typename) {
  9136. if (!U.MD.U.L.isLogin()) {
  9137. typename = typename || "1"; //判断是添加直接对方为好友还是添加对方为好友需好友验证。
  9138. //无法加本人为好友 同时不可与本人对话
  9139. if (userinfo.UserId != US.userInfo.UserId) {
  9140. //在好友里获取用户
  9141. var _friendinfo = U.Json.select(US.friend.friends, { "UserId": userinfo.UserId })[0];
  9142. //判断是否已经添加了用户
  9143. if (!_friendinfo) {
  9144. U.MD.F.M.addFriendForm(userinfo, cb, typename); //弹出添加好友框
  9145. }
  9146. //如果用户已经是自己的好友,那么直接跳出聊天
  9147. else {
  9148. U.MD.F.W.popupFriendsForm(_friendinfo); //弹出聊天框
  9149. }
  9150. } else { U.Alert("不可以添加自己为好友哟!"); }
  9151. }
  9152. else { U.Alert("快速登录关注他(她)吧"); }
  9153. }
  9154. /**
  9155. * 添加好友
  9156. *
  9157. * @param {object} 用户信息
  9158. * @param {object} 删除用户信息
  9159. */
  9160. U.MD.F.M.addFriendForm = function (userinfo, cb, typename) {
  9161. var i,
  9162. _formel,
  9163. _tempel,
  9164. _temponeel,
  9165. _temptwoel,
  9166. _tempthreeel,
  9167. _tempfourel,
  9168. _friendgroupinfo = US.friend.allclass; //好友分组
  9169. var _date = new Date();
  9170. //创建添加好友信息分组信息
  9171. _tempel = $$("div", { "className": "U_MD_U_UV_IAC" });
  9172. _temponeel = $$("div", { "className": "U_MD_U_UV_IACA" }, _tempel);
  9173. _temptwoel = $$("div", { "className": "U_MD_U_UV_IACL" },
  9174. _temponeel); _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACLT" }, _temptwoel);
  9175. $$("img",
  9176. {
  9177. "onerror": U.MD.C.imgError,
  9178. "title": "点击查看",
  9179. "src": U.MD.C.getHeadImage(userinfo.UserThumbnailImageHead)
  9180. },
  9181. _tempthreeel);
  9182. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACLB" }, _temptwoel);
  9183. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": userinfo.UserNickName || userinfo.UserName }, _tempthreeel);
  9184. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": "性别:" + (userinfo.UserSex ? "男" : "女") }, _tempthreeel);
  9185. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": "年龄:" + (U.UF.D.getYearMonthDay(_date.toLocaleDateString())[3] - U.UF.D.getYearMonthDay(userinfo.Birthday)[3]) }, _tempthreeel);
  9186. _temptwoel = $$("div", { "className": "U_MD_U_UV_IACR" }, _temponeel);
  9187. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACRT" }, _temptwoel);
  9188. $$("div", { "className": "U_MD_U_UV_IACRTL", "innerHTML": "备注姓名:" }, _tempthreeel);
  9189. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACRTR" }, _tempthreeel);
  9190. _memoName = $$("input", { "value": userinfo.UserNickName || userinfo.UserName }, _tempthreeel);
  9191. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACRB" }, _temptwoel);
  9192. $$("div", { "className": "U_MD_U_UV_IACRBL", "innerHTML": "分&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp组:" }, _tempthreeel);
  9193. _tempthreeel = $$("div", { "className": "U_MD_U_UV_IACRBR" },
  9194. _tempthreeel);
  9195. _tempfourel = $$("select", {}, _tempthreeel);
  9196. //添加用户到制定的好友分组处理
  9197. _tempfourel.options.length = _friendgroupinfo.length;
  9198. for (i = 0; i < _friendgroupinfo.length; i++) {
  9199. _tempfourel.options[i].text = _friendgroupinfo[i].FriendsGroupName;
  9200. }
  9201. //创建好友分组的弹框
  9202. _formel = U.UF.UI.confirm(_tempel, function () {
  9203. U.MD.F.M.addFriendToDb(userinfo, cb, _tempfourel, _temponeel, typename, _memoName.value);
  9204. });
  9205. _formel.form.style.width = "400px";
  9206. }
  9207. /**
  9208. * 确定添加好友
  9209. *
  9210. * @param {object} 删除用户信息
  9211. * @param {function} 删除用户信息
  9212. */
  9213. U.MD.F.M.addFriendToDb = function (userinfo, cb, selectel, loadingel, typename, _memoName) {
  9214. var _friendgroupinfo = US.friend.allclass[selectel.selectedIndex], //获取用户选择的分组
  9215. _groupid = _friendgroupinfo.FriendsGroupID, //好友分组id
  9216. _friendid = Guid.newGuid(), //用户在分组里面的唯一识别id
  9217. _messageid = Guid.newGuid(); //用户发送的消息的唯一识别id
  9218. _descript = U.selectEl(".U_MD_U_UV_IACRTR")[0].childNodes[0].value; //用户备注
  9219. //添加好友分组的ajax
  9220. //对方发送添加好友信息给你,同意后把用户直接加到好友分组里
  9221. if (typename == "0") {
  9222. U.A.Request(US.FRIEND, ["AgreeAddFriend", US.userInfo.UserId, userinfo.UserId, _friendid, _groupid, (userinfo.UserNickName || userinfo.UserName), userinfo.MessageContent.toUpperCase()],
  9223. U.MD.F.M.asynAddFriendToDb, [loadingel, _groupid, userinfo, _friendgroupinfo, cb, _friendid]); //添加好友到默认分组
  9224. }
  9225. //添加用户为好友
  9226. else {
  9227. 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]); //添加好友到默认分组
  9228. }
  9229. //提示
  9230. //U.alert("正在添加中...");
  9231. return false;
  9232. }
  9233. /**
  9234. * 添加好友到分组异步
  9235. *
  9236. * @param {object} 添加成功后的信息
  9237. */
  9238. U.MD.F.M.asynAddFriendToDb = function (r) {
  9239. var _context = r.context,
  9240. _loadingel = _context[0], //loading元素
  9241. _groupid = _context[1], //群id
  9242. _userinfo = _context[2], //用户的信息
  9243. _friendgroupinfo = _context[3], //
  9244. _cb = _context[4],
  9245. _friendid = _context[5];
  9246. r = r.value;
  9247. //同意添加对方为好友的时候处理
  9248. if (r) {
  9249. //设置添加好友
  9250. U.MD.F.M.displayAddFriend(_userinfo, _friendid, _groupid, _friendgroupinfo, r);
  9251. //添加好友的回调处理
  9252. if (_cb) {
  9253. _cb();
  9254. }
  9255. U.alert('添加好友成功,快和他发起聊天吧');
  9256. }
  9257. //添加对方为好友,给对方发送消息处理
  9258. else {
  9259. U.alert("您的请求已经发送,请等待对方的同意。");
  9260. }
  9261. //关闭loading的弹窗
  9262. U.selectEl(_loadingel).Parent({ usform: "true" }).remove();
  9263. }
  9264. /**
  9265. * 添加好友成功后的处理
  9266. *
  9267. * @param {object} 添加成功后的信息
  9268. */
  9269. U.MD.F.M.displayAddFriend = function (userinfo, friendid, classid, friendgroupinfo, r) {
  9270. var _childs,
  9271. _groupel,
  9272. //好友分组的信息
  9273. _friendinfo = new U.MD.F.T.friendEntity(userinfo.UserIndividualitysignature, userinfo.UserId, userinfo.UserImageHead,
  9274. userinfo.UserThumbnailImageHead, userinfo.UserNickName || userinfo.UserName,
  9275. userinfo.UserName, friendid, userinfo.UserNickName || userinfo.UserName, classid, 0);
  9276. _friendinfo["IsLogin"] = r[1] == "True" ? 1 : 0; //设置用户在线
  9277. US.friend.friends.unshift(_friendinfo); //添加好友到好友列表里
  9278. //打印聊天显示窗体
  9279. _groupel = U.selectEl("#g" + classid);
  9280. if (_groupel[0]) {
  9281. _childs = U.selectEl(_groupel).Child(); //0 好友分组信息 1好友信息
  9282. //如果是第一次添加好友,那么提示好友的信息删除
  9283. if (US.friend.friends.length == 1) {
  9284. U.selectEl("#U_MD_F_H_ZR")[0].innerText = "";
  9285. };
  9286. //打印添加的好友信息
  9287. U.MD.F.printFriendOrGroup(_childs[1], [_friendinfo], true); //打印好友
  9288. //好友分组信息
  9289. _childs[0].innerText = friendgroupinfo["FriendsGroupName"] + "(" + (U.Json.select(US.friend.friends, { "FriendsGroupID": classid }).length) + ")";
  9290. };
  9291. //添加成功后打开好友聊天对话
  9292. U.MD.F.W.popupFriendsForm(_friendinfo);
  9293. //右边的好友窗体也重新打印
  9294. if (!US.friend.recentcontacts.length) {
  9295. U.MD.F.printRightFormFriend(US.friend.friends, U.selectEl("#U_MD_F_H_RC")[0]);
  9296. }
  9297. }
  9298. //#endregion
  9299. ;
  9300. ///<jscompress sourcefile="Message.js" />
  9301. Namespace.register("U.MD.F.N"); //好友消息命名空间
  9302. U.MD.F.N.news = []; //用户所有的消息数组
  9303. /**
  9304. * 好友消息服务
  9305. *
  9306. * @param {string} 用户id
  9307. */
  9308. U.MD.F.N.messageService = function (userid) {
  9309. if (US.friend.allclass && userid && userid.length == 36) {
  9310. //获取好友未读消息
  9311. U.A.Request(US.USER, ["GetAllUnreadMessage", userid], U.MD.F.N.asynMessageService);
  9312. }
  9313. }
  9314. /**
  9315. * 这个是消息的异步处理
  9316. *
  9317. * @param {object} 后台返回数据的ajax对象
  9318. * 0 好友未读消息 1 用户在服务器的状态
  9319. */
  9320. U.MD.F.N.asynMessageService = function (r) {
  9321. r = r.value;
  9322. if (r) { //如果后台有返回数据的处理
  9323. var i,
  9324. _userinfo = US.userInfo, //登录用户的信息
  9325. _statenew = r[1];
  9326. //如果状态服务器里返回的数据在前端最终生成是字符串,那么就是用户的登录状态的变化
  9327. if (typeof _statenew == "string") {
  9328. U.MD.F.N.inlineNotice(_statenew);
  9329. }
  9330. //否则就是用户获取到自己的好友和其他的信息
  9331. else {
  9332. U.MD.F.N.friendOnlineAndOffline(_statenew); //用户上下线设置
  9333. U.MD.F.N.messageHandle(r); //聊天消息的处理
  9334. }
  9335. }
  9336. }
  9337. /**
  9338. * 好友的上下线处理
  9339. *
  9340. * @param {object} 后台返回数据的ajax对象
  9341. * 0 好友未读消息 1 用户在服务器的状态
  9342. */
  9343. U.MD.F.N.friendOnlineAndOffline = function (statenew) {
  9344. var i,
  9345. j,
  9346. k,
  9347. _num,
  9348. _el,
  9349. _idarr,
  9350. _friendform = U.selectEl("#U_MD_F_H_ZLZ")[0], //好友窗体
  9351. _userid = US.userInfo.UserId, //登录用户id
  9352. _friendinfo = US.friend; //好友信息数组
  9353. //循环上下线通知 0是下线的用户,1是上线的用户
  9354. for (i = 0; i < statenew.length; i++) {
  9355. //如果有上线或者下线的用户
  9356. if (statenew[i].length) {
  9357. //获取所有上下线的数组
  9358. _idarr = statenew[i].join(",");
  9359. //循环好友的数组 0 好友分组 1 所有的好友 2 好友群 3 群好友 4 在线用户 中的 1 、 3 、4
  9360. for (j = 0; j < 3; j++) {
  9361. _num = j = 0 ? 1 : j + 2; //1、3、4的规律算法
  9362. for (k = 0; k < _friendinfo[_num].length; k++) {
  9363. //如果用户在上下线操作里面
  9364. if (_idarr.indexOf(_friendinfo[_num][k].UserId) > -1) {
  9365. _friendinfo[_num][k].IsLogin = i; //设置是否登录的处理
  9366. }
  9367. }
  9368. U.Json.sort(US.friend[_num], "IsLogin", 1); //上下线后重新排序
  9369. }
  9370. //把上线的用户置顶,下线的用户放在下面
  9371. for (j = 0; j < statenew[i].length; j++) {
  9372. _el = U.selectEl("[tid='" + statenew[i][j] + "']", _friendform); //找到指定的元素
  9373. if (_el[0]) {
  9374. U.selectEl(_el[0].Parent()).append(_el, null, i ? _el[0].Parent().firstChild : null);
  9375. }
  9376. }
  9377. }
  9378. }
  9379. }
  9380. /**
  9381. * 下线通知区域
  9382. *
  9383. * @param {object} 后台返回数据的ajax对象
  9384. * 0 好友未读消息 1 用户在服务器的状态
  9385. */
  9386. U.MD.F.N.inlineNotice = function (userstate) {
  9387. //其它地方登录
  9388. if (userstate == "upline") {
  9389. return; //前期允许多点登录
  9390. //其他地方登录弹出提示框
  9391. U.UF.UI.confirm($$("div", {
  9392. "style": {
  9393. "textAlign": "center",
  9394. "marginTop": "25px",
  9395. "padding": "10px 0",
  9396. "fontSize": "14px",
  9397. "color": "red"
  9398. },
  9399. "innerHTML": "您好, 您的账号在别处有登录!"
  9400. }));
  9401. U.MD.U.LO.logout(); //注销账号信息
  9402. }
  9403. //超时重新连接
  9404. else {
  9405. U.A.Request(US.FRIEND, ["UserStateLogin", US.userInfo.UserName, US.userInfo.UserPassword], function () { });
  9406. }
  9407. }
  9408. /**
  9409. * 消息查看
  9410. *
  9411. * @param {object} 0 好友和群消息 1 交互消息
  9412. */
  9413. U.MD.F.N.messageHandle = function (arr) {
  9414. //好友消息和群消息的处理
  9415. if (arr[0]) {
  9416. U.MD.F.N.friendMessageHandle(arr[0]);
  9417. }
  9418. if (arr[1]) {
  9419. U.MD.F.N.otherNews(arr[1]);
  9420. }
  9421. }
  9422. //点击查看消息
  9423. /**
  9424. * 消息查看
  9425. *
  9426. * @param {object} 0 好友和群消息 1 交互消息
  9427. */
  9428. U.MD.F.N.friendMessageHandle = function (newsarr) {
  9429. var i, j, k,
  9430. _issound,
  9431. _isnews,
  9432. _obj,
  9433. _form,
  9434. _news,
  9435. _isgroup, //是否是群消息
  9436. _verify, //消息类型
  9437. _allnews = U.MD.F.N.news //还有消息数组
  9438. ;
  9439. //循环消息数组 0 好友消息, 1群消息
  9440. for (j = 0; j < newsarr.length; j++) {
  9441. _news = newsarr[j]; //得到好友或者群消息
  9442. //判断是否存在
  9443. if (_news) {
  9444. //好友消息或者群消息循环处理 由于好友或者群消息有多种消息 如添加还有消息、好友聊天消息,进入群消息,群聊天消息等,
  9445. for (i = 0; i < _news.length; i++) {
  9446. _obj = null; //清空obj
  9447. _isgroup = _news[i].UserId == null; //判断消息是什么消息
  9448. _verify = _news[i].MessageIsVerify || 0; //如果没有消息的类型,暂时只有群消息的时候才会触发
  9449. _allnews[_verify] = _allnews[_verify] || []; //设置功能
  9450. // _verify = _verify == 6 ? 0 : _verify;
  9451. switch (_verify) {
  9452. //好友或者群聊天消息
  9453. case 0: case 6:
  9454. _news[i].MessageSendTime = U.UF.D.getYearMonthDay(_news[i].MessageSendTime) || U.UF.D.getYearMonthDay(_news[i].GroupMessageSendTime); //发送消息的时间
  9455. _form = U.MD.F.W.isCreateForm(_news[i].UserId || _news[i].GroupManageID); //判断好友消息窗口是否打开
  9456. //如果窗体存在的处理
  9457. if (_form && _form[1] && U.selectEl('#U_MD_F_H_ZA')[0].style.display == 'block' && _form[1].style.display != "none") {
  9458. //如果没有显示
  9459. U.MD.F.N.canelMarkMessage(_news[i]); //移除消息提示
  9460. //获取消息打印
  9461. U.MD.F.H.getFriendOrGroupNews(_news[i].UserId || _news[i].GroupManageID, function (r) {
  9462. U.MD.F.N.asynReceiveMessages(_isgroup, _form[1], r.value); //输出消息
  9463. }, _isgroup);
  9464. _issound = true;
  9465. continue;
  9466. }
  9467. U.MD.F.H.recentContacts(_news[i]); //生成最近联系人
  9468. break;
  9469. //1、对方添加我为好友的请求, 2、对方请求加入群, 3、用户给拉入群处理 这里不做处理下面统一处理, 4、请求对方进入群处理, 5、确认对方进入群处理
  9470. case 1: case 2: case 3: case 4: case 5:
  9471. //_allnews[_verify].push(_news[i]);
  9472. break;
  9473. }
  9474. //判断消息是否存在过
  9475. for (k = 0; k < _allnews[_verify].length; k++) {
  9476. //判断两个用户之间或者用户和群之间是否存在消息
  9477. if ((_allnews[_verify][k].GroupManageID != null && _allnews[_verify][k].GroupManageID == _news[i].GroupManageID) ||
  9478. (_allnews[_verify][k].UserId != null && _allnews[_verify][k].UserId == _news[i].UserId)) {
  9479. _obj = _allnews[_verify][k];
  9480. break;
  9481. }
  9482. }
  9483. //如果是聊天消息,存在的情况下,那么就直接添加消息总数
  9484. if ((_verify == 0 || _verify == 6) && _obj) {
  9485. //由于群的信息获取的时候都是有总数,所以不需要用叠加的方法
  9486. if (_news[i].GroupManageID) {
  9487. if (_news[i].count > _obj.count) {
  9488. _issound = true;
  9489. }
  9490. _obj.count = _news[i].count;
  9491. }
  9492. //消息的数量叠加
  9493. else {
  9494. _issound = true;
  9495. _obj.count += _news[i].count;
  9496. }
  9497. }
  9498. //添加好友消息等直接添加 if (!_obj || _verify != 2)
  9499. else {
  9500. _issound = true;
  9501. _allnews[_verify].push(_news[i]);
  9502. }
  9503. _isnews = true; //设置有消息提醒
  9504. }
  9505. }
  9506. }
  9507. //判断是否有新消息
  9508. if (_issound) {
  9509. U.MD.F.N.addNewsSound($('.U_MD_D_NewsTipsIcon')[0], _allnews);
  9510. }
  9511. //如果有消息的处理
  9512. if (_isnews) {
  9513. //弹出消息提醒
  9514. U.MD.F.N.tipsForm();
  9515. //消息提醒次数
  9516. U.MD.F.N.markUnreadMessage(newsarr);
  9517. //上面处理好信息后,重新的打印显示消息
  9518. for (i = 0; i <= 6; i++) { //消息处理
  9519. if (_allnews[i] && _allnews[i].length) { //消息存在的处理
  9520. U.MD.F.N.displayFriendMessage(_allnews[i], i); //弹出消息框
  9521. }
  9522. }
  9523. }
  9524. }
  9525. /**
  9526. * 消息提醒窗体
  9527. *
  9528. * @param {string} 时间字符串
  9529. */
  9530. U.MD.F.N.tipsForm = function () {
  9531. var _friendel = U.selectEl("#U_MD_D_MG_AFT")[0];
  9532. _friendel.innerText = "";
  9533. if (!$('.U_MD_F_N_IconAnimation')[0]) {
  9534. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className += ' U_MD_F_N_IconAnimation';
  9535. }
  9536. U.selectEl('.U_MD_D_NewsTipsIcon')[0].onmouseover = function () {
  9537. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className = 'U_MD_D_NewsTipsIcon';
  9538. if (!$("#U_MD_F_N_Message")[0]) {
  9539. //弹出消息的处理
  9540. new U.UF.UI.form(US.userInfo.UserNickName, _friendel,
  9541. {
  9542. "id": "U_MD_F_N_Message",
  9543. "style": { 'position': 'absolute', "width": "233px", "height": "343px", "left": "-100px", "bottom": "52px", "background": "#ffffff", "padding": "0", "border": "0", "maxWidth": "300px" }
  9544. },
  9545. {
  9546. "istop": true,
  9547. "isdrag": false,
  9548. "isstretching": false,
  9549. "isenlarge": false,
  9550. "isnarrow": false,
  9551. "isclose": false,
  9552. "closecallback": function () {
  9553. U.MD.F.N.clearAllNews();
  9554. }
  9555. }, { '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'} },
  9556. '', '', U.selectEl('.U_MD_D_NewsTipsIcon')[0]);
  9557. if (!$('.U_MD_F_N_MessageTop')[0]) {
  9558. $$('div', { 'innerHTML': '全部忽略', 'className': 'U_MD_F_N_MessageTop', 'onclick': function () {
  9559. U.UF.EV.stopBubble();
  9560. U.MD.F.N.clearAllNews();
  9561. U.MD.F.N.delAllNewsTips();
  9562. U.MD.F.N.canelAllMarkMessage();
  9563. }
  9564. }, U.selectEl('#U_MD_F_N_MessageHead')[0]);
  9565. }
  9566. }
  9567. else {
  9568. U.selectEl("#U_MD_F_N_Message")[0].style.display = "block";
  9569. U.MD.F.N.noNewsTips();
  9570. }
  9571. }
  9572. U.selectEl('.U_MD_D_NewsTipsIcon')[0].onmouseout = function () {
  9573. if ($("#U_MD_D_MG_AFT").Child().length != 0) {
  9574. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className += ' U_MD_F_N_IconAnimation';
  9575. };
  9576. U.selectEl("#U_MD_F_N_Message")[0].style.display = "none";
  9577. }
  9578. }
  9579. /**
  9580. * 发送消息时间处理
  9581. *
  9582. * @param {string} 时间字符串
  9583. */
  9584. U.MD.F.N.messagesendTime = function (time) {
  9585. var _reg = RegExp(/Date/); //检查字符串是不是时间戳
  9586. if (time.match(_reg)) {
  9587. time = time.replace(/[^0-9]/ig, ""); //提取数字
  9588. var _date = new Date(parseInt(time));
  9589. var _year = _date.getFullYear();
  9590. var _month = _date.getMonth() + 1;
  9591. var _day = _date.getDate();
  9592. return _year + '-' + _month + '-' + _day;
  9593. }
  9594. return time;
  9595. }
  9596. /**
  9597. * 发送消息时间处理
  9598. *
  9599. * @param {string} 时间字符串
  9600. */
  9601. U.MD.F.N.getHoursMinutesSeconds = function (time) {
  9602. var _reg = RegExp(/Date/); //检查字符串是不是时间戳
  9603. if (time && time.match(_reg)) {
  9604. time = time.replace(/[^0-9]/ig, ""); //提取数字
  9605. var _date = new Date(parseInt(time)),
  9606. _hours = _date.getHours().toString()[1] ? _date.getHours() : '0' + _date.getHours(), //判断时间是否是两位数不是则在前面加0
  9607. _minutes = _date.getMinutes().toString()[1] ? _date.getMinutes() : '0' + _date.getMinutes(),
  9608. _seconds = _date.getSeconds().toString()[1] ? _date.getSeconds() : '0' + _date.getSeconds();
  9609. return _hours + ':' + _minutes + ':' + _seconds;
  9610. }
  9611. return time;
  9612. }
  9613. /**
  9614. * 消息提示打印处理
  9615. *
  9616. * @param {array} 需要打印的消息数组
  9617. */
  9618. U.MD.F.N.displayFriendMessage = function (news, verify) {
  9619. var i,
  9620. _username,
  9621. _descript,
  9622. _newel,
  9623. _newael,
  9624. _cb,
  9625. _newcontent,
  9626. _frag = $$("frag");
  9627. //循环消息的处理
  9628. for (i = 0; i < news.length; i++) {
  9629. //创建消息元素
  9630. _newel = $$("div", { "className": "U_MD_D_MG_OO", "title": "消息", "tid": "O" + news[i].MessageID }, _frag);
  9631. _username = news[i].FriendsDescript || news[i].GroupManageName || news[i].UserNickName;
  9632. _newsenttime = U.MD.F.N.messagesendTime(news[i].MessageSendTime);
  9633. //消息类型的处理,设置消息的内容显示
  9634. switch (verify) {
  9635. //聊天消息处理
  9636. case 0:
  9637. _descript = news[i].count;
  9638. _newcontent = news[i].MessageContent || news[i].GroupMessageContent;
  9639. //添加好友点击的回调
  9640. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9641. U.MD.F.N.chatMessage(newsinfo, news, _newel); //聊天消息设置
  9642. U.UF.EV.stopBubble();
  9643. }, [news, news[i], _newel]);
  9644. break;
  9645. //添加好友消息的处理
  9646. case 1:
  9647. _username = news[i].UserNickName; //消息名字
  9648. _newcontent = "添加您为好友"; //消息描述
  9649. //添加好友点击的回调
  9650. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9651. U.MD.F.N.addFriendNewsHandle(newsinfo, news, _newel);
  9652. U.UF.EV.stopBubble();
  9653. }, [news, news[i], _newel]);
  9654. break;
  9655. //请求加入群消息处理
  9656. case 2:
  9657. _username = news[i].UserNickName; //消息名字
  9658. _newcontent = "请求加入该群"; //消息描述
  9659. //添加好友点击的回调
  9660. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9661. U.MD.F.N.entryGroup(newsinfo, news, _newel);
  9662. }, [news, news[i], _newel]);
  9663. break;
  9664. //邀请加入群处理
  9665. case 3:
  9666. _username = news[i].UserNickName; //消息名字
  9667. _newcontent = "邀请您加入讨论组"; //消息描述
  9668. //添加好友点击的回调
  9669. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9670. U.MD.F.N.pulledIntoGroups(newsinfo, news, _newel);
  9671. U.UF.EV.stopBubble();
  9672. }, [news, news[i], _newel])
  9673. break;
  9674. //对方同意添加好友
  9675. case 4:
  9676. _username = news[i].UserNickName; //消息名字
  9677. _newcontent = "同意添加你为好友"; //消息描述
  9678. //添加好友点击的回调
  9679. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9680. U.MD.F.N.confirmAddFriend(newsinfo, news, _newel);
  9681. }, [news, news[i], _newel]);
  9682. break;
  9683. //对方确认我加入群的处理
  9684. case 5:
  9685. _username = news[i].UserNickName; //消息名字
  9686. _newcontent = "加入讨论组"; //消息描述
  9687. //添加好友点击的回调
  9688. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9689. U.MD.F.N.pulledIntoGroups(newsinfo, news, _newel);
  9690. }, [news, news[i], _newel]);
  9691. break;
  9692. case 6:
  9693. _newcontent = "你的文件到了!!!"; //发送文件描述
  9694. _cb = U.UF.P.apply(function (news, newsinfo, _newel) {
  9695. U.MD.F.N.chatMessage(newsinfo, news, _newel); //聊天消息设置
  9696. U.UF.EV.stopBubble();
  9697. }, [news, news[i], _newel]);
  9698. break;
  9699. }
  9700. //点击处理
  9701. _newel.onclick = _cb;
  9702. _newael = $$("div", { "className": "U_MD_D_MG_OOI" }, _newel);
  9703. $$("img", { "onerror": U.MD.C.imgError,
  9704. "onerror": U.MD.C.imgError, "alt": news[i].FriendsDescript || news[i].UserNickName || news[i].GroupManageName,
  9705. "src": U.MD.C.getHeadImage(news[i].UserThumbnailImageHead || "/img/UserHead/UseHead.jpg")
  9706. }, _newael);
  9707. $$("div", { "className": "U_MD_D_MG_OON U_MD_D_Text_Abbreviation", "innerHTML": _username }, _newel);
  9708. $$('div', { 'style': { 'float': 'none', 'text-align': 'end', 'color': '#737373', 'height': '15px', 'margin-right': '5px' }, 'innerHTML': _newsenttime }, _newel);
  9709. $$('div', { className: 'U_MD_D_MG_OONC', 'innerHTML': _newcontent, 'style': { 'margin-left': '10px', 'font-size': '14px', 'margin-top': '8px'} }, _newel);
  9710. if (verify != 0) {
  9711. _newel.children[3].style.color = '#2683f5';
  9712. }
  9713. if (verify == 0) {
  9714. $$("div", { "style": { "float": "right", 'margin-top': '9px', 'margin-right': '5px' }, "className": " U_MD_D_MG_Count", "innerHTML": _descript }, _newel);
  9715. }
  9716. }
  9717. U.selectEl("#U_MD_D_MG_AFT")[0].appendChild(_frag);
  9718. }
  9719. /**
  9720. * 提供好友和群统一接口实现信息回调
  9721. *
  9722. *
  9723. * @param {object} 当前的消息
  9724. * @param {array} 所有的消息
  9725. * @param {element} 消息元素
  9726. */
  9727. U.MD.F.N.chatMessage = function (newsinfo, news, el) {
  9728. var _chatinfo;
  9729. //如果是群聊天的处理
  9730. if (newsinfo.GroupManageID) {
  9731. _chatinfo = U.Json.select(US.friend.group, { "GroupManageID": newsinfo.GroupManageID })[0];
  9732. }
  9733. //如果是好友聊天的处理
  9734. else {
  9735. _chatinfo = U.Json.select(US.friend.friends, { "UserId": newsinfo.UserId })[0]
  9736. }
  9737. U.MD.F.W.viewFriend(_chatinfo); //查看消息
  9738. U.MD.F.N.clearNews(newsinfo, news, el); //清除
  9739. U.MD.F.N.delNewsTips(); //清除消息提示
  9740. }
  9741. /**
  9742. * 提供好友和群统一接口实现信息回调
  9743. *
  9744. * @param {bool} 接收的消息类型
  9745. * true 群消息
  9746. * false 好友消息
  9747. * @param {string} 好友或者群消息
  9748. * @param {object} 获取查看的好友消息
  9749. */
  9750. U.MD.F.N.asynReceiveMessages = function (isgroup, chatform, r) {
  9751. //如果是群消息查看
  9752. if (isgroup) {
  9753. U.MD.F.W.printGroupChatMessage($("div.U_MD_F_C", chatform)[0], r); //打印群消息
  9754. }
  9755. //好友消息的查看
  9756. else {
  9757. U.MD.F.W.printFriendChatMessage($("div.U_MD_F_C", chatform)[0], r); //打印好友消息
  9758. }
  9759. }
  9760. /**
  9761. * 添加好友的处理
  9762. *
  9763. * @param {object} 当前的消息
  9764. * @param {array} 所有的消息
  9765. * @param {element} 消息元素
  9766. */
  9767. U.MD.F.N.addFriendNewsHandle = function (newsinfo, news, el) {
  9768. var _friendinfo = U.Json.select(US.friend.friends, { "UserId": newsinfo.UserId }, null, 1)[0]; //判断用户是否在好友分组里
  9769. //好友不存在自己的列表
  9770. if (!_friendinfo) {
  9771. U.MD.F.M.addFriend(newsinfo, null, "0"); //添加他人进入群
  9772. }
  9773. //用户已经是自己的好友,那么直接弹出聊天
  9774. else {
  9775. U.MD.F.W.popupFriendsForm(_friendinfo);
  9776. }
  9777. U.MD.F.N.clearNews(newsinfo, news, el); //清除
  9778. }
  9779. /**
  9780. * 添加好友的处理
  9781. *
  9782. * @param {object} 当前的消息
  9783. * @param {array} 所有的消息
  9784. * @param {element} 消息元素
  9785. */
  9786. U.MD.F.N.entryGroup = function (newsinfo, news, el) {
  9787. var _groupuserid = Guid.newGuid(), //群用户id
  9788. _friendinfo = U.Json.select(US.friend.groupusers, { "GroupManageID": news.MessageContent, "UserId": news.UserId }, null, 1)[0]; //查找群
  9789. //如果群已经加载处理的处理
  9790. if (_friendinfo) {
  9791. U.alert("添加成功");
  9792. }
  9793. //添加用户进入群主
  9794. else {
  9795. 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]);
  9796. }
  9797. U.MD.F.N.clearNews(newsinfo, news, el); //清除
  9798. }
  9799. /**
  9800. * 添加群进入
  9801. *
  9802. * @param {object} 服务器返回的信息
  9803. */
  9804. U.MD.F.N.asynEntryGroup = function (r) {
  9805. var _groupuserinfo,
  9806. _context = r.context,
  9807. _news = _context[1],
  9808. _groupuserid = _context[2];
  9809. //实例化用户
  9810. _groupuserinfo = U.MD.F.T.groupUserEntity(_news.UserId, _news.UserImageHead, _news.UserNickName, _news.UserNickName, _news.UserThumbnailImageHead, _news.MessageContent.toUpperCase(), _news.MessageID, 1)
  9811. //添加用户进入群
  9812. US.friend.groupusers.push(_groupuserinfo);
  9813. }
  9814. /**
  9815. * 被用户进入群处理
  9816. *
  9817. * @param {object} 消息信息
  9818. */
  9819. U.MD.F.N.pulledIntoGroups = function (newsinfo, news, el) {
  9820. var _groupinfo = U.Json.select(US.friend.group, { "GroupManageID": newsinfo.MessageContent.toLowerCase() })[0];
  9821. //判断群是否已经加载过,如果加载过那么就不重新加载
  9822. if (!_groupinfo) {
  9823. U.A.Request(US.FRIEND, ["GetJoinGroupNews", US.userInfo.UserId, newsinfo.MessageID, newsinfo.MessageContent], U.MD.F.N.asynPulledIntoGroups, ["", newsinfo]); //拉用户进入群组
  9824. }
  9825. else {
  9826. U.MD.F.W.viewFriend(_groupinfo); //查看消息
  9827. //如果是群的文件消息的处理
  9828. if (newsinfo.MessageContent.length == 36) {
  9829. }
  9830. }
  9831. U.MD.F.N.clearNews(newsinfo, news, el); //清除用户消息
  9832. U.MD.F.W.addChecked(newsinfo); //添加聚焦效果
  9833. U.MD.F.N.delNewsTips();
  9834. }
  9835. /**
  9836. * 拉用户进入群组异步
  9837. *
  9838. * @param {object} 小新信息
  9839. */
  9840. U.MD.F.N.asynPulledIntoGroups = function (r) {
  9841. //服务器返回成功
  9842. if (r.value) {
  9843. var _groupfriend,
  9844. _groupfriends,
  9845. _groupdiskarr,
  9846. _context = r.context,
  9847. _newinfo = _context[1],
  9848. _userid = US.userInfo.UserId, //用户id
  9849. _diskinfo = US.disk.Disks[_userid], //用户群信息
  9850. _groupinfo = new U.MD.F.T.groupEntity(_newinfo.MessageContent.toLocaleLowerCase(), _newinfo.MessageDescript, U.UF.D.toTimeStamp(new Date()), _newinfo.UserId, "", null) //群信息
  9851. ;
  9852. r = r.value; //服务器响应后返回的值
  9853. _groupfriends = r[0];
  9854. US.friend.group.unshift(_groupinfo); //插入新群
  9855. //添加群友
  9856. for (i = 0; i < _groupfriends.length; i++) {
  9857. //判断用户是否在群里,不重复添加
  9858. if (!U.Json.select(US.friend.groupusers, { "GroupManageID": _groupfriends[i].GroupManageID, "UserId": _groupfriends[i].UserId })[0]) {
  9859. //初始化生成群用户
  9860. _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);
  9861. //添加群用户到群里
  9862. US.friend.groupusers.push(_groupfriend);
  9863. }
  9864. }
  9865. _groupdiskarr = [new U.MD.DK.M.entity(_groupinfo.GroupManageID, 0, US.EMPTYGUID, _groupinfo.GroupManageName,
  9866. _groupinfo.GroupManageName, "folder", null, U.UF.D.toTimeStamp(new Date()), U.MD.DK.C.getIcon("folder")[1],
  9867. 1, null, null, 0, "", _groupinfo.GroupManageID)];
  9868. _diskinfo && U.MD.DK.RE.addFileOrFolder(_groupdiskarr, _diskinfo, _diskinfo.directoryOrFiles[2]) //添加文件或者文件夹
  9869. // _diskinfo && U.MD.DK.RE.addFileOrFolder(r[1], _diskinfo, _groupinfo) //群里的文件或者文件夹
  9870. //直接显示到群里
  9871. U.MD.F.W.viewFriend(_groupinfo); //查看消息
  9872. U.selectEl($("#U_MD_F_H_ZLTA").Child()[2]).Child()[0].onclick(); //刷新群组列表
  9873. //返回添加的群
  9874. return US.friend.group[0];
  9875. }
  9876. }
  9877. /**
  9878. * 确认添加对方为好友
  9879. *
  9880. * @param {object} 确定添加对方为好友
  9881. */
  9882. U.MD.F.N.confirmAddFriend = function (newsinfo, news, el) {
  9883. var _friendid = Guid.newGuid(), //好友id
  9884. _friendinfo = U.Json.select(US.friend.friends, { "UserId": news.UserId })[0] //用户是否已经在好友列表
  9885. ;
  9886. //如果好友没有添加处理
  9887. if (!_friendinfo) {
  9888. 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]); //添加好友到默认分组
  9889. }
  9890. //如果用户在好友列表,那么直接弹出
  9891. else {
  9892. U.MD.F.W.popupFriendsForm(_friendinfo);
  9893. }
  9894. U.MD.F.N.clearNews(newsinfo, news, el); //清除消息
  9895. }
  9896. /**
  9897. * 异步处理确定添加好友
  9898. *
  9899. * @param {object} 确定添加对方为好友
  9900. */
  9901. U.MD.F.N.asynAddFriend = function (r) {
  9902. var _context = r.context,
  9903. _new = _context[1],
  9904. _groupid = _context[2],
  9905. _friendid = _context[3];
  9906. r = r.value;
  9907. U.MD.F.M.displayAddFriend(r[0][0], _friendid, _groupid, r); //确定添加好友到好友分组里
  9908. }
  9909. /**
  9910. * 清除所有的消息
  9911. *
  9912. * @param {array} 所有的消息
  9913. */
  9914. U.MD.F.N.clearAllNews = function () {
  9915. var i, j,
  9916. _allids = "",
  9917. _allnews = U.MD.F.N.news
  9918. ;
  9919. //循环获取消息的id
  9920. for (i = 0; i < _allnews.length; i++) {
  9921. if (_allnews[i]) {
  9922. for (j = 0; j < _allnews[i].length; j++) {
  9923. _allids += (_allnews[i][j].GroupManageID || _allnews[i][j].MessageID) + ",";
  9924. }
  9925. _allnews[i].splice(0);
  9926. }
  9927. }
  9928. _allids = _allids.substring(0, _allids.length - 1); //去除最后一位的,
  9929. //数据库删除消息处理
  9930. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteMessageById", _allids, US.userInfo.UserId], function () { }, []);
  9931. U.selectEl("#U_MD_D_MG_AFT")[0].innerText = "";
  9932. }
  9933. /**
  9934. * 清除所有的的添加好友信息
  9935. *
  9936. * @param {array} 所有的消息
  9937. * @param {object} 当前的消息
  9938. * @param {element} 消息元素
  9939. * @param {number} 消息类型
  9940. */
  9941. U.MD.F.N.clearNews = function (newsinfo, news, el) {
  9942. var _pel = U.selectEl(el).Parent(),
  9943. _messageid = (newsinfo.MessageID || newsinfo.GroupMessageID); //元素的上级元素
  9944. //移除单挑消息
  9945. U.Json.del(news, { "MessageID": newsinfo.MessageID });
  9946. //清理消息
  9947. U.MD.F.N.canelMarkMessage(newsinfo);
  9948. U.selectEl(el).remove(); //移除消息
  9949. //如果消息已经全部点击完毕的处理
  9950. if ($(_pel).Child().length == 0 && U.selectEl("#U_MD_F_N_Message")[0]) {
  9951. U.selectEl("#U_MD_F_N_Message")[0].close(); //关闭的处理
  9952. }
  9953. //数据库删除消息处理
  9954. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteMessageById", _messageid, US.userInfo.UserId], function () { }, []);
  9955. }
  9956. /**
  9957. * 学习系统消息处理
  9958. *
  9959. * @param {array} 除了好友聊天消息,其他消息的处理
  9960. */
  9961. U.MD.F.N.otherNews = function (news) {
  9962. }
  9963. /*
  9964. 标记未读信息
  9965. @param {array} newsarr消息信息数组
  9966. */
  9967. U.MD.F.N.markUnreadMessage = function (newsarr) {
  9968. var i, j, _id, _el, _parentel;
  9969. for (i = 0; i < newsarr.length; i++) { //循环消息数组
  9970. for (j = 0; j < newsarr[i].length; j++) {
  9971. _id = newsarr[i][j].UserId || newsarr[i][j].GroupManageID; //获取消息id
  9972. if (_id) {
  9973. _el = U.selectEl("[tid='M" + _id + "']")[0]; //获取聊天次数元素
  9974. _parentel = U.selectEl("[tid='" + _id + "']")[0]; //获取添加到哪个父亲的元素
  9975. //如果可以添加
  9976. if (_parentel) {
  9977. if (_el) {
  9978. _el.innerHTML = newsarr[i][j].count;
  9979. }
  9980. else {
  9981. $$("div", { className: "U_Mark", innerHTML: newsarr[i][j].count, tid: "M" + _id, "style": { "cssText": "margin:0;position:absolute;left:48px"} }, _parentel); //生成红点
  9982. }
  9983. }
  9984. }
  9985. }
  9986. }
  9987. }
  9988. /*
  9989. 消除标记信息
  9990. @param {json} friendindo 好友信息
  9991. */
  9992. U.MD.F.N.canelMarkMessage = function (friendInfo) {
  9993. if (friendInfo) {
  9994. if (friendInfo.GroupManageID) {
  9995. U.selectEl("[tid='M" + friendInfo.GroupManageID + "']").remove(); //删除左边标记
  9996. }
  9997. else if (friendInfo.UserId) {
  9998. U.selectEl("[tid='M" + friendInfo.UserId + "']").remove(); //删除左边标记
  9999. }
  10000. else if (friendInfo.MessageSendUserID) {
  10001. U.selectEl("[tid='M" + friendInfo.MessageSendUserID + "']").remove(); //删除左边标记
  10002. }
  10003. }
  10004. }
  10005. /*
  10006. 消除所有标记信息
  10007. @param {json} friendindo 好友信息
  10008. */
  10009. U.MD.F.N.canelAllMarkMessage = function () {
  10010. U.selectEl(".U_Mark").remove();
  10011. }
  10012. /*
  10013. 移除单个消息提示动画
  10014. */
  10015. U.MD.F.N.delNewsTips = function () {
  10016. //删除消息提示
  10017. if ($("#U_MD_D_MG_AFT").Child().length == 0) {
  10018. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className = 'U_MD_D_NewsTipsIcon';
  10019. }
  10020. }
  10021. /*
  10022. 移除所有消息提示动画
  10023. */
  10024. U.MD.F.N.delAllNewsTips = function () {
  10025. //删除消息提示
  10026. U.selectEl('.U_MD_D_NewsTipsIcon')[0].className = 'U_MD_D_NewsTipsIcon';
  10027. }
  10028. //#endregion
  10029. /*
  10030. 新消息提示图标沒有新消息的处理
  10031. */
  10032. U.MD.F.N.noNewsTips = function () {
  10033. //判断是否有新消息
  10034. if ($("#U_MD_D_MG_AFT").Child().length == 0) {
  10035. if (!$('.U_MD_F_N_NoNewsTips')[0]) {
  10036. $$('div', { 'className': 'U_MD_F_N_NoNewsTips', 'style': {}, 'innerHTML': '暂无消息' }, U.selectEl("#U_MD_F_N_Message")[0]);
  10037. } else {
  10038. U.selectEl('.U_MD_F_N_NoNewsTips')[0].style.display = "block";
  10039. }
  10040. U.MD.F.N.delAllNewsTips();
  10041. }
  10042. else {
  10043. if ($('.U_MD_F_N_NoNewsTips')[0]) {
  10044. U.selectEl('.U_MD_F_N_NoNewsTips')[0].style.display = "none";
  10045. }
  10046. }
  10047. }
  10048. /**
  10049. *添加消息提示音
  10050. *parentele {element} 添加到父亲元素
  10051. *allnews {array} 消息数组
  10052. */
  10053. U.MD.F.N.addNewsSound = function (parentele, allnews) {
  10054. //判断是否创建音频
  10055. if (!$('#U_MD_F_N_NewsAudio')[0]) {
  10056. $$('audio', { "id": "U_MD_F_N_NewsAudio", "src": "http://gddx.sc.chinaz.com/Files/DownLoad/sound1/201703/8407.wav", "autoplay": 'autoplay' }, parentele);
  10057. }
  10058. //创建了,则播放音频
  10059. else {
  10060. U.selectEl('#U_MD_F_N_NewsAudio')[0].play();
  10061. }
  10062. }
  10063. /**
  10064. *点击查看好友聊天移除企鹅图标新消息提示
  10065. *parentele {element} 添加到父亲元素
  10066. *allnews {array} 消息数组
  10067. */
  10068. U.MD.F.N.cancelNewsMessage = function (friendInfo) {
  10069. var i,
  10070. _news, //消息
  10071. _id = friendInfo.GroupManageID ? "GroupManageID" : "UserId",
  10072. _obj = {}, //查找条件
  10073. _child = U.selectEl("#U_MD_D_MG_AFT").Child(); //消息元素
  10074. _obj[_id] = friendInfo[_id]; //设置条件
  10075. _news = U.Json.select(U.MD.F.N.news[0], _obj)[0]; //查找消息
  10076. if (_news) {
  10077. //循环
  10078. for (i = 0; i < _child.length; i++) {
  10079. if (_child[i].tid == "O" + _news.MessageID) {
  10080. U.MD.F.N.chatMessage(_news, U.MD.F.N.news[0], _child[i]);
  10081. return;
  10082. }
  10083. }
  10084. }
  10085. };
  10086. ///<jscompress sourcefile="RightClick.js" />
  10087. Namespace.register("U.MD.F.R"); //好友和群窗口区域命名空间
  10088. //#region 右键菜单
  10089. /**
  10090. * 右键功能 显示[移动至][删除]窗体
  10091. * 参数说明 0 当前元素 1 用户信息
  10092. * @param {element} 右键好友的区域
  10093. * @param {object} 好友信息
  10094. */
  10095. U.MD.F.R.friendsRightClickMenu = function (el, friendinfo) {
  10096. var _friendmenuel = U.selectEl('#U_MD_F_G_Div')[0], //右键的菜单
  10097. _child = U.selectEl(_friendmenuel).Child(); //子菜单
  10098. //显示菜单,定位
  10099. U.selectEl(_friendmenuel).css({ "display": "block", "zIndex": "999" });
  10100. U.UF.C.rightClickMenuLocation(_friendmenuel); //右键菜单定位
  10101. //按钮功能赋值
  10102. _child[0].onclick = function () { U.MD.F.W.popupFriendsForm(friendinfo); }; //发送消息
  10103. _child[1].onclick = function () { U.MD.U.V.ViewOtherUserInfo(friendinfo.UserId); }; //查看个人资料
  10104. _child[2].onmouseover = function () { U.MD.F.R.moveFriendForm(friendinfo, el, _child[2]); }; //移动联系人至
  10105. _child[3].onclick = function () { U.MD.F.R.deleteFriendForm(friendinfo); }; //删除
  10106. //点击其它区域隐藏右键菜单
  10107. U.selectEl(document).bind("click", function () {
  10108. U.selectEl(_friendmenuel)[0].style.display = "none";
  10109. })
  10110. }
  10111. /**
  10112. * 鼠标移动到 联系人移动至制定的好友分组弹框
  10113. * @param {object} 好友信息
  10114. * @param {element} 右键好友的区域
  10115. * @param {element} onmouseover出发的按钮
  10116. */
  10117. U.MD.F.R.moveFriendForm = function (friendinfo, el, menubootom) {
  10118. var i,
  10119. _friendclassel = U.selectEl(menubootom).parentElement().Child()[4], //获取好友分组打印的元素
  10120. _friendclassinfo = US.friend.allclass; //获取用户所有的好友分组
  10121. _friendclassel.innerText = ""; //清空之前打印的好友分组
  10122. if (!friendinfo.FriendsGroupID) {//判断好友信息是否有好友分组id
  10123. friendinfo.FriendsGroupID = U.Json.select(US.friend.friends, { "UserId": friendinfo.UserId })[0].FriendsGroupID; //给好友信息添加好友分组id
  10124. }
  10125. //如果有好友分组可以移动的情况
  10126. if (_friendclassinfo.length > 1) {
  10127. //循环打印好友分组
  10128. for (i = 0; i < _friendclassinfo.length; i++) {
  10129. //如果是当前用户所在的好友分组不打印,否则都打印
  10130. if (_friendclassinfo[i].FriendsGroupID != friendinfo.FriendsGroupID) {
  10131. //创建好友分组元素
  10132. $$("div", { "class": "U_MD_F_G_Div_Children_A", "innerText": _friendclassinfo[i]["FriendsGroupName"],
  10133. "onclick": U.UF.C.closure(function (i) {
  10134. U.MD.F.R.assignMoveFriend(friendinfo, _friendclassinfo[i], el);
  10135. }, [i])
  10136. }, _friendclassel);
  10137. }
  10138. }
  10139. _friendclassel.style.display = "block";
  10140. }
  10141. }
  10142. /**
  10143. * 触发移动好友
  10144. *
  10145. * @param {object} 好友信息
  10146. * @param {object} 群信息
  10147. * @param {element} 好友元素
  10148. */
  10149. U.MD.F.R.assignMoveFriend = function (friendinfo, groupinfo, el) {
  10150. var _friendsid;
  10151. //只有选择移动了触发
  10152. if (friendinfo) {
  10153. U.selectEl('#U_MD_F_G_Div')[0].style.display = "none"; //点击后隐藏右键
  10154. U.selectEl(".U_MD_F_G_Div_Children")[0].style.display = "none"; //隐藏右键后好友分组选择的菜单
  10155. if (friendinfo.FriendsID) {
  10156. _friendsid = friendinfo.FriendsID;
  10157. } else {
  10158. friendinfo.FriendsID = U.Json.select(US.friend.friends, { "UserId": friendinfo.UserId })[0].FriendsID;
  10159. friendinfo.FriendsGroupID = U.Json.select(US.friend.friends, { "UserId": friendinfo.UserId })[0].FriendsGroupID;
  10160. }
  10161. //数据库设置移动好友信息
  10162. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "MoveFriendToOtherClass", friendinfo.FriendsID, groupinfo["FriendsGroupID"]],
  10163. U.MD.F.R.asynAssignMoveFriend, ["", friendinfo, groupinfo, el]);
  10164. U.alert('修改成功');
  10165. }
  10166. }
  10167. /**
  10168. * 把相应的好友移动到指定的群组里
  10169. */
  10170. U.MD.F.R.asynAssignMoveFriend = function (r) {
  10171. var _child, //好友分组元素
  10172. _context = r.context, //异步传参
  10173. _friendinfo = _context[1], //移动好友实体
  10174. _groupinfo = _context[2], //好友分组字体
  10175. _el = _context[3], //移动的元素
  10176. _friendgroupel = U.selectEl("#g" + _groupinfo.FriendsGroupID)[0], //移动到的好友分组
  10177. _previousgroupinfo = U.Json.select(US.friend.allclass, { "FriendsGroupID": _friendinfo.FriendsGroupID })[0], //修改前的好友分组
  10178. _friendnum = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo.FriendsGroupID }).length - 1 //好友分组的数量
  10179. ;
  10180. //设置好友原本所在的分组信息
  10181. //判断是否处于好友聊天功能下
  10182. if ($('.U_MD_F_H_ZLTOO')[0]) {
  10183. U.selectEl(_el).parentElement(2).Child()[0].innerHTML = _previousgroupinfo.FriendsGroupName + "(" + _friendnum + ")"; //移动好友出去后需改数量显示
  10184. U.MD.F.R.assignNoFriendTips(_previousgroupinfo, _friendnum, U.selectEl(_el).parentElement(2).Child()[1], U.selectEl(_friendgroupel).Child()[1]);
  10185. }
  10186. //好友实体的id变化FriendsGroupID
  10187. _friendinfo.FriendsGroupID = _groupinfo.FriendsGroupID;
  10188. U.Json.select(US.friend.friends, { "UserId": _friendinfo.UserId })[0].FriendsGroupID = _groupinfo.FriendsGroupID;
  10189. //判断分组是否显示
  10190. if (_friendgroupel) {
  10191. _child = U.selectEl(_friendgroupel).Child();
  10192. _friendnum = U.Json.select(US.friend.friends, { "FriendsGroupID": _friendinfo.FriendsGroupID }).length;
  10193. _child[0].innerHTML = _groupinfo["FriendsGroupName"] + "(" + _friendnum + ")"; //新好友分组
  10194. _child[1].appendChild(_el); //添加移动的元素
  10195. }
  10196. }
  10197. /**
  10198. * 移动好友后,分组内是否显示没有好友跟随提示的异步
  10199. * previousgroupinfo {object} 好友移动后的前分组
  10200. * nowfriendnum {string} 好友移动后的现在好友分组的好友数量
  10201. * previousel {elementy} 前分组的元素
  10202. * nowel {element} 现分组的元素
  10203. */
  10204. U.MD.F.R.assignNoFriendTips = function (previousgroupinfo, nowfriendnum, previousel, nowel) {
  10205. var _previousfriendnum = U.Json.select(US.friend.friends, { "FriendsGroupID": previousgroupinfo.FriendsGroupID }).length;
  10206. if (_previousfriendnum == 0 && previousel.parentNode) {
  10207. $$("div", { "class": "U_MD_F_H_ZLZOCO_under", "style": { "margin": "9px 0 0 10px" }, "innerHTML": "该分组暂无好友" }, previousel);
  10208. }
  10209. if (nowel.parentNode && nowel.getElementsByClassName("U_MD_F_H_ZLZOCO_under")[0]) {
  10210. nowel.removeChild($('.U_MD_F_H_ZLZOCO_under')[0]);
  10211. }
  10212. }
  10213. /**
  10214. * 鼠标从 联系人移动至 移开
  10215. * 隐藏现有的好友分组 Jude
  10216. */
  10217. U.MD.F.R.moveFriendOver = function (isdisplay, friendgroupmenu, el) {
  10218. //判断是否是冒泡上来的,如果是冒泡的则不处理
  10219. if (!U.UF.EV.stopBubbleMouseOutOrOver(el)) {
  10220. //根据传参设置是否显示隐藏
  10221. friendgroupmenu.style.display = isdisplay ? "none" : "block";
  10222. }
  10223. }
  10224. /**
  10225. * 弹出移动好友分组
  10226. * 参数说明 0 要移动的对象的信息集合 1 右键区域
  10227. * @param {element} 点击移动至区域
  10228. */
  10229. U.MD.F.R.topMoveFriendForm = function (el, friendinfo) {
  10230. var _chooseGroupInfon = null;
  10231. //未创建
  10232. //if (!$(".U_MD_F_G_Y_D")[0]) {
  10233. var i, //循环
  10234. _tempel,
  10235. _friendclassel = $$("div", { "className": "U_MD_F_G_Y_D" }), //弹出框内容区域
  10236. _friendclassinfo = US.friend.allclass, //好友分组信息
  10237. _friendclassform = U.UF.UI.confirm(_friendclassel, function () { U.MD.F.R.assignMoveFriend(friendinfo, _chooseGroupInfon, el) }); //好友分组弹框
  10238. $$("div", { "innerText": "选择好友移动至", "className": "U_MD_F_G_Y_DT" }, _friendclassel);
  10239. _tempel = $$("div", { "className": "U_MD_F_G_Y_DS" }, _friendclassel);
  10240. //循环所有可以移动的分组
  10241. for (i = 0; i < _friendclassinfo.length; i++) {
  10242. $$("div", { "innerHTML": _friendclassinfo[i].FriendsGroupName,
  10243. "className": "U_MD_F_G_Div_Q" + (friendinfo.FriendsGroupID == _friendclassinfo[i].FriendsGroupID ? " U_MD_F_G_Div_QO" : ""),
  10244. "onclick": U.UF.C.closure(function (i) {
  10245. _chooseGroupInfon = _friendclassinfo[i];
  10246. U.MD.F.R.topMoveFriendFormSwitch(this, friendinfo, _friendclassinfo[i], _friendclassform, el);
  10247. }, [i])
  10248. }, _tempel);
  10249. }
  10250. //自适应宽度
  10251. U.selectEl($(_friendclassform.content)[0]).Parent().style.height = "100%";
  10252. U.selectEl($($($($($(".U_MD_F_G_Y_D")[0]).Parent()).Parent()).Parent()).Parent()).Parent().style.zIndex = 100; //置顶好友分组弹窗
  10253. // } else {//已经创建
  10254. // var _formparent = U.selectEl($($($($($(".U_MD_F_G_Y_D")[0]).Parent()).Parent()).Parent()).Parent()).Parent(); //获取父级窗体元素
  10255. // if (_formparent.style.display == "none") {
  10256. // _formparent.style.display = "block";
  10257. // } else {
  10258. // _formparent.style.display = "none"
  10259. // }
  10260. // }
  10261. }
  10262. /**
  10263. * 右键功能 显示[移动至][删除]窗体
  10264. *
  10265. * @param {element} 选中变化的元素
  10266. * @param {object} 好友信息
  10267. * @param {object} 群信息
  10268. * @param {array} 对话框
  10269. ------------[0] 对话框
  10270. * @param {element} 好友元素
  10271. */
  10272. U.MD.F.R.topMoveFriendFormSwitch = function (groupel, friendinfo, friendclassinfo, friendclassform, el) {
  10273. var i, //用于循环
  10274. _child = U.selectEl(el).parentElement().Child(); //获取
  10275. //_group = U.selectEl(".U_MD_F_G_Y_DS").Child();
  10276. _group = groupel.parentNode.children;
  10277. for (i = 0; i < _group.length; i++) {
  10278. _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";
  10279. groupel.className = "U_MD_F_G_Div_Q U_MD_F_G_Div_QO";
  10280. }
  10281. //设置点击的效果
  10282. for (i = 0; i < _child.length; i++) {
  10283. _child[i].className = "U_MD_F_H_ZLZOCO" + (el == _child[i] ? " U_MD_F_G_Div_QQ" : "");
  10284. }
  10285. //设置确定按钮的事件,这里要结合窗体的api
  10286. // friendclassform.AddEvent({ Yes: [U.MD.F.R.assignMoveFriend, [friendinfo, friendclassinfo, el]] });
  10287. }
  10288. //#endregion
  10289. //#region 好友分组
  10290. /**
  10291. * 右键群显示
  10292. * @param object 右键元素的信息集合
  10293. */
  10294. U.MD.F.R.friendClassRightClickMenu = function (friendgroupinfo, el) {
  10295. var _el = U.selectEl('#U_MD_F_G_Qun')[0], //右键的菜单
  10296. _child = U.selectEl(_el).Child(); //子菜单
  10297. U.selectEl(_el).css({ "display": "block", "zIndex": "999" }); //显示右键菜单
  10298. U.UF.C.rightClickMenuLocation(_el); //右键菜单定位
  10299. //修改分组名字的点击处理
  10300. _child[0].onclick = function () { U.MD.F.R.popupUpdateFriendsClassForm(friendgroupinfo, el); };
  10301. _child[1].onclick = function () { U.MD.F.R.popupDeleteFriendsClassForm(friendgroupinfo, el); };
  10302. U.selectEl(document).bind("click", function () {
  10303. U.selectEl('#U_MD_F_G_Qun')[0].style.display = "none";
  10304. })
  10305. }
  10306. /**
  10307. * 修改分组昵称 弹框
  10308. * @param object 分组信息集合
  10309. * @param object 当前的el
  10310. */
  10311. U.MD.F.R.popupUpdateFriendsClassForm = function (friendgroupinfo, el) {
  10312. var _tempel,
  10313. _temponeel,
  10314. _temptwoel;
  10315. var _el = U.selectEl('#U_MD_F_G_Qun')[0]; //右键的菜单
  10316. U.selectEl(_el).css({ "display": "none" }); //显示右键菜单
  10317. if (friendgroupinfo) {
  10318. //创建好友分组的样式
  10319. _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNL U_MD_F_G" });
  10320. _temponeel = $$("div", {}, _tempel)
  10321. _temptwoel = $$("input", { "value": friendgroupinfo.FriendsGroupName, "onfocus": function () { U.UF.MR.inputPlaceholder(this, friendgroupinfo.FriendsGroupName, ""); },
  10322. "onblur": function () { U.UF.MR.inputPlaceholder(this, "", friendgroupinfo.FriendsGroupName); }
  10323. }, _temponeel);
  10324. //弹出好友对话框
  10325. U.UF.UI.confirm(_tempel, function () { U.MD.F.R.assignUpdateFriendsClass(friendgroupinfo, _temptwoel, el); }); //创建一个对话框
  10326. }
  10327. else {
  10328. U.alert("暂无群信息");
  10329. }
  10330. }
  10331. /**
  10332. *
  10333. * 参数说明 0 群消息集合 1 更改的分组名称 3对应修改的el
  10334. * @param {object} 群信息
  10335. * @param {element} 输入框
  10336. * @param {object} 对应的el
  10337. */
  10338. U.MD.F.R.assignUpdateFriendsClass = function (friendgroupinfo, formel, el) {
  10339. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "UpdateClassNameAndDescription", friendgroupinfo["FriendsGroupID"], formel.value, ""],
  10340. function () {
  10341. U.selectEl(el)[0].innerText = formel.value;
  10342. U.alert("修改成功");
  10343. }, []);
  10344. U.alert("正在修改中");
  10345. }
  10346. /*
  10347. * 删除好友分组弹框
  10348. * @param object 分组信息集合
  10349. * @param object 当前的el
  10350. */
  10351. U.MD.F.R.popupDeleteFriendsClassForm = function (friendgroupinfo, el) {
  10352. var _content;
  10353. var _el = U.selectEl('#U_MD_F_G_Qun')[0]; //右键的菜单
  10354. U.selectEl(_el).css({ "display": "none" }); //显示右键菜单
  10355. if (friendgroupinfo) {
  10356. _content = "是否确定删除(" + friendgroupinfo.FriendsGroupName + ")该分组";
  10357. U.UF.UI.confirm(_content, function () { U.MD.F.R.assignDeleteFriendsClass(friendgroupinfo, el); });
  10358. }
  10359. }
  10360. /*
  10361. * 确定删除好友分组
  10362. * @param object 分组信息集合
  10363. * @param object 当前的el
  10364. */
  10365. U.MD.F.R.assignDeleteFriendsClass = function (friendgroupinfo, el) {
  10366. var _friendGroupLength = U.Json.select(US.friend.friends, { "FriendsGroupID": friendgroupinfo.FriendsGroupID }).length;
  10367. if (friendgroupinfo.FriendsGroupDescript != "自动创建") {
  10368. if (_friendGroupLength == 0) {
  10369. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "DeleteFriendClass", friendgroupinfo.FriendsGroupID],
  10370. function () {
  10371. U.selectEl(el).Parent().remove()
  10372. U.alert("删除成功");
  10373. //在好友数组的全局变量中删除好友分组的信息
  10374. for (i = 0; i < US.friend.allclass.length; i++) {
  10375. if (US.friend.allclass[i].FriendsGroupID == friendgroupinfo.FriendsGroupID) {
  10376. US.friend.allclass.splice(i, 1);
  10377. }
  10378. }
  10379. }, []);
  10380. U.alert("正在删除中");
  10381. } else {
  10382. U.alert(friendgroupinfo.FriendsGroupName + "该分组下有好友,无法删除");
  10383. }
  10384. } else {
  10385. U.alert("自动创建的分组不可删除");
  10386. }
  10387. }
  10388. //#endregion
  10389. /**
  10390. * 删除确定
  10391. * 参数说明 0 要删除的对象ID 1右键的区域
  10392. * @param {element} 右键好友的区域
  10393. */
  10394. U.MD.F.R.deleteFriendForm = function (friendinfo, callback) {
  10395. var _el;
  10396. U.MD.F.R.addFriendsId(friendinfo); //添加FriendsID
  10397. //创建删除好友的信息样式
  10398. _el = $$("div", { "class": "U_MD_F_G_D" });
  10399. $$("div", { "class": "U_MD_F_G_DelSpan", "innerText": "删除后对方将从好友列表中消失,无法进行发送以及接收消息。" }, _el);
  10400. //弹出删除好友的框
  10401. U.UF.UI.confirm(_el, function () {
  10402. U.MD.F.M.deleteFriend(friendinfo);
  10403. U.UF.C.isFunction(callback) && callback();
  10404. });
  10405. }
  10406. /**
  10407. * 右上角设置
  10408. * 参数说明 friendinfo对应的好友信息集合
  10409. * @param object 好友信息
  10410. *
  10411. */
  10412. U.MD.F.R.popupRightCornerMenu = function (friendinfo, el) {
  10413. var _tempel,
  10414. _friendclassinfo,
  10415. _isaddfriend,
  10416. _menuel = U.selectEl(el).Child()[0];
  10417. //如果菜单存在则删除
  10418. if (_menuel) {
  10419. U.selectEl(_menuel).remove();
  10420. }
  10421. else {
  10422. //好友查看
  10423. if (friendinfo.UserId) {
  10424. _isaddfriend = U.Json.selectOne(US.friend.friends, { "UserId": friendinfo.UserId }); //判断用户是否在好友列表里
  10425. //判断用户是否是自己的好友,是的话则操作好友信息
  10426. _tempel = $$("div", { "class": "U_MD_F_T_B", style: {} }, el);
  10427. if (_isaddfriend) {
  10428. //获取好友分组信息
  10429. _friendclassinfo = U.selectEl($("#g" + _isaddfriend.FriendsGroupID + " div")[1]).find('[tid="' + _isaddfriend["UserId"] + '"]')[0]; //好友分组信息
  10430. //创建菜单
  10431. //_tempel = $$("div", { "class": "U_MD_F_T_B", style: {} }, el);
  10432. $$("div",
  10433. {
  10434. "innerText": "修改备注姓名",
  10435. "onclick": function () {
  10436. U.MD.F.R.updateFriendDescriptForm(_isaddfriend);
  10437. }
  10438. },
  10439. _tempel);
  10440. $$("div",
  10441. {
  10442. "innerText": "修改好友分组",
  10443. "onclick": function () {
  10444. U.MD.F.R.topMoveFriendForm(_friendclassinfo, _isaddfriend);
  10445. }
  10446. },
  10447. _tempel);
  10448. $$("div",
  10449. {
  10450. "innerText": "删除好友",
  10451. "onclick": function () {
  10452. U.MD.F.R.deleteFriendForm(_isaddfriend);
  10453. }
  10454. },
  10455. _tempel);
  10456. U.UF.EV.stopBubble();
  10457. U.selectEl(document).bind("click", function (e) {
  10458. U.selectEl(".U_MD_F_T_B").remove();
  10459. })
  10460. }
  10461. //如果好友不是自己的好友,则菜单为添加好友
  10462. else {
  10463. $$("div", { "innerText": "添加该好友", 'onclick': function () {
  10464. U.MD.F.M.addFriend(friendinfo);
  10465. }
  10466. }, _tempel);
  10467. }
  10468. }
  10469. //群菜单查看
  10470. else {
  10471. U.MD.F.J.groupInfoForm(friendinfo); //查看群 操作
  10472. }
  10473. }
  10474. }
  10475. /**
  10476. * 修改好友备注
  10477. * 参数说明 UGE对应的好友信息集合
  10478. * @param object
  10479. */
  10480. U.MD.F.R.updateFriendDescriptForm = function (_friendinfo) {
  10481. var _tempel,
  10482. _temponeel,
  10483. _temptwoel,
  10484. _descript;
  10485. _descript = _friendinfo.FriendsDescript || _friendinfo.UserNickName; //修改的好友昵称
  10486. //创建好友分组的样式
  10487. _tempel = $$("div", { "className": "U_MD_U_L_Box_I U_MD_F_Add_TNL U_MD_F_G" });
  10488. _temponeel = $$("div", {}, _tempel)
  10489. _temptwoel = $$("input",
  10490. {
  10491. "value": _descript,
  10492. "onfocus": function () {
  10493. U.UF.MR.inputPlaceholder(this, _descript, "");
  10494. },
  10495. "onblur": function () {
  10496. U.UF.MR.inputPlaceholder(this, "", _descript);
  10497. }
  10498. }, _temponeel);
  10499. //弹出好友对话框
  10500. U.UF.UI.confirm(_tempel, function () {
  10501. U.MD.F.R.updateFriendDescript(_friendinfo, _temptwoel);
  10502. }); //创建一个对话框
  10503. }
  10504. /**
  10505. * 确认修改备注
  10506. * 参数说明 0 对应好友信息集合 1对应的el 用于静态改变当前的备注
  10507. * @param{object}群信息
  10508. * @{element}对应el
  10509. */
  10510. U.MD.F.R.updateFriendDescript = function (friendinfo, el) {
  10511. U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "UpdateFriendDescription", friendinfo['FriendsID'], el.value],
  10512. U.MD.F.R.asynUpdateFriendDescript, [null, friendinfo, el.value]);
  10513. }
  10514. /**
  10515. * 好友备注修改异步
  10516. * @param{object} 异步服务器返回的信息
  10517. */
  10518. U.MD.F.R.asynUpdateFriendDescript = function (r) {
  10519. var _context = r.context,
  10520. _friendinfo = _context[1],
  10521. _descript = _context[2],
  10522. _el = U.selectEl($("#g" + _friendinfo.FriendsGroupID + " div")[1]).find('[tid="' + _friendinfo["UserId"] + '"]')[0];
  10523. _friendinfo.FriendsDescript = _descript; //在好友信息集合里修改用户描述
  10524. //在好友列表中修改好友
  10525. if (_el) {
  10526. U.selectEl("div", _el)[2].innerText = _context[2];
  10527. }
  10528. //在聊天窗口修改好友
  10529. U.selectEl("div", U.selectEl('.U_MD_F_TO.U_MD_F_TOT')[0])[1].innerText = _context[2];
  10530. var _obj = U.selectEl('.U_MD_F_TO.U_MD_F_TOT')[0],
  10531. _tags = U.selectEl(".U_MD_F_TA")[0].children;
  10532. for (var i = 0, len = _tags.length; i < len; i++) {
  10533. // 找到节点,返回下标
  10534. if (_tags[i] == _obj) {
  10535. U.selectEl("div", U.selectEl('.U_MD_F_H')[i])[2].innerText = _context[2];
  10536. }
  10537. }
  10538. }
  10539. //#region 群聊
  10540. /**
  10541. * 右键群聊显示
  10542. * @param object 右键元素的信息集合
  10543. */
  10544. U.MD.F.R.GroupRightClickMenu = function (el, friendgroupinfo) {
  10545. var _el = U.selectEl('#U_MD_F_G_Group')[0], //右键的菜单
  10546. _groupuserinfo = U.Json.select(US.friend.groupusers, { "GroupManageID": friendgroupinfo.GroupManageID }),
  10547. _child = U.selectEl(_el).Child(); //子菜单
  10548. U.selectEl(_el).css({ "display": "block", "zIndex": "999" }); //显示右键菜单
  10549. U.UF.C.rightClickMenuLocation(_el); //右键菜单定位
  10550. //修改分组名字的点击处理
  10551. _child[0].onclick = function () { U.MD.F.J.groupInfoForm(friendgroupinfo, el) };
  10552. _child[1].onclick = function () { U.MD.F.J.groupExit(friendgroupinfo, U.Json.selectOne(_groupuserinfo, { "UserId": US.userInfo.UserId })); };
  10553. U.selectEl(document).bind("click", function () {
  10554. U.selectEl('#U_MD_F_G_Group')[0].style.display = "none";
  10555. })
  10556. }
  10557. /**
  10558. *添加FriendsID
  10559. *friendinfo {object} 好友信息
  10560. */
  10561. U.MD.F.R.addFriendsId = function (friendinfo) {
  10562. var _userfriends = US.friend.friends;
  10563. if (!friendinfo.FriendsID) {//判断FriendsID是否存在
  10564. for (var i = 0; i < _userfriends.length; i++) {
  10565. if (friendinfo.UserId == _userfriends[i].UserId) {//对比好友的UserID
  10566. friendinfo.FriendsID = _userfriends[i].FriendsID; //给好友信息添加FriendsID
  10567. }
  10568. }
  10569. } else {
  10570. for (var i = 0; i < _userfriends.length; i++) {
  10571. if (friendinfo.UserId == _userfriends[i].UserId && friendinfo.FriendsID != _userfriends[i].FriendsID) {//对比好友的UserID
  10572. friendinfo.FriendsID = _userfriends[i].FriendsID; //给好友信息添加FriendsID
  10573. }
  10574. }
  10575. }
  10576. }
  10577. ;
  10578. ;
  10579. ///<jscompress sourcefile="User.js" />
  10580. ///<jscompress sourcefile="CityData.js" />
  10581. Namespace.register("U.MD.U.C"); //好友国家城市的命名空间
  10582. //国家省份城市的地址选择
  10583. 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": "其它"}]}]}] };;
  10584. ///<jscompress sourcefile="FindPassword.js" />
  10585. Namespace.register("U.MD.U.F"); //用户找回帐号
  10586. //#region 切换找回方式
  10587. /**
  10588. * 弹出密码找回
  10589. *
  10590. */
  10591. U.MD.U.F.findPassword = function () {
  10592. var _parent = U.selectEl("#U_MD_U_L_login"); //登录注册框
  10593. //弹出密码找回
  10594. var _child = _parent.Child(); //获取登录注册找回密码的div
  10595. _child[1].style.display = "none"; //隐藏注册
  10596. _child[2].style.display = "none"; //隐藏登录
  10597. U.selectEl("div", _child[0])[2].innerHTML = "找回密码";
  10598. //头部设置内容
  10599. var _head = U.selectEl(_child[0]).childs()[1];
  10600. U.selectEl(_head).addAttrArray({
  10601. "innerHTML": "",
  10602. "onclick": null,
  10603. "className": "",
  10604. "title": ""
  10605. });
  10606. //调用找回密码的上下部的处理,设置为第一步
  10607. U.MD.U.F.findPasswordProcessing($(_child[3]).Child()[1], 0);
  10608. //显示的默认密保找回处理
  10609. U.MD.U.F.switchEmailOrSecurityFind($("span", _child[3])[0], 'security');
  10610. _child[3].style.display = "block"; //显示找回密码
  10611. }
  10612. /**
  10613. * 手机号找回后的上下步操作处理
  10614. *
  10615. * @param {element} 找回密码元素
  10616. * @param {int} 第几步
  10617. */
  10618. U.MD.U.F.findPasswordProcessing = function (el, displaynum) {
  10619. var _inputs,
  10620. _len,
  10621. _bottom,
  10622. _child = U.selectEl(el).Child(), //获取找回和确认找回的两个步骤的元素
  10623. _parentel = U.selectEl(el).Parent();
  10624. //找回密码确认上下步处理
  10625. for (i = 0; i < _child.length; i++) {
  10626. //判断显示的隐藏的区域处理
  10627. if (i == displaynum) { //如果是显示
  10628. _child[i].style.display = "block";
  10629. _inputs = U.selectEl("input", _child[i]); //获取显示的元素下的input元素
  10630. _len = _inputs.length; //输入框的总长度
  10631. }
  10632. else { //隐藏
  10633. _child[i].style.display = "none";
  10634. }
  10635. }
  10636. //使用聚焦和释放的方式,重新设置input的初始化样式
  10637. while (_len--) {
  10638. _inputs[_len].value = "";
  10639. _inputs[_len].innerText = "6-20位字符或数字";
  10640. _inputs[_len].focus();
  10641. _inputs[_len].blur();
  10642. }
  10643. }
  10644. /**
  10645. * 切换找回的方式,邮箱,密保,手机切找回的方式
  10646. *
  10647. */
  10648. U.MD.U.F.switchEmailOrSecurityFind = function (el, typename) {
  10649. var _input,
  10650. _tempel,
  10651. _parentel = U.selectEl(el).Parent(2),
  10652. _childs = U.selectEl(_parentel).Child(),
  10653. _inputs = U.selectEl("input", _parentel),
  10654. _span = U.selectEl("span", _parentel),
  10655. _is = U.selectEl("i", _parentel),
  10656. _bottom = U.selectEl(_parentel).Child()[2],
  10657. _code = U.selectEl("#U_MD_U_L_Overflow_Code")[0]; //验证码框
  10658. //如果是邮箱找回处理
  10659. if (typename == "email") {
  10660. _input = _inputs[1];
  10661. _tempel = $$("input", {
  10662. "type": "text",
  10663. "onblur": function () {
  10664. U.MD.U.F.checkEmail(this); U.selectEl(this).parentElement(2).removeClass('U_MD_U_L_Box_Border');
  10665. },
  10666. "onfocus": _input.onfocus,
  10667. "onkeyup": _input.onkeyup
  10668. });
  10669. _input.parentNode.replaceChild(_tempel, _input);
  10670. _is[1].innerText = "请输入邮箱";
  10671. _span[1].className = "U_MD_U_F_T_Hover";
  10672. _span[0].className = "";
  10673. _code.style.display = "none"; //验证码框
  10674. _bottom.onclick = function () {
  10675. U.MD.U.F.findPasswordByEmail(_childs[1]);
  10676. }
  10677. }
  10678. //如果是手机找回处理
  10679. else if (typename == 'security') {//更改style
  10680. _input = _inputs[1];
  10681. _tempel = $$("input", {
  10682. "type": "text",
  10683. "onblur": function () {
  10684. U.MD.U.F.checkPhone(this); U.selectEl(this).parentElement(2).removeClass('U_MD_U_L_Box_Border');
  10685. }, //更改onblur事件
  10686. "onfocus": _input.onfocus, //更改onfocus事件
  10687. "onkeyup": _input.onkeyup//更改onkeyup事件
  10688. });
  10689. _input.parentNode.replaceChild(_tempel, _input); //替换
  10690. _is[1].innerText = "请输入手机号";
  10691. _span[0].className = "U_MD_U_F_T_Hover"; //更改class
  10692. _span[1].className = ""; //更改class
  10693. _code.style.display = "block"; //验证码框
  10694. _inputs[3].value = "发送"; //验证码框内的value
  10695. _inputs[3].onclick = function () {//验证码框的点击事件
  10696. U.MD.U.F.userName(U.MD.U.F.phoneSend); //验证用户名是否存在
  10697. }
  10698. _bottom.onclick = function () {//设定提交按钮的点击事件
  10699. U.MD.U.F.phoneConfirm(_childs[1]); //确认验证码
  10700. }
  10701. }
  10702. }
  10703. //#endregion
  10704. //#region 手机找回
  10705. /**
  10706. * 手机号设置
  10707. *
  10708. * @param {element} 手机号设置处理
  10709. */
  10710. U.MD.U.F.checkSecurityCode = function (el) {
  10711. var _inputs = U.selectEl("input", el), //输入框
  10712. _username = _inputs[0], //密码
  10713. _phone = _inputs[1]; //确认手机号
  10714. if (U.MD.U.F.checkUserName(_username) && U.MD.U.F.checkPhone(_phone)) {//判断账号和手机号是否输入指定格式
  10715. U.MD.U.F.phoneCheckSecurityCode(["", el, _username, _phone])//调用后台处理用户的修改密码
  10716. }
  10717. }
  10718. /**
  10719. * 手机发送验证码
  10720. *
  10721. */
  10722. U.MD.U.F.phoneSend = function () {
  10723. var _username = U.selectEl("#U_MD_U_L_Box_height")[0].children[0].children[0].value; //用户名
  10724. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserName", _username], function (r) {//根据用户名获取用户信息
  10725. if (r.value[0] == undefined) { //判断是否输入手机号
  10726. U.MD.U.R.setInputStyle($("#userphone")[0].children[0], {//给$("#userphone")[0].children[0] 设置 一个红色边框的样式 让用户知道你输入的手机号与账号设置的手机号不匹配
  10727. "color": "red",
  10728. "textAlign": "right",
  10729. "display": "block"
  10730. }, "输入的手机号与账号不匹配");
  10731. return false; //如果输入手机号与账号设置的手机号不匹配 return false
  10732. }
  10733. if (r.value[0].UserTelephoneNumber != U.selectEl("#userphone")[0].children[0].children[0].value) {//如果输入手机号与账号设置的手机号不匹配)
  10734. U.MD.U.R.setInputStyle($("#userphone")[0].children[0], {//给$("#userphone")[0].children[0] 设置 一个红色边框的样式 让用户知道你输入的手机号与账号设置的手机号不匹配
  10735. "color": "red",
  10736. "textAlign": "right",
  10737. "display": "block"
  10738. }, "输入的手机号与账号不匹配");
  10739. return false; //如果输入手机号与账号设置的手机号不匹配 return false
  10740. }
  10741. else {//如果输入手机号与账号匹配 向手机发送验证码
  10742. // U.A.Request("http://api.cloudsql.1473.cn/postnumber", [$("#userphone")[0].children[0].children[0].value], function (r) {
  10743. // console.log(r);
  10744. // });
  10745. var _xhttp = new XMLHttpRequest(); //XMLHttpRequest 对象用于在后台与服务器交换数据
  10746. _xhttp.onreadystatechange = function () {//每当 readyState 属性改变时,就会调用该函数。
  10747. if (this.readyState == 4) {//发送成功后
  10748. if (this.status == 201) {
  10749. U.Alert('发送成功'); //弹出发送成功
  10750. U.MD.U.F.setTime($("#U_MD_U_L_Overflow_Code")[0].children[1].children[0]); //60秒倒计时
  10751. } else {
  10752. U.Alert(JSON.parse(this.response).err || '验证码发送失败,请重新发送...');
  10753. }
  10754. }
  10755. };
  10756. _xhttp.open("POST", "http://api.cloudsql.1473.cn/postnumber", true); //指定和服务器端交互的HTTP方法,URL地址及其他请求信息
  10757. _xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //向一个打开但未发送的请求设置或添加一个 HTTP 请求
  10758. _xhttp.withCredentials = true; //发送cookie等认证信息到服务端
  10759. _xhttp.send("number=" + U.selectEl("#userphone")[0].children[0].children[0].value); //$("#userphone")[0].children[0].children[0].value 发送的手机号输入的框
  10760. // U.A.Request.Post("http://api.cloudsql.1473.cn/postnumber", { number: U.selectEl("#userphone")[0].children[0].children[0].value }, function () {
  10761. // U.MD.U.F.setTime($("#U_MD_U_L_Overflow_Code")[0].children[1].children[0]); //60秒倒计时
  10762. // U.Alert('发送成功'); //弹出发送成功
  10763. // });
  10764. }
  10765. })
  10766. }
  10767. /**
  10768. * 手机确认验证码
  10769. *
  10770. * @param {element} 确认验证码的按钮
  10771. */
  10772. U.MD.U.F.phoneConfirm = function (el) {
  10773. var _xhttp = new XMLHttpRequest(); //XMLHttpRequest 对象用于在后台与服务器交换数据
  10774. _xhttp.onreadystatechange = function () {//每当 readyState 属性改变时,就会调用该函数
  10775. if (this.readyState == 4) {//验证成功后
  10776. if (this.status == 201) {
  10777. U.MD.U.F.checkSecurityCode(el); //手机号设置
  10778. U.Alert("验证成功"); //弹出验证成功
  10779. } else {
  10780. U.Alert(JSON.parse(this.response).err || "验证码有误");
  10781. }
  10782. }
  10783. };
  10784. _xhttp.open("POST", "http://api.cloudsql.1473.cn/verifi", true); ////指定和服务器端交互的HTTP方法,URL地址及其他请求信息
  10785. _xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //向一个打开但未发送的请求设置或添加一个 HTTP 请求
  10786. _xhttp.withCredentials = true; //发送cookie等认证信息到服务端
  10787. _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 验证码输入的框
  10788. }
  10789. /**
  10790. * 手机重新发送验证码倒计时
  10791. * @param {object} 倒计时的对象
  10792. * @param {number} 倒计时的时间(秒数)
  10793. */
  10794. U.MD.U.F.setTime = function (obj, countdown) {
  10795. var countdown = 60;
  10796. var _settime = setInterval(function () { //setInterval(需要执行的javascript代码,在执行代码前需等待的毫秒数)
  10797. if (countdown == 0) { //倒计时变量为0
  10798. obj.removeAttribute("disabled"); //让obj可以使用
  10799. obj.value = "重新获取验证码";
  10800. clearInterval(_settime); //停止倒计时
  10801. return;
  10802. } else {//如果countdown不等于零 每秒countdown会减少1
  10803. obj.setAttribute("disabled", true); //禁用obj
  10804. obj.value = "重新发送(" + countdown + ")"; //显示倒计时的事件
  10805. countdown--; //倒计时时间 -1S
  10806. }
  10807. }, 1000);
  10808. }
  10809. /**
  10810. * 验证用户名是否存在
  10811. *
  10812. * @param {function} cb 回调函数
  10813. */
  10814. U.MD.U.F.userName = function (cb) {
  10815. U.A.Request(US.USER, ["CheckUserName", U_MD_U_L_Box_height.children[0].children[0].value], //验证用户名是否存在
  10816. function (r) {//回调函数
  10817. var _str = U.UF.C.jsonToStr(r.value); //序列化json为字符串
  10818. if (_str == "false") {//如果用户名不存在
  10819. U.MD.U.R.setInputStyle(U_MD_U_L_Box_height, {//如果不存在 用户名的框变红色 并且提示 用户名不存在
  10820. "color": "red",
  10821. "textAlign": "right",
  10822. "display": "block"
  10823. }, "用户名不存在");
  10824. }
  10825. cb(); //回调函数
  10826. })
  10827. }
  10828. /**
  10829. * 手机号设置处理
  10830. *
  10831. * @param {object} 数据库匹配手机号是否正确
  10832. */
  10833. U.MD.U.F.phoneCheckSecurityCode = function (r) {
  10834. var _bottom,
  10835. _childs,
  10836. _username = r[2], //输入密码框
  10837. _enterpassword = r[3], //确认密码框
  10838. _el = U.selectEl(_username).Parent(4)
  10839. ;
  10840. //如果密保匹配成功处理
  10841. if (r) {
  10842. //如果账号和手机号匹配成功的处理
  10843. U.MD.U.F.findPasswordProcessing(_el, 1); //手机找回的步骤
  10844. _bottom = U.selectEl(_el.parentNode).Child()[2]; //得到确认框
  10845. _childs = U.selectEl("input", _el); //获取所有的输入
  10846. //点击事件处理
  10847. _bottom.onclick = function () {
  10848. U.MD.U.F.setNewUserPassword(r, _childs[1]); //新密码设置
  10849. };
  10850. }
  10851. else {
  10852. //账号或者密保错误
  10853. U.MD.U.R.setInputStyle(_enterpassword, {//给_enterpassword 设置 一个红色边框的样式 让用户知道用户输入账号或者密保错误
  10854. "color": "red",
  10855. "textAlign": "right",
  10856. "display": "block"
  10857. }, "账号或者密保错误");
  10858. }
  10859. }
  10860. /**
  10861. * 新密码设置
  10862. *
  10863. * @param {string} 用户id
  10864. * @param {string} 密码
  10865. * @param {string} 确认密码
  10866. * @param {string} 用户id
  10867. */
  10868. U.MD.U.F.setNewUserPassword = function (userinfo, phone) {
  10869. //判断用户输入的密码是否正确的处理
  10870. var _newpassword = userinfo[1].children[1].children[0].children[0].children[0].value; //密码
  10871. var _newpasswordt = userinfo[1].children[1].children[1].children[0].children[0].value; //再次输入密码
  10872. if (U.MD.U.F.checkConfirmPassword(_newpassword, _newpasswordt)) {//如果 密码和再次输入的密码 相同
  10873. U.A.Request(US.USER, ["UpdateUserPasswordByOldPhoneNumber", phone.value, _newpassword], //修改密码
  10874. U.MD.U.F.asynSetNewUserPassword); //修改密码成功后执行的函数
  10875. }
  10876. }
  10877. /**
  10878. * 新密码设置
  10879. *
  10880. * @param {object} 设置密码成功的异步ajax对象
  10881. */
  10882. U.MD.U.F.asynSetNewUserPassword = function (r) {
  10883. if (r.value) {
  10884. U.alert("修改密码成功,请登录");
  10885. U.MD.U.L.login(); //直接回到登录页面
  10886. };
  10887. }
  10888. //#endregion
  10889. //#region 通过邮箱找回
  10890. /**
  10891. * 通过邮箱找回
  10892. *
  10893. * @param {element} 输入框所在的位置
  10894. */
  10895. U.MD.U.F.findPasswordByEmail = function (el) {
  10896. var _inputs = U.selectEl("input", el),
  10897. _username = _inputs[0],
  10898. _email = _inputs[1];
  10899. //判断是否发送邮箱
  10900. if (U.MD.U.F.checkEmail(_email) && U.MD.U.F.checkUserName(_username)) {
  10901. U.A.Request(US.USER, ["FindPasswordByEmail", _username.value, _email.value], U.MD.U.F.asynFindPasswordByEmail);
  10902. }
  10903. }
  10904. /**
  10905. * 通过邮箱找回
  10906. *
  10907. * @param {object} ajax返回的值
  10908. */
  10909. U.MD.U.F.asynFindPasswordByEmail = function (r) {
  10910. //成功发送
  10911. if (r.value == "2") {
  10912. U.alert("已经发送邮箱,请及时查看密码");
  10913. U.MD.U.L.init();
  10914. //U.MD.U.L.login(); //直接回到登录页面
  10915. }
  10916. //账号不存在处理
  10917. else if (r.value == "0") {
  10918. U.alert("您输入的账号不存在");
  10919. }
  10920. //邮箱和账号不匹配处理
  10921. else if (r.value == "1") {
  10922. U.alert("邮箱账号不匹配");
  10923. }
  10924. }
  10925. //#endregion
  10926. //#region 密码和密保检查
  10927. /**
  10928. * 判断有限是否正确
  10929. *
  10930. * @param {object} 输入用户名的框
  10931. */
  10932. U.MD.U.F.checkEmail = function (inputel) {
  10933. var _email = inputel.value; //获取用户名
  10934. //输入为空不做变化
  10935. if (_email == "") {
  10936. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "请输入邮箱"); //输入的用户名为空的样式处理
  10937. }
  10938. //注册的用户不符合要求
  10939. else if (!U.UF.S.Email.test(_email)) {
  10940. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right' }, "请输入正确邮箱"); //注册用户名不符合提示
  10941. }
  10942. else {
  10943. return true;
  10944. }
  10945. return false;
  10946. }
  10947. /**
  10948. * 手机号输入格式检查
  10949. *
  10950. * @param {object} 输入手机号的框
  10951. */
  10952. U.MD.U.F.checkPhone = function (inputel) {
  10953. var _password = inputel.value; //输入手机号的value
  10954. //如果没有输入手机号
  10955. if (_password == "") {
  10956. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "请输入手机号"); //没有输入手机号的提示
  10957. }
  10958. //输入的手机号的格式不对
  10959. else if (!/^1[3|4|5|8][0-9]\d{4,8}$/.test(_password)) {
  10960. U.MD.U.R.setInputStyle(inputel, { "display": "block", "color": "red", 'textAlign': 'right' }, "请输入有效手机号"); //输入的手机号有问题
  10961. }
  10962. else {
  10963. return true;
  10964. }
  10965. return false;
  10966. }
  10967. /**
  10968. * 密码输入格式检查
  10969. *
  10970. * @param {object} 输入密码的框
  10971. */
  10972. U.MD.U.F.checkPass = function (inputel) {
  10973. var _password = inputel.value;
  10974. //如果没有输入密码
  10975. if (_password == "") {
  10976. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "6-20位字符或数字"); //没有输入密码的提示
  10977. }
  10978. //输入的密码的格式不对
  10979. else if (!U.UF.S.PassWord.test(_password)) {
  10980. U.MD.U.R.setInputStyle(inputel, { "display": "block", "color": "red", 'textAlign': 'right' }, "6-20位字符或数字"); //输入的密码有问题
  10981. }
  10982. else {
  10983. return true;
  10984. }
  10985. return false;
  10986. }
  10987. /**
  10988. * 验证码输入格式
  10989. *
  10990. */
  10991. U.MD.U.F.Verification = function (inputel) {
  10992. var _code = inputel.value;
  10993. //如果没有输入验证码
  10994. if (_code == "") {
  10995. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "请输入验证码"); //没有输入验证码的提示
  10996. }
  10997. //输入的验证码的格式不对
  10998. else if (!/^\d{4,6}$/.test(_code)) {
  10999. U.MD.U.R.setInputStyle(inputel, { "display": "block", "color": "red", 'textAlign': 'right' }, "请输入4-6位数的验证码"); //输入的验证码有问题
  11000. }
  11001. else {
  11002. return true;
  11003. }
  11004. return false;
  11005. }
  11006. /**
  11007. * 判断输入框的值是否是账号或者邮箱
  11008. *
  11009. */
  11010. U.MD.U.F.checkUserName = function (inputel) {
  11011. var _username = inputel.value; //获取用户名
  11012. //输入为空不做变化
  11013. if (_username == "") {
  11014. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "云端账号"); //输入的用户名为空的样式处理
  11015. }
  11016. //注册的用户不符合要求
  11017. else if (!U.UF.S.UserName.test(_username)) {
  11018. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right' }, "4-14位数字或者字母"); //注册用户名不符合提示
  11019. }
  11020. else {
  11021. return true;
  11022. }
  11023. return false;
  11024. }
  11025. /**
  11026. * 判断输入密码和确认密码是否一致处理
  11027. *
  11028. * @param {element} 密码
  11029. * @param {element} 确认密码
  11030. */
  11031. U.MD.U.F.checkConfirmPassword = function (inputo, inputt) {
  11032. var _password = inputt.value;
  11033. //如果没有输入密码
  11034. if (_password == "") {
  11035. U.MD.U.R.setInputStyle(inputt, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "6-20位字符或数字"); //没有输入密码的提示
  11036. }
  11037. //输入的密码的格式不对
  11038. else if (!U.UF.S.PassWord.test(_password)) {
  11039. U.MD.U.R.setInputStyle(inputt, { "display": "block", "color": "red", 'textAlign': 'right' }, "6-20位字符或数字"); //输入的密码有问题
  11040. }
  11041. //输入密码和确认密码不相同
  11042. else if (inputo.value != inputt.value) {
  11043. U.MD.U.R.setInputStyle(inputt, { "display": "block", "color": "red", 'textAlign': 'right' }, "密码不一致"); //输入的密码有问题
  11044. }
  11045. else {
  11046. return true;
  11047. }
  11048. return false;
  11049. }
  11050. //#endregion
  11051. ;
  11052. ///<jscompress sourcefile="Login.js" />
  11053. Namespace.register("U.MD.U.L"); //用户登录的命名空间
  11054. /*
  11055. 问题:
  11056. 1、验证码的接口问题
  11057. 2、无窗体的接口
  11058. */
  11059. //#region 配置数据
  11060. //U.MD.U.L.loginCallBack; //登录后的回调使用
  11061. //U.MD.U.L.isLogining = false; //判断用户登录状态。cookie登录状态为cookie,账号登录为true,没有登录为false
  11062. //#endregion
  11063. //#region 登录
  11064. U.MD.U.L.init = function () {
  11065. var _parent = U.selectEl("#U_MD_U_L_login"); //登录注册框
  11066. var _child = _parent.Child(); //获取登录注册找回密码的div
  11067. _child[1].style.display = "none"; //隐藏注册框
  11068. _child[2].style.display = "block"; //显示登录
  11069. _child[3].style.display = "none"; //隐藏找回密码
  11070. //标题修改
  11071. U.selectEl("div", _child[0])[2].innerHTML = "登录";
  11072. //头部设置内容
  11073. var _head = U.selectEl(_child[0]).childs()[1];
  11074. U.selectEl(_head).addAttrArray({
  11075. innerHTML: "",
  11076. "className": "",
  11077. title: ""
  11078. });
  11079. var _username = U.UF.Cookie.get("usestudiosso", "username")[0]; //上次登录的用户名
  11080. var _input = U.selectEl("input", _child[2]);
  11081. if (_username) { //cookie存在 登录处理
  11082. _input[0].focus(); //聚焦处理
  11083. _input[0].value = _username; //设置cookie用户名
  11084. _input = _input[1]; //当前需要聚焦
  11085. }
  11086. else { //注册 找回密码 聚焦元素处理
  11087. _input = _input[0];
  11088. }
  11089. _input.focus();
  11090. }
  11091. /**
  11092. * 判断用户是否登录如果未登陆则弹出登陆框
  11093. * @param {element} 输入框
  11094. * @param {element} 确定框
  11095. *
  11096. */
  11097. U.MD.U.L.loginEnter = function (inputel, bottomel) {
  11098. var i,
  11099. _parentel = U.selectEl(inputel).Parent(3), //获取父亲层
  11100. _inputs = U.selectEl("input", _parentel); //获取所有的输入框
  11101. //循环input
  11102. for (i = 0; i < _inputs.length; i++) {
  11103. if (_inputs[i].value == "") { //如果没有输入文字的处理
  11104. _inputs[i].focus();
  11105. return;
  11106. }
  11107. }
  11108. //回车处理
  11109. bottomel.onclick();
  11110. }
  11111. //#endregion
  11112. //#region 登录数据使用
  11113. /**
  11114. * 1473桌面直接登录,单击登录按钮时触发的函数
  11115. * @param {object} ajax返回值
  11116. *
  11117. */
  11118. U.MD.U.L.clickLogin = function (bottomel) {
  11119. var _parentel = U.selectEl(bottomel).Parent(), //类名为"U_MD_U_L_T"的div元素
  11120. _inputel = U.selectEl("input", _parentel), //获取里面的input,共三个
  11121. _username = _inputel[0].value, //第一个input为用户名
  11122. _password = _inputel[1].value, //第二个input为密码
  11123. _static = _inputel[2].checked ? "1" : "0"; //第三个input为状态
  11124. //以前已经登录过,则直接跳转回调函数
  11125. if (_username && _username == US.userInfo.UserName) {
  11126. U.selectEl("#U_MD_HomeC_Pop")[0].close(); //关闭登陆款
  11127. }
  11128. //以前没有登录过,则清空密码输入 等待用户登录
  11129. else if (U.MD.U.L.loginAjax(_username, _password, _static, U.selectEl(_parentel).Parent())) {
  11130. _inputel[1].value = ""; //密码清空
  11131. }
  11132. }
  11133. /*
  11134. 功能:用户登录云端接口,向后台发送请求,记录用户名和密码,后面还有一个登陆获取用户个人信息。好友信息,及消息通知
  11135. 参数一:用户名
  11136. 参数二:密码
  11137. 参数三:登录窗口div元素,做loading的位置
  11138. 参数四:回调函数
  11139. */
  11140. U.MD.U.L.loginAjax = function (username, password, staticm, loading, fun) {
  11141. var _logaddress = US.city.userAllLocation || ""; //登录地址;
  11142. //加载用户信息 且进行异步处理
  11143. if (username.removeP() && password.removeP()) {
  11144. if (fun) { U.MD.U.L.loginCallBack = fun; } //设置回调函数
  11145. U.MD.U.L.isLogining = true; //电脑卡的时候,用户一直点登录,此处判断用户是否已经按下了登录按钮。
  11146. //此处指返回用户基本信息
  11147. U.A.Request(US.USER, ["UserLogin", username, password, staticm], U.MD.U.L.asynLoginAjax, [loading, _logaddress, username, password]);
  11148. return true;
  11149. }
  11150. }
  11151. /**
  11152. * 用户登录执行事件
  11153. * @param {object} ajax返回的对象
  11154. * @param {boolean} 是否是cookie登陆
  11155. *
  11156. */
  11157. U.MD.U.L.asynLoginAjax = function (r, iscookie) {
  11158. if ($('#U_MD_U_L_Login_B')[0]) {
  11159. U.selectEl('#U_MD_U_L_Login_B')[0].innerHTML = '登录';
  11160. }
  11161. if (U.MD.U.L.loginCallBack) {
  11162. U.MD.U.L.loginCallBack(r, iscookie); //回调处理
  11163. }
  11164. }
  11165. /**
  11166. * 判断用户名是否符合要求
  11167. *
  11168. */
  11169. U.MD.U.L.checkUserName = function (inputel) {
  11170. var _username = inputel.value; //获取用户名
  11171. //输入为空不做变化
  11172. U.selectEl('.U_MD_U_L_Box_B').removeClass('U_MD_U_L_Box_mistakeBorder');
  11173. if ($('.U_MD_U_L_Box_checkUseNameFormat')[0]) {//检测账号格式提示是否存在
  11174. U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkUseNameFormat')[0]);
  11175. }
  11176. if (_username == "") {
  11177. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "用户账号"); //输入的用户名为空的样式处理
  11178. return false;
  11179. }
  11180. //注册的用户不符合要求
  11181. else if (!U.UF.S.UserName.test(_username)) {
  11182. $$("div", { className: 'checkUseNameFormat' }, U.selectEl(".U_MD_U_L_Box_B")[0]);
  11183. U.selectEl('.U_MD_U_L_Box_B').addClass(" U_MD_U_L_Box_mistakeBorder");
  11184. U_MD_U_L_createFormat($('.U_MD_U_L_LB')[1], U.selectEl('.U_MD_U_L_Box_P_B')[1]);
  11185. //U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right', 'marginRight': '15px' }, "2-10汉字或4-20字符"); //注册用户名不符合提示
  11186. return false;
  11187. }
  11188. return true;
  11189. }
  11190. /**
  11191. *创建用户账号是否标准提醒
  11192. *
  11193. */
  11194. U_MD_U_L_createFormat = function (parentnode, beforenode) {
  11195. if ($('.U_MD_U_L_Box_checkUseNameFormat')[0]) {
  11196. U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkUseNameFormat')[0]);
  11197. }
  11198. var _format = document.createElement('div');
  11199. _format.className = "U_MD_U_L_Box_checkUseNameFormat";
  11200. _format.innerText = "2-10汉字或4-20字符";
  11201. parentnode.insertBefore(_format, beforenode);
  11202. }
  11203. /**
  11204. * 判断用户名是否符合要求
  11205. *
  11206. */
  11207. U.MD.U.L.checkpassword = function (inputel) {
  11208. var _password = inputel.value; //获取用户名
  11209. //输入为空不做变化
  11210. if (_password == "") {
  11211. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "用户密码"); //输入的用户名为空的样式处理
  11212. }
  11213. }
  11214. //#endregion
  11215. ;
  11216. ///<jscompress sourcefile="Logout.js" />
  11217. Namespace.register("U.MD.U.LO"); //用户登录的命名空间
  11218. /**
  11219. * 退出登录提示
  11220. *
  11221. * @param callback {function} 登出回调函数
  11222. */
  11223. U.MD.U.LO.logoutSystem = function (callback) {
  11224. //如果用户登录的情况
  11225. if (US.userInfo.UserId) {
  11226. //弹出退出登录的提示
  11227. U.UF.UI.confirm("是否退出" + US.userInfo.UserName + "账号", function () {
  11228. U.MD.U.LO.logout(callback);
  11229. });
  11230. }
  11231. }
  11232. /**
  11233. * 退出登录的处理
  11234. *
  11235. */
  11236. U.MD.U.LO.logout = function (callback) {
  11237. U.MD.U.LO.clearCookie(function () {
  11238. U.MD.U.LO.emptyUserInfo(); //清楚用户的前端的数据
  11239. if ($('#UI_Login')[0]) {
  11240. U.selectEl('#UI_Login')[0].contentWindow.U.MD.U.OT.logout(); //如果是第三方平台登录的,在第三方平台进行下线
  11241. }
  11242. //清理图形界面的处理
  11243. if ($("#U_MD_D_BDI")[0]) {
  11244. //清空所有的应用
  11245. U.MD.U.LO.logoutStyle(); //清除注册样式
  11246. U.MD.D.T.taskbar.clear(); //任务栏清除
  11247. U.UF.UI.form.closeWindows(); //关闭所有的窗体
  11248. }
  11249. U.UF.C.isFunction(callback) && callback();
  11250. }); //退出账号的cookie
  11251. }
  11252. /**
  11253. * 用户退出指定帐号 清理cookie
  11254. *
  11255. */
  11256. U.MD.U.LO.clearCookie = function (callback) {
  11257. //判断用户是否登录
  11258. if (US.userInfo.UserId) {
  11259. var _iscookie = U.UF.Cookie.get("usestudiosso", "userid").indexOf(US.userInfo.UserId) > -1; //判断cookie是否还存在用户的id
  11260. //如果存在cookie的出力
  11261. if (_iscookie) {
  11262. //调用后台,让用户注销
  11263. U.A.Request(US.USER, ["UserOffline", US.userInfo.UserId], function () { U.UF.C.isFunction(callback) && callback(); });
  11264. }
  11265. else {
  11266. U.UF.C.isFunction(callback) && callback();
  11267. }
  11268. }
  11269. }
  11270. /**
  11271. * 清空用户前端的信息
  11272. *
  11273. */
  11274. U.MD.U.LO.emptyUserInfo = function () {
  11275. US.userInfo = {}; //用户数据清空
  11276. US.friend = {}; //用户好友信息清空
  11277. if ($("#U_MD_D_BG")[0]) {
  11278. U.MD.D.B.setBackgroundImage(U.MD.D.B.url); //设置默认背景
  11279. }
  11280. }
  11281. /**
  11282. * 注销样式
  11283. *
  11284. */
  11285. U.MD.U.LO.logoutStyle = function () {
  11286. //清楚登录用户的样式
  11287. U.selectEl("#U_MD_D_BDI").addAttrArray({
  11288. "innerHTML": "",
  11289. "className": "U_MD_D_BDI U_Img"
  11290. });
  11291. //获取子元素
  11292. var _childel = U.selectEl("#U_MD_D_BDL").childs();
  11293. _childel[0].style.display = _childel[1].style.display = "block"; //显示登录注册
  11294. _childel[2].style.display = "none"; //隐藏提出按钮
  11295. //右边好友框隐藏
  11296. U.selectEl("#U_MD_F_H_R").css("display", "none");
  11297. //隐藏消息提醒
  11298. U.selectEl("#U_MD_D_MG_OA").Parent(2).style.display = "none";
  11299. //隐藏所有的窗体
  11300. // U.selectEl("#U_MD_Home").childs().css("display", "none");
  11301. }
  11302. ;
  11303. ///<jscompress sourcefile="OutsideLogin.js" />
  11304. Namespace.register("U.MD.U.OT"); //用户登录的命名空间
  11305. //推送的广告词
  11306. U.MD.U.OT.advertisingLanguage = "最新科技:云操作系统,您也来加入吧!点击进入哦!";
  11307. //#region 加载外联登录
  11308. /**
  11309. * 异步加载qq登录的js
  11310. *
  11311. * @param {array} 加载按钮样式(参考qq登录api)
  11312. */
  11313. U.MD.U.OT.qqLoadJs = function (bottonstyle) {
  11314. //加载第三方登录的js
  11315. U.UF.DL.asynLoadJs({
  11316. "data-appid": "100584402",
  11317. "charset": "utf-8",
  11318. "src": "http://qzonestyle.gtimg.cn/qzone/openapi/qc-1.0.1.js"
  11319. },
  11320. function () {
  11321. U.MD.U.OT.asynQqLoadJs(bottonstyle); //腾讯登录加载
  11322. });
  11323. }
  11324. /**
  11325. * qq登录加载异步js成功处理
  11326. *
  11327. * @param {array} 加载按钮样式(参考qq登录api)
  11328. */
  11329. U.MD.U.OT.asynQqLoadJs = function (bottonstyle) {
  11330. //调用加载qq登录按钮加载函数
  11331. QC.Login(bottonstyle, function (qquserinfo) {
  11332. U.MD.U.OT.qqLoginCallBack(qquserinfo);
  11333. });
  11334. //由于qq登录按钮加载后会出现a标签,所以点击会出现错位于是会这里把a标签的href修改成"javascript:void(0)"
  11335. U.selectEl("a", U.selectEl("#" + bottonstyle["btnId"])[0]).addAttrArray({ "href": "javascript:void(0)" });
  11336. }
  11337. /**
  11338. * 异步加载微博登录的js
  11339. *
  11340. * @param {array} 加载按钮样式(参考微博登录api)
  11341. */
  11342. U.MD.U.OT.weiboLoadJs = function (bottonstyle) {
  11343. //异步加载使用,微博登录加载
  11344. U.UF.DL.asynLoadJs({
  11345. "charset": "utf-8",
  11346. "src": "http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=1242324937", //&i=" + Guid.newGuid()
  11347. "charset": "utf-8",
  11348. "type": "text/javascript"
  11349. },
  11350. function () {
  11351. //微博按钮加载处理
  11352. WB2.anyWhere(function (wb) {
  11353. wb.widget.connectButton(bottonstyle); //加载按钮
  11354. U.selectEl("a", U.selectEl("#" + bottonstyle["id"])[0]).addAttrArray({ "href": "javascript:void(0)" });
  11355. });
  11356. });
  11357. }
  11358. /**
  11359. * 异步加载微信登录js
  11360. *
  11361. * @param {array} 加载按钮样式(参考微信登录api)
  11362. */
  11363. U.MD.U.OT.weixinLoadJs = function (bottonstyle) {
  11364. //异步加载微信登录
  11365. U.UF.DL.asynLoadJs({
  11366. "charset": "utf-8",
  11367. "src": "http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js",
  11368. "charset": "utf-8",
  11369. "type": "text/javascript"
  11370. },
  11371. function () {
  11372. //初始化微信
  11373. new WxLogin({
  11374. id: bottonstyle.ID || "",
  11375. appid: "wxae62986df7490c49",
  11376. scope: "snsapi_login",
  11377. redirect_uri: "",
  11378. state: bottonstyle.state || Guid.newGuid(),
  11379. style: bottonstyle.style || "",
  11380. href: bottonstyle.href || ""
  11381. });
  11382. });
  11383. }
  11384. /**
  11385. * 注销第三方登录
  11386. *
  11387. */
  11388. U.MD.U.OT.logout = function () {
  11389. try {
  11390. //退出微博登陆
  11391. if (WB2 && WB2.checkLogin()) {
  11392. WB2.logout();
  11393. }
  11394. } catch (e) { }
  11395. try {
  11396. //退出qq登陆
  11397. if (QC && QC.Login.check()) {
  11398. QC.Login.signOut();
  11399. }
  11400. } catch (e) { }
  11401. }
  11402. //#endregion
  11403. //#region 腾讯登录
  11404. /**
  11405. * 腾讯登录回调
  11406. *
  11407. */
  11408. U.MD.U.OT.qqLoginCallBack = function () {
  11409. //如果用户已经通过qq登录的处理
  11410. if (QC.Login.check()) {
  11411. //获取用户登录openid
  11412. QC.Login.getMe(function (openid, token) {
  11413. var _qquserinfo = {}; //最终得到的qq信息
  11414. _qquserinfo.accessToken = token; //token
  11415. _qquserinfo.openID = openid; //openid
  11416. //获取用户信息
  11417. QC.api("get_user_info", {}).success(function (userinfo) {
  11418. userinfo = userinfo.data; //qq用户信息回调
  11419. //获取用户基本信息
  11420. _qquserinfo.UserNickName = userinfo.nickname; //用户基本信息
  11421. _qquserinfo.gender = userinfo == "男" ? 1 : 0; //用户的性别
  11422. _qquserinfo.province = userinfo.province;
  11423. _qquserinfo.city = userinfo.city;
  11424. _qquserinfo.Birthday = U.UF.D.toTimeStamp(_qquserinfo.year + "/01/01");
  11425. //腾讯微博基本信息
  11426. QC.api("get_info", {}).success(function (weibouserinfo) {
  11427. weibouserinfo = weibouserinfo.data.data;
  11428. var _location = weibouserinfo.location.split(' ');
  11429. //发送一条雨云科技的消息
  11430. QC.api("add_pic_t", {
  11431. "content": U.MD.U.OT.advertisingLanguage,
  11432. "pic": "/img/qqew.jpg"
  11433. });
  11434. //关注我们的腾讯微博
  11435. QC.api("add_idol", {
  11436. "name": "雨云科技"
  11437. });
  11438. //登录用户信息
  11439. _qquserinfo.nickname = weibouserinfo.nick;
  11440. _qquserinfo.gender = weibouserinfo.sex;
  11441. _qquserinfo.openID = openidp;
  11442. _qquserinfo.accessToken = token;
  11443. _qquserinfo.province = _location[1];
  11444. _qquserinfo.city = _location[2];
  11445. _qquserinfo.description = weibouserinfo.introduction;
  11446. _qquserinfo.UserEmail = weibouserinfo.email;
  11447. _qquserinfo.Birthday = U.UF.D.toTimeStamp(weibouserinfo.birth_year + "-" + weibouserinfo.birth_month + "-" + weibouserinfo.birth_day, "-");
  11448. //获取信息成功后在1473中注册登录
  11449. U.MD.U.OT.thirdPartyLogin(_qquserinfo);
  11450. }).error(function () {
  11451. //如果微博没有信息,则直接用注册qq用户的信息
  11452. U.MD.U.OT.thirdPartyLogin(_qquserinfo);
  11453. });
  11454. }).error(function () { U.alert("获取用户信息失败"); })
  11455. });
  11456. }
  11457. }
  11458. //#endregion
  11459. //#region 微博登录
  11460. /**
  11461. * 微博登录成功或者失败后的回调函数
  11462. *
  11463. */
  11464. U.MD.U.OT.weiboLoginCallBack = function (userinfo) {
  11465. U.MD.U.OT.thirdPartyLogin(userinfo); //1473登录
  11466. WB2.anyWhere(function (WB2) { //调用
  11467. WB2.parseCMD("/statuses/update.json",
  11468. //利用微博登录授权后设置用户发送一条微博消息
  11469. function (message) { },
  11470. {
  11471. "status": U.MD.U.OT.advertisingLanguage
  11472. });
  11473. //让用户关注云端
  11474. WB2.parseCMD("/friendships/create.json",
  11475. function (message) { },
  11476. { "screen_name": "1473云端" });
  11477. });
  11478. }
  11479. /**
  11480. * 微博关注按钮,传入参数为需要关注的id。
  11481. *
  11482. */
  11483. U.MD.U.OT.addWeiboFollowBottom = function (id) {
  11484. //初始化得到微博功能
  11485. WB2.anyWhere(function (weibo) {
  11486. //设置按钮
  11487. weibo.widget.followButton({
  11488. "nick_name": "1473云端", //设置腾讯微博关注按钮
  11489. "id": id,
  11490. "show_head": false,
  11491. "show_name": false,
  11492. "show_cancel": false
  11493. });
  11494. });
  11495. }
  11496. //#endregion
  11497. //#region 微信登录处理
  11498. //2ed68d9671db0ee8ba114f69567502b6
  11499. /**
  11500. * 判断外链用户是否存在
  11501. *
  11502. * @param {array} 登录值参数
  11503. * @param {array} 回调函数
  11504. */
  11505. U.MD.U.OT.weixin = function () {
  11506. //防止二维码缓存。
  11507. U.MD.U.OT.wxData = { "id": Guid.newGuid() };
  11508. 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);
  11509. }
  11510. /**
  11511. * 微信注册异步回调区域
  11512. *
  11513. */
  11514. U.MD.U.OT.asynWeixin = function (str) {
  11515. var _co = U.UF.C.queryString("code", str), //获取code值
  11516. _state = U.UF.C.queryString("state", str); //回调状态
  11517. if (_state == U.MD.U.OT.wxData.id && _state != null) { //判断状态吗是否匹配
  11518. U.A.Request("http://zhifu.1473.cn/weixin/login.php?code=" + _co, [], function (r) {
  11519. if (r.value.openid) {
  11520. U.MD.U.OT.thirdPartyLogin(r.value); //登录
  11521. }
  11522. else {
  11523. U.alert("微信扫描登录失败");
  11524. }
  11525. });
  11526. }
  11527. }
  11528. //#endregion
  11529. //#region 外链登录成功使用
  11530. /**
  11531. * 判断外链用户是否存在
  11532. *
  11533. * @param {array} 登录值参数
  11534. */
  11535. U.MD.U.OT.thirdPartyLogin = function (userinfo) {
  11536. var _openid = userinfo.openID || userinfo.id || userinfo.openid; //userinfo.openID代表QQ的openid userinfo.id代表微博的openid userinfo.openid代表微信的openid
  11537. U.A.Request(US.USER, ["ThirdPartyLogin", _openid],
  11538. U.MD.U.OT.asynThirdPartyLogin, [null, userinfo]); //通过微博或者qq的openid 获取是否在1473上注册的用户
  11539. }
  11540. /**
  11541. * 微博或者qq云端登录异步
  11542. *
  11543. * @param {array} 登录值参数
  11544. * @param {array} 回调函数
  11545. */
  11546. U.MD.U.OT.asynThirdPartyLogin = function (r) {
  11547. //用户存在直接登录
  11548. if (typeof r.value == "object") {
  11549. U.MD.U.L.asynLoginAjax(r); //直接登录
  11550. }
  11551. //用户不存在填写资料
  11552. else {
  11553. U.MD.U.R.isregister[0] = U.MD.U.R.isregister[1] = false; //设置信息不成功
  11554. window.parent.U.MD.U.L.perfectUserInfo(r.context[1], r.value); //填写登录信息
  11555. }
  11556. }
  11557. //#endregion
  11558. //#region 外链登录
  11559. /**
  11560. * 默认分配的账号密码,可设置账号面膜
  11561. *
  11562. * @param {object} 用户信息
  11563. * @param {username} 默认的用户名
  11564. */
  11565. U.MD.U.OT.perfectUserInfoInit = function (userinfo, username) {
  11566. var i,
  11567. _password = U.UF.Math.getRandom(1000000), //生成一个数据密码
  11568. _el = U.selectEl("#U_MD_U_OT_B"), //获取第三方登录填写资料的框
  11569. _childs = _el.find("div"); //获取子元素
  11570. U.MD.U.R.isregister[0] = U.MD.U.R.isregister[1] = false; //设置注册的信息默认为false
  11571. //用户名的处理
  11572. while (username.toString().length < 6) {
  11573. username = "0" + username;
  11574. }
  11575. _childs[4].innerHTML = "账号:<span>" + username + "</span>"; //用户的账号
  11576. _childs[5].innerHTML = "密码:" + _password; //用户的密码
  11577. //取消按钮的设置
  11578. _childs[_childs.length - 1].onclick = function () {
  11579. U.MD.U.OT.userRegister(userinfo, false, username, _password);
  11580. }
  11581. //确定按钮的处理
  11582. _childs[_childs.length - 2].onclick = function () {
  11583. U.MD.U.OT.userRegister(userinfo, true);
  11584. }
  11585. }
  11586. /**
  11587. * 把用户填写的账号密码写入数据库
  11588. *
  11589. * @param {array} 登录值参数
  11590. * @param {array} 回调函数
  11591. */
  11592. U.MD.U.OT.userRegister = function (userinfo, b, username, password) {
  11593. var _openid, //第三方平台的openid
  11594. _el = U.selectEl("#U_MD_U_OT_B"),
  11595. _inputs = _el.find("input");
  11596. //点击确定密码自己设置
  11597. if (b) {
  11598. username = _inputs[0].value; //用户名
  11599. password = _inputs[1].value; //密码
  11600. }
  11601. //判断用户注册的信息是否通过
  11602. if (U.MD.U.R.isregister[0] && U.MD.U.R.isregister[1]) {
  11603. _openid = userinfo.openID || userinfo.id || userinfo.openid; //获取用户的唯一识别id
  11604. //调用ajax进行注册处理
  11605. U.A.Request(US.USER, ["UserRegister", username, password, "", US.city.userAllLocation || "", _openid],
  11606. U.MD.U.OT.asynUserRegister, [_el[0], userinfo]); //注册中
  11607. }
  11608. else {
  11609. U.alert("注册的信息有问题,请修改。");
  11610. }
  11611. }
  11612. /**
  11613. * 外链登录成功 同时修改个人信息
  11614. *
  11615. * @param {object} 注册用户的信息
  11616. */
  11617. U.MD.U.OT.asynUserRegister = function (r) {
  11618. var _userinfo, //登录用户信息
  11619. _context = r.context,
  11620. _outeruserinfo = _context[1];
  11621. //QQ,微博方式注册进来
  11622. if (U.MD.U.R.asynRegister(r, true)) {
  11623. _userinfo = US.userInfo;
  11624. //用户在第三方的资料设置在1473
  11625. _userinfo.Country = "中国";
  11626. _userinfo.Province = _outeruserinfo.province || "";
  11627. _userinfo.UserEmail = _outeruserinfo.UserEmail || "";
  11628. _userinfo.Birthday = U.UF.D.getYearMonthDay(_outeruserinfo.Birthday, "String");
  11629. _userinfo.City = _outeruserinfo.city || "";
  11630. _userinfo.UserAddress = _outeruserinfo.location || "";
  11631. _userinfo.UserNickName = _outeruserinfo.screen_name || _outeruserinfo.nickname || "";
  11632. _userinfo.UserRemarks = _outeruserinfo.description || "";
  11633. _userinfo.UserIndividualitysignature = _outeruserinfo.description || "";
  11634. _userinfo.UserThumbnailImageHead = _outeruserinfo.avatar_large || _outeruserinfo.avatar_hd || _outeruserinfo.figureurl_qq_2 || _outeruserinfo.figureurl_qq_1 || "";
  11635. _userinfo.UserSex = (_outeruserinfo.gender == "m" | _outeruserinfo.gender == 1) ? 1 : 0;
  11636. //基本资料同步到服务器中
  11637. 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 () { }); //修改用户登录资料
  11638. //用户头像信息更新到服务器中
  11639. U.A.Request(US.USER, ["UpdateUserHeadPortrait", US.userInfo.UserId, _userinfo.UserThumbnailImageHead, _userinfo.UserThumbnailImageHead], function () { });
  11640. //关闭窗体
  11641. parent.$("#U_MD_U_OT_B_Pop")[0].close();
  11642. }
  11643. else {
  11644. //注册成功提醒
  11645. U.alert("注册失败。请重新尝试");
  11646. }
  11647. }
  11648. //#endregion
  11649. ;
  11650. ///<jscompress sourcefile="Register.js" />
  11651. /*
  11652. 问题:
  11653. 1、注册的接口不完善 没有非窗体注册的函数
  11654. */
  11655. Namespace.register("U.MD.U.R"); //用户注册的命名空间
  11656. // 用户名 密码 确认密码 验证码 后面2个都没有用
  11657. //用于判断用户是否已经在输入框中输入了正确的值。
  11658. U.MD.U.R.isregister = [false, false, false, false, false, true];
  11659. //#region 用户注册信息判断
  11660. //#region 用户注册使用区域
  11661. /**
  11662. * 弹出注册框的处理
  11663. *
  11664. */
  11665. U.MD.U.R.register = function () {
  11666. var _parent = U.selectEl("#U_MD_U_L_login"); //登录注册框
  11667. //弹出注册框
  11668. // new U.UF.UI.form("", _parent[0],
  11669. // {
  11670. // "id": "U_MD_HomeC_Pop",
  11671. // "style": {
  11672. // "width": "360px",
  11673. // "height": "505px"
  11674. // }
  11675. // },
  11676. // {
  11677. // isdrag: false,
  11678. // isstretching: false,
  11679. // isenlarge: false,
  11680. // isnarrow: false
  11681. // });
  11682. var _child = _parent.Child(); //获取登录注册找回密码的div
  11683. _child[1].style.display = "block"; //显示注册框
  11684. _child[2].style.display = "none"; //隐藏注册
  11685. _child[3].style.display = "none"; //隐藏登录
  11686. U.selectEl("div", _child[0])[2].innerHTML = "快速注册";
  11687. //头部设置内容
  11688. var _head = U.selectEl(_child[0]).childs()[1];
  11689. //设置头部内容
  11690. U.selectEl(_head).addAttrArray({
  11691. innerHTML: "已经有账号? <span onclick='U.MD.U.L.init();'>现在登录</div>",
  11692. title: "",
  11693. "className": "U_MD_U_L_Top_Yun"
  11694. });
  11695. //注册验证码区域
  11696. if (!$("#U_MD_U_R_VC_Img img")[0]) {
  11697. //"onerror": U.MD.C.imgError,
  11698. $$("img", { //生成验证码
  11699. "alt": "看不清?点击重获验证码",
  11700. "src": "http://main.1473.cn/Uses.ashx?mode=GraphicVerificationCode&n=" + Math.random(),
  11701. "onclick": function () {
  11702. U.MD.U.R.regenerateVerificaCode(this);
  11703. }
  11704. }, U.selectEl("#U_MD_U_R_VC_Img")[0]);
  11705. }
  11706. //输入框聚焦
  11707. var _input = U.selectEl("input", _child[1])[0];
  11708. _input.focus();
  11709. }
  11710. /**
  11711. * 重新生成验证码
  11712. * @param {element} 生成验证码的图片
  11713. *
  11714. */
  11715. U.MD.U.R.regenerateVerificaCode = function (image) {
  11716. image.src = "http://main.1473.cn/Uses.ashx?mode=GraphicVerificationCode&n=" + Math.random();
  11717. }
  11718. /**
  11719. * 单击注册按钮后,首先判断是否已经阅读了云端协议,然后检查是否用户输入的信息是否全部合法。
  11720. * @param {element} 按钮
  11721. *
  11722. */
  11723. U.MD.U.R.clickRegister = function (button) {
  11724. var _inputs = U.selectEl("#U_MD_U_R_I").find("input");
  11725. //是否已经阅读了云端协议。
  11726. if (_inputs[3].checked) {
  11727. //判断注册的信息是否通过,都通过直接注册处理
  11728. if (U.MD.U.R.isRegister(_inputs, button) && _inputs[2].value != "") {
  11729. U.MD.U.R.ajaxRegister(_inputs[0].value, _inputs[1].value, "", U.selectEl("#U_MD_U_L_login")[0]); //调用ajax的注册
  11730. _inputs.addAttrArray({ "value": "" }); //注册可以通过,那么所有填写的信息都删除
  11731. //调用这个复原输入框的样式
  11732. for (i = 0; i < _inputs.length; i++) {
  11733. if (_inputs[i].offsetWidth && _inputs[i].onblur) { //如果input没有隐藏的情况
  11734. _inputs[i].onblur();
  11735. }
  11736. }
  11737. button.innerText = "注册中..."; //注册按钮提示处理
  11738. }
  11739. //弹出提示框
  11740. else if (_inputs[0].value != "" && _inputs[1].value == "") {
  11741. U.alert("请填写密码");
  11742. }else if (_inputs[1].value != "" && _inputs[2].value == "") {
  11743. U.alert("请正确填写信息");
  11744. }
  11745. else {
  11746. U.alert("请正确的填写信息");
  11747. }
  11748. }
  11749. //如果没有勾选云端协议处理
  11750. else {
  11751. U.alert("请阅读云端协议");
  11752. }
  11753. }
  11754. /**
  11755. * 注册判断设置
  11756. * @param {element} 输入的框
  11757. * @param {element} 按钮
  11758. *
  11759. */
  11760. U.MD.U.R.isRegister = function (inputs, button) {
  11761. var _checked = U.MD.U.R.isregister.indexOf(false); //判断注册的信息里是否有没有填写或者填写有问题的
  11762. //如果所有的填写数据都是成功的处理
  11763. if (_checked == -1) {
  11764. return true;
  11765. }
  11766. //如果错误只是验证码错误
  11767. else if (_checked == 4) {
  11768. //验证码获取
  11769. U.MD.U.R.verificationCode(inputs[2], function () {
  11770. U.MD.U.R.clickRegister(button); //验证码获取成功后的回调处理
  11771. });
  11772. return true;
  11773. }
  11774. return false;
  11775. }
  11776. //用户注册Ajax函数。
  11777. /**
  11778. //外面用户可以直接调用U.MD.U.R.register(username,password),调用之前必须设置全局变量US.systemId,测试用户U.MD.U.R.register=0.开发者账号需要进入授权系统进行授权
  11779. 返回值:
  11780. */
  11781. U.MD.U.R.ajaxRegister = U.MD.U.R.UR = function (username, password, email, loading) {
  11782. U.MD.U.R.isregister = [false, false, false, false, false, true]; //注册成功响应后,允许注册的值改成false
  11783. //注册处理,调用后台注册
  11784. U.A.Request(US.USER, ["UserRegister", username, password, email, US.city.userAllLocation, ""],
  11785. U.MD.U.R.asynRegister, [loading, US.city.userAllLocation]); //注册的同时执行登录
  11786. }
  11787. /**
  11788. * 用户注册异步
  11789. * @param {element} 输入的框
  11790. * @param {element} 按钮
  11791. *
  11792. */
  11793. U.MD.U.R.asynRegister = function (r, outsite) {
  11794. var value = r.value;
  11795. //账号重复注册的处理
  11796. if (value == "notregister") {
  11797. U.alert("已经存在该账号!");
  11798. }
  11799. //注册失败
  11800. else if (value == "false") {
  11801. U.alert("系统繁忙,请稍后。");
  11802. }
  11803. //注册成功,直接登录处理
  11804. else {
  11805. //注册成功直接登录
  11806. U.MD.U.L.asynLoginAjax(r);
  11807. //写入用户来源信息,根据链接统计是哪一个推广人员推广的。
  11808. //U.MD.U.NP.extension();
  11809. return r;
  11810. }
  11811. }
  11812. /**
  11813. * 验证码javascript
  11814. * @param {element} 输入的框
  11815. * @param {element} 按钮
  11816. *
  11817. */
  11818. U.MD.U.R.verificationCode = function (input, cb) {
  11819. var _code = input.value, //输入的验证码值
  11820. _isnumber = U.UF.S.Number.test(_code); //判断输入的验证码是否符合格式
  11821. if (_isnumber) {
  11822. //发送ajax判断是否注册成功
  11823. U.A.Request(US.USER, ["ConfirmGraphicVerificationCode", _code],
  11824. U.MD.U.R.asynVerificationCode, ["", input, cb]);
  11825. //验证码样式设置
  11826. U.MD.U.R.setInputStyle(input, { 'textAlign': 'right', 'color': 'red', "display": "block" }, "验证中...");
  11827. }
  11828. else if (_code) {
  11829. //验证码样式设置
  11830. U.MD.U.R.setInputStyle(input, { 'textAlign': 'right', 'color': 'red', "display": "block" }, "格式错误");
  11831. }
  11832. else {
  11833. //验证码样式设置
  11834. U.MD.U.R.setInputStyle(input, { 'textAlign': 'right', 'color': '#00aa99', "display": "block" }, "验证码");
  11835. }
  11836. }
  11837. /**
  11838. * 验证码异步
  11839. *
  11840. */
  11841. U.MD.U.R.asynVerificationCode = function (r) {
  11842. var _context = r.context, //参数
  11843. _input = _context[1], //验证码输入框
  11844. _cb = _context[2] //回调函数
  11845. ;
  11846. r = r.value; //得到后台数据库返回的值
  11847. //如果验证码正确的处理
  11848. if (r == "True") {
  11849. U.MD.U.R.setInputStyle(_input, { 'textAlign': 'right', 'marginRight': '0px', 'color': '#00aa99', "display": "block" }, "成功"); //设置提示说明样式
  11850. U.MD.U.R.isregister[4] = true; //设置验证码成功
  11851. if (U.UF.C.isFunction(_cb)) {
  11852. _cb(); //成功后的回调
  11853. }
  11854. }
  11855. //验证码正确
  11856. else if (r == "False") {
  11857. U.MD.U.R.setInputStyle(_input, { 'textAlign': 'right', 'marginRight': '15px', 'color': 'red', "display": "block" }, "错误"); //设置提示说明样式
  11858. return false;
  11859. }
  11860. //重新生成验证码
  11861. else {
  11862. _input.value = ""; //清空验证码输入
  11863. _input.blur(); //调用blur复原输入框值
  11864. U.MD.U.R.setInputStyle(_input, { 'textAlign': 'center', 'marginRight': '0px', 'color': '#00aa99', "display": "block" }, "验证码"); //设置提示说明样式
  11865. U.selectEl("img", U.selectEl(_input).Parent(3))[0].src = "http://main.1473.cn/Uses.ashx?mode=GraphicVerificationCode&n=" + Math.random(); //重新生成验证码
  11866. _input.focus(); //验证码聚焦
  11867. U.alert("验证码错误或者服务器繁忙"); //弹出服务器繁忙
  11868. }
  11869. }
  11870. //#endregion
  11871. /*
  11872. 判断用户名 这里包括登录所有的用户名的审核 是否通过等。此函数在cookie登录中不会调用。
  11873. 参数一:
  11874. 参数二:UDE为数组,
  11875. 参数三:
  11876. 返回值:
  11877. */
  11878. U.MD.U.R.checkUserName = function (inputel) {
  11879. var _username = inputel.value; //获取用户名
  11880. //输入为空不做变化
  11881. U.selectEl('.U_MD_U_L_Box_U_B').removeClass(" U_MD_U_L_Box_mistakeBorder");
  11882. if ($('.U_MD_U_L_Box_checkUseNameFormat')[0]) {//检测账号格式提示是否存在
  11883. U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkUseNameFormat')[0]);
  11884. }
  11885. if (_username == "") {
  11886. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left' }, "用户账号"); //输入的用户名为空的样式处理
  11887. }
  11888. //注册的用户不符合要求
  11889. else if (!U.UF.S.UserName.test(_username)) {
  11890. U.selectEl('.U_MD_U_L_Box_U_B').addClass(" U_MD_U_L_Box_mistakeBorder");
  11891. U_MD_U_L_createFormat($('.U_MD_U_L_LB')[0], U.selectEl('.U_MD_U_L_Box_P_B')[0]);
  11892. //U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right' }, "2-10汉字或4-20字符"); //注册用户名不符合提示
  11893. }
  11894. //用户注册 需要判断用户是否有重复的用户名
  11895. else {
  11896. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'right' }, "等待认证,请稍后..."); //设置注册的提示
  11897. U.A.Request(US.USER, ["CheckUserName", _username], U.MD.U.R.asynCheckUserName, ["", inputel]);
  11898. }
  11899. }
  11900. /**
  11901. *创建用户账号是否标准提醒
  11902. *
  11903. */
  11904. U_MD_U_L_createFormat = function (parentnode, beforenode) {
  11905. if (beforenode == U.selectEl('.U_MD_U_L_Box_P_B')[0] && U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0]) {
  11906. U.selectEl('.U_MD_U_L_Box_checkUseNameFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkUseNameFormat')[0]);
  11907. }
  11908. var _format = document.createElement('div');
  11909. _format.className = "U_MD_U_L_Box_checkUseNameFormat";
  11910. _format.innerText = "2-10汉字或4-20字符";
  11911. parentnode.insertBefore(_format, beforenode);
  11912. }
  11913. /**
  11914. * 判断用户名是否存在
  11915. * @param {object} ajax对象
  11916. *
  11917. */
  11918. U.MD.U.R.asynCheckUserName = function (r) {
  11919. var _context = r.context,
  11920. _inputel = _context[1];
  11921. r = r.value;
  11922. //无法注册
  11923. if (r == true) {
  11924. U.MD.U.R.setInputStyle(_inputel, { "color": "red" }, "已被注册!");
  11925. }
  11926. //成功注册
  11927. else {
  11928. U.MD.U.R.setInputStyle(_inputel, { "display": "none" });
  11929. U.MD.U.R.isregister[0] = true;
  11930. }
  11931. }
  11932. /**
  11933. * 判断密码输入是否有问题
  11934. * @param {object} ajax对象
  11935. *
  11936. */
  11937. U.MD.U.R.checkPassword = function (inputel) {
  11938. var _password = inputel.value;
  11939. U.selectEl('.U_MD_U_L_Box_P_B').removeClass(" U_MD_U_L_Box_mistakeBorder");
  11940. if ($('.U_MD_U_L_Box_checkPWFormat')[0]) {
  11941. U.selectEl('.U_MD_U_L_Box_checkPWFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkPWFormat')[0]);
  11942. }
  11943. //如果没有输入密码
  11944. if (_password == "") {
  11945. U.MD.U.R.setInputStyle(inputel, { "display": "block", 'textAlign': 'left', 'marginRight': '0px' }, "6-20位字符或数字"); //没有输入密码的提示
  11946. }
  11947. //输入的密码的格式不对
  11948. else if (!U.UF.S.PassWord.test(_password)) {
  11949. U.selectEl('.U_MD_U_L_Box_P_B').addClass(" U_MD_U_L_Box_mistakeBorder");
  11950. U_MD_U_L_checkPWFormat($('.U_MD_U_L_LB')[0], U.selectEl('.U_MD_U_R_VC')[0]);
  11951. //U.MD.U.R.setInputStyle(inputel, { "display": "block", "color": "red", 'textAlign': 'right', 'marginRight': '15px' }, "6-20位字符或数字"); //输入的密码有问题
  11952. }
  11953. //输入
  11954. else {
  11955. U.MD.U.R.passwordStrength(inputel); //判断输入的密码强度
  11956. U.MD.U.R.isregister[1] = true; //设置已经成功通过密码审核
  11957. return true;
  11958. }
  11959. return false;
  11960. }
  11961. /**
  11962. *创建用户账号是否标准提醒
  11963. *
  11964. */
  11965. U_MD_U_L_checkPWFormat = function (parentnode, beforenode) {
  11966. if (beforenode == U.selectEl('.U_MD_U_R_VC')[0] && U.selectEl('.U_MD_U_L_Box_checkPWFormat')[0]) {
  11967. U.selectEl('.U_MD_U_L_Box_checkPWFormat')[0].parentNode.removeChild($('.U_MD_U_L_Box_checkPWFormat')[0]);
  11968. }
  11969. var _format = document.createElement('div');
  11970. _format.className = "U_MD_U_L_Box_checkPWFormat";
  11971. _format.innerText = "2-10汉字或4-20字符";
  11972. parentnode.insertBefore(_format, beforenode);
  11973. }
  11974. /**
  11975. * 隐藏提示框,隐藏提示框,一般都在在点击重新输入,或者是点击取消提示框的时候使用
  11976. * @param {object} ajax对象
  11977. *
  11978. */
  11979. U.MD.U.R.hidePromptBox = function (el) {
  11980. var _parentel = U.selectEl(el).Parent(); //上级父亲层;
  11981. U.selectEl("i", _parentel)[0].style.display = "none"; //提示框隐藏
  11982. try {
  11983. U.selectEl("input", _parentel)[0].focus();
  11984. }
  11985. catch (e) { }
  11986. }
  11987. /**
  11988. * 设置样式
  11989. * @param {element} 输入的框
  11990. * @param {element} 样式
  11991. *
  11992. */
  11993. U.MD.U.R.setInputStyle = function (input, styles, text) {
  11994. //找input输入框的父亲元素
  11995. var _parent = U.selectEl(input).Parent();
  11996. //指定的元素里面找孩子元素为i的元素
  11997. var _el = U.selectEl("i", _parent);
  11998. styles.display = "block";
  11999. _el.addAttrArray({ "style": styles, "innerHTML": text || "" }, 0)[0];
  12000. }
  12001. /**
  12002. * 设置样式
  12003. * @param {element} 输入的框+
  12004. *
  12005. */
  12006. U.MD.U.R.passwordStrength = function (input) {
  12007. var i = 0,
  12008. _value = input.value,
  12009. _arr = [
  12010. ["弱", "#e64141"],
  12011. ["中", "#0a8cd2"],
  12012. ["强", "#4bb900"]];
  12013. //如果输入的内容大于10,那么加一
  12014. if (_value.length > 10) {
  12015. i++;
  12016. }
  12017. //如果输入的内容含数字,那么加一
  12018. if (_value.match(/[0-9]/ig)) {
  12019. i++;
  12020. }
  12021. //如果输入的内容含字符,那么加一
  12022. if (_value.match(/[a-z]/ig)) {
  12023. i++;
  12024. }
  12025. //选择输入的强度数字
  12026. i = i > 0 ? i - 1 : i;
  12027. //找input输入框的父亲元素
  12028. var _parent = U.selectEl(input).Parent();
  12029. //指定的元素里面找孩子元素为i的元素
  12030. var _el = U.selectEl("i", _parent);
  12031. //设置样式
  12032. _el.addAttrArray({
  12033. "style": {
  12034. "textAlign": "right",
  12035. "display": "block",
  12036. "color": _arr[i][1]
  12037. },
  12038. "innerHTML": _arr[i][0]
  12039. }, 0); //设置密码样式
  12040. }
  12041. //#endregion
  12042. ;
  12043. ///<jscompress sourcefile="Score.js" />
  12044. Namespace.register("U.MD.U.S"); //积分
  12045. //类型
  12046. U.MD.U.S.TF = { "Contribute": "找出漏洞", "Introduce": "推广本网站", "Upload": "上传文件", "PostArticle": "发表文章", "Online": "在线时间", "Reply": "回复文章", "SignIn": "登陆签到", "Download": "下载文件", "DiskAddition": "硬盘增加", "IllegalImage": "发布违规图片" }
  12047. U.MD.U.S.FTF = { "Upload": "UseStudioUserDiskDiv", "Download": "UseStudioUserDiskDiv", "PostArticle": "UseStudioStudyControlDiv", "Reply": "UseStudioStudyControlDiv" };
  12048. //用户数据分页
  12049. U.MD.U.S.E = {};
  12050. //点击积分图标
  12051. U.MD.U.S.LoginIC = function () {
  12052. var _UICD = U.selectEl("#UU_IC")[0], _UDGG = U.selectEl("#UU_ICBG_GG")[0]; //积分的显示区域
  12053. U.UF.F.windowTopCenter(_UICD); //居中弹框
  12054. U.MD.U.S.GetIC($("div#UU_IC_Pay", _UICD)[0]); //获取积分统计
  12055. U.MD.D.T.WindowRestore(_UICD, '', '积分中心'); //创建任务栏
  12056. }
  12057. //切换
  12058. U.MD.U.S.SIC = function (TF) {
  12059. U.MD.U.S.YXICD["none", "block"]; //切换到显示的div
  12060. if (TF == 1) { U.MD.U.S.GetIC($("#UU_IC_Pay")[0]); }
  12061. else { U.MD.U.S.ICSS(1); }
  12062. }
  12063. //切换的显示和隐藏
  12064. U.MD.U.S.YXICD = function (TF) {
  12065. U.selectEl('#UU_IC_HB')[0].style.display = TF[0];
  12066. U.selectEl('#UU_IC_Info')[0].style.display = TF[1];
  12067. }
  12068. //------------------------------------------------------------------------用户个人
  12069. //用户积分资料
  12070. U.MD.U.S.SUIC = function (UICD) {
  12071. 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 = "";
  12072. for (i = 0; i < _UET.length; i++) { TF += _UET[i].VCSumValue; } //获取用户显示的积分
  12073. //显示用户积分资料
  12074. $$("img", { "onerror": U.MD.C.imgError,
  12075. "onerror": U.MD.C.imgError,
  12076. "id": "UU_IC_Avatar_img", "src": U.MD.C.getHeadImage(US.userInfo.UserThumbnailImageHead)
  12077. }, _UDAD);
  12078. U.selectEl("#UU_IC_VCSum", UICD)[0].innerHTML = TF; //用户积分
  12079. }
  12080. //------------------------------------------------------------------------用户积分消耗查询(分)
  12081. //用户积分查询分页
  12082. U.MD.U.S.ICSS = function (P) {
  12083. var SP = Math.ceil(P * 7 / 70),
  12084. _E = SP * 70,
  12085. _S = _E - 69,
  12086. UPDL = U.MD.U.S.E[US.userInfo.UserId];
  12087. if (UPDL && (UPDL = UPDL["Page"]) && (UPDL = UPDL[SP])) {
  12088. var _TP = P % 10;
  12089. _TP = _TP == 0 ? 10 : _TP;
  12090. _E = _TP * 7; _S = _E - 7; //分页算法
  12091. var _UICL = UPDL.slice(_S, _E); //获取打印的数据
  12092. U.MD.U.S.SetICSS(_UICL, P);
  12093. }
  12094. else { U.A.Request("UseStudioPay.UserGetSomeVC", [_S, _E], U.MD.U.S.AsynICSS, ["", P, SP, US.userInfo.UserId]); } //获取积分明细记录
  12095. }
  12096. //异步用户资料查询
  12097. U.MD.U.S.AsynICSS = function (r) {
  12098. var _context = r.context;
  12099. r = r.value;
  12100. if (U.MD.U.S.E[_context[3]] == null) {
  12101. U.MD.U.S.E[_context[3]] = { "Page": [] };
  12102. }
  12103. else if (U.MD.U.S.E[_context[3]]["Page"] == null) {
  12104. U.MD.U.S.E[_context[3]]["Page"] = [];
  12105. }
  12106. U.MD.U.S.E[_context[3]]["Page"][_context[2]] = r[0]; //添加用户数据
  12107. U.MD.U.S.ICTT(r[1], U.selectEl("#UU_ICM_UU_IC_Heroes")[0]); //打印英雄榜
  12108. U.MD.U.S.ICSS(_context[1]); //用户积分查询分页
  12109. }
  12110. //设置分页
  12111. U.MD.U.S.SetICSS = function (UICL, P) {
  12112. if (UICL.length > 0) {
  12113. U.MD.U.S.ICPL(UICL, ["时间", "来源", "来源", "积分"], U.selectEl("#UU_IC_Info")[0]); //打印数据
  12114. new U.UF.P.page($("#UU_IC_Pag")[0], UICL[0].AllCount, 7, P, function (P) { U.MD.U.S.ICSS(P); }); //分页
  12115. }
  12116. }
  12117. //-------------------------------------------------------------------获取用户积分消耗情况(总)
  12118. //获取积分
  12119. U.MD.U.S.GetIC = function (UICD) {
  12120. if (U.MD.U.S.E[US.userInfo.UserId] && U.MD.U.S.E[US.userInfo.UserId]["ICCSV"]) {
  12121. U.MD.U.S.SetIC(U.MD.U.S.E[US.userInfo.UserId]["ICCSV"], UICD);
  12122. }
  12123. else {
  12124. U.A.Request("UseStudioPay.UserCountVC", [], U.MD.U.S.AsynGetIC, [UICD, 1, US.userInfo.UserId]);
  12125. } //获取积分统计
  12126. }
  12127. //获取积分异步
  12128. U.MD.U.S.AsynGetIC = function (r) {
  12129. var _context = r.context;
  12130. r = r.value;
  12131. if (U.MD.U.S.E[_context[2]] == null) {
  12132. U.MD.U.S.E[_context[2]] = {};
  12133. }
  12134. U.MD.U.S.E[_context[2]]["ICCSV"] = r; //积分消耗统计
  12135. U.MD.U.S.GetIC(_context[0], r); //显示积分
  12136. }
  12137. //打印积分详情(总)
  12138. U.MD.U.S.SetIC = function (UIC, UICD) {
  12139. U.MD.U.S.ICTT(UIC[1], U.selectEl("div#UU_ICM_UU_IC_Heroes", UICD)[0]); //打印排名
  12140. U.MD.U.S.ICPL(UIC[0], ["时间", "来源", "积分", "次数"], U.selectEl("div#UU_IC_Info", UICD)[0]); //积分使用获得的变化
  12141. U.MD.U.S.SUIC(UICD); //设置用户积分信息
  12142. }
  12143. //打印积分排名
  12144. U.MD.U.S.ICTT = function (UICL, UOD) {
  12145. var i, _UCL, _el, _UDTD,
  12146. _UDFD = $$("frag");
  12147. UOD.innerText = "";
  12148. for (i = 0; i < UICL.length; i++) {
  12149. _UCL = UICL[i]; //获取积分名次
  12150. _el = $$("div", {
  12151. "style":
  12152. {
  12153. "marginTop": "8px"
  12154. },
  12155. "onclick": function () {
  12156. U.UF.EV.stopBubble();
  12157. U.MD.U.V.POUW(_UCL.UserId);
  12158. }
  12159. }, _UDFD);
  12160. $$("img", { "onerror": U.MD.C.imgError,
  12161. "onerror": U.MD.C.imgError,
  12162. "src": U.MD.C.getHeadImage(_UCL.UserThumbnailImageHead),
  12163. "className": "UU_IC_Heroes_img"
  12164. }, _el);
  12165. $$("div", {"className": "UU_IC_HSOne","innerHTML": _UCL.UserNickName}, _el);
  12166. _UDTD = $$("div", {"className": "UU_IC_HSTwo"}, _el);
  12167. $$("span", {"innerHTML": "积分:"}, _UDTD);
  12168. $$("span", {"style":{"color": "#3081fe"},"innerHTML": _UCL.VCSumValue}, _UDTD);
  12169. }
  12170. UOD.appendChild(_UDFD);
  12171. }
  12172. //打印用户积分来源
  12173. U.MD.U.S.ICPL = function (UICL, UDTF, UOD) {
  12174. UOD.innerText = U.selectEl("#UU_IC_Pag")[0].innerText = "";
  12175. var i, j, _UCI, _UDSD,
  12176. _el = $$("div", { "className": "UU_IC_Values" }),
  12177. _UDTD = $$("div", {"className": "UU_IC_VP"});
  12178. for (i = 0; i < UDTF.length; i++) {
  12179. $$("div", {
  12180. "innerHTML": UDTF[i],
  12181. "style": { "width": (i == 3 ? "50px " : (i == 1 ? "100px" : i == 2 ? "200px" : "")) }
  12182. }, _el);
  12183. };
  12184. for (j = 0; j < UICL.length; j++) {
  12185. _UCI = UICL[j];
  12186. _UDSD = $$("div", {"className": "UU_IC_SG"}, _UDTD);
  12187. $$("div", {"innerHTML": U.UF.D.getDateInterval(_UCI.VCDateTime)}, _UDSD);
  12188. $$("div", {"innerHTML": U.MD.U.S.TF[_UCI.VCType], "style": { "width": "100px" }}, _UDSD);
  12189. $$("div", {
  12190. "onclick": _UCI.VCCountValue ? "" : U.MD.U.S.FTF[_UCI.VCType] ? function () {
  12191. U.UF.EV.stopBubble(); U.UF.C.divdoubleClick(U.MD.U.S.FTF[_UCI.VCType],
  12192. _UCI.VCDetailsDataID, null, null, "ART" + _UCI.VCDetailsDataID);
  12193. } : "", "className": ("U_MD_D_Text_Abbreviation" + (_UCI.VCCountValue ? "" : " UU_IC_FS")),
  12194. "style":
  12195. {
  12196. "color": _UCI.VCCountValue ? "" : "#3081fe", "width": "200px"
  12197. },
  12198. "innerHTML": _UCI.VCCountValue ? _UCI.VCSumValue : _UCI.VCDetailsDataValue
  12199. }, _UDSD);
  12200. $$("div", {"innerHTML": _UCI.VCCountValue || _UCI.VCValue,"style":{"width": "50px"}}, _UDSD);
  12201. }
  12202. UOD.appendChild(_el); UOD.appendChild(_UDTD);
  12203. }
  12204. //--------------------------------------------------------------------------------汇换空间----------------------------------------------------------------------------
  12205. //弹出
  12206. U.MD.U.S.ICEXC = function (TF) {
  12207. var _UIED = U.selectEl("#UU_IC_EXC")[0];
  12208. if (TF == "block") { U.UF.F.topWindow(_UIED); } //解决层次的问题
  12209. _UIED.style.display = TF; //显示或者隐藏
  12210. }
  12211. //用户换去空间
  12212. U.MD.U.S.ICGK = function (UICD) {
  12213. var i, _TF = 0,
  12214. _UICE = U.MD.U.S.E[US.userInfo.UserId]["ICCSV"][0];
  12215. UICV = UICD.value;
  12216. for (i = 0; i < _UICE.length; i++) {
  12217. _TF += _UICE[i].VCSumValue;
  12218. } //获取用户所有的积分
  12219. if (parseFloat(UICV) < 0) {
  12220. U.alert("请输入正整数");
  12221. } //换取有效网盘空间
  12222. else if (!U.UF.S.Number.test(UICV)) {
  12223. U.alert("您的输入有误,请输入数字!");
  12224. } //输入的是无效数据
  12225. else if (UICV > _TF) {
  12226. U.alert("您的积分不足");
  12227. } //积分不足无法汇换
  12228. else {
  12229. U.UF.UI.confirm("确定确定要兑换" + UICV + "M的空间吗?", function () {
  12230. // U.A.Request(US.USER,"UseStudioManage.UserDiskAddition", [UICV], U.MD.U.S.AsynICGK, ["", UICD, UICV]);
  12231. UICD.parentNode.parentNode.parentNode.style.display = "none"; UICD.value = "";
  12232. })
  12233. } //于服务器同步增加用户的网盘
  12234. }
  12235. //汇换空间异步
  12236. U.MD.U.S.AsynICGK = function (r) {
  12237. var _context = r.context;
  12238. r = r.value;
  12239. if (r) {
  12240. var i, _TF = true,
  12241. ICDE = U.MD.U.S.E[US.userInfo.UserId]["ICCSV"][0];
  12242. for (i = 0; i < ICDE.length; i++) {
  12243. if (ICDE[i]["VCType"] == "DiskAddition") {
  12244. _TF = false; ICDE[i].VCSumValue -= _context[2];
  12245. ICDE[i].VCCountValue += 1;
  12246. }
  12247. } //修改用户积分消耗信息
  12248. if (_TF) {
  12249. var _E = new U.MD.U.S.PICE[1, new Date(), -_context[2], "DiskAddition"],
  12250. _UICE = U.MD.U.S.E[US.userInfo.UserId]["Page"];
  12251. ICDE.push(_E);
  12252. if (_UICE && _UICE.length > 0) {
  12253. 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);
  12254. }
  12255. } //添加用户积分消耗信息
  12256. U.MD.U.S.SUIC();
  12257. U.MD.U.S.ICPL(ICDE, ["时间", "来源", "积分", "次数"], U.selectEl("#UU_IC_Info")[0]);
  12258. US.userInfo.UserDiskSpace += 1; //积分使用获得的变化 //用户信息
  12259. }
  12260. }
  12261. //-----------------------------------------------------------------------------数据结构-------------------------------------------------------------------------------
  12262. //积分的结构
  12263. U.MD.U.S.PICE = function (E) {
  12264. this.VCCountValue = E[0];
  12265. this.VCDateTime = E[1];
  12266. this.VCSumValue = E[2];
  12267. this.VCType = E[3];
  12268. }
  12269. //积分的消耗
  12270. U.MD.U.S.ICE = function (E) {
  12271. this.AllCount = E[0];
  12272. this.PageNum = E[1];
  12273. this.UserID = E[2];
  12274. this.VCDateTime = E[3];
  12275. this.VCDetailsDataID = E[4];
  12276. this.VCDetailsDataValue = E[5];
  12277. this.VCID = E[6];
  12278. this.VCType = E[7];
  12279. this.VCValue = E[8];
  12280. }
  12281. ;
  12282. ///<jscompress sourcefile="UserInfo.js" />
  12283. Namespace.register("U.MD.U.P"); //个人资料设置
  12284. U.MD.U.P.inpEl = {}
  12285. //#region 用户登录个人资料
  12286. //打开个人资料
  12287. U.MD.U.P.userDataSet = function () {
  12288. U.MD.U.P.init()
  12289. }
  12290. /**
  12291. * 个人设置初始化函数
  12292. */
  12293. U.MD.U.P.init = function () {
  12294. if (!U.MD.U.L.isLogin()) { //判断是否有登录
  12295. var _form = U.selectEl('#U_MD_U_P_Set'), _personal = U.selectEl("#U_MD_U_P_Uc_B")[0]; //个人资料元素
  12296. if (!_form.length) { //窗体是否存在
  12297. 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; //打开个人资料函数实例化
  12298. U.MD.U.P.eventBind(); //绑定事件
  12299. _personal.style.display = 'block'; //显示打印内容
  12300. } else {
  12301. U.selectEl('#U_MD_U_P_tab_lable_info')[0].checked = 'checked'; //让第一个选项选中
  12302. _form[0].style.display = 'block'; //显示出来
  12303. }
  12304. }
  12305. }
  12306. /**
  12307. * 事件绑定,打印页面
  12308. */
  12309. U.MD.U.P.eventBind = function () {
  12310. U.MD.U.P.EL = { //元素集合
  12311. "headImage": U.selectEl('#U_MD_U_P_simpleInfo_img')[0], //用户头像 左侧
  12312. "name": U.selectEl('.U_MD_U_P_simpleInfo_name')[0], //用户昵称 左侧
  12313. "nickName": U.selectEl('#U_MD_U_P_tab_userNickName')[0], //用户昵称 基本信息
  12314. "selfIntroduction": U.selectEl('#U_MD_U_P_tab_selfIntroduction')[0], // 个人介绍 基本信息
  12315. "email": U.selectEl('#U_MD_U_P_tab_email')[0], //邮箱 基本信息
  12316. "phoneNumber": U.selectEl('#U_MD_U_P_tab_phoneNumber')[0], //手机号码 基本信息
  12317. "address": U.selectEl('#U_MD_U_P_tab_address')[0], //地址 基本信息
  12318. "trueName": U.selectEl('#U_MD_U_P_tab_trueName')[0], //真实姓名 个人隐私
  12319. "birthday": U.selectEl('#U_MD_U_P_tab_birthday')[0], //出生日期 个人隐私
  12320. "loginName": U.selectEl('#U_MD_U_P_tab_loginName')[0], //用户名 账号安全
  12321. "oldPW": U.selectEl('#U_MD_U_P_tab_oldPW')[0], //旧密码 账号安全-修改密码
  12322. "newPW": U.selectEl('#U_MD_U_P_tab_newPW')[0], //新密码 账号安全-修改密码
  12323. "confirmPW": U.selectEl('#U_MD_U_P_tab_confirmPW')[0], //确认密码 账号安全-修改密码
  12324. "phone": U.selectEl('#U_MD_U_P_tab_phone')[0], //手机号码 账号安全-手机找回
  12325. "accountNPW": U.selectEl('#U_MD_U_P_tab_lable_accountNext_n')[0], //新密码 账号安全-手机找回
  12326. "accountCPW": U.selectEl('#U_MD_U_P_tab_lable_accountNext_c')[0] //确认密码 账号安全-手机找回
  12327. };
  12328. var _bindEl = ["nickName", "email", "phoneNumber", "newPW", "confirmPW,newPW", "phone", "accountNPW", "accountCPW,accountNPW"], //元素数组
  12329. _bindString = ["NickName", "Email", "TelephoneNumber", "PassWord", "contrastPW", "TelephoneNumber", "PassWord", "contrastPW"], //绑定验证类型
  12330. _lastPage = U.selectEl('.U_MD_U_P_tab_inp')[0], //上一个停留的位置
  12331. _isDataChanged = false, //用户是否修改过数据
  12332. _changeDataNum = "", //序号
  12333. _isNextStep = false; //是否可点击下一步
  12334. U.UF.DL.asynLoadJs({ type: "text/javascript", src: "/js/Controls/Basic/City.js" }, function () { new U.MD.UI.city(); }); //加载城市控件js
  12335. U.UF.DL.asynLoadCss({ "href": "/css/Controls/Basic/City.css", type: "text/css", rel: "stylesheet" }); //加载城市控件css
  12336. U.selectEl('#U_MD_U_P_tab_address').bind({
  12337. click: function () {
  12338. U.MD.UI.city(this);
  12339. U.selectEl("#U_MD_UI_city_cityBox")[0].style.display = "block";
  12340. U.selectEl("#U_MD_UI_city_cityBox")[0].style.zIndex = "999";
  12341. }
  12342. });
  12343. U.selectEl('#U_MD_U_P_tab_birthday').bind({ //绑定生日的日历控件
  12344. click: function () {
  12345. U.MD.UI.calendar(this, U.selectEl('#U_MD_U_P_tab_calendar')[0], false);
  12346. }
  12347. })
  12348. U.selectEl('#U_MD_U_P_save').bind({ //绑定保存点击事件
  12349. click: function () {
  12350. switch (_lastPage.value) { //判断停留在那一页上
  12351. case "0": case "1":
  12352. U.MD.U.P.updateUserBasicInfo(_lastPage.value); break;
  12353. case "2":
  12354. if ($('.U_MD_U_P_tab_accountRadio:checked')[0].value == 0) {
  12355. U.MD.U.P.setPassword(_bindEl, _bindString);
  12356. } else if ($('.U_MD_U_P_tab_accountRadio:checked')[0].value == 1) {
  12357. U.MD.U.P.updatePassword();
  12358. }
  12359. break;
  12360. }
  12361. U.selectEl('.U_MD_U_P_simpleInfo_address')[0].innerText = U.selectEl("#U_MD_U_P_tab_address")[0].value;
  12362. }
  12363. })
  12364. U.selectEl('.U_MD_U_P_tab_inp').bind({ //绑定事件
  12365. change: function () {
  12366. U.MD.U.P.reset(_changeDataNum, _isDataChanged);
  12367. _lastPage = this;
  12368. _isDataChanged = false;
  12369. }
  12370. })
  12371. U.selectEl('.U_MD_U_P_tab_lable_content input').bind({ //判断某一页用户是否修改了数据
  12372. change: function () {
  12373. if (!_isDataChanged) {
  12374. _changeDataNum = _lastPage.value;
  12375. _isDataChanged = true;
  12376. }
  12377. }
  12378. })
  12379. U.selectEl('.U_MD_U_P_tab_accountRadio').bind({ //账号安全的‘下一步’与“保存设置”按钮的显示隐藏
  12380. change: function () {
  12381. if (this.value == 0) {
  12382. U.selectEl('#U_MD_U_P_save')[0].style.display = "inline-block";
  12383. U.selectEl('#U_MD_U_P_next')[0].style.display = "none";
  12384. } else {
  12385. U.selectEl('#U_MD_U_P_save')[0].style.display = "none";
  12386. U.selectEl('#U_MD_U_P_next')[0].style.display = "inline-block";
  12387. }
  12388. }
  12389. })
  12390. U.selectEl('#U_MD_U_P_authCodeBtn').bind({
  12391. click: function () { //发送验证码
  12392. _isNextStep = U.MD.U.P.sendAuthCode(_isNextStep);
  12393. }
  12394. })
  12395. U.selectEl('#U_MD_U_P_next').bind({
  12396. click: function () { //下一步
  12397. U.MD.U.P.phoneConfirm();
  12398. }
  12399. })
  12400. U.selectEl('#U_MD_U_P_authCodeInp').bind({
  12401. change: function () { //验证码文本框的不为空清除错误
  12402. if (this.value.trim().length > 0) {
  12403. U.selectEl(this).removeClass('U_MD_U_P_tab_user_emptyInp')
  12404. }
  12405. }
  12406. })
  12407. U.selectEl('#U_MD_U_P_cancel').bind({
  12408. click: function () { //关闭
  12409. U.selectEl('#U_MD_U_P_Set')[0].style.display = 'none';
  12410. }
  12411. })
  12412. U.selectEl('#U_MD_U_P_tab_oldPW').bind({
  12413. change: function () {
  12414. var _bool = U.MD.U.P.checkEmpty(this);
  12415. !_bool && U.selectEl(this).removeClass('U_MD_U_P_tab_user_emptyInp');
  12416. }
  12417. })
  12418. U.MD.U.P.dataPrint(); //数据打印
  12419. U.MD.U.P.bindCheckFormat(_bindEl, _bindString); //绑定文本框的格式
  12420. }
  12421. /**
  12422. * 绑定事件
  12423. * @param elarr {Array} 元素数组
  12424. * @param eventarr {Array} 绑定验证类型
  12425. */
  12426. U.MD.U.P.bindCheckFormat = function (elarr, eventarr) {
  12427. var _len = elarr.length;
  12428. for (var i = 0; i < _len; i++) {
  12429. var _el = U.MD.U.P.EL[elarr[i].split(',')[0]];
  12430. _el.i = i;
  12431. U.selectEl(_el).bind({
  12432. change: function () {
  12433. U.MD.U.P.inpFormatCheck(this, elarr, eventarr);
  12434. }
  12435. })
  12436. }
  12437. }
  12438. /**
  12439. * 数据重置
  12440. * @param that {string} 标记
  12441. * @param elarr {Array} 是否更改数据
  12442. * @param eventarr {Array} 是否更改数据
  12443. */
  12444. U.MD.U.P.inpFormatCheck = function (that, elarr, eventarr) {
  12445. var _bool = false;
  12446. if (U.UF.S[eventarr[that.i]]) {
  12447. _bool = U.UF.S[eventarr[that.i]].test(that.value.trim());
  12448. } else if (eventarr[that.i] == 'contrastPW') {
  12449. _bool = (U.MD.U.P.EL[elarr[that.i].split(',')[0]].value === U.MD.U.P.EL[elarr[that.i].split(',')[1]].value);
  12450. }
  12451. if (!_bool) {
  12452. if (!that.value.trim().length) {
  12453. U.selectEl(that).removeClass('U_MD_U_P_tab_user_errorInp');
  12454. U.selectEl(that).addClass('U_MD_U_P_tab_user_emptyInp');
  12455. U.selectEl(that).next().removeClass('U_MD_U_P_tab_errorAlear');
  12456. } else {
  12457. U.selectEl(that).removeClass('U_MD_U_P_tab_user_emptyInp');
  12458. U.selectEl(that).addClass('U_MD_U_P_tab_user_errorInp');
  12459. U.selectEl(that).next().addClass('U_MD_U_P_tab_errorAlear');
  12460. }
  12461. } else {
  12462. U.selectEl(that).removeClass('U_MD_U_P_tab_user_errorInp');
  12463. U.selectEl(that).removeClass('U_MD_U_P_tab_user_emptyInp');
  12464. U.selectEl(that).next().removeClass('U_MD_U_P_tab_errorAlear');
  12465. }
  12466. }
  12467. /**
  12468. * 数据重置
  12469. * @param mark {string} 标记
  12470. * @param flag {boolean} 是否更改数据
  12471. */
  12472. U.MD.U.P.reset = function (mark, flag) {
  12473. if (!flag)
  12474. return;
  12475. var _info = US.userInfo, _elObj = U.MD.U.P.EL;
  12476. switch (mark) {
  12477. case "0":
  12478. U.MD.U.P.dataPrint.simpleInfo(_info, _elObj);
  12479. break;
  12480. case "1":
  12481. U.MD.U.P.dataPrint.privacy(_info, _elObj);
  12482. break;
  12483. case "2":
  12484. U.MD.U.P.dataPrint.account(_info, _elObj);
  12485. break;
  12486. }
  12487. }
  12488. /**
  12489. * 打印数据
  12490. */
  12491. U.MD.U.P.dataPrint = function () {
  12492. var _info = US.userInfo, _elObj = U.MD.U.P.EL;
  12493. U.MD.U.P.dataPrint.privacy(_info, _elObj);
  12494. U.MD.U.P.dataPrint.simpleInfo(_info, _elObj);
  12495. U.MD.U.P.dataPrint.account(_info, _elObj);
  12496. U.MD.U.P.dataPrint.left(_info, _elObj);
  12497. }
  12498. /**
  12499. * 初始化左侧栏数据
  12500. * @param info {Array} 元素数组
  12501. * @param elobj {Array} 绑定验证类型
  12502. */
  12503. U.MD.U.P.dataPrint.left = function (info, elobj) {
  12504. elobj["headImage"].src = U.MD.C.getHeadImage(info.UserImageHead);
  12505. /*$('.U_MD_U_P_simpleInfo_address')[0].innerText = info.LoginAddress.slice(2, 6);*/
  12506. U.selectEl('.U_MD_U_P_simpleInfo_address')[0].innerText = elobj["address"].value;
  12507. elobj["name"].innerText = info.UserNickName || "";
  12508. elobj["name"].title = info.UserNickName || "";
  12509. }
  12510. /**
  12511. * 初始化个人隐私数据
  12512. * @param info {Array} 元素数组
  12513. * @param elobj {Array} 绑定验证类型
  12514. */
  12515. U.MD.U.P.dataPrint.privacy = function (info, elobj) {
  12516. elobj["trueName"].value = info.TrueName;
  12517. elobj["birthday"].value = U.UF.D.getYearMonthDay(info.Birthday);
  12518. }
  12519. /**
  12520. * 初始化基本信息数据
  12521. * @param info {Array} 元素数组
  12522. * @param elobj {Array} 绑定验证类型
  12523. */
  12524. U.MD.U.P.dataPrint.simpleInfo = function (info, elobj) {
  12525. U.selectEl(".U_MD_U_P_tab_user_radio[value$=" + (info.UserSex ? "'1'" : "'0'") + "]")[0].checked = true;
  12526. elobj["selfIntroduction"].value = info.UserIndividualitysignature;
  12527. elobj["address"].innerText = info.Province || "";
  12528. elobj["nickName"].value = info.UserNickName || "";
  12529. elobj["email"].value = info.UserEmail;
  12530. elobj["phoneNumber"].value = info.UserTelephoneNumber;
  12531. elobj["address"].value = info.City;
  12532. elobj["loginName"].innerText = info.UserName;
  12533. }
  12534. /**
  12535. * 初始化账号安全数据
  12536. * @param info {Array} 元素数组
  12537. * @param elobj {Array} 绑定验证类型
  12538. */
  12539. U.MD.U.P.dataPrint.account = function (info, elobj) {
  12540. U.selectEl('#U_MD_U_P_tab_lable_accountNext_t')[0].innerText = info.UserName;
  12541. U.selectEl('.U_MD_U_P_tab_lable_account').css('display', 'block');
  12542. U.selectEl('.U_MD_U_P_tab_lable_accountNext').css('display', 'none');
  12543. U.selectEl('.U_MD_U_P_tab_accountRadio')[0].checked = "checked";
  12544. 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"]')));
  12545. for (var i = 0; i < _arr.length; i++) {
  12546. _arr[i].value = "";
  12547. U.selectEl(_arr[i]).removeClass('U_MD_U_P_tab_user_errorInp');
  12548. U.selectEl(_arr[i]).removeClass('U_MD_U_P_tab_user_emptyInp');
  12549. U.selectEl(_arr[i]).next().removeClass('U_MD_U_P_tab_errorAlear');
  12550. }
  12551. U.selectEl('#U_MD_U_P_save').css('display', 'inline-block');
  12552. U.selectEl('#U_MD_U_P_next').css('display', 'none');
  12553. }
  12554. /**
  12555. * 更新用户基本信息
  12556. */
  12557. U.MD.U.P.updateUserBasicInfo = function (type) {
  12558. var _info = US.userInfo, _elObj = U.MD.U.P.EL, _sex = parseInt($('.U_MD_U_P_tab_user_radio:checked')[0].value);
  12559. if (!parseInt(type)) {
  12560. 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']);
  12561. if ($('.U_MD_U_P_tab_user_errorInp').length || U.selectEl('.U_MD_U_P_tab_user_emptyInp').length || _bool) {
  12562. 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) {
  12563. U.Alert("邮箱填写错误!");
  12564. return;
  12565. } 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) {
  12566. U.Alert("手机号码填写错误!");
  12567. return;
  12568. } else {
  12569. U.Alert("信息录入错误!");
  12570. return;
  12571. }
  12572. }
  12573. }
  12574. U.A.Request(US.USER, ["UpdateUserBasicInfo", _info.UserId, _elObj["trueName"].value, _elObj["nickName"].value, _elObj["phoneNumber"].value, '', '', _elObj["selfIntroduction"].value, _sex, _elObj["email"].value,
  12575. "中国", _elObj["address"].textContent, _elObj["address"].value || "", _elObj["birthday"].value],
  12576. function (r) {
  12577. if (r.value) {//判断是否更改成功
  12578. US.userInfo.UserSex = _sex ? true : false;
  12579. US.userInfo.TrueName = _elObj["trueName"].value;
  12580. US.userInfo.UserNickName = _elObj["nickName"].value;
  12581. US.userInfo.UserTelephoneNumber = _elObj["phoneNumber"].value;
  12582. US.userInfo.UserIndividualitysignature = _elObj["selfIntroduction"].value;
  12583. US.userInfo.UserEmail = _elObj["email"];
  12584. US.userInfo.Province = _elObj["address"].value;
  12585. US.userInfo.City = _elObj["address"].value;
  12586. U.Alert("更改个人资料成功");
  12587. }
  12588. else {
  12589. U.alert("更改个人资料失败");
  12590. }
  12591. })
  12592. }
  12593. /**
  12594. * 设置密码
  12595. * @param elarr {Array} 元素数组
  12596. * @param eventarr {Array} 绑定验证类型
  12597. */
  12598. U.MD.U.P.setPassword = function (elarr, eventarr) {
  12599. var _elObj = U.MD.U.P.EL,
  12600. _emptyEl = U.selectEl($('.U_MD_U_P_tab_lable_content')[2]).find('.U_MD_U_P_tab_user_emptyInp'),
  12601. _errorEl = U.selectEl($('.U_MD_U_P_tab_lable_content')[2]).find('.U_MD_U_P_tab_user_errorInp');
  12602. if (!_emptyEl.length && !_errorEl.length) {
  12603. if (_elObj["oldPW"].value == "") {
  12604. U.MD.U.P.inpFormatCheck(_elObj["oldPW"], elarr, eventarr);
  12605. return;
  12606. } else if (_elObj["newPW"].value == "") {
  12607. U.MD.U.P.inpFormatCheck(_elObj["newPW"], elarr, eventarr);
  12608. return;
  12609. } else if (_elObj["confirmPW"].value == "") {
  12610. U.MD.U.P.inpFormatCheck(_elObj["confirmPW"], elarr, eventarr);
  12611. return;
  12612. }
  12613. U.A.Request(US.USER, ["UpdateUserPasswordByOldPassword", US.userInfo.UserId, _elObj["oldPW"].value, _elObj["confirmPW"].value], function (r) {
  12614. if (r.value) {
  12615. U.Alert("更改密码成功,请重新登录");
  12616. U.MD.U.LO.logout();
  12617. U.MD.U.L.login();
  12618. } else {
  12619. U.Alert("原密码错误");
  12620. U.selectEl(_elObj["oldPW"]).addClass("U_MD_U_P_tab_user_emptyInp");
  12621. }
  12622. });
  12623. }
  12624. }
  12625. /**
  12626. * 通过手机号码修改账户密码
  12627. */
  12628. U.MD.U.P.updatePassword = function () {
  12629. var _pw = U.selectEl('#U_MD_U_P_tab_lable_accountNext_n')[0];
  12630. var _pwconfirm = U.selectEl('#U_MD_U_P_tab_lable_accountNext_c')[0];
  12631. //判断用户密码是否正确
  12632. if (U.MD.U.F.checkConfirmPassword(_pw, _pwconfirm)) {
  12633. U.A.Request(US.USER, ["UpdateUserPassword", US.userInfo.UserId, _pw.value], function (r) {//更改密码存储过程
  12634. if (r.value) {//判断是否更改成功
  12635. U.Alert('更改密码成功');
  12636. }
  12637. else {
  12638. U.Alert('更改密码失败');
  12639. }
  12640. });
  12641. }
  12642. }
  12643. /**
  12644. * 发送验证码
  12645. * @param flag {boolean} 是否已发送
  12646. */
  12647. U.MD.U.P.sendAuthCode = function (flag) {
  12648. if (flag) {
  12649. U.Aleart('请在60秒后重试');
  12650. return;
  12651. }
  12652. var _phoneInp = U.MD.U.P.EL["phone"],
  12653. _bool = U.MD.U.P.checkEmpty(_phoneInp) || U.MD.U.P.isCanUse(_phoneInp);
  12654. if (_bool) {
  12655. U.Alert('信息录入错误!');
  12656. return;
  12657. }
  12658. U.A.Request(US.CD, [US.DB, "UseStudio_Users", "GetUserinfoByUserName", US.userInfo.UserName], function (r) {//根据用户名获取用户信息
  12659. if (r.value[0].UserTelephoneNumber != _phoneInp.value) {//如果输入手机号与账号设置的手机号不匹配)
  12660. U.Alert('输入的手机号与账号不匹配');
  12661. } else {
  12662. var _xhttp = new XMLHttpRequest(); //XMLHttpRequest 对象用于在后台与服务器交换数据
  12663. _xhttp.onreadystatechange = function () {//每当 readyState 属性改变时,就会调用该函数。
  12664. if (this.readyState == 4) {//发送成功后
  12665. if (this.status == 201) {
  12666. U.Alert('发送成功'); //弹出发送成功
  12667. U.MD.U.P.setTime($('#U_MD_U_P_authCodeBtn')[0]);
  12668. return true;
  12669. } else {
  12670. U.Alert(JSON.parse(this.response).err || '验证码发送失败,请重新发送...');
  12671. }
  12672. }
  12673. };
  12674. _xhttp.open("POST", "http://api.cloudsql.1473.cn/postnumber", true); //指定和服务器端交互的HTTP方法,URL地址及其他请求信息
  12675. _xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //向一个打开但未发送的请求设置或添加一个 HTTP 请求
  12676. _xhttp.withCredentials = true; //发送cookie等认证信息到服务端
  12677. _xhttp.send("number=" + _phoneInp.value); //$("#userphone")[0].children[0].children[0].value 发送的手机号输入的框
  12678. }
  12679. });
  12680. }
  12681. /**
  12682. * 验证手机验证码
  12683. */
  12684. U.MD.U.P.phoneConfirm = function () {
  12685. var _input = U.selectEl('#U_MD_U_P_authCodeInp')[0];
  12686. if (U.MD.U.P.checkEmpty(_input)) {
  12687. U.Alert('验证码不为空');
  12688. return;
  12689. }
  12690. var _xhttp = new XMLHttpRequest(); //XMLHttpRequest 对象用于在后台与服务器交换数据
  12691. _xhttp.onreadystatechange = function (r) {//每当 readyState 属性改变时,就会调用该函数
  12692. if (this.readyState == 4) {//验证成功后
  12693. if (this.status == 201) {
  12694. U.selectEl('#U_MD_U_P_save').css('display', 'inline-block');
  12695. U.selectEl('#U_MD_U_P_next').css('display', 'none');
  12696. U.selectEl('.U_MD_U_P_tab_lable_account').css('display', 'none');
  12697. U.selectEl('.U_MD_U_P_tab_lable_accountNext').css('display', 'block');
  12698. U.Alert("验证成功"); //弹出验证成功
  12699. } else {
  12700. U.Alert(JSON.parse(this.response).err || "验证码有误");
  12701. }
  12702. }
  12703. };
  12704. _xhttp.open("POST", "http://api.cloudsql.1473.cn/verifi", true); ////指定和服务器端交互的HTTP方法,URL地址及其他请求信息
  12705. _xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //向一个打开但未发送的请求设置或添加一个 HTTP 请求
  12706. _xhttp.withCredentials = true; //发送cookie等认证信息到服务端
  12707. _xhttp.send("code=" + _input.value);
  12708. }
  12709. /**
  12710. * 设置验证码时间
  12711. * @param inp {elenemt} 元素
  12712. */
  12713. U.MD.U.P.setTime = function (inp) {
  12714. if (this._timer) {
  12715. U.Alert('请在60后重试!');
  12716. return;
  12717. }
  12718. var _second = 60,
  12719. _this = this;
  12720. this._timer = setInterval(function () {
  12721. inp.innerText = --_second + 's';
  12722. if (!_second) {
  12723. inp.innerText = '发送验证码';
  12724. clearInterval(_this._timer);
  12725. _this._timer = null;
  12726. }
  12727. }, 1000);
  12728. }
  12729. /**
  12730. * 重置文本框
  12731. * @param inp {elenemt} 元素
  12732. */
  12733. U.MD.U.P.restoreInp = function (el) {
  12734. el.value = "";
  12735. U.selectEl(el).removeClass('U_MD_U_P_tab_user_errorInp');
  12736. U.selectEl(el).removeClass('U_MD_U_P_tab_user_emptyInp');
  12737. }
  12738. /**
  12739. * 判断元素是否有错误
  12740. * @param inp {elenemt} 元素
  12741. */
  12742. U.MD.U.P.isCanUse = function (el) {
  12743. return U.selectEl(el).hasClass('U_MD_U_P_tab_user_emptyInp') || U.selectEl(el).hasClass('U_MD_U_P_tab_user_errorInp');
  12744. }
  12745. /**
  12746. * 判断元素是否为空
  12747. * @param inp {elenemt} 元素
  12748. */
  12749. U.MD.U.P.checkEmpty = function (el) {
  12750. if (el.value.trim() == "" || !!!el.value) {
  12751. U.selectEl(el).addClass('U_MD_U_P_tab_user_emptyInp');
  12752. return true;
  12753. }
  12754. return false;
  12755. }
  12756. /**
  12757. * 上传头像到服务器处理
  12758. * @param input {ele} 上传图片的input
  12759. */
  12760. U.MD.U.P.uploadUserHeadImg = function (input) {
  12761. //判断是否支持FileReader
  12762. //头像预览
  12763. if (window.FileReader) {
  12764. var reader = new FileReader();
  12765. } else {
  12766. U.alert("您的设备不支持图片预览功能,如需该功能请升级您的设备!");
  12767. }
  12768. //获取文件
  12769. var file = input.files[0];
  12770. var imageType = /^image\//;
  12771. //是否是图片
  12772. if (!imageType.test(file.type)) {
  12773. U.alert("请选择图片!");
  12774. return;
  12775. }
  12776. var img = U.selectEl('#U_MD_U_P_simpleInfo_img')[0];
  12777. //读取完成
  12778. reader.onload = function (e) {
  12779. //获取图片dom
  12780. //图片路径设置为读取的图片
  12781. img.src = e.target.result;
  12782. };
  12783. reader.readAsDataURL(file);
  12784. //上传图片
  12785. U.UF.UP.inputUpload([input], "http://disk.1473.cn/USUpfile.ashx?typename=UploadHeadImage", function (url) {
  12786. //console.log(url.value);
  12787. //修改头像
  12788. U.A.Request(US.USER, ["UpdateUserHeaderImage", US.userInfo.UserId, url.value.UserFilesServerName, url.value.UseFilesServerThumbnailName], function (r) {
  12789. if (r.value) {
  12790. //动态修改全局属性
  12791. US.userInfo.UserImageHead = url.value.UserFilesServerName;
  12792. US.userInfo.UserThumbnailImageHead = url.value.UseFilesServerThumbnailName;
  12793. U.Alert('头像修改成功!');
  12794. } else {
  12795. U.Alert('头像修改失败!');
  12796. }
  12797. });
  12798. }, []);
  12799. }
  12800. ;
  12801. ///<jscompress sourcefile="View.js" />
  12802. Namespace.register("U.MD.U.V"); //查看用户信息弹框
  12803. //#region 用户信息查看
  12804. //------------------------------------------------------------------------------用户个人信息
  12805. //个人信息
  12806. U.MD.U.V.UIFZX = U.MD.U.V.ViewOtherUserInfo = function (userid) {
  12807. var _userinfoel = U.selectEl("#U_MD_U_UV").clone(true), // 用户信息元素
  12808. _childs = U.selectEl(_userinfoel[0]).Child(),
  12809. _head = _childs[0],
  12810. _middle = _childs[1],
  12811. _aboutMe = _childs[2];
  12812. var _div = $$('div');
  12813. _div.appendChild(_head); //个人信息的头部
  12814. _div.appendChild(_middle); //个人信息的中间部分
  12815. _div.appendChild(_aboutMe); //个人信息的底部
  12816. //弹出好友信息弹框
  12817. if ($('#U_MD_F_S_TI_Info')[0])
  12818. document.body.removeChild($('#U_MD_F_S_TI_Info')[0])
  12819. var _form = new U.UF.UI.form("<div class='U_MD_F_S_TI'>个人信息</div>",
  12820. _div,
  12821. {
  12822. "style": {
  12823. "min-width": "460px",
  12824. "width": "480px",
  12825. "height": "400px"
  12826. },
  12827. id: "U_MD_F_S_TI_Info"
  12828. },
  12829. {
  12830. isenlarge: false,
  12831. isnarrow: false
  12832. }).form;
  12833. //信息加载
  12834. U.A.Request(US.USER, ["ViewOtherUserInfo", userid],
  12835. U.MD.U.V.ViewOtherUserInfoAsyn, ['', _head, _middle, _aboutMe, _form])
  12836. // U.MD.U.V.ViewUserBlogInfo(_bloginfoel, userid, 1, true); //查看用户最新表表的博客
  12837. }
  12838. //打印用户信息 function(){U.MD.U.L.setLoginCallBack(function(){();});}
  12839. U.MD.U.V.ViewOtherUserInfoAsyn = function (r) {
  12840. var _userinfo = r.value[0],
  12841. _context = r.context,
  12842. _form = _context[4],
  12843. TN = _userinfo.UserTelephoneNumber; //用户电话号码
  12844. U.selectEl(_context[1]).find('.U_MD_U_UV_Head_Left')[0].firstElementChild.src = U.MD.C.getHeadImage(_userinfo.UserImageHead || _userinfo.UserThumbnailImageHead); //打印用户头像
  12845. U.selectEl(_context[1]).find('.U_MD_U_UV_Name')[0].innerText = _userinfo.TrueName || _userinfo.UserName || "不详"; //打印用户名字
  12846. U.selectEl(_context[1]).find('.U_MD_U_UV_Desc')[0].innerText = _userinfo.UserIndividualitysignature || "不详"; //打印用户介绍
  12847. U.selectEl(_context[3]).find('.U_MD_U_UV_Place')[0].innerText = _userinfo.City || "不详"; //打印用户地址
  12848. U.selectEl(_context[3]).find('.U_MD_U_UV_MailBox')[0].innerText = _userinfo.UserEmail != "null" ? _userinfo.UserEmail : "不详"; //打印用户邮箱
  12849. U.selectEl(_context[3]).find('.U_MD_U_UV_PhoneNum')[0].innerText = TN ? (TN.substring(0, 3) + "****" + TN.substring(7, TN.length)) : "不详"; //打印用户的电话号码
  12850. U.selectEl(_context[3]).find('.U_MD_U_UV_Birthday')[0].innerText = _userinfo.Birthday ? U.UF.D.formatDateToArray(_userinfo.Birthday).slice(0, 3).join('-') : "不详"; //打印用户的出生日期
  12851. //获取文件统计数据
  12852. U.A.Request(US.CD, [US.DB, 'UseStudio_Users', 'GetStatisticData', _userinfo.UserId], function (data) {
  12853. U.selectEl('.U_MD_U_UV_Friend', _context[1])[0].innerText = data.value[0].friendCount;
  12854. U.selectEl('.U_MD_U_UV_Word', _context[1])[0].innerText = data.value[0].wrodCount;
  12855. U.selectEl('.U_MD_U_UV_Excel', _context[1])[0].innerText = data.value[0].excelCount;
  12856. U.selectEl('.U_MD_U_UV_Cloud', _context[1])[0].innerText = data.value[0].diskFileCount;
  12857. });
  12858. //添加好友事件处理
  12859. var _friendinfo,
  12860. _addbutton = U.selectEl('.U_MD_U_UV_Head_Right_Btn', _context[1])[0],
  12861. _functionbtn = U.selectEl(_context[2]).find('.U_MD_U_UV_FuncArea_MarginBox_Btn'); //获取三个按钮
  12862. _functionbtn[1].style.display = '';
  12863. if (_userinfo.UserId == US.userInfo.UserId) {
  12864. _addbutton.onclick = function () {
  12865. U.Alert("不可以添加自己为好友哟!");
  12866. };
  12867. _functionbtn[1].style.display = 'none';
  12868. }
  12869. else if (US.friend.friends && (_friendinfo = U.Json.select(US.friend.friends, { UserId: _userinfo.UserId })[0])) {
  12870. _addbutton.onclick = function () {
  12871. U.MD.F.R.deleteFriendForm(_friendinfo, function () {
  12872. U.UF.F.closeWindow(_form);
  12873. });
  12874. //U.MD.F.M.deleteFriend(_friendinfo);
  12875. //U.UF.F.closeWindow(_form); //关闭窗口函数
  12876. };
  12877. _addbutton.style.backgroundColor = '#e20f0f';
  12878. _addbutton.innerText = '删除好友';
  12879. } else {
  12880. _addbutton.style.backgroundColor = '';
  12881. _addbutton.onclick = function () {
  12882. U.MD.F.M.addFriend(_userinfo, function () {
  12883. U.UF.F.closeWindow(_form); //关闭窗口函数
  12884. });
  12885. }
  12886. }
  12887. //协同文档事件绑定
  12888. _functionbtn[0].onclick = function () {
  12889. U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.disk.initTree[4][0] });
  12890. }
  12891. //协同他人文档事件绑定
  12892. // _functionbtn[1].onclick = function () {
  12893. // U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.disk.initTree[2][0] });
  12894. // }
  12895. //发起对话事件绑定
  12896. _functionbtn[1].onclick = function () {
  12897. if (!U.MD.U.L.isLogin()) {
  12898. var _friendinfo = U.Json.select(US.friend.friends, { UserId: _userinfo.UserId })[0];
  12899. if (_friendinfo) {
  12900. U.MD.F.W.popupFriendsForm(_friendinfo);
  12901. U.UF.F.closeWindow(_form); //关闭窗口函数
  12902. } else {
  12903. U.UF.UI.confirm((_userinfo.UserNickName || _userinfo.UserName) + "还不是你的好友哟!是否添加" + (_userinfo.UserNickName || _userinfo.UserName) + "为好友呢。", function () {
  12904. U.MD.F.M.addFriend(_userinfo, function () {
  12905. U.UF.F.closeWindow(_form); //关闭窗口函数
  12906. });
  12907. });
  12908. }
  12909. }
  12910. }
  12911. }
  12912. /**
  12913. * 添加好友状态切换 暂无使用
  12914. * @param {element} button 点击元素
  12915. * @param {element} userinfo 用户信息
  12916. */
  12917. U.MD.U.V.AddFriend = function (button, userinfo) {
  12918. U.MD.F.M.addFriend(userinfo, function () {
  12919. button.innerText = '删除好友';
  12920. button.style.backgroundColor = '#e20f0f';
  12921. button.onclick = function () {
  12922. _friendinfo = U.Json.select(US.friend.friends, { UserId: userinfo.UserId })[0];
  12923. U.MD.F.M.deleteFriend(_friendinfo);
  12924. button.innerText = '+好友';
  12925. button.style.backgroundColor = '';
  12926. button.onclick = function () {
  12927. U.MD.U.V.AddFriend(button, userinfo);
  12928. }
  12929. };
  12930. });
  12931. }
  12932. //滚动加载
  12933. U.MD.U.V.GDCKYHDT = function (UDOD, userid) {
  12934. _UDFE = U.MD.D.H.ET["UIF"][userid][1];
  12935. U.MD.U.V.ViewUserBlogInfo(UDOD, _UDFE, userid, this.P + 2); //分页打印
  12936. }
  12937. //获取用户最新发表
  12938. U.MD.U.V.ViewUserBlogInfo = function (UDOD, UDPE, userid, P, TF) {
  12939. var _userinfoel = U.selectEl(UDOD).Child();
  12940. UDPE = U.MD.D.D.FYGBL(UDPE, P); //U.UF.EL.getChildrenNoText()
  12941. if (UDPE[0]) {
  12942. if (TF) { _userinfoel[1].innerText = ""; }
  12943. if (UDPE[0].length) { U.MD.D.Blog.PGBL(_userinfoel[1], UDPE[0], true); }
  12944. else if (P === 1) { U.MD.U.V.PCKYHDT(_userinfoel[1]); }
  12945. } //打印文章
  12946. 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]); }
  12947. //$("div#U_MD_U_UV_PC", _userinfoel[0])[0].onscroll = U.UF.EV.scrollLoad({ "AF": function () { U.MD.U.V.GDCKYHDT(_bloginfoel, userid); } }).SCH(); //滚动加载
  12948. U.UF.EV.scrollLoad($("div#U_MD_U_UV_PC", _userinfoel[0])[0], function () { U.MD.U.V.GDCKYHDT(_bloginfoel, userid); }); //滚动加载
  12949. }
  12950. //异步获取最新的文章
  12951. U.MD.U.V.AsynCKYHDT = function (r) {
  12952. var _context = r.context,
  12953. UPXD = U.MD.D.H.ET["UIF"][_context[2]];
  12954. r = r.value;
  12955. if (!UPXD) { UPXD = U.MD.D.H.ET["UIF"][_context[2]] = [], UPXD[1] = [] };
  12956. UPXD[1] = UPXD[1] || [];
  12957. UPXD[1][_context[4]] = U.MD.D.Blog.ZFSGBL(r);
  12958. _context[5][1].innerText = "";
  12959. _context[5][0].innerText = r[0] > 0 ? "动静..(" + r[0].SumNumber + ")" : "动静";
  12960. U.MD.U.V.ViewUserBlogInfo(_context[1], UPXD[1], _context[2], _context[3]); //打印用户的文章
  12961. }
  12962. //用户资料没有发表文章
  12963. U.MD.U.V.PCKYHDT = function (UDOD) {
  12964. var _userinfoel = $$("div", { "className": "U_MD_U_UV_T" }, UDOD);
  12965. $$("div", { "className": "U_MD_U_UV_TS", "innerHTML": "他暂时没有相关的消息呢!!稍后再来试试吧~" }, _userinfoel);
  12966. $$("div", { "className": "U_MD_U_UV_TX", "innerHTML": "Noting!!" }, _userinfoel);
  12967. }
  12968. //群介绍
  12969. U.MD.U.V.GroupInfo = function (groupinfo) {
  12970. var _userinfoel = U.selectEl("#U_MD_U_GV").clone(true), // 用户信息元素
  12971. _childs = U.selectEl(_userinfoel[0]).Child(),
  12972. _content = _childs[0];
  12973. U.MD.U.V.syncData(_content, groupinfo);
  12974. var _form = new U.UF.UI.form("<div class='U_MD_F_S_TI'>群信息</div>",
  12975. _content,
  12976. {
  12977. "style": {
  12978. "min-width": "480px",
  12979. "width": "480px",
  12980. "height": "340px"
  12981. },
  12982. id: "U_MD_G_Info"
  12983. },
  12984. {
  12985. isenlarge: false,
  12986. isnarrow: false
  12987. }).form;
  12988. }
  12989. //同步群介绍的数据
  12990. U.MD.U.V.syncData = function (el, groupinfo) {
  12991. var _head = el.children[0], //群介绍的头部
  12992. _middle = el.children[1], //群介绍的中间部分
  12993. _bottom = el.children[2], //群介绍的底部
  12994. _groupId = groupinfo.GroupManageID, //群的ID
  12995. _groupCreaterId = groupinfo.GroupManageCreateUserID, //群主的ID
  12996. _groupCreaterEl = U.selectEl(_bottom).find('.U_MD_U_GV_GroupInfo_ImgArea_Creater')[0], //群主显示的元素
  12997. _groupMember = U.Json.select(US.friend.groupusers, { GroupManageID: _groupId }), //群人数
  12998. _cloneEl = $$('img'), //创建图片
  12999. _createrImg = _cloneEl.cloneNode(), //克隆图片元素
  13000. _groupMemberEl = U.selectEl(_bottom).find('.U_MD_U_GV_GroupInfo_ImgArea_MemberImg')[0], //群人数显示的元素
  13001. _groupBtn = U.selectEl(_middle).find('.U_MD_U_GV_FuncArea_MarginBox_Btn'); //群的三个按钮
  13002. U.selectEl(_head).find('.U_MD_U_GV_HeadInfo_Name')[0].innerText = groupinfo.GroupManageName; //群的名字
  13003. U.selectEl(_head).find('.U_MD_U_GV_HeadInfo_Desc')[0].innerText = groupinfo.GroupManageDescript; //群的介绍
  13004. U.selectEl(_bottom).find('.U_MD_U_GV_GroupInfo_Img_TextNum')[0].innerText = _groupMember.length; //群的人数
  13005. _createrImg.src = U.MD.C.getHeadImage(U.Json.selectOne(US.friend.groupusers, { UserId: _groupCreaterId }).UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg"; //群头像
  13006. _groupCreaterEl.appendChild(_createrImg) //把群头像添加到元素里
  13007. _groupCreaterEl.onclick = function () {
  13008. U.MD.U.V.ViewOtherUserInfo(_groupCreaterId);
  13009. }
  13010. _groupBtn[2].onclick = function () {
  13011. top.U.MD.F.W.popupFriendsForm(groupinfo);
  13012. }
  13013. for (var i = 0; i < _groupMember.length; i++) {
  13014. if (i < 6) {
  13015. var _cloneImg = _cloneEl.cloneNode();
  13016. _cloneImg.src = U.MD.C.getHeadImage(_groupMember[i].UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg";
  13017. _cloneImg.onclick = U.UF.C.closure(function (i) {
  13018. U.MD.U.V.ViewOtherUserInfo(_groupMember[i].UserId);
  13019. }, [i])
  13020. _groupMemberEl.appendChild(_cloneImg);
  13021. } else {
  13022. $$('span', { className: "U_MD_U_GV_GroupInfo_ImgArea_MemberMore", innerText: "···", onclick: function () {
  13023. U.MD.U.V.showAllGroupMember(_groupMember, this, _cloneEl, _groupMemberEl);
  13024. }
  13025. }, _groupMemberEl);
  13026. return;
  13027. }
  13028. }
  13029. }
  13030. U.MD.U.V.showAllGroupMember = function (groupmember, el, cloneel, addel) {
  13031. addel.style.display = "none";
  13032. addel.style.height = "82px";
  13033. for (var i = 6; i < groupmember.length; i++) {
  13034. var _cloneImg = cloneel.cloneNode();
  13035. _cloneImg.src = U.MD.C.getHeadImage(groupmember[i].UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg";
  13036. _cloneImg.onclick = U.UF.C.closure(function (i) {
  13037. U.MD.U.V.ViewOtherUserInfo(groupmember[i].UserId);
  13038. }, [i]);
  13039. addel.appendChild(_cloneImg);
  13040. }
  13041. addel.style.display = "block";
  13042. U.selectEl(el).remove();
  13043. }
  13044. //#endregion;
  13045. ///<jscompress sourcefile="ViewLogin.js" />
  13046. Namespace.register("U.MD.U.L"); //用户登录的命名空间
  13047. Namespace.register("U.MD.U.OT"); //用户登录的命名空间
  13048. //#region 登录
  13049. /*
  13050. 问题:
  13051. 1、验证码的接口问题
  13052. 2、无窗体的接口
  13053. */
  13054. //#region 配置数据
  13055. U.MD.U.L.loginCallBack; //登录后的回调使用
  13056. U.MD.U.L.isLogining = false; //判断用户登录状态。cookie登录状态为cookie,账号登录为true,没有登录为false
  13057. //#endregion
  13058. /**
  13059. * 弹出登录注册
  13060. *
  13061. * @param {int} type==3:登录页面,type==1:注册页面,type==2:找回密码页面
  13062. * @param {function} cb为回调函数
  13063. * @returns {boolean} 是否登录
  13064. */
  13065. U.MD.U.L.login = U.MD.U.L.DLTC = function (fun) {
  13066. var _iframe = U.selectEl("#U_MD_HomeC_Pop iframe")[0];
  13067. if ($("#U_MD_HomeC_Pop")[0]) {
  13068. U.UF.F.windowTopCenter($("#U_MD_HomeC_Pop")[0]);
  13069. try {
  13070. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13071. if (U.UF.C.isFunction(fun)) {
  13072. U.MD.U.L.loginCallBack = fun; //回调处理
  13073. }
  13074. U.selectEl("input", _iframe.contentWindow.document)[0].focus();
  13075. _iframe.contentWindow.U.MD.U.L.init();
  13076. }
  13077. catch (e) { }
  13078. }
  13079. else {
  13080. 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" });
  13081. new U.UF.UI.form("", _iframe,
  13082. {
  13083. "id": "U_MD_HomeC_Pop",
  13084. "style": {
  13085. "width": "360px",
  13086. "height": "510px"
  13087. }
  13088. },
  13089. {
  13090. isdrag: false,
  13091. isstretching: false,
  13092. isenlarge: false,
  13093. isnarrow: false
  13094. });
  13095. //跨域回调设置
  13096. U.UF.DL.iframeLoad(_iframe, function () {
  13097. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13098. if (U.UF.C.isFunction(fun)) {
  13099. U.MD.U.L.loginCallBack = fun; //回调处理
  13100. }
  13101. _iframe.contentWindow.U.MD.U.L.loginCallBack = U.MD.U.L.defaultCallBack; //设置登录回调
  13102. });
  13103. }
  13104. return _iframe;
  13105. }
  13106. /**
  13107. * 打开注册窗体
  13108. */
  13109. U.MD.U.L.register = function (fun) {
  13110. var _iframe = U.MD.U.L.login();
  13111. try {
  13112. _iframe.contentWindow.U.MD.U.R.register();
  13113. }
  13114. catch (e) {
  13115. U.UF.DL.iframeLoad(_iframe, function () {
  13116. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13117. if (U.UF.C.isFunction(fun)) {
  13118. U.MD.U.L.loginCallBack = fun; //回调处理
  13119. }
  13120. _iframe.contentWindow.U.MD.U.L.loginCallBack = U.MD.U.L.defaultCallBack; //设置登录回调
  13121. _iframe.contentWindow.U.UF.N.addHash('register'); //添加hash的处理
  13122. });
  13123. }
  13124. }
  13125. /**
  13126. * 打开找回密码窗体
  13127. */
  13128. U.MD.U.L.retrieve = function () {
  13129. var _iframe = U.MD.U.L.login();
  13130. try {
  13131. _iframe.contentWindow.U.MD.U.F.findPassword();
  13132. }
  13133. catch (e) {
  13134. U.UF.DL.iframeLoad(_iframe, function () {
  13135. _iframe.contentWindow.U.UF.N.addHash('findPassword'); //添加hash的处理
  13136. });
  13137. }
  13138. }
  13139. /**
  13140. * 登录异步
  13141. *
  13142. * @param {object} 服务器返回的值
  13143. * @param {boolean} 是否是cookie登录
  13144. */
  13145. U.MD.U.L.defaultCallBack = function (r, iscookie) {
  13146. var _userinfo, //用户个人信息
  13147. _backgroudimage, //背景图片
  13148. _str, //输出的提示
  13149. _context = r.context, //回调参数
  13150. _address = _context[1], //触发函数的地址
  13151. _username = _context[2], //用户名
  13152. _password = _context[3]; //密码
  13153. //登录后台返回的数据
  13154. r = r.value;
  13155. //判断登录状态
  13156. switch (r) {
  13157. case null:
  13158. _str = "系统繁忙!请重试";
  13159. break; //系统繁忙
  13160. case 0:
  13161. _str = "帐号不存在!";
  13162. break;
  13163. case 1:
  13164. _str = "密码错误!";
  13165. break; //帐号密码错误
  13166. case 2:
  13167. _str = "该用户不允许被访问!请联系管理员";
  13168. break; //用户给禁用
  13169. default:
  13170. if (r) {
  13171. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13172. U.MD.U.LO.emptyUserInfo(); //登陆的时候先清空用户信息,防止前面登陆用户的信息有冲突
  13173. //如果刚刚登陆的时候没有用户的地址,这里重新获取,然后向后台发送
  13174. if (!_address) {
  13175. U.UF.CI.getUserLocation(U.MD.U.L.addUserAccess); //客户端信息加载,好像只加载了新浪ip地址?
  13176. }
  13177. _userinfo = U.MD.U.L.setUserInfo(r); //设置用户基本信息,包括用户信息,好友信息
  13178. U.MD.U.L.getLoginUserInfo(_username || US.userInfo.UserName); //去获取用户详细信息
  13179. if ($("#U_MD_D_BDI")[0] && U.selectEl('#U_MD_D_BG')[0]) {
  13180. //登录有用户的信息展示到页面中,包括背景图片、用户头像等
  13181. U.MD.U.L.printUserInfo(); //用户头部头像个人信息
  13182. _backgroudimage = U.MD.D.B.split(US.userInfo.UserBackGroundImage); //拆分用户的背景图片,里面包含了图片地址和展示的格式
  13183. U.MD.D.B.setBackgroundImage(_backgroudimage[0], _backgroudimage[1]); //设置用户背景图,以后需修改为设置用户桌面信息
  13184. }
  13185. //Cookie登录,即使密码错误也不弹出错误信息。
  13186. if (_str && iscookie !== true) {
  13187. U.alert(_str); //登录提示处理
  13188. }
  13189. //如果弹出了登录框,那么给登录框进行处理
  13190. if ($("#U_MD_HomeC_Pop")[0]) {
  13191. //登录框的样式还原
  13192. U.selectEl("#U_MD_HomeC_Pop")[0].close(); //关闭登陆款
  13193. }
  13194. U.MD.O && U.MD.O.P.connect();
  13195. }
  13196. // _str = "登录成功";
  13197. }
  13198. if (_str) {
  13199. U.alert(_str);
  13200. }
  13201. }
  13202. /**
  13203. * 判断用户是否登录如果未登陆则弹出登陆框
  13204. *
  13205. */
  13206. U.MD.U.L.isLogin = function (fun) {
  13207. if (!US.userInfo.UserId) { //判断用户id是否存在
  13208. U.MD.U.L.login(fun); //用户登录函数
  13209. return true; //用户未登录返回false
  13210. }
  13211. return false; //用户登录返回true
  13212. }
  13213. /**
  13214. * 登录调用回调使用
  13215. * @param {function} 回调函数
  13216. *
  13217. */
  13218. U.MD.U.L.setLoginCallBack = function (fun) {
  13219. //未登录要求登录
  13220. if (U.MD.U.L.isLogin()) {
  13221. U.MD.U.L.loginCallBack = fun;
  13222. }
  13223. //登录直接转发
  13224. else {
  13225. fun();
  13226. return true;
  13227. }
  13228. }
  13229. //#endregion
  13230. //#region cookie登录
  13231. /*
  13232. 功能:1473.cn域下各个应用的用户通过Cookie自动登录,Cookie登录入口。支持跨域
  13233. */
  13234. U.MD.U.L.cookieLogin = function () {
  13235. var _cookie = U.MD.U.L.getCookieByUserId(), //获取用户的云端Cookie,选取最后一个账号进行登录。
  13236. _address = US.city.userAllLocation || ""; //找到自己登陆用户的地址
  13237. //如果获取到cookie的值,那么就进行cookie登陆
  13238. if (_cookie && _cookie.userid && _cookie.userid.length == 36) {
  13239. U.MD.U.L.isLogining = "cookie"; //设置cookie登陆状态
  13240. U.A.Request(US.USER, ["LoginByCookie", _cookie.userid, _cookie.username], U.MD.U.L.defaultCallBack, ["", _address]); //调用cookie登陆处理
  13241. }
  13242. }
  13243. /*
  13244. 功能:获取用户cookie,云端cookie关键字为usestudiosso,格式为
  13245. Loginid:登录id
  13246. userstamp:账号13928417148的值为"1364812396"?奇怪?
  13247. userid:云端用户id
  13248. username:云端用户名
  13249. 如果不传入参数,默认获取最后一个,否则获取传入userid的账号进行登录。
  13250. 参数一:userid代表用户id。传入用户id,则判断cookie中是否有该账号,并使用该账号登录。
  13251. */
  13252. U.MD.U.L.getCookieByUserId = function (userid) {
  13253. var i, _cookiearr = U.MD.U.L.cookieToArray("usestudiosso"); //获取保存的cookie值。
  13254. //如果传入参数userid并且cookie中有userid。则判断是否是自己的账号登录。
  13255. if (_cookiearr.userid) {
  13256. //如果传了userid,那么就根据userid找
  13257. if (userid) {
  13258. //数组里匹配
  13259. for (i = 0; i < _cookiearr.userid.length; i++) {
  13260. if (_cookiearr.userid[i] == userid) {
  13261. break;
  13262. }
  13263. }
  13264. }
  13265. //否则找到最后一个登陆用户的信息
  13266. else {
  13267. //允许多用户登录,则用户id减少一?
  13268. i = _cookiearr.userid.length - 1;
  13269. }
  13270. //循环所有Cookie。
  13271. for (var c in _cookiearr) {
  13272. //对中文进行解密。_cookiearr[c]中可能有多个userid,只获取最后选中的第i个。返回的数据在这里做了处理。
  13273. _cookiearr[c] = decodeURIComponent(_cookiearr[c][i]);
  13274. }
  13275. }
  13276. //返回的集合包括了Loginid:登录iduserstamp:账号13928417148的值为"1364812396"?奇怪?userid:云端用户idusername:云端用户名
  13277. return _cookiearr;
  13278. }
  13279. /**
  13280. *1473cookie格式专用
  13281. * 把形如:"userid=72854d28-f45c-48d7-92b7-3cd933e03022&username=13928417148&Loginid=fd02976d-993b-4437-bbd9-5efa99802c8f&userstamp=1364812396"的cookie转换为json对象。函数名有问题。
  13282. 得到的形式为:_UAE.Loginid可得到用户id。
  13283. *
  13284. * @param {string} 获取cookie的key对应的值 如usestudio=aa=ff&ss=aa 的usestudio里的 aa=ff&ss=aa
  13285. * @return {object} {key:[value1,value2]}
  13286. */
  13287. U.MD.U.L.cookieToArray = function (key) { //获取cookie
  13288. var i, //循环初始化
  13289. _cookieobj = {}, //初始化对象 作为返回值
  13290. _cookie = U.UF.Cookie.get("usestudiosso"); //获取用户指定的Cookie值
  13291. if (_cookie) { //是否存在
  13292. _cookie = _cookie.split("&");
  13293. for (i = 0; i < _cookie.length; i++) { //循环对应的值
  13294. _cookie[i] = _cookie[i].split("="); //切分key和value
  13295. //如果定义了cookie值的接受数组,则不再重复定义。_cookie[i][0]相当于key,例如userid
  13296. if (!_cookieobj[_cookie[i][0]]) {
  13297. _cookieobj[_cookie[i][0]] = [];
  13298. }
  13299. _cookieobj[_cookie[i][0]].push(decodeURIComponent(_cookie[i][1])); //生成{key:[value1,value2]}
  13300. }
  13301. }
  13302. return _cookieobj;
  13303. }
  13304. //#endregion
  13305. //#region 登录数据使用
  13306. /**
  13307. * 为了以后的扩展,给其他系统获取完整的用户信息,获取用户登录数据,后面还有一个登陆获取用户个人信息。好友信息,及消息通知,逻辑有问题。
  13308. * @param {string} 用户名
  13309. *
  13310. */
  13311. U.MD.U.L.getLoginUserInfo = function (username) {
  13312. U.A.Request(US.USER, ["GetUserLoginData", username], U.MD.U.L.asynGetLoginUserInfo);
  13313. }
  13314. /**
  13315. * 异步获取数据
  13316. * @param {object} ajax返回的数据值
  13317. *
  13318. */
  13319. U.MD.U.L.asynGetLoginUserInfo = function (r) {
  13320. r = r.value; //得到登录用户的数据
  13321. US.friend = r; //返回的r里面是用户的好友信息 包括 {"className":好友分组信息,friends:好友信息,group:好友群,groupusers:群好友,recentcontacts:最近联系人,unreadfirendmessage:未读好友消息,unreadgroupmessage:未读群消息,commonfriend:推荐好友}
  13322. U.MD.U.L.initUserLogin(US.userInfo); //登录初始化应用
  13323. if (U.MD.D && U.MD.D.IsUseStudio || U.selectEl("#usestudio_server")[0]) {
  13324. U.MD.F && U.MD.F.N.friendMessageHandle([r.unreadfirendmessage, r.unreadgroupmessage]); //用户消息区域
  13325. }
  13326. }
  13327. /**
  13328. * 添加用户初始化资料信息
  13329. * @param {array} 登录用户的数据
  13330. *
  13331. */
  13332. U.MD.U.L.setUserInfo = function (userinfo) {
  13333. US.userInfo = userinfo[0]; //给用户信息全局变量赋值。
  13334. US.userInfo.LoginId = userinfo[2]; //用户前后台更新数据唯一识别id
  13335. US.friend.onlinefirendinfo = userinfo[1]; //添加在线信息。
  13336. return US.userInfo;
  13337. }
  13338. //登录成功执行事件
  13339. U.MD.U.L.initUserLogin = function () {
  13340. var _userinfo = US.userInfo; //初始化用户资料
  13341. U.MD.UI && U.MD.UI.flashEmptyUpload && U.MD.UI.flashEmptyUpload(); //清理上传文件
  13342. //登录有的其他回调,如,登陆后直接打开好友聊天等
  13343. if (U.UF.C.isFunction(U.MD.U.L.loginCallBack)) {
  13344. U.MD.U.L.loginCallBack(_userinfo); //回调处理
  13345. }
  13346. U.MD.F && U.MD.F.initFriend(); //初始化好友
  13347. //如果没有用url指引,同时又是1473的项目,那么弹出云盘,否则只是加载数据
  13348. if (U.MD.D && U.MD.D.IsUseStudio) {
  13349. U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.FTPFOLDERID }); //弹出云盘的数据。
  13350. }
  13351. //外部加载1473框架的都会带有usestudio_server 这个元素,当用户没有填写邮箱信息的时候,同时是在1473主站点的,那么就弹出用户
  13352. if (!US.userInfo.UserEmail && !$("#usestudio_server")[0]) {
  13353. U.MD.U.P.userDataSet(); //用户数据加载
  13354. }
  13355. }
  13356. /**
  13357. * 添加用户登录信息
  13358. *
  13359. */
  13360. U.MD.U.L.addUserAccess = function () {
  13361. //如果用户的城市信息不存在,则添加用户用户城市信息,应该不只是单单判断地址,此处逻辑还需要整理!
  13362. if (US.city.userAllLocation) {
  13363. U.A.Request(US.USER, ["RecordUserClientInfo", US.userInfo.UserName, "", "", US.city.userAllLocation, ""],
  13364. function () { }); //异步添加地址信息
  13365. }
  13366. }
  13367. /**
  13368. * 打印用户的信息
  13369. *
  13370. */
  13371. U.MD.U.L.printUserInfo = function () {
  13372. var _childel,
  13373. _userinfo = US.userInfo, //用户的信息
  13374. _userimage = U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead), //获取用户头像
  13375. _el = U.selectEl("#U_MD_D_BDI"); //头像打印的区域
  13376. if (_el[0]) {
  13377. //设置头部的样式变化
  13378. _el.addAttrArray({
  13379. "className": "U_MD_D_BDI"
  13380. })[0];
  13381. //如果已经有头像了,那么直接修改头像
  13382. if (_el.find("img")[0]) {
  13383. //设置头像处理
  13384. _el.find("img").addAttrArray({
  13385. "onerror": U.MD.C.imgError,
  13386. "title": _userinfo.UserNickName,
  13387. "onclick": function () {
  13388. U.MD.D.I.openApplication("set");
  13389. },
  13390. "src": U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead)
  13391. });
  13392. }
  13393. //创建头像的处理
  13394. else {
  13395. $$("img", { "onerror": U.MD.C.imgError,
  13396. "onerror": U.MD.C.imgError,
  13397. "title": _userinfo.UserNickName,
  13398. "onclick": function () {
  13399. U.MD.D.I.openApplication("set");
  13400. },
  13401. "src": U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead)
  13402. }, _el[0])
  13403. }
  13404. _childel = U.selectEl("#U_MD_D_BDL").Child();
  13405. _childel[0].style.display = _childel[1].style.display = "none";
  13406. _childel[2].style.display = "block";
  13407. }
  13408. }
  13409. //#endregion
  13410. //#region 外链登录
  13411. /**
  13412. * 填写登录信息
  13413. *
  13414. * @param {array} 登录值参数
  13415. * @param {array} 回调函数
  13416. */
  13417. U.MD.U.L.perfectUserInfo = function (userinfo, username) {
  13418. if ($("#U_MD_U_OT_B_Pop")[0]) {
  13419. U.UF.F.windowTopCenter($("#U_MD_U_OT_B_Pop")[0]);
  13420. }
  13421. else {
  13422. 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" });
  13423. new U.UF.UI.form("", _iframe,
  13424. {
  13425. "id": "U_MD_U_OT_B_Pop",
  13426. "style": {
  13427. "width": "400px",
  13428. "height": "340px"
  13429. }
  13430. },
  13431. {
  13432. isdrag: false,
  13433. isstretching: false,
  13434. isenlarge: false,
  13435. isnarrow: false
  13436. });
  13437. //跨域回调设置
  13438. U.UF.DL.iframeLoad(_iframe, function () {
  13439. if ($("#U_MD_HomeC_Pop")[0]) {
  13440. U.selectEl("#U_MD_HomeC_Pop")[0].close();
  13441. }
  13442. _iframe.contentWindow.U.MD.U.L.loginCallBack = U.MD.U.L.defaultCallBack; //设置登录回调
  13443. _iframe.contentWindow.U.MD.U.OT.perfectUserInfoInit(userinfo, username); //设置登录回调
  13444. });
  13445. }
  13446. }
  13447. //#endregion
  13448. ;
  13449. ;
  13450. ///<jscompress sourcefile="Advertisement.js" />
  13451. /*
  13452. 广告使用区域
  13453. */
  13454. Namespace.register("U.UF.DL.C.AD"); //桌面广告命名空间
  13455. //#region 百度广告
  13456. /*
  13457. * 百度异步加载
  13458. *
  13459. * @param {string} 广告id
  13460. */
  13461. U.UF.DL.C.AD.onloadBaiduJs = function (baiduid) {
  13462. U.UF.DL.asynLoadJs({ "src": "//hm.baidu.com/hm.js?" + baiduid }); //加载广告
  13463. }
  13464. /*
  13465. * 百度异步加载
  13466. *
  13467. * @param {string} 广告位置id
  13468. * @param {string} 广告id
  13469. */
  13470. U.UF.DL.C.AD.baidu = function (elementid, baiduid) {
  13471. if (baiduid) { //异步加载
  13472. U.UF.DL.asynLoadJs({ type: "text/javascript", src: "http://cbjs.baidu.com/js/m.js" },
  13473. function () {
  13474. U.UF.DL.C.AD.asynBaidu(elementid, baiduid);
  13475. }); //异步加载
  13476. }
  13477. }
  13478. /*
  13479. * 异步广告
  13480. *
  13481. * @param {string} 广告位置id
  13482. * @param {string} 广告id
  13483. */
  13484. U.UF.DL.C.AD.asynBaidu = function (elementid, code) {
  13485. BAIDU_CLB_fillSlotAsync(code, elementid);
  13486. }
  13487. //#endregion
  13488. //#region
  13489. /*
  13490. * 异步阿里妈妈广告
  13491. *
  13492. * @param {string} 广告位置id
  13493. */
  13494. U.UF.DL.C.AD.alimama = function (obj) {
  13495. //阿里巴巴官网实例
  13496. var i,
  13497. _aliobj = window.alimamatk_onload = window.alimamatk_onload || [];
  13498. if (Array.isArray(obj)) {
  13499. for (i = 0; i < obj.length; i++) {
  13500. U.UF.DL.C.AD.alimama(obj[i]);
  13501. }
  13502. }
  13503. else {
  13504. _aliobj.push(U.UF.C.isObject(obj) ? obj : (obj = { pid: obj, appkey: "", unid: "", type: "click" }));
  13505. } //加载广告
  13506. if (!window.alimamatk_show) {
  13507. U.UF.DL.asynLoadJs({ type: "text/javascript", id: obj.pid, charset: "gbk", async: true, src: "http://a.alimama.cn/tkapi.js" });
  13508. }
  13509. }
  13510. /*
  13511. * 阿里妈妈广告异步
  13512. *
  13513. * @param {string} 广告位置id
  13514. */
  13515. U.UF.DL.C.AD.asynAlimama = function (el, id) {
  13516. $$("a", { style: { "display": "none!important" }, id: "tanx-a-" + id }, el); //显示元素
  13517. U.UF.DL.asynLoadJs({ type: "text/javascript", id: "tanx-s-" + id, async: true,
  13518. charset: "gbk", async: true, src: "http://p.tanx.com/ex?i=" + id
  13519. }); //加载广告
  13520. }
  13521. //#endregion
  13522. ;
  13523. ///<jscompress sourcefile="Common.js" />
  13524. Namespace.register("U.MD.C");
  13525. /**
  13526. * 图片错误处理
  13527. *
  13528. * @param {element} 图片元素
  13529. * @param {number} 判断的类型
  13530. */
  13531. U.MD.C.imgError = function (imgel, type) {
  13532. var _number, //存放参数
  13533. _url; //存放图片的src
  13534. //获取出错的对象
  13535. imgel = imgel && !imgel.srcElement ? imgel : (event ? event.srcElement || this : this);
  13536. //如果是错误图片就不执行
  13537. if (imgel.src != "/img/error.png") {
  13538. if (type == 2) { //重复请求图片 用于初始上传的图片
  13539. _url = imgel.src; //图片的路径
  13540. _number = _url.indexOf("?&n="); //判断是否添加获取
  13541. //允许文件同时获取10次
  13542. if (_number < 0 || _url.length - _number < 10) {
  13543. imgel.src += (_number == -1 ? "?&n=" : "") + 1; //添加缓存过滤
  13544. return
  13545. }
  13546. else {
  13547. type = 1;
  13548. }
  13549. }
  13550. if (type == 1) { //错误图像处理
  13551. U.selectEl(imgel).addAttrArray({ "src": "/img/error.png" });
  13552. }
  13553. else { //错误头像处理
  13554. imgel.src = type || "/img/UserHead/UseHead.jpg";
  13555. }
  13556. }
  13557. }
  13558. /**
  13559. * 获取头像图片的正确地址
  13560. *
  13561. * @param {string} 需要生成正常地址的 由于1473的地址 需要带上 http://fs.1473.cn 无需 这里同时处理了 1473和外链地址
  13562. * @return {string} 过滤过的
  13563. */
  13564. U.MD.C.getHeadImage = function (url) {
  13565. 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"), ""))));
  13566. };
  13567. ///<jscompress sourcefile="DataCrossdomain.js" />
  13568. Namespace.register("U.MD.CD"); //完全跨域的解决方案
  13569. //是否加载完成
  13570. U.MD.CD.isLoad;
  13571. //跨域传输的数据
  13572. U.MD.CD.data;
  13573. //如果不是1473的域名访问的处理
  13574. if (!window.location.host.indexOf("www.1473.cn")) {
  13575. //错误处理,前端错误需要在控制台输出,同时提交到错误数据库
  13576. //window.onerror = function(sMessage,sUrl,sLine,columnNumber,errorObj){};
  13577. //onerror函数的五个参数用于确定错误确切的信息,代表的意思依次为:
  13578. //* @param {String} errorMessage errorMessage 错误信息
  13579. //* @param {String} scriptURI 出错的文件
  13580. //* @param {Long} lineNumber 出错代码的行号
  13581. //* @param {Long} columnNumber 出错代码的列号
  13582. //* @param {Object} errorObj 错误的详细信息,Anything
  13583. window.onerror = function (errorMessage, scripturi, linenumber, columnnumber, errorobj) {
  13584. errorobj = errorobj || {}; //屏蔽js错误
  13585. U.A.Request(US.USER, ["SetError", 0, (event.errorMessage || event || errorMessage), (scripturi || event.filename || event.errorUr) + "。行号:" + (linenumber || event.lineno || event.errorLine)], function () { }, []); //错误消息发送到数据库
  13586. U.UF.C.console(event.errorMessage || event || errorobj); //console 输出错误信息
  13587. return true; //不让浏览器弹出错误报告,浏览器会弹出一个comfirm的错误。
  13588. }
  13589. //加载所有的跨域
  13590. U.UF.CD.loadAjaxCrossDomain(function () {
  13591. U.MD.CD.isLoad = true; //设置跨域加载成功处理
  13592. U.MD.CD.load(); //加载成功后的处理
  13593. });
  13594. //跨域执行ajax处理 fun, issender, iframeid, url, id
  13595. U.MD.CD.me = new U.UF.EV.message(function (data, id, cookie) {
  13596. U.MD.CD.data = [data, id]; //跨域传输的数据
  13597. U.MD.CD.load(); //加载的处理
  13598. }, false, "domain");
  13599. //发送请求获取数据
  13600. U.MD.CD.load = function () {
  13601. //如果加载完,同时有传输数据的处理
  13602. if (U.MD.CD.isLoad && U.MD.CD.data) {
  13603. var _data = U.MD.CD.data[0], //传参的值
  13604. _url = _data[0], //需要请求的url
  13605. _params = _data[1]; //需要请求的参数
  13606. try {
  13607. //做www.1473.cn的用户安全的。以后再扩展
  13608. US.userInfo = US.userInfo.UserId ? US.userInfo : {
  13609. "LoginId": U.UF.Cookie.get("usestudiosso", "loginid")[0],
  13610. "UserId": U.UF.Cookie.get("usestudiosso", "userid")[0]
  13611. };
  13612. }
  13613. catch (e) { }
  13614. //当a.com要调用b.com的时候,把a.com的ajax转向到b.com中去访问。boomyun是用到这里的.
  13615. U.A.Request(_url, _params, function (r) {
  13616. var _cookie = U.UF.Cookie.get("usestudiosso");
  13617. //设置登录信息
  13618. if ("LoginByCookie,uploadUserinfo".indexOf(_params[0]) > -1 && r.value && r.value[0]) {
  13619. US.userInfo = r.value[0];
  13620. US.userInfo.LoginId = r.value[2];
  13621. }
  13622. //数据发送获取
  13623. U.MD.CD.me.post(r.value, U.MD.CD.data[1], "usestudiosso=" + (_cookie || ""));
  13624. });
  13625. }
  13626. }
  13627. }
  13628. ;
  13629. ///<jscompress sourcefile="PageCrossdomain.js" />
  13630. Namespace.register("U.MD.CD");
  13631. //ui页面跨域处理 data[0] = 1473删除的data数据 [1] = 1473传输过来的函数唯一识别id [2] = cookie
  13632. U.MD.CD.me = new U.UF.EV.message(function (data, id) {
  13633. //获取加载1473 index.aspx里面的内容
  13634. U.UF.CD.loadPageCrossDomain(function () {
  13635. //把数据发送到发送者页面
  13636. U.MD.CD.me.post(document.body.innerHTML, id, "usestudiosso=" + (U.UF.Cookie.get("usestudiosso") || ""));
  13637. });
  13638. }, false, "pagedomain");
  13639. ;
  13640. ///<jscompress sourcefile="Switch.js" />
  13641. //#region 切换效果区域
  13642. Namespace.register("U.UF.MR");
  13643. /**
  13644. * input搜索框变化
  13645. *
  13646. * @param {element} 变化的input元素
  13647. * @param {array} 变化的数组 实现数组 0 、 1 切换
  13648. -----------[0] 变化前的值 如 "请输入内容"
  13649. -----------[1] 变化后的值 如 ""
  13650. */
  13651. U.UF.MR.inputPlaceholder = function (el, str, changestr) {
  13652. if (typeof str == "string") {
  13653. str = { color: "#999", value: str };
  13654. }
  13655. if (typeof changestr == "string") {
  13656. changestr = { color: "#000", value: changestr };
  13657. }
  13658. //聚焦操作
  13659. if (str.value == "") {
  13660. //当前value为默认提醒内容
  13661. if (el.value == "") {
  13662. el.value = changestr.value;
  13663. el.style.color = str.color;
  13664. }
  13665. }
  13666. //失焦操作
  13667. if (changestr.value == "") {
  13668. el.style.color = changestr.color;
  13669. if (el.value == str.value) {
  13670. el.value = "";
  13671. }
  13672. }
  13673. }
  13674. //#endregion
  13675. ;
  13676. ///<jscompress sourcefile="Permission.js" />
  13677. US.permission = {}; //所有的权限列表
  13678. //网盘所有的权限
  13679. US.permission.disk = {
  13680. "isopen": true, //是否允许打开, 现在所有的文件都有打开权限
  13681. "isupadte": true, //是否允许修改, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  13682. "isdelete": true, //是否允许删除, 只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  13683. "iscopy": true, //是否允许复制,现在所有的文件都有复制权限
  13684. "isshear": true, //是否允许剪切,只有自己的文件,他人添加文件或者文件夹到我的ftp中,或者是我作为群主的群文件
  13685. "isencryption": false, //是否允许加密,展示取消这个功能。
  13686. "isreply": true, //是否允许加密,展示取消这个功能。
  13687. "isdownload": true, //是否允许下载,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  13688. "isnew": true, //是否允许新建, 只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  13689. "ispaste": true, //是否允许粘贴,只有自己的文件夹,或者是任何人的ftp文件夹下及下的文件夹,或者是群里
  13690. "isrefresh": true, //是否允许刷新, 现在所有的文件都有刷新权限
  13691. "isupload": true, //是否允许上传,文件夹设置了不允许下载的文件夹和文件夹下的所有文件都不允许下载,其他都有权限
  13692. "isview": true, //是否允许视图切换,所有的文件夹都支持
  13693. "isedit": true //是否允许编辑,只有拥有可修改权限的文本文件才能修改
  13694. };
  13695. //网盘权限获取方法
  13696. US.permission.getDiskPermission = function () {
  13697. var i, _obj = {}, _p = US.permission.disk;//定义变量i,返回值对象_obj,获取全局的初始权限对象
  13698. for (i in _p) {//定义循环,将全局权限对象克隆给_obj
  13699. _obj[i] = _p[i]
  13700. }
  13701. return _obj;//返回_obj对象
  13702. };
  13703. ///<jscompress sourcefile="Timer.js" />
  13704. Namespace.register("U.MD.C.T"); //桌面计时器命名空间
  13705. U.MD.C.T.timer = null; //计时器
  13706. /*
  13707. * 计时器使用
  13708. *
  13709. */
  13710. U.MD.C.T.onesetInterval = function () {
  13711. var _num = 0; //定义一个时间计数变量
  13712. clearInterval(U.MD.C.T.timer); //防止多次启动计时器,这里是清除可能的计时器
  13713. //初始化计时器处理
  13714. U.MD.C.T.timer = setInterval(function () {
  13715. var _userid = US.userInfo.UserId; //登录用户的id
  13716. if (!(_num % 60)) { //每一分钟计数清空,防止页面运行太久计数太大,导致超过了js最大数
  13717. _num = 0;
  13718. }
  13719. //执行每隔五秒与服务器通讯一次
  13720. if (_userid) { //已经登录用户获取聊天消息
  13721. U.MD.F.N.messageService(_userid); //执行与服务器通讯函数
  13722. }
  13723. }, 5000); //执行计时消息
  13724. };
  13725. ///<jscompress sourcefile="Upload.js" />
  13726. Namespace.register("U.MD.UI"); //Disk上传的命名空间
  13727. //#region 上传区域 Html5 Flash html
  13728. //整个控件的名字规范函数名字
  13729. /**
  13730. * 上传带界面的函数
  13731. * @param {string} url为服务器地址
  13732. * @param {function} 回调函数
  13733. * @param {function} 判断hash值回调函数
  13734. * 回调函数返回结果:url为服务器地址返回的值。
  13735. */
  13736. U.MD.UI.upload = function (url, cb, hashcallback) {
  13737. //如果有flash,则走flash。
  13738. var _str = U.UF.CI.isSupportFlash(); //得到客户端支持html还是flash的处理
  13739. //_str = "Flash";
  13740. //html5的处理和html的处理,如果html,不能断点续传,不能解析md5.
  13741. if (_str == "HTML5") {
  13742. U.MD.UI.upload.html5(url, cb, hashcallback);
  13743. }
  13744. //flash的处理
  13745. else if (_str == "Flash") {
  13746. U.MD.UI.upload.flash(url, cb, hashcallback);
  13747. }
  13748. //只能通过input上传的处理
  13749. else {
  13750. U.MD.UI.upload.input(url, cb, hashcallback);
  13751. }
  13752. }
  13753. //所有的上传框选择的文件处理
  13754. U.MD.UI.upload.uploadFileInfo = [];
  13755. /**
  13756. * HTML5上传
  13757. * @param {string} url为服务器地址
  13758. * @param {function} 回调函数
  13759. * @param {function} 判断hash值回调函数
  13760. * 回调函数返回结果:url为服务器地址返回的值。
  13761. */
  13762. U.MD.UI.upload.html5 = function (url, cb, hashcallback) {
  13763. //如果是html5,走html5
  13764. U.MD.UI.create(); //创建传出上传框
  13765. var _clickuploadel = U.selectEl("#U_MD_UI_UP_DRT")[0]; //获取上传按钮的处理
  13766. _clickuploadel.innerText = "";
  13767. //创建一个input file
  13768. $$("input", { "multiple": "true", "type": "file", "accept": "*/*", "onchange": function () {
  13769. U.MD.UI.inputSelect({
  13770. //错误处理
  13771. error: function (r) {
  13772. console.log("上传错误:" + r);
  13773. },
  13774. //获取hash回调
  13775. getHashCallBack: function (filehash, fileinfo, callback) {
  13776. //判断获取hash
  13777. hashcallback(filehash, fileinfo, function (isupload) {
  13778. //判断是否上传的处理
  13779. if (isupload) { //如果md5匹配后还是要求上传,那么这里就处理上传
  13780. //判断数据库是否有该文件hash值 回调参数(文件服务器名,服务器文件大小)
  13781. U.UF.UP.html5Upload.select(fileinfo, filehash, function (fileservername, filesize) {
  13782. //上传处理
  13783. U.UF.UP.html5Upload.loop(fileinfo, filehash, fileservername, filesize, function (value) {
  13784. //上传成功的处理
  13785. if (value == true) {
  13786. callback.getData(filehash, fileservername, fileinfo); //得到返回值处理
  13787. var _nextuploadfile = U.MD.UI.delUploadFile(fileinfo.fileel, fileinfo); //删除上传成功后的文件,得到下一个需要上传的文件
  13788. // 如果有下一个文件要上传的处理
  13789. if (_nextuploadfile) {
  13790. U.MD.UI.inputUpload(_nextuploadfile, callback);
  13791. }
  13792. }
  13793. //上传中的处理
  13794. else {
  13795. callback.progress(value, fileinfo.fileid, "上传中"); //生成进度条
  13796. }
  13797. });
  13798. });
  13799. }
  13800. else {
  13801. var _nextuploadfile = U.MD.UI.delUploadFile(fileinfo.fileel, fileinfo); //删除上传成功后的文件,得到下一个需要上传的文件
  13802. // 如果有下一个文件要上传的处理
  13803. if (_nextuploadfile) {
  13804. U.MD.UI.inputUpload(_nextuploadfile, callback);
  13805. }
  13806. }
  13807. });
  13808. },
  13809. //获取进度条
  13810. progress: U.MD.UI.progress, //上传文件的进度条处理
  13811. //得到服务器返回值的处理
  13812. getData: function (filehash, fileservername, file) {
  13813. var _type = file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length), //获取文件后缀名
  13814. _thumbnailname = 'gif|jpg|jpeg|png'.indexOf(_type.toLowerCase()) > -1 ? (Guid.newGuid() + "." + _type) : null; //判断是否为图片
  13815. //如果是图片则创建缩略图
  13816. if (_thumbnailname) {
  13817. U.A.Request(US.DISK, ['CreateThumbnail', fileservername, _thumbnailname], function (r) { });
  13818. }
  13819. //添加文件到数据库
  13820. 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)],
  13821. function (request) {
  13822. cb({ data: [fileservername, fileservername, file.fileid, file.size, U.UF.C.queryString("Encrypt", url), U.UF.C.queryString("DirectoryId", url)] }, file);
  13823. });
  13824. }
  13825. });
  13826. this.value = "";
  13827. }, "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;" }
  13828. }, _clickuploadel);
  13829. }
  13830. /**
  13831. * Flash上传
  13832. * @param {string} url为服务器地址
  13833. * @param {function} 回调函数
  13834. * @param {function} 判断hash值回调函数
  13835. * 回调函数返回结果:url为服务器地址返回的值。
  13836. */
  13837. U.MD.UI.upload.flash = function (url, cb, hashcallback) {
  13838. U.MD.UI.create(); //创建传出上传框
  13839. var _url = url,
  13840. _cb = cb,
  13841. _hashcallback = hashcallback,
  13842. _clickuploadel = U.selectEl("#U_MD_UI_UP_DRT")[0]; //获取上传按钮的处理
  13843. _clickuploadel.innerText = "";
  13844. //添加flash按钮
  13845. U.UF.UP.addFlashUploadBottom(_clickuploadel, "flashupload", { "width": _clickuploadel.clientWidth, "height": _clickuploadel.offsetHeight }, {
  13846. error: U.MD.UI.flashError, //错误处理回调函数
  13847. /**
  13848. * 选择文件回调函数
  13849. * @param {array} filesinfo
  13850. */
  13851. select: function (filesinfo) {
  13852. U.MD.UI.flashSelect(filesinfo, _url, U.UF.C.isFunction(_hashcallback)); //选择文件的处理
  13853. },
  13854. /**
  13855. * 上传文件获取文件流后的处理
  13856. * @param {string} 文件的md5值
  13857. * @param {string} 需要上传的文件的唯一识别id
  13858. */
  13859. getHashCallBack: function (md5, fileid) {
  13860. var _fileinfo = U.MD.UI.getFileInfoById(fileid)[0];
  13861. //判断获取hash
  13862. _hashcallback(md5, _fileinfo, function (isupload) {
  13863. //判断是否上传的处理
  13864. if (isupload) { //如果md5匹配后还是要求上传,那么这里就处理上传
  13865. //直接执行文件的上传处理
  13866. U.UF.UP.flashUpload($("*flashupload")[0], fileid, _url);
  13867. }
  13868. else { //否则执行下一个上传的处理
  13869. U.MD.UI.flashContinueUpload(fileid, _url, U.UF.C.isFunction(_hashcallback));
  13870. }
  13871. });
  13872. },
  13873. progress: U.MD.UI.progress, //上传文件的进度条处理
  13874. uploadComplete: U.MD.UI.flashUploadComplete, //单个文件上传成功的回调函数
  13875. //单个文件上传成功后,得到服务器的响应值处理,和CP不一样的是这里是得到了返回值,上面的只是文件已经传输到服务器了。
  13876. /**
  13877. * 上传文件成功返回上传文件值
  13878. * @param {object} 获取服务器返回值
  13879. * @param {string} 上传文件的唯一识别id
  13880. */
  13881. getData: function (r, fileid) {
  13882. if (U.UF.C.isFunction(_cb)) {
  13883. _cb(r, U.MD.UI.getFileInfoById(fileid)[0]);
  13884. }
  13885. //否则执行下一个上传的处理
  13886. U.MD.UI.flashContinueUpload(fileid, _url, U.UF.C.isFunction(_hashcallback));
  13887. },
  13888. endUpload: U.MD.UI.deleteUploadAllFile //结束上传后释放资源
  13889. }, "*");
  13890. }
  13891. /**
  13892. * input上传
  13893. * @param {string} url为服务器地址
  13894. * @param {function} 回调函数
  13895. * @param {function} 判断hash值回调函数
  13896. * 回调函数返回结果:url为服务器地址返回的值。
  13897. */
  13898. U.MD.UI.upload.input = function (url, cb, hashcallback) {
  13899. U.MD.UI.create(); //创建传出上传框
  13900. var _clickuploadel = U.selectEl("#U_MD_UI_UP_DRT")[0]; //获取上传按钮的处理
  13901. _clickuploadel.innerText = "";
  13902. //创建一个input file
  13903. $$("input", {
  13904. "multiple": "true", "type": "file", "accept": "*/*", "onchange": U.MD.UI.inputSelect,
  13905. "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;" }
  13906. }, _clickuploadel);
  13907. }
  13908. /**
  13909. * 初始化创建上传弹框
  13910. */
  13911. U.MD.UI.create = function () {
  13912. var _flashtop = U.selectEl("#U_MD_UI_UP_O")[0];
  13913. if (_flashtop) {
  13914. U.UF.F.windowTopCenter(_flashtop); //居中弹出
  13915. }
  13916. else {
  13917. var _uploadel,
  13918. _topel,
  13919. _titleel,
  13920. _bottom,
  13921. _switchel;
  13922. _uploadel = $$("div", { "id": "U_MD_UI_UP", "className": "U_MD_UI_UP" });
  13923. _topel = $$("div", { "className": "U_MD_UI_UP_O" }, _uploadel);
  13924. //头部
  13925. _titleel = $$("div", { "className": "U_MD_UI_UP_T" }, _topel);
  13926. $$("div", { "className": "U_MD_UI_UP_TO", "innerHTML": "普通上传" }, _titleel);
  13927. $$("div", { "className": "U_MD_UI_UP_Z", "innerHTML": "提示声明: 严谨上传包括反动、暴力、色情、违法及侵权内容的文件;严格遵守保密法律法规,任何危害用户或犯法的行为,都必须受到法律追究。" }, _topel);
  13928. //文件上传区域
  13929. $$("div", { "id": "U_MD_UI_UP_C", "className": "U_MD_UI_UP_C" }, _topel);
  13930. //底部
  13931. _bottom = $$("div", { "className": "U_MD_UI_UP_D" }, _topel);
  13932. _switchel = $$("div", { "className": "U_MD_UI_UP_DR" }, _bottom);
  13933. $$("div", { "className": "U_MD_UI_UP_DRO", "innerHTML": "点击上传" }, _switchel);
  13934. $$("div", { "className": "U_MD_UI_UP_DRO U_MD_UI_UP_DRT", "id": "U_MD_UI_UP_DRT" }, _switchel);
  13935. //弹出上传框
  13936. return new U.UF.UI.form("<div class='U_MD_F_S_TI'>上传</div>", _uploadel, {
  13937. "id": "U_MD_UI_UP_O",
  13938. "style": { "width": "700px", "height": "560px" }
  13939. }, { isnarrow: false, isenlarge: false }).form;
  13940. }
  13941. }
  13942. /**
  13943. * 获取上传文件所在的位置
  13944. * @param {string} 上传文件的id
  13945. * @return {array} 上传文件的位置及信息
  13946. * 0 找到上传文件的信息
  13947. * 1 上传文件在一个flashfiles的位置
  13948. * 2 上传文件在多个flashfiles中其中一个flashfiles的位置
  13949. */
  13950. U.MD.UI.getFileInfoById = function (fileid) {
  13951. var i, j,
  13952. _allfiles = U.MD.UI.upload.uploadFileInfo; //用户需要上传的所有文件
  13953. for (i = 0; i < _allfiles.length; i++) {
  13954. j = _allfiles[i].objIndexOf({ "fileid": fileid }); //根据fileid在_allfiles[i]数组的查找获取fileid = fileid的上传文件信息
  13955. //找到该上传文件
  13956. if (j > -1) {
  13957. /*
  13958. * 0 找到上传文件的信息
  13959. * 1 上传文件在一个flashfiles的位置
  13960. * 2 上传文件在多个flashfiles中其中一个flashfiles的位置
  13961. */
  13962. return [_allfiles[i][j], j, i];
  13963. }
  13964. }
  13965. return [null, -1, -1]; //返回未找到的信息
  13966. }
  13967. //#endregion
  13968. //#region html5- input上传
  13969. U.MD.UI.inputSelect = function () {
  13970. }
  13971. //#endregion
  13972. //#region html5 input上传处理
  13973. /**
  13974. * 生成上传的点击框
  13975. * @param event 当input内容改变时触发函数
  13976. */
  13977. U.MD.UI.inputSelect = function (callback) {
  13978. //获取input控件
  13979. var event = window.event || arguments.callee.caller.arguments[0];
  13980. var _fileinfo,
  13981. _fileinfos = [],
  13982. _files = event.target.files; //所有上传的文件
  13983. //遍历input的文件
  13984. for (var i = 0; i < _files.length; i++) {
  13985. _fileinfos.push(_files[i]); //加入待上传文件信息
  13986. }
  13987. U.MD.UI.upload.uploadFileInfo.push(_fileinfos); //添加上传的处理
  13988. U.MD.UI.printUploadFiles(_fileinfos); //生成前台UI
  13989. U.MD.UI.inputUpload(_fileinfos[0], callback); //调用上传
  13990. }
  13991. /*
  13992. 生成文件信息
  13993. * @param {file} file文件
  13994. */
  13995. //U.MD.UI.inputFileInfo = function (input) {
  13996. // var _return = {
  13997. // "creationDate": input.lastModifiedDate,
  13998. // "creator": null,
  13999. // "data": null,
  14000. // "modificationData": input.lastModifiedDate,
  14001. // "name": input.name,
  14002. // "size": input.size,
  14003. // "type": U.UF.UP.getFileNameAndExtension(input.name)[1]
  14004. // }
  14005. // return _return;
  14006. //}
  14007. /**
  14008. * input上传处理的全过程
  14009. * @param event 当input内容改变时触发函数
  14010. */
  14011. U.MD.UI.inputUpload = function (file, callback) {
  14012. file.isupload = true; //设置上传状态为true
  14013. //进行文件加密 回调参数(进度,完成,文件hash)
  14014. U.UF.UP.html5Upload.fileMd5(file, function (progress, finish, filehash) {
  14015. //发生错误的处理
  14016. if (!progress) {
  14017. //错误处理
  14018. if (U.UF.C.isFunction(callback.error)) {
  14019. callback.error(finish);
  14020. }
  14021. }
  14022. //判断是否解析完成
  14023. else if (finish) {
  14024. callback.progress({ "Loaded": 1, "Total": 1 }, file.fileid, ""); //生成进度条
  14025. //获取hash后的回调处理
  14026. if (U.UF.C.isFunction(callback.getHashCallBack)) {
  14027. callback.getHashCallBack(filehash, file, callback);
  14028. }
  14029. }
  14030. //未解析完毕进度条处理
  14031. else {
  14032. if (U.UF.C.isFunction(callback.progress)) {
  14033. callback.progress(progress, file.fileid, "解析中"); //生成进度条
  14034. }
  14035. }
  14036. });
  14037. }
  14038. //#endregion
  14039. //#region flash上传处理的过程
  14040. /**
  14041. * 上传框用户选择完文件的处理
  14042. * @param {array} 需要加载上传框的元素
  14043. */
  14044. U.MD.UI.flashSelect = function (uploadfiles, url, isgethash) {
  14045. U.MD.UI.printUploadFiles(uploadfiles, true); //打印上传的内容
  14046. U.MD.UI.upload.uploadFileInfo.push(uploadfiles); //添加上传的信息处理
  14047. U.MD.UI.flashUpload(uploadfiles[0], url, isgethash); //上传处理
  14048. }
  14049. /**
  14050. * 上传的处理,如果有处理hash的那么就调用hash的回调
  14051. * @param {array} 需要加载上传框的元素
  14052. */
  14053. U.MD.UI.flashUpload = function (uploadfile, url, isgethash) {
  14054. var _flashbottom = U.selectEl("*flashupload")[0], //上传按钮
  14055. _fileid = uploadfile.fileid //上传文件的唯一识别id
  14056. ;
  14057. uploadfile.isupload = true; //设置上传状态为true
  14058. //如果需要处理获取hash值的处理
  14059. if (isgethash) {
  14060. //上传前,先得到hash的值,进行判断是否文件已经存在
  14061. U.UF.UP.generateFileHash($("*flashupload")[0], _fileid); //获取hash
  14062. }
  14063. //文件直接上传的处理
  14064. else {
  14065. //直接执行文件的上传处理
  14066. U.UF.UP.flashUpload(_flashbottom, _fileid, url);
  14067. }
  14068. }
  14069. /**
  14070. * 文件单个上传完毕
  14071. * @param {string} 上传文件的唯一识别id
  14072. */
  14073. U.MD.UI.flashUploadComplete = function (fileid) {
  14074. // U.alert("传输完成,等待返回。");
  14075. }
  14076. /**
  14077. * 所有文件上传完的处理
  14078. */
  14079. U.UF.UP.deleteUploadAllFile = function () {
  14080. }
  14081. /**
  14082. * 清空上传框处理
  14083. */
  14084. U.MD.UI.flashEmptyUpload = function (el) {
  14085. var _flashbottom = U.selectEl("*flashupload")[0];
  14086. if (_flashbottom) {
  14087. U.UF.UP.deleteUploadAllFile(_flashbottom); //清理flash上传的资源
  14088. }
  14089. }
  14090. /**
  14091. * 获取上传文件所在的位置
  14092. * @param {object} 错误消息
  14093. * @return {array} 上传文件的位置及信息
  14094. * 0 上传文件在一个flashfiles的位置
  14095. * 1 上传文件在多个flashfiles中其中一个flashfiles的位置
  14096. * 2 找到上传文件的信息
  14097. */
  14098. U.MD.UI.flashError = function (errorinfo) {
  14099. if (errorinfo.message) { //有错误消息
  14100. var _meeage = "上传处理失败:" + errorinfo.message; //上传错误信息
  14101. if (UE.errorID == 1502) { //当错误编码是1502时候我们弹出用户可理解的错误
  14102. _meeage = "文件太大,电脑内存不足";
  14103. }
  14104. U.alert(_meeage); //弹出错误
  14105. U.UF.C.console(errorinfo); //控制台输出错误
  14106. }
  14107. }
  14108. //#endregion
  14109. //#region 统一处理
  14110. /**
  14111. * 打印上传的信息
  14112. * @param {array} 上传的文件数组
  14113. */
  14114. U.MD.UI.printUploadFiles = function (uploadfiles, isflash) {
  14115. var _type,
  14116. _info,
  14117. _uploaddiv,
  14118. _panel,
  14119. _panel_one,
  14120. _progressel,
  14121. _uploadcontent = U.selectEl("#U_MD_UI_UP_C"),
  14122. _frag = $$("frag");
  14123. //循环打印上传的文件信息
  14124. for (i = 0; i < uploadfiles.length; i++) {
  14125. uploadfiles[i].fileid = Guid.newGuid(); //设置上传文件的id
  14126. _type = U.UF.UP.getFileNameAndExtension(uploadfiles[i]["name"])[1]; //获取上传文件的后缀
  14127. //创建上传文件的信息
  14128. _uploaddiv = $$("div", { "className": "U_MD_UI_UP_CO" }, _frag);
  14129. _panel = $$("div", { "className": "U_MD_UI_UP_COO" }, _uploaddiv);
  14130. _panel_one = $$("div", { "className": "U_MD_UI_UP_COI U_Img ", "style": { "cssText": "background-position:-12px 1px"} }, _panel);
  14131. $$("div", { "className": "U_MD_UI_UP_COION", "innerHTML": _type }, _panel_one);
  14132. _panel_one = $$("div", { "className": "U_MD_UI_UP_COT" }, _panel);
  14133. $$("div", { "className": "U_MD_UI_UP_COTS U_MD_D_Text_Abbreviation", "innerHTML": uploadfiles[i].name }, _panel_one);
  14134. $$("div", { "className": "U_MD_UI_UP_COTX", "innerHTML": "容量大小:" + U.UF.UP.minUnitToMaxUnit(uploadfiles[i]["size"]) }, _panel);
  14135. _panel_one = $$("div", { "className": "U_MD_UI_UP_COS U_MD_D_Text_Abbreviation" }, _panel);
  14136. $$("div", { "className": "U_MD_UI_UP_COSN", "innerHTML": "准备上传" }, _panel_one);
  14137. $$("div", { "className": "U_MD_UI_UP_COSI U_Img" }, _panel_one);
  14138. _panel_one = $$("div", { "className": "U_MD_UI_UP_COC U_MD_UI_UP_COX", "title": "等待响应..." }, _panel_one);
  14139. $$("img", { "onerror": U.MD.C.imgError, "src": US.DOMAIN + "img/ULG.gif" }, _panel_one);
  14140. $$("div", { "className": "U_MD_UI_UP_COX", "titlle": "点击撤销删除上传", "innerHTML": "撤销",
  14141. "onclick": function () {
  14142. U.MD.UI.delUploadFile(_uploaddiv, uploadfiles[0], isflash); // 移除当前上传元素,排队向下上传处理
  14143. }
  14144. }, _panel);
  14145. _progressel = $$("div", { "className": "U_MD_UI_UP_COU" }, _uploaddiv);
  14146. uploadfiles[i].fileel = _uploaddiv; //记录上传元素的框
  14147. uploadfiles[i].progressel = _progressel; //进度条元素
  14148. }
  14149. //添加上传的文件信息在中间上传区域
  14150. _uploadcontent.append(_frag);
  14151. }
  14152. /**
  14153. * 移除当前上传元素,排队向下上传处理
  14154. * @param {element} 需要移除的元素
  14155. * @param {object} 上传文件的信息
  14156. */
  14157. U.MD.UI.delUploadFile = function (uploadel, uploadfile, isflash) {
  14158. var i, j,
  14159. _allfiles = U.MD.UI.upload.uploadFileInfo,
  14160. _fileinfo = U.MD.UI.getFileInfoById(uploadfile.fileid), //根据文件的id获取在U.MD.UI.FTF["FL"]中的位置及在U.MD.UI.FTF["FL"][i]中的位置
  14161. _allfilesnum = _fileinfo[2], //文件在U.MD.UI.FTF["FL"]中的位置
  14162. _filesnum = _fileinfo[1]; //文件在U.MD.UI.FTF["FL"][i]中的位置
  14163. U.selectEl(uploadel).remove(); //上传成功后删除上传的元素
  14164. if (_filesnum != -1) { //实体存在
  14165. //移除一个上传文件
  14166. _allfiles[_allfilesnum].splice(_filesnum, 1)[0];
  14167. //如果在移除的文件是该多个flash上传中的其中一个的最后一个上传,那么直接删除上传数组
  14168. if (!_allfiles[_allfilesnum].length) {
  14169. _allfiles.splice(_allfilesnum, 1);
  14170. }
  14171. //flash清楚上传处理
  14172. if (isflash) {
  14173. U.UF.UP.deleteUploadFile($("*flashupload")[0], _filesnum, _allfilesnum); //flash中删除上传。
  14174. }
  14175. //html5清除上传处理
  14176. else {
  14177. U.UF.UP.html5Upload.deleteUploadFile(uploadfile);
  14178. }
  14179. //判断上传文件的上传状态,如果是正在上传的文件删除,那么需要向下执行上传文件
  14180. if (uploadfile.isupload) {
  14181. //如果还有文件需要上传
  14182. if (_allfiles.length) {
  14183. //利用排队的方式执行文件上传
  14184. for (i = 0; i < _allfiles.length; i++) { //从所有的上传文件数组里排队
  14185. for (j = 0; j < _allfiles[i].length; j++) { //在fileslist中排队筛选
  14186. if (!_allfiles[i][j].isupload) { //如果该文件的状态没有在上传中,那么就直接上传
  14187. return _allfiles[i][j];
  14188. }
  14189. }
  14190. }
  14191. }
  14192. else {
  14193. //flash清理上传处理
  14194. if (isflash) {
  14195. U.MD.UI.flashEmptyUpload(); //清空上传框
  14196. }
  14197. else {
  14198. U.UF.UP.html5Upload.deleteUploadAllFile();
  14199. }
  14200. }
  14201. }
  14202. }
  14203. }
  14204. /**
  14205. * 上传文件进度条处理
  14206. * @param {object} 进度条的值 Loaded 现在的进度 Total 中进度
  14207. * @param {object} 上传文件的唯一识别id
  14208. * @param {object} 用md5去判断上传的文件是否需要上传
  14209. */
  14210. U.MD.UI.progress = function (progress, fileid, msg) {
  14211. var _fileinfo = U.MD.UI.getFileInfoById(fileid)[0], //根据上传文件唯一识别的id获取上传文件的信息
  14212. _progresschilds = U.selectEl($(_fileinfo.fileel).childs(0).childs(0)[3]).Child(), //获取上传文件进度条元素
  14213. _progress = Math.floor((progress.Loaded / progress.Total) * 100); //获取进度的百分比
  14214. _fileinfo.progressel.style.width = _progress + "%"; //上传的进度样式
  14215. _progresschilds[0].innerText = msg; //上传信息提醒,包括准备上传、正在解析、上传中
  14216. _progresschilds[1].style.display = "none"; //上传成功后的
  14217. _progresschilds[2].style.display = "block"; //loading
  14218. }
  14219. /**
  14220. * 接续上传的处理
  14221. * @param {string} 上传文件的唯一识别id
  14222. */
  14223. U.MD.UI.flashContinueUpload = function (fileid, url, isgethash) {
  14224. var _fileinfo = U.MD.UI.getFileInfoById(fileid)[0], //获取上传完的文件
  14225. _nextuploadfile = U.MD.UI.delUploadFile(_fileinfo.fileel, _fileinfo, true); //删除上传成功后的文件,得到下一个需要上传的文件
  14226. // 如果有下一个文件要上传的处理
  14227. if (_nextuploadfile) {
  14228. U.MD.UI.flashUpload(_nextuploadfile, url, isgethash); //调用上传,如果有hash的获取这里支持自动获取hash
  14229. }
  14230. }
  14231. //#endregion;
  14232. ///<jscompress sourcefile="Url.js" />
  14233. /*用户使用www.1473.cn时,我们需要设置成: /#!/word/guid
  14234. 用于推广运营时的链接如下:
  14235. 电脑端
  14236. word可编辑模式跳转 /word/guid。。
  14237. word不可编辑模式 http://guid.1473.cn 或者短域名访问 http://123.1473.cn
  14238. file的访问模式 /disk/guid
  14239. 手机端
  14240. word可编辑模式跳转: http://m.1473.cn/word/guid
  14241. */
  14242. Namespace.register("U.MD.N"); //Url执行区域
  14243. /**
  14244. * url指引函数
  14245. * 此函数需要修改。。参数urlinfo的类型需要固定。
  14246. */
  14247. U.MD.N.urlGuide = function () {
  14248. var _hash = U.UF.C.getUrlHash(), //获取传参
  14249. _type; //类型
  14250. //如果链接类型是 /#!/disk/13928417148/f6d7a4b6-e34c-4964-beed-24187b2cb1ba 的处理
  14251. if (_hash[0] == "#!") {
  14252. _hash.shift()
  14253. }
  14254. //链接类型是 /#disk/13928417148/f6d7a4b6-e34c-4964-beed-24187b2cb1ba 的处理
  14255. else {
  14256. _hash[0] = _hash[0].substr(1);
  14257. }
  14258. _type = _hash[0];
  14259. switch (_type) {
  14260. case "disk":
  14261. //打开网盘的处理
  14262. U.MD.D.I.openApplication(_type, { "userid": _hash[1], "directoryid": _hash[2] });
  14263. break;
  14264. case "file":
  14265. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", _hash[1]]), function (r) {
  14266. var _fileinfo = r.value[0];
  14267. _fileinfo = new U.MD.DK.M.entity(_fileinfo.UserFilesID, _fileinfo.UserFilesSize, _fileinfo.UserDirectoryID, _fileinfo.UserFilesName, _fileinfo.UserFilesName, //创建US.disk.Disks里面的内容的数据结构
  14268. _fileinfo.UserFilesExtendName, _fileinfo.UserFilesServerName, _fileinfo.UserFilesAddTime, null, 999, _fileinfo.UserFilesModifyTime, _fileinfo.UserDirectoryEncrypt,
  14269. 1, _fileinfo.UserFilesExtendName, _fileinfo.GroupID, _fileinfo.UsOffice, _fileinfo.UserID, US.userInfo.UserNikeName, _fileinfo.UserName, _fileinfo.UserThumbnailImageHead);
  14270. U.MD.DK.LE.openFileDirectory(_fileinfo);
  14271. });
  14272. break;
  14273. case "excel":
  14274. if (_hash[1] == 'join') { //如果地址栏有join进入加群流程
  14275. U.MD.N.joinGuide(_hash, _type);
  14276. }
  14277. else if (_hash[1].length == 36) { //正常调用
  14278. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", _hash[1]]), function (r) {
  14279. if (r.value[0]) {
  14280. //拼接word
  14281. var _fileinfo = {
  14282. UserDirectoryExtendType: r.value[0].UserFilesExtendName,
  14283. UsOffice: r.value[0].UsOffice ? r.value[0].UsOffice.unEscapeQuotes() : null,
  14284. UserId: r.value[0].UserID,
  14285. UserallDirectoryName: r.value[0].UserFilesName,
  14286. UserDirectoryID: r.value[0].UserFilesID,
  14287. GroupID: r.value[0].UserDirectoryEncrypt
  14288. };
  14289. //获取word内容
  14290. if (r.value && r.value.UsOffice !== undefined && r.value.UsOffice != null) {
  14291. U.MD.D.I.openApplication(_type, _fileinfo);
  14292. }
  14293. }
  14294. });
  14295. }
  14296. break
  14297. case "word":
  14298. if (_hash[1] == 'join') { //如果地址栏有join进入加群流程
  14299. U.MD.N.joinGuide(_hash, _type);
  14300. }
  14301. else if (_hash[1].length == 36) { //正常调用
  14302. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", _hash[1]]), function (r) {
  14303. if (r.value[0]) {
  14304. r = r.value[0];
  14305. //拼接word
  14306. var _fileinfo = {
  14307. UserFilesServerName: r.UserFilesServerName,
  14308. UserDirectoryExtendType: r.UserFilesExtendName,
  14309. UsOffice: r.UsOffice ? r.UsOffice.unEscapeQuotes() : null,
  14310. UserId: r.UserID,
  14311. UserallDirectoryName: r.UserFilesName,
  14312. UserDirectoryID: r.UserFilesID,
  14313. GroupID: r.UserDirectoryEncrypt
  14314. };
  14315. //获取word内容
  14316. if (r && r.UsOffice !== undefined && r.UsOffice != null) {
  14317. U.MD.D.I.openApplication(_type, _fileinfo);
  14318. }
  14319. //如果内容不存在则去office系统中获取
  14320. else {
  14321. U.A.Request("http://office.1473.cn/Officetohtml.ashx", ["Open", _fileinfo.UserDirectoryExtendType, _fileinfo.UserFilesServerName], function (r) {
  14322. if (r.value.value != undefined) {
  14323. r = r.value;
  14324. _fileinfo.UsOffice = r.value.getBodyHtml().replace(/src=[\'\"]?([^\'\"]*)[\'\"]?/ig, function (str1, str2) {
  14325. return "src=\"http://office.1473.cn/usoffice/" + str2 + "\"";
  14326. });
  14327. U.MD.D.I.openApplication(_type, _fileinfo);
  14328. } else {
  14329. U.Alert('文档已丢失。。。');
  14330. }
  14331. });
  14332. }
  14333. }
  14334. });
  14335. }
  14336. break;
  14337. case "boomYun": case "txt": case "friend": case "lookupfriend": case "set": case "systemset":
  14338. U.MD.D.I.openApplication(_type, { "directoryid": _hash[1] });
  14339. if (_hash[1] == "template") {
  14340. //打开模板函数
  14341. if (_hash[2] != "undefined") {
  14342. U.Boom.I.GetHomeTemp.particulars(_hash[2]);
  14343. U.MD.N.urlWrite("boomYun/template/" + _hash[2], "互联办公"); //boomyun的url重写
  14344. }
  14345. }
  14346. break;
  14347. default: break;
  14348. }
  14349. }
  14350. /**
  14351. * 分享邀请链接加入群组
  14352. * @param {hash} hash值
  14353. * @param {type} 文件类型
  14354. */
  14355. U.MD.N.joinGuide = function (hash, type) {
  14356. var _fileId = hash[2]; //获取文件id
  14357. U.MD.U.L.setLoginCallBack(function () { //当用户登录后
  14358. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", _fileId]), function (r) { //获取文档对的信息
  14359. var _docinfo = r.value[0]; //文档信息
  14360. if (!_docinfo) { //是否有文档信息
  14361. return U.Alert('添加协同链接有误,请联系群主获取最新协同链接。。。');
  14362. }
  14363. if (US.friend.group) { //判断是否有群
  14364. var _groupId = _docinfo.UserDirectoryEncrypt || _docinfo.UserDirectoryID, //获取群id
  14365. _groupinfo = U.Json.select(US.friend.group, { "GroupManageID": _groupId })[0], //判断用户是否加入了群
  14366. _docId = _docinfo.UserFilesID; //文档ID
  14367. if (!_groupinfo) { //如果没有加群
  14368. U.A.Request(US.CD, ([US.DB, "UseStudio_Friends", "GetGroupInfo", _groupId]), function (r) { //取数据库获取群的信息
  14369. U.MD.F.J.selectUserInfo.NeedUser = [US.userInfo]; //得到个人信息名并赋值NeeUser全局
  14370. US.friend.group.push(r.value[0]); //添加到用户的群
  14371. top.U.MD.F.J.determineCreateGroupAndAddGroupUser(r.value[0].GroupManageID, null, null, false, "", "", function (groupid, groupdata) { //添加群
  14372. U.Json.del(groupdata[0], { UserId: US.userInfo.UserId });
  14373. US.friend.groupusers.push.apply(US.friend.groupusers, groupdata[0]);
  14374. // US.disk.Disks[US.userInfo.UserId].directoryOrFiles.push.apply(US.disk.Disks[US.userInfo.UserId].directoryOrFiles, _groupuserinfo);
  14375. 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); }); //打开应用
  14376. });
  14377. }); //获取群资料
  14378. } else { //加入了群
  14379. var _docdiskinfo = new U.MD.DK.M.entity(_docinfo.UserFilesID, _docinfo.UserFilesSize, _docinfo.UserDirectoryID, _docinfo.UserFilesName, _docinfo.UserFilesName, //创建US.disk.Disks里面的内容的数据结构
  14380. _docinfo.UserFilesExtendName, _docinfo.UserFilesServerName, _docinfo.UserFilesAddTime, null, 999, _docinfo.UserFilesModifyTime, _docinfo.UserDirectoryEncrypt,
  14381. 0, _docinfo.UserFilesExtendName, _groupId, _docinfo.UsOffice, _docinfo.UserID, US.userInfo.UserNikeName, _docinfo.UserName, _docinfo.UserThumbnailImageHead);
  14382. U.Alert("你已经在该文档的群里了!");
  14383. U.MD.D.I.openApplication(type, _docdiskinfo); //打开应用
  14384. }
  14385. }
  14386. })
  14387. });
  14388. }
  14389. //添加页面导航
  14390. /*
  14391. * @param {string} hash值
  14392. * @param {string} document.title变化
  14393. */
  14394. U.MD.N.urlWrite = function (hash, title) {
  14395. setTimeout(function () {
  14396. U.UF.N.addHash(hash); //添加hash的处理
  14397. document.title = title; //title的处理
  14398. }, 0);
  14399. }
  14400. //seo模块.现有访问网址。/
  14401. //论坛
  14402. // 目录: /#!/pb/afa8621d-de5a-44db-8338-7d36168e7446
  14403. // 文章:外网:/#!/pbt/e80c57a0-1c82-4f43-931d-b7c8fab982a8
  14404. //硬盘
  14405. // 目录: /#!/disk/13928417148/f6d7a4b6-e34c-4964-beed-24187b2cb1ba
  14406. // txt文件:/#!/txt/63e6b0c9-aa72-1ef5-a9c0-a9d19b2b4c39
  14407. // word文件:/#!/word/efb4be75-696b-27fe-f125-25eff5d2716f
  14408. // img文件:/#!/img/efb4be75-696b-27fe-f125-25eff5d2716f
  14409. //现有word直接查看形式。
  14410. //http://disk.1473.cn/efb4be75-696b-27fe-f125-25eff5d2716f/Word
  14411. //http://disk.1473.cn/efb4be75-696b-27fe-f125-25eff5d2716f/Txt
  14412. //http://disk.1473.cn/efb4be75-696b-27fe-f125-25eff5d2716f/Excel
  14413. //从这些网址派生短链接。
  14414. //10001.1473.cn
  14415. //网盘文件直接打开查看
  14416. ///#!/file/38807b15-e721-4820-88b2-5f88da69813b;
  14417. ///<jscompress sourcefile="NetworkPromotion.js" />
  14418. Namespace.register("U.MD.U.NP");
  14419. 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"]} }
  14420. U.MD.U.NP.TF; //
  14421. //---------------------------------------------------------------------------用户数据加载----------------------------------------------------------------------------
  14422. //-------------------------------------------------------加载数据
  14423. U.MD.U.NP.DTG = function () {
  14424. var _UDPD = U.selectEl("#U_MD_U_NP")[0]; //推广框
  14425. U.UF.F.windowTopCenter(_UDPD); //居中
  14426. // U.MD.D.T.WindowRestore(_UDPD, null, "推广"); //创建任务栏链接
  14427. }
  14428. //-----------------------------------------------------推广介绍
  14429. U.MD.U.NP.DTGOD = function (TGID) {
  14430. var _UDTD = U.selectEl("#U_MD_U_NP_XW")[0],
  14431. _UDAD = U.selectEl("div", _UDTD),
  14432. _UGN = U.MD.U.NP.GN[TGID]["TT"];
  14433. for (var i = 0; i < _UGN.length; i++) {
  14434. if (i == 1) {
  14435. continue;
  14436. }
  14437. if (i > 0 && i < _UGN.length - 1) {
  14438. _UDAD[i].innerHTML = _UGN[i];
  14439. }
  14440. else {
  14441. _UDAD[i].className = _UGN[i] + " U_MD_U_NP_I";
  14442. }
  14443. }
  14444. _UDAD[_UDAD.length - 2].onclick = function () {
  14445. U.MD.U.NP.GTGURL(TGID);
  14446. }; //点击获取推广地址
  14447. }
  14448. //-----------------------------------------------------------------------------有效点击
  14449. //加载该用户已有的推广数据
  14450. U.MD.U.NP.NTG = function (T) {
  14451. if (!U.MD.U.L.isLogin()) {
  14452. if (US.userInfo.TGD && US.userInfo.TGD["NTG"] && T == null) {
  14453. U.MD.U.NP.PLTG(US.userInfo.TGD["NTG"]);
  14454. U.MD.U.NP.LTTG(US.userInfo.TGD["YXT"]);
  14455. U.selectEl("#U_MD_U_NP_DPI")[0].innerText = "";
  14456. U.MD.U.NP.GTGFW(0);
  14457. }
  14458. else {
  14459. U.A.Request("UseStudioPay.GetUserAllTG", [US.userInfo.UserId], U.MD.U.NP.AsynNTG, [$("#U_MD_U_NP_A")[0]]);
  14460. // U.selectEl("#U_MD_U_NP_A")[0].onscroll = U.UF.EV.scrollLoad({ 'AF': U.MD.U.NP.GFWTG }).SCH();
  14461. U.UF.EV.scrollLoad($("#U_MD_U_NP_A")[0], function () {
  14462. U.MD.U.NP.GFWTG
  14463. });
  14464. } //异步获取
  14465. }
  14466. }
  14467. //异步获取推广数据
  14468. U.MD.U.NP.AsynNTG = function (r) {
  14469. var _context = r.context;
  14470. r = r.value;
  14471. if (US.userInfo.TGD == null) { US.userInfo.TGD = {} };
  14472. US.userInfo.TGD["NTG"] = r[0];
  14473. US.userInfo.TGD["YXT"] = U.MD.U.NP.DT(r[1]); //区分有效统计和注册
  14474. US.userInfo.TGD["YXD"] = [r[2]];
  14475. U.MD.U.NP.NTG();
  14476. }
  14477. //区分有效统计 点击和注册
  14478. U.MD.U.NP.DT = function (UTL) {
  14479. var i, j, _TF = [];
  14480. for (i = 0; i < UTL.length; i++) {
  14481. _TF[i] = []; _TF[i].push(UTL[i]);
  14482. for (j = i + 1; j < UTL.length; j++) {
  14483. if (UTL[j]["TGUserInfoID"] == UTL[i]["TGUserInfoID"]) {
  14484. _TF[i].push(UTL[j]); UTL.splice(j, 1);
  14485. }
  14486. }
  14487. }
  14488. return _TF;
  14489. }
  14490. //用户已有的推广数据
  14491. U.MD.U.NP.PLTG = function (UTL) {
  14492. var i, j, k,
  14493. _UDPD = U.selectEl("#U_MD_U_NP_DTD")[0],
  14494. _el, _UDTD, _UDI,
  14495. _UDFD = $$("frag"),
  14496. _UAFD = [],
  14497. _UAT = ["disk", "photo", "music", "video", "blog"];
  14498. _UDPD.innerText = "";
  14499. if (UTL.length > 0) {
  14500. U.selectEl("#U_MD_U_NP_DUN")[0].innerHTML = US.userInfo.TrueName || US.userInfo.UserNickName; //用户推广名
  14501. for (i = 0; i < UTL.length; i++) {
  14502. _UAFD.push(UTL[i]["TY"] + UTL[i]["TGUserInfoID"]); //基础推广地址
  14503. if (UTL[i]["TGID"] == "fd01dd1b-9c87-4e4f-a3fb-af1b91bf56f8") {
  14504. for (j = 0; j < _UAT.length; j++) {
  14505. _UAFD.push(US.DOMAIN + "#!/" + _UAT[j] + "/" + US.userInfo.UserName);
  14506. }
  14507. }
  14508. _el = $$("div", { "className": "U_MD_U_NP_DTDD" }, _UDFD);
  14509. $$("div", { "className": "U_MD_U_NP_DTDDN", "innerHTML": U.MD.U.NP.GN[UTL[i]["TGID"]]["TT"][2] + ':' }, _el);
  14510. for (k = 0; k < _UAFD.length; k++) {
  14511. _UDTD = $$("div", { "className": "U_MD_U_NP_DTDDA" }, _el);
  14512. _UDI = $$("input",
  14513. {
  14514. "className": "U_MD_U_NP_DTDDS",
  14515. "readOnly": "true",
  14516. "value": _UAFD[k],
  14517. "oncopy": function () {
  14518. U.UF.EV.stopBubble();
  14519. U.UF.C.copy("retElement.value");
  14520. }
  14521. }, _UDTD);
  14522. $$("div",
  14523. {
  14524. "innerHTML": "复制",
  14525. "className": "U_MD_U_NP_DTDDF",
  14526. "style":
  14527. {
  14528. "cssText": "float:right"
  14529. },
  14530. "onclick": function () {
  14531. U.UF.EV.stopBubble();
  14532. U.UF.C.copy(_UDI.value);
  14533. }
  14534. }, _UDTD); //复制按钮
  14535. }
  14536. _UAFD.splice(0, _UAFD.length);
  14537. }
  14538. _UDPD.appendChild(_UDFD);
  14539. }
  14540. else { _UDPD.innerText = "没有推广分类文类"; }
  14541. }
  14542. //打印有效统计
  14543. U.MD.U.NP.LTTG = function (UTL) {
  14544. var _UDPD = U.selectEl("#U_MD_U_NP_DWP")[0],
  14545. _el, _UDTD, _UDSD,
  14546. _UDFD = $$("frag");
  14547. _UDPD.innerText = "";
  14548. for (var i = 0; i < UTL.length; i++) {
  14549. _el = $$("div", { "className": "U_MD_U_NP_DWP" }, _UDFD);
  14550. _UDTD = $$("div", { "className": "U_MD_U_NP_DWY" }, _el);
  14551. $$("div", { "className": "U_MD_U_NP_DWYN", "innerHTML": U.MD.U.NP.GN[UTL[i][0]["TGID"]]["TT"][2] + "点击次数" }, _UDTD);
  14552. $$("div", { "className": "U_MD_U_NP_DWYS", "innerHTML": UTL[i][0]["C"] }, _UDTD);
  14553. _UDSD = $$("div", { "className": "U_MD_U_NP_DWY" }, _el);
  14554. $$("div", { "className": "U_MD_U_NP_DWYN", "innerHTML": U.MD.U.NP.GN[UTL[i][0]["TGID"]]["TT"][2] + "成功注册" }, _UDSD);
  14555. $$("div", { "className": "U_MD_U_NP_DWYS", "innerHTML": UTL[i][1] ? UTL[i][1]["C"] : "0" }, _UDSD);
  14556. }
  14557. _UDPD.appendChild(_UDFD);
  14558. }
  14559. //---------------------------------------------------------------------有效地址
  14560. //滚动加载访问地址
  14561. U.MD.U.NP.GFWTG = function () {
  14562. if (U.MD.U.NP.GTGFW.call(this, (this.P + 1)).length == 0) {
  14563. this.P -= 1;
  14564. this.TF = false;
  14565. return false;
  14566. }
  14567. }
  14568. //获取打印有效数据
  14569. U.MD.U.NP.GTGFW = function (P) {
  14570. var _UTL = U.MD.U.NP.GYXFW(P);
  14571. if (_UTL) { U.MD.U.NP.FWTG(_UTL); }
  14572. else {
  14573. var _FP = Math.floor(P / 5);
  14574. U.A.Request("UseStudioPay.GetTGYXSL", [US.userInfo.UserId, _FP * 50, (_FP + 1) * 50 - 1], U.MD.U.NP.AsynGTGFW, ["", P, this]);
  14575. return [];
  14576. }
  14577. return _UTL;
  14578. }
  14579. //异步获取
  14580. U.MD.U.NP.AsynGTGFW = function (r) {
  14581. var _context = r.context;
  14582. r = r.value;
  14583. US.userInfo.TGD["YXD"].push(r);
  14584. U.MD.U.NP.GTGFW(_context[1]);
  14585. _context[2].TF = true;
  14586. }
  14587. //获取有效数据
  14588. U.MD.U.NP.GYXFW = function (P) {
  14589. if (US.userInfo.TGD) {
  14590. var _UTGP = US.userInfo.TGD["YXD"],
  14591. TP = Math.floor(P / 5), FP = (P - TP * 5);
  14592. if (_UTGP[TP]) {
  14593. return _UTGP[TP].slice(FP * 10, (FP + 1) * 10);
  14594. }
  14595. }
  14596. }
  14597. //访问地址打印
  14598. U.MD.U.NP.FWTG = function (UTL) {
  14599. if (UTL.length > 0) {
  14600. var _UDPD = U.selectEl("#U_MD_U_NP_DPI")[0],
  14601. _el,
  14602. _UTD,
  14603. _UDFD = $$("frag");
  14604. for (var i = 0; i < UTL.length; i++) {
  14605. eval("0,_UTD =" + UTL[i]["TGAdress"]);
  14606. _el = $$("div", { "className": "U_MD_U_NP_DPH U_MD_U_NP_DPIF", "style": { "backgroundColor": "White"} }, _UDPD);
  14607. $$("div", { "className": "U_MD_D_Text_Abbreviation", "style": { "marginLeft": "0px" }, "innerHTML": UTL[i]["UserIp"] }, _el);
  14608. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": _UTD["province"] + " " + _UTD["city"] }, _el);
  14609. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": U.UF.D.getYearMonthDay(UTL[i]["Time"], "String") }, _el);
  14610. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": U.MD.U.NP.GN[UTL[i]["TGID"]]["TT"][2] }, _el);
  14611. $$("div", { "className": "U_MD_D_Text_Abbreviation", "innerHTML": UTL[i]["IsRegistration"] ? "成功" : "失败", "style": { "color": UTL[i]["IsRegistration"] ? "Red" : ""} }, _el);
  14612. }
  14613. _UDPD.appendChild(_UDFD);
  14614. }
  14615. }
  14616. //-----------------------------------------------------------------排名
  14617. //获取排名
  14618. U.MD.U.NP.GPMTG = function (TF) {
  14619. if (US.userInfo.TGD && US.userInfo.TGD["TGP"] && TF == null) {
  14620. U.MD.U.NP.PMTG(US.userInfo.TGD["TGP"]);
  14621. }
  14622. else {
  14623. U.A.Request("UseStudioPay.GetTGPM", [], U.MD.U.NP.AsynGPMTG, [$("#U_MD_U_NP_A")[0]]);
  14624. }
  14625. }
  14626. //异步获取排名
  14627. U.MD.U.NP.AsynGPMTG = function (r) {
  14628. r = r.value;
  14629. if (US.userInfo.TGD == null) { US.userInfo.TGD = {} };
  14630. US.userInfo.TGD["TGP"] = r;
  14631. U.MD.U.NP.GPMTG(); //打印排名
  14632. }
  14633. //打印用户排名
  14634. U.MD.U.NP.PMTG = function (UTL) {
  14635. var _UDPD = U.selectEl("#U_MD_U_NP_PG")[0],
  14636. _el, _UDTD,
  14637. _UDFD = $$("frag");
  14638. _UDPD.innerText = "";
  14639. for (var i = 0; i < UTL.length; i++) {
  14640. _el = $$("div", { "className": "U_MD_U_NP_PH" + (i < 3 ? "" : " U_MD_U_NP_PHV") }, _UDFD);
  14641. $$("div", { "className": "U_MD_U_NP_PHM", "innerHTML": (i + 1 < 10 ? "0" : "") + (i + 1) + ".", "style": { "color": i == 0 ? "#e06767" : ""} }, _el);
  14642. _UDTD = $$("div", { "className": (i < 3 ? "U_MD_U_NP_PHH" : "U_MD_U_NP_PHHM") }, _el);
  14643. $$("img",
  14644. {
  14645. "className": (i < 3 ? "U_MD_U_NP_PHHI" : "U_MD_U_NP_PHHIO"),
  14646. "alt": UTL[i]["TrueName"] || UTL[i]["UserName"],
  14647. "src": U.MD.C.getHeadImage(UTL[i].UserThumbnailImageHead),
  14648. "onclick": [U.MD.U.V.POUW, [UTL[i]["UserID"]]]
  14649. }, _UDTD);
  14650. $$("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);
  14651. $$("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);
  14652. }
  14653. _UDPD.appendChild(_UDFD);
  14654. }
  14655. //----------------------------------------------------------------------辅助功能
  14656. //添加用户访问地址
  14657. //例子:2013年的推广,暂时没有使用
  14658. U.MD.U.NP.AddUr = function (TGID) {
  14659. U.A.Request("UseStudioPay.SetYXTG", [TGID, U.UF.C.jsonToStr(US.city)], U.MD.U.NP.AsynAddUr, [""]);
  14660. }
  14661. //通过用户id添加用户访问地址
  14662. //例:
  14663. U.MD.U.NP.AddUrID = function (userid) {
  14664. U.A.Request("UseStudioPay.SetYXTGBYUID", [userid, U.UF.C.jsonToStr(US.city)], U.MD.U.NP.AsynAddUr, [""]);
  14665. }
  14666. //获取用户访问地址
  14667. U.MD.U.NP.AsynAddUr = function (r) {
  14668. r = r.value;
  14669. U.MD.U.NP.TF = r;
  14670. U.MD.U.NP.TGR(); //发送注册信息
  14671. }
  14672. //添加推广地址
  14673. U.MD.U.NP.GTGURL = function (TGID) {
  14674. if (!U.MD.U.L.isLogin()) {//必须登录获取用户信息
  14675. if (US.userInfo.TGD && US.userInfo.TGD["NTG"] && U.MD.U.NP.GISTGURL(TGID)) {
  14676. U.MD.U.NP.STG(1, U.selectEl("#U_MD_U_NP_A")[0]);
  14677. return false;
  14678. } //查看地址
  14679. U.alert("正在获取中..."); //提示用户等待
  14680. U.A.Request("UseStudioPay.SetUserTG", [US.userInfo.UserId, TGID], U.MD.U.NP.AsynGTGURL, ["", TGID]); //添加用户注册信息
  14681. }
  14682. }
  14683. //异步添加推广地址
  14684. U.MD.U.NP.AsynGTGURL = function (r) {
  14685. _context = r.context;
  14686. r = r.value
  14687. if (r) {
  14688. if (US.userInfo.TGD && US.userInfo.TGD["NTG"]) {
  14689. r = r.toLocaleLowerCase();
  14690. var _ET = new U.MD.U.NP.TGE[_context[1], r, U.MD.U.NP.GN[_context[1]]["Url"]];
  14691. };
  14692. US.userInfo.TGD["NTG"].push(_ET);
  14693. }
  14694. U.MD.U.NP.STG(1, U.selectEl("#U_MD_U_NP_A")[0]); //查看地址
  14695. }
  14696. //获取推广地址是否存在
  14697. U.MD.U.NP.GISTGURL = function (TGID) {
  14698. var _UNTG = US.userInfo.TGD["NTG"];
  14699. for (var i = 0; i < _UNTG.length; i++) {
  14700. if (_UNTG[i]["TGID"] == TGID) {
  14701. return _UNTG[i];
  14702. }
  14703. }
  14704. return false;
  14705. }
  14706. //成功注册,添加推广信息,
  14707. U.MD.U.NP.TGR = function () {
  14708. if (U.MD.U.NP.TF && US.userInfo.UserId) {//添加用户注册信息
  14709. U.A.Request("UseStudioPay.UpAddR", [U.MD.U.NP.TF], function () { }, []);
  14710. U.MD.U.NP.TF = false; //取消重复
  14711. }
  14712. }
  14713. //推广切换
  14714. U.MD.U.NP.STG = function (TF, UTFD) {
  14715. TF = TF + 1; //显示的div
  14716. var _UTAD = U.UF.EL.getChildrenNoText(UTFD.childNodes); //获取所有的子元素
  14717. for (var i = 1; i < _UTAD.length; i++) {
  14718. if (TF == 2 && US.userInfo.UserId == null) {
  14719. break;
  14720. };
  14721. if (TF == i) {
  14722. _UTAD[i].style.display = "block";
  14723. }
  14724. else {
  14725. _UTAD[i].style.display = "none";
  14726. }
  14727. }
  14728. if (TF == 3) {
  14729. U.MD.U.NP.GPMTG();
  14730. } //查看排名
  14731. else if (TF > 1) {
  14732. if (!U.MD.U.L.isLogin()) {
  14733. U.MD.U.NP.NTG();
  14734. }
  14735. } //用户推广资料
  14736. }
  14737. //-------------------------------------------------------------------辅助函数--------------------------------------------------------------
  14738. //用户推广的实体
  14739. U.MD.U.NP.TGE = function (E) {
  14740. this.TGID = E[0];
  14741. this.TGUserInfoID = E[1];
  14742. this.TY = E[2];
  14743. }
  14744. ;