index.vue 6.3 KB

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