Holla-Tako 7 kuukautta sitten
vanhempi
commit
1c9a8ae57a
26 muutettua tiedostoa jossa 3343 lisäystä ja 3228 poistoa
  1. 7 8
      price-collection/.hbuilderx/launch.json
  2. 6 1
      price-collection/App.vue
  3. 7 0
      price-collection/api/collect.js
  4. 22 4
      price-collection/manifest.json
  5. 1 1
      price-collection/pages/index/index.vue
  6. 24 1
      price-collection/pages/login/index.vue
  7. BIN
      price-collection/unpackage/.DS_Store
  8. BIN
      price-collection/unpackage/cache/apk/__UNI__7ED3A40_cm.apk
  9. 1 1
      price-collection/unpackage/cache/apk/apkurl
  10. 1 1
      price-collection/unpackage/cache/apk/cmManifestCache.json
  11. 4 4
      price-collection/unpackage/cache/wgt/__UNI__7ED3A40/app-service.js
  12. 1 1
      price-collection/unpackage/cache/wgt/__UNI__7ED3A40/app-view.js
  13. 1 1
      price-collection/unpackage/cache/wgt/__UNI__7ED3A40/manifest.json
  14. BIN
      price-collection/unpackage/debug/.DS_Store
  15. BIN
      price-collection/unpackage/debug/android_debug.apk
  16. 4 4
      price-collection/unpackage/dist/build/app-plus/app-service.js
  17. 1 1
      price-collection/unpackage/dist/build/app-plus/app-view.js
  18. 1 1
      price-collection/unpackage/dist/build/app-plus/manifest.json
  19. 1604 1620
      price-collection/unpackage/dist/dev/app-plus/app-service.js
  20. 1602 1578
      price-collection/unpackage/dist/dev/app-plus/app-view.js
  21. 1 1
      price-collection/unpackage/dist/dev/app-plus/manifest.json
  22. BIN
      price-collection/unpackage/release/apk/__UNI__7ED3A40__20240423151540.apk
  23. BIN
      price-collection/unpackage/release/apk/__UNI__7ED3A40__20240423212048.apk
  24. BIN
      price-collection/unpackage/release/apk/__UNI__7ED3A40__20240415160538.apk
  25. 14 0
      price-collection/utils/cache.js
  26. 41 0
      price-collection/utils/pullNotice.js

+ 7 - 8
price-collection/.hbuilderx/launch.json

@@ -2,15 +2,14 @@
2 2
     "version" : "1.0",
3 3
     "configurations" : [
4 4
         {
5
-            "playground" : "standard",
5
+            "playground" : "custom",
6 6
             "type" : "uni-app:app-android"
7 7
         },
8
-	{
9
-		"app-plus" : 
10
-		{
11
-			"launchtype" : "local"
12
-		},
13
-		"type" : "uniCloud"
14
-	}
8
+        {
9
+            "app-plus" : {
10
+                "launchtype" : "local"
11
+            },
12
+            "type" : "uniCloud"
13
+        }
15 14
     ]
16 15
 }

+ 6 - 1
price-collection/App.vue

@@ -1,10 +1,15 @@
1 1
 <script>
