租房小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

253 lines
5.5 KiB

  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <view class="title">选择发布类型</view>
  5. <view class="subtitle">请选择您要发布的房源类型</view>
  6. </view>
  7. <view class="options-container">
  8. <view
  9. class="option-item"
  10. v-for="(item, index) in optionList"
  11. :key="index"
  12. @click="onSelectOption(item)"
  13. >
  14. <view class="option-icon">
  15. <image :src="item.image" v-if="item.image" mode="aspectFill"></image>
  16. <text class="icon-emoji" v-if="item.icon">{{item.icon}}</text>
  17. </view>
  18. <view class="option-content">
  19. <view class="option-title">{{item.title}}</view>
  20. <view class="option-desc">{{item.shortTitle}}</view>
  21. </view>
  22. <view class="option-arrow">
  23. <uv-icon name="arrow-right" color="#999" size="20"></uv-icon>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="tips">
  28. <view class="tips-title">温馨提示</view>
  29. <!-- <view class="tips-content">
  30. 请根据您的实际情况选择对应的发布类型<br/>
  31. 不同类型的房源信息录入内容会有所差异<br/>
  32. 提交后将进入相应的信息录入页面
  33. </view> -->
  34. <view class="tips-content"
  35. v-html="info">
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import { commonIndexIndexIcon } from "@/common/api.js"
  42. export default {
  43. data() {
  44. return {
  45. optionList: [
  46. // {
  47. // code: 'idle_farmhouse',
  48. // title: '闲置农房/宅基地',
  49. // shortTitle: '农村闲置房屋、宅基地等资源',
  50. // icon: '🏡',
  51. // type: 1
  52. // },
  53. // {
  54. // code: 'commercial_land',
  55. // title: '经营性建设用地',
  56. // shortTitle: '可用于商业经营的建设用地',
  57. // icon: '🏢',
  58. // type: 2
  59. // },
  60. // {
  61. // code: 'other_resources',
  62. // title: '其他农村资源',
  63. // shortTitle: '其他类型的农村可利用资源',
  64. // icon: '🌾',
  65. // type: 3
  66. // },
  67. ],
  68. info : '',
  69. }
  70. },
  71. onLoad() {
  72. this.getRlease_home_info()
  73. this.onCommonIndexIndexIcon()
  74. },
  75. methods: {
  76. onCommonIndexIndexIcon(){
  77. let that = this
  78. commonIndexIndexIcon({}).then(response=>{
  79. console.info('onCommonIndexIndexIcon',response)
  80. that.optionList = response.result
  81. })
  82. },
  83. getRlease_home_info(){
  84. console.log(this.$utils.getkeyContent('release_home_info'));
  85. let a = this.$utils.getkeyContent('release_home_info') || {}
  86. this.info = (a.keyContent || '').replaceAll('\n', '<br>')
  87. },
  88. onSelectOption(item) {
  89. console.log('选择了:', item);
  90. // 根据不同类型跳转到不同的录入页面
  91. let targetUrl = '';
  92. if (item.code === 'idle_farmhouse') {
  93. // 闲置农房跳转到专门的录入页面
  94. targetUrl = `/pages_subpack/house/farmhouse?commonClass=${item.id}`;
  95. } else if (item.code === 'commercial_land') {
  96. // 经营性建设用地跳转到专门的录入页面
  97. targetUrl = `/pages_subpack/house/commercial?commonClass=${item.id}`;
  98. } else if (item.code === 'other_resources') {
  99. // 其他农村资源跳转到专门的录入页面
  100. targetUrl = `/pages_subpack/house/other?commonClass=${item.id}`;
  101. } else {
  102. // 其他类型跳转到通用录入页面
  103. targetUrl = `/pages_subpack/house/index?id=${item.id}&title=${item.title}`;
  104. }
  105. uni.navigateTo({
  106. url: targetUrl
  107. });
  108. }
  109. }
  110. }
  111. </script>
  112. <style scoped lang="scss">
  113. .container {
  114. min-height: 100vh;
  115. background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  116. padding: 40rpx;
  117. }
  118. .header {
  119. text-align: center;
  120. margin-bottom: 80rpx;
  121. padding-top: 60rpx;
  122. }
  123. .title {
  124. font-size: 48rpx;
  125. font-weight: bold;
  126. color: #333;
  127. margin-bottom: 20rpx;
  128. }
  129. .subtitle {
  130. font-size: 28rpx;
  131. color: #666;
  132. line-height: 1.6;
  133. }
  134. .options-container {
  135. margin-bottom: 60rpx;
  136. }
  137. .option-item {
  138. background: #fff;
  139. border-radius: 20rpx;
  140. padding: 40rpx 30rpx;
  141. margin-bottom: 30rpx;
  142. display: flex;
  143. align-items: center;
  144. box-shadow: 0 8rpx 25rpx rgba(0,0,0,0.08);
  145. transition: all 0.3s ease;
  146. position: relative;
  147. overflow: hidden;
  148. }
  149. .option-item::before {
  150. content: '';
  151. position: absolute;
  152. top: 0;
  153. left: 0;
  154. right: 0;
  155. height: 6rpx;
  156. background: linear-gradient(90deg, #1EC77A 0%, #4CAF50 100%);
  157. transform: scaleX(0);
  158. transition: transform 0.3s ease;
  159. }
  160. .option-item:active {
  161. transform: translateY(2rpx);
  162. box-shadow: 0 4rpx 15rpx rgba(0,0,0,0.12);
  163. }
  164. .option-item:active::before {
  165. transform: scaleX(1);
  166. }
  167. .option-icon {
  168. width: 120rpx;
  169. height: 120rpx;
  170. margin-right: 30rpx;
  171. display: flex;
  172. align-items: center;
  173. justify-content: center;
  174. background: #f8f9fa;
  175. border-radius: 50%;
  176. image{
  177. width: 100rpx;
  178. height: 100rpx;
  179. border-radius: 50%;
  180. }
  181. }
  182. .icon-emoji {
  183. font-size: 60rpx;
  184. line-height: 1;
  185. }
  186. .option-content {
  187. flex: 1;
  188. }
  189. .option-title {
  190. font-size: 32rpx;
  191. font-weight: bold;
  192. color: #333;
  193. margin-bottom: 10rpx;
  194. }
  195. .option-desc {
  196. font-size: 26rpx;
  197. color: #666;
  198. line-height: 1.5;
  199. }
  200. .option-arrow {
  201. margin-left: 20rpx;
  202. }
  203. .tips {
  204. background: #fff;
  205. border-radius: 20rpx;
  206. padding: 30rpx;
  207. box-shadow: 0 4rpx 15rpx rgba(0,0,0,0.06);
  208. }
  209. .tips-title {
  210. font-size: 28rpx;
  211. font-weight: bold;
  212. color: #1EC77A;
  213. margin-bottom: 20rpx;
  214. display: flex;
  215. align-items: center;
  216. }
  217. .tips-title::before {
  218. content: '';
  219. width: 8rpx;
  220. height: 32rpx;
  221. background: #1EC77A;
  222. border-radius: 4rpx;
  223. margin-right: 15rpx;
  224. }
  225. .tips-content {
  226. font-size: 24rpx;
  227. color: #666;
  228. line-height: 1.8;
  229. }
  230. </style>