diff --git a/App.vue b/App.vue index a0bfe21..b949e04 100644 --- a/App.vue +++ b/App.vue @@ -1,6 +1,6 @@ diff --git a/components/user-agreement/user-agreement.vue b/components/user-agreement/user-agreement.vue index d1f8803..635b4b8 100644 --- a/components/user-agreement/user-agreement.vue +++ b/components/user-agreement/user-agreement.vue @@ -6,6 +6,7 @@ 《用户服务协议》《隐私政策》, 勾选代表您已同意此协议 + @@ -30,17 +31,25 @@ export default { // 服务协议 serviceAgreement(){ - uni.navigateTo({ - url: '/pages/service-agreement/service-agreement', + console.log('用户服务协议') + uni.navigateToMiniProgram({ + appId: 'wx5b97b0686831c076', + path: 'pages/preview/preview?sid=&fid=60774991254', + success(res) { + console.log(res); + }, }); }, // 隐私政策 privacyAolicy(){ - uni.navigateTo({ - url: '/pages/privacy-aolicy/privacy-aolicy', + uni.navigateToMiniProgram({ + appId: 'wx5b97b0686831c076', + path: 'pages/preview/preview?sid=&fid=60774976650', + success(res) { + console.log(res); + }, }); - } }, }; diff --git a/manifest.json b/manifest.json index e81bf4b..d35ad5c 100644 --- a/manifest.json +++ b/manifest.json @@ -69,7 +69,8 @@ "desc": "你的位置信息将用于获取地理位置及地图展示" } }, - "usingComponents" : true + "usingComponents" : true, + "navigateToMiniProgramAppIdList": ["wx5b97b0686831c076"] }, "mp-alipay" : { "usingComponents" : true diff --git a/pages.json b/pages.json index c2bccb0..5fe768c 100644 --- a/pages.json +++ b/pages.json @@ -1,5 +1,12 @@ { "pages": [ + // { + // "path": "pages/my-trips/my-trips", + // "style": { + // "navigationBarTitleText": "我的行程" + // } + // }, + { "path": "pages/index/index", "style": { diff --git a/pages/add-stroke/add-stroke.vue b/pages/add-stroke/add-stroke.vue index a1caf1b..861b6c2 100644 --- a/pages/add-stroke/add-stroke.vue +++ b/pages/add-stroke/add-stroke.vue @@ -9,13 +9,26 @@ *抵达时间 + + *行程类型 + + + + + + + + 出行交通方式(必选) @@ -24,7 +37,11 @@ *乘坐航班车次或车牌号码及座位号(没有填无) - + + + + 同行人 + @@ -49,6 +66,8 @@ export default { components: {UniCalendar,DateSelector}, data() { return { + startTime: this.$moment().format('YYYY-MM-DD'), + endTime: this.$moment().format('YYYY-MM-DD'), transports: [ { value: '0', @@ -75,8 +94,20 @@ export default { name: '其他', } ], - carNumber: '', - current: 0, + carNo: '', + journeys: [ + { + value: '0', + name: '返校行程', + }, + { + value: '1', + name: '日常外出', + } + ], + together: '', + tripMode: 0, + journeyType: 0, agree: false }; }, @@ -84,7 +115,16 @@ export default { RadioChange: function(evt) { for (let i = 0; i < this.transports.length; i++) { if (this.transports[i].value === evt.target.value) { - this.current = i; + this.tripMode = i; + break; + } + } + }, + + TypeChange: function(evt) { + for (let i = 0; i < this.journeys.length; i++) { + if (this.journeys[i].value === evt.target.value) { + this.journeyType = i; break; } } @@ -97,6 +137,7 @@ export default { */ getStartData(start) { console.log('出发时间 start: ', start); + this.startTime = start; }, /** @@ -106,6 +147,7 @@ export default { */ getEndData(end) { console.log('抵达时间 end: ', end); + this.endTime = end; }, /** @@ -114,30 +156,26 @@ export default { async handleAddStroke() { try { if (!this.checkRules()) return; - const { - address, - animalHeat, - district, - healthTypeId, - hospital, - token, - touchHubei, - touchSick + carNo, + endTime, + journeyType, + startTime, + together, + tripMode } = this; const params = { param: { - address, - animalHeat, - district, - healthTypeId, - hospital, - token, - touchHubei, - touchSick + carNo, + endTime: +this.$moment(endTime).format('x'), + journeyType: journeyType+1, + startTime: +this.$moment(startTime).format('x'), + together, + tripMode } }; - const res = await this.$http.post(HEALTH_SIGN, params); + console.log('params2',params) + const res = await this.$http.post(SUBMIT_JOURNEYS, params); const { success, code, @@ -145,14 +183,13 @@ export default { data } = res.data; if (success && code === 200) { - this.setHealthCode(data.healthCode) this.success = true; uni.reLaunch({ url: `/pages/index/index`, }); } else { uni.showToast({ - title: msg || '申请健康码成功', + title: msg || '行程添加成功', icon: 'none' }); } @@ -160,7 +197,7 @@ export default { console.log('error: ', error); if (error.msg) { uni.showToast({ - title: error.msg || '申请健康码失败', + title: error.msg || '行程添加失败', icon: 'none' }); } @@ -169,13 +206,25 @@ export default { // 验证信息 checkRules() { - const { district,address,healthTypeId,animalHeat,agree } = this; - if (!this.transports) { - showToast('请选择身份'); + const { startTime,endTime,journeyType,tripMode,carNo,agree } = this; + if (!this.startTime) { + showToast('请选择出发时间'); + return; + } + if (!this.endTime) { + showToast('请选择抵达时间'); + return; + } + if (this.journeyType<0) { + showToast('请选择行程类型'); + return; + } + if (this.tripMode<0) { + showToast('请选择出行交通方式'); return; } - if (!this.carNumber) { - showToast('请输入学号'); + if (!this.carNo) { + showToast('乘坐航班车次或车牌号码及座位号'); return; } if (!this.agree) { diff --git a/pages/apply-code/apply-code.vue b/pages/apply-code/apply-code.vue index 133d4a9..85a56df 100644 --- a/pages/apply-code/apply-code.vue +++ b/pages/apply-code/apply-code.vue @@ -3,7 +3,11 @@
*当前所在地区 - + + + + *当前所在详细地址 @@ -15,7 +19,7 @@ @@ -78,61 +82,32 @@ import { HEALTH_SIGN } from 'api/api'; - import { mapState,mapMutations } from 'vuex'; + import { + mapState, + mapMutations + } from 'vuex'; export default { data() { return { district: '请选择当前所在地区', address: '', - status: [{ - value: '0', - name: '正常', - }, - { - value: '1', - name: '发烧(37.3度以上)', - }, - { - value: '2', - name: '咳嗽', - }, - { - value: '3', - name: '咽喉疼痛', - }, - { - value: '4', - name: '流鼻涕', - }, - { - value: '5', - name: '头痛', - }, - { - value: '6', - name: '其他', - } - ], + // status: [], hospital: '', tours: [{ - value: 1, - name: '是' - }, - { - value: 0, - name: '否' - } - ], + value: '0', + name: '否' + }, { + value: '1', + name: '是' + }], touches: [{ - value: 1, - name: '是' - }, - { - value: 0, - name: '否' - } - ], + value: '0', + name: '否' + }, { + value: '1', + name: '是' + }], animalHeat: 0, healthTypeId: 0, touchHubei: 0, @@ -140,7 +115,8 @@ agree: false, }; }, - computed: mapState('user', ['token']), + computed: mapState('user', ['token', 'status']), + methods: { ...mapMutations('user', ['setHealthCode']), handleSelectLocation() { @@ -157,7 +133,7 @@ // 状态 StateChange: function(evt) { for (let i = 0; i < this.status.length; i++) { - if (this.status[i].value === evt.target.value) { + if (this.status[i].id === evt.target.value) { this.healthTypeId = i; break; } @@ -175,10 +151,11 @@ }, // 接触 - TouchChange: function(evt) { - for (let i = 0; i < this.touches.length; i++) { - if (this.touches[i].value === evt.target.value) { - this.touchSick = i; + TouchChange(evt) { + console.log(this.touches,'aa') + for (let b = 0; b < this.touches.length; b++) { + if (this.touches[b].value === evt.target.value) { + this.touchSick = b; break; } } @@ -190,7 +167,7 @@ async handleHealthSign() { try { if (!this.checkRules()) return; - + const { address, animalHeat, @@ -206,13 +183,14 @@ address, animalHeat, district, - healthTypeId, + healthTypeId: healthTypeId + 1, hospital, token, touchHubei, touchSick } }; + console.log('params1', params) const res = await this.$http.post(HEALTH_SIGN, params); const { success, @@ -221,8 +199,8 @@ data } = res.data; if (success && code === 200) { - this.setHealthCode(data.healthCode) this.success = true; + this.setHealthCode(data.healthCode) uni.reLaunch({ url: `/pages/index/index`, }); @@ -242,33 +220,39 @@ } } }, - + // 验证信息 checkRules() { - const { district,address,healthTypeId,animalHeat,agree } = this; - if (!district || district === '请选择当前所在地区') { - showToast('请选择当前所在地区'); - return; - } - if (!address) { - showToast('请输入当前所在地址'); - return; - } - if (healthTypeId<0) { - showToast('请选择状态'); - return; - } - if (!animalHeat) { - showToast('请输入当前体温'); - return; - } - if (!agree) { - showToast('请确定是否为本人填写'); - return; - } - return true; + const { + district, + address, + healthTypeId, + animalHeat, + agree + } = this; + if (!district || district === '请选择当前所在地区') { + showToast('请选择当前所在地区'); + return; + } + if (!address) { + showToast('请输入当前所在地址'); + return; + } + if (healthTypeId < 0) { + showToast('请选择状态'); + return; + } + if (!animalHeat) { + showToast('请输入当前体温'); + return; + } + if (!agree) { + showToast('请确定是否为本人填写'); + return; + } + return true; }, - + }, }; @@ -282,6 +266,11 @@ line-height: 60rpx; } + .timer { + font-size: 34rpx !important; + color: $gray; + } + .primary-btn { border-radius: 15rpx; } diff --git a/pages/my-code/my-code.vue b/pages/my-code/my-code.vue index 8829c78..f3cb742 100644 --- a/pages/my-code/my-code.vue +++ b/pages/my-code/my-code.vue @@ -2,9 +2,8 @@ - - - {{ item.time }} + + {{ $moment(+item.time).format('MM-DD') }} {{ item.district }},{{ item.address }} @@ -14,8 +13,11 @@ - - 体温{{ item.animalHeat }}℃,状态:{{ item.healthTypeId }} + + 体温:{{ item.animalHeat }}℃, + + 状态:{{ state.name }} + @@ -38,61 +40,61 @@ showToast } from 'common/script/util'; import { - SUBMIT_USER_INFO + HEALTH_SIGN_HISTORY } from 'api/api'; import { mapState,mapMutations } from 'vuex'; export default { data() { return { - tableList: [{ - time: '2020-02-05', - district: '太原', - address: '小店', - healthTypeId: '正常', - hospital: '是深V', - touchHubei: 1, - touchSick: 1, - animalHeat: 0, - healthLevel: 0, // 健康码等级 0正常 1隔离中或疑似 2确诊 - }, - { - time: '2020-02-05', - district: '太原', - address: '小店', - healthTypeId: '正常', - hospital: '', - touchHubei: 1, - touchSick: 0, - animalHeat: 0, - healthLevel: 1 - }, - { - time: '2020-02-05', - district: '太原', - address: '小店', - healthTypeId: '正常', - hospital: '', - touchHubei: 1, - touchSick: 0, - animalHeat: 0, - healthLevel: 2 - } - ], + tableList: [], }; }, created() { - if(this.userInfo){ - - } + this.getHealthSignHistory(); }, - computed: mapState('user', ['userInfo']), + computed: mapState('user', ['token','userInfo','status']), methods: { - ...mapMutations('user', ['setUserInfo']), - + ...mapMutations('user', ['setStatus','setUserInfo']), + + // 获取健康打卡记录 + async getHealthSignHistory() { + try { + const { token } = this; + const params = { + param: { + token + } + }; + const res = await this.$http.post(HEALTH_SIGN_HISTORY, params); + const { + success, + code, + msg, + data + } = res.data; + if (success && code === 200) { + this.success = true; + this.tableList = data; + } else { + uni.showToast({ + title: msg || '获取健康打卡记录成功', + icon: 'none' + }); + } + } catch (error) { + console.log('error: ', error); + if (error.msg) { + uni.showToast({ + title: error.msg || '获取健康打卡记录失败', + icon: 'none' + }); + } + } + }, }, }; diff --git a/pages/my-trips/my-trips.vue b/pages/my-trips/my-trips.vue index cd34f41..b2dda7b 100644 --- a/pages/my-trips/my-trips.vue +++ b/pages/my-trips/my-trips.vue @@ -2,78 +2,134 @@ - - - {{ index+1 }} - - - {{ item.date }} + + {{ item.startTime }} + + + + {{ item.startTime }} 到 {{ item.endTime }} - - - - - 出发时间: - {{ item.startTime }} - + + + + 返校行程 + 日常外出 - - 抵达时间: - {{ item.endTime }} - + + 同行人:{{ item.together }} - - 出行交通方式: - {{ item.transport }} - + + 出行方式: + {{ trip.name }} - - 乘坐航班车次或车牌号码及座位号: - {{ item.carNumber }} - + + 乘坐航班车次或车牌号码及座位号: + {{ item.carNo }} + - + diff --git a/pages/service-agreement/service-agreement.vue b/pages/service-agreement/service-agreement.vue index 9742d4e..3844d15 100644 --- a/pages/service-agreement/service-agreement.vue +++ b/pages/service-agreement/service-agreement.vue @@ -6,7 +6,7 @@ export default { data() { return { - url: 'https://www.yuque.com/docs/share/00738d22-45de-46d0-8473-4275ac421fbd?#' + url: 'pages/preview/preview?sid=&fid=60774991254&fname=%25E7%2594%25A8%25E6%2588%25B7%25E6%259C%258D%25E5%258A%25A1%25E5%258D%258F%25E8%25AE%25AE.docx&ftype=file&groupid=821063867&needUpdateRecent=true' } }, } diff --git a/store/modules/user/mutations.js b/store/modules/user/mutations.js index c1347f2..3da99aa 100644 --- a/store/modules/user/mutations.js +++ b/store/modules/user/mutations.js @@ -60,6 +60,15 @@ const mutations = { */ setPagePath(state, data) { state.pagePath = data; + }, + + /** + * 设置健康状态类型 status + * @param {*} state + * @param {array} data + */ + setStatus(state, data) { + state.status = data || []; } }; diff --git a/store/modules/user/state.js b/store/modules/user/state.js index 727e3a9..fff4bf3 100644 --- a/store/modules/user/state.js +++ b/store/modules/user/state.js @@ -4,6 +4,7 @@ const state = { healthCode: '', // 健康码 userInfo: '', // 个人基本信息 pagePath: '', //页面跳转参数 + status: [], // 健康状态类型 }; export default state;