forked from x/icebergs
opt location
This commit is contained in:
parent
37b5d0cf13
commit
db53a31bcf
@ -68,7 +68,7 @@ const ACTION = "action"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ACTION: {Actions: ice.MergeActions(ice.Actions{
|
||||
ACTION: {Help: "工作区", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(mdb.MODIFY, RIVER, _storm_key(m), mdb.LIST, m.OptionSimple(mdb.ID), arg)
|
||||
}},
|
||||
|
@ -10,7 +10,7 @@ const CMD = "cmd"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
CMD: {Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
CMD: {Help: "命令", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg[0]) == 0 || arg[0] == "" {
|
||||
web.RenderMain(m)
|
||||
} else if aaa.Right(m, arg) {
|
||||
|
@ -10,7 +10,7 @@ const FLOWS = "flows"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
FLOWS: {Name: "flows zone hash auto", Icon: "Automator.png", Help: "工作流", Actions: ice.MergeActions(ice.Actions{
|
||||
FLOWS: {Name: "flows zone hash auto", Help: "工作流", Icon: "Automator.png", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) {
|
||||
mdb.HashSelects(m.Spawn()).Table(func(value ice.Maps) {
|
||||
|
@ -13,7 +13,7 @@ const FOOTER = "footer"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
FOOTER: {Actions: ice.MergeActions(ice.Actions{
|
||||
FOOTER: {Help: "状态栏", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.HELP: {Hand: func(m *ice.Message, arg ...string) {
|
||||
ctx.ProcessField(m, web.WIKI_WORD, []string{ctx.FileURI(kit.ExtChange(ctx.GetCmdFile(m, arg[0]), nfs.SHY))}, arg...)
|
||||
}},
|
||||
|
@ -64,7 +64,7 @@ const HEADER = "header"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
HEADER: {Actions: ice.MergeActions(ice.Actions{
|
||||
HEADER: {Help: "标题栏", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
aaa.White(m, HEADER)
|
||||
aaa.Black(m, kit.Keys(HEADER, ctx.ACTION, mdb.CREATE))
|
||||
|
@ -15,7 +15,7 @@ const ICONS = "icons"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ICONS: {Actions: ctx.ConfAction(nfs.PATH, "bootstrap-icons/font/bootstrap-icons.css"), Hand: func(m *ice.Message, arg ...string) {
|
||||
ICONS: {Help: "图标", Actions: ctx.ConfAction(nfs.PATH, "bootstrap-icons/font/bootstrap-icons.css"), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(lex.SPLIT, ice.USR_MODULES+mdb.Config(m, nfs.PATH), kit.Dict(lex.SPLIT_SPACE, " {:;}"), func(text string, ls []string) {
|
||||
if len(ls) > 2 && ls[2] == nfs.CONTENT {
|
||||
name := "bi " + strings.TrimPrefix(ls[0], nfs.PT)
|
||||
|
@ -21,7 +21,7 @@ func init() {
|
||||
}},
|
||||
})
|
||||
chat.Index.MergeCommands(ice.Commands{
|
||||
AMAP: {Name: "amap keyword auto", Help: "高德地图", Hand: func(m *ice.Message, arg ...string) {
|
||||
AMAP: {Help: "高德地图", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Display("", nfs.SCRIPT, mdb.Config(m, nfs.SCRIPT))
|
||||
}},
|
||||
})
|
||||
|
@ -8,18 +8,15 @@ Volcanos(chat.ONIMPORT, {
|
||||
map.on("moveend", function(event) { can.Action("pitch", map.getPitch().toFixed(2)), can.Action("rotation", map.getRotation()) })
|
||||
map.on("zoomend", function(event) { can.Action("zoom", map.getZoom().toFixed(2)) })
|
||||
map.on("click", function(event) { can.onexport.status(can, event.lnglat) })
|
||||
map.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.MapType', 'AMap.Geolocation', 'AMap.Geocoder'], function() {
|
||||
map.addControl(new AMap.ToolBar()), map.addControl(new AMap.Scale()), map.addControl(new AMap.MapType())
|
||||
map.plugin(['AMap.Scale', 'AMap.ToolBar', 'AMap.MapType', 'AMap.Geolocation', 'AMap.Geocoder', 'AMap.Weather'], function() {
|
||||
map.addControl(new AMap.Scale()), map.addControl(new AMap.ToolBar()), map.addControl(new AMap.MapType())
|
||||
map.addControl(can.ui.geolocation = new AMap.Geolocation({buttonPosition: 'RB', enableHighAccuracy: true})), can.ui.geocoder = new AMap.Geocoder({})
|
||||
AMap.event.addListener(can.ui.geolocation, 'complete', function() {
|
||||
can.ui.map.setZoom(can.Action("zoom", 16)), can.ui.map.setPitch(can.Action("pitch", 0)), can.ui.map.setRotation(can.Action("rotation", 0))
|
||||
can.user.toastSuccess(can), can.onmotion.delay(can, function() { can.onexport.status(can) }, 500)
|
||||
AMap.plugin('AMap.Weather', function() { var weather = new AMap.Weather()
|
||||
weather.getLive(can.Status("city"), function(err, data) { can.Status(data) })
|
||||
})
|
||||
})
|
||||
// can.onaction.current({}, can)
|
||||
can.onexport.status(can)
|
||||
can.user.toastSuccess(can), can.onmotion.delay(can, function() { can.onexport.status(can)
|
||||
var weather = new AMap.Weather(); weather.getLive(can.Status("city"), function(err, data) { can.Status(data) })
|
||||
}, 500)
|
||||
}), can.onmotion.delay(can, function() { can.onaction.current({}, can) })
|
||||
})
|
||||
map.add(can.ui.favor = new AMap.OverlayGroup())
|
||||
map.add(can.ui.marker = new AMap.Marker({position: [116.39, 39.9]}))
|
||||
@ -43,30 +40,26 @@ Volcanos(chat.ONACTION, {
|
||||
current: "定位", favor: "收藏",
|
||||
input: {
|
||||
zoom: "缩放", pitch: "倾斜", rotation: "旋转",
|
||||
weather: "天气", temperature: "温度", humidity: "湿度", windPower: "风速",
|
||||
},
|
||||
},
|
||||
current: function(event, can) { can.user.toastProcess(can), can.ui.geolocation.getCurrentPosition() },
|
||||
current: function(event, can) {
|
||||
can.user.toastProcess(can), can.ui.geolocation.getCurrentPosition()
|
||||
},
|
||||
feature: function(event, can, button, value) {
|
||||
if (value == "road") {
|
||||
can.ui.map.setFeatures(["bg", "road"])
|
||||
can.ui.map.setFeatures(["bg", "road", "building"])
|
||||
} else {
|
||||
can.ui.map.setFeatures(["bg", "road", "building", "point"])
|
||||
}
|
||||
},
|
||||
center: function(can, item) {
|
||||
can.ui.marker.setTitle(item.name)
|
||||
center: function(can, item) { can.ui.marker.setTitle(item.name)
|
||||
can.ui.map.setCenter(new AMap.LngLat(parseFloat(item.longitude), parseFloat(item.latitude)))
|
||||
can.onmotion.delay(can, function() { can.onexport.status(can) }, 500)
|
||||
}
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {
|
||||
status: function(can, p) { p = p||can.ui.map.getCenter(), can.ui.marker.setPosition(p), can.ui.circle.setCenter(p)
|
||||
can.Status({longitude: p.getLng().toFixed(6), latitude: p.getLat().toFixed(6)})
|
||||
can.ui.map.getCity(function(result) { can.Status(result) })
|
||||
can.ui.geocoder.getAddress(p, function(status, result) {
|
||||
can.Status({text: result.regeocode.formattedAddress})
|
||||
can.Status(result.regeocode.addressComponent)
|
||||
})
|
||||
can.Status({longitude: p.getLng().toFixed(6), latitude: p.getLat().toFixed(6)}), can.ui.map.getCity(function(result) { can.Status(result) })
|
||||
can.ui.geocoder.getAddress(p, function(status, result) { can.Status(result.regeocode.addressComponent), can.Status({text: result.regeocode.formattedAddress}) })
|
||||
},
|
||||
})
|
||||
|
18
core/chat/location/bmap.go
Normal file
18
core/chat/location/bmap.go
Normal file
@ -0,0 +1,18 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/core/chat"
|
||||
)
|
||||
|
||||
const BMAP = "bmap"
|
||||
|
||||
func init() {
|
||||
chat.Index.MergeCommands(ice.Commands{
|
||||
BMAP: {Help: "百度地图", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Display("", nfs.SCRIPT, mdb.Config(m, nfs.SCRIPT))
|
||||
}},
|
||||
})
|
||||
}
|
22
core/chat/location/bmap.js
Normal file
22
core/chat/location/bmap.js
Normal file
@ -0,0 +1,22 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg, cb) {
|
||||
// window.initialize = function() {
|
||||
// can.require(["location.js"], function() { can.onimport._layout_init(can, msg, function() { cb && cb(msg), can.onimport._content(can) }) })
|
||||
// }, can.require([can.Conf(nfs.SCRIPT)])
|
||||
can.require(["location.js"], function() { can.onimport._layout_init(can, msg, function() { cb && cb(msg), can.onimport._content(can) }) })
|
||||
},
|
||||
_content: function(can, item) {
|
||||
var map = new BMapGL.Map(can.ui.content)
|
||||
var point = new BMapGL.Point(116.404, 39.915)
|
||||
map.centerAndZoom(point, 15)
|
||||
map.enableScrollWheelZoom(true)
|
||||
map.setMapType(BMAP_EARTH_MAP)
|
||||
var scaleCtrl = new BMapGL.ScaleControl(); // 添加比例尺控件
|
||||
map.addControl(scaleCtrl);
|
||||
var zoomCtrl = new BMapGL.ZoomControl(); // 添加缩放控件
|
||||
map.addControl(zoomCtrl);
|
||||
var cityCtrl = new BMapGL.CityListControl(); // 添加城市列表控件
|
||||
map.addControl(cityCtrl);
|
||||
can.ui.map = map
|
||||
},
|
||||
})
|
@ -1,4 +1,6 @@
|
||||
section "bmap"
|
||||
refer `
|
||||
后台 https://lbsyun.baidu.com/apiconsole/key#/home
|
||||
https://lbsyun.baidu.com/index.php?title=jspopularGL
|
||||
https://map.baidu.com/
|
||||
`
|
||||
|
@ -24,7 +24,7 @@ const LOCATION = "location"
|
||||
func init() {
|
||||
chat.Index.MergeCommands(ice.Commands{
|
||||
LOCATION: {Help: "地图", Icon: "Maps.png", Meta: kit.Dict(
|
||||
ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict(
|
||||
ice.CTX_TRANS, kit.Dict(EXPLORE, "周边", DIRECTION, "导航", DISTRICT, "地区", html.INPUT, kit.Dict(
|
||||
LONGITUDE, "经度", LATITUDE, "纬度", PROVINCE, "省份", CITY, "城市", DISTRICT, "区域", STREET, "街路",
|
||||
)),
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
|
@ -1,26 +1,22 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {},
|
||||
_layout_init: function(can, msg, cb) {
|
||||
can.ui = can.onappend.layout(can); if (can.user.isMobile) {
|
||||
can.db.list = {}, can.ui = can.onappend.layout(can), can.onimport._project(can)
|
||||
// can.core.Item(can.ui.zone, function(key, item) { key == "favor" || item._legend.click() })
|
||||
if (can.user.isMobile) {
|
||||
can.page.style(can, can.ui.project, "z-index", 10, "position", "absolute")
|
||||
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
||||
can.page.Select(can, can._action, "div.item.text", function(target) { can.onmotion.hidden(can, target) })
|
||||
can.onmotion.hidden(can, can._status)
|
||||
can.onmotion.hidden(can, can._action), can.onmotion.hidden(can, can._status)
|
||||
} else {
|
||||
can.ui.layout(can.ConfHeight(), can.ConfWidth())
|
||||
}
|
||||
can.onimport._project(can), can.db.list = {}
|
||||
can.user.isMobile && can.core.Item(can.ui.zone, function(key, item) { key == "favor" || item._legend.click() })
|
||||
can.user.isMobile && can.onmotion.hidden(can, can._action)
|
||||
msg.Option(ice.MSG_ACTION, ""), cb && cb(msg)
|
||||
if (msg.IsDetail()) {
|
||||
can.onaction.center(can, can._current = can.onimport._item(can, msg.TableDetail()))
|
||||
} else {
|
||||
if (msg.IsDetail()) { can.onaction.center(can, can.onimport._item(can, msg.TableDetail())) } else {
|
||||
msg.Table(function(item) { can.onimport._item(can, item) }), can.ui.zone.favor._total(msg.Length())
|
||||
var item = can.db.list[can.db.hash[0]]; item? item.click(): can.user.agent.getLocation(can, function(res) { res.type = "current", can.onaction.center(can, can._current = res) })
|
||||
var item = can.db.list[can.db.hash[0]]; item && item.click()
|
||||
}
|
||||
},
|
||||
_project: function(can) { can.onmotion.clear(can, can.ui.project), can.onimport.zone(can, [
|
||||
{name: "explore"}, {name: "search"}, {name: "direction"},
|
||||
{name: "search"}, {name: "explore"}, {name: "direction"},
|
||||
{name: "favor", _menu: shy({"play": function(event, can, button) {
|
||||
can.core.Next(can.page.Select(can, can.ui.zone.favor._target, html.DIV_ITEM), function(item, next) {
|
||||
item.click(), can.onmotion.delay(can, next, 3000)
|
||||
@ -31,27 +27,26 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) {},
|
||||
_item: function(can, item, target) { if (!item.latitude || !item.longitude) { return item }
|
||||
var _target = can.onimport.item(can, item, function(event) {
|
||||
can.onaction.center(can, item), can.ui.map.setZoom(can.Action("zoom", 16)), can.misc.SearchHash(can, item.hash)
|
||||
can.onimport.plugin(can, item) && can.onmotion.delay(can, function() { var ls = can.ui.map.getBounds().path
|
||||
can.ui.map.setCenter([ls[1][0]-(ls[1][0]-ls[3][0])*3/8, ls[1][1]+(ls[3][1]-ls[1][1])*3/8])
|
||||
can.onimport.plugin(can, item) && can.onmotion.delay(can, function() {
|
||||
var ls = can.ui.map.getBounds().path
|
||||
ls && can.ui.map.setCenter([ls[1][0]-(ls[1][0]-ls[3][0])*3/8, ls[1][1]+(ls[3][1]-ls[1][1])*3/8])
|
||||
}, 500)
|
||||
}, function(event) {
|
||||
can.onaction.center(can, item), can.user.carteRight(event, can, {
|
||||
direction: function(event, button) { can.onaction[button](event, can, button) },
|
||||
favor: function(event, button) { can.onaction.create(can.request(event, item), can, button) },
|
||||
plugin: function(event, button) { can.user.input(can.request(event, item), can, [ctx.INDEX, ctx.ARGS], function(data) {
|
||||
item.extra = can.base.Copy(item.extra||{}, data), can.onimport.plugin(can, item)
|
||||
can.runAction(event, mdb.MODIFY, ["extra.index", data.index, "extra.args", data.args], function() {})
|
||||
}) },
|
||||
favor: function(event) { can.request(event, item), can.onaction.create(event, can) },
|
||||
direction: function(event, button) { can.onaction.center(can, item), can.onaction[button](event, can, button) },
|
||||
remove: function(event, button) { can.runAction(event, mdb.REMOVE, [mdb.HASH, item.hash], function() { can.page.Remove(can, _target) }) },
|
||||
})
|
||||
}, target||can.ui.zone.favor._target); can.db.list[item.hash] = _target, can.ui.zone.favor._total()
|
||||
return can.onimport._mark(can, item, _target), item
|
||||
},
|
||||
_mark: function(can, item) {},
|
||||
_style: function(can, style) {},
|
||||
plugin: function(can, item) { var extra = can.base.Obj(item.extra, {}); can.onmotion.toggle(can, can.ui.profile, true)
|
||||
}, _mark: function(can, item) {}, _style: function(can, style) {},
|
||||
plugin: function(can, item) { var extra = can.base.Obj(item.extra, {})
|
||||
if (!extra.index) { return can.onmotion.toggle(can, can.ui.profile, false) } can.onmotion.toggle(can, can.ui.profile, true)
|
||||
if (can.onmotion.cache(can, function() { return item.hash }, can.ui.profile)) { return true }
|
||||
if (!extra.index) { return can.onmotion.toggle(can, can.ui.profile, false) }
|
||||
can.onappend.plugin(can, {space: item.space, index: extra.index, args: extra.args}, function(sub) { item._plugin = sub
|
||||
sub.onaction._close = function() { can.onmotion.hidden(can, can.ui.profile) }
|
||||
sub.onexport.output = function() { sub.onimport.size(sub, can.ConfHeight()/2, can.ConfWidth()/2, true)
|
||||
@ -62,17 +57,25 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) {},
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONACTION, {
|
||||
_trans: {
|
||||
current: "定位", favor: "收藏",
|
||||
input: {
|
||||
zoom: "缩放", pitch: "倾斜", rotation: "旋转",
|
||||
weather: "天气", temperature: "温度", humidity: "湿度", windPower: "风速",
|
||||
},
|
||||
},
|
||||
list: [
|
||||
["style", "normal", "light", "whitesmoke", "fresh", "macaron", "graffiti", "darkblue", "blue", "grey", "dark"],
|
||||
["feature", "point", "road"],
|
||||
{type: html.TEXT, name: "zoom", value: 16, range: [3, 21]},
|
||||
{type: html.TEXT, name: "pitch", value: 30, range: [0, 80, 5]},
|
||||
{type: html.TEXT, name: "rotation", value: 0, range: [0, 360, 10]},
|
||||
"current:button", "explore", "search", "direction", mdb.CREATE,
|
||||
"current:button", "search", "explore", "direction", mdb.CREATE,
|
||||
], _trans: {current: "定位", favor: "收藏"},
|
||||
style: function(event, can, button, value) { can.onimport._style(can, value) },
|
||||
zoom: function(event, can) { can.ui.map.setZoom(can.Action("zoom")) },
|
||||
pitch: function(event, can) { can.ui.map.setPitch(can.Action("pitch")) },
|
||||
rotation: function(event, can) { can.ui.map.setRotation(can.Action("rotation")) },
|
||||
center: function(can, item) {},
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {list: ["province", "city", "district", "street", "longitude", "latitude", "type", "name", "text", "space", "weather", "temperature", "humidity", "windPower"]})
|
||||
|
@ -12,6 +12,12 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const (
|
||||
SEARCH = "search"
|
||||
EXPLORE = "explore"
|
||||
CURRENT = "current"
|
||||
DIRECTION = "direction"
|
||||
)
|
||||
const TMAP = "tmap"
|
||||
|
||||
func init() {
|
||||
@ -24,22 +30,22 @@ func init() {
|
||||
}))
|
||||
}
|
||||
chat.Index.MergeCommands(ice.Commands{
|
||||
TMAP: {Actions: ice.Actions{
|
||||
TMAP: {Help: "腾讯地图", Actions: ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, TMAP, "https://apis.map.qq.com/ws/")
|
||||
}},
|
||||
"explore": {Help: "周边", Hand: func(m *ice.Message, arg ...string) {
|
||||
DISTRICT: {Help: "地区", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(get(m, "district/v1/getchildren", m.OptionSimple(mdb.ID)))
|
||||
}},
|
||||
EXPLORE: {Help: "周边", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(get(m, "place/v1/explore", m.OptionSimple("keyword,boundary,page_index")))
|
||||
}},
|
||||
"search": {Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||
SEARCH: {Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(get(m, "place/v1/search", m.OptionSimple("keyword,boundary,page_index")))
|
||||
}},
|
||||
"direction": {Help: "导航", Hand: func(m *ice.Message, arg ...string) {
|
||||
DIRECTION: {Help: "导航", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(get(m, "direction/v1/"+m.Option(mdb.TYPE)+nfs.PS, m.OptionSimple("from,to")))
|
||||
}},
|
||||
"district": {Help: "地区", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(get(m, "district/v1/getchildren", m.OptionSimple(mdb.ID)))
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, arg ...string) {
|
||||
// m.Option(LOCATION, m.Cmdx(web.SERVE, tcp.HOST))
|
||||
// m.Option(LOCATION, get(m, "location/v1/ip", aaa.IP, m.Option(ice.MSG_USERIP)))
|
||||
|
@ -1,29 +1,45 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.require([msg.Option(nfs.SCRIPT)], function() {
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg, cb) { can.require([can.Conf(nfs.SCRIPT)], function() {
|
||||
can.require(["location.js"], function() { can.onimport._layout_init(can, msg, function() { cb && cb(msg)
|
||||
var res = {type: "unknown", latitude: 39.984120, longitude: 116.307480}, current = can.base.Obj(msg.Option(chat.LOCATION), {})
|
||||
res.nation = current.nation||current.country, res.province = current.province||current.regionName, res.city = current.city
|
||||
res.latitude = current.latitude||current.lat||res.latitude, res.longitude = current.longitude||current.lon||res.longitude
|
||||
var res = {type: "unknown", longitude: 116.307480, latitude: 39.984120}, current = can.base.Obj(msg.Option(chat.LOCATION), {})
|
||||
res.province = current.province||current.regionName, res.city = current.city
|
||||
res.longitude = current.longitude||current.lon||res.longitude, res.latitude = current.latitude||current.lat||res.latitude
|
||||
res.name = current.name||"当前位置", res.text = current.text||"某某大街", res.ip = current.ip||current.query
|
||||
can.onimport._content(can, can._current = res), can.Status(can._current = res)
|
||||
can.onimport._content(can, res), can.Status(res)
|
||||
}) })
|
||||
}) },
|
||||
_content: function(can, item) {
|
||||
can.ui.map = new TMap.Map(can.ui.content, {center: can.onimport.point(can, item), zoom: can.Action("zoom"), pitch: can.Action("pitch"), rotation: can.Action("rotation")})
|
||||
can.ui.map.on("zoom", function(event) { can.Action("zoom", can.ui.map.getZoom().toFixed(2)) })
|
||||
can.ui.map.on("pitch", function(event) { can.Action("pitch", can.ui.map.getPitch().toFixed(2)) })
|
||||
can.ui.map.on("rotate", function(event) { can.Action("rotation", can.ui.map.getRotation().toFixed(2)) })
|
||||
can.ui.map.on("click", function(event) { var point = can.onaction._point(event, can, {name: event.poi? event.poi.name: ""}); can.onaction.center(can, point) })
|
||||
can.ui.current = {item: item, info: can.onfigure.info(can, item), hover: can.onfigure.info(can, item),
|
||||
label: new TMap.MultiLabel({map: can.ui.map, geometries: [{id: "current", position: can.onimport.point(can, item), content: item.name}]}),
|
||||
marker: new TMap.MultiMarker({map: can.ui.map, geometries: [{id: "current", position: can.onimport.point(can, item)}]}),
|
||||
circle: can.onfigure.circle(can, item, 100),
|
||||
}
|
||||
can.onfigure._mark(can), can.onimport._mark(can, item)
|
||||
can.page.Select(can, can._target, "div.content>div", function(item) { can.page.style(can, item, {"z-index": 9}) })
|
||||
},
|
||||
_mark: function(can, item) {
|
||||
can.mark && can.mark.add({position: can.onimport.point(can, item), properties: item})
|
||||
},
|
||||
_explore: function(can, keyword, i) { var p = can.onimport.point(can, can.current.item)
|
||||
can.runAction(can.request({}, {_method: http.GET, "boundary": "nearby("+can.base.join([p.lat, p.lng, "500"], mdb.FS)+")", "page_index": i||1, "keyword": keyword}), "search", [], function(msg) {
|
||||
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) {
|
||||
can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.zone.explore._target)
|
||||
})
|
||||
})
|
||||
},
|
||||
_search: function(can, keyword, i) { var p = can.onimport.point(can, can.current.item)
|
||||
|
||||
_search: function(can, keyword, i) { var p = can.onimport.point(can, can.ui.current.item)
|
||||
can.runAction(can.request({}, {_method: http.GET, "boundary": "region("+can.base.join([can.Status("city"), p.lat, p.lng], mdb.FS)+")", "page_index": i||1, "keyword": keyword}), "search", [], function(msg) {
|
||||
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) {
|
||||
can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.zone.search._target)
|
||||
})
|
||||
})
|
||||
},
|
||||
_explore: function(can, keyword, i) { var p = can.onimport.point(can, can.ui.current.item)
|
||||
can.runAction(can.request({}, {_method: http.GET, "boundary": "nearby("+can.base.join([p.lat, p.lng, "500"], mdb.FS)+")", "page_index": i||1, "keyword": keyword}), "search", [], function(msg) {
|
||||
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) {
|
||||
can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.zone.explore._target)
|
||||
})
|
||||
})
|
||||
},
|
||||
_list_result: function(can, msg, cb) { var res = can.base.Obj(msg.Result()); if (res.status) { can.user.toastFailure(can, res.message); return }
|
||||
return res && res.result && can.core.List(res.result[0], function(item) { item.name = item.name||item.fullname; return can.base.isFunc(cb)? cb(item): item })
|
||||
},
|
||||
@ -32,7 +48,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.require([msg.Option
|
||||
can.onimport._list_result(can, msg, function(province) {
|
||||
can.onimport.item(can, province, function(event, _, show) { if (show === false) { return }
|
||||
can.onaction.center(can, can.onexport.point(can, province.location, {type: "province", name: province.name, text: province.fullname}))
|
||||
can.map.setZoom(can.Action("zoom", 8)), can.Status({nation: "中国", province: province.fullname})
|
||||
can.ui.map.setZoom(can.Action("zoom", 8)), can.Status({nation: "中国", province: province.fullname})
|
||||
show === true || can.onimport._city(can, province, event.target)
|
||||
}, function() {}, target)
|
||||
})
|
||||
@ -40,72 +56,108 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.require([msg.Option
|
||||
_city: function(can, province, target) { can.onimport._district(can, province.id, function(msg) {
|
||||
can.onimport.itemlist(can, can.onimport._list_result(can, msg), function(event, city, show) { if (show === false) { return }
|
||||
can.onaction.center(can, can.onexport.point(can, city.location, {type: "city", name: city.name, text: city.fullname}))
|
||||
can.map.setZoom(can.Action("zoom", 12)), can.Status({nation: "中国", province: province.fullname, city: city.fullname})
|
||||
can.ui.map.setZoom(can.Action("zoom", 12)), can.Status({nation: "中国", province: province.fullname, city: city.fullname})
|
||||
show === true || can.onimport._county(can, province, city, event.target)
|
||||
}, function() {}, target)
|
||||
}) },
|
||||
_county: function(can, province, city, target) { can.onimport._district(can, city.id, function(msg) {
|
||||
can.onimport.itemlist(can, can.onimport._list_result(can, msg), function(event, county) {
|
||||
can.onaction.center(can, can.onexport.point(can, county.location, {type: "county", name: city.name, text: county.fullname}))
|
||||
can.map.setZoom(can.Action("zoom", 15)), can.Status({nation: "中国", province: province.fullname, city: city.fullname})
|
||||
can.ui.map.setZoom(can.Action("zoom", 15)), can.Status({nation: "中国", province: province.fullname, city: city.fullname})
|
||||
}, function() {}, target)
|
||||
}) },
|
||||
_content: function(can, item) {
|
||||
can.map = new TMap.Map(can.ui.content, {
|
||||
center: can.onimport.point(can, item),
|
||||
zoom: can.Action("zoom"), pitch: can.Action("pitch"), rotation: can.Action("rotation"),
|
||||
})
|
||||
can.map.on("zoom", function(event) { can.Action("zoom", can.map.getZoom().toFixed(2)) })
|
||||
can.map.on("pitch", function(event) { can.Action("pitch", can.map.getPitch().toFixed(2)) })
|
||||
can.map.on("rotate", function(event) { can.Action("rotation", can.map.getRotation().toFixed(2)) })
|
||||
can.map.on("click", function(event) { var point = can.onaction._point(event, can, {name: event.poi? event.poi.name: ""}); can.onaction.center(can, point) })
|
||||
can.ui.map = can.map
|
||||
can.current = {item: item, info: can.onfigure.info(can, item), hover: can.onfigure.info(can, item),
|
||||
label: new TMap.MultiLabel({map: can.map, geometries: [{id: "current", position: can.onimport.point(can, item), content: item.name}]}),
|
||||
marker: new TMap.MultiMarker({map: can.map, geometries: [{id: "current", position: can.onimport.point(can, item)}]}),
|
||||
circle: can.onfigure.circle(can, item, 100),
|
||||
}
|
||||
can.onfigure._mark(can), can.mark && can.mark.add({position: can.onimport.point(can, can._current), properties: can._current})
|
||||
can.page.Select(can, can._target, "div.content>div", function(item) { can.page.style(can, item, {"z-index": 9}) })
|
||||
},
|
||||
point: function(can, item) { return new TMap.LatLng(item.latitude, item.longitude) },
|
||||
_plugin: function(can, item, meta) {
|
||||
function myInfoWindow(options) { TMap.DOMOverlay.call(this, options) }
|
||||
myInfoWindow.prototype = new TMap.DOMOverlay()
|
||||
myInfoWindow.prototype.onInit = function(options) { this.position = options.position, this.meta = options.meta }
|
||||
myInfoWindow.prototype.createDOM = function() {
|
||||
var meta = this.meta, ui = can.onappend.field(can, chat.FLOAT, {}, can._output)
|
||||
can.onappend.plugin(can, meta, function(sub) {
|
||||
sub.run = function(event, cmds, cb) { can.runAction(can.request(event), ctx.RUN, [meta.index].concat(cmds), cb) }
|
||||
sub.onaction.close = function(event) { can.misc.Event(event, can, function(msg) {
|
||||
can.onmotion.hidden(can, sub._target)
|
||||
}) }
|
||||
item._plugin = sub
|
||||
}, can._output, ui.fieldset)
|
||||
return ui.fieldset
|
||||
}
|
||||
myInfoWindow.prototype.updateDOM = function() {
|
||||
var pixel = this.map.projectToContainer(this.position); can.page.style(can, this.dom, {
|
||||
left: pixel.getX(), top: pixel.getY()+2*html.ACTION_HEIGHT,
|
||||
})
|
||||
}
|
||||
return new myInfoWindow({map: can.map, position: can.onimport.point(can, item), meta: meta})
|
||||
Volcanos(chat.ONACTION, {
|
||||
_trans: {
|
||||
current: "定位", favor: "收藏",
|
||||
input: {
|
||||
zoom: "缩放", pitch: "倾斜", rotation: "旋转",
|
||||
weather: "天气", temperature: "温度", humidity: "湿度", windPower: "风速",
|
||||
},
|
||||
}, ["location.js"])
|
||||
},
|
||||
_point: function(event, can, item) { var rect = can.ui.content.getBoundingClientRect()
|
||||
return can.base.Copy({left: rect.left+event.point.x, bottom: rect.top+event.point.y, latitude: event.latLng.lat.toFixed(6), longitude: event.latLng.lng.toFixed(6)}, item, true)
|
||||
},
|
||||
current: function(event, can) { can.user.toastProcess(can)
|
||||
can.user.agent.getLocation(can, function(res) { can.user.toastSuccess(can)
|
||||
res.type = "current", can.onaction.center(can, res)
|
||||
can.ui.map.setZoom(can.Action("zoom", 16)), can.ui.map.setPitch(can.Action("pitch", 0)), can.ui.map.setRotation(can.Action("rotation", 0))
|
||||
})
|
||||
},
|
||||
center: function(can, item) {
|
||||
var point = can.onimport.point(can, item); can.ui.map.setCenter(point); if (!item.name) { return }
|
||||
can.ui.current.item = item, can.Status(mdb.NAME, ""), can.Status(mdb.TEXT, ""), can.Status(item), can.Status({latitude: point.lat, longitude: point.lng})
|
||||
can.ui.current.info.setPosition(point), can.ui.current.info.setContent((item.name||"")+"<br/>"+(item.text||""))
|
||||
can.ui.current.label.updateGeometries([{id: "current", position: point, content: item.name}])
|
||||
can.ui.current.marker.updateGeometries([{id: "current", position: point}])
|
||||
can.ui.current.circle.setGeometries([{center: point, radius: 300}])
|
||||
},
|
||||
|
||||
search: function(event, can, button) { can.onmotion.clear(can, can.ui.zone.search._target)
|
||||
can.user.input(event, can, ["keyword"], function(list) {
|
||||
for (var i = 1; i < 6; i++) {
|
||||
can.onimport._search(can, list[0], i)
|
||||
}
|
||||
})
|
||||
},
|
||||
explore: function(event, can, button) { can.onmotion.clear(can, can.ui.zone.explore._target)
|
||||
can.user.input(event, can, ["keyword"], function(list) {
|
||||
for (var i = 1; i < 6; i++) {
|
||||
can.onimport._explore(can, list[0], i)
|
||||
}
|
||||
})
|
||||
},
|
||||
direction: function(event, can, button) { var p = can.ui.map.getCenter(); can.onmotion.clear(can, can.ui.zone.direction._target)
|
||||
can.user.input(event, can, [["type", "driving", "walking", "bicycling", "transit"]], function(list) {
|
||||
var from = can.onimport.point(can, can._current), to = can.onimport.point(can, can.ui.current.item)
|
||||
var msg = can.request({}, {_method: http.GET, type: list[0], "from": can.base.join([from.lat, from.lng], mdb.FS), "to": can.base.join([to.lat, to.lng], mdb.FS)})
|
||||
can.runAction(msg._event, button, [], function(msg) { var res = can.base.Obj(msg.Result()), route = res.result.routes[0]
|
||||
var coors = route.polyline, pl = [], kr = 1000000
|
||||
for (var i = 2; i < coors.length; i++) { coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr }
|
||||
for (var i = 0; i < coors.length; i += 2) { pl.push(new TMap.LatLng(coors[i], coors[i+1])) }
|
||||
can.onfigure._polyline(can, pl)
|
||||
can.core.List(route.steps, function(item) { var i = item.polyline_idx[0]
|
||||
can.onimport._item(can, can.onexport.point(can, {lat: coors[i], lng: coors[i+1]}, {type: item.category, name: item.instruction, text: item.act_desc}), can.ui.zone.direction._target)
|
||||
}), can.user.toastProcess(can, "distance: "+route.distance+" duration: "+route.duration)
|
||||
})
|
||||
})
|
||||
},
|
||||
create: function(event, can) { can.request(event, can.ui.current.item)
|
||||
can.user.input(event, can, can.core.Split("type,name,text"), function(args) { var p = can.onexport.center(can)
|
||||
can.runAction(event, mdb.CREATE, args.concat("latitude", p.latitude, "longitude", p.longitude), function(msg) {
|
||||
can.onimport._item(can, can.base.Copy(p, {name: msg.Option(mdb.NAME), text: msg.Option(mdb.TEXT)}))
|
||||
}, true)
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {
|
||||
point: function(can, point, item) { return can.base.Copy({latitude: point.lat, longitude: point.lng}, item, true) },
|
||||
center: function(can) { return can.onexport.point(can, can.ui.map.getCenter()) },
|
||||
current: function(can) { var p = can.onexport.center(can); p.latitude, p.longitude; can.Status(p)
|
||||
can.ui.current.marker.updateGeometries([{id: "current", position: can.ui.map.getCenter()}])
|
||||
can.ui.current.label.updateGeometries([{id: "current", position: can.ui.map.getCenter()}])
|
||||
can.ui.current.circle.setGeometries([{center: can.ui.map.getCenter(), radius: 300}])
|
||||
},
|
||||
hover: function(can, item) {
|
||||
can.ui.current.hover.setPosition(can.onimport.point(can, item))
|
||||
can.ui.current.hover.setContent(item.name+"<br/>"+item.text)
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONFIGURE, {
|
||||
circle: function(can, item, radius) {
|
||||
return new TMap.MultiCircle({
|
||||
map: can.map, styles: {circle: new TMap.CircleStyle({color: 'rgba(41,91,255,0.16)', borderColor: 'rgba(41,91,255,1)', borderWidth: 2, showBorder: true})},
|
||||
map: can.ui.map, styles: {circle: new TMap.CircleStyle({color: 'rgba(41,91,255,0.16)', borderColor: 'rgba(41,91,255,1)', borderWidth: 2, showBorder: true})},
|
||||
geometries: [{styleId: 'circle', center: can.onimport.point(can, item), radius: radius||300}],
|
||||
})
|
||||
},
|
||||
info: function(can, item) {
|
||||
return new TMap.InfoWindow({map: can.map,
|
||||
return new TMap.InfoWindow({map: can.ui.map,
|
||||
position: can.onimport.point(can, item), offset: {x: 0, y: -32},
|
||||
content: (item.name||"")+"<br/>"+(item.text||""),
|
||||
})
|
||||
},
|
||||
_mark: function(can, msg) { can.mark = new TMap.MultiMarker({map: can.map})
|
||||
_mark: function(can, msg) { can.mark = new TMap.MultiMarker({map: can.ui.map})
|
||||
can.mark.on("click", function(event) { if (!event.geometry) { return }
|
||||
var item = event.geometry.properties; can.db.list[item.hash].click()
|
||||
})
|
||||
@ -114,7 +166,7 @@ Volcanos(chat.ONFIGURE, {
|
||||
})
|
||||
},
|
||||
_polyline: function(can, path) { return new TMap.MultiPolyline({
|
||||
map: can.map, styles: {
|
||||
map: can.ui.map, styles: {
|
||||
'style_blue': new TMap.PolylineStyle({
|
||||
'color': '#3777FF', //线填充色
|
||||
'width': 6, //折线宽度
|
||||
@ -142,68 +194,3 @@ Volcanos(chat.ONFIGURE, {
|
||||
], speed: 70}}, {autoRotation:true})
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONACTION, {
|
||||
_point: function(event, can, item) { var rect = can.ui.content.getBoundingClientRect()
|
||||
return can.base.Copy({left: rect.left+event.point.x, bottom: rect.top+event.point.y, latitude: event.latLng.lat.toFixed(6), longitude: event.latLng.lng.toFixed(6)}, item, true)
|
||||
},
|
||||
center: function(can, item) {
|
||||
var point = can.onimport.point(can, item); can.map.setCenter(point); if (!item.name) { return }
|
||||
can.current.item = item, can.Status(mdb.NAME, ""), can.Status(mdb.TEXT, ""), can.Status(item), can.Status({latitude: point.lat, longitude: point.lng})
|
||||
can.current.info.setPosition(point), can.current.info.setContent((item.name||"")+"<br/>"+(item.text||""))
|
||||
can.current.label.updateGeometries([{id: "current", position: point, content: item.name}])
|
||||
can.current.marker.updateGeometries([{id: "current", position: point}])
|
||||
can.current.circle.setGeometries([{center: point, radius: 300}])
|
||||
can.onimport.plugin(can, item)
|
||||
},
|
||||
current: function(event, can) { can.onaction.center(can, can._current), can.map.setZoom(can.Action("zoom", 16)), can.map.setPitch(can.Action("pitch", 30)), can.map.setRotation(can.Action("rotation", 0)) },
|
||||
explore: function(event, can, button) { can.onmotion.clear(can, can.ui.zone.explore._target)
|
||||
can.user.input(event, can, ["keyword"], function(list) {
|
||||
for (var i = 1; i < 6; i++) {
|
||||
can.onimport._explore(can, list[0], i)
|
||||
}
|
||||
})
|
||||
},
|
||||
search: function(event, can, button) { can.onmotion.clear(can, can.ui.zone.search._target)
|
||||
can.user.input(event, can, ["keyword"], function(list) {
|
||||
for (var i = 1; i < 6; i++) {
|
||||
can.onimport._search(can, list[0], i)
|
||||
}
|
||||
})
|
||||
},
|
||||
direction: function(event, can, button) { var p = can.map.getCenter(); can.onmotion.clear(can, can.ui.zone.direction._target)
|
||||
can.user.input(event, can, [["type", "driving", "walking", "bicycling", "transit"]], function(list) {
|
||||
var from = can.onimport.point(can, can._current), to = can.onimport.point(can, can.current.item)
|
||||
var msg = can.request({}, {_method: http.GET, type: list[0], "from": can.base.join([from.lat, from.lng], mdb.FS), "to": can.base.join([to.lat, to.lng], mdb.FS)})
|
||||
can.runAction(msg._event, button, [], function(msg) { var res = can.base.Obj(msg.Result()), route = res.result.routes[0]
|
||||
var coors = route.polyline, pl = [], kr = 1000000
|
||||
for (var i = 2; i < coors.length; i++) { coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr }
|
||||
for (var i = 0; i < coors.length; i += 2) { pl.push(new TMap.LatLng(coors[i], coors[i+1])) }
|
||||
can.onfigure._polyline(can, pl)
|
||||
can.core.List(route.steps, function(item) { var i = item.polyline_idx[0]
|
||||
can.onimport._item(can, can.onexport.point(can, {lat: coors[i], lng: coors[i+1]}, {type: item.category, name: item.instruction, text: item.act_desc}), can.ui.zone.direction._target)
|
||||
}), can.user.toastProcess(can, "distance: "+route.distance+" duration: "+route.duration)
|
||||
})
|
||||
})
|
||||
},
|
||||
create: function(event, can) { can.request(event, can.current.item)
|
||||
can.user.input(event, can, can.core.Split("type,name,text"), function(args) { var p = can.onexport.center(can)
|
||||
can.runAction(event, mdb.CREATE, args.concat("latitude", p.latitude, "longitude", p.longitude), function(msg) {
|
||||
can.onimport._item(can, can.base.Copy(p, {name: msg.Option(mdb.NAME), text: msg.Option(mdb.TEXT)}))
|
||||
}, true)
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {
|
||||
point: function(can, point, item) { return can.base.Copy({latitude: point.lat, longitude: point.lng}, item, true) },
|
||||
center: function(can) { return can.onexport.point(can, can.map.getCenter()) },
|
||||
current: function(can) {
|
||||
var p = can.onexport.center(can); p.latitude, p.longitude; can.Status(p)
|
||||
can.current.marker.updateGeometries([{id: "current", position: can.map.getCenter()}])
|
||||
can.current.label.updateGeometries([{id: "current", position: can.map.getCenter()}])
|
||||
can.current.circle.setGeometries([{center: can.map.getCenter(), radius: 300}])
|
||||
},
|
||||
hover: function(can, item) {
|
||||
can.current.hover.setPosition(can.onimport.point(can, item))
|
||||
can.current.hover.setContent(item.name+"<br/>"+item.text)
|
||||
},
|
||||
})
|
||||
|
@ -18,7 +18,7 @@ const APPLICATIONS = "applications"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
APPLICATIONS: {Actions: ice.MergeActions(ice.Actions{
|
||||
APPLICATIONS: {Help: "应用", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
FinderAppend(m, "", m.PrefixKey())
|
||||
defer Notify(m, "Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
||||
|
@ -8,6 +8,6 @@ const CACULATOR = "caculator"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
CACULATOR: {Icon: "Caculator.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }},
|
||||
CACULATOR: {Help: "计算器", Icon: "Caculator.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }},
|
||||
})
|
||||
}
|
||||
|
@ -8,6 +8,6 @@ const CLOCK = "clock"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
CLOCK: {Icon: "Clock.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }},
|
||||
CLOCK: {Help: "时钟", Icon: "Clock.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }},
|
||||
})
|
||||
}
|
||||
|
@ -10,7 +10,8 @@ import (
|
||||
const DOCK = "dock"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{DOCK: {Actions: ice.MergeActions(ice.Actions{
|
||||
Index.MergeCommands(ice.Commands{
|
||||
DOCK: {Help: "工具栏", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmd(DOCK).Length() == 0 {
|
||||
DockAppend(m, "Finder.png", Prefix(FINDER))
|
||||
@ -21,7 +22,8 @@ func init() {
|
||||
DockAppend(m, "vimer.png", web.CODE_VIMER)
|
||||
}
|
||||
}},
|
||||
}, aaa.RoleAction(), CmdHashAction(), mdb.ExportHashAction())}})
|
||||
}, aaa.RoleAction(), CmdHashAction(), mdb.ExportHashAction())},
|
||||
})
|
||||
}
|
||||
|
||||
func DockAppend(m *ice.Message, icon, index string) { install(m, DOCK, icon, index) }
|
||||
|
@ -8,10 +8,12 @@ import (
|
||||
const FINDER = "finder"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{FINDER: {Name: "finder list", Help: "应用", Actions: ice.MergeActions(ice.Actions{
|
||||
Index.MergeCommands(ice.Commands{
|
||||
FINDER: {Name: "finder list", Help: "应用", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(APPLICATIONS, mdb.INPUTS, arg) }},
|
||||
mdb.INSERT: {Name: "insert space index* args name* icon*@icon", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(APPLICATIONS, mdb.CREATE, arg) }},
|
||||
}, CmdHashAction(mdb.NAME))}})
|
||||
}, CmdHashAction(mdb.NAME))},
|
||||
})
|
||||
}
|
||||
|
||||
func FinderAppend(m *ice.Message, icon, index string) { install(m, FINDER, icon, index) }
|
||||
|
@ -10,7 +10,7 @@ const MENU = "menu"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
MENU: {Actions: ice.MergeActions(aaa.RoleAction(), CmdHashAction(), mdb.ClearOnExitHashAction())},
|
||||
MENU: {Help: "菜单栏", Actions: ice.MergeActions(aaa.RoleAction(), CmdHashAction(), mdb.ClearOnExitHashAction())},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ const NOTIFICATIONS = "notifications"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
NOTIFICATIONS: {Actions: ice.MergeActions(ice.Actions{
|
||||
NOTIFICATIONS: {Help: "消息", Actions: ice.MergeActions(ice.Actions{
|
||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
Notify(m, "Launchpad.png", m.Option(mdb.NAME), "空间创建成功", ctx.INDEX, web.CHAT_IFRAME, ctx.ARGS, m.MergePod(m.Option(mdb.NAME)))
|
||||
}},
|
||||
|
@ -9,7 +9,7 @@ const SESSION = "session"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SESSION: {Actions: ice.MergeActions(CmdHashAction(mdb.NAME), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
SESSION: {Help: "会话", Actions: ice.MergeActions(CmdHashAction(mdb.NAME), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
||||
m.EchoIFrame(m.MergePodCmd("", DESKTOP) + "#" + m.Append(mdb.NAME))
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ const POD = "pod"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
POD: {Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
POD: {Help: "空间", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 || arg[0] == "" {
|
||||
web.RenderMain(m)
|
||||
} else if strings.HasPrefix(m.Option(ice.MSG_USERUA), "git/") {
|
||||
|
@ -9,6 +9,6 @@ const PORTAL = "portal"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
PORTAL: {Actions: web.ApiAction(), Hand: func(m *ice.Message, arg ...string) { web.RenderMain(m) }},
|
||||
PORTAL: {Help: "门户", Actions: web.ApiAction(), Hand: func(m *ice.Message, arg ...string) { web.RenderMain(m) }},
|
||||
})
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ const RIVER = "river"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
RIVER: {Actions: ice.MergeActions(ice.Actions{
|
||||
RIVER: {Help: "导航", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create type=void,tech,root name=hi text=hello template=base", Hand: func(m *ice.Message, arg ...string) {
|
||||
h := mdb.HashCreate(m, arg)
|
||||
defer m.Result(h)
|
||||
|
@ -10,7 +10,7 @@ const SEARCH = "search"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SEARCH: {Actions: ice.MergeActions(ice.Actions{
|
||||
SEARCH: {Help: "搜索", Actions: ice.MergeActions(ice.Actions{
|
||||
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, arg...) }},
|
||||
}, web.ApiAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(web.Space(m, m.Option(ice.POD)), "mdb.search", arg)
|
||||
|
@ -16,7 +16,7 @@ const SSO = "sso"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SSO: {Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
SSO: {Help: "授权", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) || m.Warn(m.Option(web.SPACE) == "", ice.ErrNotValid) || m.Warn(m.Option(cli.BACK) == "", ice.ErrNotValid) {
|
||||
web.RenderMain(m)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user