pwd.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view style="height: 100%">
  3. <image
  4. mode="widthFix"
  5. src="/pages2/static/login_bg.jpg"
  6. class="full_img"
  7. ></image>
  8. <u-navbar
  9. title="修改密码"
  10. :border-bottom="false"
  11. background="{ background: '#ffffff',opacity:0.4; }"
  12. title-color="#ffffff"
  13. back-icon-color="#ffffff"
  14. ></u-navbar>
  15. <view style="padding: 30rpx">
  16. <view class="login_box">
  17. <u-form :model="form" ref="uForm">
  18. <u-form-item prop="oldpwd"
  19. ><u-input
  20. class="password"
  21. placeholder-style="color:#999999"
  22. v-model="form.oldpwd"
  23. type="password"
  24. placeholder="请输入旧密码"
  25. /></u-form-item>
  26. <u-form-item prop="pwd"
  27. ><u-input
  28. class="password"
  29. placeholder-style="color:#999999"
  30. v-model="form.pwd"
  31. type="password"
  32. placeholder="请输入新密码"
  33. /></u-form-item>
  34. <u-form-item prop="pwdAgain"
  35. ><u-input
  36. class="password"
  37. placeholder-style="color:#999999"
  38. v-model="form.pwdAgain"
  39. type="password"
  40. placeholder="再次输入新密码"
  41. /></u-form-item>
  42. </u-form>
  43. </view>
  44. <button
  45. :disabled="isUse"
  46. class="loginBtn"
  47. :class="{ able: canSubmit() }"
  48. @click="submit"
  49. >
  50. 确定
  51. </button>
  52. </view>
  53. <u-verification-code
  54. seconds="60"
  55. ref="uCode"
  56. @change="codeChange"
  57. ></u-verification-code>
  58. <!-- <u-navbar title="" :border-bottom="false" background="{ background: '#ffffff',opacity:0.4; }" title-color="#ffffff" back-icon-color="#ffffff">
  59. </u-navbar> -->
  60. </view>
  61. </template>
  62. <script>
  63. import {mapGetters} from 'vuex';
  64. export default {
  65. data() {
  66. return {
  67. code: "",
  68. form: {
  69. code: "",
  70. tel: "",
  71. pwd: "",
  72. pwdAgain: "",
  73. },
  74. rules: {
  75. pwd: [
  76. {
  77. required: true,
  78. message: "请输入密码",
  79. // 可以单个或者同时写两个触发验证方式
  80. trigger: ["change"],
  81. },
  82. ],
  83. pwdAgain: [
  84. {
  85. required: true,
  86. message: "请输入密码",
  87. // 可以单个或者同时写两个触发验证方式
  88. trigger: ["change"],
  89. },
  90. ],
  91. oldpwd: [
  92. {
  93. required: true,
  94. message: "请输入旧密码",
  95. // 可以单个或者同时写两个触发验证方式
  96. trigger: ["change"],
  97. },
  98. ],
  99. },
  100. codeTips: "",
  101. read: "",
  102. isUse: false,
  103. };
  104. },
  105. methods: {
  106. canSubmit() {
  107. if (
  108. this.form.oldpwd &&
  109. this.form.pwd &&
  110. this.form.pwdAgain
  111. ) {
  112. return true;
  113. }
  114. return false;
  115. },
  116. submit() {
  117. let that = this;
  118. if (!this.form.oldpwd) {
  119. this.$u.toast("请输入旧密码");
  120. return;
  121. }
  122. if (!this.form.pwd) {
  123. this.$u.toast("请输入新密码");
  124. return;
  125. }
  126. if (!this.form.pwdAgain) {
  127. this.$u.toast("请输入确定新密码");
  128. return;
  129. }
  130. if (this.form.pwd != this.form.pwdAgain) {
  131. this.$u.toast("两次密码不一致");
  132. return;
  133. }
  134. that.isUse = true;
  135. console.log(this.userInfo,"sda")
  136. let datas = {
  137. userId: this.userInfo.userId,
  138. oldPwd: this.form.oldpwd,
  139. newPwd: this.form.pwd,
  140. };
  141. that.$api.appuserupdatePwd(datas).then(
  142. (res) => {
  143. that.isUse = false;
  144. if (res.data.code == 200) {
  145. uni.showModal({
  146. title: "提示",
  147. content: "修改成功",
  148. showCancel: false,
  149. success: function (resst) {
  150. // this.$navTo.togo()
  151. uni.reLaunch({
  152. url: "/pages/wd/index",
  153. });
  154. },
  155. });
  156. } else {
  157. that.$u.toast(res.data.msg);
  158. }
  159. },
  160. (err) => {
  161. that.isUse = false;
  162. console.log(err);
  163. }
  164. );
  165. },
  166. },
  167. onLoad(option) {
  168. let that = this;
  169. // this.from = option.from; // 看页面没有用到
  170. uni.login({
  171. provider: "weixin",
  172. success: function (loginRes) {
  173. that.code = loginRes.code;
  174. },
  175. });
  176. },
  177. onReady() {
  178. this.$refs.uForm.setRules(this.rules);
  179. },
  180. computed: {...mapGetters(['userInfo'])},
  181. };
  182. </script>
  183. <style scoped lang="scss">
  184. .wxBtn {
  185. position: fixed;
  186. bottom: 10%;
  187. width: 100%;
  188. left: 0;
  189. }
  190. /deep/ .wxBtn button::after {
  191. border: none;
  192. }
  193. .loginBtn {
  194. width: 526rpx;
  195. height: 80rpx;
  196. background: linear-gradient(90deg, #015eea, #00c0fa);
  197. box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
  198. opacity: 0.6;
  199. border-radius: 40rpx;
  200. color: #ffffff;
  201. text-align: center;
  202. line-height: 80rpx;
  203. margin: 40rpx auto;
  204. &.able {
  205. opacity: 1;
  206. }
  207. }
  208. .wxloginBtn {
  209. background: url("/static/loginBtn.png") no-repeat;
  210. background-size: 100% 100%;
  211. border: none;
  212. width: 100rpx;
  213. height: 100rpx;
  214. }
  215. /deep/page {
  216. background-color: #ffffff;
  217. height: 100%;
  218. width: 100%;
  219. }
  220. .login_box {
  221. width: 100%;
  222. height: 566rpx;
  223. background: #ffffff;
  224. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(1, 99, 235, 0.1);
  225. border-radius: 24rpx;
  226. margin-top: 30rpx;
  227. padding: 40rpx 35rpx;
  228. .password {
  229. /deep/.uicon-eye-fill {
  230. &::before {
  231. color: #007aff;
  232. content: "\e613";
  233. }
  234. }
  235. }
  236. }
  237. /deep/ .u-item-bg {
  238. border-radius: 32px !important;
  239. }
  240. /deep/ .u-subsection {
  241. border-radius: 32px !important;
  242. }
  243. .full_img {
  244. position: absolute;
  245. left: 0;
  246. display: block;
  247. width: 100%;
  248. z-index: -999;
  249. top: 0;
  250. }
  251. .head {
  252. height: 96rpx;
  253. width: 100%;
  254. line-height: 96rpx;
  255. margin-top: 40rpx;
  256. text-align: center;
  257. display: flex;
  258. position: relative;
  259. justify-content: center;
  260. }
  261. .icon {
  262. position: absolute;
  263. left: 30rpx;
  264. }
  265. .aa {
  266. padding: 10rpx;
  267. text-align: center;
  268. margin-top: 10rpx;
  269. }
  270. </style>