From d204ffe6fab816bb0aff9f647bc91cc40f902ddb Mon Sep 17 00:00:00 2001 From: xlj <543978819@qq.com> Date: Sat, 20 Sep 2025 21:04:45 +0800 Subject: [PATCH] init --- .gitignore | 1 + app.js | 82 ++++++++++++++++++++++++++++++++++++++++++ app.json | 8 +++++ app.wxss | 14 ++++++++ pages/index/index.js | 7 ++++ pages/index/index.json | 3 ++ pages/index/index.wxml | 3 ++ pages/index/index.wxss | 38 ++++++++++++++++++++ project.config.json | 47 ++++++++++++++++++++++++ 9 files changed, 203 insertions(+) create mode 100644 .gitignore create mode 100644 app.js create mode 100644 app.json create mode 100644 app.wxss create mode 100644 pages/index/index.js create mode 100644 pages/index/index.json create mode 100644 pages/index/index.wxml create mode 100644 pages/index/index.wxss create mode 100644 project.config.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd038d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/CLAUDE.md diff --git a/app.js b/app.js new file mode 100644 index 0000000..a206f84 --- /dev/null +++ b/app.js @@ -0,0 +1,82 @@ + +App({ + // 应用启动时执行 + onLaunch: function() { + // 初始化环境设置 + this.initEnvironment(); + }, + + globalData: { + // 当前环境的WebURL,通过getWebUrl()动态获取 + webUrl: '', + // 当前环境标识 + currentEnv: 'RELEASE' + }, + + // 环境配置常量 + ENV_CONFIG: { + TEST: { + name: '测试环境', + url: 'http://192.168.110.201:7456/web-mobile/release/index.html' + }, + RELEASE: { + name: '正式环境', + url: 'https://xchat188.com/' //正式版URL + } + }, + + // 初始化环境设置 + initEnvironment: function() { + try { + // 从本地存储读取环境设置,默认为TEST + const savedEnv = 'RELEASE'; + this.globalData.currentEnv = savedEnv; + // 设置对应环境的URL + this.globalData.webUrl = this.ENV_CONFIG[savedEnv].url; + + console.log(`当前环境: ${this.ENV_CONFIG[savedEnv].name} - ${this.globalData.webUrl}`); + } catch (error) { + console.error('初始化环境失败:', error); + // 出错时使用默认TEST环境 + this.globalData.currentEnv = 'TEST'; + this.globalData.webUrl = this.ENV_CONFIG.TEST.url; + } + }, + + // 切换环境(调试用) + switchEnvironment: function(env) { + if (!this.ENV_CONFIG[env]) { + console.error('无效的环境:', env); + return false; + } + + try { + // 更新全局数据 + this.globalData.currentEnv = env; + this.globalData.webUrl = this.ENV_CONFIG[env].url; + + // 保存到本地存储 + wx.setStorageSync('APP_ENVIRONMENT', env); + + console.log(`环境已切换为: ${this.ENV_CONFIG[env].name} - ${this.globalData.webUrl}`); + return true; + } catch (error) { + console.error('切换环境失败:', error); + return false; + } + }, + + // 获取当前环境的WebURL + getWebUrl: function() { + return this.globalData.webUrl; + }, + + // 获取当前环境信息 + getCurrentEnv: function() { + return { + env: this.globalData.currentEnv, + name: this.ENV_CONFIG[this.globalData.currentEnv].name, + url: this.globalData.webUrl + }; + } +}) \ No newline at end of file diff --git a/app.json b/app.json new file mode 100644 index 0000000..0e7bd0a --- /dev/null +++ b/app.json @@ -0,0 +1,8 @@ +{ + "pages": [ + "pages/index/index" + ], + "window": { + "navigationBarTitleText": "AIphrodite" + } +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..d686b1e --- /dev/null +++ b/app.wxss @@ -0,0 +1,14 @@ +/* Global reset for full screen web-view */ +page { + margin: 0 !important; + padding: 0 !important; + box-sizing: border-box; + width: 100vw; + height: 100vh; + overflow: hidden; +} + +/* Ensure no system styling interferes */ +* { + box-sizing: border-box; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..29d03d4 --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,7 @@ +const app = getApp() + +Page({ + data: { + url: app.globalData.webUrl + } +}) diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..5cc3dfe --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,3 @@ +{ + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..c23943d --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,3 @@ + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..66aaeca --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,38 @@ +/* Remove all default margins and padding */ +page { + margin: 0; + padding: 0; + height: 100vh; + overflow: hidden; +} + +/* Full screen container that extends beyond safe area */ +.web-view-container { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + margin: 0; + padding: 0; + overflow: hidden; +} + +/* Web-view styling for absolute full screen coverage */ +web-view { + position: absolute; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + margin: 0; + padding: 0; + border: none; + outline: none; + + /* Force extension beyond safe area on iPhone 14 */ + margin-top: calc(-1 * env(safe-area-inset-top, 0px)); + margin-top: calc(-1 * constant(safe-area-inset-top, 0px)); + height: calc(100vh + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px)); + height: calc(100vh + constant(safe-area-inset-top, 0px) + constant(safe-area-inset-bottom, 0px)); +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..9c61f0c --- /dev/null +++ b/project.config.json @@ -0,0 +1,47 @@ +{ + "projectid": "mp0ygqvghc940ppb_AIphrodite", + "setting": { + "urlCheck": false, + "es6": true, + "postcss": true, + "minified": true, + "newFeature": true, + "autoAudits": false, + "nodeModules": true, + "uploadWithSourceMap": true, + "uglifyFileName": true, + "remoteDebugLogEnable": true, + "prefetch": false + }, + "LuffaToolsLibVersion": "2.2.7", + "compileType": "miniprogram", + "createTime": 1758263984023, + "accessTime": 1758263984023, + "packOptions": { + "ignore": [] + }, + "debugOptions": { + "hidedInDevtools": [] + }, + "LuffaToolsappid": "mp0ygqvghc940ppb", + "projectname": "AIphrodite", + "scripts": {}, + "condition": { + "search": { + "current": -1, + "list": [] + }, + "conversation": { + "current": -1, + "list": [] + }, + "game": { + "currentL": -1, + "list": [] + }, + "miniprogram": { + "current": -1, + "list": [] + } + } +} \ No newline at end of file