main.js 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  1. function getNewArticleList(id) {
  2. $.getJSON('/article/get-new-article-list', function (res) {
  3. var html = ''
  4. var data = res.data
  5. for (var i = 0; i < data.length; i++) {
  6. var item = data[i]
  7. html += '<li><a href="/ad_' + item.id + '.html"><h2>' + item.title + '</h2></a><h3>' + item.create_date + '</h3></li>'
  8. }
  9. id = id || 'new_article_list';
  10. $('#' + id).append(html)
  11. })
  12. }
  13. //---------------导航条---------------------
  14. window.onload = function () {
  15. var index_nav = document.getElementById("index_nav");
  16. var index_nav_ul = index_nav.getElementsByTagName("ul")[0];
  17. var index_nav_li = index_nav_ul.children;
  18. for (var i = 1; i < index_nav_li.length; i++) {
  19. index_nav_li[i].index = i;
  20. if (index_nav_li[i].querySelector("ul")) {
  21. index_nav_li[i].onmousemove = function () {
  22. var this_ = this.querySelector("ul");
  23. this_.style.display = "block";
  24. startMove(this_, {opacity: 100});
  25. }
  26. index_nav_li[i].onmouseleave = function () {
  27. var this_ = this.querySelector("ul");
  28. this_.style.display = "none";
  29. clearInterval(this_.timer);
  30. }
  31. }
  32. }
  33. }
  34. //----------------------------------------------------
  35. if (document.getElementById("index_banner")) {
  36. var index_banner_oBox = document.getElementById('index_banner');
  37. var index_banner_oUl = index_banner_oBox.getElementsByTagName('ul')[0];
  38. var index_banner_aLi = index_banner_oUl.getElementsByTagName('li');
  39. var index_banner_ico = document.getElementById('index_banner_ico').getElementsByTagName('a');
  40. var index_banner_timer = null;
  41. var index_banner_ico_num = 0;
  42. index_banner_oUl.innerHTML += index_banner_oUl.innerHTML;
  43. function autoPlay() {
  44. if (index_banner_ico_num < index_banner_aLi.length - 1) {
  45. index_banner_ico_num++;
  46. } else {
  47. index_banner_ico_num = index_banner_aLi.length / 2;
  48. index_banner_oUl.style.bottom = -(index_banner_aLi[0].offsetHeight * (index_banner_aLi.length / 2 - 1)) + 'px';
  49. }
  50. scroll();
  51. }
  52. index_banner_timer = setInterval(autoPlay, 5000);
  53. for (var i = 0; i < index_banner_ico.length; i++) {
  54. index_banner_ico[i].index = i;
  55. index_banner_ico[i].onclick = function () {
  56. index_banner_ico_num = this.index;
  57. scroll();
  58. }
  59. }
  60. function scroll() {
  61. startMove(index_banner_oUl, {bottom: -index_banner_aLi[0].offsetHeight * index_banner_ico_num});
  62. for (var i = 0; i < index_banner_ico.length; i++) {
  63. index_banner_ico[i].className = '';
  64. }
  65. index_banner_ico[index_banner_ico_num % index_banner_ico.length].className = 'index_banner_active';
  66. }
  67. }
  68. //----------------------四大产品隐藏or显示-------------
  69. if (document.getElementById("index_products")) {
  70. var index_products = document.getElementById("index_products");
  71. var index_products_li = index_products.getElementsByTagName("li");
  72. var index_products_h1 = index_products.getElementsByTagName("h1");
  73. var index_products_h3 = index_products.getElementsByTagName("h3");
  74. var box = document.getElementById("index_banner_shape_01");
  75. var logo = document.getElementById("index_logo");
  76. for (var i = 0; i < index_products_li.length; i++) {
  77. index_products_li[i].index = i;
  78. index_products_li[i].onmouseenter = function () {
  79. startMove(index_products_h1[this.index], {paddingTop: 20});
  80. startMove(index_products_h3[this.index], {opacity: 99});
  81. }
  82. index_products_li[i].onmouseleave = function () {
  83. startMove(index_products_h1[this.index], {paddingTop: 75});
  84. startMove(index_products_h3[this.index], {opacity: 0});
  85. }
  86. }
  87. }
  88. $("#kefu_btn").click(function () {
  89. window.open('http://crm2.qq.com/page/portalpage/wpa.php?uin=800800642&aty=1&a=0&curl=&ty=1', '_blank', 'width=760,height=430,top=0px,left=0px');
  90. })
  91. //---------------首页扫描二维码下载软件------------
  92. $("#index_android_ewm").hover(function () {
  93. $("#index_android_ewm_pic").fadeIn();
  94. }, function () {
  95. $("#index_android_ewm_pic").hide()
  96. })
  97. $("#index_ios_ewm").hover(function () {
  98. $("#index_ios_ewm_pic").fadeIn();
  99. }, function () {
  100. $("#index_ios_ewm_pic").hide();
  101. })
  102. //-----------------------TAB切换---------------------
  103. if (document.getElementById("index_tabs_list")) {
  104. var index_tab = document.getElementById("index_tabs_list");
  105. var index_tab_ul = index_tab.getElementsByTagName("ul")[0];
  106. var index_tab_li = index_tab_ul.getElementsByTagName("li");
  107. var index_tab_main = document.getElementById("index_tabs_main");
  108. var index_tab_ul = index_tab_main.getElementsByTagName("ul");
  109. for (var i = 0; i < index_tab_li.length; i++) {
  110. index_tab_li[i].index = i;
  111. index_tab_li[i].onmouseover = function () {
  112. for (var i = 0; i < index_tab_li.length; i++) {
  113. index_tab_li[i].className = "";
  114. index_tab_ul[i].style.display = "none";
  115. }
  116. this.className = "index_tabs_active";
  117. index_tab_ul[this.index].style.display = "block";
  118. }
  119. }
  120. }
  121. //运动框架-------------------------
  122. function getStyle(obj, attr) {
  123. if (obj.currentStyle) {
  124. return obj.currentStyle[attr];
  125. } else {
  126. return getComputedStyle(obj, false)[attr];
  127. }
  128. }
  129. function startMove(obj, json, fn) {
  130. clearInterval(obj.timer);
  131. obj.timer = setInterval(function () {
  132. var bStop = true;
  133. for (var attr in json) {
  134. var iCur = 0;
  135. if (attr == 'opacity') {
  136. iCur = parseInt(parseFloat(getStyle(obj, attr)) * 100);//100
  137. } else {
  138. iCur = parseInt(getStyle(obj, attr));
  139. }
  140. var iSpeed = (json[attr] - iCur) / 8;
  141. iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
  142. if (iCur != json[attr]) {
  143. bStop = false;
  144. }
  145. if (attr == 'opacity') {
  146. obj.style.filter = 'alpha(opacity:' + (iCur + iSpeed) + ')';
  147. obj.style.opacity = (iCur + iSpeed) / 100;
  148. } else {
  149. obj.style[attr] = iCur + iSpeed + 'px';
  150. }
  151. }
  152. // console.log(iSpeed)
  153. if (bStop) {
  154. clearInterval(obj.timer);
  155. if (fn) {
  156. fn();
  157. }
  158. }
  159. }, 20)
  160. }
  161. //-----------------首页数据提交-------------------
  162. function regsubmit_01(index_header_form) {
  163. var name_01_ = 'name_01',
  164. phone_01_ = 'phone_01',
  165. email_01_ = "email_01";
  166. var form = $("#" + index_header_form);
  167. var name_01 = form.find("input[name =" + name_01_ + "]");
  168. var phone_01 = form.find("input[name =" + phone_01_ + "]");
  169. var email_01 = form.find("input[name =" + email_01_ + "]");
  170. var status = 1;
  171. //检查昵称
  172. if (name_01.val() != undefined) {
  173. if (name_01.val() == "") {
  174. layer_tips("姓名不能为空", name_01);
  175. name_01.focus();
  176. status = 0;
  177. return false;
  178. }
  179. if (name_01.val().match(regexEnum.chinese) == null) {
  180. layer_tips("只能为汉字,如有疑问请咨询客服", name_01);
  181. name_01.focus();
  182. status = 0;
  183. return false;
  184. }
  185. }
  186. //console.log(phone_01.val())
  187. //检查手机号码
  188. if (phone_01.val() != undefined) {
  189. if (phone_01.val() == "") {
  190. layer_tips("手机号码不能为空", phone_01);
  191. phone_01.focus();
  192. status = 0;
  193. return false;
  194. }
  195. if (phone_01.val().match(regexEnum.mobile) == null) {
  196. layer_tips("号码格式错误,如有疑问请咨询客服", phone_01);
  197. phone_01.focus();
  198. status = 0;
  199. return false;
  200. }
  201. }
  202. //检查邮箱
  203. if (email_01.val() != undefined) {
  204. if (email_01.val() == "") {
  205. layer_tips("请输入正确的邮箱,如有疑问请咨询客服", email_01);
  206. email_01.focus();
  207. status = 0;
  208. return false;
  209. }
  210. if (email_01.val().match(regexEnum.email) == null) {
  211. layer_tips("邮箱格式错误,如有疑问请咨询客服", email_01);
  212. email_01.focus();
  213. status = 0;
  214. return false;
  215. }
  216. }
  217. //提交表单的网址------------------------------------------------
  218. if (status == 1) {
  219. var posturl = "/api/save-register";//提交表单的网址
  220. var postparam = {
  221. "name": name_01.val(),
  222. "mobile": phone_01.val(),
  223. "email": email_01.val()
  224. // "ip":returnCitySN["cip"]
  225. }
  226. $.ajax({
  227. type: "POST",
  228. data: postparam,
  229. url: posturl,
  230. async: false,
  231. dataType: "json",
  232. success: function (data) {
  233. if (data) {
  234. //清空表单
  235. if (name_01.val() != undefined) {
  236. name_01.val("");
  237. }
  238. if (phone_01.val() != undefined) {
  239. phone_01.val("");
  240. }
  241. if (email_01.val() != undefined) {
  242. email_01.val("");
  243. }
  244. layer.msg(
  245. '恭喜您!您的申请已成功提交' + "<br>" + '请保持电话畅通,稍后我们会有客服为您提供服务。',
  246. {time: 4000},
  247. function () {
  248. window.location.href = "" + window.location.pathname + "";
  249. }
  250. );
  251. } else {
  252. }
  253. }
  254. });
  255. }
  256. }
  257. function regsubmit_02(index_bottom_form) {
  258. var name_02_ = 'name_02',
  259. phone_02_ = 'phone_02',
  260. email_02_ = "email_02";
  261. var form = $("#" + index_bottom_form);
  262. var name_02 = form.find("input[name =" + name_02_ + "]");
  263. var phone_02 = form.find("input[name =" + phone_02_ + "]");
  264. var email_02 = form.find("input[name =" + email_02_ + "]");
  265. var status = 1;
  266. //检查昵称
  267. if (name_02.val() != undefined) {
  268. if (name_02.val() == "") {
  269. layer_tips("请输入您的姓名", name_02);
  270. name_02.focus();
  271. status = 0;
  272. return false;
  273. }
  274. if (name_02.val().match(regexEnum.chinese) == null) {
  275. layer_tips("只能为汉字,如有疑问请咨询客服", name_02);
  276. name.focus();
  277. status = 0;
  278. return false;
  279. }
  280. }
  281. //检查手机号码
  282. if (phone_02.val() != undefined) {
  283. if (phone_02.val() == "") {
  284. layer_tips("请输入手机号码", phone_02);
  285. phone_02.focus();
  286. status = 0;
  287. return false;
  288. }
  289. if (phone_02.val().match(regexEnum.mobile) == null) {
  290. layer_tips("手机号码格式错误,如有疑问请咨询客服", phone_02);
  291. phone_02.focus();
  292. status = 0;
  293. return false;
  294. }
  295. }
  296. //console.log("name_02.val" + "--------------" + name_02.val())
  297. //检查邮箱
  298. if (email_02.val() != undefined) {
  299. if (email_02.val() == "") {
  300. layer_tips("请输入正确的邮箱,如有疑问请咨询客服", email_02);
  301. email_02.focus();
  302. status = 0;
  303. return false;
  304. }
  305. if (email_02.val().match(regexEnum.email) == null) {
  306. layer_tips("邮箱格式错误,如有疑问请咨询客服", email_02);
  307. email_02.focus();
  308. status = 0;
  309. return false;
  310. }
  311. }
  312. if (status == 1) {
  313. var posturl = "/api/save-register";//提交表单的网址
  314. var postparam = {
  315. "name": name_02.val(),
  316. "mobile": phone_02.val(),
  317. "email": email_02.val()
  318. // "ip":returnCitySN["cip"]
  319. }
  320. $.ajax({
  321. type: "POST",
  322. data: postparam,
  323. url: posturl,
  324. async: false,
  325. dataType: "json",
  326. success: function (data) {
  327. if (data) {
  328. //清空表单
  329. if (name_02.val() != undefined) {
  330. name_02.val("");
  331. }
  332. if (phone_02.val() != undefined) {
  333. phone_02.val("");
  334. }
  335. if (email_02.val() != undefined) {
  336. email_02.val("");
  337. }
  338. layer.msg(
  339. '恭喜您!您的申请已成功提交' + "<br>" + '请保持电话畅通,稍后我们会有客服为您提供服务。',
  340. {time: 4000},
  341. function () {
  342. window.location.href = "" + window.location.pathname + "";
  343. }
  344. );
  345. } else {
  346. }
  347. }
  348. });
  349. }
  350. }
  351. //------------------客户端下载------------------
  352. $("#download_ewm_and").mouseover(function () {
  353. $("#download_ewm_android").fadeIn(1000);
  354. })
  355. $("#download_ewm_and").mouseout(function () {
  356. $("#download_ewm_android").fadeOut(1000);
  357. })
  358. $("#download_ewm_ios").mouseover(function () {
  359. $("#download_ewm_ios_pic").fadeIn(1000);
  360. })
  361. $("#download_ewm_ios").mouseout(function () {
  362. $("#download_ewm_ios_pic").fadeOut(1000);
  363. })
  364. $(".download_btn_left").mouseover(function () {
  365. $(".download_btn_left_ewm").fadeIn(1000);
  366. })
  367. $(".download_btn_left").mouseout(function () {
  368. $(".download_btn_left_ewm").fadeOut(1000);
  369. })
  370. //-----------右边的快速导航----------
  371. //sidebar
  372. $(".sidebar-box li").hover(function () {
  373. $(this).children("div").clearQueue().animate({
  374. width: "202"
  375. });
  376. }, function () {
  377. $(this).children("div").clearQueue().animate({
  378. width: "0"
  379. });
  380. });
  381. //---------------弹框---------------------
  382. var regexEnum = {
  383. email: "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", //邮件
  384. chinese: "^[\\u4E00-\\u9FA5\\uF900-\\uFA2D]+$", //仅中文
  385. mobile: "^1[3|4|5|7|8][0-9]\\d{8}$", //最新的手机号码
  386. qq: "^[1-9]*[1-9][0-9]*$", //QQ号码
  387. ps_username: "^[\\u4E00-\\u9FA5\\uF900-\\uFA2D_\\w]+$", //中文、字母、数字 _
  388. weixin: "^[a-zA-Z0-9_-]{5,19}$" //微信
  389. }
  390. //弹出新窗口
  391. function layer_openwin(url, width, height, title) {
  392. var param = "&spetitle=" + document.title;
  393. if (!width) width = "660px";
  394. if (!height) height = "600px";
  395. layer.open({
  396. type: 2,
  397. title: "&nbsp;",
  398. shadeClose: true,
  399. shade: 0.8,
  400. area: [width, height],
  401. content: url + param
  402. });
  403. }
  404. //弹出提示窗口
  405. function layer_alert(msg) {
  406. layer.alert(msg, {skin: 'layui-layer-lan'});
  407. }
  408. //消息提示窗口
  409. function layer_msg(msg) {
  410. layer.msg(msg);
  411. }
  412. //tip提示
  413. function layer_tips(msg, id) {
  414. layer.tips(msg, id, {tips: [1]});
  415. }
  416. function layer_loading() {
  417. var index = layer.load(1, {
  418. shade: [0.1, '#fff'] //0.1透明度的白色背景
  419. });
  420. }
  421. //图片弹出框
  422. function layer_popimg(id, i) {
  423. layer.open({
  424. type: 1,
  425. title: false,
  426. closeBtn: false,
  427. area: ['auto', 'auto'],
  428. skin: 'layui-layer-nobg', //没有背景色
  429. shadeClose: true,
  430. content: $('#imgViewBig_' + id + '_' + i)
  431. });
  432. }
  433. //内容层
  434. function layer_page(cnt, title, width, height) {
  435. if (!title) title = "&nbsp;";
  436. if (!width) width = "650px";
  437. if (!height) height = "600px";
  438. layer.open({
  439. type: 1,
  440. title: title,
  441. shadeClose: true,
  442. skin: 'layui-layer-rim',
  443. area: [width, height],
  444. content: "<div style='padding:10px'>" + cnt + "</div>"
  445. });
  446. }
  447. //表单验证
  448. function layer_validate(dom, text, regex) {
  449. var DOMval = $(dom).val();
  450. if (regex) { //如果正则不为空,dom存在内容,则验证。
  451. var r = DOMval.match(regex);
  452. if (r == null) {
  453. layer_tips(text, $(dom));
  454. $(dom).focus();
  455. return false;
  456. }
  457. } else {//如果不填写正则,验证是否为空
  458. if (!DOMval) {
  459. layer_tips(text, $(dom));
  460. $(dom).focus();
  461. return false;
  462. }
  463. }
  464. }
  465. //-------------------------------------
  466. //---------活动专题------------------
  467. $("#list").height($("#huodongyugao li").length * 235);
  468. $("#project_banner_tab_right").click(function () {
  469. $("#huodongyugao").css("display", "none");
  470. $("#aikehuodong").css("display", "block");
  471. $("#project_banner_tab_right").addClass("active");
  472. $("#project_banner_tab_left").removeClass("active");
  473. $("#list_02").height($("#aikehuodong li").length * 235);
  474. })
  475. $("#project_banner_tab_left").click(function () {
  476. $("#huodongyugao").css("display", "block");
  477. $("#aikehuodong").css("display", "none");
  478. $("#project_banner_tab_left").addClass("active");
  479. $("#project_banner_tab_right").removeClass("active");
  480. })
  481. //------------------账户类型------------------
  482. $("#account_banner_tab li").click(function () {
  483. var i = $(this).index();
  484. $(this).addClass("active").siblings().removeClass("active");
  485. $('#account_tab >div').eq(i).show().siblings().hide();
  486. })
  487. //------------------交易平台------------------
  488. $("#download_banner_tab li").click(function () {
  489. var i = $(this).index();
  490. $(this).addClass("active").siblings().removeClass("active");
  491. $('#download_tab >div').eq(i).show().siblings().hide();
  492. })
  493. //-----------------------------
  494. /*! layer-v1.9.0 弹层组件 License LGPL http://sentsin.com/jquery/layer/ */
  495. ;!function (a, b) {
  496. "use strict";
  497. var c, d, e = {
  498. getPath: function () {
  499. var a = document.scripts, b = a[a.length - 1].src;
  500. return b.substring(0, b.lastIndexOf("/") + 1)
  501. }(),
  502. config: {},
  503. end: {},
  504. btn: ["&#x786E;&#x5B9A;", "&#x53D6;&#x6D88;"],
  505. type: ["dialog", "page", "iframe", "loading", "tips"]
  506. };
  507. a.layer = {
  508. v: "1.9.0",
  509. ie6: !!a.ActiveXObject && !a.XMLHttpRequest,
  510. index: 0,
  511. path: e.getPath,
  512. config: function (a, b) {
  513. var d = 0;
  514. return a = a || {}, e.config = c.extend(e.config, a), layer.path = e.config.path || layer.path, "string" == typeof a.extend && (a.extend = [a.extend]), layer.use("../css/layer.css", a.extend && a.extend.length > 0 ? function f() {
  515. var c = a.extend;
  516. layer.use(c[c[d] ? d : d - 1], d < c.length ? function () {
  517. return ++d, f
  518. }() : b)
  519. }() : b), this
  520. },
  521. use: function (a, b, d) {
  522. var e = c("head")[0], a = a.replace(/\s/g, ""), f = /\.css$/.test(a),
  523. g = document.createElement(f ? "link" : "script"), h = "layui_layer_" + a.replace(/\.|\//g, "");
  524. return f && (g.rel = "stylesheet"), g[f ? "href" : "src"] = /^http:\/\//.test(a) ? a : layer.path + a, g.id = h, c("#" + h)[0] || e.appendChild(g), function i() {
  525. (f ? 1989 === parseInt(c("#" + h).css("width")) : layer[d || h]) ? function () {
  526. b && b();
  527. try {
  528. f || e.removeChild(g)
  529. } catch (a) {
  530. }
  531. }() : setTimeout(i, 100)
  532. }(), this
  533. },
  534. ready: function (a, b) {
  535. var d = "function" == typeof a;
  536. return d && (b = a), layer.config(c.extend(e.config, function () {
  537. return d ? {} : {path: a}
  538. }()), b), this
  539. },
  540. alert: function (a, b, d) {
  541. var e = "function" == typeof b;
  542. return e && (d = b), layer.open(c.extend({content: a, yes: d}, e ? {} : b))
  543. },
  544. confirm: function (a, b, d, f) {
  545. var g = "function" == typeof b;
  546. return g && (f = d, d = b), layer.open(c.extend({content: a, btn: e.btn, yes: d, cancel: f}, g ? {} : b))
  547. },
  548. msg: function (a, d, e) {
  549. var f = "function" == typeof d, h = "layui-layer-msg", i = g.anim.length - 1;
  550. return f && (e = d), layer.open(c.extend({
  551. content: a,
  552. time: 3e3,
  553. shade: !1,
  554. skin: h,
  555. title: !1,
  556. closeBtn: !1,
  557. btn: !1,
  558. end: e
  559. }, f ? {skin: h + " layui-layer-hui", shift: i} : function () {
  560. return d = d || {}, (-1 === d.icon || d.icon === b) && (d.skin = h + " " + (d.skin || "layui-layer-hui")), d
  561. }()))
  562. },
  563. load: function (a, b) {
  564. return layer.open(c.extend({type: 3, icon: a || 0, shade: .01}, b))
  565. },
  566. tips: function (a, b, d) {
  567. return layer.open(c.extend({type: 4, content: [a, b], closeBtn: !1, time: 3e3, maxWidth: 210}, d))
  568. }
  569. };
  570. var f = function (a) {
  571. var b = this;
  572. b.index = ++layer.index, b.config = c.extend({}, b.config, a, e.config), b.creat()
  573. };
  574. f.pt = f.prototype;
  575. var g = ["layui-layer", ".layui-layer-title", ".layui-layer-main", ".layui-layer-dialog", "layui-layer-iframe", "layui-layer-content", "layui-layer-btn", "layui-layer-close"];
  576. g.anim = ["layui-anim-01", "layui-anim-02", "layui-anim-03", "layui-anim-04", "layui-anim-05", "layui-anim-06", "layui-anim-07"], f.pt.config = {
  577. type: 0,
  578. shade: .3,
  579. fix: !0,
  580. move: g[1],
  581. title: "&#x4FE1;&#x606F;",
  582. offset: "auto",
  583. area: "auto",
  584. closeBtn: 1,
  585. time: 0,
  586. zIndex: 19891014,
  587. maxWidth: 360,
  588. shift: 0,
  589. icon: -1,
  590. scrollbar: !0,
  591. tips: 2
  592. }, f.pt.vessel = function (a, b) {
  593. var c = this, d = c.index, f = c.config, h = f.zIndex + d, i = "object" == typeof f.title,
  594. j = !(!f.maxmin || 1 !== f.type && 2 !== f.type || /^\d+%$/.test(f.area[0]) && /^\d+%$/.test(f.area[1])),
  595. k = f.title ? '<div class="layui-layer-title" style="' + (i ? f.title[1] : "") + '">' + (i ? f.title[0] : f.title) + "</div>" : "";
  596. return f.zIndex = h, b([f.shade ? '<div class="layui-layer-shade" id="layui-layer-shade' + d + '" times="' + d + '" style="' + ("z-index:" + (h - 1) + "; background-color:" + (f.shade[1] || "#000") + "; opacity:" + (f.shade[0] || f.shade) + "; filter:alpha(opacity=" + (100 * f.shade[0] || 100 * f.shade) + ");") + '"></div>' : "", '<div class="' + g[0] + " " + (g.anim[f.shift] || "") + (" layui-layer-" + e.type[f.type]) + (0 != f.type && 2 != f.type || f.shade ? "" : " layui-layer-border") + " " + (f.skin || "") + '" id="' + g[0] + d + '" type="' + e.type[f.type] + '" times="' + d + '" showtime="' + f.time + '" conType="' + (a ? "object" : "string") + '" style="z-index: ' + h + "; width:" + f.area[0] + ";height:" + f.area[1] + (f.fix ? "" : ";position:absolute;") + '">' + (a && 2 != f.type ? "" : k) + '<div class="layui-layer-content' + (0 == f.type && -1 !== f.icon ? " layui-layer-padding" : "") + (3 == f.type ? " xubox_loading_" + f.icon : "") + '">' + (0 == f.type && -1 !== f.icon ? '<i class="layui-layer-ico layui-layer-ico' + f.icon + '"></i>' : "") + (1 == f.type && a ? "" : f.content || "") + '</div><span class="layui-layer-setwin">' + function () {
  597. var a = j ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : "";
  598. return f.closeBtn && (a += '<a class="layui-layer-ico ' + g[7] + " " + g[7] + (f.title ? f.closeBtn : 4 == f.type ? "1" : "2") + '" href="javascript:;"></a>'), a
  599. }() + "</span>" + (f.btn ? function () {
  600. var a = "";
  601. "string" == typeof f.btn && (f.btn = [f.btn]);
  602. for (var b = 0, c = f.btn.length; c > b; b++) a += '<a class="' + g[6] + b + '">' + f.btn[b] + "</a>";
  603. return '<div class="' + g[6] + '">' + a + "</div>"
  604. }() : "") + "</div>"], k), c
  605. }, f.pt.creat = function () {
  606. var a = this, b = a.config, f = a.index, h = b.content, i = "object" == typeof h;
  607. switch ("string" == typeof b.area && (b.area = "auto" === b.area ? ["", ""] : [b.area, ""]), b.type) {
  608. case 0:
  609. b.btn = "btn" in b ? b.btn : e.btn[0], layer.close(c("div." + g[0] + "[type=dialog]").attr("times"));
  610. break;
  611. case 2:
  612. var h = b.content = i ? b.content : [b.content || "http://sentsin.com?from=layer", "auto"];
  613. b.content = '<iframe scrolling="' + (b.content[1] || "auto") + '" allowtransparency="true" id="' + g[4] + f + '" name="' + g[4] + f + '" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + b.content[0] + '"></iframe>';
  614. break;
  615. case 3:
  616. b.title = !1, b.closeBtn = !1, -1 === b.icon && 0 === b.icon, layer.closeAll("loading");
  617. break;
  618. case 4:
  619. i || (b.content = [b.content, "body"]), b.follow = b.content[1], b.content = b.content[0] + '<i class="layui-layer-TipsG"></i>', b.title = !1, b.shade = !1, b.fix = !1, b.tips = "object" == typeof b.tips ? b.tips : [b.tips, !0], b.tipsMore || layer.closeAll("tips")
  620. }
  621. a.vessel(i, function (d, e) {
  622. c("body").append(d[0]), i ? function () {
  623. 2 == b.type || 4 == b.type ? function () {
  624. c("body").append(d[1])
  625. }() : function () {
  626. h.parents("." + g[0])[0] || (h.show().addClass("layui-layer-wrap").wrap(d[1]), c("#" + g[0] + f).find("." + g[5]).before(e))
  627. }()
  628. }() : c("body").append(d[1]), a.layero = c("#" + g[0] + f), b.scrollbar || g.html.css("overflow", "hidden").attr("layer-full", f)
  629. }).auto(f), 2 == b.type && layer.ie6 && a.layero.find("iframe").attr("src", h[0]), 4 == b.type ? a.tips() : a.offset(), b.fix && d.on("resize", function () {
  630. a.offset(), (/^\d+%$/.test(b.area[0]) || /^\d+%$/.test(b.area[1])) && a.auto(f), 4 == b.type && a.tips()
  631. }), b.time <= 0 || setTimeout(function () {
  632. layer.close(a.index)
  633. }, b.time), a.move().callback()
  634. }, f.pt.auto = function (a) {
  635. function b(a) {
  636. a = h.find(a), a.height(i[1] - j - k - 2 * (0 | parseFloat(a.css("padding"))))
  637. }
  638. var e = this, f = e.config, h = c("#" + g[0] + a);
  639. "" === f.area[0] && f.maxWidth > 0 && (/MSIE 7/.test(navigator.userAgent) && f.btn && h.width(h.innerWidth()), h.outerWidth() > f.maxWidth && h.width(f.maxWidth));
  640. var i = [h.innerWidth(), h.innerHeight()], j = h.find(g[1]).outerHeight() || 0,
  641. k = h.find("." + g[6]).outerHeight() || 0;
  642. switch (f.type) {
  643. case 2:
  644. b("iframe");
  645. break;
  646. default:
  647. "" === f.area[1] ? f.fix && i[1] > d.height() && (i[1] = d.height(), b("." + g[5])) : b("." + g[5])
  648. }
  649. return e
  650. }, f.pt.offset = function () {
  651. var a = this, b = a.config, c = a.layero, e = [c.outerWidth(), c.outerHeight()],
  652. f = "object" == typeof b.offset;
  653. a.offsetTop = (d.height() - e[1]) / 2, a.offsetLeft = (d.width() - e[0]) / 2, f ? (a.offsetTop = b.offset[0], a.offsetLeft = b.offset[1]) : "auto" !== b.offset && (a.offsetTop = b.offset, "rb" === b.offset && (a.offsetTop = d.height() - e[1], a.offsetLeft = d.width() - e[0])), b.fix || (a.offsetTop += d.scrollTop(), a.offsetLeft += d.scrollLeft()), c.css({
  654. top: a.offsetTop,
  655. left: a.offsetLeft
  656. })
  657. }, f.pt.tips = function () {
  658. var a = this, b = a.config, e = a.layero, f = [e.outerWidth(), e.outerHeight()], h = c(b.follow);
  659. h[0] || (h = c("body"));
  660. var i = {width: h.outerWidth(), height: h.outerHeight(), top: h.offset().top, left: h.offset().left},
  661. j = e.find(".layui-layer-TipsG"), k = b.tips[0];
  662. b.tips[1] || j.remove(), i.autoLeft = function () {
  663. i.left + f[0] - d.width() > 0 ? (i.tipLeft = i.left + i.width - f[0], j.css({
  664. right: 12,
  665. left: "auto"
  666. })) : i.tipLeft = i.left
  667. }, i.where = [function () {
  668. i.autoLeft(), i.tipTop = i.top - f[1] - 10, j.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color", b.tips[1])
  669. }, function () {
  670. i.tipLeft = i.left + i.width + 10, i.tipTop = i.top, j.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color", b.tips[1])
  671. }, function () {
  672. i.autoLeft(), i.tipTop = i.top + i.height + 10, j.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color", b.tips[1])
  673. }, function () {
  674. i.tipLeft = i.left - f[0] - 10, i.tipTop = i.top, j.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color", b.tips[1])
  675. }], i.where[k - 1](), 1 === k ? i.top - (d.scrollTop() + f[1] + 16) < 0 && i.where[2]() : 2 === k ? d.width() - (i.left + i.width + f[0] + 16) > 0 || i.where[3]() : 3 === k ? i.top - d.scrollTop() + i.height + f[1] + 16 - d.height() > 0 && i.where[0]() : 4 === k && f[0] + 16 - i.left > 0 && i.where[1](), e.find("." + g[5]).css({
  676. "background-color": b.tips[1],
  677. "padding-right": b.closeBtn ? "30px" : ""
  678. }), e.css({left: i.tipLeft, top: i.tipTop})
  679. }, f.pt.move = function () {
  680. var a = this, b = a.config, e = {
  681. setY: 0, moveLayer: function () {
  682. var a = e.layero, b = parseInt(a.css("margin-left")), c = parseInt(e.move.css("left"));
  683. 0 === b || (c -= b), "fixed" !== a.css("position") && (c -= a.parent().offset().left, e.setY = 0), a.css({
  684. left: c,
  685. top: parseInt(e.move.css("top")) - e.setY
  686. })
  687. }
  688. }, f = a.layero.find(b.move);
  689. return b.move && f.attr("move", "ok"), f.css({cursor: b.move ? "move" : "auto"}), c(b.move).on("mousedown", function (a) {
  690. if (a.preventDefault(), "ok" === c(this).attr("move")) {
  691. e.ismove = !0, e.layero = c(this).parents("." + g[0]);
  692. var f = e.layero.offset().left, h = e.layero.offset().top, i = e.layero.width() - 6,
  693. j = e.layero.height() - 6;
  694. c("#layui-layer-moves")[0] || c("body").append('<div id="layui-layer-moves" class="layui-layer-moves" style="left:' + f + "px; top:" + h + "px; width:" + i + "px; height:" + j + 'px; z-index:2147483584"></div>'), e.move = c("#layui-layer-moves"), b.moveType && e.move.css({visibility: "hidden"}), e.moveX = a.pageX - e.move.position().left, e.moveY = a.pageY - e.move.position().top, "fixed" !== e.layero.css("position") || (e.setY = d.scrollTop())
  695. }
  696. }), c(document).mousemove(function (a) {
  697. if (e.ismove) {
  698. var c = a.pageX - e.moveX, f = a.pageY - e.moveY;
  699. if (a.preventDefault(), !b.moveOut) {
  700. e.setY = d.scrollTop();
  701. var g = d.width() - e.move.outerWidth(), h = e.setY;
  702. 0 > c && (c = 0), c > g && (c = g), h > f && (f = h), f > d.height() - e.move.outerHeight() + e.setY && (f = d.height() - e.move.outerHeight() + e.setY)
  703. }
  704. e.move.css({left: c, top: f}), b.moveType && e.moveLayer(), c = f = g = h = null
  705. }
  706. }).mouseup(function () {
  707. try {
  708. e.ismove && (e.moveLayer(), e.move.remove()), e.ismove = !1
  709. } catch (a) {
  710. e.ismove = !1
  711. }
  712. b.moveEnd && b.moveEnd()
  713. }), a
  714. }, f.pt.callback = function () {
  715. var a = this, b = a.layero, d = a.config;
  716. a.openLayer(), d.success && (2 == d.type ? b.find("iframe")[0].onload = function () {
  717. this.className = "", d.success(b, a.index)
  718. } : d.success(b, a.index)), layer.ie6 && a.IE6(b), b.find("." + g[6] + "0").on("click", function () {
  719. d.yes ? d.yes(a.index) : layer.close(a.index)
  720. }), b.find("." + g[7] + ",." + g[6] + "1").on("click", function () {
  721. d.cancel && d.cancel(a.index), layer.close(a.index)
  722. }), d.shadeClose && c("#layui-layer-shade" + a.index).on("click", function () {
  723. layer.close(a.index)
  724. }), b.find(".layui-layer-min").on("click", function () {
  725. layer.min(a.index, d), d.min && d.min(b)
  726. }), b.find(".layui-layer-max").on("click", function () {
  727. c(this).hasClass("layui-layer-maxmin") ? (layer.restore(a.index), d.restore && d.restore(b)) : (layer.full(a.index, d), d.full && d.full(b))
  728. }), d.end && (e.end[a.index] = d.end)
  729. }, e.reselect = function () {
  730. c.each(c("select"), function () {
  731. var a = c(this);
  732. a.parents("." + g[0])[0] || 1 == a.attr("layer") && c("." + g[0]).length < 1 && a.removeAttr("layer").show(), a = null
  733. })
  734. }, f.pt.IE6 = function (a) {
  735. function b() {
  736. a.css({top: f + (e.config.fix ? d.scrollTop() : 0)})
  737. }
  738. var e = this, f = a.offset().top;
  739. b(), d.scroll(b), c("select").each(function () {
  740. var a = c(this);
  741. a.parents("." + g[0])[0] || "none" === a.css("display") || a.attr({layer: "1"}).hide(), a = null
  742. })
  743. }, f.pt.openLayer = function () {
  744. var a = this;
  745. layer.zIndex = a.config.zIndex, layer.setTop = function (a) {
  746. var b = function () {
  747. layer.zIndex++, a.css("z-index", layer.zIndex + 1)
  748. };
  749. return layer.zIndex = parseInt(a[0].style.zIndex), a.on("mousedown", b), layer.zIndex
  750. }
  751. }, e.record = function (a) {
  752. var b = [a.outerWidth(), a.outerHeight(), a.position().top, a.position().left + parseFloat(a.css("margin-left"))];
  753. a.find(".layui-layer-max").addClass("layui-layer-maxmin"), a.attr({area: b})
  754. }, e.rescollbar = function (a) {
  755. g.html.attr("layer-full") == a && (g.html[0].style.removeProperty ? g.html[0].style.removeProperty("overflow") : g.html[0].style.removeAttribute("overflow"), g.html.removeAttr("layer-full"))
  756. }, layer.getChildFrame = function (a, b) {
  757. return b = b || c("." + g[4]).attr("times"), c("#" + g[0] + b).find("iframe").contents().find(a)
  758. }, layer.getFrameIndex = function (a) {
  759. return c("#" + a).parents("." + g[4]).attr("times")
  760. }, layer.iframeAuto = function (a) {
  761. if (a) {
  762. var b = layer.getChildFrame("body", a).outerHeight(), d = c("#" + g[0] + a),
  763. e = d.find(g[1]).outerHeight() || 0, f = d.find("." + g[6]).outerHeight() || 0;
  764. d.css({height: b + e + f}), d.find("iframe").css({height: b})
  765. }
  766. }, layer.iframeSrc = function (a, b) {
  767. c("#" + g[0] + a).find("iframe").attr("src", b)
  768. }, layer.style = function (a, b) {
  769. var d = c("#" + g[0] + a), f = d.attr("type"), h = d.find(g[1]).outerHeight() || 0,
  770. i = d.find("." + g[6]).outerHeight() || 0;
  771. (f === e.type[1] || f === e.type[2]) && (d.css(b), f === e.type[2] && d.find("iframe").css({height: parseFloat(b.height) - h - i}))
  772. }, layer.min = function (a) {
  773. var b = c("#" + g[0] + a), d = b.find(g[1]).outerHeight() || 0;
  774. e.record(b), layer.style(a, {
  775. width: 180,
  776. height: d
  777. }), b.find(".layui-layer-min").hide(), "page" === b.attr("type") && b.find(g[4]).hide(), e.rescollbar(a)
  778. }, layer.restore = function (a) {
  779. {
  780. var b = c("#" + g[0] + a), d = b.attr("area").split(",");
  781. b.attr("type")
  782. }
  783. layer.style(a, {
  784. width: parseFloat(d[0]),
  785. height: parseFloat(d[1]),
  786. top: parseFloat(d[2]),
  787. left: parseFloat(d[3])
  788. }), b.find(".layui-layer-max").removeClass("layui-layer-maxmin"), b.find(".layui-layer-min").show(), "page" === b.attr("type") && b.find(g[4]).show(), e.rescollbar(a)
  789. }, layer.full = function (a) {
  790. var b, f = c("#" + g[0] + a);
  791. e.record(f), g.html.attr("layer-full") || g.html.css("overflow", "hidden").attr("layer-full", a), clearTimeout(b), b = setTimeout(function () {
  792. var b = "fixed" === f.css("position");
  793. layer.style(a, {
  794. top: b ? 0 : d.scrollTop(),
  795. left: b ? 0 : d.scrollLeft(),
  796. width: d.width(),
  797. height: d.height()
  798. }), f.find(".layui-layer-min").hide()
  799. }, 100)
  800. }, layer.title = function (a, b) {
  801. var d = c("#" + g[0] + (b || layer.index)).find(g[1]);
  802. d.html(a)
  803. }, layer.close = function (a) {
  804. var b = c("#" + g[0] + a), d = b.attr("type");
  805. if (b[0]) {
  806. if (d === e.type[1] && "object" === b.attr("conType")) {
  807. b.children(":not(." + g[5] + ")").remove();
  808. for (var f = 0; 2 > f; f++) b.find(".layui-layer-wrap").unwrap().hide()
  809. } else {
  810. if (d === e.type[2]) try {
  811. var h = c("#" + g[4] + a)[0];
  812. h.contentWindow.document.write(""), h.contentWindow.close(), b.find("." + g[5])[0].removeChild(h)
  813. } catch (i) {
  814. }
  815. b[0].innerHTML = "", b.remove()
  816. }
  817. c("#layui-layer-moves, #layui-layer-shade" + a).remove(), layer.ie6 && e.reselect(), e.rescollbar(a), "function" == typeof e.end[a] && e.end[a](), delete e.end[a]
  818. }
  819. }, layer.closeAll = function (a) {
  820. c.each(c("." + g[0]), function () {
  821. var b = c(this), d = a ? b.attr("type") === a : 1;
  822. d && layer.close(b.attr("times")), d = null
  823. })
  824. }, e.run = function () {
  825. c = jQuery, d = c(a), g.html = c("html"), layer.open = function (a) {
  826. var b = new f(a);
  827. return b.index
  828. }
  829. }, "function" == typeof define ? define(function () {
  830. return e.run(), layer
  831. }) : function () {
  832. e.run(), layer.use("../css/layer.css")
  833. }()
  834. }(window);
  835. /*! http://mths.be/placeholder v2.0.7 by @mathias */
  836. ;(function (f, h, $) {
  837. var a = 'placeholder' in h.createElement('input'), d = 'placeholder' in h.createElement('textarea'), i = $.fn,
  838. c = $.valHooks, k, j;
  839. if (a && d) {
  840. j = i.placeholder = function () {
  841. return this
  842. };
  843. j.input = j.textarea = true
  844. } else {
  845. j = i.placeholder = function () {
  846. var l = this;
  847. l.filter((a ? 'textarea' : ':input') + '[placeholder]').not('.placeholder').bind({
  848. 'focus.placeholder': b,
  849. 'blur.placeholder': e
  850. }).data('placeholder-enabled', true).trigger('blur.placeholder');
  851. return l
  852. };
  853. j.input = a;
  854. j.textarea = d;
  855. k = {
  856. get: function (m) {
  857. var l = $(m);
  858. return l.data('placeholder-enabled') && l.hasClass('placeholder') ? '' : m.value
  859. }, set: function (m, n) {
  860. var l = $(m);
  861. if (!l.data('placeholder-enabled')) {
  862. return m.value = n
  863. }
  864. if (n == '') {
  865. m.value = n;
  866. if (m != h.activeElement) {
  867. e.call(m)
  868. }
  869. } else {
  870. if (l.hasClass('placeholder')) {
  871. b.call(m, true, n) || (m.value = n)
  872. } else {
  873. m.value = n
  874. }
  875. }
  876. return l
  877. }
  878. };
  879. a || (c.input = k);
  880. d || (c.textarea = k);
  881. $(function () {
  882. $(h).delegate('form', 'submit.placeholder', function () {
  883. var l = $('.placeholder', this).each(b);
  884. setTimeout(function () {
  885. l.each(e)
  886. }, 10)
  887. })
  888. });
  889. $(f).bind('beforeunload.placeholder', function () {
  890. $('.placeholder').each(function () {
  891. this.value = ''
  892. })
  893. })
  894. }
  895. function g(m) {
  896. var l = {}, n = /^jQuery\d+$/;
  897. $.each(m.attributes, function (p, o) {
  898. if (o.specified && !n.test(o.name)) {
  899. l[o.name] = o.value
  900. }
  901. });
  902. return l
  903. }
  904. function b(m, n) {
  905. var l = this, o = $(l);
  906. if (l.value == o.attr('placeholder') && o.hasClass('placeholder')) {
  907. if (o.data('placeholder-password')) {
  908. o = o.hide().next().show().attr('id', o.removeAttr('id').data('placeholder-id'));
  909. if (m === true) {
  910. return o[0].value = n
  911. }
  912. o.focus()
  913. } else {
  914. l.value = '';
  915. o.removeClass('placeholder');
  916. l == h.activeElement && l.select()
  917. }
  918. }
  919. }
  920. function e() {
  921. var q, l = this, p = $(l), m = p, o = this.id;
  922. if (l.value == '') {
  923. if (l.type == 'password') {
  924. if (!p.data('placeholder-textinput')) {
  925. try {
  926. q = p.clone().attr({type: 'text'})
  927. } catch (n) {
  928. q = $('<input>').attr($.extend(g(this), {type: 'text'}))
  929. }
  930. q.removeAttr('name').data({
  931. 'placeholder-password': true,
  932. 'placeholder-id': o
  933. }).bind('focus.placeholder', b);
  934. p.data({'placeholder-textinput': q, 'placeholder-id': o}).before(q)
  935. }
  936. p = p.removeAttr('id').hide().prev().attr('id', o).show()
  937. }
  938. p.addClass('placeholder');
  939. p[0].value = p.attr('placeholder')
  940. } else {
  941. p.removeClass('placeholder')
  942. }
  943. }
  944. }(this, document, jQuery));