@@ -0,0 +1,15 @@ | |||
const {request} = require("../request/index") | |||
/** | |||
* 获取省市区树状数据 | |||
* @param {*} params | |||
*/ | |||
export const getPermission = function(roleId) { | |||
return request({ | |||
url: '/permission/getRolePermission', | |||
method: "GET", | |||
data: { | |||
clientId: 'tuoheng-pilot-mp', | |||
roleId | |||
} | |||
}) | |||
} |
@@ -1,4 +1,7 @@ | |||
// app.js | |||
import { | |||
getPermission | |||
} from './api/permission.js' | |||
App({ | |||
onLaunch() { | |||
// 展示本地存储能力 | |||
@@ -7,11 +10,20 @@ App({ | |||
wx.setStorageSync('logs', logs) | |||
// 登录 | |||
wx.login({ | |||
success: res => { | |||
// 发送 res.code 到后台换取 openId, sessionKey, unionId | |||
} | |||
const {roleId} = wx.getStorageSync('userInfo') | |||
getPermission(roleId).then(i => { | |||
if (i.code === 0) { | |||
wx.setStorage({ | |||
key: 'menuList', | |||
data: i.data.opMenusList | |||
}) | |||
wx.setStorage({ | |||
key: 'permissionsList', | |||
data: i.data.permissionsList | |||
}) | |||
} | |||
}) | |||
}, | |||
globalData: { | |||
userInfo: null |
@@ -1,12 +1,12 @@ | |||
const __request_base_url__ = { | |||
// develop: "http://192.168.11.11:7011/pilot/miniprogram", | |||
develop: "https://pilot-miniprogram.t-aaron.com/pilot/miniprogram", | |||
develop: "https://pilot-miniprogram-test.t-aaron.com/pilot/miniprogram", | |||
trial: "https://pilot-miniprogram-test.t-aaron.com/pilot/miniprogram", | |||
release: "https://pilot-miniprogram.t-aaron.com/pilot/miniprogram" | |||
} | |||
const __request_oidc_url__ = { | |||
// develop: "https://oidc.t-aaron.com", | |||
develop: "https://oidc.t-aaron.com", | |||
develop: "https://login-test.t-aaron.com", | |||
// develop: "http://192.168.11.11:8090", | |||
trial: "https://login-test.t-aaron.com", | |||
release: "https://oidc.t-aaron.com" | |||
} |
@@ -1,6 +1,7 @@ | |||
// pages/login/login.js | |||
import {userLogin} from '../../api/login.js' | |||
import { oidcUrl } from '../../environments.js' | |||
import { getPermission } from '../../api/permission.js' | |||
Page({ | |||
/** | |||
@@ -148,6 +149,19 @@ Page({ | |||
key: 'userInfo', | |||
data: res.data | |||
}) | |||
// 获取用户权限信息 | |||
getPermission(res.data.roleId).then(i => { | |||
if (i.code === 0) { | |||
wx.setStorage({ | |||
key: 'menuList', | |||
data: i.data.opMenusList | |||
}) | |||
wx.setStorage({ | |||
key: 'permissionsList', | |||
data: i.data.permissionsList | |||
}) | |||
} | |||
}) | |||
wx.switchTab({ | |||
url: '/pages/task/task', | |||
}) |
@@ -42,6 +42,6 @@ | |||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", | |||
"projectname": "weixin-app", | |||
"setting": { | |||
"urlCheck": true | |||
"urlCheck": false | |||
} | |||
} |