开始

优化,做视频的这种形式
image.png

image.png

  1. <!-- 视频样式 -->
  2. <view class="common-list-play"></view>
  3. <view class="common-list-playinfo">
  4. 20w 次播放 2:47
  5. </view>

播放按钮
image.png
image.png
父元素加上flex布局
image.png

image.png

image.png

image.png
上面写一个公共的,绝对定位
image.png

image.png

播放按钮放大居中

font-size就是设置了视频的图标增大
image.png
加个黑色的背景,圆角和内边距
image.png

  1. .common-list-playinfo{
  2. right: 10upx;
  3. bottom: 10upx;
  4. background: #333333;
  5. border-radius: 20upx;
  6. padding: 0 15upx;
  7. }

image.png
播放按钮文字放大,右下角文字缩小。
image.png

左右边距增大
image.png

image.png
改成透明的颜色
image.png

  1. .common-list-playinfo{
  2. right: 10upx;
  3. bottom: 10upx;
  4. background: rgba(51,51,51,0.73);
  5. border-radius: 20upx;
  6. padding: 0 20upx;
  7. font-size: 26upx;
  8. }

image.png

本节代码

  1. <template>
  2. <view>
  3. <!-- 自定义导航栏 -->
  4. <uni-nav-bar :statusBar="true" @clickRight="openAdd">
  5. <!-- 左边 -->
  6. <block slot="left">
  7. <view class="nav-left">
  8. <view class="icon iconfont icon-qiandao"></view>
  9. </view>
  10. </block>
  11. <!-- 中间 -->
  12. <view class="nav-tab-bar u-f-ajc">
  13. <block v-for="(tab,index) in tabBaras" :key="tab.id">
  14. <view class="u-f-ajc" :class="{'active':tabIndex==index}"
  15. @tap="changeTab(index)">
  16. {{tab.name}}
  17. <view v-if="(tabIndex==index)" class="nav-tab-bar-line"></view></view>
  18. </block>
  19. </view>
  20. <!-- 右边 -->
  21. <block slot="right">
  22. <view class="nav-right u-f-ajc">
  23. <view class="icon iconfont icon-bianji1"></view>
  24. </view>
  25. </block>
  26. </uni-nav-bar>
  27. <!-- 列表 -->
  28. <view class="common-list u-f">
  29. <view class="common-list-l">
  30. <image src="../../static/demo/userpic/12.jpg" mode="widthFix" lazy-load="true"></image>
  31. </view>
  32. <view class="common-list-r">
  33. <view class="u-f-ac u-f-jsb">
  34. <view class="u-f-ac">昵称
  35. <view class="tag-sex icon iconfont icon-nan">25</view>
  36. </view>
  37. <view class="icon iconfont icon-zengjia">关注</view>
  38. </view>
  39. <view class="">我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题</view>
  40. <view class="u-f-ajc">
  41. <!-- 图片 -->
  42. <image src="../../static/demo/datapic/13.jpg"
  43. mode="widthFix"
  44. lazy-load="true">
  45. </image>
  46. <!-- 视频 -->
  47. <view class="common-list-play icon iconfont icon-bofang"></view>
  48. <view class="common-list-playinfo">
  49. 20w 次播放 2:47
  50. </view>
  51. </view>
  52. <view class="u-f-ajc u-f-jsb">
  53. <view class="">深圳 龙岗</view>
  54. <view class="u-f-ac">
  55. <view class="icon iconfont icon-zhuanfa"></view>
  56. <view class="icon iconfont icon-pinglun1"></view>
  57. <view class="icon iconfont icon-dianzan1"></view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. export default {
  66. data() {
  67. return {
  68. tabIndex: 0,
  69. tabBaras: [
  70. {name:'关注',id:'guanzhu'},
  71. {name:'话题',id:'toppic'},
  72. ]
  73. }
  74. },
  75. methods: {
  76. changeTab(index) {
  77. this.tabIndex=index;
  78. },
  79. openAdd(){
  80. uni.navigateTo({
  81. url:'../add-input/add-input'
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style>
  88. .common-list{
  89. padding: 20upx;
  90. }
  91. .common-list-l{
  92. flex-shrink: 0;
  93. }
  94. .common-list-l image{
  95. width: 90upx;
  96. height: 90upx;
  97. border-radius: 100%;
  98. }
  99. .common-list-r{
  100. flex: 1;
  101. margin-left: 10upx;
  102. }
  103. .common-list-r>view:nth-child(3)>image{
  104. width: 100%;
  105. border-radius: 10upx;
  106. }
  107. .common-list-r>view:nth-child(1)>view:first-child{
  108. color: #999999;
  109. color: 30upx;
  110. }
  111. .common-list-r>view:nth-child(1)>view:last-child{
  112. background: #EEEEEEE;
  113. padding: 0 10upx;
  114. font-size: 32upx;
  115. }
  116. .tag-sex{
  117. background: #007AFF;
  118. color: #FFFFFF;
  119. font-size: 23upx;
  120. padding: 5upx 10upx;
  121. margin-left: 10upx;
  122. border-radius: 20upx;
  123. line-height: 22upx;
  124. }
  125. .common-list-r>view:nth-child(2){
  126. font-size: 32upx;
  127. padding: 12upx 0;
  128. }
  129. .common-list-r>view:nth-child(3){
  130. position: relative;
  131. }
  132. .common-list-play,.common-list-playinfo{
  133. position: absolute;
  134. color: #FFFFFF;
  135. }
  136. .common-list-play{
  137. font-size: 130upx;
  138. }
  139. .common-list-playinfo{
  140. right: 10upx;
  141. bottom: 10upx;
  142. background: rgba(51,51,51,0.73);
  143. border-radius: 20upx;
  144. padding: 0 20upx;
  145. font-size: 26upx;
  146. }
  147. .common-list-r>view:nth-child(4)>view{
  148. color: #AAAAAA;
  149. }
  150. .common-list-r>view:nth-child(4)>view:nth-child(2)>view{
  151. margin-left: 10upx;
  152. padding-left: 5upx;
  153. border-bottom: 1upx solid #EEEEEE;
  154. padding-bottom: 10upx;
  155. }
  156. /* .nav-left,.nav-right{
  157. border: 1upx solid;
  158. width: 100%;
  159. } */
  160. .nav-left{
  161. /* 这里视频中是左边16upx,实际这里是不需要的 */
  162. margin-left: 0upx;
  163. }
  164. .nav-left>view,.nav-right>view{
  165. font-size: 40upx;
  166. }
  167. .nav-left>view{
  168. color: #FF9619;
  169. }
  170. .nav-tab-bar{
  171. /* 父节点是flex为1的 所以这里100%宽度就可以继承父元素的宽度 */
  172. width: 100%;
  173. /* border: 1upx solid; */
  174. margin-left: -20upx;
  175. position: relative;
  176. }
  177. .nav-tab-bar>view{
  178. /* border: 1upx solid; */
  179. font-size: 32upx;
  180. padding: 0 15upx;
  181. font-weight: bold;
  182. color: #969696;
  183. }
  184. .active{
  185. color: #333333!important;
  186. }
  187. .nav-tab-bar-line{
  188. border-bottom: 14upx solid #FEDE33;
  189. /* border-top: 7upx solid red; */
  190. width: 70upx;
  191. border-radius: 20upx;
  192. position: absolute;
  193. bottom: 12upx;
  194. }
  195. </style>

结束