feat: 小程序连接服务器IP + 同步未提交开发
- miniprogram/config.js: BASE_URL 指向 http://192.227.237.8:3001 - 动作标题中文化(nameZh),搜索匹配 name/nameZh/nameEn - 新增计划/收藏/我的 等页面与组件 - 后端 Docker 化(Dockerfile/.dockerignore)与翻译脚本 - .gitignore 补充 .DS_Store
This commit is contained in:
@@ -3,23 +3,40 @@ const app = getApp();
|
||||
Component({
|
||||
properties: {
|
||||
title: { type: String, value: '' },
|
||||
showBack: { type: Boolean, value: false }
|
||||
showBack: { type: Boolean, value: false },
|
||||
// 拦截返回:为 true 时点击返回仅触发 bind:back 事件,由页面自行处理(如未保存草稿确认)
|
||||
interceptBack: { type: Boolean, value: false }
|
||||
},
|
||||
data: {
|
||||
statusBarHeight: 20
|
||||
statusBarHeight: 20,
|
||||
// 运行期根据页面栈动态决定:只有确实存在上一页时才显示返回键,
|
||||
// 避免在底部 tab 根页(页面栈深度 = 1)误显示返回键
|
||||
canBack: false
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
const h = (app.globalData && app.globalData.statusBarHeight) || 20;
|
||||
this.setData({ statusBarHeight: h });
|
||||
const pages = getCurrentPages();
|
||||
this.setData({
|
||||
statusBarHeight: h,
|
||||
canBack: pages.length > 1
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onBack() {
|
||||
const pages = getCurrentPages();
|
||||
|
||||
// 页面要求自行处理返回逻辑(典型场景:编辑页有未保存内容需确认)
|
||||
if (this.data.interceptBack) {
|
||||
this.triggerEvent('back');
|
||||
return;
|
||||
}
|
||||
|
||||
if (pages.length > 1) {
|
||||
wx.navigateBack();
|
||||
wx.navigateBack({ delta: 1 });
|
||||
} else {
|
||||
// 兜底:确实没有上一页时回到首页(正常 tab 根页不会显示返回键,此为保险)
|
||||
wx.reLaunch({ url: '/pages/index/index' });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user