2
+	import { startPullNotice } from '@/utils/pullNotice.js'
2 3
 	export default {
3
-		onLaunch: function() {
4
+		globalData: {
5
+			isLogin: false,
6
+		},
7
+		onLaunch() {
4 8
 			// console.log('App Launch')
5 9
 		},
6 10
 		onShow: function() {
7 11
 			// console.log('App Show')
12
+			startPullNotice()
8 13
 		},
9 14
 		onHide: function() {
10 15
 			// console.log('App Hide')

+ 7 - 0
price-collection/api/collect.js

@@ -33,4 +33,11 @@ export const addCollect = (data) => {
33 33
 		url: '/client/c/grainPriceCollect/add',
34 34
 		data,
35 35
 	})
36
+}
37
+
38
+export const pullNotice = (data) => {
39
+	return request.get({
40
+		url: '/client/c/remindcycle/task',
41
+		data,
42
+	})
36 43
 }

+ 22 - 4
price-collection/manifest.json

@@ -2,8 +2,8 @@
2 2
     "name" : "粮食价格采集",
3 3
     "appid" : "__UNI__7ED3A40",
4 4
     "description" : "",
5
-    "versionName" : "1.0.0",
6
-    "versionCode" : "100",
5
+    "versionName" : "1.0.7",
6
+    "versionCode" : 107,
7 7
     "transformPx" : false,
8 8
     /* 5+App特有相关 */
9 9
     "app-plus" : {
@@ -18,7 +18,8 @@
18 18
         },
19 19
         /* 模块配置 */
20 20
         "modules" : {
21
-            "Geolocation" : {}
21
+            "Geolocation" : {},
22
+            "Push" : {}
22 23
         },
23 24
         /* 应用发布信息 */
24 25
         "distribute" : {
@@ -53,7 +54,8 @@
53 54
                         "__platform__" : [ "android" ]
54 55
                     }
55 56
                 },
56
-                "ad" : {}
57
+                "ad" : {},
58
+                "push" : {}
57 59
             },
58 60
             "icons" : {
59 61
                 "android" : {
@@ -87,6 +89,22 @@
87 89
                     }
88 90
                 }
89 91
             }
92
+        },
93
+        "nativePlugins" : {
94
+            "Ba-Notify" : {
95
+                "__plugin_info__" : {
96
+                    "name" : "应用消息通知插件(多种样式,新增支持常驻通知模式) Ba-Notify",
97
+                    "description" : "Ba-Notify 是一款功能全面的uniapp消息通知插件,可在状态栏显示各种样式的消息通知。包含普通、常驻、大图、多行、进度、按钮等通知;支持检查、设置、清除通知;支持根据渠道和ID,分类管管理;",
98
+                    "platforms" : "Android",
99
+                    "url" : "https://ext.dcloud.net.cn/plugin?id=9231",
100
+                    "android_package_name" : "uni.UNI7ED3A40",
101
+                    "ios_bundle_id" : "",
102
+                    "isCloud" : true,
103
+                    "bought" : 1,
104
+                    "pid" : "9231",
105
+                    "parameters" : {}
106
+                }
107
+            }
90 108
         }
91 109
     },
92 110
     /* 快应用特有相关 */

+ 1 - 1
price-collection/pages/index/index.vue

@@ -15,7 +15,7 @@
15 15
 			}
16 16
 		},
17 17
 		onLoad() {
18
-
18
+		
19 19
 		},
20 20
 		methods: {
21 21
 

+ 24 - 1
price-collection/pages/login/index.vue

@@ -28,11 +28,14 @@
28 28
 </template>
29 29
 
30 30
 <script>
31
+	// #ifdef APP
32
+	const notify = uni.requireNativePlugin('Ba-Notify')
33
+	// #endif
31 34
 	import {
32 35
 		cryptoPassword,
33 36
 		login
34 37
 	} from '@/api/login.js'
35
-	import { setCache } from '../../utils/cache'
38
+	import { setCache, clearChache } from '../../utils/cache'
36 39
 	export default {
37 40
 		data() {
38 41
 			return {
@@ -42,6 +45,9 @@
42 45
 				}
43 46
 			}
44 47
 		},
48
+		mounted() {
49
+			clearChache('token')
50
+		},
45 51
 		methods: {
46 52
 			login() {
47 53
 				if (
@@ -62,6 +68,7 @@
62 68
 						})
63 69
 					}).then(_ => {
64 70
 						console.log('token 保存成功 跳转首页')
71
+						// getApp().globalData.isLogin = true
65 72
 						this.goIndex()
66 73
 					}).catch(err => {
67 74
 						uni.showToast({
@@ -85,6 +92,22 @@
85 92
 					return false
86 93
 				}
87 94
 				return true
95
+			},
96
+			msg() {
97
+				// #ifdef APP
98
+				notify.show({
99
+					'channelID': '0',
100
+					'channelName': '普通通知',
101
+					'ID': 0,
102
+					'notifyType': 0,
103
+					'ticker': 'Ticker',
104
+					'title': '普通通知111',
105
+					'content': '哈哈哈哈哈',
106
+				},
107
+				(res) => {
108
+					console.log(res)
109
+				});
110
+				// #endif
88 111
 			}
89 112
 		}
90 113
 	}

