From 61f96dc77fb11a64695f19b3e212c0ba8cf6eab2 Mon Sep 17 00:00:00 2001 From: wally <18603454788@163.com> Date: Sun, 21 May 2023 10:15:54 +0800 Subject: [PATCH] feat: api --- .vscode/settings.json | 14 ++++++++- App.vue | 9 ++++++ api/base.ts | 37 ++++++++++++++++++++++ api/modules/user.ts | 7 ++--- manifest.json | 42 +++++++++++++++++++++++-- pages/loading/loading.vue | 1 + pages/patient-list/patient-list.vue | 45 +++++++++++++++++++++++--- store/modules/service.ts | 2 -- store/modules/user.ts | 49 +++++++---------------------- utils/http.ts | 2 +- 10 files changed, 155 insertions(+), 53 deletions(-) create mode 100644 api/base.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 83ad4ef..658b8c0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,15 @@ { - "cSpell.words": ["dcloudio", "easyinput", "FILESYSTEMS", "localdata", "NIHSS", "nvue", "splashscreen", "uview", "vueuse"] + "cSpell.words": [ + "dcloudio", + "easyinput", + "FILESYSTEMS", + "localdata", + "NIHSS", + "nvue", + "plusempty", + "splashscreen", + "uniui", + "uview", + "vueuse" + ] } diff --git a/App.vue b/App.vue index a4907ec..32da96c 100644 --- a/App.vue +++ b/App.vue @@ -1,14 +1,23 @@ diff --git a/api/base.ts b/api/base.ts new file mode 100644 index 0000000..c8d4b85 --- /dev/null +++ b/api/base.ts @@ -0,0 +1,37 @@ +const baseUrl = '' + +export interface IParam { + pageNum?: number + pageSize?: number + sort?: string + param: object +} + +export const post = (path: string, params: IParam) => { + let url = baseUrl + path + console.log('post: ', url) + + // #ifdef APP-PLUS + if (!uni.host) { + const host = uni.getStorageSync(uni.$u.LOCAL_KEY.HOST) + if (!host) { + uni.showModal({ + title: '提示', + content: '请先配置服务地址', + showCancel: true, + success: ({ confirm }) => { + if (confirm) { + // 跳转到配置地址的地方 + } + }, + }) + return + } + uni.host = host + } + url = `${uni.host}${baseUrl}` + // #endif + console.log(params) + + return uni.$u.post(url, params) +} diff --git a/api/modules/user.ts b/api/modules/user.ts index 006637c..f4c2dcb 100644 --- a/api/modules/user.ts +++ b/api/modules/user.ts @@ -1,7 +1,6 @@ +import { post } from '@/api/base' + export const userApi = { // 登录 - login: async query => { - console.log(query) - return null - }, + login: async (padNo: string) => post('/pad/login', { param: { padNo } }), } diff --git a/manifest.json b/manifest.json index 88616fb..e89fd1f 100644 --- a/manifest.json +++ b/manifest.json @@ -36,8 +36,44 @@ "" ] }, - "ios" : {}, - "sdkConfigs" : {} + "ios" : { + "dSYMs" : false + }, + "sdkConfigs" : { + "ad" : {} + }, + "icons" : { + "android" : { + "hdpi" : "unpackage/res/icons/72x72.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" + }, + "ios" : { + "appstore" : "unpackage/res/icons/1024x1024.png", + "ipad" : { + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "iphone" : { + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + } + } + } } }, "vueVersion" : "3", @@ -46,7 +82,7 @@ "open" : false, "proxy" : { "/service" : { - "target" : "http://110.178.211.221:38818/cyjg-webapp", + "target" : "http://test.tall.wiki:9002", "changeOrigin" : true, "pathRewrite" : { "^/service" : "" diff --git a/pages/loading/loading.vue b/pages/loading/loading.vue index 7a11fd8..ed614de 100644 --- a/pages/loading/loading.vue +++ b/pages/loading/loading.vue @@ -23,6 +23,7 @@ import { ref } from 'vue'; import { useServiceStore } from '@/store/modules/service'; const service = useServiceStore() + const leftTime = ref(6) const popupRef = ref() let timer: number | undefined diff --git a/pages/patient-list/patient-list.vue b/pages/patient-list/patient-list.vue index a4d8b7c..3ded128 100644 --- a/pages/patient-list/patient-list.vue +++ b/pages/patient-list/patient-list.vue @@ -4,8 +4,15 @@ - - + + + + 创建患者 + + + + + {{ item.name }} @@ -25,7 +32,7 @@ - + @@ -50,18 +57,37 @@ const data: IPatient[] = [ function onClickItem(event) { const item = data[event.detail.index] serviceStore.setCurrentPatient(item) - uni.$u.openPage('detail1') + uni.$u.openPage('detail2') }