新增
This commit is contained in:
parent
0b88c70ed5
commit
5320d45a36
16
api/login/index.js
Normal file
16
api/login/index.js
Normal 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'
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -1,9 +1,8 @@
|
|||||||
import request from "../request.js"
|
import request from "../request.js"
|
||||||
|
|
||||||
export function appRegister(data) {
|
export function appRegister(phone, password) {
|
||||||
return request({
|
return request({
|
||||||
url: `/nurseApp/login/appRegister`,
|
url: `/nurseApp/login/appRegister?phone=${phone}&password=${password}`,
|
||||||
method: 'POST',
|
method: 'POST'
|
||||||
data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,33 +17,49 @@
|
|||||||
"delay" : 0
|
"delay" : 0
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules" : {},
|
"modules" : {
|
||||||
|
"Geolocation" : {}
|
||||||
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
"android" : {
|
"android" : {
|
||||||
"permissions" : [
|
"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-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打包配置 */
|
||||||
"ios" : {},
|
"ios" : {},
|
||||||
/* SDK配置 */
|
/* 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
|
|||||||
58
pages.json
58
pages.json
@ -3,7 +3,41 @@
|
|||||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||||
},
|
},
|
||||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
"pages": [ //pages数组中第一项表示应用启动页,参考:https://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",
|
"path": "pages/detail/detail",
|
||||||
"style": {
|
"style": {
|
||||||
@ -11,15 +45,7 @@
|
|||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationBarBackgroundColor": "#ffffff" //背景颜色
|
"navigationBarBackgroundColor": "#ffffff" //背景颜色
|
||||||
}
|
}
|
||||||
},{
|
|
||||||
"path": "pages/site/site",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "附近护理站",
|
|
||||||
"enablePullDownRefresh": false,
|
|
||||||
"navigationBarBackgroundColor": "#ffffff" //背景颜色
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/homepage/homepage",
|
"path": "pages/homepage/homepage",
|
||||||
"style": {
|
"style": {
|
||||||
@ -40,13 +66,6 @@
|
|||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationBarBackgroundColor": "#ffffff"
|
"navigationBarBackgroundColor": "#ffffff"
|
||||||
}
|
}
|
||||||
}, {
|
|
||||||
"path": "pages/login/login",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "",
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
// "enablePullDownRefresh": false
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/shopping/shopping",
|
"path": "pages/shopping/shopping",
|
||||||
"style": {
|
"style": {
|
||||||
@ -61,13 +80,6 @@
|
|||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationBarBackgroundColor": "#ffffff"
|
"navigationBarBackgroundColor": "#ffffff"
|
||||||
}
|
}
|
||||||
}, {
|
|
||||||
"path": "pages/homepage/homepage",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "泉医到家",
|
|
||||||
"enablePullDownRefresh": false,
|
|
||||||
"navigationBarBackgroundColor": "#ffffff"
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/startup/startup",
|
"path": "pages/startup/startup",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@ -4,19 +4,22 @@
|
|||||||
账号登录
|
账号登录
|
||||||
</view>
|
</view>
|
||||||
<view class="loginphone">
|
<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>
|
||||||
<view class="logincode loginphone" style="top: 40%;" v-if='switchs'>
|
<view class="logincode loginphone" style="top: 40%;" v-if='switchs'>
|
||||||
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="userdata.password" type="password"
|
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="password" type="password"
|
||||||
border="true" password-icon="true" />
|
:border="true" :password-icon="true" />
|
||||||
</view>
|
</view>
|
||||||
<view class="logincode loginphone" style="top: 40%;" v-else>
|
<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()">
|
<view class="obtaincode get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()">
|
||||||
{{getCodeText}}
|
{{getCodeText}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="loginbtn">
|
<view class="loginbtn" @tap='pwdlogin' v-if='switchs'>
|
||||||
|
登录
|
||||||
|
</view>
|
||||||
|
<view class="loginbtn" @tap='verificationlogin' v-else>
|
||||||
登录
|
登录
|
||||||
</view>
|
</view>
|
||||||
<view class="switch" @tap='switchs=!switchs'>
|
<view class="switch" @tap='switchs=!switchs'>
|
||||||
@ -25,16 +28,20 @@
|
|||||||
<view class="switch" @tap='goregister' style="left:55%" v-if="switchs">
|
<view class="switch" @tap='goregister' style="left:55%" v-if="switchs">
|
||||||
没有账号,请先注册
|
没有账号,请先注册
|
||||||
</view>
|
</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
appLoginpwd,
|
||||||
|
appLoginvfn
|
||||||
|
} from '../../api/login/index.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userdata: {
|
phone: '13645678913',
|
||||||
phone: '13645678913',
|
password: '123456',
|
||||||
password: '123456'
|
verification: '111111',
|
||||||
},
|
|
||||||
getCodeText: '获取验证码', //获取验证码的文字
|
getCodeText: '获取验证码', //获取验证码的文字
|
||||||
getCodeBtnColor: "#4C7BC9", //获取验证码的color
|
getCodeBtnColor: "#4C7BC9", //获取验证码的color
|
||||||
getCodeisWaiting: false, //判断是否在倒计时中
|
getCodeisWaiting: false, //判断是否在倒计时中
|
||||||
@ -46,6 +53,71 @@
|
|||||||
this.switchs = options.switchs
|
this.switchs = options.switchs
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
goregister() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -265,7 +337,6 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
|
|||||||
@ -4,11 +4,11 @@
|
|||||||
注册账号
|
注册账号
|
||||||
</view>
|
</view>
|
||||||
<view class="loginphone">
|
<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>
|
||||||
<view class="logincode loginphone" style="top: 40%;">
|
<view class="logincode loginphone" style="top: 40%;">
|
||||||
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="userdata.password" type="password"
|
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="password" type="password"
|
||||||
border="true" password-icon="true" />
|
:border="true" :password-icon="true" />
|
||||||
</view>
|
</view>
|
||||||
<view class="loginbtn" @tap='register'>
|
<view class="loginbtn" @tap='register'>
|
||||||
立即注册
|
立即注册
|
||||||
@ -16,6 +16,7 @@
|
|||||||
<view class="switch" style="left:55%" @tap='gologin'>
|
<view class="switch" style="left:55%" @tap='gologin'>
|
||||||
已有账号,去登录
|
已有账号,去登录
|
||||||
</view>
|
</view>
|
||||||
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -25,17 +26,28 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userdata: {
|
phone: '13234353453',
|
||||||
phone: '13645678913',
|
password: '123456'
|
||||||
password: '123456'
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//注册功能
|
//注册功能
|
||||||
register() {
|
register() {
|
||||||
appRegister(this.userdata).then(res => {
|
appRegister(this.phone, this.password).then(res => {
|
||||||
console.log(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'
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//跳转登录页
|
//跳转登录页
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user