baoshiwei
2025-05-21 832991a036bcb0d99a66d2d1f059253136ddd622
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<script setup lang="ts">
import { getCurrentWindow } from '@tauri-apps/api/window';
import { defineEmits } from 'vue';
 
const appWindow = getCurrentWindow();
 
const emit = defineEmits(['start-service', 'select-display']);
 
 
 
 
const minimize = async () => {
  await appWindow.minimize();
};
 
const close = async () => {
  await appWindow.close();
};
 
</script>
 
<template>
  <div data-tauri-drag-region class="title-bar" >
    <div class="title-bar-left">
      <img src="../assets/logo.png" class="app-icon" alt="app icon" />
      <span class="title">六维力传感器实时数据</span>
      <!-- <button class="start-service-button" @click="handleStartService">启动服务</button> -->
    </div>
    <!-- Display mode buttons will be moved to the right -->
    
    <div class="window-controls">
      <button class="control-button minimize" @click="minimize">
        <svg width="12" height="12" viewBox="0 0 12 12">
          <rect x="2" y="5" width="8" height="2" fill="currentColor" />
        </svg>
      </button>
      <button class="control-button close" @click="close">
        <svg width="12" height="12" viewBox="0 0 12 12">
          <path d="M2.4 1L1 2.4L4.6 6L1 9.6L2.4 11L6 7.4L9.6 11L11 9.6L7.4 6L11 2.4L9.6 1L6 4.6L2.4 1Z" fill="currentColor" />
        </svg>
      </button>
    </div>
    
  </div>
</template>
 
<style scoped>
.title-bar {
  height: 32px;
  background: linear-gradient(to right, #2c3e50, #3498db);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  -webkit-user-select: none;
  user-select: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}
 
.title-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px; /* Add some space between left and center */
}
 
.app-icon {
  width: 16px;
  height: 16px;
}
 
.title {
  color: white;
  font-size: 14px;
  font-weight: 500;
}
 
.window-controls {
  display: flex;
  gap: 8px;
}
 
.control-button {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0;
  transition: background-color 0.2s;
}
 
.control-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
 
.close:hover {
  background-color: #e81123;
}
 
.start-service-button {
  background-color: #28a745;
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 16px; /* Keep margin-left for spacing from title */
}
 
.start-service-button:hover {
  background-color: #218838;
}
 
.title-bar-center {
  /* Removed as buttons are moved */
  flex-grow: 1; /* Allow the container to grow and take available space */
}
 
 
 
</style>