index.vue 31 KB

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