Commit 76add0e0 by 程智春

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents b699bef8 2de08701
const app = getApp() const app = getApp();
console.log(app, 'apppppppppp') console.log(app, "apppppppppp");
Component({ Component({
pageLifetimes: { pageLifetimes: {
show() { show() {
console.log('哈哈哈哈') console.log("哈哈哈哈");
if (typeof this.getTabBar === 'function' && if (typeof this.getTabBar === "function" && this.getTabBar()) {
this.getTabBar()) {
this.getTabBar().setData({ this.getTabBar().setData({
selected: 1 selected: 1
}) });
} }
} }
}, },
...@@ -17,106 +16,108 @@ Component({ ...@@ -17,106 +16,108 @@ Component({
selected: 0, selected: 0,
color: "#7A7E83", color: "#7A7E83",
selectedColor: "#3cc51f", selectedColor: "#3cc51f",
list: [{ list: [
pagePath: "/pages/home/main", {
iconPath: "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png", pagePath: "/pages/home/main",
selectedIconPath: "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png", iconPath:
text: "组件", "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
selectedIconPath:
"https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
text: "组件",
//--多主题 //--多主题
condition: "", condition: "",
icon: "ant-daishouhuo", icon: "ant-daishouhuo",
iconType: 1, //0 iconfont 1 image iconType: 1, //0 iconfont 1 image
imgUrl: "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png", imgUrl:
selectImgUrl: "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png", "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
link: { selectImgUrl:
key: "1.1.1.7", "https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
link: "/personalCenter/spokesmanCenter?distributionModel=1", link: {
name: "分销商中心", key: "1.1.1.7",
type: 1 link: "/personalCenter/spokesmanCenter?distributionModel=1",
name: "分销商中心",
type: 1
},
show: true,
title: "分类页",
version: "1.0.0",
visible: 1
}, },
show: true, {
title: "分类页", pagePath: "/pages/index/main",
version: "1.0.0", iconPath: "/static/images/bofang.png",
visible: 1 selectedIconPath: "/static/images/bofang.png",
}, { text: "接口",
pagePath: "/pages/index/main",
iconPath: "/static/images/bofang.png",
selectedIconPath: "/static/images/bofang.png",
text: "接口",
//--多主题 //--多主题
condition: "", condition: "",
icon: "ant-daishouhuo", icon: "ant-daishouhuo",
iconType: 0, //0 iconfont 1 image iconType: 0, //0 iconfont 1 image
imgUrl: "", imgUrl: "",
selectImgUrl: "", selectImgUrl: "",
link: {}, link: {},
show: true, show: true,
title: "分类页", title: "分类页",
version: "1.0.0", version: "1.0.0",
visible: 1 visible: 1
}], }
componentData: {} ],
componentData: {},
show: true
}, },
attached() { attached() {
let that = this let that = this;
if (app.globalData.footerVal) { if (app.globalData.footerVal) {
that.setData({ that.setData({
componentData: app.globalData.footerVal.componentData, componentData: app.globalData.footerVal.componentData,
list: app.globalData.footerVal.componentData.list list: app.globalData.footerVal.componentData.list
}) });
} else { } else {
app.footerCallBack = function (params) { app.footerCallBack = function(params) {
that.setData({ that.setData({
componentData: params.componentData, componentData: params.componentData,
list: params.componentData.list list: params.componentData.list
}) });
} };
} }
// ----------webview 变化 // ----------webview 变化
console.log('启动1111',this.getTabBar()) console.log("启动1111", this.getTabBar());
app.webviewCallBack = function (state,params) { app.webviewCallBack = function(state, params) {
console.log('webview变化',state,params) console.log("webview变化", state, params);
} };
}, },
methods: { methods: {
init() { init() {},
},
switchTab(e) { switchTab(e) {
const { const { index } = e.currentTarget.dataset;
index console.log("755555555", this.data.list[index].link);
} = e.currentTarget.dataset
console.log('755555555', this.data.list[index].link)
app.$themeToLink(this.data.list[index]['link'],1) app.$themeToLink(this.data.list[index]["link"], 1);
// this.toPage(this.data.list[index].link,index) // this.toPage(this.data.list[index].link,index)
// this.setData({ // this.setData({
// selected: index // selected: index
// }) // })
}, },
toPage(data,index){ toPage(data, index) {
console.log('index98',index,this) console.log("index98", index, this);
// index=index==0?index+1:index // index=index==0?index+1:index
// 跳转 // 跳转
if (data.link=='/') { if (data.link == "/") {
wx.switchTab({ wx.switchTab({
url: '/pages/home/main', url: "/pages/home/main"
}) });
}else{ } else {
wx.switchTab({ wx.switchTab({
url: `/pages/tabBar${index}/main`, url: `/pages/tabBar${index}/main`
}) });
// ?from=tabbar&backpath=${ // ?from=tabbar&backpath=${
// data.link // data.link
// } // }
} }
} }
} }
}) });
<!--miniprogram/custom-tab-bar/index.wxml--> <!--miniprogram/custom-tab-bar/index.wxml-->
<cover-view class="tab-bar"> <cover-view class="tab-bar" wx:if="{{show}}">
<cover-view class="antt ant-daipinglun"></cover-view> <cover-view class="antt ant-daipinglun"></cover-view>
<cover-view class="iconfont icon-fenzhi">3</cover-view> <cover-view class="iconfont icon-fenzhi">3</cover-view>
<cover-view class="tab-bar-border"></cover-view> <cover-view class="tab-bar-border"></cover-view>
<cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.link}}" data-index="{{index}}" <cover-view
bindtap="switchTab"> wx:for="{{list}}"
wx:key="index"
class="tab-bar-item"
data-path="{{item.link}}"
data-index="{{index}}"
bindtap="switchTab"
>
<cover-view wx:if="{{item.iconType==0||!item.iconType}}"> <cover-view wx:if="{{item.iconType==0||!item.iconType}}">
<cover-view class="antt {{item.icon}}"></cover-view> <cover-view class="antt {{item.icon}}"></cover-view>
</cover-view> </cover-view>
<cover-view wx:elif="{{item.iconType==1}}" <cover-view
class="img-view" wx:elif="{{item.iconType==1}}"
style="width:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}};height:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}}"> class="img-view"
style="width:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}};height:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}}"
>
<cover-image src="{{selected === index ? item.selectImgUrl : item.imgUrl}}"></cover-image> <cover-image src="{{selected === index ? item.selectImgUrl : item.imgUrl}}"></cover-image>
</cover-view> </cover-view>
<!-- 名称 --> <!-- 名称 -->
<cover-view <cover-view style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? componentData.selectionTextNum*2 : componentData.defaultTextNum*2}}rpx">
style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? componentData.selectionTextNum*2 : componentData.defaultTextNum*2}}rpx">
{{item.title}}</cover-view> {{item.title}}</cover-view>
</cover-view> </cover-view>
</cover-view> </cover-view>
\ No newline at end of file
<template>
<div
ref="ThemeDataPlant"
class="ThemeDataPlant"
:style="{
'background-color': pageSettingData.backgroundColor,
'background-image':bacImage,
'background-repeat':pageSettingData.backgroundFit == 'repeat' ? 'repeat' : 'no-repeat',
'position':pageSettingData.backgroundImageLock ? 'fixed' : 'absolute',
}"
>
</div>
</template>
<script>
export default {
props: {
},
components : {
// 'area-navigation' : () => import('~/components/theme/components/other/area-navigation')
},
data() {
return {
flag: false,
render: true,
pageInfo:{},
pageData:{},
pageSettingData:{},
bacImage:""
};
},
created(){
if (this.mpApp.globalData.pageList) {
this.pageInfo = this.mpApp.globalData.pageList.filter((item) => item.pageCode == 1)[0];
this.pageSettingData = JSON.parse(this.pageInfo.pageSettingData);
console.log(this.pageInfo.pageSettingData,'kl')
}
},
mounted(){
this.bacImage = `url(${this.pageSettingData.backgroundImage})`
},
computed:{
}
};
</script>
<style lang="scss" scoped>
.ThemeDataPlant {
width:100%;
height: 100%;
position: absolute;
top:0;
z-index: -1;
}
.ThemeDataPlant::before {
content: " ";
// position: var(--lock);
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
// background-color: var(--bg_color);
// background-image: var(--image);
// background-repeat: var(--repeat);
background-size: 100% auto;
}
</style>
<template>
<div class="bottomCont">
<div class="bc1 flex">
<i></i>
<p @click="showVConsoles">底线在此,不能更低了</p>
<i></i>
</div>
<div class="bc2">
<img :src="shopInfo.logoUrl" alt />
</div>
<div class="bc3">
<!-- 送颂 -->
<p v-if="shopInfo.shopCode=='songsong'">送颂科技提供技术支持</p>
<!-- 嗨有料 -->
<p v-else-if="shopInfo.shopCode=='HYL' || shopInfo.shopCode=='Id9uwD' "></p>
<!-- <p
v-else-if="Array.isArray(this.$store.state.sceneModule.songCopyright)"
@click="showCookie"
>{{this.$store.state.sceneModule.songCopyright.some(item=>item==shopInfo.shopCode)?'送颂科技提供技术支持':'小工蚁(上股交N板企业300258)提供平台服务'}}</p> -->
</div>
<div class="height7"></div>
</div>
</template>
<script type="text/ecmascript-6">
import { DFSImg } from "@/utils/index";
export default {
data() {
return {
shopInfo: {
logoUrl:''
},
};
},
created(){
this.shopInfo = this.mpApp.globalData.shopInfo
this.shopInfo.logoUrl = DFSImg(this.shopInfo.logoUrl, 400, 400)
console.log(this.shopInfo,'mpapp123')
},
onLoad() {
},
onShow(){
},
methods:{
}
}
</script>
<style lang="scss" scoped>
.bottomCont {
width: 100%;
position: absolute;
padding: 10px 0;
z-index:10;
div {
width: 70%;
margin: 0 auto;
text-align: center;
color: #999;
font-size: 13px;
}
.bc1 {
justify-content: space-between;
align-items: center;
i {
width: 15%;
height: 1px;
background: #c3c3c3;
}
}
.bc2 {
width: 64px;
height: 64px;
margin-top: 20px;
margin-bottom: 10px;
img {
width: 100%;
height: 100%;
object-fit: contain;
}
}
.height7{
width:100%;
height: 50px;
}
}
</style>
...@@ -39,6 +39,7 @@ mpApp.pageCallBack = function () { } ...@@ -39,6 +39,7 @@ mpApp.pageCallBack = function () { }
mpApp.footerCallBack = function () { } mpApp.footerCallBack = function () { }
// webview变化 // webview变化
mpApp.webviewCallBack = function () { } mpApp.webviewCallBack = function () { }
mpApp.shareInit = function () {};
console.log('3555555', wx) console.log('3555555', wx)
// 全局跳转 data为link对象 // 全局跳转 data为link对象
......
<template> <template>
<div class="domain"> <div class="domain">
<view class="ant-daipinglun">1</view> <!-- <view class="ant-daipinglun">1</view> -->
<!-- <goods-list id="goodsList"></goods-list> --> <!-- <goods-list id="goodsList"></goods-list> -->
<scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;" scroll-y="true"> <scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;" scroll-y="true">
<div v-for="(item,index) in pageData" :key="index"> <div style="position:relative">
<div v-if="item.componentCode=='banner'"> <ThemeDataPlant></ThemeDataPlant>
<banner :datas="item"></banner> <div v-for="(item,index) in pageData" :key="index">
</div> <div v-if="item.componentCode=='banner'">
<div v-else-if="item.componentCode=='goods-list'" style="height:100%;"> <banner :datas="item"></banner>
<goods-list class="goodsListItem" :datas="item"></goods-list> </div>
</div> <div v-else-if="item.componentCode=='goods-list'" style="height:100%;">
<div v-else-if="item.componentCode == 'area-navigation'"> <goods-list class="goodsListItem" :datas="item"></goods-list>
<area-navigation :datas="item"></area-navigation> </div>
</div> <div v-else-if="item.componentCode == 'area-navigation'">
<div v-else-if="item.componentCode == 'cube-nav'"> <area-navigation :datas="item"></area-navigation>
<cube-nav :datas="item"></cube-nav> </div>
</div> <div v-else-if="item.componentCode == 'cube-nav'">
<div v-else-if="item.componentCode == 'time-limited-discount'"> <cube-nav :datas="item"></cube-nav>
<time-limited-discount :datas="item"></time-limited-discount> </div>
</div> <div v-else-if="item.componentCode == 'time-limited-discount'">
<div v-if="item.componentCode == 'links'"> <time-limited-discount :datas="item"></time-limited-discount>
<links :datas="item"></links> </div>
</div> <div v-if="item.componentCode == 'links'">
<div v-if="item.componentCode == 'interval'"> <links :datas="item"></links>
<interval :datas="item"></interval> </div>
</div> <div v-if="item.componentCode == 'interval'">
<div v-if="item.componentCode == 'partition'"> <interval :datas="item"></interval>
<partition :datas="item"></partition> </div>
</div> <div v-if="item.componentCode == 'partition'">
<div v-if="item.componentCode == 'shop-popup'"> <partition :datas="item"></partition>
<shop-popup :datas="item"></shop-popup> </div>
</div> <div v-if="item.componentCode == 'shop-popup'">
<div v-if="item.componentCode == 'float-button'"> <shop-popup :datas="item"></shop-popup>
<float-button :datas="item"></float-button> </div>
<div v-if="item.componentCode == 'float-button'">
<float-button :datas="item"></float-button>
</div>
</div> </div>
<div v-if="item.componentCode == 'goods-search'"> <div v-if="item.componentCode == 'goods-search'">
<goods-search :datas="item"></goods-search> <goods-search :datas="item"></goods-search>
...@@ -44,6 +47,7 @@ ...@@ -44,6 +47,7 @@
<pop-up :datas="item"></pop-up> <pop-up :datas="item"></pop-up>
</div> </div>
</div> </div>
<bottomCont></bottomCont>
</scroll-view> </scroll-view>
<!-- <image <!-- <image
src="http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750" src="http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750"
...@@ -58,15 +62,20 @@ ...@@ -58,15 +62,20 @@
<van-button type="primary">按钮</van-button> --> <van-button type="primary">按钮</van-button> -->
<!-- </div> --> <!-- </div> -->
<share-popup></share-popup>
</div> </div>
</template> </template>
<script> <script>
import shop from "@/api/shop";
import bottomCont from "../../components/bottomCont"
import ThemeDataPlant from "../../components/ThemeDataPlant"
import links from '@/components/basicTool/link/index.vue' import links from '@/components/basicTool/link/index.vue'
import interval from '@/components/basicTool/interval/index.vue' import interval from '@/components/basicTool/interval/index.vue'
import partition from '@/components/basicTool/partition/index.vue' import partition from '@/components/basicTool/partition/index.vue'
import shopPopup from '@/components/basicTool/shop-popup/index.vue' import shopPopup from '@/components/basicTool/shop-popup/index.vue'
import { setTabBarActive, checkTabbarPage } from "../../utils/mayi.js"; import { setTabBarActive, checkTabbarPage } from "../../utils/mayi.js";
const app = getApp();
export default { export default {
data() { data() {
...@@ -80,9 +89,57 @@ export default { ...@@ -80,9 +89,57 @@ export default {
interval, interval,
partition, partition,
shopPopup, shopPopup,
bottomCont,
ThemeDataPlant
},
onShareAppMessage(res) {
let shareVal={};
if (res.from === "button") {
console.log(res.target,'-----------78');
return new Promise((resolve,reject)=>{
shop.getShopInfo({ shopMixId: "antgood" }).then(res=>{
if(res.data.code ==200){
let {shopName} = res.data.data;
let logoUrl = app.DFSImg(res.data.data.logoUrl,500,400,0);
resolve({
title: shopName,
path: "page/home/main",
imageUrl:logoUrl,
success: function(res) {
console.log("成功", res);
}
});
}
})
}).then(res=>{
return {
...res,
}
})
}
// return {
// title: shareVal.title,
// path: "page/home/main",
// imageUrl:shareVal.imageUrl,
// success: function(res) {
// console.log("成功", res);
// }
// };
}, },
onLoad() { onLoad(options) {
let that = this; let that = this;
// 来源
if (options.from == "logout") {
//来自用户登出
wx.removeStorage({
key: "sessionid"
});
wx.removeStorage({
key: "openid"
});
}
// 获取页面数据
if (this.mpApp.globalData.pageList) { if (this.mpApp.globalData.pageList) {
that.init(this.mpApp.globalData.pageList); that.init(this.mpApp.globalData.pageList);
} else { } else {
...@@ -118,4 +175,4 @@ export default { ...@@ -118,4 +175,4 @@ export default {
/* text-align: center; */ /* text-align: center; */
/* padding-top: 50%; */ /* padding-top: 50%; */
} }
</style> </style>
\ No newline at end of file
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
"float-button":"/static/nativeComponents/FloatButton/index", "float-button":"/static/nativeComponents/FloatButton/index",
"goods-search":"/static/nativeComponents/GoodsSearch/index", "goods-search":"/static/nativeComponents/GoodsSearch/index",
"notice":"/static/nativeComponents/Notice/index", "notice":"/static/nativeComponents/Notice/index",
"pop-up":"/static/nativeComponents/PopUp/index" "pop-up":"/static/nativeComponents/PopUp/index",
"share-popup":"/static/nativeComponents/SharePopup/index"
}, },
"enablePullDownRefresh":true "enablePullDownRefresh":true
} }
\ No newline at end of file
...@@ -133,7 +133,8 @@ export default { ...@@ -133,7 +133,8 @@ export default {
if(this.page.includes("?")){ if(this.page.includes("?")){
this.params="&mixid=" + this.shopId; this.params="&mixid=" + this.shopId;
} }
options.params && (this.params += "&" + serialize(options.params)); options.params && (this.params += "&" + serialize(decodeURIComponent(options.params)));
console.log(this.page,this.params)
} else if (options.from && options.from == "livedBackShop") { } else if (options.from && options.from == "livedBackShop") {
//直播页back到商城 //直播页back到商城
this.page = decodeURIComponent(options.backpath); this.page = decodeURIComponent(options.backpath);
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid, params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
index: 1, index: 1,
ss: "", ss: "",
}; };
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
// tabbar 跳转 // tabbar 跳转
let homeIndex = checkTabbarPage("/"); let homeIndex = checkTabbarPage("/");
homeIndex != 0 && homeIndex==this.index && (this.index = 0); homeIndex != 0 && homeIndex == this.index && (this.index = 0);
if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) { if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
this.page = getUrlofLink( this.page = getUrlofLink(
this.mpApp.globalData.footerVal.componentData.list[this.index].link this.mpApp.globalData.footerVal.componentData.list[this.index].link
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid, params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
index: 2, index: 2,
ss: "", ss: "",
}; };
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid, params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
index: 3, index: 3,
ss: "", ss: "",
}; };
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid, params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
index: 4, index: 4,
ss: "", ss: "",
}; };
......
...@@ -5,6 +5,7 @@ export function getUrlofLink(data) { ...@@ -5,6 +5,7 @@ export function getUrlofLink(data) {
// 全局跳转 data:link数据 option:是否为底部栏触发 // 全局跳转 data:link数据 option:是否为底部栏触发
export function $themeToLink(data, option) { export function $themeToLink(data, option) {
let app = getApp();
let type = data.type; let type = data.type;
// 点击底部栏 // 点击底部栏
...@@ -72,6 +73,7 @@ export function $themeToLink(data, option) { ...@@ -72,6 +73,7 @@ export function $themeToLink(data, option) {
// this.$themeCouponClick(data.feature.value.couponCode, data.feature.value); // this.$themeCouponClick(data.feature.value.couponCode, data.feature.value);
} else if (featureType == 1) {//分享 } else if (featureType == 1) {//分享
console.log('是分享了。。。。'); console.log('是分享了。。。。');
app.shareInit({ itemList: data.feature.value });
} else if (featureType == "themeMemberCardClick" || featureType == 2) { //会员卡 } else if (featureType == "themeMemberCardClick" || featureType == 2) { //会员卡
// this.$themeMemberCardClick(data.feature.value); // this.$themeMemberCardClick(data.feature.value);
} }
......
const app = getApp();
const { $themeToLink } = app;
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
behaviors: [],
properties: {},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
showPop: false,
custom: {
textShow: 1,
itemList: [1, 1, 1],
itemListInfo: [],
href: "",
toPage: "", //跳转的页面
callback: "", //回调函数
extends: {} //额外参数
},
distributorVal: "",
type: 0,
phone: "",
href: "",
posterId: -1,
spokesmanGroupId: "",
spokesmanShopId: "",
spokesmanRelId: "",
hasInvitationStatus: 0,
nickname: "",
shareGoodsInfo: {},
giftIsSend: false,
miniProgram: 0,
flag: false,
productId: "",
copyLink: "32132132"
},
// 数据监听器
observers: {},
// 组件方法
methods: {
init() {
let _this = this;
let { custom } =this.data;
app.shareInit = function(list) {
for (const key in list) {
if (list.hasOwnProperty(key)) {
if (custom[key] !== "undefined" && custom[key] !== undefined && list[key] !== "undefined" && list[key] !== undefined) {
custom[key] = list[key];
}
}
}
_this.setData({ custom });
_this.showPopup();
};
},
showPopup() {
this.setData({ showPop: true });
this.getTabBar().setData({ show: false });
},
onClose() {
this.setData({ showPop: false });
this.getTabBar().setData({ show: true });
},
cancel() {
this.onClose();
},
copyText(e) {
let { text } = e.currentTarget.dataset;
let pagePath = getCurrentPages()[0].route;
// let copyVal = pagePath + text;
wx.setClipboardData({
data: copyVal,
success: function(res) {
wx.getClipboardData({
success: function(res) {
wx.showToast({ title: "复制成功" });
}
});
}
});
},
toPosters() {
let linkVal = `/goods/posters`;
$themeToLink({ type: 1, link: linkVal });
},
},
// 组件生命周期
lifetimes: {
created() {},
attached() {
this.init();
},
ready() {},
moved() {},
detached() {}
},
definitionFilter() {},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {}
}
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-popup": "/static/vant/popup/index"
}
}
<!-- 分享弹窗 -->
<view class="SharePopup" id="SharePopup">
<van-popup
show="{{ showPop }}"
position="bottom"
bind:close="onClose"
>
<!-- <view class="share-tip">
<text style="color:#333;font-size:28rpx;">朋友通过你分享的页面成功购买后,你可获得奖励金</text>
<text style="color:#333;font-size:24rpx;">可在【我的】 - 【distributorVal】查看奖励金</text>
</view>
<view class="share-tip">
<text style="color:#333;font-size:28rpx;">朋友通过你分享的页面成功登录后,将成为你的客户</text>
<text style="color:#333;font-size:24rpx;">可在【我的】 - 【distributorVal】-【我的客户】查看</text>
</view> -->
<view class="share-main">
<view class="share-item" wx:if="{{custom.itemList[0]==1}}">
<button
type="text"
open-type="share"
class="shareButton"
>
<image src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/015d5cd2-183a-44aa-9b66-5f7c2e627089.png"></image>
<text class="item-text">微信分享</text>
</button>
</view>
<view
class="share-item"
bindtap="copyText"
data-text="{{copyLink}}"
wx:if="{{custom.itemList[1]==1}}"
>
<image src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/0320a722-25d2-4a30-900f-790c2a541f2f.png"></image>
<text class="item-text">复制链接</text>
</view>
<view
class="share-item"
bindtap="toPosters"
wx:if="{{custom.itemList[2]==1}}"
>
<image src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/18d0044d-9634-4c89-8321-3e8ff8e94cce.png"></image>
<text class="item-text">生成海报</text>
</view>
</view>
<view class="share-cancel" bindtap="cancel">取消</view>
</van-popup>
</view>
.share-tip {
padding: 24rpx 0 0 32rpx;
text-align: center;
}
.share-tip text {
line-height: 48rpx;
}
.share-main {
width: 100%;
height: 254rpx;
display: flex;
justify-content: space-around;
align-items: center;
border-bottom: 20rpx solid #eeeeed;
}
.shareButton {
background-color: transparent;
padding-left: 0;
padding-right: 0;
line-height: inherit;
border-radius:0;
font-size: 28rpx;
}
.shareButton::after {
border: none;
}
.share-main .share-item {
text-align: center;
color: #333;
font-size: 28rpx;
}
.share-main .share-item image {
width: 112rpx;
height: 112rpx;
margin-bottom: 10rpx;
}
.share-cancel {
width: 100%;
height: 100rpx;
text-align: center;
line-height: 100rpx;
font-size: 34rpx;
color: #f82f2e;
}
...@@ -20,7 +20,7 @@ const componentOptions = { ...@@ -20,7 +20,7 @@ const componentOptions = {
// 组件数据 // 组件数据
data: { data: {
isPageHidden: false, // 页面是否处于隐藏状态 isPageHidden: false, // 页面是否处于隐藏状态
hideItem: false, // hideItem: false,
timeData: {} timeData: {}
}, },
// 数据监听器 // 数据监听器
......
<!-- 活动列表item --> <!-- 活动列表item -->
<view <view
class="activityListItem" class="activityListItem"
wx:if="{{!hideItem||!datas.isEnd}}" wx:if="{{!datas.isEnd}}"
bindtap="toActivity" bindtap="toActivity"
> >
<view class="title"> <view class="title">
......
...@@ -191,7 +191,7 @@ const componentOptions = { ...@@ -191,7 +191,7 @@ const componentOptions = {
}); });
} }
if (ids.length == 0) { if (ids.length == 0) {
this.setData({ isLoading:true }); this.setData({ isLoading:false });
return; return;
} }
promoteApi.query_single_item_activity_list_by_ids(ids).then(res => { promoteApi.query_single_item_activity_list_by_ids(ids).then(res => {
...@@ -246,10 +246,9 @@ const componentOptions = { ...@@ -246,10 +246,9 @@ const componentOptions = {
// 组件生命周期 // 组件生命周期
lifetimes: { lifetimes: {
created() {}, created() {},
attached() { ready() {
this.getData(); this.getData();
}, },
ready() {},
moved() {}, moved() {},
detached() {} detached() {}
}, },
...@@ -258,12 +257,12 @@ const componentOptions = { ...@@ -258,12 +257,12 @@ const componentOptions = {
pageLifetimes: { pageLifetimes: {
// 页面被展示 // 页面被展示
show() { show() {
this.getData();
const { isPageHidden } = this.data; const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时 // show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) { if (!isPageHidden) {
return; return;
} }
this.getData();
// 重新执行定时器等操作 // 重新执行定时器等操作
}, },
......
...@@ -118,14 +118,13 @@ ...@@ -118,14 +118,13 @@
</view> </view>
</view> </view>
<!-- 活动列表 --> <!-- 活动列表 -->
<block wx:if="{{datas.componentData.dimension == 1 && isLoading}}"> <activity-list-item
<activity-list-item wx:if="{{datas.componentData.dimension == 1}}"
wx:for="{{datas.componentData.actList}}" wx:for="{{datas.componentData.actList}}"
wx:key="index" wx:key="index"
datas="{{item}}" datas="{{item}}"
num="{{index}}" num="{{index}}"
countDownShow="{{datas.componentData['countDownShow']}}" countDownShow="{{datas.componentData['countDownShow']}}"
></activity-list-item> ></activity-list-item>
</block>
</view> </view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment