Commit 36861007 authored by 刘文虎's avatar 刘文虎

修改日历组件,构建行程页

parent f21b694a
Pipeline #2750 canceled with stages
<template>
<view class="ab-button" :style="{ fontSize: fontSize + 'rpx', width: width + 'rpx', height: height + 'rpx' ,color:color}" hover-class="u-hover-class">
<u-icon :name="leftIcon" v-if="leftIcon" :size="fontSize" class="ab-button-left"></u-icon>
<text>{{ content }}</text>
<u-icon :name="rightIcon" v-if="rightIcon" :size="fontSize" class="ab-button-right"></u-icon>
</view>
</template>
<script>
export default {
name:"ab-button",
props: {
leftIcon: {
type: String,
default: ''
},
rightIcon: {
type: String,
default: ''
},
fontSize: {
type: String | Number,
default: '24'
},
content: {
type: String,
default: '确定'
},
width: {
type: String | Number,
default: '160'
},
height: {
type: String | Number,
default: '64'
},
color:{
type: String ,
default: '#ffffff'
}
},
data() {
return {};
}
};
</script>
<style lang="scss" scoped>
.ab-button{
display: flex;
align-items: center;
justify-content: center;
background: $default-color;
font-size: $ab-font-size-sm;
border-radius: 8upx;
// width: 160upx;
// height: 64upx;
&-left{
margin-right: 12upx;
}
&-right{
margin-left: 12upx;
}
}
</style>
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
"navigationBarBackgroundColor": "#F8F8F8", "navigationBarBackgroundColor": "#F6F7FA",
"backgroundColor": "#F8F8F8" "backgroundColor": "#F6F7FA"
}, },
"tabBar": { "tabBar": {
"color": "#909399", "color": "#909399",
......
<template>
<view class="plan-view">
<view class="plan-view-head">
<view class="plan-view-head-title">代办计划</view>
<ab-button content="添加计划" left-icon="plus"></ab-button>
</view>
</view>
</template>
<script>
import AbButton from '@/components/common/ab-button.vue';
export default {
name: 'plan-view',
components: {
AbButton
},
data() {
return {};
}
};
</script>
<style lang="scss" scoped>
.plan-view {
&-head {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24upx;
&-title {
font-size: 32upx;
font-weight: bold;
color: #333333;
}
}
}
</style>
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
></lunc-calendar> ></lunc-calendar>
</view> </view>
<view class=""> <view class="">
<button @click="toAdd">添加行程</button> <plan-view></plan-view>
<!-- <button @click="toAdd">添加行程</button> -->
</view> </view>
<mid-popup ref="midPopup"></mid-popup> <mid-popup ref="midPopup"></mid-popup>
<u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar> <u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar>
...@@ -27,30 +28,32 @@ ...@@ -27,30 +28,32 @@
import LxCalendar from '@/components/lx-calendar/lx-calendar.vue'; import LxCalendar from '@/components/lx-calendar/lx-calendar.vue';
import MidPopup from '@/components/mid-popup/mid-popup.vue'; import MidPopup from '@/components/mid-popup/mid-popup.vue';
import NavbarNormal from '@/components/navbar-normal'; import NavbarNormal from '@/components/navbar-normal';
import PlanView from "./components/plan-view.vue"
import { tabbar } from '@/utils/settings.js'; import { tabbar } from '@/utils/settings.js';
export default { export default {
components: { components: {
MidPopup, MidPopup,
NavbarNormal, NavbarNormal,
LxCalendar, LxCalendar,
PlanView
}, },
data() { data() {
return { return {
tabbar, tabbar,
signList: [ signList: [
{ {
date: '2022-07-05', date: '2022-07-08',
title: '张三生日', // title: '张三生日',
info: '八月初四张三生日' info: '八月初四张三生日'
}, },
{ {
date: '2022-07-07', date: '2022-07-09',
title: '生日', // title: '生日',
info: '八月初四张三生日' info: '八月初四张三生日'
}, },
{ {
date: '2022-07-09', date: '2022-07-12',
title: '朋友聚会' // title: '朋友聚会'
} }
] ]
}; };
......
<template>
<u-popup v-model="show" border-radius="24" safe-area-inset-bottom mode="bottom">
<view class="calculator-popup">
<view class="calculator-popup-top">
<text class="calculator-popup-top-left">取消</text>
<text class="calculator-popup-top-right">确定</text>
</view>
<lunc-calendar
:showLunar="true"
:showMonthBg="false"
:shouChangeBtn="true"
firstDayOfWeek="sunday"
:weekend="true"
@dayChange="dayChange"
@monthChange="monthChange"
@chooseMonth="chooseMonth"
></lunc-calendar>
</view>
</u-popup>
</template>
<script>
export default {
name: 'calculator-popup',
props: {},
data() {
return {
show: false
};
},
methods: {
open() {
this.show = true;
},
close() {
this.show = false;
},
dayChange(e) {
console.log('dayChange', e);
this.$emit('change', e);
},
monthChange(e) {
console.log('monthChange', e);
},
chooseMonth(selDate) {
console.log('selDate', selDate);
}
}
};
</script>
<style lang="scss" scoped>
.calculator-popup {
padding: 32upx;
}
.calculator-popup-top {
display: flex;
align-items: center;
justify-content: space-between;
&-left {
color: rgb(96, 98, 102);
}
&-right {
color: rgb(41, 121, 255);
&:active{
opacity: 0.7;
}
}
}
</style>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<script> <script>
export default { export default {
name:"checkbox-group", name: 'checkbox-groups',
props: { props: {
checked: { checked: {
type: Number | String, type: Number | String,
...@@ -24,8 +24,7 @@ export default { ...@@ -24,8 +24,7 @@ export default {
}, },
methods: { methods: {
handleCheck(item) { handleCheck(item) {
console.log(item); this.$emit('handleClick',item);
this.$emit('click', item);
} }
} }
}; };
......
...@@ -4,40 +4,46 @@ ...@@ -4,40 +4,46 @@
<u-form :model="form" ref="uForm" label-position="top" :error-type="errorType" label-width="180"> <u-form :model="form" ref="uForm" label-position="top" :error-type="errorType" label-width="180">
<u-form-item label="计划类型:" prop="type"> <u-form-item label="计划类型:" prop="type">
<view class="input-view"> <view class="input-view">
<CheckboxGroup :checked="form.type" :options="scheduleTypeOptions" @click="scheduleTypeChange" ></CheckboxGroup> <checkbox-groups :checked="form.type" :options="scheduleTypeOptions" @handleClick="scheduleTypeChange" ></checkbox-groups>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="计划时间:" prop="createdTime"> <u-form-item label="计划时间:" prop="createdTime">
<view class="input-view"> <view class="input-view">
<input type="text" v-model="form.createdTime" placeholder="请选择" class="field-input" /> <view class="input-view-item">
<u-icon name="scan" color="#272727" size="28" class="field-icon" @click="toScan('createdTime')"></u-icon> <u-input v-model="form.date" type="select" border="true" @click="openCalculatorPopup" />
</view> </view>
</view>
</u-form-item>
<u-form-item label="提醒设置:" prop="setting">
<checkbox-groups :checked="form.setting" :options="scheduleSettingOptions" @handleClick="scheduleSettingChange" ></checkbox-groups>
</u-form-item> </u-form-item>
<u-form-item label="提醒设置:" prop="setting"></u-form-item>
</u-form> </u-form>
</view> </view>
<view class=""><button @click="startRecording">录音</button></view> <view class=""><button @click="startRecording">录音</button></view>
<u-popup v-model="soundShow" mode="bottom" border-radius="14" safe-area-inset-bottom> <u-popup v-model="soundShow" mode="bottom" border-radius="14" safe-area-inset-bottom>
<sound-recording ref="sound-recording" @cancel="soundCancel" @confirm="soundConfirm"></sound-recording> <sound-recording ref="sound-recording" @cancel="soundCancel" @confirm="soundConfirm"></sound-recording>
</u-popup> </u-popup>
<calculator-popup ref="calculator-popup" @change="calculatorChange"></calculator-popup>
</view> </view>
</template> </template>
<script> <script>
import SoundRecording from '@/components/sound-recording/sound-recording.vue'; import SoundRecording from '@/components/sound-recording/sound-recording.vue';
import CheckboxGroup from './components/checkbox-group.vue'; import CheckboxGroups from './components/checkbox-groups.vue';
import CalculatorPopup from './components/calculator-popup.vue';
import { authorize, openSetting, showModal } from '@/utils/auth.js'; import { authorize, openSetting, showModal } from '@/utils/auth.js';
import { scheduleTypeOptions } from '@/utils/options/schedule'; import { scheduleTypeOptions,scheduleSettingOptions } from '@/utils/options/schedule';
export default { export default {
components: { SoundRecording, CheckboxGroup }, components: { SoundRecording, CheckboxGroups,CalculatorPopup },
data() { data() {
return { return {
scheduleTypeOptions, scheduleTypeOptions,
scheduleSettingOptions,
soundShow: false, // 录音弹框 soundShow: false, // 录音弹框
form: { form: {
type: '', type: '1',
createdTime: '', createdTime: '',
setting: '' setting: '1'
}, },
errorType: ['toast', 'border-bottom'], errorType: ['toast', 'border-bottom'],
rules: { rules: {
...@@ -78,8 +84,16 @@ export default { ...@@ -78,8 +84,16 @@ export default {
this.soundShow = false; this.soundShow = false;
}, },
scheduleTypeChange(item) { scheduleTypeChange(item) {
console.log(item);
this.form.type = item.value; this.form.type = item.value;
},
scheduleSettingChange(item){
this.form.setting = item.value;
},
openCalculatorPopup() {
this.$refs["calculator-popup"].open()
},
calculatorChange(e){
console.log('calculatorChange', e);
} }
} }
}; };
......
page { page {
background-color: #F2F6F9; background-color: #F6F7FA;
} }
uni-page-body, uni-page-body,
......
// 橙色渐变色 // 橙色渐变色
$orange-linear-gradient: linear-gradient(-45deg, #EB7A2F, #EB872F); $orange-linear-gradient: linear-gradient(-45deg, #eb7a2f, #eb872f);
// 橙色字体 // 橙色字体
$orange-color:#EB872F; $orange-color: #eb872f;
// 默认字体黑色 // 默认字体黑色
$default-text-color:#2E2E2E; $default-text-color: #2e2e2e;
// 底边框色 // 底边框色
$default-border-color:#E1E4F5; $default-border-color: #e1e4f5;
// 窗口背景色 // 窗口背景色
$default-background-color:#FAF9F7; $default-background-color: #F6F7FA;
/* 文字尺寸 */ /* 文字尺寸 */
$hs-font-size-sm:24upx; $ab-font-size-sm: 24upx;
$hs-font-size-base:28upx; $ab-font-size-base: 28upx;
$hs-font-size-lg:32upx; $ab-font-size-lg: 32upx;
// 基础行高 // 基础行高
$base-line-height:28upx; $base-line-height: 28upx;
// 主题颜色
$default-color: #02a074;
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
<view class="lunc-calendar"> <view class="lunc-calendar">
<!-- 头部按钮及月份 --> <!-- 头部按钮及月份 -->
<view class="header"> <view class="header">
<view class="head-icon" @click="$u.throttle(goPreMonth, 500)" v-if="shouChangeBtn"><u-icon name="arrow-left" size="32"></u-icon></view> <view class="head-icon" @click="$u.throttle(goPreMonth, 500)" v-if="shouChangeBtn"><u-icon name="arrow-left" size="28"></u-icon></view>
<picker mode="date" :value="date" fields="month" @change="chooseMonth"> <picker mode="date" :value="date" fields="month" @change="chooseMonth">
<view class="head-month" v-show="selDate.year">{{ selDate.year }}年{{ selDate.month < 10 ? '0' + selDate.month : selDate.month }}月</view> <view class="head-month">
<text v-show="selDate.year">{{ selDate.year }}年{{ selDate.month < 10 ? '0' + selDate.month : selDate.month }}月</text>
</view>
</picker> </picker>
<view class="head-icon" @click="$u.throttle(goNextMonth, 500)" v-if="shouChangeBtn"><u-icon name="arrow-right" size="32"></u-icon></view> <view class="head-icon" @click="$u.throttle(goNextMonth, 500)" v-if="shouChangeBtn"><u-icon name="arrow-right" size="26"></u-icon></view>
<!-- <view class="go-to-today" v-show="showToday" @click="goToday">回到今天</view> --> <!-- <view class="go-to-today" v-show="showToday" @click="goToday">回到今天</view> -->
</view> </view>
<!-- 星期 --> <!-- 星期 -->
...@@ -19,31 +21,28 @@ ...@@ -19,31 +21,28 @@
<swiper-item class="swiper-item" v-for="(item, index) in allDataArr" :key="index"> <swiper-item class="swiper-item" v-for="(item, index) in allDataArr" :key="index">
<view class="bg-month" v-show="showMonthBg">{{ item[15].sMonth < 10 ? '0' + item[15].sMonth : item[15].sMonth }}</view> <view class="bg-month" v-show="showMonthBg">{{ item[15].sMonth < 10 ? '0' + item[15].sMonth : item[15].sMonth }}</view>
<view class="month-days"> <view class="month-days">
<view class="day" v-for="(d, j) in item" :key="j" @click="clickDay(d)"> <view class="day" v-for="(d, j) in item" :key="j" @click="clickDay(d, true)">
<view <view
class="day-info" class="day-info"
:class="[ :class="[
d.dayClass, d.dayClass,
selDate.year === d.sYear && selDate.month === d.sMonth && selDate.day === d.day ? 'is-sel' : '', selDate.year === d.sYear && selDate.month === d.sMonth && selDate.day === d.day ? 'is-sel' : '',
d.pastTime ? 'past-time' : '' today.year === d.sYear && today.month === d.sMonth && today.day === d.day ? 'be-today' : '',
]" ]"
> >
<text <text
class="day-solar" class="day-solar"
:class="{'past-time' : d.pastTime, 'day-today': today.year === d.sYear && today.month === d.sMonth && today.day === d.day }" :class="{ 'day-today': today.year === d.sYear && today.month === d.sMonth && today.day === d.day }"
> >
{{ today.year === d.sYear && today.month === d.sMonth && today.day === d.day ? '今天' : d.day }} {{ today.year === d.sYear && today.month === d.sMonth && today.day === d.day ? '今天' : d.day }}
</text> </text>
<text <text
class="day-tag" class="day-tag"
:style="{backgroundColor: d.pastTime ? '#dddddd' : '' }" :class="{ 'past-time': d.pastTime }"
:class="{'past-time' : d.pastTime}"
v-if="d.daySign && JSON.stringify(d.daySign) != '{}'" v-if="d.daySign && JSON.stringify(d.daySign) != '{}'"
></text> ></text>
<text class="day-sign" :class="{'past-time' : d.pastTime}" v-if="d.daySign && JSON.stringify(d.daySign) != '{}'"> <text class="day-sign" v-if="d.daySign && JSON.stringify(d.daySign) != '{}'">{{ d.daySign.title ||d.dayLunar }}</text>
{{ d.daySign.title }} <text class="day-lunar" v-else v-show="showLunar">{{ d.dayLunar }}</text>
</text>
<text class="day-lunar" :class="{'past-time' : d.pastTime}" v-else v-show="showLunar">{{ d.dayLunar }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -143,10 +142,10 @@ export default { ...@@ -143,10 +142,10 @@ export default {
chooseMonth(e) { chooseMonth(e) {
let { value } = e.detail; let { value } = e.detail;
let nd = value + '-' + this.selDate.day; let nd = value + '-' + this.selDate.day;
if(this.isIOS){ if (this.isIOS) {
nd=nd.replace(/-/g, '/') nd = nd.replace(/-/g, '/');
} }
nd=new Date(nd) nd = new Date(nd);
let date = { let date = {
year: nd.getFullYear(), year: nd.getFullYear(),
month: nd.getMonth() + 1, month: nd.getMonth() + 1,
...@@ -357,7 +356,7 @@ export default { ...@@ -357,7 +356,7 @@ export default {
return maxDay; return maxDay;
}, },
//点击日期 //点击日期
clickDay(dayInfo) { clickDay(dayInfo, flag) {
if (this.selDate.day == dayInfo.day && this.selDate.month == dayInfo.month && this.selDate.year == dayInfo.year) return; if (this.selDate.day == dayInfo.day && this.selDate.month == dayInfo.month && this.selDate.year == dayInfo.year) return;
this.selDate.day = dayInfo.day; this.selDate.day = dayInfo.day;
if (dayInfo.dayType == 'normal') { if (dayInfo.dayType == 'normal') {
...@@ -393,55 +392,41 @@ export default { ...@@ -393,55 +392,41 @@ export default {
daySign: dayInfo.daySign daySign: dayInfo.daySign
}; };
if (this.showLunar) returnData['lunar'] = lunar; if (this.showLunar) returnData['lunar'] = lunar;
// 仅点击天数时返回日期
if (flag) {
this.$emit('dayChange', returnData); this.$emit('dayChange', returnData);
}
this.setPickValue(); this.setPickValue();
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.lunc-calendar { .lunc-calendar {
background-color: #fff; // background-color: #fff;
margin-bottom: 40rpx; margin-bottom: 40rpx;
.header { .header {
display: flex; display: flex;
flex-direction: row;
justify-content: center; justify-content: center;
align-items: center;
position: relative; position: relative;
height: 90rpx; height: 80rpx;
line-height: 90rpx; line-height: 80rpx;
border-bottom: 1px solid #ddd; // border-bottom: 1px solid #ddd;
.head-month { .head-month {
font-size: 36rpx; width: 220rpx;
font-size: 28rpx;
text-align: center; text-align: center;
padding: 0 40rpx; line-height: 80rpx;
margin: 0 40rpx;
} }
.head-icon { .head-icon {
width: 60rpx; line-height: 80rpx;
height: 90rpx;
line-height: 90rpx;
align-items: center;
justify-content: center;
// text {
// display: inline-block;
// width: 20rpx;
// height: 20rpx;
// border-top: 4rpx solid #AAA;
// border-left: 4rpx solid #AAA;
// }
} }
.head-pre-month {
transform: rotate(-45deg);
}
.head-next-month {
transform: rotate(135deg);
}
.go-to-today { .go-to-today {
position: absolute; position: absolute;
...@@ -460,15 +445,15 @@ export default { ...@@ -460,15 +445,15 @@ export default {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
border-bottom: 1px solid #eee; // border-bottom: 1px solid #eee;
padding: 16rpx 0; padding: 16rpx 39rpx;
margin: 0 20rpx; // margin: 0 20rpx;
.week-font { .week-font {
flex: 1; width: 96rpx;
text-align: center; text-align: center;
color: #666; color: #666;
font-size: 14px; font-size: 24rpx;
} }
} }
...@@ -476,7 +461,7 @@ export default { ...@@ -476,7 +461,7 @@ export default {
margin: 0 20rpx; margin: 0 20rpx;
.calendar-swiper { .calendar-swiper {
height: 550rpx; height:638rpx;
} }
.swiper-item { .swiper-item {
...@@ -495,35 +480,38 @@ export default { ...@@ -495,35 +480,38 @@ export default {
} }
.month-days { .month-days {
margin-top: 15rpx; // margin-top: 15rpx;
display: block; // display: block;
padding: 0 19rpx;
display: flex;
flex-wrap: wrap;
.day { .day {
width: 14.28%; width: 96rpx;
display: inline-block; display: flex;
text-align: center; text-align: center;
height: 84rpx; height: 96rpx;
color: #000; color: #000;
padding: 0 6rpx;
box-sizing: border-box; box-sizing: border-box;
// overflow: hidden;
.day-info { .day-info {
height: 100%; height: 96rpx;
width: 96rpx;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
position: relative; position: relative;
box-sizing: border-box;
.day-solar { .day-solar {
display: block; display: block;
font-size: 34rpx; font-size: 28rpx;
line-height: 34rpx; line-height: 34rpx;
} }
.day-today{ .day-today {
font-size: 24rpx; font-size: 24rpx;
line-height: 34rpx; line-height: 34rpx;
color: #02a074;
} }
.day-lunar { .day-lunar {
...@@ -535,7 +523,7 @@ export default { ...@@ -535,7 +523,7 @@ export default {
} }
.day-sign { .day-sign {
color: rgba(247, 88, 88, 1); // color: rgba(247, 88, 88, 1);
font-size: 24rpx; font-size: 24rpx;
line-height: 24rpx; line-height: 24rpx;
transform: scale(0.8); transform: scale(0.8);
...@@ -550,10 +538,11 @@ export default { ...@@ -550,10 +538,11 @@ export default {
height: 10rpx; height: 10rpx;
border-radius: 50%; border-radius: 50%;
display: inline-block; display: inline-block;
background-color: rgba(247, 88, 88, 1); // background-color: rgba(247, 88, 88, 1);
background-color: #02a074;
} }
.past-time{ .past-time {
color: #dddddd !important; background-color: #dddddd;
} }
} }
...@@ -564,26 +553,56 @@ export default { ...@@ -564,26 +553,56 @@ export default {
//周末 //周末
.week-end .day-solar { .week-end .day-solar {
color: rgba(255, 137, 137, 1); // color: rgba(255, 137, 137, 1);
} }
//节假日 //节假日
.is-festival .day-lunar, .is-festival .day-lunar,
.is-festival .day-solar { .is-festival .day-solar {
color: rgba(247, 88, 88, 1); // color: rgba(247, 88, 88, 1);
} }
//今天日期 //今天日期
.is-today .day-solar, .is-today .day-solar,
.is-today .day-lunar { .is-today .day-lunar {
color: #409eff; // color: #409eff;
color: #02a074;
}
.be-today{
background-color: #ffffff;
border: 2rpx solid #02a074;
border-radius: 16rpx;
box-sizing: border-box;
.day-today{
color: #333333;
}
.day-sign{
color: #333333;
}
} }
//选择日期 //选择日期
.is-sel { .is-sel {
background-color: rgba(198, 226, 255, 1); // background-color: rgba(198, 226, 255, 1);
background: #02a074;
border-radius: 16rpx;
color: #ffffff;
box-sizing: border-box;
.day-today{
color: #ffffff;
}
.day-sign{
color: #ffffff;
}
.day-tag {
background-color: #ffffff;
}
.day-lunar{
color: #ffffff;
}
.past-time {
background-color: #ffffff;
}
} }
} }
} }
} }
......
...@@ -7,3 +7,17 @@ export const scheduleTypeOptions = [{ ...@@ -7,3 +7,17 @@ export const scheduleTypeOptions = [{
label: "生活" label: "生活"
}, },
] ]
export const scheduleSettingOptions = [{
value: "1",
label: "30分钟前"
},
{
value: "2",
label: "1小时前"
},
{
value: "3",
label: "2小时前"
},
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment