Bladeren bron

工作台增加切换学校

liurongli 1 maand geleden
bovenliggende
commit
059cd6978a

+ 2 - 2
components/navBar.vue

@@ -8,7 +8,7 @@
 			<uni-icons class="left_icon" type="left" color="#333333" @click="GoBack()" />
 		</template>
 		<!-- 表头内容 -->
-		<view :class="['nav_head',{'only_title':!showHeadSearchInput}]" v-if="!onlyTitle">
+		<view :class="['nav_head',{'only_title':!showHeadSearchInput,'leftWidth0':leftWidth=='0rpx'}]" v-if="!onlyTitle">
 			<text class="nav_title">{{title}}</text>
 			<template v-if="showHeadSearchInput">
 				<uni-easyinput v-if="rightType=='searchBox'" class="search_box" v-model="state.searchWord" trim="all" :styles="state.searchInputStyles"
@@ -45,7 +45,7 @@
 		</view>
 		<!-- tabs 按钮 -->
 		<scroll-view v-if="showTabBtns && tabBtns.length > 0" class="scroll_tab_btn" scroll-x="true" scroll-left="0" :show-scrollbar="false">
-			<slot name="tab_btns_lef" />	
+			<slot name="tab_btns_left" />	
 			<view :class="['tab_item',{'selected':item.value===state.tabBtnSelected}]" v-for="item in tabBtns" :key="item.value" @click="SelectTabBtnsValue(item.value)">
 				{{item.label}}
 			</view>

+ 33 - 0
pages/login/index.vue

@@ -7,6 +7,9 @@
 			大数据精准教学诊断平台
 		</view>
 		<view class="login_content">
+			<view class="login_tab">
+				<text :class="['tab_item',{'tab_active':item.value==state.tabActive}]" v-for="item in state.tabList" :key="item.value" @click="ChangeTab(item.value)">{{item.label}}</text>
+			</view>
 			<view class="user_name">
 				<input class="input_name" v-model="state.username" placeholder="请输入账号" @blur="inputBlur"
 					@focus="inputFocus" />
@@ -98,6 +101,14 @@ const popupSlideCode = ref(null);
 const agreementPopupDialog = ref(null);
 const isCheck = ref(false);
 const state = reactive({
+	tabList:[{
+		label:'教师',
+		value:'1'
+	},{
+		label:'学生',
+		value:'2'
+	}],
+	tabActive:'1',
 	username: '',
 	password: '',
 	schoolId: '',
@@ -159,6 +170,9 @@ onMounted(() => {
 	console.log('设备标识id', systemInfo);
 	// #endif
 });
+const ChangeTab = (value) => {
+	state.tabActive = value;
+}
 const hideUserPass = () => {
 	state.isShowPassWord = false;
 }
@@ -479,6 +493,25 @@ const AgreementDetails = () => {
 </script>
 
 <style lang="scss">
+.login_tab{
+	display: flex;
+	width: 100%;
+	padding: 0 24px 32rpx;
+	box-sizing: border-box;
+	gap: 40rpx;
+	.tab_item{
+		height: 44rpx;
+		line-height: 44rpx;
+		font-weight: 500;
+		font-size: 32rpx;
+		color: #303133;
+		padding-bottom: 8rpx;
+		&.tab_active{
+			color: #2E64FA;
+			border-bottom: 4rpx solid #2E64FA;
+		}
+	}
+}
 :deep(.school_list) {
 	padding: 0 30rpx;
 	width: 100%;

+ 1 - 1
pages/teacherHonor/myHonor/index.vue

@@ -7,7 +7,7 @@
 				<text class="text" @click="UploadEditMyHonor('')">上传荣誉</text>
 			</view>
 		</template>
-		<template #tab_btns_lef>
+		<template #tab_btns_left>
 			<view class="select_box" @click="ShowDateTimePopup">
 				<view class="select_label">{{state.dateTypeText}}</view>
 				<uni-icons :type="state.showStatus?'up':'down'" class="select_icon"></uni-icons>

+ 143 - 8
pages/workspace/index.vue

@@ -1,7 +1,15 @@
 <template>
 	<view class="page_workspace"
-		:style="{ paddingTop: statusBarHeight + 160 + 'rpx', paddingBottom: safeAreaBottom + 150 + 'rpx' }">
-		<pageHeader></pageHeader>
+		:style="{ paddingBottom: safeAreaBottom + 150 + 'rpx' }">
+		<!-- <pageHeader></pageHeader> -->
+		<nav-bar height="112" :title="state.schoolName" rightType="select" :onlyTitle="false" :showFilterPicker="false" :showTabs="false" :showTabBtns="false" leftWidth="0rpx" rightWidth="0rpx">
+			<template #headRightIcon>
+				<view class="select_box" v-if="schoolsList?.length>1" @click="ChangeSchoolInfo">
+					<view class="select_label">切换学校</view>
+					<image src="@/static/image/icon/arrow_down.png" class="select_icon"></image>
+				</view>
+			</template>
+		</nav-bar>
 		<scroll-view scroll-y class="workspace_content">
 			<!-- 系统列表 -->
 			<view class="system_list">
@@ -143,18 +151,33 @@
 		</view>
 	</view>
 	<common-tabbar></common-tabbar>
+	<!-- 提示框 -->
+	<popup-dialog ref="schoolPopupDialogRef" popType="custom" title="选择学校" @DialogConfirm="DialogSchoolConfirm">
+		<view class="school_list">
+			<view :class="['list_item',{active:state.schoolId==item.schoolId}]" @click="SelectSchool(item.schoolId)" v-for="item in schoolsList" :key="item.schoolId">
+				<view class="school_logo">
+					<image class="logo" v-if="item.schoolLogoUrl" :src="item.schoolLogoUrl"></image>
+					<image class="logo" v-else src="@/static/image/bg/default_user.png"></image>
+				</view>
+				<text class="school_name">{{item.schoolName}}</text>
+				<uni-icons class="item_right" type="right"></uni-icons>
+			</view>
+		</view>
+	</popup-dialog>
 </template>
 
 <script setup>
-import { ref, onMounted, computed } from 'vue';
+import { ref, onMounted,reactive, computed } from 'vue';
 import { onShow } from '@dcloudio/uni-app';
 import { useStore } from 'vuex';
 import workspaceApi from '@/reqApi/workspace.js';
-import PageHeader from '@/components/pageHeader.vue';
+import navBar from '@/components/navBar.vue';
+import popupDialog from '@/components/popupDialog.vue';
+// import PageHeader from '@/components/pageHeader.vue';
 import NoData from '@/components/noData.vue';
 import CommonTabbar from '@/components/commonTabbar.vue';
 import { useSafeArea } from '@/common/safeArea';
-
+import user from '@/reqApi/user.js';
 
 
 const store = useStore();
@@ -175,7 +198,12 @@ const systemItems = ref([
 	{ name: '听课评课', id: '11', key: '', image: '/static/image/workspace/icon11.png', isLarge: false, visible: true },
 	{ name: '基础数据', id: '2', key: '', image: '/static/image/workspace/icon12.png', isLarge: false, visible: true }
 ]);
-
+const schoolPopupDialogRef = ref(null);//选择学校
+const schoolsList = computed(()=>store.state.userStore.schoolsList);
+const state = reactive({
+	schoolName:'',
+	schoolId:''
+});
 const modulesList = ref([]);
 const moduleMap = computed(() => {
 	const map = {};
@@ -328,6 +356,7 @@ const updateYearMonthIndex = () => {
 };
 
 onMounted(() => {
+	getSchoolInfo();
 	initSafeArea();
 	generateYearList();
 	generateMonthList();
@@ -454,6 +483,31 @@ const handleConfirmSchedule = async () => {
 		uni.showToast({ title: '添加日程失败,请稍后重试', icon: 'none', duration: 3000 });
 	}
 };
+//获取学生信息
+const getSchoolInfo = () => {
+	state.schoolName = store.state.userStore.userInfo.schoolName;
+	console.log(state.schoolName,323233)
+	state.schoolId = store.state.userStore.userInfo.schoolId;
+}
+//切换学校弹框
+const ChangeSchoolInfo = () => {
+	schoolPopupDialogRef.value.OpenDialog();
+}
+const SelectSchool = (schoolId) => {
+	state.schoolId = schoolId;
+}
+//切换学校
+const DialogSchoolConfirm = () => {
+	user.chooseBelongSchool({
+		schoolId:state.schoolId,
+		deviceType:'APP'
+	}).then(res=>{
+		if(res.code == 200){
+			state.schoolName = res?.data?.schoolName || '';
+			store.dispatch('setUserInfo');
+		}
+	})
+}
 </script>
 
 <style lang="scss">
@@ -615,7 +669,7 @@ $shadow-sm: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
 					right: 12rpx;
 					width: 32rpx;
 					height: 32rpx;
-					z-index: 100;
+					z-index: 10;
 					img{
 						width: 32rpx;
 						height: 32rpx;
@@ -666,7 +720,7 @@ $shadow-sm: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
 				right: 12rpx;
 				width: 32rpx;
 				height: 32rpx;
-				z-index: 100;
+				z-index: 10;
 				img{
 					width: 32rpx;
 					height: 32rpx;
@@ -1085,4 +1139,85 @@ $shadow-sm: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
 		}
 	}
 }
+.select_box{
+	width: 168rpx;
+	height: 48rpx;
+	padding: 16rpx;
+	flex-shrink: 0;
+	display: flex;
+	align-items: center;
+	box-sizing: border-box;
+	background: rgba(46,100,250,0.1);
+	border-radius: 8rpx;
+	font-weight: 400;
+	font-size: 28rpx;
+	color: #2E64FA;
+	.select_label{
+		flex:1;
+		white-space: nowrap;
+		overflow: hidden;
+		text-overflow: ellipsis;
+	}
+	.select_icon{
+		width: 16rpx;
+		height:16rpx;
+		margin-left: 8rpx;
+	}
+}
+:deep(.school_list){
+	padding:0 30rpx;
+	width: 100%;
+	box-sizing: border-box;
+	.list_item{
+		margin-top: 20rpx;
+		display: flex;
+		align-items: center;
+		width: 100%;
+		height: 108rpx;
+		background-color: #FFFFFF;
+		border-radius: 12rpx;
+		border: 1px solid #E4E7ED;
+		padding: 20rpx 38rpx 20rpx 24rpx;
+		box-sizing: border-box;
+		&.active{
+			border: 1px solid #2E64FA;
+			background-color: rgba(46,100,250,0.1);
+		}
+		.school_logo{
+			width: 68rpx;
+			height: 68rpx;
+			background: #C2D2FF;
+			border-radius: 50%;
+			overflow: hidden;
+			margin-right: 28rpx;
+			.logo{
+				width: 100%;
+				height: 100%;
+				border-radius: 50%;
+			}
+		}
+		.school_name{
+			flex: 1;
+			height: 68rpx;
+			display: inline-flex;
+			align-items: center;
+			justify-content: flex-start;
+			font-weight: 500;
+			font-size: 24rpx;
+			color: #000000;
+			span{
+				display: -webkit-box;
+				-webkit-line-clamp: 2;
+				-webkit-box-orient: vertical;
+				overflow: hidden;
+				word-break: break-all;
+			}
+		}
+		.item_right{
+			margin-left: 28rpx;
+			font-size: 36rpx !important;
+			color: #999999 !important;
+		}
+	}
+}
 </style>

BIN
static/image/icon/arrow_down.png


+ 3 - 0
style/common.scss

@@ -402,6 +402,9 @@ uni-page-body {
 		padding: 0 24rpx 0 96rpx;
 		box-sizing: border-box;
 		box-shadow: 0px 4rpx 16rpx 0px rgba(0,0,0,0.02), inset 0px -2rpx 0px 0px #F3F3F3;
+		&.leftWidth0{
+			padding: 0 24rpx;
+		}
 		&.only_title{
 			padding: 0 96rpx;
 			height: 96rpx;