12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import api from '../../api/api'
- Component({
- properties: {
- visible: {
- value: false,
- type: Boolean
- }
- },
- data: {
- visible: false,
- param: {
- "id": "20221216145803",
- "version": 1,
- "content": {
- "pageSize": 20,
- "pageNumber": 1,
- "where": {
- "condition": ""
- }
- }
- },
- list: []
- },
- lifetimes: {
- attached() {
- this.listData()
- getApp().globalData.Language.getLanguagePackage(this)
- this.setData({
- loadingTexts: ['下拉刷新', '松手刷新', '正在刷新', '刷新完成'].map(v => getApp().globalData.Language.getMapText(v))
- })
- }
- },
- methods: {
- async listData() {
- const res = await api._post(this.data.param)
- if (res.data.length > 0) {
- this.setData({
- list: this.data.list.concat(res.data)
- })
- } else {
- getApp().globalData.Language.showToast('没有更多了!')
- }
- },
- onSubmit(data) {
- this.data.param.content.where.condition = data.detail.value
- this.data.list = []
- this.data.param.content.pageNumber = 1
- this.listData()
- },
- onClear() {
- this.data.param.content.where.condition = ''
- this.data.list = []
- this.data.param.content.pageNumber = 1
- this.listData()
- },
- onClick(data) {
- let item = data.currentTarget.dataset.item
- this.setData({
- visible: false
- })
- this.triggerEvent('select', item)
- },
- onPullDownRefresh() {
- this.data.list = []
- this.data.param.content.pageNumber = 1
- this.listData()
- },
- onReachBottom() {
- this.data.param.content.pageNumber++
- this.listData()
- },
- }
- })
|