newPass.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <view class="myreport-box">
  3. <cu-custom :isBack="true" bgColor="bg-blue">
  4. <block slot="content">修改密码</block>
  5. </cu-custom>
  6. <view class="content-box">
  7. <form>
  8. <view class="cu-form-group">
  9. <view class="title">用户名</view>
  10. <input placeholder="请输入账号" v-model="userName" name="input" disabled="false"></input>
  11. </view>
  12. <view class="cu-form-group">
  13. <view class="title">原密码</view>
  14. <input placeholder="请输入原密码" type="password" displayable v-model="oldPassword" name="input"></input>
  15. </view>
  16. <view class="cu-form-group">
  17. <view class="title">新密码</view>
  18. <input placeholder="请输入新密码" type="password" displayable v-model="newPassword" name="input"></input>
  19. </view>
  20. <view class="cu-form-group">
  21. <view class="title">确认密码</view>
  22. <input placeholder="请输入新密码" type="password" displayable v-model="checkPassword" name="input"></input>
  23. </view>
  24. </form>
  25. <view class="info">注意:新密码长度必须在6-16位,并且同时包含字母和数字</view>
  26. <button @click="bindModify" class="top-40 bg-gradual-blue shadow-blur round cu-btn block lg " >确认修改</button>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import * as $auth from "@/common/auth.js"
  32. import loginService from "@/api/auth/loginService"
  33. import {
  34. mapActions
  35. } from 'vuex'
  36. export default {
  37. data() {
  38. return {
  39. newPassword: '',
  40. checkPassword: '',
  41. userName: '',
  42. oldPassword: '',
  43. }
  44. },
  45. created() {
  46. this.userInfo = $auth.getUserInfo()
  47. this.userName = this.userInfo.name
  48. },
  49. methods: {
  50. bindModify() {
  51. if (!this.oldPassword) {
  52. uni.showToast({
  53. icon: 'none',
  54. title: '请输入原始密码'
  55. });
  56. return;
  57. }
  58. if (this.checkPassword !== this.newPassword) {
  59. uni.showToast({
  60. icon: 'none',
  61. title: '确认密码与新密码不一致'
  62. });
  63. return;
  64. } else if (this.checkPassword && (this.checkPassword.length < 6 || this.checkPassword.length > 16)) {
  65. uni.showToast({
  66. icon: 'none',
  67. title: '密码长度为6-16位'
  68. });
  69. return;
  70. } else if (!(/\d/.test(this.checkPassword) && /[a-zA-Z]/.test(this.checkPassword))) {
  71. uni.showToast({
  72. icon: 'none',
  73. title: '密码必须包含字母+数字'
  74. });
  75. return;
  76. }
  77. loginService.savePwd({
  78. 'oldPassword': this.oldPassword,
  79. 'newPassword': this.newPassword
  80. }).then(res => {
  81. // this.$store.commit('SET_TOKEN',data.token);
  82. // this.refreshUserInfo();
  83. // uni.reLaunch({
  84. // url: '../index/index',
  85. // });
  86. uni.showToast({
  87. icon: 'success',
  88. title: '修改密码成功'
  89. });
  90. }).catch(e => {
  91. console.error(e)
  92. })
  93. }
  94. }
  95. }
  96. </script>
  97. <style>
  98. .login-box {
  99. width: 100vw;
  100. height: 100vh;
  101. background-size: 100% 100%;
  102. display: flex;
  103. flex-direction: column;
  104. align-items: center;
  105. position: relative;
  106. }
  107. .info{
  108. margin-top: 30rpx;
  109. font-size: 30rpx;
  110. color: #333;
  111. }
  112. .send-button-2 {
  113. font-size: 26rpx;
  114. color: gray;
  115. margin-top: 20rpx;
  116. width: 300rpx;
  117. height: 80rpx;
  118. background: #fff;
  119. box-shadow: 0rpx 2rpx 30rpx 0rpx rgba(0, 0, 0, 0.2);
  120. border-radius: 40rpx;
  121. text-align: center;
  122. line-height: 80rpx;
  123. text-shadow: 0rpx 0rpx 1rpx rgba(0, 0, 0, 0.35);
  124. align-self: flex-end;
  125. }
  126. .myreport-box {
  127. width: 100vw;
  128. height: 100vh;
  129. background-size: 100% 100%;
  130. overflow-x: hidden;
  131. overflow-y: auto;
  132. box-sizing: border-box;
  133. }
  134. .flex-center-box {
  135. display: flex;
  136. flex-direction: column;
  137. justify-content: center;
  138. align-items: center;
  139. padding-top: 50rpx;
  140. }
  141. .site-box {
  142. position: absolute;
  143. bottom: 30rpx;
  144. display: flex;
  145. justify-content: center;
  146. color: #fff;
  147. align-items: center;
  148. }
  149. .gh-icon {
  150. width: 32rpx;
  151. height: 32rpx;
  152. margin-right: 10rpx;
  153. }
  154. .logo-image {
  155. width: 626rpx;
  156. height: 144rpx;
  157. margin-top: 178rpx;
  158. }
  159. .circle-logo {
  160. width: 185rpx;
  161. height: 185rpx;
  162. margin-top: 75rpx;
  163. margin-bottom: 63rpx;
  164. }
  165. .send-button {
  166. margin-top: 20rpx;
  167. width: 300rpx;
  168. height: 100rpx;
  169. background: #fff;
  170. box-shadow: 0rpx 2rpx 30rpx 0rpx rgba(0, 0, 0, 0.2);
  171. border-radius: 50rpx;
  172. text-align: center;
  173. line-height: 100rpx;
  174. font-size: 30rpx;
  175. color: #1F94FE;
  176. text-shadow: 0rpx 0rpx 1rpx rgba(0, 0, 0, 0.35);
  177. align-self: flex-end;
  178. }
  179. .new-input-box {
  180. width: 600rpx;
  181. height: 100rpx;
  182. border-radius: 5rpx;
  183. background: #fff;
  184. display: flex;
  185. flex-direction: row;
  186. box-sizing: border-box;
  187. padding-left: 40rpx;
  188. align-items: center;
  189. border-bottom: 2rpx solid #ddd;
  190. }
  191. .input-icon {
  192. width: 32rpx;
  193. height: 32rpx;
  194. margin-right: 20rpx;
  195. }
  196. .login-button {
  197. margin-top: 60rpx;
  198. width: 600rpx;
  199. height: 80rpx;
  200. background: #fff;
  201. box-shadow: 0rpx 2rpx 30rpx 0rpx rgba(0, 0, 0, 0.2);
  202. border-radius: 40rpx;
  203. text-align: center;
  204. line-height: 80rpx;
  205. font-size: 36rpx;
  206. color: #1F94FE;
  207. text-shadow: 0rpx 0rpx 1rpx rgba(0, 0, 0, 0.35);
  208. }
  209. .info-box {
  210. margin-top: 24rpx;
  211. color: #fff;
  212. font-size: 26rpx;
  213. display: flex;
  214. justify-content: space-between;
  215. width: 500rpx;
  216. }
  217. .zai-box {
  218. padding: 0 50upx;
  219. position: relative;
  220. }
  221. .zai-logo {
  222. width: 100%;
  223. width: 100%;
  224. margin-top: 100upx;
  225. margin-bottom: 100upx;
  226. padding: 20px;
  227. height: 310upx;
  228. }
  229. .zai-title {
  230. position: absolute;
  231. top: 0;
  232. margin-top: 100upx;
  233. margin-bottom: 100upx;
  234. line-height: 340upx;
  235. font-size: 68upx;
  236. color: #fff;
  237. text-align: center;
  238. width: 100%;
  239. margin-left: -50upx;
  240. }
  241. .zai-form {
  242. margin-top: 300upx;
  243. }
  244. .zai-input {
  245. background: #e2f5fc;
  246. margin-top: 30upx;
  247. border-radius: 100upx;
  248. padding: 20upx 40upx;
  249. font-size: 36upx;
  250. }
  251. .input-placeholder,
  252. .zai-input {
  253. color: #94afce;
  254. }
  255. .zai-label {
  256. padding: 60upx 0;
  257. text-align: center;
  258. font-size: 30upx;
  259. color: #a7b6d0;
  260. }
  261. .zai-btn {
  262. background: #ff65a3;
  263. color: #fff;
  264. border: 0;
  265. border-radius: 100upx;
  266. font-size: 36upx;
  267. }
  268. .zai-btn:after {
  269. border: 0;
  270. }
  271. /*按钮点击效果*/
  272. .zai-btn.button-hover {
  273. transform: translate(1upx, 1upx);
  274. }
  275. .cu-form-group .title {
  276. min-width: calc(4em + 15px);
  277. }
  278. .content-box{
  279. width: 650rpx;
  280. margin-left: auto;
  281. margin-right: auto;
  282. margin-top: 60rpx;
  283. }
  284. .top-40{
  285. margin-top: 60rpx;
  286. }
  287. </style>