Commit c6b56e48 by 程默

fix bug

parent 09b7fa38
const app = getApp();
console.log(app, "apppppppppp");
Component({
pageLifetimes: {
show() {
console.log("哈哈哈哈");
if (typeof this.getTabBar === "function" && this.getTabBar()) {
this.getTabBar().setData({
selected: 1
});
}
}
},
data: {
selected: 0,
color: "#7A7E83",
......@@ -84,21 +72,9 @@ Component({
});
};
}
console.log(this.data.themeColor, "themeColor");
if (typeof this.getTabBar === "function" && this.getTabBar()) {
this.getTabBar().setData({
selected: 1
});
}
this.setData({
mmm: Math.ceil(app.globalData.footerVal.componentData.list.length / 2 - 1)
});
console.log(
Math.ceil(app.globalData.footerVal.componentData.list.length / 2 - 1),
this.data.selected
);
console.log(this.data.mmm, "ready");
},
attached() {
let that = this;
......@@ -108,24 +84,13 @@ Component({
that.data.selected &&
app.globalData.footerVal.componentData["styleSelectionNum"] == 1;
console.log(733333, mm);
that.setData({
componentData: app.globalData.footerVal.componentData,
list: app.globalData.footerVal.componentData.list,
mm: mm
});
console.log(
"777777",
Math.ceil(this.data.list.length / 2 - 1),
this.data.selected,
this.data.componentData["styleSelectionNum"]
);
} else {
console.log(73333381);
app.footerCallBack = function(params) {
console.log("back");
console.log(params,app.globalData.footerVal.componentData)
params.componentData.selectIconColor = app.globalData.footerVal.componentData.selectIconBackground == 1 ? 'val(--main-color)':params.componentData.selectIconColor
that.setData({
componentData: params.componentData,
......@@ -137,20 +102,8 @@ Component({
Math.ceil(params.componentData.list.length / 2 - 1) ==
that.data.selected &&
params.componentData["styleSelectionNum"] == 1;
console.log("87777777", mm);
console.log(that.data.componentData,'componentData')
};
}
// ----------webview 变化
console.log("启动1111", this.getTabBar());
app.webviewCallBack = function(state, params) {
console.log("webview变化", state, params);
};
//
this.setData({
mm:
Math.ceil(this.data.list.length / 2 - 1) == this.data.selected &&
......@@ -158,21 +111,11 @@ Component({
});
},
methods: {
init() {},
switchTab(e) {
const { index } = e.currentTarget.dataset;
console.log("755555555", this.data.list[index].link);
app.$themeToLink(this.data.list[index]["link"], 1);
// this.toPage(this.data.list[index].link,index)
// this.setData({
// selected: index
// })
},
toPage(data, index) {
console.log("index98", index, this);
// index=index==0?index+1:index
// 跳转
if (data.link == "/") {
wx.switchTab({
......@@ -182,9 +125,6 @@ Component({
wx.switchTab({
url: `/pages/tabBar${index}/main`
});
// ?from=tabbar&backpath=${
// data.link
// }
}
}
}
......
......@@ -15,7 +15,7 @@
<!-- {{index}}{{selected}}--{{Math.ceil(5/2-1)}}--{{mm}} -->
<!-- &&componentData['styleSelectionNum']==1 -->
<!-- 图标 -->
<view class="item" class="{{index == selected ? 'current' : ''}}">
<view class="item {{index == selected ? 'current' : ''}}">
<view>
<view wx:if="{{item.iconType==0||!item.iconType}}">
<view class="antt {{item.icon}}" style="font-size:{{componentData.defaultIcon==1 ? '36rpx' : (componentData.defaultIconSize*2 + 'rpx')}};color:{{index==selected?componentData.selectIconColor:componentData.defaultIconColor}}"></view>
......
......@@ -1198,12 +1198,7 @@
}
.tab-bar-item .item{
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
position: relative;
height: 100%;
}
.isItem {
......
......@@ -3,7 +3,7 @@
"extEnable":true,
"extAppid":"wxae95a07ffdf11548",
"ext":{
"mixid":"antgood",
"shopid":67
"mixid":"xyyx",
"shopid":133
}
}
\ No newline at end of file
......@@ -11,9 +11,9 @@ export default {
process.env.NODE_ENV == "production" ||
JSON.stringify(extConfig) == "{}"
) {
extConfig = { mixid: "antgood", shopid: 67 };
// extConfig = { "mixid":"xyyx",
// "shopid":133 };
// extConfig = { mixid: "antgood", shopid: 67 };
extConfig = { "mixid":"xyyx",
"shopid":133 };
}
console.log("1444444444", extConfig);
this.$store.commit("setExtConfig", extConfig.mixid);
......
......@@ -241,7 +241,7 @@ export default {
methods: {
init(pageList) {
this.getCartNum()
setTabBarActive.bind(this)(checkTabbarPage('/'));
this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
......@@ -256,12 +256,6 @@ export default {
},
scrolls(el){
// this.setFooterShow(el);
// if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){
// this.$mp.page.selectComponent(".goodsListItem").getScroll(el);
// }
// if(this.$mp.page && this.$mp.page.selectComponent(".merchants-list")){
// this.$mp.page.selectComponent(".merchants-list").getScroll(el);
// }
if (this.pageData) {
for (let i = 0; i < this.pageData.length; i++) {
const element = this.pageData[i]
......@@ -285,6 +279,7 @@ export default {
},
setFooterShow(el){
// return
let afterScrollTop = el.scrollTop;
let delta = afterScrollTop - this.beforeScrollTop;
let {showFlag} = this.$mp.page.getTabBar().data;
......@@ -298,7 +293,9 @@ export default {
this.beforeScrollTop = afterScrollTop;
return;
}
this.$mp.page.getTabBar().setData({'showFlag':delta>0?'down':'up'})
this.$mp.page.getTabBar().animation({'showFlag':delta>0?'down':'up'})
console.log(showFlag,'set296' )
// this.$mp.page.getTabBar().setData({'showFlag':delta>0?'down':'up'})
},
scrolltolower(){
console.log("scrolltolower")
......
......@@ -7,13 +7,13 @@
<div style="width:100%;height:90vh;display:flex;justify-content: center;align-items: center;">
<van-loading size="40px" type="spinner"></van-loading>
</div>
</div>
</template>
<script>
import {
getUrlofLink,
getUrlofQuery,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
......@@ -22,14 +22,14 @@ export default {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
params: "?mixid=" + this.$store.state.mixid ,
index: 1,
ss: "",
};
},
computed: {
pageUrl() {
return this.link + this.page + this.params + `&native_test=1&tabbar=1&location_obj=${wx.getStorageSync("location")}` + this.ss;
return this.link + this.page + this.params+ `&native_test=1&tabbar=2&location_obj=${wx.getStorageSync("location")}` + this.ss;
},
},
onLoad(options) {
......@@ -38,11 +38,12 @@ export default {
// tabbar 跳转
let homeIndex = checkTabbarPage("/");
homeIndex != 0 && homeIndex == this.index && (this.index = 0);
homeIndex != 0 && homeIndex==this.index && (this.index = 0);
if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
this.page = getUrlofLink(
this.mpApp.globalData.footerVal.componentData.list[this.index].link
);
this.params+='&'+getUrlofQuery( this.mpApp.globalData.footerVal.componentData.list[this.index].link)
this.mpApp.globalData.tabBarPageLink = "";
}
},
......@@ -51,14 +52,13 @@ export default {
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
// !this.params.includes('logOut=true') && (this.params+="&logOut=true")
// this.params+="&logOut=true"
}else{
this.params+=`&timestamp=${new Date().getTime()}`
}
setTabBarActive.bind(this)(this.index);
console.log('----',this.pageUrl)
},
methods: {
handleError(data) {
......
......@@ -13,6 +13,7 @@
<script>
import {
getUrlofLink,
getUrlofQuery,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
......@@ -42,6 +43,7 @@ export default {
this.page = getUrlofLink(
this.mpApp.globalData.footerVal.componentData.list[this.index].link
);
this.params+='&'+getUrlofQuery( this.mpApp.globalData.footerVal.componentData.list[this.index].link)
this.mpApp.globalData.tabBarPageLink = "";
}
},
......@@ -56,8 +58,6 @@ export default {
}
setTabBarActive.bind(this)(this.index);
console.log('----',this.pageUrl)
},
methods: {
handleError(data) {
......
......@@ -13,6 +13,7 @@
<script>
import {
getUrlofLink,
getUrlofQuery,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
......@@ -21,14 +22,14 @@ export default {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
params: "?mixid=" + this.$store.state.mixid ,
index: 3,
ss: "",
};
},
computed: {
pageUrl() {
return this.link + this.page + this.params + `&native_test=1&tabbar=3&location_obj=${wx.getStorageSync("location")}` + this.ss;
return this.link + this.page + this.params+ `&native_test=1&tabbar=2&location_obj=${wx.getStorageSync("location")}` + this.ss;
},
},
onLoad(options) {
......@@ -39,15 +40,10 @@ export default {
let homeIndex = checkTabbarPage("/");
homeIndex != 0 && homeIndex==this.index && (this.index = 0);
if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
let p= getUrlofLink(this.mpApp.globalData.footerVal.componentData.list[this.index].link);
let pl=p.split('?')
if (pl[1]) {
this.page=pl[0]
this.params+='&'+pl[1]
}else{
this.page = p
}
this.page = getUrlofLink(
this.mpApp.globalData.footerVal.componentData.list[this.index].link
);
this.params+='&'+getUrlofQuery( this.mpApp.globalData.footerVal.componentData.list[this.index].link)
this.mpApp.globalData.tabBarPageLink = "";
}
},
......@@ -62,7 +58,6 @@ export default {
}
setTabBarActive.bind(this)(this.index);
console.log('----',this.pageUrl)
},
methods: {
......
......@@ -13,6 +13,7 @@
<script>
import {
getUrlofLink,
getUrlofQuery,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
......@@ -21,14 +22,14 @@ export default {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
params: "?mixid=" + this.$store.state.mixid ,
index: 4,
ss: "",
};
},
computed: {
pageUrl() {
return this.link + this.page + this.params + `&native_test=1&tabbar=4&location_obj=${wx.getStorageSync("location")}` + this.ss;
return this.link + this.page + this.params+ `&native_test=1&tabbar=2&location_obj=${wx.getStorageSync("location")}` + this.ss;
},
},
onLoad(options) {
......@@ -39,15 +40,10 @@ export default {
let homeIndex = checkTabbarPage("/");
homeIndex != 0 && homeIndex==this.index && (this.index = 0);
if (this.mpApp.globalData.footerVal.componentData.list[this.index].link) {
let p= getUrlofLink(this.mpApp.globalData.footerVal.componentData.list[this.index].link);
let pl=p.split('?')
if (pl[1]) {
this.page=pl[0]
this.params+='&'+pl[1]
}else{
this.page = p
}
this.page = getUrlofLink(
this.mpApp.globalData.footerVal.componentData.list[this.index].link
);
this.params+='&'+getUrlofQuery( this.mpApp.globalData.footerVal.componentData.list[this.index].link)
this.mpApp.globalData.tabBarPageLink = "";
}
},
......@@ -62,7 +58,6 @@ export default {
}
setTabBarActive.bind(this)(this.index);
console.log('----',this.pageUrl)
},
methods: {
......
import cart from "@/api/cart"
import classificationApi from "@/api/classification";
// 登录白名单 name
export const noLoginList = ["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'];
export const noLoginList = ["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'];
// path
export const noLoginListPath = noLoginList.map(item=>{
item=item.replace(/-/g,'/')
item='/'+item
item=="/index" && (item="/")
export const noLoginListPath = noLoginList.map(item => {
item = item.replace(/-/g, '/')
item = '/' + item
item == "/index" && (item = "/")
return item
})
// 主题色
export let themeColor = {
"--main-color": "#ffffff",
"--minor-color": "#ffffff"
}
// 获取link 中页面地址(link兼容 有object或者string)
export function getUrlofLink(data) {
return data.link.split('?')[0]
......@@ -25,36 +22,31 @@ export function getUrlofLink(data) {
export function getUrlofQuery(data) {
return data.link.split('?')[1] || ''
}
// 全局跳转 data:link数据 option:是否为底部栏触发
export function $themeToLink(data, option) {
let app = getApp();
let type = data.type;
// 点击底部栏--
if (type!=2) {
console.log('299999',data,noLoginListPath)
// 登录拦截和底部导航栏拦截(非功能项)
if (type != 2) {
// 登录拦截
let parseLink = getUrlofLink(data);
let aa=noLoginListPath.includes(parseLink) || parseLink.substr(0,7)=="/goods/"
console.log(parseLink,aa,'parseLinkparseLinkparseLink',parseLink,noLoginListPath)
let aa = noLoginListPath.includes(parseLink) || parseLink.substr(0, 7) == "/goods/" || parseLink.includes('/brandTopics');
console.log(noLoginListPath.includes(parseLink),'3535')
if (!aa && !wx.getStorageSync("sessionid")) {
let url = `/pages/login/main?back=${parseLink}`;
wx.navigateTo({url});
wx.navigateTo({ url });
return
}
//判断是否市跳转到tabbar页面 替换首页位置
let isTabbarIndex = checkTabbarPage(parseLink);
console.log('44',isTabbarIndex)
if (isTabbarIndex>=0) {
if (isTabbarIndex >= 0) {
isTabbarIndex = isTabbarIndex == 0 ? checkTabbarPage('/') : isTabbarIndex
wx.switchTab({
url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`,
})
return
}
// console.log(option, data,'---',parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`)
// return
}
......@@ -113,33 +105,32 @@ export function $themeToLink(data, option) {
}
}
export function $themeAddToCard(item, callback) {
let app = getApp();
let errorMsg = "";
if (item.productNature == 5) {
errorMsg="电子卡券不可加入购物车";
errorMsg = "电子卡券不可加入购物车";
}
if (item.productNature == 3) {
errorMsg="会员卡不可加入购物车";
errorMsg = "会员卡不可加入购物车";
}
if (item.productNature == 2) {
errorMsg="虚拟商品不可加入购物车";
errorMsg = "虚拟商品不可加入购物车";
}
if (errorMsg) {
wx.showToast({
title:errorMsg,
title: errorMsg,
icon: 'none',
});
}
cart
.addCart([
{ productGoodsId: item.minProductGoodsId, qty: item.saleQty }
])
.then(res => {
if (res.data.code == 200) {
wx.showToast({ title: "加入购物车成功", icon: "none" });
}
callback();
});
.addCart([
{ productGoodsId: item.minProductGoodsId, qty: item.saleQty }
])
.then(res => {
if (res.data.code == 200) {
wx.showToast({ title: "加入购物车成功", icon: "none" });
}
callback();
});
}
function toPage(backPath, backParams = "") {
......@@ -148,21 +139,20 @@ function toPage(backPath, backParams = "") {
});
}
// check 链接是否为底部导航栏页面 返回索引
export function checkTabbarPage(link) {
let app = getApp()
if (!app.globalData.footerVal) return -1
let footerVal = app.globalData.footerVal.componentData.list;
let isFooter = footerVal.findIndex(item => {
return item.link.link == link
return getUrlofLink(item.link) == link.split('?')[0]
})
return isFooter
}
// 当前底部栏选中项
export function setTabBarActive(data) {
console.log(this, 'this', data)
console.log(data,'sssssssssss',this.$mp.page.getTabBar(),data)
if (data < 0 || !this.$mp.page) return
if (typeof this.$mp.page.getTabBar === 'function' &&
this.$mp.page.getTabBar()) {
......@@ -176,7 +166,7 @@ export function setTabBarActive(data) {
// 遍历所有组件有显示条件的id 是否包含地区导航组件
export function checkShowConditionIds(list) {
let allCondition = [];
let isAreaNavigation=false;
let isAreaNavigation = false;
list.forEach(element => {
pollCondition(element)
});
......@@ -202,26 +192,25 @@ export function checkShowConditionIds(list) {
}
// 有地区导航组件
if (object.componentCode == 'area-navigation') {
isAreaNavigation=true
isAreaNavigation = true
}
}
}
return {
allCondition:[...new Set(allCondition)],
allCondition: [...new Set(allCondition)],
isAreaNavigation
}
}
export function $themeArticleLike(item, callback){
let query = { articleId: item.id };
classificationApi.addLike(query).then(res => {
if (res.data.code == "200") {
if (res.data.data == 'true') {
callback("true");
export function $themeArticleLike(item, callback) {
let query = { articleId: item.id };
classificationApi.addLike(query).then(res => {
if (res.data.code == "200") {
if (res.data.data == 'true') {
callback("true");
} else {
callback("false");
}
} else {
callback("false");
}
} else {
Toast(res.data.msg);
}
});
});
}
\ No newline at end of file
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