search.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <!-- 搜索 -->
  2. <template>
  3. <view class="" style="overflow: hidden;">
  4. <view class="select-head">
  5. <u-navbar leftText="" bgColor="transparent" leftIconColor="#fff" :titleStyle="{color:'#fff'}" :fixed="false"
  6. leftIconSize="48" :autoBack="true">
  7. <view class="navBar-search flex" slot="center">
  8. <u--input :placeholder="$t('live.serch')"
  9. prefixIcon="search"
  10. color="#333"
  11. border="none"
  12. v-model="value"
  13. fontSize="28rpx"
  14. :customStyle="{borderRadius:'50px',padding:'4px 12px',background:'#F5F5F5'}"
  15. prefixIconStyle="font-size: 30px;color:#999"></u--input>
  16. </view>
  17. <view class="flex size28 cfff" slot="right">
  18. <view class="" @click="submit()">
  19. {{$t('live.searchbtn')}}
  20. </view>
  21. <!-- <navigator url="" open-type="navigateBack">
  22. Cancel
  23. </navigator> -->
  24. </view>
  25. </u-navbar>
  26. </view>
  27. <view class="main">
  28. <u-row justify="space-between" class="mg-tp42">
  29. <text class="size32 c3 Bold">{{$t('live.Historytyps')}}</text>
  30. <view class="flex" @click="setEmpty()">
  31. <image src="../../static/image/live/delete.png" mode="aspectFit" class="delete-icon mg-rt8"></image>
  32. <text class="szie24 c6">{{$t('live.Emptybtn')}}</text>
  33. </view>
  34. </u-row>
  35. <view class="list mg-tp26">
  36. <!-- :class="{actives:searchHistory.indexOf(item) !== -1}" -->
  37. <view class="list-item" v-for="(item,index) in searchHistory" :key="index" @click="submit(1,item)">
  38. {{item}}
  39. </view>
  40. </view>
  41. </view>
  42. <view class="search-title">
  43. <!-- Related Live -->
  44. {{ $t('live.lab41') }}
  45. </view>
  46. <view class="detail-video-list flex">
  47. <view class="detail-video-li" v-for="(item,index) in list" :key="index" @click="$toUrl(`./live-detail?id=${item.live_id}&ID=${item.id}`)">
  48. <image class="detail-video-li-logo" :src="item.thumb" mode="aspectFill"></image>
  49. <view class="detail-video-content ">
  50. <view class="detail-video-title text-clamp2">
  51. {{item.title}}
  52. </view>
  53. <view class="detail-video-right flex">
  54. <image class="detail-video-content-logo" :src="item.avatar" mode="aspectFill"></image>
  55. <view class="detail-video-info flex">
  56. <text class="text-clamp">{{item.user_nickname}}</text>
  57. <image src="/static/images/competition/detail-hot.png" mode=""></image>
  58. <!-- <view>{{item.heat}}</view> -->
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 新闻资讯 -->
  65. <view class="search-title">
  66. <!-- Related Headlines -->
  67. {{ $t('live.lab42') }}
  68. </view>
  69. <view class="detail-article" v-if="obj.headlinesList.length != 0">
  70. <view class="detail-article-li flex" @click="$toUrl('../News/news-detail?id=' + item.id)" v-for="(item,index) in obj.headlinesList" :key="index">
  71. <!-- <view class="text-clamp2">
  72. {{item.title}}
  73. </view> -->
  74. <view class="list-li-left">
  75. <view class="list-li-left-nav text-clamp2">{{item.title}}</view>
  76. <view class="list-li-left-bot flex-start">
  77. <!-- <text :style="{color:index == 0?'#CC374A':'#999'}">置顶</text> -->
  78. <text style="color:#CC374A;width: 90rpx;" v-if="item.is_top == 1">Top</text>
  79. <view class="flex-start" style="width: 90rpx;" v-if="item.comment_count != 0">
  80. <image src="/static/image/news/topic11.png" mode="aspectFill"></image>
  81. <text>{{item.comment_count}}</text>
  82. </view>
  83. <text>{{item.addtime}}</text>
  84. </view>
  85. </view>
  86. <u--image :showLoading="true" class="list-li-logo" radius="12" :src="item.img" width="240rpx" height="136rpx"></u--image>
  87. </view>
  88. </view>
  89. <!-- 圈子 -->
  90. <view class="search-title">
  91. <!-- Related Posts -->
  92. {{ $t('live.lab43') }}
  93. </view>
  94. <view class="u-demo-block__content" v-if="obj.circleList.length != 0">
  95. <view class="album" @click="$toUrl('../News/community-detail?id=' + item.id)" v-for="(item,index) in obj.circleList" :key="index">
  96. <view class="album_top flex-start">
  97. <image class="logo" :src="item.avatar" mode=""></image>
  98. <view class="">
  99. <u--text :text="item.user_nickname" bold size="32"></u--text>
  100. <u--text margin="6px 0 0 0" color="#999" size="26" :text="item.addtime"></u--text>
  101. </view>
  102. </view>
  103. <!-- <view class="nav font28 text-clamp3" :ref="'text'+index" :style="{'-webkit-line-clamp':lunIndex == index?'initial':3}">
  104. {{item.title}}
  105. </view> -->
  106. <mote-lines-divide :line="3" @click.stop="" :expandText="$t('news.full')" :foldHint="$t('news.collapsed')">
  107. {{item.title}}
  108. </mote-lines-divide>
  109. <!-- <view class="more" :style="{display:getLength(index)?'none':''}" @click.stop="setLunIndex(index)">
  110. Full text
  111. </view> -->
  112. <!-- <view class="album__content">
  113. <u-album multipleSize="200" space="16" :urls="item.img"></u-album>
  114. </view> -->
  115. <view class="album__content" v-if="item.is_flie_type == 0">
  116. <u-album multipleSize="200" space="16" :urls="item.img"></u-album>
  117. </view>
  118. <view class="album__content" v-else >
  119. <image v-if="item.video[0]" :src="item.video[0].img+'?vframe/jpg/offset/0'" style="width: 100%;" mode=""></image>
  120. <image class="play" src="/static/image/match/play.png" mode=""></image>
  121. </view>
  122. <view class="flex tabbar">
  123. <view class="">
  124. <image src="/static/image/news/topic2.png" mode=""></image>
  125. <u--text color="#999" size="24" :text="item.favorites"></u--text>
  126. </view>
  127. <view class="">
  128. <image src="/static/image/news/topic7.png" mode=""></image>
  129. <u--text color="#999" size="24" :text="item.comment"></u--text>
  130. </view>
  131. <view class="">
  132. <image src="/static/image/news/topic6.png" mode=""></image>
  133. <u--text color="#999" size="24" :text="item.click"></u--text>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. </template>
  140. <script>
  141. export default {
  142. data() {
  143. return {
  144. value:'',
  145. list:[],
  146. obj:{
  147. circleList:[],
  148. headlinesList:[]
  149. }
  150. }
  151. },
  152. onLoad() {
  153. },
  154. methods: {
  155. submit(type,item) {
  156. if(type == 1) {
  157. this.value = item
  158. }
  159. uni.$u.http.get('/api/Search/index',{params:{name:this.value}}).then(res=>{
  160. this.obj = res;
  161. this.list = res.liveList;
  162. if(type != 1) {
  163. let history = this.searchHistory
  164. history.push(this.value)
  165. this.$common.set('searchHistory',history)
  166. this.value = ''
  167. }
  168. }).catch(res=>{})
  169. },
  170. setEmpty() {
  171. this.searchHistory = []
  172. }
  173. },
  174. computed: {
  175. info() {
  176. return this.$store.state.info
  177. },
  178. isLogin() {
  179. return this.$store.state.isLogin
  180. },
  181. searchHistory: {
  182. get() {
  183. return this.$common.get('searchHistory') || []
  184. },
  185. set(val) {
  186. console.log(val);
  187. return this.$common.del('searchHistory')
  188. }
  189. }
  190. },
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. page {
  195. background-color: #F3F3F7;
  196. }
  197. .search-title {
  198. font-weight: bold;
  199. padding: 20rpx;
  200. }
  201. .detail-video-list {
  202. flex-wrap: wrap;
  203. margin: 0 24rpx;
  204. }
  205. .detail-video-li {
  206. overflow: hidden;
  207. margin-top: 20rpx;
  208. width: calc(50% - 9rpx);
  209. border-radius: 12rpx;
  210. background-color: white;
  211. .detail-video-li-logo {
  212. width: 100%;
  213. height: 176rpx;
  214. display: block;
  215. }
  216. .detail-video-content {
  217. padding: 16rpx;
  218. .detail-video-content-logo {
  219. width: 40rpx;
  220. height: 40rpx;
  221. border-radius: 50%;
  222. margin-right: 24rpx;
  223. }
  224. .detail-video-title {
  225. width: 99%;
  226. height: 80rpx;
  227. color: #333;
  228. font-size: 28rpx;
  229. }
  230. }
  231. .detail-video-info {
  232. font-size: 24rpx;
  233. flex: 1;
  234. image {
  235. width: 24rpx;
  236. height: 24rpx;
  237. margin-right: 6rpx;
  238. }
  239. text {
  240. flex: 1;
  241. width: 100rpx;
  242. color: #9193B4;
  243. }
  244. view {
  245. color: #999;
  246. }
  247. }
  248. }
  249. .select-head {
  250. position: sticky;
  251. top: 0;
  252. z-index: 99;
  253. background-color: $color1;
  254. .navBar-search {
  255. width: 70vw;
  256. padding: 18rpx 24rpx;
  257. margin-left: -32rpx;
  258. image {
  259. width: 60rpx;
  260. height: 60rpx;
  261. margin-right: 24rpx;
  262. }
  263. }
  264. .select-tab {
  265. padding: 0 28rpx;
  266. margin-top: 20rpx;
  267. }
  268. }
  269. .main {
  270. padding: 0 24rpx;
  271. .delete-icon {
  272. width: 24rpx;
  273. height: 24rpx;
  274. }
  275. .list {
  276. display: flex;
  277. flex-wrap: wrap;
  278. .list-item {
  279. text-align: center;
  280. line-height: 52rpx;
  281. // width: 124rpx;
  282. padding: 4rpx 10rpx;
  283. height: 52rpx;
  284. margin-bottom: 20rpx;
  285. border-radius: 4rpx 4rpx 4rpx 4rpx;
  286. border: 2px solid #ccc;
  287. color: #333;
  288. margin-right: 22rpx;
  289. }
  290. .actives {
  291. border: 2rpx solid #DC3C23;
  292. color: #DC3C23;
  293. }
  294. }
  295. }
  296. .detail-video-right {
  297. flex: 1;
  298. min-width: 100px;
  299. }
  300. .detail-article {
  301. margin: 24rpx 24rpx;
  302. padding: 0 24rpx;
  303. // border-top: 20rpx solid #f7f7f7;
  304. // padding-bottom: 120rpx;
  305. background-color: white;
  306. .list-li {
  307. padding: 32rpx 0;
  308. border-bottom: 2rpx solid #F0F0F0;
  309. }
  310. .detail-article-title {
  311. color: #333;
  312. font-size: 32rpx;
  313. font-weight: bold;
  314. padding-top: 32rpx;
  315. }
  316. .detail-article-li {
  317. padding: 30rpx 0;
  318. border-bottom: 2rpx solid #F0F0F0;
  319. .list-li-left {
  320. flex: 1;
  321. display: flex;
  322. flex-wrap: wrap;
  323. height: 136rpx;
  324. image {
  325. width: 28rpx;
  326. height: 24rpx;
  327. margin-right: 8rpx;
  328. }
  329. .list-li-left-nav {
  330. color: #333;
  331. font-size: 32rpx;
  332. align-self: flex-start;
  333. }
  334. }
  335. .list-li-left-bot {
  336. width: 95%;
  337. font-size: 24rpx;
  338. // margin: 0 auto;
  339. margin-left: 20rpx;
  340. align-self: flex-end;
  341. text {
  342. color: #999;
  343. // margin-right: 32rpx;
  344. }
  345. view {
  346. text {
  347. color: #999;
  348. }
  349. }
  350. }
  351. .list-li-logo {
  352. width: 242rpx;
  353. height: 136rpx;
  354. margin-left: 32rpx;
  355. border-radius: 12rpx;
  356. }
  357. }
  358. }
  359. /* 圈子 */
  360. .album {
  361. margin-top: 20rpx;
  362. padding: 32rpx 24rpx;
  363. border-radius: 12rpx;
  364. background-color: white;
  365. .logo {
  366. width: 72rpx;
  367. height: 72rpx;
  368. border-radius: 50%;
  369. margin-right: 16rpx;
  370. }
  371. .nav {
  372. padding-top: 20rpx;
  373. }
  374. .album__content {
  375. position: relative;
  376. margin-top: 30rpx;
  377. image {
  378. border-radius: 10rpx;
  379. }
  380. .play {
  381. position: absolute;
  382. top: 40%;
  383. left: 50%;
  384. margin-left: -60rpx;
  385. width: 80rpx;
  386. height: 80rpx;
  387. }
  388. }
  389. .tabbar {
  390. margin-top: 22rpx;
  391. padding: 0 22rpx;
  392. image {
  393. width: 48rpx;
  394. height: 48rpx;
  395. }
  396. view {
  397. display: flex;
  398. align-items: center;
  399. justify-content: flex-start;
  400. }
  401. }
  402. }
  403. </style>