1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
shaoying 2021-02-09 10:50:19 +08:00
parent 041f4ac34c
commit 3257626d81
4 changed files with 125 additions and 82 deletions

View File

@ -761,7 +761,7 @@ Volcanos("onmotion", {help: "动态交互", list: [], _init: function(can, targe
can.page.Modify(can, target||can._output, "")
},
hidden: function(can, target) {
can.page.Modify(can, target, {style: {display: "none"}})
can.page.Modify(can, target||can._target, {style: {display: "none"}})
},
toggle: function(can, target) {
can.page.Toggle(can, target)

View File

@ -18,6 +18,14 @@ App({
}; return max
},
Table: function(cb) { var res = []
if (msg.append && msg.append[0] == "key" && msg.append[1] == "value") {
var line = {}; kit.List(msg.key, function(key, index) {
line[key] = msg.value[index]
})
typeof cb == "function" && cb(line, 0, 1)
return res.push(line), res
}
for (var i = 0; i < msg.Length(); i++) { var line = {}
for (var k in msg.append) { line[msg.append[k]] = msg[msg.append[k]][i] }
typeof cb == "function" && cb(line, i, msg.Length())
@ -107,9 +115,9 @@ App({
}}) },
location: function(cb) { wx.chooseLocation({success: function(res) {
typeof cb == "function" && cb({
name: res.name, text: res.address,
latitude: parseInt(res.latitude * 100000),
type: "gcj02", name: res.name, text: res.address,
longitude: parseInt(res.longitude * 100000),
latitude: parseInt(res.latitude * 100000),
})
}}) },

View File

@ -148,13 +148,48 @@ Page({
app.toast("添加成功"), page.run(event, order)
})
}) },
upload: function() {
startLocalServiceDiscovery: function(event, page, order, cmd) {
wx.onLocalServiceFound(function(res) {
console.log(res)
})
wx.showLoading()
wx.startLocalServiceDiscovery({
serviceType: '_http._tcp.',
success: function(res) {
wx.hideLoading()
console.log(res)
},
})
},
getLocation: function(event, page, order, cmd) { app.location(function(res) {
page.run(event, order, kit.Simple("action", cmd, res), function() {
app.toast("添加成功"), page.run(event, order)
})
}) },
chooseLocation: function(event, page, order, cmd) {
wx.chooseLocation({success: function(res) { res.text = res.address, delete(res.address)
page.run(event, order, kit.Simple("action", cmd, res), function() {
app.toast("添加成功"), page.run(event, order)
})
}})
},
getWifiList: function(event, page, order, cmd) {
wx.onGetWifiList(function(res) {
console.log(res)
})
wx.getWifiList(function(res) {
console.log(res)
})
},
openLocation: function(event, page, order, cmd) {
var list = page.data.list[order].msg.Table()
var data = list[event.currentTarget.dataset.index]||list[0]
wx.openLocation({name: data.name, address: data.text, latitude: parseInt(data.latitude)/100000.0, longitude: parseInt(data.longitude)/100000.0})
},
},
onReady: function () {},

View File

@ -39,7 +39,7 @@
"minifyWXSS": true
},
"compileType": "miniprogram",
"libVersion": "2.0.4",
"libVersion": "2.15.0",
"appid": "wxf4e5104d83476ed6",
"projectname": "%E7%BB%88%E7%AB%AF%E5%B7%A5%E5%85%B7%E9%93%BE",
"debugOptions": {
@ -68,10 +68,10 @@
"miniprogram": {
"list": [
{
"id": -1,
"id": 0,
"name": "pages/action/action",
"pathName": "pages/action/action",
"query": "river=2d506d&storm=8271a3&title=hi.scan",
"query": "river= e0a1eb&storm=c23ae3&title=hi.scan",
"scene": 1001
}
]