Browse Source

修改用户弹框信息

11wqe1 3 days ago
parent
commit
1898f2bc44

BIN
src/assets/info/camera_icon.png


BIN
src/assets/info/teacher.jpg


+ 16 - 1
src/common/apiConfig.js

@@ -52,7 +52,22 @@ export const API_CONFIG = {
   ajax_Suffix: {
     functionName: "select_Suffix",
   },
-
+  //查询学校教研室
+  ajax_selectPerInfoAllTea: {
+    functionName: "selectPerInfoAllTea",
+  },
+  //查询个人信息
+  ajax_selectTestUser: {
+    functionName: "selectTestUser",
+  },
+  //获取教研室列表
+  ajax_selectTeacherOfficeBySchool: {
+    functionName: "selectTeacherOfficeBySchool",
+  },
+  //修改
+  ajax_updateUserInfoText: {
+    functionName: "updateUserInfoText",
+  },
   // 查询权限
   ajax_schoolPermission: {
     functionName: "select_schoolPermission",

+ 613 - 0
src/components/userInfoA.vue

@@ -0,0 +1,613 @@
+<template>
+	<el-dialog
+		title="个人信息"
+		:visible.sync="dialogVisibleInfo"
+		:append-to-body="true"
+		width="500px"
+		:before-close="handleClose"
+		class="dialog_diy"
+		:close-on-click-modal="false"
+		:close-on-press-escape="false"
+		:show-close="isClosed || rrole"
+	>
+		<div style="width: 100%; height: 100%" v-loading="digLoading">
+			<div class="info_box">
+				<div class="img" v-loading="imgLoading">
+					<img :src="info.headportrait ? info.headportrait : avator" alt="" />
+					<div class="mask" @click.stop="addImg($event)">
+						<img src="../assets/info/camera_icon.png" alt="" />
+						<input
+							type="file"
+							accept="image/*"
+							capture="camera"
+							style="display: none"
+							@change="beforeUpload($event)"
+						/>
+					</div>
+				</div>
+				<div class="info_span">
+					<span>姓名:</span>
+					<el-input v-model="info.username" placeholder="请输入姓名"></el-input>
+				</div>
+				<!-- <div class="info_span">
+          <span>教研室:</span>
+          <el-select v-model="info.teacherOffice"  multiple placeholder="类型" @change="Ochange">
+            <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </div> -->
+
+				<div
+					class="info_span"
+					v-for="item in teaType"
+					:key="item.id"
+					:class="{
+						'error-text': !item.value.length,
+						'error-border': !item.value.length,
+					}"
+				>
+					<span>
+						{{ item.name + ":" }}
+					</span>
+					<el-select
+						v-model="item.value"
+						multiple
+						:placeholder="'请选择' + item.name"
+						@change="Ochange"
+					>
+						<el-option
+							v-for="i in item.child"
+							:key="i.id"
+							:label="i.name"
+							:value="i.id"
+						>
+						</el-option>
+					</el-select>
+				</div>
+				<div class="info_span">
+					<span>简介:</span>
+					<textarea
+						v-autoHeight="68"
+						rows="2"
+						class="binfo_input binfo_textarea"
+						cols
+						v-model="info.intro"
+						placeholder="想说点什么..."
+					></textarea>
+				</div>
+			</div>
+		</div>
+		<span slot="footer" class="dialog-footer">
+			<el-button type="primary" @click="confirm()">确 认</el-button>
+			<el-button @click="close()" v-if="isClosed">关 闭</el-button>
+		</span>
+	</el-dialog>
+</template>
+
+<script>
+import avator from "../assets/info/teacher.jpg";
+import { API_CONFIG } from "@/common/apiConfig";
+
+export default {
+	props: {
+		// dialogVisibleInfo: {
+		// 	type: Boolean,
+		// 	default: false,
+		// },
+		rrole: {
+			type: String,
+		},
+		userid: {
+			type: String,
+		},
+		oid: {
+			type: String,
+		},
+	},
+	watch: {
+		dialogVisibleInfo(newVal) {
+			if (newVal) {
+				this.getTypeInfo();
+			}
+		},
+	},
+	directives: {
+		autoHeight: {
+			update(el, binding) {
+				const { value } = binding;
+				if (value && typeof value === "number") {
+					el.style.height = `${value}px`;
+				} else {
+					el.style.height = "auto";
+				}
+			},
+			componentUpdated(el) {
+				el.style.height = `${el.scrollHeight + 5}px`;
+			},
+		},
+	},
+	data() {
+		return {
+			avator: avator,
+			info: {},
+			imgLoading: false,
+			classJuri: [],
+			teaType: [],
+			teacherType: [],
+			allItems: [],
+			options: [],
+			typeId: "",
+			typeId2: "",
+			formLabelWidth: "100px",
+			oidArray: ["d67940a5-510c-40ea-9c9a-2631ab03013a"],
+			resultInfo: "", // 用于存储字符串
+			isClosed: true,
+			dialogVisibleInfo: false,
+			digLoading: false,
+		};
+	},
+	// mounted() {
+	// 	this.getTypeInfo();
+	// },
+	methods: {
+		cha() {
+			this.$forceUpdate();
+		},
+		openDig() {
+			this.dialogVisibleInfo = true;
+			// this.getTypeInfo();
+		},
+		//获取分类类名
+		getTypeInfo() {
+			this.digLoading = true;
+			let params = [
+				{
+					functionName: API_CONFIG.ajax_selectPerInfoAllTea.functionName, // 调用存储过程的名称
+					oid: this.oid, //学校id
+				},
+			];
+			this.$ajax
+				.post(API_CONFIG.baseUrl, params)
+				.then((res) => {
+					this.teaType = res.data[0];
+					let typeInfo = res.data[1];
+
+					this.teaType.forEach((e) => {
+						e.child = [];
+						e.value = [];
+						typeInfo.forEach((i) => {
+							if (e.id == i.parentid) {
+								e.child.push({ id: i.id, name: i.name });
+							}
+						});
+					});
+					// console.log(this.teaType, "teaType");
+					this.options = res.data[2];
+					this.getData();
+				})
+				.catch((err) => {
+					this.digLoading = false;
+					console.error(err);
+				});
+		},
+		handleClose(done) {
+			this.typeId = "";
+			this.close();
+			done();
+		},
+		close() {
+			this.typeId = "";
+			this.dialogVisibleInfo = false;
+			// this.$emit("update:dialogVisibleInfo", false);
+		},
+		generateResultInfo() {
+			// 从 teaType 中提取所有的值
+			const selectedValues = this.teaType.flatMap((item) => item.value);
+
+			// 确保 typeId 是数组,将其添加到 selectedValues 中
+			const combinedValues = Array.isArray(this.info.teacherOffice)
+				? selectedValues.concat(this.info.teacherOffice)
+				: selectedValues.concat([this.info.teacherOffice]);
+
+			// 将合并后的数组转换为逗号分隔的字符串
+			this.resultInfo = combinedValues.join(",");
+		},
+		confirm() {
+			if (!this.panData()) {
+				this.$message.error("请完善教研室分类信息");
+				return;
+			}
+			if (!this.info.username) {
+				this.$message.error("姓名不能为空!");
+				return;
+			}
+			// let teaTypeSelections = this.teaType.map(item => ({
+			//   selectedValues: item.value.join(",")  // 如果是数组,转为逗号分隔的字符串
+			// }));
+			this.generateResultInfo();
+
+			// let params = [
+			// 	{
+			// 		userid: this.userid,
+			// 		username: this.info.username,
+			// 		cclassid: this.resultInfo,
+			// 		job: this.info.job,
+			// 		subject: this.info.subject,
+			// 		intro: this.info.intro,
+			// 		h: this.info.headportrait ? this.info.headportrait : "",
+			// 	},
+			// ];
+			let params = [
+				{
+					functionName: API_CONFIG.ajax_updateUserInfoText.functionName, // 调用存储过程的名称
+					userid: this.userid,
+					username: this.info.username,
+					cclassid: this.resultInfo,
+					job: this.info.job,
+					subject: this.info.subject,
+					intro: this.info.intro,
+					h: this.info.headportrait ? this.info.headportrait : "",
+				},
+			];
+
+			console.log(params);
+			this.$ajax
+				.post(API_CONFIG.baseUrl, params)
+				.then(() => {
+					this.$message.success("修改成功");
+					this.dialogVisibleInfo = false;
+				})
+				.catch((err) => {
+					this.$message.error("网络不佳");
+					this.dialogVisibleInfo = false;
+					console.error(err);
+				});
+		},
+		getData() {
+			this.digLoading = true;
+			let params = [
+				{
+					functionName: API_CONFIG.ajax_selectTestUser.functionName, // 调用存储过程的名称
+					uid: this.userid, //学校id
+				},
+			];
+
+			this.$ajax
+				.post(API_CONFIG.baseUrl, params)
+				.then((res) => {
+					this.info = res.data[0][0];
+					this.info.teacherOffice = [];
+					let array = [];
+					for (var i = 0; i < this.options.length; i++) {
+						array.push(this.options[i].id);
+					}
+					this.info.teacherOffice = this.arrayToArray(
+						this.info.cclassid.split(","),
+						array
+					);
+					// console.log(this.info.cclassid);
+					let count = 0;
+					this.teaType.forEach((e) => {
+						let array2 = [];
+						for (var i = 0; i < e.child.length; i++) {
+							array2.push(e.child[i].id);
+						}
+						e.value = this.arrayToArray(this.info.cclassid.split(","), array2);
+						if (e.value.length) {
+							count++;
+						}
+					});
+					if (count != this.teaType.length) {
+						this.dialogVisibleInfo = true;
+					}
+					if (!this.panData()) {
+						this.isClosed = false;
+					} else {
+						this.isClosed = true;
+					}
+					this.digLoading = false;
+
+					this.$forceUpdate();
+				})
+				.catch((err) => {
+					this.digLoading = false;
+
+					console.error(err);
+				});
+		},
+		panData() {
+			let count = 0;
+			this.teaType.forEach((e) => {
+				if (e.value.length) {
+					count++;
+				}
+			});
+			return count == this.teaType.length;
+		},
+		arrayToArray(arrayo, arrayt) {
+			let array1 = arrayo;
+			let array2 = arrayt;
+
+			let commonElements = [];
+
+			for (let i = 0; i < array1.length; i++) {
+				for (let j = 0; j < array2.length; j++) {
+					if (array1[i] === array2[j]) {
+						commonElements.push(array1[i]);
+					}
+				}
+			}
+			return commonElements;
+		},
+		addImg(e) {
+			var el = e.currentTarget;
+			el.getElementsByTagName("input")[0].click();
+			e.target.value = "";
+		},
+		beforeUpload(event) {
+			// const loading = this.openLoading();
+			var file = event.target.files[0];
+			var credentials = {
+				accessKeyId: "AKIATLPEDU37QV5CHLMH",
+				secretAccessKey: "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",
+			}; //秘钥形式的登录上传
+			window.AWS.config.update(credentials);
+			window.AWS.config.region = "cn-northwest-1"; //设置区域
+
+			var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
+			var imgA = [
+				"png",
+				"jpg",
+				"jpeg",
+				"bmp",
+				"gif",
+				"webp",
+				"psd",
+				"svg",
+				"tiff",
+			];
+			if (
+				imgA.indexOf(file.name.split(".")[file.name.split(".").length - 1]) ==
+				-1
+			) {
+				this.$message.error("图片格式错误");
+				return;
+			}
+			this.imgLoading = true;
+			var _this = this;
+
+			if (file) {
+				var params = {
+					Key:
+						file.name.split(".")[0] +
+						new Date().getTime() +
+						"." +
+						file.name.split(".")[file.name.split(".").length - 1],
+					ContentType: file.type,
+					Body: file,
+					"Access-Control-Allow-Credentials": "*",
+					ACL: "public-read",
+				}; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
+				var options = {
+					partSize: 2048 * 1024 * 1024,
+					queueSize: 2,
+					leavePartsOnError: true,
+				};
+				bucket
+					.upload(params, options)
+					.on("httpUploadProgress", function () {
+						//这里可以写进度条
+						// console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
+					})
+					.send(function (err, data) {
+						_this.imgLoading = false;
+						// loading.close();
+						if (err) {
+							_this.$message.error("上传失败");
+						} else {
+							_this.info.headportrait = data.Location;
+							_this.$forceUpdate();
+
+							console.log(_this.checkJson);
+							console.log(data.Location);
+						}
+					});
+			}
+		},
+		//获取教研室列表
+		getClass2() {
+			// let params = {
+			// 	oid: this.oid,
+			// };
+			let params = [
+				{
+					functionName:
+						API_CONFIG.ajax_selectTeacherOfficeBySchool.functionName, // 调用存储过程的名称
+					oid: this.oid, //学校id
+				},
+			];
+
+			this.$ajax
+				.post(API_CONFIG.baseUrl, params)
+				.then((res) => {
+					this.classJuri = res.data[0];
+					this.getTypeInfo();
+				})
+				.catch((err) => {
+					this.isLoading = false;
+					console.error(err);
+				});
+		},
+		Ochange() {
+			this.$forceUpdate();
+		},
+	},
+};
+</script>
+
+<style scoped>
+.dialog_diy >>> .el-dialog {
+	/* height: 100%; */
+	margin: 10vh auto !important;
+}
+
+.dialog_diy >>> .el-dialog__header {
+	background: #454545 !important;
+	padding: 15px 20px;
+}
+
+.dialog_diy >>> .el-dialog__body {
+	height: calc(100% - 124px);
+	box-sizing: border-box;
+	padding: 0px;
+}
+
+.dialog_diy >>> .el-dialog__title {
+	color: #fff;
+}
+
+.dialog_diy >>> .el-dialog__headerbtn {
+	top: 19px;
+}
+
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
+	color: #fff;
+}
+
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
+	color: #fff;
+}
+
+.dialog_diy >>> .el-dialog__body,
+.dialog_diy >>> .el-dialog__footer {
+	background: #fafafa;
+}
+
+.info_box {
+	width: 100%;
+	display: flex;
+	flex-direction: column;
+	align-items: center;
+	padding: 30px 0;
+}
+
+.info_box > .img {
+	width: 80px;
+	height: 80px;
+	overflow: hidden;
+	border-radius: 50%;
+	position: relative;
+}
+
+.info_box > .img:hover > .mask {
+	display: flex;
+}
+
+.info_box > .img > .mask {
+	cursor: pointer;
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+	background: rgba(0, 0, 0, 0.5);
+	/* display: flex; */
+	align-items: center;
+	justify-content: center;
+	display: none;
+}
+
+.info_box > .img > .mask > img {
+	width: 20px;
+}
+
+.info_box > .img > img {
+	width: 100%;
+	height: 100%;
+	object-fit: cover;
+}
+
+.binfo_input {
+	width: 100%;
+	margin: 0;
+	padding: 12px 14px;
+	display: block;
+	min-width: 0;
+	outline: none;
+	box-sizing: border-box;
+	background: none;
+	border: none;
+	border-radius: 4px;
+	background: #fff;
+	font-size: 16px;
+	resize: none;
+	font-family: "Microsoft YaHei";
+	min-height: 48px;
+	/* border: 1px solid #3682fc00; */
+	border: 1px solid #c0c4cc;
+}
+
+.binfo_textarea {
+	border: 1px solid #c0c4cc;
+	font-size: 16px;
+	resize: none;
+	/* background: #f6f6f6; */
+	font-family: "Microsoft YaHei";
+	font-size: 14px;
+	color: #606266;
+}
+
+.binfo_input:focus-visible {
+	border: 1px solid #3681fc !important;
+}
+
+.binfo_textarea::-webkit-input-placeholder {
+	/* WebKit browsers */
+	color: rgb(192, 196, 204);
+}
+
+.binfo_textarea:-moz-placeholder {
+	/* Mozilla Firefox 4 to 18 */
+	color: rgb(192, 196, 204);
+}
+
+.binfo_textarea::-moz-placeholder {
+	/* Mozilla Firefox 19+ */
+	color: rgb(192, 196, 204);
+}
+
+.binfo_textarea:-ms-input-placeholder {
+	/* Internet Explorer 10+ */
+	color: rgb(192, 196, 204);
+}
+.el-form-item__label {
+	margin-left: -14px;
+}
+.elInput {
+	margin-left: 10px;
+}
+
+.info_span {
+	display: flex;
+	margin-top: 10px;
+	width: 350px;
+}
+
+.info_span > span:nth-child(1) {
+	width: 100px;
+	min-width: 100px;
+	text-align: right;
+	line-height: 40px;
+}
+
+.info_span > div {
+	width: 250px;
+}
+
+.error-border >>> .el-input__inner {
+	border: 1px solid red; /* 红色边框 */
+}
+
+.error-text {
+	color: red; /* 红色文字 */
+}
+</style>

+ 1 - 0
src/store/modules/user.js

@@ -124,6 +124,7 @@ const actions = {
           })
           .catch((error) => {
             // var _user = { userid: "a9c5c04d-1b6f-11f0-a66a-005056924926" }; //刘玉彤
+            // var _user = { userid: "6fa5dd31-83b6-11f0-9c7b-005056924926" }; //kkk
             // var _user = { userid: "5943e08c-b7d4-11ed-8d51-005056b86db5" }; //cs111
             // var _user = { userid: "6c56ec0e-2c74-11ef-bee5-005056b86db5" }; //qgt
             // var _user = { userid: "4fda23d4-1b6f-11f0-a66a-005056924926" }; //管理员

+ 38 - 10
src/views/HomeView.vue

@@ -18,9 +18,9 @@
 							}}</span>
 						</div>
 						<div class="person">
-							<div class="person_name">
+							<div class="person_name" @click="editInfo">
+								<!-- @click="openData()" -->
 								<img
-									@click="openData()"
 									style="
 										width: 40px;
 										height: 40px;
@@ -86,7 +86,6 @@
 					>
 					</iframe>
 				</div>
-				
 
 				<div
 					v-if="loading"
@@ -115,6 +114,12 @@
 				</div>
 			</div>
 		</div>
+		<userInfoA
+			ref="userInfoA"
+			:userid="roleUser.userid"
+			:oid="roleUser.organizeid"
+			:rrole="roleUser.rrole"
+		/>
 	</div>
 </template>
 
@@ -124,6 +129,7 @@ import { loginOut } from "@/api/user";
 import sidebarL from "../components/sidebarL.vue";
 import { API_CONFIG } from "@/common/apiConfig";
 import store from "../store";
+import userInfoA from "../components/userInfoA.vue";
 import homepageL from "./homepageL.vue";
 
 export default {
@@ -131,12 +137,24 @@ export default {
 	components: {
 		sidebarL,
 		homepageL,
+		userInfoA,
 	},
 	data() {
 		return {
 			AppJSon: [],
 			loading: false,
-			clearifa:''
+			clearifa: "",
+			// 荔园集团下的学校
+			mergedList: [
+				"3823a6a5-1b6e-11f0-a66a-005056924926",
+				"292e34dc-1b6e-11f0-a66a-005056924926",
+				"21d6b367-1b6e-11f0-a66a-005056924926",
+				"1a1a172d-1b6e-11f0-a66a-005056924926",
+				"1197f86b-1b6e-11f0-a66a-005056924926",
+				"f235659b-1b6d-11f0-a66a-005056924926",
+				"d87b62d3-1b6d-11f0-a66a-005056924926",
+				"c25ea59b-1b6d-11f0-a66a-005056924926",
+			],
 		};
 	},
 	computed: {
@@ -184,21 +202,25 @@ export default {
 		openData() {
 			window.topU.U.MD.D.I.openApplication("my");
 		},
+		// 打开编辑弹框
+		editInfo() {
+			this.$refs.userInfoA.openDig();
+		},
 		// 打开平台应用工具
 		AddAppJson(val) {
-			console.log('AddAppJson',val);
+			console.log("AddAppJson", val);
 			// 荔园首页工具切换,不缓存工具
-			if (val.clearL){
+			if (val.clearL) {
 				this.AppJSon.forEach((e) => {
 					this.$set(e, "stateL", false); // 使用 Vue.set 确保响应式
 				});
 				this.loading = true;
-				this.clearifa = val.json
+				this.clearifa = val.json;
 				// 打开平台工具加载两秒
 				setTimeout(() => {
 					this.loading = false;
 				}, 2000);
-				return 
+				return;
 			}
 
 			// 判断有没有打开过这个应用
@@ -231,7 +253,6 @@ export default {
 				});
 
 				setTimeout(() => {
-
 					// console.log('this.$refs.appRef.contentWindow.document.body;', this.$refs[val.toolId][0].contentWindow.document.body);
 
 					if (!this.$refs[val.toolId][0].contentWindow.document.body) {
@@ -268,7 +289,7 @@ export default {
 
 		// 获取学校权限与组织权限,优先使用学校权限,其次使用组织权限
 		async getPer() {
-			this.clearifa = ''
+			this.clearifa = "";
 			// 查询首页应用
 			this.$refs.homepageLRef.getData();
 			//查询cocofrow最近使用与收藏
@@ -424,6 +445,13 @@ export default {
 	mounted() {
 		console.log("重新获取数据");
 		this.getPer();
+		if (
+			!this.roleUser.cclassid &&
+			!this.roleUser.rrole &&
+			this.mergedList.includes(this.roleUser.org)
+		) {
+			this.editInfo();
+		}
 	},
 };
 </script>

+ 2 - 0
src/views/homepageL.vue

@@ -38,6 +38,8 @@ import { API_CONFIG } from "@/common/apiConfig";
                 this.$refs.topPageRef.getData()
 
                 this.$refs.topPageRef.getAdmincocoFlow()
+                console.log('333');
+                
             },
 
             // 查询首页应用