mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
add web.store
This commit is contained in:
parent
c56ca8d4e2
commit
e1f72758df
4
base/web/store.css
Normal file
4
base/web/store.css
Normal file
@ -0,0 +1,4 @@
|
||||
fieldset.web.store.plug>div.output>div.project { width:120px; flex:0 0 120px; }
|
||||
fieldset.web.store>div.output>div.layout>div.layout>div.content>div.item div.title div.label { font-size:var(--status-font-size); font-weight:normal; margin-top:var(--input-margin); }
|
||||
fieldset.web.store>div.output>div.layout>div.layout>div.content>div.item div.title div.label span { padding:var(--input-padding); padding-right:var(--input-margin); }
|
||||
fieldset.web.store>div.output>div.layout>div.layout>div.content>div.item div.content { height:70px; }
|
51
base/web/store.go
Normal file
51
base/web/store.go
Normal file
@ -0,0 +1,51 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const STORE = "store"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
STORE: {Help: "系统商店", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmds(SPIDE).Table(func(value ice.Maps) {
|
||||
if value[CLIENT_TYPE] == nfs.REPOS {
|
||||
m.Push("", value, arg[0])
|
||||
}
|
||||
})
|
||||
}},
|
||||
"install": {Help: "购买", Hand: func(m *ice.Message, arg ...string) {
|
||||
if strings.HasPrefix(m.Option(mdb.ICON), "/require/") {
|
||||
m.Option(mdb.ICON, strings.TrimSuffix(strings.TrimPrefix(m.Option(mdb.ICON), "/require/"), "?pod="+m.Option(mdb.NAME)))
|
||||
}
|
||||
m.OptionDefault(nfs.BINARY, m.Option(ORIGIN)+S(m.Option(mdb.NAME)))
|
||||
m.Cmdy(DREAM, mdb.CREATE, m.OptionSimple(mdb.NAME, mdb.ICON, nfs.REPOS, nfs.BINARY))
|
||||
m.Cmdy(DREAM, cli.START, m.OptionSimple(mdb.NAME))
|
||||
}},
|
||||
PORTAL: {Help: "详情", Hand: func(m *ice.Message, arg ...string) {
|
||||
ctx.ProcessField(m, CHAT_IFRAME, m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(PORTAL), arg...)
|
||||
}},
|
||||
mdb.CREATE: {Name: "create name* origin*", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(mdb.TYPE, nfs.REPOS)
|
||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("name,origin,type"))
|
||||
}},
|
||||
}, ctx.ConfAction(ctx.TOOLS, "dream")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
m.Cmdy(SPIDE, arg, kit.Dict(ice.MSG_FIELDS, "time,client.type,client.name,client.origin")).Action(mdb.CREATE).Display("")
|
||||
ctx.Toolkit(m)
|
||||
} else {
|
||||
origin := SpideOrigin(m, arg[0])
|
||||
m.SetAppend().SplitIndex(m.Cmdx(SPIDE, arg[0], C(DREAM))).Table(func(value ice.Maps) { m.Push(ORIGIN, origin) }).PushAction("install", PORTAL)
|
||||
}
|
||||
}},
|
||||
})
|
||||
}
|
38
base/web/store.js
Normal file
38
base/web/store.js
Normal file
@ -0,0 +1,38 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.ui = can.onappend.layout(can), can.onappend.style(can, "output card", can.ui.content), can.onimport._project(can, msg)
|
||||
can.onmotion.delay(can, function() { can.onimport.layout(can) })
|
||||
},
|
||||
_project: function(can, msg) { var select
|
||||
msg.Table(function(value) { if (value["client.type"] != nfs.REPOS) { return } value.name = `${value["client.name"]}`
|
||||
var _target = can.onimport.item(can, value, function(event) {
|
||||
if (can.onmotion.cache(can, function() { return value.name }, can.ui.content)) { return can.onimport.layout(can) }
|
||||
can.run(event, [value.name], function(msg) { can.onimport._content(can, msg), can.onimport.layout(can) })
|
||||
}, function() {}, can.ui.project); select = (value.name == ice.DEV? _target: select)||_target
|
||||
}), select && select.click()
|
||||
},
|
||||
_content: function(can, msg) { var year = new Date().getFullYear()+"-"
|
||||
can.page.Appends(can, can.ui.content, msg.Table(function(value) { if (value.type != web.WORKER) { return }
|
||||
var icon = value.icon; if (can.base.beginWith(value.icon, nfs.PS)) { icon = value.origin+value.icon }
|
||||
return {view: [[html.ITEM, value.status]], list: [
|
||||
{view: [wiki.TITLE, html.DIV], list: [{img: icon}, {view: mdb.NAME, list: [
|
||||
{view: mdb.NAME, list: [{text: [value.name, "", mdb.NAME]}]},
|
||||
{view: "label", list: [
|
||||
// {icon: "bi bi-file-earmark-code"}, {text: value.language||"None"},
|
||||
// {icon: "bi bi-share"}, {text: value.forks_count||"0"},
|
||||
// {icon: "bi bi-star"}, {text: value.stars_count||"0"},
|
||||
{icon: "bi bi-folder2"}, {text: value.version.split("-").slice(0, 2).join("-")},
|
||||
{icon: "bi bi-clock"}, {text: can.base.trimPrefix(value.time.split(":").slice(0, 2).join(":"), year)},
|
||||
]}
|
||||
]}]}, {view: [wiki.CONTENT, html.DIV, value.description]},
|
||||
{view: html.ACTION, inner: value.action, _init: function(target) { can.onappend.mores(can, target, value, 5) }},
|
||||
]}
|
||||
}))
|
||||
},
|
||||
layout: function(can) {
|
||||
can.page.style(can, can.ui.project, html.HEIGHT, can.ConfHeight())
|
||||
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight())
|
||||
can.page.style(can, can._output, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
||||
can.onlayout.expand(can, can.ui.content, can.user.isMobile && !can.user.isLandscape()? can.ConfWidth(): 320)
|
||||
},
|
||||
}, [""])
|
Loading…
x
Reference in New Issue
Block a user