diff --git a/components/timeline/timeline.vue b/components/timeline/timeline.vue index 0cfa809..5e0735d 100644 --- a/components/timeline/timeline.vue +++ b/components/timeline/timeline.vue @@ -1,32 +1,32 @@ diff --git a/config/api/api.js b/config/api/api.js index 90e3ec0..83ad5a0 100644 --- a/config/api/api.js +++ b/config/api/api.js @@ -35,4 +35,4 @@ export const SCAN_SIGN = `${sites}/upload`; export const GET_JOURNEYS = `${journeys}/info`; // 上报行程 -export const SUBMIT_JOURNEYS = `${sites}/upload`; +export const SUBMIT_JOURNEYS = `${journeys}/upload`; diff --git a/pages.json b/pages.json index 730e1fc..e19261a 100644 --- a/pages.json +++ b/pages.json @@ -1,5 +1,12 @@ { "pages": [ + // { + // "path": "pages/my-code/my-code", + // "style": { + // "navigationBarTitleText": "我的健康打卡" + // } + // }, + { "path": "pages/index/index", "style": { diff --git a/pages/add-stroke/add-stroke.vue b/pages/add-stroke/add-stroke.vue index b2f83c2..a1caf1b 100644 --- a/pages/add-stroke/add-stroke.vue +++ b/pages/add-stroke/add-stroke.vue @@ -33,7 +33,7 @@ 以上信息是我本人填写,本人对信息的真实性和完整性负责。 - + @@ -43,6 +43,7 @@ import { showToast } from 'common/script/util'; import UniCalendar from 'components/uni-calendar/uni-calendar.vue'; import DateSelector from './components/date-selector.vue'; +import { SUBMIT_JOURNEYS } from 'api/api'; export default { components: {UniCalendar,DateSelector}, @@ -94,8 +95,8 @@ export default { * @param {string} start 开始时间 * @param {string} end 截止时间 */ - getData(start, end) { - console.log('出发时间 start, end: ', start, end); + getStartData(start) { + console.log('出发时间 start: ', start); }, /** @@ -103,32 +104,86 @@ export default { * @param {string} start 开始时间 * @param {string} end 截止时间 */ - getEndData(start, end) { - console.log('抵达时间 start, end: ', start, end); + getEndData(end) { + console.log('抵达时间 end: ', end); }, /** - * 提交基本信息 + * 添加行程 */ - addStroke() { - if (!this.transports) { - showToast('请选择身份'); - return; - } - if (!this.carNumber) { - showToast('请输入学号'); - return; - } - if (!this.agree) { - showToast('请确定是否为本人填写'); - return; + async handleAddStroke() { + try { + if (!this.checkRules()) return; + + const { + address, + animalHeat, + district, + healthTypeId, + hospital, + token, + touchHubei, + touchSick + } = this; + const params = { + param: { + address, + animalHeat, + district, + healthTypeId, + hospital, + token, + touchHubei, + touchSick + } + }; + const res = await this.$http.post(HEALTH_SIGN, params); + const { + success, + code, + msg, + 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 || '申请健康码成功', + icon: 'none' + }); + } + } catch (error) { + console.log('error: ', error); + if (error.msg) { + uni.showToast({ + title: error.msg || '申请健康码失败', + icon: 'none' + }); + } } - console.log('信息提交'); - uni.reLaunch({ - url: `/pages/index/index`, - }); }, - + + // 验证信息 + checkRules() { + const { district,address,healthTypeId,animalHeat,agree } = this; + if (!this.transports) { + showToast('请选择身份'); + return; + } + if (!this.carNumber) { + showToast('请输入学号'); + return; + } + if (!this.agree) { + showToast('请确定是否为本人填写'); + return; + } + return true; + }, }, }; diff --git a/pages/apply-code/apply-code.vue b/pages/apply-code/apply-code.vue index c4717a3..133d4a9 100644 --- a/pages/apply-code/apply-code.vue +++ b/pages/apply-code/apply-code.vue @@ -3,7 +3,7 @@
*当前所在地区 - + *当前所在详细地址 @@ -15,7 +15,7 @@ @@ -32,7 +32,7 @@ @@ -46,7 +46,7 @@ @@ -55,7 +55,7 @@ *当前体温(℃) - + @@ -65,7 +65,7 @@ 以上信息是我本人填写,本人对信息的真实性和完整性负责。 - +
@@ -75,11 +75,15 @@ import { showToast } from 'common/script/util'; + import { + HEALTH_SIGN + } from 'api/api'; + import { mapState,mapMutations } from 'vuex'; export default { data() { return { - area: '请输入当前所在地区', + district: '请选择当前所在地区', address: '', status: [{ value: '0', @@ -87,7 +91,7 @@ }, { value: '1', - name: '发烧(377.3度以上)', + name: '发烧(37.3度以上)', }, { value: '2', @@ -129,24 +133,23 @@ name: '否' } ], - temperature: '', - current: 0, - tourCurrent: 0, - touchCurrent: 0, + animalHeat: 0, + healthTypeId: 0, + touchHubei: 0, + touchSick: 0, agree: false, }; }, + computed: mapState('user', ['token']), methods: { + ...mapMutations('user', ['setHealthCode']), handleSelectLocation() { const that = this; uni.chooseLocation({ success: function(res) { console.log('位置名称:' + res.name); console.log('详细地址:' + res.address); - console.log('纬度:' + res.latitude); - console.log('经度:' + res.longitude); - console.log('diqu', that.area, res.address) - that.area = res.address; + that.district = res.address; }, }); }, @@ -155,7 +158,7 @@ StateChange: function(evt) { for (let i = 0; i < this.status.length; i++) { if (this.status[i].value === evt.target.value) { - this.current = i; + this.healthTypeId = i; break; } } @@ -165,7 +168,7 @@ TourChange: function(evt) { for (let i = 0; i < this.tours.length; i++) { if (this.tours[i].value === evt.target.value) { - this.tourCurrent = i; + this.touchHubei = i; break; } } @@ -175,42 +178,97 @@ TouchChange: function(evt) { for (let i = 0; i < this.touches.length; i++) { if (this.touches[i].value === evt.target.value) { - this.touchCurrent = i; + this.touchSick = i; break; } } }, /** - * 提交基本信息 + * 申请健康码 */ - addStroke() { - if (!this.area) { - showToast('请输入当前所在地区'); - return; - } - if (!this.address) { - showToast('请输入当前所在地址'); - return; - } - if (!this.status) { - showToast('请选择状态'); - return; - } - if (!this.temperature) { - showToast('请输入当前体温'); - return; - } - if (!this.agree) { - showToast('请确定是否为本人填写'); - return; + async handleHealthSign() { + try { + if (!this.checkRules()) return; + + const { + address, + animalHeat, + district, + healthTypeId, + hospital, + token, + touchHubei, + touchSick + } = this; + const params = { + param: { + address, + animalHeat, + district, + healthTypeId, + hospital, + token, + touchHubei, + touchSick + } + }; + const res = await this.$http.post(HEALTH_SIGN, params); + const { + success, + code, + msg, + 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 || '申请健康码成功', + icon: 'none' + }); + } + } catch (error) { + console.log('error: ', error); + if (error.msg) { + uni.showToast({ + title: error.msg || '申请健康码失败', + icon: 'none' + }); + } } - console.log('信息提交'); - uni.reLaunch({ - url: `/pages/index/index`, - }); }, - + + // 验证信息 + 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; + }, + }, }; diff --git a/pages/basic-info/basic-info.vue b/pages/basic-info/basic-info.vue index b9336b6..a9dacc4 100644 --- a/pages/basic-info/basic-info.vue +++ b/pages/basic-info/basic-info.vue @@ -7,12 +7,12 @@ *身份证 - + *联系方式 - + *身份 @@ -31,83 +31,159 @@ - - + + \ No newline at end of file + diff --git a/pages/index/components/home.vue b/pages/index/components/home.vue index 7023107..966aba6 100644 --- a/pages/index/components/home.vue +++ b/pages/index/components/home.vue @@ -1,17 +1,17 @@ diff --git a/pages/index/components/mine.vue b/pages/index/components/mine.vue index 46db38d..6a23dc1 100644 --- a/pages/index/components/mine.vue +++ b/pages/index/components/mine.vue @@ -10,7 +10,9 @@ {{ userInfo.nickName }} {{ userInfo.classes }} - + + + @@ -39,6 +41,7 @@ @@ -59,8 +63,9 @@ overflow: hidden; } - .healthy-coad { - font-size: 40px; + .healthy-code { + width: 70rpx; + height: 70rpx; } .more { diff --git a/pages/my-code/my-code.vue b/pages/my-code/my-code.vue index 4bfdde3..aaf6c74 100644 --- a/pages/my-code/my-code.vue +++ b/pages/my-code/my-code.vue @@ -2,52 +2,30 @@ - - - {{ index+1 }} - - - {{ item.date }} + + + {{ item.time }} + + + {{ item.district }},{{ item.address }} - - - - - 当前所在地区: - {{ item.area }} - - - - 当前所在详细地址: - {{ item.address }} - - - - 当前状态: - {{ item.state }} - - - - 就诊医院: - {{ item.hospital }} - + + + + 体温{{ item.animalHeat }}℃,状态:{{ item.healthTypeId }} - - 最近14天是否有武汉居住史、旅游史或武汉亲戚来访: - {{ item.tour }} - - - - 最近14天是否有新冠肺炎患者或疑似患者接触史: - {{ item.touch }} - - - - 当前体温: - {{ item.temperature }}℃ - + + + 武汉接触史 + + + 患者接触史 + + 就诊医院:{{ item.hospital }} @@ -64,64 +42,37 @@ data() { return { tableList: [{ - date: '2020-02-05', - area: '太原', + time: '2020-02-05', + district: '太原', address: '小店', - state: '正常', - hospital: '无', - tour: '否', - touch: '否', - temperature: '36' - }, - { - date: '2020-02-05', - area: '太原', - address: '迎泽', - state: '正常', - hospital: '无', - tour: '否', - touch: '否', - temperature: '36.5' - }, - { - date: '2020-02-05', - area: '太原', - address: '迎泽', - state: '正常', - hospital: '无', - tour: '否', - touch: '否', - temperature: '36.3' + healthTypeId: '正常', + hospital: '是深V', + touchHubei: 1, + touchSick: 1, + animalHeat: 0, + healthLevel: 0, // 健康码等级 0正常 1隔离中或疑似 2确诊 }, { - date: '2020-02-05', - area: '太原', - address: '迎泽', - state: '正常', - hospital: '无', - tour: '否', - touch: '否', - temperature: '36.5' - }, - { - date: '2020-02-05', - area: '太原', - address: '迎泽', - state: '正常', - hospital: '无', - tour: '否', - touch: '否', - temperature: '36' + time: '2020-02-05', + district: '太原', + address: '小店', + healthTypeId: '正常', + hospital: '', + touchHubei: 1, + touchSick: 0, + animalHeat: 0, + healthLevel: 1 }, { - date: '2020-02-05', - area: '太原', - address: '迎泽', - state: '正常', - hospital: '无', - tour: '否', - touch: '否', - temperature: '36' + time: '2020-02-05', + district: '太原', + address: '小店', + healthTypeId: '正常', + hospital: '', + touchHubei: 1, + touchSick: 0, + animalHeat: 0, + healthLevel: 2 } ], }; diff --git a/store/modules/user/mutations.js b/store/modules/user/mutations.js index 8d4ae24..ec63bcb 100644 --- a/store/modules/user/mutations.js +++ b/store/modules/user/mutations.js @@ -34,6 +34,15 @@ const mutations = { state.user = { ...user }; uni.setStorageSync('user', JSON.stringify(user)); }, + + /** + * 设置健康码 + * @param {object} state + * @param {string} data + */ + setHealthCode(state, data) { + state.healthCode = data; + }, }; export default mutations; diff --git a/store/modules/user/state.js b/store/modules/user/state.js index 82c9f22..6fe77e4 100644 --- a/store/modules/user/state.js +++ b/store/modules/user/state.js @@ -1,6 +1,7 @@ const state = { token: '', user: null, + healthCode: '', // 健康码 }; export default state;