Jelajahi Sumber

公共url提取

ming 3 tahun lalu
induk
melakukan
2c922ab9de

+ 4 - 3
main.js

@@ -1,8 +1,9 @@
 import Vue from 'vue'
 import App from './App'
-import {myRequest} from './util/api.js'
- Vue.prototype.$myRequest = myRequest
- 
+import api from './util/api.js'
+ Vue.prototype.$myRequest = api.myRequest
+ Vue.prototype.$BASE_URL = api.BASE_URL;
+ Vue.prototype.$websiteUrl = api.websiteUrl
  // import wx from 'node_modules/jweixin-module/lib/index'
  
  

+ 1 - 1
pages/eleControl/controlReport/controlReportAdd/controlReportAdd.vue

@@ -128,7 +128,7 @@
 			 var _self = this;
 			 
 			 uni.uploadFile({
-			  url: 'https://wx.ewoogi.com/USKYOF/USKYOF.php/Home/MonitoringReporting/setUpload',
+			  url: _self.$BASE_URL+'MonitoringReporting/setUpload',
 			 
 			  files: [
 			   {

+ 2 - 2
pages/eleControl/controlReport/controlReportDetail/controlReportDetail.vue

@@ -29,7 +29,7 @@
 			<view class="form-item">
 				<view class="title"><text class="necessary">*</text>上传图片:</view>
 				<view style="width:500rpx">
-					<img :src=bathUrl+controlReportDetail.scene_pictures style="width:30%">
+					<img :src=this.$websiteUrl+controlReportDetail.scene_pictures style="width:30%">
 
 				</view>
 			</view>
@@ -66,7 +66,7 @@
 			return {
 				siteListData: [],
 				controlReportDetail: {},
-				bathUrl: 'https://wx.ewoogi.com'
+		
 			}
 		},
 		onLoad: function(option) {

+ 13 - 9
pages/index/index.vue

@@ -192,16 +192,20 @@
 
 
 		onLoad: function(option) {
+		
 			
-			if (option.op) {
-				// alert('op')
-				// alert(option.op)
-				// 首页数据渲染
-				this.getData();
+			// if (option.op) {
+			// 	// alert('op')
+			// 	// alert(option.op)
+			// 	// 首页数据渲染
+			// 	this.getData();
 			
-			} else {
-				this.init()
-			}
+			// } else {
+			// 	this.init()
+			// }
+			
+			
+			this.getData();
 
 			this.hackReset = false;
 			this.$nextTick(() => {
@@ -213,7 +217,7 @@
 
 			
 			async init() {
-				window.location.href =  "https://wx.ewoogi.com/USKYOF/USKYOF.php/Home/Com/getPageAuthorization1"
+				window.location.href =  this.$BASE_URL+"Home/Com/getPageAuthorization1"
 			},
 			// end
 

+ 1 - 34
pages/login/login.vue

@@ -16,7 +16,6 @@
 					<input type="text" placeholder="请输入验证码" v-model="verify" maxlength="5" >
 					<text class="icon iconfont left-icon">&#xe86a;</text>
 					<view @click="getVerifyCode">
-						<!-- <text class="right-icon verify">获取验证码</text> -->
 						<text class="right-icon verify">{{!codeTime?'获取验证码':codeTime+'s'}}</text>
 
 					</view>
@@ -65,14 +64,13 @@
 			});
 
 
-			// this.getLoginAuthorize()
 
 
 		},
 		methods: {
 			
 			async init(){
-				window.location.href="https://wx.ewoogi.com/USKYOF/USKYOF.php/Home/Login/getLoginAuthorizes1"
+				window.location.href=this.$BASE_URL+"Login/getLoginAuthorizes1"
 				
 			},
 			
@@ -81,20 +79,6 @@
 				this.phone=''
 			},
 
-			// setNavigationBarTitle
-			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
-			},
 			
 
 
@@ -200,23 +184,6 @@
 				}
 			},
 
-			//登录页初始化
-			async getLoginAuthorize() {
-				const res = await this.$myRequest({
-					url: 'Login/getLoginAuthorize',
-				})
-			
-				
-				if(res.data.flag == true){
-					uni.switchTab({
-						url: '/pages/index/index'
-					});
-					
-				}
-
-			},
-
-
 		}
 	}
 </script>

+ 0 - 5
pages/processList/processList.vue

@@ -132,11 +132,6 @@
 
 				</checkbox-group>
 
-
-
-
-
-
 			</view>
 
 		</block>

+ 0 - 20
pages/processedDetail/processedDetail.vue

@@ -1,6 +1,5 @@
 <template>
 	<view class="dealDetail">
-		
 		<view v-if="type==2" class="timeBox flex justify-between align-center padding-lr-sm">
 			<view class="time">{{detailMessage2.time}}</view>
 			<button class="cu-btn radius bg-green sm">已处理</button>
