221 lines
5.4 KiB
Vue
221 lines
5.4 KiB
Vue
<template>
|
|
<!-- <web-view src="http://niunian.hk.fq99.top"></web-view> -->
|
|
<view class="loginPage">
|
|
<view class="barBox" :style="{'height':systemInfo.statusBarHeight+'px'}">
|
|
</view>
|
|
<view class="loginBox">
|
|
<view class="loginTitle">
|
|
登录
|
|
</view>
|
|
<form @submit="formSubmit">
|
|
<view class="uni-form-item">
|
|
<input class="uni-input" name="account" v-model="account" placeholder="请输入账号" />
|
|
</view>
|
|
<view class="uni-form-item">
|
|
<input class="uni-input" name="password" v-model="password" placeholder="请输入密码" type="password" />
|
|
</view>
|
|
<button form-type="submit" type="primary" class="btn">登录</button>
|
|
</form>
|
|
</view>
|
|
<view class="bottomTitle" @click="showModal=true">
|
|
云服务器设置
|
|
</view>
|
|
<view class="modalBox" v-show="showModal">
|
|
<view class="modalContent">
|
|
<view class="modalTitle">
|
|
云服务器设置
|
|
<uni-icons @click="showModal=false" class="closeImg" type="closeempty" size="26"></uni-icons>
|
|
</view>
|
|
<form @submit="saveServerData">
|
|
<view class="uni-form-item">
|
|
<input class="uni-input" name="ipPort" v-model="ipPort"
|
|
placeholder="格式为http://127.0.0.1:8080" />
|
|
</view>
|
|
<button form-type="submit" type="primary" class="btn">保存</button>
|
|
</form>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import Vue from 'vue'
|
|
import uniIcons from "@/components/uni-icons/uni-icons.vue"
|
|
export default {
|
|
components: {
|
|
uniIcons
|
|
},
|
|
data() {
|
|
return {
|
|
account: '',
|
|
password: '',
|
|
ipPort: '',
|
|
showModal: false,
|
|
systemInfo: {
|
|
statusBarHeight: 0
|
|
},
|
|
clientid:''
|
|
}
|
|
},
|
|
onLoad() {
|
|
let _this=this;
|
|
// #ifdef APP-PLUS
|
|
// add:添加登录CID绑定功能 实现推送 2022年4月20日 10:47:41 罗劲章// add:添加登录CID绑定功能 实现推送 2022年4月20日 10:47:41 罗劲章
|
|
plus.push.getClientInfoAsync((info) => {
|
|
const clientid = info["clientid"];
|
|
console.log(clientid,"cidcidcidcidcid")
|
|
|
|
_this.clientid=clientid
|
|
|
|
});
|
|
// #endif
|
|
|
|
},
|
|
mounted() {
|
|
this.systemInfo = uni.getStorageSync('systemInfo')
|
|
uni.setStorageSync('language', 'zh_CN')
|
|
if (uni.getStorageSync('account')) {
|
|
this.account = uni.getStorageSync('account')
|
|
this.password = uni.getStorageSync('password')
|
|
}
|
|
if (uni.getStorageSync('ipPort')) {
|
|
this.ipPort = uni.getStorageSync('ipPort');
|
|
// let val={
|
|
// detail:{
|
|
// value:{
|
|
// account:this.account,
|
|
// password:this.password
|
|
// }
|
|
// }
|
|
// }
|
|
// this.formSubmit(val);
|
|
|
|
} else {
|
|
// this.ipPort='183.95.84.54:9500'
|
|
// uni.setStorageSync('ipPort',this.ipPort)
|
|
}
|
|
|
|
},
|
|
methods: {
|
|
saveServerData(e) {
|
|
uni.setStorageSync('ipPort', e.detail.value.ipPort)
|
|
Vue.prototype.url_config = uni.getStorageSync('ipPort') + '/'
|
|
getApp().globalData.siteUrl = uni.getStorageSync('ipPort') + '/'
|
|
this.showModal = false
|
|
},
|
|
formSubmit(e) {
|
|
// console.log(e)
|
|
var json = {
|
|
account: e.detail.value.account,
|
|
password: e.detail.value.password,
|
|
clientId:this.clientid
|
|
}
|
|
|
|
this.sendRequest({
|
|
url: "xmgl/base/login",
|
|
data: json,
|
|
method: "POST",
|
|
success: (res) => {
|
|
// #ifdef APP-PLUS
|
|
// add:添加登录CID绑定功能 实现推送 2022年4月20日 10:47:41 罗劲章// add:添加登录CID绑定功能 实现推送 2022年4月20日 10:47:41 罗劲章
|
|
plus.push.getClientInfoAsync((info) => {
|
|
const cid = info["clientid"];
|
|
// console.log(cid,"cidcidcidcidcid")
|
|
// const cid = "f4b3246189fc051c5875a35e198ca223";
|
|
const userId = res.result.userId;
|
|
const jsonParams = {
|
|
clientId: cid,
|
|
alias: userId
|
|
}
|
|
//触发绑定请求
|
|
this.sendRequest({
|
|
url: "xmgl/push/bindAlias", //替换掉后端彭定生的接口
|
|
data: jsonParams,
|
|
method: "POST",
|
|
})
|
|
});
|
|
// #endif
|
|
|
|
uni.setStorageSync('account', e.detail.value.account);
|
|
uni.setStorageSync('password', e.detail.value.password);
|
|
uni.setStorageSync('userInfo', JSON.stringify(res.result));
|
|
if (res.result.accountType == 5 || res.result
|
|
.accountType ==
|
|
6) {
|
|
if (res.result.styleType == 1) {
|
|
uni.redirectTo({
|
|
url: '/pages/projectEnd/projectIndex/projectIndex'
|
|
})
|
|
} else {
|
|
uni.redirectTo({
|
|
url: '/pages/workstation/workstationIndex/workstationIndex'
|
|
})
|
|
}
|
|
// uni.redirectTo({
|
|
// url: '/pages/workstation/workstationIndex/workstationIndex'
|
|
// })
|
|
} else {
|
|
uni.redirectTo({
|
|
url: '/pages/projectManage/projectManage'
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.loginPage {
|
|
position: relative;
|
|
color: $uni-text-color;
|
|
// background-color: white;
|
|
// height: 100%;
|
|
}
|
|
|
|
.loginBox {
|
|
padding: 100px 40px 0;
|
|
}
|
|
|
|
.loginTitle {
|
|
font-size: 30px;
|
|
margin-bottom: 30px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.uni-input {
|
|
border-bottom: 1px solid #ddd;
|
|
padding: 10px 15px;
|
|
border-radius: 3px;
|
|
margin-bottom: 25px;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.btn {
|
|
margin-top: 40px;
|
|
}
|
|
|
|
.bottomTitle {
|
|
position: fixed;
|
|
bottom: 20px;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
font-size: 15px;
|
|
}
|
|
|
|
.modalContent {
|
|
.uni-input {
|
|
border: 1px solid #ddd;
|
|
}
|
|
|
|
.btn {
|
|
margin-top: 0;
|
|
}
|
|
}
|
|
|
|
.barBox {
|
|
background-color: #2a2b5b;
|
|
}
|
|
</style>
|