| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262 |
- <template>
- <div class="setting personal-setting" v-loading="loading" v-if="personalInfo">
- <template v-if="!settingFlag">
- <div class="setting-top">
- <div class="avator-box">
- <el-image
- :src="
- personalInfo.image_url
- ? personalInfo.image_url
- : require('../../../assets/avatar.png')
- "
- fit="cover"
- style="width: 96px; height: 96px"
- >
- </el-image>
- <a class="img-crop">
- <upload
- :datafileList="infoForm.cover_image_list"
- :filleNumber="99"
- :changeFillId="handleAvatarSuccess"
- :fileName="'cover'"
- :showList="true"
- uploadType="image"
- />
- </a>
- </div>
- <div class="center">
- <div class="info-items" style="width: 400px">
- <label>用户名:</label>
- <span>{{ personalInfo.user_name }}</span>
- </div>
- <div class="info-items">
- <label>手机号码:</label>
- <span>{{
- personalInfo.phone
- ? personalInfo.phone.substring(0, 3) +
- "******" +
- personalInfo.phone.substring(9, 11)
- : "-"
- }}</span>
- </div>
- <div class="info-items" style="width: 400px">
- <label>账号ID:</label>
- <span>{{ personalInfo.id }}</span>
- </div>
- <div class="info-items">
- <label>邮箱:</label>
- <span>{{ personalInfo.email ? personalInfo.email : "-" }}</span>
- </div>
- <div class="info-items" style="width: 400px">
- <label>注册时间:</label>
- <span>{{ personalInfo.register_time }}</span>
- </div>
- <div class="info-items">
- <label>机构:</label>
- <span>{{ personalInfo.org_name }}</span>
- </div>
- </div>
- </div>
- <div class="setting-bottom">
- <div class="tabs-box">
- <a
- :class="[tabsIndex === 0 ? 'active' : '']"
- @click="handleChangeTabs(0)"
- >基本信息</a
- >
- <a
- :class="[tabsIndex === 1 ? 'active' : '']"
- @click="handleChangeTabs(1)"
- >安全设置</a
- >
- </div>
- <template v-if="tabsIndex === 0">
- <el-form
- :model="infoForm"
- :rules="rules"
- ref="ruleForm"
- label-width="150px"
- class="setting-form"
- >
- <el-form-item label="用户名" prop="name">
- <el-input
- v-model="infoForm.name"
- placeholder="请输入用户名"
- maxlength="20"
- ></el-input>
- </el-form-item>
- <el-form-item label="真实姓名" prop="realName">
- <el-input
- v-model="infoForm.realName"
- placeholder="请输入真实姓名"
- maxlength="20"
- @blur="handleTrim('infoForm', 'realName')"
- ></el-input>
- </el-form-item>
- <el-form-item label="性别" prop="sex">
- <el-radio-group v-model="infoForm.sex">
- <el-radio :label="1">男</el-radio>
- <el-radio :label="0">女</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="所在省市" prop="selectedOptions">
- <el-cascader
- size="medium"
- :options="$provinceCityList"
- v-model="infoForm.selectedOptions"
- @change="handleCity"
- >
- </el-cascader>
- </el-form-item>
- <el-form-item label="备注" prop="desc">
- <el-input
- type="textarea"
- v-model="infoForm.desc"
- placeholder="请输入备注"
- maxlength="100"
- :rows="4"
- show-word-limit
- @blur="handleTrim('infoForm', 'desc')"
- ></el-input>
- </el-form-item>
- <el-form-item label="我的机构" prop="region">
- <el-select
- v-model="infoForm.region"
- placeholder="请选择机构"
- :disabled="personalInfo.is_manager === 'true'"
- >
- <el-option
- v-for="item in orgList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <!-- -->
- <el-tag
- class="audit-status"
- v-if="personalInfo.audit_status === 0"
- >
- <svg-icon icon-class="information-fill"></svg-icon>审核中
- </el-tag>
- <el-tag
- class="audit-status audit-refused"
- v-if="personalInfo.audit_status === 2"
- >
- <i class="el-icon-error"></i>已拒绝
- </el-tag>
- <!-- <el-button v-if="regionFlag" type="primary" size="small" class="btn" @click="regionFlag=!regionFlag">申请变更</el-button>
- <template v-else>
- <el-button type="primary" @click="handleChangeOrg" size="small" class="btn">提交</el-button>
- <el-button @click="handleorgCancel" size="small">取消</el-button>
- </template> -->
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- @click="onSubmit('ruleForm')"
- size="small"
- :loading="submitLoading"
- >保存</el-button
- >
- <el-button @click="onCancel('ruleForm')" size="small"
- >取消</el-button
- >
- </el-form-item>
- </el-form>
- </template>
- <template v-if="tabsIndex === 1">
- <div class="safe-items">
- <label>登录密码</label>
- <div class="safe-items-right">
- <p class="hasContent">
- 已设置。密码至少6位字符,支持数字和字母,且必须同时包含数字和大小写字母。
- </p>
- <a @click="handleSetting('passwordFlag')">{{
- personalInfo.password ? "修改" : "设置"
- }}</a>
- </div>
- </div>
- <div class="safe-items">
- <label>绑定手机</label>
- <div class="safe-items-right">
- <p v-if="personalInfo.phone" class="hasContent">
- 已绑定:
- {{
- personalInfo.phone.substring(0, 3) +
- "******" +
- personalInfo.phone.substring(9, 11)
- }}
- </p>
- <p v-else class="noContent">
- 您暂未绑定手机,绑定手机可以有效的保护账号的安全。
- </p>
- <a @click="handleSetting('phoneFlag')">{{
- personalInfo.phone ? "修改" : "设置"
- }}</a>
- </div>
- </div>
- <div class="safe-items">
- <label>绑定邮箱</label>
- <div class="safe-items-right">
- <p v-if="personalInfo.email" class="hasContent">
- 已绑定: {{ personalInfo.email }}
- </p>
- <p v-else class="noContent">
- 您暂未设置邮箱,绑定邮箱可以用来找回密码、接收通知等。
- </p>
- <a @click="handleSetting('emailFlag')">{{
- personalInfo.email ? "修改" : "设置"
- }}</a>
- </div>
- </div>
- </template>
- </div>
- </template>
- <div class="setting-iframe" v-if="settingFlag && passwordFlag">
- <p class="title">
- <i
- class="el-icon-arrow-left"
- @click="handleSetting('passwordFlag')"
- ></i>
- 登录密码
- </p>
- <el-form
- :model="passwordForm"
- :rules="rulesPassword"
- ref="passwordForm"
- label-width="100px"
- class="passwordForm"
- >
- <el-form-item label="原始密码" prop="oldPwd">
- <el-input
- v-model="passwordForm.oldPwd"
- :type="oldPwdFlag ? 'text' : 'password'"
- autocomplete="off"
- placeholder="请输入密码"
- maxlength="20"
- @blur="handleTrim('passwordForm', 'oldPwd')"
- >
- <i
- slot="suffix"
- class="el-icon-view show-icon"
- @click="changeIcon('oldPwdFlag')"
- v-if="oldPwdFlag"
- ></i>
- <i
- slot="suffix"
- class="show-icon"
- @click="changeIcon('oldPwdFlag')"
- v-else
- >
- <svg-icon icon-class="eye-invisible"></svg-icon>
- </i>
- </el-input>
- </el-form-item>
- <el-form-item label="修改密码" prop="newPwd">
- <el-input
- v-model="passwordForm.newPwd"
- :type="newPwdFlag ? 'text' : 'password'"
- autocomplete="off"
- placeholder="请输入密码"
- maxlength="20"
- @blur="handleTrim('passwordForm', 'newPwd')"
- >
- <i
- slot="suffix"
- class="el-icon-view show-icon"
- @click="changeIcon('newPwdFlag')"
- v-if="newPwdFlag"
- ></i>
- <i
- slot="suffix"
- class="show-icon"
- @click="changeIcon('newPwdFlag')"
- v-else
- >
- <svg-icon icon-class="eye-invisible"></svg-icon>
- </i>
- </el-input>
- </el-form-item>
- <el-form-item label="再次输入" prop="confirmPwd">
- <el-input
- v-model="passwordForm.confirmPwd"
- :type="comfirmPwdFlag ? 'text' : 'password'"
- autocomplete="off"
- placeholder="请输入密码"
- maxlength="20"
- @blur="handleTrim('passwordForm', 'confirmPwd')"
- >
- <i
- slot="suffix"
- class="el-icon-view show-icon"
- @click="changeIcon('comfirmPwdFlag')"
- v-if="comfirmPwdFlag"
- ></i>
- <i
- slot="suffix"
- class="show-icon"
- @click="changeIcon('comfirmPwdFlag')"
- v-else
- >
- <svg-icon icon-class="eye-invisible"></svg-icon>
- </i>
- </el-input>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- @click="onSubmitPassword('passwordForm')"
- size="small"
- :loading="passwordLoading"
- >保存</el-button
- >
- <el-button @click="onCancel('passwordForm')" size="small"
- >取消</el-button
- >
- </el-form-item>
- </el-form>
- </div>
- <div class="setting-iframe" v-if="settingFlag && phoneFlag">
- <p class="title">
- <i class="el-icon-arrow-left" @click="handleSetting('phoneFlag')"></i>
- 绑定手机
- </p>
- <el-form
- :model="phoneForm"
- :rules="rulesPhone"
- ref="phoneForm"
- label-width="100px"
- class="phoneForm"
- >
- <el-form-item label="新手机号" prop="newPhone">
- <el-input
- v-model="phoneForm.newPhone"
- autocomplete="off"
- placeholder="请输入完整手机号"
- maxlength="20"
- @blur="handleTrim('phoneForm', 'newPhone')"
- >
- <!-- <template slot="prepend">+86</template> -->
- </el-input>
- </el-form-item>
- <el-form-item label="验证码" prop="newCode" class="code-box">
- <el-input
- v-model="phoneForm.newCode"
- autocomplete="off"
- placeholder="请输入验证码"
- class="code-input"
- maxlength="20"
- @blur="handleTrim('phoneForm', 'newCode')"
- >
- </el-input>
- <el-button
- type="primary"
- @click="sendCode('times', 'newPhone', 'verificationCodesShow')"
- size="small"
- class="sendCode"
- >
- {{ verificationCodesShow ? times + "s" : "发送验证码" }}
- </el-button>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- @click="onSubmitPhone('phoneForm')"
- size="small"
- :loading="passwordLoading"
- >保存</el-button
- >
- <el-button @click="onCancel('phoneForm')" size="small"
- >取消</el-button
- >
- </el-form-item>
- </el-form>
- </div>
- <div class="setting-iframe" v-if="settingFlag && emailFlag">
- <p class="title">
- <i class="el-icon-arrow-left" @click="handleSetting('emailFlag')"></i>
- 绑定邮箱
- </p>
- <el-form
- :model="emailForm"
- :rules="rulesEmail"
- ref="emailForm"
- label-width="100px"
- class="emailForm"
- >
- <el-form-item label="绑定邮箱" prop="email">
- <el-input
- v-model="emailForm.email"
- autocomplete="off"
- placeholder="请输入邮箱地址"
- maxlength="100"
- @blur="handleTrim('emailForm', 'email')"
- >
- </el-input>
- </el-form-item>
- <el-form-item label="验证码" prop="code" class="code-box">
- <el-input
- v-model="emailForm.code"
- autocomplete="off"
- placeholder="请输入验证码"
- class="code-input"
- maxlength="20"
- @blur="handleTrim('emailForm', 'code')"
- >
- </el-input>
- <el-button
- type="primary"
- @click="
- sendCode('timee', 'email', 'verificationCodeeShow', 'email')
- "
- size="small"
- class="sendCode"
- >
- {{ verificationCodeeShow ? timee + "s" : "发送验证码" }}
- </el-button>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- @click="onSubmitEmail('emailForm')"
- size="small"
- :loading="passwordLoading"
- >保存</el-button
- >
- <el-button @click="onCancel('emailForm')" size="small"
- >取消</el-button
- >
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- <script>
- //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》from ‘《组件路径》';
- import { mapState } from "vuex";
- import { getLogin } from "@/api/ajax";
- import Upload from "../../../components/Upload.vue";
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: { Upload },
- props: [],
- data() {
- //这里存放数据
- const validatePass = (rule, value, callback) => {
- if (value === "") {
- callback(new Error("请输入密码"));
- } else {
- let reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{6,16}$/;
- let result = reg.test(value);
- if (result) {
- callback();
- } else {
- callback(new Error("密码必须同时包含数字和大小写字母"));
- }
- }
- };
- const validatePass2 = (rule, value, callback) => {
- if (value === "") {
- callback(new Error("请再次输入密码"));
- } else if (value !== this.passwordForm.newPwd) {
- callback(new Error("两次输入密码不一致!"));
- } else {
- callback();
- }
- };
- const validatePhone = (rule, value, callback) => {
- if (value === "") {
- callback(new Error("请输入手机号"));
- } else {
- let reg = /^1[3-9]\d{9}$/;
- let regex = /^09\d{7,8}$/;
- let result = reg.test(value) || regex.test(value);
- if (result) {
- callback();
- } else {
- callback(new Error("请输入正确的手机号"));
- }
- }
- };
- const validateEmail = (rule, value, callback) => {
- if (value === "") {
- callback(new Error("请输入邮箱地址"));
- } else {
- let reg = /^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
- let result = reg.test(value);
- if (result) {
- callback();
- } else {
- callback(new Error("请输入正确的邮箱地址"));
- }
- }
- };
- return {
- show: false, // 编辑头像flag
- tabsIndex: 0,
- personalInfo: null,
- infoForm: {
- name: "",
- realName: " ",
- sex: 1,
- selectedOptions: [],
- desc: "",
- region: "",
- cover_image_list: [],
- cover_image_id: null,
- },
- rules: {
- name: [{ required: true, message: "请输入用户名", trigger: "blur" }],
- realName: [
- { required: true, message: "请输入真实姓名", trigger: "blur" },
- ],
- region: [{ required: true, message: "请选择机构", trigger: "change" }],
- selectedOptions: [
- {
- type: "array",
- required: true,
- message: "请选择所在省市",
- trigger: "change",
- },
- ],
- },
- regionFlag: true, // 修改机构
- settingFlag: false, // 修改设置
- passwordFlag: false, // 修改密码
- phoneFlag: false, // 修改手机
- emailFlag: false, // 修改邮箱
- passwordForm: {
- oldPwd: "", // 旧密码
- newPwd: "", // 新密码
- confirmPwd: "", // 确认密码
- },
- rulesPassword: {
- oldPwd: [
- { required: true, message: "请输入原始密码", trigger: "blur" },
- ],
- newPwd: [
- { required: true, validator: validatePass, trigger: "blur" },
- {
- min: 6,
- max: 16,
- message: "请输入 6-16 位密码,且必须同时包含数字和大小写字母",
- trigger: "change",
- },
- ],
- confirmPwd: [
- { required: true, validator: validatePass2, trigger: "blur" },
- ],
- },
- oldPwdFlag: false, // 查看旧密码
- newPwdFlag: false, // 查看新密码
- comfirmPwdFlag: false, // 查看确认密码
- phoneForm: {
- oldPhone: "", // 旧手机
- oldCode: "", // 旧手机验证码
- newPhone: "", // 新手机
- newCode: "", // 新手机验证码
- },
- rulesPhone: {
- oldPhone: [
- { required: true, validator: validatePhone, trigger: "blur" },
- ],
- oldCode: [{ required: true, message: "请输入验证码", trigger: "blur" }],
- newPhone: [
- { required: true, validator: validatePhone, trigger: "blur" },
- ],
- newCode: [{ required: true, message: "请输入验证码", trigger: "blur" }],
- },
- time: 60, //获取验证码的时间
- verificationCodeShow: false, //是否已经获取了验证码
- times: 60, //获取验证码的时间
- verificationCodesShow: false, //是否已经获取了验证码
- timee: 60, //获取验证码的时间
- verificationCodeeShow: false, //是否已经获取了验证码
- emailForm: {
- email: "",
- code: "",
- },
- rulesEmail: {
- email: [{ required: true, validator: validateEmail, trigger: "blur" }],
- code: [{ required: true, message: "请输入验证码", trigger: "blur" }],
- },
- loading: false,
- orgList: [],
- submitLoading: false,
- passwordLoading: false,
- timer: null,
- };
- },
- //计算属性 类似于data概念
- computed: {
- ...mapState(["$provinceCityList"]),
- },
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- // 编辑头像
- toggleShow() {
- this.show = !this.show;
- },
- // 切换tabs
- handleChangeTabs(value) {
- this.tabsIndex = value;
- },
- handleChangeFilters(item) {
- console.log(item);
- // if(this.filterTypeArr.indexOf(value)==-1){
- // this.filterTypeArr.push(value)
- // }else{
- // this.filterTypeArr.splice(this.filterTypeArr.indexOf(value),1)
- // }
- },
- // 查询词汇列表
- handleWordList() {
- this.filterTypeArr = [];
- },
- // 级联选择器
- handleCity(value) {
- // console.log(value)
- },
- // 提交表单
- onSubmit(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.submitLoading = true;
- let MethodName = "/OrgServer/Client/PersonManager/UpdateMyBaseInfo";
- let data = {
- user_name: this.infoForm.name,
- real_name: this.infoForm.realName,
- sex: this.infoForm.sex,
- city_id: this.infoForm.selectedOptions[1],
- memo: this.infoForm.desc,
- org_id: this.infoForm.region,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.submitLoading = false;
- if (res.status === 1) {
- this.getInfo();
- this.$message({
- message: "修改成功",
- type: "success",
- });
- }
- })
- .catch((res) => {
- this.submitLoading = false;
- });
- } else {
- return false;
- }
- });
- },
- // 取消 恢复到修改前状态
- onCancel(formName) {
- this.$refs[formName].resetFields();
- },
- // 修改机构提交
- handleChangeOrg() {
- this.regionFlag = !this.regionFlag;
- },
- // 取消修改机构
- handleorgCancel() {
- this.regionFlag = !this.regionFlag;
- // 注意把原来的值赋回去
- },
- // 修改设置
- handleSetting(flag) {
- this.settingFlag = !this.settingFlag;
- this[flag] = !this[flag];
- },
- changeIcon(flag) {
- this[flag] = !this[flag];
- },
- // 修改密码提交表单
- onSubmitPassword(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.passwordLoading = true;
- let MethodName = "/OrgServer/Client/PersonManager/UpdateMyPassword";
- let data = {
- password_old: this.passwordForm.oldPwd,
- password: this.passwordForm.newPwd,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.passwordLoading = false;
- if (res.status === 1) {
- this.$message({
- message: "修改成功",
- type: "success",
- });
- this.handleSetting("passwordFlag");
- this.passwordForm.oldPwd = "";
- this.passwordForm.newPwd = "";
- this.passwordForm.confirmPwd = "";
- }
- })
- .catch((res) => {
- this.passwordLoading = false;
- });
- } else {
- return false;
- }
- });
- },
- // 修改手机提交表单
- onSubmitPhone(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.passwordLoading = true;
- let MethodName = "/OrgServer/Client/PersonManager/UpdateMyPhone";
- let data = {
- phone: this.phoneForm.newPhone,
- dynamic_verification_code: this.phoneForm.newCode,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.passwordLoading = false;
- if (res.status === 1) {
- this.$message({
- message: "修改成功",
- type: "success",
- });
- this.getInfo();
- this.handleSetting("phoneFlag");
- this.phoneForm.newPhone = "";
- this.phoneForm.newCode = "";
- }
- })
- .catch((res) => {
- clearInterval(this.timer);
- this.timer = null;
- this.times = 60;
- this.timee = 60;
- this.passwordLoading = false;
- this.verificationCodeeShow = false;
- this.verificationCodesShow = false;
- });
- } else {
- return false;
- }
- });
- },
- // 修改邮箱
- onSubmitEmail(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.passwordLoading = true;
- let MethodName = "/OrgServer/Client/PersonManager/UpdateMyEmail";
- let data = {
- dynamic_verification_code: this.emailForm.code,
- email: this.emailForm.email,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.passwordLoading = false;
- if (res.status === 1) {
- this.$message({
- message: "修改成功",
- type: "success",
- });
- this.getInfo();
- this.handleSetting("emailFlag");
- this.emailForm.code = "";
- this.emailForm.email = "";
- }
- })
- .catch((res) => {
- this.passwordLoading = false;
- clearInterval(this.timer);
- this.timer = null;
- this.times = 60;
- this.timee = 60;
- this.verificationCodeeShow = false;
- this.verificationCodesShow = false;
- });
- } else {
- return false;
- }
- });
- },
- // 发送验证码
- sendCode(time, phone, flag, obj) {
- let this_ = this;
- if (this_[time] != 60) {
- return;
- }
- this_.timer = null;
- // 修改手机号
- if (!obj) {
- if (this_.phoneForm[phone]) {
- let reg = /^1[3-9]\d{9}$/;
- let regex = /^09\d{7,8}$/;
- let result =
- reg.test(this_.phoneForm[phone]) ||
- regex.test(this_.phoneForm[phone]);
- if (!result) {
- this_.$message.warning("请输入正确的手机号");
- return;
- }
- this_[flag] = true;
- this_.timer = setInterval(() => {
- this_[time]--;
- if (this_[time] == 0) {
- this_[flag] = false;
- clearInterval(this_.timer);
- this_.timer = null;
- this_[time] = 60;
- }
- }, 1000);
- let MethodName = "/OrgServer/LoginControl/SendVerificationCode";
- let data = {
- send_type: "SMS",
- phone_or_email: this_.phoneForm[phone],
- };
- getLogin(MethodName, data)
- .then((res) => {})
- .catch(() => {
- this_[flag] = false;
- clearInterval(this_.timer);
- this_.timer = null;
- this_[time] = 60;
- });
- } else {
- this_.$message.warning("请先输入手机号");
- }
- } else {
- // 修改邮箱
- if (this_.emailForm[phone]) {
- let reg = /^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
- let result = reg.test(this_.emailForm[phone]);
- if (!result) {
- this_.$message.warning("请输入正确的邮箱地址");
- return;
- }
- this_[flag] = true;
- this_.timer = setInterval(() => {
- this_[time]--;
- if (this_[time] == 0) {
- this_[flag] = false;
- clearInterval(this_.timer);
- this_.timer = null;
- this_[time] = 60;
- }
- }, 1000);
- let MethodName = "/OrgServer/LoginControl/SendVerificationCode";
- let data = {
- send_type: "EMAIL",
- phone_or_email: this_.emailForm[phone],
- };
- getLogin(MethodName, data)
- .then((res) => {})
- .catch(() => {
- this_[flag] = false;
- clearInterval(this_.timer);
- this_.timer = null;
- this_[time] = 60;
- });
- } else {
- this_.$message.warning("请先输入邮箱");
- }
- }
- },
- getInfo() {
- this.loading = true;
- let MethodName = "/OrgServer/Client/PersonManager/GetMyInfo";
- let data = {};
- getLogin(MethodName, data)
- .then((res) => {
- this.loading = false;
- if (res.status === 1) {
- this.personalInfo = res.person;
- this.infoForm = {
- name: this.personalInfo.user_name,
- realName: this.personalInfo.real_name,
- sex: this.personalInfo.sex,
- selectedOptions:
- this.personalInfo.province_id && this.personalInfo.city_id
- ? [this.personalInfo.province_id, this.personalInfo.city_id]
- : [],
- desc: this.personalInfo.memo,
- region: this.personalInfo.org_id,
- cover_image_list: [],
- cover_image_id: null,
- };
- this.$emit("changeTouxiang", this.personalInfo.image_url);
- }
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- handleAvatarSuccess(fileList, name) {
- let MethodName = "/OrgServer/Client/PersonManager/UpdateMyImage";
- let data = {
- image_id:
- fileList.length > 0 &&
- fileList[fileList.length - 1].response &&
- fileList[fileList.length - 1].response.file_info_list &&
- fileList[fileList.length - 1].response.file_info_list[0]
- ? fileList[fileList.length - 1].response.file_info_list[0].file_id
- : "",
- };
- getLogin(MethodName, data)
- .then((res) => {
- if (res.status === 1) {
- this.getInfo();
- }
- })
- .catch((res) => {});
- },
- // 查询列表
- getOrgList() {
- let MethodName = "/OrgServer/Client/OrgManager/GetOrgIndexList";
- let data = {
- name: "",
- status: 1,
- sn: "",
- };
- getLogin(MethodName, data)
- .then((res) => {
- if (res.status === 1) {
- this.orgList = res.org_index_list;
- }
- })
- .catch(() => {
- this.loading = false;
- });
- },
- // 去掉前后空格
- handleTrim(form, fild) {
- this[form][fild] = this[form][fild].trim();
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- this.getOrgList();
- this.getInfo();
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- //生命周期-创建之前
- beforeCreated() {},
- //生命周期-挂载之前
- beforeMount() {},
- //生命周期-更新之前
- beforUpdate() {},
- //生命周期-更新之后
- updated() {},
- //生命周期-销毁之前
- beforeDestory() {},
- //生命周期-销毁完成
- destoryed() {},
- //如果页面有keep-alive缓存功能,这个函数会触发
- activated() {},
- };
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .setting {
- height: 100%;
- &-top {
- margin: 0 0 12px 0;
- background: #ffffff;
- border-radius: 8px;
- display: flex;
- align-items: center;
- width: 100%;
- padding: 22px 40px;
- .avator-box {
- width: 96px;
- height: 96px;
- position: relative;
- .img-crop {
- position: absolute;
- // padding: 4px;
- width: 30px;
- height: 30px;
- right: -4px;
- bottom: -4px;
- border-radius: 50%;
- display: block;
- text-align: center;
- font-size: 0;
- border: 2px solid #ffffff;
- background: #f2f3f5 url("../../../assets/camera.png") center no-repeat;
- background-size: 12px;
- }
- .el-image {
- border-radius: 50%;
- overflow: hidden;
- }
- }
- .center {
- flex: 1;
- display: flex;
- flex-flow: wrap;
- margin-top: 12px;
- .info-items {
- margin-bottom: 12px;
- width: 41%;
- }
- label {
- font-weight: 400;
- font-size: 14px;
- line-height: 22px;
- color: #86909c;
- width: 120px;
- text-align: right;
- display: inline-block;
- padding-right: 10px;
- }
- span {
- font-size: 14px;
- line-height: 22px;
- color: #1d2129;
- }
- }
- }
- &-bottom {
- padding: 24px;
- background: #ffffff;
- border-radius: 4px;
- min-height: calc(100vh - 270px);
- .tabs-box {
- display: flex;
- padding-bottom: 16px;
- a {
- font-size: 14px;
- line-height: 22px;
- color: #4e5969;
- border-radius: 100px;
- padding: 5px 16px;
- margin-right: 12px;
- &:hover {
- background: #f2f3f5;
- }
- &.active {
- background: #f2f3f5;
- font-weight: 500;
- color: #165dff;
- }
- }
- }
- .btn {
- margin-left: 16px;
- }
- .safe-items {
- display: flex;
- width: 100%;
- padding: 30px 20px 13px 20px;
- label {
- font-weight: 500;
- font-size: 14px;
- line-height: 22px;
- color: #4e5969;
- }
- &-right {
- border-bottom: 1px solid #e5e6eb;
- padding-bottom: 20px;
- flex: 1;
- margin-left: 16px;
- display: flex;
- justify-content: space-between;
- p {
- margin: 0;
- font-weight: 400;
- font-size: 14px;
- line-height: 22px;
- color: #4e5969;
- &.noContent {
- color: #86909c;
- }
- }
- a {
- font-weight: 400;
- font-size: 14px;
- line-height: 22px;
- color: #165dff;
- }
- }
- }
- }
- &-iframe {
- width: 100%;
- height: 100%;
- background: #ffffff;
- padding: 24px;
- .title {
- margin: 0;
- font-weight: 400;
- font-size: 20px;
- line-height: 28px;
- color: #000000;
- .el-icon-arrow-left {
- margin-right: 8px;
- cursor: pointer;
- }
- }
- .passwordForm,
- .phoneForm,
- .emailForm {
- padding-top: 40px;
- .show-icon {
- cursor: pointer;
- color: #4e5969;
- }
- }
- .code-input {
- width: 268px;
- .el-input__inner {
- border-radius: 2px 0 0 2px;
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .setting {
- .el-input,
- .el-textarea {
- width: 360px;
- }
- .el-input__inner {
- height: 32px;
- color: #1d2129;
- background: #f2f3f5;
- border: none;
- }
- .el-textarea__inner,
- .el-input-group__prepend {
- color: #1d2129;
- background: #f2f3f5;
- border: none;
- }
- .el-input__count {
- background: #f2f3f5;
- }
- .el-form-item__label {
- font-weight: 400;
- font-size: 14px;
- line-height: 32px;
- color: #4e5969;
- }
- .el-form-item__content,
- .el-input__icon {
- line-height: 32px;
- color: #4e5969 !important;
- }
- .el-form-item {
- margin-bottom: 20px;
- }
- .el-radio__input.is-checked + .el-radio__label {
- color: #165dff;
- }
- .el-radio__input.is-checked .el-radio__inner {
- background: #165dff;
- border-color: #165dff;
- }
- .el-button--primary {
- background: #165dff;
- border-color: #165dff;
- border-radius: 2px;
- &:hover {
- background: #4080ff;
- border-color: #4080ff;
- }
- &:focus {
- background: #0e42d2;
- border-color: #0e42d2;
- }
- }
- .el-button--default {
- background: #f2f3f5;
- border-radius: 2px;
- border: none;
- color: #4e5969;
- height: 32px;
- &:hover {
- background: #e5e6eb;
- }
- &:focus {
- background: #c9cdd4;
- }
- }
- .setting-form {
- padding-top: 26px;
- }
- .code-box {
- .el-form-item__content {
- display: flex;
- }
- }
- .code-input {
- height: 32px;
- .el-input__inner {
- border-radius: 4px 0 0 4px;
- }
- }
- .sendCode {
- border-radius: 0 4px 4px 0;
- margin-top: 1px;
- width: 92px;
- }
- .el-input-group__prepend {
- width: 54px;
- height: 32px;
- border: none;
- background: #f2f3f5;
- border-radius: 2px 0px 0px 2px;
- line-height: 32px;
- text-align: center;
- padding: 0;
- }
- .el-input-group--prepend {
- display: flex;
- .el-input__inner {
- margin-left: 8px;
- flex: 1;
- }
- }
- }
- .personal-setting {
- .upload {
- width: 30px;
- height: 30px;
- overflow: hidden;
- .upload-demo {
- opacity: 0;
- width: 100% !important;
- }
- }
- .audit-status {
- border: none;
- margin-left: 16px;
- border-radius: 2px;
- background: #e8f7ff;
- padding: 1px 8px;
- color: #3491fa;
- font-size: 14px;
- font-weight: 500;
- line-height: 22px;
- height: 24px;
- .svg-icon {
- margin-right: 4px;
- }
- &.audit-refused {
- color: #f53f3f;
- background: #ffece8;
- .el-icon-error {
- margin-right: 4px;
- }
- }
- }
- }
- </style>
|