提交 8e6f7af1 作者: wk

访客问题修复

父级 6dc46842
......@@ -141,7 +141,7 @@
/* box-shadow: 0 0 5px #999; */
display: flex;
align-items: center;
padding: 5rpx 0;
padding: 10rpx 0;
color: #999999;
background-color: #FFFFFF;
}
......
......@@ -483,18 +483,44 @@
"navigationStyle": "custom"
}
}, {
"path": "pages/monitor/zhgdMonitor/zhgdMonitor",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/monitor/labourMonitor/labourMonitor",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/gallery/outPage/outPage",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/user/login/login",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/monitor/zhgdMonitor/zhgdMonitor",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/monitor/labourMonitor/labourMonitor",
"path" : "pages/user/accountLogin/accountLogin",
"style" :
{
"navigationBarTitleText": "",
......@@ -503,7 +529,7 @@
}
,{
"path" : "pages/gallery/outPage/outPage",
"path" : "pages/user/phoneLogin/phoneLogin",
"style" :
{
"navigationBarTitleText": "",
......
......@@ -19,7 +19,7 @@
<view class="item">
<view class="title-content" @click="toNeedDo">
<view class="title">我的待办</view>
<image src="../../static/willdo.png" class="image"></image>
<image src="../../static/to-do-list-ic.png" class="image"></image>
</view>
<view class="count">{{needDoCount}}</view>
</view>
......@@ -95,9 +95,6 @@
const info = uni.getSystemInfoSync()
this.statusBarHeight = info.statusBarHeight
this.role = getApp().globalData.userInfo.identity.code
if (this.role == 'WORKER') {
this.orgName = uni.getStorageSync("org_name")
}
this.getAppGroup()
},
onShow() {
......@@ -122,6 +119,10 @@
})
},
getOrgTree() {
var companyId = uni.getStorageSync("company_id")
if (companyId == 0) {
return
}
Api.getOrgTree({
data: {
company_id: uni.getStorageSync("company_id"),
......@@ -132,6 +133,9 @@
if (result.code == 0) {
this.trees = result.data.list[0].children_list
this.orgName = uni.getStorageSync("org_name") || result.data.list[0].name
if (this.role == 'VISITOR') {
this.orgName = "您还未【加入项目】,请前往【我的】加入"
}
}
}, (err) => {
this.$toast.showToast(err.msg)
......@@ -207,7 +211,7 @@
let data = {
project_id: uni.getStorageSync("project_id") || "",
account: currentModel.user_name,
password:currentModel.user_pw,
password: currentModel.user_pw,
url: url
}
console.log(JSON.stringify(data));
......@@ -425,7 +429,7 @@
.name {
font-weight: 500;
width: 408rpx;
width: 520rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
......
......@@ -175,7 +175,7 @@
.count {
font-weight: 600;
font-size: 40rpx;
margin-top: 30rpx;
// margin-top: 30rpx;
margin-left: 50rpx;
text-align: left;
color: #333;
......
......@@ -12,7 +12,7 @@
</view>
<view class="line"></view>
<view class="login-info-content">
<view class="login-info">{{nameLengthDeal(userInfo.user.user_name||"")||"您好"}},欢迎登录{{nowTime}}
<view class="login-info">{{nameLengthDeal(userInfo.user.user_name||"")||"您好"}},欢迎登录 {{nowTime}}
</view>
<view class="address-content">
<image src="../../static/loc.png" class="loc-image"></image>
......@@ -44,7 +44,7 @@
<view :class="isCommonSel?'tab-line-sel':'tab-line'"></view>
</view>
<view class="tab-item" @click="select(1)">
<view :class="isRecentlySel?'tab-text-sel':'tab-text'">访问业务</view>
<view :class="isRecentlySel?'tab-text-sel':'tab-text'">访问业务</view>
<view :class="isRecentlySel?'tab-line-sel':'tab-line'"></view>
</view>
<image src="../../static/ic-setting.png" class="image" @click="toSetting"></image>
......@@ -62,12 +62,12 @@
</uni-grid-item>
</uni-grid>
<!-- 无组织默认 -->
<view class="def-content" v-if="!isOrg">
<view class="def-content" v-if="role=='VISITOR'">
<image src="../../static/def-avatar.png" class="image"></image>
<view class="text-content">
<text class="text">当前身份为访客,可点击</text>
<text class="text-blue">【我的】</text>
<text class="text-blue">【加入组织】</text>
<text class="text-blue" @click="toJoinOrg">【我的】</text>
<text class="text-blue" @click="toJoinOrg">【加入组织】</text>
<text class="text"> 等待审批通过后进入组织</text>
</view>
......@@ -131,18 +131,16 @@
data() {
return {
title: '欢迎您访问一点通',
banners: [],
banners: [{
"coverImg": "../../static/banner-authority.png"
}],
statusBarHeight: 20,
isCommonSel: true,
isRecentlySel: false,
appList: [{}],
shopList: [{}, {}, {}],
isOrg: true,
news: [{
title: "关于食堂发放免费午餐的人员名单关于食堂发放免费午餐的人员名单"
}, {
title: "新闻头条"
}],
news: [],
scoreDetail: {},
city: "杭州市",
address: "浙江省杭州市",
......@@ -185,6 +183,11 @@
},
methods: {
toJoinOrg() {
uni.navigateTo({
url: "/pages/login/joinOrg/joinOrg"
})
},
dealImage(url) {
var newPath = ""
if (url) {
......@@ -252,8 +255,8 @@
uni.setStorageSync("org_name", this.project.project_name)
uni.setStorageSync("org_id", this.project.id)
uni.setStorageSync("project_id", this.project.project_id)
this.initData()
}
this.initData()
}
}, (err) => {
this.$toast.showToast(err.msg)
......@@ -562,13 +565,10 @@
uni.setStorageSync("org_no", this.userInfo.user.org_no)
uni.setStorageSync("org_name", this.userInfo.currentProject.projectName)
this.city = this.userInfo.currentProject.city
this.getWeather()
this.getAuthMenu()
}
if (this.role != 'VISITOR') {
this.getNews()
this.getBanners()
}
this.getNews()
this.getBanners()
this.getAuthMenu()
},
getAuthMenu() {
Api.getAuthMenu({
......
......@@ -33,7 +33,7 @@
methods: {
toLogin() {
uni.navigateTo({
url: "/pages/login/login/login"
url: "/pages/user/login/login"
})
},
toCancel() {
......
<template>
<view style="display: flex;flex-direction: column;">
<titleBar title="创建部门"></titleBar>
<view class="content">
<text class="text-black-normal">项目部名称</text>
<input placeholder="请输入名称" v-model="name"
style="border: 1rpx solid #E5E5E5;margin-left: 32rpx;padding: 20rpx;"
placeholder-class="placeholderStyle" />
<view class="item-content">
<view class="title">项目部名称</view>
<input placeholder="请输入名称" v-model="name" class="input-content" placeholder-class="placeholderStyle" />
</view>
<view style="height: 144rpx;"></view>
<view class="uni-group-button">
<button class="uni-grey-button" @click="toCancel">取消</button>
<button class="uni-blue-button" @click="toSure">确定</button>
<view class="uni-grey-button" @click="toCancel">取消</view>
<view class="uni-blue-button" @click="toSure">确定</view>
</view>
</view>
</template>
......@@ -43,8 +41,7 @@
"invite_code": this.code,
"dept_name": this.name
},
}).then((res) => {
let result = res.data
}).then((result) => {
if (result.code == 0) {
uni.$emit("refreshDepart")
uni.navigateBack({
......@@ -59,12 +56,35 @@
}
</script>
<style>
.content {
<style lang="scss">
.item-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
height: 800rpx;
flex-direction: column;
margin: 30rpx;
padding: 30rpx;
border-radius: 30rpx;
background-color: #fff;
.title {
font-weight: 400;
font-size: 28rpx;
color: #333;
}
.input-content {
width: 610rpx;
margin-top: 20rpx;
padding-left: 20rpx;
height: 36px;
border-radius: 16rpx;
background: transparent;
border: 2rpx solid #999;
}
.placeholderStyle {
font-weight: 400;
font-size: 28rpx;
color: #999;
}
}
</style>
<template>
<view class="join-root">
<view class="join-item">
<text class="text-black-normal">加入部门</text>
<picker @change="departChange" range-key="dept_name" :range="departList">
<view
style="border: 1rpx solid #E5E5E5;width: 680rpx;display: flex;flex-direction: row;justify-content: space-between;margin-top: 32rpx;height: 88rpx;align-items: center;">
<text class="text-black-normal" style="margin-left: 32rpx;">{{selectDepart.dept_name}}</text>
<image src="../../static/icon_drop_arrow.png"
style="width: 48rpx;height: 24rpx;margin-right: 32rpx;"></image>
<titleBar title="加入组织"></titleBar>
<view class="item-content">
<view class="title">加入部门</view>
<picker @change="departChange" range-key="dept_name" :range="departList" class="picker">
<view class="sel-content">
{{selectDepart.dept_name||""}}
</view>
</picker>
<view
style="display: flex;flex-direction: row;align-self:flex-end;color: #1890FF;font-size: 14px;margin-top: 10px;"
@click="createProject">
创建项目部</view>
<text class="text-black-normal" style="margin-top: 32rpx;">加入岗位</text>
<picker @change="postChange" range-key="job_name" :range="postList">
<view
style="border: 1rpx solid #E5E5E5;width: 680rpx;display: flex;flex-direction: row;justify-content: space-between;margin-top: 32rpx;height: 96rpx;align-items: center;">
<text class="text-black-normal" style="margin-left: 32rpx;">{{selectPost.job_name}}</text>
<image src="../../static/icon_drop_arrow.png"
style="width: 48rpx;height: 24rpx;margin-right: 32rpx;"></image>
</view>
<view class="item-content">
<view class="title">加入岗位</view>
<picker @change="postChange" range-key="job_name" :range="postList" class="picker">
<view class="sel-content">
{{selectPost.job_name||""}}
</view>
</picker>
</view>
<view style="height: 144rpx;"></view>
<view class="uni-group-button">
<button class="uni-grey-button" @click="toBefore">上一步</button>
<button class="uni-blue-button" @click="toSubmit">提交</button>
<view class="uni-grey-button" @click="toBefore">上一步</view>
<view class="uni-blue-button" @click="toSubmit">提交</view>
</view>
</view>
</template>
......@@ -65,7 +62,7 @@
methods: {
createProject() {
uni.navigateTo({
url: `../create-project/create-project?code=${this.code}`
url: `/pages/login/createProject/createProject?code=${this.code}`
})
},
toBefore() {
......@@ -91,8 +88,7 @@
}
Api.scanToJoin({
data: data
}).then((res) => {
let result = res.data
}).then((result) => {
if (result.code == 0) {
this.$toast.showToast("申请已提交")
uni.navigateBack({
......@@ -125,8 +121,7 @@
data: {
"invite_code": this.code
}
}).then((res) => {
let result = res.data
}).then((result) => {
console.log("部门列表", result);
if (result.code == 0) {
this.departList = result.data.list
......@@ -163,8 +158,7 @@
"dept_id": this.selectDepart.dept_id,
"is_page": 0
},
}).then((res) => {
let result = res.data
}).then((result) => {
console.log("岗位列表", result);
if (result.code == 0) {
this.postList = result.data.list
......@@ -179,7 +173,7 @@
}
</script>
<style>
<style lang="scss">
.join-root {
display: flex;
flex-direction: column;
......@@ -191,4 +185,40 @@
flex-direction: column;
padding: 32rpx;
}
.item-content {
display: flex;
flex-direction: column;
margin: 30rpx 30rpx 0 30rpx;
padding: 30rpx;
border-radius: 30rpx;
background-color: #fff;
.title {
font-weight: 400;
font-size: 28rpx;
color: #333;
}
.picker {
.sel-content {
width: 610rpx;
height: 36px;
margin-top: 20rpx;
padding-left: 20rpx;
border-radius: 16rpx;
align-items: center;
display: flex;
flex-direction: row;
background: transparent;
border: 2rpx solid #999;
text {
font-size: 28rpx;
color: #333;
}
}
}
}
</style>
......@@ -55,6 +55,37 @@
}
})
},
getDepartment() {
Api.getDeptByCode({
data: {
"invite_code": this.code
}
}).then((result) => {
console.log("部门列表", result);
if (result.code == 0) {
uni.navigateTo({
url: `/pages/login/joinDepartment/joinDepartment?code=${this.code}`
})
} else {
this.$toast.showToast(result.msg)
}
}, (err) => {
if (err.code == 90003) {
uni.showModal({
title: '提示',
content: err.msg,
showCancel: true,
confirmText: "知道了",
confirmColor: '#1890FF',
showCancel: false,
success: res => {}
})
} else {
this.$toast.showToast(err.msg)
}
})
},
scanToJoin() {
let data = {
invite_code: this.code,
......@@ -86,9 +117,7 @@
this.$toast.showToast("请输入邀请码")
return
}
uni.navigateTo({
url: `../join-department/join-department?code=${this.code}`
})
this.getDepartment()
},
toJoin: function() {
let that = this
......
......@@ -63,7 +63,7 @@
},
onLoad: function(params) {
this.unique_token = params.unique_token
this.type = params.type
// this.type = params.type
},
methods: {
checkAccount(account) {
......@@ -128,11 +128,11 @@
let result = res.data
if (result.code == 0) {
this.$toast.showToast("注册成功!")
if (this.type == "bind") {
this.bindLogin(data.account, data.password)
} else {
this.login(data.account, data.password)
}
// if (this.type == "bind") {
// this.bindLogin(data.account, data.password)
// } else {
this.login(data.account, data.password)
// }
} else {
this.$toast.showToast(result.msg)
}
......@@ -240,15 +240,15 @@
})
},
toLogin: function() {
if (this.type == "bind") {
uni.redirectTo({
url: "/pages/login/bindLogin/bindLogin?unique_token=" + his.unique_token
})
} else {
uni.navigateBack({
delta: 1
})
}
// if (this.type == "bind") {
// uni.redirectTo({
// url: "/pages/login/bindLogin/bindLogin?unique_token=" + his.unique_token
// })
// } else {
uni.navigateBack({
delta: 1
})
// }
},
getCode: function() {
let that = this
......@@ -326,7 +326,7 @@
.form-submit {
height: 96rpx;
border: 1rpx solid #E5E5E5;
border-radius: 10rpx;
border-radius: 48rpx;
font-size: 32rpx;
color: #FFFFFF;
background-color: #3B73FE;
......
......@@ -15,7 +15,7 @@
<view v-if="tree.isOpen" style="margin-top: 20rpx;">
<view class="org-item" v-for="(oneLevel,oneIndex) in tree.children_list" :key="oneIndex">
<view class="org">
<image v-if="!oneLevel.project_id"
<image v-if="!oneLevel.project_id&&oneLevel.children_list.length>0"
:src="oneLevel.isOpen?'../../../static/icon_up_arrow.png':'../../../static/icon_drop_arrow.png'"
class="image" @click="toNextChild(index,oneLevel,oneIndex)"></image>
<view class="name" @click="toNextChild(index,oneLevel,oneIndex)">{{oneLevel.name}}
......
......@@ -99,7 +99,7 @@
toLinkLogin() {
uni.clearStorageSync()
uni.reLaunch({
url: "/pages/login/login/login"
url: "/pages/user/login/login"
})
},
linkTo(router) {
......@@ -189,7 +189,6 @@
margin: 190px 30rpx 0 30rpx;
background-color: #fff;
border-radius: 30rpx;
padding-bottom: 30rpx;
.item {
display: flex;
......
......@@ -40,7 +40,7 @@
is_publish: 1,
app_sort: 2,
},
apps: [{}],
apps: [],
currentJob: {},
project_id: "",
orgName: "",
......
<template>
<view class="content">
<image src="../../../static/hbd-login-logo.png" class="logo-image"></image>
<view class="app-name">智慧工地一点通</view>
<input class="account-input" placeholder-class="hint-input" placeholder="请输入账号" v-model="account" />
<input class="password-input" placeholder-class="hint-input" placeholder="请输入密码" v-model="password"
type="password" />
<view class="login-btn-content" @click="login">
<text class="text">登录</text>
</view>
<view class="other-content">
<view class="register" @click="toPhoneLogin">手机验证码登录</view>
<view class="line"></view>
<view class="register" @click="toWxLogin">微信授权登录</view>
</view>
</view>
</template>
<script>
import Api from "../../../api/api.js"
export default {
data() {
return {
unique_token: "",
account: "",
password: ""
}
},
onLoad() {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
},
methods: {
toPhoneLogin() {
uni.navigateTo({
url: "/pages/user/phoneLogin/phoneLogin"
})
},
toWxLogin() {
uni.navigateTo({
url: "/pages/user/login/login"
})
},
toLogin() {
uni.showLoading({
title: "登录中..."
})
Api.login({
data: {
"user_no": this.account,
"password": this.password,
"login_type": 1,
"system_no": this.$config.systemCode
},
}).then((result) => {
console.log("登录用户信息:", result);
if (result.code === 0) {
uni.setStorageSync("token", result.data.access_token)
uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id)
uni.setStorageSync("refresh_token", result.data.refresh_token)
uni.showToast({
title: "登录成功",
icon: 'none'
})
uni.switchTab({
url: "/pages/index/index"
})
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
login() {
if (this.account == "") {
this.$toast.showToast("请输入账号")
return
}
if (this.password == "") {
this.$toast.showToast("请输入密码")
return
}
Api.getKey({
data: {
"system_no": this.$config.systemCode,
"auth_code": this.$config.authCode
},
}).then((result) => {
console.log(result);
if (result.code === 0) {
uni.setStorageSync("key", result.data.key)
this.toLogin()
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
.logo-image {
width: 144rpx;
height: 144rpx;
margin-top: 40px;
}
.app-name {
font-weight: 600;
margin-top: 16px;
font-size: 40rpx;
text-align: center;
color: #333;
}
.account-input {
width: 550rpx;
border-radius: 24px;
margin-top: 100px;
background: #f5f5f5;
padding: 12px 24px
}
.hint-input {
font-weight: 400;
font-size: 17px;
line-height: 20px;
text-align: left;
color: #999;
}
.password-input {
width: 550rpx;
border-radius: 24px;
margin-top: 24px;
background: #f5f5f5;
padding: 12px 24px
}
.login-btn-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 650rpx;
height: 48px;
margin-top: 24px;
border-radius: 24px;
background: #3B73FE;
text {
font-weight: 500;
font-size: 17px;
line-height: 20px;
text-align: center;
color: #FFF;
}
}
.other-content {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 16px;
.register {
font-weight: 400;
font-size: 16px;
line-height: 20px;
text-align: center;
color: rgba(51, 51, 51, 0.45);
}
.line {
margin: 0 32rpx;
width: 1px;
height: 16px;
background: rgba(51, 51, 51, 0.45);
}
}
}
</style>
<template>
<view class="content">
<image src="../../../static/hbd-login-logo.png" class="logo-image"></image>
<view class="app-name">智慧工地一点通</view>
<image src="../../../static/loginimage-bg.png" class="image-bg"></image>
<button class="wx-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信一键登录</button>
<view class="login-btn-content" @click="toAccountLogin">
<image src="../../../static/account-circle-ic.png" class="ac-image"></image>
<text class="text">账号密码登录</text>
</view>
<view class="other-content">
<view class="register" @click="toRegister">新用户注册</view>
<view class="line"></view>
<view class="register" @click="toPhoneLogin">手机验证码登录</view>
</view>
</view>
</template>
<script>
import Api from "../../../api/api.js"
export default {
data() {
return {
unique_token: ""
}
},
onLoad() {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
this.getJsCode()
},
methods: {
toPhoneLogin() {
uni.navigateTo({
url: "/pages/user/phoneLogin/phoneLogin"
})
},
toRegister() {
uni.navigateTo({
url: "/pages/login/register/register"
})
},
toAccountLogin() {
uni.navigateTo({
url: "/pages/user/accountLogin/accountLogin"
})
},
wxPhoneLogin(phone) {
Api.wxPhoneLogin({
data: {
"phone": phone,
"unique_token": this.unique_token
}
}).then((result) => {
console.log("微信手机号登录", result);
if (result.code == 0) {
uni.setStorageSync("token", result.data.access_token)
uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id)
uni.setStorageSync("refresh_token", result.data.refresh_token)
uni.showToast({
title: "登录成功",
icon: 'none'
})
uni.switchTab({
url: "/pages/index/index"
})
} else {
this.$toast.showToast(result.msg)
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
getPhoneNumber(e) {
Api.getWxPhone({
data: {
code: e.detail.code
}
}).then((result) => {
console.log("获取手机号", result);
if (result.code == 0) {
this.wxPhoneLogin(result.data.phoneNumber)
} else {
this.$toast.showToast(result.msg)
}
})
},
getJsCode() {
let _this = this;
// 1.wx获取登录用户code
uni.login({
provider: 'weixin',
success: function(loginRes) {
let code = loginRes.code;
//2.将用户登录code传递到后台置换用户SessionKey、OpenId等信息
Api.exchangeToken({
data: {
"js_code": code,
"system_no": _this.$config.systemCode
},
header: {
"Content-Type": "application/json"
}
}).then((res) => {
let result = res.data
_this.unique_token = result.unique_token
}, (err) => {
this.$toast.showToast(err.msg)
})
},
});
}
}
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
.logo-image {
width: 144rpx;
height: 144rpx;
margin-top: 40px;
}
.app-name {
font-weight: 600;
margin-top: 16px;
font-size: 40rpx;
text-align: center;
color: #333;
}
.image-bg {
margin-top: 24px;
width: 630rpx;
height: 220px;
}
.wx-btn {
width: 650rpx;
height: 48px;
background: #3B73FE;
border-radius: 24px;
color: #FFFFFF;
font-size: 34rpx;
}
.login-btn-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 650rpx;
height: 48px;
margin-top: 16px;
border-radius: 24px;
background: #fff;
border: 1px solid #4972f5;
.ac-image {
width: 48rpx;
height: 48rpx;
}
text {
font-weight: 400;
font-size: 17px;
margin-left: 20rpx;
line-height: 20px;
text-align: left;
color: #4972f5;
}
}
.other-content {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 16px;
.register {
font-weight: 400;
font-size: 16px;
line-height: 20px;
text-align: center;
color: rgba(51, 51, 51, 0.45);
}
.line {
margin: 0 32rpx;
width: 1px;
height: 16px;
background: rgba(51, 51, 51, 0.45);
}
}
}
</style>
<template>
<view class="content">
<image src="../../../static/hbd-login-logo.png" class="logo-image"></image>
<view class="app-name">智慧工地一点通</view>
<input class="phone-input" placeholder-class="hint-input" placeholder="请输入账号" v-model="phone" maxlength="11"
type="number" />
<view class="code-content">
<input class="code-input" placeholder-class="hint-input" placeholder="请输入验证码" v-model="code"
type="number" />
<view class="code-btn" @click="sendCode">{{codeText}}</view>
</view>
<view class="login-btn-content" @click="login">
<text class="text">登录</text>
</view>
<view class="other-content">
<view class="register" @click="toAccountLogin">账号密码登录</view>
<view class="line"></view>
<view class="register" @click="toWxLogin">微信授权登录</view>
</view>
</view>
</template>
<script>
import Api from "../../../api/api.js"
export default {
data() {
return {
unique_token: "",
phone: "",
code: "",
codeText: "获取验证码",
isCanSend: true,
downTime: 60,
}
},
onLoad() {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#ffffff'
})
},
methods: {
sendCode() {
if (!(this.isCanSend)) {
return
}
if (this.phone == "" || this.phone.length != 11) {
uni.showToast({
title: "请输入正确的手机号",
duration: 1000,
icon: 'none',
})
return
}
Api.sendCode({
data: {
"phone": this.phone,
"usage_code": "1",
"template_no": "industry-0001",
"system_no": this.$config.systemCode
},
}).then((res) => {
console.log(res);
let code = res.code
if (code == 0) {
this.timeDown(this.downTime)
uni.showToast({
title: "验证码已发送",
icon: 'none'
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
timeDown(num) {
let that = this;
if (num == 0) {
this.downTime = 60
that.isCanSend = true;
that.codeText = "发送验证码"
return clearTimeout();
} else {
that.isCanSend = false;
setTimeout(function() {
that.downTime = num - 1
that.codeText = that.downTime + "秒"
that.timeDown(num - 1)
}, 1000);
}
},
toAccountLogin() {
uni.navigateTo({
url: "/pages/user/accountLogin/accountLogin"
})
},
toWxLogin() {
uni.navigateTo({
url: "/pages/user/login/login"
})
},
toLogin() {
uni.showLoading({
title: "登录中..."
})
Api.login({
data: {
"phone": this.phone,
"code": this.code,
"login_type": 2,
"system_no": this.$config.systemCode
},
}).then((result) => {
console.log("登录用户信息:", result);
if (result.code === 0) {
uni.setStorageSync("token", result.data.access_token)
uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id)
uni.setStorageSync("refresh_token", result.data.refresh_token)
uni.showToast({
title: "登录成功",
icon: 'none'
})
if (this.isAuth) {
this.toAuthLogin()
} else {
uni.switchTab({
url: "/pages/index/index"
})
}
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
login() {
if (this.phone == "" || this.phone.length != 11) {
uni.showToast({
title: "请输入正确的手机号",
duration: 1000,
icon: 'none',
})
return
}
if (this.code == "") {
uni.showToast({
title: "请输入验证码",
duration: 1000,
icon: 'none',
})
return
}
Api.getKey({
data: {
"system_no": this.$config.systemCode,
"auth_code": this.$config.authCode
},
}).then((result) => {
console.log(result);
if (result.code === 0) {
uni.setStorageSync("key", result.data.key)
this.toLogin()
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
.logo-image {
width: 144rpx;
height: 144rpx;
margin-top: 40px;
}
.app-name {
font-weight: 600;
margin-top: 16px;
font-size: 40rpx;
text-align: center;
color: #333;
}
.phone-input {
width: 550rpx;
border-radius: 24px;
margin-top: 100px;
background: #f5f5f5;
padding: 12px 24px
}
.hint-input {
font-weight: 400;
font-size: 17px;
line-height: 20px;
text-align: left;
color: #999;
}
.code-content {
width: 550rpx;
border-radius: 24px;
margin-top: 24px;
display: flex;
flex-direction: row;
align-items: center;
background: #f5f5f5;
padding: 12px 24px;
.code-input {
width: 340rpx;
}
.code-btn {
font-weight: 500;
margin-left: 16px;
font-size: 17px;
line-height: 20px;
text-align: left;
color: #4972f5;
}
}
.login-btn-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 650rpx;
height: 48px;
margin-top: 24px;
border-radius: 24px;
background: #3B73FE;
text {
font-weight: 500;
font-size: 17px;
line-height: 20px;
text-align: center;
color: #FFF;
}
}
.other-content {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 16px;
.register {
font-weight: 400;
font-size: 16px;
line-height: 20px;
text-align: center;
color: rgba(51, 51, 51, 0.45);
}
.line {
margin: 0 32rpx;
width: 1px;
height: 16px;
background: rgba(51, 51, 51, 0.45);
}
}
}
</style>
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment