上个月月考题

<head>
        <meta charset="utf-8" />
        <title></title>
        <script type="text/javascript" src="js/angular.min.js" ></script>
        <script type="text/javascript" src="js/jquery-3.2.1.min.js" ></script>
        <script>
            var app = angular.module("myApp",[]);
            app.controller("myCtrl",function($scope){
                $scope.products = [
                {"name":"前任三","type":["喜剧","爱情"],"time":120,"author":"田羽生","price":35.9,"playTime":1511050949001,"score":9.3},
                {"name":"速度与激情8","type":["动作","冒险"],"time":145,"author":"格雷","price":45.5,"playTime":1450000949001,"score":9.5},
                {"name":"羞羞的铁拳","type":["喜剧","爱情"],"time":135,"author":"宋阳","price":42.5,"playTime":1511000949001,"score":8.6},
                {"name":"太空救援","type":["冒险","科幻"],"time":108,"author":"弗拉基米尔","price":38.9,"playTime":1516000949001,"score":9.4}
                ]
                //全选
                $scope.xz = function(){
                    for(var i=0;i<$scope.products.length;i++){
                        $scope.products[i].ck = $scope.x;
                    }
                }
                //批量删除
                $scope.plsc = function(){
                    for(var i=0;i<$scope.products.length;i++){
                        if($scope.products[i].ck){
                            $scope.products.splice(i,1);
                            i--;
                        }
                        
                    }
                }
                //删除
                $scope.sc = function(i){
                    $scope.products.splice(i,1);
                }
                //修改
                    $scope.xg=function(s){
                        var score2= prompt("评分修改",s.score); //弹框,修改原来的值
                        s.score=score2;
                    }
            });
        </script>
    </head>
    <body ng-app="myApp" ng-controller="myCtrl">
        <input type="text" placeholder="按电影名称模糊查询" ng-model="cx" style="border-radius: 10px;"  />
        <button ng-click="ss = true" >搜索</button>
        <select ng-model="px">
            <option value="">--按要求排序--</option>
            <option value="time">时长正序</option>
            <option value="-time">时长倒序</option>
            <option value="price">售价正序</option>
            <option value="-price">售价倒序</option>
            <option value="playTime">上映时间正序</option>
            <option value="-playTime">上映时间倒序</option>
            <option value="score">评分正序</option>
            <option value="-score">评分倒序</option>
        </select>
        <button ng-click="plsc()" ng-model="pl">批量删除</button>
        
        <table border="1" ng-show="ss">
            <thead>
                <tr>
                    <td><input type="checkbox" ng-click="xz()" ng-model="x" /></td>
                    <td>电影名称</td>
                    <td>类别</td>
                    <td>时长</td>
                    <td>导演</td>
                    <td>售价</td>
                    <td>上映时间</td>
                    <td>评分</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="s in products | filter:{name:cx} | orderBy:px">
                    <td><input type="checkbox" ng-model="s.ck" /></td>
                    <td>{{s.name}}</td>
                    <td>{{s.type}}</td>
                    <td>{{s.time}}</td>
                    <td>{{s.author}}</td>
                    <td>{{s.price | currency:"¥"}}</td>
                    <td>{{s.playTime | date:"yyyy-MM-dd hh:mm:ss"}}</td>
                    <td>{{s.score}}</td>
                    <td>
                        <button ng-click="xg(s)" >修改</button>
                        <button ng-click="sc()" ng-model="s">删除</button>
                    </td>
                </tr>
            </tbody>
            
        </table>
    </body>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值