mine.vue 32 KB

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