From 2311b03aee9db1bebacdd2ced13c071efda6a011 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 27 Oct 2023 11:30:41 +0800
Subject: [PATCH] 角色切换
---
vue.config.js | 34 ++++++----------
utils/func.js | 69 ++--------------------------------
api/user.js | 2
common/setting.js | 4 +-
store/index.js | 2
subPackage/user/views/roleSelect.vue | 4 ++
6 files changed, 26 insertions(+), 89 deletions(-)
diff --git a/api/user.js b/api/user.js
index 11beb9b..4760b63 100644
--- a/api/user.js
+++ b/api/user.js
@@ -3,7 +3,7 @@
// 获取token
const token = (tenantId, username, password, type) => {
return http.request({
- url: '/api/blade-auth/oauth/token',
+ url: '/blade-auth/oauth/token',
method: 'POST',
header: {
'Tenant-Id': tenantId
diff --git a/common/setting.js b/common/setting.js
index eb5c603..c428539 100644
--- a/common/setting.js
+++ b/common/setting.js
@@ -9,8 +9,8 @@
// 版本号
version: '2.0.0',
// 开发环境接口Url
- devUrl: 'https://sk.hubeishuiyi.cn',
- // devUrl: 'http://172.16.13.129:8080',
+ // devUrl: 'https://sk.hubeishuiyi.cn',
+ devUrl: 'http://172.16.13.129:9528',
// 数据中台接口url
// dataCenterUrl: 'http://10.10.2.192/services',
dataCenterUrl: 'https://sk.hubeishuiyi.cn/services',
diff --git a/store/index.js b/store/index.js
index 1c66228..59a5e73 100644
--- a/store/index.js
+++ b/store/index.js
@@ -51,7 +51,7 @@
tabBarList: [],
adCodeBase: {},
tabbarIndex: uni.getStorageSync("tabbarIndex") || 0,
- hasUpdate: false //true为不可登录,需要更新,false则是最新版
+ hasUpdate: false, //true为不可登录,需要更新,false则是最新版
},
mutations: {
diff --git a/subPackage/user/views/roleSelect.vue b/subPackage/user/views/roleSelect.vue
index 72b7a0a..6a35f75 100644
--- a/subPackage/user/views/roleSelect.vue
+++ b/subPackage/user/views/roleSelect.vue
@@ -14,6 +14,7 @@
</view>
</view>
+
</view>
<view class="submit-btn">
@@ -101,8 +102,11 @@
.container {
background-color: #fafafa;
height: 100%;
+ display: flex;
+ flex-direction: column;
.main {
+
.cell {
background-color: #ffffff;
margin: 20rpx 0;
diff --git a/utils/func.js b/utils/func.js
index efef0f5..ed8ea3c 100644
--- a/utils/func.js
+++ b/utils/func.js
@@ -17,76 +17,17 @@
// 登录操作 1
const login = (userInfo) => {
+
vm.$u.vuex('userInfo', userInfo)
vm.$u.vuex('accessToken', userInfo.access_token)
- vm.$u.vuex('refreshToken', userInfo.refresh_token)
vm.$u.vuex('isLogin', true)
- vm.$u.vuex('adCodeBase', userInfo.detail.adCodeBase)
- let role = userInfo.role_id.split(",")
- dynamicMenu(userInfo.role_id, 'app').then(res => {
- if (res.code == 200) {
- let adCodeBase = userInfo.detail.adCodeBase
- if (res.data.length > 2) {
- //当菜单有 首页 工作 我的 时,对用户进行判断
- if (!adCodeBase) {
- //没有行政区划时 去掉首页
- res.data.shift()
- }
- }
- store.commit("setTabBarList", res.data)
- store.commit('setActiveRoleId', role[0])
- // uni.switchTab({
- // url: res.data[0].path
- // })
- let url = res.data[0].path
- let name = ""
- if (url.indexOf("patrol")) {
- name = "责任人首页"
- } else {
- name = "首页"
- }
+ //添加当前激活的roleId(默认取第一个)
+ vm.$u.vuex('activeRoleId', userInfo.role_id.split(",")[0])
- let params = {
- recipient: userInfo.user_id,
- status: 0
- }
-
- // #ifdef APP-PLUS
-
- //2.0
- // 获取App端cid并存入redis
- let pinf = plus.push.getClientInfo();
- console.log(pinf, pinf.clientid, "---------------")
- if (pinf && pinf.clientid) {
- uni.setStorageSync('cid', pinf.clientid);
- saveCId(userInfo.user_id, pinf.clientid)
- } else {
- var obtainingCIDTimer = setInterval(function() {
- pinf = plus.push.getClientInfo();
- if (pinf.clientid) {
- uni.setStorageSync('cid', pinf.clientid);
- saveCId(userInfo.user_id, pinf.clientid)
- clearInterval(obtainingCIDTimer);
- }
- }, 50);
- }
- setTimeout(() => {
- console.log('cid', uni.getStorageSync('cid'));
- }, 500);
-
-
- // #endif
-
- messageCount(params).then(res => {
- updateTabbar(res.data)
- globalNavigator(url, "switchTab", name)
- })
- }
+ uni.switchTab({
+ url: '/pages/home/index'
})
-
-
-
}
// 退出登录
diff --git a/vue.config.js b/vue.config.js
index d2abc80..ae6adfe 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -9,25 +9,17 @@
transpileDependencies: ['uview-ui'],
- // devServer: {
- // proxy: {
+ devServer: {
+ proxy: {
- // // 中台接口
- // "/skapi": {
- // target: "http://10.10.2.192",
- // changeOrigin: true, //开启代理跨域
- // pathRewrite: {
- // "^/skapi": "",
- // },
- // },
- // // 业务平台接口
- // "/api": {
- // target: "http://172.16.13.110",
- // changeOrigin: true, //开启代理跨域
- // pathRewrite: {
- // "^/api": "",
- // },
- // },
- // },
- // },
-}
+ // 业务平台接口
+ "/api": {
+ target: "http://172.16.13.129:9528",
+ changeOrigin: true, //开启代理跨域
+ pathRewrite: {
+ "^/api": "",
+ },
+ },
+ },
+ },
+}
\ No newline at end of file
--
Gitblit v1.9.3