main #34
@ -775,7 +775,7 @@ async def baidu_confirm_refund_order(ns={}):
|
|||||||
await sor.U('baidu_orders', {'id': refund_id, 'refundstatus': '1'})
|
await sor.U('baidu_orders', {'id': refund_id, 'refundstatus': '1'})
|
||||||
|
|
||||||
# 增加延迟
|
# 增加延迟
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(4)
|
||||||
|
|
||||||
# 延迟2-3秒还是获取到 ready状态的订单,那就重复请求一次,目的是尽快刷新状态
|
# 延迟2-3秒还是获取到 ready状态的订单,那就重复请求一次,目的是尽快刷新状态
|
||||||
async with aiohttp_client.request(
|
async with aiohttp_client.request(
|
||||||
|
|||||||
@ -1624,7 +1624,15 @@ export const asyncRoutes = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: "产品供应", fullPath: "/operationAndMaintenance/productSupply", noCache: true
|
title: "产品供应", fullPath: "/operationAndMaintenance/productSupply", noCache: true
|
||||||
},
|
},
|
||||||
},],
|
},{
|
||||||
|
path: "envDeployment",
|
||||||
|
component: () => import("@/views/operationAndMaintenance/envDeployment"),
|
||||||
|
name: "envDeployment",
|
||||||
|
meta: {
|
||||||
|
title: "环境部署", fullPath: "/operationAndMaintenance/envDeployment", noCache: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@ -124,9 +124,23 @@ export default {
|
|||||||
console.log("退订接口返回:", res);
|
console.log("退订接口返回:", res);
|
||||||
if (res.status) {
|
if (res.status) {
|
||||||
this.$message.success('退订成功');
|
this.$message.success('退订成功');
|
||||||
|
<<<<<<< HEAD
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/BaiduNetdisk',
|
path: '/BaiduNetdisk',
|
||||||
});
|
});
|
||||||
|
=======
|
||||||
|
// 修复页面跳转 - 使用 path 而不是 url
|
||||||
|
// this.$router.push({
|
||||||
|
// path: '/customer/unsubscribe/BaiduNetdisk',
|
||||||
|
// });
|
||||||
|
// 强制刷新整个页面
|
||||||
|
if (this.$router) {
|
||||||
|
this.$router.go(0); // 使用 Vue Router 的方法刷新页面
|
||||||
|
} else {
|
||||||
|
window.location.reload(); // 备用方案,直接刷新页面
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> 3668499c20c8fb552d134820a7ab606a079a1d2a
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(res.msg || '退订失败,请稍后重试');
|
this.$message.error(res.msg || '退订失败,请稍后重试');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,469 @@
|
|||||||
|
<template>
|
||||||
|
<div class="deploy-container">
|
||||||
|
<h2>部署管理</h2>
|
||||||
|
|
||||||
|
<!-- WebSocket连接配置 -->
|
||||||
|
<div class="connection-config">
|
||||||
|
<h3>WebSocket连接配置</h3>
|
||||||
|
<div class="input-group">
|
||||||
|
<label>服务器地址:</label>
|
||||||
|
<input
|
||||||
|
v-model="socketUrl"
|
||||||
|
type="text"
|
||||||
|
placeholder="请输入WebSocket服务器地址,如: ws://localhost:56789"
|
||||||
|
class="url-input"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="button-group">
|
||||||
|
<button
|
||||||
|
@click="connectSocket"
|
||||||
|
:disabled="isConnecting || isConnected"
|
||||||
|
class="connect-btn"
|
||||||
|
>
|
||||||
|
{{ isConnecting ? '连接中...' : (isConnected ? '已连接' : '连接') }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
@click="disconnectSocket"
|
||||||
|
:disabled="!isConnected"
|
||||||
|
class="disconnect-btn"
|
||||||
|
>
|
||||||
|
断开连接
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 部署控制 -->
|
||||||
|
<div class="deploy-control" v-if="isConnected">
|
||||||
|
<h3>部署控制</h3>
|
||||||
|
<div class="status-display">
|
||||||
|
<div class="status-item" :class="connectionStatusClass">
|
||||||
|
<span class="status-label">连接状态:</span>
|
||||||
|
<span class="status-value">{{ connectionStatus }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="status-item" :class="deployStatusClass" v-if="deployStatus">
|
||||||
|
<span class="status-label">部署状态:</span>
|
||||||
|
<span class="status-value">{{ deployStatus }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="deploy-actions">
|
||||||
|
<button
|
||||||
|
@click="startDeployment"
|
||||||
|
:disabled="isDeploying || deployFailed"
|
||||||
|
class="deploy-btn"
|
||||||
|
>
|
||||||
|
<!-- 部署中:带旋转图标 -->
|
||||||
|
<span v-if="isDeploying" class="spin-box">
|
||||||
|
<svg class="spin" viewBox="0 0 24 24">
|
||||||
|
<path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm0 18a8 8 0 1 1 8-8 8 8 0 0 1-8 8z"/>
|
||||||
|
<path d="M12 4a8 8 0 0 1 8 8h-2a6 6 0 0 0-6-6V4z" opacity=".3"/>
|
||||||
|
</svg>
|
||||||
|
<!-- 部署中... -->
|
||||||
|
</span>
|
||||||
|
<!-- 非部署中:原文案 -->
|
||||||
|
<!-- {{ isDeploying ? '部署中...' : '开始部署' }} -->
|
||||||
|
{{ deployFailed ? '部署失败' : (isDeploying ? '部署中...' : '开始部署') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="log-section" v-if="showLogs">
|
||||||
|
<h4>部署日志</h4>
|
||||||
|
<div class="log-output" ref="logOutput">
|
||||||
|
<div v-for="(log, index) in logs" :key="index" class="log-line">
|
||||||
|
{{ log }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button @click="clearLogs" class="clear-btn">清空日志</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'DeployView',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
socket: null,
|
||||||
|
socketUrl: '',
|
||||||
|
isConnecting: false,
|
||||||
|
isConnected: false,
|
||||||
|
isDeploying: false,
|
||||||
|
deployFailed: false, // 新增:标记是否失败
|
||||||
|
connectionStatus: '未连接',
|
||||||
|
deployStatus: '',
|
||||||
|
logs: [],
|
||||||
|
showLogs: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
connectionStatusClass() {
|
||||||
|
if (this.isConnected) return 'status-success'
|
||||||
|
if (this.isConnecting) return 'status-warning'
|
||||||
|
return 'status-error'
|
||||||
|
},
|
||||||
|
deployStatusClass() {
|
||||||
|
if (this.deployStatus.includes('完成') || this.deployStatus.includes('成功')) return 'status-success'
|
||||||
|
if (this.deployStatus.includes('错误') || this.deployStatus.includes('失败')) return 'status-error'
|
||||||
|
if (this.deployStatus.includes('中') || this.deployStatus.includes('启动')) return 'status-info'
|
||||||
|
return 'status-info'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
connectSocket() {
|
||||||
|
if (!this.socketUrl) {
|
||||||
|
alert('请输入服务器地址')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isConnecting = true
|
||||||
|
this.connectionStatus = '正在连接...'
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 直接使用原生WebSocket连接,不需要转换URL
|
||||||
|
this.socket = new WebSocket(this.socketUrl)
|
||||||
|
|
||||||
|
this.socket.onopen = () => {
|
||||||
|
this.isConnected = true
|
||||||
|
this.isConnecting = false
|
||||||
|
this.connectionStatus = '已连接到服务器'
|
||||||
|
this.setupSocketListeners()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.socket.onclose = () => {
|
||||||
|
this.isConnected = false
|
||||||
|
this.connectionStatus = '与服务器断开连接'
|
||||||
|
this.isDeploying = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.socket.onerror = (error) => {
|
||||||
|
this.handleConnectionError(error)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.handleConnectionError(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setupSocketListeners() {
|
||||||
|
this.socket.onmessage = (event) => {
|
||||||
|
try {
|
||||||
|
console.log('接收到消息:', event.data);
|
||||||
|
console.log('接收到消息:', typeof event.data);
|
||||||
|
const data = JSON.parse(event.data)
|
||||||
|
|
||||||
|
switch (data.type) {
|
||||||
|
case 'connection_status':
|
||||||
|
this.connectionStatus = data.message
|
||||||
|
break
|
||||||
|
case 'deploy_status':
|
||||||
|
this.deployStatus = data.message
|
||||||
|
this.showLogs = true
|
||||||
|
break
|
||||||
|
case 'deploy_update':
|
||||||
|
this.logs.push(data.message)
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.scrollToBottom()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'deploy_complete':
|
||||||
|
this.deployStatus = data.message
|
||||||
|
this.isDeploying = false
|
||||||
|
this.logs.push('=== 部署结束 ===')
|
||||||
|
break
|
||||||
|
case 'deploy_error':
|
||||||
|
this.deployStatus = data.message
|
||||||
|
this.isDeploying = false
|
||||||
|
this.deployFailed = true // 标记失败
|
||||||
|
this.logs.push(`错误: ${data.message}`)
|
||||||
|
break
|
||||||
|
case 'error':
|
||||||
|
this.logs.push(`错误: ${data.message}`)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('解析消息失败:', error)
|
||||||
|
this.logs.push(`解析消息失败: ${event.data}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
disconnectSocket() {
|
||||||
|
if (this.socket) {
|
||||||
|
this.socket.close()
|
||||||
|
this.socket = null
|
||||||
|
}
|
||||||
|
this.isConnected = false
|
||||||
|
this.isConnecting = false
|
||||||
|
this.isDeploying = false
|
||||||
|
this.connectionStatus = '未连接'
|
||||||
|
this.deployStatus = ''
|
||||||
|
},
|
||||||
|
|
||||||
|
startDeployment() {
|
||||||
|
if (!this.isConnected) {
|
||||||
|
alert('请先连接到服务器')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isDeploying = true
|
||||||
|
this.deployFailed = false // 重置失败标志
|
||||||
|
this.deployStatus = '部署已启动'
|
||||||
|
this.logs = []
|
||||||
|
this.showLogs = true
|
||||||
|
|
||||||
|
// 发送JSON消息到服务器
|
||||||
|
this.socket.send(JSON.stringify({
|
||||||
|
action: 'start_deployment'
|
||||||
|
}))
|
||||||
|
},
|
||||||
|
|
||||||
|
clearLogs() {
|
||||||
|
this.logs = []
|
||||||
|
},
|
||||||
|
|
||||||
|
scrollToBottom() {
|
||||||
|
const logOutput = this.$refs.logOutput
|
||||||
|
if (logOutput) {
|
||||||
|
logOutput.scrollTop = logOutput.scrollHeight
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleConnectionError(error) {
|
||||||
|
this.isConnecting = false
|
||||||
|
this.isConnected = false
|
||||||
|
this.connectionStatus = `连接失败: ${error.message || '未知错误'}`
|
||||||
|
console.error('连接错误:', error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* ---------- 变量 ---------- */
|
||||||
|
:root {
|
||||||
|
--primary: #5433ff;
|
||||||
|
--primary-light: #7c4dff;
|
||||||
|
--success: #00c853;
|
||||||
|
--error : #ff3d00;
|
||||||
|
--warning: #ffab00;
|
||||||
|
--bg : #91b0ee;
|
||||||
|
--card-bg: #ffffff;
|
||||||
|
--text : #5433ff; /* 原来是 #303133 之类偏蓝灰,现改为中性深灰 */
|
||||||
|
--text-light: #59a4e6;
|
||||||
|
--border : #e0e4ec;
|
||||||
|
--radius : 10px;
|
||||||
|
--shadow : 0 2px 12px rgba(0,0,0,.06);
|
||||||
|
--shadow-hover: 0 6px 20px rgba(0,0,0,.08);
|
||||||
|
--transition: all .3s cubic-bezier(.4,0,.2,1);
|
||||||
|
}
|
||||||
|
/* ---------- 基础 ---------- */
|
||||||
|
.deploy-container {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: var(--bg);
|
||||||
|
padding: 32px 24px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 24px;
|
||||||
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 标题 ---------- */
|
||||||
|
h2 {
|
||||||
|
margin: 0 0 12px;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text);
|
||||||
|
letter-spacing: -.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 20px;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
h3::before {
|
||||||
|
content: "";
|
||||||
|
width: 4px;
|
||||||
|
height: 18px;
|
||||||
|
background: var(--primary);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 卡片 ---------- */
|
||||||
|
.connection-config,
|
||||||
|
.deploy-control {
|
||||||
|
background: var(--card-bg);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
padding: 28px 32px;
|
||||||
|
transition: var(--transition);
|
||||||
|
border-left: 4px solid transparent;
|
||||||
|
}
|
||||||
|
.connection-config:hover,
|
||||||
|
.deploy-control:hover {
|
||||||
|
box-shadow: var(--shadow-hover);
|
||||||
|
border-left-color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 输入组 ---------- */
|
||||||
|
.input-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.input-group label {
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.url-input {
|
||||||
|
flex: 1;
|
||||||
|
max-width: 420px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
font-size: 14px;
|
||||||
|
transition: var(--transition);
|
||||||
|
}
|
||||||
|
.url-input:focus {
|
||||||
|
border-color: var(--primary);
|
||||||
|
box-shadow: 0 0 0 3px rgba(124,77,255,.15);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 按钮 ---------- */
|
||||||
|
.button-group,
|
||||||
|
.deploy-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.connect-btn,
|
||||||
|
.disconnect-btn,
|
||||||
|
.deploy-btn,
|
||||||
|
.clear-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: var(--transition);
|
||||||
|
box-shadow: 0 2px 6px rgba(0,0,0,.08);
|
||||||
|
}
|
||||||
|
.connect-btn {
|
||||||
|
background: linear-gradient(135deg, var(--success) 0%, #00e676 100%);
|
||||||
|
color: #26dc0e;
|
||||||
|
}
|
||||||
|
.connect-btn:hover:not(:disabled) {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0,200,83,.25);
|
||||||
|
}
|
||||||
|
.disconnect-btn {
|
||||||
|
background: linear-gradient(135deg, var(--error) 0%, #ff6d00 100%);
|
||||||
|
color: #ef4b4b;
|
||||||
|
}
|
||||||
|
.disconnect-btn:hover:not(:disabled) {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(255,61,0,.25);
|
||||||
|
}
|
||||||
|
.deploy-btn {
|
||||||
|
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
|
||||||
|
color: #2eb309;
|
||||||
|
}
|
||||||
|
.deploy-btn:hover:not(:disabled) {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(84,51,255,.25);
|
||||||
|
}
|
||||||
|
.clear-btn {
|
||||||
|
background: #133419;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.clear-btn:hover {
|
||||||
|
background: #757575;
|
||||||
|
}
|
||||||
|
button:disabled {
|
||||||
|
background: #e0e0e0;
|
||||||
|
color: #9e9e9e;
|
||||||
|
cursor: not-allowed;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 状态标签 ---------- */
|
||||||
|
.status-display {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
.status-item {
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
border-left: 4px solid;
|
||||||
|
font-size: 14px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.status-success { background: #e8f5e9; border-color: var(--success); color: #2e7d32; }
|
||||||
|
.status-error { background: #ffebee; border-color: var(--error); color: #c62828; }
|
||||||
|
.status-warning { background: #fff8e1; border-color: var(--warning); color: #f57c00; }
|
||||||
|
.status-info { background: #e3f2fd; border-color: var(--primary); color: #1565c0; }
|
||||||
|
.status-label { font-weight: 600; }
|
||||||
|
|
||||||
|
/* ---------- 日志区(暗色终端) ---------- */
|
||||||
|
.log-section {
|
||||||
|
margin-top: 28px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 420px;
|
||||||
|
}
|
||||||
|
.log-section h4 {
|
||||||
|
margin: 0 0 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
.log-output {
|
||||||
|
flex: 1;
|
||||||
|
background: #1e1e1e;
|
||||||
|
color: #cdd3de;
|
||||||
|
border: 1px solid #2d2d2d;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 16px;
|
||||||
|
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.5;
|
||||||
|
overflow-y: auto;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-all;
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
counter-reset: line;
|
||||||
|
}
|
||||||
|
.log-line {
|
||||||
|
counter-increment: line;
|
||||||
|
position: relative;
|
||||||
|
padding-left: 40px;
|
||||||
|
}
|
||||||
|
.log-line::before {
|
||||||
|
content: counter(line);
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
width: 32px;
|
||||||
|
text-align: right;
|
||||||
|
color: #5c6370;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- 旋转动画 ---------- */
|
||||||
|
.spin-box { display: inline-flex; align-items: center; gap: 6px; }
|
||||||
|
.spin { width: 16px; height: 16px; fill: currentColor; animation: spin 1s linear infinite; }
|
||||||
|
@keyframes spin { to { transform: rotate(360deg); } }
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user