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

add wx.ide

This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-11-20 22:33:20 +08:00
parent fb8c552161
commit 25c2e34512
15 changed files with 182 additions and 148 deletions

View File

@ -26,6 +26,7 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
if (sub._daemon) { msg.Option(ice.MSG_DAEMON, can.core.Keys(can.ondaemon._list[0], sub._daemon)) } if (sub._daemon) { msg.Option(ice.MSG_DAEMON, can.core.Keys(can.ondaemon._list[0], sub._daemon)) }
} can.base.isIn(sub.ConfIndex(), "qrcode", "cli.qrcode") && can.page.exportValue(sub, msg) } can.base.isIn(sub.ConfIndex(), "qrcode", "cli.qrcode") && can.page.exportValue(sub, msg)
if (!can.misc.CookieSessid(can) && can.user.info.sessid) { msg.Option(ice.MSG_SESSID, can.user.info.sessid) } if (!can.misc.CookieSessid(can) && can.user.info.sessid) { msg.Option(ice.MSG_SESSID, can.user.info.sessid) }
msg.OptionDefault(ice.MSG_THEME, can.getHeaderTheme())
var names = msg.Option(chat._NAMES)||panel._names||((can.Conf("iceberg")||Volcanos.meta.iceberg)+"/chat/"+panel._name+"/") var names = msg.Option(chat._NAMES)||panel._names||((can.Conf("iceberg")||Volcanos.meta.iceberg)+"/chat/"+panel._name+"/")
names = can.base.MergeURL(names, ice.MSG_INDEX, sub.ConfIndex(), ice.MSG_LANGUAGE, can.user.info.language, ice.MSG_THEME, can.getHeader(chat.THEME)) names = can.base.MergeURL(names, ice.MSG_INDEX, sub.ConfIndex(), ice.MSG_LANGUAGE, can.user.info.language, ice.MSG_THEME, can.getHeader(chat.THEME))
can.onengine.signal(panel, chat.ONREMOTE, can.request({}, {_follow: panel._follow, _msg: msg, _cmds: cmds, names: names})) can.onengine.signal(panel, chat.ONREMOTE, can.request({}, {_follow: panel._follow, _msg: msg, _cmds: cmds, names: names}))

View File

@ -12,47 +12,6 @@
</view> </view>
</template> </template>
<template name="list">
<view class="output">
<view class="item" wx:for="{{list}}" wx:key="index">
<view class="item" bindtap="ondetail" data-index="{{index}}">{{item.name}}</view>
<view class="list" wx:if="{{item._show}}">
<view class="item" wx:for="{{item.list}}" wx:for-index="i" wx:key="i" bindtap="onchange" data-index="{{index}}" data-i="{{i}}">{{item.name}}</view>
</view>
</view>
</view>
</template>
<template name="field">
<view class="output">
<view class="field" wx:for="{{list}}" wx:for-index="order" wx:for-item="field" wx:key="index">
<view class="legend"><text>{{field.name}}({{field.help}})</text></view>
<view class="option"> <!-- 参数 -->
<view class="item {{item.type}}" wx:for="{{field.inputs}}" wx:key="name">
<!-- 文本 -->
<textarea wx:if="{{item.type == 'textarea'}}" placeholder="{{item.name}}" value="{{item.value}}"
bindinput="onInputs" data-index="{{index}}" data-order="{{order}}"></textarea>
<!-- 文本 -->
<input wx:elif="{{item.type == 'text'}}" placeholder="{{item.placeholder||item.name}}" value="{{item.value}}" type="text"
bindinput="onInputs" data-index="{{index}}" data-order="{{order}}"/>
<!-- 列表 -->
<picker wx:elif="{{item.type == 'select'}}" range="{{item.values}}" value="{{item.index||0}}"
bindchange="onChange" data-index="{{index}}" data-order="{{order}}">{{item.value||item.values[item.index||0]}}</picker>
<!-- 按钮 -->
<button wx:elif="{{item.type == 'button'}}" size="mini"
bindtap="onAction" data-index="{{index}}" data-order="{{order}}" data-name="{{item.name}}">{{item.value||item.name}}</button>
</view>
</view>
<view class="output"> <!-- 输出 -->
<!-- 表格 -->
<template is="table" data="{{order: order, msg: field.msg}}"></template>
<!-- 文本 -->
<view class="code"><rich-text wx:for="{{field.msg.result}}" wx:key="index" nodes="{{item}}"></rich-text></view>
</view>
</view>
</view>
</template>
<template name="table"> <template name="table">
<table class="{{msg._style}}" wx:if="{{msg}}"> <table class="{{msg._style}}" wx:if="{{msg}}">

