Commit cf65ca36 by 李伟康

commit

1 parent e9814a7a
...@@ -31,5 +31,15 @@ export default { ...@@ -31,5 +31,15 @@ export default {
data, data,
returnAll returnAll
}) })
},
/**获取工作台权限 */
getPermission(data = {}) {
data.method = 'scrm.api.sso.user.permission.get'
data.productCode = 'PC00025'
return window.$HTTP({
url,
data,
returnAll
})
} }
} }
.sprite-icon { background-image: url(../images/sprite.png);background-size: 194px 144px;} .sprite-icon { background-image: url(../images/sprite.png);background-size: 194px 144px;}
.icon-0 { width: 40px; height: 40px; background-position: -54px 0px;} .icon-6 { width: 40px; height: 40px; background-position: -54px 0px;}
.icon-1 { width: 40px; height: 40px; background-position: 0px -54px;} .icon-9 { width: 40px; height: 40px; background-position: 0px -54px;}
.icon-2 { width: 40px; height: 40px; background-position: -50px -54px;}
.icon-4 { width: 40px; height: 40px; background-position: -104px 0px;}
.icon-5 { width: 40px; height: 40px; background-position: -104px -50px;}
.icon-6 { width: 40px; height: 40px; background-position: 0px -104px;}
.icon-7 { width: 40px; height: 40px; background-position: -50px -104px;}
.icon-8 { width: 40px; height: 40px; background-position: -100px -104px;}
.icon-9 { width: 40px; height: 40px; background-position: -154px 0px;}
.icon-default-avatar { width: 44px; height: 44px; background-position: 0px 0px;} .icon-default-avatar { width: 44px; height: 44px; background-position: 0px 0px;}
.icon-down { width: 12px; height: 12px; background-position: -154px -83px;} .icon-down { width: 12px; height: 12px; background-position: -154px -83px;}
.icon-index-tips { width: 23px; height: 23px; background-position: -154px -50px;} .icon-index-tips { width: 23px; height: 23px; background-position: -154px -50px;}
.icon-coupon_verificationList { width: 40px; height: 40px; background-position: -50px -54px;}
.icon-tag { width: 40px; height: 40px; background-position: -104px 0px;}
.icon-merchant_goods { width: 40px; height: 40px; background-position: -104px -50px;}
.icon-coupon { width: 40px; height: 40px; background-position: 0px -104px;}
.icon-activity { width: 40px; height: 40px; background-position: -50px -104px;}
.icon-attractCustomer { width: 40px; height: 40px; background-position: -100px -104px;}
.icon-merchant { width: 40px; height: 40px; background-position: -154px 0px;}
\ No newline at end of file \ No newline at end of file

48.4 KB | W: | H:

