登录对接
This commit is contained in:
@@ -41,7 +41,7 @@ export function queryFeedBackPage(params) {
|
||||
url: '/feedback/queryFeedBackPage',
|
||||
method: 'post',
|
||||
data: {
|
||||
currentPage: 1,
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
status: '',
|
||||
type: '',
|
||||
|
||||
@@ -31,7 +31,7 @@ export function queryTopologyDiagramPage(params) {
|
||||
method: 'post',
|
||||
data: Object.assign(
|
||||
{
|
||||
currentPage: 1,
|
||||
pageNum: 1,
|
||||
pageSize: 999,
|
||||
projectId: '',
|
||||
searchValue: '',
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import request from '../js/request'
|
||||
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
* @param {*} params.type 0:登录 1:注册 3:忘记密码 4:更换手机号第二步获取验证码 5:更换手机号第一步获取验证码
|
||||
* @returns
|
||||
*/
|
||||
export function apiGetYms (params) {
|
||||
export function apiGetYms(params) {
|
||||
return request({
|
||||
url: '/shiningCloud/user/authCode',
|
||||
url: '/user-boot/appUser/authCode',
|
||||
data: {
|
||||
phone: params.phone,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
type: params.type
|
||||
type: params.type,
|
||||
},
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,17 +22,35 @@ export function apiGetYms (params) {
|
||||
* @param {*} params.type 0:ysm 1:pwd
|
||||
* @returns
|
||||
*/
|
||||
export function apiLogin (params) {
|
||||
console.log(uni.getStorageSync('cidAES'));
|
||||
export function apiLogin(params) {
|
||||
console.log(uni.getStorageSync('cidAES'))
|
||||
return request({
|
||||
url: '/shiningCloud/user/login',
|
||||
data: {
|
||||
phone: params.phone,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
key: params.key.trim(),
|
||||
type: params.type
|
||||
type: params.type,
|
||||
},
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码登录
|
||||
* @param {*} params.type 0:ysm 1:pwd
|
||||
* @returns
|
||||
*/
|
||||
export function apiYsmLogin(params) {
|
||||
uni.setStorageSync('token', 'Basic bmpjbmFwcDpuamNucHFz')
|
||||
return request({
|
||||
url: '/pas-auth/oauth/token',
|
||||
data: {
|
||||
grant_type: 'sms_code',
|
||||
phone: params.phone,
|
||||
smsCode: params.smsCode.trim(),
|
||||
},
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -42,29 +59,47 @@ export function apiLogin (params) {
|
||||
* @param {*} params
|
||||
* @returns
|
||||
*/
|
||||
export function apiRegister (params) {
|
||||
export function apiRegister(params) {
|
||||
return request({
|
||||
url: '/shiningCloud/user/register',
|
||||
url: '/user-boot/appUser/register',
|
||||
data: {
|
||||
phone: params.phone,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
code: params.code.trim(),
|
||||
},
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* app用户注册完自动登录
|
||||
* @param params
|
||||
* @returns {*}
|
||||
*/
|
||||
export function autoLogin(phone) {
|
||||
return request({
|
||||
url: '/user-boot/appUser/autoLogin',
|
||||
data: {
|
||||
phone: phone,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
},
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
// 第一次登录设置密码
|
||||
export function apiSetPsd (params) {
|
||||
export function apiSetPsd(params) {
|
||||
return request({
|
||||
url: '/shiningCloud/user/setPsd',
|
||||
data: {
|
||||
userId: uni.getStorageSync('userInfo').userId,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
password: params.password.trim()
|
||||
password: params.password.trim(),
|
||||
},
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
// 重置密码
|
||||
export function apiReSetPsd(params) {
|
||||
return request({
|
||||
@@ -73,34 +108,35 @@ export function apiReSetPsd(params) {
|
||||
phone: params.phone,
|
||||
code: params.code.trim(),
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
password: params.password.trim()
|
||||
password: params.password.trim(),
|
||||
},
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
// 更换手机号第一步
|
||||
export function apiComfirmCode (params) {
|
||||
export function apiComfirmCode(params) {
|
||||
return request({
|
||||
url: '/shiningCloud/user/comfirmCode',
|
||||
data: {
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
phone: params.phone,
|
||||
code: params.code.trim()
|
||||
code: params.code.trim(),
|
||||
},
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
// 重新绑定手机号
|
||||
export function apiRebindPhone (params) {
|
||||
export function apiRebindPhone(params) {
|
||||
return request({
|
||||
url: '/shiningCloud/user/rebindPhone',
|
||||
data: {
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
userId: uni.getStorageSync('userInfo').userId,
|
||||
phoneNew: params.phone,
|
||||
code: params.code.trim()
|
||||
code: params.code.trim(),
|
||||
},
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
@@ -27,14 +27,14 @@ export default {
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
params: {
|
||||
currentPage: 1,
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
},
|
||||
reload() {
|
||||
this.data = [];
|
||||
this.status = 'loading';
|
||||
this.empty = false;
|
||||
this.params.currentPage = 1;
|
||||
this.params.pageNum = 1;
|
||||
this.next();
|
||||
},
|
||||
callBack: null,
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
console.warn(res);
|
||||
let resultData =
|
||||
res.data?.list || res.data?.records || [];
|
||||
if (this.params.currentPage == 1) {
|
||||
if (this.params.pageNum == 1) {
|
||||
this.data = resultData;
|
||||
if (resultData.length == 0 || resultData == 0) {
|
||||
this.empty = true;
|
||||
@@ -68,11 +68,11 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.params.currentPage == 1) {
|
||||
if (this.params.pageNum == 1) {
|
||||
this.firstCallBack && this.firstCallBack();
|
||||
}
|
||||
this.loadedCallback && this.loadedCallback();
|
||||
this.params.currentPage++;
|
||||
this.params.pageNum++;
|
||||
this.total = res.total;
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
@@ -1,68 +1,62 @@
|
||||
import config from './config';
|
||||
let arr = [];
|
||||
import config from './config'
|
||||
|
||||
let arr = []
|
||||
export default (options = {}) => {
|
||||
if (options.data == undefined) {
|
||||
options.data = {};
|
||||
options.data = {}
|
||||
}
|
||||
// 防止接口重复点击
|
||||
if (arr.indexOf(options.url) === -1) {
|
||||
arr.push(options.url);
|
||||
arr.push(options.url)
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
reject({
|
||||
code: -1,
|
||||
msg: '请勿重复提交',
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.request({
|
||||
url:
|
||||
options.url.indexOf('http') === -1
|
||||
? config.domain + options.url
|
||||
: options.url,
|
||||
url: options.url.indexOf('http') === -1 ? config.domain + options.url : options.url,
|
||||
data: {
|
||||
...options.data,
|
||||
userId: uni.getStorageSync('userInfo').id,
|
||||
},
|
||||
header: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8',
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
Authorization: '12',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Authorization: uni.getStorageSync('token'),
|
||||
...options.header,
|
||||
},
|
||||
method: options.method || 'GET',
|
||||
success: async (res) => {
|
||||
console.log(res);
|
||||
console.log(res)
|
||||
if (arr.indexOf(options.url) > -1) {
|
||||
arr.splice(arr.indexOf(options.url), 1);
|
||||
arr.splice(arr.indexOf(options.url), 1)
|
||||
}
|
||||
if (
|
||||
res.data.resultCode !== 10000 &&
|
||||
res.data.code !== 'A0000'
|
||||
) {
|
||||
errHandler(res.data);
|
||||
reject(res.data);
|
||||
if (res.data.resultCode !== 10000 && res.data.code !== 'A0000') {
|
||||
errHandler(res.data)
|
||||
reject(res.data)
|
||||
} else {
|
||||
reslove(res.data);
|
||||
reslove(res.data)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
if (arr.indexOf(options.url) > -1) {
|
||||
arr.splice(arr.indexOf(options.url), 1);
|
||||
arr.splice(arr.indexOf(options.url), 1)
|
||||
}
|
||||
reject(err);
|
||||
reject(err)
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '网络异常,请稍后再试',
|
||||
});
|
||||
})
|
||||
uni.reLaunch({
|
||||
url: '/pages/user/login',
|
||||
});
|
||||
})
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误处理
|
||||
@@ -72,17 +66,17 @@ function errHandler(res) {
|
||||
switch (res.resultCode) {
|
||||
case '401':
|
||||
// #ifdef MP
|
||||
uni.removeStorageSync('Cookie');
|
||||
uni.clearStorageSync();
|
||||
uni.removeStorageSync('Cookie')
|
||||
uni.clearStorageSync()
|
||||
// #endif
|
||||
uni.reLaunch({ url: '/pages/user/login' });
|
||||
break;
|
||||
uni.reLaunch({ url: '/pages/user/login' })
|
||||
break
|
||||
default:
|
||||
uni.showToast({
|
||||
title: res.msg || '服务端未知错误',
|
||||
title: res.message || res.msg || '服务端未知错误',
|
||||
duration: 2000,
|
||||
icon: 'none',
|
||||
});
|
||||
break;
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +197,14 @@ const prePage = () => {
|
||||
return prePage
|
||||
}
|
||||
|
||||
const loginSuccess = (data) => {
|
||||
uni.setStorageSync('userInfo', data)
|
||||
uni.setStorageSync('token', data.token_type + ' ' + data.access_token)
|
||||
uni.reLaunch({
|
||||
url: '/pages/user/login',
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
validatePhoneNumber,
|
||||
toast,
|
||||
@@ -206,4 +214,5 @@ export default {
|
||||
getUserLocation,
|
||||
loadConfig,
|
||||
prePage,
|
||||
loginSuccess,
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name" : "灿能物联",
|
||||
"appid" : "__UNI__88BC25B",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.1",
|
||||
"versionCode" : "100",
|
||||
"versionName" : "1.0.2",
|
||||
"versionCode" : 101,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
@@ -132,7 +132,7 @@
|
||||
"/api" : {
|
||||
"https" : true,
|
||||
// "target" : "https://china.indpecker.com",
|
||||
"target" : "http://192.168.1.115:10210",
|
||||
"target" : "http://192.168.1.115:10215",
|
||||
"changOrigin" : true,
|
||||
"pathRewrite" : {
|
||||
"/api" : ""
|
||||
|
||||
@@ -3,5 +3,9 @@
|
||||
"html2canvas": "^1.4.1",
|
||||
"mqtt": "3.0.0",
|
||||
"pinyin-pro": "^3.13.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/html5plus": "^1.0.2",
|
||||
"@types/uni-app": "^1.4.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}),
|
||||
]
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,24 +78,24 @@ 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 => {
|
||||
})
|
||||
.then((res) => {
|
||||
uni.hideLoading()
|
||||
console.log(res);
|
||||
console.log(res)
|
||||
this.waitTime = 60
|
||||
this.inter = setInterval(() => {
|
||||
if (this.waitTime == 0) {
|
||||
@@ -100,20 +104,21 @@ export default {
|
||||
this.waitTime--
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(err => {
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading()
|
||||
console.log(err);
|
||||
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;
|
||||
|
||||
@@ -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,60 +60,60 @@ 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: "请填写确认密码"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
errorMessage: '请填写确认密码',
|
||||
},
|
||||
onLoad () {
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
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 => {
|
||||
})
|
||||
.then((res) => {
|
||||
uni.hideLoading()
|
||||
console.log(res);
|
||||
console.log(res)
|
||||
this.waitTime = 60
|
||||
this.inter = setInterval(() => {
|
||||
if (this.waitTime == 0) {
|
||||
@@ -118,27 +122,32 @@ export default {
|
||||
this.waitTime--
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(err => {
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading()
|
||||
console.log(err);
|
||||
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 {
|
||||
|
||||
96
pnpm-lock.yaml
generated
96
pnpm-lock.yaml
generated
@@ -1,6 +1,8 @@
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@types/html5plus': ^1.0.2
|
||||
'@types/uni-app': ^1.4.4
|
||||
html2canvas: ^1.4.1
|
||||
mqtt: 3.0.0
|
||||
pinyin-pro: ^3.13.2
|
||||
@@ -10,8 +12,57 @@ dependencies:
|
||||
mqtt: 3.0.0
|
||||
pinyin-pro: 3.13.2
|
||||
|
||||
devDependencies:
|
||||
'@types/html5plus': 1.0.2
|
||||
'@types/uni-app': 1.4.4
|
||||
|
||||
packages:
|
||||
|
||||
/@babel/helper-string-parser/7.22.5:
|
||||
resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dev: true
|
||||
|
||||
/@babel/helper-validator-identifier/7.22.5:
|
||||
resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dev: true
|
||||
|
||||
/@babel/parser/7.22.5:
|
||||
resolution: {integrity: sha512-DFZMC9LJUG9PLOclRC32G63UXwzqS2koQC8dkx+PLdmt1xSePYpbT/NbsrJy8Q/muXz7o/h/d4A7Fuyixm559Q==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@babel/types': 7.22.5
|
||||
dev: true
|
||||
|
||||
/@babel/types/7.22.5:
|
||||
resolution: {integrity: sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dependencies:
|
||||
'@babel/helper-string-parser': 7.22.5
|
||||
'@babel/helper-validator-identifier': 7.22.5
|
||||
to-fast-properties: 2.0.0
|
||||
dev: true
|
||||
|
||||
/@types/html5plus/1.0.2:
|
||||
resolution: {integrity: sha512-OklP5lrmLq8/6TUOLgWc0LndUVvAiTWX5dnyoCFhIUtFW9opWsnCtG/UxPgeuC28Rv2XNbFfft/hEEI39P/4Ag==}
|
||||
dev: true
|
||||
|
||||
/@types/uni-app/1.4.4:
|
||||
resolution: {integrity: sha512-ZTXnrCTblZyoLIoKbTv1Whz1nxrTcM7vg0qGXzDpXP8m9MqdjKt48N3FffQT1IsJWNkxbvJ1Eg5UHDaq+k+oBQ==}
|
||||
dependencies:
|
||||
vue: 2.7.14
|
||||
dev: true
|
||||
|
||||
/@vue/compiler-sfc/2.7.14:
|
||||
resolution: {integrity: sha512-aNmNHyLPsw+sVvlQFQ2/8sjNuLtK54TC6cuKnVzAY93ks4ZBrvwQSnkkIh7bsbNhum5hJBS00wSDipQ937f5DA==}
|
||||
dependencies:
|
||||
'@babel/parser': 7.22.5
|
||||
postcss: 8.4.24
|
||||
source-map: 0.6.1
|
||||
dev: true
|
||||
|
||||
/async-limiter/1.0.1:
|
||||
resolution: {integrity: sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==}
|
||||
dev: false
|
||||
@@ -93,6 +144,10 @@ packages:
|
||||
utrie: 1.0.2
|
||||
dev: false
|
||||
|
||||
/csstype/3.1.2:
|
||||
resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==}
|
||||
dev: true
|
||||
|
||||
/d/1.0.1:
|
||||
resolution: {integrity: sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==}
|
||||
dependencies:
|
||||
@@ -379,6 +434,12 @@ packages:
|
||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||
dev: false
|
||||
|
||||
/nanoid/3.3.6:
|
||||
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/next-tick/1.1.0:
|
||||
resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==}
|
||||
dev: false
|
||||
@@ -404,10 +465,23 @@ packages:
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/picocolors/1.0.0:
|
||||
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
|
||||
dev: true
|
||||
|
||||
/pinyin-pro/3.13.2:
|
||||
resolution: {integrity: sha512-DKz04M0PkrongGyJW7GU+iNB2jInwLcP1p5+w0gu0hz2PtF8q+GTC1GDW731wyhm+q7PGoyMuY3sLONLTqi6mg==}
|
||||
dev: false
|
||||
|
||||
/postcss/8.4.24:
|
||||
resolution: {integrity: sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
dependencies:
|
||||
nanoid: 3.3.6
|
||||
picocolors: 1.0.0
|
||||
source-map-js: 1.0.2
|
||||
dev: true
|
||||
|
||||
/process-nextick-args/2.0.1:
|
||||
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
|
||||
dev: false
|
||||
@@ -471,6 +545,16 @@ packages:
|
||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
||||
dev: false
|
||||
|
||||
/source-map-js/1.0.2:
|
||||
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/source-map/0.6.1:
|
||||
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/split2/3.2.2:
|
||||
resolution: {integrity: sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==}
|
||||
dependencies:
|
||||
@@ -521,6 +605,11 @@ packages:
|
||||
is-negated-glob: 1.0.0
|
||||
dev: false
|
||||
|
||||
/to-fast-properties/2.0.0:
|
||||
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/type/1.2.0:
|
||||
resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==}
|
||||
dev: false
|
||||
@@ -559,6 +648,13 @@ packages:
|
||||
base64-arraybuffer: 1.0.2
|
||||
dev: false
|
||||
|
||||
/vue/2.7.14:
|
||||
resolution: {integrity: sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==}
|
||||
dependencies:
|
||||
'@vue/compiler-sfc': 2.7.14
|
||||
csstype: 3.1.2
|
||||
dev: true
|
||||
|
||||
/websocket-stream/5.5.2:
|
||||
resolution: {integrity: sha512-8z49MKIHbGk3C4HtuHWDtYX8mYej1wWabjthC/RupM9ngeukU4IWoM46dgth1UOS/T4/IqgEdCDJuMe2039OQQ==}
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user