Browse Source

租户环境

hella_online_20240829
yufei0306 6 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. 28
      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=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/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=http://172.21.32.13:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.13:81/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=http://172.21.32.14:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.14:81/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=http://172.21.32.15:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.15:81/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=http://172.21.32.16:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.21.32.16:81/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=http://172.22.32.8:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.22.32.8:81/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=http://172.22.32.9:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.22.32.9:81/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=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/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 = {}) { function service(options = {}) {
var token = storage.getStorage(storage.constant.token) var token = storage.getStorage(storage.constant.token)
var tenantId = 1 var tenantId = storage.getStorage('tenantId')
// if(getApp()!=undefined){ // if(getApp()!=undefined){
// tenantId = getApp().globalData.tenantId // 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({ return request({
url: baseApi + '/system/auth/login', url: baseApi + '/system/auth/login',
headers: { headers: {
@ -28,7 +28,8 @@ export function login(username, password, code, uuid) {
username, username,
password, password,
code, code,
uuid uuid,
tenantName
} }
}) })
} }

28
src/pages/login/index.vue

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

4
src/store/modules/user.js

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

Loading…
Cancel
Save