登录对接

This commit is contained in:
仲么了
2023-07-03 09:16:54 +08:00
parent e9b1e9a417
commit 5f67499e57
19 changed files with 358 additions and 181 deletions

View File

@@ -5,7 +5,7 @@
<view class="detail-header">
<Cn-htmlToImg domId="header" @renderFinish="renderFinish">
<view class="header" ref="header" @click="previewImg">
<img src="https://cdn.xiaoriri.com/md-imgs/test2.png"
<img src="http://ruuf2hujc.bkt.clouddn.com/%E7%94%B5%E8%B7%AF%E5%9B%BE.svg"
style="width: 100%;height:475rpx;object-fit:cover" />
<view class="point" :style="{ left: '480rpx', top: '80rpx' }">负载THDI(%)
<view class="grid-card mt10">

View File

@@ -4,7 +4,7 @@
<view class='detail'>
<view class="detail-header">
<view class="header">
<image src="https://cdn.xiaoriri.com/md-imgs/test2.png" mode="widthFix" style="width: 100%;" />
<image src="http://ruuf2hujc.bkt.clouddn.com/%E7%94%B5%E8%B7%AF%E5%9B%BE.svg" mode="widthFix" style="width: 100%;" />
</view>
<!-- <view class="des">
<text>设备基础信息</text>

View File

@@ -122,9 +122,9 @@ export default {
project: '',
},
projectRange: [
{ value: 1, text: "监测", point: 1 },
{ value: 2, text: "治理", point: 2 },
{ value: 3, text: "用能", point: 1 },
{ value: 1, text: "项目1", point: 1 },
{ value: 2, text: "项目2", point: 2 },
{ value: 3, text: "项目3", point: 1 },
],
// typeRange: [
// { value: 1, text: "POS-882AX", point: 1 },

View File

