diff --git a/.editorconfig b/.editorconfig index 56d2b72..01f18b8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,4 +6,3 @@ indent_size = 2 end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true -max_line_length = 140 diff --git a/CHANGELOG.md b/CHANGELOG.md index 856cfe6..a428bff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - | 使用uview完成api请求 | [1b3efd8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b3efd8) - | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91) - | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6) + - | 时间轴页面 | [e926b75](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e926b75) - | 更新代码 | [392c8cc](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/392c8cc) - | 项目列表 | [a52e6d5](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a52e6d5) - | 项目操作面板 | [3beb05e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3beb05e) diff --git a/components/Title/Title.vue b/components/Title/Title.vue index fb9a3f0..cfd4896 100644 --- a/components/Title/Title.vue +++ b/components/Title/Title.vue @@ -12,7 +12,12 @@ - + @@ -92,10 +97,10 @@ function onBack() { const pages = getCurrentPages(); // 获取页面栈数组 console.log('历史pages: ', pages.length); if (pages.length > 1) { - uni.webView.navigateBack(); + uni.navigateBack(); } else { // this.$u.route('/', { u: this.userId }); - uni.webView.reLaunch({ url: `/pages/index/index?u=${userId.value}` }); + uni.reLaunch({ url: `/pages/index/index?u=${userId.value}` }); } } diff --git a/hooks/project/useInit.js b/hooks/project/useInit.js new file mode 100644 index 0000000..9c4c2fa --- /dev/null +++ b/hooks/project/useInit.js @@ -0,0 +1,50 @@ +import { computed } from 'vue'; +import { onLoad } from '@dcloudio/uni-app'; +import useGetUserIdFromLocal from '@/hooks/user/useGetUserIdFromLocal'; +import { useStore } from 'vuex'; + +export default function useInit() { + const store = useStore(); + const token = computed(() => store.state.user.token); + const userId = useGetUserIdFromLocal(); + console.log('userId: ', userId); + + onLoad(options => { + console.log('onLoad options: ', options); + init(options); + }); + + /** + * 初始化 + * @param {object | null} options + */ + function init(options) { + if (!token.value) { + // 不论有没有token都直接从userId获取token + // token有过期时间 从本地获取可能是过期 干脆直接从userId获取 + if (!options || !options.u) { + uni.$ui.showToast('缺少用户信息参数'); // 参数里没有u (userId)提示 + } else { + store.dispatch('user/getToken', options.u); + } + } + + // 参数里有项目名称 就设置标题里的项目名称 + options && options.pname && store.commit('project/setProjectName', options.pname); + + if (!options || !options.p) { + uni.$ui.showToast('缺少项目信息参数'); // 没有项目id参数 + } else { + if (options.p !== uni.$storage.getStorageSync('projectId')) { + console.log('切项目了'); + uni.$storage.setStorageSync('roleId', ''); + } + // TODO + getProjectById({ projectId: options.p, num: 0 }); // 根据项目id获取项目信息 + // 查询医院是否填写了调查问卷 + // this.handleQueryNotWrite(options.p); + // 根据项目id获取成员列表 + store.dispatch('role/getAllMembers', { projectId: options.p }); + } + } +} diff --git a/hooks/useGetOptions.js b/hooks/useGetOptions.js deleted file mode 100644 index e29a528..0000000 --- a/hooks/useGetOptions.js +++ /dev/null @@ -1,8 +0,0 @@ -import qs from 'qs'; - -export default function useGetOptions(){ - const options = getCurrentPages(); - const param = options[0].$page.fullPath.split('?')[1]; - const prefixed = qs.parse(param, { ignoreQueryPrefix: true }); - return prefixed -} \ No newline at end of file diff --git a/hooks/user/useGetUserIdFromLocal.js b/hooks/user/useGetUserIdFromLocal.js new file mode 100644 index 0000000..c1bfcd6 --- /dev/null +++ b/hooks/user/useGetUserIdFromLocal.js @@ -0,0 +1,9 @@ +export default function useGetUserIdFromLocal() { + try { + const userLocal = uni.$storage.getStorageSync('user'); + const user = JSON.parse(userLocal); + return user.id; + } catch (error) { + return null; + } +} diff --git a/pages/project/project copy.vue b/pages/project/project copy.vue new file mode 100644 index 0000000..fa4e413 --- /dev/null +++ b/pages/project/project copy.vue @@ -0,0 +1,434 @@ +