Skip to content

Commit

Permalink
上传https图片到七牛的bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
meiweiyuxian committed Dec 14, 2019
1 parent c6e0a33 commit 0606266
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 30 deletions.
50 changes: 28 additions & 22 deletions src/renderer/components/Goods/GoodsAddPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -421,27 +421,29 @@
this.$refs.upload.submit();
},
delePicList() {
let id = this.infoForm.id;
this.$confirm('确定删除首图?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.axios.post('goods/deleteListPicUrl', {id: id}).then((response) => {
if (response.data.errno === 0) {
this.$message({
type: 'success',
message: '删除成功'
});
this.infoForm.list_pic_url = '';
} else {
this.$message({
type: 'error',
message: '删除失败'
})
}
});
});
// 不删除服务器上的图片,上传新的自动替换旧的
this.infoForm.list_pic_url = '';
// let id = this.infoForm.id;
// this.$confirm('确定删除首图?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// this.axios.post('goods/deleteListPicUrl', {id: id}).then((response) => {
// if (response.data.errno === 0) {
// this.$message({
// type: 'success',
// message: '删除成功'
// });
// this.infoForm.list_pic_url = '';
// } else {
// this.$message({
// type: 'error',
// message: '删除失败'
// })
// }
// });
// });
},
// handleRemove(file, fileList) {
// console.log(file, fileList);
Expand Down Expand Up @@ -611,8 +613,12 @@
},
handleUploadListSuccess(res) {
let url = this.url;
console.log(url + res.key);
this.infoForm.list_pic_url = url + res.key;
this.axios.post('goods/uploadHttpsImage', {url:this.infoForm.list_pic_url}).then((response) => {
let lastUrl = response.data.data;
console.log(lastUrl);
this.infoForm.https_pic_url = lastUrl;
})
},
handleUploadIndexPicSuccess(res) {
let url = this.url;
Expand Down
9 changes: 1 addition & 8 deletions src/renderer/router/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
scrollBehavior: () => ({y: 0}),
routes: [
// {
// path: '/',
// name: 'dashboard',
// redirect: '/dashboard'
// },
{
path: '/dashboard',
name: 'dashboard',
Expand Down Expand Up @@ -183,7 +176,7 @@ export default new Router({
},
{
path: '*',
redirect: '/dashboard/welcome'
redirect: '/dashboard'
}
]
})

0 comments on commit 0606266

Please sign in to comment.