Commit e7de3d1e by liwk

commit

1 parent 529e5b6d
......@@ -15,7 +15,7 @@
"autoprefixer": "^8.0.0",
"core-js": "^3.6.4",
"dayjs": "^1.10.5",
"glsx-common": "^1.4.7",
"glsx-common": "^1.4.8",
"lib-flexible": "^0.3.2",
"postcss-loader": "^6.2.0",
"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
......@@ -7,6 +7,10 @@
* @LastEditTime: 2021-06-17 18:23:27
*/
import ssoApi from './ssoApi'
import wxConfig from './wxConfig'
import shopmallApi from './shopmallApi'
export {
ssoApi,
wxConfig,
shopmallApi
}
\ 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
const url = '/rop-scrm-sso/router'
const returnAll = true
export default {
/**OAuth2授权登陆 */
login(data) {
data.returnAll = true
data.method = 'scrm.api.sso.ww.oauth.login'
return window.$HTTP({ data })
return window.$HTTP({
url,
data,
returnAll
})
},
/** 选择登录账号 */
selectAccount(data) {
data.returnAll = true
data.method = 'scrm.api.sso.user.login.select'
return window.$HTTP({ data })
return window.$HTTP({
url,
data,
returnAll
})
}
}
\ 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
......@@ -70,4 +70,8 @@ img {
color: #ffffff;
margin-left: auto;
font-size: 10px;
}
.list-box.isFullSucreen {
// height: calc(100vh - 134px) !important;
}
\ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 200px 170px;}
.icon-coupon { width: 80px; height: 80px; background-position: 0px 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-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
.icon-vip { width: 80px; height: 80px; background-position: -90px -90px;}
\ No newline at end of file
<template>
<van-list
v-model="loading"
:finished="finished"
finished-text="到底啦!!"
@load="onLoad"
offset="100"
:immediate-check="false"
>
<slot></slot>
</van-list>
<div :class="['scroll-view', ScrollViewclass]">
<van-list
v-model="loading"
:finished="finished"
finished-text="到底啦!!"
@load="onLoad"
offset="100"
:immediate-check="false"
>
<slot></slot>
</van-list>
</div>
</template>
<script type='text/ecmascript-6'>
......@@ -20,10 +22,12 @@ export default {
finished: false,
}
},
props: ['ScrollViewclass'],
mounted () {
},
methods: {
onLoad () {
console.log('触底')
this.loading = false
this.finished = true
this.$emit('ReachBottom', null)
......@@ -33,4 +37,8 @@ export default {
</script>
<style scoped lang='scss'>
.scroll-view {
overflow-y: scroll;
box-sizing: border-box;
}
</style>
\ No newline at end of file
<template>
<van-tabs
v-model="tabIndex"
color="#5850ff"
title-inactive-color="#BBB"
title-active-color="#2c2c2c"
@click="click"
>
<template v-for="(i,index) in data">
<van-tab
:title="i"
:key="index"
></van-tab>
</template>
</van-tabs>
<div :class="[{'sticky':sticky}]">
<van-tabs
v-model="tabIndex"
color="#5850ff"
title-inactive-color="#BBB"
title-active-color="#2c2c2c"
@click="click"
>
<template v-for="(i,index) in data">
<van-tab
:title="i"
:key="index"
></van-tab>
</template>
</van-tabs>
</div>
</template>
<script type='text/ecmascript-6'>
......@@ -24,7 +26,8 @@ export default {
default: () => {
return []
}
}
},
sticky: Boolean
},
data () {
return {
......@@ -43,6 +46,11 @@ export default {
</script>
<style lang='scss'>
.sticky {
position: sticky;
top: 0;
z-index: 99;
}
.van-tabs__wrap {
height: 50px !important;
}
......
......@@ -4,6 +4,7 @@
@change="change"
v-model="value"
:border="false"
:safe-area-inset-bottom="false"
>
<template v-for="(i,index) in data">
<van-tabbar-item
......@@ -51,5 +52,9 @@ export default {
.van-tabbar-item--active {
color: #5850ff;
}
.van-tabbar-item__icon img {
width: 16px;
height: 16px;
}
}
</style>
......@@ -56,7 +56,7 @@ export default {
},
data () {
return {
showBox: true
showBox: false
}
},
mounted () {
......
......@@ -39,19 +39,26 @@ Vue.prototype.to = function(name, params) {
Vue.config.productionTip = false
// import VConsole from 'vconsole'
// const vConsole = new VConsole()
import VConsole from 'vconsole'
const vConsole = new VConsole()
const isMock = true
fetchConfig(!isMock).then(res => {
// 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn
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({
el: '#app',
router,
store,
render: h => h(App)
})
store.dispatch('navigation', router)
})
\ No newline at end of file
......@@ -12,7 +12,6 @@ import util from '@/utils/util'
const state = {
pageMeta: '',
keepAlives: [],
next: ''
}
const mutations = {
SET_PAGE_META(state, meta) {
......@@ -31,9 +30,6 @@ const mutations = {
return arr
}, [])
},
SET_ROUTER_OBJECT(state, next) {
state.next = next
}
}
const actions = {
......@@ -60,8 +56,79 @@ const actions = {
},
removeKeep({ commit }, 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 {
state,
mutations,
......
......@@ -4,8 +4,9 @@
<tab
:data="['秒杀活动','直播活动']"
@change="change"
sticky
></tab>
<scroll-view class="list-box">
<scroll-view :class="['list-box']">
<template v-for="(i,index) in activityList">
<div
:key="index"
......@@ -104,6 +105,7 @@ export default {
<style scoped lang='scss'>
.list-box {
height: calc(100vh - 100px);
.item {
background: #ffffff;
border-radius: 4px;
......
......@@ -4,8 +4,9 @@
<tab
:data="['新车精品礼券','商城优惠券']"
@change="change"
sticky
></tab>
<scroll-view class="list-box ">
<scroll-view :class="['list-box']">
<template v-for="(i,index) in couponList">
<div
:key="index"
......@@ -93,6 +94,7 @@ export default {
<style scoped lang='scss'>
.list-box {
height: calc(100vh - 100px);
.item {
margin-bottom: 10px;
height: 100px;
......
......@@ -5,6 +5,16 @@
:data="tab"
@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>
</template>
......@@ -30,4 +40,10 @@ export default {
</script>
<style scoped lang='scss'>
.list-box {
height: calc(100vh - 100px);
}
.item {
height: 100px;
}
</style>
\ No newline at end of file
<!-- home -->
<template>
<div class="container">
<keep-alive v-if="$route.meta.keepAlive">
<router-view :class="{'isTab':$route.meta.isTab}"></router-view>
</keep-alive>
<router-view
v-else
:class="{'isTab':$route.meta.isTab}"
></router-view>
<template v-if="$route.meta.isTab">
<tab-bar :data="tabList"></tab-bar>
<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>
......@@ -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 () {
},
......
......@@ -4,8 +4,9 @@
<tab
:data="['会员套餐','门店商品']"
@change="change"
sticky
></tab>
<scroll-view class="list-box">
<scroll-view :class="['list-box']">
<div :class="[`type-${tabIndex}`]">
<template v-for="(i,index) in list">
<div
......@@ -68,11 +69,12 @@
</template>
<script type='text/ecmascript-6'>
import { shopmallApi } from '@/api'
export default {
name: '',
data () {
return {
tabIndex: 0,
tabIndex: 1,
list: new Array(11),
showShare: false,
options: [
......@@ -88,6 +90,9 @@ export default {
},
activated () {
console.log('店铺')
shopmallApi.getGoodsList({ currentPage: 1 }).then(res => {
console.log(res)
})
},
deactivated () {
console.log('离开店铺页')
......@@ -105,6 +110,7 @@ export default {
<style scoped lang='scss'>
.list-box {
height: calc(100vh - 100px);
.item {
background: #ffffff;
border-radius: 4px;
......
......@@ -35,9 +35,10 @@ const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
// ]
// }
// }
/**
* 雪碧图插件
*/
/**
* 雪碧图插件
*/
const SpritesmithPlugin = require('webpack-spritesmith')
const spritesmithFunction = data => {
let { spritesheet, sprites } = data
......@@ -49,7 +50,10 @@ const spritesmithFunction = data => {
return `${shared}\n${perSprite}`
}
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模式使用
outputDir: 'dist', // 生产环境构建文件的目录
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!