kn-cli 1.0.50 → 1.0.51

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.50",
3
+ "version": "1.0.51",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -69,6 +69,9 @@ module.exports = {
69
69
  ```
70
70
 
71
71
  # 更新日志
72
+ * 1.0.50
73
+ 增加官网模板
74
+
72
75
  * 1.0.49
73
76
  更新app和admin模板,主要是编写了使用案例
74
77
 
package/src/create.js CHANGED
@@ -23,7 +23,7 @@ module.exports=async ()=> {
23
23
  choices:[
24
24
  '移动端APP',
25
25
  'pc管理系统',
26
- // 'pc官网(未开放)',
26
+ '官网',
27
27
  // '移动端H5活动(未开放)',
28
28
  // 'pc官网(未开放)',
29
29
  // 'pc管理系统',
@@ -36,6 +36,7 @@ module.exports=async ()=> {
36
36
  switch(answer.type){
37
37
  case '移动端APP':{templateName='template_app'}break;
38
38
  case 'pc管理系统':{templateName='template_admin'}break;
39
+ case '官网':{templateName='template_offcial'}break;
39
40
  }
40
41
  }
41
42
 
@@ -19,6 +19,22 @@ export const isMobile = () => {
19
19
  )
20
20
  }
21
21
 
22
+ export const toHref = (url, replace, newWindow) => {
23
+ if(window.knFeishu){
24
+ window.knFeishu.ToHref(url,replace,newWindow);
25
+ return;
26
+ }
27
+ if (newWindow) {
28
+ window.open(url);
29
+ return;
30
+ }
31
+ if (replace) {
32
+ location.replace(url);
33
+ return;
34
+ }
35
+ location.href = url;
36
+ };
37
+
22
38
  export const jumpUrl=(url,options={})=>{
23
39
  const {replace,newWindow,reload}= options;
24
40
  if(reload){
@@ -36,3 +52,15 @@ export const jumpUrl=(url,options={})=>{
36
52
  location.href=url;
37
53
 
38
54
  }
55
+
56
+
57
+ // 关闭页面
58
+ export const closeWindow = () => {
59
+ if (window.knFeishu && window.knFeishu.closeWindow) {
60
+ window.knFeishu.closeWindow();
61
+ } else {
62
+ if (window.close) {
63
+ window.close();
64
+ }
65
+ }
66
+ };
@@ -13,9 +13,36 @@ export const openLink = (link, target = '_blank') => {
13
13
  }, 200);
14
14
  }
15
15
 
16
+
17
+ export const toHref = (url, replace, newWindow) => {
18
+ if(window.knFeishu){
19
+ window.knFeishu.ToHref(url,replace,newWindow);
20
+ return;
21
+ }
22
+ if (newWindow) {
23
+ window.open(url);
24
+ return;
25
+ }
26
+ if (replace) {
27
+ location.replace(url);
28
+ return;
29
+ }
30
+ location.href = url;
31
+ };
32
+
16
33
  export const isMobile = () => {
17
34
  return navigator.userAgent.match(
18
35
  /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
19
36
  )
20
37
  }
21
38
 
39
+ // 关闭页面
40
+ export const closeWindow = () => {
41
+ if (window.knFeishu && window.knFeishu.closeWindow) {
42
+ window.knFeishu.closeWindow();
43
+ } else {
44
+ if (window.close) {
45
+ window.close();
46
+ }
47
+ }
48
+ };