Browse Source

优化及接口对接

master
zmt 3 years ago
parent
commit
7c514f42c1
  1. 6
      README.md
  2. 45
      components/no-data/no-data.vue
  3. 70
      nxTemp/apis/userAPI.js
  4. 5
      nxTemp/config/index.config.js
  5. 251
      pages/event/event_grade.vue
  6. 15
      pages/event/event_list.vue
  7. 38
      pages/login/login.vue
  8. BIN
      static/images/no_data.png

6
README.md

@ -126,3 +126,9 @@ B组件 触发($emit)
```npm install ```
```
{"id":148,"order_no":"SS20220209134238527851","member_id":290,"member_img":"https://thirdwx.qlogo.cn/mmopen/vi_32/0xr8AUjv3nia5XQpHpe8ibNoOe3GVuREbolOicnGBhWxxVWO0wFxjLjvPWEQehCLS5WEEyJYEWqKtNaxfbE7BDqjQ/132","member_name":"Kahing","member_phone":"13500071371","team_charge_man_name":"","score":"12","schedule_son_id":23,"is_set_score":true}
{"brand_id":63,"order_no":"SS20220209134238527851","member_id":290,"member_img":"https://thirdwx.qlogo.cn/mmopen/vi_32/0xr8AUjv3nia5XQpHpe8ibNoOe3GVuREbolOicnGBhWxxVWO0wFxjLjvPWEQehCLS5WEEyJYEWqKtNaxfbE7BDqjQ/132","member_name":"Kahing","member_phone":"13500071371","team_charge_man_name":"","score":23,"is_set_score":true,"match_id":80}
```

45
components/no-data/no-data.vue

@ -0,0 +1,45 @@
<template>
<view class="item flex_col">
<image src="../../static/images/no_data.png" mode=""></image>
<text>{{txt}}</text>
</view>
</template>
<script>
export default {
props: {
txt: {
value: String,
default: "暂无数据"
}
},
data() {
return {
};
},
methods: {
},
watch: {
// value(val) {
// }
}
};
</script>
<style lang="scss" scoped>
.item{
image{
width: 368rpx;
height: 316rpx;
margin-top: 80rpx;
}
text{
font-size: 28rpx;
color: #9A9A9D;
font-weight: border;
margin: 38rpx 0;
}
}
</style>

70
nxTemp/apis/userAPI.js

@ -25,75 +25,91 @@ export function postSendSMS(data) {
* @return: {*}
* @author:
*/
export function wechatGetPhoneNumber(data) {
return http.post(`${config.baseUrl}/user/wechatGetPhoneNumber`, data,{
export function wechatGetPhoneNumberLogin(data) {
// return http.post(`${config.baseUrl}/user/wechatGetPhoneNumber`, data,{
return http.post(`${config.baseUrl}/gaMatchAssistant/getPhoneNumber`, data,{
needLogin:false //未登录前操作取消登录验证
});
});
}
/**
* @description: 赛事列表
* @param {*}
* token
page
page_size
*/
export function matchList(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/match/list`, data);
}
/**
* @description: 赛程列表(赛程打分)
* @description: 赛程-列表
* @param {*}
* token
match_id
page
page_size
*/
export function matchScheduleList(data) {
export function schedule_matchList(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/matchSchedule/list`, data);
}
/**
* @description: 赛程打分
* @description: 赛程-打分
* @param
* schedule_id 赛程id
order_no 赛事订单号
score 要设置的分数
schedule_son_id 赛程子id
*/
export function scoreSave(data) {
export function schedule_scoreSave(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/matchSchedule/scoreSave`, data);
}
/**
* @description: 参赛成员(赛程打分)
* @description: 赛事-列表
* @param {*}
* brand_id
match_id
page
* token
page
page_size
*/
export function matchScoreMemberList(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/matchScore/memberList`, data);
export function matchList(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/match/list`, data);
}
/**
* @description: 打分
* @description: 打分
* @param {*}
* brand_id
* order_no
* scode
*/
export function matchScoreSave(data) {
export function scoreSave(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/match/scoreSave`, data);
}
/**
* @description: 参赛成员列表
* @param {*}
* brand_id
match_id
page
page_size
*/
export function scoreMemberList(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/matchScore/memberList`, data);
}
/**
* @description: 录入数据-数据名称列表
* @param {*}
* brand_id, order_no
*/
export function randOcondList(data) {
export function rankOcondList(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/rankConf/list`, data);
}
}
/**
* @description: 录入数据-数据保存
* @param {*}
* brand_id, order_no , rank_data{id,val}
*/
export function rankSave(data) {
return http.post(`${config.baseUrl}/gaMatchAssistant/rankData/save`,data);
}

