plugin--.js 92 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338
  1. var palette = [
  2. ["rgb(0, 0, 0)", "rgb(67, 67, 67)", "rgb(102, 102, 102)", "rgb(153, 153, 153)", "rgb(183, 183, 183)",
  3. "rgb(204, 204, 204)", "rgb(217, 217, 217)", "rgb(239, 239, 239)", "rgb(243, 243, 243)", "rgb(255, 255, 255)"],
  4. ["rgb(152, 0, 0)", "rgb(255, 0, 0)", "rgb(255, 153, 0)", "rgb(255, 255, 0)", "rgb(0, 255, 0)",
  5. "rgb(0, 255, 255)", "rgb(74, 134, 232)", "rgb(0, 0, 255)", "rgb(153, 0, 255)", "rgb(255, 0, 255)"],
  6. ["rgb(230, 184, 175)", "rgb(244, 204, 204)", "rgb(252, 229, 205)", "rgb(255, 242, 204)", "rgb(217, 234, 211)",
  7. "rgb(208, 224, 227)", "rgb(201, 218, 248)", "rgb(207, 226, 243)", "rgb(217, 210, 233)", "rgb(234, 209, 220)",
  8. "rgb(221, 126, 107)", "rgb(234, 153, 153)", "rgb(249, 203, 156)", "rgb(255, 229, 153)", "rgb(182, 215, 168)",
  9. "rgb(162, 196, 201)", "rgb(164, 194, 244)", "rgb(159, 197, 232)", "rgb(180, 167, 214)", "rgb(213, 166, 189)",
  10. "rgb(204, 65, 37)", "rgb(224, 102, 102)", "rgb(246, 178, 107)", "rgb(255, 217, 102)", "rgb(147, 196, 125)",
  11. "rgb(118, 165, 175)", "rgb(109, 158, 235)", "rgb(111, 168, 220)", "rgb(142, 124, 195)", "rgb(194, 123, 160)",
  12. "rgb(166, 28, 0)", "rgb(204, 0, 0)", "rgb(230, 145, 56)", "rgb(241, 194, 50)", "rgb(106, 168, 79)",
  13. "rgb(69, 129, 142)", "rgb(60, 120, 216)", "rgb(61, 133, 198)", "rgb(103, 78, 167)", "rgb(166, 77, 121)",
  14. "rgb(133, 32, 12)", "rgb(153, 0, 0)", "rgb(180, 95, 6)", "rgb(191, 144, 0)", "rgb(56, 118, 29)",
  15. "rgb(19, 79, 92)", "rgb(17, 85, 204)", "rgb(11, 83, 148)", "rgb(53, 28, 117)", "rgb(116, 27, 71)",
  16. "rgb(91, 15, 0)", "rgb(102, 0, 0)", "rgb(120, 63, 4)", "rgb(127, 96, 0)", "rgb(39, 78, 19)",
  17. "rgb(12, 52, 61)", "rgb(28, 69, 135)", "rgb(7, 55, 99)", "rgb(32, 18, 77)", "rgb(76, 17, 48)"]
  18. ];
  19. // RGB转16进制(rgb2hex)
  20. function colorRGB2Hex(color) {
  21. var rgb = color.split(',');
  22. var r = parseInt(rgb[0].split('(')[1]);
  23. var g = parseInt(rgb[1]);
  24. var b = parseInt(rgb[2].split(')')[0]);
  25. var hex = "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
  26. return hex;
  27. }
  28. // 基于颜色插件 获取颜色值
  29. function getFontColor(obj) {
  30. var fontColor = $(obj).spectrum("get");
  31. fontColor = 'rgb(' + fontColor._r + ',' + fontColor._g + ',' + fontColor._b + ')';
  32. return colorRGB2Hex(fontColor);
  33. }
  34. // 基于颜色插件 获取颜色值的透明度
  35. function getAlpha(obj) {
  36. return $(obj).spectrum("get")._a;
  37. }
  38. // 汉字 字符
  39. function getByteLen(val) {
  40. var len = 0;
  41. for (var i = 0; i < val.length; i++) {
  42. var a = val.charAt(i);
  43. if (a.match(/[^\x00-\xff]/ig) != null) {
  44. len += 2;
  45. } else {
  46. len += 1;
  47. }
  48. }
  49. return len;
  50. }
  51. // 第三方分享
  52. // 分享位置
  53. /*
  54. $(".plugin-share .con").click(function () {
  55. $(".plugin-share .con").removeClass("active");
  56. $(this).addClass("active");
  57. });
  58. */
  59. // 分享方式
  60. $(".plugin-share .s-way .s-ul li").click(function () {
  61. var $elShow = $(".plugin-share .app-share");
  62. var i = $(this).data("way");
  63. $(this).addClass("active").siblings().removeClass("active");
  64. if (i == 1) {
  65. $elShow.show();
  66. } else {
  67. $elShow.hide();
  68. }
  69. });
  70. // 第三方分享 点击保存,验证
  71. var wechatId = '';
  72. var wechatSecret = '';
  73. var shareText = '';
  74. var shareUrl = '';
  75. var shareWay = 1;
  76. $("#shareModal .plugin-save").click(function () {
  77. var $wxId = $("#shareModal input[name=wxId]");
  78. var $wxSecret = $("#shareModal input[name=wxSecret]");
  79. var $text = $("#shareModal input[name=text]");
  80. var $link1 = $("#shareModal input[name=link1]");
  81. var way = $("#shareModal .s-ul li.active").attr("data-way");
  82. if (way == 1) {
  83. if ($wxId.val().length > 0 && $wxSecret.val().length > 0) {
  84. $wxSecret.next(".error").hide();
  85. } else {
  86. $wxSecret.next(".error").show();
  87. }
  88. wechatId = $wxId.val();
  89. wechatSecret = $wxSecret.val();
  90. } else {
  91. $wxSecret.next(".error").hide();
  92. wechatId = '';
  93. wechatSecret = '';
  94. }
  95. if (verifyUrl($link1.val())) {
  96. $link1.parents(".form-group").removeClass("form-error");
  97. } else {
  98. $link1.parents(".form-group").addClass("form-error");
  99. }
  100. var errorLEength = $(".plugin-share .error:visible").length;
  101. if (errorLEength == 0) {
  102. $("#shareModal").modal("hide");
  103. } else {
  104. $("#shareModal").modal("show");
  105. }
  106. shareText = $text.val();
  107. shareUrl = $link1.val();
  108. shareWay = way;
  109. share = {"way": way, "wxId": wechatId, "wxSecret": wechatSecret, "shareText": shareText, "shareUrl": shareUrl};
  110. });
  111. $("#keystoreModal .plugin-save").click(function () {
  112. var storeFileContent = $("input[name=store_file_content]").val();
  113. var storeStorepass = $("input[name=store_storepass]").val();
  114. var storeAlias = $("input[name=store_alias]").val();
  115. var storeKeypass = $("input[name=store_keypass]").val();
  116. if (!(storeStorepass && storeAlias && storeKeypass)) {
  117. alert('请填写必填项');
  118. return false;
  119. }
  120. androidKey = {
  121. 'save': '1',
  122. 'type': '2',
  123. 'file_url': storeFileContent,
  124. 'storepass': storeStorepass,
  125. 'alias': storeAlias,
  126. 'keypass': storeKeypass
  127. }
  128. console.log(androidKey);
  129. $("#keystoreModal").modal("hide");
  130. })
  131. // 左侧栏 显示方式
  132. // 左侧栏背景颜色
  133. $("#colorPicker5").spectrum({
  134. color: "#f3f3f3",//初始化颜色
  135. showInput: true,//显示输入
  136. showAlpha: true, // 透明度
  137. containerClassName: "full-spectrum",
  138. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  139. showPalette: true,//显示选择器面板
  140. showSelectionPalette: true,//记住选择过的颜色
  141. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  142. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  143. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  144. chooseText: "确定",
  145. cancelText: "取消",
  146. move: function (color) {//选择器右边面板移动时触发
  147. },
  148. show: function () {//选择器面板显示时触发
  149. },
  150. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  151. },
  152. hide: function (color) {//选择器面板隐藏时触发
  153. updateAsideBackground(color);
  154. },
  155. //选择器面板颜色设置
  156. palette: palette
  157. });
  158. function updateAsideBackground(color) {
  159. $("#asideModal .aside-modal .a-left .phone .bg").css("background-color", color);
  160. }
  161. // 左侧栏字体颜色
  162. $("#asideFontColor").spectrum({
  163. color: "#333",//初始化颜色
  164. showInput: true,//显示输入
  165. showAlpha: true, // 透明度
  166. containerClassName: "full-spectrum",
  167. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  168. showPalette: true,//显示选择器面板
  169. showSelectionPalette: true,//记住选择过的颜色
  170. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  171. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  172. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  173. chooseText: "确定",
  174. cancelText: "取消",
  175. move: function (color) {//选择器右边面板移动时触发
  176. },
  177. show: function () {//选择器面板显示时触发
  178. },
  179. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  180. },
  181. hide: function (color) {//选择器面板隐藏时触发
  182. updateAsideFontColor(color);
  183. },
  184. //选择器面板颜色设置
  185. palette: palette
  186. });
  187. function updateAsideFontColor(color) {
  188. $("#asideModal .a-left .aside-nav li .iconfont").css("color", color);
  189. $("#asideModal .a-left .aside-nav li .text").css("color", color);
  190. }
  191. tab.radioRound({
  192. el: "#displayMode li",
  193. checkedClass: "icon-radio-checked"
  194. });
  195. // 左侧栏 顶部显示APP图标
  196. tab.radioTick({
  197. el: ".plugin-aside .top-show ul li"
  198. });
  199. // 左侧栏 图标显示隐藏
  200. $(".plugin-aside .top-show ul li").click(function () {
  201. var i = $(this).index();
  202. var $icon = $("#asideModal .a-left .phone .aside-icon");
  203. if (i == 0) {
  204. $icon.show();
  205. } else {
  206. $icon.hide();
  207. }
  208. });
  209. // 左侧栏 显示方式
  210. /*
  211. $("#displayMode li").click(function () {
  212. var index = $(this).index();
  213. $("#asideModal .phone .b-right img").eq(index).show().siblings().hide();
  214. });
  215. */
  216. // 左侧栏 下拉框change字体颜色设置、显示链接输入框
  217. $(".plugin-aside .n-list select").change(function () {
  218. $(this).css("color", "#333");
  219. var selectedVal = $(this).find(":selected").val();
  220. // console.log(selectedVal);
  221. if (selectedVal == "link_app" || selectedVal == "link_url") {
  222. $(this).parents("dd").find(".n-link").css("visibility", "visible").addClass("link-show");
  223. } else {
  224. $(this).parents("dd").find(".n-link").css("visibility", "hidden").removeClass("link-show");
  225. }
  226. });
  227. // 左侧栏 点击图标
  228. var asideIconIndex = -1;
  229. $(".plugin-aside .n-list .add-icon").click(function () {
  230. asideIconIndex = $(this).parents("dd").index();
  231. $("#iconsModal").modal("show");
  232. });
  233. // 左侧栏 设置图标
  234. $(".plugin-modal .icons li").click(function () {
  235. var i = $(this).index();
  236. // console.log(i);
  237. $("#iconsModal").modal("hide");
  238. $('#asideModal').css({'overflow-y': 'scroll'});
  239. $("body").css("overflow", "hidden");
  240. $(".aside-modal .aside-nav li").eq(asideIconIndex).find(".iconfont").attr("class", "fl iconfont icon-" + i);
  241. $(".plugin-aside .n-list dd").eq(asideIconIndex).find(".add-icon").find(".iconfont").attr({
  242. "class": "iconfont icon-" + i,
  243. "data-index": i
  244. }).css("color", "#333");
  245. });
  246. //左侧栏 增加导航 默认显示1个
  247. $(".plugin-aside .n-list .add-config").click(function () {
  248. var $dd = $(".plugin-aside .n-list dd:not(.active)");
  249. $dd.eq(0).addClass('active');
  250. if ($(".plugin-aside .n-list dd.active").length > 9) {
  251. $(this).addClass("disabled");
  252. } else {
  253. $(this).removeClass("disabled");
  254. }
  255. });
  256. // 左侧栏 实时文字
  257. $(".plugin-aside .n-list .n-text").bind("input propertychange", function () {
  258. var i = $(this).parents("dd").index();
  259. // console.log(i);
  260. var thisVal = $(this).val();
  261. if (thisVal.length == 0) {
  262. $("#asideModal .a-left .aside-nav li").eq(i).find(".text").text("");
  263. } else {
  264. // $("#asideModal .a-left .aside-nav li").eq(i).find(".text").text(thisVal);
  265. $("#asideModal .a-left .aside-nav li").eq(i).show().find(".text").text(thisVal);
  266. }
  267. });
  268. // 左侧栏 恢复默认
  269. $(".plugin-aside .set-nav .reset").click(function () {
  270. // $("#colorPicker4").spectrum("set", "rgb(249, 249, 249)");
  271. // li恢复到隐藏
  272. $("#asideModal .a-left .aside-nav li").hide();
  273. // 去除错误状态
  274. $(".plugin-aside .n-list").find(".error").remove();
  275. // 恢复左侧导航文字为空
  276. $("#asideModal .a-left .aside-nav li .text").text("");
  277. // 恢复 配置导航显示1个
  278. $(".plugin-aside .set-nav .n-list dd:nth-of-type(n+2)").removeClass('active');
  279. // 导航名称默认恢复为空
  280. $(".plugin-aside .n-list .n-text").val('');
  281. // 恢复图标
  282. $("#asideModal .a-left .aside-nav li .iconfont").attr("class", "iconfont fl");
  283. $(".plugin-aside .n-list .add-icon .iconfont").attr({
  284. "class": "iconfont icon-jia",
  285. "data-index": ""
  286. }).css("color", "#eee");
  287. // select恢复到默认
  288. $(".plugin-aside .n-list select").each(function () {
  289. $(this).css("color", "#999");
  290. $(this).find("option").eq(0).attr("selected", "selected");
  291. });
  292. // 链接输入框恢复到默认
  293. $(".plugin-aside .n-list .n-link").css("visibility", "hidden").val("").removeClass("link-show");
  294. $(".plugin-aside .n-list .add-config").removeClass("disabled");
  295. });
  296. // 左侧栏 删除
  297. $(".plugin-aside .n-list .n-delete").click(function () {
  298. var $this = $(this).parents("dd");
  299. var i = $this.index();
  300. $this.removeClass('active');
  301. $this.find(".n-link").removeClass("link-show").show();
  302. $this.find("select").eq(0).attr("selected", "selected");
  303. $("#asideModal .a-left .aside-nav li").eq(i).find(".text").text("");
  304. $("#asideModal .a-left .aside-nav li").eq(i).find(".iconfont").attr("class", "iconfont fl");
  305. $(".plugin-aside .n-list .add-config").removeClass("disabled");
  306. });
  307. // 升级提示 select选择自定义,自定义输入框显示
  308. $(".plugin-upgrade-prompt select").change(function () {
  309. var selectedVal = $(this).find(":selected").val();
  310. if (selectedVal == 2) {
  311. $(this).next("input").show();
  312. } else {
  313. $(this).next("input").hide();
  314. $(this).next("input").val("");
  315. }
  316. });
  317. // 升级提示 选项卡
  318. tab.radioRound({
  319. el: ".plugin-upgrade-prompt .version li",
  320. checkedClass: "icon-radio-checked"
  321. });
  322. tab.radioRound({
  323. el: ".plugin-upgrade-prompt .time li",
  324. checkedClass: "icon-radio-checked"
  325. });
  326. tab.radioTick({
  327. el: ".plugin-upgrade-prompt .style li"
  328. });
  329. // URL 拉起APP
  330. $("#urlAppModal .plugin-url-app ul li").click(function () {
  331. var i = $(this).index();
  332. if (i == 0) {
  333. $(this).parents(".plugin-url-app").find(".color-warning").show();
  334. } else {
  335. $(this).parents(".plugin-url-app").find(".color-warning").hide();
  336. }
  337. });
  338. // 下拉刷新
  339. $("#refreshModal .plugin-refresh ul li").click(function () {
  340. var i = $(this).index();
  341. if (i == 0) {
  342. $(this).parents(".plugin-refresh").find(".color-warning").show();
  343. } else {
  344. $(this).parents(".plugin-refresh").find(".color-warning").hide();
  345. }
  346. });
  347. // 加载进度条颜色
  348. $("#colorPicker1").spectrum({
  349. color: "#157df1",//初始化颜色
  350. showInput: true,//显示输入
  351. showAlpha: true, // 透明度
  352. containerClassName: "full-spectrum",
  353. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  354. showPalette: true,//显示选择器面板
  355. showSelectionPalette: true,//记住选择过的颜色
  356. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  357. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  358. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  359. chooseText: "确定",
  360. cancelText: "取消",
  361. move: function (color) {//选择器右边面板移动时触发
  362. },
  363. show: function () {//选择器面板显示时触发
  364. },
  365. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  366. },
  367. hide: function (color) {//选择器面板隐藏时触发
  368. updateLoadingBackground(color);
  369. },
  370. //选择器面板颜色设置
  371. palette: palette
  372. });
  373. function updateLoadingBackground(color) {
  374. $(".plugin-loading .con-1 .tit2 .progress1").css("background-color", color);
  375. return color;
  376. };
  377. function updateStateBackground(color) {
  378. $(".plugin-state .state-bgcolor").css("background-color", color);
  379. };
  380. function updateTitleBackground(color) {
  381. $(".plugin-title .state-bgcolor").css("background-color", color);
  382. };
  383. function updateTitleFontColor(color) {
  384. $(".plugin-title .title-top .text").css("color", color);
  385. $(".plugin-title .title-top .iconfont").css("color", color);
  386. }
  387. // 配置插件 index
  388. var activeIndex;
  389. $(".encapsulation3 .col-sm-2").click(function () {
  390. activeIndex = $(this);
  391. });
  392. /*
  393. $(".config-plugin .choose-cancel").click(function () {
  394. $(this).parents(".plugin-modal").find(".plugin-save").addClass("plugin-cancel");
  395. });
  396. */
  397. // 保存按钮 操作
  398. $(".plugin-save").click(function () {
  399. if (activeIndex && $(this).is(':visible')) {
  400. var has = $(this).hasClass("plugin-cancel");
  401. if (has) {
  402. activeIndex.find(".con").removeClass("active");
  403. $(this).removeClass("plugin-cancel");
  404. } else {
  405. activeIndex.find(".con").addClass("active").find(".icon-checkbox1").addClass("icon-checkbox-checked1 add-checked");
  406. }
  407. }
  408. activeIndex = null;
  409. });
  410. $(document).on("click", ".add-checked", function (e) {
  411. // console.log(123);
  412. $(".plugin-modal").modal("hide");
  413. $(this).removeClass("add-checked icon-checkbox-checked1");
  414. $(this).parents(".con").removeClass("active");
  415. e.stopPropagation();
  416. });
  417. // 加载动画
  418. $(".plugin-loading .con").click(function () {
  419. $(this).parents(".plugin-loading").find(".con").removeClass("active");
  420. $(this).addClass("active");
  421. var i = $(this).parent(".col-sm-5").index();
  422. // console.log(i);
  423. var that = $(this).parents(".plugin-loading").find(".color-picker-wrap");
  424. if (i == 1) {
  425. that.hide();
  426. } else {
  427. that.show();
  428. }
  429. });
  430. // 清除缓存
  431. $(".config-plugin .plugin-common .common-ul li").click(function () {
  432. $(this).addClass("active").siblings().removeClass("active");
  433. var index = $(this).index();
  434. if (index == 0) {
  435. $(this).parents(".plugin-common").find(".bg-text-color").show();
  436. $(this).parents(".plugin-common").find(".be-hidden").hide();
  437. } else {
  438. $(this).parents(".plugin-common").find(".bg-text-color").hide();
  439. $(this).parents(".plugin-common").find(".be-hidden").show();
  440. }
  441. });
  442. // 极光推送
  443. $('.plugin-modal .app-key').bind('input propertychange', function () {
  444. var valLength = $(this).val().length;
  445. // console.log(valLength);
  446. if (valLength > 0) {
  447. $(this).parents(".plugin-modal").find(".plugin-save").prop("disabled", false);
  448. } else {
  449. $(this).parents(".plugin-modal").find(".plugin-save").prop("disabled", true);
  450. }
  451. });
  452. // 退出提示
  453. $(".plugin-exit .mode dd").click(function () {
  454. $(this).addClass("active").siblings().removeClass("active");
  455. $(this).parents(".mode").find(".icon-radio").removeClass("icon-radio-checked");
  456. $(this).find(".icon-radio").addClass("icon-radio-checked");
  457. });
  458. // 引导页
  459. $(".thumbnail").change(function () {
  460. $("#guideModal .plugin-save").prop("disabled", false);
  461. });
  462. $(".plugin-guide .radio-tick li").click(function () {
  463. var type = $(this).data("type");
  464. var $parents = $(this).parents("#guideModal");
  465. if (type == -1) {
  466. $(".experience-color", $parents).hide();
  467. $(".experience-btn", $parents).hide();
  468. } else {
  469. $(".experience-color", $parents).show();
  470. $(".experience-btn", $parents).show();
  471. }
  472. });
  473. // 引导页 立即体验文字颜色
  474. $("#experienceTextColor").spectrum({
  475. color: "#fff",//初始化颜色
  476. showInput: true,//显示输入
  477. showAlpha: true, // 透明度
  478. containerClassName: "full-spectrum",
  479. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  480. showPalette: true,//显示选择器面板
  481. showSelectionPalette: true,//记住选择过的颜色
  482. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  483. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  484. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  485. chooseText: "确定",
  486. cancelText: "取消",
  487. move: function (color) {//选择器右边面板移动时触发
  488. },
  489. show: function () {//选择器面板显示时触发
  490. },
  491. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  492. },
  493. hide: function (color) {//选择器面板隐藏时触发
  494. updateGuideFontColor(color);
  495. },
  496. //选择器面板颜色设置
  497. palette: palette
  498. });
  499. // console.log(getFontColor("#experienceTextColor"));
  500. function updateGuideFontColor(color) {
  501. $("#guideModal .experience-btn").css({"color": color, "border-color": color});
  502. };
  503. // 引导页 上传图片预览
  504. $("#guideModal .thumbnail").change(function () {
  505. var index = $(this).parents(".col-sm-3").index();
  506. var file = this.files[0];
  507. var name = $(this).val();
  508. // console.log(name);
  509. // 判断文件类型
  510. var type = (name.substr(name.lastIndexOf("."))).toLowerCase();
  511. // console.log(type);
  512. var typeModal = '<div class="modal fade" id="typeModal" tabindex="-1" role="dialog">\
  513. <div class="modal-dialog modal-sm" role="document">\
  514. <div class="modal-content">\
  515. <div class="modal-body">\
  516. <div class="text-center">\
  517. <div><span class="icon icon-modal-error2"></span></div>\
  518. <p class="color-333 mt5">您上传的图片格式不正确,请重新上传!</p>\
  519. <div class="mt15">\
  520. <button type="button" class="ms-btn ms-btn-default w90" data-dismiss="modal">确定</button>\
  521. </div>\
  522. </div>\
  523. </div>\
  524. </div>\
  525. </div>\
  526. </div>';
  527. if (type != ".jpg" && type != ".gif" && type != ".jpeg" && type != ".png") {
  528. $("#typeModal").remove();
  529. $("body").append(typeModal);
  530. $("#typeModal").modal("show");
  531. return false;
  532. }
  533. ;
  534. if (file.size / (1024 * 1024) > 1) {
  535. Modal.generalModal({
  536. backdrop: false, // 点击阴影是否关闭弹窗, // true 开启; false 关闭
  537. p: '图片过大,请上传1M以内的图片', // 弹窗内容
  538. align: 'center', // 弹窗内容排列顺序 left center right
  539. successBtnText: '确定', // 确定按钮文字
  540. successBtnModal: true, // 点击确定按钮是否关闭弹窗 true 关闭 false 不关闭
  541. });
  542. $(this).val("");
  543. return false;
  544. }
  545. ;
  546. var reader = new FileReader();
  547. reader.readAsDataURL(file);
  548. reader.onload = function () {
  549. $("#guideModal .modal-aside-left .bg img").eq(index).attr("src", this.result);
  550. };
  551. });
  552. // 引导页删除上传图片
  553. $(".plugin-guide .upload-img .icon-delete2").click(function () {
  554. var index = $(this).parents(".col-sm-3").index();
  555. $("#guideModal .modal-aside-left .bg img").eq(index).attr("src", "");
  556. });
  557. /*
  558. // 状态栏背景颜色
  559. $("#colorPicker22").spectrum({
  560. color: "#157df1",//初始化颜色
  561. showInput: true,//显示输入
  562. showAlpha: true, // 透明度
  563. containerClassName: "full-spectrum",
  564. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  565. showPalette: true,//显示选择器面板
  566. showSelectionPalette: true,//记住选择过的颜色
  567. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  568. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  569. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  570. chooseText: "确定",
  571. cancelText: "取消",
  572. move: function (color) {//选择器右边面板移动时触发
  573. },
  574. show: function () {//选择器面板显示时触发
  575. },
  576. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  577. },
  578. hide: function (color) {//选择器面板隐藏时触发
  579. updateStateBackground(color);
  580. },
  581. //选择器面板颜色设置
  582. palette: palette
  583. });
  584. // 标题栏背景颜色 字体颜色
  585. $("#colorPicker3").spectrum({
  586. color: "#157df1",//初始化颜色
  587. showInput: true,//显示输入
  588. showAlpha: true, // 透明度
  589. containerClassName: "full-spectrum",
  590. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  591. showPalette: true,//显示选择器面板
  592. showSelectionPalette: true,//记住选择过的颜色
  593. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  594. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  595. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  596. chooseText: "确定",
  597. cancelText: "取消",
  598. move: function (color) {//选择器右边面板移动时触发
  599. },
  600. show: function () {//选择器面板显示时触发
  601. },
  602. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  603. },
  604. hide: function (color) {//选择器面板隐藏时触发
  605. updateTitleBackground(color);
  606. },
  607. //选择器面板颜色设置
  608. palette: palette
  609. });
  610. $("#titFontColor").spectrum({
  611. color: "#fff",//初始化颜色
  612. showInput: true,//显示输入
  613. showAlpha: true, // 透明度
  614. containerClassName: "full-spectrum",
  615. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  616. showPalette: true,//显示选择器面板
  617. showSelectionPalette: true,//记住选择过的颜色
  618. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  619. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  620. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  621. chooseText: "确定",
  622. cancelText: "取消",
  623. move: function (color) {//选择器右边面板移动时触发
  624. },
  625. show: function () {//选择器面板显示时触发
  626. },
  627. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  628. },
  629. hide: function (color) {//选择器面板隐藏时触发
  630. updateTitleFontColor(color);
  631. },
  632. //选择器面板颜色设置
  633. palette: palette
  634. });
  635. // 状态栏 文字颜色
  636. $(".plugin-modal .bg-text-color .writing li").click(function () {
  637. var index = $(this).index();
  638. $(this).addClass("active").siblings().removeClass("active");
  639. if (index == 0) {
  640. $(this).parents(".plugin-state").find(".common-top").removeClass("black").addClass("white");
  641. // $(this).parents("#asideModal").find(".a-left").find(".aside-nav").removeClass("black").addClass("white")
  642. } else {
  643. $(this).parents(".plugin-state").find(".common-top").removeClass("white").addClass("black");
  644. // $(this).parents("#asideModal").find(".a-left").find(".aside-nav").removeClass("white").addClass("black");
  645. }
  646. });
  647. // 标题栏 标题文字实时展现
  648. $(".plugin-title .input-title").bind("input propertychange", function () {
  649. var thisVal = $(this).val();
  650. $(this).parents(".plugin-title").find(".title-top").find(".text").text(thisVal);
  651. });
  652. // 标题栏 选择左功能键图标
  653. $(".plugin-title .function-keys.f-left li").click(function () {
  654. var i = $(this).index();
  655. var no = $(this).hasClass("rule-out");
  656. var checked = $(this).hasClass("active");
  657. var disabled = $(this).hasClass("disabled");
  658. if (disabled) return;
  659. var $parent = $(this).parents(".function-keys");
  660. if (checked) {
  661. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  662. $(".plugin-title .title-top .t-left span").eq(i).hide();
  663. } else {
  664. $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
  665. var dis1 = $(this).hasClass("disabled");
  666. // 不是disabled的状态,点击li,头部预览图标显示
  667. if (!dis1) {
  668. $(".plugin-title .title-top .t-left span").eq(i).show();
  669. }
  670. }
  671. var checkedLength = $parent.find(".active").length;
  672. // 超过2个
  673. if (checkedLength > 1) {
  674. $("li", $parent).not(".active").addClass("disabled");
  675. } else {
  676. $("li", $parent).not(".active").removeClass("disabled");
  677. }
  678. // 点击无
  679. var dis = $(this).hasClass("disabled");
  680. if (no && !dis) {
  681. if (checked) {
  682. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  683. $("li", $parent).removeClass("disabled");
  684. } else {
  685. $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1").parents(".active").siblings().removeClass("active").addClass("disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
  686. $(".plugin-title .title-top .t-left span").hide();
  687. }
  688. } else {
  689. }
  690. var aside = $("li[data-sideBar=1]", $parent).attr("data-sideBar");
  691. var $asideChecked = $("li[data-sideBar=1]", $parent).hasClass("active");
  692. var asideDis = $("li[data-sideBar=1]", $parent).hasClass("disabled");
  693. // 点击侧边栏出提示
  694. if (aside == 1 && $asideChecked && !asideDis) {
  695. $parent.next(".plugin-remind").show();
  696. } else {
  697. $parent.next(".plugin-remind").hide();
  698. }
  699. // 左侧是否选中了侧边栏
  700. if ($(".plugin-title .function-keys.f-right li[data-right-key='aside']").hasClass("active")) {
  701. $(".plugin-title .function-keys.f-left li[data-left-key='aside']").addClass("disabled");
  702. }
  703. if ($(".plugin-title .function-keys.f-left li[data-left-key='aside']").hasClass("active")) {
  704. $(".plugin-title .function-keys.f-right li[data-right-key='aside']").addClass("disabled");
  705. } else {
  706. if ($(".plugin-title .function-keys.f-right li.disabled").length <= 1) {
  707. $(".plugin-title .function-keys.f-right li[data-right-key='aside']").removeClass("disabled");
  708. }
  709. }
  710. });
  711. // 标题栏 选择右功能键图标
  712. $(".plugin-title .function-keys.f-right li").click(function () {
  713. var i = $(this).index();
  714. var no = $(this).hasClass("rule-out");
  715. var checked = $(this).hasClass("active");
  716. var $parent = $(this).parents(".function-keys");
  717. var disabled = $(this).hasClass("disabled");
  718. if (disabled) return;
  719. if (checked) {
  720. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  721. $(".plugin-title .title-top .t-right span").eq(i).hide();
  722. } else {
  723. $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
  724. var dis1 = $(this).hasClass("disabled");
  725. if (!dis1) {
  726. $(".plugin-title .title-top .t-right span").eq(i).show();
  727. }
  728. }
  729. var checkedLength = $parent.find(".active").length;
  730. // 超过2个
  731. if (checkedLength > 1) {
  732. $("li", $parent).not(".active").addClass("disabled");
  733. } else {
  734. $("li", $parent).not(".active").removeClass("disabled");
  735. }
  736. // 点击无
  737. var dis = $(this).hasClass("disabled");
  738. if (no && !dis) {
  739. if (checked) {
  740. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  741. $("li", $parent).removeClass("disabled");
  742. } else {
  743. $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1").parents(".active").siblings().removeClass("active").addClass("disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
  744. $(".plugin-title .title-top .t-right span").hide();
  745. }
  746. } else {
  747. }
  748. var aside = $("li[data-sideBar=1]", $parent).attr("data-sideBar");
  749. var $asideChecked = $("li[data-sideBar=1]", $parent).hasClass("active");
  750. var asideDis = $("li[data-sideBar=1]", $parent).hasClass("disabled");
  751. // 点击侧边栏出提示
  752. if (aside == 1 && $asideChecked && !asideDis) {
  753. $parent.next(".plugin-remind").show();
  754. $(".plugin-title .function-keys.f-left li[data-left-key='aside']").addClass("disabled");
  755. } else {
  756. $parent.next(".plugin-remind").hide();
  757. // 获取右侧置灰个数,超过一个不在开启
  758. if ($(".plugin-title .function-keys.f-left li.disabled").length <= 1) {
  759. $(".plugin-title .function-keys.f-left li[data-left-key='aside']").removeClass("disabled");
  760. }
  761. }
  762. // 左侧是否选中了侧边栏
  763. if ($(".plugin-title .function-keys.f-left li[data-left-key='aside']").hasClass("active")) {
  764. $(".plugin-title .function-keys.f-right li[data-right-key='aside']").addClass("disabled");
  765. }
  766. if ($(".plugin-title .function-keys.f-right li[data-right-key='aside']").hasClass("active")) {
  767. $(".plugin-title .function-keys.f-left li[data-left-key='aside']").addClass("disabled");
  768. } else {
  769. if ($(".plugin-title .function-keys.f-left li.disabled").length <= 1) {
  770. $(".plugin-title .function-keys.f-left li[data-left-key='aside']").removeClass("disabled");
  771. }
  772. }
  773. });
  774. $(".plugin-title .function-keys").on("click", ".disabled", function () {
  775. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  776. })
  777. // 标题栏 显示 隐藏
  778. $("#titleShow li").click(function () {
  779. var i = $(this).index();
  780. if (i == 1) {
  781. $(".plugin-title .title-top .t-left span").hide();
  782. $(".plugin-title .title-top .t-right span").hide();
  783. $(".plugin-title .function-keys li").removeClass("active disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
  784. $(".plugin-title .function-keys.f-left li:eq(0)").addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
  785. $(".plugin-title .function-keys.f-right li:eq(0)").addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
  786. $(".plugin-title .bg-text-color").hide();
  787. $(".plugin-title .function-keys-wrap").hide();
  788. } else {
  789. $(".plugin-title .title-top .t-left span").eq(0).show();
  790. $(".plugin-title .title-top .t-right span").eq(0).show();
  791. $(".plugin-title .bg-text-color").show();
  792. $(".plugin-title .function-keys-wrap").show();
  793. }
  794. });
  795. // 标题栏点击保存
  796. $("#titleModal .plugin-save").click(function () {
  797. var leftKeys = []; // 标题栏左侧功能键
  798. var rightKeys = []; // 标题栏右侧功能键
  799. function getKeys(obj, data, arr) {
  800. $(obj).each(function () {
  801. var has = $(this).hasClass("active");
  802. var val = $(this).attr(data);
  803. if (has) {
  804. arr.push(val);
  805. }
  806. });
  807. }
  808. getKeys(".function-keys.f-left li", "data-left-key", leftKeys);
  809. getKeys(".function-keys.f-right li", "data-right-key", rightKeys);
  810. var titleBg = getFontColor("#colorPicker3"); // 背景色
  811. var fontColor = getFontColor("#titFontColor"); // 文字色
  812. var showTitle = $("#titleShow .active").attr("data-show"); // 显示Or隐藏
  813. var titleVal = $('#titleModal input[name=title]').val(); // 标题栏文字
  814. if (showTitle == 1) {
  815. titleBar = {show: showTitle};
  816. } else {
  817. titleBar = {
  818. show: showTitle,
  819. bgColor: titleBg,
  820. titleColor: fontColor,
  821. title: titleVal,
  822. leftKey: leftKeys,
  823. rightKey: rightKeys
  824. };
  825. }
  826. console.log(titleBar);
  827. });
  828. */
  829. // 状态标题栏 状态栏背景颜色
  830. $("#colorPicker2").spectrum({
  831. color: "#157df1", //初始化颜色
  832. showInput: true, //显示输入
  833. showAlpha: true, // 透明度
  834. containerClassName: "full-spectrum",
  835. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  836. showPalette: true,//显示选择器面板
  837. showSelectionPalette: true,//记住选择过的颜色
  838. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  839. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  840. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  841. chooseText: "确定",
  842. cancelText: "取消",
  843. move: function (color) {//选择器右边面板移动时触发
  844. },
  845. show: function () {//选择器面板显示时触发
  846. },
  847. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  848. },
  849. hide: function (color) {//选择器面板隐藏时触发
  850. updateStateBackground(color);
  851. },
  852. //选择器面板颜色设置
  853. palette: palette
  854. });
  855. // 状态标题栏 标题栏背景颜色 字体颜色
  856. $("#colorPicker3").spectrum({
  857. color: "#157df1",//初始化颜色
  858. showInput: true,//显示输入
  859. showAlpha: true, // 透明度
  860. containerClassName: "full-spectrum",
  861. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  862. showPalette: true,//显示选择器面板
  863. showSelectionPalette: true,//记住选择过的颜色
  864. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  865. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  866. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  867. chooseText: "确定",
  868. cancelText: "取消",
  869. move: function (color) {//选择器右边面板移动时触发
  870. },
  871. show: function () {//选择器面板显示时触发
  872. },
  873. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  874. },
  875. hide: function (color) {//选择器面板隐藏时触发
  876. updateTitleBackground(color);
  877. },
  878. //选择器面板颜色设置
  879. palette: palette
  880. });
  881. $("#titFontColor").spectrum({
  882. color: "#fff",//初始化颜色
  883. showInput: true,//显示输入
  884. showAlpha: true, // 透明度
  885. containerClassName: "full-spectrum",
  886. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  887. showPalette: true,//显示选择器面板
  888. showSelectionPalette: true,//记住选择过的颜色
  889. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  890. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  891. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  892. chooseText: "确定",
  893. cancelText: "取消",
  894. move: function (color) {//选择器右边面板移动时触发
  895. },
  896. show: function () {//选择器面板显示时触发
  897. },
  898. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  899. },
  900. hide: function (color) {//选择器面板隐藏时触发
  901. updateTitleFontColor(color);
  902. },
  903. //选择器面板颜色设置
  904. palette: palette
  905. });
  906. function updateStateBackground(color) {
  907. $("#titleModal .state-bgcolor").css("background-color", color);
  908. };
  909. function updateTitleBackground(color) {
  910. $(".plugin-title .title-top").css("background-color", color);
  911. };
  912. function updateTitleFontColor(color) {
  913. $(".plugin-title .title-top .text").css("color", color);
  914. $(".plugin-title .title-top .iconfont").css("color", color);
  915. }
  916. // 状态标题栏 状态栏显示、隐藏
  917. $("#titleModal .state-show-toggle li").click(function () {
  918. var state = $(this).data("state");
  919. var titleShow = $("#titleShow .active").attr("data-show");
  920. var $parents = $(this).parents(".config-plugin");
  921. if (state == 2) {
  922. $(".state-way ", $parents).hide();
  923. $(".state-way [data-state-way=1]", $parents).addClass("active").siblings().removeClass("active");
  924. $(".be-hidden1", $parents).show();
  925. $("#titleModal .state-top").removeClass("state-top-extension").hide();
  926. if (titleShow == 1) {
  927. $(".title-wrap1").show();
  928. $(".title-wrap1 .title-way").hide();
  929. $("#titleModal .state-bg-extension").hide();
  930. $("#titleModal .title-top").hide();
  931. } else {
  932. $(".title-wrap1").show();
  933. $(".title-wrap1 .title-way").show();
  934. $("#titleModal .state-bg-extension").hide();
  935. $("#titleModal .title-top").show();
  936. }
  937. } else {
  938. $(".state-way", $parents).show();
  939. $(".be-hidden1", $parents).hide();
  940. $("#titleModal .state-top").show();
  941. $("#titleModal .state-bg-color1").show();
  942. }
  943. });
  944. // 状态栏标题栏 选择背景图延伸
  945. $("#titleModal .state-way-ul li").click(function () {
  946. var state = $(this).attr("data-state-way");
  947. var $parents = $(this).parents("#titleModal");
  948. if (state == 2) {
  949. $(".state-bg-color1", $parents).hide();
  950. $(".title-wrap1", $parents).hide();
  951. $(".state-bg-extension", $parents).show();
  952. $(".state-top", $parents).addClass("state-top-extension");
  953. $(".title-top", $parents).hide();
  954. } else {
  955. $(".state-bg-color1", $parents).show();
  956. $(".title-wrap1", $parents).show();
  957. $(".state-bg-extension", $parents).hide();
  958. $(".state-top", $parents).removeClass("state-top-extension");
  959. $(".title-top", $parents).show();
  960. }
  961. });
  962. // 状态标题栏 状态栏 字体颜色设置黑白
  963. $("#titleModal .bg-text-color1 .writing li").click(function () {
  964. var state = $(this).attr("data-state-font-color");
  965. var $parents = $(this).parents("#titleModal");
  966. $(this).addClass("active").siblings().removeClass("active");
  967. if (state == 1) {
  968. $(".state-top", $parents).removeClass("black").addClass("white");
  969. } else {
  970. $(".state-top", $parents).removeClass("white").addClass("black");
  971. }
  972. });
  973. // 状态标题栏 标题栏显示、隐藏
  974. $("#titleShow li").click(function () {
  975. var i = $(this).data("show");
  976. if (i == 1) {
  977. $("#titleModal .title-way").hide();
  978. $("#titleModal .title-top").hide();
  979. $("#titleModal .be-hidden2").show();
  980. // $(".plugin-title .title-top .t-left span").hide();
  981. // $(".plugin-title .title-top .t-right span").hide();
  982. // $(".plugin-title .function-keys li").removeClass("active disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
  983. // $(".plugin-title .function-keys.f-left li:eq(0)").addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
  984. // $(".plugin-title .function-keys.f-right li:eq(0)").addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
  985. // $(".plugin-title .bg-text-color").hide();
  986. // $(".plugin-title .function-keys-wrap").hide();
  987. } else {
  988. $("#titleModal .title-way").show();
  989. $("#titleModal .title-top").show();
  990. $("#titleModal .be-hidden2").hide();
  991. // $(".plugin-title .title-top .t-left span").eq(0).show();
  992. // $(".plugin-title .title-top .t-right span").eq(0).show();
  993. // $(".plugin-title .bg-text-color").show();
  994. // $(".plugin-title .function-keys-wrap").show();
  995. }
  996. });
  997. // 状态标题栏 标题栏 标题文字实时展现
  998. $(".plugin-title .input-title").bind("input propertychange", function () {
  999. var thisVal = $(this).val();
  1000. $(this).parents(".plugin-title").find(".title-top").find(".text").text(thisVal);
  1001. });
  1002. // 状态标题栏 标题栏 选择左功能键图标
  1003. $(".plugin-title .function-keys.f-left li").click(function () {
  1004. var i = $(this).index();
  1005. var no = $(this).hasClass("rule-out");
  1006. var checked = $(this).hasClass("active");
  1007. var $parent = $(this).parents(".function-keys");
  1008. var disabled = $(this).hasClass("disabled");
  1009. if (disabled) return;
  1010. var $right = $(".plugin-title .function-keys.f-right");
  1011. var $leftAside = $(".plugin-title .function-keys.f-left li[data-left-key='aside']");
  1012. var $rightAside = $(".plugin-title .function-keys.f-right li[data-right-key='aside']");
  1013. var $leftShare = $(".plugin-title .function-keys.f-left li[data-left-key='share']");
  1014. var $rightShare = $(".plugin-title .function-keys.f-right li[data-right-key='share']");
  1015. if (checked) {
  1016. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  1017. $(".plugin-title .title-top .t-left span").eq(i).hide();
  1018. } else {
  1019. $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
  1020. var dis1 = $(this).hasClass("disabled");
  1021. // 不是disabled的状态,点击li,头部预览图标显示
  1022. if (!dis1) {
  1023. $(".plugin-title .title-top .t-left span").eq(i).show();
  1024. }
  1025. }
  1026. // 点击左侧侧边栏,右侧侧边栏增加disabled
  1027. if ($leftAside.hasClass("active")) {
  1028. $rightAside.addClass("disabled disabled1");
  1029. } else {
  1030. $rightAside.removeClass("disabled disabled1");
  1031. }
  1032. // 点击左侧分享,右侧分享增加disabled
  1033. if ($leftShare.hasClass("active")) {
  1034. $rightShare.addClass("disabled disabled1");
  1035. } else {
  1036. $rightShare.removeClass("disabled disabled1");
  1037. }
  1038. var checkedLength = $parent.find(".active").length;
  1039. // console.log("left:" + checkedLength);
  1040. // 超过2个
  1041. if (checkedLength > 1) {
  1042. $("li", $parent).not(".active").addClass("disabled");
  1043. } else {
  1044. $("li", $parent).not(".active,.disabled1").removeClass("disabled");
  1045. }
  1046. // console.log($right.find(".active").length);
  1047. if ($right.find(".active").length == 2) {
  1048. if ($rightAside.hasClass("active")) {
  1049. $rightAside.removeClass("disabled");
  1050. } else {
  1051. $rightAside.addClass("disabled");
  1052. }
  1053. if ($rightShare.hasClass("active")) {
  1054. $rightShare.removeClass("disabled");
  1055. } else {
  1056. $rightShare.addClass("disabled");
  1057. }
  1058. }
  1059. /*
  1060. // 点击无
  1061. var dis = $(this).hasClass("disabled");
  1062. if (no && !dis) {
  1063. if (checked) {
  1064. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  1065. $("li", $parent).not(".disabled1").removeClass("disabled");
  1066. } else {
  1067. $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1").parents(".active").siblings().removeClass("active").addClass("disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
  1068. $(".plugin-title .title-top .t-left span").hide();
  1069. }
  1070. }
  1071. */
  1072. var aside = $("li[data-sideBar=1]", $parent).attr("data-sideBar");
  1073. var $asideChecked = $("li[data-sideBar=1]", $parent).hasClass("active");
  1074. var asideDis = $("li[data-sideBar=1]", $parent).hasClass("disabled");
  1075. // 点击侧边栏出提示
  1076. if (aside == 1 && $asideChecked && !asideDis) {
  1077. $parent.next(".plugin-remind").show();
  1078. } else {
  1079. $parent.next(".plugin-remind").hide();
  1080. }
  1081. var share = $("li[data-share=1]", $parent).attr("data-share");
  1082. var $shareChecked = $("li[data-share=1]", $parent).hasClass("active");
  1083. var shareDis = $("li[data-share=1]", $parent).hasClass("disabled");
  1084. // 点击分享出提示
  1085. if (share == 1 && $shareChecked && !shareDis) {
  1086. $parent.next(".plugin-remind").next(".plugin-remind1").show();
  1087. } else {
  1088. $parent.next(".plugin-remind").next(".plugin-remind1").hide();
  1089. }
  1090. });
  1091. // 状态标题栏 标题栏 选择右功能键图标
  1092. $(".plugin-title .function-keys.f-right li").click(function () {
  1093. var i = $(this).index();
  1094. var no = $(this).hasClass("rule-out");
  1095. var checked = $(this).hasClass("active");
  1096. var $parent = $(this).parents(".function-keys");
  1097. var disabled = $(this).hasClass("disabled");
  1098. var $left = $(".plugin-title .function-keys.f-left");
  1099. var $leftAside = $(".plugin-title .function-keys.f-left li[data-left-key='aside']");
  1100. var $rightAside = $(".plugin-title .function-keys.f-right li[data-right-key='aside']");
  1101. var $leftShare = $(".plugin-title .function-keys.f-left li[data-left-key='share']");
  1102. var $rightShare = $(".plugin-title .function-keys.f-right li[data-right-key='share']");
  1103. if (disabled) return;
  1104. if (checked) {
  1105. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  1106. $(".plugin-title .title-top .t-right span").eq(i).hide();
  1107. } else {
  1108. $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
  1109. var dis1 = $(this).hasClass("disabled");
  1110. if (!dis1) {
  1111. $(".plugin-title .title-top .t-right span").eq(i).show();
  1112. }
  1113. }
  1114. // 点击右侧侧边栏,给左侧侧边栏增加disabled
  1115. if ($rightAside.hasClass("active")) {
  1116. $leftAside.addClass("disabled disabled1");
  1117. } else {
  1118. $leftAside.removeClass("disabled disabled1");
  1119. }
  1120. // 点击右侧分享,给左侧分享增加disabled
  1121. if ($rightShare.hasClass("active")) {
  1122. $leftShare.addClass("disabled disabled1");
  1123. } else {
  1124. $leftShare.removeClass("disabled disabled1");
  1125. }
  1126. var checkedLength = $parent.find(".active").length;
  1127. // console.log("right:" + checkedLength);
  1128. // 超过2个
  1129. if (checkedLength > 1) {
  1130. $("li", $parent).not(".active").addClass("disabled");
  1131. } else {
  1132. $("li", $parent).not(".active,.disabled1").removeClass("disabled");
  1133. // console.log("left:" + $left.find(".active").length);
  1134. }
  1135. // console.log($left.find(".active").length);
  1136. if ($left.find(".active").length == 2) {
  1137. if ($leftAside.hasClass("active")) {
  1138. $leftAside.removeClass("disabled");
  1139. } else {
  1140. $leftAside.addClass("disabled");
  1141. }
  1142. if ($leftShare.hasClass("active")) {
  1143. $leftShare.removeClass("disabled");
  1144. } else {
  1145. $leftShare.addClass("disabled");
  1146. }
  1147. }
  1148. /*
  1149. // 点击无
  1150. var dis = $(this).hasClass("disabled");
  1151. if (no && !dis) {
  1152. if (checked) {
  1153. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  1154. $("li", $parent).not(".disabled1").removeClass("disabled");
  1155. } else {
  1156. $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1").parents(".active").siblings().removeClass("active").addClass("disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
  1157. $(".plugin-title .title-top .t-right span").hide();
  1158. }
  1159. } else {
  1160. }
  1161. */
  1162. var aside = $("li[data-sideBar=1]", $parent).attr("data-sideBar");
  1163. var $asideChecked = $("li[data-sideBar=1]", $parent).hasClass("active");
  1164. var asideDis = $("li[data-sideBar=1]", $parent).hasClass("disabled");
  1165. // 点击侧边栏出提示
  1166. if (aside == 1 && $asideChecked && !asideDis) {
  1167. $parent.next(".plugin-remind").show();
  1168. $(".plugin-title .function-keys.f-left li[data-left-key='aside']").addClass("disabled");
  1169. } else {
  1170. $parent.next(".plugin-remind").hide();
  1171. }
  1172. var share = $("li[data-share=1]", $parent).attr("data-share");
  1173. var $shareChecked = $("li[data-share=1]", $parent).hasClass("active");
  1174. var shareDis = $("li[data-share=1]", $parent).hasClass("disabled");
  1175. // 点击分享出提示
  1176. if (share == 1 && $shareChecked && !shareDis) {
  1177. $parent.next(".plugin-remind").next(".plugin-remind1").show();
  1178. } else {
  1179. $parent.next(".plugin-remind").next(".plugin-remind1").hide();
  1180. }
  1181. });
  1182. /*
  1183. $(".plugin-title .function-keys").on("click", ".disabled", function () {
  1184. $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
  1185. });
  1186. */
  1187. // 状态标题栏点击保存取值
  1188. $("#titleModal .plugin-save").click(function () {
  1189. stateBar = {}; // 清空状态栏
  1190. titleBar = {}; // 清空标题栏
  1191. // 状态标题栏 状态栏取值
  1192. // 状态栏显示、隐藏
  1193. var showState = $("#titleModal .state-show-toggle .active").attr("data-state"); // 1 显示 2 隐藏
  1194. // 状态栏显示方式
  1195. var stateWay = $("#titleModal .state-way-ul .active").attr("data-state-way"); // 1 自定义 2 背景图延伸
  1196. // 状态栏背景颜色
  1197. var stateBgColor = getFontColor("#colorPicker2");
  1198. // 状态栏背景透明度
  1199. var stateBgColorAlpha = getAlpha("#colorPicker2");
  1200. // 状态栏文字颜色
  1201. var stateFontColor = $("#titleModal .writing .active").attr("data-state-font-color"); // 1 白色 2 黑色
  1202. // 状态标题栏 标题栏取值
  1203. // 标题栏 显示、隐藏
  1204. var showTitle = $("#titleShow .active").attr("data-show"); // // 0 显示 1 隐藏
  1205. // 标题栏 输入文字
  1206. var titleVal = $('#titleModal input[name=title]').val();
  1207. // 标题栏 背景颜色
  1208. var titleBg = getFontColor("#colorPicker3");
  1209. // 标题栏 背景颜色透明度
  1210. var titleBgAlpha = getAlpha("#colorPicker3");
  1211. // 标题栏 字体颜色
  1212. var titleFontColor = getFontColor("#titFontColor");
  1213. // 标题栏 字体透明度
  1214. var titleFontColorAlpha = getAlpha("#titFontColor");
  1215. // 左侧功能键 取值
  1216. var leftKeys = [];
  1217. // 右侧功能键 取值
  1218. var rightKeys = [];
  1219. function getKeys(obj, data, arr) {
  1220. $(obj).each(function () {
  1221. var has = $(this).hasClass("active");
  1222. var val = $(this).attr(data);
  1223. if (has) {
  1224. arr.push(val);
  1225. }
  1226. });
  1227. }
  1228. getKeys(".function-keys.f-left li", "data-left-key", leftKeys);
  1229. getKeys(".function-keys.f-right li", "data-right-key", rightKeys);
  1230. if (showState != 2 && stateWay == 2) showTitle = 1; // 显示状态栏且延伸则标题栏不显示
  1231. titleBar.show = showTitle;
  1232. if (showTitle != 1) {
  1233. titleBar.title = titleVal;
  1234. titleBar.bgColor = titleBg;
  1235. titleBar.bgAlpha = titleBgAlpha;
  1236. titleBar.titleColor = titleFontColor;
  1237. titleBar.titleAlpha = titleFontColorAlpha;
  1238. titleBar.leftKey = leftKeys;
  1239. titleBar.rightKey = rightKeys;
  1240. }
  1241. stateBar.state = showState;
  1242. if (showState != 2) {
  1243. stateBar.way = stateWay;
  1244. if (stateWay == 2) { // 延伸
  1245. stateBar.fontColor = stateFontColor;
  1246. } else { // 自定义颜色
  1247. stateBar.bgColor = stateBgColor;
  1248. stateBar.bgAlpha = stateBgColorAlpha;
  1249. stateBar.fontColor = stateFontColor;
  1250. }
  1251. }
  1252. });
  1253. // 导航栏背景颜色 字体图标颜色
  1254. $("#colorPicker4").spectrum({
  1255. color: "#157df1",//初始化颜色
  1256. showInput: true,//显示输入
  1257. showAlpha: true, // 透明度
  1258. containerClassName: "full-spectrum",
  1259. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  1260. showPalette: true,//显示选择器面板
  1261. showSelectionPalette: true,//记住选择过的颜色
  1262. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  1263. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  1264. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  1265. chooseText: "确定",
  1266. cancelText: "取消",
  1267. move: function (color) {//选择器右边面板移动时触发
  1268. },
  1269. show: function () {//选择器面板显示时触发
  1270. },
  1271. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  1272. },
  1273. hide: function (color) {//选择器面板隐藏时触发
  1274. updateNavBackground(color);
  1275. },
  1276. //选择器面板颜色设置
  1277. palette: palette
  1278. });
  1279. $("#navFontColor1").spectrum({
  1280. color: "#ddd",//初始化颜色
  1281. showInput: true,//显示输入
  1282. showAlpha: true, // 透明度
  1283. containerClassName: "full-spectrum",
  1284. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  1285. showPalette: true,//显示选择器面板
  1286. showSelectionPalette: true,//记住选择过的颜色
  1287. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  1288. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  1289. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  1290. chooseText: "确定",
  1291. cancelText: "取消",
  1292. move: function (color) {//选择器右边面板移动时触发
  1293. },
  1294. show: function () {//选择器面板显示时触发
  1295. },
  1296. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  1297. },
  1298. hide: function (color) {//选择器面板隐藏时触发
  1299. updateNavFontColor1(color);
  1300. },
  1301. //选择器面板颜色设置
  1302. palette: palette
  1303. });
  1304. $("#navFontColor2").spectrum({
  1305. color: "#fff",//初始化颜色
  1306. showInput: true,//显示输入
  1307. showAlpha: true, // 透明度
  1308. containerClassName: "full-spectrum",
  1309. showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
  1310. showPalette: true,//显示选择器面板
  1311. showSelectionPalette: true,//记住选择过的颜色
  1312. maxPaletteSize: 7,//记住选择过的颜色的最大数量
  1313. preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
  1314. hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
  1315. chooseText: "确定",
  1316. cancelText: "取消",
  1317. move: function (color) {//选择器右边面板移动时触发
  1318. },
  1319. show: function () {//选择器面板显示时触发
  1320. },
  1321. beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
  1322. },
  1323. hide: function (color) {//选择器面板隐藏时触发
  1324. updateNavFontColor2(color);
  1325. },
  1326. //选择器面板颜色设置
  1327. palette: palette
  1328. });
  1329. function updateNavBackground(color) {
  1330. $(".plugin-nav .state-bgcolor").css("background-color", color);
  1331. }
  1332. function updateNavFontColor1(color) {
  1333. $(".plugin-nav .nav-top ul li").not(":eq(0)").find(".n-icon").css("color", color);
  1334. $(".plugin-nav .nav-top ul li").not(":eq(0)").find(".icon-null").css("border-color", color);
  1335. $(".plugin-nav .nav-top ul li").not(":eq(0)").find(".n-text").css("color", color);
  1336. }
  1337. function updateNavFontColor2(color) {
  1338. $(".plugin-nav .nav-top ul li").eq(0).find(".n-icon").css("color", color);
  1339. $(".plugin-nav .nav-top ul li").eq(0).find(".icon-null").css("border-color", color);
  1340. $(".plugin-nav .nav-top ul li").eq(0).find(".n-text").css("color", color);
  1341. }
  1342. // console.log(getFontColor("#navFontColor1"));
  1343. // 导航栏 下拉框change字体颜色设置、显示链接输入框
  1344. $(".plugin-nav .n-list select").change(function () {
  1345. $(this).css("color", "#333");
  1346. var selectedVal = $(this).find(":selected").val();
  1347. // console.log(selectedVal);
  1348. if (selectedVal == 'link_app' || selectedVal == 'link_url') {
  1349. $(this).parents("dd").find(".n-link").css("visibility", "visible").addClass("link-show");
  1350. } else {
  1351. $(this).parents("dd").find(".n-link").css("visibility", "hidden").removeClass("link-show");
  1352. }
  1353. });
  1354. // 导航栏 图标、文字3种不同 显示方式
  1355. $(".plugin-nav .set-nav .set-bottom ul li").click(function () {
  1356. var i = $(this).index();
  1357. $(".plugin-nav .set-nav .set-bottom ul li").removeClass("active").find(".icon-radio").removeClass("icon-radio-checked");
  1358. $(this).addClass("active").find(".icon-radio").addClass("icon-radio-checked");
  1359. if (i == 0) {
  1360. $(".plugin-nav .n-list .n-text").show();
  1361. $(".plugin-nav .n-list .add-icon").show();
  1362. $(".plugin-nav .nav-top .n-icon").show();
  1363. $(".plugin-nav .nav-top .n-text").show();
  1364. $(".plugin-nav .n-nav .nav-name").show();
  1365. $(".plugin-nav .n-nav .nav-icon").show();
  1366. } else if (i == 1) {
  1367. $(".plugin-nav .n-list .n-text").hide();
  1368. $(".plugin-nav .n-list .add-icon").show();
  1369. $(".plugin-nav .nav-top .n-text").hide();
  1370. $(".plugin-nav .nav-top .n-icon").show();
  1371. $(".plugin-nav .n-nav .nav-name").hide();
  1372. $(".plugin-nav .n-nav .nav-icon").show();
  1373. } else {
  1374. $(".plugin-nav .n-list .n-text").show();
  1375. $(".plugin-nav .n-list .add-icon").hide();
  1376. $(".plugin-nav .nav-top .n-text").show();
  1377. $(".plugin-nav .nav-top .n-icon").hide();
  1378. $(".plugin-nav .n-nav .nav-name").show();
  1379. $(".plugin-nav .n-nav .nav-icon").hide();
  1380. }
  1381. });
  1382. // 导航栏点击图标
  1383. var clickIconIndex = -1;
  1384. $(".plugin-nav .n-list .add-icon").click(function () {
  1385. clickIconIndex = $(this).parents("dd").index();
  1386. $("#iconsModal").modal("show");
  1387. });
  1388. // 导航栏 设置图标
  1389. $(".plugin-modal .icons li").click(function () {
  1390. var i = $(this).index();
  1391. // console.log(i);
  1392. $("#iconsModal").modal("hide");
  1393. $('#navModal').css({'overflow-y': 'scroll'});
  1394. $("body").css("overflow", "hidden");
  1395. $(".plugin-nav .nav-top ul li").eq(clickIconIndex).find(".n-icon").attr("class", "n-icon iconfont icon-" + i + "");
  1396. $(".plugin-nav .n-list dd").eq(clickIconIndex).find(".add-icon").find(".iconfont").attr({
  1397. "class": "iconfont icon-" + i,
  1398. "data-index": i
  1399. }).css("color", "#333");
  1400. });
  1401. /*
  1402. $('#iconsModal').on('hidden.bs.modal', function() {
  1403. $('#navModal').css({'overflow-y':'scroll'});
  1404. });
  1405. */
  1406. // 导航栏 增加配置导航 默认显示2个
  1407. $(".plugin-nav .n-list .add-config").click(function () {
  1408. $dd = $(".plugin-nav .n-list dd");
  1409. var showLength = $(".plugin-nav .n-list dd.active").length;
  1410. $(".plugin-nav .nav-top ul li").eq(showLength).css("display", "table-cell");
  1411. $(".plugin-nav .n-list dd:not(.active)").eq(0).addClass('active');
  1412. if (showLength >= 4) {
  1413. $(this).addClass("disabled");
  1414. } else {
  1415. $(this).removeClass("disabled");
  1416. }
  1417. });
  1418. // 导航栏 实时文字
  1419. $(".plugin-nav .n-list .n-text").bind("input propertychange", function () {
  1420. var i = $(this).parents("dd").index();
  1421. // console.log(i);
  1422. var thisVal = $(this).val();
  1423. if (thisVal.length == 0) {
  1424. $(".plugin-nav .nav-top ul li").eq(i).find(".n-text").text('空白');
  1425. } else {
  1426. $(".plugin-nav .nav-top ul li").eq(i).find(".n-text").text(thisVal);
  1427. }
  1428. });
  1429. // 导航栏 恢复默认
  1430. $(".plugin-nav .set-nav .reset").click(function () {
  1431. // $("#colorPicker4").spectrum("set", "rgb(249, 249, 249)");
  1432. // 去除错误状态
  1433. $(".plugin-nav .n-list").find(".error").remove();
  1434. // 恢复文字
  1435. $(".plugin-nav .nav-top ul li .n-text").text('空白');
  1436. // 恢复 配置导航显示2个
  1437. $(".plugin-nav .set-nav .n-list dd").addClass('active');
  1438. $(".plugin-nav .set-nav .n-list dd:nth-of-type(n+3)").removeClass('active');
  1439. // 预览导航 恢复到2个
  1440. $(".plugin-nav .nav-top ul li:nth-of-type(n+3)").hide();
  1441. // 导航名称默认恢复为空
  1442. $(".plugin-nav .n-list .n-text").val('');
  1443. // 恢复图标
  1444. $(".plugin-nav .nav-top .n-icon").attr("class", "n-icon icon-null").css("display", "inline-block");
  1445. $(".plugin-nav .n-list .add-icon .iconfont").attr({
  1446. "class": "iconfont icon-jia",
  1447. "data-index": ""
  1448. }).css("color", "#eee");
  1449. // select恢复到默认
  1450. $(".plugin-nav .n-list select").each(function () {
  1451. $(this).css("color", "#999");
  1452. $(this).find("option").eq(0).attr("selected", "selected");
  1453. });
  1454. // 链接输入框恢复到默认
  1455. $(".plugin-nav .n-list .n-link").css("visibility", "hidden").val("").removeClass("link-show");
  1456. // 新增导航按钮去除disabled
  1457. $(".plugin-nav .n-list .add-config").removeClass("disabled");
  1458. });
  1459. // 导航栏 删除
  1460. $(".plugin-nav .n-list .n-delete").click(function () {
  1461. var $This = $(this).parents("dd");
  1462. var i = $This.index();
  1463. $This.hide();
  1464. $This.find(".n-link").removeClass("link-show").show();
  1465. $This.find("select").eq(0).attr("selected", "selected");
  1466. $(".plugin-nav .nav-top ul li").eq(i).hide();
  1467. var showLength = $(".plugin-nav .n-list dd.active").length;
  1468. if (showLength < 5) {
  1469. $(".plugin-nav .n-list .add-config").removeClass("disabled");
  1470. } else {
  1471. $(".plugin-nav .n-list .add-config").addClass("disabled");
  1472. }
  1473. });
  1474. // 导航栏 保存
  1475. $("#navModal .plugin-save").click(function () {
  1476. var $dd = $(".plugin-nav .n-list dd.active");
  1477. var navBgColor = getFontColor("#colorPicker4");
  1478. var navBgColorAlpha = getAlpha("#colorPicker4");
  1479. var navDefaultFontColor = getFontColor("#navFontColor1");
  1480. var navDefaultFontColorAlpha = getAlpha("#navFontColor1");
  1481. var navCheckedFontColor = getFontColor("#navFontColor2");
  1482. var navCheckedFontColorAlpha = getAlpha("#navFontColor2");
  1483. var iconNameShow = $("#iconNameShow .active").attr("data-show");
  1484. var error = false;
  1485. var nameErrorText = "请输入导航名称,四个字以内";
  1486. var selectErrorText = "请选择导航功能";
  1487. var iconErrorText = "请选择图标";
  1488. var linkErrorText = "请输入http://或https://的链接地址";
  1489. var match = /^((ht|f)tps?):\/\/([\w\-]+(\.[\w\-]+)*\/)*[\w\-]+(\.[\w\-]+)*\/?(\?([\w\-\.,@?^=%&:\/~\+#]*)+)?/;
  1490. var menu = [];
  1491. $dd.find('.error').remove();
  1492. $dd.each(function () {
  1493. var This1 = $(this);
  1494. var text = $.trim(This1.find(".n-text").val());
  1495. var action = This1.find(":selected").val();
  1496. var icon = This1.find(".iconfont").attr("data-index");
  1497. var url = This1.find(".link-show").val();
  1498. var textLength = getByteLen(text);
  1499. var noIcon = This1.find(".add-icon").find(".iconfont").hasClass("icon-jia");
  1500. var hasUrl = This1.find(".n-link").hasClass("link-show");
  1501. // 导航功能
  1502. if (action == 0) {
  1503. This1.addClass("form-error");
  1504. This1.append('<div class="error">' + selectErrorText + '</div>');
  1505. error = true;
  1506. return false;
  1507. }
  1508. // 名称
  1509. if (iconNameShow != 1 && (textLength < 1 || textLength > 8)) {
  1510. This1.addClass("form-error");
  1511. This1.append('<div class="error">' + nameErrorText + '</div>');
  1512. error = true;
  1513. return false;
  1514. }
  1515. // 图标
  1516. if (iconNameShow != 2 && noIcon) {
  1517. This1.addClass("form-error");
  1518. This1.append('<div class="error">' + iconErrorText + '</div>');
  1519. error = true;
  1520. return false;
  1521. }
  1522. // 链接
  1523. if (hasUrl && !match.test(url)) {
  1524. This1.addClass("form-error");
  1525. This1.append('<div class="error">' + linkErrorText + '</div>');
  1526. error = true;
  1527. return false;
  1528. }
  1529. menu.push({text, action, icon, url});
  1530. });
  1531. if (!error && menu.length > 0) {
  1532. navData = {
  1533. menuBackgroundColor: navBgColor,
  1534. menuBackgroundColorAlpha: navBgColorAlpha,
  1535. menuTextColor: navDefaultFontColor,
  1536. menuTextColorAlpha: navDefaultFontColorAlpha,
  1537. menuPressedTextColor: navCheckedFontColor,
  1538. menuPressedTextColorAlpha: navCheckedFontColorAlpha,
  1539. show: iconNameShow, menu
  1540. };
  1541. console.log(navData);
  1542. $("#navModal").modal("hide");
  1543. $("#config8").parent().addClass("active");
  1544. $("#config8").find(".iconfont").addClass("icon-checkbox-checked1");
  1545. }
  1546. });
  1547. // 左侧栏 取值
  1548. $("#asideModal .plugin-save").click(function () {
  1549. var $dd = $(".plugin-aside .n-list dd.active");
  1550. // 背景色
  1551. var asideBgColor = getFontColor("#colorPicker5");
  1552. // 背景色透明度
  1553. var asideBgColorAlpha = getAlpha("#colorPicker5");
  1554. // 文字和图标颜色
  1555. var asideFontColor = getFontColor("#asideFontColor");
  1556. // 文字和图标颜色透明度
  1557. var asideFontColorAlpha = getAlpha("#asideFontColor");
  1558. // 显示方式
  1559. // var asideDisplay = $(".plugin-aside .set-nav .set-bottom ul .active").attr("data-display");
  1560. // 显示APP
  1561. var asideShowApp = $(".plugin-aside .top-show ul li.active").attr("data-app-show");
  1562. var nameErrorText = "请输入导航名称,十个字以内";
  1563. var selectErrorText = "请选择导航功能";
  1564. var iconErrorText = "请选择图标";
  1565. var linkErrorText = "请输入http://或https://的链接地址";
  1566. var match = /^((ht|f)tps?):\/\/([\w\-]+(\.[\w\-]+)*\/)*[\w\-]+(\.[\w\-]+)*\/?(\?([\w\-\.,@?^=%&:\/~\+#]*)+)?/;
  1567. var error = false;
  1568. var menu = [];
  1569. $dd.find('.error').remove();
  1570. $dd.each(function () {
  1571. var This1 = $(this);
  1572. var text = $.trim(This1.find(".n-text").val());
  1573. var action = This1.find(":selected").val();
  1574. var icon = This1.find(".iconfont").attr("data-index");
  1575. var url = This1.find(".link-show").val();
  1576. var textLength = getByteLen(text);
  1577. var noIcon = This1.find(".add-icon").find(".iconfont").hasClass("icon-jia");
  1578. var hasUrl = This1.find(".n-link").hasClass("link-show");
  1579. This1.removeClass("form-error");
  1580. This1.find(".error").remove();
  1581. // 导航功能
  1582. if (action == 0) {
  1583. This1.addClass("form-error");
  1584. This1.append('<div class="error">' + selectErrorText + '</div>');
  1585. error = true;
  1586. return false;
  1587. }
  1588. // 名称
  1589. if (textLength < 1 || textLength > 19) {
  1590. This1.addClass("form-error");
  1591. This1.append('<div class="error">' + nameErrorText + '</div>');
  1592. error = true;
  1593. return false;
  1594. }
  1595. // 图标
  1596. if (noIcon) {
  1597. This1.addClass("form-error");
  1598. This1.append('<div class="error">' + iconErrorText + '</div>');
  1599. error = true;
  1600. return false;
  1601. }
  1602. // 链接
  1603. if (hasUrl && !match.test(url)) {
  1604. This1.addClass("form-error");
  1605. This1.append('<div class="error">' + linkErrorText + '</div>');
  1606. error = true;
  1607. return false;
  1608. }
  1609. menu.push({text, action, icon, url});
  1610. });
  1611. if (!error && menu.length > 0) {
  1612. asideData = {asideBgColor, asideBgColorAlpha, asideFontColor, asideFontColorAlpha, asideShowApp, menu};
  1613. console.log(asideData);
  1614. $("#asideModal").modal("hide");
  1615. $("#configAside").parent().addClass("active");
  1616. $("#configAside").find(".iconfont").addClass("icon-checkbox-checked1");
  1617. }
  1618. });
  1619. // 长按图片保存点击保存
  1620. $("#photoSaveModal .plugin-save").click(function () {
  1621. supportLongPressSavePicture = $("#photoSaveModal").find("ul>li.active").data('photo-save');
  1622. console.log(supportLongPressSavePicture);
  1623. });
  1624. // 支持二维码扫码点击保存
  1625. $("#identifyCodeModal .plugin-save").click(function () {
  1626. supportQrcodeScan = $("#identifyCodeModal").find("ul>li.active").data('identify-code');
  1627. console.log(supportQrcodeScan);
  1628. });
  1629. // 支持侧滑返回
  1630. $("#skidBackModal .plugin-save").click(function () {
  1631. skidBack = $("#skidBackModal").find("ul>li.active").data('skid-back');
  1632. console.log(skidBack);
  1633. });
  1634. // 支持无网提示
  1635. $("#noNetModal .plugin-save").click(function () {
  1636. noNet = $("#noNetModal").find("ul>li.active").data('no-net');
  1637. console.log(noNet);
  1638. });
  1639. // 支持APK安装器
  1640. $("#installTipModal .plugin-save").click(function () {
  1641. installTip = $("#installTipModal").find("ul>li.active").data('install-tip');
  1642. console.log(installTip);
  1643. });
  1644. // 支持屏幕常亮
  1645. $("#keepScreenModal .plugin-save").click(function () {
  1646. keepScreen = $("#keepScreenModal").find("ul>li.active").data('keep-screen');
  1647. console.log(keepScreen);
  1648. });
  1649. // 支持隐藏虚拟按键
  1650. $("#hideBottomModal .plugin-save").click(function () {
  1651. hideBottom = $("#hideBottomModal").find("ul>li.active").data('hide-bottom');
  1652. console.log(hideBottom);
  1653. });
  1654. // 网页缩放
  1655. // 开启 关闭
  1656. $(".plugin-web-zoom .fun li").click(function () {
  1657. var attr = $(this).attr("data-web-zoom");
  1658. if (attr == -1) {
  1659. $(this).parents(".plugin-web-zoom").find(".zoom-in").hide();
  1660. } else {
  1661. $(this).parents(".plugin-web-zoom").find(".zoom-in").show();
  1662. }
  1663. });
  1664. // 支持网页缩放
  1665. $("#webZoomModal .plugin-save").click(function () {
  1666. supportZoom = $("#webZoomModal").find("ul>li.active").data('web-zoom');
  1667. console.log(supportZoom);
  1668. });
  1669. // 引导页保存
  1670. $("#guideModal .plugin-save").click(function () {
  1671. // 是否显示“立即体验”,以及按钮颜色
  1672. supportGuideEnterMainPageButton = $('#guideModal .experience').find("li.active").data('type');
  1673. guideEnterMainPageButtonColor = getFontColor("#experienceTextColor");
  1674. guide = {};
  1675. $('#guideModal').find(".plugin-guide img").each(function (index, element) {
  1676. guide[index] = $(element).attr('src');
  1677. });
  1678. });
  1679. // UA设置
  1680. $("#uaModal .plugin-save").click(function () {
  1681. userAgent = {};
  1682. userAgent.appendUa = $.trim($('#uaModal').find("input[name='appendUa']").val());
  1683. userAgent.completeUa = $.trim($('#uaModal').find("input[name='completeUa']").val());
  1684. if (!userAgent.appendUa && !userAgent.completeUa) {
  1685. $('#uaModal').find("input[name='completeUa']").parents(".form-group").addClass("form-error");
  1686. } else {
  1687. $('#uaModal').find("input[name='completeUa']").parents(".form-group").removeClass("form-error");
  1688. }
  1689. var errorLength = $(".plugin-ua .form-error").length;
  1690. if (errorLength > 0) {
  1691. $("#uaModal").modal("show");
  1692. $("[data-target=#uaModal]").removeClass("active").find(".icon-checkbox1").removeClass("icon-checkbox-checked1 add-checked");
  1693. } else {
  1694. $("#uaModal").modal("hide");
  1695. $("[data-target=#uaModal]").addClass("active").find(".icon-checkbox1").addClass("icon-checkbox-checked1 add-checked");
  1696. }
  1697. });
  1698. $(".toStore").on('click', function () {
  1699. $('#msModal8').modal('show');
  1700. appName = $("input[name=app]").val();
  1701. url = $("input[name=url]").val();
  1702. device = $("#device").find(".active").attr("data-device");
  1703. screen = $("#screen").find(".active").attr("data-screen");
  1704. version = $("input[name=version]").val();
  1705. bundle = $("input[name=bundle]").val();
  1706. appIcon = $(".pack-step2 #appIcon").find("img").attr('src');// ICON图标
  1707. startPage = $("input[name='startPage']").parent().find("img").attr("src"); // 启动图
  1708. splashShowTime = $(".pack-step2 .start-time ").find("ul>li.active").data("start-time"); // 启动图显示时长
  1709. isSupportShowSplashSkipButton = $(".pack-step2 .show-skip").find("ul>li.active").data("show"); // 是否显示跳过按钮
  1710. // 获取插件
  1711. plugin = {};
  1712. var hasChecked1 = $("#config1").find(".iconfont").hasClass("icon-checkbox-checked1"); // 加载动画
  1713. var hasChecked2 = $("#config2").find(".iconfont").hasClass("icon-checkbox-checked1"); // 清理缓存
  1714. var hasChecked3 = $("#config3").find(".iconfont").hasClass("icon-checkbox-checked1"); // 浏览器
  1715. var hasChecked4 = $("#config4").find(".iconfont").hasClass("icon-checkbox-checked1"); // 退出提示
  1716. var hasChecked5 = $("#config5").find(".iconfont").hasClass("icon-checkbox-checked1"); // 第三方分享
  1717. var hasChecked6 = $("#config6").find(".iconfont").hasClass("icon-checkbox-checked1"); // 极光推送
  1718. var hasChecked7 = $("#config7").find(".iconfont").hasClass("icon-checkbox-checked1"); // 友盟统计
  1719. var hasChecked8 = $("#config8").find(".iconfont").hasClass("icon-checkbox-checked1"); // 导航栏
  1720. var hasChecked9 = $("#config9").find(".iconfont").hasClass("icon-checkbox-checked1"); // 状态栏
  1721. var hasChecked10 = $("#config10").find(".iconfont").hasClass("icon-checkbox-checked1"); // 标题栏
  1722. var hasChecked11 = $("#config11").find(".iconfont").hasClass("icon-checkbox-checked1"); // 引导页
  1723. var configAsideChecked = $("#configAside").find(".iconfont").hasClass("icon-checkbox-checked1"); // 左侧栏
  1724. var longPressSavePictureChecked = $("#configPhotoSave").find(".iconfont").hasClass("icon-checkbox-checked1"); // 长按图片保存
  1725. var qrcodeScanChecked = $("#configIdentifyCode").find(".iconfont").hasClass("icon-checkbox-checked1"); // 扫一扫
  1726. var webZoomChecked = $("#configWebZoom").find(".iconfont").hasClass("icon-checkbox-checked1"); // 网页缩放
  1727. var userAgentChecked = $("#userAgent").find(".iconfont").hasClass("icon-checkbox-checked1");
  1728. var isSkidBack = $("#configSkidBack").find(".iconfont").hasClass("icon-checkbox-checked1"); // 侧滑返回
  1729. var isNoNet = $("#configNoNet").find(".iconfont").hasClass("icon-checkbox-checked1"); // 无网提示
  1730. var isInstallTip = $("#configInstallTip").find(".iconfont").hasClass("icon-checkbox-checked1"); // APK安装器
  1731. var isKeepScreen = $("#configKeepScreen").find(".iconfont").hasClass("icon-checkbox-checked1"); // 屏幕常亮
  1732. var isHideBottom = $("#configHideBottom").find(".iconfont").hasClass("icon-checkbox-checked1"); // 屏幕常亮
  1733. var hasKeystore = $('#configKeystore').find(".iconfont").hasClass("icon-checkbox-checked1"); // 安卓证书
  1734. plugin.supportLongPressSavePicture = 0;
  1735. plugin.supportQrcodeScan = 0;
  1736. plugin.supportZoom = 0;
  1737. plugin.userAgent = {};
  1738. plugin.skidBack = 0;
  1739. plugin.noNet = 0;
  1740. plugin.installTip = 0;
  1741. plugin.keepScreen = 0;
  1742. plugin.hideBottom = 0;
  1743. if (longPressSavePictureChecked) plugin.supportLongPressSavePicture = supportLongPressSavePicture;
  1744. if (qrcodeScanChecked) plugin.supportQrcodeScan = supportQrcodeScan;
  1745. if (webZoomChecked) plugin.supportZoom = supportZoom;
  1746. if (userAgentChecked) plugin.userAgent = userAgent;
  1747. if (isSkidBack) plugin.skidBack = skidBack;
  1748. if (isNoNet) plugin.noNet = noNet;
  1749. if (isInstallTip) plugin.installTip = installTip;
  1750. if (isKeepScreen) plugin.keepScreen = keepScreen;
  1751. if (isHideBottom) plugin.hideBottom = hideBottom;
  1752. // 下拉刷新
  1753. var hasCheckedRefresh = $("#configRefresh").find(".iconfont").hasClass("icon-checkbox-checked1");
  1754. if (hasCheckedRefresh) {
  1755. refreshVal = $("#refreshModal").find(".plugin-refresh").find(".active").attr("data-refresh");
  1756. plugin.refresh = refreshVal;
  1757. } else {
  1758. plugin.refresh = 0;
  1759. }
  1760. // URL 拉起APP
  1761. var hasCheckedUrlApp = $("#configUrlApp").find(".iconfont").hasClass("icon-checkbox-checked1");
  1762. plugin.urlApp = 0;
  1763. if (hasCheckedUrlApp) {
  1764. urlAppVal = $("#urlAppModal").find(".plugin-url-app").find(".active").attr("data-url-app");
  1765. plugin.urlApp = urlAppVal;
  1766. }
  1767. // 加载配置
  1768. if (hasChecked1) {
  1769. way = $("#loadingModal").find(".plugin-loading").find(".active").attr("data-way");
  1770. color = $("#loadingModal").find(".plugin-loading").find(".sp-preview-inner").css("background-color");
  1771. color = colorRGB2Hex(color);
  1772. plugin.loading = {way: way, color: color};
  1773. } else {
  1774. plugin.loading = {};
  1775. }
  1776. // 清理缓存
  1777. if (hasChecked2) {
  1778. plugin.cache = $("#cacheModal").find(".plugin-cache").find(".active").attr("data-cache");
  1779. } else {
  1780. plugin.cache = 0;
  1781. }
  1782. // 浏览器内核
  1783. if (hasChecked3) {
  1784. android = $("#browserModal").find("#androidKernel").find(".active").attr("data-android-kernel");
  1785. ios = $("#browserModal").find("#iosKernel").find(".active").attr("data-ios-kernel");
  1786. plugin.browser = {android: android, ios: ios}
  1787. } else {
  1788. plugin.browser = {};
  1789. }
  1790. // 退出提示
  1791. if (hasChecked4) {
  1792. exit = $("#exitModal").find(".plugin-exit").find(".active").attr("data-exit");
  1793. plugin.exit = exit;
  1794. } else {
  1795. plugin.exit = 0;
  1796. }
  1797. // 第三方分享
  1798. if (hasChecked5) {
  1799. plugin.share = share;
  1800. }
  1801. // 极光推送
  1802. plugin.jPushId = '';
  1803. if (hasChecked6) {
  1804. jPushId = $.trim($('#auroraModal input[name="jPushId"]').val());
  1805. if (jPushId) plugin.jPushId = jPushId;
  1806. }
  1807. // 友盟统计
  1808. plugin.umengKey = '';
  1809. if (hasChecked7) {
  1810. umengIosKey = $.trim($('#alliesModal input[name="umeng_ios_key"]').val());
  1811. umengAndroidKey = $.trim($('#alliesModal input[name="umeng_android_key"]').val());
  1812. plugin.umengKey = {
  1813. ios: umengIosKey,
  1814. android: umengAndroidKey
  1815. };
  1816. }
  1817. // 导航栏
  1818. plugin.nav = '';
  1819. if (hasChecked8 && navData) plugin.nav = navData;
  1820. // 状态标题栏
  1821. plugin.titleBar = '';
  1822. plugin.stateBar = '';
  1823. if (hasChecked10) {
  1824. plugin.titleBar = titleBar;
  1825. plugin.stateBar = stateBar;
  1826. }
  1827. // 侧边栏
  1828. plugin.asideData = '';
  1829. if (configAsideChecked && asideData) plugin.asideData = asideData;
  1830. console.info(plugin);
  1831. // 引导页
  1832. plugin.guide = {};
  1833. if (hasChecked11) {
  1834. plugin.guide = guide;
  1835. plugin.support_guide_enter_main_page_button = supportGuideEnterMainPageButton;
  1836. plugin.guide_enter_main_page_button_color = guideEnterMainPageButtonColor;
  1837. }
  1838. if (hasKeystore) {
  1839. delete androidKey.save;
  1840. plugin.androidKey = androidKey;
  1841. }
  1842. // 是否点击跳过
  1843. //var isSkip = $(this).hasClass('skip');
  1844. formData = new FormData();
  1845. formData.append('id', id);
  1846. formData.append('appName', appName);
  1847. formData.append('url', url);
  1848. formData.append('device', device);
  1849. formData.append('appVersion', version);
  1850. formData.append('bundleId', bundle);
  1851. formData.append('splashMode', screen);
  1852. formData.append('icon', appIcon);
  1853. formData.append('splash', startPage);
  1854. formData.append('isSupportShowSplashSkipButton', isSupportShowSplashSkipButton);
  1855. formData.append('splashShowTime', splashShowTime);
  1856. formData.append('plugin', JSON.stringify(plugin));
  1857. $.ajax({
  1858. url: '/pack/store',
  1859. type: 'POST',
  1860. cache: false,
  1861. data: formData,
  1862. processData: false,
  1863. contentType: false,
  1864. success: function (result) {
  1865. $('#msModal8').modal('hide');
  1866. if (result.code != 200) {
  1867. if (result.code == -10001) {
  1868. alert(result.msg, function () {
  1869. window.location.href = '/user/login';
  1870. });
  1871. } else {
  1872. alert(result.msg);
  1873. }
  1874. return;
  1875. }
  1876. window.location.href = result.data.url
  1877. }
  1878. });
  1879. });
  1880. $(function () {
  1881. $(document).on('click', "div[data-target='#navModal']", function () {
  1882. console.info(navData);
  1883. // 设置导航背景色
  1884. if (navData.menuBackgroundColor) {
  1885. $("#colorPicker4").spectrum("set", navData.menuBackgroundColor);
  1886. updateNavBackground(navData.menuBackgroundColor);
  1887. }
  1888. // 字体色
  1889. if (navData.menuTextColor) {
  1890. $("#navFontColor1").spectrum("set", navData.menuTextColor);
  1891. updateNavFontColor1(navData.menuTextColor);
  1892. }
  1893. // 选中色
  1894. if (navData.menuPressedTextColor) {
  1895. $("#navFontColor2").spectrum("set", navData.menuPressedTextColor);
  1896. updateNavFontColor2(navData.menuPressedTextColor);
  1897. }
  1898. //显示类型
  1899. $("#navModal").find("#iconNameShow li[data-show='" + navData.show + "']").trigger('click');
  1900. //设置导航值
  1901. var jsonLength = 0;
  1902. if (navData.menu) {
  1903. $.each(navData.menu, function () {
  1904. jsonLength++;
  1905. });
  1906. }
  1907. // 需要补充的导航个数
  1908. var addLength = jsonLength - 2;
  1909. if (addLength > 0) {
  1910. for (var i = 0; i < addLength; i++) {
  1911. $(".plugin-nav .nav-top ul li").eq(i + 2).css("display", "table-cell");
  1912. $(".plugin-nav .n-list dd").eq(i + 2).addClass('active');
  1913. }
  1914. }
  1915. if (navData.menu) {
  1916. // 填充数据
  1917. $.each(navData.menu, function (key, item) {
  1918. var dd = $(".plugin-nav .n-list dd");
  1919. if (item.text) {
  1920. dd.eq(key).find("input[name='navText']").val(item.text);
  1921. $(".plugin-nav .nav-top ul li").eq(key).find(".n-text").text(item.text);
  1922. }
  1923. dd.eq(key).find("select").val(item.action);
  1924. dd.eq(key).find("select").trigger('change');
  1925. if (item.icon) {
  1926. dd.eq(key).find(".add-icon span").attr('class', 'iconfont icon-' + item.icon);
  1927. dd.eq(key).find(".add-icon span").css('color', 'rgb(51, 51, 51)');
  1928. dd.eq(key).find(".add-icon span").attr('data-index', item.icon);
  1929. $(".plugin-nav .nav-top ul li").eq(key).find(".n-icon").attr("class", "n-icon iconfont icon-" + item.icon + "");
  1930. }
  1931. dd.eq(key).find("input[name='navLink']").val(item.url);
  1932. });
  1933. }
  1934. });
  1935. // 状态标题栏设置默认值
  1936. $(document).on('click', "div[data-target='#titleModal']", function () {
  1937. // 状态栏设置
  1938. if (stateBar.state == 2) { // 隐藏
  1939. $(".plugin-title").find(".state-show-toggle li[data-state='2']").trigger('click');
  1940. } else {
  1941. if (stateBar.way == 2) { // 延伸
  1942. $(".plugin-title .state-way-ul").find("li[data-state-way='2']").trigger('click');
  1943. } else { // 自定义
  1944. $(".plugin-title .state-way-ul").find("li[data-state-way='1']").trigger('click');
  1945. if (stateBar.bgColor) {
  1946. // 设置背景色
  1947. $("#colorPicker2").spectrum("set", stateBar.bgColor);
  1948. updateStateBackground(stateBar.bgColor);
  1949. //$("$colorPicker2").css('opacity', stateBar.bgAlpha);
  1950. //$("#titleModal .state-bgcolor").css("opacity", '0.5');
  1951. }
  1952. }
  1953. // 设置文字色
  1954. if (stateBar.fontColor) {
  1955. $(".plugin-title .bg-text-color1").find("li[data-state-font-color=" + stateBar.fontColor + "]").trigger('click');
  1956. }
  1957. }
  1958. // 显示或隐藏
  1959. if (titleBar.show == 1) {
  1960. $(".plugin-title").find("#titleShow li[data-show='1']").trigger('click');
  1961. return;
  1962. }
  1963. if (!titleBar.title) titleBar.title = $("input[name=app]").val();
  1964. $(".plugin-title .input-title").val(titleBar.title);
  1965. $(".plugin-title .input-title").parents(".plugin-title").find(".title-top").find(".text").text(titleBar.title);
  1966. // 设置颜色
  1967. if (titleBar.bgColor) {
  1968. $("#colorPicker3").spectrum("set", titleBar.bgColor);
  1969. updateTitleBackground(titleBar.bgColor);
  1970. }
  1971. if (titleBar.titleColor) {
  1972. $("#titFontColor").spectrum("set", titleBar.titleColor);
  1973. updateTitleFontColor(titleBar.titleColor);
  1974. }
  1975. if (titleBar.leftKey) {
  1976. $.each(titleBar.leftKey, function (key, val) {
  1977. if (!$("#leftKey").find("li[data-left-key='" + val + "']").hasClass('active')) {
  1978. // 设置功能键
  1979. $("#leftKey").find("li[data-left-key='" + val + "']").trigger('click');
  1980. console.log(val);
  1981. }
  1982. });
  1983. }
  1984. if (titleBar.rightKey) {
  1985. $.each(titleBar.rightKey, function (key, v) {
  1986. // 设置功能键,是否选中,选中后不再触发点击
  1987. if (!$("#rightKey").find("li[data-right-key='" + v + "']").hasClass('active')) {
  1988. $("#rightKey").find("li[data-right-key='" + v + "']").trigger('click');
  1989. console.log(v);
  1990. }
  1991. });
  1992. }
  1993. });
  1994. // 第三方分享设置默认值
  1995. $(document).on('click', "div[data-target='#shareModal']", function () {
  1996. if (share.way == 1) {
  1997. $(".plugin-share .s-ul").find("li[data-way='1']").trigger('click');
  1998. } else {
  1999. $(".plugin-share .s-ul").find("li[data-way='0']").trigger('click');
  2000. }
  2001. $("#shareModal input[name=wxId]").val(share.wxId);
  2002. $("#shareModal input[name=wxSecret]").val(share.wxSecret);
  2003. $("#shareModal input[name=text]").val(share.shareText);
  2004. $("#shareModal input[name=link1]").val(share.shareUrl);
  2005. });
  2006. // 第三方分享设置默认值
  2007. // $(document).on('click', "div[data-target='#keystoreModal']", function () {
  2008. //
  2009. // $('#keystoreModal .keystore-wrap').find("input[name='store_file_content']").val(androidKey.file_url);
  2010. // $('#keystoreModal .keystore-wrap').find("input[name='store_storepass']").val(androidKey.store_pass);
  2011. // $('#keystoreModal .keystore-wrap').find("input[name='store_alias']").val(androidKey.alias);
  2012. // $('#keystoreModal .keystore-wrap').find("input[name='store_keypass']").val(androidKey.key_pass);
  2013. // });
  2014. // 侧边栏设置默认值
  2015. $(document).on('click', "div[data-target='#asideModal']", function () {
  2016. var iconImg = $(".step2").find("#appIcon img").attr('src');
  2017. $("#asideModal").find(".aside-icon img").attr('src', iconImg);
  2018. // 背景色
  2019. if (asideData.asideBgColor) {
  2020. $("#colorPicker5").spectrum("set", asideData.asideBgColor);
  2021. updateAsideBackground(asideData.asideBgColor);
  2022. }
  2023. // 字体色
  2024. if (asideData.asideFontColor) {
  2025. $("#asideFontColor").spectrum("set", asideData.asideFontColor);
  2026. updateAsideFontColor(asideData.asideFontColor);
  2027. }
  2028. // 显示方式
  2029. $("#asideModal").find("#displayMode li[data-display='" + asideData.asideDisplay + "']").trigger('click');
  2030. // 是否显示APP
  2031. $("#asideModal").find(".top-show li[data-app-show='" + asideData.asideShowApp + "']").trigger('click');
  2032. //设置导航值
  2033. var jsonLength = 0;
  2034. if (asideData.menu) {
  2035. $.each(asideData.menu, function () {
  2036. jsonLength++;
  2037. });
  2038. }
  2039. // 需要补充的导航个数
  2040. var addLength = jsonLength - 1;
  2041. if (addLength > 0) {
  2042. for (var i = 0; i < addLength; i++) {
  2043. $(".plugin-aside .nav-top ul li").eq(i + 1).css("display", "table-cell");
  2044. $(".plugin-aside .n-list dd").eq(i + 1).removeClass('active');
  2045. }
  2046. }
  2047. if (asideData.menu) {
  2048. // 填充数据
  2049. $.each(asideData.menu, function (key, item) {
  2050. var dd = $(".plugin-aside .n-list dd");
  2051. if (item.text) {
  2052. dd.eq(key).find("input[name='navText']").val(item.text);
  2053. dd.eq(key).find("input[name='navText']").bind('input propertychange', function () {
  2054. //$(this).val(item.text);
  2055. }).trigger('propertychange');
  2056. $(".plugin-aside .nav-top ul li").eq(key).find(".n-text").text(item.text);
  2057. }
  2058. dd.eq(key).find("select").val(item.action);
  2059. dd.eq(key).find("select").trigger('change');
  2060. if (item.icon) {
  2061. dd.eq(key).find(".add-icon span").attr('class', 'iconfont icon-' + item.icon);
  2062. dd.eq(key).find(".add-icon span").css('color', 'rgb(51, 51, 51)');
  2063. dd.eq(key).find(".add-icon span").attr('data-index', item.icon);
  2064. item.icon.split('menu');
  2065. $(".aside-modal .aside-nav li").eq(key).find(".iconfont").attr("class", "fl iconfont icon-" + item.icon);
  2066. $(".plugin-aside .nav-top ul li").eq(key).find(".n-icon").attr("class", "n-icon iconfont icon-" + item.icon + "");
  2067. }
  2068. dd.eq(key).find("input[name='navLink']").val(item.url);
  2069. });
  2070. }
  2071. });
  2072. // // 状态栏设置默认值
  2073. // $(document).on('click', "div[data-target='#stateModal']", function () {
  2074. // // 设置颜色
  2075. // $("#colorPicker22").spectrum("set", stateBar.bgColor);
  2076. // });
  2077. //------------------ 长按图片保存 -------------------//
  2078. $(document).on('click', "div[data-target='#photoSaveModal']", function () {
  2079. $("#photoSaveModal").find("ul>li[data-photo-save='" + supportLongPressSavePicture + "']").trigger('click');
  2080. });
  2081. //------------------ 支持二维码扫码 -------------------//
  2082. $(document).on('click', "div[data-target='#identifyCodeModal']", function () {
  2083. $("#identifyCodeModal").find("ul>li[data-identify-code='" + supportQrcodeScan + "']").trigger('click');
  2084. });
  2085. //------------------ 支持侧滑返回 -------------------//
  2086. $(document).on('click', "div[data-target='#skidBackModal']", function () {
  2087. $("#skidBackModal").find("ul>li[data-skid-back='" + skidBack + "']").trigger('click');
  2088. });
  2089. //------------------ 支持无网提示 -------------------//
  2090. $(document).on('click', "div[data-target='#noNetModal']", function () {
  2091. $("#noNetModal").find("ul>li[data-no-net='" + noNet + "']").trigger('click');
  2092. });
  2093. //------------------ 支持APk安装器 -------------------//
  2094. $(document).on('click', "div[data-target='#installTipModal']", function () {
  2095. $("#installTipModal").find("ul>li[data-install-tip='" + installTip + "']").trigger('click');
  2096. });
  2097. //------------------ 支持屏幕常亮 -------------------//
  2098. $(document).on('click', "div[data-target='#keepScreenModal']", function () {
  2099. $("#keepScreenModal").find("ul>li[data-keep-screen='" + keepScreen + "']").trigger('click');
  2100. });
  2101. //------------------ 支持网页缩放 -------------------//
  2102. $(document).on('click', "div[data-target='#webZoomModal']", function () {
  2103. $("#webZoomModal").find("ul>li[data-web-zoom='" + supportZoom + "']").trigger('click');
  2104. });
  2105. //------------------ 设置引导页的“立即体验”按钮及其颜色 -------------------//
  2106. $(document).on('click', "div[data-target='#guideModal']", function () {
  2107. $("#guideModal").find(".experience ul>li[data-type='" + supportGuideEnterMainPageButton + "']").trigger('click');
  2108. if (supportGuideEnterMainPageButton == -1) {
  2109. $("#experienceTextColor").spectrum("set", '#ffffff');
  2110. } else {
  2111. $("#experienceTextColor").spectrum("set", guideEnterMainPageButtonColor);
  2112. }
  2113. });
  2114. //------------------ UA设置 -------------------//
  2115. $(document).on('click', "div[data-target='#uaModal']", function () {
  2116. $("#uaModal input[name='appendUa']").val(plugin.userAgent.appendUa);
  2117. $("#uaModal input[name='completeUa']").val(plugin.userAgent.completeUa);
  2118. });
  2119. // 提示滚动条
  2120. $(".plugin-modal .modal-body").scroll(function () {
  2121. var sclollTop = $(this).scrollTop();
  2122. // console.log(sclollTop);
  2123. if (sclollTop > 0) {
  2124. $(this).find(".more-gif").hide();
  2125. } else {
  2126. $(this).find(".more-gif").show();
  2127. }
  2128. });
  2129. // 手势配置
  2130. tab.radioRound({
  2131. el: ".gestures-list1 li",
  2132. checkedClass: "icon-radio-checked"
  2133. });
  2134. });