Browse Source

优化下

master
mk 1 year ago
parent
commit
942c7f38d6
  1. 2
      src/router/router.config.js
  2. 17
      src/store/index.js
  3. 18
      src/store/modules/app.js
  4. 23
      src/views/assistance/index.vue

2
src/router/router.config.js

@ -19,7 +19,7 @@ export const constantRouterMap = [
path: '/assistance',
name:'assistance',
component: () => import('@/views/assistance'),
meta: { title: '诉求代办', keepAlive: false }
meta: { title: '诉求代办', keepAlive: true }
},
{
path: '/changePassword',

17
src/store/index.js

@ -1,20 +1,3 @@
// import Vue from 'vue'
// import Vuex from 'vuex'
// import getters from './getters'
// import app from './modules/app'
// Vue.use(Vuex)
// const store = new Vuex.Store({
// modules: {
// app
// },
// getters
// })
// export default store
import Vue from 'vue'
import Vuex from 'vuex'

18
src/store/modules/app.js

@ -1,15 +1,29 @@
const state = {
userName: ''
userName: '',
tabActive:0,
scrollTop:0
}
const mutations = {
SET_USER_NAME(state, name) {
state.userName = name
}
},
SET_TAB_ACTIVE(state, num) {
state.tabActive = num
},
SET_SCROLL_TOP(state, num){
state.scrollTop = num
},
}
const actions = {
// 设置name
setUserName({ commit }, name) {
commit('SET_USER_NAME', name)
},
setTabActive({ commit }, num) {
commit('SET_TAB_ACTIVE', num)
},
setScrollTop({ commit }, num){
commit('SET_SCROLL_TOP', num)
}
}
export default {

23
src/views/assistance/index.vue

@ -1,5 +1,5 @@
<template>
<div class='pages' ref="scroll">
<div class='pages' ref="scroll" style="scroll-behavior: smooth;">
<div class="scroll-box" ref="scroll-content">
<van-tabs :active="active" sticky @change="hadelChangeTab">
<van-tab title="待接单">
@ -79,15 +79,13 @@ import throttle from 'lodash/debounce'
import { getServiceListRcv, getServiceListProcess, getServiceListCompleted, getCommonalityDetail, getMeasureDetail, getListMyIdentities, receiveService, getServiceScopeTree, serviceConfirm, serviceComplete,getSearchResis } from '@/api/service'
import { uploadvariedfile } from '@/api/basic'
import { Dialog } from 'vant';
export default {
data() {
return {
active: 0,
clientHeight: false,
active: this.$store.state.app.tabActive,
scroll: null,
pageNo: 1,
pageSize: 10,
pageSize: 20,
list: [],
total: 0,
requestFlag: false,
@ -118,16 +116,23 @@ export default {
};
},
created() {
this.getTableData('tab')
this.getListMyIdentities()
this.getServiceListRcv()
this.getServiceScopeTree()
},
mounted() {
this.clientHeight = document.documentElement.clientHeight; //
this.$nextTick(() => {
this.scroll = this.$refs.scroll;
if(this.$store.state.app.scrollTop){
setTimeout(()=>{
this.$refs.scroll.scrollTo(0, this.$store.state.app.scrollTop);
},500)
}
this.scroll.addEventListener('scroll', this.bottomScroll); //
})
},
activated(){
},
methods: {
afterRead(file) {
@ -269,7 +274,6 @@ export default {
handelChangeRole(val) {
this.serviceOrgId = val;
},
//
handleCLickReceive(item) {
this.showRole = item.source === 4;
@ -326,11 +330,14 @@ export default {
this.list = [];
this.pageNo = 1;
this.active = e;
this.$store.dispatch('setTabActive',e);
this.getTableData('tab')
},
//
bottomScroll: throttle(function () {
console.log('滚动加载');
let scrollTop = this.scroll.scrollTop; //
this.$store.dispatch('setScrollTop',scrollTop);
let scrollHeight = this.scroll.scrollHeight; //
let clientHeight = this.scroll.clientHeight; //
if (scrollTop + clientHeight >= scrollHeight) {

Loading…
Cancel
Save