editDetail.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view class="editDetail">
  3. <uni-menubar title="编辑资料" />
  4. <view>
  5. <tm-sheet>
  6. <tm-input title="真实姓名" v-model="form.realname"></tm-input>
  7. <tm-input title="手机号" v-model="form.mobile"></tm-input>
  8. <tm-input title="微信" v-model="form.wxh"></tm-input>
  9. <tm-input title="公司" v-model="form.company"></tm-input>
  10. <tm-input :vertical="true" :height="100" input-type="textarea" :maxlength="200" title="备注"
  11. v-model="form.content"></tm-input>
  12. <view class="mt-50">
  13. <tm-button block theme="blue" @click="keepClick">提交</tm-button>
  14. </view>
  15. </tm-sheet>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. form: {
  24. uid: "",
  25. realname: "",
  26. mobile: "",
  27. wxh: "",
  28. company: "",
  29. content: "",
  30. }
  31. }
  32. },
  33. onLoad(option) {
  34. if (option.item) {
  35. let detailObj = JSON.parse(option.item)
  36. Object.keys(this.form).forEach(key => {
  37. this.form[key] = detailObj[key]
  38. })
  39. }
  40. },
  41. methods: {
  42. keepClick() {
  43. this.$tm.request.post('user/update', this.form).then(res => {
  44. uni.showToast({
  45. title: "修改成功",
  46. icon: "success"
  47. });
  48. setTimeout(() => {
  49. uni.navigateBack({
  50. success:()=> {
  51. uni.$emit('refresh')
  52. }
  53. })
  54. }, 1000)
  55. })
  56. }
  57. },
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. </style>