InitializeThe.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view>
  3. <view v-for="item in userList" v-if="judge(item.id)" >
  4. <web-view :src="go(item.id,item.nickname)" v-bind:id="item.id" >{{item.id}}</web-view>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. userList:{
  13. /* id:'',
  14. nickname:'',
  15. password:'',
  16. remak1:'',
  17. username:'',
  18. remak2:'', */
  19. },
  20. list:[],
  21. lastUserName:'',
  22. userid:'',
  23. identify:'',
  24. bool:'',
  25. }
  26. },
  27. onLoad() {
  28. this.getUserList();
  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. },
  64. getUserList() {
  65. this.lastUserName = uni.getStorageSync('gyeeusername');
  66. this.userid = uni.getStorageSync('userid');
  67. let _this = this;
  68. uni.request({
  69. url: 'http://' + this.sisStageIp + ':' + this.sisStagePort + '/GyeeuserController/selectUserList',
  70. data: {},
  71. method: 'GET',
  72. success: function(res) {
  73. _this.userList =res.data;
  74. },
  75. fail: () => {
  76. _this.tips = '网络错误,小程序端请检查合法域名';
  77. },
  78. });
  79. },
  80. childMethod(id,bool){
  81. console.log(id);
  82. this.identify=id;
  83. this.bool = bool;
  84. this.getUserList();
  85. }
  86. }
  87. }
  88. </script>
  89. <style>
  90. </style>