gameRecord.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div class="record-warp">
  3. <div class="record-main">
  4. <el-row>
  5. <el-col :span="24">
  6. <div class="search-head">
  7. <el-input
  8. v-model="keyword"
  9. clearable
  10. placeholder="请输入游戏名称"
  11. ></el-input>&nbsp;&nbsp;
  12. <el-button type="primary" @click="searchTarget">搜索</el-button>
  13. </div>
  14. </el-col>
  15. </el-row>
  16. <div class="table-content">
  17. <el-table
  18. :data="tableData"
  19. :row-style="{ height: '0px' }"
  20. :cell-style="{ padding: '5px' }"
  21. >
  22. <el-table-column prop="name" label="游戏名称" align="center" width="">
  23. </el-table-column>
  24. <el-table-column label="操作" width="" align="center">
  25. <template slot-scope="scope">
  26. <el-button
  27. @click.native.prevent="view(scope.$index, scope.row)"
  28. type="primary"
  29. size="small"
  30. >
  31. 查看
  32. </el-button>
  33. </template>
  34. </el-table-column>
  35. </el-table>
  36. </div>
  37. <el-pagination
  38. small
  39. background
  40. @current-change="handleCurrentChange"
  41. :current-page.sync="pageNum"
  42. layout="total, prev, pager, next"
  43. :page-size="pageSize"
  44. :total="total"
  45. >
  46. </el-pagination>
  47. <!-- <el-pagination small background layout="total prev, pager, next" :total="36">
  48. </el-pagination> -->
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. import { oSessionStorage } from "../../utils/utils";
  54. export default {
  55. name: "gameRecord",
  56. components: {},
  57. data() {
  58. return {
  59. total: 0,
  60. pageSize: 10,
  61. pageNum: 1,
  62. keyword: "",
  63. tableData: [
  64. {
  65. date: "2016-05-03",
  66. name: "王小虎",
  67. province: "上海",
  68. city: "普陀区",
  69. address: "上海市普陀区金沙江路 1518 弄",
  70. zip: 200333,
  71. },
  72. {
  73. date: "2016-05-02",
  74. name: "王小虎",
  75. province: "上海",
  76. city: "普陀区",
  77. address: "上海市普陀区金沙江路 1518 弄",
  78. zip: 200333,
  79. },
  80. {
  81. date: "2016-05-04",
  82. name: "王小虎",
  83. province: "上海",
  84. city: "普陀区",
  85. address: "上海市普陀区金沙江路 1518 弄",
  86. zip: 200333,
  87. },
  88. {
  89. date: "2016-05-01",
  90. name: "王小虎",
  91. province: "上海",
  92. city: "普陀区",
  93. address: "上海市普陀区金沙江路 1518 弄",
  94. zip: 200333,
  95. },
  96. {
  97. date: "2016-05-04",
  98. name: "王小虎",
  99. province: "上海",
  100. city: "普陀区",
  101. address: "上海市普陀区金沙江路 1518 弄",
  102. zip: 200333,
  103. },
  104. {
  105. date: "2016-05-04",
  106. name: "王小虎",
  107. province: "上海",
  108. city: "普陀区",
  109. address: "上海市普陀区金沙江路 1518 弄",
  110. zip: 200333,
  111. },
  112. ],
  113. userInfo: {}, //用户信息
  114. userId: "", //用户id
  115. };
  116. },
  117. created() {},
  118. mounted() {
  119. this.searchTarget();
  120. },
  121. methods: {
  122. view(val, value) {
  123. //跳转页面
  124. sessionStorage.setItem("gameManageId", value.flag);
  125. this.$router.push({ path: "/manage/gameRecord/detail" });
  126. },
  127. handleCurrentChange(val) {
  128. this.pageNum = val;
  129. this.searchList();
  130. },
  131. //根据现有情况进行搜索
  132. searchList() {
  133. this.$http.get(
  134. `game/findAll?pageNum=${this.pageNum}&pageSize=${this.pageSize}&name=${this.keyword}`,
  135. {},
  136. (res) => {
  137. // console.log(res,'用户测试记录')
  138. if (res && res.code == 200) {
  139. this.tableData = res.data.gameInfos;
  140. this.total = res.data.num;
  141. } else {
  142. // this.$toast.fail(res.msg);
  143. this.$message.error(res.msg);
  144. }
  145. }
  146. );
  147. },
  148. searchTarget() {
  149. this.pageNum = 1;
  150. this.searchList();
  151. },
  152. //跳转首页
  153. goHome() {
  154. this.$router.push({ path: "/home" });
  155. },
  156. //跳转记录页
  157. goRecord() {
  158. this.$router.push({ path: "/record" });
  159. },
  160. //退出登陆
  161. logout() {
  162. oSessionStorage.removeItem("userInfo");
  163. oSessionStorage.removeItem("token");
  164. this.$router.push({ path: "/" });
  165. },
  166. //点击日历获取日期
  167. getDate(param) {
  168. // console.log(param,"日期。。。")
  169. this.userRecord(param.dateStr);
  170. },
  171. //点击获取月出勤次数
  172. getTimes(param) {
  173. this.monthTimes = param;
  174. },
  175. // 用户测试记录显示
  176. userRecord(date) {
  177. this.$http.get(
  178. `gameRecord/findListByUserIdAndDate/${this.userId}/${date}`,
  179. {},
  180. (res) => {
  181. // console.log(res,'用户测试记录')
  182. if (res && res.code == 200) {
  183. this.listData = res.data;
  184. } else {
  185. this.$toast.fail(res.msg);
  186. }
  187. }
  188. );
  189. },
  190. },
  191. };
  192. </script>
  193. <style lang="less" scoped>
  194. @import "../../styles/theme.less";
  195. .record-warp {
  196. width: 100%;
  197. height: 100%;
  198. //background: url(../../assets/img/index/19.png) no-repeat center;
  199. //background-size: 100% 100%;
  200. position: relative;
  201. .record-main {
  202. width: 100%;
  203. height: 100%;
  204. box-sizing: border-box;
  205. overflow-y: auto;
  206. .search-head {
  207. width: 100%;
  208. display: flex;
  209. flex-direction: row;
  210. justify-content: flex-start;
  211. align-items: center;
  212. }
  213. .table-content {
  214. margin: 10px 0;
  215. }
  216. }
  217. }
  218. </style>