48.6 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -167,6 +167,14 @@ export default { ...@@ -167,6 +167,14 @@ export default {
this.setLocalStorage('dj_scrm_userInfo', data) this.setLocalStorage('dj_scrm_userInfo', data)
console.log(data) console.log(data)
this.init() this.init()
ssoApi.getPermission().then(response => {
if (response.code == 0) {
let { children } = response.data[0].products[0].merchantProTreeResponses[0]
if (children) this.setLocalStorage('dj_scrm_permissionList', children)
} else {
Notify(response.message)
}
})
} else { } else {
Notify(message) Notify(message)
} }
......
...@@ -98,7 +98,18 @@ const actions = { ...@@ -98,7 +98,18 @@ const actions = {
util.removeLocalStorage('dj_scrm_redirect_uri') util.removeLocalStorage('dj_scrm_redirect_uri')
// 只有一个账号 history.back() // 只有一个账号 history.back()
if (redirect_uri) window.location.href = decodeURIComponent(`${redirect_uri}?sessionId=${userInfo.sessionId}&corpId=${corpId}`) if (redirect_uri) window.location.href = decodeURIComponent(`${redirect_uri}?sessionId=${userInfo.sessionId}&corpId=${corpId}`)
else window.location.replace(`${url}${route}`) else {
ssoApi.getPermission().then(response => {
if (response.code == 0) {
console.log(response)
let { children } = response.data[0].products[0].merchantProTreeResponses[0]
if (children) util.setLocalStorage('dj_scrm_permissionList', children)
window.location.replace(`${url}${route}`)
} else {
Notify(response.message)
}
})
}
} }
} else { } else {
/**没有账号 */ /**没有账号 */
...@@ -157,8 +168,8 @@ const login = ({ dispatch, to }) => { ...@@ -157,8 +168,8 @@ const login = ({ dispatch, to }) => {
let loginToken = util.getLocalStorage('dj_scrm_loginToken') let loginToken = util.getLocalStorage('dj_scrm_loginToken')
let userInfo = util.getLocalStorage('dj_scrm_userInfo') let userInfo = util.getLocalStorage('dj_scrm_userInfo')
let sessionId = util.getSessionId() let sessionId = util.getSessionId()
dispatch('registerHttp', sessionId || '')
if (!userInfo || !sessionId) { if (!userInfo || !sessionId) {
dispatch('registerHttp', sessionId || '')
if (loginToken) { if (loginToken) {
state.showWindow = true state.showWindow = true
if (to && to.name != 'common.accountList') router.replace({ name: 'common.accountList' }) if (to && to.name != 'common.accountList') router.replace({ name: 'common.accountList' })
......
...@@ -28,7 +28,7 @@ import store from '@/store' ...@@ -28,7 +28,7 @@ import store from '@/store'
import { Dialog } from 'vant' import { Dialog } from 'vant'
export default { export default {
name: 'accountList', name: 'accountList',
data () { data() {
return { return {
accountList: [], accountList: [],
merchantEnum: { merchantEnum: {
...@@ -39,20 +39,24 @@ export default { ...@@ -39,20 +39,24 @@ export default {
} }
} }
}, },
mounted () { mounted() {
this.accountList = this.getLocalStorage('dj_scrm_accountList') this.accountList = this.getLocalStorage('dj_scrm_accountList')
}, },
methods: { methods: {
choose (e) { choose(e) {
this.showLoading('', () => { this.showLoading(
'',
() => {
let loginToken = this.getLocalStorage('dj_scrm_loginToken') let loginToken = this.getLocalStorage('dj_scrm_loginToken')
let { merchantId, accountName } = e let { merchantId, accountName } = e
let loginAccount = accountName let loginAccount = accountName
ssoApi.selectAccount({ ssoApi
.selectAccount({
loginAccount, loginAccount,
merchantId, merchantId,
loginToken, loginToken
}).then(({ code, data }) => { })
.then(({ code, data }) => {
this.hideLoading() this.hideLoading()
this.removeLocalStorage('dj_scrm_loginToken') this.removeLocalStorage('dj_scrm_loginToken')
if (code == '0') { if (code == '0') {
...@@ -67,7 +71,17 @@ export default { ...@@ -67,7 +71,17 @@ export default {
this.showLoading('登录成功', () => { this.showLoading('登录成功', () => {
this.hideLoading() this.hideLoading()
if (redirect_uri) window.location.href = decodeURIComponent(`${redirect_uri}?sessionId=${data.sessionId}&corpId=${corpId}`) if (redirect_uri) window.location.href = decodeURIComponent(`${redirect_uri}?sessionId=${data.sessionId}&corpId=${corpId}`)
else this.$router.replace({ name: lastPath || 'home' }) else {
ssoApi.getPermission().then(response => {
if (response.code == 0) {
let { children } = response.data[0].products[0].merchantProTreeResponses[0]
if (children) this.setLocalStorage('dj_scrm_permissionList', children)
this.$router.replace({ name: lastPath || 'home' })
} else {
Notify(response.message)
}
})
}
}) })
} }
} else { } else {
...@@ -82,7 +96,9 @@ export default { ...@@ -82,7 +96,9 @@ export default {
}) })
} }
}) })
}, true) },
true
)
} }
} }
} }
......
<template> <template>
<div class="layout"> <div class="layout">
<div class="user-box flex"> <div class="user-box flex">
<div <!-- <div
class="tips text-center" class="tips text-center"
@click="closeWindow" @click="closeWindow"
> >
<div class="sprite-icon icon-index-tips"></div> <div class="sprite-icon icon-index-tips"></div>
<!-- <div class="num">9999</div> --> <div class="num">9999</div>
</div> </div> -->
<div class="avatar"> <div class="avatar">
<template v-if="userInfo.staffAvatar"> <template v-if="userInfo.staffAvatar">
<img :src="userInfo.staffAvatar" /> <img :src="userInfo.staffAvatar" />
......
<template> <template>
<div class="layout"> <div class="layout">
<div class="box"> <template v-for="item in list">
<template v-for="(i,index) in utilsList"> <template v-if="item.children && item.children.length">
<div <div :key="item.id">
:key="index" <template v-if="item.label != '工作台'">
class="item" <div class="title">{{item.label}}</div>
@click="jump(i)"
>
<div :class="['sprite-icon',`icon-${index}`]"></div>
{{i.name}}
</div>
</template> </template>
</div>
<div class="title">营销转化</div>
<div class="box"> <div class="box">
<template v-for="(i,index) in list"> <template v-for="i in item.children">
<div <div
:key="index" :key="i.id"
class="item" class="item"
@click="jump(i)" @click="jump(i)"
> >
<div :class="['sprite-icon',`icon-${index + 4}`]"></div> <div :class="['sprite-icon',`icon-${i.icon}`]"></div>
{{i.name}} {{i.label}}
</div> </div>
</template> </template>
</div> </div>
<div class="title">引流获客</div>
<div class="box">
<div
class="item"
@click="jump({
link:'attractCustomer',
target:'customer'
})"
>
<div class="sprite-icon icon-7"></div>
活码引流
</div>
</div>
<div class="title">留客锁客</div>
<div class="box">
<div
class="item"
@click="jump({
link: 'merchant',
target: 'activity'
})"
>
<div class="sprite-icon icon-8"></div>
门店套餐
</div>
</div> </div>
</template>
</template>
<!-- <div class="title">统计分析</div> <!-- <div class="title">统计分析</div>
<div class="box"> <div class="box">
<div class="item"> <div class="item">
...@@ -67,47 +37,28 @@ export default { ...@@ -67,47 +37,28 @@ export default {
name: '', name: '',
data() { data() {
return { return {
utilsList: [ list: []
{
name: '核销卡券',
link: 'coupon/verificationList',
target: 'activity'
},
{
name: '批量打标签',
link: 'tag',
target: 'customer'
},
// {
// name: '素材库'
// },
{
name: '商品中心',
link: 'merchant/goods',
target: 'activity'
} }
],
list: [
{
name: '我要发券',
link: 'coupon',
target: 'activity'
},
{
name: '秒杀活动',
link: 'activity',
target: 'activity'
}, },
// { activated(){
// name: '直播活动', let list = this.getLocalStorage('dj_scrm_permissionList')
// link: 'activity', if (list && list.length) {
// params: 'tabIndex=1', list.map(e => {
// target: 'activity' if (e.children) {
// } e.children.map(i => {
] let [link, target] = i.menuUrl.split('@')
i.icon = link.replace(/\//g, '_')
i.link = link
i.target = target
})
} }
})
this.list = list
}
},
mounted() {
}, },
mounted() {},
methods: { methods: {
jump(e) { jump(e) {
let sessionId = this.getSessionId() let sessionId = this.getSessionId()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!