123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package com.zswc.creativity.vmodel
- import android.app.Application
- import android.text.TextUtils
- import android.view.View
- import android.widget.LinearLayout
- import androidx.lifecycle.MutableLiveData
- import androidx.lifecycle.viewModelScope
- import com.ysnows.base.base.BRepository
- import com.ysnows.base.base.BViewModel
- import com.zswc.creativity.model.TibetaDetails
- import com.zswc.creativity.utils.PopuBuyUtils
- import com.zswc.creativity.utils.PopuShareWxUtils
- import com.zswc.creativity.utils.net.NetEngine
- import kotlinx.coroutines.launch
- class TibetanDetailsVModel(application: Application) : BViewModel<BRepository>(application) {
- var ll: LinearLayout? = null
- var data= MutableLiveData<TibetaDetails>()
- //倒计时
- var isUp = true
- var time = MutableLiveData<String>()
- fun getInfo(id:String){
- viewModelScope.launch {
- var it=repository().lreq { NetEngine.service.CollectionDetail(id) }
- if(it.ok()){
- data.value=it.data
- }
- }
- }
- fun toBuy(view :View){//支付弹框
- PopuBuyUtils.show(repository().context!!, view)
- }
- fun getUrl() {
- // viewModelScope.launch {
- // var it = repository().lreq { NetEngine.service.getAppCode(k_id, "1") }
- // if (it.ok()) {
- //
- // toShareCode(it.datas?.appcode)
- //
- // }
- // }
- //测试
- toShareCode("https://img.chuangchi.vip/nft/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220704134149.jpg20220704014839.jpg?time=1658644985996")
- }
- fun toShareCode(shareUrl: String?) {
- if (TextUtils.isEmpty(shareUrl)) {
- return
- }
- PopuShareWxUtils.show(repository().context!!, shareUrl!!, ll!!,repository().context!!.contentResolver)
- }
- }
|