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

方山建站报价深圳做分销网站

方山建站报价,深圳做分销网站,怎样制作网站电话,网页设计公司简介范文创建图文投票实现 图文投票和文字投票基本一样&#xff0c;就是在投票选项里面&#xff0c;多了一个选项图片&#xff1b;、 <view class"option_item" v-for"(item,index) in options" :key"item.id"><view class"option_input&…
创建图文投票实现

图文投票和文字投票基本一样,就是在投票选项里面,多了一个选项图片;、

在这里插入图片描述

<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.15wanjia.com/news/182652.html

相关文章:

  • 事业单位备案网站网页特效大全
  • 营销网站开发哪家强cad制图培训
  • 哪里有好网站设计wordpress前台显示作者角色
  • 建站方案书备案科技网络有限公司
  • 商业网站建设预估收益wordpress延时加载插件
  • 莲湖免费做网站官方网站建设 省心磐石网络
  • 怎么让网站排名下降wordpress 灯箱
  • 网站的申请做电影网站需要注意什么东西
  • 网站的访问量统计怎么做产品展示型网站有哪些
  • 上饶网站建设兼职网上哪个网站教做西点
  • 做pvc卡片的交流网站互联网家装平台有哪些
  • 网站优化包括整站优化吗一个网站需要多长时间
  • 做电影网站配什么公众号免费特效模板下载
  • 西安网站建设制作需要哪些费用贾汪网架公司
  • 如何通过建设一个网站赚钱什么平台可以推广
  • 地方文明网站建设方案网络平台图片
  • 网站开发培训什么网站基本要素
  • 做建筑的网站sns电商网站
  • 网站cms识别市场部网页设计西安
  • 免费建造网站系统网站调用数据库
  • seo网站建设价格外包公司是做什么的
  • 上海专业的网站建设公司wordpress底部加友链
  • 金华网站定制公司网站的层次
  • 哪些网站开发手机研发流程
  • 做阿里巴巴网站可以贷款吗wordpress安装不
  • 青岛建站通网站建设网站排名
  • 建网站可以赚钱吗网页设计与制作教程西北工业大学
  • 专业网站建设哪里找有哪些做策划的用的网站
  • 帝国建站模板网站建设分什么行业
  • 网站安全的必要性做网站需要些什么