userCenterSecuritySettingChangeMail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <div
  3. style="width: 100%; background: #fff; min-height: 700px; position: relative"
  4. class="userCenterSecuritySettingChangePhone"
  5. >
  6. <div
  7. style="
  8. height: 80px;
  9. line-height: 80px;
  10. margin-top: 20px;
  11. margin: 0 20px;
  12. color: #666;
  13. font-size: 15px;
  14. border-bottom: 1px solid #bcbcbc;
  15. "
  16. >
  17. {{ $t("common.Verify Mailbox") }}
  18. <!-- <span style="float: right;margin-top: 27px;"> <i class="el-icon-edit"></i> 修改</span> -->
  19. </div>
  20. <div style="width: 600px">
  21. <el-form
  22. ref="form"
  23. :model="form"
  24. label-width="160px"
  25. class="demo-ruleForm"
  26. :rules="rules"
  27. style="margin-left: 120px; margin-top: 40px; width: 700px"
  28. >
  29. <el-form-item :label="$t('common.EmailNumber')" prop="name">
  30. <el-input
  31. v-model="form.userEmail"
  32. style="width: 70%"
  33. maxlength="30"
  34. show-word-limit
  35. ></el-input>
  36. </el-form-item>
  37. <el-form-item :label="$t('common.VerificationCode')">
  38. <el-input
  39. v-model="form.vervification"
  40. style="width: 70%"
  41. maxlength="10"
  42. show-word-limit
  43. >
  44. </el-input>
  45. <span
  46. v-show="show"
  47. @click="getCode"
  48. style="margin-left: 20px; color: #2c5589"
  49. class="cursor"
  50. >{{ $t("common.getVerificationCode") }}</span
  51. >
  52. <span
  53. v-show="!show"
  54. class="count"
  55. style="margin-left: 20px; color: #999"
  56. >{{ count }}{{ $t("common.SendInSeconds") }}</span
  57. >
  58. </el-form-item>
  59. </el-form>
  60. </div>
  61. <div style="height: 100px">
  62. <div style="margin-top: 50px">
  63. <el-button
  64. type="primary"
  65. style="margin-left: 310px; width: 296px"
  66. @click="goAithentication"
  67. >{{ $t("common.OK") }}
  68. </el-button
  69. >
  70. </div>
  71. </div>
  72. <div
  73. style="
  74. height: 180px;
  75. position: absolute;
  76. bottom: 20px;
  77. left: 0;
  78. width: 100%;
  79. "
  80. >
  81. <div
  82. class="securBox"
  83. :style="active == 1 ? 'height:145px' : 'height:129px'"
  84. >
  85. <div class="div">{{ $t("common.CommonProblem") }}</div>
  86. <div class="div1">{{ $t("common.secremark") }}</div>
  87. <div class="div2">{{ $t("common.secremark1") }}</div>
  88. <div class="div2">{{ $t("common.secremark2") }}</div>
  89. <div class="div2">{{ $t("common.secremark3") }}</div>
  90. </div>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. import {sendTelCode, updateEmail} from "@/api/user";
  96. import {addIntegral} from "@/utils/toCompleteTask";
  97. import {getUserInfoByTel} from "@/api/login";
  98. import {getUserPointPage} from "@/api/user";
  99. export default {
  100. name: "userCenterSecuritySettingChangeMail",
  101. data() {
  102. return {
  103. informationsClass: "1",
  104. dialogVisible: false,
  105. realnameAuthenticationPersonal: true,
  106. ifDiaslog: "",
  107. title: "",
  108. isSendCode: "",
  109. active: "1",
  110. show: true,
  111. count: "",
  112. timer: null,
  113. form: {
  114. userEmail: "",
  115. vervification: "",
  116. date1: "2018-05-19",
  117. date3: "2018-05-19",
  118. date2: "2020-05-25 11:20:23",
  119. delivery: false,
  120. type: [],
  121. resource: "",
  122. desc: "",
  123. },
  124. user: {
  125. umsUser: {},
  126. },
  127. pointStatus: null,
  128. };
  129. },
  130. mounted() {
  131. this.initData();
  132. },
  133. methods: {
  134. initData() {
  135. getUserPointPage().then((res) => {
  136. this.pointStatus = res.data.umsUserPoints[0].pointStatus;
  137. });
  138. },
  139. async goAithentication() {
  140. if (!this.valid()) {
  141. return;
  142. }
  143. await updateEmail(this.form.userEmail, this.form.vervification)
  144. .then((result) => {
  145. if (result.status == "200") {
  146. if (
  147. this.user.umsUser.userUsertypeDict !== "2" &&
  148. this.pointStatus == "y"
  149. ) {
  150. addIntegral("point_task_bind_email", "20");
  151. }
  152. this.msg(this.$t("common.ValidationSuccessful"), "success");
  153. this.$router.push({
  154. name: "securitySetting",
  155. });
  156. }
  157. })
  158. .catch((error) => {
  159. this.msg(error.msg, "error");
  160. });
  161. },
  162. valid: function () {
  163. if (this.form.userEmail == "") {
  164. this.$message.warning(this.$t("common.Themailboxcannotbeempty"));
  165. return false;
  166. }
  167. //验证邮箱
  168. /* if (!this.isSendCode) {
  169. this.$message.warning("请先发送验证码!");
  170. return false;
  171. }*/
  172. if (this.form.vervification == "") {
  173. this.$message.warning(this.$t("common.Verificationcodecannotbeempty"));
  174. return false;
  175. }
  176. //验证邮箱
  177. const regEmail =
  178. /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*\.[a-z]{2,}$/;
  179. if (!regEmail.test(this.form.userEmail)) {
  180. this.$message.warning(this.$t("common.Pleaseenterlegalemail"));
  181. return false;
  182. }
  183. return true;
  184. },
  185. getCode() {
  186. if (this.form.userEmail == "") {
  187. this.$message.warning(this.$t("common.Themailboxcannotbeempty"));
  188. return;
  189. }
  190. //验证邮箱
  191. const regEmail =
  192. /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*\.[a-z]{2,}$/;
  193. if (!regEmail.test(this.form.userEmail)) {
  194. this.$message.warning(this.$t("common.Pleaseenterlegalemail"));
  195. return;
  196. }
  197. let locale = window.localStorage.getItem("locale");
  198. //获取验证码信息
  199. sendTelCode(this.form.userEmail, "YJ", locale)
  200. .then((result) => {
  201. if (result.status == "200") {
  202. // this.msg(this.$t("common.Verificationcodehasbeensent"), "success");
  203. this.msg(result.msg, "success");
  204. this.isSendCode = true;
  205. }
  206. })
  207. .catch((error) => {
  208. this.msg(error.msg, "error");
  209. });
  210. const TIME_COUNT = 60;
  211. if (!this.timer) {
  212. this.count = TIME_COUNT;
  213. this.show = false;
  214. this.timer = setInterval(() => {
  215. if (this.count > 0 && this.count <= TIME_COUNT) {
  216. this.count--;
  217. } else {
  218. this.show = true;
  219. clearInterval(this.timer);
  220. this.timer = null;
  221. }
  222. }, 1000);
  223. }
  224. },
  225. msg: function (msg, type) {
  226. if (msg == "error") {
  227. msg = this.$t("common.ThesystemisbusyPleasetryagainlater");
  228. }
  229. return this.$message({
  230. message: msg,
  231. type: type,
  232. });
  233. },
  234. },
  235. };
  236. </script>
  237. <style scoped>
  238. .el-button {
  239. width: 200px;
  240. height: 45px;
  241. }
  242. .authenticationBox1 {
  243. margin-left: 35px;
  244. margin-right: 150px;
  245. height: 100px;
  246. border: 1px solid rgba(153, 153, 153, 1);
  247. border-radius: 10px;
  248. margin-top: 50px;
  249. position: relative;
  250. }
  251. .authenticationBox2 {
  252. margin: 50px 150px 0 35px;
  253. height: 100px;
  254. border: 1px solid rgba(153, 153, 153, 1);
  255. border-radius: 10px;
  256. position: relative;
  257. }
  258. .authenticationBox1:hover,
  259. .authenticationBox2:hover {
  260. border: 1px solid #ff8400;
  261. }
  262. .avatar-uploader .el-upload {
  263. border: 1px dashed #d9d9d9;
  264. border-radius: 6px;
  265. cursor: pointer;
  266. position: relative;
  267. overflow: hidden;
  268. }
  269. .avatar-uploader .el-upload:hover {
  270. border-color: #409eff;
  271. }
  272. .userCenterSecuritySettingChangePhone
  273. >>> .el-step.is-horizontal
  274. .el-step__line {
  275. top: 24px;
  276. }
  277. .userCenterSecuritySettingChangePhone >>> .el-step__icon {
  278. width: 50px;
  279. height: 50px;
  280. font-size: 25px;
  281. }
  282. .avatar-uploader-icon {
  283. font-size: 28px;
  284. color: #8c939d;
  285. width: 178px;
  286. height: 178px;
  287. line-height: 178px;
  288. text-align: center;
  289. }
  290. .avatar {
  291. width: 178px;
  292. height: 178px;
  293. display: block;
  294. }
  295. .securBox {
  296. margin: 50px 20px 20px 20px;
  297. height: 145px;
  298. background: #f2f2f2;
  299. line-height: 29px;
  300. padding-left: 10px;
  301. }
  302. .securBox .div {
  303. font-size: 14px;
  304. color: #666;
  305. font-weight: 600;
  306. }
  307. .securBox .div1 {
  308. font-size: 14px;
  309. color: #666;
  310. }
  311. .securBox .div2 {
  312. font-size: 14px;
  313. color: #999;
  314. margin-left: 20px;
  315. }
  316. </style>