natasha 1 rok temu
rodzic
commit
29e651faea

BIN
src/common/font/Times New Roman.ttf


+ 5 - 0
src/common/font/font.css

@@ -26,4 +26,9 @@
 @font-face {
     font-family: 'Arial';
     src: url('Arial.ttf');
+}
+
+@font-face {
+    font-family: 'roman';
+    src: url('Times New Roman.ttf')
 }

+ 5 - 0
src/icons/svg/clear.svg

@@ -0,0 +1,5 @@
+<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="&#230;&#184;&#133;&#233;&#153;&#164;">
+<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M5 1.10303C4.79289 1.10303 4.625 1.27092 4.625 1.47803V3.10304H1.25C1.04289 3.10304 0.875 3.27093 0.875 3.47804V5.47804C0.875 5.68514 1.04289 5.85304 1.25 5.85304H1.625V10.0005C1.625 10.2076 1.79289 10.3755 2 10.3755H3.00049H9.00049H10C10.2071 10.3755 10.375 10.2076 10.375 10.0005V5.85304H10.75C10.9571 5.85304 11.125 5.68514 11.125 5.47804V3.47804C11.125 3.27093 10.9571 3.10304 10.75 3.10304H7.375V1.47803C7.375 1.27092 7.20711 1.10303 7 1.10303H5ZM9.00049 9.62549H9.625V5.87549H2.375V9.62549H3.00049H3.62598V8.47852C3.62598 8.27141 3.79387 8.10352 4.00098 8.10352C4.20808 8.10352 4.37598 8.27141 4.37598 8.47852V9.62549H5.62549V8.47412C5.62549 8.26701 5.79338 8.09912 6.00049 8.09912C6.20759 8.09912 6.37549 8.26701 6.37549 8.47412V9.62549H7.625V8.47852C7.625 8.27141 7.79289 8.10352 8 8.10352C8.20711 8.10352 8.375 8.27141 8.375 8.47852V9.62549H9.00049ZM5.375 3.47804V1.85303H6.625V3.47804C6.625 3.68514 6.79289 3.85304 7 3.85304H10.375V5.10304H1.625V3.85304H5C5.20711 3.85304 5.375 3.68514 5.375 3.47804Z" fill="currentColor"/>
+</g>
+</svg>

+ 2 - 1
src/store/watermark.js

