Commit 1c27661d authored by zhanglw's avatar zhanglw

首页接口

parent fad1579b
...@@ -388,8 +388,46 @@ export const HttpReq = { ...@@ -388,8 +388,46 @@ export const HttpReq = {
}).then((res) => { }).then((res) => {
return 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 @@ ...@@ -49,6 +49,11 @@
<el-input v-model="formData.content" placeholder="单行输入" class="cell-input" /> <el-input v-model="formData.content" placeholder="单行输入" class="cell-input" />
</div> </div>
</el-form-item> </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"> <el-form-item label="顺序:" class="form-cell" prop="sort">
<div class="cell-box"> <div class="cell-box">
<el-input v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" /> <el-input v-model.number="formData.sort" type="number" placeholder="请输入数字" class="cell-input" />
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
</div> </div>
</template> </template>
<script> <script>
import { HttpReq } from '@/api/common'
export default { export default {
data() { data() {
return { return {
...@@ -51,20 +52,20 @@ export default { ...@@ -51,20 +52,20 @@ export default {
{ name: '采购商常见问题', url: '' }, { name: '采购商常见问题', url: '' },
{ name: '供应商常见问题', url: '' } { name: '供应商常见问题', url: '' }
] ]
},
{
name: '友情链接',
list: [
{ name: '佛山英沃传感科技有限公司佛山英沃传感科技有限公司', url: '' },
{ name: '佛山英沃传感科技有限公司', url: '' },
{ name: '佛山英沃传感科技有限公司', url: '' }
]
} }
] ]
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
HttpReq.webClientApi.homePageGetFriendshipUrl({
preview: false
}).then((res) => {
this.dataList.push({
name: '友情链接',
list: res.data.friendshipUrl
})
})
}) })
}, },
methods: { methods: {
......
...@@ -11,23 +11,25 @@ ...@@ -11,23 +11,25 @@
<el-button icon="el-icon-search" class="btn">搜索</el-button> <el-button icon="el-icon-search" class="btn">搜索</el-button>
</div> </div>
<div class="search-keyword"> <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>
<div class="search-keyword-title"> <div class="search-keyword-title">
<div class="title-s">品牌</div> <div class="title-s">品牌</div>
</div> </div>
<div class="search-keyword-label"> <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>
<div class="search-keyword-title"> <div class="search-keyword-title">
<div class="title-s">供应商</div> <div class="title-s">供应商</div>
</div> </div>
<div class="search-keyword-label"> <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>
</div> </div>
</template> </template>
<script> <script>
import { HttpReq } from '@/api/common'
export default { export default {
dicts: ['product_type', 'area_province'], dicts: ['product_type', 'area_province'],
data() { data() {
...@@ -40,12 +42,20 @@ export default { ...@@ -40,12 +42,20 @@ export default {
}, },
mounted() { mounted() {
this.$nextTick(() => { 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: { methods: {
keywordClick(item, type) { keywordClick(item, type) {
if (item.url) {
this.$router.push({ path: item.url })
}
} }
} }
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
</div> </div>
</template> </template>
<script> <script>
import { HttpReq } from '@/api/common'
export default { export default {
props: { props: {
menuIndex: { menuIndex: {
...@@ -23,9 +25,14 @@ export default { ...@@ -23,9 +25,14 @@ export default {
}, },
mounted() { 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.currentMenuObj = this.menuIndex > this.menus.length ? { name: '个人中心', url: '/console' } : this.menus[this.menuIndex]
this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj) this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj)
}) })
})
}, },
methods: { methods: {
menuClick(item) { menuClick(item) {
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
</div> </div>
</template> </template>
<script> <script>
import { HttpReq } from '@/api/common'
export default { export default {
props: { props: {
menuIndex: { menuIndex: {
...@@ -24,9 +26,16 @@ export default { ...@@ -24,9 +26,16 @@ export default {
}, },
mounted() { mounted() {
this.$nextTick(() => { 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.currentMenuObj = this.menuIndex > this.menus.length ? { name: '个人中心', url: '/console' } : this.menus[this.menuIndex]
this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj) this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj)
}) })
})
})
}, },
methods: { methods: {
menuClick(item) { menuClick(item) {
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
<div style="padding: 20px 30px"> <div style="padding: 20px 30px">
<div v-for="(item,index) in partners" :key="'pt_'+index" class="partners-card" :title="item.name"> <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"> <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> </a>
</div> </div>
</div> </div>
...@@ -168,6 +168,7 @@ import languageSetting from './components/languageSetting' ...@@ -168,6 +168,7 @@ import languageSetting from './components/languageSetting'
import searchPanel from './components/searchPanel' import searchPanel from './components/searchPanel'
import homeFooter from './components/homeFooter' import homeFooter from './components/homeFooter'
import inquiryView from './components/inquiryView' import inquiryView from './components/inquiryView'
import { HttpReq } from '@/api/common'
export default { export default {
components: { floatBtn, titleMenus, userLogin, languageSetting, searchPanel, homeFooter, inquiryView }, components: { floatBtn, titleMenus, userLogin, languageSetting, searchPanel, homeFooter, inquiryView },
...@@ -361,41 +362,26 @@ export default { ...@@ -361,41 +362,26 @@ export default {
} }
], ],
topAreas: [], topAreas: [],
topSuppliers: [ topSuppliers: [],
{ name: '中山市三角镇凌创传感器厂', id: 123 }, topProducts: [],
{ name: '中山市三角镇凌创传感器厂', id: 123 }, partners: [],
{ 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: '' }
],
throttle: null, // 节流器 throttle: null, // 节流器
throttleTime: 300 throttleTime: 300
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { 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) => { const random = (min, max) => {
return Math.floor(Math.random() * (max - min)) + min 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