Bladeren bron

pdf预览build目录更改

OnePsycho 4 jaren geleden
bovenliggende
commit
638c8c1c44

File diff suppressed because it is too large
+ 14827 - 0
TEAMModelOS/ClientApp/public/pdfBuild/pdf.js


File diff suppressed because it is too large
+ 1 - 0
TEAMModelOS/ClientApp/public/pdfBuild/pdf.js.map


File diff suppressed because it is too large
+ 313 - 0
TEAMModelOS/ClientApp/public/pdfBuild/pdf.sandbox.js


File diff suppressed because it is too large
+ 1 - 0
TEAMModelOS/ClientApp/public/pdfBuild/pdf.sandbox.js.map


File diff suppressed because it is too large
+ 65293 - 0
TEAMModelOS/ClientApp/public/pdfBuild/pdf.worker.js


File diff suppressed because it is too large
+ 1 - 0
TEAMModelOS/ClientApp/public/pdfBuild/pdf.worker.js.map


+ 1 - 1
TEAMModelOS/ClientApp/public/web/viewer.html

@@ -34,7 +34,7 @@ See https://github.com/adobe-type-tools/cmap-resources
 
 <!-- This snippet is used in production (included from viewer.html) -->
 <link rel="resource" type="application/l10n" href="locale/locale.properties">
-<script src="../build/pdf.js"></script>
+<script src="../pdfBuild/pdf.js"></script>
 
 
   <script src="viewer.js"></script>

+ 5 - 5
TEAMModelOS/ClientApp/public/web/viewer.js

@@ -206,7 +206,7 @@ const defaultOptions = {
     kind: OptionKind.WORKER
   },
   workerSrc: {
-    value: "../build/pdf.worker.js",
+    value: "../pdfBuild/pdf.worker.js",
     kind: OptionKind.WORKER
   }
 };
@@ -220,7 +220,7 @@ const defaultOptions = {
     kind: OptionKind.VIEWER
   };
   defaultOptions.sandboxBundleSrc = {
-    value: "../build/pdf.sandbox.js",
+    value: "../pdfBuild/pdf.sandbox.js",
     kind: OptionKind.VIEWER
   };
 }
@@ -3921,10 +3921,10 @@ function apiPageModeToSidebarView(mode) {
 
 let pdfjsLib;
 
-if (typeof window !== "undefined" && window["pdfjs-dist/build/pdf"]) {
-  pdfjsLib = window["pdfjs-dist/build/pdf"];
+if (typeof window !== "undefined" && window["pdfjs-dist/pdfBuild/pdf"]) {
+  pdfjsLib = window["pdfjs-dist/pdfBuild/pdf"];
 } else {
-  pdfjsLib = require("../build/pdf.js");
+  pdfjsLib = require("../pdfBuild/pdf.js");
 }
 
 module.exports = pdfjsLib;

File diff suppressed because it is too large
+ 1 - 1
TEAMModelOS/ClientApp/public/web/viewer.js.map


+ 3 - 2
TEAMModelOS/ClientApp/src/components/syllabus/InviteTeacher.less

@@ -18,11 +18,12 @@
 	}
 	
 	.teacher-wrap{
-		margin-top: 30px;
-		
 		.dark-iview-table .ivu-table td{
 			border-color: #494949;
 			color: #c4c4c4 !important;
 		}
 	}
+
+	
+	
 }

+ 188 - 16
TEAMModelOS/ClientApp/src/components/syllabus/InviteTeacher.vue

@@ -4,8 +4,12 @@
 			<span>当前选择章节:</span>
 			<span class="node-name">{{ nodeInfo.title }}</span>
 		</div>
+		<div class="search-wrap" v-if="isSchool">
+			<Input v-model="searchVal"  placeholder="输入教师名字或ID查询..."
+			icon="ios-close-circle-outline" @on-click="onCloseSearch" @on-change="onSearchChange"/>
+		</div>
 		<div class="teacher-wrap">
-			<Table class="dark-iview-table" :columns="teacherCol" :data="teacherList" height="500">
+			<Table class="dark-iview-table" :columns="teacherCol" :data="teacherList" height="400" v-if="isSchool">
 				<template slot-scope="{ row }" slot="name">
 					<div style="display: flex;align-items: center;">
 						<PersonalPhoto :name="row.name" :picture="row.picture" />
