删除NewJsiteServer.vue调试日志优化jsite_server.js
This commit is contained in:
parent
77bc63da84
commit
5ea7f12a47
@ -191,8 +191,11 @@ export default {
|
|||||||
],
|
],
|
||||||
primaryAction({ listResource: jsiteServers }) {
|
primaryAction({ listResource: jsiteServers }) {
|
||||||
return {
|
return {
|
||||||
label: '新建Jsite服务器',
|
label: '新建服务器',
|
||||||
icon: 'plus',
|
variant: 'solid',
|
||||||
|
slots: {
|
||||||
|
prefix: icon('plus')
|
||||||
|
},
|
||||||
onClick() {
|
onClick() {
|
||||||
router.push('/jsite-servers/new');
|
router.push('/jsite-servers/new');
|
||||||
}
|
}
|
||||||
@ -217,7 +220,7 @@ export default {
|
|||||||
breadcrumbs({ documentResource: jsiteServer }) {
|
breadcrumbs({ documentResource: jsiteServer }) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'Jsite服务器',
|
label: '服务器',
|
||||||
route: '/jsite-servers'
|
route: '/jsite-servers'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,27 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog :options="{ title: '新建 Jsite 服务器', size: 'lg' }" v-model="show">
|
<Dialog :options="{ title: '新建服务器', size: 'lg' }" v-model="show">
|
||||||
<!-- 第一步:选择服务器配置和支付方式 -->
|
<!-- 第一步:选择服务器配置和支付方式 -->
|
||||||
<template v-if="!showPaymentProcessing" #body-content>
|
<template v-if="!showPaymentProcessing" #body-content>
|
||||||
<div class="p-4 sm:p-6">
|
<div class="p-4 sm:p-6">
|
||||||
<div class="mb-6">
|
<div class="mb-6">
|
||||||
<p class="mt-1 text-sm text-gray-600">
|
<p class="mt-1 text-sm text-gray-600">
|
||||||
请选择服务器配置并填写相关信息,点击"创建"后将自动为您开通。
|
请选择服务器配置和支付方式,点击"创建"后将自动为您开通。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">地域选择</label>
|
<label class="block text-sm font-medium text-gray-700 mb-2">区域选择</label>
|
||||||
<select v-model="selectedRegionId" class="w-full border rounded px-3 py-2" required @change="onRegionChange">
|
<select v-model="selectedRegionId" class="w-full border rounded px-3 py-2" required @change="onRegionChange">
|
||||||
<option value="">请选择地域</option>
|
<option value="">请选择区域</option>
|
||||||
<option v-for="region in regions" :key="getRegionId(region)" :value="getRegionId(region)">
|
<option v-for="region in regions" :key="getRegionId(region)" :value="getRegionId(region)">
|
||||||
{{ getRegionName(region) }}
|
{{ getRegionName(region) }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<!-- 调试信息 -->
|
<!-- 调试信息 -->
|
||||||
<div v-if="regions.length === 0" class="mt-2 text-sm text-gray-500">
|
<div v-if="regions.length === 0" class="mt-2 text-sm text-gray-500">
|
||||||
正在加载地域列表...
|
正在加载区域列表...
|
||||||
</div>
|
</div>
|
||||||
<div v-if="regions.length > 0" class="mt-2 text-sm text-gray-500">
|
<div v-if="regions.length > 0" class="mt-2 text-sm text-gray-500">
|
||||||
已加载 {{ regions.length }} 个地域
|
已加载 {{ regions.length }} 个区域
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
@ -211,7 +211,7 @@
|
|||||||
@click="createInstance"
|
@click="createInstance"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
>
|
>
|
||||||
{{ isLoading ? '处理中...' : '确认创建' }}
|
{{ isLoading ? '处理中...' : '创建' }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="flex justify-between w-full" v-else>
|
<div class="flex justify-between w-full" v-else>
|
||||||
@ -282,11 +282,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
url: 'jcloud.api.aliyun_server_light.get_aliyun_regions',
|
url: 'jcloud.api.aliyun_server_light.get_aliyun_regions',
|
||||||
onSuccess(response) {
|
onSuccess(response) {
|
||||||
console.log('地域API完整响应:', response);
|
|
||||||
|
|
||||||
// 后端返回格式: {success: true, data: {...}, message: '...'}
|
// 后端返回格式: {success: true, data: {...}, message: '...'}
|
||||||
const data = response.data || response;
|
const data = response.data || response;
|
||||||
console.log('提取的data部分:', data);
|
|
||||||
|
|
||||||
// 处理不同的数据结构可能性
|
// 处理不同的数据结构可能性
|
||||||
let regionsData = [];
|
let regionsData = [];
|
||||||
@ -308,19 +305,14 @@ export default {
|
|||||||
regionsData = data.body.Regions;
|
regionsData = data.body.Regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('解析后的地域数据:', regionsData);
|
|
||||||
|
|
||||||
if (Array.isArray(regionsData) && regionsData.length > 0) {
|
if (Array.isArray(regionsData) && regionsData.length > 0) {
|
||||||
this.regions = regionsData;
|
this.regions = regionsData;
|
||||||
console.log('成功设置地域数据:', this.regions);
|
|
||||||
} else {
|
} else {
|
||||||
this.error = '地域数据格式不正确或为空';
|
this.error = '区域数据格式不正确或为空';
|
||||||
console.error('地域数据格式错误:', data);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError(error) {
|
onError(error) {
|
||||||
console.error('获取地域失败:', error);
|
this.error = error.message || '获取区域失败';
|
||||||
this.error = error.message || '获取地域失败';
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -340,10 +332,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
url: 'jcloud.api.aliyun_server_light.get_aliyun_images',
|
url: 'jcloud.api.aliyun_server_light.get_aliyun_images',
|
||||||
onSuccess(response) {
|
onSuccess(response) {
|
||||||
console.log('镜像API完整响应:', response);
|
|
||||||
|
|
||||||
const data = response.data || response;
|
const data = response.data || response;
|
||||||
console.log('镜像API data部分:', data);
|
|
||||||
|
|
||||||
// 处理不同的数据结构可能性
|
// 处理不同的数据结构可能性
|
||||||
let imagesData = [];
|
let imagesData = [];
|
||||||
@ -365,18 +354,13 @@ export default {
|
|||||||
imagesData = data.body.Images;
|
imagesData = data.body.Images;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('解析后的镜像数据:', imagesData);
|
|
||||||
|
|
||||||
if (Array.isArray(imagesData) && imagesData.length > 0) {
|
if (Array.isArray(imagesData) && imagesData.length > 0) {
|
||||||
this.images = imagesData;
|
this.images = imagesData;
|
||||||
console.log('成功设置镜像数据:', this.images);
|
|
||||||
} else {
|
} else {
|
||||||
this.error = '镜像数据格式不正确或为空';
|
this.error = '镜像数据格式不正确或为空';
|
||||||
console.error('镜像数据格式错误:', data);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError(error) {
|
onError(error) {
|
||||||
console.error('获取镜像失败:', error);
|
|
||||||
this.error = error.message || '获取镜像失败';
|
this.error = error.message || '获取镜像失败';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -399,10 +383,6 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('订单创建成功,完整响应:', data);
|
|
||||||
console.log('订单ID:', data.order?.order_id);
|
|
||||||
console.log('服务器记录:', data.server);
|
|
||||||
|
|
||||||
// 显示订单支付界面
|
// 显示订单支付界面
|
||||||
this.order = data.order;
|
this.order = data.order;
|
||||||
this.server = data.server; // 保存服务器记录信息
|
this.server = data.server; // 保存服务器记录信息
|
||||||
@ -412,7 +392,6 @@ export default {
|
|||||||
this.processPayment();
|
this.processPayment();
|
||||||
},
|
},
|
||||||
onError(error) {
|
onError(error) {
|
||||||
console.error('创建服务器订单失败:', error);
|
|
||||||
this.error = error.message || '创建服务器订单失败';
|
this.error = error.message || '创建服务器订单失败';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -539,20 +518,16 @@ export default {
|
|||||||
this.stopPaymentCheck();
|
this.stopPaymentCheck();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log('组件mounted,开始获取地域列表');
|
|
||||||
this.$resources.aliyunRegions.submit();
|
this.$resources.aliyunRegions.submit();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onRegionChange() {
|
async onRegionChange() {
|
||||||
console.log('地域变更,选择的地域ID:', this.selectedRegionId);
|
|
||||||
|
|
||||||
this.selectedPlanId = '';
|
this.selectedPlanId = '';
|
||||||
this.selectedImageId = '';
|
this.selectedImageId = '';
|
||||||
this.plans = [];
|
this.plans = [];
|
||||||
this.images = [];
|
this.images = [];
|
||||||
|
|
||||||
if (this.selectedRegionId) {
|
if (this.selectedRegionId) {
|
||||||
console.log('开始获取套餐和镜像数据...');
|
|
||||||
await this.$resources.aliyunPlans.submit({ region_id: this.selectedRegionId });
|
await this.$resources.aliyunPlans.submit({ region_id: this.selectedRegionId });
|
||||||
await this.$resources.aliyunImages.submit({
|
await this.$resources.aliyunImages.submit({
|
||||||
region_id: this.selectedRegionId,
|
region_id: this.selectedRegionId,
|
||||||
@ -606,17 +581,11 @@ export default {
|
|||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
if (!this.order || !this.order.order_id) {
|
if (!this.order || !this.order.order_id) {
|
||||||
console.error('缺少订单ID,无法继续支付');
|
|
||||||
this.error = '订单信息不完整,请重试';
|
this.error = '订单信息不完整,请重试';
|
||||||
this.isProcessingPayment = false;
|
this.isProcessingPayment = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('准备处理支付,订单信息:', {
|
|
||||||
id: this.order.order_id,
|
|
||||||
method: this.selectedPaymentMethod
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.selectedPaymentMethod === 'balance') {
|
if (this.selectedPaymentMethod === 'balance') {
|
||||||
this.$resources.processBalancePayment.submit({
|
this.$resources.processBalancePayment.submit({
|
||||||
order_id: this.order.order_id
|
order_id: this.order.order_id
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user