Initial commit

This commit is contained in:
ChuXun
2025-12-07 22:53:46 +08:00
commit 5a2d39293d
27 changed files with 3188 additions and 0 deletions

199
pages/index/index.js Normal file
View File

@@ -0,0 +1,199 @@
const app = getApp()
Page({
data: {
crisisEvents: []
},
onLoad: function() {
const that = this;
// 加载危机事件数据
wx.getFileSystemManager().readFile({
filePath: `${wx.env.USER_DATA_PATH}/data/crisisEvents.json`,
encoding: 'utf-8',
success: res => {
try {
const data = JSON.parse(res.data);
that.setData({
crisisEvents: data
});
} catch (e) {
console.error('解析危机事件数据失败', e);
// 如果读取本地失败,则使用示例数据
that.setData({
crisisEvents: [
{
id: 'fake_currency_1',
type: 'fakeCurrency',
title: '伪币冲击:初级',
description: '敌方在根据地周边地区投放少量伪造边币,市场上开始出现伪币流通现象',
level: 1,
impact: '市场信心轻微下降,边币贬值风险较小'
},
{
id: 'fake_currency_2',
type: 'fakeCurrency',
title: '伪币冲击:中级',
description: '敌方增加伪造边币投放力度,市场上伪币数量明显增加,造成一定混乱',
level: 2,
impact: '市场交易受阻,边币信任度下降,贸易活动减少'
},
{
id: 'fake_currency_3',
type: 'fakeCurrency',
title: '伪币冲击:高级',
description: '敌方大规模投放高仿真度伪币,市场已难以分辨真伪,货币混乱严重',
level: 3,
impact: '边币严重贬值,市场恐慌,经济活动受到重创'
},
{
id: 'shortage_1',
type: 'shortage',
title: '物资短缺:初级',
description: '部分生活必需品供应不足,市场价格开始上涨',
level: 1,
impact: '物价小幅上涨,边币购买力略有下降'
},
{
id: 'shortage_2',
type: 'shortage',
title: '物资短缺:中级',
description: '多种生活必需品严重短缺,黑市交易开始活跃',
level: 2,
impact: '物价大幅上涨,边币购买力明显下降,民众不满情绪增加'
},
{
id: 'shortage_3',
type: 'shortage',
title: '物资短缺:高级',
description: '根据地被敌军封锁,几乎所有物资都极度匮乏',
level: 3,
impact: '物价飞涨,边币几近崩溃,根据地经济面临瘫痪'
},
{
id: 'exchange_1',
type: 'exchange',
title: '汇率波动:初级',
description: '边币对法币汇率小幅波动,交易活动受到轻微影响',
level: 1,
impact: '边币信心略有动摇,边区与外界贸易略受影响'
},
{
id: 'exchange_2',
type: 'exchange',
title: '汇率波动:中级',
description: '边币对法币汇率大幅下跌,边区与外界贸易受阻',
level: 2,
impact: '边币信心受挫,边区经济受到较大冲击'
},
{
id: 'exchange_3',
type: 'exchange',
title: '汇率波动:高级',
description: '边币对法币汇率暴跌,边区与外界经济联系几乎中断',
level: 3,
impact: '边币信心崩溃,边区经济面临严重危机'
}
]
});
}
},
fail: () => {
console.log('读取本地文件失败,使用示例数据');
// 使用示例数据
that.setData({
crisisEvents: [
{
id: 'fake_currency_1',
type: 'fakeCurrency',
title: '伪币冲击:初级',
description: '敌方在根据地周边地区投放少量伪造边币,市场上开始出现伪币流通现象',
level: 1,
impact: '市场信心轻微下降,边币贬值风险较小'
},
{
id: 'fake_currency_2',
type: 'fakeCurrency',
title: '伪币冲击:中级',
description: '敌方增加伪造边币投放力度,市场上伪币数量明显增加,造成一定混乱',
level: 2,
impact: '市场交易受阻,边币信任度下降,贸易活动减少'
},
{
id: 'fake_currency_3',
type: 'fakeCurrency',
title: '伪币冲击:高级',
description: '敌方大规模投放高仿真度伪币,市场已难以分辨真伪,货币混乱严重',
level: 3,
impact: '边币严重贬值,市场恐慌,经济活动受到重创'
},
{
id: 'shortage_1',
type: 'shortage',
title: '物资短缺:初级',
description: '部分生活必需品供应不足,市场价格开始上涨',
level: 1,
impact: '物价小幅上涨,边币购买力略有下降'
},
{
id: 'shortage_2',
type: 'shortage',
title: '物资短缺:中级',
description: '多种生活必需品严重短缺,黑市交易开始活跃',
level: 2,
impact: '物价大幅上涨,边币购买力明显下降,民众不满情绪增加'
},
{
id: 'shortage_3',
type: 'shortage',
title: '物资短缺:高级',
description: '根据地被敌军封锁,几乎所有物资都极度匮乏',
level: 3,
impact: '物价飞涨,边币几近崩溃,根据地经济面临瘫痪'
},
{
id: 'exchange_1',
type: 'exchange',
title: '汇率波动:初级',
description: '边币对法币汇率小幅波动,交易活动受到轻微影响',
level: 1,
impact: '边币信心略有动摇,边区与外界贸易略受影响'
},
{
id: 'exchange_2',
type: 'exchange',
title: '汇率波动:中级',
description: '边币对法币汇率大幅下跌,边区与外界贸易受阻',
level: 2,
impact: '边币信心受挫,边区经济受到较大冲击'
},
{
id: 'exchange_3',
type: 'exchange',
title: '汇率波动:高级',
description: '边币对法币汇率暴跌,边区与外界经济联系几乎中断',
level: 3,
impact: '边币信心崩溃,边区经济面临严重危机'
}
]
});
}
});
},
handleEventSelect: function(e) {
const eventId = e.currentTarget.dataset.id;
const selectedEvent = this.data.crisisEvents.find(item => item.id === eventId);
if (selectedEvent) {
// 将选中事件保存到全局数据
const app = getApp();
app.globalData.selectedEvent = selectedEvent;
// 跳转到策略选择页面
wx.navigateTo({
url: '/pages/strategy/strategy'
});
}
}
})

