|
@@ -281,54 +281,49 @@
|
|
|
</div>
|
|
|
</Modal>
|
|
|
<Modal v-model="assistantStatus" width="700" footer-hide title="添加协同教师" class="serch-course">
|
|
|
- <p class="serch-tips">注意:一个名单中的协同教师最多添加3位</p>
|
|
|
- <div>
|
|
|
- <Input search :placeholder="$t('teachermgmt.search')" v-model="keyword" @on-search="filterTeacher" @on-change="filterTeacher" style="width: 180px;" />
|
|
|
- <span v-show="!teacherListShow.length" style="margin-left: 10px; cursor: pointer; color: #2D8CF0;" @click="searchIn">
|
|
|
- 在平台搜索
|
|
|
- </span>
|
|
|
- <!-- <p v-show="searchIdErrorMsg">{{ searchIdErrorMsg }}</p> -->
|
|
|
- </div>
|
|
|
- <div v-if="!teacherListShow.length" id="serchUserCourse" style="height: 400px;">
|
|
|
- <div v-if="!searchIdErrorMsg && !searchInfo" class="serch-word">
|
|
|
- <span v-show="$store.state.userInfo.hasSchool">学校中暂无该教师,</span>
|
|
|
- <span v-show="!$store.state.userInfo.hasSchool">暂未加入学校,</span>
|
|
|
- 请输入手机号、用户编号或电子信箱等资讯进行搜寻
|
|
|
- </div>
|
|
|
- <p v-else-if="!searchInfo" class="serch-word">
|
|
|
- {{ searchIdErrorMsg }}
|
|
|
- </p>
|
|
|
- <div class="resultBox" v-else>
|
|
|
- <div class="avatar-div">
|
|
|
- <img v-if="searchInfo.picture" :src="searchInfo.picture" />
|
|
|
- <img v-else src="@/assets/image/touxiang.png" />
|
|
|
- </div>
|
|
|
- <div class="basicInfo">
|
|
|
- <h3>{{searchInfo.name}}</h3>
|
|
|
- <p>{{searchInfo.id}}</p>
|
|
|
- <p>{{searchInfo.email}}</p>
|
|
|
+ <Form>
|
|
|
+ <FormItem label="校内账号" v-if="$store.state.userInfo.hasSchool">
|
|
|
+ <Select v-model="sltTeachers" multiple @on-change="assistantChange">
|
|
|
+ <Option v-for="item in teacherList" :value="item.id" :key="item.id">{{ item.name }}({{ item.id }})</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="平台账号">
|
|
|
+ <Input search placeholder="请输入手机号、用户编号或电子信箱等资讯" v-model="keyword" @on-search="searchIn" />
|
|
|
+ <div v-if="assistantsList.length" style="border-bottom: 1px dashed #ccc; padding-bottom: 10px;">
|
|
|
+ <div class="resultBox" v-for="(item, index) in assistantsList" :key="item.id">
|
|
|
+ <div class="avatar-div">
|
|
|
+ <img v-if="item.picture" :src="item.picture" />
|
|
|
+ <img v-else src="@/assets/image/touxiang.png" />
|
|
|
+ </div>
|
|
|
+ <div class="basicInfo">{{item.name}}</div>
|
|
|
+ <div class="basicInfo">{{item.id}}</div>
|
|
|
+ <div class="basicInfo">{{item.email}}</div>
|
|
|
+ <div style="width: 100px;">
|
|
|
+ <Button type="error" size="small" @click="deleteList(index)">移除列表</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="serchInfo-btns">
|
|
|
- <Button class="serchInfoBtn" :loading="inviteLoading" @click="addAssistant()">{{ $t('teachermgmt.addTeacher.btn.sendInvite') }}</Button>
|
|
|
+ <div style="margin-bottom: 40px;">
|
|
|
+ <p v-if="!searchInfo" class="serch-word">
|
|
|
+ {{ searchIdErrorMsg }}
|
|
|
+ </p>
|
|
|
+ <div class="resultBox" v-else>
|
|
|
+ <div class="avatar-div">
|
|
|
+ <img v-if="searchInfo.picture" :src="searchInfo.picture" />
|
|
|
+ <img v-else src="@/assets/image/touxiang.png" />
|
|
|
+ </div>
|
|
|
+ <div class="basicInfo">{{searchInfo.name}}</div>
|
|
|
+ <div class="basicInfo">{{searchInfo.id}}</div>
|
|
|
+ <div class="basicInfo">{{searchInfo.email}}</div>
|
|
|
+ <div style="width: 100px;">
|
|
|
+ <Button v-show="searchInfo.id != $store.state.userInfo.TEAMModelId" type="info" size="small" @click="addAssistant(true)">加入列表</Button>
|
|
|
+ <span v-show="searchInfo.id === $store.state.userInfo.TEAMModelId">本人</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div v-else>
|
|
|
- <Table ref="sltTea" height="450" :columns="teaCol" :data="teacherListShow" style="margin-top:10px" @on-selection-change="(selection)=>{sltTeachers = selection}">
|
|
|
- <template slot-scope="{ row }" slot="picture">
|
|
|
- <PersonalPhoto :name="row.name" :picture="row.picture" />
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row }" slot="job">
|
|
|
- <span>{{row.job || '--'}}</span>
|
|
|
- </template>
|
|
|
- <!-- <template slot-scope="{ row,index }" slot="subject">
|
|
|
- <span :style="{color:row.subjectIds && row.subjectIds.length? '':'red'}" class="subject-tag" @click="showSetSubj(index)">
|
|
|
- {{row.subjectIds && row.subjectIds.length ? getSubjectNames(row.subjectIds) : $t('teachermgmt.notSet')}}
|
|
|
- </span>
|
|
|
- </template> -->
|
|
|
- </Table>
|
|
|
- <Button class="serchInfoBtn" :loading="inviteLoading" @click="addAssistant(true)">{{ $t('teachermgmt.addTeacher.btn.sendInvite') }}</Button>
|
|
|
- </div>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ <Button class="serchInfoBtn" :loading="inviteLoading" @click="addAssistant()">保存</Button>
|
|
|
</Modal>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -489,6 +484,8 @@
|
|
|
searchIdErrorMsg: '',
|
|
|
searchInfo: undefined,
|
|
|
groupIdsRel: [],
|
|
|
+ inviteLoading: false,
|
|
|
+ assistantsList: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -1503,6 +1500,9 @@
|
|
|
selectClass(index) {
|
|
|
this.curClassIndex = index;
|
|
|
this.agreeJoin = !this.teaClassList.length ? true : this.teaClassList[index].joinLock ? true : false;
|
|
|
+ this.sltTeachers = []
|
|
|
+ this.assistantsList = []
|
|
|
+ this.$forceUpdate()
|
|
|
},
|
|
|
// 保存名单
|
|
|
saveStuList(stuList, isUpdCus) {
|
|
@@ -1565,46 +1565,125 @@
|
|
|
this.isFull = await this.$tools.isBlobContainerFull("private");
|
|
|
},
|
|
|
getTeacherList() {
|
|
|
- if(this.$store.state.userInfo.hasSchool && !this.teacherList.length) {
|
|
|
+ let assistants = [...this.teaClassList[this.curClassIndex].assistants]
|
|
|
+ if(this.$store.state.userInfo.hasSchool) {
|
|
|
this.listLoading = true
|
|
|
this.$api.schoolUser.getSchoolTeacherAll({
|
|
|
school_code: this.$store.state.userInfo.schoolCode
|
|
|
}).then(res => {
|
|
|
+ let offAss = []
|
|
|
+ assistants.forEach(item => {
|
|
|
+ let info = res.teachers.find(tea => {
|
|
|
+ return tea.id === item
|
|
|
+ })
|
|
|
+ if(info) {
|
|
|
+ this.sltTeachers.push(info.id)
|
|
|
+ } else {
|
|
|
+ offAss.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(offAss.length) {
|
|
|
+ this.searchIn('', offAss)
|
|
|
+ }
|
|
|
this.teacherList = res.teachers
|
|
|
- this.assistantStatus = true
|
|
|
+ let index = this.teacherList.find(item => {
|
|
|
+ return item.id === this.$store.state.userInfo.TEAMModelId
|
|
|
+ })
|
|
|
+ if(index != -1) {
|
|
|
+ this.teacherList.splice(index, 1)
|
|
|
+ }
|
|
|
+ // this.assistantStatus = true
|
|
|
this.listLoading = false
|
|
|
})
|
|
|
} else {
|
|
|
- this.assistantStatus = true
|
|
|
+ this.searchIn('', assistants)
|
|
|
}
|
|
|
+ this.assistantStatus = true
|
|
|
},
|
|
|
- addAssistant(isSchool) {
|
|
|
- if((isSchool && !this.sltTeachers.length) || (!isSchool && !this.searchInfo)) {
|
|
|
- this.$Message.warning('请先选择教师!')
|
|
|
+ addAssistant(isSave) {
|
|
|
+ if(isSave) {
|
|
|
+ let length = this.sltTeachers.length + this.assistantsList.length
|
|
|
+ if(length === 3) {
|
|
|
+ this.$Message.warning('最多添加三位协同教师')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let info = {...this.searchInfo}
|
|
|
+ if(!this.assistantsList.find(item => item.id === this.searchInfo.id)) {
|
|
|
+ this.assistantsList.push(info)
|
|
|
+ }
|
|
|
+ this.searchInfo = undefined
|
|
|
+ } else {
|
|
|
+ if(!this.sltTeachers.length && !this.assistantsList.length) {
|
|
|
+ this.$Message.warning('请先选择教师!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let assistants = []
|
|
|
+ assistants = this.assistantsList.map(item => {
|
|
|
+ return item.id
|
|
|
+ })
|
|
|
+ assistants = assistants.concat(this.sltTeachers)
|
|
|
+ let params = {
|
|
|
+ scope: 'private',
|
|
|
+ grant_type: 'upsert-scheduleTask',
|
|
|
+ courseId: this.courseId,
|
|
|
+ datas: [
|
|
|
+ {
|
|
|
+ roomId: this.teaClassList[this.curClassIndex].roomId,
|
|
|
+ groupId: this.teaClassList[this.curClassIndex].groupId,
|
|
|
+ type: this.teaClassList[this.curClassIndex].type,
|
|
|
+ teacherId: this.teaClassList[this.curClassIndex].teacherId,
|
|
|
+ school: this.teaClassList[this.curClassIndex].school,
|
|
|
+ assistants,
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ this.$api.newCourse.courseManage(params).then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ if(res.courseTasks) {
|
|
|
+ this.$Message.success('邀请成功')
|
|
|
+
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$Message.error('邀请失败')
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
- searchIn() {
|
|
|
- if(!this.teacherListShow.length) {
|
|
|
- this.searchIdErrorMsg = '';
|
|
|
- if (this.keyword) {
|
|
|
- if (this.keyword.indexOf(0) == 0) this.keyword = this.keyword.substr(1) //開頭有0要去0
|
|
|
- // 向CoreID取得使用者
|
|
|
- this.$store.dispatch('user/getUserFromCoreId', [this.keyword]).then(
|
|
|
- (res) => {
|
|
|
- if (res.code == 1 && res.data.length > 0) {
|
|
|
+ deleteList(index) {
|
|
|
+ this.assistantsList.splice(index, 1)
|
|
|
+ },
|
|
|
+ /* 设置协同教师 */
|
|
|
+ assistantChange(val) {
|
|
|
+ let length = val.length + this.assistantsList.length
|
|
|
+ if(length > 3) {
|
|
|
+ this.$Message.warning(this.$t('newCusMgt.tip3'))
|
|
|
+ this.sltTeachers = this.sltTeachers.slice(0, 3 - this.assistantsList.length)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ searchIn(value, assistants) {
|
|
|
+ this.searchIdErrorMsg = '';
|
|
|
+ if (this.keyword || assistants) {
|
|
|
+ if (this.keyword.indexOf(0) == 0) this.keyword = this.keyword.substr(1) //開頭有0要去0
|
|
|
+ // 向CoreID取得使用者
|
|
|
+ let params = assistants ? assistants : [this.keyword]
|
|
|
+ this.$store.dispatch('user/getUserFromCoreId', params).then(
|
|
|
+ (res) => {
|
|
|
+ if (res.code == 1 && res.data.length > 0) {
|
|
|
+ if(assistants) {
|
|
|
+ this.assistantsList = res.data
|
|
|
+ } else {
|
|
|
this.searchInfo = res.data[0];
|
|
|
}
|
|
|
- else {
|
|
|
- this.searchIdErrorMsg = this.$t('teachermgmt.message.info19');
|
|
|
- }
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- //this.$Message.error('user/getUserFromCoreId API error!')
|
|
|
}
|
|
|
- );
|
|
|
- } else {
|
|
|
- this.$Message.warning(this.$t('teachermgmt.message.info11'));
|
|
|
+ else {
|
|
|
+ this.searchIdErrorMsg = this.$t('teachermgmt.message.info19');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ //this.$Message.error('user/getUserFromCoreId API error!')
|
|
|
}
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(this.$t('teachermgmt.message.info11'));
|
|
|
}
|
|
|
},
|
|
|
//获取教师学科信息
|
|
@@ -1717,32 +1796,20 @@
|
|
|
// width: 430px;
|
|
|
text-align: center;
|
|
|
padding-top: 20px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
.avatar-div{
|
|
|
- margin: 0 auto;
|
|
|
- margin-bottom: 20px;
|
|
|
+ // margin: 0 auto;
|
|
|
border-radius: 50%;
|
|
|
background-color: #fefefe;
|
|
|
- width: 150px;
|
|
|
- height: 150px;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
img{
|
|
|
background-color: #272727;
|
|
|
border-radius: 50%;
|
|
|
- width: 144px;
|
|
|
- height: 144px;
|
|
|
- }
|
|
|
- }
|
|
|
- .basicInfo{
|
|
|
- margin-bottom: 20px;
|
|
|
- h3{
|
|
|
- letter-spacing: 1px;
|
|
|
- color: #888888;
|
|
|
- }
|
|
|
- p{
|
|
|
- font-size: 12px;
|
|
|
- color: #2f8e78;
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
}
|
|
|
}
|
|
|
}
|