password.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <view>
  3. <view class="container">
  4. <!--顶部返回按钮-->
  5. <text class="back-btn iconfont iconzuo" @tap="navBack"></text>
  6. <view class="right-top-sign"></view>
  7. <view class="wrapper">
  8. <view class="left-top-sign">&nbsp;&nbsp;&nbsp;Reset</view>
  9. <view class="welcome"> 修改密码 </view>
  10. <view class="input-content">
  11. <view class="input-item">
  12. <text class="tit">旧密码</text>
  13. <input type="password" placeholder="请输入旧密码" v-model="oldpwd" />
  14. </view>
  15. <view class="input-item">
  16. <text class="tit">新密码</text>
  17. <input v-model="newpwd" type="password" placeholder="请输入新密码" />
  18. </view>
  19. <view class="input-item">
  20. <text class="tit">确认密码</text>
  21. <input v-model="confirmpwd" type="password" placeholder="请输入确认密码" />
  22. </view>
  23. </view>
  24. <button class="confirm-btn" :class="'bg-' + themeColor.name" @click="checkPwd()">
  25. 修改密码
  26. </button>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. toastMsg
  34. } from '@/pages/toast/toast.js'
  35. export default {
  36. data() {
  37. return {
  38. oldpwd: '',
  39. newpwd: '',
  40. confirmpwd: '',
  41. hasLogin: false
  42. };
  43. },
  44. onLoad(options) {
  45. },
  46. methods: {
  47. navBack() {
  48. this.$mRouter.back();
  49. },
  50. navTo(route) {
  51. this.$mRouter.push({
  52. route
  53. });
  54. },
  55. checkPwd() {
  56. if (this.oldpwd == '') {
  57. toastMsg('warning', "请输入旧密码");
  58. return false;
  59. }
  60. if (this.newpwd == '') {
  61. toastMsg('warning', "请输入新密码");
  62. return false;
  63. }
  64. if (this.confirmpwd == '') {
  65. toastMsg('warning', "请输入确认密码");
  66. return false;
  67. } else if (this.confirmpwd != this.newpwd) {
  68. toastMsg('warning', "两次密码输入不一致");
  69. return false;
  70. }
  71. toastMsg("loading", "提交中..");
  72. this.changePwd();
  73. },
  74. changePwd() {
  75. this.hasLogin = this.$mStore.getters.hasLogin;
  76. if (this.hasLogin) {
  77. var url = this.$mConfig.baseUrl + '/system/user/profile/updatePwd?oldPassword=' + this.oldpwd +
  78. '&newPassword=' + this.newpwd;
  79. var that = this;
  80. var token = this.$preToken + ' ' + this.$store.state.accessToken;
  81. uni.request({
  82. url: url,
  83. method: "PUT",
  84. header: {
  85. 'content-type': 'application/json',
  86. 'Authorization': token
  87. },
  88. dataType: "JSON",
  89. success: function(r) {
  90. var res = r.data;
  91. if (res.code == "200") {
  92. toastMsg('success', '修改成功');
  93. that.navBack();
  94. } else {
  95. toastMsg('warning', res.msg);
  96. }
  97. }
  98. })
  99. } else {
  100. toastMsg('warning', '登录信息已失效,请重新登录');
  101. uni.reLaunch({
  102. url: '../public/login'
  103. })
  104. }
  105. }
  106. }
  107. };
  108. </script>
  109. <style lang="scss">
  110. page {
  111. background: $color-white;
  112. }
  113. .container {
  114. padding-top: 60px;
  115. position: relative;
  116. width: 100vw;
  117. overflow: hidden;
  118. .wrapper {
  119. position: relative;
  120. width: 100vw;
  121. z-index: 90;
  122. background: #fff;
  123. padding-bottom: 40upx;
  124. .welcome {
  125. position: relative;
  126. left: 50upx;
  127. top: -90upx;
  128. font-size: 46upx;
  129. color: #555;
  130. text-shadow: 1px 0px 1px rgba(0, 0, 0, 0.3);
  131. }
  132. .input-content {
  133. padding: 0 60upx;
  134. }
  135. .input-item {
  136. display: flex;
  137. flex-direction: column;
  138. align-items: flex-start;
  139. justify-content: center;
  140. padding: 0 30upx;
  141. background: $page-color-light;
  142. height: 120upx;
  143. border-radius: 4px;
  144. margin-bottom: 50upx;
  145. &:last-child {
  146. margin-bottom: 0;
  147. }
  148. .tit {
  149. height: 50upx;
  150. line-height: 56upx;
  151. font-size: $font-sm + 2upx;
  152. color: $font-color-base;
  153. }
  154. input {
  155. height: 60upx;
  156. font-size: $font-base + 2upx;
  157. color: $font-color-dark;
  158. width: 100%;
  159. }
  160. }
  161. .input-item-sms-code {
  162. position: relative;
  163. .sms-code-btn {
  164. position: absolute;
  165. right: 20upx;
  166. color: #111;
  167. bottom: 20upx;
  168. font-size: 28upx;
  169. }
  170. .sms-code-resend {
  171. color: #999;
  172. }
  173. }
  174. .forget-section {
  175. font-size: $font-sm + 2upx;
  176. color: $font-color-spec;
  177. text-align: center;
  178. margin-top: 40upx;
  179. }
  180. }
  181. .back-btn {
  182. position: absolute;
  183. left: 40upx;
  184. z-index: 9999;
  185. padding-top: var(--status-bar-height);
  186. top: 40upx;
  187. font-size: 40upx;
  188. color: $font-color-dark;
  189. }
  190. .left-top-sign {
  191. font-size: 120upx;
  192. color: $page-color-base;
  193. position: relative;
  194. left: -16upx;
  195. }
  196. .right-top-sign {
  197. position: absolute;
  198. top: 80upx;
  199. right: -30upx;
  200. z-index: 95;
  201. &:before,
  202. &:after {
  203. display: block;
  204. content: '';
  205. width: 400upx;
  206. height: 80upx;
  207. background: #b4f3e2;
  208. }
  209. &:before {
  210. transform: rotate(50deg);
  211. border-radius: 0 50px 0 0;
  212. }
  213. &:after {
  214. position: absolute;
  215. right: -198upx;
  216. top: 0;
  217. transform: rotate(-50deg);
  218. border-radius: 50px 0 0 0;
  219. /* background: pink; */
  220. }
  221. }
  222. .register-section {
  223. margin: 50upx 0 50upx 0;
  224. width: 100%;
  225. font-size: $font-sm + 2upx;
  226. color: $font-color-base;
  227. text-align: center;
  228. text {
  229. color: $font-color-spec;
  230. margin-left: 10upx;
  231. margin-right: 10upx;
  232. }
  233. }
  234. }
  235. .password-type-2 {
  236. width: 100%;
  237. position: relative;
  238. .back-btn {
  239. position: absolute;
  240. left: 40upx;
  241. z-index: 9999;
  242. padding-top: var(--status-bar-height);
  243. top: 40upx;
  244. font-size: 48upx;
  245. color: $color-white;
  246. }
  247. .login-top {
  248. height: 460upx;
  249. position: relative;
  250. .desc {
  251. position: absolute;
  252. top: 200upx;
  253. left: 40upx;
  254. font-size: 48upx;
  255. .title {
  256. font-size: 48upx;
  257. }
  258. }
  259. .login-pic {
  260. position: absolute;
  261. width: 220upx;
  262. height: 270upx;
  263. right: 30upx;
  264. top: 100upx;
  265. }
  266. }
  267. .login-type-content {
  268. position: relative;
  269. top: -72upx;
  270. .login-bg {
  271. width: 94vw;
  272. height: 114vw;
  273. margin: 0 3vw;
  274. }
  275. .main {
  276. width: 94vw;
  277. position: absolute;
  278. top: 0;
  279. left: 3vw;
  280. .nav-bar {
  281. display: flex;
  282. height: 100upx;
  283. justify-content: center;
  284. align-items: center;
  285. position: relative;
  286. z-index: 10;
  287. .nav-bar-item {
  288. flex: 1;
  289. display: flex;
  290. height: 100%;
  291. line-height: 96upx;
  292. font-size: $font-lg;
  293. display: flex;
  294. margin: 0 120upx;
  295. justify-content: center;
  296. }
  297. .nav-bar-item-active {
  298. border-bottom: 5upx solid;
  299. }
  300. }
  301. .login-type-form {
  302. width: 80%;
  303. margin: 50upx auto;
  304. .input-item {
  305. position: relative;
  306. height: 90upx;
  307. line-height: 90upx;
  308. margin-bottom: $spacing-lg;
  309. .iconfont {
  310. font-size: 50upx;
  311. position: absolute;
  312. left: 0;
  313. }
  314. .login-type-input {
  315. height: 90upx;
  316. padding-left: 80upx;
  317. border-bottom: 1upx solid rgba(0, 0, 0, .1);
  318. }
  319. .sms-code-btn,
  320. sms-code-resend {
  321. width: 240upx;
  322. font-size: $font-base - 2upx;
  323. }
  324. }
  325. }
  326. .login-type-tips {
  327. padding: 0 50upx;
  328. display: flex;
  329. justify-content: space-between;
  330. }
  331. .confirm-btn {
  332. height: 80upx;
  333. line-height: 80upx;
  334. }
  335. }
  336. }
  337. .login-type-bottom {
  338. width: 100%;
  339. padding-bottom: 30upx;
  340. text-align: center;
  341. font-size: $font-lg;
  342. }
  343. }
  344. </style>