Commit f0065bf6 by 程智春

1

parent 69dafaae
......@@ -41,9 +41,26 @@ export default {
// 初始
this.getShopInfo(extConfig);
console.log(this, "this.mpApp");
// 页面配置信息
this.getThemePage(extConfig);
setTimeout(() => {
let mpApp = getApp();
console.log(mpApp, "this.mpApp");
mpApp.getShopInfo = this.getShopInfo
mpApp.getThemePage = this.getThemePage
},300)
},
methods: {
async setVisible(pageList, cb) {
......
......@@ -11,7 +11,7 @@
"pages/tabBar1/main",
"pages/tabBar2/main",
"pages/tabBar3/main",
"pages/tabBar4/main"
"pages/changeAdr/main"
],
"tabBar": {
"custom": true,
......@@ -31,9 +31,6 @@
},
{
"pagePath": "pages/tabBar3/main"
},
{
"pagePath": "pages/tabBar4/main"
}
]
},
......
<template>
<div class="con">
<div class="tabbar" :style="{'height' : tabbarHeight + 'px','padding-top':systemInfo.statusBarHeight + 'px'}" @click="back">
<div class="tab-back">
<van-icon name="arrow-left" />
</div>
</div>
<div class="container1">
<div class="title">当前定位城市</div>
<div class="position">
......@@ -44,10 +49,25 @@
cityList: [],
positionCity: {},
locationStatus: false,
reLocationStatus: true
reLocationStatus: true,
systemInfo : null,
tabbarHeight : 0,
noLocation : ''
}
},
onLoad(options){
this.noLocation = options.noLocation
this.systemInfo = wx.getSystemInfoSync()
let menuButtonInfo = wx.getMenuButtonBoundingClientRect()
console.log(menuButtonInfo,'menuButtonInfo')
this.tabbarHeight = (menuButtonInfo.top - this.systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + this.systemInfo.statusBarHeight
console.log(options)
this.locationStart();
changeAdr.query_operating_area_area_list(options.areaGroupId).then(res => {
......@@ -64,9 +84,28 @@
},
methods:{
back(){
if(this.noLocation == '1'){
wx.showModal({
title: '提示',
content: '请选择定位地址',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
return
}
wx.navigateBack()
},
changeCity(item,type){
this.locationStatus = true
if(type == 1){
wx.setStorageSync('location',JSON.stringify({
id : item.operatingAreaAreaId,
......@@ -90,9 +129,9 @@
this.define()
},
define(){
// wx.navigateBack()
// wx.setStorageSync('changeAdr','changeAdr')
wx.reLaunch({
url:'/pages/home/main'
url : '/pages/home/main?changeLocation=1'
})
},
locationStart(type){
......@@ -250,6 +289,19 @@
</script>
<style lang="scss" scoped>
.tabbar{
width: 100%;
background-color: white;
box-sizing: border-box;
}
.tab-back{
width: 50px;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
}
.con {
min-height: 100vh;
background-color: #f3f3f3;
......
{
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "切换地址",
"navigationBarTextStyle": "black",
"usingComponents": {
"van-loading": "/static/vant/loading/index"
}
"van-loading": "/static/vant/loading/index",
"van-icon": "/static/vant/icon/index"
},
"navigationStyle":"custom"
}
\ No newline at end of file
......@@ -13,7 +13,7 @@
<goods-list class="goodsListItem" :datas="item"></goods-list>
</div>
<div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1">
<area-navigation :datas="item"></area-navigation>
<area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation>
</div>
<div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1">
<cube-nav :datas="item"></cube-nav>
......@@ -108,7 +108,8 @@ export default {
themeColor:{
'--main-color':"",
'--minor-color':"",
}
},
changeLocation : ''
};
},
components:{
......@@ -162,10 +163,24 @@ export default {
},
onLoad(options) {
let location=JSON.parse(wx.getStorageSync('location') || '{}')
if (!location.areaGroupId) {
wx.redirectTo({
url: '/pages/changeAdr/main?areaGroupId=' + this.data.designateAreaObj.areaGroupId
})
// if (!location.areaGroupId) {
// wx.redirectTo({
// url: '/pages/changeAdr/main?areaGroupId=' + this.data.designateAreaObj.areaGroupId
// })
// }
this.changeLocation = options.changeLocation || ''
if(this.changeLocation == 1){
let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
console.log(extConfig, "-----------extConfig");
if (
process.env.NODE_ENV == "development" ||
JSON.stringify(extConfig) == "{}"
) {
extConfig = { mixid: "antgood", shopid: 67 };
}
app.getShopInfo(extConfig);
app.getThemePage(extConfig);
}
let that = this;
// 来源
......@@ -181,8 +196,12 @@ export default {
// 获取页面数据
if (this.mpApp.globalData.pageList) {
that.init(this.mpApp.globalData.pageList);
} else {
this.mpApp.pageCallBack = function (params) {
that.init(params);
};
}
......@@ -193,12 +212,41 @@ export default {
this.themeColor = res
}
}
},
onShow() {
setTabBarActive.bind(this)(checkTabbarPage('/'));
this.$mp.page.onPageScroll= (el)=>{
this.scrolls(el);
};
let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
console.log(extConfig, "-----------extConfig");
if (
process.env.NODE_ENV == "development" ||
JSON.stringify(extConfig) == "{}"
) {
extConfig = { mixid: "antgood", shopid: 67 };
}
// console.log(wx.getStorageSync('changeAdr'),'changeAdr')
// if(wx.getStorageSync('changeAdr') == 'changeAdr'){
// Object.assign(this.$data, this.$options.data());
// app.getShopInfo(extConfig);
// // 页面配置信息
// app.getThemePage(extConfig);
// wx.removeStorageSync('changeAdr')
// }
},
methods: {
init(pageList) {
......
......@@ -8,6 +8,9 @@ Component({
properties: {
datas : {
type : Object
},
changeLocation:{
type : String
}
},
......@@ -24,12 +27,23 @@ Component({
},
ready(){
console.log('++++++++++++++++++++定位组件加载好了++++++++++++++++++++')
console.log(this.data.changeLocation,'changeLocation')
console.log(getCurrentPages())
this.setData({
designateAreaObj: this.data.datas.componentData.designateAreaObj
})
if (!wx.getStorageSync('location')) {
wx.navigateTo({
url: `/pages/changeAdr/main?areaGroupId=${this.data.datas.componentData.designateAreaObj.areaGroupId}&noLocation=1`
})
return
}
if (this.data.datas.componentInfo.visible == 1) {
let _this = this;
......@@ -50,6 +64,11 @@ Component({
console.log('组件1', this.data.designateAreaObj)
if(this.data.changeLocation == 1){
return
}
wx.getLocation({
type: 'wgs84',
success(res) {
......@@ -280,7 +299,11 @@ Component({
changeShow : false
})
wx.setStorageSync('location', change )
// wx.startPullDownRefresh()
wx.reLaunch({
url: '/pages/home/main?changeLocation=1'
})
},
continueBrowser(){
console.log(this.data.designateAreaObj)
......@@ -290,6 +313,9 @@ Component({
changeShow: false
})
// wx.startPullDownRefresh()
wx.reLaunch({
url: '/pages/home/main?changeLocation=1'
})
},
changeOtherCity(){
......
......@@ -4,7 +4,7 @@
<view style="width:100%;display:flex;">
<view class="area-l" style="font-size:{{datas.componentData.fontSize / 16 + 'em'}};color:{{datas.componentData.fontColor}};font-weight:{{datas.componentData.fontWeight}}" bindtap="changeOtherCity">
<view class="antt ant-gongsidizhi"></view>
<title class="title">{{positionName}}</title>
<text class="title">{{positionName}}</text>
<van-icon name="arrow-down" style="margin-left:4rpx" />
</view>
<view class="area-r">
......@@ -20,7 +20,7 @@
<view style="width:100%;display:flex;">
<view class="area-l" style="font-size:{{datas.componentData.fontSize / 16 + 'em'}};color:{{datas.componentData.fontColor}};font-weight:{{datas.componentData.fontWeight}}" bindtap="changeOtherCity">
<view class="antt ant-gongsidizhi"></view>
<title class="title">{{positionName}}</title>
<text class="title">{{positionName}}</text>
<van-icon name="arrow-down" style="margin-left:4rpx" />
</view>
<view class="area-r">
......
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