Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
anyefeiyu
uni-app
提交
0b4bcfba
U
uni-app
项目概览
anyefeiyu
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b4bcfba
编写于
11月 24, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
71c04e6e
78949122
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
139 addition
and
57 deletion
+139
-57
packages/uni-cli-shared/lib/platform.js
packages/uni-cli-shared/lib/platform.js
+5
-1
packages/vue-cli-plugin-uni/lib/mp/index.js
packages/vue-cli-plugin-uni/lib/mp/index.js
+3
-0
packages/vue-cli-plugin-uni/util/format-errors.js
packages/vue-cli-plugin-uni/util/format-errors.js
+6
-5
src/core/helpers/i18n/index.js
src/core/helpers/i18n/index.js
+1
-1
src/core/helpers/i18n/zh-Hans.json
src/core/helpers/i18n/zh-Hans.json
+1
-1
src/core/helpers/i18n/zh-Hant.json
src/core/helpers/i18n/zh-Hant.json
+1
-1
src/core/view/components/canvas/index.vue
src/core/view/components/canvas/index.vue
+4
-4
src/platforms/app-plus/service/api/context/inner-audio.js
src/platforms/app-plus/service/api/context/inner-audio.js
+11
-4
src/platforms/app-plus/service/api/plugin/sdk.js
src/platforms/app-plus/service/api/plugin/sdk.js
+1
-1
src/platforms/h5/service/api/media/choose-file.js
src/platforms/h5/service/api/media/choose-file.js
+4
-6
src/platforms/h5/service/api/media/choose-image.js
src/platforms/h5/service/api/media/choose-image.js
+4
-6
src/platforms/h5/service/api/media/choose-video.js
src/platforms/h5/service/api/media/choose-video.js
+4
-6
src/platforms/h5/view/components/ad/index.vue
src/platforms/h5/view/components/ad/index.vue
+94
-21
未找到文件。
packages/uni-cli-shared/lib/platform.js
浏览文件 @
0b4bcfba
...
...
@@ -90,7 +90,11 @@ module.exports = {
},
getMPRuntimePath
()
{
if
(
process
.
env
.
UNI_USING_VUE3
)
{
return
require
.
resolve
(
'
@dcloudio/uni-
'
+
process
.
env
.
UNI_PLATFORM
+
'
/dist/uni.mp.esm.js
'
)
try
{
return
require
.
resolve
(
'
@dcloudio/uni-
'
+
process
.
env
.
UNI_PLATFORM
+
'
/dist/uni.mp.esm.js
'
)
}
catch
(
error
)
{
throw
new
Error
(
'
Vue3 项目暂不支持当前小程序
'
)
}
}
return
require
.
resolve
(
'
@dcloudio/uni-
'
+
process
.
env
.
UNI_PLATFORM
)
},
...
...
packages/vue-cli-plugin-uni/lib/mp/index.js
浏览文件 @
0b4bcfba
...
...
@@ -195,6 +195,9 @@ module.exports = {
alias
[
'
@dcloudio/uni-app
'
]
=
require
.
resolve
(
'
@dcloudio/vue-cli-plugin-uni/packages/uni-app
'
)
}
// 使用外层依赖的版本
alias
[
'
regenerator-runtime
'
]
=
require
.
resolve
(
'
regenerator-runtime
'
)
return
{
mode
:
process
.
env
.
NODE_ENV
===
'
production
'
?
'
production
'
:
'
development
'
,
entry
()
{
...
...
packages/vue-cli-plugin-uni/util/format-errors.js
浏览文件 @
0b4bcfba
...
...
@@ -78,11 +78,11 @@ function ModuleBuildError (err) {
builtinCompile
=
'
pug/jade
'
}
if
(
builtinCompile
)
{
const
autoInstall
=
supportAutoInstallPlugin
()
autoInstall
&&
sendSignal
(
name
)
installHBuilderXPlugin
(
name
)
return
{
message
:
'
预编译器错误:代码使用了
'
+
builtinCompile
+
'
语言,但未安装相应的编译器插件,
'
+
(
autoInstall
?
'
正在从
'
:
'
请前往
'
)
+
'
插件市场安装该插件:
\n
https://ext.dcloud.net.cn/plugin?name=
'
+
'
语言,但未安装相应的编译器插件,
'
+
(
supportAutoInstallPlugin
()
?
'
正在从
'
:
'
请前往
'
)
+
'
插件市场安装该插件:
\n
https://ext.dcloud.net.cn/plugin?name=
'
+
name
}
}
...
...
@@ -98,10 +98,11 @@ function ModuleBuildError (err) {
}
function
supportAutoInstallPlugin
()
{
return
false
// 只要有 HBuilderX 版本号,就一定支持自动安装
return
!!
process
.
env
.
HX_Version
}
function
sendSignal
(
lang
)
{
function
installHBuilderXPlugin
(
lang
)
{
if
(
supportAutoInstallPlugin
())
{
return
console
.
error
(
`%HXRunUniAPPPluginName%
${
lang
}
%HXRunUniAPPPluginName%`
...
...
src/core/helpers/i18n/index.js
浏览文件 @
0b4bcfba
...
...
@@ -158,7 +158,7 @@ export function initPullToRefreshI18n (pullToRefresh) {
}
export
function
initTabBarI18n
(
tabBar
)
{
if
(
isEnableLocale
())
{
if
(
isEnableLocale
()
&&
tabBar
.
list
)
{
tabBar
.
list
.
forEach
(
item
=>
{
defineI18nProperty
(
item
,
[
'
text
'
])
})
...
...
src/core/helpers/i18n/zh-Hans.json
浏览文件 @
0b4bcfba
...
...
@@ -12,7 +12,7 @@
"uni.chooseVideo.cancel"
:
"取消"
,
"uni.chooseVideo.sourceType.album"
:
"从相册选择"
,
"uni.chooseVideo.sourceType.camera"
:
"拍摄"
,
"uni.chooseFile.notUserActivation"
:
"文件选择器对话框只能在用户激活时显示"
,
"uni.chooseFile.notUserActivation"
:
"文件选择器对话框只能在
由
用户激活时显示"
,
"uni.previewImage.cancel"
:
"取消"
,
"uni.previewImage.button.save"
:
"保存图像"
,
"uni.previewImage.save.success"
:
"保存图像到相册成功"
,
...
...
src/core/helpers/i18n/zh-Hant.json
浏览文件 @
0b4bcfba
...
...
@@ -12,7 +12,7 @@
"uni.chooseVideo.cancel"
:
"取消"
,
"uni.chooseVideo.sourceType.album"
:
"從相冊選擇"
,
"uni.chooseVideo.sourceType.camera"
:
"拍攝"
,
"uni.chooseFile.notUserActivation"
:
"文件選擇器對話框只能在用戶激活時顯示"
,
"uni.chooseFile.notUserActivation"
:
"文件選擇器對話框只能在
由
用戶激活時顯示"
,
"uni.previewImage.cancel"
:
"取消"
,
"uni.previewImage.button.save"
:
"保存圖像"
,
"uni.previewImage.save.success"
:
"保存圖像到相冊成功"
,
...
...
src/core/view/components/canvas/index.vue
浏览文件 @
0b4bcfba
...
...
@@ -446,15 +446,15 @@ export default {
callbackId
})
{
try
{
if
(
__PLATFORM__
===
'
app-plus
'
&&
compressed
)
{
const
pako
=
require
(
'
pako
'
)
data
=
pako
.
inflateRaw
(
data
)
}
if
(
!
height
)
{
height
=
Math
.
round
(
data
.
length
/
4
/
width
)
}
const
canvas
=
getTempCanvas
(
width
,
height
)
const
context
=
canvas
.
getContext
(
'
2d
'
)
if
(
__PLATFORM__
===
'
app-plus
'
&&
compressed
)
{
const
pako
=
require
(
'
pako
'
)
data
=
pako
.
inflateRaw
(
data
)
}
context
.
putImageData
(
new
ImageData
(
new
Uint8ClampedArray
(
data
),
width
,
height
),
0
,
0
)
this
.
$refs
.
canvas
.
getContext
(
'
2d
'
).
drawImage
(
canvas
,
x
,
y
,
width
,
height
)
canvas
.
height
=
canvas
.
width
=
0
...
...
src/platforms/app-plus/service/api/context/inner-audio.js
浏览文件 @
0b4bcfba
...
...
@@ -5,6 +5,8 @@ import {
import
{
publish
}
from
'
../../bridge
'
const
AUDIO_DEFAULT_CATEGORY
=
'
ambient
'
const
audios
=
{}
...
...
@@ -12,7 +14,7 @@ const evts = ['play', 'canplay', 'ended', 'stop', 'waiting', 'seeking', 'seeked'
const
publishAudioStateChange
=
(
state
,
res
=
{})
=>
publish
(
'
onAudioStateChange
'
,
Object
.
assign
({
state
},
res
))
},
res
))
const
initStateChage
=
audioId
=>
{
const
audio
=
audios
[
audioId
]
...
...
@@ -51,7 +53,8 @@ export function createAudioInstance () {
const
audio
=
audios
[
audioId
]
=
plus
.
audio
.
createPlayer
(
''
)
audio
.
src
=
''
audio
.
volume
=
1
audio
.
startTime
=
0
audio
.
startTime
=
0
audio
.
setSessionCategory
(
AUDIO_DEFAULT_CATEGORY
)
return
{
errMsg
:
'
createAudioInstance:ok
'
,
audioId
...
...
@@ -78,7 +81,8 @@ export function setAudioState ({
autoplay
=
false
,
loop
=
false
,
obeyMuteSwitch
,
volume
volume
,
category
=
AUDIO_DEFAULT_CATEGORY
})
{
const
audio
=
audios
[
audioId
]
if
(
audio
)
{
...
...
@@ -95,7 +99,10 @@ export function setAudioState ({
if
(
typeof
volume
===
'
number
'
)
{
audio
.
volume
=
style
.
volume
=
volume
}
audio
.
setStyles
(
style
)
audio
.
setStyles
(
style
)
if
(
category
)
{
audio
.
setSessionCategory
(
category
)
}
initStateChage
(
audioId
)
}
return
{
...
...
src/platforms/app-plus/service/api/plugin/sdk.js
浏览文件 @
0b4bcfba
...
...
@@ -9,7 +9,7 @@ export const sendHostEvent = sendNativeEvent
export
function
navigateToMiniProgram
(
data
,
callbackId
)
{
sendHostEvent
(
'
navigateTo
MiniProgram
'
,
'
navigateTo
UniMP
'
,
data
,
(
res
)
=>
{
if
(
res
.
errMsg
&&
res
.
errMsg
.
indexOf
(
'
:ok
'
)
===
-
1
)
{
...
...
src/platforms/h5/service/api/media/choose-file.js
浏览文件 @
0b4bcfba
...
...
@@ -57,11 +57,9 @@ export function chooseFile ({
// TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
})
if
(
interact
.
getStatus
())
{
fileInput
.
click
()
}
else
{
invoke
(
callbackId
,
{
errMsg
:
`chooseFile:fail
${
t
(
'
uni.chooseFile.notUserActivation
'
)}
`
})
fileInput
.
click
()
if
(
!
interact
.
getStatus
())
{
console
.
warn
(
`
${
t
(
'
uni.chooseFile.notUserActivation
'
)}
`
)
}
}
src/platforms/h5/service/api/media/choose-image.js
浏览文件 @
0b4bcfba
...
...
@@ -55,11 +55,9 @@ export function chooseImage ({
// TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
})
if
(
interact
.
getStatus
())
{
imageInput
.
click
()
}
else
{
invoke
(
callbackId
,
{
errMsg
:
`chooseImage:fail
${
t
(
'
uni.chooseFile.notUserActivation
'
)}
`
})
imageInput
.
click
()
if
(
!
interact
.
getStatus
())
{
console
.
warn
(
`
${
t
(
'
uni.chooseFile.notUserActivation
'
)}
`
)
}
}
src/platforms/h5/service/api/media/choose-video.js
浏览文件 @
0b4bcfba
...
...
@@ -69,11 +69,9 @@ export function chooseVideo ({
// TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
})
if
(
interact
.
getStatus
())
{
videoInput
.
click
()
}
else
{
invoke
(
callbackId
,
{
errMsg
:
`chooseVideo:fail
${
t
(
'
uni.chooseFile.notUserActivation
'
)}
`
})
videoInput
.
click
()
if
(
!
interact
.
getStatus
())
{
console
.
warn
(
`
${
t
(
'
uni.chooseFile.notUserActivation
'
)}
`
)
}
}
src/platforms/h5/view/components/ad/index.vue
浏览文件 @
0b4bcfba
...
...
@@ -252,10 +252,9 @@ class AdScript {
this
.
_cache
=
{}
}
load
(
data
,
success
,
fail
)
{
const
provider
=
data
.
provider
load
(
provider
,
script
,
success
,
fail
)
{
if
(
this
.
_cache
[
provider
]
===
undefined
)
{
this
.
loadScript
(
data
)
this
.
loadScript
(
script
)
}
if
(
this
.
_cache
[
provider
]
===
1
)
{
...
...
@@ -271,12 +270,10 @@ class AdScript {
}
}
loadScript
(
data
)
{
const
provider
=
data
.
provider
loadScript
(
provider
,
script
)
{
this
.
_cache
[
provider
]
=
0
var
ads
=
document
.
createElement
(
'
script
'
)
ads
.
setAttribute
(
'
id
'
,
'
uniad_provider
'
+
provider
)
const
script
=
data
.
script
for
(
const
var1
in
script
)
{
ads
.
setAttribute
(
var1
,
script
[
var1
])
}
...
...
@@ -298,6 +295,59 @@ class AdScript {
}
}
class
AdTencent
{
static
get
instance
()
{
if
(
this
.
_instance
==
null
)
{
this
.
_instance
=
new
AdTencent
()
}
return
this
.
_instance
}
constructor
()
{
this
.
_instance
=
null
this
.
_callback
=
{}
this
.
_cache
=
{}
window
.
TencentGDT
=
window
.
TencentGDT
||
[]
}
load
(
appid
,
placementid
,
success
,
fail
)
{
if
(
!
this
.
_callback
[
placementid
])
{
this
.
_callback
[
placementid
]
=
[]
}
this
.
_callback
[
placementid
].
push
({
success
,
fail
})
if
(
!
this
.
_cache
[
placementid
])
{
this
.
_cache
[
placementid
]
=
{
isReady
:
false
}
window
.
TencentGDT
.
push
({
app_id
:
appid
,
placement_id
:
placementid
,
type
:
'
native
'
,
count
:
1
,
onComplete
:
(
res
)
=>
{
this
.
_cache
[
placementid
].
isReady
=
true
this
.
_callback
[
placementid
].
forEach
(({
success
,
fail
})
=>
{
if
(
res
&&
Array
.
isArray
(
res
)
&&
res
.
length
)
{
success
(
res
[
0
])
}
else
{
fail
(
res
)
}
this
.
_callback
[
placementid
].
length
=
0
})
}
})
}
if
(
this
.
_cache
[
placementid
].
isReady
===
true
)
{
window
.
TencentGDT
.
NATIVE
.
loadAd
(
placementid
)
}
}
}
const
CHECK_RENDER_DELAY
=
1000
const
CHECK_RENDER_RETRY
=
5
const
DEFAULT_WIDESCREEN_WIDTH
=
750
...
...
@@ -361,10 +411,12 @@ export default {
this
.
_pi
=
0
this
.
_clearCheckTimer
()
this
.
$refs
.
container
.
innerHTML
=
''
this
.
_isReady
=
false
},
_loadData
(
adpid
)
{
this
.
_reset
()
const
aid
=
adpid
||
(
this
.
_isWidescreen
?
this
.
adpidWidescreen
:
this
.
adpid
)
const
id
=
adpid
||
this
.
adpid
const
aid
=
(
this
.
_isWidescreen
?
(
this
.
adpidWidescreen
||
id
)
:
id
)
AdConfig
.
instance
.
get
(
aid
,
(
b
,
a
)
=>
{
this
.
_b
=
b
this
.
_pl
=
a
...
...
@@ -379,26 +431,47 @@ export default {
}
const
data
=
this
.
_pl
[
this
.
_pi
]
const
providerId
=
data
.
a1
this
.
_b
[
providerId
].
provider
=
providerId
const
providerConfig
=
this
.
_b
[
data
.
a1
][
data
.
t
]
AdScript
.
instance
.
load
(
this
.
_b
[
providerId
],
()
=>
{
this
.
_renderAdView
(
this
.
_b
[
providerId
],
data
)
},
(
err
)
=>
{
this
.
$trigger
(
'
error
'
,
{},
err
)
})
},
_renderAdView
(
provider
,
data
)
{
var
randomId
=
this
.
_randomId
()
if
(
data
.
a1
===
'
10011
'
)
{
AdTencent
.
instance
.
load
(
data
.
a3
,
data
.
a2
,
(
res
)
=>
{
window
.
TencentGDT
.
NATIVE
.
renderAd
(
res
,
randomId
)
})
this
.
_startCheckTimer
()
}
else
if
(
data
.
a1
===
'
10012
'
)
{
this
.
_renderAdView
(
providerConfig
,
data
,
randomId
)
}
else
{
AdScript
.
instance
.
load
(
data
.
t
,
providerConfig
.
script
,
()
=>
{
this
.
_renderAdView
(
providerConfig
,
data
,
randomId
)
},
(
err
)
=>
{
this
.
$trigger
(
'
error
'
,
{},
err
)
})
}
},
_renderAdView
(
providerConfig
,
data
,
randomId
)
{
var
adView
=
document
.
createElement
(
'
div
'
)
adView
.
setAttribute
(
'
class
'
,
randomId
)
adView
.
setAttribute
(
'
id
'
,
randomId
)
this
.
$refs
.
container
.
innerHTML
=
''
this
.
$refs
.
container
.
append
(
adView
)
let
bindThis
=
window
provider
.
s
.
split
(
'
.
'
).
reduce
((
total
,
currentValue
)
=>
{
bindThis
=
total
return
total
[
currentValue
]
},
window
).
bind
(
bindThis
)(
data
.
a2
,
randomId
,
2
)
if
(
data
.
a1
===
'
10011
'
)
{
}
else
if
(
data
.
a1
===
'
10012
'
)
{
var
adScript
=
document
.
createElement
(
'
script
'
)
const
script
=
providerConfig
.
script
for
(
const
var1
in
script
)
{
adScript
.
setAttribute
(
var1
,
script
[
var1
])
}
adView
.
appendChild
(
adScript
)
}
else
{
let
bindThis
=
window
providerConfig
.
s
.
split
(
'
.
'
).
reduce
((
total
,
currentValue
)
=>
{
bindThis
=
total
return
total
[
currentValue
]
},
window
).
bind
(
bindThis
)(
data
.
a2
,
randomId
,
2
)
}
this
.
_startCheckTimer
()
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录