Commit 1c27661d authored by zhanglw's avatar zhanglw

首页接口

parent fad1579b
......@@ -388,8 +388,46 @@ export const HttpReq = {
}).then((res) => {
return res
})
}
},
// web端接口列表
webClientApi: {
// 首页-头部文件
homePageGetHeader: function(params) {
return request({
url: '/api/bsw/bigScreen/index/header?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 首页-搜索推荐
homePageGetSearch: function(params) {
return request({
url: '/api/bsw/bigScreen/index/search?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 首页-热门排行
homePageGetRank: function(params) {
return request({
url: '/api/bsw/bigScreen/index/rank?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 首页-合作伙伴
homePageGetPartners: function(params) {
return request({
url: '/api/bsw/bigScreen/index/partners?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
// 首页-友情链接
homePageGetFriendshipUrl: function(params) {
return request({
url: '/api/bsw/bigScreen/index/friendshipUrl?' + qs.stringify(params, { indices: false }),
method: 'get'
})
},
xxx: null
id: null
}
}
......@@ -49,6 +49,11 @@
<el-input v-model="formData.content" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="链接:" class="form-cell" prop="url">
<div class="cell-box">
<el-input v-model="formData.url" placeholder="单行输入" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="顺序:" class="form-cell" prop="sort">
<div class="cell-box">
<el-input v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
......
......@@ -20,6 +20,7 @@
</div>
</template>
<script>
import { HttpReq } from '@/api/common'
export default {
data() {
return {
......@@ -51,20 +52,20 @@ export default {
{ name: '采购商常见问题', url: '' },
{ name: '供应商常见问题', url: '' }
]
},
{
name: '友情链接',
list: [
{ name: '佛山英沃传感科技有限公司佛山英沃传感科技有限公司', url: '' },
{ name: '佛山英沃传感科技有限公司', url: '' },
{ name: '佛山英沃传感科技有限公司', url: '' }
]
}
]
}
},
mounted() {
this.$nextTick(() => {
HttpReq.webClientApi.homePageGetFriendshipUrl({
preview: false
}).then((res) => {
this.dataList.push({
name: '友情链接',
list: res.data.friendshipUrl
})
})
})
},
methods: {
......
......@@ -11,23 +11,25 @@
<el-button icon="el-icon-search" class="btn">搜索</el-button>
</div>
<div class="search-keyword">
<span v-for="(item, index) in keywords" :key="index" class="label" @click="keywordClick(item, 'keyword')">{{ item }}</span>
<span v-for="(item, index) in keywords" :key="index" class="label" @click="keywordClick(item, 'keyword')">{{ item.name }}</span>
</div>
<div class="search-keyword-title">
<div class="title-s">品牌</div>
</div>
<div class="search-keyword-label">
<span v-for="(item, index) in brands" :key="index" class="label" @click="keywordClick(item, 'brand')">{{ item }}</span>
<span v-for="(item, index) in brands" :key="index" class="label" @click="keywordClick(item, 'brand')">{{ item.name }}</span>
</div>
<div class="search-keyword-title">
<div class="title-s">供应商</div>
</div>
<div class="search-keyword-label">
<span v-for="(item, index) in suppliers" :key="index" class="label" @click="keywordClick(item, 'supplier')">{{ item }}</span>
<span v-for="(item, index) in suppliers" :key="index" class="label" @click="keywordClick(item, 'supplier')">{{ item.name }}</span>
</div>
</div>
</template>
<script>
import { HttpReq } from '@/api/common'
export default {
dicts: ['product_type', 'area_province'],
data() {
......@@ -40,12 +42,20 @@ export default {
},
mounted() {
this.$nextTick(() => {
HttpReq.webClientApi.homePageGetSearch({
preview: false
}).then((res) => {
this.keywords = res.data.keywords
this.brands = res.data.brands
this.suppliers = res.data.suppliers
})
})
},
methods: {
keywordClick(item, type) {
if (item.url) {
this.$router.push({ path: item.url })
}
}
}
}
......
......@@ -6,6 +6,8 @@
</div>
</template>
<script>
import { HttpReq } from '@/api/common'
export default {
props: {
menuIndex: {
......@@ -23,9 +25,14 @@ export default {
},
mounted() {
this.$nextTick(() => {
HttpReq.webClientApi.homePageGetHeader({
preview: false
}).then((res) => {
this.menus = res.data.menus
this.currentMenuObj = this.menuIndex > this.menus.length ? { name: '个人中心', url: '/console' } : this.menus[this.menuIndex]
this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj)
})
})
},
methods: {
menuClick(item) {
......
......@@ -7,6 +7,8 @@
</div>
</template>
<script>
import { HttpReq } from '@/api/common'
export default {
props: {
menuIndex: {
......@@ -24,9 +26,16 @@ export default {
},
mounted() {
this.$nextTick(() => {
this.$nextTick(() => {
HttpReq.webClientApi.homePageGetHeader({
preview: false
}).then((res) => {
this.menus = res.data.menus
this.currentMenuObj = this.menuIndex > this.menus.length ? { name: '个人中心', url: '/console' } : this.menus[this.menuIndex]
this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj)
})
})
})
},
methods: {
menuClick(item) {
......
......@@ -147,7 +147,7 @@
<div style="padding: 20px 30px">
<div v-for="(item,index) in partners" :key="'pt_'+index" class="partners-card" :title="item.name">
<a :href="item.url||'http://www.minestar.cn'" target="_blank">
<el-image :src="item.imgSrc?imgSrcStart+'/img'+item.imgSrc:defaultImgLogo" fit="contain" style="width: 100%;height: 100%" />
<el-image :src="item.imgSrc?imgSrcStart+item.imgSrc:defaultImgLogo" style="width: 100%;height: 100%" />
</a>
</div>
</div>
......@@ -168,6 +168,7 @@ import languageSetting from './components/languageSetting'
import searchPanel from './components/searchPanel'
import homeFooter from './components/homeFooter'
import inquiryView from './components/inquiryView'
import { HttpReq } from '@/api/common'
export default {
components: { floatBtn, titleMenus, userLogin, languageSetting, searchPanel, homeFooter, inquiryView },
......@@ -361,41 +362,26 @@ export default {
}
],
topAreas: [],
topSuppliers: [
{ name: '中山市三角镇凌创传感器厂', id: 123 },
{ name: '中山市三角镇凌创传感器厂', id: 123 },
{ name: '中山市三角镇凌创传感器厂', id: 123 },
{ name: '中山市三角镇凌创传感器厂', id: 123 },
{ name: '中山市三角镇凌创传感器厂', id: 123 },
{ name: '中山市三角镇凌创传感器厂', id: 123 },
{ name: '中山市三角镇凌创传感器厂', id: 123 },
{ name: '中山市三角镇凌创传感器厂', id: 123 }
],
topProducts: [
{ name: 'wiwo1002热能工程压力变送器', id: 123 },
{ name: 'wiwo1002热能工程压力变送器', id: 123 },
{ name: 'wiwo1002热能工程压力变送器', id: 123 },
{ name: 'wiwo1002热能工程压力变送器', id: 123 },
{ name: 'wiwo1002热能工程压力变送器', id: 123 },
{ name: 'wiwo1002热能工程压力变送器', id: 123 },
{ name: 'wiwo1002热能工程压力变送器', id: 123 },
{ name: 'wiwo1002热能工程压力变送器', id: 123 }
],
partners: [
{ name: 'xxxxxxxx', imgSrc: '', url: '' },
{ name: 'xxxxxxxx', imgSrc: '', url: '' },
{ name: 'xxxxxxxx', imgSrc: '', url: '' },
{ name: 'xxxxxxxx', imgSrc: '', url: '' },
{ name: 'xxxxxxxx', imgSrc: '', url: '' },
{ name: 'xxxxxxxx', imgSrc: '', url: '' },
{ name: 'xxxxxxxx', imgSrc: '', url: '' }
],
topSuppliers: [],
topProducts: [],
partners: [],
throttle: null, // 节流器
throttleTime: 300
}
},
mounted() {
this.$nextTick(() => {
HttpReq.webClientApi.homePageGetRank({
preview: false
}).then((res) => {
this.topSuppliers = res.data.topSuppliers
this.topProducts = res.data.topProducts
})
HttpReq.webClientApi.homePageGetPartners({
preview: false
}).then((res) => {
this.partners = res.data.partners
})
const random = (min, max) => {
return Math.floor(Math.random() * (max - min)) + min
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment