yuanhao
2025-05-19 cc610ef597a4b600b4c48c80026f3a99be171f3b
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
<template>
    <view class="form">
        <uqrcode v-if="companyCode" ref="uqrcode" canvas-id="qrcode" :value="companyCode" :options="{ margin: 10 }"></uqrcode>
        <button @click="scode">
            扫码
        </button>
    </view>
</template>
 
<script>
    import { getCompanyInfo } from '@/api/auth'
    export default {
        data() {
            return {
                companyCode: ''
            }
        },
        onShow() {
            this.getCompanyInfo()
        },
        methods: {
            // 获取企业信息
            getCompanyInfo() {
                const value = uni.getStorageSync('userInfo')
                const id = value.users.deptId
                getCompanyInfo({companyId: id}).then(val =>{
                    this.companyCode = val.data.data.companyCode
                })
            },
            scode() {
                uni.scanCode({
                    success: val => {
                        if(val.errMsg === 'scanCode:ok'){
                            console.log(val.result)
                        }
                    }
                })
            }
        }
    }
</script>
 
<style>
 
</style>