<template>
	<view>
		  <view v-for="item in userList"  v-if="judge(item.id)" >
			  
		       <web-view :src="go(item.id,item.nickname)" v-bind:id="item.id"  >{{item.id}}</web-view>
		  </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userList:{
				/* 	id:'',
					nickname:'',
					password:'',
					remak1:'',
					username:'',
					remak2:'', */
				},
				list:[],
				lastUserName:'',
				userid:'',
				identify:'',
				bool:'',
			}
		},
		onLoad() {
			this.getUserList();
		},
		computed: {
			sisStageIp: function() {
				return this.$store.state.wholeSituationBackStageIp;
			},
			sisStagePort: function() {
				return this.$store.state.wholeSituationBackStagePort;
			},
			backStageIp: function() {
				return this.$store.state.GlobalLocalIp;
			},
			backStagePort: function() {
				return this.$store.state.GlobalLocalPort;
			},
			windpowerstationNameToId: function() {
				return this.$store.state.windpowerstationNameToId;
			},
			},
		methods: {
			judge(id){
				if(id==this.identify){
					return true;
				}
				else{
					return false;
				}
			},
			go(id,nickname){
				let _this=this;
				if(_this.bool == 1){
					 return "https://"+_this.backStageIp+":"+_this.backStagePort+"/websocket/usercontroller/view?send="+_this.userid+"&receive="+id+"&sendname="+_this.lastUserName+"&receivename="+nickname;
				}else{
					 return "https://"+ _this.backStageIp+":"+_this.backStagePort+"/websocket/usercontroller/viewoffline?send="+_this.userid+"&receive="+id+"&sendname="+_this.lastUserName+"&receivename="+nickname;
				}
			},
			getUserList() {
				this.lastUserName = uni.getStorageSync('gyeeusername');
				this.userid = uni.getStorageSync('userid');

				let _this = this;
				uni.request({
					url: 'http://' + this.sisStageIp + ':' + this.sisStagePort + '/GyeeuserController/selectUserList',
					data: {},
					method: 'GET',
					success: function(res) {
						_this.userList =res.data;
						
				
					},
					fail: () => {
						_this.tips = '网络错误，小程序端请检查合法域名';
					},
				});
				
			},
			childMethod(id,bool){
				console.log(id);
				this.identify=id;
				this.bool = bool;
				this.getUserList();
			}
			
			
		}
	}
</script>

<style>

</style>
