前端技术uni-app 常用写法登录 //判断信息是否填写 btn() { if (this.username.length { uni.showToast({ icon: 'none', title: '网络异常,请稍后重试' }); } }) //加入缓存 uni.setStorage({ key:'userinfo', data:{ bh:_this.lists[0]['bh'],作者王明昌发布时间2019-04-30最后更新2019-04-30复制登录 //判断信息是否填写 btn() { if (this.username.length <= 0) { uni.showToast({ icon: 'none', title: '请输入用户名' }); return; } if (this.pwd.length <= 0) { uni.showToast({ icon: 'none', title: '请输入密码' }); return; } } //登陆 uni.request({ url: 'http://199.168.100.55:54723/ZycfService/login/login', //仅为示例,并非真实接口地址。 data: { username: this.username, pass: this.pwd },success: (res) => { let list=JSON.stringify(res.data); console.log("返回数据状态:" + list); if(list=="[]"){ uni.showToast({ icon: 'none', title: '用户名或密码错误' }); return; } uni.showToast({ icon: 'none', title: '登录成功' }); },fail: () => { uni.showToast({ icon: 'none', title: '网络异常,请稍后重试' }); } }) //加入缓存 uni.setStorage({ key:'userinfo', data:{ bh:_this.lists[0]['bh'], rolename:_this.lists[0]['rolename'], username:_this.lists[0]['username'] } }) //跳转 uni.navigateTo({ url: '../home/home', }); onLoad() { //首先将实例指针保存到全局变量 _this 方便在异步请求中访问实例本身 _this = this; uni.getStorage({ key: 'userinfo', success: function(res) { const listdata = res.data; _this.list = listdata; console.log("数据是:" + _this.list.username) } } --------------- uni.chooseImage({ count: 6, //可以选择图片的张数 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 sourceType: ['album'], //从相册选择 默认是两个都有 success: function (res) { console.log(JSON.stringify(res.tempFilePaths)); //返回结果 } }); uni.previewImage(OBJECT) uni.chooseImage({ count: 6, sizeType: ['original', 'compressed'], success: function(res) { // 预览图片 // uni.previewImage({ // urls: res.tempFilePaths // }); for(var i=0;i< res.tempFilePaths.length;i++){ console.log("第"+i+"张图片路径:"+res.tempFilePaths[i]); } uni.getImageInfo({ src:res.tempFilePaths[0], success:function(image){ console.log("图片路径:"+image.path); } }); } }); }
2018-11-30wangeditor 内容修改var E = window.wangEditor var editor = new E('#editor') // 或者 var editor = new E( document.getElemen
2018-08-30KindEditor编辑器第一次获取的到值得解决方案 {$data.addcontent} KindEditor.ready(function(K) { window.editor = K.create('#editor_id'); }); var a
2021-08-26echarts中关系图的使用,以及通过头像的形式展示使用echarts插件实现关系图,如下图所示 代码如下,自己研究 主要就是用了echarts里面的功能,并进行修改,以头像的形式展示关系图 var myChart = echarts.init(doc
2019-04-30uni-app学习每个 .vue 文件最多包含一个 < template> 块。 每个 .vue 文件最多包含一个 < script> 块。 一个 .vue 文件可以包含多个 < style> 标签。 导入 < scr
2021-12-31网页如何使用ctrl s 保存文章使用网页版写文章有个问题,习惯性的ctrl+s,但是直接打开的保存页面的弹窗,没有实现保存文章的效果那么该如何做呢搜啊搜~~~~~~~~~只要使用一段js即可解决测试了部分浏览器不支持 documen