Skip to content

Commit

Permalink
更改默认色、修复ota
Browse files Browse the repository at this point in the history
  • Loading branch information
aoaostar committed Jan 4, 2022
1 parent ed69bba commit cf5e43e
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 263 deletions.
2 changes: 1 addition & 1 deletion app/controller/master/Ota.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Ota extends Base
public function initialize()
{
reset_opcache();
$this->RELEASE_API = base64_decode('aHR0cHM6Ly90b29sLWNsb3VkLmFvYW9zdGFyLmNvbQ==');
$this->RELEASE_API = base64_decode('aHR0cHM6Ly90b29sLWNsb3VkLmFvYW9zdGFyLmNvbS9vcGVuL3JlbGVhc2U=');
}

private function get_last_release()
Expand Down
2 changes: 1 addition & 1 deletion config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
// | 版本号
// +----------------------------------------------------------------------

define('VERSION', 'v1.0');
define('VERSION', 'v1.1');
12 changes: 12 additions & 0 deletions public/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ body {
min-height: 100vh;
flex-direction: column;
}

.site-main {
flex: 1;
}


[data-theme=light] {
--p: 0 0% 32%;
--pf: 0 0% 45.1%;
}

[data-theme=dark] {
--p: 222 13.4% 19%;
--pf: 223 13.7% 10%;
}
5 changes: 2 additions & 3 deletions route/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use think\facade\Route;
use think\facade\View;


Route::rule('api/:alias/[:method]', function () {
$alias = plugin_alias_get();
$method = plugin_method_get();
Expand All @@ -17,7 +16,7 @@
return msg("error", "该Api不存在该方法");
}
return $app->$method();
})->middleware([\app\middleware\RequestRecord::class]);
})->pattern(['alias' => '[\w|\-/]+'])->middleware([\app\middleware\RequestRecord::class]);

Route::get(':alias', function () {
$alias = plugin_alias_get();
Expand All @@ -31,4 +30,4 @@
]);
return view($template);
})->pattern(['alias' => '[\w|\-/]+'])
->middleware(\app\middleware\View::class);
->middleware(\app\middleware\View::class);
133 changes: 3 additions & 130 deletions view/index/default/index/index.html
Original file line number Diff line number Diff line change
@@ -1,133 +1,6 @@
{extend name="layout/layout" /}

{block name="title"}{$app.title} - {$app.subTitle}{/block}
{block name="main"}
<div class="container mx-auto" id="app">

<div class="card shadow-lg">
<div class="card-body">
<div class="tabs ">
<a @click="categoryId=0" class="btn btn-ghost btn-sm rounded-btn tab"
:class="{'tab-active':!categoryId}">所有</a>
{foreach $categories as $v}
<a @click="categoryId={$v.id}" class="btn btn-ghost btn-sm rounded-btn tab"
:class="{'tab-active':categoryId=={$v.id}}">{$v.title}</a>
{/foreach}
</div>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-4 mt-4">
<div class="card text-center shadow-lg"
v-for="item,index in currentPlugins" :key="index">
<div class="card-body">
<div class=" flex flex-row">
<div class="avatar w-1/3">
<div class="rounded-btn w-24 h-24">
<img :src="item.logo" alt="">
</div>
</div>
<div class="ml-4 w-2/3 flex justify-center flex-col">
<h2 class="card-title truncate">{{item.title}}</h2>
<div class="flex">
{if(is_login())}
<button v-if="user.stars.indexOf(item.alias)===-1" class="btn btn-ghost btn-sm rounded-btn"
@click="star(item.alias)">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-5 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
</svg>
Star
</button>
<button v-else class="btn btn-ghost btn-sm rounded-btn" @click="star(item.alias,'remove')">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-5 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
fill="#d63031"
d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
</svg>
UnStar
</button>
{else}
<a class="btn btn-ghost btn-sm rounded-btn"
href="/auth/login">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-5 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
</svg>
Star
</a>
{/if}
<button @click="categoryId=item.id" class="btn btn-ghost btn-sm rounded-btn"
v-if="item.category!==null">
[{{item.category.title}}]
</button>
<button class="btn btn-ghost btn-sm rounded-btn" v-else>
[默认类]
</button>
</div>
</div>
</div>
<div class="mt-3">
<p v-if="item.desc" class="truncate">{{item.desc}}</p>
<p v-else class="truncate">暂无描述</p>
<div class="justify-center card-actions">
<a class="btn btn-primary btn-block " target="_blank" :href="'/'+item.alias">进入</a>
</div>
</div>
</div>
</div>
</div>

</div>

