|
@@ -12,7 +12,7 @@
|
|
|
|
|
|
<view class="journal" v-if="journalData && Object.keys(journalData).length > 0">
|
|
|
<view class="title">手账</view>
|
|
|
- <uni-card @click.stop="handleAddJournal(journalData.id, journalData.description)">
|
|
|
+ <uni-card @tap="handleUpdateJournal(journalData.id, journalData.description)">
|
|
|
<view class="d-flex align-center">
|
|
|
<view class="line"></view>
|
|
|
<view class="date">{{ journalData.date }}</view>
|
|
@@ -21,7 +21,7 @@
|
|
|
</uni-card>
|
|
|
</view>
|
|
|
|
|
|
- <view class="add-btn" @click.stop="handleAddJournal">
|
|
|
+ <view class="add-btn" @tap="handleAddJournal">
|
|
|
<uni-icons type="plusempty" size="30" color="#fff"></uni-icons>
|
|
|
</view>
|
|
|
|
|
@@ -33,7 +33,12 @@
|
|
|
<view class="yinli">{{ calendarInfo.yinli }}</view>
|
|
|
<view class="d-flex align-center justify-center">
|
|
|
<span style="color: #7f7f7f;">幸运色</span>
|
|
|
- <view class="luckyColor ss-m-l-20" :style="{ 'background-color': `${currentColor || '#2979ff'}` }"></view>
|
|
|
+ <span v-if="calendarInfo.color === '白'" class="ss-m-l-20" style="color: #7f7f7f;">白色</span>
|
|
|
+ <view
|
|
|
+ v-else
|
|
|
+ class="luckyColor ss-m-l-20"
|
|
|
+ :style="{ 'background-color': `${colorDict[calendarInfo.color] || '#2979ff'}` }"
|
|
|
+ ></view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="center-box ss-p-y-30 ss-p-x-30">
|
|
@@ -95,6 +100,14 @@ import { getDrawLots } from '@/api/drawLots.js'
|
|
|
import layoutPage from '@/layout'
|
|
|
import { showAuthModal, closeAuthModal } from '@/hooks/useModal'
|
|
|
|
|
|
+const colorDict = {
|
|
|
+ '白': '#FAFAFA',
|
|
|
+ '黑': '#212121',
|
|
|
+ '绿': '#43A047',
|
|
|
+ '红': '#F44336',
|
|
|
+ '黄': '#FDD835'
|
|
|
+}
|
|
|
+
|
|
|
const journalData = ref({
|
|
|
id: 1,
|
|
|
date: '2025-08-27',
|
|
@@ -162,7 +175,7 @@ const journalData = ref({
|
|
|
|
|
|
onLoad(() => {
|
|
|
// showAuthModal()
|
|
|
- closeAuthModal()
|
|
|
+ // closeAuthModal()
|
|
|
|
|
|
// 设置选中项
|
|
|
setTimeout(() => {
|
|
@@ -172,7 +185,6 @@ const journalData = ref({
|
|
|
|
|
|
|
|
|
const popupRef = ref()
|
|
|
- const currentColor = ref(null)
|
|
|
|
|
|
const calendarInfo = ref({})
|
|
|
const handleChange = async (e) => {
|
|
@@ -181,11 +193,9 @@ const journalData = ref({
|
|
|
try {
|
|
|
const { result } = await getDrawLots({ date: e.fulldate })
|
|
|
if (!result) return uni.showToast({ title: '黄历信息获取失败', icon: 'none' })
|
|
|
- console.log(result, '成功信息')
|
|
|
calendarInfo.value = result || {}
|
|
|
|
|
|
popupRef.value.open()
|
|
|
- currentColor.value = result?.color || e.extraInfo?.color
|
|
|
} catch (error) {
|
|
|
console.log(error, '错误信息')
|
|
|
}
|
|
@@ -193,16 +203,20 @@ const journalData = ref({
|
|
|
|
|
|
const handleClose = () => {
|
|
|
popupRef.value.close()
|
|
|
- currentColor.value = null
|
|
|
calendarInfo.value = {}
|
|
|
}
|
|
|
|
|
|
// 添加手账
|
|
|
- const handleAddJournal = (id, text) => {
|
|
|
- let url = `/pages/drawLots/journal`
|
|
|
- if (id) url += `?id=${id}&text=${text}`
|
|
|
+ const handleAddJournal = () => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/drawLots/journal'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新手账
|
|
|
+ const handleUpdateJournal = (id, text) => {
|
|
|
uni.navigateTo({
|
|
|
- url
|
|
|
+ url: `/pages/drawLots/journal?id=${id}&text=${text}`
|
|
|
})
|
|
|
}
|
|
|
</script>
|