针对上传文件进行处理
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
<div>
|
||||
<ai-list class="list">
|
||||
<ai-title
|
||||
slot="title"
|
||||
title="速卖通采集"
|
||||
tips="请先在当前浏览器登录“拼多多跨境卖家中心”,期间保持登录状态"
|
||||
isShowBottomBorder>
|
||||
slot="title"
|
||||
title="速卖通采集"
|
||||
tips="请先在当前浏览器登录“拼多多跨境卖家中心”,期间保持登录状态"
|
||||
isShowBottomBorder>
|
||||
</ai-title>
|
||||
<template slot="content">
|
||||
<div class="content">
|
||||
@@ -15,10 +15,10 @@
|
||||
<label style="width:80px">店铺:</label>
|
||||
<el-select v-model="search.mallId" :clearable="true" @change="search.current =1, getList()" placeholder="请选择店铺" size="small">
|
||||
<el-option
|
||||
v-for="item in $store.state.mallList"
|
||||
:key="item.mallId"
|
||||
:label="item.mallName"
|
||||
:value="item.mallId">
|
||||
v-for="item in $store.state.mallList"
|
||||
:key="item.mallId"
|
||||
:label="item.mallName"
|
||||
:value="item.mallId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
@@ -33,12 +33,12 @@
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
style="margin-top: 8px;"
|
||||
:current.sync="search.current" :size.sync="search.size"
|
||||
@getList="getList">
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
style="margin-top: 8px;"
|
||||
:current.sync="search.current" :size.sync="search.size"
|
||||
@getList="getList">
|
||||
<el-table-column slot="url" label="商品地址" align="left">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.url.startsWith('http')"><a class="el-link el-link--primary" :href="scope.row.url" target="_blank">{{ scope.row.url }}</a></div>
|
||||
@@ -56,12 +56,12 @@
|
||||
</ai-list>
|
||||
|
||||
<ai-dialog
|
||||
title="采集"
|
||||
:visible.sync="copyFromDlgShow"
|
||||
:close-on-click-modal="false"
|
||||
width="790px"
|
||||
customFooter
|
||||
@close="handleClose">
|
||||
title="采集"
|
||||
:visible.sync="copyFromDlgShow"
|
||||
:close-on-click-modal="false"
|
||||
width="790px"
|
||||
customFooter
|
||||
@close="handleClose">
|
||||
<ai-copy-from-ali-express v-if="copyFromDlgShow" @onClose="handleClose" @onSuccess="handleSuccess"></ai-copy-from-ali-express>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
@@ -70,42 +70,43 @@
|
||||
<script>
|
||||
import AiCopyFromAliExpress from "@/components/AiCopyFromAliExpress.vue";
|
||||
import {sendChromeAPIMessage} from '@/api/chromeApi'
|
||||
import { getImageMd5 } from "@/utils/image.js"
|
||||
export default {
|
||||
name: 'NiubiCopy',
|
||||
components: {AiCopyFromAliExpress},
|
||||
import {getImageMd5} from "@/utils/image.js"
|
||||
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
type: '2',
|
||||
mallId: ''
|
||||
},
|
||||
|
||||
colConfigs: [
|
||||
{ slot: 'url', label: '商品地址', align: 'left' },
|
||||
{ slot: 'type', label: '来源', width: '100px', align: 'left'},
|
||||
{ prop: 'mallName', label: '店铺名称', width: '200px', align: 'left'},
|
||||
{ prop: 'createTime', label: '复制时间', width: '180px'}
|
||||
],
|
||||
tableData: [],
|
||||
total: 0,
|
||||
copyFromDlgShow: false,
|
||||
}
|
||||
},
|
||||
export default {
|
||||
name: 'NiubiCopy',
|
||||
components: {AiCopyFromAliExpress},
|
||||
|
||||
created () {
|
||||
this.getList()
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
type: '2',
|
||||
mallId: ''
|
||||
},
|
||||
|
||||
methods: {
|
||||
async getList () {
|
||||
let res2 = await getImageMd5('http://temu.jjcp52.com/dist/test.png')
|
||||
console.log(res2)
|
||||
|
||||
let res3 = await sendChromeAPIMessage({
|
||||
colConfigs: [
|
||||
{slot: 'url', label: '商品地址', align: 'left'},
|
||||
{slot: 'type', label: '来源', width: '100px', align: 'left'},
|
||||
{prop: 'mallName', label: '店铺名称', width: '200px', align: 'left'},
|
||||
{prop: 'createTime', label: '复制时间', width: '180px'}
|
||||
],
|
||||
tableData: [],
|
||||
total: 0,
|
||||
copyFromDlgShow: false,
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
async getList() {
|
||||
const image = 'http://temu.jjcp52.com/dist/test.png'
|
||||
let res2 = await getImageMd5(image), res4
|
||||
Promise.all([
|
||||
sendChromeAPIMessage({
|
||||
url: 'marvel-mms/cn/api/kiana/gmp/bg/phoenix/api/material/create',
|
||||
needMallId: true,
|
||||
mallId: '634418212443160',
|
||||
@@ -115,53 +116,49 @@ import { getImageMd5 } from "@/utils/image.js"
|
||||
{
|
||||
materialType: 1,
|
||||
materialMd5: res2.md5,
|
||||
materialName: "test.png"
|
||||
materialName: "test"
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
let res4 = await sendChromeAPIMessage({
|
||||
}),
|
||||
sendChromeAPIMessage({
|
||||
url: 'galerie/business/get_signature?sdk_version=js-0.0.16-alpha.0&tag_name=product-material-tag',
|
||||
needMallId: true,
|
||||
mallId: '634418212443160',
|
||||
data: {
|
||||
bucket_tag: "product-material-tag"
|
||||
}
|
||||
})
|
||||
|
||||
let res5 = await sendChromeAPIMessage({
|
||||
url: 'https://kuajing-file.pinduoduo.com/api/galerie/v3/store_image?sdk_version=js-0.0.16-alpha.0&tag_name=product-material-tag',
|
||||
isFormData: true,
|
||||
data: {
|
||||
url_width_height: true,
|
||||
image: new Uint8Array(res2.imageData),
|
||||
upload_sign: res4.result.signature
|
||||
}
|
||||
})
|
||||
console.log(res5)
|
||||
|
||||
this.$http.post('/api/copyProduct/myPage',null,{
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
beforeCopy() {
|
||||
this.copyFromDlgShow = true
|
||||
},
|
||||
handleClose() {
|
||||
this.copyFromDlgShow = false
|
||||
},
|
||||
// 添加模板成功
|
||||
handleSuccess() {
|
||||
this.copyFromDlgShow = false
|
||||
this.getList()
|
||||
}
|
||||
}).then(res => res4 = res)
|
||||
]).then(() => sendChromeAPIMessage({
|
||||
url: 'https://kuajing-file.pinduoduo.com/api/galerie/v3/store_image?sdk_version=js-0.0.16-alpha.0&tag_name=product-material-tag',
|
||||
isFormData: true,
|
||||
data: {
|
||||
url_width_height: true,
|
||||
image,
|
||||
upload_sign: res4.result.signature
|
||||
}
|
||||
})).then(() => this.$http.post('/api/copyProduct/myPage', null, {
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
})).then(res => {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
beforeCopy() {
|
||||
this.copyFromDlgShow = true
|
||||
},
|
||||
handleClose() {
|
||||
this.copyFromDlgShow = false
|
||||
},
|
||||
// 添加模板成功
|
||||
handleSuccess() {
|
||||
this.copyFromDlgShow = false
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user