diff --git a/core/wiki/field.go b/core/wiki/field.go index e65b8542..f90d2bc7 100644 --- a/core/wiki/field.go +++ b/core/wiki/field.go @@ -21,6 +21,10 @@ func _field_show(m *ice.Message, name, text string, arg ...string) { kit.For(arg, func(k, v string) { if k == ctx.ARGS { kit.Value(meta, k, kit.Split(strings.TrimSuffix(strings.TrimPrefix(v, "["), "]"))) + } else if k == ice.MSG_RESULT { + m.Option("output", strings.TrimSpace(v)) + kit.Value(meta, "meta.mode", "result") + kit.Value(meta, "msg", kit.Dict()) } else { kit.Value(meta, k, v) } @@ -34,8 +38,11 @@ const FIELD = "field" func init() { Index.MergeCommands(ice.Commands{ FIELD: {Name: "field name cmd", Help: "插件", Actions: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) { - kit.If(kit.Select("", arg, 1) == ctx.ARGS, func() { arg = kit.Simple("", arg) }) + kit.If(kit.IsIn(kit.Select("", arg, 1), ctx.ARGS, ice.MSG_RESULT), func() { arg = kit.Simple("", arg) }) arg = _name(m, arg) + if arg[0] == "inner" { + arg = append([]string{"", "web.code.inner", "args", "src/ main.go", "result", arg[1], "meta.display", "/plugin/local/code/inner.js", "style", "output"}, arg[2:]...) + } _field_show(m, arg[0], arg[1], arg[2:]...) }}, }) diff --git a/misc/node/admin.shy b/misc/node/admin.shy index afcce899..a71474b3 100644 --- a/misc/node/admin.shy +++ b/misc/node/admin.shy @@ -12,3 +12,4 @@ shell ` git clone -b imooc-island https://gitee.com/talelin/lin-cms-vue.git git clone -b imooc-island https://gitee.com/talelin/lin-cms-koa.git ` +field web.code.vimer args "usr/lin-cms-vue/ src/views/home/Home.vue" diff --git a/misc/node/api.go b/misc/node/api.go new file mode 100644 index 00000000..218c396b --- /dev/null +++ b/misc/node/api.go @@ -0,0 +1,28 @@ +package node + +import ( + "shylinux.com/x/ice" + "shylinux.com/x/icebergs/base/aaa" + "shylinux.com/x/icebergs/base/web" +) + +type api struct { + spaceList string `http:"/api/space/list"` + userList string `http:"/api/user/list"` + userAdd string `http:"/api/user/add"` +} + +func (s api) UserAdd(m *ice.Message, arg ...string) { + m.Cmdy(aaa.USER) +} +func (s api) UserList(m *ice.Message, arg ...string) { + m.Cmdy(aaa.USER) +} +func (s api) SpaceList(m *ice.Message, arg ...string) { + m.Cmdy(web.DREAM) +} +func (s api) List() { + +} + +func init() { ice.CodeCtxCmd(api{}) } diff --git a/misc/node/element.shy b/misc/node/element.shy deleted file mode 100644 index 7a5f4f65..00000000 --- a/misc/node/element.shy +++ /dev/null @@ -1,5 +0,0 @@ -section "element" -refer ` -https://element.eleme.cn/2.0/#/zh-CN/component/installation -` - diff --git a/misc/node/grpc.shy b/misc/node/grpc.shy deleted file mode 100644 index 160fca89..00000000 --- a/misc/node/grpc.shy +++ /dev/null @@ -1,7 +0,0 @@ -section "grpc" -shell ` -cnpm i --save-dev grpc-web -cnpm i --save-dev google-protobuf -cnpm i -g protoc-gen-js protoc-gen-grpc-web -protoc --js_out=import_style=commonjs:./demo/src --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./demo/src ./idl/*.proto -` diff --git a/misc/node/node.shy b/misc/node/node.shy index 688e67d0..2797434a 100644 --- a/misc/node/node.shy +++ b/misc/node/node.shy @@ -4,6 +4,7 @@ refer ` 官网 https://nodejs.org/ 源码 https://github.com/nodejs/node 文档 https://nodejs.org/dist/latest-v18.x/docs/api/ +https://cloud.tencent.com/developer/section/1489885 ` field web.code.node.node diff --git a/misc/node/npm.shy b/misc/node/npm.shy index 3eb6a644..d40b00c8 100644 --- a/misc/node/npm.shy +++ b/misc/node/npm.shy @@ -3,3 +3,4 @@ shell ` ./bin/npm install -g cnpm --registry=https://registry.npm.taobao.org ` field web.code.node.npm + diff --git a/misc/node/router.shy b/misc/node/router.shy deleted file mode 100644 index c97ff625..00000000 --- a/misc/node/router.shy +++ /dev/null @@ -1,4 +0,0 @@ -section "router" -refer ` -https://router.vuejs.org/zh/guide/essentials/nested-routes.html -` diff --git a/misc/node/vue.go b/misc/node/vue.go index 2341cc0b..baf84512 100644 --- a/misc/node/vue.go +++ b/misc/node/vue.go @@ -3,15 +3,63 @@ package node import ( "shylinux.com/x/ice" "shylinux.com/x/icebergs/base/nfs" + "shylinux.com/x/icebergs/base/tcp" + "shylinux.com/x/icebergs/core/code" + kit "shylinux.com/x/toolkits" ) type vue struct { ice.Code + ice.Lang list string `name:"list path auto" help:"框架"` } -func (s vue) List(m *ice.Message) { - m.Cmdy(nfs.DIR, nfs.USR) +func (s vue) Render(m *ice.Message, arg ...string) { + list := kit.Dict(kit.UnMarshal(m.Cmdx(nfs.CAT, kit.Path(m.Option(nfs.PATH), "display.json")))) + m.EchoIFrame(kit.Format("%s%s", list[tcp.HOST], kit.Format(list[m.Option(nfs.FILE)]))) } +func (s vue) Init(m *ice.Message) { + s.Lang.Init(m, code.PREPARE, ice.Map{ + code.KEYWORD: kit.List( + "template", "script", "style", + "router-link", "router-view", + "el-container", "el-aside", "el-header", "el-main", + + "el-tabs", + "el-tab-pane", + "el-dialog", + "el-form", + "el-form-item", + + "el-input", + "el-select", + "el-option", + "el-button", + "el-checkbox-group", + "el-checkbox", + "el-pagination", + + "el-menu", + "el-submenu", + "el-menu-item", + + "el-table", + "el-table-column", + ), + code.FUNCTION: kit.List( + "data", + "props", + "inject", + "provide", + "components", + "computed", + "created", + "mounted", + "methods", + "watch", + ), + }, "include", kit.List(nfs.HTML, nfs.CSS, nfs.JS), "split.operator", "{[(.,:#)]}") +} +func (s vue) List(m *ice.Message) { m.Cmdy(nfs.DIR, nfs.USR) } func init() { ice.CodeCtxCmd(vue{}) } diff --git a/misc/node/vue.shy b/misc/node/vue.shy index defcd4b9..c1ecb716 100644 --- a/misc/node/vue.shy +++ b/misc/node/vue.shy @@ -9,4 +9,40 @@ shell ` cnpm install -g @vue/cli vue create demo && cd demo vue serve +vue build +` + +section "grpc" +shell ` +cnpm i --save-dev grpc-web +cnpm i --save-dev google-protobuf +cnpm i -g protoc-gen-js protoc-gen-grpc-web +protoc --js_out=import_style=commonjs:./demo/src --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./demo/src ./idl/*.proto +` + +section "axios" +refer ` +官网 https://www.axios-http.cn +文档 https://www.axios-http.cn/docs/intro +源码 https://github.com/axios/axios +` + +section "router" +refer ` +https://router.vuejs.org/zh/guide/essentials/nested-routes.html +` + +section "element" +refer ` +https://element.eleme.cn/2.0/#/zh-CN/component/installation +` +shell ` +npm install element-ui +` + +field inner ` +// main.js +import ElementUI from "element-ui" + +Vue.use(ElementUI) `