diff --git a/.env.development b/.env.development index cb5dd6e..3055417 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,5 @@ +VUE_APP_NODE_ENV=development VUE_APP_BASE_URL=https://test.tall.wiki VUE_APP_API_URL=https://test.tall.wiki/gateway +VUE_APP_MSG_URL=wss://test.tall.wiki/websocket/message/v4.0/ws +VUE_APP_PUBLIC_PATH=/pt-dev/ diff --git a/.env.production b/.env.production index e487f5a..90fde14 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,5 @@ +VUE_APP_NODE_ENV=production VUE_APP_BASE_URL=https://www.tall.wiki VUE_APP_API_URL=https://www.tall.wiki/gateway +VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws +VUE_APP_PUBLIC_PATH=/pt-dev/ diff --git a/.eslintrc.js b/.eslintrc.js index 6f481d2..2824b10 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -36,5 +36,6 @@ module.exports = { Vuex: true, axios: true, _: true, + uni: true, }, }; diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c2d9f..590fcd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ --|--|-- - | 标题栏变化 | [c0fcd9d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c0fcd9d) - | 标题栏角色栏全局任务组件新建 | [0500cb4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/0500cb4) + - | 插件数据获取 | [5b91bdc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/5b91bdc) - | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/94cd671) - | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/69e7931) - | 时间基准线,默认插件 | [a33ba1e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a33ba1e) diff --git a/src/apis/project.js b/src/apis/project.js index e69de29..86794ca 100644 --- a/src/apis/project.js +++ b/src/apis/project.js @@ -0,0 +1,9 @@ +const apiUrl = process.env.VUE_APP_API_URL; +const tall = `${apiUrl}/defaultwbs`; + +const install = (Vue, vm) => { + vm.$u.api = { ...vm.$u.api } || {}; + vm.$u.api.findProjectById = params => vm.$u.post(`${tall}/project/findProjectById`, params); +}; + +export default { install }; diff --git a/src/apis/task.js b/src/apis/task.js index e69de29..97126ef 100644 --- a/src/apis/task.js +++ b/src/apis/task.js @@ -0,0 +1,11 @@ +const apiUrl = process.env.VUE_APP_API_URL; +const tall = `${apiUrl}/defaultwbs/task`; + +const install = (Vue, vm) => { + vm.$u.api = { ...vm.$u.api } || {}; + vm.$u.api.getGlobal = param => vm.$u.post(`${tall}/global`, param); + vm.$u.api.getPermanent = param => vm.$u.post(`${tall}/permanent`, param); + vm.$u.api.getERegular = param => vm.$u.post(`${tall}/regular`, param); +}; + +export default { install }; diff --git a/src/components/Globals/Globals.vue b/src/components/Globals/Globals.vue index effb0b7..c5233b9 100644 --- a/src/components/Globals/Globals.vue +++ b/src/components/Globals/Globals.vue @@ -12,19 +12,15 @@ - - + + + @@ -41,13 +37,32 @@ export default { loading: true, pluginId: 0, styleType: 0, + task: null, + plugins: [], }; }, - + async created() { + const permanent = await this.$u.api.getPermanent({ roleId: 0 }); + const res = await this.$u.api.getGlobal({ + roleId: 0, + timeNode: new Date().getTime(), + timeUnit: 7, + }); + for (let item of res.plugins) { + this.plugins.push(...item); + } + this.task = res; + console.log('permanent', permanent); + }, mounted() { setTimeout(() => (this.loading = false), 5000); }, computed: mapState('home', ['isShrink']), + methods: { + getClass(col, row) { + return [`row-span-${row}`, `col-span-${col}`]; + }, + }, }; diff --git a/src/components/Plugin/Plugin.vue b/src/components/Plugin/Plugin.vue index 4323596..8be59a6 100644 --- a/src/components/Plugin/Plugin.vue +++ b/src/components/Plugin/Plugin.vue @@ -1,7 +1,7 @@ diff --git a/src/components/Roles/component/RoleList.vue b/src/components/Roles/component/RoleList.vue index 4b58dc5..2b9b27a 100644 --- a/src/components/Roles/component/RoleList.vue +++ b/src/components/Roles/component/RoleList.vue @@ -9,8 +9,6 @@ - - @@ -24,16 +22,76 @@ export default { tabList: [], //tab dom节点集合 scrollLeft: 0, //scrollview需要滚动的距离 roles: [ - { id: 1, name: '项目经理', mine: 0, pm: 1, sequence: 1 }, - { id: 2, name: '运维', mine: 0, pm: 0, sequence: 2 }, - { id: 3, name: '导师一', mine: 1, pm: 0, sequence: 3 }, - { id: 4, name: '导师二', mine: 1, pm: 0, sequence: 4 }, - { id: 5, name: '导师三', mine: 1, pm: 0, sequence: 5 }, - { id: 6, name: '导师四', mine: 1, pm: 0, sequence: 6 }, - { id: 7, name: '导师五', mine: 1, pm: 0, sequence: 7 }, - { id: 8, name: '导师六', mine: 1, pm: 0, sequence: 8 }, - { id: 9, name: '导师七', mine: 1, pm: 0, sequence: 9 }, - { id: 10, name: '导师八', mine: 1, pm: 0, sequence: 10 }, + { + id: 1, + name: '项目经理', + mine: 0, + pm: 1, + sequence: 1, + }, + { + id: 2, + name: '运维', + mine: 0, + pm: 0, + sequence: 2, + }, + { + id: 3, + name: '导师一', + mine: 1, + pm: 0, + sequence: 3, + }, + { + id: 4, + name: '导师二', + mine: 1, + pm: 0, + sequence: 4, + }, + { + id: 5, + name: '导师三', + mine: 1, + pm: 0, + sequence: 5, + }, + { + id: 6, + name: '导师四', + mine: 1, + pm: 0, + sequence: 6, + }, + { + id: 7, + name: '导师五', + mine: 1, + pm: 0, + sequence: 7, + }, + { + id: 8, + name: '导师六', + mine: 1, + pm: 0, + sequence: 8, + }, + { + id: 9, + name: '导师七', + mine: 1, + pm: 0, + sequence: 9, + }, + { + id: 10, + name: '导师八', + mine: 1, + pm: 0, + sequence: 10, + }, ], loading: true, // 是否显示骨架屏组件 }; @@ -51,7 +109,10 @@ export default { const data = document.getElementsByClassName('tab-children'); // TODO 第一步 获取当前所以子元素 并插入到 tabList 列表中 data.forEach(item => { - this.tabList.push({ width: item.clientWidth, left: item.offsetLeft }); + this.tabList.push({ + width: item.clientWidth, + left: item.offsetLeft, + }); }); }, @@ -120,6 +181,7 @@ export default { color: $roleChoiceColor; font-weight: 600; } + .default-tab-choice:before { content: ''; position: absolute; @@ -171,4 +233,8 @@ scroll-view ::v-deep ::-webkit-scrollbar { } /* #endif */ + +.skeleton { + height: 44rpx; +} diff --git a/src/components/Roles/components/RoleList.vue b/src/components/Roles/components/RoleList.vue deleted file mode 100644 index d0c3445..0000000 --- a/src/components/Roles/components/RoleList.vue +++ /dev/null @@ -1,183 +0,0 @@ - - - - - diff --git a/src/components/Skeleton/READ_ME.md b/src/components/Skeleton/READ_ME.md new file mode 100644 index 0000000..09ccf28 --- /dev/null +++ b/src/components/Skeleton/READ_ME.md @@ -0,0 +1,84 @@ +# skeleton组件 + +### 1.描述 +> 此组件用于加载数据时占位图显示,跟vant-ui骨架屏用法相似,但比vant-ui更灵活 + + + +### 2.用法 + +- 基本用法 + +代码: +```vue +//基本用法 + + + content + + +``` + + +- **显示 title ——通过 **title 属性显示title占位图 + +代码: +```vue +//显示 title——通过 title 属性显示title占位图 + + + content + + +``` + + +- 显示头像(上面)——通过avatar=‘top’让头像的占位图上面显示 + +代码: +```vue + + + content + + +``` + + +- 显示头像(左边)——通过avatar=‘left’让头像的占位图左边显示 + +代码: +```vue + + + content + + +``` + + +- 显示banner**——通过 **banner属性显示banner占位图(只显示banner,不显示内容占位图时设置row="0") + +代码: +```vue + + + content + + +``` +### +### 3. API +### Props +| **属性名** | **说明** | **类型** | **默认值** | 可取值 | +| --- | --- | --- | --- | --- | +| loading | 是否显示骨架屏 | Boolean | true | true/false | +| row | 段落行数 | Number | String | 3 | 0表示不展现 | +| rowWidth | 段落行宽度 | Boolean | Number | '100%' | | +| title | 是否显示标题 | Boolean | String | false | | +| banner | 是否显示banner | Boolean | String | false | | +| animate | 是否开启动画 | Boolean | String | false | | +| avatar | 头像位置 | Boolean | String | ''空 | left/top | +| avatarSize | 头像大小 | String | - | | +| avatarShape | 头像形状 | String | circle | circle/round | + diff --git a/src/components/Skeleton/Skeleton.vue b/src/components/Skeleton/Skeleton.vue new file mode 100644 index 0000000..c5e2d59 --- /dev/null +++ b/src/components/Skeleton/Skeleton.vue @@ -0,0 +1,186 @@ + + + + + diff --git a/src/components/Skeleton/view.vue b/src/components/Skeleton/view.vue new file mode 100644 index 0000000..4d27e62 --- /dev/null +++ b/src/components/Skeleton/view.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue index 46b1371..6466ad1 100644 --- a/src/components/TimeLine/component/TimeBox.vue +++ b/src/components/TimeLine/component/TimeBox.vue @@ -83,46 +83,33 @@ export default { TaskPanel: { height: '100' }, }, ], - }; - }, - - methods: { - addTopList() { - const item = [ + addList: [ { state: 0, plugins: [[{ pluginId: '111' }], [{ pluginId: '222' }]], + TaskPanel: { height: '100' }, }, { state: 0, plugins: [[{ pluginId: '111' }], [{ pluginId: '222' }]], + TaskPanel: { height: '100' }, }, { state: 0, plugins: [[{ pluginId: '111' }], [{ pluginId: '333' }]], + TaskPanel: { height: '100' }, }, - ]; - this.list = item.concat(this.list); - console.log('this.list: ', this.list); + ], + }; + }, + + methods: { + addTopList() { + this.list = this.addList.concat(this.list); }, addBottomList() { - const item = [ - { - state: 0, - plugins: [[{ pluginId: '111' }], [{ pluginId: '333' }]], - }, - { - state: 0, - plugins: [[{ pluginId: '111' }], [{ pluginId: '333' }]], - }, - { - state: 0, - plugins: [[{ pluginId: '111' }]], - }, - ]; - this.list = this.list.concat(item); - console.log('this.list: ', this.list); + this.list = this.list.concat(this.addList); }, }, }; diff --git a/src/config/app.js b/src/config/app.js new file mode 100644 index 0000000..6602ed5 --- /dev/null +++ b/src/config/app.js @@ -0,0 +1,7 @@ +const version = '3.0.0'; + +export default { + V: version, + version, + theme: [], +}; diff --git a/src/config/plugin.js b/src/config/plugin.js new file mode 100644 index 0000000..f89949e --- /dev/null +++ b/src/config/plugin.js @@ -0,0 +1,5 @@ +// 定义插件相关信息 +/* eslint-disable */ +export default { + defaults: [], // 默认插件id列表 +}; diff --git a/src/config/zIndex.js b/src/config/zIndex.js new file mode 100644 index 0000000..4d1dab2 --- /dev/null +++ b/src/config/zIndex.js @@ -0,0 +1,5 @@ +// 定义项目中定位的元素的层级 +/* eslint-disable */ +export default { + roleBar: 999, // 角色栏成绩 +}; diff --git a/src/main.js b/src/main.js index 6d8eacf..950b073 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,7 @@ import Vue from 'vue'; -import App from './App'; import uView from 'uview-ui'; +import Tall from '@/utils/tall'; +import App from './App'; import './common/styles/index.css'; import store from './store'; @@ -16,6 +17,7 @@ Vue.use(indexedDB); Vue.config.productionTip = false; Vue.use(uView); +Vue.use(Tall); App.mpType = 'app'; @@ -23,10 +25,16 @@ const app = new Vue({ ...App, store }); import request from '@/utils/request.js'; import user from '@/apis/user.js'; +import project from '@/apis/project.js'; +import task from '@/apis/task.js'; import plugin from '@/apis/plugin.js'; +window.vm = app; + Vue.use(request, app); Vue.use(user, app); +Vue.use(project, app); +Vue.use(task, app); Vue.use(plugin, app); app.$mount(); diff --git a/src/mock/mock.js b/src/mock/mock.js index 4629a82..1151840 100644 --- a/src/mock/mock.js +++ b/src/mock/mock.js @@ -148,11 +148,29 @@ export default [ plugins: [ [ { - col: 123, + col: 1, colspan: 123, param: 123, pluginId: 123456789, - row: 123, + row: 2, + rowspan: 123, + }, + { + col: 2, + colspan: 123, + param: 123, + pluginId: 123456789, + row: 1, + rowspan: 123, + }, + ], + [ + { + col: 1, + colspan: 123, + param: 123, + pluginId: 123456789, + row: 2, rowspan: 123, }, ], @@ -195,12 +213,82 @@ export default [ plugins: [ [ { - col: 123, - colspan: 123, + col: 1, + colspan: 0, param: 123, pluginId: 123456789, - row: 123, - rowspan: 123, + row: 2, + rowspan: 1, + }, + { + col: 2, + colspan: 0, + param: 123, + pluginId: 123456789, + row: 1, + rowspan: 1, + }, + ], + [ + { + col: 1, + colspan: 0, + param: 123, + pluginId: 123456789, + row: 2, + rowspan: 1, + }, + { + col: 1, + colspan: 0, + param: 123, + pluginId: 123456789, + row: 2, + rowspan: 1, + }, + ], + [ + { + col: 1, + colspan: 0, + param: 123, + pluginId: 123456789, + row: 1, + rowspan: 1, + }, + ], + [ + { + col: 1, + colspan: 0, + param: 123, + pluginId: 123456789, + row: 1, + rowspan: 1, + }, + { + col: 1, + colspan: 0, + param: 123, + pluginId: 123456789, + row: 2, + rowspan: 1, + }, + { + col: 1, + colspan: 0, + param: 123, + pluginId: 123456789, + row: 2, + rowspan: 1, + }, + { + col: 1, + colspan: 0, + param: 123, + pluginId: 123456789, + row: 1, + rowspan: 1, }, ], ], @@ -283,7 +371,7 @@ export default [ msg: 'ok', success: true, data: { - html: ``, + html: `
`, id: 13, intro: 'string', js: `function openModal() { diff --git a/src/pages.json b/src/pages.json index 86c68c7..32624f9 100644 --- a/src/pages.json +++ b/src/pages.json @@ -1,7 +1,7 @@ { "pages": [ { - "path": "pages/index/index", + "path": "pages/project/project", "style": { "navigationStyle": "custom" , "navigationBarTextStyle": "white" diff --git a/src/pages/index/index.vue b/src/pages/project/project.vue similarity index 64% rename from src/pages/index/index.vue rename to src/pages/project/project.vue index a0892b5..4bf2141 100644 --- a/src/pages/index/index.vue +++ b/src/pages/project/project.vue @@ -10,16 +10,19 @@ - - diff --git a/src/store/user/actions.js b/src/store/user/actions.js index 5dfa3d4..d4fb3a0 100644 --- a/src/store/user/actions.js +++ b/src/store/user/actions.js @@ -1,3 +1,20 @@ -const actions = {}; +const actions = { + /** + * 通过userId获取token + * @param {any} commit + * @param {string} userId 用户id + */ + async getUserId({ commit }, userId) { + try { + uni.$u.api.getToken(userId).then(res => { + commit('setToken', res.token); + commit('setUser', res); + return res; + }); + } catch (error) { + throw error || '获取个人信息失败'; + } + }, +}; export default actions; diff --git a/src/store/user/mutations.js b/src/store/user/mutations.js index ea2bcc2..7c6a563 100644 --- a/src/store/user/mutations.js +++ b/src/store/user/mutations.js @@ -1,3 +1,25 @@ -const mutations = {}; +const mutations = { + /** + * 设置存储token + * @param {object} state + * @param {string} token + */ + setToken(state, token) { + if (!token) return; + state.token = token; + uni.setStorageSync('anyringToken', token); + }, + + /** + * 设置user数据 + * @param {object} state + * @param {object} user + */ + setUser(state, user) { + if (!user) return; + state.user = { ...user }; + uni.setStorageSync('user', JSON.stringify(user)); + }, +}; export default mutations; diff --git a/src/store/user/state.js b/src/store/user/state.js index 4110b16..39f592e 100644 --- a/src/store/user/state.js +++ b/src/store/user/state.js @@ -1,3 +1,5 @@ -const state = {}; - +const state = { + token: '', + user: null, +}; export default state; diff --git a/src/utils/indexedDB.js b/src/utils/indexedDB.js index 17e245f..58329ed 100644 --- a/src/utils/indexedDB.js +++ b/src/utils/indexedDB.js @@ -178,7 +178,7 @@ const install = Vue => { }; // create - console.log(curriedCreate(Vue.prototype.$db.db)); + // console.log(curriedCreate(Vue.prototype.$db.db)); Vue.prototype.$db.create = curriedCreate(Vue.prototype.$db.db); }; diff --git a/src/utils/request.js b/src/utils/request.js index 6f3fa58..9a0680d 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -13,9 +13,9 @@ const install = (Vue, vm) => { Vue.prototype.$u.http.interceptor.request = config => { // TODO: 如果在白名单里 则不需要加token - // if (vm.$store.state.user.token) { - // config.header.Authorization = `Bearer ${vm.$store.state.user.token}`; - // } + if (vm.$store.state.user.token) { + config.header.Authorization = `Bearer ${vm.$store.state.user.token}`; + } return config; }; @@ -41,6 +41,15 @@ const install = (Vue, vm) => { return false; } }; + + Vue.prototype.$u.post = (url, param = {}, header = {}) => { + return Vue.prototype.$u.http.request({ + url, + method: 'POST', + header, + data: { param }, + }); + }; }; export default { install }; diff --git a/src/utils/tall.js b/src/utils/tall.js new file mode 100644 index 0000000..b7bd84e --- /dev/null +++ b/src/utils/tall.js @@ -0,0 +1,17 @@ +import app from '@/config/app.js'; +import zIndex from '@/config/zIndex.js'; +import plugin from '@/config/plugin.js'; + +const $t = { + zIndex, // 定位元素层级 + app, // app级别的相关配置 + plugin, // 插件相关配置信息 +}; + +uni.$t = $t; + +const install = Vue => { + Vue.prototype.$t = $t; +}; + +export default { install }; diff --git a/vue.config.js b/vue.config.js index fd081e3..854f18d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -6,6 +6,7 @@ module.exports = { productionSourceMap: false, devServer: { // open: true, + host: '127.0.0.1', overlay: { warnings: false, errors: true }, // proxy: {} },