sale_vod_publish_bk.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div class="mainContainer">
  3. <div class="pform-head">
  4. <h3>发布课程</h3>
  5. </div>
  6. <div class="pform-body">
  7. <el-form :model="vodForm" label-width="100px">
  8. <el-form-item label="课程所属UID">
  9. <el-input v-model="vodForm.uid" placeholder="用户UID" style="width:200px"></el-input>
  10. </el-form-item>
  11. <el-form-item label="课程标题">
  12. <el-input v-model="vodForm.title"></el-input>
  13. </el-form-item>
  14. <el-form-item label="课程大纲">
  15. <el-input type="textarea" v-model="vodForm.content" placeholder="请输入内容"
  16. minlength="5"
  17. maxlength="5000" rows="6"
  18. show-word-limit></el-input>
  19. </el-form-item>
  20. <el-form-item label="课程价格">
  21. <el-input v-model="vodForm.price" placeholder="单位:元" style="width:200px"></el-input>
  22. </el-form-item>
  23. <el-form-item label="课程首页图" prop="img">
  24. <el-upload
  25. class="img-uploader"
  26. action="/api/admin/cert/uploadImg"
  27. :show-file-list="false"
  28. :on-success="handleAvatarSuccess"
  29. :before-upload="beforeAvatarUpload"
  30. >
  31. <img v-if="vodForm.img_icon" :src="vodForm.img_icon" class="img" />
  32. <i v-else class="el-icon-plus img-uploader-icon"></i>
  33. </el-upload>
  34. </el-form-item>
  35. </el-form>
  36. <div class="uploader">
  37. <UploadAuth :getUserData="getUserData" />
  38. </div>
  39. <div slot="footer">
  40. <el-button type="primary" style="margin-left: 100px;">确认发布</el-button>
  41. </div>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import UploadAuth from "@/components/videoUpload/src/UploadAuth";
  47. export default {
  48. data() {
  49. return {
  50. vodForm:{
  51. title:'',
  52. content:'',
  53. uid:'',
  54. price:'',
  55. img_icon:''
  56. }
  57. }
  58. },
  59. components: {
  60. UploadAuth
  61. },
  62. computed: {
  63. },
  64. mounted() {
  65. },
  66. methods: {
  67. handleAvatarSuccess(res, file) {
  68. this.vodForm.img_icon = res.data.img_icon
  69. },
  70. beforeAvatarUpload(file) {
  71. return true
  72. },
  73. async getUserData(filename, callback) {
  74. let res = await this.$post("/api/admin/upload/video", {filename: filename});
  75. if (res && res.status === 1) {
  76. let data = res.data;
  77. callback(JSON.stringify({Vod:data}));
  78. }
  79. },
  80. }
  81. };
  82. </script>
  83. <style>
  84. .pform-head{
  85. text-align: center;
  86. }
  87. .pform-body{
  88. margin: 20px 200px;
  89. }
  90. .img-uploader .el-upload {
  91. border: 1px dashed #d9d9d9;
  92. border-radius: 6px;
  93. cursor: pointer;
  94. position: relative;
  95. overflow: hidden;
  96. }
  97. .img-uploader .el-upload:hover {
  98. border-color: #409eff;
  99. }
  100. .img-uploader-icon {
  101. font-size: 28px;
  102. color: #8c939d;
  103. width: 178px;
  104. height: 178px;
  105. line-height: 178px;
  106. text-align: center;
  107. }
  108. .img {
  109. width: 270px;
  110. height: 190px;
  111. display: block;
  112. }
  113. .upload-type-switch {
  114. text-align: center;
  115. }
  116. .container {
  117. width: 1200px;
  118. margin: 0 auto;
  119. }
  120. .input-control {
  121. margin: 5px 0;
  122. }
  123. .input-control label {
  124. font-size: 14px;
  125. color: #333;
  126. width: 30%;
  127. text-align: right;
  128. display: inline-block;
  129. vertical-align: middle;
  130. margin-right: 10px;
  131. }
  132. .input-control input {
  133. width: 30%;
  134. height: 30px;
  135. padding: 0 5px;
  136. }
  137. .upload {
  138. padding: 30px 50px;
  139. }
  140. .progress {
  141. font-size: 14px;
  142. }
  143. .progress i {
  144. font-style: normal;
  145. }
  146. .upload-type {
  147. color: #666;
  148. font-size: 12px;
  149. padding: 10px 0;
  150. }
  151. .upload-type button {
  152. margin: 0 10px 0 20px;
  153. }
  154. .status {
  155. font-size: 14px;
  156. margin-left: 30px;
  157. }
  158. .info {
  159. font-size: 14px;
  160. padding-left: 30px;
  161. }
  162. </style>