123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677 |
- <template>
- <div class="setting" v-if="info">
- <template v-if="!settingFlag">
- <div class="setting-top">
- <div class="avator-box">
- <el-image
- :src="
- info.sys_user && info.sys_user.image_url
- ? info.sys_user.image_url
- : info.image_url
- ? info.image_url
- : require('../assets/avatar.png')
- "
- fit="cover"
- style="width: 96px; height: 96px"
- >
- </el-image>
- <a class="img-crop" v-if="page !== 'personCheck'">
- <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">
- <label>用户名:</label>
- <span>{{
- page === "editPerson" || page === "personal"
- ? info.sys_user.user_name
- : info.user_name
- }}</span>
- </div>
- <div class="info-items">
- <label>手机号码:</label>
- <span>{{
- (page === "editPerson" || page === "personal") &&
- info.sys_user.phone
- ? info.sys_user.phone.substring(0, 3) +
- "******" +
- info.sys_user.phone.substring(9, 11)
- : info.phone
- ? info.phone.substring(0, 3) +
- "******" +
- info.phone.substring(9, 11)
- : "-"
- }}</span>
- </div>
- <div class="info-items">
- <label>账号ID:</label>
- <span>{{
- page === "editPerson" || page === "personal"
- ? info.sys_user.id
- : info.id
- }}</span>
- </div>
- <div class="info-items">
- <label>邮箱:</label>
- <span>{{
- (page === "editPerson" || page === "personal") &&
- info.sys_user.email
- ? info.sys_user.email
- : info.email
- ? info.email
- : "-"
- }}</span>
- </div>
- <div class="info-items">
- <label>{{
- page === "editPerson" || page === "personal"
- ? "创建时间:"
- : "注册时间:"
- }}</label>
- <span>{{
- page === "editPerson" || page === "personal"
- ? info.sys_user.create_time
- : info.register_time
- }}</span>
- </div>
- <div
- class="info-items"
- v-if="page === 'editOrgPerson' || page === 'personCheck'"
- >
- <label>机构:</label>
- <span>{{ info.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)"
- v-if="page !== 'personCheck'"
- >安全设置</a
- >
- <a
- :class="[tabsIndex === 2 ? 'active' : '']"
- @click="handleChangeTabs(2)"
- v-if="page !== 'personCheck'"
- >{{
- page === "editPerson" || page === "personal"
- ? "我的权限"
- : "权限设置"
- }}</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"
- disabled
- placeholder="请输入用户名"
- maxlength="20"
- ></el-input>
- </el-form-item>
- <el-form-item label="真实姓名" prop="realName">
- <el-input
- v-model="infoForm.realName"
- placeholder="请输入真实姓名"
- @blur="handleTrim('infoForm', 'realName')"
- maxlength="20"
- ></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 v-if="page !== 'personCheck'">
- <el-button
- type="primary"
- @click="onSubmit('ruleForm')"
- size="small"
- :loading="loading"
- >保存</el-button
- >
- <el-button @click="onCancel('ruleForm')" size="small"
- >取消</el-button
- >
- </el-form-item>
- <el-form-item v-else>
- <el-button
- type="primary"
- @click="handleAudit('up')"
- size="small"
- :loading="loading"
- >通过</el-button
- >
- <el-button @click="handleAudit('down')" 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>
- <!-- <p v-else class="noContent">
- 您暂未设置密码,密码可以有效的保护账号的安全。
- </p> -->
- <a @click="handleSetting('passwordFlag')">{{ "修改" }}</a>
- </div>
- </div>
- <div class="safe-items">
- <label>绑定手机</label>
- <div class="safe-items-right">
- <p
- v-if="info.phone || (info.sys_user && info.sys_user.phone)"
- class="hasContent"
- >
- 已绑定:
- {{
- (page === "editPerson" || page === "personal") &&
- info.sys_user.phone
- ? info.sys_user.phone.substring(0, 3) +
- "******" +
- info.sys_user.phone.substring(9, 11)
- : info.phone
- ? info.phone.substring(0, 3) +
- "******" +
- info.phone.substring(9, 11)
- : "-"
- }}
- </p>
- <p v-else class="noContent">
- 您暂未绑定手机,绑定手机可以有效的保护账号的安全。
- </p>
- <a @click="handleSetting('phoneFlag')">{{
- info.phone || (info.sys_user && info.sys_user.phone)
- ? "修改"
- : "设置"
- }}</a>
- </div>
- </div>
- <div class="safe-items">
- <label>绑定邮箱</label>
- <div class="safe-items-right">
- <p
- v-if="info.email || (info.sys_user && info.sys_user.email)"
- class="hasContent"
- >
- 已绑定: {{ info.email || info.sys_user.email }}
- </p>
- <p v-else class="noContent">
- 您暂未设置邮箱,绑定邮箱可以用来找回密码、接收通知等。
- </p>
- <a @click="handleSetting('emailFlag')">{{
- info.email || (info.sys_user && info.sys_user.email)
- ? "修改"
- : "设置"
- }}</a>
- </div>
- </div>
- </template>
- <template
- v-if="
- tabsIndex === 2 && (page === 'editPerson' || page === 'personal')
- "
- >
- <table class="step-table">
- <tr>
- <td rowspan="2" class="step-table-header">管理权限</td>
- <td>系统用户</td>
- <td>机构管理</td>
- </tr>
- <tr>
- <td>
- <el-checkbox
- v-model="manageAuth"
- :label="10001"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td>
- <el-checkbox
- v-model="manageAuth"
- :label="10002"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- </tr>
- </table>
- <table class="step-table">
- <tr>
- <td rowspan="2" class="step-table-header">内容权限</td>
- <td class="td1">报纸管理</td>
- <td class="td1">画刊管理</td>
- <td class="td1">专辑管理</td>
- <td class="td1">评测管理</td>
- <td class="td1">练习册管理</td>
- <td class="td1">课程管理</td>
- <td class="td1">广告管理</td>
- </tr>
- <tr>
- <td class="td1">
- <el-checkbox
- v-model="manageAuth"
- :label="20001"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td class="td1">
- <el-checkbox
- v-model="manageAuth"
- :label="20002"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td class="td1">
- <el-checkbox
- v-model="manageAuth"
- :label="20003"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td class="td1">
- <el-checkbox
- v-model="manageAuth"
- :label="20004"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td class="td1">
- <el-checkbox
- v-model="manageAuth"
- :label="20005"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td class="td1">
- <el-checkbox
- v-model="manageAuth"
- :label="20006"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td class="td1">
- <el-checkbox
- v-model="manageAuth"
- :label="20007"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- </tr>
- </table>
- <table class="step-table">
- <tr>
- <td rowspan="2" class="step-table-header">兑换码权限</td>
- <td>生成兑换码</td>
- <td>查看兑换码使用情况</td>
- <td>消费报表</td>
- </tr>
- <tr>
- <td>
- <el-checkbox
- v-model="manageAuth"
- :label="30001"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td>
- <el-radio-group
- v-model="codeAuth.viewCode"
- :disabled="page === 'personal' ? true : false"
- >
- <el-radio :label="1">全部</el-radio>
- <el-radio :label="0">自己生成的</el-radio>
- </el-radio-group>
- </td>
- <td>
- <el-checkbox
- v-model="manageAuth"
- :label="30003"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- </tr>
- </table>
- <table class="step-table">
- <tr>
- <td rowspan="2" class="step-table-header">财务权限</td>
- <td>查看数据</td>
- <td>导出数据</td>
- <td>授权地区</td>
- </tr>
- <tr>
- <td>
- <el-checkbox
- v-model="manageAuth"
- :label="40001"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td>
- <el-checkbox
- v-model="manageAuth"
- :label="40002"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- <td>
- <el-cascader
- :disabled="page === 'personal' ? true : false"
- class="step-cascader"
- size="medium"
- :props="props"
- collapse-tags
- clearable
- :options="$provinceCityListAll"
- v-model="financeAuth.selectedOptions"
- @change="handleCity"
- >
- </el-cascader>
- </td>
- </tr>
- </table>
- <table class="step-table">
- <tr>
- <td rowspan="2" class="step-table-header">系统配置</td>
- <td>系统配置</td>
- </tr>
- <tr>
- <td>
- <el-checkbox
- v-model="manageAuth"
- :label="50001"
- :disabled="page === 'personal' ? true : false"
- ><br
- /></el-checkbox>
- </td>
- </tr>
- </table>
- <template v-if="page === 'editPerson'">
- <el-button
- type="primary"
- @click="onSubmitAuth()"
- size="small"
- :loading="loading"
- >保存</el-button
- >
- <el-button @click="onCancelAuth()" size="small">取消</el-button>
- </template>
- </template>
- <template v-if="tabsIndex === 2 && page === 'editOrgPerson'">
- <el-form
- :model="managerForm"
- ref="managerForm"
- label-width="150px"
- class="setting-form"
- >
- <el-form-item label="机构管理员" prop="is_manager">
- <el-radio-group v-model="managerForm.is_manager">
- <el-radio label="true">是</el-radio>
- <el-radio label="false">否</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="阅读全部内容" prop="is_can_see_all_content">
- <el-radio-group v-model="managerForm.is_can_see_all_content">
- <el-radio label="true">是</el-radio>
- <el-radio label="false">否</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- @click="onSubmitManager('managerForm')"
- size="small"
- :loading="loading"
- >保存</el-button
- >
- <el-button @click="onCancel('managerForm')" size="small"
- >取消</el-button
- >
- </el-form-item>
- </el-form>
- </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="请输入密码" >
- <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="请输入密码"
- @blur="handleTrim('passwordForm', 'newPwd')"
- maxlength="20"
- >
- <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>
- <p class="tips">不少于6位,且必须同时包含数字和大小写字母</p>
- </el-form-item>
- <el-form-item label="再次输入" prop="confirmPwd">
- <el-input
- v-model="passwordForm.confirmPwd"
- :type="comfirmPwdFlag ? 'text' : 'password'"
- autocomplete="off"
- placeholder="请输入密码"
- @blur="handleTrim('passwordForm', 'confirmPwd')"
- maxlength="20"
- >
- <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="loading"
- >保存</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="oldPhone"
- v-if="phoneForm.oldPhone"
- >
- <el-input
- v-model="phoneForm.oldPhone"
- autocomplete="off"
- :disabled="phoneForm.oldPhone ? true : false"
- placeholder="请输入完整手机号"
- @blur="handleTrim('phoneForm', 'oldPhone')"
- maxlength="20"
- >
- <template slot="prepend">+86</template>
- </el-input>
- </el-form-item>
- <el-form-item label="新手机号" prop="newPhone">
- <el-input
- v-model="phoneForm.newPhone"
- autocomplete="off"
- placeholder="请输入完整手机号"
- @blur="handleTrim('phoneForm', 'newPhone')"
- maxlength="20"
- >
- <template slot="prepend">+86</template>
- </el-input>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- @click="onSubmitPhone('phoneForm')"
- size="small"
- :loading="loading"
- >保存</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" v-if="emailForm.email">
- <el-input
- v-model="emailForm.email"
- autocomplete="off"
- :disabled="emailForm.email ? true : false"
- placeholder="请输入邮箱地址"
- @blur="handleTrim('emailForm', 'email')"
- maxlength="100"
- >
- </el-input>
- </el-form-item>
- <el-form-item label="新邮箱" prop="newEmail">
- <el-input
- v-model="emailForm.newEmail"
- autocomplete="off"
- placeholder="请输入邮箱地址"
- @blur="handleTrim('emailForm', 'newEmail')"
- maxlength="100"
- >
- </el-input>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- @click="onSubmitEmail('emailForm')"
- size="small"
- :loading="loading"
- >保存</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 Upload from "./Upload.vue";
- import { getLogin } from "@/api/ajax";
- import { getToken } from "@/utils/auth";
- import { mapState } from "vuex";
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: { Upload },
- props: ["page", "info"],
- data() {
- //这里存放数据
- const validatePass = (rule, value, callback) => {
- if (value === "") {
- callback(new Error("请输入密码"));
- } else {
- let reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]+)[a-zA-Z\d]{6,200}$/;
- 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 result = reg.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("请输入正确的邮箱地址"));
- }
- }
- };
- const validateProvince = (rule, value, callback) => {
- if (value === []) {
- callback(new Error("请选择所在省市"));
- } else if (value.length === 2) {
- if (value[0] === "" || value[1] === "") {
- callback(new Error("请选择所在省市"));
- } else {
- callback();
- }
- } else {
- callback();
- }
- };
- return {
- show: false, // 编辑头像flag
- tabsIndex: 0,
- infoForm: {
- cover_image_url: "",
- cover_image_list: [],
- cover_image_id: null,
- name:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(JSON.stringify(this.info.sys_user.user_name))
- : JSON.parse(JSON.stringify(this.info.user_name)),
- realName:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(JSON.stringify(this.info.sys_user.real_name))
- : JSON.parse(JSON.stringify(this.info.real_name)),
- sex:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(JSON.stringify(this.info.sys_user.sex))
- : JSON.parse(JSON.stringify(this.info.sex)),
- selectedOptions:
- this.page === "editPerson" || this.page === "personal"
- ? [
- JSON.parse(JSON.stringify(this.info.sys_user.province_id)),
- JSON.parse(JSON.stringify(this.info.sys_user.city_id)),
- ]
- : [
- JSON.parse(JSON.stringify(this.info.province_id)),
- JSON.parse(JSON.stringify(this.info.city_id)),
- ],
- desc:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(JSON.stringify(this.info.sys_user.memo))
- : JSON.parse(JSON.stringify(this.info.memo)),
- },
- rules: {
- name: [{ required: true, message: "请输入用户名", trigger: "blur" }],
- selectedOptions: [
- {
- type: "array",
- required: true,
- validator: validateProvince,
- trigger: "change",
- },
- ],
- sex: [{ required: true, message: "请选择性别", trigger: "change" }],
- },
- settingFlag: false, // 修改设置
- passwordFlag: false, // 修改密码
- phoneFlag: false, // 修改手机
- emailFlag: false, // 修改邮箱
- passwordForm: {
- newPwd: "", // 新密码
- confirmPwd: "", // 确认密码
- },
- rulesPassword: {
- newPwd: [
- { required: true, validator: validatePass, trigger: "blur" },
- {
- min: 6,
- message: "请输入不少于 6 位密码,且必须同时包含数字和大小写字母",
- trigger: "change",
- },
- ],
- confirmPwd: [
- { required: true, validator: validatePass2, trigger: "blur" },
- ],
- },
- oldPwdFlag: false, // 查看旧密码
- newPwdFlag: false, // 查看新密码
- comfirmPwdFlag: false, // 查看确认密码
- phoneForm: {
- oldPhone:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(JSON.stringify(this.info.sys_user.phone))
- : JSON.parse(JSON.stringify(this.info.phone)), // 旧手机
- newPhone: "", // 新手机
- },
- rulesPhone: {
- oldPhone: [
- { required: true, validator: validatePhone, trigger: "blur" },
- ],
- newPhone: [
- { required: true, validator: validatePhone, trigger: "blur" },
- ],
- },
- time: 60, //获取验证码的时间
- verificationCodeShow: false, //是否已经获取了验证码
- times: 60, //获取验证码的时间
- verificationCodesShow: false, //是否已经获取了验证码
- timee: 60, //获取验证码的时间
- verificationCodeeShow: false, //是否已经获取了验证码
- emailForm: {
- email:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(JSON.stringify(this.info.sys_user.email))
- : JSON.parse(JSON.stringify(this.info.email)),
- newEmail: "",
- },
- rulesEmail: {
- email: [{ required: true, validator: validateEmail, trigger: "blur" }],
- newEmail: [
- { required: true, validator: validateEmail, trigger: "blur" },
- ],
- },
- manageAuth:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(JSON.stringify(this.info.popedom_code_list))
- : [], // 管理权限
- codeAuth: {
- auth: [],
- viewCode:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(
- JSON.stringify(this.info.data_scope.discount_code_view_scope)
- )
- : 0,
- }, // 兑换码权限
- financeAuth: {
- auth: [],
- selectedOptions:
- this.page === "editPerson" || this.page === "personal"
- ? JSON.parse(
- JSON.stringify(this.info.data_scope.finance_popedom_data_scope)
- )
- : [],
- }, // 财务权限
- props: { multiple: true },
- loading: false,
- id: this.$route.query.id ? this.$route.query.id : "",
- managerForm: {
- is_manager:
- this.page === "editOrgPerson"
- ? JSON.parse(JSON.stringify(this.info.is_manager))
- : "false",
- is_can_see_all_content:
- this.page === "editOrgPerson"
- ? JSON.parse(JSON.stringify(this.info.is_can_see_all_content))
- : "false",
- },
- };
- },
- //计算属性 类似于data概念
- computed: {
- ...mapState(["$provinceCityList", "$provinceCityListAll"]),
- },
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- handleAvatarSuccess(fileList, name) {
- let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_Image";
- if (this.page === "editOrgPerson") {
- MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Image";
- }
- let data = {
- id: this.page === "personal" ? JSON.parse(getToken()).user_id : this.id,
- 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.$emit("getInfo");
- }
- })
- .catch((res) => {});
- },
- // 切换tabs
- handleChangeTabs(value) {
- this.tabsIndex = value;
- let breadcrumb = [];
- if (this.page === "editOrgPerson") {
- breadcrumb = [
- {
- icon: "school-line",
- url: "",
- text: "",
- },
- {
- icon: "",
- url: "",
- text: "机构管理",
- },
- {
- icon: "",
- url: "",
- text: this.info.org_name,
- },
- {
- icon: "",
- url: "",
- notLink: true,
- text:
- value === 0 ? "人员信息" : value === 1 ? "安全设置" : "权限设置",
- },
- ];
- this.$emit("changeBread", breadcrumb);
- }
- },
- // 级联选择器
- handleCity(value) {
- // console.log(value)
- },
- // 提交表单
- onSubmit(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.loading = true;
- let MethodName =
- "/OrgServer/Manager/SysUserManager/UpdateSysUser_BaseInfo";
- if (this.page === "editOrgPerson") {
- MethodName =
- "/OrgServer/Manager/PersonManager/UpdatePerson_BaseInfo";
- }
- let data = {
- id:
- this.page === "personal"
- ? JSON.parse(getToken()).user_id
- : this.id,
- user_name: this.infoForm.name,
- real_name: this.infoForm.realName,
- sex: this.infoForm.sex,
- city_id: this.infoForm.selectedOptions[1],
- memo: this.infoForm.desc,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.loading = false;
- if (res.status === 1) {
- this.$emit("getInfo");
- this.$message({
- message: "修改成功",
- type: "success",
- duration: 3000,
- });
- }
- })
- .catch((res) => {
- this.loading = false;
- });
- } else {
- return false;
- }
- });
- },
- // 取消 恢复到修改前状态
- onCancel(formName) {
- if (formName === "managerForm") {
- this.managerForm.is_manager =
- this.page === "editOrgPerson"
- ? JSON.parse(JSON.stringify(this.info.is_manager))
- : "false";
- this.managerForm.is_can_see_all_content =
- this.page === "editOrgPerson"
- ? JSON.parse(JSON.stringify(this.info.is_can_see_all_content))
- : "false";
- } else {
- this.$refs[formName].resetFields();
- }
- },
- // 修改设置
- handleSetting(flag) {
- this.settingFlag = !this.settingFlag;
- this[flag] = !this[flag];
- let breadcrumb = [];
- if (this.page === "editPerson") {
- if (this[flag]) {
- breadcrumb = [
- {
- icon: "contacts-line",
- url: "",
- text: "",
- },
- {
- icon: "",
- url: "",
- text: "系统用户",
- },
- {
- icon: "",
- url: "",
- notLink: true,
- text: "安全设置",
- },
- {
- icon: "",
- url: "",
- text:
- flag === "passwordFlag"
- ? "修改密码"
- : flag === "phoneFlag"
- ? "绑定手机"
- : "安全邮箱",
- },
- ];
- } else {
- breadcrumb = [
- {
- icon: "contacts-line",
- url: "",
- text: "",
- },
- {
- icon: "",
- url: "",
- text: "系统用户",
- },
- {
- icon: "",
- url: "",
- text: "编辑",
- },
- ];
- }
- this.$emit("changeBread", breadcrumb);
- }
- },
- changeIcon(flag) {
- this[flag] = !this[flag];
- },
- // 修改密码提交表单
- onSubmitPassword(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.loading = true;
- let MethodName =
- "/OrgServer/Manager/SysUserManager/UpdateSysUser_Password";
- if (this.page === "editOrgPerson") {
- MethodName =
- "/OrgServer/Manager/PersonManager/UpdatePerson_Password";
- }
- let data = {
- id:
- this.page === "personal"
- ? JSON.parse(getToken()).user_id
- : this.id,
- password: this.passwordForm.newPwd,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.loading = false;
- if (res.status === 1) {
- this.$message({
- message: "修改成功",
- type: "success",
- duration: 3000,
- });
- this.$emit("getInfo");
- this.handleSetting("passwordFlag");
- }
- })
- .catch((res) => {
- this.loading = false;
- });
- } else {
- return false;
- }
- });
- },
- // 修改手机提交表单
- onSubmitPhone(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.loading = true;
- let MethodName =
- "/OrgServer/Manager/SysUserManager/UpdateSysUser_Phone";
- if (this.page === "editOrgPerson") {
- MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Phone";
- }
- let data = {
- id:
- this.page === "personal"
- ? JSON.parse(getToken()).user_id
- : this.id,
- phone: this.phoneForm.newPhone,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.loading = false;
- if (res.status === 1) {
- this.$message({
- message: "修改成功",
- type: "success",
- duration: 3000,
- });
- this.$emit("getInfo");
- this.handleSetting("phoneFlag");
- this.phoneForm.oldPhone = JSON.parse(
- JSON.stringify(this.phoneForm.newPhone)
- );
- this.phoneForm.newPhone = "";
- }
- })
- .catch((res) => {
- this.loading = false;
- });
- } else {
- return false;
- }
- });
- },
- // 修改邮箱
- onSubmitEmail(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.loading = true;
- let MethodName =
- "/OrgServer/Manager/SysUserManager/UpdateSysUser_Email";
- if (this.page === "editOrgPerson") {
- MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Email";
- }
- let data = {
- id:
- this.page === "personal"
- ? JSON.parse(getToken()).user_id
- : this.id,
- email: this.emailForm.newEmail,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.loading = false;
- if (res.status === 1) {
- this.$message({
- message: "修改成功",
- type: "success",
- duration: 3000,
- });
- this.$emit("getInfo");
- this.handleSetting("emailFlag");
- this.emailForm.email = JSON.parse(
- JSON.stringify(this.emailForm.newEmail)
- );
- this.emailForm.newEmail = "";
- }
- })
- .catch((res) => {
- this.loading = false;
- });
- } else {
- return false;
- }
- });
- },
- // 去掉前后空格
- handleTrim(form, fild) {
- this[form][fild] = this[form][fild].trim();
- },
- // 修改权限
- onSubmitAuth() {
- this.loading = true;
- let MethodName =
- "/OrgServer/Manager/SysUserManager/UpdateSysUser_Popedom";
- let finance_popedom_data_scope = {};
- if (this.financeAuth.selectedOptions.length > 0) {
- if (
- this.financeAuth.selectedOptions[0][0] &&
- this.financeAuth.selectedOptions[0][0] === "0"
- ) {
- finance_popedom_data_scope.is_all = "true";
- } else {
- finance_popedom_data_scope.is_all = "false";
- let province_id_list = [];
- let city_id_list = [];
- this.financeAuth.selectedOptions.forEach((item) => {
- if (province_id_list.indexOf(item[0]) === -1) {
- province_id_list.push(item[0]);
- }
- city_id_list.push(item[1] ? item[1] : "");
- });
- finance_popedom_data_scope.province_id_list = province_id_list;
- finance_popedom_data_scope.city_id_list = city_id_list;
- }
- }
- let data = {
- id: this.page === "personal" ? JSON.parse(getToken()).user_id : this.id,
- popedom_code_list: this.manageAuth,
- data_scope: {
- discount_code_view_scope: this.codeAuth.viewCode,
- finance_popedom_data_scope: finance_popedom_data_scope,
- },
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.loading = false;
- if (res.status === 1) {
- this.$message({
- message: "修改成功",
- type: "success",
- duration: 3000,
- });
- }
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- // 取消权限
- onCancelAuth() {
- this.handleUserAuth();
- // this.manageAuth = []
- // this.codeAuth.viewCode = 0
- // this.financeAuth.selectedOptions = []
- },
- // 赋值权限
- handleUserAuth() {
- if (this.page === "editPerson" || this.page === "personal") {
- this.manageAuth = this.info.popedom_code_list
- ? JSON.parse(JSON.stringify(this.info.popedom_code_list))
- : [];
- this.codeAuth.viewCode = this.info.data_scope.discount_code_view_scope
- ? JSON.parse(
- JSON.stringify(this.info.data_scope.discount_code_view_scope)
- )
- : 0;
- if (
- this.info.data_scope.finance_popedom_data_scope &&
- this.info.data_scope.finance_popedom_data_scope.is_all === "true"
- ) {
- this.financeAuth.selectedOptions = ["0"];
- } else {
- let arr = [];
- this.info.data_scope.finance_popedom_data_scope.city_id_list.forEach(
- (item) => {
- arr.push([item.substring(0, 2), item]);
- }
- );
- this.financeAuth.selectedOptions = arr;
- }
- }
- },
- // 修改管理员权限
- onSubmitManager() {
- this.loading = true;
- let MethodName = "/OrgServer/Manager/PersonManager/UpdatePerson_Popedom";
- let data = {
- id: this.page === "personal" ? JSON.parse(getToken()).user_id : this.id,
- is_manager: this.managerForm.is_manager,
- is_can_see_all_content: this.managerForm.is_can_see_all_content,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.loading = false;
- if (res.status === 1) {
- this.$message({
- message: "修改成功",
- type: "success",
- duration: 3000,
- });
- }
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- // 通过 拒绝
- handleAudit(type) {
- let Mname = "/OrgServer/Manager/PersonManager/AuditPerson";
- let data = {
- id_list: [this.id],
- };
- if (type === "up") {
- // 下架状态
- data.is_pass = "true";
- } else if (type === "down") {
- data.is_pass = "false";
- }
- getLogin(Mname, data).then((res) => {
- this.$message({
- message: "操作成功",
- type: "success",
- duration: 3000,
- });
- this.$router.go(-1);
- });
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- if (this.info) {
- this.handleUserAuth();
- }
- },
- //生命周期 - 挂载完成(可以访问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: 40%;
- }
- label {
- font-weight: 400;
- font-size: 14px;
- line-height: 22px;
- color: #86909c;
- width: 156px;
- 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;
- }
- }
- }
- }
- .step-table {
- border: 1px solid #e5e6eb;
- border-collapse: collapse;
- font-size: 14px;
- line-height: 22px;
- color: #1d2129;
- text-align: center;
- margin-bottom: 24px;
- &-header {
- background: #f7f8fa;
- width: 120px !important;
- color: #86909c;
- font-weight: 500;
- }
- td {
- height: 40px;
- width: 260px;
- border: 1px solid #e5e6eb;
- &.td1 {
- width: 130px;
- }
- }
- .step-cascader {
- width: 250px;
- height: 32px;
- line-height: 32px;
- }
- }
- .tips {
- margin: 0;
- color: #86909c;
- font-size: 12px;
- line-height: 20px;
- }
- </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;
- }
- }
- .step-cascader {
- .el-input {
- width: 100% !important;
- }
- }
- .upload {
- width: 30px;
- height: 30px;
- overflow: hidden;
- .upload-demo {
- opacity: 0;
- width: 100% !important;
- }
- }
- }
- </style>
|