Workflow.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <div class="workflow">
  3. <div @click="router.push({ path: '/workflow-add' })" class="gradient workflow-btn flex-center">
  4. <img src="/src/assets/imgs/add.png" alt="">
  5. <div class="">{{ $t('common.publishWorkflow') }}</div>
  6. </div>
  7. <ul class="workflow-list">
  8. <li @click="toDetail(item)" v-for="(item, index) in list" :key="index" class="">
  9. <img class="image" :src="item.coverImage" alt="">
  10. <div class="kong"></div>
  11. <div class="workflow-list-con flex-column flex-between">
  12. <div class="top">
  13. <div class="workflow-list-time flex-align-center">
  14. <img src="/src/assets/imgs/rili.png" alt="">
  15. <div class="">{{ item.createTime }}</div>
  16. </div>
  17. <div class="title">{{ item.workflowTitle }}</div>
  18. <div class="desc">{{ item.description }}</div>
  19. </div>
  20. <div class="flex_1">
  21. <div class="info flex-center-between">
  22. <div class="info-left flex-align-center">
  23. <el-avatar :size="30" :src="item.userAvatar" />
  24. <div class="">{{ item.nickName }}</div>
  25. </div>
  26. <div class="info-right flex-align-center">
  27. <img src="/src/assets/imgs/yun.png" alt="">
  28. <div class="">{{ item.categoryName1 }}{{ $t('common.platform') }}</div>
  29. </div>
  30. </div>
  31. <div class="footer flex-center-between">
  32. <div @click.stop="changeItem(item, index, 0)" class="flex-center btn">
  33. <img src="/src/assets/imgs/my/edit@2x.png" alt="">
  34. <div class="">{{ $t('common.edit') }}</div>
  35. </div>
  36. <div @click.stop="changeItem(item, index, 1)" class="flex-center btn">
  37. <img src="/src/assets/imgs/my/del@2x.png" alt="">
  38. <div class="">{{ $t('common.delete') }}</div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </li>
  44. </ul>
  45. <template v-if="list.length">
  46. <Pagination :total="form.total" :page-size="form.pageSize" :current-page="form.pageNum"
  47. @page-change="handlePageChange" />
  48. </template>
  49. <el-empty v-else :description="$t('common.empty')" />
  50. </div>
  51. </template>
  52. <script setup lang="ts">
  53. import Pagination from '@/components/Pagination.vue'
  54. import { ref, onMounted } from 'vue';
  55. import { useRoute, useRouter } from 'vue-router'
  56. import { userPublishList, delectPublish } from '@/api/my'
  57. import { ElMessageBox } from 'element-plus'
  58. import DGTMessage from '@/utils/message'
  59. import { useI18n } from 'vue-i18n'
  60. const { t } = useI18n()
  61. const route = useRoute()
  62. const router = useRouter()
  63. let list = ref([])
  64. const form = ref({
  65. categoryId1: null,
  66. categoryId2: null,
  67. categoryId3: null,
  68. workflowTitle: '',
  69. orderByColumn: 'create_time',
  70. isAsc: 'desc',
  71. pageNum: 1,
  72. pageSize: 10,
  73. total: 0,
  74. })
  75. // 去工作流详情
  76. const toDetail = (item: any) => {
  77. router.push({
  78. path: '/workflow-detail',
  79. query: {
  80. publishId: item.publishId,
  81. metaTitle: 'route.WorkflowDetail'
  82. }
  83. })
  84. }
  85. // 编辑删除
  86. const changeItem = async (item: any, index: any, type: any) => {
  87. if (type == 0) {
  88. router.push({
  89. path: '/workflow-add',
  90. query: {
  91. id: item.publishId
  92. }
  93. })
  94. } else if (type == 1) {
  95. ElMessageBox.confirm(
  96. 'proxy will permanently delete the file. Continue?',
  97. 'Warning',
  98. {
  99. confirmButtonText: 'OK',
  100. cancelButtonText: 'Cancel',
  101. type: 'warning',
  102. }
  103. )
  104. .then(async () => {
  105. let res = await delectPublish(item.publishId);
  106. if (res.code === 200) {
  107. DGTMessage.success(`${t('common.delete')} ${t('common.success')}`)
  108. getList()
  109. }
  110. })
  111. .catch(() => {
  112. })
  113. }
  114. }
  115. const getList = async () => {
  116. let res = await userPublishList(form.value);
  117. form.value.total = res.total;
  118. list.value = res.rows
  119. }
  120. const handlePageChange = (page) => {
  121. list.value = []
  122. form.value.pageNum = page;
  123. getList()
  124. }
  125. onMounted(() => {
  126. getList()
  127. })
  128. </script>
  129. <style scoped lang="scss">
  130. ul,
  131. li {
  132. margin: 0;
  133. padding: 0;
  134. }
  135. .workflow {
  136. padding: 16px 0 20px;
  137. .workflow-btn {
  138. height: 50px;
  139. color: #FFFFFF;
  140. cursor: pointer;
  141. border-radius: 10px;
  142. font-size: 18px;
  143. &:hover {
  144. opacity: 0.9;
  145. }
  146. img {
  147. width: 30px;
  148. height: 30px;
  149. margin-right: 4px;
  150. }
  151. }
  152. .workflow-list {
  153. gap: 16px;
  154. display: flex;
  155. flex-wrap: wrap;
  156. margin-top: 16px;
  157. li {
  158. width: 380px;
  159. cursor: pointer;
  160. position: relative;
  161. background: #F5F7FA;
  162. border-radius: 16px;
  163. overflow: hidden;
  164. border: 1px solid #FFFFFF;
  165. .image {
  166. width: 100%;
  167. height: 204px;
  168. display: block;
  169. object-fit: cover;
  170. border-radius: 16px 16px 0 0;
  171. }
  172. .kong {
  173. height: 166px;
  174. }
  175. .workflow-list-con {
  176. height: 224px;
  177. padding: 16px;
  178. left: 0;
  179. right: 0;
  180. bottom: 0;
  181. position: absolute;
  182. transform: translateY(58px);
  183. transition: transform 0.3s ease;
  184. background: #F5F7FA;
  185. border-radius: 0px 0px 16px 16px;
  186. .top {
  187. line-height: 1;
  188. height: 120px;
  189. display: flex;
  190. flex-direction: column;
  191. }
  192. .workflow-list-time {
  193. font-size: 14px;
  194. img {
  195. width: 16px;
  196. height: 16px;
  197. margin-right: 8px;
  198. }
  199. }
  200. .title {
  201. margin: 8px 0;
  202. font-size: 18px;
  203. font-weight: bold;
  204. display: -webkit-box;
  205. -webkit-box-orient: vertical;
  206. -webkit-line-clamp: 2;
  207. overflow: hidden;
  208. text-overflow: ellipsis;
  209. line-height: 26px;
  210. }
  211. .desc {
  212. white-space: nowrap;
  213. overflow: hidden;
  214. text-overflow: ellipsis;
  215. }
  216. .info {
  217. font-size: 14px;
  218. .info-left {
  219. div {
  220. margin-left: 8px;
  221. }
  222. }
  223. .info-right {
  224. padding: 0 4px;
  225. height: 22px;
  226. background: #E9F3FF;
  227. border-radius: 4px;
  228. img {
  229. width: 16px;
  230. height: 16px;
  231. margin-right: 8px;
  232. }
  233. }
  234. }
  235. .footer {
  236. margin-top: 8px;
  237. .btn {
  238. width: 166px;
  239. height: 40px;
  240. font-size: 14px;
  241. color: #2D71FF;
  242. background: #FFFFFF;
  243. border-radius: 10px;
  244. img {
  245. width: 16px;
  246. height: 16px;
  247. margin-right: 4px;
  248. }
  249. &:last-child {
  250. color: #E43434;
  251. }
  252. &:hover {
  253. opacity: 0.7;
  254. }
  255. }
  256. }
  257. }
  258. &:hover {
  259. .workflow-list-con {
  260. transform: translateY(0);
  261. }
  262. }
  263. }
  264. }
  265. }
  266. </style>