Commit 5e7aa474 by 程默

tabbar Page

parent 5ed31fd2
......@@ -46,20 +46,19 @@ Component({
version: "1.0.0",
visible: 1
}],
componentData:{}
componentData: {}
},
attached() {
var appInstance = getApp()
let that=this
if (appInstance.globalData.footerVal) {
let that = this
if (app.globalData.footerVal) {
that.setData({
componentData:appInstance.globalData.footerVal.componentData,
list: appInstance.globalData.footerVal.componentData.list
componentData: app.globalData.footerVal.componentData,
list: app.globalData.footerVal.componentData.list
})
}else{
appInstance.footerCallBack=function (params) {
} else {
app.footerCallBack = function (params) {
that.setData({
componentData:params.componentData,
componentData: params.componentData,
list: params.componentData.list
})
}
......@@ -70,14 +69,31 @@ Component({
},
switchTab(e) {
const data = e.currentTarget.dataset
const url = data.path
// mpApp.$themeToLink //
const {
index
} = e.currentTarget.dataset
console.log('755555555', this.data.list[index].link)
// if (index == this.data.selected) return
app.globalData.tabBarPageLink=this.data.list[index].link.link
console.log(app,'aaaa')
this.toPage(this.data.list[index].link)
// return
// app.$themeToLink(this.data.list[index].link)
// this.setData({
// selected: index
// })
},
toPage(data){
// 跳转
wx.switchTab({
url
})
this.setData({
selected: data.index
url: '/pages/index/main',
})
}
}
})
<!--miniprogram/custom-tab-bar/index.wxml-->
<cover-view class="tab-bar">
<cover-view class="tab-bar-border"></cover-view>
<cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}"
<cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.link}}" data-index="{{index}}"
bindtap="switchTab">
<cover-view wx:if="{{item.iconType==0||!item.iconType}}">
......@@ -9,7 +9,7 @@
</cover-view>
<cover-view wx:elif="{{item.iconType==1}}"
class="img-view"
style="width:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}}">
style="width:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}};height:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}}">
<cover-image src="{{selected === index ? item.selectImgUrl : item.imgUrl}}"></cover-image>
</cover-view>
<!-- 名称 -->
......
{
"description": "项目配置文件。",
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": true,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": true,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"bundle": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false
},
"miniprogramRoot": "dist/wx/",
"compileType": "miniprogram",
"appid": "wx8a509d2f2ac15903",
"projectname": "mayi-mp-shop",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"plugin": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"gamePlugin": {
"current": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": [
{
"id": 0,
"name": "pages/index/main",
"pathName": "pages/index/main",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/login/main",
"pathName": "pages/login/main",
"query": "",
"scene": null
},
{
"id": 2,
"name": "pages/index/main",
"pathName": "pages/index/main",
"query": "scene=pid_6141",
"scene": 1047
}
]
}
}
"description": "项目配置文件。",
"setting": {
"urlCheck": false,
"es6": false,
"enhance": true,
"postcss": true,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": true,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": true,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
},
"miniprogramRoot": "dist/wx/",
"compileType": "miniprogram",
"appid": "wx8a509d2f2ac15903",
"projectname": "mayi-mp-shop",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"libVersion": "2.6.6",
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"plugin": {
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": [
{
"id": 0,
"name": "pages/index/main",
"pathName": "pages/index/main",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/login/main",
"pathName": "pages/login/main",
"query": "",
"scene": null
},
{
"id": 2,
"name": "pages/index/main",
"pathName": "pages/index/main",
"query": "scene=pid_6141",
"scene": 1047
}
]
}
}
}
\ No newline at end of file
......@@ -7,7 +7,11 @@
"pages/counter/main",
"pages/address/main",
"pages/contact/main",
"pages/officialAccount/main"
"pages/officialAccount/main",
"pages/tabBar1/main",
"pages/tabBar2/main",
"pages/tabBar3/main",
"pages/tabBar4/main"
],
"tabBar": {
"custom": true,
......@@ -15,13 +19,23 @@
"selectedColor": "#3cc51f",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/home/main",
"text": "组件"
}, {
"pagePath": "pages/index/main",
"text": "接口"
}]
"list": [
{
"pagePath": "pages/home/main"
},
{
"pagePath": "pages/tabBar1/main"
},
{
"pagePath": "pages/tabBar2/main"
},
{
"pagePath": "pages/tabBar3/main"
},
{
"pagePath": "pages/tabBar4/main"
}
]
},
"usingComponents": {},
"window": {
......@@ -35,4 +49,4 @@
"desc": "你的位置信息将用于获取附近的门店"
}
}
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ Vue.prototype.$store = Store
let mpAnalytics = require("../node_modules/mayi-analytics/dist/mayi.mpAnalytics.js")
.default;
mpAnalytics.init({
url:process.env.NODE_ENV == 'production'?"https://analytics.mayi888.com/ma.gif":"https://analytics.mayi888.cn/ma.gif", //错误上报地址
url: process.env.NODE_ENV == 'production' ? "https://analytics.mayi888.com/ma.gif" : "https://analytics.mayi888.cn/ma.gif", //错误上报地址
app: "mayi-mp-shop",//项目名称
wx
});
......@@ -22,12 +22,111 @@ app.$mount()
// glob挂载到
let mpApp=getApp();
let mpApp = getApp();
Vue.prototype.mpApp = mpApp
// 定义数据回调函数
// 商城
mpApp.shopCallBack=function() {}
mpApp.shopCallBack = function () { }
// 多主题页面
mpApp.pageCallBack=function() {}
mpApp.pageCallBack = function () { }
// 底部栏
mpApp.footerCallBack=function() {}
mpApp.footerCallBack = function () { }
// webview变化
mpApp.webviewCallBack = function () { }
console.log('3555555', wx)
// 全局跳转 data为link对象
mpApp.$themeToLink = function name(data) {
debugger
console.log('393939')
let type = data.type;
if (type == undefined || type == 'undefined') {
if (data.length > 0) {
// this.$nuxt.$router.push(data);
}
return
}
if (type == 0) {//无链接
return
} else if (type == 1) {//h5页面
//兼容
if (data.link.substring(0, 1) == "/") {
// this.$nuxt.$router.push(data.link);
toPage(data.link)
} else {
if (data.link.startsWith('http') || data.link.startsWith('https')) {
// if (this.$store.state.miniProgram == 1 || this.$store.state.miniProgram == 2) {
wx.miniProgram.navigateTo({ url: '/pages/wxArticle/main?link=' + encodeURIComponent(data.link) });
// } else {
// window.location = data.link
// }
} else {
window.location.href = data.link;
}
}
} else if (type == 1.1) {//小程序页面 可能增加登录态拦截
if (this.$store.state.miniProgram == 1 || this.$store.state.miniProgram == 2) {
wx.miniProgram.navigateTo({ url: data.link });
} else {
// Toast("暂不支持");
}
} else if (type == 1.2) { //第三方链接
if (data.link == 'outerChain:businessCenter') {
// 进入商家中心外链
let url = `${config.GUIDE_URL}/login?mixid=${this.$nuxt.$route.query.mixid}&back=${encodeURIComponent(window.location.href)}`;
window.location.href = url;
return
}
if (data.link.substring(0, 1) == "/") {
// this.$nuxt.$router.push(data.link);
toPage(data.link)
} else {
if (this.$store.state.miniProgram == 1 || this.$store.state.miniProgram == 2) {
$mp.miniProgram.navigateTo({ url: '/pages/wxArticle/main?link=' + encodeURIComponent(data.link) });
} else {
window.location.href = data.link
}
}
} else if (type == 2) {//功能
let featureType = data.feature.type;
if (featureType == 'themeCouponClick' || featureType == 0) {//优惠券
this.$themeCouponClick(data.feature.value.couponCode, data.feature.value);
} else if (featureType == 1) {//分享
console.log('是分享了。。。。', cb);
// if (data.type == 2 && data.feature.type == 1) {
// //分享
// this.$nuxt.$SHARE({
// itemList: data.feature.value
// });
// }
} else if (featureType == "themeMemberCardClick" || featureType == 2) { //会员卡
// this.$themeMemberCardClick(data.feature.value);
}
} else if (type == 3) { //小程序跳转到小程序
// if (this.$store.state.miniProgram == 1 || this.$store.state.miniProgram == 2) {
// if (this.$store.getters['sceneModule/flushbonadingVisible']) {
// $mp.miniProgram.navigateTo({
// url: `/pages/toMini/toMini?weappPage=${encodeURIComponent(data.link)}&weappAppId=${data.name}`,
// })
// return
// }
// $mp.miniProgram.navigateTo({
// url: `/pages/toMini/main?weappPage=${encodeURIComponent(data.link)}&weappAppId=${data.name}`,
// })
// } else {
// Toast("暂不支持");
// }
} else {
//向后兼容
if (data.length > 0) {
this.$nuxt.$router.push(data.link);
}
}
}
function toPage(backPath, backParams) {
wx.reLaunch({
url: `../index/main?from=home&backpath=${backPath}&params=${encodeURIComponent(backParams)}`
});
}
......@@ -12,7 +12,7 @@
<van-button type="primary">按钮</van-button>
<view class="ant-bofang">1</view>
----瀑布流开始----
<waterfall-flow id="waterfallFlow"></waterfall-flow>
<!-- <waterfall-flow id="waterfallFlow"></waterfall-flow> -->
----瀑布流结束----
<!-- <banner id="banner" :datas="componentsList[0]"></banner>
<div class="domain">abc
......
{
"usingComponents": {
"banner": "../../../static/nativeComponents/Banner/index",
"waterfall-flow": "../../../static/nativeComponents/module/WaterfallFlow/index",
"waterfall-flow": "/static/nativeComponents/module/WaterfallFlow/index",
"van-button": "/static/vant/button/index"
}
}
\ No newline at end of file
......@@ -56,7 +56,7 @@ export default {
}
},
watch: {
pageUrl() {
pageUrl(n,o) {
//埋点未登录时进入文章
// this.params+='&articleId=111'
console.log(wx.getStorageSync("sessionid"),3333333,this.pageUrl)
......@@ -75,6 +75,7 @@ export default {
}
},
onLoad(options) {
this.options = options;
Object.assign(this.$data, this.$options.data());
console.log(
......@@ -110,7 +111,17 @@ export default {
this.options = options;
console.log('-------1',options.scene)
console.log(this.options)
console.log('-------')
console.log('-------link',this.mpApp.globalData.tabBarPageLink)
// tabbar 跳转
// if (this.mpApp.globalData.tabBarPageLink) {
// this.page = this.mpApp.globalData.tabBarPageLink;
// this.mpApp.globalData.tabBarPageLink=''
// }
// if (options.from && options.from == "tabbar") {
// this.page = decodeURIComponent(options.backpath);
// }
// ---------
if (options.share) {
//来自分享
this.link = decodeURIComponent(options.share);
......@@ -314,9 +325,6 @@ export default {
}
this.init();
},
onShow() {
// console.log('显示了',options.webViewUrl);
},
methods: {
init() {
// 获取小程序开启的订阅消息配置
......@@ -343,7 +351,7 @@ export default {
console.log('244',getOpenid,getSessionid);
if (getOpenid == "" || getSessionid == "") {
this.params += "&logOut=true";
// this.params += "&logOut=true";
}
},
getLocationHandle() {
......
......@@ -95,6 +95,7 @@ export default {
})
},
onLoad(options) {
console.log(options,'login')
Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化
if (options.back) {
this.backPath = options.back;
......
import Vue from 'vue'
import App from './index'
// add this to handle exception
Vue.config.errorHandler = function (err) {
if (console && console.error) {
console.error(err)
}
}
const app = new Vue(App)
app.$mount()
{
}
\ No newline at end of file
<!--
tabbar1
-->
<template>
<div>
<web-view :src="pageUrl" @error="handleError"></web-view>
</div>
</template>
<script>
export default {
data() {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
};
},
computed: {
pageUrl() {
return this.link+this.page+this.params;
}
},
onLoad(options) {
// tabbar 跳转
if (this.mpApp.globalData.tabBarPageLink) {
this.page = this.mpApp.globalData.tabBarPageLink;
this.mpApp.globalData.tabBarPageLink = "";
}
},
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()
{
}
\ No newline at end of file
<!--
tabbar1
-->
<template>
<div>
<web-view :src="pageUrl" @error="handleError"></web-view>
</div>
</template>
<script>
export default {
data() {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
};
},
computed: {
pageUrl() {
return this.link+this.page+this.params;
}
},
onLoad(options) {
// tabbar 跳转
if (this.mpApp.globalData.tabBarPageLink) {
this.page = this.mpApp.globalData.tabBarPageLink;
this.mpApp.globalData.tabBarPageLink = "";
}
},
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()
{
}
\ No newline at end of file
<!--
tabbar1
-->
<template>
<div>
<web-view :src="pageUrl" @error="handleError"></web-view>
</div>
</template>
<script>
export default {
data() {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
};
},
computed: {
pageUrl() {
return this.link+this.page+this.params;
}
},
onLoad(options) {
// tabbar 跳转
if (this.mpApp.globalData.tabBarPageLink) {
this.page = this.mpApp.globalData.tabBarPageLink;
this.mpApp.globalData.tabBarPageLink = "";
}
},
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()
{
}
\ No newline at end of file
<!--
tabbar1
-->
<template>
<div>
<web-view :src="pageUrl" @error="handleError"></web-view>
</div>
</template>
<script>
export default {
data() {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid,
};
},
computed: {
pageUrl() {
return this.link+this.page+this.params;
}
},
onLoad(options) {
// tabbar 跳转
if (this.mpApp.globalData.tabBarPageLink) {
this.page = this.mpApp.globalData.tabBarPageLink;
this.mpApp.globalData.tabBarPageLink = "";
}
},
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()
{
}
\ No newline at end of file
<!--
* @Author: your name
* @Date: 2020-10-21 09:51:48
* @LastEditTime: 2020-10-21 10:35:55
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \mayi-mp-shop\src\pages\wxArticle\index.vue
第三方url
-->
<template>
<div>
......
export default {
}
const handler = {
get: function(obj, prop) {
console.log(obj,prop,'9999999999')
return prop in obj ? obj[prop] : 37;
}
};
const p = new Proxy({}, handler);
p.a = 1;
p.b = undefined;
console.log(p.a, p.b); // 1, undefined
console.log('c' in p, p.c); // false, 37
{
"components":true
"component":true
}
\ 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