场地预约整改:分工会/协会审核-校工会审核
This commit is contained in:
@@ -22,7 +22,8 @@ body {
|
||||
}
|
||||
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
/* Vue 挂载前隐藏原始模板及弹框内容,避免被 #app 的 display 规则覆盖;挂载后 Vue 自动移除此属性。 */
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
a, img {
|
||||
|
||||
@@ -198,10 +198,11 @@ layout("/mobile/platform.html"){
|
||||
<van-list
|
||||
:finished="finished"
|
||||
:finished-text="tableData.length>0?'没有更多了':''" :immediate-check="false"
|
||||
:error.sync="listError" error-text="加载失败,点击重试"
|
||||
@load="onLoad"
|
||||
v-model="loading">
|
||||
|
||||
<div class="van-doc-card" v-for="o in tableData">
|
||||
<div class="van-doc-card" v-for="o in tableData" :key="o.id">
|
||||
<div @click="openView(o)">
|
||||
|
||||
<div style="display: flex; justify-content: space-between">
|
||||
@@ -269,8 +270,10 @@ layout("/mobile/platform.html"){
|
||||
(() => {
|
||||
// PJAX 先执行内联脚本,等待历史组件加载;离开后的旧加载回调不能挂载到新页面。
|
||||
const pageRoot = document.getElementById('app')
|
||||
let pageStarted = false
|
||||
const startPage = () => {
|
||||
if (document.getElementById('app') !== pageRoot || !pageRoot.isConnected) return
|
||||
if (pageStarted || document.getElementById('app') !== pageRoot || !pageRoot.isConnected) return
|
||||
pageStarted = true
|
||||
<!--# include("/platform/activity/includeJs/activityUtil.js"){} #-->
|
||||
const siteTypeUtil = new typeUtil()
|
||||
new Vue({
|
||||
@@ -282,8 +285,11 @@ layout("/mobile/platform.html"){
|
||||
typeFilterShow:false, formLoading:false,
|
||||
tarBarActive: 0,
|
||||
list: ['a', 'b'],
|
||||
typeList: [],
|
||||
typeList: [{text:'全部场地类型',value:''}],
|
||||
siteId: '',
|
||||
// 初始化完成前禁止列表触发请求;requesting 独立于 Vant 的 loading 双向绑定。
|
||||
listReady: false, requesting: false, requestVersion: 0, listError: false,
|
||||
loading: true, mLoading: true,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -297,6 +303,9 @@ layout("/mobile/platform.html"){
|
||||
beforeDestroy() {
|
||||
// PJAX 替换 DOM 不会自动销毁实例,显式清理本页监听并触发历史 mixin 注销。
|
||||
$(document).off('pjax:beforeReplace.siteList', this._siteListDispose)
|
||||
// 离开页面后,类型请求和列表请求的旧回调均不能再发请求或追加数据。
|
||||
this.$set(this, 'listReady', false)
|
||||
this.$set(this, 'requestVersion', this.requestVersion + 1)
|
||||
},
|
||||
methods: {
|
||||
setPopupState(key, value) { this.$set(this, key, value) },
|
||||
@@ -332,17 +341,62 @@ layout("/mobile/platform.html"){
|
||||
this.clearPopupHistory(()=>{location.href = '/mobile/activity/site/info/reserve?id=' + this.siteId})
|
||||
},
|
||||
doSearch() {
|
||||
this.pageForm.pageNumber = 1
|
||||
this.tableData = []
|
||||
this.finished = false
|
||||
if (!this.listReady || this._isDestroyed || this._isBeingDestroyed) return
|
||||
// 新筛选拥有独立请求版本,旧响应及其 always 不能污染新列表或关闭新请求的 loading。
|
||||
this.$set(this, 'requestVersion', this.requestVersion + 1)
|
||||
this.$set(this, 'requesting', false)
|
||||
this.$set(this.pageForm, 'pageNumber', 1)
|
||||
this.$set(this.pageForm, 'totalCount', 0)
|
||||
this.$set(this, 'tableData', [])
|
||||
this.$set(this, 'finished', false)
|
||||
this.$set(this, 'listError', false)
|
||||
this.onLoad()
|
||||
},
|
||||
onLoad() {
|
||||
this.loading=true;return $.post('/mobile/activity/site/info/pageData',this.pageForm).then((res)=>{if(res.code===0){this.tableData=this.tableData.concat(res.data.list);this.finished=this.tableData.length>=res.data.totalCount;if(!this.finished)this.pageForm.pageNumber++}else{vant.Toast(res.msg)}}).always(()=>{this.loading=false});
|
||||
if (!this.listReady || this.requesting || this.finished || this._isDestroyed || this._isBeingDestroyed) return
|
||||
const version = this.requestVersion
|
||||
// 请求携带筛选和页码快照;成功后才推进页码,失败重试仍请求原页。
|
||||
const params = Object.assign({}, this.pageForm)
|
||||
this.$set(this, 'requesting', true)
|
||||
this.$set(this, 'loading', true)
|
||||
this.$set(this, 'listError', false)
|
||||
return $.post('/mobile/activity/site/info/pageData', params).then((res) => {
|
||||
if (version !== this.requestVersion) return
|
||||
if (!res || res.code !== 0 || !res.data || !Array.isArray(res.data.list)) {
|
||||
this.$set(this, 'listError', true)
|
||||
vant.Toast(res && res.msg || '场地列表加载失败,请重试')
|
||||
return
|
||||
}
|
||||
const rows = this.tableData.concat(res.data.list)
|
||||
this.$set(this, 'tableData', rows)
|
||||
this.$set(this.pageForm, 'totalCount', res.data.totalCount)
|
||||
this.$set(this, 'finished', res.data.list.length === 0 || rows.length >= res.data.totalCount)
|
||||
this.$set(this.pageForm, 'pageNumber', params.pageNumber + 1)
|
||||
}, () => {
|
||||
if (version !== this.requestVersion) return
|
||||
this.$set(this, 'listError', true)
|
||||
vant.Toast('场地列表加载失败,请重试')
|
||||
}).always(() => {
|
||||
if (version !== this.requestVersion) return
|
||||
this.$set(this, 'requesting', false)
|
||||
this.$set(this, 'loading', false)
|
||||
this.$set(this, 'mLoading', false)
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
siteTypeUtil.getAllType().then((rows)=>{this.typeList=[{text:'全部场地类型'}].concat(rows);this.$set(this.pageForm,'typeId',this.typeList[0].value);this.onLoad()});
|
||||
// 类型加载结束后统一启动首屏;类型请求失败时仍允许查看全部场地。
|
||||
siteTypeUtil.getAllType().then((rows) => {
|
||||
if (this._isDestroyed || this._isBeingDestroyed) return
|
||||
this.$set(this, 'typeList', [{text:'全部场地类型',value:''}].concat(rows))
|
||||
}, () => {
|
||||
if (!this._isDestroyed && !this._isBeingDestroyed) vant.Toast('场地类型加载失败,先显示全部场地')
|
||||
}).always(() => {
|
||||
if (this._isDestroyed || this._isBeingDestroyed) return
|
||||
this.$set(this.pageForm, 'typeId', '')
|
||||
this.$set(this, 'listReady', true)
|
||||
this.doSearch()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -265,8 +265,8 @@ layout("/mobile/platform.html"){
|
||||
<van-button @click="reserveDo" :loading="formLoading" color="#246fb4" style="width: 47%" size="small" type="info">确认</van-button>
|
||||
</div>
|
||||
</van-action-sheet>
|
||||
<!-- 选项弹层后于确认表单打开,由 Vant 分配更高层级;选择或返回只关闭本层。 -->
|
||||
<van-popup v-model="optionsShow" position="top" class="site-reserve-options" safe-area-inset-top>
|
||||
<!-- 预约类型和所属协会共用底部选项层,适配底部安全区域;选择或返回只关闭本层。 -->
|
||||
<van-popup v-model="optionsShow" position="bottom" class="site-reserve-options" safe-area-inset-bottom>
|
||||
<van-nav-bar :title="optionKind==='type' ? '选择预约类型' : '选择所属协会'"
|
||||
left-text="返回" left-arrow @click-left="closeOptions"></van-nav-bar>
|
||||
<van-cell v-for="option in selectionOptions" :key="option.value" :title="option.text" clickable
|
||||
|
||||
Reference in New Issue
Block a user