小程序初始提交
This commit is contained in:
44
cool-unix/pages/set/about.uvue
Normal file
44
cool-unix/pages/set/about.uvue
Normal file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<cl-page>
|
||||
<view class="p-3">
|
||||
<view class="flex flex-col items-center justify-center py-10">
|
||||
<view class="p-3 bg-primary-500 rounded-xl">
|
||||
<cl-image src="/static/logo.png" :height="80" :width="80"></cl-image>
|
||||
</view>
|
||||
<cl-text :pt="{ className: 'mt-3 mb-1' }">{{ config.name }}</cl-text>
|
||||
<cl-text
|
||||
color="info"
|
||||
:pt="{
|
||||
className: '!text-xs'
|
||||
}"
|
||||
>version {{ config.version }}</cl-text
|
||||
>
|
||||
</view>
|
||||
|
||||
<cl-list>
|
||||
<cl-list-item
|
||||
:label="t('访问官网')"
|
||||
arrow
|
||||
hoverable
|
||||
@tap="toWebSite"
|
||||
></cl-list-item>
|
||||
</cl-list>
|
||||
</view>
|
||||
</cl-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { config } from "@/config";
|
||||
import { $t, t } from "@/locale";
|
||||
import { openWeb } from "@/uni_modules/cool-open-web";
|
||||
|
||||
onReady(() => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: $t("关于{name}", { name: config.name })
|
||||
});
|
||||
});
|
||||
|
||||
function toWebSite() {
|
||||
openWeb(config.website);
|
||||
}
|
||||
</script>
|
||||
39
cool-unix/pages/set/cs.uvue
Normal file
39
cool-unix/pages/set/cs.uvue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<cl-page>
|
||||
<view class="p-10 flex flex-col items-center justify-center">
|
||||
<cl-text :pt="{ className: 'text-center mb-5' }"
|
||||
>我们期待与您携手,共同探索技术的边界,共同推动技术的进步</cl-text
|
||||
>
|
||||
|
||||
<view class="p-2 bg-white mb-5 rounded-xl">
|
||||
<cl-image
|
||||
src="/static/cs.png"
|
||||
:height="320"
|
||||
:width="320"
|
||||
show-menu-by-longpress
|
||||
></cl-image>
|
||||
</view>
|
||||
|
||||
<!-- #ifndef H5 -->
|
||||
<cl-button type="light" icon="download-line" @tap="saveImage">保存图片</cl-button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</cl-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useUi } from "@/uni_modules/cool-ui";
|
||||
|
||||
const ui = useUi();
|
||||
|
||||
function saveImage() {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: "/static/cs.png",
|
||||
success: () => {
|
||||
ui.showToast({
|
||||
message: "保存成功"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
42
cool-unix/pages/set/general.uvue
Normal file
42
cool-unix/pages/set/general.uvue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<cl-page>
|
||||
<view class="p-3">
|
||||
<cl-list>
|
||||
<cl-list-item :label="t('深色模式')">
|
||||
<cl-switch :model-value="isDark" @change="onThemeChange"></cl-switch>
|
||||
</cl-list-item>
|
||||
|
||||
<cl-list-item :label="t('多语言')" arrow hoverable @tap="setLocale"> </cl-list-item>
|
||||
|
||||
<cl-list-item :label="t('字体大小')" arrow hoverable @tap="setSize"> </cl-list-item>
|
||||
</cl-list>
|
||||
</view>
|
||||
|
||||
<!-- 语言设置 -->
|
||||
<locale-set :ref="refs.set('localeSet')"></locale-set>
|
||||
|
||||
<!-- 字体大小设置 -->
|
||||
<size-set :ref="refs.set('sizeSet')"></size-set>
|
||||
</cl-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { isDark, toggleTheme, useRefs } from "@/cool";
|
||||
import { t } from "@/locale";
|
||||
import LocaleSet from "@/components/locale-set.uvue";
|
||||
import SizeSet from "@/components/size-set.uvue";
|
||||
|
||||
const refs = useRefs();
|
||||
|
||||
function onThemeChange() {
|
||||
toggleTheme();
|
||||
}
|
||||
|
||||
function setLocale() {
|
||||
refs.open("localeSet");
|
||||
}
|
||||
|
||||
function setSize() {
|
||||
refs.open("sizeSet");
|
||||
}
|
||||
</script>
|
||||
79
cool-unix/pages/set/index.uvue
Normal file
79
cool-unix/pages/set/index.uvue
Normal file
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<cl-page>
|
||||
<view class="p-3">
|
||||
<cl-list :pt="{ className: 'mb-3' }">
|
||||
<cl-list-item
|
||||
:label="t('通用设置')"
|
||||
icon="settings-line"
|
||||
arrow
|
||||
hoverable
|
||||
@tap="router.to('/pages/set/general')"
|
||||
>
|
||||
</cl-list-item>
|
||||
<cl-list-item
|
||||
:label="t('通知设置')"
|
||||
icon="notification-4-line"
|
||||
arrow
|
||||
hoverable
|
||||
@tap="router.to('/pages/set/notice')"
|
||||
>
|
||||
</cl-list-item>
|
||||
<cl-list-item :label="t('隐私设置')" icon="lock-line" arrow hoverable>
|
||||
</cl-list-item>
|
||||
</cl-list>
|
||||
|
||||
<cl-list :pt="{ className: 'mb-3' }">
|
||||
<cl-list-item
|
||||
:label="$t('关于{name}', { name: config.name })"
|
||||
icon="error-warning-line"
|
||||
arrow
|
||||
hoverable
|
||||
:pt="{
|
||||
label: {
|
||||
className: 'flex-1'
|
||||
}
|
||||
}"
|
||||
@tap="router.to('/pages/set/about')"
|
||||
>
|
||||
</cl-list-item>
|
||||
|
||||
<cl-list-item
|
||||
:label="t('联系客服')"
|
||||
icon="customer-service-line"
|
||||
arrow
|
||||
hoverable
|
||||
@tap="router.to('/pages/set/cs')"
|
||||
>
|
||||
</cl-list-item>
|
||||
</cl-list>
|
||||
|
||||
<cl-list :pt="{ className: 'mb-3' }">
|
||||
<cl-list-item hoverable justify="center" @tap="toLogout">
|
||||
<cl-text color="error">{{ t("退出登录") }}</cl-text>
|
||||
</cl-list-item>
|
||||
</cl-list>
|
||||
</view>
|
||||
</cl-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { config } from "@/config";
|
||||
import { router, useStore } from "@/cool";
|
||||
import { $t, t } from "@/locale";
|
||||
import { useUi } from "@/uni_modules/cool-ui";
|
||||
|
||||
const ui = useUi();
|
||||
const { user } = useStore();
|
||||
|
||||
function toLogout() {
|
||||
ui.showConfirm({
|
||||
title: t("提示"),
|
||||
message: t("确定退出登录吗?"),
|
||||
callback(action) {
|
||||
if (action == "confirm") {
|
||||
user.logout();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
15
cool-unix/pages/set/notice.uvue
Normal file
15
cool-unix/pages/set/notice.uvue
Normal file
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<cl-page>
|
||||
<view class="p-3">
|
||||
<cl-list>
|
||||
<cl-list-item :label="t('开启通知')">
|
||||
<cl-switch></cl-switch>
|
||||
</cl-list-item>
|
||||
</cl-list>
|
||||
</view>
|
||||
</cl-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { t } from "@/locale";
|
||||
</script>
|
||||
Reference in New Issue
Block a user