From 161bd283edee72517b79d926f94ec1dd03dbedca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=B1=7E=E6=B5=B7=7E=E7=88=B1=E6=B5=B7=E7=88=B1?= =?UTF-8?q?=E6=B5=B7=7E=E5=8F=B3?= <1828712314@qq.com> Date: Fri, 24 Jan 2025 16:57:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BC=81=E4=B8=9A=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/system/dict.js | 10 + components/cs-page/index.vue | 80 ++++---- main.js | 3 +- pages.json | 4 + pages/login.vue | 23 ++- pages/owner.vue | 211 +++++++++++--------- static/scss/index.scss | 12 +- store/getters.js | 14 +- store/modules/user.js | 24 ++- sub/owner/edit.vue | 169 +++++++++++----- uni_modules/s-components/s-header/index.vue | 11 +- utils/constant.js | 14 +- utils/dict.js | 33 ++- utils/request.js | 6 +- utils/storage.js | 42 ++-- utils/upload.js | 6 +- 16 files changed, 417 insertions(+), 245 deletions(-) diff --git a/api/system/dict.js b/api/system/dict.js index 17abb24..ae64b49 100644 --- a/api/system/dict.js +++ b/api/system/dict.js @@ -9,4 +9,14 @@ export function getDictBatchByType(params) { method: 'GET', params }) +} + +/** + * 获取部门树 + */ +export function getDeptTree() { + return request({ + url: `/system/dept/list-all-simple`, + method: 'GET' + }) } \ No newline at end of file diff --git a/components/cs-page/index.vue b/components/cs-page/index.vue index 046f18c..2057a80 100644 --- a/components/cs-page/index.vue +++ b/components/cs-page/index.vue @@ -1,52 +1,52 @@ diff --git a/main.js b/main.js index 5adc14d..7bc492e 100644 --- a/main.js +++ b/main.js @@ -6,7 +6,8 @@ import './permission' // permission import * as dict from '@/utils/dict.js' // 引入uView import uView from '@/uni_modules/uview-ui' - +// import mpShare from '@/uni_modules/uview-ui/libs/mixin/mpShare.js' +// Vue.mixin(mpShare) // 挂载全局对象 Vue.use(plugins).use(uView) diff --git a/pages.json b/pages.json index 9156225..a48608b 100644 --- a/pages.json +++ b/pages.json @@ -47,6 +47,10 @@ "root": "sub", "pages": [{ "path": "owner/edit" + }, { + "path": "owner/invite" + }, { + "path": "enterprise/edit" }] }], "tabBar": { diff --git a/pages/login.vue b/pages/login.vue index 84c765e..44072c8 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -16,9 +16,12 @@ export default { name: 'Login', data() { - return {} + return { + invateId: '' + } }, - onLoad() { + onLoad(res) { + this.invateId = res.invateId this.init() }, methods: { @@ -42,15 +45,21 @@ export default { this.$store.dispatch('GetInfo').then(res => { const { data } = res const { user } = data - if (user.mobile) { + if (this.invateId) { + uni.navigateTo({ + url: `/sub/enterprise/edit?invateId=${this.invateId}` + }) + return + } + if (user.audit) { uni.switchTab({ url: '/pages/index' }) - } else { - uni.navigateTo({ - url: '/sub/owner/edit' - }) + return } + uni.navigateTo({ + url: '/sub/owner/edit' + }) }) } } diff --git a/pages/owner.vue b/pages/owner.vue index 088afb4..687e272 100644 --- a/pages/owner.vue +++ b/pages/owner.vue @@ -1,106 +1,133 @@ diff --git a/static/scss/index.scss b/static/scss/index.scss index 745cffa..0063035 100644 --- a/static/scss/index.scss +++ b/static/scss/index.scss @@ -1,6 +1,12 @@ // global -@import "./global.scss"; +@import './global.scss'; // color-ui -@import "@/static/scss/colorui.css"; +@import '@/static/scss/colorui.css'; // iconfont -@import "@/static/font/iconfont.css"; \ No newline at end of file +@import '@/static/font/iconfont.css'; + +.icon-box { + padding: 5px; + border-radius: 50%; + box-shadow: 0 0 4px 2px $cs-shadow-color; +} diff --git a/store/getters.js b/store/getters.js index 8854794..c544776 100644 --- a/store/getters.js +++ b/store/getters.js @@ -1,8 +1,10 @@ const getters = { - token: state => state.user.token, - avatar: state => state.user.avatar, - name: state => state.user.name, - roles: state => state.user.roles, - permissions: state => state.user.permissions + token: state => state.user.token, + avatar: state => state.user.avatar, + name: state => state.user.name, + roles: state => state.user.roles, + permissions: state => state.user.permissions, + userId: state => state.user.id, + phone: state => state.user.phone } -export default getters +export default getters \ No newline at end of file diff --git a/store/modules/user.js b/store/modules/user.js index ffaab75..53f9e8a 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -15,16 +15,25 @@ const baseUrl = config.baseUrl const user = { state: { - id: 0, // 用户编号 + id: storage.get(constant.userId), name: storage.get(constant.name), avatar: storage.get(constant.avatar), + phone: storage.get(constant.phone), roles: storage.get(constant.roles), permissions: storage.get(constant.permissions) }, - mutations: { SET_ID: (state, id) => { state.id = id + storage.set(constant.userId, id) + }, + SET_NAME: (state, name) => { + state.name = name + storage.set(constant.name, name) + }, + SET_PHONE: (state, phone) => { + state.phone = phone + storage.set(constant.phone, phone) }, SET_AVATAR: (state, avatar) => { state.avatar = avatar @@ -39,7 +48,6 @@ const user = { storage.set(constant.permissions, permissions) } }, - actions: { // 登录 Login({ @@ -67,16 +75,16 @@ const user = { return new Promise((resolve, reject) => { getInfo().then(res => { const user = res.data.user - const avatar = (user == null || user.avatar === "" || user.avatar == null) ? require( - "@/static/images/avatar.jpg") : user.avatar if (res.roles && res.roles.length > 0) { commit('SET_ROLES', res.roles) commit('SET_PERMISSIONS', res.permissions) } else { commit('SET_ROLES', ['ROLE_DEFAULT']) } - commit('SET_ID', res.data.user.id) - commit('SET_AVATAR', avatar) + commit('SET_ID', user.id) + commit('SET_AVATAR', user.avatar) + commit('SET_NAME', user.name) + commit('SET_PHONE', user.mobile) resolve(res) }).catch(error => { reject(error) @@ -104,4 +112,6 @@ const user = { } } + + export default user \ No newline at end of file diff --git a/sub/owner/edit.vue b/sub/owner/edit.vue index 541a1f8..4682f7e 100644 --- a/sub/owner/edit.vue +++ b/sub/owner/edit.vue @@ -1,8 +1,10 @@