index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div v-show="modelValue" class="edit-container">
  3. <div class="edit-header">
  4. <div class="title">视频标签</div>
  5. <i class="close" @click="handleClose" />
  6. </div>
  7. <div class="edit-content">
  8. <div class="title-box">
  9. <div class="title">当前标签</div>
  10. </div>
  11. <div class="tags">
  12. <div v-for="(item, index) in tags" :key="index" class="tag">{{ item.dict_label }}</div>
  13. </div>
  14. <div class="title-box">
  15. <div class="title">新建标签</div>
  16. </div>
  17. <div class="tags">
  18. <div class="tag">{{ addTag }}</div>
  19. <el-input v-model="addTag" class="custom-input" placeholder="不超过20个字,回车添加" @keyup.enter="handleAdd"></el-input>
  20. </div>
  21. <div class="title-box2">
  22. <div class="title">最近标签</div>
  23. </div>
  24. <div class="tags">
  25. <div v-for="(item, index) in recentTags" :key="index" class="tag" @click="handleAdd2(item)">{{ item.dict_label }}</div>
  26. </div>
  27. <div class="title-box3">
  28. <i class="icon-type" />
  29. <div class="title">类型</div>
  30. <el-select
  31. v-model="type"
  32. :teleported="false"
  33. class="custom-select"
  34. popper-class="custom-select-popper"
  35. style="width: 140px; margin-bottom: 10px"
  36. >
  37. <el-option label="全部" value="lx" />
  38. <el-option v-for="item in video_tag_type" :key="item.value" :label="item.label" :value="item.value" />
  39. </el-select>
  40. </div>
  41. <div class="tags">
  42. <div v-for="(item, index) in typeTags" :key="index" class="tag" @click="handleAdd2(item)">{{ item.dict_label }}</div>
  43. </div>
  44. <div class="title-box3">
  45. <i class="icon-industry" />
  46. <div class="title">行业</div>
  47. <el-select
  48. v-model="industry"
  49. :teleported="false"
  50. class="custom-select"
  51. popper-class="custom-select-popper"
  52. style="width: 140px; margin-bottom: 10px"
  53. >
  54. <el-option label="全部" value="hy" />
  55. <el-option v-for="item in video_tag_industry" :key="item.value" :label="item.label" :value="item.value" />
  56. </el-select>
  57. </div>
  58. <div class="tags">
  59. <div v-for="(item, index) in industryTags" :key="index" class="tag" @click="handleAdd2(item)">{{ item.dict_label }}</div>
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <script lang="ts" setup name="VideoTagEdit">
  65. import {
  66. addVideoTag,
  67. addVideoTagLabel,
  68. getLxHyVideoTagInfo,
  69. getRecentlyVideoTagInfo,
  70. getVideoTagInfo
  71. } from '@/api/videoMonitor';
  72. const props = defineProps({
  73. modelValue: Boolean,
  74. tags: [],
  75. id: String
  76. });
  77. const emits = defineEmits(['update:modelValue', 'updateVideoTag']);
  78. const proxy = getCurrentInstance()?.proxy;
  79. const { video_tag_type, video_tag_industry } = toRefs<any>(proxy?.useDict('video_tag_type', 'video_tag_industry'));
  80. let addTag = ref('');
  81. let recentTags = ref([]);
  82. let type = ref('lx');
  83. let typeTags = ref([]);
  84. let industry = ref('hy');
  85. let industryTags = ref([]);
  86. const getTypeList = () => {
  87. getLxHyVideoTagInfo({ dict_value: type.value }).then((res) => {
  88. typeTags.value = res.data;
  89. });
  90. };
  91. const getIndustryList = () => {
  92. getLxHyVideoTagInfo({ dict_value: industry.value }).then((res) => {
  93. industryTags.value = res.data;
  94. });
  95. };
  96. watch(
  97. () => props.id,
  98. () => {
  99. if (!!props.id) {
  100. getRecentlyVideoTagInfo().then((res) => {
  101. recentTags.value = res.data;
  102. });
  103. getTypeList();
  104. getIndustryList();
  105. } else {
  106. addTag.value = '';
  107. recentTags.value = [];
  108. typeTags.value = [];
  109. industryTags.value = [];
  110. }
  111. },
  112. {
  113. immediate: true
  114. }
  115. );
  116. //关闭
  117. const handleClose = () => {
  118. emits('update:modelValue', false);
  119. };
  120. const handleAdd = () => {
  121. addVideoTagLabel({
  122. video_code: props.id,
  123. dict_label: addTag.value,
  124. dict_type: 'video_type'
  125. }).then(() => {
  126. emits('updateVideoTag');
  127. });
  128. addTag.value = '';
  129. };
  130. const handleAdd2 = (item) => {
  131. addVideoTag({ video_code: props.id, dict_value: item.dict_value, dict_type: 'video_type' }).then(() => {
  132. emits('updateVideoTag');
  133. });
  134. };
  135. </script>
  136. <style lang="scss" scoped>
  137. .edit-container {
  138. position: absolute;
  139. top: 50%;
  140. left: 50%;
  141. transform: translate(-50%, -50%);
  142. z-index: 100;
  143. width: 407px;
  144. height: 602px;
  145. background: url('@/assets/images/videoTagEdit/box1.png') no-repeat;
  146. background-size: 100% 100%;
  147. .edit-header {
  148. height: 40px;
  149. display: flex;
  150. justify-content: space-between;
  151. align-items: center;
  152. padding: 0 20px;
  153. position: relative;
  154. .title {
  155. color: transparent;
  156. background-image: linear-gradient(to bottom, #ffffff 30%, #edf7fe 50%, #5cc4fa 70%, #40a2e7 100%);
  157. -webkit-background-clip: text;
  158. background-clip: text;
  159. display: inline-block;
  160. font-family: 'YouSheBiaoTiHei';
  161. font-size: 24px;
  162. }
  163. .close {
  164. width: 16px;
  165. height: 16px;
  166. background: url('@/assets/images/videoTagEdit/close.png') no-repeat;
  167. background-size: 100% 100%;
  168. cursor: pointer;
  169. }
  170. &::before {
  171. content: '';
  172. width: 43px;
  173. height: 18px;
  174. background: url('@/assets/images/videoTagEdit/line1.png') no-repeat;
  175. background-size: 100% 100%;
  176. position: absolute;
  177. bottom: -8px;
  178. left: 0;
  179. }
  180. &::after {
  181. content: '';
  182. width: calc(100% - 83px);
  183. height: 2px;
  184. background: url('@/assets/images/videoTagEdit/line2.png') no-repeat;
  185. background-size: 100% 100%;
  186. position: absolute;
  187. bottom: 0;
  188. left: 47px;
  189. }
  190. }
  191. .edit-content {
  192. margin-top: 10px;
  193. height: 500px;
  194. overflow-y: auto;
  195. .title-box {
  196. width: 379px;
  197. height: 39px;
  198. background: url('@/assets/images/map/titleBox3.png') no-repeat;
  199. background-size: 100% 100%;
  200. padding-left: 30px;
  201. margin-top: 10px;
  202. .title {
  203. font-size: 16px;
  204. }
  205. }
  206. .title-box2 {
  207. width: 135px;
  208. height: 24px;
  209. background: url('@/assets/images/map/rightMenu/titleBox2.png') no-repeat bottom left;
  210. background-size: 135px 20px;
  211. padding-left: 30px;
  212. margin-top: 10px;
  213. .title {
  214. font-size: 16px;
  215. color: #96aac1;
  216. }
  217. }
  218. .title-box3 {
  219. display: flex;
  220. align-items: center;
  221. margin-top: 10px;
  222. .title {
  223. font-size: 16px;
  224. color: #96aac1;
  225. margin: 0 6px;
  226. }
  227. .icon-type {
  228. width: 28px;
  229. height: 26px;
  230. background: url('@/assets/images/videoTagEdit/type.png') no-repeat;
  231. background-size: 100% 100%;
  232. }
  233. .icon-industry {
  234. width: 26px;
  235. height: 27px;
  236. background: url('@/assets/images/videoTagEdit/industry.png') no-repeat;
  237. background-size: 100% 100%;
  238. }
  239. }
  240. .tags {
  241. display: flex;
  242. flex-wrap: wrap;
  243. align-items: center;
  244. margin-top: -5px;
  245. .tag {
  246. min-width: 126px;
  247. height: 26px;
  248. background: url('@/assets/images/map/tag.png') no-repeat;
  249. background-size: 100% 100%;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. margin-top: 10px;
  254. padding: 0 20px 0 15px;
  255. cursor: pointer;
  256. }
  257. .custom-input {
  258. width: 230px;
  259. margin-left: 20px;
  260. margin-top: 10px;
  261. }
  262. }
  263. }
  264. }
  265. </style>