View File

@ -10,19 +10,24 @@ page {
page { padding:10px; } page { padding:10px; }
page, view { box-sizing: border-box; } page, view { box-sizing: border-box; }
view.debug { font-family:monospace; font-style:italic; padding:10px; clear:both; } view.debug { font-family:monospace; font-style:italic; padding:10px; clear:both; }
view.action view.item { float:left; }
view.action view.item.button { margin-right:5px; }
view.output { width:100%; overflow:auto; clear:both; } view.output { width:100%; overflow:auto; clear:both; }
view.output textarea { width:100%; }
view.output view.item { font-size:18px; text-align:center; padding:10px; border:var(--box-border); } view.output view.item { font-size:18px; text-align:center; padding:10px; border:var(--box-border); }
view.output view.list view.item { margin-left:20px; } view.output view.list view.item { margin-left:20px; }
view.legend { font-size:18px; font-weight:bold; margin:10px 0; } view.legend { font-size:18px; font-weight:bold; margin:10px 0; }
view.action view.item { padding:0; border:0; margin-right:5px; float:left; }
view.option view.item { padding:0; border:0; margin-right:5px; float:left; } view.option view.item { padding:0; border:0; margin-right:5px; float:left; }
view.option view.item.textarea { border:var(--box-border); width:calc(100% - 2px); clear:both; } view.option view.item.textarea { border:var(--box-border); width:calc(100% - 2px); clear:both; }
view.option view.item.select { border:var(--box-border); } view.option view.item.select { border:var(--box-border); }
view.option view.item picker { border:var(--box-border); height:30px; min-width:80px; } view.option view.item picker { border:var(--box-border); height:30px; width:80px; }
view.option view.item input { border:var(--box-border); height:30px; min-width:80px; } view.option view.item input { border:var(--box-border); height:30px; width:80px; }
view.option view.item button { height:32px; } view.option view.item button { height:32px; }
view.output view.code { white-space:pre; padding:10px; border-left:cyan solid 2px; } view.output view.code { white-space:pre; padding:10px; border-left:cyan solid 2px; }
view.status view.item { font-size:12px; font-style:italic; padding:5px; border:none; margin:0; float:left; }
view.status view.item text.name { font-size:10px; }
view.action.submit view.item { margin-right:0; }
table { display:table; border-collapse:collapse; } table { display:table; border-collapse:collapse; }
tr { display:table-row; } tr { display:table-row; }
th { display:table-cell; padding:5px; border:var(--box-border); vertical-align:middle; text-align:center; } th { display:table-cell; padding:5px; border:var(--box-border); vertical-align:middle; text-align:center; }
@ -30,4 +35,3 @@ td { display:table-cell; padding:5px; border:var(--box-border); vertical-align:m
td view.which { padding:0; order:0; } td view.which { padding:0; order:0; }
table.content.action th:last-child { position:sticky; right:2px; text-align:center; min-width:60px; } table.content.action th:last-child { position:sticky; right:2px; text-align:center; min-width:60px; }
table.content.action td:last-child { position:sticky; right:2px; text-align:center; min-width:60px; } table.content.action td:last-child { position:sticky; right:2px; text-align:center; min-width:60px; }
picker { min-width:80px; }

View File

@ -1,16 +1,18 @@
const {ice, ctx, mdb, chat, html} = require("../../utils/const.js") const {ice, ctx, mdb, code, chat, html} = require("../../utils/const.js")
const {shy, Volcanos} = require("../../utils/proto.js") const {shy, Volcanos} = require("../../utils/proto.js")
Volcanos._page = {} Volcanos._page = {}
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.ui.data.list = [] _init: function(can, msg) { can.ui.data.list = []
msg.Table(function(value, index) { can.ui.data.list.push(value) msg.Table(function(field, order) { can.ui.data.list.push(field)
value.feature = can.base.Obj(value.meta, {}) field.feature = can.base.Obj(field.meta, {})
value.inputs = can.base.Obj(value.list, []) field.inputs = can.base.Obj(field.list, [])
value.name = can.core.Split(value.name)[0] field.name = can.core.Split(field.name)[0]
if (!value.inputs || value.inputs.length === 0) { if (!field.inputs || field.inputs.length === 0) {
value.inputs = [{type: html.TEXT}, {type: html.BUTTON, name: ctx.RUN}] return can.core.Timer(30, function() {
can.onaction._refresh({}, can, order)
})
} }
can.core.List(value.inputs, function(input) { can.core.List(field.inputs, function(input) {
input.action = input.action || input.value input.action = input.action || input.value
input.value == ice.AUTO && (input.value = "") input.value == ice.AUTO && (input.value = "")
if (input.value && input.value.indexOf("@") == 0) { if (input.value && input.value.indexOf("@") == 0) {
@ -20,13 +22,15 @@ Volcanos(chat.ONIMPORT, {
input.values = input.values || can.core.Split(input.value) input.values = input.values || can.core.Split(input.value)
} }
if (input.type == html.TEXT) { if (input.type == html.TEXT) {
input.placeholder = can.user.trans(can, input.placeholder||input.name, can.core.Value(value, "feature._trans"), html.INPUT) input.placeholder = can.user.trans(can, input.placeholder||input.name, can.core.Value(field, "feature._trans"), html.INPUT)
} }
if (input.type == html.BUTTON) { if (input.type == html.BUTTON) {
input.value = can.user.trans(can, input.value||input.name, can.core.Value(value, "feature._trans")) input.value = can.user.trans(can, input.value||input.name, can.core.Value(field, "feature._trans"))
} else {
if (can.db.cmd||can.db.index) { input.value = input.value||can.db[input.name] }
} }
input.type == html.BUTTON && input.action == ice.AUTO && can.core.Timer(100, function() { input.type == html.BUTTON && input.action == ice.AUTO && can.core.Timer(30, function() {
can.onaction.onAction({}, can, ice.LIST, {order: index, name: ice.LIST}) can.onaction._refresh({}, can, order)
}) })
}) })
}), can.page.setData(can), can.user.toast(can, "加载成功") }), can.page.setData(can), can.user.toast(can, "加载成功")
@ -36,13 +40,19 @@ 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) { can.core.List(can.ui.data.list, function(item) { delete(item.msg) }), can.page.setData(can) }, "清屏": function(event, can) { can.core.List(can.ui.data.list, function(item) { delete(item.msg) }), can.page.setData(can) },
refresh: function(event, can) { _refresh: function(event, can, order) { can.page.setData(can)
if (can.db.cmd||can.db.index) { can.onaction._cmds = [] can.onaction.onAction({}, can, ice.LIST, {order: order, name: ice.LIST})
},
refresh: function(event, can) { can.onaction._apis = "", can.onaction._cmds = []
if (can.db.share) { can.onaction._apis = "/share/"+can.db.share
can.run(event, [ctx.ACTION, ctx.COMMAND], function(msg) {
can.onaction._cmds = [ctx.ACTION, ctx.RUN], can.onimport._init(can, msg)
})
} else if (can.db.cmd||can.db.index) {
can.run(event, [ctx.ACTION, ctx.COMMAND, can.db.cmd||can.db.index], function(msg) { can.run(event, [ctx.ACTION, ctx.COMMAND, can.db.cmd||can.db.index], function(msg) {
can.onaction._cmds = [ctx.ACTION, ctx.RUN], can.onimport._init(can, msg) can.onaction._cmds = [ctx.ACTION, ctx.RUN], can.onimport._init(can, msg)
}) })
} else { } else { can.onaction._cmds = [can.db.river, can.db.storm]
can.onaction._cmds = [can.db.river, can.db.storm]
can.run(event, [], function(msg) { can.onimport._init(can, msg) }) can.run(event, [], function(msg) { can.onimport._init(can, msg) })
} }
}, },
@ -56,68 +66,62 @@ Volcanos(chat.ONACTION, {list: ["刷新", "扫码", "清屏"],
onChange: function(event, can, button, data) { var order = data.order, index = data.index onChange: function(event, can, button, data) { var order = data.order, index = data.index
var input = can.ui.data.list[order||0].inputs[index||0] var input = can.ui.data.list[order||0].inputs[index||0]
input.value = input.values[parseInt(event.detail.value)] input.value = input.values[parseInt(event.detail.value)]
can.onaction.onAction({}, can, ice.LIST, {order: index, name: ice.LIST}) can.onaction._refresh(event, can, order)
}, },
onAction: function(event, can, button, data) { var order = data.order, name = data.name onAction: function(event, can, button, data) { var order = data.order, name = data.name
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) { return can.data.insert = {field: field, name: name, list: field.feature[name], cb: function(res) {
can.run(event, can.base.Simple([field.id||field.index, ctx.ACTION, name], res), function(msg) { can.run(event, can.base.Simple([field.id||field.index, ctx.ACTION, name], res), function(msg) {
can.onaction.onAction(event, can, ice.LIST, {order: order, name: ice.LIST}) can.onaction._refresh(event, can, order)
}) })
}} }}, can.user.jumps(chat.PAGES_INSERT)
can.user.jumps(chat.PAGES_INSERT, {river: can.db.river, storm: can.db.storm, index: field.id||field.index, serve: can.db.serve, space: can.db.space})
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) { if (input.type != html.BUTTON) { input.value = ls[i++]||"" } }) can.core.List(field.inputs, function(input) { 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.onaction._refresh(event, can, order)
break break
case ctx.RUN: case ctx.RUN:
case ice.LIST: case ice.LIST:
case "refresh": break case "refresh": break
default: return default: m.Option(ctx.ACTION, name)
} }
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 } })
for (var i = cmd.length-1; i > 0; i--) { if (cmd[i] === "") { cmd.pop() } else { break } } for (var i = cmd.length-1; i > 0; i--) { if (cmd[i] === "") { cmd.pop() } else { break } }
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++) { if (to[i] != from[i]) { return false } } return true
for (var i = 0; i < to.length; i++) { if (to[i] != from[i]) { return false } }
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)
can.run(event, [field.id||field.index].concat(cmd), function(msg) { can.run(event, [field.id||field.index].concat(cmd), function(msg) {
msg._head = can.core.List(msg.append, function(item) { msg._head = can.core.List(msg.append, function(item) { return can.user.trans(can, item, can.core.Value(field, "feature._trans"), html.INPUT) })
return can.user.trans(can, item, can.core.Value(field, "feature._trans"), html.INPUT) can.core.Item(msg._view, function(key, value) { can.core.List(value, function(value) { can.core.List(value, function(input, i) {
}) if (input.type == html.BUTTON) { input.value = can.user.trans(can, input.value||input.name, can.core.Value(field, "feature._trans")) }
can.core.Item(msg._view, function(key, value) { can.core.List(value, function(value, index) { can.core.List(value, function(input, i) { if (input._type == html.TEXT) { input._text = can.user.trans(can, input._text, can.core.Value(field, "feature._trans"), html.VALUE) }
if (input.type == html.BUTTON) {
input.value = can.user.trans(can, input.value||input.name, can.core.Value(field, "feature._trans"))
}
if (input._type == html.TEXT) {
input._text = can.user.trans(can, input._text, can.core.Value(field, "feature._trans"), html.VALUE)
}
}) }) }) }) }) })
msg._status = can.core.List(can.base.Obj(msg.Option(ice.MSG_STATUS)), function(item) { return item.name = can.user.trans(can, item.name), can.user.trans(can, item, html.INPUT) })
msg._action = can.core.List(can.base.Obj(msg.Option(ice.MSG_ACTION)), function(item) {
if (typeof item == code.STRING) { return {type: html.BUTTON, name: item, value: can.user.trans(can, item)} }
return item.value = can.user.trans(can, item.value||item.name), item
})
field.msg = msg, can.page.setData(can) field.msg = msg, can.page.setData(can)
}) })
}, },
onDetail: function(event, can, button, data) { var order = data.order, name = data.name, value = data.value, input = data.input onDetail: function(event, can, button, data) { var order = data.order, name = data.name, value = data.value, input = data.input
var field = can.ui.data.list[order||0] var field = can.ui.data.list[order||0]
if (input && input.type == html.BUTTON) { can.request(event, field.msg.Table()[data.index]) if (input && input.type == html.BUTTON) { can.request(event, field.msg.Table()[data.index])
var _input = {}; can.core.List(field.inputs, function(input) { if (input.type != html.BUTTON) { _input[input.name] = input.value } }), can.request(event, _input)
if (field.feature[input.name]) { if (field.feature[input.name]) {
can.onAction(event, can, input.name, {order: order, name: input.name}) can.onAction(event, can, input.name, {order: order, name: input.name})
} else { } else {
can.run(event, [field.id||field.index, ctx.ACTION, input.name], function(msg) { can.run(event, [field.id||field.index, ctx.ACTION, input.name], function(msg) {
// value.msg = msg, can.page.setData(can) can.onaction._refresh(event, can, order)
}) })
} return } return
} }
can.core.List(field.inputs, function(input) { can.core.List(field.inputs, function(input) {
if (input.name == name) { input.value = value, can.page.setData(can) if (input.name == name) { input.value = value, can.onaction._refresh(event, can, order) }
can.onaction.onAction(event, can, ice.LIST, {order: order, name: ice.LIST})
}
}) })
}, },
}) })

