正式线上项目出现can't find variable这些错误
发布于 5 年前 作者 xiulanmeng 16688 次浏览 来自 问答
  1. 进入某一个页面出错,can't find variable at request fail callback function等错误提示。

  2. 突然发现下面有textarea的话,里面的文字会覆盖在控制台上,textarea这个东西真的很万恶,包括层级这些问题。

  3. 图片上传后返回结果不能解析,本地真机和开发工具都没问题,发到了线上出现问题了,

    下面是正常返回的数据,json串看着没问题啊,已经打了控制台提交审核新版本了,麻烦审核快一点,今天还可以调一下线上的。


    上传图片的代码如下:
commonUploadImage(url, data = {}, options = {}) {
        options = { ...DEFAULT_UPLOADIMAGE_OPTIONS,
            ...options
        }
        // 使用Promise处理请求
        return new Promise((response, error) => {
            wx.chooseImage({
                count: options.count, //最多可以选择的图片张数,
                success: res => {
                    wx.showLoading({
                        title: '正在上传中..', //提示的内容,
                    });
                    wx.uploadFile({
                        url: requestConfig.prefix + url,
                        filePath: res.tempFilePaths[0],
                        name: options.name,
                        header: options.header,
                        formData: {
                            token: utils.getStorage("hy_token"),
                            ...data
                        },
                        success: (res) => {
                            console.log("commonUploadImage上传成功:", res)
                            wx.hideLoading();
                            if (res && res.data) {
                                res = JSON.parse(res.data);
                                response(res);
                            }
                        },
                        fail: (res) => {
                            console.log("commonUploadImage上传失败1:", res)
                            wx.hideLoading();
                            error(res);
                        }
                    })
                },
                fail: (res) => {
                    console.log("commonUploadImage上传失败2:", res)
                    wx.hideLoading();
                    error(res);
                },
            });
        })
    },

本地返回成功的结果如下:

{"repCode":"S0000","repNote":"SUCCESS","pertain":"CRM","totalRows":"0","resModel":{"fileName":"wxb74ef161e3ed9478.o6zAJs_TX8S9j9j8IfQlIL0kw1-0.7ULsiOG9wGMA634bd7219c25d2ba4bba92bfe2b6c3e6.png","id":"a0537272-229e-48ef-ab35-a242c86f23e9","url":"https://www.smartkedou.com/member/20181026142021_62f6addc-a95f-4474-9d5c-ff78f2e6b773.png"},"resExtra":null}

下面是上面描述的报错的两个问题的图片:

2 回复

请问楼主怎么解决的

回到顶部