forget-password.vue 7.4 KB

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