Foxtable(狐表)用户栏目专家坐堂 → 一个网页,多个微信扫码输入要怎么实现


  共有1762人关注过本帖树形打印复制链接

主题:一个网页,多个微信扫码输入要怎么实现

帅哥哟,离线,有人找我吗?
wsjawm
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:72 积分:852 威望:0 精华:0 注册:2021/5/20 0:18:00
一个网页,多个微信扫码输入要怎么实现  发帖心情 Post By:2023/4/26 20:53:00 [只看该作者]

帮助文档中给了通过企业微信调用微信库实现扫码的功能,但只实现了一个扫码按钮,如果有多个扫码按钮要怎么实现呢?图片点击可在新窗口打开查看

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/4/26 20:59:00 [只看该作者]

绑定多个按钮即可

wx.ready(function () {
    document.getElementById('
scan1').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('
number1
').value = res.resultStr;
            }
        });
    };
});

wx.ready(function () {
    document.getElementById('
scan2').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('
number2
').value = res.resultStr;
            }
        });
    };
});

 回到顶部
帅哥哟,离线,有人找我吗?
wsjawm
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:72 积分:852 威望:0 精华:0 注册:2021/5/20 0:18:00
  发帖心情 Post By:2023/4/26 21:30:00 [只看该作者]

wx.ready(function () {
    document.getElementById('scan').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('number').value = res.resultStr;findtype();findCodes()
            }

        });
    };
});
wx.error(function (res) {
    //alert(res.errMsg);
});

wx.ready(function () {
    document.getElementById('scanw').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('outnumber').value = res.resultStr;findouttype();find10Codes()
            }

        });
    };
});
wx.error(function (res) {
    //alert(res.errMsg);
});

wx.ready(function () {
    document.getElementById('scann').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('innernumber').value = res.resultStr;findinnertype();find11Codes()
            }

        });
    };
});
wx.error(function (res) {
    //alert(res.errMsg);
});

这样改过后只有第一个有效,后面两个点扫码输入按钮没有反应

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/4/26 21:41:00 [只看该作者]

wx.ready(function () {
    document.getElementById('scan').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('number').value = res.resultStr;findtype();findCodes()
            }

        });
    };
    document.getElementById('scanw').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('outnumber').value = res.resultStr;findouttype();find10Codes()
            }

        });
    };
    document.getElementById('scann').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('innernumber').value = res.resultStr;findinnertype();find11Codes()
            }

        });
    };
});
wx.error(function (res) {
    //alert(res.errMsg);
});

 回到顶部
帅哥哟,离线,有人找我吗?
wsjawm
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:72 积分:852 威望:0 精华:0 注册:2021/5/20 0:18:00
  发帖心情 Post By:2023/4/26 22:06:00 [只看该作者]

直接把您给的代码复制过来,还是一样,第一个有效,后面两个无效,不知道是不是我哪里还没有注意到?

 回到顶部
帅哥,在线噢!
有点蓝
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/4/26 22:27:00 [只看该作者]

js文件发过来看看

 回到顶部
帅哥哟,离线,有人找我吗?
wsjawm
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:72 积分:852 威望:0 精华:0 注册:2021/5/20 0:18:00
  发帖心情 Post By:2023/4/26 23:24:00 [只看该作者]

wx.ready(function () {
    document.getElementById('scan').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('number').value = res.resultStr;findtype();findCodes()
            }

        });
    };
    document.getElementById('scanw').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('outnumber').value = res.resultStr;findouttype();find10Codes()
            }

        });
    };
    document.getElementById('scann').onclick = function () {
        wx.scanQRCode({
            needResult: 1,
            scanType: ['qrCode','barCode'],
            success: function (res) {
                document.getElementById('innernumber').value = res.resultStr;findinnertype();find11Codes()
            }

        });
    };
});
wx.error(function (res) {
    //alert(res.errMsg);
});

上传附件时提示文件类型不正确,只好把代码复制过来了

 回到顶部
帅哥,在线噢!
有点蓝
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/4/27 9:02:00 [只看该作者]

安装微信开发者工具打开页面测试看提示什么错误

 回到顶部
帅哥哟,离线,有人找我吗?
wsjawm
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:72 积分:852 威望:0 精华:0 注册:2021/5/20 0:18:00
  发帖心情 Post By:2023/4/27 13:27:00 [只看该作者]

使用微信开发者工具,输入域名后出现:INVALID_LOGIN,access_token expired

 回到顶部
帅哥,在线噢!
有点蓝
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/4/27 13:37:00 [只看该作者]

access_token 过期了,重新获取一下

 回到顶部
总数 12 1 2 下一页