refactor: rename the theme brand and every identifier from AKSRT to Jio
Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5b16bc6e15
commit
35bb96e82f
997 files changed
+28216
-28188
No files matched your search
@@ -1,20 +1,20 @@
|
||||
/**
|
||||
* AKSRT Ticket Center Core — 工单中心共享层(REST、提示、行内校验、弹窗、图片上传)。
|
||||
* Jio Ticket Center Core — 工单中心共享层(REST、提示、行内校验、弹窗、图片上传)。
|
||||
*
|
||||
* 由 ticket-center.js(列表 / 详情 / 新建)消费,挂到 window.AksrtTicketCore。
|
||||
* 由 ticket-center.js(列表 / 详情 / 新建)消费,挂到 window.JioTicketCore。
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var API_ROOT = (function () {
|
||||
var d = window.aksrtData || {};
|
||||
var raw = d.apiUrl || d.restUrl || d.rest_url || '/index.php?rest_route=/aksrt/v1';
|
||||
var d = window.jioData || {};
|
||||
var raw = d.apiUrl || d.restUrl || d.rest_url || '/index.php?rest_route=/jio/v1';
|
||||
return String(raw).replace(/\/$/, '');
|
||||
})();
|
||||
var NONCE = (window.aksrtData && window.aksrtData.restNonce) || '';
|
||||
var NONCE = (window.jioData && window.jioData.restNonce) || '';
|
||||
var IMAGE_ACCEPT = 'image/gif,image/jpeg,image/png,image/webp';
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* ------------------------------------------------------------------ */
|
||||
|
||||
function settings() {
|
||||
var d = window.aksrtData && window.aksrtData.ticket;
|
||||
var d = window.jioData && window.jioData.ticket;
|
||||
return d && typeof d === 'object' ? d : {};
|
||||
}
|
||||
|
||||
@@ -76,10 +76,10 @@
|
||||
// 提交前的人机验证:场景未启用时无挂载点,run 直接 resolve {};
|
||||
// 用户中途取消验证时 run resolve null,此时 reject {cancelled:true} 中止提交。
|
||||
function runCaptcha(scene) {
|
||||
if (!window.AKSRTCaptcha || typeof window.AKSRTCaptcha.run !== 'function') {
|
||||
if (!window.JioCaptcha || typeof window.JioCaptcha.run !== 'function') {
|
||||
return Promise.resolve({});
|
||||
}
|
||||
return window.AKSRTCaptcha.run(scene).then(function (payload) {
|
||||
return window.JioCaptcha.run(scene).then(function (payload) {
|
||||
return payload === null ? Promise.reject({ cancelled: true }) : (payload || {});
|
||||
}, function () {
|
||||
return Promise.reject({ message: '人机验证未通过' });
|
||||
@@ -108,13 +108,13 @@
|
||||
}
|
||||
|
||||
function statusBadge(ticket) {
|
||||
return '<span class="aksrt-ticket-badge" style="--aksrt-ticket-color:' + escapeHtml(ticket.status_color || '#6b7280') + '">'
|
||||
return '<span class="jio-ticket-badge" style="--jio-ticket-color:' + escapeHtml(ticket.status_color || '#6b7280') + '">'
|
||||
+ escapeHtml(ticket.status_label || ticket.status) + '</span>';
|
||||
}
|
||||
|
||||
function emptyHtml(iconName, title, text, action) {
|
||||
return '<div class="aksrt-tickets-page__empty">'
|
||||
+ '<span class="aksrt-tickets-page__empty-icon">' + icon(iconName) + '</span>'
|
||||
return '<div class="jio-tickets-page__empty">'
|
||||
+ '<span class="jio-tickets-page__empty-icon">' + icon(iconName) + '</span>'
|
||||
+ '<h3>' + escapeHtml(title) + '</h3>'
|
||||
+ '<p>' + escapeHtml(text) + '</p>'
|
||||
+ (action || '') + '</div>';
|
||||
@@ -144,12 +144,12 @@
|
||||
function markInvalid(field, text) {
|
||||
if (!field) return;
|
||||
field.setAttribute('aria-invalid', 'true');
|
||||
var holder = field.closest('.aksrt-ticket-field') || field.parentNode;
|
||||
var error = holder.querySelector('.aksrt-ticket-field__error');
|
||||
var holder = field.closest('.jio-ticket-field') || field.parentNode;
|
||||
var error = holder.querySelector('.jio-ticket-field__error');
|
||||
if (!error) {
|
||||
error = document.createElement('p');
|
||||
error.className = 'aksrt-ticket-field__error';
|
||||
error.id = 'aksrt-ticket-err-' + Math.random().toString(36).slice(2, 8);
|
||||
error.className = 'jio-ticket-field__error';
|
||||
error.id = 'jio-ticket-err-' + Math.random().toString(36).slice(2, 8);
|
||||
error.setAttribute('role', 'alert');
|
||||
holder.appendChild(error);
|
||||
}
|
||||
@@ -163,14 +163,14 @@
|
||||
if (!field || field.getAttribute('aria-invalid') !== 'true') return;
|
||||
field.removeAttribute('aria-invalid');
|
||||
field.removeAttribute('aria-describedby');
|
||||
var holder = field.closest('.aksrt-ticket-field') || field.parentNode;
|
||||
var error = holder && holder.querySelector('.aksrt-ticket-field__error');
|
||||
var holder = field.closest('.jio-ticket-field') || field.parentNode;
|
||||
var error = holder && holder.querySelector('.jio-ticket-field__error');
|
||||
if (error) error.remove();
|
||||
}
|
||||
|
||||
function updateCounter(shell, field) {
|
||||
if (!field || !field.name || !field.maxLength || field.maxLength < 0) return;
|
||||
var counter = shell.querySelector('[data-aksrt-ticket-counter="' + field.name + '"]');
|
||||
var counter = shell.querySelector('[data-jio-ticket-counter="' + field.name + '"]');
|
||||
if (!counter) return;
|
||||
var length = field.value.length;
|
||||
counter.textContent = length + ' / ' + field.maxLength;
|
||||
@@ -182,11 +182,11 @@
|
||||
* ------------------------------------------------------------------ */
|
||||
|
||||
function openModal(options) {
|
||||
if (!window.AksrtModalRuntime || typeof window.AksrtModalRuntime.open !== 'function') {
|
||||
if (!window.JioModalRuntime || typeof window.JioModalRuntime.open !== 'function') {
|
||||
notyf('工单组件加载失败,请刷新页面后重试', 'danger');
|
||||
return null;
|
||||
}
|
||||
return window.AksrtModalRuntime.open(Object.assign({ mobileBottom: true }, options));
|
||||
return window.JioModalRuntime.open(Object.assign({ mobileBottom: true }, options));
|
||||
}
|
||||
|
||||
|
||||
@@ -195,26 +195,26 @@
|
||||
}
|
||||
|
||||
function setModalContent(shell, html) {
|
||||
var content = shell.querySelector('.aksrt-modal-runtime__content');
|
||||
var content = shell.querySelector('.jio-modal-runtime__content');
|
||||
if (content) content.innerHTML = html;
|
||||
shell.setAttribute('data-aksrt-modal-state', 'ready');
|
||||
shell.setAttribute('data-jio-modal-state', 'ready');
|
||||
}
|
||||
|
||||
function modalError(shell, text) {
|
||||
setModalContent(shell, emptyHtml('fa-exclamation-circle', '加载失败', text,
|
||||
'<button type="button" class="btn-outline" data-aksrt-modal-close>关闭</button>'));
|
||||
'<button type="button" class="btn-outline" data-jio-modal-close>关闭</button>'));
|
||||
}
|
||||
|
||||
function imageHolder(root) {
|
||||
return root ? root.querySelector('[data-aksrt-ticket-images]') : null;
|
||||
return root ? root.querySelector('[data-jio-ticket-images]') : null;
|
||||
}
|
||||
|
||||
function collectAttachments(root) {
|
||||
var out = [];
|
||||
var holder = imageHolder(root);
|
||||
if (!holder) return out;
|
||||
holder.querySelectorAll('[data-aksrt-ticket-image]').forEach(function (node) {
|
||||
var url = node.getAttribute('data-aksrt-ticket-image');
|
||||
holder.querySelectorAll('[data-jio-ticket-image]').forEach(function (node) {
|
||||
var url = node.getAttribute('data-jio-ticket-image');
|
||||
if (url && out.length < attachmentMax()) out.push(url);
|
||||
});
|
||||
return out;
|
||||
@@ -229,10 +229,10 @@
|
||||
var holder = imageHolder(root);
|
||||
if (!holder) return;
|
||||
var full = holder.children.length >= attachmentMax();
|
||||
root.querySelectorAll('[data-aksrt-ticket-upload]').forEach(function (button) {
|
||||
root.querySelectorAll('[data-jio-ticket-upload]').forEach(function (button) {
|
||||
button.disabled = full;
|
||||
});
|
||||
var count = root.querySelector('[data-aksrt-ticket-image-count]');
|
||||
var count = root.querySelector('[data-jio-ticket-image-count]');
|
||||
if (count) {
|
||||
count.textContent = holder.children.length + ' / ' + attachmentMax();
|
||||
count.classList.toggle('is-zero', holder.children.length === 0);
|
||||
@@ -264,8 +264,8 @@
|
||||
|
||||
function uploadOne(root, holder, file) {
|
||||
var tile = document.createElement('div');
|
||||
tile.className = 'aksrt-ticket-image is-uploading';
|
||||
tile.innerHTML = '<span class="aksrt-ticket-image__spinner" aria-hidden="true"></span><span class="screen-reader-text">正在上传</span>';
|
||||
tile.className = 'jio-ticket-image is-uploading';
|
||||
tile.innerHTML = '<span class="jio-ticket-image__spinner" aria-hidden="true"></span><span class="screen-reader-text">正在上传</span>';
|
||||
holder.appendChild(tile);
|
||||
|
||||
var body = new FormData();
|
||||
@@ -279,11 +279,11 @@
|
||||
var url = result && (result.url || (result.data && result.data.url));
|
||||
if (!url) return Promise.reject(result);
|
||||
tile.classList.remove('is-uploading');
|
||||
tile.setAttribute('data-aksrt-ticket-image', url);
|
||||
tile.setAttribute('data-jio-ticket-image', url);
|
||||
var uploadId = result.data && result.data.id;
|
||||
if (uploadId) tile.setAttribute('data-aksrt-ticket-image-id', String(uploadId));
|
||||
if (uploadId) tile.setAttribute('data-jio-ticket-image-id', String(uploadId));
|
||||
tile.innerHTML = '<img src="' + escapeHtml(url) + '" alt="">'
|
||||
+ '<button type="button" class="aksrt-ticket-image__remove" data-aksrt-ticket-image-remove aria-label="移除图片">'
|
||||
+ '<button type="button" class="jio-ticket-image__remove" data-jio-ticket-image-remove aria-label="移除图片">'
|
||||
+ icon('fa-times') + '</button>';
|
||||
}).catch(function (error) {
|
||||
tile.remove();
|
||||
@@ -310,16 +310,16 @@
|
||||
});
|
||||
|
||||
shell.addEventListener('click', function (event) {
|
||||
var remove = event.target.closest('[data-aksrt-ticket-image-remove]');
|
||||
var remove = event.target.closest('[data-jio-ticket-image-remove]');
|
||||
if (remove) {
|
||||
var root = remove.closest('form');
|
||||
var tile = remove.closest('.aksrt-ticket-image');
|
||||
discardUpload(tile.getAttribute('data-aksrt-ticket-image-id'));
|
||||
var tile = remove.closest('.jio-ticket-image');
|
||||
discardUpload(tile.getAttribute('data-jio-ticket-image-id'));
|
||||
tile.remove();
|
||||
syncUploader(root);
|
||||
return;
|
||||
}
|
||||
var upload = event.target.closest('[data-aksrt-ticket-upload]');
|
||||
var upload = event.target.closest('[data-jio-ticket-upload]');
|
||||
if (upload) {
|
||||
ctx.uploadRoot = upload.closest('form');
|
||||
input.click();
|
||||
@@ -351,17 +351,17 @@
|
||||
// 回复框:工具栏里的「图片」按钮 + 输入框上方的待发送缩略图条(空时由 CSS :empty 收起)。
|
||||
function attachButtonHtml() {
|
||||
if (!attachmentEnabled()) return '';
|
||||
return '<button type="button" class="aksrt-ticket-tool" data-aksrt-ticket-upload title="添加图片,也可直接粘贴截图">'
|
||||
return '<button type="button" class="jio-ticket-tool" data-jio-ticket-upload title="添加图片,也可直接粘贴截图">'
|
||||
+ icon('fa-image') + '<span>图片</span>'
|
||||
+ '<span class="aksrt-ticket-tool__count is-zero" data-aksrt-ticket-image-count>0 / ' + attachmentMax() + '</span></button>';
|
||||
+ '<span class="jio-ticket-tool__count is-zero" data-jio-ticket-image-count>0 / ' + attachmentMax() + '</span></button>';
|
||||
}
|
||||
|
||||
function attachTrayHtml() {
|
||||
if (!attachmentEnabled()) return '';
|
||||
return '<div class="aksrt-ticket-tray" data-aksrt-ticket-images aria-label="待发送图片"></div>';
|
||||
return '<div class="jio-ticket-tray" data-jio-ticket-images aria-label="待发送图片"></div>';
|
||||
}
|
||||
|
||||
window.AksrtTicketCore = {
|
||||
window.JioTicketCore = {
|
||||
settings: settings,
|
||||
attachmentEnabled: attachmentEnabled,
|
||||
attachmentMax: attachmentMax,
|
||||
|
||||
Reference in new issue
Block a user