password.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <view class="container login">
  3. <view class="login-main">
  4. <view class="line"></view>
  5. <view class="nav-item"
  6. :class="{ current: tabCurrentIndex === 1 }"
  7. @click="tabClick(1)">
  8. 使用手机修改
  9. </view>
  10. <view class="nav-item"
  11. :class="{ current: tabCurrentIndex === 2 }"
  12. @click="tabClick(2)">
  13. 使用邮箱修改
  14. </view>
  15. </view>
  16. <!-- 手机修改 -->
  17. <view class="content" v-if="tabCurrentIndex === 1">
  18. <view class="login-form clearfix">
  19. <view class="login-input">
  20. <input type="number" v-model="mobile" maxlength="11" class="input" placeholder="请输入手机号"/>
  21. </view>
  22. </view>
  23. <view class="login-form clearfix">
  24. <view class="login-input code">
  25. <input type="number" v-model="imageCode" maxlength="4" class="input" placeholder="请输入右侧图形验证码" />
  26. </view>
  27. <view class="login-input img-btn">
  28. <view class="vscodeimg">
  29. <image :src="imageCodeUrl" mode=""></image>
  30. </view>
  31. <view class="vscod-refresh" @click.stop="getVerificationCode">
  32. <text class="iconfont icon-shuaxin"></text>
  33. <text class="ref-text">刷新</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="login-form clearfix">
  38. <view class="login-input code">
  39. <input type="number" v-model="bindPhoneCode" maxlength="6" class="input" placeholder="请输入短信验证码"/>
  40. </view>
  41. <view class="login-input btn" :class="[isMobileDisabled ? 'disabled' : '']" @click.stop="getMobileCodeFn">
  42. <button type="button" :disabled="isMobileDisabled" class="input" >{{ mobileCodeText }}</button>
  43. </view>
  44. </view>
  45. <view class="login-form clearfix">
  46. <view class="login-input pwd">
  47. <input v-show="isShowEye" type="text" v-model="password" maxlength="18" class="input" placeholder="请输入新密码,必须为8-16位字母数字的组合" autocomplete="new-password"/>
  48. <input v-show="!isShowEye" type="password" v-model="password" :password="true" maxlength="18" class="input" placeholder="请输入新密码,必须为8-16位字母数字的组合" autocomplete="new-password"/>
  49. <view class="iconfont" :class="isShowEye ? iconEyen : iconEyes" @click="passwordEye"></view>
  50. </view>
  51. </view>
  52. <view class="login-form clearfix">
  53. <view class="login-input pwd">
  54. <input v-show="isShowEyes" type="text" v-model="passwordCheck" maxlength="18" class="input" placeholder="请确认密码" autocomplete="new-password"/>
  55. <input v-show="!isShowEyes" type="password" v-model="passwordCheck" :password="true" maxlength="18" class="input" placeholder="请确认密码" autocomplete="new-password"/>
  56. <view class="iconfont" :class="isShowEyes ? iconEyen : iconEyes" @click="passwordEyes"></view>
  57. </view>
  58. </view>
  59. <view class="login-form clearfix">
  60. <view class="login-btn" @click="confirmPassword">修改密码</view>
  61. </view>
  62. </view>
  63. <!-- 邮箱修改 -->
  64. <view class="content" v-else>
  65. <view class="login-form clearfix">
  66. <view class="login-input">
  67. <input class="input" type="number" v-model="email" maxlength="30" placeholder="请输入邮箱地址"/>
  68. </view>
  69. </view>
  70. <view class="login-form clearfix">
  71. <view class="login-input code">
  72. <input class="input" type="number" v-model="emailCode" maxlength="6" placeholder="请输入邮箱验证码" />
  73. </view>
  74. <view class="login-input btn" :class="[isEmialDisabled ? 'disabled' : '']" @click.stop="getEmailCodeFn">
  75. <button class="input" type="button" :disabled="isEmialDisabled">{{ emailCodeText }}</button>
  76. </view>
  77. </view>
  78. <view class="login-form clearfix">
  79. <view class="login-input pwd">
  80. <input v-show="isShowEye" type="text" v-model="password" maxlength="18" class="input" placeholder="请输入新密码,必须为8-16位字母数字的组合" autocomplete="new-password"/>
  81. <input v-show="!isShowEye" type="password" v-model="password" :password="true" maxlength="18" class="input" placeholder="请输入新密码,必须为8-16位字母数字的组合" autocomplete="new-password"/>
  82. <view class="iconfont" :class="isShowEye ? iconEyen : iconEyes" @click="passwordEye"></view>
  83. </view>
  84. </view>
  85. <view class="login-form clearfix">
  86. <view class="login-input pwd">
  87. <input v-show="isShowEyes" type="text" v-model="passwordCheck" maxlength="18" class="input" placeholder="请确认密码" autocomplete="new-password"/>
  88. <input v-show="!isShowEyes" type="password" v-model="passwordCheck" :password="true" maxlength="18" class="input" placeholder="请确认密码" autocomplete="new-password"/>
  89. <view class="iconfont" :class="isShowEyes ? iconEyen : iconEyes" @click="passwordEyes"></view>
  90. </view>
  91. </view>
  92. <view class="login-form clearfix">
  93. <view class="login-btn" @click="goLogin">修改密码</view>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. import authorize from '@/common/config/authorize.js'
  100. import { organizationRegister , organizationVerifyRegisterFirst ,organizationVerifyRegisterTwo } from "@/api/use.js"
  101. import { getImageCode, getEmailCode, getMobileCode, uploadFileImage } from "@/api/utils.js"
  102. export default{
  103. data() {
  104. return{
  105. tabCurrentIndex: 1,
  106. mobile:'', //用户手机号
  107. email:'', //邮箱地址
  108. emailCode:'', //油箱验证码
  109. bindPhoneCode:'', //手机验证码
  110. password:'', //新密码
  111. passwordCheck:'', //二次校验新密码
  112. isShowEye:false, //控显
  113. isShowEyes:false, //控显
  114. iconEyes:'icon-yanjing_yincang_o',
  115. iconEyen:'icon-yanjing_xianshi_o',
  116. isEmialDisabled:false,//获取邮箱验证码按钮
  117. isMobileDisabled:false,//获取手机短信按钮
  118. imageCode:'', //图形验证码
  119. imageCodeUrl:'', //图形验证码地址
  120. imageCodetoken:'', //图形校验token
  121. count: '', //倒计时
  122. emailCodeText: '获取验证码',
  123. mobileCodeText: '获取验证码',
  124. codeTime: null,
  125. }
  126. },
  127. onLoad(option) {
  128. console.log(option)
  129. this.getVerificationCode()
  130. },
  131. methods:{
  132. confirmPassword(){
  133. },
  134. getVerificationCode(){//图形验证
  135. getImageCode().then(res => {
  136. this.imageCodeUrl = res.data.baseImage
  137. this.imageCodetoken = res.data.token
  138. })
  139. },
  140. getEmailCodeFn(){
  141. getEmailCode({email:this.email,status:3}).then(res =>{
  142. this.$util.msg('验证邮件已发送至邮箱,请登录邮箱查收',2000);
  143. const TIME_COUNT = 60;
  144.       if (!this.codeTime) {
  145.         this.count = TIME_COUNT;
  146.         this.isEmialDisabled = true;
  147.         this.codeTime = setInterval(() => {
  148.         if (this.count > 1 && this.count <= TIME_COUNT) {
  149.           this.count--
  150.           this.emailCodeText = this.count +'s重新发送'
  151.          } else {
  152.           this.isEmialDisabled = false;
  153.           clearInterval(this.codeTime)
  154.           this.codeTime = null
  155. this.emailCodeText = '获取验证码'
  156.          }
  157.         },1000)
  158.        }
  159. }).catch( res =>{
  160. this.$util.msg(res.msg,2000);
  161. })
  162. },
  163. getMobileCodeFn(){
  164. let params = {
  165. mobile:this.mobile,
  166. activateCodeType:1,
  167. platformType:2,
  168. imgCode:this.imageCode,
  169. token:this.imageCodetoken,
  170. }
  171. getMobileCode(params).then(res =>{
  172. this.$util.msg('验证短信已发送',2000);
  173. const TIME_COUNT = 60;
  174.       if (!this.codeTime) {
  175.         this.count = TIME_COUNT;
  176.         this.isMobileDisabled = true;
  177.         this.codeTime = setInterval(() => {
  178.         if (this.count > 1 && this.count <= TIME_COUNT) {
  179.           this.count--
  180.           this.mobileCodeText = this.count +'s重新发送'
  181.          } else {
  182.           this.isMobileDisabled = false;
  183.           clearInterval(this.codeTime)
  184.           this.codeTime = null
  185. this.mobileCodeText = '获取验证码'
  186.          }
  187.         },1000)
  188.        }
  189. }).catch( res =>{
  190. this.$util.msg(res.msg,2000);
  191. })
  192. },
  193. tabClick(index) {//tab切换
  194. this.tabCurrentIndex = index;
  195. this.password = ''
  196. this.passwordCheck = ''
  197. if(this.tabCurrentIndex == 1){
  198. this.getVerificationCode()
  199. }
  200. },
  201. passwordEye() {//密码显隐操作
  202. this.isShowEye = !this.isShowEye;
  203. },
  204. passwordEyes() {//密码显隐操作
  205. this.isShowEyes = !this.isShowEyes;
  206. }
  207. }
  208. }
  209. </script>
  210. <style lang="scss">
  211. .login{
  212. width: 100%;
  213. height: auto;
  214. .login-main{
  215. width: 100%;
  216. display: flex;
  217. height: 80rpx;
  218. border-top: 1px solid #F7F7F7;
  219. margin-bottom: 112rpx;
  220. position: relative;
  221. .line{
  222. position: absolute;
  223. top: 0;
  224. left: 50%;
  225. margin-left: -80rpx;
  226. width: 0;
  227. height: 0;
  228. border-left: 80rpx solid transparent;
  229. border-right: 80rpx solid transparent;
  230. border-bottom: 160rpx solid #FFFFFF;
  231. }
  232. .nav-item{
  233. display: flex;
  234. flex: 1;
  235. flex-direction: column;
  236. align-items: center;
  237. line-height: 80rpx;
  238. color: $text-color;
  239. font-size: $font-size-24;
  240. background: #F7F7F7;
  241. &.current{
  242. color:$color-system;
  243. background: #FFFFFF;
  244. }
  245. }
  246. }
  247. .login-form{
  248. width: 702rpx;
  249. height: auto;
  250. padding: 0 24rpx;
  251. .login-input{
  252. width: 654rpx;
  253. height: 40rpx;
  254. padding: 24rpx;
  255. margin-bottom: 20rpx;
  256. background: #F7F7F7;
  257. border-radius: 14rpx;
  258. display: flex;
  259. flex-direction: column;
  260. align-items: center;
  261. position: relative;
  262. &.pwd{
  263. .iconfont{
  264. position: absolute;
  265. right: 0;
  266. top: 0;
  267. font-size: 46rpx;
  268. color: $color-system;
  269. font-weight: bold;
  270. z-index: 99;
  271. width: 96rpx;
  272. height: 96rpx;
  273. line-height: 96rpx;
  274. text-align: center;
  275. }
  276. }
  277. &.code{
  278. width: 370rpx;
  279. float: left;
  280. margin-right: 20rpx;
  281. }
  282. &.btn{
  283. width: 215rpx;
  284. float: left;
  285. background: $btn-confirm;
  286. .input{
  287. width: 215rpx;
  288. padding: 0;
  289. color: #FFFFFF;
  290. background: $btn-confirm;
  291. text-align: center;
  292. &.none{
  293. background: #F7F7F7;
  294. }
  295. }
  296. &.disabled{
  297. background: #F7F7F7;
  298. .input{
  299. background: #F7F7F7;
  300. color: #999999;
  301. }
  302. }
  303. }
  304. &.img-btn{
  305. width: 250rpx;
  306. height: 88rpx;
  307. padding: 0;
  308. float: left;
  309. background: #FFFFFF;
  310. display: block;
  311. .vscodeimg{
  312. width: 180rpx;
  313. height: 88rpx;
  314. float: left;
  315. display: flex;
  316. flex-direction: column;
  317. align-items: center;
  318. border-radius: 14rpx;
  319. image{
  320. width: 180rpx;
  321. height: 88rpx;
  322. border-radius: 14rpx;
  323. }
  324. }
  325. .vscod-refresh{
  326. width: 70rpx;
  327. float: right;
  328. display: flex;
  329. flex-direction: column;
  330. align-items: center;
  331. .icon-shuaxin{
  332. font-size: 48rpx;
  333. color: #333333;
  334. }
  335. .ref-text{
  336. font-size: 24rpx;
  337. color: #333333;
  338. }
  339. }
  340. }
  341. .input{
  342. width: 100%;
  343. height: 100%;
  344. background: #F7F7F7;
  345. font-size: $font-size-28;
  346. line-height: 40rpx;
  347. color: #333333;
  348. border-radius: 14rpx;
  349. }
  350. }
  351. }
  352. .login-btn{
  353. width: 702rpx;
  354. height: 88rpx;
  355. border-radius: 14rpx;
  356. font-size: $font-size-28;
  357. line-height: 88rpx;
  358. color: #FFFFFF;
  359. margin: 0 auto;
  360. text-align: center;
  361. background: $btn-confirm;
  362. margin-top: 100rpx;
  363. }
  364. .model-authorization{
  365. width: 100%;
  366. height: 100%;
  367. position: fixed;
  368. top: 0;
  369. left: 0;
  370. z-index: 999;
  371. .authorization{
  372. width: 518rpx;
  373. height: 320rpx;
  374. position: absolute;
  375. background: rgba(255,255,255,.7);
  376. left: 0;
  377. right: 0;
  378. bottom: 0;
  379. top: 0;
  380. margin: auto;
  381. .to-btn{
  382. position: absolute;
  383. top: 0;
  384. left: 0;
  385. right: 0;
  386. bottom: 0;
  387. margin: auto;
  388. width: 70%;
  389. height: 88rpx;
  390. font-size: $font-size-28;
  391. line-height: 88rpx;
  392. color: #FFFFFF;
  393. text-align: center;
  394. border-radius: 44rpx;
  395. }
  396. }
  397. }
  398. }
  399. </style>