index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container margin-bottom">
  4. <div style="width:200px; display:inline-block; float:left">
  5. <el-input placeholder="请输入内容" v-model="input" clearable></el-input>
  6. </div>
  7. <div>
  8. <el-select
  9. style="display:inline-block; float:left; margin-left:15px; width:150px"
  10. v-model="value1"
  11. placeholder="分类"
  12. >
  13. <el-option
  14. v-for="item in options1"
  15. :key="item.value"
  16. :label="item.label"
  17. :value="item.value"
  18. ></el-option>
  19. </el-select>
  20. <el-select
  21. style="display:inline-block; float:left; margin-left:15px; width:150px"
  22. v-model="value2"
  23. placeholder="格式"
  24. >
  25. <el-option
  26. v-for="item in options2"
  27. :key="item.value"
  28. :label="item.label"
  29. :value="item.value"
  30. ></el-option>
  31. </el-select>
  32. <el-select
  33. style="display:inline-block; float:left; margin-left:15px; width:150px"
  34. v-model="value3"
  35. placeholder="状态"
  36. >
  37. <el-option
  38. v-for="item in options3"
  39. :key="item.value1"
  40. :label="item.label"
  41. :value="item.value"
  42. ></el-option>
  43. </el-select>
  44. <el-button
  45. style="display:inline-block; float:left; margin-left:15px;"
  46. type="primary"
  47. icon="el-icon-search"
  48. >搜索</el-button>
  49. </div>
  50. <el-button
  51. class="inline-block"
  52. type="primary"
  53. icon="el-icon-folder-add"
  54. @click="dialogFormVisible = true"
  55. >新建</el-button>
  56. </div>
  57. <el-table :data="tableData" border style="width: 100%">
  58. <el-table-column label="名称" width="300">
  59. <template slot-scope="scope">
  60. <span style="margin-left: 10px">{{ scope.row.name }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="所属分类" width="300">
  64. <template slot-scope="scope">
  65. <span style="margin-left: 10px">{{ scope.row.sort }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="播放次数" width="200">
  69. <template slot-scope="scope">
  70. <span style="margin-left: 10px">{{ scope.row.time }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="访问量" width="200">
  74. <template slot-scope="scope">
  75. <span style="margin-left: 10px">{{ scope.row.traffic }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="格式" width="200">
  79. <template slot-scope="scope">
  80. <span style="margin-left: 10px">{{ scope.row.type }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="状态" width="200">
  84. <template slot-scope="scope">
  85. <span style="margin-left: 10px">{{ scope.row.status }}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="操作">
  89. <template slot-scope="scope">
  90. <el-button size="mini" type="primary" @click="handleEdit(scope.$index, scope.row)">修改</el-button>
  91. <el-button size="mini" type="success" @click="handleModifyStatus(row,'published')">上架</el-button>
  92. <!-- <el-button size="mini" @click="handleModifyStatus(row,'draft')">下架</el-button> -->
  93. <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. <el-pagination style="margin-top:50px" background layout="prev, pager, next" :total="1000"></el-pagination>
  98. <el-dialog title="新建资料" :visible.sync="dialogFormVisible">
  99. <el-form :model="form">
  100. <el-form-item label="填写名称" :label-width="formLabelWidth">
  101. <el-input v-model="form.name" autocomplete="off"></el-input>
  102. </el-form-item>
  103. <el-form-item label="所在分类" :label-width="formLabelWidth">
  104. <el-select v-model="form.region" placeholder="请选择分类">
  105. <el-option label="区域一" value="区域一"></el-option>
  106. <el-option label="区域二" value="区域二"></el-option>
  107. </el-select>
  108. </el-form-item>
  109. <el-form-item label="文件形式" :label-width="formLabelWidth">
  110. <el-select v-model="form.type" placeholder="请选择文件形式">
  111. <el-option label="视频" value="视频"></el-option>
  112. <el-option label="音频" value="音频"></el-option>
  113. <el-option label="图片" value="图片"></el-option>
  114. <el-option label="文字" value="文字"></el-option>
  115. </el-select>
  116. </el-form-item>
  117. </el-form>
  118. <div slot="footer" class="dialog-footer">
  119. <el-button @click="dialogFormVisible = false">取 消</el-button>
  120. <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
  121. </div>
  122. </el-dialog>
  123. </div>
  124. </template>
  125. <script>
  126. export default {
  127. data() {
  128. return {
  129. input: "",
  130. tableData: [
  131. {
  132. sort: "教育",
  133. name: "王小虎",
  134. time: "2016-05-02",
  135. traffic:"54545",
  136. type:"视频",
  137. status:"下架",
  138. },
  139. {
  140. sort: "教育",
  141. name: "王小虎",
  142. time: "2016-05-02",
  143. traffic:"54545",
  144. type:"视频",
  145. status:"下架",
  146. },
  147. {
  148. sort: "教育",
  149. name: "王小虎",
  150. time: "2016-05-02",
  151. traffic:"54545",
  152. type:"视频",
  153. status:"下架",
  154. },
  155. {
  156. sort: "教育",
  157. name: "王小虎",
  158. time: "2016-05-02",
  159. traffic:"54545",
  160. type:"视频",
  161. status:"下架",
  162. },
  163. {
  164. sort: "教育",
  165. name: "王小虎",
  166. time: "2016-05-02",
  167. traffic:"54545",
  168. type:"视频",
  169. status:"下架",
  170. },
  171. {
  172. sort: "教育",
  173. name: "王小虎",
  174. time: "2016-05-02",
  175. traffic:"54545",
  176. type:"视频",
  177. status:"下架",
  178. }
  179. ],
  180. options1: [
  181. {
  182. value: "选项1",
  183. label: "按分类"
  184. },
  185. {
  186. value: "选项2",
  187. label: "双皮奶"
  188. },
  189. {
  190. value: "选项3",
  191. label: "蚵仔煎"
  192. },
  193. {
  194. value: "选项4",
  195. label: "龙须面"
  196. },
  197. {
  198. value: "选项5",
  199. label: "北京烤鸭"
  200. }
  201. ],
  202. options2: [
  203. {
  204. value: "选项1",
  205. label: "图片"
  206. },
  207. {
  208. value: "选项2",
  209. label: "音频"
  210. },
  211. {
  212. value: "选项3",
  213. label: "视频"
  214. },
  215. {
  216. value: "选项4",
  217. label: "文字"
  218. }
  219. ],
  220. options3: [
  221. {
  222. value: "选项1",
  223. label: "上架"
  224. },
  225. {
  226. value: "选项2",
  227. label: "下架"
  228. }
  229. ],
  230. value1: [],
  231. value2: [],
  232. value3: [],
  233. dialogFormVisible: false,
  234. form: {
  235. name: "",
  236. region: "",
  237. type: "",
  238. date1: "",
  239. date2: "",
  240. delivery: false,
  241. type: [],
  242. resource: "",
  243. desc: ""
  244. },
  245. formLabelWidth: "120px",
  246. methods: {
  247. handleEdit(index, row) {
  248. console.log(index, row);
  249. },
  250. handleDelete(index, row) {
  251. console.log(index, row);
  252. }
  253. }
  254. };
  255. }
  256. };
  257. </script>
  258. <style lang="scss" scoped>
  259. .margin-bottom {
  260. margin-bottom: 65px;
  261. }
  262. .inline-block {
  263. // display: inline-block;
  264. float: left;
  265. margin-left: 15px;
  266. }
  267. </style>