main #2

Merged
jingrow merged 250 commits from main into v1 2026-01-13 22:45:50 +08:00
2 changed files with 15 additions and 43 deletions
Showing only changes of commit 5ea7f12a47 - Show all commits

View File

@ -191,8 +191,11 @@ export default {
],
primaryAction({ listResource: jsiteServers }) {
return {
label: '新建Jsite服务器',
icon: 'plus',
label: '新建服务器',
variant: 'solid',
slots: {
prefix: icon('plus')
},
onClick() {
router.push('/jsite-servers/new');
}
@ -217,7 +220,7 @@ export default {
breadcrumbs({ documentResource: jsiteServer }) {
return [
{
label: 'Jsite服务器',
label: '服务器',
route: '/jsite-servers'
},
{

View File

@ -1,27 +1,27 @@
<template>
<Dialog :options="{ title: '新建 Jsite 服务器', size: 'lg' }" v-model="show">
<Dialog :options="{ title: '新建服务器', size: 'lg' }" v-model="show">
<!-- 第一步选择服务器配置和支付方式 -->
<template v-if="!showPaymentProcessing" #body-content>
<div class="p-4 sm:p-6">
<div class="mb-6">
<p class="mt-1 text-sm text-gray-600">
请选择服务器配置并填写相关信息点击"创建"后将自动为您开通
请选择服务器配置和支付方式点击"创建"后将自动为您开通
</p>
</div>
<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">
<option value="">请选择</option>
<option value="">请选择</option>
<option v-for="region in regions" :key="getRegionId(region)" :value="getRegionId(region)">
{{ getRegionName(region) }}
</option>
</select>
<!-- 调试信息 -->
<div v-if="regions.length === 0" class="mt-2 text-sm text-gray-500">
正在加载域列表...
正在加载域列表...
</div>
<div v-if="regions.length > 0" class="mt-2 text-sm text-gray-500">
已加载 {{ regions.length }}
已加载 {{ regions.length }}
</div>
</div>
<div class="mb-4">
@ -211,7 +211,7 @@
@click="createInstance"
:disabled="isLoading"
>
{{ isLoading ? '处理中...' : '确认创建' }}
{{ isLoading ? '处理中...' : '创建' }}
</button>
<div class="flex justify-between w-full" v-else>
@ -282,11 +282,8 @@ export default {
return {
url: 'jcloud.api.aliyun_server_light.get_aliyun_regions',
onSuccess(response) {
console.log('地域API完整响应:', response);
// : {success: true, data: {...}, message: '...'}
const data = response.data || response;
console.log('提取的data部分:', data);
//
let regionsData = [];
@ -308,19 +305,14 @@ export default {
regionsData = data.body.Regions;
}
console.log('解析后的地域数据:', regionsData);
if (Array.isArray(regionsData) && regionsData.length > 0) {
this.regions = regionsData;
console.log('成功设置地域数据:', this.regions);
} else {
this.error = '地域数据格式不正确或为空';
console.error('地域数据格式错误:', data);
this.error = '区域数据格式不正确或为空';
}
},
onError(error) {
console.error('获取地域失败:', error);
this.error = error.message || '获取地域失败';
this.error = error.message || '获取区域失败';
}
};
},
@ -340,10 +332,7 @@ export default {
return {
url: 'jcloud.api.aliyun_server_light.get_aliyun_images',
onSuccess(response) {
console.log('镜像API完整响应:', response);
const data = response.data || response;
console.log('镜像API data部分:', data);
//
let imagesData = [];
@ -365,18 +354,13 @@ export default {
imagesData = data.body.Images;
}
console.log('解析后的镜像数据:', imagesData);
if (Array.isArray(imagesData) && imagesData.length > 0) {
this.images = imagesData;
console.log('成功设置镜像数据:', this.images);
} else {
this.error = '镜像数据格式不正确或为空';
console.error('镜像数据格式错误:', data);
}
},
onError(error) {
console.error('获取镜像失败:', error);
this.error = error.message || '获取镜像失败';
}
};
@ -399,10 +383,6 @@ export default {
return;
}
console.log('订单创建成功,完整响应:', data);
console.log('订单ID:', data.order?.order_id);
console.log('服务器记录:', data.server);
//
this.order = data.order;
this.server = data.server; //
@ -412,7 +392,6 @@ export default {
this.processPayment();
},
onError(error) {
console.error('创建服务器订单失败:', error);
this.error = error.message || '创建服务器订单失败';
}
};
@ -539,20 +518,16 @@ export default {
this.stopPaymentCheck();
},
mounted() {
console.log('组件mounted开始获取地域列表');
this.$resources.aliyunRegions.submit();
},
methods: {
async onRegionChange() {
console.log('地域变更选择的地域ID:', this.selectedRegionId);
this.selectedPlanId = '';
this.selectedImageId = '';
this.plans = [];
this.images = [];
if (this.selectedRegionId) {
console.log('开始获取套餐和镜像数据...');
await this.$resources.aliyunPlans.submit({ region_id: this.selectedRegionId });
await this.$resources.aliyunImages.submit({
region_id: this.selectedRegionId,
@ -606,17 +581,11 @@ export default {
this.error = null;
if (!this.order || !this.order.order_id) {
console.error('缺少订单ID无法继续支付');
this.error = '订单信息不完整,请重试';
this.isProcessingPayment = false;
return;
}
console.log('准备处理支付,订单信息:', {
id: this.order.order_id,
method: this.selectedPaymentMethod
});
if (this.selectedPaymentMethod === 'balance') {
this.$resources.processBalancePayment.submit({
order_id: this.order.order_id