Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7-Res
提交
7f33efc5
提交
7f33efc5
编写于
11月 03, 2022
作者:
glod-money-money
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:更新
上级
e5c979ce
变更
6
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
255 行增加
和
4 行删除
+255
-4
app-register.ts
src/app-register.ts
+2
-0
app-field-image-dynamic.less
...edia/app-field-image-dynamic/app-field-image-dynamic.less
+0
-0
app-field-image-dynamic.vue
...media/app-field-image-dynamic/app-field-image-dynamic.vue
+91
-0
app-rawitem-carousel.vue
...ement/media/app-rawitem-carousel/app-rawitem-carousel.vue
+35
-4
index.ts
src/utils/index.ts
+1
-0
imgurl-base64.ts
src/utils/util/imgurl-base64.ts
+126
-0
未找到文件。
src/app-register.ts
浏览文件 @
7f33efc5
...
...
@@ -137,6 +137,7 @@ import AppIndexOrgSelect from './components/layout-element/index/app-index-org-s
import
AppIndexUserInfo
from
'./components/layout-element/index/app-index-user-info/app-index-user-info.vue'
;
import
AppCtrlPos
from
'./components/layout-element/control/app-ctrl-pos/app-ctrl-pos.vue'
;
import
AppPresetButton
from
'./components/layout-element/interactive/app-preset-button/app-preset-button.vue'
;
import
AppFieldImageDynamic
from
'./components/layout-element/media/app-field-image-dynamic/app-field-image-dynamic.vue'
;
// 全局挂载UI实体服务注册中心
window
[
'uiServiceRegister'
]
=
uiServiceRegister
;
// 全局挂载实体权限服务注册中心
...
...
@@ -288,5 +289,6 @@ export const AppComponents = {
v
.
component
(
'app-index-user-info'
,
AppIndexUserInfo
);
v
.
component
(
'app-ctrl-pos'
,
AppCtrlPos
);
v
.
component
(
'app-preset-button'
,
AppPresetButton
);
v
.
component
(
'app-field-image-dynamic'
,
AppFieldImageDynamic
);
},
};
\ No newline at end of file
src/components/layout-element/media/app-field-image-dynamic/app-field-image-dynamic.less
0 → 100644
浏览文件 @
7f33efc5
src/components/layout-element/media/app-field-image-dynamic/app-field-image-dynamic.vue
0 → 100644
浏览文件 @
7f33efc5
<
template
>
<div
:class=
"
{'app-field-image-dynamic':true,[cssClass]:cssClass?true:false}">
<img
:style=
"cssStyle"
:src=
"imgUrl"
/>
</div>
</
template
>
<
script
lang =
'ts'
>
import
{
Vue
,
Component
,
Prop
,
Watch
,
Provide
}
from
'vue-property-decorator'
;
import
{
ImgurlBase64
}
from
'@/utils'
;
import
{
Environment
}
from
"@/environments/environment"
;
@
Component
({})
export
default
class
AppFieldImageDynamic
extends
Vue
{
/**
* 输入值
*
* @type {string}
* @memberof AppRawItemImage
*/
@
Prop
()
public
value
:
any
;
/**
* 样式
*
* @type {string}
* @memberof AppRawItemImage
*/
@
Prop
()
public
cssStyle
?:
string
;
/**
* 样式表类名
*
* @type {string}
* @memberof AppRawItemImage
*/
@
Prop
({
default
:
''
})
public
cssClass
:
string
;
/**
* 动态图片路径
*
* @memberof AppPresetRawitem
*/
protected
dynaImgUrl
:
string
=
''
;
/**
* 下载文件路径
*
* @memberof AppPresetRawitem
*/
public
downloadUrl
=
Environment
.
ExportFile
;
/**
* 图片路径
*
* @memberof AppPresetRawitem
*/
get
imgUrl
():
string
{
return
this
.
dynaImgUrl
;
}
created
()
{
this
.
handleDynaImg
();
}
/**
* 处理动态图片
*
* @memberof AppPresetRawitem
*/
protected
handleDynaImg
()
{
if
(
this
.
value
&&
typeof
this
.
value
==
"string"
)
{
// 默认识别文件对象形式,识别失败则为全路径模式
try
{
const
_files
=
JSON
.
parse
(
this
.
value
);
const
file
=
_files
instanceof
Array
?
_files
[
0
]
:
null
;
const
url
=
file
&&
file
.
id
?
`
${
this
.
downloadUrl
}
/
${
file
.
id
}
`
:
""
;
ImgurlBase64
.
getInstance
()
.
getImgURLOfBase64
(
url
)
.
then
((
res
:
any
)
=>
{
this
.
dynaImgUrl
=
res
;
});
}
catch
(
error
)
{
this
.
dynaImgUrl
=
this
.
value
;
}
}
}
}
</
script
>
<
style
lang =
"less"
>
@import './app-field-image-dynamic.less';
</
style
>
\ No newline at end of file
src/components/layout-element/media/app-rawitem-carousel/app-rawitem-carousel.vue
浏览文件 @
7f33efc5
...
...
@@ -18,19 +18,50 @@
import
{
Component
,
Vue
,
Prop
,
Watch
}
from
'vue-property-decorator'
;
@
Component
({})
export
default
class
AppCarousel
extends
Vue
{
/**
* 父项所有数据
*
* @type {*}
* @memberof AppPresetCarousel
*/
@
Prop
()
public
contextData
?:
any
;
/**
* @description 轮播图数据
* @param {*}
* @memberof AppCarousel
*/
@
Prop
()
public
data
?:
any
;
@
Prop
()
public
value
?:
any
;
/**
* @description 轮播图样式
* @param {*}
* @memberof AppCarousel
*/
@
Prop
()
public
rawstyle
?:
any
;
@
Prop
()
public
cssStyle
?:
any
;
/**
* @description 样式表
* @param {*}
* @memberof AppCarousel
*/
@
Prop
()
public
cssClass
?:
any
;
/**
* 名称
*
* @type {string}
* @memberof AppCarousel
*/
@
Prop
()
public
name
!
:
string
;
/**
* 类型
*
* @type {string}
* @memberof AppCarousel
*/
@
Prop
()
public
type
?:
string
;
/**
* @description 轮播图图片所有项数据
...
...
@@ -64,7 +95,7 @@ export default class AppCarousel extends Vue {
* @memberof AppCarousel
*/
created
()
{
this
.
handleSwipData
(
this
.
data
);
this
.
handleSwipData
(
this
.
value
);
}
/**
...
...
@@ -81,7 +112,7 @@ export default class AppCarousel extends Vue {
this
.
swipeData
=
data
.
slice
(
0
,
-
2
);
this
.
swipeConfig
=
this
.
setSwipeConfig
(
data
.
slice
(
-
2
));
}
else
{
this
.
swipeData
=
this
.
data
;
this
.
swipeData
=
data
;
this
.
swipeConfig
=
this
.
setSwipeConfig
(
data
);
}
}
...
...
src/utils/index.ts
浏览文件 @
7f33efc5
...
...
@@ -12,3 +12,4 @@ export { UIActionTool } from './uiaction-tool/uiaction-tool';
export
{
LoadAppData
}
from
'./load-app-data/load-app-data'
;
export
{
Interceptors
}
from
'./interceptor/interceptor'
;
export
{
StudioActionUtil
}
from
'./studio-action/StudioActionUtil'
;
export
{
ImgurlBase64
}
from
'./util/imgurl-base64'
;
\ No newline at end of file
src/utils/util/imgurl-base64.ts
0 → 100644
浏览文件 @
7f33efc5
import
axios
from
'axios'
;
export
class
ImgurlBase64
{
/**
* 单例变量声明
*
* @memberof ImgurlBase64
*/
private
static
imgurlBase64
:
ImgurlBase64
;
/**
* 图片缓存(加载中)
*
* @type {Map<string,any>}
* @memberof ImgurlBase64
*/
public
static
imgCache
:
Map
<
string
,
any
>
=
new
Map
();
/**
* 图片缓存(已完成)
*
* @type {Map<string,any>}
* @memberof ImgurlBase64
*/
public
static
imgCached
:
Map
<
string
,
any
>
=
new
Map
();
/**
* 获取 ImgurlBase64 单例对象
*
* @memberof ImgurlBase64
*/
public
static
getInstance
()
{
if
(
!
this
.
imgurlBase64
)
{
this
.
imgurlBase64
=
new
ImgurlBase64
();
}
return
this
.
imgurlBase64
;
}
/**
* 手动获取图片
*
*
* @param url 图片url路径
* @returns
*/
public
async
getImgURLOfBase64
(
url
:
string
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
img
=
'/'
;
// 富文本CV上传图片与鼠标移出抛值冲突问题,上传成功回调还没执行时就抛值
var
reg
=
/^
\s
*data:
([
a-z
]
+
\/[
a-z0-9-+.
]
+
(
;
[
a-z-
]
+=
[
a-z0-9-
]
+
)?)?(
;base64
)?
,
([
a-z0-9!$&',()*+;=
\-
._~:@
\/
?%
\s]
*
?)\s
*$/i
;
if
(
reg
.
test
(
url
))
{
return
resolve
(
url
);
}
// 缓存中有从缓存中拿
if
(
ImgurlBase64
.
imgCached
.
get
(
url
))
{
let
img
=
ImgurlBase64
.
imgCached
.
get
(
url
);
resolve
(
img
);
}
const
callback
:
Function
=
(
url
:
string
,
promise
:
Promise
<
any
>
)
=>
{
promise
.
then
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
200
&&
response
.
data
)
{
// 获取文件名
const
disposition
=
response
.
headers
[
'content-disposition'
];
const
filename
=
disposition
.
split
(
'filename='
)[
1
];
let
type
=
'image/png'
;
if
(
filename
&&
filename
.
indexOf
(
'.'
)
>
0
)
{
const
start
=
filename
.
lastIndexOf
(
'.'
);
const
expandedName
=
filename
.
substring
(
start
+
1
);
if
(
expandedName
.
match
(
/
(
bmp|jpg|jpeg|png|tif|gif|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp
)
/gi
)
!=
null
)
{
type
=
'image/'
+
expandedName
;
}
else
{
resolve
(
img
);
}
}
let
blob
=
new
Blob
([
response
.
data
],{
type
:
type
});
this
.
blobToBase64
(
blob
).
then
((
res
)
=>
{
// 转化后的base64
img
=
`
${
res
}
`
;
// 缓存图片
ImgurlBase64
.
imgCached
.
set
(
url
,
img
);
resolve
(
img
);
})
}
else
{
resolve
(
img
);
}
}).
catch
((
result
:
any
)
=>
{
return
resolve
(
img
);
})
}
// 加载中
if
(
ImgurlBase64
.
imgCache
.
get
(
url
))
{
callback
(
url
,
ImgurlBase64
.
imgCache
.
get
(
url
));
}
else
{
let
_url
=
url
;
if
(
!
Object
.
is
(
'/'
,
_url
.
substring
(
0
,
1
)))
{
_url
=
'/'
+
_url
;
}
let
result
:
Promise
<
any
>
=
axios
({
method
:
'get'
,
url
:
_url
,
responseType
:
'blob'
});
ImgurlBase64
.
imgCache
.
set
(
url
,
result
);
callback
(
url
,
result
);
}
});
}
/**
* 将blob转为base64
*
*
* @param blob blob对象
* @returns
*/
public
blobToBase64
(
blob
:
any
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
fileReader
=
new
FileReader
();
fileReader
.
onload
=
(
e
:
any
)
=>
{
resolve
(
e
.
target
.
result
);
};
// readAsDataURL
fileReader
.
readAsDataURL
(
blob
);
fileReader
.
onerror
=
()
=>
{
reject
(
new
Error
(
'blobToBase64 error'
));
};
});
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录