diff --git a/collect_information/src/app.ts b/collect_information/src/app.ts index e359902..9d36c01 100644 --- a/collect_information/src/app.ts +++ b/collect_information/src/app.ts @@ -3,24 +3,34 @@ import {createPinia} from 'pinia' import {useCounterStore} from '@/store' import './app.scss' import './assets/scss/colorui.scss' -import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' +// import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' import Taro from "@tarojs/taro"; + const pinia = createPinia() -pinia.use(piniaPluginPersistedstate) +// pinia.use(piniaPluginPersistedstate) const App = createApp({ onShow(options) { - const store = useCounterStore() - const token = Taro.getStorageSync('token') - if(token){ - Taro.switchTab({ - url:'/pages/mine/mine' - }) - store.setSelected(2) - }else{ - console.log(2222) + try { + const store = useCounterStore() + const token = Taro.getStorageSync('token') + console.log(token) + if (token) { + Taro.switchTab({ + // url:'/pages/mine/mine' + url: '/pages/projectManager/index/index' + + }) + // store.setSelected(2) + } else { + console.log(2222) + } + console.log('App onShow.') + } catch (err) { + console.log(err) + } - console.log('App onShow.') + }, // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 }) diff --git a/collect_information/src/subPages/pages/myProject/myProject.vue b/collect_information/src/subPages/pages/myProject/myProject.vue index 6741d9b..4f68051 100644 --- a/collect_information/src/subPages/pages/myProject/myProject.vue +++ b/collect_information/src/subPages/pages/myProject/myProject.vue @@ -2,15 +2,17 @@ - {{item?.name}} + {{ item?.name }} 地址: - {{item?.provinceName}}{{item.cityName}}{{item.districtsName}}{{item.streetName}} + {{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }} + + + + {{ items.name }} + - - {{items.name}} - @@ -27,9 +29,11 @@ const getMyServiceProject = async () => { myProjectList.value = resp.data } -const projectClick = (items:ServiceProjectList,name:string)=>{ +const projectClick = (items: ServiceProjectList, name: string) => { + console.log(name, JSON.stringify(items)) Taro.navigateTo({ - url:`/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`, + + url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`, }) } onMounted(async () => { diff --git a/collect_information/src/subPages/pages/projectDetails/projectDetails.scss b/collect_information/src/subPages/pages/projectDetails/projectDetails.scss index c8e7651..277cd71 100644 --- a/collect_information/src/subPages/pages/projectDetails/projectDetails.scss +++ b/collect_information/src/subPages/pages/projectDetails/projectDetails.scss @@ -19,7 +19,7 @@ } } .projectDetailsTableDrop{ - height: 800px; + height: 500px; .projectDetailsTable{ margin: 20px; border-radius: 10px; diff --git a/collect_information/src/subPages/pages/projectDetails/projectDetails.vue b/collect_information/src/subPages/pages/projectDetails/projectDetails.vue index cfda983..58cc5d1 100644 --- a/collect_information/src/subPages/pages/projectDetails/projectDetails.vue +++ b/collect_information/src/subPages/pages/projectDetails/projectDetails.vue @@ -34,22 +34,29 @@ - - 项目人员 - - - 姓名:{{ item?.name }} - 性别:{{ item.sex.label }} - 职位:{{ item.workPost }} - 保安证件:{{ item.securityNumber }} + 项目人员 + + + + + 姓名:{{ item?.name }} + 性别:{{ item.sex.label }} + 职位:{{ item.workPost }} + 保安证件:{{ item.securityNumber }} 地址:{{ item.homeAddress }} 出生年月:{{ item.dateOfBirth }} 创建时间:{{ item.createTime }} 身份证:{{ item.idCard }} + - - + + + + @@ -73,24 +80,60 @@ useLoad(async (options: MyProjectList) => { await projectDetailsTable() }) const projectDetailsTable = async () => { + // if (total.value === projectData.value.length) return + Taro.showLoading({ + title: '加载中', + }) const queryParams = { params: { serviceProjectId: detailsList.value?.snowFlakeId, }, page: { - size: 6, - current: 1 + size: 2, + current: current.value } } const resp = await api.post('/miniProgramUser/securityUserPager', queryParams) - projectData.value = resp?.data.records - + projectData.value = [...projectData.value, ...resp?.data.records] + total.value = resp?.data.total + isRefresher.value = false + Taro.hideLoading() } const formAdd = () => { Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(detailsList.value)}`}) } +const total = ref(null) +const current = ref(1) +const isRefresher = ref(false) +const scrollTop = ref(0) +const toView = ref('demo2') +const upper = (e) => { + console.log('到顶了:', e) +} +// 滚动到底部/右边时触发 +const lower = (e) => { + if (total.value === projectData.value.length) return + if (total.value > projectData.value.length) { + console.log('触底了:', e) + current.value = current.value + 1 + projectDetailsTable() + } +} +// 自定义下拉刷新被触发 +const onRefresherRefresh = (e) => { + projectData.value = [] + total.value = null + current.value = 1 //重置 + isRefresher.value = true + console.log('自定义下拉刷新被触发:', e) + projectDetailsTable() +} +const scroll = (e) => { + // console.log('scroll:', e) +} +