index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-menubars title="" :shadow="0" :showback="true"></tm-menubars>
  5. <view class="tou C1b1b1b">
  6. <view>设置新密码</view>
  7. <view class="text-size-s mt-20">请输入您的新密码</view>
  8. </view>
  9. <view class="zhuti">
  10. <tm-form>
  11. <view class="tel text-size-m mt-50">请设置6~20位新的登录密码</view>
  12. <view class="mima">
  13. <tm-input name="title" placeholder="请输入" :password="kan==1?true:false" v-model="reqData.password"></tm-input>
  14. <view class="one">
  15. <image v-if="kan==1" src="/static/icon/mima4.png" class="mimaicon2" @click="kan=2"></image>
  16. <image v-if="kan==2" src="/static/icon/mima3.png" class="mimaicon1" @click="kan=1"></image>
  17. </view>
  18. </view>
  19. <view class="mima">
  20. <tm-input name="title" :password="kan1==3?true:false" placeholder="请再次输入新的登录密码" v-model="reqData.password1"></tm-input>
  21. <view class="one">
  22. <image v-if="kan1==3" src="/static/icon/mima4.png" class="mimaicon2" @click="kan1=4"></image>
  23. <image v-if="kan1==4" src="/static/icon/mima3.png" class="mimaicon1" @click="kan1=3"></image>
  24. </view>
  25. </view>
  26. <view class="px-24">
  27. <tm-button @click="tijiao()" theme="primary" :round="24" class="mt100" block>确认</tm-button>
  28. </view>
  29. </tm-form>
  30. </view>
  31. <!-- 弹出层消息 -->
  32. <tm-message ref="toast"></tm-message>
  33. </view>
  34. </template>
  35. <script>
  36. import{myRequest} from '@/api/request.js'
  37. export default {
  38. data() {
  39. return {
  40. active:1,
  41. kan:1, //1没看2看
  42. kan1:3, //1没看2看
  43. reqData:{
  44. mobile:'',
  45. sms_code:'',
  46. password:'',
  47. password1:''
  48. },
  49. yzmvar:{
  50. text:'发送验证码'
  51. }
  52. };
  53. },
  54. onLoad(option) {
  55. console.log(option)
  56. this.reqData.mobile=option.mobile;
  57. this.reqData.sms_code=option.sms_code;
  58. },
  59. created() {
  60. this.sys = uni.getSystemInfoSync();
  61. },
  62. methods: {
  63. tijiao(){
  64. var that=this;
  65. if(that.reqData.password=="" || that.reqData.password.length<6 ||that.reqData.password.length>20){
  66. that.$refs.toast.show({model:'warn',label:'请设置6-20位登录密码'})
  67. return
  68. }else if(that.reqData.password1==""){
  69. that.$refs.toast.show({model:'warn',label:'请再次输入新的登录密码'})
  70. return
  71. }else if(that.reqData.password != that.reqData.password1){
  72. that.$refs.toast.show({model:'warn',label:'密码不一致'})
  73. return
  74. }
  75. myRequest({
  76. url: "/api/login/retrievePassword",
  77. method:'post',
  78. data:that.reqData
  79. }).then(res => {
  80. console.log(res)
  81. if (res.data.code == 200) {
  82. that.$refs.toast.show({model:'success',label:res.data.msg})
  83. setTimeout(function(){
  84. uni.navigateTo({
  85. url: "/pages/login/index",
  86. })
  87. },2000)
  88. }else{
  89. that.$refs.toast.show({model:'error',label:res.data.msg})
  90. }
  91. })
  92. },
  93. xia(){
  94. var that=this;
  95. if(that.reqData.mobile==""){
  96. that.$refs.toast.show({model:'warn',label:'请输入手机号'})
  97. return
  98. }else if(that.reqData.sms_code==""){
  99. that.$refs.toast.show({model:'warn',label:'请输入验证码'})
  100. return
  101. }
  102. that.active=2
  103. },
  104. },
  105. }
  106. </script>
  107. <style lang="scss">
  108. /deep/ .tm-menubars .body{
  109. background-color: #1b1b1b !important;
  110. }
  111. /deep/ .grey-darken-5{
  112. background-color: #0d0d0d!important;
  113. padding: 0px !important;
  114. }
  115. .tou{
  116. font-size: 28px;
  117. padding: 15px 30px 40px 30px;
  118. }
  119. .zhuti{
  120. padding: 15px 30px 40px 30px;
  121. }
  122. .mima{
  123. position: relative;
  124. }
  125. .wangji{
  126. position: absolute;
  127. right: 0px;
  128. top: 3px;
  129. }
  130. /deep/ .wangji .primary{
  131. background-color: #303440 !important;
  132. }
  133. .tel{
  134. margin-left: 5px;
  135. }
  136. .one{
  137. position: absolute;
  138. right: 15px;
  139. top: 18px;
  140. width: 50px;
  141. text-align: center;
  142. }
  143. .mimaicon1{
  144. width: 25px;
  145. height: 25px;
  146. }
  147. .mimaicon2{
  148. width: 25px;
  149. height: 25px;
  150. }
  151. </style>