mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
opt mp
This commit is contained in:
parent
5d991551fc
commit
0d7b3c5c5f
@ -3,9 +3,7 @@ const kit = require("utils/kit.js")
|
||||
App({
|
||||
data: {}, conf: {serve: "https://shylinux.com/chat", space: ""},
|
||||
requests: function(cmd, data, cb) { wx.showLoading()
|
||||
this.request(cmd, data, function(msg) { wx.hideLoading()
|
||||
typeof cb == "function" && cb(msg)
|
||||
})
|
||||
this.request(cmd, data, function(msg) { wx.hideLoading(), typeof cb == "function" && cb(msg) })
|
||||
},
|
||||
request: function(cmd, data, cb) { var app = this; data.sessid = app.conf.sessid, data.pod = app.conf.space
|
||||
wx.request({method: "POST", url: app.conf.serve+"/"+cmd, data: data, success: function(res) { var msg = res.data
|
||||
@ -62,6 +60,7 @@ App({
|
||||
download: function(cmd, data, cb) { var app = this; data.sessid = app.conf.sessid
|
||||
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/sess", {code: res.code}, function(msg) {
|
||||
wx.setStorage({key: "sessid", data: app.conf.sessid = msg.Result()})
|
||||
@ -80,6 +79,9 @@ App({
|
||||
}}) })
|
||||
},
|
||||
location: function(arg) { wx.chooseLocation(arg) },
|
||||
clipboard: function(cb) { wx.getClipboardData({success: function(res) {
|
||||
typeof cb == "function" && cb(kit.parseJSON(res.data))
|
||||
}}) },
|
||||
|
||||
title: function(title) { wx.setNavigationBarTitle({title: title, success: function() {}})},
|
||||
modal: function(title, content, cb) { wx.showModal({title: title||"", content: content||"", success: cb})},
|
||||
|
@ -63,7 +63,6 @@ Page({
|
||||
console.log("action", this.name, data.name)
|
||||
this.action[data.name](event, this)
|
||||
},
|
||||
|
||||
run: function(event, order, cmd, cb) { var page = this, field = page.data.list[order]
|
||||
var cmds = [page.data.river, page.data.storm, field.id||field.key]; if (!cmd) {
|
||||
var cmd = kit.List(field.inputs, function(input) { if (input._input != "button") { return input.value } })
|
||||
@ -85,11 +84,11 @@ Page({
|
||||
})
|
||||
return true
|
||||
}) },
|
||||
getClipboardData: function(event, order, page, cmd) { wx.getClipboardData({success: function(res) {
|
||||
page.run(event, order, kit.Simple("action", cmd, kit.parseJSON(res.data)), function() {
|
||||
getClipboardData: function(event, order, page, cmd) { app.clipboard(function(res) {
|
||||
page.run(event, order, kit.Simple("action", cmd, res), function() {
|
||||
app.toast("添加成功"), page.run(event, order)
|
||||
})
|
||||
}}) },
|
||||
}) },
|
||||
getLocation: function(event, order, page, cmd) { app.location({success: function(res) {
|
||||
res.latitude = parseInt(res.latitude * 100000)
|
||||
res.longitude = parseInt(res.longitude * 100000)
|
||||
@ -106,7 +105,6 @@ Page({
|
||||
var input = page.data.list[data.order].inputs[data.index]
|
||||
input.value = input.values[parseInt(event.detail.value)]
|
||||
},
|
||||
|
||||
onClick: function(event) { var page = this, data = event.target.dataset
|
||||
var field = page.data.list[data.order]
|
||||
var input = field.inputs[data.index]
|
||||
|
@ -11,7 +11,6 @@ function shy(help, meta, list, cb) {
|
||||
cb.list = next("object") || []
|
||||
return cb
|
||||
}; var _can_name = ""
|
||||
|
||||
module.exports = {
|
||||
Number: function(d, n) {var res = [];
|
||||
while (d > 0) {res.push(d % 10); d = parseInt(d / 10); n--}
|
||||
|
Loading…
x
Reference in New Issue
Block a user