Browse Source

租户环境

hella_online_20240829
yufei0306 4 months ago
parent
commit
782bc9338c
  1. 3
      .env.development
  2. 3
      .env.hella13
  3. 3
      .env.hella14
  4. 3
      .env.hella15
  5. 3
      .env.hella16
  6. 3
      .env.hella8
  7. 3
      .env.hella9
  8. 3
      .env.test
  9. 2
      src/api/httpRequest3.js
  10. 5
      src/api/request2.js
  11. 30
      src/pages/login/index.vue
  12. 4
      src/store/modules/user.js

3
.env.development

@ -1,2 +1,5 @@
VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/admin-api
# 租户配置
VITE_TENANT='[{"text":"长春","value":1},{"text":"成都","value":2}]'

3
.env.hella13

@ -1,2 +1,5 @@
VITE_BASE_URL=http://172.21.32.13:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.13:81/admin-api
# 租户配置
VITE_TENANT='[{"text":"长春","value":1}]'

3
.env.hella14

@ -1,2 +1,5 @@
VITE_BASE_URL=http://172.21.32.14:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.14:81/admin-api
# 租户配置
VITE_TENANT='[{"text":"长春","value":1}]'

3
.env.hella15

@ -1,2 +1,5 @@
VITE_BASE_URL=http://172.21.32.15:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.15:81/admin-api
# 租户配置
VITE_TENANT='[{"text":"长春","value":1}]'

3
.env.hella16

@ -1,2 +1,5 @@
VITE_BASE_URL=http://172.21.32.16:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.16:81/admin-api
# 租户配置
VITE_TENANT='[{"text":"长春","value":1}]'

3
.env.hella8

@ -1,2 +1,5 @@
VITE_BASE_URL=http://172.22.32.8:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.22.32.8:81/admin-api
# 租户配置
VITE_TENANT='[{"text":"成都","value":2}]'

3
.env.hella9

@ -1,2 +1,5 @@
VITE_BASE_URL=http://172.22.32.9:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.22.32.9:81/admin-api
# 租户配置
VITE_TENANT='[{"text":"成都","value":2}]'

3
.env.test

@ -1,3 +1,6 @@
VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/admin-api
# 租户配置
VITE_TENANT='[{"text":"长春","value":1},{"text":"成都","value":2}]'

2
src/api/httpRequest3.js

@ -3,7 +3,7 @@ import storage from '../common/utils/storage'
function service(options = {}) {
var token = storage.getStorage(storage.constant.token)
var tenantId = 1
var tenantId = storage.getStorage('tenantId')
// if(getApp()!=undefined){
// tenantId = getApp().globalData.tenantId
// }

5
src/api/request2.js

@ -17,7 +17,7 @@ export function getCaptchaImage(params) {
/**
* 登录方法
*/
export function login(username, password, code, uuid) {
export function login(username, password, code, uuid,tenantName) {
return request({
url: baseApi + '/system/auth/login',
headers: {
@ -28,7 +28,8 @@ export function login(username, password, code, uuid) {
username,
password,
code,
uuid
uuid,
tenantName
}
})
}

30
src/pages/login/index.vue

@ -27,7 +27,8 @@
租户
</view>
<view>
<input class="uni-input" placeholder="请输入租户名" v-model="tenantName" disabled="true" />
<!-- <input class="uni-input" placeholder="请输入租户名" v-model="tenantName" disabled="true" /> -->
<uni-data-select class="uni-data-select" placeholder="请输入租户名" v-model="tenantValue" :clear="false" :localdata="tenantArray"></uni-data-select>
</view>
</view>
<view class="conone">
@ -36,7 +37,8 @@
用户名
</view>
<view>
<input class="uni-input" style="padding:25rpx" placeholder="请输入用户名" v-model="username" />
<input class="uni-input" style="padding:25rpx" placeholder="请输入用户名"
v-model="username" />
</view>
</view>
<view class="conone">
@ -44,9 +46,9 @@
<image class="icon_normal" src="../../static/icons_ui/icon_login_password.svg"></image>
密码
</view>
<view class="uni-input-wrapper" >
<input class="uni-input" style="padding:25rpx" placeholder="请输入密码" :password="showPassword"
v-model="password" />
<view class="uni-input-wrapper">
<input class="uni-input" style="padding:25rpx" placeholder="请输入密码"
:password="showPassword" v-model="password" />
<text class="uni-icon" :class="[!showPassword ? 'uni-eye-active' : '']"
@click="changePassword">&#xe568;</text>
</view>
@ -101,8 +103,10 @@
components: {},
data() {
return {
tenantArray: JSON.parse(import.meta.env.VITE_TENANT),
smloginmsg: "",
tenantName: "闻荫源码",
tenantValue:0,
// tenantName: "",
username: "",
password: "",
tapstyle: 2,
@ -115,7 +119,7 @@
},
// computed: mapState(['forcedLogin', 'hasLogin']),
mounted() {
this.tenantValue = this.tenantArray[0].value
uni.clearStorageSync()
uni.clearStorage(); //
if (process.env.NODE_ENV === 'development') {
@ -193,6 +197,10 @@
logininfo.password = this.password
logininfo.code = this.code;
logininfo.uuid = this.uuid;
logininfo.tenantName = this.tenantArray.find(item=>item.value==this.tenantValue).text;
uni.setStorageSync('tenantId', this.tenantValue)
} else if (this.tapstyle == 1) {
// let arr = Base64.decode(this.smloginmsg).split(':')
// logininfo.username = arr[0];
@ -332,7 +340,13 @@
line-height: 90rpx;
padding: 0 0 0 20rpx;
}
.conone .uni-data-select .uni-select{
background-color: #F7F9FF;
height: 90rpx;
line-height: 90rpx;
border: 0px;
padding: 0 10rpx 0 20rpx;
}
.conone .title {
font-size: .875rem;
align-items: center;

4
src/store/modules/user.js

@ -50,9 +50,9 @@ const user = {
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
const tenantName = userInfo.tenantName
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
login(username, password, code, uuid,tenantName).then(res => {
if(res.data){
res = res.data;
// 设置 token

Loading…
Cancel
Save