页面进行数据绑定
<div class="lyrow ui-draggable" style="">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i>删除</a>
<span class="drag label label-default ui-draggable-handle">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-warning" data-target="#editorModal" data-type="layout" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">
<input value="12" class="form-control" type="text">
</div>
<div class="view">
<div class="row clearfix" style="display: flex; flex-wrap: wrap; padding-bottom: 150px; margin-top: 30px;">
<div class="col-md-12 column ui-sortable" style="width:100%;">
<div class="lyrow ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-warning" data-target="#editorModal" data-type="layout" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">
<input value="6 6" class="form-control" type="text"> </div>
<div class="view">
<div class="row">
<div class="col-md-12 column ui-sortable">
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<table cellpadding="1" cellspacing="1" style="width:600px;/* border-bottom:1px solid #bfbec1; */background:#f3f8f9;margin-left: -15px;border-top: 1px solid #bfbec1;/* border-right: 1px solid #bfbec1; */">
<tbody>
<tr>
<td style="padding: 11px 10px;width:90%;">
<strong>聊天</strong>
</td>
<td class="text-center">
<img alt="" data-anijs="if: click,do: $openPage url=/f/10_5_2.html|openTarget=_self|inhash=0" src="/img/close.png" style="width: 20px;">
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="lyrow ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-warning" data-target="#editorModal" data-type="layout" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">
<input value="6 6" class="form-control" type="text"> </div>
<div class="view">
<div class="row clearfix" data-positionstyle="static" style="height:425px;background:#dadfe0;width:600px;overflow: auto;overflow-x: hidden;">
<div class="col-md-12 column ui-sortable" data-positionstyle="static" style="padding: 0px; border-width: 1px 1px 0px 0px; border-style: solid; border-color: rgb(191, 190, 193);">
<!--
<p class="text-center" style="margin-top:0px;margin-bottom:20px;"><span style="color:#959a99;font-size:12px;">2018/5/6 12:35:33</span></p>
-->
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<p class="text-center" style="margin-top:24px;margin-bottom:20px;">
<span style="color:#0285ce;">查看更多消息</span>
</p>
</div>
</div>
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<div data-bind="foreach: wechat" data-positionstyle="static">
<div data-bind="css: {"hide":pd()}">
<p class="text-center" style="margin-top:0px;margin-bottom:20px;">
<span data--time="" data-bind="attr: {"data--time":wechat7sendingtim}" data-format="yyyy-MM-dd hh:mm:ss" data-wwclass="getlocaltime">2018-04-11 01:48:24</span>
</p>
<div class="row clearfix" style="display: flex; flex-wrap: wrap;">
<div class="col-md-2 column ui-sortable">
<p class="text-center ui-sortable-handle">
<span data-bind="text: wechat7senderid" style="text-align: center;">李四</span>
</p>
</div>
<div class="col-md-10 column ui-sortable" style="padding-left: 0px;">
<p class="ui-sortable-handle" data-bind="html: wechat7messagecon" data-bindvars="{"wechat7messagecon":""}" style="width: 50%; padding: 5px; float: left; margin-right: 0px; padding-right: 17px; background-color: #fff; border-radius: 10px;">Hi~您好,我来为您排忧解惑,请问有什么可以为您效劳呢~</p>
</div>
</div>
</div>
<div data-bind="css: {"hide":!pd()}">
<p class="text-center" style="margin-top:0px;margin-bottom:20px;">
<span data--time="" data-bind="attr: {"data--time":wechat7sendingtim}" data-format="yyyy-MM-dd hh:mm:ss" data-wwclass="getlocaltime">2018-04-11 01:48:24</span>
</p>
<div class="row clearfix" style="display: flex; flex-wrap: wrap;">
<div class="col-md-10 column ui-sortable" style="padding-right: 0px;">
<p class="text-right ui-sortable-handle" data-bind="html: wechat7messagecon" style="width: 32%; padding: 5px; float: right; margin-right: 0px; padding-right: 17px; background-color: #94dae0; border-radius: 10px;">我有问题想要咨讯</p>
</div>
<div class="col-md-2 column ui-sortable">
<p class="text-center ui-sortable-handle">
<span data-bind="text: wechat7senderid" data-bindvars="{"wechat7senderid":""}" style="text-align: center;">张三</span>
</p>
</div>
</div>
</div>
<!--<div>
<p class="text-center" style="margin-top:0px;margin-bottom:20px;"><span style="color:#959a99;font-size:12px;">2018/5/6 12:35:33</span></p>
<div class="row clearfix" style="display: flex; flex-wrap: wrap;">
<div class="col-md-2 column ui-sortable">
<p class="text-center ui-sortable-handle">张三</p>
</div>
<div class="col-md-10 column ui-sortable" style="padding-left: 0px;">
<p class="ui-sortable-handle" data-bind="html: chatconten7messagecon" style="width: 50%; padding: 5px; float: left; margin-right: 0px; padding-right: 17px; background-color: #fff; border-radius: 10px;">Hi~您好,我来为您排忧解惑,请问有什么可以为您效劳呢~</p>
</div>
</div>
</div>
<div>
<p class="text-center" style="margin-top:0px;margin-bottom:20px;"><span style="color:#959a99;font-size:12px;">2018/5/6 12:35:33</span></p>
<div class="row clearfix" style="display: flex; flex-wrap: wrap;">
<div class="col-md-10 column ui-sortable" style="padding-right: 0px;">
<p class="text-right ui-sortable-handle" style="width: 32%; padding: 5px; float: right; margin-right: 0px; padding-right: 17px; background-color: #94dae0; border-radius: 10px;">我有问题想要咨讯</p>
</div>
<div class="col-md-2 column ui-sortable">
<p class="text-center ui-sortable-handle">李四</p>
</div>
</div>
</div>--></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="lyrow ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-warning" data-target="#editorModal" data-type="layout" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">
<input value="6 6" class="form-control" type="text"> </div>
<div class="view">
<div class="row" style=" padding-top: 0px;">
<div class="col-md-12 column ui-sortable" data-positionstyle="static" style="background: url("initial") rgb(229, 237, 240); border: 1px solid rgb(191, 190, 193); width: 600px;">
<!--<p style="padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><img alt="" data-anijs="if: click,do: $addClass hide,to: #dd1;if: click,do: $removeClass hide,to: #dd2" data-wwsrc="/img/biaoqing1.png" id="dd1" src="/img/biaoqing1.png" style="width: 25px; margin-right: 15px;" /> <img alt="" class="hide" data-anijs="if: click,do: $addClass hide,to: #dd2;if: click,do: $removeClass hide,to: #dd1" data-wwsrc="/img/biaoqing1a.png" id="dd2" src="/img/biaoqing1a.png" style="width: 25px; margin-right: 15px;" /> <img alt="" data-anijs="if: click,do: $addClass hide,to: #dd3;if: click,do: $removeClass hide,to: #dd4" data-wwsrc="/img/biaoqing2.png" id="dd3" src="/img/biaoqing2.png" style="width: 24px; margin-right: 15px;" /> <img alt="" class="hide" data-anijs="if: click,do: $addClass hide,to: #dd4;if: click,do: $removeClass hide,to: #dd3" data-wwsrc="/img/biaoqing2a.png" id="dd4" src="/img/biaoqing2a.png" style="width: 24px; margin-right: 15px;" /></p>-->
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<p style=" margin-bottom: 0px;padding-top: 10px;">
<textarea data-bind="value: wechat7messagecon" data-positionstyle="static" style="width: 100%; height: 88px; padding: 10px; border: 1px solid rgb(189, 189, 189); box-shadow: none;">我有问题想要咨询</textarea>
</p>
</div>
</div>
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<p class="text-right" style=" padding-top: 8px;
padding-bottom: 8px; margin-bottom: 0px;">
<a class="btn btn-default" data-anijs="if: click,do: $none,before: getData url=/rest/cwechat.json|vmVar=wechat7messagecon|method=POST|ct=public_json|timeZone=0|notify=0|cache=1|ifPreventDefault=1|ifStopPropagation=1|debug=1,after: refreshData url=/rest/cwechat.json|vmVar=wechat7messagecon|method=POST|ct=public_json|timeZone=0|notify=0|cache=1|ifPreventDefault=1|ifStopPropagation=1|debug=1;if: click,do: $bindingScript sc482205" data-positionstyle="static" data-script-sc482205="_vm.wechat7messagecon("");" href="#" style="width: 90px; color: rgb(255, 255, 255); height: 34px; background: url("initial") rgb(0, 134, 140); border-radius: 0px; border-width: 0px;">发送</a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="lyrow ui-draggable" style="" data-layer="data">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i>删除</a>
<span class="drag label label-default ui-draggable-handle">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button class="label label-warning" type="button" data-target="#editorModal" data-toggle="modal" data-backdrop="false" data-keyboard="false" data-type="layout">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
<span class="layername">data</span>
</span>
<div class="preview">
<input class="form-control" value="12">
</div>
<div class="view">
<div class="row clearfix">
<div class="col-md-12 column ui-sortable">
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<div data-bindvars="{"wechat2":[],"wechat7messagecon":""}" data-url="/rest/rwechat.json" data-wwclass="fetchdata">获取数据基础元素, 请右键配置详细信息. </div>
</div>
</div>
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<div data--wsurl="/user/999" data-bind="attr: {"data-x-wid":socketid}" data-wwclass="wsock">服务器反向通知元素</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script id="_wwblockConfig" data-config="%7B%22nocontainer%22:true%7D"></script>
读取
/**
version=0.22
*/
sp.exports = (function() {
var STRICT = /*INSBEGIN:STRICT*/ true /*INSEND:STRICT*/ ;
var cacheControl = /*INSBEGIN:VCC*/ {} /*INSEND:VCC*/ ;
var url_parameter_constraints = /*INSBEGIN:URLPM*/ {} /*INSEND:URLPM*/ ;
var form_parameter_constraints = /*INSBEGIN:FORMPM*/ {} /*INSEND:FORMPM*/ ;
var page_data = {};
function prepare(req, res) {
var tmp_data = {};
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PREPROCESS*/
/*INSEND:PREPROCESS*/
]);
}
/** 公有数据处理函数 */
function getPublicData(req, res, data) {
/* 任何需要返回给客户端的信息务必追加到这个对象上 */
var finish_data = {};
/* tmp_data的作用在于多个代码块之间互相传值 */
var tmp_data = {};
/* 所有输入参数一旦被验证通过了,接下来就可以通过 inputs这个对象来来获取: inputs.key */
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PUBDATA*/
/*INSBEGIN:SEQUENCENOEX*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:SEQUENCE*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
]);
},
/*INSEND:SEQUENCE*/
/*INSBEGIN:SEQUENCE*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:STDQUERY:{}*/
function() {
return when.pipeline([
function() {
var tableName = "wechat";
var from = 0;
var size = 10;
from = 0;
size = 50;
tmp_data.TABLEINFO = tmp_data.TABLEINFO || {};
tmp_data.TABLEINFO[tableName] = tmp_data.TABLEINFO[tableName] || {};
tmp_data.TABLEINFO[tableName].from = from;
tmp_data.TABLEINFO[tableName].size = size;
tmp_data.wechat = tmp_data.wechat || [];
var _tmpIDObj = {};
_tmpIDObj["1"] = 0;
_tmpIDObj["5"] = 1;
var q = {
"bool":{
"must":[{
"bool":{
"must":[{
"term":{
"wechat7recordpers": "caa0d430feba11e8aac503cf8862ec79"
}
}],
"should":[{
"bool":{
"must":[{
"term":{
"wechat7senderid": "d06bd4a0feba11e8aac503cf8862ec79"
}
},{
"term":{
"wechat7receiverid": "caa0d430feba11e8aac503cf8862ec79"
}
}]
}
},{
"bool":{
"must":[{
"term":{
"wechat7senderid": "caa0d430feba11e8aac503cf8862ec79"
}
},{
"term":{
"wechat7receiverid": "d06bd4a0feba11e8aac503cf8862ec79"
}
}]
}
}]
}
}]
}
};
if (_.isEmpty(q)) {
q = {
"match_all": {}
};
}
var opt = {
from: from,
size: size
};
var sort = ["wechat7sendingtim"];
if (sort.length > 0) {
opt.sort = sort;
}
opt._sourceInclude = ["wechat7senderid", "wechat7receiverid", "wechat7messagecon", "wechat7sendingtim", "wechat7recordpers"];
var db = req.database();
var table = db.getTable(tableName);
return table.exec(q, opt);
},
function(queryResult) {
tmp_data.TABLEINFO.wechat.total = queryResult.hits.total;
var whiteList = {
"wechat7senderid": "默认值",
"wechat7receiverid": "默认值",
"wechat7messagecon": "默认值",
"wechat7sendingtim": "默认值",
"wechat7recordpers": "默认值"
};
_.each(queryResult.hits.hits, function(value, key, list) {
var defaultValue = _.clone(whiteList);
var source = value._source || whiteList;
defaultValue = _.extend(defaultValue, _.pick(source, _.keys(whiteList)));
defaultValue._id = value._id;
tmp_data.wechat.push(defaultValue);
});
return tmp_data.wechat;
}
]) /*INSBEGIN:EXCEPTION*/
/*INSEND:EXCEPTION*/
;
},
//@wweditorinfo:{"id":"fae70fac8678b7a6443cea508b7ed086","editor":{"table":{"method":{"method":"typedTable","tables":"wechat"}},"common":{"method":"query","pagination":true,"resultPosition":"tmp_data","resultName":"wechat","catchException":false,"gatherSort":false,"gatherScore":false,"from":{"from":"const","value":0},"size":{"from":"const_size","value":50}},"query":{"type":{"type":"bool","must":[{"type":"bool","must":[{"type":"term","field":"wechat7recordpers","query":{"query":"const","value":"caa0d430feba11e8aac503cf8862ec79"},"boost":1}],"must_not":[],"should":[{"type":"term","field":"wechat7senderid","query":{"query":"const","value":"caa0d430feba11e8aac503cf8862ec79"},"boost":1},{"type":"term","field":"wechat7receiverid","query":{"query":"const","value":"d06bd4a0feba11e8aac503cf8862ec79"},"boost":1}],"shouldMin":1,"boost":1},{"type":"bool","must":[{"type":"term","field":"wechat7senderid","query":{"query":"const","value":"d06bd4a0feba11e8aac503cf8862ec79"},"boost":1},{"type":"term","field":"wechat7receiverid","query":{"query":"const","value":"caa0d430feba11e8aac503cf8862ec79"},"boost":1}],"must_not":[],"should":[],"shouldMin":1,"boost":1}],"must_not":[],"should":[],"shouldMin":1,"boost":1}},"highlight":{"ishighlight":"no","searchfield":{"from":"param","value":"0"},"fields":["_id"],"color":"#ff0000","search":"arguments[0]"},"sort":{"sort":[{"field":{"type":"const","value":"wechat7sendingtim"},"order":{"type":"const","value":"desc"}}],"nextDefaultValue":true},"whitelist":{"_id":true,"wechat7senderid":true,"wechat7receiverid":true,"wechat7messagecon":true,"wechat7sendingtim":true,"wechat7recordpers":true},"withAggs":{"isAggs":false}}}
/*INSEND:STDQUERY*/
/*INSBEGIN:CONDITION*/
function(condition) {
console.log("=============" + JSON.stringify(tmp_data.wechat));
if (!_.isEmpty(tmp_data.wechat)) {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:CUSTOM*/
function() {
_.each(tmp_data.wechat, function(v, k, l) {
if (v.wechat7senderid === "caa0d430feba11e8aac503cf8862ec79") {
v.wechat7senderid = "Lily";
v.pd = true;
} else {
v.wechat7senderid = "Alice";
v.pd = false;
}
});
},
/*INSEND:CUSTOM*/
/*INSEND:SEQUENCEIP*/
function(value) {
return value;
}
]);
}
return false;
},
/*INSEND:CONDITION*/
/*INSBEGIN:STDOUT*/
//@wwcomments:{编号2}页面正常情况下,输出的数据 注意1:页面中信息点的标注方式不同返回数据的格式也不同 注意2:默认是针对数据绑定方式的数据返回格式
function() {
_.extend(finish_data, {
"success": true,
"_runCommand": [{
"command": "updatelv",
"params": [{
"wechat": tmp_data.wechat,
}]
}]
});
},
//@wweditorinfo:{"id":"cf760ed9cbd5d5e99d047f3b7ac9dad0","editor":{"jsonValue":{"success":true,"_runCommand":[{"command":"updatelv","params":[{"databind_key":"newValue"}]},{"command":"updatelv","params":[{"a":"newValue"}]}]},"steppurpose":{"purpose":"finishdata"}}}
/*INSEND:STDOUT*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
]);
},
/*INSEND:SEQUENCE*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
])
.catch(function(err) {
return err;
});
},
/*INSEND:SEQUENCENOEX*/
/*INSBEGIN:EXCEPTCHECK*/
function(except) {
if (except instanceof Error) {
var procedException = false;
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSEND:SEQUENCEIP*/
function(result) {
if (procedException) {
return result;
}
throw except;
}
]);
}
return except;
},
/*INSEND:EXCEPTCHECK*/
/*INSEND:PUBDATA*/
function() {
/*INSBEGIN:MARKDESC {
}
INSEND:MARKDESC*/
var default_data = /*INSBEGIN:MARK*/ {
"success": true
} /*INSEND:MARK*/ ;
return _.extend(default_data, finish_data);
}
]);
}
/** user数据处理函数 */
function getUserData(req, res, data) {
/* 任何需要返回给客户端的信息务必追加到这个对象上 */
var finish_data = {};
/* tmp_data的作用在于多个代码块之间互相传值 */
var tmp_data = {};
/* 所有输入参数一旦被验证通过了,接下来就可以通过 inputs这个对象来来获取: inputs.key */
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PRIVATEDATA*/
/*INSEND:PRIVATEDATA*/
function() {
/*INSBEGIN:USERMARKDESC {
}
INSEND:USERMARKDESC*/
var default_data = /*INSBEGIN:USERMARK*/ {
"success": true
} /*INSEND:USERMARK*/ ;
return _.extend(default_data, finish_data);
}
]);
}
/** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!以下内容为系统自动生成,请不要做任何修改!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
var wwgtranslator;
var _wwi = function(str, req) {
if (wwgtranslator && req) {
return reqprocessor.i18nImplement(wwgtranslator, str, req);
}
return str;
};
var wwiInited = false;
var render = {};
// 模板经过编译之后,_ViewName保存了基础的view的名称(也就是文件名部分)。而dotjsFunc保存了主View(not resposive portion)的dotjs函数。
var _ViewName;
/***DOTJSFUNC***/
var option = {
"STRICT": STRICT,
"render": render,
"prepare": prepare,
"_ViewName": _ViewName,
"getUserData": getUserData,
"getPublicData": getPublicData,
"constraints": form_parameter_constraints,
"get_constraints": url_parameter_constraints
};
function process(req, res) {
if (!wwiInited) {
wwiInited = true;
var ret = reqprocessor.i18ninit(req, res, option, function(translator) {
wwgtranslator = translator;
});
if (ret) {
return ret;
}
}
return reqprocessor.processHandler(option, req, res);
}
function doPrepare(req, res) {
option.sc = option.sc || {};
_.extend(option.sc, cacheControl.sc);
return reqprocessor.doPrepare(option, req, res);
}
return /*INSPOINTBEGIN:MIDDLEDEP*/ ["session", /*"wxlogin",*/ "passport", doPrepare, "bodyparser", process] /*INSPOINTEND:MIDDLEDEP*/ ;
})();
创建
/**
version=0.22
*/
sp.exports = (function() {
var STRICT = /*INSBEGIN:STRICT*/ {
"strict": true,
"eh": false
} /*INSEND:STRICT*/ ;
var cacheControl = /*INSBEGIN:VCC*/ {} /*INSEND:VCC*/ ;
var url_parameter_constraints = /*INSBEGIN:URLPM*/ {} /*INSEND:URLPM*/ ;
var form_parameter_constraints = /*INSBEGIN:FORMPM*/ {
"wechat7messagecon": {
"type": "string",
"constraints": {
"presence": {
"message": "请输入内容!"
}
}
}
} /*INSEND:FORMPM*/ ;
var page_data = {};
function prepare(req, res) {
var tmp_data = {};
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PREPROCESS*/
/*INSEND:PREPROCESS*/
]);
}
/** 公有数据处理函数 */
function getPublicData(req, res, data) {
/* 任何需要返回给客户端的信息务必追加到这个对象上 */
var finish_data = {};
/* tmp_data的作用在于多个代码块之间互相传值 */
var tmp_data = {};
/* 所有输入参数一旦被验证通过了,接下来就可以通过 inputs这个对象来来获取: inputs.key */
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PUBDATA*/
/*INSBEGIN:SEQUENCENOEX*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:SEQUENCE*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
]);
},
/*INSEND:SEQUENCE*/
/*INSBEGIN:SEQUENCE*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:CUSTOM*/
function() {
tmp_data.nr = [{
"wechat7senderid": "caa0d430feba11e8aac503cf8862ec79",
"wechat7receiverid": "d06bd4a0feba11e8aac503cf8862ec79",
"wechat7messagecon": inputs.wechat7messagecon,
"wechat7sendingtim": moment()
.utc()
.format(),
"wechat7recordpers": "caa0d430feba11e8aac503cf8862ec79"
}, {
"wechat7senderid": "caa0d430feba11e8aac503cf8862ec79",
"wechat7receiverid": "d06bd4a0feba11e8aac503cf8862ec79",
"wechat7messagecon": inputs.wechat7messagecon,
"wechat7sendingtim": moment()
.utc()
.format(),
"wechat7recordpers": "d06bd4a0feba11e8aac503cf8862ec79"
}];
},
/*INSEND:CUSTOM*/
/*INSBEGIN:MUPDATE*/
function() {
var tableName = "wechat",
docs = [];
return when.pipeline([
function() {
function _2Date(value, format) {
try {
if (!_.isEmpty(format)) {
return moment.utc(value)
.format(format);
} else {
return moment.utc(value)
.format();
}
} catch (e) {
throw {
"status": 200,
"success": false,
"message": {
"status": 200,
"success": false,
"message": "批量更新表[" + tableName + "]中,字段 [" + value + "] 不是合法的时间类型"
}
};
}
}
_.each(tmp_data.nr, function(v, k, l) {
docs.push({
//_id必须存在否则将不能更新对应数据项
"_id": v._id,
"wechat7senderid": v.wechat7senderid,
"wechat7receiverid": v.wechat7receiverid,
"wechat7messagecon": v.wechat7messagecon,
"wechat7sendingtim": _2Date(v.wechat7sendingtim,""),
"wechat7recordpers": v.wechat7recordpers
});
});
},
function() {
if (_.isArray(docs) && docs.length > 0) {
var table = req.database()
.getTable(tableName);
return table.mupdate(docs);
}
}
]);
},
//@wweditorinfo:{"id":"19d4d0cd84f6dd6770ed83b93692492c","editor":{"step1":{"method":{"method":"typedTable","tables":"wechat"}},"selectField":{"_id":true,"wechat7senderid":true,"wechat7receiverid":true,"wechat7messagecon":true,"wechat7sendingtim":true,"wechat7recordpers":true},"step3":{"docList":{"from":"tmp_data","value":"nr"}}}}
/*INSEND:MUPDATE*/
/*INSBEGIN:WSNOTIFY*/
function() {
return reqlib('msgbroker');
},
function(msgbroker) {
function _2Date(value, format) {
try {
if (format) {
return moment.utc(value)
.format(format);
} else {
return moment.utc(value)
.format();
}
} catch (e) {
return value;
}
}
var domain = req.wwdomain();
var uid = "d06bd4a0feba11e8aac503cf8862ec79";
var msg = {
"command": "MESSAGE",
"headers": {
"random": Math.random(),
"subscription": "sub-0"
},
"body": ""
};
msg.headers._runCommand = JSON.stringify([{
"command": "vmArrFuc",
"params": [
"push",
"wechat2", {
"wechat7senderid": "Lily",
"wechat7messagecon": inputs.wechat7messagecon,
"wechat7sendingtim": _2Date(),
"pd": false
}
]
}]);
return msgbroker.notifyuser(domain, uid, msg);
},
//@wweditorinfo:{"id":"a189fffd8eceaebf0c6c516cba3d15c0","editor":{"step1":false,"stepUser":{"domain":{"from":"const","value":"kefu7zxkfb"},"uid":{"from":"tmp_data","value":"0000"},"msg":{"from":"inputs","value":"kefu7zxkfb7ltnr"},"isFilter":false}}}
/*INSEND:WSNOTIFY*/
/*INSBEGIN:REFRESHDB*/
function() {
return req.database()
.refresh();
},
/*INSEND:REFRESHDB*/
/*INSBEGIN:STDOUT*/
//@wwcomments:{编号2}页面正常情况下,输出的数据 注意1:页面中信息点的标注方式不同返回数据的格式也不同 注意2:默认是针对数据绑定方式的数据返回格式
function() {
function _2Date(value, format) {
try {
if (format) {
return moment.utc(value)
.format(format);
} else {
return moment.utc(value)
.format();
}
} catch (e) {
return value;
}
}
_.extend(finish_data, {
"success": true,
"_runCommand": [{
"command": "vmArrFuc",
"params": ["push", "wechat", {
"wechat7senderid": "Lily",
"wechat7messagecon": inputs.wechat7messagecon,
"pd": true,
"wechat7sendingtim": _2Date(),
}]
}]
});
},
//@wweditorinfo:{"id":"cf760ed9cbd5d5e99d047f3b7ac9dad0","editor":{"jsonValue":{"success":true,"_runCommand":[{"command":"updatelv","params":[{"databind_key":"newValue"}]}]},"steppurpose":{"purpose":"finishdata"}}}
/*INSEND:STDOUT*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
]);
},
/*INSEND:SEQUENCE*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
])
.catch(function(err) {
return err;
});
},
/*INSEND:SEQUENCENOEX*/
/*INSEND:PUBDATA*/
function() {
/*INSBEGIN:MARKDESC {
}
INSEND:MARKDESC*/
var default_data = /*INSBEGIN:MARK*/ {
"success": true
} /*INSEND:MARK*/ ;
return _.extend(default_data, finish_data);
}
]);
}
/** user数据处理函数 */
function getUserData(req, res, data) {
/* 任何需要返回给客户端的信息务必追加到这个对象上 */
var finish_data = {};
/* tmp_data的作用在于多个代码块之间互相传值 */
var tmp_data = {};
/* 所有输入参数一旦被验证通过了,接下来就可以通过 inputs这个对象来来获取: inputs.key */
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PRIVATEDATA*/
/*INSEND:PRIVATEDATA*/
function() {
/*INSBEGIN:USERMARKDESC {
}
INSEND:USERMARKDESC*/
var default_data = /*INSBEGIN:USERMARK*/ {
"success": true
} /*INSEND:USERMARK*/ ;
return _.extend(default_data, finish_data);
}
]);
}
/** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!以下内容为系统自动生成,请不要做任何修改!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
var wwgtranslator;
var _wwi = function(str, req) {
if (wwgtranslator && req) {
return reqprocessor.i18nImplement(wwgtranslator, str, req);
}
return str;
};
var wwiInited = false;
var render = {};
// 模板经过编译之后,_ViewName保存了基础的view的名称(也就是文件名部分)。而dotjsFunc保存了主View(not resposive portion)的dotjs函数。
var _ViewName;
/***DOTJSFUNC***/
var option = {
"STRICT": STRICT,
"render": render,
"prepare": prepare,
"_ViewName": _ViewName,
"getUserData": getUserData,
"getPublicData": getPublicData,
"constraints": form_parameter_constraints,
"get_constraints": url_parameter_constraints
};
function process(req, res) {
if (!wwiInited) {
wwiInited = true;
var ret = reqprocessor.i18ninit(req, res, option, function(translator) {
wwgtranslator = translator;
});
if (ret) {
return ret;
}
}
return reqprocessor.processHandler(option, req, res);
}
function doPrepare(req, res) {
option.sc = option.sc || {};
_.extend(option.sc, cacheControl.sc);
return reqprocessor.doPrepare(option, req, res);
}
return /*INSPOINTBEGIN:MIDDLEDEP*/ ["session", /*"wxlogin",*/ "passport", doPrepare, "bodyparser", process] /*INSPOINTEND:MIDDLEDEP*/ ;
})();
页面
<div class="lyrow ui-draggable" style="">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i>删除</a>
<span class="drag label label-default ui-draggable-handle">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-warning" data-target="#editorModal" data-type="layout" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">
<input value="12" class="form-control" type="text">
</div>
<div class="view">
<div class="row clearfix" style="display: flex; flex-wrap: wrap; padding-bottom: 150px; margin-top: 30px;">
<div class="col-md-12 column ui-sortable" style="width:100%;">
<div class="lyrow ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-warning" data-target="#editorModal" data-type="layout" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">
<input value="6 6" class="form-control" type="text"> </div>
<div class="view">
<div class="row">
<div class="col-md-12 column ui-sortable">
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<table cellpadding="1" cellspacing="1" style="width:600px;/* border-bottom:1px solid #bfbec1; */background:#f3f8f9;margin-left: -15px;border-top: 1px solid #bfbec1;/* border-right: 1px solid #bfbec1; */">
<tbody>
<tr>
<td style="padding: 11px 10px;width:90%;">
<strong>聊天</strong>
</td>
<td class="text-center">
<img alt="" data-anijs="if: click,do: $openPage url=/f/10_5_2.html|openTarget=_self|inhash=0" src="/img/close.png" style="width: 20px;">
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="lyrow ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-warning" data-target="#editorModal" data-type="layout" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">
<input value="6 6" class="form-control" type="text"> </div>
<div class="view">
<div class="row clearfix" data-positionstyle="static" style="height:425px;background:#dadfe0;width:600px;overflow: auto;overflow-x: hidden;">
<div class="col-md-12 column ui-sortable" data-positionstyle="static" style="padding: 0px; border-width: 1px 1px 0px 0px; border-style: solid; border-color: rgb(191, 190, 193);">
<!--
<p class="text-center" style="margin-top:0px;margin-bottom:20px;"><span style="color:#959a99;font-size:12px;">2018/5/6 12:35:33</span></p>
-->
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<p class="text-center" style="margin-top:24px;margin-bottom:20px;">
<span style="color:#0285ce;">查看更多消息</span>
</p>
</div>
</div>
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<div data-bind="foreach: wechat2" data-positionstyle="static">
<div data-bind="css: {"hide":pd()}">
<p class="text-center" style="margin-top:0px;margin-bottom:20px;">
<span data--time="" data-bind="attr: {"data--time":wechat7sendingtim}" data-format="yyyy-MM-dd hh:mm:ss" data-wwclass="getlocaltime">2018-04-11 01:48:24</span>
</p>
<div class="row clearfix" style="display: flex; flex-wrap: wrap;">
<div class="col-md-2 column ui-sortable">
<p class="text-center ui-sortable-handle">
<span data-bind="text: wechat7senderid" style="text-align: center;">李四</span>
</p>
</div>
<div class="col-md-10 column ui-sortable" style="padding-left: 0px;">
<p class="ui-sortable-handle" data-bind="html: wechat7messagecon" data-bindvars="{"wechat7messagecon":""}" style="width: 50%; padding: 5px; float: left; margin-right: 0px; padding-right: 17px; background-color: #fff; border-radius: 10px;">Hi~您好,我来为您排忧解惑,请问有什么可以为您效劳呢~</p>
</div>
</div>
</div>
<div data-bind="css: {"hide":!pd()}">
<p class="text-center" style="margin-top:0px;margin-bottom:20px;">
<span data--time="" data-bind="attr: {"data--time":wechat7sendingtim}" data-format="yyyy-MM-dd hh:mm:ss" data-wwclass="getlocaltime">2018-04-11 01:48:24</span>
</p>
<div class="row clearfix" style="display: flex; flex-wrap: wrap;">
<div class="col-md-10 column ui-sortable" style="padding-right: 0px;">
<p class="text-right ui-sortable-handle" data-bind="html: wechat7messagecon" style="width: 32%; padding: 5px; float: right; margin-right: 0px; padding-right: 17px; background-color: #94dae0; border-radius: 10px;">我有问题想要咨讯</p>
</div>
<div class="col-md-2 column ui-sortable">
<p class="text-center ui-sortable-handle">
<span data-bind="text: wechat7senderid" style="text-align: center;">张三</span>
</p>
</div>
</div>
</div>
<!--<div>
<p class="text-center" style="margin-top:0px;margin-bottom:20px;"><span style="color:#959a99;font-size:12px;">2018/5/6 12:35:33</span></p>
<div class="row clearfix" style="display: flex; flex-wrap: wrap;">
<div class="col-md-2 column ui-sortable">
<p class="text-center ui-sortable-handle">张三</p>
</div>
<div class="col-md-10 column ui-sortable" style="padding-left: 0px;">
<p class="ui-sortable-handle" data-bind="html: chatconten7messagecon" style="width: 50%; padding: 5px; float: left; margin-right: 0px; padding-right: 17px; background-color: #fff; border-radius: 10px;">Hi~您好,我来为您排忧解惑,请问有什么可以为您效劳呢~</p>
</div>
</div>
</div>
<div>
<p class="text-center" style="margin-top:0px;margin-bottom:20px;"><span style="color:#959a99;font-size:12px;">2018/5/6 12:35:33</span></p>
<div class="row clearfix" style="display: flex; flex-wrap: wrap;">
<div class="col-md-10 column ui-sortable" style="padding-right: 0px;">
<p class="text-right ui-sortable-handle" style="width: 32%; padding: 5px; float: right; margin-right: 0px; padding-right: 17px; background-color: #94dae0; border-radius: 10px;">我有问题想要咨讯</p>
</div>
<div class="col-md-2 column ui-sortable">
<p class="text-center ui-sortable-handle">李四</p>
</div>
</div>
</div>--></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="lyrow ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-warning" data-target="#editorModal" data-type="layout" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">
<input value="6 6" class="form-control" type="text"> </div>
<div class="view">
<div class="row" style=" padding-top: 0px;">
<div class="col-md-12 column ui-sortable" data-positionstyle="static" style="background: url("initial") rgb(229, 237, 240); border: 1px solid rgb(191, 190, 193); width: 600px;">
<!--<p style="padding-top: 8px;padding-bottom: 8px;margin-bottom: 0px;"><img alt="" data-anijs="if: click,do: $addClass hide,to: #dd1;if: click,do: $removeClass hide,to: #dd2" data-wwsrc="/img/biaoqing1.png" id="dd1" src="/img/biaoqing1.png" style="width: 25px; margin-right: 15px;" /> <img alt="" class="hide" data-anijs="if: click,do: $addClass hide,to: #dd2;if: click,do: $removeClass hide,to: #dd1" data-wwsrc="/img/biaoqing1a.png" id="dd2" src="/img/biaoqing1a.png" style="width: 25px; margin-right: 15px;" /> <img alt="" data-anijs="if: click,do: $addClass hide,to: #dd3;if: click,do: $removeClass hide,to: #dd4" data-wwsrc="/img/biaoqing2.png" id="dd3" src="/img/biaoqing2.png" style="width: 24px; margin-right: 15px;" /> <img alt="" class="hide" data-anijs="if: click,do: $addClass hide,to: #dd4;if: click,do: $removeClass hide,to: #dd3" data-wwsrc="/img/biaoqing2a.png" id="dd4" src="/img/biaoqing2a.png" style="width: 24px; margin-right: 15px;" /></p>-->
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<p style=" margin-bottom: 0px;padding-top: 10px;">
<textarea data-bind="value: wechat7messagecon" data-positionstyle="static" style="width: 100%; height: 88px; padding: 10px; border: 1px solid rgb(189, 189, 189); box-shadow: none;">我有问题想要咨询</textarea>
</p>
</div>
</div>
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<p class="text-right" style=" padding-top: 8px;
padding-bottom: 8px; margin-bottom: 0px;">
<a class="btn btn-default" data-anijs="if: click,do: $none,before: getData url=/rest/cwechat2.json|vmVar=wechat7messagecon|method=POST|ct=public_json|timeZone=0|notify=0|cache=1|ifPreventDefault=1|ifStopPropagation=1|debug=1,after: refreshData url=/rest/cwechat2.json|vmVar=wechat7messagecon|method=POST|ct=public_json|timeZone=0|notify=0|cache=1|ifPreventDefault=1|ifStopPropagation=1|debug=1;if: click,do: $bindingScript sc482205" data-positionstyle="static" data-script-sc482205="_vm.wechat7messagecon("");" href="#" style="width: 90px; color: rgb(255, 255, 255); height: 34px; background: url("initial") rgb(0, 134, 140); border-radius: 0px; border-width: 0px;">发送</a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="lyrow ui-draggable" style="" data-layer="data">
<a href="#close" class="remove label label-danger">
<i class="glyphicon-remove glyphicon"></i>删除</a>
<span class="drag label label-default ui-draggable-handle">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button class="label label-warning" type="button" data-target="#editorModal" data-toggle="modal" data-backdrop="false" data-keyboard="false" data-type="layout">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
<span class="layername">data</span>
</span>
<div class="preview">
<input class="form-control" value="12">
</div>
<div class="view">
<div class="row clearfix">
<div class="col-md-12 column ui-sortable">
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<div data-bindvars="{"wechat2":[],"wechat7messagecon":""}" data-url="/rest/rwechat2.json" data-wwclass="fetchdata">获取数据基础元素, 请右键配置详细信息. </div>
</div>
</div>
<div class="box box-element ui-draggable ui-sortable-handle">
<a href="#close" class="remove label label-danger">
<i class="glyphicon glyphicon-remove"></i> 删除</a>
<span class="drag label label-default">
<i class="glyphicon glyphicon-move"></i> 拖拽</span>
<span class="configuration">
<button type="button" class="label label-default" data-target="#editorModal" data-toggle="modal">
<span>
<i class="glyphicon glyphicon-edit"></i>
</span>编辑</button>
</span>
<div class="preview">内容</div>
<div class="view">
<div data--wsurl="/user/999" data-bind="attr: {"data-x-wid":socketid}" data-wwclass="wsock">服务器反向通知元素</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script id="_wwblockConfig" data-config="%7B%22nocontainer%22:true%7D"></script>
读取
/**
version=0.22
*/
sp.exports = (function() {
var STRICT = /*INSBEGIN:STRICT*/ true /*INSEND:STRICT*/ ;
var cacheControl = /*INSBEGIN:VCC*/{}/*INSEND:VCC*/ ;
var url_parameter_constraints = /*INSBEGIN:URLPM*/ {} /*INSEND:URLPM*/ ;
var form_parameter_constraints = /*INSBEGIN:FORMPM*/ {} /*INSEND:FORMPM*/ ;
var page_data = {};
function prepare(req, res) {
var tmp_data = {};
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PREPROCESS*/
/*INSEND:PREPROCESS*/
]);
}
/** 公有数据处理函数 */
function getPublicData(req, res, data) {
/* 任何需要返回给客户端的信息务必追加到这个对象上 */
var finish_data = {};
/* tmp_data的作用在于多个代码块之间互相传值 */
var tmp_data = {};
/* 所有输入参数一旦被验证通过了,接下来就可以通过 inputs这个对象来来获取: inputs.key */
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PUBDATA*/
/*INSBEGIN:SEQUENCENOEX*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:SEQUENCE*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
]);
},
/*INSEND:SEQUENCE*/
/*INSBEGIN:SEQUENCE*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:STDQUERY:{}*/
function() {
return when.pipeline([
function() {
var tableName = "wechat";
var from = 0;
var size = 10;
from = 0;
size = 50;
tmp_data.TABLEINFO = tmp_data.TABLEINFO || {};
tmp_data.TABLEINFO[tableName] = tmp_data.TABLEINFO[tableName] || {};
tmp_data.TABLEINFO[tableName].from = from;
tmp_data.TABLEINFO[tableName].size = size;
tmp_data.wechat = tmp_data.wechat || [];
var _tmpIDObj = {};
_tmpIDObj["1"] = 0;
_tmpIDObj["3"] = 0;
_tmpIDObj["6"] = 1;
var q = {
"bool": {
"must": [{
"bool": {
"must": [{
"term": {
"wechat7recordpers": "d06bd4a0feba11e8aac503cf8862ec79"
}
}],
"should": [{
"bool": {
"must": [{
"term": {
"wechat7senderid": "d06bd4a0feba11e8aac503cf8862ec79"
}
}, {
"term": {
"wechat7receiverid": "caa0d430feba11e8aac503cf8862ec79"
}
}]
}
}, {
"bool": {
"must": [{
"term": {
"wechat7senderid": "caa0d430feba11e8aac503cf8862ec79"
}
}, {
"term": {
"wechat7receiverid": "d06bd4a0feba11e8aac503cf8862ec79"
}
}]
}
}]
}
}]
}
};
if (_.isEmpty(q)) {
q = {
"match_all": {}
};
}
var opt = {
from: from,
size: size
};
var sort = ["wechat7sendingtim"];
if (sort.length > 0) {
opt.sort = sort;
}
opt._sourceInclude = ["wechat7senderid", "wechat7receiverid", "wechat7messagecon", "wechat7sendingtim", "wechat7recordpers"];
var db = req.database();
var table = db.getTable(tableName);
return table.exec(q, opt);
},
function(queryResult) {
tmp_data.TABLEINFO.wechat.total = queryResult.hits.total;
var whiteList = {
"wechat7senderid": "默认值",
"wechat7receiverid": "默认值",
"wechat7messagecon": "默认值",
"wechat7sendingtim": "默认值",
"wechat7recordpers": "默认值"
};
_.each(queryResult.hits.hits, function(value, key, list) {
var defaultValue = _.clone(whiteList);
var source = value._source || whiteList;
defaultValue = _.extend(defaultValue, _.pick(source, _.keys(whiteList)));
defaultValue._id = value._id;
tmp_data.wechat.push(defaultValue);
});
return tmp_data.wechat;
}
]) /*INSBEGIN:EXCEPTION*/
/*INSEND:EXCEPTION*/
;
},
//@wweditorinfo:{"id":"fae70fac8678b7a6443cea508b7ed086","editor":{"table":{"method":{"method":"typedTable","tables":"wechat"}},"common":{"method":"query","pagination":true,"resultPosition":"tmp_data","resultName":"wechat","catchException":false,"gatherSort":false,"gatherScore":false,"from":{"from":"const","value":0},"size":{"from":"const_size","value":50}},"query":{"type":{"type":"bool","must":[{"type":"bool","must":[{"type":"term","field":"wechat7recordpers","query":{"query":"const","value":"d06bd4a0feba11e8aac503cf8862ec79"},"boost":1}],"must_not":[],"should":[{"type":"bool","must":[{"type":"term","field":"wechat7senderid","query":{"query":"const","value":"d06bd4a0feba11e8aac503cf8862ec79"},"boost":1},{"type":"term","field":"wechat7receiverid","query":{"query":"const","value":"caa0d430feba11e8aac503cf8862ec79"},"boost":1}],"must_not":[],"should":[{"type":"bool","must":[],"must_not":[],"should":[],"shouldMin":1,"boost":1},{"type":"bool","must":[],"must_not":[],"should":[],"shouldMin":1,"boost":1}],"shouldMin":1,"boost":1},{"type":"bool","must":[{"type":"term","field":"wechat7senderid","query":{"query":"const","value":"caa0d430feba11e8aac503cf8862ec79"},"boost":1},{"type":"term","field":"wechat7receiverid","query":{"query":"const","value":"d06bd4a0feba11e8aac503cf8862ec79"},"boost":1}],"must_not":[],"should":[],"shouldMin":1,"boost":1}],"shouldMin":1,"boost":1}],"must_not":[],"should":[],"shouldMin":1,"boost":1}},"highlight":{"ishighlight":"no","searchfield":{"from":"param","value":"0"},"fields":["_id"],"color":"#ff0000","search":"arguments[0]"},"sort":{"sort":[{"field":{"type":"const","value":"wechat7sendingtim"},"order":{"type":"const","value":"asc"}}],"nextDefaultValue":true},"whitelist":{"_id":true,"wechat7senderid":true,"wechat7receiverid":true,"wechat7messagecon":true,"wechat7sendingtim":true,"wechat7recordpers":true},"withAggs":{"isAggs":false}}}
/*INSEND:STDQUERY*/
/*INSBEGIN:CUSTOM*/
function() {
console.log("=============" + JSON.stringify(tmp_data.wechat));
},
/*INSEND:CUSTOM*/
/*INSBEGIN:CONDITION*/
function(condition) {
if (!_.isEmpty(tmp_data.wechat)) {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:CUSTOM*/
function() {
_.each(tmp_data.wechat, function(v, k, l) {
if (v.wechat7senderid === "d06bd4a0feba11e8aac503cf8862ec79") {
v.wechat7senderid = "Alice";
v.pd = true;
} else {
v.wechat7senderid = "Lily";
v.pd = false;
}
});
//console.log("==============="+JSON.stringify(v.pd));
},
/*INSEND:CUSTOM*/
/*INSEND:SEQUENCEIP*/
function(value) {
return value;
}
]);
}
return false;
},
/*INSEND:CONDITION*/
/*INSBEGIN:STDOUT*/
//@wwcomments:{编号2}页面正常情况下,输出的数据 注意1:页面中信息点的标注方式不同返回数据的格式也不同 注意2:默认是针对数据绑定方式的数据返回格式
function() {
_.extend(finish_data, {
"success": true,
"_runCommand": [{
"command": "updatelv",
"params": [{
"wechat2": tmp_data.wechat,
}]
}]
});
},
//@wweditorinfo:{"id":"cf760ed9cbd5d5e99d047f3b7ac9dad0","editor":{"jsonValue":{"success":true,"_runCommand":[{"command":"updatelv","params":[{"databind_key":"newValue"}]}]},"steppurpose":{"purpose":"finishdata"}}}
/*INSEND:STDOUT*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
]);
},
/*INSEND:SEQUENCE*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
])
.catch(function(err) {
return err;
});
},
/*INSEND:SEQUENCENOEX*/
/*INSBEGIN:EXCEPTCHECK*/
function(except) {
if (except instanceof Error) {
var procedException = false;
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSEND:SEQUENCEIP*/
function(result) {
if (procedException) {
return result;
}
throw except;
}
]);
}
return except;
},
/*INSEND:EXCEPTCHECK*/
/*INSEND:PUBDATA*/
function() {
/*INSBEGIN:MARKDESC {
}
INSEND:MARKDESC*/
var default_data = /*INSBEGIN:MARK*/ {"success":true} /*INSEND:MARK*/ ;
return _.extend(default_data, finish_data);
}
]);
}
/** user数据处理函数 */
function getUserData(req, res, data) {
/* 任何需要返回给客户端的信息务必追加到这个对象上 */
var finish_data = {};
/* tmp_data的作用在于多个代码块之间互相传值 */
var tmp_data = {};
/* 所有输入参数一旦被验证通过了,接下来就可以通过 inputs这个对象来来获取: inputs.key */
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PRIVATEDATA*/
/*INSEND:PRIVATEDATA*/
function() {
/*INSBEGIN:USERMARKDESC {
}
INSEND:USERMARKDESC*/
var default_data = /*INSBEGIN:USERMARK*/ {"success":true} /*INSEND:USERMARK*/ ;
return _.extend(default_data, finish_data);
}
]);
}
/** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!以下内容为系统自动生成,请不要做任何修改!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
var wwgtranslator;
var _wwi = function(str,req) {
if(wwgtranslator && req) {
return reqprocessor.i18nImplement(wwgtranslator,str,req);
}
return str;
};
var wwiInited = false;
var render = {};
// 模板经过编译之后,_ViewName保存了基础的view的名称(也就是文件名部分)。而dotjsFunc保存了主View(not resposive portion)的dotjs函数。
var _ViewName;
/***DOTJSFUNC***/
var option = {
"STRICT": STRICT,
"render": render,
"prepare": prepare,
"_ViewName": _ViewName,
"getUserData": getUserData,
"getPublicData": getPublicData,
"constraints": form_parameter_constraints,
"get_constraints": url_parameter_constraints
};
function process(req, res) {
if (!wwiInited) {
wwiInited = true;
var ret = reqprocessor.i18ninit(req,res,option,function(translator){
wwgtranslator = translator;
});
if(ret) {
return ret;
}
}
return reqprocessor.processHandler(option, req, res);
}
function doPrepare(req, res) {
option.sc = option.sc || {};
_.extend(option.sc,cacheControl.sc);
return reqprocessor.doPrepare(option, req, res);
}
return /*INSPOINTBEGIN:MIDDLEDEP*/ ["session",/*"wxlogin",*/ "passport", doPrepare, "bodyparser", process] /*INSPOINTEND:MIDDLEDEP*/ ;
})();
创建
/**
version=0.22
*/
sp.exports = (function() {
var STRICT = /*INSBEGIN:STRICT*/ {
"strict": true,
"eh": false
} /*INSEND:STRICT*/ ;
var cacheControl = /*INSBEGIN:VCC*/ {} /*INSEND:VCC*/ ;
var url_parameter_constraints = /*INSBEGIN:URLPM*/ {} /*INSEND:URLPM*/ ;
var form_parameter_constraints = /*INSBEGIN:FORMPM*/ {
"wechat7messagecon": {
"type": "string",
"constraints": {
"presence": {
"message": "请输入内容!"
}
}
}
} /*INSEND:FORMPM*/ ;
var page_data = {};
function prepare(req, res) {
var tmp_data = {};
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PREPROCESS*/
/*INSEND:PREPROCESS*/
]);
}
/** 公有数据处理函数 */
function getPublicData(req, res, data) {
/* 任何需要返回给客户端的信息务必追加到这个对象上 */
var finish_data = {};
/* tmp_data的作用在于多个代码块之间互相传值 */
var tmp_data = {};
/* 所有输入参数一旦被验证通过了,接下来就可以通过 inputs这个对象来来获取: inputs.key */
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PUBDATA*/
/*INSBEGIN:SEQUENCENOEX*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:SEQUENCE*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
]);
},
/*INSEND:SEQUENCE*/
/*INSBEGIN:SEQUENCE*/
function() {
return when.pipeline([
/*INSBEGIN:SEQUENCEIP*/
/*INSBEGIN:CUSTOM*/
function() {
tmp_data.nr = [{
"wechat7senderid": "d06bd4a0feba11e8aac503cf8862ec79",
"wechat7receiverid": "caa0d430feba11e8aac503cf8862ec79 ",
"wechat7messagecon": inputs.wechat7messagecon,
"wechat7sendingtim": moment()
.utc()
.format(),
"wechat7recordpers": "caa0d430feba11e8aac503cf8862ec79"
}, {
"wechat7senderid": "d06bd4a0feba11e8aac503cf8862ec79",
"wechat7receiverid": "caa0d430feba11e8aac503cf8862ec79 ",
"wechat7messagecon": inputs.wechat7messagecon,
"wechat7sendingtim": moment()
.utc()
.format(),
"wechat7recordpers": "d06bd4a0feba11e8aac503cf8862ec79"
}];
},
/*INSEND:CUSTOM*/
/*INSBEGIN:MUPDATE*/
function() {
var tableName = "wechat",
docs = [];
return when.pipeline([
function() {
function _2Date(value, format) {
try {
if (!_.isEmpty(format)) {
return moment.utc(value)
.format(format);
} else {
return moment.utc(value)
.format();
}
} catch (e) {
throw {
"status": 200,
"success": false,
"message": {
"status": 200,
"success": false,
"message": "批量更新表[" + tableName + "]中,字段 [" + value + "] 不是合法的时间类型"
}
};
}
}
_.each(tmp_data.nr, function(v, k, l) {
docs.push({
//_id必须存在否则将不能更新对应数据项
"_id": v._id,
"wechat7senderid": v.wechat7senderid,
"wechat7receiverid": v.wechat7receiverid,
"wechat7messagecon": v.wechat7messagecon,
"wechat7sendingtim": _2Date(v.wechat7sendingtim,""),
"wechat7recordpers": v.wechat7recordpers
});
});
},
function() {
if (_.isArray(docs) && docs.length > 0) {
var table = req.database()
.getTable(tableName);
return table.mupdate(docs);
}
}
]);
},
//@wweditorinfo:{"id":"19d4d0cd84f6dd6770ed83b93692492c","editor":{"step1":{"method":{"method":"typedTable","tables":"wechat"}},"selectField":{"_id":true,"wechat7senderid":true,"wechat7receiverid":true,"wechat7messagecon":true,"wechat7sendingtim":true,"wechat7recordpers":true},"step3":{"docList":{"from":"tmp_data","value":"nr"}}}}
/*INSEND:MUPDATE*/
/*INSBEGIN:WSNOTIFY*/
function() {
return reqlib('msgbroker');
},
function(msgbroker) {
function _2Date(value, format) {
try {
if (format) {
return moment.utc(value)
.format(format);
} else {
return moment.utc(value)
.format();
}
} catch (e) {
return value;
}
}
var domain = req.wwdomain();
var uid = "caa0d430feba11e8aac503cf8862ec79";
var msg = {
"command": "MESSAGE",
"headers": {
"random": Math.random(),
"subscription": "sub-0"
},
"body": ""
};
msg.headers._runCommand = JSON.stringify([{
"command": "vmArrFuc",
"params": [
"push",
"wechat", {
"wechat7senderid": "Alice",
"wechat7messagecon": inputs.wechat7messagecon,
"wechat7sendingtim": _2Date(),
"pd": false
}
]
}]);
return msgbroker.notifyuser(domain, uid, msg);
},
//@wweditorinfo:{"id":"a189fffd8eceaebf0c6c516cba3d15c0","editor":{"step1":false,"stepUser":{"domain":{"from":"const","value":"kefu7zxkfb"},"uid":{"from":"tmp_data","value":"0000"},"msg":{"from":"inputs","value":"kefu7zxkfb7ltnr"},"isFilter":false}}}
/*INSEND:WSNOTIFY*/
/*INSBEGIN:REFRESHDB*/
function() {
return req.database()
.refresh();
},
/*INSEND:REFRESHDB*/
/*INSBEGIN:STDOUT*/
//@wwcomments:{编号2}页面正常情况下,输出的数据 注意1:页面中信息点的标注方式不同返回数据的格式也不同 注意2:默认是针对数据绑定方式的数据返回格式
function() {
function _2Date(value, format) {
try {
if (format) {
return moment.utc(value)
.format(format);
} else {
return moment.utc(value)
.format();
}
} catch (e) {
return value;
}
}
_.extend(finish_data, {
"success": true,
"_runCommand": [{
"command": "vmArrFuc",
"params": ["push", "wechat2", {
"wechat7senderid": "Alice",
"wechat7messagecon": inputs.wechat7messagecon,
"pd": true,
"wechat7sendingtim": _2Date(),
}]
}]
});
},
//@wweditorinfo:{"id":"cf760ed9cbd5d5e99d047f3b7ac9dad0","editor":{"jsonValue":{"success":true,"_runCommand":[{"command":"updatelv","params":[{"databind_key":"newValue"}]}]},"steppurpose":{"purpose":"finishdata"}}}
/*INSEND:STDOUT*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
]);
},
/*INSEND:SEQUENCE*/
/*INSEND:SEQUENCEIP*/
function() {
return arguments[0];
}
])
.catch(function(err) {
return err;
});
},
/*INSEND:SEQUENCENOEX*/
/*INSEND:PUBDATA*/
function() {
/*INSBEGIN:MARKDESC {
}
INSEND:MARKDESC*/
var default_data = /*INSBEGIN:MARK*/ {
"success": true
} /*INSEND:MARK*/ ;
return _.extend(default_data, finish_data);
}
]);
}
/** user数据处理函数 */
function getUserData(req, res, data) {
/* 任何需要返回给客户端的信息务必追加到这个对象上 */
var finish_data = {};
/* tmp_data的作用在于多个代码块之间互相传值 */
var tmp_data = {};
/* 所有输入参数一旦被验证通过了,接下来就可以通过 inputs这个对象来来获取: inputs.key */
var inputs = req.params.param || {};
return when.pipeline([
/*INSBEGIN:PRIVATEDATA*/
/*INSEND:PRIVATEDATA*/
function() {
/*INSBEGIN:USERMARKDESC {
}
INSEND:USERMARKDESC*/
var default_data = /*INSBEGIN:USERMARK*/ {
"success": true
} /*INSEND:USERMARK*/ ;
return _.extend(default_data, finish_data);
}
]);
}
/** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!以下内容为系统自动生成,请不要做任何修改!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
var wwgtranslator;
var _wwi = function(str, req) {
if (wwgtranslator && req) {
return reqprocessor.i18nImplement(wwgtranslator, str, req);
}
return str;
};
var wwiInited = false;
var render = {};
// 模板经过编译之后,_ViewName保存了基础的view的名称(也就是文件名部分)。而dotjsFunc保存了主View(not resposive portion)的dotjs函数。
var _ViewName;
/***DOTJSFUNC***/
var option = {
"STRICT": STRICT,
"render": render,
"prepare": prepare,
"_ViewName": _ViewName,
"getUserData": getUserData,
"getPublicData": getPublicData,
"constraints": form_parameter_constraints,
"get_constraints": url_parameter_constraints
};
function process(req, res) {
if (!wwiInited) {
wwiInited = true;
var ret = reqprocessor.i18ninit(req, res, option, function(translator) {
wwgtranslator = translator;
});
if (ret) {
return ret;
}
}
return reqprocessor.processHandler(option, req, res);
}
function doPrepare(req, res) {
option.sc = option.sc || {};
_.extend(option.sc, cacheControl.sc);
return reqprocessor.doPrepare(option, req, res);
}
return /*INSPOINTBEGIN:MIDDLEDEP*/ ["session", /*"wxlogin",*/ "passport", doPrepare, "bodyparser", process] /*INSPOINTEND:MIDDLEDEP*/ ;
})();