From bca9d166e868d0c61d9d1f753e2836d601047658 Mon Sep 17 00:00:00 2001 From: zmt Date: Mon, 14 Feb 2022 11:49:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A1=86=E6=9E=B6=E9=AA=8C?= =?UTF-8?q?=E8=AF=81&=E5=AE=8C=E5=96=84=E7=99=BB=E5=BD=95=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nxTemp/apis/userAPI.js | 71 ++++++++++++++++++++++++++++++++++++-- nxTemp/config/requestConfig.js | 77 ++++++++++++++++++++++-------------------- nxTemp/utils/tools.js | 4 +++ pages.json | 20 ----------- pages/index/index.vue | 13 +++++-- pages/login/login.vue | 29 +++++++++++----- 6 files changed, 143 insertions(+), 71 deletions(-) diff --git a/nxTemp/apis/userAPI.js b/nxTemp/apis/userAPI.js index c01a2e1..e043811 100644 --- a/nxTemp/apis/userAPI.js +++ b/nxTemp/apis/userAPI.js @@ -4,13 +4,15 @@ import config from "@/nxTemp/config/index.config.js"; // 用户登录 export function postLogin(data) { return http.post(`${config.baseUrl}/gaMatchAssistant/login`, data ,{ - needLogin:false + needLogin:false //未登录前操作取消登录验证 }); } //发送验证码 export function postSendSMS(data) { - return http.post(`${config.baseUrl}/gaMatchAssistant/captchaSms/send`, data); + return http.post(`${config.baseUrl}/gaMatchAssistant/captchaSms/send`, data,{ + // needLogin:false //未登录前操作取消登录验证 + }); } /** @@ -27,4 +29,69 @@ export function wechatGetPhoneNumber(data) { return http.post(`${config.baseUrl}/user/wechatGetPhoneNumber`, data); } +/** +* @description: 赛事列表 +* @param {*} +* token +page +page_size +*/ +export function matchList(data) { + return http.post(`${config.baseUrl}/gaMatchAssistant/match/list`, data); +} + +/** +* @description: 赛程列表(赛程打分) +* @param {*} +* token +match_id +page +page_size +*/ +export function matchScheduleList(data) { + return http.post(`${config.baseUrl}/gaMatchAssistant/matchSchedule/list`, data); +} + +/** +* @description: 赛程打分 +* @param +* schedule_id 赛程id +order_no 赛事订单号 +score 要设置的分数 +schedule_son_id 赛程子id +*/ +export function scoreSave(data) { + return http.post(`${config.baseUrl}/gaMatchAssistant/matchSchedule/scoreSave`, data); +} + +/** +* @description: 参赛成员(赛程打分) +* @param {*} +* brand_id +match_id +page +page_size +*/ +export function matchScoreMemberList(data) { + return http.post(`${config.baseUrl}/gaMatchAssistant/matchScore/memberList`, data); +} +/** +* @description: 赛程打分 +* @param {*} +* brand_id +* order_no +* scode +*/ +export function matchScoreSave(data) { + return http.post(`${config.baseUrl}/gaMatchAssistant/match/scoreSave`, data); +} + +/** +* @description: 录入数据-数据名称列表 +* @param {*} +* brand_id, order_no +*/ +export function randOcondList(data) { + return http.post(`${config.baseUrl}/gaMatchAssistant/rankConf/list`, data); +} \ No newline at end of file diff --git a/nxTemp/config/requestConfig.js b/nxTemp/config/requestConfig.js index cbad30b..b5f33a7 100644 --- a/nxTemp/config/requestConfig.js +++ b/nxTemp/config/requestConfig.js @@ -16,46 +16,13 @@ let $http = new request({ // 'project_token': config.projectToken, //项目token(可删除) } }); -// 添加获取七牛云token的方法 -$http.getQnToken = function(callback) { - //该地址需要开发者自行配置(每个后台的接口风格都不一样) - $http.get("api/common/v1/qn_upload").then(data => { - /* - *接口返回参数: - *visitPrefix:访问文件的域名 - *token:七牛云上传token - *folderPath:上传的文件夹 - *region: 地区 默认为:SCN - */ - callback({ - visitPrefix: data.visitPrefix, - token: data.token, - folderPath: data.folderPath - }); - }); -} + //请求开始拦截器 $http.requestStart = function(options) { // console.log("请求开始", options); if (options.load) { //打开加载动画 store.commit("setLoadingShow", true); - } - // 图片上传大小限制 - if (options.method == "FILE" && options.maxSize) { - // 文件最大字节: options.maxSize 可以在调用方法的时候加入参数 - let maxSize = options.maxSize; - for (let item of options.files) { - if (item.size > maxSize) { - setTimeout(() => { - uni.showToast({ - title: "图片过大,请重新上传", - icon: "none" - }); - }, 500); - return false; - } - } } //请求前加入token & token验证 @@ -70,7 +37,24 @@ $http.requestStart = function(options) { options.data['token'] = token; //请求data中带上token } } - } + } + // 图片上传大小限制 + if (options.method == "FILE" && options.maxSize) { + // 文件最大字节: options.maxSize 可以在调用方法的时候加入参数 + let maxSize = options.maxSize; + for (let item of options.files) { + if (item.size > maxSize) { + setTimeout(() => { + uni.showToast({ + title: "图片过大,请重新上传", + icon: "none" + }); + }, 500); + return false; + } + } + } + // if (options.url) { // //请求前加入token // let url = options.url.substring(options.url.lastIndexOf('/') + 1); @@ -108,7 +92,7 @@ $http.dataFactory = async function(res) { // data: res.data, // method: res.method, // }); - console.log("requestConfig:",res); + // console.log("requestConfig:",res); showLog(res.data,res.url,res.response) } @@ -257,6 +241,25 @@ $http.requestError = function(e) { }); } } +// 添加获取七牛云token的方法 +$http.getQnToken = function(callback) { + //该地址需要开发者自行配置(每个后台的接口风格都不一样) + $http.get("api/common/v1/qn_upload").then(data => { + /* + *接口返回参数: + *visitPrefix:访问文件的域名 + *token:七牛云上传token + *folderPath:上传的文件夹 + *region: 地区 默认为:SCN + */ + callback({ + visitPrefix: data.visitPrefix, + token: data.token, + folderPath: data.folderPath + }); + }); +} +//log日志函数 function showLog(data,url,response){ let weburl = getWebURL(data,url) let temp = url.split("?")[0].split("/") @@ -267,7 +270,7 @@ function showLog(data,url,response){ +"\n 服务端返回:\n"+JSON.stringify(response.data) +"\n <<-------------------- ["+postName+"][log] ↑↑↑\n") } - +//获取拼接url function getWebURL(data,url){ let result = "" for(var i in data){ diff --git a/nxTemp/utils/tools.js b/nxTemp/utils/tools.js index 5ccb60d..7a75439 100644 --- a/nxTemp/utils/tools.js +++ b/nxTemp/utils/tools.js @@ -161,5 +161,9 @@ export default { } }, + route(url,type){ + // 无再次封装必要,参考 + // https://hhyang.cn/v2/api/routerInsatll.html#router-aftereach + }, } diff --git a/pages.json b/pages.json index bd5a6d8..be4c76c 100644 --- a/pages.json +++ b/pages.json @@ -119,26 +119,6 @@ "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8" }, - "tabBar": { - "color": "#7A7E83", - "selectedColor": "#fe519f", - "borderStyle": "black", - "backgroundColor": "#F8F8F8", - "list": [{ - "pagePath": "pages/index/index", - "iconPath": "static/images/tabbar/tab_home_01.png", - "selectedIconPath": "static/images/tabbar/tab_home_02.png", - "text": "首页" - }, - - { - "pagePath": "pages/me/index", - "iconPath": "static/images/tabbar/tab_user_01.png", - "selectedIconPath": "static/images/tabbar/tab_user_02.png", - "text": "我的" - } - ] - }, "condition": { //模式配置,仅开发期间生效 "current": 0, //当前激活的模式(list 的索引项) "list": [ diff --git a/pages/index/index.vue b/pages/index/index.vue index 2666346..8f021b6 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -5,7 +5,7 @@ - 1888888888 + {{userInfo.mobile||"-"}} 您好! 前往登录 @@ -30,14 +30,21 @@ - -