4
pages/index/index.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "边币战争 - 事件选择"
}

58
pages/index/index.wxml Normal file
View File

@@ -0,0 +1,58 @@
<!--index.wxml-->
<view class="container vintage-bg">
<view class="header">
<view class="logo"></view>
<view class="title-box">
<text class="main-title">边币战争</text>
<text class="sub-title">重温根据地金融斗争历史</text>
</view>
</view>
<view class="intro-card card">
<text class="intro-text">欢迎来到"边币战争",您将扮演边区政府决策者,应对各种货币危机,选择最合适的策略保卫边币,维护根据地经济安全。</text>
</view>
<view class="section-title">选择危机事件</view>
<view class="event-list">
<view class="event-type">
<view class="type-title">伪币冲击</view>
<view class="events">
<view wx:for="{{crisisEvents}}" wx:key="id" wx:if="{{item.type === 'fakeCurrency'}}"
class="event-card card level-{{item.level}}" bindtap="handleEventSelect" data-id="{{item.id}}">
<view class="event-title">{{item.title}}</view>
<view class="event-desc">{{item.description}}</view>
<view class="event-impact">影响:{{item.impact}}</view>
</view>
</view>
</view>
<view class="event-type">
<view class="type-title">物资短缺</view>
<view class="events">
<view wx:for="{{crisisEvents}}" wx:key="id" wx:if="{{item.type === 'shortage'}}"
class="event-card card level-{{item.level}}" bindtap="handleEventSelect" data-id="{{item.id}}">
<view class="event-title">{{item.title}}</view>
<view class="event-desc">{{item.description}}</view>
<view class="event-impact">影响:{{item.impact}}</view>
</view>
</view>
</view>
<view class="event-type">
<view class="type-title">汇率波动</view>
<view class="events">
<view wx:for="{{crisisEvents}}" wx:key="id" wx:if="{{item.type === 'exchange'}}"
class="event-card card level-{{item.level}}" bindtap="handleEventSelect" data-id="{{item.id}}">
<view class="event-title">{{item.title}}</view>
<view class="event-desc">{{item.description}}</view>
<view class="event-impact">影响:{{item.impact}}</view>
</view>
</view>
</view>
</view>
<view class="footer">
<text class="footer-text">根据史实改编,仅供学习参考</text>
</view>
</view>

151
pages/index/index.wxss Normal file
View File

@@ -0,0 +1,151 @@
/**index.wxss**/
.header {
display: flex;
align-items: center;
padding: 30rpx 0;
}
.logo {
width: 100rpx;
height: 100rpx;
margin-right: 20rpx;
background-color: #f0f0f0;
border-radius: 50%;
position: relative;
}
.logo::after {
content: "LOGO";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #999;
font-size: 24rpx;
}
.title-box {
display: flex;
flex-direction: column;
}
.main-title {
font-size: 36rpx;
font-weight: bold;
color: #8B0000;
}
.sub-title {
font-size: 24rpx;
color: #666;
}
.intro-card {
margin: 20rpx 0 40rpx;
padding: 30rpx;
border-left: 4px solid #8B0000;
}
.intro-text {
font-size: 28rpx;
line-height: 1.6;
}
.section-title {
font-size: 32rpx;
font-weight: bold;
margin: 20rpx 0;
color: #333;
border-bottom: 1px solid #ddd;
padding-bottom: 10rpx;
}
.event-type {
margin-bottom: 40rpx;
}
.type-title {
font-size: 30rpx;
font-weight: bold;
margin: 10rpx 0;
color: #555;
}
.events {
display: flex;
flex-direction: column;
}
.event-card {
padding: 20rpx;
margin: 10rpx 0;
position: relative;
overflow: hidden;
}
.event-card.level-1 {
border-left: 4px solid #4CAF50;
}
.event-card.level-2 {
border-left: 4px solid #FFC107;
}
.event-card.level-3 {
border-left: 4px solid #F44336;
}
.event-card::after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
border-style: solid;
}
.event-card.level-1::after {
border-width: 0 20px 20px 0;
border-color: transparent #4CAF50 transparent transparent;
}
.event-card.level-2::after {
border-width: 0 20px 20px 0;
border-color: transparent #FFC107 transparent transparent;
}
.event-card.level-3::after {
border-width: 0 20px 20px 0;
border-color: transparent #F44336 transparent transparent;
}
.event-title {
font-size: 28rpx;
font-weight: bold;
margin-bottom: 10rpx;
}
.event-desc {
font-size: 26rpx;
color: #666;
margin-bottom: 10rpx;
line-height: 1.4;
}
.event-impact {
font-size: 24rpx;
color: #888;
}
.footer {
margin-top: 40rpx;
padding: 20rpx;
text-align: center;
border-top: 1px solid #eee;
}
.footer-text {
font-size: 24rpx;
color: #999;
}