| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <div class="home">
- <div class="mobile-modal" v-if="showStoreInfo">
- <div class="mobile-modal-box">
- <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
- <div class="mobile-modal-content">
- <div>商家地址:深圳市南山区英唐大厦6楼</div>
- <div class="content-line link-url">在线咨询</div>
- <div>致电:<span class="content-line link-url">0755-96586323</span></div>
- </div>
- </div>
- </div>
- <div class="home-header">
- <div class="home-search">
- <ul>
- <li :class="activeType=='model'?'active':''" @click="activeType='model'"><span>型号</span></li>
- <li :class="activeType=='brand'?'active':''" @click="activeType='brand'"><span>品牌</span></li>
- <li :class="activeType=='shops'?'active':''" @click="activeType='shops'"><span>商家</span></li>
- </ul>
- <div class="home-input">
- <input type="text" placeholder="请输入您要查找的型号、品牌或商家" v-model="keyword"
- @focus.stop.prevent="onFocus()"/>
- <span @click="onSearch()"><i class="iconfont icon-sousuo"></i></span>
- </div>
- </div>
- </div>
- <div class="home-main">
- <a class="home-main-content">
- <div>
- <img src="/images/mobile/@2x/home/brand@2x.png" alt="1">
- </div>
- <h2>4036万</h2>
- <p>品牌</p>
- </a>
- <a class="home-main-content">
- <div>
- <img src="/images/mobile/@2x/home/modelbrand@2x.png" alt="1">
- </div>
- <h2>3250万</h2>
- <p>型号</p>
- </a>
- <a class="home-main-content">
- <div>
- <img src="/images/mobile/@2x/home/bookbrand@2x.png">
- </div>
- <h2>926万</h2>
- <p>规格书</p>
- </a>
- <nuxt-link to="/mobile/shop" class="home-main-content">
- <div>
- <img src="/images/mobile/@2x/home/shopbrand@2x.png">
- </div>
- <p>店铺列表</p>
- </nuxt-link>
- <nuxt-link to="/mobile/user" class="home-main-content">
- <div>
- <img src="/images/mobile/@2x/home/storebrand@2x.png">
- </div>
- <p>我的收藏</p>
- </nuxt-link>
- <a @click="showStoreInfo = true" class="home-main-content">
- <div>
- <img src="/images/mobile/@2x/home/phonebrand@2x.png">
- </div>
- <p>联系我们</p>
- </a>
- </div>
- <div class="home-search-list" v-if="associate && keyword">
- <div>
- <div class="search-list-top">
- <h5>历史搜索:<i class="iconfont icon-delete"></i></h5>
- <div class="search-list-item">
- <a href="#">smk212121288</a>
- <a href="#">CPU</a>
- <a href="#">CPU</a>
- <a href="#">CPU</a>
- <a href="#">CPU</a>
- <a href="#">CPU</a>
- </div>
- </div>
- <div class="search-list-bottom">
- <h5><i class="iconfont icon-remensousuo"></i>热搜器件</h5>
- <span v-for="item in hotwords">
- <nuxt-link :to="item.url" >{{item.name}}</nuxt-link>
- </span>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'home',
- data () {
- return {
- keyword: '',
- activeType: 'model',
- associate: '',
- showStoreInfo: false
- }
- },
- props: {
- hotwords: {
- type: Array,
- default () {
- return [
- {name: 'SCT2080KEC', url: '/mobile/brand/componentDetail/1100400300009990'},
- {name: 'Vishay', url: '/mobile/brand/30327265e42a871be050007f01003d96'},
- {name: 'Panasonic', url: '/mobile/brand/30327265e47d871be050007f01003d96'}
- ]
- }
- }
- },
- methods: {
- onFocus () {
- this.associate = true
- },
- onSearch () {
- if (this.keyword) {
- this.$router.push({path: '/mobile/search?w=' + encodeURIComponent(this.keyword)})
- }
- }
- },
- created () {
- this.$store.dispatch('resetSearchKeywords')
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '~assets/scss/mobileCommon';
- .home{
- margin-top: .88rem;
- font-size:.28rem;
- background: #f7fbff;
- margin-bottom:1rem;
- .home-header{
- width:100%;
- height:6.12rem;
- background:url('/images/mobile/@2x/home/background@2x.png')no-repeat;
- background-size: 100% 6.14rem;
- padding-bottom:1rem;
- .home-search{
- width:6rem;
- line-height: .3rem;
- margin:0 auto;
- padding-top:2rem;
- ul{
- display:inline-flex;
- li{
- flex:1;
- text-align:center;
- >span{
- display:inline-block;
- width:.72rem;
- line-height:.33rem;
- height:.33rem;
- background: #fff;
- color:#000;
- border-radius: .05rem .05rem 0 0 ;
- }
- }
- li.active span{
- background: #3c7cf5;
- color:#fff;
- cursor:pointer;
- }
- }
- .home-input{
- input{
- width:6rem;
- padding: 0 1.2rem 0 .16rem;
- margin-right:-1rem;
- font-size:.24rem;
- line-height: .64rem;
- border:.02rem solid #3c7cf5;
- border-radius:.05rem;
- }
- span{
- display:inline-block;
- text-align: center;
- width:1rem;
- height:.65rem;
- line-height: .64rem;
- font-size:.23rem;
- border-left:none;
- border-radius: 0 .05rem .05rem 0;
- background: #3c7cf5;
- color:#fff;
- i{
- font-size: .33rem;
- }
- }
- }
- }
- }
- }
- .home-main{
- width:100%;
- display:flex;
- justify-content:space-between;
- flex-wrap:wrap;
- text-align: center;
- padding-top:.22rem;
- }
- .home-main a.home-main-content {
- width:33%;
- margin-bottom:.52rem;
- }
- .home-main .home-main-content div{
- border-radius: .2rem;
- width:1.14rem;
- height:1.14rem;
- margin:0 auto;
- }
- .home-main .home-main-content div>img{
- width: 100%;
- height:100%;
- }
- .home-main .home-main-content p{
- font-size:.28rem;
- color:rgb(51,51,51);
- line-height: .52rem;
- }
- .home-main .home-main-content h2{
- font-size:.3rem;
- color:#ff7800;
- line-height: .32rem;
- margin:0;
- margin-top:.1rem;
- }
- /* 搜索记录 */
- .home-search-list {
- position:absolute;
- top:6.5rem;
- width:100%;
- min-height: 4rem;
- background: #fff;
- }
- .home-search-list div{
- width:6.55rem;
- margin:0 auto;
- margin-top:.1rem;
- padding-bottom:.2rem;
- .search-list-top{
- h5{
- font-size:.3rem;
- position:relative;
- line-height: .4rem;
- color:rgb(102,102,102);
- i{
- position:absolute;
- right:.2rem;
- top:.1rem;
- color:#4f8afb;
- font-size: .35rem;
- }
- }
- .search-list-item{
- a{
- display:inline-block;
- font-size:.28rem;
- line-height: .45rem;
- color:rgb(102,102,102);
- background: #fff;
- padding:0 .1rem;
- width:2.18rem;
- overflow:hidden;
- text-overflow : ellipsis;
- &:nth-child(2){
- border-left:1px solid #a5a6a6;
- border-right:1px solid #a5a6a6;
- text-align: center;
- }
- &:nth-child(5){
- border-left:1px solid #a5a6a6;
- border-right:1px solid #a5a6a6;
- text-align: center;
- }
- }
- }
- }
- .search-list-bottom{
- margin-top:-.07rem;
- h5{
- color:rgb(255,120,0);
- font-size:.3rem;
- text-align: center;
- i{
- margin-right:.15rem;
- }
- }
- a{
- display:inline-block;
- font-size:.24rem;
- color:rgb(255,120,0);
- background: #fff;
- max-width:1.62rem;
- line-height: .35rem;
- padding:0 .1rem;
- border:1px solid rgb(255,120,0);
- overflow:hidden;
- text-overflow : ellipsis;
- margin-left:.12rem;
- }
- }
- }
- </style>
|