Commit 393d6252 by 程默

Merge branch 'nativehome_tst' into native2

parents d7b16029 168e2e23
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
"build": "node build/build.js wx" "build": "node build/build.js wx"
}, },
"dependencies": { "dependencies": {
"flyio": "^0.6.14",
"mayi-analytics": "^1.1.14", "mayi-analytics": "^1.1.14",
"mpvue": "^2.0.0", "mpvue": "^2.0.0",
"mpvue-wxparse": "^0.6.5", "mpvue-wxparse": "^0.6.5",
......
...@@ -8,13 +8,14 @@ export default { ...@@ -8,13 +8,14 @@ export default {
let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
console.log(extConfig, "-----------extConfig"); console.log(extConfig, "-----------extConfig");
if ( if (
process.env.NODE_ENV == "development" || process.env.NODE_ENV == "production" ||
JSON.stringify(extConfig) == "{}" JSON.stringify(extConfig) == "{}"
) { ) {
// extConfig = { mixid: "jordan", shopid: 471 }; // extConfig = { mixid: "jordan", shopid: 471 };
extConfig = { mixid: "antgood", shopid: 67 }; extConfig = { "mixid":"xyyx",
"shopid":133 };
} }
console.log("1444444444", extConfig.mixid); console.log("1444444444", extConfig);
this.$store.commit("setExtConfig", extConfig.mixid); this.$store.commit("setExtConfig", extConfig.mixid);
this.$store.commit('setExtConfigInfo',extConfig) this.$store.commit('setExtConfigInfo',extConfig)
// 调用API从本地缓存中获取数据 // 调用API从本地缓存中获取数据
...@@ -163,6 +164,8 @@ export default { ...@@ -163,6 +164,8 @@ export default {
return item.componentName == "底部导航"; return item.componentName == "底部导航";
})[0]; })[0];
// 显示条件(未处理)
footerVal.componentData.list=footerVal.componentData.list.filter(item=>item.visible==undefined || item.visible==1) || [];
this.mpApp.globalData.footerVal = footerVal; this.mpApp.globalData.footerVal = footerVal;
// app中异步数据回调 底部栏数据 // app中异步数据回调 底部栏数据
if (mpApp.footerCallBack) { if (mpApp.footerCallBack) {
......
...@@ -30,6 +30,9 @@ console.log(process.env,'-----------------config------') ...@@ -30,6 +30,9 @@ console.log(process.env,'-----------------config------')
}, },
addBuyingShowPraise(data){ addBuyingShowPraise(data){
return requestPOST(`${process.env.OLSHOP_URL}/activityInfo/buyingShow/addBuyingShowPraise/${data.buyingShowId}`); return requestPOST(`${process.env.OLSHOP_URL}/activityInfo/buyingShow/addBuyingShowPraise/${data.buyingShowId}`);
},
get_multi_merchant_by_tags(data){
return requestPOST(`${process.env.OLSHOP_URL}/shop/get_multi_merchant_by_tags`,data)
} }
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<cube-nav :datas="item"></cube-nav> <cube-nav :datas="item"></cube-nav>
</div> </div>
<div v-else-if="item.componentCode == 'time-limited-discount' && item.componentInfo.visible == 1"> <div v-else-if="item.componentCode == 'time-limited-discount' && item.componentInfo.visible == 1">
<time-limited-discount :datas="item"></time-limited-discount> <time-limited-discount :class="'time-limited-discount'+index" :datas="item" :k="index"></time-limited-discount>
</div> </div>
<div v-if="item.componentCode == 'links' && item.componentInfo.visible == 1"> <div v-if="item.componentCode == 'links' && item.componentInfo.visible == 1">
<links :datas="item"></links> <links :datas="item"></links>
...@@ -81,6 +81,9 @@ ...@@ -81,6 +81,9 @@
<div v-if="item.componentCode == 'share-picture' && item.componentInfo.visible == 1"> <div v-if="item.componentCode == 'share-picture' && item.componentInfo.visible == 1">
<share-picture :datas="item"></share-picture> <share-picture :datas="item"></share-picture>
</div> </div>
<div v-if="item.componentCode == 'merchants-list' && item.componentInfo.visible == 1">
<merchants-list class="goodsListItem" :datas="item"></merchants-list>
</div>
</div> </div>
<bottomCont></bottomCont> <bottomCont></bottomCont>
</div> </div>
...@@ -104,6 +107,7 @@ import imgText from '@/components/content/imgText' ...@@ -104,6 +107,7 @@ import imgText from '@/components/content/imgText'
import coupon from '@/components/activity/coupon' import coupon from '@/components/activity/coupon'
import integralTurntable from '@/components/activity/integralTurntable' import integralTurntable from '@/components/activity/integralTurntable'
import { setTabBarActive, checkTabbarPage,themeColor } from "../../utils/mayi.js"; import { setTabBarActive, checkTabbarPage,themeColor } from "../../utils/mayi.js";
import { throttle } from "../../utils/index.js"
const app = getApp(); const app = getApp();
export default { export default {
...@@ -169,6 +173,17 @@ export default { ...@@ -169,6 +173,17 @@ export default {
// } // }
// }; // };
}, },
onReady(){
// 上报首页打开时间
if (wx.canIUse('reportPerformance')) {
const performance = wx.getPerformance()
const observer = performance.createObserver((entryList) => {
let getEntries=entryList.getEntries()
wx.reportPerformance(2001, getEntries[0]['duration'])
})
observer.observe({ entryTypes: ['render', 'script'] })
}
},
onLoad(options) { onLoad(options) {
let location=JSON.parse(wx.getStorageSync('location') || '{}') let location=JSON.parse(wx.getStorageSync('location') || '{}')
...@@ -180,17 +195,7 @@ export default { ...@@ -180,17 +195,7 @@ export default {
this.changeLocation = options.changeLocation || '' this.changeLocation = options.changeLocation || ''
if(this.changeLocation == 1){ if(this.changeLocation == 1){
// let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
// console.log(extConfig, "-----------extConfig");
// if (
// process.env.NODE_ENV == "development" ||
// JSON.stringify(extConfig) == "{}"
// ) {
// extConfig = { mixid: "antgood", shopid: 67 };
// }
console.log('this.$store.state.extConfig',this.$store.state.extConfig) console.log('this.$store.state.extConfig',this.$store.state.extConfig)
app.getShopInfo(this.$store.state.extConfig); app.getShopInfo(this.$store.state.extConfig);
app.getThemePage(this.$store.state.extConfig); app.getThemePage(this.$store.state.extConfig);
} }
...@@ -231,10 +236,11 @@ export default { ...@@ -231,10 +236,11 @@ export default {
onShow() { onShow() {
setTabBarActive.bind(this)(checkTabbarPage('/')); setTabBarActive.bind(this)(checkTabbarPage('/'));
this.$mp.page.onPageScroll= (el)=>{ this.$mp.page.onPageScroll= (el)=>{
this.scrolls(el); throttle(this.scrolls(el),100)
}; };
}, },
methods: { methods: {
init(pageList) { init(pageList) {
setTabBarActive.bind(this)(checkTabbarPage('/')); setTabBarActive.bind(this)(checkTabbarPage('/'));
...@@ -254,6 +260,18 @@ export default { ...@@ -254,6 +260,18 @@ export default {
if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){ if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){
this.$mp.page.selectComponent(".goodsListItem").getScroll(el); this.$mp.page.selectComponent(".goodsListItem").getScroll(el);
} }
if (this.pageData) {
for (let i = 0; i < this.pageData.length; i++) {
const element = this.pageData[i]
if(element.componentCode=="time-limited-discount"){
let com=this.$mp.page.selectComponent(".time-limited-discount"+i) ;
com && com.getScroll(el);
}
}
}
}, },
setFooterShow(el){ setFooterShow(el){
let afterScrollTop = el.scrollTop; let afterScrollTop = el.scrollTop;
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
"video-player":"/static/nativeComponents/VideoPlayer/index", "video-player":"/static/nativeComponents/VideoPlayer/index",
"photo-gallery":"/static/nativeComponents/PhotoGallery/index", "photo-gallery":"/static/nativeComponents/PhotoGallery/index",
"live-broadcast":"/static/nativeComponents/LiveBroadcast/index", "live-broadcast":"/static/nativeComponents/LiveBroadcast/index",
"share-picture":"/static/nativeComponents/SharePicture/index" "share-picture":"/static/nativeComponents/SharePicture/index",
"merchants-list":"/static/nativeComponents/MerchantsList/index"
}, },
"enablePullDownRefresh":true, "enablePullDownRefresh":true,
"backgroundColor":"#f5f5f5" "backgroundColor":"#f5f5f5"
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
link: this.baseUrl, link: this.baseUrl,
page: "/", page: "/",
location_obj:encodeURIComponent(wx.getStorageSync("location")), location_obj:encodeURIComponent(wx.getStorageSync("location")),
params: "?mixid=" + this.shopId+`&location_obj=${this.location_obj}`, params: "?mixid=" + this.shopId+`&native_test=1&location_obj=${this.location_obj}`,
userInfo: { userInfo: {
nickName: "mpvue", nickName: "mpvue",
...@@ -139,7 +139,7 @@ export default { ...@@ -139,7 +139,7 @@ export default {
//来自直播详情 //来自直播详情
this.page = decodeURIComponent(options.backpath); this.page = decodeURIComponent(options.backpath);
if(this.page.includes("?")){ if(this.page.includes("?")){
this.params="&mixid=" + this.shopId+`&location_obj=${this.location_obj}`; this.params="&mixid=" + this.shopId+`&native_test=1&location_obj=${this.location_obj}`;
} }
options.params && (this.params += "&" + serialize(decodeURIComponent(options.params))); options.params && (this.params += "&" + serialize(decodeURIComponent(options.params)));
console.log(this.page,this.params) console.log(this.page,this.params)
......
...@@ -2,6 +2,29 @@ function formatNumber(n) { ...@@ -2,6 +2,29 @@ function formatNumber(n) {
const str = n.toString() const str = n.toString()
return str[1] ? str : `0${str}` return str[1] ? str : `0${str}`
} }
// 防抖
export function debounce(fn, wait) {
var timeout = null;
return function() {
if (timeout !== null)
clearTimeout(timeout);
timeout = setTimeout(fn, wait);
}
}
// 节流
export function throttle(func, delay) {
var prev = Date.now();
return function() {
var context = this;
var args = arguments;
var now = Date.now();
if (now - prev >= delay) {
func.apply(context, args);
prev = Date.now();
}
}
}
//格式时间 //格式时间
export function formatTime(date) { export function formatTime(date) {
......
...@@ -29,7 +29,7 @@ export function $themeToLink(data, option) { ...@@ -29,7 +29,7 @@ export function $themeToLink(data, option) {
let type = data.type; let type = data.type;
// 点击底部栏-- // 点击底部栏--
// if (option) { if (type!=2) {
// 登录拦截 // 登录拦截
let parseLink = getUrlofLink(data); let parseLink = getUrlofLink(data);
let aa=noLoginListPath.includes(parseLink) || parseLink.substr(0,7)=="/goods/" let aa=noLoginListPath.includes(parseLink) || parseLink.substr(0,7)=="/goods/"
...@@ -55,7 +55,7 @@ export function $themeToLink(data, option) { ...@@ -55,7 +55,7 @@ export function $themeToLink(data, option) {
} }
// console.log(option, data,'---',parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`) // console.log(option, data,'---',parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`)
// return // return
// } }
// 历史数据 // 历史数据
......
// static/nativeComponents/MerchantsList/index.js
let app = getApp()
const { indexApi } = app;
Component({
/**
* 组件的属性列表
*/
properties: {
datas: {
type: Object
}
},
/**
* 组件的初始数据
*/
data: {
showList : true,
toLoad : true,
query : {
pageNum: 0,
pageSize: 10,
shopTagIds: [],
mallFlag: 1,
},
WaterfallFlowList : [],
skeletonLoading: true,
loading: false,
finished: false,
clientHeight : 0,
WaterfallFlowListL : [],
WaterfallFlowListR : []
},
ready(){
let _this = this;
let { clientHeight } = this.data;
wx.getSystemInfo({
success: function (res) {
let clientHeight = parseInt(res.windowHeight);
_this.setData({ clientHeight });
}
});
this.init()
},
/**
* 组件的方法列表
*/
methods: {
init(){
this.loadHandle(1);
},
loadHandle(val){
if (this.data.toLoad == false) return;
this.setData({
toLoad: false
})
if(val == 1){
this.setData({
['query.pageNum'] : 1,
WaterfallFlowList : []
})
}else{
this.setData({
['query.pageNum']: this.data.query.pageNum + 1
})
}
this.setData({
['query.shopTagIds']: this.data.datas.componentData.selectMerchants == 0 ? [] : this.data.datas.componentData.selectLabelList,
})
indexApi.get_multi_merchant_by_tags(this.data.query).then(res => {
this.setData({
toLoad : true,
skeletonLoading : false,
loading : false
})
if(res.data.code == '200'){
let list = res.data.data
if(list == null || list.length == 0){
if(this.query.pageNum == 1){
this.setData({
showList: false
})
}
}else{
list.forEach((item,index) => {
item.logoUrl = item.logoUrl ? app.DFSImg(item.logoUrl,300,300,1) : app.DFSImg("");
})
if (val == 1){
if (this.data.datas.componentData.layoutType == 0){
this.setData({
WaterfallFlowListL: [],
WaterfallFlowListR: []
})
let WaterfallFlowListL = []
let WaterfallFlowListR = []
list.forEach((item, index) => {
if (index % 2 == 0) {
WaterfallFlowListL.push(item)
} else {
WaterfallFlowListR.push(item)
}
})
this.setData({
'WaterfallFlowListL[0]': WaterfallFlowListL,
'WaterfallFlowListR[0]': WaterfallFlowListR
})
}else{
this.setData({
'WaterfallFlowList[0]': list
})
}
}else{
if (this.data.datas.componentData.layoutType == 0) {
let WaterfallFlowListL = []
let WaterfallFlowListR = []
list.forEach((item,index) => {
if (index % 2 == 0) {
WaterfallFlowListL.push(item)
} else {
WaterfallFlowListR.push(item)
}
})
this.setData({
['WaterfallFlowListL[' + this.data.WaterfallFlowListL.length + ']']: WaterfallFlowListL,
['WaterfallFlowListR[' + this.data.WaterfallFlowListR.length + ']']: WaterfallFlowListR
})
} else {
this.setData({
['WaterfallFlowList[' + this.data.WaterfallFlowList.length + ']']: list
})
}
}
if (this.data.WaterfallFlowList.length <= 0) {
this.showList = false;
}
}
if (list == null || list.length < 10) {
this.setData({
finished : true
})
} else {
this.setData({
finished: false
})
}
console.log(this.data.WaterfallFlowList,'this.data.WaterfallFlowList')
}else{
this.setData({
finished : true,
showList : false
})
}
})
},
getScroll(el) {
let _this = this
this.createSelectorQuery().select("#ItemModule0").boundingClientRect(function(res){
if(res){
let scrollTop = parseInt(el.scrollTop);
let domHeight = parseInt(res.height);
if (
scrollTop + _this.data.clientHeight >= domHeight - 150 &&
_this.data.finished == false
) {
_this.loadHandle(2);
}
}
}).exec()
this.createSelectorQuery().select("#ItemModule1").boundingClientRect(function(res){
if (res) {
let scrollTop = parseInt(el.scrollTop);
let domHeight = parseInt(res.height);
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
if (
scrollTop + _this.data.clientHeight >= domHeight - 150 &&
_this.data.finished == false
) {
_this.loadHandle(2);
}
}
}).exec()
},
scrolltolower(){
if(this.data.finished == false){
this.loadHandle(2)
}
},
itemClick(e){
let item = e.currentTarget.dataset.item
console.log(item)
app.$themeToLink({
type: 1,
link: `/merchantsDetail/${ item.boundOrgId }`
})
}
}
})
{
"component": true,
"usingComponents": {
"skeleton-block": "../module/SkeletonBlock/index"
}
}
\ No newline at end of file
<!--static/nativeComponents/MerchantsList/index.wxml-->
<view class="merchants-list" wx:if="{{showList}}" style="border-radius:{{datas.componentData.moduleRadius * 2}}rpx;padding-top:{{datas.componentData.levelMargin * 2}}rpx;padding-bottom:{{datas.componentData.levelMargin * 2}}rpx;padding-left:{{datas.componentData.verticalMargin * 2}}rpx;padding-right:{{datas.componentData.verticalMargin * 2}}rpx;--modelBackgroundColor:{{datas.componentData.modelBackgroundColor}};--lineHeight:{{datas.componentData.lineHeight * 2}}rpx;--columnHeight:{{datas.componentData.columnHeight * 2}}rpx;--columnDistance:{{datas.componentData.columnHeight}}rpx;--pictureBackgroundColor:{{datas.componentData.pictureBackgroundColor}}">
<view wx:if="{{skeletonLoading}}">
<view wx:if="{{datas.componentData.layoutType == 0}}">
<skeleton-block loading="{{skeletonLoading}}" type="{{'flow'}}"></skeleton-block>
</view>
<view wx:if="{{datas.componentData.layoutType == 1}}">
<skeleton-block loading="{{skeletonLoading}}" type="{{'row'}}" height="30" row="1" col="4"></skeleton-block>
</view>
<view wx:if="{{datas.componentData.layoutType == 2}}">
<skeleton-block loading="{{skeletonLoading}}" type="{{'col'}}" row="1" col="2" height="50"></skeleton-block>
</view>
</view>
<view wx:if="{{datas.componentData.layoutType == 0}}" id="ItemModule0">
<view class="layoutType0">
<view class="type-l">
<view wx:for="{{WaterfallFlowListL}}" :wx:key="index">
<view wx:for="{{item}}" wx:for-item="item1" wx:for-index="index1">
<view class="ItemModule ItemModule3" bindtap="itemClick" data-item="{{item1}}">
<view class="product-item">
<view class="product-img">
<image src="{{item1.logoUrl}}" mode="widthFix"></image>
</view>
<view class="product-info">
<text class="name">{{item1.shopName}}</text>
<view class="des">{{item1.remark}}</view>
<view class="label">
<view class="labelItem" wx:for="{{item1.tagInfoResponseDTOS}}" wx:for-index="idx" wx:for-item="itemName">{{itemName.tagName}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="type-r ">
<view wx:for="{{WaterfallFlowListR}}" wx:key="index">
<view wx:for="{{item}}" wx:for-item="item1" wx:for-index="index1">
<view class="ItemModule ItemModule3" bindtap="itemClick" data-item="{{item1}}">
<view class="product-item">
<view class="product-img">
<image src="{{item1.logoUrl}}" mode="widthFix"></image>
</view>
<view class="product-info">
<text class="name">{{item1.shopName}}</text>
<view class="des">{{item1.remark}}</view>
<view class="label">
<view class="labelItem" wx:for="{{item1.tagInfoResponseDTOS}}" wx:for-index="idx" wx:for-item="itemName">{{itemName.tagName}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="placeholderRect">{{ !finished ? "加载中" : "没有更多了" }}</view>
</view>
<view wx:elif="{{datas.componentData.layoutType == 1}}" id="ItemModule1">
<view wx:for="{{WaterfallFlowList}}" wx:key="index">
<view wx:for="{{item}}" wx:for-item="item1" wx:for-index="index1">
<view class="ItemModule ItemModule1" bindtap="itemClick" data-item="{{item1}}">
<view class="product-item item-row" >
<view class="product-img">
<image mode="aspectFill" src="{{item1.logoUrl}}"></image>
</view>
<view class="product-info">
<text class="name">{{item1.shopName}}</text>
<view class="des">{{item1.remark}}</view>
<view class="label">
<view class="labelItem" wx:for="{{item1.tagInfoResponseDTOS}}" wx:for-index="idx" wx:for-item="itemName">{{itemName.tagName}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="placeholderRect">{{ !finished ? "加载中" : "没有更多了" }}</view>
</view>
<view wx:elif="{{datas.componentData.layoutType == 2}}">
<view class="layoutType2">
<scroll-view scroll-x="true" bindscrolltolower="scrolltolower" class="HorizontalRoll">
<view style="display:flex;">
<view wx:for="{{WaterfallFlowList}}" wx:key="index" style="display:inline-block">
<view class="layoutType2-content" wx:for="{{item}}" wx:for-item="item1" wx:for-index="index1">
<view class="ItemModule ItemModule2" bindtap="itemClick" data-item="{{item1}}">
<view class="product-item">
<view class="product-img">
<image mode="aspectFill" src="{{item1.logoUrl}}"></image>
</view>
<view class="product-info">
<text class="name">{{item1.shopName}}</text>
<view class="des">{{item1.remark}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="bottom" ref="bottomDom">
<view>{{ !finished ? "" : "没有更多了" }}</view>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
/* static/nativeComponents/MerchantsList/index.wxss */
.merchants-list{
font-size: 32rpx;
overflow: hidden;
background: var(--modelBackgroundColor);
}
.placeholderRect {
color: #969799;
font-size: 28rpx;
line-height: 100rpx;
text-align: center;
}
.ItemModule{
margin-bottom: var(--lineHeight);
}
.ItemModule .label{
display: flex;
flex-wrap: wrap;
margin-top: 20rpx;
}
.ItemModule .product-img{
background: var(--pictureBackgroundColor);
}
.ItemModule .label .labelItem {
padding: 0px 8rpx;
height: 32rpx;
font-size: 24rpx;
color: #fff;
background: var(--main-color);
border-radius: 20rpx;
margin-right: 8rpx;
margin-bottom: 8rpx;
}
.ItemModule .product-item{
font-size: 32rpx;
background-color: #fff;
border-radius: 14rpx;
overflow: hidden;
}
.ItemModule1 .product-item .product-img{
position: relative;
width: 200rpx;
height: 200rpx;
flex-shrink: 0;
}
.ItemModule1 .product-item .product-img image{
width: 100%;
height: 100%;
opacity: 1;
}
.product-info{
font-size: 26rpx;
margin: 10rpx;
color: #888888;
flex: 1;
}
.product-item .product-info .name {
display: flex;
font-size: 26rpx;
justify-content: space-between;
width: 80%;
overflow: hidden;
text-overflow: ellipsis;
color: #262626;
margin-bottom: 4rpx;
}
.product-item .product-info .des {
line-height: 36rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.ItemModule1 .item-row{
display: flex;
}
.ItemModule2 .product-item{
font-size: 32rpx;
background-color: #fff;
border-radius: 8rpx;
overflow: hidden;
}
.ItemModule2 .product-img {
width: 300rpx;
height: 300rpx;
}
.ItemModule2 .product-img image{
width: 100%;
height: 100%;
}
.layoutType2 {
overflow-x: hidden;
overflow-y: hidden;
white-space: nowrap;
}
.layoutType2 .layoutType2-content {
display: inline-block;
vertical-align: top;
white-space: normal;
margin-right: var(--columnHeight);
width: 300rpx;
}
.layoutType2 .layoutType2-content .product-info .name {
width: 100%;
justify-content: center;
white-space: normal;
overflow: auto;
}
.layoutType2::-webkit-scrollbar {
display: none; /* Chrome Safari */
}
.HorizontalRoll {
display: flex;
align-items: center;
}
.HorizontalRoll .bottom{
writing-mode:vertical-lr;
font-size: 28rpx;
color: #666;
display: inline-block;
}
.HorizontalRoll .bottom view{
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.layoutType0{
overflow: hidden;
}
.layoutType0 .type-l{
width: 50%;
float: left;
box-sizing: border-box;
padding-right: var(--columnDistance)
}
.layoutType0 .type-r{
width: 50%;
float: right;
box-sizing: border-box;
padding-left: var(--columnDistance)
}
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</view> </view>
<view wx:if="{{datas.componentData.style==='list'}}"> <view wx:if="{{datas.componentData.style==='list'}}">
<view class="imgcontent" wx:for="{{datas.componentData.imgList}}" wx:key="{{index}}" style="margin-bottom:{{datas.componentData.imgPadding * 2}}rpx"> <view class="imgcontent" wx:for="{{datas.componentData.imgList}}" wx:key="{{index}}" style="margin-bottom:{{datas.componentData.imgPadding * 2}}rpx">
<image src="{{item.imageUrl}}" lazy-load></image> <image src="{{item.imageUrl}}" lazy-load mode="widthFix"></image>
</view> </view>
</view> </view>
<view wx:elif="{{datas.componentData.style==='across' || datas.componentData.style==='tiled'}}" class="across"> <view wx:elif="{{datas.componentData.style==='across' || datas.componentData.style==='tiled'}}" class="across">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="pop-up" wx:if="{{domainShow}}"> <view class="pop-up" wx:if="{{domainShow}}">
<view class="shade"></view> <view class="shade"></view>
<view class="content"> <view class="content">
<image src="{{img}}" bindtap="onclickHandle"></image> <image src="{{img}}" bindtap="onclickHandle" mode="widthFix"></image>
<view class="back {{datas.componentData.backButtonSite=='bottom'?'back-bottom':'back-top'}}" bindtap="backHandle"> <view class="back {{datas.componentData.backButtonSite=='bottom'?'back-bottom':'back-top'}}" bindtap="backHandle">
<em></em> <em></em>
<em></em> <em></em>
......
...@@ -45,7 +45,8 @@ em:nth-child(2) { ...@@ -45,7 +45,8 @@ em:nth-child(2) {
} }
.back-bottom { .back-bottom {
margin: 40rpx auto 0; margin: 0 auto ;
padding-top: 40rpx;
} }
.back-top { .back-top {
position: absolute; position: absolute;
......
...@@ -57,21 +57,25 @@ Component({ ...@@ -57,21 +57,25 @@ Component({
res.data.data.category[0].children.forEach(item => { res.data.data.category[0].children.forEach(item => {
if (item.categoryBigImg) { if (item.categoryBigImg) {
item.categoryBigImg = app.DFSImg(item.categoryBigImg) item.categoryBigImg = app.DFSImg(item.categoryBigImg,400,400)
} }
if (item.categoryBigImg) { if (item.categoryImgUrl) {
item.categoryImgUrl = app.DFSImg(item.categoryImgUrl) item.categoryImgUrl = app.DFSImg(item.categoryImgUrl,400,400)
} }
})
console.log(res.data.data.category[0].children, 'res.data.data.category[0].children')
this.setData({ this.setData({
categoryList: res.data.data.category[0].children categoryList: res.data.data.category[0].children
}) })
if (this.data.categoryList.length == 0) { if (this.data.categoryList.length == 0) {
this.setData({ this.setData({
targetShow : false targetShow: false
}) })
} }
})
} }
}) })
......
...@@ -39,6 +39,7 @@ xcsoft.countdown = function(a, b, c) { ...@@ -39,6 +39,7 @@ xcsoft.countdown = function(a, b, c) {
d.minute = 0; d.minute = 0;
d.second = 0; d.second = 0;
d.t = setInterval(function() { d.t = setInterval(function() {
console.log('倒计时')
e = new Date().getTime(); e = new Date().getTime();
f = parseInt(e / 1000 + x); f = parseInt(e / 1000 + x);
var l = d.time - f; var l = d.time - f;
...@@ -109,10 +110,15 @@ const componentOptions = { ...@@ -109,10 +110,15 @@ const componentOptions = {
properties: { properties: {
datas: { datas: {
type: Object type: Object
},
k:{
type:String
} }
}, },
// 组件数据 // 组件数据
data: { data: {
loaded:false,
isContain:false,
isPageHidden: false, // 页面是否处于隐藏状态 isPageHidden: false, // 页面是否处于隐藏状态
timeData: {}, timeData: {},
isLoading: true, isLoading: true,
...@@ -243,6 +249,24 @@ const componentOptions = { ...@@ -243,6 +249,24 @@ const componentOptions = {
} }
}); });
}, },
getScroll(){
this.getEleInfo(()=>{
this.getData()
});
},
// 获取当前组件位置信息
getEleInfo(cb){
if(this.loaded || this.isContain) return
this.isContain=true;
let {windowHeight} = wx.getSystemInfoSync()
let query=wx.createSelectorQuery().in(this);
query.select('.time-limited-discount').boundingClientRect(rect=>{
if (rect.top<windowHeight && rect.top+rect.height>0) {
cb && cb()
}
this.isContain=false;
}).exec();
},
onChange(e) { onChange(e) {
this.setData({ timeData: e.detail }); this.setData({ timeData: e.detail });
}, },
...@@ -275,6 +299,8 @@ const componentOptions = { ...@@ -275,6 +299,8 @@ const componentOptions = {
}); });
}, },
getData() { getData() {
if(this.loaded) return
this.loaded=true
let { dimension } = this.data.datas.componentData; let { dimension } = this.data.datas.componentData;
if (dimension == 0) { if (dimension == 0) {
this.init(); this.init();
...@@ -287,7 +313,11 @@ const componentOptions = { ...@@ -287,7 +313,11 @@ const componentOptions = {
lifetimes: { lifetimes: {
created() {}, created() {},
ready() { ready() {
this.getData(); this.loaded=false;
this.isContain=false;
this.getEleInfo(()=>{
this.getData()
});
}, },
moved() {}, moved() {},
detached() {} detached() {}
...@@ -297,7 +327,11 @@ const componentOptions = { ...@@ -297,7 +327,11 @@ const componentOptions = {
pageLifetimes: { pageLifetimes: {
// 页面被展示 // 页面被展示
show() { show() {
this.getData(); this.loaded=false;
this.isContain=false;
this.getEleInfo(()=>{
this.getData()
});
const { isPageHidden } = this.data; const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时 // show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) { if (!isPageHidden) {
......
...@@ -125,6 +125,8 @@ Component({ ...@@ -125,6 +125,8 @@ Component({
console.log(73333381); console.log(73333381);
app.footerCallBack = function(params) { app.footerCallBack = function(params) {
console.log("back"); console.log("back");
console.log(params,app.globalData.footerVal.componentData)
params.componentData.selectIconColor = app.globalData.footerVal.componentData.selectIconBackground == 1 ? 'val(--main-color)':params.componentData.selectIconColor
that.setData({ that.setData({
componentData: params.componentData, componentData: params.componentData,
list: params.componentData.list list: params.componentData.list
...@@ -136,6 +138,8 @@ Component({ ...@@ -136,6 +138,8 @@ Component({
that.data.selected && that.data.selected &&
params.componentData["styleSelectionNum"] == 1; params.componentData["styleSelectionNum"] == 1;
console.log("87777777", mm); console.log("87777777", mm);
console.log(that.data.componentData,'componentData')
}; };
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<!-- {{index}}{{selected}}--{{Math.ceil(5/2-1)}}--{{mm}} --> <!-- {{index}}{{selected}}--{{Math.ceil(5/2-1)}}--{{mm}} -->
<!-- &&componentData['styleSelectionNum']==1 --> <!-- &&componentData['styleSelectionNum']==1 -->
<!-- 图标 --> <!-- 图标 -->
<view class="item"> <view class="item" class="{{index == selected ? 'current' : ''}}">
<view> <view>
<view wx:if="{{item.iconType==0||!item.iconType}}"> <view wx:if="{{item.iconType==0||!item.iconType}}">
<view class="antt {{item.icon}}" style="font-size:{{componentData.defaultIcon==1 ? '36rpx' : (componentData.defaultIconSize*2 + 'rpx')}};color:{{index==selected?componentData.selectIconColor:componentData.defaultIconColor}}"></view> <view class="antt {{item.icon}}" style="font-size:{{componentData.defaultIcon==1 ? '36rpx' : (componentData.defaultIconSize*2 + 'rpx')}};color:{{index==selected?componentData.selectIconColor:componentData.defaultIconColor}}"></view>
......
...@@ -1296,3 +1296,6 @@ ...@@ -1296,3 +1296,6 @@
line-height: 36rpx; line-height: 36rpx;
z-index: 999; z-index: 999;
} }
.current view{
color: var(--main-color);
}
\ No newline at end of file
// static/nativeComponents/module/SkeletonBlock/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
type: {
type: String,
default: "row",
},
// 渲染块行数
row: {
type: Number,
default: 4,
},
// 列数
col: {
type: Number,
default: 1,
},
// 模块高度
height: {
type: Number,
default: 30,
},
},
/**
* 组件的初始数据
*/
data: {
blockNumber : 0,
SkeletonItemWidth : 0
},
ready() {
if (this.data.type == 'flow'){
this.setData({
blockNumber : 4
})
}else{
this.setData({
blockNumber: this.properties.row * this.properties.col
})
}
this.setData({
SkeletonItemWidth: this.data.type == 'row' ? '100%' :'48%'
})
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/module/SkeletonBlock/index.wxml-->
<view wx:if="loading" class="SkeletonBlock {{type == 'row' ? 'SkeletonRow' : ''}} {{type == 'col' ? 'SkeletonCol' :''}} {{type == 'flow' ? 'SkeletonFlow' : ''}}" style="--blockWidth : 48%">
<view class="skeleton-animate SkeletonItem" wx:for="{{blockNumber}}" wx:key="index" style="width:{{SkeletonItemWidth}};padding-top:{{height}}%"></view>
</view>
\ No newline at end of file
/* static/nativeComponents/module/SkeletonBlock/index.wxss */
.SkeletonBlock{
position: relative;
}
.SkeletonBlock .SkeletonItem{
width: 100%;
margin-bottom: 32rpx;
padding-top: 30%;
background-color: #f2f3f5;
border-radius: 8rpx;
}
.SkeletonBlock .skeleton-animate{
animation: skeleton-blink 1.2s ease-in-out infinite;
}
@keyframes skeleton-blink {
50% {
opacity: 0.6;
}
}
.SkeletonRow .SkeletonItem{
width: 100%;
box-sizing: border-box
}
.SkeletonCol{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.SkeletonFlow{
padding: 0;
height: 620rpx;
}
.SkeletonFlow .SkeletonItem{
position: absolute;
top: 0;
margin-top: 0;
}
.SkeletonFlow .SkeletonItem:nth-child(2n){
position: absolute;
left: 52%;
}
.SkeletonFlow .SkeletonItem:nth-child(1){
height: 360rpx;
}
.SkeletonFlow .SkeletonItem:nth-child(2){
height: 280rpx;
}
.SkeletonFlow .SkeletonItem:nth-child(3){
top: calc(360rpx + 32rpx);
height: 240rpx;
}
.SkeletonFlow .SkeletonItem:nth-child(4){
top: calc(280rpx + 32rpx);
height: 32r0px;
}
\ No newline at end of file
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