app.js 188 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915
  1. window.$Request = {
  2. post: function (url, data, response, type) {
  3. NProgress.start();
  4. $Request.httpRequest({
  5. url: url,
  6. data: data ? data : {},
  7. type: type ? type : 'POST',
  8. headers: {
  9. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  10. 'X-CSRF-TOKEN': ($('meta[name="csrf-token"]').attr('content') ? $('meta[name="csrf-token"]').attr('content') : $(window.parent.document).find('meta[name="csrf-token"]').attr('content'))
  11. },
  12. response: function (res, status, header) {
  13. // console.log(status);
  14. /*错误码 400*/
  15. if (status > 399 && status < 500) {
  16. NProgress.done();
  17. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  18. // window.location = '/404?msg=页面未找到';
  19. return false;
  20. }
  21. /*错误码 500*/
  22. else if (status >= 500) {
  23. NProgress.done();
  24. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  25. return false;
  26. } else {
  27. if (!res) {
  28. NProgress.done();
  29. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  30. return false;
  31. }
  32. NProgress.done();
  33. response(res);
  34. }
  35. }
  36. })
  37. },
  38. postJson: function (url, data, response, type) {
  39. var platform = $('meta[name="framework-platform"]').attr('content');
  40. NProgress.start();
  41. $Request.httpJsonRequest({
  42. url: url,
  43. data: data ? data : {},
  44. type: type ? type : 'POST',
  45. headers: {
  46. 'Request-Source' :platform,
  47. 'Content-Type': 'application/json; charset=UTF-8',
  48. 'X-CSRF-TOKEN': ($('meta[name="csrf-token"]').attr('content') ? $('meta[name="csrf-token"]').attr('content') : $(window.parent.document).find('meta[name="csrf-token"]').attr('content'))
  49. },
  50. response: function (res, status, header) {
  51. // console.log(status);
  52. /*错误码 400*/
  53. if (status > 399 && status < 500) {
  54. NProgress.done();
  55. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  56. // window.location = '/404?msg=页面未找到';
  57. return false;
  58. }
  59. /*错误码 500*/
  60. else if (status >= 500) {
  61. NProgress.done();
  62. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  63. return false;
  64. } else {
  65. if (!res) {
  66. NProgress.done();
  67. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  68. return false;
  69. }
  70. NProgress.done();
  71. response(res);
  72. }
  73. }
  74. })
  75. },
  76. get: function (url, data) {
  77. url = url ? url : window.location.href;
  78. data = data ? data : {};
  79. if ($.isEmptyObject(data)) {
  80. window.location.href = url;
  81. } else {
  82. window.location.href = url + '?' + $Request.getQueryString(data);
  83. }
  84. },
  85. open: function (url, data) {
  86. url = url ? url : window.location.href;
  87. data = data ? data : {};
  88. if ($.isEmptyObject(data)) {
  89. window.open(url);
  90. } else {
  91. window.open(url + '?' + $Request.getQueryString(data));
  92. }
  93. },
  94. frame: function (url, data, options) {
  95. if (!$.isEmptyObject(data)) {
  96. url = url + '?' + $Request.getQueryString(data)
  97. }
  98. var _s = Object.assign({
  99. width: (parseInt((document.documentElement.clientWidth / 100) * 55)) + 'px',
  100. height: (parseInt((document.documentElement.clientHeight / 100) * 77)) + 'px',
  101. msg: '正在打开页面,请稍后。。。'
  102. }, options);
  103. var iframe = document.createElement("iframe");
  104. iframe.id = $Request.random(12);
  105. iframe.src = url;
  106. iframe.width = _s.width;
  107. iframe.height = _s.height;
  108. iframe.className = 'va-frame__wrapper_iframe';
  109. $(".va-frame__wrapper").find('iframe').remove();
  110. window.$__frameLoading = $App.$loading({
  111. lock: true,
  112. text: _s.msg,
  113. spinner: 'el-icon-loading',
  114. });
  115. $(".va-frame__wrapper").append(iframe);
  116. $(window).resize(function () {
  117. $("body").find('.va-frame__wrapper_iframe').attr('width', (parseInt((document.documentElement.clientWidth / 100) * 55)) + 'px');
  118. $("body").find('.va-frame__wrapper_iframe').attr('height', (parseInt((document.documentElement.clientHeight / 100) * 77)) + 'px');
  119. });
  120. },
  121. href: function (url, data) {
  122. url = url ? url : window.location.href;
  123. data = data ? data : {};
  124. if ($.isEmptyObject(data)) {
  125. return url;
  126. } else {
  127. return url + '?' + $Request.getQueryString(data);
  128. }
  129. },
  130. load: function (url, data, callback) {
  131. var stateObject = {};
  132. url = url ? url : window.location.href;
  133. data = data ? data : {};
  134. if (!$.isEmptyObject(data)) {
  135. url = url + '?' + $Request.getQueryString(data);
  136. }
  137. $("#app").load(url, null, function (response, status, xhr) {
  138. if (xhr.status === 404) {
  139. $App.layouts.loading = false;
  140. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  141. if (typeof callback === 'function') {
  142. callback(xhr.status);
  143. }
  144. } else if (xhr.status === 500) {
  145. $App.layouts.loading = false;
  146. $App.$message({message: '服务器响应错误,请稍后再试!', type: 'error'});
  147. if (typeof callback === 'function') {
  148. callback(xhr.status);
  149. }
  150. } else {
  151. history.pushState(stateObject, '', url);
  152. if (typeof callback === 'function') {
  153. callback(xhr.status);
  154. }
  155. $App.layouts.loading = false;
  156. }
  157. });
  158. },
  159. random: function (length) {
  160. length = length ? length : 16;
  161. var result = '';
  162. for (var i = 0; i < length; i++) {
  163. result += Math.floor(Math.random() * 16).toString(16);
  164. }
  165. return result.toUpperCase();
  166. },
  167. httpRequest: function (settings) {
  168. var _s = Object.assign({
  169. url: window.location.href,
  170. type: 'POST',
  171. dataType: 'json',
  172. async: true,
  173. data: null,
  174. headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
  175. timeout: 0,
  176. encrypt: true,
  177. beforeSend: function (xhr) {
  178. },
  179. success: function (result, status, xhr) {
  180. },
  181. error: function (xhr, status, error) {
  182. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  183. },
  184. response: function (xhr, status) {
  185. }
  186. }, settings);
  187. if (!_s.url) {
  188. _s.url = window.location.href
  189. }
  190. // 参数验证
  191. if (!_s.url || !_s.type || !_s.dataType || !_s.async) {
  192. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  193. return;
  194. }
  195. // 创建XMLHttpRequest请求对象
  196. var xhr = new XMLHttpRequest();
  197. // 请求开始回调函数
  198. xhr.addEventListener('loadstart', function (e) {
  199. _s.beforeSend(xhr);
  200. });
  201. // 请求成功回调函数
  202. xhr.addEventListener('load', function (e) {
  203. var status = xhr.status;
  204. if ((status >= 200 && status < 300) || status === 304) {
  205. var result;
  206. if (xhr.responseType === 'text') {
  207. result = xhr.responseText;
  208. } else if (xhr.responseType === 'document') {
  209. result = xhr.responseXML;
  210. } else {
  211. result = xhr.response;
  212. }
  213. _s.success(result, status, xhr);
  214. } else {
  215. _s.error(xhr, status, e);
  216. }
  217. });
  218. // 请求结束
  219. xhr.addEventListener('loadend', function (e) {
  220. var result;
  221. if (xhr.responseType === 'text') {
  222. result = xhr.responseText;
  223. } else if (xhr.responseType === 'document') {
  224. result = xhr.responseXML;
  225. } else {
  226. result = xhr.response;
  227. }
  228. _s.response(result, xhr.status);
  229. });
  230. // 请求出错
  231. xhr.addEventListener('error', function (e) {
  232. _s.error(xhr, xhr.status, e);
  233. });
  234. // 请求超时
  235. xhr.addEventListener('timeout', function (e) {
  236. _s.error(xhr, 408, e);
  237. });
  238. var useUrlParam = false;
  239. var sType = _s.type.toUpperCase();
  240. if (sType === 'GET' || sType === 'DELETE') {
  241. useUrlParam = true;
  242. _s.url += $Request.getUrlParam(_s.url, _s.data);
  243. }
  244. xhr.open(_s.type, _s.url, _s.async);
  245. xhr.responseType = _s.dataType;
  246. var headers_keys = Object.keys(_s.headers);
  247. // 设置请求头
  248. headers_keys.forEach(function (value, index, array) {
  249. xhr.setRequestHeader(value, _s.headers[value]);
  250. });
  251. if (_s.async && _s.timeout) {
  252. xhr.timeout = _s.timeout;
  253. }
  254. xhr.send(useUrlParam ? null : $Request.getQueryData(_s.data));
  255. },
  256. httpJsonRequest: function (settings) {
  257. var _s = Object.assign({
  258. url: window.location.href,
  259. type: 'POST',
  260. dataType: 'json',
  261. async: true,
  262. data: null,
  263. headers: {'Content-Type': 'application/json; charset=UTF-8'},
  264. timeout: 0,
  265. encrypt: true,
  266. beforeSend: function (xhr) {
  267. },
  268. success: function (result, status, xhr) {
  269. },
  270. error: function (xhr, status, error) {
  271. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  272. },
  273. response: function (xhr, status) {
  274. }
  275. }, settings);
  276. if (!_s.url) {
  277. _s.url = window.location.href
  278. }
  279. // 参数验证
  280. if (!_s.url || !_s.type || !_s.dataType || !_s.async) {
  281. $App.$message({message: '网络请求异常,请稍后再试!', type: 'error'});
  282. return;
  283. }
  284. // 创建XMLHttpRequest请求对象
  285. var xhr = new XMLHttpRequest();
  286. // 请求开始回调函数
  287. xhr.addEventListener('loadstart', function (e) {
  288. _s.beforeSend(xhr);
  289. });
  290. // 请求成功回调函数
  291. xhr.addEventListener('load', function (e) {
  292. var status = xhr.status;
  293. if ((status >= 200 && status < 300) || status === 304) {
  294. var result;
  295. if (xhr.responseType === 'text') {
  296. result = xhr.responseText;
  297. } else if (xhr.responseType === 'document') {
  298. result = xhr.responseXML;
  299. } else {
  300. result = xhr.response;
  301. }
  302. _s.success(result, status, xhr);
  303. } else {
  304. _s.error(xhr, status, e);
  305. }
  306. });
  307. // 请求结束
  308. xhr.addEventListener('loadend', function (e) {
  309. var result;
  310. if (xhr.responseType === 'text') {
  311. result = xhr.responseText;
  312. } else if (xhr.responseType === 'document') {
  313. result = xhr.responseXML;
  314. } else {
  315. result = xhr.response;
  316. }
  317. _s.response(result, xhr.status);
  318. });
  319. // 请求出错
  320. xhr.addEventListener('error', function (e) {
  321. _s.error(xhr, xhr.status, e);
  322. });
  323. // 请求超时
  324. xhr.addEventListener('timeout', function (e) {
  325. _s.error(xhr, 408, e);
  326. });
  327. var useUrlParam = false;
  328. var sType = _s.type.toUpperCase();
  329. if (sType === 'GET' || sType === 'DELETE') {
  330. useUrlParam = true;
  331. _s.url += $Request.getUrlParam(_s.url, _s.data);
  332. }
  333. xhr.open(_s.type, _s.url, _s.async);
  334. xhr.responseType = _s.dataType;
  335. var headers_keys = Object.keys(_s.headers);
  336. // 设置请求头
  337. headers_keys.forEach(function (value, index, array) {
  338. xhr.setRequestHeader(value, _s.headers[value]);
  339. });
  340. if (_s.async && _s.timeout) {
  341. xhr.timeout = _s.timeout;
  342. }
  343. // xhr.send(useUrlParam ? null : $Request.getQueryData(_s.data));
  344. xhr.send(useUrlParam ? null : JSON.stringify(_s.data));
  345. },
  346. getUrlParam: function (url, data) {
  347. if (!data) {
  348. return '';
  349. }
  350. var paramsStr = data instanceof Object ? $Request.getQueryString(data) : data;
  351. return (url.indexOf('?') !== -1) ? paramsStr : '?' + paramsStr;
  352. },
  353. getQueryData: function (data) {
  354. if (!data) {
  355. return null;
  356. }
  357. if (typeof data === 'string') {
  358. return data;
  359. }
  360. if (data instanceof FormData) {
  361. return data;
  362. }
  363. return $Request.getQueryString(data);
  364. },
  365. getQueryString: function (data) {
  366. var paramsArr = [];
  367. if (data instanceof Object) {
  368. Object.keys(data).forEach(function (key) {
  369. var val = data[key];
  370. paramsArr.push(encodeURIComponent(key) + '=' + encodeURIComponent(val));
  371. });
  372. }
  373. return paramsArr.join('&');
  374. }
  375. };
  376. var $Config = {
  377. data: function () {
  378. return {
  379. isCollapse: false,
  380. }
  381. },
  382. methods: {
  383. /*主题色右侧菜单事件*/
  384. themeCommandEvent: function (theme) {
  385. let root = document.querySelector(":root");
  386. Cookies.set('theme', theme);
  387. root.style.setProperty("--themeColors", themeStyle[theme].themeColors);
  388. root.style.setProperty("--themeTextColors", themeStyle[theme].themeTextColors);
  389. root.style.setProperty("--themeSelectColors", themeStyle[theme].themeSelectColors);
  390. root.style.setProperty("--headerBackground", themeStyle[theme].headerBackground);
  391. root.style.setProperty("--headerTextColors", themeStyle[theme].headerTextColors);
  392. root.style.setProperty("--leftBackground", themeStyle[theme].leftBackground);
  393. root.style.setProperty("--leftTextColors", themeStyle[theme].leftTextColors);
  394. root.style.setProperty("--buttonHoverColors", themeStyle[theme].buttonHoverColors);
  395. },
  396. /*左侧菜单展合*/
  397. menuClose() {
  398. var that = this;
  399. if (that.isCollapse === true) {
  400. that.isCollapse = false;
  401. $('#app-main').css('--real-sidebar-width', '200px')
  402. $('.left-title span').css('display', 'inline')
  403. } else {
  404. that.isCollapse = true;
  405. $('#app-main').css('--real-sidebar-width', '64px')
  406. $('.left-title span').css('display', 'none')
  407. }
  408. // 监听窗口大小变化
  409. that.handleResize()
  410. },
  411. handleResize(){
  412. // 监听窗口开合
  413. }
  414. },
  415. beforeCreate: function () {
  416. },
  417. created: function () {
  418. },
  419. mounted: function () {
  420. //设置主体
  421. var $theme = Cookies.get('theme');
  422. this.themeCommandEvent($theme ? $theme : 'index');
  423. }
  424. };
  425. var $Layouts = {
  426. data: function () {
  427. return {
  428. config: {
  429. menuLayouts: 'left', permissions: true, breadcrumb: true,
  430. header: {show: false, msg: '详细页面', back: '', callback: ''}, menu_id: 0,
  431. },
  432. menuRule:'index',
  433. fastAdminPath:'/admin.php',
  434. currentItemsKey:'currentItems',
  435. layoutsLeftMenuEventKey:'layoutsLeftMenuEvent',
  436. permissions: [],
  437. layouts: {
  438. tabs: {
  439. menuOpenIds: [],
  440. active: 0,
  441. menus: {},
  442. show: true,
  443. custom: false,
  444. openeds: [],
  445. headerParentId: 0
  446. },
  447. left: {
  448. menuOpenIds: [],
  449. active: '0',
  450. menus: {},
  451. show: true,
  452. custom: false,
  453. openeds: [],
  454. headerParentId: 0,
  455. },
  456. drawerFormsHeight: {'height': '600px'},
  457. drawerFixedHeight: {'height': '480px'},
  458. dialogFormsHeight: {'height': '480px'},
  459. dialogFixedHeight: {'height': '480px'},
  460. },
  461. GalleryParams: {
  462. models: '',
  463. action: '/admin/framework/common/gallery/upload',
  464. driver: 'local',
  465. domain: '',
  466. options: {
  467. max: 1,
  468. size: 20,
  469. suffix: 'bmp,gif,jpg,jpeg,png',
  470. type: 1,
  471. cat: false,
  472. tabs: false,
  473. upload: true,
  474. addPage: false,
  475. addIcon: false,
  476. },
  477. fileTypeMaps: {
  478. '1': 'image', '2': 'media', '3': 'file'
  479. },
  480. postHeaders: {
  481. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  482. },
  483. postData: {},
  484. operation: {
  485. groupManage: false,
  486. groupMax: 6,
  487. imageTotal: 0,
  488. dialog: false,
  489. loading: false,
  490. loadingMsg: '',
  491. error: false
  492. },
  493. search: {
  494. group_id: 0,
  495. page: 1,
  496. keyword: '',
  497. size: 12,
  498. type: 1
  499. },
  500. size:0,
  501. groupItems: [],
  502. imagesItems: [],
  503. selected: [],
  504. },
  505. CenterParams:{
  506. // 监测抽屉鼠标事件
  507. mousedownClassBol: false,//抽屉遮盖层误触
  508. dialogClassModel: '',//抽屉遮盖层误触
  509. // 监测抽屉鼠标事件 End.
  510. loadingMsg:'正在加载数据,请稍后...',
  511. dialog: false, loading: false,updatePasswordStatus:false,
  512. action: '',
  513. model: {name:'',account:'',password:''},
  514. rules: {
  515. name: [
  516. { required: true, message: '请填写用户名', trigger: 'blur'}
  517. ],
  518. account: [
  519. { required: true, message: '请填写登录账号', trigger: 'blur'}
  520. ]
  521. }
  522. },
  523. }
  524. },
  525. methods: {
  526. copy(context){
  527. let that = this
  528. navigator.clipboard.writeText(context)
  529. .then(()=>{
  530. that.$Message('复制成功', 'success');
  531. })
  532. .catch(err => {
  533. that.$Message('复制失败', 'warning');
  534. })
  535. },
  536. /*格式化时间戳*/
  537. formatTableDate: function (row, column, value) {
  538. if ((typeof (value) === 'undefined') || parseInt(value) === 0) {
  539. return '---';
  540. }
  541. return $Utils.formatDate('yyyy-MM-dd hh:mm:ss', value);
  542. },
  543. formatTableDay: function (row, column, value) {
  544. if ((typeof (value) === 'undefined') || parseInt(value) === 0) {
  545. return '---';
  546. }
  547. return $Utils.formatDate('yyyy-MM-dd', value);
  548. },
  549. /*确认信息*/
  550. $Alerts: function (msg, successCallback, errorCallback, options) {
  551. options = options ? options : {
  552. type: 'warning',
  553. lockScroll: true,
  554. center: true,
  555. confirm: '确定',
  556. cancel: '取消',
  557. showClose: true,
  558. showCancelButton: true,
  559. };
  560. var that = this;
  561. that.$confirm(msg, '系统提示', {
  562. dangerouslyUseHTMLString: true,
  563. confirmButtonText: options.confirm ? options.confirm : '确定',
  564. cancelButtonText: options.cancel ? options.cancel : '取消',
  565. type: options.type ? options.type : 'warning',
  566. lockScroll: options.lockScroll ? options.lockScroll : false,
  567. showClose: options.showClose ? options.showClose : true,
  568. center: options.center ? options.center : true,
  569. showCancelButton: options.showCancelButton ? options.showCancelButton : true,
  570. }).then(function () {
  571. if (successCallback) {
  572. successCallback();
  573. }
  574. }).catch(function () {
  575. if (errorCallback) {
  576. errorCallback();
  577. }
  578. });
  579. },
  580. /*确认信息*/
  581. $Confirm: function (msg, successCallback, errorCallback, options) {
  582. var that = this;
  583. options = options ? options : {};
  584. var _s = Object.assign({
  585. dangerouslyUseHTMLString: true,
  586. lockScroll: false,
  587. type: 'warning',
  588. center: true,
  589. confirmButtonText: '确定',
  590. cancelButtonText: '取消',
  591. closeOnClickModal: true,
  592. showCancelButton: true
  593. }, options);
  594. that.$confirm(msg, '系统提示', _s).then(function () {
  595. if (successCallback) {
  596. successCallback();
  597. }
  598. }).catch(function () {
  599. if (errorCallback) {
  600. errorCallback();
  601. }
  602. });
  603. },
  604. /*提示信息*/
  605. $Message: function (msg, callback, type, duration) {
  606. var that = this;
  607. if (typeof callback === 'string') {
  608. type = callback;
  609. } else {
  610. if (!type) {
  611. type = 'success'; //warning error
  612. }
  613. }
  614. duration = duration ? duration : 1500;
  615. that.$message({
  616. type: type, duration: duration, message: msg, dangerouslyUseHTMLString: true, onClose: function (res) {
  617. if (callback && (typeof callback) === 'function') {
  618. callback(res);
  619. }
  620. }
  621. });
  622. },
  623. $Loading: function () {
  624. var loading = this.$loading({
  625. lock: true,
  626. text: 'Loading',
  627. spinner: 'el-icon-loading',
  628. background: 'rgba(0, 0, 0, 0.7)'
  629. });
  630. setTimeout(() => {
  631. loading.close();
  632. }, 2000);
  633. },
  634. emptyChange: function () {
  635. },
  636. PermissionsCallbackEvent: function (res) {
  637. return true;
  638. },
  639. layoutsLeftMenuEvent: function (key, keyPath, e) {
  640. var that = this;
  641. var menuItems = e.$attrs.items;
  642. var $loading = that.$loading({
  643. lock: true,
  644. background: 'rgba(255, 255, 255, 0.4)'
  645. });
  646. if ((typeof e.$attrs.items) != 'object') {
  647. if (!$Validator.json(e.$attrs.items)) {
  648. return true;
  649. }
  650. menuItems = JSON.parse(e.$attrs.items);
  651. }
  652. var currentItems = Cookies.getJSON(that.currentItemsKey);
  653. Cookies.set(that.layoutsLeftMenuEventKey, menuItems.id);
  654. Cookies.set(that.currentItemsKey, menuItems);
  655. that.layoutsTabsMenuEvent(menuItems);
  656. $Request.get(menuItems.path, {}, function (status) {
  657. $loading.close();
  658. if (status !== 200) {
  659. Cookies.set(that.currentItemsKey, currentItems);
  660. Cookies.set(that.layoutsLeftMenuEventKey, currentItems.id);
  661. $Request.get(currentItems.path, {});
  662. }
  663. });
  664. },
  665. layoutsLeftMenuEventSet: function (menuItems) {
  666. var that = this
  667. var $loading = this.$loading({
  668. lock: true,
  669. background: 'rgba(255, 255, 255, 0.4)'
  670. });
  671. var currentItems = Cookies.getJSON(that.currentItemsKey);
  672. Cookies.set(that.layoutsLeftMenuEventKey, menuItems.id);
  673. Cookies.set(that.currentItemsKey, menuItems);
  674. $Request.get(menuItems.path, {}, function (status) {
  675. $loading.close();
  676. if (status !== 200) {
  677. Cookies.set(that.currentItemsKey, currentItems);
  678. Cookies.set(that.layoutsLeftMenuEventKey, currentItems.id);
  679. $Request.get(currentItems.path, {});
  680. }
  681. });
  682. },
  683. layoutsTabsMenuClickEvent: function (e) {
  684. var that = this;
  685. if (!that.layouts.tabs.show) return false;
  686. if (!that.layouts.tabs.active || parseInt(that.layouts.tabs.active) === 0) {
  687. Cookies.remove(that.currentItemsKey);
  688. Cookies.remove(that.layoutsLeftMenuEventKey);
  689. $Request.get('/admin', {});
  690. return true;
  691. }
  692. $.each(that.layouts.tabs.menus, function (key, val) {
  693. if (parseInt(val.id) === parseInt(that.layouts.tabs.active)) {
  694. that.layoutsLeftMenuEventSet(val);
  695. return true;
  696. }
  697. });
  698. },
  699. layoutsTabsMenuRemoveEvent: function (e) {
  700. var that = this;
  701. var _Key = 0;
  702. if (!that.layouts.tabs.show) return false;
  703. $.each(that.layouts.tabs.menus, function (key, val) {
  704. if (parseInt(val.id) === e) {
  705. _Key = (key + 1);
  706. that.layouts.tabs.menus.splice(key, 1);
  707. return false;
  708. }
  709. });
  710. var _Length = that.layouts.tabs.menus.length;
  711. if (_Length < 1) {
  712. sessionStorage.removeItem('9ca5hgd13b48hfcddfdab76c63ddf8u2');
  713. Cookies.remove(that.currentItemsKey);
  714. Cookies.remove(that.layoutsLeftMenuEventKey);
  715. $Request.get('/admin', {});
  716. return true;
  717. }
  718. sessionStorage.setItem('9ca5hgd13b48hfcddfdab76c63ddf8u2', JSON.stringify(that.layouts.tabs.menus));
  719. if (parseInt(that.layouts.tabs.active) === e) {
  720. if (parseInt(_Key) === 1) {
  721. that.layoutsLeftMenuEventSet(that.layouts.tabs.menus[0]);
  722. return true;
  723. }
  724. that.layoutsLeftMenuEventSet(that.layouts.tabs.menus[_Key - 2]);
  725. }
  726. return true;
  727. },
  728. layoutsTabsMenuEvent: function (items) {
  729. var that = this;
  730. var _isS = true;
  731. if (!that.layouts.tabs.show) return false;
  732. $.each(that.layouts.tabs.menus, function (key, val) {
  733. if (parseInt(val.id) === parseInt(items.id)) {
  734. that.layouts.tabs.active = val.id;
  735. _isS = false;
  736. return true;
  737. }
  738. });
  739. if (_isS === true) {
  740. var menus = sessionStorage.getItem('9ca5hgd13b48hfcddfdab76c63ddf8u2');
  741. if (menus) {
  742. menus = JSON.parse(menus);
  743. menus.push(items);
  744. } else {
  745. menus = [items];
  746. }
  747. sessionStorage.setItem('9ca5hgd13b48hfcddfdab76c63ddf8u2', JSON.stringify(menus));
  748. return true;
  749. }
  750. },
  751. layoutsTabsMenuCommandEvent: function (e) {
  752. var that = this;
  753. if (!that.layouts.tabs.show) return false;
  754. if (that.layouts.tabs.menus.length < 1) {
  755. return true;
  756. }
  757. if (e === 'all') {
  758. sessionStorage.removeItem('9ca5hgd13b48hfcddfdab76c63ddf8u2');
  759. Cookies.remove(that.currentItemsKey);
  760. Cookies.remove(that.layoutsLeftMenuEventKey);
  761. $Request.get('/admin', {});
  762. return true;
  763. } else if (e === 'other') {
  764. var tabsMenus = [];
  765. if (that.layouts.tabs.menus && that.layouts.tabs.menus.length > 0) {
  766. if (parseInt(this.layouts.tabs.active) > 0) {
  767. $.each(that.layouts.tabs.menus, function (key, val) {
  768. if (parseInt(val.id) === parseInt(that.layouts.tabs.active)) {
  769. tabsMenus[0] = val;
  770. }
  771. });
  772. that.layouts.tabs.menus = tabsMenus;
  773. sessionStorage.setItem('9ca5hgd13b48hfcddfdab76c63ddf8u2', JSON.stringify(tabsMenus));
  774. } else {
  775. sessionStorage.removeItem('9ca5hgd13b48hfcddfdab76c63ddf8u2');
  776. Cookies.remove(that.currentItemsKey);
  777. Cookies.remove(that.layoutsLeftMenuEventKey);
  778. $Request.get('/admin', {});
  779. }
  780. }
  781. } else {
  782. if (parseInt(this.layouts.tabs.active) > 0) {
  783. that.layoutsTabsMenuRemoveEvent(that.layouts.tabs.active);
  784. }
  785. }
  786. },
  787. getLayoutsTabsMenus: function (items) {
  788. var that = this;
  789. if (!that.layouts.tabs.show) return false;
  790. that.layouts.tabs.menus = [];
  791. if (!that.layouts.tabs.show) return true;
  792. var currentItems = sessionStorage.getItem('9ca5hgd13b48hfcddfdab76c63ddf8u2');
  793. if (!currentItems) {
  794. return true;
  795. }
  796. currentItems = JSON.parse(currentItems);
  797. that.layouts.tabs.show = true;
  798. that.layouts.tabs.menus = currentItems;
  799. },
  800. /*获取页面操作项*/
  801. getUserOperationPermissions: function (menu_rule) {
  802. var that = this;
  803. $Request.postJson(that.fastAdminPath + '/vue/operationPermissions', {menu_rule: menu_rule}, function (res) {
  804. if (res.code === 200) {
  805. that.permissions = res.result;
  806. // console.log(that.permissions);
  807. that.PermissionsCallbackEvent(res.result);
  808. }
  809. });
  810. },
  811. redirectPage: function (url, data, type) {
  812. var that = this;
  813. var backLoading = that.$loading({
  814. lock: true,
  815. background: 'rgba(255, 255, 255, 0.4)'
  816. });
  817. switch (type) {
  818. case 'load':
  819. that.layouts.loading = true;
  820. $Request.load(url, data);
  821. break;
  822. case 'open':
  823. backLoading.close();
  824. $Request.open(url, data);
  825. break;
  826. case 'reload':
  827. window.location.reload();
  828. break;
  829. case 'post':
  830. $Request.postJson(url, data, function (res) {
  831. backLoading.close();
  832. that.$Message('成功!');
  833. });
  834. break;
  835. default:
  836. that.layouts.loading = true;
  837. $Request.get(url, data);
  838. break;
  839. }
  840. return true;
  841. },
  842. /*计算页面高度*/
  843. computingWindowHeight: function (reload) {
  844. var that = this;
  845. if (reload === true) {
  846. if (that.layouts.isCollapse) {
  847. that.layouts.isCollapse = false;
  848. that.layouts.menuWidth = {'width': '220px !important'}
  849. } else {
  850. that.layouts.isCollapse = true;
  851. that.layouts.menuWidth = {'width': '64px !important'}
  852. }
  853. if (!that.layouts.left.show) {
  854. that.layouts.isCollapse = false;
  855. that.layouts.menuWidth = {'width': '0 !important'};
  856. }
  857. }
  858. var documentClientHeight = document.documentElement.clientHeight;
  859. that.layouts.containerHeight = {
  860. 'height': (documentClientHeight - 20) + 'px',
  861. };
  862. that.layouts.mainHeight = {
  863. 'min-height': (documentClientHeight - 120) + 'px',
  864. };
  865. that.layouts.drawerFormsHeight = {
  866. 'max-height': parseInt((documentClientHeight * 0.71) - 120) + 'px'
  867. };
  868. that.layouts.dialogFormsHeight = {
  869. 'max-height': parseInt((documentClientHeight * 0.81) - 120) + 'px'
  870. };
  871. that.layouts.drawerFixedHeight = {
  872. 'height': (documentClientHeight - 131) + 'px',
  873. };
  874. that.layouts.dialogFixedHeight = {
  875. 'height': (documentClientHeight - 380) + 'px',
  876. };
  877. that.layouts.windowHeight = documentClientHeight - 120;
  878. },
  879. handleCommand: function (command) {
  880. var that = this;
  881. switch (command) {
  882. case 'logout': //退出
  883. that.logout();
  884. break;
  885. case 'clear_cache':
  886. that.clearCache();
  887. break;
  888. case 'center':
  889. that.centerDialogOpen();
  890. break;
  891. default:
  892. break;
  893. }
  894. },
  895. logout: function () {
  896. $Request.get('/admin/passport/logout', {});
  897. },
  898. clearCache: function () {
  899. this.redirectPage('/admin/framework/common/cacheClear', {}, 'post')
  900. },
  901. centerDialogOpen: function () {
  902. $Center.CenterDialogOpen();
  903. },
  904. },
  905. beforeCreate: function () {
  906. },
  907. created: function () {
  908. var that = this;
  909. var path = window.location.pathname.split('/')[1];
  910. path = path === undefined ? '' : '/' + path;
  911. that.layoutsLeftMenuEventKey = $('meta[name="layouts-left"]').attr('content');
  912. that.currentItemsKey = $('meta[name="current-items"]').attr('content');
  913. that.fastAdminPath = path;
  914. that.getUserOperationPermissions(that.menuRule);
  915. },
  916. mounted: function () {
  917. var that = this;
  918. that.computingWindowHeight(true);
  919. $(window).resize(function () {
  920. that.computingWindowHeight(false);
  921. });
  922. }
  923. };
  924. var $Tables = {
  925. data: function () {
  926. return {
  927. tables: {
  928. remove: {url: '', msg: '', field: ''},
  929. status: {url: '', msg: '', field: '', maps: {1: '禁用', 2: '启用'}},
  930. sort: {url: '', item: '', field: ''},
  931. selects: [],
  932. options: {
  933. cell: true,
  934. loading: true,
  935. loadingMsg: '正在加载数据,请稍后...'
  936. },
  937. url: '', search: {},
  938. prop: 'id',
  939. orderBy: 'desc',
  940. pagination: {
  941. layouts: 'total, sizes, prev, pager, next, jumper',
  942. sizes: [15, 30, 50, 100, 300, 500],
  943. page: 1,
  944. size: 15,
  945. total: 20,
  946. },
  947. data: []
  948. },
  949. }
  950. },
  951. methods: {
  952. formatTableColumn: function (row, column, value) {
  953. },
  954. tablesCellMoveEvent: function (row, column, cell, event) {
  955. var that = this;
  956. if (column.filterPlacement === 'false' || !that.tables.options.cell) {
  957. return false;
  958. }
  959. event.stopPropagation();
  960. if ($(cell).find('.cell').hasClass('Va-table-move')) {
  961. return false;
  962. } else {
  963. $('.cell').removeClass('Va-table-move');
  964. $('.Va-table-move-close').remove();
  965. if (!row[column.property]) {
  966. return false;
  967. }
  968. $(cell).find('.cell').append('<i class="el-icon-close Va-table-move-close" onclick="removeTableMoveEvent(this)"></i>');
  969. $(cell).find('.cell').addClass('Va-table-move');
  970. if (($(cell).width() - 20) > $(cell).parent().find('.Va-table-move').width()) {
  971. $('.cell').removeClass('Va-table-move');
  972. $('.Va-table-move-close').remove();
  973. }
  974. }
  975. },
  976. tablesPaginationSizeChange: function (size) {
  977. var that = this;
  978. that.tables.pagination.size = size;
  979. that.tablesGetTableList();
  980. },
  981. tablesPaginationCurrentChange: function (page) {
  982. var that = this;
  983. that.tables.pagination.page = page;
  984. that.$refs.formContainerTables.clearSelection();
  985. that.tablesGetTableList();
  986. },
  987. /*排序发生改变时触发*/
  988. tablesPaginationSortChange: function (rows) {
  989. var that = this;
  990. that.$set(that.tables, 'orderBy', rows.orderBy);
  991. if (typeof rows.column.sortBy === 'undefined') {
  992. that.$set(that.tables, 'prop', rows.prop);
  993. } else {
  994. that.$set(that.tables, 'prop', rows.column.sortBy);
  995. }
  996. that.tablesGetTableList();
  997. },
  998. /*多选发生改变时触发*/
  999. tablesSelectChange: function (rows) {
  1000. var that = this;
  1001. that.selects = rows;
  1002. that.$set(that.tables, 'selects', rows);
  1003. },
  1004. tablesClearSelect: function () {
  1005. var that = this;
  1006. that.$nextTick(function () {
  1007. that.$refs.formContainerTables.clearSelection();
  1008. })
  1009. },
  1010. getTablesSelected: function () {
  1011. var that = this;
  1012. if (!that.tables.selects.length || that.tables.selects.length <= 0) {
  1013. return [];
  1014. }
  1015. var selects_ids = [];
  1016. that.tables.selects.forEach(function (item, index) {
  1017. selects_ids.push(item.id);
  1018. });
  1019. if (!selects_ids || selects_ids.length <= 0) {
  1020. return [];
  1021. }
  1022. return selects_ids;
  1023. },
  1024. tablesGetTableList: function () {
  1025. var that = this;
  1026. if (!that.tablesGetTableListFront()) {
  1027. return false;
  1028. }
  1029. if (!that.tables.url) {
  1030. that.tables.url = window.location.href;
  1031. }
  1032. that.tables.options.loading = true;
  1033. that.tables.search.page = that.tables.pagination.page;
  1034. that.tables.search.size = that.tables.pagination.size;
  1035. that.tables.search.orderBy = that.tables.orderBy;
  1036. that.tables.search.prop = that.tables.prop;
  1037. $Request.postJson(that.tables.url, that.tables.search, function (res) {
  1038. if (that.tablesGetTablesListsAfter(res)) {
  1039. if ((typeof (res) === 'undefined')) {
  1040. return false;
  1041. }
  1042. if ((typeof (res.result) === 'undefined')) {
  1043. return false;
  1044. }
  1045. // console.log(that.tables.data);
  1046. that.tables.options.loading = false;
  1047. that.tables.data = res.result.rows ? res.result.rows : res.result.data;
  1048. that.tables.pagination.total = res.result.total;
  1049. }
  1050. that.tablesGetTablesListsFinish(res);
  1051. })
  1052. if (that.parking && that.parking.search.store_id){
  1053. that.getParkingList()
  1054. }
  1055. },
  1056. tablesGetTableListFront: function () {
  1057. return true;
  1058. },
  1059. tablesGetTablesListsAfter: function () {
  1060. return true;
  1061. },
  1062. tablesGetTablesListsFinish: function () {
  1063. return true;
  1064. },
  1065. tablesRowsRemove: function (rows, params) {
  1066. var that = this;
  1067. if (!that.tables.remove.url) {
  1068. return false;
  1069. }
  1070. var requestData = {};
  1071. if (params) {
  1072. requestData = params;
  1073. }
  1074. that.tables.remove.msg = that.tables.remove.msg ? that.tables.remove.msg : '确认删除当前数据吗?';
  1075. that.tables.remove.field = that.tables.remove.field ? that.tables.remove.field : 'id';
  1076. if (!rows[that.tables.remove.field]) {
  1077. return false;
  1078. }
  1079. requestData[that.tables.remove.field] = rows[that.tables.remove.field];
  1080. that.$confirm(that.tables.remove.msg, '操作提示', {
  1081. confirmButtonText: '确定',
  1082. cancelButtonText: '取消',
  1083. type: 'warning',
  1084. center: true,
  1085. dangerouslyUseHTMLString: true,
  1086. lockScroll: false,
  1087. }).then(function () {
  1088. $Request.postJson(that.tables.remove.url, requestData, function (res) {
  1089. if (res.code === 200) {
  1090. that.$message({
  1091. message: res.message, type: 'success', duration: 2400, onClose: function () {
  1092. }
  1093. });
  1094. that.tablesGetTableList();
  1095. } else {
  1096. that.$message({
  1097. message: res.message, type: 'error', duration: 2400, onClose: function () {
  1098. }
  1099. });
  1100. }
  1101. })
  1102. }).catch(function () {
  1103. });
  1104. },
  1105. tablesRowsStatus: function (rows, params) {
  1106. var that = this;
  1107. if (!that.tables.status.url || !that.tables.status.field) {
  1108. return false;
  1109. }
  1110. if (!rows[that.tables.status.field] && rows[that.tables.status.field] !== 0) {
  1111. return false;
  1112. }
  1113. if (!that.tables.status.maps[rows[that.tables.status.field]]) {
  1114. return false;
  1115. }
  1116. that.tables.status.msg = '确认' + that.tables.status.maps[rows[that.tables.status.field]] + '当前数据吗?';
  1117. var requestData = {};
  1118. if (params) {
  1119. requestData = params;
  1120. }
  1121. requestData[that.tables.status.field] = rows[that.tables.status.field];
  1122. that.$confirm(that.tables.status.msg, '操作提示', {
  1123. confirmButtonText: '确定',
  1124. cancelButtonText: '取消',
  1125. type: 'warning',
  1126. center: false,
  1127. dangerouslyUseHTMLString: true,
  1128. lockScroll: false,
  1129. }).then(function () {
  1130. $Request.postJson(that.tables.status.url, requestData, function (res) {
  1131. if (res.code === 200) {
  1132. that.$message({
  1133. message: res.message, type: 'success', duration: 2400, onClose: function () {
  1134. }
  1135. });
  1136. that.tablesGetTableList();
  1137. } else {
  1138. that.$message({
  1139. message: res.message, type: 'error', duration: 2400, onClose: function () {
  1140. }
  1141. });
  1142. }
  1143. })
  1144. }).catch(function () {
  1145. });
  1146. },
  1147. tablesRowsSort: function (rows) {
  1148. var that = this;
  1149. if (!that.tables.sort.url) {
  1150. return false;
  1151. }
  1152. var requestData = {};
  1153. that.tables.sort.field = that.tables.sort.field ? that.tables.sort.field : 'id';
  1154. that.tables.sort.item = that.tables.sort.item ? that.tables.sort.item : 'sort';
  1155. if (!rows[that.tables.sort.field]) {
  1156. return false;
  1157. }
  1158. if (!rows[that.tables.sort.item]) {
  1159. return false;
  1160. }
  1161. requestData[that.tables.sort.field] = rows[that.tables.sort.field];
  1162. requestData[that.tables.sort.item] = rows[that.tables.sort.item];
  1163. $Request.postJson(that.tables.sort.url, requestData, function (res) {
  1164. if (res.code === 200) {
  1165. that.$message({message: res.message, type: 'success', duration: 2100});
  1166. that.tablesGetTableList();
  1167. } else {
  1168. that.$message({message: res.message, type: 'error', duration: 2100});
  1169. }
  1170. })
  1171. },
  1172. tablesRowsType: function (rows) {
  1173. var that = this;
  1174. if (!that.tables.type.url) {
  1175. return false;
  1176. }
  1177. var requestData = {};
  1178. that.tables.type.field = that.tables.type.field ? that.tables.type.field : 'id';
  1179. that.tables.type.item = that.tables.type.item ? that.tables.type.item : 'type';
  1180. if (!rows[that.tables.type.field]) {
  1181. return false;
  1182. }
  1183. if (!rows[that.tables.type.item]) {
  1184. return false;
  1185. }
  1186. requestData[that.tables.type.field] = rows[that.tables.type.field];
  1187. requestData[that.tables.type.item] = rows[that.tables.type.item];
  1188. $Request.postJson(that.tables.type.url, requestData, function (res) {
  1189. if (res.code === 200) {
  1190. that.$message({message: res.message, type: 'success', duration: 2100});
  1191. that.tablesGetTableList();
  1192. } else {
  1193. that.$message({message: res.message, type: 'error', duration: 2100});
  1194. }
  1195. })
  1196. },
  1197. // 公共执行操作
  1198. tablesRowsOperate: function (url, params, msg = '确定要执行当前操作吗?') {
  1199. var that = this;
  1200. var requestData = {};
  1201. if (params) {
  1202. requestData = params;
  1203. }
  1204. that.$confirm(msg, '操作提示', {
  1205. confirmButtonText: '确定',
  1206. cancelButtonText: '取消',
  1207. type: 'warning',
  1208. center: false,
  1209. dangerouslyUseHTMLString: true,
  1210. lockScroll: false,
  1211. }).then(function () {
  1212. $Request.postJson(url, requestData, function (res) {
  1213. if (res.code === 200) {
  1214. that.$message({
  1215. message: res.message, type: 'success', duration: 2400, onClose: function () {
  1216. }
  1217. });
  1218. that.tablesGetTableList();
  1219. } else {
  1220. that.$message({
  1221. message: res.message, type: 'error', duration: 2400, onClose: function () {
  1222. }
  1223. });
  1224. }
  1225. })
  1226. }).catch(function () {
  1227. });
  1228. },
  1229. tablesSearchEvent: function () {
  1230. this.tables.pagination.page = 1;
  1231. this.tablesGetTableList();
  1232. },
  1233. tablesResetsEvent: function () {
  1234. },
  1235. },
  1236. mounted: function () {
  1237. var that = this;
  1238. that.tablesGetTableList();
  1239. },
  1240. beforeCreate: function () {
  1241. var that = this;
  1242. },
  1243. created: function () {
  1244. }
  1245. };
  1246. var $DrawerForms = {
  1247. data: function () {
  1248. return {
  1249. drawerFormsOptions: {
  1250. models: 'drawerForms',
  1251. refs: 'create.model',
  1252. status: false,
  1253. },
  1254. drawerOpens: [],
  1255. __key: '',
  1256. drawerForms: {},
  1257. // 监测抽屉鼠标事件
  1258. mousedownClassBol: false,//抽屉遮盖层误触
  1259. drawerClassModel: '',//抽屉遮盖层误触
  1260. // 监测抽屉鼠标事件 End.
  1261. }
  1262. },
  1263. methods: {
  1264. // 监测抽屉鼠标事件
  1265. handleWrapperMousedown(e) {
  1266. var that = this;
  1267. // 如果为true,则表示点击发生在遮罩层
  1268. that.drawerClassModel = !!e.target.classList.contains('el-drawer__container')
  1269. },
  1270. handleWrapperMouseup(e) {
  1271. var that = this;
  1272. if ((!!e.target.classList.contains('el-drawer__container')) && that.drawerClassModel) {
  1273. that.drawerFormsCloses(that.drawerFormsOptions.models);
  1274. }
  1275. },
  1276. // 监测抽屉鼠标事件 End.
  1277. drawerFormsCloses: function (model) {
  1278. var that = this;
  1279. if (model && typeof model == 'string') that.drawerFormsOptions.models = model;
  1280. that[that.drawerFormsOptions.models].drawer = false;
  1281. that[that.drawerFormsOptions.models].loading = false;
  1282. if (that.drawerOpens.length > 0) {
  1283. that.drawerOpens.splice(that.drawerOpens.length - 1)
  1284. that.drawerFormsOptions.models = that.drawerOpens[that.drawerOpens.length - 1] ? that.drawerOpens[that.drawerOpens.length - 1] : 'drawerForms'
  1285. }
  1286. if (that.$refs[that.drawerFormsOptions.refs]) {
  1287. setTimeout(function () {
  1288. that.$refs[that.drawerFormsOptions.refs].resetFields();
  1289. }, 500);
  1290. }
  1291. },
  1292. drawerFormsBeforeCloses: function (model) {
  1293. var that = this;
  1294. if (model && typeof model == 'string') that.drawerFormsOptions.models = model;
  1295. // console.log(that.drawerFormsOptions.models);
  1296. that[that.drawerFormsOptions.models].drawer = false;
  1297. that[that.drawerFormsOptions.models].loading = false;
  1298. },
  1299. drawerFormsSubmits: function (model) {
  1300. var that = this;
  1301. if (model && typeof model == 'string') that.drawerFormsOptions.models = model;
  1302. /*防止重复提交*/
  1303. if (that[that.drawerFormsOptions.models].loading) {
  1304. return false;
  1305. }
  1306. if ((typeof (that.$refs[that.drawerFormsOptions.refs]) === 'undefined')) {
  1307. that[that.drawerFormsOptions.models].loading = true;
  1308. var formsdrawerFunction = that.drawerFormsOptions.models + 'FormsSubmits';
  1309. if (that.hasOwnProperty(formsdrawerFunction)) {
  1310. that[formsdrawerFunction](that[that.drawerFormsOptions.models].model);
  1311. } else {
  1312. that.drawerFormsRequests(that[that.drawerFormsOptions.models].model);
  1313. }
  1314. that[that.drawerFormsOptions.models].loading = false;
  1315. return true;
  1316. } else {
  1317. that.$refs[that.drawerFormsOptions.refs].validate(function (valid) {
  1318. if (valid) {
  1319. that[that.drawerFormsOptions.models].loading = true;
  1320. var formsdrawerFunction = that.drawerFormsOptions.models + 'FormsSubmits';
  1321. if (that.hasOwnProperty(formsdrawerFunction)) {
  1322. that[formsdrawerFunction](that[that.drawerFormsOptions.models].model);
  1323. } else {
  1324. that.drawerFormsRequests(that[that.drawerFormsOptions.models].model);
  1325. }
  1326. } else {
  1327. that[that.drawerFormsOptions.models].loading = false;
  1328. }
  1329. });
  1330. }
  1331. },
  1332. drawerFormsOpens: function (model) {
  1333. var that = this;
  1334. that.config.__key = $Request.random(12);
  1335. that.drawerFormsOptions.models = model;
  1336. if ((typeof (model) === 'undefined') || (typeof (model) === 'object')) {
  1337. that.drawerFormsOptions.models = 'drawerForms';
  1338. }
  1339. if ((typeof (that[that.drawerFormsOptions.models])) === 'undefined') {
  1340. that[that.drawerFormsOptions.models] = {
  1341. drawer: false,
  1342. loading: false,
  1343. action: '',
  1344. model: {},
  1345. rules: {}
  1346. };
  1347. }
  1348. if ((typeof (that[that.drawerFormsOptions.models].drawer)) === 'undefined') {
  1349. that[that.drawerFormsOptions.models].drawer = false;
  1350. }
  1351. if ((typeof (that[that.drawerFormsOptions.models].loading)) === 'undefined') {
  1352. that[that.drawerFormsOptions.models].loading = false;
  1353. }
  1354. if ((typeof (that[that.drawerFormsOptions.models].loadingTables)) === 'undefined') {
  1355. that[that.drawerFormsOptions.models].loadingTables = true;
  1356. }
  1357. if ((typeof (that[that.drawerFormsOptions.models].model)) === 'undefined') {
  1358. that[that.drawerFormsOptions.models].model = {};
  1359. }
  1360. if ((typeof (that[that.drawerFormsOptions.models].rules)) === 'undefined') {
  1361. that[that.drawerFormsOptions.models].rules = {};
  1362. }
  1363. that.drawerFormsOptions.refs = that.drawerFormsOptions.models + '.model';
  1364. that.drawerFormsOptions.status = true;
  1365. that.drawerOpens.push(that.drawerFormsOptions.models);
  1366. that[that.drawerFormsOptions.models].drawer = true;
  1367. that[that.drawerFormsOptions.models].loading = false;
  1368. if (!(typeof (that.$refs[that.drawerFormsOptions.refs]) === 'undefined')) {
  1369. that.$refs[that.drawerFormsOptions.refs].resetFields();
  1370. }
  1371. return true;
  1372. },
  1373. drawerFormsRequests: function (model) {
  1374. var that = this;
  1375. if (!that[that.drawerFormsOptions.models].action) {
  1376. console.error('$drawerForms:Forms component does not configure submit parameters!');
  1377. that[that.drawerFormsOptions.models].loading = false;
  1378. return false;
  1379. }
  1380. $Request.postJson(that[that.drawerFormsOptions.models].action, model, function (res) {
  1381. if (res.code === 200) {
  1382. that.$message({
  1383. message: res.message, type: 'success', duration: 1500, onClose: function () {
  1384. if (that.hasOwnProperty('tablesGetTableList')) {
  1385. that[that.drawerFormsOptions.models].loading = false;
  1386. that[that.drawerFormsOptions.models].drawer = false;
  1387. if (that[that.drawerFormsOptions.models].loadingTables) {
  1388. that.tablesGetTableList();
  1389. }
  1390. that.drawerFormsRequestsAfter(res);
  1391. }
  1392. if (that[that.drawerFormsOptions.models].success) {
  1393. var success = that[that.drawerFormsOptions.models].success;
  1394. if (that.hasOwnProperty(success)) {
  1395. that[success](res)
  1396. }
  1397. }
  1398. }
  1399. });
  1400. } else {
  1401. that[that.drawerFormsOptions.models].loading = false;
  1402. that.$message({message: res.message, type: 'error', duration: 1500});
  1403. }
  1404. });
  1405. },
  1406. drawerFormsRequestsAfter: function () {
  1407. return true;
  1408. },
  1409. drawerFormsRequestsErrors: function () {
  1410. var that = this;
  1411. },
  1412. drawerFormsValidateErrors: function (forms) {
  1413. var that = this;
  1414. },
  1415. drawerListPageFormsOpens:function (model) {
  1416. var that = this;
  1417. var __table = that[model].model.__table;
  1418. $Request.postJson('/admin/arts/setup/pageGetSetup', {__table: __table}, function (res) {
  1419. if(res.code === 200){
  1420. if(res.result && !Array.isArray(res.result)) {
  1421. that[model].model = res.result;
  1422. }
  1423. that[model].model.__table = __table;
  1424. }
  1425. that.drawerFormsOpens(model);
  1426. })
  1427. }
  1428. },
  1429. mounted: function () {
  1430. },
  1431. beforeCreate: function () {
  1432. var that = this;
  1433. },
  1434. created: function () {
  1435. var that = this;
  1436. }
  1437. };
  1438. var $DialogForms = {
  1439. data: function () {
  1440. return {
  1441. dialogFormsOptions: {
  1442. models: 'dialogForms',
  1443. refs: 'create.model',
  1444. status: false,
  1445. },
  1446. dialogOpens: [],
  1447. __key: '',
  1448. dialogForms: {},
  1449. // 监测抽屉鼠标事件
  1450. mousedownClassBol: false,//抽屉遮盖层误触
  1451. dialogClassModel: '',//抽屉遮盖层误触
  1452. // 监测抽屉鼠标事件 End.
  1453. }
  1454. },
  1455. methods: {
  1456. // 监测抽屉鼠标事件
  1457. handleWrapperMousedown(e) {
  1458. var that = this;
  1459. // 如果为true,则表示点击发生在遮罩层
  1460. that.dialogClassModel = !!e.target.classList.contains('el-dialog__wrapper')
  1461. },
  1462. handleWrapperMouseup(e) {
  1463. var that = this;
  1464. if ((!!e.target.classList.contains('el-dialog__wrapper')) && that.dialogClassModel) {
  1465. that.dialogFormsCloses(that.dialogFormsOptions.models);
  1466. }
  1467. },
  1468. // 监测抽屉鼠标事件 End.
  1469. dialogFormsCloses: function (model) {
  1470. var that = this;
  1471. if (model && typeof model == 'string') that.dialogFormsOptions.models = model;
  1472. that[that.dialogFormsOptions.models].dialog = false;
  1473. that[that.dialogFormsOptions.models].loading = false;
  1474. if (that.dialogOpens.length > 0) {
  1475. that.dialogOpens.splice(that.dialogOpens.length - 1)
  1476. that.dialogFormsOptions.models = that.dialogOpens[that.dialogOpens.length - 1] ? that.dialogOpens[that.dialogOpens.length - 1] : 'drawerForms'
  1477. }
  1478. if (that.$refs[that.dialogFormsOptions.refs]) {
  1479. setTimeout(function () {
  1480. that.$refs[that.dialogFormsOptions.refs].resetFields();
  1481. }, 500);
  1482. }
  1483. },
  1484. dialogFormsBeforeCloses: function (model) {
  1485. var that = this;
  1486. if (model && typeof model == 'string') that.dialogFormsOptions.models = model;
  1487. // console.log(that.dialogFormsOptions.models);
  1488. that[that.dialogFormsOptions.models].dialog = false;
  1489. that[that.dialogFormsOptions.models].loading = false;
  1490. },
  1491. dialogFormsSubmits: function (model) {
  1492. var that = this;
  1493. if (model && typeof model == 'string') that.dialogFormsOptions.models = model;
  1494. /*防止重复提交*/
  1495. if (that[that.dialogFormsOptions.models].loading) {
  1496. return false;
  1497. }
  1498. if ((typeof (that.$refs[that.dialogFormsOptions.refs]) === 'undefined')) {
  1499. that[that.dialogFormsOptions.models].loading = true;
  1500. var formsdialogFunction = that.dialogFormsOptions.models + 'FormsSubmits';
  1501. if (that.hasOwnProperty(formsdialogFunction)) {
  1502. that[formsdialogFunction](that[that.dialogFormsOptions.models].model);
  1503. } else {
  1504. that.dialogFormsRequests(that[that.dialogFormsOptions.models].model);
  1505. }
  1506. that[that.dialogFormsOptions.models].loading = false;
  1507. return true;
  1508. } else {
  1509. that.$refs[that.dialogFormsOptions.refs].validate(function (valid) {
  1510. if (valid) {
  1511. that[that.dialogFormsOptions.models].loading = true;
  1512. var formsdialogFunction = that.dialogFormsOptions.models + 'FormsSubmits';
  1513. if (that.hasOwnProperty(formsdialogFunction)) {
  1514. that[formsdialogFunction](that[that.dialogFormsOptions.models].model);
  1515. } else {
  1516. that.dialogFormsRequests(that[that.dialogFormsOptions.models].model);
  1517. }
  1518. } else {
  1519. that[that.dialogFormsOptions.models].loading = false;
  1520. }
  1521. });
  1522. }
  1523. },
  1524. dialogFormsOpens: function (model) {
  1525. var that = this;
  1526. that.config.__key = $Request.random(12);
  1527. that.dialogFormsOptions.models = model;
  1528. if ((typeof (model) === 'undefined') || (typeof (model) === 'object')) {
  1529. that.dialogFormsOptions.models = 'dialogForms';
  1530. }
  1531. if ((typeof (that[that.dialogFormsOptions.models])) === 'undefined') {
  1532. that[that.dialogFormsOptions.models] = {
  1533. dialog: false,
  1534. loading: false,
  1535. action: '',
  1536. model: {},
  1537. rules: {}
  1538. };
  1539. }
  1540. if ((typeof (that[that.dialogFormsOptions.models].dialog)) === 'undefined') {
  1541. that[that.dialogFormsOptions.models].dialog = false;
  1542. }
  1543. if ((typeof (that[that.dialogFormsOptions.models].loading)) === 'undefined') {
  1544. that[that.dialogFormsOptions.models].loading = false;
  1545. }
  1546. if ((typeof (that[that.dialogFormsOptions.models].loadingTables)) === 'undefined') {
  1547. that[that.dialogFormsOptions.models].loadingTables = true;
  1548. }
  1549. if ((typeof (that[that.dialogFormsOptions.models].model)) === 'undefined') {
  1550. that[that.dialogFormsOptions.models].model = {};
  1551. }
  1552. if ((typeof (that[that.dialogFormsOptions.models].rules)) === 'undefined') {
  1553. that[that.dialogFormsOptions.models].rules = {};
  1554. }
  1555. that.dialogFormsOptions.refs = that.dialogFormsOptions.models + '.model';
  1556. that.dialogFormsOptions.status = true;
  1557. that[that.dialogFormsOptions.models].dialog = true;
  1558. that[that.dialogFormsOptions.models].loading = false;
  1559. if (!(typeof (that.$refs[that.dialogFormsOptions.refs]) === 'undefined')) {
  1560. that.$refs[that.dialogFormsOptions.refs].resetFields();
  1561. }
  1562. return true;
  1563. },
  1564. dialogFormsRequests: function (model) {
  1565. var that = this;
  1566. if (!that[that.dialogFormsOptions.models].action) {
  1567. console.error('$dialogForms:Forms component does not configure submit parameters!');
  1568. that[that.dialogFormsOptions.models].loading = false;
  1569. return false;
  1570. }
  1571. $Request.postJson(that[that.dialogFormsOptions.models].action, model, function (res) {
  1572. if (res.code === 200) {
  1573. that.$message({
  1574. message: res.message, type: 'success', duration: 1500, onClose: function () {
  1575. if (that.hasOwnProperty('tablesGetTableList')) {
  1576. that[that.dialogFormsOptions.models].loading = false;
  1577. that[that.dialogFormsOptions.models].dialog = false;
  1578. if (that[that.dialogFormsOptions.models].loadingTables) {
  1579. that.tablesGetTableList();
  1580. that.tablesDialogGetTableList();
  1581. }
  1582. that.dialogFormsRequestsAfter(res);
  1583. }
  1584. if (that[that.dialogFormsOptions.models].success) {
  1585. that[that.dialogFormsOptions.models].loading = false;
  1586. var success = that[that.dialogFormsOptions.models].success;
  1587. if (that.hasOwnProperty(success)) {
  1588. that[success](res)
  1589. }
  1590. }
  1591. }
  1592. });
  1593. } else {
  1594. that[that.dialogFormsOptions.models].loading = false;
  1595. that.$message({message: res.message, type: 'error', duration: 1500});
  1596. }
  1597. });
  1598. },
  1599. dialogFormsRequestsAfter: function () {
  1600. return true;
  1601. },
  1602. dialogFormsRequestsErrors: function () {
  1603. var that = this;
  1604. },
  1605. dialogFormsValidateErrors: function (forms) {
  1606. var that = this;
  1607. },
  1608. dialogListPageFormsOpens:function (model) {
  1609. var that = this;
  1610. var __table = that[model].model.__table;
  1611. $Request.postJson('/admin/arts/setup/pageGetSetup', {__table: __table}, function (res) {
  1612. if(res.code === 200){
  1613. if(res.result && !Array.isArray(res.result)) {
  1614. that[model].model = res.result;
  1615. }
  1616. that[model].model.__table = __table;
  1617. }
  1618. that.dialogFormsOpens(model);
  1619. })
  1620. }
  1621. },
  1622. mounted: function () {
  1623. },
  1624. beforeCreate: function () {
  1625. var that = this;
  1626. },
  1627. created: function () {
  1628. var that = this;
  1629. }
  1630. };
  1631. var $Login = {
  1632. data: function () {
  1633. return {}
  1634. },
  1635. methods: {
  1636. hasClass: function (elem, cls) {
  1637. cls = cls || '';
  1638. if (cls.replace(/\s/g, '').length == 0) return false; //当cls没有参数时,返回false
  1639. return new RegExp(' ' + cls + ' ').test(' ' + elem.className + ' ');
  1640. },
  1641. addClass(ele, cls) {
  1642. if (!this.hasClass(ele, cls)) {
  1643. ele.className = ele.className == '' ? cls : ele.className + ' ' + cls;
  1644. }
  1645. },
  1646. removeClass(ele, cls) {
  1647. if (this.hasClass(ele, cls)) {
  1648. var newClass = ' ' + ele.className.replace(/[\t\r\n]/g, '') + ' ';
  1649. while (newClass.indexOf(' ' + cls + ' ') >= 0) {
  1650. newClass = newClass.replace(' ' + cls + ' ', ' ');
  1651. }
  1652. ele.className = newClass.replace(/^\s+|\s+$/g, '');
  1653. }
  1654. },
  1655. removeLocal(){
  1656. Cookies.remove('9ca8e8d13b4369cddfdab26c63d69ce2');
  1657. Cookies.remove('f63dcfe3c89a14e80c9cdf60b4b94f4b');
  1658. localStorage.clear();
  1659. sessionStorage.clear();
  1660. }
  1661. },
  1662. beforeCreate: function () {
  1663. },
  1664. created: function () {
  1665. },
  1666. mounted: function () {
  1667. //设置主体
  1668. var $theme = Cookies.get('theme');
  1669. this.themeCommandEvent($theme ? $theme : 'index');
  1670. }
  1671. };
  1672. var $TableDialog = {
  1673. data: function () {
  1674. return {
  1675. tableDialog:{
  1676. model: 'dialog'
  1677. }
  1678. }
  1679. },
  1680. methods: {
  1681. formatTableDialogColumn: function (row, column, value) {},
  1682. tablesDialogCellMoveEvent: function (row, column, cell, event) {
  1683. var that = this;
  1684. if (column.filterPlacement === 'false' || !that[that.tableDialog.models].options.cell) {
  1685. return false;
  1686. }
  1687. event.stopPropagation();
  1688. if ($(cell).find('.cell').hasClass('Va-table-move')) {
  1689. return false;
  1690. } else {
  1691. $('.cell').removeClass('Va-table-move');
  1692. $('.Va-table-move-close').remove();
  1693. if (!row[column.property]) {
  1694. return false;
  1695. }
  1696. $(cell).find('.cell').append('<i class="el-icon-close Va-table-move-close" onclick="removeTableMoveEvent(this)"></i>');
  1697. $(cell).find('.cell').addClass('Va-table-move');
  1698. if (($(cell).width() - 20) > $(cell).parent().find('.Va-table-move').width()) {
  1699. $('.cell').removeClass('Va-table-move');
  1700. $('.Va-table-move-close').remove();
  1701. }
  1702. }
  1703. },
  1704. tablesDialogPaginationSizeChange: function (size) {
  1705. var that = this;
  1706. that[that.tableDialog.models].pagination.size = size;
  1707. that.tablesDialogGetTableList();
  1708. },
  1709. tablesDialogPaginationCurrentChange: function (page) {
  1710. var that = this;
  1711. that[that.tableDialog.models].pagination.page = page;
  1712. that.$refs.formContainerTables.clearSelection();
  1713. that.tablesDialogGetTableList();
  1714. },
  1715. /*排序发生改变时触发*/
  1716. tablesDialogPaginationSortChange: function (rows) {
  1717. var that = this;
  1718. that.$set(that[that.tableDialog.models], 'orderBy', rows.orderBy);
  1719. if (typeof rows.column.sortBy === 'undefined') {
  1720. that.$set(that[that.tableDialog.models], 'prop', rows.prop);
  1721. } else {
  1722. that.$set(that[that.tableDialog.models], 'prop', rows.column.sortBy);
  1723. }
  1724. that.tablesDialogGetTableList();
  1725. },
  1726. /*多选发生改变时触发*/
  1727. tablesDialogSelectChange: function (rows) {
  1728. var that = this;
  1729. that.selects = rows;
  1730. that.$set(that[that.tableDialog.models], 'selects', rows);
  1731. },
  1732. tablesDialogClearSelect: function () {
  1733. var that = this;
  1734. that.$nextTick(function () {
  1735. that.$refs.formContainerTables.clearSelection();
  1736. })
  1737. },
  1738. getTablesDialogSelected: function () {
  1739. var that = this;
  1740. if (!that[that.tableDialog.models].selects.length || that[that.tableDialog.models].selects.length <= 0) {
  1741. return [];
  1742. }
  1743. var selects_ids = [];
  1744. that[that.tableDialog.models].selects.forEach(function (item, index) {
  1745. selects_ids.push(item.id);
  1746. });
  1747. if (!selects_ids || selects_ids.length <= 0) {
  1748. return [];
  1749. }
  1750. return selects_ids;
  1751. },
  1752. tablesDialogGetTableList: function (model) {
  1753. var that = this;
  1754. if (model && typeof model == 'string') that.tableDialog.models = model;
  1755. if (!that.tablesDialogGetTableListFront()) {
  1756. return false;
  1757. }
  1758. if (!that[that.tableDialog.models].url) {
  1759. that[that.tableDialog.models].url = window.location.href;
  1760. }
  1761. that[that.tableDialog.models].options.loading = true;
  1762. that[that.tableDialog.models].search.page = that[that.tableDialog.models].pagination.page;
  1763. that[that.tableDialog.models].search.size = that[that.tableDialog.models].pagination.size;
  1764. that[that.tableDialog.models].search.orderBy = that[that.tableDialog.models].orderBy;
  1765. that[that.tableDialog.models].search.prop = that[that.tableDialog.models].prop;
  1766. $Request.postJson(that[that.tableDialog.models].url, that[that.tableDialog.models].search, function (res) {
  1767. if (that.tablesDialogGetTablesListsAfter(res)) {
  1768. if ((typeof (res) === 'undefined')) {
  1769. return false;
  1770. }
  1771. if ((typeof (res.result) === 'undefined')) {
  1772. return false;
  1773. }
  1774. that[that.tableDialog.models].options.loading = false;
  1775. that[that.tableDialog.models].data = res.result.rows ? res.result.rows : res.result.data;
  1776. that[that.tableDialog.models].pagination.total = res.result.total;
  1777. }
  1778. that.tablesDialogGetTablesListsFinish(res);
  1779. })
  1780. },
  1781. tablesDialogGetTableListFront: function () {
  1782. return true;
  1783. },
  1784. tablesDialogGetTablesListsAfter: function () {
  1785. return true;
  1786. },
  1787. tablesDialogGetTablesListsFinish: function () {
  1788. return true;
  1789. },
  1790. tablesDialogRowsRemove: function (model, rows, params) {
  1791. var that = this;
  1792. if (model && typeof model == 'string') that.tableDialog.models = model;
  1793. if (!that[that.tableDialog.models].remove.url) {
  1794. return false;
  1795. }
  1796. var requestData = {};
  1797. if (params) {
  1798. requestData = params;
  1799. }
  1800. that[that.tableDialog.models].remove.msg = that[that.tableDialog.models].remove.msg ? that[that.tableDialog.models].remove.msg : '确认删除当前数据吗?';
  1801. that[that.tableDialog.models].remove.field = that[that.tableDialog.models].remove.field ? that[that.tableDialog.models].remove.field : 'id';
  1802. if (!rows[that.tables.remove.field]) {
  1803. return false;
  1804. }
  1805. requestData[that[that.tableDialog.models].remove.field] = rows[that[that.tableDialog.models].remove.field];
  1806. that.$confirm(that[that.tableDialog.models].remove.msg, '操作提示', {
  1807. confirmButtonText: '确定',
  1808. cancelButtonText: '取消',
  1809. type: 'warning',
  1810. center: true,
  1811. dangerouslyUseHTMLString: true,
  1812. lockScroll: false,
  1813. }).then(function () {
  1814. $Request.postJson(that[that.tableDialog.models].remove.url, requestData, function (res) {
  1815. if (res.code === 200) {
  1816. that.$message({
  1817. message: res.message, type: 'success', duration: 2400, onClose: function () {
  1818. }
  1819. });
  1820. that.tablesDialogGetTableList();
  1821. } else {
  1822. that.$message({
  1823. message: res.message, type: 'error', duration: 2400, onClose: function () {
  1824. }
  1825. });
  1826. }
  1827. })
  1828. }).catch(function () {
  1829. });
  1830. },
  1831. tablesDialogRowsStatus: function (model, rows, params) {
  1832. var that = this;
  1833. if (model && typeof model == 'string') that.tableDialog.models = model;
  1834. if (!that[that.tableDialog.models].status.url || !that[that.tableDialog.models].status.field) {
  1835. return false;
  1836. }
  1837. if (!rows[that[that.tableDialog.models].status.field] && rows[that[that.tableDialog.models].status.field] !== 0) {
  1838. return false;
  1839. }
  1840. if (!that[that.tableDialog.models].status.maps[rows[that[that.tableDialog.models].status.field]]) {
  1841. return false;
  1842. }
  1843. that[that.tableDialog.models].status.msg = '确认' + that[that.tableDialog.models].status.maps[rows[that[that.tableDialog.models].status.field]] + '当前数据吗?';
  1844. var requestData = {};
  1845. if (params) {
  1846. requestData = params;
  1847. }
  1848. requestData[that[that.tableDialog.models].status.field] = rows[that[that.tableDialog.models].status.field];
  1849. that.$confirm(that[that.tableDialog.models].status.msg, '操作提示', {
  1850. confirmButtonText: '确定',
  1851. cancelButtonText: '取消',
  1852. type: 'warning',
  1853. center: false,
  1854. dangerouslyUseHTMLString: true,
  1855. lockScroll: false,
  1856. }).then(function () {
  1857. $Request.postJson(that[that.tableDialog.models].status.url, requestData, function (res) {
  1858. if (res.code === 200) {
  1859. that.$message({
  1860. message: res.message, type: 'success', duration: 2400, onClose: function () {
  1861. }
  1862. });
  1863. that.tablesDialogGetTableList();
  1864. } else {
  1865. that.$message({
  1866. message: res.message, type: 'error', duration: 2400, onClose: function () {
  1867. }
  1868. });
  1869. }
  1870. })
  1871. }).catch(function () {
  1872. });
  1873. },
  1874. tablesDialogRowsSort: function (model, rows) {
  1875. var that = this;
  1876. if (model && typeof model == 'string') that.tableDialog.models = model;
  1877. if (!that[that.tableDialog.models].sort.url) {
  1878. return false;
  1879. }
  1880. var requestData = {};
  1881. that[that.tableDialog.models].sort.field = that[that.tableDialog.models].sort.field ? that[that.tableDialog.models].sort.field : 'id';
  1882. that[that.tableDialog.models].sort.item = that[that.tableDialog.models].sort.item ? that[that.tableDialog.models].sort.item : 'sort';
  1883. if (!rows[that[that.tableDialog.models].sort.field]) {
  1884. return false;
  1885. }
  1886. if (!rows[that[that.tableDialog.models].sort.item]) {
  1887. return false;
  1888. }
  1889. requestData[that[that.tableDialog.models].sort.field] = rows[that[that.tableDialog.models].sort.field];
  1890. requestData[that[that.tableDialog.models].sort.item] = rows[that[that.tableDialog.models].sort.item];
  1891. $Request.postJson(that[that.tableDialog.models].sort.url, requestData, function (res) {
  1892. if (res.code === 200) {
  1893. that.$message({message: res.message, type: 'success', duration: 2100});
  1894. that.tablesDialogGetTableList();
  1895. } else {
  1896. that.$message({message: res.message, type: 'error', duration: 2100});
  1897. }
  1898. })
  1899. },
  1900. tablesDialogRowsType: function (rows) {
  1901. var that = this;
  1902. if (model && typeof model == 'string') that.tableDialog.models = model;
  1903. if (!that[that.tableDialog.models].type.url) {
  1904. return false;
  1905. }
  1906. var requestData = {};
  1907. that[that.tableDialog.models].type.field = that[that.tableDialog.models].type.field ? that[that.tableDialog.models].type.field : 'id';
  1908. that[that.tableDialog.models].type.item = that[that.tableDialog.models].type.item ? that[that.tableDialog.models].type.item : 'type';
  1909. if (!rows[that[that.tableDialog.models].type.field]) {
  1910. return false;
  1911. }
  1912. if (!rows[that[that.tableDialog.models].type.item]) {
  1913. return false;
  1914. }
  1915. requestData[that[that.tableDialog.models].type.field] = rows[that[that.tableDialog.models].type.field];
  1916. requestData[that[that.tableDialog.models].type.item] = rows[that[that.tableDialog.models].type.item];
  1917. $Request.postJson(that[that.tableDialog.models].type.url, requestData, function (res) {
  1918. if (res.code === 200) {
  1919. that.$message({message: res.message, type: 'success', duration: 2100});
  1920. that.tablesDialogGetTableList();
  1921. } else {
  1922. that.$message({message: res.message, type: 'error', duration: 2100});
  1923. }
  1924. })
  1925. },
  1926. tablesDialogSearchEvent: function (model) {
  1927. var that = this;
  1928. if (model && typeof model == 'string') that.tableDialog.models = model;
  1929. that[that.tableDialog.models].pagination.page = 1;
  1930. that.tablesDialogGetTableList();
  1931. },
  1932. tablesDialogResetsEvent: function () {},
  1933. },
  1934. mounted: function () {},
  1935. beforeCreate: function () {},
  1936. created: function () {}
  1937. };
  1938. window.$Utils = {
  1939. formatDate: function (fmt, time) {
  1940. time = time ? time * 1000 : (new Date()).getTime();
  1941. var date = new Date(parseInt(time));
  1942. var o = {
  1943. "M+": date.getMonth() + 1,
  1944. "d+": date.getDate(),
  1945. "h+": date.getHours(),
  1946. "m+": date.getMinutes(),
  1947. "s+": date.getSeconds(),
  1948. "q+": Math.floor((date.getMonth() + 3) / 3),
  1949. "S": date.getMilliseconds()
  1950. };
  1951. if (/(y+)/.test(fmt))
  1952. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  1953. for (var k in o)
  1954. if (new RegExp("(" + k + ")").test(fmt))
  1955. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  1956. return fmt;
  1957. },
  1958. /*加密数据*/
  1959. encrypt: function (str, KEY, IV) {
  1960. if (!str) return false;
  1961. KEY = KEY ? KEY : $Public.request.key;
  1962. IV = IV ? IV : $Public.request.iv;
  1963. var key = CryptoJS.enc.Utf8.parse(KEY);
  1964. var iv = CryptoJS.enc.Utf8.parse(IV);
  1965. var encrypted = CryptoJS.AES.encrypt(str, key, {
  1966. iv: iv,
  1967. mode: CryptoJS.mode.CBC,
  1968. padding: CryptoJS.pad.Pkcs7
  1969. });
  1970. return encrypted.toString();
  1971. },
  1972. /*解密数据*/
  1973. decrypt: function (str, KEY, IV) {
  1974. if (!str) return false;
  1975. KEY = KEY ? KEY : $Public.request.key;
  1976. IV = IV ? IV : $Public.request.iv;
  1977. var key = CryptoJS.enc.Utf8.parse(KEY);
  1978. var iv = CryptoJS.enc.Utf8.parse(IV);
  1979. var decrypted = CryptoJS.AES.decrypt(str, key, {
  1980. iv: iv,
  1981. padding: CryptoJS.pad.Pkcs7
  1982. });
  1983. return decrypted.toString(CryptoJS.enc.Utf8);
  1984. },
  1985. getUrlParams: function (name)
  1986. {
  1987. return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) || null
  1988. }
  1989. };
  1990. window.$Public = {
  1991. request: {
  1992. key: '5B9ADC14C705F1B041DDC2D9B16A2D94',
  1993. iv: '33092152342590AD',
  1994. encrypt: true,
  1995. debug: true,
  1996. }
  1997. };
  1998. window.$Validator = {
  1999. json: function (str) {
  2000. if (typeof str == 'string') {
  2001. try {
  2002. var obj = JSON.parse(str);
  2003. if (typeof obj == 'object' && obj) {
  2004. return true;
  2005. } else {
  2006. return false;
  2007. }
  2008. } catch (e) {
  2009. return false;
  2010. }
  2011. } else {
  2012. return false;
  2013. }
  2014. },
  2015. typeOf: function (str, type) {
  2016. if ((typeof str) === type) {
  2017. return true;
  2018. } else {
  2019. return false;
  2020. }
  2021. }
  2022. };
  2023. window.$Gallery = {
  2024. GalleryDialogOpen: function (options) {
  2025. $App.GalleryParams.options = Object.assign({
  2026. max: 10,//上传条数
  2027. size: 20, //上传大小
  2028. type: '1',//文件类型;1:图片;2:视频;3:音频;4:文件;5:图标;20:网页
  2029. tabs: false,//是否使用多标签菜单
  2030. suffix: '', //上传类型
  2031. multiple: true, //多选
  2032. file_name: '',
  2033. callback: function (result) {
  2034. },
  2035. }, options);
  2036. $Gallery.GalleryUploadToken($App.GalleryParams.options.type);
  2037. $Gallery.GalleryUploadInit();
  2038. $App.GalleryParams.operation.dialog = true;
  2039. },
  2040. GalleryDialogPages: function (options) {
  2041. $App.GalleryParams.selected = [];
  2042. $App.GalleryParams.search.keyword = '';
  2043. $App.GalleryParams.options = Object.assign({
  2044. max: 1,//上传条数
  2045. size: 20, //上传大小
  2046. type: '1',//文件类型;1:图片;2:视频;3:音频;4:文件;5:图标;20:网页
  2047. tabs: false,//是否使用多标签菜单
  2048. suffix: '', //上传类型
  2049. multiple: false, //多谢
  2050. callback: function (result) {
  2051. },
  2052. }, options);
  2053. $Gallery.GalleryUploadToken($App.GalleryParams.options.type);
  2054. $Gallery.GalleryUploadInit();
  2055. },
  2056. GalleryUploadToken: function (callback, type) {
  2057. type = type ? type : $App.GalleryParams.options.type;
  2058. $Request.postJson('/admin/framework/common/uploadToken', {type: type}, function (res) {
  2059. if (res.code === 200) {
  2060. if ($Validator.typeOf(callback, 'function')) {
  2061. callback(res.result);
  2062. return true;
  2063. }
  2064. if (res.result.driver === "qiniu") {
  2065. $App.GalleryParams.driver = res.result.driver;
  2066. $App.GalleryParams.action = res.result.action;
  2067. $App.GalleryParams.domain = res.result.domain;
  2068. $App.GalleryParams.postData.token = res.result.token;
  2069. if (res.result.key) {
  2070. $App.GalleryParams.postData.key = res.result.key;
  2071. }
  2072. if (res.result.save_path) {
  2073. // TODO
  2074. }
  2075. }
  2076. if (res.result.driver === "oss") {
  2077. $App.GalleryParams.driver = res.result.driver;
  2078. $App.GalleryParams.action = res.result.ssl + '://' + res.result.domain;
  2079. $App.GalleryParams.domain = res.result.ssl + '://' + res.result.domain;
  2080. $App.GalleryParams.postData.OSSAccessKeyId = res.result.accessKeyId;
  2081. $App.GalleryParams.postData.policy = res.result.policy;
  2082. $App.GalleryParams.postData.Signature = res.result.signature;
  2083. // $App.GalleryParams.postData['x-oss-security-token'] = res.result.stsToken;
  2084. $App.GalleryParams.postData.bucket = res.result.bucket;
  2085. $App.GalleryParams.postData.region = res.result.region;
  2086. $App.GalleryParams.postData.success_action_status = 200;
  2087. if (res.result.save_path) {
  2088. // TODO
  2089. }
  2090. }
  2091. if (res.result.driver === "cos"){
  2092. // console.log(res.result)
  2093. $App.GalleryParams.driver = res.result.driver;
  2094. $App.GalleryParams.action = res.result.ssl + '://' + res.result.domain;
  2095. $App.GalleryParams.domain = res.result.ssl + '://' + res.result.domain;
  2096. $App.GalleryParams.postData.policy = res.result.policy;
  2097. $App.GalleryParams.postData.success_action_status = 200;
  2098. $App.GalleryParams.postData['q-sign-algorithm'] = res.result.q_sign_algorithm;
  2099. $App.GalleryParams.postData['q-ak'] = res.result.q_ak;
  2100. $App.GalleryParams.postData['q-key-time'] = res.result.q_key_time;
  2101. $App.GalleryParams.postData['q-signature'] = res.result.q_signature;
  2102. if (res.result.key) {
  2103. $App.GalleryParams.postData.key = res.result.key;
  2104. }
  2105. if (res.result.save_path) {
  2106. // TODO
  2107. }
  2108. }
  2109. if (res.result.driver === 'local') {
  2110. $App.GalleryParams.action = '/admin/framework/common/gallery/upload';
  2111. }
  2112. } else {
  2113. callback(false);
  2114. }
  2115. })
  2116. },
  2117. GalleryUploadInit: function () {
  2118. var that = this;
  2119. $App.GalleryParams.selected = [];
  2120. $App.GalleryParams.search.keyword = '';
  2121. $App.GalleryParams.search.page = 1;
  2122. $App.GalleryParams.search.size = 12;
  2123. $App.GalleryParams.options.upload = true;
  2124. $App.GalleryParams.options.suffix = '';
  2125. $App.GalleryParams.options.addPage = '';
  2126. $App.GalleryParams.options.addIcon = '';
  2127. switch (parseInt($App.GalleryParams.options.type)) {
  2128. case 1://图片
  2129. $App.GalleryParams.options.suffix = $App.GalleryParams.options.suffix ?
  2130. $App.GalleryParams.options.suffix : 'bmp,gif,jpg,jpeg,png';
  2131. break;
  2132. case 2://视频
  2133. $App.GalleryParams.options.suffix = $App.GalleryParams.options.suffix ?
  2134. $App.GalleryParams.options.suffix : 'mp3,wma,avi,rm,rmvb,flv,mpg,mov,mk,mp4';
  2135. break;
  2136. case 3://文件
  2137. $App.GalleryParams.options.suffix = $App.GalleryParams.options.suffix ?
  2138. $App.GalleryParams.options.suffix : 'doc,docx,xls,xlsx,xlsm,xlt,csv';
  2139. break;
  2140. case 4://网页
  2141. $App.GalleryParams.options.suffix = '';
  2142. $App.GalleryParams.options.upload = false;
  2143. $App.GalleryParams.options.addPage = true;
  2144. $App.GalleryParams.options.addIcon = false;
  2145. $App.GalleryParams.search.size = 7;
  2146. break;
  2147. case 5://音频
  2148. break;
  2149. case 20:
  2150. $App.GalleryParams.options.suffix = '';
  2151. $App.GalleryParams.options.upload = false;
  2152. $App.GalleryParams.options.addIcon = true;
  2153. $App.GalleryParams.options.addPage = false;
  2154. break;
  2155. default:
  2156. }
  2157. $App.GalleryParams.search.type = $App.GalleryParams.options.type;
  2158. $App.GalleryParams.imagesItems = [];
  2159. $App.GalleryParams.operation.imageTotal = 0;
  2160. $App.GalleryParams.search.group_id = 0;
  2161. $Gallery.GalleryUploadParams();
  2162. $Gallery.GalleryRequestLists();
  2163. },
  2164. GalleryUploadParams: function () {
  2165. $App.GalleryParams.postData = {
  2166. type: $App.GalleryParams.options.type,
  2167. size: $App.GalleryParams.options.size,
  2168. suffix: $App.GalleryParams.options.suffix,
  2169. max: $App.GalleryParams.options.max,
  2170. group_id: $App.GalleryParams.search.group_id,
  2171. dir: '',
  2172. file_name: $App.GalleryParams.options.file_name
  2173. };
  2174. },
  2175. GalleryUploadProgress: function (event, file, fileList) {
  2176. if ($App.GalleryParams.operation.error === false) {
  2177. $App.GalleryParams.operation.loading = true;
  2178. $App.GalleryParams.operation.loadingMsg = '文件正在上传 (' + parseFloat((event.percent).toFixed(2)) + '%), 请稍后...';
  2179. }
  2180. },
  2181. GalleryUploadSuccess: function (response, file, fileList) {
  2182. let params = {};
  2183. // console.log('size:',$App.GalleryParams.size)
  2184. switch ($App.GalleryParams.driver) {
  2185. case 'qiniu':
  2186. response.group_id = $App.GalleryParams.search.group_id;
  2187. response.type = $App.GalleryParams.search.type;
  2188. response.code = 200;
  2189. response.url = $App.GalleryParams.domain + '/' + response.key;
  2190. response.file_name = $App.GalleryParams.options.file_name;
  2191. response.size = $App.GalleryParams.size;
  2192. if (response.code === 200) {
  2193. $Request.postJson('/admin/framework/common/gallery/insert', response, function (res) {
  2194. if (res.code !== 200) {
  2195. $App.$Message(res.message, 'warning');
  2196. return true;
  2197. }
  2198. $App.$Message('文件上传成功!');
  2199. $App.GalleryParams.operation.loadingMsg = '';
  2200. $App.GalleryParams.operation.loading = false;
  2201. $App.$refs.GalleryDialogUpload.clearFiles();
  2202. $App.GalleryParams.search.page = 1;
  2203. $Gallery.GalleryRequestLists();
  2204. $Gallery.GalleryUploadToken($App.GalleryParams.options.type);
  2205. });
  2206. }
  2207. break;
  2208. case'oss':
  2209. case'cos':
  2210. params.group_id = $App.GalleryParams.search.group_id;
  2211. params.type = $App.GalleryParams.search.type;
  2212. params.code = 200;
  2213. params.url = $App.GalleryParams.domain + '/' + $App.GalleryParams.postData.key;
  2214. params.file_name = $App.GalleryParams.options.file_name;
  2215. params.size = $App.GalleryParams.size;
  2216. params.driver = $App.GalleryParams.driver;
  2217. params.key = $App.GalleryParams.postData.key;
  2218. if (params.code === 200){
  2219. $Request.postJson('/admin/framework/common/gallery/insert', params, function (res) {
  2220. if (res.code !== 200) {
  2221. $App.$Message(res.message, 'warning');
  2222. return true;
  2223. }
  2224. $App.$Message('文件上传成功!');
  2225. $App.GalleryParams.operation.loadingMsg = '';
  2226. $App.GalleryParams.operation.loading = false;
  2227. $App.$refs.GalleryDialogUpload.clearFiles();
  2228. $App.GalleryParams.search.page = 1;
  2229. $Gallery.GalleryRequestLists();
  2230. $Gallery.GalleryUploadToken($App.GalleryParams.options.type);
  2231. });
  2232. }
  2233. break;
  2234. // case'cos':
  2235. // params.group_id = $App.GalleryParams.search.group_id;
  2236. // params.type = $App.GalleryParams.search.type;
  2237. // params.code = 200;
  2238. // params.url = $App.GalleryParams.domain + '/' + $App.GalleryParams.postData.key;
  2239. // params.file_name = $App.GalleryParams.options.file_name;
  2240. // params.size = $App.GalleryParams.postData.size;
  2241. // params.driver = $App.GalleryParams.driver;
  2242. // params.key = $App.GalleryParams.postData.key;
  2243. // if (params.code === 200){
  2244. // $Request.postJson('/admin/framework/common/gallery/insert', params, function (res) {
  2245. // if (res.code !== 200) {
  2246. // $App.$Message(res.message, 'warning');
  2247. // return true;
  2248. // }
  2249. // $App.$Message('文件上传成功!');
  2250. // $App.GalleryParams.operation.loadingMsg = '';
  2251. // $App.GalleryParams.operation.loading = false;
  2252. // $App.$refs.GalleryDialogUpload.clearFiles();
  2253. // $App.GalleryParams.search.page = 1;
  2254. // $Gallery.GalleryRequestLists();
  2255. // $Gallery.GalleryUploadToken($App.GalleryParams.options.type);
  2256. // });
  2257. // }
  2258. // break;
  2259. default:
  2260. $App.GalleryParams.operation.loadingMsg = '';
  2261. $App.GalleryParams.operation.loading = false;
  2262. $App.$refs.GalleryDialogUpload.clearFiles();
  2263. if (response.code !== 200) {
  2264. $App.$Message(response.message, 'warning');
  2265. return true;
  2266. } else {
  2267. $App.$Message('文件上传成功!');
  2268. $App.GalleryParams.search.page = 1;
  2269. $Gallery.GalleryRequestLists();
  2270. break;
  2271. }
  2272. }
  2273. },
  2274. GalleryUploadError: function () {
  2275. var that = this;
  2276. $App.$Message('文件上传失败,请重试!', 'warning');
  2277. $App.GalleryParams.operation.loadingMsg = '';
  2278. $App.GalleryParams.operation.loading = false;
  2279. // that.GalleryUploadParams();
  2280. // $App.$refs.GalleryDialogUpload.clearFiles();
  2281. },
  2282. GalleryUploadBefore: function (file) {
  2283. $App.GalleryParams.size = file.size;
  2284. return new Promise(async (resolve, reject) => {
  2285. /*验证图片大小*/
  2286. if ($App.GalleryParams.options.size) {
  2287. if ((file.size / 1048576) > $App.GalleryParams.options.size) {
  2288. $App.$Message('请上传' + $App.GalleryParams.options.size + 'M以内的文件', 'warning');
  2289. $Gallery.GalleryCloseOperationLoading();
  2290. return reject();
  2291. }
  2292. }
  2293. /*验证文件后缀*/
  2294. if ($App.GalleryParams.options.suffix) {
  2295. var args = ((file.name).split('.'));
  2296. if (args[args.length - 1]) {
  2297. var args_suffix = (args[args.length - 1]).toLowerCase();
  2298. var suffix = ($App.GalleryParams.options.suffix).split(',');
  2299. if ($.inArray(args_suffix, suffix) < 0) {
  2300. $App.$Message('请上传' + $App.GalleryParams.options.suffix + '类型的文件', 'warning');
  2301. $Gallery.GalleryCloseOperationLoading();
  2302. return reject();
  2303. }
  2304. }
  2305. }
  2306. $App.GalleryParams.options.file_name = file.name;
  2307. $App.GalleryParams.postData.file_name = file.name;
  2308. $App.GalleryParams.operation.loadingMsg = '文件正在上传 (0%), 请稍后...';
  2309. $App.GalleryParams.operation.loading = true;
  2310. await $Gallery.GalleryGetFileKey().catch(err => {
  2311. $App.$Message('操作失败!');
  2312. $Gallery.GalleryCloseOperationLoading();
  2313. return reject();
  2314. });
  2315. switch ($App.GalleryParams.driver) {
  2316. case 'qiniu':
  2317. break;
  2318. case 'oss':
  2319. // console.log('oss',$App.GalleryParams.postData);
  2320. break;
  2321. default:
  2322. break;
  2323. }
  2324. $App.GalleryParams.operation.error = false
  2325. return resolve();
  2326. })
  2327. },
  2328. GalleryCloseOperationLoading: function () {
  2329. setTimeout(function () {
  2330. $App.$refs.GalleryDialogUpload.clearFiles();
  2331. $App.GalleryParams.operation.loadingMsg = '';
  2332. $App.GalleryParams.operation.loading = false;
  2333. $App.GalleryParams.operation.error = true;
  2334. $App.GalleryParams.search.page = 1;
  2335. $Gallery.GalleryRequestLists();
  2336. $Gallery.GalleryUploadToken($App.GalleryParams.options.type);
  2337. }, 1000)
  2338. },
  2339. // 获取文件地址
  2340. GalleryGetFileKey() {
  2341. return new Promise(function (resolve, reject) {
  2342. switch ($App.GalleryParams.driver) {
  2343. case 'qiniu':
  2344. case 'oss':
  2345. case 'cos':
  2346. $Request.postJson('/admin/framework/common/getFileKey', $App.GalleryParams.postData, function (res) {
  2347. if (res.code !== 200) {
  2348. $App.$Message(res.message, 'warning');
  2349. reject()
  2350. return false;
  2351. }
  2352. $App.GalleryParams.postData.key = res.result.key;
  2353. resolve()
  2354. });
  2355. break;
  2356. default:
  2357. resolve()
  2358. return true;
  2359. }
  2360. })
  2361. },
  2362. GalleryUploadDialogClose: function () {
  2363. $App.GalleryParams.selected = [];
  2364. $App.GalleryParams.operation.loadingMsg = '';
  2365. $App.GalleryParams.operation.loading = false;
  2366. $App.GalleryParams.operation.dialog = false;
  2367. },
  2368. GalleryUploadDialogSubmit: function () {
  2369. var that = this;
  2370. var selected = $App.GalleryParams.selected;
  2371. if (selected.length <= 0) {
  2372. $App.$Message('请选择文件!', 'warning');
  2373. return false;
  2374. }
  2375. if (!$App.GalleryParams.options.multiple) {
  2376. selected = selected[0];
  2377. }
  2378. $App.GalleryParams.options.callback(selected);
  2379. $App.GalleryParams.selected = [];
  2380. $App.GalleryParams.operation.loading = false;
  2381. $App.GalleryParams.operation.dialog = false;
  2382. },
  2383. GalleryGroupChangeEvent: function (item) {
  2384. $.each($App.GalleryParams.groupItems, function (key, val) {
  2385. val.active = false;
  2386. });
  2387. item.active = true;
  2388. $App.GalleryParams.imagesItems = [];
  2389. $App.GalleryParams.search.page = 1;
  2390. $App.GalleryParams.operation.imageTotal = 0;
  2391. $App.GalleryParams.search.group_id = item.id;
  2392. $Gallery.GalleryRequestLists();
  2393. },
  2394. GalleryGroupRemoveEvent: function (index, item) {
  2395. $App.$Confirm('确认删除当前分组吗?', function (res) {
  2396. $Request.postJson('/admin/framework/common/gallery/groupRemove', {
  2397. id: item.id
  2398. }, function (res) {
  2399. if (res.code === 200) {
  2400. $App.$message({message: res.message, type: 'success', duration: 2400});
  2401. $Gallery.GalleryRequestLists();
  2402. } else {
  2403. $App.$message({message: res.message, type: 'error', duration: 2400});
  2404. }
  2405. });
  2406. });
  2407. },
  2408. GalleryRemotePictureEvent: function () {
  2409. var that = this;
  2410. $App.GalleryParams.operation.loading = true;
  2411. $App.$prompt('', '图片地址', {
  2412. confirmButtonText: '确定',
  2413. cancelButtonText: '取消',
  2414. inputValue: '',
  2415. lockScroll: false,
  2416. inputPlaceholder: '请输入图片地址',
  2417. inputValidator: function (e) {
  2418. return $Validator.image(e);
  2419. },
  2420. inputErrorMessage: '请输入图片地址',
  2421. }).then(function (result) {
  2422. if (!result.value) {
  2423. $App.$message({type: 'error', message: '请输入图片地址!'});
  2424. return false;
  2425. }
  2426. $App.GalleryParams.postData._value = result.value;
  2427. $Request.postJson('/admin/framework/common/gallery/remote', $App.GalleryParams.postData, function (res) {
  2428. if (res.code === 200) {
  2429. $App.$message({message: '图片保存成功!', type: 'success', duration: 2400});
  2430. $Gallery.GalleryRequestLists();
  2431. that.GalleryUploadParams();
  2432. } else {
  2433. $App.$message({message: res.message, type: 'error', duration: 2400});
  2434. }
  2435. $App.GalleryParams.operation.loading = false;
  2436. });
  2437. }).catch(function () {
  2438. $App.GalleryParams.operation.loading = false;
  2439. });
  2440. },
  2441. GalleryAddPageEvent: function (item, is_update) {
  2442. var params = {
  2443. confirmButtonText: '确定',
  2444. cancelButtonText: '取消',
  2445. lockScroll: false,
  2446. inputPlaceholder: '网页地址规则:网页名称,网页地址',
  2447. inputErrorMessage: '请输入图片地址',
  2448. };
  2449. if (is_update && item.id) {
  2450. params.inputValue = item.original + ',' + item.url;
  2451. }
  2452. $App.$prompt('', '网页地址', params).then(function (result) {
  2453. if (!result.value) {
  2454. $App.$message({type: 'error', message: '请输入网页地址!'});
  2455. return false;
  2456. }
  2457. $App.GalleryParams.postData._value = result.value;
  2458. if (is_update && item.id) {
  2459. $App.GalleryParams.postData._id = item.id;
  2460. $App.GalleryParams.postData._is_update = 1;
  2461. }
  2462. $App.GalleryParams.postData._value = result.value;
  2463. $Request.postJson('/admin/framework/common/gallery/pages', $App.GalleryParams.postData, function (res) {
  2464. if (res.code === 200) {
  2465. $App.$message({message: res.message, type: 'success', duration: 2400});
  2466. $Gallery.GalleryRequestLists();
  2467. } else {
  2468. $App.$message({message: res.message, type: 'error', duration: 2400});
  2469. }
  2470. });
  2471. }).catch(function () {
  2472. });
  2473. },
  2474. GalleryItemUpdateOriginalEvent: function (item) {
  2475. $App.$prompt('', '修改文件名', {
  2476. confirmButtonText: '确定',
  2477. cancelButtonText: '取消',
  2478. inputPlaceholder: '请输入文件名',
  2479. inputValue: item.original,
  2480. lockScroll: false,
  2481. closeOnClickModal: false,
  2482. }).then(function (params) {
  2483. if (!params.value) {
  2484. $App.$message({message: '请输入文件名!', type: 'error', duration: 2400});
  2485. } else {
  2486. $Request.postJson('/admin/framework/common/gallery/original', {
  2487. id: item.id, name: params.value
  2488. }, function (res) {
  2489. if (res.code === 200) {
  2490. $App.$message({message: '文件名修改成功!', type: 'success', duration: 2400});
  2491. $Gallery.GalleryRequestLists();
  2492. } else {
  2493. $App.$message({message: '文件名修改失败,请稍后再试!', type: 'error', duration: 2400});
  2494. }
  2495. })
  2496. }
  2497. }).catch(function () {
  2498. });
  2499. },
  2500. GalleryItemRemoveEvent: function (item) {
  2501. $App.$confirm('确认删除当前数据吗?删除后不可恢复!', '操作提示', {
  2502. confirmButtonText: '确定',
  2503. cancelButtonText: '取消',
  2504. type: 'warning',
  2505. dangerouslyUseHTMLString: true,
  2506. lockScroll: false,
  2507. center: true
  2508. }).then(function () {
  2509. $Request.postJson('/admin/framework/common/gallery/remove', {
  2510. id: item.id
  2511. }, function (res) {
  2512. if (res.code === 200) {
  2513. $App.$message({message: '文件删除成功!', type: 'success', duration: 2400});
  2514. $Gallery.GalleryRequestLists();
  2515. } else {
  2516. $App.$message({message: '文件删除失败,请稍后再试!', type: 'error', duration: 2400});
  2517. }
  2518. })
  2519. }).catch(function () {
  2520. });
  2521. },
  2522. GalleryTabEvent: function () {
  2523. $Gallery.GalleryUploadToken($App.GalleryParams.options.type);
  2524. $Gallery.GalleryUploadInit();
  2525. },
  2526. GalleryGroupUpdateEvent: function (index, item) {
  2527. $App.$prompt('', '修改分组', {
  2528. confirmButtonText: '确定',
  2529. cancelButtonText: '取消',
  2530. inputValue: item.name,
  2531. lockScroll: false,
  2532. inputPlaceholder: '请输入分组名称',
  2533. inputValidator: function (e) {
  2534. return (e && e.length < 10) ? true : false;
  2535. },
  2536. inputErrorMessage: '请输入分组名称',
  2537. }).then(function (result) {
  2538. if (!result.value) {
  2539. $App.$message({type: 'error', message: '请输入分组名称!'});
  2540. return false;
  2541. }
  2542. $Request.postJson('/admin/framework/common/gallery/groupUpdate', {
  2543. id: item.id,
  2544. name: result.value
  2545. }, function (res) {
  2546. if (res.code === 200) {
  2547. $App.$message({message: res.message, type: 'success', duration: 2400});
  2548. $Gallery.GalleryRequestLists();
  2549. } else {
  2550. $App.$message({message: res.message, type: 'error', duration: 2400});
  2551. }
  2552. });
  2553. }).catch(function () {
  2554. });
  2555. },
  2556. GalleryGroupInsertEvent: function () {
  2557. if ($App.GalleryParams.groupItems.length > 6) {
  2558. $App.$message({message: '分组最多可添加5个!', type: 'error', duration: 2400});
  2559. return false;
  2560. }
  2561. $App.$prompt('', '添加分组', {
  2562. confirmButtonText: '确定',
  2563. cancelButtonText: '取消',
  2564. lockScroll: false,
  2565. inputPlaceholder: '请输入分组名称,最长10个字符',
  2566. inputValidator: function (e) {
  2567. return (e && e.length < 10) ? true : false;
  2568. },
  2569. inputErrorMessage: '请输入分组名称',
  2570. }).then(function (result) {
  2571. if (!result.value) {
  2572. $App.$message({type: 'error', message: '请输入分组名称!'});
  2573. return false;
  2574. }
  2575. $Request.postJson('/admin/framework/common/gallery/groupCreate', {
  2576. name: result.value,
  2577. type: $App.GalleryParams.options.type
  2578. }, function (res) {
  2579. if (res.code === 200) {
  2580. $App.$message({message: res.message, type: 'success', duration: 2400});
  2581. $Gallery.GalleryRequestLists();
  2582. } else {
  2583. $App.$message({message: res.message, type: 'error', duration: 2400});
  2584. }
  2585. });
  2586. }).catch(function () {
  2587. });
  2588. },
  2589. GalleryGroupManageEvent: function () {
  2590. $App.GalleryParams.operation.groupManage = !$App.GalleryParams.operation.groupManage;
  2591. },
  2592. GalleryImagesPageChange: function (page) {
  2593. var that = this;
  2594. $App.GalleryParams.search.page = page;
  2595. $Gallery.GalleryRequestLists();
  2596. },
  2597. GalleryItemCheckboxEvent: function (item) {
  2598. var that = this;
  2599. // console.log(11111,item);
  2600. if (item.active === 0 || item.active === false) {
  2601. /*多选*/
  2602. if ($App.GalleryParams.options.max > 1) {
  2603. if ($App.GalleryParams.selected.length >= $App.GalleryParams.options.max) {
  2604. $App.$message({
  2605. message: '最多可选择' + $App.GalleryParams.options.max + '项!',
  2606. type: 'warning'
  2607. });
  2608. return true;
  2609. } else {
  2610. item.active = true;
  2611. $App.GalleryParams.selected.push(item);
  2612. }
  2613. } else {
  2614. if ($App.GalleryParams.selected.length > 0) {
  2615. $App.GalleryParams.selected.forEach(function (selected_item) {
  2616. $App.GalleryParams.imagesItems.forEach(function (rows, index) {
  2617. if (selected_item.id === rows.id) {
  2618. rows.active = false;
  2619. }
  2620. });
  2621. });
  2622. }
  2623. item.active = true;
  2624. $App.GalleryParams.selected = [];
  2625. $App.GalleryParams.selected[0] = item;
  2626. }
  2627. } else {
  2628. $Gallery.GalleryItemActiveInEvent(item);
  2629. }
  2630. },
  2631. GalleryItemActiveInEvent: function (item) {
  2632. /*取消选中*/
  2633. if ($App.GalleryParams.options.max > 1) {
  2634. if ($App.GalleryParams.selected.length > 0) {
  2635. $App.GalleryParams.selected.forEach(function (rows, index) {
  2636. if (rows.id === item.id) {
  2637. $App.GalleryParams.selected.splice(index, 1);
  2638. item.active = false;
  2639. return true;
  2640. }
  2641. });
  2642. } else {
  2643. item.active = false;
  2644. $App.GalleryParams.selected = [];
  2645. return true;
  2646. }
  2647. } else {
  2648. item.active = false;
  2649. $App.GalleryParams.selected = [];
  2650. return true;
  2651. }
  2652. },
  2653. GalleryItemDropdownEvent: function (e, item) {
  2654. var that = this;
  2655. if (e.target.dataset.command === 'edit') {
  2656. that.GalleryItemUpdateOriginalEvent(item);
  2657. } else {
  2658. that.GalleryItemRemoveEvent(item);
  2659. }
  2660. },
  2661. GalleryRequestLists: function () {
  2662. $App.GalleryParams.operation.loading = true;
  2663. $App.GalleryParams.operation.groupManage = false;
  2664. $Gallery.GalleryUploadParams();
  2665. $Gallery.GalleryGroupRequestLists();
  2666. $Request.postJson('/admin/framework/common/gallery/iframe', $App.GalleryParams.search, function (res) {
  2667. if (res.code === 200) {
  2668. $App.GalleryParams.imagesItems = res.result.data;
  2669. $App.GalleryParams.operation.imageTotal = res.result.total;
  2670. $App.GalleryParams.selected.forEach(function (selected_item) {
  2671. $App.GalleryParams.imagesItems.forEach(function (item, index) {
  2672. if (selected_item.id === item.id) {
  2673. item.active = true;
  2674. }
  2675. });
  2676. });
  2677. }
  2678. $App.GalleryParams.operation.loadingMsg = '';
  2679. $App.GalleryParams.operation.loading = false;
  2680. $App.layouts.dialogFormsHeight = {
  2681. 'max-height': parseInt((document.documentElement.clientHeight * 0.75) - 120) + 'px'
  2682. };
  2683. // console.log($App.layouts.dialogFormsHeight)
  2684. });
  2685. },
  2686. GalleryGroupRequestLists: function () {
  2687. $App.GalleryParams.loading = true;
  2688. $Request.postJson('/admin/framework/common/gallery/group', $App.GalleryParams.search, function (res) {
  2689. if (res.code === 200) {
  2690. $App.GalleryParams.groupItems = res.result;
  2691. }
  2692. });
  2693. },
  2694. };
  2695. window.$Center = {
  2696. CenterDialogOpen: function () {
  2697. $App.CenterParams.loadingMsg = '正在加载数据,请稍后...';
  2698. $App.CenterParams.loading = true;
  2699. $App.CenterParams.dialog = true;
  2700. $App.CenterParams.model = {name:'',account:'',password:''};
  2701. $Request.postJson('/admin/framework/common/center/info', {}, function (res) {
  2702. if(res.code === 200){
  2703. $App.CenterParams.model = res.result;
  2704. $App.CenterParams.loading = false;
  2705. } else {
  2706. $App.$message({message: res.message, type: 'error'});
  2707. $App.CenterParams.loadingMsg = res.message;
  2708. }
  2709. })
  2710. },
  2711. CenterDialogClose: function () {
  2712. $App.CenterParams.dialog = false;
  2713. },
  2714. CenterDialogSubmits: function (){
  2715. $App.CenterParams.loadingMsg = '正在提交,请稍后...';
  2716. $App.CenterParams.loading = true;
  2717. var params = $App.CenterParams.model;
  2718. $Request.postJson('/admin/framework/common/center/update', params, function (res) {
  2719. if(res['code'] === 200) {
  2720. $App.$Message(res['message'], function () {
  2721. $App.CenterParams.loading = false;
  2722. $App.CenterParams.dialog = false;
  2723. location.reload();
  2724. });
  2725. } else {
  2726. $App.$Message(res.message, 'error');
  2727. }
  2728. });
  2729. },
  2730. // 监测抽屉鼠标事件
  2731. handleWrapperMousedown(e) {
  2732. // 如果为true,则表示点击发生在遮罩层
  2733. $App.CenterParams.dialogClassModel = !!e.target.classList.contains('el-dialog__wrapper')
  2734. },
  2735. handleWrapperMouseup(e) {
  2736. if ((!!e.target.classList.contains('el-dialog__wrapper')) && $App.CenterParams.dialogClassModel) {
  2737. $App.CenterParams.dialog = false;
  2738. }
  2739. },
  2740. // 监测抽屉鼠标事件 End.
  2741. };
  2742. window.$Arrays = {
  2743. /* arrayLookup(data,'id',1,'name');*/
  2744. arrayLookup: function (data, key, value, targetKey) {
  2745. if (!data) return '---';
  2746. var data_length = data.length;
  2747. var targetValue = "";
  2748. for (var i = 0; i < data_length; i++) {
  2749. if (!data[i][key]) {
  2750. break;
  2751. }
  2752. if (data[i][key] == value) {
  2753. targetValue = targetKey ? data[i][targetKey] : data[i];
  2754. break;
  2755. }
  2756. }
  2757. return targetValue ? targetValue : '---';
  2758. }
  2759. };
  2760. // 自定义模板
  2761. Vue.component('va-media', {
  2762. props: {
  2763. size: {type: Number, default: 20},
  2764. file: {type: String, default: ''},
  2765. width:{ type: String, default: '400px'},
  2766. height:{ type: String, default: '240px'}
  2767. },
  2768. model: {
  2769. prop: 'file',
  2770. event: 'change'
  2771. },
  2772. template: '<div style="border: 1px dashed #2d8cf0;border-radius: 5px;cursor: pointer" :style="{\'width\':width,\'height\':height}" @click="pictureGalleryOpen">' +
  2773. '<img src="/statics/v1/image/empty/data.png" style="width: 100%;height: 100%;object-fit: contain;" v-if="!file">' +
  2774. '<video :src="file" :poster="file+\'?vframe/jpg/offset/2/w/130/h/140/\'" ' +
  2775. 'controls="controls" width="100%" height="100%" autoplay v-if="file">' +
  2776. '<source :src="file" type="video/mp4" /></video></div>',
  2777. methods: {
  2778. pictureGalleryOpen: function() {
  2779. var that = this;
  2780. $Gallery.GalleryDialogOpen({
  2781. max: 1,
  2782. size: that.size,
  2783. multiple: false,
  2784. type: 2,
  2785. cat:true,
  2786. callback: function(res) {
  2787. that.$emit('change', res.url);
  2788. }
  2789. });
  2790. }
  2791. },
  2792. mounted: function() {
  2793. }
  2794. });
  2795. Vue.component('va-image', {
  2796. props: {
  2797. size: {type: Number, default: 20},
  2798. src: {type: String, default: ''},
  2799. key: {type: String, default: ''}
  2800. },
  2801. data: function () {
  2802. return {
  2803. imageUrl: '',
  2804. imageUrlList: [],
  2805. };
  2806. },
  2807. watch: {
  2808. src(value) {
  2809. if (!this.imageUrl) {
  2810. this._init(value);
  2811. }
  2812. },
  2813. },
  2814. template: '<el-image class="tables-image" :src="imageUrl" fit="contain" lazy :size="size" :key="key" :preview-src-list="imageUrlList">' +
  2815. '<div slot="error" class="image-slot"><i class="fa fa-picture-o"></i></div>' +
  2816. '</el-image>',
  2817. methods: {
  2818. _init: function (value) {
  2819. var that = this;
  2820. if (!value) {
  2821. that.imageUrl = '/statics/v1/image/common/empty.jpeg';
  2822. return true;
  2823. }
  2824. if ($Validator.json(value)) {
  2825. var fileItems = JSON.parse(value);
  2826. if (fileItems.length && fileItems.length > 0) {
  2827. $.each(fileItems, function (key, item) {
  2828. that.imageUrlList.push(item.url);
  2829. });
  2830. that.imageUrl = that.imageUrlList[0];
  2831. } else {
  2832. that.imageUrl = fileItems.url;
  2833. }
  2834. } else {
  2835. if (value.includes('base64')){
  2836. that.imageUrlList = [value];
  2837. }else {
  2838. that.imageUrlList = value.split(",").filter(function (n) {
  2839. return n
  2840. });
  2841. }
  2842. if (that.imageUrlList.length < 1) {
  2843. that.imageUrl = '/statics/v1/image/common/empty.jpeg';
  2844. } else {
  2845. that.imageUrl = that.imageUrlList[0];
  2846. }
  2847. }
  2848. }
  2849. },
  2850. mounted: function () {
  2851. this._init(this.src);
  2852. }
  2853. });
  2854. Vue.component('va-forms-tips', {
  2855. props: {},
  2856. data: function () {
  2857. return {};
  2858. },
  2859. template: '<span class="Va-help-block" data-7512a93d><i class="el-icon-info"></i> <slot></slot></span>',
  2860. mounted: function () {
  2861. }
  2862. });
  2863. Vue.component("va-picture", {
  2864. props: {
  2865. action: {
  2866. type: String,
  2867. default: '/admin/framework/common/pictureUploads'
  2868. },
  2869. size: {
  2870. type: Number,
  2871. default: 20
  2872. },
  2873. suffix: {
  2874. type: String,
  2875. default: 'png,bmp,jpeg,jpg,gif'
  2876. },
  2877. postData: {
  2878. type: Object,
  2879. default: {}
  2880. },
  2881. file: {
  2882. type: String,
  2883. default: ''
  2884. },
  2885. gallery: {
  2886. type: Boolean,
  2887. default: true
  2888. },
  2889. alt: {
  2890. type: Boolean,
  2891. default: false
  2892. },
  2893. name: {
  2894. type: Boolean,
  2895. default: false
  2896. },
  2897. disabled: {
  2898. type: Boolean,
  2899. default: false
  2900. },
  2901. onSuccess: {
  2902. type: Function,
  2903. default: function (res) {
  2904. }
  2905. },
  2906. },
  2907. data: function () {
  2908. return {
  2909. picture: {
  2910. postHeaders: {
  2911. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  2912. },
  2913. uploadStatus: false,
  2914. progress: 0,
  2915. },
  2916. fileItems: {
  2917. url: '',
  2918. alt: '',
  2919. name: ''
  2920. },
  2921. _fileName: '', _fileSize: 0,
  2922. galleryOptions: {},
  2923. uploadOption: {driver: 'local', action: '', token: '', domain: ''},
  2924. }
  2925. },
  2926. model: {
  2927. prop: 'file',
  2928. event: 'change'
  2929. },
  2930. computed: {
  2931. fileItemsAlt() {
  2932. return this.fileItems.alt;
  2933. },
  2934. fileItemsName() {
  2935. return this.fileItems.name;
  2936. }
  2937. },
  2938. watch: {
  2939. file(value) {
  2940. var that = this;
  2941. if (that.alt || that.name) {
  2942. if ($Validator.json(value)) {
  2943. that.fileItems = JSON.parse(value);
  2944. }
  2945. } else {
  2946. that.fileItems = {
  2947. url: value,
  2948. alt: '',
  2949. name: ''
  2950. };
  2951. }
  2952. },
  2953. fileItemsAlt(value) {
  2954. this.emitItemsEvent()
  2955. },
  2956. fileItemsName(value) {
  2957. this.emitItemsEvent()
  2958. },
  2959. },
  2960. template: '<div v-if="!fileItems.url" :disabled="disabled">\n' +
  2961. ' <el-upload\n' +
  2962. ' :action="action"\n' +
  2963. ' :show-file-list="false"\n' +
  2964. ' :headers="picture.postHeaders"\n' +
  2965. ' :data="postData"\n' +
  2966. ' :on-success="pictureUploadSuccess"\n' +
  2967. ' :on-progress="pictureUploadProgress"\n' +
  2968. ' :on-change="pictureChangeEvent"\n' +
  2969. ' :on-error="pictureUploadError"\n' +
  2970. ' ref="pictureUploadRef"\n' +
  2971. ' :disabled="disabled"\n' +
  2972. ' :before-upload="pictureUploadBefore" v-if="!gallery">\n' +
  2973. ' <div class="va-component-picture" :disabled="disabled" v-if="!picture.uploadStatus">\n' +
  2974. ' <div class="upload" :disabled="disabled">\n' +
  2975. ' <i class="el-icon-upload icon" :disabled="disabled"></i>\n' +
  2976. ' </div>\n' +
  2977. ' </div>\n' +
  2978. ' <div class="va-component-picture" v-else :disabled="disabled">\n' +
  2979. ' <el-progress type="circle" :percentage="picture.progress" style="margin-top: 5px;" ></el-progress>\n' +
  2980. ' </div>\n' +
  2981. ' </el-upload>\n' +
  2982. ' <div v-else class="va-component-picture gallery" :disabled="disabled" @click="pictureGalleryOpen">\n' +
  2983. ' <div class="upload" :disabled="disabled">\n' +
  2984. ' <i class="el-icon-upload icon" :disabled="disabled"></i>\n' +
  2985. ' </div>\n' +
  2986. ' </div>\n' +
  2987. '</div>\n' +
  2988. '<div class="va-component-picture" v-else :disabled="disabled">\n' +
  2989. ' <div class="show" :title="fileItems.alt">\n' +
  2990. ' <el-image class="image" :src="fileItems.url"></el-image>\n' +
  2991. ' <div class="shadow" v-if="!disabled">\n' +
  2992. ' <i class="el-icon-delete icon" @click="pictureItemsRemove(fileItems)"></i>\n' +
  2993. ' <el-dropdown class= "dropdown-picture-edit" placement="top" size="mini" style="position:absolute" @command="pictureItemsEdit(event)" v-if="alt || name">\n' +
  2994. ' <span class="el-dropdown-link"><i class="el-icon-edit icon"></i> </span>\n' +
  2995. ' <el-dropdown-menu slot="dropdown">\n' +
  2996. ' <el-dropdown-item command="name" data-command="name" v-if="name">名称</el-dropdown-item>\n' +
  2997. ' <el-dropdown-item command="alt" data-command="alt" v-if="alt">alt</el-dropdown-item>\n' +
  2998. ' </el-dropdown-menu></el-dropdown>\n' +
  2999. ' </div>\n' +
  3000. ' </div>\n' +
  3001. '</div>',
  3002. methods: {
  3003. pictureGalleryOpen: function () {
  3004. var that = this;
  3005. if (that.disabled) {
  3006. return false;
  3007. }
  3008. $Gallery.GalleryDialogOpen({
  3009. max: 1,
  3010. size: that.size,
  3011. suffix: that.suffix,
  3012. multiple: false,
  3013. type: '1',
  3014. tabs: false,
  3015. callback: function (res) {
  3016. that.fileItems = {url: res.url, alt: res.original, name: res.original};
  3017. that.emitItemsEvent();
  3018. that.picture.uploadStatus = false;
  3019. that.picture.progress = 0;
  3020. }
  3021. });
  3022. },
  3023. pictureItemsEdit: function (e, item, index) {
  3024. var that = this;
  3025. if (that.disabled) {
  3026. return false;
  3027. }
  3028. var tips = (e.target.dataset.command === 'name') ? '名称' : 'alt';
  3029. $App.$prompt('', '修改图片' + tips, {
  3030. confirmButtonText: '确定',
  3031. cancelButtonText: '取消',
  3032. inputPlaceholder: '请输入图片' + tips,
  3033. inputValue: that.fileItems[e.target.dataset.command],
  3034. lockScroll: false,
  3035. }).then(function (params) {
  3036. if (!params.value) {
  3037. $App.$message({
  3038. message: '请输入图片' + tips,
  3039. type: 'error',
  3040. duration: 2400
  3041. });
  3042. } else {
  3043. that.fileItems[e.target.dataset.command] = params.value;
  3044. that.emitItemsEvent();
  3045. }
  3046. }).catch(function () {
  3047. });
  3048. return true;
  3049. },
  3050. pictureItemsRemove: function () {
  3051. var that = this;
  3052. that.fileItems = {
  3053. url: '',
  3054. alt: '',
  3055. name: ''
  3056. };
  3057. that.emitItemsEvent();
  3058. },
  3059. pictureAltEvent: function (items, index) {
  3060. var that = this;
  3061. that.$refs[('picturePopoverAlt00101')].doClose();
  3062. },
  3063. pictureUploadProgress: function (event, file, fileList) {
  3064. var that = this;
  3065. that.picture.progress = parseFloat((event.percent).toFixed(2));
  3066. },
  3067. pictureUploadSuccess: function (response, file, fileList) {
  3068. var that = this;
  3069. var url;
  3070. that.$refs.pictureUploadRef.clearFiles();
  3071. if (response.code !== 200) {
  3072. switch (that.uploadOption.driver) {
  3073. case 'qiniu':
  3074. response.url = that.uploadOption.domain + '/' + response.key;
  3075. url = response.url;
  3076. that.onSuccess(response);
  3077. break;
  3078. case'oss':
  3079. default:
  3080. url = response.result.url;
  3081. $App.$Message(response.msg, 'warning');
  3082. that.picture.uploadStatus = false;
  3083. that.picture.progress = 0;
  3084. break;
  3085. }
  3086. that.fileItems = {
  3087. url: url,
  3088. alt: that.fileItems.alt,
  3089. name: that.fileItems.name,
  3090. defaultImg: that.uploadOption.defaultImg
  3091. };
  3092. that.emitItemsEvent();
  3093. $App.$Message('文件上传成功!', 'success');
  3094. that.picture.uploadStatus = false;
  3095. that.picture.progress = 0;
  3096. return true;
  3097. } else {
  3098. $App.$Message(response.msg, 'warning');
  3099. that.picture.uploadStatus = false;
  3100. that.picture.progress = 0;
  3101. }
  3102. },
  3103. pictureUploadError: function () {
  3104. var that = this;
  3105. that.picture.uploadStatus = false;
  3106. that.picture.progress = 0;
  3107. $App.$Message('文件上传失败,请重试!', 'warning');
  3108. that.$refs.pictureUploadRef.clearFiles();
  3109. return true;
  3110. },
  3111. pictureUploadBefore: function (file, e) {
  3112. var that = this;
  3113. /*验证图片大小*/
  3114. if (that.size) {
  3115. if ((file.size / 1048576) > that.size) {
  3116. $App.$Message('请上传' + that.size + 'M以内的文件', 'warning');
  3117. that.$refs.pictureUploadRef.clearFiles();
  3118. return false;
  3119. }
  3120. }
  3121. /*验证文件后缀*/
  3122. if (that.suffix) {
  3123. var args = ((file.name).split('.'));
  3124. if (args[args.length - 1]) {
  3125. var suffix = (that.suffix).split(',');
  3126. if ($.inArray((args[args.length - 1]).toLowerCase(), suffix) < 0) {
  3127. $App.$Message('请上传' + that.suffix + '类型的文件', 'warning');
  3128. that.$refs.pictureUploadRef.clearFiles();
  3129. return false;
  3130. }
  3131. }
  3132. }
  3133. that._fileSize = (file.size / 1048576).toFixed(2);
  3134. that._fileName = file.name;
  3135. that.picture.uploadStatus = true;
  3136. that.picture.progress = 1;
  3137. return true;
  3138. },
  3139. emitItemsEvent: function () {
  3140. var that = this;
  3141. if (that.alt || that.name) {
  3142. that.$emit('change', JSON.stringify(that.fileItems));
  3143. } else {
  3144. that.$emit('change', that.fileItems.url);
  3145. }
  3146. that.UploadToken();
  3147. },
  3148. UploadToken: function () {
  3149. var that = this;
  3150. if (that.gallery) return true;
  3151. $Gallery.GalleryUploadToken(function (res) {
  3152. that.uploadOption.driver = res.result.driver;
  3153. that.uploadOption.domain = res.result.domain;
  3154. that.action = res.result.action;
  3155. that.postData.token = res.result.token;
  3156. if (res.result.key) {
  3157. $App.postData.key = res.result.key;
  3158. }
  3159. if (res.result.driver === 'local') {
  3160. $App.action = '/admin/framework/common/pictureUploads';
  3161. }
  3162. }, 1)
  3163. }
  3164. },
  3165. mounted: function () {
  3166. var that = this;
  3167. that.UploadToken();
  3168. if (!that.size) {
  3169. that.postData.size = 20;
  3170. } else {
  3171. that.postData.size = that.size;
  3172. }
  3173. if (!that.suffix) {
  3174. that.postData.suffix = 'png,bmp,jpeg,jpg,gif';
  3175. } else {
  3176. that.postData.suffix = that.suffix;
  3177. }
  3178. if (that.alt) {
  3179. if (that.file) {
  3180. if ((typeof that.file) == 'object') {
  3181. that.fileItems = that.file;
  3182. } else {
  3183. if (!$Validator.json(that.file)) {
  3184. console.error('va-picture components. File parameter requires a JSON string');
  3185. } else {
  3186. that.fileItems = JSON.parse(that.file);
  3187. }
  3188. }
  3189. } else {
  3190. that.fileItems = {
  3191. url: '',
  3192. alt: ''
  3193. };
  3194. }
  3195. } else {
  3196. that.fileItems = {
  3197. url: (that.file && that.file != 'null') ? that.file : '',
  3198. alt: '',
  3199. name: ''
  3200. };
  3201. }
  3202. that.galleryOptions = {
  3203. max: 1,
  3204. size: that.size,
  3205. suffix: that.suffix,
  3206. type: 'image',
  3207. callback: 'pictureSelectedSuccess'
  3208. };
  3209. that.picture.uploadStatus = false;
  3210. that.picture.progress = 0;
  3211. }
  3212. });
  3213. Vue.component("va-picture-multiple", {
  3214. props: {
  3215. action: {
  3216. type: String,
  3217. default: '/admin/framework/common/pictureUploads'
  3218. },
  3219. size: {
  3220. type: Number,
  3221. default: 20
  3222. },
  3223. suffix: {
  3224. type: String,
  3225. default: 'png,bmp,jpeg,jpg,gif'
  3226. },
  3227. postData: {
  3228. type: Object,
  3229. default: {}
  3230. },
  3231. limit: {
  3232. type: Number,
  3233. default: 10
  3234. },
  3235. file: {
  3236. type: String,
  3237. default: ''
  3238. },
  3239. gallery: {
  3240. type: Boolean,
  3241. default: true
  3242. },
  3243. alt: {
  3244. type: Boolean,
  3245. default: false
  3246. },
  3247. name: {
  3248. type: Boolean,
  3249. default: false
  3250. },
  3251. disabled: {
  3252. type: Boolean,
  3253. default: false
  3254. },
  3255. },
  3256. data: function () {
  3257. return {
  3258. picture: {
  3259. postHeaders: {
  3260. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  3261. },
  3262. uploadStatus: false,
  3263. progress: 0,
  3264. },
  3265. fileItems: [],
  3266. galleryOptions: {},
  3267. uploadOption: {driver: 'local', action: '', token: '', domain: ''},
  3268. }
  3269. },
  3270. model: {
  3271. prop: 'file',
  3272. event: 'change'
  3273. },
  3274. watch: {
  3275. file(value) {
  3276. if (this.fileItems && this.fileItems.length > 0) {
  3277. return true;
  3278. }
  3279. this.formatFileEvent(value);
  3280. }
  3281. },
  3282. template: '<div class="va-component-picture-multiple" :disabled="disabled" id="_va-component-picture">\n' +
  3283. ' <template v-if="fileItems.length > 0" >\n' +
  3284. ' <div v-for="(item, index) in fileItems" class="va-component-picture picture__Sortable" :data-no="index" :disabled="disabled">\n' +
  3285. ' <div class="show" :title="item.alt">\n' +
  3286. ' <img class="image" :src="item.url">\n' +
  3287. ' <div class="shadow" v-if="!disabled">\n' +
  3288. ' <i class="el-icon-delete icon" @click="pictureItemsRemove(item, index)"></i>\n' +
  3289. ' <el-dropdown class= "dropdown-picture-edit" placement="top" style="position:absolute" size="mini" @command="pictureItemsEdit(event, item, index)" v-if="alt || name">\n' +
  3290. ' <span class="el-dropdown-link"><i class="el-icon-edit icon"></i> </span>\n' +
  3291. ' <el-dropdown-menu slot="dropdown">\n' +
  3292. ' <el-dropdown-item command="name" data-command="name" v-if="name">名称</el-dropdown-item>\n' +
  3293. ' <el-dropdown-item command="alt" data-command="alt" v-if="alt">alt</el-dropdown-item>\n' +
  3294. ' </el-dropdown-menu>' +
  3295. ' </el-dropdown>\n' +
  3296. ' </div>\n' +
  3297. ' </div>\n' +
  3298. ' </div>' +
  3299. ' </template>\n' +
  3300. ' <template v-if="fileItems.length < limit">\n' +
  3301. ' <el-upload\n' +
  3302. ' :action="action"\n' +
  3303. ' :show-file-list="false"\n' +
  3304. ' :headers="picture.postHeaders"\n' +
  3305. ' :data="postData"\n' +
  3306. ' :multiple="true"\n' +
  3307. ' :limit="limit"\n' +
  3308. ' :on-success="pictureUploadSuccess"\n' +
  3309. ' :on-progress="pictureUploadProgress"\n' +
  3310. ' :on-error="pictureUploadError"\n' +
  3311. ' ref="pictureMultipleUploadRef"\n' +
  3312. ' :before-upload="pictureUploadBefore" v-if="!gallery">\n' +
  3313. ' <div class="va-component-picture" :disabled="disabled" v-if="!picture.uploadStatus" >\n' +
  3314. ' <div class="upload" :disabled="disabled">\n' +
  3315. ' <i class="el-icon-upload icon" :disabled="disabled"></i>\n' +
  3316. ' </div>\n' +
  3317. ' </div>\n' +
  3318. ' <div class="va-component-picture" :disabled="disabled" v-else>\n' +
  3319. ' <el-progress type="circle" :percentage="picture.progress" style="margin-top: 10px;" ></el-progress>\n' +
  3320. ' </div>\n' +
  3321. ' </el-upload>\n' +
  3322. ' <div v-else class="va-component-picture gallery" :disabled="disabled" @click="pictureGalleryOpen">\n' +
  3323. ' <div class="upload" :disabled="disabled">\n' +
  3324. ' <i class="el-icon-upload icon" :disabled="disabled"></i>\n' +
  3325. ' </div>\n' +
  3326. ' </div>\n' +
  3327. ' </template>\n' +
  3328. '</div>',
  3329. methods: {
  3330. pictureGalleryOpen: function () {
  3331. var that = this;
  3332. if (that.disabled) {
  3333. return false;
  3334. }
  3335. $Gallery.GalleryDialogOpen({
  3336. max: (that.limit - that.fileItems.length),
  3337. size: that.size,
  3338. suffix: that.suffix,
  3339. multiple: true,
  3340. type: '1',
  3341. tabs: false,
  3342. callback: function (res) {
  3343. res.forEach(function (item, key) {
  3344. if (that.fileItems.length < 1) {
  3345. that.fileItems.push({url: item.url, alt: item.original, name: item.original});
  3346. } else {
  3347. if (that.fileItems.length < that.limit) {
  3348. that.fileItems.push({url: item.url, alt: item.original, name: item.original});
  3349. }
  3350. }
  3351. });
  3352. that.emitItemsEvent();
  3353. that.picture.uploadStatus = false;
  3354. that.picture.progress = 0;
  3355. }
  3356. });
  3357. },
  3358. pictureItemsEdit: function (e, item, index) {
  3359. var that = this;
  3360. if (that.disabled) {
  3361. return false;
  3362. }
  3363. var tips = (e.target.dataset.command === 'name') ? '名称' : 'alt';
  3364. $App.$prompt('', '修改图片' + tips, {
  3365. confirmButtonText: '确定',
  3366. cancelButtonText: '取消',
  3367. inputPlaceholder: '请输入图片' + tips,
  3368. inputValue: item[e.target.dataset.command],
  3369. lockScroll: false,
  3370. }).then(function (params) {
  3371. if (!params.value) {
  3372. $App.$message({
  3373. message: '请输入图片' + tips,
  3374. type: 'error',
  3375. duration: 2400
  3376. });
  3377. } else {
  3378. item[e.target.dataset.command] = params.value;
  3379. that.emitItemsEvent();
  3380. }
  3381. }).catch(function(){});
  3382. return true;
  3383. },
  3384. pictureItemsRemove: function (items, index) {
  3385. var that = this;
  3386. that.fileItems.splice(index, 1);
  3387. that.emitItemsEvent();
  3388. },
  3389. pictureUploadProgress: function (event, file, fileList) {
  3390. var that = this;
  3391. that.picture.progress = parseFloat((event.percent).toFixed(2));
  3392. },
  3393. pictureUploadSuccess: function (response, file, fileList) {
  3394. var that = this;
  3395. var fileItemsMaps = that.fileItems;
  3396. var url;
  3397. switch (that.uploadOption.driver) {
  3398. case 'qiniu':
  3399. url = that.uploadOption.domain + '/' + response.key;
  3400. break;
  3401. case'oss':
  3402. default:
  3403. if (response.code !== 200) {
  3404. $App.$Message(response.msg, 'warning');
  3405. that.picture.uploadStatus = false;
  3406. that.picture.progress = 0;
  3407. return true;
  3408. } else {
  3409. url = response.result.url;
  3410. }
  3411. break;
  3412. }
  3413. if (fileItemsMaps.length < that.limit) {
  3414. fileItemsMaps.push({url: url, alt: '', name: ''});
  3415. }
  3416. ;
  3417. that.fileItems = fileItemsMaps;
  3418. that.emitItemsEvent();
  3419. $App.$Message('文件上传成功!', 'success');
  3420. that.picture.uploadStatus = false;
  3421. that.picture.progress = 0;
  3422. return true;
  3423. },
  3424. pictureUploadError: function () {
  3425. var that = this;
  3426. that.picture.uploadStatus = false;
  3427. that.picture.progress = 0;
  3428. $App.$Message('文件上传失败,请重试!', 'warning');
  3429. that.$refs.pictureMultipleUploadRef.clearFiles();
  3430. return true;
  3431. },
  3432. pictureUploadBefore: function (file, e) {
  3433. var that = this;
  3434. that.UploadToken();
  3435. /*验证图片大小*/
  3436. if (that.size) {
  3437. if ((file.size / 1048576) > that.size) {
  3438. $App.$Message('请上传' + that.size + 'M以内的文件', 'warning');
  3439. that.$refs.pictureMultipleUploadRef.clearFiles();
  3440. return false;
  3441. }
  3442. }
  3443. /*验证文件后缀*/
  3444. if (that.suffix) {
  3445. var args = ((file.name).split('.'));
  3446. if (args[args.length - 1]) {
  3447. var suffix = (that.suffix).split(',');
  3448. if ($.inArray((args[args.length - 1]).toLowerCase(), suffix) < 0) {
  3449. $App.$Message('请上传' + that.suffix + '类型的文件', 'warning');
  3450. that.$refs.pictureMultipleUploadRef.clearFiles();
  3451. return false;
  3452. }
  3453. }
  3454. }
  3455. that.picture.uploadStatus = true;
  3456. that.picture.progress = 1;
  3457. return true;
  3458. },
  3459. emitItemsEvent: function () {
  3460. var that = this;
  3461. that.UploadToken();
  3462. if (that.alt || that.name) {
  3463. that.$emit('change', JSON.stringify(that.fileItems));
  3464. that.SortTableEvent();
  3465. } else {
  3466. var fileItems = '';
  3467. if (that.fileItems.length > 0) {
  3468. that.fileItems.forEach(function (item, key) {
  3469. if (key === that.fileItems.length) {
  3470. fileItems += item.url;
  3471. } else {
  3472. fileItems += item.url + ',';
  3473. }
  3474. });
  3475. that.SortTableEvent();
  3476. }
  3477. that.$emit('change', fileItems);
  3478. }
  3479. },
  3480. formatFileEvent: function () {
  3481. var that = this;
  3482. if (that.alt || that.name) {
  3483. if (that.file) {
  3484. if ((typeof that.file) == 'object') {
  3485. that.fileItems = that.file;
  3486. } else {
  3487. if (!$Validator.json(that.file)) {
  3488. console.info('va-picture-multiple components. File parameter requires a JSON string');
  3489. } else {
  3490. that.fileItems = JSON.parse(that.file);
  3491. that.emitItemsEvent();
  3492. }
  3493. }
  3494. } else {
  3495. that.fileItems = [];
  3496. }
  3497. } else {
  3498. if (!that.file || that.file == '[]' || that.file == '{}') {
  3499. that.fileItems = [];
  3500. } else {
  3501. if (that.file) {
  3502. var fileItems = (that.file).split(',');
  3503. if (fileItems && fileItems.length > 0) {
  3504. for (var i = 0; i <= fileItems.length; i++) {
  3505. if (fileItems[i]) {
  3506. that.fileItems.push({
  3507. url: fileItems[i],
  3508. alt: ''
  3509. });
  3510. }
  3511. }
  3512. that.emitItemsEvent();
  3513. } else {
  3514. that.fileItems = [];
  3515. }
  3516. } else {
  3517. that.fileItems = [];
  3518. }
  3519. }
  3520. }
  3521. },
  3522. UploadToken: function () {
  3523. var that = this;
  3524. if (that.gallery) return true;
  3525. $Gallery.GalleryUploadToken(function (res) {
  3526. that.uploadOption.driver = res.driver;
  3527. that.uploadOption.domain = res.domain;
  3528. that.action = res.action;
  3529. that.postData.token = res.token;
  3530. if (res.key) {
  3531. that.postData.key = res.key;
  3532. }
  3533. if (res.driver === 'local') {
  3534. that.action = '/admin/framework/common/pictureUploads';
  3535. }
  3536. }, 1);
  3537. },
  3538. SortTableEvent: function () {
  3539. //获取对象
  3540. var that = this;
  3541. var el = document.getElementById('_va-component-picture');
  3542. //设置配置
  3543. var ops = {
  3544. animation: 1000,
  3545. dataIdAttr: "data-no",
  3546. draggable: ".picture__Sortable",
  3547. //拖动结束
  3548. onEnd: function (evt) {
  3549. var asd = [];
  3550. var sortableArr = sortable.toArray();
  3551. $.each(sortableArr, function (key, val) {
  3552. asd.push(that.fileItems[val]);
  3553. });
  3554. that.fileItems = asd;
  3555. that.emitItemsEvent();
  3556. },
  3557. };
  3558. //初始化
  3559. var sortable = Sortable.create(el, ops);
  3560. }
  3561. },
  3562. mounted: function () {
  3563. var that = this;
  3564. that.UploadToken();
  3565. if (!that.size) {
  3566. that.postData.size = 20;
  3567. } else {
  3568. that.postData.size = that.size;
  3569. }
  3570. if (!that.suffix) {
  3571. that.postData.suffix = 'png,bmp,jpeg,jpg,gif';
  3572. } else {
  3573. that.postData.suffix = that.suffix;
  3574. }
  3575. that.formatFileEvent();
  3576. that.galleryOptions = {
  3577. max: that.limit,
  3578. size: that.size,
  3579. suffix: that.suffix,
  3580. type: 'image',
  3581. callback: 'pictureSelectedSuccess'
  3582. };
  3583. that.picture.uploadStatus = false;
  3584. that.picture.progress = 0;
  3585. }
  3586. });
  3587. Vue.component("va-video", {
  3588. props: {
  3589. action: {
  3590. type: String,
  3591. default: '/admin/framework/common/fileUploads'
  3592. },
  3593. size: {
  3594. type: Number,
  3595. default: 20
  3596. },
  3597. suffix: {
  3598. type: String,
  3599. default: 'mp3,wma,avi,rm,rmvb,flv,mpg,mov,mk,mp4'
  3600. },
  3601. postData: {
  3602. type: Object,
  3603. default: {
  3604. size: 20,
  3605. suffix: 'mp3,wma,avi,rm,rmvb,flv,mpg,mov,mk,mp4'
  3606. }
  3607. },
  3608. file: {
  3609. type: String,
  3610. default: "{url:'', size:'', original:''}"
  3611. },
  3612. gallery: {
  3613. type: Boolean,
  3614. default: true
  3615. },
  3616. preview: {
  3617. type: Boolean,
  3618. default: false
  3619. },
  3620. disabled: {
  3621. type: String,
  3622. default: false
  3623. },
  3624. onSuccess: {
  3625. type: String,
  3626. default: ''
  3627. },
  3628. },
  3629. data: function () {
  3630. return {
  3631. postHeaders: {
  3632. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  3633. },
  3634. uploadOption: {driver: 'local', domain: ''},
  3635. uploadStatus: false,
  3636. _fileName: '',
  3637. _fileSize: 0,
  3638. percentage: 0,
  3639. fileItems: {url: '', size: '', original: ''},
  3640. galleryOptions: {}
  3641. }
  3642. },
  3643. model: {
  3644. prop: 'file',
  3645. event: 'change'
  3646. },
  3647. watch: {
  3648. file(value) {
  3649. if (!this.fileItems.url) {
  3650. this.fileItems = JSON.parse(value);
  3651. this.$emit('change', JSON.stringify(this.fileItems));
  3652. }
  3653. }
  3654. },
  3655. template: '<div class="va-component-file" :disabled="disabled">\n' +
  3656. ' <el-upload\n' +
  3657. ' v-if="!fileItems.url && !uploadStatus && !gallery"\n' +
  3658. ' :action="action"\n' +
  3659. ' :headers="postHeaders"\n' +
  3660. ' limit="1" drag\n' +
  3661. ' :show-file-list="false"\n' +
  3662. ' :data="postData"\n' +
  3663. ' :disabled="disabled"\n' +
  3664. ' :on-progress="fileUploadProgress"\n' +
  3665. ' :on-success="fileUploadSuccess"\n' +
  3666. ' :on-error="fileUploadError"\n' +
  3667. ' :before-upload="fileUploadBefore"\n' +
  3668. ' ref="fileDialogUpload"\n' +
  3669. ' >\n' +
  3670. ' <div class="upload">\n' +
  3671. ' <i class="el-icon-upload icon" :disabled="disabled"></i>\n' +
  3672. ' <div class="el-upload__text" style="margin-top: -12px">\n' +
  3673. ' <el-link type="primary" :underline="false">\n' +
  3674. ' <span style="font-weight: 500;font-size: 15px">点击视频上传</span>\n' +
  3675. ' </el-link>\n' +
  3676. ' <div style="font-size: 12px;margin-top:-15px">\n' +
  3677. ' <div style="color: #909399;height: 15px">视频大小{{size}}MB以内</div>\n' +
  3678. ' <div style="color: #909399;height: 15px">支持类型:{{suffix}}</div>\n' +
  3679. ' </div>\n' +
  3680. ' </div>\n' +
  3681. ' </div>\n' +
  3682. ' </el-upload>\n' +
  3683. ' <div class="upload" @click="fileGalleryOpen" v-if="!fileItems.url && !uploadStatus && gallery">\n' +
  3684. ' <i class="el-icon-upload icon" :disabled="disabled"></i>\n' +
  3685. ' <div class="el-upload__text" style="margin-top: -12px">\n' +
  3686. ' <el-link type="primary" :disabled="disabled" :underline="false">\n' +
  3687. ' <span style="font-weight: 500;font-size: 15px">点击视频上传</span>\n' +
  3688. ' </el-link>\n' +
  3689. ' <div style="font-size: 12px;margin-top:-15px">\n' +
  3690. ' <div style="color: #909399;margin-top: 0">视频大小{{size}}MB以内</div>\n' +
  3691. ' <div style="color: #909399;margin-top: -20px">支持类型:{{suffix}}</div>\n' +
  3692. ' </div>\n' +
  3693. ' </div>\n' +
  3694. ' </div>\n' +
  3695. '\n' +
  3696. ' <div class="progress" v-if="uploadStatus && percentage > 0">\n' +
  3697. ' <el-progress type="circle" :percentage="percentage" color=" var(--themeColors)"></el-progress>\n' +
  3698. ' </div>\n' +
  3699. '\n' +
  3700. ' <div class="files" v-if="fileItems.url && !uploadStatus">\n' +
  3701. ' <el-button :disabled="disabled" class="Va-button button" size="mini" type="default" @click="fileUploadAgain">重新上传</el-button>\n' +
  3702. ' <el-button :disabled="disabled" class="Va-button button" size="mini" v-if="preview" type="default" @click="fileUploadPreview" style="top:42px">预览视频</el-button>\n' +
  3703. ' <i class="el-icon-document icon"></i>\n' +
  3704. ' <div class="text">\n' +
  3705. ' <span class="text-space" style="font-weight: 500;font-size: 15px;line-height: 20px;display: inline-block;width: 90%;margin-top:10px">{{fileItems.original}}</span>\n' +
  3706. ' <div style="font-size: 12px;margin-top: -20px">\n' +
  3707. ' <div class="el-upload__tip" slot="tip" style="color: #909399">视频大小:{{fileItems.size}}字节</div>\n' +
  3708. ' </div>\n' +
  3709. ' </div>\n' +
  3710. ' </div>\n' +
  3711. '</div>',
  3712. methods: {
  3713. fileGalleryOpen: function () {
  3714. var that = this;
  3715. $Gallery.GalleryDialogOpen({
  3716. max: 1,
  3717. size: that.size,
  3718. suffix: that.suffix,
  3719. multiple: false,
  3720. type: '2',
  3721. tabs: false,
  3722. callback: function (res) {
  3723. that.emitItemsEvent(res);
  3724. $App.$Message('视频上传成功!', 'success');
  3725. that.uploadStatus = false;
  3726. that.percentage = 0;
  3727. }
  3728. });
  3729. },
  3730. fileUploadPreview: function () {
  3731. var that = this;
  3732. $Preview.PreviewDialogOpen(that.fileItems.url);
  3733. },
  3734. fileUploadAgain: function () {
  3735. var that = this;
  3736. that.fileItems = {url: '', size: '', original: ''};
  3737. that.emitItemsEvent({url: '', size: '', original: ''});
  3738. that.uploadStatus = false;
  3739. that.percentage = 0;
  3740. if (that.onSuccess) {
  3741. that.onSuccess();
  3742. }
  3743. },
  3744. fileUploadProgress: function (event) {
  3745. var that = this;
  3746. that.percentage = parseFloat((event.percent).toFixed(2));
  3747. },
  3748. fileUploadSuccess: function (response, file, fileList) {
  3749. var that = this;
  3750. var _result = {url: '', original: '', size: '', code: 200};
  3751. switch (that.uploadOption.driver) {
  3752. case 'qiniu':
  3753. _result.url = that.uploadOption.domain + '/' + response.key;
  3754. _result.original = that._fileName;
  3755. _result.size = that._fileSize;
  3756. that.percentage = 0;
  3757. that.uploadStatus = false;
  3758. that.emitItemsEvent(_result);
  3759. if (that.onsuccess) {
  3760. that.onsuccess(_result);
  3761. }
  3762. $App.$Message('视频上传成功!', 'success');
  3763. break;
  3764. case'oss':
  3765. default:
  3766. if (response.code !== 200) {
  3767. that.percentage = 0;
  3768. that.uploadStatus = false;
  3769. $App.$Message(response.msg, 'warning');
  3770. return true;
  3771. } else {
  3772. that.percentage = 0;
  3773. that.uploadStatus = false;
  3774. that.emitItemsEvent(response.result);
  3775. if (that.onsuccess) {
  3776. that.onsuccess(response.result);
  3777. }
  3778. $App.$Message('视频上传成功!', 'success');
  3779. return true;
  3780. }
  3781. }
  3782. },
  3783. fileUploadError: function () {
  3784. var that = this;
  3785. that.percentage = 0;
  3786. that.uploadStatus = false;
  3787. $App.$Message('视频上传失败,请重试!', 'warning');
  3788. that.$refs.fileDialogUpload.clearFiles();
  3789. return true;
  3790. },
  3791. fileUploadBefore: function (file, e) {
  3792. var that = this;
  3793. /*验证图片大小*/
  3794. if (that.size) {
  3795. if ((file.size / 1048576) > that.size) {
  3796. $App.$Message('请上传' + that.size + 'M以内的视频', 'warning');
  3797. that.$refs.fileDialogUpload.clearFiles();
  3798. return false;
  3799. }
  3800. }
  3801. /*验证视频后缀*/
  3802. if (that.suffix) {
  3803. var args = ((file.name).split('.'));
  3804. if (args[args.length - 1]) {
  3805. var suffix = (that.suffix).split(',');
  3806. if ($.inArray(args[args.length - 1], suffix) < 0) {
  3807. $App.$Message('请上传' + that.suffix + '类型的视频', 'warning');
  3808. that.$refs.fileDialogUpload.clearFiles();
  3809. return false;
  3810. }
  3811. }
  3812. }
  3813. that._fileSize = (file.size / 1048576).toFixed(2);
  3814. that._fileName = file.name;
  3815. that.percentage = 1;
  3816. that.uploadStatus = true;
  3817. return true;
  3818. },
  3819. emitItemsEvent: function (value) {
  3820. var that = this;
  3821. that.fileItems = {
  3822. url: value.url,
  3823. size: value.size,
  3824. original: value.original
  3825. };
  3826. that.UploadToken();
  3827. that.$emit('change', JSON.stringify(that.fileItems));
  3828. },
  3829. UploadToken: function () {
  3830. var that = this;
  3831. if (that.gallery) return true;
  3832. $Gallery.GalleryUploadToken(function (res) {
  3833. that.uploadOption.driver = res.driver;
  3834. that.uploadOption.domain = res.domain;
  3835. that.action = res.action;
  3836. that.postData.token = res.token;
  3837. if (res.key) {
  3838. that.postData.key = res.key;
  3839. }
  3840. if (res.driver === 'local') {
  3841. that.action = '/admin/framework/common/fileUploads';
  3842. }
  3843. }, 3);
  3844. }
  3845. },
  3846. mounted: function () {
  3847. var that = this;
  3848. that.UploadToken();
  3849. that.postData.size = that.size ? that.size : 20;
  3850. that.postData.suffix = that.suffix ? that.suffix : 'doc,docx,xls,xlsx,xlsm,xlt,csv';
  3851. if (that.file) {
  3852. if ((typeof that.file) == 'object') {
  3853. that.fileItems = that.file;
  3854. that.$emit('change', JSON.stringify(that.fileItems));
  3855. } else {
  3856. if (!$Validator.json(that.file)) {
  3857. console.error('va-file components. File parameter requires a JSON string');
  3858. } else {
  3859. that.fileItems = JSON.parse(that.file);
  3860. that.$emit('change', JSON.stringify(that.fileItems));
  3861. }
  3862. }
  3863. } else {
  3864. that.fileItems = {
  3865. url: '',
  3866. size: '',
  3867. original: ''
  3868. };
  3869. that.$emit('change', JSON.stringify(that.fileItems));
  3870. }
  3871. that.uploadStatus = false;
  3872. that.percentage = 0;
  3873. }
  3874. });
  3875. Vue.component("va-file", {
  3876. props: {
  3877. action: {
  3878. type: String,
  3879. default: '/admin/framework/common/fileUploads'
  3880. },
  3881. size: {
  3882. type: Number,
  3883. default: 20
  3884. },
  3885. suffix: {
  3886. type: String,
  3887. default: 'doc,docx,xls,xlsx,xlsm,xlt,csv'
  3888. },
  3889. postData: {
  3890. type: Object,
  3891. default: {
  3892. size: 20,
  3893. suffix: 'doc,docx,xls,xlsx,xlsm,xlt,csv'
  3894. }
  3895. },
  3896. file: {
  3897. type: String,
  3898. default: "{url:'', size:'', original:''}"
  3899. },
  3900. gallery: {
  3901. type: Boolean,
  3902. default: true
  3903. },
  3904. preview: {
  3905. type: Boolean,
  3906. default: false
  3907. },
  3908. disabled: {
  3909. type: String,
  3910. default: false
  3911. },
  3912. onSuccess: {
  3913. type: String,
  3914. default: ''
  3915. },
  3916. },
  3917. data: function () {
  3918. return {
  3919. postHeaders: {
  3920. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  3921. },
  3922. uploadOption: {driver: 'local', domain: ''},
  3923. uploadStatus: false,
  3924. _fileName: '',
  3925. _fileSize: 0,
  3926. percentage: 0,
  3927. fileItems: {url: '', size: '', original: ''},
  3928. galleryOptions: {}
  3929. }
  3930. },
  3931. model: {
  3932. prop: 'file',
  3933. event: 'change'
  3934. },
  3935. watch: {
  3936. file(value) {
  3937. if (!this.fileItems.url) {
  3938. this.fileItems = JSON.parse(value);
  3939. this.$emit('change', JSON.stringify(this.fileItems));
  3940. }
  3941. }
  3942. },
  3943. template: '<div class="va-component-file" :disabled="disabled">\n' +
  3944. ' <el-upload\n' +
  3945. ' v-if="!fileItems.url && !uploadStatus && !gallery"\n' +
  3946. ' :action="action"\n' +
  3947. ' :headers="postHeaders"\n' +
  3948. ' limit="1" drag\n' +
  3949. ' :show-file-list="false"\n' +
  3950. ' :data="postData"\n' +
  3951. ' :disabled="disabled"\n' +
  3952. ' :on-progress="fileUploadProgress"\n' +
  3953. ' :on-success="fileUploadSuccess"\n' +
  3954. ' :on-error="fileUploadError"\n' +
  3955. ' :before-upload="fileUploadBefore"\n' +
  3956. ' ref="fileDialogUpload"\n' +
  3957. ' >\n' +
  3958. ' <div class="upload">\n' +
  3959. ' <i class="el-icon-upload icon" :disabled="disabled"></i>\n' +
  3960. ' <div class="el-upload__text" style="margin-top: -12px">\n' +
  3961. ' <el-link type="primary" :underline="false">\n' +
  3962. ' <span style="font-weight: 500;font-size: 15px">点击文件上传</span>\n' +
  3963. ' </el-link>\n' +
  3964. ' <div style="font-size: 12px;margin-top:-15px">\n' +
  3965. ' <div style="color: #909399;height: 15px">文件大小{{size}}MB以内</div>\n' +
  3966. ' <div style="color: #909399;height: 15px">支持类型:{{suffix}}</div>\n' +
  3967. ' </div>\n' +
  3968. ' </div>\n' +
  3969. ' </div>\n' +
  3970. ' </el-upload>\n' +
  3971. ' <div class="upload" @click="fileGalleryOpen" v-if="!fileItems.url && !uploadStatus && gallery">\n' +
  3972. ' <i class="el-icon-upload icon" :disabled="disabled"></i>\n' +
  3973. ' <div class="el-upload__text" style="margin-top: -12px">\n' +
  3974. ' <el-link type="primary" :disabled="disabled" :underline="false">\n' +
  3975. ' <span style="font-weight: 500;font-size: 15px">点击文件上传</span>\n' +
  3976. ' </el-link>\n' +
  3977. ' <div style="font-size: 12px;margin-top:-15px">\n' +
  3978. ' <div style="color: #909399;margin-top: 0">文件大小{{size}}MB以内</div>\n' +
  3979. ' <div style="color: #909399;margin-top: -20px">支持类型:{{suffix}}</div>\n' +
  3980. ' </div>\n' +
  3981. ' </div>\n' +
  3982. ' </div>\n' +
  3983. '\n' +
  3984. ' <div class="progress" v-if="uploadStatus && percentage > 0">\n' +
  3985. ' <el-progress type="circle" :percentage="percentage" color=" var(--themeColors)"></el-progress>\n' +
  3986. ' </div>\n' +
  3987. '\n' +
  3988. ' <div class="files" v-if="fileItems.url && !uploadStatus">\n' +
  3989. ' <el-button :disabled="disabled" class="Va-button button" size="mini" type="default" @click="fileUploadAgain">重新上传</el-button>\n' +
  3990. ' <el-button :disabled="disabled" class="Va-button button" size="mini" v-if="preview" type="default" @click="fileUploadPreview" style="top:42px">预览文件</el-button>\n' +
  3991. ' <i class="el-icon-document icon"></i>\n' +
  3992. ' <div class="text">\n' +
  3993. ' <span style="font-weight: 500;font-size: 15px;line-height: 20px;display: inline-block;width: 90%;margin-top:10px">{{fileItems.original}}</span>\n' +
  3994. ' <div style="font-size: 12px;margin-top: -20px">\n' +
  3995. ' <div class="el-upload__tip" slot="tip" style="color: #909399">文件大小:{{fileItems.size}}字节</div>\n' +
  3996. ' </div>\n' +
  3997. ' </div>\n' +
  3998. ' </div>\n' +
  3999. '</div>',
  4000. methods: {
  4001. fileGalleryOpen: function () {
  4002. var that = this;
  4003. $Gallery.GalleryDialogOpen({
  4004. max: 1,
  4005. size: that.size,
  4006. suffix: that.suffix,
  4007. multiple: false,
  4008. type: '3',
  4009. tabs: false,
  4010. callback: function (res) {
  4011. that.emitItemsEvent(res);
  4012. $App.$Message('文件上传成功!', 'success');
  4013. that.uploadStatus = false;
  4014. that.percentage = 0;
  4015. }
  4016. });
  4017. },
  4018. fileUploadPreview: function () {
  4019. var that = this;
  4020. $Preview.PreviewDialogOpen(that.fileItems.url);
  4021. },
  4022. fileUploadAgain: function () {
  4023. var that = this;
  4024. that.fileItems = {url: '', size: '', original: ''};
  4025. that.emitItemsEvent({url: '', size: '', original: ''});
  4026. that.uploadStatus = false;
  4027. that.percentage = 0;
  4028. if (that.onSuccess) {
  4029. that.onSuccess();
  4030. }
  4031. },
  4032. fileUploadProgress: function (event) {
  4033. var that = this;
  4034. that.percentage = parseFloat((event.percent).toFixed(2));
  4035. },
  4036. fileUploadSuccess: function (response, file, fileList) {
  4037. var that = this;
  4038. var _result = {url: '', original: '', size: '', code: 200};
  4039. switch (that.uploadOption.driver) {
  4040. case 'qiniu':
  4041. _result.url = that.uploadOption.domain + '/' + response.key;
  4042. _result.original = that._fileName;
  4043. _result.size = that._fileSize;
  4044. that.percentage = 0;
  4045. that.uploadStatus = false;
  4046. that.emitItemsEvent(_result);
  4047. if (that.onsuccess) {
  4048. that.onsuccess(_result);
  4049. }
  4050. $App.$Message('文件上传成功!', 'success');
  4051. break;
  4052. case'oss':
  4053. default:
  4054. if (response.code !== 200) {
  4055. that.percentage = 0;
  4056. that.uploadStatus = false;
  4057. $App.$Message(response.msg, 'warning');
  4058. return true;
  4059. } else {
  4060. that.percentage = 0;
  4061. that.uploadStatus = false;
  4062. that.emitItemsEvent(response.result);
  4063. if (that.onsuccess) {
  4064. that.onsuccess(response.result);
  4065. }
  4066. $App.$Message('文件上传成功!', 'success');
  4067. return true;
  4068. }
  4069. }
  4070. },
  4071. fileUploadError: function () {
  4072. var that = this;
  4073. that.percentage = 0;
  4074. that.uploadStatus = false;
  4075. $App.$Message('文件上传失败,请重试!', 'warning');
  4076. that.$refs.fileDialogUpload.clearFiles();
  4077. return true;
  4078. },
  4079. fileUploadBefore: function (file, e) {
  4080. var that = this;
  4081. /*验证图片大小*/
  4082. if (that.size) {
  4083. if ((file.size / 1048576) > that.size) {
  4084. $App.$Message('请上传' + that.size + 'M以内的文件', 'warning');
  4085. that.$refs.fileDialogUpload.clearFiles();
  4086. return false;
  4087. }
  4088. }
  4089. /*验证文件后缀*/
  4090. if (that.suffix) {
  4091. var args = ((file.name).split('.'));
  4092. if (args[args.length - 1]) {
  4093. var suffix = (that.suffix).split(',');
  4094. if ($.inArray(args[args.length - 1], suffix) < 0) {
  4095. $App.$Message('请上传' + that.suffix + '类型的文件', 'warning');
  4096. that.$refs.fileDialogUpload.clearFiles();
  4097. return false;
  4098. }
  4099. }
  4100. }
  4101. that._fileSize = (file.size / 1048576).toFixed(2);
  4102. that._fileName = file.name;
  4103. that.percentage = 1;
  4104. that.uploadStatus = true;
  4105. return true;
  4106. },
  4107. emitItemsEvent: function (value) {
  4108. var that = this;
  4109. that.fileItems = {
  4110. url: value.url,
  4111. size: value.size,
  4112. original: value.original
  4113. };
  4114. that.UploadToken();
  4115. that.$emit('change', JSON.stringify(that.fileItems));
  4116. },
  4117. UploadToken: function () {
  4118. var that = this;
  4119. if (that.gallery) return true;
  4120. $Gallery.GalleryUploadToken(function (res) {
  4121. that.uploadOption.driver = res.driver;
  4122. that.uploadOption.domain = res.domain;
  4123. that.action = res.action;
  4124. that.postData.token = res.token;
  4125. if (res.key) {
  4126. that.postData.key = res.key;
  4127. }
  4128. if (res.driver === 'local') {
  4129. that.action = '/admin/framework/common/fileUploads';
  4130. }
  4131. }, 3);
  4132. }
  4133. },
  4134. mounted: function () {
  4135. var that = this;
  4136. that.UploadToken();
  4137. that.postData.size = that.size ? that.size : 20;
  4138. that.postData.suffix = that.suffix ? that.suffix : 'doc,docx,xls,xlsx,xlsm,xlt,csv';
  4139. if (that.file) {
  4140. if ((typeof that.file) == 'object') {
  4141. that.fileItems = that.file;
  4142. that.$emit('change', JSON.stringify(that.fileItems));
  4143. } else {
  4144. if (!$Validator.json(that.file)) {
  4145. console.error('va-file components. File parameter requires a JSON string');
  4146. } else {
  4147. that.fileItems = JSON.parse(that.file);
  4148. that.$emit('change', JSON.stringify(that.fileItems));
  4149. }
  4150. }
  4151. } else {
  4152. that.fileItems = {
  4153. url: '',
  4154. size: '',
  4155. original: ''
  4156. };
  4157. that.$emit('change', JSON.stringify(that.fileItems));
  4158. }
  4159. that.uploadStatus = false;
  4160. that.percentage = 0;
  4161. }
  4162. });
  4163. /*弹窗时需要销毁 va-editor; 最好是同弹窗一起v-if*/
  4164. Vue.component("va-editor", {
  4165. props: {
  4166. height: {
  4167. type: String,
  4168. default: '200'
  4169. },
  4170. max_height: {
  4171. type: String,
  4172. default: '500'
  4173. },
  4174. id: {
  4175. type: String,
  4176. default: $Request.random(12)
  4177. },
  4178. placeholder: {
  4179. type: String,
  4180. default: '请填写内容'
  4181. },
  4182. disabled: {
  4183. type: String,
  4184. default: false
  4185. },
  4186. content: {
  4187. type: String,
  4188. default: ''
  4189. },
  4190. inline: {
  4191. type: Boolean,
  4192. default: false
  4193. },
  4194. toolbar: {
  4195. type: String,
  4196. default: '#fixed-editor-util'
  4197. },
  4198. mode: {
  4199. type: String,
  4200. default: 'ordinary'
  4201. }, //simple, ordinary ,complex
  4202. is_news: {
  4203. type: String,
  4204. default: '0'
  4205. },
  4206. },
  4207. data: function () {
  4208. return {
  4209. vaEditorObj: {},
  4210. reloadNum: 5,
  4211. }
  4212. },
  4213. model: {
  4214. prop: 'content',
  4215. event: 'change'
  4216. },
  4217. watch: {
  4218. content(value) {
  4219. var that = this;
  4220. // if (!that.vaEditorObj.getContent({
  4221. // format: 'text'
  4222. // }) && value) {
  4223. // that.vaEditorObj.setContent(value);
  4224. // }
  4225. return true;
  4226. },
  4227. },
  4228. template: '<div :id="id" class="va-editor tinymce-editor-ele" style="opacity: 0;width: 0;height: 0"></div>',
  4229. methods: {
  4230. createEditor: function () {
  4231. var that = this;
  4232. var plugins, toolbar = '';
  4233. that.mode = that.mode ? that.mode : 'ordinary';
  4234. switch (that.mode) {
  4235. /*emoticons*/
  4236. case 'simple':
  4237. plugins = 'print autosave preview searchreplace autolink directionality visualblocks visualchars fullscreen gallery image link code codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern emoticons bdmap autoresize toolbarsticky';//media
  4238. toolbar = 'code undo redo | removeformat formats fontselect fontsizeselect bold italic underline strikethrough hr blockquote forecolor backcolor | gallery table \
  4239. //| alignleft aligncenter alignright alignjustify outdent indent indent2em lineheight ';//image media imagetools
  4240. break;
  4241. case 'ordinary':
  4242. plugins = 'print autosave preview searchreplace autolink directionality visualblocks visualchars fullscreen gallery link code codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern emoticons bdmap autoresize toolbarsticky';//media
  4243. toolbar = 'code undo redo | removeformat formats fontselect fontsizeselect bold italic underline strikethrough hr blockquote forecolor backcolor \
  4244. //| alignleft aligncenter alignright alignjustify outdent indent indent2em lineheight | gallery';//media
  4245. break;
  4246. case 'complex':
  4247. plugins = '';
  4248. toolbar = '';
  4249. break;
  4250. }
  4251. $(function () {
  4252. tinymce.init({
  4253. selector: '#' + that.id,
  4254. resize: true,
  4255. language: 'zh_CN',
  4256. menubar: that.mode === 'simple' ? false : ' file edit view table insert tool format image',
  4257. inline: that.inline,
  4258. font_formats: "微软雅黑='微软雅黑';宋体='宋体';黑体='黑体';仿宋='仿宋';楷体='楷体';隶书='隶书';幼圆='幼圆';Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings",
  4259. toolbar_groups: {
  4260. textformat: {
  4261. text: '文字格式',
  4262. icon: 'text-color',
  4263. tooltip: 'Formatting',
  4264. items: 'forecolor backcolor bold italic underline strikethrough',
  4265. },
  4266. paragraph: {
  4267. text: '段落',
  4268. icon: 'align-left',
  4269. tooltip: 'alignment',
  4270. items: 'alignleft aligncenter alignright alignjustify outdent indent indent2em lineheight',
  4271. },
  4272. alignments: {
  4273. text: '对齐方式',
  4274. icon: 'align-left',
  4275. tooltip: 'alignment',
  4276. items: 'alignleft aligncenter alignright alignjustify outdent indent indent2em lineheight ',
  4277. },
  4278. },
  4279. plugins: plugins,
  4280. toolbar: toolbar,
  4281. // plugins: 'print autosave preview searchreplace autolink directionality visualblocks visualchars fullscreen image media link code codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern emoticons bdmap autoresize ',//autosave
  4282. // toolbar: 'preview fullscreen code undo redo restoredraft | textformat | paragraph | styleselect formatselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \
  4283. // table emoticons hr | powerpaste',
  4284. // plugins: 'print autosave preview searchreplace autolink directionality visualblocks visualchars fullscreen image media link code codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern emoticons bdmap autoresize ',//autosave
  4285. // toolbar: 'code undo redo restoredraft formatting | forecolor backcolor bold italic underline strikethrough | alignleft aligncenter alignright alignjustify outdent indent | \
  4286. // styleselect formatselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \
  4287. // table emoticons hr | powerpaste',
  4288. placeholder: that.placeholder ? that.placeholder : '请输入内容',
  4289. readonly: that.disabled, //只读模式
  4290. branding: false, //隐藏右下角技术支持
  4291. statusbar: false,
  4292. elementpath: false, //隐藏底栏的元素路径
  4293. custom_undo_redo_levels: 30, //撤销次数
  4294. object_resizing: true, //调整大小控件开关
  4295. contextmenu_never_use_native: false, //在编辑器中屏蔽浏览器本身的右键菜单
  4296. fixed_toolbar_container: that.inline ? that.toolbar : '', // '#fixed-editor-util',//指定工具栏在某一容器顶部固定。
  4297. // fixed_toolbar_container: '#va-editor-content',//指定工具栏在某一容器顶部固定。
  4298. custom_ui_selector: 'body',
  4299. toolbar_mode: 'wrap',
  4300. // toolbar_sticky: true,
  4301. cfyun_toolbar_sticky: true,
  4302. toolbar_sticky_type: false,
  4303. toolbar_sticky_elem_height: 60,
  4304. toolbar_sticky_wrap: '.Va-container',
  4305. fontsize_formats: '12px 14px 16px 18px 24px 36px 48px 56px 72px',
  4306. remove_trailing_brs: true, //删除最尾的br
  4307. width: '100%',
  4308. min_height: parseInt(that.height),
  4309. autoresize_bottom_margin: 50, //自动调整编辑器大小的方法以适应内容
  4310. //autoresize_overflow_padding: 50,//指定编辑器body初始化时两侧的距离,相当于padding-left加padding-right
  4311. max_height: parseInt(that.max_height),
  4312. autolink: true, //autolink插件会自动创建超链接
  4313. fullscreen_native: true, //全屏将不在是网页全屏,而是使用浏览器的全屏模式
  4314. /*图片参数*/
  4315. image_uploadtab: true, //配置了images_upload_url后会在图像对话框中添加“上传”标签用于上传本地图像,此选项设false可关闭该标签。
  4316. image_advtab: true, //为图像属性编辑窗口添加高级属性
  4317. automatic_uploads: false, //Data URL/Blob URL插入图片和文件到内容区的方式
  4318. images_upload_credentials: true,
  4319. file_picker_types: 'image media',
  4320. images_upload_url: '/admin/framework/common/uploadEditor',
  4321. autosave_ask_before_unload: false, //当关闭或跳转URL时,弹出提示框提醒用户仍未保存变更内容。
  4322. autosave_interval: '5s', //自动存稿的世界间隔。注意该值为字符串,以秒为单位
  4323. convert_urls: false, //上传文件自动转换相对路径
  4324. image_caption: true, //在弹出框中增加一个“标题”选项,开启后图片将被包含在figure(HTML5新增)内。
  4325. image_description: true, //为img添加属性alt
  4326. typeahead_urls: true, //设false就是关闭地址input的自动完成。
  4327. media_alt_source: false, //显示隐藏资源备用地址输入框
  4328. media_poster: false, //显示隐藏图片封面输入框
  4329. media_live_embeds: true,
  4330. hidden_input: false,
  4331. visual: false,
  4332. inline_boundaries: false,
  4333. auto_focus: false,
  4334. setup: function (editor) {
  4335. that.vaEditorObj = editor;
  4336. editor.on('input change undo redo execCommand KeyUp', function (e) {
  4337. $(".el-container.is-vertical").css({
  4338. flexDirection: 'inherit'
  4339. });
  4340. $(".el-container.is-vertical").css({
  4341. flexDirection: 'column'
  4342. });
  4343. that.$emit('change', editor.getContent());
  4344. });
  4345. that.vaEditorObj.setMode(that.disabled ? 'readonly' : 'design');
  4346. },
  4347. init_instance_callback: function (editor) {
  4348. setTimeout(function () {
  4349. that.vaEditorObj.setContent(that.content);
  4350. }, 100);
  4351. //that.vaEditorObj.focus();
  4352. },
  4353. handle_event_callback: function (event) {
  4354. that.vaEditorObj.focus();
  4355. },
  4356. audio_template_callback: function (data) {
  4357. return '<audio controls>' + '\n<source src="' + data.source1 + '"' + (data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' + '</audio>';
  4358. },
  4359. /*文件上传回调*/
  4360. file_picker_callback: function (callback, value, meta) {
  4361. window.galleryObj = {};
  4362. var fileParams = {
  4363. ts: meta.filetype,
  4364. ft: 1,
  4365. is_news: that.is_news,
  4366. mx: 1,
  4367. ck: 'ComponentPictureTemporaryEvent',
  4368. se: 20,
  4369. };
  4370. switch (meta.filetype) {
  4371. case "image":
  4372. fileParams.ft = 1;
  4373. fileParams.mx = 1;
  4374. fileParams.se = 20;
  4375. break;
  4376. case "media":
  4377. fileParams.ft = 2;
  4378. fileParams.mx = 1;
  4379. fileParams.se = 100;
  4380. break;
  4381. case "file":
  4382. fileParams.ft = 3;
  4383. fileParams.mx = 1;
  4384. fileParams.se = 100;
  4385. break;
  4386. default:
  4387. break;
  4388. }
  4389. $Gallery.GalleryDialogOpen({
  4390. max: fileParams.mx,
  4391. size: fileParams.se,
  4392. is_new: fileParams.is_news,
  4393. multiple: false,
  4394. type: fileParams.ft,
  4395. callback: function (res) {
  4396. callback(res.url, {
  4397. source2: res.url,
  4398. poster: res.original
  4399. });
  4400. }
  4401. });
  4402. },
  4403. });
  4404. });
  4405. if (!that.vaEditorObj.id && that.reloadNum > 0) {
  4406. setTimeout(function () {
  4407. that.createEditor();
  4408. that.reloadNum = that.reloadNum - 1;
  4409. }, 500);
  4410. }
  4411. }
  4412. },
  4413. beforeDestroy: function () {
  4414. tinymce.remove();
  4415. },
  4416. beforeCreate: function () {
  4417. },
  4418. created: function () {
  4419. var that = this;
  4420. setTimeout(function () {
  4421. that.createEditor()
  4422. }, 100);
  4423. },
  4424. mounted: function () {
  4425. }
  4426. });
  4427. Vue.component('va-timer', {
  4428. props: {
  4429. time: {type: Number, default: 0},
  4430. },
  4431. data: function () {
  4432. return {
  4433. flag:null,
  4434. hour:0,
  4435. minute:0,
  4436. second:0,
  4437. hour_time:'00',
  4438. minute_time:'00',
  4439. second_time:'00',
  4440. }
  4441. },
  4442. model: {
  4443. prop: 'file',
  4444. event: 'change'
  4445. },
  4446. template: '<div style="display: inline">' +
  4447. '<span>{{hour_time}}</span>' +
  4448. '<span>:</span>' +
  4449. '<span>{{minute_time}}</span>' +
  4450. '<span>:</span>' +
  4451. '<span>{{second_time}}</span>' +
  4452. '</div>',
  4453. methods: {
  4454. start(time){
  4455. var that = this;
  4456. if (time > 0){
  4457. // 初始化时间
  4458. var nowTime = Date.now()
  4459. var date = new Date(parseInt(nowTime - (time * 1000)))
  4460. that.hour = date.getUTCHours();
  4461. that.minute = date.getUTCMinutes();
  4462. that.second = date.getUTCSeconds();
  4463. }
  4464. // 开始定时
  4465. that.flag = setInterval(()=>{
  4466. that.second += 1;
  4467. if(that.second >= 60){
  4468. that.second = 0;
  4469. that.minute += 1;
  4470. }
  4471. if (that.minute >= 60){
  4472. that.minute = 0;
  4473. that.hour += 1;
  4474. }
  4475. that.hour_time = that.zeroize(that.hour);
  4476. that.minute_time = that.zeroize(that.minute);
  4477. that.second_time = that.zeroize(that.second);
  4478. },1000)
  4479. },
  4480. zeroize(n){
  4481. return n < 10 ? '0' + n : "" + n;
  4482. }
  4483. },
  4484. mounted: function() {
  4485. var that = this;
  4486. that.start(that.time);
  4487. }
  4488. });
  4489. // Other
  4490. $(function () {
  4491. // document.getElementsByClassName('el-drawer__container').onclick = function () {
  4492. $('body').on('mousedown', '.el-drawer__container', function (e) {
  4493. // $DrawerForms.methods.handleWrapperMousedown(e);
  4494. })
  4495. $('body').on('mouseup', '.el-drawer__container', function (e) {
  4496. // $DrawerForms.methods.handleWrapperMouseup(e);
  4497. })
  4498. $('body').on('mousedown', '.el-dialog__wrapper', function (e) {
  4499. // $DialogForms.methods.handleWrapperMousedown(e);
  4500. })
  4501. $('body').on('mouseup', '.el-dialog__wrapper', function (e) {
  4502. // $DialogForms.methods.handleWrapperMouseup(e);
  4503. })
  4504. /**
  4505. * panda
  4506. * 页面加载进度条
  4507. */
  4508. if (location.hostname.match(/ricostacruz\.com$/)) {
  4509. var _gaq = _gaq || [];
  4510. _gaq.push(["_setAccount", "UA-20473929-1"]), _gaq.push(["_trackPageview"]), function () {
  4511. var a = document.createElement("script");
  4512. a.type = "text/javascript", a.async = !0, a.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
  4513. var b = document.getElementsByTagName("script")[0];
  4514. b.parentNode.insertBefore(a, b)
  4515. }()
  4516. }
  4517. $('body').show();
  4518. $('.version').text(NProgress.version);
  4519. NProgress.start();
  4520. setTimeout(function () {
  4521. NProgress.done();
  4522. $('.fade').removeClass('out');
  4523. }, 1000);
  4524. $("#b-0").click(function () {
  4525. NProgress.start();
  4526. });
  4527. $("#b-40").click(function () {
  4528. NProgress.set(0.4);
  4529. });
  4530. $("#b-inc").click(function () {
  4531. NProgress.inc();
  4532. });
  4533. $("#b-100").click(function () {
  4534. NProgress.done();
  4535. });
  4536. var HN = [];
  4537. HN.factory = function (e) {
  4538. return function () {
  4539. HN.push([e].concat(Array.prototype.slice.call(arguments, 0)))
  4540. };
  4541. },
  4542. HN.on = HN.factory("on"),
  4543. HN.once = HN.factory("once"),
  4544. HN.off = HN.factory("off"),
  4545. HN.emit = HN.factory("emit"),
  4546. HN.load = function () {
  4547. var e = "hn-button.js";
  4548. if (document.getElementById(e)) return;
  4549. var t = document.createElement("script");
  4550. //t.id=e,t.src="//hn-button.herokuapp.com/hn-button.js";
  4551. var n = document.getElementsByTagName("script")[0];
  4552. n.parentNode.insertBefore(t, n)
  4553. }, HN.load();
  4554. /**
  4555. * panda
  4556. * 页面加载进度条end.
  4557. */
  4558. })
  4559. //表格关闭
  4560. function removeTableMoveEvent(obj) {
  4561. $(obj).parent().removeClass('Va-table-move');
  4562. $(obj).remove();
  4563. }
  4564. function in_array(val, arr) {
  4565. for (var i = 0, len = arr.length; i < len; i++) {
  4566. if (val === arr[i]) {
  4567. return true;
  4568. }
  4569. }
  4570. return false;
  4571. }
  4572. // 主题色
  4573. var themeStyle = {
  4574. index: {
  4575. themeColors: "#009688",
  4576. themeTextColors: "#F9F9F9",
  4577. themeSelectColors: "#606266",
  4578. headerBackground: "#fff",
  4579. headerTextColors: "#303133",
  4580. leftBackground: "#344058",
  4581. leftTextColors: "#fff",
  4582. buttonHoverColors: "#009688"
  4583. },
  4584. purple: {
  4585. themeColors: "#d21074",
  4586. themeTextColors: "#F9F9F9",
  4587. themeSelectColors: "#606266",
  4588. headerBackground: "#fff",
  4589. headerTextColors: "#303133",
  4590. leftBackground: "#564d67",
  4591. leftTextColors: "#fff",
  4592. buttonHoverColors: "#d21074"
  4593. },
  4594. blue: {
  4595. themeColors: "#2790a6",
  4596. themeTextColors: "#F9F9F9",
  4597. themeSelectColors: "#606266",
  4598. headerBackground: "#fff",
  4599. headerTextColors: "#303133",
  4600. leftBackground: "#2d6973",
  4601. leftTextColors: "#fff",
  4602. buttonHoverColors: "#d21074"
  4603. }
  4604. }