首页标题优化-0715
parent
272cad2f57
commit
b7162acc09
|
@ -189,10 +189,12 @@
|
|||
// 查询二级分类
|
||||
getSecondList(index){
|
||||
this.secondList=[];
|
||||
if(this.cateList[index].has_children){
|
||||
this.secondList = this.cateList[index].children;
|
||||
}else{
|
||||
this.isTips = true;
|
||||
if(this.cateList.length>0){
|
||||
if(this.cateList[index].has_children){
|
||||
this.secondList = this.cateList[index].children;
|
||||
}else{
|
||||
this.isTips = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 跳转详情页
|
||||
|
|
|
@ -51,13 +51,13 @@
|
|||
|
||||
<script>
|
||||
import statusNav from '@/components/status-navs/status-nav';
|
||||
import swiperPu from '@/components/swipers/swiper-pu';
|
||||
import swiperPu from '@/components/swipers/swiper-pu';
|
||||
import enterCart from '@/components/enter-cart/enter-cart.vue';
|
||||
import footTab from '@/components/foot-tab/foot-tab.vue';
|
||||
import productList from '@/components/product-list/product-list.vue';
|
||||
import navTab from '@/components/nav-tab/nav-tab.vue';
|
||||
import pullList from '@/components/pull-list/pull-list.vue';
|
||||
import {getCartNum,userInfoEv} from '@/jsFile/public-api.js';
|
||||
import {getCartNum} from '@/jsFile/public-api.js';
|
||||
import {mapState} from 'vuex'//引入mapState
|
||||
export default {
|
||||
components:{
|
||||
|
@ -88,7 +88,7 @@
|
|||
total:0, //数量
|
||||
totalAll:-1,//总数
|
||||
ifLoading:true,
|
||||
indexTitle:'首页',//标题
|
||||
indexTitle:'',//标题
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
|
@ -102,17 +102,14 @@
|
|||
if(res.code == 0){
|
||||
this.getHomeData();
|
||||
this.getArticleNav();
|
||||
userInfoEv();
|
||||
this.getCompanyList(op.business_id);
|
||||
this.userInfoEv();
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.getHomeData();
|
||||
this.getArticleNav();
|
||||
userInfoEv();
|
||||
this.getCompanyList(uni.getStorageSync('business_id'));
|
||||
this.userInfoEv();
|
||||
}
|
||||
this.getCompanyList(uni.getStorageSync('business_id'));
|
||||
},
|
||||
onShow() {
|
||||
this.playTimer = setTimeout(()=>{
|
||||
|
@ -147,6 +144,16 @@
|
|||
this.isplay =false;
|
||||
},
|
||||
methods: {
|
||||
// 查询用户信息
|
||||
userInfoEv(){
|
||||
this.$requst.get('/api/user/info').then(res=>{
|
||||
if(res.code==0){
|
||||
uni.setStorageSync('business_id',res.data.business_id);
|
||||
uni.setStorageSync('business_code',res.data.business_code);
|
||||
this.getCompanyList(res.data.business_id);
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查询工厂列表
|
||||
getCompanyList(business_id){
|
||||
this.$requst.post('/api/business/info',{business_id:business_id}).then(res=>{
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -347,10 +347,12 @@ var _default = {
|
|||
// 查询二级分类
|
||||
getSecondList: function getSecondList(index) {
|
||||
this.secondList = [];
|
||||
if (this.cateList[index].has_children) {
|
||||
this.secondList = this.cateList[index].children;
|
||||
} else {
|
||||
this.isTips = true;
|
||||
if (this.cateList.length > 0) {
|
||||
if (this.cateList[index].has_children) {
|
||||
this.secondList = this.cateList[index].children;
|
||||
} else {
|
||||
this.isTips = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 跳转详情页
|
||||
|
|
|
@ -255,7 +255,7 @@ var _default = {
|
|||
total: 0, //数量
|
||||
totalAll: -1, //总数
|
||||
ifLoading: true,
|
||||
indexTitle: '首页' //标题
|
||||
indexTitle: '' //标题
|
||||
};
|
||||
},
|
||||
computed: _objectSpread({},
|
||||
|
@ -269,17 +269,14 @@ var _default = {
|
|||
if (res.code == 0) {
|
||||
_this.getHomeData();
|
||||
_this.getArticleNav();
|
||||
(0, _publicApi.userInfoEv)();
|
||||
_this.getCompanyList(op.business_id);
|
||||
_this.userInfoEv();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.getHomeData();
|
||||
this.getArticleNav();
|
||||
(0, _publicApi.userInfoEv)();
|
||||
this.getCompanyList(uni.getStorageSync('business_id'));
|
||||
this.userInfoEv();
|
||||
}
|
||||
this.getCompanyList(uni.getStorageSync('business_id'));
|
||||
},
|
||||
onShow: function onShow() {var _this2 = this;
|
||||
this.playTimer = setTimeout(function () {
|
||||
|
@ -314,16 +311,26 @@ var _default = {
|
|||
this.isplay = false;
|
||||
},
|
||||
methods: {
|
||||
// 查询用户信息
|
||||
userInfoEv: function userInfoEv() {var _this3 = this;
|
||||
this.$requst.get('/api/user/info').then(function (res) {
|
||||
if (res.code == 0) {
|
||||
uni.setStorageSync('business_id', res.data.business_id);
|
||||
uni.setStorageSync('business_code', res.data.business_code);
|
||||
_this3.getCompanyList(res.data.business_id);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 查询工厂列表
|
||||
getCompanyList: function getCompanyList(business_id) {var _this3 = this;
|
||||
getCompanyList: function getCompanyList(business_id) {var _this4 = this;
|
||||
this.$requst.post('/api/business/info', { business_id: business_id }).then(function (res) {
|
||||
if (res.code == 0) {
|
||||
_this3.indexTitle = res.data.alias;
|
||||
_this4.indexTitle = res.data.alias;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取首页数据
|
||||
getHomeData: function getHomeData() {var _this4 = this;
|
||||
getHomeData: function getHomeData() {var _this5 = this;
|
||||
this.$requst.get('/api/index/home').then(function (res) {
|
||||
if (res.code == 0) {
|
||||
var bannerArr = [];
|
||||
|
@ -336,15 +343,15 @@ var _default = {
|
|||
|
||||
bannerArr.push(obj);
|
||||
});
|
||||
_this4.bannerList = bannerArr;
|
||||
_this4.recommendList = res.data['banner-next-2'];
|
||||
_this4.productList = res.data.spu;
|
||||
_this4.ifLoading = false;
|
||||
_this5.bannerList = bannerArr;
|
||||
_this5.recommendList = res.data['banner-next-2'];
|
||||
_this5.productList = res.data.spu;
|
||||
_this5.ifLoading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取文章栏目
|
||||
getArticleNav: function getArticleNav() {var _this5 = this;
|
||||
getArticleNav: function getArticleNav() {var _this6 = this;
|
||||
this.$requst.get('/api/archives/category').then(function (res) {
|
||||
if (res.code == 0) {
|
||||
res.data.forEach(function (item) {
|
||||
|
@ -352,11 +359,11 @@ var _default = {
|
|||
id: item.id,
|
||||
name: item.title };
|
||||
|
||||
_this5.navTabList.push(obj);
|
||||
_this6.navTabList.push(obj);
|
||||
});
|
||||
_this5.articleNavId = _this5.navTabList[0].id;
|
||||
_this6.articleNavId = _this6.navTabList[0].id;
|
||||
// 获取文章列表
|
||||
_this5.getArticleList();
|
||||
_this6.getArticleList();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -372,7 +379,7 @@ var _default = {
|
|||
}
|
||||
},
|
||||
// 获取文章列表
|
||||
getArticleList: function getArticleList() {var _this6 = this;
|
||||
getArticleList: function getArticleList() {var _this7 = this;
|
||||
uni.showLoading({
|
||||
title: '加载中' });
|
||||
|
||||
|
@ -383,20 +390,20 @@ var _default = {
|
|||
|
||||
this.$requst.get('/api/archives/list', params).then(function (res) {
|
||||
if (res.code == 0) {
|
||||
_this6.total = res.data.total;
|
||||
_this7.total = res.data.total;
|
||||
var newArr = [];
|
||||
res.data.list.forEach(function (item) {
|
||||
var obj = {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
time: _this6.dateFormat(item.published_at.replace(/-/g, '/')),
|
||||
time: _this7.dateFormat(item.published_at.replace(/-/g, '/')),
|
||||
src: item.cover };
|
||||
|
||||
newArr.push(obj);
|
||||
});
|
||||
_this6.articleList = newArr;
|
||||
if (_this6.articleList.length == _this6.total) {
|
||||
_this6.totalAll = _this6.total;
|
||||
_this7.articleList = newArr;
|
||||
if (_this7.articleList.length == _this7.total) {
|
||||
_this7.totalAll = _this7.total;
|
||||
}
|
||||
}
|
||||
uni.hideLoading();
|
||||
|
|
Loading…
Reference in New Issue