lrf402788946 4 vuotta sitten
vanhempi
commit
df5abf964b
2 muutettua tiedostoa jossa 11 lisäystä ja 0 poistoa
  1. 1 0
      package.json
  2. 10 0
      src/views/techolchat/list/detail-model/questionnaire-model.vue

+ 1 - 0
package.json

@@ -17,6 +17,7 @@
     "lodash": "^4.17.20",
     "moment": "^2.29.1",
     "naf-core": "^0.1.2",
+    "qrcode": "^1.4.4",
     "swiper": "^5.3.6",
     "vue": "^2.6.11",
     "vue-awesome-swiper": "^4.1.1",

+ 10 - 0
src/views/techolchat/list/detail-model/questionnaire-model.vue

@@ -12,6 +12,7 @@
             <el-col :span="24" class="info">
               <el-col :span="24" class="title">
                 {{ data.title }}
+                <img :src="qc" style="position:relative;top:15px" />
               </el-col>
               <el-col :span="24" class="brief">
                 {{ data.brief }}
@@ -70,6 +71,7 @@
 </template>
 
 <script>
+import QRCode from 'qrcode';
 const _ = require('lodash');
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: answer } = createNamespacedHelpers('answer');
@@ -84,10 +86,12 @@ export default {
       answer: {},
       disabled: false,
       userForm: {},
+      qc: '',
     };
   },
   created() {
     this.init();
+    this.creatQrCode();
   },
   methods: {
     ...answer(['create', 'findAnswer']),
@@ -169,6 +173,12 @@ export default {
         this.$router.push({ path: './list', query: { index: this.$route.query.index } });
       }
     },
+    // 创建二维码
+    async creatQrCode() {
+      let url = `http://broadcast.waityou24.cn/platmobile/question/detail?id=${this.data.id}`; // 需要转换为二维码的内容
+      console.log(url);
+      this.qc = await QRCode.toDataURL(url, { height: 50, width: 50 });
+    },
   },
   computed: {
     ...mapState(['user', 'menuParams']),