index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view class="index-container">
  3. <view class="project-box">
  4. <view class="project-name">
  5. <text class="label">项目名称</text>
  6. <uni-icons class="project-icon" type="right" size="16"></uni-icons>
  7. </view>
  8. <view class="change-role">
  9. <uni-icons type="contact" size="14" class="role-icon"></uni-icons>切换角色
  10. </view>
  11. </view>
  12. <view class="banner-box">
  13. <swiper class="swiper-box">
  14. <swiper-item class="swiper-item-box" v-for="(item, index) in info" :key="index">
  15. <view class="swiper-item" :style="'background-image:url(' + item.url + ')'"></view>
  16. </swiper-item>
  17. </swiper>
  18. </view>
  19. <view class="grid">
  20. <view class="grid-item red">
  21. <view>
  22. <view class="label">房源列表</view>
  23. <view class="sub-label">
  24. 查看房源
  25. <uni-icons class="sub-label-icon" type="right" size="14"></uni-icons>
  26. </view>
  27. </view>
  28. <uni-icons class="home-filled" type="home-filled" size="40"></uni-icons>
  29. </view>
  30. <view class="grid-item blue">
  31. <view>
  32. <view class="label">客户管理</view>
  33. <view class="sub-label">
  34. 查看客户
  35. <uni-icons class="sub-label-icon" type="right" size="14"></uni-icons>
  36. </view>
  37. </view>
  38. <uni-icons class="home-filled" type="person-filled" size="40"></uni-icons>
  39. </view>
  40. </view>
  41. <view class="house-box">
  42. <view class="good-box">
  43. <text>推荐房源</text>
  44. </view>
  45. <house-list :list="houseList"></house-list>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import houseList from '@/components/house/houseList.vue'
  51. import {
  52. getHouseListByPage
  53. } from '@/request/api/house'
  54. export default {
  55. data() {
  56. return {
  57. info: [{
  58. url: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5'
  59. },
  60. {
  61. url: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/f488a1cc0e904ed089d52d88e3c1b33d'
  62. }
  63. ],
  64. houseList: []
  65. }
  66. },
  67. onShow() {
  68. this.getHouseList();
  69. },
  70. methods: {
  71. getHouseList() {
  72. getHouseListByPage({
  73. currPage: 1,
  74. pageSize: 10,
  75. projectId: 9
  76. }).then(res => {
  77. if (res.code === 200) {
  78. let commonUrl =
  79. 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/f488a1cc0e904ed089d52d88e3c1b33d';
  80. this.houseList = res.data.dataList.map(node => {
  81. if (node.picture) {
  82. let picture = JSON.parse(node.picture);
  83. if (picture.length === 0) {
  84. node['privewImage'] = commonUrl;
  85. } else {
  86. node['privewImage'] = picture[0].url;
  87. }
  88. } else {
  89. node['privewImage'] = commonUrl;
  90. }
  91. return node;
  92. });
  93. }
  94. })
  95. }
  96. },
  97. components: {
  98. houseList
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. .index-container {
  104. box-sizing: border-box;
  105. position: relative;
  106. .project-box {
  107. padding: 20rpx 30rpx;
  108. display: flex;
  109. justify-content: space-between;
  110. background-color: $uni-white;
  111. border-top: 1px solid $uni-border-2;
  112. position: fixed;
  113. /* #ifdef MP-WEIXIN */
  114. top: 0;
  115. /* #endif */
  116. /* #ifdef H5 */
  117. top: calc(44px + env(safe-area-inset-top));
  118. /* #endif */
  119. left: 0;
  120. right: 0;
  121. z-index: 99;
  122. .project-name {
  123. display: flex;
  124. align-items: center;
  125. font-weight: 400;
  126. align-items: center;
  127. flex: 1;
  128. width: 0;
  129. overflow: hidden;
  130. }
  131. .project-icon {
  132. margin-left: 8rpx;
  133. }
  134. .change-role {
  135. font-size: 24rpx;
  136. color: $uni-secondary-color;
  137. border: 1px solid $uni-border-3;
  138. width: 160rpx;
  139. height: 40rpx;
  140. border-radius: 40rpx;
  141. display: flex;
  142. align-items: center;
  143. justify-content: center;
  144. }
  145. .role-icon {
  146. text {
  147. color: $uni-secondary-color !important;
  148. }
  149. margin-right: 8rpx;
  150. }
  151. }
  152. .banner-box {
  153. padding: 30rpx;
  154. box-sizing: border-box;
  155. margin-top: 86rpx;
  156. .swiper-box {
  157. height: 400rpx;
  158. border-radius: 20rpx;
  159. overflow: hidden;
  160. }
  161. .swiper-item {
  162. width: 100%;
  163. height: 100%;
  164. background-size: cover;
  165. background-position: bottom;
  166. }
  167. .swiper-item-box:first-child {
  168. border-radius: 20rpx 0 0 20rpx;
  169. }
  170. .swiper-item-box:last-child {
  171. border-radius: 0 20rpx 20rpx 0;
  172. }
  173. }
  174. .grid {
  175. display: flex;
  176. flex-wrap: wrap;
  177. padding: 0 30rpx;
  178. box-sizing: border-box;
  179. .grid-item {
  180. flex: 1;
  181. height: 180rpx;
  182. border-radius: 16rpx;
  183. color: $uni-white;
  184. display: flex;
  185. align-items: center;
  186. padding: 0 20rpx;
  187. justify-content: space-between;
  188. &.red {
  189. background: linear-gradient(to right, rgb(242, 79, 104), rgb(237, 133, 152));
  190. }
  191. &.blue {
  192. background: linear-gradient(to right, rgb(69, 159, 230), rgb(108, 201, 228));
  193. }
  194. }
  195. .label {
  196. font-size: 32rpx;
  197. margin-bottom: 5px;
  198. }
  199. .sub-label {
  200. color: $uni-extras-color;
  201. font-size: 24rpx;
  202. display: flex;
  203. align-items: center;
  204. height: 40rpx;
  205. opacity: 0.5;
  206. }
  207. .sub-label-icon {
  208. /* #ifdef H5 */
  209. color: $uni-extras-color !important;
  210. /* #endif */
  211. /* #ifdef MP-WEIXIN */
  212. text {
  213. color: $uni-extras-color !important;
  214. }
  215. /* #endif */
  216. }
  217. .grid-item:nth-child(2n) {
  218. margin-left: 30rpx;
  219. }
  220. .home-filled {
  221. opacity: 0.3;
  222. /* #ifdef H5 */
  223. color: $uni-extras-color !important;
  224. /* #endif */
  225. /* #ifdef MP-WEIXIN */
  226. text {
  227. color: $uni-extras-color !important;
  228. }
  229. /* #endif */
  230. }
  231. }
  232. .house-box {
  233. padding: 0 30rpx;
  234. box-sizing: border-box;
  235. .good-box {
  236. margin-top: 30rpx;
  237. position: relative;
  238. text-align: center;
  239. text {
  240. background: $uni-background-color;
  241. z-index: 9;
  242. position: relative;
  243. padding: 5px 10px;
  244. color: $uni-secondary-color;
  245. }
  246. &:before {
  247. content: '';
  248. bottom: 20rpx;
  249. position: absolute;
  250. left: 0;
  251. height: 1px;
  252. right: 0;
  253. background: $uni-border-2;
  254. z-index: 8;
  255. }
  256. }
  257. }
  258. }
  259. </style>