|
@@ -1,20 +1,19 @@
|
|
|
<template>
|
|
|
-<div>
|
|
|
- <header class="mui-bar mui-bar-nav">
|
|
|
- <h1 class="mui-title">用户注册</h1>
|
|
|
- <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
|
|
|
- </header>
|
|
|
+ <div>
|
|
|
+ <common @asynCallBack="asynCallBack"></common>
|
|
|
+ <top-header :pageTitle="pageTitle"></top-header>
|
|
|
+
|
|
|
<div class="mui-content fyy-upphoto margin60">
|
|
|
<div class="mui-content-padded">
|
|
|
<h5>请输入您的信息</h5>
|
|
|
<form class="mui-input-group">
|
|
|
<div class="mui-input-row">
|
|
|
<label>姓名</label>
|
|
|
- <input type="text" class="mui-input-clear" placeholder="输入姓名">
|
|
|
+ <input type="text" v-model="subForm.name" class="mui-input-clear" placeholder="输入姓名">
|
|
|
</div>
|
|
|
<div class="mui-input-row">
|
|
|
<label>手机号码</label>
|
|
|
- <input type="text" class="mui-input-clear" placeholder="输入姓名">
|
|
|
+ <input type="text" v-model="subForm.phone" class="mui-input-clear" placeholder="输入手机号码">
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
@@ -25,25 +24,133 @@
|
|
|
照片将用于人脸识别设备,请上传清晰的免冠登记照或肩部以上近照。
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="mui-content-padded faceaifyy-content">
|
|
|
- <div class="faceaifyy-content-region">
|
|
|
- <a href="#picture"><span class="mui-icon iconfont icon-weibiaoti1"></span></a>
|
|
|
+ <div class="mui-content-padded faceaifyy-content" @click="chooseImage">
|
|
|
+ <div class="faceaifyy-content-region" :style="subForm.faceImageUrl?'background:none':''">
|
|
|
+ <a v-if="!subForm.faceImageUrl"><span class="mui-icon iconfont icon-weibiaoti1"></span></a>
|
|
|
+ <img v-if="subForm.faceImageUrl" :src="subForm.faceImageUrl" width="100%" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
<div class="fyy-footer">
|
|
|
- <div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-primary ">下一步</button></div>
|
|
|
+ <div class="bindfyy-btn"><button type="button" class="mui-btn mui-btn-primary" @click="submit">下一步</button></div>
|
|
|
</div>
|
|
|
-</div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import Common from '$project/components/Common.vue'
|
|
|
+ import Loading from '$project/components/Loading.vue'
|
|
|
+ import TopHeader from '$project/components/TopHeader.vue'
|
|
|
+ import {
|
|
|
+ mapGetters,
|
|
|
+ mapMutations
|
|
|
+ } from 'vuex'
|
|
|
+ import * as WxJsApi from '$project/utils/wxJsApi'
|
|
|
+ import * as types from '$project/store/mutation-types'
|
|
|
+ export default {
|
|
|
+ name: 'HouseKeeperAdminPersonAdd',
|
|
|
+ components: {
|
|
|
+ Common,
|
|
|
+ Loading,
|
|
|
+ TopHeader
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ pageTitle: '用户注册',
|
|
|
+
|
|
|
+ isLoading: false,
|
|
|
+
|
|
|
+ subForm: {
|
|
|
+ name: '',
|
|
|
+ phone: '',
|
|
|
+ faceImageUrl: '',
|
|
|
+ bindDevices: '',
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ //微信选择图片
|
|
|
+ chooseImage() {
|
|
|
+ WxJsApi.chooseImage().then(res => {
|
|
|
+ var localData = res.localData;
|
|
|
+
|
|
|
+ if (localData.indexOf('data:image') != 0) {
|
|
|
+ //判断是否有这样的头部
|
|
|
+ localData = 'data:image/jpeg;base64,' + localData
|
|
|
+ }
|
|
|
+ localData = localData.replace(/\r|\n/g, '').replace('data:image/jgp', 'data:image/jpeg')
|
|
|
+ this.imgBase64 = localData;
|
|
|
+ //显示裁剪图片
|
|
|
+ //_this.showCropper(field);
|
|
|
+ this.uploadpic();
|
|
|
+ }).catch(error => {
|
|
|
+ mui.toast(error);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //上传图片
|
|
|
+ uploadpic() {
|
|
|
+ this.isLoading = true;
|
|
|
+ WxJsApi.uploadPic(this.imgBase64).then(response => {
|
|
|
+ this.isLoading = false;
|
|
|
+
|
|
|
+ this.subForm.faceImageUrl = response;
|
|
|
+ }).catch(error => {
|
|
|
+ this.isLoading = false;
|
|
|
+ mui.toast(error);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //表单检测
|
|
|
+ checkFrom() {
|
|
|
+ if (!this.subForm.name) {
|
|
|
+ mui.toast('请输入姓名');
|
|
|
+ return false;
|
|
|
+ } else if (!this.subForm.phone) {
|
|
|
+ mui.toast('请输入电话号码');
|
|
|
+ return false;
|
|
|
+ } else if (!this.subForm.faceImageUrl) {
|
|
|
+ mui.toast('请上传人脸照片');
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //提交
|
|
|
+ submit() {
|
|
|
+ if (this.checkFrom()) {
|
|
|
+ this.set_add_person_data(this.subForm);
|
|
|
+ this.$router.push({
|
|
|
+ name: 'HouseKeeperAdminPersonDevice',
|
|
|
+ query: {}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ asynCallBack() {
|
|
|
+
|
|
|
+ },
|
|
|
+ ...mapMutations({
|
|
|
+ set_add_person_data: types.SET_ADD_PERSON_DATA,
|
|
|
+ })
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ //获取微信配置
|
|
|
+ WxJsApi.getWxConfig();
|
|
|
+ },
|
|
|
+ destroyed() {},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ openId: 'wx_openid',
|
|
|
+ token: 'token',
|
|
|
+ add_person_data: 'add_person_data'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style scoped src="$project/assets/css/sczpfyy.css"></style>
|
|
|
<style scoped src="$project/assets/css/xpwyfyy.css"></style>
|
|
|
<style src="$project/assets/css/iconfont.css"></style>
|
|
|
-<style>
|
|
|
+<style scoped>
|
|
|
</style>
|