index.vue 6.4 KB

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