1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

mix branch 'master'

This commit is contained in:
shaoying 2019-09-22 19:07:23 +08:00
commit 2477780d67
4 changed files with 22 additions and 6 deletions

View File

@ -120,6 +120,8 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
return
case "rename":
m.Cmd("aaa.auth", "username", m.Option("username"), "data", "nickname", arg[1])
case "weixin":
}
}

View File

@ -642,6 +642,14 @@ var page = Page({check: true,
})
page.river.Pane.Show(), page.pane = page.action, page.plugin = kit.Selector(page.action, "fieldset")[0]
page.action.Pane.Layout(ctx.Search("layout")? ctx.Search("layout"): kit.device.isMobile? "办公": "工作")
page.socket = page.WSS()
function conn() {
page.socket = page.WSS(null, function() {
page.socket.close()
}, function() {
setTimeout(conn, 1000)
})
}
conn()
},
})

View File

@ -204,7 +204,7 @@ ctx = context = {
xhr.setRequestHeader("Accept", "application/json")
xhr.send(args.join("&"))
},
WSS: function(cb) {
WSS: function(cb, onerror, onclose) {
var s = new WebSocket(location.protocol.replace("http", "ws")+"//"+location.host+"/wss")
s.onopen = function(event) {
kit.Log(event)
@ -225,9 +225,11 @@ ctx = context = {
}
s.onerror = function(event) {
kit.Log(event)
typeof onerror == "function" && onerror(event)
}
s.onclose = function(event) {
kit.Log(event)
typeof onclose == "function" && onclose(event)
}
return s
},

View File

@ -142,10 +142,10 @@ function Page(page) {
}
if (page.check) {
false && kit.device.isWeiXin? page.login.Pane.Run(["weixin"], function(msg) {
kit.device.isWeiXin? page.login.Pane.Run(["weixin"], function(msg) {
page.Include([
"https://res.wx.qq.com/open/js/jweixin-1.4.0.js",
"/static/librarys/weixin.js",
// "/static/librarys/weixin.js",
], function(event) {
wx.error(function(res){})
wx.ready(function(){
@ -437,7 +437,7 @@ function Page(page) {
}
return typeof page[args[0]] == "function" && kit._call(page[args[0]], args.slice(1))
},
WSS: function(cb) {
WSS: function(cb, onerror, onclose) {
return ctx.WSS(cb || (function(m) {
if (m.detail) {
page.action.Pane.Core(event, m, ["_cmd", m.detail], function(msg) {
@ -446,7 +446,7 @@ function Page(page) {
} else {
page.ontoast(m.result.join(""))
}
}))
}), onerror, onclose)
},
initToast: function() {},
@ -464,6 +464,10 @@ function Page(page) {
})
}]}, {type: "br"},
])
if (kit.device.isWeiXin) {
kit.AppendChild(output, [])
}
return {
Login: function(username, password, cb) {
field.Pane.Run([username, password], function(msg) {cb(msg.result && msg.result[0] || "")})