@@ -4,7 +4,8 @@ let watermarkTimer = null
 let setWatermark = (str, date) => {
     let id = '1.23452384164.123412416'
 
-    if (document.getElementById(id) !== null) {
+    if (document.getElementById(id) !== null && document.body.contains(document.getElementById(id))) {
+        console.log(document.body.contains(document.getElementById(id)))
         document.body.removeChild(document.getElementById(id))
     }
 

+ 292 - 8
src/views/bookShelf/components/PrintModel.vue

@@ -43,7 +43,92 @@
                 </div>
             </div>
             <div class="print-model-bottom-right">
-                <div>
+                <h3><svg-icon icon-class="print"></svg-icon>打印设置</h3>
+                <div class="config-box">
+                    <div class="item-page">
+                        <label>字体:</label>
+                        <el-select v-model="printForm.fontFamily" placeholder="请选择">
+                            <el-option
+                                v-for="item in fontList"
+                                :key="item.value"
+                                :label="item.name"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                    </div>
+                    <div class="item-page">
+                        <label>字号:</label>
+                        <el-input-number v-model="printForm.fontSize" :step="2"></el-input-number>
+                    </div>
+                    <div class="item-page">
+                        <label>颜色:</label>
+                        <el-color-picker v-model="printForm.color" size="small"></el-color-picker>
+                    </div>
+                    <el-divider class="print-divider"></el-divider>
+                    <div class="item-page">
+                        <label>行距:</label>
+                        <el-select v-model="printForm.lineHeight" placeholder="请选择">
+                            <el-option
+                                v-for="item in lineHeightList"
+                                :key="item.value"
+                                :label="item.name"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                    </div>
+                    <el-divider class="print-divider"></el-divider>
+                    <div class="item-page">
+                        <label>打印范围:</label>
+                        <el-checkbox-group v-model="printForm.range">
+                            <el-checkbox v-for="(itemT,indexT) in rangeList" :key="indexT" :label="itemT.value">{{itemT.name}}</el-checkbox>
+                        </el-checkbox-group>
+                    </div>
+                    <div class="item-page">
+                        <label>加粗显示:</label>
+                        <el-checkbox-group v-model="printForm.bold">
+                            <el-checkbox v-for="(itemT,indexT) in boldList" :key="indexT" :label="itemT.value">{{itemT.name}}</el-checkbox>
+                        </el-checkbox-group>
+                    </div>
+                    <el-divider class="print-divider"></el-divider>
+                    <div class="item-page">
+                        <label>附加信息:</label>
+                        <b @click="handleClear"><svg-icon icon-class="clear"></svg-icon>清除</b>
+                    </div>
+                    <div class="item-page">
+                        <label>姓名:</label>
+                        <el-input v-model="printForm.name" autocomplete="off" placeholder="请输入" maxlength="20">
+                        </el-input>
+                    </div>
+                    <div class="item-page">
+                        <label>学校:</label>
+                        <el-input v-model="printForm.school" autocomplete="off" placeholder="请输入" maxlength="20">
+                        </el-input>
+                    </div>
+                    <div class="item-page">
+                        <label>班级:</label>
+                        <el-input v-model="printForm.className" autocomplete="off" placeholder="请输入" maxlength="20">
+                        </el-input>
+                    </div>
+                    <div class="item-page">
+                        <label>日期:</label>
+                        <el-input v-model="printForm.dateStr" autocomplete="off" placeholder="请输入" maxlength="20">
+                        </el-input>
+                    </div>
+                    <div class="item-page">
+                        <label>备注:</label>
+                        <el-input v-model="printForm.momo" autocomplete="off" placeholder="请输入" maxlength="20">
+                        </el-input>
+                    </div>
+                    <el-divider class="print-divider"></el-divider>
+                    <div class="item-page">
+                        <label>统计信息:</label>
+                        <el-checkbox-group v-model="printForm.info">
+                            <el-checkbox v-for="(itemT,indexT) in infoList" :key="indexT" :label="itemT.value">{{itemT.name}}</el-checkbox>
+                        </el-checkbox-group>
+                    </div>
+                    <el-divider class="print-divider"></el-divider>
+                </div>
+                <div class="item-page" style="padding:24px 24px 0 24px">
                     <el-button @click="goBack" size="small">取消</el-button>
                     <el-button type="primary" @click="handlePrint" size="small">打印</el-button>
                 </div>
@@ -62,7 +147,95 @@ export default {
             userMessage: getToken()?JSON.parse(getToken()):null,
             resArr: [],
             articleImg: {}, // 文章图片
-            sentenceList: []
+            sentenceList: [],
+            fontList: [
+                {
+                    value:'roman',
+                    name:'Times New Roman'
+                },
+                {
+                    value: 'Arial',
+                    name: 'Arial'
+                }
+            ],
+            lineHeightList: [
+                {
+                    value:'0.8',
+                    name:'0.8倍'
+                },
+                {
+                    value:'1.0',
+                    name:'1.0倍'
+                },
+                {
+                    value:'1.5',
+                    name:'1.5倍'
+                },
+                {
+                    value:'2.0',
+                    name:'2.0倍'
+                },
+            ],
+            rangeList: [
+                {
+                    value:'image',
+                    name:'图片'
+                },
+                {
+                    value:'vocab',
+                    name:'词表'
+                },
+                {
+                    value:'ciyun',
+                    name:'词云'
+                },
+                {
+                    value:'notes',
+                    name:'笔记'
+                }
+            ],
+            boldList:[
+                {
+                    value:'newWord',
+                    name:'生词'
+                },
+                {
+                    value:'phrase',
+                    name:'短语'
+                },
+                {
+                    value:'sentence',
+                    name:'长句'
+                }
+            ],
+            infoList:[
+                {
+                    value:'wordLength',
+                    name:'长度'
+                },
+                {
+                    value:'wordNumber',
+                    name:'词数'
+                },
+                {
+                    value:'difficulty',
+                    name:'难度'
+                }
+            ],
+            printForm:{
+                fontFamily:'roman',
+                fontSize: 24,
+                color: '#2F3742',
+                lineHeight: '1.5',
+                range: [],
+                bold: ['newWord','phrase'],
+                info: [],
+                name: '',
+                school: '',
+                className: '',
+                dateStr: '',
+                momo: ''
+            }
         }
     },
     methods: {
@@ -112,6 +285,14 @@ export default {
                 },
                 });
             });
