Commit 86c66a4e authored by 王雷's avatar 王雷

1)商品详情页的二维码隐藏;

parent baf4031f
......@@ -19,5 +19,6 @@
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
<option name="offlineMode" value="true" />
</component>
</project>
\ No newline at end of file
......@@ -9,13 +9,15 @@ android {
compileSdkVersion 30
packagingOptions {
exclude 'META-INF/*.kotlin_module'
exclude 'classes.dex'
exclude '**.**'
}
defaultConfig {
applicationId "com.qimai.yttgrass"
minSdkVersion 21
targetSdkVersion 30
versionCode 2
versionName "1.1"
versionCode 3
versionName "1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
......
......@@ -10,8 +10,8 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 2,
"versionName": "1.1",
"versionCode": 3,
"versionName": "1.2",
"outputFile": "app-release.apk"
}
]
......
......@@ -67,7 +67,11 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
} else {
ll_webview.visibility = View.VISIBLE
}
mVm.mGoodsInfo?.content?.let { getGoodsHtml(it) }?.let {
mVm.mGoodsInfo?.content?.let {
Log.d(TAG, "onActivityCreated111: it= $it")
val info = it.replace("<img", "<img style='max-width:100%;height:auto;'")
getGoodsHtml(info) }?.let {
Log.d(TAG, "onActivityCreated: it= $it")
webview.loadDataWithBaseURL(
null,
it,
......@@ -95,7 +99,8 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
tv_sub_introduction.visibility = View.GONE
}
if (!goodsId.isNullOrEmpty()) {
mVm.getMiniProgramCode(goodsId!!).observe(viewLifecycleOwner, Observer {
//二维码图片暂不展示
/* mVm.getMiniProgramCode(goodsId!!).observe(viewLifecycleOwner, Observer {
when (it.status) {
Status.SUCCESS -> {
......@@ -107,7 +112,7 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
Log.d(TAG, "onActivityCreated: error= ${it.message}")
}
}
})
})*/
}
//把商品详情清理掉
mVm.mGoodsInfo = null
......@@ -143,8 +148,8 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
override fun onPageFinished(p0: WebView?, p1: String?) {
super.onPageFinished(p0, p1)
Log.d(TAG, "onPageFinished: ")
imgReset()
webview.loadUrl("javascript:abc.resize(document.body.getBoundingClientRect().height)")
// imgReset()
// webview.loadUrl("javascript:abc.resize(document.body.getBoundingClientRect().height)")
}
override fun onReceivedError(
......@@ -273,7 +278,19 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
}
private fun getGoodsHtml(content: String): String {
return "<html> <body>${content}</body></html>"
return "<html> <body> <style>\n" +
" * {\n" +
" margin: 0;\n" +
" padding: 0\n" +
" }\n" +
" p {\n" +
" font-size: 0;\n" +
" }\n" +
" img{\n" +
" width: 100%;\n" +
" vertical-align: top;\n" +
" }\n" +
" </style>${content}</body></html>"
}
private fun countdown() {
......
......@@ -11,6 +11,7 @@ import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.Navigation
import androidx.navigation.Navigation.findNavController
import com.qimai.android.fetch.Response.Status
......@@ -19,6 +20,8 @@ import com.qimai.yttgrass.scan.ScanGun
import com.qimai.yttgrass.vm.HomeVm
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_welcome.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
class MainActivity : AppCompatActivity() {
private var mScanGun: ScanGun? = null
......@@ -31,6 +34,10 @@ class MainActivity : AppCompatActivity() {
hideBottomUIMenu()
setContentView(R.layout.activity_main)
initData()
/* lifecycleScope.launch{
delay(3000)
getInfo("8801051154436")
}*/
}
/**
......
......@@ -130,6 +130,7 @@
android:layout_marginRight="30dp"
android:layout_marginBottom="30dp"
android:background="@color/white"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintRight_toRightOf="parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment