mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
add mp
This commit is contained in:
parent
7e5ff58415
commit
3ae4c800db
@ -102,20 +102,10 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
|
|||||||
function set(begin_time, col, row) { return begin+col-1+"-"+can.base.Number(row, 2) }
|
function set(begin_time, col, row) { return begin+col-1+"-"+can.base.Number(row, 2) }
|
||||||
can.onimport._content(can, msg, head, list, key, get, set)
|
can.onimport._content(can, msg, head, list, key, get, set)
|
||||||
},
|
},
|
||||||
layout: function(can) {
|
layout: function(can) { can.ui.layout(can.ConfHeight(), can.ConfWidth());
|
||||||
can.ui.layout(can.ConfHeight(), can.ConfWidth())
|
(can.Conf("_auto") || can.user.isMobile) && can.page.style(can, can.ui.content, html.HEIGHT, "")
|
||||||
can.user.isMobile && can.page.style(can, can.ui.content, html.HEIGHT, "")
|
|
||||||
var sub = can._plugin_display; sub && sub.onimport.display_size(can, sub)
|
var sub = can._plugin_display; sub && sub.onimport.display_size(can, sub)
|
||||||
can.ui.toggle && can.ui.toggle.layout()
|
can.ui.toggle && can.ui.toggle.layout()
|
||||||
return
|
|
||||||
can.page.styleHeight(can, can._output, can.ConfHeight()), can.page.styleHeight(can, can.ui.project, can.ConfHeight())
|
|
||||||
var height = can._display_heights[can.sup.task? [can.sup.task.zone, can.sup.task.id].join(mdb.FS): ""]||html.ACTION_HEIGHT
|
|
||||||
if (!can.ui.display.innerHTML || can.ui.display.style.display == html.NONE) { height = 0 }
|
|
||||||
can.page.style(can, can.ui.table, html.HEIGHT, can.ConfHeight()-height, html.WIDTH, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
|
|
||||||
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight()-height, html.WIDTH, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
|
|
||||||
can.page.styleHeight(can, can.ui.profile, can.ConfHeight()-height), height == 0 || can.core.List(can._plugins_display, function(sub) {
|
|
||||||
sub.onimport.size(sub, height-html.ACTION_HEIGHT-sub.onexport.statusHeight(sub), sub.ConfWidth(can.ConfWidth()-can.ui.project.offsetWidth), true)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}, [""])
|
}, [""])
|
||||||
Volcanos(chat.ONACTION, {list: [
|
Volcanos(chat.ONACTION, {list: [
|
||||||
|
@ -1,50 +1,43 @@
|
|||||||
|
const {ice, ctx, mdb, chat, html} = require("../../utils/const.js")
|
||||||
const {shy, Volcanos} = require("../../utils/proto.js")
|
const {shy, Volcanos} = require("../../utils/proto.js")
|
||||||
const {ice, ctx, mdb, html} = require("../../utils/const.js")
|
|
||||||
Volcanos._page = {}
|
Volcanos._page = {}
|
||||||
Volcanos("onimport", {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) { can.db.list = []
|
_init: function(can, msg) { can.ui.data.list = []
|
||||||
msg.Table(function(value, index) { can.db.list.push(value)
|
msg.Table(function(value, index) { can.ui.data.list.push(value)
|
||||||
value.feature = can.base.Obj(value.meta, {})
|
value.feature = can.base.Obj(value.meta, {})
|
||||||
value.inputs = can.base.Obj(value.list, [])
|
value.inputs = can.base.Obj(value.list, [])
|
||||||
value.name = can.core.Split(value.name)[0]
|
value.name = can.core.Split(value.name)[0]
|
||||||
if (!value.inputs || value.inputs.length === 0) {
|
if (!value.inputs || value.inputs.length === 0) {
|
||||||
value.inputs = [{type: html.TEXT}, {type: html.BUTTON, value: "执行"}]
|
value.inputs = [{type: html.TEXT}, {type: html.BUTTON, name: ctx.RUN}]
|
||||||
}
|
}
|
||||||
can.core.List(value.inputs, function(input) {
|
can.core.List(value.inputs, function(input) {
|
||||||
input.action = input.action || input.value
|
input.action = input.action || input.value
|
||||||
input.value = can.core.Value(value, "feature._trans."+input.name) || input.value
|
input.value == ice.AUTO && (input.value = "")
|
||||||
input.value == "auto" && (input.value = "")
|
|
||||||
if (input.value && input.value.indexOf("@") == 0) {
|
if (input.value && input.value.indexOf("@") == 0) {
|
||||||
input.action = input.value.slice(1), input.value = ""
|
input.action = input.value.slice(1), input.value = ""
|
||||||
}
|
}
|
||||||
if (input.type == "select") {
|
if (input.type == html.SELECT) {
|
||||||
input.values = input.values || can.core.Split(input.value)
|
input.values = input.values || can.core.Split(input.value)
|
||||||
}
|
}
|
||||||
if (input.type == "button") {
|
if (input.type == html.BUTTON) {
|
||||||
|
input.value = can.core.Value(value, "feature._trans."+(input.value||input.name))
|
||||||
input.value = {"list": "查看", "back": "返回", "create": "创建"}[input.value||input.name]||input.value||input.name
|
input.value = {"list": "查看", "back": "返回", "create": "创建"}[input.value||input.name]||input.value||input.name
|
||||||
}
|
}
|
||||||
input.type == "button" && input.action == "auto" && can.core.Timer(100, function() {
|
input.type == html.BUTTON && input.action == ice.AUTO && can.core.Timer(100, function() {
|
||||||
can.run({}, [can.db.river, can.db.storm, value.id||value.index], function(msg) {
|
can.run({}, [can.db.river, can.db.storm, value.id||value.index], function(msg) {
|
||||||
value.msg = msg, can.page.setData(can, can.db.list)
|
value.msg = msg, can.page.setData(can)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}), can.page.setData(can, can.db.list)
|
}), can.page.setData(can)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onaction", {list: ["刷新", "扫码", "清屏"],
|
Volcanos(chat.ONACTION, {list: ["刷新", "扫码", "清屏"],
|
||||||
"刷新": function(event, can) { can.onaction.refresh(event, can) },
|
"刷新": function(event, can) { can.onaction.refresh(event, can) },
|
||||||
"扫码": function(event, can) { can.user.agent.scanQRCode(can) },
|
"扫码": function(event, can) { can.user.agent.scanQRCode(can) },
|
||||||
"清屏": function(event, can) {
|
"清屏": function(event, can) { can.core.List(can.ui.data.list, function(item) { delete(item.msg) }), can.page.setData(can) },
|
||||||
can.core.List(can.db.list, function(item) { delete(item.msg) })
|
refresh: function(event, can) { can.run(event, [can.db.river, can.db.storm], function(msg) { can.onimport._init(can, msg) }) },
|
||||||
can.page.setData(can, can.db.list)
|
onaction: function(event, can, button, data) { var name = data.name;
|
||||||
},
|
|
||||||
refresh: function(event, can) {
|
|
||||||
can.run(event, [can.db.river, can.db.storm], function(msg) {
|
|
||||||
can.onimport._init(can, msg)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onaction: function(event, can, button, data) { var name = data.name
|
|
||||||
(can.onaction[name]||function(event) { can.run(event, [ctx.ACTION, name]) })(event, can)
|
(can.onaction[name]||function(event) { can.run(event, [ctx.ACTION, name]) })(event, can)
|
||||||
},
|
},
|
||||||
onInputs: function(event, can, button, data) { var order = data.order, index = data.index
|
onInputs: function(event, can, button, data) { var order = data.order, index = data.index
|
||||||
@ -59,38 +52,31 @@ Volcanos("onaction", {list: ["刷新", "扫码", "清屏"],
|
|||||||
var field = can.ui.data.list[order||0]
|
var field = can.ui.data.list[order||0]
|
||||||
if (field.feature[name]) {
|
if (field.feature[name]) {
|
||||||
can.data.insert = {field: field, name: name, list: field.feature[name], cb: function(res) {
|
can.data.insert = {field: field, name: name, list: field.feature[name], cb: function(res) {
|
||||||
debugger
|
|
||||||
can.run(event, can.base.Simple([can.db.river, can.db.storm, field.id||field.index, ctx.ACTION, name], res), function(msg) {
|
can.run(event, can.base.Simple([can.db.river, can.db.storm, field.id||field.index, ctx.ACTION, name], res), function(msg) {
|
||||||
can.onaction.onAction(event, can, ice.LIST, {order: order, name: ice.LIST})
|
can.onaction.onAction(event, can, ice.LIST, {order: order, name: ice.LIST})
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
can.user.jumps("/pages/insert/insert", {river: can.db.river, storm: can.db.storm, index: field.id||field.index, title: field.name})
|
can.user.jumps(chat.PAGES_INSERT, {river: can.db.river, storm: can.db.storm, index: field.id||field.index, title: field.name})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
field._history = field._history||[]
|
field._history = field._history||[]
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case ice.BACK: field._history.pop()
|
case ice.BACK: field._history.pop()
|
||||||
var ls = field._history.pop()||[], i = 0
|
var ls = field._history.pop()||[], i = 0
|
||||||
can.core.List(field.inputs, function(input, index) {
|
can.core.List(field.inputs, function(input, index) { if (input.type != html.BUTTON) { input.value = ls[i++]||"" } })
|
||||||
if (input.type != html.BUTTON) { input.value = ls[i++]||"" }
|
can.page.setData(can), can.onaction.onAction(event, can, ice.LIST, {order: order, name: ice.LIST})
|
||||||
})
|
|
||||||
can.page.setData(can)
|
|
||||||
can.onaction.onAction(event, can, order, ice.LIST)
|
|
||||||
break
|
break
|
||||||
case "run":
|
case ctx.RUN:
|
||||||
case ice.LIST:
|
case ice.LIST:
|
||||||
case "refresh":
|
case "refresh": break
|
||||||
break
|
default: return
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
var cmds = [can.db.river, can.db.storm, field.id||field.index]
|
var cmds = [can.db.river, can.db.storm, field.id||field.index]
|
||||||
var cmd = can.core.List(field.inputs, function(input) { if (input.type != html.BUTTON) { return input.value } })
|
var cmd = can.core.List(field.inputs, function(input) { if (input.type != html.BUTTON) { return input.value } })
|
||||||
function eq(to, from) { if (!to) { return false }
|
function eq(to, from) { if (!to) { return false }
|
||||||
if (to.length != from.length) { return false }
|
if (to.length != from.length) { return false }
|
||||||
for (var i = 0; i < to.length; i++) {
|
for (var i = 0; i < to.length; i++) { if (to[i] != from[i]) { return false } }
|
||||||
if (to[i] != from[i]) { return false }
|
return true
|
||||||
} return true
|
|
||||||
} eq(field._history[field._history.length-1], cmd) || field._history.push(cmd)
|
} eq(field._history[field._history.length-1], cmd) || field._history.push(cmd)
|
||||||
cmds = cmds.concat(cmd)
|
cmds = cmds.concat(cmd)
|
||||||
for (var i = cmds.length-1; i > 0; i--) { if (cmds[i] === "") { cmds.pop() } else { break } }
|
for (var i = cmds.length-1; i > 0; i--) { if (cmds[i] === "") { cmds.pop() } else { break } }
|
||||||
@ -99,9 +85,8 @@ Volcanos("onaction", {list: ["刷新", "扫码", "清屏"],
|
|||||||
onDetail: function(event, can, button, data) { var order = data.order, name = data.name, value = data.value
|
onDetail: function(event, can, button, data) { var order = data.order, name = data.name, value = data.value
|
||||||
var field = can.ui.data.list[order||0]
|
var field = can.ui.data.list[order||0]
|
||||||
can.core.List(field.inputs, function(input) {
|
can.core.List(field.inputs, function(input) {
|
||||||
if (input.name == name) {
|
if (input.name == name) { input.value = value, can.page.setData(can)
|
||||||
input.value = value, can.page.setData(can)
|
can.onaction.onAction(event, can, ice.LIST, {order: order, name: ice.LIST})
|
||||||
can.onaction.onAction(event, can, order, ice.LIST)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
|
const {ice, mdb, chat, html} = require("../../utils/const.js")
|
||||||
const {shy, Volcanos} = require("../../utils/proto.js")
|
const {shy, Volcanos} = require("../../utils/proto.js")
|
||||||
const {mdb, html} = require("../../utils/const.js")
|
|
||||||
Volcanos._page = {}
|
Volcanos._page = {}
|
||||||
Volcanos("onimport", {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) {},
|
_init: function(can, msg) {},
|
||||||
})
|
})
|
||||||
|
Volcanos(chat.ONACTION, {list: ["刷新", "扫码"],
|
||||||
Volcanos("onaction", {list: ["刷新", "扫码"],
|
|
||||||
"刷新": function(event, can) { can.onaction.refresh(event, can) },
|
"刷新": function(event, can) { can.onaction.refresh(event, can) },
|
||||||
"扫码": function(event, can) { can.user.agent.scanQRCode(can) },
|
"扫码": function(event, can) { can.user.agent.scanQRCode(can) },
|
||||||
refresh: function(event, can) {
|
refresh: function(event, can) {
|
||||||
can.core.List(can.data.insert.list, function(input) {
|
can.core.List(can.data.insert.list, function(input) {
|
||||||
input.action = input.action || input.value
|
input.action = input.action || input.value
|
||||||
input.value == "auto" && (input.value = "")
|
input.value == ice.AUTO && (input.value = "")
|
||||||
if (input.value && input.value.indexOf("@") == 0) {
|
if (input.value && input.value.indexOf("@") == 0) {
|
||||||
input.action = input.value.slice(1), input.value = ""
|
input.action = input.value.slice(1), input.value = ""
|
||||||
}
|
}
|
||||||
})
|
if (input.type == html.SELECT) {
|
||||||
can.page.setData(can, can.data.insert.list)
|
input.values = input.values || can.core.Split(input.value)
|
||||||
|
}
|
||||||
|
}), can.page.setData(can, can.data.insert.list)
|
||||||
},
|
},
|
||||||
onaction: function(event, can, button, data) { var name = data.name
|
onaction: function(event, can, button, data) { var name = data.name;
|
||||||
(can.onaction[name]||function(event) { can.run(event, [ctx.ACTION, name]) })(event, can)
|
(can.onaction[name]||function(event) { can.run(event, [ctx.ACTION, name]) })(event, can)
|
||||||
},
|
},
|
||||||
onInputs: function(event, can, button, data) { var index = data.index
|
onInputs: function(event, can, button, data) { var index = data.index
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
<picker wx:elif="{{item.type == 'select'}}" range="{{item.values}}" value="{{item.index||0}}" bindchange="onChange" data-index="{{index}}">
|
<picker wx:elif="{{item.type == 'select'}}" range="{{item.values}}" value="{{item.index||0}}" bindchange="onChange" data-index="{{index}}">
|
||||||
<view>{{item.values[item.index||0]}}</view>
|
<view>{{item.values[item.index||0]}}</view>
|
||||||
</picker>
|
</picker>
|
||||||
<!-- 按钮 -->
|
|
||||||
<button wx:elif="{{item.type == 'button'}}" size="mini" bindtap="onClick" data-index="{{index}}">{{item.value||item.name}}</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="action">
|
<view class="action">
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
const {ice, nfs, chat, html} = require("../../utils/const.js")
|
||||||
const {shy, Volcanos} = require("../../utils/proto.js")
|
const {shy, Volcanos} = require("../../utils/proto.js")
|
||||||
const {ice, chat, html} = require("../../utils/const.js")
|
|
||||||
Volcanos._page = {}
|
Volcanos._page = {}
|
||||||
Volcanos("onimport", {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) { msg.Dump(can) },
|
_init: function(can, msg) { msg.Dump(can) },
|
||||||
})
|
})
|
||||||
Volcanos("onaction", {list: ["刷新", "扫码", "登录"],
|
Volcanos("onaction", {list: ["刷新", "扫码", "登录"],
|
||||||
@ -24,8 +24,8 @@ Volcanos("onaction", {list: ["刷新", "扫码", "登录"],
|
|||||||
},
|
},
|
||||||
onchange: function(event, can, button, data) { var index = data.index, i = data.i
|
onchange: function(event, can, button, data) { var index = data.index, i = data.i
|
||||||
var river = can.ui.data.list[index], storm = river.list[i]
|
var river = can.ui.data.list[index], storm = river.list[i]
|
||||||
can.user.jumps(can.base.MergeURL("/pages/action/action", {river: river.hash, storm: storm.hash, title: river.name+"."+storm.name}))
|
can.user.jumps(can.base.MergeURL(chat.PAGES_ACTION, {river: river.hash, storm: storm.hash, title: river.name+"."+storm.name}))
|
||||||
},
|
},
|
||||||
_name: "/chat/river/",
|
_name: nfs.CHAT_RIVER,
|
||||||
})
|
})
|
||||||
Volcanos._init()
|
Volcanos._init()
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
"uploadWithSourceMap": true,
|
"uploadWithSourceMap": true,
|
||||||
"compileHotReLoad": false,
|
"compileHotReLoad": false,
|
||||||
"lazyloadPlaceholderEnable": false,
|
"lazyloadPlaceholderEnable": false,
|
||||||
"useMultiFrameRuntime": false,
|
"useMultiFrameRuntime": true,
|
||||||
"useApiHook": false,
|
"useApiHook": true,
|
||||||
"useApiHostProcess": false,
|
"useApiHostProcess": true,
|
||||||
"babelSetting": {
|
"babelSetting": {
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"disablePlugins": [],
|
"disablePlugins": [],
|
||||||
@ -37,10 +37,7 @@
|
|||||||
"packNpmManually": false,
|
"packNpmManually": false,
|
||||||
"packNpmRelationList": [],
|
"packNpmRelationList": [],
|
||||||
"minifyWXSS": true,
|
"minifyWXSS": true,
|
||||||
"disableUseStrict": false,
|
"showES6CompileOption": false
|
||||||
"minifyWXML": true,
|
|
||||||
"showES6CompileOption": false,
|
|
||||||
"useCompilerPlugins": false
|
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.15.0",
|
"libVersion": "2.15.0",
|
||||||
@ -48,6 +45,10 @@
|
|||||||
"projectname": "%E7%BB%88%E7%AB%AF%E5%B7%A5%E5%85%B7%E9%93%BE",
|
"projectname": "%E7%BB%88%E7%AB%AF%E5%B7%A5%E5%85%B7%E9%93%BE",
|
||||||
"simulatorType": "wechat",
|
"simulatorType": "wechat",
|
||||||
"simulatorPluginLibVersion": {},
|
"simulatorPluginLibVersion": {},
|
||||||
|
"editorSetting": {
|
||||||
|
"tabIndent": "insertSpaces",
|
||||||
|
"tabSize": 2
|
||||||
|
},
|
||||||
"condition": {
|
"condition": {
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": [
|
"list": [
|
||||||
@ -59,9 +60,5 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"editorSetting": {
|
|
||||||
"tabIndent": "insertSpaces",
|
|
||||||
"tabSize": 2
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"projectname": "%E7%BB%88%E7%AB%AF%E5%B7%A5%E5%85%B7%E9%93%BE",
|
"projectname": "%E7%BB%88%E7%AB%AF%E5%B7%A5%E5%85%B7%E9%93%BE",
|
||||||
"setting": {
|
"setting": {
|
||||||
"compileHotReLoad": true
|
"compileHotReLoad": false
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,6 +11,8 @@ var kit = {proto: function(sub, sup) { return sub.__proto__ = sup, sub },
|
|||||||
}
|
}
|
||||||
var ice = {
|
var ice = {
|
||||||
TB: "\t", SP: " ", DF: ":", EQ: "=", AT: "@", QS: "?", PS: "/", PT: ".", FS: ",", NL: "\n", LT: "<", GT: ">",
|
TB: "\t", SP: " ", DF: ":", EQ: "=", AT: "@", QS: "?", PS: "/", PT: ".", FS: ",", NL: "\n", LT: "<", GT: ">",
|
||||||
|
HTTP: "http", HELP: "help",
|
||||||
|
MAIN: "main", AUTO: "auto",
|
||||||
LIST: "list", BACK: "back",
|
LIST: "list", BACK: "back",
|
||||||
|
|
||||||
MSG_FIELDS: "fields", MSG_SESSID: "sessid",
|
MSG_FIELDS: "fields", MSG_SESSID: "sessid",
|
||||||
@ -27,8 +29,21 @@ var mdb = {
|
|||||||
KEY: "key", VALUE: "value", STATUS: "status", EXPIRE: "expire", EXTRA: "extra",
|
KEY: "key", VALUE: "value", STATUS: "status", EXPIRE: "expire", EXTRA: "extra",
|
||||||
DATA: "data", VIEW: "view", ORDER: "order",
|
DATA: "data", VIEW: "view", ORDER: "order",
|
||||||
}
|
}
|
||||||
|
var web = {
|
||||||
|
OPEN: "open", LINK: "link", HTTP: "http", DOMAIN: "domain", URL: "url",
|
||||||
|
}
|
||||||
|
var aaa = {
|
||||||
|
}
|
||||||
|
var tcp = {
|
||||||
|
}
|
||||||
var nfs = {
|
var nfs = {
|
||||||
DF: ice.DF, PS: ice.PS, PT: ice.PT,
|
DF: ice.DF, PS: ice.PS, PT: ice.PT,
|
||||||
|
CHAT_RIVER: "/chat/river/",
|
||||||
|
CHAT_ACTION: "/chat/action/",
|
||||||
|
}
|
||||||
|
var cli = {
|
||||||
|
}
|
||||||
|
var log = {
|
||||||
}
|
}
|
||||||
var code = {
|
var code = {
|
||||||
COMMENT: "comment", KEYWORD: "keyword",
|
COMMENT: "comment", KEYWORD: "keyword",
|
||||||
@ -37,8 +52,24 @@ var code = {
|
|||||||
META: "Meta", ALT: "Alt", CONTROL: "Control", SHIFT: "Shift", TAB: "Tab", ESCAPE: "Escape", ENTER: "Enter",
|
META: "Meta", ALT: "Alt", CONTROL: "Control", SHIFT: "Shift", TAB: "Tab", ESCAPE: "Escape", ENTER: "Enter",
|
||||||
CMD: "Cmd", CTRL: "Ctrl", SPACE: "Space", BACKSPACE: "Backspace", ESC: "Esc", PS: "/",
|
CMD: "Cmd", CTRL: "Ctrl", SPACE: "Space", BACKSPACE: "Backspace", ESC: "Esc", PS: "/",
|
||||||
}
|
}
|
||||||
|
var wiki = {
|
||||||
|
}
|
||||||
var chat = {
|
var chat = {
|
||||||
SHARE: "share", RIVER: "river", STORM: "storm", FIELD: "field", TOOL: "tool",
|
SHARE: "share", RIVER: "river", STORM: "storm", FIELD: "field", TOOL: "tool",
|
||||||
|
|
||||||
|
ONENGINE: "onengine", ONDAEMON: "ondaemon", ONAPPEND: "onappend", ONLAYOUT: "onlayout", ONMOTION: "onmotion", ONKEYMAP: "onkeymap",
|
||||||
|
ONIMPORT: "onimport", ONACTION: "onaction", ONDETAIL: "ondetail", ONEXPORT: "onexport",
|
||||||
|
ONSYNTAX: "onsyntax", ONFIGURE: "onfigure", ONPLUGIN: "onplugin",
|
||||||
|
|
||||||
|
WX_LOGIN_SESS: "/chat/wx/login/action/sess",
|
||||||
|
WX_LOGIN_USER: "/chat/wx/login/action/user",
|
||||||
|
WX_LOGIN_SCAN: "/chat/wx/login/action/scan",
|
||||||
|
PAGES_ACTION: "/pages/action/action",
|
||||||
|
PAGES_INSERT: "/pages/insert/insert",
|
||||||
|
}
|
||||||
|
var team = {
|
||||||
|
}
|
||||||
|
var mall = {
|
||||||
}
|
}
|
||||||
var http = {
|
var http = {
|
||||||
GET: "GET", PUT: "PUT", POST: "POST", DELETE: "DELETE",
|
GET: "GET", PUT: "PUT", POST: "POST", DELETE: "DELETE",
|
||||||
@ -49,8 +80,8 @@ var html = {
|
|||||||
}
|
}
|
||||||
module.exports = {
|
module.exports = {
|
||||||
kit, ice,
|
kit, ice,
|
||||||
ctx, mdb,
|
ctx, mdb, web, aaa,
|
||||||
nfs,
|
tcp, nfs, cli, log,
|
||||||
code, chat,
|
code, wiki, chat, team, mall,
|
||||||
http, html,
|
http, html,
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const {ice, mdb, nfs, code, http} = require("../const.js")
|
const {ice, mdb, web, nfs, code, http} = require("../const.js")
|
||||||
const {Volcanos} = require("../proto.js")
|
const {Volcanos} = require("../proto.js")
|
||||||
module.exports =
|
module.exports =
|
||||||
Volcanos("base", {
|
Volcanos("base", {
|
||||||
@ -15,12 +15,6 @@ Volcanos("base", {
|
|||||||
if (from[k] === "") { delete(to[k]) } else { to[k] = from[k] }
|
if (from[k] === "") { delete(to[k]) } else { to[k] = from[k] }
|
||||||
} return to } for (var i = 2; i < arguments.length; i++) { var k = arguments[i]; to[k] = from[k] } return to
|
} return to } for (var i = 2; i < arguments.length; i++) { var k = arguments[i]; to[k] = from[k] } return to
|
||||||
},
|
},
|
||||||
Eq: function(to, from, skip) { var call = arguments.callee; if (typeof to != typeof from) { return false }
|
|
||||||
if (typeof to == code.OBJECT) { if (to.length != from.length) { return false }
|
|
||||||
for (var i = 0; i < to.length; i++) { if (!call(to[i], from[i])) { return false } }
|
|
||||||
for (var k in to) { if (k != skip && !call(to[k], from[k])) { return false } } return true
|
|
||||||
} return to === from
|
|
||||||
},
|
|
||||||
Args: function() { var res = [], arg = arguments; function encode(k, v) { k && v != undefined && v != null && res.push(encodeURIComponent(k)+mdb.EQ+encodeURIComponent(v)) }
|
Args: function() { var res = [], arg = arguments; function encode(k, v) { k && v != undefined && v != null && res.push(encodeURIComponent(k)+mdb.EQ+encodeURIComponent(v)) }
|
||||||
for (var i = 0; i < arg.length; i += 2) { if (typeof arg[i] == code.OBJECT) {
|
for (var i = 0; i < arg.length; i += 2) { if (typeof arg[i] == code.OBJECT) {
|
||||||
if (arg[i].length > 0) { for (var j = 0; j < arg[i].length; j += 2) { encode(arg[i][j], arg[i][j+1]) } } else { for (var k in arg[i]) { encode(k, arg[i][k]) } } i--
|
if (arg[i].length > 0) { for (var j = 0; j < arg[i].length; j += 2) { encode(arg[i][j], arg[i][j+1]) } } else { for (var k in arg[i]) { encode(k, arg[i][k]) } } i--
|
||||||
@ -33,9 +27,12 @@ Volcanos("base", {
|
|||||||
MergeURL: function(url) { var arg = this._parse(url); delete(arg._origin); for (var i = 1; i < arguments.length; i += 2) { delete(arg[arguments[i]]) }
|
MergeURL: function(url) { var arg = this._parse(url); delete(arg._origin); for (var i = 1; i < arguments.length; i += 2) { delete(arg[arguments[i]]) }
|
||||||
var arg = this.Args.apply(this, [arg].concat(Array.prototype.slice.call(arguments, 1))); return url.split(ice.QS)[0]+(arg? ice.QS+arg: "")
|
var arg = this.Args.apply(this, [arg].concat(Array.prototype.slice.call(arguments, 1))); return url.split(ice.QS)[0]+(arg? ice.QS+arg: "")
|
||||||
},
|
},
|
||||||
Number: function(d, n) { var res = []
|
ParseJSON: function(str) { var res; if (typeof str == code.OBJECT) { return str }
|
||||||
while (d > 0) { res.push(d%10); d = parseInt(d/10); n-- } while (n > 0) { res.push("0"); n-- }
|
if (str.indexOf(ice.HTTP) == 0) {
|
||||||
return res.reverse(), res.join("")
|
var res = this._parse(str, {type: web.LINK, name: "", text: str})
|
||||||
|
return res.name = res._origin.split("://").pop().split(nfs.PS)[0], res
|
||||||
|
}
|
||||||
|
try { res = JSON.parse(str), res.text = res.text||str, res.type = res.type||nfs.JSON } catch (e) { res = {type: mdb.TEXT, text: str} } return res
|
||||||
},
|
},
|
||||||
Simple: function() { var res = []; for (var i = 0; i < arguments.length; i++) { var val = arguments[i]; switch (typeof val) {
|
Simple: function() { var res = []; for (var i = 0; i < arguments.length; i++) { var val = arguments[i]; switch (typeof val) {
|
||||||
case code.OBJECT: if (val.length > 0) { res = res.concat(val); break }
|
case code.OBJECT: if (val.length > 0) { res = res.concat(val); break }
|
||||||
@ -47,21 +44,6 @@ Volcanos("base", {
|
|||||||
if (typeof arg[i] == code.OBJECT && arg[i].length > 0 && arg[i].indexOf(item) > -1) { return true }
|
if (typeof arg[i] == code.OBJECT && arg[i].length > 0 && arg[i].indexOf(item) > -1) { return true }
|
||||||
if (item == arg[i]) { return true }
|
if (item == arg[i]) { return true }
|
||||||
} },
|
} },
|
||||||
Time: function(t, fmt) {var now = t? new Date(t): new Date();
|
|
||||||
fmt = fmt || "%y-%m-%d %H:%M:%S";
|
|
||||||
fmt = fmt.replace("%y", now.getFullYear())
|
|
||||||
fmt = fmt.replace("%m", Number(now.getMonth()+1, 2))
|
|
||||||
fmt = fmt.replace("%d", Number(now.getDate(), 2))
|
|
||||||
fmt = fmt.replace("%H", Number(now.getHours(), 2))
|
|
||||||
fmt = fmt.replace("%M", Number(now.getMinutes(), 2))
|
|
||||||
fmt = fmt.replace("%S", Number(now.getSeconds(), 2))
|
|
||||||
return fmt
|
|
||||||
},
|
|
||||||
ParseJSON: function(str) { var res; if (typeof str == code.OBJECT) { return str }
|
|
||||||
if (str.indexOf(ice.HTTP) == 0) { var res = this._parse(str, {type: web.LINK, name: "", text: str}); return res.name = res._origin.split("://").pop().split(nfs.PS)[0], res }
|
|
||||||
try { res = JSON.parse(str), res.text = res.text||str, res.type = res.type||nfs.JSON } catch (e) { res = {type: mdb.TEXT, text: str} } return res
|
|
||||||
},
|
|
||||||
isNumber: function(val) { return typeof val == code.NUMBER },
|
|
||||||
isString: function(val) { return typeof val == code.STRING },
|
isString: function(val) { return typeof val == code.STRING },
|
||||||
isObject: function(val) { return typeof val == code.OBJECT },
|
isObject: function(val) { return typeof val == code.OBJECT },
|
||||||
isArray: function(val) { return Array.isArray(val) },
|
isArray: function(val) { return Array.isArray(val) },
|
||||||
|
@ -3,13 +3,6 @@ const {Volcanos} = require("../proto.js")
|
|||||||
module.exports =
|
module.exports =
|
||||||
Volcanos("misc", {
|
Volcanos("misc", {
|
||||||
Message: function(event, can) { var msg = kit.proto({}, {_event: event, _can: can, _target: can._target,
|
Message: function(event, can) { var msg = kit.proto({}, {_event: event, _can: can, _target: can._target,
|
||||||
Display: function(file) { return msg.Option(ice.MSG_DISPLAY, file) },
|
|
||||||
DisplayStory: function(file) { return msg.Option(ice.MSG_DISPLAY, chat.PLUGIN_STORY+file) },
|
|
||||||
SearchOrOption: function(key) { return can.misc.Search(can, key)||msg.Option(key) },
|
|
||||||
OptionProcess: function() { return msg.Option(ice.MSG_PROCESS) },
|
|
||||||
OptionStatus: function() { return msg.Option(ice.MSG_STATUS) },
|
|
||||||
StatusTimeCount: function(obj) { msg.append && msg.Status(can.base.Copy(kit.Dict(mdb.TIME, can.base.Time(), mdb.COUNT, msg.Length()+"x"+msg.append.length), obj)) },
|
|
||||||
Status: function(obj) { return msg.Option(ice.MSG_STATUS, JSON.stringify(can.core.Item(obj, function(key, value) { return {name: key, value: value} }))) },
|
|
||||||
OptionDefault(key, val) { var arg = arguments; for (var i = 0; i < arg.length; i += 2) { msg.Option(arg[i]) || msg.Option(arg[i], arg[i+1]) } return msg.Option(key) },
|
OptionDefault(key, val) { var arg = arguments; for (var i = 0; i < arg.length; i += 2) { msg.Option(arg[i]) || msg.Option(arg[i], arg[i+1]) } return msg.Option(key) },
|
||||||
Option: function(key, val) { if (key == undefined) { return msg.option || [] }
|
Option: function(key, val) { if (key == undefined) { return msg.option || [] }
|
||||||
if (can.base.isObject(key)) { return can.core.Item(key, msg.Option) }
|
if (can.base.isObject(key)) { return can.core.Item(key, msg.Option) }
|
||||||
@ -24,9 +17,7 @@ Volcanos("misc", {
|
|||||||
Result: function() { if (!msg.result) { return "" } return msg.result[0] == ice.ErrWarn? msg.result.join(lex.SP): msg.result.join("") },
|
Result: function() { if (!msg.result) { return "" } return msg.result[0] == ice.ErrWarn? msg.result.join(lex.SP): msg.result.join("") },
|
||||||
Results: function() { return msg.result && msg.result[0] == ice.ErrWarn? "": msg.Result() },
|
Results: function() { return msg.result && msg.result[0] == ice.ErrWarn? "": msg.Result() },
|
||||||
TableDetail: function() { var item = can.Option(); return msg.Table(function(value) { can.core.Value(item, value.key, value.value) }), item },
|
TableDetail: function() { var item = can.Option(); return msg.Table(function(value) { can.core.Value(item, value.key, value.value) }), item },
|
||||||
IsDetail: function() {
|
IsDetail: function() { return msg.Option(ice.MSG_FIELDS) == "detail" || msg.append && msg.append.length == 2 && msg.append[0] == mdb.KEY && msg.append[1] == mdb.VALUE },
|
||||||
return msg.Option("fields") == "detail" || msg.append && msg.append.length == 2 && msg.append[0] == "key" && msg.append[1] == "value"
|
|
||||||
},
|
|
||||||
Table: function(cb) { return can.core.List(msg.Length(), function(index) { var item = {}
|
Table: function(cb) { return can.core.List(msg.Length(), function(index) { var item = {}
|
||||||
can.core.List(msg.append, function(k) { item[k] = msg[k]&&msg[k][index]||"" })
|
can.core.List(msg.append, function(k) { item[k] = msg[k]&&msg[k][index]||"" })
|
||||||
return can.base.isFunc(cb)? cb(item, index): item
|
return can.base.isFunc(cb)? cb(item, index): item
|
||||||
@ -58,17 +49,6 @@ Volcanos("misc", {
|
|||||||
msg.Push(ctx.ACTION, can.page.Format(html.INPUT, "", mdb.TYPE, html.BUTTON, mdb.NAME, button, mdb.VALUE, can.user.trans(can, button)))
|
msg.Push(ctx.ACTION, can.page.Format(html.INPUT, "", mdb.TYPE, html.BUTTON, mdb.NAME, button, mdb.VALUE, can.user.trans(can, button)))
|
||||||
}); return msg },
|
}); return msg },
|
||||||
Echo: function(res) { msg.result = (msg.result||[]).concat(can.core.List(arguments)); return msg._hand = true, msg },
|
Echo: function(res) { msg.result = (msg.result||[]).concat(can.core.List(arguments)); return msg._hand = true, msg },
|
||||||
Dump: function(can) { can = can||msg._can; if (can.user.isNodejs) { return }
|
|
||||||
can.onmotion.clear(can), can.onappend.table(can, msg), can.onappend.board(can, msg), can.onmotion.story.auto(can)
|
|
||||||
},
|
|
||||||
Defer: function(cb) { msg._defer = msg._defer||[]
|
|
||||||
if (arguments.length == 0) { msg._defer = can.core.List(msg._defer.reverse(), function(cb) { can.base.isFunc(cb) && cb() }) } else { msg._defer.push(cb) }
|
|
||||||
},
|
|
||||||
IsErr: function() {
|
|
||||||
return msg.result && msg.result[0] == "warn: "
|
|
||||||
},
|
|
||||||
_caller: function(skip) { msg.Option("log.caller") || msg.Option("log.caller", can.misc.fileLine((skip||2)+3).link); return msg },
|
|
||||||
isDebug: function() { return msg.Option(log.DEBUG) == ice.TRUE },
|
|
||||||
}); return msg },
|
}); return msg },
|
||||||
requests: function(can, msg, cmd, data, cb) {
|
requests: function(can, msg, cmd, data, cb) {
|
||||||
wx.showLoading(), can.misc.request(can, msg, cmd, data, function(msg) { wx.hideLoading(), cb && cb(msg) })
|
wx.showLoading(), can.misc.request(can, msg, cmd, data, function(msg) { wx.hideLoading(), cb && cb(msg) })
|
||||||
@ -77,7 +57,8 @@ Volcanos("misc", {
|
|||||||
wx.request({method: http.POST, url: can.conf.serve+cmd, data: data, success: function(res) {
|
wx.request({method: http.POST, url: can.conf.serve+cmd, data: data, success: function(res) {
|
||||||
if (res.statusCode == 401) {
|
if (res.statusCode == 401) {
|
||||||
can.user.info = {}, can.misc.localStorage(can, ice.MSG_SESSID, can.conf.sessid = "")
|
can.user.info = {}, can.misc.localStorage(can, ice.MSG_SESSID, can.conf.sessid = "")
|
||||||
return can.user.login(can, function() { can.misc.request(can, msg, cmd, data, cb) }) }
|
return can.user.login(can, function() { can.misc.request(can, msg, cmd, data, cb) })
|
||||||
|
}
|
||||||
msg.Copy(res.data), console.log("request", cmd, data.cmds||data, msg)
|
msg.Copy(res.data), console.log("request", cmd, data.cmds||data, msg)
|
||||||
msg.Data = function(item, index) {
|
msg.Data = function(item, index) {
|
||||||
var text = msg[item]&&msg[item][index]||""
|
var text = msg[item]&&msg[item][index]||""
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
const {ice, mdb, nfs, code, http} = require("../const.js")
|
const {shy, Volcanos} = require("../proto.js")
|
||||||
const {Volcanos} = require("../proto.js")
|
|
||||||
module.exports =
|
module.exports =
|
||||||
Volcanos("page", {
|
Volcanos("page", {
|
||||||
setData: function(can, list) {
|
setData: function(can, list) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const {ice, mdb, nfs, code, http} = require("../const.js")
|
const {ice, ctx, mdb, chat} = require("../const.js")
|
||||||
const {Volcanos} = require("../proto.js")
|
const {shy, Volcanos} = require("../proto.js")
|
||||||
module.exports =
|
module.exports =
|
||||||
Volcanos("user", {
|
Volcanos("user", {
|
||||||
agent: {
|
agent: {
|
||||||
@ -24,42 +24,34 @@ Volcanos("user", {
|
|||||||
case "auth":
|
case "auth":
|
||||||
can.user.userinfo(can, function() {
|
can.user.userinfo(can, function() {
|
||||||
can.user.modal(can, "授权登录", data.name, function(res) {
|
can.user.modal(can, "授权登录", data.name, function(res) {
|
||||||
res.confirm && can.misc.request(can, can.request(), "/chat/wx/login/action/scan", data, function(msg) {
|
res.confirm && can.misc.request(can, can.request(), chat.WX_LOGIN_SCAN, data, function(msg) {
|
||||||
can.user.toast(can, "授权成功")
|
can.user.toast(can, "授权成功")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
default: can.misc.request(can, can.request(), "/chat/wx/login/action/scan", data)
|
default: can.misc.request(can, can.request(), chat.WX_LOGIN_SCAN, data)
|
||||||
}
|
}
|
||||||
}})
|
}})
|
||||||
},
|
},
|
||||||
}, info: {},
|
}, info: {},
|
||||||
jumps: function(url, cb) {
|
jumps: function(url, cb) { wx.navigateTo({url: url, success: cb}) },
|
||||||
wx.navigateTo({url: url, success: cb})
|
title: function(text, cb) { text && wx.setNavigationBarTitle({title: text, success: cb}) },
|
||||||
},
|
toast: function(can, content, title) { wx.showToast({title: title, content: content||""}) },
|
||||||
title: function(text, cb) {
|
modal: function(can, content, title, cb) { wx.showModal({title: title||"", content: content||"", success: cb}) },
|
||||||
text && wx.setNavigationBarTitle({title: text, success: cb})
|
|
||||||
},
|
|
||||||
toast: function(can, content, title) {
|
|
||||||
wx.showToast({title: title, content: content||""})
|
|
||||||
},
|
|
||||||
modal: function(can, content, title, cb) {
|
|
||||||
wx.showModal({title: title||"", content: content||"", success: cb})
|
|
||||||
},
|
|
||||||
login: function(can, cb) {
|
login: function(can, cb) {
|
||||||
can.conf.sessid = can.conf.sessid||can.misc.localStorage(can, ice.MSG_SESSID)
|
can.conf.sessid = can.conf.sessid||can.misc.localStorage(can, ice.MSG_SESSID)
|
||||||
if (can.conf.sessid) { return cb && cb() }
|
if (can.conf.sessid) { return cb && cb() }
|
||||||
wx.login({success: function(res) { can.misc.request(can, can.request(), "/chat/wx/login/action/sess", {code: res.code}, function(msg) {
|
wx.login({success: function(res) { can.misc.request(can, can.request(), chat.WX_LOGIN_SESS, {code: res.code}, function(msg) {
|
||||||
wx.setStorage({key: ice.MSG_SESSID, data: can.conf.sessid = msg.Result()}), cb && cb()
|
wx.setStorage({key: ice.MSG_SESSID, data: can.conf.sessid = msg.Result()}), cb && cb()
|
||||||
}) }})
|
}) }})
|
||||||
},
|
},
|
||||||
userinfo: function(can, cb) {
|
userinfo: function(can, cb) {
|
||||||
can.user.info.userNick? can.misc.request(can, can.request(), "/chat/wx/login/action/user", {}, function(msg) {
|
can.user.info.userNick? can.misc.request(can, can.request(), chat.WX_LOGIN_USER, {}, function(msg) {
|
||||||
cb && cb(can.user.info)
|
cb && cb(can.user.info)
|
||||||
}): can.user.login(can, function() { wx.getSetting({success: function(res) {
|
}): can.user.login(can, function() { wx.getSetting({success: function(res) {
|
||||||
res.authSetting['scope.userInfo'] && wx.getUserInfo({success: function(res) {
|
res.authSetting['scope.userInfo'] && wx.getUserInfo({success: function(res) {
|
||||||
can.misc.request(can, can.request(), "/chat/wx/login/action/user", can.user.info = res.userInfo, function(msg) {
|
can.misc.request(can, can.request(), chat.WX_LOGIN_USER, can.user.info = res.userInfo, function(msg) {
|
||||||
cb && cb(can.user.info)
|
cb && cb(can.user.info)
|
||||||
})
|
})
|
||||||
}})
|
}})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const {ctx, code, chat} = require("const.js")
|
const {ctx, nfs, code, chat} = require("const.js")
|
||||||
|
|
||||||
function shy(help, meta, list, cb) { var arg = arguments, i = 0; function next(type) {
|
function shy(help, meta, list, cb) { var arg = arguments, i = 0; function next(type) {
|
||||||
if (type == code.OBJECT) { if (typeof arg[i] == code.OBJECT && arg[i].length == undefined) { return arg[i++] }
|
if (type == code.OBJECT) { if (typeof arg[i] == code.OBJECT && arg[i].length == undefined) { return arg[i++] }
|
||||||
@ -25,14 +25,14 @@ Volcanos._init = function() {
|
|||||||
}); return msg
|
}); return msg
|
||||||
},
|
},
|
||||||
run: function(event, cmds, cb) {
|
run: function(event, cmds, cb) {
|
||||||
can.misc.requests(can, can.request(event), can.onaction._name||"/chat/action/", {cmds: cmds}, function(msg) {
|
can.misc.requests(can, can.request(event), can.onaction._name||nfs.CHAT_ACTION, {cmds: cmds}, function(msg) {
|
||||||
msg.Dump = function() { can.ui.setData({list: msg.Table()}) }, cb(msg)
|
msg.Dump = function() { can.ui.setData({list: msg.Table()}) }, cb(msg)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}; Volcanos._page.__proto__ = getApp(), delete(Volcanos._page)
|
}; Volcanos._page.__proto__ = getApp(), delete(Volcanos._page)
|
||||||
var page = {data: {action: can.onaction.list, list: []},
|
var page = {data: {action: can.onaction.list, list: []},
|
||||||
onLoad: function(options) { can.ui = this, can.db = options
|
onLoad: function(options) { can.ui = this, can.db = options
|
||||||
console.log(can.ui.route, options)
|
console.log("app show", can.ui.route, options)
|
||||||
can.user.title(decodeURIComponent(options.title||""))
|
can.user.title(decodeURIComponent(options.title||""))
|
||||||
can.user.login(can, function() {
|
can.user.login(can, function() {
|
||||||
if (can.onaction.refresh) {
|
if (can.onaction.refresh) {
|
||||||
@ -51,7 +51,6 @@ Volcanos._init = function() {
|
|||||||
onShareAppMessage: function() {}
|
onShareAppMessage: function() {}
|
||||||
}
|
}
|
||||||
can.core.ItemCB(can.onaction, function(key, cb) { page[key] = function(event) {
|
can.core.ItemCB(can.onaction, function(key, cb) { page[key] = function(event) {
|
||||||
// can.core.CallFunc(cb, {event: event, can: can, msg: can.request(event, event.target.dataset)})
|
|
||||||
can.core.CallFunc(cb, [event, can, key, event.target.dataset])
|
can.core.CallFunc(cb, [event, can, key, event.target.dataset])
|
||||||
} }), Page(page)
|
} }), Page(page)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user