Commit cf65ca36 by 李伟康

commit

1 parent e9814a7a
......@@ -31,5 +31,15 @@ export default {
data,
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;}
.icon-0 { width: 40px; height: 40px; background-position: -54px 0px;}
.icon-1 { 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-6 { width: 40px; height: 40px; background-position: -54px 0px;}
.icon-9 { width: 40px; height: 40px; background-position: 0px -54px;}
.icon-default-avatar { width: 44px; height: 44px; background-position: 0px 0px;}
.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
.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

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 {
this.setLocalStorage('dj_scrm_userInfo', data)
console.log(data)
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 {
Notify(message)
}
......
......@@ -98,7 +98,18 @@ const actions = {
util.removeLocalStorage('dj_scrm_redirect_uri')
// 只有一个账号 history.back()
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 {
/**没有账号 */
......@@ -157,8 +168,8 @@ const login = ({ dispatch, to }) => {
let loginToken = util.getLocalStorage('dj_scrm_loginToken')
let userInfo = util.getLocalStorage('dj_scrm_userInfo')
let sessionId = util.getSessionId()
dispatch('registerHttp', sessionId || '')
if (!userInfo || !sessionId) {
dispatch('registerHttp', sessionId || '')
if (loginToken) {
state.showWindow = true
if (to && to.name != 'common.accountList') router.replace({ name: 'common.accountList' })
......
......@@ -28,7 +28,7 @@ import store from '@/store'
import { Dialog } from 'vant'
export default {
name: 'accountList',
data () {
data() {
return {
accountList: [],
merchantEnum: {
......@@ -39,50 +39,66 @@ export default {
}
}
},
mounted () {
mounted() {
this.accountList = this.getLocalStorage('dj_scrm_accountList')
},
methods: {
choose (e) {
this.showLoading('', () => {
let loginToken = this.getLocalStorage('dj_scrm_loginToken')
let { merchantId, accountName } = e
let loginAccount = accountName
ssoApi.selectAccount({
loginAccount,
merchantId,
loginToken,
}).then(({ code, data }) => {
this.hideLoading()
this.removeLocalStorage('dj_scrm_loginToken')
if (code == '0') {
if (data) {
let { lastPath } = this.getQuery()
let redirect_uri = this.getLocalStorage('dj_scrm_redirect_uri')
this.setLocalStorage('dj_scrm_userInfo', data)
this.setSessionId(data.sessionId)
let { corpId } = this.getLocalStorage('dj_scrm_corpId')
store.dispatch('registerHttp', data.sessionId)
this.removeLocalStorage('dj_scrm_redirect_uri')
this.showLoading('登录成功', () => {
choose(e) {
this.showLoading(
'',
() => {
let loginToken = this.getLocalStorage('dj_scrm_loginToken')
let { merchantId, accountName } = e
let loginAccount = accountName
ssoApi
.selectAccount({
loginAccount,
merchantId,
loginToken
})
.then(({ code, data }) => {
this.hideLoading()
this.removeLocalStorage('dj_scrm_loginToken')
if (code == '0') {
if (data) {
let { lastPath } = this.getQuery()
let redirect_uri = this.getLocalStorage('dj_scrm_redirect_uri')
this.setLocalStorage('dj_scrm_userInfo', data)
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()
if (redirect_uri) window.location.href = decodeURIComponent(`${redirect_uri}?sessionId=${data.sessionId}&corpId=${corpId}`)
else this.$router.replace({ name: lastPath || 'home' })
})
}
} else {
this.hideLoading()
Dialog.alert({
title: '温馨提示',
message: '登录失败,请重试',
confirmButtonColor: '#FF7336',
confirmButtonText: '重试'
}).then(() => {
store.dispatch('login')
Dialog.alert({
title: '温馨提示',
message: '登录失败,请重试',
confirmButtonColor: '#FF7336',
confirmButtonText: '重试'
}).then(() => {
store.dispatch('login')
})
}
})
}
})
}, true)
},
true
)
}
}
}
......
<template>
<div class="layout">
<div class="user-box flex">
<div
<!-- <div
class="tips text-center"
@click="closeWindow"
>
<div class="sprite-icon icon-index-tips"></div>
<!-- <div class="num">9999</div> -->
</div>
<div class="num">9999</div>
</div> -->
<div class="avatar">
<template v-if="userInfo.staffAvatar">
<img :src="userInfo.staffAvatar" />
......
<template>
<div class="layout">
<div class="box">
<template v-for="(i,index) in utilsList">
<div
:key="index"
class="item"
@click="jump(i)"
>
<div :class="['sprite-icon',`icon-${index}`]"></div>
{{i.name}}
</div>
</template>
</div>
<div class="title">营销转化</div>
<div class="box">
<template v-for="(i,index) in list">
<div
:key="index"
class="item"
@click="jump(i)"
>
<div :class="['sprite-icon',`icon-${index + 4}`]"></div>
{{i.name}}
<template v-for="item in list">
<template v-if="item.children && item.children.length">
<div :key="item.id">
<template v-if="item.label != '工作台'">
<div class="title">{{item.label}}</div>
</template>
<div class="box">
<template v-for="i in item.children">
<div
:key="i.id"
class="item"
@click="jump(i)"
>
<div :class="['sprite-icon',`icon-${i.icon}`]"></div>
{{i.label}}
</div>
</template>
</div>
</div>
</template>
</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>
</template>
<!-- <div class="title">统计分析</div>
<div class="box">
<div class="item">
......@@ -67,47 +37,28 @@ export default {
name: '',
data() {
return {
utilsList: [
{
name: '核销卡券',
link: 'coupon/verificationList',
target: 'activity'
},
{
name: '批量打标签',
link: 'tag',
target: 'customer'
},
// {
// name: '素材库'
// },
{
name: '商品中心',
link: 'merchant/goods',
target: 'activity'
list: []
}
},
activated(){
let list = this.getLocalStorage('dj_scrm_permissionList')
if (list && list.length) {
list.map(e => {
if (e.children) {
e.children.map(i => {
let [link, target] = i.menuUrl.split('@')
i.icon = link.replace(/\//g, '_')
i.link = link
i.target = target
})
}
],
list: [
{
name: '我要发券',
link: 'coupon',
target: 'activity'
},
{
name: '秒杀活动',
link: 'activity',
target: 'activity'
},
// {
// name: '直播活动',
// link: 'activity',
// params: 'tabIndex=1',
// target: 'activity'
// }
]
})
this.list = list
}
},
mounted() {},
mounted() {
},
methods: {
jump(e) {
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!