diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 76d6785b350b16e29ec69bd76e989176b1dcfb96..0000000000000000000000000000000000000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore index 9d4267df04c8fbaf37f0f5e415aadb2bc939619a..9b071114e26b4bce0805ebf5a1ad82857a8a3417 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ web/online-Language-quiz-app/public/editor-md/ web/basicQuiz-app/public/editor-md/ web/subjective-app/public/editor-md/ web/student-web/public/editor-md/ -web/instructor-web/public/editor-md/ \ No newline at end of file +web/instructor-web/public/editor-md/ +.DS_Store diff --git a/web/basicQuiz-app/.env.development b/web/basicQuiz-app/.env.development deleted file mode 100644 index e3b8e8b0e7f77668bb2a99e4513048cf454faf57..0000000000000000000000000000000000000000 --- a/web/basicQuiz-app/.env.development +++ /dev/null @@ -1,12 +0,0 @@ -REACT_APP_CAS_LOGIN_URL=https://school.thoughtworks.cn/learn-staging/cas/login -REACT_APP_CAS_LOGOUT_URL=https://school.thoughtworks.cn/learn-staging/cas/logout -REACT_APP_CAS_USER_CENTER_HOME_URL=https://school.thoughtworks.cn/learn-staging/home/index.html - -REACT_APP_CAS_STUDENT_HOME_URL=http://localhost:3000/# -REACT_APP_CAS_INSTRUCTOR_HOME_URL=http://localhost:3001/# - -REACT_APP_BASIC_QUIZ_URL=http://localhost:3003/# -REACT_APP_HOMEWORK_QUIZ_URL=http://localhost:3002/# -REACT_APP_STUDENT_URL=http://localhost:3000/# -REACT_APP_INSTRUCTOR_URL=http://localhost:3001/# -REACT_APP_SUBJECTIVE_QUIZ_URL=http://localhost:3004/# \ No newline at end of file diff --git a/web/basicQuiz-app/.env.production b/web/basicQuiz-app/.env.production deleted file mode 100644 index 436886a6dbe61c03c72f0eb6a6c7b62b28ca8b79..0000000000000000000000000000000000000000 --- a/web/basicQuiz-app/.env.production +++ /dev/null @@ -1,7 +0,0 @@ -REACT_APP_CAS_USER_CENTER_HOME_URL=https://school.thoughtworks.cn/learn/home/index.html -REACT_APP_CAS_LOGIN_URL=https://school.thoughtworks.cn/learn/cas/login -REACT_APP_CAS_LOGOUT_URL=https://school.thoughtworks.cn/learn/cas/logout - -REACT_APP_CAS_STUDENT_HOME_URL=https://school.thoughtworks.cn/learn/program-center/student/index.html# -REACT_APP_STUDENT_URL=https://school.thoughtworks.cn/learn/program-center/student/index.html# -REACT_APP_INSTRUCTOR_URL=https://school.thoughtworks.cn/learn/program-center/instructor/index.html# diff --git a/web/basicQuiz-app/.env.staging b/web/basicQuiz-app/.env.staging deleted file mode 100644 index c9c1e1296a0ab5e97ca4171192c0f72a30deb297..0000000000000000000000000000000000000000 --- a/web/basicQuiz-app/.env.staging +++ /dev/null @@ -1,7 +0,0 @@ -REACT_APP_CAS_LOGIN_URL=https://school.thoughtworks.cn/learn-staging/cas/login -REACT_APP_CAS_LOGOUT_URL=https://school.thoughtworks.cn/learn-staging/cas/logout -REACT_APP_CAS_USER_CENTER_HOME_URL=https://school.thoughtworks.cn/learn-staging/home/index.html - -REACT_APP_CAS_STUDENT_HOME_URL=https://school.thoughtworks.cn/learn-staging/program-center/student/index.html# -REACT_APP_STUDENT_URL=https://school.thoughtworks.cn/learn-staging/program-center/student/index.html# -REACT_APP_INSTRUCTOR_URL=https://school.thoughtworks.cn/learn-staging/program-center/instructor/index.html# diff --git a/web/basicQuiz-app/package.json b/web/basicQuiz-app/package.json index 4fff7fce37141f66d457b3f9e49ca92d6b30e96b..ac010fc79591c8d4cf7ef84a2031bffeed9cfe3e 100644 --- a/web/basicQuiz-app/package.json +++ b/web/basicQuiz-app/package.json @@ -35,10 +35,7 @@ }, "scripts": { "start": "PORT=3003 react-app-rewired start", - "build": "sh -ac '. .env.${REACT_APP_ENV}; react-app-rewired build'", - "build:staging": "REACT_APP_ENV=staging npm run build", - "build:production": "REACT_APP_ENV=production npm run build", - "build:dev": "REACT_APP_ENV=development npm run build", + "build": "react-app-rewired build", "test": "react-app-rewired test --env=jsdom", "eject": "react-app-rewired eject", "test:coverage": "react-app-rewired test --env=jsdom --coverage", diff --git a/web/basicQuiz-app/src/component/student-assignment-page-body.js b/web/basicQuiz-app/src/component/student-assignment-page-body.js index 15e36830acf787e09b86d6e05d948ecc99a38901..c0f7f3c1d3d248c76e110024d092cbc4f739bad0 100644 --- a/web/basicQuiz-app/src/component/student-assignment-page-body.js +++ b/web/basicQuiz-app/src/component/student-assignment-page-body.js @@ -72,6 +72,7 @@ class AssignmentPageBody extends Component { const {assignment, comments, user} = this.props const {basicQuizzes, reviewQuiz} = assignment const {task} = this.props.taskInfo + const {studentHomeUrl} = this.props.settings const {programId, taskId, assignmentId} = this.state const quizMap = { @@ -92,7 +93,7 @@ class AssignmentPageBody extends Component { - {task.title} + {task.title}
diff --git a/web/basicQuiz-app/src/component/tutor-assignment-page-body.js b/web/basicQuiz-app/src/component/tutor-assignment-page-body.js index 6e10fb7cd3bbbe0fb2d2c394025cbc04ce67c82a..e5bc9ab8ee6b80ed82818aaf646022878e30317e 100644 --- a/web/basicQuiz-app/src/component/tutor-assignment-page-body.js +++ b/web/basicQuiz-app/src/component/tutor-assignment-page-body.js @@ -57,6 +57,7 @@ class AssignmentPageBody extends Component { const {suggestions, assignment} = this.props const { basicQuizzes, reviewQuiz, student } = assignment const { task } = this.props.taskInfo + const { studentHomeUrl } = this.props.settings const assignments = task.assignments || [] const currentAssignment = assignments.find(assignment => assignment.id === parseInt(this.state.assignmentId)) const completeName = this.getCompleteName(student) @@ -84,7 +85,7 @@ class AssignmentPageBody extends Component { + href={studentHomeUrl + `/tutor/program/${this.state.programId}/task/${this.state.taskId}/student/${this.state.studentId}`}> {task.title} diff --git a/web/basicQuiz-app/src/component/tws-layout/course-center-breadcrumb.js b/web/basicQuiz-app/src/component/tws-layout/course-center-breadcrumb.js index b53b17df5c5a2e9862a1a98be92d427394eec3a3..5b34403ed024efcc6defbad4452fa94ce84765b8 100644 --- a/web/basicQuiz-app/src/component/tws-layout/course-center-breadcrumb.js +++ b/web/basicQuiz-app/src/component/tws-layout/course-center-breadcrumb.js @@ -43,16 +43,18 @@ class TwsBreadCrumb extends Component { changePage (item) { const url = item.linkTo - if(this.isIndex(url)){ - window.location.href = 'https://school.thoughtworks.cn/learn/home/index.html#/app-center' - } - else if(this.isInstructor(url)){ - window.location.href = url.replace('/instructor',`${process.env.REACT_APP_INSTRUCTOR_URL}`) - } - else if(this.isBasicQuiz(url, item)){ - this.props.history.push(url) - } - else window.location.href = process.env.REACT_APP_STUDENT_URL+url + if (this.isIndex(url)) { + window.location.href = 'https://school.thoughtworks.cn/learn/home/index.html#/app-center' + } + else if (this.isInstructor(url)) { + window.location.href = url.replace('/instructor', this.props.settings.introduceUrl) + } + else if (this.isBasicQuiz(url, item)) { + this.props.history.push(url) + } + else { + window.location.href = this.props.settings.studentUrl + url + } } isBasicQuiz(url, item) { diff --git a/web/basicQuiz-app/src/component/tws-layout/index.js b/web/basicQuiz-app/src/component/tws-layout/index.js index 096c2874ecbe2a57da3f443ad1a207c8b9b871ea..f4e69543449c0c87e9cc0623c202bf5debce03ad 100644 --- a/web/basicQuiz-app/src/component/tws-layout/index.js +++ b/web/basicQuiz-app/src/component/tws-layout/index.js @@ -20,12 +20,12 @@ class Index extends Component { render () { const {user, settings, notifications} = this.props - const { notificationMoreUrl } = settings + const { notificationMoreUrl, logoutUrl, userCenterHomeUrl } = settings return ( } diff --git a/web/basicQuiz-app/src/reducers/settings.js b/web/basicQuiz-app/src/reducers/settings.js index ba179712c9e5a1d38dcf4c7bd87743e389a14760..15aba05937c08f115769e50336589279c6b6d085 100644 --- a/web/basicQuiz-app/src/reducers/settings.js +++ b/web/basicQuiz-app/src/reducers/settings.js @@ -3,12 +3,17 @@ const genSetting = (data) => { const userCenterHomeUrl = `${appContextPath}/home/index.html` const logoutUrl = `${appContextPath}/cas/logout` const notificationMoreUrl = `${appContextPath}/notification-center/index.html` + const introduceUrl = `${appContextPath}/program-center/instructor/index.html#` + const studentUrl = `${appContextPath}/program-center/student/index.html#` + const studentHomeUrl = `${appContextPath}/program-center/student/index.html#` - - return Object.assign({}, { + return Object.assign({}, { userCenterHomeUrl, logoutUrl, - notificationMoreUrl + notificationMoreUrl, + introduceUrl, + studentUrl, + studentHomeUrl }, data) } diff --git a/web/subjective-app/.env.development b/web/subjective-app/.env.development deleted file mode 100644 index 28b5b7437b84ac566c7ef1846d86c7d8e9ce7ed2..0000000000000000000000000000000000000000 --- a/web/subjective-app/.env.development +++ /dev/null @@ -1,10 +0,0 @@ -REACT_APP_CAS_LOGIN_URL=https://school.thoughtworks.cn/learn-staging/cas/login -REACT_APP_CAS_LOGOUT_URL=https://school.thoughtworks.cn/learn-staging/cas/logout -REACT_APP_CAS_USER_CENTER_HOME_URL=https://school.thoughtworks.cn/learn-staging/home/index.html - - -REACT_APP_BASIC_QUIZ_URL=http://localhost:3003/# -REACT_APP_HOMEWORK_QUIZ_URL=http://localhost:3002/# -REACT_APP_STUDENT_URL=http://localhost:3000/# -REACT_APP_INSTRUCTOR_URL=http://localhost:3001/# -REACT_APP_SUBJECTIVE_QUIZ_URL=http://localhost:3004/# \ No newline at end of file diff --git a/web/subjective-app/.env.production b/web/subjective-app/.env.production deleted file mode 100644 index cfcc10f6a4bae56add9099cff7df92c77ff48952..0000000000000000000000000000000000000000 --- a/web/subjective-app/.env.production +++ /dev/null @@ -1,10 +0,0 @@ -REACT_APP_CAS_USER_CENTER_HOME_URL=https://school.thoughtworks.cn/learn/home/index.html -REACT_APP_CAS_LOGIN_URL=https://school.thoughtworks.cn/learn/cas/login -REACT_APP_CAS_LOGOUT_URL=https://school.thoughtworks.cn/learn/cas/logout - -REACT_APP_BASIC_QUIZ_URL=https://school.thoughtworks.cn/learn/program-center/basicQuiz/index.html# -REACT_APP_HOMEWORK_QUIZ_URL=https://school.thoughtworks.cn/learn/program-center/homeworkQuiz/index.html# -REACT_APP_SUBJECTIVE_QUIZ_URL=https://school.thoughtworks.cn/learn/program-center/subjectiveQuiz/index.html# -REACT_APP_STUDENT_URL=https://school.thoughtworks.cn/learn/program-center/student/index.html# -REACT_APP_INSTRUCTOR_URL=https://school.thoughtworks.cn/learn/program-center/instructor/index.html# - diff --git a/web/subjective-app/.env.staging b/web/subjective-app/.env.staging deleted file mode 100644 index 5515a6d1f223207102fd3420223b9b52fa2221f9..0000000000000000000000000000000000000000 --- a/web/subjective-app/.env.staging +++ /dev/null @@ -1,11 +0,0 @@ -REACT_APP_CAS_LOGIN_URL=https://school.thoughtworks.cn/learn-staging/cas/login -REACT_APP_CAS_LOGOUT_URL=https://school.thoughtworks.cn/learn-staging/cas/logout -REACT_APP_CAS_USER_CENTER_HOME_URL=https://school.thoughtworks.cn/learn-staging/home/index.html - - -REACT_APP_BASIC_QUIZ_URL=https://school.thoughtworks.cn/learn-staging/program-center/basicQuiz/index.html# -REACT_APP_HOMEWORK_QUIZ_URL=https://school.thoughtworks.cn/learn-staging/program-center/homeworkQuiz/index.html# -REACT_APP_SUBJECTIVE_QUIZ_URL=https://school.thoughtworks.cn/learn-staging/program-center/subjectiveQuiz/index.html# -REACT_APP_STUDENT_URL=https://school.thoughtworks.cn/learn-staging/program-center/student/index.html# -REACT_APP_INSTRUCTOR_URL=https://school.thoughtworks.cn/learn-staging/program-center/instructor/index.html# - diff --git a/web/subjective-app/package.json b/web/subjective-app/package.json index 160954e5af634800bdb5c1335d7fd67ecf966b2f..3c793c876b1b8799f094f0833c6a4523799ef9e3 100644 --- a/web/subjective-app/package.json +++ b/web/subjective-app/package.json @@ -36,10 +36,7 @@ }, "scripts": { "start": "PORT=3004 react-app-rewired start", - "build": "sh -ac '. .env.${REACT_APP_ENV}; react-app-rewired build'", - "build:staging": "REACT_APP_ENV=staging npm run build", - "build:production": "REACT_APP_ENV=production npm run build", - "build:dev": "REACT_APP_ENV=development npm run build", + "build": "react-app-rewired build", "test": "react-app-rewired test --env=jsdom", "eject": "react-app-rewired eject", "test:coverage": "react-app-rewired test --env=jsdom --coverage", diff --git a/web/subjective-app/src/component/student-assignment-page-body.js b/web/subjective-app/src/component/student-assignment-page-body.js index 405ff25d8f261c8e4941af85d572c4d88e9ec466..11c59f0b82ba1df91b38b2f5541f6909d513044d 100644 --- a/web/subjective-app/src/component/student-assignment-page-body.js +++ b/web/subjective-app/src/component/student-assignment-page-body.js @@ -53,7 +53,7 @@ class StudentAssignmentPageBody extends Component { goExcellentAssignmentList () { const {programId, taskId, assignmentId, quizId} = this.state - window.location.href = process.env.REACT_APP_STUDENT_URL + `/program/${programId}/task/${taskId}/assignment/${assignmentId}/quiz/${quizId}/excellent-quiz-list` + window.location.href = this.props.settings.studentUrl + `/program/${programId}/task/${taskId}/assignment/${assignmentId}/quiz/${quizId}/excellent-quiz-list` } changeQuiz (quizId) { @@ -91,7 +91,7 @@ class StudentAssignmentPageBody extends Component { + href={this.props.settings.studentUrl + '/student/program/' + this.state.programId + '/task/' + this.state.taskId}> {taskInfo.title} diff --git a/web/subjective-app/src/component/tutor-assignment-page-body.js b/web/subjective-app/src/component/tutor-assignment-page-body.js index 860f37033dd5592266a11343849af5b58114ea53..d2f73d0204fa88884ffbe6384fdff1a0f7645519 100644 --- a/web/subjective-app/src/component/tutor-assignment-page-body.js +++ b/web/subjective-app/src/component/tutor-assignment-page-body.js @@ -111,7 +111,7 @@ class TutorAssignmentPageBody extends Component {
+ href={this.props.settings.studentUrl + `/tutor/program/${this.state.programId}/task/${this.state.taskId}/student/${this.state.studentId}`}> {taskInfo.title} diff --git a/web/subjective-app/src/component/tws-layout/course-center-breadcrumb.js b/web/subjective-app/src/component/tws-layout/course-center-breadcrumb.js index c8996fb01bd27d79698590be80812b1311f8edc5..a12e43f77971b85a956813dda867bb525f9733ac 100644 --- a/web/subjective-app/src/component/tws-layout/course-center-breadcrumb.js +++ b/web/subjective-app/src/component/tws-layout/course-center-breadcrumb.js @@ -49,12 +49,14 @@ class TwsBreadCrumb extends Component { window.location.href = 'https://school.thoughtworks.cn/learn/home/index.html#/app-center' } else if (this.isInstructor(url)) { - window.location.href = url.replace('/instructor', `${process.env.REACT_APP_INSTRUCTOR_URL}`) + window.location.assign(url.replace('/instructor', this.props.settings.introduceUrl)) } else if (this.isSubjective(url, item)) { this.props.history.push(url) } - else window.location.href = process.env.REACT_APP_STUDENT_URL + url + else { + window.location.assign(this.props.settings.studentUrl + url) + } } diff --git a/web/subjective-app/src/component/tws-layout/index.js b/web/subjective-app/src/component/tws-layout/index.js index 9067412537812b0d8c2736f5fe8dd39c0fefc2ee..c9f5524d704b64eb83be8dd45a1559f7c52ed939 100644 --- a/web/subjective-app/src/component/tws-layout/index.js +++ b/web/subjective-app/src/component/tws-layout/index.js @@ -16,12 +16,12 @@ class Index extends Component { } render () { const {user, settings, notifications} = this.props - const { notificationMoreUrl } = settings + const { notificationMoreUrl, logoutUrl, userCenterHomeUrl } = settings return ( } diff --git a/web/subjective-app/src/reducers/settings.js b/web/subjective-app/src/reducers/settings.js index c8db1cc34524693299e68bc06dbfabe94c8b44cc..882fc7f042e6402005fa5ee8d6bd55f598ed66dc 100644 --- a/web/subjective-app/src/reducers/settings.js +++ b/web/subjective-app/src/reducers/settings.js @@ -3,11 +3,15 @@ const genSetting = (data) => { const userCenterHomeUrl = `${appContextPath}/home/index.html` const logoutUrl = `${appContextPath}/cas/logout` const notificationMoreUrl = `${appContextPath}/notification-center/index.html` + const studentUrl = `${appContextPath}/program-center/student/index.html#` + const introduceUrl = `${appContextPath}/program-center/instructor/index.html#` return Object.assign({}, { userCenterHomeUrl, logoutUrl, - notificationMoreUrl + notificationMoreUrl, + studentUrl, + introduceUrl }, data) }