五运六气

This commit is contained in:
@fawn-nine
2023-11-17 17:43:28 +08:00
parent 1172043635
commit 880d75eec1
5 changed files with 649 additions and 4 deletions

View File

@@ -7,9 +7,9 @@ if (process.env.NODE_ENV === 'development') {
// baseUrl = "https://twin-ui.com/demo/";
// baseUrl = "http://59.110.212.44:9200/pb/";
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
baseUrl = "https://api.nuttyreading.com/"; // 线上正式
// baseUrl = "https://api.nuttyreading.com/"; // 线上正式
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
// baseUrl = "http://192.168.110.110:9200/pb/";
baseUrl = "http://192.168.110.110:9200/pb/";
// baseUrl = "http://192.168.110.38:9200/pb/"; // 吴春磊笔记本1
// socketUrl = "ws://8.129.186.35:6001/";
} else if (process.env.NODE_ENV === 'production') {

View File

@@ -508,6 +508,14 @@
"navigationBarTitleText" : "脉穴详情",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/luck/luck",
"style" :
{
"navigationBarTitleText" : "五运六气",
"enablePullDownRefresh" : false
}
}
],
"globalStyle": {

View File

@@ -0,0 +1,287 @@
<template>
<view class="container">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> -->
<z-nav-bar title="五运六气"></z-nav-bar>
<view class="">
<canvas style="width: 100%; height:100vh;" canvas-id="firstCanvas" id="firstCanvas"></canvas>
</view>
<music-play :playData="playData"></music-play>
<z-navigation></z-navigation>
</view>
</template>
<script>
import musicPlay from '@/components/music.vue'
import $http from '@/config/requestConfig.js';
export default {
data() {
return {
playData: {},
pageWidth: uni.getSystemInfoSync().windowWidth,
pageHeight: uni.getSystemInfoSync().windowHeight - 200,
fiveYunNum: 5,
zhuyun: [],
keyun: [],
nianyun: '',
fiveTimes: []
}
},
onLoad() {
this.getYun()
},
onReady: function(e) {
},
onHide() {
},
methods: {
getpanOne() {
console.log(this.nianyun, 'nuanyun')
var myCanvas = uni.createCanvasContext('firstCanvas')
//将原点设置100,100位置
myCanvas.translate(0, 0);
//原点在100,100则圆心设为0,0 ——> 100,100的位置
myCanvas.setStrokeStyle("#00ff00")
myCanvas.setLineWidth(1)
// myCanvas.fillStyle = "#f3b2a7"
// myCanvas.rect(0, 0, 200, 200)
// myCanvas.stroke()
myCanvas.setLineWidth(1)
// console.log(-Math.PI/5,'-Math.PI/2')
let yunNum = 360 / 5
var angle = Math.PI * 2 / 5;
// let startAng = 0
// console.log(angle,'angle')
var deg = Math.PI / 180
// 最大圈
for (var i = 0; i < this.fiveYunNum; i++) {
myCanvas.setStrokeStyle("#000")
let n = i + 1
myCanvas.beginPath();
myCanvas.moveTo(this.pageWidth / 2, this.pageHeight / 2)
myCanvas.arc(this.pageWidth / 2, this.pageHeight / 2, 160, -deg * i * yunNum, -deg * yunNum * n, true)
myCanvas.font = 'normal 16px Arial'
myCanvas.fillStyle = "#f3b2a7"
myCanvas.fill();
myCanvas.closePath();
myCanvas.stroke()
}
for (var i = 0; i < this.fiveYunNum; i++) {
myCanvas.setStrokeStyle("#000")
let n = i + 1
myCanvas.beginPath();
myCanvas.moveTo(this.pageWidth / 2, this.pageHeight / 2)
myCanvas.arc(this.pageWidth / 2, this.pageHeight / 2, 90, -deg * i * yunNum, -deg * yunNum * n, true)
myCanvas.closePath();
myCanvas.fillStyle = "#fef9e4"
myCanvas.fill();
myCanvas.stroke()
}
// 中间的主运
myCanvas.beginPath();
myCanvas.arc(this.pageWidth / 2, this.pageHeight / 2, 30, 0, 2 * Math.PI, true)
myCanvas.fillStyle = "#f8d8d5"
myCanvas.fill();
myCanvas.fillStyle = "#000"
myCanvas.fillText(this.nianyun, this.pageWidth / 2 - 9, this.pageHeight / 2 + 6)
myCanvas.closePath();
myCanvas.stroke()
// 绘制文字(主运)
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.zhuyun[0], this.pageWidth / 2 + 90, this.pageHeight / 2 + 70)
myCanvas.closePath();
myCanvas.stroke()
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.zhuyun[1], this.pageWidth / 2 - 30, this.pageHeight / 2 + 120)
myCanvas.closePath();
myCanvas.stroke()
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.zhuyun[2], this.pageWidth / 2 - 140, this.pageHeight / 2)
myCanvas.closePath();
myCanvas.stroke()
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.zhuyun[3], this.pageWidth / 2 - 50, this.pageHeight / 2 - 120)
myCanvas.closePath();
myCanvas.stroke()
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.zhuyun[4], this.pageWidth / 2 + 90, this.pageHeight / 2 - 70)
myCanvas.closePath();
myCanvas.stroke()
// 结束
// 绘制文字(客运)
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.keyun[0], this.pageWidth / 2 + 40, this.pageHeight / 2 + 40)
myCanvas.closePath();
myCanvas.stroke()
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.keyun[1], this.pageWidth / 2 - 20, this.pageHeight / 2 + 60)
myCanvas.closePath();
myCanvas.stroke()
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.keyun[2], this.pageWidth / 2 - 70, this.pageHeight / 2)
myCanvas.closePath();
myCanvas.stroke()
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.keyun[3], this.pageWidth / 2 - 30, this.pageHeight / 2 - 50)
myCanvas.closePath();
myCanvas.stroke()
myCanvas.beginPath();
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 16px Arial'
// myCanvas.rotate((Math.PI/180)*5)
myCanvas.fillText(this.keyun[4], this.pageWidth / 2 + 30, this.pageHeight / 2 - 20)
myCanvas.closePath();
myCanvas.stroke()
// 结束
// 绘制时间
// myCanvas.beginPath();
myCanvas.save();
myCanvas.translate(this.pageWidth / 2 + 170, this.pageHeight / 2 - 30);
myCanvas.rotate(90 * Math.PI / 180 );
// console.log(30 * Math.PI / 180 )
myCanvas.fillStyle = "#000"
// myCanvas.textBaseline = 'middle'
myCanvas.font = 'normal 12px Arial'
myCanvas.fillText(this.fiveTimes[0], 0, 0)
// myCanvas.closePath();
myCanvas.restore()
// myCanvas.beginPath();
myCanvas.save();
myCanvas.translate(this.pageWidth / 2 + 80, this.pageHeight / 2 + 150);
myCanvas.rotate((90+yunNum) * Math.PI / 180 );
// console.log(30 * Math.PI / 180 )
myCanvas.fillStyle = "#000"
// myCanvas.textBaseline = 'middle'
myCanvas.font = 'normal 12px Arial'
myCanvas.fillText(this.fiveTimes[1], 0, 0)
// myCanvas.closePath();
myCanvas.restore()
myCanvas.save();
myCanvas.translate(this.pageWidth / 2 - 120, this.pageHeight / 2 + 120);
myCanvas.rotate((90+yunNum*2) * Math.PI / 180 );
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 12px Arial'
myCanvas.fillText(this.fiveTimes[2], 0, 0)
myCanvas.restore()
myCanvas.save();
myCanvas.translate(this.pageWidth / 2 - 160, this.pageHeight / 2 - 70);
myCanvas.rotate((90+yunNum*3) * Math.PI / 180 );
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 12px Arial'
myCanvas.fillText(this.fiveTimes[3], 0, 0)
myCanvas.restore()
myCanvas.save();
myCanvas.translate(this.pageWidth / 2 + 20, this.pageHeight / 2 - 170);
myCanvas.rotate((90+yunNum*4) * Math.PI / 180 );
myCanvas.fillStyle = "#000"
myCanvas.font = 'normal 12px Arial'
myCanvas.fillText(this.fiveTimes[4], 0, 0)
myCanvas.restore()
myCanvas.draw()
},
getYun() {
$http.request({
url: "book/point/TGDZForYear",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"date": "2023-11-16 13:25:15"
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0 && res.tgdz) {
console.log('获取成功', res.tgdz)
this.zhuyun = res.tgdz.wy.zhuYun
this.keyun = res.tgdz.wy.keYun
this.nianyun = res.tgdz.wy.nianYun
this.fiveTimes = res.tgdz.wy.time
// console.log(this.nianyun,'this.nianyun')
this.getpanOne()
} else {
}
}).catch(e => {
console.log(e, 'e')
});
}
},
components: {
musicPlay
},
}
</script>
<style lang="scss" scoped>
.container {
padding: 10rpx;
height: 100vh;
background-color: #fff;
}
.flexbox {
display: flex;
}
</style>

350
pages/luck/luck.vue Normal file
View File

@@ -0,0 +1,350 @@
<template>
<view class="container">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> -->
<z-nav-bar title="五运六气"></z-nav-bar>
<view>
<!-- {{date}}---{{timestamp}} -->
<!-- <uni-section :title="'date 对象用法:' + datetimesingle" type="line"></uni-section> -->
<view class="datetimeBox">
<uni-datetime-picker type="datetime" v-model="date" @change="changeLog" :clear-icon="false" />
</view>
<view class="flexbox box1 grayBg">
<view class="yunqi">
<view class="">
<text>五运{{wy.zhuyun[wy.now]}}(主运) &nbsp; {{wy.keyun[wy.now]}}(客运) &nbsp; {{wy.nianyun}}(年运)</text>
</view>
<view class="">
<text>六气{{lq.zhuqi[lq.now]}}(主气) &nbsp; {{lq.keqi[lq.now]}}(客气)</text>
</view>
</view>
<!-- <view class="yinli">
<text>{{yinli.year}}</text>
<text>{{yinli.month}}</text>
<text>{{yinli.day}}</text>
<text>{{yinli.hour}}</text>
</view> -->
</view>
</view>
<view class="centerBox">* 五运图左滑查看全年运数</view>
<!-- <scroll-view class="scroll-view_H flexbox" scroll-x="true" @scroll="scroll" > -->
<view class="flexbox scroll-view_H wuYunBox">
<view class="leftone row" id="text">
<view class="line line1">开始时间<br /><span>运数</span></view>
<!-- <view class="">*</view> -->
<view class="line zhuyun">主运</view>
<view class="line keyun">客运</view>
</view>
<view :class="['row', wy.now == 0 ? 'cur' : '']" id="text0">
<view class="line line1">{{wy.fiveTimes[0]}}<br /><span>初之运</span></view>
<view class="line zhuyun">{{wy.zhuyun[0]}}</view>
<view class="line keyun">{{wy.keyun[0]}}</view>
</view>
<view :class="['row', wy.now == 1 ? 'cur' : '']" id="text1">
<view class="line line1">{{wy.fiveTimes[1]}}<br /><span>二之运</span></view>
<view class="line zhuyun">{{wy.zhuyun[1]}}</view>
<view class="line keyun">{{wy.keyun[1]}}</view>
</view>
<view :class="['row', wy.now == 2 ? 'cur' : '']" id="text2">
<view class="line line1">{{wy.fiveTimes[2]}}<br /><span>三之运</span></view>
<view class="line zhuyun">{{wy.zhuyun[2]}}</view>
<view class="line keyun">{{wy.keyun[2]}}</view>
</view>
<view :class="['row', wy.now == 3 ? 'cur' : '']" id="text3">
<view class="line line1">{{wy.fiveTimes[3]}}<br /><span>四之运</span></view>
<view class="line zhuyun">{{wy.zhuyun[3]}}</view>
<view class="line keyun">{{wy.keyun[3]}}</view>
</view>
<view :class="['row',wy.now == 4 ? 'cur' : '']" id="text4">
<view class="line line1">{{wy.fiveTimes[4]}}<br /><span>终之运</span></view>
<view class="line zhuyun">{{wy.zhuyun[4]}}</view>
<view class="line keyun">{{wy.keyun[4]}}</view>
</view>
</view>
<!-- </scroll-view> -->
<view class="centerBox">* 六气图左滑查看全年气数</view>
<scroll-view class="scroll-view_H flexbox" scroll-x="true" @scroll="scroll" :scroll-left="200">
<!-- <view class="flexbox scroll-view_H"> -->
<view class="leftone row">
<view class="line line1">开始时间<br /><span>气数</span></view>
<!-- <view class="">*</view> -->
<view class="line zhuyun">主气</view>
<view class="line keyun">客气</view>
</view>
<view :class="['row', lq.now == 0 ? 'cur' : '']">
<view class="line line1">{{lq.time[0]}}<br /><span>初之气</span></view>
<view class="line zhuyun">{{lq.zhuqi[0]}}</view>
<view class="line keyun">{{lq.keqi[0]}}</view>
</view>
<view :class="['row', lq.now == 1 ? 'cur' : '']">
<view class="line line1">{{lq.time[1]}}<br /><span>二之气</span></view>
<view class="line zhuyun">{{lq.zhuqi[1]}}</view>
<view class="line keyun">{{lq.keqi[1]}}</view>
</view>
<view :class="['row', lq.now == 2 ? 'cur' : '']">
<view class="line line1">{{lq.time[2]}}<br /><span>三之气</span></view>
<view class="line zhuyun">{{lq.zhuqi[2]}}</view>
<view class="line keyun">{{lq.keqi[2]}}</view>
</view>
<view :class="['row', lq.now == 3 ? 'cur' : '']">
<view class="line line1">{{lq.time[3]}}<br /><span>四之气</span></view>
<view class="line zhuyun">{{lq.zhuqi[3]}}</view>
<view class="line keyun">{{lq.keqi[3]}}</view>
</view>
<view :class="['row', lq.now == 4 ? 'cur' : '']">
<view class="line line1">{{lq.time[4]}}<br /><span>五之气</span></view>
<view class="line zhuyun">{{lq.zhuqi[4]}}</view>
<view class="line keyun">{{lq.keqi[4]}}</view>
</view>
<view :class="['row', lq.now == 5 ? 'cur' : '']">
<view class="line line1">{{lq.time[5]}}<br /><span>终之气</span></view>
<view class="line zhuyun">{{lq.zhuqi[5]}}</view>
<view class="line keyun">{{lq.keqi[5]}}</view>
</view>
<!-- </view> -->
</scroll-view>
<music-play :playData="playData"></music-play>
<z-navigation></z-navigation>
</view>
</template>
<script>
import musicPlay from '@/components/music.vue'
import $http from '@/config/requestConfig.js';
function formatDateTime(time) {
var date = new Date(time);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
};
export default {
data() {
return {
playData: {},
pageWidth: uni.getSystemInfoSync().windowWidth,
pageHeight: uni.getSystemInfoSync().windowHeight - 200,
fiveYunNum: 5,
// date: new Date().toISOString().slice(0, 10), // 只返回年月日
date: Date.now() - 2 * 24 * 3600 * 1000, // 返回年月日带时间
dateToString: formatDateTime(new Date()), // 字符串格式的日期
timestamp: Date.now() - 2 * 24 * 3600 * 1000, // 时间戳
wy: {
curTime:0,
zhuyun: [],
keyun: [],
nianyun: '',
fiveTimes: []
},
showCalendar: false,
info: {
lunar: true,
range: true,
insert: false,
selected: []
},
lq: {
curTime:0,
zhuqi: [],
keqi: [],
time: []
},
yinli: {
year: '',
month: '',
day: '',
hour: ''
},
wYScrollLeft:0,
lQScrollLeft:0,
wytext:'',
}
},
onLoad() {
let da = new Date().toISOString().slice(0, 10)
this.timestamp = new Date(da).getTime()
this.getYun(this.dateToString)
},
onHide() {
},
methods: {
scroll: function(e) {},
// 获取五运六气
getYun(date) {
let that = this
$http.request({
url: "book/point/WYLQForYear",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"date": date
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0 && res.wylq) {
console.log('获取成功', res.wylq)
this.wy.zhuyun = res.wylq.wy.zhuYun
this.wy.keyun = res.wylq.wy.keYun
this.wy.nianyun = res.wylq.wy.nianYun
this.wy.fiveTimes = res.wylq.wy.time
this.wy.now = res.wylq.wy.now
this.wytext = 'text'+this.wy.now
// this.wy.timestampList = res.wylq.wy.time.map( item => {
// return new Date(item).getTime()
// })
// this.wy.curTime = this.wy.timestampList.find(function(elem){
// return elem > that.timestamp
// });
// console.log(this.wy,'this.wy.curTime',this.timestamp)
// this.yinli.month = res.wylq.month
// this.yinli.day = res.wylq.day
// this.yinli.hour = res.wylq.hour
// this.yinli.year = res.wylq.year
this.lq = res.wylq.lq
// this.wy.now >= 2 ? this.wYScrollLeft = 1800 : 0
// this.lq.now >= 2 ?this.lQScrollLeft = 1800 : 0
// this.lq.timestampList = res.wylq.lq.time.map( item => {
// return new Date(item).getTime()
// })
// console.log(this.wYScrollLeft,this.lQScrollLeft,'this.lq.timestampList')
}
}).catch(e => {
console.log(e, 'e')
});
},
changeLog(e) {
console.log('change事件:', e);
let ss = e.slice(0, 10)
// console.log(e.slice(0, 10),'e.slice(0, 10)')
this.timestamp = new Date(ss).getTime()
this.getYun(e)
},
maskClick(e) {
console.log('maskClick事件:', e);
},
},
components: {
musicPlay
},
}
</script>
<style lang="scss" scoped>
* {
font-size: 28rpx;
}
.centerBox {
text-align: center;
padding: 20px;
color: #ddd;
}
.yinli {
line-height: 50rpx;
text {
writing-mode: vertical-rl;
letter-spacing: 20rpx;
color: #c06346;
}
}
.box1 {
padding: 20rpx;
margin-bottom: 20rpx;
justify-content: space-between;
.yunqi {
color: #c06346;
line-height: 50rpx;
}
}
.grayBg {
background-color: #eee;
}
.scroll-view_H {
white-space: nowrap;
width: 100%;
.leftone {
border-left: 1px solid #ddd;
}
.row {
display: inline-block;
text-align: center;
background-color: #fef9e4;
border-right: 1px solid #ddd;
border-bottom: 1px solid #ddd;
}
.row.cur{background-color: #8d3d16; color: #fff; position: relative; border-right:0;
z-index: 5; box-shadow:0 0 10px #8d3d16;
}
.line {
padding: 20rpx;
border-top: 1px solid #ddd;
span{font-size: 36rpx; }
}
.line1{ font-size: 24rpx; height: 200rpx; writing-mode: vertical-rl;;}
.zhuyun {
color: #8d3d16;
background-color: #faede7;
font-size: 30rpx;
}
.keyun {
color: #c06346;
background-color: #fceeed;
font-size: 30rpx;
}
}
.container {
padding: 10rpx;
background-color: #fff; padding-bottom: 70rpx;
}
.datetimeBox {
width: 80%;
margin: 0 auto;
margin-bottom: 30rpx;
}
.wuYunBox{
.row{width: 20%; box-sizing: border-box;}
}
/deep/ .uni-calendar__content-mobile {
bottom: 100rpx !important;
}
.flexbox {
display: flex;
}
</style>

View File

@@ -20,10 +20,10 @@
<image src="../../static/icon/five2.png" mode="aspectFit"></image>
<text>方药检索</text>
</div> -->
<!-- <div class="item item1">
<div class="item item1" @click="onPageJump('../luck/luck')">
<image src="../../static/icon/five4.png" mode="aspectFit"></image>
<text>五运六气</text>
</div> -->
</div>
<div class="item item1" @click="onPageJump('../peanut/searchFor')">
<image src="../../static/icon/five3.png" mode="aspectFit"></image>
<text>书名检索</text>