{extend name="layout/tools"" /}
{block name="head"}
<script>
new Vue({
el: '#app',
data: {
categoryId: "{:request()->get('categoryId')}",
plugins: [],
currentPlugins: [],
user: JSON.parse('{if(is_login())}{$user|raw}{else}{literal}{}{/literal}{/if}'),
},
watch: {
categoryId(newVal) {
if (!newVal) {
this.currentPlugins = this.plugins;
return
}
let arr = []
for (plugin of this.plugins) {
if (plugin.category_id === newVal) {
arr.push(plugin)
}
}
this.currentPlugins = arr
},
plugins(newVal){
this.currentPlugins = newVal
}
},
created() {
this.getPlugins(this.categoryId)
},
methods: {
getPlugins(categoryId) {
return plugins_get(categoryId).then(res => {
if (res.status === 'ok') {
this.plugins = res.data.items
}
})
},
star(pluginAlias, action = 'add') {
return star(pluginAlias, action).then(res => {
if (res.status === 'ok') {
this.user.stars = res.data;
}
})
}
},
})
const IS_STAR = 0
</script>
{/block}
130 changes: 3 additions & 127 deletions view/index/default/index/stars.html
Original file line number Diff line number Diff line change
@@ -1,132 +1,8 @@
{extend name="layout/layout" /}
{extend name="layout/tools" /}

{block name="title"}我的收藏 - {$app.title}{/block}
{block name="main"}
<div class="container mx-auto" id="app">

<div class="card shadow-lg">
<div class="card-body">
<div class="tabs ">
<a @click="categoryId=0" class="btn btn-ghost btn-sm rounded-btn tab"
:class="{'tab-active':!categoryId}">所有</a>
{foreach $categories as $v}
<a @click="categoryId={$v.id}" class="btn btn-ghost btn-sm rounded-btn tab"
:class="{'tab-active':categoryId=={$v.id}}">{$v.title}</a>
{/foreach}
</div>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-4 mt-4">
<div class="card text-center shadow-lg"
v-for="item,index in currentPlugins" :key="index">
<div class="card-body">
<div class=" flex flex-row">
<div class="avatar w-1/3">
<div class="rounded-btn w-24 h-24">
<img :src="item.logo" alt="">
</div>
</div>
<div class="ml-4 w-2/3 flex justify-center flex-col">
<h2 class="card-title truncate">{{item.title}}</h2>
<div class="flex">
{if(is_login())}
<button v-if="user.stars.indexOf(item.alias)===-1" class="btn btn-ghost btn-sm rounded-btn"
@click="star(item.alias)">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-5 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
</svg>
Star
</button>
<button v-else class="btn btn-ghost btn-sm rounded-btn" @click="star(item.alias,'remove')">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-5 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
fill="#d63031"
d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
</svg>
UnStar
</button>
{else}
<a class="btn btn-ghost btn-sm rounded-btn"
href="/auth/login">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-5 mr-2 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
</svg>
Star
</a>
{/if}
<button @click="categoryId=item.id" class="btn btn-ghost btn-sm rounded-btn"
v-if="item.category!==null">
[{{item.category.title}}]
</button>
<button class="btn btn-ghost btn-sm rounded-btn" v-else>
[默认类]
</button>
</div>
</div>
</div>
<div class="mt-3">
<p v-if="item.desc" class="truncate">{{item.desc}}</p>
<p v-else class="truncate">暂无描述</p>
<div class="justify-center card-actions">
<a class="btn btn-primary btn-block " target="_blank" :href="'/'+item.alias">进入</a>
</div>
</div>
</div>
</div>
</div>

</div>

{block name="head"}
<script>
new Vue({
el: '#app',
data: {
categoryId: "{:request()->get('categoryId')}",
plugins: [],
user: JSON.parse('{if(is_login())}{$user|raw}{else}{literal}{}{/literal}{/if}'),
},
watch: {
categoryId(newVal) {
if (!newVal) {
this.currentPlugins = this.plugins;
return
}
let arr = []
for (plugin of this.plugins) {
if (plugin.category_id === newVal) {
arr.push(plugin)
}
}
this.currentPlugins = arr
},
plugins(newVal){
this.currentPlugins = newVal
}
},
created() {
this.getPlugins(this.categoryId)
},
methods: {
getPlugins(categoryId) {
return plugins_get(categoryId, 1).then(res => {
if (res.status === 'ok') {
this.plugins = res.data.items
}
})
},
star(pluginAlias, action = 'add') {
return star(pluginAlias, action).then(res => {
if (res.status === 'ok') {
this.user.stars = res.data;
}
})
}
},
})
const IS_STAR = 1
</script>
{/block}
2 changes: 1 addition & 1 deletion view/index/default/layout/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script src="/static/http.js?v={:get_version()}"></script>
<script src="/static/common.js?v={:get_version()}"></script>
<script src="/static/api.js?v={:get_version()}"></script>
<link rel="stylesheet" href="/static/style.css?v={:get_version()}">
<link rel="stylesheet" href="/static/style.css?v={:time()}">
{block name="head"}{/block}
</head>
<body>
Expand Down
Loading

0 comments on commit cf5e43e

Please sign in to comment.