| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <template>
- <view class="container">
- <!-- 选择星期区域 -->
- <view class="week_title">
- 选择星期
- </view>
- <view class="week">
- <jlk-week :value="selectedWeeks" @change="changeWeek"></jlk-week>
- </view>
- <!-- 选择打卡时间段区域 -->
- <view class="time_list">
- <view class="title">
- 选择打卡时间段
- </view>
- <view class="add" @click="handleAddTime">
- 添加时段
- </view>
- </view>
- <view class="list">
- <uni-swipe-action>
- <!-- 每一个时间段区域 -->
- <uni-swipe-action-item :auto-close="true" :right-options="options" @click="onClick(item.id)"
- v-for="(item,index) in list" :key="index">
- <view class="item">
- <view class="item_box">
- <picker mode="time" :value="item.startTime" @change="bindTimeChange($event,1,item)">
- <view class="uni-input">
- <view class="input_time">
- {{item.startTime}}
- </view>
- <view class="input_icon">
- <img src="../../static/time.png">
- </view>
- </view>
- </picker>
- </view>
- --
- <view class="item_box">
- <picker mode="time" :value="item.endTime" @change="bindTimeChange($event,2,item)">
- <view class="uni-input">
- <view class="input_time">
- {{item.endTime}}
- </view>
- <view class="input_icon">
- <img src="../../static/time.png">
- </view>
- </view>
- </picker>
- </view>
- </view>
- </uni-swipe-action-item>
- </uni-swipe-action>
- <!-- <view class="edit">
- 编辑
- </view> -->
- </view>
- <!-- switch区域 -->
- <view class="switch">
- <view class="switch_title">
- 除去法定节假日
- </view>
- <view class="switch_button">
- <switch color="#2A82E4" @change="switchChange" />
- </view>
- </view>
- <view class="button">
- 保存
- </view>
- </view>
- </template>
- <script>
- import JlkWeek from '@/uni_modules/jlk-week/components/jlk-week/jlk-week.vue';
- export default {
- components: {
- JlkWeek
- },
- data() {
- return {
- selectedWeeks: [],
- list: [{
- startTime: "00:00",
- endTime: "00:00",
- },
- {
- startTime: "00:00",
- endTime: "00:00",
- },
- ],
- info: {},
- options: [{
- text: '删除',
- style: {
- backgroundColor: '#D43030'
- }
- }],
- }
- },
- onLoad(options) {
- if (options.flag == 1) {
- uni.setNavigationBarTitle({
- title: '添加打卡时间'
- });
- } else {
- uni.setNavigationBarTitle({
- title: '编辑打卡时间'
- });
- this.selectedWeeks = [0, 1]
- // this.info=JSON.parse(options.info)
- // console.log(this.info);
- // let temList=this.info.time.split("、")
- // console.log(temList);
- }
- },
- methods: {
- changeWeek(value) {
- console.log(value);
- this.selectedWeeks = value
- },
- bindTimeChange(e, val, item) {
- console.log(e);
- console.log(val);
- console.log(item);
- if (val == 1) {
- item.startTime = e.detail.value
- } else {
- item.endTime = e.detail.value
- }
- },
- handleAddTime() {
- this.list.push({
- startTime: "00:00",
- endTime: "00:00",
- })
- },
- switchChange(e) {
- console.log('switch1 发生 change 事件,携带值为', e.detail.value)
- },
- // 点击右侧删除按钮回调
- onClick(id) {
- console.log(id);
- uni.showModal({
- title: '提示',
- content: '确定删除该打卡时间段吗?',
- success: function(res) {
- if (res.confirm) {
- console.log('用户点击确定');
- uni.showToast({
- title: "删除成功",
- icon: 'success'
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- padding-top: 33rpx;
- .week_title {
- margin-left: 35rpx;
- font-size: 34rpx;
- font-weight: 500;
- }
- .week {
- margin: 0 auto;
- margin-top: 12rpx;
- width: 690rpx;
- height: 107rpx;
- border-radius: 10rpx;
- background-color: #fff;
- }
- .time_list {
- display: flex;
- align-items: center;
- margin: 0 auto;
- margin-top: 32rpx;
- width: 690rpx;
- height: 60rpx;
- font-weight: 500;
- .title {
- flex: 4;
- font-size: 34rpx;
- }
- .add {
- flex: 1;
- text-align: end;
- font-size: 24rpx;
- color: #3396FB;
- }
- }
- .list {
- margin: 0 auto;
- margin-top: 13rpx;
- padding-top: 20rpx;
- padding-bottom: 20rpx;
- width: 690rpx;
- border-radius: 10rpx;
- background-color: #fff;
- .item {
- display: flex;
- justify-content: space-between;
- margin: 0 20rpx 20rpx 20rpx;
- width: 650rpx;
- height: 60rpx;
- .item_box {
- width: 291rpx;
- height: 60rpx;
- border-radius: 8rpx;
- border: 1rpx solid #CCCCCC;
- .uni-input {
- display: flex;
- align-items: center;
- width: 291rpx;
- height: 60rpx;
- .input_time {
- flex: 2;
- margin-left: 34rpx;
- font-size: 28rpx;
- color: #707070;
- }
- .input_icon {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- img {
- width: 26rpx;
- height: 26rpx;
- }
- }
- }
- }
- }
- // .edit {
- // margin-left: 20rpx;
- // padding-top: 10rpx;
- // width: 70rpx;
- // height: 60rpx;
- // color: #3396FB;
- // font-size: 24rpx;
- // font-weight: 500;
- // }
- }
- .switch {
- box-sizing: border-box;
- display: flex;
- align-items: center;
- margin: 0 auto;
- margin-top: 20rpx;
- padding: 0 20rpx;
- width: 690rpx;
- height: 86rpx;
- border-radius: 10rpx;
- background: #FFFFFF;
- .switch_title {
- flex: 5;
- font-size: 34rpx;
- font-weight: 500;
- }
- .switch_button {
- flex: 1;
- }
- }
- .button {
- margin: 0 auto;
- margin-top: 50rpx;
- width: 690rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- color: #fff;
- font-size: 32rpx;
- border-radius: 16rpx;
- background-color: #3396FB;
- }
- }
- // 选择星期区域圆角效果
- ::v-deep .weeks-outer {
- border-radius: 10rpx;
- }
-
- // 解决左滑区域突出问题
- ::v-deep .uni-swipe_button-group {
- margin-bottom: 20rpx;
- }
- </style>
|