Setting.vue 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262
  1. <template>
  2. <div class="setting personal-setting" v-loading="loading" v-if="personalInfo">
  3. <template v-if="!settingFlag">
  4. <div class="setting-top">
  5. <div class="avator-box">
  6. <el-image
  7. :src="
  8. personalInfo.image_url
  9. ? personalInfo.image_url
  10. : require('../../../assets/avatar.png')
  11. "
  12. fit="cover"
  13. style="width: 96px; height: 96px"
  14. >
  15. </el-image>
  16. <a class="img-crop">
  17. <upload
  18. :datafileList="infoForm.cover_image_list"
  19. :filleNumber="99"
  20. :changeFillId="handleAvatarSuccess"
  21. :fileName="'cover'"
  22. :showList="true"
  23. uploadType="image"
  24. />
  25. </a>
  26. </div>
  27. <div class="center">
  28. <div class="info-items" style="width: 400px">
  29. <label>用户名:</label>
  30. <span>{{ personalInfo.user_name }}</span>
  31. </div>
  32. <div class="info-items">
  33. <label>手机号码:</label>
  34. <span>{{
  35. personalInfo.phone
  36. ? personalInfo.phone.substring(0, 3) +
  37. "******" +
  38. personalInfo.phone.substring(9, 11)
  39. : "-"
  40. }}</span>
  41. </div>
  42. <div class="info-items" style="width: 400px">
  43. <label>账号ID:</label>
  44. <span>{{ personalInfo.id }}</span>
  45. </div>
  46. <div class="info-items">
  47. <label>邮箱:</label>
  48. <span>{{ personalInfo.email ? personalInfo.email : "-" }}</span>
  49. </div>
  50. <div class="info-items" style="width: 400px">
  51. <label>注册时间:</label>
  52. <span>{{ personalInfo.register_time }}</span>
  53. </div>
  54. <div class="info-items">
  55. <label>机构:</label>
  56. <span>{{ personalInfo.org_name }}</span>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="setting-bottom">
  61. <div class="tabs-box">
  62. <a
  63. :class="[tabsIndex === 0 ? 'active' : '']"
  64. @click="handleChangeTabs(0)"
  65. >基本信息</a
  66. >
  67. <a
  68. :class="[tabsIndex === 1 ? 'active' : '']"
  69. @click="handleChangeTabs(1)"
  70. >安全设置</a
  71. >
  72. </div>
  73. <template v-if="tabsIndex === 0">
  74. <el-form
  75. :model="infoForm"
  76. :rules="rules"
  77. ref="ruleForm"
  78. label-width="150px"
  79. class="setting-form"
  80. >
  81. <el-form-item label="用户名" prop="name">
  82. <el-input
  83. v-model="infoForm.name"
  84. placeholder="请输入用户名"
  85. maxlength="20"
  86. ></el-input>
  87. </el-form-item>
  88. <el-form-item label="真实姓名" prop="realName">
  89. <el-input
  90. v-model="infoForm.realName"
  91. placeholder="请输入真实姓名"
  92. maxlength="20"
  93. @blur="handleTrim('infoForm', 'realName')"
  94. ></el-input>
  95. </el-form-item>
  96. <el-form-item label="性别" prop="sex">
  97. <el-radio-group v-model="infoForm.sex">
  98. <el-radio :label="1">男</el-radio>
  99. <el-radio :label="0">女</el-radio>
  100. </el-radio-group>
  101. </el-form-item>
  102. <el-form-item label="所在省市" prop="selectedOptions">
  103. <el-cascader
  104. size="medium"
  105. :options="$provinceCityList"
  106. v-model="infoForm.selectedOptions"
  107. @change="handleCity"
  108. >
  109. </el-cascader>
  110. </el-form-item>
  111. <el-form-item label="备注" prop="desc">
  112. <el-input
  113. type="textarea"
  114. v-model="infoForm.desc"
  115. placeholder="请输入备注"
  116. maxlength="100"
  117. :rows="4"
  118. show-word-limit
  119. @blur="handleTrim('infoForm', 'desc')"
  120. ></el-input>
  121. </el-form-item>
  122. <el-form-item label="我的机构" prop="region">
  123. <el-select
  124. v-model="infoForm.region"
  125. placeholder="请选择机构"
  126. :disabled="personalInfo.is_manager === 'true'"
  127. >
  128. <el-option
  129. v-for="item in orgList"
  130. :key="item.id"
  131. :label="item.name"
  132. :value="item.id"
  133. >
  134. </el-option>
  135. </el-select>
  136. <!-- -->
  137. <el-tag
  138. class="audit-status"
  139. v-if="personalInfo.audit_status === 0"
  140. >
  141. <svg-icon icon-class="information-fill"></svg-icon>审核中
  142. </el-tag>
  143. <el-tag
  144. class="audit-status audit-refused"
  145. v-if="personalInfo.audit_status === 2"
  146. >
  147. <i class="el-icon-error"></i>已拒绝
  148. </el-tag>
  149. <!-- <el-button v-if="regionFlag" type="primary" size="small" class="btn" @click="regionFlag=!regionFlag">申请变更</el-button>
  150. <template v-else>
  151. <el-button type="primary" @click="handleChangeOrg" size="small" class="btn">提交</el-button>
  152. <el-button @click="handleorgCancel" size="small">取消</el-button>
  153. </template> -->
  154. </el-form-item>
  155. <el-form-item>
  156. <el-button
  157. type="primary"
  158. @click="onSubmit('ruleForm')"
  159. size="small"
  160. :loading="submitLoading"
  161. >保存</el-button
  162. >
  163. <el-button @click="onCancel('ruleForm')" size="small"
  164. >取消</el-button
  165. >
  166. </el-form-item>
  167. </el-form>
  168. </template>
  169. <template v-if="tabsIndex === 1">
  170. <div class="safe-items">
  171. <label>登录密码</label>
  172. <div class="safe-items-right">
  173. <p class="hasContent">
  174. 已设置。密码至少6位字符,支持数字和字母,且必须同时包含数字和大小写字母。
  175. </p>
  176. <a @click="handleSetting('passwordFlag')">{{
  177. personalInfo.password ? "修改" : "设置"
  178. }}</a>
  179. </div>
  180. </div>
  181. <div class="safe-items">
  182. <label>绑定手机</label>
  183. <div class="safe-items-right">
  184. <p v-if="personalInfo.phone" class="hasContent">
  185. 已绑定:
  186. {{
  187. personalInfo.phone.substring(0, 3) +
  188. "******" +
  189. personalInfo.phone.substring(9, 11)
  190. }}
  191. </p>
  192. <p v-else class="noContent">
  193. 您暂未绑定手机,绑定手机可以有效的保护账号的安全。
  194. </p>
  195. <a @click="handleSetting('phoneFlag')">{{
  196. personalInfo.phone ? "修改" : "设置"
  197. }}</a>
  198. </div>
  199. </div>
  200. <div class="safe-items">
  201. <label>绑定邮箱</label>
  202. <div class="safe-items-right">
  203. <p v-if="personalInfo.email" class="hasContent">
  204. 已绑定: {{ personalInfo.email }}
  205. </p>
  206. <p v-else class="noContent">
  207. 您暂未设置邮箱,绑定邮箱可以用来找回密码、接收通知等。
  208. </p>
  209. <a @click="handleSetting('emailFlag')">{{
  210. personalInfo.email ? "修改" : "设置"
  211. }}</a>
  212. </div>
  213. </div>
  214. </template>
  215. </div>
  216. </template>
  217. <div class="setting-iframe" v-if="settingFlag && passwordFlag">
  218. <p class="title">
  219. <i
  220. class="el-icon-arrow-left"
  221. @click="handleSetting('passwordFlag')"
  222. ></i>
  223. 登录密码
  224. </p>
  225. <el-form
  226. :model="passwordForm"
  227. :rules="rulesPassword"
  228. ref="passwordForm"
  229. label-width="100px"
  230. class="passwordForm"
  231. >
  232. <el-form-item label="原始密码" prop="oldPwd">
  233. <el-input
  234. v-model="passwordForm.oldPwd"
  235. :type="oldPwdFlag ? 'text' : 'password'"
  236. autocomplete="off"
  237. placeholder="请输入密码"
  238. maxlength="20"
  239. @blur="handleTrim('passwordForm', 'oldPwd')"
  240. >
  241. <i
  242. slot="suffix"
  243. class="el-icon-view show-icon"
  244. @click="changeIcon('oldPwdFlag')"
  245. v-if="oldPwdFlag"
  246. ></i>
  247. <i
  248. slot="suffix"
  249. class="show-icon"
  250. @click="changeIcon('oldPwdFlag')"
  251. v-else
  252. >
  253. <svg-icon icon-class="eye-invisible"></svg-icon>
  254. </i>
  255. </el-input>
  256. </el-form-item>
  257. <el-form-item label="修改密码" prop="newPwd">
  258. <el-input
  259. v-model="passwordForm.newPwd"
  260. :type="newPwdFlag ? 'text' : 'password'"
  261. autocomplete="off"
  262. placeholder="请输入密码"
  263. maxlength="20"
  264. @blur="handleTrim('passwordForm', 'newPwd')"
  265. >
  266. <i
  267. slot="suffix"
  268. class="el-icon-view show-icon"
  269. @click="changeIcon('newPwdFlag')"
  270. v-if="newPwdFlag"
  271. ></i>
  272. <i
  273. slot="suffix"
  274. class="show-icon"
  275. @click="changeIcon('newPwdFlag')"
  276. v-else
  277. >
  278. <svg-icon icon-class="eye-invisible"></svg-icon>
  279. </i>
  280. </el-input>
  281. </el-form-item>
  282. <el-form-item label="再次输入" prop="confirmPwd">
  283. <el-input
  284. v-model="passwordForm.confirmPwd"
  285. :type="comfirmPwdFlag ? 'text' : 'password'"
  286. autocomplete="off"
  287. placeholder="请输入密码"
  288. maxlength="20"
  289. @blur="handleTrim('passwordForm', 'confirmPwd')"
  290. >
  291. <i
  292. slot="suffix"
  293. class="el-icon-view show-icon"
  294. @click="changeIcon('comfirmPwdFlag')"
  295. v-if="comfirmPwdFlag"
  296. ></i>
  297. <i
  298. slot="suffix"
  299. class="show-icon"
  300. @click="changeIcon('comfirmPwdFlag')"
  301. v-else
  302. >
  303. <svg-icon icon-class="eye-invisible"></svg-icon>
  304. </i>
  305. </el-input>
  306. </el-form-item>
  307. <el-form-item>
  308. <el-button
  309. type="primary"
  310. @click="onSubmitPassword('passwordForm')"
  311. size="small"
  312. :loading="passwordLoading"
  313. >保存</el-button
  314. >
  315. <el-button @click="onCancel('passwordForm')" size="small"
  316. >取消</el-button
  317. >
  318. </el-form-item>
  319. </el-form>
  320. </div>
  321. <div class="setting-iframe" v-if="settingFlag && phoneFlag">
  322. <p class="title">
  323. <i class="el-icon-arrow-left" @click="handleSetting('phoneFlag')"></i>
  324. 绑定手机
  325. </p>
  326. <el-form
  327. :model="phoneForm"
  328. :rules="rulesPhone"
  329. ref="phoneForm"
  330. label-width="100px"
  331. class="phoneForm"
  332. >
  333. <el-form-item label="新手机号" prop="newPhone">
  334. <el-input
  335. v-model="phoneForm.newPhone"
  336. autocomplete="off"
  337. placeholder="请输入完整手机号"
  338. maxlength="20"
  339. @blur="handleTrim('phoneForm', 'newPhone')"
  340. >
  341. <!-- <template slot="prepend">+86</template> -->
  342. </el-input>
  343. </el-form-item>
  344. <el-form-item label="验证码" prop="newCode" class="code-box">
  345. <el-input
  346. v-model="phoneForm.newCode"
  347. autocomplete="off"
  348. placeholder="请输入验证码"
  349. class="code-input"
  350. maxlength="20"
  351. @blur="handleTrim('phoneForm', 'newCode')"
  352. >
  353. </el-input>
  354. <el-button
  355. type="primary"
  356. @click="sendCode('times', 'newPhone', 'verificationCodesShow')"
  357. size="small"
  358. class="sendCode"
  359. >
  360. {{ verificationCodesShow ? times + "s" : "发送验证码" }}
  361. </el-button>
  362. </el-form-item>
  363. <el-form-item>
  364. <el-button
  365. type="primary"
  366. @click="onSubmitPhone('phoneForm')"
  367. size="small"
  368. :loading="passwordLoading"
  369. >保存</el-button
  370. >
  371. <el-button @click="onCancel('phoneForm')" size="small"
  372. >取消</el-button
  373. >
  374. </el-form-item>
  375. </el-form>
  376. </div>
  377. <div class="setting-iframe" v-if="settingFlag && emailFlag">
  378. <p class="title">
  379. <i class="el-icon-arrow-left" @click="handleSetting('emailFlag')"></i>
  380. 绑定邮箱
  381. </p>
  382. <el-form
  383. :model="emailForm"
  384. :rules="rulesEmail"
  385. ref="emailForm"
  386. label-width="100px"
  387. class="emailForm"
  388. >
  389. <el-form-item label="绑定邮箱" prop="email">
  390. <el-input
  391. v-model="emailForm.email"
  392. autocomplete="off"
  393. placeholder="请输入邮箱地址"
  394. maxlength="100"
  395. @blur="handleTrim('emailForm', 'email')"
  396. >
  397. </el-input>
  398. </el-form-item>
  399. <el-form-item label="验证码" prop="code" class="code-box">
  400. <el-input
  401. v-model="emailForm.code"
  402. autocomplete="off"
  403. placeholder="请输入验证码"
  404. class="code-input"
  405. maxlength="20"
  406. @blur="handleTrim('emailForm', 'code')"
  407. >
  408. </el-input>
  409. <el-button
  410. type="primary"
  411. @click="
  412. sendCode('timee', 'email', 'verificationCodeeShow', 'email')
  413. "
  414. size="small"
  415. class="sendCode"
  416. >
  417. {{ verificationCodeeShow ? timee + "s" : "发送验证码" }}
  418. </el-button>
  419. </el-form-item>
  420. <el-form-item>
  421. <el-button
  422. type="primary"
  423. @click="onSubmitEmail('emailForm')"
  424. size="small"
  425. :loading="passwordLoading"
  426. >保存</el-button
  427. >
  428. <el-button @click="onCancel('emailForm')" size="small"
  429. >取消</el-button
  430. >
  431. </el-form-item>
  432. </el-form>
  433. </div>
  434. </div>
  435. </template>
  436. <script>
  437. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  438. //例如:import 《组件名称》from ‘《组件路径》';
  439. import { mapState } from "vuex";
  440. import { getLogin } from "@/api/ajax";
  441. import Upload from "../../../components/Upload.vue";
  442. export default {
  443. //import引入的组件需要注入到对象中才能使用
  444. components: { Upload },
  445. props: [],
  446. data() {
  447. //这里存放数据
  448. const validatePass = (rule, value, callback) => {
  449. if (value === "") {
  450. callback(new Error("请输入密码"));
  451. } else {
  452. let reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{6,16}$/;
  453. let result = reg.test(value);
  454. if (result) {
  455. callback();
  456. } else {
  457. callback(new Error("密码必须同时包含数字和大小写字母"));
  458. }
  459. }
  460. };
  461. const validatePass2 = (rule, value, callback) => {
  462. if (value === "") {
  463. callback(new Error("请再次输入密码"));
  464. } else if (value !== this.passwordForm.newPwd) {
  465. callback(new Error("两次输入密码不一致!"));
  466. } else {
  467. callback();
  468. }
  469. };
  470. const validatePhone = (rule, value, callback) => {
  471. if (value === "") {
  472. callback(new Error("请输入手机号"));
  473. } else {
  474. let reg = /^1[3-9]\d{9}$/;
  475. let regex = /^09\d{7,8}$/;
  476. let result = reg.test(value) || regex.test(value);
  477. if (result) {
  478. callback();
  479. } else {
  480. callback(new Error("请输入正确的手机号"));
  481. }
  482. }
  483. };
  484. const validateEmail = (rule, value, callback) => {
  485. if (value === "") {
  486. callback(new Error("请输入邮箱地址"));
  487. } else {
  488. let reg = /^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
  489. let result = reg.test(value);
  490. if (result) {
  491. callback();
  492. } else {
  493. callback(new Error("请输入正确的邮箱地址"));
  494. }
  495. }
  496. };
  497. return {
  498. show: false, // 编辑头像flag
  499. tabsIndex: 0,
  500. personalInfo: null,
  501. infoForm: {
  502. name: "",
  503. realName: " ",
  504. sex: 1,
  505. selectedOptions: [],
  506. desc: "",
  507. region: "",
  508. cover_image_list: [],
  509. cover_image_id: null,
  510. },
  511. rules: {
  512. name: [{ required: true, message: "请输入用户名", trigger: "blur" }],
  513. realName: [
  514. { required: true, message: "请输入真实姓名", trigger: "blur" },
  515. ],
  516. region: [{ required: true, message: "请选择机构", trigger: "change" }],
  517. selectedOptions: [
  518. {
  519. type: "array",
  520. required: true,
  521. message: "请选择所在省市",
  522. trigger: "change",
  523. },
  524. ],
  525. },
  526. regionFlag: true, // 修改机构
  527. settingFlag: false, // 修改设置
  528. passwordFlag: false, // 修改密码
  529. phoneFlag: false, // 修改手机
  530. emailFlag: false, // 修改邮箱
  531. passwordForm: {
  532. oldPwd: "", // 旧密码
  533. newPwd: "", // 新密码
  534. confirmPwd: "", // 确认密码
  535. },
  536. rulesPassword: {
  537. oldPwd: [
  538. { required: true, message: "请输入原始密码", trigger: "blur" },
  539. ],
  540. newPwd: [
  541. { required: true, validator: validatePass, trigger: "blur" },
  542. {
  543. min: 6,
  544. max: 16,
  545. message: "请输入 6-16 位密码,且必须同时包含数字和大小写字母",
  546. trigger: "change",
  547. },
  548. ],
  549. confirmPwd: [
  550. { required: true, validator: validatePass2, trigger: "blur" },
  551. ],
  552. },
  553. oldPwdFlag: false, // 查看旧密码
  554. newPwdFlag: false, // 查看新密码
  555. comfirmPwdFlag: false, // 查看确认密码
  556. phoneForm: {
  557. oldPhone: "", // 旧手机
  558. oldCode: "", // 旧手机验证码
  559. newPhone: "", // 新手机
  560. newCode: "", // 新手机验证码
  561. },
  562. rulesPhone: {
  563. oldPhone: [
  564. { required: true, validator: validatePhone, trigger: "blur" },
  565. ],
  566. oldCode: [{ required: true, message: "请输入验证码", trigger: "blur" }],
  567. newPhone: [
  568. { required: true, validator: validatePhone, trigger: "blur" },
  569. ],
  570. newCode: [{ required: true, message: "请输入验证码", trigger: "blur" }],
  571. },
  572. time: 60, //获取验证码的时间
  573. verificationCodeShow: false, //是否已经获取了验证码
  574. times: 60, //获取验证码的时间
  575. verificationCodesShow: false, //是否已经获取了验证码
  576. timee: 60, //获取验证码的时间
  577. verificationCodeeShow: false, //是否已经获取了验证码
  578. emailForm: {
  579. email: "",
  580. code: "",
  581. },
  582. rulesEmail: {
  583. email: [{ required: true, validator: validateEmail, trigger: "blur" }],
  584. code: [{ required: true, message: "请输入验证码", trigger: "blur" }],
  585. },
  586. loading: false,
  587. orgList: [],
  588. submitLoading: false,
  589. passwordLoading: false,
  590. timer: null,
  591. };
  592. },
  593. //计算属性 类似于data概念
  594. computed: {
  595. ...mapState(["$provinceCityList"]),
  596. },
  597. //监控data中数据变化
  598. watch: {},
  599. //方法集合
  600. methods: {
  601. // 编辑头像
  602. toggleShow() {
  603. this.show = !this.show;
  604. },
  605. // 切换tabs
  606. handleChangeTabs(value) {
  607. this.tabsIndex = value;
  608. },
  609. handleChangeFilters(item) {
  610. console.log(item);
  611. // if(this.filterTypeArr.indexOf(value)==-1){
  612. // this.filterTypeArr.push(value)
  613. // }else{
  614. // this.filterTypeArr.splice(this.filterTypeArr.indexOf(value),1)
  615. // }
  616. },
  617. // 查询词汇列表
  618. handleWordList() {
  619. this.filterTypeArr = [];
  620. },
  621. // 级联选择器
  622. handleCity(value) {
  623. // console.log(value)
  624. },
  625. // 提交表单
  626. onSubmit(formName) {
  627. this.$refs[formName].validate((valid) => {
  628. if (valid) {
  629. this.submitLoading = true;
  630. let MethodName = "/OrgServer/Client/PersonManager/UpdateMyBaseInfo";
  631. let data = {
  632. user_name: this.infoForm.name,
  633. real_name: this.infoForm.realName,
  634. sex: this.infoForm.sex,
  635. city_id: this.infoForm.selectedOptions[1],
  636. memo: this.infoForm.desc,
  637. org_id: this.infoForm.region,
  638. };
  639. getLogin(MethodName, data)
  640. .then((res) => {
  641. this.submitLoading = false;
  642. if (res.status === 1) {
  643. this.getInfo();
  644. this.$message({
  645. message: "修改成功",
  646. type: "success",
  647. });
  648. }
  649. })
  650. .catch((res) => {
  651. this.submitLoading = false;
  652. });
  653. } else {
  654. return false;
  655. }
  656. });
  657. },
  658. // 取消 恢复到修改前状态
  659. onCancel(formName) {
  660. this.$refs[formName].resetFields();
  661. },
  662. // 修改机构提交
  663. handleChangeOrg() {
  664. this.regionFlag = !this.regionFlag;
  665. },
  666. // 取消修改机构
  667. handleorgCancel() {
  668. this.regionFlag = !this.regionFlag;
  669. // 注意把原来的值赋回去
  670. },
  671. // 修改设置
  672. handleSetting(flag) {
  673. this.settingFlag = !this.settingFlag;
  674. this[flag] = !this[flag];
  675. },
  676. changeIcon(flag) {
  677. this[flag] = !this[flag];
  678. },
  679. // 修改密码提交表单
  680. onSubmitPassword(formName) {
  681. this.$refs[formName].validate((valid) => {
  682. if (valid) {
  683. this.passwordLoading = true;
  684. let MethodName = "/OrgServer/Client/PersonManager/UpdateMyPassword";
  685. let data = {
  686. password_old: this.passwordForm.oldPwd,
  687. password: this.passwordForm.newPwd,
  688. };
  689. getLogin(MethodName, data)
  690. .then((res) => {
  691. this.passwordLoading = false;
  692. if (res.status === 1) {
  693. this.$message({
  694. message: "修改成功",
  695. type: "success",
  696. });
  697. this.handleSetting("passwordFlag");
  698. this.passwordForm.oldPwd = "";
  699. this.passwordForm.newPwd = "";
  700. this.passwordForm.confirmPwd = "";
  701. }
  702. })
  703. .catch((res) => {
  704. this.passwordLoading = false;
  705. });
  706. } else {
  707. return false;
  708. }
  709. });
  710. },
  711. // 修改手机提交表单
  712. onSubmitPhone(formName) {
  713. this.$refs[formName].validate((valid) => {
  714. if (valid) {
  715. this.passwordLoading = true;
  716. let MethodName = "/OrgServer/Client/PersonManager/UpdateMyPhone";
  717. let data = {
  718. phone: this.phoneForm.newPhone,
  719. dynamic_verification_code: this.phoneForm.newCode,
  720. };
  721. getLogin(MethodName, data)
  722. .then((res) => {
  723. this.passwordLoading = false;
  724. if (res.status === 1) {
  725. this.$message({
  726. message: "修改成功",
  727. type: "success",
  728. });
  729. this.getInfo();
  730. this.handleSetting("phoneFlag");
  731. this.phoneForm.newPhone = "";
  732. this.phoneForm.newCode = "";
  733. }
  734. })
  735. .catch((res) => {
  736. clearInterval(this.timer);
  737. this.timer = null;
  738. this.times = 60;
  739. this.timee = 60;
  740. this.passwordLoading = false;
  741. this.verificationCodeeShow = false;
  742. this.verificationCodesShow = false;
  743. });
  744. } else {
  745. return false;
  746. }
  747. });
  748. },
  749. // 修改邮箱
  750. onSubmitEmail(formName) {
  751. this.$refs[formName].validate((valid) => {
  752. if (valid) {
  753. this.passwordLoading = true;
  754. let MethodName = "/OrgServer/Client/PersonManager/UpdateMyEmail";
  755. let data = {
  756. dynamic_verification_code: this.emailForm.code,
  757. email: this.emailForm.email,
  758. };
  759. getLogin(MethodName, data)
  760. .then((res) => {
  761. this.passwordLoading = false;
  762. if (res.status === 1) {
  763. this.$message({
  764. message: "修改成功",
  765. type: "success",
  766. });
  767. this.getInfo();
  768. this.handleSetting("emailFlag");
  769. this.emailForm.code = "";
  770. this.emailForm.email = "";
  771. }
  772. })
  773. .catch((res) => {
  774. this.passwordLoading = false;
  775. clearInterval(this.timer);
  776. this.timer = null;
  777. this.times = 60;
  778. this.timee = 60;
  779. this.verificationCodeeShow = false;
  780. this.verificationCodesShow = false;
  781. });
  782. } else {
  783. return false;
  784. }
  785. });
  786. },
  787. // 发送验证码
  788. sendCode(time, phone, flag, obj) {
  789. let this_ = this;
  790. if (this_[time] != 60) {
  791. return;
  792. }
  793. this_.timer = null;
  794. // 修改手机号
  795. if (!obj) {
  796. if (this_.phoneForm[phone]) {
  797. let reg = /^1[3-9]\d{9}$/;
  798. let regex = /^09\d{7,8}$/;
  799. let result =
  800. reg.test(this_.phoneForm[phone]) ||
  801. regex.test(this_.phoneForm[phone]);
  802. if (!result) {
  803. this_.$message.warning("请输入正确的手机号");
  804. return;
  805. }
  806. this_[flag] = true;
  807. this_.timer = setInterval(() => {
  808. this_[time]--;
  809. if (this_[time] == 0) {
  810. this_[flag] = false;
  811. clearInterval(this_.timer);
  812. this_.timer = null;
  813. this_[time] = 60;
  814. }
  815. }, 1000);
  816. let MethodName = "/OrgServer/LoginControl/SendVerificationCode";
  817. let data = {
  818. send_type: "SMS",
  819. phone_or_email: this_.phoneForm[phone],
  820. };
  821. getLogin(MethodName, data)
  822. .then((res) => {})
  823. .catch(() => {
  824. this_[flag] = false;
  825. clearInterval(this_.timer);
  826. this_.timer = null;
  827. this_[time] = 60;
  828. });
  829. } else {
  830. this_.$message.warning("请先输入手机号");
  831. }
  832. } else {
  833. // 修改邮箱
  834. if (this_.emailForm[phone]) {
  835. let reg = /^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
  836. let result = reg.test(this_.emailForm[phone]);
  837. if (!result) {
  838. this_.$message.warning("请输入正确的邮箱地址");
  839. return;
  840. }
  841. this_[flag] = true;
  842. this_.timer = setInterval(() => {
  843. this_[time]--;
  844. if (this_[time] == 0) {
  845. this_[flag] = false;
  846. clearInterval(this_.timer);
  847. this_.timer = null;
  848. this_[time] = 60;
  849. }
  850. }, 1000);
  851. let MethodName = "/OrgServer/LoginControl/SendVerificationCode";
  852. let data = {
  853. send_type: "EMAIL",
  854. phone_or_email: this_.emailForm[phone],
  855. };
  856. getLogin(MethodName, data)
  857. .then((res) => {})
  858. .catch(() => {
  859. this_[flag] = false;
  860. clearInterval(this_.timer);
  861. this_.timer = null;
  862. this_[time] = 60;
  863. });
  864. } else {
  865. this_.$message.warning("请先输入邮箱");
  866. }
  867. }
  868. },
  869. getInfo() {
  870. this.loading = true;
  871. let MethodName = "/OrgServer/Client/PersonManager/GetMyInfo";
  872. let data = {};
  873. getLogin(MethodName, data)
  874. .then((res) => {
  875. this.loading = false;
  876. if (res.status === 1) {
  877. this.personalInfo = res.person;
  878. this.infoForm = {
  879. name: this.personalInfo.user_name,
  880. realName: this.personalInfo.real_name,
  881. sex: this.personalInfo.sex,
  882. selectedOptions:
  883. this.personalInfo.province_id && this.personalInfo.city_id
  884. ? [this.personalInfo.province_id, this.personalInfo.city_id]
  885. : [],
  886. desc: this.personalInfo.memo,
  887. region: this.personalInfo.org_id,
  888. cover_image_list: [],
  889. cover_image_id: null,
  890. };
  891. this.$emit("changeTouxiang", this.personalInfo.image_url);
  892. }
  893. })
  894. .catch((res) => {
  895. this.loading = false;
  896. });
  897. },
  898. handleAvatarSuccess(fileList, name) {
  899. let MethodName = "/OrgServer/Client/PersonManager/UpdateMyImage";
  900. let data = {
  901. image_id:
  902. fileList.length > 0 &&
  903. fileList[fileList.length - 1].response &&
  904. fileList[fileList.length - 1].response.file_info_list &&
  905. fileList[fileList.length - 1].response.file_info_list[0]
  906. ? fileList[fileList.length - 1].response.file_info_list[0].file_id
  907. : "",
  908. };
  909. getLogin(MethodName, data)
  910. .then((res) => {
  911. if (res.status === 1) {
  912. this.getInfo();
  913. }
  914. })
  915. .catch((res) => {});
  916. },
  917. // 查询列表
  918. getOrgList() {
  919. let MethodName = "/OrgServer/Client/OrgManager/GetOrgIndexList";
  920. let data = {
  921. name: "",
  922. status: 1,
  923. sn: "",
  924. };
  925. getLogin(MethodName, data)
  926. .then((res) => {
  927. if (res.status === 1) {
  928. this.orgList = res.org_index_list;
  929. }
  930. })
  931. .catch(() => {
  932. this.loading = false;
  933. });
  934. },
  935. // 去掉前后空格
  936. handleTrim(form, fild) {
  937. this[form][fild] = this[form][fild].trim();
  938. },
  939. },
  940. //生命周期 - 创建完成(可以访问当前this实例)
  941. created() {
  942. this.getOrgList();
  943. this.getInfo();
  944. },
  945. //生命周期 - 挂载完成(可以访问DOM元素)
  946. mounted() {},
  947. //生命周期-创建之前
  948. beforeCreated() {},
  949. //生命周期-挂载之前
  950. beforeMount() {},
  951. //生命周期-更新之前
  952. beforUpdate() {},
  953. //生命周期-更新之后
  954. updated() {},
  955. //生命周期-销毁之前
  956. beforeDestory() {},
  957. //生命周期-销毁完成
  958. destoryed() {},
  959. //如果页面有keep-alive缓存功能,这个函数会触发
  960. activated() {},
  961. };
  962. </script>
  963. <style lang="scss" scoped>
  964. /* @import url(); 引入css类 */
  965. .setting {
  966. height: 100%;
  967. &-top {
  968. margin: 0 0 12px 0;
  969. background: #ffffff;
  970. border-radius: 8px;
  971. display: flex;
  972. align-items: center;
  973. width: 100%;
  974. padding: 22px 40px;
  975. .avator-box {
  976. width: 96px;
  977. height: 96px;
  978. position: relative;
  979. .img-crop {
  980. position: absolute;
  981. // padding: 4px;
  982. width: 30px;
  983. height: 30px;
  984. right: -4px;
  985. bottom: -4px;
  986. border-radius: 50%;
  987. display: block;
  988. text-align: center;
  989. font-size: 0;
  990. border: 2px solid #ffffff;
  991. background: #f2f3f5 url("../../../assets/camera.png") center no-repeat;
  992. background-size: 12px;
  993. }
  994. .el-image {
  995. border-radius: 50%;
  996. overflow: hidden;
  997. }
  998. }
  999. .center {
  1000. flex: 1;
  1001. display: flex;
  1002. flex-flow: wrap;
  1003. margin-top: 12px;
  1004. .info-items {
  1005. margin-bottom: 12px;
  1006. width: 41%;
  1007. }
  1008. label {
  1009. font-weight: 400;
  1010. font-size: 14px;
  1011. line-height: 22px;
  1012. color: #86909c;
  1013. width: 120px;
  1014. text-align: right;
  1015. display: inline-block;
  1016. padding-right: 10px;
  1017. }
  1018. span {
  1019. font-size: 14px;
  1020. line-height: 22px;
  1021. color: #1d2129;
  1022. }
  1023. }
  1024. }
  1025. &-bottom {
  1026. padding: 24px;
  1027. background: #ffffff;
  1028. border-radius: 4px;
  1029. min-height: calc(100vh - 270px);
  1030. .tabs-box {
  1031. display: flex;
  1032. padding-bottom: 16px;
  1033. a {
  1034. font-size: 14px;
  1035. line-height: 22px;
  1036. color: #4e5969;
  1037. border-radius: 100px;
  1038. padding: 5px 16px;
  1039. margin-right: 12px;
  1040. &:hover {
  1041. background: #f2f3f5;
  1042. }
  1043. &.active {
  1044. background: #f2f3f5;
  1045. font-weight: 500;
  1046. color: #165dff;
  1047. }
  1048. }
  1049. }
  1050. .btn {
  1051. margin-left: 16px;
  1052. }
  1053. .safe-items {
  1054. display: flex;
  1055. width: 100%;
  1056. padding: 30px 20px 13px 20px;
  1057. label {
  1058. font-weight: 500;
  1059. font-size: 14px;
  1060. line-height: 22px;
  1061. color: #4e5969;
  1062. }
  1063. &-right {
  1064. border-bottom: 1px solid #e5e6eb;
  1065. padding-bottom: 20px;
  1066. flex: 1;
  1067. margin-left: 16px;
  1068. display: flex;
  1069. justify-content: space-between;
  1070. p {
  1071. margin: 0;
  1072. font-weight: 400;
  1073. font-size: 14px;
  1074. line-height: 22px;
  1075. color: #4e5969;
  1076. &.noContent {
  1077. color: #86909c;
  1078. }
  1079. }
  1080. a {
  1081. font-weight: 400;
  1082. font-size: 14px;
  1083. line-height: 22px;
  1084. color: #165dff;
  1085. }
  1086. }
  1087. }
  1088. }
  1089. &-iframe {
  1090. width: 100%;
  1091. height: 100%;
  1092. background: #ffffff;
  1093. padding: 24px;
  1094. .title {
  1095. margin: 0;
  1096. font-weight: 400;
  1097. font-size: 20px;
  1098. line-height: 28px;
  1099. color: #000000;
  1100. .el-icon-arrow-left {
  1101. margin-right: 8px;
  1102. cursor: pointer;
  1103. }
  1104. }
  1105. .passwordForm,
  1106. .phoneForm,
  1107. .emailForm {
  1108. padding-top: 40px;
  1109. .show-icon {
  1110. cursor: pointer;
  1111. color: #4e5969;
  1112. }
  1113. }
  1114. .code-input {
  1115. width: 268px;
  1116. .el-input__inner {
  1117. border-radius: 2px 0 0 2px;
  1118. }
  1119. }
  1120. }
  1121. }
  1122. </style>
  1123. <style lang="scss">
  1124. .setting {
  1125. .el-input,
  1126. .el-textarea {
  1127. width: 360px;
  1128. }
  1129. .el-input__inner {
  1130. height: 32px;
  1131. color: #1d2129;
  1132. background: #f2f3f5;
  1133. border: none;
  1134. }
  1135. .el-textarea__inner,
  1136. .el-input-group__prepend {
  1137. color: #1d2129;
  1138. background: #f2f3f5;
  1139. border: none;
  1140. }
  1141. .el-input__count {
  1142. background: #f2f3f5;
  1143. }
  1144. .el-form-item__label {
  1145. font-weight: 400;
  1146. font-size: 14px;
  1147. line-height: 32px;
  1148. color: #4e5969;
  1149. }
  1150. .el-form-item__content,
  1151. .el-input__icon {
  1152. line-height: 32px;
  1153. color: #4e5969 !important;
  1154. }
  1155. .el-form-item {
  1156. margin-bottom: 20px;
  1157. }
  1158. .el-radio__input.is-checked + .el-radio__label {
  1159. color: #165dff;
  1160. }
  1161. .el-radio__input.is-checked .el-radio__inner {
  1162. background: #165dff;
  1163. border-color: #165dff;
  1164. }
  1165. .el-button--primary {
  1166. background: #165dff;
  1167. border-color: #165dff;
  1168. border-radius: 2px;
  1169. &:hover {
  1170. background: #4080ff;
  1171. border-color: #4080ff;
  1172. }
  1173. &:focus {
  1174. background: #0e42d2;
  1175. border-color: #0e42d2;
  1176. }
  1177. }
  1178. .el-button--default {
  1179. background: #f2f3f5;
  1180. border-radius: 2px;
  1181. border: none;
  1182. color: #4e5969;
  1183. height: 32px;
  1184. &:hover {
  1185. background: #e5e6eb;
  1186. }
  1187. &:focus {
  1188. background: #c9cdd4;
  1189. }
  1190. }
  1191. .setting-form {
  1192. padding-top: 26px;
  1193. }
  1194. .code-box {
  1195. .el-form-item__content {
  1196. display: flex;
  1197. }
  1198. }
  1199. .code-input {
  1200. height: 32px;
  1201. .el-input__inner {
  1202. border-radius: 4px 0 0 4px;
  1203. }
  1204. }
  1205. .sendCode {
  1206. border-radius: 0 4px 4px 0;
  1207. margin-top: 1px;
  1208. width: 92px;
  1209. }
  1210. .el-input-group__prepend {
  1211. width: 54px;
  1212. height: 32px;
  1213. border: none;
  1214. background: #f2f3f5;
  1215. border-radius: 2px 0px 0px 2px;
  1216. line-height: 32px;
  1217. text-align: center;
  1218. padding: 0;
  1219. }
  1220. .el-input-group--prepend {
  1221. display: flex;
  1222. .el-input__inner {
  1223. margin-left: 8px;
  1224. flex: 1;
  1225. }
  1226. }
  1227. }
  1228. .personal-setting {
  1229. .upload {
  1230. width: 30px;
  1231. height: 30px;
  1232. overflow: hidden;
  1233. .upload-demo {
  1234. opacity: 0;
  1235. width: 100% !important;
  1236. }
  1237. }
  1238. .audit-status {
  1239. border: none;
  1240. margin-left: 16px;
  1241. border-radius: 2px;
  1242. background: #e8f7ff;
  1243. padding: 1px 8px;
  1244. color: #3491fa;
  1245. font-size: 14px;
  1246. font-weight: 500;
  1247. line-height: 22px;
  1248. height: 24px;
  1249. .svg-icon {
  1250. margin-right: 4px;
  1251. }
  1252. &.audit-refused {
  1253. color: #f53f3f;
  1254. background: #ffece8;
  1255. .el-icon-error {
  1256. margin-right: 4px;
  1257. }
  1258. }
  1259. }
  1260. }
  1261. </style>