@@ -12,16 +11,12 @@
 				<view>告警历时:{{detailMessage.duration}}</view>
 				<view>关联告警:{{detailMessage.handlerTime}}</view>
 				<view style="color:#4074E7">【{{detailMessage.route_name}}】设备低压-{{detailMessage.digitalValue=='1'?'动作':'复归'}}</view>
-				<!-- <view class="time">{{detailMessage.time}}</view> -->
-				<!-- <view>dfd</view> -->
 			</view>
 			
 			<button  v-if="handling_status==1" class="cu-btn radius bg-green sm margin-top-sm">已处理</button>
 			<button  v-if="handling_status==2" class="cu-btn radius bg-orange sm margin-top-sm">待确认</button>
 			<button  v-if="handling_status==3" class="cu-btn radius bg-blue sm margin-top-sm">自动恢复</button>
 			<button  v-if="handling_status==4" class="cu-btn radius bg-gray sm margin-top-sm">过期失效</button>
-			
-		
 		</view>
 		
 		
@@ -252,8 +247,6 @@
 						"handlerContent": this.msg
 					})
 				}
-				
-				
 			},
 			
 			async powerSubmitRes(params = {}) {
@@ -278,8 +271,6 @@
 				
 			},
 			
-			
-			
 			async getUnProcessDetail(ming={}) {
 				const res= await this.$myRequest({
 					url:'IntegratedAlarm/getPowerAlarmDetails',
@@ -304,17 +295,7 @@
 			},
 			mapLocation(){
 				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)+''
 			
-				// uni.openLocation({
-				// 	latitude: parseInt(this.detailMessage.latitude),
-				// 	longitude: parseInt(this.detailMessage.longitude),
-				// 	success: function() {
-				// 		console.log('success');
-				// 	}
-				// });
 				
 				
 				// 微信公众号导航
@@ -365,7 +346,6 @@
 			inputReason(e) {
 				this.reason = e.detail.value;
 			}
-
 		}
 	}
 </script>

+ 2 - 2
pages/siteArchive/siteArchiveAdd/siteArchiveAdd.vue

@@ -459,14 +459,14 @@
 						that.formMess[upimage] = res.tempFilePaths[0];
 						console.log(res.tempFilePaths[0])
 						uni.uploadFile({
-							url: 'https://wx.ewoogi.com/USKYOF/USKYOF.php/Home/MonitoringReporting/setUpload',
+							url: that.$BASE_URL+'MonitoringReporting/setUpload',
 							filePath: that.formMess[upimage],
 							name: 'file',
 							formData: {
 								'user': 'test'
 							},
 							success: (uploadFileRes) => {
-								that.formMess[upimage] = 'https://wx.ewoogi.com' + JSON.parse(
+								that.formMess[upimage] = that.$websiteUrl+ JSON.parse(
 										uploadFileRes.data)
 									.img_url;
 								console.log(that.formMess)

+ 1 - 0
pages/unprocessDetail/unprocessDetail.vue

@@ -5,6 +5,7 @@
 			<view  v-else class="time">{{detailMessage2.time}}</view>
 			<button class="cu-btn radius bg-red sm">未处理</button>
 		</view>
+		
 		<!-- 电力start -->
 		<view v-if="type==1">
 			<view class="basic-info">

+ 6 - 8
util/api.js

@@ -1,12 +1,12 @@
 // const BASE_URL = 'https://iot.usky.cn/USKYOF/USKYOF.php/Home/' //(测试域名)  
 const BASE_URL = 'https://wx.ewoogi.com/USKYOF/USKYOF.php/Home/' //(正式域名新)  
-// const websiteUrl = 'https://wx.ewoogi.com'
+const websiteUrl = 'https://wx.ewoogi.com'
 
 // const BASE_URL='http://https://qhome.usky.cn/USKYOF/USKYOF.php/Home/'
 // 同时发送异步代码的次数,防止一次点击中有多次请求,用于处理
 let ajaxTimes = 0;
 
-export const myRequest = (options) => {
+function myRequest(options){
 
 	let showLoading = options.showLoading || false;
 
@@ -37,8 +37,7 @@ export const myRequest = (options) => {
 						let ua = navigator.userAgent.toLowerCase();
 						if (notIndexFail2.includes(options.url) && ua.match(
 								/MicroMessenger/i) == "micromessenger") {
-							// alert('数据拉取失败,请重新进入公众号')
-							// window.location.href = 'https://wx.ewoogi.com/index.html#/pages/index/index';
+							
 						} else {
 
 							return uni.showToast({
@@ -91,7 +90,6 @@ export const myRequest = (options) => {
 }
 
 
-export default {  
-  // websiteUrl,   
-}
-
+	export default {
+	    BASE_URL,myRequest,websiteUrl
+	}

+ 2 - 5
util/jssdk.js

@@ -6,15 +6,12 @@ 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)
+	console.log(BASE_URL.websiteUrl)
 	// start
 	uni.request({
-		url:"https://wx.ewoogi.com/sign.php",	
+		url:BASE_URL.websiteUrl+"/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'
 		},