5
nxTemp/config/index.config.js

@ -4,8 +4,9 @@ const CONFIG = {
loginTitleTxt: "development_wx", // 登录页标题
copyrightTxt: "XXXv1.0", // 版本信息
assetsPath: "http://cdn.com/img", // 静态资源路径
// baseUrl: "http://testmanager.ouxuanzhineng.cn",
baseUrl: "https://testmatch.ouxuanzhineng.cn",
baseUrl: "http://testmanager.ouxuanzhineng.cn",
// baseUrl: "https://testmatch.ouxuanzhineng.cn",
// baseUrl: "http://192.168.1.55:9090",
tokenKey: "wxf368fa7316d6952f", // 登录标识
testOpenId: "", // 小程序测试openId
forcedLogin: false, // touristMode游客模式下APP是否强制用户登录 场景:当用户进入登录页面后无法后退。

251
pages/event/event_grade.vue

@ -2,38 +2,71 @@
<view class="content flex_col flex_start">
<view class="head flex_row flex_around">
<view class="head flex_row flex_around" v-if="!!showHeader">
<view class="tap-btn" :class="[getTabClass(e)]" @click="clickHead(i)" v-for="(e,i) in headDate" :key="i">
{{e.name}}
</view>
</view>
<!-- item -->
<!--schedule item -->
<block v-if="headIndex==0">
<view class="item flex_col flex_start_y bg-white " v-for="(i,k) in pageList" :key="k">
<view class="title flex_row flex_start">
<view class="text-m text-left">{{i.schedule_name}}</view>
<view class="text-m text-left">{{match_name}}</view>
<!-- <view class="bandage"></view> -->
</view>
<view class="info flex_row flex_between">
<view class="time">{{i.schedule_start_date}}</view>
<view class="type">半决赛</view>
<view class="type">{{i.schedule_name}}</view>
</view>
<view class="card flex_row flex_between">
<view class="card flex_row flex_between" v-for="(u,ukey) in i.son_list">
<view class="persion flex_row">
<image class="bg-brown" src="../../static/images/event/event_lock.png" mode=""></image>
<text>adjksk</text>
<image class="bg-brown" :src="u.member_img" :key="ukey" mode=""></image>
<text>{{u.member_name}}</text>
</view>
<view class="btn-box flex_row">
<view class="btn state-0 flex_row">已打分</view>
<view class="btn state-1 flex_row" @click="openGrade()">打分</view>
<view class="btn state-2 flex_row" @click="openGradeMore()">数据</view>
<view class="btn state-0 flex_row" v-if="u.is_set_score" @click="openGrade(u)">已打分</view>
<view class="btn state-1 flex_row" v-else @click="openGrade(u)">打分</view>
<view class="btn state-2 flex_row" @click="openGradeRank(u)">数据</view>
</view>
</view>
</view>
</block>
<!--match item -->
<block v-if="headIndex==1">
<view class="item flex_col flex_start_y bg-white ">
<view class="title flex_row flex_start">
<view class="text-m text-left">{{match_name}}</view>
<!-- <view class="bandage"></view> -->
</view>
<!-- <view class="info flex_row flex_between">
<view class="time">{{i.schedule_start_date}}</view>
<view class="type">{{i.schedule_name}}</view>
</view> -->
<view class="card flex_row flex_between" v-for="(u,ukey) in pageList" :key="ukey">
<view class="persion flex_row">
<image class="bg-brown" :src="u.member_img" :key="ukey" mode=""></image>
<text>{{u.member_name}}</text>
</view>
<view class="btn-box flex_row">
<view class="btn state-0 flex_row" v-if="u.is_set_score" @click="openGrade(u)">已打分</view>
<view class="btn state-1 flex_row" v-else @click="openGrade(u)">打分</view>
<view class="btn state-2 flex_row" @click="openGradeRank(u)">数据</view>
</view>
</view>
</view>
</block>
<!-- 无数据 -->
<no-data :txt="no_data_txt_arr[headIndex]" v-if="pageList.length==0"></no-data>
<!-- 弹出交互 uview popup有bug,废弃重写-->
<!-- <u-popup :show="showGrade" @close="close" @open="open" mode="center" :closeOnClickOverlay="true" :closeable="true" :round="10">
@ -51,69 +84,83 @@
<view class="grade flex_col flex_start" >
<image class="g-close" src="../../static/images/event/event_close.png" mode="" @click="closeGrade()"></image>
<text class="g-title">赛事打分</text>
<text class="g-txt">李静分数录入</text>
<input type="text" value="" placeholder="请录入分数" placeholder-class="place-style"/>
<text class="g-txt">{{gradeData.user.member_name||""}}分数录入</text>
<input type="number " class="" v-model="gradeData.score" value="" placeholder="请录入分数" placeholder-class="place-style"/>
<view class="g-tip">请输入成员该赛程最终得分非累计</view>
<view class="g-btn flex_row" @click="closeGrade()">保存</view>
<view class="g-btn flex_row" @click="saveGrade()">保存</view>
</view>
</view>
<!-- 赛事数据弹出 -->
<view class="overlay flex_col" v-if="showGradeMore">
<!-- 赛事数据录入弹出 -->
<view class="overlay flex_col" v-if="showGradeRank">
<view class="grade grade-more flex_col flex_start" >
<image class="g-close" src="../../static/images/event/event_close.png" mode="" @click="closeGradeMore()"></image>
<text class="g-title">入围赛数据</text>
<text class="g-txt">李静分数录入</text>
<image class="g-close" src="../../static/images/event/event_close.png" mode="" @click="closeGradeRank()"></image>
<text class="g-title">{{match_name}}数据</text>
<text class="g-txt">{{gradeDataRank.user.member_name}}分数录入</text>
<view class="g-input-box">
<view class="b-item flex_row">
<text>篮板</text>
<input type="text" value="" placeholder="请录入数据" placeholder-class="place-style"/>
<view class="b-item flex_row" v-for="(si,sk) in gradeDataRank.list" :key="sk">
<text>{{si.rank_param_name}}</text>
<input type="number" value="" v-model="si.val" placeholder="请录入数据" placeholder-class="place-style"/>
</view>
<view class="b-item flex_row">
<!-- <view class="b-item flex_row">
<text>助攻</text>
<input type="text" value="" placeholder="请录入数据" placeholder-class="place-style"/>
<input type="number" value="" placeholder="请录入数据" placeholder-class="place-style"/>
</view>
<view class="b-item flex_row">
<text>场次</text>
<input type="text" value="" placeholder="请录入数据" placeholder-class="place-style"/>
</view>
<input type="number" value="" placeholder="请录入数据" placeholder-class="place-style"/>
</view> -->
</view>
<view class="g-tip">请输入成员该赛程最终得分非累计</view>
<view class="g-btn flex_row" @click="closeGradeMore()">保存</view>
<view class="g-btn flex_row" @click="saveRank()">保存</view>
</view>
</view>
<!-- <u-modal :show="showGrade" @confirm="open" ref="uModal" :asyncClose="true" @close="close" :closeOnClickOverlay="true">确认????</u-modal> -->
</view>
</template>
<script>
import {matchScheduleList} from "../../nxTemp/apis/userAPI.js"
import {schedule_matchList,schedule_scoreSave,
scoreSave,scoreMemberList,
rankOcondList,rankSave} from "../../nxTemp/apis/userAPI.js"
export default {
data() {
return {
showGrade:false,
showGradeMore:true,
address:"",
headIndex:0,
showGrade:false,//
showGradeRank:false,//
showHeader:true,//
headIndex:0,//
headDate:[{name:'赛程打分'},{name:'赛事打分'}],
postData:{
postData:{//
page:1,
page_size:10,
match_id:""
match_id:"",
// brand_id:""
},
listLoadFinished:false,//
listTotal:0,//
match_name:"",//(,使)
pageList:[],
gradeData:{//
user:"",
score:0
},
gradeDataRank:{//
user:"",
score:0,
list:""
},
listLoadFinished:false,
listTotal:0,
pageList:[]
brand_id:"",
no_data_txt_arr:["暂无赛程安排~","暂无人员参加~"]
};
},
computed:{
},
onLoad(opt) {
console.log("onLoad:",opt);
this.postData.match_id = opt.match_id
onLoad(opts) {
console.log(8888,opts);
this.setOnloadOpts(opts)
this.updatePage()
},
onUnload() {
@ -130,45 +177,128 @@
//
updatePage() {
if(this.listLoadFinished)return this.$tools.showNone("已加载完毕")
matchScheduleList(this.postData).then(res => {
this.$tools.showNone("已更新");
getPostAPI(this)(this.postData).then(res => {
this.pageList.push(...res.list)
this.match_name = res.match_name
checkListLoadFinished(res,this);
}).catch(e=>{
this.$tools.showNone(e.errMsg)
})
function getPostAPI(that){
return [schedule_matchList,scoreMemberList][that.headIndex]
// return [schedule_matchList,matchList][that.headIndex]
}
//
function checkListLoadFinished(res,that){
if(that.pageList.length == res.total)that.listLoadFinished = true
else that.postData.page++
}
function getFilterList(list){
return list
}
},
//
getFilteredItem(item){
return Promise.resolve({}=item)
},
//
setOnloadOpts(opts){
console.log("onLoad:",opts);
opts.showHeader = JSON.parse(opts.showHeader)
this.postData.match_id = opts.match_id||""
this.headIndex = opts.showHeader?0:1;//
this.showHeader = opts.showHeader
// this.postData.brand_id = opts.brand_id||""
this.brand_id = opts.brand_id||""
},
resetPostData(){
this.postData = {
page:1,
page_size:10,
match_id:""
// this.postData = {
// page:1,
// page_size:10,
// match_id:""
// }
this.postData.page = 1;
this.pageList = [];
this.listLoadFinished = false;
},
saveGrade() {//
let {score} = this.gradeData
let {order_no,schedule_son_id,id:schedule_id} = this.gradeData.user
if(score<=0)return this.$tools.showNone("请输入分数");
getPostAPI(this)(getPostData(this)).then(res => {
this.$tools.showNone("已保存");
this.closeGrade()
}).catch(e=>{
this.$tools.showNone(e.errMsg)
this.closeGrade()
})
function getPostAPI(that){
return [schedule_scoreSave,scoreSave][that.headIndex]
}
function getPostData(that){
let {brand_id} = that
return [{order_no,schedule_son_id,schedule_id,score},{order_no,score,brand_id}][that.headIndex]
}
},
openGrade() {
this.showGrade = ! this.showGrade
console.log('open');
openGrade(user) {
this.showGrade = true
this.gradeData.user = user
this.gradeData.score = ""
console.log('open',JSON.stringify(user));
},
closeGrade() {
this.showGrade = false
console.log('close');
console.log('closeGrade');
},
openGradeMore() {
this.showGradeMore = ! this.showGradeMore
console.log('open');
async openGradeRank(user) {
this.gradeDataRank.user = user
this.gradeDataRank.score = ""
let res = await this.updateRankList()
this.showGradeRank = true
console.log('openGradeRank',res);
},
closeGradeMore() {
this.showGradeMore = false
console.log('close');
closeGradeRank() {
this.showGradeRank = false
console.log('closeGradeRank');
},
saveRank(){
let {order_no} = this.gradeDataRank.user
let {brand_id} = this
brand_id = parseInt(brand_id)
let rank_data = getRankData(this)
if(!checkData(rank_data)) return this.$tools.showNone("请输入合适的分数")
rankSave({
order_no,brand_id,rank_data
}).then(res => {
this.$tools.showNone("保存成功")
this.closeGradeRank()
}).catch(e=>{
this.$tools.showNone(e.errMsg)
})
function getRankData(that){
return that.gradeDataRank.list.map((item)=>{
let {id,val} = item
return {id,val}
})
}
function checkData(list){
return list.every((e)=>{
return parseInt(e.val)>0
})
}
},
updateRankList(){
let {order_no} = this.gradeDataRank.user
let {brand_id} = this
return rankOcondList({
order_no,brand_id
}).then(res => {
console.log("updateRankList:",res);
this.gradeDataRank.list = res.list
}).catch(e=>{
this.$tools.showNone(e.errMsg)
})
},
getTabClass(item){
let {headDate,headIndex} = this
@ -176,6 +306,9 @@
},
clickHead(index){
this.headIndex = index
console.log("click index: ",index);
this.resetPostData();
this.updatePage();
},
jumpPage(){
this.$Router.push({name:"login"})
@ -322,7 +455,7 @@
background: #FFFFFF;
border: 2rpx solid #D8D8D8;
border-radius: 10rpx;
padding: 20rpx;
padding:0 20rpx;
}
.g-tip{
align-self: flex-start;
@ -366,6 +499,8 @@
.place-style{
font-size: 28rpx;
color: #9A9A9D;
// text-align: center;
// line-height: 88rpx;
}
}

15
pages/event/event_list.vue

@ -37,11 +37,13 @@
<view class="load-finish" v-if="listLoadFinished">我是有底线的</view>
<no-data :txt="no_data_txt" v-if="pageList.length==0"></no-data>
</view>
</template>
<script>
import {matchList} from "../../nxTemp/apis/userAPI.js"
export default {
import {matchList} from "../../nxTemp/apis/userAPI.js"
export default {
data() {
return {
postData:{
@ -50,7 +52,8 @@
},
listLoadFinished:false,
listTotal:0,
pageList:[]
pageList:[],
no_data_txt:"还没有任何赛事~"
};
},
onLoad(opt) {
@ -68,11 +71,11 @@
},
methods: {
jumpDetail(i){
let {match_id} = i
let {match_id,brand_id,is_show_match_assistant_score_nav_bar:showHeader} = i
this.$Router.push({
name:"eventGrade",
params:{
match_id
match_id,brand_id,showHeader
}
})
},
@ -83,7 +86,7 @@
updatePage() {
if(this.listLoadFinished)return this.$tools.showNone("已加载完毕")
matchList(this.postData).then(res => {
this.$tools.showNone("已更新");
// this.$tools.showNone("");
this.pageList.push(...res.list)
checkListLoadFinished(res,this);
}).catch(e=>{

38
pages/login/login.vue

@ -49,7 +49,7 @@
<script>
//,page
import {
postLogin,postSendSMS,wechatGetPhoneNumber
postLogin,postSendSMS,wechatGetPhoneNumberLogin
} from "@/nxTemp/apis/userAPI.js"
import {mapActions} from 'vuex'
export default {
@ -57,6 +57,7 @@
return {
sended:false,//
count:5,
code:"",
agreed:false,//
login: {//
mobile: '13500071371',//
@ -71,6 +72,15 @@
}
};
},
async onLoad() {
// let _login = await this.$tools.promisify(uni.login)()
// this.code = _login.code
// uni.login({
// complete(e) {
// console.log(888,e);
// }
// })
},
methods: {
...mapActions(["setUserData"]),
@ -80,10 +90,15 @@
if (this.login.verify_code.length < 6) {
return this.$tools.showNone("请输入正确的验证码");}
postLogin(this.login).then(res => {
this.$tools.showNone("登录成功");
this.setUserData(res)
this.$Router.replace({name:"index"})
});
this.loginSuccess(res)
}).catch((e)=>{
this.$tools.showNone(e.errMsg)
})
},
//
loginSuccess({token,mobile}){
this.setUserData({token,mobile})
this.$Router.replace({name:"index"})
},
jumpAgreement(){
this.$Router.push('/pages/login/agreement')
@ -109,21 +124,24 @@
}
},
async decryptPhoneNumber(e){
console.log("decryptPhoneNumber",e);
if(e.detail.errMsg!=="getPhoneNumber:ok")return this.$tools.showNone(e.detail.errMsg)
this.$tools.showNone("解析数据...")
const accountInfo = uni.getAccountInfoSync();
let {encryptedData,iv} = e.detail
let {code} = await this.$tools.promisify(uni.login)()
let {code} = await this.$tools.promisify(uni.login)()
let appid = accountInfo.miniProgram.appId
this.WXdetail = {encryptedData,iv,code,appid}
this.getWXPhoneNumber(this.WXdetail)
},
getWXPhoneNumber(WXdetail){
wechatGetPhoneNumber(WXdetail).then(res => {
this.$tools.showNone("发送成功")
this.login.ticket = res.data||""
});
wechatGetPhoneNumberLogin(WXdetail).then(res => {
// this.login.ticket = res.data||""
this.loginSuccess(res)
}).catch((e)=>{
this.$tools.showNone(e.errMsg)
})
},
}
}

BIN
static/images/no_data.png

After

Width: 736  |  Height: 632  |  Size: 27 KiB

Loading…
Cancel
Save