浏览代码

init 大宋

dufeng 3 月之前
父节点
当前提交
b240df93a8
共有 6 个文件被更改,包括 244 次插入165 次删除
  1. 34 34
      androidPrivacy.json
  2. 10 0
      api/core/api.js
  3. 14 4
      manifest.json
  4. 1 1
      modifyManifest.js
  5. 183 124
      pages/webViews/webViews.vue
  6. 2 2
      utils/config.js

+ 34 - 34
androidPrivacy.json

@@ -1,38 +1,38 @@
 {
-  "version": "1",
-  "prompt": "template",
-  "title": "服务协议和隐私政策",
-  "message": "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://90.5000v.com/userProtocol.html\">《服务协议》</a>和<a href=\"https://90.5000v.com/PrivacyPolicy.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
-  "buttonAccept": "同意并接受",
-  "buttonRefuse": "暂不同意",
-  "hrefLoader": "system",
-  "backToExit":"false",
-  "second": {
-    "title": "确认提示",
-    "message": "  进入应用前,你需先同意<a href=\"https://90.5000v.com/userProtocol.html\">《服务协议》</a>和<a href=\"https://90.5000v.com/PrivacyPolicy.html\">《隐私政策》</a>,否则将退出应用。",
-    "buttonAccept": "同意并继续",
-    "buttonRefuse": "退出应用"
-  },
-  "disagreeMode":{
-    "support": false,
-    "loadNativePlugins": false,
-    "visitorEntry": false,
-    "showAlways": false
-  },
-  "styles": {
-    "backgroundColor": "#f2f2f2",
-    "borderRadius":"5px",
-    "title": {
-      "color": "#333333"
+    "version" : "1",
+    "prompt" : "template",
+    "title" : "服务协议和隐私政策",
+    "message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://90.5000v.com/userProtocol.html\">《服务协议》</a>和<a href=\"https://90.5000v.com/PrivacyPolicy.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
+    "buttonAccept" : "同意并接受",
+    "buttonRefuse" : "暂不同意",
+    "hrefLoader" : "system",
+    "backToExit" : "false",
+    "second" : {
+        "title" : "确认提示",
+        "message" : "  进入应用前,你需先同意<a href=\"https://90.5000v.com/userProtocol.html\">《服务协议》</a>和<a href=\"https://90.5000v.com/PrivacyPolicy.html\">《隐私政策》</a>,否则将退出应用。",
+        "buttonAccept" : "同意并继续",
+        "buttonRefuse" : "退出应用"
     },
-    "buttonAccept": {
-      "color": "#333333"
+    "disagreeMode" : {
+        "support" : false,
+        "loadNativePlugins" : false,
+        "visitorEntry" : false,
+        "showAlways" : false
     },
-    "buttonRefuse": {
-      "color": "#00aaff"
-    },
-    "buttonVisitor": {
-      "color": "#00aaff"
+    "styles" : {
+        "backgroundColor" : "#f2f2f2",
+        "borderRadius" : "5px",
+        "title" : {
+            "color" : "#333333"
+        },
+        "buttonAccept" : {
+            "color" : "#333333"
+        },
+        "buttonRefuse" : {
+            "color" : "#00aaff"
+        },
+        "buttonVisitor" : {
+            "color" : "#00aaff"
+        }
     }
-  }
-}
+}

+ 10 - 0
api/core/api.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request.js'
+
+// 定位数据发送
+export function sendPos(params) {
+	return request({
+		url: '/core/api/pad/sendPos',
+		method: 'POST', 
+		params
+	})
+}

+ 14 - 4
manifest.json

@@ -1,5 +1,5 @@
 {
-    "name" : "车辆定位",
+    "name" : "御河调度",
     "appid" : "__UNI__C20958D",
     "description" : "",
     "versionName" : "1.0.0",
@@ -17,7 +17,9 @@
             "delay" : 0
         },
         /* 模块配置 */
-        "modules" : {},
+        "modules" : {
+            "Geolocation" : {}
+        },
         /* 应用发布信息 */
         "distribute" : {
             /* android打包配置 */
@@ -47,7 +49,15 @@
             },
             /* SDK配置 */
             "sdkConfigs" : {
-                "ad" : {}
+                "ad" : {},
+                "geolocation" : {
+                    "amap" : {
+                        "name" : "amapNbtPP23y",
+                        "__platform__" : [ "ios", "android" ],
+                        "appkey_ios" : "742e5b0ff9aa0bf07aef0729fce1cbf8",
+                        "appkey_android" : "7d8589a408c322f08a3f8545e2383285"
+                    }
+                }
             },
             "icons" : {
                 "android" : {
@@ -133,6 +143,6 @@
             }
         },
         "template" : "index.html",
-        "title" : "车辆定位"
+        "title" : "御河调度"
     }
 }

