1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 01:04:06 +08:00
This commit is contained in:
shaoying 2020-10-23 09:21:11 +08:00
parent 0a35665fc4
commit 5a7e8fece5
2 changed files with 11 additions and 11 deletions

View File

@ -42,21 +42,21 @@ App({
wx.downloadFile({url: app.conf.serve+"/"+cmd, data: data, success: cb})
},
usercode: function(cb) { var app = this
wx.login({success: function(res) { app.request("mp/login/code", {code: res.code}, function(msg) {
wx.login({success: function(res) { app.request("mp/login/sess", {code: res.code}, function(msg) {
wx.setStorage({key: "sessid", data: msg.Result()})
app.conf.sessid = msg.Result(), typeof cb == "function" && cb()
})}})
},
userinfo: function(cb) { var app = this
if (app.conf.userInfo) {
app.request("mp/login/info", app.conf.userInfo, function(msg) {
app.request("mp/login/user", app.conf.userInfo, function(msg) {
typeof cb == "function" && cb(app.conf.userInfo)
})
return
}
app.usercode(function() {
wx.getSetting({ success: function(res) { res.authSetting['scope.userInfo'] && wx.getUserInfo({success: function(res) {
app.request("mp/login/info", res.userInfo, function(msg) { app.conf.userInfo = res.userInfo
app.request("mp/login/user", res.userInfo, function(msg) { app.conf.userInfo = res.userInfo
typeof cb == "function" && cb(res.userInfo)
})
}})}})

View File

@ -59,7 +59,14 @@ Page({
onReachBottom: function () {},
plugin: {
scan: function(page) { app.scans(function(res) {
getLocation: function(page, data) { app.location({success: function(res) {
res.latitude = parseInt(res.latitude * 100000)
res.longitude = parseInt(res.longitude * 100000)
kit.List(page.data.insert, function(item) {
res[item.name] && (item.value = res[item.name])
}), page.setData(page.data)
}}) },
scanQRCode: function(page) { app.scans(function(res) {
kit.List(page.data.insert, function(item) {
res[item.name] && (item.value = res[item.name])
}), page.setData(page.data)
@ -69,12 +76,5 @@ Page({
res[item.name] && (item.value = res[item.name])
}), page.setData(page.data)
}}) },
location: function(page, data) { app.location({success: function(res) {
res.latitude = parseInt(res.latitude * 100000)
res.longitude = parseInt(res.longitude * 100000)
kit.List(page.data.insert, function(item) {
res[item.name] && (item.value = res[item.name])
}), page.setData(page.data)
}}) },
},
})