Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夜猫逐梦
1024程序员开源挑战赛
提交
2fa9f773
1
1024程序员开源挑战赛
项目概览
夜猫逐梦
/
1024程序员开源挑战赛
与 Fork 源项目一致
Fork自
GitCode / 1024程序员开源挑战赛(10.23-11.14)
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1
1024程序员开源挑战赛
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2fa9f773
编写于
8月 11, 2021
作者:
B
baiy
提交者:
ninecents
10月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#51 fix
上级
bdb1ca11
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
145 addition
and
120 deletion
+145
-120
src/views/tool/time.vue
src/views/tool/time.vue
+145
-120
未找到文件。
src/views/tool/time.vue
浏览文件 @
2fa9f773
<
template
>
<
template
>
<div>
<div>
<Tabs
name=
"default"
>
<Tabs
name=
"default"
>
<TabPane
label=
"差值计算器"
name=
"default"
>
<TabPane
label=
"差值计算器"
name=
"default"
>
<option-block>
<option-block>
<FormItem>
<FormItem>
<DatePicker
transfer
v-model=
"current.poor.input1"
:options=
"options"
type=
"datetime"
<DatePicker
transfer
v-model=
"current.poor.input1"
:options=
"options"
type=
"datetime"
format=
"yyyy-MM-dd HH:mm:ss"
></DatePicker>
format=
"yyyy-MM-dd HH:mm:ss"
></DatePicker>
</FormItem>
</FormItem>
<FormItem>
<FormItem>
与
与
</FormItem>
</FormItem>
<FormItem>
<FormItem>
<DatePicker
transfer
v-model=
"current.poor.input2"
:options=
"options"
type=
"datetime"
<DatePicker
transfer
v-model=
"current.poor.input2"
:options=
"options"
type=
"datetime"
format=
"yyyy-MM-dd HH:mm:ss"
></DatePicker>
format=
"yyyy-MM-dd HH:mm:ss"
></DatePicker>
</FormItem>
</FormItem>
<FormItem>
<FormItem>
相差
相差
</FormItem>
</FormItem>
<FormItem>
<FormItem>
<Input
v-model=
"poor"
>
<Input
v-model=
"poor"
>
<Select
transfer
v-model=
"current.poor.unit"
slot=
"append"
style=
"width: 60px"
>
<Select
transfer
v-model=
"current.poor.unit"
slot=
"append"
style=
"width: 60px"
>
<Option
v-for=
"v in poorUnit"
:value=
"v.v"
:key=
"v.v"
>
{{
v
.
n
}}
</Option>
<Option
v-for=
"v in poorUnit"
:value=
"v.v"
:key=
"v.v"
>
{{
v
.
n
}}
</Option>
</Select>
</Select>
</Input>
</Input>
</FormItem>
</FormItem>
</option-block>
</option-block>
</TabPane>
</TabPane>
</Tabs>
</Tabs>
<Tabs
name=
"default"
>
<Tabs
name=
"default"
>
<TabPane
label=
"时间操作"
name=
"default"
>
<TabPane
label=
"时间操作"
name=
"default"
>
<option-block>
<option-block>
<FormItem>
<FormItem>
<DatePicker
transfer
v-model=
"current.duration.input"
:options=
"options"
type=
"datetime"
<DatePicker
transfer
v-model=
"current.duration.input"
:options=
"options"
type=
"datetime"
format=
"yyyy-MM-dd HH:mm:ss"
></DatePicker>
format=
"yyyy-MM-dd HH:mm:ss"
></DatePicker>
</FormItem>
</FormItem>
<FormItem>
<FormItem>
<Select
transfer
v-model=
"current.duration.type"
style=
"width: 100px"
>
<Select
transfer
v-model=
"current.duration.type"
style=
"width: 100px"
>
<Option
value=
"+"
>
添加
</Option>
<Option
value=
"+"
>
添加
</Option>
<Option
value=
"-"
>
减少
</Option>
<Option
value=
"-"
>
减少
</Option>
</Select>
</Select>
</FormItem>
</FormItem>
<FormItem>
<FormItem>
<Input
v-model=
"current.duration.length"
type=
"number"
number
>
<Input
v-model=
"current.duration.length"
type=
"number"
number
>
<Select
transfer
v-model=
"current.duration.unit"
slot=
"append"
style=
"width: 60px"
>
<Select
transfer
v-model=
"current.duration.unit"
slot=
"append"
style=
"width: 60px"
>
<Option
v-for=
"v in poorUnit"
:value=
"v.v"
:key=
"v.v"
>
{{
v
.
n
}}
</Option>
<Option
v-for=
"v in poorUnit"
:value=
"v.v"
:key=
"v.v"
>
{{
v
.
n
}}
</Option>
</Select>
</Select>
</Input>
</Input>
</FormItem>
</FormItem>
<FormItem>
<FormItem>
后, 为
<strong>
{{
duration
}}
</strong>
后, 为
<strong>
{{
duration
}}
</strong>
</FormItem>
</FormItem>
</option-block>
</option-block>
</TabPane>
</TabPane>
</Tabs>
</Tabs>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
moment
from
'
moment
'
import
moment
from
'
moment
'
export
default
{
export
default
{
created
()
{
created
()
{
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
())
this
.
current
=
Object
.
assign
(
this
.
current
,
this
.
$getToolData
())
},
computed
:
{
poor
()
{
let
a
=
moment
(
this
.
current
.
poor
.
input1
)
let
b
=
moment
(
this
.
current
.
poor
.
input2
)
this
.
$saveToolData
(
this
.
current
)
return
b
.
diff
(
a
,
this
.
current
.
poor
.
unit
)
},
},
computed
:
{
duration
()
{
poor
()
{
if
(
!
this
.
current
.
duration
.
length
){
let
a
=
moment
(
this
.
current
.
poor
.
input1
)
return
""
;
let
b
=
moment
(
this
.
current
.
poor
.
input2
)
}
this
.
$saveToolData
(
this
.
current
)
let
rate
=
this
.
getRate
(
this
.
current
.
duration
.
unit
)
return
b
.
diff
(
a
,
this
.
current
.
poor
.
unit
)
let
result
;
},
if
(
rate
===
0
)
{
duration
()
{
if
(
!
Number
.
isInteger
(
this
.
current
.
duration
.
length
)){
this
.
$saveToolData
(
this
.
current
)
return
"
年/月间隔只能是整数
"
;
}
const
type
=
this
.
current
.
duration
.
type
===
'
+
'
?
'
add
'
:
'
subtract
'
const
type
=
this
.
current
.
duration
.
type
===
'
+
'
?
'
add
'
:
'
subtract
'
return
moment
(
this
.
current
.
duration
.
input
)[
type
](
this
.
current
.
duration
.
length
,
this
.
current
.
duration
.
unit
).
result
=
moment
(
this
.
current
.
duration
.
input
)[
type
](
this
.
current
.
duration
.
length
,
this
.
current
.
duration
.
unit
)
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
}
else
{
},
result
=
moment
(
moment
(
this
.
current
.
duration
.
input
).
unix
()
*
1000
+
(
rate
*
this
.
current
.
duration
.
length
)
*
(
this
.
current
.
duration
.
type
===
'
+
'
?
1
:
-
1
)
)
}
this
.
$saveToolData
(
this
.
current
)
return
result
.
format
(
'
YYYY-MM-DD HH:mm:ss
'
);
},
},
data
()
{
},
return
{
methods
:
{
options
:
{
getRate
(
unit
)
{
shortcuts
:
[
for
(
let
item
of
this
.
poorUnit
)
{
{
if
(
item
.
v
===
unit
)
{
text
:
'
当前时间
'
,
return
parseInt
(
item
.
rate
)
value
()
{
}
return
moment
().
toDate
()
}
},
return
0
;
},
}
{
},
text
:
'
当前日期
'
,
data
()
{
value
()
{
return
{
return
moment
(
moment
().
format
(
'
YYYY-MM-DD
'
)).
toDate
()
options
:
{
},
shortcuts
:
[
{
text
:
'
当前时间
'
,
value
()
{
return
moment
().
toDate
()
},
},
{
},
text
:
'
当月日期
'
,
{
value
()
{
text
:
'
当前日期
'
,
return
moment
(
moment
().
format
(
'
YYYY-MM-01
'
)).
toDate
()
value
()
{
},
return
moment
(
moment
().
format
(
'
YYYY-MM-DD
'
)).
toDate
()
},
},
{
},
text
:
'
当年日期
'
,
{
value
()
{
text
:
'
当月日期
'
,
return
moment
(
moment
().
format
(
'
YYYY-01-01
'
)).
toDate
()
value
()
{
},
return
moment
(
moment
().
format
(
'
YYYY-MM-01
'
)).
toDate
()
},
},
],
},
poorUnit
:
[
{
v
:
'
years
'
,
n
:
'
年
'
},
{
v
:
'
months
'
,
n
:
'
月
'
},
{
v
:
'
weeks
'
,
n
:
'
周
'
},
{
v
:
'
days
'
,
n
:
'
天
'
},
{
v
:
'
hours
'
,
n
:
'
小时
'
},
{
v
:
'
minutes
'
,
n
:
'
分钟
'
},
{
v
:
'
seconds
'
,
n
:
'
秒
'
},
],
current
:
{
poor
:
{
input1
:
moment
(
moment
().
format
(
'
YYYY-MM-DD
'
)).
toDate
(),
input2
:
moment
(
moment
().
format
(
'
YYYY-MM-DD
'
)).
add
(
1
,
'
d
'
).
toDate
(),
unit
:
'
seconds
'
,
},
},
duration
:
{
{
input
:
moment
(
moment
().
format
(
'
YYYY-MM-DD
'
)).
toDate
()
,
text
:
'
当年日期
'
,
unit
:
'
days
'
,
value
()
{
type
:
'
+
'
,
return
moment
(
moment
().
format
(
'
YYYY-01-01
'
)).
toDate
()
length
:
1
,
}
,
},
},
],
},
poorUnit
:
[
{
v
:
'
years
'
,
n
:
'
年
'
,
rate
:
0
},
{
v
:
'
months
'
,
n
:
'
月
'
,
rate
:
0
},
{
v
:
'
weeks
'
,
n
:
'
周
'
,
rate
:
1000
*
60
*
60
*
24
*
7
},
{
v
:
'
days
'
,
n
:
'
天
'
,
rate
:
1000
*
60
*
60
*
24
},
{
v
:
'
hours
'
,
n
:
'
小时
'
,
rate
:
1000
*
60
*
60
},
{
v
:
'
minutes
'
,
n
:
'
分钟
'
,
rate
:
1000
*
60
},
{
v
:
'
seconds
'
,
n
:
'
秒
'
,
rate
:
1000
},
],
current
:
{
poor
:
{
input1
:
moment
(
moment
().
format
(
'
YYYY-MM-DD
'
)).
toDate
(),
input2
:
moment
(
moment
().
format
(
'
YYYY-MM-DD
'
)).
add
(
1
,
'
d
'
).
toDate
(),
unit
:
'
seconds
'
,
},
},
}
duration
:
{
},
input
:
moment
(
moment
().
format
(
'
YYYY-MM-DD
'
)).
toDate
(),
}
unit
:
'
days
'
,
type
:
'
+
'
,
length
:
1
,
},
},
}
},
}
</
script
>
</
script
>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录