1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2022-08-17 20:23:49 +08:00
parent 4745c03a16
commit 09ab86a009
5 changed files with 29 additions and 24 deletions

View File

@ -1,10 +1,10 @@
Volcanos("user", {help: "用户操作", info: {}, agent: { Volcanos("user", {help: "用户操作", info: {}, agent: {
scanQRCode: function(cb, can) { scanQRCode: function(can, cb) {
can.user.input(event, can, [{type: html.TEXTAREA, name: "text", text: ""}], function(list) { can.user.input(event, can, [{type: html.TEXTAREA, name: "text", text: ""}], function(list) {
cb(list[0], can.base.ParseJSON(list[0])) cb(can.base.ParseJSON(list[0]))
}) })
}, },
getLocation: function(cb) { var call = arguments.callee getLocation: function(can, cb) { var call = arguments.callee
if (call._res) { return cb(call._res) } if (call._res) { return cb(call._res) }
navigator.geolocation.getCurrentPosition(function(res) { navigator.geolocation.getCurrentPosition(function(res) {
@ -13,11 +13,11 @@ Volcanos("user", {help: "用户操作", info: {}, agent: {
typeof cb == lang.FUNCTION && cb({type: "unknown", name: "unknown", latitude: 3998412, longitude: 11630748}) typeof cb == lang.FUNCTION && cb({type: "unknown", name: "unknown", latitude: 3998412, longitude: 11630748})
} ); } );
}, },
openLocation: function(msg) { openLocation: function(can, msg) {
window.open("https://map.baidu.com/search/"+encodeURIComponent(msg.Option(mdb.TEXT)) window.open("https://map.baidu.com/search/"+encodeURIComponent(msg.Option(mdb.TEXT))
+"/@12958750.085,4825785.55,16z?querytype=s&da_src=shareurl&wd="+encodeURIComponent(msg.Option(mdb.TEXT))) +"/@12958750.085,4825785.55,16z?querytype=s&da_src=shareurl&wd="+encodeURIComponent(msg.Option(mdb.TEXT)))
}, },
chooseImage: function(cb) { chooseImage: function(can, cb) {
typeof cb == lang.FUNCTION && cb([]) typeof cb == lang.FUNCTION && cb([])
}, },
}, },

View File

@ -15,7 +15,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
can.require([can.base.MergeURL("https://map.qq.com/api/gljs", "v", "1.exp", "libraries", "service", "key", can.Conf(aaa.TOKEN))], function() { can.require([can.base.MergeURL("https://map.qq.com/api/gljs", "v", "1.exp", "libraries", "service", "key", can.Conf(aaa.TOKEN))], function() {
var res = {type: "unknown", latitude: 3998412, longitude: 11630748}, current = can.base.Obj(msg.Option(chat.LOCATION)) var res = {type: "unknown", latitude: 3998412, longitude: 11630748}, current = can.base.Obj(msg.Option(chat.LOCATION))
if (current.status === 0) { res = can.onexport.point(can, current.result.location, current.result.ad_info), res.type = "ip", res.name = current.result.ip, can.Status(res) } if (current.status === 0) { res = can.onexport.point(can, current.result.location, current.result.ad_info), res.type = "ip", res.name = current.result.ip, can.Status(res) }
can._current = res, can.onimport._layout(can), can.user.agent.getLocation(function(res) { res.type = "current", can.onimport.center(can, can._current = res) }) can._current = res, can.onimport._layout(can), can.user.agent.getLocation(can, function(res) { res.type = "current", can.onimport.center(can, can._current = res) })
}) })
}, },
_layout: function(can) { can.onmotion.clear(can, can.ui.content), can.onmotion.clear(can, can.ui.project) _layout: function(can) { can.onmotion.clear(can, can.ui.content), can.onmotion.clear(can, can.ui.project)
@ -46,18 +46,18 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
can.runAction(can.request({}, {"boundary": "nearby("+can.base.join([p.lat, p.lng, "500"], ice.FS)+")", "page_index": 1, "keyword": keyword}), "search", [], function(msg) { can.runAction(can.request({}, {"boundary": "nearby("+can.base.join([p.lat, p.lng, "500"], ice.FS)+")", "page_index": 1, "keyword": keyword}), "search", [], function(msg) {
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) { 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.explore._target) can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.explore._target)
}), can.misc.Debug(res) })
}) })
}, },
_search: function(can, keyword) { var p = can.onimport.point(can, can.current.item) _search: function(can, keyword) { var p = can.onimport.point(can, can.current.item)
can.runAction(can.request({}, {"boundary": "region("+can.base.join([can.Status("city"), p.lat, p.lng], ice.FS)+")", "page_index": 1, "keyword": keyword}), "search", [], function(msg) { can.runAction(can.request({}, {"boundary": "region("+can.base.join([can.Status("city"), p.lat, p.lng], ice.FS)+")", "page_index": 1, "keyword": keyword}), "search", [], function(msg) {
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) { 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.search._target) can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.search._target)
}), can.misc.Debug(res) })
}) })
}, },
_list_result: function(can, msg, cb) { var res = can.base.Obj(msg.Result()); can.misc.Debug(res) _list_result: function(can, msg, cb) { var res = can.base.Obj(msg.Result())
return can.core.List(res.result[0], function(item) { item.name = item.name||item.fullname; return can.base.isFunc(cb)? cb(item): item }) return can.core.List(res.result[0], function(item) { item.name = item.name||item.fullname; return can.base.isFunc(cb)? cb(item): item })
}, },
_district: function(can, id, cb) { _district: function(can, id, cb) {
@ -259,7 +259,7 @@ Volcanos(chat.ONACTION, {help: "操作数据", list: [["mode", "select", "insert
can.runAction(can.request({}, {"boundary": "nearby("+can.base.join([p.lat, p.lng, "500"], ice.FS)+")", "page_index": i}), button, [], function(msg) { can.runAction(can.request({}, {"boundary": "nearby("+can.base.join([p.lat, p.lng, "500"], ice.FS)+")", "page_index": i}), button, [], function(msg) {
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) { 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.explore._target) can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.explore._target)
}), can.misc.Debug(res) })
}) })
} }
}, },

View File

@ -5,19 +5,19 @@ Volcanos(chat.ONACTION, {source: function(can, msg) {
nonceStr: msg.Option("noncestr"), timestamp: msg.Option("timestamp"), nonceStr: msg.Option("noncestr"), timestamp: msg.Option("timestamp"),
jsApiList: can.core.Item({ jsApiList: can.core.Item({
scanQRCode: function(cb) { wx.scanQRCode({needResult: cb? 1: 0, scanType: ["qrCode","barCode"], success: function (res) { scanQRCode: function(can, cb) { wx.scanQRCode({needResult: cb? 1: 0, scanType: ["qrCode","barCode"], success: function (res) {
can.base.isFunc(cb) && cb(res.resultStr, can.base.ParseJSON(res.resultStr)) can.base.isFunc(cb) && cb(can.base.ParseJSON(res.resultStr))
} }) }, } }) },
getLocation: function(cb) { wx.getLocation({type: "gcj02", success: function (res) { 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) }) can.base.isFunc(cb) && cb({type: "gcj02", name: "当前位置", text: "当前位置", latitude: parseInt(res.latitude*100000), longitude: parseInt(res.longitude*100000) })
} }) }, } }) },
openLocation: function(msg) { wx.openLocation({ openLocation: function(can, msg) { wx.openLocation({
latitude: parseInt(msg.Option("latitude"))/100000, latitude: parseInt(msg.Option("latitude"))/100000,
longitude: parseInt(msg.Option("longitude"))/100000, longitude: parseInt(msg.Option("longitude"))/100000,
name: msg.Option(mdb.NAME), address: msg.Option(mdb.TEXT), name: msg.Option(mdb.NAME), address: msg.Option(mdb.TEXT),
scale: msg.Option("scale")||14, infoUrl: msg.Option(mdb.LINK), scale: msg.Option("scale")||14, infoUrl: msg.Option(mdb.LINK),
}) }, }) },
chooseImage: function(cb, count) { wx.chooseImage({count: count||9, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: function (res) { chooseImage: function(can, cb, count) { wx.chooseImage({count: count||9, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: function (res) {
can.base.isFunc(cb) && cb(res.localIds) can.base.isFunc(cb) && cb(res.localIds)
} }) }, } }) },
}, function(key, value) { return can.user.agent[key] = value, key }), }, function(key, value) { return can.user.agent[key] = value, key }),

View File

@ -79,7 +79,7 @@ Volcanos(chat.ONACTION, {help: "组件菜单", list: [
limit: function(event, can, key, value) { can.Action(key, value), can.onimport.page(can, can.list) }, limit: function(event, can, key, value) { can.Action(key, value), can.onimport.page(can, can.list) },
chooseImage: function(event, can) { var msg = can.request(event) chooseImage: function(event, can) { var msg = can.request(event)
can.user.agent.chooseImage(function(list) { can.core.List(list, function(item) { can.user.agent.chooseImage(can, function(list) { can.core.List(list, function(item) {
can.page.Append(can, can._output, [{img: item, height: 200}]) can.page.Append(can, can._output, [{img: item, height: 200}])
}) }) }) })
}, },

View File

@ -202,20 +202,25 @@ Volcanos(chat.ONACTION, {help: "交互操作", list: [
} }
}) })
}, },
getClipboardData: function(event, can, button) {
openLocation: function(event, can) { can.user.agent.openLocation(can.request(event)) }, function add(text) { can.runAction(event, button, can.base.Simple(can.base.ParseJSON(text)), function() { can.Update() }) }
navigator.clipboard? navigator.clipboard.readText().then(add).catch(function(err) { can.misc.Log(err) }):
can.user.input(event, can, [{type: html.TEXTAREA, name: mdb.TEXT}], function(list) { add(list[0]) })
},
scanQRCode0: function(event, can, button) { can.user.agent.scanQRCode(can) },
scanQRCode: function(event, can, button) {
can.user.agent.scanQRCode(can, function(data) {
can.runAction(event, button, can.base.Simple(data), function() { can.Update() })
})
},
openLocation: function(event, can) { can.user.agent.openLocation(can, can.request(event)) },
getLocation: function(event, can, button) { getLocation: function(event, can, button) {
can.user.agent.getLocation(function(data) { can.request(event, data) can.user.agent.getLocation(can, function(data) { can.request(event, data)
can.user.input(event, can, [mdb.TYPE, mdb.NAME, mdb.TEXT, "latitude", "longitude"], function(args) { can.user.input(event, can, [mdb.TYPE, mdb.NAME, mdb.TEXT, "latitude", "longitude"], function(args) {
can.runAction(event, button, args) can.runAction(event, button, args)
}) })
}) })
}, },
getClipboardData: function(event, can, button) {
function add(text) { can.runAction(event, button, [can.base.ParseJSON(text)]) }
navigator.clipboard? navigator.clipboard.readText().then(add).catch(function(err) { can.misc.Log(err) }):
can.user.input(event, can, [{type: html.TEXTAREA, name: mdb.TEXT}], function(list) { add(list[0]) })
},
}) })
Volcanos(chat.ONEXPORT, {help: "导出数据", Volcanos(chat.ONEXPORT, {help: "导出数据",
table: function(can) { var msg = can._msg; if (msg.Length() == 0) { return } table: function(can) { var msg = can._msg; if (msg.Length() == 0) { return }