Commit 4e2320fc authored by sujie@126.com's avatar sujie@126.com

合并代码

parent 820ff9d1
......@@ -409,6 +409,13 @@
"pages": [
"index"
]
},
{
"root": "business/pages/calendarthemeeditor",
"name": "businessecalendarthemeeditor",
"pages": [
"index"
]
}
],
"preloadRule": {
......
This diff is collapsed.
{
"navigationBarTitleText": "新建日历打卡",
"usingComponents": {
"sjd-media-editor": "../../../components/sjdmediaeditor",
"sound-recording": "../../../components/soundrecording",
"calender":"../../../components/calendar",
"w-switch": "/dist/w-switch/index",
"w-button": "/dist/w-button/index",
"w-cell": "/dist/w-cell/index",
"w-cell-group": "/dist/w-cell-group/index",
"w-pane": "/dist/w-pane/index"
}
}
\ No newline at end of file
This diff is collapsed.
@import '../../../style/editor.wxss';
.theme-editor-container {
min-height: 100vh;
background-color: rgba(247, 247, 249, 1);
padding-bottom: 52rpx;
}
.theme-editor-container.opacitybody {
display: none;
}
.question-box {
width: 42rpx;
height: 42rpx;
border-radius: 50%;
background-color: #fff;
box-shadow: 0px -2rpx 18rpx 2rpx rgba(0, 0, 0, 0.08);
color: #65b8f4;
font-size: 30rpx;
text-align: center;
line-height: 42rpx;
margin-left: 20rpx;
}
.theme-editor-container .circle-name-box {
position: relative;
}
.theme-editor-container .broadcast-box {
padding: 22rpx 0 22rpx 24rpx;
background-color: #fff;
}
.theme-editor-container .broadcast-box .broadcast-img {
width: 24rpx;
height: 18rpx;
display: block;
float: left;
margin-top: 10rpx;
}
.theme-editor-container .broadcast-box .broadcast-text {
font-size: 24rpx;
color: #ef9c52;
padding-left: 21rpx;
float: left;
width: 647rpx;
}
.theme-editor-container .circle-name-box .circle-name {
background-color: rgba(248, 248, 248, 1);
border-radius: 8rpx;
width: 100%;
padding: 16rpx 6rpx 19rpx 15rpx;
height: 110rpx;
font-size: 28rpx;
margin-top: 20rpx;
line-height: 39rpx;
font-size: 26rpx;
}
.theme-editor-container .circle-name-box .length-rate {
position: absolute;
right: 6rpx;
bottom: 13rpx;
color: rgba(0, 0, 0, 0.3);
font-size: 26rpx;
}
.theme-editor-container .circle-name-box .circle-name-placeholder {
color: rgba(0, 0, 0, 0.3);
/* color:red; */
line-height: 39rpx;
font-size: 26rpx;
}
.theme-editor-container .submitbtn {
display: block;
margin: 0 auto;
width: 256rpx;
height: 80rpx;
line-height: 80rpx;
background: rgba(101, 184, 244, 1);
border-radius: 40rpx;
font-size: 38rpx;
color: #fff;
letter-spacing: 4rpx;
margin-top: 82rpx;
/* position: fixed;
bottom: 53rpx;
left: 50%;
margin-left: -128rpx; */
}
.theme-editor-container .pd0 {
padding-bottom: 0;
}
.warn-text-red {
color: #7d7d7d;
font-size: 26rpx;
margin-top: 44rpx;
text-align: center;
}
.theme-editor-container .self-editor-box .box-title .main-title {
float: left;
}
.main-title-box {
display: flex;
display: -webkit-flex;
align-items: center;
justify-content: flex-start;
float: left;
}
.theme-editor-container .self-editor-box .box-title {
margin-bottom: 0;
}
.theme-editor-container .self-editor-box .box-title.box-title-mode .main-title-box .main-title {
font-size: 28rpx;
font-weight: 500;
}
.theme-editor-container .self-editor-box .box-title.box-title-mode {
}
.tranparent {
opacity: 0;
}
.theme-editor-container .self-editor-box .box-title .main-title-right {
float: right;
color: #65b8f4;
font-size: 26rpx;
padding-right: 36rpx;
}
.theme-editor-container .self-editor-box .box-title .arrowright {
display: block;
width: 14rpx;
height: 21rpx;
position: absolute;
right: 0;
top: 27rpx;
display: block;
}
.switchimgbox {
display: flex;
align-items: center;
float: right;
}
.switchimg {
width: 74rpx;
height: 36rpx;
float: right;
/* line-height: 73rpx; */
margin-top: 18rpx;
}
.sjd-dialog {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 100;
display: flex;
display: -webkit-flex;
align-items: center;
justify-content: center;
}
.sjd-dialog .sjd-input-dialog-mask {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, 0.7);
/* filter: blur(10px); */
z-index: 1;
}
.sjd-dialog .sjd-input-dialog-content {
background-color: #fff;
border-radius: 6rpx;
position: relative;
z-index: 2;
width: 560rpx;
}
.sjd-dialog .sjd-input-dialog-content .sjd-dialog-box {
padding: 30rpx;
}
.sjd-dialog .sjd-input-dialog-content .sjd-dialog-box .linetext {
font-size: 36rpx;
color: #000;
text-align: center;
line-height: 1;
margin-bottom: 24rpx;
}
.sjd-dialog .sjd-input-dialog-content .sjd-dialog-box .smalllineitem {
color: #999;
font-size: 24rpx;
margin-top: 45rpx;
text-align: center;
}
.sjd-dialog .sjd-input-dialog-content .sjd-dialog-box .input-item {
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 5rpx;
padding: 0 10rpx;
width: 443rpx;
line-height: 60rpx;
height: 60rpx;
/* margin-bottom: 45rpx; */
display: block;
margin: 20rpx auto 45rpx;
}
.sjd-dialog .sjd-input-dialog-content .sjd-dialog-box .line {
margin-bottom: 10rpx;
line-height: 1.2;
}
.sjd-dialog .sjd-input-dialog-content .sjd-input-footer {
display: flex;
display: -webkit-flex;
justify-content: center;
border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.sjd-dialog .sjd-input-dialog-content .sjd-input-footer .btn-item {
flex-grow: 1;
line-height: 101rpx;
text-align: center;
font-size: 36rpx;
}
.sjd-dialog .sjd-input-dialog-content .sjd-input-footer .btn-item.cancel {
border-right: 1px solid rgba(0, 0, 0, 0.05);
}
.sjd-dialog .sjd-input-dialog-content .sjd-input-footer .btn-item.sure {
color: #00c200;
}
/* .media-text-item textarea {
height: 600rpx;
} */
.time-ipt-box {
display: flex;
font-size: 26rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(125, 125, 125, 1);
padding: 28rpx 0 44rpx 26rpx;
}
.iteminput {
width: 74rpx;
border-bottom: 1px solid rgba(130, 142, 156, 0.4);
text-align: center;
font-size: 26rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(101, 184, 244, 1);
}
.timeset-title-box .main-title {
font-size: 28rpx;
font-weight: 500;
}
.timeset-box {
/* display: flex;
justify-content: space-between; */
line-height: 1 !important;
}
.timeset-box .timeset-title-box {
float: left;
}
.timeset-box .content-box {
width: 340rpx;
font-size: 26rpx;
line-height: 1;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(101, 184, 244, 1);
padding-bottom: 20rpx;
overflow: hidden;
display: flex;
float: right;
justify-content: space-between;
border-bottom: 1px solid rgba(130, 142, 156, 0.4);
}
.timeset-box .content-box .time {
}
.timeset-box .content-box .date {
}
.timeset-box .content-time-box {
float: right;
display: flex;
line-height: 1;
font-size: 22rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(0, 0, 0, 1);
}
.timeset-box .content-time-box .time {
font-size: 26rpx;
width: 190rpx;
text-align: center;
border-bottom: 1px solid rgba(130, 142, 156, 0.4);
padding-bottom: 20rpx;
color: rgba(101, 184, 244, 1);
}
.timeset-box .content-time-box .date {
width: 190rpx;
font-size: 26rpx;
text-align: center;
border-bottom: 1px solid rgba(130, 142, 156, 0.4);
padding-bottom: 20rpx;
color: rgba(101, 184, 244, 1);
}
.timeset-title-box .title-tips {
font-size: 24rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(173, 173, 173, 1);
}
.time-editor-box {
padding: 0 24rpx;
}
.time-editor-box .time-ipt-box {
padding: 0rpx 0 40rpx 26rpx;
color: rgba(125, 125, 125, 1);
}
.time-editor-box .time-ipt-box .time {
width: 190rpx;
line-height: 1;
padding-bottom: 20rpx;
text-align: center;
font-size: 26rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: rgba(101, 184, 244, 1);
border-bottom: 1px solid rgba(130, 142, 156, 0.4);
}
.nowork-day{
}
.nowork-day .box-title{
display: flex;
align-items: center;
}
.nowork-day .box-title .main-title{
padding-right: 75rpx;
}
.nowork-day .box-title .select-days{
width: 434rpx;
font-size:26rpx;
font-family:PingFang-SC-Regular;
font-weight:400;
color:rgba(170,170,170,1);
overflow: hidden;
text-overflow:ellipsis;
white-space:nowrap;
display: flex;
}
.nowork-day .box-title .select-days .day-item{
}
.nowork-day .arrowsmall{
width:12rpx;
height:20rpx;
padding-left: 20rpx;
}
.nowork-day .week-select{
display: flex;
}
.nowork-day .week-select .week-item{
width:78rpx;
height:78rpx;
background:rgba(255,255,255,1);
border:1px solid rgba(203,203,203,1);
border-radius:50%;
font-size:22rpx;
font-family:PingFang-SC-Regular;
font-weight:400;
color:rgba(0,0,0,1);
text-align: center;
line-height: 78rpx;
margin-right: 26rpx;
}
.nowork-day .week-select .selected-item{
background:rgba(101,184,244,1);
border: none;
color:rgba(255,255,255,1);
}
.calender-box{
background: rgba(0,0,0,.5);
position: fixed;
width: 100%;
height: 100%;
z-index: 20;
left: 0;
bottom: 0;
}
.calender-box .content-box{
background: #fff;
position: absolute;
width: 100%;
left: 0;
bottom: 0;
border-radius:20rpx 20rpx 0px 0px;
}
.calender-box .footer{
display: flex;
padding: 85rpx 0 48rpx 0;
}
.calender-box .footer .sure{
flex: 1;
text-align: center;
line-height: 1;
font-size:26rpx;
font-family:PingFang-SC-Bold;
font-weight:bold;
color:rgba(101,184,244,1);
}
.calender-box .footer .cancle{
flex: 1;
text-align: center;
line-height: 1;
font-size:26rpx;
font-family:PingFang-SC-Bold;
font-weight:bold;
color:rgba(101,184,244,1);
border-right: 1rpx solid rgba(0,0,0,.1);
}
\ No newline at end of file
......@@ -8,9 +8,9 @@ import {
import {
themeDetail
} from '../../../service/business/themeindex.js';
import {
import  {
formIdCreate
} from '../../../service/common.js';
}  from  '../../../service/common.js';
import {
audioorigin
} from '../../../utilities/index.js';
......@@ -28,7 +28,17 @@ Page({
title: '',
content: [],
is_cheat: 0,
is_encrypt: 0
is_encrypt: 0,
is_read: 0,
is_remind:0,
readtime: 0,
startDate: '2019-04-05',
startTime: '00:00',
endDate: '2019-04-05',
endTime: '00:00',
dayStime: '00:00',
dayEtime: '24:00',
tipTime:'00:00'
},
submiting: false,
audioStatus: { // 录音弹窗的交互状态
......@@ -46,21 +56,28 @@ Page({
showWarn: false
},
onLoad: function(options) { // Do some initialize when page load.
const { id, tid, clone, sid} = options;
const {
id,
tid,
clone,
sid
} = options;
this.setData({
id,
tid,
clone: clone || '',
sid: sid || ''
});
this.loadThemeData({id, tid});
this.loadThemeData({
id,
tid
});
// wx.hideShareMenu()
},
onReady: function() { // Do something when page ready.
},
onShow: function() { // Do something when page show.
},
onHide: function() { // Do something when page hide.
innerAudioContext.pause();
......@@ -86,23 +103,25 @@ Page({
clearInterval(this.data.voiceInterval);
},
onPullDownRefresh: function() { // Do something when pull down.
},
onReachBottom: function() { // Do something when page reach bottom.
},
onShareAppMessage: function () { // return custom share data when user share.
onShareAppMessage: function() { // return custom share data when user share.
return {
title: '打卡小管家',
path: '/ucenter/index',
}
},
onPageScroll: function() { // Do something when page scroll
},
onTabItemTap(item) {
},
loadThemeData ({id, tid}) {
onTabItemTap(item) {},
loadThemeData({
id,
tid
}) {
if (tid == 0) { // 走新建的逻辑
} else { // 走查询的逻辑
......@@ -111,10 +130,13 @@ Page({
})
themeDetail({
id: this.data.tid,
school_id:this.data.sid
school_id: this.data.sid
}).then((res) => {
wx.hideLoading();
const {code, data} = res;
const {
code,
data
} = res;
if (code == 200) {
let _content = [];
try {
......@@ -130,15 +152,17 @@ Page({
is_cheat: data.is_cheat,
is_encrypt: data.is_encrypt,
}
})
})
}
}).catch((err) => {
wx.hideLoading()
})
}
},
titleInput (e) {
const {value} = e.detail;
titleInput(e) {
const {
value
} = e.detail;
this.setData({
'params.title': value.length > 20 ? value.substr(0, 20) : value
})
......@@ -147,7 +171,7 @@ Page({
const that = this;
wx.showActionSheet({
itemList: ['无限制', '录音打卡', '视频打卡', '照片打卡'],
success (res) {
success(res) {
that.setData({
'params.type': `${res.tapIndex}`
})
......@@ -159,8 +183,10 @@ Page({
// url: `/src/pages/circleindex/index?id=${this.data.id}`,
// })
// },
saveTheme (e) {
const {formId} = e.detail;
saveTheme(e) {
const {
formId
} = e.detail;
const _params = JSON.parse(JSON.stringify(this.data.params));
if (_params.title.trim() === '') {
wx.showModal({
......@@ -197,9 +223,12 @@ Page({
class_id: this.data.id,
tid: this.data.tid,
clone: this.data.clone,
school_id:this.data.sid
school_id: this.data.sid
})).then((res) => {
const {code, data} = res;
const {
code,
data
} = res;
wx.hideLoading();
this.setData({
submiting: false
......@@ -235,14 +264,20 @@ Page({
})
},
// 跟录音相关的操作
addVoice (e) {
const {show, src} = e.detail
addVoice(e) {
const {
show,
src
} = e.detail
this.setData({
'audioStatus.show': show
})
},
pushVoice (e) {
const {src, duration} = e.detail;
pushVoice(e) {
const {
src,
duration
} = e.detail;
this.selectComponent('#sjd-media-editor').pushVoice({
src,
duration
......@@ -252,7 +287,7 @@ Page({
// 跟录音相关的操作
// 播放录音的相关操作
// 格式是以录音名字为key value为{play: true || false, currentTime: 0}的一个对象
voiceIntervalPlay (value) { // 初始化录音的状态
voiceIntervalPlay(value) { // 初始化录音的状态
let voiceInterval = setInterval(() => {
let audioStorage = this.data.audioStorage;
let currentTime = ++audioStorage[value].currentTime;
......@@ -272,8 +307,11 @@ Page({
voiceInterval
})
},
playvoice (e) {
const {value, duration} = e.detail;
playvoice(e) {
const {
value,
duration
} = e.detail;
innerAudioContext.src = audioorigin(value);
this.resetAudiosPlayStatus();
clearInterval(this.data.voiceInterval);
......@@ -299,8 +337,10 @@ Page({
audioStorage,
})
},
pausevoice (e) {
const {value} = e.detail;
pausevoice(e) {
const {
value
} = e.detail;
let audioStorage = this.data.audioStorage;
audioStorage[value].play = false;
this.setData({
......@@ -309,8 +349,12 @@ Page({
innerAudioContext.pause();
clearInterval(this.data.voiceInterval);
},
voiceslide (e) {
const {value, slide, duration} = e.detail;
voiceslide(e) {
const {
value,
slide,
duration
} = e.detail;
let audioStorage = this.data.audioStorage;
if (!audioStorage[value]) {
audioStorage[value] = {
......@@ -326,8 +370,11 @@ Page({
audioStorage,
})
},
slidestart (e) {
const {value, slide} = e.detail;
slidestart(e) {
const {
value,
slide
} = e.detail;
let audioStorage = this.data.audioStorage;
if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 则先暂停音乐盒计时器 播放按钮状态不需要改
innerAudioContext.pause();
......@@ -335,8 +382,11 @@ Page({
} else { // 如果当前不是播放状态 则该干嘛干嘛
}
},
slideend (e) {
const {value, slide} = e.detail;
slideend(e) {
const {
value,
slide
} = e.detail;
let audioStorage = this.data.audioStorage;
if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 则启用定时器 播放按钮状态不需要改
// clearInterval(this.data.voiceInterval);
......@@ -345,7 +395,7 @@ Page({
} else { // 如果当前不是播放状态 则该干嘛干嘛
}
},
resetAudiosPlayStatus () { // 点击一个录音的时候把其他的录音状态改成暂停状态
resetAudiosPlayStatus() { // 点击一个录音的时候把其他的录音状态改成暂停状态
let audioStorage = this.data.audioStorage;
Object.keys(audioStorage).forEach((key) => {
audioStorage[key].play = false
......@@ -354,8 +404,10 @@ Page({
audioStorage,
})
},
delvoice (e) {
const {value} = e.detail;
delvoice(e) {
const {
value
} = e.detail;
let audioStorage = this.data.audioStorage;
if (audioStorage[value] && audioStorage[value].play) { // 如果当前是播放状态 删除录音的操作要把录音销毁掉
delete audioStorage[value]
......@@ -367,7 +419,7 @@ Page({
})
},
// 跟录音相关的操作
showDesc () {
showDesc() {
this.setData({
showWarn: !this.data.showWarn
})
......@@ -377,7 +429,7 @@ Page({
// showCancel: false
// })
},
cheatswitch () {
cheatswitch() {
if (Number(this.data.params.is_cheat) == 0) {
this.setData({
'params.is_cheat': 1
......@@ -388,7 +440,7 @@ Page({
})
}
},
encryptswitch () {
encryptswitch() {
if (Number(this.data.params.is_encrypt) == 0) {
this.setData({
'params.is_encrypt': 1
......@@ -398,5 +450,91 @@ Page({
'params.is_encrypt': 0
})
}
},
readswitch() {
if (Number(this.data.params.is_read) == 0) {
this.setData({
'params.is_read': 1
})
} else if (Number(this.data.params.is_read) == 1) {
this.setData({
'params.is_read': 0
})
}
},
remindswitch() {
if (Number(this.data.params.is_remind) == 0) {
this.setData({
'params.is_remind': 1
})
} else if (Number(this.data.params.is_remind) == 1) {
this.setData({
'params.is_remind': 0
})
}
},
readtimeInput(e) {
const {
value
} = e.detail;
this.setData({
'params.readtime': value,
})
},
startDateChange(e) {
const {
value
} = e.detail;
this.setData({
'params.startDate': value,
})
},
startTimeChange(e) {
const {
value
} = e.detail;
this.setData({
'params.startTime': value,
})
},
endDateChange(e) {
const {
value
} = e.detail;
this.setData({
'params.endDate': value,
})
},
endTimeChange(e) {
const {
value
} = e.detail;
this.setData({
'params.endTime': value,
})
},
dayStimeChange(e) {
const {
value
} = e.detail;
this.setData({
'params.dayStime': value,
})
},
dayEtimeChange(e) {
const {
value
} = e.detail;
this.setData({
'params.dayEtime': value,
})
},
tipTimeChange(e){
const {
value
} = e.detail;
this.setData({
'params.tipTime': value,
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "打卡主题",
"navigationBarTitleText": "新建作业打卡",
"usingComponents": {
"sjd-media-editor": "../../../components/sjdmediaeditor",
"sound-recording": "../../../components/soundrecording"
"sound-recording": "../../../components/soundrecording",
"w-switch": "/dist/w-switch/index",
"w-button": "/dist/w-button/index",
"w-cell": "/dist/w-cell/index",
"w-cell-group": "/dist/w-cell-group/index",
"w-pane": "/dist/w-pane/index"
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
@font-face {
font-family: 'iconfont';
src: url(data:font/truetype;charset=utf-8;base64,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) format('truetype');
font-weight: normal;
font-style: normal;
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
}
.icon-right::before {
content: "\e7eb";
}
.icon-left::before {
content: "\e7ec";
}
.icon-doubleleft::before {
content: "\e7ed";
}
.icon-doubleright::before {
content: "\e7ee";
}
import { getCurrentPage, warn } from './utils';
import {
jump,
isLeftSlide,
isRightSlide,
whenChangeDate,
renderCalendar,
whenMulitSelect,
whenSingleSelect,
calculateNextWeekDays,
calculatePrevWeekDays
} from './main.js';
let page = {};
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
properties: {
calendar: {
type: Object
}
},
lifetimes: {
attached: function() {
page = getCurrentPage();
}
},
attached: function() {
page = getCurrentPage();
},
data: {
handleMap: {
prev_year: 'chooseYear',
prev_month: 'chooseMonth',
next_month: 'chooseMonth',
next_year: 'chooseYear'
}
},
methods: {
chooseDate(e) {
const { type } = e.currentTarget.dataset;
if (!type) return;
const methodName = this.data.handleMap[type];
this[methodName](type);
},
chooseYear(type) {
const { curYear, curMonth } = this.data.calendar;
if (!curYear || !curMonth) return warn('异常:未获取到当前年月');
let newYear = curYear;
let newMonth = curMonth;
if (type === 'prev_year') {
newYear = curYear - 1;
} else if (type === 'next_year') {
newYear = curYear + 1;
}
this.calculate(curYear, curMonth, newYear, newMonth);
},
chooseMonth(type) {
const { curYear, curMonth } = this.data.calendar;
if (!curYear || !curMonth) return warn('异常:未获取到当前年月');
let newYear = curYear;
let newMonth = curMonth;
if (type === 'prev_month') {
newMonth = curMonth - 1;
if (newMonth < 1) {
newYear = curYear - 1;
newMonth = 12;
}
} else if (type === 'next_month') {
newMonth = curMonth + 1;
if (newMonth > 12) {
newYear = curYear + 1;
newMonth = 1;
}
}
this.calculate(curYear, curMonth, newYear, newMonth);
},
calculate(curYear, curMonth, newYear, newMonth) {
whenChangeDate({
curYear,
curMonth,
newYear,
newMonth
});
page.setData({
'calendar.curYear': newYear,
'calendar.curMonth': newMonth
});
renderCalendar(newYear, newMonth);
},
/**
* 日期点击事件
* @param {!object} e 事件对象
*/
tapDayItem(e) {
const { idx, disable } = e.currentTarget.dataset;
if (disable) return;
let currentSelected = {}; // 当前选中日期
let { days, selectedDay: selectedDays, todoLabels } =
this.data.calendar || []; // 所有选中日期
const config = page.config;
const { multi, onTapDay } = config;
const opts = {
e,
idx,
onTapDay,
currentSelected,
selectedDays,
todoLabels,
days: days.slice()
};
if (multi) {
whenMulitSelect(opts);
} else {
whenSingleSelect(opts);
}
},
doubleClickToToday() {
if (page.config.multi) return;
if (this.count === undefined) {
this.count = 1;
} else {
this.count += 1;
}
if (this.lastClick) {
const difference = new Date().getTime() - this.lastClick;
if (difference < 500 && this.count >= 2) {
jump();
}
this.count = undefined;
this.lastClick = undefined;
} else {
this.lastClick = new Date().getTime();
}
},
/**
* 日历滑动开始
* @param {object} e
*/
calendarTouchstart(e) {
const t = e.touches[0];
const startX = t.clientX;
const startY = t.clientY;
page.slideLock = true; // 滑动事件加锁
page.setData({
'gesture.startX': startX,
'gesture.startY': startY
});
},
/**
* 日历滑动中
* @param {object} e
*/
calendarTouchmove(e) {
const self = page;
if (isLeftSlide.call(self, e)) {
self.setData({
'calendar.leftSwipe': 1
});
if (page.weekMode) return calculateNextWeekDays.call(page);
this.chooseMonth('next_month');
}
if (isRightSlide.call(self, e)) {
self.setData({
'calendar.rightSwipe': 1
});
if (page.weekMode) return calculatePrevWeekDays.call(page);
this.chooseMonth('prev_month');
}
},
calendarTouchend(e) {
page.setData({
'calendar.leftSwipe': 0,
'calendar.rightSwipe': 0
});
}
}
});
{
"component": true
}
\ No newline at end of file
<view class="flex b tb ac" wx:if="{{calendar}}">
<view class="calendar pink-color b tb">
<view class="top-handle fs28 b lr ac pc">
<view class="prev fs36">
<text class="prev-handle iconfont icon-doubleleft" bindtap="chooseDate" data-type="prev_year"></text>
<text class="prev-handle iconfont icon-left" bindtap="chooseDate" data-type="prev_month"></text>
</view>
<view class="date-area b lr cc" bindtap="doubleClickToToday">{{calendar.curYear || "--"}} 年 {{calendar.curMonth || "--"}} 月</view>
<view class="next fs36">
<text class="next-handle iconfont icon-right" bindtap="chooseDate" data-type="next_month"></text>
<text class="next-handle iconfont icon-doubleright" bindtap="chooseDate" data-type="next_year"></text>
</view>
</view>
<view class="weeks b lr ac">
<view class="week fs28" wx:for="{{calendar.weeksCh}}" wx:key="{{index}}" data-idx="{{index}}">{{item}}</view>
</view>
<view class="perspective">
<view class="days b lr box-wrap {{calendar.leftSwipe ? 'leftRoate' : ''}} {{calendar.rightSwipe ? 'rightRoate' : ''}}" bindtouchstart="calendarTouchstart" bindtouchmove="calendarTouchmove" bindtouchend="calendarTouchend">
<view wx:if="{{calendar.empytGrids}}" class="grid disable-day-color b ac pc" wx:for="{{calendar.empytGrids}}" wx:key="{{index}}" data-idx="{{index}}">
<view class="day b ac pc">{{item}}</view>
</view>
<view class="grid normal-day-color b ac pc" wx:for="{{calendar.days}}" wx:key="{{index}}" data-disable="{{item.disable}}" data-idx="{{index}}" bindtap="tapDayItem">
<view wx:if="{{!calendar.todoLabelCircle}}" class="dot-day-height b tb ac pc">
<view class="day border-radius {{(item.week === 0 || item.week === 6) ? 'pink-color' : ''}} {{item.choosed ? 'day-choosed-color day-choosed-bg' : ''}} {{ item.disable ? 'disable-day-color disable-day-bg' : '' }} b ac pc" wx:if="{{!item.todoText}}">{{item.day}}</view>
<view wx:if="{{item.showTodoLabel}}" class="{{item.todoText ? 'todo-text' : 'todo-dot'}} {{calendar.todoLabelPos === 'bottom' ? 'todo-text-bottom' : 'todo-text-top'}}" style="background-color: {{calendar.todoLabelColor}};">{{item.todoText}}</view>
</view>
<view wx:else class="dot-day-height b tb ac pc">
<view class="day border-radius {{(item.week === 0 || item.week === 6) ? 'pink-color' : ''}} {{item.showTodoLabel ? 'day-circle' : '' }} {{item.choosed ? 'day-choosed-color day-choosed-bg' : ''}} {{ item.disable ? 'disable-day-color disable-day-bg' : '' }} b ac pc">{{item.day}}</view>
</view>
</view>
<view class="grid disable-day-color b ac pc" wx:for="{{calendar.lastEmptyGrids}}" wx:key="{{index}}" data-idx="{{index}}">
<view class="day b ac pc">{{item}}</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
@import './iconfont//iconfont.wxss';
.b {
display: flex;
}
.box-lr {
flex-direction: row;
}
.tb {
flex-direction: column;
}
.pc {
justify-content: center;
}
.ac {
align-items: center;
}
.cc {
align-items: center;
justify-content: center;
}
.box-wrap {
flex-wrap: wrap;
}
.flex {
flex-grow: 1;
}
.bg {
background-image: linear-gradient(to bottom, #faefe7, #ffcbd7);
overflow: hidden;
}
.pink-color {
/* color: #ff629a; */
}
.white-color {
color: #fff;
}
.fs24 {
font-size: 24rpx;
}
.fs28 {
font-size: 28rpx;
}
.fs32 {
font-size: 32rpx;
}
.fs36 {
font-size: 36rpx;
}
.calendar {
width: 100%;
box-sizing: border-box;
}
.top-handle {
height: 80rpx;
}
.top-handle text{
color: #8E8E8E;
}
.prev-handle,
.next-handle {
padding: 20rpx;
}
.date-area {
height: 80rpx;
padding: 0 60rpx;
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(0,0,0,1);
}
.weeks {
height: 50rpx;
line-height: 50rpx;
opacity: 0.5;
}
.week {
text-align: center;
}
.grid,
.week {
width: 14.286014285714286%;
}
.day {
width: 60rpx;
height: 60rpx;
font-size: 28rpx;
font-weight: 200;
}
.normal-day-color {
color:rgba(0,0,0,1);
}
.day-choosed-color {
color: #fff;
}
/* todo相关样式 */
.todo-dot {
width: 10rpx;
height: 10rpx;
border-radius: 50%;
background-color: #cc5226;
}
.todo-text {
font-size: 22rpx;
color: #c2c2c2;
/* position: absolute; */
}
.todo-text-bottom {
bottom: -8rpx;
}
.todo-text-top {
top: -8rpx;
}
.dot-day-height {
height: 72rpx;
position: relative;
left: 0;
top: 0;
}
/* 不可选日期 */
.disable-day-color {
color:rgba(0,0,0,.1);
}
.disable-day-bg {
background-color: #f6f6f7;
}
/* 日期圆圈标记 */
.day-circle {
border: 1rpx solid #88d2ac;
box-sizing: border-box;
}
.border-radius {
border-radius: 50%;
position: relative;
left: 0;
top: 0;
}
/* 日期选中 */
.day-choosed-bg {
background-color:rgba(101,184,244,1);
transition: all 0.3s;
animation-name: choosed;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: 1;
}
@keyframes choosed {
from {
transform: scale(1);
}
50% {
transform: scale(0.9);
}
to {
transform: scale(1);
}
}
This diff is collapsed.
let systemInfo;
export function getSystemInfo() {
if (systemInfo) return systemInfo;
systemInfo = wx.getSystemInfoSync();
return systemInfo;
}
export function info(msg) {
console.log(
'%cInfo: %c' + msg,
'color:#FF0080;font-weight:bold',
'color: #FF509B'
);
}
export function warn(msg) {
console.log(
'%cWarn: %c' + msg,
'color:#FF6600;font-weight:bold',
'color: #FF9933'
);
}
export function tips(msg) {
console.log(
'%cTips: %c' + msg,
'color:#00B200;font-weight:bold',
'color: #00CC33'
);
}
export function isIos() {
const sys = getSystemInfo();
return /iphone|ios/i.test(sys.platform);
}
/**
* 获取当前页面实例
*/
export function getCurrentPage() {
const pages = getCurrentPages();
const last = pages.length - 1;
return pages[last];
}
/**
* new Date 区分平台
* @param {number} year
* @param {number} month
* @param {number} day
*/
export function newDate(year, month, day) {
let cur = `${year}-${month}-${day}`;
if (isIos()) {
cur = `${year}/${month}/${day}`;
}
return new Date(cur);
}
/**
* 日期数组根据日期去重
* @param {array} array 数组
*/
export function uniqueArrayByDate(array = []) {
let uniqueObject = {};
let uniqueArray = [];
array.forEach(item => {
uniqueObject[`${item.year}-${item.month}-${item.day}`] = item;
});
for (let i in uniqueObject) {
uniqueArray.push(uniqueObject[i]);
}
return uniqueArray;
}
/**
* 指定可选日期及可选日期数组去重
* @param {array} enableDays 特定可选日期数组
* @param {array} enableArea 可选日期区域数组
*/
export function delRepeatedEnableDay(enableDays = [], enableArea = []) {
let _startTimestamp;
let _endTimestamp;
if (enableArea.length === 2) {
const { startTimestamp, endTimestamp } = convertEnableAreaToTimestamp(
enableArea
);
_startTimestamp = startTimestamp;
_endTimestamp = endTimestamp;
}
const enableDaysTimestamp = converEnableDaysToTimestamp(enableDays);
const tmp = enableDaysTimestamp.filter(
item => item < _startTimestamp || item > _endTimestamp
);
return tmp;
}
/**
* 指定日期区域转时间戳
* @param {array} timearea 时间区域
*/
export function convertEnableAreaToTimestamp(timearea = []) {
const start = timearea[0].split('-');
const end = timearea[1].split('-');
const startTimestamp = newDate(start[0], start[1], start[2]).getTime();
const endTimestamp = newDate(end[0], end[1], end[2]).getTime();
return {
start,
end,
startTimestamp,
endTimestamp
};
}
/**
* 指定特定日期数组转时间戳
* @param {array} enableDays 指定时间数组
*/
export function converEnableDaysToTimestamp(enableDays = []) {
const enableDaysTimestamp = [];
enableDays.forEach(item => {
if (typeof item !== 'string') return warn('enableDays()入参日期格式错误');
const tmp = item.split('-');
if (tmp.length !== 3) return warn('enableDays()入参日期格式错误');
const timestamp = newDate(tmp[0], tmp[1], tmp[2]).getTime();
enableDaysTimestamp.push(timestamp);
});
return enableDaysTimestamp;
}
export default {
imageRoot: 'https://cdn.img.shangjiadao.cn/source/images/daka/',
host: 'https://wx.m.shangjiadao.cn/daka',
host2: 'https://wx.m.shangjiadao.cn',
// host: 'https://wx.m.shangjiadao.cn/daka',
// host2: 'https://wx.m.shangjiadao.cn',
storageVersion: '3.0',
imageVersion: '20190416',
// host: 'https://clock.wp53.cn',
// host2: 'https://test.wp53.cn',
host: 'https://clock.wp53.cn',
host2: 'https://test.wp53.cn',
appId: 'wxc1246ea029394785',
miniProgram: {
clock: 'wxdeee20e52a1fd7ee'
......
/*
* @Author: cnyballk[https://github.com/cnyballk]
* @Date: 2018-09-15 14:58:34
* @Last Modified by: cnyballk[https://github.com/cnyballk]
* @Last Modified time: 2018-09-15 15:28:57
*/
module.exports = Behavior({});
/*
* @Author: cnyballk[https://github.com/cnyballk]
* @Date: 2018-09-15 14:58:34
* @Last Modified by: cnyballk[https://github.com/cnyballk]
* @Last Modified time: 2018-09-16 11:31:34
*/
module.exports = Behavior({
// behaviors: ['wx://form-field'],
properties: {
defaultValue: {
type: null,
value: null,
},
name: {
type: String,
value: null,
},
},
methods: {
_resetAllValue() {
const { value: _value, disable, readOnly, defaultValue = '' } = this.data;
if (disable || readOnly) return false;
const type = typeof _value;
switch (type) {
case 'string':
this.setData({ value: defaultValue });
break;
case 'boolean':
this.setData({ value: !!defaultValue });
break;
case 'object':
this._emptyValue && this._emptyValue();
break;
default:
break;
}
},
validate(newValue) {
const validate = this.getRelationNodes('../w-validate/index')[0];
if (!validate) return false;
validate.isValidate(newValue || '');
},
},
});
module.exports = Behavior({
behaviors: [],
properties: {
},
data: {
},
attached: function () {},
methods: {
/**
*
* @param {string} v 要格式化的单位
* @param {string} unit 无单位时补充的单位
* @param {string} r 要替换的单位
*/
formatUnit(v,unit,r) {
const units = ['px','rpx','%','rm','rem'];
if(!v)return '';
let x = '';
return !!units.reduce((p,n) => {
if(String(v).indexOf(n) > -1) {
p+=1;
x = n;
}
return p;
},0) ? r != null || r != undefined ? v.replace(new RegExp(x,'g'),'') + r : v : v + unit;
},
/**
* 判断是否是数组对象 [{},{},{}....]
* @param {array} arry
*/
isArrayObject(arry) {
return Array.isArray(arry) && arry.length >0 && Object.prototype.toString.call(arry[0]) === '[object Object]'
},
}
})
\ No newline at end of file
import Behavior from '../behavior/index';
export default (options = {}) => {
options.options = {
multipleSlots: true,
addGlobalClass: true,
...options.options,
};
options.behaviors = [
Behavior,
...(options.behaviors = options.behaviors || []),
];
options.externalClasses = [
'wuss-class',
...(options.externalClasses = options.externalClasses || []),
];
return Component(options)
}
\ No newline at end of file
/*
This file is a skin file for the Wuss-weapp custom component theme.
*/
\ No newline at end of file
/*
* @Author: cnyballk[https://github.com/cnyballk]
* @Date: 2018-09-18 12:45:25
* @Last Modified by: cnyballk[https://github.com/cnyballk]
* @Last Modified time: 2018-10-18 09:48:30
*/
/** 如何使用 ?
* const wussV = new WussValidate (rules)
* wussV.isValidate(value)
*
* 规则的类型 :
* interface IWussValidate<T>
* {
* value:T //验证的规则
* message:string //验证失败的提示语
* }
* @param {array} mode 模式 mobile | email | url |idcard
* @param {IWussValidate<boolean>} required 是否必填
* @param {IWussValidate<number>} equalLength 等于字符长度
* @param {IWussValidate<number>} maxLength 最大字符长度
* @param {IWussValidate<number>} minLength 最小字符长度
* @param {IWussValidate<array>} rangelength 限制字符长度的范围
* @param {IWussValidate<number>} equal 等于某值
* @param {IWussValidate<number>} max 最大值
* @param {IWussValidate<number>} min 最小值
* @param {IWussValidate<number>} range 值的范围
* @param {IWussValidate<string>} regexp 正则限制
*
* 使用 addMethods 增加新的方法
* wussV.addMethods(()=>{ return '我是验证失败的提示语' })
*/
class WussValidate {
result = [];
constructor(rules) {
this.rules = rules;
}
isValidate(value) {
this.value = value;
for (const i in this.rules) {
const message = this[i](this.rules[i]);
message && this.result.push(message);
}
return this.result;
}
mode(arr) {
for (const i in arr) {
const message = this[arr[i]]();
message && this.result.push(message);
}
}
// 验证手机号
mobile() {
return !/^1[345789]\d{9}$/.test(this.value) && `请输入11位的手机号码`;
}
// 邮箱验证
email() {
return (
!/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(
this.value
) && `请输入有效的电子邮件地址`
);
}
url() {
return (
!/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(
this.value
) && `请输入有效的地址`
);
}
idcard() {
return (
!/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
this.value
) && `请输入有效的身份证号`
);
}
required({ value, message }) {
return value && this.value.length === 0 && (message || `请输入值`);
}
// 等于长度
equalLength({ value, message }) {
return this.value.length !== value && (message || `长度必须为${value}位`);
}
// 最大长度
maxLength({ value, message }) {
return this.value.length > value && (message || `最多可以输入${value}位`);
}
// 最小长度
minLength({ value, message }) {
return this.value.length < value && (message || `长度不能少于${value}位`);
}
//验证一个长度范围[min, max]
rangelength({ value, message }) {
const l = this.value.length,
minL = value[0],
maxL = value[1];
return (
l > minL &&
l < maxL &&
(message || `请输入长度在 ${minL}${maxL} 之间的字符`)
);
}
min({ value, message }) {
return this.value < value && (message || `请输入不小于 ${value} 的数值`);
}
max({ value, message }) {
return this.value > value && (message || `请输入不大于 ${value} 的数值`);
}
range({ value, message }) {
const min = value[0],
max = value[1];
return (
this.value > min &&
this.value < max &&
(message || `请输入 ${min}${max} 之间的数值`)
);
}
equal({ value, message }) {
return this.value === value && (message || `输入值必须和 ${value} 相同`);
}
regexp({ value, message }) {
if (!value[0]) return;
const _regexp = new RegExp(value[0], value[1] || '');
return !_regexp.test(this.value) && message;
}
addMethods(name, func) {
this[name] = func;
}
}
export default WussValidate;
const CountUp = require('./w-count-up/index');
const getCurrentPage = () => {
const pages = getCurrentPages();
return pages[pages.length - 1];
};
const getCtx = selector => {
const page = getCurrentPage();
const component = page.selectComponent(selector);
if (!component) {
throw Error(`无法找到对应的组件: ${selector}`);
}
return component;
};
const Toast = {
show: (opts = {}) => {
const componentCtx = getCtx('#wuss-toast');
return componentCtx.show(opts);
},
};
const Alert = options => {
const component = getCtx('#wuss-alert');
return component.alert(options);
};
const Confirm = options => {
const component = getCtx('#wuss-confirm');
return component.confirm(options);
};
const ActionSheet = {
show: (options = {}) => {
const component = getCtx('#wuss-actionsheet');
return component.show(options);
},
hide: (options = {}) => {
const component = getCtx('#wuss-actionsheet');
return component.hide(options);
},
};
const Loading = {
show: (options = {}) => {
const component = getCtx('#wuss-loading');
return component.show(options);
},
hide: (options = {}) => {
const component = getCtx('#wuss-loading');
return component.hide(options);
},
};
module.exports = {
Toast,
Alert,
Confirm,
Loading,
CountUp,
ActionSheet,
};
import WussComponent from '../common/extends/baseComponent';
const PATH = '../w-accordion/index';
WussComponent({
relations: {
[PATH]: {
type: 'child',
linked() {
this.update();
},
linkChanged() {
this.update();
},
unlinked() {
this.update();
},
},
},
/**
* @param {accordion} 开启手风琴模式
* @param {activeKey} 激活的key数组
*/
properties: {
accordion: Boolean,
activeKey: {
type: Array,
value: [],
observer: 'changeCurrent',
},
},
data: {
keys: [],
},
methods: {
update() {
const { activeKey, accordion } = this.data;
const keys = this.getRelationNodes(PATH).map((e, index) => {
const current = accordion
? activeKey[0] === index
: activeKey.indexOf(index) !== -1;
e.setData({ current, index });
return e.data.key;
});
this.setData({ keys });
},
clickDisabledItem(index, key) {
this.triggerEvent('disabledClick', { index, key });
},
clickItem(index) {
let { activeKey, accordion, keys } = this.data;
if (accordion) {
activeKey = activeKey[0] === index ? [] : [index];
} else {
activeKey =
activeKey.indexOf(index) !== -1
? activeKey.filter(n => n !== index)
: [...activeKey, index];
}
this.setData({ activeKey }, () => {
this.update();
this.triggerEvent('onChange', {
activeKey,
keys: keys.filter((e, i) => {
return activeKey.indexOf(i) !== -1;
}),
});
});
},
},
});
{
"component": true,
"usingComponents": {
"w-cell-group": "../w-cell-group/index"
}
}
<view class="wuss-class wuss-accordion-group">
<slot/>
</view>
.wuss-accordion-group {
position: relative;
}
.wuss-accordion-group::after {
content: ' ';
position: absolute;
top: 0;
right: 0;
height: 1px;
border-top: 1px solid #d9d9d9;
transform-origin: 0 100%;
transform: scaleY(0.5);
left: 0;
}
import WussComponent from '../common/extends/baseComponent';
const PATH = '../w-accordion-group/index';
WussComponent({
relations: {
[PATH]: { type: 'parent' },
},
/**
* @param {string} key 携带的数据
* @param {string} title 标题
* @param {boolean} disabled 是否开启禁用
*/
properties: {
key: null,
title: String,
disabled: Boolean,
},
data: {
current: false,
index: 0,
height: '',
zeroHeight: '',
},
ready() {
wx.createSelectorQuery()
.in(this)
.select('.wuss-accordion--content')
.boundingClientRect()
.exec(rect => {
this.setData({
height: `height:${rect[0].height}px`,
zeroHeight: 'height:0px',
});
});
},
methods: {
onTap() {
const { index, disabled } = this.data;
const parent = this.getRelationNodes(PATH)[0];
if (parent) {
if (disabled) {
parent.clickDisabledItem(index);
} else {
parent.clickItem(index);
}
}
},
},
});
{
"component": true,
"usingComponents": {
"w-icon": "../w-icon/index"
}
}
<view class="wuss-class wuss-accordion" bindtap="onTap">
<view class="wuss-accordion--header">
<view class="{{disabled?'wuss-accordion--disabled' : ''}}">
<block wx:if="{{ title }}">
<view class="wuss-accordion--title">{{ title }}</view>
</block>
<block wx:else>
<slot name="header" />
</block>
<w-icon type="arrow-down" wuss-class="wuss-accordion--arrow" />
</view>
</view>
<view class="wuss-accordion--content" style="{{current ? height : zeroHeight }}">
<slot/>
</view>
</view>
This diff is collapsed.
This diff is collapsed.
{
"component": true,
"usingComponents": {
"w-popup": "../w-popup/index",
"w-activity-indicator": "../w-activity-indicator/index",
"w-mask-shadow": "../w-mask-shadow/index",
"w-icon": "../w-icon/index"
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"component": true,
"usingComponents": {
"w-cell": "../w-cell/index"
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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