Commit 51831e0e by 程默

ff

parent 3e896e8e
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",
selectedColor: "#3cc51f",
list: [
{
pagePath: "/pages/home/main",
iconPath:
"https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
selectedIconPath:
"https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
text: "组件",
//--多主题
condition: "",
icon: "ant-daishouhuo",
iconType: 1, //0 iconfont 1 image
imgUrl:
"https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
selectImgUrl:
"https://cdn.mayi888.com/public/png/2d084453-2ca3-4d01-95f9-8bed8fc46dc6.png",
link: {
key: "1.1.1.7",
link: "/personalCenter/spokesmanCenter?distributionModel=1",
name: "分销商中心",
type: 1
},
show: true,
title: "分类页",
version: "1.0.0",
visible: 1
},
{
pagePath: "/pages/index/main",
iconPath: "/static/images/bofang.png",
selectedIconPath: "/static/images/bofang.png",
text: "接口",
//--多主题
condition: "",
icon: "ant-daishouhuo",
iconType: 0, //0 iconfont 1 image
imgUrl: "",
selectImgUrl: "",
link: {},
show: true,
title: "分类页",
version: "1.0.0",
visible: 1
}
],
mm: false,
componentData: {},
show: true,
mmm: false,
mainColor: "",
showFlag: "up",
cartNum: 0
},
ready() {
if (app.themeColor["--main-color"] != "#ffffff") {
this.setData({
mainColor: app.themeColor["--main-color"]
});
} else {
app.themeColorCallBack = res => {
this.setData({
mainColor: res["--main-color"]
});
};
}
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;
if (app.globalData.footerVal) {
let mm =
Math.ceil(app.globalData.footerVal.componentData.list.length / 2 - 1) ==
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");
that.setData({
componentData: params.componentData,
list: params.componentData.list
// mm:(Math.ceil(params.componentData.list.length/2-1)==that.data.selected&&params.componentData['styleSelectionNum']==1)
});
let mm =
Math.ceil(params.componentData.list.length / 2 - 1) ==
that.data.selected &&
params.componentData["styleSelectionNum"] == 1;
console.log("87777777", mm);
};
}
// ----------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 &&
this.data.componentData["styleSelectionNum"] == 1
});
},
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({
url: "/pages/home/main"
});
}
}
}
});
......@@ -322,9 +322,13 @@ export default {
// wx.navigateBack()
// return
if(isTabbarIndex>-1){
wx.switchTab({
url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`,
})
if (parseLink == '/') {
wx.navigateTo({url:'/pages/home/main'})
}else{
wx.navigateTo({
url: `../index/main?from=home&backpath=${encodeURIComponent(this.backPath)}&params=${encodeURIComponent(this.backParams)}`
});
}
}else{
wx.redirectTo({
url: `../index/main?from=login&backpath=${
......
<!--
tabbar
-->
<template>
<div>
<web-view :src="pageUrl" @error="handleError"></web-view>
<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,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
export default {
data() {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
index: 1,
ss: "",
};
},
computed: {
pageUrl() {
return this.link + this.page + this.params + `&tabbar=1&location_obj=${wx.getStorageSync("location")}` + this.ss;
},
},
onLoad(options) {
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
// tabbar 跳转
let homeIndex = checkTabbarPage("/");
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.mpApp.globalData.tabBarPageLink = "";
}
},
onShow() {
let ss = wx.getStorageSync("sessionid");
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
!this.params.includes('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) {
wx.showLoading({
title: "网页加载失败 请右上角刷新",
});
},
},
};
</script>
<style lang="scss" scoped></style>
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
{
"usingComponents": {
"van-loading": "/static/vant/loading/index"
}
}
\ No newline at end of file
<!--
tabbar
-->
<template>
<div>
<web-view :src="pageUrl" @error="handleError"></web-view>
<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,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
export default {
data() {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid ,
index: 2,
ss: "",
};
},
computed: {
pageUrl() {
return this.link + this.page + this.params+ `&tabbar=2&location_obj=${wx.getStorageSync("location")}` + this.ss;
},
},
onLoad(options) {
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
// tabbar 跳转
let homeIndex = checkTabbarPage("/");
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.mpApp.globalData.tabBarPageLink = "";
}
},
onShow() {
let ss = wx.getStorageSync("sessionid");
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
this.params+="&logOut=true"
}else{
this.params+=`&timestamp=${new Date().getTime()}`
}
setTabBarActive.bind(this)(this.index);
console.log('----',this.pageUrl)
},
methods: {
handleError(data) {
wx.showLoading({
title: "网页加载失败 请右上角刷新",
});
},
},
};
</script>
<style lang="scss" scoped></style>
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
{
"usingComponents": {
"van-loading": "/static/vant/loading/index"
}
}
\ No newline at end of file
<!--
tabbar
-->
<template>
<div>
<web-view :src="pageUrl" @error="handleError"></web-view>
<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,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
export default {
data() {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
index: 3,
ss: "",
};
},
computed: {
pageUrl() {
return this.link + this.page + this.params + `&tabbar=3&location_obj=${wx.getStorageSync("location")}` + this.ss;
},
},
onLoad(options) {
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
// tabbar 跳转
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.mpApp.globalData.tabBarPageLink = "";
}
},
onShow() {
let ss = wx.getStorageSync("sessionid");
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
this.params+="&logOut=true"
}else{
this.params+=`&timestamp=${new Date().getTime()}`
}
setTabBarActive.bind(this)(this.index);
console.log('----',this.pageUrl)
},
methods: {
handleError(data) {
wx.showLoading({
title: "网页加载失败 请右上角刷新",
});
},
},
};
</script>
<style lang="scss" scoped></style>
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
{
"usingComponents": {
"van-loading": "/static/vant/loading/index"
}
}
\ No newline at end of file
<!--
tabbar
-->
<template>
<div>
<web-view :src="pageUrl" @error="handleError"></web-view>
<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,
setTabBarActive,
checkTabbarPage,
} from "../../utils/mayi.js";
export default {
data() {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
index: 4,
ss: "",
};
},
computed: {
pageUrl() {
return this.link + this.page + this.params + `&tabbar=4&location_obj=${wx.getStorageSync("location")}` + this.ss;
},
},
onLoad(options) {
let ss = wx.getStorageSync("sessionid");
this.ss = ss ? `&sessionid=${ss}` : "";
// tabbar 跳转
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.mpApp.globalData.tabBarPageLink = "";
}
},
onShow() {
let ss = wx.getStorageSync("sessionid");
if (!this.ss && ss) {
this.ss = `&sessionid=${ss}`;
}else if(!ss){
this.params+="&logOut=true"
}else{
this.params+=`&timestamp=${new Date().getTime()}`
}
setTabBarActive.bind(this)(this.index);
console.log('----',this.pageUrl)
},
methods: {
handleError(data) {
wx.showLoading({
title: "网页加载失败 请右上角刷新",
});
},
},
};
</script>
<style lang="scss" scoped></style>
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
{
"usingComponents": {
"van-loading": "/static/vant/loading/index"
}
}
\ No newline at end of file
......@@ -42,12 +42,13 @@ export function $themeToLink(data, option) {
//判断是否市跳转到tabbar页面 替换首页位置
let isTabbarIndex = checkTabbarPage(parseLink);
console.log('44',isTabbarIndex)
// console.log('44',isTabbarIndex)
if (isTabbarIndex>=0) {
isTabbarIndex = isTabbarIndex == 0 ? checkTabbarPage('/') : isTabbarIndex
wx.switchTab({
url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`,
})
// isTabbarIndex = isTabbarIndex == 0 ? checkTabbarPage('/') : isTabbarIndex
// wx.switchTab({
// url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`,
// })
toPage(data.link);
return
}
// console.log(option, data,'---',parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`)
......
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