四端上传
This commit is contained in:
1 parent
25bbb5f9c8
commit
c6e2cb4d5b
276 files changed
+17812
-3
No files matched your search
+27
-3
@@ -13,6 +13,30 @@
|
||||
/.ignore
|
||||
|
||||
|
||||
# 系统文件
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
# 系统文件
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Node
|
||||
node_modules/
|
||||
dist/
|
||||
build/
|
||||
.turbo/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# 环境变量与密钥(禁止入库)
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# 小程序构建产物
|
||||
yelaymaths/miniprogram_npm/
|
||||
yelaymaths/project.private.config.json
|
||||
|
||||
# 课程数据端(大文件不入库,仅保留目录骨架与说明)
|
||||
yelaymaths_data.yeomai.site/**
|
||||
!yelaymaths_data.yeomai.site/**/
|
||||
!yelaymaths_data.yeomai.site/**/README.md
|
||||
!yelaymaths_data.yeomai.site/README.md
|
||||
@@ -0,0 +1,67 @@
|
||||
# 叶雷讲数学
|
||||
|
||||
微信小程序在线数学课程项目。
|
||||
|
||||
## 目录结构
|
||||
|
||||
四个子项目**各自独立**:各自安装依赖、各自持有 lockfile,互不依赖。
|
||||
仓库根目录不放任何 Node 配置,也不会有 `node_modules`。
|
||||
|
||||
| 目录 | 角色 | 技术栈 |
|
||||
|---|---|---|
|
||||
| `yelaymaths/` | 微信小程序 | 原生小程序 |
|
||||
| `yelaymaths_api/` | 服务端 API | NestJS + Prisma + MySQL 5.7 |
|
||||
| `yelaymaths_admin/` | 管理后台 | Next.js 15 + Tailwind |
|
||||
| `yelaymaths_data.yeomai.site/` | 课程数据(图片 / 视频) | 静态文件 |
|
||||
| `docs/` | 设计与部署文档 | — |
|
||||
|
||||
历史版本代码保留在 `前端/`、`服务端/`、`数据库/`,仅作参考,迁移完成后可删除。
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 1. 服务端
|
||||
|
||||
```bash
|
||||
cd yelaymaths_api
|
||||
pnpm install
|
||||
cp .env.example .env # 填写数据库连接串与各类密钥
|
||||
pnpm prisma:generate
|
||||
pnpm prisma:migrate # 建表
|
||||
pnpm dev # http://127.0.0.1:3000
|
||||
```
|
||||
|
||||
### 2. 迁移旧数据
|
||||
|
||||
```bash
|
||||
cd yelaymaths_api
|
||||
pnpm legacy:check # 体检,确认旧数据可无损映射
|
||||
pnpm legacy:migrate -- --dry-run # 试运行,核对行数
|
||||
pnpm legacy:migrate # 正式迁移
|
||||
```
|
||||
|
||||
详见 [`yelaymaths_api/tools/legacy/README.md`](yelaymaths_api/tools/legacy/README.md)。
|
||||
|
||||
### 3. 管理后台
|
||||
|
||||
```bash
|
||||
cd yelaymaths_admin
|
||||
pnpm install
|
||||
cp .env.example .env.local # 填写 API 地址
|
||||
pnpm dev # http://127.0.0.1:3001
|
||||
```
|
||||
|
||||
首次打开用登录页的「创建管理员账号」入口初始化超管。
|
||||
|
||||
### 4. 小程序
|
||||
|
||||
用微信开发者工具打开 `yelaymaths/`,先在 `yelaymaths/config/index.js` 里填写 API 与静态资源域名,
|
||||
然后执行【工具 → 构建 npm】。
|
||||
|
||||
## 部署
|
||||
|
||||
见 [`docs/部署指南.md`](docs/部署指南.md)。
|
||||
|
||||
## 设计文档
|
||||
|
||||
见 [`docs/重构开发文档.md`](docs/重构开发文档.md)。
|
||||
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
# 部署指南
|
||||
|
||||
面向接手部署的人。按顺序执行即可,每一步都有验证方法。
|
||||
|
||||
---
|
||||
|
||||
## 0. 变量约定
|
||||
|
||||
下文用占位符代替真实域名,部署时替换:
|
||||
|
||||
只需要**三个域名**:管理后台直接调用 `<API域名>`(服务端同一进程内含 `/admin/v1/*`),
|
||||
不需要单独的接口域名。
|
||||
|
||||
| 占位符 | 含义 | 举例 |
|
||||
|---|---|---|
|
||||
| `<API域名>` | 服务端 API 域名 | `yelaymaths-api.example.com` |
|
||||
| `<后台域名>` | 管理后台域名 | `yelaymaths-admin.example.com` |
|
||||
| `<数据域名>` | 课程数据(图片 / 视频)域名 | `yelaymaths-data.example.com` |
|
||||
|
||||
> ⚠️ **三个域名都不能含下划线。** 下划线不是合法的主机名字符(RFC 1034/1035 只允许字母、数字、连字符),
|
||||
> 后果是 Let's Encrypt 拒签证书、微信「request 合法域名」校验也会拒绝。
|
||||
>
|
||||
> 用中划线:`yelaymaths-api.example.com`,不要用 `yelaymaths_api.example.com`。
|
||||
|
||||
---
|
||||
|
||||
## 1. 服务器准备(宝塔面板)
|
||||
|
||||
1. 软件商店安装:**MySQL 5.7**、**Nginx**、**Node 版本管理器**(选 Node 22 LTS)。
|
||||
2. 防火墙放行 80 / 443。
|
||||
3. 建 3 个站点,各配 Let's Encrypt 证书:
|
||||
|
||||
| 站点 | 反向代理到 |
|
||||
|---|---|
|
||||
| `<API域名>` | `http://127.0.0.1:3000` |
|
||||
| `<后台域名>` | `http://127.0.0.1:3001` |
|
||||
|
||||
> 这两个站点**都不是静态站点**,反向代理必须配,只上传文件不会工作。
|
||||
|
||||
4. 建数据端站点 `<数据域名>`,根目录指向课程数据目录(见第 6 节)。
|
||||
|
||||
---
|
||||
|
||||
## 2. 数据库
|
||||
|
||||
1. 新建数据库 `yelaymaths`,字符集 `utf8mb4`。
|
||||
2. 新建数据库账号并授权。
|
||||
|
||||
> **关于 Prisma 权限**:`prisma migrate dev` 需要 `CREATE DATABASE` 权限来建影子库,宝塔默认账号没有。
|
||||
> 生产环境**只用** `pnpm prisma:migrate`(即 `prisma migrate deploy`),它不建影子库,无需额外权限。
|
||||
|
||||
3. **备份旧库**(迁移前必做):
|
||||
|
||||
```bash
|
||||
mysqldump -u <用户> -p api_yeomai_site > /root/backup/api_yeomai_site_$(date +%F).sql
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 部署服务端
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot
|
||||
git clone <仓库地址> yelaymaths
|
||||
cd yelaymaths/yelaymaths_api
|
||||
pnpm install
|
||||
cp .env.example .env
|
||||
vi .env # 按下表填写
|
||||
```
|
||||
|
||||
### 必须填写的环境变量
|
||||
|
||||
| 变量 | 说明 |
|
||||
|---|---|
|
||||
| `DATABASE_URL` | `mysql://用户:密码@127.0.0.1:3306/yelaymaths` |
|
||||
| `LEGACY_DATABASE_URL` | 旧库连接串,仅迁移脚本使用 |
|
||||
| `API_BASE_URL` | `https://<API域名>` |
|
||||
| `STATIC_BASE_URL` | `https://<数据域名>` |
|
||||
| `ADMIN_ORIGIN` | `https://<后台域名>`(跨域白名单) |
|
||||
| `JWT_ACCESS_SECRET` | 随机 32 位以上 |
|
||||
| `JWT_REFRESH_SECRET` | 随机 32 位以上 |
|
||||
| `SESSION_KEY_ENC_SECRET` | 随机 32 位以上,用于加密存储用户 sessionKey |
|
||||
| `MEDIA_SIGN_SECRET` | 随机 32 位以上,用于播放地址签名 |
|
||||
| `WX_APPID` | `wx3fbaf897825bf04f` |
|
||||
| `WX_APPSECRET` | 小程序密钥 |
|
||||
| `WX_OFFER_ID` / `WX_PAY_APPKEY` | 虚拟支付参数,未开通可留空 |
|
||||
| `DATA_ROOT` | 课程数据目录的**绝对路径** |
|
||||
|
||||
> 生成随机密钥:`openssl rand -hex 32`
|
||||
>
|
||||
> ⚠️ `STATIC_BASE_URL` 必须在跑数据迁移**之前**填对。旧库里有 48 处内容写死了旧域名,
|
||||
> 迁移时会按这个变量改写;填错会导致图片与视频全部 404。
|
||||
|
||||
### 建表、迁移、启动
|
||||
|
||||
```bash
|
||||
pnpm prisma:generate
|
||||
pnpm prisma:migrate # 建表
|
||||
pnpm legacy:check # 体检
|
||||
pnpm legacy:migrate -- --dry-run # 核对行数
|
||||
pnpm legacy:migrate # 正式迁移
|
||||
pnpm build
|
||||
```
|
||||
|
||||
在宝塔「Node 项目」里新建项目:
|
||||
|
||||
- 项目目录:`/www/wwwroot/yelaymaths/yelaymaths_api`
|
||||
- 启动文件:`dist/main.js`
|
||||
- 端口:`3000`
|
||||
- 运行方式:PM2
|
||||
|
||||
**验证**:`curl https://<API域名>/healthz` 应返回 `{"code":0,...,"db":"ok"}`。
|
||||
若 `db` 为 `down`,说明数据库连接串不对。
|
||||
|
||||
---
|
||||
|
||||
## 4. 部署管理后台
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/yelaymaths/yelaymaths_admin
|
||||
pnpm install
|
||||
cp .env.example .env.local
|
||||
vi .env.local # NEXT_PUBLIC_API_BASE_URL=https://<API域名>
|
||||
pnpm build
|
||||
```
|
||||
|
||||
同样用宝塔「Node 项目」启动:
|
||||
|
||||
- 启动文件:`node_modules/next/dist/bin/next`,参数 `start -p 3001`
|
||||
- 或直接用 `pnpm start`
|
||||
- 端口:`3001`
|
||||
|
||||
**验证**:打开 `https://<后台域名>`,应看到登录页。
|
||||
首次使用点「创建管理员账号」,创建完成后切回登录。
|
||||
|
||||
> 该接口只在系统中没有任何管理员时生效,之后调用会返回「已存在」,因此可以安全保留。
|
||||
|
||||
---
|
||||
|
||||
## 5. 部署课程数据端
|
||||
|
||||
把旧服务器的资源目录复制到 `<数据域名>` 站点根目录:
|
||||
|
||||
| 来源 | 目标 | 体积参考 |
|
||||
|---|---|---|
|
||||
| 旧站 `Images/` | `<根>/Images/` | 约 195 MB |
|
||||
| 旧站 `WebPages/` | `<根>/WebPages/` | 约 21 MB |
|
||||
| 旧站 `Course/` | `<根>/Course/` | 视频文件 |
|
||||
| 旧站 `FreeVideos/` | `<根>/FreeVideos/` | 视频文件 |
|
||||
|
||||
再从旧小程序的 `static/image/` 复制三张占位图到 `<根>/Images/Placeholder/`:
|
||||
|
||||
```
|
||||
Images/Placeholder/user.png
|
||||
Images/Placeholder/defaultAvatar.png
|
||||
Images/Placeholder/weixin.png
|
||||
```
|
||||
|
||||
**目录名与文件名不可更改**,前端是拼路径访问的。完整约定见
|
||||
[`yelaymaths_data.yeomai.site/README.md`](../yelaymaths_data.yeomai.site/README.md)。
|
||||
|
||||
### ⚠️ 付费视频目录必须挡住
|
||||
|
||||
付费视频的鉴权由服务端 `/media/*` 签名通道提供(地址有效期 30 分钟,HLS 的 `.ts` 分片也逐行带签名)。
|
||||
但如果 `Course/` 目录同时被数据域名公开暴露,任何人猜到路径就能直接下载,这套防护等于没有。
|
||||
|
||||
**在数据端站点的 Nginx 配置里加一条:**
|
||||
|
||||
```nginx
|
||||
location ^~ /Course/ {
|
||||
deny all;
|
||||
}
|
||||
```
|
||||
|
||||
免费内容(`Images/`、`WebPages/`、`FreeVideos/`)保持公开即可。
|
||||
|
||||
> 若后续改用 CDN,把 `MediaService.buildSignedUrl` 换成 CDN 厂商的签名方式,并在 CDN 侧对 `Course/` 开鉴权。
|
||||
|
||||
---
|
||||
|
||||
## 6. 配置小程序
|
||||
|
||||
1. 编辑 `yelaymaths/config/index.js`:
|
||||
|
||||
```js
|
||||
API_BASE_URL: 'https://<API域名>',
|
||||
STATIC_BASE_URL: 'https://<数据域名>',
|
||||
```
|
||||
|
||||
2. 用微信开发者工具打开 `yelaymaths/`,执行【工具 → 构建 npm】。
|
||||
3. 上传并提交审核。
|
||||
|
||||
> 小程序**不打包任何业务图片**,只保留 6 个 tabBar 图标(约 19 KB)。
|
||||
> tabBar 图标必须本地,这是微信的限制,无法改为网络图。
|
||||
|
||||
---
|
||||
|
||||
## 7. 微信小程序后台配置
|
||||
|
||||
| 配置项 | 位置 | 值 |
|
||||
|---|---|---|
|
||||
| request 合法域名 | 开发 → 开发管理 → 开发设置 | `https://<API域名>` |
|
||||
| 发货推送 URL | 虚拟支付 → 基本配置 | `https://<API域名>/v1/payments/notify` |
|
||||
| 小程序简称 | 虚拟支付 → 基础配置 | iOS 支付必需 |
|
||||
| 苹果 IAP 支付 | 虚拟支付 → 基础配置 | iOS 支付需开启 |
|
||||
| 支付道具 | 虚拟支付 → 道具管理 | 每门课建一个,记下道具 ID 与价格 |
|
||||
|
||||
> `<image>` 与 `<video>` 的资源域名**不受合法域名限制**,所以数据域名与 CDN 都不需要加白名单。
|
||||
|
||||
创建完道具后,在管理后台「支付商品」里把 `课程 ID`、`微信道具 ID`、`价格(分)` 填进去,
|
||||
价格必须与微信后台完全一致(单位:分)。
|
||||
|
||||
---
|
||||
|
||||
## 8. 上线顺序
|
||||
|
||||
建议严格按此顺序,每步都可独立验证:
|
||||
|
||||
1. 服务器与数据库就绪 → 备份旧库
|
||||
2. 部署服务端 → `/healthz` 返回 `db: ok`
|
||||
3. 建表 + 数据迁移 → 行数校验通过
|
||||
4. 部署管理后台 → 能登录,用户数与旧库一致
|
||||
5. 部署数据端 → 浏览器直接打开一张图片能显示
|
||||
6. 小程序改配置并上传 → 真机验证:首页图片、试听播放、已购课程播放
|
||||
7. 微信后台配域名与支付 → 用一笔小额真实订单验证:支付 → 发货 → 课程出现在「知识」页
|
||||
|
||||
---
|
||||
|
||||
## 9. 上线后验证清单
|
||||
|
||||
- [ ] `/healthz` 返回 `db: ok`
|
||||
- [ ] 管理后台用户数 = 284(迁移前旧库数量)
|
||||
- [ ] 随机挑一个老用户,其「已购课程」与升级前一致
|
||||
- [ ] 首页轮播、新课长图、试听封面图片全部能加载
|
||||
- [ ] `pages/VideoDetailsPage/VideoDetailsPage` 的公式图能显示
|
||||
- [ ] 免费试听能播放
|
||||
- [ ] 已购课程能播放(走 `/media/...` 签名地址)
|
||||
- [ ] 未登录状态下访问受保护页面会跳转登录
|
||||
- [ ] 未购买课程看不到课时列表(直接请求接口返回 3000 错误码)
|
||||
- [ ] 支付一笔小额订单,课程正确开通
|
||||
- [ ] 管理后台能看到这笔订单,状态为「已开通」
|
||||
|
||||
---
|
||||
|
||||
## 10. 回滚
|
||||
|
||||
- 旧服务端与旧数据库**保留不动**,直到新系统稳定运行一段时间。
|
||||
- 小程序出现严重问题时,可在微信后台回退到上一个版本。
|
||||
- 数据库出问题时用第 2 节的备份恢复。
|
||||
|
||||
---
|
||||
|
||||
## 11. 安全提醒
|
||||
|
||||
以下密钥曾在旧代码与数据库导出文件中明文出现,**必须全部轮换**:
|
||||
|
||||
- 旧数据库账号密码
|
||||
- 阿里云 AccessKey(旧短信模块使用,该模块已删除)
|
||||
- 163 邮箱授权码(旧邮件脚本使用,已删除)
|
||||
- 小程序 AppSecret
|
||||
|
||||
> ⚠️ **AppSecret 不能提前换**。旧 PHP 服务仍在使用它,一换线上小程序立刻无法登录。
|
||||
> 正确做法是:新后端上线并确认可用后,再在微信后台重置 AppSecret 并同步更新新后端配置。
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Eslint config file
|
||||
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
||||
* Install the Eslint extension before using this feature.
|
||||
*/
|
||||
module.exports = {
|
||||
env: {
|
||||
es6: true,
|
||||
browser: true,
|
||||
node: true,
|
||||
},
|
||||
ecmaFeatures: {
|
||||
modules: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
},
|
||||
globals: {
|
||||
wx: true,
|
||||
App: true,
|
||||
Page: true,
|
||||
getCurrentPages: true,
|
||||
getApp: true,
|
||||
Component: true,
|
||||
requirePlugin: true,
|
||||
requireMiniProgram: true,
|
||||
},
|
||||
// extends: 'eslint:recommended',
|
||||
rules: {},
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//CssTokenizer.js
|
||||
function CssTokenizer(style = '', tagStyle = {}) {
|
||||
this.res = tagStyle;
|
||||
this._state = "SPACE";
|
||||
this._buffer = style;
|
||||
this._sectionStart = 0;
|
||||
this._index = 0;
|
||||
this._name = '';
|
||||
this._content = '';
|
||||
this._list = [];
|
||||
this._comma = false;
|
||||
}
|
||||
CssTokenizer.prototype.SPACE = function(c) {
|
||||
if (/[a-zA-Z.#]/.test(c)) {
|
||||
this._sectionStart = this._index;
|
||||
this._state = "InName";
|
||||
} else if (c == '@') this._state = "Ignore1";
|
||||
else if (c == '/') this._state = "BeforeComment";
|
||||
};
|
||||
CssTokenizer.prototype.BeforeComment = function(c) {
|
||||
if (c == '*') this._state = "InComment";
|
||||
else {
|
||||
this._index--;
|
||||
this._state = "SPACE";
|
||||
}
|
||||
};
|
||||
CssTokenizer.prototype.InComment = function(c) {
|
||||
if (c == '*') this._state = "AfterComment";
|
||||
};
|
||||
CssTokenizer.prototype.AfterComment = function(c) {
|
||||
if (c == '/') this._state = "SPACE";
|
||||
else {
|
||||
this._index--;
|
||||
this._state = "InComment"
|
||||
}
|
||||
};
|
||||
CssTokenizer.prototype.InName = function(c) {
|
||||
if (c == '{') {
|
||||
this._list.push(this._buffer.substring(this._sectionStart, this._index))
|
||||
this._sectionStart = this._index + 1;
|
||||
this._state = "InContent";
|
||||
} else if (c == ',') {
|
||||
this._list.push(this._buffer.substring(this._sectionStart, this._index));
|
||||
this._sectionStart = this._index + 1;
|
||||
this._comma = true;
|
||||
} else if ((c == '.' || c == '#') && !this._comma) {
|
||||
this._buffer = this._buffer.splice(this._index, 1, ' ');
|
||||
} else if (/\s/.test(c)) {
|
||||
this._name = this._buffer.substring(this._sectionStart, this._index);
|
||||
this._state = "NameSpace";
|
||||
} else if (/[>:\[]/.test(c)) {
|
||||
if (this._list.length) this._state = "IgnoreName";
|
||||
else this._state = "Ignore1";
|
||||
} else this._comma = false;
|
||||
};
|
||||
CssTokenizer.prototype.NameSpace = function(c) {
|
||||
if (c == '{') {
|
||||
this._list.push(this._name);
|
||||
this._sectionStart = this._index + 1;
|
||||
this._state = "InContent";
|
||||
} else if (c == ',') {
|
||||
this._comma = true;
|
||||
this._list.push(this._name);
|
||||
this._sectionStart = this._index + 1;
|
||||
this._state = "InName"
|
||||
} else if (/\S/.test(c)) {
|
||||
if (this._comma) {
|
||||
this._sectionStart = this._index;
|
||||
this._index--;
|
||||
this._state = "InName";
|
||||
} else if (this._list.length) this._state = "IgnoreName";
|
||||
else this._state = "Ignore1"
|
||||
}
|
||||
};
|
||||
CssTokenizer.prototype.InContent = function(c) {
|
||||
if (c == '}') {
|
||||
this._content = this._buffer.substring(this._sectionStart, this._index);
|
||||
for (let item of this._list)
|
||||
this.res[item] = (this.res[item] || '') + this._content;
|
||||
this._list = [];
|
||||
this._comma = false;
|
||||
this._state = "SPACE";
|
||||
}
|
||||
};
|
||||
CssTokenizer.prototype.IgnoreName = function(c) {
|
||||
if (c == ',') {
|
||||
this._sectionStart = this._index + 1;
|
||||
this._state = "InName";
|
||||
} else if (c == '{') {
|
||||
this._sectionStart = this._index + 1;
|
||||
this._state = "InContent";
|
||||
}
|
||||
}
|
||||
CssTokenizer.prototype.Ignore1 = function(c) {
|
||||
if (c == ';') {
|
||||
this._state = "SPACE";
|
||||
this._sectionStart = this._index + 1;
|
||||
} else if (c == '{') this._state = "Ignore2";
|
||||
};
|
||||
CssTokenizer.prototype.Ignore2 = function(c) {
|
||||
if (c == '}') {
|
||||
this._state = "SPACE";
|
||||
this._sectionStart = this._index + 1;
|
||||
} else if (c == '{') this._state = "Ignore3";
|
||||
};
|
||||
CssTokenizer.prototype.Ignore3 = function(c) {
|
||||
if (c == '}') this._state = "Ignore2";
|
||||
};
|
||||
CssTokenizer.prototype.parse = function() {
|
||||
for (; this._index < this._buffer.length; this._index++)
|
||||
this[this._state](this._buffer[this._index]);
|
||||
return this.res;
|
||||
};
|
||||
module.exports = CssTokenizer;
|
||||
@@ -0,0 +1,325 @@
|
||||
//DomHandler.js
|
||||
const CssTokenizer = require('./CssTokenizer.js');
|
||||
const CanIUse = require('./api.js').versionHigherThan('2.7.1');
|
||||
const Common = 1,
|
||||
Rich = 2;
|
||||
const trustTag = {
|
||||
a: Rich,
|
||||
abbr: Common,
|
||||
audio: Rich,
|
||||
b: Common,
|
||||
blockquote: Common,
|
||||
br: Rich,
|
||||
code: Common,
|
||||
col: Rich,
|
||||
colgroup: Rich,
|
||||
dd: Common,
|
||||
del: Common,
|
||||
dl: Common,
|
||||
dt: Common,
|
||||
div: Common,
|
||||
em: Common,
|
||||
fieldset: Rich,
|
||||
font: Common,
|
||||
h1: Rich,
|
||||
h2: Rich,
|
||||
h3: Rich,
|
||||
h4: Rich,
|
||||
h5: Rich,
|
||||
h6: Rich,
|
||||
hr: Rich,
|
||||
i: Common,
|
||||
img: Common,
|
||||
ins: Common,
|
||||
label: Common,
|
||||
legend: Rich,
|
||||
li: Rich,
|
||||
ol: Rich,
|
||||
p: Common,
|
||||
q: Common,
|
||||
source: Rich,
|
||||
span: Common,
|
||||
strong: Common,
|
||||
sub: Rich,
|
||||
sup: Rich,
|
||||
table: Rich,
|
||||
tbody: Rich,
|
||||
td: Rich,
|
||||
tfoot: Rich,
|
||||
th: Rich,
|
||||
thead: Rich,
|
||||
tr: Rich,
|
||||
u: Common,
|
||||
ul: Rich,
|
||||
video: Common
|
||||
};
|
||||
const blockTag = {
|
||||
address: true,
|
||||
article: true,
|
||||
aside: true,
|
||||
body: true,
|
||||
center: true,
|
||||
cite: true,
|
||||
footer: true,
|
||||
header: true,
|
||||
html: true,
|
||||
nav: true,
|
||||
pre: true,
|
||||
section: true
|
||||
}
|
||||
const textTag = {
|
||||
a: true,
|
||||
abbr: true,
|
||||
b: true,
|
||||
big: true,
|
||||
code: true,
|
||||
del: true,
|
||||
em: true,
|
||||
font: true,
|
||||
i: true,
|
||||
ins: true,
|
||||
label: true,
|
||||
mark: true,
|
||||
q: true,
|
||||
s: true,
|
||||
small: true,
|
||||
span: true,
|
||||
strong: true,
|
||||
u: true
|
||||
};
|
||||
const ignoreTag = {
|
||||
area: true,
|
||||
base: true,
|
||||
basefont: true,
|
||||
canvas: true,
|
||||
circle: true,
|
||||
command: true,
|
||||
ellipse: true,
|
||||
embed: true,
|
||||
frame: true,
|
||||
head: true,
|
||||
iframe: true,
|
||||
input: true,
|
||||
isindex: true,
|
||||
keygen: true,
|
||||
line: true,
|
||||
link: true,
|
||||
map: true,
|
||||
meta: true,
|
||||
param: true,
|
||||
path: true,
|
||||
polygon: true,
|
||||
polyline: true,
|
||||
rect: true,
|
||||
script: true,
|
||||
stop: true,
|
||||
textarea: true,
|
||||
title: true,
|
||||
track: true,
|
||||
use: true,
|
||||
wbr: true
|
||||
};
|
||||
if (CanIUse) {
|
||||
trustTag.bdi = Rich;
|
||||
trustTag.bdo = Rich;
|
||||
trustTag.caption = Rich;
|
||||
trustTag.rt = Rich;
|
||||
trustTag.ruby = Rich;
|
||||
ignoreTag.rp = true;
|
||||
trustTag.big = Common;
|
||||
trustTag.small = Common;
|
||||
trustTag.pre = Rich;
|
||||
delete blockTag.pre;
|
||||
}
|
||||
//添加默认值
|
||||
function initStyle(tagStyle) {
|
||||
tagStyle.a = "display:inline;color:#366092;word-break:break-all;" + (tagStyle.a || "");
|
||||
tagStyle.address = "font-style:italic;" + (tagStyle.address || "");
|
||||
tagStyle.blockquote = tagStyle.blockquote || 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px';
|
||||
tagStyle.center = 'text-align:center;' + (tagStyle.center || "");
|
||||
tagStyle.cite = "font-style:italic;" + (tagStyle.cite || "");
|
||||
tagStyle.code = tagStyle.code || 'padding:0 1px 0 1px;margin-left:2px;margin-right:2px;background-color:#f8f8f8;border:1px solid #cccccc;border-radius:3px';
|
||||
tagStyle.dd = "margin-left:40px;" + (tagStyle.dd || "");
|
||||
tagStyle.img = "max-width:100%;" + (tagStyle.img || "");
|
||||
tagStyle.mark = "display:inline;background-color:yellow;" + (tagStyle.mark || "");
|
||||
tagStyle.pre = "overflow:scroll;" + (tagStyle.pre || 'background-color:#f6f8fa;padding:5px;border-radius:5px;');
|
||||
tagStyle.s = "display:inline;text-decoration:line-through;" + (tagStyle.s || "");
|
||||
tagStyle.u = "display:inline;text-decoration:underline;" + (tagStyle.u || "");
|
||||
//低版本兼容
|
||||
if (!CanIUse) {
|
||||
blockTag.caption = true;
|
||||
tagStyle.big = "display:inline;font-size:1.2em;" + (tagStyle.big || "");
|
||||
tagStyle.small = "display:inline;font-size:0.8em;" + (tagStyle.small || "");
|
||||
tagStyle.pre = "font-family:monospace;white-space:pre;" + tagStyle.pre;
|
||||
}
|
||||
return tagStyle;
|
||||
}
|
||||
|
||||
function DomHandler(style, tagStyle = {}) {
|
||||
this.imgList = [];
|
||||
this.nodes = [];
|
||||
this.title = "";
|
||||
this._videoNum = 0;
|
||||
this._audioNum = 0;
|
||||
this._style = new CssTokenizer(style, initStyle(tagStyle)).parse();
|
||||
this._tagStack = [];
|
||||
}
|
||||
DomHandler.prototype._addDomElement = function(element) {
|
||||
let parent = this._tagStack[this._tagStack.length - 1];
|
||||
let siblings = parent ? parent.children : this.nodes;
|
||||
siblings.push(element);
|
||||
};
|
||||
DomHandler.prototype._bubbling = function() {
|
||||
for (let i = this._tagStack.length - 1; i >= 0; i--) {
|
||||
if (trustTag[this._tagStack[i].name] == Common) this._tagStack[i].continue = true;
|
||||
else return this._tagStack[i].name;
|
||||
}
|
||||
}
|
||||
DomHandler.prototype.onopentag = function(name, attrs) {
|
||||
let element = {
|
||||
children: []
|
||||
};
|
||||
//匹配样式
|
||||
let matched = this._style[name] ? (this._style[name] + ';') : '';
|
||||
if (attrs.id) {
|
||||
matched += (this._style['#' + attrs.id] ? (this._style['#' + attrs.id] + ';') : '');
|
||||
delete attrs.id;
|
||||
}
|
||||
if (attrs.class) {
|
||||
for (var Class of attrs.class.split(' ')) {
|
||||
matched += (this._style['.' + Class] ? (this._style['.' + Class] + ';') : '');
|
||||
}
|
||||
delete attrs.class;
|
||||
}
|
||||
//处理属性
|
||||
switch (name) {
|
||||
case 'div':
|
||||
case 'p':
|
||||
if (attrs.align) {
|
||||
attrs.style += (';text-align:' + attrs.align);
|
||||
delete attrs.align;
|
||||
}
|
||||
break;
|
||||
case 'img':
|
||||
if (attrs.width) {
|
||||
attrs.style = 'width:' + attrs.width + (/[0-9]/.test(attrs.width[attrs.width.length - 1]) ? 'px' : '') + ';' + attrs.style;
|
||||
delete attrs.width;
|
||||
}
|
||||
if (attrs['data-src']) {
|
||||
attrs.src = attrs.src || attrs['data-src'];
|
||||
delete attrs['data-src'];
|
||||
}
|
||||
if (!attrs.hasOwnProperty('ignore') && attrs.src) {
|
||||
this.imgList.push(attrs.src);
|
||||
if (this._bubbling() == 'a') attrs.ignore = "";
|
||||
};
|
||||
break;
|
||||
case 'font':
|
||||
name = 'span';
|
||||
if (attrs.color) {
|
||||
attrs.style += (';color:' + attrs.color);
|
||||
delete attrs.color;
|
||||
}
|
||||
if (attrs.face) {
|
||||
attrs.style += (";font-family:" + attrs.face);
|
||||
delete attrs.face;
|
||||
}
|
||||
if (attrs.size) {
|
||||
var size = parseInt(attrs.size);
|
||||
if (size < 1) size = 1;
|
||||
else if (size > 7) size = 7;
|
||||
switch (size) {
|
||||
case 1:
|
||||
size = 10;
|
||||
break;
|
||||
case 2:
|
||||
size = 13;
|
||||
break;
|
||||
case 3:
|
||||
size = 16;
|
||||
break;
|
||||
case 4:
|
||||
size = 18;
|
||||
break;
|
||||
case 5:
|
||||
size = 24;
|
||||
break;
|
||||
case 6:
|
||||
size = 32;
|
||||
break;
|
||||
case 7:
|
||||
size = 48;
|
||||
break;
|
||||
}
|
||||
attrs.style += (";font-size:" + size + "px");
|
||||
delete attrs.size;
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
this._bubbling();
|
||||
break;
|
||||
case 'video':
|
||||
case 'audio':
|
||||
attrs.loop = attrs.hasOwnProperty('loop');
|
||||
attrs.controls = attrs.hasOwnProperty('controls');
|
||||
attrs.autoplay = attrs.hasOwnProperty('autoplay');
|
||||
if (name == 'video') {
|
||||
attrs.muted = attrs.hasOwnProperty('muted');
|
||||
if (attrs.width) {
|
||||
attrs.style = 'width:' + parseFloat(attrs.width) + 'px;' + attrs.style;
|
||||
delete attrs.width;
|
||||
}
|
||||
if (attrs.height) {
|
||||
attrs.style = 'height:' + parseFloat(attrs.height) + 'px;' + attrs.style;
|
||||
delete attrs.height;
|
||||
}
|
||||
}
|
||||
attrs.id = (name + (++this['_' + name + 'Num']));
|
||||
attrs.source = [];
|
||||
if (attrs.src) attrs.source.push(attrs.src);
|
||||
if (!attrs.controls && !attrs.autoplay)
|
||||
console.warn('存在没有controls属性的' + name + '标签,可能导致无法播放', attrs);
|
||||
this._bubbling();
|
||||
break;
|
||||
case 'source':
|
||||
let parent = this._tagStack[this._tagStack.length - 1];
|
||||
if (parent && (parent.name == 'video' || parent.name == 'audio')) {
|
||||
parent.attrs.source.push(attrs.src);
|
||||
if (!parent.attrs.src) parent.attrs.src = attrs.src;
|
||||
}
|
||||
this._tagStack.push(element);
|
||||
return;
|
||||
}
|
||||
attrs.style = matched + attrs.style;
|
||||
if (textTag[name]) element.continue = true;
|
||||
else if (blockTag[name]) name = 'div';
|
||||
else if (!trustTag[name]) name = 'span';
|
||||
element.name = name;
|
||||
element.attrs = attrs;
|
||||
this._addDomElement(element);
|
||||
this._tagStack.push(element);
|
||||
};
|
||||
DomHandler.prototype.ontext = function(data) {
|
||||
if (/\S/.test(data)) {
|
||||
let element = {
|
||||
text: data.replace(/ /g, '\u00A0'),
|
||||
type: 'text'
|
||||
};
|
||||
if (/&#*((?!sp|lt|gt).){2,5};/.test(data)) element.decode = true;
|
||||
this._addDomElement(element);
|
||||
}
|
||||
};
|
||||
DomHandler.prototype.onclosetag = function(name) {
|
||||
let element = this._tagStack.pop();
|
||||
if (ignoreTag[name]) {
|
||||
if (name == 'title') {
|
||||
try {
|
||||
this.title = element.children[0].text;
|
||||
} catch (e) {}
|
||||
}
|
||||
let parent = this._tagStack[this._tagStack.length - 1];
|
||||
let siblings = parent ? parent.children : this.nodes;
|
||||
siblings.pop();
|
||||
}
|
||||
};
|
||||
module.exports = DomHandler;
|
||||
@@ -0,0 +1,156 @@
|
||||
//Parser.js
|
||||
const Tokenizer = require("./Tokenizer.js");
|
||||
const DomHandler = require("./DomHandler.js");
|
||||
const trustAttrs = {
|
||||
align: true,
|
||||
alt: true,
|
||||
author: true,
|
||||
autoplay: true,
|
||||
class: true,
|
||||
color: true,
|
||||
colspan: true,
|
||||
controls: true,
|
||||
"data-src": true,
|
||||
dir: true,
|
||||
face: true,
|
||||
height: true,
|
||||
href: true,
|
||||
id: true,
|
||||
ignore: true,
|
||||
loop: true,
|
||||
muted: true,
|
||||
name: true,
|
||||
poster: true,
|
||||
rowspan: true,
|
||||
size: true,
|
||||
span: true,
|
||||
src: true,
|
||||
start: true,
|
||||
style: true,
|
||||
type: true,
|
||||
width: true,
|
||||
};
|
||||
const voidTag = {
|
||||
area: true,
|
||||
base: true,
|
||||
basefont: true,
|
||||
br: true,
|
||||
col: true,
|
||||
circle: true,
|
||||
command: true,
|
||||
ellipse: true,
|
||||
embed: true,
|
||||
frame: true,
|
||||
hr: true,
|
||||
img: true,
|
||||
input: true,
|
||||
isindex: true,
|
||||
keygen: true,
|
||||
line: true,
|
||||
link: true,
|
||||
meta: true,
|
||||
param: true,
|
||||
path: true,
|
||||
polygon: true,
|
||||
polyline: true,
|
||||
rect: true,
|
||||
source: true,
|
||||
stop: true,
|
||||
track: true,
|
||||
use: true,
|
||||
wbr: true
|
||||
};
|
||||
|
||||
function Parser(cbs, callback) {
|
||||
this._cbs = cbs;
|
||||
this._callback = callback;
|
||||
this._tagname = "";
|
||||
this._attribname = "";
|
||||
this._attribvalue = "";
|
||||
this._attribs = null;
|
||||
this._stack = [];
|
||||
this._tokenizer = new Tokenizer(this);
|
||||
}
|
||||
Parser.prototype.ontext = function(data) {
|
||||
this._cbs.ontext(data);
|
||||
};
|
||||
Parser.prototype.onopentagname = function(name) {
|
||||
name = name.toLowerCase();
|
||||
this._tagname = name;
|
||||
this._attribs = {
|
||||
style: ''
|
||||
};
|
||||
if (!voidTag[name]) this._stack.push(name);
|
||||
};
|
||||
Parser.prototype.onopentagend = function() {
|
||||
if (this._attribs) {
|
||||
this._cbs.onopentag(this._tagname, this._attribs);
|
||||
this._attribs = null;
|
||||
}
|
||||
if (voidTag[this._tagname]) this._cbs.onclosetag(this._tagname);
|
||||
this._tagname = "";
|
||||
};
|
||||
Parser.prototype.onclosetag = function(name) {
|
||||
name = name.toLowerCase();
|
||||
if (this._stack.length && !voidTag[name]) {
|
||||
var pos = this._stack.lastIndexOf(name);
|
||||
if (pos !== -1) {
|
||||
pos = this._stack.length - pos;
|
||||
while (pos--) this._cbs.onclosetag(this._stack.pop());
|
||||
} else if (name === "p") {
|
||||
this.onopentagname(name);
|
||||
this._closeCurrentTag();
|
||||
}
|
||||
} else if (name === "br" || name === "hr" || name === "p") {
|
||||
this.onopentagname(name);
|
||||
this._closeCurrentTag();
|
||||
}
|
||||
};
|
||||
Parser.prototype._closeCurrentTag = function() {
|
||||
let name = this._tagname;
|
||||
this.onopentagend();
|
||||
if (this._stack[this._stack.length - 1] === name) {
|
||||
this._cbs.onclosetag(name);
|
||||
this._stack.pop();
|
||||
}
|
||||
};
|
||||
Parser.prototype.onattribend = function() {
|
||||
this._attribvalue = this._attribvalue.replace(/"/g, '"');
|
||||
if (this._attribs && trustAttrs[this._attribname]) {
|
||||
this._attribs[this._attribname] = this._attribvalue;
|
||||
}
|
||||
this._attribname = "";
|
||||
this._attribvalue = "";
|
||||
};
|
||||
Parser.prototype.onend = function() {
|
||||
for (
|
||||
var i = this._stack.length; i > 0; this._cbs.onclosetag(this._stack[--i])
|
||||
);
|
||||
this._callback({
|
||||
'nodes': this._cbs.nodes,
|
||||
'title': this._cbs.title,
|
||||
'imgList': this._cbs.imgList
|
||||
});
|
||||
};
|
||||
Parser.prototype.write = function(chunk) {
|
||||
this._tokenizer.parse(chunk);
|
||||
};
|
||||
|
||||
function html2nodes(data, tagStyle) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
try {
|
||||
let style = '';
|
||||
data = data.replace(/<style.*?>([\s\S]*?)<\/style>/gi, function() {
|
||||
style += arguments[1];
|
||||
return '';
|
||||
});
|
||||
let handler = new DomHandler(style, tagStyle);
|
||||
new Parser(handler, (res) => {
|
||||
return resolve(res);
|
||||
}).write(data);
|
||||
} catch (err) {
|
||||
return reject(err);
|
||||
}
|
||||
})
|
||||
}
|
||||
module.exports = html2nodes;
|
||||
@@ -0,0 +1,218 @@
|
||||
//Tokenizer.js
|
||||
function Tokenizer(cbs) {
|
||||
this._state = "TEXT";
|
||||
this._buffer = "";
|
||||
this._sectionStart = 0;
|
||||
this._index = 0;
|
||||
this._cbs = cbs;
|
||||
}
|
||||
Tokenizer.prototype.TEXT = function(c) {
|
||||
var index = this._buffer.indexOf("<", this._index);
|
||||
if (index != -1) {
|
||||
this._index = index;
|
||||
this._cbs.ontext(this._getSection());
|
||||
this._state = "BeforeTag";
|
||||
this._sectionStart = this._index;
|
||||
} else this._index = this._buffer.length;
|
||||
};
|
||||
Tokenizer.prototype.BeforeTag = function(c) {
|
||||
switch (c) {
|
||||
case "/":
|
||||
this._state = "BeforeCloseTag";
|
||||
break;
|
||||
case "!":
|
||||
this._state = "BeforeDeclaration";
|
||||
break;
|
||||
case "?":
|
||||
let index = this._buffer.indexOf(">", this._index);
|
||||
if (index != -1) {
|
||||
this._index = index;
|
||||
this._sectionStart = this._index + 1;
|
||||
} else this._sectionStart = this._index = this._buffer.length;
|
||||
this._state = "TEXT";
|
||||
break;
|
||||
case ">":
|
||||
this._state = "TEXT";
|
||||
break;
|
||||
case "<":
|
||||
this._cbs.ontext(this._getSection());
|
||||
this._sectionStart = this._index;
|
||||
break;
|
||||
default:
|
||||
if (/\s/.test(c)) this._state = "TEXT";
|
||||
else {
|
||||
this._state = "InTag";
|
||||
this._sectionStart = this._index;
|
||||
}
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.InTag = function(c) {
|
||||
if (c === "/" || c === ">" || /\s/.test(c)) {
|
||||
this._cbs.onopentagname(this._getSection());
|
||||
this._state = "BeforeAttrsName";
|
||||
this._index--;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.BeforeAttrsName = function(c) {
|
||||
if (c === ">") {
|
||||
this._cbs.onopentagend();
|
||||
this._state = "TEXT";
|
||||
this._sectionStart = this._index + 1;
|
||||
} else if (c === "/") {
|
||||
this._state = "InSelfCloseTag";
|
||||
} else if (!(/\s/.test(c))) {
|
||||
this._state = "InAttrsName";
|
||||
this._sectionStart = this._index;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.InAttrsName = function(c) {
|
||||
if (c === "=" || c === "/" || c === ">" || /\s/.test(c)) {
|
||||
this._cbs._attribname = this._getSection().toLowerCase();
|
||||
this._sectionStart = -1;
|
||||
this._state = "AfterAttrsName";
|
||||
this._index--;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.AfterAttrsName = function(c) {
|
||||
if (c === "=") {
|
||||
this._state = "BeforeAttrsValue";
|
||||
} else if (c === "/" || c === ">") {
|
||||
this._cbs.onattribend();
|
||||
this._state = "BeforeAttrsName";
|
||||
this._index--;
|
||||
} else if (!(/\s/.test(c))) {
|
||||
this._cbs.onattribend();
|
||||
this._state = "InAttrsName";
|
||||
this._sectionStart = this._index;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.BeforeAttrsValue = function(c) {
|
||||
if (c === '"') {
|
||||
this._state = "InAttrsValueDQ";
|
||||
this._sectionStart = this._index + 1;
|
||||
} else if (c === "'") {
|
||||
this._state = "InAttrsValueSQ";
|
||||
this._sectionStart = this._index + 1;
|
||||
} else if (!(/\s/.test(c))) {
|
||||
this._state = "InAttrsValueNQ";
|
||||
this._sectionStart = this._index;
|
||||
this._index--;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.InAttrsValueDQ = function(c) {
|
||||
if (c === '"') {
|
||||
this._cbs._attribvalue += this._getSection();
|
||||
this._cbs.onattribend();
|
||||
this._state = "BeforeAttrsName";
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.InAttrsValueSQ = function(c) {
|
||||
if (c === "'") {
|
||||
this._cbs._attribvalue += this._getSection();
|
||||
this._cbs.onattribend();
|
||||
this._state = "BeforeAttrsName";
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.InAttrsValueNQ = function(c) {
|
||||
if (/\s/.test(c) || c === ">") {
|
||||
this._cbs._attribvalue += this._getSection();
|
||||
this._cbs.onattribend();
|
||||
this._state = "BeforeAttrsName";
|
||||
this._index--;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.BeforeCloseTag = function(c) {
|
||||
if (/\s/.test(c));
|
||||
else if (c === ">") {
|
||||
this._state = "TEXT";
|
||||
} else {
|
||||
this._state = "InCloseTag";
|
||||
this._sectionStart = this._index;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.InCloseTag = function(c) {
|
||||
if (c === ">" || /\s/.test(c)) {
|
||||
this._cbs.onclosetag(this._getSection());
|
||||
this._state = "AfterCloseTag";
|
||||
this._index--;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.InSelfCloseTag = function(c) {
|
||||
if (c === ">") {
|
||||
this._cbs.onopentagend();
|
||||
this._state = "TEXT";
|
||||
this._sectionStart = this._index + 1;
|
||||
} else if (!(/\s/.test(c))) {
|
||||
this._state = "BeforeAttrsName";
|
||||
this._index--;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.AfterCloseTag = function(c) {
|
||||
if (c === ">") {
|
||||
this._state = "TEXT";
|
||||
this._sectionStart = this._index + 1;
|
||||
}
|
||||
};
|
||||
Tokenizer.prototype.BeforeDeclaration = function(c) {
|
||||
if (c == '-') this._state = "InComment";
|
||||
else if (c == '[') this._state = "BeforeCDATA1";
|
||||
else this._state = "InDeclaration";
|
||||
};
|
||||
Tokenizer.prototype.InDeclaration = function(c) {
|
||||
var index = this._buffer.indexOf(">", this._index);
|
||||
if (index != -1) {
|
||||
this._index = index;
|
||||
this._sectionStart = index + 1;
|
||||
} else this._sectionStart = this._index = this._buffer.length;
|
||||
this._state = "TEXT";
|
||||
};
|
||||
Tokenizer.prototype.InComment = function(c) {
|
||||
let key = (c == '-' ? '-->' : '>');
|
||||
let index = this._buffer.indexOf(key, this._index);
|
||||
if (index != -1) {
|
||||
this._index = index + key.length - 1;
|
||||
this._sectionStart = this._index + 1;
|
||||
} else this._sectionStart = this._index = this._buffer.length;
|
||||
this._state = "TEXT";
|
||||
};
|
||||
Tokenizer.prototype.BeforeCDATA1 = function(c) {
|
||||
if (c == 'C') this._state = "BeforeCDATA2";
|
||||
else this._state = "InDeclaration";
|
||||
};
|
||||
Tokenizer.prototype.BeforeCDATA2 = function(c) {
|
||||
if (c == 'D') this._state = "BeforeCDATA3";
|
||||
else this._state = "InDeclaration";
|
||||
};
|
||||
Tokenizer.prototype.BeforeCDATA3 = function(c) {
|
||||
if (c == 'A') this._state = "BeforeCDATA4";
|
||||
else this._state = "InDeclaration";
|
||||
};
|
||||
Tokenizer.prototype.BeforeCDATA4 = function(c) {
|
||||
if (c == 'T') this._state = "BeforeCDATA5";
|
||||
else this._state = "InDeclaration";
|
||||
};
|
||||
Tokenizer.prototype.BeforeCDATA5 = function(c) {
|
||||
if (c == 'A') this._state = "InCDATA";
|
||||
else this._state = "InDeclaration";
|
||||
};
|
||||
Tokenizer.prototype.InCDATA = function(c) {
|
||||
let key = (c == '[' ? ']]>' : '>');
|
||||
let index = this._buffer.indexOf(key, this._index);
|
||||
if (index != -1) {
|
||||
this._index = index + key.length - 1;
|
||||
this._sectionStart = this._index + 1;
|
||||
} else this._sectionStart = this._index = this._buffer.length;
|
||||
this._state = "TEXT";
|
||||
};
|
||||
Tokenizer.prototype.parse = function(chunk) {
|
||||
this._buffer += chunk;
|
||||
for (; this._index < this._buffer.length; this._index++)
|
||||
this[this._state](this._buffer[this._index]);
|
||||
if (this._state === "TEXT" && this._sectionStart !== this._index)
|
||||
this._cbs.ontext(this._buffer.substr(this._sectionStart));
|
||||
this._cbs.onend();
|
||||
};
|
||||
Tokenizer.prototype._getSection = function() {
|
||||
return this._buffer.substring(this._sectionStart, this._index);
|
||||
};
|
||||
module.exports = Tokenizer;
|
||||
@@ -0,0 +1,37 @@
|
||||
String.prototype.splice = function(start = 0, deleteCount = 0, addStr = '') {
|
||||
if (start < 0) start = this.length + start;
|
||||
if (deleteCount < 0) deleteCount = 0;
|
||||
return this.substring(0, start) + addStr + this.substring(start + deleteCount);
|
||||
}
|
||||
module.exports = {
|
||||
versionHigherThan(version = '') {
|
||||
//旧版 var v1 = wx.getSystemInfoSync().SDKVersion.split('.');
|
||||
var v1 = wx.getAppBaseInfo().SDKVersion.split('.');
|
||||
var v2 = version.split('.');
|
||||
const len = Math.max(v1.length, v2.length);
|
||||
while (v1.length < len) {
|
||||
v1.push('0');
|
||||
}
|
||||
while (v2.length < len) {
|
||||
v2.push('0');
|
||||
}
|
||||
for (let i = 0; i < len; i++) {
|
||||
const num1 = parseInt(v1[i]);
|
||||
const num2 = parseInt(v2[i]);
|
||||
if (num1 > num2) {
|
||||
return true;
|
||||
} else if (num1 < num2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
html2nodes(html, tagStyle) {
|
||||
const Parser = require('./Parser.js');
|
||||
return Parser(html, tagStyle);
|
||||
},
|
||||
css2object(style, tagStyle) {
|
||||
const CssTokenizer = require('./CssTokenizer.js');
|
||||
return new CssTokenizer(style, tagStyle).parse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
//Parser组件
|
||||
const html2nodes = require('./Parser.js');
|
||||
const initData = function(Component) {
|
||||
setTimeout(() => {
|
||||
Component.createSelectorQuery().select('#contain').boundingClientRect(res => {
|
||||
Component.triggerEvent('ready', res);
|
||||
}).exec();
|
||||
Component.videoContext = [];
|
||||
let nodes = [Component.selectComponent('#contain')];
|
||||
nodes = nodes.concat(Component.selectAllComponents('#contain>>>#node'));
|
||||
for (let node of nodes) {
|
||||
for (let item of node.data.nodes) {
|
||||
if (item.name == 'video') {
|
||||
Component.videoContext.push({
|
||||
id: item.attrs.id,
|
||||
context: wx.createVideoContext(item.attrs.id, node)
|
||||
});
|
||||
} else if (item.name == 'audio' && item.attrs.autoplay)
|
||||
wx.createAudioContext(item.attrs.id, node).play();
|
||||
}
|
||||
}
|
||||
}, 10)
|
||||
}
|
||||
Component({
|
||||
properties: {
|
||||
'html': {
|
||||
type: String,
|
||||
value: '',
|
||||
observer: function(html) {
|
||||
let hideAnimation = {},
|
||||
showAnimation = {};
|
||||
if (this.data.showWithAnimation) {
|
||||
hideAnimation = wx.createAnimation({
|
||||
duration: this.data.animationDuration,
|
||||
timingFunction: "ease"
|
||||
}).opacity(0).step().export();
|
||||
showAnimation = wx.createAnimation({
|
||||
duration: this.data.animationDuration,
|
||||
timingFunction: "ease"
|
||||
}).opacity(1).step().export();
|
||||
}
|
||||
if (!html) {
|
||||
this.setData({
|
||||
nodes: []
|
||||
})
|
||||
} else if (typeof html == 'string') {
|
||||
html2nodes(html, this.data.tagStyle).then(res => {
|
||||
this.setData({
|
||||
nodes: res.nodes,
|
||||
controls: {
|
||||
imgMode: this.data.imgMode
|
||||
},
|
||||
showAnimation,
|
||||
hideAnimation
|
||||
}, initData(this))
|
||||
if (res.title && this.data.autosetTitle) {
|
||||
wx.setNavigationBarTitle({
|
||||
title: res.title
|
||||
})
|
||||
}
|
||||
this.imgList = res.imgList;
|
||||
this.triggerEvent('parse', res);
|
||||
}).catch(err => {
|
||||
this.triggerEvent('error', err);
|
||||
})
|
||||
} else if (html.constructor == Array) {
|
||||
this.setData({
|
||||
controls: {
|
||||
imgMode: this.data.imgMode
|
||||
},
|
||||
showAnimation,
|
||||
hideAnimation
|
||||
}, initData(this))
|
||||
this.imgList = [];
|
||||
} else if (typeof html == 'object') {
|
||||
if (!html.nodes || html.nodes.constructor != Array) {
|
||||
this.triggerEvent('error', {
|
||||
message: "传入的nodes数组格式不正确!应该传入的类型是array,实际传入的类型是:" + typeof html.nodes
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
controls: {
|
||||
imgMode: this.data.imgMode
|
||||
},
|
||||
showAnimation,
|
||||
hideAnimation
|
||||
}, initData(this))
|
||||
if (html.title && this.data.autosetTitle) {
|
||||
wx.setNavigationBarTitle({
|
||||
title: html.title
|
||||
})
|
||||
}
|
||||
this.imgList = html.imgList || [];
|
||||
} else {
|
||||
this.triggerEvent('error', {
|
||||
message: "错误的html类型:" + typeof html
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
'autocopy': {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
'autopause': {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
'autosetTitle':{
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
'imgMode': {
|
||||
type: String,
|
||||
value: "default"
|
||||
},
|
||||
'selectable': {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
'tagStyle': {
|
||||
type: Object,
|
||||
value: { video:"width:100%" }
|
||||
},
|
||||
'showWithAnimation': {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
'animationDuration': {
|
||||
type: Number,
|
||||
value: 400
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//事件
|
||||
tapEvent(e) {
|
||||
if (this.data.autocopy && e.detail && /^http/.test(e.detail)) {
|
||||
wx.setClipboardData({
|
||||
data: e.detail,
|
||||
success() {
|
||||
wx.showToast({
|
||||
title: '链接已复制',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.triggerEvent('linkpress', e.detail);
|
||||
},
|
||||
errorEvent(e) {
|
||||
this.triggerEvent('error', e.detail);
|
||||
},
|
||||
//内部方法
|
||||
_previewImg(e) {
|
||||
wx.previewImage({
|
||||
current: e.detail,
|
||||
urls: this.imgList.length ? this.imgList : [e.detail],
|
||||
})
|
||||
},
|
||||
_playVideo(e) {
|
||||
if (this.videoContext.length > 1 && this.data.autopause) {
|
||||
for (let video of this.videoContext) {
|
||||
if (video.id == e.detail) continue;
|
||||
video.context.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"trees": "./trees/trees"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<!--Parser-->
|
||||
<slot wx:if="{{!(html.nodes||((html[0].name||html[0].type)?1:nodes.length))}}" animation="{{hideAnimation}}"></slot>
|
||||
<trees id="contain" style="{{(showWithAnimation?'opacity:0;':'')+(selectable?'user-select:text;-webkit-user-select:text':'')}}" animation="{{showAnimation}}" nodes="{{html.nodes||((html[0].name||html[0].type)?html:nodes)}}" controls="{{controls}}" catchpreview="_previewImg"
|
||||
catchplay="_playVideo" catchlinkpress="tapEvent" catcherror="errorEvent" />
|
||||
@@ -0,0 +1,5 @@
|
||||
:host {
|
||||
display: block;
|
||||
overflow: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Parser/trees/cssHandler.wxs
|
||||
module.exports = {
|
||||
getStyle: function(style, display) {
|
||||
var res = "";
|
||||
var reg = getRegExp("float\s*:\s*[^;]*", "i");
|
||||
if (reg.test(style)) res += reg.exec(style)[0];
|
||||
reg = getRegExp("margin[^;]*auto", "i");
|
||||
if (reg.test(style)) res += (";" + reg.exec(style)[0]);
|
||||
reg = getRegExp("display\s*:\s*([^;]*)", "i");
|
||||
if (reg.test(style) && reg.exec(style)[1]!="flex") res += (';' + reg.exec(style)[0]);
|
||||
else res += (';display:' + display);
|
||||
reg = getRegExp("[^;\s]*width\s*:\s*[^;]*", "ig");
|
||||
var width = reg.exec(style);
|
||||
while (width) {
|
||||
res += (';' + width[0]);
|
||||
width = reg.exec(style);
|
||||
}
|
||||
return res;
|
||||
},
|
||||
setImgStyle: function(item, imgMode) {
|
||||
if (getRegExp("[^-]width\s*:\s*[^;]*", "i").test(';' + item.attrs.style))
|
||||
item.attrs.style += ';width:100%';
|
||||
if (imgMode == "widthFix")
|
||||
item.attrs.style += ";height:auto !important";
|
||||
return [item];
|
||||
},
|
||||
setStyle: function(item) {
|
||||
if (getRegExp("[^-]width\s*:\s*[^;]*", "i").test(';' + item.attrs.style))
|
||||
item.attrs.style += ';width:100%';
|
||||
return [item];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Parser/trees/trees.js
|
||||
Component({
|
||||
properties: {
|
||||
nodes: {
|
||||
type: Array,
|
||||
value: []
|
||||
},
|
||||
controls: {
|
||||
type: Object,
|
||||
value: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//冒泡事件
|
||||
playEvent(e) {
|
||||
this.triggerEvent('play', e.currentTarget.dataset.id, {
|
||||
bubbles: true,
|
||||
composed: true
|
||||
});
|
||||
},
|
||||
previewEvent(e) {
|
||||
if (!e.target.dataset.hasOwnProperty('ignore')) {
|
||||
this.triggerEvent('preview', e.currentTarget.dataset.src, {
|
||||
bubbles: true,
|
||||
composed: true
|
||||
});
|
||||
}
|
||||
},
|
||||
tapEvent(e) {
|
||||
this.triggerEvent('linkpress', e.currentTarget.dataset.href, {
|
||||
bubbles: true,
|
||||
composed: true
|
||||
});
|
||||
},
|
||||
errorEvent(e) {
|
||||
//尝试加载其他源
|
||||
if (!this.data.controls[e.currentTarget.dataset.id] && e.currentTarget.dataset.source.length > 1) {
|
||||
this.data.controls[e.currentTarget.dataset.id] = {
|
||||
play: false,
|
||||
index: 1
|
||||
}
|
||||
} else if (this.data.controls[e.currentTarget.dataset.id] && e.currentTarget.dataset.source.length > (this.data.controls[e.currentTarget.dataset.id].index + 1)) {
|
||||
this.data.controls[e.currentTarget.dataset.id].index++;
|
||||
}
|
||||
this.setData({
|
||||
controls: this.data.controls
|
||||
})
|
||||
this.triggerEvent('error', {
|
||||
target: e.currentTarget,
|
||||
message: e.detail.errMsg
|
||||
}, {
|
||||
bubbles: true,
|
||||
composed: true
|
||||
});
|
||||
},
|
||||
//内部方法:加载视频
|
||||
_loadVideo(e) {
|
||||
this.data.controls[e.currentTarget.dataset.id] = {
|
||||
play: true,
|
||||
index: 0
|
||||
}
|
||||
this.setData({
|
||||
controls: this.data.controls
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"trees":"./trees"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<!--Parser/trees/trees.wxml-->
|
||||
<wxs module="cssHandler" src="./cssHandler.wxs" />
|
||||
<block wx:for='{{nodes}}' wx:key="index">
|
||||
<block wx:if="{{!item.continue}}">
|
||||
<!--图片-->
|
||||
<rich-text wx:if="{{item.name=='img'}}" style="{{cssHandler.getStyle(item.attrs.style,'inline-block')}}" nodes='{{cssHandler.setImgStyle(item,controls.imgMode)}}' data-ignore='{{item.attrs.ignore}}' data-src='{{item.attrs.src}}' bindtap='previewEvent' />
|
||||
<!--文本-->
|
||||
<block wx:elif="{{item.type=='text'}}">
|
||||
<text wx:if="{{!item.decode}}" decode>{{item.text}}</text>
|
||||
<rich-text wx:else style="display:inline-block" nodes="{{[item]}}"></rich-text>
|
||||
</block>
|
||||
<text wx:elif="{{item.name=='br'}}">\n</text>
|
||||
<!--视频-->
|
||||
<block wx:elif="{{item.name=='video'}}">
|
||||
<view wx:if="{{item.attrs.id>'video3'&&!controls[item.attrs.id].play}}" class="video" style="{{item.attrs.style+(item.attrs.width?(';width:'+item.attrs.width):'')+(item.attrs.height?('height:'+item.attrs.height):'')}}" data-id="{{item.attrs.id}}" bindtap="_loadVideo">
|
||||
<view class="video-triangle" />
|
||||
</view>
|
||||
<video wx:else src='{{controls[item.attrs.id]?item.attrs.source[controls[item.attrs.id].index]:item.attrs.src}}' id="{{item.attrs.id}}" loop='{{item.attrs.loop}}' controls='{{item.attrs.controls}}' autoplay="{{item.attrs.autoplay||controls[item.attrs.id].play}}"
|
||||
class="v" muted="{{item.attrs.muted}}" style="{{item.attrs.style+(item.attrs.width?(';width:'+item.attrs.width):'')+(item.attrs.height?('height:'+item.attrs.height):'')}}" data-id="{{item.attrs.id}}" data-source="{{item.attrs.source}}" bindplay='playEvent'
|
||||
binderror="errorEvent" />
|
||||
</block>
|
||||
<!--音频-->
|
||||
<audio wx:elif="{{item.name=='audio'}}" src='{{controls[item.attrs.id]?item.attrs.source[controls[item.attrs.id].index]:item.attrs.src}}' id="{{item.attrs.id}}" loop='{{item.attrs.loop}}' controls='{{item.attrs.controls}}' poster='{{item.attrs.poster}}'
|
||||
name='{{item.attrs.name}}' author='{{item.attrs.author}}' style="{{item.attrs.style}}" data-id="{{item.attrs.id}}" data-source="{{item.attrs.source}}" binderror="errorEvent" />
|
||||
<!--富文本-->
|
||||
<rich-text wx:else class="{{item.name}}" style="{{cssHandler.getStyle(item.attrs.style,'block')}}" nodes="{{cssHandler.setStyle(item)}}" />
|
||||
</block>
|
||||
<!--链接-->
|
||||
<navigator wx:elif="{{item.name=='a'}}" url="{{item.attrs.href}}" style="{{item.attrs.style}}" data-href='{{item.attrs.href}}' hover-class="navigator-hover" hover-start-time="25" hover-stay-time="300" bindtap="tapEvent">
|
||||
<trees id="node" nodes="{{item.children}}" controls="{{controls}}" />
|
||||
</navigator>
|
||||
<!--继续递归-->
|
||||
<trees wx:else id="node" class="{{item.name}}" style="{{item.attrs.style}}" nodes="{{item.children}}" controls="{{controls}}" />
|
||||
</block>
|
||||
@@ -0,0 +1,69 @@
|
||||
/* 链接受到点击的hover-class,可自定义修改 */
|
||||
.navigator-hover {
|
||||
opacity: 0.7;
|
||||
text-decoration: underline;
|
||||
}
|
||||
/* 以下内容不建议修改 */
|
||||
:host {
|
||||
display: inherit;
|
||||
float: inherit;
|
||||
}
|
||||
.sub, .sup, .bdo, .bdi, .ruby, .rt {
|
||||
display: inline-block !important;
|
||||
}
|
||||
.div, .blockquote, .p{
|
||||
display:block;
|
||||
}
|
||||
.b, .strong {
|
||||
display: inline;
|
||||
font-weight: bold;
|
||||
}
|
||||
.em, .i {
|
||||
display: inline;
|
||||
font-style: italic;
|
||||
}
|
||||
.del {
|
||||
display: inline;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.ins {
|
||||
display: inline;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.code {
|
||||
display: inline;
|
||||
font-family: monospace;
|
||||
}
|
||||
.big {
|
||||
font-size:1.2em;
|
||||
display:inline;
|
||||
}
|
||||
.small {
|
||||
font-size:0.8em;
|
||||
display:inline;
|
||||
}
|
||||
.q, .span, .label, .abbr {
|
||||
display: inline;
|
||||
}
|
||||
.q::before {
|
||||
content: '"';
|
||||
}
|
||||
.q::after {
|
||||
content: '"';
|
||||
}
|
||||
.video {
|
||||
background-color: rgb(0, 0, 0);
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.video-triangle {
|
||||
border-width: 15px 0 15px 30px;
|
||||
border-style: solid;
|
||||
border-color: transparent transparent transparent white;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin: -15px 0 0 -15px;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// app.js
|
||||
const api = require('./utils/api');
|
||||
const store = require('./utils/store');
|
||||
|
||||
App({
|
||||
globalData: {
|
||||
/** 初始化完成的 Promise,页面 onLoad 里等它即可,避免首屏读不到数据 */
|
||||
ready: null,
|
||||
},
|
||||
|
||||
onLaunch() {
|
||||
this.globalData.ready = this.bootstrap();
|
||||
},
|
||||
|
||||
/**
|
||||
* 启动流程:配置再静默登录,最后拉已购课程。
|
||||
*
|
||||
* 每一步失败都不阻断启动:配置缺失时用兜底文案,登录失败时按未登录渲染。
|
||||
* 旧版本在页面 data 里同步读缓存、而缓存由异步写入,首次安装必然报错,这里不再重蹈。
|
||||
*/
|
||||
bootstrap() {
|
||||
const tasks = [
|
||||
api
|
||||
.getConfig()
|
||||
.then((cfg) => store.setSiteConfig(cfg))
|
||||
.catch((err) => console.warn('[app] 配置加载失败', err)),
|
||||
|
||||
api
|
||||
.login()
|
||||
.then(() => api.getEntitlements())
|
||||
.then((list) => store.setEntitlements(list))
|
||||
.catch((err) => console.warn('[app] 登录或权益加载失败', err)),
|
||||
];
|
||||
return Promise.all(tasks);
|
||||
},
|
||||
|
||||
/** 页面调用它确保初始化完成。 */
|
||||
ready() {
|
||||
return this.globalData.ready || Promise.resolve();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/wode/wode",
|
||||
"pages/kecheng/kecheng",
|
||||
"pages/LoginOrOutDetails/LoginOrOutDetails",
|
||||
"pages/WebPageDetails/WebPageDetails",
|
||||
"pages/VideoDetails/VideoDetails",
|
||||
"pages/VideoDetailsPage/VideoDetailsPage",
|
||||
"pages/IndexNewCourseDetails/IndexNewCourseDetails",
|
||||
"pages/IndexFreeCourseDetails/IndexFreeCourseDetails",
|
||||
"pages/ChangeUserInfo/ChangeUserInfo"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "叶雷讲数学",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"backgroundColor": "#fff"
|
||||
},
|
||||
"tabBar": {
|
||||
"color":"#000",
|
||||
"selectedColor":"#00aa00",
|
||||
"borderStyle": "black",
|
||||
"list": [{
|
||||
"text": "首页",
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "static/image/shouye.png",
|
||||
"selectedIconPath": "static/image/shouye-selected.png"
|
||||
},
|
||||
{
|
||||
"text": "知识",
|
||||
"pagePath": "pages/kecheng/kecheng",
|
||||
"iconPath": "static/image/kecheng.png",
|
||||
"selectedIconPath": "static/image/kecheng-selected.png"
|
||||
},{
|
||||
"text": "我的",
|
||||
"pagePath": "pages/wode/wode",
|
||||
"iconPath": "static/image/wode.png",
|
||||
"selectedIconPath": "static/image/wode-selected.png"
|
||||
}]
|
||||
},
|
||||
"componentFramework": "glass-easel",
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"lazyCodeLoading": "requiredComponents"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 200rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 全局配置。
|
||||
*
|
||||
* 部署时只需修改本文件即可切换环境——所有域名与路径都收口在这里。
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* 服务端 API。
|
||||
* 这个域名同时要加到微信后台的「request 合法域名」白名单。
|
||||
*/
|
||||
API_BASE_URL: 'https://yelaymaths-api.yeomai.site',
|
||||
|
||||
/**
|
||||
* 课程数据端(图片 / 视频)。
|
||||
* 已存库的正文 HTML 里的地址与此无关——那部分在数据迁移时按服务端的 STATIC_BASE_URL 改写。
|
||||
*/
|
||||
STATIC_BASE_URL: 'https://yelaymaths-data.yeomai.site',
|
||||
|
||||
/** 本地缓存 key */
|
||||
STORAGE: {
|
||||
TOKEN: 'accessToken',
|
||||
REFRESH_TOKEN: 'refreshToken',
|
||||
USER: 'userInfo',
|
||||
CONFIG: 'siteConfig',
|
||||
ENTITLEMENTS: 'entitlements',
|
||||
},
|
||||
|
||||
/** 占位图(走网络,不占用小程序包体积) */
|
||||
PLACEHOLDER: {
|
||||
AVATAR: '/Images/Placeholder/defaultAvatar.png',
|
||||
WECHAT: '/Images/Placeholder/weixin.png',
|
||||
USER: '/Images/Placeholder/user.png',
|
||||
},
|
||||
|
||||
/** 请求超时(毫秒) */
|
||||
TIMEOUT: 15000,
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "yelaymaths",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "叶雷讲数学 — 微信小程序",
|
||||
"dependencies": {
|
||||
"@vant/weapp": "^1.11.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
// pages/ChangeUserInfo/ChangeUserInfo.js
|
||||
const api = require('../../utils/api');
|
||||
const store = require('../../utils/store');
|
||||
const config = require('../../config/index');
|
||||
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
// wxml 里直接用它拼头像路径,保持不变
|
||||
BaseURL: config.STATIC_BASE_URL,
|
||||
activeNames: [],
|
||||
username: '',
|
||||
HeadiconID: 0,
|
||||
list: 50,
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
app.ready().then(() => this.applyUser());
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.applyUser();
|
||||
},
|
||||
|
||||
applyUser() {
|
||||
const user = store.getUser() || {};
|
||||
this.setData({
|
||||
username: user.nickname || '',
|
||||
HeadiconID: user.headiconId || 0,
|
||||
list: parseInt(store.cfg('profile.headicon_count', '50'), 10) || 50,
|
||||
});
|
||||
},
|
||||
|
||||
onChange(event) {
|
||||
let inputVal = event.detail;
|
||||
// 只保留中英文与数字
|
||||
inputVal = inputVal.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '');
|
||||
// 去掉开头的数字
|
||||
inputVal = inputVal.replace(/^[0-9]+/, '');
|
||||
inputVal = inputVal.substring(0, 8);
|
||||
this.setData({ username: inputVal });
|
||||
},
|
||||
|
||||
selectHeadicon(event) {
|
||||
this.setData({ HeadiconID: event.currentTarget.dataset.index });
|
||||
},
|
||||
|
||||
onChange2(event) {
|
||||
this.setData({ activeNames: event.detail });
|
||||
},
|
||||
|
||||
onConfirm() {
|
||||
const nickname = (this.data.username || '').trim();
|
||||
if (!nickname) {
|
||||
wx.showToast({ title: '请输入用户名', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定修改个人资料吗?',
|
||||
confirmColor: '#ff0000',
|
||||
success: (res) => {
|
||||
if (!res.confirm) return;
|
||||
wx.showLoading({ title: '提交中', mask: true });
|
||||
|
||||
api
|
||||
.updateMe({ nickname: nickname, headiconId: this.data.HeadiconID })
|
||||
.then((user) => {
|
||||
store.setUser(user);
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: '成功', icon: 'success', mask: true, duration: 1500 });
|
||||
setTimeout(() => wx.switchTab({ url: '/pages/wode/wode' }), 1500);
|
||||
})
|
||||
.catch((err) => {
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: err.message || '修改失败', icon: 'none', mask: true });
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-collapse": "@vant/weapp/collapse/index",
|
||||
"van-collapse-item": "@vant/weapp/collapse-item/index",
|
||||
"van-grid": "@vant/weapp/grid/index",
|
||||
"van-grid-item": "@vant/weapp/grid-item/index",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"van-button": "@vant/weapp/button/index"
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<van-cell-group>
|
||||
<van-field
|
||||
label="用户名"
|
||||
value="{{username}}"
|
||||
placeholder="请输入用户名"
|
||||
border="true"
|
||||
bind:change="onChange"
|
||||
/>
|
||||
</van-cell-group>
|
||||
|
||||
<van-collapse value="{{ activeNames }}" bind:change="onChange2">
|
||||
<van-collapse-item title="头像" name="1">
|
||||
<view style="display: flex; justify-content: center; padding: 20rpx 0;">
|
||||
<van-image width="120rpx" height="120rpx" src="{{BaseURL}}/Images/Headicons/Headicon{{HeadiconID}}.png" />
|
||||
</view>
|
||||
<van-grid icon-size="80rpx">
|
||||
<scroll-view scroll-y style="min-height: 200rpx;max-height: 620rpx;" class="scroll-area">
|
||||
<van-grid-item wx:for="{{ list }}" wx:key="index" icon="{{BaseURL}}/Images/Headicons/Headicon{{index + 1}}.png" text="{{index + 1}}" bind:click="selectHeadicon" data-index="{{index + 1}}"/>
|
||||
</scroll-view>
|
||||
</van-grid>
|
||||
</van-collapse-item>
|
||||
</van-collapse>
|
||||
|
||||
<view class="button-container" style="text-align: center;padding: 20rpx;">
|
||||
<van-button type="primary" bind:click="onConfirm">确认修改</van-button>
|
||||
</view>
|
||||
@@ -0,0 +1 @@
|
||||
/* pages/ChangeUserInfo/ChangeUserInfo.wxss */
|
||||
@@ -0,0 +1,56 @@
|
||||
// pages/IndexFreeCourseDetails/IndexFreeCourseDetails.js
|
||||
const api = require('../../utils/api');
|
||||
const format = require('../../utils/format');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
VideoTitle: '',
|
||||
playdata: [],
|
||||
VideoPlayerSrc: '',
|
||||
HiddenVideoControl: true,
|
||||
top: 0,
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const seriesNo = options.seriesNo;
|
||||
if (!seriesNo) {
|
||||
wx.switchTab({ url: '/pages/index/index' });
|
||||
return;
|
||||
}
|
||||
|
||||
api
|
||||
.getFreeLessons(Number(seriesNo))
|
||||
.then((list) => {
|
||||
const rows = (list || []).map((item) => ({
|
||||
coverUrl: item.coverUrl,
|
||||
videoTitle: item.videoTitle,
|
||||
intro: item.intro,
|
||||
publishedAt: format.toDateString(item.publishedAt),
|
||||
duration: item.duration,
|
||||
videoUrl: item.videoUrl,
|
||||
}));
|
||||
this.setData({
|
||||
playdata: rows,
|
||||
VideoTitle: rows.length ? rows[0].videoTitle || '' : '',
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('[IndexFreeCourseDetails] 加载失败', err);
|
||||
this.setData({ playdata: [] });
|
||||
});
|
||||
},
|
||||
|
||||
onTapLesson(e) {
|
||||
const item = this.data.playdata[e.currentTarget.dataset.index];
|
||||
if (!item || !item.videoUrl) {
|
||||
wx.showToast({ title: '该课时暂无视频', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.setData({ VideoPlayerSrc: item.videoUrl, HiddenVideoControl: false, top: 420 });
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return { title: '叶雷讲数学', path: '/pages/index/index' };
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<video hidden="{{HiddenVideoControl}}" class="videoplayer" src="{{VideoPlayerSrc}}" />
|
||||
<scroll-view class="scrollarea" scroll-y type="list" style="top:{{top}}rpx;">
|
||||
<view class="jieshao">
|
||||
<text decode class="video_biaoti"> {{VideoTitle}}</text>
|
||||
<text decode class="video_info"> 已更新{{playdata.length}}期</text>
|
||||
</view>
|
||||
|
||||
<view class="videolistcontainer" bind:tap="onTapLesson"
|
||||
wx:for="{{playdata}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-index="{{index}}">
|
||||
<view class="videoimage">
|
||||
<image class="coverimage" src="{{item.coverUrl}}" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="videoinfo">
|
||||
<text class="videotitle">{{item.videoTitle}}</text>
|
||||
<text class="videodetails">{{item.intro}}</text>
|
||||
<view class="videoinfo2">
|
||||
<text class="videodata">{{item.publishedAt}}</text>
|
||||
<text class="videotime">{{item.duration}}min</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
.videoplayer {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 420rpx;
|
||||
width: 750rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
.scrollarea {
|
||||
position: relative;
|
||||
top: 420rpx;
|
||||
flex: 1;
|
||||
overflow-y: hidden;
|
||||
|
||||
}
|
||||
|
||||
.jieshao {
|
||||
margin-bottom: 10rpx;
|
||||
/* box-shadow: 0 4rpx 4rpx rgba(150, 150, 150, 0.5); */
|
||||
position: relative;
|
||||
/* height: 100rpx; */
|
||||
display: block;
|
||||
}
|
||||
.video_biaoti {
|
||||
text-align: center;
|
||||
display: block;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.video_miaoshu {
|
||||
text-align: center;
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.video_info {
|
||||
position: absolute;
|
||||
bottom: 10rpx;
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
right: 30rpx;
|
||||
}
|
||||
.video_list_content {
|
||||
margin: 10rpx 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.videolistcontainer {
|
||||
border-radius: 20rpx;
|
||||
margin: 10rpx 10rpx;
|
||||
box-shadow: 0 0 4rpx rgba(0, 0, 0, 0.5);
|
||||
width: 730rpx;
|
||||
height: 200rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.videoimage {
|
||||
width: 320rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-left: 10rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 5rpx 10rpx rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.videoinfo{
|
||||
position: relative;
|
||||
width: 390rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.videotitle {
|
||||
text-align: left;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.videodetails {
|
||||
display: block;
|
||||
margin: 10rpx 0rpx;
|
||||
font-size: 25rpx;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.videoinfo2 {
|
||||
position:absolute;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content:left;
|
||||
}
|
||||
.videodata {
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.videotime {
|
||||
font-size: 20rpx;
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
.coverimage {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// pages/IndexNewCourseDetails/IndexNewCourseDetails.js
|
||||
const api = require('../../utils/api');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
html: ' ',
|
||||
courseCode: '',
|
||||
courseTitle: '',
|
||||
priceYuan: '',
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const id = options.id;
|
||||
if (!id) return;
|
||||
|
||||
api
|
||||
.getHomeCourses()
|
||||
.then((list) => {
|
||||
const item = (list || []).filter((c) => String(c.id) === String(id))[0];
|
||||
if (!item) return;
|
||||
this.setData({
|
||||
html: item.content || ' ',
|
||||
courseCode: item.courseCode || '',
|
||||
courseTitle: item.courseTitle || '',
|
||||
});
|
||||
})
|
||||
.catch((err) => console.error('[IndexNewCourseDetails] 加载失败', err));
|
||||
},
|
||||
|
||||
/** 复用付费课页面完成购买:未拥有时那里会展示价格与购买按钮。 */
|
||||
toBuy() {
|
||||
if (!this.data.courseCode) return;
|
||||
wx.navigateTo({ url: '/pages/VideoDetails/VideoDetails?code=' + this.data.courseCode });
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"Parser":"/Parser/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<!--pages/IndexNewCourseDetails/IndexNewCourseDetails.wxml-->
|
||||
<Parser html="{{html}}">加载中...</Parser>
|
||||
|
||||
<view class="fixed-btn-wrapper">
|
||||
<view class="btn-group">
|
||||
<button wx:if="{{courseCode}}" class="DianJiXiangQing1" bind:tap="toBuy">
|
||||
<text class="DianJiXiangQing2">立即购买</text>
|
||||
</button>
|
||||
<button class="DianJiXiangQing1" open-type="contact" bindcontact="handleContact">
|
||||
<text class="DianJiXiangQing2">咨询客服</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,46 @@
|
||||
/* pages/IndexNewCourseDetails/IndexNewCourseDetails.wxss */
|
||||
@keyframes breathe {
|
||||
0%, 100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
}
|
||||
|
||||
.fixed-btn-wrapper {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 60rpx;
|
||||
padding: 0 20rpx; /* 调整为左右边距 */
|
||||
display: flex;
|
||||
justify-content: center; /* 水平居中 */
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
max-width: 700rpx;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.DianJiXiangQing1 {
|
||||
flex: 1;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
margin: 0 10rpx;
|
||||
border-radius: 45rpx;
|
||||
height: 90rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
animation: breathe 1s linear infinite;
|
||||
}
|
||||
|
||||
.DianJiXiangQing2 {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// pages/LoginOrOutDetails/LoginOrOutDetails.js
|
||||
const api = require('../../utils/api');
|
||||
const store = require('../../utils/store');
|
||||
const config = require('../../config/index');
|
||||
|
||||
const app = getApp();
|
||||
|
||||
/** 未填昵称时自动生成,与旧版行为一致:用户 + 8 位小写字母数字 */
|
||||
function randomNickname() {
|
||||
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
let s = '';
|
||||
for (let i = 0; i < 8; i++) s += chars[Math.floor(Math.random() * chars.length)];
|
||||
return '用户' + s;
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
userInfo: { avatarUrl: '', nickName: '' },
|
||||
loginStatue: false,
|
||||
LoginTag: '一键登录',
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
app.ready().then(() => this.refresh());
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
refresh() {
|
||||
const user = store.getUser();
|
||||
const registered = !!(user && user.nickname);
|
||||
this.setData({
|
||||
loginStatue: registered,
|
||||
LoginTag: registered ? '退出登录' : '一键登录',
|
||||
userInfo: {
|
||||
avatarUrl: config.STATIC_BASE_URL + config.PLACEHOLDER.WECHAT,
|
||||
nickName: registered ? user.nickname : '',
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
onLoginBtnClick() {
|
||||
const nickname = this.data.userInfo.nickName || randomNickname();
|
||||
wx.showLoading({ title: '请稍候', mask: true });
|
||||
|
||||
api
|
||||
.updateMe({ nickname: nickname })
|
||||
.then((user) => {
|
||||
store.setUser(user);
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: '成功', icon: 'success', mask: true, duration: 1500 });
|
||||
setTimeout(() => wx.switchTab({ url: '/pages/wode/wode' }), 1500);
|
||||
})
|
||||
.catch((err) => {
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: err.message || '登录失败', icon: 'none', mask: true });
|
||||
});
|
||||
},
|
||||
|
||||
onlogout() {
|
||||
if (!this.data.loginStatue) return;
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定退出登录吗?',
|
||||
confirmColor: '#ff0000',
|
||||
success: (res) => {
|
||||
if (!res.confirm) return;
|
||||
wx.showLoading({ title: '请稍候', mask: true });
|
||||
api.logout().then(() => {
|
||||
wx.hideLoading();
|
||||
wx.switchTab({ url: '/pages/wode/wode' });
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "个人信息"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<scroll-view class="scrollarea" scroll-y type="list">
|
||||
|
||||
<view class="imgview">
|
||||
<image class="touxiang_img" src="{{userInfo.avatarUrl}}" mode="" />
|
||||
</view>
|
||||
<view class="imgview2">
|
||||
<text class="imgtext2">叶雷讲数学</text>
|
||||
</view>
|
||||
<view class="imgview3">
|
||||
<text class="imgtext3">让数学不再难学</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loginStatue}}" class="btn_wrapper">
|
||||
<button plain class="btn1" bind:tap="onLoginBtnClick">
|
||||
<text class="btn_text">{{LoginTag}}</text>
|
||||
</button>
|
||||
</view>
|
||||
<view wx:else="{{loginStatue}}" class="btn_wrapper">
|
||||
<button plain class="btn2" bind:tap="onlogout">
|
||||
<text class="btn_text">退出登录</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
|
||||
</scroll-view>
|
||||
@@ -0,0 +1,117 @@
|
||||
/* pages/LoginOrOutDetails/LoginOrOutDetails.wxss */
|
||||
page {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.scrollarea {
|
||||
flex: 1;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.warp {
|
||||
|
||||
/* border: 1px solid #353535; */
|
||||
padding: 10rpx 0;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
margin: 50rpx 100rpx;
|
||||
border-radius: 30rpx;
|
||||
}
|
||||
.userinfo1 {
|
||||
margin-top: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.userinfo2 {
|
||||
margin-top: 80rpx;
|
||||
margin-bottom: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
.touxiang_btn[plain] {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
padding: 0;
|
||||
margin-left: 50rpx;
|
||||
margin-right: 50rpx;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.touxiang_text {
|
||||
margin-right: 50rpx;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.imgview {
|
||||
margin-top: 300rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.imgview2 {
|
||||
margin-top: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.imgview3 {
|
||||
color: rgb(95, 95, 95);
|
||||
font-size: 25rpx;
|
||||
margin-top: 15rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.imgtext {
|
||||
display: block;
|
||||
|
||||
}
|
||||
|
||||
.touxiang_img {
|
||||
display: block;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.nickname_label {
|
||||
margin-right: 50rpx;
|
||||
font-size: 34rpx;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.nickname_input {
|
||||
width: 160rpx;
|
||||
padding-left: 40rpx;
|
||||
}
|
||||
|
||||
.btn1 {
|
||||
width: 546rpx;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
.btn1[plain] {
|
||||
border: 0px solid #d10000;
|
||||
background-color: #d10000;
|
||||
/* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); */
|
||||
}
|
||||
.btn2 {
|
||||
width: 546rpx;
|
||||
margin-top: 30rpx;
|
||||
margin-bottom: 100rpx;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
.btn2[plain] {
|
||||
border: 0px solid #d10000;
|
||||
background-color: #d10000;
|
||||
/* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); */
|
||||
}
|
||||
.btn_text {
|
||||
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
// pages/VideoDetails/VideoDetails.js
|
||||
const api = require('../../utils/api');
|
||||
const store = require('../../utils/store');
|
||||
const format = require('../../utils/format');
|
||||
|
||||
const POLL_INTERVAL = 1500;
|
||||
const POLL_MAX = 8;
|
||||
|
||||
Page({
|
||||
data: {
|
||||
code: '',
|
||||
owned: false,
|
||||
loading: true,
|
||||
buying: false,
|
||||
VideoTitle: '',
|
||||
VideoDetails: '',
|
||||
coverUrl: '',
|
||||
priceYuan: '',
|
||||
playdata: [],
|
||||
VideoPlayerSrc: '',
|
||||
HiddenVideoControl: true,
|
||||
top: 0,
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const code = options.code;
|
||||
if (!code) {
|
||||
wx.switchTab({ url: '/pages/kecheng/kecheng' });
|
||||
return;
|
||||
}
|
||||
this.setData({ code: code });
|
||||
this.load(code);
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if (this.data.code && this.data.owned) this.load(this.data.code);
|
||||
},
|
||||
|
||||
load(code) {
|
||||
api
|
||||
.getCourse(code)
|
||||
.then((course) => {
|
||||
this.setData({
|
||||
loading: false,
|
||||
owned: course.owned,
|
||||
VideoTitle: course.title || '',
|
||||
VideoDetails: course.intro || '',
|
||||
coverUrl: course.coverUrl || '',
|
||||
priceYuan: format.fenToYuan(course.priceFen),
|
||||
});
|
||||
if (course.owned) this.loadLessons(code);
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setData({ loading: false });
|
||||
wx.showToast({ title: err.message || '课程加载失败', icon: 'none' });
|
||||
setTimeout(() => wx.switchTab({ url: '/pages/kecheng/kecheng' }), 1500);
|
||||
});
|
||||
},
|
||||
|
||||
loadLessons(code) {
|
||||
api
|
||||
.getLessons(code)
|
||||
.then((list) => {
|
||||
const rows = (list || []).map((item) => ({
|
||||
chapterId: item.chapterId,
|
||||
playId: item.playId,
|
||||
chapterTitle: item.chapterTitle,
|
||||
lessonTitle: item.lessonTitle,
|
||||
duration: item.duration,
|
||||
publishedAt: format.toDateString(item.publishedAt),
|
||||
coverUrl: item.coverUrl,
|
||||
}));
|
||||
this.setData({ playdata: rows });
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setData({ playdata: [] });
|
||||
console.warn('[VideoDetails] 课时加载失败', err);
|
||||
});
|
||||
},
|
||||
|
||||
/** 点课时:向后端换一次性播放地址,视频本身不直接暴露。 */
|
||||
onTapLesson(e) {
|
||||
const item = this.data.playdata[e.currentTarget.dataset.index];
|
||||
if (!item) return;
|
||||
|
||||
wx.showLoading({ title: '加载中', mask: true });
|
||||
api
|
||||
.getPlayUrl(this.data.code, item.chapterId, item.playId)
|
||||
.then((res) => {
|
||||
wx.hideLoading();
|
||||
this.setData({ VideoPlayerSrc: res.url, HiddenVideoControl: false, top: 420 });
|
||||
})
|
||||
.catch((err) => {
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: err.message || '无法播放', icon: 'none' });
|
||||
});
|
||||
},
|
||||
|
||||
/** 购买:下单 → 拉起支付 → 轮询订单状态确认发货。 */
|
||||
buyNow() {
|
||||
if (this.data.buying) return;
|
||||
if (typeof wx.requestVirtualPayment !== 'function') {
|
||||
wx.showToast({ title: '当前微信版本不支持支付,请升级微信', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
this.setData({ buying: true });
|
||||
wx.showLoading({ title: '发起支付', mask: true });
|
||||
|
||||
api
|
||||
.createOrder(this.data.code)
|
||||
.then((order) => {
|
||||
wx.hideLoading();
|
||||
return api.requestVirtualPayment(order.payData).then(() => order.outTradeNo);
|
||||
})
|
||||
.then((outTradeNo) => this.waitForDelivery(outTradeNo))
|
||||
.catch((err) => {
|
||||
wx.hideLoading();
|
||||
this.setData({ buying: false });
|
||||
// 用户主动取消不算错误
|
||||
if (err && err.errMsg && err.errMsg.indexOf('cancel') >= 0) return;
|
||||
wx.showToast({ title: (err && err.message) || '支付失败', icon: 'none' });
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 支付成功后权益由服务端发货推送发放,存在秒级延迟,这里轮询确认。
|
||||
* 即便轮询全部超时也不会丢单:服务端有定时查单兜底。
|
||||
*/
|
||||
waitForDelivery(outTradeNo) {
|
||||
let attempts = 0;
|
||||
const poll = () => {
|
||||
attempts += 1;
|
||||
return api.getOrder(outTradeNo).then((order) => {
|
||||
if (order.status === 2) {
|
||||
this.setData({ buying: false, owned: true });
|
||||
wx.showToast({ title: '购买成功', icon: 'success', mask: true });
|
||||
this.load(this.data.code);
|
||||
return;
|
||||
}
|
||||
if (attempts >= POLL_MAX || order.status === 3 || order.status === 4) {
|
||||
this.setData({ buying: false });
|
||||
wx.showToast({ title: '支付已提交,开通可能稍有延迟', icon: 'none', duration: 3000 });
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL)).then(poll);
|
||||
});
|
||||
};
|
||||
return poll();
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return { title: '叶雷讲数学', path: '/pages/index/index' };
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<!--pages/VideoDetails/VideoDetails.wxml-->
|
||||
|
||||
<!-- 已拥有:正常播放 -->
|
||||
<block wx:if="{{owned}}">
|
||||
<video hidden="{{HiddenVideoControl}}" class="videoplayer" src="{{VideoPlayerSrc}}" />
|
||||
<scroll-view class="scrollarea" scroll-y type="list" style="top:{{top}}rpx;">
|
||||
<view class="jieshao">
|
||||
<text decode class="video_biaoti"> {{VideoTitle}}</text>
|
||||
<text decode class="video_miaoshu"> {{VideoDetails}}</text>
|
||||
<text decode class="video_info"> 已更新{{playdata.length}}期</text>
|
||||
</view>
|
||||
|
||||
<view class="videolistcontainer" bind:tap="onTapLesson"
|
||||
wx:for="{{playdata}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-index="{{index}}">
|
||||
<view class="videoimage">
|
||||
<image class="coverimage" src="{{item.coverUrl}}" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="videoinfo">
|
||||
<text class="videotitle">{{item.chapterTitle}}</text>
|
||||
<text class="videodetails">{{item.lessonTitle}}</text>
|
||||
<view class="videoinfo2">
|
||||
<text class="videodata">{{item.publishedAt}}</text>
|
||||
<text class="videotime">{{item.duration}}min</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</block>
|
||||
|
||||
<!-- 未拥有:展示介绍与购买入口 -->
|
||||
<block wx:else>
|
||||
<scroll-view class="scrollarea" scroll-y type="list">
|
||||
<view class="jieshao">
|
||||
<text decode class="video_biaoti"> {{VideoTitle}}</text>
|
||||
<text decode class="video_miaoshu"> {{VideoDetails}}</text>
|
||||
</view>
|
||||
|
||||
<view style="padding: 0 40rpx;">
|
||||
<image style="width: 100%; border-radius: 16rpx;" src="{{coverUrl}}" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
<view class="fixed-btn-wrapper">
|
||||
<view class="btn-group">
|
||||
<button class="DianJiXiangQing1" bind:tap="buyNow" disabled="{{buying}}">
|
||||
<text class="DianJiXiangQing2">{{buying ? '处理中…' : '立即购买 ¥' + priceYuan}}</text>
|
||||
</button>
|
||||
<button class="DianJiXiangQing1" open-type="contact">
|
||||
<text class="DianJiXiangQing2">咨询客服</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</block>
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
.videoplayer {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 420rpx;
|
||||
width: 750rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
.scrollarea {
|
||||
position: relative;
|
||||
top: 420rpx;
|
||||
flex: 1;
|
||||
overflow-y: hidden;
|
||||
|
||||
}
|
||||
|
||||
.jieshao {
|
||||
margin-bottom: 10rpx;
|
||||
/* box-shadow: 0 4rpx 4rpx rgba(150, 150, 150, 0.5); */
|
||||
position: relative;
|
||||
height: 200rpx;
|
||||
}
|
||||
.video_biaoti {
|
||||
text-align: center;
|
||||
display: block;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.video_miaoshu {
|
||||
text-align: center;
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.video_info {
|
||||
position:absolute;
|
||||
bottom: 10rpx;
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
right: 30rpx;
|
||||
}
|
||||
.video_list_content {
|
||||
margin: 10rpx 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.videolistcontainer {
|
||||
border-radius: 20rpx;
|
||||
margin: 10rpx 10rpx;
|
||||
box-shadow: 0 0 4rpx rgba(0, 0, 0, 0.5);
|
||||
width: 730rpx;
|
||||
height: 200rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.videoimage {
|
||||
width: 320rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-left: 10rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 5rpx 10rpx rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.videoinfo{
|
||||
position: relative;
|
||||
width: 390rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.videotitle {
|
||||
text-align: left;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.videodetails {
|
||||
display: block;
|
||||
margin: 10rpx 0rpx;
|
||||
font-size: 25rpx;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.videoinfo2 {
|
||||
position:absolute;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content:left;
|
||||
}
|
||||
.videodata {
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.videotime {
|
||||
font-size: 20rpx;
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
.coverimage {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// pages/VideoDetailsPage/VideoDetailsPage.js
|
||||
const htmlSnip =
|
||||
`<p>
|
||||
在初中数学的考试当中,解所有题型都需要用到公式,公式的重要性不言而喻!为了更好的帮助孩子们记住初中数学常用的公式、定理,在此老师给大家总结了初中三年所有的公式及定理!这份资料十分珍贵,每次考试都能用的上!
|
||||
</p>
|
||||
<p>
|
||||
<img src="https://api.yeomai.site/WebPages/2/1.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/2.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/3.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/4.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/5.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/6.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/7.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/8.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/9.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/10.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/11.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/12.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/13.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/14.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/15.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/16.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/17.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/18.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/19.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/20.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/21.jpg"/>
|
||||
</p>
|
||||
<p>
|
||||
<br/>
|
||||
</p>
|
||||
`
|
||||
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
htmlSnip,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
},
|
||||
//允许分享到朋友圈
|
||||
onShareTimeline(){
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"Parser":"/Parser/index"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<text>VideoDetailsPage</text>
|
||||
<text>富文本测试</text>
|
||||
<Parser html="{{htmlSnip}}" />
|
||||
@@ -0,0 +1,7 @@
|
||||
/* pages/VideoDetailsPage/VideoDetailsPage.wxss */
|
||||
text {
|
||||
/* display:inherit; */
|
||||
left: 400rpx;
|
||||
top: 100 px;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// pages/WebPageDetails/WebPageDetails.js
|
||||
const api = require('../../utils/api');
|
||||
const format = require('../../utils/format');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
htmlcontent: ' ',
|
||||
author: '',
|
||||
title: '',
|
||||
date: '',
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const id = options.id;
|
||||
if (!id) return;
|
||||
|
||||
api
|
||||
.getArticle(id)
|
||||
.then((article) => {
|
||||
if (!article) return;
|
||||
this.setData({
|
||||
htmlcontent: article.content || ' ',
|
||||
author: article.publisher || '',
|
||||
title: article.title || '',
|
||||
date: format.toDateString(article.publishedAt),
|
||||
});
|
||||
})
|
||||
.catch((err) => console.error('[WebPageDetails] 加载失败', err));
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return { title: '叶雷讲数学', path: '/pages/index/index' };
|
||||
},
|
||||
|
||||
onShareTimeline() {
|
||||
return { title: '叶雷讲数学' };
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"Parser":"/Parser/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<scroll-view class="scrollarea" scroll-y type="list">
|
||||
<text class="pagetitle">{{title}}</text>
|
||||
|
||||
<view class="pageauthoranddate">
|
||||
<text class="pageauthor">{{author}}</text>
|
||||
<text class="pagedate">{{date}}</text>
|
||||
</view>
|
||||
|
||||
<Parser html="{{htmlcontent}}" />
|
||||
|
||||
|
||||
</scroll-view>
|
||||
@@ -0,0 +1,63 @@
|
||||
/**index.wxss**/
|
||||
page {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.scrollarea {
|
||||
flex: 1;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.pagetitle {
|
||||
display: block;
|
||||
font-size: 40rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.pagecontent {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
text-align: left;
|
||||
text-indent: 0rem;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.pagecontent:first-child {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.pageimg {
|
||||
width: 100%;
|
||||
}
|
||||
.pagevideo {
|
||||
width: 750rpx;
|
||||
height: 421rpx;
|
||||
}
|
||||
.pageauthor {
|
||||
color: rgb(165, 165, 165);
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.pagedate {
|
||||
color: rgb(151, 151, 151);
|
||||
padding-left: 60rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.pageauthoranddate {
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.sharebtn[plain] {
|
||||
display: inline;
|
||||
color: cadetblue;
|
||||
border:none;
|
||||
font-size: 30rpx;
|
||||
margin:0 rpx;
|
||||
margin-left: 20rpx;
|
||||
margin-right: 0rpx;
|
||||
padding:0 ;
|
||||
width: 120rpx;
|
||||
}
|
||||
.content123 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
// pages/index/index.js
|
||||
const api = require('../../utils/api');
|
||||
const store = require('../../utils/store');
|
||||
const config = require('../../config/index');
|
||||
|
||||
const app = getApp();
|
||||
const updateManager = wx.getUpdateManager();
|
||||
|
||||
const PAGE_SIZE = 10;
|
||||
|
||||
Page({
|
||||
data: {
|
||||
staticBase: config.STATIC_BASE_URL,
|
||||
banners: [],
|
||||
courseList: [],
|
||||
freeCourseList: [],
|
||||
articles: [],
|
||||
page: 1,
|
||||
articleTotal: 0,
|
||||
loadingMore: false,
|
||||
noMore: false,
|
||||
title1: '',
|
||||
title2: '',
|
||||
title3: '',
|
||||
footerText: '',
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
// 等应用初始化完成再取配置,避免首屏读到空缓存
|
||||
app.ready().then(() => this.applyConfig());
|
||||
this.loadAll();
|
||||
},
|
||||
|
||||
applyConfig() {
|
||||
this.setData({
|
||||
title1: store.cfg('home.title.paid', '付费课程'),
|
||||
title2: store.cfg('home.title.trial', '试听课程'),
|
||||
title3: store.cfg('home.title.public', '公开课程'),
|
||||
footerText: store.cfg('home.footer_text', '我是有底线的!'),
|
||||
});
|
||||
},
|
||||
|
||||
loadAll() {
|
||||
this.setData({ page: 1, noMore: false });
|
||||
|
||||
api
|
||||
.getBanners()
|
||||
.then((list) => this.setData({ banners: list || [] }))
|
||||
.catch((err) => console.error('[index] 轮播加载失败', err));
|
||||
|
||||
api
|
||||
.getHomeCourses()
|
||||
.then((list) => this.setData({ courseList: list || [] }))
|
||||
.catch((err) => console.error('[index] 新课加载失败', err));
|
||||
|
||||
api
|
||||
.getHomeFreeCourses()
|
||||
.then((list) => this.setData({ freeCourseList: list || [] }))
|
||||
.catch((err) => console.error('[index] 试听列表加载失败', err));
|
||||
|
||||
api
|
||||
.getArticles(1, PAGE_SIZE)
|
||||
.then((res) => this.setData({ articles: res.items || [], articleTotal: res.total || 0, page: 1 }))
|
||||
.catch((err) => console.error('[index] 文章加载失败', err));
|
||||
},
|
||||
|
||||
onShow() {
|
||||
updateManager.onCheckForUpdate(() => {});
|
||||
updateManager.onUpdateReady(() => {
|
||||
wx.showModal({
|
||||
title: '更新提示',
|
||||
showCancel: false,
|
||||
content: '新版本已准备好,即将重启应用',
|
||||
success: (res) => {
|
||||
if (res.confirm) updateManager.applyUpdate();
|
||||
},
|
||||
});
|
||||
});
|
||||
updateManager.onUpdateFailed(() => {});
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
Promise.all([this.reload()]).then(() => wx.stopPullDownRefresh());
|
||||
},
|
||||
|
||||
async reload() {
|
||||
try {
|
||||
const cfg = await api.getConfig();
|
||||
store.setSiteConfig(cfg);
|
||||
this.applyConfig();
|
||||
} catch (err) {
|
||||
console.warn('[index] 配置刷新失败', err);
|
||||
}
|
||||
this.loadAll();
|
||||
},
|
||||
|
||||
onReachBottom() {
|
||||
if (this.data.loadingMore || this.data.noMore) return;
|
||||
const next = this.data.page + 1;
|
||||
this.setData({ loadingMore: true });
|
||||
|
||||
api
|
||||
.getArticles(next, PAGE_SIZE)
|
||||
.then((res) => {
|
||||
const merged = this.data.articles.concat(res.items || []);
|
||||
this.setData({
|
||||
articles: merged,
|
||||
page: next,
|
||||
loadingMore: false,
|
||||
noMore: merged.length >= (res.total || 0),
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('[index] 加载更多失败', err);
|
||||
this.setData({ loadingMore: false });
|
||||
});
|
||||
},
|
||||
|
||||
toArticle(e) {
|
||||
wx.navigateTo({ url: '/pages/WebPageDetails/WebPageDetails?id=' + e.currentTarget.dataset.id });
|
||||
},
|
||||
|
||||
toNewCourse(e) {
|
||||
wx.navigateTo({ url: '/pages/IndexNewCourseDetails/IndexNewCourseDetails?id=' + e.currentTarget.dataset.id });
|
||||
},
|
||||
|
||||
toFreeCourse(e) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/IndexFreeCourseDetails/IndexFreeCourseDetails?seriesNo=' + e.currentTarget.dataset.series,
|
||||
});
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return { title: '叶雷讲数学', path: '/pages/index/index' };
|
||||
},
|
||||
|
||||
onShareTimeline() {
|
||||
return { title: '叶雷讲数学' };
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-loading": "@vant/weapp/loading/index"
|
||||
},
|
||||
"onReachBottomDistance":50,
|
||||
"enablePullDownRefresh":true
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<!--index.wxml-->
|
||||
|
||||
<scroll-view class="container" scroll-y enable-flex type="custom">
|
||||
<view class="banner">
|
||||
<swiper class="bannerswiper" autoplay interval="20000" circular indicator-dots indicator-color="rgba(255, 255, 255, .3)" indicator-active-color="rgba(255, 255, 255, 1.0)" indicator-type="normal" duration="1000" easing-function="easeOutCubic">
|
||||
<swiper-item wx:for="{{banners}}" wx:for-item="item" wx:key="id" class="bannerswiperitem">
|
||||
<image class="indeximage" src="{{item.imageUrl}}" mode="aspectFill" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<!-- 新课上线 -->
|
||||
<view class="shouyetupianlist">
|
||||
<view wx:if="{{courseList.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{staticBase}}/Images/Icon/xinke.png" mode="aspectFill" />
|
||||
<text decode> {{title1}}</text>
|
||||
</view>
|
||||
<view class="shouyetupianlistcontent" wx:for="{{courseList}}" wx:for-item="item" wx:for-index="index" wx:key="id" data-id="{{item.id}}" bind:tap="toNewCourse">
|
||||
<view class="hengxianglist">
|
||||
<image class="indeximagelist" src="{{item.coverUrl}}" mode="aspectFill" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 自我学习 -->
|
||||
<view class="shouyetupianlist">
|
||||
<view wx:if="{{freeCourseList.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{staticBase}}/Images/Icon/ziwoxuexi.png" mode="aspectFill" />
|
||||
<text decode> {{title2}}</text>
|
||||
</view>
|
||||
<view class="shouyetupianlistcontent" wx:for="{{freeCourseList}}" wx:for-item="item" wx:for-index="index" wx:key="id" data-series="{{item.seriesNo}}" bind:tap="toFreeCourse">
|
||||
<view class="hengxianglist">
|
||||
<image class="indeximagelist" src="{{item.coverUrl}}" mode="aspectFill" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 知识速通 -->
|
||||
<view class="shouyetupianlist">
|
||||
<view wx:if="{{articles.length > 0}}" class="biaoti01">
|
||||
<image class="biaoti01img" src="{{staticBase}}/Images/Icon/sutong.png" mode="aspectFill" />
|
||||
<text decode> {{title3}}</text>
|
||||
</view>
|
||||
|
||||
<view class="shouyetupianlistcontent01" wx:for="{{articles}}" wx:for-item="item" wx:for-index="index" wx:key="id" bind:tap="toArticle" data-id="{{item.id}}">
|
||||
<view class="hengxianglist01">
|
||||
<image class="indeximagelist01" src="{{item.thumbUrl}}" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="indeximagelistmiaosu">{{item.title}}</view>
|
||||
<view class="indeximagelistmiaosu01">
|
||||
<text class="indeximagelistmiaosu0102">{{item.intro}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: auto; margin: 0px auto; margin-bottom: 10px;">
|
||||
<text wx:if="{{noMore}}">{{footerText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/**index.wxss**/
|
||||
/* 暂时未用到
|
||||
page {
|
||||
|
||||
} */
|
||||
|
||||
|
||||
.container {
|
||||
padding:0;
|
||||
align-items:center;
|
||||
flex-direction:column;
|
||||
justify-content:space-between;
|
||||
}
|
||||
.mulucontainer {
|
||||
width: 710rpx;
|
||||
height: 150rpx;
|
||||
white-space: nowrap; /*强制子元素为一行 */
|
||||
margin-left: 25rpx;
|
||||
}
|
||||
.navpage001 {
|
||||
display: inline-block;
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
margin-right: 25rpx;
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
.navpage001img {
|
||||
margin:0 auto;
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
}
|
||||
.mulucontainer .navpage001:last-child{
|
||||
margin-right: 0;
|
||||
}
|
||||
.banner{
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.shouyetupianlist {
|
||||
display: flex;
|
||||
flex-wrap: wrap;/* 允许内容换行 */
|
||||
justify-content:space-between;/* 水平方向上两端对齐 */
|
||||
}
|
||||
.shouyetupianlistcontent {
|
||||
/* display: inline; */
|
||||
padding: 0;
|
||||
margin: 20rpx;
|
||||
height: 204rpx;
|
||||
width: 334rpx; /* 每行两个图片,设置宽度为 48% 可以有一定的间距 */
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.shouyetupianlistcontent01 {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
margin: 20rpx;
|
||||
height: 260rpx;
|
||||
width: 730rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.indeximagelist {
|
||||
width: 100%;
|
||||
height: 204rpx;
|
||||
}
|
||||
.indeximagelist01 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tupianwenzi {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.biaoti01 {
|
||||
display: flex;
|
||||
width: 750rpx;
|
||||
height: 60rpx;
|
||||
align-items: center;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
.biaoti01img {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
.hengxianglist01 {
|
||||
display: flex;
|
||||
width: 300rpx;
|
||||
height: inherit; /* 推荐尺寸在300*250rpx 即150*125px */
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.indeximage{
|
||||
border-radius: 20rpx;
|
||||
height: 350rpx;
|
||||
width: 710rpx;
|
||||
transform: translate(20rpx, 30rpx);
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.bannerswiper {
|
||||
height: 390rpx;
|
||||
}
|
||||
.indeximagelistmiaosu {
|
||||
font-size: 28rpx;
|
||||
display:flex;
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
left: 300rpx;
|
||||
height: 70rpx;
|
||||
align-items: center;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
.indeximagelistmiaosu01 {
|
||||
display: inline;
|
||||
position: absolute;
|
||||
left: 300rpx;
|
||||
top: 35px;
|
||||
align-items: center;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
.indeximagelistmiaosu0102 {
|
||||
font-size: 20rpx;
|
||||
position: relative;
|
||||
top: -15px;
|
||||
width: 370rpx;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// pages/kecheng/kecheng.js
|
||||
const api = require('../../utils/api');
|
||||
const store = require('../../utils/store');
|
||||
const config = require('../../config/index');
|
||||
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
staticBase: config.STATIC_BASE_URL,
|
||||
hasCourse: false,
|
||||
ownedCourses: [],
|
||||
otherCourses: [],
|
||||
tipsHtml: '',
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
// 旧版本用 10ms 轮询最多 5 秒等登录数据,这里改为等初始化完成
|
||||
app.ready().then(() => this.refresh());
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if (store.isLoggedIn()) this.refresh();
|
||||
},
|
||||
|
||||
refresh() {
|
||||
this.loadTips();
|
||||
|
||||
api
|
||||
.getEntitlements()
|
||||
.then((list) => {
|
||||
store.setEntitlements(list);
|
||||
this.setData({ ownedCourses: list || [], hasCourse: (list || []).length > 0 });
|
||||
})
|
||||
.catch((err) => console.warn('[kecheng] 已购课程加载失败', err));
|
||||
|
||||
api
|
||||
.getCourses()
|
||||
.then((list) => {
|
||||
this.setData({ otherCourses: (list || []).filter((c) => !c.owned) });
|
||||
})
|
||||
.catch((err) => console.warn('[kecheng] 课程列表加载失败', err));
|
||||
},
|
||||
|
||||
loadTips() {
|
||||
if (this.data.tipsHtml) return;
|
||||
api
|
||||
.getTips()
|
||||
.then((tip) => this.setData({ tipsHtml: (tip && tip.content) || ' ' }))
|
||||
.catch((err) => console.warn('[kecheng] 文案加载失败', err));
|
||||
},
|
||||
|
||||
toMyCourse(e) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/VideoDetails/VideoDetails?code=' + e.currentTarget.dataset.code,
|
||||
});
|
||||
},
|
||||
|
||||
toStoreCourse(e) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/VideoDetails/VideoDetails?code=' + e.currentTarget.dataset.code,
|
||||
});
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return { title: '叶雷讲数学', path: '/pages/index/index' };
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"Parser":"/Parser/index"
|
||||
},
|
||||
"navigationBarTitleText": "知识"
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<scroll-view class="container" scroll-y enable-flex type="custom">
|
||||
<block wx:if="{{!hasCourse}}">
|
||||
<view style="width: 100%;height: 400rpx;">
|
||||
<image style="margin-top: 30rpx; margin-left: 20rpx; height: 350rpx; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); width: 710rpx; border-radius: 20rpx; background-color: rgb(0, 255, 255);"
|
||||
src="{{staticBase}}/Images/Banner/BGbanner.png" mode="aspectFill" />
|
||||
</view>
|
||||
<Parser html="{{tipsHtml}}" />
|
||||
</block>
|
||||
|
||||
<block wx:if="{{hasCourse}}">
|
||||
<view wx:for="{{ownedCourses}}" wx:for-item="item" wx:for-index="index" wx:key="courseId"
|
||||
class="kecheng" bind:tap="toMyCourse" data-code="{{item.code}}">
|
||||
<view class="kecheng_video_up">
|
||||
<image class="kecheng_img" src="{{item.coverUrl}}" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="kecheng_video_right">
|
||||
<text class="kecheng_title">{{item.title}}</text>
|
||||
<text class="kecheng_details">{{item.intro}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block wx:if="{{otherCourses.length > 0}}">
|
||||
<view wx:for="{{otherCourses}}" wx:for-item="item" wx:for-index="index" wx:key="code"
|
||||
class="kecheng" bind:tap="toStoreCourse" data-code="{{item.code}}">
|
||||
<view class="kecheng_video_up">
|
||||
<image class="kecheng_img" src="{{item.coverUrl}}" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="kecheng_video_right">
|
||||
<text class="kecheng_title">{{item.title}}</text>
|
||||
<text class="kecheng_details">{{item.intro}}</text>
|
||||
</view>
|
||||
<text style="position: absolute; right: 24rpx; bottom: 24rpx; font-size: 24rpx; color: #ff6b00;">未开通</text>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/* pages/kecheng/kecheng.wxss */
|
||||
.container {
|
||||
padding:0;
|
||||
align-items:center;
|
||||
flex-direction:column;
|
||||
justify-content:space-between;
|
||||
}
|
||||
.kecheng {
|
||||
width: 710rpx;
|
||||
height: 275rpx;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
align-items: center;
|
||||
margin: 6px 0;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
|
||||
.kecheng_video_up {
|
||||
width: 400rpx;
|
||||
height: 225rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.kecheng_video_right {
|
||||
margin-left: 5rpx;
|
||||
width: 290rpx;
|
||||
height: 225rpx;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
.kecheng_img {
|
||||
background-color: #15457b;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
.kecheng_title {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.kecheng_details {
|
||||
display: block;
|
||||
font-size: 25rpx;
|
||||
margin-top: 15rpx;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// pages/wode/wode.js
|
||||
const api = require('../../utils/api');
|
||||
const store = require('../../utils/store');
|
||||
const config = require('../../config/index');
|
||||
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
showCode: false,
|
||||
headiconUrl: '',
|
||||
isLoggedIn: false,
|
||||
userNameText: '未登录',
|
||||
loginBtnText: '登录注册',
|
||||
version: '',
|
||||
qrcodeUrl: '',
|
||||
text2: '',
|
||||
text3: '',
|
||||
text4: '',
|
||||
text5: '',
|
||||
text6: '',
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
app.ready().then(() => {
|
||||
this.applyConfig();
|
||||
this.applyUser();
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if (store.getSiteConfig() && Object.keys(store.getSiteConfig()).length) this.applyConfig();
|
||||
this.applyUser();
|
||||
},
|
||||
|
||||
applyConfig() {
|
||||
const qrcodeName = store.cfg('profile.qrcode_image', '');
|
||||
this.setData({
|
||||
version: store.cfg('site.version', 'V0.0.9'),
|
||||
text2: store.cfg('profile.menu.change_info', '修改资料'),
|
||||
text3: store.cfg('profile.menu.share', '好友分享'),
|
||||
text4: store.cfg('profile.menu.contact', '在线沟通'),
|
||||
text5: store.cfg('profile.menu.wechat', '添加微信:叶雷讲数学'),
|
||||
text6: store.cfg('profile.qrcode_caption', '长按识别二维码'),
|
||||
qrcodeUrl: qrcodeName ? config.STATIC_BASE_URL + '/Images/WXCode/' + qrcodeName + '.png' : '',
|
||||
});
|
||||
},
|
||||
|
||||
applyUser() {
|
||||
const user = store.getUser();
|
||||
// 已登录 = 有 token 且设置过昵称;未设置昵称的仍是游客,与旧版语义一致
|
||||
const registered = !!(user && user.nickname);
|
||||
this.setData({
|
||||
isLoggedIn: registered,
|
||||
userNameText: registered ? user.nickname : '未登录',
|
||||
loginBtnText: registered ? '退出登录' : '登录注册',
|
||||
headiconUrl: user && user.headiconUrl ? user.headiconUrl : config.STATIC_BASE_URL + config.PLACEHOLDER.USER,
|
||||
});
|
||||
},
|
||||
|
||||
toLoginOrOut() {
|
||||
wx.navigateTo({ url: '/pages/LoginOrOutDetails/LoginOrOutDetails' });
|
||||
},
|
||||
|
||||
toChangeUserInfo() {
|
||||
if (!this.data.isLoggedIn) {
|
||||
wx.showToast({ mask: true, icon: 'error', title: '请先登录' });
|
||||
return;
|
||||
}
|
||||
wx.navigateTo({ url: '/pages/ChangeUserInfo/ChangeUserInfo' });
|
||||
},
|
||||
|
||||
showQrcode() {
|
||||
this.setData({ showCode: true });
|
||||
},
|
||||
|
||||
onCodeClose() {
|
||||
this.setData({ showCode: false });
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return { title: '叶雷讲数学', path: '/pages/index/index' };
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-image": "@vant/weapp/image/index"
|
||||
},
|
||||
"navigationBarTitleText": "个人中心"
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<!--pages/wode/wode.wxml-->
|
||||
<van-popup show="{{ showCode }}" bind:close="onCodeClose">
|
||||
<view class="code-container">
|
||||
<text class="tip-text">{{text6}}</text>
|
||||
<van-image
|
||||
show-menu-by-longpress="true"
|
||||
use-loading-slot
|
||||
use-error-slot
|
||||
width="600rpx"
|
||||
height="816rpx"
|
||||
src="{{qrcodeUrl}}"
|
||||
/>
|
||||
<van-loading slot="loading" type="spinner" size="20" vertical />
|
||||
</view>
|
||||
</van-popup>
|
||||
|
||||
<scroll-view class="container" scroll-y enable-flex type="custom">
|
||||
<view class="login">
|
||||
<view class="touxiangimg">
|
||||
<image class="loginuserimg" src="{{headiconUrl}}" mode="aspectFill" />
|
||||
</view>
|
||||
|
||||
<view class="userinfo_name">
|
||||
<text>{{userNameText}}</text>
|
||||
<button class="loginbtn" bindtap="toLoginOrOut" plain>{{loginBtnText}}</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button wx:if="{{isLoggedIn}}" class="functions2" bind:tap="toChangeUserInfo">
|
||||
<text class="zuobianwenzi">{{text2}}</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
<button class="functions2" open-type="share">
|
||||
<text class="zuobianwenzi">{{text3}}</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
<button class="functions2" open-type="contact">
|
||||
<text class="zuobianwenzi">{{text4}}</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
<button class="functions2" bind:tap="showQrcode">
|
||||
<text class="zuobianwenzi">{{text5}}</text>
|
||||
<text class="jiantou"> > </text>
|
||||
</button>
|
||||
|
||||
<view class="version">
|
||||
<text style="display: block;">Version {{version}}</text>
|
||||
<text style="font-size: 20rpx;display: block;">Copyright<text style="font-size: 15rpx;position: relative;top: -10rpx;right: 0rpx;">©</text> 2026 YelayMaths. All Rights Reserved.</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/* pages/wode/wode.wxss */
|
||||
.container {
|
||||
padding:0;
|
||||
align-items:center;
|
||||
flex-direction:column;
|
||||
justify-content:space-between;
|
||||
}
|
||||
.code-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center; /* 水平居中 */
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: rgb(0, 201, 77);
|
||||
}
|
||||
|
||||
/* 文字样式:可选加粗、颜色、间距等 */
|
||||
.tip-text {
|
||||
font-size: 34rpx;
|
||||
color: #ffffff;
|
||||
margin-bottom: 20rpx; /* 与图片保持间距 */
|
||||
text-align: center; /* 冗余保险,虽然 flex 已居中 */
|
||||
}
|
||||
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
/* border: 3rpx solid rgb(110, 110, 110); */
|
||||
width: 710rpx;
|
||||
height: 150rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 20rpx;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.touxiangimg {
|
||||
display: flex;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
.userinfo_name {
|
||||
width: 500rpx;
|
||||
height: 150rpx;
|
||||
margin-left: 30rpx;
|
||||
border-radius: 75rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.loginbtn {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
.loginbtn[plain] {
|
||||
color: #353535;
|
||||
background-color: transparent;
|
||||
border: 0px solid #353535;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
padding: 0rpx 20rpx;
|
||||
}
|
||||
.loginuserimg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.functions1 {
|
||||
border: 3rpx solid rgb(110, 110, 110);
|
||||
width: 670rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
padding: 20rpx;
|
||||
}
|
||||
.functions2 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
/* border: 3rpx solid rgb(110, 110, 110); */
|
||||
background-color: white;
|
||||
width: 710rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 8rpx 20rpx;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.jiantou {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
.zuobianwenzi {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.function001 {
|
||||
height: 150rpx;
|
||||
width: 75rpx;
|
||||
|
||||
padding: 10rpx 47rpx;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
.functionimg001 {
|
||||
width: 75rpx;
|
||||
height: 75rpx;
|
||||
}
|
||||
|
||||
.functionimg002 {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
.functiontext001 {
|
||||
font-size: 25rpx;
|
||||
}
|
||||
.functionstools {
|
||||
position: relative;
|
||||
top: 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
.version {
|
||||
position: fixed;
|
||||
bottom: 10rpx;
|
||||
color: rgb(197, 197, 197);
|
||||
font-size: 25rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.7.12",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"enhance": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"packNpmManually": true,
|
||||
"packNpmRelationList": [
|
||||
{
|
||||
"packageJsonPath": "./package.json",
|
||||
"miniprogramNpmDistDir": "./"
|
||||
}
|
||||
],
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"compileWorklet": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"minifyWXSS": true,
|
||||
"minifyWXML": true,
|
||||
"localPlugins": false,
|
||||
"disableUseStrict": false,
|
||||
"useCompilerPlugins": false,
|
||||
"condition": false,
|
||||
"swc": false,
|
||||
"disableSWC": true
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "auto",
|
||||
"tabSize": 2
|
||||
},
|
||||
"appid": "wx3fbaf897825bf04f",
|
||||
"simulatorPluginLibVersion": {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||
"rules": [{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* 统一请求层与接口封装。
|
||||
*
|
||||
* 替代旧版本「每个接口手写一遍 wx.request + Promise」的写法。
|
||||
* 职责:
|
||||
* - 自动附带 Authorization
|
||||
* - 统一解包 { code, message, data, requestId }
|
||||
* - token 失效自动刷新,刷新失败自动重新登录
|
||||
*/
|
||||
|
||||
const config = require('../config/index');
|
||||
const store = require('./store');
|
||||
|
||||
/** 进行中的刷新,避免并发 401 触发多次刷新 */
|
||||
let refreshing = null;
|
||||
|
||||
function staticUrl(path) {
|
||||
if (!path) return '';
|
||||
if (/^https?:\/\//i.test(path)) return path;
|
||||
return config.STATIC_BASE_URL.replace(/\/+$/, '') + '/' + String(path).replace(/^\/+/, '');
|
||||
}
|
||||
|
||||
function normalizeError(body, statusCode) {
|
||||
if (body && typeof body.code === 'number') {
|
||||
return { code: body.code, message: body.message || '请求失败', requestId: body.requestId };
|
||||
}
|
||||
return { code: -1, message: '服务异常(' + statusCode + ')' };
|
||||
}
|
||||
|
||||
/** 底层请求。不做鉴权重试,返回完整响应体。 */
|
||||
function rawRequest(options) {
|
||||
const header = { 'content-type': 'application/json' };
|
||||
if (options.auth !== false) {
|
||||
const token = store.getToken();
|
||||
if (token) header.Authorization = 'Bearer ' + token;
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
url: config.API_BASE_URL.replace(/\/+$/, '') + options.url,
|
||||
method: options.method || 'GET',
|
||||
data: options.data,
|
||||
header,
|
||||
timeout: config.TIMEOUT,
|
||||
success(res) {
|
||||
resolve({ statusCode: res.statusCode, body: res.data || {} });
|
||||
},
|
||||
fail() {
|
||||
reject({ code: -1, message: '网络异常,请检查网络后重试' });
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** 带鉴权的请求。token 失效时刷新一次并重试。 */
|
||||
function request(options) {
|
||||
return rawRequest(options).then(({ statusCode, body }) => {
|
||||
if (body.code === 0) return body.data;
|
||||
|
||||
const needLogin = statusCode === 401 || body.code === 2000 || body.code === 2001;
|
||||
if (needLogin && options.auth !== false && options.retried !== true) {
|
||||
return refreshAccessToken()
|
||||
.then(() => request(Object.assign({}, options, { retried: true })))
|
||||
.catch(() => {
|
||||
store.reset();
|
||||
throw { code: 2000, message: '登录已过期,请重新进入小程序' };
|
||||
});
|
||||
}
|
||||
|
||||
throw normalizeError(body, statusCode);
|
||||
});
|
||||
}
|
||||
|
||||
function refreshAccessToken() {
|
||||
if (refreshing) return refreshing;
|
||||
const refreshToken = store.getRefreshToken();
|
||||
if (!refreshToken) return Promise.reject({ code: 2000, message: '未登录' });
|
||||
|
||||
refreshing = rawRequest({
|
||||
url: '/v1/auth/refresh',
|
||||
method: 'POST',
|
||||
data: { refreshToken },
|
||||
auth: false,
|
||||
})
|
||||
.then(({ body }) => {
|
||||
if (body.code !== 0) throw { code: 2000, message: '登录已过期' };
|
||||
store.setTokens(body.data.accessToken);
|
||||
return body.data.accessToken;
|
||||
})
|
||||
.finally(() => {
|
||||
refreshing = null;
|
||||
});
|
||||
|
||||
return refreshing;
|
||||
}
|
||||
|
||||
// ── 登录 ──────────────────────────────────────────────────────────────────
|
||||
|
||||
/** wx.login 换 code,再用 code 换服务端 token。 */
|
||||
function login() {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.login({
|
||||
success(res) {
|
||||
if (!res.code) {
|
||||
reject({ code: 3002, message: '微信登录失败,请重试' });
|
||||
return;
|
||||
}
|
||||
request({
|
||||
url: '/v1/auth/wx-login',
|
||||
method: 'POST',
|
||||
data: { code: res.code },
|
||||
auth: false,
|
||||
})
|
||||
.then((data) => {
|
||||
store.setTokens(data.accessToken, data.refreshToken);
|
||||
store.setUser(data.user);
|
||||
resolve(data);
|
||||
})
|
||||
.catch(reject);
|
||||
},
|
||||
fail() {
|
||||
reject({ code: 3002, message: '微信登录失败,请重试' });
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function logout() {
|
||||
return request({ url: '/v1/auth/logout', method: 'POST' }).catch(() => null).then(() => {
|
||||
store.reset();
|
||||
});
|
||||
}
|
||||
|
||||
// ── 首页内容 ──────────────────────────────────────────────────────────────
|
||||
|
||||
const api = {
|
||||
staticUrl,
|
||||
login,
|
||||
logout,
|
||||
|
||||
getConfig: () => request({ url: '/v1/config', auth: false }),
|
||||
getBanners: () => request({ url: '/v1/banners', auth: false }),
|
||||
getHomeCourses: () => request({ url: '/v1/home/courses', auth: false }),
|
||||
getHomeFreeCourses: () => request({ url: '/v1/home/free-courses', auth: false }),
|
||||
getArticles: (page, pageSize) =>
|
||||
request({ url: '/v1/articles?page=' + (page || 1) + '&pageSize=' + (pageSize || 10), auth: false }),
|
||||
getArticle: (id) => request({ url: '/v1/articles/' + id, auth: false }),
|
||||
getTips: () => request({ url: '/v1/tips', auth: false }),
|
||||
|
||||
// ── 课程 ────────────────────────────────────────────────────────────
|
||||
getCourses: () => request({ url: '/v1/courses' }),
|
||||
getCourse: (code) => request({ url: '/v1/courses/' + code }),
|
||||
getLessons: (code) => request({ url: '/v1/courses/' + code + '/lessons' }),
|
||||
getPlayUrl: (code, chapterId, playId) =>
|
||||
request({
|
||||
url:
|
||||
'/v1/courses/' +
|
||||
code +
|
||||
'/play?chapterId=' +
|
||||
encodeURIComponent(chapterId) +
|
||||
'&playId=' +
|
||||
encodeURIComponent(playId),
|
||||
}),
|
||||
getFreeLessons: (seriesNo) =>
|
||||
request({ url: '/v1/free-lessons' + (seriesNo === undefined ? '' : '?seriesNo=' + seriesNo), auth: false }),
|
||||
|
||||
// ── 用户 ────────────────────────────────────────────────────────────
|
||||
getMe: () => request({ url: '/v1/me' }),
|
||||
updateMe: (payload) => request({ url: '/v1/me', method: 'PATCH', data: payload }),
|
||||
getEntitlements: () => request({ url: '/v1/me/entitlements' }),
|
||||
|
||||
// ── 订单与支付 ──────────────────────────────────────────────────────
|
||||
createOrder: (courseCode) =>
|
||||
request({ url: '/v1/orders', method: 'POST', data: { courseCode: courseCode } }),
|
||||
getOrder: (outTradeNo) => request({ url: '/v1/orders/' + outTradeNo }),
|
||||
};
|
||||
|
||||
/**
|
||||
* 拉起虚拟支付。
|
||||
*
|
||||
* 支付成功只代表「钱付了」,权益由服务端收到发货推送后发放,
|
||||
* 因此这里不直接开通课程,而是让调用方轮询订单状态。
|
||||
*/
|
||||
function requestVirtualPayment(payData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.requestVirtualPayment({
|
||||
signData: payData.signData,
|
||||
mode: payData.mode,
|
||||
paySig: payData.paySig,
|
||||
signature: payData.signature,
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = Object.assign(api, { requestVirtualPayment });
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/** 展示用格式化。 */
|
||||
|
||||
function pad(n) {
|
||||
return n < 10 ? '0' + n : String(n);
|
||||
}
|
||||
|
||||
/** ISO 字符串 → YYYY-MM-DD */
|
||||
function toDateString(value) {
|
||||
if (!value) return '';
|
||||
const d = new Date(value);
|
||||
if (isNaN(d.getTime())) return '';
|
||||
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate());
|
||||
}
|
||||
|
||||
/** 分 → 元(保留两位,去掉多余的 .00) */
|
||||
function fenToYuan(fen) {
|
||||
const n = Number(fen);
|
||||
if (!isFinite(n)) return '0';
|
||||
const yuan = n / 100;
|
||||
return yuan % 1 === 0 ? String(yuan) : yuan.toFixed(2);
|
||||
}
|
||||
|
||||
module.exports = { toDateString, fenToYuan };
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* 极简全局状态。
|
||||
*
|
||||
* 替代旧版本在各页面直接读写 wx.getStorageSync 的做法:
|
||||
* 统一从内存读、同步落盘,页面只与这里交互。
|
||||
*/
|
||||
|
||||
const config = require('../config/index');
|
||||
|
||||
const memory = {
|
||||
user: null,
|
||||
siteConfig: null,
|
||||
entitlements: [],
|
||||
};
|
||||
|
||||
const listeners = new Set();
|
||||
|
||||
function notify() {
|
||||
listeners.forEach((fn) => {
|
||||
try {
|
||||
fn();
|
||||
} catch (e) {
|
||||
console.error('[store] 监听器执行失败', e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function read(key, fallback) {
|
||||
try {
|
||||
const v = wx.getStorageSync(key);
|
||||
return v === '' || v === undefined || v === null ? fallback : v;
|
||||
} catch (e) {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
const store = {
|
||||
// ── token ────────────────────────────────────────────────────────────
|
||||
getToken: () => read(config.STORAGE.TOKEN, ''),
|
||||
getRefreshToken: () => read(config.STORAGE.REFRESH_TOKEN, ''),
|
||||
|
||||
setTokens(accessToken, refreshToken) {
|
||||
wx.setStorageSync(config.STORAGE.TOKEN, accessToken);
|
||||
if (refreshToken) wx.setStorageSync(config.STORAGE.REFRESH_TOKEN, refreshToken);
|
||||
},
|
||||
|
||||
clearTokens() {
|
||||
wx.removeStorageSync(config.STORAGE.TOKEN);
|
||||
wx.removeStorageSync(config.STORAGE.REFRESH_TOKEN);
|
||||
},
|
||||
|
||||
isLoggedIn: () => !!read(config.STORAGE.TOKEN, ''),
|
||||
|
||||
// ── 用户 ─────────────────────────────────────────────────────────────
|
||||
getUser() {
|
||||
if (memory.user) return memory.user;
|
||||
memory.user = read(config.STORAGE.USER, null);
|
||||
return memory.user;
|
||||
},
|
||||
|
||||
setUser(user) {
|
||||
memory.user = user;
|
||||
wx.setStorageSync(config.STORAGE.USER, user);
|
||||
notify();
|
||||
},
|
||||
|
||||
// ── 站点配置 ─────────────────────────────────────────────────────────
|
||||
getSiteConfig() {
|
||||
if (memory.siteConfig) return memory.siteConfig;
|
||||
memory.siteConfig = read(config.STORAGE.CONFIG, {});
|
||||
return memory.siteConfig;
|
||||
},
|
||||
|
||||
setSiteConfig(cfg) {
|
||||
memory.siteConfig = cfg || {};
|
||||
wx.setStorageSync(config.STORAGE.CONFIG, memory.siteConfig);
|
||||
notify();
|
||||
},
|
||||
|
||||
/** 取配置项,带兜底值,避免配置缺失时页面直接崩掉。 */
|
||||
cfg(key, fallback) {
|
||||
const value = store.getSiteConfig()[key];
|
||||
return value === undefined || value === '' ? (fallback === undefined ? '' : fallback) : value;
|
||||
},
|
||||
|
||||
// ── 已购课程 ─────────────────────────────────────────────────────────
|
||||
getEntitlements() {
|
||||
if (memory.entitlements && memory.entitlements.length) return memory.entitlements;
|
||||
memory.entitlements = read(config.STORAGE.ENTITLEMENTS, []) || [];
|
||||
return memory.entitlements;
|
||||
},
|
||||
|
||||
setEntitlements(list) {
|
||||
memory.entitlements = list || [];
|
||||
wx.setStorageSync(config.STORAGE.ENTITLEMENTS, memory.entitlements);
|
||||
notify();
|
||||
},
|
||||
|
||||
hasCourse(code) {
|
||||
return store.getEntitlements().some((item) => item.code === code);
|
||||
},
|
||||
|
||||
// ── 订阅与清理 ───────────────────────────────────────────────────────
|
||||
subscribe(fn) {
|
||||
listeners.add(fn);
|
||||
return () => listeners.delete(fn);
|
||||
},
|
||||
|
||||
reset() {
|
||||
memory.user = null;
|
||||
memory.siteConfig = null;
|
||||
memory.entitlements = [];
|
||||
store.clearTokens();
|
||||
wx.removeStorageSync(config.STORAGE.USER);
|
||||
wx.removeStorageSync(config.STORAGE.ENTITLEMENTS);
|
||||
notify();
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = store;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
const formatTime = timestamp => {
|
||||
const date = new Date(timestamp);
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
const hour = date.getHours()
|
||||
const minute = date.getMinutes()
|
||||
const second = date.getSeconds()
|
||||
|
||||
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
|
||||
}
|
||||
|
||||
const formatNumber = n => {
|
||||
n = n.toString()
|
||||
return n[1] ? n : `0${n}`
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
# 服务端 API 地址
|
||||
NEXT_PUBLIC_API_BASE_URL="https://yelaymaths-api.yeomai.site"
|
||||
@@ -0,0 +1 @@
|
||||
zyCUiWlckOogSq2NJ0g1K
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"pages": {
|
||||
"/_not-found/page": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/chunks/app/_not-found/page-3a19bd448c737fab.js"
|
||||
],
|
||||
"/layout": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/css/288c6d98e0f16504.css",
|
||||
"static/chunks/app/layout-56c10f3c2e636e3d.js"
|
||||
],
|
||||
"/login/page": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/chunks/app/login/page-25e80207b9a6b8e3.js"
|
||||
],
|
||||
"/(admin)/layout": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/chunks/app/(admin)/layout-e013a799f6422b7c.js"
|
||||
],
|
||||
"/(admin)/settings/page": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/chunks/app/(admin)/settings/page-56f9fafa3a8b5c68.js"
|
||||
],
|
||||
"/(admin)/[resource]/page": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/chunks/app/(admin)/[resource]/page-11eaa5a84ee2c65d.js"
|
||||
],
|
||||
"/(admin)/users/page": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/chunks/app/(admin)/users/page-a644f17c93131d05.js"
|
||||
],
|
||||
"/(admin)/orders/page": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/chunks/app/(admin)/orders/page-d9f848f64d9de826.js"
|
||||
],
|
||||
"/(admin)/page": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js",
|
||||
"static/chunks/app/(admin)/page-1515adc761c8c449.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"/_not-found/page": "/_not-found",
|
||||
"/login/page": "/login",
|
||||
"/(admin)/settings/page": "/settings",
|
||||
"/(admin)/[resource]/page": "/[resource]",
|
||||
"/(admin)/users/page": "/users",
|
||||
"/(admin)/orders/page": "/orders",
|
||||
"/(admin)/page": "/"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"polyfillFiles": [
|
||||
"static/chunks/polyfills-42372ed130431b0a.js"
|
||||
],
|
||||
"devFiles": [],
|
||||
"ampDevFiles": [],
|
||||
"lowPriorityFiles": [
|
||||
"static/zyCUiWlckOogSq2NJ0g1K/_buildManifest.js",
|
||||
"static/zyCUiWlckOogSq2NJ0g1K/_ssgManifest.js"
|
||||
],
|
||||
"rootMainFiles": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/602a57ae-ac477c2757cb0862.js",
|
||||
"static/chunks/857-fa8a30735eba58c8.js",
|
||||
"static/chunks/main-app-dc507bc0873917ed.js"
|
||||
],
|
||||
"rootMainFilesTree": {},
|
||||
"pages": {
|
||||
"/_app": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/framework-ee6678c0f79578b9.js",
|
||||
"static/chunks/main-aa39fb296f299038.js",
|
||||
"static/chunks/pages/_app-22e72e9e1e26d302.js"
|
||||
],
|
||||
"/_error": [
|
||||
"static/chunks/webpack-bcbae60858e02af9.js",
|
||||
"static/chunks/framework-ee6678c0f79578b9.js",
|
||||
"static/chunks/main-aa39fb296f299038.js",
|
||||
"static/chunks/pages/_error-ede5b6fe7b50e31c.js"
|
||||
]
|
||||
},
|
||||
"ampFirstPages": []
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"previewModeId":"aea58ebb36cd8bde25282e320f79dd91","previewModeSigningKey":"21237b83cac9668fb72c91e3a1fbd15d64e2311b891864de84a781340fc8c099","previewModeEncryptionKey":"2b8e282decf7503f07dc5e00db157235c2a7b843fb409578ce6febd372140de5","expireAt":1791874368859}
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"encryption.key":"E98NfDv5OUscL1+m1ouRmRxpcp3igcgLKZbwj3LGCBA=","encryption.expire_at":1791874368811}
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"fileNames":["../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescriLine truncated
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"buildStage": "static-generation",
|
||||
"buildOptions": {
|
||||
"useBuildWorker": "true"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"Next.js","version":"15.5.26"}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 1,
|
||||
"hasExportPathMap": false,
|
||||
"exportTrailingSlash": false,
|
||||
"isNextImageImported": false
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"version": 1,
|
||||
"images": {
|
||||
"deviceSizes": [
|
||||
640,
|
||||
750,
|
||||
828,
|
||||
1080,
|
||||
1200,
|
||||
1920,
|
||||
2048,
|
||||
3840
|
||||
],
|
||||
"imageSizes": [
|
||||
16,
|
||||
32,
|
||||
48,
|
||||
64,
|
||||
96,
|
||||
128,
|
||||
256,
|
||||
384
|
||||
],
|
||||
"path": "/_next/image",
|
||||
"loader": "default",
|
||||
"loaderFile": "",
|
||||
"domains": [],
|
||||
"disableStaticImages": false,
|
||||
"minimumCacheTTL": 60,
|
||||
"formats": [
|
||||
"image/webp"
|
||||
],
|
||||
"maximumResponseBody": 50000000,
|
||||
"dangerouslyAllowSVG": false,
|
||||
"contentSecurityPolicy": "script-src 'none'; frame-src 'none'; sandbox;",
|
||||
"contentDispositionType": "attachment",
|
||||
"remotePatterns": [],
|
||||
"unoptimized": false,
|
||||
"sizes": [
|
||||
640,
|
||||
750,
|
||||
828,
|
||||
1080,
|
||||
1200,
|
||||
1920,
|
||||
2048,
|
||||
3840,
|
||||
16,
|
||||
32,
|
||||
48,
|
||||
64,
|
||||
96,
|
||||
128,
|
||||
256,
|
||||
384
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":1,"files":["../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/_/_interop_require_default/package.json","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/package.json","../node_modules/.pnpm/client-only@0.0.1/node_modules/client-only/index.js","../node_modules/.pnpm/client-only@0.0.1/node_modules/client-only/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@swc/helpers","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/components/app-router-headers.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/babel-code-frame/index.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/babel-code-frame/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/babel/code-frame.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/babel/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/bytes/index.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/bytes/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/next-server/server.runtime.prod.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/source-map/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/source-map/source-map.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/stacktrace-parser/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/stacktrace-parser/stack-trace-parser.cjs.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/ws/index.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/ws/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/experimental/testmode/context.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/experimental/testmode/fetch.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/experimental/testmode/server-edge.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/lib/client-and-server-references.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/lib/constants.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/lib/interop-default.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/lib/is-error.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/lib/picocolors.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/next-devtools/server/shared.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/server/after/builtin-request-context.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/server/app-render/after-task-async-storLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"version":1,"files":["../node_modules/.pnpm/@img+colour@1.1.0/node_modules/@img/colour/color.cjs","../node_modules/.pnpm/@img+colour@1.1.0/node_modules/@img/colour/index.cjs","../node_modules/.pnpm/@img+colour@1.1.0/node_modules/@img/colour/package.json","../node_modules/.pnpm/@img+sharp-darwin-arm64@0.35.5/node_modules/@img/sharp-darwin-arm64/index.cjs","../node_modules/.pnpm/@img+sharp-darwin-arm64@0.35.5/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64-0.35.5.node","../node_modules/.pnpm/@img+sharp-darwin-arm64@0.35.5/node_modules/@img/sharp-darwin-arm64/package.json","../node_modules/.pnpm/@img+sharp-darwin-arm64@0.35.5/node_modules/@img/sharp-libvips-darwin-arm64","../node_modules/.pnpm/@img+sharp-libvips-darwin-arm64@1.3.4/node_modules/@img/sharp-libvips-darwin-arm64/lib/libvips-cpp.8.18.7.dylib","../node_modules/.pnpm/@img+sharp-libvips-darwin-arm64@1.3.4/node_modules/@img/sharp-libvips-darwin-arm64/package.json","../node_modules/.pnpm/@next+env@15.5.26/node_modules/@next/env/dist/index.js","../node_modules/.pnpm/@next+env@15.5.26/node_modules/@next/env/package.json","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/_/_class_private_field_loose_base/package.json","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/_/_class_private_field_loose_key/package.json","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/_/_interop_require_default/package.json","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/_/_interop_require_wildcard/package.json","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/cjs/_class_private_field_loose_base.cjs","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/cjs/_class_private_field_loose_key.cjs","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs","../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/package.json","../node_modules/.pnpm/client-only@0.0.1/node_modules/client-only/index.js","../node_modules/.pnpm/client-only@0.0.1/node_modules/client-only/package.json","../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/detect-libc.js","../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/elf.js","../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/filesystem.js","../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/lib/process.js","../node_modules/.pnpm/detect-libc@2.1.2/node_modules/detect-libc/package.json","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@next/env","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@swc/helpers","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/build/output/log.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/add-base-path.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/app-build-id.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/app-call-server.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/app-find-source-map-url.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/assign-location.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/components/app-router-announcer.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/components/app-router-headers.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/components/app-router-instance.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/components/app-router.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/components/bailout-to-client-rendering.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/components/builtin/default.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/client/components/builtin/global-error.js","../node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@1Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
{"type": "commonjs"}
|
||||
@@ -0,0 +1,157 @@
|
||||
{
|
||||
"version": 4,
|
||||
"routes": {
|
||||
"/_not-found": {
|
||||
"initialStatus": 404,
|
||||
"experimentalBypassFor": [
|
||||
{
|
||||
"type": "header",
|
||||
"key": "next-action"
|
||||
},
|
||||
{
|
||||
"type": "header",
|
||||
"key": "content-type",
|
||||
"value": "multipart/form-data;.*"
|
||||
}
|
||||
],
|
||||
"initialRevalidateSeconds": false,
|
||||
"srcRoute": "/_not-found",
|
||||
"dataRoute": "/_not-found.rsc",
|
||||
"allowHeader": [
|
||||
"host",
|
||||
"x-matched-path",
|
||||
"x-prerender-revalidate",
|
||||
"x-prerender-revalidate-if-generated",
|
||||
"x-next-revalidated-tags",
|
||||
"x-next-revalidate-tag-token"
|
||||
]
|
||||
},
|
||||
"/": {
|
||||
"experimentalBypassFor": [
|
||||
{
|
||||
"type": "header",
|
||||
"key": "next-action"
|
||||
},
|
||||
{
|
||||
"type": "header",
|
||||
"key": "content-type",
|
||||
"value": "multipart/form-data;.*"
|
||||
}
|
||||
],
|
||||
"initialRevalidateSeconds": false,
|
||||
"srcRoute": "/",
|
||||
"dataRoute": "/index.rsc",
|
||||
"allowHeader": [
|
||||
"host",
|
||||
"x-matched-path",
|
||||
"x-prerender-revalidate",
|
||||
"x-prerender-revalidate-if-generated",
|
||||
"x-next-revalidated-tags",
|
||||
"x-next-revalidate-tag-token"
|
||||
]
|
||||
},
|
||||
"/orders": {
|
||||
"experimentalBypassFor": [
|
||||
{
|
||||
"type": "header",
|
||||
"key": "next-action"
|
||||
},
|
||||
{
|
||||
"type": "header",
|
||||
"key": "content-type",
|
||||
"value": "multipart/form-data;.*"
|
||||
}
|
||||
],
|
||||
"initialRevalidateSeconds": false,
|
||||
"srcRoute": "/orders",
|
||||
"dataRoute": "/orders.rsc",
|
||||
"allowHeader": [
|
||||
"host",
|
||||
"x-matched-path",
|
||||
"x-prerender-revalidate",
|
||||
"x-prerender-revalidate-if-generated",
|
||||
"x-next-revalidated-tags",
|
||||
"x-next-revalidate-tag-token"
|
||||
]
|
||||
},
|
||||
"/users": {
|
||||
"experimentalBypassFor": [
|
||||
{
|
||||
"type": "header",
|
||||
"key": "next-action"
|
||||
},
|
||||
{
|
||||
"type": "header",
|
||||
"key": "content-type",
|
||||
"value": "multipart/form-data;.*"
|
||||
}
|
||||
],
|
||||
"initialRevalidateSeconds": false,
|
||||
"srcRoute": "/users",
|
||||
"dataRoute": "/users.rsc",
|
||||
"allowHeader": [
|
||||
"host",
|
||||
"x-matched-path",
|
||||
"x-prerender-revalidate",
|
||||
"x-prerender-revalidate-if-generated",
|
||||
"x-next-revalidated-tags",
|
||||
"x-next-revalidate-tag-token"
|
||||
]
|
||||
},
|
||||
"/settings": {
|
||||
"experimentalBypassFor": [
|
||||
{
|
||||
"type": "header",
|
||||
"key": "next-action"
|
||||
},
|
||||
{
|
||||
"type": "header",
|
||||
"key": "content-type",
|
||||
"value": "multipart/form-data;.*"
|
||||
}
|
||||
],
|
||||
"initialRevalidateSeconds": false,
|
||||
"srcRoute": "/settings",
|
||||
"dataRoute": "/settings.rsc",
|
||||
"allowHeader": [
|
||||
"host",
|
||||
"x-matched-path",
|
||||
"x-prerender-revalidate",
|
||||
"x-prerender-revalidate-if-generated",
|
||||
"x-next-revalidated-tags",
|
||||
"x-next-revalidate-tag-token"
|
||||
]
|
||||
},
|
||||
"/login": {
|
||||
"experimentalBypassFor": [
|
||||
{
|
||||
"type": "header",
|
||||
"key": "next-action"
|
||||
},
|
||||
{
|
||||
"type": "header",
|
||||
"key": "content-type",
|
||||
"value": "multipart/form-data;.*"
|
||||
}
|
||||
],
|
||||
"initialRevalidateSeconds": false,
|
||||
"srcRoute": "/login",
|
||||
"dataRoute": "/login.rsc",
|
||||
"allowHeader": [
|
||||
"host",
|
||||
"x-matched-path",
|
||||
"x-prerender-revalidate",
|
||||
"x-prerender-revalidate-if-generated",
|
||||
"x-next-revalidated-tags",
|
||||
"x-next-revalidate-tag-token"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dynamicRoutes": {},
|
||||
"notFoundRoutes": [],
|
||||
"preview": {
|
||||
"previewModeId": "aea58ebb36cd8bde25282e320f79dd91",
|
||||
"previewModeSigningKey": "21237b83cac9668fb72c91e3a1fbd15d64e2311b891864de84a781340fc8c099",
|
||||
"previewModeEncryptionKey": "2b8e282decf7503f07dc5e00db157235c2a7b843fb409578ce6febd372140de5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,319 @@
|
||||
{
|
||||
"version": 1,
|
||||
"config": {
|
||||
"env": {},
|
||||
"webpack": null,
|
||||
"eslint": {
|
||||
"ignoreDuringBuilds": true
|
||||
},
|
||||
"typescript": {
|
||||
"ignoreBuildErrors": false,
|
||||
"tsconfigPath": "tsconfig.json"
|
||||
},
|
||||
"typedRoutes": false,
|
||||
"distDir": ".next",
|
||||
"cleanDistDir": true,
|
||||
"assetPrefix": "",
|
||||
"cacheMaxMemorySize": 52428800,
|
||||
"configOrigin": "next.config.ts",
|
||||
"useFileSystemPublicRoutes": true,
|
||||
"generateEtags": true,
|
||||
"pageExtensions": [
|
||||
"tsx",
|
||||
"ts",
|
||||
"jsx",
|
||||
"js"
|
||||
],
|
||||
"poweredByHeader": true,
|
||||
"compress": true,
|
||||
"images": {
|
||||
"deviceSizes": [
|
||||
640,
|
||||
750,
|
||||
828,
|
||||
1080,
|
||||
1200,
|
||||
1920,
|
||||
2048,
|
||||
3840
|
||||
],
|
||||
"imageSizes": [
|
||||
16,
|
||||
32,
|
||||
48,
|
||||
64,
|
||||
96,
|
||||
128,
|
||||
256,
|
||||
384
|
||||
],
|
||||
"path": "/_next/image",
|
||||
"loader": "default",
|
||||
"loaderFile": "",
|
||||
"domains": [],
|
||||
"disableStaticImages": false,
|
||||
"minimumCacheTTL": 60,
|
||||
"formats": [
|
||||
"image/webp"
|
||||
],
|
||||
"maximumResponseBody": 50000000,
|
||||
"dangerouslyAllowSVG": false,
|
||||
"contentSecurityPolicy": "script-src 'none'; frame-src 'none'; sandbox;",
|
||||
"contentDispositionType": "attachment",
|
||||
"remotePatterns": [],
|
||||
"unoptimized": false
|
||||
},
|
||||
"devIndicators": {
|
||||
"position": "bottom-left"
|
||||
},
|
||||
"onDemandEntries": {
|
||||
"maxInactiveAge": 60000,
|
||||
"pagesBufferLength": 5
|
||||
},
|
||||
"amp": {
|
||||
"canonicalBase": ""
|
||||
},
|
||||
"basePath": "",
|
||||
"sassOptions": {},
|
||||
"trailingSlash": false,
|
||||
"i18n": null,
|
||||
"productionBrowserSourceMaps": false,
|
||||
"excludeDefaultMomentLocales": true,
|
||||
"serverRuntimeConfig": {},
|
||||
"publicRuntimeConfig": {},
|
||||
"reactProductionProfiling": false,
|
||||
"reactStrictMode": true,
|
||||
"reactMaxHeadersLength": 6000,
|
||||
"httpAgentOptions": {
|
||||
"keepAlive": true
|
||||
},
|
||||
"logging": {},
|
||||
"compiler": {},
|
||||
"expireTime": 31536000,
|
||||
"staticPageGenerationTimeout": 60,
|
||||
"modularizeImports": {
|
||||
"@mui/icons-material": {
|
||||
"transform": "@mui/icons-material/{{member}}"
|
||||
},
|
||||
"lodash": {
|
||||
"transform": "lodash/{{member}}"
|
||||
}
|
||||
},
|
||||
"outputFileTracingRoot": "/Users/tianmokeji/Desktop/YelayMaths/yelaymaths_admin",
|
||||
"experimental": {
|
||||
"useSkewCookie": false,
|
||||
"cacheLife": {
|
||||
"default": {
|
||||
"stale": 300,
|
||||
"revalidate": 900,
|
||||
"expire": 4294967294
|
||||
},
|
||||
"seconds": {
|
||||
"stale": 30,
|
||||
"revalidate": 1,
|
||||
"expire": 60
|
||||
},
|
||||
"minutes": {
|
||||
"stale": 300,
|
||||
"revalidate": 60,
|
||||
"expire": 3600
|
||||
},
|
||||
"hours": {
|
||||
"stale": 300,
|
||||
"revalidate": 3600,
|
||||
"expire": 86400
|
||||
},
|
||||
"days": {
|
||||
"stale": 300,
|
||||
"revalidate": 86400,
|
||||
"expire": 604800
|
||||
},
|
||||
"weeks": {
|
||||
"stale": 300,
|
||||
"revalidate": 604800,
|
||||
"expire": 2592000
|
||||
},
|
||||
"max": {
|
||||
"stale": 300,
|
||||
"revalidate": 2592000,
|
||||
"expire": 4294967294
|
||||
}
|
||||
},
|
||||
"cacheHandlers": {},
|
||||
"cssChunking": true,
|
||||
"multiZoneDraftMode": false,
|
||||
"appNavFailHandling": false,
|
||||
"prerenderEarlyExit": true,
|
||||
"serverMinification": true,
|
||||
"serverSourceMaps": false,
|
||||
"linkNoTouchStart": false,
|
||||
"caseSensitiveRoutes": false,
|
||||
"clientSegmentCache": false,
|
||||
"clientParamParsing": false,
|
||||
"dynamicOnHover": false,
|
||||
"preloadEntriesOnStart": true,
|
||||
"clientRouterFilter": true,
|
||||
"clientRouterFilterRedirects": false,
|
||||
"fetchCacheKeyPrefix": "",
|
||||
"middlewarePrefetch": "flexible",
|
||||
"optimisticClientCache": true,
|
||||
"manualClientBasePath": false,
|
||||
"cpus": 9,
|
||||
"memoryBasedWorkersCount": false,
|
||||
"imgOptConcurrency": null,
|
||||
"imgOptTimeoutInSeconds": 7,
|
||||
"imgOptMaxInputPixels": 268402689,
|
||||
"imgOptSequentialRead": null,
|
||||
"isrFlushToDisk": true,
|
||||
"workerThreads": false,
|
||||
"optimizeCss": false,
|
||||
"nextScriptWorkers": false,
|
||||
"scrollRestoration": false,
|
||||
"externalDir": false,
|
||||
"disableOptimizedLoading": false,
|
||||
"gzipSize": true,
|
||||
"craCompat": false,
|
||||
"esmExternals": true,
|
||||
"fullySpecified": false,
|
||||
"swcTraceProfiling": false,
|
||||
"forceSwcTransforms": false,
|
||||
"largePageDataBytes": 128000,
|
||||
"typedEnv": false,
|
||||
"parallelServerCompiles": false,
|
||||
"parallelServerBuildTraces": false,
|
||||
"ppr": false,
|
||||
"authInterrupts": false,
|
||||
"webpackMemoryOptimizations": false,
|
||||
"optimizeServerReact": true,
|
||||
"viewTransition": false,
|
||||
"routerBFCache": false,
|
||||
"removeUncaughtErrorAndRejectionListeners": false,
|
||||
"validateRSCRequestHeaders": false,
|
||||
"staleTimes": {
|
||||
"dynamic": 0,
|
||||
"static": 300
|
||||
},
|
||||
"serverComponentsHmrCache": true,
|
||||
"staticGenerationMaxConcurrency": 8,
|
||||
"staticGenerationMinPagesPerWorker": 25,
|
||||
"cacheComponents": false,
|
||||
"inlineCss": false,
|
||||
"useCache": false,
|
||||
"globalNotFound": false,
|
||||
"devtoolSegmentExplorer": true,
|
||||
"browserDebugInfoInTerminal": false,
|
||||
"optimizeRouterScrolling": false,
|
||||
"middlewareClientMaxBodySize": 10485760,
|
||||
"optimizePackageImports": [
|
||||
"lucide-react",
|
||||
"date-fns",
|
||||
"lodash-es",
|
||||
"ramda",
|
||||
"antd",
|
||||
"react-bootstrap",
|
||||
"ahooks",
|
||||
"@ant-design/icons",
|
||||
"@headlessui/react",
|
||||
"@headlessui-float/react",
|
||||
"@heroicons/react/20/solid",
|
||||
"@heroicons/react/24/solid",
|
||||
"@heroicons/react/24/outline",
|
||||
"@visx/visx",
|
||||
"@tremor/react",
|
||||
"rxjs",
|
||||
"@mui/material",
|
||||
"@mui/icons-material",
|
||||
"recharts",
|
||||
"react-use",
|
||||
"effect",
|
||||
"@effect/schema",
|
||||
"@effect/platform",
|
||||
"@effect/platform-node",
|
||||
"@effect/platform-browser",
|
||||
"@effect/platform-bun",
|
||||
"@effect/sql",
|
||||
"@effect/sql-mssql",
|
||||
"@effect/sql-mysql2",
|
||||
"@effect/sql-pg",
|
||||
"@effect/sql-sqlite-node",
|
||||
"@effect/sql-sqlite-bun",
|
||||
"@effect/sql-sqlite-wasm",
|
||||
"@effect/sql-sqlite-react-native",
|
||||
"@effect/rpc",
|
||||
"@effect/rpc-http",
|
||||
"@effect/typeclass",
|
||||
"@effect/experimental",
|
||||
"@effect/opentelemetry",
|
||||
"@material-ui/core",
|
||||
"@material-ui/icons",
|
||||
"@tabler/icons-react",
|
||||
"mui-core",
|
||||
"react-icons/ai",
|
||||
"react-icons/bi",
|
||||
"react-icons/bs",
|
||||
"react-icons/cg",
|
||||
"react-icons/ci",
|
||||
"react-icons/di",
|
||||
"react-icons/fa",
|
||||
"react-icons/fa6",
|
||||
"react-icons/fc",
|
||||
"react-icons/fi",
|
||||
"react-icons/gi",
|
||||
"react-icons/go",
|
||||
"react-icons/gr",
|
||||
"react-icons/hi",
|
||||
"react-icons/hi2",
|
||||
"react-icons/im",
|
||||
"react-icons/io",
|
||||
"react-icons/io5",
|
||||
"react-icons/lia",
|
||||
"react-icons/lib",
|
||||
"react-icons/lu",
|
||||
"react-icons/md",
|
||||
"react-icons/pi",
|
||||
"react-icons/ri",
|
||||
"react-icons/rx",
|
||||
"react-icons/si",
|
||||
"react-icons/sl",
|
||||
"react-icons/tb",
|
||||
"react-icons/tfi",
|
||||
"react-icons/ti",
|
||||
"react-icons/vsc",
|
||||
"react-icons/wi"
|
||||
],
|
||||
"trustHostHeader": false,
|
||||
"isExperimentalCompile": false
|
||||
},
|
||||
"htmlLimitedBots": "[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight",
|
||||
"bundlePagesRouterDependencies": false,
|
||||
"configFileName": "next.config.ts",
|
||||
"turbopack": {
|
||||
"root": "/Users/tianmokeji/Desktop/YelayMaths/yelaymaths_admin"
|
||||
}
|
||||
},
|
||||
"appDir": "/Users/tianmokeji/Desktop/YelayMaths/yelaymaths_admin",
|
||||
"relativeAppDir": "",
|
||||
"files": [
|
||||
".next/routes-manifest.json",
|
||||
".next/server/pages-manifest.json",
|
||||
".next/build-manifest.json",
|
||||
".next/prerender-manifest.json",
|
||||
".next/server/functions-config-manifest.json",
|
||||
".next/server/middleware-manifest.json",
|
||||
".next/server/middleware-build-manifest.js",
|
||||
".next/server/middleware-react-loadable-manifest.js",
|
||||
".next/react-loadable-manifest.json",
|
||||
".next/server/app-paths-manifest.json",
|
||||
".next/app-path-routes-manifest.json",
|
||||
".next/app-build-manifest.json",
|
||||
".next/server/server-reference-manifest.js",
|
||||
".next/server/server-reference-manifest.json",
|
||||
".next/BUILD_ID",
|
||||
".next/server/next-font-manifest.js",
|
||||
".next/server/next-font-manifest.json",
|
||||
".next/required-server-files.json"
|
||||
],
|
||||
"ignore": [
|
||||
"node_modules/.pnpm/next@15.5.26_@types+node@22.20.4_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"version": 3,
|
||||
"pages404": true,
|
||||
"caseSensitive": false,
|
||||
"basePath": "",
|
||||
"redirects": [
|
||||
{
|
||||
"source": "/:path+/",
|
||||
"destination": "/:path+",
|
||||
"internal": true,
|
||||
"statusCode": 308,
|
||||
"regex": "^(?:/((?:[^/]+?)(?:/(?:[^/]+?))*))/$"
|
||||
}
|
||||
],
|
||||
"headers": [],
|
||||
"rewrites": {
|
||||
"beforeFiles": [],
|
||||
"afterFiles": [],
|
||||
"fallback": []
|
||||
},
|
||||
"dynamicRoutes": [
|
||||
{
|
||||
"page": "/[resource]",
|
||||
"regex": "^/([^/]+?)(?:/)?$",
|
||||
"routeKeys": {
|
||||
"nxtPresource": "nxtPresource"
|
||||
},
|
||||
"namedRegex": "^/(?<nxtPresource>[^/]+?)(?:/)?$"
|
||||
}
|
||||
],
|
||||
"staticRoutes": [
|
||||
{
|
||||
"page": "/",
|
||||
"regex": "^/(?:/)?$",
|
||||
"routeKeys": {},
|
||||
"namedRegex": "^/(?:/)?$"
|
||||
},
|
||||
{
|
||||
"page": "/_not-found",
|
||||
"regex": "^/_not\\-found(?:/)?$",
|
||||
"routeKeys": {},
|
||||
"namedRegex": "^/_not\\-found(?:/)?$"
|
||||
},
|
||||
{
|
||||
"page": "/login",
|
||||
"regex": "^/login(?:/)?$",
|
||||
"routeKeys": {},
|
||||
"namedRegex": "^/login(?:/)?$"
|
||||
},
|
||||
{
|
||||
"page": "/orders",
|
||||
"regex": "^/orders(?:/)?$",
|
||||
"routeKeys": {},
|
||||
"namedRegex": "^/orders(?:/)?$"
|
||||
},
|
||||
{
|
||||
"page": "/settings",
|
||||
"regex": "^/settings(?:/)?$",
|
||||
"routeKeys": {},
|
||||
"namedRegex": "^/settings(?:/)?$"
|
||||
},
|
||||
{
|
||||
"page": "/users",
|
||||
"regex": "^/users(?:/)?$",
|
||||
"routeKeys": {},
|
||||
"namedRegex": "^/users(?:/)?$"
|
||||
}
|
||||
],
|
||||
"dataRoutes": [],
|
||||
"rsc": {
|
||||
"header": "rsc",
|
||||
"varyHeader": "rsc, next-router-state-tree, next-router-prefetch, next-router-segment-prefetch",
|
||||
"prefetchHeader": "next-router-prefetch",
|
||||
"didPostponeHeader": "x-nextjs-postponed",
|
||||
"contentTypeHeader": "text/x-component",
|
||||
"suffix": ".rsc",
|
||||
"prefetchSuffix": ".prefetch.rsc",
|
||||
"prefetchSegmentHeader": "next-router-segment-prefetch",
|
||||
"prefetchSegmentSuffix": ".segment.rsc",
|
||||
"prefetchSegmentDirSuffix": ".segments"
|
||||
},
|
||||
"rewriteHeaders": {
|
||||
"pathHeader": "x-nextjs-rewritten-path",
|
||||
"queryHeader": "x-nextjs-rewritten-query"
|
||||
}
|
||||
}
|
||||
Loaded 100 of 276 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user