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;}
\ No newline at end of file \ No newline at end of file
.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,50 +39,66 @@ export default { ...@@ -39,50 +39,66 @@ 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 { merchantId, accountName } = e () => {
let loginAccount = accountName let loginToken = this.getLocalStorage('dj_scrm_loginToken')
ssoApi.selectAccount({ let { merchantId, accountName } = e
loginAccount, let loginAccount = accountName
merchantId, ssoApi
loginToken, .selectAccount({
}).then(({ code, data }) => { loginAccount,
this.hideLoading() merchantId,
this.removeLocalStorage('dj_scrm_loginToken') loginToken
if (code == '0') { })
if (data) { .then(({ code, data }) => {
let { lastPath } = this.getQuery() this.hideLoading()
let redirect_uri = this.getLocalStorage('dj_scrm_redirect_uri') this.removeLocalStorage('dj_scrm_loginToken')
this.setLocalStorage('dj_scrm_userInfo', data) if (code == '0') {
this.setSessionId(data.sessionId) if (data) {
let { corpId } = this.getLocalStorage('dj_scrm_corpId') let { lastPath } = this.getQuery()
store.dispatch('registerHttp', data.sessionId) let redirect_uri = this.getLocalStorage('dj_scrm_redirect_uri')
this.removeLocalStorage('dj_scrm_redirect_uri') this.setLocalStorage('dj_scrm_userInfo', data)
this.showLoading('登录成功', () => { this.setSessionId(data.sessionId)
let { corpId } = this.getLocalStorage('dj_scrm_corpId')
store.dispatch('registerHttp', data.sessionId)
this.removeLocalStorage('dj_scrm_redirect_uri')
this.showLoading('登录成功', () => {
this.hideLoading()
if (redirect_uri) window.location.href = decodeURIComponent(`${redirect_uri}?sessionId=${data.sessionId}&corpId=${corpId}`)
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 {
this.hideLoading() this.hideLoading()
if (redirect_uri) window.location.href = decodeURIComponent(`${redirect_uri}?sessionId=${data.sessionId}&corpId=${corpId}`) Dialog.alert({
else this.$router.replace({ name: lastPath || 'home' }) title: '温馨提示',
}) message: '登录失败,请重试',
} confirmButtonColor: '#FF7336',
} else { confirmButtonText: '重试'
this.hideLoading() }).then(() => {
Dialog.alert({ store.dispatch('login')
title: '温馨提示', })
message: '登录失败,请重试', }
confirmButtonColor: '#FF7336',
confirmButtonText: '重试'
}).then(() => {
store.dispatch('login')
}) })
} },
}) 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)" </template>
> <div class="box">
<div :class="['sprite-icon',`icon-${index}`]"></div> <template v-for="i in item.children">
{{i.name}} <div
</div> :key="i.id"
</template> class="item"
</div> @click="jump(i)"
<div class="title">营销转化</div> >
<div class="box"> <div :class="['sprite-icon',`icon-${i.icon}`]"></div>
<template v-for="(i,index) in list"> {{i.label}}
<div </div>
:key="index" </template>
class="item" </div>
@click="jump(i)"
>
<div :class="['sprite-icon',`icon-${index + 4}`]"></div>
{{i.name}}
</div> </div>
</template> </template>
</div> </template>
<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 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', activated(){
target: 'activity' let list = this.getLocalStorage('dj_scrm_permissionList')
}, if (list && list.length) {
{ list.map(e => {
name: '批量打标签', if (e.children) {
link: 'tag', e.children.map(i => {
target: 'customer' let [link, target] = i.menuUrl.split('@')
}, i.icon = link.replace(/\//g, '_')
// { i.link = link
// name: '素材库' i.target = target
// }, })
{
name: '商品中心',
link: 'merchant/goods',
target: 'activity'
} }
], })
list: [ this.list = list
{
name: '我要发券',
link: 'coupon',
target: 'activity'
},
{
name: '秒杀活动',
link: 'activity',
target: 'activity'
},
// {
// name: '直播活动',
// link: 'activity',
// params: 'tabIndex=1',
// target: 'activity'
// }
]
} }
}, },
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!