|
|
@ -14,23 +14,49 @@ |
|
|
|
|
|
|
|
<!-- 全局提示框 --> |
|
|
|
<u-top-tips ref="uTips"></u-top-tips> |
|
|
|
|
|
|
|
<!-- 选择老人 --> |
|
|
|
<!-- :async-close="true" --> |
|
|
|
<u-modal v-model="showElder" title="选择老人" @confirm="confirmModel" @cancel="cancelModel" ref="uModal" :show-cancel-button="true"> |
|
|
|
<ChooseElder></ChooseElder> |
|
|
|
</u-modal> |
|
|
|
|
|
|
|
<!-- 设置使用者 --> |
|
|
|
<!-- :async-close="true" --> |
|
|
|
<u-modal |
|
|
|
v-model="showUser" |
|
|
|
title="设置使用者" |
|
|
|
@confirm="confirmSetUserModel" |
|
|
|
@cancel="cancelSetUserModel" |
|
|
|
ref="uModal" |
|
|
|
:show-cancel-button="true" |
|
|
|
> |
|
|
|
<ChooseUser></ChooseUser> |
|
|
|
</u-modal> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { mapState, mapMutations } from 'vuex'; |
|
|
|
import toolMixin from '@/mixins/tool'; |
|
|
|
import { mapState, mapMutations, mapActions } from 'vuex'; |
|
|
|
|
|
|
|
let prevY = 0; |
|
|
|
|
|
|
|
export default { |
|
|
|
mixins: [toolMixin], |
|
|
|
|
|
|
|
data() { |
|
|
|
return { |
|
|
|
calendar: null, |
|
|
|
days: [], |
|
|
|
options: {}, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
computed: mapState('user', ['token', 'user']), |
|
|
|
computed: { |
|
|
|
...mapState('user', ['token', 'user']), |
|
|
|
...mapState('yanyuan', ['enterByCode', 'toolCode']), |
|
|
|
}, |
|
|
|
|
|
|
|
watch: { |
|
|
|
token(value) { |
|
|
@ -38,6 +64,15 @@ export default { |
|
|
|
this.getProjects(); |
|
|
|
this.handleFindPoint(); |
|
|
|
}, |
|
|
|
|
|
|
|
user(value) { |
|
|
|
if (value.wxInfo && value.wxInfo.nickname && value.phone) { |
|
|
|
if (this.options && this.options.scene && !this.options.code) { |
|
|
|
// 首页用户身份判断 |
|
|
|
this.homeIdentity(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
onShow() { |
|
|
@ -47,12 +82,18 @@ export default { |
|
|
|
this.setProject(); |
|
|
|
}, |
|
|
|
|
|
|
|
onReady() { |
|
|
|
// this.calendar = this.$refs.calendar; |
|
|
|
async onLoad(options) { |
|
|
|
this.options = options; |
|
|
|
if (options.code === 'true') { |
|
|
|
// 首页用户身份判断 |
|
|
|
await this.homeIdentity(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
...mapMutations('project', ['setProjects', 'setDotList', 'setProject']), |
|
|
|
...mapActions('yanyuan', ['getBindTool']), |
|
|
|
...mapMutations('yanyuan', ['setIdentityInfo']), |
|
|
|
|
|
|
|
// 获取项目列表 |
|
|
|
getProjects(start = this.$moment().startOf('day').valueOf(), end = this.$moment().endOf('day').valueOf()) { |
|
|
@ -124,6 +165,34 @@ export default { |
|
|
|
duration: '6000', |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 首页用户身份判断 |
|
|
|
*/ |
|
|
|
async homeIdentity() { |
|
|
|
try { |
|
|
|
const data = await this.$u.api.homeIdentity(); |
|
|
|
this.setIdentityInfo(data); |
|
|
|
if (this.enterByCode && this.toolCode) { |
|
|
|
await this.bindTool(); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('error: ', error); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 绑定工具箱 |
|
|
|
*/ |
|
|
|
async bindTool() { |
|
|
|
try { |
|
|
|
const params = { toolCode: this.toolCode }; |
|
|
|
await this.getBindTool(params); |
|
|
|
this.initTool(); |
|
|
|
} catch (error) { |
|
|
|
console.error('error: ', error); |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|