Authored by hongyong.zhao

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

  1 +import { jumpByUrl } from '../../libs/urlRoute';
  2 +import { postFormId } from '../../libs/formIdCollectRequest.js';
  3 +
  4 +import {
  5 + logEvent,
  6 + YB_MAIN_POP_UP_C,
  7 +} from '../../libs/analytics.js'
  8 +
  9 +Component({
  10 + options: {
  11 + multipleSlots: true
  12 + },
  13 +
  14 + properties: {
  15 + src: {
  16 + type: String,
  17 + value: ""
  18 + },
  19 + url: {
  20 + type: String,
  21 + value: ""
  22 + }
  23 + },
  24 +
  25 + dada: {
  26 + isShow: false,
  27 + },
  28 +
  29 + methods: {
  30 + hideDialog(){
  31 + this.setData({
  32 + isShow: false,
  33 + });
  34 + },
  35 + showDialog(){
  36 + this.setData({
  37 + isShow: true,
  38 + });
  39 + },
  40 + jumpByRule(){
  41 + let that = this;
  42 + if (that.properties.url == null){
  43 + return;
  44 + }
  45 +
  46 + let params = {
  47 + TO_PATH: that.properties.url
  48 + };
  49 + logEvent(YB_MAIN_POP_UP_C, params);
  50 +
  51 + jumpByUrl(that.properties.url,'home');
  52 + that.hideDialog();
  53 + },
  54 + //formId上报
  55 + formSubmit(e) {
  56 + // console.log('----formSubmit---', e);
  57 + let formId = e.detail.formId;
  58 + postFormId(formId,'1');
  59 + }
  60 + }
  61 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<view class='container' hidden="{{!isShow}}" catchtouchmove="true">
  2 + <view class='dialog-mask'>
  3 + <view class='dialog'>
  4 + <form bindsubmit='formSubmit' report-submit='true'>
  5 + <image src="{{src}}" class='dialog-image' mode='aspecdtFit' bindtap='jumpByRule'></image>
  6 + <button class='image-btn' form-type='submit' bindtap='jumpByRule'></button>
  7 + </form>
  8 + <form bindsubmit='formSubmit' report-submit='true'>
  9 + <view class='dialog-close' bindtap='hideDialog'>
  10 + <image class='close' src="./images/close.png" ></image>
  11 + <button class='dialog-btn' form-type='submit'></button>
  12 + </view>
  13 + </form>
  14 + </view>
  15 + </view>
  16 +</view>
  1 +
  2 +.dialog-mask{
  3 + position: fixed;
  4 + z-index: 4999;
  5 + width: 100%;
  6 + height: 100%;
  7 + top: 0;
  8 + right: 0;
  9 + left: 0;
  10 + bottom: 0;
  11 + display: flex;
  12 + flex-direction: column;
  13 + align-items: center;
  14 + background: rgba(0, 0, 0, 0.6);
  15 +}
  16 +
  17 +.dialog{
  18 + position: fixed;
  19 + z-index: 5000;
  20 + top: 110rpx;
  21 + display: flex;
  22 + flex-direction: column;
  23 + align-items: center;
  24 + height: wrap;
  25 +}
  26 +
  27 +.dialog-image{
  28 + height: 680rpx;
  29 + width: 680rpx;
  30 + display: flex;
  31 + flex-direction: column;
  32 + align-items: center;
  33 +}
  34 +
  35 +.dialog-close{
  36 + height: 110rpx;
  37 + width: 100rpx;
  38 + margin-top: 30rpx;
  39 + display: flex;
  40 + align-items: center;
  41 + justify-content: center;
  42 +}
  43 +
  44 +.close {
  45 + width: 80rpx;
  46 + height: 80rpx;
  47 +}
  48 +
  49 +.dialog-btn {
  50 + height: 110rpx;
  51 + width: 100rpx;
  52 + background-color: red;
  53 + position: absolute;
  54 + opacity: 0;
  55 +}
  56 +
  57 +.image-btn {
  58 + height: 680rpx;
  59 + width: 680rpx;
  60 + background-color: red;
  61 + position: absolute;
  62 + top: 0rpx;
  63 + opacity: 0;
  64 +}
@@ -4,7 +4,8 @@ export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3'; @@ -4,7 +4,8 @@ export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3';
4 export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile'; 4 export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
5 5
6 // export const ACTIVITY_HOST = 'http://192.168.102.49:6006'; 6 // export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
7 -export const ACTIVITY_HOST = 'https://action.yoho.cn'; 7 +export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com'
  8 +// export const ACTIVITY_HOST = 'https://action.yoho.cn';
8 9
9 // export const API_HOST = 'http://dev-api.yohops.com:9999'; 10 // export const API_HOST = 'http://dev-api.yohops.com:9999';
10 // export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/'; 11 // export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/';
  1 +// pages/zeroSell/components/timeCountDown/time-countdown.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 +
  8 + },
  9 +
  10 + /**
  11 + * 组件的初始数据
  12 + */
  13 + data: {
  14 +
  15 + },
  16 +
  17 + /**
  18 + * 组件的方法列表
  19 + */
  20 + methods: {
  21 +
  22 + }
  23 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--pages/zeroSell/components/timeCountDown/time-countdown.wxml-->
  2 +<text>pages/zeroSell/components/timeCountDown/time-countdown.wxml</text>
  1 +/* pages/zeroSell/components/timeCountDown/time-countdown.wxss */
1 1
2 2
3 import ZeroSellService from './service/zero-sell' 3 import ZeroSellService from './service/zero-sell'
  4 +import CommonService from './service/common'
4 5
5 import { 6 import {
6 decodePhoneNumber, 7 decodePhoneNumber,
7 getUnionID, 8 getUnionID,
8 decodeUnionId, 9 decodeUnionId,
9 - openAuthorizeSettings 10 + openAuthorizeSettings,
10 } from '../../utils/login'; 11 } from '../../utils/login';
11 12
  13 +import {formatImageUrl} from '../../utils/util'
  14 +
12 import { 15 import {
13 Toast 16 Toast
14 } from '../../vendors/zanui/index'; 17 } from '../../vendors/zanui/index';
15 import router from './router/router'; 18 import router from './router/router';
  19 +import { jumpByUrl } from '../../libs/urlRoute';
16 20
17 let app = getApp() 21 let app = getApp()
18 22
@@ -33,15 +37,23 @@ Page(Object.assign({ @@ -33,15 +37,23 @@ Page(Object.assign({
33 footText: '', 37 footText: '',
34 hasUnionID: false, 38 hasUnionID: false,
35 uid: 0, 39 uid: 0,
36 - isLogin: false 40 + isLogin: false,
  41 + dialogSrc: null,
  42 + dialogUrl: null,
  43 + bannerSrc: null,
  44 + bannerUrl: null
37 }, 45 },
38 46
39 onLoad() { 47 onLoad() {
40 this.service = new ZeroSellService(); 48 this.service = new ZeroSellService();
  49 + this.commonService = new CommonService();
41 50
42 this._init(); 51 this._init();
43 52
44 new app.WeToast(); 53 new app.WeToast();
  54 +
  55 + this._getResouceCode()
  56 + this._getBottomBanner()
45 }, 57 },
46 58
47 onShow() { 59 onShow() {
@@ -54,6 +66,8 @@ Page(Object.assign({ @@ -54,6 +66,8 @@ Page(Object.assign({
54 }) 66 })
55 67
56 this._getUser(); 68 this._getUser();
  69 +
  70 + this.dialog = this.selectComponent("#dialog");
57 }, 71 },
58 72
59 onPullDownRefresh() { 73 onPullDownRefresh() {
@@ -153,6 +167,42 @@ Page(Object.assign({ @@ -153,6 +167,42 @@ Page(Object.assign({
153 } 167 }
154 }, 168 },
155 169
  170 + _getResouceCode() {
  171 + this.commonService.getResourceCode('194ffd46254d6ad20e6c538bea4d89d7')
  172 + .then(data => {
  173 + // console.log(data)
  174 + this.setData({
  175 + dialogSrc: formatImageUrl(data.src, 340 * app.globalData.systemInfo.pixelRatio, 340 * app.globalData.systemInfo.pixelRatio, 2),
  176 + dialogUrl: data.url
  177 + })
  178 + this.dialog.showDialog();
  179 + })
  180 + .catch(error => {
  181 + console.log(error)
  182 + })
  183 +
  184 + },
  185 + _getBottomBanner() {
  186 + this.commonService.getResourceCode('5a2203f5656fbc9788bd8af70f2823d3')
  187 + .then(data => {
  188 + // console.log(data)
  189 + this.setData({
  190 + bannerSrc: formatImageUrl(data.src, app.globalData.systemInfo.screenWidth, 70, 2),
  191 + bannerUrl: data.url
  192 + })
  193 + })
  194 + .catch(error => {
  195 + console.log(error)
  196 + })
  197 + },
  198 +
  199 + _jumpBanner() {
  200 + if (this.data.bannerUrl == null) {
  201 + return;
  202 + }
  203 + jumpByUrl(that.data.bannerUrl);
  204 + },
  205 +
156 onTabChange({detail}) { 206 onTabChange({detail}) {
157 this.setData({ 207 this.setData({
158 tabIndex: detail, 208 tabIndex: detail,
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 "product-item": "./components/product-item", 7 "product-item": "./components/product-item",
8 "quickNavigation": "/pages/quickNavigation/quickNavigation", 8 "quickNavigation": "/pages/quickNavigation/quickNavigation",
9 "tabs": "./components/tabs", 9 "tabs": "./components/tabs",
10 - "tabs-pane": "./components/tabs-pane" 10 + "tabs-pane": "./components/tabs-pane",
  11 + "dialog": "../../component/dialog/dialog"
11 } 12 }
12 } 13 }
@@ -28,6 +28,9 @@ @@ -28,6 +28,9 @@
28 <view class="list-foot-blank">{{footText}}</view> 28 <view class="list-foot-blank">{{footText}}</view>
29 </tabs> 29 </tabs>
30 30
  31 +<view class="bottom-banner" bindtap="_jumpBanner" wx:if="{{bannerSrc != null}}">
  32 +<image class="bottom-banner-img" src="{{bannerSrc}}"></image>
  33 +</view>
31 34
32 <view class="bottom-bar"> 35 <view class="bottom-bar">
33 <block wx:if="{{isLogin}}"> 36 <block wx:if="{{isLogin}}">
@@ -44,5 +47,9 @@ @@ -44,5 +47,9 @@
44 47
45 <import src="../../../../vendors/toast/wetoast.wxml"/> 48 <import src="../../../../vendors/toast/wetoast.wxml"/>
46 <template is="wetoast" data="{{...__wetoast__}}"/> 49 <template is="wetoast" data="{{...__wetoast__}}"/>
47 - 50 +<dialog
  51 +id='dialog'
  52 +src="{{dialogSrc}}"
  53 +url="{{dialogUrl}}"
  54 +></dialog>
48 <quickNavigation id="quickNavigation" isShowIndicator="{{false}}" isShowShopCart="{{false}}" marginBottom="{{190}}"></quickNavigation> 55 <quickNavigation id="quickNavigation" isShowIndicator="{{false}}" isShowShopCart="{{false}}" marginBottom="{{190}}"></quickNavigation>
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 display: block; 3 display: block;
4 width: 100%; 4 width: 100%;
5 text-align: center; 5 text-align: center;
6 - margin-bottom: 80rpx; 6 + margin-bottom: 322rpx;
7 } 7 }
8 8
9 .list-top-blank, 9 .list-top-blank,
@@ -17,6 +17,18 @@ @@ -17,6 +17,18 @@
17 color: #ccc; 17 color: #ccc;
18 } 18 }
19 19
  20 +.bottom-banner {
  21 + position: fixed;
  22 + bottom: 88rpx;
  23 + height: 234rpx;
  24 + width: 100%;
  25 +}
  26 +
  27 +.bottom-banner-img {
  28 + width: 100%;
  29 + height: 234rpx;
  30 +}
  31 +
20 .bottom-bar { 32 .bottom-bar {
21 position: fixed; 33 position: fixed;
22 bottom: 0; 34 bottom: 0;
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 import Service from './service' 3 import Service from './service'
4 import { API_HOST} from '../../../libs/config'; 4 import { API_HOST} from '../../../libs/config';
  5 +// import Promise from '../../../vendors/es6-promise';
5 6
6 class CommonService extends Service { 7 class CommonService extends Service {
7 constructor() { 8 constructor() {
@@ -13,6 +14,28 @@ class CommonService extends Service { @@ -13,6 +14,28 @@ class CommonService extends Service {
13 method: 'wechat.formId.add' 14 method: 'wechat.formId.add'
14 }, data)) 15 }, data))
15 } 16 }
  17 +
  18 + getResourceCode(content_code) {
  19 + let param = {
  20 + content_code
  21 + }
  22 + let self = this;
  23 +
  24 + return new Promise(function(resolve,reject) {
  25 + self._get(API_HOST + '/operations/api/v5/resource/get', param)
  26 + .then(json => {
  27 + 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 ) {
  28 + resolve(json.data[0].data.list[0])
  29 + } else {
  30 + reject(json)
  31 + }
  32 + })
  33 + .catch(error => {
  34 + reject(error)
  35 + })
  36 + })
  37 +
  38 + }
16 } 39 }
17 40
18 export default CommonService; 41 export default CommonService;