Browse Source

fix: Update version to V0.0.4

master
guoapeng 2 months ago
parent
commit
123fb3f1cc
  1. 2
      package.json
  2. 2
      src/components/craft/AddCraft/index.vue
  3. 92
      src/libs/http(1).ts
  4. 92
      src/libs/http.ts
  5. 1
      src/libs/utils.ts
  6. 65
      src/views/home/index.vue

2
package.json

@ -1,7 +1,7 @@
{
"name": "separate-gold-web",
"type": "module",
"version": "0.0.3",
"version": "0.0.4",
"description": "",
"author": "",
"license": "ISC",

2
src/components/craft/AddCraft/index.vue

@ -58,7 +58,7 @@ const okHandle = async () => {
step.params.time = (step.params.minutes || 0) * 60 + (step.params.seconds || 0) || undefined
}
}
step.params.description = `${index}.`
step.params.description = `${index + 1}.`
switch (step.method) {
case 'clean':
step.params.description += `针头高度${step.params.height}mm, 加${step.params.volume}ml水清洗${step.params.cycle}`

92
src/libs/http(1).ts

@ -0,0 +1,92 @@
import axios from 'axios'
import { FtMessage } from 'libs/message'
import { getToken } from 'libs/token'
import { HEADER_TOKEN_KEY } from '@/libs/constant'
const http = axios.create({
baseURL: import.meta.env.FT_API_BASE,
timeout: 1000 * 60,
})
// 请求拦截器
http.interceptors.request.use(
(config) => {
if (getToken()) {
config.headers![HEADER_TOKEN_KEY] = getToken()
}
return config
},
(error: any) => {
return Promise.reject(error)
},
)
// 响应拦截器
http.interceptors.response.use(
(response) => {
if (
response.status === 200
&& response.data.code !== '0'
) {
// 返回错误拦截
FtMessage.error(response.data.msg)
return Promise.reject(response)
}
else if (
response.config.url?.includes('/files/download')
|| response.config.url?.includes('downloadStream')
) {
return response.data
}
else if (response.data instanceof Blob) {
return response.data
}
return response.data.data // 返回数据体
},
(error: any) => {
console.log(error)
if (error.response && error.response.status === 401) {
FtMessage.error('账号权限过期')
// TODO 登出
}
else {
if (error.message.includes('timeout')) {
FtMessage.error('请求超时')
}
else if (error.message.includes('Network')) {
FtMessage.error('网络连接错误')
}
else {
FtMessage.error('接口请求失败')
}
error.response = {
data: {
res: false,
},
}
return Promise.reject(error.response)
}
},
)
// 封装 GET 请求
export function get<T>(url: string, params?: any): Promise<T> {
return http.get(url, { params })
}
// 封装 POST 请求
export function post<T>(url: string, data?: any): Promise<T> {
return http.post(url, data)
}
// 封装 PUT 请求
export function put<T>(url: string, data?: any): Promise<T> {
return http.put(url, data)
}
// 封装 DELETE 请求
export function del<T>(url: string, params?: any): Promise<T> {
return http.delete(url, { params })
}
export default http

92
src/libs/http.ts

@ -1,92 +0,0 @@
import axios from 'axios'
import { FtMessage } from 'libs/message'
import { getToken } from 'libs/token'
import { HEADER_TOKEN_KEY } from '@/libs/constant'
const http = axios.create({
baseURL: import.meta.env.FT_API_BASE,
timeout: 1000 * 60,
})
// 请求拦截器
http.interceptors.request.use(
(config) => {
if (getToken()) {
config.headers![HEADER_TOKEN_KEY] = getToken()
}
return config
},
(error: any) => {
return Promise.reject(error)
},
)
// 响应拦截器
http.interceptors.response.use(
(response) => {
if (
response.status === 200
&& response.data.code !== '0'
) {
// 返回错误拦截
FtMessage.error(response.data.msg)
return Promise.reject(response)
}
else if (
response.config.url?.includes('/files/download')
|| response.config.url?.includes('downloadStream')
) {
return response.data
}
else if (response.data instanceof Blob) {
return response.data
}
return response.data.data // 返回数据体
},
(error: any) => {
console.log(error)
if (error.response && error.response.status === 401) {
FtMessage.error('账号权限过期')
// TODO 登出
}
else {
if (error.message.includes('timeout')) {
FtMessage.error('请求超时')
}
else if (error.message.includes('Network')) {
FtMessage.error('网络连接错误')
}
else {
FtMessage.error('接口请求失败')
}
error.response = {
data: {
res: false,
},
}
return Promise.reject(error.response)
}
},
)
// 封装 GET 请求
export function get<T>(url: string, params?: any): Promise<T> {
return http.get(url, { params })
}
// 封装 POST 请求
export function post<T>(url: string, data?: any): Promise<T> {
return http.post(url, data)
}
// 封装 PUT 请求
export function put<T>(url: string, data?: any): Promise<T> {
return http.put(url, data)
}
// 封装 DELETE 请求
export function del<T>(url: string, params?: any): Promise<T> {
return http.delete(url, { params })
}
export default http

1
src/libs/utils.ts

@ -57,6 +57,7 @@ export const cmdNameMap = {
liquid_motor_disable: '失能加液臂电机',
door_enable: '使能门电机',
door_disable: '失能门电机',
out_tray: '取出托盘',
}

65
src/views/home/index.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import { stopTask, trayIn, trayOut } from 'apis/home'
import { stopTask, trayIn } from 'apis/home'
import AddLiquid from 'components/home/AddLiquid/index.vue'
import CheckCraft from 'components/home/CheckCraft/index.vue'
import ExecuteCraft from 'components/home/ExecuteCraft/index.vue'
@ -162,11 +162,12 @@ const move_to_anneal_area = async () => {
const trayInHandle = async () => {
await trayIn()
FtMessage.success('设置放入托盘成功')
}
const trayOutHandle = async () => {
await trayOut()
}
// const trayOutHandle = async () => {
// await trayOut()
// }
const checkCraftVisible = ref(false)
</script>
@ -204,7 +205,7 @@ const checkCraftVisible = ref(false)
<ft-button size="large" :click-handle="trayInHandle">
放入托盘
</ft-button>
<ft-button size="large" :click-handle="trayOutHandle">
<ft-button size="large" :click-handle="() => commandHandle('out_tray', { heatModuleCode: selectedHeatArea!.value })" :disabled="!selectedHeatArea">
取出托盘
</ft-button>
</div>
@ -311,34 +312,34 @@ const checkCraftVisible = ref(false)
<style scoped lang="scss">
.home-page {
.page-top{
height: 65%;
border-radius: 8px;
padding: 0 10px 10px;
display: grid;
grid-template-columns: repeat(4, 1fr); /* 创建3列等宽轨道 */
grid-template-rows: repeat(1, auto); /* 创建2行自动高度 */
gap: 10px;
justify-content: center; /* 水平居中 */
align-items: center;
}
.button-box {
height: 35%;
//display: grid;
//grid-template-columns: repeat(6, 1fr); /* 3 */
//grid-template-rows: repeat(4, 1fr); /* 2 */
//gap: 10px 20px;
.ft-button {
//width: 100px;
font-weight: bold;
margin-right: 0;
.my-button {
padding: 0 !important;
border: 3px solid #1989fa !important;
.page-top{
height: 65%;
border-radius: 8px;
padding: 0 10px 10px;
display: grid;
grid-template-columns: repeat(4, 1fr); /* 创建3列等宽轨道 */
grid-template-rows: repeat(1, auto); /* 创建2行自动高度 */
gap: 10px;
justify-content: center; /* 水平居中 */
align-items: center;
}
}
}
.button-box {
height: 35%;
//display: grid;
//grid-template-columns: repeat(6, 1fr); /* 3 */
//grid-template-rows: repeat(4, 1fr); /* 2 */
//gap: 10px 20px;
.ft-button {
//width: 100px;
font-weight: bold;
margin-right: 0;
.my-button {
padding: 0 !important;
border: 3px solid #1989fa !important;
}
}
}
}
</style>
Loading…
Cancel
Save