Header.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <div class="app-header">
  3. <a class="logo" href="https://le5le.com" target="_blank">
  4. <img src="/favicon.ico" />
  5. <span>乐吾乐</span>
  6. </a>
  7. <t-dropdown
  8. :minColumnWidth="200"
  9. :maxHeight="560"
  10. :delay2="[10, 150]"
  11. overlayClassName="header-dropdown"
  12. trigger="click"
  13. >
  14. <a> 文件 </a>
  15. <t-dropdown-menu>
  16. <t-dropdown-item>
  17. <a>新建文件</a>
  18. </t-dropdown-item>
  19. <t-dropdown-item>
  20. <a>打开文件</a>
  21. </t-dropdown-item>
  22. <t-dropdown-item divider="true">
  23. <a>导入文件</a>
  24. </t-dropdown-item>
  25. <t-dropdown-item>
  26. <a>保存</a>
  27. </t-dropdown-item>
  28. <t-dropdown-item>
  29. <a>另保存</a>
  30. </t-dropdown-item>
  31. <t-dropdown-item divider="true">
  32. <a>下载JSON文件</a>
  33. </t-dropdown-item>
  34. <t-dropdown-item>
  35. <a>
  36. <div class="flex">
  37. 导出为ZIP文件 <span class="flex-grow"></span>
  38. <span><label>VIP</label></span>
  39. </div>
  40. </a>
  41. </t-dropdown-item>
  42. <t-dropdown-item>
  43. <a>
  44. <div class="flex">
  45. 导出为HTML <span class="flex-grow"></span>
  46. <span><label>VIP</label></span>
  47. </div>
  48. </a>
  49. </t-dropdown-item>
  50. <t-dropdown-item>
  51. <a>
  52. <div class="flex">
  53. 导出为Vue3组件 <span class="flex-grow"></span>
  54. <span><label>VIP</label></span>
  55. </div>
  56. </a>
  57. </t-dropdown-item>
  58. <t-dropdown-item>
  59. <a>
  60. <div class="flex">
  61. 导出为Vue2组件 <span class="flex-grow"></span>
  62. <span><label>VIP</label></span>
  63. </div>
  64. </a>
  65. </t-dropdown-item>
  66. <t-dropdown-item divider="true">
  67. <a>
  68. <div class="flex">
  69. 导出为React组件 <span class="flex-grow"></span>
  70. <span><label>VIP</label></span>
  71. </div>
  72. </a>
  73. </t-dropdown-item>
  74. <t-dropdown-item>
  75. <a>下载为PNG</a>
  76. </t-dropdown-item>
  77. <t-dropdown-item>
  78. <a>下载为SVG</a>
  79. </t-dropdown-item>
  80. </t-dropdown-menu>
  81. </t-dropdown>
  82. <t-dropdown
  83. :minColumnWidth="180"
  84. :maxHeight="500"
  85. :delay2="[10, 150]"
  86. overlayClassName="header-dropdown"
  87. >
  88. <a> 编辑 </a>
  89. <t-dropdown-menu>
  90. <t-dropdown-item>
  91. <a>
  92. <div class="flex">
  93. 撤销 <span class="flex-grow"></span> Ctrl + Z
  94. </div>
  95. </a>
  96. </t-dropdown-item>
  97. <t-dropdown-item divider="true">
  98. <a>
  99. <div class="flex">
  100. 恢复 <span class="flex-grow"></span> Ctrl + Y
  101. </div>
  102. </a>
  103. </t-dropdown-item>
  104. <t-dropdown-item>
  105. <a>
  106. <div class="flex">
  107. 剪切 <span class="flex-grow"></span> Ctrl + X
  108. </div>
  109. </a>
  110. </t-dropdown-item>
  111. <t-dropdown-item>
  112. <a>
  113. <div class="flex">
  114. 复制 <span class="flex-grow"></span> Ctrl + C
  115. </div>
  116. </a>
  117. </t-dropdown-item>
  118. <t-dropdown-item divider="true">
  119. <a>
  120. <div class="flex">
  121. 粘贴 <span class="flex-grow"></span> Ctrl + V
  122. </div>
  123. </a>
  124. </t-dropdown-item>
  125. <t-dropdown-item>
  126. <a>
  127. <div class="flex">
  128. 添加/删除锚点 <span class="flex-grow"></span> A
  129. </div>
  130. </a>
  131. </t-dropdown-item>
  132. <t-dropdown-item>
  133. <a>
  134. <div class="flex">添加手柄 <span class="flex-grow"></span> H</div>
  135. </a>
  136. </t-dropdown-item>
  137. <t-dropdown-item>
  138. <a>
  139. <div class="flex">删除手柄 <span class="flex-grow"></span> D</div>
  140. </a>
  141. </t-dropdown-item>
  142. <t-dropdown-item>
  143. <a>
  144. <div class="flex">
  145. 切换手柄 <span class="flex-grow"></span> Shift
  146. </div>
  147. </a>
  148. </t-dropdown-item>
  149. </t-dropdown-menu>
  150. </t-dropdown>
  151. <t-dropdown
  152. :minColumnWidth="180"
  153. :maxHeight="500"
  154. :delay2="[10, 150]"
  155. overlayClassName="header-dropdown"
  156. >
  157. <a> 工具 </a>
  158. <t-dropdown-menu>
  159. <t-dropdown-item>
  160. <a>窗口大小</a>
  161. </t-dropdown-item>
  162. <t-dropdown-item>
  163. <a>放大</a>
  164. </t-dropdown-item>
  165. <t-dropdown-item>
  166. <a>缩小</a>
  167. </t-dropdown-item>
  168. <t-dropdown-item divider="true">
  169. <a>100%视图</a>
  170. </t-dropdown-item>
  171. <t-dropdown-item>
  172. <a>鹰眼地图</a>
  173. </t-dropdown-item>
  174. <t-dropdown-item divider="true">
  175. <a>放大镜</a>
  176. </t-dropdown-item>
  177. <t-dropdown-item>
  178. <a>
  179. <div class="flex middle">
  180. 自动锚点 <span class="flex-grow"></span> <t-icon name="check" />
  181. </div>
  182. </a>
  183. </t-dropdown-item>
  184. <t-dropdown-item divider="true">
  185. <a>
  186. <div class="flex middle">
  187. 禁用锚点 <span class="flex-grow"></span> <t-icon name="check" />
  188. </div>
  189. </a>
  190. </t-dropdown-item>
  191. <t-dropdown-item>
  192. <a>明亮主题</a>
  193. </t-dropdown-item>
  194. <t-dropdown-item>
  195. <a>暗黑主题</a>
  196. </t-dropdown-item>
  197. </t-dropdown-menu>
  198. </t-dropdown>
  199. <t-dropdown
  200. :minColumnWidth="180"
  201. :maxHeight="500"
  202. :delay2="[10, 150]"
  203. overlayClassName="header-dropdown"
  204. >
  205. <a> 帮助 </a>
  206. <t-dropdown-menu>
  207. <t-dropdown-item>
  208. <a>产品介绍</a>
  209. </t-dropdown-item>
  210. <t-dropdown-item>
  211. <a>快速上手</a>
  212. </t-dropdown-item>
  213. <t-dropdown-item>
  214. <a>使用手册</a>
  215. </t-dropdown-item>
  216. <t-dropdown-item divider="true">
  217. <a>快捷键</a>
  218. </t-dropdown-item>
  219. <t-dropdown-item divider="true">
  220. <a>企业服务与支持</a>
  221. </t-dropdown-item>
  222. <t-dropdown-item>
  223. <a>关于我们</a>
  224. </t-dropdown-item>
  225. </t-dropdown-menu>
  226. </t-dropdown>
  227. <input v-model="data.name" />
  228. <div style="width: 290px; flex-shrink: 0"></div>
  229. <t-dropdown
  230. v-if="user.id"
  231. :minColumnWidth="200"
  232. :maxHeight="500"
  233. :delay2="[10, 150]"
  234. overlayClassName="custom-dropdown header"
  235. >
  236. <a style="margin-left: 32px; margin-right: 0">
  237. <t-avatar
  238. size="small"
  239. :image="user.avatarUrl ? user.avatarUrl : baseUrl + 'img/avatar.png'"
  240. />
  241. </a>
  242. <t-dropdown-menu>
  243. <t-dropdown-item>
  244. <router-link to="/account/info">
  245. {{ user.username }}
  246. </router-link>
  247. </t-dropdown-item>
  248. <t-dropdown-item>
  249. <router-link to="/account/info">我的图纸</router-link>
  250. </t-dropdown-item>
  251. <t-dropdown-item>
  252. <router-link to="/account/teams">我的团队</router-link>
  253. </t-dropdown-item>
  254. <t-dropdown-item>
  255. <router-link to="/account/info">账号信息</router-link>
  256. </t-dropdown-item>
  257. <t-dropdown-item :divider="true">
  258. <router-link to="/account/security"> 安全设置 </router-link>
  259. </t-dropdown-item>
  260. <t-dropdown-item>
  261. <a @click="signout">退出</a>
  262. </t-dropdown-item>
  263. </t-dropdown-menu>
  264. </t-dropdown>
  265. <div class="flex middle" v-else>
  266. <a class="button primary solid" style="width: 80px" :href="login()">登录</a>
  267. </div>
  268. </div>
  269. </template>
  270. <script lang="ts" setup>
  271. import { reactive } from 'vue';
  272. import { useUser } from '@/services/user';
  273. const market = import.meta.env.VITE_MARKET;
  274. const baseUrl = import.meta.env.BASE_URL || '/';
  275. const { user, message, getUser, getMessage, signout } = useUser();
  276. const data = reactive({
  277. name: '空白文件',
  278. });
  279. function login() {
  280. //TODO 临时地址
  281. return `https://account.le5le.com/?cb=${encodeURIComponent(location.href)}`
  282. // if (market) {
  283. // return `/account/login?cb=${encodeURIComponent(location.href)}`;
  284. // } else {
  285. // let arr = location.host.split('.');
  286. // arr[0] = 'http://account';
  287. // let accountUrl = arr.join('.');
  288. // return `${
  289. // (<any>globalThis).loginUrl ? (<any>globalThis).loginUrl : accountUrl
  290. // }?cb=${encodeURIComponent(location.href)}`;
  291. // }
  292. }
  293. </script>
  294. <style lang="postcss" scoped>
  295. .app-header {
  296. display: flex;
  297. height: 40px;
  298. .logo {
  299. display: flex;
  300. padding: 0 16px;
  301. align-items: center;
  302. font-size: 14px;
  303. font-weight: 500;
  304. img {
  305. height: 20px;
  306. margin-right: 6px;
  307. }
  308. }
  309. a {
  310. display: flex;
  311. padding: 0 8px;
  312. margin: 0 8px;
  313. align-items: center;
  314. color: var(--color);
  315. text-decoration: none;
  316. &:hover {
  317. color: var(--color-primary);
  318. }
  319. }
  320. input {
  321. font-size: var(--font-size);
  322. flex-grow: 1;
  323. background: none;
  324. outline: none;
  325. border: none;
  326. text-align: center;
  327. color: var(--color-title);
  328. }
  329. }
  330. </style>