activity_publish.vue 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container" style="padding: 0 20px; background-color: #f6f8f9;">
  7. <div class="edit-main">
  8. <div class="preview-panel">
  9. <preview-form :activity="activity" :paragraph="activity_paragraph"></preview-form>
  10. </div>
  11. <div class="edit-panel">
  12. <edit-form ref="edit_form" :activity="activity" :paragraph="activity_paragraph"></edit-form>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import BreadCrumb from "@/scrm_pages/components/bread-crumb";
  20. import PreviewForm from "@/scrm_pages/marketing_tool/components/edit_activity_preview_form"
  21. import EditForm from "@/scrm_pages/marketing_tool/components/edit_activity_edit_form"
  22. import { fetchActivity } from "@/api/activity/activity"
  23. export default {
  24. name: "ActivityPublish",
  25. components: {
  26. BreadCrumb,
  27. PreviewForm,
  28. EditForm,
  29. },
  30. data() {
  31. return {
  32. crumbs: [
  33. { path: false, name: "营销工具" },
  34. { path: false, name: "发布活动" }
  35. ],
  36. activity: {
  37. id: 0,
  38. poster_photo: "",
  39. title: "",
  40. subtitle: "",
  41. address: "",
  42. limit_num: 0,
  43. sign_up_deadline: 0,
  44. start_time: 0,
  45. phone_number: "",
  46. sign_up_notice: "",
  47. },
  48. activity_paragraph: {
  49. id: 0,
  50. title: "",
  51. content: "",
  52. }
  53. }
  54. },
  55. created() {
  56. var id = this.$route.query.id
  57. if (id != undefined) {
  58. fetchActivity(id).then(rs => {
  59. var resp = rs.data
  60. if (resp.state == 1) {
  61. // console.log(resp.data)
  62. var activity = resp.data.activity
  63. this.activity.id = activity.id
  64. this.activity.poster_photo = activity.poster_photo
  65. this.activity.title = activity.title
  66. this.activity.subtitle = activity.subtitle
  67. this.activity.address = activity.address
  68. this.activity.limit_num = activity.limit_num
  69. this.activity.sign_up_deadline = activity.sign_up_deadline * 1000
  70. this.activity.start_time = activity.start_time * 1000
  71. this.activity.phone_number = activity.phone_number
  72. this.activity.sign_up_notice = activity.sign_up_notice
  73. var paragraph = resp.data.paragraph
  74. this.activity_paragraph.id = paragraph.id
  75. this.activity_paragraph.title = paragraph.title
  76. this.activity_paragraph.content = paragraph.content
  77. this.$refs.edit_form.initForms()
  78. } else {
  79. this.$message.error(resp.msg)
  80. }
  81. }).catch(err => {
  82. this.$message.error(err)
  83. })
  84. }
  85. },
  86. }
  87. </script>
  88. <style scoped rel="stylesheet/scss" lang="scss">
  89. .edit-main {
  90. width: 100%;
  91. display: flex;
  92. min-height: 600px;
  93. height: auto;
  94. box-sizing: border-box;
  95. .preview-panel {
  96. flex: 3;
  97. margin-right: 1rem;
  98. background-color: #fff;
  99. }
  100. .edit-panel {
  101. flex: 4;
  102. padding-bottom: 80px;
  103. background-color: #fff;
  104. }
  105. }
  106. </style>