test.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div
  3. :class="$deviceType.isMobile() ? 'mobileMain' : ''"
  4. :style="{marginTop: mainMarginTop, marginBottom: $deviceType.isMobile() ? '0px' : '30px !important'}">
  5. <div class="consult-wrapper">
  6. <div class="consult-top">
  7. <div class="tabs">
  8. <div class="tabs-item" :class="num==0 ? 'active' : ''" @click="tabsItem(0)">全部</div>
  9. <div class="tabs-item" :class="num==19 ? 'active' : ''" @click="tabsItem(19)">技术服务商</div>
  10. <div class="tabs-item" :class="num==18 ? 'active' : ''" @click="tabsItem(18)">人力外包</div>
  11. </div>
  12. </div>
  13. <div>
  14. <div class="company-list" v-if="companyList.length">
  15. <a :href="`/company/${item.uid}`" v-for="item in companyList" :key="item.uid">
  16. <!-- <img class="img" :src="item.logo" :alt="item.name"> -->
  17. <img class="img" :src="defaultImg" v-real-img="item.logo" :alt="item.name">
  18. <div class="right">
  19. <h3 class="title">{{ item.name }}</h3>
  20. <div class="industry">
  21. <span v-for="tag in item.tag" :key="tag.name">{{ tag.name }}</span>
  22. </div>
  23. <div class="intro">
  24. <span>入驻平台: <em>{{ !item.time ? 0 : item.time }}年</em></span>
  25. <span>企业规模: <em>{{ !item.group_type ? 0 : item.group_type }}人</em></span>
  26. <span>办公地址: <em>{{ !item.address ? '暂无' : item.address }}</em></span>
  27. </div>
  28. <p class="info">{{ item.brief_introduction }}</p>
  29. </div>
  30. </a>
  31. </div>
  32. <div class="result-empty-wrapper" style="margin-top: 10px;" v-else>
  33. <img src="@/assets/img/common/empty@2x.png" alt="empty">
  34. <span>暂无内容</span>
  35. </div>
  36. </div>
  37. <div class="pagination">
  38. <el-pagination
  39. background
  40. layout="prev, pager, next"
  41. :current-page="pagination.page"
  42. :total="pagination.total"
  43. @current-change="handlePageChange">
  44. </el-pagination>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import {mapState} from "vuex"
  51. import DealSeoList from "@/components/company/dealSeoList"
  52. import qs from "qs"
  53. export default {
  54. name: 'SeoCompanyList',
  55. data () {
  56. return {
  57. num: 0,
  58. baseUrl: '',
  59. isWeixinApp: true,
  60. defaultImg: require('@/assets/img/common/empty@2x.png')
  61. }
  62. },
  63. head() {
  64. const {
  65. title = "",
  66. keyword = "",
  67. description = "",
  68. h1 = "",
  69. canonical = "",
  70. metaLocation
  71. } = this.head || {}
  72. let obj = {
  73. title: title,
  74. meta: [{
  75. name: "keywords",
  76. content: keyword
  77. }, {
  78. name: "description",
  79. content: description
  80. }, {
  81. name: "h1",
  82. content: h1
  83. }],
  84. link: [{rel: "canonical", href: canonical}]
  85. }
  86. if (metaLocation) {
  87. obj.meta.push({name: "location", content: metaLocation})
  88. }
  89. return obj
  90. },
  91. computed: {
  92. ...mapState(["deviceType"]),
  93. showWxHeader () {
  94. return !this.deviceType.app && !this.isWeixinApp &&
  95. (this.deviceType.android || this.deviceType.ios)
  96. },
  97. mainMarginTop () {
  98. if (this.mobile && this.showWxHeader) {
  99. return '64px !important'
  100. } else if (this.mobile) {
  101. return '0px !important'
  102. } else {
  103. return '10px !important'
  104. }
  105. }
  106. },
  107. async asyncData ({...params}) {
  108. let dealDataObj = new DealSeoList(params)
  109. let result = await dealDataObj.dealData()
  110. return {
  111. ...result
  112. }
  113. },
  114. mounted () {
  115. this.baseUrl = this.$store.state.domainConfig.siteUrl
  116. this.isWeixinApp = navigator.userAgent.indexOf("miniProgram") > -1
  117. },
  118. methods: {
  119. tabsItem(num){
  120. this.num = num
  121. this.getCompanyList(num)
  122. },
  123. getCompanyList (num=0) {
  124. this.pagination.loading = true
  125. let data = {
  126. cert_id: num,
  127. page: this.pagination.page,
  128. pagesize: this.pagination.pagesize
  129. }
  130. this.$axios.$post('/uapi/company', data).then(res => {
  131. const { data, info, status} = res
  132. if(status===1){
  133. this.companyList = data.list
  134. this.pagination.total = data.count
  135. }
  136. }).then(()=>{
  137. this.pagination.loading = false
  138. })
  139. // this.pagination.loading = true
  140. // this.pagination.noMore = false
  141. },
  142. /** 分页页码改变时 */
  143. handlePageChange (val) {
  144. this.pagination.page = val
  145. this.getCompanyList(this.num)
  146. },
  147. /** mobile 加载更多 */
  148. // handleLoadMoreConsult () {
  149. // if (this.pagination.loading) {
  150. // return
  151. // }
  152. // this.pagination.page++
  153. // this.getCompanyList()
  154. // },
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. @import "@/assets/css/consult/list.scss";
  160. </style>
  161. <style lang="scss">
  162. .consult-wrapper .consult-top{
  163. padding-bottom: 0 !important;
  164. border-radius: 6px !important;
  165. }
  166. .company-list {
  167. a {
  168. display: flex;
  169. font-family: PingFangSC, PingFangSC-Regular;
  170. padding: 18px;
  171. margin-top: 10px;
  172. background: #fff;
  173. .right {
  174. flex: 1;
  175. padding-left: 16px;
  176. }
  177. .img {
  178. width: 164px;
  179. height: 164px;
  180. background: #fff;
  181. border-radius: 8px;
  182. }
  183. .title {
  184. color: #222;
  185. font-size: 20px;
  186. padding-top: 4px;
  187. }
  188. .industry {
  189. padding: 12px 0;
  190. span {
  191. background: rgba(48,142,255,0.11);
  192. border-radius: 1px;
  193. padding: 9px 11px;
  194. color: #308eff;
  195. font-size: 12px;
  196. display: inline-block;
  197. margin-right: 8px;
  198. }
  199. }
  200. .intro {
  201. color: #999;
  202. font-size: 14px;
  203. span {
  204. display: inline-block;
  205. margin-right: 16px;
  206. }
  207. em {
  208. color: #308eff;
  209. }
  210. }
  211. .info {
  212. padding: 12px 0;
  213. color: #666;
  214. font-size: 14px;
  215. line-height: 22px;
  216. text-overflow: -o-ellipsis-lastline;
  217. overflow: hidden;
  218. text-overflow: ellipsis;
  219. display: -webkit-box;
  220. -webkit-line-clamp: 2;
  221. line-clamp: 2;
  222. -webkit-box-orient: vertical;
  223. }
  224. }
  225. }
  226. .pagination {
  227. margin-top: 10px;
  228. background: #fff;
  229. width: 100%;
  230. height: 65px;
  231. display: flex;
  232. align-items: center;
  233. justify-content: center;
  234. .el-pagination {
  235. padding: 0;
  236. }
  237. }
  238. .consult-wrapper .consult-top .tabs .tabs-item {
  239. cursor: pointer;
  240. }
  241. .wx-header-custom-list {
  242. position: fixed !important;
  243. z-index: 11 !important;
  244. }
  245. </style>