From 409dd40848672eb7dae42885c25c417ca957ff0b Mon Sep 17 00:00:00 2001 From: shy Date: Wed, 8 Nov 2023 17:36:26 +0800 Subject: [PATCH] add some --- core/chat/cmd.go | 3 +-- core/chat/location/amap.js | 7 +++++++ core/chat/location/location.js | 12 +++++++----- core/chat/location/tmap.js | 1 - 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/chat/cmd.go b/core/chat/cmd.go index 3f5e12d5..38cf00fa 100644 --- a/core/chat/cmd.go +++ b/core/chat/cmd.go @@ -2,7 +2,6 @@ package chat import ( ice "shylinux.com/x/icebergs" - "shylinux.com/x/icebergs/base/aaa" "shylinux.com/x/icebergs/base/web" ) @@ -13,7 +12,7 @@ func init() { 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) { + } else { if m.IsCliUA() { m.Cmdy(arg, m.Optionv(ice.ARG)).RenderResult() } else { diff --git a/core/chat/location/amap.js b/core/chat/location/amap.js index cf3d5d37..970c2f13 100644 --- a/core/chat/location/amap.js +++ b/core/chat/location/amap.js @@ -17,6 +17,9 @@ Volcanos(chat.ONIMPORT, { 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) }) + AMap.event.addListener(can.ui.geolocation, 'error', function(res) { + can.user.toastFailure(can, res.message) + }) }) map.add(can.ui.favor = new AMap.OverlayGroup()) map.add(can.ui.marker = new AMap.Marker({position: [116.39, 39.9]})) @@ -40,6 +43,7 @@ Volcanos(chat.ONACTION, { current: "定位", favor: "收藏", input: { zoom: "缩放", pitch: "倾斜", rotation: "旋转", + weather: "天气", temperature: "温度", humidity: "湿度", windPower: "风速", }, }, current: function(event, can) { @@ -55,6 +59,9 @@ Volcanos(chat.ONACTION, { 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) + }, + direction: function(event, can, button, item) { + can.user.isMobile && window.open(`https://uri.amap.com/marker?position=${item.longitude},${item.latitude}&name=${item.name||item.text}&callnative=1`) } }) Volcanos(chat.ONEXPORT, { diff --git a/core/chat/location/location.js b/core/chat/location/location.js index 737097ae..b3ab7a7e 100644 --- a/core/chat/location/location.js +++ b/core/chat/location/location.js @@ -3,7 +3,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) {}, 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.project, "z-index", 10, "position", "absolute", html.MAX_HEIGHT, can.ConfHeight()-120) can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth()) can.onmotion.hidden(can, can._action), can.onmotion.hidden(can, can._status) } else { @@ -11,7 +11,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) {}, } msg.Option(ice.MSG_ACTION, ""), cb && cb(msg) 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()) + msg.Table(function(item) { can.onimport._item(can, item) }), can.ui.zone.favor._total(msg.Length()), can.ui.zone.favor.toggle(true) var item = can.db.list[can.db.hash[0]]; item && item.click() } }, @@ -33,7 +33,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) {}, }, 500) }, function(event) { can.onaction.center(can, item), can.user.carteRight(event, can, { - direction: function(event, button) { can.onaction[button](event, can, button) }, + direction: function(event, button) { can.onaction[button](event, can, button, item) }, 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) @@ -49,8 +49,10 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) {}, if (can.onmotion.cache(can, function() { return item.hash }, can.ui.profile)) { return true } 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) - can.page.style(can, can.ui.profile, html.HEIGHT, can.ConfHeight()/2, html.WIDTH, can.ConfWidth()/2) + sub.onexport.output = function() { + var width = (can.user.isMobile? can.ConfWidth()-120: can.ConfWidth()/2) + sub.onimport.size(sub, can.ConfHeight()/2, width, true) + can.page.style(can, can.ui.profile, html.HEIGHT, can.ConfHeight()/2, html.WIDTH, width) } }, can.ui.profile) return true diff --git a/core/chat/location/tmap.js b/core/chat/location/tmap.js index 031564eb..9296ea8c 100644 --- a/core/chat/location/tmap.js +++ b/core/chat/location/tmap.js @@ -73,7 +73,6 @@ Volcanos(chat.ONACTION, { current: "定位", favor: "收藏", input: { zoom: "缩放", pitch: "倾斜", rotation: "旋转", - weather: "天气", temperature: "温度", humidity: "湿度", windPower: "风速", }, }, _point: function(event, can, item) { var rect = can.ui.content.getBoundingClientRect()