forget-password.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <view class="content">
  3. <view class="status_bar"></view>
  4. <view class="logo">
  5. <image src="~@/static/logo.png" mode="aspectFit"></image>
  6. </view>
  7. <view class="title">
  8. <text v-if="mine_code == 'ningdongyunying'">E信管理</text>
  9. <text v-if="mine_code == 'ningmeijituan'">宁煤安全</text>
  10. <text v-if="mine_code == 'zaoquan'">枣泉煤矿</text>
  11. <text v-if="mine_code == 'qingshuiying'">清水营煤矿</text>
  12. <text v-if="mine_code == 'wuyegongsi'">智慧物业</text>
  13. <text v-if="mine_code == 'jinjiaqu' || mine_code == 'jinjiaqu_neiwang'">金家渠煤矿</text>
  14. <text v-if="mine_code == 'yangchangwan'">羊场湾煤矿</text>
  15. <text v-if="mine_code == 'shicaocun'">石槽村煤矿</text>
  16. <text v-if="mine_code == 'jinfeng' || mine_code == 'jinfeng_neiwang'">金凤煤矿</text>
  17. </view>
  18. <view class="change_box">
  19. <view class="item">
  20. <view class="name">手机号</view>
  21. <view class="input">
  22. <input type="text" value="" v-model="mobile"/>
  23. </view>
  24. </view>
  25. <view class="send_box">
  26. <view class="send_code">
  27. <view class="name">验证码</view>
  28. <view class="input">
  29. <input type="text" value="" v-model="vcode"/>
  30. </view>
  31. </view>
  32. <view class="send_btn" @click="send_vcode()">
  33. <text>{{send_text}}</text>
  34. </view>
  35. </view>
  36. <view class="item">
  37. <view class="name">修改密码</view>
  38. <view class="input">
  39. <input type="password" value="" v-model="password"/>
  40. </view>
  41. </view>
  42. <view class="item">
  43. <view class="name">确认密码</view>
  44. <view class="input">
  45. <input type="password" value="" v-model="copypassword"/>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="tips">
  50. <text @click="back()">记起来了?请点击这里登陆</text>
  51. </view>
  52. <view class="change_btn" @click="changeBtn()">
  53. <text>确认修改</text>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. var testPassword =/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,15}$/
  59. export default {
  60. data() {
  61. return {
  62. mine_code:"",
  63. mobile:'',
  64. vcode:'',
  65. password:'',
  66. copypassword:'',
  67. send_text:'发送验证码'
  68. };
  69. },
  70. onLoad() {
  71. this.mine_code = uni.getStorageSync('mine_code')
  72. },
  73. methods: {
  74. back(){
  75. uni.navigateTo({
  76. url:"../login/login"
  77. })
  78. },
  79. send_vcode(){
  80. if(this.mobile.length < 11){
  81. uni.showToast({
  82. icon:'none',
  83. title:'请填写正确的手机号'
  84. })
  85. return
  86. }
  87. if(this.send_text == "发送验证码"){
  88. this.$api.sms_send_v_code({
  89. mobile:this.mobile
  90. }).then((res)=>{
  91. console.log(res.data)
  92. if(res.data.code == 3001){
  93. uni.showToast({
  94. icon:"none",
  95. title:"电话号码错误"
  96. })
  97. this.send_text = "发送验证码"
  98. }else if(res.data.code == 3002){
  99. uni.showToast({
  100. icon:"none",
  101. title:"发送失败"
  102. })
  103. this.send_text = "发送验证码"
  104. }else if(res.data.code == 3003){
  105. uni.showToast({
  106. icon:"none",
  107. title:res.data.message
  108. })
  109. this.send_text = "发送验证码"
  110. }else if(res.data.code == 0){
  111. uni.showToast({
  112. icon:"none",
  113. title:"验证码发送成功"
  114. })
  115. }
  116. })
  117. }
  118. this.send_text = "已发送"
  119. if(this.send_text = "已发送"){
  120. uni.showToast({
  121. icon:"none",
  122. title:"请勿重复发送"
  123. })
  124. }
  125. },
  126. changeBtn(){
  127. if(this.vcode == ''){
  128. uni.showToast({
  129. icon:'none',
  130. title:'请填写验证码'
  131. })
  132. return
  133. }
  134. if(this.password == '' || this.copypassword == ''){
  135. uni.showToast({
  136. icon:'none',
  137. title:'请填写完整信息'
  138. })
  139. return
  140. }
  141. if(this.password !== this.copypassword){
  142. uni.showToast({
  143. icon:'none',
  144. title:'两次密码输入不一致'
  145. })
  146. return
  147. }
  148. if( !testPassword.test(this.password) ){
  149. uni.showToast({
  150. icon:'none',
  151. title:'密码必须包含大写字母、小写字母、数字和特殊符号且长度在8位至16位之间'
  152. })
  153. return
  154. }
  155. this.$api.user_forget_password({
  156. mobile:this.mobile,
  157. vcode:this.vcode,
  158. password:this.password
  159. }).then((res)=>{
  160. console.log(res)
  161. if(res.data.code == 4002){
  162. uni.showToast({
  163. icon:'none',
  164. title:"验证码超时或者错误"
  165. })
  166. return
  167. }else{
  168. uni.setStorageSync('login_password',this.password)
  169. uni.showToast({
  170. icon:'none',
  171. title:'密码修改成功、返回登陆'
  172. })
  173. this.send_text = "发送验证码"
  174. }
  175. setTimeout(function(){
  176. uni.navigateTo({
  177. url:"../login/login"
  178. })
  179. },1000)
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. page {}
  187. .content {
  188. width: 750rpx;
  189. min-height: 100vh;
  190. height: 100%;
  191. background-image: url(~@/static/login.png);
  192. background-size: cover;
  193. background-position: center center;
  194. background-repeat: no-repeat;
  195. .logo {
  196. width: 344rpx;
  197. height: 350rpx;
  198. margin: 0 auto;
  199. padding-top: 100rpx;
  200. image {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. }
  205. .title {
  206. margin: 0 auto;
  207. margin-top: 32rpx;
  208. width: 288rpx;
  209. height: 47rpx;
  210. font-size: 36rpx;
  211. color: #FFFFFF;
  212. line-height: 47rpx;
  213. text-align: center;
  214. }
  215. .change_box {
  216. padding-top: 40px;
  217. .item {
  218. margin: 0 auto;
  219. margin-bottom: 20px;
  220. width: 600rpx;
  221. height: 45px;
  222. background: #FFFFFF;
  223. border-radius: 25px;
  224. box-sizing: border-box;
  225. padding: 0 20px;
  226. display: flex;
  227. align-items: center;
  228. .name {
  229. width: 150rpx;
  230. font-size: 16px;
  231. color: #009FE8;
  232. line-height: 45px;
  233. }
  234. .input {
  235. input {
  236. height: 45px;
  237. color: #666;
  238. }
  239. }
  240. }
  241. .send_box{
  242. margin: 0 auto;
  243. margin-bottom: 20px;
  244. width: 600rpx;
  245. display: flex;
  246. justify-content: space-between;
  247. align-items: center;
  248. .send_code{
  249. background: #FFFFFF;
  250. border-radius: 25px;
  251. box-sizing: border-box;
  252. padding: 0 20px;
  253. height: 45px;
  254. display: flex;
  255. justify-content: space-between;
  256. align-items: center;
  257. .name{
  258. width: 120rpx;
  259. font-size: 16px;
  260. font-family: MicrosoftYaHei;
  261. color: #009FE8;
  262. line-height: 45px;
  263. }
  264. .input{
  265. width: 140rpx;
  266. }
  267. }
  268. .send_btn{
  269. width: 220rpx;
  270. height: 50px;
  271. background: rgba(100, 220, 255, 0.8);
  272. border-radius: 25px;
  273. text-align: center;
  274. line-height: 50px;
  275. text {
  276. font-size: 34rpx;
  277. color: #FFFFFF;
  278. }
  279. }
  280. }
  281. }
  282. .tips {
  283. margin: 0 auto;
  284. margin-top: 25px;
  285. text-align: center;
  286. font-size: 14px;
  287. color: #ECF0F1;
  288. line-height: 40px;
  289. text-align: center;
  290. }
  291. .change_btn {
  292. margin: 40px auto;
  293. width: 200px;
  294. height: 50px;
  295. background: rgba(100, 220, 255, 0.8);
  296. border-radius: 25px;
  297. text-align: center;
  298. line-height: 50px;
  299. text {
  300. font-size: 18px;
  301. color: #FFFFFF;
  302. letter-spacing: 4px;
  303. }
  304. }
  305. }
  306. </style>