|
@@ -30,7 +30,8 @@ Page({
|
|
|
onLoad: async function () {
|
|
|
const self = this
|
|
|
const tokenData = await commonApi.getToken();
|
|
|
- if (tokenData.token) {
|
|
|
+
|
|
|
+ if (tokenData.token && !requestApi.HEAD.token) {
|
|
|
wx.setStorageSync('token', tokenData.token)
|
|
|
requestApi.HEAD.token = tokenData.token
|
|
|
}
|
|
@@ -50,6 +51,8 @@ Page({
|
|
|
console.log(res)
|
|
|
const latitude = res.latitude
|
|
|
const longitude = res.longitude
|
|
|
+ wx.setStorageSync('lon', longitude)
|
|
|
+ wx.setStorageSync('lat', latitude)
|
|
|
const rs = await storeApi.getNearStore(latitude, longitude)
|
|
|
console.log(rs.info);
|
|
|
self.setData({
|
|
@@ -65,6 +68,12 @@ Page({
|
|
|
// this.getProductHeight()
|
|
|
},
|
|
|
onShow: async function () {
|
|
|
+ const self = this
|
|
|
+ const tokenData = await commonApi.getToken();
|
|
|
+ if (tokenData.token && !requestApi.HEAD.token) {
|
|
|
+ wx.setStorageSync('token', tokenData.token)
|
|
|
+ requestApi.HEAD.token = tokenData.token
|
|
|
+ }
|
|
|
var tabs = await this.getProductList();
|
|
|
this.setData({
|
|
|
tabs
|
|
@@ -155,6 +164,8 @@ Page({
|
|
|
console.log(res)
|
|
|
const latitude = res.latitude
|
|
|
const longitude = res.longitude
|
|
|
+ wx.setStorageSync('lon', longitude)
|
|
|
+ wx.setStorageSync('lat', latitude)
|
|
|
const speed = res.speed
|
|
|
const accuracy = res.accuracy
|
|
|
const rs = await storeApi.getNearStore(latitude, longitude)
|