123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- <template>
- <view>
- </view>
- </template>
- <script>
- var wv = [];
- export default {
- name: "initial",
- props: {
- showModal: {
- type: String,
- default: '0'
- }
- },
- data() {
- return {
- userList: [],
- userListshow: [],
- list: [],
- lastUserName: '',
- userid: '',
- identify: '',
- bool: '',
- }
- },
- created() {
- this.getUserList();
- this.onlineMonitor();
- let _this = this;
- setInterval(function() {
- _this.onlineUserMap();
- }, 5000);
-
- },
- 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: {
-
- destroyUseWebViews() {
- wv=null;
-
- },
- getUserList() {
- let im_show =uni.getStorageSync('im_show');
- if (im_show == "1") {
- 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 = [];
- for (var i = 0; i < res.data.length; i++) {
- if (res.data[i].id != _this.userid) {
- var pages = getCurrentPages();
- var page = pages[pages.length - 1];
- let webView = plus.webview.create("", "webview" + res.data[i].id, {
- plusrequire: "none",
- 'uni-app': 'none',
- top: uni.getSystemInfoSync().statusBarHeight + 44
- })
- let url = "https://" + _this.backStageIp + ":" + _this.backStagePort + "/websocket/usercontroller/view?send=" +
- _this.userid + "&receive=" + res.data[i].id + "&sendname=" + _this.lastUserName + "&receivename=" + res.data[
- i].nickname;
-
- webView.loadURL(url)
- var currentWebview = page.$getAppWebview();
- currentWebview.append(webView);
-
-
- setTimeout(function() {
-
- }, 1000);
- webView.hide();
- wv.push(webView)
-
- }
-
- };
-
- },
- fail: () => {
- _this.tips = '网络错误,小程序端请检查合法域名';
- },
- });
-
- uni.setStorageSync('im_show','0');
-
- }else
- {
-
- var pages = getCurrentPages();
- var page = pages[pages.length - 1];
- var currentWebview = page.$getAppWebview();
-
- for (var i = 0; i < wv.length; i++) {
-
- let webView = wv[i];
-
-
- currentWebview.append(webView);
-
- }
-
- }
- },
- async onlineUserMap() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- async onlineMonitor() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- childMethod(id, bool, state) {
- console.log(id);
- this.identify = id;
- this.bool = bool;
-
- let webview;
- for (var i = 0; i < wv.length; i++) {
- if (wv[i].id == "webview" + id) {
- webview = wv[i];
- if (state == 1) {
- webview.show()
- } else {
- webview.hide();
- }
- break;
- }
- }
- },
-
- }
- }
- </script>
- <style>
- </style>
|