GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
hanfei
/
VueSharedPrinting
Browse code
合并代码
master
commit
c10491ab485cdb7801bafa4e3f52f8122820fe67
2 parents
1008114
+
0675017
hanfei
authored
on 4 Jan 2024
Patch
Showing
8 changed files
.gitignore
.prettierrc
package.json
src/api/resultApi.js
src/utils/request.js
src/views/argument.vue
src/views/explain.vue
src/views/selectFile.vue
Ignore Space
Show notes
View
.gitignore
.DS_Store node_modules /dist .gitignore # local env files .env.local .env.*.local # Log files npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* # Editor directories and files .idea .vscode *.suo *.ntvs* *.njsproj *.sln *.sw?
.DS_Store node_modules /dist # local env files .env.local .env.*.local # Log files npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* # Editor directories and files .idea .vscode *.suo *.ntvs* *.njsproj *.sln *.sw?
Ignore Space
Show notes
View
.prettierrc
0 → 100644
{ "printWidth": 200, "eslintIntegration": true, "stylelintIntegration": true, "tabWidth": 2, "semi": false, "singleQuote": true, "bracketSpacing": true, "arrowParens": "avoid", "htmlWhitespaceSensitivity": "ignore", "javascript.format.insertSpaceBeforeFunctionParenthesis": true, "files.insertFinalNewline": true, "useTabs": false, "endOfLine": "auto", "ignorePath": ".gnore", "trailingComma": "none" }
Ignore Space
Show notes
View
package.json
{ "name": "tzshare", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "axios": "^1.6.3", "core-js": "^3.6.5", "html2canvas": "^1.4.1", "postcss-px2rem": "^0.3.0", "px2rem-loader": "^0.1.9", "vue": "^2.6.11", "vue-router": "^3.2.0" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.15", "@vue/cli-plugin-eslint": "~4.5.15", "@vue/cli-plugin-router": "~4.5.15", "@vue/cli-service": "~4.5.15", "babel-eslint": "^10.1.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", "less": "^4.2.0", "less-loader": "^7.3.0", "vue-template-compiler": "^2.6.11" }, "eslintConfig": { "root": true, "env": { "node": true }, "extends": [ "plugin:vue/essential", "eslint:recommended" ], "parserOptions": { "parser": "babel-eslint" }, "rules": {} }, "browserslist": [ "> 1%", "last 2 versions", "not dead" ] }
{ "name": "tzshare", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "axios": "^1.6.2", "core-js": "^3.6.5", "html2canvas": "^1.4.1", "postcss-px2rem": "^0.3.0", "px2rem-loader": "^0.1.9", "vue": "^2.6.11", "vue-router": "^3.2.0" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.15", "@vue/cli-plugin-eslint": "~4.5.15", "@vue/cli-plugin-router": "~4.5.15", "@vue/cli-service": "~4.5.15", "babel-eslint": "^10.1.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", "less": "^4.2.0", "less-loader": "^7.3.0", "vue-template-compiler": "^2.6.11" }, "eslintConfig": { "root": true, "env": { "node": true }, "extends": [ "plugin:vue/essential", "eslint:recommended" ], "parserOptions": { "parser": "babel-eslint" }, "rules": {} }, "browserslist": [ "> 1%", "last 2 versions", "not dead" ] }
Ignore Space
Show notes
View
src/api/resultApi.js
import request from '../utils/request' // 打印价格 export const getPrintPrice = params => { return request({ url: '/device/getPrintPriceList', params }) } // 获取设备ID export const getDeviceByCode = params => { return request({ url: '/device/getDeviceByCode', params }) } // 文件上传 export const upload2Pdf = data => { return request({ method: 'POST', url: '/file/upload2Pdf', data }) }
import request from "../utils/request"; // 打印价格 export const getPrintPrice = (params) => { return request({ url: "/device/getPrintPriceList", params, }); }; export const getDeviceByCode = (params) => { return request({ url: "/device/getDeviceByCode", params, }); };
Ignore Space
Show notes
View
src/utils/request.js
import axios from 'axios' const request = axios.create({ baseURL: window.location.origin + '/api', timeout: 15000 // request timeout }) request.interceptors.request.use(config => { // const token = getToken() // config.headers["Authorization"] = "Bearer " + token console.log(config.url) // if (config.url === '/file/upload2Pdf') { // config.headers['enctype'] = 'multipart/form-data' // } console.log(config) return config }) request.interceptors.response.use(res => { return res.data }) export default request
import axios from "axios"; const request = axios.create({ baseURL: window.location.origin + "/api", timeout: 15000, // request timeout }); request.interceptors.request.use((config) => { // const token = getToken() // config.headers["Authorization"] = "Bearer " + token return config; }); request.interceptors.response.use((res) => { return res.data; }); export default request;
Ignore Space
Show notes
View
src/views/argument.vue
<template> <!-- 参数设定--> <div class="transcoding"> <navbar :name="name" /> <div class="box flex-center"> <div class="left"> <div class="title">温馨提示</div> <div class="content">请根据您具体的需要选择打印需要的颜色、单双面、列印方向、份数,以及打印范围(如果需要打印全部页码,可忽略不用修改)/缩印格式等。</div> <div class="content">打印参数确认好之后,即可点击/轻按“下一步”按钮完成打印任务的提交</div> </div> <div class="right"> <!-- <div class="flex-between name">{{ pageData.name }}</div> --> <div class="flex-between"> <div>纸张规格</div> <div>{{ pageData.specification }}</div> </div> <div class="flex-between"> <div>颜色</div> <div class="only flex-center"> <div class="flex-center" :class="pageData.colour == 0 ? 'act' : ''" @click="onChange('colour', 0)">黑白</div> <div class="flex-center" :class="pageData.colour == 1 ? 'act' : ''" @click="onChange('colour', 1)">彩色</div> </div> </div> <div class="flex-between"> <div>单双面</div> <div class="only flex-center"> <div class="flex-center" :class="pageData.singledihedral == 0 ? 'act' : ''" @click="onChange('singledihedral', 0)">单面</div> <div class="flex-center" :class="pageData.singledihedral == 1 ? 'act' : ''" @click="onChange('singledihedral', 1)">双面</div> </div> </div> <!-- <div class="flex-between"> <div>方向</div> <div class="only flex-center"> <div class="flex-center" :class="pageData.direction == 0 ? 'act' : ''" @click="onChange('direction', 0)">横向</div> <div class="flex-center" :class="pageData.direction == 1 ? 'act' : ''" @click="onChange('direction', 1)">纵向</div> </div> </div> --> <div class="flex-between"> <div>份数</div> <div class="import flex-center"> <img src="../assets/demo14.png" alt="" @click="variable(pageData.copies < 1 ? 0 : pageData.copies - 1)" /> <input :value="pageData.copies" type="number" min="1" /> <img src="../assets/demo15.png" alt="" @click="variable(pageData.copies + 1)" /> </div> </div> <!-- <div class="flex-between">--> <!-- <div>打印范围(共13页)</div>--> <!-- <div class="flex-center print">--> <!-- <input :value="pageData.minPrint" type="number" min="1">--> <!-- <div>至</div>--> <!-- <input :value="pageData.maxPrint" type="number" min="1">--> <!-- </div>--> <!-- </div>--> <!-- <div class="flex-between">--> <!-- <div>缩印(多合一)</div>--> <!-- <div class="optionBox">--> <!-- <select>--> <!-- <option value="1">1页/张</option>--> <!-- <option value="2">2页/张</option>--> <!-- <option value="3">3页/张</option>--> <!-- </select>--> <!-- </div>--> <!-- </div>--> <div class="btn flex-center" @click="skip('pay', name)">下一步</div> </div> </div> </div> </template> <script> import navbar from '@/components/nav' export default { name: 'argument', components: { navbar }, provide() { return { title: '', type: this.name } }, data() { return { name: this.$route.params.name, pageData: { name: '文件名称……文件名称.doc', //文件名称 specification: 'A4', //纸张规格 colour: 0, //颜色 singledihedral: 0, //单双面 direction: 0, //方向 copies: 1, //份数 maxPrint: 13, //打印范围最大 minPrint: 1, //打印范围最小 minimo: 0 //缩印 } } }, methods: { skip(href, name) { this.$router.push({ name: href, params: { name: name } }) }, onChange(name, val) { this.pageData[name] = val }, variable(num) { this.pageData.copies = num } } } </script> <style scoped lang="less"> .box { height: 42.13rem; .css1 { height: 100%; background: #ffffff; box-shadow: 0rem 0.31rem 0.63rem 0.06rem rgba(0, 0, 0, 0.14); border-radius: 1.63rem; } .left { width: 46.44rem; margin-right: 1.88rem; .css1(); .title { font-size: 2.88rem; font-weight: bold; color: #d41212; line-height: 4.06rem; padding: 4.13rem 0 2.44rem; } .content { width: 37rem; font-size: 2.25rem; font-weight: bold; color: #323232; line-height: 3rem; margin: 0 auto; text-align: left; text-indent: 2em; } } .right { display: flex; flex-direction: column; justify-content: center; width: 53.19rem; .css1(); padding: 0 4.81rem; font-size: 1.88rem; font-weight: 400; color: #323232; line-height: 3.75rem; .name { margin-top: 3.19rem; } .only { width: 17.25rem; height: 3.19rem; background: #ffffff; border-radius: 0.63rem; border: 0.06rem solid #707070; overflow: hidden; div { width: 50%; font-size: 1.88rem; font-weight: 400; color: #323232; line-height: 2.63rem; height: 100%; cursor: pointer; } .act { background: #61aa8f; color: #ffffff; } } .import { img { width: 2.75rem; height: 2.75rem; cursor: pointer; } } input { width: 6.38rem; height: 3.19rem; background: #ffffff; border-radius: 0.63rem; border: 0.06rem solid #707070; font-size: 1.88rem; font-weight: 400; color: #323232; text-align: center; margin: 0 0.94rem; } .optionBox { select { width: 13.69rem; height: 3.19rem; padding-right: 3.56rem; border-radius: 0.63rem; border: 0.06rem solid #707070; font-size: 1.88rem; font-weight: 400; color: #323232; text-align: center; appearance: none; -moz-appearance: none; -webkit-appearance: none; background: url('../assets/demo16.png') no-repeat scroll right center transparent; background-position-x: 11rem; } select::-ms-expand { display: none; } } .btn { width: 100%; height: 5.5rem; background: linear-gradient(132deg, #52a39d 0%, #a1c553 50%, #81d012 100%); border-radius: 1.25rem; font-size: 1.88rem; font-weight: 400; color: #ffffff; line-height: 2.63rem; margin-top: 2.25rem; cursor: pointer; } } } input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none !important; margin: 0; } </style>
<template> <!-- 参数设定--> <div class="transcoding"> <navbar :name="name"/> <div class="box flex-center"> <div class="left"> <div class="title">温馨提示</div> <div class="content">请根据您具体的需要选择打印需要的颜色、单双面、列印方向、份数,以及打印范围(如果需要打印全部页码,可忽略不用修改)/缩印格式等。</div> <div class="content">打印参数确认好之后,即可点击/轻按“下一步”按钮完成打印任务的提交</div> </div> <div class="right"> <div class="flex-between name">{{ pageData.name }}</div> <div class="flex-between"> <div>纸张规格</div><div>{{ pageData.specification }}</div> </div> <div class="flex-between"> <div>颜色</div> <div class="only flex-center"> <div class="flex-center" :class="pageData.colour==0?'act':''" @click="onChange('colour',0)">黑白</div> <div class="flex-center" :class="pageData.colour==1?'act':''" @click="onChange('colour',1)">彩色</div> </div> </div> <div class="flex-between"> <div>单双面</div> <div class="only flex-center"> <div class="flex-center" :class="pageData.singledihedral==0?'act':''" @click="onChange('singledihedral',0)">单面</div> <div class="flex-center" :class="pageData.singledihedral==1?'act':''" @click="onChange('singledihedral',1)">双面</div> </div> </div> <div class="flex-between"> <div>方向</div> <div class="only flex-center"> <div class="flex-center" :class="pageData.direction==0?'act':''" @click="onChange('direction',0)">横向</div> <div class="flex-center" :class="pageData.direction==1?'act':''" @click="onChange('direction',1)">纵向</div> </div> </div> <div class="flex-between"> <div>份数</div> <div class="import flex-center"> <img src="../assets/demo14.png" alt="" @click="variable(pageData.copies<1?0:pageData.copies-1)"> <input :value="pageData.copies" type="number" min="1"> <img src="../assets/demo15.png" alt="" @click="variable(pageData.copies+1)"> </div> </div> <!-- <div class="flex-between">--> <!-- <div>打印范围(共13页)</div>--> <!-- <div class="flex-center print">--> <!-- <input :value="pageData.minPrint" type="number" min="1">--> <!-- <div>至</div>--> <!-- <input :value="pageData.maxPrint" type="number" min="1">--> <!-- </div>--> <!-- </div>--> <!-- <div class="flex-between">--> <!-- <div>缩印(多合一)</div>--> <!-- <div class="optionBox">--> <!-- <select>--> <!-- <option value="1">1页/张</option>--> <!-- <option value="2">2页/张</option>--> <!-- <option value="3">3页/张</option>--> <!-- </select>--> <!-- </div>--> <!-- </div>--> <div class="btn flex-center" @click="skip('pay',name)">下一步</div> </div> </div> </div> </template> <script> import navbar from '@/components/nav' export default { name: "argument", components: { navbar }, provide() { return { title: '', type: this.name } }, data() { return { name: this.$route.params.name, pageData: { name: '文件名称……文件名称.doc',//文件名称 specification: 'A4',//纸张规格 colour: 0,//颜色 singledihedral: 0,//单双面 direction: 0,//方向 copies: 1,//份数 maxPrint: 13,//打印范围最大 minPrint: 1,//打印范围最小 minimo: 0,//缩印 } } }, methods: { skip(href,name) { this.$router.push({ name: href, params: { name: name } }) }, onChange(name,val) { this.pageData[name] = val }, variable(num) { this.pageData.copies = num }, }, } </script> <style scoped lang="less"> .box { height: 42.13rem; .css1 { height: 100%; background: #FFFFFF; box-shadow: 0rem 0.31rem 0.63rem 0.06rem rgba(0,0,0,0.14); border-radius: 1.63rem; } .left { width: 46.44rem; margin-right: 1.88rem; .css1(); .title { font-size: 2.88rem; font-weight: bold; color: #D41212; line-height: 4.06rem; padding: 4.13rem 0 2.44rem; } .content { width: 37rem; font-size: 2.25rem; font-weight: bold; color: #323232; line-height: 3rem; margin: 0 auto; text-align: left; text-indent: 2em; } } .right { width: 53.19rem; .css1(); padding: 0 4.81rem; font-size: 1.88rem; font-weight: 400; color: #323232; line-height: 3.75rem; .name { margin-top: 3.19rem; } .only { width: 17.25rem; height: 3.19rem; background: #FFFFFF; border-radius: 0.63rem; border: 0.06rem solid #707070; overflow: hidden; div { width: 50%; font-size: 1.88rem; font-weight: 400; color: #323232; line-height: 2.63rem; height: 100%; cursor: pointer; } .act { background: #61AA8F; color: #FFFFFF; } } .import { img { width: 2.75rem; height: 2.75rem; cursor: pointer; } } input { width: 6.38rem; height: 3.19rem; background: #FFFFFF; border-radius: 0.63rem; border: 0.06rem solid #707070; font-size: 1.88rem; font-weight: 400; color: #323232; text-align: center; margin: 0 .94rem; } .optionBox { select { width: 13.69rem; height: 3.19rem; padding-right: 3.56rem; border-radius: 0.63rem; border: 0.06rem solid #707070; font-size: 1.88rem; font-weight: 400; color: #323232; text-align: center; appearance:none; -moz-appearance:none; -webkit-appearance:none; background:url("../assets/demo16.png") no-repeat scroll right center transparent; background-position-x: 11rem; } select::-ms-expand{display: none;} } .btn { width: 100%; height: 5.5rem; background: linear-gradient(132deg, #52A39D 0%, #A1C553 50%, #81D012 100%); border-radius: 1.25rem; font-size: 1.88rem; font-weight: 400; color: #FFFFFF; line-height: 2.63rem; margin-top: 2.25rem; cursor: pointer; } } } input::-webkit-outer-spin-button, input::-webkit-inner-spin-button{ -webkit-appearance: none !important; margin: 0; } </style>
Ignore Space
Show notes
View
src/views/explain.vue
<template> <!--说明--> <div class="explain"> <navbar :name="name" /> <div class="box"> <div v-if="name == '使用教程'"> <div class="content"> 使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程 </div> </div> <div v-if="name == '打印价格'" class="flex-center"> <!-- <div class="content">A4纸[文件打印、扫描打印、身份证打印] :单面+黑白: 0.5元/张单面+彩色: 1.0元/张双面+黑白: 0.8元/张双面+彩色: 1.8元/张</div> <div class="content">6寸相纸/热升华相纸 [照片、 证件照打印]:证件照: XXX 元/ 张(版)照 片: XXX元/张</div> --> <!-- 整个表格内容 --> <table border="1" width="500" height="100%" align="center" cellpadding="10" cellspacing="0"> <!-- 表格中一行的内容 --> <tr class="bg-header"> <!-- 表格中单个单元格内容 --> <!-- <td>打印类型&格式</td> <td>单价</td> --> </tr> <tr :class="index === 0 ? 'bg-header' : ''" v-for="(item, index) in tableData" :key="index"> <td>{{ item.name }}</td> <td>{{ item.amount }}/元</td> </tr> </table> </div> <div v-if="name == '联系客服'"> <div class="content">尊敬的会员朋友,您在使用自助打印软件过程中遇到任何问题或困难,欢迎随时拨打国内客服电话 400 -12345678,我们将为您提供耐心解答和及时帮助,谢谢。</div> </div> </div> </div> </template> <script> import navbar from '@/components/nav' import { getPrintPrice } from '../api/resultApi' export default { name: 'explain', components: { navbar }, provide() { return { title: this.name, type: '' } }, data() { return { name: this.$route.params.name, tableData: [] } }, methods: { getPrintPrice() { getPrintPrice({ deviceId: this.cite.sbInfo.id }).then(res => { this.tableData = [{ name: '打印类型&格式', amount: '单价' }, ...res.data] }) } }, created() { this.getPrintPrice() }, mounted() {} } </script> <style scoped lang="less"> .explain { .box { width: 114.06rem; height: 32rem; padding: 6rem 0; background: #ffffff; box-shadow: 0rem 0.31rem 0.63rem 0.06rem rgba(0, 0, 0, 0.14); border-radius: 1.63rem; margin: 0 auto; > div { height: 100%; overflow-y: auto; } .content { width: 93.81rem; font-size: 2.25rem; font-weight: bold; color: #323232; line-height: 3.1rem; margin: 0 auto; text-align: left; } .bg-header { font-weight: bold; font-size: 1.3rem; background-color: #edeff6; } } } </style>
<template> <!--说明--> <div class="explain"> <navbar :name="name" /> <div class="box"> <div v-if="name == '使用教程'"> <div class="content"> 使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程 </div> </div> <div v-if="name == '打印价格'" class="flex-center"> <!-- <div class="content">A4纸[文件打印、扫描打印、身份证打印] :单面+黑白: 0.5元/张单面+彩色: 1.0元/张双面+黑白: 0.8元/张双面+彩色: 1.8元/张</div> <div class="content">6寸相纸/热升华相纸 [照片、 证件照打印]:证件照: XXX 元/ 张(版)照 片: XXX元/张</div> --> <!-- 整个表格内容 --> <table border="1" width="500" height="100%" align="center" cellpadding="10" cellspacing="0" > <!-- 表格中一行的内容 --> <tr class="bg-header"> <!-- 表格中单个单元格内容 --> <td>打印类型&格式</td> <td>单价</td> </tr> <tr v-for="(item, index) in tableData" :key="index"> <td>{{ item.name }}</td> <td>{{ item.amount }}/元</td> </tr> </table> </div> <div v-if="name == '联系客服'"> <div class="content"> 尊敬的会员朋友,您在使用自助打印软件过程中遇到任何问题或困难,欢迎随时拨打国内客服电话 400 -12345678,我们将为您提供耐心解答和及时帮助,谢谢。 </div> </div> </div> </div> </template> <script> import navbar from "@/components/nav"; import { getPrintPrice } from "../api/resultApi"; export default { name: "explain", components: { navbar, }, provide() { return { title: this.name, type: "", }; }, data() { return { name: this.$route.params.name, tableData: [], }; }, methods: { getPrintPrice() { getPrintPrice({ deviceId: this.cite.sbInfo.id }).then((res) => { this.tableData = res.data; }); }, }, created() { this.getPrintPrice(); }, mounted() {}, }; </script> <style scoped lang="less"> .explain { .box { width: 114.06rem; height: 32rem; padding: 6rem 0; background: #ffffff; box-shadow: 0rem 0.31rem 0.63rem 0.06rem rgba(0, 0, 0, 0.14); border-radius: 1.63rem; margin: 0 auto; > div { height: 100%; overflow-y: auto; } .content { width: 93.81rem; font-size: 2.25rem; font-weight: bold; color: #323232; line-height: 3.1rem; margin: 0 auto; text-align: left; } .bg-header { font-weight: bold; font-size: 1.3rem; background-color: #edeff6; } } } </style>
Ignore Space
Show notes
View
src/views/selectFile.vue
<template> <!-- 选取资料--> <div class="selectFile"> <navbar :name="name" /> <!-- U盘打印--> <div class="box flex-center" v-show="name == 'U盘打印'"> <div class="tip"> <div class="title">温馨提示</div> <div class="content">请在右侧文件浏览区,找到文件存放的目录/文件夹,然后点选您要打印的文件,之后按下“确认资料”按钮。</div> </div> <div class="file tip2"> <div class="main"> <div v-for="(item, index) in UpFile" v-bind:key="index" class="flex-between li"> <div class="name">{{ item.name }}</div> <span @click="onCancel(index, 'UpFile')">删除</span> </div> </div> <div class="flex-between but"> <div class="btn flex-center" @click="paiz()"> 选择文件 <input type="file" @change="handleFileChange" /> </div> <div class="btn flex-center" @click="skip('transcoding', name)">确认资料</div> </div> </div> </div> <!-- 扫描打印--> <div class="box flex-center" v-show="name == '扫描打印'"> <div class="file2"> <div class="title">已完成扫描的版面</div> <div class="main flex-between"> <div class="smfyData"> <div v-for="(item, index) in imgList" v-bind:key="index" :class="['flex-center', { act: smfyIndex == index }]" @click="onChange(index, 'smfyIndex')"> <div class="name">{{ index + 1 }}</div> <span @click="onCancel(index, 'imgList')">删除</span> </div> </div> <img :src="imgList[smfyIndex]" alt="" style="width: 25rem; height: 100%" /> </div> </div> <div class="tip tip2"> <div class="title">温馨提示</div> <div class="content"> 宜家扫描号的页面显示在左边的列表中,您可以点击列表中的缩略图进行核对,有不满意的请点旁边的“X”进行移除并重新扫描。如果有件需要继续扫描,请按要求放置好资料后,按“继续扫描”。 按照刚才的方法,重复扫描过程,直到完成了所有需要的页面。核对无误后,可以按“完成扫描”结束资料扫描过程。 </div> <div class="flex-between but"> <div class="btn flex-center" @click="paiz()">继续扫描</div> <div class="btn flex-center" @click="skip('transcoding', name)">完成扫描</div> </div> </div> </div> <!-- 身份证打印--> <div class="box flex-center" v-show="name == '身份证打印'"> <div class="file2 file3" style="margin-right: 20rem"> <div class="title">请核对您的信息</div> <div class="card" ref="captureArea"> <div class="card-box"> <img src="../assets/card2.png" alt="身份证反面" /> <div class="card-name">{{ cardInfo.name }}</div> <div class="card-gender"> {{ cardInfo.gender==1?'男':'女' }}<span>{{ cardInfo.nation }}</span> </div> <div class="card-birth"> {{ cardInfo.birthday | joinYear }} <span class="month">{{ cardInfo.birthday | joinMonth }}</span> <span class="day">{{ cardInfo.birthday | joinDay }}</span> </div> <div class="card-addr"> {{ cardInfo.address }} </div> <div class="card-id">{{ cardInfo.idNum }}</div> <div class="card-avatar"> <img :src="'data:image/png;base64,'+cardInfo.photo" alt="" /> </div> </div> <div class="card-box"> <img src="../assets/card1.png" alt="身份证正面" /> <div class="card-sign">{{ cardInfo.issueOrg }}</div> <div class="card-date"> {{ cardInfo.effectDate }} - {{ cardInfo.expireDate }} </div> </div> </div> </div> <div class="tip"> <div class="title">温馨提示</div> <div class="content">身份证件信息读取成功,请您核对个人信息无误后,按“信息无误,继续”按钮进行后续操作。此时您可以收回您的身份证卡片并妥善报讯。</div> <div class="btn flex-center" @click="skip('transcoding', name)">信息无误,继续</div> </div> </div> </div> </template> <script> import navbar from "@/components/nav"; import html2canvas from "html2canvas"; import axios from "axios"; import { upload2Pdf } from '@/api/resultApi' export default { name: 'selectFile', components: { navbar }, provide() { return { title: this.tit, type: this.name } }, filters: { joinYear(val) { return val.substring(0, 4) }, joinMonth(val) { return val.substring(4, 6) }, joinDay(val) { return val.substring(6, 8) } }, data() { return { tit: this.$route.params.name == 'U盘打印' ? '资料选取提交' : '资料扫描提交', name: this.$route.params.name, path: this.cite.inWebURL, socket: '', imgList: [], smfyIndex: 0, UpFile: [], cardInfo: {}, }; }, methods: { skip(href, name) { let formData = new FormData() for (let i = 0; i < this.UpFile.length; i++) { formData.append('file', this.UpFile[i]) // 使用数组语法添加多个文件 } upload2Pdf(formData).then(res => { console.log(res) }) this.captureAndDownload() this.$router.push({ name: href, params: { name: name } }) }, async captureAndDownload() { const captureArea = this.$refs.captureArea // 使用 html2canvas 将区域内容生成为图片 const canvas = await html2canvas(captureArea) // 将 canvas 转为图片 URL const imageUrl = canvas.toDataURL('image/png') console.log(imageUrl) // 调用接口上传图片 // 创建一个下载链接 // const downloadLink = document.createElement("a"); // downloadLink.href = imageUrl; // downloadLink.download = "captured_image.png"; // 模拟点击下载链接 // downloadLink.click(); }, onChange(index, name) { this[name] = index }, onCancel(index, name) { this[name].splice(index, 1) }, paiz() { this.socket.send('Capture@2') }, init: function () { if (typeof WebSocket === 'undefined') { alert('您的浏览器不支持socket') } else { // 实例化socket this.socket = new WebSocket(this.path) // 监听socket连接 this.socket.onopen = this.open // 监听socket错误信息 this.socket.onerror = this.error // 监听socket消息 this.socket.onmessage = this.getMessage } }, open: function () { // console.log("socket连接成功") this.socket.send('OpenIdCardEx@0') this.socket.send('OpenDevice@1') this.socket.send('SetResolution@2@2592@1944') this.socket.send('OpenVideo') this.socket.send('RotateRight') this.socket.send('Deskew') }, error: function () { console.log('连接错误') }, getMessage: function (msg) { if (typeof msg.data == 'string') { if (msg.data.indexOf('GetDevCount') == 0) { let s = msg.data.substring(12) if ('1' == s || '2' == s) { //如果是双摄像头 那就需要判断 s = 2;表示当前是连接了2个设备 alert('检测到已经连接上摄像头') } } else if (msg.data.indexOf('Capture') == 0) { let s = msg.data.substring(8) if (s) { this.imgList.push('data:image/jpeg;base64,' + s) } } else if (msg.data.indexOf('MoveDetectEvent') == 0) { this.socket.send('Capture@2') } else if (msg.data.indexOf('IdCardEvent') == 0) { this.socket.send('UnFaceDetect') } else if (msg.data.indexOf('ReadIdCard') == 0) { let s = msg.data.substring(11) if ('1' == s) { this.socket.send('GetIdCardResult@||') this.socket.send('GetIdCardImage@2') } } else if (msg.data.indexOf('GetIdCardResult') == 0) { let s = msg.data.substring(16) let info = document.getElementById('info') info.value = s } else if (msg.data.indexOf('GetBarcode') == 0) { // alert(msg.data); let s = msg.data.substring(11) let info = document.getElementById('info') info.value = s } else if (msg.data.indexOf('GetIdCardImage') == 0) { let s = msg.data.substring(15) let arr = s.split('#') let faceImg = arr[0] let myimg = document.getElementById('myCanvas3') myimg.src = 'data:image/jpeg;base64,' + faceImg } else if (msg.data.indexOf('GetBase64') == 0) { let s = msg.data.substring(10) let myimg = document.getElementById('myCanvas2') myimg.src = 'data:image/jpeg;base64,' + s alert(s) } else if (msg.data.indexOf('GetRecognitionFromFileName') == 0) { let s = msg.data.substring(27) let info = document.getElementById('info') info.value = s } else if (msg.data.indexOf('GetOcrFromFileName') == 0) { let s = msg.data.substring(19) let info = document.getElementById('info') info.value = s } else if (msg.data.indexOf('GetDogSN') == 0) { let s = msg.data.substring(11) let info = document.getElementById('info') info.value = s } } else { let reader = new FileReader() reader.onload = function (msg) { if (msg.target.readyState == FileReader.DONE) { // let url = msg.target.result; // document.getElementById('myCanvas').src = url; } } reader.readAsDataURL(msg.data) } }, close: function () { // console.log("socket已经关闭") this.socket.close() this.socket = '' }, handleFileChange(event) { let file = event.target.files[0] if (file) { this.UpFile.push(file) } }, sfzCard() { let _this = this axios.get('http://127.0.0.1:7846/api/readCard', {}).then(function (re) { let res = re.data if(res.errorMsg == 'OK') { _this.cardInfo = res.resultContent } }).catch(function (error) { console.log(error); }); }, }, destroyed() { // 销毁监听 this.close() }, mounted() { if (this.$route.params.name == "扫描打印") { this.init(); }else if(this.$route.params.name == "身份证打印") { this.sfzCard() } } } </script> <style scoped lang="less"> .selectFile { .box { width: 114.06rem; height: 42.13rem; background: #ffffff; box-shadow: 0rem 0.31rem 0.63rem 0.06rem rgba(0, 0, 0, 0.14); border-radius: 1.63rem; margin: 0 auto; .tip { //margin-right: 15.31rem; width: 37rem; font-size: 2.25rem; font-weight: bold; color: #323232; line-height: 3rem; .title { font-size: 2.88rem; font-weight: bold; color: #d41212; line-height: 4.06rem; } .content { margin: 3rem auto 59px; text-align: center; } } .file { margin-left: 9.69rem; .main { width: 31.63rem; height: 26.56rem; background: #ffffff; border: 0.06rem solid #707070; margin: 0 auto 2.81rem; padding: 2rem 0; overflow-y: scroll; .li { width: 80%; margin: 0 auto; padding-bottom: 1rem; span { text-decoration: underline; cursor: pointer; } } } } .tip2 { width: 52rem; .but { .btn { width: 24.44rem; position: relative; input { position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: 0; } } } } .file2 { margin-right: 9.69rem; .title { font-size: 2.13rem; font-weight: bold; color: #323232; line-height: 3rem; text-align: left; } .main { width: 39.81rem; height: 31.31rem; background: #eeeeee; margin: 1.38rem auto 0; } .card { width: 42.81rem; height: 35.31rem; display: flex; flex-direction: column; justify-content: space-around; align-items: flex-end; .card-box { width: 25rem; height: 15rem; margin-right: 5rem; position: relative; font-weight: bold; font-size: 0.7rem; .card-title { padding: 1rem 0; } img { width: 25rem; } .card-sign { position: absolute; bottom: 2.7rem; left: 10.5rem; } .card-date { position: absolute; bottom: 0.7rem; left: 10.5rem; } .card-name { position: absolute; top: 2.2rem; left: 4.5rem; } .card-gender { position: absolute; top: 4.1rem; left: 4.5rem; font-size: 0.7rem; span { margin-left: 5rem; } } .card-birth { position: absolute; top: 6.15rem; left: 4.5rem; font-size: 0.7rem; .month { margin-left: 2.3rem; } .day { margin-left: 1.5rem; } } .card-addr { width: 10rem; position: absolute; top: 8.1rem; left: 4.5rem; font-size: 0.7rem; text-align: left; } .card-id { position: absolute; bottom: 1.05rem; left: 8rem; font-size: 0.7rem; } .card-avatar { position: absolute; top: 3.2rem; right: 2rem; width: 7rem; height: 9rem; img { width: 7rem; height: 9rem; background-size: contain; } } } } } .file3 { margin-right: 28.13rem; .main { width: 20.75rem; height: 28.88rem; border: 0.06rem solid #707070; margin: 1.06rem 0 0 13.38rem; } } .btn { width: 100%; height: 5.5rem; background: linear-gradient(132deg, #52a39d 0%, #a1c553 50%, #81d012 100%); border-radius: 1.25rem; font-size: 1.88rem; font-weight: 400; color: #ffffff; line-height: 2.63rem; cursor: pointer; } } .smfyData { height: 90%; width: 14.81rem; font-size: 1rem; font-weight: bold; color: #323232; line-height: 2rem; overflow: auto; cursor: pointer; .act { color: #52a39d; } .name { text-decoration: underline; } span { margin-left: 5rem; } } } </style>
<template> <!-- 选取资料--> <div class="selectFile"> <navbar :name="name" /> <!-- U盘打印--> <div class="box flex-center" v-show="name == 'U盘打印'"> <div class="tip"> <div class="title">温馨提示</div> <div class="content"> 请在右侧文件浏览区,找到文件存放的目录/文件夹,然后点选您要打印的文件,之后按下“确认资料”按钮。 </div> </div> <div class="file tip2"> <div class="main"> <div v-for="(item,index) in UpFile" v-bind:key="index" class="flex-between li"> <div class="name">{{item.name}}</div> <span @click="onCancel(index,'UpFile')">删除</span> </div> </div> <div class="flex-between but"> <div class="btn flex-center" @click="paiz()">选择文件 <input type="file" @change="handleFileChange" /> </div> <div class="btn flex-center" @click="skip('transcoding',name)">确认资料</div> </div> </div> </div> <!-- 扫描打印--> <div class="box flex-center" v-show="name == '扫描打印'"> <div class="file2"> <div class="title">已完成扫描的版面</div> <div class="main flex-between"> <div class="smfyData"> <div v-for="(item, index) in imgList" v-bind:key="index" :class="['flex-center', { act: smfyIndex == index }]" @click="onChange(index, 'smfyIndex')" > <div class="name">{{ index + 1 }}</div> <span @click="onCancel(index, 'imgList')">删除</span> </div> </div> <img :src="imgList[smfyIndex]" alt="" style="width: 25rem; height: 100%" /> </div> </div> <div class="tip tip2"> <div class="title">温馨提示</div> <div class="content"> 宜家扫描号的页面显示在左边的列表中,您可以点击列表中的缩略图进行核对,有不满意的请点旁边的“X”进行移除并重新扫描。如果有件需要继续扫描,请按要求放置好资料后,按“继续扫描”。 按照刚才的方法,重复扫描过程,直到完成了所有需要的页面。核对无误后,可以按“完成扫描”结束资料扫描过程。 </div> <div class="flex-between but"> <div class="btn flex-center" @click="paiz()">继续扫描</div> <div class="btn flex-center" @click="skip('transcoding', name)"> 完成扫描 </div> </div> </div> </div> <!-- 身份证打印--> <div class="box flex-center" v-show="name == '身份证打印'"> <div class="file2 file3" style="margin-right: 20rem"> <div class="title">请核对您的信息</div> <div class="card" ref="captureArea"> <div class="card-box"> <img src="../assets/card2.png" alt="身份证反面" /> <div class="card-name">{{ cardInfo.name }}</div> <div class="card-gender"> {{ cardInfo.gender==1?'男':'女' }}<span>{{ cardInfo.nation }}</span> </div> <div class="card-birth"> {{ cardInfo.birthday | joinYear }} <span class="month">{{ cardInfo.birthday | joinMonth }}</span ><span class="day">{{ cardInfo.birthday | joinDay }}</span> </div> <div class="card-addr"> {{ cardInfo.address }} </div> <div class="card-id">{{ cardInfo.idNum }}</div> <div class="card-avatar"> <img :src="'data:image/png;base64,'+cardInfo.photo" alt="" /> </div> </div> <div class="card-box"> <img src="../assets/card1.png" alt="身份证正面" /> <div class="card-sign">{{ cardInfo.issueOrg }}</div> <div class="card-date"> {{ cardInfo.effectDate }} - {{ cardInfo.expireDate }} </div> </div> </div> </div> <div class="tip"> <div class="title">温馨提示</div> <div class="content"> 身份证件信息读取成功,请您核对个人信息无误后,按“信息无误,继续”按钮进行后续操作。此时您可以收回您的身份证卡片并妥善报讯。 </div> <div class="btn flex-center" @click="skip('transcoding', name)"> 信息无误,继续 </div> </div> </div> </div> </template> <script> import navbar from "@/components/nav"; import html2canvas from "html2canvas"; import axios from "axios"; export default { name: "selectFile", components: { navbar, }, provide() { return { title: this.tit, type: this.name, }; }, filters: { joinYear(val) { return val.substring(0, 4); }, joinMonth(val) { return val.substring(4, 6); }, joinDay(val) { return val.substring(6, 8); }, }, data() { return { tit: this.$route.params.name == "U盘打印" ? "资料选取提交" : "资料扫描提交", name: this.$route.params.name, path: this.cite.inWebURL, socket: "", imgList: [], smfyIndex: 0, UpFile: [], cardInfo: {}, }; }, methods: { skip(href, name) { this.captureAndDownload(); this.$router.push({ name: href, params: { name: name, }, }); }, async captureAndDownload() { const captureArea = this.$refs.captureArea; // 使用 html2canvas 将区域内容生成为图片 const canvas = await html2canvas(captureArea); // 将 canvas 转为图片 URL const imageUrl = canvas.toDataURL("image/png"); console.log(imageUrl); // 调用接口上传图片 // 创建一个下载链接 // const downloadLink = document.createElement("a"); // downloadLink.href = imageUrl; // downloadLink.download = "captured_image.png"; // 模拟点击下载链接 // downloadLink.click(); }, onChange(index, name) { this[name] = index; }, onCancel(index, name) { this[name].splice(index, 1); }, paiz() { this.socket.send("Capture@2"); }, init: function () { if (typeof WebSocket === "undefined") { alert("您的浏览器不支持socket"); } else { // 实例化socket this.socket = new WebSocket(this.path); // 监听socket连接 this.socket.onopen = this.open; // 监听socket错误信息 this.socket.onerror = this.error; // 监听socket消息 this.socket.onmessage = this.getMessage; } }, open: function () { // console.log("socket连接成功") this.socket.send("OpenIdCardEx@0"); this.socket.send("OpenDevice@1"); this.socket.send("SetResolution@2@2592@1944"); this.socket.send("OpenVideo"); this.socket.send("RotateRight"); this.socket.send("Deskew"); }, error: function () { console.log("连接错误"); }, getMessage: function (msg) { if (typeof msg.data == "string") { if (msg.data.indexOf("GetDevCount") == 0) { let s = msg.data.substring(12); if ("1" == s || "2" == s) { //如果是双摄像头 那就需要判断 s = 2;表示当前是连接了2个设备 alert("检测到已经连接上摄像头"); } } else if (msg.data.indexOf("Capture") == 0) { let s = msg.data.substring(8); if (s) { this.imgList.push("data:image/jpeg;base64," + s); } } else if (msg.data.indexOf("MoveDetectEvent") == 0) { this.socket.send("Capture@2"); } else if (msg.data.indexOf("IdCardEvent") == 0) { this.socket.send("UnFaceDetect"); } else if (msg.data.indexOf("ReadIdCard") == 0) { let s = msg.data.substring(11); if ("1" == s) { this.socket.send("GetIdCardResult@||"); this.socket.send("GetIdCardImage@2"); } } else if (msg.data.indexOf("GetIdCardResult") == 0) { let s = msg.data.substring(16); let info = document.getElementById("info"); info.value = s; } else if (msg.data.indexOf("GetBarcode") == 0) { // alert(msg.data); let s = msg.data.substring(11); let info = document.getElementById("info"); info.value = s; } else if (msg.data.indexOf("GetIdCardImage") == 0) { let s = msg.data.substring(15); let arr = s.split("#"); let faceImg = arr[0]; let myimg = document.getElementById("myCanvas3"); myimg.src = "data:image/jpeg;base64," + faceImg; } else if (msg.data.indexOf("GetBase64") == 0) { let s = msg.data.substring(10); let myimg = document.getElementById("myCanvas2"); myimg.src = "data:image/jpeg;base64," + s; alert(s); } else if (msg.data.indexOf("GetRecognitionFromFileName") == 0) { let s = msg.data.substring(27); let info = document.getElementById("info"); info.value = s; } else if (msg.data.indexOf("GetOcrFromFileName") == 0) { let s = msg.data.substring(19); let info = document.getElementById("info"); info.value = s; } else if (msg.data.indexOf("GetDogSN") == 0) { let s = msg.data.substring(11); let info = document.getElementById("info"); info.value = s; } } else { let reader = new FileReader(); reader.onload = function (msg) { if (msg.target.readyState == FileReader.DONE) { // let url = msg.target.result; // document.getElementById('myCanvas').src = url; } }; reader.readAsDataURL(msg.data); } }, close: function () { // console.log("socket已经关闭") this.socket.close(); this.socket = ""; }, handleFileChange(event) { let file = event.target.files[0]; if (file) { this.UpFile.push(file); } }, sfzCard() { let _this = this axios.get('http://127.0.0.1:7846/api/readCard', {}).then(function (re) { let res = re.data if(res.errorMsg == 'OK') { _this.cardInfo = res.resultContent } }).catch(function (error) { console.log(error); }); }, }, destroyed() { // 销毁监听 this.close(); }, mounted() { if (this.$route.params.name == "扫描打印") { this.init(); }else if(this.$route.params.name == "身份证打印") { this.sfzCard() } }, }; </script> <style scoped lang="less"> .selectFile { .box { width: 114.06rem; height: 42.13rem; background: #ffffff; box-shadow: 0rem 0.31rem 0.63rem 0.06rem rgba(0, 0, 0, 0.14); border-radius: 1.63rem; margin: 0 auto; .tip { //margin-right: 15.31rem; width: 37rem; font-size: 2.25rem; font-weight: bold; color: #323232; line-height: 3rem; .title { font-size: 2.88rem; font-weight: bold; color: #d41212; line-height: 4.06rem; } .content { margin: 3rem auto 59px; text-align: center; } } .file { margin-left: 9.69rem; .main { width: 31.63rem; height: 26.56rem; background: #FFFFFF; border: 0.06rem solid #707070; margin: 0 auto 2.81rem; padding: 2rem 0; overflow-y: scroll; .li { width: 80%; margin: 0 auto; padding-bottom: 1rem; span { text-decoration: underline; cursor: pointer; } } } } .tip2 { width: 52rem; .but { .btn { width: 24.44rem; position: relative; input { position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: 0; } } } } .file2 { margin-right: 9.69rem; .title { font-size: 2.13rem; font-weight: bold; color: #323232; line-height: 3rem; text-align: left; } .main { width: 39.81rem; height: 31.31rem; background: #eeeeee; margin: 1.38rem auto 0; } .card { width: 42.81rem; height: 35.31rem; display: flex; flex-direction: column; justify-content: space-around; align-items: flex-end; .card-box { width: 25rem; height: 15rem; margin-right: 5rem; position: relative; font-weight: bold; font-size: 0.7rem; .card-title { padding: 1rem 0; } img { width: 25rem; } .card-sign { position: absolute; bottom: 2.7rem; left: 10.5rem; } .card-date { position: absolute; bottom: 0.7rem; left: 10.5rem; } .card-name { position: absolute; top: 2.2rem; left: 4.5rem; } .card-gender { position: absolute; top: 4.1rem; left: 4.5rem; font-size: 0.7rem; span { margin-left: 5rem; } } .card-birth { position: absolute; top: 6.15rem; left: 4.5rem; font-size: 0.7rem; .month { margin-left: 2.3rem; } .day { margin-left: 1.5rem; } } .card-addr { width: 10rem; position: absolute; top: 8.1rem; left: 4.5rem; font-size: 0.7rem; text-align: left; } .card-id { position: absolute; bottom: 1.05rem; left: 8rem; font-size: 0.7rem; } .card-avatar { position: absolute; top: 3.2rem; right: 2rem; width: 7rem; height: 9rem; img { width: 7rem; height: 9rem; background-size: contain; } } } } } .file3 { margin-right: 28.13rem; .main { width: 20.75rem; height: 28.88rem; border: 0.06rem solid #707070; margin: 1.06rem 0 0 13.38rem; } } .btn { width: 100%; height: 5.5rem; background: linear-gradient( 132deg, #52a39d 0%, #a1c553 50%, #81d012 100% ); border-radius: 1.25rem; font-size: 1.88rem; font-weight: 400; color: #ffffff; line-height: 2.63rem; cursor: pointer; } } .smfyData { height: 90%; width: 14.81rem; font-size: 1rem; font-weight: bold; color: #323232; line-height: 2rem; overflow: auto; cursor: pointer; .act { color: #52a39d; } .name { text-decoration: underline; } span { margin-left: 5rem; } } } </style>
Show line notes below