删除技能功能修复
This commit is contained in:
@@ -394,11 +394,31 @@ function addSkill() {
|
||||
|
||||
// 删除技能
|
||||
function removeSkill(index) {
|
||||
state.skills.splice(index, 1);
|
||||
const skill = state.skills[index];
|
||||
|
||||
// 更新完成度
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
// 如果有技能id,调用删除接口
|
||||
if (skill && skill.id) {
|
||||
$api.createRequest(`/app/appskill/${skill.id}`, {}, 'DELETE').then(() => {
|
||||
// 接口调用成功,从本地数组中移除
|
||||
state.skills.splice(index, 1);
|
||||
|
||||
// 更新完成度
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
|
||||
$api.msg('删除成功');
|
||||
}).catch((err) => {
|
||||
console.error('删除技能失败:', err);
|
||||
$api.msg('删除失败,请重试');
|
||||
});
|
||||
} else {
|
||||
// 没有id的技能(新增的),直接从本地数组中移除
|
||||
state.skills.splice(index, 1);
|
||||
|
||||
// 更新完成度
|
||||
const result = getFormCompletionPercent(fromValue);
|
||||
percent.value = result;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取技能等级文本
|
||||
|
||||
Reference in New Issue
Block a user