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 @@
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "首页",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
"navigationBarBackgroundColor": "#F6F7FA",
"backgroundColor": "#F6F7FA"
},
"tabBar": {
"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 @@
></lunc-calendar>
</view>
<view class="">
<button @click="toAdd">添加行程</button>
<plan-view></plan-view>
<!-- <button @click="toAdd">添加行程</button> -->
</view>
<mid-popup ref="midPopup"></mid-popup>
<u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar>
......@@ -27,30 +28,32 @@
import LxCalendar from '@/components/lx-calendar/lx-calendar.vue';
import MidPopup from '@/components/mid-popup/mid-popup.vue';
import NavbarNormal from '@/components/navbar-normal';
import PlanView from "./components/plan-view.vue"
import { tabbar } from '@/utils/settings.js';
export default {
components: {
MidPopup,
NavbarNormal,
LxCalendar,
PlanView
},
data() {
return {
tabbar,
signList: [
{
date: '2022-07-05',
title: '张三生日',
date: '2022-07-08',
// title: '张三生日',
info: '八月初四张三生日'
},
{
date: '2022-07-07',
title: '生日',
date: '2022-07-09',
// title: '生日',
info: '八月初四张三生日'
},
{
date: '2022-07-09',
title: '朋友聚会'
date: '2022-07-12',
// 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 @@
<script>
export default {
name:"checkbox-group",
name: 'checkbox-groups',
props: {
checked: {
type: Number | String,
......@@ -24,8 +24,7 @@ export default {
},
methods: {
handleCheck(item) {
console.log(item);
this.$emit('click', item);
this.$emit('handleClick',item);
}
}
};
......
......@@ -4,40 +4,46 @@
<u-form :model="form" ref="uForm" label-position="top" :error-type="errorType" label-width="180">
<u-form-item label="计划类型:" prop="type">
<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>
</u-form-item>
<u-form-item label="计划时间:" prop="createdTime">
<view class="input-view">
<input type="text" v-model="form.createdTime" placeholder="请选择" class="field-input" />
<u-icon name="scan" color="#272727" size="28" class="field-icon" @click="toScan('createdTime')"></u-icon>
<view class="input-view-item">
<u-input v-model="form.date" type="select" border="true" @click="openCalculatorPopup" />
</view>
</view>
</u-form-item>
<u-form-item label="提醒设置:" prop="setting"></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>
</view>
<view class=""><button @click="startRecording">录音</button></view>
<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>
</u-popup>
<calculator-popup ref="calculator-popup" @change="calculatorChange"></calculator-popup>
</view>
</template>
<script>
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 { scheduleTypeOptions } from '@/utils/options/schedule';
import { scheduleTypeOptions,scheduleSettingOptions } from '@/utils/options/schedule';
export default {
components: { SoundRecording, CheckboxGroup },
components: { SoundRecording, CheckboxGroups,CalculatorPopup },
data() {
return {
scheduleTypeOptions,
scheduleSettingOptions,
soundShow: false, // 录音弹框
form: {
type: '',
type: '1',
createdTime: '',
setting: ''
setting: '1'
},
errorType: ['toast', 'border-bottom'],
rules: {
......@@ -78,8 +84,16 @@ export default {
this.soundShow = false;
},
scheduleTypeChange(item) {
console.log(item);
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 {
background-color: #F2F6F9;
background-color: #F6F7FA;
}
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;
$hs-font-size-base:28upx;
$hs-font-size-lg:32upx;
$ab-font-size-sm: 24upx;
$ab-font-size-base: 28upx;
$ab-font-size-lg: 32upx;
// 基础行高
$base-line-height:28upx;
$base-line-height: 28upx;
// 主题颜色
$default-color: #02a074;
......@@ -2,11 +2,13 @@
<view class="lunc-calendar">
<!-- 头部按钮及月份 -->
<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">
<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>
<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>
<!-- 星期 -->
......@@ -19,31 +21,28 @@
<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="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
class="day-info"
:class="[
d.dayClass,
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
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 }}
</text>
<text
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) != '{}'"
></text>
<text class="day-sign" :class="{'past-time' : d.pastTime}" v-if="d.daySign && JSON.stringify(d.daySign) != '{}'">
{{ d.daySign.title }}
</text>
<text class="day-lunar" :class="{'past-time' : d.pastTime}" v-else v-show="showLunar">{{ d.dayLunar }}</text>
<text class="day-sign" v-if="d.daySign && JSON.stringify(d.daySign) != '{}'">{{ d.daySign.title ||d.dayLunar }}</text>
<text class="day-lunar" v-else v-show="showLunar">{{ d.dayLunar }}</text>
</view>
</view>
</view>
......@@ -143,10 +142,10 @@ export default {
chooseMonth(e) {
let { value } = e.detail;
let nd = value + '-' + this.selDate.day;
if(this.isIOS){
nd=nd.replace(/-/g, '/')
if (this.isIOS) {
nd = nd.replace(/-/g, '/');
}
nd=new Date(nd)
nd = new Date(nd);
let date = {
year: nd.getFullYear(),
month: nd.getMonth() + 1,
......@@ -357,7 +356,7 @@ export default {
return maxDay;
},
//点击日期
clickDay(dayInfo) {
clickDay(dayInfo, flag) {
if (this.selDate.day == dayInfo.day && this.selDate.month == dayInfo.month && this.selDate.year == dayInfo.year) return;
this.selDate.day = dayInfo.day;
if (dayInfo.dayType == 'normal') {
......@@ -393,55 +392,41 @@ export default {
daySign: dayInfo.daySign
};
if (this.showLunar) returnData['lunar'] = lunar;
this.$emit('dayChange', returnData);
// 仅点击天数时返回日期
if (flag) {
this.$emit('dayChange', returnData);
}
this.setPickValue();
}
}
};
</script>
<style lang="scss">
<style lang="scss" scoped>
.lunc-calendar {
background-color: #fff;
// background-color: #fff;
margin-bottom: 40rpx;
.header {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
position: relative;
height: 90rpx;
line-height: 90rpx;
border-bottom: 1px solid #ddd;
height: 80rpx;
line-height: 80rpx;
// border-bottom: 1px solid #ddd;
.head-month {
font-size: 36rpx;
width: 220rpx;
font-size: 28rpx;
text-align: center;
padding: 0 40rpx;
line-height: 80rpx;
margin: 0 40rpx;
}
.head-icon {
width: 60rpx;
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);
line-height: 80rpx;
}
.head-next-month {
transform: rotate(135deg);
}
.go-to-today {
position: absolute;
......@@ -460,15 +445,15 @@ export default {
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #eee;
padding: 16rpx 0;
margin: 0 20rpx;
// border-bottom: 1px solid #eee;
padding: 16rpx 39rpx;
// margin: 0 20rpx;
.week-font {
flex: 1;
width: 96rpx;
text-align: center;
color: #666;
font-size: 14px;
font-size: 24rpx;
}
}
......@@ -476,7 +461,7 @@ export default {
margin: 0 20rpx;
.calendar-swiper {
height: 550rpx;
height:638rpx;
}
.swiper-item {
......@@ -495,35 +480,38 @@ export default {
}
.month-days {
margin-top: 15rpx;
display: block;
// margin-top: 15rpx;
// display: block;
padding: 0 19rpx;
display: flex;
flex-wrap: wrap;
.day {
width: 14.28%;
display: inline-block;
width: 96rpx;
display: flex;
text-align: center;
height: 84rpx;
height: 96rpx;
color: #000;
padding: 0 6rpx;
box-sizing: border-box;
// overflow: hidden;
.day-info {
height: 100%;
height: 96rpx;
width: 96rpx;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
box-sizing: border-box;
.day-solar {
display: block;
font-size: 34rpx;
font-size: 28rpx;
line-height: 34rpx;
}
.day-today{
.day-today {
font-size: 24rpx;
line-height: 34rpx;
color: #02a074;
}
.day-lunar {
......@@ -535,7 +523,7 @@ export default {
}
.day-sign {
color: rgba(247, 88, 88, 1);
// color: rgba(247, 88, 88, 1);
font-size: 24rpx;
line-height: 24rpx;
transform: scale(0.8);
......@@ -550,10 +538,11 @@ export default {
height: 10rpx;
border-radius: 50%;
display: inline-block;
background-color: rgba(247, 88, 88, 1);
// background-color: rgba(247, 88, 88, 1);
background-color: #02a074;
}
.past-time{
color: #dddddd !important;
.past-time {
background-color: #dddddd;
}
}
......@@ -564,26 +553,56 @@ export default {
//周末
.week-end .day-solar {
color: rgba(255, 137, 137, 1);
// color: rgba(255, 137, 137, 1);
}
//节假日
.is-festival .day-lunar,
.is-festival .day-solar {
color: rgba(247, 88, 88, 1);
// color: rgba(247, 88, 88, 1);
}
//今天日期
.is-today .day-solar,
.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 {
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 = [{
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