Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ElectricitySheep
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄媛媛
ElectricitySheep
Commits
f56b6376
Commit
f56b6376
authored
Sep 01, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
6922b66c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
526 additions
and
466 deletions
+526
-466
materialMan.vue
src/components/CommodityMan/materialMan.vue
+32
-2
index.js
src/plug/index.js
+494
-464
No files found.
src/components/CommodityMan/materialMan.vue
View file @
f56b6376
...
@@ -117,8 +117,10 @@
...
@@ -117,8 +117,10 @@
:content=
"item.Name"
placement=
"top-start"
>
:content=
"item.Name"
placement=
"top-start"
>
<div
@
click=
"PageSelect(item,index)"
:class=
"item.Selected ? 'selected' :''"
<div
@
click=
"PageSelect(item,index)"
:class=
"item.Selected ? 'selected' :''"
class=
"el-tooltip item material-item "
>
class=
"el-tooltip item material-item "
>
<img
:src=
"getIconLink(item.Path)+'?x-oss-process=video/snapshot,t_9,f_jpg,w_299,h_0,m_fast'"
<img
:src=
"getIconLink(item.Path)+'?x-oss-process=video/snapshot,t_9,f_jpg,w_299,h_0,m_fast'"
class=
"material-img"
style=
"width: 140px; height: 140px;"
>
class=
"material-img"
style=
"width: 140px; height: 140px;"
>
<div
class=
"material-video-info"
><i
class=
"el-icon-video-play"
></i>
<div
class=
"material-video-info"
><i
class=
"el-icon-video-play"
></i>
<span>
{{
Time
(
item
.
VideoTime
)
}}
</span></div>
<span>
{{
Time
(
item
.
VideoTime
)
}}
</span></div>
<div
flex=
"dir:left"
style=
"margin-top: 5px;"
>
<div
flex=
"dir:left"
style=
"margin-top: 5px;"
>
...
@@ -178,6 +180,10 @@
...
@@ -178,6 +180,10 @@
<el-button
size=
"small"
type=
"primary"
@
click=
"pagesubmitForm('addpageMsg')"
>
确 定
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"pagesubmitForm('addpageMsg')"
>
确 定
</el-button>
</span>
</span>
</el-dialog>
</el-dialog>
<video
width=
"320"
height=
"240"
controls
id=
"upvideo"
style=
"display:none"
>
</video>
<img
:src=
"testImg"
style=
"width:120px;height:60px;border:1px solid red;"
/>
<canvas
id=
'mycanvas'
></canvas>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
...
@@ -243,7 +249,7 @@
...
@@ -243,7 +249,7 @@
checkList
:
[],
checkList
:
[],
checkAllList
:
[],
checkAllList
:
[],
checkAll
:
false
,
checkAll
:
false
,
testImg
:
""
}
}
},
},
created
()
{
created
()
{
...
@@ -251,9 +257,33 @@
...
@@ -251,9 +257,33 @@
this
.
GetPageList
();
this
.
GetPageList
();
},
},
mounted
()
{
mounted
()
{
this
.
findvideocover
(
"http://192.168.2.214:8130/Upload/Video/20200901114120428.mp4"
)
},
},
methods
:
{
methods
:
{
//获取视频封面
findvideocover
(
videoUrl
)
{
let
_this
=
this
;
this
.
$nextTick
(()
=>
{
let
video
=
document
.
getElementById
(
"upvideo"
);
let
source
=
document
.
createElement
(
"source"
);
source
.
src
=
videoUrl
;
source
.
type
=
"video/mp4"
;
video
.
appendChild
(
source
);
video
.
addEventListener
(
"loadeddata"
,
function
()
{
var
canvas
=
document
.
createElement
(
"canvas"
);
canvas
.
width
=
"320"
;
canvas
.
height
=
"320"
;
canvas
.
getContext
(
"2d"
)
.
drawImage
(
video
,
0
,
0
,
canvas
.
width
,
canvas
.
width
);
console
.
log
(
"video"
,
video
);
var
img
=
document
.
createElement
(
"img"
);
let
imgsrc
=
canvas
.
toDataURL
(
"image/png"
);
_this
.
testImg
=
imgsrc
});
});
},
Time
(
value
)
{
Time
(
value
)
{
var
theTime
=
parseInt
(
value
);
// 秒
var
theTime
=
parseInt
(
value
);
// 秒
var
middle
=
0
;
// 分
var
middle
=
0
;
// 分
...
...
src/plug/index.js
View file @
f56b6376
import
md5
from
'js-md5'
import
md5
from
'js-md5'
export
default
{
export
default
{
install
(
Vue
,
options
)
{
install
(
Vue
,
options
)
{
Vue
.
prototype
.
md5
=
md5
;
Vue
.
prototype
.
md5
=
md5
;
//消息成功提示
//消息成功提示
Vue
.
prototype
.
Success
=
function
(
msg
)
{
Vue
.
prototype
.
Success
=
function
(
msg
)
{
this
.
$message
({
this
.
$message
({
message
:
msg
,
message
:
msg
,
duration
:
2000
,
duration
:
2000
,
type
:
"success"
type
:
"success"
});
});
},
},
//错误提示
//错误提示
Vue
.
prototype
.
Error
=
function
(
msg
)
{
Vue
.
prototype
.
Error
=
function
(
msg
)
{
this
.
$message
({
this
.
$message
({
message
:
msg
,
message
:
msg
,
duration
:
2000
,
duration
:
2000
,
type
:
"error"
type
:
"error"
});
});
},
},
//一般提示
//一般提示
Vue
.
prototype
.
Info
=
function
(
msg
)
{
Vue
.
prototype
.
Info
=
function
(
msg
)
{
this
.
$message
({
this
.
$message
({
message
:
msg
,
message
:
msg
,
duration
:
2000
,
duration
:
2000
,
type
:
"info"
type
:
"info"
});
});
},
},
//警告提示
//警告提示
Vue
.
prototype
.
Warning
=
function
(
msg
)
{
Vue
.
prototype
.
Warning
=
function
(
msg
)
{
this
.
$message
({
this
.
$message
({
message
:
msg
,
message
:
msg
,
duration
:
2000
,
duration
:
2000
,
type
:
"warning"
type
:
"warning"
});
});
},
},
//Confirm
//Confirm
Vue
.
prototype
.
Confirm
=
function
(
msg
,
callback
)
{
Vue
.
prototype
.
Confirm
=
function
(
msg
,
callback
)
{
this
.
$confirm
(
msg
,
"提示"
,
{
this
.
$confirm
(
msg
,
"提示"
,
{
confirmButtonText
:
"确定"
,
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
type
:
"warning"
})
})
.
then
(()
=>
{
.
then
(()
=>
{
if
(
typeof
callback
===
'function'
)
{
if
(
typeof
callback
===
'function'
)
{
callback
();
callback
();
}
}
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
Info
(
"已取消操作"
);
this
.
Info
(
"已取消操作"
);
});
});
},
},
//域名管理对象
Vue
.
prototype
.
domainManager
=
function
()
{
let
domainUrl
=
''
;
let
javaUrl
=
'http://192.168.2.65:8018'
;
domainUrl
=
"http://192.168.2.65"
;
//域名管理对象
//domainUrl = "https://localhost:5001";
Vue
.
prototype
.
domainManager
=
function
()
{
let
domainUrl
=
''
;
let
javaUrl
=
'http://192.168.2.65:8018'
;
let
locationName
=
window
.
location
.
hostname
;
domainUrl
=
"http://192.168.0.116:8200"
;
if
(
locationName
.
indexOf
(
'testmall.oytour'
)
!==
-
1
)
{
domainUrl
=
"https://localhost:5001"
;
domainUrl
=
"https://mallapi.oytour.com"
;
let
vtUploadUrl
=
"http://192.168.2.214:8120"
;
javaUrl
=
"http://property.oytour.com"
;
let
vtViewUrl
=
"http://192.168.2.214:8130"
;
}
else
if
(
locationName
.
indexOf
(
'oytour'
)
!==
-
1
)
{
domainUrl
=
"https://mallapi.oytour.com"
;
javaUrl
=
"http://property.oytour.com"
;
}
var
obj
=
{
//主地址npm
DomainUrl
:
domainUrl
,
//资产管理
javaUrl
:
javaUrl
,
//常用提交数据URL
PostUrl
:
domainUrl
+
"/api/common/post"
,
ImageUrl
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com'
,
UploadFileUrl
:
domainUrl
+
'/api/File/LocalFileUploadImport'
,
UploadBlob
:
domainUrl
+
'/api/File/UploadBlob'
,
};
return
obj
;
},
//浏览器缓存
Vue
.
prototype
.
getLocalStorage
=
function
()
{
var
localStorageData
=
window
.
localStorage
[
"mall_userInfo"
];
if
(
localStorageData
!==
undefined
&&
localStorageData
!=
'undefined'
)
{
return
JSON
.
parse
(
localStorageData
);
}
else
{
return
null
;
}
},
//验证只能输入2位小数【负数:isMinus传true】
Vue
.
prototype
.
checkPrice
=
function
(
item
,
filed
,
isMinus
)
{
var
value
=
""
+
item
[
filed
];
//转字符串
var
t
=
value
.
charAt
(
0
);
value
=
value
.
replace
(
/
[^\d
.
]
/g
,
""
);
//清除“数字”和“.”以外的字符
value
=
value
.
replace
(
/
\.{2,}
/g
,
"."
);
//只保留第一个. 清除多余的
value
=
value
.
replace
(
"."
,
"$#$"
)
.
replace
(
/
\.
/g
,
""
)
.
replace
(
"$#$"
,
"."
);
value
=
value
.
replace
(
/^
(\-)
*
(\d
+
)\.(\d\d)
.*$/
,
'$1$2.$3'
);
//只能输入两个小数
//如果第一位是负号,则允许添加 如果不允许添加负号 可以把这块注释掉
//是否允许负数
if
(
isMinus
&&
t
==
'-'
)
{
value
=
'-'
+
value
;
}
item
[
filed
]
=
value
;
}
//验证只能输入整数【负数:isMinus传true】
Vue
.
prototype
.
checkInteger
=
function
(
item
,
filed
,
isMinus
)
{
var
value
=
""
+
item
[
filed
];
//转字符串
var
t
=
value
.
charAt
(
0
);
value
=
value
.
replace
(
this
.
$commonUtils
.
Regex
.
isInteger
,
""
);
//是否允许负数
if
(
isMinus
&&
t
==
'-'
)
{
value
=
'-'
+
value
;
}
item
[
filed
]
=
value
;
},
//是否是线上环境【发布时修改为true】
Vue
.
prototype
.
isOnline
=
function
()
{
return
process
.
env
.
NODE_ENV
!==
'development'
;
},
//文件类型数组
Vue
.
prototype
.
FileType
=
function
()
{
var
fileTypeJson
=
{
//主地址npm
UserImg
:
"User"
,
//用户相图片
//常用提交数据URL
GoodsImg
:
"Goods"
,
//素材相关文件
SetImg
:
"Set"
,
//用户相图片
};
return
fileTypeJson
;
},
//上传文件到云存储
Vue
.
prototype
.
UploadFileToTencent
=
function
(
path
,
fileObj
,
callback
)
{
// debugger;
console
.
log
(
'filein...'
)
if
(
fileObj
.
type
==
"image/png"
||
fileObj
.
type
==
"image/jpeg"
)
{
let
that
=
this
lrz
(
fileObj
,
{
width
:
750
,
quality
:
0.8
})
.
then
(
function
(
rst
)
{
//成功时执行
console
.
log
(
rst
)
var
arr
=
rst
.
base64
.
split
(
','
);
var
mime
=
arr
[
0
].
match
(
/:
(
.*
?)
;/
)[
1
];
var
bstr
=
atob
(
arr
[
1
]);
var
n
=
bstr
.
length
;
var
u8arr
=
new
Uint8Array
(
n
);
while
(
n
--
)
{
u8arr
[
n
]
=
bstr
.
charCodeAt
(
n
);
}
var
newFile
=
new
File
([
u8arr
],
fileObj
.
name
,
{
type
:
mime
});
debugger
;
console
.
log
(
newFile
);
that
.
uploadStart
(
path
,
newFile
,
callback
)
}).
catch
(
function
(
error
)
{
that
.
uploadStart
(
path
,
fileObj
,
callback
)
}).
always
(
function
()
{
//不管成功或失败,都会执行
})
}
},
let
locationName
=
window
.
location
.
hostname
;
Vue
.
prototype
.
uploadStart
=
function
(
path
,
fileObj
,
callback
)
{
if
(
locationName
.
indexOf
(
'testmall.oytour'
)
!==
-
1
)
{
console
.
log
(
fileObj
)
domainUrl
=
"https://mallapi.oytour.com"
;
debugger
;
javaUrl
=
"http://property.oytour.com"
;
//获取文件扩展名
vtUploadUrl
=
"http://upload.oytour.com"
;
var
filename
=
fileObj
.
name
;
vtViewUrl
=
"http://imgfile.oytour.com"
;
var
index
=
filename
.
lastIndexOf
(
"."
);
}
else
if
(
locationName
.
indexOf
(
'oytour'
)
!==
-
1
)
{
var
suffix
=
filename
.
substr
(
index
);
domainUrl
=
"https://mallapi.oytour.com"
;
var
timestamp1
=
Date
.
parse
(
new
Date
())
+
"_"
+
(
Math
.
ceil
(
Math
.
random
()
*
1000
));
javaUrl
=
"http://property.oytour.com"
;
let
str
=
''
;
vtUploadUrl
=
"http://upload.oytour.com"
;
if
(
this
.
isOnline
())
{
vtViewUrl
=
"http://imgfile.oytour.com"
;
str
=
"/Test"
}
}
var
obj
=
{
var
newFileName
=
str
+
'/Upload/'
+
path
+
"/"
+
timestamp1
+
""
+
suffix
;
//主地址npm
var
uploadMsg
=
{
DomainUrl
:
domainUrl
,
Bucket
:
"viitto-1301420277"
,
//资产管理
Region
:
"ap-chengdu"
,
javaUrl
:
javaUrl
,
/* 存储桶所在地域,必须字段 */
//常用提交数据URL
SecretId
:
"AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd"
,
PostUrl
:
domainUrl
+
"/api/common/post"
,
SecretKey
:
"PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob"
,
ImageUrl
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com'
,
};
UploadFileUrl
:
domainUrl
+
'/api/File/LocalFileUploadImport'
,
var
COS
=
require
(
'cos-js-sdk-v5'
);
UploadBlob
:
domainUrl
+
'/api/File/UploadBlob'
,
var
cos
=
new
COS
({
//文件上传自己服务器
SecretId
:
uploadMsg
.
SecretId
,
VTUploadUrl
:
vtUploadUrl
,
SecretKey
:
uploadMsg
.
SecretKey
,
//文件预览自己服务器
});
VTViewUrl
:
vtUploadUrl
};
return
obj
;
},
//浏览器缓存
Vue
.
prototype
.
getLocalStorage
=
function
()
{
var
localStorageData
=
window
.
localStorage
[
"mall_userInfo"
];
if
(
localStorageData
!==
undefined
&&
localStorageData
!=
'undefined'
)
{
return
JSON
.
parse
(
localStorageData
);
}
else
{
return
null
;
}
},
//验证只能输入2位小数【负数:isMinus传true】
Vue
.
prototype
.
checkPrice
=
function
(
item
,
filed
,
isMinus
)
{
var
value
=
""
+
item
[
filed
];
//转字符串
var
t
=
value
.
charAt
(
0
);
value
=
value
.
replace
(
/
[^\d
.
]
/g
,
""
);
//清除“数字”和“.”以外的字符
value
=
value
.
replace
(
/
\.{2,}
/g
,
"."
);
//只保留第一个. 清除多余的
value
=
value
.
replace
(
"."
,
"$#$"
)
.
replace
(
/
\.
/g
,
""
)
.
replace
(
"$#$"
,
"."
);
value
=
value
.
replace
(
/^
(\-)
*
(\d
+
)\.(\d\d)
.*$/
,
'$1$2.$3'
);
//只能输入两个小数
//如果第一位是负号,则允许添加 如果不允许添加负号 可以把这块注释掉
//是否允许负数
if
(
isMinus
&&
t
==
'-'
)
{
value
=
'-'
+
value
;
}
item
[
filed
]
=
value
;
}
//验证只能输入整数【负数:isMinus传true】
Vue
.
prototype
.
checkInteger
=
function
(
item
,
filed
,
isMinus
)
{
var
value
=
""
+
item
[
filed
];
//转字符串
var
t
=
value
.
charAt
(
0
);
value
=
value
.
replace
(
this
.
$commonUtils
.
Regex
.
isInteger
,
""
);
//是否允许负数
if
(
isMinus
&&
t
==
'-'
)
{
value
=
'-'
+
value
;
}
item
[
filed
]
=
value
;
},
//是否是线上环境【发布时修改为true】
Vue
.
prototype
.
isOnline
=
function
()
{
return
process
.
env
.
NODE_ENV
!==
'development'
;
},
//文件类型数组
Vue
.
prototype
.
FileType
=
function
()
{
var
fileTypeJson
=
{
//主地址npm
UserImg
:
"User"
,
//用户相图片
//常用提交数据URL
GoodsImg
:
"Goods"
,
//素材相关文件
SetImg
:
"Set"
,
//用户相图片
Video
:
"Video"
,
//视频
};
return
fileTypeJson
;
},
//上传文件到本地服务器
Vue
.
prototype
.
UploadSelfFile
=
function
(
path
,
file
,
callback
)
{
var
that
=
this
;
var
newPath
=
'/Upload/'
+
path
+
"/"
;
var
formData
=
new
FormData
();
var
uploadUrl
=
that
.
domainManager
().
VTUploadUrl
+
"/Upload?filePath="
+
newPath
;
formData
.
append
(
"myfile"
,
file
);
that
.
$http
.
post
(
uploadUrl
,
formData
,
{})
.
then
(
res
=>
{
if
(
res
&&
res
.
status
==
200
&&
res
.
data
&&
res
.
data
.
FilePath
)
{
var
uploadResult
=
{
resultCode
:
1
,
FileName
:
file
.
name
,
FileUrl
:
that
.
domainManager
().
VTViewUrl
+
res
.
data
.
FilePath
}
if
(
callback
)
{
callback
(
uploadResult
);
}
}
}).
catch
(
function
(
reason
)
{
console
.
log
(
reason
)
});
},
//上传文件到云存储
Vue
.
prototype
.
UploadFileToTencent
=
function
(
path
,
fileObj
,
callback
)
{
// debugger;
if
(
fileObj
.
type
==
"image/png"
||
fileObj
.
type
==
"image/jpeg"
)
{
let
that
=
this
lrz
(
fileObj
,
{
width
:
750
,
quality
:
0.8
})
.
then
(
function
(
rst
)
{
//成功时执行
var
arr
=
rst
.
base64
.
split
(
','
);
var
mime
=
arr
[
0
].
match
(
/:
(
.*
?)
;/
)[
1
];
var
bstr
=
atob
(
arr
[
1
]);
var
n
=
bstr
.
length
;
var
u8arr
=
new
Uint8Array
(
n
);
while
(
n
--
)
{
u8arr
[
n
]
=
bstr
.
charCodeAt
(
n
);
}
var
newFile
=
new
File
([
u8arr
],
fileObj
.
name
,
{
type
:
mime
});
that
.
uploadStart
(
path
,
newFile
,
callback
)
}).
catch
(
function
(
error
)
{
that
.
uploadStart
(
path
,
fileObj
,
callback
)
}).
always
(
function
()
{
//不管成功或失败,都会执行
})
}
},
Vue
.
prototype
.
uploadStart
=
function
(
path
,
fileObj
,
callback
)
{
//获取文件扩展名
var
filename
=
fileObj
.
name
;
var
index
=
filename
.
lastIndexOf
(
"."
);
var
suffix
=
filename
.
substr
(
index
);
var
timestamp1
=
Date
.
parse
(
new
Date
())
+
"_"
+
(
Math
.
ceil
(
Math
.
random
()
*
1000
));
let
str
=
''
;
if
(
this
.
isOnline
())
{
str
=
"/Test"
}
var
newFileName
=
str
+
'/Upload/'
+
path
+
"/"
+
timestamp1
+
""
+
suffix
;
var
uploadMsg
=
{
Bucket
:
"viitto-1301420277"
,
Region
:
"ap-chengdu"
,
/* 存储桶所在地域,必须字段 */
SecretId
:
"AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd"
,
SecretKey
:
"PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob"
,
};
var
COS
=
require
(
'cos-js-sdk-v5'
);
var
cos
=
new
COS
({
SecretId
:
uploadMsg
.
SecretId
,
SecretKey
:
uploadMsg
.
SecretKey
,
});
cos
.
putObject
({
cos
.
putObject
({
Bucket
:
uploadMsg
.
Bucket
,
Bucket
:
uploadMsg
.
Bucket
,
Region
:
uploadMsg
.
Region
,
//存储桶所在地域,必须字段
Region
:
uploadMsg
.
Region
,
//存储桶所在地域,必须字段
Key
:
newFileName
,
//文件名
Key
:
newFileName
,
//文件名
StorageClass
:
'STANDARD'
,
StorageClass
:
'STANDARD'
,
Body
:
fileObj
,
// 上传文件对象
Body
:
fileObj
,
// 上传文件对象
onProgress
:
function
(
progressData
)
{}
onProgress
:
function
(
progressData
)
{}
},
function
(
err
,
data
)
{
},
function
(
err
,
data
)
{
debugger
;
if
(
data
&&
data
.
statusCode
==
200
)
{
if
(
data
&&
data
.
statusCode
==
200
)
{
var
uploadResult
=
{
var
uploadResult
=
{
resultCode
:
1
,
resultCode
:
1
,
FileName
:
fileObj
.
name
,
FileName
:
fileObj
.
name
,
FileUrl
:
"http://"
+
data
.
Location
FileUrl
:
"http://"
+
data
.
Location
}
if
(
callback
)
{
callback
(
uploadResult
);
}
}
else
{
/*上传文件异常*/
console
.
log
(
err
||
data
);
}
});
},
//公用跳转
Vue
.
prototype
.
CommonJump
=
function
(
path
,
obj
)
{
this
.
$router
.
push
({
name
:
path
,
query
:
obj
});
}
}
//公用判断图片地址 判断是否包含http
if
(
callback
)
{
Vue
.
prototype
.
getIconLink
=
function
(
url
)
{
callback
(
uploadResult
);
let
str
=
''
if
(
url
&&
url
!=
''
)
{
if
(
url
.
indexOf
(
'http'
)
!=
-
1
)
{
str
=
url
}
else
{
str
=
this
.
domainManager
().
ImageUrl
+
url
;
}
return
str
;
}
}
}
//HTTP提交数据
}
else
{
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
/*上传文件异常*/
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
console
.
log
(
err
||
data
);
var
postData
=
this
.
GetPostData
(
cmd
,
msg
,
""
);
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
});
headers
:
{
},
'Content-Type'
:
'application/json'
,
//公用跳转
'Referer-Viitto'
:
this
.
$route
.
path
Vue
.
prototype
.
CommonJump
=
function
(
path
,
obj
)
{
}
this
.
$router
.
push
({
})
name
:
path
,
.
then
(
res
=>
{
query
:
obj
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
});
this
.
$router
.
push
({
}
path
:
'/login'
//公用判断图片地址 判断是否包含http
});
Vue
.
prototype
.
getIconLink
=
function
(
url
)
{
}
else
if
(
res
.
resultCode
==
10005
)
{
let
str
=
''
this
.
$router
.
go
(
-
1
);
if
(
url
&&
url
!=
''
)
{
}
else
{
if
(
url
.
indexOf
(
'http'
)
!=
-
1
)
{
successCall
(
res
);
str
=
url
}
}
else
{
},
faildCall
)
str
=
this
.
domainManager
().
ImageUrl
+
url
;
}
return
str
;
}
}
//HTTP提交数据
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
postData
=
this
.
GetPostData
(
cmd
,
msg
,
""
);
this
.
$http
.
post
(
apiurl
,
postData
,
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Referer-Viitto'
:
this
.
$route
.
path
}
})
.
then
(
res
=>
{
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
this
.
$router
.
push
({
path
:
'/login'
});
}
else
if
(
res
.
resultCode
==
10005
)
{
this
.
$router
.
go
(
-
1
);
}
else
{
successCall
(
res
);
}
},
faildCall
)
}
//获取请求参数
Vue
.
prototype
.
GetPostData
=
function
(
cmd
,
msg
,
newCmd
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
}
var
timestamp
=
(
new
Date
()).
valueOf
();
if
(
!
localStorage
.
mall_userInfo
&&
localStorage
.
mall_userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/register"
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/forgetpassword"
)
{
this
.
$router
.
push
({
path
:
'/login'
})
}
var
token
=
""
;
var
key
=
""
;
var
MallBaseId
=
"0"
;
//小程序ID
var
TenantId
=
"0"
;
//商户Id
var
EmpId
=
0
;
//员工编号【员工登录时使用】
if
(
this
.
getLocalStorage
()
!=
null
)
{
token
=
this
.
getLocalStorage
().
Token
;
key
=
this
.
getLocalStorage
().
SecretKey
;
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
TenantId
=
this
.
getLocalStorage
().
TenantId
;
EmpId
=
this
.
getLocalStorage
().
EmpId
;
}
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
let
tempLanguage
=
0
;
if
(
localStorage
.
language
&&
localStorage
.
language
!=
''
)
{
if
(
localStorage
.
language
==
"zh-TW"
)
{
tempLanguage
=
1
;
}
else
if
(
localStorage
.
language
==
"Japanese"
)
{
tempLanguage
=
2
;
}
}
var
cmdStr
=
""
;
if
(
newCmd
)
{
cmdStr
=
newCmd
;
}
var
postData
=
{
msg
:
msg
,
timestamp
:
timestamp
,
token
:
token
,
sign
:
md5Str
,
languageId
:
tempLanguage
,
cmd
:
cmdStr
,
MallBaseId
:
MallBaseId
,
TenantId
:
TenantId
,
EmpId
:
EmpId
,
SmallShopsId
:
0
,
MiniAppId
:
"wxacd9f8cc3480d29e"
,
OpenId
:
"ow_7I5cKHQJeQlNJOKoeERRhe6SA"
,
UserId
:
21382
,
}
return
postData
},
//HTTP提交数据资产
Vue
.
prototype
.
assetsApipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
postData
=
this
.
GetAssetsPostData
(
cmd
,
msg
,
""
);
this
.
$http
.
post
(
apiurl
,
postData
,
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Referer-Viitto'
:
this
.
$route
.
path
}
}
//获取请求参数
})
Vue
.
prototype
.
GetPostData
=
function
(
cmd
,
msg
,
newCmd
)
{
.
then
(
res
=>
{
if
(
msg
==
null
||
msg
==
""
)
{
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
msg
=
{}
this
.
$router
.
push
({
}
path
:
'/login'
var
timestamp
=
(
new
Date
()).
valueOf
();
});
if
(
!
localStorage
.
mall_userInfo
&&
localStorage
.
mall_userInfo
!=
""
&&
}
else
if
(
res
.
resultCode
==
10005
)
{
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
&&
this
.
$router
.
go
(
-
1
);
this
.
$route
.
path
.
toLowerCase
()
!=
"/register"
&&
}
else
{
this
.
$route
.
path
.
toLowerCase
()
!=
"/forgetpassword"
successCall
(
res
);
)
{
this
.
$router
.
push
({
path
:
'/login'
})
}
var
token
=
""
;
var
key
=
""
;
var
MallBaseId
=
"0"
;
//小程序ID
var
TenantId
=
"0"
;
//商户Id
var
EmpId
=
0
;
//员工编号【员工登录时使用】
if
(
this
.
getLocalStorage
()
!=
null
)
{
token
=
this
.
getLocalStorage
().
Token
;
key
=
this
.
getLocalStorage
().
SecretKey
;
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
TenantId
=
this
.
getLocalStorage
().
TenantId
;
EmpId
=
this
.
getLocalStorage
().
EmpId
;
}
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
let
tempLanguage
=
0
;
if
(
localStorage
.
language
&&
localStorage
.
language
!=
''
)
{
if
(
localStorage
.
language
==
"zh-TW"
)
{
tempLanguage
=
1
;
}
else
if
(
localStorage
.
language
==
"Japanese"
)
{
tempLanguage
=
2
;
}
}
var
cmdStr
=
""
;
if
(
newCmd
)
{
cmdStr
=
newCmd
;
}
var
postData
=
{
msg
:
msg
,
timestamp
:
timestamp
,
token
:
token
,
sign
:
md5Str
,
languageId
:
tempLanguage
,
cmd
:
cmdStr
,
MallBaseId
:
MallBaseId
,
TenantId
:
TenantId
,
EmpId
:
EmpId
,
MiniAppId
:
"wxacd9f8cc3480d29e"
,
OpenId
:
"ow_7I5ZQKhAB66yvOTGI35Xk-Kmg"
,
// UserId:19992,
}
return
postData
},
//HTTP提交数据资产
Vue
.
prototype
.
assetsApipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
postData
=
this
.
GetAssetsPostData
(
cmd
,
msg
,
""
);
this
.
$http
.
post
(
apiurl
,
postData
,
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Referer-Viitto'
:
this
.
$route
.
path
}
})
.
then
(
res
=>
{
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
this
.
$router
.
push
({
path
:
'/login'
});
}
else
if
(
res
.
resultCode
==
10005
)
{
this
.
$router
.
go
(
-
1
);
}
else
{
successCall
(
res
);
}
},
faildCall
)
}
}
},
faildCall
)
}
//获取请求参数
//获取请求参数
Vue
.
prototype
.
GetAssetsPostData
=
function
(
cmd
,
msg
,
newCmd
)
{
Vue
.
prototype
.
GetAssetsPostData
=
function
(
cmd
,
msg
,
newCmd
)
{
if
(
msg
==
null
||
msg
==
""
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
msg
=
{}
}
}
var
timestamp
=
(
new
Date
()).
valueOf
();
var
timestamp
=
(
new
Date
()).
valueOf
();
if
(
!
localStorage
.
mall_userInfo
&&
localStorage
.
mall_userInfo
!=
""
&&
if
(
!
localStorage
.
mall_userInfo
&&
localStorage
.
mall_userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/register"
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/register"
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/forgetpassword"
this
.
$route
.
path
.
toLowerCase
()
!=
"/forgetpassword"
)
{
)
{
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
'/login'
path
:
'/login'
})
})
}
}
var
token
=
""
;
var
token
=
""
;
var
key
=
""
;
var
key
=
""
;
var
MallBaseId
=
"0"
;
//小程序ID
var
MallBaseId
=
"0"
;
//小程序ID
var
TenantId
=
"0"
;
//商户Id
var
TenantId
=
"0"
;
//商户Id
var
EmpId
=
0
;
//员工编号【员工登录时使用】
var
EmpId
=
0
;
//员工编号【员工登录时使用】
var
ERPGroupId
=
0
;
var
ERPGroupId
=
0
;
var
ERPEmpId
=
0
;
var
ERPEmpId
=
0
;
var
ERPBranchId
=
0
;
var
ERPBranchId
=
0
;
if
(
this
.
getLocalStorage
()
!=
null
)
{
if
(
this
.
getLocalStorage
()
!=
null
)
{
token
=
this
.
getLocalStorage
().
Token
;
token
=
this
.
getLocalStorage
().
Token
;
key
=
this
.
getLocalStorage
().
SecretKey
;
key
=
this
.
getLocalStorage
().
SecretKey
;
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
TenantId
=
this
.
getLocalStorage
().
TenantId
;
TenantId
=
this
.
getLocalStorage
().
TenantId
;
EmpId
=
this
.
getLocalStorage
().
EmpId
;
EmpId
=
this
.
getLocalStorage
().
EmpId
;
ERPGroupId
=
this
.
getLocalStorage
().
ERPGroupId
;
ERPGroupId
=
this
.
getLocalStorage
().
ERPGroupId
;
ERPEmpId
=
this
.
getLocalStorage
().
ERPEmpId
;
ERPEmpId
=
this
.
getLocalStorage
().
ERPEmpId
;
ERPBranchId
=
this
.
getLocalStorage
().
ERPBranchId
;
ERPBranchId
=
this
.
getLocalStorage
().
ERPBranchId
;
}
}
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
let
tempLanguage
=
0
;
let
tempLanguage
=
0
;
if
(
localStorage
.
language
&&
localStorage
.
language
!=
''
)
{
if
(
localStorage
.
language
&&
localStorage
.
language
!=
''
)
{
if
(
localStorage
.
language
==
"zh-TW"
)
{
if
(
localStorage
.
language
==
"zh-TW"
)
{
tempLanguage
=
1
;
tempLanguage
=
1
;
}
else
if
(
localStorage
.
language
==
"Japanese"
)
{
}
else
if
(
localStorage
.
language
==
"Japanese"
)
{
tempLanguage
=
2
;
tempLanguage
=
2
;
}
}
}
}
var
cmdStr
=
""
;
var
cmdStr
=
""
;
if
(
newCmd
)
{
if
(
newCmd
)
{
cmdStr
=
newCmd
;
cmdStr
=
newCmd
;
}
}
var
postData
=
{
var
postData
=
{
msg
:
msg
,
msg
:
msg
,
timestamp
:
timestamp
,
timestamp
:
timestamp
,
token
:
token
,
token
:
token
,
sign
:
md5Str
,
sign
:
md5Str
,
languageId
:
tempLanguage
,
languageId
:
tempLanguage
,
cmd
:
cmdStr
,
cmd
:
cmdStr
,
MallBaseId
:
MallBaseId
,
MallBaseId
:
MallBaseId
,
TenantId
:
TenantId
,
TenantId
:
TenantId
,
EmpId
:
EmpId
,
EmpId
:
EmpId
,
ERPGroupId
:
ERPGroupId
,
ERPGroupId
:
ERPGroupId
,
ERPEmpId
:
ERPEmpId
,
ERPEmpId
:
ERPEmpId
,
ERPBranchId
:
ERPBranchId
,
ERPBranchId
:
ERPBranchId
,
// MiniAppId:"wxacd9f8cc3480d29e",
// MiniAppId:"wxacd9f8cc3480d29e",
// OpenId:"ow_7I5ZQKhAB66yvOTGI35Xk-Kmg",
// OpenId:"ow_7I5ZQKhAB66yvOTGI35Xk-Kmg",
// UserId:19992,
// UserId:19992,
}
}
return
postData
return
postData
},
},
//文件下载
//文件下载
Vue
.
prototype
.
GetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
newCmd
,
successCall
)
{
Vue
.
prototype
.
GetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
newCmd
,
successCall
)
{
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
postData
=
this
.
GetPostData
(
cmd
,
msg
,
newCmd
);
var
postData
=
this
.
GetPostData
(
cmd
,
msg
,
newCmd
);
this
.
$http
.
post
(
apiurl
,
postData
,
{
this
.
$http
.
post
(
apiurl
,
postData
,
{
responseType
:
'arraybuffer'
responseType
:
'arraybuffer'
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
let
blob
=
new
Blob
([
res
.
data
],
{
let
blob
=
new
Blob
([
res
.
data
],
{
type
:
"application/vnd.ms-excel"
type
:
"application/vnd.ms-excel"
})
})
let
url
=
URL
.
createObjectURL
(
blob
);
let
url
=
URL
.
createObjectURL
(
blob
);
let
link
=
document
.
createElement
(
'a'
);
let
link
=
document
.
createElement
(
'a'
);
link
.
href
=
url
;
link
.
href
=
url
;
link
.
setAttribute
(
"download"
,
fileName
);
link
.
setAttribute
(
"download"
,
fileName
);
document
.
body
.
appendChild
(
link
);
document
.
body
.
appendChild
(
link
);
link
.
click
();
link
.
click
();
successCall
(
res
);
successCall
(
res
);
}).
catch
(
function
(
res
)
{});
}).
catch
(
function
(
res
)
{});
},
},
//调用资产的接口
//调用资产的接口
Vue
.
prototype
.
apiJavaPost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
Vue
.
prototype
.
apiJavaPost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
if
(
msg
==
null
||
msg
==
""
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
msg
=
{}
}
}
var
apiurl
=
this
.
domainManager
().
javaUrl
+
cmd
;
var
apiurl
=
this
.
domainManager
().
javaUrl
+
cmd
;
var
timestamp
=
(
new
Date
()).
valueOf
();
var
timestamp
=
(
new
Date
()).
valueOf
();
this
.
apiurl
=
apiurl
;
this
.
apiurl
=
apiurl
;
var
token
=
""
;
var
token
=
""
;
var
key
=
""
;
var
key
=
""
;
var
MallBaseId
=
"0"
;
//小程序ID
var
MallBaseId
=
"0"
;
//小程序ID
var
TenantId
=
"0"
;
//商户Id
var
TenantId
=
"0"
;
//商户Id
var
uid
=
"0"
var
uid
=
"0"
if
(
this
.
getLocalStorage
()
!=
null
)
{
if
(
this
.
getLocalStorage
()
!=
null
)
{
token
=
this
.
getLocalStorage
().
Token
;
token
=
this
.
getLocalStorage
().
Token
;
key
=
this
.
getLocalStorage
().
SecretKey
;
key
=
this
.
getLocalStorage
().
SecretKey
;
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
TenantId
=
this
.
getLocalStorage
().
TenantId
;
TenantId
=
this
.
getLocalStorage
().
TenantId
;
uid
=
this
.
getLocalStorage
().
ERPEmpId
uid
=
this
.
getLocalStorage
().
ERPEmpId
}
}
var
md5Str
=
md5
(
`msg=YXZCGL2020×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
var
md5Str
=
md5
(
`msg=YXZCGL2020×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
var
postData
=
{
var
postData
=
{
"msg"
:
msg
,
"msg"
:
msg
,
"timestamp"
:
timestamp
,
"timestamp"
:
timestamp
,
"token"
:
token
,
"token"
:
token
,
"sign"
:
md5Str
,
"sign"
:
md5Str
,
"MallBaseId"
:
MallBaseId
,
"MallBaseId"
:
MallBaseId
,
"TenantId"
:
TenantId
,
"TenantId"
:
TenantId
,
'uid'
:
uid
'uid'
:
uid
}
}
if
(
localStorage
.
g
&&
localStorage
.
g
!=
'undefined'
)
{
if
(
localStorage
.
g
&&
localStorage
.
g
!=
'undefined'
)
{
postData
.
groupId
=
2
;
postData
.
groupId
=
2
;
}
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
this
.
$http
.
post
(
apiurl
,
postData
,
{
headers
:
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
'Referer-Viitto'
:
this
.
$route
.
path
'Referer-Viitto'
:
this
.
$route
.
path
}
})
.
then
(
res
=>
{
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
this
.
$router
.
push
({
path
:
'/login'
})
}
else
if
(
res
.
data
.
resultCode
==
10005
)
{
this
.
$router
.
go
(
-
1
)
}
else
{
successCall
(
res
)
}
},
faildCall
)
}
}
}
})
}
.
then
(
res
=>
{
\ No newline at end of file
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
this
.
$router
.
push
({
path
:
'/login'
})
}
else
if
(
res
.
data
.
resultCode
==
10005
)
{
this
.
$router
.
go
(
-
1
)
}
else
{
successCall
(
res
)
}
},
faildCall
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment