Myphoto.vue 966 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <view class="">
  3. <view class="" style="margin-top: 100rpx;">
  4. <back></back>
  5. </view>
  6. <view v-for="(item,index) in image" :key="index" class="flex" >
  7. <image :src="item" mode="" class="image" @click="showPhoto(index)" v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' "></image>
  8. <video :src="item" controls v-else class="image"></video>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. import service from '@/api/index.js'
  14. export default{
  15. data(){
  16. return{
  17. id:0,
  18. image:[],
  19. index:0,
  20. }
  21. },
  22. onLoad(e) {
  23. this.id = e.id;
  24. this.photo()
  25. },
  26. methods:{
  27. photo(){
  28. service.getOrderPhoto({orderId:this.id}).then(res=>{
  29. this.image = res;
  30. })
  31. },
  32. showPhoto(index){
  33. uni.previewImage({
  34. current:index,
  35. urls:this.image,
  36. })
  37. }
  38. }
  39. }
  40. </script>
  41. <style lang="scss" scoped>
  42. .image{
  43. margin: 50rpx auto;
  44. width: 330rpx;
  45. height: 230rpx;
  46. }
  47. </style>