| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <html lang="zh">
- <head>
- <title>百日题库-题目合集</title>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <script src="/static/vue.js"></script>
- <script src="/static/jquery.min.js"></script>
- <style>
- .click {
- font-size: 22px;
- /*text-decoration: underline;*/
- user-select: none;
- cursor: pointer;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <p v-show="msg!=''">{{msg}}</p>
- <p v-show="updateTime!=''">更新时间:{{updateTime}}</p>
- <p class="click" v-for="c in courses" @click="chooseCourse(c.id, c.name)">{{c.name}}</p>
- </div>
- <script>
- var URL_PREFIX = "";
- var app = new Vue({
- el: '#app',
- data: {
- msg: "loading...",
- updateTime: "",
- courses: []
- },
- methods: {
- chooseCourse(id, courseName) {
- courseName = courseName.split(' ');
- if (courseName.length < 2 || courseName[1] === '') {
- courseName = courseName[0];
- }
- else {
- courseName = courseName[1];
- }
- location.href = URL_PREFIX + "/course/" + id + "?course_name=" + encodeURI(courseName);
- },
- getCourse() {
- var self = this;
- $.ajax({
- url: URL_PREFIX + "/get/course",
- success: function(data) {
- console.log(data);
- if (data["success"]) {
- self.msg = "";
- self.updateTime = data["time"];
- self.courses = data["data"]["results"];
- }
- else {
- self.msg = "获取失败";
- }
- }
- });
- }
- },
- mounted() {
- this.getCourse();
- }
- });
- </script>
- </body>
- </html>
|