gameRecordDetail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. class="main_input"
  11. placeholder="请输入账号"
  12. ></el-input>&nbsp;&nbsp;
  13. <el-date-picker
  14. clearable
  15. class="popperClass"
  16. v-model="value1"
  17. type="daterange"
  18. range-separator="至"
  19. start-placeholder="开始日期"
  20. end-placeholder="结束日期"
  21. @change="timeFo"
  22. >
  23. </el-date-picker>&nbsp;&nbsp;
  24. <el-button type="primary" @click="searchTarget">搜索</el-button>
  25. </div>
  26. </el-col>
  27. </el-row>
  28. <div class="table-content">
  29. <el-table
  30. :data="tableData"
  31. :row-style="{ height: '0px' }"
  32. :cell-style="{ padding: '5px' }"
  33. >
  34. <el-table-column
  35. prop="gameName"
  36. label="游戏名称"
  37. align="center"
  38. width=""
  39. >
  40. </el-table-column>
  41. <el-table-column prop="userId" label="账号" align="center" width="">
  42. </el-table-column>
  43. <el-table-column
  44. prop="updateTime"
  45. label="测试时间"
  46. align="center"
  47. width=""
  48. >
  49. </el-table-column>
  50. <el-table-column
  51. prop="totalScore"
  52. label="得分"
  53. align="center"
  54. width=""
  55. >
  56. </el-table-column>
  57. <!-- <el-table-column label="操作" width="" align="center">
  58. <template slot-scope="scope">
  59. <el-button
  60. @click.native.prevent="view(scope.$index, scope.row)"
  61. type="text"
  62. size="small"
  63. style="font-size: 14px"
  64. >
  65. 查看
  66. </el-button>
  67. </template>
  68. </el-table-column> -->
  69. </el-table>
  70. </div>
  71. <el-pagination
  72. small
  73. background
  74. @current-change="handleCurrentChange"
  75. :current-page.sync="pageNum"
  76. layout="total, prev, pager, next"
  77. :page-size="pageSize"
  78. :total="total"
  79. >
  80. </el-pagination>
  81. <!-- <el-pagination small background layout="total prev, pager, next" :total="36">
  82. </el-pagination> -->
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. import { oSessionStorage } from "../../utils/utils";
  88. export default {
  89. name: "gameRecordDetail",
  90. components: {},
  91. data() {
  92. return {
  93. startTime: "",
  94. endTime: "",
  95. value1: null,
  96. total: 0,
  97. pageSize: 10,
  98. pageNum: 1,
  99. keyword: "",
  100. tableData: [],
  101. userInfo: {}, //用户信息
  102. gameId: "", //用户id
  103. type: 0, //用户查询类型0超管查询某游戏所有普通用户;1医生查询某游戏所有下属普通用户;2代理查询某游戏所有下属普通用户
  104. };
  105. },
  106. created() {},
  107. mounted() {
  108. this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
  109. this.gameId = sessionStorage.getItem("gameManageId");
  110. this.type = this.userInfo.roleType == 1 ? 0 : this.userInfo.roleType == 2 ? 1 : this.userInfo.roleType == 3 ? 2 : "";
  111. this.searchTarget();
  112. },
  113. methods: {
  114. timeFo(val) {
  115. if (val !== null) {
  116. this.startTime = this.formatterTime(val[0]);
  117. this.endTime = this.formatterTime(val[1]);
  118. } else {
  119. this.startTime = "";
  120. this.endTime = "";
  121. }
  122. this.searchTarget();
  123. },
  124. formatterTime(val) {
  125. let year = val.getFullYear();
  126. let month = val.getMonth() + 1;
  127. if (month < 10) {
  128. month = "0" + month;
  129. }
  130. let day = val.getDate();
  131. if (day < 10) {
  132. day = "0" + day;
  133. }
  134. return year + "-" + month + "-" + day;
  135. },
  136. //格式化时间
  137. view(val, value) {
  138. //跳转页面
  139. sessionStorage.setItem("manageUserId", value.id);
  140. },
  141. handleCurrentChange(val) {
  142. this.pageNum = val;
  143. this.searchList();
  144. },
  145. //根据现有情况进行搜索
  146. searchList() {
  147. this.$http.get(
  148. `gameRecord/findListByGameFlag?beginTime=${this.startTime}&endTime=${this.endTime}&phone=${this.keyword}&pageNum=${this.pageNum}&pageSize=${this.pageSize}&gameFlag=${this.gameId}&type=${this.type}&invitationCode=${this.userInfo.invitationCode}`,
  149. {},
  150. (res) => {
  151. // console.log(res,'用户测试记录')
  152. if (res && res.code == 200) {
  153. this.tableData = res.data.userEntities;
  154. this.total = res.data.num;
  155. } else {
  156. // this.$toast.fail(res.msg);
  157. this.$message.error(res.msg);
  158. }
  159. }
  160. );
  161. },
  162. searchTarget() {
  163. this.pageNum = 1;
  164. this.searchList();
  165. },
  166. //跳转首页
  167. goHome() {
  168. this.$router.push({ path: "/home" });
  169. },
  170. //跳转记录页
  171. goRecord() {
  172. this.$router.push({ path: "/record" });
  173. },
  174. //退出登陆
  175. logout() {
  176. oSessionStorage.removeItem("userInfo");
  177. oSessionStorage.removeItem("token");
  178. this.$router.push({ path: "/" });
  179. },
  180. //点击日历获取日期
  181. getDate(param) {
  182. // console.log(param,"日期。。。")
  183. this.userRecord(param.dateStr);
  184. },
  185. //点击获取月出勤次数
  186. getTimes(param) {
  187. this.monthTimes = param;
  188. },
  189. // 用户测试记录显示
  190. userRecord(date) {
  191. this.$http.get(
  192. `gameRecord/findListByUserIdAndDate/${this.userId}/${date}`,
  193. {},
  194. (res) => {
  195. // console.log(res,'用户测试记录')
  196. if (res && res.code == 200) {
  197. this.listData = res.data;
  198. } else {
  199. this.$toast.fail(res.msg);
  200. }
  201. }
  202. );
  203. },
  204. },
  205. };
  206. </script>
  207. <style lang="less" scoped>
  208. @import "../../styles/theme.less";
  209. .record-warp {
  210. width: 100%;
  211. height: 100%;
  212. //background: url(../../assets/img/index/19.png) no-repeat center;
  213. //background-size: 100% 100%;
  214. position: relative;
  215. .record-main {
  216. width: 100%;
  217. height: 100%;
  218. box-sizing: border-box;
  219. overflow-y: auto;
  220. .search-head {
  221. width: 100%;
  222. display: flex;
  223. flex-direction: row;
  224. justify-content: flex-start;
  225. align-items: center;
  226. }
  227. .table-content {
  228. margin: 10px 0;
  229. }
  230. }
  231. }
  232. </style>