智慧农业后台管理页面
guoshilong
2022-11-08 082613d446e29e4ec1c16bfaa52345106a498b23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<template>
  <div>
    <el-dialog
      title="溯源码预览"
      :modal-append-to-body="false"
      :append-to-body="true"
      :close-on-click-modal="false"
      @close="close"
      width="40%"
      :visible.sync="visible"
      center
    >
      <div class="dialog-code">
        <div class="syms">
          <div class="code">{{code}}</div>
          <p class="detail">溯源信息:{{remark}}</p>
        </div>
        <div class="qrcode">
          <img :src="qrcode" alt=""/>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import { mapGetters } from "vuex";
import { getSimpleInfo } from "@/api/traceability/traceability";
export default {
  data() {
    return {
      code: null,
      visible: false,
      qrcode:'',
      remark:''
    };
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
  },
  mounted() {},
  methods: {
    //初始化
    init(row) {
      this.code = row.code;
      this.visible = true;
      this.getTraceability(this.code);
    },
    //获取溯源信息
    getTraceability(code){
      getSimpleInfo(code).then((res)=>{
        this.qrcode = res.data.data.qrcode;
        this.remark = res.data.data.remark;
      })
    },
  },
};
</script>
 
<style>
.dialog-code{
    width: 400px;
    height: 100%;
    border-radius: 20px;
    border: 1px solid transparent;
    box-shadow: 0 0 5px #ddd;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.syms{
  width: 200px;
  display: flex;
  flex-direction:column;
}
 
.syms .code{
  font-size: 24px;
  font-weight: 700;
  height: 28px;
}
 
.syms .detail{
  margin-top: 0px;
}
 
.qrcode{
  width:100px;
}
 
.qrcode img{
  width:100px;
   image-rendering: -moz-crisp-edges; /* Firefox */
    image-rendering: -o-crisp-edges; /* Opera */
    image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
}
</style>