Starrysky前端框架

链接:https://pan.baidu.com/s/1P8mPrHZjyRtzw1NWnAx-9w
提取码:cjl5

接口文档:https://www.showdoc.cc/xinghan

Element开发组件

https://element.eleme.cn/#/zh-CN

1、启动前端页面

打开index.html

2、在index里创建文件

2.1 创建一个叫mjz的目录

复制一份<dd></dd>标签

                                <dd data-name="console" >
                                    <!--<iframe src="starrysky_v2/test.html">test</iframe>-->
                                    <a lay-href="starrysky_v2/mjz.html">mjz</a>

                                </dd>

2.2 在starrysky_v2目录下创建一个mjz.html

3、开发mjz页面

3.1 把样式和组件库导入到mjz.html里

<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>

检查

3.2 添加一个搜索输入框、下拉框、搜索按钮

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>mjz</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
    <div id="search">
        <el-form :inline="true" :model="query_search" class="demo-form-inline">
            <el-form-item>
                <el-input v-model="query_search.search" placeholder="搜索"></el-input>
            </el-form-item>
            <el-form-item label="活动区域">
                <el-select v-model="query_search.project" placeholder="活动区域">
                    <el-option label="区域一" value="shanghai"></el-option>
                    <el-option label="区域二" value="beijing"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
        </el-form>
    </div>
</div>
<!-- import Vue before Element -->
<script src="../js/vue.js"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            query_search: {
                search: '',
                project: ''
            }
        },
        methods: {
            onSubmit() {
                console.log('submit!');
            }
        }
    })
</script>
</body>
</html>

注意:VUE必须防止Element前

3.3 添加项目下拉选项

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>mjz</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
    <div id="search">
        <el-form :inline="true" class="demo-form-inline">
            <el-form-item>
                <el-input v-model="query_search.search" placeholder="搜索"></el-input>
            </el-form-item>
            <el-form-item>
                <el-select v-model="query_search.project">
                    <el-option v-for="item in projects" :key="item.name" :value="item.id" :label="item.name"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">添加</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">运行</el-button>
            </el-form-item>
        </el-form>
    </div>
</div>
<!-- import Vue before Element -->
<script src="../js/vue.js"></script>
<script src="../js/axios.min.js"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="../js/config.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            query_search: {
                search: '',
                project: ''
            },
            projects:[]
        },
        methods: {
            onSubmit() {
                console.log('submit!');
            },
            get_project_data(){
                axios({
                    method:'get',
                    url:host + '/api/project'
                }).then((response)=>{
                    this.projects = response.data.data;
                })
            }
        },
        created:function () {
            // 请求项目接口,获取项目数据
            this.get_project_data()
        }
    })
</script>
</body>
</html>

3.4 获取用例集合信息,在前端显示

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>mjz</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
    <div id="search">
        <el-form :inline="true" class="demo-form-inline">
            <el-form-item>
                <el-input v-model="query_search.search" placeholder="搜索"></el-input>
            </el-form-item>
            <el-form-item>
                <el-select v-model="query_search.project">
                    <el-option v-for="item in projects" :key="item.id" :value="item.id" :label="item.name"></el-option>
                </el-select>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="search">查询</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">添加</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">运行</el-button>
            </el-form-item>
        </el-form>
    </div>
    <div id="table">
        <el-table
                ref="multipleTable"
                :data="case_collection_data"
                tooltip-effect="dark"
                style="width: 100%"
                @selection-change="handleSelectionChange">
            <el-table-column
                    type="selection"
                    width="55">
            </el-table-column>
            <el-table-column
                    label="集合名称"
                    width="120">
                <template slot-scope="scope">
                    <el-button type="text">{{scope.row.name}}</el-button>
                </template>
            </el-table-column>
            <el-table-column
                    prop="desc"
                    label="描述"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="project_name"
                    label="归属项目"
                    show-overflow-tooltip>
            </el-table-column>
            <el-table-column
                    prop="case_count"
                    label="用例数量"
                    show-overflow-tooltip>
            </el-table-column>
            <el-table-column
                    prop="report_name"
                    label="测试报告"
                    show-overflow-tooltip>
                <el-button>查看</el-button>
            </el-table-column>
            <el-table-column
                    prop="user"
                    label="创建用户"
                    show-overflow-tooltip>
            </el-table-column>
            <el-table-column
                    label="状态"
                    show-overflow-tooltip>
                <template slot-scope="scope">
                    <el-tag type="danger">{{ scope.row.status|replaceStatus }}</el-tag>
                </template>
            </el-table-column>
            <el-table-column
                    prop="create_time"
                    label="创建时间"
                    show-overflow-tooltip>
            </el-table-column>
            <el-table-column
                    prop="address"
                    label="操作"
                    show-overflow-tooltip>
                <el-button>选择用例</el-button>
                <el-button type="danger">删除</el-button>
            </el-table-column>
        </el-table>
    </div>
    <div id="pagination">
        <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="query_search.page"
                :page-sizes="[5,10]"
                :page-size="query_search.limit"
                layout="total, sizes, prev, pager, next, jumper"
                :total="count">
        </el-pagination>

    </div>

</div>
<!-- import Vue before Element -->
<script src="../js/vue.js"></script>
<script src="../js/axios.min.js"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="../js/config.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            query_search: {
                search: undefined,
                project: undefined,
                page: 1,
                limit: 5
            },
            projects: [],
            case_collection_data: [],
            multipleSelection: [],
            count: 0,

        },
        methods: {
            search() {
                this.get_page_data()
            },
            handleSizeChange(val) {
                this.query_search.limit = val;
                this.get_page_data()
            },
            handleCurrentChange(val) {
                this.query_search.page = val;
                this.get_page_data()
            },
            handleSelectionChange(val) {
                let ids = [];
                for (var num in val) {
                    ids.push(val[num].id)
                }
                this.multipleSelection = ids;
            },
            onSubmit() {
                console.log('submit!');
            },
            get_project_data() {
                axios({
                    method: 'get',
                    url: host + '/api/project'
                }).then((response) => {

                    this.projects = response.data.data;
                })
            },
            get_page_data() {
                axios({
                    method: 'get',
                    url: host + '/api/case_collection',
                    params: this.query_search
                }).then((response) => {
                    this.case_collection_data = response.data.data;
                    this.count = response.data.count;
                })
            }
        },
        created: function () {
            // 请求项目接口 获取项目数据
            this.get_project_data();
            // 获取页面的数据
            this.get_page_data()
        },
        filters: {
            replaceStatus(status) {
                if (status == 3) {
                    return '运行中'
                }
            }
        }
    })

</script>
</body>
</html>

HTML基础五-starrysky页面动起来的更多相关文章

  1. 从零开始学习jQuery (七) jQuery动画-让页面动起来!

    一.摘要 本系列文章将带您进入jQuery的精彩世界, 其中有很多作者具体的使用经验和解决方案,  即使你会使用jQuery也能在阅读中发现些许秘籍. 开发人员一直痛疼做动画. 但是有了jQuery你 ...

  2. Bootstrap <基础二十三>页面标题(Page Header)

    页面标题(Page Header)是个不错的功能,它会在网页标题四周添加适当的间距.当一个网页中有多个标题且每个标题之间需要添加一定的间距时,页面标题这个功能就显得特别有用.如需使用页面标题(Page ...

  3. Bootstrap <基础五>表格

    Bootstrap 提供了一个清晰的创建表格的布局.下表列出了 Bootstrap 支持的一些表格元素: 标签 描述 <table> 为表格添加基础样式. <thead> 表格 ...

  4. GSAP JS基础教程--使用缓动函数

    今天来了解一下缓动easeing函数. 开始,如果你还没有GSAP的类包,可以到GreenSock的官网去下载最新版本的类包,或者直接点击这里​来下载 学习之前,先来准备一下:     <!DO ...

  5. day 70 Django基础五之django模型层(二)多表操作

    Django基础五之django模型层(二)多表操作   本节目录 一 创建模型 二 添加表记录 三 基于对象的跨表查询 四 基于双下划线的跨表查询 五 聚合查询.分组查询.F查询和Q查询 六 ORM ...

  6. day 56 Django基础五之django模型层(二)多表操作

    Django基础五之django模型层(二)多表操作   本节目录 一 创建模型 二 添加表记录 三 基于对象的跨表查询 四 基于双下划线的跨表查询 五 聚合查询.分组查询.F查询和Q查询 六 ORM ...

  7. Django基础五之Ajax

    Django基础五之Ajax 目录 Django基础五之Ajax 1. Ajax介绍 2. Ajax前后端传值 2.1 方法一HttpResponse直接返回 2.2 方法二使用Json格式返回 2. ...

  8. 七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理

    系列文章 七天学会ASP.NET MVC (一)——深入理解ASP.NET MVC 七天学会ASP.NET MVC (二)——ASP.NET MVC 数据传递 七天学会ASP.NET MVC (三)— ...

  9. 玩转HTML5移动页面(动效篇)(转载)

    本文转载自: 玩转HTML5移动页面(动效篇)

随机推荐

  1. 机器学习之感知器和线性回归、逻辑回归以及SVM的相互对比

    线性回归是回归模型 感知器.逻辑回归以及SVM是分类模型 线性回归:f(x)=wx+b 感知器:f(x)=sign(wx+b)其中sign是个符号函数,若wx+b>=0取+1,若wx+b< ...

  2. ReverseInteger:实现int整数的反转

    原文链接 Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 ...

  3. 随便读读skynet开源项目RILLSERVER

    读RILL SERVER 因为源码是前段时间下载的,最近才拿出来分析,今天发现已经更新了,比如删除了module中订阅那些代码.但是并不影响总体的思路. 他加入了behavior3 . pl .FSM ...

  4. LeetCode 151:给定一个字符串,逐个翻转字符串中的每个单词 Reverse Words in a String

    公众号:爱写bug(ID:icodebugs) 翻转字符串里的单词 Given an input string, reverse the string word by word. 示例 1: 输入: ...

  5. redis集群之Sentinel

    目前我们讲的 Redis 还只是主从方案,最终一致性.读者们可思考过,如果主节点凌晨3 点突发宕机怎么办?就坐等运维从床上爬起来,然后手工进行从主切换,再通知所有的程序把地址统统改一遍重新上线么?毫无 ...

  6. 『The Counting Problem 数位dp』

    The Counting Problem Description 求 [L,R]内每个数码出现的次数. Input Format 若干行,一行两个正整数 L 和 R. 最后一行 L=R=0,表示输入结 ...

  7. generator的本质是将异步的管理剥离

    generator的本质是将异步的管理剥离

  8. Microsoft.Practices.Unity

    // // Summary: // Register a type mapping with the container. // // Parameters: // container: // Con ...

  9. ASP.NET Core中的jQuery Unobtrusive Ajax帮助器

    最近在ASP.NET Core下写文章管理系统时,准备在分页显示文章内容时,使用Ajax.网上找了篇帖文,简单翻一下,仅供自己查阅. 原链接:https://dotnetthoughts.net/jq ...

  10. C#中使用WCF创建面向网络的服务程序

    如题. 这种东西基于微软的一整套东西,在.NET内使用特别方便.利弊自行衡量,是否使用自行决定. 步骤1.创建一组在网上发布的方法 新建项目,类型选择“WCF服务应用程序”  在项目里,你可以补充任意 ...