自定义源添加更新地址参数
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { onBeforeUnmount, useI18n } from '@renderer/utils/vueTools'
|
||||
import { onUserApiStatus, setUserApi, getUserApiList, userApiRequest, userApiRequestCancel, onShowUserApiUpdateAlert } from '@renderer/utils/tools'
|
||||
import { openUrl } from '@renderer/utils'
|
||||
import apiSourceInfo from '@renderer/utils/music/api-source-info'
|
||||
import music from '@renderer/utils/music'
|
||||
import { apiSource, qualityList, userApi } from '@renderer/core/share'
|
||||
@@ -69,11 +70,27 @@ export default ({ setting }) => {
|
||||
}
|
||||
})
|
||||
|
||||
const rUserApiShowUpdateAlert = onShowUserApiUpdateAlert((event, { name, message }) => {
|
||||
dialog({
|
||||
message: `${t('user_api__update_alert', { name })}\n${message}`,
|
||||
confirmButtonText: t('ok'),
|
||||
})
|
||||
const rUserApiShowUpdateAlert = onShowUserApiUpdateAlert((event, { name, log, updateUrl }) => {
|
||||
if (updateUrl) {
|
||||
dialog({
|
||||
message: `${t('user_api__update_alert', { name })}\n${log}`,
|
||||
selection: true,
|
||||
showCancel: true,
|
||||
confirmButtonText: t('user_api__update_alert_open_url'),
|
||||
cancelButtonText: t('close'),
|
||||
}).then(confirm => {
|
||||
if (!confirm) return
|
||||
setTimeout(() => {
|
||||
openUrl(updateUrl)
|
||||
}, 300)
|
||||
})
|
||||
} else {
|
||||
dialog({
|
||||
message: `${t('user_api__update_alert', { name })}\n${log}`,
|
||||
selection: true,
|
||||
confirmButtonText: t('ok'),
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<Modal :show="visible" @close="handleCancel" @after-leave="afterLeave" :closeBtn="false" :teleport="teleport">
|
||||
<main :class="$style.main">{{message}}</main>
|
||||
<main class="scroll" :class="[$style.main, { 'select': selection }]">{{message}}</main>
|
||||
<footer :class="$style.footer">
|
||||
<Btn :class="$style.btn" v-if="showCancel" @click="handleCancel">{{cancelBtnText}}</Btn>
|
||||
<Btn :class="$style.btn" @click="handleComfirm">{{confirmBtnText}}</Btn>
|
||||
@@ -30,6 +30,7 @@ export default {
|
||||
cancelButtonText: '',
|
||||
confirmButtonText: '',
|
||||
teleport: '#root',
|
||||
selection: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -58,9 +59,9 @@ export default {
|
||||
.main {
|
||||
flex: auto;
|
||||
min-height: 40px;
|
||||
padding: 15px;
|
||||
padding: 15px 15px 0;
|
||||
font-size: 14px;
|
||||
max-width: 320px;
|
||||
// max-width: 320px;
|
||||
min-width: 220px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-line;
|
||||
@@ -68,7 +69,7 @@ export default {
|
||||
|
||||
.footer {
|
||||
flex: none;
|
||||
padding: 0 15px 15px;
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: flex-end;
|
||||
|
||||
@@ -10,10 +10,11 @@ const defaultOptions = {
|
||||
showCancel: false,
|
||||
cancelButtonText: '',
|
||||
confirmButtonText: '',
|
||||
selection: false,
|
||||
}
|
||||
|
||||
export const dialog = function(options) {
|
||||
const { message, showCancel, cancelButtonText, confirmButtonText, teleport } =
|
||||
const { message, showCancel, cancelButtonText, confirmButtonText, teleport, selection } =
|
||||
Object.assign({}, defaultOptions, typeof options == 'string' ? { message: options } : options || {})
|
||||
return new Promise((resolve, reject) => {
|
||||
let app = createApp(Dialog, {
|
||||
@@ -32,6 +33,7 @@ export const dialog = function(options) {
|
||||
instance.cancelButtonText = cancelButtonText
|
||||
instance.confirmButtonText = confirmButtonText
|
||||
instance.teleport = teleport
|
||||
instance.selection = selection
|
||||
|
||||
// 挂载
|
||||
document.getElementById('container').appendChild(instance.$el)
|
||||
|
||||
Reference in New Issue
Block a user