This commit is contained in:
曹辉 2022-10-13 17:39:43 +08:00
parent 0b88c70ed5
commit 5320d45a36
6 changed files with 187 additions and 61 deletions

16
api/login/index.js Normal file
View File

@ -0,0 +1,16 @@
import request from "../request.js"
//密码
export function appLoginpwd(account, password) {
return request({
url: `/nurseApp/login/appLogin?account=${account}&password=${password}`,
method: 'POST'
})
}
//验证码
export function appLoginvfn(account, verification) {
return request({
url: `/nurseApp/login/appLogin?account=${account}&verification=${verification}`,
method: 'POST'
})
}

View File

@ -1,9 +1,8 @@
import request from "../request.js"
export function appRegister(data) {
export function appRegister(phone, password) {
return request({
url: `/nurseApp/login/appRegister`,
method: 'POST',
data
url: `/nurseApp/login/appRegister?phone=${phone}&password=${password}`,
method: 'POST'
})
}

View File

@ -17,33 +17,49 @@
"delay" : 0
},
/* */
"modules" : {},
"modules" : {
"Geolocation" : {}
},
/* */
"distribute" : {
/* android */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"
]
},
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {}
"sdkConfigs" : {
"maps" : {
"amap" : {
"appkey_ios" : "",
"appkey_android" : ""
}
},
"geolocation" : {
"system" : {
"__platform__" : [ "ios", "android" ]
}
}
},
"splashscreen" : {
"androidStyle" : "default",
"android" : {
"xxhdpi" : "static/启动页.png",
"hdpi" : "static/启动页.png",
"xhdpi" : "static/启动页.png"
},
"useOriginalMsgbox" : true
}
}
},
/* */

View File

@ -3,7 +3,41 @@
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
// "enablePullDownRefresh": false
}
}, {
"path": "pages/register/register",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}, {
"path": "pages/site/site",
"style": {
"navigationBarTitleText": "附近护理站",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff" //
}
}, {
"path": "pages/homepage/homepage",
"style": {
"navigationBarTitleText": "泉医到家",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff"
}
}, {
"path": "pages/CommodityDetails/CommodityDetails",
"style": {
"navigationBarTitleText": "商品详情",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff"
}
},
{
"path": "pages/detail/detail",
"style": {
@ -11,15 +45,7 @@
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff" //
}
},{
"path": "pages/site/site",
"style": {
"navigationBarTitleText": "附近护理站",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff" //
}
},
{
"path": "pages/homepage/homepage",
"style": {
@ -40,13 +66,6 @@
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff"
}
}, {
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
// "enablePullDownRefresh": false
}
}, {
"path": "pages/shopping/shopping",
"style": {
@ -61,13 +80,6 @@
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff"
}
}, {
"path": "pages/homepage/homepage",
"style": {
"navigationBarTitleText": "泉医到家",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#ffffff"
}
}, {
"path": "pages/startup/startup",
"style": {

View File

@ -4,19 +4,22 @@
账号登录
</view>
<view class="loginphone">
<input class="phone" type="text" placeholder="手机号码" maxlength="11" v-model="userdata.phone" />
<input class="phone" type="text" placeholder="手机号码" maxlength="11" v-model="phone" />
</view>
<view class="logincode loginphone" style="top: 40%;" v-if='switchs'>
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="userdata.password" type="password"
border="true" password-icon="true" />
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="password" type="password"
:border="true" :password-icon="true" />
</view>
<view class="logincode loginphone" style="top: 40%;" v-else>
<input class="code phone" type="text" placeholder="验证码" maxlength="6" />
<input class="code phone" type="text" placeholder="验证码" maxlength="6" v-model="verification" />
<view class="obtaincode get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()">
{{getCodeText}}
</view>
</view>
<view class="loginbtn">
<view class="loginbtn" @tap='pwdlogin' v-if='switchs'>
登录
</view>
<view class="loginbtn" @tap='verificationlogin' v-else>
登录
</view>
<view class="switch" @tap='switchs=!switchs'>
@ -25,16 +28,20 @@
<view class="switch" @tap='goregister' style="left:55%" v-if="switchs">
没有账号,请先注册
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
appLoginpwd,
appLoginvfn
} from '../../api/login/index.js'
export default {
data() {
return {
userdata: {
phone: '13645678913',
password: '123456'
},
phone: '13645678913',
password: '123456',
verification: '111111',
getCodeText: '获取验证码', //
getCodeBtnColor: "#4C7BC9", //color
getCodeisWaiting: false, //
@ -46,6 +53,71 @@
this.switchs = options.switchs
},
methods: {
//
verificationlogin() {
appLoginvfn(this.phone, this.verification).then(res => {
console.log(res)
if (res.code == 200) {
if (res.data.registerFlag == false) {
this.$refs.uToast.show({
title: res.data.message,
type: 'success',
url: '',
duration: '1500'
})
setInterval(() => {
//TODO
uni.switchTab({
url: '/pages/homepage/homepage',
})
}, 1500);
} else {
this.$refs.uToast.show({
title: res.data.message,
type: 'error'
})
}
} else {
console.log(res)
this.$refs.uToast.show({
title: res.msg,
type: 'error'
})
}
})
},
//
pwdlogin() {
appLoginpwd(this.phone, this.password).then(res => {
if (res.code == 200) {
if (res.data.registerFlag == false) {
this.$refs.uToast.show({
title: res.data.message,
type: 'success',
url: '',
duration: '1500'
})
setInterval(() => {
//TODO
uni.switchTab({
url: '/pages/homepage/homepage',
})
}, 1500);
} else {
this.$refs.uToast.show({
title: res.data.message,
type: 'error'
})
}
} else {
console.log(res)
this.$refs.uToast.show({
title: res.msg,
type: 'error'
})
}
})
},
//
goregister() {
uni.navigateTo({
@ -265,7 +337,6 @@
font-weight: 400;
height: 100%;
}
}
.title {

View File

@ -4,11 +4,11 @@
注册账号
</view>
<view class="loginphone">
<input class="phone" type="text" placeholder="手机号码" maxlength="11" v-model="userdata.phone" />
<input class="phone" type="text" placeholder="手机号码" maxlength="11" v-model="phone" />
</view>
<view class="logincode loginphone" style="top: 40%;">
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="userdata.password" type="password"
border="true" password-icon="true" />
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="password" type="password"
:border="true" :password-icon="true" />
</view>
<view class="loginbtn" @tap='register'>
立即注册
@ -16,6 +16,7 @@
<view class="switch" style="left:55%" @tap='gologin'>
已有账号,去登录
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
@ -25,17 +26,28 @@
export default {
data() {
return {
userdata: {
phone: '13645678913',
password: '123456'
}
phone: '13234353453',
password: '123456'
};
},
methods: {
//
register() {
appRegister(this.userdata).then(res => {
appRegister(this.phone, this.password).then(res => {
console.log(res)
if (res.code == 200) {
this.$refs.uToast.show({
title: '注册成功,前往登录',
type: 'success',
url: '/pages/login/login',
duration: '1500'
})
} else {
this.$refs.uToast.show({
title: res.msg,
type: 'error'
})
}
})
},
//