Ming před 4 roky
rodič
revize
ae0019106d

+ 5 - 0
common/common.js

@@ -17,7 +17,12 @@ function noMultipleClicks(methods) {
     }
 }
 
+// const websiteUrl = 'https://qhome.usky.cn';  
+// const BASE_URL = 'https://qhome.usky.cn/USKYZHAF/USKYZHAF.php/Home/'
+
 //导出
 export default {
     noMultipleClicks,//禁止多次点击
+	// websiteUrl,
+	// BASE_URL
 }

+ 23 - 22
main.js

@@ -1,22 +1,26 @@
 import Vue from 'vue'
-import App from './App'
-import {myRequest} from './util/api.js'
- 
- 
- Vue.prototype.$myRequest = myRequest
-
-// 引入colorui组件
-import cuCustom from 'colorui/components/cu-custom.vue'
-Vue.component('cu-custom',cuCustom)
-
- //配置公共方法
- import common from './common/common.js'
- Vue.prototype.$noMultipleClicks = common.noMultipleClicks; // (禁止重复点击)
- 
- 
- import JsonExcel from 'vue-json-excel'
- Vue.component('downloadExcel', JsonExcel)
- 
+import App from './App'
+
+import {
+	myRequest
+} from './util/api.js'
+Vue.prototype.$myRequest = myRequest
+
+// 引入colorui组件
+import cuCustom from 'colorui/components/cu-custom.vue'
+Vue.component('cu-custom', cuCustom)
+
+//配置公共方法
+import common from './common/common.js'
+Vue.prototype.$noMultipleClicks = common.noMultipleClicks; // (禁止重复点击)
+// Vue.prototype.$websiteUrl = common.websiteUrl;
+// Vue.prototype.$BASE_URL = common.BASE_URL;
+Vue.prototype.$websiteUrl =  'https://qhome.usky.cn';
+Vue.prototype.$BASE_URL = 'https://qhome.usky.cn/USKYZHAF/USKYZHAF.php/Home/';
+
+
+import JsonExcel from 'vue-json-excel'
+Vue.component('downloadExcel', JsonExcel)
 
 
 Vue.config.productionTip = false
@@ -24,9 +28,6 @@ Vue.config.productionTip = false
 App.mpType = 'app'
 
 const app = new Vue({
-    ...App
+	...App
 })
 app.$mount()
-
-
-

+ 12 - 1
manifest.json

@@ -123,7 +123,18 @@
             "mode" : "hash"
         },
         "devServer" : {
-            "https" : false
+            "https" : false,
+			"proxy": {  
+					"/web": {  
+						"target": "https://wx.ewoogi.com/wx",
+						"changeOrigin": true,   
+						"secure": false,
+						"pathRewrite": {
+							"^/web": "/"  
+						}  
+					}  
+				}  
+		
         }
     }
 }

+ 19 - 11
pages/deviceManage/deviceManage.vue

@@ -45,7 +45,7 @@
 			<view class="processList deviceRegistList" style="height: calc(100vh - 470rpx);">
 				<checkbox-group @change="changeCheckbox">
 					<view class="cu-list menu-avatar ">
-						<view class=" site-item text-center margin-top" v-if="!newDeviceManage.length">暂无结果</view>
+						<view class=" site-item text-center margin-top" v-if="!this.deviceManage.length&&this.deviceManage==1">暂无数据</view>
 						<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
 							v-for="(item,index) in deviceManage" :key="index" :data-target="'move-box-' + index">
 							<view class="cu-form-group margin-top">
@@ -101,16 +101,16 @@
 			</view>
 			<view class="share-item  text-center">
 				<view><text class="icon iconfont margin-xs" style="color:#FF642E">&#xe66e;</text></view>
-				<view @tap="showModal" data-target="DialogModal" v-if="this.exportData.length">
+				<view @tap="showModal" data-target="DialogModal">
 						导出
 				</view>
-				<view @tap="showModal" data-target="DialogModal" v-else>
+				<!-- <view @tap="showModal" data-target="DialogModal" v-else>
 					<download-excel class="export-excel-wrapper" :data="exportData" :fields="json_fields" header='导出数据'
 						name="设备管理数据表.xls">
 						导出
 					</download-excel>
 					
