Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-05-14 23:17:01 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f72992802c0a99d682fd31d8ce3809870f313d47
f7299280
1 parent
7f9a3c90
新增环境变量判断
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
11 deletions
.env.development
.env.production
src/views/auth.vue
src/views/business/login.vue
.env.development
View file @
f729928
NODE_ENV = 'development'
VITE_APP_OPENID = ''
VITE_OPENID = 'api-test-openid'
VITE_ID = '13812345678'
VITE_PIN = '8888'
...
...
.env.production
View file @
f729928
NODE_ENV = 'production'
VITE_APP_OPENID = 'api-test-openid'
VITE_APP_OPENID = ''
VITE_APP_ID = ''
VITE_APP_PIN = ''
...
...
src/views/auth.vue
View file @
f729928
...
...
@@ -11,11 +11,9 @@ const $route = useRoute();
onMounted(() => {
// php需要先跳转链接获取openid
let url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址
// TAG: 系统参数读取
if (process.env.NODE_ENV === 'development') {
// TEMP:临时使用测试 OPENID, 正式版需要删除
let text = 'api-test-openid'
location.href = `/srv/?f=voice&a=openid_${$route.query.userType}&res=${url}&input_openid=${text}`
// TAG: 开发环境测试数据
location.href = `/srv/?f=voice&a=openid_${$route.query.userType}&res=${url}&input_openid=${import.meta.env.VITE_OPENID}`
} else {
location.href = `/srv/?f=voice&a=openid_${$route.query.userType}&res=${url}`;
}
...
...
src/views/business/login.vue
View file @
f729928
...
...
@@ -68,6 +68,16 @@ const validator = (val) => {
}
return flag
};
const phone = ref('');
const code = ref('');
// TAG: 开发环境测试数据
if (process.env.NODE_ENV === 'development') {
phone.value = import.meta.env.VITE_ID
code.value = import.meta.env.VITE_PIN
}
onMounted(() => {
/**
* 判断微信环境看是否弹出控件框
...
...
@@ -129,9 +139,7 @@ const sendCode = () => { // 发送验证码
})
}
};
// TEMP:测试数据
const phone = ref('13812345678');
const code = ref('8888');
const disabled = ref(true);
// 过滤输入的数字 只能四位
const formatter = (value) => value.substring(0, 4);
...
...
Please
register
or
login
to post a comment