Skip to content

Commit

Permalink
修改各种bug。增加分享
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Aug 28, 2017
1 parent e7e4773 commit 31a4bde
Show file tree
Hide file tree
Showing 903 changed files with 888 additions and 203,480 deletions.
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<modules>
<module>xiaoyaoji-pdf</module>
<module>xiaoyaoji-biz</module>
<module>xiaoyaoji-config</module>
<module>xiaoyaoji-plugins</module>
<module>xiaoyaoji-web</module>
<module>xiaoyaoji-login-plugin</module>
Expand Down
2 changes: 2 additions & 0 deletions xiaoyaoji-biz/src/main/java/cn/com/xiaoyaoji/data/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public interface Data {

ProjectGlobal getProjectGlobal(String projectId);

ProjectGlobal getProjectGlobal(String projectId,String column);

List<Attach> getAttachsByRelatedId(String relatedId);

List<DocHistory> getDocHistorys(String docId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public List<Project> handle(Connection connection, QueryRunner qr) throws SQLExc
.append(" p left join user u on u.id = p.userId ")
.append(" left join project_user pu on pu.projectId = p.id ")
.append(" where ( pu.userId=?) and p.status=?")
.append(" order by createTime asc");
.append(" order by createTime desc");
return qr.query(connection, sql.toString(), new BeanListHandler<>(Project.class), pagination.getParams().get("userId"), status);
}
});
Expand Down Expand Up @@ -833,6 +833,25 @@ public ProjectGlobal handle(Connection connection, QueryRunner qr) throws SQLExc
});
}

@Override
public ProjectGlobal getProjectGlobal(final String projectId,final String column) {
return process(new Handler<ProjectGlobal>() {
@Override
public ProjectGlobal handle(Connection connection, QueryRunner qr) throws SQLException {
ProjectGlobal pg = qr.query(connection, "select "+column+" from " + TableNames.PROJECT_GLOBAL + " where projectId=?", new BeanHandler<>(ProjectGlobal.class), projectId);
if (pg == null) {
//会有并发问题
pg = generateProjectGlobal(projectId);
SQLBuildResult sbr = SqlUtils.generateInsertSQL(pg);
if (qr.update(connection, sbr.getSql(), sbr.getParams()) == 0) {
throw new SystemErrorException("创建project_global失败");
}
}
return pg;
}
});
}


public ProjectGlobal generateProjectGlobal(String projectId) {
ProjectGlobal pg = new ProjectGlobal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ public ProjectGlobal getProjectGlobal(String projectId){
return DataFactory.instance().getProjectGlobal(projectId);
}

public ProjectGlobal getProjectGlobalEnvironment(String projectId){
return DataFactory.instance().getProjectGlobal(projectId,"environment");
}
public ProjectGlobal getProjectGlobalStatus(String projectId){
return DataFactory.instance().getProjectGlobal(projectId,"status");
}



/**
* 修改最后更新时间
* @param projectId
Expand Down
11 changes: 0 additions & 11 deletions xiaoyaoji-config/pom.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public User doRequest(HttpServletRequest request) {
public String getOpenURL() {
String clientid = getPluginInfo().getConfig().get("clientId");
String redirectUri = getPluginInfo().getConfig().get("redirectUri");
return "https://github.com/login/oauth/authorize?client_id="+clientid+"&redirect_uri="+redirectUri+"/github&scope=user&state=login";
return "https://github.com/login/oauth/authorize?client_id="+clientid+"&redirect_uri="+redirectUri+"&scope=user&state=login";
}

@Override
Expand Down
102 changes: 52 additions & 50 deletions xiaoyaoji-plugins/src/main/plugin-resources/web/http/edit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,63 @@
<div id="api-edit-details">
<div id="api-edit-content" class="form">
<ul uk-tab><li class="uk-active"><a>基本信息</a></li></ul>
<div class="item uk-grid-small" uk-grid>
<div class="uk-width-1-4">
<div uk-grid>
<label class="uk-form-label uk-width-1-2 uk-form-small">请求方法</label>
<select v-model="content.requestMethod" class="uk-select uk-form-small uk-width-1-2">
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="DELETE">DELETE</option>
<option value="PATCH">PATCH</option>
<option value="COPY">COPY</option>
<option value="OPTIONS">OPTIONS</option>
</select>
</div>
</div>
<div class="uk-width-1-4">
<div class="uk-grid">
<label class="uk-form-label uk-width-3-5 uk-form-small">请求数据类型</label>
<select v-model="content.dataType" class="uk-select uk-form-small uk-width-2-5">
<option value="X-WWW-FORM-URLENCODED">X-WWW-FORM-URLENCODED</option>
<template v-if="content.requestMethod == 'POST'">
<option value="FORM-DATA">FORM-DATA</option>
<option value="BINARY">BINARY</option>
</template>
<option value="JSON">JSON</option>
<option value="RAW">RAW</option>
<option value="XML">XML</option>
</select>
</div>
<div class="item">
<div class="col-sm-1 label">请求方法</div>
<div class="col-sm-2">
<select v-model="content.requestMethod" class="uk-select">
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="DELETE">DELETE</option>
<option value="PATCH">PATCH</option>
<option value="COPY">COPY</option>
<option value="OPTIONS">OPTIONS</option>
</select>
</div>
<div class="uk-width-1-4">
<div class="uk-grid">
<label class="uk-form-label uk-width-1-2 uk-form-small">响应类型</label>
<select v-model="content.contentType" class="uk-select uk-form-small uk-width-1-2">
<option value="JSON">JSON</option>
<option value="JSONP">JSONP</option>
<option value="TEXT">TEXT</option>
<option value="XML">XML</option>
<option value="HTML">HTML</option>
<option value="IMAGE">IMAGE</option>
<div class="col-sm-1 label">请求数据类型</div>
<div class="col-sm-2">
<select v-model="content.dataType" class="uk-select">
<option value="X-WWW-FORM-URLENCODED">X-WWW-FORM-URLENCODED</option>
<template v-if="content.requestMethod == 'POST'">
<option value="FORM-DATA">FORM-DATA</option>
<option value="BINARY">BINARY</option>
</select>
</div>
</template>
<option value="JSON">JSON</option>
<option value="RAW">RAW</option>
<option value="XML">XML</option>
</select>
</div>
<div class="col-sm-1 label">响应类型</div>
<div class="col-sm-2">
<select v-model="content.contentType" class="uk-select">
<option value="JSON">JSON</option>
<option value="JSONP">JSONP</option>
<option value="TEXT">TEXT</option>
<option value="XML">XML</option>
<option value="HTML">HTML</option>
<option value="IMAGE">IMAGE</option>
<option value="BINARY">BINARY</option>
</select>
</div>
<div v-if="global.status.length>0" class="uk-width-1-4">
<div class="uk-grid">
<label class="uk-form-label uk-width-1-2 uk-form-small">状态</label>
<select v-model="content.status" class="uk-select uk-form-small uk-width-1-2">
<option :value="item.name" v-for="item in global.status" v-bind:selected="item.name==content.status">{{item.name}}</option>
</select>
</div>

</div>
<div class="col-sm-1 label" v-if="global.status.length>0" >状态</div>
<div class="col-sm-2" v-if="global.status.length>0" >
<select v-model="content.status" class="uk-select">
<option :value="item.name" v-for="item in global.status" v-bind:selected="item.name==content.status">{{item.name}}</option>
</select>
</div>

</div>


<div class="item">
<div class="col-sm-1 label">接口名称</div>
<div class="col-sm-11">
<input type="text" class="uk-input" maxlength="30" placeholder="请输入接口名称"
v-model="doc.name" :value="doc.name">
</div>
</div>

<div class="item">
<div class="col-sm-1 label">接口名称</div>
<div class="col-sm-11">
Expand Down Expand Up @@ -209,7 +211,7 @@
</div>
</div>
<ul uk-tab><li class="uk-active"><a>示例数据</a></li></ul>
<textarea class="api-example api-field uk-textarea" v-model="content.example"
<textarea rows="5" class="api-example api-field uk-textarea" v-model="content.example"
placeholder="请添加一些示例数据">{{content.example}}</textarea>
<ul uk-tab><li class="uk-active"><a>附件</a></li></ul>
<div class="doc-http-attach">
Expand Down
16 changes: 14 additions & 2 deletions xiaoyaoji-plugins/src/main/plugin-resources/web/http/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ requirejs(['utils', 'vue',
localStorage.setItem(key, value);
}
}

if(!(url.indexOf('http://') || url.indexOf('https://'))){
url = 'http://'+url;
}

var params = {
url: url,
Expand Down Expand Up @@ -419,7 +421,13 @@ requirejs(['utils', 'vue',

this.global = g;
new Clipboard('.content-copy');
this.currentEnv = g.environment[0] || {};

var temp = localStorage.getItem(_projectId_+"_currentEnv");
if(temp){
this.currentEnv = JSON.parse(temp);
}else{
this.currentEnv = g.environment[0] || {};
}

initUrlArgs.call(this);
window.content =this.content;
Expand Down Expand Up @@ -505,6 +513,10 @@ requirejs(['utils', 'vue',
win.document.documentElement.innerHTML = '';
win.document.write(utils.unescape(this.result.content));
win.document.close();
},
changeEnv:function(item){
this.currentEnv=item;
localStorage.setItem(_projectId_+"_currentEnv",JSON.stringify(item))
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
</button>
<div uk-dropdown="mode: click; boundary: ! .uk-button-group; boundary-align: true;">
<ul class="uk-nav uk-dropdown-nav">
<li v-for="item in global.environment" v-on:click="currentEnv=item" v-bind:class="{'uk-active':item.t == currentEnv.t}"><a href="#">{{item.name}}</a></li>
<li v-for="item in global.environment" v-on:click="changeEnv(item)" v-bind:class="{'uk-active':item.t == currentEnv.t}"><a href="#">{{item.name}}</a></li>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link rel="stylesheet" href="${ctx}/proxy/${pluginInfo.id}/assets/editor.md/lib/codemirror/addon/fold/foldgutter.css?v=${pluginInfo.version}"/>
<link rel="stylesheet" href="${ctx}/proxy/${pluginInfo.id}/assets/editor.md/css/editormd.min.css?v=${pluginInfo.version}"/>
<script>
$(function(){
(function(){
requirejs.config({
baseUrl:'${ctx}/proxy/${pluginInfo.id}/assets/',
urlArgs:'v=${pluginInfo.version}',
Expand Down Expand Up @@ -57,7 +57,7 @@
var editor = editormd('editormd', {
path: '${ctx}/proxy/${pluginInfo.id}/editor.md/lib/',
width: '100%',
height: $(window).height()-200,
height: $(window).height()-20,
flowChart: false,
sequenceDiagram: false,
markdown:(doc.content || ''),
Expand Down Expand Up @@ -96,7 +96,7 @@
}
})
});
})();
</script>
42 changes: 23 additions & 19 deletions xiaoyaoji-plugins/src/main/plugin-resources/web/richtext/edit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,48 @@
Time: 22:43
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link rel="stylesheet" type="text/css" href="${ctx}/proxy/${pluginInfo.id}/assets/wangeditor/dist/css/wangEditor.min.css">
<div class="docWeApp" id="docWeApp" v-cloak>
<div id="we" style="height: 600px;">${doc.content}</div>

<div class="docWeApp" id="docWeApp">
<div id="we">${doc.content}</div>
</div>
<script>
$(function () {
var editJs = '${ctx}/proxy/${pluginInfo.id}/assets/wangeditor3/wangEditor.js';
(function () {
function resizeHeight(f) {
var height = $(window).height() - $('.doc-content').offset().top - 40;
if(!f){
//it's a bug for wangeditor
height-=45;
}
$('#we').height(height);
var height = $(window).height() - $('.doc-content').offset().top - 60;
$('.w-e-text-container').height(height);
}
$(window).resize(function(){resizeHeight()});
resizeHeight(true);
require(['vue', '${ctx}/proxy/${pluginInfo.id}/assets/wangeditor/dist/js/wangEditor.js'], function (Vue) {
$(window).resize(function () {
resizeHeight()
});
require(['vue', editJs], function (Vue,wangEditor) {
var editor;
var app = new Vue({
new Vue({
el: '#docWeApp',
data: {
editorContent: ''
},
mounted: function () {
var self = this;
editor = new wangEditor('we');
editor = new wangEditor('#we');
editor.onchange = function () {
// onchange 事件中更新数据
self.editorContent = editor.$txt.html();
self.editorContent = editor.txt.html();
};
editor.create();
resizeHeight(true);
}
});
window.getDoc = function () {
return {
content: editor.$txt.html()
content: editor.txt.html()
}
}
});
});
</script>
})();
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
Time: 22:43
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.we-doc-name{
width: 100%;
padding: 8px 20px;
font-size: 18px;
border: none;
}
</style>
<link rel="stylesheet" type="text/css" href="${ctx}/proxy/${pluginInfo.id}/assets/wangeditor/dist/css/wangEditor.min.css">
<div class="docWeApp" id="docWeApp">
<div id="we">${doc.content}</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<ul uk-tab>
<li class="uk-active"><a>示例数据</a></li>
</ul>
<textarea class="api-example api-field uk-textarea" v-model="content.example"
<textarea rows="5" class="api-example api-field uk-textarea" v-model="content.example"
placeholder="请添加一些示例数据">{{content.example}}</textarea>
<ul uk-tab>
<li class="uk-active"><a>附件</a></li>
Expand Down
Loading

0 comments on commit 31a4bde

Please sign in to comment.