password.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {extend name="public/base"/}
  2. {block name="css"}
  3. {/block}
  4. {block name="body"}
  5. <van-nav-bar
  6. class="nav-theme"
  7. :fixed="true"
  8. :placeholder="true"
  9. left-text="返回"
  10. left-arrow
  11. @click-left="onBack"
  12. >
  13. <template #title>
  14. <span class="text-white">修改密码</span>
  15. </template>
  16. </van-nav-bar>
  17. <van-form @submit="onSubmit">
  18. <van-cell-group>
  19. <van-field
  20. v-model="form.old_password"
  21. required
  22. type="password"
  23. label="原始密码"
  24. placeholder="请输入原始密码"
  25. :rules="[{ required: true, message: '请输入原始密码' }]"
  26. ></van-field>
  27. <van-field
  28. v-model="form.new_password"
  29. required
  30. type="password"
  31. label="新密码"
  32. placeholder="请输入新密码"
  33. :rules="[{ required: true, message: '请输入新密码' }]"
  34. ></van-field>
  35. <van-field
  36. v-model="form.confirm_password"
  37. required
  38. type="password"
  39. label="确认密码"
  40. placeholder="请输入确认密码"
  41. :rules="[{ required: true, message: '请输入确认密码' }]"
  42. ></van-field>
  43. </van-cell-group>
  44. <div style="margin: 16px;">
  45. <van-button round block type="primary" native-type="submit">
  46. 提交
  47. </van-button>
  48. </div>
  49. </van-form>
  50. {/block}
  51. {block name="script"}
  52. <script>
  53. function v_setup() {
  54. let base = {};
  55. base.form = Vue.reactive({
  56. old_password: '',
  57. new_password: '',
  58. confirm_password: '',
  59. });
  60. base.onBack = () => {
  61. location.href = "{:url('index/index')}";
  62. };
  63. //表单提交
  64. base.onSubmit = () => {
  65. postJson('/my/passwordPost',base.form).then(() => {
  66. vant.showDialog({
  67. title: '提示',
  68. message: '修改成功',
  69. }).then(() => {
  70. location.href = "{:url('index/index')}";
  71. });
  72. });
  73. };
  74. return base;
  75. }
  76. </script>
  77. {/block}