Commit c8c50add by liwk

commit

1 parent 4457b445
......@@ -18,7 +18,7 @@
to continue.</strong>
</noscript>
<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>
<!-- 使用CDN加速的JS文件,配置在vue.config.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 {
/** 获取门店商品列表 */
getGoodsList(data) {
......@@ -9,4 +9,13 @@ export default {
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
......@@ -7,10 +7,12 @@
* @LastEditTime: 2021-06-17 18:23:27
*/
import ssoApi from './ssoApi'
import couponApi from './couponApi'
import wx_config from './wxConfig'
import shopmallApi from './shopmallApi'
export {
ssoApi,
couponApi,
wx_config,
shopmallApi
}
\ No newline at end of file
......@@ -9,4 +9,20 @@ export default {
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
......@@ -195,12 +195,15 @@ class WxConfig {
}
/**获取本地图片接口 */
getLocalImgData() {
return new Promise((resolve) => {
getLocalImgData(localId) {
return new Promise((resolve, reject) => {
wx.getLocalImgData({
localId: '', // 图片的localID
localId, // 图片的
success(res) {
resolve(res) //localData是图片的base64数据,可以用img标签显示
},
fail(err) {
reject(err)
}
})
})
......@@ -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) {
/**
......@@ -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;}
.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-down { width: 12px; height: 12px; background-position: -180px -60px;}
.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;}
\ 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
<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
......@@ -34,6 +34,7 @@
附:购买套餐后到店赠送餐具一套
</div>
</div>
</van-action-sheet>
</template>
......@@ -56,14 +57,14 @@ export default {
},
data () {
return {
showBox: false
showBox: false,
}
},
mounted () {
},
methods: {
onCancel () {
this.$emit('cancel', false)
this.$emit('cancel')
}
}
}
......
......@@ -39,7 +39,7 @@ Vue.prototype.to = function(name, params) {
Vue.config.productionTip = false
import VConsole from 'vconsole'
// const vConsole = new VConsole()
const vConsole = new VConsole()
const isMock = true
fetchConfig(!isMock).then(res => {
......@@ -48,14 +48,11 @@ fetchConfig(!isMock).then(res => {
Vue.use(cfg)
window.$fetchConfig = res
/**登录过期 重新登录 */
window.reLogin = () => {
console.log(123)
}
window.reLogin = () => {}
window.vm = new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
store.dispatch('navigation', router)
})
\ No newline at end of file
......@@ -47,7 +47,9 @@ import {
PullRefresh,
Picker,
Dialog,
ShareSheet
ShareSheet,
Overlay,
loading
} from 'vant'
export const components = [
Button,
......@@ -87,5 +89,7 @@ export const components = [
PullRefresh,
Picker,
Dialog,
ShareSheet
ShareSheet,
Overlay,
loading
]
\ No newline at end of file
......@@ -40,6 +40,13 @@ router.beforeEach((to, from, next) => {
} else {
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()
})
......
......@@ -71,6 +71,5 @@ const getPages = _ => {
})
return [router]
}
console.log(getPages())
export const keeps = keepAlives
export default getPages()
\ No newline at end of file
......@@ -67,8 +67,7 @@ const actions = {
code,
corpId
}).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/')
let url = `${baseURL}/dj-scrm-wx-work-main/#/`
let route = state.lastPath == 'home' ? '' : state.lastPath || ''
......@@ -79,9 +78,10 @@ const actions = {
util.setLocalStorage('dj_scrm_loginToken', data.loginToken)
util.setLocalStorage('dj_scrm_accountList', data.loginList)
let redirect_uri = encodeURI(`${redirectUrl}${route}`)
console.log(data)
//先注释 window.location.replace(`${url}common/accountList?redirect_uri=${redirect_uri}`)
//以下是 本地调试多账号默认第一个
let [userInfo] = data.loginList
//以下是 本地调试多账号
let userInfo = data.loginList[1]
let { merchantId, accountName } = userInfo
let loginAccount = accountName
ssoApi.selectAccount({
......@@ -102,19 +102,19 @@ const actions = {
let [userInfo] = data.loginList
util.setLocalStorage('dj_scrm_userInfo', userInfo)
util.setSessionId(userInfo.sessionId)
registerHttp(userInfo.sessionId)
dispatch('registerHttp', userInfo.sessionId)
// 只有一个账号 history.back()
console.log(`${redirectUrl}${route}`)
window.location.replace(`${redirectUrl}${route}`)
}
} else {
/**没有账号 */
window.location.replace(`${url}common/nothing`)
window.location.href = `${url}common/nothing`
}
} else {
/**账号过期 (暂时没有字段判断是否过期) */
window.vm.showToast(message)
window.location.replace(`${url}common/overdue`)
Notify(message)
window.location.href = `${url}common/overdue`
}
})
} else {
......@@ -136,18 +136,18 @@ const actions = {
if (sessionId || storage_sessionId) {
state.showWindow = true
util.setSessionId(sessionId || storage_sessionId)
registerHttp(sessionId || storage_sessionId)
dispatch('registerHttp', sessionId || storage_sessionId)
} else {
registerHttp()
dispatch('registerHttp')
dispatch('login')
return
}
state.showWindow = true
},
registerHttp({}, sessionId = '') {
window.$HTTP = new Http({...window.$fetchConfig, alert: Notify, headers: { token: sessionId } })
}
}
const registerHttp = (sessionId = '') => {
window.$HTTP = new Http({...window.$fetchConfig, alert: Notify, headers: { token: sessionId } })
}
const getParams = name => {
let [url, paramsList] = window.location.href.split('?')
if (!paramsList) return name ? null : {}
......
......@@ -37,11 +37,11 @@
</div>
</template>
</scroll-view>
<van-share-sheet
v-model="showShare"
title="立即分享给好友"
:options="options"
@select="onSelect"
<share
:value="showShare"
apiName="couponApi"
@cancel="showShare = false"
:currentItem="currentItem"
/>
</template>
<template v-else>
......@@ -51,8 +51,7 @@
</template>
<script type='text/ecmascript-6'>
import { wx_config } from '@/api'
const WX = new wx_config(['shareToExternalContact'])
import { wx_config, couponApi } from '@/api'
export default {
name: '',
data () {
......@@ -61,10 +60,7 @@ export default {
couponList: new Array(10),
tabIndex: 0,
showShare: false,
options: [
{ name: '企业微信', icon: 'wechat', type: 1 },
{ name: '复制链接', icon: 'weibo', type: 2 },
]
currentItem: null
}
},
activated () {
......@@ -77,14 +73,21 @@ export default {
console.log('离开卡券页')
},
mounted () {
// window.$wx = new wx_config(['shareToExternalContact', 'sendChatMessage'])
this.getBoutiqueCouponList()
},
methods: {
getBoutiqueCouponList () {
couponApi.getBoutiqueCouponList({ currentPage: 1 }).then(res => {
console.log(res)
})
},
jump () {
window.$back = true
},
change (index) {
this.tabIndex = index
WX.shareToExternalContact().then(res => {
this.WX.shareToExternalContact().then(res => {
console.log(res)
})
},
......
......@@ -9,58 +9,60 @@
></tab>
<scroll-view :class="['list-box']">
<div :class="[`type-${tabIndex}`]">
<template v-for="(i,index) in list">
<div
:key="index"
class="item"
>
<template v-if="tabIndex == 0">
<div class="sprite-icon icon-vip">
<template v-if="flag">
<template v-for="(i,index) in list">
<div
:key="index"
class="item"
>
<template v-if="tabIndex == 0">
<div class="sprite-icon icon-vip">
</div>
<div class="info">
<div>
<div class="title text-hide">高级会员套餐</div>
<div class="decoration">价值99,999元的100项权益</div>
</div>
<div class="info">
<div>
<div class="title text-hide">高级会员套餐</div>
<div class="decoration">价值99,999元的100项权益</div>
</div>
<div
class="btn text-center"
@click="showVip = true"
>
查看套餐
</div>
</div>
<div
class="btn text-center"
@click="showVip = true"
>
查看套餐
class="btn text-center y-center"
@click="showShare = true"
>分享给客户</div>
</template>
<template v-else>
<div class="icon">
<img :src="i.goodsImage || ''">
</div>
<div class="info">
<div class="name text-two-line">{{i.goodsName}}</div>
<div class="price">¥{{i.price.toFixed(2)}}</div>
</div>
</div>
<div
class="btn text-center y-center"
@click="showShare = true"
>分享给客户</div>
</template>
<template v-else>
<div class="icon">
<img src="@/assets/images/test.jpg">
</div>
<div class="info">
<div class="name text-two-line">2020款 xDrive4Oi湿湿碎手机还是抗裂砂浆 领先型豪华套装(进口)</div>
<div class="price">¥399</div>
</div>
<div
class="sprite-icon icon-share"
@click="showShare = true"
></div>
</template>
</div>
<div
class="sprite-icon icon-share"
@click="showShareModel(i)"
></div>
</template>
</div>
</template>
</template>
</div>
</scroll-view>
<van-share-sheet
v-model="showShare"
title="立即分享给好友"
:options="options"
@select="onSelect"
<share
:value="showShare"
:apiName="tabIndex == 0 ?'':'shopmallApi'"
@cancel="showShare = false"
:currentItem="currentItem"
/>
<vip-dialog
v-model="showVip"
@cancel="showVip = $event"
@cancel="showVip = false"
></vip-dialog>
</template>
<template v-else>
......@@ -70,41 +72,46 @@
</template>
<script type='text/ecmascript-6'>
import { shopmallApi } from '@/api'
import { shopmallApi, wx_config } from '@/api'
export default {
name: '',
data () {
return {
tabIndex: 1,
list: new Array(11),
showVip: false,
flag: false,
showShare: false,
options: [
{ name: '企业微信', icon: 'wechat', type: 1 },
{ name: '分享海报', icon: 'wechat', type: 2 },
{ name: '复制链接', icon: 'weibo', type: 3 },
],
showVip: false
currentItem: {}
}
},
mounted () {
window.$wx = new wx_config(['shareToExternalContact', 'sendChatMessage', 'shareAppMessage'])
this.getGoodsList()
},
activated () {
console.log('店铺')
shopmallApi.getGoodsList({ currentPage: 1 }).then(res => {
console.log(res)
})
},
deactivated () {
console.log('离开店铺页')
},
methods: {
getGoodsList () {
shopmallApi.getGoodsList({ currentPage: 1 }).then(({ total, list }) => {
this.list = list
this.flag = true
})
},
change (index) {
this.tabIndex = index
this.list = []
index == 1 ? this.getGoodsList() : ''
},
onSelect (e) {
console.log(e)
showShareModel (i) {
this.showShare = true
this.currentItem = i
}
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!