添加图片

main
wenyi 2 years ago
parent 2f287f0c70
commit d6709cb790

@ -0,0 +1,31 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}

@ -1,2 +1,3 @@
# shuxue
![截图](./屏幕截图%202024-06-29%20151943.png)

@ -0,0 +1,19 @@
// app.js
App({
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
},
globalData: {
userInfo: null
}
})

@ -0,0 +1,36 @@
{
"pages": [
"pages/index/index",
"pages/video/video",
"pages/music/music"
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "中国古代数学",
"navigationBarBackgroundColor": "#ffffff"
},
"tabBar": {
"list": [
{
"pagePath": "pages/index/index",
"text": "主页"
},
{
"pagePath": "pages/video/video",
"text": "视频介绍"
},
{
"pagePath": "pages/music/music",
"text": "音乐欣赏"
}
],
"color": "#000",
"selectedColor": "#1AAD19",
"backgroundColor": "#fff",
"borderStyle": "black"
},
"style": "v2",
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}

@ -0,0 +1,10 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}

@ -0,0 +1,40 @@
Page({
data: {
banners: [
{ url: 'https://pic.vjshi.com/2022-08-31/578a52769c9e48bd803212d743022624/00001.jpg?x-oss-process=style/watermark' },
{ url: 'https://ts1.cn.mm.bing.net/th/id/R-C.f710b3dd4dcc3a230c59e37fe8648803?rik=JYB%2fWaSduGLMZQ&riu=http%3a%2f%2fwww.tanmizhi.com%2fimg%2fallimg%2f01%2f19-2001091RJ2.jpg&ehk=%2bZymS0MGiSDKNKCwx23%2bNvO0B9S4DTZtJpBGYiHq3SI%3d&risl=&pid=ImgRaw&r=0' },
{ url: 'https://ts1.cn.mm.bing.net/th/id/R-C.2cd67462b64447245bdfe216b463c645?rik=EwYm5k2zUgB4hg&riu=http%3a%2f%2fwww.tanmizhi.com%2fimg%2fallimg%2f01%2f19-2001091RJ3-50.jpg&ehk=xnDGy1mugyNjDpuuOIy6Rwnfn54oQ3cock9LReF%2fvGM%3d&risl=&pid=ImgRaw&r=0&sres=1&sresct=1' }
],
historians: [
{
avatar: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.Y_LM4QVJ9qifB2ctdxeeoAHaJT?w=600&h=754&rs=1&pid=ImgDetMain',
name: '祖冲之',
intro: '祖冲之是南北朝时期的数学家,他首次将圆周率计算到小数点后七位。'
},
{
avatar: 'https://ts1.cn.mm.bing.net/th/id/R-C.670c838d1b365325623135ea4ba40342?rik=RvMNP3yvxw%2bl%2bw&riu=http%3a%2f%2fimgres.qulishi.com%2fqulishi%2f94%2f468290-2023082511110164e81bc54aeb0.jpg&ehk=Qq6D6%2buuRGH7ZMBdVdPkYurtXq7g9soywbgKEDwvzjo%3d&risl=&pid=ImgRaw&r=0',
name: '刘徽',
intro: '刘徽是魏晋时期的数学家,他的《九章算术注》对后世产生了深远影响。'
},
{
avatar: 'https://ts1.cn.mm.bing.net/th/id/R-C.445fde33d3319f45eabcdcbcffaef306?rik=ntURNR08LBQv6Q&riu=http%3a%2f%2fwww.cas.cn%2fspzb1%2fJNHLGSS25ZN%2fHLG25LZP%2f201006%2fW020100610507641629592.jpg&ehk=SLv45SiVMzt%2bh10bRJu3zDfu%2febBYtC%2bXUSQKLvJj6o%3d&risl=&pid=ImgRaw&r=0',
name: '华罗庚',
intro: '华罗庚是现代数学家,他在数论、代数几何等领域取得了杰出成就。'
}
],
mathProblems: [
{
title: '鸡兔同笼',
content: '今有雉兔同笼,上有三十五头,下有九十四足,问雉兔各几何?'
},
{
title: '韩信点兵',
content: '韩信率军出征他想知道士兵的准确数目。他让士兵按照每3人一排排队剩下2人按照每5人一排排队剩下3人按照每7人一排排队剩下2人。请问韩信的军队有多少人'
},
{
title: '百鸡问题',
content: '今有鸡翁一,值钱五;鸡母一,值钱三;鸡雏三,值钱一。凡百钱买鸡百只,问鸡翁、母、雏各几何?'
}
]
}
})

