index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div>
  3. <div>
  4. <!-- 主菜单界面 -->
  5. <div
  6. class="syno-sds-appview"
  7. :class="cls"
  8. style="width: 100%; height: 100%"
  9. :style="{ display: display }"
  10. @contextmenu.prevent=""
  11. >
  12. <div class="syno-sds-appview-container">
  13. <div class="search-field" style="width: 278px">
  14. <input
  15. type="text"
  16. size="16"
  17. placeholder="搜索"
  18. class="search-field-input"
  19. v-model="keyword"
  20. @click.stop="searchInputFocus"
  21. @input="searchAppView"
  22. />
  23. <button
  24. type="button"
  25. class="search-field-clear-btn"
  26. style="display: none"
  27. ></button>
  28. </div>
  29. </div>
  30. <div class="sds-shortcut-wrapper">
  31. <div class="shortcut-zone" style="width: 13%"></div>
  32. <div class="shortcut-zone right-zone" style="width: 13%"></div>
  33. </div>
  34. <div class="sds-app-panel">
  35. <div
  36. class="v-ps ps ps--active-y"
  37. v-if="desktopAppViewDetail.detailMessageList.length"
  38. >
  39. <div class="app-layout-wrapper" style="width: 74%; height: 100%">
  40. <div
  41. class="sds-desktop-layout search-layout"
  42. style="display: none"
  43. ></div>
  44. <div class="sds-desktop-layout">
  45. <li
  46. class="launch-icon app-item-icon"
  47. v-for="detailMessage in desktopAppViewDetail.detailMessageList"
  48. :key="detailMessage.id"
  49. @click.stop="clickAppViewItem(detailMessage.id)"
  50. @contextmenu.prevent="
  51. contextmenuAppViewItem(
  52. $event,
  53. detailMessage,
  54. detailMessage.selectList
  55. )
  56. "
  57. >
  58. <div
  59. class="image"
  60. :style="{
  61. backgroundImage: `url(${detailMessage.titleImgUrl})`,
  62. }"
  63. >
  64. <div
  65. id="ext-gen50"
  66. class="sds-application-notify-badge-num"
  67. :class="detailMessage.unReadyMessageCls"
  68. v-if="detailMessage.unReadyMessage.length"
  69. ></div>
  70. </div>
  71. <div class="text">{{ detailMessage.title }}</div>
  72. </li>
  73. </div>
  74. </div>
  75. </div>
  76. <div class="sds-desktop-no-result" v-else>找不到符合的项目。</div>
  77. </div>
  78. <PortalTarget></PortalTarget>
  79. </div>
  80. </div>
  81. <AppViewItem
  82. :defaultZIndex="defaultZIndex"
  83. :detailMessageList="desktopAppViewDetail.detailMessageList"
  84. ></AppViewItem>
  85. </div>
  86. </template>
  87. <script>
  88. import AppViewItem from "./AppViewItem";
  89. import PortalTarget from "./PortalTarget";
  90. export default {
  91. props: ["defaultZIndex", "appViewData"],
  92. data() {
  93. return {
  94. desktopAppViewDetail: {
  95. detailMessageList: [],
  96. },
  97. display: "none",
  98. keyword: "",
  99. cls: "",
  100. firstOpen: true,
  101. };
  102. },
  103. created() {
  104. this.desktopAppViewDetail.detailMessageList = this.appViewData;
  105. },
  106. mounted() {
  107. this.$bus.on("showAppView", this.showAppView);
  108. },
  109. methods: {
  110. // 显示appView页面
  111. showAppView() {
  112. this.display = "block";
  113. this.$bus.emit("hiddenOrShowOtherWindow", true);
  114. this.$bus.emit("hiddenPortalTarget");
  115. window.addEventListener("click", this.WindowClick);
  116. if (this.firstOpen) {
  117. this.desktopAppViewDetail.detailMessageList.forEach((item) => {
  118. if (item.unReadyMessage.length) {
  119. item.unReadyMessageCls = "bounce-effect";
  120. }
  121. });
  122. setTimeout(() => {
  123. this.desktopAppViewDetail.detailMessageList.forEach((item) => {
  124. if (item.unReadyMessageCls === "bounce-effect") {
  125. item.unReadyMessageCls = "";
  126. }
  127. });
  128. }, 800);
  129. }
  130. setTimeout(() => {
  131. this.cls = "syno-sds-appview-animate";
  132. }, 0);
  133. this.firstOpen = false;
  134. },
  135. // 搜索框聚焦
  136. searchInputFocus(e) {
  137. if (
  138. !e.srcElement.parentElement.className.includes(" search-field-focused")
  139. ) {
  140. e.srcElement.parentElement.className =
  141. e.srcElement.parentElement.className + " search-field-focused";
  142. }
  143. },
  144. // 输入关键字搜索
  145. searchAppView() {
  146. let appViewData = JSON.parse(JSON.stringify(this.appViewData));
  147. this.desktopAppViewDetail.detailMessageList = appViewData.filter(
  148. (item) => {
  149. return item.title.includes(this.keyword);
  150. }
  151. );
  152. },
  153. // 点击页面关闭本页面
  154. WindowClick() {
  155. let el = document.querySelector(".search-field-focused");
  156. if (el) {
  157. el.className = el.className.replace(" search-field-focused", "");
  158. }
  159. this.keyword = "";
  160. this.display = "none";
  161. this.cls = "";
  162. this.desktopAppViewDetail.detailMessageList = this.appViewData;
  163. this.$bus.emit("hiddenOrShowOtherWindow", false);
  164. window.removeEventListener("click", this.WindowClick);
  165. this.$bus.emit("showDialogWindow");
  166. this.$bus.emit("hiddenPortalTarget");
  167. },
  168. // 点击appViewItem
  169. clickAppViewItem(id) {
  170. this.$bus.emit("clickAppViewItem", id);
  171. this.WindowClick();
  172. },
  173. // 鼠标点击右键
  174. contextmenuAppViewItem(e, item, selectList) {
  175. e.preventDefault();
  176. console.log(e, item, selectList);
  177. let obj = { left: e.clientX, top: e.clientY, item, selectList };
  178. this.$bus.emit("showPortalTarget", obj);
  179. },
  180. },
  181. components: {
  182. AppViewItem,
  183. PortalTarget,
  184. },
  185. name: "DesktopAppView",
  186. };
  187. </script>
  188. <style lang="css" scoped>
  189. .sds-desktop-layout {
  190. display: grid;
  191. flex-direction: row;
  192. justify-content: space-between;
  193. grid-template-columns: repeat(auto-fill, 172px);
  194. overflow: -moz-scrollbars-none;
  195. }
  196. .app-layout-wrapper::-webkit-scrollbar {
  197. width: 0 !important;
  198. }
  199. .app-layout-wrapper {
  200. overflow: scroll;
  201. }
  202. .syno-sds-appview .sds-app-panel .sds-desktop-layout {
  203. justify-content: center;
  204. }
  205. .syno-sds-appview .sds-app-panel .sds-desktop-layout .app-item-icon {
  206. justify-content: center;
  207. display: flex;
  208. flex-direction: column;
  209. }
  210. .search-field input::-webkit-input-placeholder {
  211. color: rgb(102 111 122);
  212. }
  213. .search-field input:-moz-placeholder {
  214. color: rgb(102 111 122);
  215. }
  216. .search-field input:-ms-input-placeholder {
  217. color: rgb(102 111 122);
  218. }
  219. </style>