BIN
price-collection/unpackage/.DS_Store


BIN
price-collection/unpackage/cache/apk/__UNI__7ED3A40_cm.apk


+ 1 - 1
price-collection/unpackage/cache/apk/apkurl

@@ -1 +1 @@
1
-https://app.liuyingyong.cn/build/download/60c17a50-f640-11ee-a0df-038e386ad320
1
+https://app.liuyingyong.cn/build/download/3cb2b1f0-0175-11ef-b9cf-eb8168a9b8e7

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
price-collection/unpackage/cache/apk/cmManifestCache.json


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 4 - 4
price-collection/unpackage/cache/wgt/__UNI__7ED3A40/app-service.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
price-collection/unpackage/cache/wgt/__UNI__7ED3A40/app-view.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
price-collection/unpackage/cache/wgt/__UNI__7ED3A40/manifest.json


BIN
price-collection/unpackage/debug/.DS_Store


BIN
price-collection/unpackage/debug/android_debug.apk


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 4 - 4
price-collection/unpackage/dist/build/app-plus/app-service.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
price-collection/unpackage/dist/build/app-plus/app-view.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
price-collection/unpackage/dist/build/app-plus/manifest.json


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1604 - 1620
price-collection/unpackage/dist/dev/app-plus/app-service.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1602 - 1578
price-collection/unpackage/dist/dev/app-plus/app-view.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
price-collection/unpackage/dist/dev/app-plus/manifest.json


BIN
price-collection/unpackage/release/apk/__UNI__7ED3A40__20240423151540.apk


BIN
price-collection/unpackage/release/apk/__UNI__7ED3A40__20240423212048.apk


BIN
price-collection/unpackage/release/apk/__UNI__7ED3A40__20240415160538.apk


+ 14 - 0
price-collection/utils/cache.js

@@ -26,4 +26,18 @@ export const getCache = (key) => {
26 26
 			}
27 27
 		})
28 28
 	})
29
+}
30
+
31
+export const clearChache = (key) => {
32
+	return new Promise((resolve, reject) => {
33
+		uni.clearStorage({
34
+			key: key,
35
+			success(val) {
36
+				resolve(val)
37
+			},
38
+			fail(err) {
39
+				reject(err)
40
+			}
41
+		})
42
+	}) 
29 43
 }

+ 41 - 0
price-collection/utils/pullNotice.js

@@ -0,0 +1,41 @@
1
+
2
+import { getCache } from "./cache";
3
+import {pullNotice} from '@/api/collect.js'
4
+// #ifdef APP
5
+const notify = uni.requireNativePlugin('Ba-Notify')
6
+// #endif
7
+
8
+let pullNoticeExecutor = null
9
+
10
+export const startPullNotice = () => {
11
+	console.log('开始执行轮询');
12
+	if(pullNoticeExecutor) {
13
+		clearImmediate(pullNoticeExecutor)
14
+	}
15
+	pullNoticeExecutor = setInterval(() => {
16
+		getCache('token').then(res => {
17
+			console.log('token is', res);
18
+			pullNotice().then(resp => {
19
+				console.log('pull', resp);
20
+				if(resp.msg) {
21
+					// #ifdef APP
22
+					notify.show({
23
+						'channelID': '0',
24
+						'channelName': '普通通知',
25
+						'ID': 0,
26
+						'notifyType': 0,
27
+						'ticker': 'Ticker',
28
+						'title': '提醒',
29
+						'content': resp.msg,
30
+					},
31
+					(res) => {
32
+						console.log(res)
33
+					});
34
+					// #endif
35
+				}
36
+			})
37
+		}).catch(err => {
38
+			console.log('token not found', err);
39
+		})
40
+	}, 5 * 60_000)
41
+}