feat: 更新作业纸 footer

This commit is contained in:
R524809
2026-10-26 18:29:47 +08:00
parent 98dc338848
commit 49467c1e3d
7 changed files with 124 additions and 15 deletions
+5 -4
View File
@@ -2,16 +2,17 @@ export type ApiEnvironment = 'local' | 'staging' | 'production';
type MiniProgramVersion = 'develop' | 'trial' | 'release';
const LOCAL_BASE_URL = 'http://127.0.0.1:8800/api/v1';
const STORAGE_KEY = 'doodle_develop_api_environment_v1';
// 默认来源改为线上时启用新选择键,旧版保存的 local 不覆盖本次默认值。
const STORAGE_KEY = 'doodle_develop_api_environment_v2';
let selectedEnvironment: ApiEnvironment | undefined;
let revision = 0;
/** 暂时共用本地地址;部署后分别替换 staging/production,真机 local 使用电脑局域网 IP。 */
/** 默认访问线上;local 保留调试,staging 暂沿用本机占位地址。 */
export const apiConfig = {
developmentEnvironment: 'local' as ApiEnvironment,
developmentEnvironment: 'production' as ApiEnvironment,
localBaseUrl: LOCAL_BASE_URL,
stagingBaseUrl: LOCAL_BASE_URL,
productionBaseUrl: LOCAL_BASE_URL,
productionBaseUrl: 'https://doodle-api.joeyone.cn/api/v1',
timeout: 10000,
};
@@ -174,7 +174,11 @@ export default class PaperDrawService extends BaseDrawService {
ctx.globalAlpha = 0.35;
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
ctx.fillText('涂鸦丫小程序', canvasWidth / 2, canvasHeight - 16);
ctx.fillText(
'© 涂鸦丫小程序 | 原创出品',
canvasWidth / 2,
canvasHeight - 16,
);
ctx.restore();
}
@@ -106,12 +106,19 @@ createPage(
// 草稿在公开详情中固定为 404;开发版使用本地注册配置,不通过失败请求判断预览权限。
if (!this.data.isDevEnv) {
const remote = await getWorksheet(entry.id);
if (
entry.id !== PAPER_SHEET_WORKSHEET_ID &&
(remote.rendering?.rendererKey !== entry.rendererKey ||
remote.rendering?.paperType !== paperType)
) {
throw new Error('作业纸配置暂不可用,请更新小程序');
if (entry.id !== PAPER_SHEET_WORKSHEET_ID) {
// 旧服务端可能未下发 rendering。仅对本地已注册 ID、且公开路由一致的条目使用固定配置。
// 显式下发的配置仍须匹配;404、网络异常及未知条目不进入此兼容分支。
const matches =
remote.rendering === undefined
? remote.path ===
getPublishMetaByMode(entry.id)?.path
: remote.rendering?.rendererKey ===
entry.rendererKey &&
remote.rendering?.paperType === paperType;
if (!matches) {
throw new Error('作业纸配置异常,请稍后重试');
}
}
}
if (request !== this._entryRequest) return;