-				</view>
+				</view> -->
 
 			</view>
 			<view class="checkAll" style="display:inline-block">
@@ -190,6 +190,7 @@
 		},
 		data() {
 			return {
+				deviceManage: 0,
 				
 				json_fields: {
 					"单位编号": "company", //常规字段
@@ -286,6 +287,7 @@
 					showLoading: true
 				})
 				this.deviceManage = res.data.data;
+				this.deviceManageRes=1;
 			},
 
 			// 页面跳转
@@ -301,14 +303,20 @@
 			},
 			//导出弹框
 			showModal(e) {
-				// alert(1)
-				if (this.checkedArr.length == 0) {
-					alert('请选择至少一条需要导出的数据')
-				} else {
-					this.modalName = e.currentTarget.dataset.target;
-					
-					// this.getDataExport()
+				var ua = window.navigator.userAgent.toLowerCase();
+				if(ua.match(/MicroMessenger/i) == 'micromessenger'){
+					alert('点击右上角 ┇,选择默认浏览器进行导出操作')
+				}else{
+					if (this.checkedArr.length == 0) {
+						alert('请选择至少一条需要导出的数据')
+					} else {
+						
+						this.modalName = e.currentTarget.dataset.target;
+						
+						this.getDataExport()
+					}
 				}
+				
 			},
 			getDataExport() {
 				const base64 = s => window.btoa(unescape(encodeURIComponent(s)));

+ 99 - 55
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view style="background:#f1f1f1;" class="padding-sm">
-		
+
 		<!-- 下拉选择 -->
 		<view class="searchSelect shadow" v-if="flag">
 			<view class="cu-bar search bg-white">
@@ -18,7 +18,7 @@
 			</view>
 		</view>
 		<!-- 下拉选择 end -->
-		
+
 		<!-- <search-Select :flag="flag"></search-Select> -->
 
 		<!-- 图表 -->
@@ -37,12 +37,12 @@
 				<view v-if="Inv == 1">
 					<chart2 :bindData="staticData"></chart2>
 				</view>
-				<view v-if="Inv == 2" class="chart3-box" >
+				<view v-if="Inv == 2" class="chart3-box">
 					<ul class="chart3-icon">
 						<li @tap="goOfflineList()">
 							<image src="../../static/chart3-1.png" style="width:64rpx;height:64rpx"></image>
 						</li>
-						<li  @tap="goFaultList()">
+						<li @tap="goFaultList()">
 							<image src="../../static/chart3-2.png" style="width:64rpx;height:64rpx"></image>
 						</li>
 						<li>
@@ -55,7 +55,7 @@
 							<image src="../../static/chart3-5.png" style="width:64rpx;height:64rpx"></image>
 						</li>
 					</ul>
-					<chart3 :bindData="staticData" >
+					<chart3 :bindData="staticData">
 					</chart3>
 				</view>
 			</view>
@@ -83,12 +83,15 @@
 	import chart from './components/chart/chart.vue';
 	import chart2 from './components/chart2/chart2.vue';
 	import chart3 from './components/chart3/chart3.vue';
-	
+
 	import searchSelect from './components/searchSelect/searchSelect.vue';
-	
-	
+
+
 	import json from '../../data/json.js';
 
+	//引入js sdk的封装
+	import * as jwx from '../../util/jssdk.js'
+
 	export default {
 		components: {
 			chart,
@@ -104,14 +107,14 @@
 				cuIconList: json.cuIconList,
 				Inv: 0,
 
-				
+
 				flag: false,
 				searchList: [],
 				searchList2: [],
 
 				searchInput: '',
-				selectedCode:10012,
-				getData:[]
+				selectedCode: 10012,
+				getData: []
 
 			};
 		},
@@ -119,40 +122,81 @@
 		// 自定义导航事件
 		onNavigationBarButtonTap(e) {
 			if (e.float == 'right') {
-				console.log("你点击了扫一扫")
+				console.log("你点击了扫一扫");
+				this.scanQRCode();
 			} else {
 				this.showTag()
 			}
 		},
 
 		onLoad(option) {
-			
-			var res=uni.getStorageSync('selectedCode');
-			var res2=uni.getStorageSync('selectedName');
-			if(res){
+
+			console.log('$websiteUrl')
+			console.log(this.$websiteUrl)
+			console.log(this.$BASE_URL)
+			// console.log(BASE_URL)
+			var res = uni.getStorageSync('selectedCode');
+			var res2 = uni.getStorageSync('selectedName');
+			if (res) {
 				uni.setNavigationBarTitle({
 					title: res2
 				});
 			}
-			
-			
-			
+
+
+
 			// 数据渲染
 			this.getHomeData();
-			
+
 
 			// 图表切换渲染
 			this.hackReset = false;
 			this.$nextTick(() => {
 				this.hackReset = true;
 			})
-			
+
 			this.getHandleData();
 			this.getSearchList()
-	
-			
+
+
 		},
 		methods: {
+
+			//新增
+			scanQRCode() {
+				// alert(1)
+				// 将this赋值给that
+				let that = this;
+				// 微信公众号获取位置
+				jwx.configWeiXin(jweixin => {
+					wx.scanQRCode({
+						needResult: 0, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+						scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
+						success: function(res) {
+							console.log('res')
+							console.log(res)
+							// that.longitude=res.longitude
+							// var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
+						}
+					});
+
+
+					// jwx.configWeiXin(jweixin => {
+					// 	wx.getLocation({
+					// 	  type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
+					// 	  success: function (res) {
+					// 		that.longitude=res.longitude
+					// 		that.latitude=res.latitude
+					// 	  }
+					// 	});
+					// });
+				});
+
+
+			},
+
+
+
 			// 九宫格页面跳转
 			navItemClick(index) {
 				let url = "";
@@ -184,13 +228,13 @@
 						// case 8:
 						// 	url = "/pages/test/test"
 						// 	break;
-						case 9:
-							url = "/pages/deviceManage/deviceManage"
-							break;
-						case 10:
-							url = "/pages/accountManage/accountManage"
-							break;
-						
+					case 9:
+						url = "/pages/deviceManage/deviceManage"
+						break;
+					case 10:
+						url = "/pages/accountManage/accountManage"
+						break;
+
 					default:
 						break;
 				}
@@ -214,15 +258,15 @@
 				uni.navigateTo({
 					url: '/pages/deviceOffLine/deviceOffLine?type=离线',
 				});
-				
+
 			},
 			goFaultList() {
 				uni.navigateTo({
 					url: '/pages/deviceOffLine/deviceOffLine?type=故障',
 				});
-				
+
 			},
-			
+
 
 			//站点下拉请求
 			async getSearchList(param = {}) {
@@ -230,11 +274,11 @@
 					url: 'Index/getCompanyList',
 					data: param
 				})
-				this.getData=res.data.data
-	
-				if(!uni.getStorageSync('selectedCode')){
-					uni.setStorageSync('selectedCode',this.getData[0].owner_code);
-					uni.setStorageSync('selectedName',this.getData[0].owner_name);
+				this.getData = res.data.data
+
+				if (!uni.getStorageSync('selectedCode')) {
+					uni.setStorageSync('selectedCode', this.getData[0].owner_code);
+					uni.setStorageSync('selectedName', this.getData[0].owner_name);
 				}
 				res.data.data.forEach(item => {
 					this.searchList.push(item)
@@ -242,21 +286,21 @@
 				});
 				console.log('this.searchList')
 				console.log(this.searchList)
-				
-				
+
+
 			},
-			
+
 			showTag() {
 				this.flag = !this.flag;
 			},
-			
-			
+
+
 			// 下拉选择
 			clickSelectItem(item, index) {
-				this.selectedCode=item.owner_code;
-				uni.setStorageSync('selectedCode',item.owner_code);
-				uni.setStorageSync('selectedName',item.owner_name);
-				this.searchInput=item.owner_name;
+				this.selectedCode = item.owner_code;
+				uni.setStorageSync('selectedCode', item.owner_code);
+				uni.setStorageSync('selectedName', item.owner_name);
+				this.searchInput = item.owner_name;
 				uni.setNavigationBarTitle({
 					title: this.searchInput
 				});
@@ -267,7 +311,7 @@
 				this.searchList = newlist
 			},
 
-		
+
 			InputFocus(e) {
 				this.InputBottom = e.detail.height
 			},
@@ -279,7 +323,7 @@
 				that.navIdx = Inv;
 
 			},
-			
+
 			//echarts图表请求
 			async getHomeData(param = {}) {
 				const res = await this.$myRequest({
@@ -288,8 +332,8 @@
 				})
 				// console.log('首页请求staticData')
 				// console.log(res.data.data[0])
-				this.staticData=res.data.data[0]
-				
+				this.staticData = res.data.data[0]
+
 			},
 			// 未处理告警请求
 			async getHandleData() {
@@ -297,13 +341,13 @@
 					url: 'Index/getFunctionalModuleStatistics',
 					showLoading: true
 				})
