about.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="app-container">
  3. <tinymce v-model="introduction" :height="300" />
  4. <el-form ref="dataForm" :rules="rules" :model="from" label-position="left" label-width="80px" style="float: left;margin-top: 20px;">
  5. <el-form-item label="联系我们" prop="contactNumber">
  6. <el-input v-model="from.contactNumber" maxlength="11" placeholder="请输入联系方式" />
  7. </el-form-item>
  8. </el-form>
  9. <div slot="footer" class="dialog-footer" style="float: right;padding:80px 0 80px 0;">
  10. <el-button type="primary" style="width:100px;" :loading="loadingbut" @click="onSubmite()">{{ loadingbuttext }}</el-button>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import Tinymce from '@/components/Tinymce'
  16. import { getOrganizeInfo, updateOrganizeInfo } from '@/api/other'
  17. export default {
  18. components: {
  19. Tinymce
  20. },
  21. data() {
  22. return {
  23. isContent: false,
  24. introduction: '',
  25. loadingbut: false,
  26. loadingbuttext: '提交',
  27. from: {
  28. contactNumber: ''
  29. },
  30. rules: {
  31. contactNumber: [{ required: true, message: '联系方式不能为空', trigger: 'blur' }]
  32. }
  33. }
  34. },
  35. computed: {
  36. organizeID() {
  37. return this.$store.getters.organizeID
  38. }
  39. },
  40. created() {
  41. this.initData()
  42. },
  43. methods: {
  44. initData() {
  45. getOrganizeInfo({ id: this.organizeID }).then(response => {
  46. console.log(response)
  47. this.introduction = response.data.introduction
  48. this.from.contactNumber = response.data.contactNumber
  49. })
  50. },
  51. onSubmite() {
  52. this.$refs['dataForm'].validate((valid) => {
  53. if (valid) {
  54. const Formobj = { id: this.organizeID, introduction: this.introduction }
  55. const params = Object.assign(Formobj, this.from)
  56. this.loadingbut = true
  57. this.loadingbuttext = '提交中'
  58. updateOrganizeInfo(params).then(response => {
  59. this.$message({ message: response.msg, type: 'success', center: true })
  60. this.loadingbut = false
  61. this.loadingbuttext = '提交'
  62. setTimeout(() => {
  63. this.initData()
  64. }, 3000)
  65. })
  66. }
  67. })
  68. }
  69. }
  70. }
  71. </script>
  72. <style scoped>
  73. </style>