common.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. var mobile = {};
  2. var dictMap = {};
  3. var paramMap = {};
  4. var user={};
  5. var company="";
  6. var shareUser="";
  7. $(function() {
  8. pushHistory();
  9. });
  10. function pushHistory() {
  11. window.addEventListener("popstate", function(e) {
  12. self.location.reload();
  13. }, false);
  14. var state = {
  15. title : "",
  16. url : "#"
  17. };
  18. window.history.replaceState(state, "", "#");
  19. };
  20. (function() {
  21. if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
  22. handleFontSize();
  23. } else {
  24. if (document.addEventListener) {
  25. document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
  26. } else if (document.attachEvent) {
  27. //IE浏览器,非W3C规范
  28. document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
  29. }
  30. }
  31. function handleFontSize() {
  32. // 设置网页字体为默认大小
  33. WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize' : 0 });
  34. // 重写设置网页字体大小的事件
  35. WeixinJSBridge.on('menu:setfont', function() {
  36. WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize' : 0 });
  37. });
  38. }
  39. })();
  40. $(document).ready(function () {
  41. if(window.history.length<2){
  42. //$(".mui-action-back").hide();
  43. }
  44. addLog();
  45. getTicket();
  46. $(".home-btn").on("tap",function(){
  47. location.href=base+"/mobile/index.jsp";
  48. });
  49. });
  50. function addLog(){
  51. if(mobile.getUrlVars("company")){
  52. company = mobile.getUrlVars("company");
  53. sessionStorage.setItem("company",mobile.getUrlVars("company"));
  54. }else if(sessionStorage.getItem("company")){
  55. company = sessionStorage.getItem("company");
  56. }
  57. if(mobile.getUrlVars("shareUser")){
  58. shareUser = mobile.getUrlVars("shareUser");
  59. sessionStorage.setItem("shareUser",mobile.getUrlVars("shareUser"));
  60. }else if(sessionStorage.getItem("shareUser")){
  61. shareUser = sessionStorage.getItem("shareUser");
  62. }
  63. var url = location.href.replace('#','');
  64. if (user){
  65. if(url.indexOf("?")!=-1){
  66. if(url.indexOf("shareUser")!=-1){
  67. url = mobile.changeUrlParam(url,"shareUser",user.openid);
  68. }else{
  69. url+="&shareUser="+user.openid;
  70. }
  71. }else{
  72. url+="?shareUser="+user.openid;
  73. }
  74. }
  75. if(company){
  76. if(url.indexOf("?")!=-1){
  77. url+="&company="+company;
  78. }else{
  79. url+="?company="+company;
  80. }
  81. }
  82. share.link = url;
  83. var page = window.location.pathname;
  84. var id = mobile.getUrlVars("id");
  85. mobile.ajaxPost(base+"/userViewLog/save",{id:id,page:page,company:company,shareUser:shareUser},function(json){},"");
  86. }
  87. //获取微信js参数
  88. function getTicket(){
  89. mobile.ajaxPost(base+"/wechat/getTicket",{url:location.href.replace('#','')},function(data){
  90. wx.config({
  91. debug: false,
  92. appId:data.appId,
  93. timestamp: data.timestamp,
  94. nonceStr: data.nonceStr,
  95. signature: data.signature,
  96. jsApiList: [
  97. 'onMenuShareTimeline',
  98. 'onMenuShareAppMessage',
  99. 'getLocation',
  100. 'openLocation'
  101. ]
  102. });
  103. },"");
  104. }
  105. //分享
  106. wx.ready(function(){
  107. wx.onMenuShareTimeline({
  108. title: share.title, // 分享标题
  109. link: share.link, // 分享链接
  110. imgUrl: share.imgUrl, // 分享图标
  111. success: function () {
  112. if(typeof share.callback=='function'){
  113. share.callback('1');
  114. }
  115. saveShareLog("10");
  116. },
  117. cancel: function () {
  118. alert('取消分享');
  119. }
  120. });
  121. wx.onMenuShareAppMessage({
  122. title: share.title, // 分享标题
  123. desc: share.desc, // 分享描述
  124. link: share.link, // 分享链接
  125. imgUrl: share.imgUrl, // 分享图标
  126. type: 'link', // 分享类型,music、video或link,不填默认为link
  127. success: function () {
  128. if(typeof share.callback=='function'){
  129. share.callback('2');
  130. }
  131. saveShareLog("20");
  132. },
  133. cancel: function () {
  134. alert('取消分享');
  135. }
  136. });
  137. });
  138. function saveShareLog(type) {
  139. var page = window.location.pathname;
  140. var id = mobile.getUrlVars("id");
  141. mobile.ajaxPost(base+"/userShareLog/save",{id:id,page:page,type:type},function(json){},"");
  142. }
  143. /**
  144. * 获取购物车数量
  145. */
  146. mobile.getCartNum = function () {
  147. mobile.ajaxPost(base+'/userCart/getNum',{},function(json){
  148. if(json.data!=0){
  149. $('.mui-bar-tab .icon-gouwuche .mui-badge').html(json.data);
  150. $('.mui-bar-tab .icon-gouwuche .mui-badge').removeClass('mui-hidden');
  151. }else{
  152. $('.mui-bar-tab .icon-gouwuche .mui-badge').addClass('mui-hidden');
  153. }
  154. });
  155. };
  156. /**
  157. * flag 当子窗口取不到是否不取父窗口的值,默认取父窗口
  158. */
  159. mobile.getUrlVars = function (name, flag) {
  160. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  161. var r = window.location.search.substr(1).match(reg);
  162. //modify by zhengwei
  163. if (flag) {
  164. if (r == null) {
  165. r = window.parent.location.search.substr(1).match(reg);
  166. }
  167. }
  168. if (r != null) return decodeURI(r[2]);
  169. return null;
  170. };
  171. /**
  172. * form赋值
  173. */
  174. mobile.toForm = function (data) {
  175. if(data){
  176. $.each(data,function(key,value){
  177. if($('#'+key)){
  178. $('#'+key).val(mobile.nullToSpace(value));
  179. }
  180. });
  181. }
  182. }
  183. //把null转为空
  184. mobile.nullToSpace = function (param) {
  185. if (param == null || typeof param == 'undefined') {
  186. param = '';
  187. }
  188. return param;
  189. }
  190. //把null转为0
  191. mobile.nullToZore = function (param) {
  192. if (param == null || typeof param == 'undefined') {
  193. param = 0;
  194. }
  195. return param;
  196. }
  197. /**
  198. * 增加天数
  199. */
  200. mobile.addDate = function(date,days){
  201. var a = new Date(date)
  202. a = a.valueOf();
  203. a = a + days * 24 * 60 * 60 * 1000
  204. a = new Date(a)
  205. return a;
  206. }
  207. /**
  208. * 获取星期
  209. */
  210. mobile.getWeek = function(date){
  211. var str = "星期";
  212. var week = date.getDay();
  213. switch (week) {
  214. case 0 :
  215. str += "日";
  216. break;
  217. case 1 :
  218. str += "一";
  219. break;
  220. case 2 :
  221. str += "二";
  222. break;
  223. case 3 :
  224. str += "三";
  225. break;
  226. case 4 :
  227. str += "四";
  228. break;
  229. case 5 :
  230. str += "五";
  231. break;
  232. case 6 :
  233. str += "六";
  234. break;
  235. }
  236. return str;
  237. }
  238. /**
  239. * 检查手机号码
  240. */
  241. mobile.checkMobile = function (phone){
  242. var reg= /(^1[3|4|5|7|8|9][0-9]{9}$)/;
  243. return reg.test(phone);
  244. }
  245. //ajax post
  246. mobile.ajaxPost = function (url, params, callback,msg) {
  247. var index=null;
  248. $.ajax({
  249. type:"POST",
  250. url:url,
  251. data:params,
  252. dataType:"json",
  253. timeout:60000,
  254. beforeSend:function(){
  255. if(msg!=""){
  256. if(msg){
  257. index=layer.open({type: 3,shadeClose:false,content: msg});
  258. }else{
  259. index=layer.open({type: 3,shadeClose:false,content: '加载中...'});
  260. }
  261. }
  262. },
  263. success:function(data){
  264. if(msg!=""){
  265. layer.close(index);
  266. }
  267. if(typeof callback=='function'){
  268. callback(data);
  269. }
  270. },
  271. error:function(XMLHttpRequest, textStatus, errorThrown){
  272. if(msg!=""){
  273. layer.close(index);
  274. }
  275. switch (XMLHttpRequest.status){
  276. case(500):
  277. layer.open({content: "服务异常",time: 3});
  278. break;
  279. case(408):
  280. layer.open({content: "请求超时",time: 3});
  281. break;
  282. case(0):
  283. layer.open({content: "网络连接异常",time: 3});
  284. break;
  285. default:
  286. layer.open({content: "请求错误,请稍后再试",time: 3});
  287. }
  288. },
  289. complete: function (XHR, TS) { XHR = null; }
  290. });
  291. };
  292. //保留两位小数
  293. mobile.toDecimal = function (x) {
  294. var f = parseFloat(x);
  295. if (isNaN(f)) {
  296. return;
  297. }
  298. f = Math.round(x * 100) / 100;
  299. return f;
  300. }
  301. mobile.getWeekDay = function (){
  302. var str = "";
  303. var week = new Date().getDay();
  304. if (week == 0) {
  305. str = "星期日";
  306. } else if (week == 1) {
  307. str = "星期一";
  308. } else if (week == 2) {
  309. str = "星期二";
  310. } else if (week == 3) {
  311. str = "星期三";
  312. } else if (week == 4) {
  313. str = "星期四";
  314. } else if (week == 5) {
  315. str = "星期五";
  316. } else if (week == 6) {
  317. str = "星期六";
  318. }
  319. return str;
  320. }
  321. //日期格式化
  322. Date.prototype.format = function (fmt) {
  323. var o = {
  324. "M+": this.getMonth() + 1, //月份
  325. "d+": this.getDate(), //日
  326. "h+": this.getHours(), //小时
  327. "m+": this.getMinutes(), //分
  328. "s+": this.getSeconds(), //秒
  329. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  330. "S": this.getMilliseconds() //毫秒
  331. };
  332. if (/(y+)/.test(fmt))
  333. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  334. for (var k in o)
  335. if (new RegExp("(" + k + ")").test(fmt))
  336. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  337. return fmt;
  338. }
  339. //数组移除
  340. Array.prototype.removeAt = function (Index) {
  341. if (isNaN(Index) || Index > this.length) {
  342. return false;
  343. }
  344. for (var i = 0, n = 0; i < this.length; i++) {
  345. if (this[i] != this[Index]) {
  346. this[n++] = this[i]
  347. }
  348. }
  349. this.length -= 1
  350. }
  351. //数组是否包含某项
  352. Array.prototype.contains = function (needle) {
  353. for (i in this) {
  354. if (this[i] == needle)
  355. return true;
  356. }
  357. return false;
  358. }
  359. /**
  360. * 根据字典类型获取items
  361. * @param d_key
  362. * @returns
  363. */
  364. mobile.getDictMap = function (d_key) {
  365. if (dictMap[d_key]) {
  366. return dictMap[d_key];
  367. }
  368. };
  369. /**
  370. * 根据系统参数
  371. * @param code
  372. * @returns
  373. */
  374. mobile.getParam = function (code) {
  375. if (paramMap[code]) {
  376. return paramMap[code];
  377. } else {
  378. return "";
  379. }
  380. };
  381. /**
  382. * 根据代码和字典类型获取下拉选项的名称item{value:'1',label:'测试'}
  383. * @param d_key
  384. * @param code
  385. * @returns
  386. */
  387. mobile.getDictVal = function (key, code) {
  388. var items = dictMap[key];
  389. if (items && items.length > 0) {
  390. for (var i = 0; i < items.length; i++) {
  391. var item = items[i];
  392. if (item.dict_code == code) {
  393. return item.dict_name;
  394. break;
  395. }
  396. }
  397. }
  398. return "";
  399. }
  400. mobile.fileUploader = function(filePicker,callback,params){
  401. //添加删除事件结束
  402. var imgUploadUrl = base+'/common/upload';
  403. if(typeof params!='undefined'){
  404. imgUploadUrl = imgUploadUrl+"?"+params;
  405. }
  406. var opt={
  407. auto: true,
  408. // swf文件路径
  409. swf: base+'/static/frame/webuploader/Uploader.swf',
  410. // 文件接收服务端。
  411. server : imgUploadUrl,
  412. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  413. pick : {
  414. id : '#'+filePicker,
  415. multiple : false
  416. },
  417. //fileSingleSizeLimit: 5*1024*1024, //最大5M
  418. // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
  419. resize : false,
  420. multiple : false,
  421. duplicate :true
  422. };
  423. if(typeof options!='undefined'){
  424. opt = $.extend(opt,options);
  425. }
  426. var uploader = WebUploader.create(opt);
  427. // 文件上传过程中提示。
  428. uploader.on( 'uploadProgress', function( file, percentage ) {
  429. //layer.msg
  430. });
  431. uploader.on( 'uploadError', function( file ) {
  432. layer.msg("上传失败");
  433. uploader.reset();
  434. });
  435. uploader.onError = function( code ) {
  436. switch(code){
  437. case 'F_EXCEED_SIZE':
  438. layer.msg('文件大小超出最大值');
  439. break;
  440. case 'Q_EXCEED_NUM_LIMIT':
  441. layer.msg('超过最大上传数量');
  442. break;
  443. case 'Q_EXCEED_SIZE_LIMIT':
  444. layer.msg('文件大小超出最大值');
  445. break;
  446. case 'Q_TYPE_DENIED':
  447. layer.msg('文件类型不允许');
  448. break;
  449. default:
  450. layer.msg('未知错误:'+code);
  451. break;
  452. }
  453. };
  454. //如果服务器端返回的code不为0,那么也是没有成功,会触发uploadError事件
  455. uploader.on("uploadAccept", function(file,data){
  456. if(!data.success){
  457. return false;
  458. }
  459. });
  460. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  461. uploader.on( 'uploadSuccess', function(file,data) {
  462. if(typeof callback=='function'){
  463. callback(data);
  464. }
  465. uploader.reset();
  466. });
  467. // 完成上传完了,成功或者失败,先删除进度条。
  468. uploader.on( 'uploadComplete', function(file,data) {
  469. });
  470. }
  471. /**
  472. * 加载图片
  473. * @param fileList 容器ID
  474. * @param data 数组类型或者字符串
  475. * @param width 图片宽度
  476. * @param height 图片高度
  477. */
  478. mobile.loadImage = function(fileList,data,width,height,editFlag){
  479. if(!width){//如果没有设置,默认为100px
  480. width=100;
  481. }
  482. if(!height){
  483. height=100;
  484. }
  485. var $list = $('#'+fileList);
  486. var arr=[];
  487. if(typeof(data) == "string"){
  488. var $li = $(
  489. '<div class="file-item thumbnail">' +
  490. '<img src="'+data+'" style="width:'+width+'px;height:'+height+'px;">' +
  491. '</div>'
  492. );
  493. if(editFlag){
  494. var $btns = $('<div class="file-panel" style="height:0px;">' +
  495. '<span class="cancel">删除</span>' +
  496. '</div>').appendTo( $li );
  497. }
  498. if(data.indexOf("flag=true")==-1){
  499. data +="&flag=true";
  500. }
  501. arr.push(data);
  502. $list.append( $li );
  503. }else{
  504. $.each(data,function(id,item){
  505. if(typeof(item) == "string"){
  506. var $li = $(
  507. '<div class="file-item thumbnail">' +
  508. '<img src="'+item+'" style="width:'+width+'px;height:'+height+'px;">' +
  509. '</div>'
  510. );
  511. if(item.indexOf("flag=true")==-1){
  512. item +="&flag=true";
  513. }
  514. arr.push(item);
  515. }else{
  516. var $li = $(
  517. '<div class="file-item thumbnail">' +
  518. '<img src="'+item.imgUrl+'" style="width:'+width+'px;height:'+height+'px;">' +
  519. '<div class="info">"'+item.imgName+'"</div>' +
  520. '</div>'
  521. );
  522. if(item.imgUrl.indexOf("flag=true")==-1){
  523. item.imgUrl +="&flag=true";
  524. }
  525. arr.push(item.imgUrl);
  526. }
  527. if(editFlag){
  528. var $btns = $('<div class="file-panel" style="height:0px;">' +
  529. '<span class="cancel">删除</span>' +
  530. '</div>').appendTo( $li );
  531. }
  532. $list.append( $li );
  533. });
  534. }
  535. $list.find("img").on('click',function(){
  536. web.showImage(arr,$(this).parent().index());
  537. });
  538. }
  539. /**
  540. * 上传图片
  541. * @param fileList 容器ID
  542. * @param filePicker 上传按钮ID
  543. * @param callback 返回方法
  544. * @param options 自定义上传
  545. * @param params 参数
  546. */
  547. mobile.imageUploader = function(fileList,filePicker,callback,options,params){
  548. $('#'+fileList).on('mouseover','.file-item',function(){
  549. $(this).find('.file-panel').css('height','30px');
  550. });
  551. $('#'+fileList).on('mouseout','.file-item',function(){
  552. $(this).find('.file-panel').css('height','0');
  553. });
  554. $('#'+fileList).on('click','.cancel',function(){
  555. $(this).parents('.file-item').remove();
  556. });
  557. //添加删除事件结束
  558. var imgUploadUrl = base+'/common/upload';
  559. if(typeof params!='undefined'){
  560. imgUploadUrl = imgUploadUrl+"?"+params;
  561. }
  562. var opt={
  563. auto: true,
  564. // swf文件路径
  565. swf: base+'/static/frame/webuploader/Uploader.swf',
  566. // 文件接收服务端。
  567. server : imgUploadUrl,
  568. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  569. pick : {
  570. id : '#'+filePicker,
  571. multiple : true
  572. },
  573. fileSingleSizeLimit: 5*1024*1024, //最大5M
  574. // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
  575. resize : false,
  576. duplicate :true,
  577. fileNumLimit:10,
  578. accept : {
  579. title : 'Images',
  580. extensions : 'jpg,jpeg,png',
  581. mimeTypes : 'image/jpg,image/jpeg,image/png'
  582. }
  583. };
  584. if(typeof options!='undefined'){
  585. opt = $.extend(opt,options);
  586. }
  587. if(!opt.thumbnailWidth){//如果没有设置,默认为100px
  588. opt.thumbnailWidth=100;
  589. }
  590. if(!opt.thumbnailHeight){
  591. opt.thumbnailHeight=100;
  592. }
  593. var $list = $('#'+fileList);
  594. var uploader = WebUploader.create(opt);
  595. uploader.on( 'fileQueued', function( file ) {
  596. if($list.find('.image-item').length>=opt.maxLength){
  597. layer.open({content:'最多上传'+opt.maxLength+'张图片',time:3});
  598. uploader.cancelFile( file );
  599. return;
  600. }
  601. var $li = $(
  602. '<div class="image-item">'+
  603. '<div class="image-close">X</div>'+
  604. '</div>'
  605. );
  606. $list.append( $li );
  607. // 创建缩略图
  608. // 如果为非图片文件,可以不用调用此方法。
  609. // thumbnailWidth x thumbnailHeight 为 100 x 100
  610. uploader.makeThumb( file, function( error, src ) {
  611. if ( error ) {
  612. $img.replaceWith('<span>不能预览</span>');
  613. return;
  614. }
  615. $li.css("background-image","url("+src+")");
  616. }, opt.thumbnailWidth, opt.thumbnailHeight);
  617. });
  618. // 文件上传过程中创建进度条实时显示。
  619. uploader.on( 'uploadProgress', function( file, percentage ) {
  620. var $li = $( '#'+file.id );
  621. var $percent = $li.find('.progress span');
  622. // 避免重复创建
  623. if ( !$percent.length ) {
  624. $percent = $('<p class="progress"><span></span></p>')
  625. .appendTo( $li )
  626. .find('span');
  627. }
  628. $percent.css( 'width', percentage * 100 + '%' );
  629. });
  630. uploader.on( 'uploadError', function( file ,reason) {
  631. var $li = $( '#'+file.id );
  632. var $error = $li.find('div.error');
  633. // 避免重复创建
  634. if ( !$error.length ) {
  635. $error = $('<div class="error"></div>').appendTo( $li );
  636. }
  637. $error.text('上传失败');
  638. });
  639. uploader.onError = function( code ) {
  640. switch(code){
  641. case 'F_EXCEED_SIZE':
  642. layer.msg('文件大小超出最大值');
  643. break;
  644. case 'Q_EXCEED_NUM_LIMIT':
  645. layer.msg('超过最大上传数量');
  646. break;
  647. case 'Q_EXCEED_SIZE_LIMIT':
  648. layer.msg('文件大小超出最大值');
  649. break;
  650. case 'Q_TYPE_DENIED':
  651. layer.msg('文件类型不允许');
  652. break;
  653. default:
  654. layer.msg('未知错误:'+code);
  655. break;
  656. }
  657. };
  658. //如果服务器端返回的code不为0,那么也是没有成功,会触发uploadError事件
  659. uploader.on("uploadAccept", function(file,data){
  660. if(!data.success){
  661. return false;
  662. }
  663. });
  664. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  665. uploader.on( 'uploadSuccess', function(file,data) {
  666. if(typeof callback=='function'){
  667. callback(data);
  668. }
  669. });
  670. // 完成上传完了,成功或者失败,先删除进度条。
  671. uploader.on( 'uploadComplete', function(file,data) {
  672. $( '#'+file.id ).find('.progress').remove();
  673. });
  674. }
  675. /**
  676. * 上传图片
  677. * @param fileList 容器ID
  678. * @param filePicker 上传按钮ID
  679. * @param callback 返回方法
  680. * @param options 自定义上传
  681. * @param params 参数
  682. */
  683. mobile.tip=function(obj,msg,icon,top){
  684. if(!top){
  685. top="50%"
  686. }
  687. if(!icon){
  688. icon="icon-zanwushuju"
  689. }
  690. $(""+obj+"").append('<div class="center" style="top:'+top+'">'+
  691. '<div class="mui-icon iconfont '+icon+' fs44 mb10"></div><div class="fs14">'+msg+'</div></div>');
  692. }
  693. mobile.changeUrlParam=function (url, param, val){
  694. var pattern = param+'=([^&]*)';
  695. var replaceText = param+'='+val;
  696. return url.match(pattern) ? url.replace(eval('/('+ param+'=)([^&]*)/gi'), replaceText) : (url.match('[\?]') ? url+'&'+replaceText : url+'?'+replaceText);
  697. }