| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- import {
- ApiModel
- } from "../../utils/api";
- const _Http = new ApiModel();
- const handleList = require("../../utils/processingData")
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- //轮播图列表
- swiperBannerList: [],
- liveList: [], //云展会直播大厅
- agentList: [], //热门展商
- prodList: [], //热门展品
- fagentcount: null, //展示商
- flivecount: null, //正在直播
- ftotalcustcount: null, //观众总数
- showDownIndex: -1, //显示下拉下标
- liveSelectClassify: '全部', //直播分类选择
- agentSelectClassify: '全部', //展商分类选择
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let data = {
- "classname": "publicmethod.live.live",
- "method": "getLiveChannelData",
- "content": {
- "tactivityid": options.id
- }
- }
- /* 云展会直播大厅 */
- _Http.basic(data).then(res => {
- if (res.msg != "成功") {
- wx.showToast({
- title: '直播大厅加载失败,请重新进入页面',
- icon: "error",
- duration: 5000
- })
- } else {
- const liveList = handleList.twoDimensionalArr(res.data.tlivelist, 4, 10);
- this.setData({
- liveList,
- fagentcount: res.data.fagentcount,
- flivecount: res.data.flivecount,
- ftotalcustcount: res.data.ftotalcustcount
- })
- }
- });
- /* 热门展商 */
- data.method = "agentList";
- _Http.basic(data).then(res => {
- if (res.msg != "成功") {
- wx.showToast({
- title: '热门展商加载失败,请重新进入页面',
- icon: "error",
- duration: 5000
- })
- } else {
- const agentList = handleList.twoDimensionalArr(res.data, 4, 10);
- this.setData({
- agentList
- })
- }
- });
- /* 热门展品 */
- data.method = "prodList";
- _Http.basic(data).then(res => {
- if (res.msg != "成功") {
- wx.showToast({
- title: '热门展品加载失败,请重新进入页面',
- icon: "error",
- duration: 5000
- })
- } else {
- const prodList = handleList.twoDimensionalArr(res.data, 6, 10);
- this.setData({
- prodList,
- })
- }
- });
- /* 分类 */
- _Http.basic({
- "classname": "publicmethod.homepage.homepage",
- "method": "query_typeselectList",
- "content": {}
- }).then(res => {
- if (res.msg != '成功') {
- wx.showToast({
- title: '分类加载失败,请重新进入页面',
- icon: "error",
- duration: 5000
- })
- } else {
- res.data.unshift({
- ftype: "全部"
- });
- console.log(res.data)
- this.setData({
- typeselectList: res.data
- })
- }
- })
- /* 获取轮播图 */
- const bannerList = getApp().globalData.bannerDataList.filter(value => value.flocation == 'activity_head');
- this.setData({
- swiperBannerList: bannerList[0].banner
- });
- },
- /* 数据展示 */
- searchBlur(e) {
- const {
- value
- } = e.detail;
- console.log(value)
- },
- /* 显示下拉 */
- showPullDown(e) {
- const {
- index
- } = e.target.dataset;
- if (this.data.showDownIndex == index) return this.setData({
- showDownIndex: -1
- });
- this.setData({
- showDownIndex: index
- })
- },
- /* 关闭 */
- closeTheDropDown() {
- this.setData({
- showDownIndex: -1
- })
- },
- /* 选择分类 */
- modeSelect(e) {
- const {
- name,
- index
- } = e.target.dataset
- console.log(index, name)
- if (this.data.showDownIndex == 1) {
- //直播大厅
- this.setData({
- showDownIndex: -1,
- liveSelectClassify: name
- })
- } else {
- //热门展商
- this.setData({
- showDownIndex: -1,
- agentSelectClassify: name
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|