index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <div>
  3. <div class="left-top-tabs" id="left-top-tabs">
  4. <div class="top-tab">
  5. <!-- <el-tooltip placement="top" :hide-after="0" content="首页">-->
  6. <!-- <IconHome class="handler-item" @click="goHome"/>-->
  7. <!-- </el-tooltip>-->
  8. </div>
  9. </div>
  10. <div class="left-bottom-tabs">
  11. <div class="center-tabs">
  12. <div class="center-tab" :class="{ 'left-active': tab.key === poolType }" v-for="tab in topTabsRef"
  13. :key="tab.key"
  14. @click="setPoolType(tab.key)">
  15. <div class="flex justify-center items-center flex-col" :id="`left-tabs-${tab.key}`">
  16. <SvgIcon :icon-class="tab.icon" className="svg-size"/>
  17. <div class="left-name">{{ $t(tab.label) }}</div>
  18. </div>
  19. </div>
  20. </div>
  21. <!-- <div class="bottom-tabs">-->
  22. <!-- &lt;!&ndash; <div class="bottom-tab" :class="{ 'left-active': 'layer' === poolType }" @click="setPoolType('layer')">-->
  23. <!-- <div :id="`left-tabs-layer`">-->
  24. <!-- <div><SvgIcon icon-class="layer" className="svg-size" /></div>-->
  25. <!-- <div class="left-name">{{ $t("message.layer") }}</div>-->
  26. <!-- </div>-->
  27. <!-- </div> &ndash;&gt;-->
  28. <!-- <div class="bottom-tab" :class="{ 'left-active': 'help' === poolType }" ref="helpRef"-->
  29. <!-- @click="setPoolType('help')">-->
  30. <!-- <div :id="`left-tabs-help`">-->
  31. <!-- <div>-->
  32. <!-- <SvgIcon icon-class="help" className="svg-size"/>-->
  33. <!-- </div>-->
  34. <!-- <div class="left-name">{{ $t("message.help") }}</div>-->
  35. <!-- </div>-->
  36. <!-- </div>-->
  37. <!-- <HelpPopover :help-ref="helpRef" :help-popover-ref="helpPopoverRef"/>-->
  38. <!-- <HotkeyDrawer :has-hotkey="hasHotkey"/>-->
  39. <!-- </div>-->
  40. </div>
  41. </div>
  42. </template>
  43. <script lang="ts" setup>
  44. import {useMainStore} from "@/store";
  45. import {PoolType} from "@/types/common";
  46. import {storeToRefs} from "pinia";
  47. import {useRouter} from 'vue-router'
  48. import HotkeyDrawer from "./components/HotkeyDrawer.vue";
  49. import HelpPopover from "./components/HelpPopover.vue";
  50. import {onMounted} from "vue";
  51. const router = useRouter()
  52. const mainStore = useMainStore();
  53. const {poolType, poolShow} = storeToRefs(mainStore);
  54. const helpRef = ref();
  55. const helpPopoverRef = ref();
  56. const hasHotkey = ref(false);
  57. const runMode = ref(0);
  58. interface TabItem {
  59. key: PoolType;
  60. label: string;
  61. icon: string;
  62. index: number;
  63. }
  64. const topTabsRef = ref([])
  65. const topTabs: TabItem[] = [
  66. {key: "editor", label: "message.edit", icon: `editor`, index: 0},
  67. // { key: "template", label: "message.template", icon: `template`, index: 1 },
  68. {key: "material", label: "message.material", icon: `material`, index: 2},
  69. {key: "text", label: "message.text", icon: "text", index: 3},
  70. {key: "image", label: "message.image", icon: "picture", index: 4},
  71. // { key: "toolkit", label: "message.tool", icon: "toolkit", index: 5 },
  72. // { key: "chatgpt", label: "message.chatgpt", icon: "chatgpt", index: 6 },
  73. ];
  74. const topTabsFront: TabItem[] = [
  75. {key: "frontEditor", label: "message.edit", icon: `editor`, index: 0}
  76. ];
  77. const setPoolType = (tab: PoolType) => {
  78. if (poolShow.value && tab === poolType.value) {
  79. poolShow.value = false;
  80. } else {
  81. poolShow.value = tab !== "help" ? true : false;
  82. }
  83. mainStore.setPoolType(tab);
  84. };
  85. const goHome = () => {
  86. window.open(router.resolve({path: `/home`}).href, '_blank');
  87. }
  88. onMounted(() => {
  89. const query = router.currentRoute.value.query
  90. if (query.runMode) {
  91. runMode.value = query.runMode
  92. }
  93. if (runMode.value == 0) {
  94. topTabsRef.value = topTabsFront;
  95. setTimeout(() => {
  96. setPoolType("frontEditor")
  97. }, 300)
  98. } else topTabsRef.value = topTabs;
  99. })
  100. </script>
  101. <style lang="scss" scoped>
  102. .top-tab {
  103. width: 100%;
  104. height: $headerHeight;
  105. text-align: center;
  106. font-size: 20px;
  107. cursor: pointer;
  108. display: flex;
  109. flex-direction: column;
  110. justify-content: center;
  111. align-items: center;
  112. border-bottom: 1px solid $borderColor;
  113. .handler-item {
  114. width: 32px;
  115. height: 32px;
  116. display: flex;
  117. justify-content: center;
  118. align-items: center;
  119. margin: 0 2px;
  120. border-radius: $borderRadius;
  121. &:not(.group-btn):hover {
  122. background-color: #f1f1f1;
  123. }
  124. }
  125. }
  126. .center-tabs {
  127. // overflow-y: scroll;
  128. overflow-x: hidden;
  129. height: calc(100vh - 100px);
  130. .center-tab:hover {
  131. background: #f1f1f1;
  132. border-radius: 5px;
  133. }
  134. }
  135. .center-tab {
  136. width: 100%;
  137. height: 60px;
  138. padding-left: 2px;
  139. text-align: center;
  140. font-size: 12px;
  141. cursor: pointer;
  142. display: flex;
  143. flex-direction: column;
  144. justify-content: center;
  145. position: relative;
  146. }
  147. .left-active {
  148. color: $themeColor;
  149. }
  150. .left-name {
  151. font-size: 14px;
  152. line-height: 1.2;
  153. }
  154. .svg-size {
  155. font-size: 20px;
  156. }
  157. .left-active::before {
  158. background-color: $themeColor;
  159. border-radius: 4px;
  160. content: "";
  161. height: 41px;
  162. left: -3px;
  163. position: absolute;
  164. transition: top 0.2s;
  165. width: 6px;
  166. z-index: 20;
  167. }
  168. .left-content {
  169. position: relative;
  170. width: 300px;
  171. left: 50px;
  172. top: -360px;
  173. height: 100%;
  174. z-index: 1;
  175. background: #fff;
  176. border-left: 1px solid $borderColor;
  177. border-right: 1px solid $borderColor;
  178. transition: left 0.5s linear, right 0.5s linear;
  179. }
  180. .left-close {
  181. cursor: default;
  182. left: -320px;
  183. position: relative;
  184. top: 50%;
  185. // z-index: 1;
  186. }
  187. .layout-toggle {
  188. background: $themeColor;
  189. cursor: pointer;
  190. height: 88px;
  191. position: absolute;
  192. right: -17px;
  193. top: 50%;
  194. transform: translateY(-50%);
  195. transition: right 0.1s linear;
  196. width: 16px;
  197. z-index: 1;
  198. border-top-right-radius: 20px;
  199. border-bottom-right-radius: 20px;
  200. display: flex;
  201. align-items: center;
  202. border-top: 1px solid $borderColor;
  203. border-bottom: 1px solid $borderColor;
  204. border-right: 1px solid $borderColor;
  205. }
  206. .bottom-tabs {
  207. position: absolute;
  208. bottom: 0;
  209. width: 51px;
  210. z-index: 30;
  211. border-right: 1px solid #eee;
  212. }
  213. .bottom-tab {
  214. height: 60px;
  215. display: flex;
  216. flex-direction: column;
  217. justify-content: center;
  218. align-items: center;
  219. cursor: pointer;
  220. background: #fff;
  221. position: relative;
  222. border-radius: 5px;
  223. .help-handle {
  224. font-size: 20px;
  225. }
  226. #left-tabs-help,
  227. #left-tabs-layer {
  228. width: 100%;
  229. display: flex;
  230. flex-direction: column;
  231. justify-content: center;
  232. align-items: center;
  233. }
  234. &:hover {
  235. background: #f1f1f1;
  236. }
  237. }
  238. .has-help {
  239. color: $themeColor;
  240. }
  241. .help-pop-row {
  242. font-size: 15px;
  243. padding: 10px 25px;
  244. cursor: pointer;
  245. .help-pop-icon {
  246. font-size: 20px;
  247. }
  248. .help-pop-text {
  249. padding-left: 10px;
  250. }
  251. }
  252. .help-pop-row:hover {
  253. background-color: $hoverColor;
  254. }
  255. </style>