Commit c8c50add by liwk

commit

1 parent 4457b445
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
to continue.</strong> to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- <script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> --> <script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script> <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 --> <!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %> <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
......
const url = '/rop-scrm-coupon/router' const url = 'http://192.168.3.222:8489/rop-scrm-boutiquecoupon/router'
export default { export default {
/** 获取门店商品列表 */ /** 获取门店商品列表 */
getGoodsList(data) { getGoodsList(data) {
...@@ -9,4 +9,13 @@ export default { ...@@ -9,4 +9,13 @@ export default {
data data
}) })
}, },
/**精品礼券分页查询 */
getBoutiqueCouponList(data) {
data.method = 'scrm.api.boutiquecoupon.wework.coupon.page'
data.pageSize = 10
return window.$HTTP({
url,
data
})
},
} }
\ No newline at end of file \ No newline at end of file
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
* @LastEditTime: 2021-06-17 18:23:27 * @LastEditTime: 2021-06-17 18:23:27
*/ */
import ssoApi from './ssoApi' import ssoApi from './ssoApi'
import couponApi from './couponApi'
import wx_config from './wxConfig' import wx_config from './wxConfig'
import shopmallApi from './shopmallApi' import shopmallApi from './shopmallApi'
export { export {
ssoApi, ssoApi,
couponApi,
wx_config, wx_config,
shopmallApi shopmallApi
} }
\ No newline at end of file \ No newline at end of file
...@@ -9,4 +9,20 @@ export default { ...@@ -9,4 +9,20 @@ export default {
data data
}) })
}, },
/**获取商品海报 */
getGoodsPoster(data) {
data.method = 'scrm.api.shopmall.goods.wework.posterUrl'
return window.$HTTP({
url,
data
})
},
/** 获取商品链接 */
getGoodsLink(data) {
data.method = 'scrm.api.shopmall.goods.wework.url'
return window.$HTTP({
url,
data
})
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -195,12 +195,15 @@ class WxConfig { ...@@ -195,12 +195,15 @@ class WxConfig {
} }
/**获取本地图片接口 */ /**获取本地图片接口 */
getLocalImgData() { getLocalImgData(localId) {
return new Promise((resolve) => { return new Promise((resolve, reject) => {
wx.getLocalImgData({ wx.getLocalImgData({
localId: '', // 图片的localID localId, // 图片的
success(res) { success(res) {
resolve(res) //localData是图片的base64数据,可以用img标签显示 resolve(res) //localData是图片的base64数据,可以用img标签显示
},
fail(err) {
reject(err)
} }
}) })
}) })
...@@ -252,6 +255,20 @@ class WxConfig { ...@@ -252,6 +255,20 @@ class WxConfig {
}) })
} }
/**下载图片接口 */
downloadImage(serverId) {
return new Promise((resolve) => {
wx.downloadImage({
serverId, // 需要下载的图片的服务器端ID,由uploadImage接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success(res) {
resolve(res) // 返回图片下载后的本地ID
}
})
})
}
/**使用企业微信内置地图查看位置接口 */ /**使用企业微信内置地图查看位置接口 */
openLocation(obj) { openLocation(obj) {
/** /**
...@@ -274,7 +291,23 @@ class WxConfig { ...@@ -274,7 +291,23 @@ class WxConfig {
} }
}) })
}) })
}
/**自定义转发到会话 */
shareAppMessage(obj) {
// title: '', // 分享标题
// desc: '', // 分享描述
// link: '', // 分享链接
// imgUrl: '' // 分享封面
return new Promise((resolve) => {
wx.invoke("shareAppMessage", obj,
function(res) {
if (res.err_msg == "shareAppMessage:ok") {
}
}
)
})
} }
} }
......
.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-down { width: 12px; height: 12px; background-position: -180px -60px;}
.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-poster-close { width: 20px; height: 20px; background-position: -180px 0px;}
.icon-share { width: 20px; height: 20px; background-position: -180px -30px;}
.icon-vip { width: 80px; height: 80px; background-position: -90px -90px;} .icon-vip { width: 80px; height: 80px; background-position: -90px -90px;}
\ No newline at end of file \ No newline at end of file

43.6 KB | W: | H:

45.2 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
<template>
<van-overlay
:show="show"
z-index="2003"
>
<div
class="wrapper"
@click.stop
>
<div class="img">
<div
class="sprite-icon icon-poster-close"
@click.prevent="close"
></div>
<van-image
:src="img"
width="100%"
height="100%"
>
<template v-slot:loading>
<van-loading
type="spinner"
size="20"
/>
</template>
</van-image>
</div>
<div class="btns flex">
<div
class="save text-center"
@click.prevent="save"
>保存到相册</div>
<div
class="share text-center"
@click.prevent="share"
>分享</div>
</div>
</div>
</van-overlay>
</template>
<script type='text/ecmascript-6'>
import { shopmallApi } from '@/api'
export default {
name: 'Poster',
props: ['value', 'apiName', 'currentItem'],
data () {
return {
show: false,
img: null
}
},
mounted () {
},
watch: {
'value' (n) {
this.show = n
if (n) {
if (this.apiName == 'shopmallApi') this.getGoodsPoster(this.currentItem.id)
}
},
},
methods: {
close () {
this.show = false
this.$emit('close')
},
save () {
this.showToast('请长按海报保存')
},
share () {
window.$wx.shareAppMessage({
imgUrl: this.img
}).then(res => {
console.log(res)
})
},
getGoodsPoster (id) {
this.img = ''
shopmallApi.getGoodsPoster({ id }).then(res => {
console.log(res)
this.img = res
})
}
}
}
</script>
<style scoped lang='scss'>
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
flex-direction: column;
.img {
width: 254px;
height: 452px;
position: relative;
.icon-poster-close {
position: absolute;
top: -10px;
right: -10px;
z-index: 2;
}
}
.btns {
width: 254px;
justify-content: space-between;
margin-top: 16px;
.text-center {
width: 119px;
height: 32px;
border-radius: 16px;
font-size: 14px;
color: #ffffff;
}
.save {
background: rgba(0, 0, 0, 0.3);
}
.share {
background: #5850ff;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="share">
<van-share-sheet
v-model="showShare"
title="立即分享给好友"
:options="options"
@select="onSelect"
@cancel="cancel"
@click-overlay="cancel"
/>
<poster
:value="showPoster"
@close="showPoster = false"
:apiName="apiName"
:currentItem="currentItem"
/>
</div>
</template>
<script type='text/ecmascript-6'>
import { shopmallApi } from '@/api'
const staticOptions = [
{ name: '企业微信', icon: require('@/assets/images/icon/wx.png'), type: 1 },
{ name: '分享海报', icon: require('@/assets/images/icon/poster.png'), type: 2 },
{ name: '复制链接', icon: require('@/assets/images/icon/copy.png'), type: 3 },
]
export default {
name: 'Share',
props: ['value', 'apiName', 'currentItem'],
data () {
return {
showPoster: false,
showShare: false,
options: [],
}
},
watch: {
value (n) {
this.showShare = n
if (n) {
let options = this.tools.deepClone(staticOptions)
if (this.apiName == 'couponApi') {
options[1].className = 'disabled'
}
this.options = options
}
}
},
mounted () {
},
methods: {
closePoster () {
this.showPoster = false
},
onSelect ({ type, className }) {
switch (type) {
case 1:
break;
case 2:
if (className) return
this.showPoster = true
break;
case 3:
let { currentItem, apiName } = this
if (apiName == 'shopmallApi') {
shopmallApi.getGoodsLink({ id: currentItem.id }).then(data => {
if (data) this.setClipboardData(data)
})
}
break;
}
},
cancel () {
this.$emit('cancel')
}
}
}
</script>
<style lang='scss'>
.van-share-sheet__option.disabled {
opacity: 0.5;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
附:购买套餐后到店赠送餐具一套 附:购买套餐后到店赠送餐具一套
</div> </div>
</div> </div>
</van-action-sheet> </van-action-sheet>
</template> </template>
...@@ -56,14 +57,14 @@ export default { ...@@ -56,14 +57,14 @@ export default {
}, },
data () { data () {
return { return {
showBox: false showBox: false,
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
onCancel () { onCancel () {
this.$emit('cancel', false) this.$emit('cancel')
} }
} }
} }
......
...@@ -39,7 +39,7 @@ Vue.prototype.to = function(name, params) { ...@@ -39,7 +39,7 @@ 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 => {
...@@ -48,14 +48,11 @@ fetchConfig(!isMock).then(res => { ...@@ -48,14 +48,11 @@ fetchConfig(!isMock).then(res => {
Vue.use(cfg) Vue.use(cfg)
window.$fetchConfig = res window.$fetchConfig = res
/**登录过期 重新登录 */ /**登录过期 重新登录 */
window.reLogin = () => { 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
...@@ -47,7 +47,9 @@ import { ...@@ -47,7 +47,9 @@ import {
PullRefresh, PullRefresh,
Picker, Picker,
Dialog, Dialog,
ShareSheet ShareSheet,
Overlay,
loading
} from 'vant' } from 'vant'
export const components = [ export const components = [
Button, Button,
...@@ -87,5 +89,7 @@ export const components = [ ...@@ -87,5 +89,7 @@ export const components = [
PullRefresh, PullRefresh,
Picker, Picker,
Dialog, Dialog,
ShareSheet ShareSheet,
Overlay,
loading
] ]
\ No newline at end of file \ No newline at end of file
...@@ -40,6 +40,13 @@ router.beforeEach((to, from, next) => { ...@@ -40,6 +40,13 @@ router.beforeEach((to, from, next) => {
} else { } else {
store.dispatch('setPageMeta', { title: '活动中心' }) store.dispatch('setPageMeta', { title: '活动中心' })
} }
/* 路由发生变化修改页面背景色 */
document.documentElement.style.backgroundColor = to.meta.backgroundColor || '#fff'
if (to.matched.some(recode => recode.meta.noAuth)) {
store.state.app.showWindow = true
} else {
store.dispatch('navigation')
}
next() next()
}) })
......
...@@ -71,6 +71,5 @@ const getPages = _ => { ...@@ -71,6 +71,5 @@ const getPages = _ => {
}) })
return [router] return [router]
} }
console.log(getPages())
export const keeps = keepAlives export const keeps = keepAlives
export default getPages() export default getPages()
\ No newline at end of file \ No newline at end of file
...@@ -67,7 +67,6 @@ const actions = { ...@@ -67,7 +67,6 @@ const actions = {
code, code,
corpId corpId
}).then(({ code, data, message }) => { }).then(({ code, data, message }) => {
console.log(data, code)
// const { baseURL } = window.$fetchConfig.request // const { baseURL } = window.$fetchConfig.request
const [baseURL] = redirectUrl.split('/dj-scrm-wx-work-main/') const [baseURL] = redirectUrl.split('/dj-scrm-wx-work-main/')
let url = `${baseURL}/dj-scrm-wx-work-main/#/` let url = `${baseURL}/dj-scrm-wx-work-main/#/`
...@@ -79,9 +78,10 @@ const actions = { ...@@ -79,9 +78,10 @@ const actions = {
util.setLocalStorage('dj_scrm_loginToken', data.loginToken) util.setLocalStorage('dj_scrm_loginToken', data.loginToken)
util.setLocalStorage('dj_scrm_accountList', data.loginList) util.setLocalStorage('dj_scrm_accountList', data.loginList)
let redirect_uri = encodeURI(`${redirectUrl}${route}`) let redirect_uri = encodeURI(`${redirectUrl}${route}`)
console.log(data)
//先注释 window.location.replace(`${url}common/accountList?redirect_uri=${redirect_uri}`) //先注释 window.location.replace(`${url}common/accountList?redirect_uri=${redirect_uri}`)
//以下是 本地调试多账号默认第一个 //以下是 本地调试多账号
let [userInfo] = data.loginList let userInfo = data.loginList[1]
let { merchantId, accountName } = userInfo let { merchantId, accountName } = userInfo
let loginAccount = accountName let loginAccount = accountName
ssoApi.selectAccount({ ssoApi.selectAccount({
...@@ -102,19 +102,19 @@ const actions = { ...@@ -102,19 +102,19 @@ const actions = {
let [userInfo] = data.loginList let [userInfo] = data.loginList
util.setLocalStorage('dj_scrm_userInfo', userInfo) util.setLocalStorage('dj_scrm_userInfo', userInfo)
util.setSessionId(userInfo.sessionId) util.setSessionId(userInfo.sessionId)
registerHttp(userInfo.sessionId) dispatch('registerHttp', userInfo.sessionId)
// 只有一个账号 history.back() // 只有一个账号 history.back()
console.log(`${redirectUrl}${route}`) console.log(`${redirectUrl}${route}`)
window.location.replace(`${redirectUrl}${route}`) window.location.replace(`${redirectUrl}${route}`)
} }
} else { } else {
/**没有账号 */ /**没有账号 */
window.location.replace(`${url}common/nothing`) window.location.href = `${url}common/nothing`
} }
} else { } else {
/**账号过期 (暂时没有字段判断是否过期) */ /**账号过期 (暂时没有字段判断是否过期) */
window.vm.showToast(message) Notify(message)
window.location.replace(`${url}common/overdue`) window.location.href = `${url}common/overdue`
} }
}) })
} else { } else {
...@@ -136,17 +136,17 @@ const actions = { ...@@ -136,17 +136,17 @@ const actions = {
if (sessionId || storage_sessionId) { if (sessionId || storage_sessionId) {
state.showWindow = true state.showWindow = true
util.setSessionId(sessionId || storage_sessionId) util.setSessionId(sessionId || storage_sessionId)
registerHttp(sessionId || storage_sessionId) dispatch('registerHttp', sessionId || storage_sessionId)
} else { } else {
registerHttp() dispatch('registerHttp')
dispatch('login') dispatch('login')
return return
} }
state.showWindow = true state.showWindow = true
} },
} registerHttp({}, sessionId = '') {
const 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 => {
let [url, paramsList] = window.location.href.split('?') let [url, paramsList] = window.location.href.split('?')
......
...@@ -37,11 +37,11 @@ ...@@ -37,11 +37,11 @@
</div> </div>
</template> </template>
</scroll-view> </scroll-view>
<van-share-sheet <share
v-model="showShare" :value="showShare"
title="立即分享给好友" apiName="couponApi"
:options="options" @cancel="showShare = false"
@select="onSelect" :currentItem="currentItem"
/> />
</template> </template>
<template v-else> <template v-else>
...@@ -51,8 +51,7 @@ ...@@ -51,8 +51,7 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { wx_config } from '@/api' import { wx_config, couponApi } from '@/api'
const WX = new wx_config(['shareToExternalContact'])
export default { export default {
name: '', name: '',
data () { data () {
...@@ -61,10 +60,7 @@ export default { ...@@ -61,10 +60,7 @@ export default {
couponList: new Array(10), couponList: new Array(10),
tabIndex: 0, tabIndex: 0,
showShare: false, showShare: false,
options: [ currentItem: null
{ name: '企业微信', icon: 'wechat', type: 1 },
{ name: '复制链接', icon: 'weibo', type: 2 },
]
} }
}, },
activated () { activated () {
...@@ -77,14 +73,21 @@ export default { ...@@ -77,14 +73,21 @@ export default {
console.log('离开卡券页') console.log('离开卡券页')
}, },
mounted () { mounted () {
// window.$wx = new wx_config(['shareToExternalContact', 'sendChatMessage'])
this.getBoutiqueCouponList()
}, },
methods: { methods: {
getBoutiqueCouponList () {
couponApi.getBoutiqueCouponList({ currentPage: 1 }).then(res => {
console.log(res)
})
},
jump () { jump () {
window.$back = true window.$back = true
}, },
change (index) { change (index) {
this.tabIndex = index this.tabIndex = index
WX.shareToExternalContact().then(res => { this.WX.shareToExternalContact().then(res => {
console.log(res) console.log(res)
}) })
}, },
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
></tab> ></tab>
<scroll-view :class="['list-box']"> <scroll-view :class="['list-box']">
<div :class="[`type-${tabIndex}`]"> <div :class="[`type-${tabIndex}`]">
<template v-if="flag">
<template v-for="(i,index) in list"> <template v-for="(i,index) in list">
<div <div
:key="index" :key="index"
...@@ -37,30 +38,31 @@ ...@@ -37,30 +38,31 @@
</template> </template>
<template v-else> <template v-else>
<div class="icon"> <div class="icon">
<img src="@/assets/images/test.jpg"> <img :src="i.goodsImage || ''">
</div> </div>
<div class="info"> <div class="info">
<div class="name text-two-line">2020款 xDrive4Oi湿湿碎手机还是抗裂砂浆 领先型豪华套装(进口)</div> <div class="name text-two-line">{{i.goodsName}}</div>
<div class="price">¥399</div> <div class="price">¥{{i.price.toFixed(2)}}</div>
</div> </div>
<div <div
class="sprite-icon icon-share" class="sprite-icon icon-share"
@click="showShare = true" @click="showShareModel(i)"
></div> ></div>
</template> </template>
</div> </div>
</template> </template>
</template>
</div> </div>
</scroll-view> </scroll-view>
<van-share-sheet <share
v-model="showShare" :value="showShare"
title="立即分享给好友" :apiName="tabIndex == 0 ?'':'shopmallApi'"
:options="options" @cancel="showShare = false"
@select="onSelect" :currentItem="currentItem"
/> />
<vip-dialog <vip-dialog
v-model="showVip" v-model="showVip"
@cancel="showVip = $event" @cancel="showVip = false"
></vip-dialog> ></vip-dialog>
</template> </template>
<template v-else> <template v-else>
...@@ -70,41 +72,46 @@ ...@@ -70,41 +72,46 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { shopmallApi } from '@/api' import { shopmallApi, wx_config } from '@/api'
export default { export default {
name: '', name: '',
data () { data () {
return { return {
tabIndex: 1, tabIndex: 1,
list: new Array(11), list: new Array(11),
showVip: false,
flag: false,
showShare: false, showShare: false,
options: [ currentItem: {}
{ name: '企业微信', icon: 'wechat', type: 1 },
{ name: '分享海报', icon: 'wechat', type: 2 },
{ name: '复制链接', icon: 'weibo', type: 3 },
],
showVip: false
} }
}, },
mounted () { mounted () {
window.$wx = new wx_config(['shareToExternalContact', 'sendChatMessage', 'shareAppMessage'])
this.getGoodsList()
}, },
activated () { activated () {
console.log('店铺') console.log('店铺')
shopmallApi.getGoodsList({ currentPage: 1 }).then(res => {
console.log(res)
})
}, },
deactivated () { deactivated () {
console.log('离开店铺页') console.log('离开店铺页')
}, },
methods: { methods: {
getGoodsList () {
shopmallApi.getGoodsList({ currentPage: 1 }).then(({ total, list }) => {
this.list = list
this.flag = true
})
},
change (index) { change (index) {
this.tabIndex = index this.tabIndex = index
this.list = []
index == 1 ? this.getGoodsList() : ''
}, },
onSelect (e) { showShareModel (i) {
console.log(e) this.showShare = true
this.currentItem = i
} }
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!