活动报名静态界面

This commit is contained in:
WindowBird 2025-08-14 17:06:05 +08:00
parent 5349c734ca
commit eb56c0fb2f
8 changed files with 545 additions and 74 deletions

View File

@ -18,6 +18,6 @@ export const CommonEnum = {
Refresh: "https://api.ccttiot.com/image-1754377032112.png", //刷新
LotusMeditation: "https://api.ccttiot.com/image-1754377169541.png", //莲坐禅心
CENTER_TILES: "https://api.ccttiot.com/image-1754897751419.png", //腰部瓦片组
SUCCESS_APPOINTMENT: "https://api.ccttiot.com/image-1754897751419.png", //预约成功
SUCCESS_APPOINTMENT: "https://api.ccttiot.com/image-1755156093304.png", //预约成功
};
export default CommonEnum;

View File

@ -172,6 +172,41 @@
"style": {
"navigationStyle": "custom"
}
},
{
"path" : "pages/activity/application",
"style" :
{
"navigationStyle": "custom"
}
},
{
"path" : "pages/activity/appointmentSuccess",
"style" :
{
"navigationStyle": "custom"
}
},
{
"path" : "pages/activity/reservationVegetarianMeals",
"style" :
{
"navigationStyle": "custom"
}
},
{
"path" : "pages/activity/ReservationSuccess",
"style" :
{
"navigationStyle": "custom"
}
},
{
"path" : "pages/activity/myReservation",
"style" :
{
"navigationStyle": "custom"
}
}
],
"subPackages": [

View File

@ -0,0 +1,13 @@
<template>
<view class="">
</view>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,239 @@
<template>
<view class="page">
<base-background />
<!-- 使用自定义导航栏组件 -->
<custom-navbar ref="customNavbar" title="活动报名" />
<view :style="{ backgroundColor: CommonEnum.BASE_COLOR }" class="header">
<!-- 页面内容将在这里添加 -->
<text>选择活动日期</text>
<scroll-view class="scroll-view" scroll-x="true">
<view class="scroll-view-item_date">A</view>
<view class="scroll-view-item_date">B</view>
<view class="scroll-view-item_date">C</view>
</scroll-view>
<text>选择活动时段</text>
<scroll-view class="scroll-view" scroll-x="true">
<view class="scroll-view-item_time">A</view>
<view class="scroll-view-item_time">B</view>
<view class="scroll-view-item_time">C</view>
</scroll-view>
<text>参与活动人数</text>
<scroll-view class="scroll-view" scroll-x="true">
<view class="scroll-view-item_number">1</view>
<view class="scroll-view-item_number">2</view>
<view class="scroll-view-item_number">自定义</view>
</scroll-view>
</view>
<view class="contact">
<view class="contact-item">
<view class="info">姓名</view>
<input placeholder="请输入姓名" type="text" />
</view>
<view class="contact-item">
<view class="info">联系号码</view>
<input placeholder="填写手机号" type="text" />
</view>
</view>
<view class="submit">
<view class="submit-message">100</view>
<view class="submit-button">提交报名</view>
</view>
</view>
</template>
<script>
import { CommonEnum } from "@/enum/common.js";
import { MonkEnum } from "@/enum/monk.js";
import { getMonkList } from "@/api/monk/monk.js";
import SearchBox from "../../components/search-box/search-box.vue";
export default {
components: {
MonkSearchBox: SearchBox,
},
data() {
return {
bgc: {
backgroundColor: "#F5F0E7",
},
CommonEnum,
MonkEnum,
monkList: [],
searchName: "",
};
},
onLoad() {
this.fetchMonkList();
},
methods: {
async fetchMonkList() {
try {
const res = await getMonkList({ name: this.searchName });
if (res.code === 200 && Array.isArray(res.rows)) {
this.monkList = res.rows;
} else {
uni.showToast({
title: res.msg || "获取失败",
icon: "none",
});
}
} catch (e) {
uni.showToast({
title: "网络错误",
icon: "none",
});
}
},
// HTML
stripHtmlTags(html) {
if (!html) return ""; //
return html.replace(/<[^>]+>/g, ""); // HTML
},
},
};
</script>
<style lang="scss" scoped>
.page {
width: 100%;
display: flex;
align-items: center;
flex-direction: column;
.header {
width: 650rpx;
margin-top: 24rpx;
height: 726rpx;
display: flex;
align-items: flex-start;
flex-direction: column;
padding: 38rpx 50rpx 50rpx 50rpx;
background: #fffbf5;
border-radius: 20rpx 20rpx 20rpx 20rpx;
border: 2rpx solid #c7a26d;
margin-bottom: 40rpx;
.scroll-view {
display: flex;
justify-content: space-between;
white-space: nowrap;
width: 100%;
margin-bottom: 62rpx;
.scroll-view-item_date {
text-align: center;
line-height: 120rpx;
display: inline-block;
width: 162rpx;
height: 120rpx;
background: #fff1dd;
border-radius: 14rpx 14rpx 14rpx 14rpx;
margin-right: 32rpx;
font-weight: 700;
font-size: 28rpx;
color: #c7a26d;
}
.scroll-view-item_time {
text-align: center;
line-height: 120rpx;
display: inline-block;
width: 258rpx;
height: 120rpx;
background: #fff1dd;
border-radius: 14rpx 14rpx 14rpx 14rpx;
margin-right: 34rpx;
font-weight: 700;
font-size: 30rpx;
color: #c7a26d;
}
.scroll-view-item_number {
text-align: center;
line-height: 64rpx;
display: inline-block;
width: 170rpx;
height: 64rpx;
background: #fff1dd;
border-radius: 48rpx 48rpx 48rpx 48rpx;
border: 2rpx solid #c7a26d;
margin-right: 18rpx;
font-weight: 400;
font-size: 32rpx;
color: #c7a26d;
}
}
}
.contact {
width: 650rpx;
height: 232rpx;
background: #fffbf5;
border-radius: 20rpx 20rpx 20rpx 20rpx;
border: 2rpx solid #c7a26d;
padding: 0 50rpx 0 54rpx;
margin-bottom: 292rpx;
.contact-item {
width: 100%;
height: 116rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #d8d8d8;
.info {
font-weight: 400;
font-size: 32rpx;
color: #695347;
line-height: 44rpx;
text-align: center;
}
}
}
.submit {
width: 650rpx;
height: 92rpx;
background: #fffbf5;
border-radius: 57rpx 57rpx 57rpx 57rpx;
border: 2rpx solid #c7a26d;
display: flex;
justify-content: space-between;
align-items: center;
.submit-message {
font-weight: 500;
font-size: 28rpx;
color: #695347;
line-height: 38rpx;
margin-left: 62rpx;
}
.submit-button {
width: 224rpx;
height: 72rpx;
background: #a24242;
border-radius: 57rpx 57rpx 57rpx 57rpx;
font-weight: 500;
font-size: 28rpx;
color: #ffffff;
line-height: 72rpx;
text-align: center;
margin-right: 10rpx;
}
}
}
text {
font-weight: 400;
font-size: 32rpx;
color: #695347;
line-height: 44rpx;
text-align: center;
margin-bottom: 26rpx;
}
</style>

View File

@ -0,0 +1,13 @@
<template>
<view class="">
</view>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,82 @@
<template>
<view class="page">
<base-background />
<!-- 使用自定义导航栏组件 -->
<custom-navbar ref="customNavbar" title="带图片背景的基础界面" />
<view :style="{ backgroundColor: CommonEnum.BASE_COLOR }" class="header">
<!-- 状态展示 -->
<status-display v-if="loading" loading-text="加载中..." type="loading" />
<!-- 页面内容将在这里添加 -->
</view>
</view>
</template>
<script>
import { CommonEnum } from "@/enum/common.js";
import { MonkEnum } from "@/enum/monk.js";
import { getMonkList } from "@/api/monk/monk.js";
import SearchBox from "../../components/search-box/search-box.vue";
export default {
components: {
MonkSearchBox: SearchBox,
},
data() {
return {
bgc: {
backgroundColor: "#F5F0E7",
},
CommonEnum,
MonkEnum,
monkList: [],
searchName: "",
};
},
onLoad() {
this.fetchMonkList();
},
methods: {
async fetchMonkList() {
try {
const res = await getMonkList({ name: this.searchName });
if (res.code === 200 && Array.isArray(res.rows)) {
this.monkList = res.rows;
} else {
uni.showToast({
title: res.msg || "获取失败",
icon: "none",
});
}
} catch (e) {
uni.showToast({
title: "网络错误",
icon: "none",
});
}
},
// HTML
stripHtmlTags(html) {
if (!html) return ""; //
return html.replace(/<[^>]+>/g, ""); // HTML
},
},
};
</script>
<style lang="scss" scoped>
.page {
width: 100%;
min-height: 100vh;
}
.header {
width: 100%;
min-height: 100vh;
display: flex;
align-items: flex-start;
flex-direction: column;
padding: 0 15rpx 40rpx 15rpx;
}
</style>

View File

@ -0,0 +1,82 @@
<template>
<view class="page">
<base-background />
<!-- 使用自定义导航栏组件 -->
<custom-navbar ref="customNavbar" title="带图片背景的基础界面" />
<view :style="{ backgroundColor: CommonEnum.BASE_COLOR }" class="header">
<!-- 状态展示 -->
<status-display v-if="loading" loading-text="加载中..." type="loading" />
<!-- 页面内容将在这里添加 -->
</view>
</view>
</template>
<script>
import { CommonEnum } from "@/enum/common.js";
import { MonkEnum } from "@/enum/monk.js";
import { getMonkList } from "@/api/monk/monk.js";
import SearchBox from "../../components/search-box/search-box.vue";
export default {
components: {
MonkSearchBox: SearchBox,
},
data() {
return {
bgc: {
backgroundColor: "#F5F0E7",
},
CommonEnum,
MonkEnum,
monkList: [],
searchName: "",
};
},
onLoad() {
this.fetchMonkList();
},
methods: {
async fetchMonkList() {
try {
const res = await getMonkList({ name: this.searchName });
if (res.code === 200 && Array.isArray(res.rows)) {
this.monkList = res.rows;
} else {
uni.showToast({
title: res.msg || "获取失败",
icon: "none",
});
}
} catch (e) {
uni.showToast({
title: "网络错误",
icon: "none",
});
}
},
// HTML
stripHtmlTags(html) {
if (!html) return ""; //
return html.replace(/<[^>]+>/g, ""); // HTML
},
},
};
</script>
<style lang="scss" scoped>
.page {
width: 100%;
min-height: 100vh;
}
.header {
width: 100%;
min-height: 100vh;
display: flex;
align-items: flex-start;
flex-direction: column;
padding: 0 15rpx 40rpx 15rpx;
}
</style>

View File

@ -6,50 +6,50 @@
// 环境配置
const ENV_CONFIG = {
develop: {
loadingText: '开发环境加载中~',
loadingText: "加载中~",
loadingTime: 100,
},
trial: {
loadingText: '体验版加载中~',
loadingText: "加载中~",
loadingTime: 100,
},
release: {
loadingText: '加载中~',
loadingText: "加载中~",
loadingTime: 100,
},
}
};
// 获取当前环境配置
const getCurrentConfig = () => {
try {
const { envVersion } = wx.getAccountInfoSync().miniProgram
console.log('当前环境:', envVersion)
return ENV_CONFIG[envVersion] || ENV_CONFIG.release
const { envVersion } = wx.getAccountInfoSync().miniProgram;
console.log("当前环境:", envVersion);
return ENV_CONFIG[envVersion] || ENV_CONFIG.release;
} catch (error) {
console.warn('获取环境失败,默认使用正式环境:', error)
return ENV_CONFIG.release
console.warn("获取环境失败,默认使用正式环境:", error);
return ENV_CONFIG.release;
}
}
};
const config = getCurrentConfig()
const config = getCurrentConfig();
// 全局状态管理
let isLoading = false
let loadingTimer = null
let loadingCount = 0 // 请求计数器
let isLoading = false;
let loadingTimer = null;
let loadingCount = 0; // 请求计数器
/**
* 设置loading超时自动清除
*/
const setLoadingTimeout = () => {
if (loadingTimer) {
clearTimeout(loadingTimer)
clearTimeout(loadingTimer);
}
loadingTimer = setTimeout(() => {
console.warn('Loading超时强制清除')
forceHideLoading()
}, 30000) // 30秒超时
}
console.warn("Loading超时强制清除");
forceHideLoading();
}, 30000); // 30秒超时
};
/**
* 显示加载状态
@ -57,19 +57,19 @@ const setLoadingTimeout = () => {
*/
function showLoading(text = config.loadingText) {
try {
loadingCount++
loadingCount++;
if (!isLoading) {
isLoading = true
isLoading = true;
uni.showLoading({
title: text,
mask: true,
})
});
// 设置超时清除
setLoadingTimeout()
console.log('显示Loading:', text)
setLoadingTimeout();
console.log("显示Loading:", text);
}
} catch (error) {
console.warn('显示loading失败:', error)
console.warn("显示loading失败:", error);
}
}
@ -78,23 +78,26 @@ function showLoading(text = config.loadingText) {
*/
function hideLoading() {
try {
loadingCount--
loadingCount--;
if (loadingCount > 0) {
console.log('还有其他请求在进行不隐藏Loading, 剩余请求数:', loadingCount)
return // 还有其他请求在进行
console.log(
"还有其他请求在进行不隐藏Loading, 剩余请求数:",
loadingCount,
);
return; // 还有其他请求在进行
}
if (isLoading) {
isLoading = false
isLoading = false;
// 清除超时定时器
if (loadingTimer) {
clearTimeout(loadingTimer)
loadingTimer = null
clearTimeout(loadingTimer);
loadingTimer = null;
}
uni.hideLoading()
console.log('隐藏Loading')
uni.hideLoading();
console.log("隐藏Loading");
}
} catch (error) {
console.warn('隐藏loading失败:', error)
console.warn("隐藏loading失败:", error);
}
}
@ -103,16 +106,16 @@ function hideLoading() {
*/
export function forceHideLoading() {
try {
isLoading = false
loadingCount = 0
isLoading = false;
loadingCount = 0;
if (loadingTimer) {
clearTimeout(loadingTimer)
loadingTimer = null
clearTimeout(loadingTimer);
loadingTimer = null;
}
uni.hideLoading()
console.log('强制隐藏Loading')
uni.hideLoading();
console.log("强制隐藏Loading");
} catch (error) {
console.warn('强制隐藏loading失败:', error)
console.warn("强制隐藏loading失败:", error);
}
}
@ -125,7 +128,7 @@ export function getLoadingStatus() {
isLoading,
loadingCount,
hasTimer: !!loadingTimer,
}
};
}
/**
@ -133,8 +136,8 @@ export function getLoadingStatus() {
* @param {Object} newConfig - 新的配置
*/
export function setLoadingConfig(newConfig) {
Object.assign(config, newConfig)
console.log('更新Loading配置:', config)
Object.assign(config, newConfig);
console.log("更新Loading配置:", config);
}
/**
@ -142,7 +145,7 @@ export function setLoadingConfig(newConfig) {
* @returns {Object} 当前配置
*/
export function getLoadingConfig() {
return { ...config }
return { ...config };
}
/**
@ -150,10 +153,13 @@ export function getLoadingConfig() {
* @param {string} text - 加载提示文字
* @param {number} delay - 延迟时间毫秒
*/
export function showLoadingWithDelay(text = config.loadingText, delay = config.loadingTime) {
export function showLoadingWithDelay(
text = config.loadingText,
delay = config.loadingTime,
) {
setTimeout(() => {
showLoading(text)
}, delay)
showLoading(text);
}, delay);
}
/**
@ -162,8 +168,8 @@ export function showLoadingWithDelay(text = config.loadingText, delay = config.l
*/
export function hideLoadingWithDelay(delay = 500) {
setTimeout(() => {
hideLoading()
}, delay)
hideLoading();
}, delay);
}
/**
@ -171,35 +177,36 @@ export function hideLoadingWithDelay(delay = 500) {
*/
export function initGlobalLoadingManager() {
// 监听页面显示事件
uni.$on('page-show', () => {
console.log('页面显示检查loading状态')
uni.$on("page-show", () => {
console.log("页面显示检查loading状态");
// 页面显示时检查loading状态如果超时则清除
if (isLoading && loadingTimer) {
const remainingTime = 30000 - (Date.now() - (loadingTimer._startTime || Date.now()))
const remainingTime =
30000 - (Date.now() - (loadingTimer._startTime || Date.now()));
if (remainingTime <= 0) {
console.warn('页面显示时发现超时loading强制清除')
forceHideLoading()
console.warn("页面显示时发现超时loading强制清除");
forceHideLoading();
}
}
})
});
// 监听页面隐藏事件
uni.$on('page-hide', () => {
console.log('页面隐藏')
})
uni.$on("page-hide", () => {
console.log("页面隐藏");
});
// 监听应用显示事件
uni.$on('app-show', () => {
console.log('应用显示')
})
uni.$on("app-show", () => {
console.log("应用显示");
});
// 监听应用隐藏事件
uni.$on('app-hide', () => {
console.log('应用隐藏清除loading')
forceHideLoading()
})
uni.$on("app-hide", () => {
console.log("应用隐藏清除loading");
forceHideLoading();
});
console.log('全局loading管理器已初始化')
console.log("全局loading管理器已初始化");
}
/**
@ -207,30 +214,30 @@ export function initGlobalLoadingManager() {
*/
export class AutoLoadingManager {
constructor() {
this.isActive = false
this.isActive = false;
}
// 显示loading可选
show(text = '加载中...') {
this.isActive = true
show(text = "加载中...") {
this.isActive = true;
// 这里可以选择是否显示额外的loading
// 默认情况下所有API调用都会自动显示loading
}
// 隐藏loading可选
hide() {
this.isActive = false
this.isActive = false;
// 这里可以选择是否手动隐藏loading
// 默认情况下API调用完成后会自动隐藏loading
}
// 销毁管理器
destroy() {
this.isActive = false
this.isActive = false;
// 页面卸载时可以选择是否强制清除loading
// forceHideLoading()
}
}
// 导出内部方法供request.js使用
export { showLoading, hideLoading, config }
export { showLoading, hideLoading, config };