12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- const Fs = require('fire-fs');
- const FsExtra = require('fs-extra');
- const Path = require('fire-path');
- const Electron = require('electron');
- const CfgUtil = Editor.require('packages://hot-update-tools/core/CfgUtil.js');
- const OSS = Editor.require('packages://hot-update-tools/node_modules/ali-oss');
- const GoogleAnalytics = Editor.require('packages://hot-update-tools/core/GoogleAnalytics.js');
- const OutPut = Editor.require('packages://hot-update-tools/core/OutPut.js');
- const Msg = Editor.require('packages://hot-update-tools/panel/msg.js');
- Editor.require('packages://hot-update-tools/panel/env-project.js');
- Editor.require('packages://hot-update-tools/panel/env-test.js');
- Editor.require('packages://hot-update-tools/panel/manifest-gen.js');
- Editor.Panel.extend({
- style: Fs.readFileSync(Editor.url('packages://hot-update-tools/panel/index.css'), 'utf8'),
- template: Fs.readFileSync(Editor.url('packages://hot-update-tools/panel/index.html'), 'utf8'),
- ready () {
- GoogleAnalytics.init();
- GoogleAnalytics.eventOpen();
- this.plugin = new window.Vue({
- el: this.shadowRoot,
- created () {
- CfgUtil.initCfg(this.log);
- this.$root.$on(Msg.Log, this.log);
- const data = Editor.require('packages://hot-update-tools/package.json');
- if (data) {
- this.version = `版本号:V${data.version}`;
- } else {
- this.version = '';
- }
- },
- data: {
- logView: '',
- version: '',
- },
- computed: {},
- methods: {
- log (str) {
- let time = new Date();
- this.logView += `[${time.toLocaleString()}]: ${str}\n`;
- this.$nextTick(() => {
- let logCtrl = this.$els.log;
- logCtrl.scrollTop = logCtrl.scrollHeight;
- });
- },
- onStopTouchEvent (event) {
- event.preventDefault();
- event.stopPropagation();
- },
- onBuildFinished (time) {
- // 当构建完成的时候,genTime和buildTime是一致的
- console.log('hot - onBuildFinished');
- },
- onTestSelect () {
- this.$nextTick(() => {
- this.$els.address.selectedIndex = index;
- });
- },
- },
- });
- },
- messages: {
- 'hot-update-tools:onBuildFinished' (event, time) {
- this.plugin.onBuildFinished(time);
- },
- },
- });
|