Commit c13b30ff authored by 小耗子's avatar 小耗子

注册

parent ba8cd802
...@@ -5,7 +5,16 @@ ...@@ -5,7 +5,16 @@
}, },
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path" : "pages/user/register/index",
"name":"register",
"style" :
{
"navigationBarTitleText": "注册",
"enablePullDownRefresh": false
}
},{
"path" : "pages/index/defalutScreen", "path" : "pages/index/defalutScreen",
"name":"defalutScreen",
"style" : "style" :
{ {
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
...@@ -105,14 +114,6 @@ ...@@ -105,14 +114,6 @@
"navigationBarTitleText": "选择企业", "navigationBarTitleText": "选择企业",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},{
"path" : "pages/user/register/index",
"name":"register",
"style" :
{
"navigationBarTitleText": "注册",
"enablePullDownRefresh": false
}
} }
], ],
"subPackages":[], "subPackages":[],
...@@ -150,9 +151,16 @@ ...@@ -150,9 +151,16 @@
"condition" : { //模式配置,仅开发期间生效 "condition" : { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项) "current": 0, //当前激活的模式(list 的索引项)
"list": [ "list": [
{ // {
"name": "enterprise", //模式名称 // "name": "defalutScreen", //模式名称
"path": "/pages/user/enterprise" //启动页面,必选 // "path": "pages/index/defalutScreen", //启动页面,必选
// "query": "companyId=999999998"
// }
{
"name": "register", //模式名称
"path": "pages/user/register/index", //启动页面,必选
"query": "reqisterPageType=3"
} }
] ]
}, },
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
mapGetters mapGetters
} from 'vuex' } from 'vuex'
import http from '@/shopro/request/index'; import http from '@/shopro/request/index';
import qs from 'qs';
export default { export default {
data() { data() {
return { return {
...@@ -26,7 +25,7 @@ ...@@ -26,7 +25,7 @@
} }
}, },
methods: { methods: {
...mapActions(['getPhoneNumber']), ...mapActions(['getPhoneNumber','editPhone']),
agreement(flag){ agreement(flag){
uni.navigateTo({ uni.navigateTo({
url: `/pages/public/${flag}`, url: `/pages/public/${flag}`,
...@@ -51,24 +50,30 @@ ...@@ -51,24 +50,30 @@
// 获取手机号 // 获取手机号
async getInfoPhoneNumber(e) { async getInfoPhoneNumber(e) {
let ph = await this.getPhoneNumber(e); let ph = await this.getPhoneNumber(e);
http('user.editPhone', qs.stringify({"mobile":ph})).then(res => { let res = await this.editPhone(ph);
if(res.code == 0) { if(res) { //跳转
uni.showToast({
title: '绑定成功',
duration: 2000,
icon:'none'
});
uni.navigateTo({ uni.navigateTo({
url: `/pages/h5/index?appointPage=${this.appointPage}` url: `/pages/h5/index?appointPage=${this.appointPage}`
}) })
}else{
uni.showToast({
title: res.msg,
duration: 2000,
icon:'none'
});
} }
}) // http('user.editPhone', qs.stringify({"mobile":ph})).then(res => {
// if(res.code == 0) {
// uni.showToast({
// title: '绑定成功',
// duration: 2000,
// icon:'none'
// });
// uni.navigateTo({
// url: `/pages/h5/index?appointPage=${this.appointPage}`
// })
// }else{
// uni.showToast({
// title: res.msg,
// duration: 2000,
// icon:'none'
// });
// }
// })
} }
}, },
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
return { return {
unregistered: false, unregistered: false,
checkSessionStatus: false, checkSessionStatus: false,
loading: true loading: true,
companyId:""
} }
}, },
computed: { computed: {
...@@ -49,24 +49,26 @@ ...@@ -49,24 +49,26 @@
this.getInfoPhoneNumber() this.getInfoPhoneNumber()
} }
}, },
// 获取手机号 // 自动注册
async getInfoPhoneNumber(e) { async autoRegister(companyId){
let list = await this.enterprise() let register = await this.registerInfoFn(companyId);
console.log(list)
if(list.length == 1) {
let register = await this.registerInfoFn(list[0].companyId);
if (register) { //注册成功 if (register) { //注册成功
this.unregistered = true; this.unregistered = true;
uni.navigateTo({ uni.navigateTo({
url: '/pages/h5/index', url: '/pages/h5/index',
}) })
} }
},
// 获取手机号
async getInfoPhoneNumber(e) {
let list = await this.enterprise()
if(list.length == 1) {
this.autoRegister(list[0].companyId)
}else{ }else{
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/enterprise', url: '/pages/user/enterprise'
}) })
} }
}, },
async auth() { async auth() {
let auth = await this.authCheck(); let auth = await this.authCheck();
...@@ -105,7 +107,7 @@ ...@@ -105,7 +107,7 @@
success: function(info) { //调用code success: function(info) { //调用code
console.log("code000000000000000000000000==========", info.code) console.log("code000000000000000000000000==========", info.code)
that.$store.commit('wxCode', info.code); //按钮切换全选。 that.$store.commit('wxCode', info.code); //按钮切换全选。
let userInfo = that.getUserInfo(info.code); let userInfo = that.getUserInfo(info.code,this.companyId);
userInfo.then(res => { userInfo.then(res => {
that.authCheck().then(checkCode => { that.authCheck().then(checkCode => {
that.loading = false; that.loading = false;
...@@ -166,6 +168,13 @@ ...@@ -166,6 +168,13 @@
return { return {
path: 'pages/index/defalutScreen' path: 'pages/index/defalutScreen'
} }
},
onLoad(options){
if(this.$Route.query.companyId){
this.companyId = this.$Route.query.companyId
}else{
this.companyId = ""
}
} }
} }
......
...@@ -59,18 +59,19 @@ ...@@ -59,18 +59,19 @@
}, },
methods: { methods: {
...mapActions(['enterprise','registerInfoFn']), ...mapActions(['enterprise','registerInfoFn']),
/** // 选择企业
* 选择企业
*/
async selectEnterprise(item){ async selectEnterprise(item){
if(item.loginType && item.mallType == 0){
// 0-页面有 手机号+验证码 phCodeReg // 0-页面有 手机号+验证码 phCodeReg
// 1-页面有 手机号+验证码+工号 phCodeEmpnoReg // 1-页面有 手机号+验证码+工号 phCodeEmpnoReg
// 3-页面有 礼品卡+密码 giftPwdReg // 3-页面有 礼品卡+密码 giftPwdReg
// 4-页面有 手机号验证码+姓名+工号 pwdCodeNameEmpnoReg // 4-页面有 手机号验证码+姓名+工号 pwdCodeNameEmpnoReg
if(item.loginType && item.mallType == 0){ //需要注册页 && 封闭式
this.$Router.push({ path: '/pages/user/register/index',query:{"reqisterPageType":item.reqisterPageType}})
}else if(item.loginType && item.mallType == 1){
this.$Router.push({ path: '/pages/user/register/index',query:{"reqisterPageType":item.reqisterPageType}}) this.$Router.push({ path: '/pages/user/register/index',query:{"reqisterPageType":item.reqisterPageType}})
}else{//不需要注册 }
let register = await this.reg isterInfoFn(item.companyId); else{//开放式的代码
let register = await this.registerInfoFn(item.companyId)
if (register) { //注册成功 if (register) { //注册成功
uni.navigateTo({ uni.navigateTo({
url: '/pages/h5/index', url: '/pages/h5/index',
...@@ -106,6 +107,7 @@ ...@@ -106,6 +107,7 @@
margin-top: 10rpx; margin-top: 10rpx;
.enterprise_icon{ .enterprise_icon{
width:24rpx ; width:24rpx ;
height: 24rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
.tips{ .tips{
...@@ -120,6 +122,7 @@ ...@@ -120,6 +122,7 @@
width:50rpx ; width:50rpx ;
.next_icon2{ .next_icon2{
width:48rpx ; width:48rpx ;
height: 48rpx;
} }
} }
} }
......
<template> <template>
<view> <view class="addressCreate-wrap">
礼品卡绑定 <view class="address_info w-bg-color p-l-32 p-r-32 p-t-32 ">
<u-form labelPosition="left" :model="form" ref="form1">
<u-form-item labelWidth="80" label="手机号" prop="userInfo.name" borderBottom ref="item1">
<u--input v-model="params.tel" border="none" placeholder="请填写收货人手机号"></u--input>
<view slot="right">
<u-button size="mini" type="success" open-type="getPhoneNumber" @getphonenumber="getInfoPhoneNumber" >微信一键授权</u-button>
</view>
</u-form-item>
<u-form-item labelWidth="80" label="卡号" prop="userInfo.name" borderBottom ref="item1">
<u--input v-model="params.name" border="none" placeholder="请填写收货人姓名"></u--input>
</u-form-item>
<u-form-item labelWidth="80" label="密码" prop="userInfo.name" borderBottom ref="item1">
<u--input v-model="params.tel" border="none" placeholder="请填写收货人手机号"></u--input>
</u-form-item>
</u-form>
<u-button type="success" @click="submit">提交</u-button>
</view>
</view> </view>
</template> </template>
<script>
// import shPickaddress from '@/components/sh-pickAddress/pickAddress.vue';
import {
mapActions,
mapGetters
} from 'vuex'
import http from '@/shopro/request/index';
export default {
components: {
// shPickaddress
},
data() {
return {
showSex: false,
params: {
name: '',
tel:'',
region:'',
detailRegion:''
},
// rules: {
// 'userInfo.name': {
// type: 'string',
// required: true,
// message: '请填写姓名',
// trigger: ['blur', 'change']
// },
// 'userInfo.sex': {
// type: 'string',
// max: 1,
// required: true,
// message: '请选择男或女',
// trigger: ['blur', 'change']
// },
// },
radio: '',
switchVal: false,
filterPopup: false,//选择地址列表
switchBar: true, //默认地址开关
}
},
methods: {
...mapActions(['getPhoneNumber','editPhone']),
async getInfoPhoneNumber(e) {
let ph = await this.getPhoneNumber(e);
let res = await this.editPhone(ph);
console.log(res)
console.log(ph)
if(res) { //跳转
}
}
},
onLoad() {
// 判定是否有手机号
// 无手机号:显示手机号授权,点击注册,提示请先授权
// 有手机号:不显示手机号授权,直接注册
}
}
</script>
<style lang="scss" scoped>
page{
background:#f2f2f2;
}
.addressCreate-wrap{
.address_info{
margin: 0 auto;
height: 370rpx;
border-radius:0 0 26rpx 26rpx;
}
.default_address{
height: 160rpx;
border-radius:26rpx;
.tipText{
color: #666;
}
}
.save-btn{
.btn-h{
height: 65rpx;
}
}
}
::v-deep .u-form-item__body__left__content__label,::v-deep .uni-input-placeholder{
font-size: 14PX;
}
</style>
...@@ -27,11 +27,14 @@ ...@@ -27,11 +27,14 @@
// }, // },
data() { data() {
return { return {
reqisterPageType:this.$Route.query.reqisterPageType reqisterPageType:""
} }
}, },
methods: { methods: {
},
onLoad(opt){
this.reqisterPageType = this.$Route.query.reqisterPageType
} }
} }
</script> </script>
......
<template> <template>
<view> <view class="addressCreate-wrap">
手机号,验证码,工号注册 <view class="address_info w-bg-color p-l-32 p-r-32 p-t-32 ">
<u-form labelPosition="left" :model="form" ref="form1">
<u-form-item labelWidth="80" label="手机号" prop="userInfo.name" borderBottom ref="item1">
<u--input v-model="params.tel" border="none" placeholder="请填写收货人手机号"></u--input>
<view slot="right">
<u-button size="mini" type="success" @click="submit">微信一键授权</u-button>
</view>
</u-form-item>
<u-form-item labelWidth="80" label="工号/卡号" prop="userInfo.name" borderBottom ref="item1">
<u--input v-model="params.name" border="none" placeholder="请填写收货人姓名"></u--input>
</u-form-item>
<u-form-item labelWidth="80" label="姓名" prop="userInfo.name" borderBottom ref="item1">
<u--input v-model="params.tel" border="none" placeholder="请填写收货人手机号"></u--input>
</u-form-item>
</u-form>
<u-button type="success" @click="submit">提交</u-button>
</view>
</view> </view>
</template> </template>
<script>
// import shPickaddress from '@/components/sh-pickAddress/pickAddress.vue';
export default {
components: {
// shPickaddress
},
data() {
return {
showSex: false,
form: {
userInfo: {
name: '',
tel:'',
region:'',
detailRegion:''
},
},
// rules: {
// 'userInfo.name': {
// type: 'string',
// required: true,
// message: '请填写姓名',
// trigger: ['blur', 'change']
// },
// 'userInfo.sex': {
// type: 'string',
// max: 1,
// required: true,
// message: '请选择男或女',
// trigger: ['blur', 'change']
// },
// },
radio: '',
switchVal: false,
filterPopup: false,//选择地址列表
switchBar: true, //默认地址开关
}
},
methods: {
selAddress() {
this.filterPopup = true
},
// 选择性别
// sexSelect(e) {
// this.model1.userInfo.sex = e.name
// this.$refs.form1.validateField('userInfo.sex')
// },
}
}
</script>
<style lang="scss" scoped>
page{
background:#f2f2f2;
}
.addressCreate-wrap{
.address_info{
margin: 0 auto;
height: 370rpx;
border-radius:0 0 26rpx 26rpx;
}
.default_address{
height: 160rpx;
border-radius:26rpx;
.tipText{
color: #666;
}
}
.save-btn{
.btn-h{
height: 65rpx;
}
}
}
::v-deep .u-form-item__body__left__content__label,::v-deep .uni-input-placeholder{
font-size: 14PX;
}
</style>
<template> <template>
<view> <view class="addressCreate-wrap">
手机号,验证码,姓名,工号注册 <view class="address_info w-bg-color p-l-32 p-r-32 p-t-32 ">
<u-form labelPosition="left" :model="form" ref="form1">
<u-form-item labelWidth="80" label="手机号" prop="params.name" borderBottom ref="item1">
<u--input v-model="params.tel" border="none" placeholder="请填写收货人手机号"></u--input>
<view slot="right">
<u-button size="mini" type="success" @click="submit">微信一键授权</u-button>
</view>
</u-form-item>
<u-form-item labelWidth="80" label="工号/卡号" prop="params.name" borderBottom ref="item1">
<u--input v-model="params.name" border="none" placeholder="请填写收货人姓名"></u--input>
</u-form-item>
<u-form-item labelWidth="80" label="姓名" prop="params.name" borderBottom ref="item1">
<u--input v-model="params.tel" border="none" placeholder="请填写收货人手机号"></u--input>
</u-form-item>
</u-form>
<u-button type="success" @click="submit">提交</u-button>
</view>
</view> </view>
</template> </template>
<script>
// import shPickaddress from '@/components/sh-pickAddress/pickAddress.vue';
export default {
components: {
// shPickaddress
},
data() {
return {
showSex: false,
params: {
name: '',
tel:'',
region:'',
detailRegion:''
},
// rules: {
// 'params.name': {
// type: 'string',
// required: true,
// message: '请填写姓名',
// trigger: ['blur', 'change']
// },
// 'params.sex': {
// type: 'string',
// max: 1,
// required: true,
// message: '请选择男或女',
// trigger: ['blur', 'change']
// },
// },
radio: '',
switchVal: false,
filterPopup: false,//选择地址列表
switchBar: true, //默认地址开关
}
},
methods: {
selAddress() {
this.filterPopup = true
},
// 选择性别
// sexSelect(e) {
// this.model1.params.sex = e.name
// this.$refs.form1.validateField('params.sex')
// },
}
}
</script>
<style lang="scss" scoped>
page{
background:#f2f2f2;
}
.addressCreate-wrap{
.address_info{
margin: 0 auto;
height: 370rpx;
border-radius:0 0 26rpx 26rpx;
}
.default_address{
height: 160rpx;
border-radius:26rpx;
.tipText{
color: #666;
}
}
.save-btn{
.btn-h{
height: 65rpx;
}
}
}
::v-deep .u-form-item__body__left__content__label,::v-deep .uni-input-placeholder{
font-size: 14PX;
}
</style>
...@@ -5,7 +5,7 @@ import { ...@@ -5,7 +5,7 @@ import {
MALL_ID, MALL_ID,
COMPANY_ID COMPANY_ID
} from "@/env"; } from "@/env";
import qs from 'qs';
const state = { const state = {
mallId:MALL_ID, mallId:MALL_ID,
sessionkey: uni.getStorageSync("sessionkey") || "", sessionkey: uni.getStorageSync("sessionkey") || "",
...@@ -42,7 +42,7 @@ const actions = { ...@@ -42,7 +42,7 @@ const actions = {
dispatch, dispatch,
commit, commit,
state state
}, code) { }, code,companyId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.setStorageSync("mallId", state.mallId); uni.setStorageSync("mallId", state.mallId);
...@@ -50,10 +50,12 @@ const actions = { ...@@ -50,10 +50,12 @@ const actions = {
// let code = state.wxCode; // let code = state.wxCode;
http('user.getHomePage', { http('user.getHomePage', {
code: code, code: code,
mallId: state.mallId mallId: state.mallId,
companyId:companyId?companyId:""
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
let { sessionKey } = res.data; let { sessionKey } = res.data;
console.log(res.data)
uni.setStorageSync("sessionKey", sessionKey) uni.setStorageSync("sessionKey", sessionKey)
commit('userInfo', res.data); commit('userInfo', res.data);
let token = encodeURI(JSON.stringify(res.data)) let token = encodeURI(JSON.stringify(res.data))
...@@ -144,6 +146,27 @@ const actions = { ...@@ -144,6 +146,27 @@ const actions = {
} }
}) })
}, },
editPhone({commit},ph){
return new Promise((resolve,reject) => {
http('user.editPhone', qs.stringify({"mobile":ph})).then(res => {
if(res.code == 0) {
uni.showToast({
title: '绑定成功',
duration: 2000,
icon:'none'
});
resolve(1)
}else{
uni.showToast({
title: res.msg,
duration: 2000,
icon:'none'
});
reject(0);
}
})
})
},
// 注册用户 // 注册用户
registerInfoFn({commit,state},companyId){ registerInfoFn({commit,state},companyId){
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
...@@ -232,7 +255,6 @@ const actions = { ...@@ -232,7 +255,6 @@ const actions = {
}) })
} }
} }
const mutations = { const mutations = {
token(state, payload) { token(state, payload) {
......
...@@ -137,3 +137,10 @@ $bg-color:#f0f0f0;//背景底色 ...@@ -137,3 +137,10 @@ $bg-color:#f0f0f0;//背景底色
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
} }
// form表单样式
.u-form-item{
padding-left:32rpx ;
padding-right:32rpx ;
background: #e4e7ed;
margin-bottom: 20rpx;
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment