Commit e7de3d1e by liwk

commit

1 parent 529e5b6d
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"autoprefixer": "^8.0.0", "autoprefixer": "^8.0.0",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"dayjs": "^1.10.5", "dayjs": "^1.10.5",
"glsx-common": "^1.4.7", "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",
"sha1": "^1.1.1", "sha1": "^1.1.1",
......
const url = '/rop-scrm-coupon/router'
export default {
/** 获取门店商品列表 */
getGoodsList(data) {
data.method = 'scrm.api.shopmall.goods.wework.page'
data.pageSize = 10
return window.$HTTP({
url,
data
})
},
}
\ No newline at end of file \ No newline at end of file
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
* @LastEditTime: 2021-06-17 18:23:27 * @LastEditTime: 2021-06-17 18:23:27
*/ */
import ssoApi from './ssoApi' import ssoApi from './ssoApi'
import wxConfig from './wxConfig'
import shopmallApi from './shopmallApi'
export { export {
ssoApi, ssoApi,
wxConfig,
shopmallApi
} }
\ No newline at end of file \ No newline at end of file
const url = '/rop-scrm-shopmall/router'
export default {
/** 获取门店商品列表 */
getGoodsList(data) {
data.method = 'scrm.api.shopmall.goods.wework.page'
data.pageSize = 10
return window.$HTTP({
url,
data
})
},
}
\ No newline at end of file \ No newline at end of file
const url = '/rop-scrm-sso/router'
const returnAll = true
export default { export default {
/**OAuth2授权登陆 */ /**OAuth2授权登陆 */
login(data) { login(data) {
data.returnAll = true
data.method = 'scrm.api.sso.ww.oauth.login' data.method = 'scrm.api.sso.ww.oauth.login'
return window.$HTTP({ data }) return window.$HTTP({
url,
data,
returnAll
})
}, },
/** 选择登录账号 */ /** 选择登录账号 */
selectAccount(data) { selectAccount(data) {
data.returnAll = true
data.method = 'scrm.api.sso.user.login.select' data.method = 'scrm.api.sso.user.login.select'
return window.$HTTP({ data }) return window.$HTTP({
url,
data,
returnAll
})
} }
} }
\ No newline at end of file \ No newline at end of file
import util from '@/utils/util'
import { Notify } from 'vant'
class WxConfig {
constructor(jsApiList) {
let [redirectUrl] = window.location.href.split('#')
const corpId = util.getLocalStorage('dj_scrm_corpId')
/** 获取企微应用AgentConfig */
let data = {
corpId,
method: 'scrm.api.work.wechat.get.agent.config',
url: redirectUrl,
appCode: 'DJQWZS'
}
window.$HTTP({
url: '/rop-scrm-wechat/router',
data
}).then(res => {
console.log(res)
if (res) {
this.setConfig({
...res.data,
jsApiList
})
} else {
Notify('网络异常')
}
})
}
setConfig(params) {
let obj = {}
Object.keys(params).map(key => {
if (params[key]) obj[key] = params[key]
})
wx.agentConfig(obj)
}
getContext(callBack) {
/**
* entry String 场景值
* shareTicket String 仅当转发时设置了withShareTicket转发到会话的消息进入才返回该字段,详见私密消息
**/
return new Promise((resolve, reject) => {
wx.invoke('getContext', {}, ({ err_msg, entry, shareTicket }) => {
/** entry 说明
*contact_profile 从联系人详情进入 3.0.24
*single_chat_tools 从单聊会话的工具栏进入 3.0.24
*group_chat_tools 从群聊会话的工具栏进入 3.0.24
*chat_attachment 从会话的聊天附件栏进入 3.1.6
*normal 除以上场景之外进入,例如工作台,聊天会话等 3.0.24
**/
if (err_msg == 'getContext:ok') {
//entry 返回进入H5页面的入口类型,目前有normal、contact_profile、single_chat_tools、group_chat_tools、chat_attachment
//shareTicket可用于调用getShareInfo接口
callBack(resolve, {
entry,
shareTicket
})
} else {
callBack(reject)
}
})
})
}
/**获取当前外部联系人userid */
getCurExternalContact() {
return this.getContext((resolve, {
entry,
}) => {
wx.invoke('getCurExternalContact', {}, res => {
if (entry == 'contact_profile' || entry == 'single_chat_tools') {
if (res.err_msg == 'getCurExternalContact:ok') {
resolve(res.userId)
}
} else {
Notify('需有配置客户联系功能权限')
}
})
})
}
/**分享消息到当前会话 */
sendChatMessage(params) {
return this.getContext((resolve, {
entry,
shareTicket
}) => {
wx.invoke('sendChatMessage', params, res => {
if (entry == 'chat_attachment') {
if (res.err_msg == 'sendChatMessage:ok') {
resolve()
}
} else {
Notify('需有配置客户联系功能权限')
}
})
})
}
/**群发消息给客户 */
shareToExternalContact(params) {
return this.getContext(resolve => {
wx.invoke('shareToExternalContact', params, res => {
if (res.err_msg == 'shareToExternalContact:ok') {
resolve()
} else {
Notify('需有配置客户联系功能权限')
}
})
})
}
/**群发消息到客户群 */
shareToExternalChat(params) {
return this.getContext(resolve => {
wx.invoke('shareToExternalChat', params, res => {
if (res.err_msg == 'shareToExternalChat:ok') {
resolve()
} else {
Notify('需有配置客户联系功能权限')
}
})
})
}
/**进入添加客户界面 */
navigateToAddCustomer() {
wx.invoke('navigateToAddCustomer')
}
/**发表内容到客户朋友圈 */
shareToExternalMoments(params) {
return this.getContext(resolve => {
wx.invoke('shareToExternalMoments', params, res => {
if (res.err_msg == 'shareToExternalMoments:ok') {
resolve()
} else {
Notify('需有配置客户联系功能权限')
}
})
})
}
}
export default WxConfig
\ No newline at end of file \ No newline at end of file
...@@ -70,4 +70,8 @@ img { ...@@ -70,4 +70,8 @@ img {
color: #ffffff; color: #ffffff;
margin-left: auto; margin-left: auto;
font-size: 10px; font-size: 10px;
}
.list-box.isFullSucreen {
// height: calc(100vh - 134px) !important;
} }
\ No newline at end of file \ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 200px 170px;} .sprite-icon { background-image: url(../images/sprite.png);background-size: 200px 170px;}
.icon-coupon { width: 80px; height: 80px; background-position: 0px 0px;} .icon-coupon { width: 80px; height: 80px; background-position: 0px 0px;}
.icon-discount { width: 80px; height: 80px; background-position: -90px 0px;} .icon-discount { width: 80px; height: 80px; background-position: -90px 0px;}
.icon-down { width: 12px; height: 12px; background-position: -180px -30px;}
.icon-exchange { width: 80px; height: 80px; background-position: 0px -90px;} .icon-exchange { width: 80px; height: 80px; background-position: 0px -90px;}
.icon-share { width: 20px; height: 20px; background-position: -180px 0px;} .icon-share { width: 20px; height: 20px; background-position: -180px 0px;}
.icon-vip { width: 80px; height: 80px; background-position: -90px -90px;}
.icon-down { width: 12px; height: 12px; background-position: -180px -30px;}
\ No newline at end of file \ No newline at end of file
.icon-vip { width: 80px; height: 80px; background-position: -90px -90px;}
\ No newline at end of file \ No newline at end of file
<template> <template>
<van-list <div :class="['scroll-view', ScrollViewclass]">
v-model="loading" <van-list
:finished="finished" v-model="loading"
finished-text="到底啦!!" :finished="finished"
@load="onLoad" finished-text="到底啦!!"
offset="100" @load="onLoad"
:immediate-check="false" offset="100"
> :immediate-check="false"
<slot></slot> >
</van-list> <slot></slot>
</van-list>
</div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
...@@ -20,10 +22,12 @@ export default { ...@@ -20,10 +22,12 @@ export default {
finished: false, finished: false,
} }
}, },
props: ['ScrollViewclass'],
mounted () { mounted () {
}, },
methods: { methods: {
onLoad () { onLoad () {
console.log('触底')
this.loading = false this.loading = false
this.finished = true this.finished = true
this.$emit('ReachBottom', null) this.$emit('ReachBottom', null)
...@@ -33,4 +37,8 @@ export default { ...@@ -33,4 +37,8 @@ export default {
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.scroll-view {
overflow-y: scroll;
box-sizing: border-box;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<van-tabs <div :class="[{'sticky':sticky}]">
v-model="tabIndex" <van-tabs
color="#5850ff" v-model="tabIndex"
title-inactive-color="#BBB" color="#5850ff"
title-active-color="#2c2c2c" title-inactive-color="#BBB"
@click="click" title-active-color="#2c2c2c"
> @click="click"
<template v-for="(i,index) in data"> >
<van-tab <template v-for="(i,index) in data">
:title="i" <van-tab
:key="index" :title="i"
></van-tab> :key="index"
</template> ></van-tab>
</van-tabs> </template>
</van-tabs>
</div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
...@@ -24,7 +26,8 @@ export default { ...@@ -24,7 +26,8 @@ export default {
default: () => { default: () => {
return [] return []
} }
} },
sticky: Boolean
}, },
data () { data () {
return { return {
...@@ -43,6 +46,11 @@ export default { ...@@ -43,6 +46,11 @@ export default {
</script> </script>
<style lang='scss'> <style lang='scss'>
.sticky {
position: sticky;
top: 0;
z-index: 99;
}
.van-tabs__wrap { .van-tabs__wrap {
height: 50px !important; height: 50px !important;
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
@change="change" @change="change"
v-model="value" v-model="value"
:border="false" :border="false"
:safe-area-inset-bottom="false"
> >
<template v-for="(i,index) in data"> <template v-for="(i,index) in data">
<van-tabbar-item <van-tabbar-item
...@@ -51,5 +52,9 @@ export default { ...@@ -51,5 +52,9 @@ export default {
.van-tabbar-item--active { .van-tabbar-item--active {
color: #5850ff; color: #5850ff;
} }
.van-tabbar-item__icon img {
width: 16px;
height: 16px;
}
} }
</style> </style>
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
}, },
data () { data () {
return { return {
showBox: true showBox: false
} }
}, },
mounted () { mounted () {
......
...@@ -39,19 +39,26 @@ Vue.prototype.to = function(name, params) { ...@@ -39,19 +39,26 @@ Vue.prototype.to = function(name, params) {
Vue.config.productionTip = false Vue.config.productionTip = false
// import VConsole from 'vconsole' import VConsole from 'vconsole'
// const vConsole = new VConsole() const vConsole = new VConsole()
const isMock = true const isMock = true
fetchConfig(!isMock).then(res => { fetchConfig(!isMock).then(res => {
// 从配置服务器获取动态配置 // 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn // 设置 js中可以访问 $cdn
Vue.use(cfg) Vue.use(cfg)
window.$Http = new Http({...res }) window.$baseUrl = res.request.baseURL
window.$HTTP = new Http({...res, alert: components.Notify })
console.log(window.$HTTP)
/**登录过期 重新登录 */
window.reLogin = () => {
console.log(123)
}
window.vm = new Vue({ window.vm = new Vue({
el: '#app', el: '#app',
router, router,
store, store,
render: h => h(App) render: h => h(App)
}) })
store.dispatch('navigation', router)
}) })
\ No newline at end of file \ No newline at end of file
...@@ -12,7 +12,6 @@ import util from '@/utils/util' ...@@ -12,7 +12,6 @@ import util from '@/utils/util'
const state = { const state = {
pageMeta: '', pageMeta: '',
keepAlives: [], keepAlives: [],
next: ''
} }
const mutations = { const mutations = {
SET_PAGE_META(state, meta) { SET_PAGE_META(state, meta) {
...@@ -31,9 +30,6 @@ const mutations = { ...@@ -31,9 +30,6 @@ const mutations = {
return arr return arr
}, []) }, [])
}, },
SET_ROUTER_OBJECT(state, next) {
state.next = next
}
} }
const actions = { const actions = {
...@@ -60,8 +56,79 @@ const actions = { ...@@ -60,8 +56,79 @@ const actions = {
}, },
removeKeep({ commit }, names) { removeKeep({ commit }, names) {
commit('REMOVE_KEEP', names) commit('REMOVE_KEEP', names)
},
login() {
let [redirectUrl] = window.location.href.split('?')
const code = getParams('code')
if (code) {
const corpId = util.getLocalStorage('dj_scrm_corpId')
ssoApi.login({
code,
corpId
}).then(({ code, data, message }) => {
let url = `${window.$baseUrl}/dj-scrm-wx-work-main/#/`
let route = state.lastPath == 'home' ? '' : state.lastPath
state.showWindow = true
if (code == '0') {
if (data.loginList.length) {
if (data.loginList.length > 1) {
util.setLocalStorage('dj_scrm_loginToken', data.loginToken)
util.setLocalStorage('dj_scrm_accountList', data.loginList)
let redirect_uri = encodeURI(`${redirectUrl}${route}`)
window.location.replace(`${url}common/accountList?redirect_uri=${redirect_uri}`)
} else {
let [userInfo] = data.loginList
util.setLocalStorage('dj_scrm_userInfo', userInfo)
util.setLocalStorage('dj_scrm_session_id', userInfo.sessionId)
// 只有一个账号 history.back()
console.log(`${redirectUrl}${route}`)
window.location.replace(`${redirectUrl}${route}`)
}
} else {
/**没有账号 */
window.location.replace(`${url}common/nothing`)
}
} else {
/**账号过期 (暂时没有字段判断是否过期) */
window.vm.showToast(message)
window.location.replace(`${url}common/overdue`)
}
})
} else {
util.showLoading()
let corpId = getParams('corpId') //从链接获取
if (!corpId) corpId = 'ww7ee69c648ae1b7e6'
util.setLocalStorage('dj_scrm_corpId', corpId)
// 'ww657a2d4ae89a4424'
const wxUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize'
window.location.replace(`${wxUrl}?appid=${corpId}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`)
}
},
navigation({ dispatch }) {
util.showLoading()
const sessionId = getParams('sessionId')
const storage_sessionId = util.getLocalStorage('dj_scrm_session_id')
if (sessionId || storage_sessionId) {
state.showWindow = true
util.setLocalStorage('dj_scrm_session_id', sessionId || storage_sessionId)
} else {
dispatch('login')
return
}
state.showWindow = true
} }
} }
const getParams = name => {
let [url, paramsList] = window.location.href.split('?')
if (!paramsList) return name ? null : {}
let param = paramsList.split('&')
let obj = {}
param.map(e => {
let [key, value] = e.split('=')
obj[key] = value
})
return name ? obj[name] : obj
}
export default { export default {
state, state,
mutations, mutations,
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
<tab <tab
:data="['秒杀活动','直播活动']" :data="['秒杀活动','直播活动']"
@change="change" @change="change"
sticky
></tab> ></tab>
<scroll-view class="list-box"> <scroll-view :class="['list-box']">
<template v-for="(i,index) in activityList"> <template v-for="(i,index) in activityList">
<div <div
:key="index" :key="index"
...@@ -104,6 +105,7 @@ export default { ...@@ -104,6 +105,7 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
.list-box { .list-box {
height: calc(100vh - 100px);
.item { .item {
background: #ffffff; background: #ffffff;
border-radius: 4px; border-radius: 4px;
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
<tab <tab
:data="['新车精品礼券','商城优惠券']" :data="['新车精品礼券','商城优惠券']"
@change="change" @change="change"
sticky
></tab> ></tab>
<scroll-view class="list-box "> <scroll-view :class="['list-box']">
<template v-for="(i,index) in couponList"> <template v-for="(i,index) in couponList">
<div <div
:key="index" :key="index"
...@@ -93,6 +94,7 @@ export default { ...@@ -93,6 +94,7 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
.list-box { .list-box {
height: calc(100vh - 100px);
.item { .item {
margin-bottom: 10px; margin-bottom: 10px;
height: 100px; height: 100px;
......
...@@ -5,6 +5,16 @@ ...@@ -5,6 +5,16 @@
:data="tab" :data="tab"
@change="change" @change="change"
/> />
<scroll-view class="list-box">
<template v-for="(i,index) in 10">
<div
:key="index"
class="item"
>
{{i}}
</div>
</template>
</scroll-view>
</div> </div>
</template> </template>
...@@ -30,4 +40,10 @@ export default { ...@@ -30,4 +40,10 @@ export default {
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.list-box {
height: calc(100vh - 100px);
}
.item {
height: 100px;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
<!-- home --> <!-- home -->
<template> <template>
<div class="container"> <div class="container">
<keep-alive v-if="$route.meta.keepAlive"> <template v-if="showWindow">
<router-view :class="{'isTab':$route.meta.isTab}"></router-view> <transition name="fade">
</keep-alive> <keep-alive v-if="$route.meta.keepAlive">
<router-view <router-view></router-view>
v-else </keep-alive>
:class="{'isTab':$route.meta.isTab}" </transition>
></router-view> <transition name="fade">
<template v-if="$route.meta.isTab"> <router-view v-if="!$route.meta.keepAlive"></router-view>
<tab-bar :data="tabList"></tab-bar> </transition>
<template v-if="$route.meta.isTab">
<tab-bar :data="tabList"></tab-bar>
</template>
</template> </template>
</div> </div>
</template> </template>
...@@ -40,7 +43,20 @@ export default { ...@@ -40,7 +43,20 @@ export default {
} }
}, },
computed: {}, watch: {
watchFlag: {
immediate: true,
handler (newval) {
this.showWindow = newval
this.hideLoading()
}
}
},
computed: {
watchFlag () {
return this.$store.state.app.showWindow
}
},
mounted () { mounted () {
}, },
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
<tab <tab
:data="['会员套餐','门店商品']" :data="['会员套餐','门店商品']"
@change="change" @change="change"
sticky
></tab> ></tab>
<scroll-view class="list-box"> <scroll-view :class="['list-box']">
<div :class="[`type-${tabIndex}`]"> <div :class="[`type-${tabIndex}`]">
<template v-for="(i,index) in list"> <template v-for="(i,index) in list">
<div <div
...@@ -68,11 +69,12 @@ ...@@ -68,11 +69,12 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { shopmallApi } from '@/api'
export default { export default {
name: '', name: '',
data () { data () {
return { return {
tabIndex: 0, tabIndex: 1,
list: new Array(11), list: new Array(11),
showShare: false, showShare: false,
options: [ options: [
...@@ -88,6 +90,9 @@ export default { ...@@ -88,6 +90,9 @@ export default {
}, },
activated () { activated () {
console.log('店铺') console.log('店铺')
shopmallApi.getGoodsList({ currentPage: 1 }).then(res => {
console.log(res)
})
}, },
deactivated () { deactivated () {
console.log('离开店铺页') console.log('离开店铺页')
...@@ -105,6 +110,7 @@ export default { ...@@ -105,6 +110,7 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
.list-box { .list-box {
height: calc(100vh - 100px);
.item { .item {
background: #ffffff; background: #ffffff;
border-radius: 4px; border-radius: 4px;
......
...@@ -35,9 +35,10 @@ const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV) ...@@ -35,9 +35,10 @@ const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
// ] // ]
// } // }
// } // }
/**
* 雪碧图插件 /**
*/ * 雪碧图插件
*/
const SpritesmithPlugin = require('webpack-spritesmith') const SpritesmithPlugin = require('webpack-spritesmith')
const spritesmithFunction = data => { const spritesmithFunction = data => {
let { spritesheet, sprites } = data let { spritesheet, sprites } = data
...@@ -49,7 +50,10 @@ const spritesmithFunction = data => { ...@@ -49,7 +50,10 @@ const spritesmithFunction = data => {
return `${shared}\n${perSprite}` return `${shared}\n${perSprite}`
} }
module.exports = { module.exports = {
publicPath: './', // 署应用包时的基本 URL。 vue-router hash 模式使用
publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-main/attachment-activity/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-attachment-activity/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: '/dj-scrm-wx-work-attachment-activity/', // 署应用包时的基本 URL。 vue-router history模式使用 // publicPath: '/dj-scrm-wx-work-attachment-activity/', // 署应用包时的基本 URL。 vue-router history模式使用
outputDir: 'dist', // 生产环境构建文件的目录 outputDir: 'dist', // 生产环境构建文件的目录
assetsDir: 'static', // outputDir的静态资源(js、css、img、fonts)目录 assetsDir: 'static', // outputDir的静态资源(js、css、img、fonts)目录
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!