Commit 23d89942 by 刘奕

首页优化

parent 166393ed
...@@ -28,19 +28,19 @@ ...@@ -28,19 +28,19 @@
"outputPath": "" "outputPath": ""
}, },
"enableEngineNative": false, "enableEngineNative": false,
"useIsolateContext": true, "useIsolateContext": false,
"userConfirmedBundleSwitch": false, "userConfirmedBundleSwitch": false,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [], "packNpmRelationList": [],
"minifyWXSS": true, "minifyWXSS": true,
"disableUseStrict": false, "disableUseStrict": false,
"minifyWXML": true,
"showES6CompileOption": false, "showES6CompileOption": false,
"useCompilerPlugins": false, "useCompilerPlugins": false
"minifyWXML": true
}, },
"miniprogramRoot": "dist/wx/", "miniprogramRoot": "dist/wx/",
"compileType": "miniprogram", "compileType": "miniprogram",
"appid": "wx937625b28b7f85fd", "appid": "wx3722f444d90b60d8",
"projectname": "mayi-mp-shop", "projectname": "mayi-mp-shop",
"simulatorType": "wechat", "simulatorType": "wechat",
"simulatorPluginLibVersion": {}, "simulatorPluginLibVersion": {},
......
...@@ -86,6 +86,12 @@ ...@@ -86,6 +86,12 @@
"pathName": "pages/contact/main", "pathName": "pages/contact/main",
"query": "", "query": "",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/pages_subpack/article/main",
"query": "article_id=395",
"scene": null
} }
] ]
} }
......
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
console.log(extConfig, "-----------extConfig"); console.log(extConfig, "-----------extConfig");
if (JSON.stringify(extConfig) == "{}") { if (JSON.stringify(extConfig) == "{}") {
extConfig = process.env.NODE_ENV == "development" ? { mixid: "antgood", shopid: 67}:{ "mixid":"CL", "shopid":1166 }; extConfig = process.env.NODE_ENV == "development" ? { mixid: "antgood", shopid: 67}:{ "mixid":"zantest", "shopid":1166 };
} }
...@@ -48,6 +48,9 @@ export default { ...@@ -48,6 +48,9 @@ export default {
// 页面配置信息 // 页面配置信息
this.getThemePage(extConfig); this.getThemePage(extConfig);
// 商城配置
this.shopConfiguration()
setTimeout(() => { setTimeout(() => {
let mpApp = getApp(); let mpApp = getApp();
...@@ -225,6 +228,16 @@ export default { ...@@ -225,6 +228,16 @@ export default {
} }
}); });
}, },
//商城配置
shopConfiguration(){
shop.get_shop_configuration().then(res=>{
if (res.data.code == 200) {
let mpApp = getApp();
mpApp.shop_configuration = res.data.data
console.log(mpApp.shop_configuration,'mpApp.shop_configuration');
}
})
},
async getThemePage({ mixid, shopid }) { async getThemePage({ mixid, shopid }) {
await shop await shop
.themePagesInfo({ .themePagesInfo({
......
...@@ -37,5 +37,12 @@ export default { ...@@ -37,5 +37,12 @@ export default {
return requestPOST( return requestPOST(
`${process.env.OLSHOP_URL}/user/draw_membership_card?cardId=${params}` `${process.env.OLSHOP_URL}/user/draw_membership_card?cardId=${params}`
); );
},
//获取shop配置
get_shop_configuration(){
return requestPOST(
`${process.env.OLSHOP_URL}/shop/get_shop_configuration`
);
} }
}; };
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
"pages/tabBar4/main", "pages/tabBar4/main",
"pages/changeAdr/main", "pages/changeAdr/main",
"pages/downFile/main", "pages/downFile/main",
"pages/wxArticle/main" "pages/wxArticle/main",
"pages/pages_subpack/article/main"
], ],
"usingComponents": {}, "usingComponents": {},
"window": { "window": {
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<banner :datas="item1"></banner> <banner :datas="item1"></banner>
</div> </div>
<div v-else-if="item1.componentCode=='goods-list' && item1.componentInfo.visible == 1" style="height:100%;"> <div v-else-if="item1.componentCode=='goods-list' && item1.componentInfo.visible == 1" style="height:100%;">
<goods-list class="goodsListItem" :datas="item1"></goods-list> <goods-list v-if="active == index" :class="['goodsListItem','goodsListItemIndex'+index]" :datas="item1" :datasIndex="active" :goodsListIndex="index"></goods-list>
</div> </div>
<div v-else-if="item1.componentCode == 'area-navigation' && item1.componentInfo.visible == 1"> <div v-else-if="item1.componentCode == 'area-navigation' && item1.componentInfo.visible == 1">
<area-navigation :datas="item1" :changeLocation="changeLocation"></area-navigation> <area-navigation :datas="item1" :changeLocation="changeLocation"></area-navigation>
...@@ -421,6 +421,7 @@ export default { ...@@ -421,6 +421,7 @@ export default {
}) })
} }
this.active=res.target.index; this.active=res.target.index;
wx.setStorageSync('datasIndex', res.target.index);
}, },
timeOutInitTabs(notGetAllTabWidth) { timeOutInitTabs(notGetAllTabWidth) {
setTimeout(() => { setTimeout(() => {
......
...@@ -11,6 +11,8 @@ import cartApi from './api/cart' ...@@ -11,6 +11,8 @@ import cartApi from './api/cart'
import classificationApi from "./api/classification"; import classificationApi from "./api/classification";
import spokesmanApi from './api/spokesman' import spokesmanApi from './api/spokesman'
import { DFSImg, concatUrl } from "@/utils/index"; import { DFSImg, concatUrl } from "@/utils/index";
//一些js工具类
import tool from "@/utils/tool";
var log = require('./utils/log') var log = require('./utils/log')
import fenxiaoModel from "@/utils/fenxiaoModel"; import fenxiaoModel from "@/utils/fenxiaoModel";
import { import {
...@@ -135,6 +137,7 @@ mpApp.getThemePage = getThemePage ...@@ -135,6 +137,7 @@ mpApp.getThemePage = getThemePage
mpApp.themeColor = {} mpApp.themeColor = {}
mpApp.log = log mpApp.log = log
mpApp.tool = tool
function getThemePage({mixid,shopid}) { function getThemePage({mixid,shopid}) {
shop shop
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<banner :datas="item"></banner> <banner :datas="item"></banner>
</div> </div>
<div v-else-if="item.componentCode=='goods-list' && item.componentInfo.visible == 1" style="height:100%;"> <div v-else-if="item.componentCode=='goods-list' && item.componentInfo.visible == 1" style="height:100%;">
<goods-list :class="'goodsListItem' + index" :datas="item"></goods-list> <goods-list :class="['goodsListItem' + index,'goodsListItemIndex0']" :datas="item" :single="true"></goods-list>
</div> </div>
<div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1"> <div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1">
<area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation> <area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation>
...@@ -158,7 +158,7 @@ import indexApi from "@/api/index.js"; ...@@ -158,7 +158,7 @@ import indexApi from "@/api/index.js";
import { throttle, concatUrl } from "../../utils/index.js" import { throttle, concatUrl } from "../../utils/index.js"
import mpvueCropper from '@/components/mpvue-cropper' import mpvueCropper from '@/components/mpvue-cropper'
const app = getApp(); const app = getApp();
const { log } = app; const { log,tool } = app;
export default { export default {
data() { data() {
return { return {
...@@ -387,6 +387,19 @@ export default { ...@@ -387,6 +387,19 @@ export default {
// 新人有礼弹窗 // 新人有礼弹窗
this.newUserFun(); this.newUserFun();
} }
//清除懒加载缓存
wx.removeStorage({
key: 'storageGoodsList'
})
wx.removeStorage({
key: 'storageDatasList'
})
wx.removeStorage({
key: 'datasIndex'
})
console.log('storageGoodsList---detory');
}, },
onShow() { onShow() {
// 设置显示条件 // 设置显示条件
...@@ -408,10 +421,14 @@ export default { ...@@ -408,10 +421,14 @@ export default {
this.active=checkTabbarPage('/') this.active=checkTabbarPage('/')
} }
this.$mp.page.onPageScroll= (el)=>{ // this.$mp.page.onPageScroll= (el)=>{
throttle(this.scrolls(el),100) // throttle(this.scrolls(el),100)
}; // };
}, },
onPageScroll: tool.throttle(function (el) {
// console.log(el);
this.scrolls(el)
},1000),
methods: { methods: {
async setVisible(pageList, cb) { async setVisible(pageList, cb) {
// 首页显示条件 // 首页显示条件
...@@ -534,6 +551,7 @@ export default { ...@@ -534,6 +551,7 @@ export default {
this.active=checkTabbarPage('/'); this.active=checkTabbarPage('/');
this.setVisible(this.mpApp.globalData.pageList,(res)=>{ this.setVisible(this.mpApp.globalData.pageList,(res)=>{
this.pageInfo = res; this.pageInfo = res;
console.log(this.pageInfo,'this.pageInfo');
this.pageData = JSON.parse(this.pageInfo.pageData); this.pageData = JSON.parse(this.pageInfo.pageData);
}); });
log.info("36----------------------559", this.pageData,this.pageInfo.pageSettingData); log.info("36----------------------559", this.pageData,this.pageInfo.pageSettingData);
...@@ -593,7 +611,7 @@ export default { ...@@ -593,7 +611,7 @@ export default {
getSpokesmanInit(extConfig) { getSpokesmanInit(extConfig) {
//绑定上下级关系 //绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then(res=>{ app.fenxiaoModel.becomeRelation(extConfig).then(res=>{
if(res) { if(res.data.code == '200') {
wx.removeStorage({ wx.removeStorage({
key: "becomeInfo" key: "becomeInfo"
}); });
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<div class="title_user">{{article.author}}</div> <div class="title_user">{{article.author}}</div>
<div class="title_time">{{article.createDatetime}}</div> <div class="title_time">{{article.createDatetime}}</div>
</div> </div>
<!-- <wxParse :content="article.content" v-if="!article.msg" /> -->
<div v-html="article.content" v-if="!article.msg"></div> <div v-html="article.content" v-if="!article.msg"></div>
<!-- <rich-text :datas="datas" v-if="!article.msg"></rich-text> --> <!-- <rich-text :datas="datas" v-if="!article.msg"></rich-text> -->
<div class="title" style="min-height: 50vh;color: #999;align-items: center;display: flex;justify-content: center;" v-else>{{article.msg}}</div> <div class="title" style="min-height: 50vh;color: #999;align-items: center;display: flex;justify-content: center;" v-else>{{article.msg}}</div>
...@@ -52,7 +53,9 @@ ...@@ -52,7 +53,9 @@
<script> <script>
import article from '@/api/article' import article from '@/api/article'
import shadeGuide from "./shadeGuide.vue"; import shadeGuide from "./shadeGuide.vue";
import richText from "../../../components/basicTool/rich-text/index.vue"; import { throttle, concatUrl } from "../../../utils/index.js"
// import wxParse from 'mpvue-wxparse'
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
export default { export default {
...@@ -71,59 +74,197 @@ export default { ...@@ -71,59 +74,197 @@ export default {
pageNum: 0, pageNum: 0,
pageSize: 20, pageSize: 20,
}, },
datas: {
componentData: {}
}
} }
}, },
components: { components: {
"shade-guide": shadeGuide, "shade-guide": shadeGuide
"rich-text": richText
}, },
created() { created() {
}, },
onReady() { onReady() {
}, },
onLoad(option) { onLoad(options) {
wx.showShareMenu({ wx.showShareMenu({
withShareTicket: true, withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'] menus: ['shareAppMessage', 'shareTimeline']
}) })
this.articleId = option.article_id
this.query['articleId'] = this.articleId if (options.queryStr) {
this.init() wx.showModal({
title: "",
content: options.queryStr,
showCancel: true,
cancelText: '取消',
cancelColor: '#000000',
confirmText: '确定',
confirmColor: '#3CC51F',
success: (result) => {
if (result.confirm) {
}
},
fail: () => { },
complete: () => { }
});
} else if (options.article_id) {
this.articleId = options.article_id
this.query['articleId'] = this.articleId
this.init()
}
//进页面存储需要绑定的信息
if (options.userId || options.spokesmanRelId) {
wx.setStorage({
key: "becomeInfo",
data: JSON.stringify(options)
});
}
if (wx.getStorageSync("sessionid")) {
//获取分销信息
this.getSpokesmanInit(wx.getStorageSync("becomeInfo") ? JSON.parse(wx.getStorageSync("becomeInfo")) : '')
}
}, },
onShareAppMessage() { // onShareAppMessage() {
return { // return {
title: '', // title: '',
path: `/pages/article/main?article_id=${this.articleId}` // path: `/pages/pages_subpack/article/main?article_id=${this.articleId}`
// }
// },
async onShareAppMessage(res) {
console.log('wxshare');
let newHref = `/pages/pages_subpack/article/main?article_id=${this.articleId}`;
let title = app.globalData.shopInfo.shopName;
let hasInvitationStatus = 0;
if (wx.getStorageSync("sessionid")) {
await app.fenxiaoModel.getSpokesmanidByShare().then(data => {
hasInvitationStatus = data.hasInvitationStatus;
})
await app.fenxiaoModel.getSpokesmanInfo().then(data => {
let newData = {}
if (data != null) {
if (hasInvitationStatus == 1) {
newData = {
spokesmanGroupId: data.groupId,
spokesmanShopId: data.shopId,
spokesmanRelId: data.id,
userId: data.userId
}
} else {
newData = {
userId: data.userId
}
}
}
newHref = concatUrl(newHref, newData)
})
} }
console.log(newHref, title, 'share');
return {
title: title, // 默认是小程序的名称
path: newHref, // 默认是当前页面
imageUrl: '',
success: function (res) {
// 转发成功之后的回调
if (res.errMsg == "shareAppMessage:ok") {
log.info(res, "分享成功");
}
},
fail: function () {
// 转发失败之后的回调
if (res.errMsg == "shareAppMessage:fail cancel") {
// 用户取消转发
log.info(res, "分享失败");
} else if (res.errMsg == "shareAppMessage:fail") {
// 转发失败,其中 detail message 为详细失败信息
}
},
complete: function () {
// 转发结束之后的回调(转发成不成功都会执行)
}
};
}, },
onShareTimeline() { //用户点击右上角分享朋友圈
onShareTimeline: function () {
return { return {
title: '', title: '',
query: { query: `article_id=${this.article_id}`,
article_id: this.articleId imageUrl: ''
},
imageUrl: '',
createDatetime: ''
} }
}, },
// async onShareTimeline() {
// console.log('Timeline');
// // let newHref = `/pages/pages_subpack/article/main?article_id=${this.articleId}`;
// let newHref = ''
// let title = app.globalData.shopInfo.shopName;
// let hasInvitationStatus = 0;
// if (wx.getStorageSync("sessionid")) {
// await app.fenxiaoModel.getSpokesmanidByShare().then(data => {
// hasInvitationStatus = data.hasInvitationStatus;
// })
// await app.fenxiaoModel.getSpokesmanInfo().then(data => {
// let newData = {}
// if (data != null) {
// if (hasInvitationStatus == 1) {
// newData = {
// spokesmanGroupId: data.groupId,
// spokesmanShopId: data.shopId,
// spokesmanRelId: data.id,
// userId: data.userId
// }
// } else {
// newData = {
// userId: data.userId
// }
// }
// }
// newHref = concatUrl(newHref, newData)
// })
// }
// console.log(newHref, title, 'TimelineShare');
// // let queryStr = `articleId_${this.articleId}/spokesmanGroupId_${obj.spokesmanGroupId}/spokesmanShopId_${obj.spokesmanShopId}/spokesmanRelId_${obj.spokesmanRelId}/userId_${obj.userId}`
// return {
// title: title,
// query: 'a=1111',
// imageUrl: '',
// createDatetime: ''
// }
// },
methods: { methods: {
getSpokesmanInit(extConfig) {
//绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then(res => {
if (res) {
wx.removeStorage({
key: "becomeInfo"
});
}
})
},
//富文本解析和替换
formatRichText(html) { formatRichText(html) {
console.log(html,'html');
let newContent = html.replace(/<img[^>]*>/gi, function (match, capture) { let newContent = html.replace(/<img[^>]*>/gi, function (match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, ''); if (match.startsWith('<img style="object-fit: contain;')) {
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, ''); console.log(match,'match');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, ''); match = match.replace(/height:(.*?);/g, 'height: 76px !important;')
console.log(match,'match');
} else {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
}
return match; return match;
}); });
console.log('newContent', newContent);
newContent = newContent.replace(/style="[^"]+"/gi, function (match, capture) { newContent = newContent.replace(/style="[^"]+"/gi, function (match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;'); match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
return match; return match;
}); });
newContent = newContent.replace(/<br[^>]*\/>/gi, ''); newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;margin:10px 0;"'); newContent = newContent.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;margin:10px 0;"');
return newContent return newContent
}, },
init() { init() {
...@@ -131,22 +272,22 @@ export default { ...@@ -131,22 +272,22 @@ export default {
article.getArticleInfo(this.articleId).then(res => { article.getArticleInfo(this.articleId).then(res => {
if (res.data.data) { if (res.data.data) {
let article = res.data.data let article = res.data.data
let content = res.data.data.content.replace("<body>", "").replace("</body>", "") let content = res.data.data.content.replace('<body>', '<div style="overflow-x: hidden;width:100%">').replace("</body>", "</div>")
let createDatetime = article.createDatetime != '' ? article.createDatetime.slice(0, -9) : ''
article.content = this.formatRichText(content) article.content = this.formatRichText(content)
this.datas.componentData['padding'] = 0 article.createDatetime = createDatetime
this.datas.componentData['richText'] = content
this.datas.componentData['backgroundColor'] = '#fff'
this.article = article this.article = article
// this.createDatetime = article.createDatetime != '' ? article.createDatetime.slice(0,-3):'' // this.createDatetime = article.createDatetime != '' ? article.createDatetime.slice(0,-3):''
// log.info(this.createDatetime,'article.createDatetime'); // log.info(this.createDatetime,'article.createDatetime');
if (article.fabulousFlag == 'true') { if (article.fabulousFlag == 'true') {
this.isThumbsUp = true; this.isThumbsUp = true;
} }
if (article.title && article.title.length) { // 不设置title
wx.setNavigationBarTitle({ // if (article.title && article.title.length) {
title: article.title // wx.setNavigationBarTitle({
}) // title: article.title
} // })
// }
} }
}); });
...@@ -267,6 +408,10 @@ export default { ...@@ -267,6 +408,10 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// @import url("~mpvue-wxparse/src/wxParse.css");
.imgbox .img {
height: 96px !important;
}
.article_container { .article_container {
position: relative; position: relative;
} }
...@@ -276,6 +421,7 @@ export default { ...@@ -276,6 +421,7 @@ export default {
padding: 0 10px; padding: 0 10px;
padding-bottom: 100px; padding-bottom: 100px;
box-sizing: border-box; box-sizing: border-box;
overflow-x: hidden;
} }
.title { .title {
...@@ -284,13 +430,14 @@ export default { ...@@ -284,13 +430,14 @@ export default {
width: 100%; width: 100%;
padding: 12px 0; padding: 12px 0;
text-align: left; text-align: left;
font-weight: 700;
} }
.title_info { .title_info {
display: flex; display: flex;
justify-content: center; justify-content: flex-start;
// padding: 0 12px; // padding: 0 12px;
font-size: 13px; font-size: 13px;
margin-bottom: 12px; margin-bottom: 24px;
} }
.title_user { .title_user {
width: 100%; width: 100%;
...@@ -299,7 +446,7 @@ export default { ...@@ -299,7 +446,7 @@ export default {
.title_time { .title_time {
width: 100%; width: 100%;
// padding-right: 13px; // padding-right: 13px;
text-align: right; text-align: left;
color: #999; color: #999;
} }
......
{ {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "文章详情", "navigationBarTitleText": "",
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"usingComponents": { "usingComponents": {
......
...@@ -4,9 +4,147 @@ ...@@ -4,9 +4,147 @@
<script> <script>
import tabbarPage from "../../components/tabbarPage.vue"; import tabbarPage from "../../components/tabbarPage.vue";
import { concatUrl } from "../../utils/index.js"
const app = getApp();
const { log } = app;
export default { export default {
components: { components: {
tabbarPage, tabbarPage,
}, },
data() {
return {
pageInfo: {},
pageData: {},
}
},
onLoad(options) {
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
wx.showModal({
title: '',
content: JSON.stringify(options),
showCancel: true,
cancelText: '取消',
cancelColor: '#000000',
confirmText: '确定',
confirmColor: '#3CC51F',
success: (result) => {
if(result.confirm){
}
},
fail: ()=>{},
complete: ()=>{}
});
console.log(this.mpApp.globalData.pageList, 'llll');
this.init()
if (options.userId || options.spokesmanRelId) {
wx.setStorage({
key: "becomeInfo",
data: JSON.stringify(options)
});
}
if (wx.getStorageSync("sessionid")) {
//获取分销信息
this.getSpokesmanInit(wx.getStorageSync("becomeInfo") ? JSON.parse(wx.getStorageSync("becomeInfo")) : '')
}
},
async onShareAppMessage(res) {
log.info(res)
let newHref = '/pages/tabBar1/main';
let title = app.globalData.shopInfo.shopName;
let hasInvitationStatus = 0;
if (wx.getStorageSync("sessionid")) {
await app.fenxiaoModel.getSpokesmanidByShare().then(data => {
hasInvitationStatus = data.hasInvitationStatus;
})
await app.fenxiaoModel.getSpokesmanInfo().then(data => {
let newData = {}
if (data != null) {
if (hasInvitationStatus == 1) {
newData = {
spokesmanGroupId: data.groupId,
spokesmanShopId: data.shopId,
spokesmanRelId: data.id,
userId: data.userId
}
} else {
newData = {
userId: data.userId
}
}
}
newHref = concatUrl(newHref, newData)
})
}
let imageUrl = '';
//多主题自定义分享标题和图片
if (this.pageInfo.pageSettingData && JSON.parse(this.pageInfo.pageSettingData).shareTitle) {
title = JSON.parse(this.pageInfo.pageSettingData).shareTitle
}
console.log(JSON.parse(this.pageInfo.pageSettingData));
if (this.pageInfo.pageSettingData && JSON.parse(this.pageInfo.pageSettingData).shareImg) {
imageUrl = JSON.parse(this.pageInfo.pageSettingData).shareImg
}
console.log(newHref, 3333555666, title,imageUrl, res);
log.info(newHref, 3333555666, title, res)
return {
title: title, // 默认是小程序的名称
path: newHref, // 默认是当前页面
imageUrl: imageUrl,
success: function (res) {
// 转发成功之后的回调
if (res.errMsg == "shareAppMessage:ok") {
log.info(res, "分享成功");
}
},
fail: function () {
// 转发失败之后的回调
if (res.errMsg == "shareAppMessage:fail cancel") {
// 用户取消转发
log.info(res, "分享失败");
} else if (res.errMsg == "shareAppMessage:fail") {
// 转发失败,其中 detail message 为详细失败信息
}
},
complete: function () {
// 转发结束之后的回调(转发成不成功都会执行)
}
};
},
onShareTimeline(res) {
log.info(res, '-----onShareTimeline')
},
methods: {
init() {
this.setVisible(this.mpApp.globalData.pageList, (res) => {
this.pageInfo = res;
this.pageData = JSON.parse(this.pageInfo.pageData);
});
},
async setVisible(pageList, cb) {
// 首页显示条件
let pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
cb(pageInfo)
},
getSpokesmanInit(extConfig) {
//绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then(res => {
if (res.data.code == 200) {
wx.removeStorage({
key: "becomeInfo"
});
}
})
},
}
}; };
</script> </script>
...@@ -14,6 +14,7 @@ export function debounce(fn, wait) { ...@@ -14,6 +14,7 @@ export function debounce(fn, wait) {
// 节流 // 节流
export function throttle(func, delay) { export function throttle(func, delay) {
console.log('节流流~~');
var prev = Date.now(); var prev = Date.now();
return function () { return function () {
var context = this; var context = this;
......
!function i(o,a,r){function l(t,e){if(!a[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(s)return s(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=a[t]={exports:{}},o[t][0].call(n.exports,function(e){return l(o[t][1][e]||e)},n,n.exports,i,o,a,r)}return a[t].exports}for(var s="function"==typeof require&&require,e=0;e<r.length;e++)l(r[e]);return l}({1:[function(e,t,n){var i,o,t=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function l(t){if(i===setTimeout)return setTimeout(t,0);if((i===a||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:a}catch(e){i=a}try{o="function"==typeof clearTimeout?clearTimeout:r}catch(e){o=r}}();var s,c=[],u=!1,p=-1;function g(){u&&s&&(u=!1,s.length?c=s.concat(c):p=-1,c.length&&d())}function d(){if(!u){var e=l(g);u=!0;for(var t=c.length;t;){for(s=c,c=[];++p<t;)s&&s[p].run();p=-1,t=c.length}s=null,u=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===r||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function h(){}t.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new m(e,t)),1!==c.length||u||l(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=h,t.addListener=h,t.once=h,t.off=h,t.removeListener=h,t.removeAllListeners=h,t.emit=h,t.prependListener=h,t.prependOnceListener=h,t.listeners=function(e){return[]},t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},{}],2:[function(e,t,a){!function(o,t){!function(){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.hylBannerLink=i,a.hylToLink=s;var r=void 0,m=void 0,h=void 0,f=void 0,v=void 0,l=void 0,k="",n=null;function i(e){var t,n,i,o,a,r,l,s,c,u,p,g,d;k=$nuxt.$store,console.log("hylBannerLink",e),3!=e.type?1.1==e.type&&(1==k.state.miniProgram||2==k.state.miniProgram?-1<e.link.indexOf("pages/hiberDrawEntity/hiberDrawEntity")?(t=e.link.split("?"))[1]&&t[1].split("=")[1]&&(l=JSON.parse(decodeURIComponent(t[1].split("=")[1])),c=(s=l).id,u=l.type,p=l.isOpenDraw,g=v.formatDate.format(new Date),d=(d=l.validTimeEnd).split(".").join("-"),2==l.validTimeEnd.split(" ").length||(g=g.split(" ")[0]),g=(g=new Date(d.replace(/-/g,"/")).getTime()-new Date(g.replace(/-/g,"/")).getTime())/1e3,2==p?0<=g?(1==u&&$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}),2==u&&$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}),3==u&&$mp.miniProgram.navigateTo({url:"/pages/draw/turntable/turntable?id="+c})):2==u&&null!=s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?perdraw=33&id="+c}):2==u&&null==s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):m.alert({title:"标题",message:"抽奖已结束"}).then(function(){}):1==u?null==s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c}):2==u?null!=s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c}):$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):null==s.drawRecordEntity?m.alert({title:"标题",message:"抽奖已结束"}).then(function(){}):$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c})):-1<e.link.indexOf("type")?(t=e.link.split("?"),"[object Array]"==Object.prototype.toString.call(t)&&t.length&&(r=t[1].split("&"),n={},r.forEach(function(e){e.split("="),n[e.split("=")[0]]=e.split("=")[1]}),console.log(n),i=n.id,o=n.jumpScore,a=n.type,k.state.sessionId?f.getConsumerScoreFlag({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){0==e.code&&(1==e.object?(o&&0<o&&f.changeScore({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){e.object&&$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})}),o&&o<0&&w.showModal({title:"提示",content:"跳转扣除"+Math.abs(o)+"积分",success:function(e){e.confirm?f.changeScore({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){e.object&&$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})}):e.cancel&&console.log("用户点击取消")}}),o||$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})):$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i}))}):$mp.miniProgram.navigateTo({url:"/pages/login/login"}))):((e.link.includes("pages/draw/draw/draw")||e.link.includes("pages/question/question")||e.link.includes("pages/live/live"))&&(r=y($nuxt.$route.query.mixid+"_location")&&JSON.parse(y($nuxt.$route.query.mixid+"_location")).outId,console.log(r,"跳转id"),r&&(e.link.includes("?")?e.link=e.link+"&addressId="+r:e.link=e.link+"?addressId="+r)),$mp.miniProgram.navigateTo({url:e.link})):h("暂不支持")):1==k.state.miniProgram||2==k.state.miniProgram?$mp.miniProgram.navigateTo({url:"/pages/toMini/toMini?weappPage="+encodeURIComponent(e.link)+"&weappAppId="+e.name}):h("暂不支持")}function s(e){if(e=e.data,console.log("----工具中hyl"),n=e.type,(k=$nuxt.$store).getters["sceneModule/flushbonadingVisible"])if(null!=n&&"undefined"!=n){if(0!=n)if(1==n)"/"==e.link.substring(0,1)?$nuxt.$router.push(e.link):!e.link.startsWith("http")&&!e.link.startsWith("https")||1!=k.state.miniProgram&&2!=k.state.miniProgram?window.location.href=e.link:$mp.miniProgram.navigateTo({url:"/pages/wxArticle/main?link="+encodeURIComponent(e.link)});else if(2==n){var t=e.feature.type;"themeCouponClick"==t||0==t?this.$themeCouponClick(e.feature.value.couponCode,e.feature.value):1==t?(console.log("是分享了。。。。"),2==e.type&&1==e.feature.type&&$nuxt.$SHARE({itemList:e.feature.value})):"themeMemberCardClick"!=t&&2!=t||this.$themeMemberCardClick(e.feature.value)}else if(1.1==n||3==n)i(e);else if(1.2==n){if("outerChain:businessCenter"==e.link)return console.log(l.GUIDE_URL,"-----shopConfig.GUIDE_URL"),t=l.GUIDE_URL+"/login?mixid="+$nuxt.$route.query.mixid+"&back="+encodeURIComponent(window.location.href),void(window.location.href=t);"/"==e.link.substring(0,1)?$nuxt.$router.push(e.link):1==k.state.miniProgram||2==k.state.miniProgram?$mp.miniProgram.navigateTo({url:"/pages/wxArticle/main?link="+encodeURIComponent(e.link)}):window.location.href=e.link}else 0<e.length&&$nuxt.$router.push(e.link)}else 0<e.length&&$nuxt.$router.push(e)}function y(e){if(o.browser&&"undefined"!=typeof document)for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var i=t[n].split("=");if(i[0].trim()==e)return decodeURIComponent(i[1])}}Object.defineProperty(a,"__esModule",{value:!0}),a.themeToLinkInit=e,a.$themeToLink=R;var c=null,u=null,p=null,r=void 0,g=void 0,l=void 0,h=void 0,s=void 0,d=void 0,w=void 0,C=void 0;function T(e,t){t=1<arguments.length&&void 0!==t?t:"";return"../index/main?from=themeLink&backpath="+encodeURIComponent(e)+"&params="+encodeURIComponent(t)}function P(){return 1==c?this.$store&&this.$store.state.sessionId&&this.$store.state.sessionId:2==c?w&&w.getStorageSync("sessionid"):void 0}function $(){return 1==c&&this.$store&&this.$store.state.miniProgram}function b(){return 1==c?l.GUIDE_URL:2==c?config.GUIDE_URL:void 0}function I(e){return e.link.split("?")[0]}function x(e){var e=e.link.split("?"),n=[];return e.forEach(function(e,t){1<=t&&n.push(e)}),n.join("?")||""}function D(t){var e=getApp();return e.globalData.footerVal?e.globalData.footerVal.componentData.list.findIndex(function(e){return I(e.link)==t.split("?")[0]}):-1}var L=["index","media-video","goods-goodsInfo","goods-commodityMenu","goodsSearch-goodsSearch","chooseStores","activty-receivingGift","activty","login-register","login-phoneLogin","login-authInformation","login-forgetPassWord","login-accountLogin","login-wxRegister","pay-payList","comment-evaluateList","goods-commonProblemList","article-articlePage","article-articleList","goods-posters","liveBroadcast","liveBroadcast-list","personalCenter-coupon-getCoupon","buyerShow-showDetail","goods-addGoodsList","personalCenter-CDkey-exchange","giftCards-linkReceive","giftCoupon-preview","smartForm","shopCart-shareShopCart","groupBuying-beInvite","brandTopics","personalCenter-spokesmanCenter","personalCenter-spokesmanCenter-mine-spokesmanHomePage","liveBroadcast-lived","personalCenter-spokesmanCenter-mine-getBusinessCard","changeAdr"].map(function(e){return"/index"==(e="/"+e.replace(/-/g,"/"))?"/":e});function e(e){var t=e.homeNative,n=e.wx,i=e.getCoupon,o=e.themeMemberCardClick,a=e.requireFun,e=e.extend;if(C=e,c=t,d=a,console.log(d,"-------------------------115"),g=d.createdUserJWT,d.getBcakUrl,w=n,console.log(c,"-------------themeToLinkInit"),console.log("toPage-------------"),p=1==c?function(e){var t=e.pagePath;1==(e=void 0===(e=e.pageType)?1:e)?this.$router.push(t):2==e?window.location.href=t:3==e&&w.navigateTo({url:t})}:2==c?function(e){var t=e.pagePath;1==(e=void 0===(e=e.pageType)?1:e)?(console.log("pagePath",t),w.navigateTo({url:t})):2==e&&w.reLaunch({url:t})}:void 0,1==c)try{r=d.Vue,l=d.shopConfig,r.prototype.$themeToLink=R,h=d.Toast,s=d.hylToLink}catch(e){}else 2==c&&((u=getApp()).$themeToLink=R,u.getCoupon=i,u.themeMemberCardClick=o)}function U(e){if(!(e=e.split("?")[1]))return{};for(var t,n,i=e.split("&"),o={},a=0;a<i.length;a++)t=(n=i[a].split("="))[0],n=n[1],console.log(81,this),o[t]=n;return o}async function R(t){if(console.log(t,"$themeToLink"),console.log(C,"extend======="),console.log("data",t),C.loginIntercept&&!P.call(this)){console.log("走进来了");var e="/pages/login/main?back="+I(t)+"&params="+JSON.stringify(U(t.link));return p({pagePath:e}),!1}if(t.type&&t.link&&t.link.includes("dynamicForm")){if(!P.call(this)){console.log("走进来了--dynamicForm");var n="/pages/login/main?back="+I(t)+"&params="+JSON.stringify(U(t.link));return p({pagePath:n}),!1}await g().then(function(e){t.link+="&token="+e}).catch(function(e){})}var i,o,a,r;1==c&&this.$store.getters["sceneModule/flushbonadingVisible"]?s.call(this,{data:t,Vue:d.Vue,Dialog:d.Dialog,Toast:d.Toast,hyl:d.hyl,dateFilter:d.dateFilter,shopConfig:d.shopConfig}):(e=t.type,console.log(t.key,"----------------------key"),(2==e||2!=c||t.key&&t.key.startsWith("1.9")||t.link&&t.link.startsWith("/activty/")||t.link.startsWith("/article/")||function(e){var t=I(e),n=x(e);if(console.log("parseLink",t),console.log("parseQuery",n),console.log("noLoginListPath",L),L.includes(t)||"/goods/"==t.substr(0,7)||t.includes("/brandTopics")||P.call(this))return!(0<=(i=D(t)))||(i=0==i?D("/"):i,t="/"==t?"/pages/home/main":"/pages/tabBar"+i+"/main",(i=getCurrentPages())[i.length-1].route!=t&&(p({pagePath:t+(n?"?"+n:""),pageType:2}),0));var i="",i=-1<n.indexOf("scene=sso")?"/pages/login/main?back="+t+"&ossLink="+encodeURIComponent(n):"/pages/login/main?back="+t+"&params="+JSON.stringify(U(e.link));return console.log(i,"------------------------190"),p({pagePath:i}),0}(t))&&(null!=e&&"undefined"!=e?0==e||(1==e?"/"==t.link.substring(0,1)?1==c?p.call(this,{pagePath:t.link}):2==c&&(i="",i=t.link&&t.link.startsWith("/article/")?"/pages/pages_subpack/article/main?article_id="+(n=t.link.split("/"))[n.length-1]:T(I(t),x(t)),console.log("url",i),p({pagePath:i})):t.link.startsWith("http")||t.link.startsWith("https")?1==c?p.call(this,{pagePath:t.link,pageType:2}):(i="/pages/wxArticle/main?link="+encodeURIComponent(t.link),p({pagePath:i})):p({pagePath:t.link,pageType:2}):1.1==e?2==c?p({pagePath:t.link}):1==c&&(1==$.call(this)||2==$.call(this)?p.call(this,{pagePath:t.link,pageType:3}):h("暂不支持")):1.2==e?"outerChain:businessCenter"!=t.link?"/"==t.link.substring(0,1)?p.call(this,{pagePath:t.link}):1==c?1==this.$store.state.miniProgram||2==this.$store.state.miniProgram?(o="/pages/wxArticle/main?link="+encodeURIComponent(t.link),p.call(this,{pagePath:o,pageType:3})):p.call(this,{pagePath:t.link,pageType:2}):2==c&&(o="/pages/wxArticle/main?link="+encodeURIComponent(t.link),p.call(this,{pagePath:o,pageType:1})):(console.log(b(),"-----getGUIDE_URL()"),a=b()+"/login?mixid="+this.$nuxt.$route.query.mixid+"&back="+encodeURIComponent(window.location.href),p.call(this,{pagePath:a,pageType:2})):2==e?"themeCouponClick"==(a=t.feature.type)||0==a?1==c?this.$themeCouponClick(t.feature.value.couponCode,t.feature.value):2==c&&u.getCoupon(t.feature.value.couponCode,t.feature.value):1==a?2==t.type&&1==t.feature.type&&function(e){1==c?this.$nuxt.$SHARE({itemList:e.feature.value}):2==c&&u.shareInit({itemList:e.feature.value})}.call(this,t):"themeMemberCardClick"!=a&&2!=a||(1==c?this.$themeMemberCardClick(t.feature.value):2==c&&u.themeMemberCardClick(t.feature.value)):3==e?(console.log(c,"-----------------homeNative"),1==c?1==$.call(this)||2==$.call(this)?(e=this.$store.getters["sceneModule/flushbonadingVisible"]?"/pages/toMini/toMini?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name:"/pages/toMini/main?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,p.call(this,{pagePath:e,pageType:3})):h("暂不支持"):t.key&&t.key.startsWith("1.9")?function(e){if(console.log("sss",e),2==c)switch(e.key){case"1.9.1":console.log("begin"),w.openChannelsActivity?w.openChannelsActivity({finderUserName:e.name,feedId:e.link,success:function(){console.log("success")},fail:function(){console.log("fail"),E.call(this,"提示","打开视频号失败")}}):E.call(this),console.log("end");break;case"1.9.2":console.log("begin"),w.openChannelsEvent?w.openChannelsEvent({finderUserName:e.name,eventId:e.link,fail:function(){E.call(this,"提示","打开视频号活动失败")}}):E.call(this),console.log("end")}}.call(this,t):(r="/pages/toMini/main?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,p({pagePath:r}))):0<t.length&&p.call(this,{pagePath:t.link})):0<t.length&&(1==c?p.call(this,{pagePath:t}):2==c&&(r=T(I(t),x(t)),p({pagePath:r})))))}function E(){w.showModal({title:0<arguments.length&&void 0!==arguments[0]?arguments[0]:"提示",content:1<arguments.length&&void 0!==arguments[1]?arguments[1]:"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"}),console.log("不支持")}t.themeToLinkInit=e}.call(this)}.call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:1}]},{},[2]); !function i(o,a,r){function l(t,e){if(!a[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(s)return s(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=a[t]={exports:{}},o[t][0].call(n.exports,function(e){return l(o[t][1][e]||e)},n,n.exports,i,o,a,r)}return a[t].exports}for(var s="function"==typeof require&&require,e=0;e<r.length;e++)l(r[e]);return l}({1:[function(e,t,n){var i,o,t=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function l(t){if(i===setTimeout)return setTimeout(t,0);if((i===a||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:a}catch(e){i=a}try{o="function"==typeof clearTimeout?clearTimeout:r}catch(e){o=r}}();var s,c=[],u=!1,p=-1;function g(){u&&s&&(u=!1,s.length?c=s.concat(c):p=-1,c.length&&d())}function d(){if(!u){var e=l(g);u=!0;for(var t=c.length;t;){for(s=c,c=[];++p<t;)s&&s[p].run();p=-1,t=c.length}s=null,u=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===r||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function h(){}t.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new m(e,t)),1!==c.length||u||l(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=h,t.addListener=h,t.once=h,t.off=h,t.removeListener=h,t.removeAllListeners=h,t.emit=h,t.prependListener=h,t.prependOnceListener=h,t.listeners=function(e){return[]},t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},{}],2:[function(e,t,a){!function(o,t){!function(){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.hylBannerLink=i,a.hylToLink=s;var r=void 0,m=void 0,h=void 0,f=void 0,v=void 0,l=void 0,k="",n=null;function i(e){var t,n,i,o,a,r,l,s,c,u,p,g,d;k=$nuxt.$store,console.log("hylBannerLink",e),3!=e.type?1.1==e.type&&(1==k.state.miniProgram||2==k.state.miniProgram?-1<e.link.indexOf("pages/hiberDrawEntity/hiberDrawEntity")?(t=e.link.split("?"))[1]&&t[1].split("=")[1]&&(l=JSON.parse(decodeURIComponent(t[1].split("=")[1])),c=(s=l).id,u=l.type,p=l.isOpenDraw,g=v.formatDate.format(new Date),d=(d=l.validTimeEnd).split(".").join("-"),2==l.validTimeEnd.split(" ").length||(g=g.split(" ")[0]),g=(g=new Date(d.replace(/-/g,"/")).getTime()-new Date(g.replace(/-/g,"/")).getTime())/1e3,2==p?0<=g?(1==u&&$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}),2==u&&$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}),3==u&&$mp.miniProgram.navigateTo({url:"/pages/draw/turntable/turntable?id="+c})):2==u&&null!=s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?perdraw=33&id="+c}):2==u&&null==s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):m.alert({title:"标题",message:"抽奖已结束"}).then(function(){}):1==u?null==s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c}):2==u?null!=s.drawRecordEntity?$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c}):$mp.miniProgram.navigateTo({url:"/pages/draw/drawDetails/drawDetails?id="+c}):null==s.drawRecordEntity?m.alert({title:"标题",message:"抽奖已结束"}).then(function(){}):$mp.miniProgram.navigateTo({url:"/pages/draw/openDraw/openDraw?id="+c})):-1<e.link.indexOf("type")?(t=e.link.split("?"),"[object Array]"==Object.prototype.toString.call(t)&&t.length&&(r=t[1].split("&"),n={},r.forEach(function(e){e.split("="),n[e.split("=")[0]]=e.split("=")[1]}),console.log(n),i=n.id,o=n.jumpScore,a=n.type,k.state.sessionId?f.getConsumerScoreFlag({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){0==e.code&&(1==e.object?(o&&0<o&&f.changeScore({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){e.object&&$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})}),o&&o<0&&y.showModal({title:"提示",content:"跳转扣除"+Math.abs(o)+"积分",success:function(e){e.confirm?f.changeScore({outId:k.state.userInfo.mixId,advertisementId:i}).then(function(e){e.object&&$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})}):e.cancel&&console.log("用户点击取消")}}),o||$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i})):$mp.miniProgram.navigateTo({url:"/pages/advertisement/advertisement?type="+a+"&id="+i}))}):$mp.miniProgram.navigateTo({url:"/pages/login/login"}))):((e.link.includes("pages/draw/draw/draw")||e.link.includes("pages/question/question")||e.link.includes("pages/live/live"))&&(r=w($nuxt.$route.query.mixid+"_location")&&JSON.parse(w($nuxt.$route.query.mixid+"_location")).outId,console.log(r,"跳转id"),r&&(e.link.includes("?")?e.link=e.link+"&addressId="+r:e.link=e.link+"?addressId="+r)),$mp.miniProgram.navigateTo({url:e.link})):h("暂不支持")):1==k.state.miniProgram||2==k.state.miniProgram?$mp.miniProgram.navigateTo({url:"/pages/toMini/toMini?weappPage="+encodeURIComponent(e.link)+"&weappAppId="+e.name}):h("暂不支持")}function s(e){if(e=e.data,console.log("----工具中hyl"),n=e.type,(k=$nuxt.$store).getters["sceneModule/flushbonadingVisible"])if(null!=n&&"undefined"!=n){if(0!=n)if(1==n)"/"==e.link.substring(0,1)?$nuxt.$router.push(e.link):!e.link.startsWith("http")&&!e.link.startsWith("https")||1!=k.state.miniProgram&&2!=k.state.miniProgram?window.location.href=e.link:$mp.miniProgram.navigateTo({url:"/pages/wxArticle/main?link="+encodeURIComponent(e.link)});else if(2==n){var t=e.feature.type;"themeCouponClick"==t||0==t?this.$themeCouponClick(e.feature.value.couponCode,e.feature.value):1==t?(console.log("是分享了。。。。"),2==e.type&&1==e.feature.type&&$nuxt.$SHARE({itemList:e.feature.value})):"themeMemberCardClick"!=t&&2!=t||this.$themeMemberCardClick(e.feature.value)}else if(1.1==n||3==n)i(e);else if(1.2==n){if("outerChain:businessCenter"==e.link)return console.log(l.GUIDE_URL,"-----shopConfig.GUIDE_URL"),t=l.GUIDE_URL+"/login?mixid="+$nuxt.$route.query.mixid+"&back="+encodeURIComponent(window.location.href),void(window.location.href=t);"/"==e.link.substring(0,1)?$nuxt.$router.push(e.link):1==k.state.miniProgram||2==k.state.miniProgram?$mp.miniProgram.navigateTo({url:"/pages/wxArticle/main?link="+encodeURIComponent(e.link)}):window.location.href=e.link}else 0<e.length&&$nuxt.$router.push(e.link)}else 0<e.length&&$nuxt.$router.push(e)}function w(e){if(o.browser&&"undefined"!=typeof document)for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var i=t[n].split("=");if(i[0].trim()==e)return decodeURIComponent(i[1])}}Object.defineProperty(a,"__esModule",{value:!0}),a.themeToLinkInit=e,a.$themeToLink=R;var c=null,u=null,p=null,r=void 0,g=void 0,l=void 0,h=void 0,s=void 0,d=void 0,y=void 0,C=void 0;function T(e,t){t=1<arguments.length&&void 0!==t?t:"";return"../index/main?from=themeLink&backpath="+encodeURIComponent(e)+"&params="+encodeURIComponent(t)}function P(){return 1==c?this.$store&&this.$store.state.sessionId&&this.$store.state.sessionId:2==c?y&&y.getStorageSync("sessionid"):void 0}function $(){return 1==c&&this.$store&&this.$store.state.miniProgram}function b(){return 1==c?l.GUIDE_URL:2==c?config.GUIDE_URL:void 0}function I(e){return e.link.split("?")[0]}function x(e){var e=e.link.split("?"),n=[];return e.forEach(function(e,t){1<=t&&n.push(e)}),n.join("?")||""}function D(t){var e=getApp();return e.globalData.footerVal?e.globalData.footerVal.componentData.list.findIndex(function(e){return I(e.link)==t.split("?")[0]}):-1}var L=["index","media-video","goods-goodsInfo","goods-commodityMenu","goodsSearch-goodsSearch","chooseStores","activty-receivingGift","activty","login-register","login-phoneLogin","login-authInformation","login-forgetPassWord","login-accountLogin","login-wxRegister","pay-payList","comment-evaluateList","goods-commonProblemList","article-articlePage","article-articleList","goods-posters","liveBroadcast","liveBroadcast-list","personalCenter-coupon-getCoupon","buyerShow-showDetail","goods-addGoodsList","personalCenter-CDkey-exchange","giftCards-linkReceive","giftCoupon-preview","smartForm","shopCart-shareShopCart","groupBuying-beInvite","brandTopics","personalCenter-spokesmanCenter","personalCenter-spokesmanCenter-mine-spokesmanHomePage","liveBroadcast-lived","personalCenter-spokesmanCenter-mine-getBusinessCard","changeAdr"].map(function(e){return"/index"==(e="/"+e.replace(/-/g,"/"))?"/":e});function e(e){var t=e.homeNative,n=e.wx,i=e.getCoupon,o=e.themeMemberCardClick,a=e.requireFun,e=e.extend;if(C=e,c=t,d=a,console.log(d,"-------------------------115"),g=d.createdUserJWT,d.getBcakUrl,y=n,console.log(c,"-------------themeToLinkInit"),console.log("toPage-------------"),p=1==c?function(e){var t=e.pagePath;1==(e=void 0===(e=e.pageType)?1:e)?this.$router.push(t):2==e?window.location.href=t:3==e&&y.navigateTo({url:t})}:2==c?function(e){var t=e.pagePath;1==(e=void 0===(e=e.pageType)?1:e)?(console.log("pagePath",t),y.navigateTo({url:t})):2==e&&y.reLaunch({url:t})}:void 0,1==c)try{r=d.Vue,l=d.shopConfig,r.prototype.$themeToLink=R,h=d.Toast,s=d.hylToLink}catch(e){}else 2==c&&((u=getApp()).$themeToLink=R,u.getCoupon=i,u.themeMemberCardClick=o)}function U(e){if(!(e=e.split("?")[1]))return{};for(var t,n,i=e.split("&"),o={},a=0;a<i.length;a++)t=(n=i[a].split("="))[0],n=n[1],console.log(81,this),o[t]=n;return o}async function R(t){if(console.log(t,"$themeToLink"),console.log(C,"extend======="),console.log("data",t),C.loginIntercept&&!P.call(this)){console.log("走进来了");var e="/pages/login/main?back="+I(t)+"&params="+JSON.stringify(U(t.link));return p({pagePath:e}),!1}if(t.type&&t.link&&t.link.includes("dynamicForm")){if(!P.call(this)){console.log("走进来了--dynamicForm");var n="/pages/login/main?back="+I(t)+"&params="+JSON.stringify(U(t.link));return p({pagePath:n}),!1}await g().then(function(e){t.link+="&token="+e}).catch(function(e){})}var i,o,a,r;1==c&&this.$store.getters["sceneModule/flushbonadingVisible"]?s.call(this,{data:t,Vue:d.Vue,Dialog:d.Dialog,Toast:d.Toast,hyl:d.hyl,dateFilter:d.dateFilter,shopConfig:d.shopConfig}):(e=t.type,console.log(t.key,"----------------------key"),(2==e||2!=c||t.key&&t.key.startsWith("1.9")||t.link&&t.link.startsWith("/activty/")||t.link.startsWith("/article/")||function(e){var t=I(e),n=x(e);if(L.includes(t)||"/goods/"==t.substr(0,7)||t.includes("/brandTopics")||P.call(this))return!(0<=(i=D(t)))||(i=0==i?D("/"):i,t="/"==t?"/pages/home/main":"/pages/tabBar"+i+"/main",(i=getCurrentPages())[i.length-1].route!=t&&(p({pagePath:t+(n?"?"+n:""),pageType:2}),0));var i="",i=-1<n.indexOf("scene=sso")?"/pages/login/main?back="+t+"&ossLink="+encodeURIComponent(n):"/pages/login/main?back="+t+"&params="+JSON.stringify(U(e.link));return console.log(i,"------------------------190"),p({pagePath:i}),0}(t))&&(null!=e&&"undefined"!=e?0==e||(1==e?"/"==t.link.substring(0,1)?1==c?p.call(this,{pagePath:t.link}):2==c&&(i="",i=t.link&&/\/article\/[\d]+/.test(t.link)?"/pages/pages_subpack/article/main?article_id="+(n=t.link.split("/"))[n.length-1]:T(I(t),x(t)),console.log("url",i),p({pagePath:i})):t.link.startsWith("http")||t.link.startsWith("https")?1==c?p.call(this,{pagePath:t.link,pageType:2}):(i="/pages/wxArticle/main?link="+encodeURIComponent(t.link),p({pagePath:i})):p({pagePath:t.link,pageType:2}):1.1==e?2==c?p({pagePath:t.link}):1==c&&(1==$.call(this)||2==$.call(this)?p.call(this,{pagePath:t.link,pageType:3}):h("暂不支持")):1.2==e?"outerChain:businessCenter"!=t.link?"/"==t.link.substring(0,1)?p.call(this,{pagePath:t.link}):1==c?1==this.$store.state.miniProgram||2==this.$store.state.miniProgram?(o="/pages/wxArticle/main?link="+encodeURIComponent(t.link),p.call(this,{pagePath:o,pageType:3})):p.call(this,{pagePath:t.link,pageType:2}):2==c&&(o="/pages/wxArticle/main?link="+encodeURIComponent(t.link),p.call(this,{pagePath:o,pageType:1})):(console.log(b(),"-----getGUIDE_URL()"),a=b()+"/login?mixid="+this.$nuxt.$route.query.mixid+"&back="+encodeURIComponent(window.location.href),p.call(this,{pagePath:a,pageType:2})):2==e?"themeCouponClick"==(a=t.feature.type)||0==a?1==c?this.$themeCouponClick(t.feature.value.couponCode,t.feature.value):2==c&&u.getCoupon(t.feature.value.couponCode,t.feature.value):1==a?2==t.type&&1==t.feature.type&&function(e){1==c?this.$nuxt.$SHARE({itemList:e.feature.value}):2==c&&u.shareInit({itemList:e.feature.value})}.call(this,t):"themeMemberCardClick"!=a&&2!=a||(1==c?this.$themeMemberCardClick(t.feature.value):2==c&&u.themeMemberCardClick(t.feature.value)):3==e?(console.log(c,"-----------------homeNative"),1==c?1==$.call(this)||2==$.call(this)?(e=this.$store.getters["sceneModule/flushbonadingVisible"]?"/pages/toMini/toMini?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name:"/pages/toMini/main?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,p.call(this,{pagePath:e,pageType:3})):h("暂不支持"):t.key&&t.key.startsWith("1.9")?function(e){if(console.log("sss",e),2==c)switch(e.key){case"1.9.1":console.log("begin"),y.openChannelsActivity?y.openChannelsActivity({finderUserName:e.name,feedId:e.link,success:function(){console.log("success")},fail:function(){console.log("fail"),E.call(this,"提示","打开视频号失败")}}):E.call(this),console.log("end");break;case"1.9.2":console.log("begin"),y.openChannelsEvent?y.openChannelsEvent({finderUserName:e.name,eventId:e.link,fail:function(){E.call(this,"提示","打开视频号活动失败")}}):E.call(this),console.log("end")}}.call(this,t):(r="/pages/toMini/main?weappPage="+encodeURIComponent(t.link)+"&weappAppId="+t.name,p({pagePath:r}))):0<t.length&&p.call(this,{pagePath:t.link})):0<t.length&&(1==c?p.call(this,{pagePath:t}):2==c&&(r=T(I(t),x(t)),p({pagePath:r})))))}function E(){y.showModal({title:0<arguments.length&&void 0!==arguments[0]?arguments[0]:"提示",content:1<arguments.length&&void 0!==arguments[1]?arguments[1]:"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"}),console.log("不支持")}t.themeToLinkInit=e}.call(this)}.call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:1}]},{},[2]);
\ No newline at end of file \ No newline at end of file
<!-- 商品列表item --> <!-- 商品列表item -->
<view wx:if="{{items && datas.componentData['style'] == 'list' && items.loadState == false}}">
<view class="skeleton-animate">
<view class="skeleton-bg skeleton-img"></view>
<view class="skeleton-bg skeleton-title"></view>
<view class="skeleton-bg skeleton-detail"></view>
<view class="skeleton-bg skeleton-price"></view>
</view>
</view>
<view <view
class="goodsItem {{datas.componentData.style==='rowList'?'goodsRowList':''}} {{datas.componentData.style==='heap'?'goodsRowList goodsHeapItem':''}}" class="goodsItem {{datas.componentData.style==='rowList'?'goodsRowList':''}} {{datas.componentData.style==='heap'?'goodsRowList goodsHeapItem':''}}"
style="--proGap2:{{datas.componentData.proGap*2}}rpx;" style="--proGap2:{{datas.componentData.proGap*2}}rpx;"
bindtap="onclickProduct" bindtap="onclickProduct"
wx:else
> >
<view class="goods-item-child {{datas.componentData['borderColorShow']?'goods-item-child-bd':''}}" style="border-radius:{{datas.componentData.borderRadius*2}}rpx;--border_color:{{datas.componentData['borderColor']}};box-shadow:{{datas.componentData['cardShadow']?'0rpx 0rpx 10rpx '+datas.componentData['cardShadowSize']*2+'rpx #ccc':''}};"> <view class="goods-item-child {{datas.componentData['borderColorShow']?'goods-item-child-bd':''}}" style="border-radius:{{datas.componentData.borderRadius*2}}rpx;--border_color:{{datas.componentData['borderColor']}};box-shadow:{{datas.componentData['cardShadow']?'0rpx 0rpx 10rpx '+datas.componentData['cardShadowSize']*2+'rpx #ccc':''}};">
<!-- 商户入口-顶部 --> <!-- 商户入口-顶部 -->
...@@ -56,6 +66,7 @@ ...@@ -56,6 +66,7 @@
<image mode="widthFix" src="{{datas.componentData['angleSignImg']}}" /> <image mode="widthFix" src="{{datas.componentData['angleSignImg']}}" />
</view> </view>
<!-- 商品主图 --> <!-- 商品主图 -->
<!-- {{items.loadState}}--{{items.loadProductImgUrl}}--{{items.productImgUrl}} -->
<image <image
lazy-load lazy-load
mode="{{datas.componentData.style==='rowList' || datas.componentData.style==='heap'?'aspectFit':'widthFix'}}" mode="{{datas.componentData.style==='rowList' || datas.componentData.style==='heap'?'aspectFit':'widthFix'}}"
......
@import "/static/font/common_icon.wxss"; @import "/static/font/common_icon.wxss";
/* 商品列表骨架屏 */
@import "/static/css/skeleton.wxss";
.flex{ .flex{
display: flex; display: flex;
} }
......
const app = getApp(); const app = getApp();
const { goodsApi, DFSImg, $themeToLink } = app; const { goodsApi, DFSImg, $themeToLink,tool } = app;
const componentOptions = { const componentOptions = {
// 组件选项 // 组件选项
options: { options: {
...@@ -9,7 +9,20 @@ const componentOptions = { ...@@ -9,7 +9,20 @@ const componentOptions = {
properties: { properties: {
datas: { datas: {
type: Object type: Object
} },
datasIndex:{
type: Number,
value:0,
observer: function () {
// console.log('aaa');
// this.init()
}
},
goodsListIndex:{
type:Number,
value:0,
},
}, },
// 组件数据 // 组件数据
data: { data: {
...@@ -21,12 +34,20 @@ const componentOptions = { ...@@ -21,12 +34,20 @@ const componentOptions = {
loading: false, loading: false,
finished: false, finished: false,
goodsList:[], goodsList:[],
rectsLength:0,
storageGoodsList:[],
storageDatasList:[],
pageSize:10,
pageNum:1,
pageGoodsList:[],
loadingFlag:true
}, },
// 数据监听器 // 数据监听器
observers: {}, observers: {},
// 组件生命周期 // 组件生命周期
lifetimes: { lifetimes: {
created() {}, created() {
},
ready() { ready() {
this.init(); this.init();
}, },
...@@ -62,6 +83,10 @@ const componentOptions = { ...@@ -62,6 +83,10 @@ const componentOptions = {
// 组件方法 // 组件方法
methods: { methods: {
init() { init() {
// console.log(this.data.datasIndex,this.data.goodsListIndex,'init');
// if (this.data.datasIndex != this.data.goodsListIndex ) {
// return
// }
let { let {
goodsType, goodsType,
goodsSource, goodsSource,
...@@ -170,7 +195,7 @@ const componentOptions = { ...@@ -170,7 +195,7 @@ const componentOptions = {
page: 1, page: 1,
rows: terminalProductIds.length, rows: terminalProductIds.length,
terminalProductIds: terminalProductIds, terminalProductIds: terminalProductIds,
whetherShowSoldOutGoods: this.whetherShowSoldOutGoods whetherShowSoldOutGoods: app.shop_configuration.whetherShowSoldOutGoods
}; // 当前页 // 一页多少条 }; // 当前页 // 一页多少条
this.briefProduct(briefQuery); this.briefProduct(briefQuery);
} }
...@@ -223,6 +248,8 @@ const componentOptions = { ...@@ -223,6 +248,8 @@ const componentOptions = {
item.shopLogoUrl = DFSImg(item.shopLogoUrl); item.shopLogoUrl = DFSImg(item.shopLogoUrl);
item.coverImage = DFSImg(item.coverImage, 400, 400, 1); item.coverImage = DFSImg(item.coverImage, 400, 400, 1);
item.productImgUrl = DFSImg(item.productImgUrl, 400, 400, 1); item.productImgUrl = DFSImg(item.productImgUrl, 400, 400, 1);
item.loadState = false
item.loadProductImgUrl = ""
item.minPrice = Number(item.minPrice).toFixed(2); item.minPrice = Number(item.minPrice).toFixed(2);
item.qty = Number(item.qty); item.qty = Number(item.qty);
item.saleQty = item.saleQty ? Number(item.saleQty) : 1; item.saleQty = item.saleQty ? Number(item.saleQty) : 1;
...@@ -243,10 +270,54 @@ const componentOptions = { ...@@ -243,10 +270,54 @@ const componentOptions = {
item.getSaleTime = this.getSaleTime(item.saleTime); item.getSaleTime = this.getSaleTime(item.saleTime);
} }
}); });
var that = this
this.setData({ this.setData({
"datas.componentData.goodsList": goodsList, "datas.componentData.goodsList": goodsList,
goodsList goodsList
}); },function () {
var num = 0
wx.createSelectorQuery().selectAll("._goods-list").boundingClientRect(function(rects){
console.log(rects,'rects');
rects.forEach((e,v)=>{
num ++
})
let storageGoodsList = wx.getStorageSync('storageGoodsList') || []
let storageDatasList = wx.getStorageSync('storageDatasList') || []
storageGoodsList.push(goodsList)
storageDatasList.push(that.data.datas.componentData)
wx.setStorageSync('storageGoodsList', storageGoodsList);
wx.setStorageSync('storageDatasList', storageDatasList);
console.log(storageGoodsList.length,num,'storageGoodsList.length');
let pageGoodsList = []
pageGoodsList[that.data.datasIndex] = storageGoodsList[that.data.datasIndex].slice(0,10)
wx.setStorageSync('pageGoodsList', pageGoodsList);
that.setData({
pageGoodsList
},function () {
that.lazyloading();
})
// if (storageGoodsList.length == num) {
// that.setData({
// storageGoodsList
// })
// console.log(that.data.storageGoodsList,'storageGoodsList');
// }
}).exec();
// 节点布局方案在组件嵌套层级过深测试无效
// let goodsList = this.data.goodsList // 获取原数据
// goodsList.forEach((item,index)=>{
// wx.createIntersectionObserver().relativeToViewport({bottom: 20}).observe(`.goodsItemIndex${index}`, (ret) => {
// // if (ret.intersectionRatio > 0){
// // group[i].show = true
// // }
// // this.setData({ // 更新数据
// // group
// // })
// console.log('1111');
// })
// })
})
if (type == 1) { if (type == 1) {
// 初始化 // 初始化
if (this.selectComponent("#waterfallFlow")) { if (this.selectComponent("#waterfallFlow")) {
...@@ -259,6 +330,96 @@ const componentOptions = { ...@@ -259,6 +330,96 @@ const componentOptions = {
} }
} }
}, },
// 触发图片加载
lazyloading(){
var that = this
let storageDatasList = wx.getStorageSync('storageDatasList') || []
console.log('storageDatasList',storageDatasList);
let { style } = storageDatasList[that.data.datasIndex];
let type = ''
if(style == 'list'){
type = 'goods-item'
}else{
return
}
// console.log(that.data.datasIndex,that.data.goodsListIndex,'index');
// if (that.data.datasIndex != that.data.goodsListIndex) {
// return
// }
let windowHeight = wx.getSystemInfoSync().windowHeight
// let goodsList = that.data.goodsList
let pageGoodsList = wx.getStorageSync('pageGoodsList') || []
let loadingFlag = false
if (!that.data.loadingFlag) {
return
}
wx.createSelectorQuery().selectAll(`.goodsListItemIndex${that.data.datasIndex}>>>.${type}`).boundingClientRect(function(rects){
for (let index = 0; index < rects.length; index++) {
if (rects[index].top == 0 && rects[index].bottom == 0 && rects[index].left == 0 && rects[index].right == 0) {
break
}
if (rects[index].top < windowHeight) {
pageGoodsList[that.data.datasIndex][index].loadState = true
// if (index == storageGoodsList[that.data.datasIndex].length && storageGoodsList[that.data.datasIndex][index].loadState == true) {
// loadingFlag = true
// }
// goodsList[index].loadState = true
}
}
// rects.forEach((item,index)=>{
// if (condition) {
// }
// if (item.top < windowHeight) {
// goodsList[index].loadState = true
// }
// })
that.setData({
// goodsList
pageGoodsList
})
console.log(rects,that.data.pageGoodsList, pageGoodsList[that.data.datasIndex],'fff');
wx.setStorageSync('pageGoodsList',pageGoodsList)
let storageGoodsList = wx.getStorageSync('storageGoodsList')[that.data.datasIndex]
if (storageGoodsList.length == that.data.pageGoodsList.length) {
return
}
if (that.data.pageGoodsList[that.data.datasIndex][that.data.pageGoodsList[that.data.datasIndex].length -1].loadState == true) {
let pageNum = that.data.pageNum
pageNum += 1
that.setData({
pageNum
})
let newPageGoodsList = that.data.pageGoodsList
console.log(pageGoodsList,newPageGoodsList,'newPageGoodsList');
let sliceStorageGoodsList = storageGoodsList.slice((that.data.pageNum - 1) * that.data.pageSize,that.data.pageNum * that.data.pageSize)
newPageGoodsList[that.data.datasIndex].push(...sliceStorageGoodsList)
console.log(sliceStorageGoodsList,newPageGoodsList,'newPageGoodsList2');
that.setData({
loadingFlag:false
})
that.setData({
pageGoodsList:newPageGoodsList
},function(){
wx.setStorageSync('pageGoodsList',pageGoodsList)
that.setData({
loadingFlag:true
})
console.log(that.data.pageGoodsList,pageGoodsList,'pageGoodsList');
})
console.log('load--ok');
}
}).exec();
// let keyStr = `datas.componentData.goodsList[${index}].loadState`;
// this.setData({
// [keyStr]:true
// })
},
getSaleTime(val) { getSaleTime(val) {
return new Date(val.replace(/-/g, "/")).getTime() - new Date().getTime(); return new Date(val.replace(/-/g, "/")).getTime() - new Date().getTime();
}, },
...@@ -328,6 +489,8 @@ const componentOptions = { ...@@ -328,6 +489,8 @@ const componentOptions = {
getScroll(el) { getScroll(el) {
// 是指定分类且不显示查看更多的瀑布流组件滚动加载 // 是指定分类且不显示查看更多的瀑布流组件滚动加载
let { goodsSource, moreShow, style } = this.data.datas.componentData; let { goodsSource, moreShow, style } = this.data.datas.componentData;
console.log('goodsSource, moreShow, style',goodsSource, moreShow, style);
this.lazyloading()
if ( if (
goodsSource == "classify" && goodsSource == "classify" &&
moreShow == false && moreShow == false &&
......
...@@ -25,15 +25,20 @@ ...@@ -25,15 +25,20 @@
style="margin-left:{{-datas.componentData.proGap*2}}rpx;" style="margin-left:{{-datas.componentData.proGap*2}}rpx;"
> >
<view <view
wx:for="{{goodsList}}" wx:for="{{pageGoodsList[datasIndex]}}"
wx:key="index" wx:key="index"
class="goods-item" class="goods-item {{'goodsItemIndex'+index}}"
style="width:{{100/datas.componentData.columnNum}}%;padding-left:{{datas.componentData.proGap*2}}rpx" style="width:{{100/datas.componentData.columnNum}}%;padding-left:{{datas.componentData.proGap*2}}rpx"
> >
<goods-item <!-- <goods-item
datas="{{datas}}" datas="{{datas}}"
items="{{goodsList[index]}}" items="{{goodsList[index]}}"
indexs="{{index}}" indexs="{{index}}"
></goods-item> -->
<goods-item
items="{{pageGoodsList[datasIndex][index]}}"
datas="{{datas}}"
indexs="{{index}}"
></goods-item> ></goods-item>
</view> </view>
</view> </view>
...@@ -60,6 +65,17 @@ ...@@ -60,6 +65,17 @@
</view> </view>
<!-- 瀑布流 --> <!-- 瀑布流 -->
<view wx:if="{{datas.componentData.style==='waterfall'}}"> <view wx:if="{{datas.componentData.style==='waterfall'}}">
<!-- <waterfall-flow
generic:defaultCom="goods-item"
id="waterfallFlow"
note="{{datas.componentData.goodsList}}"
datas="{{datas}}"
padding="{{datas.componentData.proGap}}"
wx:if="{{datas.componentData.goodsList}}"
bindonLoad="onLoad"
loading="{{loading}}"
finished="{{finished}}"
></waterfall-flow> -->
<waterfall-flow <waterfall-flow
generic:defaultCom="goods-item" generic:defaultCom="goods-item"
id="waterfallFlow" id="waterfallFlow"
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
color: #bbb; color: #bbb;
} }
.goods-search .ipt{ .goods-search .ipt{
width: 96%; width: 90%;
margin: 0 auto; margin: 0 auto;
height: 60rpx; height: 60rpx;
align-items: center; align-items: center;
......
...@@ -154,7 +154,15 @@ VantComponent({ ...@@ -154,7 +154,15 @@ VantComponent({
}); });
}, },
onTap(event) { onTap(event) {
const { index } = event.currentTarget.dataset; let index
if (Object.prototype.toString.call(event) == '[object Object]') {
// const { index } = event.currentTarget.dataset;
index = event.currentTarget.dataset.index;
}else{
index = event
}
console.log('index',index);
console.log(this.children);
const child = this.children[index]; const child = this.children[index];
if (child.data.disabled) { if (child.data.disabled) {
this.trigger("disabled", child); this.trigger("disabled", child);
...@@ -213,7 +221,7 @@ VantComponent({ ...@@ -213,7 +221,7 @@ VantComponent({
} }
}, },
resize(skipTransition = false) { resize(skipTransition = false) {
console.log("resize") console.log("resize11")
if (this.data.type !== "line") { if (this.data.type !== "line") {
return; return;
} }
......
...@@ -59,9 +59,9 @@ function trackStyle(data) { ...@@ -59,9 +59,9 @@ function trackStyle(data) {
function lineStyle(data) { function lineStyle(data) {
return style({ return style({
width: utils.addUnit(data.lineWidth - 16), width: utils.addUnit(data.lineWidth - 32),
transform: 'translateX(' + (data.lineOffsetLeft +16) + 'px)', transform: 'translateX(' + (data.lineOffsetLeft +16) + 'px)',
'-webkit-transform': 'translateX(' + (data.lineOffsetLeft + 8) + 'px)', '-webkit-transform': 'translateX(' + (data.lineOffsetLeft + 16) + 'px)',
'background-color': data.color, 'background-color': data.color,
height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null, height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
'border-radius': 'border-radius':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment