首页标题优化-0715

master
Lee-1203 2022-07-15 09:04:30 +08:00
parent 272cad2f57
commit b7162acc09
19 changed files with 72 additions and 54 deletions

View File

@ -189,11 +189,13 @@
//
getSecondList(index){
this.secondList=[];
if(this.cateList.length>0){
if(this.cateList[index].has_children){
this.secondList = this.cateList[index].children;
}else{
this.isTips = true;
}
}
},
//
toShop(id) {

View File

@ -57,7 +57,7 @@
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

View File

@ -347,11 +347,13 @@ var _default = {
// 查询二级分类
getSecondList: function getSecondList(index) {
this.secondList = [];
if (this.cateList.length > 0) {
if (this.cateList[index].has_children) {
this.secondList = this.cateList[index].children;
} else {
this.isTips = true;
}
}
},
// 跳转详情页
toShop: function toShop(id) {

View File

@ -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();