Browse Source

导航接入jssdk功能完善

ming 4 years ago
parent
commit
5b7c1e8012

+ 19 - 3
pages/processedDetail/processedDetail.vue

@@ -32,7 +32,7 @@
 						<text>采集终端:</text>
 						<text>{{detailMessage.deviceCode}}</text>
 					</view>
-					<view>
+					<view  style="word-break:keep-all;white-space:nowrap; ">
 						<text>站点地址:</text>
 						<text>{{detailMessage.address}}<text class="icon iconfont map" @click="mapLocation()">&#xe612;</text></text>
 					</view>
@@ -150,7 +150,10 @@
 	</view>
 </template>
 
-<script>
+<script>
+	//引入js sdk的封装
+	import * as jwx from '../../util/jssdk.js'
+	
 	export default {
 		data() {
 			return {
@@ -202,7 +205,7 @@
 				console.log(this.detailMessage)
 				
 				
-				window.location.href =  'http://apis.map.qq.com/uri/v1/marker?marker=coord:'+parseFloat(this.detailMessage.latitude)+','+parseFloat(this.detailMessage.longitude)+''
+				// window.location.href =  'http://apis.map.qq.com/uri/v1/marker?marker=coord:'+parseFloat(this.detailMessage.latitude)+','+parseFloat(this.detailMessage.longitude)+''
 			
 				// uni.openLocation({
 				// 	latitude: parseInt(this.detailMessage.latitude),
@@ -211,6 +214,19 @@
 				// 		console.log('success');
 				// 	}
 				// });
+				
+				
+				// 微信公众号导航
+				jwx.configWeiXin(jweixin => {
+					let shareInfo = {
+						latitude: parseFloat(this.detailMessage.latitude), // 纬度,浮点数,范围为90 ~ -90
+						longitude: parseFloat(this.detailMessage.longitude), // 经度,浮点数,范围为180 ~ -180。
+						name: this.detailMessage.siteName, // 位置名
+						address: this.detailMessage.address, // 地址详情说明
+						scale: 15, // 地图缩放级别,整型值,范围从1~28。默认为最大
+					};
+					jweixin.openLocation(shareInfo);
+				});
 			},
 	
 			// 页面跳转

+ 14 - 13
pages/siteManage/siteManage.vue

@@ -52,9 +52,10 @@
 <script>
 
 </script>
-<script>
+<script>
+	
 	//引入js sdk的封装
-	// import * as jwx from '../../util/jssdk.js'
+	import * as jwx from '../../util/jssdk.js'
 
 	export default {
 		data() {
@@ -113,7 +114,7 @@
 			mapLocation(item) {
 				
 				//h5 地图导航
-				window.location.href =  'http://apis.map.qq.com/uri/v1/marker?marker=coord:'+parseFloat(item.latitude)+','+parseFloat(item.longitude)+'' 
+				// window.location.href =  'http://apis.map.qq.com/uri/v1/marker?marker=coord:'+parseFloat(item.latitude)+','+parseFloat(item.longitude)+'' 
 
 				//app导航
 				// uni.openLocation({
@@ -125,16 +126,16 @@
 				// });
 
 				// 微信公众号导航
-				// jwx.configWeiXin(jweixin => {
-				// 	let shareInfo = {
-				// 		latitude: parseFloat(item.latitude), // 纬度,浮点数,范围为90 ~ -90
-				// 		longitude: parseFloat(item.longitude), // 经度,浮点数,范围为180 ~ -180。
-				// 		name: item.siteName, // 位置名
-				// 		address: item.address, // 地址详情说明
-				// 		scale: 15, // 地图缩放级别,整型值,范围从1~28。默认为最大
-				// 	};
-				// 	jweixin.openLocation(shareInfo);
-				// });
+				jwx.configWeiXin(jweixin => {
+					let shareInfo = {
+						latitude: parseFloat(item.latitude), // 纬度,浮点数,范围为90 ~ -90
+						longitude: parseFloat(item.longitude), // 经度,浮点数,范围为180 ~ -180。
+						name: item.siteName, // 位置名
+						address: item.address, // 地址详情说明
+						scale: 15, // 地图缩放级别,整型值,范围从1~28。默认为最大
+					};
+					jweixin.openLocation(shareInfo);
+				});
 			},
 
 			async setDelSite(ming = {}) {

+ 20 - 4
pages/unprocessDetail/unprocessDetail.vue

@@ -33,7 +33,7 @@
 						<text>采集终端:</text>
 						<text>{{detailMessage.deviceCode}}</text>
 					</view>
-					<view>
+					<view  style="word-break:keep-all;white-space:nowrap; ">
 						<text>站点地址:</text>
 						<text>{{detailMessage.address}}<text class="icon iconfont map" @click="mapLocation()">&#xe612;</text></text>
 					</view>
@@ -151,7 +151,10 @@
 	</view>
 </template>
 
-<script>
+<script>
+	//引入js sdk的封装
+	import * as jwx from '../../util/jssdk.js'
+	
 	export default {
 		data() {
 			return {
@@ -300,14 +303,27 @@
 
 			mapLocation() {
 				
-				window.location.href =  'http://apis.map.qq.com/uri/v1/marker?marker=coord:'+parseFloat(this.detailMessage.latitude)+','+parseFloat(this.detailMessage.longitude)+''
+				// window.location.href =  'http://apis.map.qq.com/uri/v1/marker?marker=coord:'+parseFloat(this.detailMessage.latitude)+','+parseFloat(this.detailMessage.longitude)+''
+				
 				// uni.openLocation({
 				// 	latitude: parseFloat(this.detailMessage.latitude),
 				// 	longitude: parseFloat(this.detailMessage.longitude),
 				// 	success: function() {
 				// 		console.log('success');
 				// 	}
-				// });
+				// });
+				
+				// 微信公众号导航
+				jwx.configWeiXin(jweixin => {
+					let shareInfo = {
+						latitude: parseFloat(this.detailMessage.latitude), // 纬度,浮点数,范围为90 ~ -90
+						longitude: parseFloat(this.detailMessage.longitude), // 经度,浮点数,范围为180 ~ -180。
+						name: this.detailMessage.siteName, // 位置名
+						address: this.detailMessage.address, // 地址详情说明
+						scale: 15, // 地图缩放级别,整型值,范围从1~28。默认为最大
+					};
+					jweixin.openLocation(shareInfo);
+				});
 			},
 
 			// 页面跳转

+ 1 - 1
util/api.js

@@ -1,4 +1,4 @@
-// const BASE_URL = 'https://iot.usky.cn/USKYOF/USKYOF.php/Home/'
+// const BASE_URL = 'https://iot.usky.cn/USKYOF/USKYOF.php/Home/'   //(测试域名)
 const BASE_URL='https://qhome.usky.cn/USKYOF/USKYOF.php/Home/'
 // 同时发送异步代码的次数,防止一次点击中有多次请求,用于处理
 let ajaxTimes = 0;

+ 13 - 2
util/jssdk.js

@@ -4,27 +4,38 @@ const jweixin = require('jweixin-module')
 //#endif
 export function configWeiXin(callback) {
 	const url = window.location.href.split('#')[0];
+	
 	uni.request({
-		url: 'https://s.yxin.tech/sign.php', //仅为示例,并非真实接口地址。
+		// url: 'https://s.yxin.tech/sign.php', //test-ming
+		url:"https://qhome.usky.cn/sign.php",		
 		header: {
 			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
 		},
+		
 		data:{"url":url},
+		// data:{"turl":url},
 		method: 'GET',
 		success: (res) => {
 			console.log('请求的签名的参数')
 			console.log(res)
+
+			
 			
 			let apiList = [ // 可能需要用到的能力 需要啥就写啥。多写也没有坏处
 				// 'scanQRCode',
 				'openLocation'
 			];
 			let info = {
-				debug: true, // 调试,发布的时候改为false
+				debug: false, // 调试,发布的时候改为false
 				appId: res.data.appid,
+				// appId: res.data.appId,
+				
+				
 				nonceStr: res.data.nonceStr,
 				timestamp: parseInt(res.data.timestamp),
+				
 				signature: res.data.sha_str,
+				// signature: res.data.signature,
 				jsApiList: apiList
 			};