当前位置: 首页 > news >正文

吉安市建设技术培训中心网站郑州品牌网站建设

吉安市建设技术培训中心网站,郑州品牌网站建设,成都淘宝网站建设,科泉网站锋哥原创的uniapp微信小程序投票系统实战: uniapp微信小程序投票系统实战课程 (SpringBoot2vue3.2element plus ) ( 火爆连载更新中... )_哔哩哔哩_bilibiliuniapp微信小程序投票系统实战课程 (SpringBoot2vue3.2element plus ) ( 火爆连载更新中... )共计21条视频…

锋哥原创的uniapp微信小程序投票系统实战:

uniapp微信小程序投票系统实战课程 (SpringBoot2+vue3.2+element plus ) ( 火爆连载更新中... )_哔哩哔哩_bilibiliuniapp微信小程序投票系统实战课程 (SpringBoot2+vue3.2+element plus ) ( 火爆连载更新中... )共计21条视频,包括:uniapp微信小程序投票系统实战课程 (SpringBoot2+vue3.2+element plus ) ( 火爆连载更新中... )、第2讲 投票项目后端架构搭建、第3讲 小程序端 TabBar搭建等,UP主更多精彩视频,请关注UP账号。icon-default.png?t=N7T8https://www.bilibili.com/video/BV1ea4y137xf/图文投票和文字投票基本一样,就是在投票选项里面,多了一个选项图片;

<view class="option_item" v-for="(item,index) in options" :key="item.id"><view class="option_input"><text class="removeOption" @click="removeOption(item.id)">&#xe618;</text><input type="text" v-model="item.name" placeholder="输入选项名称" placeholder-style="color:#bababa;font-size:14px"></view>				<view class="option_upload"><uni-file-picker@select="selectVoteItemFileFunc($event,index)":auto-upload="false" limit="1":del-icon="false" disable-preview file-mediatype="image" :imageStyles="voteItemImageStyles"><view class="upload"><text class="smallUploadImg">&#xe727;</text></view></uni-file-picker></view></view>
.option_item{margin-top: 10px;border-radius: 5px;background-color: white;padding: 10px;.option_input{display: flex;}.option_upload{margin-top: 20rpx;.upload{margin: 10rpx;background-color: #f4f5f7;width:90rpx;height: 90rpx;display: flex;align-items: center;justify-content: center;}}}
			voteItemImageStyles:{width:"150rpx",height:"120rpx",border:false},
selectVoteItemFileFunc:function(e,index){console.log("index="+index)console.log(e.tempFilePaths[0])uni.uploadFile({header:{token:uni.getStorageSync("token")},url:getBaseUrl()+"/vote/uploadVoteItemImage",filePath:e.tempFilePaths[0],name:"voteItemImage",success: (res) => {let result=JSON.parse(res.data);if(result.code==0){this.options[index].image=result.voteItemImageFileName;}}})},

加个image属性:

提交加上验证:

// 验证投票选项,如果有名称的,必须要上传图片for(var i=0;i<this.options.length;i++){var option=this.options[i];if(!isEmpty(option.name)){if(isEmpty(option.image)){console.log("请上传第"+(i+1)+"个投票选项图片")uni.showToast({icon:"error",title:"请上传第"+(i+1)+"个投票选项图片"})return;}}}

后端:

voteItemImagesFilePath: D://uniapp/voteItemImgs/
@Value("${voteItemImagesFilePath}")
private String voteItemImagesFilePath;
/*** 上传投票选项图片* @param voteItemImage* @return* @throws Exception*/
@RequestMapping("/uploadVoteItemImage")
public Map<String,Object> uploadVoteItemImage(MultipartFile voteItemImage)throws Exception{System.out.println("filename:"+voteItemImage.getName());Map<String,Object> resultMap=new HashMap<>();if(!voteItemImage.isEmpty()){// 获取文件名String originalFilename = voteItemImage.getOriginalFilename();String suffixName=originalFilename.substring(originalFilename.lastIndexOf("."));String newFileName= DateUtil.getCurrentDateStr()+suffixName;FileUtils.copyInputStreamToFile(voteItemImage.getInputStream(),new File(voteItemImagesFilePath+newFileName));resultMap.put("code",0);resultMap.put("msg","上传成功");resultMap.put("voteItemImageFileName",newFileName);}return resultMap;
}

http://www.yayakq.cn/news/989522/

相关文章:

  • 网站标题导航栏关于室内设计的网站有哪些
  • 湖南省住房和城乡建设网站wordpress版本怎么升级
  • 专门教做衣服的网站中国四大saas公司
  • 哈尔滨云建站模板贵州建设学校网站
  • 陕西省建设厅便民服务网站wordpress 代码 翻译
  • 网站建设有哪些费用网站开发与编程的区别
  • 公司门户网站建设wordpress 首页文章数量
  • 网站源码免费的最佳外贸建站平台
  • 网站建设裕鸿国际网站浮动咨询代码
  • 系部网站开发计划深圳建网站哪个好
  • 帝国小说网站模板建设企业网站需要使用哪些技术
  • 海淀周边网站建设wordpress更改上传
  • 网站链接优化h5自适应网站模板
  • 做电影网站有什么流媒体好自助网站开发
  • 建设网站需要哪些认证上海企业体检
  • 销售网站开发业务网站浏览图片怎么做的
  • 大型网站开发教程wordpress怎么做
  • 泊头网站制作案例个人网站不能备案
  • 珠海网站建设成功案例网站变宽屏怎么做
  • 淮阴区住房和城乡建设局网站wordpress tag 获取
  • 用百度云做网站商场设计与商品陈列
  • 网站流量怎么算的创意设计网站公司
  • 写作投稿网站2021年电商平台排行榜
  • 分类信息网站建设郑州百度快照优化排名
  • 做网站与不做网站的区别腾讯云做淘客网站
  • 搜索引擎网站制作青岛网站建设费用
  • 设一个网站需要多少钱上海搬家公司价目表
  • 南通网站推广优化公司单页销售网站源码
  • 网站开发工程师面试问哪些问题平面设计工作室网站
  • js素材网站石家庄网络科技有限公司