Commit 9931f68a by 王志慧
2 parents 6a47e684 69401d72
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"glsx-common": "^1.4.8", "glsx-common": "^1.4.8",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"postcss-loader": "^6.2.0", "postcss-loader": "^6.2.0",
"sass-loader": "^7.3.1",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"storejs": "^1.1.0", "storejs": "^1.1.0",
"vant": "^2.12.21", "vant": "^2.12.21",
...@@ -41,7 +42,6 @@ ...@@ -41,7 +42,6 @@
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport": "^1.1.1",
"postcss-pxtorem": "^5.1.1", "postcss-pxtorem": "^5.1.1",
"sass-loader": "^8.0.2",
"script-ext-html-webpack-plugin": "^2.1.4", "script-ext-html-webpack-plugin": "^2.1.4",
"vue-loader": "^15.9.8", "vue-loader": "^15.9.8",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11",
......
<template> <template>
<div id="app"> <div id="app">
<router-view /> <template v-if="showWindow">
<router-view />
</template>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'App' name: 'App',
data() {
return {
showWindow: false
}
},
watch: {
watchFlag: {
immediate: true,
handler(newval) {
this.showWindow = newval
this.hideLoading()
}
}
},
computed: {
watchFlag() {
return this.$store.state.app.showWindow
}
}
} }
</script> </script>
<style lang="scss"></style> <style lang="scss"></style>
...@@ -5,7 +5,6 @@ export default { ...@@ -5,7 +5,6 @@ export default {
/**获取详情信息 */ /**获取详情信息 */
getDetail(data) { getDetail(data) {
data.method = 'scrm.api.live.merchant.get.task' data.method = 'scrm.api.live.merchant.get.task'
data.taskId = '1'
return window.$HTTP({ return window.$HTTP({
url, url,
data, data,
......
...@@ -35,8 +35,6 @@ const mutations = { ...@@ -35,8 +35,6 @@ const mutations = {
SET_LAST_PATH(state, path) { SET_LAST_PATH(state, path) {
state.lastPath = path state.lastPath = path
} }
} }
const actions = { const actions = {
// 设置name // 设置name
...@@ -65,70 +63,75 @@ const actions = { ...@@ -65,70 +63,75 @@ const actions = {
}, },
login({ dispatch }) { login({ dispatch }) {
let [redirectUrl] = window.location.href.split('?') let [redirectUrl] = window.location.href.split('?')
// 以下是 本地调试 // 以下是 本地调试
if (process.env.NODE_ENV == 'development') { if (process.env.NODE_ENV == 'development') {
const code = getParams('code') const code = getParams('code')
if (code) { if (code) {
const { corpId } = util.getLocalStorage('dj_scrm_corpId') const { corpId } = util.getLocalStorage('dj_scrm_corpId')
ssoApi.login({ ssoApi
code, .login({
corpId code,
}).then(({ code, data, message }) => { corpId
console.log(data) })
// const { baseURL } = window.$fetchConfig.request .then(({ code, data, message }) => {
const [baseURL] = redirectUrl.split('/dj-scrm-wx-work-main/') console.log(data)
let url = `${baseURL}/dj-scrm-wx-work-main/#/` // const { baseURL } = window.$fetchConfig.request
let route = state.lastPath == 'coupon' ? '' : state.lastPath || '' const [baseURL] = redirectUrl.split('/dj-scrm-wx-work-main/')
route = route.replace('.', '/') let url = `${baseURL}/dj-scrm-wx-work-main/#/`
state.showWindow = true let route = state.lastPath == 'coupon' ? '' : state.lastPath || ''
if (code == '0') { route = route.replace('.', '/')
if (data.loginList.length) { if (code == '0') {
if (data.loginList.length > 1) { if (data.loginList.length) {
if (data.loginList.length > 1) {
let userInfo = data.loginList[0] let userInfo = data.loginList[0]
let { merchantId, accountName } = userInfo let { merchantId, accountName } = userInfo
let loginAccount = accountName let loginAccount = accountName
ssoApi.selectAccount({ ssoApi
loginAccount, .selectAccount({
merchantId, loginAccount,
loginToken: data.loginToken, merchantId,
loginSource: 'WW', loginToken: data.loginToken,
loginType: 3 loginSource: 'WW',
}).then(res => { loginType: 3
util.removeLocalStorage('dj_scrm_loginToken') })
util.removeLocalStorage('dj_scrm_accountList') .then(res => {
util.setLocalStorage('dj_scrm_userInfo', res.data) util.removeLocalStorage('dj_scrm_loginToken')
util.setSessionId(res.data.sessionId) util.removeLocalStorage('dj_scrm_accountList')
dispatch('registerHttp', res.data.sessionId) util.setLocalStorage('dj_scrm_userInfo', res.data)
window.location.replace(`${url}${route}`) util.setSessionId(res.data.sessionId)
}) dispatch('registerHttp', res.data.sessionId)
state.showWindow = true
window.location.replace(`${url}${route}`)
})
} else {
let [userInfo] = data.loginList
util.setLocalStorage('dj_scrm_userInfo', userInfo)
util.setSessionId(userInfo.sessionId)
dispatch('registerHttp', userInfo.sessionId)
// 只有一个账号 history.back()
console.log(`${redirectUrl}${route}`)
state.showWindow = true
window.location.replace(`${redirectUrl}${route}`)
}
} else { } else {
let [userInfo] = data.loginList /**没有账号 */
util.setLocalStorage('dj_scrm_userInfo', userInfo) // window.location.href = `${url}common/nothing`
util.setSessionId(userInfo.sessionId) Notify('没有账号')
dispatch('registerHttp', userInfo.sessionId)
// 只有一个账号 history.back()
console.log(`${redirectUrl}${route}`)
// window.location.replace(`${redirectUrl}${route}`)
} }
} else { } else {
/**没有账号 */ /**账号过期 (暂时没有字段判断是否过期) */
// window.location.href = `${url}common/nothing` Notify(message)
// window.location.href = `${url}common/overdue`
} }
} else { })
/**账号过期 (暂时没有字段判断是否过期) */
Notify(message)
// window.location.href = `${url}common/overdue`
}
})
} else { } else {
util.showLoading() util.showLoading()
let appid = getParams('corpId') //从链接获取 let appid = getParams('corpId') //从链接获取
let dj_scrm = util.getLocalStorage('dj_scrm_corpId') let dj_scrm = util.getLocalStorage('dj_scrm_corpId')
if (!appid) appid = dj_scrm && dj_scrm.corpId || 'ww7ee69c648ae1b7e6' if (!appid) appid = (dj_scrm && dj_scrm.corpId) || 'ww7ee69c648ae1b7e6'
// //
util.setLocalStorage('dj_scrm_corpId', { corpId: appid }) util.setLocalStorage('dj_scrm_corpId', { corpId: appid })
// 'ww657a2d4ae89a4424' // 'ww657a2d4ae89a4424'
const wxUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize' const wxUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize'
window.location.href = `${wxUrl}?appid=${appid}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect` window.location.href = `${wxUrl}?appid=${appid}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
} }
...@@ -138,13 +141,12 @@ const actions = { ...@@ -138,13 +141,12 @@ const actions = {
let url = `${baseURL}/dj-scrm-wx-work-main/#/` let url = `${baseURL}/dj-scrm-wx-work-main/#/`
window.location.href = `${url}?redirect_uri=${redirectUrl}&corpId=${storage_corpId.corpId}` window.location.href = `${url}?redirect_uri=${redirectUrl}&corpId=${storage_corpId.corpId}`
} }
}, },
navigation({ dispatch }) { navigation({ dispatch }) {
let { sessionId, corpId } = getParams() let { sessionId, corpId } = getParams()
const storage_sessionId = util.getSessionId() const storage_sessionId = util.getSessionId()
const storage_corpId = util.getLocalStorage('dj_scrm_corpId') const storage_corpId = util.getLocalStorage('dj_scrm_corpId')
if (!corpId) corpId = storage_corpId && storage_corpId.corpId || 'ww7ee69c648ae1b7e6' if (!corpId) corpId = (storage_corpId && storage_corpId.corpId) || 'ww7ee69c648ae1b7e6'
util.setLocalStorage('dj_scrm_corpId', { corpId }) util.setLocalStorage('dj_scrm_corpId', { corpId })
if (sessionId || storage_sessionId) { if (sessionId || storage_sessionId) {
state.showWindow = true state.showWindow = true
...@@ -159,7 +161,7 @@ const actions = { ...@@ -159,7 +161,7 @@ const actions = {
state.showWindow = true state.showWindow = true
}, },
registerHttp({}, sessionId = '') { registerHttp({}, sessionId = '') {
window.$HTTP = new Http({...window.$fetchConfig, alert: Notify, headers: { token: sessionId } }) window.$HTTP = new Http({ ...window.$fetchConfig, alert: Notify, headers: { token: sessionId } })
} }
} }
const getParams = name => { const getParams = name => {
......
...@@ -152,6 +152,9 @@ const toTop = () => { ...@@ -152,6 +152,9 @@ const toTop = () => {
const getParams = () => { const getParams = () => {
return window.vm.$route.params return window.vm.$route.params
} }
const getQuery = () => {
return window.vm.$route.query
}
const watchPageBack = () => { const watchPageBack = () => {
return new Promise(resolve => { return new Promise(resolve => {
if (window.$back) { if (window.$back) {
...@@ -183,7 +186,8 @@ const utils = { ...@@ -183,7 +186,8 @@ const utils = {
throttle, throttle,
decimal, decimal,
dialog, dialog,
toTop toTop,
getQuery
} }
Object.keys(utils).map(key => { Object.keys(utils).map(key => {
......
<template> <template>
<div class="container"> <div class="container">
<div class="box"> <div class="box" v-if="showBox">
<div class="top"> <div class="top">
<div class="top-title">{{ detail.name }}直播活动</div> <div class="top-title">{{ detail.name }}直播活动</div>
<div class="iconBox" @click="copyMessage(this.massMessage)"> <div class="iconBox" @click="copyMessage(this.massMessage)">
...@@ -13,46 +13,61 @@ ...@@ -13,46 +13,61 @@
<img :src="detail.postImgUrl" alt="" /> <img :src="detail.postImgUrl" alt="" />
</div> </div>
</div> </div>
<div class="fixedButtom"> <div class="fixedButtom" v-if="showBox">
<!-- <div class="item-container"> --> <div class="item-container">
<div class="icon-container"> <div class="icon-container">
<div class="icon-box" @click="shareWechat"> <div class="icon-box" @click="share('wechat')">
<img src="@/assets/images/wechat.png" alt="" /> <img src="@/assets/images/wechat.png" alt="" />
</div>
</div> </div>
<div class="icon-instruction">分享朋友圈</div>
</div> </div>
<!-- <div class="icon-instruction">分享到朋友圈</div> --> <div class="item-container" style="margin-left: 61px">
<!-- </div> --> <div class="icon-container" @click="share('customer')">
<div class="icon-container" style="margin-left: 75px" @click="shareCustomer"> <div class="icon-box">
<div class="icon-box"> <img src="@/assets/images/customer.png" alt="" />
<img src="@/assets/images/customer.png" alt="" /> </div>
</div> </div>
<div class="icon-instruction">分享客户</div>
</div> </div>
<div class="icon-container" style="margin-left: 75px" @click="shareGroup"> <div class="item-container" style="margin-left: 61px">
<div class="icon-box"> <div class="icon-container" @click="share('group')">
<img src="@/assets/images/group.png" alt="" /> <div class="icon-box">
<img src="@/assets/images/group.png" alt="" />
</div>
</div> </div>
<div class="icon-instruction">分享客户群</div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { liveBroadcast, wxConfig } from '@/api' import { liveBroadcast, wxConfig } from '@/api'
import { Notify } from 'vant'
export default { export default {
name: 'mass', name: 'mass',
data() { data() {
return { return {
detail: {}, detail: {},
date: '' date: '',
showBox: true
} }
}, },
activated() {}, activated() {},
deactivated() {}, deactivated() {},
mounted() { mounted() {
let { taskId } = this.getQuery()
//获取界面详情数据 //获取界面详情数据
liveBroadcast.getDetail({}).then(res => { liveBroadcast.getDetail({ taskId }).then(res => {
this.detail = res.data console.log(res,'789')
console.log(this.detail.startTime, 'this.detail.startTime') if (res.code !== '0') {
this.formatDate(this.detail.startTime, this.detail.endTime) this.showBox = false
Notify(res.message)
} else if (res.code == '0') {
this.detail = res.data
console.log(this.detail.startTime, 'this.detail.startTime')
this.formatDate(this.detail.startTime, this.detail.endTime)
}
}) })
//初始化微信方法 //初始化微信方法
window.$wx = wxConfig window.$wx = wxConfig
...@@ -66,29 +81,31 @@ export default { ...@@ -66,29 +81,31 @@ export default {
// cloneText(val) // cloneText(val)
// Toast('复制成功') // Toast('复制成功')
// } // }
//分享到朋友圈 share(object) {
shareWechat() { console.log(object)
let text = { let text = {
content: this.detail.promotion + '直播时间' + ' ' + this.date content: this.detail.promotion + '\n' + '直播时间' + ' ' + this.date
} }
let attachments = [ let attachments = [
{ {
msgtype: 'image', msgtype: 'image',
image: { image: {
imgUrl: '' imgUrl: this.detail.postImgUrl
} }
} }
] ]
// let text = this.detail.promotion +'直播时间' + ' ' + this.date //分享到朋友圈
window.$wx.shareToExternalMoments({ content: text }).then(res => {}) if (object == 'wechat') {
}, window.$wx.shareToExternalMoments({ text, attachments }).then(res => {})
//分享给客户 }
shareCustomer() { //分享给客户
window.$wx.shareToExternalContact().then(res => {}) if (object == 'customer') {
}, window.$wx.shareToExternalContact({ text, attachments }).then(res => {})
//分享给客户群 }
shareGroup() { //分享给客户群
window.$wx.shareToExternalChat().then(res => {}) if (object == 'group') {
window.$wx.shareToExternalChat({ text, attachments }).then(res => {})
}
}, },
//更改日期格式 //更改日期格式
formatDate(startTime, endTime) { formatDate(startTime, endTime) {
...@@ -109,16 +126,17 @@ export default { ...@@ -109,16 +126,17 @@ export default {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
position: -webkit-sticky; position: -webkit-sticky;
position: sticky; position: fixed;
bottom: 0; bottom: 0;
opacity: 1; opacity: 1;
z-index: 99; z-index: 99;
box-sizing: border-box;
text-align: center; text-align: center;
padding: 20px 38px 20px 37px; padding: 20px 33px 20px 32px;
height: 76px;
background: #ffffff; background: #ffffff;
box-shadow: 0px -2px 8px 0px rgba(224, 224, 224, 0.5); box-shadow: 0px -2px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 16px 16px 0px 0px; border-radius: 16px 16px 0px 0px;
width: 100%;
} }
.buttomLine { .buttomLine {
width: 134px; width: 134px;
...@@ -200,6 +218,7 @@ export default { ...@@ -200,6 +218,7 @@ export default {
height: 50px; height: 50px;
background-color: #e9e8ff; background-color: #e9e8ff;
border-radius: 50%; border-radius: 50%;
margin: 0px 5px 0px 5px;
} }
.icon-box { .icon-box {
width: 26px; width: 26px;
......
<!-- home -->
<template>
<div class="container">
<template v-if="showWindow">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
<template v-if="$route.meta.isTab">
<tab-bar :data="tabList"></tab-bar>
</template>
</template>
</div>
</template>
<script>
export default {
data () {
return {
showWindow: false
}
},
watch: {
watchFlag: {
immediate: true,
handler (newval) {
this.showWindow = newval
this.hideLoading()
}
}
},
computed: {
watchFlag () {
return this.$store.state.app.showWindow
}
},
mounted () {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
...@@ -49,8 +49,8 @@ const spritesmithFunction = data => { ...@@ -49,8 +49,8 @@ const spritesmithFunction = data => {
return `${shared}\n${perSprite}` return `${shared}\n${perSprite}`
} }
module.exports = { module.exports = {
publicPath: IS_PROD ? './' : '/dj-scrm-wx-group-chat/',
publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-main/', // 署应用包时的基本 URL。 vue-router hash 模式使用 // publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-main/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-attachment-customer/', // 署应用包时的基本 URL。 vue-router hash 模式使用 // publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-attachment-customer/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: '/dj-scrm-wx-work-attachment-customer/', // 署应用包时的基本 URL。 vue-router history模式使用 // publicPath: '/dj-scrm-wx-work-attachment-customer/', // 署应用包时的基本 URL。 vue-router history模式使用
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!