index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <template>
  2. <div class="application-overview">
  3. <!-- 右侧主内容区 -->
  4. <div class="main-content">
  5. <div style="display: flex; justify-content: space-between; padding-right: 30px">
  6. <!-- 搜索栏 -->
  7. <div class="search-bar">
  8. <el-input placeholder="请输入应用名称关键字" v-model="searchKeyword" class="search-input">
  9. <!-- <template #append>
  10. <el-button type="primary" class="search-btn">搜索</el-button>
  11. </template> -->
  12. </el-input>
  13. <el-button type="primary" class="search-btn" @click="getDmsDataList">搜索</el-button>
  14. </div>
  15. <!-- 应用范围过滤 -->
  16. <!-- <div class="filter-tabs">
  17. <el-radio-group v-model="activeTab" size="medium" @change="handleTabChange" v-for="item in buffOptions" :key="item.value">
  18. <el-radio-button :label="item.label">{{ item.value }}</el-radio-button>
  19. </el-radio-group>
  20. </div> -->
  21. <!-- 应用标签过滤 -->
  22. <div class="filter-group">
  23. <el-radio-group
  24. v-model="tagFilter"
  25. size="medium"
  26. @change="handleTagFilterChange"
  27. v-for="item in tagOptions"
  28. :key="item.value"
  29. >
  30. <el-radio-button :label="item.label">{{ item.value }}</el-radio-button>
  31. </el-radio-group>
  32. </div>
  33. </div>
  34. <!-- 应用卡片网格 -->
  35. <div class="app-content">
  36. <div class="applications-grid">
  37. <div class="application-card" v-for="(app, index) in applications" :key="index">
  38. <div class="card-image">
  39. <div
  40. v-if="app.issf != '0'"
  41. style="
  42. position: absolute;
  43. background: #0e3a74;
  44. border-radius: 5px 0px 5px 0px;
  45. width: 30px;
  46. height: 30px;
  47. "
  48. >
  49. <el-icon :size="20" color="yellow" style="position: relative; left: 5px; top: 5px">
  50. <StarFilled />
  51. </el-icon>
  52. </div>
  53. <img :src="curUrl + app.c_picture" :alt="app.title" />
  54. </div>
  55. <div class="card-content">
  56. <div class="app-header">
  57. <h3 class="app-name">{{ app.title }}</h3>
  58. <!-- <span class="app-level">{{ app.buffName }}</span> -->
  59. <span class="app-version">{{ app.version }}</span>
  60. </div>
  61. <div class="app-tags">
  62. <el-tag size="small" type="success">{{ app.buffName }}</el-tag>
  63. <!-- <el-tag size="small" type="success">{{ app.status }}</el-tag> -->
  64. <span v-for="tag in app.tags" :key="tag">
  65. <el-tag size="small" v-if="tag != ''">{{ tag }}</el-tag>
  66. </span>
  67. </div>
  68. <el-tooltip placement="top" effect="dark">
  69. <template #content>
  70. <div style="max-width: 500px">{{ app.content }}</div>
  71. </template>
  72. <p class="app-description">{{ app.content }}</p>
  73. </el-tooltip>
  74. <div class="app-footer">
  75. <span class="app-date">{{ app.createTime }}</span>
  76. <el-button
  77. type="primary"
  78. size="small"
  79. class="visit-button"
  80. v-if="app.c_url"
  81. @click="handleOpenPage(app)"
  82. >访问</el-button
  83. >
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- 加载更多按钮 -->
  90. <!-- <div class="load-more">
  91. <el-button type="primary" size="medium">查看更多</el-button>
  92. </div> -->
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import appCenter from "@/api/appCenter";
  98. import moment from "moment";
  99. export default {
  100. name: "ApplicationOverview",
  101. data() {
  102. return {
  103. searchKeyword: "",
  104. activeTab: "all",
  105. tagFilter: sessionStorage.getItem("activeTag")
  106. ? parseInt(sessionStorage.getItem("activeTag"))
  107. : "all",
  108. curUrl: systemConfig.dmsDataProxy,
  109. buffOptions: [],
  110. tagOptions: [],
  111. applications: [],
  112. itemApplications: [],
  113. };
  114. },
  115. mounted() {
  116. this.initData();
  117. },
  118. methods: {
  119. handleTabChange() {
  120. // console.log(this.activeTab);
  121. if (this.activeTab == "all") {
  122. this.applications = this.itemApplications;
  123. } else {
  124. this.applications = this.itemApplications.filter((item) => item.appbuff == this.activeTab);
  125. }
  126. },
  127. handleTagFilterChange() {
  128. if (this.tagFilter == "all") {
  129. sessionStorage.setItem("activeTag", "");
  130. this.applications = this.itemApplications;
  131. } else {
  132. sessionStorage.setItem("activeTag", this.tagFilter);
  133. this.applications = this.itemApplications.filter((item) =>
  134. item.apptags.split(",").includes(this.tagFilter.toString())
  135. );
  136. }
  137. },
  138. initData() {
  139. this.getDmsCNameAType();
  140. this.getDmsTagSName();
  141. this.getDmsDataList();
  142. },
  143. handleOpenPage(param) {
  144. if (param.c_url) {
  145. if(param.c_url.indexOf(":2024") > -1){
  146. window.open(param.c_url + "?token=" + localStorage.getItem("token"), "_blank");
  147. }else{
  148. window.open(param.c_url, "_blank");
  149. }
  150. }
  151. },
  152. getDmsTagSName() {
  153. let requestParams = {
  154. sName: "tag",
  155. };
  156. appCenter.getDmsSName(requestParams).then((res) => {
  157. if (res.code === 200) {
  158. this.tagOptions = res.content.map((item) => ({
  159. label: item.index,
  160. value: item.name,
  161. }));
  162. let allOption = {
  163. label: "all",
  164. value: "全部",
  165. };
  166. this.tagOptions.unshift(allOption);
  167. }
  168. });
  169. },
  170. getDmsCNameAType() {
  171. let allOption = {
  172. label: "all",
  173. value: "全部",
  174. };
  175. this.buffOptions.unshift(allOption);
  176. let obj = this.$getDmsTypes("applevel");
  177. for (let key in obj) {
  178. this.buffOptions.push({
  179. label: key,
  180. value: obj[key],
  181. });
  182. }
  183. // let requestParams = {
  184. // cName: "applevel",
  185. // type: 0,
  186. // };
  187. // appCenter.getDmsCNameAType(requestParams).then((res) => {
  188. // if (res.code === 200) {
  189. // this.buffOptions = res.content.map(item => ({
  190. // label: item.index,
  191. // value: item.name
  192. // }));
  193. // let allOption = {
  194. // label: 'all',
  195. // value: '全部'
  196. // }
  197. // this.buffOptions.unshift(allOption);
  198. // }
  199. // });
  200. },
  201. getDmsDataList() {
  202. let requestParams = {
  203. columnId: systemConfig.columnIds[1], // 应用中心栏目id
  204. states: 0,
  205. orderBy: JSON.stringify([{ field: "frame_time", orderByType: 2 }]),
  206. pageSize: 9999,
  207. page: 0,
  208. };
  209. if (this.searchKeyword) {
  210. requestParams.search = JSON.stringify([
  211. {
  212. field: "title",
  213. searchType: 2,
  214. content: { value: "%" + this.searchKeyword + "%" },
  215. },
  216. ]);
  217. }
  218. appCenter.getDmsDataList(requestParams).then((res) => {
  219. if (res.code === 200) {
  220. this.itemApplications = res.content.data.map((item) => ({
  221. ...item,
  222. status:
  223. item.status === 0
  224. ? "待审核"
  225. : item.status === 1
  226. ? "待发布"
  227. : item.status === 2
  228. ? "未完成"
  229. : "已完成",
  230. buffName:
  231. this.buffOptions.find((info) => info.label == item.appbuff.trim())?.value || "",
  232. tags: item.apptags
  233. .split(",")
  234. .map((tag) => this.tagOptions.find((info) => info.label == tag.trim())?.value || ""),
  235. createTime: moment(item.create_time).format("YYYY-MM-DD HH:mm:ss"),
  236. }));
  237. this.applications = this.itemApplications;
  238. // this.handleTabChange();
  239. this.handleTagFilterChange();
  240. } else {
  241. this.applications = [];
  242. }
  243. });
  244. },
  245. },
  246. };
  247. </script>
  248. <style lang="less" scoped>
  249. .application-overview {
  250. display: flex;
  251. width: 100%;
  252. background-color: #00002a;
  253. color: #ffffff;
  254. }
  255. /* 右侧主内容区 */
  256. .main-content {
  257. flex: 1;
  258. padding: 5px 30px;
  259. overflow-y: auto;
  260. }
  261. /* 搜索栏样式 */
  262. .search-bar {
  263. margin-bottom: 20px;
  264. .search-input {
  265. width: 400px;
  266. // ::v-deep .el-input__inner {
  267. // background-color: rgba(255, 255, 255, 0.1);
  268. // border: 1px solid rgba(255, 255, 255, 0.2);
  269. // color: #ffffff;
  270. // &::placeholder {
  271. // color: rgba(255, 255, 255, 0.6);
  272. // }
  273. // }
  274. // ::v-deep .el-input__prepend {
  275. // background-color: rgba(255, 255, 255, 0.1);
  276. // border-color: rgba(255, 255, 255, 0.2);
  277. // color: rgba(255, 255, 255, 0.8);
  278. // }
  279. }
  280. .search-btn {
  281. margin-left: 10px;
  282. }
  283. }
  284. /* 过滤标签样式 */
  285. .filter-tabs {
  286. margin-bottom: 30px;
  287. :deep(.el-radio-group) {
  288. .el-radio-button {
  289. background-color: rgba(255, 255, 255, 0.1);
  290. border-color: rgba(255, 255, 255, 0.2);
  291. color: rgba(255, 255, 255, 0.8);
  292. &:first-child .el-radio-button__inner {
  293. border-left-color: rgba(255, 255, 255, 0.2);
  294. }
  295. .el-radio-button__inner {
  296. background-color: transparent;
  297. border-color: rgba(255, 255, 255, 0.2);
  298. color: rgba(255, 255, 255, 0.8);
  299. }
  300. &.is-active {
  301. background-color: #1890ff;
  302. .el-radio-button__inner {
  303. background-color: #1890ff;
  304. border-color: #1890ff;
  305. color: #ffffff;
  306. }
  307. }
  308. }
  309. }
  310. }
  311. .app-content {
  312. // height: 640px;
  313. height: calc(100vh - 160px);
  314. overflow: auto;
  315. padding-right: 20px;
  316. }
  317. /* 应用卡片网格样式 */
  318. .applications-grid {
  319. display: grid;
  320. grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  321. gap: 25px;
  322. }
  323. /* 应用卡片样式 */
  324. .application-card {
  325. background-color: rgba(255, 255, 255, 0.05);
  326. border: 1px solid rgba(255, 255, 255, 0.1);
  327. border-radius: 8px;
  328. overflow: hidden;
  329. transition: all 0.3s ease;
  330. &:hover {
  331. transform: translateY(-5px);
  332. box-shadow: 0 10px 30px rgba(24, 144, 255, 0.2);
  333. border-color: rgba(24, 144, 255, 0.4);
  334. }
  335. .card-image {
  336. width: 100%;
  337. height: 160px;
  338. overflow: hidden;
  339. position: relative;
  340. img {
  341. width: 100%;
  342. height: 100%;
  343. object-fit: cover;
  344. transition: transform 0.3s ease;
  345. }
  346. // &:hover img {
  347. // transform: scale(1.05);
  348. // }
  349. }
  350. .card-content {
  351. padding: 15px;
  352. }
  353. .app-header {
  354. display: flex;
  355. justify-content: space-between;
  356. align-items: center;
  357. margin-bottom: 10px;
  358. .app-name {
  359. font-size: 16px;
  360. font-weight: bold;
  361. margin: 0;
  362. color: #ffffff;
  363. }
  364. .app-level {
  365. font-size: 12px;
  366. color: rgba(255, 255, 255, 0.6);
  367. background-color: rgba(27, 117, 236, 0.8);
  368. padding: 2px 6px;
  369. border-radius: 4px;
  370. }
  371. .app-version {
  372. font-size: 12px;
  373. color: rgba(255, 255, 255, 0.6);
  374. background-color: rgba(255, 255, 255, 0.1);
  375. padding: 2px 6px;
  376. border-radius: 4px;
  377. }
  378. }
  379. .app-tags {
  380. margin-bottom: 10px;
  381. .el-tag {
  382. margin-right: 5px;
  383. margin-bottom: 5px;
  384. }
  385. }
  386. .app-description {
  387. font-size: 13px;
  388. line-height: 1.6;
  389. color: rgba(255, 255, 255, 0.7);
  390. margin-bottom: 15px;
  391. overflow: hidden;
  392. text-overflow: ellipsis;
  393. display: -webkit-box;
  394. -webkit-line-clamp: 2;
  395. -webkit-box-orient: vertical;
  396. }
  397. .app-footer {
  398. display: flex;
  399. justify-content: space-between;
  400. align-items: center;
  401. .app-date {
  402. font-size: 12px;
  403. color: rgba(255, 255, 255, 0.5);
  404. }
  405. .visit-button {
  406. padding: 4px 12px;
  407. font-size: 12px;
  408. border-radius: 4px;
  409. }
  410. }
  411. }
  412. /* 加载更多按钮 */
  413. .load-more {
  414. text-align: center;
  415. margin-bottom: 30px;
  416. .el-button {
  417. padding: 10px 30px;
  418. background-color: rgba(24, 144, 255, 0.2);
  419. border-color: rgba(24, 144, 255, 0.4);
  420. color: #1890ff;
  421. &:hover {
  422. background-color: rgba(24, 144, 255, 0.3);
  423. border-color: rgba(24, 144, 255, 0.6);
  424. }
  425. }
  426. }
  427. /* 响应式设计 */
  428. @media (max-width: 1200px) {
  429. .applications-grid {
  430. grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  431. gap: 20px;
  432. }
  433. }
  434. @media (max-width: 992px) {
  435. .sidebar {
  436. width: 180px;
  437. .sidebar-menu .menu-item {
  438. padding: 12px 15px;
  439. i {
  440. font-size: 16px;
  441. }
  442. }
  443. }
  444. .main-content {
  445. padding: 15px 20px;
  446. }
  447. .search-input {
  448. width: 300px !important;
  449. }
  450. .applications-grid {
  451. grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  452. gap: 15px;
  453. }
  454. }
  455. /* 在你的组件或全局样式文件中 */
  456. .custom-tooltip-width {
  457. width: 200px; /* 设置你想要的宽度 */
  458. }
  459. </style>