View File

@ -1,5 +1,44 @@
<import src="../../app.wxml"/> <import src="../../app.wxml"/>
<template is="action" data="{{action}}"></template> <view class="page action">
<template is="debug" data="{{conf}}"></template> <template is="action" data="{{action}}"></template>
<template is="field" data="{{list}}"></template> <template is="debug" data="{{conf}}"></template>
<view class="output">
<view class="field" wx:for="{{list}}" wx:for-index="order" wx:for-item="field" wx:key="index">
<view class="legend"><text>{{field.name}}({{field.help}})</text></view>
<view class="option"> <!-- 参数 -->
<view class="item {{item.type}}" wx:for="{{field.inputs}}" wx:key="name">
<!-- 文本 -->
<textarea wx:if="{{item.type == 'textarea'}}" placeholder="{{item.name}}" value="{{item.value}}"
bindinput="onInputs" data-index="{{index}}" data-order="{{order}}"></textarea>
<!-- 文本 -->
<input wx:elif="{{item.type == 'text'}}" placeholder="{{item.placeholder||item.name}}" value="{{item.value}}" type="text"
bindinput="onInputs" data-index="{{index}}" data-order="{{order}}"/>
<!-- 列表 -->
<picker wx:elif="{{item.type == 'select'}}" range="{{item.values}}" value="{{item.index||0}}"
bindchange="onChange" data-index="{{index}}" data-order="{{order}}">{{item.value||item.values[item.index||0]}}</picker>
<!-- 按钮 -->
<button wx:elif="{{item.type == 'button'}}" size="mini"
bindtap="onAction" data-index="{{index}}" data-order="{{order}}" data-name="{{item.name}}">{{item.value||item.name}}</button>
</view>
</view>
<view class="action"> <!-- 参数 -->
<view class="item {{item.type}}" wx:for="{{field.msg._action}}" wx:key="name">
<!-- 按钮 -->
<button wx:if="{{item.type == 'button'}}" size="mini"
bindtap="onAction" data-index="{{index}}" data-order="{{order}}" data-name="{{item.name}}">{{item.value||item.name}}</button>
</view>
</view>
<view class="output"> <!-- 输出 -->
<!-- 表格 -->
<template is="table" data="{{order: order, msg: field.msg}}"></template>
<!-- 文本 -->
<view class="code"><rich-text wx:for="{{field.msg.result}}" wx:key="index" nodes="{{item}}"></rich-text></view>
</view>
<view class="status"> <!-- 参数 -->
<view class="item {{item.name}}" wx:for="{{field.msg._status}}" wx:key="name">
<text class="name">{{item.name}}</text>: <text class="value">{{item.value}}</text>
</view>
</view>
</view>
</view>
</view>

