mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 09:14:06 +08:00
add count
This commit is contained in:
parent
75ae5cdb80
commit
7d27b56595
@ -125,6 +125,12 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
|
|||||||
m.Add("append", "name", kit.Chains(value, "conf.name"))
|
m.Add("append", "name", kit.Chains(value, "conf.name"))
|
||||||
m.Add("append", "create_user", kit.Chains(value, "conf.create_user"))
|
m.Add("append", "create_user", kit.Chains(value, "conf.create_user"))
|
||||||
m.Add("append", "create_time", kit.Chains(value, "conf.create_time"))
|
m.Add("append", "create_time", kit.Chains(value, "conf.create_time"))
|
||||||
|
|
||||||
|
if list, ok := kit.Chain(value, "text.list").([]interface{}); ok {
|
||||||
|
m.Add("append", "count", len(list))
|
||||||
|
} else {
|
||||||
|
m.Add("append", "count", 0)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
m.Table()
|
m.Table()
|
||||||
return
|
return
|
||||||
|
@ -10,12 +10,17 @@ var page = Page({
|
|||||||
page.panes.river = field
|
page.panes.river = field
|
||||||
page.panes.channel = output
|
page.panes.channel = output
|
||||||
page.showRiver(page, option)
|
page.showRiver(page, option)
|
||||||
|
return {"button": ["添加"], "action": function(value) {
|
||||||
|
ctx.Run(page, option.dataset, ["river", "create", prompt("name")], function(msg) {
|
||||||
|
page.showRiver(page, option)
|
||||||
|
})
|
||||||
|
}}
|
||||||
},
|
},
|
||||||
showRiver: function(page, option) {
|
showRiver: function(page, option) {
|
||||||
page.panes.channel.innerHTML = ""
|
page.panes.channel.innerHTML = ""
|
||||||
page.getRiver(page, option, function(line, index) {
|
page.getRiver(page, option, function(line, index) {
|
||||||
page.conf.river = page.conf.river || page.showTarget(page, option, line.key) || line.key
|
page.conf.river = page.conf.river || page.showTarget(page, option, line.key) || line.key
|
||||||
kit.AppendChild(page.panes.channel, [{view: ["item", "div", line.name], click: function(event) {
|
kit.AppendChild(page.panes.channel, [{view: ["item", "div", line.name+"("+line.count+")"], click: function(event) {
|
||||||
if (page.conf.river == line.key) {
|
if (page.conf.river == line.key) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -151,7 +156,15 @@ var page = Page({
|
|||||||
var init = page[field.dataset.init]
|
var init = page[field.dataset.init]
|
||||||
if (typeof init == "function") {
|
if (typeof init == "function") {
|
||||||
var conf = page[field.dataset.init](page, field, option, output)
|
var conf = page[field.dataset.init](page, field, option, output)
|
||||||
if (conf) {
|
if (conf && conf["button"]) {
|
||||||
|
var buttons = []
|
||||||
|
conf.button.forEach(function(value, index) {
|
||||||
|
buttons.push({"button": [value, function(event) {
|
||||||
|
typeof conf["action"] == "function" && conf["action"](value, event)
|
||||||
|
}]})
|
||||||
|
})
|
||||||
|
kit.InsertChild(field, output, "div", buttons)
|
||||||
|
} else if (conf) {
|
||||||
kit.AppendChild(output, conf)
|
kit.AppendChild(output, conf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user