createdMonthly.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <el-dialog :title="title" :show="show" :visible.sync="monthly_show" width="60%" class="public_task" @close="$emit('update:show', false)">
  3. <div class="blueStripe" />
  4. <el-form ref="monthly_form" :model="monthly_form" label-position="left" label-width="80px">
  5. <el-form-item label="标题">
  6. <el-input v-model="monthly_form.title" placeholder="请输入" />
  7. </el-form-item>
  8. <el-form-item label="缩略图">
  9. <el-upload action="http://star.xiaojukeji.com/upload/img.node" list-type="picture-card" :limit="1" :multiple="false" :on-success="handlePictureCardPreview" :on-remove="handleRemove">
  10. <i class="el-icon-plus" />
  11. <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过5MB</div>
  12. </el-upload>
  13. </el-form-item>
  14. <el-form-item label="素材">
  15. <el-upload action="http://star.xiaojukeji.com/upload/img.node" list-type="picture-card" :limit="1" :multiple="false" :on-success="handlePictureCardPreviewTow" :on-remove="handleRemoveTow">
  16. <i class="el-icon-plus" />
  17. <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过5MB</div>
  18. </el-upload>
  19. </el-form-item>
  20. </el-form>
  21. <span slot="footer" class="dialog-footer">
  22. <el-button @click="monthly_show = false">取 消</el-button>
  23. <el-button type="primary" @click="monthly_dialog">创 建</el-button>
  24. </span>
  25. </el-dialog>
  26. </template>
  27. <script>
  28. export default {
  29. props: {
  30. show: { type: Boolean, default: false },
  31. title: { type: String, required: true }
  32. },
  33. data() {
  34. return {
  35. monthly_show: this.show,
  36. monthly_form: {}
  37. }
  38. },
  39. watch: {
  40. show: {
  41. handler(newV) {
  42. this.monthly_show = newV
  43. },
  44. immediate: true
  45. }
  46. },
  47. methods: {
  48. monthly_dialog() {
  49. this.$emit('monthly_created', this.monthly_form)
  50. this.$emit('update:show', false)
  51. },
  52. handleClose(done) {
  53. this.monthly_show = false
  54. },
  55. handleRemoveTow(file, fileList) {
  56. console.log(file, fileList)
  57. },
  58. handlePictureCardPreviewTow(file) {
  59. this.monthly_form.content = 'http:' + file.url
  60. },
  61. handleRemove(file, fileList) {
  62. console.log(file, fileList)
  63. },
  64. handlePictureCardPreview(file) {
  65. this.monthly_form.thumb = 'http:' + file.url
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .public_task {
  72. /deep/ .el-dialog__title {
  73. line-height: 24px;
  74. font-size: 16px;
  75. color: #303133;
  76. padding-left: 10px;
  77. }
  78. .blueStripe {
  79. width:4px;
  80. height:17px;
  81. background:#409EFF;
  82. border-radius:1px;
  83. position: absolute;
  84. top: 23px;
  85. left: 20px;
  86. }
  87. }
  88. </style>