View File

@ -1,20 +1,21 @@
<import src="../../app.wxml"/> <import src="../../app.wxml"/>
<template is="action" data="{{action}}"></template> <view class="page insert">
<template is="debug" data="{{conf}}"></template> <template is="action" data="{{action}}"></template>
<view class="output"> <template is="debug" data="{{conf}}"></template>
<view class="item" wx:for="{{list}}" wx:key="index"> <view class="output">
<!-- 文本 --> <view class="item" wx:for="{{list}}" wx:key="index">
<textarea wx:if="{{item.type == 'textarea'}}" placeholder="{{item.name}}" value="{{item.value}}" bindinput="onInputs" data-index="{{index}}"></textarea> <!-- 文本 -->
<!-- 文本 --> <textarea wx:if="{{item.type == 'textarea'}}" placeholder="{{item.name}}" value="{{item.value}}" bindinput="onInputs" data-index="{{index}}"></textarea>
<input wx:elif="{{item.type == 'text'}}" placeholder="{{item.name}}" value="{{item.value}}" type="text" bindinput="onInputs" data-index="{{index}}"/> <!-- 文本 -->
<!-- 列表 --> <input wx:elif="{{item.type == 'text'}}" placeholder="{{item.name}}" value="{{item.value}}" type="text" bindinput="onInputs" 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> <picker wx:elif="{{item.type == 'select'}}" range="{{item.values}}" value="{{item.index||0}}" bindchange="onChange" data-index="{{index}}">
</picker> <view>{{item.values[item.index||0]}}</view>
</picker>
</view>
</view>
<view class="action submit">
<view class="item"><button bindtap="onCancel">取消</button></view>
<view class="item"><button bindtap="onConfirm">提交</button></view>
</view> </view>
</view> </view>
<view class="action">
<view class="item"><button bindtap="onCancel">取消</button></view>
<view class="item"><button bindtap="onConfirm">提交</button></view>
</view>

