转移到PC

This commit is contained in:
2022-02-08 13:58:35 +08:00
parent 62a7d349cc
commit d5b8f1b930
13 changed files with 148 additions and 59 deletions
+7
View File
@@ -65,6 +65,13 @@ export default {
computed: {
showTabbar() {
const path = tabbar.map(tab => tab.path);
const { name, query: { temple_id } } = this.$route;
// 等于寺庙功德箱时隐藏底部导航
if(name === 'merit-box' && temple_id !== '1'){
return false
}
return path.includes(this.$route.path);
},
paddingBottom() {
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+58 -9
View File
@@ -1,11 +1,12 @@
let wechatInstance;
function signToWechat(config, readFunction) {
function signToWechat(config, shareConfig) {
if (!wx) {
console.warn('请安装微信网页JS-SDK, url: https://res2.wx.qq.com/open/js/jweixin-1.6.0.js');
}
const defaultConfig = {
...config,
debug: false,
jsApiList: [
'onMenuShareTimeline',
'onMenuShareAppMessage',
@@ -16,15 +17,63 @@ function signToWechat(config, readFunction) {
'updateTimelineShareData'
],
};
return new Promise((resolve) => {
console.log('defaultConfig', defaultConfig);
wx.config(defaultConfig);
wx.ready(function() {
console.warn('wechat sdk config success');
wechatInstance = wx;
resolve(wx);
readFunction && readFunction(wx)
console.log('sign', wx);
wx.config(defaultConfig);
wx.ready(function() {
console.log('wechat sdk config success');
wechatInstance = wx;
wx.onMenuShareAppMessage({
title: shareConfig.title,
desc: shareConfig.desc,
link: shareConfig.link,
imgUrl: shareConfig.imgUrl,
complete: res => {
shareConfig.callback && shareConfig.callback({
key: 'updateAppMessageShareData',
...res
});
}
});
// // 分享朋友圈
wx.onMenuShareTimeline({
title: shareConfig.title,
link: shareConfig.link,
imgUrl: shareConfig.imgUrl,
complete: res => {
shareConfig.callback && shareConfig.callback({
key: 'updateTimelineShareData',
...res
});
}
});
// wx.updateAppMessageShareData({
// title: shareConfig.title,
// desc: shareConfig.desc,
// link: shareConfig.link,
// imgUrl: shareConfig.imgUrl,
// complete: res => {
// shareConfig.callback && shareConfig.callback({
// key: 'updateAppMessageShareData',
// ...res
// });
// }
// });
// // 分享朋友圈
// wx.updateTimelineShareData({
// title: shareConfig.title,
// link: shareConfig.link,
// imgUrl: shareConfig.imgUrl,
// complete: res => {
// shareConfig.callback && shareConfig.callback({
// key: 'updateTimelineShareData',
// ...res
// });
// }
// });
});
}
+2 -1
View File
@@ -112,7 +112,7 @@ export default {
<style lang="scss">
.red-packet{
height: 60vh;
min-height: 60vh;
background: #e85042 url('~@/assets/img/red-packet.jpg') top center no-repeat;
background-size: contain;
overflow: hidden;
@@ -208,6 +208,7 @@ export default {
margin-top: .7rem;
display: flex;
padding: 0 .4rem;
margin-bottom: .5rem;
button{
background: transparent;
margin: 0 .2rem;
+6 -30
View File
@@ -32,42 +32,18 @@ export default {
}
},
methods: {
wechatReady(callback){
getWechatSign(location.href).then(async res => {
await signToWechat(res, function(wx){
console.log('wechat sign success', wx)
callback && callback(wx);
});
wechatReady(shareConfig){
console.log('wechatReady get share config', shareConfig)
getWechatSign(location.href).then(res => {
signToWechat(res, shareConfig);
});
},
shareToWechat(wx, shareConfig){
if(!shareConfig){
return console.error(`wechat share config error: ${shareConfig}`);
}
wx.updateAppMessageShareData({
title: shareConfig.title,
desc: shareConfig.desc,
link: shareConfig.link,
imgUrl: shareConfig.url,
complete: res => {
shareConfig.callback && shareConfig.callback({
key: 'updateAppMessageShareData',
...res
});
}
});
wx.updateTimelineShareData({
title: shareConfig.title,
desc: shareConfig.desc,
link: shareConfig.link,
imgUrl: shareConfig.imgUrl,
complete: res => {
shareConfig.callback && shareConfig.callback({
key: 'updateTimelineShareData',
...res
});
}
});
console.log('share', wx, shareConfig)
},
getHasFullScreen() {
let result = false;
+4 -2
View File
@@ -63,8 +63,10 @@ export default {
async getDynamicDetail(){
const data = await getDynamicDetail(this.$route.query.id);
this.data = data;
this.wechatReady((wx) => {
this.shareToWechat(wx, data.shareConfig)
this.wechatReady({
...data.shareConfig,
link: location.href,
})
},
+6 -7
View File
@@ -5,14 +5,9 @@
<van-nav-bar left-arrow v-if="$route.meta.showNavBar" :title="$route.meta.title" @click-left="$router.back()" :style="{backgroundColor: $route.meta.navBarBackgroundColor}" />
</div>
<swiper class="swiper-container" :options="swiperOption">
<swiper-slide>
<swiper-slide v-for="(picture, index) in data.pictures" :key="index">
<div style="height: 100vw;" class="picture">
<img src="https://img1.baidu.com/it/u=3715184423,1831753068&fm=26&fmt=auto" alt="">
</div>
</swiper-slide>
<swiper-slide>
<div style="height: 100vw;" class="picture">
<img src="https://img1.baidu.com/it/u=3715184423,1831753068&fm=26&fmt=auto" alt="">
<img :src="picture" alt="">
</div>
</swiper-slide>
</swiper>
@@ -272,6 +267,10 @@ export default {
this.priceUnit = Number(priceUnit) * Number(this.data.price)
this.priceUnitId = id;
}
this.wechatReady({
...this.data.shareConfig,
link: location.href
})
},
async getDynamicDataByGoodsId(goods_id){
const res = await getDynamicData(1, 1, goods_id);
+3 -2
View File
@@ -195,8 +195,9 @@ export default {
this.$nextTick(() => {
this.paddingBottom = this.$refs.fixedBottom.getOffsetHeight()
})
this.wechatReady((wx) => {
this.shareToWechat(wx, this.data.shareConfig)
this.wechatReady({
...this.data.shareConfig,
link: location.href
})
},
// 获取感恩功德
+19 -4
View File
@@ -36,7 +36,7 @@
</div>
</div>
<div class="merit-button-group" :style="{bottom: tabHeight + 'px'}">
<button class="merit-button" @click="randVisible = true">随喜功德</button>
<button class="merit-button" @click="openBox">随喜功德</button>
</div>
</div>
<random-money :value.sync="randVisible" @change="onRandNext"></random-money>
@@ -44,7 +44,7 @@
</template>
<script>
import { getMeritBox } from "@/api";
import { getMeritBox, getOrderCompare } from '@/api';
import { swiper, swiperSlide } from 'vue-awesome-swiper';
@@ -55,8 +55,9 @@ export default {
},
inject: ['screenHeight', 'root'],
data(){
const { query } = this.$route;
return {
query: this.$route.query,
query,
width: 0,
randVisible: false,
type_id: 1,
@@ -93,8 +94,14 @@ export default {
this.width = window.innerWidth;
this.containerHeight = this.$refs.swiper.$el.offsetHeight;
this.getMeritBox();
if(this.query.open_box){
this.openBox()
}
},
methods: {
openBox(){
this.randVisible = true
},
onSwiper(swiper){
console.log('on swiper', swiper)
},
@@ -116,11 +123,19 @@ export default {
if(!this.$route.query.temple_id){
history.pushState('', '', location.href + query)
}
this.wechatReady({
title: `${this.info.unit_name} - 在线功德箱 | 已有 ${this.total} 人广种福田`,
desc: '随缘布施,广种福田,喜结善缘',
imgUrl: 'https://temple-h5.oss-cn-hangzhou.aliyuncs.com/uploads/common/merit_box.png',
link: location.href
})
},
onListBy(n, index){
this.type_id = n.id;
this.swiper.slideTo(index, 300, false)
this.getMeritBox();
},
loadMore(){
console.log('加载更多')
+6 -1
View File
@@ -26,7 +26,7 @@ export default {
},
computed: {
src(){
return `https://wdx-temple.oss-cn-hangzhou.aliyuncs.com/uploads/merit/certificate/${this.query.order_id}.jpg`
return `https://temple-h5.oss-cn-hangzhou.aliyuncs.com//uploads/merit/certificate/${this.query.order_id}.jpg`
}
},
methods: {
@@ -34,6 +34,11 @@ export default {
this.$router.push('/user/order')
},
onPayAgain(){
// 功德箱订单再结善缘重新随喜
if(this.query.from === 'meritBox'){
this.$router.replace({ name: 'merit-box', query: { temple_id: this.query.temple_id , open_box: 1}})
return
}
const { goods_type, goods_id, temple_id, spec_ids } = this.query;
this.onPushToGoodsDetail(goods_type, goods_id, temple_id, spec_ids)
}
+1 -1
View File
@@ -3,7 +3,7 @@
<img class="banner" :src="data.picture" alt="">
<div class="authed border-bottom">
<img src="@/assets/img/cert.jpg" alt="">
<span>已通过 <b>寺院联盟</b> 认证,可放心访问</span>
<span>已通过 <b>自在福田</b> 认证,可放心访问</span>
</div>
<div class="auth">
+35 -1
View File
@@ -123,6 +123,8 @@
<span class="iconfont icon-arrow-left"></span>
</p>
</van-popup>
<img src="@/assets/img/gongdexiang.png" class="gongdexiang" @click="openBox"/>
</div>
</template>
@@ -143,6 +145,12 @@ export default {
this.getUserData();
},
methods: {
openBox(){
this.$router.push({
name: 'merit-box',
query: { temple_id : this.query.temple_id, open_box: 1 }
})
},
locationTo(nav) {
// nav.type: 0外部链接,1日行一善商品,2添砖加瓦类商品,3通用商品,4功德箱,5进展动态
if(nav.type === 0){
@@ -160,7 +168,8 @@ export default {
if(nav.type === 4){
this.$router.push({
name: 'merit-box'
name: 'merit-box',
query: { temple_id : nav.temple_id }
})
return
}
@@ -217,6 +226,18 @@ export default {
setTimeout(() => {
document.title = res.temple_data.unit_name;
}, 30)
// this.wechatReady(wx => {
// // const { title, desc, link, imageUrl } = res.shareConfig;
// this.shareToWechat(wx, {
// ...res.shareConfig,
// link: location.href,
// })
// })
this.wechatReady({
...res.shareConfig,
link: location.href,
})
},
onTempleStation(){
this.$router.push({ name: 'user-temple-station'})
@@ -241,6 +262,16 @@ export default {
color: white;
}
.temple-home-page{
padding-bottom: 2rem;
.gongdexiang{
position: fixed;
left: 0;
right: 0;
bottom: 0;
width: 4rem;
margin-left: auto;
margin-right: auto;
}
.merit-scroll-container{
height: 3.39rem;
overflow-x: auto;
@@ -556,6 +587,9 @@ export default {
}
.temple-home-activity {
.buddha-process{
padding: 0
}
.process {
padding: .4rem 0;
+1 -1
View File
File diff suppressed because one or more lines are too long