123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <template>
- <view>
- <view v-for="item in userListshow" >
- <web-view :src="go(item.id,item.nickname)" v-if="item.state" :key="item.id" ></web-view>
- </view>
- <view v-for="item in userList" >
-
- <web-view :src="go(item.id,item.nickname)" v-show="item.state" :key="item.id" ></web-view>
- </view>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- userList:[],
- userListshow:[],
- list:[],
- lastUserName:'',
- userid:'',
- identify:'',
- bool:'',
- }
- },
- created(){
- this.getUserList();
- },
- onUnload() {
-
- this.userList=[];
- },
- 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;
- // }
-
- if (_this.identify == id && _this.bool == 0) {
- return "https://" + _this.backStageIp + ":" + _this.backStagePort + "/websocket/usercontroller/viewoffline?send=" + _this
- .userid + "&receive=" + id + "&sendname=" + _this.lastUserName + "&receivename=" + nickname ;
- } else {
- return "https://" + _this.backStageIp + ":" + _this.backStagePort + "/websocket/usercontroller/view?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=[];
- _this.userListshow=[];
- for (var i = 0; i < res.data.length; i++) {
-
- if(res.data[i].id!=_this.userid)
- {
- if (_this.identify == res.data[i].id && _this.bool == 1) {
- res.data[i].state = true;
- _this.userListshow.push(res.data[i]);
- }else
- {
- res.data[i].state = false;
- _this.userList.push(res.data[i]);
- }
-
- }
-
-
- };
-
-
- },
- fail: () => {
- _this.tips = '网络错误,小程序端请检查合法域名';
- },
- });
-
- },
- childMethod(id,bool){
- console.log(id);
- this.identify=id;
- this.bool = bool;
- this.getUserList();
- }
-
-
- }
- }
- </script>
- <style>
- </style>
|