diff --git a/config/menu.yml b/config/menu.yml index c88e94ec4..711b087d1 100644 --- a/config/menu.yml +++ b/config/menu.yml @@ -1,13 +1,20 @@ button: - - type: "click" + type: "view" name: "最新动态" - key: "MY_NEWS" + url: "http://wechat.trustie.net/assets/wechat/issue.html" - type: "click" name: "意见返馈" key: "FEEDBACK" - - type: "view" - name: "进入网站" - url: "http://www.trustie.net/" \ No newline at end of file + name: "更多" + sub_button: + - + type: "view" + name: "进入网站" + url: "http://www.trustie.net/" + - + type: "view" + name: "使用手册" + url: "https://www.trustie.net/organizations/1/downloads" \ No newline at end of file diff --git a/public/assets/wechat/issue.html b/public/assets/wechat/issue.html new file mode 100644 index 000000000..7b6eedde2 --- /dev/null +++ b/public/assets/wechat/issue.html @@ -0,0 +1,52 @@ + + + + react js + + + + + + + + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/public/javascripts/wechat/wechat-dev.js b/public/javascripts/wechat/wechat-dev.js new file mode 100644 index 000000000..9c5704b8c --- /dev/null +++ b/public/javascripts/wechat/wechat-dev.js @@ -0,0 +1,54 @@ +/** + * Created by root on 3/25/16. + */ +$(document).ready(function(){ + + var bt=baidu.template; + bt.LEFT_DELIMITER=''; + + + var apiUrl = '/api/v1/' + var setTemplate = function(data){ + console.log(data); + + + var html=bt('t:result-list',{issues: data}); + $('#container').prepend(html); + } + + var loadDataFromServer = function(id){ + $.ajax({ + url: apiUrl + 'issues/' + id, + dataType: 'json', + success: function(data){ + setTemplate(data.data); + }, + error: function(xhr,status,err){ + console.log(err); + } + }) + }; + + + loadDataFromServer(299); + + + var postWidth = $(".post-wrapper").width(); + var titleWidth = postWidth - 80; + $(".post-title").css("maxWidth",titleWidth); + + $(".post-all-content").each(function(){ + var postHeight = $(this).height(); + if (postHeight > 90){ + $(this).parent().next().css("display","block"); + $(this).parent().next().toggle(function(){ + $(this).text("点击隐藏"); + $(this).prev().css("height",postHeight); + },function(){ + $(this).text("点击展开"); + $(this).prev().css("height",90); + }); + } + }); +}); diff --git a/public/javascripts/wechat/wechat.jsx b/public/javascripts/wechat/wechat.jsx index 29a8da732..86d92318b 100644 --- a/public/javascripts/wechat/wechat.jsx +++ b/public/javascripts/wechat/wechat.jsx @@ -10,6 +10,8 @@ var Index = React.createClass({ var apiUrl = '/api/v1/'; +var converter = new Showdown.converter(); + var PostContainer = React.createClass({ loadDataFromServer: function(){ $.ajax({ @@ -31,36 +33,52 @@ var PostContainer = React.createClass({ }, render: function(){ return ( -
-
- -
-
- ) + + )issues } }); var PostView = React.createClass({ + testClick: function(){ + console.log("123123"); + }, + render: function(){ if(!this.props.data){ return
} - return ( -
-
-
{this.props.data.subject}
-
{this.props.data.author.nickname}项目问题
-
-
-

{this.props.data.description}

+ + var issueEach = this.props.data.map(function(issue){ + + var descMarkup = converter.makeHtml(issue.description.toString()); + + return ( +
+
+
+
+
{issue.subject}
+ +
+
+
+
+ 点击展开 +
+ {issue.created_on} +
+
+
- 点击展开 -
- {this.props.data.time} -
-
- ) + ) + }); + + return( +
{issueEach}
+ ); + + } }); @@ -77,5 +95,3 @@ var routes = ( React.render(routes, document.getElementById("container")); - -