|
@@ -1,7 +1,17 @@
|
|
|
import { defineComponent } from 'vue'
|
|
|
import styles from './index.module.less'
|
|
|
import ColHeader from '@/components/col-header'
|
|
|
-import { Button, Icon, Popup, RadioGroup, Sticky, Radio, Tag, List } from 'vant'
|
|
|
+import {
|
|
|
+ Button,
|
|
|
+ Icon,
|
|
|
+ Popup,
|
|
|
+ RadioGroup,
|
|
|
+ Sticky,
|
|
|
+ Radio,
|
|
|
+ Tag,
|
|
|
+ List,
|
|
|
+ ActionSheet
|
|
|
+} from 'vant'
|
|
|
import ColSearch from '@/components/col-search'
|
|
|
import PracticeItem from './practice-item'
|
|
|
import request from '@/helpers/request'
|
|
@@ -10,6 +20,35 @@ import AllSearch from './model/all-search'
|
|
|
import OrganSearch from './model/organ-search'
|
|
|
import { state } from '@/state'
|
|
|
|
|
|
+// {"subjectId":null,"search":"","sort":"starGrade ASC,expTime DESC,subjectPrice DESC"}
|
|
|
+const actions = [
|
|
|
+ {
|
|
|
+ name: '不限制',
|
|
|
+ value: '',
|
|
|
+ color: 'var(--van-primary)'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '单价最高',
|
|
|
+ value: 'subjectPrice DESC',
|
|
|
+ color: '#333'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '单价最低',
|
|
|
+ value: 'subjectPrice ASC',
|
|
|
+ color: '#333'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '课时数最多',
|
|
|
+ value: 'expTime DESC',
|
|
|
+ color: '#333'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '评分最高',
|
|
|
+ value: 'starGrade DESC',
|
|
|
+ color: '#333'
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
export default defineComponent({
|
|
|
name: 'practiceClass',
|
|
|
data() {
|
|
@@ -35,7 +74,8 @@ export default defineComponent({
|
|
|
subjectId: null as any,
|
|
|
page: 1,
|
|
|
rows: 20
|
|
|
- }
|
|
|
+ },
|
|
|
+ show: false
|
|
|
}
|
|
|
},
|
|
|
async mounted() {
|
|
@@ -52,15 +92,7 @@ export default defineComponent({
|
|
|
this.params.search = _search
|
|
|
this.onSort()
|
|
|
},
|
|
|
- onSort(type?: any) {
|
|
|
- const popupParams = type || this.tempSort
|
|
|
- let str: any = []
|
|
|
- for (let i in popupParams) {
|
|
|
- if (popupParams[i] !== 'ALL') {
|
|
|
- str.push(`${i} ${popupParams[i]}`)
|
|
|
- }
|
|
|
- }
|
|
|
- this.params.sort = str.join(',')
|
|
|
+ onSort() {
|
|
|
this.params.page = 1
|
|
|
this.list = []
|
|
|
this.dataShow = true // 判断是否有数据
|
|
@@ -69,6 +101,17 @@ export default defineComponent({
|
|
|
this.searchStatus = false
|
|
|
this.getList()
|
|
|
},
|
|
|
+ onSheetSelect(item: any) {
|
|
|
+ actions.forEach((v: any) => {
|
|
|
+ v.color = '#333'
|
|
|
+ if (v.value === item.value) {
|
|
|
+ v.color = 'var(--van-primary)'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.params.sort = item.value
|
|
|
+ this.show = false
|
|
|
+ this.onSort()
|
|
|
+ },
|
|
|
async getList() {
|
|
|
try {
|
|
|
if (this.dataLoading) {
|
|
@@ -149,8 +192,7 @@ export default defineComponent({
|
|
|
<div
|
|
|
class={styles.dataItem}
|
|
|
onClick={() => {
|
|
|
- this.searchStatus = !this.searchStatus
|
|
|
- this.searchType = 'all'
|
|
|
+ this.show = true
|
|
|
}}
|
|
|
>
|
|
|
筛选
|
|
@@ -199,6 +241,14 @@ export default defineComponent({
|
|
|
/>
|
|
|
)}
|
|
|
|
|
|
+ <ActionSheet
|
|
|
+ show={this.show}
|
|
|
+ actions={actions}
|
|
|
+ cancelText="取消"
|
|
|
+ onSelect={this.onSheetSelect}
|
|
|
+ onCancel={() => (this.show = false)}
|
|
|
+ />
|
|
|
+
|
|
|
<Popup
|
|
|
show={this.searchStatus}
|
|
|
position="bottom"
|
|
@@ -208,7 +258,7 @@ export default defineComponent({
|
|
|
onClose={() => (this.searchStatus = false)}
|
|
|
onClosed={() => (this.openStatus = false)}
|
|
|
>
|
|
|
- {this.searchType === 'all' && <AllSearch onSort={this.onSort} />}
|
|
|
+ {/* {this.searchType === 'all' && <AllSearch onSort={this.onSort} />} */}
|
|
|
{this.searchType === 'organ' && this.openStatus && (
|
|
|
<OrganSearch
|
|
|
subjectList={this.subjectList}
|