Compare commits

..

No commits in common. "ce148f695bc708ad5622130a4040d260be2fdb37" and "b6a0f47245dc0cd858948de64601d08a1cf6151e" have entirely different histories.

7 changed files with 590 additions and 783 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -37,25 +37,20 @@
<script>
import request from '../../utils/request';
import {
loginApp,
loginApp
} from '@/api/login.js';
import {
setToken,
setTenantId,
removeToken
setTenantId
} from '@/utils/auth.js'
import {
login,
getInfo,
getTenantIdByWebsite
} from '@/api/login.js'
import drawQrcode from "weapp-qrcode";
export default {
data() {
return {
//openId
openId: "",
phoneNumber: "",
baseUrl: this.$baseUrl,
isButtonDisabled: false,
@ -84,65 +79,9 @@ export default {
}
},
},
mounted() {
},
created(){
//token
removeToken()
/*2.微信公众平台自动登录*/
let code = this.getUrlCode('code')
if (code !== null && code !== "") {
//
this.getOpenidAndUserinfo(code)
} else {
uni.showToast({
title: '未获取到授权信息,请重新进入!!',
icon: 'none'
})
}
},
onShow() {
},
mounted() {},
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
@ -210,7 +149,7 @@ export default {
},
goregister() {
uni.navigateTo({
url: '/pages/my/register?openId='+this.openId
url: '/pages/login/register'
})
},
goforgot() {

View File

@ -5,47 +5,58 @@
<view class="formItem">
<view class="formLabel">姓名</view>
<view class="formContainer">
<input placeholder="请填写你的真实姓名" v-model="formData.cusName" type="text"/>
<input placeholder="请填写你的真实姓名" type="text" />
</view>
</view>
<view class="formItem">
<view class="formLabel">性别</view>
<view class="formContainer">
<radio-group name="group1" class="radioGroup" :bindchange="radioChange">
<label class="radio" v-for="(item, index) in radioSexItems" :key="item.value">
<radio activeBackgroundColor="#009EDA" :value="item.value" :checked="item.checked"/>
{{item.name}}
<radio-group class="radioGroup">
<label class="radio">
<radio activeBackgroundColor="#009EDA" value="r1" checked="true" />
</label>
<label class="radio">
<radio activeBackgroundColor="#009EDA" value="r2" />
</label>
</radio-group>
</view>
</view>
<view class="formItem">
<view class="formLabel">身份证号</view>
<view class="formLabel">省份</view>
<view class="formContainer">
<input placeholder="请填写你的身份证号" v-model="formData.idCard" type="text"/>
<picker :range="addressRange" mode="multiSelector" @columnchange="addressColumnChangeFun">
<view class="formPicker">
<input class="formPickerInput" type="text" disabled="true" placeholder="请选择所在省份/城市/区" />
<image class="formPickerBtn" src="../../static/icons/homeInfoMore.png" mode="aspectFit">
</image>
</view>
</view>
<!-- <view class="formItem">-->
<!-- <view class="formLabel">生日</view>-->
<!-- <view class="formContainer">-->
<!-- <picker mode="date" :value="formData.birthday" start="1900-01-01" end="2050-12-12" :bindchange="bindDateChange">-->
<!-- </picker>-->
<!-- </view>-->
<!-- </view>-->
<view class="formItem">
<view class="formLabel">手机号</view>
<view class="formContainer">
<input placeholder="请填写你的手机号" v-model="formData.phoneNumber" type="text"/>
</picker>
</view>
</view>
<view class="formItem">
<view class="formLabel">联系地址</view>
<view class="formLabel">详细地址</view>
<view class="formContainer">
<textarea placeholder="请填写你的联系地址" v-model="formData.address" maxlength="300"/>
<picker :range="detailAddress" mode="multiSelector" @columnchange="detailColumnChangeFun">
<view class="formPicker">
<input class="formPickerInput" type="text" disabled="true" placeholder="请选择所在街道/小区" />
<image class="formPickerBtn" src="../../static/icons/homeInfoMore.png" mode="aspectFit">
</image>
</view>
</picker>
</view>
</view>
<view class="formItem">
<view class="formLabel">上传图片</view>
<view class="formContainer">
<view class="">
<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 class="dl" @click="getlogin()">
<text>注册</text>
</view>
</view>
</view>
@ -53,10 +64,6 @@
<script>
import VNavigationBar from '@/components/VNavigationBar.vue'
import request from "../../utils/request";
import {
setToken,
} from '@/utils/auth.js'
export default {
components: {
@ -64,19 +71,6 @@ export default {
},
data() {
return {
formData: {
openId: "",
cusName: "",
sex: "",
idCard:"",
phoneNumber:"",
address:"",
},
//
radioSexItems: [
{ name: '男', value: '0', checked: true },
{ name: '女', value: '1', checked: false },
],
detailAddress: [
['a', 'b'],
['b', 'a']
@ -88,105 +82,7 @@ export default {
]
};
},
onLoad(e) {
this.formData.openId = e.openId
},
methods: {
/**
* 注册
*/
async getlogin(){
//
if(this.checkForm()){
//
this.formData.sex = this.radioSexItems.filter(item => item.checked ===true)[0].value;
await request({
url: '/base/custom-app/register',
method: 'post',
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
}) {
@ -229,6 +125,7 @@ export default {
}
}
</script>
<style lang="less" scoped>
.container {
height: 100%;
@ -289,17 +186,4 @@ export default {
height: 28rpx;
}
}
.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
config.header = config.header || {}
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);
return new Promise((resolve, reject) => {
uni.request({