From 2dac4e3e6280ceb88910f160234d94f6ca134b18 Mon Sep 17 00:00:00 2001
From: unknown <331404948@qq.com>
Date: Mon, 18 Sep 2023 20:18:32 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/api.js | 13 ++++++++++---
config/request.js | 20 ++++++++++++--------
config/site.config.js | 8 ++++++++
manifest.json | 2 +-
pages/tabbar/index/index.vue | 19 ++++++++++++++++++-
pages/userCenter/login/login.vue | 2 +-
pages/userCenter/login/loginByPhone.vue | 19 ++++++++++++++-----
site.config.js | 9 +++++----
store/modules/user.js | 22 ++++++++++++++++++++++
9 files changed, 91 insertions(+), 23 deletions(-)
create mode 100644 config/site.config.js
diff --git a/config/api.js b/config/api.js
index e1cc984..f7da277 100644
--- a/config/api.js
+++ b/config/api.js
@@ -1,10 +1,17 @@
-const http = uni.$u.http
+var http = uni.$u.http
// 隐私政策
export const getAgreement = (params, config = {}) => http.post('/util/manage/getAgreement.do', params, config)
// 验证码登录
-export const loginSMS = (data) => http.post('/account/manage/login.do', data)
+export const loginSMS = (data) => http.post('member/auth/sms-login', data)
// 登录发验证码
-export const getLoginCode = (data) => http.post('/util/manage/getLoginRegistCode.do', data)
+export const getLoginCode = (data) => http.post('member/auth/send-sms-code', data)
+// 获取个人信息
+export const getUserInfo = (data) => http.post('member/user/get', {header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}})
+// 刷新token
+export const refreshToken = (data) => http.post('member/auth/refresh-token', data)
+
+
+
diff --git a/config/request.js b/config/request.js
index 9e7c0a2..6054ae0 100644
--- a/config/request.js
+++ b/config/request.js
@@ -1,11 +1,17 @@
+import { H5_API, WX_API } from './site.config.js'
+
// 此vm参数为页面的实例,可以通过它引用vuex中的变量
module.exports = (vm) => {
// 初始化请求配置
uni.$u.http.setConfig((config) => {
+ let prefix = config.prefix?config.prefix:'app-api/'
/* config 为默认全局配置*/
- config.baseURL = 'http://121.41.97.244:8090'; /* 根域名 */
- config.header['content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
+ config.baseURL = H5_API+ WX_API + prefix; /* 根域名 */
+ console.log(config.baseURL)
+ // config.header['content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
+ config.header['tenant-id'] = '1'
+
return config
})
@@ -14,10 +20,8 @@ module.exports = (vm) => {
// 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{}
config.data = config.data || {}
// 根据custom参数中配置的是否需要token,添加对应的请求头
- if(config?.custom?.auth) {
- // 可以在此通过vm引用vuex中的变量,具体值在vm.$store.state中
- config.header.token = vm.$store.state.userInfo.token
- }
+ // config.header.Authorization = 'Bearer ' + vm.$store.state.user.vuex_loginInfo.accessToken
+
return config
}, config => { // 可使用async await 做异步操作
return Promise.reject(config)
@@ -26,14 +30,14 @@ module.exports = (vm) => {
// 响应拦截
uni.$u.http.interceptors.response.use((response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
const data = response.data
- console.log('response')
+ console.log('请求结果')
console.log(data)
// 自定义参数
const custom = response.config?.custom
if (data.code !== 0) {
// 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示
if (custom.toast !== false) {
- uni.$u.toast(data.message)
+ uni.$u.toast(data.msg)
}
// 如果需要catch返回,则进行reject
diff --git a/config/site.config.js b/config/site.config.js
new file mode 100644
index 0000000..c63f5cb
--- /dev/null
+++ b/config/site.config.js
@@ -0,0 +1,8 @@
+const VUE_APP_PLATFORM = process.env.VUE_APP_PLATFORM;
+// localIp = false
+module.exports = {
+ H5_API: VUE_APP_PLATFORM === 'h5' ? '/api' : '',//h5代理
+ WX_API: VUE_APP_PLATFORM === 'h5' ? '' : 'http://192.168.1.26:48080/',//非代理地址
+ TEMP_HOST: VUE_APP_PLATFORM === 'h5' ? '' : 'http://192.168.1.26:48080/',
+
+};
diff --git a/manifest.json b/manifest.json
index be2f3d5..901fb58 100644
--- a/manifest.json
+++ b/manifest.json
@@ -93,7 +93,7 @@
"disableHostCheck" : true,
"proxy" : {
"/api" : {
- "target" : "http://121.41.97.244:8090",
+ "target" : "http://192.168.1.26:48080/",
"changeOrigin" : true,
"secure" : true,
"pathRewrite" : {
diff --git a/pages/tabbar/index/index.vue b/pages/tabbar/index/index.vue
index 84979e2..847bb84 100644
--- a/pages/tabbar/index/index.vue
+++ b/pages/tabbar/index/index.vue
@@ -206,6 +206,18 @@
icon: require('../../../static/images/index/img_6@2x.png'),
url: '/pages/indexEntry/consult/consult'
},
+ {
+ text: '满分学习考试',
+ tps: '网络教育 数据联网',
+ icon: require('../../../static/images/index/img_7@2x.png'),
+ url: ''
+ },
+ {
+ text: '送考卷下乡',
+ tps: '便民利民 就近考试',
+ icon: require('../../../static/images/index/img_8@2x.png'),
+ url: ''
+ },
],
swiperDotIndex: 1,
current: 1,
@@ -530,7 +542,12 @@
&.li2Bg5 {
background: linear-gradient(180deg, #FCF9FB 0%, #FFF5F8 100%);
}
-
+ &.li2Bg6 {
+ background: linear-gradient(180deg, #FDFFF3 0%, #F5FFE1 100%);
+ }
+ &.li2Bg7 {
+ background: linear-gradient(180deg, #EDF7FF 0%, #F3F1FF 100%);
+ }
.icon {
width: 80rpx;
height: 80rpx;
diff --git a/pages/userCenter/login/login.vue b/pages/userCenter/login/login.vue
index f071393..38019ea 100644
--- a/pages/userCenter/login/login.vue
+++ b/pages/userCenter/login/login.vue
@@ -4,7 +4,7 @@
-
+
手机号快捷登录
手机号登录/注册
diff --git a/pages/userCenter/login/loginByPhone.vue b/pages/userCenter/login/loginByPhone.vue
index 429a9a4..a114074 100644
--- a/pages/userCenter/login/loginByPhone.vue
+++ b/pages/userCenter/login/loginByPhone.vue
@@ -35,7 +35,7 @@