+ 1 - 1
modifyManifest.js

@@ -43,7 +43,7 @@ function replaceManifest(path, value) {
 // 动态配置appid
 if (PLATFORM === "enterprises") {
   // 企事业
-  let title = '"车辆定位"'
+  let title = '"御河调度"'
   replaceManifest("name", title);
   replaceManifest("h5.router.base", '"/mobile/"');
   replaceManifest("h5.title", title);

+ 183 - 124
pages/webViews/webViews.vue

@@ -4,141 +4,200 @@
 </template>
 
 <script>
-import { getToken } from '@/utils/auth'
-import { server_url } from '@/utils/config.js'
-var wv;
-export default {
-	data() {
-		return {
-			src: '',
-			query: {},
-			webviewServer: server_url,
-
-		};
-	},
-	onLoad(query) {
-		this.query = query
-
-		this.initData(query)
-		
-
-	},
-
-	onReady() {
-		// #ifdef APP-PLUS
-		var self = this;
-		var currentWebview = this.$scope.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效,非v3编译模式使用this.$mp.page.$getAppWebview()
-		setTimeout(function () {
-			wv = currentWebview.children()[0];
-			wv.addEventListener(
-				"progressChanged",
-				function (e) {
-					wv.canBack(function (e) {
-						self.canBack = e.canBack;
-					});
-				},
-				false
-			);
-		}, 500); //如果是页面初始化调用时,需要延时一下
-		// #endif
-	},
-	// 设备上点击返回按钮时的处理
-	onBackPress(e) {
-		if (wv && this.canBack) {
-			wv.back();
-		} else {
-			// 没有可返回的页面了, 可以做些其他的处理, 比如回首页等等
-		}
-		return true;
-	},
-	/* onNavigationBarButtonTap(e) {
-		
-	  // 返回
-	  if (e.index === 0) {
-		// #ifdef H5
-		uni.navigateBack();
-		// #endif
-	 
-		// #ifdef APP-PLUS
-		if (this.canBack) {
-			wv.back();
-		} else {
-			// 没有可返回的页面了, 可以做些其他的处理, 比如回首页等等
-		}
-		// #endif
-	  }
-	  // 首页
-	  if (e.index === 1) {
-		// 显示tabbar
-		//uni.showTabBar({
-		//  animation: false
-		//});
-		uni.switchTab({
-		  url: '/pages/index/index'
-		});
-	  }
-	}, */
-	watch: {
-		authtoken: {
-			immediate: true,
-			deep: true,
-			handler(newVal) {
-				// console.log(newVal,'newValnewValnewVal')
-				// this.initData(this.query)
-			}
-		}
-	},
-	computed: {
-		token() {
-			return this.$store.state.user.token
-		}
-	},
-	methods: {
+	import { sendPos  } from "@/api/core/api";
+	import {
+		server_url
+	} from '@/utils/config.js'
+	var wv;
+	export default {
+		data() {
+			return {
+				timer: '',
+				src: '',
+				query: {},
+				webviewServer: server_url,
+				uuid: '',
+			};
+		},
+		onLoad(query) {
+			this.query = query
+
+			this.initData(query)
+
+
+		},
 
-		
-		
-		getUuid() {
-			var uuid = "";
+		onReady() {
 			// #ifdef APP-PLUS
-			if (plus.os.name == "Android") {
-				try {
-					var Build = plus.android.importClass("android.os.Build");
-					var serial = Build.SERIAL;
-					var mainActivity = plus.android.runtimeMainActivity();
-					var Settings = plus.android.importClass("android.provider.Settings");
-					var ANDROID_ID = Settings.Secure.getString(mainActivity.getContentResolver(), Settings.Secure.ANDROID_ID)
-					uuid = `${ANDROID_ID}-${serial}`
-				} catch (e) {
-					console.log("获取设备唯一标识失败:", e);
-				}
-			}
+			var self = this;
+			var currentWebview = this.$scope
+				.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效,非v3编译模式使用this.$mp.page.$getAppWebview()
+			setTimeout(function() {
+				wv = currentWebview.children()[0];
+				wv.addEventListener(
+					"progressChanged",
+					function(e) {
+						wv.canBack(function(e) {
+							self.canBack = e.canBack;
+						});
+					},
+					false
+				);
+			}, 500); //如果是页面初始化调用时,需要延时一下
 			// #endif
-			return uuid;
 		},
-		
-		
-		initData(query) {
-
+		// 设备上点击返回按钮时的处理
+		onBackPress(e) {
+			if (wv && this.canBack) {
+				wv.back();
+			} else {
+				// 没有可返回的页面了, 可以做些其他的处理, 比如回首页等等
+			}
+			return true;
+		},
+		/* onNavigationBarButtonTap(e) {
 			
-			let urlParams = ''
-			for (let key in query) {
-				if (key != 'token') {
-					urlParams += `&${key}=${query[key]}`
+		  // 返回
+		  if (e.index === 0) {
+			// #ifdef H5
+			uni.navigateBack();
+			// #endif
+		 
+			// #ifdef APP-PLUS
+			if (this.canBack) {
+				wv.back();
+			} else {
+				// 没有可返回的页面了, 可以做些其他的处理, 比如回首页等等
+			}
+			// #endif
+		  }
+		  // 首页
+		  if (e.index === 1) {
+			// 显示tabbar
+			//uni.showTabBar({
+			//  animation: false
+			//});
+			uni.switchTab({
+			  url: '/pages/index/index'
+			});
+		  }
+		}, */
+		watch: {
+			authtoken: {
+				immediate: true,
+				deep: true,
+				handler(newVal) {
+					// console.log(newVal,'newValnewValnewVal')
+					// this.initData(this.query)
 				}
 			}
-			urlParams += `&uuid=${this.getUuid()}`
-			urlParams = urlParams.replace('&', '')
-			this.src = `${this.webviewServer}/mobile/pages/attachedVessel/index/?${urlParams}`
-			console.log('webview地址', this.src)
 		},
-		getLocation() {
-
+		computed: {
+			token() {
+				return this.$store.state.user.token
+			}
 		},
-		scanCode() {
+		methods: {
+
+
+
+			getUuid() {
+				var uuid = "";
+				// #ifdef APP-PLUS
+				if (plus.os.name == "Android") {
+					try {
+						var Build = plus.android.importClass("android.os.Build");
+						var serial = Build.SERIAL;
+						var mainActivity = plus.android.runtimeMainActivity();
+						var Settings = plus.android.importClass("android.provider.Settings");
+						var ANDROID_ID = Settings.Secure.getString(mainActivity.getContentResolver(), Settings.Secure
+							.ANDROID_ID)
+						uuid = `${ANDROID_ID}-${serial}`
+					} catch (e) {
+						console.log("获取设备唯一标识失败:", e);
+					}
+				}
+				// #endif
+				return uuid;
+			},
+
+
+			initData(query) {
+
 
+				let urlParams = ''
+				for (let key in query) {
+					if (key != 'token') {
+						urlParams += `&${key}=${query[key]}`
+					}
+				}
+				urlParams += `&uuid=${this.getUuid()}`
+				urlParams = urlParams.replace('&', '')
+				this.src = `${this.webviewServer}/mobile/pages/attachedVessel/index/?${urlParams}`
+				console.log('webview地址', this.src)
+				this.uuid = this.getUuid()
+				//测试背景音频播放
+				// try {
+				// 	const bgAudioManager = uni.getBackgroundAudioManager();
+				// 	bgAudioManager.title = '致爱丽丝';
+				// 	bgAudioManager.singer = '暂无';
+				// 	bgAudioManager.coverImgUrl = 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/music-a.png';
+				// 	bgAudioManager.src = 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3';
+
+				// } catch (error) {
+				// 	//TODO handle the exception
+				// 	 console.log('语音播报失败', error)
+				// }
+				try {
+					let this_ = this
+					this.timer = setInterval(() => {
+						uni.getLocation({
+							type: 'gcj02',
+							isHighAccuracy: true,
+							success: function(res) {
+								console.log('持续位置信息', res)
+								// console.log('当前位置的经度:' + res.longitude);
+								// console.log('当前位置的纬度:' + res.latitude);
+								let datas = {
+									deviceId:this_.uuid,
+									gpsTime:this_.dayjs().format('YYYY-MM-DD HH:mm:ss'),
+									lat02:res.latitude,
+									lng02:res.longitude,
+									accuracy:res.accuracy,
+									speed:res.speed
+								}
+								console.log('上传定位信息',datas)
+								sendPos(datas).then(res => {
+									console.log('位置信息上传成功', res)
+								}).catch(err => {
+									console.log('位置信息上传失败', err)
+								})
+							}
+						});
+					}, 8 * 1000)
+					// uni.startLocationUpdate({
+					// 	type:'gcj02',
+					// 	// success: res => console.log('开启小程序接收位置消息成功'),
+					// 	fail: err => console.error('开启接收位置消息失败:', err),
+					// 	complete: msg => console.log('调用开启接收位置消息 API 完成')
+					// });
+
+					// uni.onLocationChange((res) => {
+					// 	console.log('持续位置信息', res)
+
+					// });
+				} catch (error) {
+					console.log('获取定位失败', error)
+				}
+			},
+			getLocation() {
+
+			},
+			scanCode() {
+
+			}
 		}
 	}
-}
 </script>
 
-<style lang="scss"></style>
+<style lang="scss"></style>

+ 2 - 2
utils/config.js

@@ -20,8 +20,8 @@ let url_all,ws_url_all
 
 if (PLATFORM === "enterprises") {
   // 企事业
-	 url_all = { 'DEV': 'http://61.53.66.104:8011', 'BUILD': 'http://61.53.66.104:8011' }	 // 非h5配置
-	 ws_url_all = { 'DEV': 'http://61.53.66.104:8011', 'BUILD': 'http://61.53.66.104:8011' }	 // 非h5配置
+	 url_all = { 'DEV': 'https://yhdd.dasongyuhe.com', 'BUILD': 'https://yhdd.dasongyuhe.com' }	 // 非h5配置
+	 ws_url_all = { 'DEV': 'https://yhdd.dasongyuhe.com', 'BUILD': 'https://yhdd.dasongyuhe.com' }	 // 非h5配置
 }else if (PLATFORM === "sanitation") {
 	 url_all = { 'DEV': 'http://tq.5000v.com:8025', 'BUILD': 'http://tq.5000v.com:8025' }	 // 非h5配置
 	 ws_url_all = { 'DEV': 'http://tq.5000v.com:8025', 'BUILD': 'http://tq.5000v.com:8025' }	 // 非h5配置