diff --git a/hooks/usePageList.js b/hooks/usePageList.js new file mode 100644 index 0000000..5792d48 --- /dev/null +++ b/hooks/usePageList.js @@ -0,0 +1,33 @@ +import { computed, ref, watch } from "vue"; +import useDebounce from '@/utils/useDebounce' + +export default function usePageList(callback, options = {}) { + const keyword = ref('') + const list = ref([]) + const page = ref(1) + const pageSize = ref(options.pageSize || 20) + const pages = ref(0); + const loading = ref(false) + const total = ref(0) + + const hasMore = computed(() => page.value < pages.value) + + const handleKeywordChange = useDebounce(() => { + getList() + }, options.debounce || 1000) + + function changePage(p) { + if (loading.value) return + page.value = p + getList() + } + + function getList() { + typeof callback === 'function' && callback() + } + + watch(keyword, handleKeywordChange); + + return { total, page, pageSize, keyword, list, pages, changePage, loading, hasMore } + +} diff --git a/pages.json b/pages.json index 5782845..9605487 100644 --- a/pages.json +++ b/pages.json @@ -1,222 +1,236 @@ { - "pages": [ - { - "path": "pages/home/home", - "style": { - "navigationBarTitleText": "首页", - "navigationStyle": "custom", - "disableScroll": true - } - }, - { - "path": "pages/article/article-list", - "style": { - "navigationBarTitleText": "我的宣教", - "disableScroll": true - } - }, - { - "path": "pages/article/article-cate-list", - "style": { - "navigationBarTitleText": "健康宣教", - "disableScroll": true - } - }, - { - "path": "pages/survey/survey-list", - "style": { - "navigationBarTitleText": "我的问卷", - "disableScroll": true - } - }, - { - "path": "pages/survey/fill", - "style": { - "navigationBarTitleText": "问卷", - "disableScroll": true - } - }, - { - "path": "pages/message/message", - "style": { - "navigationBarTitleText": "消息", - "disableScroll": true - } - }, - { - "path": "pages/message/index", - "style": { - "navigationBarTitleText": "聊天", - "enablePullDownRefresh": false, - "disableScroll": true - } - }, - { - "path": "pages/login/login", - "style": { - "navigationBarTitleText": "健康柚", - "navigationStyle": "custom", - "disableScroll": true - } - }, - { - "path": "pages/login/redirect-page", - "style": { - "navigationBarTitleText": "健康柚", - "disableScroll": true - } - }, - { - "path": "pages/login/agreement", - "style": { - "navigationBarTitleText": "健康柚", - "disableScroll": true - } - }, - { - "path": "pages/archive/archive-manage", - "style": { - "navigationBarTitleText": "档案管理", - "disableScroll": true - } - }, - { - "path": "pages/archive/edit-archive", - "style": { - "navigationBarTitleText": "新增档案", - "disableScroll": true - } - }, - { - "path": "pages/archive/archive-result", - "style": { - "navigationBarTitleText": "团队服务", - "disableScroll": true - } - }, - { - "path": "pages/health/list", - "style": { - "navigationBarTitleText": "健康信息", - "disableScroll": true - } - }, - { - "path": "pages/health/record", - "style": { - "navigationBarTitleText": "健康信息", - "disableScroll": true - } - }, - { - "path": "pages/library/diagnosis-list", - "style": { - "navigationBarTitleText": "选择诊断", - "disableScroll": true - } - }, - { - "path": "pages/team/team-detail", - "style": { - "navigationBarTitleText": "团队介绍", - "disableScroll": true - } - }, - { - "path": "pages/team/homepage", - "style": { - "navigationBarTitleText": "个人主页", - "disableScroll": true - } - }, - { - "path": "pages/team/friend", - "style": { - "navigationBarTitleText": "添加好友", - "disableScroll": true - } - }, - { - "path": "pages/web-view/web-view", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - }, - { - "path": "pages/mine/mine", - "style": { - "navigationBarTitleText": "我的", - "disableScroll": true - } - }, - { - "path": "pages/mine/contact", - "style": { - "navigationBarTitleText": "联系客服", - "disableScroll": true - } - }, - { - "path": "pages/common/privacy", - "style": { - "navigationBarTitleText": "隐私政策", - "disableScroll": true - } - }, - { - "path": "pages/common/agreement", - "style": { - "navigationBarTitleText": "用户协议", - "disableScroll": true - } - }, - { - "path": "pages/article/article-detail", - "style": { - "navigationBarTitleText": "宣教文章", - "disableScroll": true - } - }, - { - "path": "pages/article/send-article", - "style": { - "navigationBarTitleText": "选择宣教文章", - "disableScroll": true - } - } - ], - "globalStyle": { - "navigationBarTextStyle": "white", - "navigationBarTitleText": "uni-app", - "navigationBarBackgroundColor": "#065bd6", - "backgroundColor": "#065bd6" - }, - "tabBar": { - "color": "#666666", - "selectedColor": "#007aff", - "backgroundColor": "#ffffff", - "borderStyle": "white", - "list": [ - { - "pagePath": "pages/home/home", - "iconPath": "static/tabbar/home.png", - "selectedIconPath": "static/tabbar/home_selected.png", - "text": "服务" - }, - { - "pagePath": "pages/message/message", - "iconPath": "static/tabbar/consult.png", - "selectedIconPath": "static/tabbar/consult_selected.png", - "text": "咨询" - }, - { - "pagePath": "pages/mine/mine", - "iconPath": "static/tabbar/mine.png", - "selectedIconPath": "static/tabbar/mine_selected.png", - "text": "我的" - } - ] - }, - "uniIdRouter": {} -} \ No newline at end of file + "pages": [ + { + "path": "pages/home/home", + "style": { + "navigationBarTitleText": "首页", + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/article/article-list", + "style": { + "navigationBarTitleText": "我的宣教", + "disableScroll": true + } + }, + { + "path": "pages/article/article-cate-list", + "style": { + "navigationBarTitleText": "健康宣教", + "disableScroll": true + } + }, + { + "path": "pages/survey/survey-list", + "style": { + "navigationBarTitleText": "我的问卷", + "disableScroll": true + } + }, + { + "path": "pages/survey/fill", + "style": { + "navigationBarTitleText": "问卷", + "disableScroll": true + } + }, + { + "path": "pages/rate/rate-list", + "style": { + "navigationBarTitleText": "服务评价", + "disableScroll": true + } + }, + { + "path": "pages/rate/rate-detail", + "style": { + "navigationBarTitleText": "服务评价", + "disableScroll": true + } + }, + { + "path": "pages/message/message", + "style": { + "navigationBarTitleText": "消息", + "disableScroll": true + } + }, + { + "path": "pages/message/index", + "style": { + "navigationBarTitleText": "聊天", + "enablePullDownRefresh": false, + "disableScroll": true + } + }, + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "健康柚", + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/login/redirect-page", + "style": { + "navigationBarTitleText": "健康柚", + "disableScroll": true + } + }, + { + "path": "pages/login/agreement", + "style": { + "navigationBarTitleText": "健康柚", + "disableScroll": true + } + }, + { + "path": "pages/archive/archive-manage", + "style": { + "navigationBarTitleText": "档案管理", + "disableScroll": true + } + }, + { + "path": "pages/archive/edit-archive", + "style": { + "navigationBarTitleText": "新增档案", + "disableScroll": true + } + }, + { + "path": "pages/archive/archive-result", + "style": { + "navigationBarTitleText": "团队服务", + "disableScroll": true + } + }, + { + "path": "pages/health/list", + "style": { + "navigationBarTitleText": "健康信息", + "disableScroll": true + } + }, + { + "path": "pages/health/record", + "style": { + "navigationBarTitleText": "健康信息", + "disableScroll": true + } + }, + { + "path": "pages/library/diagnosis-list", + "style": { + "navigationBarTitleText": "选择诊断", + "disableScroll": true + } + }, + { + "path": "pages/team/team-detail", + "style": { + "navigationBarTitleText": "团队介绍", + "disableScroll": true + } + }, + { + "path": "pages/team/homepage", + "style": { + "navigationBarTitleText": "个人主页", + "disableScroll": true + } + }, + { + "path": "pages/team/friend", + "style": { + "navigationBarTitleText": "添加好友", + "disableScroll": true + } + }, + { + "path": "pages/web-view/web-view", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + }, + { + "path": "pages/mine/mine", + "style": { + "navigationBarTitleText": "我的", + "disableScroll": true + } + }, + { + "path": "pages/mine/contact", + "style": { + "navigationBarTitleText": "联系客服", + "disableScroll": true + } + }, + { + "path": "pages/common/privacy", + "style": { + "navigationBarTitleText": "隐私政策", + "disableScroll": true + } + }, + { + "path": "pages/common/agreement", + "style": { + "navigationBarTitleText": "用户协议", + "disableScroll": true + } + }, + { + "path": "pages/article/article-detail", + "style": { + "navigationBarTitleText": "宣教文章", + "disableScroll": true + } + }, + { + "path": "pages/article/send-article", + "style": { + "navigationBarTitleText": "选择宣教文章", + "disableScroll": true + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "white", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#065bd6", + "backgroundColor": "#065bd6" + }, + "tabBar": { + "color": "#666666", + "selectedColor": "#007aff", + "backgroundColor": "#ffffff", + "borderStyle": "white", + "list": [ + { + "pagePath": "pages/home/home", + "iconPath": "static/tabbar/home.png", + "selectedIconPath": "static/tabbar/home_selected.png", + "text": "服务" + }, + { + "pagePath": "pages/message/message", + "iconPath": "static/tabbar/consult.png", + "selectedIconPath": "static/tabbar/consult_selected.png", + "text": "咨询" + }, + { + "pagePath": "pages/mine/mine", + "iconPath": "static/tabbar/mine.png", + "selectedIconPath": "static/tabbar/mine_selected.png", + "text": "我的" + } + ] + }, + "uniIdRouter": {} +} diff --git a/pages/home/consult.vue b/pages/home/consult.vue index 3f897ec..d9c875c 100644 --- a/pages/home/consult.vue +++ b/pages/home/consult.vue @@ -70,7 +70,7 @@ const consultItems = ref([ id: "rating", label: "服务评价", icon: "/static/home/service-rating.png", - path: "", + path: "/pages/rate/rate-list", }, ]); diff --git a/pages/rate/rate-detail.vue b/pages/rate/rate-detail.vue new file mode 100644 index 0000000..5e4da99 --- /dev/null +++ b/pages/rate/rate-detail.vue @@ -0,0 +1,251 @@ +