index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-message ref="toast"></tm-message>
  5. <tm-menubars title="找回密码" :showback="true"></tm-menubars>
  6. <tm-sheet :shadow="24">
  7. <tm-steps model="number" color="bg-gradient-blue-accent" activeFontColor="blue" line-color="bg-gradient-blue-accent" v-model="active" :list="list"></tm-steps>
  8. <view v-if="active==1">
  9. <tm-form>
  10. <tm-input name="title" title="手机号" v-model="reqData.mobile"></tm-input>
  11. <view class="flex-between" :class="$tm.vx.state().tmVuetify.black ? 'bk' : ''">
  12. <tm-input name="title" title="验证码" v-model="reqData.sms_code"></tm-input>
  13. <view>
  14. <tm-button @click="sendyzm" :theme="yzmvar.colorvar" size="m">{{yzmvar.text}}</tm-button>
  15. </view>
  16. </view>
  17. <view class="px-24">
  18. <tm-button @click="xia()" theme="bg-gradient-blue-accent" block>下一步</tm-button>
  19. </view>
  20. </tm-form>
  21. </view>
  22. <view v-else>
  23. <tm-form>
  24. <tm-input name="title" password title="密码" v-model="reqData.password"></tm-input>
  25. <tm-input name="title" password title="确认密码" v-model="reqData.password1"></tm-input>
  26. <view class="px-24">
  27. <tm-button @click="tijiao()" theme="bg-gradient-blue-accent" block>提交</tm-button>
  28. </view>
  29. </tm-form>
  30. </view>
  31. </tm-sheet>
  32. </view>
  33. </template>
  34. <script>
  35. import{myRequest} from '@/api/request.js'
  36. export default {
  37. data() {
  38. return {
  39. active:1,
  40. list:['1.验证手机号码','2.设置新密码'],
  41. reqData:{
  42. mobile:'',
  43. sms_code:'',
  44. password:'',
  45. password1:''
  46. },
  47. yzmvar:{
  48. colorvar:'primary',
  49. text:'发送验证码'
  50. }
  51. };
  52. },
  53. onLoad() {
  54. },
  55. created() {
  56. this.sys = uni.getSystemInfoSync();
  57. },
  58. methods: {
  59. tijiao(){
  60. var that=this;
  61. if(that.reqData.password==""){
  62. that.$refs.toast.show({model:'warn',label:'请输入密码'})
  63. return
  64. }else if(that.reqData.password1==""){
  65. that.$refs.toast.show({model:'warn',label:'请输入确认密码'})
  66. return
  67. }else if(that.reqData.password != that.reqData.password1){
  68. that.$refs.toast.show({model:'warn',label:'密码不一致'})
  69. return
  70. }
  71. myRequest({
  72. url: "/api/login/retrievePassword",
  73. method:'post',
  74. data:that.reqData
  75. }).then(res => {
  76. console.log(res)
  77. if (res.data.code == 200) {
  78. that.$refs.toast.show({model:'success',label:res.data.msg})
  79. setTimeout(function(){
  80. uni.navigateTo({
  81. url: "/pages/login/index",
  82. })
  83. },2000)
  84. }else{
  85. that.$refs.toast.show({model:'error',label:res.data.msg})
  86. }
  87. })
  88. },
  89. xia(){
  90. var that=this;
  91. if(that.reqData.mobile==""){
  92. that.$refs.toast.show({model:'warn',label:'请输入手机号'})
  93. return
  94. }else if(that.reqData.sms_code==""){
  95. that.$refs.toast.show({model:'warn',label:'请输入验证码'})
  96. return
  97. }
  98. that.active=2
  99. },
  100. sendyzm(){
  101. var that=this;
  102. if(that.reqData.mobile==""){
  103. that.$refs.toast.show({model:'warn',label:'请输入手机号'})
  104. return
  105. }
  106. that.yzmvar.colorvar="gray";
  107. that.yzmvar.text="已发送";
  108. setTimeout(function(){
  109. that.yzmvar.colorvar="primary";
  110. that.yzmvar.text="发送验证码";
  111. },5000)
  112. },
  113. },
  114. }
  115. </script>
  116. <style lang="scss">
  117. /deep/ .tm-menubars .body{
  118. background-color: #1b1b1b !important;
  119. }
  120. </style>