@ -0,0 +1,4 @@
{
"usingComponents": {
}
}

@ -0,0 +1,41 @@
<view class="container">
<!-- 轮播图 -->
<swiper class="swiper" indicator-dots="{{true}}" autoplay="{{true}}" interval="{{5000}}" duration="{{500}}">
<block wx:for="{{banners}}" wx:key="index">
<swiper-item>
<image src="{{item.url}}" mode="aspectFill" class="swiper-img"></image>
</swiper-item>
</block>
</swiper>
<!-- 关于我们 -->
<view class="section">
<view class="section-title">关于我们</view>
<view class="section-content">
我们的小程序致力于展示中国古代数学的悠久历史和丰富贡献。通过视频和音乐的形式,我们希望带领您领略古代数学的魅力。
</view>
</view>
<!-- 历史名人 -->
<view class="section">
<view class="section-title">历史名人</view>
<view class="section-content">
<view wx:for="{{historians}}" wx:key="index" class="historian">
<image src="{{item.avatar}}" mode="aspectFill" class="historian-avatar"></image>
<text class="historian-name">{{item.name}}</text>
<text class="historian-intro">{{item.intro}}</text>
</view>
</view>
</view>
<!-- 数学趣题 -->
<view class="section">
<view class="section-title">数学趣题</view>
<view class="section-content">
<view wx:for="{{mathProblems}}" wx:key="index" class="math-problem">
<text class="math-problem-title">{{item.title}}</text>
<text class="math-problem-content">{{item.content}}</text>
</view>
</view>
</view>
</view>

@ -0,0 +1,75 @@
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
}
.swiper {
width: 100%;
height: 200px;
}
.swiper-img {
width: 100%;
height: 100%;
}
.section {
width: 100%;
margin-top: 20px;
}
.section-title {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
}
.section-content {
font-size: 16px;
line-height: 1.5;
}
.historian {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 10px;
}
.historian-avatar {
width: 100px;
height: 100px;
border-radius: 50%;
margin-bottom: 10px;
}
.historian-name {
font-size: 18px;
font-weight: bold;
margin-bottom: 5px;
}
.historian-intro {
font-size: 16px;
line-height: 1.5;
}
.math-problem {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 10px;
}
.math-problem-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 5px;
}
.math-problem-content {
font-size: 16px;
line-height: 1.5;
}

