Authored by 李奇

配置文件中添加渠道号参数

... ... @@ -139,6 +139,7 @@ const api = {
return Object.assign({
client_type: config.apiParams.client_type,
app_version: config.apiParams.app_version,
union_type: config.unionType, // 渠道号
udid: udid.get()
}, params);
},
... ...
... ... @@ -8,6 +8,7 @@ const config = {
private_key: 'b43890b0a296ff3c7b8c260ca763980b',
app_version: '6.4.0'
},
unionType: '8bfc9b404772199', // 渠道号:后台写死
constants: {
LOG_EVENT_HOST: 'https://analysis.yohobuy.com/yas_mobile',
APP_REPORT_HOST: 'https://app.yoho.cn/collect/v3',
... ...
... ... @@ -190,6 +190,7 @@ function _publicParams() {
let client_type = config.constants.CLIENT_TYPE;
let screen_size = '';
let privateKey = config.constants.PRIVATE_KEY;
let union_type = config.unionType;
let v = '7';
try {
... ... @@ -205,6 +206,7 @@ function _publicParams() {
os_version,
client_type,
screen_size,
union_type,
v
};
}
... ...
import api from '../../common/api';
export default {
/**
* 推荐商品列表
* @param params
* @returns {*}
*/
productList() {
return api.get({
url: '',
data: {
method: 'app.distribution.productList'
}
});
},
/**
* 解析用户信息
* @param thirdSession
* @param encryptedData
* @param iv
* @returns {*}
*/
decodeUserInfo(thirdSession, encryptedData, iv) {
return api.post({
url: '/wechat/',
data: {
iv,
encryptedData,
srdSession: thirdSession,
method: 'wechat.smallProgram.decodeUserInfo'
}
});
},
};
... ...
import resource from '../../common/resource';
import indexModel from '../../models/index/index';
//获取应用实例
let app = getApp();
... ... @@ -8,51 +9,11 @@ Page({
resource
},
onLoad: function (e) {
// new app.WeToast;
//
// let jumpType = e.jumpType;
// if (jumpType == config.constants.JUMP_BRAND) {
//
// let brandId = e.brandId;
// let brandName = e.brandName;
// if (brandId != '' && brandName != '')
// wx.navigateTo({
// url: '../goodsList/brand?brandId=' + brandId + '&brandName=' + brandName + '&page_name=' + 'home' + '&page_param=' + ''
// });
// } else if (jumpType == config.constants.JUMP_DETAIL) {
// let productSkn = e.productSkn;
// if (productSkn != '') {
// wx.navigateTo({
// url: '../goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + 'home' + '&page_param=' + ''
// });
// }
// } else if (jumpType == config.constants.JUMP_PRODUCTPOOL) {
// let productPool = e.productPool;
// if (productPool != '') {
// wx.navigateTo({
// url: '../goodsList/productPool?productPool=' + productPool + '&page_name=' + 'home' + '&page_param=' + ''
// });
// }
// }
onLoad: function () {
this.productList();
},
onShow: function () {
// var pages = getCurrentPages()
// var currentPage = pages[pages.length - 1]
// var url = currentPage.route
// let params = {
// PAGE_NAME: 'home',
// PAGE_PARAM: '',
// FROM_PAGE_NAME: '',
// FROM_PAGE_PARAM: '',
// PV_ID: PV_ID,
// PAGE_PATH: url
// };
// logEvent(YB_PAGE_OPEN_L, params);
//
// logEvent(YB_MAIN_TAB_C, {TAB_ID: 1});
},
... ... @@ -101,143 +62,15 @@ Page({
scrollTop: 0
})
},
jumpByRule: function (e) {
// let jumpUrl = e.currentTarget.dataset.jump_rule;
// if (!jumpUrl) {
// return;
// }
// let F_ID = e.currentTarget.dataset.f_id;//楼层id
// let I_INDEX = e.currentTarget.dataset.f_inindex + 1//楼层内index
// let F_INDEX = e.currentTarget.dataset.f_index + 1//楼层序号
// let F_NAME = e.currentTarget.dataset.f_name;//楼层名称
// let param = {
// F_ID, I_INDEX, F_INDEX, F_NAME,
// F_URL: jumpUrl
// }
//
// logEvent('YB_MAIN_EVENT', param);
// jumpByUrl(jumpUrl, 'home');
},
//获取新首页数据
fetchNewHomeData: function (force) {
// var channel = this.data.selectedChannel;
// let newChannels = this.data.newChannels;
// let currentData = newChannels[channel];
// if (currentData && currentData.data && currentData.data.length > 0 && !force) {
// this.setHomeList();
// return;
// }
// let cotentCode = getHomeContentCode(channel);
// let gender = getGenderCode(channel);
// let yh_channel = getChannelCode(channel);
// if (!force) {
// this.setLoadingHomeData(true);
// }
// let param = {
// content_code: cotentCode,
// gender,
// yh_channel,
// page: 1,
// limit: 10,
// fromPage: 'aFP_Home'
// }
// GET(config.constants.API_HOST + '/operations/api/v5/resource/home', param)
// .then(json => {
// this.setLoadingHomeData(false);
// if (json && json.code && json.code == 200) {
// let homeList = json.data.list;
// homeList = parseHomeList(homeList, windowWidth, windowHeight, activityItemWidth, activityItemHeight);
//
// if (!homeList || homeList.length <= 0) {
// this.wetoast.toast({
// title: json.message,
// titleClassName: 'wetoast-title',
// duration: 1500
// });
// }
// let newChannels = this.data.newChannels;
// let currentData = newChannels[channel];
// currentData.data = homeList;
// newChannels[channel] = currentData;
// this.setData({
// newChannels: newChannels
// })
// this.setHomeList(force);
// } else {
// this.setHomeList(force);
// this.wetoast.toast({
// title: json.message,
// titleClassName: 'wetoast-title',
// duration: 1500
// });
// }
// })
// .catch(error => {
// this.setLoadingHomeData(false);
// this.setHomeList(force);
// this.wetoast.toast({
// title: error.message,
// titleClassName: 'wetoast-title',
// duration: 1500
// });
// })
},
setLoadingHomeData: function (isLoading) {
let channel = this.data.selectedChannel;
let _newChannels = this.data.newChannels;
let currentData = _newChannels[channel];
if (currentData) {
currentData.isLoading = isLoading;
}
this.setData({
newChannels: _newChannels
})
},
setHomeList: function (force) {
// let channel = this.data.selectedChannel;
// let newChannels = this.data.newChannels;
// let currentData = newChannels[channel];
// if (currentData && currentData.data) {
// this.setData({
// homelist: currentData.data
// })
// }
// this.fetchRecommend(force);
productList: function () {
indexModel.productList().then(res => { console.log(res); })
},
toSearch: function () {
wx.navigateTo({
url: '../search/search'
});
},
//商品点击进入商品详情
productCellTapped: function (event) {
// if (shouldDiscardTap(event.timeStamp, this.data.lastTapTimeStamp)) {
// return;
// }
// this.setData({lastTapTimeStamp: event.timeStamp});
//
// let data = event.currentTarget.dataset;
// let productSkn = data.productSkn;
// let productIndex = data.productIndex;
// let productF_index = data.productF_index;
// let f_name = productF_index == 2 ? '新品到着' : '猜你喜欢';
//
// let params = {
// F_ID: productF_index,
// F_NAME: f_name,
// F_URL: '../goodsDetail/goodsDetail?productSkn=' + productSkn,
// F_INDEX: productF_index,
// I_INDEX: productIndex + 1,
// PV_ID: PV_ID
// };
// logEvent(YB_MAIN_EVENT, params);
//
// wx.navigateTo({
// url: '../goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + 'home' + '&page_param=' + ''
// });
},
sortChange: function (e) {
console.log(e.detail);
}
... ...