首页标题优化-0714
parent
313fb2ac8d
commit
272cad2f57
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="pad-b150" v-if="!ifLoading">
|
<view class="pad-b150" v-if="!ifLoading">
|
||||||
<status-nav :ifReturn="false" navBarTitle="首页" :marginBottom="0"></status-nav>
|
<status-nav :ifReturn="false" :navBarTitle="indexTitle" :marginBottom="0"></status-nav>
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<view class="search-bg">
|
<view class="search-bg">
|
||||||
<view class="search flex">
|
<view class="search flex">
|
||||||
|
@ -88,6 +88,7 @@
|
||||||
total:0, //数量
|
total:0, //数量
|
||||||
totalAll:-1,//总数
|
totalAll:-1,//总数
|
||||||
ifLoading:true,
|
ifLoading:true,
|
||||||
|
indexTitle:'首页',//标题
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
|
@ -102,16 +103,16 @@
|
||||||
this.getHomeData();
|
this.getHomeData();
|
||||||
this.getArticleNav();
|
this.getArticleNav();
|
||||||
userInfoEv();
|
userInfoEv();
|
||||||
}else{
|
this.getCompanyList(op.business_id);
|
||||||
// this.$toolAll.tools.showToast(res.msg);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
this.getHomeData();
|
this.getHomeData();
|
||||||
this.getArticleNav();
|
this.getArticleNav();
|
||||||
userInfoEv();
|
userInfoEv();
|
||||||
|
this.getCompanyList(uni.getStorageSync('business_id'));
|
||||||
}
|
}
|
||||||
|
this.getCompanyList(uni.getStorageSync('business_id'));
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.playTimer = setTimeout(()=>{
|
this.playTimer = setTimeout(()=>{
|
||||||
|
@ -146,6 +147,14 @@
|
||||||
this.isplay =false;
|
this.isplay =false;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 查询工厂列表
|
||||||
|
getCompanyList(business_id){
|
||||||
|
this.$requst.post('/api/business/info',{business_id:business_id}).then(res=>{
|
||||||
|
if(res.code==0) {
|
||||||
|
this.indexTitle = res.data.alias;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 获取首页数据
|
// 获取首页数据
|
||||||
getHomeData(){
|
getHomeData(){
|
||||||
this.$requst.get('/api/index/home').then(res=>{
|
this.$requst.get('/api/index/home').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
|
@ -254,8 +254,9 @@ var _default = {
|
||||||
size: 5, //查询条数
|
size: 5, //查询条数
|
||||||
total: 0, //数量
|
total: 0, //数量
|
||||||
totalAll: -1, //总数
|
totalAll: -1, //总数
|
||||||
ifLoading: true };
|
ifLoading: true,
|
||||||
|
indexTitle: '首页' //标题
|
||||||
|
};
|
||||||
},
|
},
|
||||||
computed: _objectSpread({},
|
computed: _objectSpread({},
|
||||||
(0, _vuex.mapState)({
|
(0, _vuex.mapState)({
|
||||||
|
@ -269,16 +270,16 @@ var _default = {
|
||||||
_this.getHomeData();
|
_this.getHomeData();
|
||||||
_this.getArticleNav();
|
_this.getArticleNav();
|
||||||
(0, _publicApi.userInfoEv)();
|
(0, _publicApi.userInfoEv)();
|
||||||
} else {
|
_this.getCompanyList(op.business_id);
|
||||||
// this.$toolAll.tools.showToast(res.msg);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.getHomeData();
|
this.getHomeData();
|
||||||
this.getArticleNav();
|
this.getArticleNav();
|
||||||
(0, _publicApi.userInfoEv)();
|
(0, _publicApi.userInfoEv)();
|
||||||
|
this.getCompanyList(uni.getStorageSync('business_id'));
|
||||||
}
|
}
|
||||||
|
this.getCompanyList(uni.getStorageSync('business_id'));
|
||||||
},
|
},
|
||||||
onShow: function onShow() {var _this2 = this;
|
onShow: function onShow() {var _this2 = this;
|
||||||
this.playTimer = setTimeout(function () {
|
this.playTimer = setTimeout(function () {
|
||||||
|
@ -313,8 +314,16 @@ var _default = {
|
||||||
this.isplay = false;
|
this.isplay = false;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 查询工厂列表
|
||||||
|
getCompanyList: function getCompanyList(business_id) {var _this3 = this;
|
||||||
|
this.$requst.post('/api/business/info', { business_id: business_id }).then(function (res) {
|
||||||
|
if (res.code == 0) {
|
||||||
|
_this3.indexTitle = res.data.alias;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
// 获取首页数据
|
// 获取首页数据
|
||||||
getHomeData: function getHomeData() {var _this3 = this;
|
getHomeData: function getHomeData() {var _this4 = this;
|
||||||
this.$requst.get('/api/index/home').then(function (res) {
|
this.$requst.get('/api/index/home').then(function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
var bannerArr = [];
|
var bannerArr = [];
|
||||||
|
@ -327,15 +336,15 @@ var _default = {
|
||||||
|
|
||||||
bannerArr.push(obj);
|
bannerArr.push(obj);
|
||||||
});
|
});
|
||||||
_this3.bannerList = bannerArr;
|
_this4.bannerList = bannerArr;
|
||||||
_this3.recommendList = res.data['banner-next-2'];
|
_this4.recommendList = res.data['banner-next-2'];
|
||||||
_this3.productList = res.data.spu;
|
_this4.productList = res.data.spu;
|
||||||
_this3.ifLoading = false;
|
_this4.ifLoading = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 获取文章栏目
|
// 获取文章栏目
|
||||||
getArticleNav: function getArticleNav() {var _this4 = this;
|
getArticleNav: function getArticleNav() {var _this5 = this;
|
||||||
this.$requst.get('/api/archives/category').then(function (res) {
|
this.$requst.get('/api/archives/category').then(function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
res.data.forEach(function (item) {
|
res.data.forEach(function (item) {
|
||||||
|
@ -343,11 +352,11 @@ var _default = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.title };
|
name: item.title };
|
||||||
|
|
||||||
_this4.navTabList.push(obj);
|
_this5.navTabList.push(obj);
|
||||||
});
|
});
|
||||||
_this4.articleNavId = _this4.navTabList[0].id;
|
_this5.articleNavId = _this5.navTabList[0].id;
|
||||||
// 获取文章列表
|
// 获取文章列表
|
||||||
_this4.getArticleList();
|
_this5.getArticleList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -363,7 +372,7 @@ var _default = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取文章列表
|
// 获取文章列表
|
||||||
getArticleList: function getArticleList() {var _this5 = this;
|
getArticleList: function getArticleList() {var _this6 = this;
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中' });
|
title: '加载中' });
|
||||||
|
|
||||||
|
@ -374,20 +383,20 @@ var _default = {
|
||||||
|
|
||||||
this.$requst.get('/api/archives/list', params).then(function (res) {
|
this.$requst.get('/api/archives/list', params).then(function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
_this5.total = res.data.total;
|
_this6.total = res.data.total;
|
||||||
var newArr = [];
|
var newArr = [];
|
||||||
res.data.list.forEach(function (item) {
|
res.data.list.forEach(function (item) {
|
||||||
var obj = {
|
var obj = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
time: _this5.dateFormat(item.published_at.replace(/-/g, '/')),
|
time: _this6.dateFormat(item.published_at.replace(/-/g, '/')),
|
||||||
src: item.cover };
|
src: item.cover };
|
||||||
|
|
||||||
newArr.push(obj);
|
newArr.push(obj);
|
||||||
});
|
});
|
||||||
_this5.articleList = newArr;
|
_this6.articleList = newArr;
|
||||||
if (_this5.articleList.length == _this5.total) {
|
if (_this6.articleList.length == _this6.total) {
|
||||||
_this5.totalAll = _this5.total;
|
_this6.totalAll = _this6.total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<block wx:if="{{!ifLoading}}"><view class="pad-b150 data-v-6b1f4146"><status-nav vue-id="f8c7e56e-1" ifReturn="{{false}}" navBarTitle="首页" marginBottom="{{0}}" class="data-v-6b1f4146" bind:__l="__l"></status-nav><view class="search-bg data-v-6b1f4146"><view class="search flex data-v-6b1f4146"><image class="search-img data-v-6b1f4146" src="/static/public/icon-search.png" mode="widthFix"></image><input class="search-input data-v-6b1f4146" type="text" placeholder="请输入关键词" placeholder-style="color: #666666" data-event-opts="{{[['input',[['__set_model',['','keyword','$event',[]]]]]]}}" value="{{keyword}}" bindinput="__e"/><view class="search-line data-v-6b1f4146"></view><view data-event-opts="{{[['tap',[['toSearch',['$event']]]]]}}" class="search-btn flex data-v-6b1f4146" bindtap="__e">搜索</view></view></view><view class="banner data-v-6b1f4146"><swiper-pu vue-id="f8c7e56e-2" newRadius="0" bannerList="{{bannerList}}" newHeight="372rpx" newBottom="20rpx" isplay="{{isplay}}" class="data-v-6b1f4146" bind:__l="__l"></swiper-pu></view><view class="flag-list flex data-v-6b1f4146"><block wx:for="{{recommendList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['toLink',['$0'],[[['recommendList','',index,'url']]]]]]]}}" class="flag-item data-v-6b1f4146" bindtap="__e"><view class="flag-img data-v-6b1f4146"><image class="search-img data-v-6b1f4146" src="{{item.src}}" mode="widthFix"></image></view><view class="flag-txt clips1 data-v-6b1f4146">{{item.title}}</view></view></block></view><block wx:for="{{productList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="index-product-list data-v-6b1f4146"><view class="product-list-title flex data-v-6b1f4146"><view class="txt data-v-6b1f4146"><text class="data-v-6b1f4146">{{item.title}}</text><view class="line data-v-6b1f4146"></view></view><view data-event-opts="{{[['tap',[['toMore',['$event']]]]]}}" class="more data-v-6b1f4146" bindtap="__e"><image src="/static/public/icon-more.png" mode="widthFix" class="data-v-6b1f4146"></image></view></view><product-list vue-id="{{'f8c7e56e-3-'+index}}" list="{{item.goods}}" newWidth="{{item.goods.length*460-490+'rpx'}}" data-event-opts="{{[['^toDetail',[['toShopDetail']]]]}}" bind:toDetail="__e" class="data-v-6b1f4146" bind:__l="__l"></product-list></view></block><view class="index-news data-v-6b1f4146"><nav-tab vue-id="f8c7e56e-4" list="{{navTabList}}" maxNum="{{1}}" data-event-opts="{{[['^chooseEv',[['chooseEv']]]]}}" bind:chooseEv="__e" class="data-v-6b1f4146" bind:__l="__l"></nav-tab><pull-list vue-id="f8c7e56e-5" list="{{articleList}}" data-event-opts="{{[['^toDetail',[['toArticleDetail']]]]}}" bind:toDetail="__e" class="data-v-6b1f4146" bind:__l="__l"></pull-list></view><block wx:if="{{totalAll==total}}"><view class="more-txt data-v-6b1f4146">暂无更多内容</view></block><enter-cart vue-id="f8c7e56e-6" class="data-v-6b1f4146" bind:__l="__l"></enter-cart><foot-tab vue-id="f8c7e56e-7" class="data-v-6b1f4146" bind:__l="__l"></foot-tab></view></block>
|
<block wx:if="{{!ifLoading}}"><view class="pad-b150 data-v-6b1f4146"><status-nav vue-id="f8c7e56e-1" ifReturn="{{false}}" navBarTitle="{{indexTitle}}" marginBottom="{{0}}" class="data-v-6b1f4146" bind:__l="__l"></status-nav><view class="search-bg data-v-6b1f4146"><view class="search flex data-v-6b1f4146"><image class="search-img data-v-6b1f4146" src="/static/public/icon-search.png" mode="widthFix"></image><input class="search-input data-v-6b1f4146" type="text" placeholder="请输入关键词" placeholder-style="color: #666666" data-event-opts="{{[['input',[['__set_model',['','keyword','$event',[]]]]]]}}" value="{{keyword}}" bindinput="__e"/><view class="search-line data-v-6b1f4146"></view><view data-event-opts="{{[['tap',[['toSearch',['$event']]]]]}}" class="search-btn flex data-v-6b1f4146" bindtap="__e">搜索</view></view></view><view class="banner data-v-6b1f4146"><swiper-pu vue-id="f8c7e56e-2" newRadius="0" bannerList="{{bannerList}}" newHeight="372rpx" newBottom="20rpx" isplay="{{isplay}}" class="data-v-6b1f4146" bind:__l="__l"></swiper-pu></view><view class="flag-list flex data-v-6b1f4146"><block wx:for="{{recommendList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['toLink',['$0'],[[['recommendList','',index,'url']]]]]]]}}" class="flag-item data-v-6b1f4146" bindtap="__e"><view class="flag-img data-v-6b1f4146"><image class="search-img data-v-6b1f4146" src="{{item.src}}" mode="widthFix"></image></view><view class="flag-txt clips1 data-v-6b1f4146">{{item.title}}</view></view></block></view><block wx:for="{{productList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="index-product-list data-v-6b1f4146"><view class="product-list-title flex data-v-6b1f4146"><view class="txt data-v-6b1f4146"><text class="data-v-6b1f4146">{{item.title}}</text><view class="line data-v-6b1f4146"></view></view><view data-event-opts="{{[['tap',[['toMore',['$event']]]]]}}" class="more data-v-6b1f4146" bindtap="__e"><image src="/static/public/icon-more.png" mode="widthFix" class="data-v-6b1f4146"></image></view></view><product-list vue-id="{{'f8c7e56e-3-'+index}}" list="{{item.goods}}" newWidth="{{item.goods.length*460-490+'rpx'}}" data-event-opts="{{[['^toDetail',[['toShopDetail']]]]}}" bind:toDetail="__e" class="data-v-6b1f4146" bind:__l="__l"></product-list></view></block><view class="index-news data-v-6b1f4146"><nav-tab vue-id="f8c7e56e-4" list="{{navTabList}}" maxNum="{{1}}" data-event-opts="{{[['^chooseEv',[['chooseEv']]]]}}" bind:chooseEv="__e" class="data-v-6b1f4146" bind:__l="__l"></nav-tab><pull-list vue-id="f8c7e56e-5" list="{{articleList}}" data-event-opts="{{[['^toDetail',[['toArticleDetail']]]]}}" bind:toDetail="__e" class="data-v-6b1f4146" bind:__l="__l"></pull-list></view><block wx:if="{{totalAll==total}}"><view class="more-txt data-v-6b1f4146">暂无更多内容</view></block><enter-cart vue-id="f8c7e56e-6" class="data-v-6b1f4146" bind:__l="__l"></enter-cart><foot-tab vue-id="f8c7e56e-7" class="data-v-6b1f4146" bind:__l="__l"></foot-tab></view></block>
|
|
@ -35,7 +35,7 @@
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.24.7",
|
"libVersion": "2.24.7",
|
||||||
"appid": "wx2128cb0ee735d71a",
|
"appid": "wxa02e44170bc722cd",
|
||||||
"projectname": "app适配微信小程序",
|
"projectname": "app适配微信小程序",
|
||||||
"condition": {
|
"condition": {
|
||||||
"search": {
|
"search": {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{
|
{
|
||||||
"name": "",
|
"name": "",
|
||||||
"pathName": "pages/tabbar/index/index",
|
"pathName": "pages/tabbar/index/index",
|
||||||
"query": "business_id=7",
|
"query": "business_id=8",
|
||||||
"launchMode": "default",
|
"launchMode": "default",
|
||||||
"scene": null
|
"scene": null
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue