InitializeThe.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. backStageIp: function() {
  32. return this.$store.state.GlobalLocalIp;
  33. },
  34. backStagePort: function() {
  35. return this.$store.state.GlobalLocalPort;
  36. },
  37. windpowerstationNameToId: function() {
  38. return this.$store.state.windpowerstationNameToId;
  39. },
  40. },
  41. methods: {
  42. judge(id){
  43. if(id==this.identify){
  44. return true;
  45. }
  46. else{
  47. return false;
  48. }
  49. },
  50. go(id,nickname){
  51. let _this=this;
  52. if(_this.bool == 1){
  53. return "https://"+_this.backStageIp+":"+_this.backStagePort+"/websocket/usercontroller/view?send="+_this.userid+"&receive="+id+"&sendname="+_this.lastUserName+"&receivename="+nickname;
  54. }else{
  55. return "https://"+ _this.backStageIp+":"+_this.backStagePort+"/websocket/usercontroller/viewoffline?send="+_this.userid+"&receive="+id+"&sendname="+_this.lastUserName+"&receivename="+nickname;
  56. }
  57. },
  58. getUserList() {
  59. this.lastUserName = uni.getStorageSync('gyeeusername');
  60. this.userid = uni.getStorageSync('userid');
  61. let _this = this;
  62. uni.request({
  63. url: 'http://' + this.backStageIp + ':' + this.backStagePort + '/GyeeuserController/selectUserList',
  64. data: {},
  65. method: 'GET',
  66. success: function(res) {
  67. _this.userList =res.data;
  68. },
  69. fail: () => {
  70. _this.tips = '网络错误,小程序端请检查合法域名';
  71. },
  72. });
  73. },
  74. childMethod(id,bool){
  75. console.log(id);
  76. this.identify=id;
  77. this.bool = bool;
  78. this.getUserList();
  79. }
  80. }
  81. }
  82. </script>
  83. <style>
  84. </style>