验收20%

This commit is contained in:
2026-07-16 07:42:07 +08:00
parent 0dec90ffdd
commit cb25317412
108 changed files with 6477 additions and 1308 deletions
@@ -0,0 +1,63 @@
#target photoshop
app.displayDialogs = DialogModes.NO;
var createdDocument = null;
var previousRulerUnits = app.preferences.rulerUnits;
function readJson(filePath) {
var file = File(filePath);
if (!file.exists) {
throw new Error('Manifest does not exist: ' + filePath);
}
file.encoding = 'UTF8';
if (!file.open('r')) {
throw new Error('Unable to open manifest: ' + filePath);
}
var content = file.read();
file.close();
return eval('(' + content + ')');
}
try {
app.preferences.rulerUnits = Units.PIXELS;
var manifest = readJson(JIAPU_A01_MANIFEST);
var psdFile = File(JIAPU_A01_PSD);
if (psdFile.exists) {
throw new Error('Refusing to overwrite existing PSD: ' + psdFile.fsName);
}
createdDocument = app.documents.add(
manifest.canvas.width,
manifest.canvas.height,
manifest.canvas.resolution,
'JIAPU_A01_SCRIPT_SOURCE',
NewDocumentMode.RGB,
DocumentFill.TRANSPARENT
);
for (var groupIndex = manifest.groups.length - 1; groupIndex >= 0; groupIndex--) {
var groupSpec = manifest.groups[groupIndex];
var group = createdDocument.layerSets.add();
group.name = groupSpec.name;
group.visible = groupSpec.visible;
}
if (createdDocument.artLayers.length > 0) {
createdDocument.artLayers[0].remove();
}
var saveOptions = new PhotoshopSaveOptions();
saveOptions.layers = true;
createdDocument.saveAs(psdFile, saveOptions, true, Extension.LOWERCASE);
createdDocument.close(SaveOptions.DONOTSAVECHANGES);
createdDocument = null;
} catch (error) {
if (createdDocument !== null) {
createdDocument.close(SaveOptions.DONOTSAVECHANGES);
}
throw error;
} finally {
app.preferences.rulerUnits = previousRulerUnits;
}
@@ -0,0 +1,178 @@
#target photoshop
app.displayDialogs = DialogModes.NO;
app.preferences.rulerUnits = Units.PIXELS;
var ROOT = new Folder(JIAPU_A01_ROOT).fsName;
var OUTPUT = new Folder(JIAPU_A01_OUTPUT_DIR);
var PREVIEW_VERSION = typeof JIAPU_A01_PREVIEW_VERSION === 'undefined' ? 'v2' : JIAPU_A01_PREVIEW_VERSION;
if (!OUTPUT.exists) {
OUTPUT.create();
}
function assetPath(relativePath) {
return ROOT + '/' + relativePath;
}
function color(hex) {
var value = hex.replace('#', '');
var result = new SolidColor();
result.rgb.red = parseInt(value.substring(0, 2), 16);
result.rgb.green = parseInt(value.substring(2, 4), 16);
result.rgb.blue = parseInt(value.substring(4, 6), 16);
return result;
}
function placeImage(document, sourcePath, layerName, x, y, width, height, group) {
var sourceDocument = app.open(File(sourcePath));
var layer = sourceDocument.activeLayer.duplicate(document, ElementPlacement.PLACEATBEGINNING);
sourceDocument.close(SaveOptions.DONOTSAVECHANGES);
app.activeDocument = document;
layer.name = layerName;
var bounds = layer.bounds;
var currentWidth = bounds[2].as('px') - bounds[0].as('px');
var currentHeight = bounds[3].as('px') - bounds[1].as('px');
layer.resize(width / currentWidth * 100, height / currentHeight * 100, AnchorPosition.TOPLEFT);
bounds = layer.bounds;
layer.translate(x - bounds[0].as('px'), y - bounds[1].as('px'));
if (group) {
layer.move(group, ElementPlacement.PLACEATBEGINNING);
}
return layer;
}
function addText(document, group, layerName, contents, x, y, size, hex, alignment) {
app.activeDocument = document;
var layer = document.artLayers.add();
layer.kind = LayerKind.TEXT;
layer.name = layerName;
layer.textItem.contents = contents;
layer.textItem.font = 'KaiTi';
layer.textItem.size = UnitValue(size, 'px');
layer.textItem.color = color(hex);
layer.textItem.position = [UnitValue(x, 'px'), UnitValue(y, 'px')];
layer.textItem.justification = alignment === 'left' ? Justification.LEFT : Justification.CENTER;
layer.textItem.antiAliasMethod = AntiAlias.SMOOTH;
layer.move(group, ElementPlacement.PLACEATBEGINNING);
return layer;
}
function addRect(document, group, layerName, x, y, width, height, hex) {
app.activeDocument = document;
var layer = document.artLayers.add();
layer.name = layerName;
document.selection.select([
[x, y],
[x + width, y],
[x + width, y + height],
[x, y + height]
]);
document.selection.fill(color(hex));
document.selection.deselect();
layer.move(group, ElementPlacement.PLACEATBEGINNING);
return layer;
}
function savePsd(document, filePath) {
var options = new PhotoshopSaveOptions();
options.layers = true;
document.saveAs(File(filePath), options, true, Extension.LOWERCASE);
}
function savePng(document, filePath) {
var options = new PNGSaveOptions();
options.interlaced = false;
document.saveAs(File(filePath), options, true, Extension.LOWERCASE);
}
function compose(stateName) {
var document = app.documents.add(1236, 2745, 72, 'A01-' + stateName, NewDocumentMode.RGB, DocumentFill.WHITE);
var common = document.layerSets.add();
common.name = '00-common';
var state = document.layerSets.add();
state.name = stateName === 'password' ? '10-password' : '10-sms';
addRect(document, common, 'page-background', 0, 0, 1236, 2745, '#f4eadc');
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-header-background-candidate-v3.png'), 'ancestral-header', 0, 0, 1236, 510, common);
// 设计预览使用完整母图,避免拆片尚未定稿时产生重叠接缝;运行时切片另行验收。
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-scroll-master-transparent-candidate-v4-1236x2745.png'), 'scroll-master', 29, 430, 1178, 2315, common);
placeImage(document, assetPath('static/assets/foundation/transparent/brand-seal.png'), 'brand-seal', 510, 105, 216, 259, common);
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-title-ornament-candidate-v2.png'), 'title-ornament', 430, 700, 376, 130, common);
addText(document, common, 'page-title', '\u767b\u5f55\u5bb6\u8c31', 618, 960, 126, '#721417', 'center');
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-divider-ornament-candidate-v2.png'), 'title-divider', 348, 995, 540, 90, common);
addText(document, common, 'password-tab', '\u5bc6\u7801\u767b\u5f55', 390, 1165, 70, stateName === 'password' ? '#b10f18' : '#aa8240', 'center');
addText(document, common, 'sms-tab', '\u9a8c\u8bc1\u7801\u767b\u5f55', 846, 1165, 70, stateName === 'sms' ? '#b10f18' : '#aa8240', 'center');
addRect(document, common, 'tab-rule', 180, 1210, 876, 3, '#d7b37a');
addRect(document, common, 'active-tab-rule', stateName === 'password' ? 300 : 756, 1200, 180, 12, '#c3151d');
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-icon-phone-candidate-v1.png'), 'phone-icon', 190, 1270, 100, 100, state);
addText(document, state, 'phone-placeholder', '\u624b\u673a\u53f7', 330, 1355, 60, '#8b8580', 'left');
addRect(document, state, 'phone-line', 180, 1440, 876, 3, '#d7b37a');
if (stateName === 'password') {
placeImage(document, assetPath('static/assets/modules/auth/transparent/a01-icon-lock-v1.png'), 'lock-icon', 196, 1518, 82, 98, state);
addText(document, state, 'password-placeholder', '\u5bc6\u7801', 330, 1590, 60, '#8b8580', 'left');
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-icon-eye-closed-pupil-candidate-v1.png'), 'eye-closed-pupil', 952, 1530, 84, 70, state);
addRect(document, state, 'password-line', 180, 1665, 876, 3, '#d7b37a');
addText(document, state, 'forgot-password', '\u5fd8\u8bb0\u5bc6\u7801', 1020, 1745, 48, '#b10f18', 'center');
} else {
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-icon-sms-three-dots-candidate-v1.png'), 'sms-three-dots', 190, 1510, 100, 100, state);
addText(document, state, 'code-placeholder', '\u9a8c\u8bc1\u7801', 330, 1590, 60, '#8b8580', 'left');
addText(document, state, 'get-code', '\u83b7\u53d6\u9a8c\u8bc1\u7801', 930, 1590, 48, '#b10f18', 'center');
addRect(document, state, 'code-line', 180, 1665, 876, 3, '#d7b37a');
}
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-primary-button-master-candidate-v2.png'), 'primary-button-skin', 180, 1790, 876, 195, common);
addText(document, common, 'login-label', '\u767b\u5f55', 618, 1925, 82, '#ffffff', 'center');
addRect(document, common, 'other-left-line', 190, 2072, 260, 3, '#d7b37a');
addRect(document, common, 'other-right-line', 786, 2072, 260, 3, '#d7b37a');
addText(document, common, 'other-methods', '\u5176\u4ed6\u767b\u5f55\u65b9\u5f0f', 618, 2100, 50, '#aa8240', 'center');
placeImage(document, assetPath('docs/design/assets/a01-vnext/candidates/a01-secondary-button-master-candidate-v2.png'), 'secondary-button-skin', 180, 2160, 876, 180, common);
placeImage(document, assetPath('static/assets/foundation/transparent/auth-wechat.png'), 'wechat-icon', 365, 2190, 105, 105, common);
addText(document, common, 'wechat-label', '\u5fae\u4fe1\u767b\u5f55', 690, 2290, 66, '#30241d', 'center');
addText(document, common, 'register-copy', '\u8fd8\u6ca1\u6709\u8d26\u53f7\uff1f \u6ce8\u518c\u8d26\u53f7', 618, 2425, 46, '#4c3b30', 'center');
placeImage(document, assetPath('static/assets/modules/auth/transparent/a02-agreement-unchecked.png'), 'agreement-unchecked', 180, 2460, 66, 66, common);
addText(document, common, 'agreement-copy', '\u6211\u5df2\u9605\u8bfb\u5e76\u540c\u610f\u300a\u7528\u6237\u534f\u8bae\u300b\u4e0e\u300a\u9690\u79c1\u653f\u7b56\u300b', 270, 2515, 36, '#4c3b30', 'left');
var baseName = stateName === 'password' ? 'A01-page-password-' + PREVIEW_VERSION : 'A01-page-sms-' + PREVIEW_VERSION;
savePsd(document, OUTPUT.fsName + '/' + baseName + '.psd');
savePng(document, OUTPUT.fsName + '/' + baseName + '-1236x2745.png');
document.close(SaveOptions.DONOTSAVECHANGES);
}
function makeContactSheet() {
var contact = null;
var step = 'create';
try {
contact = app.documents.add(2472, 2745, 72, 'A01-contact-sheet', NewDocumentMode.RGB, DocumentFill.WHITE);
step = 'place-password';
placeImage(contact, OUTPUT.fsName + '/A01-page-password-' + PREVIEW_VERSION + '-1236x2745.png', 'password', 0, 0, 1236, 2745, null);
step = 'place-sms';
placeImage(contact, OUTPUT.fsName + '/A01-page-sms-' + PREVIEW_VERSION + '-1236x2745.png', 'sms', 1236, 0, 1236, 2745, null);
step = 'resize';
contact.resizeImage(UnitValue(824, 'px'), UnitValue(915, 'px'), null, ResampleMethod.BICUBICSHARPER);
step = 'save';
savePng(contact, OUTPUT.fsName + '/A01-page-password-sms-contact-' + PREVIEW_VERSION + '-824x915.png');
contact.close(SaveOptions.DONOTSAVECHANGES);
contact = null;
} catch (error) {
if (contact) {
contact.close(SaveOptions.DONOTSAVECHANGES);
}
throw new Error('CONTACT_' + step + ': ' + error.message);
}
}
if (typeof JIAPU_A01_CONTACT_ONLY === 'undefined' || !JIAPU_A01_CONTACT_ONLY) {
compose('password');
compose('sms');
}
if (typeof JIAPU_A01_SKIP_CONTACT === 'undefined' || !JIAPU_A01_SKIP_CONTACT) {
makeContactSheet();
}
'A01_PAGE_PREVIEWS_OK';
@@ -0,0 +1,38 @@
#target photoshop
app.displayDialogs = DialogModes.NO;
var openedDocument = null;
function readJson(filePath) {
var file = File(filePath);
if (!file.exists) {
throw new Error('Manifest does not exist: ' + filePath);
}
file.encoding = 'UTF8';
if (!file.open('r')) {
throw new Error('Unable to open manifest: ' + filePath);
}
var content = file.read();
file.close();
return eval('(' + content + ')');
}
try {
var manifest = readJson(JIAPU_A01_MANIFEST);
var psdFile = File(JIAPU_A01_PSD);
if (!psdFile.exists) {
throw new Error('PSD does not exist: ' + psdFile.fsName);
}
openedDocument = app.open(psdFile);
if (manifest.exports.length !== 0) {
throw new Error('Layer export is not implemented until assets are approved.');
}
openedDocument.close(SaveOptions.DONOTSAVECHANGES);
openedDocument = null;
} catch (error) {
if (openedDocument !== null) {
openedDocument.close(SaveOptions.DONOTSAVECHANGES);
}
throw error;
}
@@ -0,0 +1,20 @@
#target photoshop
var runnerFile = new File($.fileName);
var root = runnerFile.parent.parent.parent.fsName;
var JIAPU_A01_ROOT = root;
var JIAPU_A01_OUTPUT_DIR = root + '/docs/design/assets/a01-vnext/review/page-v2';
var JIAPU_A01_PREVIEW_VERSION = 'v2';
var JIAPU_A01_SKIP_CONTACT = true;
try {
$.evalFile(new File(root + '/scripts/photoshop/a01-compose-page-preview.jsx'));
} catch (error) {
var log = new File(root + '/docs/design/assets/a01-vnext/review/page-v2/photoshop-error.log');
log.encoding = 'UTF8';
log.open('w');
log.write('number=' + error.number + '\nline=' + error.line + '\nmessage=' + error.message + '\nsource=' + error.source);
log.close();
throw error;
}