Commit f0065bf6 by 程智春

1

parent 69dafaae
...@@ -41,9 +41,26 @@ export default { ...@@ -41,9 +41,26 @@ export default {
// 初始 // 初始
this.getShopInfo(extConfig); this.getShopInfo(extConfig);
console.log(this, "this.mpApp");
// 页面配置信息 // 页面配置信息
this.getThemePage(extConfig); this.getThemePage(extConfig);
setTimeout(() => {
let mpApp = getApp();
console.log(mpApp, "this.mpApp");
mpApp.getShopInfo = this.getShopInfo
mpApp.getThemePage = this.getThemePage
},300)
}, },
methods: { methods: {
async setVisible(pageList, cb) { async setVisible(pageList, cb) {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"pages/tabBar1/main", "pages/tabBar1/main",
"pages/tabBar2/main", "pages/tabBar2/main",
"pages/tabBar3/main", "pages/tabBar3/main",
"pages/tabBar4/main" "pages/changeAdr/main"
], ],
"tabBar": { "tabBar": {
"custom": true, "custom": true,
...@@ -31,9 +31,6 @@ ...@@ -31,9 +31,6 @@
}, },
{ {
"pagePath": "pages/tabBar3/main" "pagePath": "pages/tabBar3/main"
},
{
"pagePath": "pages/tabBar4/main"
} }
] ]
}, },
......
<template> <template>
<div class="con"> <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="container1">
<div class="title">当前定位城市</div> <div class="title">当前定位城市</div>
<div class="position"> <div class="position">
...@@ -44,10 +49,25 @@ ...@@ -44,10 +49,25 @@
cityList: [], cityList: [],
positionCity: {}, positionCity: {},
locationStatus: false, locationStatus: false,
reLocationStatus: true reLocationStatus: true,
systemInfo : null,
tabbarHeight : 0,
noLocation : ''
} }
}, },
onLoad(options){ 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) console.log(options)
this.locationStart(); this.locationStart();
changeAdr.query_operating_area_area_list(options.areaGroupId).then(res => { changeAdr.query_operating_area_area_list(options.areaGroupId).then(res => {
...@@ -64,9 +84,28 @@ ...@@ -64,9 +84,28 @@
}, },
methods:{ 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){ changeCity(item,type){
this.locationStatus = true this.locationStatus = true
if(type == 1){ if(type == 1){
wx.setStorageSync('location',JSON.stringify({ wx.setStorageSync('location',JSON.stringify({
id : item.operatingAreaAreaId, id : item.operatingAreaAreaId,
...@@ -90,9 +129,9 @@ ...@@ -90,9 +129,9 @@
this.define() this.define()
}, },
define(){ define(){
// wx.navigateBack() // wx.setStorageSync('changeAdr','changeAdr')
wx.reLaunch({ wx.reLaunch({
url:'/pages/home/main' url : '/pages/home/main?changeLocation=1'
}) })
}, },
locationStart(type){ locationStart(type){
...@@ -250,6 +289,19 @@ ...@@ -250,6 +289,19 @@
</script> </script>
<style lang="scss" scoped> <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 { .con {
min-height: 100vh; min-height: 100vh;
background-color: #f3f3f3; background-color: #f3f3f3;
......
{ {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "切换地址",
"navigationBarTextStyle": "black",
"usingComponents": { "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 @@ ...@@ -13,7 +13,7 @@
<goods-list class="goodsListItem" :datas="item"></goods-list> <goods-list class="goodsListItem" :datas="item"></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"></area-navigation> <area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation>
</div> </div>
<div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1"> <div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1">
<cube-nav :datas="item"></cube-nav> <cube-nav :datas="item"></cube-nav>
...@@ -108,7 +108,8 @@ export default { ...@@ -108,7 +108,8 @@ export default {
themeColor:{ themeColor:{
'--main-color':"", '--main-color':"",
'--minor-color':"", '--minor-color':"",
} },
changeLocation : ''
}; };
}, },
components:{ components:{
...@@ -162,10 +163,24 @@ export default { ...@@ -162,10 +163,24 @@ export default {
}, },
onLoad(options) { onLoad(options) {
let location=JSON.parse(wx.getStorageSync('location') || '{}') let location=JSON.parse(wx.getStorageSync('location') || '{}')
if (!location.areaGroupId) { // if (!location.areaGroupId) {
wx.redirectTo({ // wx.redirectTo({
url: '/pages/changeAdr/main?areaGroupId=' + this.data.designateAreaObj.areaGroupId // 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; let that = this;
// 来源 // 来源
...@@ -181,8 +196,12 @@ export default { ...@@ -181,8 +196,12 @@ export default {
// 获取页面数据 // 获取页面数据
if (this.mpApp.globalData.pageList) { if (this.mpApp.globalData.pageList) {
that.init(this.mpApp.globalData.pageList); that.init(this.mpApp.globalData.pageList);
} else { } else {
this.mpApp.pageCallBack = function (params) { this.mpApp.pageCallBack = function (params) {
that.init(params); that.init(params);
}; };
} }
...@@ -193,12 +212,41 @@ export default { ...@@ -193,12 +212,41 @@ export default {
this.themeColor = res this.themeColor = res
} }
} }
}, },
onShow() { onShow() {
setTabBarActive.bind(this)(checkTabbarPage('/')); setTabBarActive.bind(this)(checkTabbarPage('/'));
this.$mp.page.onPageScroll= (el)=>{ this.$mp.page.onPageScroll= (el)=>{
this.scrolls(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: { methods: {
init(pageList) { init(pageList) {
......
...@@ -8,6 +8,9 @@ Component({ ...@@ -8,6 +8,9 @@ Component({
properties: { properties: {
datas : { datas : {
type : Object type : Object
},
changeLocation:{
type : String
} }
}, },
...@@ -24,12 +27,23 @@ Component({ ...@@ -24,12 +27,23 @@ Component({
}, },
ready(){ ready(){
console.log('++++++++++++++++++++定位组件加载好了++++++++++++++++++++') console.log('++++++++++++++++++++定位组件加载好了++++++++++++++++++++')
console.log(this.data.changeLocation,'changeLocation')
console.log(getCurrentPages()) console.log(getCurrentPages())
this.setData({ this.setData({
designateAreaObj: this.data.datas.componentData.designateAreaObj 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) { if (this.data.datas.componentInfo.visible == 1) {
let _this = this; let _this = this;
...@@ -50,6 +64,11 @@ Component({ ...@@ -50,6 +64,11 @@ Component({
console.log('组件1', this.data.designateAreaObj) console.log('组件1', this.data.designateAreaObj)
if(this.data.changeLocation == 1){
return
}
wx.getLocation({ wx.getLocation({
type: 'wgs84', type: 'wgs84',
success(res) { success(res) {
...@@ -280,7 +299,11 @@ Component({ ...@@ -280,7 +299,11 @@ Component({
changeShow : false changeShow : false
}) })
wx.setStorageSync('location', change ) wx.setStorageSync('location', change )
// wx.startPullDownRefresh()
wx.reLaunch({
url: '/pages/home/main?changeLocation=1'
})
}, },
continueBrowser(){ continueBrowser(){
console.log(this.data.designateAreaObj) console.log(this.data.designateAreaObj)
...@@ -290,6 +313,9 @@ Component({ ...@@ -290,6 +313,9 @@ Component({
changeShow: false changeShow: false
}) })
// wx.startPullDownRefresh() // wx.startPullDownRefresh()
wx.reLaunch({
url: '/pages/home/main?changeLocation=1'
})
}, },
changeOtherCity(){ changeOtherCity(){
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view style="width:100%;display:flex;"> <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="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> <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" /> <van-icon name="arrow-down" style="margin-left:4rpx" />
</view> </view>
<view class="area-r"> <view class="area-r">
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<view style="width:100%;display:flex;"> <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="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> <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" /> <van-icon name="arrow-down" style="margin-left:4rpx" />
</view> </view>
<view class="area-r"> <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