From 063af419f54ab4fca8e8f3ed4d6b32aa44af029b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 23 Jul 2019 10:43:46 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 064061058..54e9fe4b2 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -160,14 +160,11 @@ class SubjectsController < ApplicationController @shixuns = @shixuns.where(id: shixun_ids) end - @shixuns = @shixuns.reorder("created_at desc") - @shixuns_count = @shixuns.size + @shixuns_count = @shixuns.count ## 分页参数 page = params[:page] || 1 - @shixuns = @shixuns.page(page).per(10) - - @shixuns = @shixuns.includes(:myshixuns) + @shixuns = @shixuns.includes(:myshixuns).reorder("created_at desc").page(page).per(10) end def append_to_stage From 526c87c76965eff74f3050e5925f1470b2128af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 23 Jul 2019 10:45:16 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/ShixunModal.js | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/ShixunModal.js b/public/react/src/modules/courses/coursesPublic/ShixunModal.js index afba47723..56cecc51b 100644 --- a/public/react/src/modules/courses/coursesPublic/ShixunModal.js +++ b/public/react/src/modules/courses/coursesPublic/ShixunModal.js @@ -29,11 +29,13 @@ class ShixunModal extends Component{ axios.get(url).then((result)=>{ if(result.status===200){ - this.setState({ - shixunmodallist:result.data, - hometypepvisible:false, - newshixunmodallist:result.data.shixun_list, - }) + if(result.data.message===undefined){ + this.setState({ + shixunmodallist:result.data, + hometypepvisible:false, + newshixunmodallist:result.data.shixun_list, + }) + } } }).catch((error)=>{ console.log(error); @@ -59,18 +61,18 @@ class ShixunModal extends Component{ } }).then((result)=>{ if(result.status===200){ + if(result.data.message===undefined){ + let shixun_list = result.data.shixun_list; + for (var i = 0; i < shixun_list.length; i++) { + newshixunmodallists.push(shixun_list[i]) + } + this.setState({ + shixunmodallist: result.data, + newshixunmodallist: newshixunmodallists, + hometypepvisible: false + }) - let shixun_list=result.data.shixun_list; - for(var i=0; i{ From 800417eff48ad41e7fba2a04a942d391dd015aca Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 23 Jul 2019 10:49:48 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 54e9fe4b2..4e4d494ce 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -160,11 +160,14 @@ class SubjectsController < ApplicationController @shixuns = @shixuns.where(id: shixun_ids) end + @shixuns = @shixuns.reorder("created_at desc") @shixuns_count = @shixuns.count ## 分页参数 page = params[:page] || 1 - @shixuns = @shixuns.includes(:myshixuns).reorder("created_at desc").page(page).per(10) + @shixuns = @shixuns.page(page).per(10) + + @shixuns = @shixuns.includes(:myshixuns) end def append_to_stage From 6bc633b3b668e06dcff9ca4a24d5a80bef7772db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 23 Jul 2019 10:58:55 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Index.js | 2 +- public/react/src/modules/courses/coursesHome/CoursesHome.js | 6 +++--- .../src/modules/courses/coursesHome/CoursesHomeCard.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index 27424821f..017a36765 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -18,7 +18,7 @@ const ListPageIndex = Loadable({ //课堂首页 const CoursesHome = Loadable({ - loader: () => import('./coursesHome/coursesHome'), + loader: () => import('./coursesHome/CoursesHome'), loading:Loading, }) diff --git a/public/react/src/modules/courses/coursesHome/CoursesHome.js b/public/react/src/modules/courses/coursesHome/CoursesHome.js index 994e14eb9..3f4b4ad12 100644 --- a/public/react/src/modules/courses/coursesHome/CoursesHome.js +++ b/public/react/src/modules/courses/coursesHome/CoursesHome.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import {getImageUrl} from 'educoder'; -import CoursesHomeCard from "./coursesHomeCard.js" +import CoursesHomeCard from "./CoursesHomeCard.js" import axios from 'axios'; import {Input,Tooltip} from 'antd'; import UpgradeModals from '../../modals/UpgradeModals'; @@ -10,7 +10,7 @@ import '@icedesign/base/lib/pagination/style.js'; const Search = Input.Search; -class coursesHome extends Component{ +class CoursesHome extends Component{ constructor(props) { super(props) this.state = { @@ -160,7 +160,7 @@ class coursesHome extends Component{ ) } } -export default coursesHome; +export default CoursesHome; // {/**/} \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js b/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js index 2f65c622f..cd671cbe4 100644 --- a/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js +++ b/public/react/src/modules/courses/coursesHome/CoursesHomeCard.js @@ -4,7 +4,7 @@ import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import {Tooltip,Spin,Alert} from 'antd'; import ShowSpin from '../../../common/ShowSpin'; -class coursesHomeCard extends Component{ +class CoursesHomeCard extends Component{ constructor(props) { super(props) } @@ -134,5 +134,5 @@ class coursesHomeCard extends Component{ ) } } -export default coursesHomeCard; +export default CoursesHomeCard; From 200520c908a8dc353b5dacd859dffb046be83142 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 23 Jul 2019 11:03:23 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 4e4d494ce..064061058 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -161,7 +161,7 @@ class SubjectsController < ApplicationController end @shixuns = @shixuns.reorder("created_at desc") - @shixuns_count = @shixuns.count + @shixuns_count = @shixuns.size ## 分页参数 page = params[:page] || 1