From 5b34e689d660947cb63591c861d6c76caf51c7ec Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Sun, 31 Jan 2021 18:03:17 +0800 Subject: [PATCH] add all --- src/App.vue | 5 ++ src/js/api.js | 4 +- src/js/server.js | 16 +++++- src/main.js | 6 +- src/pages/course/list/list.vue | 47 +++++++++++---- src/pages/index/index.vue | 48 +++++++++++++--- src/pages/login/login.vue | 112 +++++++++++++++++++----------------- src/pages/store_list/store_list.vue | 43 +++++++++++--- src/static/images/arrow_cff.png | Bin 0 -> 333 bytes src/store/index.js | 28 +-------- src/store/mutations.js | 9 ++- 11 files changed, 199 insertions(+), 119 deletions(-) create mode 100644 src/static/images/arrow_cff.png diff --git a/src/App.vue b/src/App.vue index 40fdd98..8284ccd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,6 +8,11 @@ }, onHide: function() { console.log('App Hide') + }, + methods: { + isLogin(){ + return !!uni.getStorageSync('loginInfo'); + } } } diff --git a/src/js/api.js b/src/js/api.js index b433f72..1433d24 100644 --- a/src/js/api.js +++ b/src/js/api.js @@ -5,6 +5,9 @@ export const ORIGIN = `http://kahing.local:9090`; // 本地测试 export const API = { coachLogin: `${ORIGIN}/stadium/coach/login`, // 小程序-账号登录 getCoachCourseTimes: `${ORIGIN}/stadium/coach/getCoachCourseTimes`, // 小程序-账号登录 + + getHomeData: `${ORIGIN}/stadium/coach/getHomeData`, // 小程序-获取教练主页的数据 + saveFeedback: `${ORIGIN}/stadium/coach/saveFeedback`, // 小程序-保存教练反馈 coach_feedback: `${ORIGIN}/upload/file/coach_feedback`, // 上传文件 @@ -15,7 +18,6 @@ API['course'] = { courseList: `${ORIGIN}/stadium/coach/courseList`, // 小程序-课程列表 getClassList: `${ORIGIN}/stadium/coach/getClassList`, // 小程序-班级列表 getCourseStudentList: `${ORIGIN}/stadium/coach/getCourseStudentList`, // 小程序-学员列表 - getCourseStudentList: `${ORIGIN}/stadium/coach/getCourseStudentList`, // 小程序-学员列表 SaveStudentComment: `${ORIGIN}/stadium/coach/SaveStudentComment`, // 小程序-学员点评保存 courseList: `${ORIGIN}/stadium/coach/courseList`, // 小程序-课程列表 } diff --git a/src/js/server.js b/src/js/server.js index 76456ae..c14b2bc 100644 --- a/src/js/server.js +++ b/src/js/server.js @@ -1,6 +1,6 @@ import util from '../utils/util'; // import { app as vm } from '../main'; -const islog = true; +const islog = false; export class Server { request(url,data,method,header,isDefaultGet,failMsg){ @@ -9,8 +9,12 @@ export class Server { // let storeInfo = _store.state.storeInfo || null; // if(storeInfo)data['brand_id'] = storeInfo.brand_id; const _loginInfo = uni.getStorageSync('loginInfo'); - - if(_loginInfo || true){ + if(!_loginInfo&&!data.isSkipCheck){ + + setTimeout(_=>util.routeTo(`/pages/login/login`, 'rL'), 10) + return Promise.reject('not logged in') + } + if(_loginInfo){ data = Object.assign({ coach_token: _loginInfo.coach_token || '7a04dc20-62c0-11eb-8979-00e04c0166b9', brand_id: _loginInfo.brand_id || '63', @@ -24,6 +28,12 @@ export class Server { method, // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT header: {...header}, // 设置请求的 header // {'custom-header': 'application/json'} success: res=>{ + if(res.data.code == 10001){ + util.showNone(res.data.message || '校验失败!') + setTimeout(_=>util.routeTo(`/pages/login/login`, 'rL'), 1200); + console.warn('校验失败---->', res); + return Promise.reject(res) + } if(islog)console.log('req success---->',{ link: url, query: data, diff --git a/src/main.js b/src/main.js index 7f88dd0..95c7132 100644 --- a/src/main.js +++ b/src/main.js @@ -1,11 +1,11 @@ import Vue from 'vue' import App from './App' - +import store from './store/index.js'; Vue.config.productionTip = false - App.mpType = 'app' const app = new Vue({ - ...App + ...App, + store }) app.$mount() diff --git a/src/pages/course/list/list.vue b/src/pages/course/list/list.vue index e08fe4f..57d48ef 100644 --- a/src/pages/course/list/list.vue +++ b/src/pages/course/list/list.vue @@ -11,15 +11,18 @@ {{e.name || '-'}} {{e.kind || '-'}} - + 班级数: {{e.class_number || 0}} 学员人数: {{e.join_person_number || 0}} - 预约上课 - 班级 + + 预约上课 + 班级 + + 详情 @@ -35,14 +38,14 @@ - + 选择班级 - + @@ -51,7 +54,7 @@ - + @@ -61,21 +64,21 @@ - + - - + - 取消 - 确定 + 取消 + 确定 @@ -87,17 +90,37 @@ import { API } from '../../../js/api' import { servers } from '../../../js/server' import util from '../../../utils/util' +import { mapState } from 'vuex'; export default { + computed: { + ...mapState([ 'storeInfo' ]), + }, data(){ return { curTabIdx: 0, courseList: [], + isOrderCourseModal: false, } }, onLoad(){ this.getCourseList({}); }, methods: { + toClass(e){ + console.warn(e); + let _query = { + course_id: e.id, + course_name: e.name, + } + util.routeTo(`/pages/course/class_list/class_list?query=${util.jsonStr(_query)}`, 'nT'); + }, + orderCourseBtn(){ + this.isOrderCourseModal = true; + }, + // 课程类型映射 成班课(0)/私教课(1); + getCourseType(type = ''){ + return ['成班课', '私教课'].findIndex(e=>e===type); + }, tabChange: util.debounce(function(i){ this.curTabIdx = i; this.courseList = []; @@ -109,10 +132,12 @@ export default { is_experience_class = 0, kind = '', }){ + let { storeInfo } = this; util.showLoad(); servers.get({ url: API.course.courseList, data: { + stadium_id: storeInfo.id, is_experience_class, kind, }, @@ -311,7 +336,6 @@ export default { flex-shrink: 0; width: 28upx; height: 28upx; - background-color: skyblue; } } .cl-content{ @@ -340,7 +364,6 @@ export default { flex-shrink: 0; width: 28upx; height: 28upx; - background-color: skyblue; } } diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 9dee164..0596de6 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -1,11 +1,16 @@ @@ -41,7 +72,6 @@ export default { height: 100upx; border-radius: 50%; border: 2upx solid #D8D8D8; - background-color: skyblue; } .si-content{ flex-grow: 1; @@ -66,7 +96,6 @@ export default { flex-grow: 0; height: 32upx; width: 32upx; - background-color: skyblue; } } .sc-tag{ diff --git a/src/static/images/arrow_cff.png b/src/static/images/arrow_cff.png new file mode 100644 index 0000000000000000000000000000000000000000..9a6505ef77a390f19d3329806b7e3cabd8d36bb8 GIT binary patch literal 333 zcmV-T0kZyyP)Px#1ZP1_K>z@;j|==^1poj5_en%SR9Hvt*gXybVGzdg4T%egN~cjcfD^cZ8#si{ z8MI2JR_7E*G%A%sR8GJ%@?@ge^^puSlKC~8ecvhm+07sy8}h9<0m%Q5uf z`d|v&ieUt7Q=uYTa00feP?0^zNDCQhB_pk5q?L@cl95(2(n?k21UTYPA}_$UJGtk! zzZtMgZGhXp%Hrge%TwiupR%|kgov91o0P*D2AGZQFsnBsdkl%A0^AkEw{!g<>$$9SEaW!5)wuJ$lflL165Fp2N f`GSA*T8rWab8<8rEloUA00000NkvXXu0mjfRiuiq literal 0 HcmV?d00001 diff --git a/src/store/index.js b/src/store/index.js index cb15e5f..cde16fc 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -10,32 +10,8 @@ export default new Vuex.Store({ // device }, state: { - // // #ifdef H5 - // APPID: uni.getAccountInfoSync().miniProgram.appId, - // // #endif - // brandInfo: { - // brand: {} - // }, - // permissionObj: { // 权限代号对应 - // '1001': '营业额', - // '1002': '收款记录', - // '1003': '经营分析', - // '1004': '预约订单', - // '1005': '会员卡订单', - // '1006': '积分订单', - // '1007': '员工管理', - // '1008': '查询核销', - // '1009': '场地管理', - // '1010': '设备管理', - // }, - - // // 场地占用提交页面信息 - // occupyInfo: { - // storeInfo: {}, // 店铺信息 - // dateInfo: {}, // 时间信息 - // typeInfo: {}, // 球场类型 - // venueList: [], // 选择场地列表 - // } + // 当前小程序店铺信息 + storeInfo: {}, }, mutations, actions, diff --git a/src/store/mutations.js b/src/store/mutations.js index 8c34132..74555f3 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -2,11 +2,10 @@ export default { - // // 设置品牌信息 - // setBrandInfo(state, brandInfo){ - // // console.log(storeInfo,'-----') - // state.brandInfo = brandInfo - // }, + // 设置店铺信息 + setStoreInfo(state, storeInfo){ + state.storeInfo = storeInfo + }, // // 场地占用信息 // setOccupyInfo(state, _occupyInfo){