mine.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. <template>
  2. <div class="mine">
  3. <!--<navbar />-->
  4. <div class="mine-page">
  5. <div class="left-max-box scrollbar-box" v-if="user.userId">
  6. <p class="left-title">个人中心</p>
  7. <div class="left-user-img">
  8. <userAvatar :user="user" />
  9. </div>
  10. <p class="left-name">{{user.userName}}</p>
  11. <p class="left-num">{{user.userType=='1'?'工号:':(user.userType=='2'?'学号:':'管理员:')}}{{user.account}}</p>
  12. <div class="left-text-max-box">
  13. <div class="left-text-big-box">
  14. <div class="left-text-big-box-left">
  15. <img v-if="user.userType == '2'" src="@/assets/ZDimages/basicsModules/icon_grzx_xl.png">
  16. <img v-else src="@/assets/ZDimages/basicsModules/icon_grzx_zc.png">
  17. <p v-if="user.userType == '1'">{{user.categoryName?user.categoryName:'未设置'}}</p>
  18. <p v-if="user.userType == '2'">{{user.educationName?user.educationName:'未设置'}}</p>
  19. </div>
  20. <div class="left-text-big-box-right">
  21. <img class="img-two" v-if="user.userType == '2'" src="@/assets/ZDimages/basicsModules/icon_grzx_zy.png">
  22. <img class="img-one" v-else src="@/assets/ZDimages/basicsModules/icon_grzx_zw.png">
  23. <p>{{user.positionName?user.positionName:'未设置'}}</p>
  24. </div>
  25. </div>
  26. <div class="left-text-min-box">
  27. <img src="@/assets/ZDimages/basicsModules/icon_grzx_sjh.png">
  28. <p>{{user.mobile?user.mobile:'未设置'}}</p>
  29. </div>
  30. <div class="left-text-min-box">
  31. <img src="@/assets/ZDimages/basicsModules/icon_grzx_yx.png">
  32. <p>{{user.email?user.email:'未设置'}}</p>
  33. </div>
  34. <div class="left-text-min-box">
  35. <img src="@/assets/ZDimages/basicsModules/icon_grzx_bgl.png">
  36. <p>{{user.deptName?user.deptName:'未设置'}}</p>
  37. </div>
  38. </div>
  39. <div class="left-type-text-max-box">
  40. <div>
  41. <p>联系方式</p>
  42. <p :class="user.mobile?'p-color-a':'p-color-b'">{{user.mobile?'已设置':'未设置'}}</p>
  43. </div>
  44. <div>
  45. <p>系统头像</p>
  46. <p :class="user.avatar?'p-color-a':'p-color-b'">{{user.avatar?'已设置':'未设置'}}</p>
  47. </div>
  48. <div>
  49. <p>人脸照片</p>
  50. <p :class="user.faceImg?'p-color-a':'p-color-b'">{{user.faceImg?'已设置':'未设置'}}</p>
  51. </div>
  52. <div>
  53. <p>电子签名</p>
  54. <p :class="user.signature?'p-color-a':'p-color-b'">{{user.signature?'已设置':'未设置'}}</p>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="right-max-box scrollbar-box" v-if="user.userId">
  59. <div class="right-title-box">
  60. <div class="title-button-min-box" @click="buttonTypeClick(1)">
  61. <p :class="buttonType == '1'?'bottomColor':''">基本资料</p>
  62. <p :class="buttonType == '1'?'bottomBack':''"></p>
  63. </div>
  64. <div class="title-button-min-box" @click="buttonTypeClick(2)">
  65. <p :class="buttonType == '2'?'bottomColor':''">安全设置</p>
  66. <p :class="buttonType == '2'?'bottomBack':''"></p>
  67. </div>
  68. <p class="right-null-p"></p>
  69. <!--<p class="reset-button-one right-out-button" @click="outButton">返回</p>-->
  70. </div>
  71. <div v-if="buttonType == 1">
  72. <el-form :model="userform" ref="userform" :rules="rules" :inline="true" >
  73. <div>
  74. <el-form-item class="form-item-min input-number-none-box" label="联系方式:" prop="mobile" label-width="120px">
  75. <el-input-number
  76. :max="19999999999"
  77. v-model="userform.mobile"
  78. placeholder="请输入联系方式"
  79. clearable/>
  80. </el-form-item>
  81. <el-form-item class="form-item-min" label="邮箱:" prop="email" label-width="120px">
  82. <el-input
  83. maxlength="40"
  84. v-model="userform.email"
  85. placeholder="请输入邮箱"
  86. clearable
  87. style="width:200px;"
  88. size="small"
  89. />
  90. </el-form-item>
  91. <el-form-item class="form-item-min" label="出生年月:" prop="birthday" label-width="120px">
  92. <el-date-picker
  93. v-model="userform.birthday"
  94. value-format="yyyy-MM-dd"
  95. type="date"
  96. style="width:200px;"
  97. placeholder="请选择出生日期">
  98. </el-date-picker>
  99. </el-form-item>
  100. </div>
  101. <div>
  102. <el-form-item class="form-item-min" label="人脸照片:" prop="searchValue" label-width="120px">
  103. <div class="up-data-box" style="width:200px;">
  104. <div class="up-data-min-box" style="display: flex;">
  105. <div class="up-data-button" v-if="!user.faceImg" @click="upFaceOpenClick(2)">
  106. <p>+</p>
  107. <p>上传</p>
  108. </div>
  109. <img class="img-one" :src="user.faceImg" v-if="user.faceImg" @click="upFaceOpenClick(2)">
  110. </div>
  111. </div>
  112. </el-form-item>
  113. <el-form-item class="form-item-min" label="电子签名:" prop="searchValue" label-width="120px">
  114. <div class="up-data-box">
  115. <div class="up-data-min-box" style="display: flex;">
  116. <el-upload
  117. class="position-button"
  118. :action="uploadImgUrlTwo"
  119. :show-file-list="false"
  120. :auto-upload="false"
  121. :on-change="signatureChange"
  122. accept="image/jpeg,image/jpg,image/gif,image/png"
  123. :headers="headers"
  124. :before-upload="beforeAvatarUpload">
  125. <div class="up-data-button" v-if="!user.signature">
  126. <p>+</p>
  127. <p>上传</p>
  128. </div>
  129. <img class="img-two" :src="user.signature" v-if="user.signature">
  130. </el-upload>
  131. </div>
  132. </div>
  133. </el-form-item>
  134. </div>
  135. </el-form>
  136. <p class="type-one-max-box page-submit-common-style-button" @click="upDataProfile">保存</p>
  137. </div>
  138. <div v-if="buttonType == 2">
  139. <el-form :model="form" ref="form" :inline="true" :rules="rules">
  140. <div>
  141. <el-form-item class="form-item-min" label="原始密码:" prop="oldPassword" :validate-event="false" label-width="120px">
  142. <el-input
  143. maxlength="16"
  144. type="password"
  145. v-model.trim="form.oldPassword"
  146. placeholder="请输入原始密码"
  147. clearable
  148. size="small"
  149. />
  150. </el-form-item>
  151. <el-form-item class="form-item-min" label="新密码:" prop="password" :validate-event="false" label-width="120px">
  152. <el-input
  153. maxlength="16"
  154. type="password"
  155. v-model.trim="form.password"
  156. placeholder="请输入新密码"
  157. clearable
  158. size="small"
  159. />
  160. </el-form-item>
  161. <el-form-item class="form-item-min" label="确认密码:" prop="confirmPassword" :validate-event="false" label-width="120px">
  162. <el-input
  163. maxlength="16"
  164. type="password"
  165. v-model.trim="form.confirmPassword"
  166. placeholder="请确认密码"
  167. clearable
  168. size="small"
  169. />
  170. </el-form-item>
  171. <span class="type-one-max-box page-submit-common-style-button" style="margin-left:20px;display: inline-block;" @click="submit">保存</span>
  172. </div>
  173. </el-form>
  174. </div>
  175. </div>
  176. </div>
  177. <!--电子签名-->
  178. <el-dialog class="up-img-box" title="上传电子签名" :visible.sync="upImgOpen" width="600px" append-to-body :close-on-click-modal="false">
  179. <p>示例</p>
  180. <img class="img-one" src="@/assets/ZDimages/basicsModules/icon_scdzqm_sl.png">
  181. <p>正楷签名</p>
  182. <div class="cropper-box">
  183. <vueCropper
  184. ref="cropper"
  185. :img="option.img"
  186. :outputSize="option.outputSize"
  187. :outputType="option.outputType"
  188. :info="option.info"
  189. :canScale="option.canScale"
  190. :autoCrop="option.autoCrop"
  191. :autoCropWidth="option.autoCropWidth"
  192. :autoCropHeight="option.autoCropHeight"
  193. :fixed="option.fixed"
  194. :fixedNumber="option.fixedNumber"
  195. :full="option.full"
  196. :fixedBox="option.fixedBox"
  197. :canMove="option.canMove"
  198. :canMoveBox="option.canMoveBox"
  199. :original="option.original"
  200. :centerBox="option.centerBox"
  201. :height="option.height"
  202. :infoTrue="option.infoTrue"
  203. :maxImgSize="option.maxImgSize"
  204. :enlarge="option.enlarge"
  205. :mode="option.mode"
  206. @realTime="realTime"
  207. @imgLoad="imgLoad"
  208. ></vueCropper>
  209. <p class="cropper-button" @click="upImgButton">保存查看</p>
  210. <el-upload
  211. class="position-button"
  212. :action="uploadImgUrl"
  213. :show-file-list="false"
  214. :auto-upload="false"
  215. :on-change="signatureChange"
  216. accept="image/jpeg,image/jpg,image/gif,image/png"
  217. :headers="headers"
  218. :before-upload="beforeAvatarUpload">
  219. <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>
  220. </el-upload>
  221. </div>
  222. <p style="color:#999;">请将签名置于选择框内以便提高识别度</p>
  223. <img class="cropper-img" v-if="signatureData" :src="signatureData">
  224. <div slot="footer" class="dialog-footer dialog-footer-box">
  225. <p class="dialog-footer-button-null"></p >
  226. <p class="dialog-footer-button-info" @click="upImgOpenClick(1)">取消</p >
  227. <p class="dialog-footer-button-primary" @click="upSignatureData">提交</p >
  228. <p class="dialog-footer-button-null"></p >
  229. </div>
  230. </el-dialog>
  231. <!--上传照片-->
  232. <el-dialog class="up-img-box" title="上传照片" :visible.sync="upFaceOpen" width="600px" append-to-body :close-on-click-modal="false">
  233. <el-upload
  234. ref="faceUpLoad"
  235. class="position-button"
  236. :action="uploadImgUrl"
  237. :data="upImportData"
  238. :show-file-list="false"
  239. :auto-upload="false"
  240. :on-change="faceChange"
  241. accept="image/jpeg,image/jpg,image/gif,image/png"
  242. :on-success="(res)=>handleAvatarSuccess(res)"
  243. :headers="headers"
  244. :before-upload="beforeAvatarUpload">
  245. <div v-if="!upFaceUrl" style="width:300px;height:300px;border: 1px dashed #E0E0E0;cursor: pointer;margin:20px 130px 0;">
  246. <p style="text-align: center;color:#999;font-weight:500;font-size: 20px;line-height:300px;margin:0;">+</p>
  247. </div>
  248. <div v-if="upFaceUrl" class="scrollbar-box" style="width:560px;margin:0 auto;max-height:700px;overflow-y: scroll">
  249. <img :src="upFaceUrl" style="max-width:560px;border: 1px dashed #E0E0E0;cursor: pointer;margin:30px auto 0;">
  250. </div>
  251. </el-upload>
  252. <div slot="footer" class="dialog-footer dialog-footer-box">
  253. <p class="dialog-footer-button-null"></p >
  254. <p class="dialog-footer-button-info" @click="faceButton(1)">取消</p >
  255. <p class="dialog-footer-button-primary" @click="faceButton(2)">提交</p >
  256. <p class="dialog-footer-button-null"></p >
  257. </div>
  258. </el-dialog>
  259. </div>
  260. </template>
  261. <script>
  262. import userAvatar from "./components/userAvatar";
  263. import { getUserProfile,updateUserPwd,changePhone,genSign,updateSignature,upDataProfile,fingerprintQuantity} from "@/api/basicsModules/index";
  264. import { getToken } from "@/utils/auth";
  265. //V3
  266. import { systemUserProfile,systemUserEditPasswd,systemUserEditUser } from "@/api/commonality/permission";
  267. import md5 from 'js-md5';
  268. export default {
  269. name: "mine",
  270. components: {
  271. userAvatar,
  272. },
  273. data(){
  274. const equalToPassword = (rule, value, callback) => {
  275. if (this.form.confirmPassword !== value) {
  276. callback(new Error("两次输入的密码不一致"));
  277. } else {
  278. callback();
  279. }
  280. };
  281. const equalToPasswordTwo = (rule, value, callback) => {
  282. if (this.form.password !== value) {
  283. callback(new Error("两次输入的密码不一致"));
  284. } else {
  285. callback();
  286. }
  287. };
  288. const validatePass = (rule, value, callback) => {
  289. let reg = /^(?=.*[0-9\!@#\$%\^&\*])(?=.*[a-zA-Z]).{8,16}$/
  290. // let reg = /^(?![A-z0-9]+$)(?=.[^%&',;=?$\x22])(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{8,16}$/
  291. if(reg.test(value)){
  292. const reg2 = /(\w)*(\w)\2{2}(\w)*/g
  293. if (reg2.test(value)) {
  294. return callback(new Error('请输入8-16位密码,不能输入纯数字或重复性的密码'));
  295. }else{
  296. callback()
  297. }
  298. }else{
  299. return callback(new Error('请输入8-16位密码,不能输入纯数字或重复性的密码'));
  300. }
  301. };
  302. // 不能连续字符(如123、abc)连续3位或3位以上
  303. const LxStr = (rule, value, callback) => {
  304. const regex = /([a-zA-Z])\1{2}/;
  305. const regex2 = /(\d)\1{2}/;
  306. const result = value.match(regex);
  307. const result2 = value.match(regex2);
  308. let arr = value.split('')
  309. let flag = true
  310. for (let i = 1; i < arr.length - 1; i++) {
  311. let firstIndex = arr[i - 1].charCodeAt()
  312. let secondIndex = arr[i].charCodeAt()
  313. let thirdIndex = arr[i + 1].charCodeAt()
  314. thirdIndex - secondIndex == 1
  315. secondIndex - firstIndex == 1
  316. if ((thirdIndex - secondIndex == 1) && (secondIndex - firstIndex == 1)) {
  317. flag = false
  318. }
  319. }
  320. if (result||result2||!flag) {
  321. return callback(new Error('不能输入如:123,abc,111,aaa等形式的连续型字符'));
  322. }else{
  323. callback()
  324. }
  325. }
  326. return{
  327. buttonType:'1',
  328. uploadImgUrl: window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/system/user/face/addOrUpdate", // 上传的图片服务器地址
  329. uploadImgUrlTwo: window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + "/file/upload", // 上传的图片服务器地址
  330. headers: {
  331. Authorization: getToken(),
  332. },
  333. upImportData:{
  334. userId:localStorage.getItem('userId'),
  335. },
  336. pageType:false,
  337. user: {
  338. userId:"",
  339. },
  340. roleGroup: {},
  341. postGroup: {},
  342. activeTab: "resetPwd",
  343. form:{
  344. oldPassword:"",
  345. password:"",
  346. confirmPassword:""
  347. },
  348. userform:{},
  349. userformData:{},
  350. open:false,
  351. phoneForm:{
  352. phone:"",
  353. },
  354. // 表单校验
  355. rules: {
  356. oldPassword: [
  357. { required: true, message: "旧密码不能为空", trigger: "blur" },
  358. ],
  359. password: [
  360. { required: true, message: "新密码不能为空", trigger: "blur" },
  361. { required: true, message: "用户密码不能为空", validator: this.spaceJudgment, trigger: "blur" },
  362. { required: true, validator: equalToPassword, trigger: "blur" },
  363. { required: true, message: "不能输入如:123,abc,111,aaa等形式的连续型字符", validator: LxStr, trigger: "blur" },
  364. {
  365. pattern: /^(?=(?:.*[A-Z]){1})(?=(?:.*[a-z]){1})(?=(?:.*[0-9]){1})(?=(?:.*[!@#*?&]){1})(?!(.)\1)(.{10,16})$/,
  366. message: '密码长度最少10位 最多16位,必须同时包含一个大写字母、一个小写字母、一个数字和一个特殊字符!@#*?&',
  367. trigger: 'blur'
  368. }
  369. ],
  370. confirmPassword: [
  371. { required: true, message: "确认密码不能为空", trigger: "blur" },
  372. { required: true, message: "用户密码不能为空", validator: this.spaceJudgment, trigger: "blur" },
  373. { required: true, validator: equalToPasswordTwo, trigger: "blur" },
  374. { required: true, message: "不能输入如:123,abc,111,aaa等形式的连续型字符", validator: LxStr, trigger: "blur" },
  375. {
  376. pattern: /^(?=(?:.*[A-Z]){1})(?=(?:.*[a-z]){1})(?=(?:.*[0-9]){1})(?=(?:.*[!@#*?&]){1})(?!(.)\1)(.{10,16})$/,
  377. message: '密码长度最少10位 最多16位,必须同时包含一个大写字母、一个小写字母、一个数字和一个特殊字符!@#*?&',
  378. trigger: 'blur'
  379. }
  380. ],
  381. mobile: [
  382. { required: true, message: "请输入11位手机号码", trigger: "blur" },
  383. { validator: this.checkPhone, trigger: 'blur' },
  384. // { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" },
  385. { required: true, message: "请输入11位手机号码", validator: this.spaceJudgment, trigger: "blur" }
  386. ],
  387. // phone: [
  388. // { required: true, message: "请输入手机号码", trigger: "blur" },
  389. // { required: true, message: "请输入手机号码", validator: this.spaceJudgment, trigger: "blur" }
  390. // ],
  391. // email: [
  392. // { required: true, message: "请输入邮箱地址", trigger: "blur" },
  393. // { required: true, message: "请输入正确的邮箱地址", type: 'email'},
  394. // { required: true, message: "请输入邮箱地址", validator: this.spaceJudgment, trigger: "blur" }
  395. // ],
  396. // birthday: [
  397. // { required: true, message: "请选择出生日期", trigger: "blur" }
  398. // ],
  399. },
  400. //上传签名开关
  401. upImgOpen:false,
  402. option:{
  403. img: '', // 裁剪图片的地址
  404. outputSize: 1, //裁剪生成图片的质量(可选0.1 - 1)
  405. outputType: 'png', //裁剪生成图片的格式(jpeg || png || webp)
  406. info: true, //图片大小信息
  407. canScale: true, //图片是否允许滚轮缩放
  408. autoCrop: true, //是否默认生成截图框
  409. autoCropWidth: 240, //默认生成截图框宽度
  410. autoCropHeight: 80, //默认生成截图框高度
  411. fixed: true, //是否开启截图框宽高固定比例
  412. fixedNumber: [3, 1], //截图框的宽高比例
  413. full: false, //false按原比例裁切图片,不失真
  414. fixedBox: true, //固定截图框大小,不允许改变
  415. canMove: false, //上传图片是否可以移动
  416. canMoveBox: true, //截图框能否拖动
  417. original: false, //上传图片按照原始比例渲染
  418. centerBox: false, //截图框是否被限制在图片里面
  419. height: true, //是否按照设备的dpr 输出等比例图片
  420. infoTrue: false, //true为展示真实输出图片宽高,false展示看到的截图框宽高
  421. maxImgSize: 3000, //限制图片最大宽度和高度
  422. enlarge: 1, //图片根据截图框输出比例倍数
  423. mode: '560px 400px' //图片默认渲染方式
  424. },
  425. previews:{},
  426. //上传人脸
  427. upFaceOpen:false,
  428. upFaceUrl:"",
  429. //临时签名数据
  430. signatureData:"",
  431. Quantity:0,//指纹录取数量
  432. }
  433. },
  434. created() {
  435. this.getUser();
  436. // this.fingerprintQuantityFun();
  437. },
  438. methods: {
  439. //修改用户信息
  440. upDataProfile(){
  441. this.$refs["userform"].validate(valid => {
  442. if (valid) {
  443. if(!this.userform.mobile&&!this.userform.email&&!this.userform.birthday){
  444. this.msgError('联系方式/邮箱/出生年月,请至少填写一项进行修改')
  445. return
  446. }
  447. if((this.userform.mobile == this.userformData.mobile)&&
  448. (this.userform.email == this.userformData.email)&&
  449. (this.userform.birthday == this.userformData.birthday)){
  450. this.msgError('联系方式/邮箱/出生年月,请至少修改一项再进行保存操作')
  451. return
  452. }
  453. // let obj = JSON.parse(JSON.stringify(this.userform));
  454. let obj = {
  455. userId : this.user.userId,
  456. userType : this.user.userType,
  457. };
  458. obj.mobile = this.userform.mobile;
  459. if(this.userform.email){
  460. let regex = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
  461. if(!regex.test(this.userform.email)){
  462. this.msgError('请输入正确的邮箱地址')
  463. return
  464. }else{
  465. obj.email = this.userform.email;
  466. }
  467. }else {
  468. obj.email = '';
  469. }
  470. if(this.userform.birthday){
  471. obj.birthday = this.userform.birthday;
  472. }else{
  473. obj.birthday = '';
  474. }
  475. systemUserEditUser(obj).then(response => {
  476. this.msgSuccess('操作成功');
  477. this.getUser();
  478. });
  479. }
  480. })
  481. },
  482. //手机号验证
  483. checkPhone(rule, value, callback) {
  484. if (!value) {
  485. return callback(new Error('手机号码不能为空'))
  486. } else {
  487. if(value == '19999999999'){
  488. return callback(new Error('请输入正确的手机号码'))
  489. }
  490. const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
  491. if (reg.test(value)) {
  492. callback()
  493. } else {
  494. return callback(new Error('请输入正确的手机号码'))
  495. }
  496. }
  497. },
  498. //修改按钮密码
  499. submit() {
  500. let self = this;
  501. self.$refs["form"].validate(valid => {
  502. if (valid) {
  503. this.$confirm('确定要修改吗', "警告", {
  504. confirmButtonText: "确定",
  505. cancelButtonText: "取消",
  506. type: "warning"
  507. }).then(function() {
  508. self.systemUserEditPasswd();
  509. }).then(() => {
  510. }).catch(() => {});
  511. }
  512. });
  513. },
  514. //指纹-查询用户指纹录取数量
  515. fingerprintQuantityFun(){
  516. let _this=this;
  517. fingerprintQuantity(localStorage.getItem('userId')).then(response => {
  518. if(response.code == 200){
  519. _this.Quantity=response.data;
  520. }
  521. }
  522. );
  523. },
  524. //修改密码接口
  525. systemUserEditPasswd(){
  526. let obj = {
  527. userId:this.user.userId,
  528. oldPassword:md5(this.form.oldPassword),
  529. password:md5(this.form.password)
  530. }
  531. systemUserEditPasswd(obj).then(
  532. response => {
  533. this.form.oldPassword = "";
  534. this.form.password = "";
  535. this.form.confirmPassword = "";
  536. this.msgSuccess("修改成功");
  537. }
  538. );
  539. },
  540. //返回按钮
  541. outButton(){
  542. this.$router.go(-1)
  543. },
  544. //页面按钮点击
  545. buttonTypeClick(type){
  546. if(this.buttonType != type){
  547. if(type == 1){
  548. this.buttonType = type;
  549. }else {
  550. if (this.user.source == 1){
  551. this.buttonType = type;
  552. } else {
  553. // 系统对接用户 跳转至统一认证平台
  554. }
  555. }
  556. }
  557. },
  558. //获取信息
  559. getUser() {
  560. // getUserProfile().then(response => {
  561. systemUserProfile().then(response => {
  562. this.user = JSON.parse(JSON.stringify(response.data));
  563. this.roleGroup = response.roleGroup;
  564. this.postGroup = response.postGroup;
  565. let obj = {
  566. mobile:response.data.mobile,
  567. email:response.data.email,
  568. birthday:response.data.birthday,
  569. }
  570. this.$set(this,'userform',JSON.parse(JSON.stringify(obj)));
  571. this.$set(this,'userformData',JSON.parse(JSON.stringify(obj)));
  572. this.pageType = true;
  573. });
  574. },
  575. //上传签名
  576. upSignatureData(){
  577. if(!this.signatureData){
  578. this.msgError('请先选择签名上传并保存查看')
  579. }
  580. var blob = this.dataURLtoBlob(this.signatureData);
  581. var file = this.blobToFile(blob, 'dx.jpg');
  582. let formData = new FormData();
  583. formData.append('file',file,"DX.jpg")
  584. updateSignature(formData).then(response => {
  585. if(response.code == 200){
  586. this.msgSuccess("操作成功");
  587. this.upImgOpen = false;
  588. this.getUser();
  589. }
  590. });
  591. },
  592. //照片页面开关
  593. upFaceOpenClick(type){
  594. if(type == 1){
  595. this.upFaceOpen = false;
  596. }else if (type == 2){
  597. this.upFaceUrl = this.user.faceImg;
  598. this.upFaceOpen = true;
  599. }
  600. },
  601. //签名页面开关
  602. upImgOpenClick(type){
  603. if(type == 1){
  604. this.upImgOpen = false;
  605. }else if (type == 2){
  606. this.option.img = this.user.signature;
  607. this.signatureData = this.user.signature;
  608. this.upImgOpen = true;
  609. }
  610. },
  611. //确定签名
  612. upImgButton(){
  613. let self = this;
  614. this.$refs.cropper.getCropBlob(async (data) => {
  615. let formData = new FormData();
  616. formData.append('file',data,"DX.jpg")
  617. genSign(formData).then(response => {
  618. if(response.code == 200){
  619. this.signatureData = 'data:image/png;base64,'+response.data;
  620. } else {
  621. this.msgError(response.message)
  622. }
  623. });
  624. })
  625. },
  626. //照片选择
  627. faceChange(val){
  628. const windowURL = window.URL || window.webkitURL;
  629. this.upFaceUrl = windowURL.createObjectURL(val.raw)
  630. },
  631. //签名选择
  632. signatureChange(val){
  633. const windowURL = window.URL || window.webkitURL;
  634. this.option.img = windowURL.createObjectURL(val.raw)
  635. this.signatureData = "";
  636. this.upImgOpen = true;
  637. },
  638. // 照片上传按钮
  639. faceButton(type){
  640. if(type==1){
  641. this.upFaceOpen = false;
  642. }else if(type == 2){
  643. this.$refs.faceUpLoad.submit();
  644. }
  645. },
  646. //上传
  647. handleAvatarSuccess(res, type) {
  648. if(res.code == 200){
  649. // this.user.faceImg = res.data.cardUrl;
  650. this.upFaceOpen = false;
  651. this.getUser();
  652. this.msgSuccess(res.message)
  653. this.$forceUpdate()
  654. }else{
  655. this.msgError(res.message)
  656. }
  657. },
  658. beforeAvatarUpload(file) {
  659. let type = false;
  660. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/jpg' || file.type == 'image/gif') {
  661. type = true;
  662. }else{
  663. this.msgError('只能上传png/jpeg/jpg/gif格式图片')
  664. type = false;
  665. }
  666. return type;
  667. },
  668. // 实时预览函数
  669. realTime(data) {
  670. this.previews = data;
  671. },
  672. //图片加载的回调 imgLoad 返回结果success, error
  673. imgLoad (msg) {
  674. },
  675. //将base64转换为blob
  676. dataURLtoBlob: function(dataurl) {
  677. var arr = dataurl.split(',')
  678. var mime = arr[0].match(/:(.*?);/)[1]
  679. var bstr = atob(arr[1])
  680. var n = bstr.length
  681. var u8arr = new Uint8Array(n)
  682. while (n--) {
  683. u8arr[n] = bstr.charCodeAt(n);
  684. }
  685. return new Blob([u8arr], { type: mime });
  686. },
  687. //将blob转换为file
  688. blobToFile: function(theBlob, fileName){
  689. theBlob.lastModifiedDate = new Date();
  690. theBlob.name = fileName;
  691. return theBlob;
  692. },
  693. }
  694. }
  695. </script>
  696. <style scoped lang="scss">
  697. .mine{
  698. height:100%;
  699. width:100%;
  700. display: flex;
  701. flex-direction: column;
  702. overflow: hidden;
  703. *{
  704. margin:0;
  705. }
  706. .mine-page{
  707. flex:1;
  708. display: flex;
  709. overflow: hidden;
  710. .left-max-box{
  711. width:300px;
  712. /*margin:20px;*/
  713. margin:5px 20px 20px 10px;
  714. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  715. border-radius:10px;
  716. .left-title{
  717. font-size:18px;
  718. text-align: center;
  719. line-height: 30px;
  720. margin-top:30px;
  721. color:#0045af;
  722. }
  723. .left-user-img{
  724. width:130px;
  725. height:130px;
  726. overflow: hidden;
  727. border-radius:50%;
  728. margin:30px auto 20px;
  729. }
  730. .left-name{
  731. font-size:20px;
  732. line-height:43px;
  733. text-align: center;
  734. }
  735. .left-num{
  736. font-size:16px;
  737. line-height:38px;
  738. text-align: center;
  739. }
  740. .left-text-max-box{
  741. border-top:1px dashed #dedede;
  742. border-bottom:1px dashed #dedede;
  743. margin:24px 10px 0;
  744. padding:20px 0;
  745. .left-text-big-box{
  746. display: flex;
  747. .left-text-big-box-left{
  748. width:100px;
  749. height:38px;
  750. display: flex;
  751. margin-right:10px;
  752. img{
  753. width:16px;
  754. height:16px;
  755. margin:11px 10px 0;
  756. }
  757. p{
  758. flex:1;
  759. font-size:14px;
  760. line-height:38px;
  761. display:block;
  762. overflow:hidden;
  763. text-overflow:ellipsis;
  764. white-space:nowrap;
  765. }
  766. }
  767. .left-text-big-box-right{
  768. height:38px;
  769. flex:1;
  770. display: flex;
  771. .img-one{
  772. width:16px;
  773. height:14px;
  774. margin:12px 10px 0;
  775. }
  776. .img-two{
  777. width:16px;
  778. height:16px;
  779. margin:11px 10px 0;
  780. }
  781. p{
  782. flex:1;
  783. font-size:14px;
  784. line-height:38px;
  785. display:block;
  786. overflow:hidden;
  787. text-overflow:ellipsis;
  788. white-space:nowrap;
  789. }
  790. }
  791. }
  792. .left-text-min-box{
  793. display: flex;
  794. height:38px;
  795. img{
  796. width:16px;
  797. height:16px;
  798. margin:11px 10px 0;
  799. }
  800. p{
  801. flex:1;
  802. font-size:14px;
  803. line-height:38px;
  804. }
  805. }
  806. }
  807. .left-type-text-max-box{
  808. padding:20px 0;
  809. div{
  810. display: flex;
  811. p{
  812. flex:1;
  813. font-size:14px;
  814. color:#333;
  815. line-height:40px;
  816. }
  817. p:nth-child(1){
  818. text-align: left;
  819. margin-left:32px;
  820. }
  821. p:nth-child(2){
  822. text-align: right;
  823. margin-right:48px;
  824. }
  825. .p-color-a{
  826. color:#06B924;
  827. }
  828. .p-color-b{
  829. color:#FF9735;
  830. }
  831. }
  832. }
  833. }
  834. .right-max-box{
  835. flex:1;
  836. /*margin:20px 20px 20px 0;*/
  837. margin:5px 20px 20px 0;
  838. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  839. border-radius:10px;
  840. display: flex;
  841. flex-direction: column;
  842. .right-title-box{
  843. display: flex;
  844. border-bottom:1px solid #dedede;
  845. .title-button-min-box{
  846. height:90px;
  847. margin:0 20px;
  848. cursor: pointer;
  849. p:nth-child(1){
  850. margin-top:6px;
  851. line-height:78px;
  852. font-size:16px;
  853. }
  854. p:nth-child(2){
  855. height:6px;
  856. border-radius:4px;
  857. }
  858. .bottomColor{
  859. color:#0045AF;
  860. }
  861. .bottomBack{
  862. background:#0045AF ;
  863. }
  864. }
  865. .right-null-p{
  866. flex:1;
  867. }
  868. .right-out-button{
  869. margin:20px;
  870. }
  871. }
  872. .type-one-max-box{
  873. width:100px;
  874. margin:40px auto;
  875. }
  876. .up-data-box{
  877. display: inline-block;
  878. width:280px;
  879. line-height:20px;
  880. margin-bottom:30px;
  881. .up-data-min-box{
  882. .up-data-title{
  883. font-size:15px;
  884. color:#333;
  885. }
  886. .up-data-button{
  887. width:120px;
  888. height:120px;
  889. border: 1px dashed #E0E0E0;
  890. cursor: pointer;
  891. p{
  892. text-align: center;
  893. color:#999;
  894. font-weight:500;
  895. }
  896. p:nth-child(1){
  897. font-size: 20px;
  898. line-height:40px;
  899. margin-top:20px;
  900. }
  901. p:nth-child(2){
  902. font-size: 16px;
  903. }
  904. }
  905. .img-one{
  906. width:120px;
  907. height:120px;
  908. }
  909. .img-two{
  910. width: 240px;
  911. height:80px;
  912. }
  913. }
  914. }
  915. .fingerprint_no{
  916. >p:nth-of-type(1){
  917. color: #666666;
  918. }
  919. >p:nth-of-type(2){
  920. color: #F56C6C;
  921. }
  922. }
  923. .fingerprint_yes{
  924. .fingerprint_yes_img{
  925. width: 122px;
  926. height: 142px;
  927. position: relative;
  928. >img:nth-of-type(1){
  929. width: 122px;
  930. height: 142px;
  931. position: absolute;
  932. }
  933. >img:nth-of-type(2){
  934. width: 65px;
  935. height: 88px;
  936. position: absolute;
  937. left: 29px;
  938. top: 29px;
  939. }
  940. }
  941. >p{
  942. color: #666;
  943. text-align: center;
  944. }
  945. }
  946. .form-item-min{
  947. margin-top:40px;
  948. }
  949. }
  950. }
  951. }
  952. </style>
  953. <style lang="scss">
  954. .up-img-box{
  955. .el-dialog__body{
  956. padding-top:0;
  957. }
  958. .img-one{
  959. width:560px;
  960. height:150px;
  961. }
  962. .cropper-img{
  963. display: block;
  964. border:1px solid #e0e0e0;
  965. width:360px;
  966. height:120px;
  967. margin:0 auto;
  968. }
  969. .cropper-box{
  970. width:560px;
  971. height:270px;
  972. position: relative;
  973. .cropper-button{
  974. position: absolute;
  975. right:10px;top:10px;
  976. z-index:1;
  977. background: #0183FA;
  978. color:#fff;
  979. cursor: pointer;
  980. padding:5px 10px;
  981. margin:0;
  982. border-radius:6px;
  983. }
  984. }
  985. }
  986. .mine{
  987. .mine-page{
  988. .input-number-none-box{
  989. input{
  990. text-align: left;
  991. }
  992. }
  993. }
  994. }
  995. </style>