@ -0,0 +1,20 @@
Page({
data: {
relatedMusic: [
{
title: '古代数学之歌',
url: 'http://music.163.com/song/media/outer/url?id=1888687693.mp3' //
},
{
title: '数学之美',
url: 'http://music.163.com/song/media/outer/url?id=2043218731.mp3' //
},
{
title: '智慧的旋律',
url: 'http://music.163.com/song/media/outer/url?id=2043218731.mp3' //
}
]
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,21 @@
<view class="container">
<view class="title">音乐欣赏</view>
<view class="music-section">
<audio src="http://music.163.com/song/media/outer/url?id=2043218731.mp3" controls class="music-player"></audio>
</view>
<view class="description-section">
<view class="section-title">音乐简介</view>
<view class="section-content">
本音乐作品灵感来源于中国古代数学,旋律优美动听,带您领略古代数学的文化韵味。希望您在欣赏音乐的同时,也能感受到数学的魅力。
</view>
</view>
<view class="related-music">
<view wx:for="{{relatedMusic}}" wx:key="index" class="related-music-item">
<text class="related-music-title">{{item.title}}</text>
<audio src="{{item.url}}" controls class="related-music-player" poster=""></audio>
</view>
</view>
<view class="back-btn">
<navigator url="/pages/index/index">返回首页</navigator>
</view>
</view>

@ -0,0 +1,71 @@
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
}
.title {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}
.music-section {
width: 100%;
margin-bottom: 20px;
}
.music-player {
width: 100%;
}
.description-section,
.related-music-section {
width: 100%;
margin-bottom: 20px;
}
.section-title {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.section-content {
font-size: 16px;
line-height: 1.5;
}
.related-music {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.related-music-item {
width: 48%;
margin-bottom: 10px;
}
.related-music-cover {
width: 100%;
height: 0;
padding-bottom: 75%; /* 16:9 aspect ratio */
background-size: cover;
margin-bottom: 5px;
}
.related-music-title {
font-size: 16px;
line-height: 1.5;
}
.back-btn {
font-size: 18px;
color: #1AAD19;
text-decoration: none;
padding: 10px 20px;
border: 1px solid #1AAD19;
border-radius: 5px;
}

@ -0,0 +1,18 @@
Page({
data: {
relatedVideos: [
{
thumbnail: 'https://kvideo01.youju.sohu.com/160b49f1-b4b0-41f2-8068-70c5a3768b1e2_0_0.mp4?sign=d69dc4422d7864c6856b22421d461c5b&t=1718629907',
title: '古代数学家的故事'
},
{
thumbnail: 'https://kvideo01.youju.sohu.com/70e7f352-7c9d-4c5c-96ef-2a685ab6c0d52_0_0.mp4?sign=9be599bbb78d5554f7110765fac73ea5&t=1718630313',
title: '中国古代数学定理'
},
{
thumbnail: 'https://721-4.vod.tv.itc.cn/sohu/v1/TmwdqAIsRYWHMYA2TKwB0Lsl8SkDD6e2RYbO8Y6AhhXUyYbSoO27fSx.mp4?k=n7kFEZ&p=jWlvzSwdqLsBqmx3qEO349xIWhysRYNsZY14WBeXWhetfDy4WhWS0MocRYo70ScAZMx4gGo70O2CfMXS0pbcWhoGgY27oVfS0p0cWJoV0Y2svmN2ZM1mNp&r=TUldziJCtpCmhWlvsmCioLwWtWaizY&q=OpC3hW7IWhodRDvOvmfCyY2slGdOlGvOWJXOWho2ZDvXfGbOWDbOwm4cWJesr&nid=721',
title: '数学在古代中国的应用'
}
]
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,24 @@
<view class="container">
<view class="title">视频介绍</view>
<view class="video-section">
<video src="https://kvideo01.youju.sohu.com/2091f24d-6c1b-4992-b5fa-925d6ee87f162_0_0.mp4?sign=b36a42ceac968f048902b3256deb040e&t=1718629716" controls class="video-player"></video>
</view>
<view class="description-section">
<view class="section-title">视频简介</view>
<view class="section-content">
本视频介绍了中国古代数学的发展历程,包括重要的数学家、定理和计算方法。通过观看本视频,您将对中国古代数学有一个全面的了解。
</view>
</view>
<view class="related-videos-section">
<view class="section-title">相关视频推荐</view>
<view class="related-videos">
<view wx:for="{{relatedVideos}}" wx:key="index" class="related-video">
<video src="{{item.thumbnail}}" mode="aspectFill" class="related-video-thumbnail"></video>
<text class="related-video-title">{{item.title}}</text>
</view>
</view>
</view>
<view class="back-btn">
<navigator url="/pages/index/index">返回首页</navigator>
</view>
</view>

@ -0,0 +1,72 @@
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
}
.title {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}
.video-section {
width: 100%;
margin-bottom: 20px;
}
.video-player {
width: 100%;
height: 400px;
}
.description-section,
.related-videos-section {
width: 100%;
margin-bottom: 20px;
}
.section-title {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.section-content {
font-size: 16px;
line-height: 1.5;
}
.related-videos {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.related-video {
width: 48%;
margin-bottom: 10px;
}
.related-video-thumbnail {
width: 100%;
height: 0;
padding-bottom: 75%; /* 16:9 aspect ratio */
background-size: cover;
margin-bottom: 5px;
}
.related-video-title {
font-size: 16px;
line-height: 1.5;
}
.back-btn {
font-size: 18px;
color: #1AAD19;
text-decoration: none;
padding: 10px 20px;
border: 1px solid #1AAD19;
border-radius: 5px;
}

@ -0,0 +1,28 @@
{
"compileType": "miniprogram",
"libVersion": "trial",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"condition": {},
"editorSetting": {
"tabIndent": "auto",
"tabSize": 2
},
"appid": "wxfabab2225eb5630e"
}

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "%E4%B8%AD%E5%9B%BD%E5%8F%A4%E4%BB%A3%E6%95%B0%E5%AD%A6",
"setting": {
"compileHotReLoad": true
}
}

@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

@ -0,0 +1,19 @@
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : `0${n}`
}
module.exports = {
formatTime
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Loading…
Cancel
Save