Authored by hongyong.zhao

添加首页弹出框,底部banner图等

import { jumpByUrl } from '../../libs/urlRoute';
import { postFormId } from '../../libs/formIdCollectRequest.js';
import {
logEvent,
YB_MAIN_POP_UP_C,
} from '../../libs/analytics.js'
Component({
options: {
multipleSlots: true
},
properties: {
src: {
type: String,
value: ""
},
url: {
type: String,
value: ""
}
},
dada: {
isShow: false,
},
methods: {
hideDialog(){
this.setData({
isShow: false,
});
},
showDialog(){
this.setData({
isShow: true,
});
},
jumpByRule(){
let that = this;
if (that.properties.url == null){
return;
}
let params = {
TO_PATH: that.properties.url
};
logEvent(YB_MAIN_POP_UP_C, params);
jumpByUrl(that.properties.url,'home');
that.hideDialog();
},
//formId上报
formSubmit(e) {
// console.log('----formSubmit---', e);
let formId = e.detail.formId;
postFormId(formId,'1');
}
}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class='container' hidden="{{!isShow}}" catchtouchmove="true">
<view class='dialog-mask'>
<view class='dialog'>
<form bindsubmit='formSubmit' report-submit='true'>
<image src="{{src}}" class='dialog-image' mode='aspecdtFit' bindtap='jumpByRule'></image>
<button class='image-btn' form-type='submit' bindtap='jumpByRule'></button>
</form>
<form bindsubmit='formSubmit' report-submit='true'>
<view class='dialog-close' bindtap='hideDialog'>
<image class='close' src="./images/close.png" ></image>
<button class='dialog-btn' form-type='submit'></button>
</view>
</form>
</view>
</view>
</view>
\ No newline at end of file
... ...
.dialog-mask{
position: fixed;
z-index: 4999;
width: 100%;
height: 100%;
top: 0;
right: 0;
left: 0;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
background: rgba(0, 0, 0, 0.6);
}
.dialog{
position: fixed;
z-index: 5000;
top: 110rpx;
display: flex;
flex-direction: column;
align-items: center;
height: wrap;
}
.dialog-image{
height: 680rpx;
width: 680rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.dialog-close{
height: 110rpx;
width: 100rpx;
margin-top: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.close {
width: 80rpx;
height: 80rpx;
}
.dialog-btn {
height: 110rpx;
width: 100rpx;
background-color: red;
position: absolute;
opacity: 0;
}
.image-btn {
height: 680rpx;
width: 680rpx;
background-color: red;
position: absolute;
top: 0rpx;
opacity: 0;
}
... ...
... ... @@ -4,7 +4,8 @@ export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3';
export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
// export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
export const ACTIVITY_HOST = 'https://action.yoho.cn';
export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com'
// export const ACTIVITY_HOST = 'https://action.yoho.cn';
// export const API_HOST = 'http://dev-api.yohops.com:9999';
// export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/';
... ...
// pages/zeroSell/components/timeCountDown/time-countdown.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pages/zeroSell/components/timeCountDown/time-countdown.wxml-->
<text>pages/zeroSell/components/timeCountDown/time-countdown.wxml</text>
... ...
/* pages/zeroSell/components/timeCountDown/time-countdown.wxss */
\ No newline at end of file
... ...
import ZeroSellService from './service/zero-sell'
import CommonService from './service/common'
import {
decodePhoneNumber,
getUnionID,
decodeUnionId,
openAuthorizeSettings
openAuthorizeSettings,
} from '../../utils/login';
import {formatImageUrl} from '../../utils/util'
import {
Toast
} from '../../vendors/zanui/index';
import router from './router/router';
import { jumpByUrl } from '../../libs/urlRoute';
let app = getApp()
... ... @@ -33,15 +37,23 @@ Page(Object.assign({
footText: '',
hasUnionID: false,
uid: 0,
isLogin: false
isLogin: false,
dialogSrc: null,
dialogUrl: null,
bannerSrc: null,
bannerUrl: null
},
onLoad() {
this.service = new ZeroSellService();
this.commonService = new CommonService();
this._init();
new app.WeToast();
this._getResouceCode()
this._getBottomBanner()
},
onShow() {
... ... @@ -54,6 +66,8 @@ Page(Object.assign({
})
this._getUser();
this.dialog = this.selectComponent("#dialog");
},
onPullDownRefresh() {
... ... @@ -153,6 +167,42 @@ Page(Object.assign({
}
},
_getResouceCode() {
this.commonService.getResourceCode('194ffd46254d6ad20e6c538bea4d89d7')
.then(data => {
// console.log(data)
this.setData({
dialogSrc: formatImageUrl(data.src, 340 * app.globalData.systemInfo.pixelRatio, 340 * app.globalData.systemInfo.pixelRatio, 2),
dialogUrl: data.url
})
this.dialog.showDialog();
})
.catch(error => {
console.log(error)
})
},
_getBottomBanner() {
this.commonService.getResourceCode('5a2203f5656fbc9788bd8af70f2823d3')
.then(data => {
// console.log(data)
this.setData({
bannerSrc: formatImageUrl(data.src, app.globalData.systemInfo.screenWidth, 70, 2),
bannerUrl: data.url
})
})
.catch(error => {
console.log(error)
})
},
_jumpBanner() {
if (this.data.bannerUrl == null) {
return;
}
jumpByUrl(that.data.bannerUrl);
},
onTabChange({detail}) {
this.setData({
tabIndex: detail,
... ...
... ... @@ -7,6 +7,7 @@
"product-item": "./components/product-item",
"quickNavigation": "/pages/quickNavigation/quickNavigation",
"tabs": "./components/tabs",
"tabs-pane": "./components/tabs-pane"
"tabs-pane": "./components/tabs-pane",
"dialog": "../../component/dialog/dialog"
}
}
\ No newline at end of file
... ...
... ... @@ -28,6 +28,9 @@
<view class="list-foot-blank">{{footText}}</view>
</tabs>
<view class="bottom-banner" bindtap="_jumpBanner" wx:if="{{bannerSrc != null}}">
<image class="bottom-banner-img" src="{{bannerSrc}}"></image>
</view>
<view class="bottom-bar">
<block wx:if="{{isLogin}}">
... ... @@ -44,5 +47,9 @@
<import src="../../../../vendors/toast/wetoast.wxml"/>
<template is="wetoast" data="{{...__wetoast__}}"/>
<dialog
id='dialog'
src="{{dialogSrc}}"
url="{{dialogUrl}}"
></dialog>
<quickNavigation id="quickNavigation" isShowIndicator="{{false}}" isShowShopCart="{{false}}" marginBottom="{{190}}"></quickNavigation>
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@
display: block;
width: 100%;
text-align: center;
margin-bottom: 80rpx;
margin-bottom: 322rpx;
}
.list-top-blank,
... ... @@ -17,6 +17,18 @@
color: #ccc;
}
.bottom-banner {
position: fixed;
bottom: 88rpx;
height: 234rpx;
width: 100%;
}
.bottom-banner-img {
width: 100%;
height: 234rpx;
}
.bottom-bar {
position: fixed;
bottom: 0;
... ...
... ... @@ -2,6 +2,7 @@
import Service from './service'
import { API_HOST} from '../../../libs/config';
// import Promise from '../../../vendors/es6-promise';
class CommonService extends Service {
constructor() {
... ... @@ -13,6 +14,28 @@ class CommonService extends Service {
method: 'wechat.formId.add'
}, data))
}
getResourceCode(content_code) {
let param = {
content_code
}
let self = this;
return new Promise(function(resolve,reject) {
self._get(API_HOST + '/operations/api/v5/resource/get', param)
.then(json => {
if (json && json.code == 200 && json.data && json.data[0] && json.data[0].data && json.data[0].data.list && json.data[0].data.list[0] && json.data[0].data.list[0].src ) {
resolve(json.data[0].data.list[0])
} else {
reject(json)
}
})
.catch(error => {
reject(error)
})
})
}
}
export default CommonService;
\ No newline at end of file
... ...