com.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. function systemmsg(msg, fn){
  2. var msgbox = $("#systemmsg_box");
  3. msg && msg.length>0 && $('#systemmsg_text').html(msg);
  4. $('#systemmsg_btn').bind('click', function(){
  5. msgbox.hide();
  6. fn && fn();
  7. });
  8. msgbox.show();
  9. }
  10. //手机测试
  11. function isMobile(str) {
  12. return /^1[3-9]{1}[0-9]{9}$/.test(str);
  13. }
  14. //邮箱测试
  15. function isEmail(str){
  16. var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
  17. if(reg.test(str)){
  18. return true;
  19. }
  20. return false;
  21. }
  22. //车牌测试
  23. function isLicenseNo(str) {
  24. return /(^[\u4E00-\u9FA5]{1}[A-Z0-9]{6}$)|(^[A-Z]{2}[A-Z0-9]{2}[A-Z0-9\u4E00-\u9FA5]{1}[A-Z0-9]{4}$)|(^[\u4E00-\u9FA5]{1}[A-Z0-9]{5}[挂学警军港澳]{1}$)|(^[A-Z]{2}[0-9]{5}$)|(^(08|38){1}[A-Z0-9]{4}[A-Z0-9挂学警军港澳]{1}$)/i.test(str);
  25. }
  26. var dataForWeixin = {
  27. appid: 'wx13b7a88076a07cba', //平安财富帮APPID
  28. img_url: '',
  29. img_width: '100',
  30. img_height: '100',
  31. link: '',
  32. title: '',
  33. desc: '',
  34. callback:function(){}
  35. };
  36. // 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
  37. (function(){
  38. var onBridgeReady = function(){
  39. var WJ = WeixinJSBridge;
  40. // 发送给好友
  41. WJ.on('menu:share:appmessage', function() {
  42. WJ.invoke('sendAppMessage', dataForWeixin, function(res) {
  43. dataForWeixin.callback();
  44. });
  45. });
  46. // 发送到朋友圈
  47. WJ.on('menu:share:timeline', function() {
  48. WJ.invoke('shareTimeline', dataForWeixin, function(res) {
  49. dataForWeixin.callback();
  50. });
  51. });
  52. // 发送到微博
  53. WJ.on('menu:share:weibo', function() {
  54. WJ.invoke('shareWeibo', dataForWeixin, function(res) {
  55. dataForWeixin.callback();
  56. });
  57. });
  58. //显示右上角三个点按钮
  59. WJ.call('showOptionMenu');
  60. };
  61. if (document.addEventListener) {
  62. document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
  63. } else if (document.attachEvent) {
  64. document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
  65. document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
  66. }
  67. })();