mix-public 1.1.4 → 1.1.5

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
@@ -82,4 +82,5 @@
82
82
  - v1.1.1 添加OnloadPage生命周期/调整 goto 方法参数
83
83
  - v1.1.2 修复方法环境变量/添加 a 标签捕获自定义站内跳转
84
84
  - v1.1.3 方法包剩余调用方式整体调整
85
- - v1.1.4 goto 方法参数调整
85
+ - v1.1.4 goto 方法参数调整
86
+ - v1.1.5 部分方法网页版完善/优化方法样式
@@ -2,8 +2,6 @@
2
2
  // closeToast,
3
3
  // showConfirmDialog,
4
4
  // showDialog,
5
- // showLoadingToast,
6
- // showNotify,
7
5
  // } from "vant"
8
6
  import { mixLocalShakeDownDecrypt, mixLocalShakeDownEncrypt } from "../customMethod/cryptoJS.js"
9
7
  import { Cookies } from "../customMethod/cookie.js"
@@ -13,11 +11,7 @@ import { asyncReturnMethod, syncReturnMethod, callMethod, mixJsonStringify, mixJ
13
11
  import cachPictureForWeb from "../customMethod/cachPictureForWeb.js"
14
12
  import formatColor, { togglePageGrayscale } from "../customMethod/formatColor.js";
15
13
  import { getUrlQuery } from "../customMethod/pageParams.js"
16
-
17
- function mixShowAlert(message) {
18
- alert(message)
19
- // showNotify({ message })
20
- }
14
+ import { mixLoading, mixHideLoading, mixMsg, mixDialog, mixFloatingWindowData } from "../pageRender/componentsRender.js"
21
15
 
22
16
  const loginUrl = "user-login";
23
17
  var u = navigator.userAgent
@@ -1666,7 +1660,18 @@ export const mixPublicLib = (op) =>{
1666
1660
  environment:this.environment,
1667
1661
  methodName: 'ClearAppCache',
1668
1662
  webMethod: ()=>{
1669
- console.log(`清理APP缓存`, "color: blue", "color: #4CAF50;")
1663
+ const cookies = document.cookie.split(';');
1664
+ const domainParts = window.location.hostname.split('.');
1665
+ const domains = [
1666
+ '', // 当前域名
1667
+ ...(domainParts.length > 1 ? [`.${domainParts.slice(-2).join('.')}`] : []) // 二级域名
1668
+ ];
1669
+ cookies.forEach(cookie => {
1670
+ const [name] = cookie.trim().split('=');
1671
+ domains.forEach(domain => {
1672
+ document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${domain}`;
1673
+ });
1674
+ });
1670
1675
  },
1671
1676
  params:{}
1672
1677
  })
@@ -1852,7 +1857,7 @@ export const mixPublicLib = (op) =>{
1852
1857
  environment:this.environment,
1853
1858
  methodName: 'ShowLoading',
1854
1859
  webMethod: ()=>{
1855
- ShowLoading(Message)
1860
+ mixLoading(Message)
1856
1861
  },
1857
1862
  params:{}
1858
1863
  });
@@ -1866,7 +1871,7 @@ export const mixPublicLib = (op) =>{
1866
1871
  environment:this.environment,
1867
1872
  methodName: 'HideLoading',
1868
1873
  webMethod: ()=>{
1869
- closeToast()
1874
+ mixHideLoading()
1870
1875
  },
1871
1876
  params:{}
1872
1877
  });
@@ -1876,56 +1881,69 @@ export const mixPublicLib = (op) =>{
1876
1881
  * 显示msg弹窗
1877
1882
  * */
1878
1883
  ShowMsg: function (op = {}) {
1879
- const Title = op.Title || "标题"
1880
- const Message = op.Message || "提示内容"
1881
- const ButtonText = op.confirmButtonText || "知道了"
1882
- callMethod({
1883
- environment:this.environment,
1884
- methodName: 'ShowMsg',
1885
- webMethod: ()=>{
1886
- showDialog({
1887
- title: Title,
1888
- message: Message,
1889
- confirmButtonText: ButtonText,
1890
- }).then(() => {
1891
- // on close
1892
- })
1893
- },
1894
- params:{Title, ButtonText, Message}
1895
- });
1884
+ return new Promise((resolve, reject) => {
1885
+ window.MixShowMsgCallBack = function () {
1886
+ resolve();
1887
+ }
1888
+ const Title = op.Title || "标题"
1889
+ const Message = op.Message || "提示内容"
1890
+ const ButtonText = op.confirmButtonText || "知道了"
1891
+ const ConfirmAction = "MixShowMsgCallBack"
1892
+ callMethod({
1893
+ environment:this.environment,
1894
+ methodName: 'ShowMsg',
1895
+ webMethod: ()=>{
1896
+ mixMsg({
1897
+ title: Title,
1898
+ message: Message,
1899
+ confirmButtonText: ButtonText,
1900
+ }).then(()=>{
1901
+ MixShowMsgCallBack()
1902
+ })
1903
+ },
1904
+ params:{Title, ButtonText, Message, ConfirmAction}
1905
+ });
1906
+
1907
+ })
1896
1908
  },
1897
1909
 
1898
1910
  /**
1899
1911
  * 确认弹出框
1900
1912
  * */
1901
1913
  ShowDialog: function (op = {}) {
1902
- const Title = op.Title || ""
1903
- const Message = op.Message || ""
1904
- const ConfirmText = op.ConfirmText || ""
1905
- const CancelText = op.CancelText || ""
1906
- const ConfirmAction = op.ConfirmAction || ""
1907
- const CancelAction = op.CancelAction || ""
1908
- callMethod({
1909
- environment:this.environment,
1910
- methodName: 'ShowDialog',
1911
- webMethod: ()=>{
1912
- showConfirmDialog({
1913
- title: Title,
1914
- message: Message,
1915
- confirmButtonText: ConfirmText || "确定",
1916
- cancelButtonText: CancelText || "取消",
1917
- })
1918
- .then(() => {
1919
- // on confirm
1920
- window[ConfirmAction]()
1921
- })
1922
- .catch(() => {
1923
- // on cancel
1924
- window[CancelAction]()
1914
+ return new Promise((resolve, reject) => {
1915
+ window.MixShowDialogConfirmActionCallBack = function () {
1916
+ resolve();
1917
+ }
1918
+ window.MixShowDialogCancelActionCallBack = function () {
1919
+ reject();
1920
+ }
1921
+ const Title = op.Title || "标题"
1922
+ const Message = op.Message || "确认内容"
1923
+ const ConfirmText = op.ConfirmText || "确认按钮"
1924
+ const CancelText = op.CancelText || "取消按钮"
1925
+ const ConfirmAction = "MixShowDialogConfirmActionCallBack"
1926
+ const CancelAction = "MixShowDialogCancelActionCallBack"
1927
+ callMethod({
1928
+ environment:this.environment,
1929
+ methodName: 'ShowDialog',
1930
+ webMethod: ()=>{
1931
+ mixDialog({
1932
+ title: Title,
1933
+ message: Message,
1934
+ confirmButtonText: ConfirmText || "确定",
1935
+ cancelButtonText: CancelText || "取消",
1925
1936
  })
1926
- },
1927
- params:{Title, Message, ConfirmText, CancelText, ConfirmAction, CancelAction}
1928
- });
1937
+ .then(() => {
1938
+ MixShowDialogConfirmActionCallBack()
1939
+ })
1940
+ .catch(() => {
1941
+ MixShowDialogCancelActionCallBack()
1942
+ })
1943
+ },
1944
+ params:{Title, Message, ConfirmText, CancelText, ConfirmAction, CancelAction}
1945
+ });
1946
+ })
1929
1947
  },
1930
1948
 
1931
1949
  /**
@@ -1935,17 +1953,15 @@ export const mixPublicLib = (op) =>{
1935
1953
  const Url = op.Url || ""
1936
1954
  const Title = op.Title || ""
1937
1955
  const Detail = op.Detail || ""
1938
- const Params = op.Params || ""
1956
+ const Params = op.Params || {}
1939
1957
  const Icon = op.Icon || ""
1940
1958
  callMethod({
1941
1959
  environment:this.environment,
1942
1960
  methodName: 'FloatingWindowData',
1943
1961
  webMethod: ()=>{
1944
- console.log(
1945
- `%c 添加页面浮窗=> %c 参数为:${row}`,
1946
- "color: blue",
1947
- "color: #4CAF50;",
1948
- )
1962
+ mixFloatingWindowData({
1963
+ Url, Title, Detail, Params, Icon,Fn: mixPublicLib({isWeb, version})
1964
+ })
1949
1965
  },
1950
1966
  params:{Url, Title, Detail, Params, Icon}
1951
1967
  });
@@ -2113,7 +2129,7 @@ export const mixPublicLib = (op) =>{
2113
2129
  },
2114
2130
 
2115
2131
  /**
2116
- * 启动本地服务器
2132
+ * 启动本地服务器(仅APP环境)
2117
2133
  * */
2118
2134
  StartHttpServer: function () {
2119
2135
  callMethod({
@@ -2127,7 +2143,7 @@ export const mixPublicLib = (op) =>{
2127
2143
  },
2128
2144
 
2129
2145
  /**
2130
- * 关闭本地服务器
2146
+ * 关闭本地服务器(仅APP环境)
2131
2147
  * */
2132
2148
  StopHttpServer: function () {
2133
2149
  callMethod({
@@ -2192,7 +2208,8 @@ export const mixPublicLib = (op) =>{
2192
2208
  environment:this.environment,
2193
2209
  methodName: 'CacheSize',
2194
2210
  webMethod: ()=>{
2195
- return "1.24KB"
2211
+ let cookies = document.cookie;
2212
+ return (Math.floor(cookies.length / 1024 * 100) / 100) + "KB";
2196
2213
  },
2197
2214
  params: {},
2198
2215
  })
@@ -2206,7 +2223,7 @@ export const mixPublicLib = (op) =>{
2206
2223
  environment:this.environment,
2207
2224
  methodName: 'OnlineService',
2208
2225
  webMethod: ()=>{
2209
- console.log(`客服中心`, "color: blue", "color: #4CAF50;")
2226
+ window.location.href = "http://oss.kexiaoshuang.com/MEIQIA/chatlink.html"
2210
2227
  },
2211
2228
  params:{}
2212
2229
  });
@@ -2220,19 +2237,15 @@ export const mixPublicLib = (op) =>{
2220
2237
  environment:this.environment,
2221
2238
  methodName: 'OpenAmap',
2222
2239
  webMethod: ()=>{
2240
+ var url = `https://m.amap.com/search?query=${encodeURIComponent(Address)}`;
2241
+ window.open(url);
2223
2242
  return new Promise((resolve, reject) => {
2224
- // TODO
2225
- console.log(`打开高德地图`, "color: blue", "color: #4CAF50;")
2226
- // window.location.href = Url;
2227
- setTimeout(() => {
2228
- resolve()
2229
- }, 4000);
2230
2243
  })
2231
2244
  },
2232
2245
  params:{Address}
2233
2246
  })
2234
2247
  },
2235
- /**
2248
+ /**-
2236
2249
  * 上传视频(单个视频,相机/相册)
2237
2250
  * MethodName:回调方法
2238
2251
  * VideoDuration: 录制时长
@@ -7,7 +7,6 @@ import customNavigation from "@/components/lkb-custom-navigation-container/index
7
7
  import { inject } from "vue"
8
8
  const mixPublicLib: any = inject("mixPublicLib")
9
9
 
10
- mixPublicLib.putCookieInfo('aaaaaaa', { a: 1, b: 2 })
11
10
  const searchValue = ref("");
12
11
 
13
12
  const mainEntrance = ref([
package/mixRender.css CHANGED
@@ -131,6 +131,174 @@
131
131
  justify-content: center;
132
132
  }
133
133
 
134
+ @keyframes loadingIn {
135
+ 0% { transform: rotate(0deg);}
136
+ 100% { transform: rotate(360deg);}
137
+ }
138
+ #mix-loading,
139
+ #mix-msg,
140
+ #mix-dialog{
141
+ background-color: rgba(0,0,0, 0.6);
142
+ width: 100vw;
143
+ height: 100vh;
144
+ position: absolute;
145
+ top: 0;
146
+ bottom: 0;
147
+ left: 0;
148
+ right: 0;
149
+ z-index: 999;
150
+ }
151
+ #mix-loading #mix-loading-container{
152
+ position: absolute;
153
+ top: 50%;
154
+ left: 50%;
155
+ transform: translate(-50%, -50%);
156
+ display: flex;
157
+ flex-direction: column;
158
+ align-items: center;
159
+ color: #fff;
160
+ }
161
+ #mix-loading #mix-loading-container #mix-loading-main {
162
+ width: 10vw;
163
+ height: 10vw;
164
+ border: 3px solid #ccc;
165
+ border-top: 3px solid #11a8cd;
166
+ border-radius: 50%;
167
+ animation: loadingIn 1s linear infinite;
168
+ }
169
+ #mix-loading #mix-loading-container #mix-loading-message {
170
+ margin-top: 20px;
171
+ }
172
+
173
+ #mix-msg #mix-msg-container{
174
+ background-color: #fff;
175
+ width: 65vw;
176
+ max-height: 60vw;
177
+ border-radius: 12px;
178
+ position: absolute;
179
+ top: 50%;
180
+ left: 50%;
181
+ transform: translate(-50%, -50%);
182
+ display: flex;
183
+ flex-direction: column;
184
+ align-items: center;
185
+ justify-content: space-between;
186
+ padding: 12px;
187
+ box-sizing: border-box;
188
+ }
189
+ #mix-msg #mix-msg-container #mix-msg-title{
190
+ font-size: 16px;
191
+ color: #333;
192
+ text-align: center;
193
+ }
194
+ #mix-msg #mix-msg-container #mix-msg-message{
195
+ font-size: 14px;
196
+ color: #666;
197
+ margin:14px 0;
198
+ }
199
+ #mix-msg #mix-msg-container #mix-msg-button{
200
+ font-size: 14px;
201
+ color: #fff;
202
+ background-color: #11a8cd;
203
+ width:100%;
204
+ height: 38px;
205
+ border-radius: 99px;
206
+ text-align: center;
207
+ line-height: 38px;
208
+ overflow: hidden;
209
+ }
210
+ #mix-dialog #mix-dialog-container{
211
+ background-color: #fff;
212
+ width: 65vw;
213
+ max-height: 60vw;
214
+ border-radius: 12px;
215
+ position: absolute;
216
+ top: 50%;
217
+ left: 50%;
218
+ transform: translate(-50%, -50%);
219
+ display: flex;
220
+ flex-direction: column;
221
+ align-items: center;
222
+ justify-content: space-between;
223
+ padding: 12px;
224
+ box-sizing: border-box;
225
+ }
226
+ #mix-dialog #mix-dialog-container #mix-dialog-title{
227
+ font-size: 16px;
228
+ color: #333;
229
+ text-align: center;
230
+ }
231
+ #mix-dialog #mix-dialog-container #mix-dialog-message{
232
+ font-size: 14px;
233
+ color: #666;
234
+ margin:14px 0;
235
+ }
236
+ #mix-dialog #mix-dialog-container #mix-dialog-button{
237
+ width: 100%;
238
+ display: flex;
239
+ justify-content: space-between;
240
+ align-items: center;
241
+ }
242
+ #mix-dialog #mix-dialog-container #mix-dialog-button #mix-dialog-confirm-button{
243
+ width: 48%;
244
+ font-size: 14px;
245
+ color: #fff;
246
+ background-color: #11a8cd;
247
+ height: 38px;
248
+ border-radius: 99px;
249
+ text-align: center;
250
+ line-height: 38px;
251
+ overflow: hidden;
252
+ }
253
+ #mix-dialog #mix-dialog-container #mix-dialog-button #mix-dialog-cancel-button{
254
+ width: 48%;
255
+ font-size: 14px;
256
+ color: #fff;
257
+ background-color: #d54941;
258
+ height: 38px;
259
+ border-radius: 99px;
260
+ text-align: center;
261
+ line-height: 38px;
262
+ overflow: hidden;
263
+ }
264
+
265
+ #mix-floating-window-data{
266
+ height:10vw;
267
+ max-width: 30vw;
268
+ min-width: 10vw;
269
+ background-color: #fff;
270
+ position: absolute;
271
+ top: 80%;
272
+ right: 5%;
273
+ z-index: 100;
274
+ border-radius: 8px;
275
+ overflow: hidden;
276
+ display: flex;
277
+ box-shadow: 0 0 10px rgba(0,0,0,0.2);
278
+ }
279
+ #mix-floating-window-data #mix-floating-window-img{
280
+ height:100%;
281
+ vertical-align: bottom;
282
+ }
283
+ #mix-floating-window-data #mix-floating-window-container{
284
+ padding: 2px;
285
+ display: flex;
286
+ flex-direction: column;
287
+ align-items: center;
288
+ }
289
+ #mix-floating-window-data #mix-floating-window-container #mix-floating-window-title{
290
+ font-size: 12px;
291
+ margin-bottom: 2px;
292
+ }
293
+ #mix-floating-window-data #mix-floating-window-container #mix-floating-window-message{
294
+ font-size: 10px;
295
+ display: -webkit-box;
296
+ -webkit-line-clamp: 1;
297
+ -webkit-box-orient: vertical;
298
+ overflow: hidden;
299
+ text-overflow: ellipsis;
300
+ }
301
+
134
302
  @font-face {
135
303
  src: url("data:application/x-font-ttf;base64,AAEAAAAKAIAAAwAgT1MvMlbe5goAAACsAAAAYGNtYXAMWhQPAAABDAAAAVJnbHlmDHw5gwAAAmAAAAVkaGVhZLax7SsAAAfEAAAANmhoZWEFhgDYAAAH/AAAACRobXR4BaoAvQAACCAAAAAebG9jYQfaBrQAAAhAAAAAGm1heHAAEgBaAAAIXAAAACBuYW1l9Spy4AAACHwAAAM0cG9zdAAyALEAAAuwAAAAOgAEAYACvAADAAQCigJYAAAASwKKAlgAAAFeADIBMAAAAAAFAAAAAAAAAIAAAK8QAAAAAAAAAAAAAABFQkRBACAALQA5Asj+4ADIA6kA+gAAAAEAAAAAAfsCyAAgACAAAgAAAAMAAAADAAAAHAABAAAAAABMAAMAAQAAABwABAAwAAAACAAIAAIAAAAtADn/////AAAALQAw///////U/9IAAQABAAAAAAAAAAAAAAEGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAACAwQFBgcICQoLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAB9AK8AAMABgAJAAwADwAANxEhEQM3IRMXEQEhJwMRNwAB9Pqq/qzIqv6OAVSqyKoAArz9RAGL//7U/wH+/dX/ASz+Av8AAAEALADiAVkBSAADAAA3NSEVLAEt4mZmAAIAIv/6AVICzgAZACcAABM0Njc+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JAHQAAMAAQQJAAUAEAH0AAMAAQQJAAYAIgIEAAMAAQQJAAcAFAImAAMAAQQJAAkAHAI6Q29weXJpZ2h0IMKpIDE5ODEsIDIwMDIgSGVpZGVsYmVyZ2VyIERydWNrbWFzY2hpbmVuIEFHLiBBbGwgcmlnaHRzIHJlc2VydmVkLkRJTiBDb25kZW5zZWRCb2xkRElOIENvbmRlbnNlZCBCb2xkOyAxMy4yZDJlMTsgMjAxOC0wMS0yMkRJTiBDb25kZW5zZWQgQm9sZDEzLjJkMmUxRElOQ29uZGVuc2VkLUJvbGRESU5TY2hyaWZ0TGlub3R5cGUgU3RhZmYAQwBvAHAAeQByAGkAZwBoAHQAIACpACAAMQA5ADgAMQAsACAAMgAwADAAMgAgAEgAZQBpAGQAZQBsAGIAZQByAGcAZQByACAARAByAHUAYwBrAG0AYQBzAGMAaABpAG4AZQBuACAAQQBHAC4AIABBAGwAbAAgAHIAaQBnAGgAdABzACAAcgBlAHMAZQByAHYAZQBkAC4ARABJAE4AIABDAG8AbgBkAGUAbgBzAGUAZABCAG8AbABkAEQASQBOACAAQwBvAG4AZABlAG4AcwBlAGQAIABCAG8AbABkADsAIAAxADMALgAyAGQAMgBlADEAOwAgADIAMAAxADgALQAwADEALQAyADIARABJAE4AIABDAG8AbgBkAGUAbgBzAGUAZAAgAEIAbwBsAGQAMQAzAC4AMgBkADIAZQAxAEQASQBOAEMAbwBuAGQAZQBuAHMAZQBkAC0AQgBvAGwAZABEAEkATgBTAGMAaAByAGkAZgB0AEwAaQBuAG8AdAB5AHAAZQAgAFMAdABhAGYAZgACAAAAAAAA/5wAMgAAAAAAAAAAAAAAAAAAAAAAAAAMAAwAAAAQABMAFAAVABYAFwAYABkAGgAbABwAAA==");
136
304
  font-family: DINCondensed-Bold;
package/mixRender.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import mixNavigation from "./pageRender/navigation.js"
2
2
  import mixTabbar from "./pageRender/tabbar.js"
3
3
  import { mixPublicLib } from "./main/mixappfunc.js"
4
- const renderBasic = () => {
4
+ import { mixFloatingWindowRender } from "./pageRender/componentsRender.js"
5
+ const renderBasic = (callback) => {
5
6
  document.body.innerHTML = `<div id="mix-main">
6
7
  <div id="mix-navigation">
7
8
  <div class="mix-navigation-left">
@@ -23,6 +24,7 @@ const renderBasic = () => {
23
24
  <div id="mix-tab-bar">
24
25
  </div>
25
26
  </div>`
27
+ callback()
26
28
  }
27
29
 
28
30
  export default (op) => {
@@ -37,45 +39,50 @@ export default (op) => {
37
39
  };
38
40
  const minMainFn = mixPublicLib({isWeb:mixAppParameter.mixIsWeb, version:mixAppParameter.mixVersion})
39
41
  if(!mixJustMethod){
40
- // 创建onstart生命周期事件代理
41
- const onStartEventList = []
42
- window.OnStartLoad = function (event, config) {
43
- onStartEventList.push(event)
44
- if (config?.immediate) {
45
- event()
42
+ const pageOnload = ()=>{
43
+ // 创建onstart生命周期事件代理
44
+ const onStartEventList = []
45
+ window.OnStartLoad = function (event, config) {
46
+ onStartEventList.push(event)
47
+ if (config?.immediate) {
48
+ event()
49
+ }
46
50
  }
47
- }
48
- // onstart生命周期执行时间转发
49
- window.OnStart = function () {
50
- onStartEventList.forEach((event) => {
51
- event()
52
- })
53
- }
54
- // web执行onstart生命周期函数
55
- if(mixAppParameter.mixIsWeb){
56
- if (window.performance) {
57
- const navigationType = window.performance.navigation.type;
58
- if (navigationType === window.performance.navigation.TYPE_BACK_FORWARD) {
59
- setTimeout(() => {
60
- window.OnStart();
61
- },10);
51
+ // onstart生命周期执行时间转发
52
+ window.OnStart = function () {
53
+ onStartEventList.forEach((event) => {
54
+ event()
55
+ })
56
+ mixFloatingWindowRender({
57
+ ClickBack: minMainFn
58
+ })
59
+ }
60
+ // web执行onstart生命周期函数
61
+ if(mixAppParameter.mixIsWeb){
62
+ if (window.performance) {
63
+ const navigationType = window.performance.navigation.type;
64
+ if (navigationType === window.performance.navigation.TYPE_BACK_FORWARD) {
65
+ setTimeout(() => {
66
+ window.OnStart();
67
+ },10);
68
+ }
69
+ }
62
70
  }
71
+ // 添加页面加载生命周期函数
72
+ window.OnloadPage = function (callback) {
73
+ callback(minMainFn.getCookieInfo({Key:"mixAPPPageParams"}))
63
74
  }
75
+ setTimeout(() => {
76
+ document.querySelectorAll(".mix-custom-jump").forEach((item)=>{
77
+ item.addEventListener('click', function(event) {
78
+ event.preventDefault(); // 阻止默认行为
79
+ // 自定义跳转逻辑
80
+ minMainFn.Goto({Url:item.pathname})
81
+ });
82
+ })
83
+ }, 1000);
64
84
  }
65
- // 添加页面加载生命周期函数
66
- window.OnloadPage = function (callback) {
67
- callback(minMainFn.getCookieInfo({Key:"mixAPPPageParams"}))
68
- }
69
- setTimeout(() => {
70
- document.querySelectorAll(".mix-custom-jump").forEach((item)=>{
71
- item.addEventListener('click', function(event) {
72
- event.preventDefault(); // 阻止默认行为
73
- // 自定义跳转逻辑
74
- minMainFn.Goto({Url:item.pathname})
75
- });
76
- })
77
- }, 1000);
78
- renderBasic();
85
+ renderBasic(pageOnload);
79
86
  mixNavigation(mixAppParameter);
80
87
  mixTabbar(mixAppParameter);
81
88
  // 若为web端且页面为非首次加载,则执行OnStart(需转为异步延迟执行)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mix-public",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "use mix-app",
5
5
  "main": "mixRender.js",
6
6
  "scripts": {
@@ -0,0 +1,98 @@
1
+
2
+ export const mixLoading = (message)=>{
3
+ const element = document.createElement('div');
4
+ element.id = 'mix-loading';
5
+ element.innerHTML = `<div id="mix-loading-container"><div id="mix-loading-main"></div><div id="mix-loading-message">${message}</div></div>`;
6
+ document.body.appendChild(element);
7
+ }
8
+ export const mixHideLoading = ()=>{
9
+ const element = document.getElementById('mix-loading');
10
+ document.body.removeChild(element);
11
+ }
12
+ export const mixMsg = (op)=>{
13
+ return new Promise((resolve, reject) => {
14
+ const Title = op.title
15
+ const Message = op.message
16
+ const ButtonText = op.confirmButtonText
17
+ const element = document.createElement('div');
18
+ element.id = 'mix-msg';
19
+ element.innerHTML = `<div id="mix-msg-container"><div id="mix-msg-title">${Title}</div><div id="mix-msg-message">${Message}</div><div id="mix-msg-button">${ButtonText}</div></div>`;
20
+ document.body.appendChild(element);
21
+ document.getElementById('mix-msg-button').addEventListener('click',()=>{
22
+ const element = document.getElementById('mix-msg');
23
+ document.body.removeChild(element);
24
+ resolve();
25
+ })
26
+ });
27
+ }
28
+ export const mixDialog = (op)=>{
29
+ return new Promise((resolve, reject) => {
30
+ const Title = op.title
31
+ const Message = op.message
32
+ const ConfirmButtonText = op.confirmButtonText
33
+ const CancelButtonText = op.cancelButtonText
34
+ const element = document.createElement('div');
35
+ element.id = 'mix-dialog';
36
+ element.innerHTML = `<div id="mix-dialog-container"><div id="mix-dialog-title">${Title}</div><div id="mix-dialog-message">${Message}</div><div id="mix-dialog-button"><div id="mix-dialog-confirm-button">${ConfirmButtonText}</div><div id="mix-dialog-cancel-button">${CancelButtonText}</div></div></div>`;
37
+ document.body.appendChild(element);
38
+ document.getElementById('mix-dialog-confirm-button').addEventListener('click',()=>{
39
+ const element = document.getElementById('mix-dialog');
40
+ document.body.removeChild(element);
41
+ resolve();
42
+ })
43
+ document.getElementById('mix-dialog-cancel-button').addEventListener('click',()=>{
44
+ const element = document.getElementById('mix-dialog');
45
+ document.body.removeChild(element);
46
+ reject();
47
+ })
48
+ });
49
+ }
50
+ export const mixFloatingWindowData = (op)=>{
51
+ const Url = op.Url;
52
+ const Title = op.Title;
53
+ const Detail = op.Detail;
54
+ const Params = op.Params;
55
+ const Icon = op.Icon;
56
+ op.Fn.putCookieInfo('mixFloatingWindowData', {Url, Title, Detail, Params, Icon})
57
+ }
58
+ export const mixFloatingWindowRender = (op) =>{
59
+ const ClickBack = op.ClickBack;
60
+ const mixFloatingWindowData = ClickBack.getCookieInfo('mixFloatingWindowData')
61
+ const Url = mixFloatingWindowData.Url;
62
+ const Title = mixFloatingWindowData.Title;
63
+ const Detail = mixFloatingWindowData.Detail;
64
+ const Params = mixFloatingWindowData.Params;
65
+ const Icon = mixFloatingWindowData.Icon;
66
+ if(!Url) return;
67
+ const element = document.createElement('div');
68
+ element.id = 'mix-floating-window-data';
69
+ element.innerHTML = `<img id="mix-floating-window-img" src=${Icon}></img><div id="mix-floating-window-container"><div id="mix-floating-window-title">${Title}</div><div id="mix-floating-window-message">${Detail}</div></div>`;
70
+ document.body.appendChild(element);
71
+ const dom = document.getElementById('mix-floating-window-data')
72
+ let startX = 0
73
+ let startY = 0
74
+ let startLeft = 0
75
+ let startTop = 0
76
+ dom.addEventListener('click',(e)=>{
77
+ ClickBack.Goto({Url,Params})
78
+ })
79
+ dom.addEventListener('touchstart',(e)=>{
80
+ startX = e.touches[0].clientX;
81
+ startY = e.touches[0].clientY;
82
+ startLeft = parseInt(window.getComputedStyle(dom).left, 10);
83
+ startTop = parseInt(window.getComputedStyle(dom).top, 10);
84
+ })
85
+ dom.addEventListener('touchmove',(e)=>{
86
+ // 计算移动的距离
87
+ var dx = e.touches[0].clientX - startX;
88
+ var dy = e.touches[0].clientY - startY;
89
+ // 计算新的位置
90
+ var newLeft = startLeft + dx;
91
+ var newTop = startTop + dy;
92
+ newLeft = newLeft < 0 ? 0 : newLeft > window.innerWidth - dom.offsetWidth ? window.innerWidth - dom.offsetWidth : newLeft;
93
+ newTop = newTop < 0 ? 0 : newTop > window.innerHeight - dom.offsetHeight ? window.innerHeight - dom.offsetHeight : newTop;
94
+ // 更新元素的位置
95
+ dom.style.left = newLeft + 'px';
96
+ dom.style.top = newTop + 'px';
97
+ })
98
+ }