建立可运行、可构建的 Go 骨架,供后续 R1~R5 在其上叠加。 后端: - main.go / app.go:Wails v2 窗口与 14 个前端可调方法。Wails 专有 API 只出现在这两个文件,internal/ 对 Wails 零依赖,便于将来迁移 v3 - internal/config:config.yaml 的读写、校验、脱敏。保存时按固定模板 渲染以保留注释,不用 yaml.Marshal - internal/store:SQLite(modernc.org/sqlite,无需 CGO)。建表迁移、 商品仓储、KV。重复同步不会覆盖本地下载与上传状态 - internal/logx:9 条脱敏规则,覆盖淘宝 token、Cookie、Authorization、 密码和图片 base64;并发安全的内存日志缓冲 前端(Vue 3 + Naive UI,按已确认原型 v4): - Sidebar:176px 可折叠,仅商品列表与参数设置两项,底部是登录状态的 唯一显示位置 - ProductListView:两行工具栏(四项筛选 + 重置搜索 / 四个操作按钮)、 商品表格、分页 - SettingsView:四张卡片,路径用文件与目录选择框 - LogWindow:运行日志子窗口,按级别过滤、自动滚动、导出 配置改用 YAML:分 huohanhan / taobao / download 三段。taobao 段刻意 没有账号密码字段,并有单元测试挡住后续加入。 构建相关: - .gitignore 只忽略 build/bin/,不忽略 build/。Wails 把 build/ 当源码 目录(图标、manifest),忽略掉会让别人克隆后构建失败 - .gitignore 忽略 config.yaml、payloads/ 和 *.har(含真实手机号与凭据) 未实现的下载数据、下载视频、上传数据三个方法返回明确的「还没实现」, 不静默失败。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LbdtsD3ohhSMy3KPoCgARq
298 lines
7.0 KiB
JavaScript
298 lines
7.0 KiB
JavaScript
/*
|
|
_ __ _ __
|
|
| | / /___ _(_) /____
|
|
| | /| / / __ `/ / / ___/
|
|
| |/ |/ / /_/ / / (__ )
|
|
|__/|__/\__,_/_/_/____/
|
|
The electron alternative for Go
|
|
(c) Lea Anthony 2019-present
|
|
*/
|
|
|
|
export function LogPrint(message) {
|
|
window.runtime.LogPrint(message);
|
|
}
|
|
|
|
export function LogTrace(message) {
|
|
window.runtime.LogTrace(message);
|
|
}
|
|
|
|
export function LogDebug(message) {
|
|
window.runtime.LogDebug(message);
|
|
}
|
|
|
|
export function LogInfo(message) {
|
|
window.runtime.LogInfo(message);
|
|
}
|
|
|
|
export function LogWarning(message) {
|
|
window.runtime.LogWarning(message);
|
|
}
|
|
|
|
export function LogError(message) {
|
|
window.runtime.LogError(message);
|
|
}
|
|
|
|
export function LogFatal(message) {
|
|
window.runtime.LogFatal(message);
|
|
}
|
|
|
|
export function EventsOnMultiple(eventName, callback, maxCallbacks) {
|
|
return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks);
|
|
}
|
|
|
|
export function EventsOn(eventName, callback) {
|
|
return EventsOnMultiple(eventName, callback, -1);
|
|
}
|
|
|
|
export function EventsOff(eventName, ...additionalEventNames) {
|
|
return window.runtime.EventsOff(eventName, ...additionalEventNames);
|
|
}
|
|
|
|
export function EventsOffAll() {
|
|
return window.runtime.EventsOffAll();
|
|
}
|
|
|
|
export function EventsOnce(eventName, callback) {
|
|
return EventsOnMultiple(eventName, callback, 1);
|
|
}
|
|
|
|
export function EventsEmit(eventName) {
|
|
let args = [eventName].slice.call(arguments);
|
|
return window.runtime.EventsEmit.apply(null, args);
|
|
}
|
|
|
|
export function WindowReload() {
|
|
window.runtime.WindowReload();
|
|
}
|
|
|
|
export function WindowReloadApp() {
|
|
window.runtime.WindowReloadApp();
|
|
}
|
|
|
|
export function WindowSetAlwaysOnTop(b) {
|
|
window.runtime.WindowSetAlwaysOnTop(b);
|
|
}
|
|
|
|
export function WindowSetSystemDefaultTheme() {
|
|
window.runtime.WindowSetSystemDefaultTheme();
|
|
}
|
|
|
|
export function WindowSetLightTheme() {
|
|
window.runtime.WindowSetLightTheme();
|
|
}
|
|
|
|
export function WindowSetDarkTheme() {
|
|
window.runtime.WindowSetDarkTheme();
|
|
}
|
|
|
|
export function WindowCenter() {
|
|
window.runtime.WindowCenter();
|
|
}
|
|
|
|
export function WindowSetTitle(title) {
|
|
window.runtime.WindowSetTitle(title);
|
|
}
|
|
|
|
export function WindowFullscreen() {
|
|
window.runtime.WindowFullscreen();
|
|
}
|
|
|
|
export function WindowUnfullscreen() {
|
|
window.runtime.WindowUnfullscreen();
|
|
}
|
|
|
|
export function WindowIsFullscreen() {
|
|
return window.runtime.WindowIsFullscreen();
|
|
}
|
|
|
|
export function WindowGetSize() {
|
|
return window.runtime.WindowGetSize();
|
|
}
|
|
|
|
export function WindowSetSize(width, height) {
|
|
window.runtime.WindowSetSize(width, height);
|
|
}
|
|
|
|
export function WindowSetMaxSize(width, height) {
|
|
window.runtime.WindowSetMaxSize(width, height);
|
|
}
|
|
|
|
export function WindowSetMinSize(width, height) {
|
|
window.runtime.WindowSetMinSize(width, height);
|
|
}
|
|
|
|
export function WindowSetPosition(x, y) {
|
|
window.runtime.WindowSetPosition(x, y);
|
|
}
|
|
|
|
export function WindowGetPosition() {
|
|
return window.runtime.WindowGetPosition();
|
|
}
|
|
|
|
export function WindowHide() {
|
|
window.runtime.WindowHide();
|
|
}
|
|
|
|
export function WindowShow() {
|
|
window.runtime.WindowShow();
|
|
}
|
|
|
|
export function WindowMaximise() {
|
|
window.runtime.WindowMaximise();
|
|
}
|
|
|
|
export function WindowToggleMaximise() {
|
|
window.runtime.WindowToggleMaximise();
|
|
}
|
|
|
|
export function WindowUnmaximise() {
|
|
window.runtime.WindowUnmaximise();
|
|
}
|
|
|
|
export function WindowIsMaximised() {
|
|
return window.runtime.WindowIsMaximised();
|
|
}
|
|
|
|
export function WindowMinimise() {
|
|
window.runtime.WindowMinimise();
|
|
}
|
|
|
|
export function WindowUnminimise() {
|
|
window.runtime.WindowUnminimise();
|
|
}
|
|
|
|
export function WindowSetBackgroundColour(R, G, B, A) {
|
|
window.runtime.WindowSetBackgroundColour(R, G, B, A);
|
|
}
|
|
|
|
export function ScreenGetAll() {
|
|
return window.runtime.ScreenGetAll();
|
|
}
|
|
|
|
export function WindowIsMinimised() {
|
|
return window.runtime.WindowIsMinimised();
|
|
}
|
|
|
|
export function WindowIsNormal() {
|
|
return window.runtime.WindowIsNormal();
|
|
}
|
|
|
|
export function BrowserOpenURL(url) {
|
|
window.runtime.BrowserOpenURL(url);
|
|
}
|
|
|
|
export function Environment() {
|
|
return window.runtime.Environment();
|
|
}
|
|
|
|
export function Quit() {
|
|
window.runtime.Quit();
|
|
}
|
|
|
|
export function Hide() {
|
|
window.runtime.Hide();
|
|
}
|
|
|
|
export function Show() {
|
|
window.runtime.Show();
|
|
}
|
|
|
|
export function ClipboardGetText() {
|
|
return window.runtime.ClipboardGetText();
|
|
}
|
|
|
|
export function ClipboardSetText(text) {
|
|
return window.runtime.ClipboardSetText(text);
|
|
}
|
|
|
|
/**
|
|
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
|
*
|
|
* @export
|
|
* @callback OnFileDropCallback
|
|
* @param {number} x - x coordinate of the drop
|
|
* @param {number} y - y coordinate of the drop
|
|
* @param {string[]} paths - A list of file paths.
|
|
*/
|
|
|
|
/**
|
|
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
|
*
|
|
* @export
|
|
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
|
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
|
|
*/
|
|
export function OnFileDrop(callback, useDropTarget) {
|
|
return window.runtime.OnFileDrop(callback, useDropTarget);
|
|
}
|
|
|
|
/**
|
|
* OnFileDropOff removes the drag and drop listeners and handlers.
|
|
*/
|
|
export function OnFileDropOff() {
|
|
return window.runtime.OnFileDropOff();
|
|
}
|
|
|
|
export function CanResolveFilePaths() {
|
|
return window.runtime.CanResolveFilePaths();
|
|
}
|
|
|
|
export function ResolveFilePaths(files) {
|
|
return window.runtime.ResolveFilePaths(files);
|
|
}
|
|
|
|
export function InitializeNotifications() {
|
|
return window.runtime.InitializeNotifications();
|
|
}
|
|
|
|
export function CleanupNotifications() {
|
|
return window.runtime.CleanupNotifications();
|
|
}
|
|
|
|
export function IsNotificationAvailable() {
|
|
return window.runtime.IsNotificationAvailable();
|
|
}
|
|
|
|
export function RequestNotificationAuthorization() {
|
|
return window.runtime.RequestNotificationAuthorization();
|
|
}
|
|
|
|
export function CheckNotificationAuthorization() {
|
|
return window.runtime.CheckNotificationAuthorization();
|
|
}
|
|
|
|
export function SendNotification(options) {
|
|
return window.runtime.SendNotification(options);
|
|
}
|
|
|
|
export function SendNotificationWithActions(options) {
|
|
return window.runtime.SendNotificationWithActions(options);
|
|
}
|
|
|
|
export function RegisterNotificationCategory(category) {
|
|
return window.runtime.RegisterNotificationCategory(category);
|
|
}
|
|
|
|
export function RemoveNotificationCategory(categoryId) {
|
|
return window.runtime.RemoveNotificationCategory(categoryId);
|
|
}
|
|
|
|
export function RemoveAllPendingNotifications() {
|
|
return window.runtime.RemoveAllPendingNotifications();
|
|
}
|
|
|
|
export function RemovePendingNotification(identifier) {
|
|
return window.runtime.RemovePendingNotification(identifier);
|
|
}
|
|
|
|
export function RemoveAllDeliveredNotifications() {
|
|
return window.runtime.RemoveAllDeliveredNotifications();
|
|
}
|
|
|
|
export function RemoveDeliveredNotification(identifier) {
|
|
return window.runtime.RemoveDeliveredNotification(identifier);
|
|
}
|
|
|
|
export function RemoveNotification(identifier) {
|
|
return window.runtime.RemoveNotification(identifier);
|
|
} |