1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-07-20 11:05:14 +08:00
parent 9ba006a1da
commit daa740ffbe
6 changed files with 30 additions and 51 deletions

View File

@ -61,6 +61,8 @@ const (
IMAGE = "image"
SUBMIT = "submit"
CHROME = "chrome"
NEED = "need"
MUST = "must"
STYLE = "style"
FLOAT = "float"

View File

@ -217,6 +217,9 @@ const (
WIKI_WORD = "web.wiki.word"
WIKI_PORTAL = "web.wiki.portal"
CHAT_OAUTH_CLIENT = "web.chat.oauth.client"
CHAT_WX_ACCESS = "web.chat.wx.access"
CHAT_WX_TEMPLATE = "web.chat.wx.template"
CHAT_WX_OCR = "web.chat.wx.ocr"
CHAT_MESSAGE = "web.chat.message"
CHAT_HEADER = "web.chat.header"
CHAT_IFRAME = "web.chat.iframe"

View File

@ -256,6 +256,7 @@ const ( // MSG
LOG_TRACEID = "log.id"
MSG_NODETYPE = "node.type"
MSG_NODENAME = "node.name"
MSG_FILES = "file.system"
FROM_SPACE = "from.space"
FROM_DAEMON = "from.daemon"

View File

@ -143,13 +143,15 @@ func init() {
if ice.Info.NodeType == web.WORKER {
return
}
m.Option(ice.MSG_NODETYPE, ice.Info.NodeType)
kit.If(m.Option(ice.MSG_USERPOD), func(p string) {
m.Option(ice.MSG_NODETYPE, m.Cmdx(web.SPACE, p, cli.RUNTIME, ice.MSG_NODETYPE))
m.Option(ice.MSG_NODENAME, m.Cmdx(web.SPACE, p, cli.RUNTIME, ice.MSG_NODENAME))
m.Option("favicon", m.Cmd(web.SPACE, m.Option(ice.MSG_USERPOD), web.SPACE, ice.INFO).Append(mdb.ICONS))
}, func() {
// m.Option("titles", ice.Info.Title())
m.Option(ice.MSG_NODETYPE, ice.Info.NodeType)
m.Option(ice.MSG_NODENAME, ice.Info.NodeName)
m.Option("favicon", ice.Info.NodeIcon)
m.Option("titles", ice.Info.Titles)
})
m.Option(aaa.LANGUAGE, strings.ReplaceAll(strings.ToLower(kit.Select("", kit.Split(kit.GetValid(
func() string { return kit.Select("", "zh-cn", strings.Contains(m.Option(ice.MSG_USERUA), "zh_CN")) },

View File

@ -94,9 +94,9 @@ func (m *Message) Push(key string, value Any, arg ...Any) *Message {
if v = kit.Value(value, k); v != nil {
break
}
if v = kit.Value(value, kit.Keys(EXTRA, k)); v != nil {
break
}
// if v = kit.Value(value, kit.Keys(EXTRA, k)); v != nil {
// break
// }
if v = val[k]; v != nil {
break
}

View File

@ -5,10 +5,8 @@ Volcanos(chat.ONIMPORT, {
}
msg.Option(ice.MSG_ACTION, ""), can.require([msg.Option(nfs.SCRIPT)], function(can) {
var debug = msg.isDebug() && can.user.info.userrole == aaa.TECH; debug && can.onmotion.toggle(can, can._fields, true)
// debug = false
can.onmotion.hidden(can, can._fields)
debug = false, can.onmotion.hidden(can, can._fields)
wx.config({debug: debug, signature: msg.Option("signature"), timestamp: msg.Option("timestamp"), nonceStr: msg.Option("noncestr"), appId: msg.Option("appid"),
openTagList: ["wx-open-subscribe"],
jsApiList: can.core.Item({
getLocation: function(can, cb) { wx.getLocation({type: "gcj02", success: function (res) {
can.base.isFunc(cb) && cb({type: "gcj02", name: "当前位置", text: "当前位置", latitude: parseInt(res.latitude*100000), longitude: parseInt(res.longitude*100000) })
@ -17,23 +15,33 @@ Volcanos(chat.ONIMPORT, {
name: msg.Option(mdb.NAME), address: msg.Option(mdb.TEXT), infoUrl: msg.Option(web.LINK),
longitude: parseFloat(msg.Option(aaa.LONGITUDE)), latitude: parseFloat(msg.Option(aaa.LATITUDE)), scale: msg.Option("scale")||14,
}) },
scanQRCode: function(can, cb) { wx.scanQRCode({needResult: cb? 1: 0, scanType: ["qrCode", "barCode"], success: function (res) {
can.base.isFunc(cb) && cb(can.base.ParseJSON(res.resultStr))
} }) },
chooseImage: function(can, cb, count) { wx.chooseImage({count: count||9, sourceType: ["camera", "album"], sizeType: ["original", "compressed"], success: function (res) {
can.base.isFunc(cb) && cb(res.localIds)
} }) },
uploadImage: function(can, id, cb) { wx.uploadImage({ localId: id, isShowProgressTips: 1, success: function (res) {
can.base.isFunc(cb) && cb(res.serverId)
} }) },
previewImage: function(can, url, list) {
wx.previewImage({current: url, urls: list||[url]})
},
scanQRCode: function(can, cb) { wx.scanQRCode({needResult: cb? 1: 0, scanType: ["qrCode", "barCode"], success: function (res) {
can.base.isFunc(cb) && cb(can.base.ParseJSON(res.resultStr))
} }) },
}, function(key, value) { return can.user.agent[key] = value, key }).concat([
"updateAppMessageShareData", "updateTimelineShareData",
]),
]), openTagList: ["wx-open-subscribe"],
})
wx.ready(function () {
function share(title, icons) {
wx.updateAppMessageShareData({title: title, desc: can.user.info.titles, link: location.href, imgUrl: icons})
wx.updateTimelineShareData({title: title, link: location.href, imgUrl: icons})
}
var p = can.misc.Resource(can, can.user.info.favicon); can.base.beginWith(p, "/") && (p = location.origin + p)
wx.updateAppMessageShareData({title: can.user.info.titles, desc: "车管所业务代办", link: location.href, imgUrl: p})
wx.updateTimelineShareData({title: can.user.info.titles, link: location.href, imgUrl: p})
share(document.title, p)
can.user.agent.init = function(can) { if (!can) { return }
p = can.misc.Resource(can, can.Conf(mdb.ICONS))||p; can.base.beginWith(p, "/") && (p = location.origin + p)
share(document.title, p)
}, can.user.agent.init(can.user.agent.cmd)
})
})
},
@ -42,8 +50,6 @@ Volcanos(chat.ONACTION, {
list: [
"getLocation", "openLocation", "openAddress",
"scanQRCode", "scanQRCode1",
"chooseImage", "uploadImage", "previewImage",
"updateAppMessageShareData", "updateTimelineShareData",
],
getLocation: function(event, can, button) {
wx.getLocation({type: "gcj02", success: function (res) {
@ -76,39 +82,4 @@ Volcanos(chat.ONACTION, {
can._output.innerHTML = res.resultStr
} })
},
uploadImage: function(event, can, button) {
wx.chooseImage({success: function (res) { can.core.List(res.localIds, function(item) {
wx.uploadImage({localId: item, isShowProgressTips: 1, success: function (res) {
var serverId = res.serverId;
can._output.innerHTML = serverId
} })
}) }})
},
chooseImage: function(event, can, button) {
wx.chooseImage({count: 9, sourceType: ["camera", "album"], sizeType: ["original", "compressed"], success: function (res) {
can.page.Append(can, can._output, can.core.List(res.localIds, function(item) {
return {img: item, style: {"max-width": can.ConfWidth()}}
}))
} })
},
previewImage: function(event, can, button) {
wx.previewImage({urls: [
"https://2021.shylinux.com/share/local/usr/icons/timg.png",
"https://2021.shylinux.com/share/local/usr/icons/mall.png",
]})
},
updateAppMessageShareData: function(event, can, button) {
wx.updateAppMessageShareData({
title: document.title, desc: "工具系统", link: location.href,
imgUrl: "https://2021.shylinux.com/share/local/usr/icons/timg.png",
success: function (res) { can._output.innerHTML = JSON.stringify(res) },
})
},
updateTimelineShareData: function(event, can, button) {
wx.updateTimelineShareData({
title: document.title, desc: "工具系统", link: location.href,
imgUrl: "https://2021.shylinux.com/share/local/usr/icons/timg.png",
success: function (res) { can._output.innerHTML = JSON.stringify(res) },
})
},
})