123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- <template>
- <div
- style="width: 100%; background: #fff; min-height: 700px; position: relative"
- class="userCenterSecuritySettingChangePhone"
- >
- <div
- style="
- height: 80px;
- line-height: 80px;
- margin-top: 20px;
- margin: 0 20px;
- color: #666;
- font-size: 15px;
- border-bottom: 1px solid #bcbcbc;
- "
- >
- {{ $t("common.Verify Mailbox") }}
- <!-- <span style="float: right;margin-top: 27px;"> <i class="el-icon-edit"></i> 修改</span> -->
- </div>
- <div style="width: 600px">
- <el-form
- ref="form"
- :model="form"
- label-width="160px"
- class="demo-ruleForm"
- :rules="rules"
- style="margin-left: 120px; margin-top: 40px; width: 700px"
- >
- <el-form-item :label="$t('common.EmailNumber')" prop="name">
- <el-input
- v-model="form.userEmail"
- style="width: 70%"
- maxlength="30"
- show-word-limit
- ></el-input>
- </el-form-item>
- <el-form-item :label="$t('common.VerificationCode')">
- <el-input
- v-model="form.vervification"
- style="width: 70%"
- maxlength="10"
- show-word-limit
- >
- </el-input>
- <span
- v-show="show"
- @click="getCode"
- style="margin-left: 20px; color: #2c5589"
- class="cursor"
- >{{ $t("common.getVerificationCode") }}</span
- >
- <span
- v-show="!show"
- class="count"
- style="margin-left: 20px; color: #999"
- >{{ count }}{{ $t("common.SendInSeconds") }}</span
- >
- </el-form-item>
- </el-form>
- </div>
- <div style="height: 100px">
- <div style="margin-top: 50px">
- <el-button
- type="primary"
- style="margin-left: 310px; width: 296px"
- @click="goAithentication"
- >{{ $t("common.OK") }}
- </el-button
- >
- </div>
- </div>
- <div
- style="
- height: 180px;
- position: absolute;
- bottom: 20px;
- left: 0;
- width: 100%;
- "
- >
- <div
- class="securBox"
- :style="active == 1 ? 'height:145px' : 'height:129px'"
- >
- <div class="div">{{ $t("common.CommonProblem") }}</div>
- <div class="div1">{{ $t("common.secremark") }}</div>
- <div class="div2">{{ $t("common.secremark1") }}</div>
- <div class="div2">{{ $t("common.secremark2") }}</div>
- <div class="div2">{{ $t("common.secremark3") }}</div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {sendTelCode, updateEmail} from "@/api/user";
- import {addIntegral} from "@/utils/toCompleteTask";
- import {getUserInfoByTel} from "@/api/login";
- import {getUserPointPage} from "@/api/user";
- export default {
- name: "userCenterSecuritySettingChangeMail",
- data() {
- return {
- informationsClass: "1",
- dialogVisible: false,
- realnameAuthenticationPersonal: true,
- ifDiaslog: "",
- title: "",
- isSendCode: "",
- active: "1",
- show: true,
- count: "",
- timer: null,
- form: {
- userEmail: "",
- vervification: "",
- date1: "2018-05-19",
- date3: "2018-05-19",
- date2: "2020-05-25 11:20:23",
- delivery: false,
- type: [],
- resource: "",
- desc: "",
- },
- user: {
- umsUser: {},
- },
- pointStatus: null,
- };
- },
- mounted() {
- this.initData();
- },
- methods: {
- initData() {
- getUserPointPage().then((res) => {
- this.pointStatus = res.data.umsUserPoints[0].pointStatus;
- });
- },
- async goAithentication() {
- if (!this.valid()) {
- return;
- }
- await updateEmail(this.form.userEmail, this.form.vervification)
- .then((result) => {
- if (result.status == "200") {
- if (
- this.user.umsUser.userUsertypeDict !== "2" &&
- this.pointStatus == "y"
- ) {
- addIntegral("point_task_bind_email", "20");
- }
- this.msg(this.$t("common.ValidationSuccessful"), "success");
- this.$router.push({
- name: "securitySetting",
- });
- }
- })
- .catch((error) => {
- this.msg(error.msg, "error");
- });
- },
- valid: function () {
- if (this.form.userEmail == "") {
- this.$message.warning(this.$t("common.Themailboxcannotbeempty"));
- return false;
- }
- //验证邮箱
- /* if (!this.isSendCode) {
- this.$message.warning("请先发送验证码!");
- return false;
- }*/
- if (this.form.vervification == "") {
- this.$message.warning(this.$t("common.Verificationcodecannotbeempty"));
- return false;
- }
- //验证邮箱
- const regEmail =
- /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*\.[a-z]{2,}$/;
- if (!regEmail.test(this.form.userEmail)) {
- this.$message.warning(this.$t("common.Pleaseenterlegalemail"));
- return false;
- }
- return true;
- },
- getCode() {
- if (this.form.userEmail == "") {
- this.$message.warning(this.$t("common.Themailboxcannotbeempty"));
- return;
- }
- //验证邮箱
- const regEmail =
- /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*\.[a-z]{2,}$/;
- if (!regEmail.test(this.form.userEmail)) {
- this.$message.warning(this.$t("common.Pleaseenterlegalemail"));
- return;
- }
- let locale = window.localStorage.getItem("locale");
- //获取验证码信息
- sendTelCode(this.form.userEmail, "YJ", locale)
- .then((result) => {
- if (result.status == "200") {
- // this.msg(this.$t("common.Verificationcodehasbeensent"), "success");
- this.msg(result.msg, "success");
- this.isSendCode = true;
- }
- })
- .catch((error) => {
- this.msg(error.msg, "error");
- });
- const TIME_COUNT = 60;
- if (!this.timer) {
- this.count = TIME_COUNT;
- this.show = false;
- this.timer = setInterval(() => {
- if (this.count > 0 && this.count <= TIME_COUNT) {
- this.count--;
- } else {
- this.show = true;
- clearInterval(this.timer);
- this.timer = null;
- }
- }, 1000);
- }
- },
- msg: function (msg, type) {
- if (msg == "error") {
- msg = this.$t("common.ThesystemisbusyPleasetryagainlater");
- }
- return this.$message({
- message: msg,
- type: type,
- });
- },
- },
- };
- </script>
- <style scoped>
- .el-button {
- width: 200px;
- height: 45px;
- }
- .authenticationBox1 {
- margin-left: 35px;
- margin-right: 150px;
- height: 100px;
- border: 1px solid rgba(153, 153, 153, 1);
- border-radius: 10px;
- margin-top: 50px;
- position: relative;
- }
- .authenticationBox2 {
- margin: 50px 150px 0 35px;
- height: 100px;
- border: 1px solid rgba(153, 153, 153, 1);
- border-radius: 10px;
- position: relative;
- }
- .authenticationBox1:hover,
- .authenticationBox2:hover {
- border: 1px solid #ff8400;
- }
- .avatar-uploader .el-upload {
- border: 1px dashed #d9d9d9;
- border-radius: 6px;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- }
- .avatar-uploader .el-upload:hover {
- border-color: #409eff;
- }
- .userCenterSecuritySettingChangePhone
- >>> .el-step.is-horizontal
- .el-step__line {
- top: 24px;
- }
- .userCenterSecuritySettingChangePhone >>> .el-step__icon {
- width: 50px;
- height: 50px;
- font-size: 25px;
- }
- .avatar-uploader-icon {
- font-size: 28px;
- color: #8c939d;
- width: 178px;
- height: 178px;
- line-height: 178px;
- text-align: center;
- }
- .avatar {
- width: 178px;
- height: 178px;
- display: block;
- }
- .securBox {
- margin: 50px 20px 20px 20px;
- height: 145px;
- background: #f2f2f2;
- line-height: 29px;
- padding-left: 10px;
- }
- .securBox .div {
- font-size: 14px;
- color: #666;
- font-weight: 600;
- }
- .securBox .div1 {
- font-size: 14px;
- color: #666;
- }
- .securBox .div2 {
- font-size: 14px;
- color: #999;
- margin-left: 20px;
- }
- </style>
|