Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
luomor
uni-app
提交
6934b710
uni-app
项目概览
luomor
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6934b710
编写于
4月 01, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
57ef7f7b
489abe85
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
84 addition
and
44 deletion
+84
-44
package.json
package.json
+2
-1
packages/uni-cli-shared/template/common/__uniapppicker.js
packages/uni-cli-shared/template/common/__uniapppicker.js
+1
-1
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
+5
-5
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+15
-5
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/main.js
...i-plugin-uni/packages/webpack-uni-app-loader/view/main.js
+1
-1
packages/webpack-uni-pages-loader/lib/platforms/app-plus/app-config-service.js
...pages-loader/lib/platforms/app-plus/app-config-service.js
+3
-2
src/core/service/api/context/create-map-context.js
src/core/service/api/context/create-map-context.js
+1
-5
src/core/view/mixins/keyboard.js
src/core/view/mixins/keyboard.js
+5
-2
src/platforms/app-plus/service/api/ad/rewarded-video-ad.js
src/platforms/app-plus/service/api/ad/rewarded-video-ad.js
+14
-10
src/platforms/app-plus/service/api/location/open-location-weex.js
...forms/app-plus/service/api/location/open-location-weex.js
+13
-2
src/platforms/app-plus/service/on-web-invoke-app-service.js
src/platforms/app-plus/service/on-web-invoke-app-service.js
+1
-1
src/platforms/app-plus/view/components/map/index.vue
src/platforms/app-plus/view/components/map/index.vue
+5
-2
src/platforms/h5/helpers/get-real-path.js
src/platforms/h5/helpers/get-real-path.js
+10
-3
src/platforms/h5/view/components/map/index.vue
src/platforms/h5/view/components/map/index.vue
+5
-3
src/platforms/h5/view/components/picker/index.vue
src/platforms/h5/view/components/picker/index.vue
+3
-1
未找到文件。
package.json
浏览文件 @
6934b710
...
...
@@ -108,7 +108,8 @@
"my"
:
true
,
"swan"
:
true
,
"tt"
:
true
,
"qh"
:
true
,
"qh"
:
true
,
"qa"
:
true
,
"weex"
:
true
,
"__id__"
:
true
,
"__uniConfig"
:
true
,
...
...
packages/uni-cli-shared/template/common/__uniapppicker.js
浏览文件 @
6934b710
此差异已折叠。
点击以展开。
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
浏览文件 @
6934b710
...
...
@@ -97,7 +97,7 @@ const plugins = [
new
WebpackAppPlusNVuePlugin
()
]
const
excludeModuleReg
=
/node_modules
(?!(\/
|
\\)
.*
(
weex
)
.*
)
/
//
const excludeModuleReg = /node_modules(?!(\/|\\).*(weex).*)/
const
rules
=
[{
test
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
pages.json
'
),
...
...
@@ -119,10 +119,10 @@ const rules = [{
}
},
jsPreprocessorLoader
]
,
exclude
(
modulePath
)
{
return
excludeModuleReg
.
test
(
modulePath
)
&&
modulePath
.
indexOf
(
'
@dcloudio
'
)
===
-
1
}
]
// exclude (modulePath) { // nvue js均提供babel,否则还得提供transpileDependencies配置
//
return excludeModuleReg.test(modulePath) && modulePath.indexOf('@dcloudio') === -1
//
}
},
{
test
:
[
/
\.
nvue
(\?[^
?
]
+
)?
$/
,
/
\.
vue
(\?[^
?
]
+
)?
$/
],
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
6934b710
...
...
@@ -3,6 +3,12 @@ const path = require('path')
const
mkdirp
=
require
(
'
mkdirp
'
)
const
loaderUtils
=
require
(
'
loader-utils
'
)
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
function
hasOwn
(
obj
,
key
)
{
return
hasOwnProperty
.
call
(
obj
,
key
)
}
process
.
UNI_CLOUD
=
false
process
.
UNI_CLOUD_TCB
=
false
process
.
UNI_CLOUD_ALIYUN
=
false
...
...
@@ -124,7 +130,7 @@ process.UNI_STAT_CONFIG = {
// 默认启用 自定义组件模式
// if (isInHBuilderXAlpha) {
let
usingComponentsAbsent
=
false
if
(
!
platformOptions
.
hasOwnProperty
(
'
usingComponents
'
))
{
if
(
!
hasOwn
(
platformOptions
,
'
usingComponents
'
))
{
usingComponentsAbsent
=
true
}
platformOptions
.
usingComponents
=
true
...
...
@@ -173,12 +179,15 @@ if (process.env.UNI_PLATFORM === 'app-plus') {
isNVueCompiler
=
false
}
if
(
platformOptions
.
compilerVersion
===
'
3
'
||
platformOptions
.
compilerVersion
===
3
!
hasOwn
(
platformOptions
,
'
compilerVersion
'
)
||
// 默认v3
(
platformOptions
.
compilerVersion
===
'
3
'
||
platformOptions
.
compilerVersion
===
3
)
)
{
delete
process
.
env
.
UNI_USING_CACHE
if
(
platformOptions
.
renderer
===
'
native
'
)
{
process
.
env
.
UNI_USING_V3_NATIVE
=
true
process
.
env
.
UNI_USING_V3_NATIVE
=
true
}
else
{
process
.
env
.
UNI_USING_V3
=
true
platformOptions
.
usingComponents
=
true
...
...
@@ -269,7 +278,8 @@ const needWarning = !platformOptions.usingComponents || usingComponentsAbsent
let
hasNVue
=
false
// 输出编译器版本等信息
if
(
process
.
env
.
UNI_USING_NATIVE
||
process
.
env
.
UNI_USING_V3_NATIVE
)
{
console
.
log
(
'
当前nvue编译模式
'
+
(
process
.
env
.
UNI_USING_V3_NATIVE
?
'
(v3)
'
:
''
)
+
'
:
'
+
(
isNVueCompiler
?
'
uni-app
'
:
'
weex
'
)
+
console
.
log
(
'
当前nvue编译模式
'
+
(
process
.
env
.
UNI_USING_V3_NATIVE
?
'
(v3)
'
:
''
)
+
'
:
'
+
(
isNVueCompiler
?
'
uni-app
'
:
'
weex
'
)
+
'
。编译模式差异见:https://ask.dcloud.net.cn/article/36074
'
)
}
else
if
(
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
&&
process
.
env
.
UNI_PLATFORM
!==
'
quickapp
'
)
{
try
{
...
...
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/main.js
浏览文件 @
6934b710
...
...
@@ -92,7 +92,7 @@ function getStylesCode(loaderContext) {
'
app-vue
'
)
}
return
stylesCode
.
replace
(
/main
\.
j
s/g
,
'
App.vue
'
)
return
stylesCode
.
replace
(
/main
\.
[
jt
]
s/g
,
'
App.vue
'
)
}
module
.
exports
=
function
(
source
,
map
)
{
...
...
packages/webpack-uni-pages-loader/lib/platforms/app-plus/app-config-service.js
浏览文件 @
6934b710
...
...
@@ -42,7 +42,8 @@ var isReady=false;var onReadyCallbacks=[];
var __uniConfig =
${
JSON
.
stringify
(
appJson
,
null
)}
;
var __uniRoutes =
${
JSON
.
stringify
(
__uniRoutes
)}
;
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,window:void 0}}}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,window:void 0
,global:void 0
}}}});
`
}
}
}
src/core/service/api/context/create-map-context.js
浏览文件 @
6934b710
...
...
@@ -18,17 +18,13 @@ UniServiceJSBridge.subscribe('onMapMethodCallback', ({
callback
.
invoke
(
callbackId
,
data
)
})
const
methods
=
[
'
getCenterLocation
'
,
'
getScale
'
,
'
getRegion
'
,
'
includePoints
'
,
'
translateMarker
'
]
const
methods
=
[
'
getCenterLocation
'
,
'
moveToLocation
'
,
'
getScale
'
,
'
getRegion
'
,
'
includePoints
'
,
'
translateMarker
'
]
export
class
MapContext
{
constructor
(
id
,
pageVm
)
{
this
.
id
=
id
this
.
pageVm
=
pageVm
}
moveToLocation
()
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
moveToLocation
'
)
}
}
MapContext
.
prototype
.
$getAppMap
=
function
()
{
...
...
src/core/view/mixins/keyboard.js
浏览文件 @
6934b710
...
...
@@ -44,7 +44,10 @@ export default {
methods
:
{
initKeyboard
(
el
)
{
el
.
addEventListener
(
'
focus
'
,
()
=>
{
UniViewJSBridge
.
subscribe
(
'
hideKeyboard
'
,
hideKeyboard
)
this
.
hideKeyboardTemp
=
function
()
{
hideKeyboard
()
}
UniViewJSBridge
.
subscribe
(
'
hideKeyboard
'
,
this
.
hideKeyboardTemp
)
document
.
addEventListener
(
'
click
'
,
iosHideKeyboard
,
false
)
this
.
setSoftinputNavBar
()
this
.
setSoftinputTemporary
()
...
...
@@ -101,7 +104,7 @@ export default {
}
},
onKeyboardHide
()
{
UniViewJSBridge
.
unsubscribe
(
'
hideKeyboard
'
,
hideKeyboard
)
UniViewJSBridge
.
unsubscribe
(
'
hideKeyboard
'
,
this
.
hideKeyboardTemp
)
document
.
removeEventListener
(
'
click
'
,
iosHideKeyboard
,
false
)
this
.
resetSoftinputNavBar
()
}
...
...
src/platforms/app-plus/service/api/ad/rewarded-video-ad.js
浏览文件 @
6934b710
...
...
@@ -2,17 +2,14 @@
const
eventNames
=
[
'
load
'
,
'
close
'
,
'
verify
'
,
'
error
'
]
const
ERROR_CODE_LIST
=
[
-
5001
,
-
5002
,
-
5003
,
-
5004
,
-
5005
,
-
5006
]
class
RewardedVideoAd
{
constructor
(
adpid
)
{
this
.
_options
=
{
adpid
:
adpid
}
constructor
(
options
=
{})
{
const
_callbacks
=
this
.
_callbacks
=
{}
eventNames
.
forEach
(
item
=>
{
_callbacks
[
item
]
=
[]
...
...
@@ -26,7 +23,7 @@ class RewardedVideoAd {
this
.
_adError
=
''
this
.
_loadPromiseResolve
=
null
this
.
_loadPromiseReject
=
null
const
rewardAd
=
this
.
_rewardAd
=
plus
.
ad
.
createRewardedVideoAd
(
this
.
_
options
)
const
rewardAd
=
this
.
_rewardAd
=
plus
.
ad
.
createRewardedVideoAd
(
options
)
rewardAd
.
onLoad
((
e
)
=>
{
this
.
_isLoad
=
true
this
.
_dispatchEvent
(
'
load
'
,
{})
...
...
@@ -39,6 +36,9 @@ class RewardedVideoAd {
this
.
_loadAd
()
this
.
_dispatchEvent
(
'
close
'
,
{
isEnded
:
e
.
isEnded
})
})
rewardAd
.
onVerify
((
e
)
=>
{
this
.
_dispatchEvent
(
'
verify
'
,
{
isValid
:
e
.
isValid
})
})
rewardAd
.
onError
((
e
)
=>
{
const
{
code
,
message
}
=
e
const
data
=
{
code
:
code
,
errMsg
:
message
}
...
...
@@ -72,6 +72,12 @@ class RewardedVideoAd {
}
})
}
getProvider
()
{
return
this
.
_rewardAd
.
getProvider
()
}
destroy
()
{
this
.
_rewardAd
.
destroy
()
}
_loadAd
()
{
this
.
_isLoad
=
false
this
.
_rewardAd
.
load
()
...
...
@@ -85,8 +91,6 @@ class RewardedVideoAd {
}
}
export
function
createRewardedVideoAd
({
adpid
=
''
}
=
{})
{
return
new
RewardedVideoAd
(
adpid
)
export
function
createRewardedVideoAd
(
options
)
{
return
new
RewardedVideoAd
(
options
)
}
src/platforms/app-plus/service/api/location/open-location-weex.js
浏览文件 @
6934b710
import
{
invoke
}
from
'
../../bridge
'
import
{
showPage
}
from
'
../page.js
'
export
function
openLocation
(
data
)
{
export
function
openLocation
(
data
,
callbackId
)
{
showPage
({
url
:
'
__uniappopenlocation
'
,
data
,
style
:
{
titleNView
:
{
type
:
'
transparent
'
}
},
popGesture
:
'
close
'
,
backButtonAutoControl
:
'
close
'
},
onClose
()
{
invoke
(
callbackId
,
{
errMsg
:
'
openLocation:fail cancel
'
})
}
})
return
{
...
...
src/platforms/app-plus/service/on-web-invoke-app-service.js
浏览文件 @
6934b710
...
...
@@ -5,7 +5,7 @@ function onMessage (pageId, arg) {
return
}
if
(
!
page
.
$page
.
meta
.
isNVue
)
{
const
target
=
page
.
$vm
.
_$vd
.
elements
.
find
(
target
=>
target
.
t
agNam
e
===
'
web-view
'
&&
target
.
events
[
'
message
'
])
const
target
=
page
.
$vm
.
_$vd
.
elements
.
find
(
target
=>
target
.
t
yp
e
===
'
web-view
'
&&
target
.
events
[
'
message
'
])
if
(
!
target
)
{
return
}
...
...
src/platforms/app-plus/view/components/map/index.vue
浏览文件 @
6934b710
...
...
@@ -229,8 +229,11 @@ export default {
}
this
.
map
&&
this
[
type
](
data
)
},
moveToLocation
(
data
)
{
this
.
map
.
setCenter
(
new
plus
.
maps
.
Point
(
this
.
longitude
,
this
.
latitude
))
moveToLocation
({
callbackId
,
longitude
,
latitude
})
{
this
.
map
.
setCenter
(
new
plus
.
maps
.
Point
(
longitude
||
this
.
longitude
,
latitude
||
this
.
latitude
))
this
.
_publishHandler
(
callbackId
,
{
errMsg
:
'
moveToLocation:ok
'
})
},
getCenterLocation
({
callbackId
})
{
const
center
=
this
.
map
.
getCenter
()
...
...
src/platforms/h5/helpers/get-real-path.js
浏览文件 @
6934b710
...
...
@@ -4,10 +4,17 @@ const SCHEME_RE = /^([a-z-]+:)?\/\//i
const
DATA_RE
=
/^data:.*,.*/
function
addBase
(
filePath
)
{
if
(
__uniConfig
.
router
.
base
)
{
return
__uniConfig
.
router
.
base
+
filePath
const
base
=
__uniConfig
.
router
.
base
if
(
!
base
)
{
return
filePath
}
return
filePath
if
(
base
!==
'
/
'
)
{
// 部分地址已经带了base(如被webpack处理过的资源自动带了publicPath)
if
((
'
/
'
+
filePath
).
indexOf
(
base
)
===
0
)
{
return
'
/
'
+
filePath
}
}
return
base
+
filePath
}
export
default
function
getRealPath
(
filePath
)
{
...
...
src/platforms/h5/view/components/map/index.vue
浏览文件 @
6934b710
...
...
@@ -348,10 +348,12 @@ export default {
})
})
break
case
'
moveToLocation
'
:
var
locationPosition
=
this
.
_locationPosition
case
'
moveToLocation
'
:
const
{
latitude
,
longitude
}
=
data
var
locationPosition
=
(
latitude
&&
longitude
)
?
new
maps
.
LatLng
(
latitude
,
longitude
)
:
this
.
_locationPosition
if
(
locationPosition
)
{
this
.
_map
.
setCenter
(
locationPosition
)
this
.
_map
.
setCenter
(
locationPosition
)
callback
({})
}
break
case
'
translateMarker
'
:
...
...
src/platforms/h5/view/components/picker/index.vue
浏览文件 @
6934b710
...
...
@@ -353,7 +353,9 @@ export default {
}
const
length
=
this
.
valueSync
.
length
=
Math
.
max
(
val
.
length
,
this
.
range
.
length
)
for
(
let
index
=
0
;
index
<
length
;
index
++
)
{
this
.
valueSync
.
splice
(
index
,
1
,
Number
(
val
[
index
])
||
Number
(
this
.
valueSync
[
index
])
||
0
)
const
val0
=
Number
(
val
[
index
])
const
val1
=
Number
(
this
.
valueSync
[
index
])
this
.
valueSync
.
splice
(
index
,
1
,
isNaN
(
val0
)
?
(
isNaN
(
val1
)
?
0
:
val1
)
:
val0
)
}
break
case
mode
.
TIME
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录