126 lines
4.7 KiB
Kotlin
126 lines
4.7 KiB
Kotlin
@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
|
|
package uni.UNI644401D
|
|
import io.dcloud.uniapp.*
|
|
import io.dcloud.uniapp.extapi.*
|
|
import io.dcloud.uniapp.framework.*
|
|
import io.dcloud.uniapp.runtime.*
|
|
import io.dcloud.uniapp.vue.*
|
|
import io.dcloud.uniapp.vue.shared.*
|
|
import io.dcloud.uts.*
|
|
import io.dcloud.uts.Map
|
|
import io.dcloud.uts.Set
|
|
import io.dcloud.uts.UTSAndroid
|
|
import kotlin.properties.Delegates
|
|
import io.dcloud.uniapp.extapi.exit as uni_exit
|
|
import io.dcloud.uniapp.extapi.showToast as uni_showToast
|
|
val runBlock1 = run {
|
|
__uniConfig.getAppStyles = fun(): Map<String, Map<String, Map<String, Any>>> {
|
|
return GenApp.styles
|
|
}
|
|
}
|
|
var firstBackTime: Number = 0
|
|
open class GenApp : BaseApp {
|
|
constructor(__ins: ComponentInternalInstance) : super(__ins) {
|
|
onLaunch(fun(_: OnLaunchOptions) {
|
|
console.log("App Launch")
|
|
}
|
|
, __ins)
|
|
onAppShow(fun(_: OnShowOptions) {
|
|
console.log("App Show")
|
|
}
|
|
, __ins)
|
|
onAppHide(fun() {
|
|
console.log("App Hide")
|
|
}
|
|
, __ins)
|
|
onLastPageBackPress(fun() {
|
|
console.log("App LastPageBackPress")
|
|
if (firstBackTime == 0) {
|
|
uni_showToast(ShowToastOptions(title = "再按一次退出应用", position = "bottom"))
|
|
firstBackTime = Date.now()
|
|
setTimeout(fun(){
|
|
firstBackTime = 0
|
|
}, 2000)
|
|
} else if (Date.now() - firstBackTime < 2000) {
|
|
firstBackTime = Date.now()
|
|
uni_exit(null)
|
|
}
|
|
}
|
|
, __ins)
|
|
onExit(fun() {
|
|
console.log("App Exit")
|
|
}
|
|
, __ins)
|
|
}
|
|
companion object {
|
|
val styles: Map<String, Map<String, Map<String, Any>>> by lazy {
|
|
_nCS(_uA(
|
|
styles0
|
|
))
|
|
}
|
|
val styles0: Map<String, Map<String, Map<String, Any>>>
|
|
get() {
|
|
return _uM("uni-row" to _pS(_uM("flexDirection" to "row")), "uni-column" to _pS(_uM("flexDirection" to "column")))
|
|
}
|
|
}
|
|
}
|
|
val GenAppClass = CreateVueAppComponent(GenApp::class.java, fun(): VueComponentOptions {
|
|
return VueComponentOptions(type = "app", name = "", inheritAttrs = true, inject = Map(), props = Map(), propsNeedCastKeys = _uA(), emits = Map(), components = Map(), styles = GenApp.styles)
|
|
}
|
|
, fun(instance): GenApp {
|
|
return GenApp(instance)
|
|
}
|
|
)
|
|
val GenPagesIndexIndexClass = CreateVueComponent(GenPagesIndexIndex::class.java, fun(): VueComponentOptions {
|
|
return VueComponentOptions(type = "page", name = "", inheritAttrs = GenPagesIndexIndex.inheritAttrs, inject = GenPagesIndexIndex.inject, props = GenPagesIndexIndex.props, propsNeedCastKeys = GenPagesIndexIndex.propsNeedCastKeys, emits = GenPagesIndexIndex.emits, components = GenPagesIndexIndex.components, styles = GenPagesIndexIndex.styles)
|
|
}
|
|
, fun(instance, renderer): GenPagesIndexIndex {
|
|
return GenPagesIndexIndex(instance, renderer)
|
|
}
|
|
)
|
|
fun createApp(): UTSJSONObject {
|
|
val app = createSSRApp(GenAppClass)
|
|
return _uO("app" to app)
|
|
}
|
|
fun main(app: IApp) {
|
|
definePageRoutes()
|
|
defineAppConfig()
|
|
(createApp()["app"] as VueApp).mount(app, GenUniApp())
|
|
}
|
|
open class UniAppConfig : io.dcloud.uniapp.appframe.AppConfig {
|
|
override var name: String = "SkinCamera"
|
|
override var appid: String = "__UNI__644401D"
|
|
override var versionName: String = "1.0.0"
|
|
override var versionCode: String = "100"
|
|
override var uniCompilerVersion: String = "4.87"
|
|
constructor() : super() {}
|
|
}
|
|
fun definePageRoutes() {
|
|
__uniRoutes.push(UniPageRoute(path = "pages/index/index", component = GenPagesIndexIndexClass, meta = UniPageMeta(isQuit = true), style = _uM("navigationBarTitleText" to "uni-app x")))
|
|
}
|
|
val __uniLaunchPage: Map<String, Any?> = _uM("url" to "pages/index/index", "style" to _uM("navigationBarTitleText" to "uni-app x"))
|
|
fun defineAppConfig() {
|
|
__uniConfig.entryPagePath = "/pages/index/index"
|
|
__uniConfig.globalStyle = _uM("navigationBarTextStyle" to "black", "navigationBarTitleText" to "uni-app x", "navigationBarBackgroundColor" to "#F8F8F8", "backgroundColor" to "#F8F8F8")
|
|
__uniConfig.getTabBarConfig = fun(): Map<String, Any>? {
|
|
return null
|
|
}
|
|
__uniConfig.tabBar = __uniConfig.getTabBarConfig()
|
|
__uniConfig.conditionUrl = ""
|
|
__uniConfig.uniIdRouter = _uM()
|
|
__uniConfig.ready = true
|
|
}
|
|
open class GenUniApp : UniAppImpl() {
|
|
open val vm: GenApp?
|
|
get() {
|
|
return getAppVm() as GenApp?
|
|
}
|
|
open val `$vm`: GenApp?
|
|
get() {
|
|
return getAppVm() as GenApp?
|
|
}
|
|
}
|
|
fun getApp(): GenUniApp {
|
|
return getUniApp() as GenUniApp
|
|
}
|