Browse Source

打卡插件增加位置信息

tall4
xuesinan 3 years ago
parent
commit
b13eb798a0
  1. 6
      src/App.vue
  2. 15
      src/components/List/List.vue
  3. 18
      src/store/modules/home/mutations.js
  4. 4
      src/store/modules/home/state.js

6
src/App.vue

@ -22,19 +22,23 @@ export default {
const roleId = this.$route.query.rid;
const token = this.$route.query.token;
const url = this.$route.query.url;
const longitude = this.$route.query.longitude;
const latitude = this.$route.query.latitude;
// const params = { userId };
// await this.getUserId(params);
await this.sign(token);
await this.setRoleId(roleId);
await this.setUrl(url);
await this.setLongitude(longitude);
await this.setLatitude(latitude);
await this.getAllMembers({ projectId: this.$route.query.pid });
this.setProjectId(this.$route.query.pid);
});
},
methods: {
...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId', 'setUrl']),
...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId', 'setUrl', 'setLongitude', 'setLatitude']),
...mapMutations('user', ['sign']),
// ...mapActions('user', ['getUserId']),
...mapActions('home', ['getAllMembers']),

15
src/components/List/List.vue

@ -290,7 +290,17 @@ export default {
};
},
computed: mapState('home', ['projectId', 'members', 'startTime', 'endTime', 'memberIdList', 'roleId', 'checkers']),
computed: mapState('home', [
'projectId',
'members',
'startTime',
'endTime',
'memberIdList',
'roleId',
'checkers',
'longitude',
'latitude',
]),
mounted() {
this.timer = setInterval(async () => {
@ -426,6 +436,9 @@ export default {
params.param.remark = this.remark;
}
params.param.longitude = this.longitude;
params.param.latitude = this.latitude;
const res = await clockPunch(params);
const { code, msg } = res.data;
if (code === 200) {

18
src/store/modules/home/mutations.js

@ -78,6 +78,24 @@ const mutations = {
setUrl(state, data) {
state.url = data;
},
/**
* 设置经度信息
* @param {object} state
* @param {String} data
*/
setLongitude(state, data) {
state.longitude = data;
},
/**
* 设置纬度信息
* @param {object} state
* @param {String} data
*/
setLatitude(state, data) {
state.latitude = data;
},
};
export default mutations;

4
src/store/modules/home/state.js

@ -14,7 +14,9 @@ const state = {
memberIdList: [],
roleId: '',
checkers: [], // 审核人列表
url: ''
url: '',
longitude: '',
latitude: ''
};
export default state;

Loading…
Cancel
Save