InitializeThe.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view>
  3. <view v-for="item in userListshow" >
  4. <web-view :src="go(item.id,item.nickname)" v-if="item.state" :key="item.id" ></web-view>
  5. </view>
  6. <view v-for="item in userList" >
  7. <web-view :src="go(item.id,item.nickname)" v-show="item.state" :key="item.id" ></web-view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. userList:[],
  16. userListshow:[],
  17. list:[],
  18. lastUserName:'',
  19. userid:'',
  20. identify:'',
  21. bool:'',
  22. }
  23. },
  24. created(){
  25. this.getUserList();
  26. },
  27. onUnload() {
  28. this.userList=[];
  29. },
  30. computed: {
  31. sisStageIp: function() {
  32. return this.$store.state.wholeSituationBackStageIp;
  33. },
  34. sisStagePort: function() {
  35. return this.$store.state.wholeSituationBackStagePort;
  36. },
  37. backStageIp: function() {
  38. return this.$store.state.GlobalLocalIp;
  39. },
  40. backStagePort: function() {
  41. return this.$store.state.GlobalLocalPort;
  42. },
  43. windpowerstationNameToId: function() {
  44. return this.$store.state.windpowerstationNameToId;
  45. },
  46. },
  47. methods: {
  48. judge(id){
  49. if(id==this.identify){
  50. return true;
  51. }
  52. else{
  53. return false;
  54. }
  55. },
  56. go(id,nickname){
  57. let _this=this;
  58. // if(_this.bool == 1){
  59. // return "https://"+_this.backStageIp+":"+_this.backStagePort+"/websocket/usercontroller/view?send="+_this.userid+"&receive="+id+"&sendname="+_this.lastUserName+"&receivename="+nickname;
  60. // }else{
  61. // return "https://"+ _this.backStageIp+":"+_this.backStagePort+"/websocket/usercontroller/viewoffline?send="+_this.userid+"&receive="+id+"&sendname="+_this.lastUserName+"&receivename="+nickname;
  62. // }
  63. if (_this.identify == id && _this.bool == 0) {
  64. return "https://" + _this.backStageIp + ":" + _this.backStagePort + "/websocket/usercontroller/viewoffline?send=" + _this
  65. .userid + "&receive=" + id + "&sendname=" + _this.lastUserName + "&receivename=" + nickname ;
  66. } else {
  67. return "https://" + _this.backStageIp + ":" + _this.backStagePort + "/websocket/usercontroller/view?send=" +
  68. _this.userid + "&receive=" + id + "&sendname=" + _this.lastUserName + "&receivename=" + nickname ;
  69. }
  70. },
  71. getUserList() {
  72. this.lastUserName = uni.getStorageSync('gyeeusername');
  73. this.userid = uni.getStorageSync('userid');
  74. let _this = this;
  75. uni.request({
  76. url: 'http://' + this.sisStageIp + ':' + this.sisStagePort + '/GyeeuserController/selectUserList',
  77. data: {},
  78. method: 'GET',
  79. success: function(res) {
  80. _this.userList=[];
  81. _this.userListshow=[];
  82. for (var i = 0; i < res.data.length; i++) {
  83. if(res.data[i].id!=_this.userid)
  84. {
  85. if (_this.identify == res.data[i].id && _this.bool == 1) {
  86. res.data[i].state = true;
  87. _this.userListshow.push(res.data[i]);
  88. }else
  89. {
  90. res.data[i].state = false;
  91. _this.userList.push(res.data[i]);
  92. }
  93. }
  94. };
  95. },
  96. fail: () => {
  97. _this.tips = '网络错误,小程序端请检查合法域名';
  98. },
  99. });
  100. },
  101. childMethod(id,bool){
  102. console.log(id);
  103. this.identify=id;
  104. this.bool = bool;
  105. this.getUserList();
  106. }
  107. }
  108. }
  109. </script>
  110. <style>
  111. </style>