pushdeer/quickapp/src/pages/component/Settings/index.ux

78 lines
1.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<import name="setting-card" src="./card"></import>
<template>
<div class="wrapper">
<div class="header">
<text>设置</text>
<!-- <image @click="onPlusBtnClick" src="/assets/images/arrow-up.png" /> -->
</div>
<list style="width: 80%">
<list-item type="settingitem" for="{{ s in settings}}">
<setting-card
label="{{s.label}}"
opt-name="{{s.optName}}"
idx="{{$idx}}"
></setting-card>
</list-item>
</list>
</div>
</template>
<script>
import storage from '@system.storage'
import router from '@system.router'
export default {
data: {
settings: [
{ label: "", optName: "退出", handler: () => {
promiseFactory(storage.clear)
.then(() => {
router.replace({
uri: 'pages'
})
})
.catch(e => {
$utils.showToast(e)
})
} },
// { label: "自定义服务器", optName: "扫码", handler: () => { $utils.showToast('点击了扫码按钮') } },
{ label: "喜欢PushDeer", optName: "评分", handler: () => { $utils.showToast('点击了评分按钮') } }
],
},
onLogoutBtnClick() {
console.log('settings', 'onLogoutBtnClick')
},
onInit() {
console.log('settings', 'init')
this.$on('SettingsItemClick', (evt) => {
evt.stop()
this.settings[evt.detail].handler();
})
this.settings[0].label = "登录为 " + this.$app.$def.userinfo.name
}
}
</script>
<style lang="less">
@import '../../../assets/styles/style.less';
.wrapper {
.flex-box-mixins(column, flex-start, center);
width: 100%;
height: 100%;
padding-top: 84px;
.header {
margin-bottom: 24px;
width: 80%;
justify-content: space-between;
text {
font-size: 48px;
color: #000000;
}
}
}
</style>