..
This commit is contained in:
@@ -39,20 +39,29 @@ layout("/layouts/platform_1.html"){
|
|||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card shadow="never" class="mt-3">
|
<el-card shadow="never" class="mt-3">
|
||||||
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
|
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData" @cell-click="cellClick">
|
||||||
<el-table-column label="队伍" prop="groupName" header-align="center" align="center"
|
<el-table-column label="队伍" prop="groupName" fixed="left" width="100px"></el-table-column>
|
||||||
width="100px"></el-table-column>
|
|
||||||
|
|
||||||
<el-table-column v-for="item in itemOptions" :key="item.id" :label="item.name" show-overflow-tooltip
|
<el-table-column v-for="item in itemOptions" :key="item.id" :label="item.name" show-overflow-tooltip
|
||||||
width="10%">
|
width="10%">
|
||||||
<template slot="header" slot-scope="scope">
|
<template slot="header" slot-scope="scope">
|
||||||
<span v-html="formatName(item.name)"></span>
|
<span v-html="formatName(item.name)"></span>
|
||||||
</template>
|
</template>
|
||||||
<el-table-column label="成绩" min-width="50px"></el-table-column>
|
<el-table-column label="成绩" :prop="item.id+item.name" min-width="50px">
|
||||||
<el-table-column label="名次" min-width="50px"></el-table-column>
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row[item.id]['totalScore']"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="名次" :prop="item.id+item.name" min-width="50px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row[item.id]['totalRank']"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!--#include("/layouts/pagination.html"){}#-->
|
<el-row type="flex"justify="end" class="mt-3">
|
||||||
|
<el-button type="primary" @click="saveScore">保存</el-button>
|
||||||
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -76,10 +85,12 @@ layout("/layouts/platform_1.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 格式化名称
|
||||||
formatName(name) {
|
formatName(name) {
|
||||||
if (!name) return ""
|
if (!name) return ""
|
||||||
return name.match(/.{1,4}/g)?.join("<br>") || ""
|
return name.match(/.{1,4}/g)?.join("<br>") || ""
|
||||||
},
|
},
|
||||||
|
// 获取活动
|
||||||
listAct() {
|
listAct() {
|
||||||
$.get("/platform/activity/scoreEnter/list-activity", this.pageForm).then(res => {
|
$.get("/platform/activity/scoreEnter/list-activity", this.pageForm).then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
@@ -93,35 +104,61 @@ layout("/layouts/platform_1.html"){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
listGroup() {
|
// 获取队伍
|
||||||
$.get("/platform/activity/scoreEnter/list-group/" + this.pageForm.activityId).then(res => {
|
async listGroup() {
|
||||||
if (res.code === 0) {
|
const {
|
||||||
this.groupOptions = res.data
|
code,
|
||||||
|
data,
|
||||||
|
msg
|
||||||
|
} = await $.get("/platform/activity/scoreEnter/list-group/" + this.pageForm.activityId)
|
||||||
|
if (code === 0) {
|
||||||
|
this.groupOptions = data
|
||||||
|
} else {
|
||||||
|
this.$message.error(msg)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取项目
|
||||||
|
async listItem() {
|
||||||
|
const {
|
||||||
|
code,
|
||||||
|
data,
|
||||||
|
msg
|
||||||
|
} = await $.get("/platform/activity/scoreEnter/list-item/" + this.pageForm.activityId)
|
||||||
|
if (code === 0) {
|
||||||
|
this.itemOptions = data
|
||||||
|
} else {
|
||||||
|
this.$message.error(msg)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 活动改变
|
||||||
|
async activityChange() {
|
||||||
|
await this.listGroup()
|
||||||
|
await this.listItem()
|
||||||
this.buildTableData()
|
this.buildTableData()
|
||||||
} else {
|
|
||||||
this.$message.error(res.msg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
listItem() {
|
|
||||||
$.get("/platform/activity/scoreEnter/list-item/" + this.pageForm.activityId).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.itemOptions = res.data
|
|
||||||
} else {
|
|
||||||
this.$message.error(res.msg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
activityChange() {
|
|
||||||
this.listGroup()
|
|
||||||
this.listItem()
|
|
||||||
},
|
},
|
||||||
|
// 构建表格数据
|
||||||
buildTableData() {
|
buildTableData() {
|
||||||
this.tableData = this.groupOptions.map((group) => {
|
this.tableData = this.groupOptions.map((group) => {
|
||||||
return{
|
const row = {
|
||||||
|
groupId: group.id,
|
||||||
groupName: group.groupName
|
groupName: group.groupName
|
||||||
}
|
}
|
||||||
|
this.itemOptions.forEach((item) => {
|
||||||
|
row[item.id] = {
|
||||||
|
totalScore: item.totalScore,
|
||||||
|
totalRank: item.totalRank
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
return row
|
||||||
|
})
|
||||||
|
console.log(this.tableData)
|
||||||
|
},
|
||||||
|
// 单元格点击
|
||||||
|
cellClick(row, column){
|
||||||
|
console.log(row, column)
|
||||||
|
},
|
||||||
|
// 保存成绩
|
||||||
|
saveScore(){
|
||||||
console.log(this.tableData)
|
console.log(this.tableData)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import {setupRouterInterceptor, getDefaultWhiteList} from './utils/routerInterceptor'
|
import {checkAuth, setupRouterInterceptor, getDefaultWhiteList} from './utils/routerInterceptor'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
globalData: {
|
globalData: {
|
||||||
@@ -7,7 +7,9 @@ export default {
|
|||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
console.log('App Launch')
|
console.log('App Launch')
|
||||||
|
console.log(process.env.VUE_APP_PLATFORM)
|
||||||
|
// 检查访问页面是否需要登录(不走拦截器 直接从地址栏进入)
|
||||||
|
checkAuth()
|
||||||
// 初始化路由拦截器
|
// 初始化路由拦截器
|
||||||
setupRouterInterceptor(getDefaultWhiteList())
|
setupRouterInterceptor(getDefaultWhiteList())
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -68,5 +68,11 @@
|
|||||||
"uniStatistics": {
|
"uniStatistics": {
|
||||||
"enable": false
|
"enable": false
|
||||||
},
|
},
|
||||||
|
"h5": {
|
||||||
|
"title": "趣味运动会",
|
||||||
|
"router": {
|
||||||
|
"mode": "history"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vueVersion" : "3"
|
"vueVersion" : "3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,32 @@ export const setupRouterInterceptor = (whiteList = []) => {
|
|||||||
addNavigationInterceptors(whiteList)
|
addNavigationInterceptors(whiteList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const checkAuth = () => {
|
||||||
|
debugger
|
||||||
|
if (process.env.VUE_APP_PLATFORM === 'h5' && window.location.pathname !== '/') {
|
||||||
|
const path = window.location.pathname.replace(/^\//, '')
|
||||||
|
if (!getDefaultWhiteList().includes(path)) {
|
||||||
|
const token = uni.getStorageSync('token')
|
||||||
|
if(token){
|
||||||
|
// 获取用户信息
|
||||||
|
const {user} = getApp().globalData
|
||||||
|
if(user == null){
|
||||||
|
return useRequest().get('/client/auth/info').then(({code, data, msg}) => {
|
||||||
|
if(code === 0){
|
||||||
|
getApp().globalData.user = data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加所有导航方法的拦截器
|
* 添加所有导航方法的拦截器
|
||||||
* @param {Array} whiteList - 白名单页面列表
|
* @param {Array} whiteList - 白名单页面列表
|
||||||
|
|||||||
Reference in New Issue
Block a user