
TaoLerCMS
一个简单迅速高效插件化轻量级CMS系统
上手快
构建以 TaoLer核心框架 为中心的项目结构,以最少的配置帮助你快速搭建项目。配置简单,使用容易。
高性能
以最小的核心可运行单元驱动,API接口拓展业务,轻量化,数据缓存,反应迅速。
插件化
可定制化高,统一约束,规范灵活,一键安装部署,前端可混编,可前后端分离,自适应,小程序H5等开发。
TaoLer基础结构代码
<!DOCTYPE html>
<html>
<head>
<meat charset="UFT-8">
<meat name="keywords" content="这里是网站关键词">
<meat name="description" content="这里是网站关键词">
<title>文档的标题</title>
<link rel="sytlesheet" href="">
<style>
h1{font-size:16px;}
</style>
</head>
<body>
文档的内容......
<H1>这里搜索引擎</h1>
</body>
</html>
<template>
<!-- 单个商品内容 -->
<view class="goods" @click="clickGoodsItem(goodsInfo.id)">
<image class="pic" :src="goodsInfo.img" mode="aspectFill"></image>
<view class="name">{{ goodsInfo.name}}</view>
<view class="info">
¥ <text class="price">{{ goodsInfo.price }}</text> <text class="oprice">原 {{ goodsInfo.oprice }}</text> <text class="sold">已售 {{ goodsInfo.sold }}</text>
</view>
</view>
</template>
<script>
export default {
name:"GoodsItem",
}
</script>
<script setup>
import { defineProps } from 'vue';
defineProps({
'goodsInfo':{
img: {
type: String,
defalut: ''
},
name: {
type: String,
defalut: '商品名'
},
price: {
type: Number,
defalut: 0
},
oprice: {
type: Number,
defalut: 0
},
sold: {
type: Number,
defalut: 0
}
}
});
const clickGoodsItem = (id) => {
uni.navigateTo({
url: '/pages/goods/detail?id=' + id
})
}
</script>
<style lang="scss" scoped>
.goods {
width: 350rpx;
height: 100%;
padding: 10rpx 0;
.pic {
width: 350rpx;
height: 350rpx;
border-radius: 16rpx;
}
.name {
width: 100%;
font-size: 32rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; /*省略号*/
padding: 15rpx 0;
}
.info {
height: 60rpx;
line-height: 60rpx;
font-size: 28rpx;
.price {
color: red;
}
.oprice {
padding: 0 15rpx;
text-decoration: line-through;
}
}
}
</style>
<?php
namespace app\common\taglib;
use think\template\TagLib;
class Taoler extends TagLib
{
protected $tags = [
// 标签定义: attr 属性列表 close 是否闭合(0 或者1 默认1) alias 标签别名 level 嵌套层次
'nav' => ['attr' => '', 'close' => 1],
'snav' => ['attr' => '', 'close' => 1],
'gnav' => ['attr' => '', 'close' => 1],
'if' => ['condition', 'expression' => true, 'close' => 1],
];
public function tagNav($tag, $content): string
{
$id = $tag['id'] ?? 'nav';
$parse = '{php}$__cate__ = \app\facade\Cate::getNav();{/php}';
$parse .= '{volist name="__cate__" id="'.$id.'"}';
$parse .= $content;
$parse .= '{/volist}';
return $parse;
}
public function tagSnav($tag, $content): string
{
$id = $tag['id'] ?? 'snav';
$parse = '{notempty name="nav.children"}';
$parse .= '{volist name="nav.children" id="'.$id.'"}';
$parse .= $content;
$parse .= '{/volist}';
$parse .= '{/notempty}';
return $parse;
}
public function tagGnav($tag, $content): string
{
$id = $tag['id'] ?? 'gnav';
$parse = '{notempty name="snav.children"}';
$parse .= '{volist name="snav.children" id="'.$id.'"}';
$parse .= $content;
$parse .= '{/volist}';
$parse .= '{/notempty}';
return $parse;
}
public function tagIf($tag, $content): string
{
$condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition'];
$condition = $this->parseCondition($condition);
$parseStr = '<?php if(' . $condition . '): ?>' . $content . '<?php endif; ?>';
return $parseStr;
}
}
package controllers
import (
"TaoGer/models"
"net/http"
"github.com/gin-gonic/gin"
)
type UserController struct{}
type UserAddParam struct {
Name string `json:"name"`
Password string `json:"password"`
}
func (u UserController) SetUserAdd(c *gin.Context) {
// 1.
name := c.PostForm("name")
// name := c.Param("name")
//name := c.Query("name")
// name, _ := c.GetQuery("name")
// password := c.DefaultPostForm("password", "123456")
JsonOk(c, 0, "succ", name)
}
func (u UserController) Adds(c *gin.Context) {
c.String(http.StatusOK, "User add")
}
func (u UserController) GetUserInfo(c *gin.Context) {
id := c.Param("id")
JsonOk(c, 0, "success", id)
}
func (u UserController) GetUserList(c *gin.Context) {
models.GetUserList()
c.String(http.StatusOK, "Get User List")
}