Browse Source

feat(calendar, tall.js): 上下滑动切换日历的模式,tall.js中domain根据环境变量切换

tall
wally 4 years ago
parent
commit
364e25d9dc
  1. 3
      CHANGELOG.md
  2. 36
      src/components/Calendar/Calendar.vue
  3. 2
      src/components/Projects/Projects.vue
  4. 24
      src/pages/index/index.vue
  5. 4
      src/utils/tall.js

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-08-10)
# 0.1.0 (2021-08-11)
### 🌟 新功能
范围|描述|commitId
@ -33,6 +33,7 @@
- | 标题栏角色栏全局任务组件新建 | 0500cb4
- | 模拟接口测试 | 69e7931
- | 添加时间轴上下滚动 | 2b81bbc
- | 点击日历日期查询项目列表 | c458385
- | 角色栏实现 | 94cd671
- | 距调整pc端 | 5069aa1
- | 配置默认插件接口 | f0c177d

36
src/components/Calendar/Calendar.vue

@ -92,31 +92,19 @@ import { gegerateDates, dateEqual, formatDate } from './generateDates.js';
export default {
props: {
duration: {
type: Number,
default: 500,
},
dotList: {
type: Array, ///
default() {
return [];
},
},
showBack: {
type: Boolean, //
default: false,
},
todayClass: {
type: String, // class
default: 'is-today',
},
checkedClass: {
type: String, // class
default: 'is-checked',
},
duration: { type: Number, default: 500 },
//
dotList: { type: Array, default: () => [] },
//
showBack: { type: Boolean, default: false },
// class
todayClass: { type: String, default: 'is-today' },
// class
checkedClass: { type: String, default: 'is-checked' },
//
dotStyle: {
type: Object, //
default() {
type: Object,
default: () => {
return { background: '#FF0000' };
},
},

2
src/components/Projects/Projects.vue

@ -1,5 +1,5 @@
<template>
<view class="py-3 mt-4 bg-white">
<view class="py-3 mt-4 bg-white u-font-15">
<view v-for="(project, index) in projects" :key="index">
<!-- 有子项目 -->
<view class="flex items-center justify-between p-3">

24
src/pages/index/index.vue

@ -1,8 +1,8 @@
<template>
<view class="bg-gray-50">
<view class="bg-gray-50" @touchmove="onMove">
<view class="relative">
<!-- 日历 -->
<Calendar @selected-change="onDateChange" :show-back="true" :dot-list="days" />
<Calendar @selected-change="onDateChange" :show-back="true" :dot-list="days" ref="calendar" />
<!-- 上传 导入wbs -->
<Upload @show-alert="onShowAlert" />
</view>
@ -27,6 +27,8 @@
<script>
import { mapState, mapMutations } from 'vuex';
let prevY = 0;
export default {
data() {
return {
@ -41,6 +43,7 @@ export default {
title: '',
description: '',
},
calendar: null,
};
},
@ -58,6 +61,10 @@ export default {
this.getProjects();
},
onReady() {
this.calendar = this.$refs.calendar;
},
methods: {
...mapMutations('project', ['setProjects']),
@ -89,6 +96,19 @@ export default {
this.alert.show = true;
setTimeout(() => (this.alert.show = false), 10000);
},
// /
onMove(event) {
const y = event.changedTouches[0].pageY;
if (y - prevY > 0) {
// weekMode=true weekMode=false
this.calendar.weekMode && (this.calendar.weekMode = false);
} else if (y - prevY < 0) {
// weekMode=false weekMode=true
!this.calendar.weekMode && (this.calendar.weekMode = true);
}
prevY = y;
},
},
};
</script>

4
src/utils/tall.js

@ -7,6 +7,8 @@ import time from '@/utils/time.js';
import ui from '@/utils/ui.js';
import upload from '@/utils/upload.js';
const gateway = process.env.VUE_APP_API_URL;
const $t = {
zIndex, // 定位元素层级
app, // app级别的相关配置
@ -16,7 +18,7 @@ const $t = {
timeConfig, // 时间相关配置
ui, // ui界面提示相关
chooseAndUpload: upload.chooseAndUpload, // 选择并上传单个文件相关的封装
domain: 'https://www.tall.wiki/gateway/defaultwbs',
domain: `${gateway}/defaultwbs`,
};
uni.$t = $t;

Loading…
Cancel
Save