index.vue 31 KB

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