mix-public 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +11 -5
  2. package/customMethod/cachPictureForWeb.ts +67 -0
  3. package/customMethod/cookie.js +1 -1
  4. package/customMethod/cryptoJS.js +1 -1
  5. package/customMethod/{imageFormat.js → imageFormat.ts} +74 -62
  6. package/customMethod/{pageParams.js → pageParams.ts} +3 -3
  7. package/customMethod/publicLogic.ts +168 -0
  8. package/docs/01./346/241/206/346/236/266/344/273/213/347/273/215/01./347/233/256/345/275/225/347/273/223/346/236/204.md +16 -0
  9. package/docs/01./346/241/206/346/236/266/344/273/213/347/273/215/02./345/211/215/347/253/257/346/241/206/346/236/266.md +220 -0
  10. package/docs/01./346/241/206/346/236/266/344/273/213/347/273/215/03./345/211/215/347/253/257/351/241/271/347/233/256/344/273/213/347/273/215.md +253 -0
  11. package/docs/01./346/241/206/346/236/266/344/273/213/347/273/215/04./345/211/215/347/253/257/344/273/243/347/240/201/350/247/204/350/214/203.md +153 -0
  12. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/01./346/234/254/345/234/260/345/234/260/345/235/200/350/267/263/350/275/254/01.Goto.md +35 -0
  13. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/01./346/234/254/345/234/260/345/234/260/345/235/200/350/267/263/350/275/254/02.GotoMain.md +28 -0
  14. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/01./346/234/254/345/234/260/345/234/260/345/235/200/350/267/263/350/275/254/03.Drawer.md +53 -0
  15. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/01./346/234/254/345/234/260/345/234/260/345/235/200/350/267/263/350/275/254/04.PopupShow.md +53 -0
  16. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/01./346/234/254/345/234/260/345/234/260/345/235/200/350/267/263/350/275/254/05.GoBack.md +31 -0
  17. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/01./346/234/254/345/234/260/345/234/260/345/235/200/350/267/263/350/275/254/06.ReturnHomePage.md +30 -0
  18. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/02./347/275/221/347/273/234/345/234/260/345/235/200/350/267/263/350/275/254/01.GoTo.md +31 -0
  19. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/02./347/275/221/347/273/234/345/234/260/345/235/200/350/267/263/350/275/254/02.GotoUrlByBrowse.md +30 -0
  20. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/03./350/267/263/350/275/254/347/211/271/346/256/212/351/241/265/351/235/242/01.GoToVideo.md +31 -0
  21. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/03./350/267/263/350/275/254/347/211/271/346/256/212/351/241/265/351/235/242/02.GoToMap.md +30 -0
  22. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/03./350/267/263/350/275/254/347/211/271/346/256/212/351/241/265/351/235/242/03.MapSearch.md +31 -0
  23. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/03./350/267/263/350/275/254/347/211/271/346/256/212/351/241/265/351/235/242/04.OnlineService.md +28 -0
  24. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/04./350/267/263/350/275/254/344/270/211/346/226/271/01.OpenOtherApp.md +36 -0
  25. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/04./350/267/263/350/275/254/344/270/211/346/226/271/02.OpenWechatMiniProgram.md +37 -0
  26. package/docs/02.API/00./351/241/265/351/235/242/350/267/263/350/275/254/_meta.json +30 -0
  27. package/docs/02.API/01./346/234/254/345/234/260/345/217/202/346/225/260/345/255/230/345/202/250/01.putCookieInfo.md +29 -0
  28. package/docs/02.API/01./346/234/254/345/234/260/345/217/202/346/225/260/345/255/230/345/202/250/02.getCookieInfo.md +52 -0
  29. package/docs/02.API/02.APP/345/210/206/344/272/253/01./345/210/206/344/272/253/351/223/276/346/216/245/350/207/263/345/276/256/344/277/241/01.ShareSessionUrl.md +32 -0
  30. package/docs/02.API/02.APP/345/210/206/344/272/253/01./345/210/206/344/272/253/351/223/276/346/216/245/350/207/263/345/276/256/344/277/241/02.ShareTimelineUrl.md +32 -0
  31. package/docs/02.API/02.APP/345/210/206/344/272/253/02./345/210/206/344/272/253/345/233/276/347/211/207/350/207/263/345/276/256/344/277/241/01.ShareSessionImage.md +29 -0
  32. package/docs/02.API/02.APP/345/210/206/344/272/253/02./345/210/206/344/272/253/345/233/276/347/211/207/350/207/263/345/276/256/344/277/241/02.Base64ImageShareWechatSession.md +29 -0
  33. package/docs/02.API/02.APP/345/210/206/344/272/253/02./345/210/206/344/272/253/345/233/276/347/211/207/350/207/263/345/276/256/344/277/241/03.ShareTimelineImage.md +29 -0
  34. package/docs/02.API/02.APP/345/210/206/344/272/253/02./345/210/206/344/272/253/345/233/276/347/211/207/350/207/263/345/276/256/344/277/241/04.Base64ImageShareWechatTimeline.md +29 -0
  35. package/docs/02.API/02.APP/345/210/206/344/272/253/_meta.json +16 -0
  36. package/docs/02.API/04.APP/345/233/276/347/211/207/01./345/233/276/347/211/207/351/200/211/346/213/251/01.UploadPhoto.md +44 -0
  37. package/docs/02.API/04.APP/345/233/276/347/211/207/01./345/233/276/347/211/207/351/200/211/346/213/251/02.LibraryPhoto.md +44 -0
  38. package/docs/02.API/04.APP/345/233/276/347/211/207/01./345/233/276/347/211/207/351/200/211/346/213/251/03.CanemaPhoto.md +44 -0
  39. package/docs/02.API/04.APP/345/233/276/347/211/207/01./345/233/276/347/211/207/351/200/211/346/213/251/04.ImgUpload.md +131 -0
  40. package/docs/02.API/04.APP/345/233/276/347/211/207/02./345/233/276/347/211/207/344/277/235/345/255/230/01.SaveToSd.md +26 -0
  41. package/docs/02.API/04.APP/345/233/276/347/211/207/02./345/233/276/347/211/207/344/277/235/345/255/230/02.SaveBase64ImageToSd.md +23 -0
  42. package/docs/02.API/04.APP/345/233/276/347/211/207/02./345/233/276/347/211/207/344/277/235/345/255/230/03.CachePicture.md +32 -0
  43. package/docs/02.API/04.APP/345/233/276/347/211/207/03./345/233/276/347/211/207/351/242/204/350/247/210/01.PhotoBrowser.md +30 -0
  44. package/docs/02.API/04.APP/345/233/276/347/211/207/_meta.json +23 -0
  45. package/docs/02.API/05./345/260/217/347/250/213/345/272/217/01./345/260/217/347/250/213/345/272/217/350/267/263/350/275/254/01.JumpMiniApp.md +34 -0
  46. package/docs/02.API/05./345/260/217/347/250/213/345/272/217/01./345/260/217/347/250/213/345/272/217/350/267/263/350/275/254/02.JumpHalfScreenApp.md +33 -0
  47. package/docs/02.API/05./345/260/217/347/250/213/345/272/217/01./345/260/217/347/250/213/345/272/217/350/267/263/350/275/254/03.getMiniProgramUsageRecord.md +28 -0
  48. package/docs/02.API/05./345/260/217/347/250/213/345/272/217/02./346/270/205/351/231/244/345/260/217/347/250/213/345/272/217/347/274/223/345/255/230/01.MiniAppDelete.md +27 -0
  49. package/docs/02.API/05./345/260/217/347/250/213/345/272/217/_meta.json +16 -0
  50. package/docs/02.API/06./345/271/277/345/221/212/01.ShowRewardedVideo.md +26 -0
  51. package/docs/02.API/06./345/271/277/345/221/212/02.ShowInterstitial.md +26 -0
  52. package/docs/02.API/07./346/226/207/344/273/266/347/256/241/347/220/206/01./346/226/207/344/273/266/344/270/213/350/275/275/01.DownloadFiles.md +38 -0
  53. package/docs/02.API/07./346/226/207/344/273/266/347/256/241/347/220/206/01./346/226/207/344/273/266/344/270/213/350/275/275/02.DownloadFileCancel.md +33 -0
  54. package/docs/02.API/07./346/226/207/344/273/266/347/256/241/347/220/206/01./346/226/207/344/273/266/344/270/213/350/275/275/03.getDownloadFileProgress.md +41 -0
  55. package/docs/02.API/07./346/226/207/344/273/266/347/256/241/347/220/206/02./346/226/207/344/273/266/345/210/240/351/231/244/01.DownloadFileDelete.md +33 -0
  56. package/docs/02.API/07./346/226/207/344/273/266/347/256/241/347/220/206/03./346/226/207/344/273/266/351/242/204/350/247/210/01.FilesPreview.md +32 -0
  57. package/docs/02.API/07./346/226/207/344/273/266/347/256/241/347/220/206/04./350/216/267/345/217/226/346/226/207/344/273/266/344/270/213/350/275/275/345/210/227/350/241/250/01.getFinishDownloadPaths.md +28 -0
  58. package/docs/02.API/07./346/226/207/344/273/266/347/256/241/347/220/206/_meta.json +30 -0
  59. package/docs/02.API/08./351/241/265/351/235/242/346/226/271/346/263/225/01.OnStart.md +28 -0
  60. package/docs/02.API/08./351/241/265/351/235/242/346/226/271/346/263/225/02.OnStop.md +28 -0
  61. package/docs/02.API/08./351/241/265/351/235/242/346/226/271/346/263/225/03.RefreshDialog.md +30 -0
  62. package/docs/02.API/08./351/241/265/351/235/242/346/226/271/346/263/225/04.returnPageUrl.md +27 -0
  63. package/docs/02.API/08./351/241/265/351/235/242/346/226/271/346/263/225/05.keyboard.md +30 -0
  64. package/docs/02.API/09.OCR/01.getBase64Info.md +86 -0
  65. package/docs/02.API/09.OCR/02.OCRBankCard.md +44 -0
  66. package/docs/02.API/09.OCR/03.OCRIdCard.md +46 -0
  67. package/docs/02.API/10./346/211/253/346/217/217/346/226/271/346/263/225/01.ScanQRCode.md +39 -0
  68. package/docs/02.API/10./346/211/253/346/217/217/346/226/271/346/263/225/02.QRCodeBase64.md +33 -0
  69. package/docs/02.API/11./350/256/276/347/275/256/351/241/265/351/235/242/351/205/215/347/275/256/344/277/241/346/201/257/01.SetTitle.md +32 -0
  70. package/docs/02.API/11./350/256/276/347/275/256/351/241/265/351/235/242/351/205/215/347/275/256/344/277/241/346/201/257/02.SetRightButtonTitle.md +38 -0
  71. package/docs/02.API/11./350/256/276/347/275/256/351/241/265/351/235/242/351/205/215/347/275/256/344/277/241/346/201/257/03.SetStatusBarBgColor.md +34 -0
  72. package/docs/02.API/11./350/256/276/347/275/256/351/241/265/351/235/242/351/205/215/347/275/256/344/277/241/346/201/257/04.SetStatusBarStyle.md +32 -0
  73. package/docs/02.API/11./350/256/276/347/275/256/351/241/265/351/235/242/351/205/215/347/275/256/344/277/241/346/201/257/05.PlayMusic.md +30 -0
  74. package/docs/02.API/11./350/256/276/347/275/256/351/241/265/351/235/242/351/205/215/347/275/256/344/277/241/346/201/257/06.PageCheck.md +25 -0
  75. package/docs/02.API/11./350/256/276/347/275/256/351/241/265/351/235/242/351/205/215/347/275/256/344/277/241/346/201/257/07.SetBadgeValue.md +31 -0
  76. package/docs/02.API/11./350/256/276/347/275/256/351/241/265/351/235/242/351/205/215/347/275/256/344/277/241/346/201/257/08.ClearBadgeValue.md +30 -0
  77. package/docs/02.API/12./350/216/267/345/217/226/350/256/276/345/244/207/344/277/241/346/201/257/01.getDeviceInfo.md +42 -0
  78. package/docs/02.API/12./350/216/267/345/217/226/350/256/276/345/244/207/344/277/241/346/201/257/02.getBrightness.md +27 -0
  79. package/docs/02.API/12./350/216/267/345/217/226/350/256/276/345/244/207/344/277/241/346/201/257/03.getVolume.md +27 -0
  80. package/docs/02.API/12./350/216/267/345/217/226/350/256/276/345/244/207/344/277/241/346/201/257/04.getClipboardContent.md +27 -0
  81. package/docs/02.API/12./350/216/267/345/217/226/350/256/276/345/244/207/344/277/241/346/201/257/05.IsNet.md +27 -0
  82. package/docs/02.API/12./350/216/267/345/217/226/350/256/276/345/244/207/344/277/241/346/201/257/06.GetLocation.md +31 -0
  83. package/docs/02.API/12./350/216/267/345/217/226/350/256/276/345/244/207/344/277/241/346/201/257/07.getApnsAuthorizationStatus.md +37 -0
  84. package/docs/02.API/13./346/217/220/344/272/244/350/256/276/345/244/207/344/277/256/346/224/271/01.Brightness.md +32 -0
  85. package/docs/02.API/13./346/217/220/344/272/244/350/256/276/345/244/207/344/277/256/346/224/271/02.VolumeControl.md +32 -0
  86. package/docs/02.API/13./346/217/220/344/272/244/350/256/276/345/244/207/344/277/256/346/224/271/03.ScheduleReminder.md +38 -0
  87. package/docs/02.API/13./346/217/220/344/272/244/350/256/276/345/244/207/344/277/256/346/224/271/04.SettingApns.md +24 -0
  88. package/docs/02.API/14./350/216/267/345/217/226APP/344/277/241/346/201/257/01.GetAppVersion.md +27 -0
  89. package/docs/02.API/14./350/216/267/345/217/226APP/344/277/241/346/201/257/02.getStatusBarHeight.md +27 -0
  90. package/docs/02.API/14./350/216/267/345/217/226APP/344/277/241/346/201/257/03.CacheSize.md +26 -0
  91. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/01.GreyAllPages.md +24 -0
  92. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/02.ClosePop.md +26 -0
  93. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/03.ClearAppCache.md +24 -0
  94. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/04.ExitApp.md +24 -0
  95. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/05.getAppIconsPath.md +26 -0
  96. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/06.ReplaceAppIcon.md +25 -0
  97. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/07.getBiometricRecognition.md +26 -0
  98. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/08.IsOpenPushSound.md +30 -0
  99. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/09.BindCloudChannel.md +30 -0
  100. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/10.UnbindCloudChannel.md +24 -0
  101. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/11.Shock.md +27 -0
  102. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/12.SetApplicationIconBadgeNumber.md +30 -0
  103. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/13.ClearApplicationIconBadgeNumber.md +24 -0
  104. package/docs/02.API/15.APP/346/223/215/344/275/234/346/226/271/346/263/225/14.AutoLogin.md +31 -0
  105. package/docs/02.API/16.APP/345/274/271/347/252/227/01.ShowLoading.md +24 -0
  106. package/docs/02.API/16.APP/345/274/271/347/252/227/02.HideLoading.md +24 -0
  107. package/docs/02.API/16.APP/345/274/271/347/252/227/03.ShowMsg.md +31 -0
  108. package/docs/02.API/16.APP/345/274/271/347/252/227/04.ShowDialog.md +42 -0
  109. package/docs/02.API/16.APP/345/274/271/347/252/227/05.FloatingWindowData.md +40 -0
  110. package/docs/02.API/17./350/256/276/345/244/207/346/226/271/346/263/225/01./351/231/200/350/236/272/344/273/252/01.OpenGyro.md +37 -0
  111. package/docs/02.API/17./350/256/276/345/244/207/346/226/271/346/263/225/01./351/231/200/350/236/272/344/273/252/02.CloseGyro.md +25 -0
  112. package/docs/02.API/17./350/256/276/345/244/207/346/226/271/346/263/225/02./346/213/250/345/217/267/01.PhoneCall.md +31 -0
  113. package/docs/02.API/17./350/256/276/345/244/207/346/226/271/346/263/225/_meta.json +16 -0
  114. package/docs/02.API/18.IOS/347/213/254/346/234/211/346/226/271/346/263/225/01.SaveToiCloud.md +31 -0
  115. package/docs/02.API/18.IOS/347/213/254/346/234/211/346/226/271/346/263/225/02.FullScreen.md +24 -0
  116. package/docs/02.API/19.Android/347/213/254/346/234/211/346/226/271/346/263/225/01.InitCloudChannel.md +32 -0
  117. package/docs/02.API/20.APP/347/231/273/345/275/225/01.WeChatLogin.md +26 -0
  118. package/docs/02.API/20.APP/347/231/273/345/275/225/02.QQLogin.md +26 -0
  119. package/docs/02.API/21./346/234/254/345/234/260/346/234/215/345/212/241/345/231/250/01.StartHttpServer.md +24 -0
  120. package/docs/02.API/21./346/234/254/345/234/260/346/234/215/345/212/241/345/231/250/02.StopHttpServer.md +24 -0
  121. package/docs/02.API/APP/346/224/257/344/273/230/01.RequestAlipay.md +36 -0
  122. package/docs/02.API/APP/346/224/257/344/273/230/02.RequestWechatPay.md +35 -0
  123. package/docs/02.API/_meta.json +156 -0
  124. package/main/{mixappfunc.js → mixappfunc.ts} +474 -374
  125. package/main/paramsTypes.ts +273 -0
  126. package/main/returnTypes.ts +10 -0
  127. package/mix-project/src/components/lkb-custom-navigation-container/index.vue +2 -2
  128. package/mix-project/src/pages/index/index.js +6 -6
  129. package/mix-project/src/pages/index/index.vue +20 -2
  130. package/mix-project/src/pages/my/index.vue +34 -33
  131. package/mix-project/src/pages/user-login/index.vue +11 -10
  132. package/mixRender.css +99 -8
  133. package/mixRender.js +17 -17
  134. package/package.json +1 -1
  135. package/pageRender/componentsRender.js +16 -16
  136. package/pageRender/getInfo.js +76 -76
  137. package/pageRender/navigation.js +17 -17
  138. package/pageRender/pageDisplay.js +95 -0
  139. package/pageRender/tabbar.js +53 -35
  140. package/types/global.d.ts +16 -0
  141. package/customMethod/cachPictureForWeb.js +0 -60
  142. package/customMethod/publicLogic.js +0 -140
  143. package/pageRender/pop.js +0 -14
package/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
 
6
6
  - mixAPP依赖,可用于web/app开发
7
7
 
8
-
9
8
  ### 安装方法
9
+
10
10
  ```javascript
11
11
  // npm
12
12
  npm i mix-public
@@ -15,7 +15,9 @@
15
15
  // pnpm
16
16
  pnpm i mix-public
17
17
  ```
18
+
18
19
  ### 初始化方式
20
+
19
21
  ```javascript
20
22
  // 布局使用(入口文件)
21
23
  import mixRender from "mix-public"
@@ -39,6 +41,7 @@
39
41
  ```
40
42
 
41
43
  ### 生命周期
44
+
42
45
  ```javascript
43
46
  // 页面加载时
44
47
  OnloadPage((op)=>{
@@ -53,21 +56,22 @@
53
56
  ```
54
57
 
55
58
  ### 方法使用方式
59
+
56
60
  ```javascript
57
61
 
58
62
  // 调用类型
59
63
  //1.直接调用类
60
- mixPublicLib.putCookieInfo('key','value')
64
+ mixPublicLib.PutCookieInfo('key','value')
61
65
  //2.同步返回类
62
- const result = mixPublicLib. getCookieInfo('key')
66
+ const result = mixPublicLib.GetCookieInfo('key')
63
67
  //1.异步返回类
64
68
  mixPublicLib.UploadPhoto({PhotoCount:1, isCut:true, Quality:1}).then(file=>{
65
69
  console.log(file)
66
70
  })
67
71
  ```
