whychdw
2019-10-19 6dd9eae83ba8e58c1f0ff70058a75ba72811e3d4
修改内容
6个文件已修改
166 ■■■■ 已修改文件
platforms/android/app/src/main/assets/www/pages/index/index.js 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platforms/android/app/src/main/assets/www/pages/main/main.html 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platforms/android/app/src/main/assets/www/pages/main/main.js 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
www/pages/index/index.js 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
www/pages/main/main.html 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
www/pages/main/main.js 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platforms/android/app/src/main/assets/www/pages/index/index.js
@@ -10,17 +10,12 @@
        vm: ''
    },
    loaded: function loaded(require, exports, module) {
        // 设置页面中的Worker线程(需要再workers.js先定义)
        setIpWorker = new Worker('worker/data.worker.js');
        getIpWorker = new Worker('worker/data.worker.js');
        // 引入vue
        this.vm = new Vue({
            el: getPageRoot(module),
            data: {
                number: 1234,
                ip: '127.0.0.1',
                setIpWorker: setIpWorker,
                getIpWorker: getIpWorker,
            },
            methods: {
                routerTo: function routerTo(path) {
@@ -31,20 +26,6 @@
                            name: path
                        }
                    });
                },
                getIp: function() {
                    if(typeof(JSInterface) != 'undefined') {
                        JSInterface.obtainDeviceIp();
                    }else {
                        bui.alert({"code": "1", "cmd": "0"});
                    }
                },
                setIp: function() {
                    if(typeof(JSInterface) != 'undefined') {
                        JSInterface.setUpDeviceIp(this.ip);
                    }else {
                        bui.alert('请使用手机端登陆!');
                    }
                },
                startScan: function() {
                    if(typeof(plus) != 'undefined') {
@@ -64,26 +45,8 @@
                    }
                }
            },
            mounted() {
                // 设置Ip监听
                this.setIpWorker.onmessage = function(res) {
                    bui.alert(res.data);
                };
                // 获取Ip监听
                this.getIpWorker.onmessage = function(res) {
                    bui.alert(res.data);
                };
            },
            destroyed: function destroyed() {
                // 关闭获取IP的worker线程
                this.getIpWorker.terminate();
                // 关闭设置IP的worker线程
                this.setIpWorker.terminate();
                // 关闭测试Ip的worker线程
                this.testIpWorker.terminate();
            }
            mounted() {},
            destroyed: function destroyed() {}
        });
    },
    destroyed: function destroyed() {
platforms/android/app/src/main/assets/www/pages/main/main.html
@@ -22,7 +22,10 @@
                                @click="testIp"
                                type="success" 
                                style="margin-right: 16px;">测试链接</i-button>
                                <i-button type="primary">进入系统</i-button>
                                <i-button
                                type="primary"
                                @click="setIp"
                                :disabled="states">进入系统</i-button>
                            </div>
                        </div>
                        <div class="bui-box" style="margin-top: 8px">
platforms/android/app/src/main/assets/www/pages/main/main.js
@@ -12,13 +12,21 @@
    loaded: function loaded(require, exports, module) {
        // 设置页面中的Worker线程(需要再workers.js先定义)
        testIpWorker = new Worker('worker/data.worker.js');
        getIpWorker = new Worker('worker/data.worker.js');
        // 引入vue
        this.vm = new Vue({
            el: getPageRoot(module),
            data: {
                loading: bui.loading(),
                ip: '127.0.0.1',
                states: true,
                getIpWorker: getIpWorker,
                testIpWorker: testIpWorker,
            },
            watch: {
                ip: function(val) {
                    this.states = true;
                }
            },
            methods: {
                enterIndex: function() {
@@ -40,6 +48,20 @@
                        this.close();
                    });
                },
                getIp: function() {
                    if(typeof(JSInterface) != 'undefined') {
                        JSInterface.obtainDeviceIp();
                    }
                },
                setIp: function() {
                    var self = this;
                    if(typeof(JSInterface) != 'undefined') {
                        JSInterface.setUpDeviceIp(this.ip);
                        self.enterIndex();
                    }else {
                        bui.alert('请使用手机端登陆!');
                    }
                },
                testIp: function() {
                    var self = this;
                    if(typeof(JSInterface) != 'undefined') {
@@ -53,11 +75,24 @@
            },
            mounted() {
                var self = this;
                this.getIp();
                // 获取Ip监听
                this.getIpWorker.onmessage = function(res) {
                    if(res.data.code == 1) {
                        self.ip = res.data.data;
                    }
                };
                // 测试Ip
                this.testIpWorker.onmessage = function(res) {
                    // 关闭等待框
                    self.loading.hide();
                    bui.alert(res.data);
                    if(res.data.code == 1) {
                        self.states = false;
                    }else {
                        bui.alert('测试连接失败!');
                    }
                }
            },
            destroyed: function destroyed() {
www/pages/index/index.js
@@ -10,17 +10,12 @@
        vm: ''
    },
    loaded: function loaded(require, exports, module) {
        // 设置页面中的Worker线程(需要再workers.js先定义)
        setIpWorker = new Worker('worker/data.worker.js');
        getIpWorker = new Worker('worker/data.worker.js');
        // 引入vue
        this.vm = new Vue({
            el: getPageRoot(module),
            data: {
                number: 1234,
                ip: '127.0.0.1',
                setIpWorker: setIpWorker,
                getIpWorker: getIpWorker,
            },
            methods: {
                routerTo: function routerTo(path) {
@@ -31,20 +26,6 @@
                            name: path
                        }
                    });
                },
                getIp: function() {
                    if(typeof(JSInterface) != 'undefined') {
                        JSInterface.obtainDeviceIp();
                    }else {
                        bui.alert({"code": "1", "cmd": "0"});
                    }
                },
                setIp: function() {
                    if(typeof(JSInterface) != 'undefined') {
                        JSInterface.setUpDeviceIp(this.ip);
                    }else {
                        bui.alert('请使用手机端登陆!');
                    }
                },
                startScan: function() {
                    if(typeof(plus) != 'undefined') {
@@ -64,26 +45,8 @@
                    }
                }
            },
            mounted() {
                // 设置Ip监听
                this.setIpWorker.onmessage = function(res) {
                    bui.alert(res.data);
                };
                // 获取Ip监听
                this.getIpWorker.onmessage = function(res) {
                    bui.alert(res.data);
                };
            },
            destroyed: function destroyed() {
                // 关闭获取IP的worker线程
                this.getIpWorker.terminate();
                // 关闭设置IP的worker线程
                this.setIpWorker.terminate();
                // 关闭测试Ip的worker线程
                this.testIpWorker.terminate();
            }
            mounted() {},
            destroyed: function destroyed() {}
        });
    },
    destroyed: function destroyed() {
www/pages/main/main.html
@@ -22,7 +22,10 @@
                                @click="testIp"
                                type="success" 
                                style="margin-right: 16px;">测试链接</i-button>
                                <i-button type="primary">进入系统</i-button>
                                <i-button
                                type="primary"
                                @click="setIp"
                                :disabled="states">进入系统</i-button>
                            </div>
                        </div>
                        <div class="bui-box" style="margin-top: 8px">
www/pages/main/main.js
@@ -12,13 +12,21 @@
    loaded: function loaded(require, exports, module) {
        // 设置页面中的Worker线程(需要再workers.js先定义)
        testIpWorker = new Worker('worker/data.worker.js');
        getIpWorker = new Worker('worker/data.worker.js');
        // 引入vue
        this.vm = new Vue({
            el: getPageRoot(module),
            data: {
                loading: bui.loading(),
                ip: '127.0.0.1',
                states: true,
                getIpWorker: getIpWorker,
                testIpWorker: testIpWorker,
            },
            watch: {
                ip: function(val) {
                    this.states = true;
                }
            },
            methods: {
                enterIndex: function() {
@@ -40,6 +48,20 @@
                        this.close();
                    });
                },
                getIp: function() {
                    if(typeof(JSInterface) != 'undefined') {
                        JSInterface.obtainDeviceIp();
                    }
                },
                setIp: function() {
                    var self = this;
                    if(typeof(JSInterface) != 'undefined') {
                        JSInterface.setUpDeviceIp(this.ip);
                        self.enterIndex();
                    }else {
                        bui.alert('请使用手机端登陆!');
                    }
                },
                testIp: function() {
                    var self = this;
                    if(typeof(JSInterface) != 'undefined') {
@@ -53,11 +75,24 @@
            },
            mounted() {
                var self = this;
                this.getIp();
                // 获取Ip监听
                this.getIpWorker.onmessage = function(res) {
                    if(res.data.code == 1) {
                        self.ip = res.data.data;
                    }
                };
                // 测试Ip
                this.testIpWorker.onmessage = function(res) {
                    // 关闭等待框
                    self.loading.hide();
                    bui.alert(res.data);
                    if(res.data.code == 1) {
                        self.states = false;
                    }else {
                        bui.alert('测试连接失败!');
                    }
                }
            },
            destroyed: function destroyed() {