diff --git a/App.vue b/App.vue index 72d8166..26ed54a 100644 --- a/App.vue +++ b/App.vue @@ -2,7 +2,20 @@ export default { onLaunch: function() { this.$nextTick(() => { - + // uni.login({ + // provider: 'weixin', + // success: (res) => { + // console.log(res.code); + // this.$u.api.login({ + // code: res.code + // }).then(res => { + // this.$u.vuex('vuex_token', res.token) + // this.$u.api.user().then(res=>{ + // this.$u.vuex('vuex_user', res) + // }) + // }) + // } + // }); }) }, diff --git a/common/http.api.js b/common/http.api.js index d30713e..80fece8 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -1,45 +1,65 @@ -//api集合 -let apiApp = { - login: '/api/mobile/user/wechat-login', - user: '/api/mobile/user/show', - saveUser: '/api/mobile/user/save', - getAppId: '/api/mobile/user/wechat-login-url', - getQuestions: '/api/mobile/quiz/get-questions', - getPoints: '/api/mobile/map-point/point-list', - baseFormIndex: '/api/mobile/base-form/index', - baseFormShow: '/api/mobile/base-form/show', - baseFormSave: '/api/mobile/base-form/save', - baseFormDestroy: '/api/mobile/base-form/destroy', - saveQuiz: '/api/mobile/map-point/save-quiz', - pointDetail: '/api/mobile/map-point/point-detail', - share: '/api/mobile/user/wechat-share', - savePoster: '/api/mobile/vr/save-poster', - getPoster: '/api/mobile/vr/get-poster', -} - -// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作 -const install = (Vue, vm) => { - - //api方法 - let login = (params = {}) => vm.$u.get(apiApp.login, params); - let user = (params = {}) => vm.$u.get(apiApp.user, params); - let getAppId = (params = {}) => vm.$u.get(apiApp.getAppId, params); - let getQuestions = (params = {}) => vm.$u.get(apiApp.getQuestions, params); - let getPoints = (params = {}) => vm.$u.get(apiApp.getPoints, params) - let baseFormIndex = (params = {}) => vm.$u.get(apiApp.baseFormIndex, params); - let baseFormShow = (params = {}) => vm.$u.get(apiApp.baseFormShow, params); - let baseFormSave = (data = {}) => vm.$u.post(apiApp.baseFormSave, data); - let baseFormDestroy = (params = {}) => vm.$u.post(apiApp.baseFormDestroy, params); - let saveQuiz = (params = {}) => vm.$u.post(apiApp.saveQuiz, params); - let pointDetail = (params = {}) => vm.$u.get(apiApp.pointDetail, params); - let share = (params = {}) => vm.$u.get(apiApp.share, params); - let savePoster = (params = {}) => vm.$u.get(apiApp.savePoster, params); - let getPoster = (params = {}) => vm.$u.get(apiApp.getPoster, params) - let saveUser = (params = {}) => vm.$u.post(apiApp.saveUser, params); - // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 - vm.$u.api = { login, getAppId, getQuestions, baseFormIndex, baseFormShow, baseFormSave, baseFormDestroy, getPoints, saveQuiz, pointDetail, share, savePoster, user, saveUser, getPoster }; -} - -export default { - install -} +//api集合 +let apiApp = { + getAppId: '/api/mobile/user/wechat-login-url', + login: '/api/mobile/user/wechat-login', + user: '/api/mobile/user/show', + saveUser: '/api/mobile/user/save', + getPhone: '/api/mobile/user/bind-mobile-by-wechat', + getParty: '/api/mobile/quiz/get-departments', + baseFormIndex: '/api/mobile/base-form/index', + baseFormShow: '/api/mobile/base-form/show', + getAudios: '/api/mobile/audio/get-audios', + showAudios: '/api/mobile/audio/get-audio', + enterAudios: '/api/mobile/audio/play-audio', + getMyAudios: '/api/mobile/audio-my/audio-plays', + + share: '/api/mobile/user/wechat-share', + savePoster: '/api/mobile/vr/save-poster', + getPoster: '/api/mobile/vr/get-poster', +} + +// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作 +const install = (Vue, vm) => { + + //api方法 + let getAppId = (params = {}) => vm.$u.get(apiApp.getAppId, params); + let login = (params = {}) => vm.$u.get(apiApp.login, params); + let user = (params = {}) => vm.$u.get(apiApp.user, params); + let saveUser = (params = {}) => vm.$u.post(apiApp.saveUser, params); + let getPhone = (params = {}) => vm.$u.get(apiApp.getPhone, params); + let getParty = (params = {}) => vm.$u.get(apiApp.getParty, params); + + let baseFormIndex = (params = {}) => vm.$u.get(apiApp.baseFormIndex, params); + let baseFormShow = (params = {}) => vm.$u.get(apiApp.baseFormShow, params); + let getAudios = (params = {}) => vm.$u.get(apiApp.getAudios, params); + let enterAudios = (id, params) => vm.$u.post(apiApp.enterAudios + '/' + id, params); + let showAudios = (id, params) => vm.$u.get(apiApp.showAudios + '/' + id, params); + + let getMyAudios = (params = {}) => vm.$u.get(apiApp.getMyAudios, params); + + let share = (params = {}) => vm.$u.get(apiApp.share, params); + let savePoster = (params = {}) => vm.$u.get(apiApp.savePoster, params); + let getPoster = (params = {}) => vm.$u.get(apiApp.getPoster, params) + // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 + vm.$u.api = { + login, + getAppId, + getPhone, + getParty, + baseFormIndex, + baseFormShow, + getAudios, + showAudios, + enterAudios, + getMyAudios, + share, + savePoster, + user, + saveUser, + getPoster + }; +} + +export default { + install +} \ No newline at end of file diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 3e0b315..e0d9d47 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -23,7 +23,7 @@ const install = (Vue, vm) => { console.log('config-http', config) config.data.activity_tag = 'xtykt' config.data.activity_list_id = 12 - + let xtykt_lifeData = uni.getStorageSync('xtykt_lifeData') let vuex_token = xtykt_lifeData.vuex_token; if (vuex_token || vm.vuex_token) { @@ -67,6 +67,29 @@ const install = (Vue, vm) => { } } +// const customParamsSerializer = (params)=>{ +// console.log("params",params) +// let result = ""; +// for (let key in params) { +// if (params.hasOwnProperty(key)) { +// if (Array.isArray(params[key])) { +// if (typeof params[key] === "object") { +// params[key].forEach((item, index) => { +// if (typeof item === "object") { +// key[index]['key'] = item.key +// key[index]['op'] = item.op +// key[index]['value'] = item.value +// // result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`; +// } +// }); +// } +// } +// } +// } +// console.log("result",result) +// return result.slice(0, -1); +// } + export default { install } diff --git a/common/util.js b/common/util.js index 718b900..9e125e3 100644 --- a/common/util.js +++ b/common/util.js @@ -2,35 +2,74 @@ * 公共方法 * */ +import moment from 'moment'; const base64ToFile = (dataurl, filename = 'file') => { - let arr = dataurl.split(',') - let mime = arr[0].match(/:(.*?);/)[1] - let suffix = mime.split('/')[1] - let bstr = atob(arr[1]) - let n = bstr.length - let u8arr = new Uint8Array(n) - while (n--) { - u8arr[n] = bstr.charCodeAt(n) - } - return new File([u8arr], `${filename}.${suffix}`, { - type: mime - }) } +const toast = (msg,time,callback) => { + uni.showToast({ + icon: "none", + title: msg, + duration: time||1500, + success:function(res){ + if(callback && typeof(callback)=='function'){ + console.log(callback) + callback() + } + } + }) +} +// 转换日期为日月 +const formatDateToMonthDay = (dateString) => { + const month = moment(dateString).format('MM') + const day = moment(dateString).format('DD') + return `${month}月${day}日`; +} +// 比较当前时间是否在活动期间 在true 不在false +const isCurrentTimeBetween = (startTime, endTime) => { + let that = this + const now = moment().valueOf() + const start = moment(startTime).valueOf(); + const end = moment(endTime).valueOf(); + return now < start || now > end; +} +// 验证是否填写的是中文 +const isOnlyChinese = (str)=>{ + const chineseRegex = /^[\u4e00-\u9fa5]+$/; + return chineseRegex.test(str); +} + +// 验证是否为空 +const isNull = (p)=>{ + return p == '' || p == undefined || p == null || p == 'undefined' || p == 'null'; +} + +// 验证手机号 +const isMobile = (phoneNumber) => { + const regex = /^1[3-9]\d{9}$/; + return regex.test(phoneNumber); +} + export { - base64ToFile + base64ToFile, + toast, + formatDateToMonthDay, + isCurrentTimeBetween, + isOnlyChinese, + isNull, + isMobile } diff --git a/components/tabbar/tabbar.vue b/components/tabbar/tabbar.vue new file mode 100644 index 0000000..3ef17d6 --- /dev/null +++ b/components/tabbar/tabbar.vue @@ -0,0 +1,130 @@ + + + + \ No newline at end of file diff --git a/manifest.json b/manifest.json index f10c537..4d4276c 100644 --- a/manifest.json +++ b/manifest.json @@ -50,7 +50,7 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "wxbf4862e929ab85b0", + "appid" : "wxc7c1f375858bbdda", "setting" : { "urlCheck" : false }, diff --git a/package.json b/package.json index 63f4318..4d5df4c 100644 --- a/package.json +++ b/package.json @@ -16,5 +16,7 @@ "keywords": [], "author": "", "license": "ISC", - "dependencies": {} + "dependencies": { + "moment": "^2.30.1" + } } diff --git a/packages/h5/h5.vue b/packages/h5/h5.vue new file mode 100644 index 0000000..caff90a --- /dev/null +++ b/packages/h5/h5.vue @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/packages/record/record.vue b/packages/record/record.vue new file mode 100644 index 0000000..5296851 --- /dev/null +++ b/packages/record/record.vue @@ -0,0 +1,253 @@ + + + + + + diff --git a/pages.json b/pages.json index 5fd4130..66312fa 100644 --- a/pages.json +++ b/pages.json @@ -19,18 +19,26 @@ "navigationStyle": "custom" } },{ - "path": "pages/record/record", + "path": "pages/me/me", "style": { "navigationStyle": "custom" } + } + ], + "subPackages":[{ + "root": "packages", + "pages":[{ + "path": "record/record", + "style": { + "navigationStyle": "custom" + } },{ - "path": "pages/me/me", + "path": "h5/h5", "style": { "navigationStyle": "custom" } - } - ], - "subPackages": [], + }] + }], "preloadRule": {}, "globalStyle": { "navigationBarTextStyle": "black", @@ -47,14 +55,14 @@ "list": [{ "text": "首页", "pagePath": "pages/index/index", - "iconPath": "static/index-home.png", - "selectedIconPath": "static/index-home-cur.png" + "iconPath": "/static/index-home.png", + "selectedIconPath": "/static/index-home-cur.png" }, { "text": "我的", "pagePath": "pages/me/me", - "iconPath": "static/index-me.png", - "selectedIconPath": "static/index-me-cur.png" + "iconPath": "/static/index-me.png", + "selectedIconPath": "/static/index-me-cur.png" } ] } diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index a4b14ba..613d815 100644 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -1,69 +1,24 @@ @@ -77,49 +32,38 @@ data() { return { navBarBoxHeight: 0, - statusBarHeight: 40, - menutitle: '课件绘编', + navBarHeight:0, + navBarTop:0, + menutitle: '', info: {}, id: '', - showContent:false, - organizer_list:[], - guidance_unit_list: [], - sponsor_list: [], - bear_unit_list: [] + showContent:false } }, onLoad(options) { - // this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; - this.navBarBoxHeight = 80 + this.statusBarHeight * 2 - this.id = options.id ? options.id : '' - // this.loadDetail() + const MenuButton = uni.getMenuButtonBoundingClientRect() + this.navBarTop = MenuButton.top //左侧文字与右侧胶囊对齐 + this.navBarHeight = MenuButton.height + this.navBarBoxHeight = this.navBarTop + this.navBarHeight + 10 + console.log(options) + this.id = options.id ? options.id : '' + this.menutitle = options.menuTitle?options.menuTitle:'冬训云课堂' + this.loadDetail(this.id) + this.enterAudios(this.id) }, methods: { - cancelTime(val){ - return val.substring(0,10) + goback(){ + uni.navigateBack({ + delta: 1 // 返回的页面数,这里设置为1表示返回上一页 + }); + }, + async enterAudios(id){ + await this.$u.api.enterAudios(id,{}) }, - loadDetail() { - var that = this; - this.util.request({ - api: '/api/mobile/exhibit-hall/show', - data: { - id: that.id - }, - utilSuccess: function(res) { - res.dateRange = that.util.splitTime(res.start_time,res.over_time) - that.info = res - const host = that.util.HOST - that.info.content = that.util.replaceImgUrl(that.info.content,'../storage/files',`${host}/storage/files`) - that.organizer_list = res.organizer?res.organizer.split('、'):[] - that.guidance_unit_list = res.guidance_unit?res.guidance_unit.split('、'):[] - that.sponsor_list = res.sponsor?res.sponsor.split('、'):[] - that.bear_unit_list = res.bear_unit?res.bear_unit.split('、'):[], - that.showContent = true - }, - utilFail: function(res) { - - } - }) + async loadDetail(id) { + const res = await this.$u.api.showAudios(id,{}) + this.info = res + this.showContent = true } } } @@ -216,7 +160,7 @@ .detail { padding:0 60rpx; background: #fff; - padding-top: 30rpx; + /* padding-top: 30rpx; */ border-radius: 30rpx 30rpx 0 0; padding-bottom:180rpx; font-size: 28rpx; diff --git a/pages/index/index.vue b/pages/index/index.vue index 6ea6fac..099929f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,21 +1,27 @@ - @@ -118,6 +214,7 @@ color: #fff; font-size: 32rpx; text-align: left; + position: absolute; } } @@ -126,22 +223,20 @@ } .content { - // height:1400px; - padding-bottom: 100rpx; + padding-bottom: 180rpx; .topbg { - background: url(../../static/index-top.png) no-repeat top left; - background-size: 100% 100%; width: 100%; height: 360rpx; } .banner { - background: url(../../static/index-banner.png) no-repeat top left; - background-size: 100% 100%; width: 98%; height: 383rpx; margin: 0 auto; + display: block; + position: relative; + z-index: 1; } &-content { @@ -177,7 +272,7 @@ } .menus-list { - padding: 0 20rpx; + padding: 0 30rpx; &-item { display: flex; @@ -193,7 +288,7 @@ &-img { width: 196rpx; - height: 169rpx; + height: 129rpx; margin-right: 24rpx; } @@ -208,11 +303,16 @@ text-overflow: ellipsis; } } - + .hasNomore{ + text-align: center; + color:#a4a4a4; + height:80rpx; + line-height: 80rpx; + } } - // background: url(../../static/index-top.png) no-repeat top left; + // background: url(@/static/index-top.png) no-repeat top left; // background-size: 100% 100%; // width:100%; // height:360rpx; diff --git a/pages/me/me.vue b/pages/me/me.vue index a204e4d..b2d85e6 100644 --- a/pages/me/me.vue +++ b/pages/me/me.vue @@ -1,142 +1,457 @@ - \ No newline at end of file diff --git a/pages/menu/components/swiper-list-item.vue b/pages/menu/components/swiper-list-item.vue index 7d78dba..ca24b4c 100644 --- a/pages/menu/components/swiper-list-item.vue +++ b/pages/menu/components/swiper-list-item.vue @@ -1,138 +1,185 @@ - - - - - - + top:0; + left:0; + width: 196rpx; + height: 129rpx; + background-color: rgba(0,0,0,0.5); + text-align: center; + line-height: 129rpx; + } + + + \ No newline at end of file diff --git a/pages/menu/menu.vue b/pages/menu/menu.vue index 07c6d9b..ccde9d8 100644 --- a/pages/menu/menu.vue +++ b/pages/menu/menu.vue @@ -1,13 +1,25 @@