alert.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // import wx from './aa';
  2. function alertMessage(text) {
  3. alert(text)
  4. // wx.config({
  5. // })
  6. // wx.ready(function () {
  7. // })
  8. // alert(text+'sss')
  9. }
  10. function isWechatBrowser(){
  11. var ua = window.navigator.userAgent.toLocaleLowerCase();
  12. return ua.indexOf('micromessenger')!=-1;
  13. }
  14. async function getClipboardContents() {
  15. try {
  16. const text = await navigator.clipboard.readText();
  17. alert('Pasted content: ' + text);
  18. } catch (err) {
  19. alert('Failed to read clipboard contents: ' + err);
  20. }
  21. }
  22. function share(parmas) {
  23. jWeixin.config({
  24. appId: parmas.appid, // 必填,公众号的唯一标识
  25. timestamp: parmas.timestamp, // 必填,生成签名的时间戳
  26. nonceStr: parmas.noncestr, // 必填,生成签名的随机串
  27. signature: parmas.signature, // 必填,签名
  28. jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'getNetworkType', 'hideOptionMenu', 'showOptionMenu', 'hideMenuItems', 'showMenuItems', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem', 'closeWindow', 'scanQRCode', 'chooseWXPay']
  29. })
  30. jWeixin.ready(function () {
  31. })
  32. }
  33. async function shareSys(base64url,shareUrl){
  34. const blob = await (await fetch(base64url)).blob();
  35. const file = new File([blob],'share.png',{type:blob.type});
  36. if (navigator.share){
  37. window.navigator.share({text:'LinkBaeBae 链接吧,宝贝!',title:'LinkBaeBae 链接吧,宝贝!',url:shareUrl,files:[file]})
  38. }
  39. else {
  40. alert('bb')
  41. }
  42. }
  43. // function capture(x, y, width, height) {
  44. // // Get The canvas
  45. // html2canvas(document.body, {
  46. // x: x,
  47. // y: y,
  48. // width: width - x,
  49. // height: height - y
  50. // //Callback after image captured
  51. // }).then(function (canvas) {
  52. // //Create a dummy element to download the file
  53. // var a = document.createElement("a")
  54. // a.style = "display: none;"
  55. // a.href = canvas.toDataURL("image/png");
  56. // a.download = "Example.png";
  57. // document.querySelector("body").append(a);
  58. // a.click();
  59. // a.remove();
  60. // });
  61. // }