View File

@ -28,6 +28,6 @@ Volcanos("onaction", {list: ["刷新", "扫码", "登录"],
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(chat.PAGES_ACTION, {river: river.hash, storm: storm.hash, serve: can.db.serve, space: can.db.space})) can.user.jumps(can.base.MergeURL(chat.PAGES_ACTION, {river: river.hash, storm: storm.hash, serve: can.db.serve, space: can.db.space}))
}, },
_name: nfs.CHAT_RIVER, _apis: nfs.CHAT_RIVER,
}) })
Volcanos._init() Volcanos._init()

View File

@ -1,4 +1,13 @@
<import src="../../app.wxml"/> <import src="../../app.wxml"/>
<template is="action" data="{{action}}"></template> <view class="page river">
<template is="debug" data="{{conf}}"></template> <template is="action" data="{{action}}"></template>
<template is="list" data="{{list}}"></template> <template is="debug" data="{{conf}}"></template>
<view class="output">
<view class="item" wx:for="{{list}}" wx:key="index">
<view class="item" bindtap="ondetail" data-index="{{index}}">{{item.name}}</view>
<view class="list" wx:if="{{item._show}}">
<view class="item" wx:for="{{item.list}}" wx:for-index="i" wx:key="i" bindtap="onchange" data-index="{{index}}" data-i="{{i}}">{{item.name}}</view>
</view>
</view>
</view>
</view>

