commit 3968e1a82c29b827e8c181f7db1d6bb97ee9aaec Author: 治安 吴 Date: Tue Nov 25 17:09:19 2025 +0800 Initial commit diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -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: {}, +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e885c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# Node 依赖 +node_modules/ + +# 小程序构建后的 npm 目录 +miniprogram_npm/ + +# 其他临时文件 +.DS_Store +.idea/ +.vscode/ +project.config.json +project.private.config.json diff --git a/app.js b/app.js new file mode 100644 index 0000000..e20ab3c --- /dev/null +++ b/app.js @@ -0,0 +1,20 @@ +// app.js +App({ + onLaunch() { + // 展示本地存储能力 + // const logs = wx.getStorageSync('logs') || [] + // logs.unshift(Date.now()) + // wx.setStorageSync('logs', logs) + + // // 登录 + // wx.login({ + // success: res => { + // // 发送 res.code 到后台换取 openId, sessionKey, unionId + // } + // }) + wx.setNavigationBarTitle ({title: ''}) + }, + globalData: { + userInfo: null + } +}) diff --git a/app.json b/app.json new file mode 100644 index 0000000..5973443 --- /dev/null +++ b/app.json @@ -0,0 +1,16 @@ +{ +"pages": [ + "pages/login/index" + ], + + "window": { + "backgroundColor": "#f1f1f1", + "backgroundTextStyle": "dark", + "navigationBarTitleText": "", + "navigationBarTextStyle": "black" + }, + "componentFramework": "glass-easel", + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents", + "usingComponents": { } +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..b28b04f --- /dev/null +++ b/app.wxss @@ -0,0 +1,3 @@ + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..d836a0d --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "T1DM", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..f4840e5 --- /dev/null +++ b/package.json @@ -0,0 +1,3 @@ +{ + "dependencies": { } +} diff --git a/pages/login/index.js b/pages/login/index.js new file mode 100644 index 0000000..cd80d28 --- /dev/null +++ b/pages/login/index.js @@ -0,0 +1,52 @@ +// pages/browser/index.js +Page({ + data: { + //h5Url: 'https://t1d.yixunpro.com/h5/', // 直接赋值真实链接,无需传参 + //pageTitle: 'H5 页面', + //isLoading: true + }, + + onLoad() { + wx.setNavigationBarTitle ({title: ''}) + // 无需接收 options,直接使用硬编码链接 + //console.log('加载 H5 链接:', this.data.h5Url); + }, + + // H5 页面加载完成 + handleWebLoad(e) { + this.setData({ isLoading: false }); + // 可选:同步 H5 页面标题(通过 web-view 加载完成的 url 解析,或 H5 主动发送消息) + //wx.setNavigationBarTitle({ title: 'H5 页面' }); // 也可固定标题或动态解析 + }, + + // H5 页面加载失败 + handleWebError(e) { + // this.setData({ isLoading: false }); + wx.showToast({ title: '页面加载失败', icon: 'none' }); + console.error('H5 加载失败:', e.detail); + }, + + // 返回上一页(H5 历史记录) + handleGoBack() { + // 创建 web-view 上下文,控制 H5 历史回退 + const webViewCtx = wx.createWebViewContext('web-view'); + webViewCtx.navigateBack({ + fail: () => { + // 若 H5 无历史记录,返回小程序上一页 + wx.navigateBack({ delta: 1 }); + } + }); + }, + + // 刷新 H5 页面 + handleRefresh() { + this.setData({ isLoading: true }); + // 通过添加时间戳强制刷新(避免缓存) + const timestamp = Date.now(); + const newUrl = this.data.h5Url.includes('?') + ? `${this.data.h5Url}&t=${timestamp}` + : `${this.data.h5Url}?t=${timestamp}`; + this.setData({ h5Url: newUrl }); + } + +}); \ No newline at end of file diff --git a/pages/login/index.json b/pages/login/index.json new file mode 100644 index 0000000..7893f7a --- /dev/null +++ b/pages/login/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom", + "navigationBarTitleText": "", + "disableScroll": true, + "navigationBarTextStyle": "black" +} \ No newline at end of file diff --git a/pages/login/index.wxml b/pages/login/index.wxml new file mode 100644 index 0000000..0049829 --- /dev/null +++ b/pages/login/index.wxml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/pages/login/index.wxss b/pages/login/index.wxss new file mode 100644 index 0000000..cda0829 --- /dev/null +++ b/pages/login/index.wxss @@ -0,0 +1,12 @@ +.container { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + overflow: hidden; +} +web-view { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..c85a0bc --- /dev/null +++ b/readme.md @@ -0,0 +1,12 @@ +common 公共文件 +components 组件文件 +helper 根据名称存放对应通用处理函数 +pages 存放具体业务UI相关文件 + bizs 业务代码 + components 具体业务提取的组件(对应业务层面) + mocks 模拟数据,对用业务创一个对应js文件,后续连接http接口时在对应的bizs中进行替换即可 + styles 具体业务对应的样式代码 +styles 公共样式代码 +tpls 模板脚本文件 +utils 工具类 + request.js 封装的http请求,后续后端api提供后将mock的数据替换 \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file