123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <div style="height: 100%;">
- <!-- <diy ref="diy" v-if="isDiy"></diy>
- <visualization v-else></visualization> -->
- <index></index>
- </div>
- </template>
- <script>
- // import diy from './diy'
- // import visualization from './visualization'
- import index from './newindex/index.vue';
- import Cache from '@/utils/cache';
- import {
- getShare
- } from "@/api/public.js";
- let app = getApp();
- export default {
- data() {
- return {
- isDiy: uni.getStorageSync('is_diy'),
- shareInfo: {}
- }
- },
- components: {
- index
- // diy,
- // visualization
- },
- onShow() {
- uni.hideTabBar()
- // uni.$on('is_diy', (data) => {
- // this.isDiy = data
- // })
- this.setOpenShare();
- },
- onHide() {
- // this.isDiy = -1
- },
- methods: {
- // 微信分享;
- setOpenShare: function() {
- let that = this;
- getShare().then((res) => {
- let data = res.data;
- this.shareInfo = data;
- // #ifdef H5
- let url = location.href;
- if (this.$store.state.app.uid) {
- url =
- url.indexOf("?") === -1 ?
- url + "?spread=" + this.$store.state.app.uid :
- url + "&spread=" + this.$store.state.app.uid;
- }
- if (that.$wechat.isWeixin()) {
- let configAppMessage = {
- desc: data.synopsis,
- title: data.title,
- link: url,
- imgUrl: data.img,
- };
- that.$wechat.wechatEvevt(
- ["updateAppMessageShareData", "updateTimelineShareData"],
- configAppMessage
- );
- }
- // #endif
- });
- },
- },
- onReachBottom: function() {
- if (this.isDiy) {
- this.$refs.diy.onsollBotton()
- }
- },
- // 滚动监听
- onPageScroll(e) {
- // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
- uni.$emit('scroll');
- },
- // #ifdef MP
- //发送给朋友
- onShareAppMessage(res) {
- // 此处的distSource为分享者的部分信息,需要传递给其他人
- let that = this;
- return {
- title: this.shareInfo.title,
- path: "/pages/index/index?spid=" + this.$store.state.app.uid || 0,
- imageUrl: this.shareInfo.img,
- };
- },
- //分享到朋友圈
- onShareTimeline() {
- return {
- title: this.shareInfo.title,
- query: {
- spid: this.$store.state.app.uid || 0
- },
- imageUrl: this.shareInfo.img,
- };
- },
- // #endif
- }
- </script>
- <style>
- </style>
|