-				
+
 				this.cuIconList[0].badge = res.data.data[0].comprehensive_alarm_count;
 				this.cuIconList[2].badge = res.data.data[0].fire_brigade_inspector_count
 			},
 
 
-		
+
 		}
 	}
 </script>
@@ -365,11 +409,11 @@
 	}
 
 	.chart3-icon {
-		width:90%;
+		width: 90%;
 		position: absolute;
 		top: 60rpx;
 		left: 30rpx;
-		z-index:1;
+		z-index: 1;
 	}
 
 	.chart3-icon li {

+ 1 - 1
pages/repair/repairDetail/repairDetail.vue

@@ -84,7 +84,7 @@
 			upFile(input, event) {
 				var _self = this;
 				uni.uploadFile({
-					url: 'https://qhome.usky.cn/USKYZHAF/USKYZHAF.php/Home/Inspection/setUpload',
+					url: this.$BASE_URL+'/Inspection/setUpload',
 					files: [{
 						file: input.files[0],
 						uri: event.srcElement.value

+ 1 - 1
pages/weiBao/planDetail/planDetail.vue

@@ -93,7 +93,7 @@
 			upFile(input, event) {
 				var _self = this;
 				uni.uploadFile({
-					url: 'https://qhome.usky.cn/USKYZHAF/USKYZHAF.php/Home/Inspection/setUpload',
+					url: this.$BASE_URL+'Inspection/setUpload',
 					files: [{
 						file: input.files[0],
 						uri: event.srcElement.value

+ 3 - 1
pages/weiBao/planDetailDone/planDetailDone.vue

@@ -39,7 +39,9 @@
 					上传图片:
 				</view>
 			
-				<img :src="`https://qhome.usky.cn${this.getData.report_photos}`" alt="" style="max-width:50%">  
+				<!-- <img :src="`https://qhome.usky.cn${this.getData.report_photos}`" alt="" style="max-width:50%">  -->
+				<img :src="`${this.$BASE_URL}${this.getData.report_photos}`" alt="" style="max-width:50%">
+				
 			</view>
 			
 			<view class="form-item">

+ 1 - 1
pages/xunJian/planDetail/planDetail.vue

@@ -93,7 +93,7 @@
 			upFile(input, event) {
 				var _self = this;
 				uni.uploadFile({
-					url: 'https://qhome.usky.cn/USKYZHAF/USKYZHAF.php/Home/Inspection/setUpload',
+					url:this.$BASE_URL+'Inspection/setUpload',
 					files: [{
 						file: input.files[0],
 						uri: event.srcElement.value

+ 2 - 1
pages/xunJian/planDetailDone/planDetailDone.vue

@@ -39,7 +39,8 @@
 					上传图片:
 				</view>
 			
-				<img :src="`https://qhome.usky.cn${this.getData.report_photos}`" alt="" style="max-width:50%">  
+				<!-- <img :src="`https://qhome.usky.cn${this.getData.report_photos}`" alt="" style="max-width:50%">  -->
+				<img :src="`${this.$BASE_URL}${this.getData.report_photos}`" alt="" style="max-width:50%">
 			</view>
 			
 			<view class="form-item">

+ 4 - 0
util/api.js

@@ -61,6 +61,10 @@ export const myRequest = (options) => {
 		})
 	})
 
+}
+
+export default {
+    BASE_URL
 }
 
 

+ 0 - 74
util/auth.js

@@ -1,74 +0,0 @@
-
-// start
-	getUrlCode() {
-		var url = location.search
-		this.winUrl = url
-		var theRequest = new Object()
-		if (url.indexOf("?") != -1) {
-			var str = url.substr(1)
-			var strs = str.split("&")
-			for (var i = 0; i < strs.length; i++) {
-				theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1])
-			}
-		}
-		return theRequest
-	},
-	 getUrlPrams(key) {
-		var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)", "i");
-		var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
-		var context = "";
-		if (r != null) {
-			context = r[2];
-		}
-		return context;
-	},
-
-export const authInit = (options) => {
-
-	var appId = "wx4eab2e3b5531d58b";
-	var params = {};
-	var CODE = getUrlCode();
-	var code = CODE['code'];
-	// alert("CODE="+code);
-	if (code) {
-	 // console.log("打印参数",JSON.stringify(params));
-	 params.code=code;
-	 // alert(code);
-	 // alert(JSON.stringify(params));
-		   
-	 //使用code请求服务器接口,换取用户用户openID
-	 const res = await this.$myRequest({
-	  url: 'Com/getPageAuthorization',
-	  data:params
-	 })
-	 // alert(res.data.flag);
-	 if(res.data.flag==3000){
-	  alert("授权失败,请重新登录");
-	  uni.navigateTo({
-	   url: '/pages/login/login',
-	  });
-	 }
-	 if(res.data.flag==3002){
-	  alert("授权失败,请重新登录");
-	  uni.navigateTo({
-	   url: '/pages/login/login',
-	  });
-	 }
-	 return "ok";
-	}
-	// alert("授权开始");
-	var cs = {};
-	var curl=window.location.href;
-	cs.curl=curl;
-	// alert("当前页面路径"+curl);
-	const res1 = await this.$myRequest({
-	 url: 'Com/getAuthorizationUrl',
-	 data:cs
-	})
-	// alert(res1.data);
-	var turl=res1.data.turl;
-	// alert(turl)
-	window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri='+turl+'&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect';
-		
-
-}

+ 55 - 0
util/jssdk.js

@@ -0,0 +1,55 @@
+import BASE_URL from './api.js';
+
+// jwx.js
+//#ifdef H5
+const jweixin = require('jweixin-module')
+//#endif
+export function configWeiXin(callback) {
+	const url = window.location.href.split('#')[0];
+	// console.log(111)
+	// console.log(BASE_URL.BASE_URL)
+	// start
+	uni.request({
+		url: "/web/sign.php",
+		// url:"http://s.yxin.tech/sign.php",
+
+
+		// url:`${BASE_URL.BASE_URL}sign.php`,		
+		header: {
+			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
+		},
+		data: {
+			"url": url
+		},
+		method: 'GET',
+		success: (res) => {
+			// console.log('请求的签名的参数')
+			// console.log(res)
+
+			let apiList = [ // 可能需要用到的能力 需要啥就写啥。多写也没有坏处
+				'openLocation',
+				'getLocation',
+				'scanQRCode'
+			];
+			let info = {
+				debug: false, // 调试,发布的时候改为false
+				appId: res.data.appid,
+				nonceStr: res.data.nonceStr,
+				timestamp: parseInt(res.data.timestamp),
+				signature: res.data.sha_str,
+				jsApiList: apiList
+			};
+
+			jweixin.config(info);
+			jweixin.error(err => {
+				console.log('config fail:', err);
+				return
+			});
+
+			jweixin.ready(res => {
+				// if (callback) callback(jweixin);
+			});
+		}
+	});
+	// end
+}