移动端提前缓存城市数据,避免编辑地址时等待请求
parent
f4e2327095
commit
fc25cdfa02
|
@ -1,12 +1,12 @@
|
|||
|
||||
let domain = 'https://xxx.xxx'
|
||||
let domain = 'xxx.xxx'
|
||||
|
||||
module.exports = {
|
||||
// 请求域名 格式: https://您的域名
|
||||
// #ifdef MP
|
||||
HTTP_REQUEST_URL: domain,
|
||||
// #endif
|
||||
HTTP_ADMIN_URL:'https://xxx.xxx.xxx', //PC后台的API请求地址,上传图片用
|
||||
HTTP_ADMIN_URL:'xxx.xxx.xxx', //PC后台的API请求地址,上传图片用
|
||||
// #ifdef H5
|
||||
//H5接口是浏览器地址
|
||||
// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
|
||||
|
|
|
@ -125,22 +125,12 @@
|
|||
<script>
|
||||
let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
|
||||
import Cache from '@/utils/cache';
|
||||
import {
|
||||
BACK_URL
|
||||
} from '@/config/cache';
|
||||
import {
|
||||
getMenuList
|
||||
// setVisit
|
||||
} from '@/api/user.js';
|
||||
import {
|
||||
orderData
|
||||
} from '@/api/order.js';
|
||||
import {
|
||||
toLogin
|
||||
} from '@/libs/login.js';
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import {BACK_URL} from '@/config/cache';
|
||||
import {getMenuList} from '@/api/user.js';
|
||||
import {orderData} from '@/api/order.js';
|
||||
import {toLogin} from '@/libs/login.js';
|
||||
import {getCity} from '@/api/api.js';
|
||||
import {mapGetters} from "vuex";
|
||||
// #ifdef H5
|
||||
import Auth from '@/libs/wechat';
|
||||
// #endif
|
||||
|
@ -218,6 +208,7 @@
|
|||
that.$set(that, 'pageHeight', app.globalData.windowHeight);
|
||||
// #endif
|
||||
that.$set(that, 'MyMenus', app.globalData.MyMenus);
|
||||
if (!this.$Cache.has('cityList')) this.getCityList();
|
||||
if (that.isLogin == false) {
|
||||
// #ifdef H5
|
||||
toLogin()
|
||||
|
@ -355,6 +346,18 @@
|
|||
this.openAuto()
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
// 获取地址数据
|
||||
getCityList: function() {
|
||||
let that = this;
|
||||
getCity().then(res => {
|
||||
let oneDay = 24 * 3600 * 1000;
|
||||
this.$Cache.setItem({
|
||||
name: 'cityList',
|
||||
value: res.data,
|
||||
expires: oneDay * 7
|
||||
}); //设置七天过期时间
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue