index.vue 31 KB

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