@@ -85,7 +85,7 @@ export default {
if (res.code = 'A0000') {
this.$util.toast(res.message)
setTimeout(() => {
// uni.redirectTo({ url: '/pages/message/feedback' })
uni.redirectTo({ url: '/pages/message/feedback' })
}, 1000);
} else {
this.$util.toast(res.message)

View File

@@ -152,7 +152,7 @@ export default {
projectListFilter() {
return this.projectList.filter((item) => {
if (this.select.engineeringName) {
return item.engineeringName === this.select.engineeringName
return item.engineeringName === this.select.engineeringName || item.value == -1
} else {
return true
}
@@ -227,9 +227,7 @@ export default {
url: '/pages/device/APF/detail',
})
},
init() {
},
init() {},
},
mounted() {
this.userInfo = uni.getStorageSync('userInfo')

View File

@@ -195,7 +195,7 @@ export default {
},
getProjectList() {
getProjectList({
currentPage: 1,
pageNum: 1,
pageSize: 9999,
}).then((res) => {
console.log(res)
@@ -208,6 +208,7 @@ export default {
return {
text: item.name,
value: item.id,
...item,
}
}),
]

View File

@@ -59,8 +59,10 @@
:key="key"
/> -->
<uni-file-picker
ref="filePicker"
v-model="topologyDiagramPage"
:sourceType="['album']"
:auto-upload="false"
@select="addAppTopologyDiagram"
@delete="deleteTopologyDiagramPage"
></uni-file-picker>
@@ -119,6 +121,30 @@ export default {
e.tempFiles[0].path
).then((res) => {
console.log(res)
if (res.length > 1) {
const result = JSON.parse(res[1].data)
console.log(result)
if (result.code === 'A0000') {
this.topologyDiagramPage.push({
name: result.name,
extname: 'img',
url: result.filePath,
...result,
})
} else {
this.$refs.filePicker.clearFiles(this.topologyDiagramPage.length - 1)
uni.showToast({
title: result.message,
icon: 'none',
})
}
} else {
uni.showToast({
title: '上传失败',
icon: 'none',
})
this.$refs.filePicker.clearFiles(this.topologyDiagramPage.length - 1)
}
})
},
deleteTopologyDiagramPage(e) {

View File

@@ -176,6 +176,7 @@ export default {
let data = JSON.parse(JSON.stringify(this.formData))
delete data.files
addAppProject(data, arr).then((res) => {
console.warn(res);
if (res.length === 1) {
this.$util.toast(res[0].message)

View File

@@ -9,7 +9,7 @@
<image class="login-box-logo" mode="widthFix" src="/static/logo.png"></image>
<template v-if="loginType == 'yzm'">
<view class="login-box-input mt100">
<input class="login-box-input-main" v-model="yzmForm.phone" placeholder="请输入手机号" />
<input class="login-box-input-main" maxlength="11" v-model="yzmForm.phone" placeholder="请输入手机号" />
</view>
<!-- <view class="login-box-input mt40">
<input class="login-box-input-main" v-model="yzmForm.imgCode" placeholder="图形验证码" />
@@ -17,8 +17,12 @@
</view> -->
<view class="login-box-input mt40">
<input class="login-box-input-main" v-model="yzmForm.code" placeholder="手机验证码" />
<view class="ml40" style="font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
<view
class="ml40"
style="font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0"
>{{ waitTime + 's后重新获取' }}</view
>
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
</view>
</template>
@@ -39,13 +43,13 @@
<view class="login-box-footer">
<view @click="loginType = 'pwd'" v-if="loginType == 'yzm'">账号密码登录</view>
<view @click="loginType = 'yzm'" v-else>短信验证码登录</view>
<view style="flex:1"></view>
<view style="flex: 1"></view>
<navigator url="/pages/user/forget" hover-class="none">忘记密码</navigator>
<view style="margin:0 10px;color:#999">|</view>
<view style="margin: 0 10px; color: #999">|</view>
<navigator url="/pages/user/register" hover-class="none">快速注册</navigator>
</view>
<view class="login-box-tips">
<view style="color:#999">点击登录即表示同意</view>
<view style="color: #999">点击登录即表示同意</view>
<navigator url="/pages/mine/agreement" hover-class="none">用户协议</navigator>
<navigator url="/pages/mine/policy" hover-class="none">个人信息保护政策</navigator>
</view>
@@ -55,9 +59,9 @@
</Cn-page>
</template>
<script>
import { apiGetYms, apiLogin } from '@/common/api/user'
import { apiGetYms, apiLogin, apiYsmLogin } from '@/common/api/user'
export default {
data () {
data() {
return {
loading: false,
loginType: 'pwd',
@@ -74,46 +78,47 @@ export default {
waitTime: 0,
tenantId: '',
companyName: '',
}
},
components: {},
methods: {
getCode () {
getCode() {
if (!this.yzmForm.phone) {
return this.$util.toast('请输入手机号!')
}
uni.showLoading({
title: '请稍等'
title: '请稍等',
})
apiGetYms({
phone: this.yzmForm.phone,
type: 0,
}).then(res => {
uni.hideLoading()
console.log(res);
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
}).catch(err => {
uni.hideLoading()
console.log(err);
})
.then((res) => {
uni.hideLoading()
console.log(res)
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
})
.catch((err) => {
uni.hideLoading()
console.log(err)
})
},
login () {
console.log(this.loginType);
login() {
console.log(this.loginType)
if (this.loginType == 'pwd') {
this.pwdLogin()
} else {
this.yzmLogin()
}
},
pwdLogin () {
pwdLogin() {
if (!this.pwdForm.phone && !this.pwdForm.pwd) {
return this.$util.toast('请填写登录信息!')
}
@@ -121,24 +126,23 @@ export default {
phone: this.pwdForm.phone,
key: this.pwdForm.pwd,
type: 1,
}).then(res => {
console.log(res);
}).then((res) => {
console.log(res)
uni.setStorageSync('userInfo', res.data)
uni.reLaunch({
url: '/pages/index/index',
})
})
},
yzmLogin () {
yzmLogin() {
if (!this.yzmForm.phone && !this.yzmForm.code) {
return this.$util.toast('请填写登录信息!')
}
apiLogin({
apiYsmLogin({
phone: this.yzmForm.phone,
key: this.yzmForm.code,
type: 0,
}).then(res => {
console.log(res);
smsCode: this.yzmForm.code,
}).then((res) => {
console.log(res)
uni.setStorageSync('userInfo', res.data)
uni.reLaunch({
url: '/pages/index/index',
@@ -146,11 +150,10 @@ export default {
})
},
},
onLoad (o) {
},
onLoad(o) {},
}
</script>
<style lang='scss'>
<style lang="scss">
.login {
.login-title {
padding-left: 64rpx;
@@ -252,4 +255,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -5,21 +5,24 @@
<template v-if="step == 1">
<uni-forms ref="form" :rules="rules" :modelValue="formData">
<uni-forms-item name="phone">
<uni-easyinput type="number" v-model="formData.phone" placeholder="请输入手机号" />
<uni-easyinput type="number" v-model="formData.phone" maxlength="11" placeholder="请输入手机号" />
</uni-forms-item>
<uni-forms-item name="code">
<view class="login-box-input">
<uni-easyinput type="number" v-model="formData.code" placeholder="请输入验证码" />
<view class="ml40"
style="margin-left:40rpx;font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
<view
class="ml40"
style="margin-left: 40rpx; font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0"
>{{ waitTime + 's后重新获取' }}
</view>
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
</view>
</uni-forms-item>
</uni-forms>
<button type="default" class="submit-btn" @click="firstSubmit">下一步</button>
<view class="login-box-tips">
<view style="color:#999">点击提交即表示同意</view>
<view style="color: #999">点击提交即表示同意</view>
<navigator url="/pages/mine/agreement" hover-class="none">用户协议</navigator>
<navigator url="/pages/mine/policy" hover-class="none">个人信息保护政策</navigator>
</view>
@@ -35,7 +38,7 @@
</uni-forms>
<button type="default" class="submit-btn" @click="secondSubmit">提交</button>
<view class="login-box-tips">
<view style="color:#999">说明密码长度为6-18</view>
<view style="color: #999">说明密码长度为6-18</view>
</view>
</template>
</view>
@@ -43,10 +46,11 @@
</Cn-page>
</template>
<script>
import { apiRegister, apiGetYms, apiSetPsd } from '@/common/api/user'
import { apiRegister, apiGetYms, apiSetPsd, autoLogin } from '@/common/api/user'
export default {
name: "jiaban",
data () {
name: 'jiaban',
data() {
return {
step: 1,
loading: false,
@@ -56,89 +60,94 @@ export default {
phone: '',
code: '',
password: '',
password2: ''
password2: '',
},
rules: {
phone: {
rules: [
{
required: true,
errorMessage: "请填写手机号"
}
]
errorMessage: '请填写手机号',
},
],
},
code: {
rules: [
{
required: true,
errorMessage: "请填写验证码"
}
]
errorMessage: '请填写验证码',
},
],
},
password: {
rules: [
{
required: true,
errorMessage: "请填写新密码"
}
]
errorMessage: '请填写新密码',
},
],
},
password2: {
rules: [
{
required: true,
errorMessage: "请填写确认密码"
}
]
}
}
};
},
onLoad () {
errorMessage: '请填写确认密码',
},
],
},
},
}
},
onLoad() {},
methods: {
getCode () {
getCode() {
if (!this.formData.phone) {
return this.$util.toast('请输入手机号!')
}
uni.showLoading({
title: '请稍等'
title: '请稍等',
})
apiGetYms({
phone: this.formData.phone,
type: 1,
}).then(res => {
uni.hideLoading()
console.log(res);
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
}).catch(err => {
uni.hideLoading()
console.log(err);
})
.then((res) => {
uni.hideLoading()
console.log(res)
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
})
.catch((err) => {
uni.hideLoading()
console.log(err)
})
},
firstSubmit () {
firstSubmit() {
this.$refs.form.validate().then((valid, errors) => {
apiRegister({
phone: this.formData.phone,
code: this.formData.code
}).then(res => {
console.log(res);
code: this.formData.code,
}).then((res) => {
console.log(res)
this.$util.toast(res.msg)
uni.setStorageSync('userInfo', res.data)
this.step = 2
// this.step = 2
// 直接登录
autoLogin(this.formData.phone).then((res) => {
this.loginSuccess(res.data)
})
})
})
},
secondSubmit () {
secondSubmit() {
this.$refs.form.validate().then((valid, errors) => {
console.log(this.formData.password.length);
console.log(this.formData.password.length)
if (this.formData.password.length < 6 || this.formData.password.length > 18) {
return this.$util.toast('密码长度为6-18位')
} else if (this.formData.password != this.formData.password2) {
@@ -147,18 +156,18 @@ export default {
apiSetPsd({
phone: this.formData.phone,
password: this.formData.password,
}).then(res => {
console.log(res);
}).then((res) => {
console.log(res)
this.$util.toast(res.msg)
uni.setStorageSync('userInfo', res.data)
uni.reLaunch({
url: '/pages/user/login'
url: '/pages/user/login',
})
})
})
}
}
};
},
},
}
</script>
<style lang="scss">
.index {