diff --git a/.gitignore b/.gitignore index bc57802..ec90642 100644 --- a/.gitignore +++ b/.gitignore @@ -144,6 +144,4 @@ dist/ unpackage/ unpackage/* .history -.idea -.vscode -.hbuilderx +.DS_Store diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json new file mode 100644 index 0000000..582561b --- /dev/null +++ b/.hbuilderx/launch.json @@ -0,0 +1,16 @@ +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version": "0.0", + "configurations": [{ + "app-plus" : + { + "launchtype" : "local" + }, + "default" : + { + "launchtype" : "local" + }, + "type" : "uniCloud" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..83ad4ef --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cSpell.words": ["dcloudio", "easyinput", "FILESYSTEMS", "localdata", "NIHSS", "nvue", "splashscreen", "uview", "vueuse"] +} diff --git a/App.vue b/App.vue old mode 100755 new mode 100644 diff --git a/components/SettingPad/SettingPad.vue b/components/SettingPad/SettingPad.vue new file mode 100644 index 0000000..ba38aa1 --- /dev/null +++ b/components/SettingPad/SettingPad.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/config/local.ts b/config/local.ts index 9538d5c..86fc264 100644 --- a/config/local.ts +++ b/config/local.ts @@ -1,3 +1,5 @@ export const LOCAL_KEY = { LOADED: 'loaded', // 用来显示启动页 有本地数据不显示启动页 没有才显示 + DEVICE_NO: 'SS_DEVICE_NO', // 平板编号 + HOST: 'SS_ACCESS_HOST', // 域名 } diff --git a/index.html b/index.html old mode 100755 new mode 100644 diff --git a/main.js b/main.js old mode 100755 new mode 100644 diff --git a/manifest.json b/manifest.json old mode 100755 new mode 100644 diff --git a/package.json b/package.json old mode 100755 new mode 100644 diff --git a/pages.json b/pages.json old mode 100755 new mode 100644 diff --git a/pages/detail1/detail1.vue b/pages/detail1/detail1.vue index 65d91da..fb89e78 100644 --- a/pages/detail1/detail1.vue +++ b/pages/detail1/detail1.vue @@ -135,6 +135,9 @@ + + + @@ -150,6 +153,17 @@ function onClickLeft() { function onClickRight() { uni.$u.openPage('detail2') } + +function uploadImage() { + uni.chooseImage({ + count: 1, + sizeType: ['original'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: function (res) { + console.log(JSON.stringify(res.tempFilePaths)); + } + }); +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml old mode 100755 new mode 100644 diff --git a/store/modules/service.ts b/store/modules/service.ts index b3ffe09..7dcaa07 100644 --- a/store/modules/service.ts +++ b/store/modules/service.ts @@ -15,20 +15,49 @@ export interface IPatient { export interface ServiceState { currentPatient: null | IPatient + device: null | { deviceNo: string; host: string } } export const useServiceStore = defineStore({ id: 'service', state: (): ServiceState => ({ - currentPatient: null, + currentPatient: null, // 当前病友的信息 + device: null, // 当前设备的信息 }), - getters: {}, + getters: { + deviceNo: ({ device }) => device?.deviceNo || '', + host: ({ device }) => device?.host || '', + }, actions: { setCurrentPatient(patient: IPatient) { this.currentPatient = patient }, + + // 设置设备信息 + setDevice(device: null | { deviceNo: string; host: string }) { + this.device = device + if (device?.deviceNo) { + uni.setStorageSync(uni.$u.LOCAL_KEY.DEVICE_NO, device.deviceNo) + } + if (device?.host) { + uni.setStorageSync(uni.$u.LOCAL_KEY.HOST, device.host) + } + }, + + // sync local device info 2 store + // 应用启动的时候调用一次 loading页调用了 + syncDevice() { + const localDeviceNo = uni.getStorageSync(uni.$u.LOCAL_KEY.DEVICE_NO) + const localDeviceHost = uni.getStorageSync(uni.$u.LOCAL_KEY.HOST) + + if (localDeviceNo && localDeviceHost) { + this.device = { deviceNo: localDeviceNo, host: localDeviceHost } + } else { + this.device = null + } + }, }, }) diff --git a/tsconfig.json b/tsconfig.json old mode 100755 new mode 100644 diff --git a/uni-webview-js.js b/uni-webview-js.js old mode 100755 new mode 100644 diff --git a/uni.scss b/uni.scss old mode 100755 new mode 100644 diff --git a/utils/common.ts b/utils/common.ts index 25d1c6e..ff49259 100644 --- a/utils/common.ts +++ b/utils/common.ts @@ -1,5 +1,5 @@ /** - * 打开页面 + * 打开页面 timeout 1s执行 * @param {string} pageName 页面的名称 同文件名 文件夹名 * @param {boolean} isRedirect 是否是重定向 替换模式 * @param {string} query 查询参数 不带? 如 name=wally&age=17 @@ -7,8 +7,12 @@ export function openPage(pageName: string, isRedirect = false, query?: string) { const path = query ? `/pages/${pageName}/${pageName}?${query}` : `/pages/${pageName}/${pageName}` if (isRedirect) { - uni.redirectTo({ url: path }) + setTimeout(() => { + uni.redirectTo({ url: path }) + }, 1000) } else { - uni.navigateTo({ url: path }) + setTimeout(() => { + uni.navigateTo({ url: path }) + }, 1000) } }