+        },
+        // 清除
+        handleClear(){
+            this.printForm.name = ''
+            this.printForm.school = ''
+            this.printForm.className = ''
+            this.printForm.dateStr = ''
+            this.printForm.momo = ''
         }
     },
     mounted(){
@@ -119,6 +300,9 @@ export default {
             this.handleData();
         }
         waterMark.set(this.userMessage.user_name+' '+this.userMessage.phone,'')
+        this.$nextTick(() => {
+            document.onselectstart = new Function("event.returnValue=false");
+        })
     }
 };
 </script>
@@ -166,7 +350,7 @@ export default {
         justify-content: center;
         padding-top: 46px;
         &-left{
-            width: 1090px;
+            width: 1070px;
             margin: 8px 346px 8px 8px;
             background: #fff;
             flex-shrink: 0;
@@ -196,18 +380,86 @@ export default {
             }
         }
         &-right{
-            width: 338px;
-            padding: 24px;
+            width: 360px;
+            padding: 24px 0;
             background: #FFF;
             position: fixed;
             z-index: 1;
             top: 46px;
-            right: calc((100% - 1440px)/2);
-            height: 100%;
-            overflow: auto;
+            right: calc((100% - 1450px)/2);
+            height: calc(100% - 48px);
+            .config-box{
+                height: calc(100% - 80px);
+                overflow: auto;
+                padding: 0 24px;
+            }
+            h3{
+                color: #2F3742;
+                font-size: 24px;
+                font-weight: 400;
+                line-height: 32px;
+                margin: 0;
+                padding: 0 24px;
+                .svg-icon{
+                    width: 24px;
+                    height: 24px;
+                    margin-right: 8px;
+                }
+            }
+        }
+    }
+}
+.item-page {
+    display: flex;
+    padding-top: 24px;
+    >label {
+        color: #2F3742;
+        text-align: right;
+        font-size: 14px;
+        font-weight: 500;
+        line-height: 30px;
+        width: 72px;
+        margin-right: 16px;
+        flex-shrink: 0;
+    }
+    .el-select{
+        height: 32px;
+        border-radius: 2px;
+        width: 202px;
+    }
+    .el-button{
+        width: 140px;
+        padding: 8px 32px;
+        color:rgba(0, 0, 0, 0.91);
+        font-size: 14px;
+        font-weight: 400;
+        line-height: 22px;
+        border-radius: 4px;
+        background: #EBEBEB;
+        border: none;
+    }
+    .el-button--primary{
+        background:#3459D2;
+        color: #fff;
+    }
+    >b{
+        flex: 1;
+        text-align: right;
+        cursor: pointer;
+        line-height: 30px;
+        color: #175DFF;
+        font-size: 14px;
+        font-weight: 400;
+        .svg-icon{
+            width: 12px;
+            margin-right: 4px;
         }
     }
 }
+.print-divider{
+    margin: 24px 0 0 0;
+    background-color: #F2F3F5;
+}
 #showWaterMark{
     overflow: hidden;
     position: relative;
@@ -247,4 +499,36 @@ export default {
         margin: 30px 30px 40px 30px;
     }
 }
+</style>
+<style lang="scss">
+.item-page {
+    .el-input__inner{
+        height: 32px;
+        line-height: 32px;
+        background: #F2F3F5;
+        border: none;
+    }
+    .el-input__icon{
+        line-height: 32px;
+    }
+    .el-input-number{
+        line-height: 30px;
+        width: 202px;
+    }
+    .el-input-number__decrease, .el-input-number__increase{
+        height: 30px;
+        width: 30px;
+    }
+    .el-checkbox{
+        margin-right: 12px;
+        line-height: 30px;
+    }
+    .el-checkbox__input.is-checked+.el-checkbox__label{
+        color: #2F3742;
+    }
+    .el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner{
+        background-color: #3459D2;
+        border-color: #3459D2;
+    }
+}
 </style>