统一用户信息付费查看
This commit is contained in:
@@ -23,9 +23,11 @@ function getDialogElement(id) {
|
||||
* @param {string} options.color
|
||||
* @param {string} options.type
|
||||
* @param {string} [options.defaultVal]
|
||||
* @param {string} [options.confirmText]
|
||||
* @param {string} [options.cancelText]
|
||||
* @returns {void}
|
||||
*/
|
||||
function openDialog({ message, title, color, type, defaultVal }) {
|
||||
function openDialog({ message, title, color, type, defaultVal, confirmText, cancelText }) {
|
||||
currentDialogType = type;
|
||||
|
||||
const header = getDialogElement("global-dialog-header");
|
||||
@@ -44,6 +46,8 @@ function openDialog({ message, title, color, type, defaultVal }) {
|
||||
header.style.background = color;
|
||||
messageBox.textContent = message;
|
||||
confirmButton.style.background = color;
|
||||
confirmButton.textContent = confirmText || "确定";
|
||||
cancelButton.textContent = cancelText || "取消";
|
||||
|
||||
if (type === "prompt") {
|
||||
inputElement.value = defaultVal ?? "";
|
||||
@@ -105,12 +109,14 @@ function createChatDialogApi() {
|
||||
* @param {string} message
|
||||
* @param {string} title
|
||||
* @param {string} color
|
||||
* @param {string} confirmText
|
||||
* @param {string} cancelText
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
confirm(message, title = "请确认", color = "#cc4444") {
|
||||
confirm(message, title = "请确认", color = "#cc4444", confirmText = "确定", cancelText = "取消") {
|
||||
return new Promise((resolve) => {
|
||||
dialogResolve = resolve;
|
||||
openDialog({ message, title, color, type: "confirm" });
|
||||
openDialog({ message, title, color, type: "confirm", confirmText, cancelText });
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user