- import js出错,module is not defined,如何解决?
真机报错: module 'utils/config.js' is not defined, require args is '@utils/config's 使用 miniprogram-ci 编译上传 const project = new ci.Project({ appid: appid, type: 'miniProgram', projectPath: './src', privateKeyPath: keyPath, ignores: ['node_modules/**/*'], }) const uploadResult = await ci.upload({ project, version: process.env.VERSION, robot: 2, desc: `${name} ${appid}`, setting: { es6: true, es7 : true, enhance: true, minified: true, ignoreUploadUnusedFiles: true, }, }) 项目结构: ├── LICENSE ├── package-lock.json ├── package.json ├── scripts │ └── ci │ ├── dev.js └── src ├── app.js ├── app.json ├── app.wxss ├── custom-tab-bar ├── miniprogram_npm ├── pages │ ├── tabbar │ ├── home │ ├── home.js ├── project.config.json ├── static └── utils ├── api.js ├── log.js └── util.js import config from '@utils/config'; import util from '@utils/util'; import API from '@utils/api'; import log from '@utils/log'; "resolveAlias": { "~/*": "/*", "@utils/*": "utils/*" },
03-30 - wxss能不能数据绑定?
大家是怎么实现切换主题的, 全部用内联样式感觉有点麻烦
2023-05-18 - 微信开放平台账号不存在, 如何解决?
我在修改了微信开放平台邮箱之后, 修改前后的邮箱都不能登录 [图片]
2023-04-28 - 小程序上传报错 提示非法的文件, 怎么解决?
报错信息如下, 这个错误提示与没有差不多. 还是改了变量名的文件, 控制台没有输出错误, 不便于定位错误 大佬们 可能是什么原因啊 message:Error: 非法的文件,错误信息:invalid file: 3CDAA2E46BAEBEDF5ABCCAE36C8BA4A1.js, 1:191, SyntaxError: Unexpected token =!function(){const t=require("E615F6676BAEBEDF80739E60979BA4A1.js"),e=require("46D3BE516BAEBEDF20B5D65669ABA4A1.js"),a=require("B66F8D406BAEBEDFD009E54748BBA4A1.js");const n=new class{userInfo={};getToken=async()=>{for(;null==this.userInfo.token;)await e.delay(.5);return this.userInfo.token};getUserInfo=async(n=!0)=>{if(n&&await this.getToken())return this.userInfo;const s=await e.get(t.getUserInfo,{token:await this.getToken()});return a.info("获取用户信息",s),this.userInfo=s.data,0==s.status?s.data:{}};login=async n=>{const s=await e.post(t.login,{code:n,timestamp:(new Date).getTime().toString(),systemInfo:wx.getSystemInfoSync()});return a.info("登录",s),this.userInfo=s.data,0==s.status?s.data:{}};getHomeImg=async()=>{const n=await e.get(t.homeImg);return a.info("获取轮播图",n),0==n.status?n.data:[]};getRanking=async(n="today")=>{const s=await e.get(t.ranking,{type:n});return a.info("获取"+n,s),0==s.status?s.data:[]};getPractiseList=async(n=0,s=15,o="每日练习")=>{const i=await e.get(t.practiseList,{begin:n,num:s,type:o});return a.info("获取练习题列表",i),0==i.status?i.data:[]};changeInfo=async(n={})=>{const s=await e.post(t.changeInfo,{token:await this.getToken(),userInfo:n});return a.info("修改信息",s),0==s.status?(""!=s.data.token&&(this.userInfo.token=s.data.token),Object.assign(s.data)):Object.assign(n)};getProblems=async(n=0,s=15,o="all")=>{const i=await e.get(t.getProblems,{token:await this.getToken(),begin:n,num:s,type:o});return a.info(`获取${o}题目列表`,i),0==i.status?i.data:[]};getProblem=async n=>{const s=await e.get(t.getProblem,{token:await this.getToken(),problem_id:n});return a.info("获取单个题目",s),0==s.status?s.data:{}};getNewProblems=async n=>{const s=await e.get(t.getNewProblems,{token:await this.getToken(),exam_id:n});return a.info("获取练习题",s),0==s.status?s.data:[]};submitAnswer=async(n,s)=>{const o=await e.post(t.submitAnswer,{token:await this.getToken(),exam_id:n,answer:s});return a.info("提交练习题答案",o),0==o.status?o.data:{}};search=async(n="",s="all")=>{if(""==n)return[];const o=await e.get(t.search,{keyword:n,type:s});return a.info("搜索"+n,o),0==o.status?o.data:[]}};module.exports=n}(); [20230406 21:41:17][wx49c3da798eaf16f0] appid: wx49c3da798eaf16f0 openid: o6zAJsyzWxiEcL9j2SVE-9uvYVkg ideVersion: 1.06.2303220 osType: win32-x64 time: 2023-04-06 21:41:21
2023-04-06 - 微信云函数如何解决@cloudbase/manager-node依赖问题?
本地调试能正常运行, 云端就不行, 删除后重新部署也没用, 目测可能是安装依赖的问题. 这两个都按了, 没效果. [图片] 求各路大佬帮帮忙, 谢谢 目的: 小程序读取云储存目录下的所有图片并展示 附云函数代码和调用的代码 //这是云函数代码 const cloud = require('wx-server-sdk') const CloudBase = require('@cloudbase/manager-node') const { storage } = new CloudBase() cloud.init({ // 初始化 env: '环境ID'//只有一个环境ID, 是正确的 }) exports.main = async (event, context) => { const list = await storage.listDirectoryFiles('SmartCampus/data/home/carousel/') console.log("获取目录下文件列表", list); return { data: { fileList: list }, } } //在home.js里面调用云函数 wx.cloud.callFunction({ name: 'getHomeCarousel', data: {} }).then(res => { console.log("test", res.result.data.fileList); var newArr = res.result.data.fileList.slice(1);//去掉第一个 that.setData({ arrPic: newArr }) }) //app.js里面也初始化了 wx.cloud.init({ traceUser: true, nev: '略' });
2022-07-12