删除NewJsiteServer.vue调试日志优化jsite_server.js

This commit is contained in:
jingrow 2025-07-29 13:43:51 +08:00
parent 77bc63da84
commit 5ea7f12a47
2 changed files with 15 additions and 43 deletions

View File

@ -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'
}, },
{ {

View File

@ -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