View File

@ -1,6 +1,25 @@
{ {
"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": false "compileHotReLoad": true
},
"condition": {
"miniprogram": {
"list": [
{
"name": "",
"pathName": "pages/action/action",
"query": "cmd=web.code.h2.h2",
"launchMode": "default",
"scene": null
},
{
"name": "pages/action/action",
"pathName": "pages/action/action",
"query": "river= e0a1eb&storm=c23ae3&title=hi.scan",
"scene": 1001
}
]
}
} }
} }

View File

@ -19,6 +19,7 @@ var ice = {
MSG_FIELDS: "fields", MSG_SESSID: "sessid", MSG_FIELDS: "fields", MSG_SESSID: "sessid",
MSG_DETAIL: "detail", MSG_OPTION: "option", MSG_APPEND: "append", MSG_RESULT: "result", MSG_DETAIL: "detail", MSG_OPTION: "option", MSG_APPEND: "append", MSG_RESULT: "result",
MSG_ACTION: "_action", MSG_STATUS: "_status",
} }
var ctx = { var ctx = {
CONTEXT: "context", COMMAND: "command", CONFIG: "config", INPUTS: "inputs", FEATURE: "feature", CONTEXT: "context", COMMAND: "command", CONFIG: "config", INPUTS: "inputs", FEATURE: "feature",
@ -64,11 +65,12 @@ var chat = {
ONIMPORT: "onimport", ONACTION: "onaction", ONDETAIL: "ondetail", ONEXPORT: "onexport", ONIMPORT: "onimport", ONACTION: "onaction", ONDETAIL: "ondetail", ONEXPORT: "onexport",
ONSYNTAX: "onsyntax", ONFIGURE: "onfigure", ONPLUGIN: "onplugin", ONSYNTAX: "onsyntax", ONFIGURE: "onfigure", ONPLUGIN: "onplugin",
PAGES_RIVER: "/pages/river/river",
PAGES_ACTION: "/pages/action/action",
PAGES_INSERT: "/pages/insert/insert",
WX_LOGIN_SESS: "/chat/wx/login/action/sess", WX_LOGIN_SESS: "/chat/wx/login/action/sess",
WX_LOGIN_USER: "/chat/wx/login/action/user", WX_LOGIN_USER: "/chat/wx/login/action/user",
WX_LOGIN_SCAN: "/chat/wx/login/action/scan", WX_LOGIN_SCAN: "/chat/wx/login/action/scan",
PAGES_ACTION: "/pages/action/action",
PAGES_INSERT: "/pages/insert/insert",
} }
var team = { var team = {
} }

View File

@ -55,4 +55,14 @@ Volcanos("base", {
list[list.length-1] = value list[list.length-1] = value
} } } }
}, },
trimPrefix: function(str, pre) { if (typeof str != code.STRING) { return str } var arg = arguments, callee = arg.callee
if (arg.length > 2) { for (var i = 1; i < arg.length; i++) { str = callee(str, arg[i]) } return str }
if (str.indexOf(pre) == -1) { return str } return str.slice(pre.length)
},
trimSuffix: function(str, end) { while (str) { var index = str.lastIndexOf(end)
if (index == -1 || index+end.length != str.length) { break } str = str.slice(0, index)
} return str },
trim: function(arg) { if (this.isString(arg)) { return arg.trim() }
if (this.isArray(arg)) { for (var i = arg.length-1; i >= 0; i--) { if (!arg[i]) { arg.pop() } else { break } } } return arg
},
}) })

View File

@ -67,7 +67,6 @@ Volcanos("misc", {
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) })
} }
wx.hideLoading()
msg.Copy(res.data), console.log("request", cmd, data.cmds||data, msg) msg.Copy(res.data), console.log("request", cmd, data.cmds||data, msg)
can.base.toLast(msg.append, mdb.TIME), can.base.toLast(msg.append, web.LINK), can.base.toLast(msg.append, ctx.ACTION) can.base.toLast(msg.append, mdb.TIME), can.base.toLast(msg.append, web.LINK), can.base.toLast(msg.append, ctx.ACTION)
if (msg.append && msg.append.indexOf(ctx.ACTION) > 0) { if (msg.append && msg.append.indexOf(ctx.ACTION) > 0) {

View File

@ -3,6 +3,5 @@ module.exports =
Volcanos("page", { Volcanos("page", {
setData: function(can, list) { setData: function(can, list) {
can.ui.setData({list: list||can.ui.data.list}) can.ui.setData({list: list||can.ui.data.list})
wx.hideLoading()
} }
}) })

View File

@ -21,19 +21,14 @@ Volcanos("user", {
wx.scanCode({success: function(res) { var data = can.base.ParseJSON(res.result) wx.scanCode({success: function(res) { var data = can.base.ParseJSON(res.result)
if (data.type == web.LINK && data._origin) { can.base.Copy(data, can.misc.ParseURL(can, res.result)) } if (data.type == web.LINK && data._origin) { can.base.Copy(data, can.misc.ParseURL(can, res.result)) }
if (cb && cb(data)) { return } if (cb && cb(data)) { return }
if (data.cmd||data.index) { if (data.type == web.LINK && data._origin) { delete(data.type), delete(data.name), delete(data.text)
if (data.type == web.LINK && data._origin) { var serve = /(https?:\/\/[^/]+)([^?#])*/.exec(data._origin)[1]; data.serve = serve, delete(data._origin)
var serve = /(https?:\/\/[^/]+)([^?#])*/.exec(data._origin)[1]; data.serve = serve, delete(data._origin) }
delete(data.type), delete(data.name), delete(data.text) if (data.cmd||data.index||data.share) {
} can.user.jumps(can.base.MergeURL(chat.PAGES_ACTION, data))
can.user.jumps(can.base.MergeURL("/pages/action/action", data)) } else if (data.pod||data.space||data.serve) {
can.user.jumps(can.base.MergeURL(chat.PAGES_RIVER, data))
} else { } else {
if (data.type == web.LINK && data._origin) {
var serve = /(https?:\/\/[^/]+)([^?#])*/.exec(data._origin)[1]; data.serve = serve, delete(data._origin)
delete(data.type), delete(data.name), delete(data.text)
can.user.jumps(can.base.MergeURL("/pages/river/river", data))
return
}
can.misc.request(can, can.request(), chat.WX_LOGIN_SCAN, data) can.misc.request(can, can.request(), chat.WX_LOGIN_SCAN, data)
} }
}}) }})
@ -63,10 +58,13 @@ Volcanos("user", {
}, },
trans: function(can, text, list, zone) { if (!text) { return text } trans: function(can, text, list, zone) { if (!text) { return text }
return can.core.Value(list, can.core.Keys(zone, text))||can.core.Value({ return can.core.Value(list, can.core.Keys(zone, text))||can.core.Value({
"list": "查看", "back": "返回", "create": "创建", "run": "执行", "list": "查看", "back": "返回",
"create": "创建", "remove": "删除",
"prunes": "清理",
"start": "启动", "stop": "停止", "open": "打开", "start": "启动", "stop": "停止", "open": "打开",
"trash": "清理", "trash": "清理",
input: { input: {
"hash": "索引",
"time": "时间", "link": "链接", "status": "状态", "action": "操作", "time": "时间", "link": "链接", "status": "状态", "action": "操作",
"type": "类型", "name": "名称", "text": "内容", "icon": "图标", "type": "类型", "name": "名称", "text": "内容", "icon": "图标",
"repos": "仓库", "binary": "程序", "script": "脚本", "template": "仓库", "version": "版本", "repos": "仓库", "binary": "程序", "script": "脚本", "template": "仓库", "version": "版本",

View File

@ -24,28 +24,18 @@ Volcanos._init = function() {
}): can.core.Item(can.base.isFunc(item)? item(): item, set) }): can.core.Item(can.base.isFunc(item)? item(): item, set)
}); return msg }); return msg
}, },
run: function(event, cmds, cb) { run: function(event, cmds, cb) { wx.showLoading()
wx.showLoading() can.misc.requests(can, can.request(event, {pod: can.db.pod||can.db.space}), can.onaction._apis||nfs.CHAT_ACTION, {cmds: (can.onaction._cmds||[]).concat(cmds)}, function(msg) {
var msg = can.request(event); msg._serve = can.db.serve msg.Dump = function() { can.ui.setData({list: msg.Table()}) }, cb(msg), wx.hideLoading()
can.misc.requests(can, can.request(event, {pod: can.db.pod||can.db.space}), can.onaction._name||nfs.CHAT_ACTION, {cmds: (can.onaction._cmds||[]).concat(cmds)}, function(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, can.db.serve = can.db.serve||can.conf.serve
can.db.serve = can.db.serve||can.conf.serve
can.core.Item(can.db, function(key, value) { can.db[key] = decodeURIComponent(value) }) can.core.Item(can.db, function(key, value) { can.db[key] = decodeURIComponent(value) })
can.user.title(can.db.title||can.db.pod||can.db.space||(can.db.serve||can.conf.serve).split("://")[1]) can.user.title(can.db.title||can.db.pod||can.db.space||(can.db.serve||can.conf.serve).split("://")[1])
console.log("app show", can.ui.route, options) console.log("app show", can.ui.route, options), can.ui.setData({conf: can.db})
can.ui.setData({conf: can.db}) can.user.login(can, function() { can.onaction.refresh({}, can) })
can.user.login(can, function() {
if (can.onaction.refresh) {
can.onaction.refresh({}, can)
} else {
}
})
}, },
onShow: function() {}, onShow: function() {},
onReady: function() {}, onReady: function() {},