userCenterSecuritySettingBindPhone.vue 8.7 KB

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