12345678910111213141516171819202122232425262728293031323334 |
- import http from './http.js'
- import config from './config.js'
- export default {
- get_home_list(_this, data = {}, isLoading = false){
- if(uni.getStorageSync('list')){
- _this['list'] = uni.getStorageSync('list')
- _this['title'] = uni.getStorageSync('title')
- }else{
- http.Post(config.homeData, data, isLoading).then((res) => {
- // 数据
- let list = res['data']['data']
- // console.log(list)
- _this['list'] = list
- // 系统设置中的标题
- let titles = res['data']['config']
- _this.title[0] = titles.title
- _this.title[1] = titles.subtitle
- uni.setStorageSync('title',_this.title)
- uni.setStorageSync('list',list)
- }).catch(err=>{})
- }
- },
- check_data_update(_this, data = {}, isLoading = false){
- http.Post(config.checkDataUpdate, data, isLoading).then((res) => {
- _this['timeStr'] = res['data']['timeStr']
- if(uni.getStorageSync('timeStr') != _this['timeStr']){
- // 比对本地缓存与服务器缓存,不同则重新获取数据
- uni.setStorageSync('timeStr',_this['timeStr'])
- _this.clearCache()
- }
- }).catch(err=>{})
- }
- }
|