mix-public 1.1.2 → 1.1.3

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.
package/README.md CHANGED
@@ -80,4 +80,5 @@
80
80
  - v1.0.9 依赖引用调整
81
81
  - v1.1.0 方法包调用方式整体调整
82
82
  - v1.1.1 添加OnloadPage生命周期/调整 goto 方法参数
83
- - v1.1.2 修复方法环境变量/添加 a 标签捕获自定义站内跳转
83
+ - v1.1.2 修复方法环境变量/添加 a 标签捕获自定义站内跳转
84
+ - v1.1.3 方法包剩余调用方式整体调整
@@ -2,11 +2,11 @@
2
2
  * @Author: Gui
3
3
  * @Date: 2023-07-04 11:59:05
4
4
  * @LastEditors: guicheng 1625811865@qq.com
5
- * @LastEditTime: 2026-01-26 15:29:20
5
+ * @LastEditTime: 2026-02-05 15:23:27
6
6
  * @Description: kxs files
7
7
  * @filePath:
8
8
  */
9
- import CryptoJS from "crypto-js"
9
+ import CryptoJS from "../resource/crypto-js.js"
10
10
  // 加密
11
11
  export const mixLocalShakeDownEncrypt = function (message) {
12
12
  const keyHex = CryptoJS.enc.Utf8.parse("2024SIG4W1SAVDTSA6OV0VN1G07PS3N5")
@@ -30,8 +30,8 @@ const dataURLtoBlob = function (base64) {
30
30
  return new Blob([u8arr], { type: mime });
31
31
  };
32
32
 
33
- // 获取图片文件,返回file对象
34
- const getImgFile = async (imgData)=> {
33
+ // 获取文件,返回file对象
34
+ const getImgFile = async (imgData, type = "image/png", fileName = "mixImage.png")=> {
35
35
  if (typeof imgData === "object") {
36
36
  return Promise.resolve(imgData)
37
37
  } else {
@@ -42,10 +42,10 @@ const getImgFile = async (imgData)=> {
42
42
  xhr.responseType = "blob"
43
43
  xhr.onload = async function (e) {
44
44
  if (xhr.status == 200) {
45
- const blob = new Blob([this.response], { type: "image/png" })
45
+ const blob = new Blob([this.response], { type })
46
46
  // Convert blob to File object
47
- const file = new File([blob], "image.png", {
48
- type: "image/png",
47
+ const file = new File([blob], fileName, {
48
+ type,
49
49
  lastModified: new Date().getTime(),
50
50
  })
51
51
 
@@ -172,6 +172,14 @@ export async function formatImage(imgPath, formatConfig){
172
172
  })
173
173
  }
174
174
 
175
+ export async function formatVideo(imgPath){
176
+ return new Promise((resolve, reject) => {
177
+ getImgFile(imgPath, "video/mp4", "mixVide.mp4").then(async(file)=>{
178
+ resolve(file)
179
+ })
180
+ })
181
+ }
182
+
175
183
  export function scanQrcode(imgPath){
176
184
  return new Promise((resolve, reject) => {
177
185
  getImgFile(imgPath).then(file=>{
@@ -62,9 +62,9 @@ export const callMethod = (op) => {
62
62
  webMethod && webMethod();
63
63
  } else {
64
64
  if (isAndroid || isHarmony) {
65
- androidMethod ? androidMethod() : Func[methodName](mixJsonStringify(params));
65
+ androidMethod ? androidMethod(mixJsonStringify(params)) : Func[methodName](mixJsonStringify(params));
66
66
  } else if (isIOS) {
67
- iosMethod ? iosMethod() : window.webkit.messageHandlers[methodName].postMessage(
67
+ iosMethod ? iosMethod(mixJsonStringify(params)) : window.webkit.messageHandlers[methodName].postMessage(
68
68
  mixJsonStringify(params)
69
69
  );
70
70
  }