吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1025|回复: 26
收起左侧

[其他转载] 365存钱法AI写的

  [复制链接]
lcg888 发表于 2025-3-24 19:45
代码如下:

[HTML] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>365存钱法 - 智能计算器</title>
    <style>
        :root {
            --primary: #4a90e2;
            --bg: #f5f7fa;
            --card-bg: #ffffff;
            --text: #2c3e50;
        }
 
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
 
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg);
            color: var(--text);
            line-height: 1.6;
        }
 
        .container {
            max-width: 600px;
            margin: 1rem auto;
            padding: 1.5rem;
        }
 
        .calculator-card {
            background: var(--card-bg);
            border-radius: 16px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.08);
            padding: 2rem;
        }
 
        .date-picker {
            position: relative;
            margin-bottom: 1.5rem;
        }
 
        .custom-date-input {
            width: 100%;
            padding: 1rem;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 1rem;
            background: #fff;
            -webkit-appearance: none;
        }
 
        .calendar-icon {
            position: absolute;
            right: 1rem;
            top: 50%;
            transform: translateY(-50%);
            width: 24px;
            height: 24px;
            pointer-events: none;
        }
 
        .result-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 1rem;
            margin: 1.5rem 0;
        }
 
        .result-item {
            background: rgba(74,144,226,0.1);
            padding: 1rem;
            border-radius: 8px;
            text-align: center;
            transition: transform 0.3s ease;
        }
 
        .progress-container {
            height: 12px;
            background: #e0e0e0;
            border-radius: 6px;
            margin: 2rem 0;
            overflow: hidden;
        }
 
        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #4a90e2, #6c5ce7);
            transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
        }
 
        .quote {
            margin-top: 2rem;
            padding: 1.5rem;
            background: rgba(74,144,226,0.05);
            border-radius: 8px;
            text-align: center;
            font-style: italic;
            color: #666;
            opacity: 1;
            transition: opacity 0.3s ease;
        }
 
        .quote.fade {
            opacity: 0;
        }
 
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
 
        .animated {
            animation: pulse 0.5s ease-in-out;
        }
 
        [url=home.php?mod=space&uid=945662]@media[/url] (max-width: 480px) {
            .container {
                padding: 1rem;
            }
            .result-grid {
                grid-template-columns: 1fr;
            }
            .custom-date-input {
                font-size: 0.9rem;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="calculator-card">
            <h2 style="margin-bottom: 1.5rem; text-align: center">&#128176;365存钱法&#128176;</h2>
             
            <div class="date-picker">
                <input type="date" id="dateInput" class="custom-date-input">
                <svg class="calendar-icon" viewBox="0 0 24 24">
                    <path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V9h14v10z"/>
                </svg>
            </div>
 
            <div class="result-grid">
                <div class="result-item">
                    <p>今日应存</p>
                    <h3 id="dailyAmount">0 元</h3>
                </div>
                <div class="result-item">
                    <p>累计存款</p>
                    <h3 id="totalAmount">0 元</h3>
                </div>
            </div>
 
            <div class="progress-container">
                <div class="progress-bar" id="progressBar" style="width: 0%"></div>
            </div>
             
            <div style="text-align: center">
                <p>总进度:<span id="percentage">0</span>%</p>
            </div>
 
            <div class="quote">
                <p id="quoteText">理财之道,积少成多</p>
                <p class="quote-author" id="quoteAuthor">—— 中国谚语</p>
            </div>
        </div>
    </div>
 
    <script>
        const SavingCalculator = (() => {
            const quotes = [
                { text: "省下一分钱就是赚到一分钱", author: "本杰明·富兰克林" },
                { text: "财富就像一棵树,是从一粒小小的种子开始成长的", author: "戴夫·拉姆齐" },
                { text: "不要为了花钱而工作,要让钱为你工作", author: "罗伯特·清崎" },
                { text: "理财的首要目标应是保障资本安全,其次才是追求收益", author: "沃伦·巴菲特" },
                { text: "每月存下收入的10%会让你惊讶于它的累积速度", author: "约翰·洛克菲勒" },
                { text: "理财不是有钱人的专利,而是每个人的必修课", author: "李嘉诚" }
            ];
 
            let animationFrameIds = {};
 
            function getToday() {
                const now = new Date();
                return new Date(now.getFullYear(), now.getMonth(), now.getDate());
            }
 
            function calculateDays(startDate, endDate) {
                const start = new Date(startDate);
                const end = new Date(endDate);
                start.setHours(0, 0, 0, 0);
                end.setHours(0, 0, 0, 0);
                return Math.floor((end - start) / 86400000) + 1;
            }
 
            function animateValue(elementId, targetValue) {
                const element = document.getElementById(elementId);
                const current = parseInt(element.textContent.replace(/,/g, '')) || 0;
                 
                if (animationFrameIds[elementId]) {
                    cancelAnimationFrame(animationFrameIds[elementId]);
                }
 
                const startTime = Date.now();
                const duration = 500;
 
                const animate = () => {
                    const progress = Math.min((Date.now() - startTime) / duration, 1);
                    const value = Math.floor(current + (targetValue - current) * progress);
                    element.textContent = value.toLocaleString() + ' 元';
                     
                    if (progress < 1) {
                        animationFrameIds[elementId] = requestAnimationFrame(animate);
                    } else {
                        delete animationFrameIds[elementId];
                    }
                };
 
                animationFrameIds[elementId] = requestAnimationFrame(animate);
            }
 
            function updateProgress(percentage) {
                const progressBar = document.getElementById('progressBar');
                const percentageElement = document.getElementById('percentage');
                 
                progressBar.style.width = `${percentage}%`;
                percentageElement.textContent = percentage.toFixed(1);
            }
 
            function showRandomQuote() {
                const quoteContainer = document.querySelector('.quote');
                quoteContainer.classList.add('fade');
 
                setTimeout(() => {
                    const {text, author} = quotes[Math.floor(Math.random() * quotes.length)];
                    document.getElementById('quoteText').textContent = text;
                    document.getElementById('quoteAuthor').textContent = `—— ${author}`;
                    quoteContainer.classList.remove('fade');
                }, 300);
            }
 
            return {
                init() {
                    const dateInput = document.getElementById('dateInput');
                    const currentYear = new Date().getFullYear();
 
                    // 设置日期范围
                    dateInput.min = `${currentYear}-01-01`;
                    dateInput.max = `${currentYear}-12-31`;
 
                    // 初始化日期
                    const savedDate = localStorage.getItem('savingDate');
                    if (savedDate && new Date(savedDate).getFullYear() === currentYear) {
                        dateInput.value = savedDate;
                    } else {
                        dateInput.value = getToday().toISOString().split('T')[0];
                    }
 
                    // 绑定事件
                    dateInput.addEventListener('change', () => {
                        localStorage.setItem('savingDate', dateInput.value);
                        this.calculate();
                    });
 
                    this.calculate();
                    showRandomQuote();
                },
 
                calculate() {
                    const dateInput = document.getElementById('dateInput');
                    const currentYear = new Date().getFullYear();
                    const selectedDate = new Date(dateInput.value);
                     
                    // 日期有效性验证
                    if (isNaN(selectedDate) || selectedDate.getFullYear() !== currentYear) {
                        dateInput.value = getToday().toISOString().split('T')[0];
                        selectedDate.setTime(getToday().getTime());
                    }
 
                    // 计算天数
                    const startDate = new Date(currentYear, 0, 1);
                    const daysPassed = Math.max(1, Math.min(
                        calculateDays(startDate, selectedDate),
                        365
                    ));
 
                    // 计算结果
                    const totalSaved = (daysPassed * (daysPassed + 1)) / 2;
                    const percentage = (totalSaved / 66795) * 100;
 
                    // 更新界面
                    animateValue('dailyAmount', daysPassed);
                    animateValue('totalAmount', totalSaved);
                    updateProgress(percentage);
                    showRandomQuote();
 
                    // 触发元素动画
                    document.querySelectorAll('.result-item h3').forEach(el => {
                        el.classList.add('animated');
                        setTimeout(() => el.classList.remove('animated'), 500);
                    });
                }
            };
        })();
 
        // 初始化应用
        SavingCalculator.init();
    </script>
</body>
</html>




1. HTML结构
容器:页面内容包裹在.container中,确保内容居中并限制最大宽度。
卡片布局:.calculator-card包含所有计算器的核心内容,包括日期选择器、结果显示、进度条和名言展示。
日期选择器:使用<input type="date">让用户选择日期,右侧有一个日历图标。
结果显示:通过.result-grid展示“今日应存”和“累计存款”两个结果。
进度条:.progress-container和.progress-bar用于显示存款的总进度。
名言展示:.quote区域随机显示一条理财相关的名言。

2. CSS样式
变量定义:使用CSS变量(如--primary、--bg)统一管理颜色和样式。
响应式设计:通过媒体查询(@media)确保页面在移动设备上也能良好显示。
动画效果:使用@keyframes定义脉冲动画(pulse),在数值更新时触发。
过渡效果:使用transition为进度条和名言区域添加平滑的过渡效果。

3. JavaScript逻辑
SavingCalculator模块:封装了所有计算和更新逻辑,包括:
名言库:quotes数组存储多条理财相关的名言。
日期处理:getToday获取当前日期,calculateDays计算两个日期之间的天数。
数值动画:animateValue实现数值变化的平滑动画。
进度更新:updateProgress更新进度条的宽度和百分比。
名言展示:showRandomQuote随机显示一条名言,并添加淡入淡出效果。
初始化与计算:init初始化日期选择器并绑定事件,calculate根据选定的日期计算存款进度。

4. 功能流程
初始化:页面加载时,SavingCalculator.init()设置日期选择器的范围和默认值,并绑定change事件。
日期选择:用户选择日期后,calculate方法根据选定的日期计算“今日应存”和“累计存款”,并更新进度条和名言。
动画效果:数值变化和名言更新时,触发相应的动画效果,提升用户体验。

5. 核心逻辑
365存钱法:每天存的钱数等于当天的天数(例如第1天存1元,第2天存2元,依此类推)。
计算公式:
累计存款:totalSaved = (daysPassed * (daysPassed + 1)) / 2
总进度:percentage = (totalSaved / 66795) * 100(66795是一年365天的累计存款总额)。

6. 交互细节
日期范围:日期选择器限制在当前年份(1月1日至12月31日)。
本地存储:用户选择的日期会保存在localStorage中,页面刷新后自动恢复。
动态更新:日期变化时,所有相关数值和进度条都会动态更新。

7. 优化与扩展
性能优化:使用requestAnimationFrame实现平滑的数值动画,避免卡顿。
可扩展性:名言库和计算逻辑可以轻松扩展,例如支持自定义存款计划或添加更多理财建议。

8. 适用场景
个人理财:适合希望通过小额定存培养储蓄习惯的用户。
教育工具:可用于理财教育,帮助用户理解复利和积累的重要性。
总结
这个“365存钱法”计算器通过简洁的界面和动态的交互效果,帮助用户直观地追踪存款进度。其模块化的设计和清晰的逻辑使得代码易于维护和扩展,适合作为个人理财工具或教育项目。

免费评分

参与人数 3吾爱币 +1 热心值 +3 收起 理由
info99 + 1 这个很有意思啊!
wuai5211314 + 1 感谢分享!
Bob5230 + 1 + 1 热心回复!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| lcg888 发表于 2025-3-24 20:24
z00800 发表于 2025-3-24 20:17
&#128180;去哪里领?

直接复制保存为HTML
 楼主| lcg888 发表于 2025-3-25 06:52
homehome 发表于 2025-3-24 20:56
存钱知道。怎么赚钱呢?请楼主指明发财道路,以方便用上这个软件

能做生意一天赚80,别去打工一天赚100。你要问做啥生意合适,只能告诉你去做自己喜欢的感兴趣的,把它做好做精。

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
homehome + 1 + 1 热心回复!

查看全部评分

z00800 发表于 2025-3-24 20:17
chicken666 发表于 2025-3-24 20:26
不错,粘上去就可以用
 楼主| lcg888 发表于 2025-3-24 20:27
chicken666 发表于 2025-3-24 20:26
不错,粘上去就可以用

复制即用
homehome 发表于 2025-3-24 20:56
存钱知道。怎么赚钱呢?请楼主指明发财道路,以方便用上这个软件
wqy204 发表于 2025-3-24 21:14
怎么赚钱呢?请楼主指明发财道路
水乡云榭 发表于 2025-3-24 21:23
我感觉我要努力先去找一个一天能挣300多的工作。要不然到后半年的话一天存300多元
bb521 发表于 2025-3-24 21:52
这个是软件吗?是不是直接生成的?
BBG77 发表于 2025-3-24 23:05
想法思路不错,感谢分享
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-4-23 22:11

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表