diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 5773d7297..b4f4d6683 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -129,10 +129,12 @@ class ChallengesController < ApplicationController end def destroy + next_challenges = @shixun.challenges.where("position > #{@challenge.position}") + next_challenges.update_all("position = position - 1") @challenge.destroy - respond_to do |format| - format.html{redirect_to shixun_challenges_path(@shixun)} - end + @challenges = @shixun.challenges + + add_shixun_modify_status(@shixun, 1) end def update diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 1bb5dfaeb..c711acbf2 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -35,12 +35,12 @@ class GamesController < ApplicationController end # logger.info("#################%%%%%%#{@game.outputs.first.out_put}") # @games = @myshixun.games.includes(:challenge) + @game_challenge = @game.challenge @challenges = Challenge.where(:shixun_id => @myshixun.shixun_id) @shixun = @myshixun.shixun - @praise_count = PraiseTread.where(:praise_tread_object_id => @challenges, :praise_tread_object_type => "Challenge").count - @tread_count = PraiseTread.where(:praise_tread_object_id => @challenges, :praise_tread_object_type => "ChallengeTread").count + @praise_count = PraiseTread.where(:praise_tread_object_id => @game_challenge.id, :praise_tread_object_type => "Challenge").count + @tread_count = PraiseTread.where(:praise_tread_object_id => @game_challenge.id, :praise_tread_object_type => "ChallengeTread").count # @games_count = @games.count - @game_challenge = @game.challenge @st = @game_challenge.st @had_done = @game.had_done @praise = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?", @game_challenge.id, @game_challenge.class.to_s, User.current.id).first @@ -218,8 +218,8 @@ class GamesController < ApplicationController @game.update_attribute(:end_time, Time.now) game_passed_code(@game.id, game_challenge.try(:path), @myshixun.try(:gpid), 1) if !@game.answer_open && shixun.status > 1 - reward_grade(@game.user, @game.id, @game.class, game_challenge.score) - reward_experience(@game.user, @game.id, @game.class, game_challenge.score) + reward_grade(@game.user, @game.id, 'Game', game_challenge.score) + reward_experience(@game.user, @game.id, 'Game', game_challenge.score) end end game_status = @game.status @@ -295,7 +295,11 @@ class GamesController < ApplicationController had_done = @game.had_done shixun = @myshixun.shixun if shixun.status > 1 && !@game.answer_open - User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score)) if correct + if correct + #User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score)) + reward_grade(@game.user, @game.id, 'Game', game_challenge.score) + reward_experience(@game.user, @game.id, 'Game', game_challenge.score) + end end if @game.outputs.blank? Output.create(:game_id => @game.id, :actual_output => user_answer, :result => correct) diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index d202a8fb4..ad8655bdb 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -22,9 +22,9 @@ class PraiseTreadController < ApplicationController if(params[:game_praise] == "true") pts.delete if params[:obj_type] == "Challenge" - praise_tread_count = PraiseTread.where(:praise_tread_object_id => params[:obj_id], :praise_tread_object_type => "Challenge").count + praise_tread_count = PraiseTread.where(:praise_tread_object_id => @obj_id, :praise_tread_object_type => "Challenge").count else - praise_tread_count = PraiseTread.where(:praise_tread_object_id => params[:obj_id], :praise_tread_object_type => "ChallengeTread").count + praise_tread_count = PraiseTread.where(:praise_tread_object_id =>@obj_id, :praise_tread_object_type => "ChallengeTread").count end render :json => {praise: false, praise_tread_count: praise_tread_count} return @@ -46,9 +46,9 @@ class PraiseTreadController < ApplicationController # end if params[:game_praise] == "true" if params[:obj_type] == "Challenge" - praise_tread_count = PraiseTread.where(:praise_tread_object_id => params[:obj_id], :praise_tread_object_type => "Challenge").count + praise_tread_count = PraiseTread.where(:praise_tread_object_id => @obj_id, :praise_tread_object_type => "Challenge").count else - praise_tread_count = PraiseTread.where(:praise_tread_object_id => params[:obj_id], :praise_tread_object_type => "ChallengeTread").count + praise_tread_count = PraiseTread.where(:praise_tread_object_id => @obj_id, :praise_tread_object_type => "ChallengeTread").count end render :json => {praise: true, praise_tread_count: praise_tread_count} return diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index eab591a15..6fd7bcf21 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -78,14 +78,18 @@ class ShixunsController < ApplicationController end def index - @order = "created_at" - @sort = "desc" + @order = "myshixun_count" + @sort = "asc" search = params[:search] @shixun_all_count = Shixun.all.count #@shixuns = Shixun.find_by_sql("select * from shixuns where id in (SELECT distinct(shixun_id) FROM `challenges`) and name like '%#{search}%' order by created_at desc") @shixuns = Shixun.where("name like ?", "%#{search}%").reorder("created_at desc") # @shixun_my_score = Game.find_by_sql("select sum(final_score) as score from games where myshixun_id in (select id from myshixuns where status =1 # and user_id=#{User.current.id} and shixun_id in (SELECT id FROM `shixuns` where status > 1))").first.try(:score).to_i + @shixuns.each do |shixun| + shixun[:myshixunCount] = shixun.myshixuns.count + end + @shixuns = @shixuns.sort{|x, y| y[:myshixunCount] <=> x[:myshixunCount]} @shixun_my_score = Experience.find_by_sql("SELECT sum(score) as score FROM `experiences` where user_id=#{User.current.id}").first.try(:score).to_i @current_user_had_passed = Myshixun.find_by_sql("select count(*) as had_passed from myshixuns where status =1 and user_id=#{User.current.id} and shixun_id in (SELECT id FROM `shixuns` where status > 1)").first.try(:had_passed).to_i @@ -154,7 +158,7 @@ class ShixunsController < ApplicationController def search # 确定 sort 1升序 2 降序 - @order = params[:order] || "created_at" + @order = params[:order] || "myshixun_count" bsort = params[:sort] || "desc" @sort = bsort == "desc" ? "asc" : "desc" if @order == "created_at" @@ -218,7 +222,11 @@ class ShixunsController < ApplicationController @shixuns.each do |shixun| shixun[:myshixunCount] = shixun.myshixuns.count end - @shixuns = @shixuns.sort{|x, y| y[:myshixunCount] <=> x[:myshixunCount]} + if bsort == "desc" + @shixuns = @shixuns.sort{|x, y| y[:myshixunCount] <=> x[:myshixunCount]} + else + @shixuns = @shixuns.sort{|x, y| x[:myshixunCount] <=> y[:myshixunCount]} + end end # @shixuns = Shixun.where(:authentication => 1).reorder(order) @shixuns_count = @shixuns.count diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 012f3be73..d1fb01bac 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -45,7 +45,7 @@ class UsersController < ApplicationController :user_courses4show,:user_projects4show,:user_contests4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list, :sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community, - :shixuns, :user_show_course_list, :shixuns_or_courses_filter, :user_wathlist_and_fanslist] + :shixuns, :user_show_course_list, :shixuns_or_courses_filter, :user_wathlist_and_fanslist, :growth_record, :user_grade, :user_experience] before_filter :auth_user_extension, only: :show before_filter :show_system_message, :only => [:show] #before_filter :rest_user_score, only: :show @@ -2277,6 +2277,40 @@ class UsersController < ApplicationController end end + def growth_record + @user_tags = @user.experiences.reorder("created_at desc") + @limit = 20 + @is_remote = true + @tags_count = @user_tags.count + @tags_pages = Paginator.new @tags_count, @limit, params['page'] || 1 + @offset ||= @tags_pages.offset + @user_tags = paginateHelper @user_tags, @limit + respond_to do |format| + format.js + format.html {render :layout => 'base_edu_user'} + end + end + + def user_experience + @user_experiences = @user.experiences.reorder("created_at desc") + @limit = 20 + @is_remote = true + @experiences_count = @user_experiences.count + @experiences_pages = Paginator.new @experiences_count, @limit, params['page'] || 1 + @offset ||= @experiences_pages.offset + @user_experiences = paginateHelper @user_experiences, @limit + end + + def user_grade + @type = params[:type] ? params[:type].to_i : 1 + @user_grades = @type == 1 ? @user.grades.where("score > 0").reorder("created_at desc") : @user.grades.where("score < 0").reorder("created_at desc") + @limit = 20 + @is_remote = true + @grades_count = @user_grades.count + @grades_pages = Paginator.new @grades_count, @limit, params['page'] || 1 + @offset ||= @grades_pages.offset + @user_grades = paginateHelper @user_grades, @limit + end def user_show_course_list @courses = @user.courses.not_deleted_not_end.order("updated_at desc") diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c9cef2a8e..1c098ae1b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3012,9 +3012,8 @@ module ApplicationHelper end end - def identity_authentication_status user_id - apply = ApplyAction.where(:user_id => user_id).first - case apply.try(:status) + def identity_authentication_status status + case status when nil "未授权" when 0 @@ -3026,6 +3025,38 @@ module ApplicationHelper end end + def user_certification_status user + status = "" + if user.authentication + status = "已实名认证" + else + apply_auth = ApplyUserAuthentication.where(:user_id => user.id, :auth_type => 1).last + if apply_auth && apply_auth.status == 0 + status = "实名认证中" + elsif apply_auth && apply_auth.status == 2 + status = "实名认证未通过" + else + status = "未实名认证" + end + end + end + + def pro_certification_status user + status = "" + if user.professional_certification + status = "已职业认证" + else + apply_auth = ApplyUserAuthentication.where(:user_id => user.id, :auth_type => 2).last + if apply_auth && apply_auth.status == 0 + status = "职业认证中" + elsif apply_auth && apply_auth.status == 2 + status = "职业认证未通过" + else + status = "未职业认证" + end + end + end + def shixun_authentication_status shixun case shixun.try(:status) when 0,nil diff --git a/app/models/experience.rb b/app/models/experience.rb index c229f5f35..1892f2f13 100644 --- a/app/models/experience.rb +++ b/app/models/experience.rb @@ -1,3 +1,5 @@ class Experience < ActiveRecord::Base attr_accessible :container_id, :container_type, :score, :user_id + + belongs_to :user end diff --git a/app/models/grade.rb b/app/models/grade.rb index d0b686dfd..b4fae2b09 100644 --- a/app/models/grade.rb +++ b/app/models/grade.rb @@ -1,5 +1,7 @@ # container_type: -# Phone-手机注册;Mail-邮箱绑定;Account-完善资料 +# Phone-手机注册;Mail-邮箱绑定;Account-完善资料;Answer-查看参考答案;Game-闯关 class Grade < ActiveRecord::Base attr_accessible :container_id, :container_type, :score, :user_id + + belongs_to :user end diff --git a/app/models/user.rb b/app/models/user.rb index 14ce956e7..1580df643 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -130,6 +130,7 @@ class User < Principal has_many :shixuns, :through => :shixun_members has_many :shixun_members, :dependent => :destroy has_many :challenges, :dependent => :destroy + has_many :games, :dependent => :destroy has_many :subjects @@ -202,6 +203,9 @@ class User < Principal ##### has_many :shares ,:dependent => :destroy + has_many :grades + has_many :experiences + ### has_many :apply_actions, :dependent => :destroy @@ -310,6 +314,13 @@ class User < Principal end end } + def challenge_tags + shixuns = Shixun.where(:id => Myshixun.where(:user_id => self.id).map(&:shixun_id), :status => [2,3]) + myshixuns = Myshixun.where(:user_id => self.id, :shixun_id => shixuns.map(&:id)) + games = self.games.where(:myshixun_id => myshixuns.map(&:id), :status => 2) + challenge_tags = ChallengeTag.where(:challenge_id => games.map(&:challenge_id)) + end + def self.search(query) __elasticsearch__.search( { @@ -1420,21 +1431,21 @@ class User < Principal # 为新注册用户发送留言 # 只发三条没可以不用delay job,而且这个最好是注册的时候就能看到 def add_new_jour - Rails.logger.info "add_new_jour_delay!!!!!!!!!" - if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0" - if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? - lead_message1 = Message.find(19292) - notes1 = lead_message1.content - lead_message2 = Message.find(19291) - notes2 = lead_message2.content - lead_message3 = Message.find(19504) - notes3 = lead_message3.content - #user_id 默认为课程使者创建 - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - end - end + # Rails.logger.info "add_new_jour_delay!!!!!!!!!" + # if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0" + # if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? + # lead_message1 = Message.find(19292) + # notes1 = lead_message1.content + # lead_message2 = Message.find(19291) + # notes2 = lead_message2.content + # lead_message3 = Message.find(19504) + # notes3 = lead_message3.content + # #user_id 默认为课程使者创建 + # self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + # self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + # self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + # end + # end # self.delay.add_new_jour_delay end diff --git a/app/views/challenges/_content_list.html.erb b/app/views/challenges/_content_list.html.erb index 7cc37a224..91a7e2e31 100644 --- a/app/views/challenges/_content_list.html.erb +++ b/app/views/challenges/_content_list.html.erb @@ -38,13 +38,14 @@ <% if User.current.manager_of_shixun?(@shixun) && @shixun.status == 0 %>

+ <% unless challenge.position < 2 %> - + <% end %> <% if @shixun.challenges.count != challenge.position %> - + <% end %> - +

diff --git a/app/views/challenges/_edit_skill.html.erb b/app/views/challenges/_edit_skill.html.erb index f57446c82..599337fa2 100644 --- a/app/views/challenges/_edit_skill.html.erb +++ b/app/views/challenges/_edit_skill.html.erb @@ -10,7 +10,7 @@
diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb index 6f1096100..74a8fca4d 100644 --- a/app/views/games/show.html.erb +++ b/app/views/games/show.html.erb @@ -26,7 +26,7 @@ var nRIcon = $("#extend_and_zoom").children("i"); // 版本库放大缩小按钮 var nCode = $("#file_entry_content").find(".CodeMirror-scroll"); // 版本库代码区域 var nVIcon = $("#valuation_extend_and_zoom").children("i"); // 评测放大缩小 - var nMove =$(".h-center"); + var nMove = $(".h-center"); /* --------------------------------版本库的放大与缩小---------------------------------------------*/ function repository_extend_and_zoom(){ diff --git a/app/views/managements/_trial_authorization_list.html.erb b/app/views/managements/_trial_authorization_list.html.erb index 1845b143e..1d6500be8 100644 --- a/app/views/managements/_trial_authorization_list.html.erb +++ b/app/views/managements/_trial_authorization_list.html.erb @@ -23,7 +23,8 @@ <%= user.try(:user_extensions).try(:student_id) %> <% end %> <% end %> - <%= identity_authentication_status(User.current.id) %> + <%= user_certification_status(user) %> + <%= pro_certification_status(user) %>
  • diff --git a/app/views/managements/_trial_authorization_passed_list.html.erb b/app/views/managements/_trial_authorization_passed_list.html.erb index 0ee16a735..8b621340c 100644 --- a/app/views/managements/_trial_authorization_passed_list.html.erb +++ b/app/views/managements/_trial_authorization_passed_list.html.erb @@ -22,7 +22,8 @@ <%= user.try(:user_extensions).try(:student_id) %> <% end %> <% end %> - <%= identity_authentication_status(User.current.id) %> + <%= user_certification_status(user) %> + <%= pro_certification_status(user) %>
  • <% if authorization.status == 2 %>
  • 原因:<%= authorization.reason.blank? ? "空" : authorization.reason %>
  • diff --git a/app/views/managements/_users_authorization_list.html.erb b/app/views/managements/_users_authorization_list.html.erb index 8b077f6af..666f2bdfa 100644 --- a/app/views/managements/_users_authorization_list.html.erb +++ b/app/views/managements/_users_authorization_list.html.erb @@ -14,7 +14,7 @@ <% @users.each do |user| %> - <% authorization = ApplyAction.where(:user_id => user).first %> + <% authorization = ApplyAction.where(:user_id => user, :container_type => "TrialAuthorization").last %> @@ -29,7 +29,7 @@ <%= user.professional_certification ? "已认证" : "未认证" %> <%= user.try(:user_extensions).try(:school).try(:name).blank? ? "--" : user.try(:user_extensions).try(:school) %> <%= user.try(:user_extensions).department ? user.try(:user_extensions).try(:department).try(:name).to_s : '--' %> - <%= identity_authentication_status(user.id) %> + <%= identity_authentication_status(authorization.try(:status)) %> <% end %> diff --git a/app/views/shixuns/_shixun_list.html.erb b/app/views/shixuns/_shixun_list.html.erb index f8965b239..e0823c79c 100644 --- a/app/views/shixuns/_shixun_list.html.erb +++ b/app/views/shixuns/_shixun_list.html.erb @@ -1,11 +1,10 @@ -
    <% if @shixuns.blank? %> diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index a6b2eb37c..8f56ebd11 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -39,6 +39,11 @@ <% end %> <% end %>
    + <% unless User.current.manager_of_shixun?(@shixun) %> + <%= @shixun.language %> + <%= @shixun.shixun_trainee %> + <%= @shixun.shixun_major_courses.blank? ? "" : CourseList.where(:id => @shixun.shixun_major_courses.map(&:course_list_id)).map(&:name).join("、") %> + <% end %>
    diff --git a/app/views/users/_user_experience.html.erb b/app/views/users/_user_experience.html.erb new file mode 100644 index 000000000..843afcaf3 --- /dev/null +++ b/app/views/users/_user_experience.html.erb @@ -0,0 +1,4 @@ +

    当前经验值:<%= @user.experience %>,您可以通过<%= link_to '实训挑战', shixuns_path(), :class => "color-orange03" %>的方式获得经验值

    +
    + <%= render :partial => "users/user_experience_content" %> +
    \ No newline at end of file diff --git a/app/views/users/_user_experience_content.html.erb b/app/views/users/_user_experience_content.html.erb new file mode 100644 index 000000000..94031e0df --- /dev/null +++ b/app/views/users/_user_experience_content.html.erb @@ -0,0 +1,38 @@ +<% if @user_experiences.blank? %> +
    + +

    您还没有获得过经验值哦~

    +
    +<% else %> + + + + + + + + + + + <% @user_experiences.each do |exp| %> + + + + <% game = Game.where(:id => exp.container_id).first %> + + + + <% end %> + +
    操作变更详情操作时间
    闯关+ <%= exp.score %><%= game ? "通过实训“#{game.challenge.shixun.name}”的第#{game.challenge.position}关获得的奖励" : "" %><%= format_time exp.created_at %>
    + +
    +
    +
    +
      + <%= pagination_links_full @experiences_pages, @experiences_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_grade.html.erb b/app/views/users/_user_grade.html.erb new file mode 100644 index 000000000..18b25b3b5 --- /dev/null +++ b/app/views/users/_user_grade.html.erb @@ -0,0 +1,10 @@ +
    + <%= link_to "金币收入", user_grade_user_path(@user), :class => 'edu-filter-cir-grey fl active', :remote => true, :id => 'score_income' %> + <%= link_to "金币支出", user_grade_user_path(@user, :type => 2), :class => 'edu-filter-cir-grey fl', :remote => true, :id => 'score_expand' %> +
    +

    当前金币:<%= @user.grade %>,您可以通过<%= link_to '完善基本资料', my_account_path(), :class => "color-orange03" %> + 、<%= link_to '首次绑定邮箱和手机', security_settings_path(), :class => "color-orange03" %> + 以及<%= link_to '实训挑战', shixuns_path(), :class => "color-orange03" %>的方式获得金币

    +
    + <%= render :partial => "users/user_grade_content" %> +
    diff --git a/app/views/users/_user_grade_content.html.erb b/app/views/users/_user_grade_content.html.erb new file mode 100644 index 000000000..36a0419a0 --- /dev/null +++ b/app/views/users/_user_grade_content.html.erb @@ -0,0 +1,58 @@ +<% if @user_grades.blank? %> +
    + +

    您还没有获得过金币哦~

    +
    +<% else %> + + + + + + + + + + + <% @user_grades.each do |grade| %> + + <% case grade.container_type %> + <% when 'Phone' %> + + + + <% when 'Mail' %> + + + + <% when 'Account' %> + + + + <% when 'Answer' %> + + + <% game = Game.where(:id => grade.container_id).first %> + + <% when 'Game' %> + + + <% game = Game.where(:id => grade.container_id).first %> + + <% end %> + + + <% end %> + +
    操作变更详情操作时间
    绑定手机+ <%= grade.score %>用户首次绑定手机号码获得的奖励绑定邮箱+ <%= grade.score %>用户首次绑定邮箱获得的奖励完善基本资料+ <%= grade.score %>新用户首次填写基本资料获得的奖励查看参考答案- <%= grade.score.abs %><%= game ? "查看实训“#{game.challenge.shixun.name}”第#{game.challenge.position}关的参考答案消耗的金币" : "" %>闯关+ <%= grade.score %><%= game ? "通过实训“#{game.challenge.shixun.name}”的第#{game.challenge.position}关获得的奖励" : "" %><%= format_time grade.created_at %>
    + +
    +
    +
    +
      + <%= pagination_links_full @grades_pages, @grades_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_tag.html.erb b/app/views/users/_user_tag.html.erb new file mode 100644 index 000000000..2ac7e8fa0 --- /dev/null +++ b/app/views/users/_user_tag.html.erb @@ -0,0 +1,4 @@ +

    当前技能标签:<%= @user.challenge_tags.count %>,您可以通过<%= link_to '实训挑战', shixuns_path(), :class => "color-orange03" %>的方式获得技能标签

    +
    + <%= render :partial => "users/user_tag_content" %> +
    \ No newline at end of file diff --git a/app/views/users/_user_tag_content.html.erb b/app/views/users/_user_tag_content.html.erb new file mode 100644 index 000000000..b3fcca569 --- /dev/null +++ b/app/views/users/_user_tag_content.html.erb @@ -0,0 +1,38 @@ +<% if @user_tags.blank? %> +
    + +

    您还没有获得过技能标签哦~

    +
    +<% else %> + + + + + + + + + + + <% @user_tags.each do |tag| %> + + + <% game = Game.where(:id => tag.container_id).first %> + + + + + <% end %> + +
    操作变更详情操作时间
    闯关+ 标签:<%= game ? game.challenge.challenge_tags.map(&:name).join("、") : "" %><%= game ? "通过实训“#{game.challenge.shixun.name}”的第#{game.challenge.position}关获得的标签" : "" %><%= format_time tag.created_at %>
    + +
    +
    +
    +
      + <%= pagination_links_full @tags_pages, @tags_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/users/growth_record.html.erb b/app/views/users/growth_record.html.erb new file mode 100644 index 000000000..6ca1480a6 --- /dev/null +++ b/app/views/users/growth_record.html.erb @@ -0,0 +1,63 @@ +
    + + + +
    +
    +
    +
    +

    你好~<%= @user.show_name %>,欢迎来到个人成长记录中心

    +

    + 技能标签<%= @user.challenge_tags.count %> + 经验值<%= @user.experience %> + 金币<%= @user.grade %> +

    +
    +
      +
    • + <%= link_to "技能标签", "javascript:void(0)", :remote => true, :class => "font-16 tab_type" %> +
    • +
    • + <%= link_to "经验值", "javascript:void(0)", :remote => true, :class => "font-16 tab_type" %> +
    • +
    • + <%= link_to "金币", "javascript:void(0)", :remote => true, :class => "font-16 tab_type" %> +
    • +
    +
    + <%= render :partial => "users/user_tag" %> +
    +
    +
    +
    + +
    + \ No newline at end of file diff --git a/app/views/users/growth_record.js.erb b/app/views/users/growth_record.js.erb new file mode 100644 index 000000000..8379358be --- /dev/null +++ b/app/views/users/growth_record.js.erb @@ -0,0 +1,5 @@ +<% if params[:page] %> +$("#user_tag_content").html("<%= j(render :partial => 'users/user_tag_content') %>"); +<% else %> +$("#growth_record_content").html("<%= j(render :partial => 'users/user_tag') %>"); +<% end %> \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 3cbfda836..ac07a9c5b 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -114,9 +114,9 @@ <% if new_message_count > 0 %> 新留言<%= new_message_count %> <% end %> - - 经验值<%= @user.experience %> - 金币<%= @user.grade %> + 技能标签<%= link_to @user.challenge_tags.count, growth_record_user_path(@user), :class => "ml5 color-orange03" %> + 经验值<%= link_to @user.experience, growth_record_user_path(@user, :tab => 2), :class => "ml5 color-orange03" %> + 金币<%= link_to @user.grade, growth_record_user_path(@user, :tab => 3), :class => "ml5 color-orange03" %>