68
72
 
69
-
70
73
  ### 更新记录
74
+
71
75
  - v1.0.0 项目初始化
72
76
  - v1.0.1 调整文档调用方式
73
77
  - v1.0.2 调整publicLib调用方式(区分类app样式及单公共调用方法)
@@ -84,4 +88,6 @@
84
88
  - v1.1.3 方法包剩余调用方式整体调整
85
89
  - v1.1.4 goto 方法参数调整
86
90
  - v1.1.5 部分方法网页版完善/优化方法样式
87
- - v1.1.6 添加APPpop页面
91
+ - v1.1.6 添加APPpop页面
92
+ - v1.1.7 添加文档模板/部分 web 实现添加
93
+ - v1.1.8 添加核心方法TS配置,部分方法修复/部分方法吗规范统一
@@ -0,0 +1,67 @@
1
+ interface IcachPic {
2
+ Picurl: string;
3
+ Domid: string;
4
+ }
5
+ import md5 from "../resource/md5.js"
6
+ export default (op: IcachPic): void => {
7
+ var indexedDB =
8
+ window.indexedDB ||
9
+ window.mozIndexedDB ||
10
+ window.webkitIndexedDB ||
11
+ window.msIndexedDB
12
+ var dataBase: any = null
13
+ dataBase = indexedDB.open("MIXAPPCachePicture", 1)
14
+ dataBase.onupgradeneeded = function (e: any) {
15
+ var active = dataBase.result
16
+ var objectDb = active.createObjectStore("seasidecity", {
17
+ keyPath: "id",
18
+ })
19
+ objectDb.createIndex("index_base64", "base64", {
20
+ unique: false,
21
+ })
22
+ }
23
+ dataBase.onsuccess = function (e: any) {
24
+ var transaction = dataBase.result.transaction(["seasidecity"])
25
+ var objectStore = transaction.objectStore("seasidecity")
26
+ var request = objectStore.get(md5(op.Picurl))
27
+ request.onerror = function (event: any) { }
28
+ request.onsuccess = function (event: any) {
29
+ if (request.result) {
30
+ setTimeout(function () {
31
+ const Domid: any = document.getElementById(op.Domid)
32
+ if (Domid)
33
+ Domid.src = request.result.base64
34
+ }, 300)
35
+ } else {
36
+ setTimeout(function () {
37
+ const Domid: any = document.getElementById(op.Domid)
38
+ if (Domid)
39
+ Domid.src = op.Picurl
40
+ }, 300)
41
+ var img = document.createElement("img")
42
+ img.setAttribute("crossOrigin", "anonymous")
43
+ img.src = op.Picurl
44
+ img.onload = function () {
45
+ var canvas = document.createElement("canvas")
46
+ canvas.width = img.width
47
+ canvas.height = img.height
48
+ var ctx: any = canvas.getContext("2d")
49
+ ctx.drawImage(img, 0, 0, img.width, img.height)
50
+ var dataURL = canvas.toDataURL("image/png")
51
+
52
+ var active = dataBase.result
53
+ var data = active.transaction(["seasidecity"], "readwrite")
54
+ var objectDb = data.objectStore("seasidecity")
55
+ var request = objectDb.put({
56
+ id: md5(op.Picurl),
57
+ base64: dataURL,
58
+ })
59
+ request.onerror = function (e: any) { }
60
+
61
+ data.oncomplete = function (e: any) { }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ dataBase.onerror = function (e: any) { }
67
+ }
@@ -170,7 +170,7 @@ const cookie = {
170
170
  },
171
171
  }
172
172
 
173
- export const Cookies = {
173
+ export const Cookies = {
174
174
  get: function (
175
175
  name,
176
176
  type = 1,
@@ -2,7 +2,7 @@
2
2
  * @Author: Gui
3
3
  * @Date: 2023-07-04 11:59:05
4
4
  * @LastEditors: guicheng 1625811865@qq.com
5
- * @LastEditTime: 2026-02-05 15:23:27
5
+ * @LastEditTime: 2026-03-03 11:17:23
6
6
  * @Description: kxs files
7
7
  * @filePath:
8
8
  */
@@ -1,26 +1,27 @@
1
1
  import SimpleCrop from "../imageCut/SimpleCrop.js"
2
2
  import jsQR from "../resource/jsQR.js"
3
3
  // 文件下载
4
- function downloadBlob(blob) {
4
+ function downloadBlob(blob: Blob | MediaSource) {
5
5
  // 1. 创建下载链接
6
6
  const url = window.URL.createObjectURL(blob);
7
7
  const a = document.createElement('a');
8
8
  a.href = url;
9
9
  a.download = 'mix_app_image_' + new Date().getTime();
10
-
10
+
11
11
  // 2. 触发下载
12
12
  document.body.appendChild(a);
13
13
  a.click();
14
-
14
+
15
15
  // 3. 清理
16
16
  document.body.removeChild(a);
17
17
  window.URL.revokeObjectURL(url);
18
18
  }
19
19
 
20
20
  // base64转换为blob
21
- const dataURLtoBlob = function (base64) {
22
- var arr = base64.split(",");
23
- var mime = arr[0].match(/:(.*?);/)[1];
21
+ const dataURLtoBlob = function (base64: string) {
22
+ var arr = base64.split(",") || [];
23
+ var mimeMatch = arr[0].match(/:(.*?);/);
24
+ var mime = mimeMatch ? mimeMatch[1] : '';
24
25
  var bstr = atob(arr[1]);
25
26
  var n = bstr.length;
26
27
  var u8arr = new Uint8Array(n);
@@ -31,7 +32,7 @@ const dataURLtoBlob = function (base64) {
31
32
  };
32
33
 
33
34
  // 获取文件,返回file对象
34
- const getImgFile = async (imgData, type = "image/png", fileName = "mixImage.png")=> {
35
+ const getImgFile = async (imgData: string | object, type: string = "image/png", fileName: string = "mixImage.png") => {
35
36
  if (typeof imgData === "object") {
36
37
  return Promise.resolve(imgData)
37
38
  } else {
@@ -58,7 +59,7 @@ const getImgFile = async (imgData, type = "image/png", fileName = "mixImage.png"
58
59
  }
59
60
 
60
61
  // 非裁剪压缩
61
- function compressImage(src, quality = 1, outputFormat = "image/jpeg") {
62
+ function compressImage(src: any, quality = 1, outputFormat = "image/jpeg") {
62
63
  return new Promise((resolve, reject) => {
63
64
  const type = Object.prototype.toString.call(src);
64
65
  const image = new Image();
@@ -73,7 +74,7 @@ function compressImage(src, quality = 1, outputFormat = "image/jpeg") {
73
74
  canvas.width = width;
74
75
  canvas.height = height;
75
76
  const ctx = canvas.getContext("2d");
76
- ctx.drawImage(image, 0, 0, width, height);
77
+ ctx?.drawImage(image, 0, 0, width, height);
77
78
  resolve(dataURLtoBlob(canvas.toDataURL(outputFormat, quality)));
78
79
  };
79
80
  image.onerror = reject;
@@ -81,7 +82,7 @@ function compressImage(src, quality = 1, outputFormat = "image/jpeg") {
81
82
  }
82
83
 
83
84
  // 保存在线图片到浏览器下载
84
- export async function saveOnlineImage(imageUrl) {
85
+ export async function saveOnlineImage(imageUrl: string) {
85
86
  try {
86
87
  // 1. 获取图片数据
87
88
  const response = await fetch(imageUrl);
@@ -98,7 +99,7 @@ export async function saveOnlineImage(imageUrl) {
98
99
  }
99
100
 
100
101
  // 保存base64到浏览器下载
101
- export function savebase64Image(base64) {
102
+ export function savebase64Image(base64: string) {
102
103
  try {
103
104
  // 1. 转 base64为blob
104
105
  var blob = dataURLtoBlob(base64);
@@ -108,12 +109,17 @@ export function savebase64Image(base64) {
108
109
  console.error('保存图片失败:', error);
109
110
  }
110
111
  }
112
+ interface imageCropType {
113
+ file: any;
114
+ width: number;
115
+ height: number;
116
+ }
111
117
 
112
118
  function imageCrop({
113
119
  width,
114
120
  height,
115
121
  file,
116
- }) {
122
+ }: imageCropType) {
117
123
  return new Promise((resolve, reject) => {
118
124
  new SimpleCrop({
119
125
  src: file,
@@ -122,8 +128,8 @@ function imageCrop({
122
128
  height: height,
123
129
  },
124
130
  cropSizePercent: 1,
125
- cropCallback: function (resultCanvas) {
126
- resultCanvas.toBlob((fileBlob) => {
131
+ cropCallback: function (resultCanvas: any) {
132
+ resultCanvas.toBlob((fileBlob: any) => {
127
133
  if (!fileBlob) {
128
134
  reject(new Error("裁切失败"))
129
135
  return
@@ -148,62 +154,68 @@ function imageCrop({
148
154
  * Quality // 压缩质量 0-1
149
155
  * }
150
156
  */
151
- export async function formatImage(imgPath, formatConfig){
152
- return new Promise((resolve, reject) => {
153
- if(formatConfig.isCut){
154
- getImgFile(imgPath).then(async(file)=>{
155
- // 使用createImageBitmap解码图片
156
- const bitmap = await createImageBitmap(file);
157
- const width = Math.floor(bitmap.width * formatConfig.Quality)
158
- const height = Math.floor(bitmap.height * formatConfig.Quality)
159
- imageCrop({file,width,height}).then(file=>{
160
- resolve(file)
161
- }).catch(err=>{
162
- reject(err)
163
- })
164
- })
165
- }else{
166
- compressImage(imgPath, formatConfig.Quality).then(blob=>{
167
- resolve(new File([blob], "mix_app_image.png", { type: blob.type }))
168
- }).catch(err=>{
169
- reject(err)
170
- })
171
- }
172
- })
157
+ interface formatImageType {
158
+ isCut?: boolean;
159
+ Quality?: number;
173
160
  }
174
-
175
- export async function formatVideo(imgPath){
176
- return new Promise((resolve, reject) => {
177
- getImgFile(imgPath, "video/mp4", "mixVide.mp4").then(async(file)=>{
161
+ export async function formatImage(imgPath: any, formatConfig: formatImageType = { isCut: false, Quality: 1 }) {
162
+ return new Promise((resolve, reject) => {
163
+ const Quality: number = formatConfig.Quality ?? 1
164
+ if (formatConfig.isCut) {
165
+ getImgFile(imgPath).then(async (file: any) => {
166
+ // 使用createImageBitmap解码图片
167
+ const bitmap = await createImageBitmap(file);
168
+ const width = Math.floor(bitmap.width * Quality)
169
+ const height = Math.floor(bitmap.height * Quality)
170
+ imageCrop({ file, width, height }).then(file => {
178
171
  resolve(file)
172
+ }).catch(err => {
173
+ reject(err)
174
+ })
175
+ })
176
+ } else {
177
+ compressImage(imgPath, Quality).then((blob: any) => {
178
+ resolve(new File([blob], "mix_app_image.png", { type: blob.type }))
179
+ }).catch(err => {
180
+ reject(err)
179
181
  })
182
+ }
183
+ })
184
+ }
185
+
186
+ export async function formatVideo(imgPath: any) {
187
+ return new Promise((resolve, reject) => {
188
+ getImgFile(imgPath, "video/mp4", "mixVide.mp4").then(async (file) => {
189
+ resolve(file)
180
190
  })
191
+ })
181
192
  }
182
193
 
183
- export function scanQrcode(imgPath){
194
+ export function scanQrcode(imgPath: any) {
184
195
  return new Promise((resolve, reject) => {
185
- getImgFile(imgPath).then(file=>{
196
+ getImgFile(imgPath).then((file: any) => {
186
197
  const reader = new FileReader();
187
- reader.onload = function(event) {
188
- const img = new Image();
189
- img.onload = function() {
190
- const canvas = document.createElement('canvas');
191
- const ctx = canvas.getContext('2d');
192
- canvas.width = img.width;
193
- canvas.height = img.height;
194
- ctx.drawImage(img, 0, 0);
195
- const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
196
- const code = jsQR(imageData.data, imageData.width, imageData.height);
197
- if (code) {
198
- resolve(code.data)
199
- } else {
200
- resolve("")
201
- }
202
- };
203
- img.onerror = function (event) {
204
- reject(event)
205
- };
206
- img.src = event.target.result;
198
+ reader.onload = function (event) {
199
+ const result: any = event.target?.result;
200
+ const img = new Image();
201
+ img.onload = function () {
202
+ const canvas = document.createElement('canvas');
203
+ const ctx = canvas.getContext('2d');
204
+ canvas.width = img.width;
205
+ canvas.height = img.height;
206
+ ctx?.drawImage(img, 0, 0);
207
+ const imageData: any = ctx?.getImageData(0, 0, canvas.width, canvas.height);
208
+ const code = jsQR(imageData.data, imageData.width, imageData.height);
209
+ if (code) {
210
+ resolve(code.data)
211
+ } else {
212
+ resolve("")
213
+ }
214
+ };
215
+ img.onerror = function (event) {
216
+ reject(event)
217
+ };
218
+ img.src = result;
207
219
  };
208
220
  reader.readAsDataURL(file);
209
221
  })
@@ -1,9 +1,9 @@
1
1
  /* 获取url上的query参数以对象的方式返回 */
2
- function getUrlQuery(url) {
2
+ function getUrlQuery(url: string): any {
3
3
  const urlSearch = url.replace(/^[^?=]*\?/g, "")
4
- const obj = {}
4
+ const obj: any = {}
5
5
  const searchURL = new URLSearchParams(urlSearch)
6
- searchURL.forEach((value, key) => {
6
+ searchURL.forEach((value: any, key: any) => {
7
7
  obj[key] = value
8
8
  })
9
9
  return obj
@@ -0,0 +1,168 @@
1
+ declare global {
2
+ interface Window {
3
+ [key: string]: any; // 允许通过字符串索引访问任意属性
4
+ }
5
+ }
6
+ declare const Func: {
7
+ [key: string]: (params: string) => any;
8
+ };
9
+
10
+ export function mixJsonParse(str: string) {
11
+ try {
12
+ return JSON.parse(str)
13
+ } catch (e) {
14
+ return str
15
+ }
16
+ }
17
+ export function mixJsonStringify(val: object | any) {
18
+ try {
19
+ return JSON.stringify(val)
20
+ } catch (e) {
21
+ return val
22
+ }
23
+ }
24
+ export function isPromise(obj: object | Promise<any>): boolean {
25
+ return obj && Object.prototype.toString.call(obj) === '[object Promise]';
26
+ }
27
+ interface callFunction {
28
+ (params: any): any | void;
29
+ }
30
+
31
+ interface callMethodType {
32
+ environment: { isWeb: boolean, isHarmony: boolean, isAndroid: boolean, isIOS: boolean };
33
+ params: object;
34
+ methodName: string;
35
+ webMethod?: callFunction | null | any;
36
+ androidMethod?: callFunction | null | any;
37
+ iosMethod?: callFunction | null | any;
38
+ }
39
+ interface asyncReturnMethodType {
40
+ callBackMethod?: callFunction | null | any;
41
+ }
42
+ interface syncReturnMethod {
43
+ singleField?: boolean;
44
+ asyncReturn?: boolean;
45
+ }
46
+ export const asyncReturnMethod = (op: callMethodType & asyncReturnMethodType): Promise<any> => {
47
+ var environment = {
48
+ isWeb: op?.environment?.isWeb || false,
49
+ isHarmony: op?.environment?.isHarmony || false,
50
+ isAndroid: op?.environment?.isAndroid || false,
51
+ isIOS: op?.environment?.isIOS || false
52
+ }
53
+ var webMethod = op.webMethod || false;
54
+ var androidMethod = op.androidMethod || false;
55
+ var iosMethod = op.iosMethod || false;
56
+ var callBackMethod = op.callBackMethod || false;
57
+ var params: any = op.params || {};
58
+ var methodName = op.methodName || "";
59
+ var callBackMethodName: string = "MIX_APP_" + methodName
60
+ params.MethodName = callBackMethodName
61
+ callMethod({
62
+ environment,
63
+ methodName,
64
+ androidMethod: () => { androidMethod && androidMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) },
65
+ iosMethod: () => { iosMethod && iosMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) },
66
+ webMethod: () => { webMethod && webMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) },
67
+ params
68
+ })
69
+ return new Promise((resolve, reject) => {
70
+ window[callBackMethodName] = (data: any) => {
71
+ callBackMethod && data ? callBackMethod(data).then((formatData: any) => { resolve(formatData) }).catch((err: any) => { reject(err) }) : resolve(data)
72
+ }
73
+ });
74
+ };
75
+ export const callMethod = (op: callMethodType): void => {
76
+ var isWeb = op?.environment?.isWeb || false;
77
+ var isHarmony = op?.environment?.isHarmony || false;
78
+ var isAndroid = op?.environment?.isAndroid || false;
79
+ var isIOS = op?.environment?.isIOS || false;
80
+ var webMethod = op.webMethod || false;
81
+ var androidMethod = op.androidMethod || false;
82
+ var iosMethod = op.iosMethod || false;
83
+ var params: any = op.params || {};
84
+ var methodName = op.methodName;
85
+ for (var key in params) {
86
+ if (!Object.hasOwn(params, key)) continue;
87
+ params[key] = params[key].toString();
88
+ }
89
+ if (isWeb) {
90
+ webMethod && webMethod();
91
+ } else {
92
+ if (isAndroid || isHarmony) {
93
+ androidMethod ? androidMethod(mixJsonStringify(params)) : window.Func[methodName](mixJsonStringify(params));
94
+ } else if (isIOS) {
95
+ iosMethod ? iosMethod(mixJsonStringify(params)) : window.webkit.messageHandlers[methodName].postMessage(
96
+ mixJsonStringify(params)
97
+ );
98
+ }
99
+ }
100
+ };
101
+ export const syncReturnMethod = (op: callMethodType & syncReturnMethod & asyncReturnMethodType) => {
102
+ var isWeb = op?.environment?.isWeb || false;
103
+ var isHarmony = op?.environment?.isHarmony || false;
104
+ var isAndroid = op?.environment?.isAndroid || false;
105
+ var isIOS = op?.environment?.isIOS || false;
106
+ var webMethod = op.webMethod || false;
107
+ var asyncReturn = op.asyncReturn || false;
108
+ var androidMethod = op.androidMethod || false;
109
+ var iosMethod = op.iosMethod || false;
110
+ var params: any = op.params || {};
111
+ var methodName = op.methodName;
112
+ var singleField = op.singleField || false;
113
+ var singleParam = ""
114
+ for (var key in params) {
115
+ if (!Object.hasOwn(params, key)) continue;
116
+ params[key] = params[key].toString();
117
+ if (singleField) {
118
+ singleParam = params[key];
119
+ }
120
+ }
121
+ var result: any;
122
+ if (isWeb) {
123
+ webMethod && (result = webMethod());
124
+ } else {
125
+ if (isAndroid || isHarmony) {
126
+ if (asyncReturn) {
127
+ result = new Promise((resolve, reject) => {
128
+ try {
129
+ params.MethodName = "MIX_APP_" + methodName
130
+ window["MIX_APP_" + methodName] = (data: any) => {
131
+ resolve(data)
132
+ }
133
+ androidMethod ? resolve(androidMethod()) : window.Func[methodName](mixJsonStringify(params))
134
+ } catch (error) {
135
+ reject(error)
136
+ }
137
+ })
138
+ } else {
139
+ result = androidMethod ? androidMethod() : window.Func[methodName](mixJsonStringify(params));
140
+ }
141
+ } else if (isIOS) {
142
+ if (asyncReturn) {
143
+ result = new Promise((resolve, reject) => {
144
+ try {
145
+ params.MethodName = "MIX_APP_" + methodName
146
+ window["MIX_APP_" + methodName] = (data: any) => {
147
+ resolve(data)
148
+ }
149
+ if (singleField) {
150
+ result = iosMethod ? resolve(iosMethod()) : decodeURIComponent(window.prompt(methodName, singleParam) ?? "")
151
+ } else {
152
+ result = iosMethod ? resolve(iosMethod()) : decodeURIComponent(window.prompt(methodName, mixJsonStringify(params)) ?? "")
153
+ }
154
+ } catch (error) {
155
+ reject(error)
156
+ }
157
+ })
158
+ } else {
159
+ if (singleField) {
160
+ result = iosMethod ? iosMethod() : decodeURIComponent(window.prompt(methodName, singleParam) ?? "")
161
+ } else {
162
+ result = iosMethod ? iosMethod() : decodeURIComponent(window.prompt(methodName, mixJsonStringify(params)) ?? "")
163
+ }
164
+ }
165
+ }
166
+ }
167
+ return mixJsonParse(result);
168
+ };
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: 目录结构
3
+ date: 2023-08-07 11:37:11
4
+ permalink: /pages/8f427a/
5
+ categories:
6
+ - 前端军刀
7
+ - 框架介绍
8
+ tags:
9
+ -
10
+ author:
11
+ name: ABpasser
12
+ ---
13
+
14
+ ## 目录介绍
15
+
16
+ ## 文件介绍