PestAnalysis.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div class="container">
  3. <div class="result-container">
  4. <!-- <span style="width: 400px;height: 300px">自定义</span>-->
  5. <el-skeleton style="width:600px;height: 300px" :loading="isLoading" animated>
  6. <template slot="template">
  7. <el-skeleton-item
  8. variant="image"
  9. style="width: 600px; height: 300px;"
  10. />
  11. <!-- <div style="padding: 14px;">-->
  12. <!-- <el-skeleton-item variant="h3" style="width: 50%;" />-->
  13. <!-- <div-->
  14. <!-- style="display: flex; align-items: center; justify-items: space-between; margin-top: 16px; height: 16px;"-->
  15. <!-- >-->
  16. <!-- <el-skeleton-item variant="text" style="margin-right: 16px;" />-->
  17. <!-- <el-skeleton-item variant="text" style="width: 30%;" />-->
  18. <!-- </div>-->
  19. <!-- </div>-->
  20. </template>
  21. <template>
  22. <el-card :body-style="{ padding: '0px', marginBottom: '1px' }">
  23. <img
  24. :src="resPic"
  25. class="image"
  26. width="auto"
  27. height="300px"
  28. />
  29. <div style="padding: 14px;">
  30. <span>检测结果</span>
  31. </div>
  32. </el-card>
  33. </template>
  34. </el-skeleton>
  35. <!-- <el-card style="width: 700px;height: 300px">-->
  36. <!--&lt;!&ndash; &ndash;&gt;-->
  37. <!-- <el-image :src="resPic" v-if="resPic!=null">-->
  38. <!-- <div slot="placeholder" class="image-slot">-->
  39. <!-- 加载结果<span class="dot">...</span>-->
  40. <!-- </div>-->
  41. <!-- </el-image>-->
  42. <!-- </el-card>-->
  43. </div>
  44. <div class="upload-container">
  45. <el-upload
  46. class="avatar-uploader"
  47. :action="$baseUrl + '/files/upload'"
  48. :headers="{ token: user.token }"
  49. list-type="picture"
  50. :on-success="handleUploadSuccess"
  51. >
  52. <el-button type="primary">上传商品害虫图片</el-button>
  53. </el-upload>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. export default {
  59. name: "PestAnalysis",
  60. data() {
  61. return {
  62. user :JSON.parse(localStorage.getItem('xm-user') || '{}'),
  63. uploadResult: null,
  64. returnResult: null,
  65. flaskBaseUrl: '', // Flask地址
  66. resPic:null,
  67. isLoading:false,
  68. };
  69. },
  70. methods: {
  71. handleUploadSuccess(file) {
  72. this.isLoading = true;
  73. setTimeout(()=>{
  74. this.resPic = require("/src/assets/imgs/query_result.png")
  75. this.isLoading = false; // 加载完成
  76. },2000)
  77. var fileReader = new FileReader();
  78. return file
  79. },
  80. uploadImg(){
  81. },
  82. }
  83. };
  84. </script>
  85. <style scoped>
  86. .container {
  87. height: 100vh;
  88. overflow: hidden;
  89. background-image: url("@/assets/imgs/bg.jpg");
  90. background-size: 100%;
  91. display: flex;
  92. flex-direction: column;
  93. align-items: center;
  94. justify-content: center;
  95. color: #666;
  96. }
  97. .upload-container, .result-container {
  98. text-align: center;
  99. margin-top: 50px;
  100. }
  101. .result-container {
  102. margin-top: 20px; /* 调整上方间距 */
  103. }
  104. </style>