Commit 1b81344b by liujinsa

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

parents 8d2ef061 2d1faf1f
......@@ -211,13 +211,6 @@
content: "\e6cf";
}
page {
--main-color: #ffffff;
--minor-color: #ffffff;
--theme-color:#EF114C;
}
@font-face {
font-family: "ant";
src: url('//cdn.mayi888.com/static/font/ant-171b61a6fb.eot');
......
<script>
import shop from "@/api/shop";
import {themeColor} from "@/utils/mayi"
export default {
created() {
// NODE_ENV
......@@ -10,7 +10,7 @@ export default {
process.env.NODE_ENV == "development" ||
JSON.stringify(extConfig) == "{}"
) {
extConfig = { mixid: "antgood" };
extConfig = { mixid: "antgood", shopid:67};
}
console.log("1444444444", extConfig.mixid);
this.$store.commit("setExtConfig", extConfig.mixid);
......@@ -40,12 +40,12 @@ export default {
// 初始
this.getShopInfo(extConfig);
// 页面配置信息
this.getThemePage();
this.getThemePage(extConfig);
},
methods: {
//商城配置
getShopInfo(extConfig) {
shop.getShopInfo({ shopMixId: "antgood" }).then((res) => {
getShopInfo({mixid}) {
shop.getShopInfo({ shopMixId: mixid }).then((res) => {
if (res.data.code == 200) {
let mpApp = getApp();
// 商城基本数据
......@@ -69,14 +69,20 @@ export default {
mpApp.footerCallBack(footerVal);
}
}
// 设置主题色
themeColor['--main-color']=val.themeColor.mainColor
themeColor['--minor-color']=val.themeColor.minorColor
//
console.log(this.mpApp,'mmmmm74',themeColor)
}
});
},
getThemePage() {
getThemePage({mixid,shopid}) {
shop
.themePagesInfo({
shopid: 67,
shopMixId: "antgood",
shopid,
shopMixId: mixid,
})
.then((response) => {
if (response.data.code == 200) {
......@@ -128,4 +134,5 @@ export default {
/* @import url("../static/nicon/iconfont.css"); */
@import url("../static/font/iconfont.css");
@import url("../static/css/common.scss");
</style>
......@@ -16,5 +16,8 @@ console.log(process.env,'-----------------config------')
forward(data) {
return requestPOST(`${process.env.OLSHOP_URL}/article/forward`, data)
},
queryLocation(longitude,latitude){
return requestGET(`${process.env.OLSHOP_URL}/operatingArea/query_Location_operating_area_area_list?location=${longitude},${latitude}`)
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import "../static/nicon/iconfont.css"
import goodsApi from "./api/goods"
import orderApi from "./api/order"
import promoteApi from "./api/promote";
import indexApi from './api/index'
import { DFSImg } from "@/utils/index";
import { $themeToLink } from "@/utils/mayi"
......@@ -48,4 +49,24 @@ mpApp.$themeToLink = $themeToLink
mpApp.goodsApi = goodsApi;
mpApp.orderApi = orderApi;
mpApp.promoteApi = promoteApi;
mpApp.indexApi = indexApi;
mpApp.DFSImg = DFSImg;
if (!mpApp.globalData.setPopupStorage){
let popUpList = wx.getStorageSync('popUpList') || []
let arr = []
popUpList.forEach(item=> {
arr.push(item)
wx.removeStorageSync(item)
})
arr.forEach(item => {
popUpList.splice(popUpList.indexOf(item),1)
})
wx.setStorageSync('popUpList', popUpList)
}
\ No newline at end of file
......@@ -82,7 +82,7 @@
regionName : item.regionName,
regionType : item.regionType,
systemRegionId : item.systemRegionId,
areaGroupId : item.groupId,
areaGroupId : item.areaGroupId,
outId : item.outId
}))
}
......
......@@ -2,8 +2,8 @@
<div class="domain">
<!-- <view class="ant-daipinglun">1</view> -->
<!-- <goods-list id="goodsList"></goods-list> -->
<scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;" scroll-y="true">
<div style="position:relative">
<!-- <scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;overflow-y:auto;" scroll-y="true"> -->
<div style="position:relative;">
<ThemeDataPlant></ThemeDataPlant>
<div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner'">
......@@ -45,10 +45,19 @@
<div v-if="item.componentCode == 'video-player'">
<videoPlayer :datas="item"></videoPlayer>
</div>
<div v-if="item.componentCode == 'goods-search'">
<goods-search :datas="item"></goods-search>
</div>
<div v-if="item.componentCode == 'notice'">
<notice :datas="item"></notice>
</div>
<div v-if="item.componentCode == 'pop-up'">
<pop-up :datas="item"></pop-up>
</div>
</div>
<bottomCont></bottomCont>
</scroll-view>
<!-- </scroll-view> -->
<!-- <image
src="http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750"
></image>
......@@ -61,7 +70,7 @@
<div class="domain">abc
<van-button type="primary">按钮</van-button> -->
<!-- </div> -->
</div>
<share-popup></share-popup>
</div>
</template>
......@@ -100,17 +109,18 @@ export default {
},
onShareAppMessage(res) {
let shareVal={};
let {shopCode} = app.globalData.shopInfo;
if (res.from === "button") {
console.log(res.target,'-----------78');
return new Promise((resolve,reject)=>{
shop.getShopInfo({ shopMixId: "antgood" }).then(res=>{
shop.getShopInfo({ shopMixId: shopCode }).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",
path: "/pages/home/main",
imageUrl:logoUrl,
success: function(res) {
console.log("成功", res);
......@@ -156,6 +166,9 @@ export default {
},
onShow() {
setTabBarActive.bind(this)(checkTabbarPage('/'));
this.$mp.page.onPageScroll= (el)=>{
this.scrolls(el);
};
},
methods: {
init(pageList) {
......@@ -166,8 +179,9 @@ export default {
console.log("36", this.pageData);
},
scrolls(el){
console.log('scroll')
if(this.$mp.page.selectComponent(".goodsListItem")){
this.$mp.page.selectComponent(".goodsListItem").getScroll(el);
}
},
scrolltolower(){
console.log("scrolltolower")
......
......@@ -8,6 +8,9 @@
"area-navigation":"/static/nativeComponents/AreaNavigation/index",
"cube-nav":"/static/nativeComponents/CubeNav/index",
"float-button":"/static/nativeComponents/FloatButton/index",
"goods-search":"/static/nativeComponents/GoodsSearch/index",
"notice":"/static/nativeComponents/Notice/index",
"pop-up":"/static/nativeComponents/PopUp/index",
"share-popup":"/static/nativeComponents/SharePopup/index"
},
"enablePullDownRefresh":true
......
......@@ -46,7 +46,7 @@ export function getQueryVariable(query,variable) {
}
//补全图片路径
export function DFSImg(path, w, h) { //
export function DFSImg(path, w, h,type=0) { //
// if (path == null || path == '') {
// return require('~/static/images/noImg.png');
// }
......@@ -57,8 +57,13 @@ export function DFSImg(path, w, h) { //
if (h) style += ',h_' + h;
if (style.length > 0) {
if(path.indexOf('?x-oss-process') == -1){
if(type == 1){
path += '?x-oss-process=image/resize,limit_0' + style
}else{
path += '?x-oss-process=image/resize,m_pad,limit_0' + style
}
}
}
if (path.indexOf('http') == 0) {
return path;
......
// 主题色
export let themeColor={
"--main-color": "#ffffff",
"--minor-color": "#ffffff"
}
// 获取link 中页面地址(link兼容 有object或者string)
export function getUrlofLink(data) {
return data.link
......
// static/nativeComponents/AreaNavigation/index.js
const app = getApp()
const { indexApi } = app;
Component({
/**
* 组件的属性列表
......@@ -57,14 +58,7 @@ Component({
const latitude = res.latitude
const longitude = res.longitude
console.log('组件2', _this.data.designateAreaObj)
wx.request({
url: `http://test-m-shop.mayi888.cn/test/innerApi/shopApiService/operatingArea/query_Location_operating_area_area_list?location=${longitude},${latitude}`,
header: {
'Shop-Mixid': 'Id9uwD'
},
success(data) {
console.log('组件3', _this.data.designateAreaObj)
indexApi.queryLocation(longitude, latitude).then(data => {
if (data.data.code == '200') {
let city = ''
data.data.data.forEach(item => {
......@@ -82,27 +76,38 @@ Component({
})
}
if(!wx.getStorageSync('location')){
_this.setData({
'designateAreaObj.id': _this.data.positionCity.operatingAreaAreaId,
'designateAreaObj.regionName': _this.data.positionCity.regionName,
'designateAreaObj.regionType': _this.data.positionCity.regionType,
'designateAreaObj.systemRegionId': _this.data.positionCity.systemRegionId,
'designateAreaObj.outId': _this.data.positionCity.outId,
})
}
console.log(_this.data.positionCity, '定位城市信息')
console.log(_this.data.designateAreaObj,'组件信息')
console.log(_this.data.designateAreaObj, '组件信息')
let str = JSON.stringify({
id: _this.data.positionCity.operatingAreaAreaId,
regionName: _this.data.positionCity.regionName,
regionType: _this.data.positionCity.regionType,
systemRegionId: _this.data.positionCity.systemRegionId,
outId: _this.data.positionCity.outId,
areaGroupId: _this.data.positionCity.areaGroupId,
areaGroupId: _this.data.designateAreaObj.areaGroupId,
})
console.log(str,'str.......')
console.log(str, 'str.......')
wx.setStorageSync('location', str)
if (_this.data.positionCity.operatingAreaAreaId == _this.data.designateAreaObj.id){
if (_this.data.positionCity.operatingAreaAreaId == _this.data.designateAreaObj.id) {
_this.setData({
positionName: _this.data.positionCity.regionName
})
}else{
} else {
_this.setData({
changeShow : true
changeShow: true
})
}
......@@ -127,8 +132,7 @@ Component({
}
}
}
},
fail(){
}).catch(err => {
console.log('定位')
if (!wx.getStorageSync('location')) {
if (_this.data.designateAreaObj.id) {
......@@ -147,9 +151,7 @@ Component({
})
}
}
}
})
},
fail(error) {
console.log('定位失败')
......@@ -289,7 +291,7 @@ Component({
changeOtherCity(){
console.log(getCurrentPages())
wx.navigateTo({
url: '/pages/changeAdr/main?areaGroupId=' + this.data.datas.componentData.designateAreaObj.areaGroupId,
url: '/pages/changeAdr/main?areaGroupId=' + this.data.designateAreaObj.areaGroupId,
})
},
toSearchPage(){
......
......@@ -36,7 +36,6 @@
show="{{noShow}}"
use-slot
showConfirmButton="{{false}}"
class="change-dialog"
>
<view class="change-dialog">
<view style="line-height:60rpx">您所在的地区暂未开放</view>
......@@ -48,7 +47,6 @@
show="{{changeShow}}"
use-slot
showConfirmButton="{{false}}"
class="change-dialog"
>
<view class="change-dialog">
<view style="line-height:60rpx">
......
......@@ -39,6 +39,10 @@ Component({
let _this = this;
let columnWidthArr = ['100%', '50%', '33.3%', '25%', '20%', '16.6%']
this.data.datas.componentData.imgList.forEach(item => {
item.imageUrl = item.imageUrl ? app.DFSImg(item.imageUrl,400,400) : ''
})
this.setData({
imgList: this.data.datas.componentData.imgList.filter(item => item.visible == undefined || item.visible == 1),
getColumnWidth: columnWidthArr[this.data.datas.componentData.columnNum - 1],
......@@ -65,26 +69,26 @@ Component({
if (res) {
if (_this.data.datas.componentData.rowNum == 1){
_this.setData({
cube3H: res.height * 2 * _this.data.datas.componentData.rowNum
cube3H: res.height * _this.data.datas.componentData.rowNum
})
} else if (_this.data.datas.componentData.rowNum == 2){
if(_this.data.imgList.length / _this.data.datas.componentData.columnNum > 1){
_this.setData({
cube3H: res.height * 2 * _this.data.datas.componentData.rowNum
cube3H: res.height * _this.data.datas.componentData.rowNum
})
}else{
_this.setData({
cube3H: res.height * 2 * 1
cube3H: res.height * 1
})
}
} else if (_this.data.datas.componentData.rowNum == 3){
if (_this.data.datas.componentData.columnNum == 1){
_this.setData({
cube3H: res.height * 2 * (_this.data.imgList / _this.data.datas.componentData.rowNum)
cube3H: res.height * (_this.data.imgList / _this.data.datas.componentData.rowNum)
})
}else{
_this.setData({
cube3H: res.height * 2 * (Math.ceil(_this.data.imgList.length / _this.data.datas.componentData.columnNum))
cube3H: res.height * (Math.ceil(_this.data.imgList.length / _this.data.datas.componentData.columnNum))
})
}
......@@ -128,9 +132,11 @@ Component({
wArr[_this.data.datas.componentData.columnNum - 1]
})
}
_this.setData({
w: wArr[_this.data.datas.componentData.columnNum - 1]
})
console.log(_this.data.w)
if (_this.data.wrapW > cube2W) {
_this.setData({
navShow: true
......
......@@ -7,20 +7,20 @@
<image wx:if="{{item.imageUrl}}" src="{{item.imageUrl}}"></image>
</view>
</view>
<view class="item-title" style="font-size:{{datas.componentData.textSize * 2}}rpx;color:{{datas.componentData.fontColor}};height:{{datas.componentData.textSize / 12}}em;line-hieght:{{datas.componentData.textSize / 12}}em">{{ item.title }}</view>
<view class="item-title" style="font-size:{{datas.componentData.textSize * 2}}rpx;color:{{datas.componentData.fontColor}};height:{{datas.componentData.textSize / 12}}em;line-height:{{datas.componentData.textSize / 12}}em">{{ item.title }}</view>
</view>
</view>
<view wx:if="{{datas.componentData.layoutType == 1}}" style="position:relative;background-color:{{datas.componentData.backgroundColor || ''}};border-radius:{{datas.componentData.moduleRadius * 2}}rpx;padding-bottom:{{navShow ? '20rpx' : '0'}}">
<view wx:if="{{datas.componentData.layoutType == 1}}" style="position:relative;background-color:{{datas.componentData.backgroundColor || ''}};border-radius:{{datas.componentData.moduleRadius}}px;padding-bottom:{{navShow ? '10px' : '0'}}">
<view class="cube2 clearfix" style="overflow-x:auto;overflow-y:hidden" bindtouchmove="touchmove">
<view class="clearfix" style="width:{{wrapW * 2}}rpx" id="wrapW">
<view class="cube-item" wx:for="{{imgList}}" style="padding-top:{{datas.componentData.lineHeight * 2}}rpx;padding-bottom:{{datas.componentData.lineHeight *2}}rpx;width:{{w * 2}}rpx;position:relative" bindtap="onclickHandle" data-item="{{item}}">
<view class="clearfix" style="width:{{wrapW}}px" id="wrapW">
<view class="cube-item" wx:for="{{imgList}}" style="padding-top:{{datas.componentData.lineHeight}}px;padding-bottom:{{datas.componentData.lineHeight}}px;width:{{w}}px;position:relative" bindtap="onclickHandle" data-item="{{item}}">
<view style="padding-left:{{getImgSize}}%;padding-right:{{getImgSize}}%">
<view class="item-img {{item.imageUrl == '' ? 'item-bg' : ''}}">
<image wx:if="{{item.imageUrl}}" src="{{item.imageUrl}}"></image>
</view>
</view>
<view class="item-title" style="font-size:{{datas.componentData.textSize * 2}}rpx;color:{{datas.componentData.fontColor}};height:{{datas.componentData.textSize / 12}}em;line-hieght:{{datas.componentData.textSize / 12}}em">{{item.title}}
<view class="item-title" style="font-size:{{datas.componentData.textSize}}px;color:{{datas.componentData.fontColor}}">{{item.title}}
</view>
</view>
</view>
......@@ -33,16 +33,16 @@
</view>
<view class="cube3 clearfix" wx:if="{{datas.componentData.layoutType == 2}}" style="background-color:{{datas.componentData.backgroundColor || ''}};border-radius:{{datas.componentData.moduleRadius * 2}}rpx;">
<swiper indicator-dots="{{true}}" style="height:{{cube3H}}rpx">
<swiper-item wx:for="{{swiperList}}" style="width:{{swiperItemW*2}}rpx">
<view class="cube-item" style="padding-top:{{datas.componentData.lineHeight * 2}}rpx;padding-bottom:{{datas.componentData.lineHeight * 2}}rpx;width:{{getColumnWidth}};position:relative" wx:for-item="item1" wx:for="{{item}}" data-item="{{item1}}" bindtap="onclickHandle">
<view class="cube3 clearfix" wx:if="{{datas.componentData.layoutType == 2}}" style="background-color:{{datas.componentData.backgroundColor || ''}};border-radius:{{datas.componentData.moduleRadius}}px;">
<swiper indicator-dots="{{true}}" style="height:{{cube3H}}px">
<swiper-item wx:for="{{swiperList}}" style="width:{{swiperItemW}}px">
<view class="cube-item" style="padding-top:{{datas.componentData.lineHeight}}px;padding-bottom:{{datas.componentData.lineHeight}}px;width:{{getColumnWidth}};position:relative" wx:for-item="item1" wx:for="{{item}}" data-item="{{item1}}" bindtap="onclickHandle">
<view style="padding-left:{{getImgSize}}%;padding-right:{{getImgSize}}%">
<view class="item-img {{item1.imageUrl == '' ? 'item-bg' : ''}}">
<image wx:if="{{item1.imageUrl}}" src="{{item1.imageUrl}}"></image>
</view>
</view>
<view class="item-title" style="font-size:{{datas.componentData.textSize * 2}}rpx;color:{{datas.componentData.fontColor}};height:{{textSize / 12}}em;line-hieght:{{textSize / 12}}em">{{item1.title}}
<view class="item-title" style="font-size:{{datas.componentData.textSize}}px;color:{{datas.componentData.fontColor}}">{{item1.title}}
</view>
</view>
</swiper-item>
......
<!--static/nativeComponents/FloatButton/index.wxml-->
<movable-area class="float-botton">
<movable-view class="movable-view {{datas.componentData.style==0 ? 'icon-class':'img-class'}}" direction="all" style="width:{{datas.componentData['sizeInfo']['width']/12}}em;height:{{datas.componentData['sizeInfo']['width']/12}}em;top:{{datas.componentData['position']['y']}}em;left:{{datas.componentData['position']['y']}}em;background-color:{{datas.componentData.style==0?datas.componentData['backgroundColor']:'transparent'}};box-shadow:{{(datas.componentData.style==0 && datas.componentData.boxShadow)?'rgba(0, 0, 0, 0.5) 0px 0px 10rpx':'none'}}" bindtap="clickHandler">
<movable-view class="movable-view {{datas.componentData.style==0 ? 'icon-class':'img-class'}}" direction="all" style="width:{{datas.componentData['sizeInfo']['width'] * 2}}rpx;height:{{datas.componentData['sizeInfo']['width'] *2}}rpx;top:{{datas.componentData['position']['y'] * 12 * 2}}rpx;left:{{datas.componentData['position']['x'] * 12 * 2}}rpx;background-color:{{datas.componentData.style==0?datas.componentData['backgroundColor']:'transparent'}};box-shadow:{{(datas.componentData.style==0 && datas.componentData.boxShadow)?'rgba(0, 0, 0, 0.5) 0px 0px 10rpx':'none'}}" bindtap="clickHandler">
<view wx:if="{{datas.componentData.style==0}}" class="content">
<view wx:if="{{datas.componentData.icon.type==1}}">
<i
......@@ -10,7 +10,7 @@
></i>
<i
wx:else
class="content-img antt iconfont {{datas.componentData.icon.src}}"
class="content-img iconfont {{datas.componentData.icon.src}}"
style="font-size:1.6em;color:{{datas.componentData['contentColor']}}"
>
</i>
......
......@@ -26,12 +26,14 @@ const componentOptions = {
// 组件生命周期
lifetimes: {
created() {},
ready() {},
ready() {
this.init();
},
moved() {},
detached() {}
},
attached() {
this.init();
},
definitionFilter() {},
// 页面生命周期
......@@ -220,8 +222,8 @@ const componentOptions = {
)
: [];
item.shopLogoUrl = DFSImg(item.shopLogoUrl);
item.coverImage = DFSImg(item.coverImage, 100, 100, 0);
item.productImgUrl = DFSImg(item.productImgUrl, 100, 100, 0);
item.coverImage = DFSImg(item.coverImage, 400, 400, 1);
item.productImgUrl = DFSImg(item.productImgUrl, 400, 400, 1);
item.minPrice = Number(item.minPrice).toFixed(2);
item.qty = Number(item.qty);
item.saleQty = Number(item.saleQty);
......@@ -242,22 +244,20 @@ const componentOptions = {
item.getSaleTime = this.getSaleTime(item.saleTime);
}
});
setTimeout(() => {
this.setData({
"datas.componentData.goodsList": goodsList
});
if (type == 1) {
// 初始化
if (this.selectComponent("#waterfallFlow")) {
this.selectComponent("#waterfallFlow").initList();
this.selectComponent("#waterfallFlow").initList(goodsList);
}
} else {
// 滚动加载
if (this.selectComponent("#waterfallFlow")) {
this.selectComponent("#waterfallFlow").reLoadPro();
this.selectComponent("#waterfallFlow").reLoadPro(goodsList);
}
}
}, 0);
},
getSaleTime(val) {
return new Date(val.replace(/-/g, "/")).getTime() - new Date().getTime();
......
// static/nativeComponents/GoodsSearch/index.js
let app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
datas: {
type: Object
}
},
/**
* 组件的初始数据
*/
data: {
backgroundColor : '',
borderColor : '',
placeholderValue : ''
},
ready(){
this.setData({
backgroundColor: this.data.datas.componentData["showStyle"] == 1 &&
this.data.datas.componentData["backgroundColorShow"] ? this.data.datas.componentData["backgroundColor"] : "rgba(224, 224, 224, 0)",
})
if (this.data.datas.componentData["showStyle"] == 0){
this.setData({
borderColor : this.data.datas.componentData["borderColorShow"]
? this.data.datas.componentData["borderColor"]
: "rgba(224, 224, 224, 0)"
})
}else{
this.setData({
borderColor: 'transparent'
})
}
this.setData({
placeholderValue: this.data.datas.componentData.placeHolderVal ? this.data.datas.componentData.placeHolderVal : '搜索店铺内商品'
})
},
/**
* 组件的方法列表
*/
methods: {
toSearchPage(){
app.$themeToLink({
type: 1,
link: '/goodsSearch/goodsSearch?placeHolderText=' + (this.data.datas.componentData["placeHolderVal"] || '')
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/GoodsSearch/index.wxml-->
<view class="goods-search flex" style="background:{{datas.componentData.heapBgColor||''}}">
<view class="ipt flex {{datas.componentData.keywordPosition == 1 ? 'textCenter' : ''}} {{datas.componentData.showStyle == 0 ? 'my-hairline--all' :''}}" style="border-radius:{{2*(datas.componentData['radius']/100)*2}}em;border-radius:{{2*(datas.componentData['radius']/100)}}em;background:{{backgroundColor}};border-color:{{borderColor}}" bindtap="toSearchPage">
<i class="iconfont-common common-iconsousuo"></i>
<input style="width:{{placeholderValue.length*40}}rpx" disabled type="text" placeholder="{{placeholderValue}}">
</input>
</view>
</view>
/* static/nativeComponents/GoodsSearch/index.wxss */
@import "/static/font/common_icon.wxss";
.flex{
display: flex;
}
.goods-search{
font-size: 24rpx;
width: 100%;
height: 80rpx;
align-items:center;
}
.goods-search i{
margin: 0 20rpx;
color: #bbb;
}
.goods-search .ipt{
width: 96%;
margin: 0 auto;
height: 60rpx;
align-items: center;
position: relative;
border-width: 1rpx;
border-style: solid;
}
.goods-search .ipt input{
font-size: 28rpx;
color: #bbb;
}
.goods-search .textCenter{
justify-content: center;
}
// static/nativeComponents/Notice/index.js
let app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
datas : {
type : Object
}
},
/**
* 组件的初始数据
*/
data: {
timer:null,
newLeft : 0
},
ready(){
let marqueeWidth = 0;
let screenWidth = 0;
let _this = this
this.createSelectorQuery().select('.marquee').boundingClientRect(function(res){
if (res) {
marqueeWidth = res.width
_this.createSelectorQuery().select('.notice').boundingClientRect(function (res1) {
if (res1) {
screenWidth = res1.width
console.log(marqueeWidth, screenWidth, 'screenWidth')
if (marqueeWidth > screenWidth) {
_this.marqueeMove(marqueeWidth,screenWidth);
}else{
clearInterval(_this.data.timer);
_this.setData({
newLeft : 0
})
}
}
}).exec()
}
}).exec()
},
/**
* 组件的方法列表
*/
methods: {
marqueeMove(marqueeWidth,screenWidth){
clearInterval(this.data.timer);
this.data.timer = setInterval(() => {
this.setData({
newLeft : this.data.newLeft - 1
})
if(Math.abs(this.data.newLeft) >= marqueeWidth + 200){
this.setData({
newLeft: screenWidth
})
}
},10)
},
onclickHandle(){
app.$themeToLink(this.data.datas.componentData.link)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/Notice/index.wxml-->
<view class="notice-wrap" style="background-color:{{datas.componentData.backgroundColor}}">
<view class="notice" style="text-align:left;color:{{datas.componentData.fontColor}}; ">
<view class="marquee" style="left:{{newLeft * 2}}rpx" bindtap="onclickHandle">{{datas.componentData.content}}</view>
</view>
</view>
/* static/nativeComponents/Notice/index.wxss */
.notice{
font-size: 32rpx;
position: relative;
overflow: hidden;
height: 80rpx;
width: calc(100vw - 40rpx);
margin-left: 20rpx;
}
.marquee {
position: absolute;
height: 80rpx;
line-height: 80rpx;
/* width: 100%; */
margin: 0 auto;
white-space: nowrap;
box-sizing: border-box;
}
\ No newline at end of file
// static/nativeComponents/PopUp/index.js
let app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
datas:{
type:Object
}
},
/**
* 组件的初始数据
*/
data: {
timeout: null,
domainShow: false,
img : ''
},
detached(){
clearTimeout(this.data.timeout);
},
ready() {
this.setData({
img: app.DFSImg(this.data.datas.componentData.imageUrl,700,null,1)
})
if (this.getPopFlag() == 'true'){
this.setData({
domainShow : false
})
}else{
this.setData({
domainShow: true
})
if (this.data.datas.componentData.columnNum > 0 && this.data.datas.componentData.autoOff){
clearTimeout(this.data.timeout);
this.data.timeout = setTimeout(() => {
this.setData({
domainShow: false
})
this.setPopFlag('true')
}, this.data.datas.componentData.columnNum * 1000)
}
}
},
/**
* 组件的方法列表
*/
methods: {
getPopFlag() {
let routes = getCurrentPages()
let page = routes[routes.length - 1].route
return wx.getStorageSync(`${app.globalData.shopInfo.shopCode}_popFlag_${page}_${this.data.datas.id}`)
},
setPopFlag(value) {
app.globalData.setPopupStorage = 1;
let routes = getCurrentPages()
let page = routes[routes.length - 1].route
wx.setStorageSync(`${app.globalData.shopInfo.shopCode}_popFlag_${page}_${this.data.datas.id}`, value)
let popUpList = wx.getStorageSync('popUpList') || [];
popUpList.push(`${app.globalData.shopInfo.shopCode}_popFlag_${page}_${this.data.datas.id}`)
wx.setStorageSync('popUpList', popUpList)
console.log(app.globalData)
},
backHandle(){
this.setData({
domainShow : false
})
this.setPopFlag("true");
clearTimeout(this.data.timeout);
},
onclickHandle() {
app.$themeToLink(this.data.datas.componentData.link);
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/PopUp/index.wxml-->
<view class="pop-up" wx:if="{{domainShow}}">
<view class="shade"></view>
<view class="content">
<image src="{{img}}" bindtap="onclickHandle"></image>
<view class="back {{datas.componentData.backButtonSite=='bottom'?'back-bottom':'back-top'}}" bindtap="backHandle">
<em></em>
<em></em>
</view>
</view>
</view>
/* static/nativeComponents/PopUp/index.wxss */
.pop-up{
font-size: 20rpx;
position: fixed;
left: 0;
top: 0;
z-index: 5000;
width: 100%;
height: 100%;
}
.shade {
opacity: 0.7;
background-color: #000;
width: 100vw;
height: 100vh;
}
.content{
z-index: 5001;
width: 80%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.content image{
width: 100%
}
.content .back{
width: 48rpx;
height: 48rpx;
}
.content .back em{
display: block;
width: 100%;
height: 4rpx;
background-color: #fff;
margin-top: 20rpx;
box-shadow: 0 0 1rpx #fff;
}
em:nth-child(1) {
transform: translateY(0em) rotate(45deg);
}
em:nth-child(2) {
transform: translateY(-1.2em) rotate(-45deg);
}
.back-bottom {
margin: 40rpx auto 0;
}
.back-top {
position: absolute;
top: 20rpx;
right: 24rpx;
}
\ No newline at end of file
......@@ -36,7 +36,7 @@ const componentOptions = {
miniProgram: 0,
flag: false,
productId: "",
copyLink: "32132132"
copyLink: ""
},
// 数据监听器
observers: {},
......@@ -72,7 +72,7 @@ const componentOptions = {
copyText(e) {
let { text } = e.currentTarget.dataset;
let pagePath = getCurrentPages()[0].route;
// let copyVal = pagePath + text;
let copyVal = pagePath + text;
wx.setClipboardData({
data: copyVal,
success: function(res) {
......
......@@ -8,7 +8,7 @@
{{datas.singleItemActivityName}}
</view>
<view class="cover">
<image mode="center" src="{{datas.singleItemActivityCoverImage}}"></image>
<image src="{{datas.singleItemActivityCoverImage}}"></image>
</view>
<view class="countDown flex" wx:if="{{countDownShow}}">
<van-count-down
......
.activityListItem {
margin-bottom: 20rpx;
padding: 20rpx 0;
background: #fff;
border-radius: 8rpx;
......@@ -7,6 +6,7 @@
-moz-border-radius: 8rpx;
-ms-border-radius: 8rpx;
-o-border-radius: 8rpx;
margin-bottom: 20rpx;
}
.title {
padding: 8rpx 20rpx;
......@@ -23,6 +23,7 @@
}
.cover image {
width: 100%;
height: 100%;
}
.countDown {
padding: 4rpx 10rpx;
......
......@@ -210,6 +210,7 @@ const componentOptions = {
item.endTimeTimeStamp = new Date(item.endTime.replace(/-/g, "/")).getTime() - new Date().getTime();
item.singleItemActivityCoverImage = DFSImg(item.singleItemActivityCoverImage);
item.isStart = new Date(item.startTime.replace(/-/g, "/")).getTime() > new Date().getTime() ? true : false;
console.log(item.isEnd,'-----------------------213');
})
this.setData({ "datas.componentData.actList": list });
if (hideNum == actList.length) {
......
......@@ -54,23 +54,41 @@ Component({
contentList: [],
inj: 0,
clientHeight: 0, //窗口高度
goodsNum:0,
goodsNum: 0,
},
methods: {
// 初始化数组
initList() {
initList(goodsList) {
// 初始化容器
let { contentList, waterfallDeviationHeight } = this.data;
contentList[0] = [];
contentList[1] = [];
waterfallDeviationHeight = [0,0];
waterfallDeviationHeight = [0, 0];
this.setData({ contentList, waterfallDeviationHeight });
console.log(this.data.note, "-------------------185");
this.reLoadPro();
this.reLoadPro(goodsList);
},
async reLoadPro(goodsList) {
console.log(goodsList,'----------------------75')
// this.setHeight(this.data.goodsNum);
this.setHeight1(this.data.goodsNum,goodsList);
this.setData({
goodsNum:
goodsList.length > 0 ? goodsList.length + 1 : 0
});
},
async reLoadPro() {
this.setHeight(this.data.goodsNum);
this.setData({ goodsNum:this.data.note.length>0?this.data.note.length+1:0 });
setHeight1(i,goodsList) {
let itemList = goodsList.splice(i, goodsList.length);
let { contentList } = this.data;
itemList.forEach((item, index) => {
if (index % 2 == 0) {
contentList[0].push(item);
console.log(item.productName, "--------位置--左");
} else {
contentList[1].push(item);
console.log(item.productName, "--------位置--右");
}
});
this.setData({ contentList });
},
setHeight(i) {
let _this = this;
......@@ -147,12 +165,13 @@ Component({
.select("#waterfallFlow")
.boundingClientRect(function(res) {
if (res) {
console.log(el, "-------------118");
console.log(res, "---------------35");
let scrollTop = parseInt(el.target.scrollTop);
let scrollTop = parseInt(el.scrollTop);
let domHeight = parseInt(res.height);
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
if (scrollTop + _this.data.clientHeight >= domHeight - 150 && finished == false) {
if (
scrollTop + _this.data.clientHeight >= domHeight - 150 &&
finished == false
) {
_this.triggerEvent("onLoad");
}
}
......
......@@ -17,3 +17,9 @@ image {
.container-item:nth-child(2n + 2) {
padding-left: var(--proGap);
}
.loadBottom{
text-align: center;
color: #999;
font-size: 24rpx;
margin-top: 10rpx;
}
\ 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