mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 17:18:05 +08:00
opt some
This commit is contained in:
parent
4554de495d
commit
1991db8302
@ -1,14 +0,0 @@
|
||||
package mall
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
)
|
||||
|
||||
const PAPER = "paper"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
PAPER: {Name: "paper", Help: "问卷", Actions: ice.MergeActions(ice.Actions{}, mdb.ZoneAction(mdb.FIELD, "time,id,type,name,text"))},
|
||||
})
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
fieldset.count div.output div.item {
|
||||
margin:10px; padding:10px;
|
||||
border:solid 2px green;
|
||||
float:left;
|
||||
}
|
||||
fieldset.count div.output div.item.gone {
|
||||
border:solid 2px red;
|
||||
}
|
||||
fieldset.count div.output div.item div.name {
|
||||
font-size:38px; color:green;
|
||||
font-family:cursive;
|
||||
text-align:center;
|
||||
}
|
||||
fieldset.count div.output div.item span.day {
|
||||
font-size:24px; color:green;
|
||||
}
|
||||
fieldset.count div.output div.item.gone div.name {
|
||||
color:red;
|
||||
}
|
||||
fieldset.count div.output div.item.gone span.day {
|
||||
color:red;
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package team
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const COUNT = "count"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
COUNT: {Name: "count begin_time@date end_time@date auto insert", Help: "倒计时", Meta: kit.Dict(
|
||||
ice.Display(""),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INSERT: {Name: "insert zone type=once,step,week name text begin_time@date close_time@date", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(TASK, mdb.INSERT, arg)
|
||||
}},
|
||||
}, TASK), Hand: func(m *ice.Message, arg ...string) {
|
||||
begin_time, end_time := _plan_scope(m, 8, append([]string{LONG}, arg...)...)
|
||||
msg := _plan_list(m.Spawn(), begin_time, end_time)
|
||||
msg.SortTime(BEGIN_TIME)
|
||||
|
||||
tz := int64(8)
|
||||
msg.Tables(func(value ice.Maps) {
|
||||
if value[mdb.STATUS] == CANCEL {
|
||||
return
|
||||
}
|
||||
|
||||
show := []string{}
|
||||
for _, k := range []string{mdb.NAME, mdb.TEXT} {
|
||||
show = append(show, kit.Format(`<div class="%v">%v</div>`, k, value[k]))
|
||||
}
|
||||
|
||||
t := (kit.Time(value[BEGIN_TIME])+int64(time.Hour)*tz)/int64(time.Second)/3600/24 - (time.Now().Unix()+3600*tz)/3600/24
|
||||
m.Echo(`<div class="item %s" title="%s">距离 %v%v%v<span class="day"> %v </span>天</div>`,
|
||||
kit.Select("gone", "come", t > 0), value[mdb.TEXT],
|
||||
strings.Split(value[BEGIN_TIME], " ")[0],
|
||||
strings.Join(show, ""),
|
||||
kit.Select("已经", "还有", t > 0), t,
|
||||
)
|
||||
})
|
||||
}},
|
||||
})
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
|
||||
can.onmotion.clear(can)
|
||||
can.onappend.table(can, msg)
|
||||
can.onappend.board(can, msg)
|
||||
can.base.isFunc(cb) && cb(msg)
|
||||
},
|
||||
}, [""])
|
||||
Volcanos("onaction", {help: "控件交互", list: ["play"],
|
||||
play: function(event, can) {
|
||||
can.page.Select(can, can._output, "div.item", function(item) {
|
||||
can.onmotion.hidden(can, item)
|
||||
})
|
||||
can.core.Next(can.page.Select(can, can._output, "div.item"), function(item, next) {
|
||||
can.onmotion.show(can, 300, next, item)
|
||||
}, function() {
|
||||
can.user.toast(can, "播放结束")
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: []})
|
@ -14,10 +14,10 @@ const EPIC = "epic"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
EPIC: {Name: "epic hash list create export import", Help: "史记", Actions: ice.MergeActions(ice.Actions{
|
||||
EPIC: {Name: "epic hash list", Help: "史记", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create time@date zone name"}, mdb.MODIFY: {Name: "modify time@date zone name"},
|
||||
}, mdb.HashAction(mdb.FIELD, "time,hash,zone,name")), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).Tables(func(value ice.Maps) {
|
||||
if mdb.HashSelect(m, arg...).Tables(func(value ice.Maps) {
|
||||
if span := kit.Time(m.Time()) - kit.Time(value[mdb.TIME]); span > 0 {
|
||||
m.Push(mdb.TEXT, kit.Format(`已经 <span style="font-size:24px;color:red">%v</span> 天<br>距 %s<br>`,
|
||||
int(time.Duration(span)/time.Hour/24), kit.Split(value[mdb.TIME])[0],
|
||||
@ -27,7 +27,9 @@ func init() {
|
||||
-int(time.Duration(span)/time.Hour/24)+1, kit.Split(value[mdb.TIME])[0],
|
||||
))
|
||||
}
|
||||
}).Sort(mdb.TIME).PushAction(mdb.MODIFY, mdb.REMOVE)
|
||||
}).PushAction(mdb.MODIFY, mdb.REMOVE); len(arg) == 0 || arg[0] == "" {
|
||||
m.Sort(mdb.TIME).Action(mdb.CREATE, mdb.EXPORT, mdb.IMPORT)
|
||||
}
|
||||
web.PushPodCmd(m, "", arg...)
|
||||
ctx.DisplayTableCard(m)
|
||||
}},
|
||||
|
@ -38,16 +38,14 @@ func _plan_scope(m *ice.Message, tz int, arg ...string) (begin_time, end_time ti
|
||||
}
|
||||
return begin_time, end_time
|
||||
}
|
||||
func _plan_list(m *ice.Message, begin_time, end_time time.Time) *ice.Message {
|
||||
func _plan_list(m *ice.Message, begin_time, end_time time.Time) {
|
||||
m.Option(mdb.CACHE_LIMIT, "-1")
|
||||
m.OptionFields("begin_time,close_time,zone,id,level,status,score,type,name,text,pod,extra")
|
||||
m.Cmd(mdb.SELECT, m.Prefix(TASK), "", mdb.ZONE, mdb.FOREACH, func(key string, fields []string, value, val ice.Map) {
|
||||
begin, _ := time.ParseInLocation(ice.MOD_TIME, kit.Format(value[BEGIN_TIME]), time.Local)
|
||||
if begin.After(begin_time) && end_time.After(begin) {
|
||||
if begin, _ := time.ParseInLocation(ice.MOD_TIME, kit.Format(value[BEGIN_TIME]), time.Local); begin.After(begin_time) && end_time.After(begin) {
|
||||
m.Push(key, value, fields, val).PushButton(_task_action(m, value[STATUS], mdb.PLUGIN))
|
||||
}
|
||||
})
|
||||
return m
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -9,4 +9,4 @@ const TEAM = "team"
|
||||
|
||||
var Index = &ice.Context{Name: TEAM, Help: "团队中心"}
|
||||
|
||||
func init() { web.Index.Register(Index, nil, TASK, PLAN) }
|
||||
func init() { web.Index.Register(Index, nil, TODO, EPIC, TASK, PLAN) }
|
||||
|
@ -12,14 +12,16 @@ const TODO = "todo"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
TODO: {Name: "todo hash list create export import", Help: "待办", Actions: ice.MergeActions(ice.Actions{
|
||||
TODO: {Name: "todo hash list", Help: "待办", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { mdb.HashInputs(m, arg).Cmdy(TASK, mdb.INPUTS, arg) }},
|
||||
cli.START: {Name: "start type=once,step,week", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(TASK, mdb.INSERT, m.OptionSimple("zone,type,name,text"))
|
||||
mdb.HashRemove(m, m.OptionSimple(mdb.HASH))
|
||||
}},
|
||||
}, mdb.HashAction(mdb.FIELD, "time,hash,zone,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).PushAction(cli.START, mdb.REMOVE)
|
||||
if mdb.HashSelect(m, arg...).PushAction(cli.START, mdb.REMOVE); len(arg) == 0 || arg[0] == "" {
|
||||
m.Action(mdb.CREATE, mdb.EXPORT, mdb.IMPORT)
|
||||
}
|
||||
web.PushPodCmd(m, "", arg...)
|
||||
ctx.DisplayTableCard(m)
|
||||
}},
|
||||
|
Loading…
x
Reference in New Issue
Block a user