Initial commit
This commit is contained in:
commit
3968e1a82c
31
.eslintrc.js
Normal file
31
.eslintrc.js
Normal file
@ -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: {},
|
||||||
|
}
|
||||||
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Node 依赖
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# 小程序构建后的 npm 目录
|
||||||
|
miniprogram_npm/
|
||||||
|
|
||||||
|
# 其他临时文件
|
||||||
|
.DS_Store
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
project.config.json
|
||||||
|
project.private.config.json
|
||||||
20
app.js
Normal file
20
app.js
Normal file
@ -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
|
||||||
|
}
|
||||||
|
})
|
||||||
16
app.json
Normal file
16
app.json
Normal file
@ -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": { }
|
||||||
|
}
|
||||||
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "T1DM",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
3
package.json
Normal file
3
package.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"dependencies": { }
|
||||||
|
}
|
||||||
52
pages/login/index.js
Normal file
52
pages/login/index.js
Normal file
@ -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 });
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
7
pages/login/index.json
Normal file
7
pages/login/index.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"disableScroll": true,
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
}
|
||||||
4
pages/login/index.wxml
Normal file
4
pages/login/index.wxml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<view class="container">
|
||||||
|
<web-view src="https://t1d.yixunpro.com/h5/"
|
||||||
|
binderror="handleWebError"></web-view>
|
||||||
|
</view>
|
||||||
12
pages/login/index.wxss
Normal file
12
pages/login/index.wxss
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.container {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
web-view {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
12
readme.md
Normal file
12
readme.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
common 公共文件
|
||||||
|
components 组件文件
|
||||||
|
helper 根据名称存放对应通用处理函数
|
||||||
|
pages 存放具体业务UI相关文件
|
||||||
|
bizs 业务代码
|
||||||
|
components 具体业务提取的组件(对应业务层面)
|
||||||
|
mocks 模拟数据,对用业务创一个对应js文件,后续连接http接口时在对应的bizs中进行替换即可
|
||||||
|
styles 具体业务对应的样式代码
|
||||||
|
styles 公共样式代码
|
||||||
|
tpls 模板脚本文件
|
||||||
|
utils 工具类
|
||||||
|
request.js 封装的http请求,后续后端api提供后将mock的数据替换
|
||||||
7
sitemap.json
Normal file
7
sitemap.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||||
|
"rules": [{
|
||||||
|
"action": "allow",
|
||||||
|
"page": "*"
|
||||||
|
}]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user