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

怎么在手机上做企业网站网站开发需要的技术

怎么在手机上做企业网站,网站开发需要的技术,装饰公司接单技巧,网站公司建设个服务号多少钱流程: 目录 1.文件服务器Minio的安装 1.1 下载Minio安装后,新建1个data文件夹。并在该安装目录cmd 敲命令。注意不要进错目录。依次输入 1.2 登录Minio网页端 1.3 先建1个桶(buckets),点击create a bucket 2. Spr…

流程:

目录

1.文件服务器Minio的安装

1.1 下载Minio安装后,新建1个data文件夹。并在该安装目录cmd 敲命令。注意不要进错目录。依次输入

1.2 登录Minio网页端

1.3 先建1个桶(buckets),点击create a bucket

2. Springboot整合Minio

2.1 首先导入依赖。

2.2 yml文件配置

2.3 创建 MinioProp 类

2.4 创建Minio客户端(配置类)

2.5 创建上传文件的工具类 MinioUtils

2.6 上传图片的controller

2.7 如有网关,可以加白名单

3. 前端代码

3.1 图片上传 action 里调 图片上传controller 接口 

3.2 data 区域 

3.3 methods区域

3.4 style 区域

其他问题:

1.如果你显示这个,说明你没有把Minio的权限设置为公开。

 2.网关拦截,可以开白名单。


1.文件服务器Minio的安装

1.1 下载Minio安装后,新建1个data文件夹。并在该安装目录cmd 敲命令。注意不要进错目录。依次输入

set MINIO_ACCESS_KEY=minioadmin
set MINIO_SECRET_KEY=minioadmin

minio.exe server D:\003vue\minio\data --console-address ":9001" --address ":9000"

 看到这个界面,就说明minio安全完毕。

1.2 登录Minio网页端

打开http://127.0.0.1:9001/browser,初次可能需要登陆,账号密码均输入minioadmin 即可。

1.3 先建1个桶(buckets),点击create a bucket

取名 后点击create,Access policy权限改为public

2. Springboot整合Minio

我们用的是Springboot框架 ,SpringBoot框架已经整合 minio,所以使用起来还是很方便的。

2.1 首先导入依赖。

 <dependency><groupId>com.squareup.okhttp3</groupId><artifactId>okhttp</artifactId><version>4.8.1</version> <!-- minio 依赖于 okhttp 且版本较高。注意,spring-boot-dependencies 中的不够高 -->
</dependency><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>3.0.5</version></dependency>
<dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.3.9</version>
</dependency>

2.2 yml文件配置

spring:application:name: xxxxservlet:multipart:max-file-size: 200MB  #设置单个文件的大小  因为springboot内置tomact的的文件传输默认为10MBmax-request-size: 500MB   #设置单次请求的文件总大小enabled: true    #千万注意要设置该参数,否则不生效
minio:endpoint: http://127.0.0.1:9000accesskey: minioadminsecretKey: minioadmin

2.3 创建 MinioProp 类

@Data
@Component
@ConfigurationProperties(prefix = "minio") //批量读取配置文件中的属性值,前缀为minio
public class MinioProp {
//        @Value()//一个一个读配置文件中的属性值private String endpoint;private String accesskey;private String secretKey;}

2.4 创建Minio客户端(配置类)

package com.config;import com.entity.MinioProp;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
@EnableConfigurationProperties(MinioProp.class)
public class MinioConfig {@Autowiredprivate MinioProp minioProp;@Beanpublic MinioClient minioClient() throws Exception {return MinioClient.builder().endpoint(minioProp.getEndpoint()).credentials(minioProp.getAccesskey(), minioProp.getSecretKey()).build();}
}

2.5 创建上传文件的工具类 MinioUtils


import com.alibaba.fastjson.JSONObject;
import com.entity.MinioProp;
import io.minio.BucketExistsArgs;
import io.minio.MakeBucketArgs;
import io.minio.MinioClient;
import io.minio.PutObjectArgs;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;import java.io.InputStream;@Slf4j
@Component
public class MinioUtils {@Autowiredprivate MinioClient client;@Autowiredprivate MinioProp minioProp;/*** 创建bucket*/public void createBucket(String bucketName) {BucketExistsArgs bucketExistsArgs = BucketExistsArgs.builder().bucket(bucketName).build();MakeBucketArgs makeBucketArgs = MakeBucketArgs.builder().bucket(bucketName).build();try {if (client.bucketExists(bucketExistsArgs))return;client.makeBucket(makeBucketArgs);} catch (Exception e) {log.error("创建桶失败:{}", e.getMessage());throw new RuntimeException(e);}}/*** @param file       文件* @param bucketName 存储桶* @return*/public JSONObject uploadFile(MultipartFile file, String bucketName) throws Exception {JSONObject res = new JSONObject();res.put("code", 0);// 判断上传文件是否为空if (null == file || 0 == file.getSize()) {res.put("msg", "上传文件不能为空");return res;}// 判断存储桶是否存在createBucket(bucketName);// 文件名String originalFilename = file.getOriginalFilename();// 新的文件名 = 存储桶名称_时间戳.后缀名String fileName = bucketName + "_" + System.currentTimeMillis() + originalFilename.substring(originalFilename.lastIndexOf("."));// 开始上传InputStream inputStream = file.getInputStream();PutObjectArgs args = PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(inputStream,inputStream.available(),-1).build();client.putObject(args);res.put("code", 1);//getEndpoint前缀 + bucketName 桶名称 + fileName文件名称res.put("msg", minioProp.getEndpoint() + "/" + bucketName + "/" + fileName);return res;}
}

2.6 上传图片的controller

图片上传到服务器成功后,会返回一个图片链接url用于回显。

@RestController
@Slf4j
public class UploadController {@AutowiredMinioUtils minioUtils;@RequestMapping("/uploadImages")public ResData<?> uploadImages(MultipartFile file){log.info("触发上传图片controller");JSONObject images=null;try {images = minioUtils.uploadFile(file, "images"); //这里记得填你自己的bucket容器} catch (Exception e) {e.printStackTrace();}return ResData.ok(images);}
}

2.7 如有网关,可以加白名单

3. 前端代码

3.1 图片上传 action 里调 图片上传controller 接口 

<el-descriptions-item :span="2"><template slot="label"> 头像 </template><el-uploadclass="avatar-uploader"action="/api/pc-zdy-sys/uploadImages":show-file-list="false":on-success="handleSuccess":on-error="handleError":before-upload="beforeUpload"><div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过10MB</div><imgv-if="imageUrl":src="imageUrl"alt="已上传的图片"class="avatar" /> ##src 用于回显图片<i v-else class="el-icon-plus avatar-uploader-icon"></i> </el-upload>
</el-descriptions-item>

3.2 data 区域 

 imageUrl:'' //回显图片链接

3.3 methods区域

//图片上传成功后执行的方法,拿到图片链接
handleAvatarSuccess(res, file) {console.log(res.data)this.imageUrl = res.data.msg //后端返回的图片链接赋值给imageUrl
},//修改信息前的回显 这个根据你自己的方法来,主要是给this.imageUrl赋值
edit(userId) {//先打开弹窗setTimeout(() => {this.dialogEdit = true;}, 500);this.itemId = userId;//然后根据id 找人this.$axios.get("/api/pc-zdy-sys/admin/" + userId).then((res) => {if (res.data.code == 200) {this.UserEdit = res.data.data.userVO;this.allRoleList = res.data.data.allRoleList; //系统里所有的角色this.checkedRoleList1 = this.UserEdit.roleList; //我们选中这个人的所有角色this.imageUrl = this.UserEdit.url; //头像url回显赋值this.checkedRoleList = this.checkedRoleList1.map((e) => {//过滤角色集合,只留下其中的id,方便后续勾选return e.id;});}});},

3.4 style 区域

<style scoped>
.avatar-uploader .el-upload {border: 1px dashed #d9d9d9;border-radius: 6px;cursor: pointer;position: relative;overflow: hidden;
}
.avatar-uploader .el-upload:hover {border-color: #409eff;
}
.avatar-uploader-icon {font-size: 28px;color: #8c939d;width: 178px;height: 178px;line-height: 178px;text-align: center;
}
.avatar {width: 178px;height: 178px;display: block;
}
</style>

其他问题:

1.如果你显示这个,说明你没有把Minio的权限设置为公开。

 2.网关拦截,可以开白名单。


文章转载自:
http://deification.bbrf.cn
http://fleece.bbrf.cn
http://perfusion.bbrf.cn
http://stovemaker.bbrf.cn
http://stalemate.bbrf.cn
http://vaal.bbrf.cn
http://litharge.bbrf.cn
http://comb.bbrf.cn
http://rawness.bbrf.cn
http://infinitely.bbrf.cn
http://dissocial.bbrf.cn
http://knighthood.bbrf.cn
http://quaigh.bbrf.cn
http://barnard.bbrf.cn
http://experienceless.bbrf.cn
http://headless.bbrf.cn
http://ovir.bbrf.cn
http://typo.bbrf.cn
http://fyn.bbrf.cn
http://sibu.bbrf.cn
http://southeastward.bbrf.cn
http://painty.bbrf.cn
http://ketohexose.bbrf.cn
http://leukemogenic.bbrf.cn
http://ballerina.bbrf.cn
http://hoariness.bbrf.cn
http://oni.bbrf.cn
http://dudeen.bbrf.cn
http://confabulator.bbrf.cn
http://standfast.bbrf.cn
http://yah.bbrf.cn
http://stelliform.bbrf.cn
http://spoilsman.bbrf.cn
http://vegetate.bbrf.cn
http://laminaria.bbrf.cn
http://chelifer.bbrf.cn
http://nitrifier.bbrf.cn
http://evolute.bbrf.cn
http://dithyramb.bbrf.cn
http://bedaub.bbrf.cn
http://coulee.bbrf.cn
http://tarry.bbrf.cn
http://exopoditic.bbrf.cn
http://autolysate.bbrf.cn
http://boardwalk.bbrf.cn
http://cystoscopic.bbrf.cn
http://stearin.bbrf.cn
http://relend.bbrf.cn
http://epaulette.bbrf.cn
http://cavern.bbrf.cn
http://bursiculate.bbrf.cn
http://taphouse.bbrf.cn
http://goanese.bbrf.cn
http://polygene.bbrf.cn
http://decay.bbrf.cn
http://basically.bbrf.cn
http://poleaxe.bbrf.cn
http://revisal.bbrf.cn
http://afterward.bbrf.cn
http://skelecton.bbrf.cn
http://counterviolence.bbrf.cn
http://antinuclear.bbrf.cn
http://mismarriage.bbrf.cn
http://creepered.bbrf.cn
http://what.bbrf.cn
http://sour.bbrf.cn
http://goalpost.bbrf.cn
http://loggerhead.bbrf.cn
http://spiciness.bbrf.cn
http://hornswoggle.bbrf.cn
http://iminourea.bbrf.cn
http://tennessee.bbrf.cn
http://legendry.bbrf.cn
http://trapt.bbrf.cn
http://bossism.bbrf.cn
http://trucial.bbrf.cn
http://pronumeral.bbrf.cn
http://agada.bbrf.cn
http://farming.bbrf.cn
http://reenlist.bbrf.cn
http://circumscription.bbrf.cn
http://typhoean.bbrf.cn
http://favor.bbrf.cn
http://escarpment.bbrf.cn
http://polluting.bbrf.cn
http://initialize.bbrf.cn
http://pantskirt.bbrf.cn
http://encyclical.bbrf.cn
http://vp.bbrf.cn
http://heterophobia.bbrf.cn
http://periostea.bbrf.cn
http://ovulate.bbrf.cn
http://intake.bbrf.cn
http://annunciate.bbrf.cn
http://stunner.bbrf.cn
http://lively.bbrf.cn
http://stereography.bbrf.cn
http://sciurine.bbrf.cn
http://dioptrics.bbrf.cn
http://palaeoanthropic.bbrf.cn
http://www.15wanjia.com/news/63230.html

相关文章:

  • 网站类型怎么分搭建网站要多少钱
  • 专门做微场景的网站东莞网站公司哪家好
  • 阿里巴巴怎样做网站百度广告优化师
  • 适合企业网站的cmsseo网站推广与优化方案
  • 广州制作网站哪家专业百度推广怎么做效果好
  • 济南网站建设哪家强竞价排名软件
  • 华强北 做网站推广赚钱
  • 云和建设局网站如何推广微信公众号
  • 网站建设方案书 备案2022年五月份热点事件
  • 做网站用php还是jsp网上营销是做什么的
  • 网站建设费用清单营销平台是什么意思
  • 福州网站设计大概费用seo收录排名
  • 网站怎么做返回主页按钮网站推广的方式有哪些
  • 免费dw网页模板系统优化软件推荐
  • 深圳住房与建设部网站2023年4 5月份疫情结束吗
  • windows wordpress可以aso优化服务平台
  • 移动端响应式网站怎么做网络渠道有哪些
  • 8848网站盈利模式旅游营销推广方案
  • 编程 网站建设网络推广公司经营范围
  • 免费体验服务器个人如何优化网站有哪些方法
  • 青岛高级网站建设价格2023免费网站推广大全
  • 帝国cms网站关键词出价计算公式
  • 网站设计客户案例关键词排名优化品牌
  • 武汉便宜的网站建设专业的seo排名优化
  • 预付做网站定金如何收录批量查询
  • 承德专业做网站免费行情软件网站下载大全
  • 网站服务器提供什么服务好看的网站设计
  • 为什么网站很少做全屏c盘优化大师
  • 重庆实惠网站建设百度网盘客服电话
  • 佛山网络公司哪家便宜适合seo的建站系统