Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
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
bp
ShenghuoquanBusiness
Commits
0791daf6
Commit
0791daf6
authored
Jul 09, 2021
by
shiyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通过XBrid调用原生页面
parent
dfa96cc3
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
76 additions
and
51 deletions
+76
-51
YdBaseApplication.kt
...mmon/src/main/java/com/yidian/common/YdBaseApplication.kt
+5
-4
CommodityApplication.kt
...yidian/shenghuoquan/commodity/app/CommodityApplication.kt
+6
-0
CategoryListDto.kt
.../com/yidian/shenghuoquan/commodity/dto/CategoryListDto.kt
+4
-4
SelectCategoryService.kt
...n/shenghuoquan/commodity/service/SelectCategoryService.kt
+15
-6
ChooseCategoryActivity.kt
...henghuoquan/commodity/ui/coupon/ChooseCategoryActivity.kt
+9
-3
ChooseCategoryViewModel.kt
...enghuoquan/commodity/ui/coupon/ChooseCategoryViewModel.kt
+2
-2
PublishCouponsActivity.kt
...henghuoquan/commodity/ui/coupon/PublishCouponsActivity.kt
+1
-3
AndroidManifest.xml
Components/commodity/src/main/manifest/AndroidManifest.xml
+23
-23
SelectStoreService.kt
...an/shenghuoquan/newscontent/service/SelectStoreService.kt
+7
-3
FlashActivity.kt
...a/com/yidian/shenghuoquan/newscontent/ui/FlashActivity.kt
+2
-1
ChooseStoreActivity.kt
.../shenghuoquan/newscontent/ui/store/ChooseStoreActivity.kt
+1
-1
activity_choose_store.xml
...newscontent/src/main/res/layout/activity_choose_store.xml
+1
-0
build.gradle
app/build.gradle
+0
-1
No files found.
CommonLib/Common/src/main/java/com/yidian/common/YdBaseApplication.kt
View file @
0791daf6
...
...
@@ -5,7 +5,6 @@ import android.app.Application
import
android.content.Context
import
android.content.res.Configuration
import
android.os.Bundle
import
android.util.Log
import
com.orhanobut.hawk.Hawk
import
com.scwang.smart.refresh.footer.ClassicsFooter
import
com.scwang.smart.refresh.header.ClassicsHeader
...
...
@@ -171,16 +170,18 @@ open class YdBaseApplication : Application() {
response
:
Response
// 业务方需要借助 response 来回应服务调用结果
)
{
val
data
=
request
.
params
as
JSONObject
Log
.
e
(
"zhb-yd"
,
"服务名:"
+
request
.
name
)
Log
.
e
(
"zhb-yd"
,
"JS传递参数:$data"
)
// JS调用Native传递的数据
Timber
.
tag
(
"xbrid"
).
e
(
"服务名:%s"
,
request
.
name
)
Timber
.
tag
(
"xbrid"
).
e
(
"JS传递参数:%s"
,
data
)
val
action
=
data
.
optString
(
"action"
)
val
params
=
data
.
optJSONObject
(
"params"
)
val
options
=
data
.
optJSONObject
(
"options"
)
// Native调用JS传递的数据
ZapTicket
(
request
.
name
).
withAction
(
action
).
withServiceParams
(
params
).
withServiceOptions
(
options
).
withIdentifier
(
identifier
)
.
onResult
{
result
->
response
.
result
(
result
.
code
,
result
.
result
!!
,
""
)
response
.
result
(
result
.
code
,
result
.
result
?:
""
,
""
)
}.
onLost
{
result
->
response
.
result
(
result
.
code
,
""
,
result
.
mesg
)
}.
ship
()
...
...
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/app/CommodityApplication.kt
View file @
0791daf6
...
...
@@ -5,12 +5,16 @@ import com.yidian.common.XRouterPathConstants
import
com.yidian.common.YdBaseApplication
import
com.yidian.news.util.ProcessUtil
import
com.yidian.shenghuoquan.commodity.service.SelectCategoryService
import
com.yidian.shenghuoquan.commodity.ui.coupon.ChooseCategoryActivity
import
com.yidian.shenghuoquan.commodity.ui.coupon.CommodityManagementActivity
import
com.yidian.shenghuoquan.commodity.ui.coupon.PublishCouponsActivity
import
com.yidian.xpage.XPageManager
import
com.yidian.xpage.node.XPageHandler
import
com.yidian.xpage.node.XPageNode
import
com.yidian.xpage.node.XPageNodePageType
import
com.yidian.yac.core.core.YacModuleSpec
import
com.yidian.yac.core.zap.Zap
import
timber.log.Timber
@YacModuleSpec
class
CommodityApplication
:
YdBaseApplication
()
{
...
...
@@ -18,6 +22,7 @@ class CommodityApplication : YdBaseApplication() {
override
fun
onCreate
()
{
super
.
onCreate
()
if
(
ProcessUtil
.
isMainProcess
(
this
))
{
Timber
.
tag
(
"注册"
).
e
(
"开始注册"
)
registerXPage
()
initService
()
}
...
...
@@ -37,6 +42,7 @@ class CommodityApplication : YdBaseApplication() {
}
})
XPageManager
.
registeredNode
(
node
)
Timber
.
e
(
"注册XPage ${it.key}"
)
}
}
...
...
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/dto/CategoryListDto.kt
View file @
0791daf6
...
...
@@ -5,13 +5,13 @@ package com.yidian.shenghuoquan.commodity.dto
* 类目列表
*/
data class
CategoryListDto
(
val
category_id
:
Int
,
// 分类id
val
category_id
:
Long
,
// 分类id
val
name
:
String
,
// 分类名称
val
sub_list
:
List
<
SubCategory
>
// 二级分类
)
data class
SubCategory
(
val
category_id
:
Int
,
val
category_id
:
Long
,
val
name
:
String
,
var
isSelect
:
Boolean
=
false
)
...
...
@@ -20,8 +20,8 @@ data class SubCategory(
* 当前选中的类目信息
*/
data class
SelectCategoryDto
(
val
firstCategoryId
:
Int
,
val
firstCategoryId
:
Long
,
val
firstCategoryName
:
String
,
val
secondCategoryId
:
Int
,
val
secondCategoryId
:
Long
,
val
secondCategoryName
:
String
)
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/service/SelectCategoryService.kt
View file @
0791daf6
...
...
@@ -35,13 +35,22 @@ class SelectCategoryService : ZapService() {
*/
private
fun
gotoSelectCategory
(
params
:
JSONObject
)
{
val
lastSelectCategory
=
params
.
optJSONObject
(
"selectedCategory"
)
if
(
lastSelectCategory
==
null
)
{
XPageManager
.
push
(
XRouterPathConstants
.
CHOOSE_CATEGORY_ACTIVITY
,
null
)
}
else
{
val
map
=
HashMap
<
String
,
Any
?>()
map
[
ChooseCategoryActivity
.
lastSelectCategoryKey
]
=
lastSelectCategory
lastSelectCategory
?.
let
{
val
firstCategoryId
=
it
.
optLong
(
"firstCategoryId"
)
val
firstCategoryName
=
it
.
optString
(
"firstCategoryName"
)
val
secondCategoryId
=
it
.
optLong
(
"secondCategoryId"
)
val
secondCategoryName
=
it
.
optString
(
"secondCategoryName"
)
if
(
firstCategoryId
==
0L
||
firstCategoryName
.
isNullOrBlank
()
||
secondCategoryId
==
0L
||
secondCategoryName
.
isNullOrBlank
())
{
XPageManager
.
push
(
XRouterPathConstants
.
CHOOSE_CATEGORY_ACTIVITY
,
null
)
return
}
val
map
=
HashMap
<
String
,
Any
>()
map
[
ChooseCategoryActivity
.
firstCategoryId
]
=
firstCategoryId
map
[
ChooseCategoryActivity
.
firstCategoryName
]
=
firstCategoryName
map
[
ChooseCategoryActivity
.
secondCategoryId
]
=
secondCategoryId
map
[
ChooseCategoryActivity
.
secondCategoryName
]
=
secondCategoryName
XPageManager
.
push
(
XRouterPathConstants
.
CHOOSE_CATEGORY_ACTIVITY
,
map
)
}
}
?:
XPageManager
.
push
(
XRouterPathConstants
.
CHOOSE_CATEGORY_ACTIVITY
,
null
)
}
@Subscribe
(
sticky
=
false
,
threadMode
=
ThreadMode
.
MAIN
)
...
...
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/ui/coupon/ChooseCategoryActivity.kt
View file @
0791daf6
...
...
@@ -50,8 +50,11 @@ class ChooseCategoryActivity : BaseMvvmActivity<CommodityActivityChooseCategoryB
val
paramsMap
=
intent
?.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
paramsMap
?.
let
{
it
as
HashMap
<*,
*>
val
selectCategoryDto
=
it
[
lastSelectCategoryKey
]
as
SelectCategoryDto
vm
.
setLastSelected
(
selectCategoryDto
)
val
firstId
=
it
[
firstCategoryId
]
as
Long
val
firstName
=
it
[
firstCategoryName
]
as
String
val
secondId
=
it
[
secondCategoryId
]
as
Long
val
secondName
=
it
[
secondCategoryName
]
as
String
vm
.
setLastSelected
(
SelectCategoryDto
(
firstId
,
firstName
,
secondId
,
secondName
))
}
}
...
...
@@ -131,7 +134,10 @@ class ChooseCategoryActivity : BaseMvvmActivity<CommodityActivityChooseCategoryB
}
companion
object
{
const
val
lastSelectCategoryKey
=
"lastSelectCategory"
const
val
firstCategoryId
=
"firstCategoryId"
const
val
firstCategoryName
=
"firstCategoryName"
const
val
secondCategoryId
=
"secondCategoryId"
const
val
secondCategoryName
=
"secondCategoryName"
}
}
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/ui/coupon/ChooseCategoryViewModel.kt
View file @
0791daf6
...
...
@@ -22,11 +22,11 @@ class ChooseCategoryViewModel : BaseViewModel() {
// 选择的一级类目名称
var
selectFirstCategoryName
=
MutableLiveData
<
String
>()
var
selectFirstCategoryId
=
MutableLiveData
<
Int
>()
var
selectFirstCategoryId
=
MutableLiveData
<
Long
>()
// 选择的二级类目名称
var
selectSecondCategoryName
=
MutableLiveData
<
String
>()
var
selectSecondCategoryId
=
MutableLiveData
<
Int
>()
var
selectSecondCategoryId
=
MutableLiveData
<
Long
>()
var
selectedCategory
=
MutableLiveData
<
SelectCategoryDto
?>(
null
)
/**
...
...
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/ui/coupon/PublishCouponsActivity.kt
View file @
0791daf6
...
...
@@ -53,9 +53,7 @@ class PublishCouponsActivity : BaseMvvmActivity<CommodityActivityPublishCouponsB
"xbrid_coupon_publish?life_account_id=$lifeAccountId"
}
// webView.loadUrl(webUrl)
// webView.loadUrl("http://10.60.102.66:8080")
webView
.
loadUrl
(
"http://10.60.100.85:8080"
)
// webView.loadUrl("https://www.baidu.com")
webView
.
loadUrl
(
"http://10.60.102.66:8080"
)
webView
.
webChromeClient
=
object
:
WebChromeClient
()
{
override
fun
onProgressChanged
(
view
:
WebView
?,
newProgress
:
Int
)
{
super
.
onProgressChanged
(
view
,
newProgress
)
...
...
Components/commodity/src/main/manifest/AndroidManifest.xml
View file @
0791daf6
...
...
@@ -3,30 +3,30 @@
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.yidian.shenghuoquan.commodity"
>
<application
android:name=
".app.CommodityApplication"
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:label=
"商品组件"
android:networkSecurityConfig=
"@xml/network_security_config"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:theme=
"@style/AppTheme"
tools:replace=
"android:allowBackup,android:label"
tools:targetApi=
"n"
>
<!-- <application-->
<!-- android:name=".app.CommodityApplication"-->
<!-- android:allowBackup="true"-->
<!-- android:icon="@mipmap/ic_launcher"-->
<!-- android:label="商品组件"-->
<!-- android:networkSecurityConfig="@xml/network_security_config"-->
<!-- android:roundIcon="@mipmap/ic_launcher_round"-->
<!-- android:theme="@style/AppTheme"-->
<!-- tools:replace="android:allowBackup,android:label"-->
<!-- tools:targetApi="n">--
>
<activity
android:name=
".ui.coupon.ChooseCategoryActivity"
android:theme=
"@style/FlashTheme"
>
<intent-filter
>
<action
android:name=
"android.intent.action.VIEW"
/
>
<action
android:name=
"android.intent.action.MAIN"
/
>
<!-- <activity-->
<!-- android:name=".ui.coupon.ChooseCategoryActivity"-->
<!-- android:theme="@style/FlashTheme">--
>
<!-- <intent-filter>--
>
<!-- <action android:name="android.intent.action.VIEW" />--
>
<!-- <action android:name="android.intent.action.MAIN" />--
>
<category
android:name=
"android.intent.category.LAUNCHER"
/
>
</intent-filter
>
</activity
>
<activity
android:name=
".ui.coupon.CategorySearchActivity"
android:windowSoftInputMode=
"adjustPan"
/
>
</application
>
<!-- <category android:name="android.intent.category.LAUNCHER" />--
>
<!-- </intent-filter>--
>
<!-- </activity>--
>
<!-- <activity-->
<!-- android:name=".ui.coupon.CategorySearchActivity"-->
<!-- android:windowSoftInputMode="adjustPan" />--
>
<!-- </application>--
>
</manifest>
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/service/SelectStoreService.kt
View file @
0791daf6
...
...
@@ -35,12 +35,16 @@ class SelectStoreService : ZapService() {
* 选择门店
*/
private
fun
gotoSelectStore
(
params
:
JSONObject
)
{
val
lastSelectStore
=
params
.
optJSONArray
(
"selectedStore"
)
if
(
lastSelectStore
==
null
)
{
val
lastSelectStore
Array
=
params
.
optJSONArray
(
"selectedStore"
)
if
(
lastSelectStore
Array
==
null
||
lastSelectStoreArray
.
length
()
<=
0
)
{
XPageManager
.
push
(
XRouterPathConstants
.
CHOOSE_STORE_ACTIVITY
,
null
)
}
else
{
val
list
=
mutableListOf
<
String
>()
for
(
i
in
0
until
lastSelectStoreArray
.
length
())
{
list
.
add
(
lastSelectStoreArray
.
getString
(
i
))
}
val
map
=
HashMap
<
String
,
Any
?>()
map
[
ChooseStoreActivity
.
lastSelectStoreKey
]
=
l
astSelectStore
map
[
ChooseStoreActivity
.
lastSelectStoreKey
]
=
l
ist
XPageManager
.
push
(
XRouterPathConstants
.
CHOOSE_STORE_ACTIVITY
,
map
)
}
}
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/FlashActivity.kt
View file @
0791daf6
...
...
@@ -34,7 +34,8 @@ class FlashActivity : BaseActivity<ActivityFlashBinding>(), IGetLifeAccountListC
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
getPermissions
()
XPageManager
.
push
(
XRouterPathConstants
.
PUBLISH_COUPONS_ACTIVITY
,
null
)
// getPermissions()
}
private
fun
launcher
()
{
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/store/ChooseStoreActivity.kt
View file @
0791daf6
...
...
@@ -88,7 +88,7 @@ class ChooseStoreActivity : BaseActivity<ActivityChooseStoreBinding>() {
XPageManager
.
pop
(
null
)
}
viewBind
.
include
.
tvMenu
.
text
=
"新增门店"
viewBind
.
include
.
tvMenu
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
color_
66
1852F1
))
viewBind
.
include
.
tvMenu
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
color_1852F1
))
viewBind
.
include
.
tvMenu
.
clickAntiShake
{
val
intent
=
Intent
(
this
,
EditStoreActivity
::
class
.
java
)
intent
.
putExtra
(
"from"
,
EditStoreActivity
.
fromAddStore
)
...
...
Components/newscontent/src/main/res/layout/activity_choose_store.xml
View file @
0791daf6
...
...
@@ -4,6 +4,7 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
android:orientation=
"vertical"
>
<include
...
...
app/build.gradle
View file @
0791daf6
...
...
@@ -14,7 +14,6 @@ android {
versionCode
rootProject
.
ext
.
android
.
versionCode
versionName
rootProject
.
ext
.
android
.
versionName
buildConfigField
(
"boolean"
,
"IS_ENCRYPT_DEBUG_KEY"
,
rootProject
.
ext
.
android
.
isEncryptDebugKey
)
buildConfigField
(
"boolean"
,
"IS_APP_UPGRADE_ONLINE"
,
rootProject
.
ext
.
android
.
isAppUpgradeOnline
)
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders
=
[
qqappid:
"101923771"
]
...
...
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