展品维保小程序前端代码接口
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.

332 lines
8.0 KiB

  1. <template>
  2. <view class="home-container">
  3. <!-- 顶部横幅图片 -->
  4. <view class="banner-section">
  5. <image class="banner-image" src="@/static/首页背景图.png" mode="aspectFill"></image>
  6. </view>
  7. <!-- 搜索区域 -->
  8. <SearchInput
  9. v-model="searchValue"
  10. placeholder="请输入展品名称"
  11. search-button-text="搜索"
  12. @search="handleSearch"
  13. />
  14. <!-- 展品分类 -->
  15. <view class="category-section" @click="openPicker">
  16. <view class="category-label">展品分类</view>
  17. <uv-icon name="arrow-down-fill" size="14" color="#C70019"></uv-icon>
  18. <uv-picker
  19. ref="picker"
  20. v-model="categoryShow"
  21. :columns="columns"
  22. mode="selector"
  23. @confirm="onCategoryConfirm"
  24. confirmColor="#C70019"
  25. >
  26. </uv-picker>
  27. </view>
  28. <!-- 展品列表 -->
  29. <view class="exhibit-list">
  30. <view class="exhibit-item" v-for="(item, index) in exhibitList" :key="index" @click="handleItemClick(item)">
  31. <view class="item-header">
  32. <text class="item-id">{{ item.id }}</text>
  33. <img src="@/static/copy.png" alt="我是复制黏贴" class="item-icon" @click="copyId(item.id)">
  34. </view>
  35. <view class="item-border" />
  36. <view class="item-content">
  37. <view class="content-row">
  38. <text class="name">{{ item.name }}</text>
  39. </view>
  40. <view class="content-row">
  41. <text class="label">展品编号</text>
  42. <text class="value">{{ item.code }}</text>
  43. </view>
  44. <view class="content-row">
  45. <text class="label">展品编号</text>
  46. <text class="value">{{ item.code }}</text>
  47. </view>
  48. <view class="content-row">
  49. <text class="label">展品位置</text>
  50. <text class="value">{{ item.location }}</text>
  51. </view>
  52. <view class="content-row">
  53. <text class="label">展品类型</text>
  54. <text class="value">{{ item.type }}</text>
  55. </view>
  56. <view class="content-row">
  57. <text class="label">下次保养日期</text>
  58. <text class="value">{{ item.maintenanceDate }}</text>
  59. <view v-if="item.maintenanceProject" class="project">
  60. {{ item.maintenanceProject }}
  61. </view>
  62. </view>
  63. </view>
  64. <view class="item-actions">
  65. <uv-button
  66. size="small"
  67. color="#c70019"
  68. shape="circle"
  69. text="申请报修"
  70. @click.stop="handleRepair(item)"
  71. ></uv-button>
  72. <uv-button
  73. size="small"
  74. text="保养提交"
  75. color="#c70019"
  76. shape="circle"
  77. plain
  78. @click.stop="handleMaintenance(item)"
  79. ></uv-button>
  80. <uv-button
  81. color="#c70019"
  82. shape="circle"
  83. size="small"
  84. text="维修/保养记录"
  85. plain
  86. @click.stop="handleRecord(item)"
  87. ></uv-button>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import SearchInput from '@/pages/components/SearchInput.vue'
  95. export default {
  96. components: {
  97. SearchInput
  98. },
  99. data() {
  100. return {
  101. searchValue: '',
  102. categoryShow: false,
  103. selectedCategory: '',
  104. columns: [
  105. [
  106. '全部',
  107. '文字内容',
  108. '互动设备',
  109. '展示设备'
  110. ]
  111. ],
  112. exhibitList: [
  113. {
  114. id: '3451356565',
  115. name: '展品名称内容',
  116. code: '56559685623452',
  117. location: '2楼互动区液体力学',
  118. type: '文字内容',
  119. maintenanceDate: '2025-08-19'
  120. },
  121. {
  122. id: '3451356566',
  123. name: '展品名称内容',
  124. code: '56559685623453',
  125. location: '1楼展示区机械原理',
  126. type: '互动设备',
  127. maintenanceDate: '2025-09-15',
  128. maintenanceProject: '3天后维保',
  129. },
  130. {
  131. id: '3451356567',
  132. name: '展品名称内容',
  133. code: '56559685623454',
  134. location: '3楼体验区声学实验',
  135. type: '展示设备',
  136. maintenanceDate: '2025-07-22'
  137. }
  138. ]
  139. }
  140. },
  141. methods: {
  142. handleSearch() {
  143. console.log('搜索:', this.searchValue)
  144. // TODO: 实现搜索逻辑
  145. },
  146. openPicker() {
  147. this.$refs.picker.open()
  148. },
  149. onCategoryConfirm(e) {
  150. this.selectedCategory = e.label
  151. console.log('选择分类:', e)
  152. // TODO: 根据分类筛选展品
  153. },
  154. copyId(id) {
  155. uni.setClipboardData({
  156. data: id,
  157. success: () => {
  158. uni.showToast({
  159. title: '已复制到剪贴板',
  160. icon: 'success'
  161. })
  162. }
  163. })
  164. },
  165. handleItemClick(item) {
  166. console.log('点击展品:', item)
  167. // TODO: 跳转到展品详情页
  168. },
  169. handleRepair(item) {
  170. uni.navigateTo({
  171. url: '/subPages/home/repairSubmit?id=' + item.id
  172. })
  173. // TODO: 跳转到报修页面
  174. },
  175. handleMaintenance(item) {
  176. console.log('保养提交:', item)
  177. uni.navigateTo({
  178. url: '/subPages/home/maintainanceSubmit?id=' + item.id
  179. })
  180. // TODO: 跳转到保养提交页面
  181. },
  182. handleRecord(item) {
  183. console.log('查看记录:', item)
  184. uni.navigateTo({
  185. url: '/subPages/home/RAArecord?id=' + item.id
  186. })
  187. // TODO: 跳转到维修保养记录页面
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .home-container {
  194. background-color: #fff;
  195. min-height: 100vh;
  196. }
  197. .banner-section {
  198. width: 100%;
  199. height: 500rpx;
  200. .banner-image {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. }
  205. .category-section {
  206. padding: 20rpx 48rpx;
  207. display: flex;
  208. align-items: center;
  209. justify-content: start;
  210. gap: 9rpx;
  211. .category-label {
  212. font-size: 28rpx;
  213. color: $primary-color;
  214. }
  215. .category-picker {
  216. display: flex;
  217. align-items: center;
  218. padding: 10rpx 20rpx;
  219. border: 1rpx solid #ddd;
  220. border-radius: 8rpx;
  221. background-color: #fafafa;
  222. .category-text {
  223. font-size: 28rpx;
  224. color: #666;
  225. margin-right: 10rpx;
  226. }
  227. }
  228. }
  229. .exhibit-list {
  230. padding: 20rpx 30rpx;
  231. .exhibit-item {
  232. background-color: #fff;
  233. border-radius: 16rpx;
  234. padding: 30rpx 30rpx 45rpx;
  235. margin-bottom: 20rpx;
  236. border-radius: 15rpx;
  237. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  238. .item-header {
  239. display: flex;
  240. align-items: center;
  241. justify-content: start;
  242. gap: 20rpx;
  243. padding-bottom: 14rpx;
  244. .item-id {
  245. font-size: 28rpx;
  246. color: $secondary-text-color;
  247. }
  248. .item-icon {
  249. width: 25.5rpx;
  250. height: 25.5rpx;
  251. }
  252. }
  253. .item-border {
  254. border-bottom: 1rpx solid $secondary-text-color;
  255. opacity: 0.22;
  256. }
  257. .item-content {
  258. margin-top: 26.5rpx;
  259. margin-bottom: 57rpx;
  260. .content-row {
  261. display: flex;
  262. align-items: center;
  263. margin-bottom: 25rpx;
  264. .name{
  265. font-size: 30rpx;
  266. color: $primary-text-color;
  267. font-weight: bold;
  268. }
  269. &:last-child {
  270. margin-bottom: 0;
  271. }
  272. &:first-child {
  273. margin-bottom: 37rpx;
  274. }
  275. .label {
  276. font-size: 22rpx;
  277. color: $secondary-text-color;
  278. // width: 200rpx;
  279. margin-right: 19rpx;
  280. flex-shrink: 0;
  281. }
  282. .value {
  283. font-size: 22rpx;
  284. color: $primary-text-color;
  285. margin-right: 40rpx;
  286. }
  287. .project {
  288. // flex: 1;
  289. background: $primary-color;
  290. // border: 1px solid #707070;
  291. border-radius: 11rpx;
  292. color: #fff;
  293. font-size: 22rpx;
  294. padding: 6rpx 12rpx;
  295. }
  296. }
  297. }
  298. .item-actions {
  299. margin-left: -10rpx;
  300. display: flex;
  301. gap: 55rpx;
  302. flex-wrap: wrap;
  303. }
  304. }
  305. }
  306. </style>