lzj500 3 years ago
parent
commit
a850c29f79

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 .svn
 /Application/Index/Runtime
+/Config/config.php

+ 99 - 71
Application/Index/Home/View/Index/table.html

@@ -1,80 +1,108 @@
 <html>
 
-	<head>
-		<title>{$table}数据库字典</title>
-		<include file="Public:headCssJs" />
-	</head>
+<head>
+    <title>{$table}数据库字典</title>
+    <include file="Public:headCssJs"/>
+    <style>
+        .copy {
+            cursor: pointer
+        }
+    </style>
+</head>
 
-	<body>
+<body>
 
-		<div class="leftNav">
-			<ul>
-				<li>
-					<a href="{:U('Index/index')}">&lt;&lt;返回首页</a>
-				</li>
-				<foreach name="tables" item="tb" key="key0">
-					<li>
-						<a href="#{$tb.table_name}">{$key0+1}.{$tb.table_name}:{$tb.table_comment}</a>
-					</li>
-				</foreach>
-				<li>
-					<a href="#top">︽ 返回顶部</a>
-				</li>
-				
-			</ul>
-		</div>
+<div class="leftNav">
+    <ul>
+        <li>
+            <a href="{:U('Index/index')}">&lt;&lt;返回首页</a>
+        </li>
+        <foreach name="tables" item="tb" key="key0">
+            <li>
+                <a href="#{$tb.table_name}">{$key0+1}.{$tb.table_name}:{$tb.table_comment}</a>
+            </li>
+        </foreach>
+        <li>
+            <a href="#top">︽ 返回顶部</a>
+        </li>
 
-		<div class="rightBox">
-			<div class="p15">
-				<h1 class="tc fs18" id="top">{$table}数据库字典</h1>
+    </ul>
+</div>
 
-				<foreach name="tables" item="tb" key="key1">
-					<div class="p5 mt20" id="{$tb.table_name}">{$key1+1}.{$tb.table_name}:{$tb.table_comment}</div>
-					<table class="formtable">
-						<tr>
-							<th>序号</th>
-							<th>字段名</th>
-							<th>类型</th>
-							<th>主键</th>
-							<th>允许为空</th>
-							<th>默认值</th>
-							<th>自增长</th>
-							<th width="300">说明</th>
+<div class="rightBox">
+    <div class="p15">
+        <h1 class="tc fs18" id="top"><span class="copy" data-clipboard-text="{$table}">{$table}</span>数据库字典</h1>
 
-						</tr>
-						
-						<foreach name="tb.column" item="item" key="key">
-							<tr>
-								<td>
-									{$item.index}
-								</td>
-								<td>
-									{$item.column_name}
-								</td>
-								<td>{$item.column_type}</td>
-								<td class="tc">{$item.column_key}</td>
-								<td class="tc">{$item.is_nullable}</td>
-								<td class="tc">{$item.column_default}</td>
-								<td class="tc">
-									<eq name="item.extra" value="auto_increment">是</eq>
-								</td>
-								<td><div class="w300">
-									{$item.column_comment}</div></td>
-							</tr>
-						</foreach>
-					</table>
-				</foreach>
-			</div>
-		</div>
-		<script>
-			$(function() {
-				$("#goto_box").mouseover(function() {
-					$(this).css("right", "0px");
-				}).mouseout(function() {
-					$(this).css("right", "-144px");
-				});
-			})
-		</script>
-	</body>
+        <foreach name="tables" item="tb" key="key1">
+            <div class="p5 mt20" id="{$tb.table_name}">{$key1+1}.
+                <span class="copy" data-clipboard-text="{$tb.table_name}">{$tb.table_name}<span>:
+                            <span class="copy" data-clipboard-text="{$tb.table_comment}">{$tb.table_comment}</span></div>
+            <table class="formtable">
+                <tr>
+                    <th>序号</th>
+                    <th>字段名</th>
+                    <th>类型</th>
+                    <th>主键</th>
+                    <th>允许为空</th>
+                    <th>默认值</th>
+                    <th>自增长</th>
+                    <th width="300">说明</th>
+
+                </tr>
+
+                <foreach name="tb.column" item="item" key="key">
+                    <tr>
+                        <td class="">
+                            {$item.index}
+                        </td>
+                        <td class="copy" data-clipboard-text="{$item.column_name}">
+                            {$item.column_name}
+                        </td>
+                        <td class="copy" data-clipboard-text="{$item.column_type}">{$item.column_type}</td>
+                        <td class="tc copy" data-clipboard-text="{$item.column_key}">{$item.column_key}</td>
+                        <td class="tc copy" data-clipboard-text="{$item.is_nullable}">{$item.is_nullable}</td>
+                        <td class="tc copy" data-clipboard-text="{$item.column_default}">{$item.column_default}</td>
+                        <td class="tc copy" data-clipboard-text="{$item.auto_increment}">
+                            <eq name="item.extra" value="auto_increment">是</eq>
+                        </td>
+                        <td class="copy" data-clipboard-text="{$item.column_comment}">
+                            <div class="w300">
+                                {$item.column_comment}
+                            </div>
+                        </td>
+                    </tr>
+                </foreach>
+            </table>
+        </foreach>
+    </div>
+</div>
+<script>
+    $(function () {
+        $("#goto_box").mouseover(function () {
+            $(this).css("right", "0px");
+        }).mouseout(function () {
+            $(this).css("right", "-144px");
+        });
+
+        var clipboard = new ClipboardJS('.copy');
+        console.log("clipboard", clipboard);
+        clipboard.on('success', function (e) {
+            /*  console.info('Action:', e.action);
+              console.info('Text:', e.text);
+              console.info('Trigger:', e.trigger);*/
+            showMessage('复制成功', 1000);
+            e.clearSelection();
+        });
+
+        clipboard.on('error', function (e) {
+            console.error('Action:', e.action);
+            console.error('Trigger:', e.trigger);
+        });
+
+    })
+
+
+</script>
+</body>
 
 </html>

+ 4 - 1
Application/Index/Home/View/Public/headCssJs.html

@@ -1,4 +1,7 @@
 
 <link href="__PUBLIC__/css/common_yckj.css"  rel="stylesheet" type="text/css" />
 <link href="__PUBLIC__/css/main.css"  rel="stylesheet" type="text/css" />
-<script src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
+<link href="__PUBLIC__/js/toast/toast.css"  rel="stylesheet" type="text/css" />
+<script src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
+<script src="__PUBLIC__/js/clipboard.js"></script>
+<script src="__PUBLIC__/js/toast/toast.js"></script>

+ 13 - 0
Config/config.php.bak

@@ -0,0 +1,13 @@
+<?php
+$config = array (
+		'PAGE_SIZE'=>15,
+		'DB_TYPE' => 'mysql', // 数据库类型
+		'DB_HOST' => '127.0.0.1', // 服务器地址
+		'DB_NAME' => 'information_schema', // 数据库名
+		'DB_USER' => 'root', // 用户名
+		'DB_PWD' => 'root', // 密码
+		'DB_PORT' => '3306', // 端口
+		'DB_PREFIX' => '', // 数据库表前缀
+		// 是否开启session
+		'SESSION_AUTO_START' => true 
+);

File diff suppressed because it is too large
+ 7 - 0
Public/js/clipboard.js


+ 97 - 0
Public/js/toast/toast.css

@@ -0,0 +1,97 @@
+@charset "UTF-8";
+/* Welcome to Compass.
+ * In this file you should write your main styles. (or centralize your imports)
+ * Import this file using the following HTML or equivalent:
+ * <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */
+/* line 5, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td,
+article, aside, canvas, details, embed,
+figure, figcaption, footer, header, hgroup,
+menu, nav, output, ruby, section, summary,
+time, mark, audio, video {
+    margin: 0;
+    padding: 0;
+    border: 0;
+    font: inherit;
+    font-size: 100%;
+    vertical-align: baseline;
+}
+
+/* line 22, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+html {
+    line-height: 1;
+}
+
+/* line 24, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+ol, ul {
+    list-style: none;
+}
+
+/* line 26, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+table {
+    border-collapse: collapse;
+    border-spacing: 0;
+}
+
+/* line 28, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+caption, th, td {
+    text-align: left;
+    font-weight: normal;
+    vertical-align: middle;
+}
+
+/* line 30, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+q, blockquote {
+    quotes: none;
+}
+/* line 103, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+q:before, q:after, blockquote:before, blockquote:after {
+    content: "";
+    content: none;
+}
+
+/* line 32, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+a img {
+    border: none;
+}
+
+/* line 116, C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
+article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
+    display: block;
+}
+
+/* line 13, ../sass/toast.scss */
+.cpt-toast {
+    position: fixed;
+    left: 50%;
+    top: 50%;
+    text-align: center;
+    animation-duration: 0.3s;
+    max-width: 300px;
+    line-height: 20px;
+    display: inline-block;
+    vertical-align: middle;
+    *vertical-align: auto;
+    *zoom: 1;
+    *display: inline;
+    -moz-transition: all 0.3s ease;
+    -o-transition: all 0.3s ease;
+    -webkit-transition: all 0.3s ease;
+    transition: all 0.3s ease;
+    transform: translate(-50%, -50%);
+    transform: translate3d(-50%, -50%, 0);
+    font-family: '微软雅黑','Microsoft Yahei';
+    -moz-user-select: -moz-none;
+    -ms-user-select: none;
+    -webkit-user-select: none;
+    user-select: none;
+    word-wrap: break-word;
+}

