evue_launcher.evue 2.23 KB
Newer Older
wanli's avatar
wanli committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
<html>
<div class="container">
    <image src="evue_logo.bin" style="top: 20px;left: 40px;"></image>
    <text style="top:190px;background-color: transparent; color: white;font-size: 20px;width: 240px;height: 25px;text-align: center;">{{ title }}</text>
</div>

</html>
<script>
    router = require("@system.router")
    http = require("@system.http")
    fs = require("@system.fs")
    watch = require("@system.watch")
    os = require("@system.os")

    export default {
        data: {
            title: 'Power by EVM!',
            epk_remote_url: 'http://store.evmiot.com/api/v1/evm_store/download/apps',
            path_prefix: '',
            epk_name: 'evue_launcher.epk',
            fpath: '',
            url_dock: 'evue_dock',
            url_404: 'evue_404',
            appId: "evue_launcher"
        },
        onInit: function() {},

        onReady: function() {
            this.fpath = this.epk_name;
        },

        onShow: function() {
            setTimeout(function() {
                this.install();
            }, 10)
        },

        install: function() {
            this.installLauncherEpk(this.appId, this.epk_remote_url)
            router.push({
                path: this.url_dock
            })
        },

        onHide: function() {},

        onDestroy: function() {},

        installLauncherEpk: function(appId, epk_remote_url) {
            headers = [
                "Accept: application/json",
                "Content-Type: application/json",
                "charsets: utf-8"
            ]
            var res = http.request({
                method: "POST",
                url: epk_remote_url,
                headers: headers,
                data: JSON.stringify({
                    "id": appId,
                    "imei": watch.imei()
                }),
                timeout: 10000,
                responseType: "epk",
                callback: function(res, len) {},
                error: function(code) {}
            });
        }

    }
</script>
<style>
    .container {
        width: 240px;
        height: 240px;
        border-width: 0px;
        border-radius: 0px;
        margin: 0px;
        padding: 0px;
        opacity: 0;
        background-color: transparent;
        align-items: off;
    }
</style>