efront 3.9.0 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,8 @@ function main() {
13
13
  });
14
14
  renderWithDefaults(page, {
15
15
  fields, data: {
16
- host: location.host,
16
+ host: data.getInstance("base").host || location.host,
17
+
17
18
  }, pending: false
18
19
  });
19
20
  on("submit")(page, async function () {
@@ -24,14 +25,10 @@ function main() {
24
25
  try {
25
26
  var login = await data.getApi("login");
26
27
  login.base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";
27
- cross.addDirect(login.base);
28
+ data.setInstance("base", { base: login.base, host: parseURL(login.base).host });
28
29
  var info = await data.from(login, {
29
30
  a: encode62.timeencode(encode62.geta(password))
30
31
  }).loading_promise;
31
- var apimap = await data.getConfig();
32
- for (var k in apimap) {
33
- apimap[k].base = login.base;
34
- }
35
32
  info = encode62.timeupdate(info);
36
33
  data.setSource({ authorization: info });
37
34
  user.login({})
@@ -4,6 +4,13 @@ var token = data.getSource('authorization');
4
4
  if (token) {
5
5
  user.login({});
6
6
  }
7
+ data.bindInstance("base", async function (base) {
8
+ cross.addDirect(base.base);
9
+ var apimap = await data.getConfig();
10
+ for (var k in apimap) {
11
+ apimap[k].base = base.base;
12
+ }
13
+ });
7
14
  setInterval(function () {
8
15
  var auth = data.getSource('authorization');
9
16
  if (!auth) return;
@@ -8,7 +8,7 @@
8
8
  <field -repeat="f in fields" -src="[f,data]"></field>
9
9
  <pre -text="task.code"></pre>
10
10
  </div>
11
- <div class="right">
11
+ <div class="right" :class="{error:error}">
12
12
  <pre -text="output"></pre>
13
13
  </div>
14
14
  </div>
@@ -3,7 +3,7 @@ function main(a) {
3
3
  page.innerHTML = template;
4
4
  drag.on(page.firstChild, page);
5
5
  var fields = data.from("params", { key: a.key }, function (a) {
6
- return JSON.parse(encode62.timedecode(a));
6
+ return a ? JSON.parse(encode62.timedecode(a)) : [];
7
7
  });
8
8
  var taskid = 0;
9
9
  renderWithDefaults(page, {
@@ -14,16 +14,24 @@ function main(a) {
14
14
  fields: fields,
15
15
  task: a,
16
16
  output: '',
17
+ error: false,
17
18
  async run() {
18
19
  var id = ++taskid;
20
+ this.output = "正在执行..";
21
+ this.error = false;
19
22
  var params = JSON.stringify(this.data);
20
- var res = await data.from("invoke", { key: a.key, params: encode62.timeencode(params) }, function (a) {
21
- return encode62.timedecode(a);
22
- });
23
- console.log(res);
24
- if (id !== taskid) return;
25
- this.output = res;
23
+ try {
24
+ var res = await data.from("invoke", { key: a.key, params: encode62.timeencode(params) }, function (a) {
25
+ return a ? encode62.timedecode(a) : '完成!';
26
+ });
27
+ if (id !== taskid) return;
28
+ this.output = res;
29
+ } catch (e) {
30
+ this.output = String(e);
31
+ this.error = true;
32
+ }
26
33
  }
27
34
  });
35
+ resize.on(page);
28
36
  return page;
29
37
  }
@@ -7,4 +7,17 @@
7
7
  display: inline-block;
8
8
  width: 50%;
9
9
  vertical-align: top;
10
+ overflow: auto;
11
+ font-size: 12px;
12
+ border-bottom: 50px solid transparent;
13
+ padding: 0 10px;
14
+
15
+ &.right {
16
+ background: #000;
17
+ color: #fff;
18
+ height: 100%;
19
+ }
20
+ &.error{
21
+ color: #c26;
22
+ }
10
23
  }
@@ -43,7 +43,7 @@ Object.assign(encode62, {
43
43
  var time_rest = time_stamp % time_delta;
44
44
  var time_rest_str = time_rest.toString(36);
45
45
  var time_delta_str = time_delta.toString(36);
46
- string = encodeURIComponent(string).replace(/\./g, '..').replace(/%/g, '.');
46
+ string = encodeURIComponent(string).replace(/\./g, '..').replace(/[\!'\(\)~]/g, a => escape(a)).replace(/%/g, '.');
47
47
  return this.encode62(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
48
48
  },
49
49
  timeupdate(string) {
@@ -73,7 +73,7 @@ const formulaters = {
73
73
  }
74
74
  };
75
75
 
76
- function getErrorMessage(error) {
76
+ function getErrorMessage(error = this) {
77
77
  if (!isObject(error)) return String(error);
78
78
  if (error instanceof Error) return String(error);
79
79
  var words = "reason,message,desc,descption,msg,err,error,data".split(',');
@@ -550,7 +550,7 @@ var privates = {
550
550
  }).error(xhr => {
551
551
  try {
552
552
  var e = getErrorMessage(parseData(xhr.response || xhr.responseText || xhr.statusText || xhr.status));
553
- oh({ status: xhr.status, error: e })
553
+ oh({ status: xhr.status, error: e, toString: getErrorMessage })
554
554
  } catch (error) {
555
555
  oh(error);
556
556
  }
@@ -33,7 +33,7 @@ var encode62 = {
33
33
  var time_rest = time_stamp % time_delta;
34
34
  var time_rest_str = time_rest.toString(36);
35
35
  var time_delta_str = time_delta.toString(36);
36
- string = encodeURIComponent(string).replace(/\./g, '..').replace(/%/g, '.');
36
+ string = encodeURIComponent(string).replace(/\./g, '..').replace(/[\!'\(\)~]/g, a => escape(a)).replace(/%/g, '.');
37
37
  return this.encode(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
38
38
  },
39
39
  timeupdate(string) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {