Commit dcdbe7f8 authored by 张锡奇's avatar 张锡奇

upload

parent 3e2b076a
...@@ -16,6 +16,12 @@ module.exports = { ...@@ -16,6 +16,12 @@ module.exports = {
pathRewrite: { '^/api': '' }, pathRewrite: { '^/api': '' },
changeOrigin: true, changeOrigin: true,
secure: false secure: false
},
'/webService': {
target: 'http://47.96.168.158:4080',
pathRewrite: { '^/webService': '' },
changeOrigin: true,
secure: false
} }
}, },
......
...@@ -86,7 +86,8 @@ ...@@ -86,7 +86,8 @@
"webpack": "^3.6.0", "webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0", "webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1", "webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0" "webpack-merge": "^4.1.0",
"xmldom": "^0.3.0"
}, },
"engines": { "engines": {
"node": ">= 6.0.0", "node": ">= 6.0.0",
......
...@@ -376,7 +376,22 @@ let tipRoutes = [ ...@@ -376,7 +376,22 @@ let tipRoutes = [
} }
}, },
] ]
} },
{ //图片上传
name:"main",
component:()=>import("@/view/main.vue"),
path:"/main",
children:[
{
path:"/tiip/uploadImg",
name:"IntReportForms",
component:()=>import("@/view/tiip/uploadImg/index.vue"),
meta:{
title:"图片上传"
},
}
]
},
]; ];
let shopVersionRoutes = [ let shopVersionRoutes = [
......
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
<div class="header"> <div class="header">
<searchComponent placeholder="请输入订单号/合同号/供应商/客户..." :search="search" :typeList="typeList" :status="status"/> <searchComponent placeholder="请输入订单号/合同号/供应商/客户..." :search="search" :typeList="typeList" :status="status"/>
</div> </div>
<button id="scanQRCode" >ddddddd</button>
<div class="Table"> <div class="Table">
<customerTable :columns="columns" :list="list" :tableStyle="tableStyle"></customerTable> <customerTable :columns="columns" :list="list" :tableStyle="tableStyle"></customerTable>
</div> </div>
...@@ -248,7 +245,7 @@ export default { ...@@ -248,7 +245,7 @@ export default {
}else if(key == 'dEndDate'){ }else if(key == 'dEndDate'){
postData.push({key:key,value:value + ' 23:59:59' || ''}) postData.push({key:key,value:value + ' 23:59:59' || ''})
}else if(key == 'searchvalue'){ }else if(key == 'searchvalue'){
postData.push({key:'searchvalue',value:value}) postData.push({key:'searchname',value:value})
} }
} }
let res = await this.request('getTipProcessProgress',{ let res = await this.request('getTipProcessProgress',{
......
...@@ -213,7 +213,7 @@ export default { ...@@ -213,7 +213,7 @@ export default {
}, },
methods:{ methods:{
async getDetail(){ async getDetail(){
let res = await this.apiGet(`${this.host}${this.userId}/fabricorder/dtl/`,{ let res = await this.apiGet(`${this.$url('default')}/fabricorder/dtl/`,{
uGUID:this.hdr.uGUID uGUID:this.hdr.uGUID
},true); },true);
// if(res.length > 0){ // if(res.length > 0){
......
...@@ -250,7 +250,7 @@ export default { ...@@ -250,7 +250,7 @@ export default {
this.$router.push({name:'searchOrderDetail'}) this.$router.push({name:'searchOrderDetail'})
}, },
async getDetail(){ async getDetail(){
let res = await this.apiGet(`${this.host}${this.userId}/fabricorder/dtl/`,{ let res = await this.apiGet(`${this.$url('default')}/fabricorder/dtl/`,{
uGUID:this.hdr.uGUID uGUID:this.hdr.uGUID
},true); },true);
if(res.length > 0){ if(res.length > 0){
...@@ -260,7 +260,7 @@ export default { ...@@ -260,7 +260,7 @@ export default {
} }
}, },
async getOrderallmes(){ async getOrderallmes(){
let res = await this.apiGet(`${this.host}${this.userId}/fabricorder/orderallmes/`,{ let res = await this.apiGet(`${this.$url('default')}/fabricorder/orderallmes/`,{
sOrderNo:this.hdr.sOrderNo sOrderNo:this.hdr.sOrderNo
},true); },true);
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
import Util from '@/libs/util.js' import Util from '@/libs/util.js'
import customerTable from '@/components/Table' import customerTable from '@/components/Table'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import urlFun from '@/libs/host.js'
export default { export default {
name: 'searchOrderDetail', name: 'searchOrderDetail',
data () { data () {
...@@ -104,8 +106,6 @@ export default { ...@@ -104,8 +106,6 @@ export default {
tbodyHeight:'calc(100vh - 110px)', tbodyHeight:'calc(100vh - 110px)',
tbodyTrBorderBottom:'0.5px solid #5cadff' tbodyTrBorderBottom:'0.5px solid #5cadff'
}, },
host:'https://weixin.huansi.net/apiproxy/huansi/service/proxy/',
// host:'http://192.168.4.40:5001',
nAllAmount:0, nAllAmount:0,
} }
}, },
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
}, },
methods:{ methods:{
async getDetail(){ async getDetail(){
let res = await this.apiGet(`${this.host}${this.userId}/fabricorder/dtl/`,{ let res = await this.apiGet(`${urlFun('default')}/fabricorder/dtl/`,{
uGUID:this.hdr.uGUID uGUID:this.hdr.uGUID
},true); },true);
......
...@@ -67,7 +67,7 @@ import Util from '@/libs/util.js' ...@@ -67,7 +67,7 @@ import Util from '@/libs/util.js'
import searchComponent from '@/components/search' import searchComponent from '@/components/search'
import customerTable from '@/components/Table' import customerTable from '@/components/Table'
import customerModal from '@/components/Modal' import customerModal from '@/components/Modal'
import urlFun from '@/libs/host.js'
import { XButton } from 'vux' import { XButton } from 'vux'
export default { export default {
...@@ -128,8 +128,6 @@ export default { ...@@ -128,8 +128,6 @@ export default {
tbodyTrBorderBottom:'1px solid #dbe9f8', tbodyTrBorderBottom:'1px solid #dbe9f8',
width:'100%' width:'100%'
}, },
host:'https://weixin.huansi.net/apiproxy/huansi/service/proxy/',
// host:'http://192.168.4.40:5001',
status:[], status:[],
showModal:false, showModal:false,
row:{}, row:{},
...@@ -175,7 +173,7 @@ export default { ...@@ -175,7 +173,7 @@ export default {
}, },
methods:{ methods:{
async getStatus(){ async getStatus(){
let res = await this.apiGet(`${this.host}${this.$route.params.userId}/fabricorder/status/`,{},true); let res = await this.apiGet(`${urlFun('default')}/fabricorder/status/`,{},true);
this.status = res; this.status = res;
this.status.map(x=>{ this.status.map(x=>{
x.sStatus = x.sStatus || '全部'; x.sStatus = x.sStatus || '全部';
...@@ -201,8 +199,7 @@ export default { ...@@ -201,8 +199,7 @@ export default {
delete data.dBeginDate; delete data.dBeginDate;
delete data.dEndDate; delete data.dEndDate;
let res = await this.apiGet(`${this.host}${this.$route.params.userId}/fabricorder/hdr/`,data,'加载中') let res = await this.apiGet(`${urlFun('default')}/fabricorder/hdr/`,data,'加载中')
// let res = await this.apiGet(`http://weixin.huansi.net/apiproxy/huansi/hszh_HSFabricTradeTest/fabricorder/hdr/`,data,'加载中')
if(res.table.length > 0){ if(res.table.length > 0){
res.table.map(x=>{ res.table.map(x=>{
......
...@@ -122,13 +122,12 @@ ...@@ -122,13 +122,12 @@
import Util from '@/libs/util.js' import Util from '@/libs/util.js'
import customerTable from '@/components/Table' import customerTable from '@/components/Table'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import urlFun from '@/libs/host.js'
export default { export default {
name: 'searchOrderMaterialDetail', name: 'searchOrderMaterialDetail',
data () { data () {
return { return {
host:'https://weixin.huansi.net/apiproxy/huansi/service/proxy/',
// host:'http://192.168.4.40:5001',
list:{}, list:{},
} }
}, },
...@@ -147,7 +146,7 @@ export default { ...@@ -147,7 +146,7 @@ export default {
}, },
methods:{ methods:{
async getMaterial(){ async getMaterial(){
let res = await this.apiGet(`${this.host}${this.userId}/fabricorder/material/`,{ let res = await this.apiGet(`${urlFun('default')}/fabricorder/material/`,{
sSampleMaterialNo:this.dtl.sSampleMaterialNo sSampleMaterialNo:this.dtl.sSampleMaterialNo
},'加载中'); },'加载中');
......
...@@ -157,7 +157,7 @@ import Util from '@/libs/util.js' ...@@ -157,7 +157,7 @@ import Util from '@/libs/util.js'
import customerTable from '@/components/Table' import customerTable from '@/components/Table'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { XButton } from 'vux' import { XButton } from 'vux'
import urlFun from '@/libs/host.js'
export default { export default {
name: 'searchOrderTrack', name: 'searchOrderTrack',
data () { data () {
...@@ -250,7 +250,7 @@ export default { ...@@ -250,7 +250,7 @@ export default {
// this.$router.push({name:'searchOrderDetail'}) // this.$router.push({name:'searchOrderDetail'})
}, },
async getDetail(){ async getDetail(){
let res = await this.apiGet(`${this.host}${this.userId}/fabricorder/dtl/`,{ let res = await this.apiGet(`${urlFun('default')}/fabricorder/dtl/`,{
uGUID:this.hdr.uGUID uGUID:this.hdr.uGUID
},true); },true);
...@@ -261,7 +261,7 @@ export default { ...@@ -261,7 +261,7 @@ export default {
} }
}, },
async getOrderallmes(){ async getOrderallmes(){
let res = await this.apiGet(`${this.host}${this.userId}/fabricorder/orderallmes/`,{ let res = await this.apiGet(`${urlFun('default')}/fabricorder/orderallmes/`,{
sOrderNo:this.hdr.sOrderNo sOrderNo:this.hdr.sOrderNo
},true); },true);
......
...@@ -127,7 +127,7 @@ export default { ...@@ -127,7 +127,7 @@ export default {
this.$set(this.dtl[index],'isErr',true) this.$set(this.dtl[index],'isErr',true)
}, },
async getList(){ async getList(){
this.apiGet(`${this.host}${this.$route.params.userId}/goods/onesample/${this.uGuid}/`,{},true).then(res=>{ this.apiGet(`${this.$url('default')}/goods/onesample/${this.uGuid}/`,{},true).then(res=>{
this.hdr = res.header; this.hdr = res.header;
this.dtl = res.childs; this.dtl = res.childs;
res.childs.map(v=>{ res.childs.map(v=>{
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
this.dtl_src.push({ this.dtl_src.push({
sColorName:v.sColorName, sColorName:v.sColorName,
sColorNo:v.sColorNo, sColorNo:v.sColorNo,
src:`${this.host}${this.$route.params.userId}/goods/image_click/?uGuid=${v.uPictureGuid}&iType=2&random=${Math.random()}` src:`${this.$url('default')}/goods/image_click/?uGuid=${v.uPictureGuid}&iType=2&random=${Math.random()}`
}) })
}) })
}) })
......
...@@ -205,11 +205,11 @@ export default { ...@@ -205,11 +205,11 @@ export default {
} }
}, },
async getList(){ async getList(){
this.apiGet(`${this.host}${this.$route.params.userId}/goods/onesample/${this.uGuid}/`,{},true).then(res=>{ this.apiGet(`${this.$url('default')}/goods/onesample/${this.uGuid}/`,{},true).then(res=>{
this.hdr = res.header; this.hdr = res.header;
this.dtl = res.childs; this.dtl = res.childs;
res.childs.map(v=>{ res.childs.map(v=>{
this.dtl_src.push(`${this.host}${this.$route.params.userId}/goods/image_click/?uGuid=${v.uPictureGuid}&iType=2&random=${Math.random()}`) this.dtl_src.push(`${this.$url('default')}/goods/image_click/?uGuid=${v.uPictureGuid}&iType=2&random=${Math.random()}`)
}) })
}) })
}, },
......
<style lang="less" >
#uploadImg{
background: #ffffff;
height:100%;
display:flex;
justify-content: center;
flex-wrap: wrap;
flex-direction: column;
padding: 20px;
.file {
position: relative;
display: inline-block;
background: #D0EEFF;
border: 2px dashed #99D3F5;
border-radius: 4px;
overflow: hidden;
color: #1E88C7;
text-decoration: none;
text-indent: 0;
height:200px;
line-height: 200px;
text-align: center;
width: auto;
>div{
margin-top: -10px;
display: flex;
flex-wrap: wrap;
justify-content: center;
position: relative;
>i{
position: absolute;
font-size:40px;
}
>span{
position: absolute;
width:100%;
top:30px;
}
}
}
.file input {
position: absolute;
font-size: 100px;
right: 0;
top: 0;
opacity: 0;
}
.file:hover {
background: #AADFFD;
border-color: #78C3F3;
color: #004974;
text-decoration: none;
}
.uploaded{
width:100%;
height:1px;
flex-grow: 1;
margin-top:20px;
>span{
font-size:12px;
font-weight:bold;
}
>div{
margin-top:10px;
width:100%;
display:flex;
flex-wrap: wrap;
>img{
width:20%;
margin-right:5%;
margin-bottom: 5%;
}
}
}
}
</style>
<template>
<div id="uploadImg">
<a href="javascript:;" class="file">
<div>
<i class='iconfont icon-jia1' id="phone_icon"></i>
<span>上传图片</span>
</div>
<input ref="upload" id="upload" type="file" accept="image/*">
</a>
<div class="uploaded">
<span>已上传的图片:</span>
<div>
<img v-for="(item,index) in fileList" :key="index" class="previewer-demo-img" :src="item.src" width="100" @click.stop="show(index)" />
</div>
</div>
<div v-transfer-dom>
<previewer :list="fileList" ref="previewer" :options="options" @on-index-change="logIndexChange"></previewer>
</div>
</div>
</template>
<script>
import Util from '@/libs/util.js';
import Axios from 'axios';
var DOMParser = require('xmldom').DOMParser;
import {Previewer , TransferDom} from 'vux';
export default {
name: 'uploadImg',
data () {
return {
options: {
getThumbBoundsFn (index) {
// find thumbnail element
let thumbnail = document.querySelectorAll('.previewer-demo-img')[index]
// get window scroll Y
let pageYScroll = window.pageYOffset || document.documentElement.scrollTop
// optionally get horizontal scroll
// get position of element relative to viewport
let rect = thumbnail.getBoundingClientRect()
// w = width
return {x: rect.left, y: rect.top + pageYScroll, w: rect.width}
// Good guide on how to get element coordinates:
// http://javascript.info/tutorial/coordinates
}
},
fileList:[],
query:{},
}
},
components:{
Previewer
},
directives: {
TransferDom
},
async mounted(){
var that = window.d = this;
this.query = this.$route.query;
this.$refs['upload'].addEventListener('change', function() {
var t_files = this.files;
var str = '';
var reader=new FileReader();
reader.onload = function(e){
that.upload(reader.result); //或者 e.target.result都是一样的,都是base64码
}
reader.readAsDataURL(this.files[0]);
}, false);
},
methods:{
show(index){
this.$refs['previewer'].show(index)
},
logIndexChange(){
},
upload(base64,callback){
var datacopy = `<?xml version="1.0" encoding="utf-8"?><soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"><soap12:Body><SavePic xmlns="http://tempuri.org/"><sToken>F563EBDF-0FC1-4777-96B8-033C3E89D6F8</sToken><sProjectNo>${this.query.sProjectNo}</sProjectNo><sGuid>${this.query.uGUID}</sGuid><sBase64>${base64.split('data:image/png;base64,')[1]}</sBase64></SavePic></soap12:Body></soap12:Envelope>`
var xhr = new XMLHttpRequest();
//打开连接
xhr.open('POST',this.query.sWebServiceURL,true);
//重新设置请求头
xhr.setRequestHeader("Content-Type","text/xml;charset=UTF-8");
xhr.setRequestHeader("SOAPAction","http://tempuri.org/SavePic");
//设置回调函数
xhr.onreadystatechange = ()=>{
if(xhr.readyState == 4){
let doc = new DOMParser().parseFromString(xhr.response);
if(xhr.status == 200){
let data = doc.getElementsByTagName('SavePicResult')[0].firstChild.nodeValue;
if(data == 'Success'){
this.$vux.confirm.show({
title:"提示",
content:data,
showCancelButton:false,
})
this.fileList.push({
src:base64
})
}
}else if(xhr.status == 500){
let data = doc.getElementsByTagName('soap:Text')[0].firstChild.nodeValue;
this.$vux.confirm.show({
title:"提示",
content:data,
showCancelButton:false,
})
}else if(xhr.status == 0){
this.$vux.confirm.show({
title:"提示",
content:'存在跨域问题!',
showCancelButton:false,
})
}
}
};
//发送请求
xhr.send(datacopy);
// var headers = {
// 'Content-Type':'text/xml; charset=utf-8',
// 'SOAPAction':'http://tempuri.org/SavePic'
// }
// Axios({
// method: 'POST',
// url: this.query.sWebServiceURL,
// data: datacopy,
// headers: headers
// }).then(res=>{
// let doc = new DOMParser().parseFromString(res.data);
// let data = doc.getElementsByTagName('SavePicResult')[0].firstChild.nodeValue;
// if(data == 'Success'){
// this.fileList.push({
// src:base64
// })
// }
// this.$vux.confirm.show({
// title:"提示",
// content:data,
// showCancelButton:false,
// })
// }).catch(err=>{
// this.$vux.confirm.show({
// title:"提示",
// content:'上传错误,请重新上传!',
// showCancelButton:false,
// })
// })
}
},
deactivated(){
// 移除监听
this.$refs['upload'].removeEventListener("change")
}
}
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment