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

315 lines
7.4 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 list" :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.title }}</text>
  39. </view>
  40. <view class="content-row">
  41. <text class="label">展品编号</text>
  42. <text class="value">{{ item.id }}</text>
  43. </view>
  44. <view class="content-row">
  45. <text class="label">展品位置</text>
  46. <text class="value">{{ item.position }}</text>
  47. </view>
  48. <view class="content-row">
  49. <text class="label">展品类型</text>
  50. <text class="value">{{ item.type }}</text>
  51. </view>
  52. <view class="content-row">
  53. <text class="label">下次保养日期</text>
  54. <text class="value">{{ item.maintenanceDate }}</text>
  55. <view v-if="item.maintenanceProject" class="project">
  56. {{ item.maintenanceProject }}
  57. </view>
  58. </view>
  59. </view>
  60. <view class="item-actions">
  61. <uv-button
  62. size="small"
  63. color="#c70019"
  64. shape="circle"
  65. text="申请报修"
  66. @click.stop="handleRepair(item)"
  67. ></uv-button>
  68. <uv-button
  69. size="small"
  70. text="保养提交"
  71. color="#c70019"
  72. shape="circle"
  73. plain
  74. @click.stop="handleMaintenance(item)"
  75. ></uv-button>
  76. <uv-button
  77. color="#c70019"
  78. shape="circle"
  79. size="small"
  80. text="维修/保养记录"
  81. plain
  82. @click.stop="handleRecord(item)"
  83. ></uv-button>
  84. </view>
  85. </view>
  86. </view>
  87. <!-- 空状态 -->
  88. <uv-empty v-if="!list.length" icon="/static/暂无搜索结果.png" />
  89. </view>
  90. </template>
  91. <script>
  92. import SearchInput from '@/pages/components/SearchInput.vue'
  93. import ListMixin from '@/mixins/list'
  94. export default {
  95. mixins: [ListMixin],
  96. components: {
  97. SearchInput
  98. },
  99. data() {
  100. return {
  101. mixinListApi: 'exhibit.queryShowpieceList',
  102. searchValue: '',
  103. categoryShow: false,
  104. selectedCategory: '',
  105. columns: [
  106. [
  107. '全部',
  108. '文字内容',
  109. '互动设备',
  110. '展示设备'
  111. ]
  112. ]
  113. }
  114. },
  115. methods: {
  116. handleSearch() {
  117. console.log('搜索的数值为', this.searchValue);
  118. this.initPage()
  119. this.getList(true)
  120. },
  121. mixinSetParams() {
  122. return {
  123. title: this.searchValue
  124. }
  125. },
  126. openPicker() {
  127. this.$refs.picker.open()
  128. },
  129. onCategoryConfirm(e) {
  130. this.selectedCategory = e.label
  131. console.log('选择分类:', e)
  132. // TODO: 根据分类筛选展品
  133. },
  134. copyId(id) {
  135. uni.setClipboardData({
  136. data: id,
  137. success: () => {
  138. uni.showToast({
  139. title: '已复制到剪贴板',
  140. icon: 'success'
  141. })
  142. }
  143. })
  144. },
  145. handleItemClick(item) {
  146. console.log('点击展品:', item)
  147. // TODO: 跳转到展品详情页
  148. },
  149. handleRepair(item) {
  150. uni.navigateTo({
  151. url: '/subPages/home/repairSubmit?id=' + item.id
  152. })
  153. // TODO: 跳转到报修页面
  154. },
  155. handleMaintenance(item) {
  156. console.log('保养提交:', item)
  157. uni.navigateTo({
  158. url: '/subPages/home/maintainanceSubmit?id=' + item.id
  159. })
  160. // TODO: 跳转到保养提交页面
  161. },
  162. handleRecord(item) {
  163. console.log('查看记录:', item)
  164. uni.navigateTo({
  165. url: '/subPages/home/RAArecord?id=' + item.id
  166. })
  167. // TODO: 跳转到维修保养记录页面
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .home-container {
  174. background-color: #fff;
  175. min-height: 100vh;
  176. }
  177. .banner-section {
  178. width: 100%;
  179. height: 500rpx;
  180. .banner-image {
  181. width: 100%;
  182. height: 100%;
  183. }
  184. }
  185. .category-section {
  186. padding: 20rpx 48rpx;
  187. display: flex;
  188. align-items: center;
  189. justify-content: start;
  190. gap: 9rpx;
  191. .category-label {
  192. font-size: 28rpx;
  193. color: $primary-color;
  194. }
  195. .category-picker {
  196. display: flex;
  197. align-items: center;
  198. padding: 10rpx 20rpx;
  199. border: 1rpx solid #ddd;
  200. border-radius: 8rpx;
  201. background-color: #fafafa;
  202. .category-text {
  203. font-size: 28rpx;
  204. color: #666;
  205. margin-right: 10rpx;
  206. }
  207. }
  208. }
  209. .exhibit-list {
  210. padding: 20rpx 30rpx;
  211. .exhibit-item {
  212. background-color: #fff;
  213. border-radius: 16rpx;
  214. padding: 30rpx 30rpx 45rpx;
  215. margin-bottom: 20rpx;
  216. border-radius: 15rpx;
  217. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  218. .item-header {
  219. display: flex;
  220. align-items: center;
  221. justify-content: start;
  222. gap: 20rpx;
  223. padding-bottom: 14rpx;
  224. .item-id {
  225. font-size: 28rpx;
  226. color: $secondary-text-color;
  227. }
  228. .item-icon {
  229. width: 25.5rpx;
  230. height: 25.5rpx;
  231. }
  232. }
  233. .item-border {
  234. border-bottom: 1rpx solid $secondary-text-color;
  235. opacity: 0.22;
  236. }
  237. .item-content {
  238. margin-top: 26.5rpx;
  239. margin-bottom: 57rpx;
  240. .content-row {
  241. display: flex;
  242. align-items: center;
  243. margin-bottom: 25rpx;
  244. .name{
  245. font-size: 30rpx;
  246. color: $primary-text-color;
  247. font-weight: bold;
  248. }
  249. &:last-child {
  250. margin-bottom: 0;
  251. }
  252. &:first-child {
  253. margin-bottom: 37rpx;
  254. }
  255. .label {
  256. font-size: 22rpx;
  257. color: $secondary-text-color;
  258. // width: 200rpx;
  259. margin-right: 19rpx;
  260. flex-shrink: 0;
  261. }
  262. .value {
  263. font-size: 22rpx;
  264. color: $primary-text-color;
  265. margin-right: 40rpx;
  266. }
  267. .project {
  268. // flex: 1;
  269. background: $primary-color;
  270. // border: 1px solid #707070;
  271. border-radius: 11rpx;
  272. color: #fff;
  273. font-size: 22rpx;
  274. padding: 6rpx 12rpx;
  275. }
  276. }
  277. }
  278. .item-actions {
  279. margin-left: -10rpx;
  280. display: flex;
  281. gap: 55rpx;
  282. flex-wrap: wrap;
  283. }
  284. }
  285. }
  286. </style>