@@ -14,10 +18,24 @@
 				</template>
 				<template slot-scope="{ row }" slot="action">
 					<div style="display: flex;align-items: center;">
-						
+						<i-switch true-color="#13ce66"></i-switch>
 					</div>
 				</template>
 			</Table>
+			<div class="search-id-wrap" v-else>
+				<div class="id-search">
+					<Input v-model="searchIdVal" placeholder="搜索教师..." search @on-search="onIdSearch"/>
+					<p v-html="$t('teachermgmt.addTeacher.content')"></p>
+					<p v-if="curTeacher && curTeacher.id" class="search-result-text">搜索结果</p>
+					<div v-if="curTeacher && curTeacher.id" class="search-result-wrap">
+						<PersonalPhoto :name="curTeacher.name" :picture="curTeacher.picture" />
+						<p class="t-name">{{ curTeacher.name }}</p>
+						<p class="t-id">{{ curTeacher.id }}</p>
+					</div>
+					<p v-if="!curTeacher && hasSearchResult" class="search-none">暂未查询到相关结果</p>
+					<p v-if="hasSearchResult" class="re-search" @click="onReSearch">重新搜索</p>
+				</div>
+			</div>
 		</div>
 	</div>
 </template>
@@ -40,31 +58,54 @@
 		},
 		data() {
 			return {
+				isSchool:false,
+				hasSearchResult:false,
+				searchVal:'',
+				searchIdVal:'',
 				nodeInfo: {
 					title: ''
 				},
+				curTeacher:{
+					name:'',
+					picture:'',
+					id:'',
+					job:''
+				},
 				teacherCol: [{
-						title: '姓名',
+						title: this.$t('teachermgmt.table.th2'),
 						key: 'name',
 						slot: 'name'
 					},
 					{
-						title: '醍摩豆ID',
+						title: this.$t('teachermgmt.table.th1'),
 						key: 'id'
 					},
 					{
-						title: '权限',
-						key: 'size'
+					  title: this.$t('teachermgmt.table.th3'),
+					  key: 'job',
+					  render: (h, params) => {
+					    if (typeof params.row.job === 'undefined' || params.row.job == null || params.row.job === '') {
+					      return h('span', this.$t('teachermgmt.job.teacher'))
+					    } else {
+					      return h('span', params.row.job)
+					    }
+					  }
 					},
 					{
-						title: '操作',
-						slot:'action'
+						title: '是否共编',
+						key:'action',
+						slot: 'action'
 					}
 				],
-				teacherList: []
+				teacherList: [],
+				originList:[]
 			}
 		},
