|
@@ -1,7 +1,93 @@
|
|
|
-import Vue from 'vue'
|
|
|
+import Vue from 'vue';
|
|
|
+
|
|
|
+/* 获取用户权限 */
|
|
|
+function query_userauth() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ Vue.prototype.$Http.basic({
|
|
|
+ "classname": "sysmanage.develop.userauth.userauth",
|
|
|
+ "method": "query_userauth",
|
|
|
+ content: {
|
|
|
+ nocache: true
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("查询用户权限", res)
|
|
|
+ if (Vue.prototype.cutoff(res.msg)) return resolve(false);
|
|
|
+ resolve(true)
|
|
|
+ parsingAuth(res.data)
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+}
|
|
|
+/* 查询站点数据 */
|
|
|
+function querySite_Parameter() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ Vue.prototype.$Http.basic({
|
|
|
+ "classname": "webmanage.site.site",
|
|
|
+ "method": "querySite_Parameter", //查询站点数据
|
|
|
+ "content": {}
|
|
|
+ }).then(res => {
|
|
|
+ console.log("查询站点配置", res)
|
|
|
+ if (Vue.prototype.cutoff(res.msg)) return resolve(false);
|
|
|
+ uni.removeStorage({
|
|
|
+ key: 'siteP',
|
|
|
+ })
|
|
|
+ uni.setStorageSync('siteP', res.data);
|
|
|
+ resolve(true)
|
|
|
+ });
|
|
|
+ })
|
|
|
+}
|
|
|
+/* 查询站点数据 */
|
|
|
+function querySite() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ Vue.prototype.$Http.basic({
|
|
|
+ "classname": "webmanage.site.site",
|
|
|
+ "method": "querySite",
|
|
|
+ "content": {},
|
|
|
+ }).then(res => {
|
|
|
+ console.log("查询站点配置", res)
|
|
|
+ if (Vue.prototype.cutoff(res.msg)) return resolve(false);
|
|
|
+ res.data.logo = res.data.attinfos.length ? Vue.prototype.getSpecifiedImage(res.data.attinfos.find(s => s.usetype == "actionlogo") || res.data.attinfos[0]) : ''
|
|
|
+ uni.removeStorage({
|
|
|
+ key: 'site',
|
|
|
+ })
|
|
|
+ uni.setStorageSync('site', res.data);
|
|
|
+ resolve(true)
|
|
|
+ });
|
|
|
+ })
|
|
|
+}
|
|
|
+/* 格式化权限 */
|
|
|
+function parsingAuth(list) {
|
|
|
+ let authList = {}
|
|
|
+ list.forEach(system => {
|
|
|
+ // let systemObj = {}
|
|
|
+ system.modules.forEach(app => {
|
|
|
+ let appObj = {}
|
|
|
+ app.apps.forEach(m => {
|
|
|
+ appObj[m.meta.title] = {
|
|
|
+ path: m.path,
|
|
|
+ pathDetail: m.path_index,
|
|
|
+ pathDetail: m.path_index,
|
|
|
+ name: m.name,
|
|
|
+ remark: m.meta.title,
|
|
|
+ cover: m.cover,
|
|
|
+ option: m.meta.auth.map(v => v.option),
|
|
|
+ optionname: m.meta.auth.map(v => v.optionname)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // systemObj[app.systemmodulename] = appObj;
|
|
|
+ authList[app.systemmodulename] = appObj;
|
|
|
+ })
|
|
|
+ // authList[system.systemname] = systemObj;
|
|
|
+ });
|
|
|
+ uni.removeStorage({
|
|
|
+ key: 'authList'
|
|
|
+ })
|
|
|
+ uni.setStorageSync('authList', authList)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
class Login {
|
|
|
wechatLogin() {
|
|
|
- let that = this;
|
|
|
return new Promise((resolve, reject) => {
|
|
|
uni.login({
|
|
|
success(res) {
|
|
@@ -10,12 +96,13 @@ class Login {
|
|
|
"systemclient": "marketingtool"
|
|
|
}).then(res => {
|
|
|
console.log("微信登录", res)
|
|
|
- if (Vue.prototype.cutoff(res.msg)) return resolve({});
|
|
|
+ if (Vue.prototype.cutoff(res.msg)) return resolve(false);
|
|
|
+ resolve(res.account_list[0].token)
|
|
|
uni.removeStorage({
|
|
|
key: 'userMsg',
|
|
|
})
|
|
|
uni.setStorageSync('userMsg', res.account_list[0])
|
|
|
- Vue.prototype.$Http.systemInitIsComplete = Promise.all([that.query_userauth(), that.querySite_Parameter(), that.querySite()]).then(res => {
|
|
|
+ Vue.prototype.$Http.systemInitIsComplete = Promise.all([query_userauth(), querySite_Parameter(), querySite()]).then(res => {
|
|
|
Vue.prototype.$Http.systemInitIsComplete = true
|
|
|
Vue.prototype.$Http.HomePageStartRendering && Vue.prototype.$Http.HomePageStartRendering()
|
|
|
})
|
|
@@ -24,90 +111,7 @@ class Login {
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
- /* 获取用户权限 */
|
|
|
- query_userauth() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- Vue.prototype.$Http.basic({
|
|
|
- "classname": "sysmanage.develop.userauth.userauth",
|
|
|
- "method": "query_userauth",
|
|
|
- content: {
|
|
|
- nocache: true
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("查询用户权限", res)
|
|
|
- if (Vue.prototype.cutoff(res.msg)) return resolve(false);
|
|
|
- resolve(true)
|
|
|
- this.parsingAuth(res.data)
|
|
|
- });
|
|
|
- })
|
|
|
|
|
|
- }
|
|
|
- /* 查询站点数据 */
|
|
|
- querySite_Parameter() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- Vue.prototype.$Http.basic({
|
|
|
- "classname": "webmanage.site.site",
|
|
|
- "method": "querySite_Parameter", //查询站点数据
|
|
|
- "content": {}
|
|
|
- }).then(res => {
|
|
|
- console.log("查询站点配置", res)
|
|
|
- if (Vue.prototype.cutoff(res.msg)) return resolve(false);
|
|
|
- uni.removeStorage({
|
|
|
- key: 'siteP',
|
|
|
- })
|
|
|
- uni.setStorageSync('siteP', res.data);
|
|
|
- resolve(true)
|
|
|
- });
|
|
|
- })
|
|
|
- }
|
|
|
- /* 查询站点数据 */
|
|
|
- querySite() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- Vue.prototype.$Http.basic({
|
|
|
- "classname": "webmanage.site.site",
|
|
|
- "method": "querySite",
|
|
|
- "content": {},
|
|
|
- }).then(res => {
|
|
|
- console.log("查询站点配置", res)
|
|
|
- if (Vue.prototype.cutoff(res.msg)) return resolve(false);
|
|
|
- res.data.logo = res.data.attinfos.length ? Vue.prototype.getSpecifiedImage(res.data.attinfos.find(s => s.usetype == "actionlogo") || res.data.attinfos[0]) : ''
|
|
|
- uni.removeStorage({
|
|
|
- key: 'site',
|
|
|
- })
|
|
|
- uni.setStorageSync('site', res.data);
|
|
|
- resolve(true)
|
|
|
- });
|
|
|
- })
|
|
|
- }
|
|
|
- /* 格式化权限 */
|
|
|
- parsingAuth(list) {
|
|
|
- let authList = {}
|
|
|
- list.forEach(system => {
|
|
|
- // let systemObj = {}
|
|
|
- system.modules.forEach(app => {
|
|
|
- let appObj = {}
|
|
|
- app.apps.forEach(m => {
|
|
|
- appObj[m.meta.title] = {
|
|
|
- path: m.path,
|
|
|
- pathDetail: m.path_index,
|
|
|
- pathDetail: m.path_index,
|
|
|
- name: m.name,
|
|
|
- remark: m.meta.title,
|
|
|
- cover: m.cover,
|
|
|
- option: m.meta.auth.map(v => v.option),
|
|
|
- optionname: m.meta.auth.map(v => v.optionname)
|
|
|
- }
|
|
|
- })
|
|
|
- // systemObj[app.systemmodulename] = appObj;
|
|
|
- authList[app.systemmodulename] = appObj;
|
|
|
- })
|
|
|
- // authList[system.systemname] = systemObj;
|
|
|
- });
|
|
|
- uni.removeStorage({
|
|
|
- key: 'authList'
|
|
|
- })
|
|
|
- uni.setStorageSync('authList', authList)
|
|
|
- }
|
|
|
}
|
|
|
export {
|
|
|
Login
|