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
e17e2be2
Commit
e17e2be2
authored
Jul 08, 2021
by
shiyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增新建门店相关逻辑
parent
2e8eac3a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
46 deletions
+104
-46
URLs.kt
...onLib/Common/src/main/java/com/yidian/common/http/URLs.kt
+35
-32
PublishCouponsActivity.kt
...henghuoquan/commodity/ui/coupon/PublishCouponsActivity.kt
+8
-9
ChooseStoreApter.kt
...dian/shenghuoquan/newscontent/adapter/ChooseStoreApter.kt
+1
-0
StoreAdapter.kt
...m/yidian/shenghuoquan/newscontent/adapter/StoreAdapter.kt
+1
-0
ApiService.kt
...va/com/yidian/shenghuoquan/newscontent/http/ApiService.kt
+20
-1
CommonService.kt
...com/yidian/shenghuoquan/newscontent/http/CommonService.kt
+7
-0
EditStoreActivity.kt
...an/shenghuoquan/newscontent/ui/store/EditStoreActivity.kt
+32
-4
No files found.
CommonLib/Common/src/main/java/com/yidian/common/http/URLs.kt
View file @
e17e2be2
...
...
@@ -7,7 +7,10 @@ class URLs {
// 生活圈B端
const
val
getShopList
=
"/shop/shop/get_shop_list"
// 编辑门店
const
val
updateShop
=
"/shop/shop/update_shop"
// 新建门店
const
val
addShop
=
"/shop/shop/add_shop"
const
val
uploadFile
=
"/user/user/modify_profile"
const
val
pushTokenAndroid
=
"/push/token/android"
const
val
authPersonalGetToken
=
"/Identify/IdOcr/getBizToken"
...
...
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/ui/coupon/PublishCouponsActivity.kt
View file @
e17e2be2
...
...
@@ -4,10 +4,13 @@ import android.webkit.WebChromeClient
import
android.webkit.WebView
import
androidx.activity.viewModels
import
com.google.gson.Gson
import
com.orhanobut.hawk.Hawk
import
com.yidian.common.HawkConfig
import
com.yidian.common.XRouterPathConstants
import
com.yidian.common.extensions.initTitleBar
import
com.yidian.common.http.HttpResult
import
com.yidian.common.mvvm.BaseMvvmActivity
import
com.yidian.news.util.StorageUtils
import
com.yidian.shenghuoquan.commodity.R
import
com.yidian.shenghuoquan.commodity.databinding.CommodityActivityPublishCouponsBinding
import
com.yidian.xarc.xbrid.XBridManager
...
...
@@ -21,8 +24,6 @@ import org.json.JSONObject
class
PublishCouponsActivity
:
BaseMvvmActivity
<
CommodityActivityPublishCouponsBinding
,
PublishCouponsViewModel
>(),
XPageViewProtocol
{
private
lateinit
var
webView
:
XWebView
private
var
loadDataFinish
=
false
private
var
loadWebViewFinish
=
false
private
var
data
:
HttpResult
<
Any
?>?
=
null
override
val
layoutId
:
Int
=
R
.
layout
.
commodity_activity_publish_coupons
...
...
@@ -45,26 +46,24 @@ class PublishCouponsActivity : BaseMvvmActivity<CommodityActivityPublishCouponsB
private
fun
initWebView
()
{
webView
=
XBridManager
.
getWebView
(
this
,
"testidenfier"
,
binding
.
couponWebView
)
webView
.
loadUrl
(
"xbrid_article"
)
val
lifeAccountId
=
Hawk
.
get
(
HawkConfig
.
LifeAccountId
,
""
)
webView
.
loadUrl
(
"xbrid_coupon_publish?life_account_id=$lifeAccountId"
)
webView
.
webChromeClient
=
object
:
WebChromeClient
()
{
override
fun
onProgressChanged
(
view
:
WebView
?,
newProgress
:
Int
)
{
super
.
onProgressChanged
(
view
,
newProgress
)
if
(
newProgress
==
100
)
{
loadWebViewFinish
=
true
postDataToWeb
()
// postDataToWeb()
}
}
}
WebView
.
setWebContentsDebuggingEnabled
(
true
)
}
private
fun
postDataToWeb
()
{
// if (loadDataFinish && loadWebViewFinish) {
// private fun postDataToWeb() {
// val contentDetailBean = ContentDetailBean("getArticleData", data)
// val params = Gson().toJson(contentDetailBean)
// XBridManager.postEvent("ArticleService", JSONObject(params), webView)
// }
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/ChooseStoreApter.kt
View file @
e17e2be2
...
...
@@ -36,6 +36,7 @@ class ChooseStoreApter : BaseQuickAdapter<GetShopListBean, BaseViewHolder>(R.lay
holder
.
getView
<
ImageView
>(
R
.
id
.
iv_store_edit
).
clickAntiShake
{
val
intent
=
Intent
(
context
,
EditStoreActivity
::
class
.
java
)
intent
.
putExtra
(
"shop_name"
,
item
.
shop_name
)
intent
.
putExtra
(
"shop_id"
,
item
.
shop_id
)
intent
.
putExtra
(
"sub_shop_id"
,
item
.
sub_shop_id
)
intent
.
putExtra
(
"address"
,
item
.
address
)
intent
.
putExtra
(
"phone"
,
item
.
phone
)
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/StoreAdapter.kt
View file @
e17e2be2
...
...
@@ -29,6 +29,7 @@ class StoreAdapter(private val context: Context) : RecyclerView.Adapter<StoreVie
override
fun
jump
()
{
val
intent
=
Intent
(
context
,
EditStoreActivity
::
class
.
java
)
intent
.
putExtra
(
"shop_name"
,
store
.
shop_name
)
intent
.
putExtra
(
"shop_id"
,
store
.
shop_id
)
intent
.
putExtra
(
"sub_shop_id"
,
store
.
sub_shop_id
)
intent
.
putExtra
(
"address"
,
store
.
address
)
intent
.
putExtra
(
"phone"
,
store
.
phone
)
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/ApiService.kt
View file @
e17e2be2
...
...
@@ -497,6 +497,26 @@ class ApiService {
})
}
// 新建门店
fun
addStore
(
requestParams
:
HashMap
<
String
,
String
?
>,
callback
:
((
Boolean
)
->
Unit
)?
=
null
)
{
val
timeStamp
=
System
.
currentTimeMillis
()
val
publicParamsMap
=
HttpParamsUtils
.
getPublicParamsMap
(
timeStamp
)
val
privateParamsMap
=
HttpParamsUtils
.
getPrivateParamsMap
(
requestParams
,
timeStamp
)
ServiceFactory
.
getInstance
().
createService
(
CommonService
::
class
.
java
)
.
addShop
(
publicParamsMap
,
privateParamsMap
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultSubscriber
<
Any
?>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
Any
?
>?)
{
callback
?.
invoke
(
true
)
}
override
fun
onFailer
(
result
:
HttpResult
<
Any
?
>?)
{
}
})
}
// 编辑门店
fun
updateStore
(
requestParams
:
HashMap
<
String
,
String
?
>,
callback
:
((
Boolean
)
->
Unit
)?
=
null
)
{
val
timeStamp
=
System
.
currentTimeMillis
()
val
publicParamsMap
=
HttpParamsUtils
.
getPublicParamsMap
(
timeStamp
)
...
...
@@ -507,7 +527,6 @@ class ApiService {
.
subscribe
(
object
:
HttpResultSubscriber
<
Any
?>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
Any
?
>?)
{
callback
?.
invoke
(
true
)
}
override
fun
onFailer
(
result
:
HttpResult
<
Any
?
>?)
{
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/CommonService.kt
View file @
e17e2be2
...
...
@@ -147,6 +147,13 @@ interface CommonService {
@Body
requestParams
:
Map
<
String
,
String
?
>
):
Observable
<
HttpResult
<
Any
?
>>
@Headers
(
"Content-Type: application/json"
)
@POST
(
URLs
.
addShop
)
fun
addShop
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@Body
requestParams
:
Map
<
String
,
String
?
>
):
Observable
<
HttpResult
<
Any
?
>>
@Headers
(
"Content-Type: application/json"
)
@POST
(
URLs
.
updateShop
)
fun
updateShop
(
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/store/EditStoreActivity.kt
View file @
e17e2be2
...
...
@@ -14,7 +14,9 @@ import com.yidian.shenghuoquan.newscontent.widget.CommonTopBarView
*/
class
EditStoreActivity
:
BaseActivity
<
ActivityStoreEditBinding
>(),
CommonTopBarView
.
OnCommonTopBarActionCallback
{
private
var
store
=
Store
(
""
,
""
,
""
,
""
,
""
,
""
)
// 是否为新建门店
private
var
isAddStore
:
Boolean
=
false
private
var
store
=
Store
(
""
,
""
,
""
,
""
,
""
)
override
fun
createViewBinding
():
ActivityStoreEditBinding
{
return
ActivityStoreEditBinding
.
inflate
(
layoutInflater
)
...
...
@@ -28,10 +30,12 @@ class EditStoreActivity : BaseActivity<ActivityStoreEditBinding>(), CommonTopBar
intent
?.
let
{
when
(
it
.
getSerializableExtra
(
"from"
))
{
fromAddStore
->
{
isAddStore
=
true
viewBind
.
bvTopBar
.
setPageTitle
(
"新建门店"
)
initContent
()
}
fromEditStore
->
{
isAddStore
=
false
viewBind
.
bvTopBar
.
setPageTitle
(
"编辑门店"
)
initContent
(
it
)
}
...
...
@@ -45,11 +49,13 @@ class EditStoreActivity : BaseActivity<ActivityStoreEditBinding>(), CommonTopBar
viewBind
.
storePhoneNum
.
setText
(
""
)
viewBind
.
storeAddressEdit
.
text
=
""
viewBind
.
storeName
.
setText
(
""
)
store
.
shop_id
=
""
store
.
sub_shop_id
=
""
}
else
{
viewBind
.
storePhoneNum
.
setText
(
intent
.
getStringExtra
(
"phone"
))
viewBind
.
storeAddressEdit
.
text
=
intent
.
getStringExtra
(
"address"
)
viewBind
.
storeName
.
setText
(
intent
.
getStringExtra
(
"shop_name"
))
store
.
shop_id
=
intent
.
getStringExtra
(
"shop_id"
)
?:
""
store
.
sub_shop_id
=
intent
.
getStringExtra
(
"sub_shop_id"
)
?:
""
}
}
...
...
@@ -65,11 +71,34 @@ class EditStoreActivity : BaseActivity<ActivityStoreEditBinding>(), CommonTopBar
* 保存(新建和编辑)
*/
override
fun
onDoAction
()
{
if
(
isAddStore
)
{
toAddStore
()
}
else
{
toUpdateStore
()
}
}
private
fun
toAddStore
()
{
val
requestParams
=
HashMap
<
String
,
String
?>()
requestParams
[
"life_account_id"
]
=
StorageUtil
.
getLifeAccountId
()
requestParams
[
"phone"
]
=
viewBind
.
storePhoneNum
.
text
.
toString
()
requestParams
[
"shop_name"
]
=
viewBind
.
storeName
.
text
.
toString
()
requestParams
[
"latitude"
]
=
store
.
latitude
requestParams
[
"longitude"
]
=
store
.
longitude
requestParams
[
"address"
]
=
store
.
title
ApiService
.
updateStore
(
requestParams
)
{
if
(
it
)
{
Toast
.
makeText
(
this
@EditStoreActivity
,
"保存成功"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
}
private
fun
toUpdateStore
()
{
val
requestParams
=
HashMap
<
String
,
String
?>()
requestParams
[
"sub_shop_id"
]
=
store
.
sub_shop_id
requestParams
[
"life_account_id"
]
=
StorageUtil
.
getLifeAccountId
()
requestParams
[
"phone"
]
=
viewBind
.
storePhoneNum
.
text
.
toString
()
requestParams
[
"shop_id"
]
=
""
requestParams
[
"shop_id"
]
=
store
.
shop_id
requestParams
[
"shop_name"
]
=
viewBind
.
storeName
.
text
.
toString
()
requestParams
[
"latitude"
]
=
store
.
latitude
requestParams
[
"longitude"
]
=
store
.
longitude
...
...
@@ -100,10 +129,9 @@ class EditStoreActivity : BaseActivity<ActivityStoreEditBinding>(), CommonTopBar
data class
Store
(
var
title
:
String
,
var
cityName
:
String
,
var
adName
:
String
,
var
latitude
:
String
,
var
longitude
:
String
,
var
shop_id
:
String
,
var
sub_shop_id
:
String
)
}
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