Selaa lähdekoodia

修改即时通信连接加载位置在首页

shilin 5 vuotta sitten
vanhempi
commit
6bbc6fa7b9

+ 1 - 1
common/store.js

@@ -8,7 +8,7 @@ const store = new Vuex.Store({
 		wholeSituationBackStageIp:'117.78.18.24',//117.78.18.24
 		wholeSituationBackStagePort:'9988',
 		
-		GlobalLocalIp:'192.168.3.24',//192.168.1.102
+		GlobalLocalIp:'192.168.0.91',//192.168.1.102
 		GlobalLocalPort:'4397',
 		
 		windpowerstationNameToId:{},

+ 22 - 13
components/mine/addressBook/InitializeThe.vue

@@ -51,7 +51,7 @@
 			getUserList() {
 
 				let im_show =uni.getStorageSync('im_show');
-				if (im_show == "1") {
+				if (im_show != "1") {
 					this.lastUserName = uni.getStorageSync('gyeeusername');
 					this.userid = uni.getStorageSync('userid');
 
@@ -75,21 +75,17 @@
 										top: uni.getSystemInfoSync().statusBarHeight + 44 //放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值
 									})
 
-									let url = '';
-									if (_this.identify == res.data[i].id && _this.bool == 0) {
-										url = "https://" + _this.backStageIp + ":" + _this.backStagePort +
-											"/websocket/usercontroller/viewoffline?send=" + _this
-											.userid + "&receive=" + res.data[i].id + "&sendname=" + _this.lastUserName + "&receivename=" + res.data[i]
-											.nickName;
-									} else {
-										url = "https://" + _this.backStageIp + ":" + _this.backStagePort + "/websocket/usercontroller/view?send=" +
-											_this.userid + "&receive=" + res.data[i].id + "&sendname=" + _this.lastUserName + "&receivename=" + res.data[
-												i].nickname;
-									}
+									let url = "https://" + _this.backStageIp + ":" + _this.backStagePort + "/websocket/usercontroller/view?send=" +
+										_this.userid + "&receive=" + res.data[i].id + "&sendname=" + _this.lastUserName + "&receivename=" + res.data[
+											i].nickname;
 									webView.loadURL(url)
 									var currentWebview = page.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效,非v3编译模式使用this.$mp.page.$getAppWebview()
 									currentWebview.append(webView); //一定要append到当前的页面里!!!才能跟随当前页面一起做动画,一起关闭
 									//wv.setStyle({top:70,height:height});
+									
+									 setTimeout(function() {
+									          
+									        }, 1000);//如果是首页的onload调用时需要延时一下,二级页面无需延时,可直接获取
 									webView.hide();
 
 									wv.push(webView)
@@ -105,8 +101,21 @@
 						},
 					});
 					
-					 uni.setStorageSync('im_show','0');
+					 uni.setStorageSync('im_show','1');
 					
+				}else
+				{
+					var pages = getCurrentPages();
+					var page = pages[pages.length - 1];
+					var currentWebview = page.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效,非v3编译模式使用this.$mp.page.$getAppWebview()
+					
+					for (var i = 0; i < wv.length; i++) {
+						
+						let webView = wv[i];
+						
+						currentWebview.append(webView); //一定要append到当前的页面里!!!才能跟随当前页面一起做动画,一起关闭
+						
+					}
 				}
 
 

+ 2 - 2
components/mine/addressBook/addressBook.vue

@@ -187,7 +187,7 @@
 
 <script>
 	import pinyin from './index.js';
-	import initial from './InitializeThe.vue';
+
 
 	import res from '../../../common/data.json';
 	import drawer from '../../../components/drawer/threeLineDrawer.vue'
@@ -199,7 +199,7 @@
 	var wv;
 	export default {
 		components: {
-			initial: initial,
+	
 			drawer: drawer,
 			plusDrawer: plusDrawer,
 			mine: mine,

+ 3 - 0
main.js

@@ -12,6 +12,9 @@ Vue.prototype.dataprocessing=Dataprocessing;
 import Common from './common/common.js';
 Vue.prototype.common = Common;
 
+import initial from './components/mine/addressBook/InitializeThe.vue'
+Vue.component('initial',initial)
+
 Vue.prototype.getTimeFormat = function(){
          Date.prototype.Format = function(fmt) {
 				var o = {

+ 2 - 0
pages/index/Index.vue

@@ -434,6 +434,7 @@
 		</scroll-view>
 
 		<view class="DrawerClose" :class="modalName == 'viewModal' ? 'show' : ''" @tap="hideModal"><text class="cuIcon-pullright"></text></view>
+	<initial ref="mychild"></initial>
 	</view>
 </template>
 
@@ -579,6 +580,7 @@ export default {
 		};
 	},
 	created: function() {
+		uni.setStorageSync('im_show','0');
 		this.play();
 		this.timeNow();
 		this.$nextTick(function() {