+ 132 - 0
Public/js/toast/toast.js

@@ -0,0 +1,132 @@
+'use strict';
+(function($,window){
+    //动态加载animate
+    var loadStyles = function(url) {
+        var hasSameStyle = false;
+        var links = $('link');
+        for(var i = 0;i<links.length;i++){
+            if(links.eq(i).attr('href') == url){
+                hasSameStyle = true;
+                return
+            }
+        }
+
+        if(!hasSameStyle){
+            var link = document.createElement("link");
+            link.type = "text/css";
+            link.rel = "stylesheet";
+            link.href = url;
+            document.getElementsByTagName("head")[0].appendChild(link);
+        }
+    }
+
+    loadStyles('css/animate.css');
+
+    //显示提示信息    toast
+    $.fn.toast = function(options){
+        var $this = $(this);
+        var _this = this;
+        return this.each(function(){
+            $(this).css({
+                position:'relative'
+            });
+            var top = '';		//bottom的位置
+            var translateInfo = ''; 	//居中和不居中时的tarnslate
+
+            var box = '';   //消息元素
+            var defaults = {
+                position:  			  "absolute", 				//不是body的话就absolute
+                animateIn:  		  "fadeIn",					//进入的动画
+                animateOut: 		  "fadeOut",				//结束的动画
+                padding:              "10px 20px",              //padding
+                background:           "rgba(7,17,27,0.66)",     //背景色
+                borderRadius:         "6px",                    //圆角
+                duration:             3000,                     //定时器时间
+                animateDuration: 	  500, 						//执行动画时间
+                fontSize:             14,                   	//字体大小
+                content:              "这是一个提示信息",       //提示内容
+                color:                "#fff",                   //文字颜色
+                top:            	  "80%",                	//bottom底部的位置    具体的数值 或者center  垂直居中
+                zIndex:               1000001,                	//层级
+                isCenter:   		  true, 					//是否垂直水平居中显示
+                closePrev: 			  true, 					//在打开下一个toast的时候立即关闭上一个toast
+            }
+
+            var opt = $.extend(defaults,options||{});
+            var t = '';
+
+            // setTimeout(function(){
+            //   	box.addClass('show');
+            // },10);
+
+            top = opt.isCenter===true? '50%':opt.top;
+
+            defaults.isLowerIe9 = function(){
+                return (!window.FormData);
+            }
+
+            // translateY(-50%)
+            // translateInfo = opt.isCenter===true? 'translate3d(-50%,0,0)':'translate3d(-50%,-50%,0)';
+
+            defaults.createMessage = function(){
+                if(opt.closePrev){
+                    $('.cpt-toast').remove();
+                }
+                box = $("<span class='animated "+opt.animateIn+" cpt-toast'></span>").css({
+                    "position":opt.position,
+                    "padding":opt.padding,
+                    "background":opt.background,
+                    "font-size":opt.fontSize,
+                    "-webkit-border-radius":opt.borderRadius,
+                    "-moz-border-radius":opt.borderRadius,
+                    "border-radius":opt.borderRadius,
+                    "color":opt.color,
+                    "top":top,
+                    "z-index":opt.zIndex,
+                    "-webkit-transform":'translate3d(-50%,-50%,0)',
+                    "-moz-transform":'translate3d(-50%,-50%,0)',
+                    "transform":'translate3d(-50%,-50%,0)',
+                    '-webkit-animation-duration':opt.animateDuration/1000+'s',
+                    '-moz-animation-duration':opt.animateDuration/1000+'s',
+                    'animation-duration':opt.animateDuration/1000+'s',
+                }).html(opt.content).appendTo($this);
+                defaults.colseMessage();
+            }
+
+            defaults.colseMessage = function(){
+                var isLowerIe9 = defaults.isLowerIe9();
+                if(!isLowerIe9){
+                    t = setTimeout(function(){
+                        box.removeClass(opt.animateIn).addClass(opt.animateOut).on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',function(){
+                            box.remove();
+                        });
+                        box.remove();
+                    },opt.duration);
+                }else{
+                    t = setTimeout(function(){
+                        box.remove();
+                    },opt.duration);
+                }
+            }
+
+            defaults.createMessage();
+        })
+    };
+})(jQuery,window);
+
+
+var showMessage = function(content,duration,isCenter,animateIn,animateOut){
+    var animateIn = animateIn || 'fadeIn';
+    var animateOut = animateOut || 'fadeOut';
+    var content = content || '这是一个提示信息';
+    var duration = duration || '2000';
+    var isCenter = isCenter || false;
+    $('body').toast({
+        position:'fixed',
+        animateIn:animateIn,
+        animateOut:animateOut,
+        content:content,
+        duration:duration,
+        isCenter:isCenter,
+    });
+}