Compare commits

...

2 Commits

Author SHA1 Message Date
Vinjor
ce148f695b Merge branch 'master' of http://122.51.230.86:3000/sunliwei/lanan-repair
# Conflicts:
#	config.js
2024-09-24 18:35:30 +08:00
Vinjor
ed71f35fcb 微信公众号自动登录 2024-09-24 18:32:59 +08:00
7 changed files with 783 additions and 590 deletions

View File

@ -18,6 +18,14 @@ export function login(username, password, code, uuid) {
}) })
} }
// 微信登录
export function wechatLogin(data) {
return request({
'url': '/weChat/wechatLogin',
'method': 'post',
'data':data
})
}
// 获取用户详细信息 // 获取用户详细信息
export function getInfo() { export function getInfo() {
return request({ return request({

View File

@ -1,9 +1,7 @@
// 应用全局配置 // 应用全局配置
module.exports = { module.exports = {
//baseUrl: 'https://www.nuoyunr.com/admin-api', //baseUrl: 'https://www.nuoyunr.com/admin-api',
// baseUrl: 'http://192.168.1.4:48080', baseUrl: 'https://3w823u8516.vicp.fun',
// baseUrl: 'http://localhost:48080',
baseUrl: 'http://192.168.1.4:48080',
imagesUrl: 'http://shequ.0315e.com/static/images/pages/', imagesUrl: 'http://shequ.0315e.com/static/images/pages/',
baseImageUrl: 'https://www.nuoyunr.com/minio', baseImageUrl: 'https://www.nuoyunr.com/minio',
//wsUrl: 'wss://www.nuoyunr.com/admin-api', //wsUrl: 'wss://www.nuoyunr.com/admin-api',

View File

@ -69,5 +69,15 @@
"uniStatistics" : { "uniStatistics" : {
"enable" : false "enable" : false
}, },
"h5" : {
"router" : {
"base" : "/lanan-repair"
},
"devServer" : {
"port" : 8080,
"disableHostCheck" : true,
"https" : false
}
},
"vueVersion" : "2" "vueVersion" : "2"
} }

View File

@ -6,12 +6,12 @@
// "navigationBarTitleText": "uni-app" // "navigationBarTitleText": "uni-app"
// } // }
// }, // },
// { {
// "path": "pages/login/login", "path": "pages/login/login",
// "style": { "style": {
// "navigationBarTitleText": "uni-app" "navigationBarTitleText": "uni-app"
// } }
// }, },
{ {
"path" : "pages/home/home", "path" : "pages/home/home",
"style" : "style" :

View File

@ -1,449 +1,510 @@
<template> <template>
<view class="content"> <view class="content">
<view class="top"> <view class="top">
<view class="touxiang"> <view class="touxiang">
<image src="../../static/xinlogo.png" mode=""></image> <image src="../../static/xinlogo.png" mode=""></image>
</view> </view>
<view class="inputs"> <view class="inputs">
<input type="text" v-model="userName" placeholder="请输入用户名"> <input type="text" v-model="userName" placeholder="请输入用户名">
</view> </view>
<view class="inputs"> <view class="inputs">
<input type="password" v-model="wrod" placeholder="请输入密码"> <input type="password" v-model="wrod" placeholder="请输入密码">
</view> </view>
<view class="wjworb" @click="goforgot()"> <view class="wjworb" @click="goforgot()">
<view class="">忘记密码</view> <view class="">忘记密码</view>
</view> </view>
</view> </view>
<view class="dl" @click="getlogin()"> <view class="dl" @click="getlogin()">
<text> </text> <text> </text>
</view> </view>
<!-- <view class="hging"> <!-- <view class="hging">
<text>没有账号</text> <text>没有账号</text>
<text style="color: #0078FF;" @click="goregister()">立即注册</text> <text style="color: #0078FF;" @click="goregister()">立即注册</text>
</view> --> </view> -->
<view class="dbottom"> <view class="dbottom">
<view class="quanzi" v-if="qindex == false " @click="qindex =! qindex"></view> <view class="quanzi" v-if="qindex == false " @click="qindex =! qindex"></view>
<view class="lanquanzi" v-if="qindex == true" @click="qindex =! qindex"> <view class="lanquanzi" v-if="qindex == true" @click="qindex =! qindex">
<uni-icons type="checkmarkempty" color="#ffffff" size="14"></uni-icons> <uni-icons type="checkmarkempty" color="#ffffff" size="14"></uni-icons>
</view> </view>
<text>请仔细阅读</text> <text>请仔细阅读</text>
<text class="lan">用户协议</text> <text class="lan">用户协议</text>
<text></text> <text></text>
<text class="lan">隐私政策</text> <text class="lan">隐私政策</text>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import request from '../../utils/request'; import request from '../../utils/request';
import { import {
loginApp loginApp,
} from '@/api/login.js'; } from '@/api/login.js';
import { import {
setToken, setToken,
setTenantId setTenantId,
} from '@/utils/auth.js' removeToken
import { } from '@/utils/auth.js'
login, import {
getInfo, login,
getTenantIdByWebsite getInfo,
} from '@/api/login.js' getTenantIdByWebsite
export default { } from '@/api/login.js'
data() { import drawQrcode from "weapp-qrcode";
return {
phoneNumber: "",
baseUrl: this.$baseUrl,
isButtonDisabled: false,
countdownTime: 60,
qindex: false,
sfindex: 'user',
userName: '',
yzm: '',
wrod: '',
activeid: 0,
tenantCode: 'lanan'
}
},
computed: {
groupChange(n) {
console.log('groupChange', n);
},
radioChange(n) {
console.log('radioChange', n);
},
buttonText() {
if (this.isButtonDisabled) {
return `${this.countdownTime}s 后重新发送`;
} else {
return "获取验证码";
}
},
},
mounted() {},
methods: {
setidentity(text) { export default {
this.sfindex = text data() {
return {
//openId
openId: "",
phoneNumber: "",
baseUrl: this.$baseUrl,
isButtonDisabled: false,
countdownTime: 60,
qindex: false,
sfindex: 'user',
userName: '',
yzm: '',
wrod: '',
activeid: 0,
tenantCode: 'lanan'
}
},
computed: {
groupChange(n) {
console.log('groupChange', n);
},
radioChange(n) {
console.log('radioChange', n);
},
buttonText() {
if (this.isButtonDisabled) {
return `${this.countdownTime}s 后重新发送`;
} else {
return "获取验证码";
}
},
},
mounted() {
},
created(){
//token
removeToken()
/*2.微信公众平台自动登录*/
let code = this.getUrlCode('code')
if (code !== null && code !== "") {
//
this.getOpenidAndUserinfo(code)
} else {
uni.showToast({
title: '未获取到授权信息,请重新进入!!',
icon: 'none'
})
}
},
onShow() {
}, },
//
getlogin() {
if (this.qindex != true) {
uni.showToast({
icon: "none",
title: "请阅读并勾选用户协议",
duration: 2000
})
return;
}
if (this.userName == '') {
uni.showToast({
title: '输入框不能为空!',
icon: 'none'
})
return
}
uni.setStorageSync('identity', this.sfindex); methods: {
/**
* 微信自动登录
* @param {Object} code 用户code
*/
async getOpenidAndUserinfo(code) {
await request({
url: '/userClient/weChat/wechatLogin',
method: 'get',
params: {code:code}
}).then((res) => {
if (res.code==200) {
if(res.data.hasOwnProperty("accessToken")){
setToken(res.data.accessToken)
uni.reLaunch({
url: '/pages/home/home'
})
}else{
//
this.openId = res.data
//
this.goregister()
}
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
/**
* 获取路径中的参数
* @param {Object} name
*/
getUrlCode(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) || null
},
setidentity(text) {
this.sfindex = text
const loginFun = () => { },
const data = { //
username: this.userName, getlogin() {
password: this.wrod, if (this.qindex != true) {
type: 0 uni.showToast({
} icon: "none",
loginApp(data).then(res => { title: "请阅读并勾选用户协议",
if (res.data.needMobile === "1") { duration: 2000
uni.navigateTo({ })
url: '/pages/login/bindPhoe' return;
}) }
uni.setStorageSync('validaCodeToken', res.data.accessToken) if (this.userName == '') {
} else { uni.showToast({
setToken(res.data.accessToken) title: '输入框不能为空!',
uni.reLaunch({ icon: 'none'
url: '/pages/home/home' })
}) return
} }
})
}
getTenantIdByWebsite(this.tenantCode).then(res => { uni.setStorageSync('identity', this.sfindex);
if (res.code === 200 && res.data && res.data.length > 0) {
uni.showActionSheet({
itemList: res.data.map(m => m.name),
success: ({
tapIndex
}) => {
setTenantId(res.data[tapIndex].id)
loginFun()
}
})
} else {
setTenantId('')
loginFun()
}
})
},
getxz(index) {
this.activeid = index
},
goregister() {
uni.navigateTo({
url: '/pages/login/register'
})
},
goforgot() {
uni.navigateTo({
url: '/pages/login/forgot'
})
},
goselect() {
console.log('执行去救援', this.sfindex);
// pages/rescue/trafficPolice
if (this.sfindex == 'police') {
uni.reLaunch({
url: '/pages/rescue/trafficPolice'
})
} else {
uni.reLaunch({
url: '/pages/rescue/rescue'
})
}
}, const loginFun = () => {
// const data = {
sendVerificationCode() { username: this.userName,
let reg = /^((13[0-9])|(14[0-9])|(15[0-9])|(17[0-9])|(18[0-9]))\d{8}$/; password: this.wrod,
if (!reg.test(this.userName)) { type: 0
uni.showToast({ }
icon: 'none', loginApp(data).then(res => {
title: '请输入正确的11位手机号' if (res.data.needMobile === "1") {
}) uni.navigateTo({
this.userName = ''; url: '/pages/login/bindPhoe'
return false; })
} uni.setStorageSync('validaCodeToken', res.data.accessToken)
if (this.isButtonDisabled) { } else {
return; // setToken(res.data.accessToken)
} uni.reLaunch({
const data = { url: '/pages/home/home'
phone: this.userName, })
} }
request({ })
url: '/loginSmsCode', }
method: 'post',
params: data getTenantIdByWebsite(this.tenantCode).then(res => {
}).then((res) => { if (res.code === 200 && res.data && res.data.length > 0) {
console.log('验证码', res); uni.showActionSheet({
if (res.code == 200) { itemList: res.data.map(m => m.name),
uni.showToast({ success: ({
title: '验证码已发送 请注意查收', tapIndex
icon: 'none' }) => {
}) setTenantId(res.data[tapIndex].id)
} else { loginFun()
uni.showToast({ }
title: '网络不佳请稍后再试', })
icon: 'none' } else {
}) setTenantId('')
} loginFun()
}) }
})
},
getxz(index) {
this.activeid = index
},
goregister() {
uni.navigateTo({
url: '/pages/my/register?openId='+this.openId
})
},
goforgot() {
uni.navigateTo({
url: '/pages/login/forgot'
})
},
goselect() {
console.log('执行去救援', this.sfindex);
// pages/rescue/trafficPolice
if (this.sfindex == 'police') {
uni.reLaunch({
url: '/pages/rescue/trafficPolice'
})
} else {
uni.reLaunch({
url: '/pages/rescue/rescue'
})
}
},
//
sendVerificationCode() {
let reg = /^((13[0-9])|(14[0-9])|(15[0-9])|(17[0-9])|(18[0-9]))\d{8}$/;
if (!reg.test(this.userName)) {
uni.showToast({
icon: 'none',
title: '请输入正确的11位手机号'
})
this.userName = '';
return false;
}
if (this.isButtonDisabled) {
return; //
}
const data = {
phone: this.userName,
}
request({
url: '/loginSmsCode',
method: 'post',
params: data
}).then((res) => {
console.log('验证码', res);
if (res.code == 200) {
uni.showToast({
title: '验证码已发送 请注意查收',
icon: 'none'
})
} else {
uni.showToast({
title: '网络不佳请稍后再试',
icon: 'none'
})
}
})
this.disableButton(); // this.disableButton(); //
this.startCountdown(); // this.startCountdown(); //
}, },
disableButton() { disableButton() {
this.isButtonDisabled = true; this.isButtonDisabled = true;
}, },
enableButton() { enableButton() {
this.isButtonDisabled = false; this.isButtonDisabled = false;
}, },
startCountdown() { startCountdown() {
let countdown = setInterval(() => { let countdown = setInterval(() => {
this.countdownTime--; this.countdownTime--;
if (this.countdownTime === 0) { if (this.countdownTime === 0) {
clearInterval(countdown); clearInterval(countdown);
this.enableButton(); // this.enableButton(); //
} }
}, 1000); }, 1000);
}, },
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.jsq { .jsq {
border: none !important; border: none !important;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
color: #0078FF; color: #0078FF;
} }
button { button {
border: none !important; border: none !important;
background: none !important; background: none !important;
margin: 0px; margin: 0px;
display: block; display: block;
} }
button:focus { button:focus {
color: #0078FF; color: #0078FF;
outline: none; outline: none;
box-shadow: none; box-shadow: none;
} }
.content { .content {
box-sizing: border-box; box-sizing: border-box;
} }
.top { .top {
box-sizing: border-box; box-sizing: border-box;
padding: 0px 27px; padding: 0px 27px;
padding-top: 100px; padding-top: 100px;
background-image: url('../../static/loginbj.png'); background-image: url('../../static/loginbj.png');
// background-color:lightseagreen; // background-color:lightseagreen;
// background-image: url('../../static/loginbj.png'); // background-image: url('../../static/loginbj.png');
background-size: cover; background-size: cover;
background-position: center; background-position: center;
width: 100%; width: 100%;
// height: 385px; // height: 385px;
} }
.touxiang { .touxiang {
width: 88px; width: 88px;
height: 88px; height: 88px;
border-radius: 10px; border-radius: 10px;
background: #D7D7D7; background: #D7D7D7;
margin: 0 auto; margin: 0 auto;
margin-bottom: 40px; margin-bottom: 40px;
overflow: hidden; overflow: hidden;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.twotap { .twotap {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
view { view {
font-size: 15px; font-size: 15px;
font-family: Microsoft YaHei; font-family: Microsoft YaHei;
font-weight: 400; font-weight: 400;
color: #666666; color: #666666;
margin-right: 38.5px; margin-right: 38.5px;
} }
} }
.blck { .blck {
color: #333333 !important; color: #333333 !important;
font-weight: bold !important; font-weight: bold !important;
} }
.inputs { .inputs {
box-sizing: border-box; box-sizing: border-box;
padding: 16px 0px; padding: 16px 0px;
display: flex; display: flex;
align-items: center; align-items: center;
border-bottom: 2px solid #E8E8E8; border-bottom: 2px solid #E8E8E8;
margin-top: 20px; margin-top: 20px;
} }
.wjworb { .wjworb {
margin-top: 5px; margin-top: 5px;
width: 100%; width: 100%;
display: flex; display: flex;
font-size: 12px; font-size: 12px;
color: #0078FF; color: #0078FF;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
} }
.dl { .dl {
width: 90%; width: 90%;
height: 44px; height: 44px;
background: linear-gradient(-46deg, #0853C4 0%, #4282D8 80%); background: linear-gradient(-46deg, #0853C4 0%, #4282D8 80%);
border-radius: 5px; border-radius: 5px;
margin: 0 auto; margin: 0 auto;
font-size: 16px; font-size: 16px;
color: #FFFFFF; color: #FFFFFF;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 22px; margin-top: 22px;
} }
.hging { .hging {
width: 100%; width: 100%;
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
color: #636363; color: #636363;
margin-top: 20px; margin-top: 20px;
} }
.wx { .wx {
width: 38px; width: 38px;
height: 38px; height: 38px;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
margin: 0px auto; margin: 0px auto;
margin-top: 20px; margin-top: 20px;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.hui { .hui {
font-size: 10px; font-size: 10px;
width: 100%; width: 100%;
text-align: center; text-align: center;
font-weight: 400; font-weight: 400;
color: #666666; color: #666666;
} }
.dbottom { .dbottom {
width: 100%; width: 100%;
text-align: center; text-align: center;
font-size: 12px; font-size: 12px;
color: #333333; color: #333333;
margin-top: 40px; margin-top: 40px;
position: fixed; position: fixed;
bottom: 25px; bottom: 25px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.quanzi { .quanzi {
width: 14px; width: 14px;
height: 14px; height: 14px;
border: 1px solid #666666; border: 1px solid #666666;
border-radius: 50%; border-radius: 50%;
margin-right: 10px; margin-right: 10px;
} }
.lanquanzi { .lanquanzi {
width: 14px; width: 14px;
height: 14px; height: 14px;
border: 1px solid #0078FF; border: 1px solid #0078FF;
border-radius: 50%; border-radius: 50%;
margin-right: 10px; margin-right: 10px;
background: #0078FF; background: #0078FF;
color: white; color: white;
} }
.lan { .lan {
color: #0078FF; color: #0078FF;
} }
.jiuzhong { .jiuzhong {
width: 90%; width: 90%;
margin: 10px auto; margin: 10px auto;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.dist { .dist {
display: flex; display: flex;
align-items: center; align-items: center;
margin: 0px 10px; margin: 0px 10px;
} }
.d-zi { .d-zi {
font-size: 14px; font-size: 14px;
} }
.d-qian { .d-qian {
width: 14px; width: 14px;
height: 14px; height: 14px;
margin-right: 5px; margin-right: 5px;
overflow: hidden; overflow: hidden;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border: 1px solid #666666; border: 1px solid #666666;
color: white; color: white;
} }
.d-qian-lan { .d-qian-lan {
width: 14px; width: 14px;
height: 14px; height: 14px;
margin-right: 5px; margin-right: 5px;
overflow: hidden; overflow: hidden;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: #0078FF; background: #0078FF;
border: 1px solid #0078FF; border: 1px solid #0078FF;
color: white; color: white;
} }
</style> </style>

View File

@ -1,189 +1,305 @@
<template> <template>
<view class="container"> <view class="container">
<VNavigationBar title-color="#333" background-color="#fff" title="信息填写"></VNavigationBar> <VNavigationBar title-color="#333" background-color="#fff" title="信息填写"></VNavigationBar>
<view class="body"> <view class="body">
<view class="formItem"> <view class="formItem">
<view class="formLabel">姓名</view> <view class="formLabel">姓名</view>
<view class="formContainer"> <view class="formContainer">
<input placeholder="请填写你的真实姓名" type="text" /> <input placeholder="请填写你的真实姓名" v-model="formData.cusName" type="text"/>
</view> </view>
</view> </view>
<view class="formItem"> <view class="formItem">
<view class="formLabel">性别</view> <view class="formLabel">性别</view>
<view class="formContainer"> <view class="formContainer">
<radio-group class="radioGroup"> <radio-group name="group1" class="radioGroup" :bindchange="radioChange">
<label class="radio"> <label class="radio" v-for="(item, index) in radioSexItems" :key="item.value">
<radio activeBackgroundColor="#009EDA" value="r1" checked="true" /> <radio activeBackgroundColor="#009EDA" :value="item.value" :checked="item.checked"/>
</label> {{item.name}}
<label class="radio"> </label>
<radio activeBackgroundColor="#009EDA" value="r2" /> </radio-group>
</label> </view>
</radio-group> </view>
</view> <view class="formItem">
</view> <view class="formLabel">身份证号</view>
<view class="formItem"> <view class="formContainer">
<view class="formLabel">省份</view> <input placeholder="请填写你的身份证号" v-model="formData.idCard" type="text"/>
<view class="formContainer"> </view>
<picker :range="addressRange" mode="multiSelector" @columnchange="addressColumnChangeFun"> </view>
<view class="formPicker"> <!-- <view class="formItem">-->
<input class="formPickerInput" type="text" disabled="true" placeholder="请选择所在省份/城市/区" /> <!-- <view class="formLabel">生日</view>-->
<image class="formPickerBtn" src="../../static/icons/homeInfoMore.png" mode="aspectFit"> <!-- <view class="formContainer">-->
</image> <!-- <picker mode="date" :value="formData.birthday" start="1900-01-01" end="2050-12-12" :bindchange="bindDateChange">-->
</view> <!-- </picker>-->
</picker> <!-- </view>-->
</view> <!-- </view>-->
</view> <view class="formItem">
<view class="formItem"> <view class="formLabel">手机号</view>
<view class="formLabel">详细地址</view> <view class="formContainer">
<view class="formContainer"> <input placeholder="请填写你的手机号" v-model="formData.phoneNumber" type="text"/>
<picker :range="detailAddress" mode="multiSelector" @columnchange="detailColumnChangeFun"> </view>
<view class="formPicker"> </view>
<input class="formPickerInput" type="text" disabled="true" placeholder="请选择所在街道/小区" /> <view class="formItem">
<image class="formPickerBtn" src="../../static/icons/homeInfoMore.png" mode="aspectFit"> <view class="formLabel">联系地址</view>
</image> <view class="formContainer">
</view> <textarea placeholder="请填写你的联系地址" v-model="formData.address" maxlength="300"/>
</picker> </view>
</view> </view>
</view> <view class="dl" @click="getlogin()">
<view class="formItem"> <text>注册</text>
<view class="formLabel">上传图片</view> </view>
<view class="formContainer"> </view>
<view class=""> </view>
<uni-file-picker :image-styles="{width: 80, height: 80}" v-model="imageValue"
fileMediatype="image" limit="1" mode="grid" @select="select" @progress="progress"
@success="success" @fail="fail">
<image style="width: 160rpx;height: 160rpx;" src="../../static/icons/addImageIcon.png"
mode="aspectFit"></image>
</uni-file-picker>
</view>
</view>
</view>
</view>
</view>
</template> </template>
<script> <script>
import VNavigationBar from '@/components/VNavigationBar.vue' import VNavigationBar from '@/components/VNavigationBar.vue'
import request from "../../utils/request";
import {
setToken,
} from '@/utils/auth.js'
export default { export default {
components: { components: {
VNavigationBar VNavigationBar
}, },
data() { data() {
return { return {
detailAddress: [ formData: {
['a', 'b'], openId: "",
['b', 'a'] cusName: "",
], sex: "",
addressRange: [ idCard:"",
['山东'], phoneNumber:"",
['济南'], address:"",
['历下区'] },
] //
}; radioSexItems: [
}, { name: '男', value: '0', checked: true },
methods: { { name: '女', value: '1', checked: false },
detailColumnChangeFun({ ],
detail detailAddress: [
}) { ['a', 'b'],
if (detail.column === 0) { ['b', 'a']
// ],
this.$set(this.detailAddress, 1, ['m', 'n']) addressRange: [
} ['山东'],
}, ['济南'],
addressColumnChangeFun({ ['历下区']
detail ]
}) { };
if (detail.column === 0) { },
// onLoad(e) {
this.$set(this.detailAddress, 1, ['济宁']) this.formData.openId = e.openId
// },
this.$set(this.detailAddress, 2, ['任城']) methods: {
} else if (detail.column === 1) { /**
// * 注册
this.$set(this.detailAddress, 2, ['任城']) */
} async getlogin(){
}, //
// if(this.checkForm()){
select(e) { //
console.log('选择文件:', e) this.formData.sex = this.radioSexItems.filter(item => item.checked ===true)[0].value;
}, await request({
// url: '/base/custom-app/register',
progress(e) { method: 'post',
console.log('上传进度:', e) data: this.formData
}, }).then((res) => {
if (res.code==200) {
if(res.data.hasOwnProperty("accessToken")){
setToken(res.data.accessToken)
uni.reLaunch({
url: '/pages/home/home'
})
}
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
}
},
checkForm(){
if(""==this.formData.cusName){
uni.showToast({
title: '请填写姓名',
icon: 'none'
})
return false
}
if(""==this.formData.idCard || !this.isValidID(this.formData.idCard)){
uni.showToast({
title: '请填写正确的身份证号',
icon: 'none'
})
return false
}
if(""==this.formData.phoneNumber || !this.isValidPhoneNumber(this.formData.phoneNumber)){
uni.showToast({
title: '请填写手机号',
icon: 'none'
})
return false
}
if(""==this.formData.address){
uni.showToast({
title: '请填写联系地址',
icon: 'none'
})
return false
}
return true;
},
/**
* 校验身份证号是否合法
* @param id
* @returns {boolean}
*/
isValidID(id) {
const regex = /^[1-9]\d{5}(18|19|20|21|22)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|[Xx])$/;
return regex.test(id);
},
/**
* 校验手机号
* @param phoneNumber
* @returns {boolean}
*/
isValidPhoneNumber(phoneNumber) {
const regex = /^1[3-9]\d{9}$/;
return regex.test(phoneNumber);
},
bindDateChange(e) {
this.formData.birthday = e.detail.value;
},
radioChange: function(e) {
let radioItems = this.radioSexItems;
for (let i = 0, len = radioItems.length; i < len; ++i) {
radioItems[i].checked = radioItems[i].value === e.detail.value;
}
this.radioSexItems = radioItems;
},
submit() {
this.$refs.form.validate().then(res => {
console.log('表单数据信息:', res);
}).catch(err => {
console.log('表单错误信息:', err);
})
},
detailColumnChangeFun({
detail
}) {
if (detail.column === 0) {
//
this.$set(this.detailAddress, 1, ['m', 'n'])
}
},
addressColumnChangeFun({
detail
}) {
if (detail.column === 0) {
//
this.$set(this.detailAddress, 1, ['济宁'])
//
this.$set(this.detailAddress, 2, ['任城'])
} else if (detail.column === 1) {
//
this.$set(this.detailAddress, 2, ['任城'])
}
},
//
select(e) {
console.log('选择文件:', e)
},
//
progress(e) {
console.log('上传进度:', e)
},
// //
success(e) { success(e) {
console.log('上传成功') console.log('上传成功')
}, },
// //
fail(e) { fail(e) {
console.log('上传失败:', e) console.log('上传失败:', e)
} }
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.container { .container {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.body { .body {
flex: 1; flex: 1;
height: 0; height: 0;
overflow: auto; overflow: auto;
padding: 20rpx 0; padding: 20rpx 0;
} }
.formItem { .formItem {
padding: 40rpx 0; padding: 40rpx 0;
margin: 0 32rpx; margin: 0 32rpx;
border-bottom: 1rpx solid #EEEEEE; border-bottom: 1rpx solid #EEEEEE;
} }
.formLabel { .formLabel {
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
.radioGroup { .radioGroup {
display: flex; display: flex;
align-items: center; align-items: center;
column-gap: 100rpx; column-gap: 100rpx;
} }
.radio { .radio {
display: flex; display: flex;
align-items: center; align-items: center;
column-gap: 20rpx; column-gap: 20rpx;
} }
/* #ifdef MP-WEIXIN */ /* #ifdef MP-WEIXIN */
radio { radio {
filter: hue-rotate(90deg); filter: hue-rotate(90deg);
} }
/* #endif */ /* #endif */
.formPicker { .formPicker {
display: flex; display: flex;
align-items: center; align-items: center;
column-gap: 20rpx; column-gap: 20rpx;
} }
.formPickerInput { .formPickerInput {
flex: 1; flex: 1;
width: 0; width: 0;
} }
.formPickerBtn { .formPickerBtn {
width: 28rpx; width: 28rpx;
height: 28rpx; height: 28rpx;
} }
} }
</style> .dl {
width: 90%;
height: 44px;
background: linear-gradient(-46deg, #0853C4 0%, #4282D8 80%);
border-radius: 5px;
margin: 0 auto;
font-size: 16px;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
margin-top: 22px;
}
</style>

View File

@ -26,9 +26,9 @@ const request = config => {
const isTanantId = (config.headers || {}).isTanantId === false const isTanantId = (config.headers || {}).isTanantId === false
config.header = config.header || {} config.header = config.header || {}
if(getTenantId() && !isTanantId){ if(getTenantId() && !isTanantId){
config.header['Tenant-Id'] = getTenantId() config.header['tenant-id'] = getTenantId()
} }
config.header['Tenant-Id'] = 180 config.header['tenant-id'] = 180
console.log(config.header,424242); console.log(config.header,424242);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
@ -41,7 +41,7 @@ console.log(config.header,424242);
}).then(response => { }).then(response => {
// debugger // debugger
let res = response let res = response
const code = res.data.code || 200 const code = res.data.code || 200
const msg = errorCode[code] || res.data.msg || errorCode['default'] const msg = errorCode[code] || res.data.msg || errorCode['default']
if (code === 401) { if (code === 401) {