Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

settings.vue 2.0 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class="page">
  3. <h2>Settings</h2>
  4. <section class="form inputs">
  5. <h3>Avatar</h3>
  6. <canvas width="200" height="200" ref="canvas"></canvas>
  7. <input type="file"
  8. @change="e => changeAvatar(e.target.files[0])"
  9. />
  10. <button>Upload</button>
  11. </section>
  12. <section class="form inputs">
  13. <h3>Letterhead</h3>
  14. <span>Header as appears on PDFs.</span>
  15. <img src="/assets/image/mintberry.jpg" alt="avatar">
  16. <button>Upload</button>
  17. </section>
  18. <section class="form inputs special">
  19. <h3>Profile</h3>
  20. <label for="">First Name</label>
  21. <input type="text">
  22. <label for="">Last Name</label>
  23. <input type="text">
  24. <label for="">NMLS ID</label>
  25. <input type="text">
  26. <label for="">Branch ID</label>
  27. <input type="text">
  28. <select id="" name="" >
  29. <option value="usa">USA</option>
  30. <option value="canada">Canada</option>
  31. </select>
  32. <button @click="check">Save</button>
  33. </section>
  34. <section class="form inputs special">
  35. <h3>Login</h3>
  36. <label for="">Email</label>
  37. <input type="text">
  38. <label for="">New Password</label>
  39. <input type="text">
  40. <button @click="check">Save</button>
  41. </section>
  42. <Dialog v-if="ready" @close="() => ready = false">
  43. <h3>Confirm your current password to save changes.</h3>
  44. <input type="text">
  45. <button>Confirm</button>
  46. </Dialog>
  47. </div>
  48. </template>
  49. <script setup>
  50. import { ref, watch } from "vue"
  51. import Dialog from "./dialog.vue"
  52. let avatar = ref(null)
  53. let ready = ref(false)
  54. let avatarChanged = ref(false)
  55. const canvas = ref(null)
  56. const props = defineProps(['user', 'token'])
  57. function save() {
  58. }
  59. function check() {
  60. ready.value = true
  61. }
  62. function uploadAvatar(blob) {
  63. }
  64. function changeAvatar(blob) {
  65. avatar.value = blob
  66. createImageBitmap(blob,
  67. {resizeWidth: 200, resizeHeight: 200, resizeQuality: 'medium'}).
  68. then((img) => {
  69. avatar.value = img
  70. canvas.value.getContext("2d").drawImage(img, 0, 0, 200, 200)
  71. canvas.value.toBlob(b => {
  72. console.log(b)
  73. })
  74. })
  75. }
  76. watch(props.user, () => {
  77. changeAvatar(props.user.avatar)
  78. })
  79. </script>