语言包和Msg提示消息优化
This commit is contained in:
parent
58f0f27af8
commit
aa1aa01b5d
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 状态提示
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
use think\facade\Cookie;
|
||||
|
@ -1,58 +1,104 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 状态提示
|
||||
// +----------------------------------------------------------------------
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\common\lib;
|
||||
|
||||
use think\facade\Lang;
|
||||
|
||||
class Msg
|
||||
{
|
||||
public static function getCode($strCode){
|
||||
//状态配置
|
||||
$res = [
|
||||
'success' => 1,
|
||||
'error' => 0,
|
||||
|
||||
];
|
||||
|
||||
foreach($res as $k => $v){
|
||||
static protected $res = [];
|
||||
|
||||
/**
|
||||
* 设置状态吗
|
||||
* @return array
|
||||
*/
|
||||
public static function setCodes()
|
||||
{
|
||||
return $res = [
|
||||
'success' => 0,
|
||||
'error' => 1,
|
||||
'add_success' => Lang::get('add success'),
|
||||
'add_error' => Lang::get('add error'),
|
||||
'edit_success' => Lang::get('edit success'),
|
||||
'edit_error' => Lang::get('edit error'),
|
||||
'delete_success' => Lang::get('delete success'),
|
||||
'delete_error' => Lang::get('delete error'),
|
||||
'upload_success' => Lang::get('upload success'),
|
||||
'upload_error' => Lang::get('upload error'),
|
||||
'upgrade_success' => Lang::get('upgrade success'),
|
||||
'upgrade_error' => Lang::get('upgrade error'),
|
||||
'illegal_request' => Lang::get('illegal request'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取返回码
|
||||
* @param string $strCode
|
||||
* @return mixed string
|
||||
*/
|
||||
public static function getCode(string $strCode){
|
||||
foreach(self::setCodes() as $k => $v){
|
||||
if($k == $strCode){
|
||||
return $res = $v;
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
//return $res;
|
||||
}
|
||||
|
||||
public static function getMsg($strMsg){
|
||||
//状态配置
|
||||
$res = [
|
||||
'add_success' => Lang::get('add success'),
|
||||
'add_error' => Lang::get('add error'),
|
||||
'edit_success' => Lang::get('edit success'),
|
||||
'edit_error' => Lang::get('edit error'),
|
||||
'illegal_request' => Lang::get('illegal request'),
|
||||
|
||||
];
|
||||
|
||||
foreach($res as $k => $v){
|
||||
|
||||
/**
|
||||
* 获取返回信息 如果不存在返回自身
|
||||
* @param string $strMsg
|
||||
* @return mixed string
|
||||
*/
|
||||
public static function getMsg(string $strMsg){
|
||||
foreach(self::setCodes() as $k => $v){
|
||||
if($k == $strMsg){
|
||||
return $res = $v;
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
//$res;
|
||||
}
|
||||
|
||||
public static function show($strCode,$strMsg,$url)
|
||||
{
|
||||
$res = [
|
||||
'code' => self::getCode($strCode),
|
||||
'msg' => self::getMsg($strMsg),
|
||||
'url' => $url,
|
||||
];
|
||||
|
||||
return json($res);
|
||||
|
||||
/**
|
||||
* 成功提示
|
||||
* @param string $strMsg
|
||||
* @param string|null $url
|
||||
* @param string $data
|
||||
* @return string|\think\response\Json
|
||||
*/
|
||||
public static function success(string $strMsg,string $url = null, $data = ''){
|
||||
if(empty($strMsg)){
|
||||
return '不能返回为空消息';
|
||||
}
|
||||
$result = [
|
||||
'code' => self::getCode('success'),
|
||||
'msg' => self::getMsg($strMsg),
|
||||
'url' => $url,
|
||||
'data' => $data
|
||||
];
|
||||
return json($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 失败提示
|
||||
* @param string $strMsg 消息提示码
|
||||
* @param string|null $url 跳转地址
|
||||
* @param string $data 返回数据
|
||||
* @return string|\think\response\Json
|
||||
*/
|
||||
public static function error(string $strMsg,string $url = null, $data = ''){
|
||||
if(empty($strMsg)){
|
||||
return '不能返回为空消息';
|
||||
}
|
||||
$result = [
|
||||
'code' => self::getCode('error'),
|
||||
'msg' => self::getMsg($strMsg),
|
||||
'url' => $url,
|
||||
'data' => $data
|
||||
];
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Article extends Model
|
||||
if($result) {
|
||||
return 1;
|
||||
} else {
|
||||
return '文章添加失败!';
|
||||
return 'add_error';
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ class Article extends Model
|
||||
if($result) {
|
||||
return 1;
|
||||
} else {
|
||||
return '文章修改失败!';
|
||||
return 'edit_error';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,6 @@ use app\common\model\Comment;
|
||||
use app\common\model\Article as ArticleModel;
|
||||
use think\exception\ValidateException;
|
||||
use taoler\com\Message;
|
||||
use app\common\model\Cate;
|
||||
use app\common\model\User;
|
||||
use app\common\model\Collection;
|
||||
use think\facade\Lang;
|
||||
use app\common\lib\Msg;
|
||||
|
||||
@ -236,108 +233,68 @@ class Article extends BaseController
|
||||
return json($res);
|
||||
}
|
||||
|
||||
//添加文章
|
||||
/**
|
||||
* 添加帖子文章
|
||||
* @return string|\think\Response|\think\response\Json|void
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['cate_id','title','title_color','user_id','content','upzip','tags','captcha']);
|
||||
$validate = new \app\common\validate\Article; //调用验证器
|
||||
$result = $validate->scene('Artadd')->check($data); //进行数据验证
|
||||
if(true !==$result){
|
||||
return $this->error($validate->getError());
|
||||
} else {
|
||||
$article = new \app\common\model\Article;
|
||||
$result = $article->add($data);
|
||||
if($result == 1) {
|
||||
$aid = Db::name('article')->max('id');
|
||||
$link = (string) url('article/detail',['id'=> $aid]);
|
||||
//清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
|
||||
//return json(['code'=>1,'msg'=>'发布成功','url'=> $link]);
|
||||
return json(['code'=>Msg::getCode('success'),'msg'=>Msg::getMsg('add_success'),'url'=> $link]);
|
||||
} else {
|
||||
$this->error($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//上传附件
|
||||
public function upzip()
|
||||
{
|
||||
$file = request()->file('file');
|
||||
try {
|
||||
validate(['file'=>'fileSize:1024000|fileExt:jpg,zip'])
|
||||
->check(['file'=>$file]);
|
||||
$savename = \think\facade\Filesystem::disk('public')->putFile('article_zip',$file);
|
||||
} catch (ValidateException $e) {
|
||||
return json(['status'=>-1,'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$upload = Config::get('filesystem.disks.public.url');
|
||||
|
||||
if($savename){
|
||||
$name_path =str_replace('\\',"/",$upload.'/'.$savename);
|
||||
$res = ['status'=>0,'msg'=>'上传成功','url'=> $name_path];
|
||||
}else{
|
||||
$res = ['status'=>-1,'msg'=>'上传错误'];
|
||||
{
|
||||
if (Request::isAjax()) {
|
||||
$data = Request::only(['cate_id', 'title', 'title_color', 'user_id', 'content', 'upzip', 'tags', 'captcha']);
|
||||
$validate = new \app\common\validate\Article; //调用验证器
|
||||
$result = $validate->scene('Artadd')->check($data); //进行数据验证
|
||||
if (true !== $result) {
|
||||
return Msg::error($validate->getError());
|
||||
}
|
||||
$result = ArticleModel::add($data);
|
||||
if ($result == 1) {
|
||||
$aid = Db::name('article')->max('id');
|
||||
$link = (string)url('article/detail', ['id' => $aid]);
|
||||
//清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
$res = Msg::success('add_success', $link);
|
||||
} else {
|
||||
$res = Msg::error('add_error');
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
return json($res);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//附件下载
|
||||
public function download($id)
|
||||
{
|
||||
$zipdir = Db::name('article')->where('id',$id)->value('upzip');
|
||||
$zip = substr($zipdir,1);
|
||||
return download($zip,'my');
|
||||
}
|
||||
|
||||
//添加tag
|
||||
public function tags()
|
||||
{
|
||||
$data = Request::only(['tags']);
|
||||
$att = explode(',',$data['tags']);
|
||||
$tags = [];
|
||||
foreach($att as $v){
|
||||
if ($v !='') {
|
||||
$tags[] = $v;
|
||||
}
|
||||
}
|
||||
return json(['code'=>0,'data'=>$tags]);
|
||||
}
|
||||
|
||||
//编辑文章
|
||||
/**
|
||||
* 编辑文章
|
||||
* @param $id
|
||||
* @return string|\think\Response|\think\response\Json|void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$article = Db::name('article')->find($id);
|
||||
|
||||
$article = ArticleModel::find($id);
|
||||
//编辑
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','tags','captcha']);
|
||||
$validate = new \app\common\validate\Article(); //调用验证器
|
||||
$res = $validate->scene('Artadd')->check($data); //进行数据验证
|
||||
|
||||
if(true !==$res){
|
||||
return $this->error($validate->getError());
|
||||
return Msg::error($validate->getError());
|
||||
} else {
|
||||
$article = new \app\common\model\Article;
|
||||
$result = $article->edit($data);
|
||||
if($result == 1) {
|
||||
//删除缓存显示编辑后内容
|
||||
//删除原有缓存显示编辑后内容
|
||||
Cache::delete('article_'.$id);
|
||||
$link = (string) url('article/detail',['id'=> $id]);
|
||||
//return json(['code'=>0,'msg'=>'修改成功','url'=> $link]);
|
||||
return Msg::show('error','edit_success',$link);
|
||||
|
||||
|
||||
$editRes = Msg::success('edit_success',$link);
|
||||
} else {
|
||||
$this->error($result);
|
||||
$editRes = Msg::error($result);
|
||||
}
|
||||
return $editRes;
|
||||
}
|
||||
}
|
||||
|
||||
$tag = Db::name('article')->where('id',$id)->value('tags');
|
||||
//查询标签
|
||||
$tag = $article->tags;
|
||||
$attr = explode(',',$tag);
|
||||
$tags = [];
|
||||
foreach($attr as $key=>$v){
|
||||
@ -390,6 +347,49 @@ class Article extends BaseController
|
||||
return json($res);
|
||||
}
|
||||
|
||||
//上传附件
|
||||
public function upzip()
|
||||
{
|
||||
$file = request()->file('file');
|
||||
try {
|
||||
validate(['file'=>'fileSize:1024000|fileExt:jpg,zip'])
|
||||
->check(['file'=>$file]);
|
||||
$savename = \think\facade\Filesystem::disk('public')->putFile('article_zip',$file);
|
||||
} catch (ValidateException $e) {
|
||||
return json(['status'=>-1,'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$upload = Config::get('filesystem.disks.public.url');
|
||||
|
||||
if($savename){
|
||||
$name_path =str_replace('\\',"/",$upload.'/'.$savename);
|
||||
$res = ['status'=>0,'msg'=>'上传成功','url'=> $name_path];
|
||||
}else{
|
||||
$res = ['status'=>-1,'msg'=>'上传错误'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
|
||||
//附件下载
|
||||
public function download($id)
|
||||
{
|
||||
$zipdir = Db::name('article')->where('id',$id)->value('upzip');
|
||||
$zip = substr($zipdir,1);
|
||||
return download($zip,'my');
|
||||
}
|
||||
|
||||
//添加tag
|
||||
public function tags()
|
||||
{
|
||||
$data = Request::only(['tags']);
|
||||
$att = explode(',',$data['tags']);
|
||||
$tags = [];
|
||||
foreach($att as $v){
|
||||
if ($v !='') {
|
||||
$tags[] = $v;
|
||||
}
|
||||
}
|
||||
return json(['code'=>0,'data'=>$tags]);
|
||||
}
|
||||
|
||||
//文章置顶,状态
|
||||
public function jieset(){
|
||||
|
@ -171,9 +171,10 @@ class Index extends BaseController
|
||||
$lang = $language->select(input('language'));
|
||||
if($lang){
|
||||
return json(['code'=>0,'msg'=>'']);
|
||||
//return Msg::success('')
|
||||
}
|
||||
}else {
|
||||
return json(['code'=>Msg::get('error'),'msg'=>Msg::getMsg('illegal_request')]);
|
||||
return Msg::error('illegal_request');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ class Login extends BaseController
|
||||
$url = '/';
|
||||
}
|
||||
Cookie::set('url',$url);
|
||||
|
||||
if(Request::isAjax()) {
|
||||
$data = Request::param();
|
||||
|
||||
|
119
app/index/controller/Msg.php
Normal file
119
app/index/controller/Msg.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use think\facade\Lang;
|
||||
|
||||
class Msg
|
||||
{
|
||||
static protected $res = [];
|
||||
|
||||
/**
|
||||
* 设置状态吗
|
||||
* @return array
|
||||
*/
|
||||
public static function setCodes()
|
||||
{
|
||||
return $res = [
|
||||
'success' => 0,
|
||||
'error' => 1,
|
||||
'add_success' => Lang::get('add success'),
|
||||
'add_error' => Lang::get('add error'),
|
||||
'edit_success' => Lang::get('编辑成功1'),
|
||||
'edit_error' => Lang::get('edit error'),
|
||||
'delete_success' => Lang::get('delete success'),
|
||||
'delete_error' => Lang::get('delete error'),
|
||||
'uploade_success' => Lang::get('uploade success'),
|
||||
'uploade_error' => Lang::get('uploade error'),
|
||||
'upgrade_success' => Lang::get('upgrade success'),
|
||||
'upgrade_error' => Lang::get('upgrade error'),
|
||||
'illegal_request' => Lang::get('illegal request'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取返回码
|
||||
* @param string $strCode
|
||||
* @return mixed string
|
||||
*/
|
||||
public static function getCode(string $strCode){
|
||||
foreach(self::setCodes() as $k => $v){
|
||||
if($k == $strCode){
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取返回信息 如果不存在返回自身
|
||||
* @param string $strMsg
|
||||
* @return mixed string
|
||||
*/
|
||||
public static function getMsg(string $strMsg){
|
||||
$res = [
|
||||
'success' => 0,
|
||||
'error' => 1,
|
||||
'add_success' => Lang::get('add success'),
|
||||
'add_error' => Lang::get('add error'),
|
||||
'edit_success' => Lang::get('edit success'),
|
||||
'edit_error' => Lang::get('edit error'),
|
||||
'delete_success' => Lang::get('delete success'),
|
||||
'delete_error' => Lang::get('delete error'),
|
||||
'uploade_success' => Lang::get('uploade success'),
|
||||
'uploade_error' => Lang::get('uploade error'),
|
||||
'upgrade_success' => Lang::get('upgrade success'),
|
||||
'upgrade_error' => Lang::get('upgrade error'),
|
||||
'illegal_request' => Lang::get('illegal request'),
|
||||
];
|
||||
foreach($res as $k => $v){
|
||||
if($k == $strMsg){
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功提示
|
||||
* @param string $strMsg
|
||||
* @param string|null $url
|
||||
* @param string $data
|
||||
* @return string|\think\response\Json
|
||||
*/
|
||||
public static function success(string $strMsg,string $url = null, $data = ''){
|
||||
if(empty($strMsg)){
|
||||
return '不能返回为空消息';
|
||||
}
|
||||
$result = [
|
||||
'code' => self::getCode('success'),
|
||||
'msg' => self::getMsg($strMsg),
|
||||
'url' => $url,
|
||||
'data' => $data
|
||||
];
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败提示
|
||||
* @param string $strMsg 消息提示码
|
||||
* @param string|null $url 跳转地址
|
||||
* @param string $data 返回数据
|
||||
* @return string|\think\response\Json
|
||||
*/
|
||||
public static function error(string $strMsg,string $url = null, $data = ''){
|
||||
if(empty($strMsg)){
|
||||
return '不能返回为空消息';
|
||||
}
|
||||
$result = [
|
||||
'code' => self::getCode('error'),
|
||||
'msg' => self::getMsg($strMsg),
|
||||
'url' => $url,
|
||||
'data' => $data
|
||||
];
|
||||
|
||||
return json($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -2,108 +2,121 @@
|
||||
|
||||
return [
|
||||
//语言
|
||||
'language' => 'language',
|
||||
'chinese' => '中文简体',
|
||||
'english' => 'English',
|
||||
'language' => 'language',
|
||||
'chinese' => '中文简体',
|
||||
'english' => 'English',
|
||||
|
||||
//message
|
||||
'add' => 'add',
|
||||
'delete' => 'delete',
|
||||
'edit' => 'edit',
|
||||
'uploads' => 'Upload',
|
||||
'add success' => 'add success!',
|
||||
'add error' => 'add error',
|
||||
'edit success' => 'edit success',
|
||||
'edit error' => 'edit error',
|
||||
'delete success' => 'delete success',
|
||||
'delete error' => 'delete error',
|
||||
'upload success' => 'upload success',
|
||||
'upload error' => 'upload error',
|
||||
'upgrade success' => 'upgrade success',
|
||||
'upgrade error' => 'upgrade error',
|
||||
'illegal request' => 'illegal request',
|
||||
|
||||
//menu
|
||||
'index' => 'Index',
|
||||
'home page' => 'Home',
|
||||
'user center' => 'Center',
|
||||
'set info' => 'Set info',
|
||||
'my message' => 'Message',
|
||||
'my page' => 'My page',
|
||||
'index' => 'Index',
|
||||
'home page' => 'Home',
|
||||
'user center' => 'Center',
|
||||
'set info' => 'Set info',
|
||||
'my message' => 'Message',
|
||||
'my page' => 'My page',
|
||||
|
||||
'login' => 'Login',
|
||||
'logout' => 'Logout',
|
||||
'sign in' => 'Sign in',
|
||||
'sign up' => 'Sign up',
|
||||
'register' => 'Register',
|
||||
'discuss' => 'Discuss',
|
||||
'case' => 'Case',
|
||||
'timeline' => 'Timeline',
|
||||
'login' => 'Login',
|
||||
'logout' => 'Logout',
|
||||
'sign in' => 'Sign in',
|
||||
'sign up' => 'Sign up',
|
||||
'register' => 'Register',
|
||||
'discuss' => 'Discuss',
|
||||
'case' => 'Case',
|
||||
'timeline' => 'Timeline',
|
||||
|
||||
//帖子
|
||||
'poster' => 'poster',
|
||||
'title color' => 'Title color',
|
||||
'add_post' => 'Add post',
|
||||
'collection' => 'collection',
|
||||
'my collection' => 'My collection',
|
||||
'cancel collection' => 'cancel collection',
|
||||
'all' => 'All',
|
||||
'finished' => 'Finished',
|
||||
'end' => 'End',
|
||||
'no finished' => 'no finished',
|
||||
'hot' => 'Hot',
|
||||
'top' => 'Top',
|
||||
'cancel hoting' => 'Cancel hoting',
|
||||
'cancel topping' => 'Cancel topping',
|
||||
'go sign' => 'Go sign',
|
||||
'more post' => 'more post',
|
||||
'friendly link' => 'Friendly link',
|
||||
'reviewers list' => 'Reviewers list',
|
||||
'hot post list' => 'Hot post list',
|
||||
'links list' => 'Links list',
|
||||
'statement' => 'Statement',
|
||||
'trends' => 'Trends',
|
||||
'sponsor' => 'Super sponsor',
|
||||
'i want to join' => 'i want to join',
|
||||
'official products' => 'Official products',
|
||||
'no comments' => 'No comments',
|
||||
'submit comments' => 'Submit comments',
|
||||
'reply' => 'reply',
|
||||
'replies' => 'replies',
|
||||
'accept' => 'accept',
|
||||
'please input the content' => 'please input the content',
|
||||
'ads area' => 'Ads area',
|
||||
'enclosure' => 'enclosure',
|
||||
'download files' => 'Download files',
|
||||
|
||||
//message
|
||||
'add' => 'add',
|
||||
'delete' => 'delete',
|
||||
'edit' => 'edit',
|
||||
'add success' => 'add success!',
|
||||
'add error' => 'add error',
|
||||
'edit success' => 'articel edit success',
|
||||
'edit error' => 'articel edit error',
|
||||
'illegal_request' => 'illegal request',
|
||||
//article/post
|
||||
'poster' => 'poster',
|
||||
'title' => 'Title',
|
||||
'title color' => 'Title color',
|
||||
'add post' => 'Add post',
|
||||
'edit post' => 'Edit post',
|
||||
'delete post' => 'Delete post',
|
||||
'post now' => 'Post now',
|
||||
'collection' => 'collection',
|
||||
'my collection' => 'My collection',
|
||||
'cancel collection' => 'cancel collection',
|
||||
'all' => 'All',
|
||||
'finished' => 'Finished',
|
||||
'end' => 'End',
|
||||
'no finished' => 'no finished',
|
||||
'hot' => 'Hot',
|
||||
'top' => 'Top',
|
||||
'cancel hoting' => 'Cancel hoting',
|
||||
'cancel topping' => 'Cancel topping',
|
||||
'go sign' => 'Go sign',
|
||||
'more post' => 'more post',
|
||||
'friendly link' => 'Friendly link',
|
||||
'reviewers list' => 'Reviewers list',
|
||||
'hot post list' => 'Hot post list',
|
||||
'links list' => 'Links list',
|
||||
'statement' => 'Statement',
|
||||
'trends' => 'Trends',
|
||||
'sponsor' => 'Super sponsor',
|
||||
'i want to join' => 'i want to join',
|
||||
'official products' => 'Official products',
|
||||
'no comments' => 'No comments',
|
||||
'submit comments' => 'Submit comments',
|
||||
'reply' => 'reply',
|
||||
'replies' => 'replies',
|
||||
'accept' => 'accept',
|
||||
'please input the content' => 'please input the content',
|
||||
'ads area' => 'Ads area',
|
||||
'enclosure' => 'Enclosure',
|
||||
'add attachment' => 'Add attachment',
|
||||
'download files' => 'Download files',
|
||||
'special column' => 'Columns',
|
||||
|
||||
//Sign in/up
|
||||
'username' => 'Username',
|
||||
'password' => 'Password',
|
||||
'new password' => 'New Password',
|
||||
'reset password' => 'Reset password',
|
||||
'retrieve password' => 'Retrieve password',
|
||||
'email' => 'Email',
|
||||
'confirm password' => 'Confirm password',
|
||||
'captcha' => 'Captcha',
|
||||
'remember password' => 'Remember password',
|
||||
'forget password' => 'Forget password',
|
||||
'login now' => 'Login now',
|
||||
'submit' => 'Submit',
|
||||
'go back' => 'Go back',
|
||||
'register now' => 'Register now',
|
||||
'mail/username' => 'mail/username',
|
||||
'6-16 characters' => '6-16 characters',
|
||||
'strong type encryption' => 'Strong type encryption',
|
||||
'it cannot be changed' => 'It cannot be changed',
|
||||
'the only way to get back your password' => 'The only way to get back your password',
|
||||
'please input the password' => 'Please input the password',
|
||||
'please confirm the password' => 'Please confirm the password',
|
||||
'please input the captcha' => 'Please input the captcha',
|
||||
'username' => 'Username',
|
||||
'password' => 'Password',
|
||||
'new password' => 'New Password',
|
||||
'reset password' => 'Reset password',
|
||||
'retrieve password' => 'Retrieve password',
|
||||
'email' => 'Email',
|
||||
'confirm password' => 'Confirm password',
|
||||
'captcha' => 'Captcha',
|
||||
'remember password' => 'Remember password',
|
||||
'forget password' => 'Forget password',
|
||||
'login now' => 'Login now',
|
||||
'submit' => 'Submit',
|
||||
'go back' => 'Go back',
|
||||
'register now' => 'Register now',
|
||||
'mail/username' => 'mail/username',
|
||||
'6-16 characters' => '6-16 characters',
|
||||
'strong type encryption' => 'Strong type encryption',
|
||||
'it cannot be changed' => 'It cannot be changed',
|
||||
'the only way to get back your password' => 'The only way to get back your password',
|
||||
'please input the password' => 'Please input the password',
|
||||
'please confirm the password' => 'Please confirm the password',
|
||||
'please input the captcha' => 'Please input the captcha',
|
||||
|
||||
//user
|
||||
'add friends' => 'Add friends',
|
||||
'start a chat' => 'Start a chat',
|
||||
'authentication information' => 'Authentication information',
|
||||
'it is not signed yet' => 'It is not signed yet',
|
||||
'log in to view' => 'Log in to view',
|
||||
'join' => 'Join',
|
||||
'recent statements' => 'Recent statements',
|
||||
'recent answers' => 'Recent answers',
|
||||
'browses' => 'Browses',
|
||||
'in' => 'in',
|
||||
'accumulate points' => 'Accumulate points',
|
||||
'my post' => 'My post',
|
||||
//user
|
||||
'add friends' => 'Add friends',
|
||||
'start a chat' => 'Start a chat',
|
||||
'authentication information' => 'Authentication information',
|
||||
'it is not signed yet' => 'It is not signed yet',
|
||||
'log in to view' => 'Log in to view',
|
||||
'join' => 'Join',
|
||||
'recent statements' => 'Recent statements',
|
||||
'recent answers' => 'Recent answers',
|
||||
'browses' => 'Browses',
|
||||
'in' => 'in',
|
||||
'accumulate points' => 'Accumulate points',
|
||||
'my post' => 'My post',
|
||||
];
|
@ -2,18 +2,35 @@
|
||||
|
||||
return [
|
||||
//语言
|
||||
'language' => 'language',
|
||||
'chinese' => '中文简体',
|
||||
'english' => 'english',
|
||||
|
||||
//menu
|
||||
'language' => 'language',
|
||||
'chinese' => '中文简体',
|
||||
'english' => 'english',
|
||||
|
||||
//弹窗提示消息
|
||||
'add' => '添加',
|
||||
'delete' => '删除',
|
||||
'edit' => '编辑',
|
||||
'uploads' => '上传',
|
||||
'add success' => '添加成功!',
|
||||
'add error' => '添加失败',
|
||||
'edit success' => '修改成功',
|
||||
'edit error' => '修改失败',
|
||||
'delete success' => '删除成功',
|
||||
'delete error' => '删除失败',
|
||||
'upload success' => '上传成功',
|
||||
'upload error' => '上传失败',
|
||||
'upgrade success' => '升级成功',
|
||||
'upgrade error' => '升级失败',
|
||||
'illegal request' => '非法请求',
|
||||
|
||||
//菜单
|
||||
'index' => 'index',
|
||||
'home page' => '首页',
|
||||
'user center' => '用户中心',
|
||||
'set info' => '设置',
|
||||
'my message' => '我的消息',
|
||||
'my page' => '我的主页',
|
||||
|
||||
|
||||
'login' => '登录',
|
||||
'logout' => '退出',
|
||||
'sign in' => '签到',
|
||||
@ -22,51 +39,50 @@ return [
|
||||
'discuss' => '讨论',
|
||||
'case' => '案例',
|
||||
'timeline' => '框架日志',
|
||||
|
||||
|
||||
//帖子
|
||||
'poster' => '贴主',
|
||||
'title color' => '颜色',
|
||||
'add_post' => '添加帖子',
|
||||
'my collection' => '我的收藏',
|
||||
'cancel collection' => '取消收藏',
|
||||
'all' => '综合',
|
||||
'finished' => '已结',
|
||||
'end' => '已结',
|
||||
'no finished' => '未结',
|
||||
'hot' => '热贴',
|
||||
'top' => '精贴',
|
||||
'cancel hoting' => '取消精贴',
|
||||
'cancel topping' => '取消置顶',
|
||||
'go sign' => '去签到',
|
||||
'more post' => '更多帖子',
|
||||
'friendly link' => '友情链接',
|
||||
'reviewers list' => '回帖热榜',
|
||||
'hot post list' => '本周热议',
|
||||
'links list' => '温馨通道',
|
||||
'statement' => '说明',
|
||||
'trends' => '动态',
|
||||
'sponsor' => '钻级赞助商',
|
||||
'i want to join' => '我要加入',
|
||||
'official products' => '官方产品',
|
||||
'no comments' => '暂时还没有评论',
|
||||
'submit comments' => '提交评论',
|
||||
'reply' => '回复',
|
||||
'replies' => '次回复',
|
||||
'accept' => '采纳',
|
||||
'please input the content' => '请输入内容',
|
||||
'ads area' => '广告区',
|
||||
'enclosure' => '附件',
|
||||
'download files' => '下载文件',
|
||||
|
||||
//message
|
||||
'add' => '添加',
|
||||
'delete' => '删除',
|
||||
'add success' => '添加成功!',
|
||||
'add error' => '添加失败',
|
||||
'edit success' => '修改成功',
|
||||
'edit error' => '修改失败',
|
||||
'illegal request' => '非法请求',
|
||||
|
||||
'poster' => '贴主',
|
||||
'title' => '标题',
|
||||
'title color' => '颜色',
|
||||
'add post' => '添加帖子',
|
||||
'edit post' => '编辑帖子',
|
||||
'delete post' => '删除帖子',
|
||||
'post now' => '立即发布',
|
||||
'my collection' => '我的收藏',
|
||||
'cancel collection' => '取消收藏',
|
||||
'all' => '综合',
|
||||
'finished' => '已结',
|
||||
'end' => '已结',
|
||||
'no finished' => '未结',
|
||||
'hot' => '热贴',
|
||||
'top' => '精贴',
|
||||
'cancel hoting' => '取消精贴',
|
||||
'cancel topping' => '取消置顶',
|
||||
'go sign' => '去签到',
|
||||
'more post' => '更多帖子',
|
||||
'friendly link' => '友情链接',
|
||||
'reviewers list' => '回帖热榜',
|
||||
'hot post list' => '本周热议',
|
||||
'links list' => '温馨通道',
|
||||
'statement' => '说明',
|
||||
'trends' => '动态',
|
||||
'sponsor' => '钻级赞助商',
|
||||
'i want to join' => '我要加入',
|
||||
'official products' => '官方产品',
|
||||
'no comments' => '暂时还没有评论',
|
||||
'submit comments' => '提交评论',
|
||||
'reply' => '回复',
|
||||
'replies' => '次回复',
|
||||
'accept' => '采纳',
|
||||
'please input the content' => '请输入内容',
|
||||
'ads area' => '广告区',
|
||||
'enclosure' => '附件',
|
||||
'add attachment' => '添加附件',
|
||||
'download files' => '下载文件',
|
||||
'special column' => '选择专栏',
|
||||
'tags' => '标签',
|
||||
'add tags' => '添加标签',
|
||||
|
||||
//Sign in/up
|
||||
'username' => '用户',
|
||||
'password' => '密码',
|
||||
@ -90,7 +106,7 @@ return [
|
||||
'please input the password' => '请输入密码',
|
||||
'please confirm the password' => '请确认密码',
|
||||
'please input the captcha' => '请输入验证码',
|
||||
|
||||
|
||||
//user
|
||||
'add friends' => '添加为好友',
|
||||
'start a chat' => '开始会话',
|
||||
@ -99,11 +115,11 @@ return [
|
||||
'log in to view' => '登录查看',
|
||||
'join' => '加入',
|
||||
'recent statements' => '最近发帖',
|
||||
'recent answers' => '最近回贴',
|
||||
'recent answers' => '最近回贴',
|
||||
'browses' => '浏览',
|
||||
'in' => '在',
|
||||
'in' => '在',
|
||||
'accumulate points' => '积分',
|
||||
'my post' => '我的帖子',
|
||||
|
||||
|
||||
|
||||
];
|
@ -8,25 +8,25 @@
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="user">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">发表新帖<!-- 编辑帖子 --></li>
|
||||
<li class="layui-this">{:lang('add post')}<!-- 编辑帖子 --></li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
||||
<div class="layui-tab-item layui-show">
|
||||
|
||||
<div class="layui-row layui-col-space15 layui-form-item">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">所在专栏</label>
|
||||
<label class="layui-form-label">{:lang('special column')}</label>
|
||||
<div class="layui-input-block">
|
||||
<select lay-verify="required" name="cate_id" lay-filter="column">
|
||||
<option></option>
|
||||
{volist name="cateList" id="cate"}
|
||||
<option value="{$cate.id}">{$cate.catename}</option>
|
||||
<option value="{$cate.id}">{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md8">
|
||||
<label for="L_title" class="layui-form-label">标题</label>
|
||||
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input">
|
||||
@ -68,26 +68,26 @@
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细描述" class="layui-textarea fly-editor" style="height: 260px;"></textarea>
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 260px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">上传附件</label>
|
||||
<label class="layui-form-label">{:lang('enclosure')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="upzip" value="" placeholder="zip,jpg格式" title="上传附件"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>上传文件</button>
|
||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>{:lang('uploads')}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">添加标签</label>
|
||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="tags" placeholder="多个标签用,号隔开" title="添加标签"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">添加</button>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
@ -111,16 +111,16 @@
|
||||
</div>
|
||||
</div-->
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">验证码</label>
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div >
|
||||
<span style="color: #c00;"><img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="article-add" lay-submit id="add">立即发布</button>
|
||||
<button type="submit" class="layui-btn" lay-filter="article-add" lay-submit id="add">{:lang('post now')}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -210,7 +210,7 @@
|
||||
data:{"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha},
|
||||
dataType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 1) {
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{
|
||||
icon:6,
|
||||
time:2000
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="user">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">编辑帖子</li>
|
||||
<li class="layui-this">{:lang('edit post')}</li>
|
||||
</ul>
|
||||
<div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
||||
<div class="layui-tab-item layui-show">
|
||||
@ -16,19 +16,19 @@
|
||||
<input type="hidden" name="id" value="{$article.id}">
|
||||
<div class="layui-row layui-col-space15 layui-form-item">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">所在专栏</label>
|
||||
<label class="layui-form-label">{:lang('special column')}</label>
|
||||
<div class="layui-input-block">
|
||||
<select lay-verify="required" name="cate_id" lay-filter="column">
|
||||
<option></option>
|
||||
|
||||
{volist name="cateList" id="cate"}
|
||||
<option value="{$cate.id}" {if $article.cate_id == $cate.id}selected{/if}>{$cate.catename}</option>
|
||||
<option value="{$cate.id}" {if $article.cate_id == $cate.id}selected{/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md8">
|
||||
<label for="L_title" class="layui-form-label">标题</label>
|
||||
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
|
||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" value="{$article.title_color}">
|
||||
@ -91,7 +91,7 @@
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">上传附件</label>
|
||||
<label class="layui-form-label">{:lang('enclosure')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="upzip" value="{$article.upzip}" placeholder="zip,jpg格式" title="上传附件"/>
|
||||
</div>
|
||||
@ -101,11 +101,11 @@
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">添加标签</label>
|
||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="tags" placeholder="多个标签用,号隔开" title="添加标签"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">添加</button>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
@ -116,16 +116,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">验证码</label>
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
<span style="color: #c00;"><img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="article-edit" lay-submit id="edit">立即发布</button>
|
||||
<button type="submit" class="layui-btn" lay-filter="article-edit" lay-submit id="edit">{:lang('post now')}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -185,7 +185,6 @@
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user