1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003 |
- <template>
- <div class="mine">
- <!--<navbar />-->
- <div class="mine-page">
- <div class="left-max-box scrollbar-box" v-if="user.userId">
- <p class="left-title">个人中心</p>
- <div class="left-user-img">
- <userAvatar :user="user" />
- </div>
- <p class="left-name">{{user.userName}}</p>
- <p class="left-num">{{user.userType=='1'?'工号:':(user.userType=='2'?'学号:':'管理员:')}}{{user.account}}</p>
- <div class="left-text-max-box">
- <div class="left-text-big-box">
- <div class="left-text-big-box-left">
- <img v-if="user.userType == '2'" src="@/assets/ZDimages/basicsModules/icon_grzx_xl.png">
- <img v-else src="@/assets/ZDimages/basicsModules/icon_grzx_zc.png">
- <p v-if="user.userType == '1'">{{user.categoryName?user.categoryName:'未设置'}}</p>
- <p v-if="user.userType == '2'">{{user.educationName?user.educationName:'未设置'}}</p>
- </div>
- <div class="left-text-big-box-right">
- <img class="img-two" v-if="user.userType == '2'" src="@/assets/ZDimages/basicsModules/icon_grzx_zy.png">
- <img class="img-one" v-else src="@/assets/ZDimages/basicsModules/icon_grzx_zw.png">
- <p>{{user.positionName?user.positionName:'未设置'}}</p>
- </div>
- </div>
- <div class="left-text-min-box">
- <img src="@/assets/ZDimages/basicsModules/icon_grzx_sjh.png">
- <p>{{user.mobile?user.mobile:'未设置'}}</p>
- </div>
- <div class="left-text-min-box">
- <img src="@/assets/ZDimages/basicsModules/icon_grzx_yx.png">
- <p>{{user.email?user.email:'未设置'}}</p>
- </div>
- <div class="left-text-min-box">
- <img src="@/assets/ZDimages/basicsModules/icon_grzx_bgl.png">
- <p>{{user.deptName?user.deptName:'未设置'}}</p>
- </div>
- </div>
- <div class="left-type-text-max-box">
- <div>
- <p>联系方式</p>
- <p :class="user.mobile?'p-color-a':'p-color-b'">{{user.mobile?'已设置':'未设置'}}</p>
- </div>
- <div>
- <p>系统头像</p>
- <p :class="user.avatar?'p-color-a':'p-color-b'">{{user.avatar?'已设置':'未设置'}}</p>
- </div>
- <div>
- <p>人脸照片</p>
- <p :class="user.faceImg?'p-color-a':'p-color-b'">{{user.faceImg?'已设置':'未设置'}}</p>
- </div>
- <div>
- <p>电子签名</p>
- <p :class="user.signature?'p-color-a':'p-color-b'">{{user.signature?'已设置':'未设置'}}</p>
- </div>
- </div>
- </div>
- <div class="right-max-box scrollbar-box" v-if="user.userId">
- <div class="right-title-box">
- <div class="title-button-min-box" @click="buttonTypeClick(1)">
- <p :class="buttonType == '1'?'bottomColor':''">基本资料</p>
- <p :class="buttonType == '1'?'bottomBack':''"></p>
- </div>
- <div class="title-button-min-box" @click="buttonTypeClick(2)">
- <p :class="buttonType == '2'?'bottomColor':''">安全设置</p>
- <p :class="buttonType == '2'?'bottomBack':''"></p>
- </div>
- <p class="right-null-p"></p>
- <!--<p class="reset-button-one right-out-button" @click="outButton">返回</p>-->
- </div>
- <div v-if="buttonType == 1">
- <el-form :model="userform" ref="userform" :rules="rules" :inline="true" >
- <div>
- <el-form-item class="form-item-min input-number-none-box" label="联系方式:" prop="mobile" label-width="120px">
- <el-input-number
- :max="19999999999"
- v-model="userform.mobile"
- placeholder="请输入联系方式"
- clearable/>
- </el-form-item>
- <el-form-item class="form-item-min" label="邮箱:" prop="email" label-width="120px">
- <el-input
- maxlength="40"
- v-model="userform.email"
- placeholder="请输入邮箱"
- clearable
- style="width:200px;"
- size="small"
- />
- </el-form-item>
- <el-form-item class="form-item-min" label="出生年月:" prop="birthday" label-width="120px">
- <el-date-picker
- v-model="userform.birthday"
- value-format="yyyy-MM-dd"
- type="date"
- style="width:200px;"
- placeholder="请选择出生日期">
- </el-date-picker>
- </el-form-item>
- </div>
- <div>
- <el-form-item class="form-item-min" label="人脸照片:" prop="searchValue" label-width="120px">
- <div class="up-data-box" style="width:200px;">
- <div class="up-data-min-box" style="display: flex;">
- <div class="up-data-button" v-if="!user.faceImg" @click="upFaceOpenClick(2)">
- <p>+</p>
- <p>上传</p>
- </div>
- <img class="img-one" :src="user.faceImg" v-if="user.faceImg" @click="upFaceOpenClick(2)">
- </div>
- </div>
- </el-form-item>
- <el-form-item class="form-item-min" label="电子签名:" prop="searchValue" label-width="120px">
- <div class="up-data-box">
- <div class="up-data-min-box" style="display: flex;">
- <el-upload
- class="position-button"
- :action="uploadImgUrlTwo"
- :show-file-list="false"
- :auto-upload="false"
- :on-change="signatureChange"
- accept="image/jpeg,image/jpg,image/gif,image/png"
- :headers="headers"
- :before-upload="beforeAvatarUpload">
- <div class="up-data-button" v-if="!user.signature">
- <p>+</p>
- <p>上传</p>
- </div>
- <img class="img-two" :src="user.signature" v-if="user.signature">
- </el-upload>
- </div>
- </div>
- </el-form-item>
- </div>
- </el-form>
- <p class="type-one-max-box page-submit-common-style-button" @click="upDataProfile">保存</p>
- </div>
- <div v-if="buttonType == 2">
- <el-form :model="form" ref="form" :inline="true" :rules="rules">
- <div>
- <el-form-item class="form-item-min" label="原始密码:" prop="oldPassword" :validate-event="false" label-width="120px">
- <el-input
- maxlength="16"
- type="password"
- v-model.trim="form.oldPassword"
- placeholder="请输入原始密码"
- clearable
- size="small"
- />
- </el-form-item>
- <el-form-item class="form-item-min" label="新密码:" prop="password" :validate-event="false" label-width="120px">
- <el-input
- maxlength="16"
- type="password"
- v-model.trim="form.password"
- placeholder="请输入新密码"
- clearable
- size="small"
- />
- </el-form-item>
- <el-form-item class="form-item-min" label="确认密码:" prop="confirmPassword" :validate-event="false" label-width="120px">
- <el-input
- maxlength="16"
- type="password"
- v-model.trim="form.confirmPassword"
- placeholder="请确认密码"
- clearable
- size="small"
- />
- </el-form-item>
- <span class="type-one-max-box page-submit-common-style-button" style="margin-left:20px;display: inline-block;" @click="submit">保存</span>
- </div>
- </el-form>
- </div>
- </div>
- </div>
- <!--电子签名-->
- <el-dialog class="up-img-box" title="上传电子签名" :visible.sync="upImgOpen" width="600px" append-to-body :close-on-click-modal="false">
- <p>示例</p>
- <img class="img-one" src="@/assets/ZDimages/basicsModules/icon_scdzqm_sl.png">
- <p>正楷签名</p>
- <div class="cropper-box">
- <vueCropper
- ref="cropper"
- :img="option.img"
- :outputSize="option.outputSize"
- :outputType="option.outputType"
- :info="option.info"
- :canScale="option.canScale"
- :autoCrop="option.autoCrop"
- :autoCropWidth="option.autoCropWidth"
- :autoCropHeight="option.autoCropHeight"
- :fixed="option.fixed"
- :fixedNumber="option.fixedNumber"
- :full="option.full"
- :fixedBox="option.fixedBox"
- :canMove="option.canMove"
- :canMoveBox="option.canMoveBox"
- :original="option.original"
- :centerBox="option.centerBox"
- :height="option.height"
- :infoTrue="option.infoTrue"
- :maxImgSize="option.maxImgSize"
- :enlarge="option.enlarge"
- :mode="option.mode"
- @realTime="realTime"
- @imgLoad="imgLoad"
- ></vueCropper>
- <p class="cropper-button" @click="upImgButton">保存查看</p>
- <el-upload
- class="position-button"
- :action="uploadImgUrl"
- :show-file-list="false"
- :auto-upload="false"
- :on-change="signatureChange"
- accept="image/jpeg,image/jpg,image/gif,image/png"
- :headers="headers"
- :before-upload="beforeAvatarUpload">
- <p style="position: absolute;right:100px;top:10px;z-index:1;color:#fff;background:#14AE10;cursor: pointer;padding:5px 10px;margin:0;border-radius:6px;">选择签名</p>
- </el-upload>
- </div>
- <p style="color:#999;">请将签名置于选择框内以便提高识别度</p>
- <img class="cropper-img" v-if="signatureData" :src="signatureData">
- <div slot="footer" class="dialog-footer dialog-footer-box">
- <p class="dialog-footer-button-null"></p >
- <p class="dialog-footer-button-info" @click="upImgOpenClick(1)">取消</p >
- <p class="dialog-footer-button-primary" @click="upSignatureData">提交</p >
- <p class="dialog-footer-button-null"></p >
- </div>
- </el-dialog>
- <!--上传照片-->
- <el-dialog class="up-img-box" title="上传照片" :visible.sync="upFaceOpen" width="600px" append-to-body :close-on-click-modal="false">
- <el-upload
- ref="faceUpLoad"
- class="position-button"
- :action="uploadImgUrl"
- :data="upImportData"
- :show-file-list="false"
- :auto-upload="false"
- :on-change="faceChange"
- accept="image/jpeg,image/jpg,image/gif,image/png"
- :on-success="(res)=>handleAvatarSuccess(res)"
- :headers="headers"
- :before-upload="beforeAvatarUpload">
- <div v-if="!upFaceUrl" style="width:300px;height:300px;border: 1px dashed #E0E0E0;cursor: pointer;margin:20px 130px 0;">
- <p style="text-align: center;color:#999;font-weight:500;font-size: 20px;line-height:300px;margin:0;">+</p>
- </div>
- <div v-if="upFaceUrl" class="scrollbar-box" style="width:560px;margin:0 auto;max-height:700px;overflow-y: scroll">
- <img :src="upFaceUrl" style="max-width:560px;border: 1px dashed #E0E0E0;cursor: pointer;margin:30px auto 0;">
- </div>
- </el-upload>
- <div slot="footer" class="dialog-footer dialog-footer-box">
- <p class="dialog-footer-button-null"></p >
- <p class="dialog-footer-button-info" @click="faceButton(1)">取消</p >
- <p class="dialog-footer-button-primary" @click="faceButton(2)">提交</p >
- <p class="dialog-footer-button-null"></p >
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import userAvatar from "./components/userAvatar";
- import { getUserProfile,updateUserPwd,changePhone,genSign,updateSignature,upDataProfile,fingerprintQuantity} from "@/api/basicsModules/index";
- import { getToken } from "@/utils/auth";
- //V3
- import { systemUserProfile,systemUserEditPasswd,systemUserEditUser } from "@/api/commonality/permission";
- import md5 from 'js-md5';
- export default {
- name: "mine",
- components: {
- userAvatar,
- },
- data(){
- const equalToPassword = (rule, value, callback) => {
- if (this.form.confirmPassword !== value) {
- callback(new Error("两次输入的密码不一致"));
- } else {
- callback();
- }
- };
- const equalToPasswordTwo = (rule, value, callback) => {
- if (this.form.password !== value) {
- callback(new Error("两次输入的密码不一致"));
- } else {
- callback();
- }
- };
- const validatePass = (rule, value, callback) => {
- let reg = /^(?=.*[0-9\!@#\$%\^&\*])(?=.*[a-zA-Z]).{8,16}$/
- // let reg = /^(?![A-z0-9]+$)(?=.[^%&',;=?$\x22])(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{8,16}$/
- if(reg.test(value)){
- const reg2 = /(\w)*(\w)\2{2}(\w)*/g
- if (reg2.test(value)) {
- return callback(new Error('请输入8-16位密码,不能输入纯数字或重复性的密码'));
- }else{
- callback()
- }
- }else{
- return callback(new Error('请输入8-16位密码,不能输入纯数字或重复性的密码'));
- }
- };
- // 不能连续字符(如123、abc)连续3位或3位以上
- const LxStr = (rule, value, callback) => {
- const regex = /([a-zA-Z])\1{2}/;
- const regex2 = /(\d)\1{2}/;
- const result = value.match(regex);
- const result2 = value.match(regex2);
- let arr = value.split('')
- let flag = true
- for (let i = 1; i < arr.length - 1; i++) {
- let firstIndex = arr[i - 1].charCodeAt()
- let secondIndex = arr[i].charCodeAt()
- let thirdIndex = arr[i + 1].charCodeAt()
- thirdIndex - secondIndex == 1
- secondIndex - firstIndex == 1
- if ((thirdIndex - secondIndex == 1) && (secondIndex - firstIndex == 1)) {
- flag = false
- }
- }
- if (result||result2||!flag) {
- return callback(new Error('不能输入如:123,abc,111,aaa等形式的连续型字符'));
- }else{
- callback()
- }
- }
- return{
- buttonType:'1',
- uploadImgUrl: window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/system/user/face/addOrUpdate", // 上传的图片服务器地址
- uploadImgUrlTwo: window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/file/upload", // 上传的图片服务器地址
- headers: {
- Authorization: getToken(),
- },
- upImportData:{
- userId:localStorage.getItem('userId'),
- },
- pageType:false,
- user: {
- userId:"",
- },
- roleGroup: {},
- postGroup: {},
- activeTab: "resetPwd",
- form:{
- oldPassword:"",
- password:"",
- confirmPassword:""
- },
- userform:{},
- userformData:{},
- open:false,
- phoneForm:{
- phone:"",
- },
- // 表单校验
- rules: {
- oldPassword: [
- { required: true, message: "旧密码不能为空", trigger: "blur" },
- ],
- password: [
- { required: true, message: "新密码不能为空", trigger: "blur" },
- { required: true, message: "用户密码不能为空", validator: this.spaceJudgment, trigger: "blur" },
- { required: true, validator: equalToPassword, trigger: "blur" },
- { required: true, message: "不能输入如:123,abc,111,aaa等形式的连续型字符", validator: LxStr, trigger: "blur" },
- {
- pattern: /^(?=(?:.*[A-Z]){1})(?=(?:.*[a-z]){1})(?=(?:.*[0-9]){1})(?=(?:.*[!@#*?&]){1})(?!(.)\1)(.{10,16})$/,
- message: '密码长度最少10位 最多16位,必须同时包含一个大写字母、一个小写字母、一个数字和一个特殊字符!@#*?&',
- trigger: 'blur'
- }
- ],
- confirmPassword: [
- { required: true, message: "确认密码不能为空", trigger: "blur" },
- { required: true, message: "用户密码不能为空", validator: this.spaceJudgment, trigger: "blur" },
- { required: true, validator: equalToPasswordTwo, trigger: "blur" },
- { required: true, message: "不能输入如:123,abc,111,aaa等形式的连续型字符", validator: LxStr, trigger: "blur" },
- {
- pattern: /^(?=(?:.*[A-Z]){1})(?=(?:.*[a-z]){1})(?=(?:.*[0-9]){1})(?=(?:.*[!@#*?&]){1})(?!(.)\1)(.{10,16})$/,
- message: '密码长度最少10位 最多16位,必须同时包含一个大写字母、一个小写字母、一个数字和一个特殊字符!@#*?&',
- trigger: 'blur'
- }
- ],
- mobile: [
- { required: true, message: "请输入11位手机号码", trigger: "blur" },
- { validator: this.checkPhone, trigger: 'blur' },
- // { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" },
- { required: true, message: "请输入11位手机号码", validator: this.spaceJudgment, trigger: "blur" }
- ],
- // phone: [
- // { required: true, message: "请输入手机号码", trigger: "blur" },
- // { required: true, message: "请输入手机号码", validator: this.spaceJudgment, trigger: "blur" }
- // ],
- // email: [
- // { required: true, message: "请输入邮箱地址", trigger: "blur" },
- // { required: true, message: "请输入正确的邮箱地址", type: 'email'},
- // { required: true, message: "请输入邮箱地址", validator: this.spaceJudgment, trigger: "blur" }
- // ],
- // birthday: [
- // { required: true, message: "请选择出生日期", trigger: "blur" }
- // ],
- },
- //上传签名开关
- upImgOpen:false,
- option:{
- img: '', // 裁剪图片的地址
- outputSize: 1, //裁剪生成图片的质量(可选0.1 - 1)
- outputType: 'png', //裁剪生成图片的格式(jpeg || png || webp)
- info: true, //图片大小信息
- canScale: true, //图片是否允许滚轮缩放
- autoCrop: true, //是否默认生成截图框
- autoCropWidth: 240, //默认生成截图框宽度
- autoCropHeight: 80, //默认生成截图框高度
- fixed: true, //是否开启截图框宽高固定比例
- fixedNumber: [3, 1], //截图框的宽高比例
- full: false, //false按原比例裁切图片,不失真
- fixedBox: true, //固定截图框大小,不允许改变
- canMove: false, //上传图片是否可以移动
- canMoveBox: true, //截图框能否拖动
- original: false, //上传图片按照原始比例渲染
- centerBox: false, //截图框是否被限制在图片里面
- height: true, //是否按照设备的dpr 输出等比例图片
- infoTrue: false, //true为展示真实输出图片宽高,false展示看到的截图框宽高
- maxImgSize: 3000, //限制图片最大宽度和高度
- enlarge: 1, //图片根据截图框输出比例倍数
- mode: '560px 400px' //图片默认渲染方式
- },
- previews:{},
- //上传人脸
- upFaceOpen:false,
- upFaceUrl:"",
- //临时签名数据
- signatureData:"",
- Quantity:0,//指纹录取数量
- }
- },
- created() {
- this.getUser();
- // this.fingerprintQuantityFun();
- },
- methods: {
- //修改用户信息
- upDataProfile(){
- this.$refs["userform"].validate(valid => {
- if (valid) {
- if(!this.userform.mobile&&!this.userform.email&&!this.userform.birthday){
- this.msgError('联系方式/邮箱/出生年月,请至少填写一项进行修改')
- return
- }
- if((this.userform.mobile == this.userformData.mobile)&&
- (this.userform.email == this.userformData.email)&&
- (this.userform.birthday == this.userformData.birthday)){
- this.msgError('联系方式/邮箱/出生年月,请至少修改一项再进行保存操作')
- return
- }
- // let obj = JSON.parse(JSON.stringify(this.userform));
- let obj = {
- userId : this.user.userId,
- userType : this.user.userType,
- };
- obj.mobile = this.userform.mobile;
- if(this.userform.email){
- let regex = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
- if(!regex.test(this.userform.email)){
- this.msgError('请输入正确的邮箱地址')
- return
- }else{
- obj.email = this.userform.email;
- }
- }else {
- obj.email = '';
- }
- if(this.userform.birthday){
- obj.birthday = this.userform.birthday;
- }else{
- obj.birthday = '';
- }
- systemUserEditUser(obj).then(response => {
- this.msgSuccess('操作成功');
- this.getUser();
- });
- }
- })
- },
- //手机号验证
- checkPhone(rule, value, callback) {
- if (!value) {
- return callback(new Error('手机号码不能为空'))
- } else {
- if(value == '19999999999'){
- return callback(new Error('请输入正确的手机号码'))
- }
- const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
- if (reg.test(value)) {
- callback()
- } else {
- return callback(new Error('请输入正确的手机号码'))
- }
- }
- },
- //修改按钮密码
- submit() {
- let self = this;
- self.$refs["form"].validate(valid => {
- if (valid) {
- this.$confirm('确定要修改吗', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- self.systemUserEditPasswd();
- }).then(() => {
- }).catch(() => {});
- }
- });
- },
- //指纹-查询用户指纹录取数量
- fingerprintQuantityFun(){
- let _this=this;
- fingerprintQuantity(localStorage.getItem('userId')).then(response => {
- if(response.code == 200){
- _this.Quantity=response.data;
- }
- }
- );
- },
- //修改密码接口
- systemUserEditPasswd(){
- let obj = {
- userId:this.user.userId,
- oldPassword:md5(this.form.oldPassword),
- password:md5(this.form.password)
- }
- systemUserEditPasswd(obj).then(
- response => {
- this.form.oldPassword = "";
- this.form.password = "";
- this.form.confirmPassword = "";
- this.msgSuccess("修改成功");
- }
- );
- },
- //返回按钮
- outButton(){
- this.$router.go(-1)
- },
- //页面按钮点击
- buttonTypeClick(type){
- if(this.buttonType != type){
- if(type == 1){
- this.buttonType = type;
- }else {
- if (this.user.source == 1){
- this.buttonType = type;
- } else {
- // 系统对接用户 跳转至统一认证平台
- }
- }
- }
- },
- //获取信息
- getUser() {
- // getUserProfile().then(response => {
- systemUserProfile().then(response => {
- this.user = JSON.parse(JSON.stringify(response.data));
- this.roleGroup = response.roleGroup;
- this.postGroup = response.postGroup;
- let obj = {
- mobile:response.data.mobile,
- email:response.data.email,
- birthday:response.data.birthday,
- }
- this.$set(this,'userform',JSON.parse(JSON.stringify(obj)));
- this.$set(this,'userformData',JSON.parse(JSON.stringify(obj)));
- this.pageType = true;
- });
- },
- //上传签名
- upSignatureData(){
- if(!this.signatureData){
- this.msgError('请先选择签名上传并保存查看')
- }
- var blob = this.dataURLtoBlob(this.signatureData);
- var file = this.blobToFile(blob, 'dx.jpg');
- let formData = new FormData();
- formData.append('file',file,"DX.jpg")
- updateSignature(formData).then(response => {
- if(response.code == 200){
- this.msgSuccess("操作成功");
- this.upImgOpen = false;
- this.getUser();
- }
- });
- },
- //照片页面开关
- upFaceOpenClick(type){
- if(type == 1){
- this.upFaceOpen = false;
- }else if (type == 2){
- this.upFaceUrl = this.user.faceImg;
- this.upFaceOpen = true;
- }
- },
- //签名页面开关
- upImgOpenClick(type){
- if(type == 1){
- this.upImgOpen = false;
- }else if (type == 2){
- this.option.img = this.user.signature;
- this.signatureData = this.user.signature;
- this.upImgOpen = true;
- }
- },
- //确定签名
- upImgButton(){
- let self = this;
- this.$refs.cropper.getCropBlob(async (data) => {
- let formData = new FormData();
- formData.append('file',data,"DX.jpg")
- genSign(formData).then(response => {
- if(response.code == 200){
- this.signatureData = 'data:image/png;base64,'+response.data;
- } else {
- this.msgError(response.message)
- }
- });
- })
- },
- //照片选择
- faceChange(val){
- const windowURL = window.URL || window.webkitURL;
- this.upFaceUrl = windowURL.createObjectURL(val.raw)
- },
- //签名选择
- signatureChange(val){
- const windowURL = window.URL || window.webkitURL;
- this.option.img = windowURL.createObjectURL(val.raw)
- this.signatureData = "";
- this.upImgOpen = true;
- },
- // 照片上传按钮
- faceButton(type){
- if(type==1){
- this.upFaceOpen = false;
- }else if(type == 2){
- this.$refs.faceUpLoad.submit();
- }
- },
- //上传
- handleAvatarSuccess(res, type) {
- if(res.code == 200){
- // this.user.faceImg = res.data.cardUrl;
- this.upFaceOpen = false;
- this.getUser();
- this.msgSuccess(res.message)
- this.$forceUpdate()
- }else{
- this.msgError(res.message)
- }
- },
- beforeAvatarUpload(file) {
- let type = false;
- if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/jpg' || file.type == 'image/gif') {
- type = true;
- }else{
- this.msgError('只能上传png/jpeg/jpg/gif格式图片')
- type = false;
- }
- return type;
- },
- // 实时预览函数
- realTime(data) {
- this.previews = data;
- },
- //图片加载的回调 imgLoad 返回结果success, error
- imgLoad (msg) {
- },
- //将base64转换为blob
- dataURLtoBlob: function(dataurl) {
- var arr = dataurl.split(',')
- var mime = arr[0].match(/:(.*?);/)[1]
- var bstr = atob(arr[1])
- var n = bstr.length
- var u8arr = new Uint8Array(n)
- while (n--) {
- u8arr[n] = bstr.charCodeAt(n);
- }
- return new Blob([u8arr], { type: mime });
- },
- //将blob转换为file
- blobToFile: function(theBlob, fileName){
- theBlob.lastModifiedDate = new Date();
- theBlob.name = fileName;
- return theBlob;
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .mine{
- height:100%;
- width:100%;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- *{
- margin:0;
- }
- .mine-page{
- flex:1;
- display: flex;
- overflow: hidden;
- .left-max-box{
- width:300px;
- /*margin:20px;*/
- margin:5px 20px 20px 10px;
- box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
- border-radius:10px;
- .left-title{
- font-size:18px;
- text-align: center;
- line-height: 30px;
- margin-top:30px;
- color:#0045af;
- }
- .left-user-img{
- width:130px;
- height:130px;
- overflow: hidden;
- border-radius:50%;
- margin:30px auto 20px;
- }
- .left-name{
- font-size:20px;
- line-height:43px;
- text-align: center;
- }
- .left-num{
- font-size:16px;
- line-height:38px;
- text-align: center;
- }
- .left-text-max-box{
- border-top:1px dashed #dedede;
- border-bottom:1px dashed #dedede;
- margin:24px 10px 0;
- padding:20px 0;
- .left-text-big-box{
- display: flex;
- .left-text-big-box-left{
- width:100px;
- height:38px;
- display: flex;
- margin-right:10px;
- img{
- width:16px;
- height:16px;
- margin:11px 10px 0;
- }
- p{
- flex:1;
- font-size:14px;
- line-height:38px;
- display:block;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- }
- .left-text-big-box-right{
- height:38px;
- flex:1;
- display: flex;
- .img-one{
- width:16px;
- height:14px;
- margin:12px 10px 0;
- }
- .img-two{
- width:16px;
- height:16px;
- margin:11px 10px 0;
- }
- p{
- flex:1;
- font-size:14px;
- line-height:38px;
- display:block;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- }
- }
- .left-text-min-box{
- display: flex;
- height:38px;
- img{
- width:16px;
- height:16px;
- margin:11px 10px 0;
- }
- p{
- flex:1;
- font-size:14px;
- line-height:38px;
- }
- }
- }
- .left-type-text-max-box{
- padding:20px 0;
- div{
- display: flex;
- p{
- flex:1;
- font-size:14px;
- color:#333;
- line-height:40px;
- }
- p:nth-child(1){
- text-align: left;
- margin-left:32px;
- }
- p:nth-child(2){
- text-align: right;
- margin-right:48px;
- }
- .p-color-a{
- color:#06B924;
- }
- .p-color-b{
- color:#FF9735;
- }
- }
- }
- }
- .right-max-box{
- flex:1;
- /*margin:20px 20px 20px 0;*/
- margin:5px 20px 20px 0;
- box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
- border-radius:10px;
- display: flex;
- flex-direction: column;
- .right-title-box{
- display: flex;
- border-bottom:1px solid #dedede;
- .title-button-min-box{
- height:90px;
- margin:0 20px;
- cursor: pointer;
- p:nth-child(1){
- margin-top:6px;
- line-height:78px;
- font-size:16px;
- }
- p:nth-child(2){
- height:6px;
- border-radius:4px;
- }
- .bottomColor{
- color:#0045AF;
- }
- .bottomBack{
- background:#0045AF ;
- }
- }
- .right-null-p{
- flex:1;
- }
- .right-out-button{
- margin:20px;
- }
- }
- .type-one-max-box{
- width:100px;
- margin:40px auto;
- }
- .up-data-box{
- display: inline-block;
- width:280px;
- line-height:20px;
- margin-bottom:30px;
- .up-data-min-box{
- .up-data-title{
- font-size:15px;
- color:#333;
- }
- .up-data-button{
- width:120px;
- height:120px;
- border: 1px dashed #E0E0E0;
- cursor: pointer;
- p{
- text-align: center;
- color:#999;
- font-weight:500;
- }
- p:nth-child(1){
- font-size: 20px;
- line-height:40px;
- margin-top:20px;
- }
- p:nth-child(2){
- font-size: 16px;
- }
- }
- .img-one{
- width:120px;
- height:120px;
- }
- .img-two{
- width: 240px;
- height:80px;
- }
- }
- }
- .fingerprint_no{
- >p:nth-of-type(1){
- color: #666666;
- }
- >p:nth-of-type(2){
- color: #F56C6C;
- }
- }
- .fingerprint_yes{
- .fingerprint_yes_img{
- width: 122px;
- height: 142px;
- position: relative;
- >img:nth-of-type(1){
- width: 122px;
- height: 142px;
- position: absolute;
- }
- >img:nth-of-type(2){
- width: 65px;
- height: 88px;
- position: absolute;
- left: 29px;
- top: 29px;
- }
- }
- >p{
- color: #666;
- text-align: center;
- }
- }
- .form-item-min{
- margin-top:40px;
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .up-img-box{
- .el-dialog__body{
- padding-top:0;
- }
- .img-one{
- width:560px;
- height:150px;
- }
- .cropper-img{
- display: block;
- border:1px solid #e0e0e0;
- width:360px;
- height:120px;
- margin:0 auto;
- }
- .cropper-box{
- width:560px;
- height:270px;
- position: relative;
- .cropper-button{
- position: absolute;
- right:10px;top:10px;
- z-index:1;
- background: #0183FA;
- color:#fff;
- cursor: pointer;
- padding:5px 10px;
- margin:0;
- border-radius:6px;
- }
- }
- }
- .mine{
- .mine-page{
- .input-number-none-box{
- input{
- text-align: left;
- }
- }
- }
- }
- </style>
|