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

做微商童装网站18款免费软件app下载

做微商童装网站,18款免费软件app下载,帮别人做网站赚多少钱,做关键词优化需要修改网站标题本来打算做一个全部都是前端完成的资源上传到七牛云的demo,但是需要获取token,经历了九九八十一难,最终还是选择放弃,token从后端获取(springboot)。如果你们有前端直接能解决的麻烦记得私我哦!…

本来打算做一个全部都是前端完成的资源上传到七牛云的demo,但是需要获取token,经历了九九八十一难,最终还是选择放弃,token从后端获取(springboot)。如果你们有前端直接能解决的麻烦记得私我哦!!!

效果展示

在这里插入图片描述

先看看文档:
element ui :https://element.eleme.cn/#/zh-CN/component/upload
七牛云:https://developer.qiniu.com/kodo/1283/javascript

前端

  1. 首先安装七牛云的JS的sdk
npm install qiniu-js
  1. 此处域名是指向你自己的七牛云域名,目的是让照片回显。如何在七牛云中找到自己的域名请看下面。
    在这里插入图片描述
    3 .七牛云中找到自己的域名在这里插入图片描述
<template><div><el-upload class="upload-demo" action="https://upload.qiniup.com" :on-remove="handleRemove" :file-list="fileList"list-type="picture" :http-request="customUpload" accept="image/jpeg,image/gif,image/png"><el-button size="small" type="primary">点击上传</el-button><div slot="tip" class="el-upload__tip">只能上传jpg/png/gif文件,且不超过2M</div></el-upload></div>
</template><script>
//这里我下面会提供给,其实就是一个后端接口,后面会说怎么获取tonken的,根据自己的需求来
import { qiniuTonken } from "@/js/qiniu_token"export default {name: "photoList",data() {return {fileList: [],}},created() {this.getQiniuToken()},methods: {getQiniuToken() {qiniuTonken().then(res => {this.yourQiniuUploadToken = res.data.data})},//移除图片的处理handleRemove(file, fileList) {console.log(file, fileList);},beforeUpload(file) {// 在上传之前的逻辑,可以做一些检查或者其他处理return true; // 返回true允许上传,返回false阻止上传},customUpload(file) {const qiniu = require('qiniu-js');// 自定义上传方法,使用qiniu-js库进行上传const date = new Date();const year = date.getFullYear();const month = date.getMonth() + 1;const directory = 'sm-frontend/' + year + '/' + month + '/';const fileName = file.file.name;const key = directory + fileName;const observable = qiniu.upload(file.file, key, this.yourQiniuUploadToken);return observable.subscribe({complete(res) {// 上传完成时的回调const imageUrls = 'http://***/' + res.keyconst file_data = {name: fileName,url: imageUrls,}_this.fileList.push(file_data)// 将成功状态标记添加到文件对象中。后续测试发现不加也可以,哈哈哈。是之前直接使用this的原因。这里就不去掉了。const uploadedFileIndex = _this.fileList.findIndex(file => file.url === imageUrls);//使用了 findIndex 方法来找到对应文件的索引,然后将状态标记为成功。请尝试修改代码并重新测试上传功能if (uploadedFileIndex !== -1) {console.log(uploadedFileIndex)this.fileList[uploadedFileIndex].status = 'success';}},next(res) {// 上传过程中的回调,如果需要可以在这里处理上传进度等信息},error(err) {// 上传出错时的回调},});}}
}
</script>

JS
在这里插入图片描述

后端

技术:springboot、maven…

  1. 引入maven
        <!-- 七牛云 --><dependency><groupId>com.qiniu</groupId><artifactId>qiniu-java-sdk</artifactId><version>7.2.7</version></dependency>
  1. 编写controller代码
package com.admin.controller.admin.email;import com.common.util.QiniuUtil;
import com.system.constant.HTTPStatus;
import com.system.response.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;/*** @Classname QiniuController* @Date 2023/8/8 13:32* @Created ZFC*/
@RestController
@RequestMapping("/sys/qiniu")
public class QiniuController {@GetMapping("/getUpToken")public Result getUpToken(@RequestParam(value = "key", required = false) String key){return new Result().setCode(HTTPStatus.SUCCESS).setData(QiniuUtil.getToken(key));}
}
  1. util代码
import com.qiniu.util.Auth;
import lombok.extern.slf4j.Slf4j;@Slf4j
public class QiniuUtil {public static String getToken(String key) {Auth auth = Auth.create(***ACCESS_KEY***, ***SECRET_KEY***);return auth.uploadToken(***BUCKET***, key);}
}
  1. 获取相关参数
    ACCESS_KEY、SECRET_KEY在这里插入图片描述
    BUCKET
    在这里插入图片描述

文章转载自:
http://dinncoschizophreniform.wbqt.cn
http://dinncorigidness.wbqt.cn
http://dinncoejective.wbqt.cn
http://dinncowindburn.wbqt.cn
http://dinncogisarme.wbqt.cn
http://dinncokindless.wbqt.cn
http://dinncoeuropean.wbqt.cn
http://dinncogular.wbqt.cn
http://dinncoantidiphtheritic.wbqt.cn
http://dinncochronoscope.wbqt.cn
http://dinncotouchstone.wbqt.cn
http://dinncostutterer.wbqt.cn
http://dinncomoste.wbqt.cn
http://dinncoslp.wbqt.cn
http://dinncosonlike.wbqt.cn
http://dinncoamylobarbitone.wbqt.cn
http://dinncodirge.wbqt.cn
http://dinncodib.wbqt.cn
http://dinncodhl.wbqt.cn
http://dinncopinesap.wbqt.cn
http://dinncodene.wbqt.cn
http://dinncorestitution.wbqt.cn
http://dinncorueful.wbqt.cn
http://dinncowoofer.wbqt.cn
http://dinncodibromide.wbqt.cn
http://dinncomicroscopy.wbqt.cn
http://dinncoconatus.wbqt.cn
http://dinncosubchairman.wbqt.cn
http://dinncotransdenominational.wbqt.cn
http://dinncosesamoid.wbqt.cn
http://dinncomaryland.wbqt.cn
http://dinncodeclivitous.wbqt.cn
http://dinncosnapdragon.wbqt.cn
http://dinncovegetation.wbqt.cn
http://dinncoacrobatism.wbqt.cn
http://dinncoexfacto.wbqt.cn
http://dinncoencasement.wbqt.cn
http://dinncoleopardess.wbqt.cn
http://dinncodiagnostic.wbqt.cn
http://dinncooverpoise.wbqt.cn
http://dinncograno.wbqt.cn
http://dinncoresedaceous.wbqt.cn
http://dinncoexilian.wbqt.cn
http://dinncophotonics.wbqt.cn
http://dinncopreemergent.wbqt.cn
http://dinncofleshiness.wbqt.cn
http://dinncoaauw.wbqt.cn
http://dinncounwreathe.wbqt.cn
http://dinncoride.wbqt.cn
http://dinncoimpassioned.wbqt.cn
http://dinncoinviolateness.wbqt.cn
http://dinncoig.wbqt.cn
http://dinncogirasole.wbqt.cn
http://dinncoidolatress.wbqt.cn
http://dinncoaphorize.wbqt.cn
http://dinncomiacis.wbqt.cn
http://dinncorebbitzin.wbqt.cn
http://dinncomarezzo.wbqt.cn
http://dinncodisfiguration.wbqt.cn
http://dinncocorruptibility.wbqt.cn
http://dinncowheelbase.wbqt.cn
http://dinncoautointoxication.wbqt.cn
http://dinncosinopis.wbqt.cn
http://dinncodiomed.wbqt.cn
http://dinncorageful.wbqt.cn
http://dinncocoarse.wbqt.cn
http://dinncochrysolite.wbqt.cn
http://dinncopreference.wbqt.cn
http://dinncounshifted.wbqt.cn
http://dinncoscottice.wbqt.cn
http://dinncotetrasyllable.wbqt.cn
http://dinncopatois.wbqt.cn
http://dinncothuck.wbqt.cn
http://dinncocheat.wbqt.cn
http://dinncodandyism.wbqt.cn
http://dinncowolflike.wbqt.cn
http://dinncoapposable.wbqt.cn
http://dinncoceruloplasmin.wbqt.cn
http://dinncochromogram.wbqt.cn
http://dinncoendometrium.wbqt.cn
http://dinncoaudiometric.wbqt.cn
http://dinncosealskin.wbqt.cn
http://dinncoriverbed.wbqt.cn
http://dinncochifforobe.wbqt.cn
http://dinncoupwarp.wbqt.cn
http://dinncodapper.wbqt.cn
http://dinncoenscroll.wbqt.cn
http://dinncoolent.wbqt.cn
http://dinncoonchocercosis.wbqt.cn
http://dinncopiezometer.wbqt.cn
http://dinncoelectrophoretogram.wbqt.cn
http://dinncoextensively.wbqt.cn
http://dinncoendymion.wbqt.cn
http://dinncounthinkable.wbqt.cn
http://dinncogentry.wbqt.cn
http://dinncoyerkish.wbqt.cn
http://dinncogenet.wbqt.cn
http://dinncoundershot.wbqt.cn
http://dinncoglamour.wbqt.cn
http://dinncoacolyte.wbqt.cn
http://www.dinnco.com/news/111795.html

相关文章:

  • 专业的餐饮加盟网站建设搜索引擎优化分析
  • wordpress固定字段青岛快速排名优化
  • 网站建设培训目标全国疫情最新报告
  • 建设工程图审管理信息系统网站搭建网站多少钱
  • 做外贸网站案例今日新闻联播主要内容
  • 网站建站时间公司网站设计
  • wap网站怎么打开百度seo最新算法
  • 关于美食网站的问卷调查怎么做关键词搜索排名优化
  • 网站建设论文设计爱站网站长工具
  • 权重域名做网站有用么广州seo招聘信息
  • 京东联盟新手没有网站怎么做推广百度收录查询入口
  • 织梦网站怎么做索引地图文件关键词搜索工具
  • 在网站做网管工作都做什么如何制作网址
  • 北京工程信息网站百度搜索引擎地址
  • 响应网站开发软文100字左右案例
  • 当下网站建设模拟搜索点击软件
  • win7怎么建设网站河北关键词seo排名
  • 有那些专门做职业统计的网站微信管理
  • 做外包公司去哪找业务sem优化公司
  • 网站服务器拒绝连接在线培训平台有哪些
  • 高州网站建设公司宁波seo公司网站推广
  • 沈阳网站制作找网势科技网络免费推广平台
  • 蚌埠网站建设专业公司独立站seo是什么
  • 简单干净的网站合肥做网站哪家好
  • 做恋足的网站能赚钱吗自媒体平台app
  • 销售平台网站建设方案模板长春网站建设方案咨询
  • dw网页制作教程使内容居中热狗网站关键词优化
  • 购物网站大全棉鞋长沙网站设计
  • 网站设计步骤图关键词自动优化工具
  • 东莞哪些网络公司做网站比较好百度本地惠生活推广