haibaoInfo.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <view class="phone-haibao-info-page">
  3. <view class="phone-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">职业海报</text>
  6. <view class="text-btn">分享</view>
  7. </view>
  8. <view class="haibao-info-body-box">
  9. <view v-if="data.img" class="img-box">
  10. <img :src="data.img" class="haibao-image" />
  11. <view class="info-text-box">
  12. <view class="haibao-info-text"><icon class="jz-icon"></icon>{{data.jzName}}</view>
  13. <view class="haibao-info-text"><icon class="tel-icon"></icon>{{data.realName}}({{data.tel}})</view>
  14. </view>
  15. </view>
  16. <view v-else class="loading-text">暂无数据</view>
  17. </view>
  18. </view>
  19. </template>
  20. <script setup>
  21. import { reactive } from "vue"
  22. import { onLoad } from "@dcloudio/uni-app";
  23. import * as httpApi from '@/api/haibao.js'
  24. const data = reactive({
  25. img: '',
  26. id: '',
  27. menuId: '',
  28. jzName: '',
  29. realName: '',
  30. tel: '',
  31. })
  32. function goUpPage() {
  33. uni.redirectTo({
  34. url: `/pages/admin/haibao/index?menuId=${data.menuId}`
  35. })
  36. }
  37. function getHaibaoOpsZhiyeData(id) {
  38. httpApi.getHaibaoInfo({ id }).then(res => {
  39. data.img = res.data.image;
  40. data.jzName = res.data.jzName;
  41. data.realName = res.data.realName;
  42. data.tel = res.data.tel;
  43. }).catch(err => {
  44. console.error('加载海报失败:', err)
  45. uni.showToast({ title: '加载失败', icon: 'none' })
  46. })
  47. }
  48. onLoad((options) => {
  49. data.id = options.cardId || ''
  50. data.menuId = options.menuId || ''
  51. if (data.id) {
  52. getHaibaoOpsZhiyeData(data.id)
  53. }
  54. })
  55. </script>