|
|
|
@ -59,6 +59,32 @@ onBeforeMount( |
|
|
|
|
) |
|
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
// region 处理按键文案 |
|
|
|
|
let updateBtn = ref("更新") |
|
|
|
|
const handleBtnName = (ip) => { |
|
|
|
|
if (store.state.update_status[ip] === false) { |
|
|
|
|
updateBtn.value = "更新" |
|
|
|
|
} |
|
|
|
|
if (store.state.update_status[ip] === true) { |
|
|
|
|
updateBtn.value = "更新中" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 更新时禁用全部选项 |
|
|
|
|
const disableAll = ref(false) |
|
|
|
|
|
|
|
|
|
const handleDisable = (ip) => { |
|
|
|
|
disableAll.value = store.state.update_status[ip] === true; |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 更新状态 |
|
|
|
|
const changUpdateStatus = (ip) => { |
|
|
|
|
store.commit("change_update_status", ip) |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region opened事件对应的功能 |
|
|
|
|
// 定义方法用于在加载过程中将ip对应的状态存入全局store中 |
|
|
|
|
const addUpdateStatus = () => { |
|
|
|
@ -88,6 +114,11 @@ const handleOpened = () => { |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region close时间对应功能 |
|
|
|
|
const handleClose = () => { |
|
|
|
|
store.state.update_dialog_show = false |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 提交升级相关逻辑 |
|
|
|
|
const updateForm = ref() |
|
|
|
@ -95,10 +126,11 @@ const checkedCmd = ref([]) |
|
|
|
|
|
|
|
|
|
// 处理点击事件 |
|
|
|
|
const handleRep = (ip) => { |
|
|
|
|
console.log(store.state.update_status[ip]) |
|
|
|
|
changUpdateStatus(ip) // 更新状态 |
|
|
|
|
handleBtnName(props.ip) // 变更按键文案 |
|
|
|
|
handleDisable(props.ip) // 启用全部状态 |
|
|
|
|
store.commit("clear_update_status", props.ip) // 清除临时状态 |
|
|
|
|
console.log(store.state.update_status[ip]) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleUpdate = async () => { |
|
|
|
@ -106,13 +138,7 @@ const handleUpdate = async () => { |
|
|
|
|
alert("请先选择影院和目标版本!") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 更新状态 |
|
|
|
|
changUpdateStatus(props.ip) |
|
|
|
|
// 处理按键显示的文案 |
|
|
|
|
handleBtnName(props.ip) |
|
|
|
|
// 禁用全部选项 |
|
|
|
|
handleDisable(props.ip) |
|
|
|
|
handleRep(props.ip) |
|
|
|
|
|
|
|
|
|
// 添加store全局数据 |
|
|
|
|
let data = {} |
|
|
|
@ -137,47 +163,17 @@ const handleUpdate = async () => { |
|
|
|
|
// 处理成功逻辑 |
|
|
|
|
const ip = JSON.parse(JSON.stringify(res))["ip"] |
|
|
|
|
handleRep(ip) |
|
|
|
|
store.commit("clear_update_status", ip) // 清除临时状态 |
|
|
|
|
}).catch(err => { |
|
|
|
|
const ip = JSON.parse(JSON.stringify(err))["ip"] |
|
|
|
|
const ip = err.config.params.ip |
|
|
|
|
handleRep(ip) |
|
|
|
|
store.commit("clear_update_status", ip) // 清除临时状态 |
|
|
|
|
alert("升级失败,请重试!") |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 更新状态 |
|
|
|
|
const changUpdateStatus = (ip) => { |
|
|
|
|
store.commit("change_update_status", ip) |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 处理按键文案 |
|
|
|
|
let updateBtn = ref("更新") |
|
|
|
|
const handleBtnName = (ip) => { |
|
|
|
|
if (store.state.update_status[ip] === false) { |
|
|
|
|
updateBtn.value = "更新" |
|
|
|
|
} |
|
|
|
|
if (store.state.update_status[ip] === true) { |
|
|
|
|
updateBtn.value = "更新中" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 更新时禁用全部选项 |
|
|
|
|
const disableAll = ref(false) |
|
|
|
|
|
|
|
|
|
const handleDisable = (ip) => { |
|
|
|
|
disableAll.value = store.state.update_status[ip] === true; |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
// region 独立的生命周期 |
|
|
|
|
const handleClose = () => { |
|
|
|
|
store.state.update_dialog_show = false |
|
|
|
|
} |
|
|
|
|
// endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|