Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
mallapp
Commits
ce018a05
Commit
ce018a05
authored
Jul 27, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增活动点名
parent
2a6d4def
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1974 additions
and
8 deletions
+1974
-8
pages.json
pages.json
+2
-0
JIaheactivitydetails.vue
pages/school/JIaheactivitydetails.vue
+29
-2
Jiaheactivity.vue
pages/school/Jiaheactivity.vue
+0
-6
RollCall.vue
pages/school/RollCall.vue
+148
-0
uni-table.vue
pages/school/tableComponents/uni-table/uni-table.vue
+455
-0
uni-tbody.vue
pages/school/tableComponents/uni-tbody/uni-tbody.vue
+29
-0
uni-td.vue
pages/school/tableComponents/uni-td/uni-td.vue
+90
-0
filter-dropdown.vue
pages/school/tableComponents/uni-th/filter-dropdown.vue
+502
-0
uni-th.vue
pages/school/tableComponents/uni-th/uni-th.vue
+250
-0
uni-thead.vue
pages/school/tableComponents/uni-thead/uni-thead.vue
+129
-0
table-checkbox.vue
pages/school/tableComponents/uni-tr/table-checkbox.vue
+178
-0
uni-tr.vue
pages/school/tableComponents/uni-tr/uni-tr.vue
+162
-0
No files found.
pages.json
View file @
ce018a05
...
...
@@ -451,6 +451,8 @@
"path"
:
"Jiaheactivity"
//甲鹤活动
},{
"path"
:
"JIaheactivitydetails"
//活动详情
},{
"path"
:
"RollCall"
//活动点名
},{
"path"
:
"jieheactivityBM"
//甲鹤活动报名
},{
...
...
pages/school/JIaheactivitydetails.vue
View file @
ce018a05
...
...
@@ -496,10 +496,11 @@
<text style="font-size: 22rpx;">点</text>
</view> -->
</view>
<view
class=
"btnc"
:style=
"{background:mainColor}"
v-if=
"IsShowRollCall==1"
@
click=
"goRollCall"
>
点名
</view>
<view
v-if=
"detial.IsJoinActivity==0"
>
<view
class=
"btnc"
v-if=
"detial.IsSignUp==1 && (detial.TotalMan- detial.JoinNum)>0"
:style=
"{background:mainColor}"
@
click=
"gosignUp()"
>
立即预约
</view>
<view
class=
"btnc"
v-if=
"detial.IsSignUp==0 || (detial.TotalMan- detial.JoinNum)==0"
>
不可预约
</view>
</view>
<view
v-if=
"detial.IsJoinActivity==1"
>
<view
class=
"btnc"
v-if=
"detial.IsSignUp==1"
>
已报名
</view>
...
...
@@ -527,7 +528,8 @@
Id
:
0
,
detial
:{},
richtext
:
""
,
Up
:
0
Up
:
0
,
IsShowRollCall
:
0
,
//是否显示点名按钮
}
},
onShareTimeline
()
{
...
...
@@ -588,6 +590,7 @@
uni
.
setNavigationBarTitle
({
title
:
this
.
pageTitle
,
});
this
.
GetEduRollCallAction
();
},
methods
:{
goPicDetail
(
arr
){
...
...
@@ -671,6 +674,30 @@
gbAuth
(){
this
.
showAuth
=
false
},
goRollCall
(){
uni
.
navigateTo
({
url
:
"/pages/school/RollCall?ActivityId="
+
this
.
Id
})
},
GetEduRollCallAction
(){
this
.
u
=
uni
.
getStorageSync
(
"mall_UserInfo"
);
if
(
!
this
.
u
)
{
uni
.
showToast
({
title
:
"请登录"
,
icon
:
"error"
})
}
else
{
this
.
request2
({
url
:
'/api/AppletEducation/GetEduRollCallAction'
,
data
:
{}
},
res
=>
{
this
.
IsShowRollCall
=
res
.
data
.
IsEduRollCallAction
}
);
}
},
}
}
</
script
>
...
...
pages/school/Jiaheactivity.vue
View file @
ce018a05
...
...
@@ -319,7 +319,6 @@
};
},
onShareAppMessage
(
res
)
{
let
u
=
uni
.
getStorageSync
(
"mall_UserInfo"
);
let
uid
=
u
.
UserId
?
u
.
UserId
:
0
;
if
(
uid
==
0
)
{
...
...
@@ -342,13 +341,10 @@
this
.
tabbarH
=
this
.
$uiConfig
.
is_bang
?
78
:
50
;
},
mounted
()
{
uni
.
setNavigationBarTitle
({
title
:
this
.
pageTitle
,
});
let
basedata
=
wx
.
getStorageSync
(
"basedata"
)
},
onLoad
:
function
(
option
)
{
// this.u = uni.getStorageSync("mall_UserInfo");
...
...
@@ -361,8 +357,6 @@
// } else {
this
.
GetActivityTypeList
()
// }
},
methods
:
{
GetActivityTypeList
(){
...
...
pages/school/RollCall.vue
0 → 100644
View file @
ce018a05
<
style
scoped
>
.flex
{
display
:
flex
;
}
.con
{
width
:
100%
;
height
:
100vh
;
background-color
:
#FFF
;
box-sizing
:
border-box
;
padding-bottom
:
90
rpx
;
}
.nowrap
{
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
.mr
{
margin-right
:
10
rpx
;
}
.btn
{
/* width: 100%; */
/* height: 45px; */
padding
:
0
rpx
30
rpx
;
border-radius
:
10
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
font-size
:
24
rpx
;
font-family
:
PingFang
SC
;
color
:
#EEEEEE
;
}
</
style
>
<
template
>
<view
class=
"con"
>
<uni-table
border
stripe
emptyText=
"暂无数据"
>
<!-- 表头行 -->
<uni-tr
class=
"header"
>
<uni-th
align=
"center"
width=
"100"
>
姓名
</uni-th>
<uni-th
align=
"center"
width=
"100"
>
手机号
</uni-th>
<uni-th
align=
"center"
width=
"80"
>
状态
</uni-th>
<uni-th
align=
"center"
width=
"auto"
>
操作
</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr
v-for=
"item in data"
>
<uni-td
align=
"center"
>
<view
class=
"nowrap"
>
{{
item
.
LinkMan
}}
</view>
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
LinkTel
}}
</uni-td>
<uni-td
align=
"center"
>
<view
class=
"nowrap"
>
<text
v-if=
"item.IsRollCall==1"
>
未到
</text>
<text
v-if=
"item.IsRollCall==2"
>
已到
</text>
</view>
</uni-td>
<uni-td
align=
"center"
>
<view
class=
"flex"
v-if=
"item.IsCommission!=2"
>
<view
class=
"btn mr nowrap"
:style=
"
{'background-color':mainColor}" @click="SignIn(item,2)">
已到
</view>
<view
class=
"btn nowrap"
style=
"color: #999;"
:style=
"
{'border': `1rpx solid ${mainColor}`}" @click="SignIn(item,1)">
未到
</view>
</view>
</uni-td>
</uni-tr>
</uni-table>
</view>
</
template
>
<
script
>
import
uniTable
from
'./tableComponents/uni-table/uni-table.vue'
import
uniTr
from
'./tableComponents/uni-tr/uni-tr.vue'
import
uniTh
from
'./tableComponents/uni-th/uni-th.vue'
import
uniTd
from
'./tableComponents/uni-td/uni-td.vue'
export
default
{
components
:{
uniTable
,
uniTr
,
uniTh
,
uniTd
},
data
()
{
return
{
pageTitle
:
"点名列表"
,
mainColor
:
''
,
scrollTop
:
0
,
ActivityId
:
0
,
data
:[],
};
},
created
()
{
this
.
mainColor
=
this
.
$uiConfig
.
mainColor
;
},
mounted
()
{
uni
.
setNavigationBarTitle
({
title
:
this
.
pageTitle
,
});
},
onLoad
(
option
)
{
this
.
ActivityId
=
option
.
ActivityId
this
.
GetRollCallConsultList
();
},
methods
:
{
GetRollCallConsultList
()
{
this
.
request2
({
url
:
'/api/AppletEducation/GetRollCallConsultList'
,
data
:
{
ActivityId
:
this
.
ActivityId
}
},
res
=>
{
if
(
res
.
resultCode
===
1
){
this
.
data
=
res
.
data
}
}
);
},
SignIn
(
item
,
i
){
let
newItem
=
JSON
.
parse
(
JSON
.
stringify
(
item
))
newItem
.
IsRollCall
=
i
let
that
=
this
this
.
request2
({
url
:
'/api/AppletEducation/GetUpdateRollCallConsultList'
,
data
:
[
newItem
]
},
res
=>
{
if
(
res
.
resultCode
===
1
){
uni
.
showToast
({
title
:
"操作成功"
,
icon
:
"success"
})
that
.
GetRollCallConsultList
();
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
"error"
})
}
}
);
}
},
};
</
script
>
pages/school/tableComponents/uni-table/uni-table.vue
0 → 100644
View file @
ce018a05
This diff is collapsed.
Click to expand it.
pages/school/tableComponents/uni-tbody/uni-tbody.vue
0 → 100644
View file @
ce018a05
<
template
>
<!-- #ifdef H5 -->
<tbody>
<slot></slot>
</tbody>
<!-- #endif -->
<!-- #ifndef H5 -->
<view><slot></slot></view>
<!-- #endif -->
</
template
>
<
script
>
export
default
{
name
:
'uniBody'
,
options
:
{
virtualHost
:
true
},
data
()
{
return
{
}
},
created
()
{},
methods
:
{}
}
</
script
>
<
style
>
</
style
>
pages/school/tableComponents/uni-td/uni-td.vue
0 → 100644
View file @
ce018a05
<
template
>
<!-- #ifdef H5 -->
<td
class=
"uni-table-td"
:rowspan=
"rowspan"
:colspan=
"colspan"
:class=
"
{'table--border':border}" :style="{width:width + 'px','text-align':align}">
<slot></slot>
</td>
<!-- #endif -->
<!-- #ifndef H5 -->
<!-- :class="
{'table--border':border}" -->
<view
class=
"uni-table-td"
:class=
"
{'table--border':border}" :style="{width:width + 'px','text-align':align}">
<slot></slot>
</view>
<!-- #endif -->
</
template
>
<
script
>
/**
* Td 单元格
* @description 表格中的标准单元格组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=3270
* @property {Number} align = [left|center|right] 单元格对齐方式
*/
export
default
{
name
:
'uniTd'
,
options
:
{
virtualHost
:
true
},
props
:
{
width
:
{
type
:
[
String
,
Number
],
default
:
''
},
align
:
{
type
:
String
,
default
:
'left'
},
rowspan
:
{
type
:
[
Number
,
String
],
default
:
1
},
colspan
:
{
type
:
[
Number
,
String
],
default
:
1
}
},
data
()
{
return
{
border
:
false
};
},
created
()
{
this
.
root
=
this
.
getTable
()
this
.
border
=
this
.
root
.
border
},
methods
:
{
/**
* 获取父元素实例
*/
getTable
()
{
let
parent
=
this
.
$parent
;
let
parentName
=
parent
.
$options
.
name
;
while
(
parentName
!==
'uniTable'
)
{
parent
=
parent
.
$parent
;
if
(
!
parent
)
return
false
;
parentName
=
parent
.
$options
.
name
;
}
return
parent
;
},
}
}
</
script
>
<
style
lang=
"scss"
>
$border-color
:
#EBEEF5
;
.uni-table-td
{
display
:
table-cell
;
padding
:
8px
10px
;
font-size
:
14px
;
border-bottom
:
1px
$border-color
solid
;
font-weight
:
400
;
color
:
#606266
;
line-height
:
23px
;
box-sizing
:
border-box
;
}
.table--border
{
border-right
:
1px
$border-color
solid
;
}
</
style
>
pages/school/tableComponents/uni-th/filter-dropdown.vue
0 → 100644
View file @
ce018a05
This diff is collapsed.
Click to expand it.
pages/school/tableComponents/uni-th/uni-th.vue
0 → 100644
View file @
ce018a05
<
template
>
<!-- #ifdef H5 -->
<th
:rowspan=
"rowspan"
:colspan=
"colspan"
class=
"uni-table-th"
:class=
"
{ 'table--border': border }" :style="{ width: width + 'px', 'text-align': align }">
<view
class=
"uni-table-th-row"
>
<view
class=
"uni-table-th-content"
:style=
"
{ 'justify-content': contentAlign }" @click="sort">
<slot></slot>
<view
v-if=
"sortable"
class=
"arrow-box"
>
<text
class=
"arrow up"
:class=
"
{ active: ascending }" @click.stop="ascendingFn">
</text>
<text
class=
"arrow down"
:class=
"
{ active: descending }" @click.stop="descendingFn">
</text>
</view>
</view>
<dropdown
v-if=
"filterType || filterData.length"
:filterData=
"filterData"
:filterType=
"filterType"
@
change=
"ondropdown"
></dropdown>
</view>
</th>
<!-- #endif -->
<!-- #ifndef H5 -->
<view
class=
"uni-table-th"
:class=
"
{ 'table--border': border }" :style="{ width: width + 'px', 'text-align': align }">
<slot></slot></view>
<!-- #endif -->
</
template
>
<
script
>
import
dropdown
from
'./filter-dropdown.vue'
/**
* Th 表头
* @description 表格内的表头单元格组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=3270
* @property {Number} width 单元格宽度
* @property {Boolean} sortable 是否启用排序
* @property {Number} align = [left|center|right] 单元格对齐方式
* @value left 单元格文字左侧对齐
* @value center 单元格文字居中
* @value right 单元格文字右侧对齐
* @property {Array} filterData 筛选数据
* @property {String} filterType [search|select] 筛选类型
* @value search 关键字搜素
* @value select 条件选择
* @event {Function} sort-change 排序触发事件
*/
export
default
{
name
:
'uniTh'
,
options
:
{
virtualHost
:
true
},
components
:
{
dropdown
},
props
:
{
width
:
{
type
:
[
String
,
Number
],
default
:
''
},
align
:
{
type
:
String
,
default
:
'left'
},
rowspan
:
{
type
:
[
Number
,
String
],
default
:
1
},
colspan
:
{
type
:
[
Number
,
String
],
default
:
1
},
sortable
:
{
type
:
Boolean
,
default
:
false
},
filterType
:
{
type
:
String
,
default
:
""
},
filterData
:
{
type
:
Array
,
default
()
{
return
[]
}
}
},
data
()
{
return
{
border
:
false
,
ascending
:
false
,
descending
:
false
}
},
computed
:
{
contentAlign
()
{
let
align
=
'left'
switch
(
this
.
align
)
{
case
'left'
:
align
=
'flex-start'
break
case
'center'
:
align
=
'center'
break
case
'right'
:
align
=
'flex-end'
break
}
return
align
}
},
created
()
{
this
.
root
=
this
.
getTable
(
'uniTable'
)
this
.
rootTr
=
this
.
getTable
(
'uniTr'
)
this
.
rootTr
.
minWidthUpdate
(
this
.
width
?
this
.
width
:
140
)
this
.
border
=
this
.
root
.
border
this
.
root
.
thChildren
.
push
(
this
)
},
methods
:
{
sort
()
{
if
(
!
this
.
sortable
)
return
this
.
clearOther
()
if
(
!
this
.
ascending
&&
!
this
.
descending
)
{
this
.
ascending
=
true
this
.
$emit
(
'sort-change'
,
{
order
:
'ascending'
})
return
}
if
(
this
.
ascending
&&
!
this
.
descending
)
{
this
.
ascending
=
false
this
.
descending
=
true
this
.
$emit
(
'sort-change'
,
{
order
:
'descending'
})
return
}
if
(
!
this
.
ascending
&&
this
.
descending
)
{
this
.
ascending
=
false
this
.
descending
=
false
this
.
$emit
(
'sort-change'
,
{
order
:
null
})
}
},
ascendingFn
()
{
this
.
clearOther
()
this
.
ascending
=
!
this
.
ascending
this
.
descending
=
false
this
.
$emit
(
'sort-change'
,
{
order
:
this
.
ascending
?
'ascending'
:
null
})
},
descendingFn
()
{
this
.
clearOther
()
this
.
descending
=
!
this
.
descending
this
.
ascending
=
false
this
.
$emit
(
'sort-change'
,
{
order
:
this
.
descending
?
'descending'
:
null
})
},
clearOther
()
{
this
.
root
.
thChildren
.
map
(
item
=>
{
if
(
item
!==
this
)
{
item
.
ascending
=
false
item
.
descending
=
false
}
return
item
})
},
ondropdown
(
e
)
{
this
.
$emit
(
"filter-change"
,
e
)
},
/**
* 获取父元素实例
*/
getTable
(
name
)
{
let
parent
=
this
.
$parent
let
parentName
=
parent
.
$options
.
name
while
(
parentName
!==
name
)
{
parent
=
parent
.
$parent
if
(
!
parent
)
return
false
parentName
=
parent
.
$options
.
name
}
return
parent
}
}
}
</
script
>
<
style
lang=
"scss"
>
$border-color
:
#ebeef5
;
.uni-table-th
{
padding
:
12px
10px
;
/* #ifndef APP-NVUE */
display
:
table-cell
;
box-sizing
:
border-box
;
/* #endif */
font-size
:
14px
;
font-weight
:
bold
;
color
:
#909399
;
border-bottom
:
1px
$border-color
solid
;
}
.uni-table-th-row
{
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
}
.table--border
{
border-right
:
1px
$border-color
solid
;
}
.uni-table-th-content
{
display
:
flex
;
align-items
:
center
;
flex
:
1
;
}
.arrow-box
{
}
.arrow
{
display
:
block
;
position
:
relative
;
width
:
10px
;
height
:
8px
;
// border: 1px red solid;
left
:
5px
;
overflow
:
hidden
;
cursor
:
pointer
;
}
.down
{
top
:
3px
;
::after
{
content
:
''
;
width
:
8px
;
height
:
8px
;
position
:
absolute
;
left
:
2px
;
top
:
-5px
;
transform
:
rotate
(
45deg
);
background-color
:
#ccc
;
}
&
.active
{
::after
{
background-color
:
#007aff
;
}
}
}
.up
{
::after
{
content
:
''
;
width
:
8px
;
height
:
8px
;
position
:
absolute
;
left
:
2px
;
top
:
5px
;
transform
:
rotate
(
45deg
);
background-color
:
#ccc
;
}
&
.active
{
::after
{
background-color
:
#007aff
;
}
}
}
</
style
>
pages/school/tableComponents/uni-thead/uni-thead.vue
0 → 100644
View file @
ce018a05
<
template
>
<!-- #ifdef H5 -->
<thead
class=
"uni-table-thead"
>
<tr
class=
"uni-table-tr"
>
<th
:rowspan=
"rowspan"
colspan=
"1"
class=
"checkbox"
:class=
"
{ 'tr-table--border': border }">
<table-checkbox
:indeterminate=
"indeterminate"
:checked=
"checked"
@
checkboxSelected=
"checkboxSelected"
></table-checkbox>
</th>
</tr>
<slot></slot>
</thead>
<!-- #endif -->
<!-- #ifndef H5 -->
<view
class=
"uni-table-thead"
><slot></slot></view>
<!-- #endif -->
</
template
>
<
script
>
import
tableCheckbox
from
'../uni-tr/table-checkbox.vue'
export
default
{
name
:
'uniThead'
,
components
:
{
tableCheckbox
},
options
:
{
virtualHost
:
true
},
data
()
{
return
{
border
:
false
,
selection
:
false
,
rowspan
:
1
,
indeterminate
:
false
,
checked
:
false
}
},
created
()
{
this
.
root
=
this
.
getTable
()
// #ifdef H5
this
.
root
.
theadChildren
=
this
// #endif
this
.
border
=
this
.
root
.
border
this
.
selection
=
this
.
root
.
type
},
methods
:
{
init
(
self
)
{
this
.
rowspan
++
},
checkboxSelected
(
e
)
{
this
.
indeterminate
=
false
const
backIndexData
=
this
.
root
.
backIndexData
const
data
=
this
.
root
.
trChildren
.
filter
(
v
=>
!
v
.
disabled
&&
v
.
keyValue
)
if
(
backIndexData
.
length
===
data
.
length
)
{
this
.
checked
=
false
this
.
root
.
clearSelection
()
}
else
{
this
.
checked
=
true
this
.
root
.
selectionAll
()
}
},
/**
* 获取父元素实例
*/
getTable
(
name
=
'uniTable'
)
{
let
parent
=
this
.
$parent
let
parentName
=
parent
.
$options
.
name
while
(
parentName
!==
name
)
{
parent
=
parent
.
$parent
if
(
!
parent
)
return
false
parentName
=
parent
.
$options
.
name
}
return
parent
}
}
}
</
script
>
<
style
lang=
"scss"
>
$border-color
:
#ebeef5
;
.uni-table-thead
{
display
:
table-header-group
;
}
.uni-table-tr
{
/* #ifndef APP-NVUE */
display
:
table-row
;
transition
:
all
0
.3s
;
box-sizing
:
border-box
;
/* #endif */
border
:
1px
red
solid
;
background-color
:
#fafafa
;
}
.checkbox
{
padding
:
0
8px
;
width
:
26px
;
padding-left
:
12px
;
/* #ifndef APP-NVUE */
display
:
table-cell
;
vertical-align
:
middle
;
/* #endif */
color
:
#333
;
font-weight
:
500
;
border-bottom
:
1px
$border-color
solid
;
font-size
:
14px
;
// text-align: center;
}
.tr-table--border
{
border-right
:
1px
$border-color
solid
;
}
/* #ifndef APP-NVUE */
.uni-table-tr
{
::v-deep
.uni-table-th
{
&
.table--border
:last-child
{
// border-right: none;
}
}
::v-deep
.uni-table-td
{
&
.table--border
:last-child
{
// border-right: none;
}
}
}
/* #endif */
</
style
>
pages/school/tableComponents/uni-tr/table-checkbox.vue
0 → 100644
View file @
ce018a05
<
template
>
<view
class=
"uni-table-checkbox"
@
click=
"selected"
>
<view
v-if=
"!indeterminate"
class=
"checkbox__inner"
:class=
"
{'is-checked':isChecked,'is-disable':isDisabled}">
<view
class=
"checkbox__inner-icon"
></view>
</view>
<view
v-else
class=
"checkbox__inner checkbox--indeterminate"
>
<view
class=
"checkbox__inner-icon"
></view>
</view>
</view>
</
template
>
<
script
>
export
default
{
name
:
'TableCheckbox'
,
props
:
{
indeterminate
:
{
type
:
Boolean
,
default
:
false
},
checked
:
{
type
:
[
Boolean
,
String
],
default
:
false
},
disabled
:
{
type
:
Boolean
,
default
:
false
},
index
:
{
type
:
Number
,
default
:
-
1
},
cellData
:
{
type
:
Object
,
default
()
{
return
{}
}
}
},
watch
:{
checked
(
newVal
){
if
(
typeof
this
.
checked
===
'boolean'
){
this
.
isChecked
=
newVal
}
else
{
this
.
isChecked
=
true
}
},
indeterminate
(
newVal
){
this
.
isIndeterminate
=
newVal
}
},
data
()
{
return
{
isChecked
:
false
,
isDisabled
:
false
,
isIndeterminate
:
false
}
},
created
()
{
if
(
typeof
this
.
checked
===
'boolean'
){
this
.
isChecked
=
this
.
checked
}
this
.
isDisabled
=
this
.
disabled
},
methods
:
{
selected
()
{
if
(
this
.
isDisabled
)
return
this
.
isIndeterminate
=
false
this
.
isChecked
=
!
this
.
isChecked
this
.
$emit
(
'checkboxSelected'
,
{
checked
:
this
.
isChecked
,
data
:
this
.
cellData
})
}
}
}
</
script
>
<
style
lang=
"scss"
>
$checked-color
:
#007aff
;
$border-color
:
#DCDFE6
;
$disable
:
0
.4
;
.uni-table-checkbox
{
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
center
;
position
:
relative
;
margin
:
5px
0
;
cursor
:
pointer
;
// 多选样式
.checkbox__inner
{
/* #ifndef APP-NVUE */
flex-shrink
:
0
;
box-sizing
:
border-box
;
/* #endif */
position
:
relative
;
width
:
16px
;
height
:
16px
;
border
:
1px
solid
$border-color
;
border-radius
:
2px
;
background-color
:
#fff
;
z-index
:
1
;
.checkbox__inner-icon
{
position
:
absolute
;
/* #ifdef APP-NVUE */
top
:
2px
;
/* #endif */
/* #ifndef APP-NVUE */
top
:
2px
;
/* #endif */
left
:
5px
;
height
:
7px
;
width
:
3px
;
border
:
1px
solid
#fff
;
border-left
:
0
;
border-top
:
0
;
opacity
:
0
;
transform-origin
:
center
;
transform
:
rotate
(
45deg
);
box-sizing
:
content-box
;
}
&
.checkbox--indeterminate
{
border-color
:
$checked-color
;
background-color
:
$checked-color
;
.checkbox__inner-icon
{
position
:
absolute
;
opacity
:
1
;
transform
:
rotate
(
0deg
);
height
:
2px
;
top
:
0
;
bottom
:
0
;
margin
:
auto
;
left
:
0px
;
right
:
0px
;
bottom
:
0
;
width
:
auto
;
border
:
none
;
border-radius
:
2px
;
transform
:
scale
(
0
.5
);
background-color
:
#fff
;
}
}
&
:hover
{
border-color
:
$checked-color
;
}
// 禁用
&
.is-disable
{
/* #ifdef H5 */
cursor
:
not
-
allowed
;
/* #endif */
background-color
:
#F2F6FC
;
border-color
:
$border-color
;
}
// 选中
&
.is-checked
{
border-color
:
$checked-color
;
background-color
:
$checked-color
;
.checkbox__inner-icon
{
opacity
:
1
;
transform
:
rotate
(
45deg
);
}
// 选中禁用
&
.is-disable
{
opacity
:
$disable
;
}
}
}
}
</
style
>
pages/school/tableComponents/uni-tr/uni-tr.vue
0 → 100644
View file @
ce018a05
<
template
>
<!-- #ifdef H5 -->
<tr
class=
"uni-table-tr"
>
<th
v-if=
"selection === 'selection' && ishead"
class=
"checkbox"
:class=
"
{ 'tr-table--border': border }">
<table-checkbox
:checked=
"checked"
:indeterminate=
"indeterminate"
:disabled=
"disabled"
@
checkboxSelected=
"checkboxSelected"
></table-checkbox>
</th>
<slot></slot>
<!--
<uni-th
class=
"th-fixed"
>
123
</uni-th>
-->
</tr>
<!-- #endif -->
<!-- #ifndef H5 -->
<view
class=
"uni-table-tr"
>
<view
v-if=
"selection === 'selection' "
class=
"checkbox"
:class=
"
{ 'tr-table--border': border }">
<table-checkbox
:checked=
"checked"
:indeterminate=
"indeterminate"
:disabled=
"disabled"
@
checkboxSelected=
"checkboxSelected"
></table-checkbox>
</view>
<slot></slot>
</view>
<!-- #endif -->
</
template
>
<
script
>
import
tableCheckbox
from
'./table-checkbox.vue'
/**
* Tr 表格行组件
* @description 表格行组件 仅包含 th,td 组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=
*/
export
default
{
name
:
'uniTr'
,
components
:
{
tableCheckbox
},
props
:
{
disabled
:
{
type
:
Boolean
,
default
:
false
},
keyValue
:
{
type
:
[
String
,
Number
],
default
:
''
}
},
options
:
{
virtualHost
:
true
},
data
()
{
return
{
value
:
false
,
border
:
false
,
selection
:
false
,
widthThArr
:
[],
ishead
:
true
,
checked
:
false
,
indeterminate
:
false
}
},
created
()
{
this
.
root
=
this
.
getTable
()
this
.
head
=
this
.
getTable
(
'uniThead'
)
if
(
this
.
head
)
{
this
.
ishead
=
false
this
.
head
.
init
(
this
)
}
this
.
border
=
this
.
root
.
border
this
.
selection
=
this
.
root
.
type
this
.
root
.
trChildren
.
push
(
this
)
const
rowData
=
this
.
root
.
data
.
find
(
v
=>
v
[
this
.
root
.
rowKey
]
===
this
.
keyValue
)
if
(
rowData
){
this
.
rowData
=
rowData
}
this
.
root
.
isNodata
()
},
mounted
()
{
if
(
this
.
widthThArr
.
length
>
0
)
{
const
selectionWidth
=
this
.
selection
===
'selection'
?
50
:
0
this
.
root
.
minWidth
=
this
.
widthThArr
.
reduce
((
a
,
b
)
=>
Number
(
a
)
+
Number
(
b
))
+
selectionWidth
}
},
destroyed
()
{
const
index
=
this
.
root
.
trChildren
.
findIndex
(
i
=>
i
===
this
)
this
.
root
.
trChildren
.
splice
(
index
,
1
)
this
.
root
.
isNodata
()
},
methods
:
{
minWidthUpdate
(
width
)
{
this
.
widthThArr
.
push
(
width
)
},
// 选中
checkboxSelected
(
e
)
{
let
rootData
=
this
.
root
.
data
.
find
(
v
=>
v
[
this
.
root
.
rowKey
]
===
this
.
keyValue
)
this
.
checked
=
e
.
checked
this
.
root
.
check
(
rootData
||
this
,
e
.
checked
,
rootData
?
this
.
keyValue
:
null
)
},
change
(
e
)
{
this
.
root
.
trChildren
.
forEach
(
item
=>
{
if
(
item
===
this
)
{
this
.
root
.
check
(
this
,
e
.
detail
.
value
.
length
>
0
?
true
:
false
)
}
})
},
/**
* 获取父元素实例
*/
getTable
(
name
=
'uniTable'
)
{
let
parent
=
this
.
$parent
let
parentName
=
parent
.
$options
.
name
while
(
parentName
!==
name
)
{
parent
=
parent
.
$parent
if
(
!
parent
)
return
false
parentName
=
parent
.
$options
.
name
}
return
parent
}
}
}
</
script
>
<
style
lang=
"scss"
>
$border-color
:
#ebeef5
;
.uni-table-tr
{
/* #ifndef APP-NVUE */
display
:
table-row
;
transition
:
all
0
.3s
;
box-sizing
:
border-box
;
/* #endif */
}
.checkbox
{
padding
:
0
8px
;
width
:
26px
;
padding-left
:
12px
;
/* #ifndef APP-NVUE */
display
:
table-cell
;
vertical-align
:
middle
;
/* #endif */
color
:
#333
;
font-weight
:
500
;
border-bottom
:
1px
$border-color
solid
;
font-size
:
14px
;
// text-align: center;
}
.tr-table--border
{
border-right
:
1px
$border-color
solid
;
}
/* #ifndef APP-NVUE */
.uni-table-tr
{
::v-deep
.uni-table-th
{
&
.table--border
:last-child
{
// border-right: none;
}
}
::v-deep
.uni-table-td
{
&
.table--border
:last-child
{
// border-right: none;
}
}
}
/* #endif */
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment