Forráskód Böngészése

添加coconote登录页面

11wqe1 1 hete
szülő
commit
3c56b27e0f

+ 3 - 1
src/api/user.js

@@ -34,7 +34,9 @@ export function loginOut(data) {
 export function getUser(data) {
   return axios.get(`${baseApi}selectUser`, data)
 }
-
+export function getCourseGroup(data) {
+  return axios.get(`${baseApi}getCourseGroup`, data)
+}
 export function updatePassword(data) {
   return axios.post(`${baseApi}updatePassword`, [data])
 }

BIN
src/assets/login/image.png


+ 5 - 0
src/common/apiConfig.js

@@ -119,6 +119,11 @@ export const API_CONFIG = {
     ajax_roleUser: {
       functionName: "select_roleUser",
     },
+    
+    // 查询coconote登录学生列表
+    selectSCourseStudents: {
+      functionName: "selectSCourseStudents",
+    },
 
   //新增学校应用
   ajax_add_usuallyApp: {

+ 4 - 1
src/lang/cn.json

@@ -150,5 +150,8 @@
 	"waitfororg":"请等待组织识别",
 	"completeaccountnumber":"请输入完整账号",
 	"completeaccountnumber2":"请输入完整账号或使用组织号登录",
-	"accAbnormal":"账号状态异常,请联系管理员"
+	"accAbnormal":"账号状态异常,请联系管理员",
+	"interlearning":"跨学科学习",
+	"Scanagain":"扫码登录失败请重新扫码",
+	"enterCorrectcode":"请输入正确课程识别码"
 }

+ 4 - 1
src/lang/en.json

@@ -150,6 +150,9 @@
   "waitfororg":"Please wait for organizational identification",
 	"completeaccountnumber":"Please enter the complete account number",
   "completeaccountnumber2":"Please enter your complete account or log in with your organization number",
-	"accAbnormal":"Account status is abnormal, please contact the administrator"
+	"accAbnormal":"Account status is abnormal, please contact the administrator",
+  "interlearning":"interdisciplinary learning",
+	"Scanagain":"Scan code login failed, please scan code again",
+	"enterCorrectcode":"Please enter the correct course identification code"
 
 }

+ 4 - 1
src/lang/hk.json

@@ -150,5 +150,8 @@
   "waitfororg":"請等待組織識別",
 	"completeaccountnumber":"請輸入完整帳號",
   "completeaccountnumber2":"請輸入完整帳號或使用組織號登入",
-  "accAbnormal":"帳號狀態异常,請聯系管理員"
+  "accAbnormal":"帳號狀態异常,請聯系管理員",
+  "interlearning":"跨學科學習",
+	"Scanagain":"掃碼登入失敗請重新掃碼",
+	"enterCorrectcode":"請輸入正確課程識別碼"
 }

+ 232 - 15
src/views/HomeView.vue

@@ -3,14 +3,14 @@
 		<div class="container">
 			<div class="leftBar" style="height: 100%">
 				<sidebarL
-					v-if="!this.$route.query.courseId"
+					v-if="!courseId && !cocoNoteType"
 					@getPer="getPer"
 					@AddAppJson="AddAppJson"
 					ref="sidebarLRef"
 				></sidebarL>
 			</div>
 			<div class="table-container">
-				<div class="top" v-show="!appSign">
+				<div class="top" v-show="!appSign || cocoNoteType">
 					<div class="topCon">
 						<div class="title"> 
 							<span v-if="roleUser.orgName">{{ roleUser.orgName }}</span>
@@ -47,7 +47,7 @@
 									</div>
 								</div>
 							</div>
-							<div v-if="prefixL != 'liyuan_'" @click="backVersion" class="Version">
+							<div v-if="prefixL != 'liyuan_' && !cocoNoteType" @click="backVersion" class="Version">
 								{{ lang.Returnoldversion }}
 							</div>
 							<el-button
@@ -184,7 +184,7 @@
 
 <script>
 import { mapGetters, mapActions } from "vuex";
-import { loginOut } from "@/api/user";
+import { loginOut,getCourseGroup } from "@/api/user";
 import sidebarL from "../components/sidebarL.vue";
 import { API_CONFIG } from "@/common/apiConfig";
 import store from "../store";
@@ -275,6 +275,10 @@ export default {
 			betaL: this.$region,
 			clearifa: "",
 			msgNum: 0,
+			cocoNoteType: this.$route.query.cocoNoteType,
+			// cocoNoteType: '666',
+			courseId: this.$route.query.courseId,
+			// courseId: 'da5aa5b7-a98c-11f0-84cf-005056924926',
 			// 荔园集团下的学校
 			mergedList: [
 				"3823a6a5-1b6e-11f0-a66a-005056924926",
@@ -462,9 +466,90 @@ export default {
 				}, 2000);
 			}
 		},
-		handleLoad(){
+		async handleLoad(){
 			this.loading = false;
 			console.log('iframe加载完成');
+			if (this.cocoNoteType && this.courseId) {
+				let params = {
+					cid: this.courseId,
+					classid: '1',
+				};
+				
+				try {
+					let res = await getCourseGroup(params);
+					if (res.data && res.data[1].length) {
+						let groupPerson = res.data[1]
+						let groupCid = ''
+						for (var i = 0; i < groupPerson.length; i++) {
+							if (groupPerson[i].userid == this.roleUser.userid) {
+								groupCid = groupPerson[i].groupCid
+								break;
+							}
+						}
+						if (groupCid) {
+							window.topU.postMessage(
+								{
+									tools: "opencCscl",
+									cid: this.courseId,
+									gid: groupCid,
+								},
+								"*"
+							);
+							this.addOp3('1', "", { courseid: this.courseId , type: (this.roleUser.type == 1 ? '_teacher' : '_student') +  "CocoNote_open" }, "success")
+						} else {
+							this.$message.error("没有加入分组请先加入分组");
+							this.goToCourse3(this.courseId)
+							this.addOp3('1', "", { courseid: this.courseId , type:  (this.roleUser.type == 1 ? '_teacher' : '_student') +  "CocoNote_open" }, '没有加入分组请先加入分组')
+						}
+					} else {
+						this.$message.error("没有加入分组请先加入分组");
+						this.goToCourse3(this.courseId)
+						this.addOp3('1', "", { courseid: this.courseId , type:  (this.roleUser.type == 1 ? '_teacher' : '_student') +  "CocoNote_open" }, '没有加入分组请先加入分组')
+					}
+				} catch (error) {
+					this.addOp3(
+						"1",
+						"",
+						{ courseid: this.courseId ,type:  (this.roleUser.type == 1 ? '_teacher' : '_student') +  "CocoNote_open" },
+						error
+					)
+				}	
+			}
+		},
+		goToCourse3() {
+
+			// if (courseId) {
+
+				this.openApp4({
+					stateL: true,
+					toolId: "synergyCourse/add",
+					clearL: true,
+				});
+				// this.$router.push(
+				// "/synergyCourse/add?cid=" +
+				// courseId +
+				// "&userid=" +
+				// this.userid +
+				// "&oid=" +
+				// this.oid +
+				// "&org=" +
+				// this.org +
+				// "&role=" +
+				// this.role
+				// );
+			// } else {
+			// 	this.$router.push(
+			// 	"/synergyCourse/add?userid=" +
+			// 	this.userid +
+			// 	"&oid=" +
+			// 	this.oid +
+			// 	"&org=" +
+			// 	this.org +
+			// 	"&role=" +
+			// 	this.role
+			// 	);
+			// 	this.addOp3('1', "", { type: "CocoNote_standard_add" }, "success")
+			// }
 		},
 		async handleLogout() {
 			this.$confirm(this.lang.sureexit, this.lang.tip, {
@@ -515,7 +600,7 @@ export default {
 			let queryString = "";
 			if (argumentList && argumentList.length) {
 				const paramsMap = {
-					courseId: this.$route.query.courseId,
+					courseId: this.courseId,
 					userid: _userid,
 					oid: _oid,
 					org: _org,
@@ -555,6 +640,127 @@ export default {
 				"success"
 			);
 		},
+		// coconotetype网址登录到页面直接跳转到协同建构
+		async openApp3(val) {
+			let url = "";
+			let argumentList = ["userid", "oid", "org","role"];
+			if (this.betaL == "beta") {
+				url = `https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/#/${val.toolId}`;
+			} else {
+				url = `https://pbl.cocorobo.cn/pbl-teacher-table/dist/#/${val.toolId}`;
+			}
+
+			await store.commit("user/SET_AppSIGN", val.toolId);
+
+			let _userinfo = this.roleUser, //登录用户信息
+				{
+					userid: _userid,
+					organizeid: _oid,
+					org: _org,
+					role:_role,
+				} = _userinfo; // 解构赋值获取用户信息
+			let queryString = "";
+			if (argumentList && argumentList.length) {
+				const paramsMap = {
+					userid: _userid,
+					oid: _oid,
+					org: _org,
+					role: _role,
+					ly :1
+				};
+
+				const canshu = argumentList
+					.filter((param) => paramsMap[param] !== undefined || param === "type")
+					.map((param) =>
+						param === "type"
+							? `tType=${paramsMap["tType"]}`
+							: `${param}=${paramsMap[param]}`
+					);
+
+				queryString = canshu.length
+					? (url.includes("?") ? "&" : "?") + canshu.join("&")
+					: ""; // 生成查询字符串
+			}
+
+			let _url = url + queryString;
+			console.log("_url", _url);
+
+			let pl = {
+				json: _url,
+				stateL: true,
+				toolId: val.toolId,
+				clearL: val.clearL,
+			};
+			this.AddAppJson(pl)
+			// this.$emit("cutUrl", pl);
+			this.addOp3(
+				"1",
+				"",
+				{ type: this.prefixL + val.toolId + (this.roleUser.type == 1 ? '_teacher' : '_student') +  "stu_open" },
+				"success"
+			);
+		},
+		// coconotetype网址登录到页面直接跳转到协同建构,未加入分组后提示加入分组
+		async openApp4(val) {
+			let url = "";
+			let argumentList = ["userid", "oid", "org","role","cid"];
+			if (this.betaL == "beta") {
+				url = `https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/#/${val.toolId}`;
+			} else {
+				url = `https://pbl.cocorobo.cn/pbl-teacher-table/dist/#/${val.toolId}`;
+			}
+
+			await store.commit("user/SET_AppSIGN", val.toolId);
+
+			let _userinfo = this.roleUser, //登录用户信息
+				{
+					userid: _userid,
+					organizeid: _oid,
+					org: _org,
+					role:_role,
+				} = _userinfo; // 解构赋值获取用户信息
+			let queryString = "";
+			if (argumentList && argumentList.length) {
+				const paramsMap = {
+					cid: this.courseId,
+					userid: _userid,
+					oid: _oid,
+					org: _org,
+					role: _role,
+					ly :1
+				};
+
+				const canshu = argumentList
+					.filter((param) => paramsMap[param] !== undefined || param === "type")
+					.map((param) =>
+						param === "type"
+							? `tType=${paramsMap["tType"]}`
+							: `${param}=${paramsMap[param]}`
+					);
+
+				queryString = canshu.length
+					? (url.includes("?") ? "&" : "?") + canshu.join("&")
+					: ""; // 生成查询字符串
+			}
+
+			let _url = url + queryString;
+			console.log("_url", _url);
+
+			let pl = {
+				json: _url,
+				stateL: true,
+				toolId: val.toolId,
+				clearL: val.clearL,
+			};
+			this.AddAppJson(pl)
+			// this.$emit("cutUrl", pl);
+			this.addOp3(
+				"1",
+				"",
+				{ type: this.prefixL + val.toolId + (this.roleUser.type == 1 ? '_teacher' : '_student') +  "stu_open" },
+				"success"
+			);
+		},
 		// 获取学校权限与组织权限,优先使用学校权限,其次使用组织权限
 		async getPer() {
 			this.clearifa = "";
@@ -593,15 +799,9 @@ export default {
 	mounted() {
 		console.log("重新获取数据");
 		console.log('this.$route.query.courseId',this.$route.query.courseId);
-		this.getPer();
-		// this.getMsg()
-		if (this.$route.query.courseId) {
-			this.openApp2({
-				stateL: true,
-				toolId: "courseDetail",
-				clearL: true,
-			});
-		}
+		console.log('this.$route.query.cocoNoteType',this.$route.query.cocoNoteType);
+
+		
 		if (
 			!this.roleUser.cclassid &&
 			this.roleUser.type == 1 &&
@@ -611,6 +811,23 @@ export default {
 		) {
 			this.editInfo();
 		}
+		// this.getMsg()
+		if(this.cocoNoteType){
+			this.openApp3({
+				stateL: true,
+				toolId: "synergyCourse",
+				clearL: true,
+			});
+			return
+		}else if (this.courseId) {
+			this.openApp2({
+				stateL: true,
+				toolId: "courseDetail",
+				clearL: true,
+			});
+			return
+		}
+		this.getPer();
 	},
 };
 </script>

+ 74 - 14
src/views/login/loginPage.vue

@@ -9,7 +9,7 @@
 				@click="backVersion"
 				class="Version"
 			>
-				{{ lang.Returnoldversion }}
+				{{ cocoNoteType ? lang.interlearning : lang.Returnoldversion }}
 			</div>
 			<div class="lp_r_box" v-loading="nextStepsLoading">
 				<div class="lp_r_b_logo">
@@ -35,10 +35,11 @@
 							<span style="margin: 0" v-else>{{ lang.KekeleboPlatform }}</span>
 						</div>
 						<div v-if="steps == 2">
-							<div style="margin-left: 10px">{{ codeRes.school }} - {{ codeClassName }}</div>
+							<div style="margin-left: 10px" v-if="!cocoNoteCid">{{ codeRes.school }} - {{ codeClassName }}</div>
+							<div style="margin-left: 10px" v-if="cocoNoteCid && cocoNoteName">{{ cocoNoteName }}</div>
 						</div>
 						<div
-							v-if="steps == 2"
+							v-if="steps == 2 && !cocoNoteCid"
 							style="cursor: pointer"
 							@click="(steps = 1), (stuInfoCode = {})"
 						>
@@ -51,7 +52,7 @@
 						v-if="['default', 'weChat', 'orgL', 'code','code2'].includes(loginType)"
 						style="display: flex;justify-content: space-between;align-items: first baseline;"
 						>
-						{{ lang.login }}
+						{{ cocoNoteType ? lang.interlearning : lang.login }}
 						<!-- 返回到选择身份 -->
 						<div v-if="logIdentity != 0" @click="backIDyData" class="backIDy">{{ lang.Reidentity }}</div>
 					</span>
@@ -434,9 +435,9 @@
 									:class="[stuInfoCode.userid == i.userid ? 'stuback' : '','nameModule']"
 									@click="selAcc(i)"
 								>
-									<el-tooltip effect="dark" :content="i.name" placement="top">
+									<el-tooltip effect="dark" :content="i.username" placement="top">
 										<span>
-											{{ i.name }}
+											{{ i.username }}
 										</span>
 									</el-tooltip>
 								</div>
@@ -521,6 +522,15 @@ export default {
 			showName: "",
 			oloading: false,
 			openid: "",
+			cocoNoteType: this.$route.query["type"],
+			cocoNoteCid: this.$route.query["courseid"],
+			// cocoNoteCid: "da5aa5b7-a98c-11f0-84cf-005056924926",
+			cocoNoteCon: {
+				banner: require('../../assets/login/image.png'),
+				logo: '',
+				name: '跨学科学习'
+			},
+			cocoNoteName:'',
 			uppercaseAlphabet:['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
 			allowOrgList: [
 				{
@@ -568,6 +578,10 @@ export default {
 				_result.banner = _obj.banner;
 				_result.name = _obj.name;
 				_result.logo = _obj.logo;
+			} else if (this.cocoNoteType == 'coconote') {
+				_result.banner = this.cocoNoteCon.banner;
+				_result.name = this.cocoNoteCon.name;
+				_result.logo = this.cocoNoteCon.logo;
 			}
 
 			return _result;
@@ -588,6 +602,28 @@ export default {
 			login: "user/login",
 			logout: "user/logout",
 		}),
+		// coconote学生登录
+		async cocostulog(){
+			this.steps = 2
+			let params = [
+				{
+					functionName: API_CONFIG.selectSCourseStudents.functionName,
+					cid: this.cocoNoteCid
+				},
+			];
+			try {
+				const res = await this.$ajax.post(API_CONFIG.baseUrl, params);
+				console.log("data", res.data);
+				if (res.data[0].length) {
+					this.cocoNoteName = res.data[0][0].title
+				}
+				this.classJuri = this.groupByName(res.data[0])
+				this.nextStepsLoading = false
+			} catch (error) {
+				this.nextStepsLoading = false
+				console.log('error',error);
+			}
+		},
 		// 返回身份登录页后清除数据 
 		backIDyData(){
 			this.password = '';
@@ -627,6 +663,8 @@ export default {
 		// 返回旧版本
 		backVersion() {
 			console.log(this.$region);
+			if (this.cocoNoteType == 'coconote') return console.log('不能返回');
+			
 			this.$confirm(this.lang.backoldversion, this.lang.tip, {
 				confirmButtonText: this.lang.confirm,
 				cancelButtonText: this.lang.Cancel,
@@ -882,7 +920,10 @@ export default {
 							) {
 								this.$router.push({ path: "/kanban" });
 							} else {
-								this.$router.push({ path: this.redirect || "/" });
+								this.$router.push(
+									{ path: this.redirect || "/",
+									query: { cocoNoteType: this.cocoNoteType },
+								});
 							}
 							this.addOp3(
 								"1",
@@ -987,7 +1028,10 @@ export default {
 							) {
 								this.$router.push({ path: "/kanban" });
 							} else {
-								this.$router.push({ path: this.redirect || "/" });
+								this.$router.push({ 
+									path: this.redirect || "/",
+									query: { cocoNoteType: this.cocoNoteType }
+								});
 							}
 						} else {
 							this.$message.error(this.lang.Bindingfailed);
@@ -1012,12 +1056,18 @@ export default {
 			const hasToken = this.$store.getters.token;
 			if (hasToken) {
 				// 如果已登录,直接重定向
-				this.$router.push({ path: this.redirect || "/" });
+				this.$router.push({ 
+					path: this.redirect || "/",
+					query: { cocoNoteType: this.cocoNoteType }
+				});
 				return;
 			}
 			const userid = await this.login();
 			if (userid) {
-				this.$router.push({ path: this.redirect || "/" });
+				this.$router.push({ 
+					path: this.redirect || "/",
+					cocoNoteType: this.cocoNoteType 
+				});
 			}
 		},
 		// async inpGetAccOrgName(){
@@ -1339,7 +1389,10 @@ export default {
 						) {
 							this.$router.push({ path: "/kanban" });
 						} else {
-							this.$router.push({ path: this.redirect || "/" });
+							this.$router.push({
+								path: this.redirect || "/",
+								cocoNoteType: this.cocoNoteType 
+							});
 						}
 						this.$message.success(this.lang.Loginsuccessful);
 
@@ -1420,7 +1473,7 @@ export default {
 		// 随机码2登录
 		nextSteps2() {
 			if (this.SuffixData.length < 5) {
-				this.$message.error('请输入正确课程识别码');
+				this.$message.error(this.lang.enterCorrectcode);
 				return;
 			}
 
@@ -1625,7 +1678,10 @@ export default {
 
 							this.$router.push({
 								path: this.redirect || "/",
-								query: { courseId: this.courseId },
+								query: { 
+									courseId: this.cocoNoteType ? this.cocoNoteCid : this.courseId,
+									cocoNoteType: this.cocoNoteType  
+								},
 							});
 							this.addOp3(
 								"1",
@@ -1689,11 +1745,15 @@ export default {
 				if (e.data.code == 200) {
 					_this.getOpenId(e.data.data.openid);
 				} else {
-					_this.$message.error("扫码登录失败请重新扫码");
+					_this.$message.error(this.lang.Scanagain);
 					_this.wechatLogin();
 				}
 			}
 		});
+		if (this.cocoNoteCid) {
+			this.nextStepsLoading = true
+			this.cocostulog()
+		}
 		this.getLoading();
 		this.getOrdOidData();
 	},