init
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/CLAUDE.md
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "AIphrodite"
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
const app = getApp()
|
||||
|
||||
Page({
|
||||
data: {
|
||||
url: app.globalData.webUrl
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<view class="web-view-container">
|
||||
<web-view src="{{url}}"/>
|
||||
</view>
|
||||
@@ -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));
|
||||
}
|
||||
@@ -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": []
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user