+		created() {
+			this.isSchool = this.$route.name === 'syllabus'
+		},
 		methods: {
+			/* 获取学校所有教师列表 */
 			getAllTeacher() {
 				this.$store.dispatch('user/getSchoolTeacher').then(
 					res => {
@@ -72,22 +113,52 @@
 							this.$Message.error('無法取得使用者資料')
 						} else {
 							this.teacherList = this.$store.state.user.schoolUserList.filter(i => i.status === 'join')
-							console.log(this.teacherList)
+							this.originList = JSON.parse(JSON.stringify(this.teacherList))
 						}
 					},
 					err => {
 						this.$Message.error('user/setSchoolTeacher API error!')
 					}
 				)
+			},
+			/* 搜索词汇发生变化 */
+			onSearchChange(){
+				this.teacherList = this.originList.filter(i => i.name.indexOf(this.searchVal) > -1 || i.id.indexOf(this.searchVal) > -1)
+			},
+			/* 关闭搜索 */
+			onCloseSearch(){
+				this.searchVal = ''
+				this.teacherList = JSON.parse(JSON.stringify(this.originList))
+			},
+			/* 根据ID邮箱手机号搜索教师信息 */
+			onIdSearch(){
+				this.$store.dispatch('user/getUserFromCoreId', [this.searchIdVal]).then(
+				    (res) => {
+				        if (res.code == 1) {
+				            this.curTeacher = res.data.length ? res.data[0] : null
+				        } else {
+				            this.$Message.error('user/getUserFromCoreId API error!')
+				        }
+						this.hasSearchResult = true
+				    },
+				    (err) => {
+				        this.$Message.error('user/getUserFromCoreId API error!')
+				    }
+				)
+			},
+			/* 重新搜索 */
+			onReSearch(){
+				this.searchIdVal = ''
+				this.curTeacher = null
+				this.hasSearchResult = false
 			}
 		},
 		mounted() {
-			this.getAllTeacher()
+			this.isSchool && this.getAllTeacher()
 		},
 		watch: {
 			node: {
 				handler(n, o) {
-					console.log('xxxxxxx', n)
 					if (n) {
 						this.nodeInfo = n
 					}
@@ -100,12 +171,113 @@
 
 <style lang="less" scoped src="./InviteTeacher.less"></style>
 <style lang="less">
-	.teacher-wrap {
-		.dark-iview-table .ivu-table td {
-			border-color: #494949;
-			color: #c4c4c4 !important;
+	.it-container{
+		.teacher-wrap {
+			.dark-iview-table .ivu-table td {
+				border-color: #494949;
+				color: #c4c4c4 !important;
+			}
 		}
 		
+		.search-wrap{
+			.ivu-input-wrapper{
+				width: 300px;
+				line-height: 35px;
+			}
+			.ivu-input{
+				background-color: #474747;
+				border-color: #515151;
+				font-size: 12px;
+				color: #ddd;
+				margin: 20px 0;
+				border-radius: 50px;
+				padding-left: 10px;
+				height: 35px;
+			}
+			
+			.ivu-input-icon{
+				line-height: 75px;
+			}
+		}
 		
+		.search-id-wrap{
+			margin-top: 20px;
+			color: #adadad;
+			.point{
+				color: #F1F1F1;
+				font-weight: bold;
+				font-size: 16px;
+				margin: 0 10px;
+			}
+			
+			.id-search{
+				height: 400px;
+				width: 100%;
+				display: flex;
+				flex-direction: column;
+				align-items: center;
+				
+				.ivu-input-wrapper{
+					width: 500px;
+					line-height: 35px;
+				}
+				.ivu-input{
+					background-color: #474747;
+					border-color: #515151;
+					font-size: 14px;
+					color: #ddd;
+					margin: 20px 0;
+					border-radius: 50px;
+					padding-left: 20px;
+					height: 45px;
+				}
+				
+				.ivu-input-icon{
+					line-height: 86px;
+					margin-right: 10px;
+				}
+			}
+			
+			.search-result-text{
+				margin-top: 60px;
+				margin-bottom: 10px;
+			}
+			
+			.search-result-wrap{
+				background-color: #4e4e4e;
+				padding: 20px;
+				border-radius: 10px;
+				display: flex;
+				flex-direction: column;
+				justify-content: center;
+				align-items: center;
+				.avatar , .fakeAvatar{
+					width: 60px !important;
+					height: 60px !important;
+					border-radius: 50%;
+				}
+				.t-name{
+					color: #fff;
+					font-size: 16px;
+					font-weight: bold;
+					margin: 10px 0;
+				}
+			}
+			
+			.search-none{
+				color: #ff4f80;
+				font-size: 16px;
+				font-weight: bold;
+				margin-top: 80px;
+			}
+			
+			.re-search{
+				margin: 20px 0;
+				text-decoration: underline;
+				color: #FFFCFC;
+				font-size: 14px;
+				cursor: pointer;
+			}
+		}
 	}
 </style>

+ 0 - 47
TEAMModelOS/ClientApp/src/utils/html2pdf.js

@@ -4,14 +4,8 @@ import store from '@/store'
 import domtoimage from './dom_to_image';
 export default {
     install(Vue, options) {
-        Vue.prototype.getPdfByImg = () => {
-
-        }
-
         Vue.prototype.getPdf = () => {
 			return new Promise((r,j) => {
-				
-			
             var title = store.state.answerSheet.paperItem.name
             setTimeout(() => {
                 domtoimage.toJpeg(document.querySelector('#pdfDom'), { bgcolor: '#fff', scale: 4 })
@@ -55,52 +49,11 @@ export default {
                             PDF.save(title + '.pdf')
 							r(200)
                         }
-
                     })
                     .catch(function (error) {
                         console.error('oops, something went wrong!', error);
 						j(error)
                     });
-
-                // html2canvas( document.querySelector('#pdfDom'), {
-                //     allowTaint: true,  //允许 canvas 污染, allowTaint参数要去掉,否则是无法通过toDataURL导出canvas数据的
-                //     useCORS:true  //允许canvas画布内 可以跨域请求外部链接图片, 允许跨域请求。
-                // } ).then( (canvas)=>{
-                //     var contentWidth = canvas.width;
-                //     var contentHeight = canvas.height;
-                //     console.log(contentWidth)
-                //     console.log(contentHeight)
-                //     //一页pdf显示html页面生成的canvas高度;
-                //     var pageHeight = contentWidth / 592.28 * 841.89;
-                //     //未生成pdf的html页面高度
-                //     var leftHeight = contentHeight;
-                //     //页面偏移
-                //     var position = 0;
-                //     //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
-                //     var imgWidth = 595.28;
-                //     var imgHeight = 595.28/contentWidth * contentHeight;
-                //     var pageData = canvas.toDataURL('image/jpeg', 1.0);
-                //     var pdf = new JsPDF('', 'pt', 'a4');
-                //     //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89)
-                //     //当内容未超过pdf一页显示的范围,无需分页
-                //     if (leftHeight < pageHeight) {
-                //         //在pdf.addImage(pageData, 'JPEG', 左,上,宽度,高度)设置在pdf中显示;
-                //         pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight);
-                //         // pdf.addImage(pageData, 'JPEG', 20, 40, imgWidth, imgHeight);
-                //     } else {    // 分页
-                //         while(leftHeight > 0) {
-                //             pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight);
-                //             leftHeight -= pageHeight;
-                //             position -= 841.89;
-                //             //避免添加空白页
-                //             if(leftHeight > 0) {
-                //                 pdf.addPage();
-                //             }
-                //         }
-                //     }
-                //     //可动态生成
-                //     pdf.save(title + '.pdf')
-                // })
             }, 1000)
 			})
 		}

+ 7 - 7
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.vue

@@ -26,9 +26,9 @@
 						<span>册别清单</span>
 						<span class="syllabus-content-header-tools">
 							<Icon type="md-search" @click="doSearchVolume" />
-							<Icon type="md-create" @click="doEditVolume" />
-							<Icon type="md-trash" @click="doDeleteVolume" />
-							<Icon type="md-add" @click="doAddVolume" />
+							<Icon type="md-create" @click="doEditVolume" v-if="$access.can('admin.*|Syllabus_Edit')"/>
+							<Icon type="md-trash" @click="doDeleteVolume" v-if="$access.can('admin.*|Syllabus_Edit')"/>
+							<Icon type="md-add" @click="doAddVolume" v-if="$access.can('admin.*|Syllabus_Edit')"/>
 						</span>
 					</div>
 					<div style="width: 90%;" v-else>
@@ -56,7 +56,7 @@
 				<div class="syllabus-content-header">
 					<span>课纲目录</span>
 					<span class="syllabus-content-header-tools">
-						<Icon type="md-add" @click="isAddTreeModal = true" />
+						<Icon type="md-add" @click="isAddTreeModal = true" v-if="$access.can('admin.*|Syllabus_Edit')"/>
 					</span>
 				</div>
 				<div class="syllabus-tree-box">
@@ -192,10 +192,10 @@
 			<Button slot="footer" @click="onRelateContent" style="margin-bottom: 20px;" class="modal-btn">确认</Button>
 		</Modal>
 		
-		<!-- 关联内容弹窗 -->
-		<Modal v-model="isInviteModal" width="900" class="tree-modal add-volume-modal choose-content-modal">
+		<!-- 选择共编、分享弹窗 -->
+		<Modal v-model="isInviteModal" width="750" class="tree-modal add-volume-modal choose-content-modal">
 			<div class="modal-header" slot="header">
-				选择共编教师
+				选择{{ isSchool ? '共编' : '分享' }}教师
 			</div>
 			<InviteTeacher :node="curShareNode"></InviteTeacher>
 			<Button slot="footer" @click="onRelateContent" style="margin-bottom: 20px;" class="modal-btn">确认</Button>