Commit 730979ab by 李伟康

提交提交

1 parent f0011a86
import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 2
let index = 3
/**
*
......
......@@ -180,4 +180,19 @@ module.exports = {
...data
})
},
/** 获取活动分享链接 */
getActivitylink(id) {
return api.post({
method: 'scrm.api.shopmall.activity.get.shared',
id
})
},
/** 获取商品分享链接 */
getGoodslink(id) {
return api.post({
method: 'scrm.api.shopmall.goods.get.shared',
id
})
},
}
\ No newline at end of file
......@@ -122,7 +122,17 @@
opacity: 1;
}
}
@keyframes show-box-inset{
0% {
opacity: 0;
transform: scale(.1);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.safe-area {
display: block;
width: 100%;
......
/* components/Tab/Tab.wxss */
@import "../../assets/style/common.wxss";
@import "/assets/style/common.wxss";
.tab-box {
display: flex;
......
......@@ -16,13 +16,14 @@ Component({
value: '',
observer: async function (url, o) {
if (url) {
let isWebp = url.includes('webp')
let checkList = ['https://', 'http://']
let isFullAdd = checkList.map(item => url.includes(item)).some(item => item)
let isBASE64 = url.includes('data:image')
let isWebp = url.includes('webp'),
checkList = ['https://', 'http://'],
isFullAdd = checkList.map(item => url.includes(item)).some(item => item),
isBASE64 = url.includes('data:image'),
v = await systemApi.getImageVersion()
this.setData({
isWebp,
imagePath: `${isFullAdd || isBASE64 ? '' : IMG_URL}${url}` + (isBASE64 ? '' : `?v=${await systemApi.getImageVersion()}`)
imagePath: `${isFullAdd || isBASE64 ? '' : IMG_URL}${url}` + (isBASE64 ? '' : `?v=${v}`)
})
}
}
......
module.exports = Behavior({
methods: {
countDown({
timer,
hideDay,
targetObject
}) {
const {
name,
key
} = targetObject
let activityStatus = this.data[name][key] // activityStatus 1:未开始,2进行中,3已结束
const addZero = i => i < 10 ? `0${i}` : `${i}`,
[activityStartTime, activityEndTime] = timer,
start = wx.$util.iosTimeFormat(activityStartTime),
end = wx.$util.iosTimeFormat(activityEndTime)
if ((new Date().getTime() > new Date(end).getTime()) || activityStatus == 3) {
this.setData({
timeFlag: true,
finished: '活动已结束',
[`${name}.${key}`]: 3
})
return
}
if (new Date().getTime() >= new Date(start).getTime() && activityStatus != 2) {
this.setData({
[`${name}.${key}`]: 2
})
activityStatus = 2
}
let starTime = new Date(),
endTime = new Date(activityStatus == 2 ? end : start),
lefttime = parseInt((endTime.getTime() - starTime.getTime()) / 1e3),
d = parseInt(lefttime / (24 * 60 * 60)),
h = addZero(parseInt(hideDay ? lefttime / (60 * 60) : lefttime / (60 * 60) % 24)),
m = addZero(parseInt(lefttime / 60 % 60)),
s = addZero(parseInt(lefttime % 60)),
type = {
1: '距开始',
2: '距结束'
} [activityStatus]
if (this.time) {
clearTimeout(this.time)
this.time = null
}
let activityTime = {
dayList: [h, m, s],
type
}
if (d > 0) activityTime.day = `${d}天`
this.setData({
activityTime,
timeFlag: true
})
this.time = setTimeout(() => {
this.countDown({
timer,
hideDay,
targetObject
})
}, 1e3)
}
}
})
\ No newline at end of file
import kfMixin from './kfMixin'
import orderMixin from './orderMixin'
import afterSaleMixin from './afterSaleMixin'
import countdownMixin from './countdownMixin'
module.exports = {
kfMixin,
orderMixin,
afterSaleMixin,
countdownMixin
}
......@@ -4,8 +4,8 @@ page{
background: white;
}
.detail_container{
padding-bottom: calc(100rpx + var(--constantSafeAreaInsetBottom));
padding-bottom: calc(100rpx + var(--envSafeAreaInsetBottom));
padding-bottom: calc(120rpx + var(--constantSafeAreaInsetBottom));
padding-bottom: calc(120rpx + var(--envSafeAreaInsetBottom));
}
.account_area {
......@@ -220,7 +220,7 @@ page{
box-sizing: border-box;
background-color: #fff;
/* padding: 10rpx 30rpx; */
padding: 0 32rpx 0 90rpx;
padding: 20rpx 32rpx 20rpx 90rpx;
min-height: 100rpx;
left: 0;
right: 0;
......
......@@ -10,12 +10,12 @@ Page({
currentIndex: 0,
richText: '',
showModal: false,
noScroll: wx.p.wxApi.noScroll(),
isGameUse:false,
coupons:null,
showCoupons:false,
showComponent:false
},
noScroll(){},
onShow: function () {
this.toCheckMember()
},
......
......@@ -2,8 +2,8 @@ page {
background: white;
}
.commodity-detail-container{
padding-bottom: calc(100rpx + var(--constantSafeAreaInsetBottom));
padding-bottom: calc(100rpx + var(--envSafeAreaInsetBottom));
padding-bottom: calc(120rpx + var(--constantSafeAreaInsetBottom));
padding-bottom: calc(120rpx + var(--envSafeAreaInsetBottom));
}
.goods_scroll_wrapper {
padding: 46rpx 0 40rpx 40rpx;
......@@ -283,7 +283,7 @@ page {
justify-content: space-between;
background: white;
box-sizing: border-box;
padding: 0 32rpx 0 90rpx;
padding: 20rpx 32rpx 20rpx 90rpx;
}
.buy_btn {
......
......@@ -89,7 +89,7 @@
</view>
<view class="buy_btn flex_cc {{isHaveInventory?'':'disableBtn'}}" bind:tap="toBuyItem">{{isHaveInventory?'立即购买':'该商品已售罄'}}<text wx:if="{{isHaveInventory}}">(¥{{isOpen || !curentGoodsItem.noMemberPrice?curentGoodsItem.salesPrice:curentGoodsItem.noMemberPrice}})</text></view>
</view>
<view wx:if="{{showModal}}" class="overlay">
<view wx:if="{{showModal}}" class="overlay" catchtouchmove="noScroll">
<view class="overlay_boxs">
<view class="box_body" style="height:{{!isOpen?'700':'612'}}rpx">
<glsx-image webp class="boxs_icon" webp src="equity/scrm_modal_top_icon.png" />
......
......@@ -32,16 +32,7 @@ Page({
}
}
let temp = encodeURIComponent(JSON.stringify(bindInfo))
// //埋点
// let trackobj = {
// ...this.data.tempOptions,
// phone: para.phone
// }
// if (this.data.tempOptions) {
// wx.p.cache.storageApi.reportData(trackobj, false, true)
// }
wx.p.storage.set('bindInfo', temp)
// wx.p.router.reLaunch('/pages/tab/shopMall/index?tabIndex=1', { notIntercept: true })
wx.reLaunch({
url: '/pages/tab/equity/index',
});
......@@ -67,9 +58,6 @@ Page({
const userInfo = wx.p.storage.get('userInfo')
let { merchantId, phone } = userInfo
if (!phone) {
return
}
wx.p.wxApi.showLoading()
this.toPostFreeCard(merchantId, phone, userInfo)
},
......@@ -77,85 +65,12 @@ Page({
onLoad(options) {
let system = wx.getSystemInfoSync()
const { merchantId } = wx.p.storage.get('merchant_info')
// if (options && options.scene) {
// this.getLiveActivityId(decodeURIComponent(options.scene))
// } else {
// this.toGetFreeCardDay(merchantId)
// }
this.toGetFreeCardDay(merchantId)
this.setData({
paddingH: system.windowHeight * 0.11,
textpadding: system.windowHeight * 0.31
})
// 埋点---定保
// if (options.activity_id) {
// this.data.tempOptions = options
// wx.p.cache.storageApi.reportData(options, true, false)
// }
},
// 获取scene
getLiveActivityId(str) {
wx.p.api.shopmallApi
.getLiveActivityId({
id: str.split('=')[1]
})
.then(({ code, data }) => {
if (code == 0) {
let op = {}
data.scene.split('&').map(item => {
const [key, val] = item.split('=')
op[key] = val
})
if (op.merchantId) wx.p.storage.set('srcm_shopmall_merchant_id', op.merchantId)
if (op.openId) {
wx.setStorageSync('showServicesMerchantId', op.merchantId);
wx.p.eventbus.emit('SERVICES', true)
this.phone = op.phone
this.merchantId = op.merchantId
this.setData({
showAuthBtn: false,
})
this.op = op
} else {
this.login()
}
this.toGetFreeCardDay(op.merchantId)
}
})
},
// 客户id
// handlerCustomerId() {
// let customerId = wx.p.storage.get('srcm_shopmall_customer_id')
// if (customerId) wx.p.api.userApi.updataCustomerPhone()
// },
// freeLogin() {
// let op = this.op
// // wx.clearStorageSync();
// ssoApi.loginByOpenId({
// openId: op.openId
// }).then(({
// code,
// data,
// message
// }) => {
// wx.p.authStatus = code != 0
// if (code == '0') {
// wx.p.cache.storageApi.setUserInfo(data)
// wx.p.cache.storageApi.setSessionId(data.sessionId)
// wx.p.authStatus = false
// this.sessionId = data.sessionId
// this.toPostFreeCard(op.merchantId, op.phone, data)
// // wx.p.storage.set('srcm_shopmall_merchant_id', op.merchantId)
// // wx.setStorageSync('showServicesMerchantId', op.merchantId);
// // wx.p.eventbus.emit('SERVICES', true)
// // wx.p.storage.set('bindInfo', temp)
// // wx.p.router.reLaunch('/pages/tab/shopMall/index?tabIndex=1', { notIntercept: true })
// } else {
// wx.p.wxApi.showToast(message || '系统异常')
// }
// })
// },
onUnload: function () {
//wx.p.cache.storageApi.customerbehavior(2)
}
})
<view class="freecard_container" style="padding-bottom:{{paddingH}}rpx;box-sizing: border-box;">
<glsx-image webp class="bgIcon"src="equity/freecard_bg_icon.png" />
<view class="wrapper2" style="top:{{textpadding}}rpx">
<view class="dayText">
{{freeDay}}
<text class="mintext">天</text>
</view>
<glsx-image webp class="bottomIcon" mode="widthFix" src="equity/mini_new_freecard_icon_text.png" />
</view>
<view class="wrapper1">
<!-- <view class="btnText" bind:tap="tofreeReceive">免费领取</view> -->
<!-- <block wx:if="{{showAuthBtn}}">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="auth-button"></button>
</block> -->
<glsx-image webp bind:tap="tofreeReceive" webp class="bottomIcon animaiton" mode="widthFix" src="equity/freecard_btn_icon_new.png" />
</view>
<view style="height:22rpx"></view>
<view class="wrapper1">
<glsx-image webp class="bottomIcon" webp mode="widthFix" src="equity/new_freecard_icon.png" />
<glsx-image webp class="bgIcon" src="equity/freecard_bg_icon.png" />
<view class="wrapper2" style="top:{{textpadding}}rpx">
<view class="dayText">
{{freeDay}}
<text class="mintext">天</text>
</view>
<glsx-image webp class="bottomIcon" mode="widthFix" src="equity/mini_new_freecard_icon_text.png" />
</view>
<view class="wrapper1">
<!-- <view class="btnText" bind:tap="tofreeReceive">免费领取</view> -->
<glsx-image webp bind:tap="tofreeReceive" webp class="bottomIcon animaiton" mode="widthFix" src="equity/freecard_btn_icon_new.png" />
</view>
<view style="height:22rpx"></view>
<view class="wrapper1">
<glsx-image webp class="bottomIcon" webp mode="widthFix" src="equity/new_freecard_icon.png" />
</view>
</view>
<services/>
\ No newline at end of file
<services />
\ No newline at end of file
/* components/Sku/Sku.wxss */
@import '/style/common.wxss';
@import '/assets/style/common.wxss';
.sku {
position: fixed;
......
......@@ -6,7 +6,12 @@ import {
const navStyle = 'background-color: transparent;'
let navBarHeight = 38
import NP from 'number-precision'
import {
countdownMixin
} from '~/mixins/index'
Page({
behaviors: [countdownMixin],
/**
* 页面的初始数据
*/
......@@ -111,11 +116,6 @@ Page({
navStyle: e.scrollTop >= navBarHeight ? '' : navStyle
})
},
goodsActionReady(e) {
this.setData({
padding_bottom: e.detail
})
},
showSkuFun() {
this.setData({
showSku: true
......@@ -150,7 +150,9 @@ Page({
this.join()
}
},
pay(e) {
async pay(e) {
const loginStatus = await wx.p.router.intercept()
if (loginStatus) return
let {
isActivity,
isLive,
......@@ -160,12 +162,6 @@ Page({
isDefault
} = this.data
let stock
if (wx.$authStatus) {
wx.navigateTo({
url: '/pages/Login/Login'
})
return
}
let params = {
orderSource: 1
}
......@@ -387,7 +383,13 @@ Page({
activeSku
})
if (isActivity) this.countDown([data.startTime, data.endTime])
if (isActivity) this.countDown({
timer: [data.startTime, data.endTime],
targetObject: {
name: 'goodsInfo',
key: 'activityStatus'
}
})
wx.hideLoading()
} else {
wx.hideLoading()
......@@ -484,6 +486,34 @@ Page({
})
})
},
//分享海报
sharePoster(e) {
const {
isActivity,
posterUrl,
id
} = this.data, target = isActivity ? 'getActivitylink' : 'getGoodslink'
if (!posterUrl) {
wx.p.wxApi.showLoading('加载中...')
wx.p.api.shopmallApi[target](id).then(data => {
if (data) {
this.setData({
posterUrl: data.posterUrl
})
}
wx.hideLoading()
})
}
this.setData({
showPoster: true
})
},
hidden() {
this.setData({
showPoster: false
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......@@ -522,56 +552,5 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
countDown(params) {
let {
activityStatus
} = this.data.goodsInfo
// activityStatus 1:未开始,2进行中,3已结束
const addZero = i => (i < 10 ? `0${i}` : `${i}`)
let [activityStartTime, activityEndTime] = params
const start = iosTimeFormat(activityStartTime)
const end = iosTimeFormat(activityEndTime)
if (new Date().getTime() > new Date(end).getTime() || activityStatus == 3) {
clearTimeout(this.time)
this.setData({
timeFlag: true,
finished: '活动已结束'
})
return
}
if (new Date().getTime() >= new Date(start).getTime() && activityStatus != 2) {
this.setData({
'goodsInfo.activityStatus': 2
})
activityStatus = 2
}
let starTime = new Date()
let endTime = new Date(activityStatus == 2 ? end : start)
let lefttime = parseInt((endTime.getTime() - starTime.getTime()) / 1000)
let d = parseInt(lefttime / (24 * 60 * 60))
let h = parseInt((lefttime / (60 * 60)) % 24)
let m = parseInt((lefttime / 60) % 60)
let s = parseInt(lefttime % 60)
h = addZero(h)
m = addZero(m)
s = addZero(s)
let type = {
1: '距开始',
2: '距结束'
} [activityStatus]
if (this.time) clearTimeout(this.time)
this.time = setTimeout(() => {
let dayList = [h, m, s]
let activityTime = {
dayList,
type
}
if (d > 0) activityTime.day = `${d}天`
this.setData({
activityTime,
timeFlag: true
})
this.countDown(params)
}, 1 * 1000)
}
noScroll() {}
})
\ No newline at end of file
......@@ -4,7 +4,10 @@
align-items: center;
position: relative;
}
.layout{
padding-bottom: calc(140rpx + var(--constantSafeAreaInsetBottom));
padding-bottom: calc(140rpx + var(--envSafeAreaInsetBottom));
}
.navigation-bar {
position: fixed;
top: 0;
......@@ -408,8 +411,8 @@
color: #282829;
line-height: 40rpx;
padding: 0 0 20rpx 0;
white-space:normal;
word-break:break-all;
white-space: normal;
word-break: break-all;
}
......@@ -447,7 +450,8 @@
background-color: #333333;
border-radius: 50%;
}
.user-portrait image{
.user-portrait image {
border-radius: 50%;
}
......@@ -481,32 +485,36 @@
background-color: #e7e7e7;
margin-bottom: 10rpx;
}
.goods-comment .comment-images .icon image {
border-radius: 8rpx;
}
.share {
width: 108rpx;
height: 34rpx;
background: rgba(252, 91, 50, 0.1);
border-radius: 4rpx;
height: 44rpx;
background: #EFDEE0;
border-radius: 22rpx;
font-size: 24rpx;
color: var(--btnColor);
line-height: 34rpx;
display: flex;
align-items: center;
position: absolute;
right: 0;
padding-left: 12rpx;
padding-left: 16rpx;
box-sizing: border-box;
&-icon {
width: 20rpx;
height: 22rpx;
margin-left: 8rpx;
}
}
.share text {
flex-shrink: 0;
}
.icon-goods-share {
transform: scale(0.54);
}
.model {
position: fixed;
......@@ -522,63 +530,32 @@
align-items: center;
justify-content: center;
}
.poster {
width: 540rpx;
height: 860rpx;
border-radius: 8rpx;
animation: show-box-inset .5s forwards;
}
.hidden{
height:100%;
overflow: hidden;
}
.shop {
height: 62rpx;
background-color: white;
padding: 30rpx;
display: flex;
align-items: center;
border-bottom: 2rpx solid #F7F8FA;
}
.shop .right {
width: 24rpx;
height: 18rpx;
margin: 0 14rpx 0 26rpx;
}
.shop .processBox {
display: flex;
}
.shop .processBox .describe {
margin-left: 8rpx;
}
.shop .processBox .describe .describeTop {
font-size: 24rpx;
color: #333333;
}
.shop .processBox .describe .describeBottom {
font-size: 20rpx;
color: #999999;
}
.shop .processBox image {
width: 60rpx;
height: 60rpx;
}
.goods-param .items {
min-height: 34rpx;
display: flex;
font-size: 24rpx;
padding: 32rpx 0;
}
.goods-param .items .labels {
width: 136rpx;
color: #656566;
}
.goods-param .items .values {
width: 490rpx;
color: #3B3B3D;
}
.tab-widget{
.tab-widget {
width: 100%;
height: 88rpx;
background: white;
......@@ -588,22 +565,26 @@
right: 0;
z-index: 999;
}
.tab-widget .tab-item{
.tab-widget .tab-item {
width: 50%;
height: 100%;
position: relative;
}
.tab-widget .tab-item .text{
.tab-widget .tab-item .text {
font-size: 28rpx;
color: #656566;
line-height: 40rpx;
}
.tab-widget .tab-item .text-ative{
.tab-widget .tab-item .text-ative {
font-weight: 500;
font-size: 28rpx;
color: #2C2C2C;
}
.tab-widget .tab-item .line{
.tab-widget .tab-item .line {
position: absolute;
left: 50%;
bottom: 0;
......
......@@ -12,7 +12,7 @@
活动重新配置中,请稍后重试
</view>
<block wx:if="{{goodsFlag}}">
<view class="{{posterUrl==''?'layout':'layout hidden'}} " style="padding-bottom:{{padding_bottom + 20}}px;">
<view class="layout">
<view class="banner-box">
<swiper class="banner" bindchange="changeBanner">
<block wx:for="{{goodsInfo.goodsDetailImageList}}" wx:key="index">
......@@ -99,6 +99,12 @@
<view class="flex">
<view class="name"> {{isActivity?goodsInfo.activityName:goodsInfo.goodsName}}
</view>
<view class="share" bindtap="sharePoster">
<text>分享</text>
<view class="share-icon">
<glsx-image src="mall/share.png"></glsx-image>
</view>
</view>
</view>
<block wx:if="{{!isActivity}}">
<view class="count">
......@@ -197,8 +203,15 @@
</block>
<coupon-goods show="{{showCoupon}}" only="{{only}}" couponData="{{couponData}}" bindclick="showCouponFun"></coupon-goods>
<block wx:if="{{navHeight && goodsFlag}}">
<goods-action bindready="goodsActionReady" pay-disabled="{{goodsInfo.activityStatus != 2 }}" stock="{{goodsInfo.goodsStock === 0}}" buyFlag="{{goodsInfo.buyFlag == 2}}" bindclick="goodsActionClick" hideShop="{{isActivity}}"></goods-action>
<goods-action pay-disabled="{{goodsInfo.activityStatus != 2 }}" stock="{{goodsInfo.goodsStock === 0}}" buyFlag="{{goodsInfo.buyFlag == 2}}" bindclick="goodsActionClick" hideShop="{{isActivity}}"></goods-action>
<block wx:if="{{activeSku}}">
<sku show="{{showSku}}" showName="showSku" isActivity="{{isActivity}}" skuData="{{goodsInfo}}" bindpay="pay" bindjoin="join"></sku>
</block>
</block>
<block wx:if="{{showPoster && posterUrl}}">
<view class="model" catchtouchmove="noScroll" bindtap="hidden">
<view class="poster" bindlongpress='save'>
<image webp src="{{posterUrl}}"></image>
</view>
</view>
</block>
\ No newline at end of file
/* components/Stepper/Stepper.wxss */
@import '/style/common.wxss';
@import "/assets/style/common.wxss";
.stepper-box {
display: flex;
......
......@@ -54,13 +54,15 @@ Page({
getLocation() {
let { currentAddress } = this.data
if (currentAddress) return
this.setData({
unauthorized: false
})
wx.getLocation({
type: 'gcj02'
})
.then(({ latitude, longitude }) => {
this.setData({
current: true,
unauthorized: false
current: true
})
mapApi.detailedAdrress([latitude, longitude]).then(detail => {
console.log(detail)
......
......@@ -9,6 +9,11 @@
padding: var(--margin);
background: #fff;
border-radius:var(--borderRadius);
height: 156rpx;
box-sizing: border-box;
.flex{
height: 100%;
}
}
.current .address-box {
......
......@@ -2,10 +2,12 @@
<view class="current">
<block wx:if="{{!current}}">
<block wx:if="{{unauthorized}}">
<view bindtap="authAddress">授权获取当前位置</view>
<view class="flex" bindtap="authAddress">授权获取当前位置</view>
</block>
<block wx:else>
获取当前位置中...
<view class="flex">
获取当前位置中...
</view>
</block>
</block>
<block wx:else>
......
......@@ -25,7 +25,7 @@
<button class="wx-auth-button text-center {{isAgree}}" bindtap="showTips">登录</button>
</block>
<block wx:else>
<button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="wx-auth-button text-center">微信登录</button>
<button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="wx-auth-button text-center">登录</button>
</block>
</view>
</block>
......@@ -38,7 +38,7 @@
<input maxlength="11" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写手机号" bindinput="input" data-name="mobile" class="input" value="{{mobile}}" />
</view>
<view class="login-item flex">
<input maxlength="4" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写验证码" bindinput="input" data-name="captcha" class="input" value="{{captcha}}" />
<input maxlength="4" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写验证码" bindinput="input" data-name="captcha" class="input" value="{{captcha}}" />
<button disabled="{{!mobile}}" class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</button>
</view>
</view>
......
// pages/tab/index/components/ChannelsModal/ChannelsModal.js
import {
systemApi
} from '~/api/index'
Component({
/**
* 组件的属性列表
......@@ -11,7 +14,7 @@ Component({
* 组件的初始数据
*/
data: {
showChannels: true
},
/**
......@@ -19,5 +22,139 @@ Component({
*/
methods: {
noScroll() {},
async init(auto = true) {
const {
finderUserName
} = await wx.p.api.systemApi.getMockData()
this.setData({
finderUserName: finderUserName || 'sph7YsAMEGQixoU'
})
this.getChannelsLiveInfo(auto)
},
getChannelsLiveInfo(auto) {
const _this = this,
{
finderUserName
} = this.data
wx.getChannelsLiveInfo({
finderUserName,
success(liveInfo) {
console.log(liveInfo, '视频号直播')
if (liveInfo.status == 3) {
_this.getChannelsLiveNoticeInfo(finderUserName, auto)
liveInfo = null
} else if (!auto) _this.close()
_this.setData({
liveInfo
})
},
fail(err) {
console.log(err)
_this.getChannelsLiveNoticeInfo(finderUserName, auto)
}
})
},
getChannelsLiveNoticeInfo(finderUserName, auto) {
const _this = this
wx.getChannelsLiveNoticeInfo({
finderUserName,
success(liveNoticeInfo) {
console.log(liveNoticeInfo, '视频号预告')
let startTime = liveNoticeInfo.startTime * 1e3,
month = new Date(startTime).format('M'),
day = new Date(startTime).format('d'),
time = new Date(startTime).format('hh:mm')
liveNoticeInfo = {
...liveNoticeInfo,
month,
day,
time
}
_this.setData({
liveNoticeInfo
})
if (!auto) _this.close()
},
fail(err) {
console.log(err)
_this.setData({
liveNoticeInfo: null
})
}
})
},
jumpLive() {
const {
liveInfo: {
feedId,
nonceId
},
finderUserName
} = this.data,
_this = this
wx.openChannelsLive({
finderUserName,
feedId,
nonceId,
success(res) {
_this.close()
},
fail(err) {
if (err && err.errMsg && !err.errMsg.includes('cancel')) wx.p.wxApi.showToast(err.errMsg)
}
})
},
reserve() {
this.close()
const {
noticeId
} = this.data.liveNoticeInfo
wx.reserveChannelsLive({
noticeId
})
},
close(e) {
if (e) this.setData({
animation: true
}, setTimeout(() => {
this.setBanner()
}, .5e3))
else this.setBanner()
},
async setBanner() {
const v = await systemApi.getImageVersion()
const {
liveInfo,
liveNoticeInfo,
finderUserName
} = this.data,
bannerImg = `https://img02.glsx.com.cn/weapp/resource/miniprogram/hmd/home/live/${liveInfo ? 'live' :'notice'}.png?v=${v}`,
thisPage = wx.p.router.getPageInstance()
let {
bannerList
} = thisPage.data,
item = liveInfo || liveNoticeInfo,
obj = {
bannerImg,
bannerType: 'channels',
type: liveInfo ? 1 : 0,
finderUserName,
...item,
}
if (!bannerList) bannerList = []
bannerList.unshift(obj)
thisPage.setData({
bannerList
})
this.setData({
showChannels: false
})
}
},
lifetimes: {
ready() {
this.init()
}
}
})
})
\ No newline at end of file
......@@ -17,15 +17,153 @@
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 590rpx;
height: 892rpx;
background: #8A303A;
border-radius: 16rpx;
transform: translate(-50%, -50%);
.live{
animation: show-live-box .5s forwards;
.close {
position: absolute;
top: 20rpx;
right: 20rpx;
width: 36rpx;
height: 36rpx;
z-index: 3;
}
.live-box {
width: 100%;
height: 700rpx;
overflow: hidden;
min-height: 994rpx;
.live-view {
height: 800rpx;
}
.live-info {
font-weight: 500;
font-size: 24rpx;
color: #FFFFFF;
text-align: center;
padding: 20rpx 55rpx 48rpx;
.text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.channels-btn {
margin: 20rpx auto 0;
}
}
}
.notice-bg {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.notice-box {
min-height: 892rpx;
position: relative;
z-index: 1;
.notice-title {
font-weight: 600;
font-size: 28rpx;
color: #FFFFFF;
letter-spacing: 2rpx;
padding: 24rpx 0;
text-align: center;
}
.notice-head-url {
width: 486rpx;
height: 480rpx;
position: absolute;
top: 112rpx;
left: 50%;
transform: translateX(-50%);
border-radius: 16rpx;
overflow: hidden;
}
.notice-time {
position: absolute;
left: 50%;
bottom: 208rpx;
transform: translateX(-50%);
width: 100%;
font-size: 60rpx;
color: #8A303A;
display: flex;
justify-content: center;
align-items: baseline;
line-height: 72rpx;
.unit {
font-size: 28rpx;
margin: 0 10rpx;
line-height: 40rpx;
}
}
.channels-btn {
position: absolute;
left: 50%;
bottom: 48rpx;
transform: translateX(-50%);
}
}
.channels-btn {
width: 264rpx;
height: 72rpx;
background-image: radial-gradient(circle at 12% 25%, #FFEDC9 0%, #E7AE6E 98%);
border-radius: 12rpx;
font-weight: 600;
font-size: 28rpx;
color: #000000;
letter-spacing: 2rpx;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.true {
animation: close-live-box 1s forwards;
overflow: hidden;
}
@keyframes close-live-box {
0% {
opacity: 1;
}
100% {
height: 140rpx;
opacity: 0;
top: 35%;
left: 0;
}
}
@keyframes show-live-box {
0% {
opacity: 0;
transform: translate(-50%, -50%) scale(.15);
}
100% {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
}
\ No newline at end of file
<view class="channels" catchtouchmove="noScroll">
<view class="channels-bg"></view>
<view class="channels-box">
<view class="live">
<channel-live feed-id="export/UzFfAgtgekIEAQAAAAAAHM8Vpj9h1gAAAAstQy6ubaLX4KHWvLEZgBPE46BkAUN6BI6HzNPgMIt-w4M44K3HYzfRJ5PGYESb" finder-user-name="sph7YsAMEGQixoU"></channel-live>
<block wx:if="{{(liveInfo || liveNoticeInfo) && showChannels}}">
<view class="channels {{animation}}" catchtouchmove="noScroll">
<view class="channels-bg"></view>
<view class="channels-box">
<view class="close" bindtap="close">
<glsx-image src="home/live/close.png" />
</view>
<block wx:if="{{liveInfo}}">
<view class="live-box">
<view class="live-view" bindtap="close">
<channel-live feed-id="{{liveInfo.feedId}}" finder-user-name="{{finderUserName}}"></channel-live>
</view>
<view class="live-info">
<view class="text">{{liveInfo.description}}</view>
<view class="channels-btn" bindtap="jumpLive">进入直播间</view>
</view>
</view>
</block>
<block wx:else>
<view class="notice-bg">
<glsx-image src="home/live/notice-bg.png"></glsx-image>
</view>
<view class="notice-box">
<view class="notice-title">
视频号直播预告
</view>
<view class="notice-head-url">
<image src="{{liveNoticeInfo.headUrl}}" />
</view>
<view class="notice-time">
{{liveNoticeInfo.month}}
<view class="unit">月</view>
{{liveNoticeInfo.day}}
<view class="unit day">日</view>
{{liveNoticeInfo.time}}
</view>
<view class="channels-btn" bindtap="reserve">立即预约</view>
</view>
</block>
</view>
</view>
</view>
\ No newline at end of file
</block>
\ No newline at end of file
......@@ -6,14 +6,23 @@ Component({
properties: {
bannerList: {
type: Array,
value: []
}
value: [],
observer(n) {
this.setData({
dotsList: new Array(n.length),
bannerIndex: 0
})
}
},
},
/**
* 组件的初始数据
*/
data: {},
data: {
dotsList: [],
bannerIndex: 0
},
/**
* 组件的方法列表
*/
......@@ -25,6 +34,21 @@ Component({
equity,
item
} = e.currentTarget.dataset
if (item.bannerType == 'channels') {
if (item.type) wx.openChannelsLive({
...item,
success(res) {
console.log(res)
},
fail(err) {
if (err && err.errMsg && !err.errMsg.includes('cancel')) wx.p.wxApi.showToast(err.errMsg)
}
})
else wx.reserveChannelsLive({
noticeId: item.noticeId
})
return
}
if (id) wx.p.router.go('/packageMall/pages/detail/detail', {
id,
isActivity: false,
......@@ -35,15 +59,10 @@ Component({
},
changePage(e) {
let {
bannerList
} = this.data
bannerList.map(i => i.active = false)
let {
current
} = e.detail
bannerList[current].active = true
this.setData({
bannerList
bannerIndex: current
})
},
}
......
<block>
<view class="banner">
<swiper class="swiper" bindchange="changePage" autoplay interval="5000">
<block wx:for="{{bannerList}}" wx:key="index">
<swiper-item>
<block>
<image webp src="{{item.bannerImg}}" class="banner-img" bindtap="jumpGoods" data-item="{{item}}" data-bannerType="{{item.bannerType}}" data-id="{{item.goods.id}}" data-url="{{item.linkUrl}}" data-equity="{{item.equity}}"></image>
</block>
</swiper-item>
</block>
</swiper>
<block wx:if="{{bannerList.length > 1}}">
<view class="banner-dots">
<block wx:for="{{bannerList}}" wx:key="index">
<view class="dots {{item.active?'active':''}}"></view>
</block>
</view>
<view class="banner">
<swiper class="swiper" bindchange="changePage" autoplay interval="5000" current="{{bannerIndex}}">
<block wx:for="{{bannerList}}" wx:key="index">
<swiper-item>
<image webp src="{{item.bannerImg}}" class="banner-img" bindtap="jumpGoods" data-item="{{item}}" data-bannerType="{{item.bannerType}}" data-id="{{item.goods.id}}" data-url="{{item.linkUrl}}" data-equity="{{item.equity}}"></image>
</swiper-item>
</block>
</swiper>
<block wx:if="{{dotsList.length}}">
<view class="banner-dots">
<block wx:for="{{dotsList}}" wx:key="index">
<view class="dots {{bannerIndex == index?'active':''}}"></view>
</block>
</view>
</block>
</block>
</view>
\ No newline at end of file
......@@ -51,5 +51,5 @@
}
.banner .banner-dots .dots.active {
background-color: #2A69FF;
background-color: var(--btnColor);
}
\ No newline at end of file
/* components/Tab/Tab.wxss */
@import "/style/common.wxss";
@import "/assets/style/common.wxss";
.tab-box {
display: flex;
......
......@@ -16,46 +16,9 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getChannelsLiveInfo()
this.getHomeConfig()
this.getActivityList()
},
async getChannelsLiveInfo() {
const {
finderUserName
} = await wx.p.api.systemApi.getMockData(),
_this = this
wx.getChannelsLiveInfo({
finderUserName,
success(liveInfo) {
console.log(liveInfo, '视频号直播')
if (liveInfo.status == 3) _this.getChannelsLiveNoticeInfo(finderUserName)
else {
_this.setData({
liveInfo
})
}
},
fail(err){
console.log(err)
_this.getChannelsLiveNoticeInfo(finderUserName)
}
})
},
getChannelsLiveNoticeInfo(finderUserName) {
const _this = this
wx.getChannelsLiveNoticeInfo({
finderUserName,
success(liveNoticeInfo) {
console.log(liveNoticeInfo, '视频号预告')
_this.setData({
liveNoticeInfo
})
},
fail(err) {
console.log(err)
}
})
},
getActivityList() {
wx.p.wxApi.showLoading()
let total = 0
......@@ -133,7 +96,7 @@ Page({
})
},
//获取banner
getHomeConfig() {
getHomeConfig(refresh) {
wx.p.api.homeApi.getHomeConfig().then(data => {
let {
noticeContent
......@@ -155,6 +118,7 @@ Page({
bannerList
})
this.filterKfList(data)
if (refresh) this.selectComponent('#channels').init(false)
})
},
changeTab(e) {
......@@ -166,7 +130,6 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getHomeConfig()
},
/**
......@@ -186,7 +149,7 @@ Page({
this.setData({
noticeContent: ''
})
this.getHomeConfig()
this.getHomeConfig(true)
this.getActivityList()
this.selectComponent('#storeQuity').onPullDownRefresh()
},
......
......@@ -82,4 +82,4 @@
<customer model:show="{{widgetStatus}}" customerlist="{{customerlist}}"></customer>
<!-- 视频号直播 -->
<channels-modal />
<channels-modal id="channels" />
{
"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"setting": {
"compileMode": "dynamic",
"urlCheck": true,
"scopeDataCheck": false,
"coverView": true,
......@@ -36,7 +37,7 @@
"useCompilerPlugins": [
"sass"
],
"condition": false
"condition": true
},
"compileType": "miniprogram",
"simulatorType": "wechat",
......
/**app.wxss**/
.sticky {
position: sticky;
top: 0;
left: 0;
z-index: 2;
background-color: #fff;
}
.flex {
display: flex;
align-items: center;
}
.y-center {
top: 50%;
transform: translateY(-50%);
}
.x-center {
left: 50%;
transform: translateX(-50%);
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.isFullSucreen {
padding-bottom: var(--constantSafeAreaInsetBottom) !important;
padding-bottom: var(--envSafeAreaInsetBottom) !important;
}
.isFullSucreen-bottom {
bottom: var(--constantSafeAreaInsetBottom) !important;
bottom: var(--envSafeAreaInsetBottom) !important;
}
.isFullSucreen-padding-bottom {
padding-bottom: var(--constantSafeAreaInsetBottom) !important;
padding-bottom: var(--envSafeAreaInsetBottom) !important;
}
.default-btn {
width: 686rpx;
height: 88rpx;
background: var(--btnColor);
border-radius: var(--borderRadius);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: var(--margin);
}
/* .list-nothing {
width: 100%;
padding: 8rpx 0 30rpx;
text-align: center;
font-size: 28rpx;
color: #C1C2C3;
} */
.list-nothing {
width: 100%;
padding: 8rpx 0 30rpx;
text-align: center;
font-size: 24rpx;
color: #858A94;
}
.list-nothing.to-bottom::after {
content: '- 到 底 了 -'
}
.list-nothing .icon {
width: 320rpx;
height: 320rpx;
}
.list-not {
display: flex;
align-items: center;
justify-content: center;
color: #999;
font-size: 24rpx;
height: 100%;
}
.flex_sc {
display: flex;
align-items: center;
}
.store-btn-disabled {
background-image: none;
background: #CCCED1 !important;
color: #fff !important;
}
.store-btn-disabled::after {
border: none;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
@keyframes show-box {
0% {
opacity: 0;
transform: scale(2.5);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes show-box-opacity {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!