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

mix github

This commit is contained in:
shylinux 2020-07-29 11:40:05 +08:00
commit bac4fa029e
10 changed files with 94 additions and 20 deletions

View File

@ -1,8 +1,8 @@
const kit = require("utils/kit.js") const kit = require("utils/kit.js")
App({ App({
// data: {}, conf: {serve: "https://shylinux.com/chat", space: "mac"}, data: {}, conf: {serve: "https://shylinux.com/chat", space: "mac"},
data: {}, conf: {serve: "https://shylinux.com/chat", space: ""}, // data: {}, conf: {serve: "https://shylinux.com/chat", space: ""},
request: function(cmd, data, cb) { var app = this; data.sessid = app.conf.sessid, data.pod = app.conf.space 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 wx.request({method: "POST", url: app.conf.serve+"/"+cmd, data: data, success: function(res) { var msg = res.data
if (res.statusCode == 401) { return app.usercode(function() {app.request(cmd, data, cb)}) } if (res.statusCode == 401) { return app.usercode(function() {app.request(cmd, data, cb)}) }

View File

@ -38,12 +38,21 @@ view.option view.select picker view {
view.output { view.output {
clear:both; clear:both;
} }
view.output>view.item { view.output view.item {
text-align:center; text-align:center;
font-size:18px; font-size:18px;
padding:10px; padding:10px;
border:solid 1px green; border:solid 1px green;
} }
view.output view.list view.item {
background-color:darkgray;
margin-left:20px;
}
view.output view.code {
margin-left:10px;
padding:10px;
border-left:solid 2px cyan;
}
view.title { view.title {
margin-top:20px; margin-top:20px;

View File

@ -4,8 +4,8 @@ const app = getApp()
Page({ Page({
data: { data: {
action: ["扫码", "清屏", "刷新", "串行", "并行", "共享"], action: ["扫码", "清屏", "刷新", "串行", "并行", "共享"],
river: "", storm: "", title: "",
res: [], his: {}, inputs: {}, res: [], his: {}, inputs: {},
river: "", storm: "",
}, },
action: { action: {
"扫码": function(event, page, data, name) { "扫码": function(event, page, data, name) {
@ -19,7 +19,9 @@ Page({
}, },
"刷新": function(event, page, data, name) { "刷新": function(event, page, data, name) {
var list = []; app.data[page.data.river+page.data.storm] = page.data.res = list var list = []; app.data[page.data.river+page.data.storm] = page.data.res = list
wx.showLoading()
app.request("action", {cmds: [page.data.river, page.data.storm]}, function(msg) { app.request("action", {cmds: [page.data.river, page.data.storm]}, function(msg) {
wx.hideLoading()
msg.Table(function(line, index) { msg.Table(function(line, index) {
page.data.his[index] = [] page.data.his[index] = []
line.inputs = JSON.parse(line.inputs) line.inputs = JSON.parse(line.inputs)
@ -204,7 +206,9 @@ Page({
if (cmds[i] === "") {cmds.pop()} else {break} if (cmds[i] === "") {cmds.pop()} else {break}
} }
wx.showLoading()
app.request("action", {cmds: cmds}, function(msg) { app.request("action", {cmds: cmds}, function(msg) {
wx.hideLoading()
page.data.res[order].msg = msg page.data.res[order].msg = msg
page.setData({res: page.data.res}) page.setData({res: page.data.res})
typeof cb == "function" && cb(msg) typeof cb == "function" && cb(msg)
@ -276,8 +280,9 @@ Page({
app.conf.sessid = options.sessid || app.conf.sessid app.conf.sessid = options.sessid || app.conf.sessid
this.data.river = options.river this.data.river = options.river
this.data.storm = options.storm this.data.storm = options.storm
this.data.title = options.title
app.title(options.title) app.title(options.title)
var data = app.data[options.river+options.storm] var data = app.data[options.river+options.storm]
if (data) {return this.setData({res: this.data.res = data})} if (data) {return this.setData({res: this.data.res = data})}
this.onaction({}, {}, "刷新") this.onaction({}, {}, "刷新")
@ -293,11 +298,9 @@ Page({
onShareAppMessage: function (res) { onShareAppMessage: function (res) {
console.log(res) console.log(res)
return { return {
title: "some", title: this.data.title,
path: "pages/action/action?river="+this.data.river+"&storm="+this.data.storm, path: "pages/action/action?river="+this.data.river+"&storm="+this.data.storm+"&title="+this.data.title,
success: function(res) { success: function(res) { console.log(res) },
console.log(res)
},
} }
} }
}) })

View File

@ -38,7 +38,7 @@
<!-- 文本 --> <!-- 文本 -->
<view class="output" wx:if="{{field.msg.result && field.feature && field.feature.display == 'inner'}}"><rich-text wx:for="{{field.msg.result}}" wx:key="name" nodes="{{item}}"></rich-text></view> <view class="output" wx:if="{{field.msg.result && field.feature && field.feature.display == 'inner'}}"><rich-text wx:for="{{field.msg.result}}" wx:key="name" nodes="{{item}}"></rich-text></view>
<view class="output" wx:elif="{{field.msg.result}}"><text wx:for="{{field.msg.result}}" wx:key="name">{{item}}</text></view> <view class="code" wx:elif="{{field.msg.result}}"><text wx:for="{{field.msg.result}}" wx:key="name">{{item}}</text></view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -4,7 +4,7 @@ const app = getApp()
Page({ Page({
data: { data: {
action: ["扫码", "刷新", "登录", "授权"], action: ["扫码", "刷新", "登录", "授权"],
msg: {append: ["key", "name"]}, river: {},
}, },
action: { action: {
"扫码": function(event, page, data, name) { "扫码": function(event, page, data, name) {
@ -13,8 +13,13 @@ Page({
}) })
}, },
"刷新": function(event, page, data, name) { "刷新": function(event, page, data, name) {
wx.showLoading()
app.request("river", {}, function(msg) { app.request("river", {}, function(msg) {
page.setData({msg: msg}), msg.nRow() == 1 && page.ondetail(event, data, 0) wx.hideLoading()
var river = {}; msg.Table(function(value) {
river[value.key] = value
})
page.setData({river: river})
}) })
}, },
"登录": function(event, page, data, name) { "登录": function(event, page, data, name) {
@ -33,10 +38,30 @@ Page({
console.log("action", "river", name) console.log("action", "river", name)
this.action[name](event, this, data) this.action[name](event, this, data)
}, },
ondetail: function(event, data, index) { ondetail: function(event, data) { var page = this
data = data || event.target.dataset, index = index||data.index||0 data = data || event.target.dataset.item
console.log("detail", "river", index)
app.jumps("storm/storm", {river: this.data.msg.key[index], title: this.data.msg.name[index]}) console.log("detail", "river", data)
var river = page.data.river[data.key]
if (river.tool) {
river.hidetool = !river.hidetool
page.setData({river: page.data.river})
return
}
wx.showLoading()
app.request("storm", {cmds: [data.key]}, function(msg) {
wx.hideLoading()
river.tool = {}; msg.Table(function(value) {
river.tool[value.key] = value
value.river = data
})
page.setData({river: page.data.river})
})
},
onchange: function(event, data) { var page = this
data = data || event.target.dataset.item
app.jumps("action/action", {river: data.river.key, storm: data.key, title: data.river.name+"."+data.name})
}, },
onLoad: function (options) { onLoad: function (options) {

View File

@ -1,4 +1,12 @@
<import src="../../app.wxml"/> <import src="../../app.wxml"/>
<template is="action" data="{{action}}"></template> <template is="action" data="{{action}}"></template>
<template is="list-name" data="{{msg}}"></template>
<view class="output">
<view class="item" wx:for="{{river}}" wx:key="name">
<view class="item" bindtap="ondetail" data-item="{{item}}">{{item.name}}</view>
<view class="list" wx:if="{{!item.hidetool}}">
<view class="item" bindtap="onchange" wx:for="{{item.tool}}" wx:key="name" data-item="{{item}}">{{item.name}}</view>
</view>
</view>
</view>

View File

@ -0,0 +1,4 @@
module.exports = {
onimport: function() {},
}

View File

@ -0,0 +1 @@
hello wrold

View File

@ -77,10 +77,10 @@
"scene": null "scene": null
}, },
{ {
"id": -1, "id": 4,
"name": "pages/action/action", "name": "pages/action/action",
"pathName": "pages/action/action", "pathName": "pages/action/action",
"query": "river=d82c1d&storm=f7a8c9&title=mac.hi", "query": "river=d82c1d&storm=12d1d7&title=mac.paste",
"scene": null "scene": null
} }
] ]

24
plugin/story/paste.js Normal file
View File

@ -0,0 +1,24 @@
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { can._output.innerHTML = "";
can.ui = can.page.Append(can, can._target, [
{view: ["content", "div"]}, {view: ["display", "pre"]},
])
can.onappend.table(can, can.ui.content, "table", msg)
can.onappend.board(can, can.ui.display, "board", msg)
return typeof cb == "function" && cb(msg)
},
})
Volcanos("onaction", {help: "控件交互", list: [],
onclick: function(event, can) {
can.run(event, [], function() {})
},
})
Volcanos("ondetail", {help: "控件交互", list: ["编辑", "删除"],
"编辑": function(event, can, key) {
console.log(key)
},
"删除": function(event, can, key) {
console.log(key)
},
})