index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. sendyzm(){
  105. var that=this;
  106. if(that.reqData.mobile==""){
  107. that.$refs.toast.show({model:'warn',label:'请输入手机号'})
  108. return
  109. }
  110. that.yzmvar.text="已发送";
  111. setTimeout(function(){
  112. that.yzmvar.text="发送验证码";
  113. },15000)
  114. },
  115. },
  116. }
  117. </script>
  118. <style lang="scss">
  119. /deep/ .tm-menubars .body{
  120. background-color: #1b1b1b !important;
  121. }
  122. /deep/ .grey-darken-5{
  123. background-color: #0d0d0d!important;
  124. padding: 0px !important;
  125. }
  126. .tou{
  127. font-size: 28px;
  128. padding: 15px 30px 40px 30px;
  129. }
  130. .zhuti{
  131. padding: 15px 30px 40px 30px;
  132. }
  133. .mima{
  134. position: relative;
  135. }
  136. .wangji{
  137. position: absolute;
  138. right: 0px;
  139. top: 3px;
  140. }
  141. /deep/ .wangji .primary{
  142. background-color: #303440 !important;
  143. }
  144. .tel{
  145. margin-left: 5px;
  146. }
  147. .one{
  148. position: absolute;
  149. right: 15px;
  150. top: 18px;
  151. width: 50px;
  152. text-align: center;
  153. }
  154. .mimaicon1{
  155. width: 25px;
  156. height: 25px;
  157. }
  158. .mimaicon2{
  159. width: 25px;
  160. height: 25px;
  161. }
  162. </style>