use absolute path for all routes

This commit is contained in:
RockYang 2023-09-07 10:27:18 +08:00
parent 3b26735998
commit f943669e18
9 changed files with 27 additions and 19 deletions

View File

@ -1,5 +1,16 @@
# 更新日志 # 更新日志
## v3.1.2
1. 功能新增:新增七牛云 OSS 实现目前已支持三种文件上传服务Local, Minio, QiNiu OSS。
2. 功能新增:新增桌面版,使用 electron 套壳网页版。
3. Bug修复自动去除众筹核销时候转账单号中的空格防止复制的时候多复制了空格。
4. 功能优化ChatPlus.vue 页面支持通过 chat_id path variable 来定位到指定的聊天。
5. 功能优化:取消导出聊天页面的授权验证
6. 功能优化:所有路由跳转都使用绝对路径
## v3.1.1
紧急修复版本采用弹窗的方式显示验证码解决验证码在低分辨率下被掩盖的Bug
## v3.1.0(大版本更新) ## v3.1.0(大版本更新)
1. 功能重构:将聊天模型独立拆分,以便支持多平台模型,目前已经内置支持 OPenAIAzure 以及 ChatGLM用户可以在这两个平台的模型中随意切换体验不同的模型聊天。 1. 功能重构:将聊天模型独立拆分,以便支持多平台模型,目前已经内置支持 OPenAIAzure 以及 ChatGLM用户可以在这两个平台的模型中随意切换体验不同的模型聊天。
2. 功能重构:重写系统 API 授权机制,使用 JWT 替换传统的 session 会话授权,使得 API 授权变得更加灵活。 2. 功能重构:重写系统 API 授权机制,使用 JWT 替换传统的 session 会话授权,使得 API 授权变得更加灵活。

View File

@ -145,6 +145,8 @@ func authorizeMiddleware(s *AppServer, client *redis.Client) gin.HandlerFunc {
c.Request.URL.Path == "/api/user/register" || c.Request.URL.Path == "/api/user/register" ||
c.Request.URL.Path == "/api/reward/notify" || c.Request.URL.Path == "/api/reward/notify" ||
c.Request.URL.Path == "/api/mj/notify" || c.Request.URL.Path == "/api/mj/notify" ||
c.Request.URL.Path == "/api/chat/history" ||
c.Request.URL.Path == "/api/chat/detail" ||
strings.HasPrefix(c.Request.URL.Path, "/api/sms/") || strings.HasPrefix(c.Request.URL.Path, "/api/sms/") ||
strings.HasPrefix(c.Request.URL.Path, "/api/captcha/") || strings.HasPrefix(c.Request.URL.Path, "/api/captcha/") ||
strings.HasPrefix(c.Request.URL.Path, "/static/") || strings.HasPrefix(c.Request.URL.Path, "/static/") ||

View File

@ -35,14 +35,9 @@ func (h *ChatHandler) Update(c *gin.Context) {
// History 获取聊天历史记录 // History 获取聊天历史记录
func (h *ChatHandler) History(c *gin.Context) { func (h *ChatHandler) History(c *gin.Context) {
chatId := c.Query("chat_id") // 会话 ID chatId := c.Query("chat_id") // 会话 ID
user, err := utils.GetLoginUser(c, h.db)
if err != nil {
resp.NotAuth(c)
return
}
var items []model.HistoryMessage var items []model.HistoryMessage
var messages = make([]vo.HistoryMessage, 0) var messages = make([]vo.HistoryMessage, 0)
res := h.db.Where("chat_id = ? AND user_id = ?", chatId, user.Id).Find(&items) res := h.db.Where("chat_id = ?", chatId).Find(&items)
if res.Error != nil { if res.Error != nil {
resp.ERROR(c, "No history message") resp.ERROR(c, "No history message")
return return

View File

@ -102,7 +102,7 @@ const exportChat = () => {
justify-content center justify-content center
.chat-box { .chat-box {
max-width 800px; width 800px;
// //
--content-font-size: 16px; --content-font-size: 16px;
--content-color: #c1c1c1; --content-color: #c1c1c1;

View File

@ -356,7 +356,7 @@ onMounted(() => {
ElMessage.error("加载会话列表失败!") ElMessage.error("加载会话列表失败!")
}) })
}).catch(() => { }).catch(() => {
router.push('login') router.push('/login')
}); });
const clipboard = new Clipboard('.copy-reply'); const clipboard = new Clipboard('.copy-reply');
@ -750,7 +750,7 @@ const logout = function () {
activelyClose.value = true; activelyClose.value = true;
httpGet('/api/user/logout').then(() => { httpGet('/api/user/logout').then(() => {
removeUserToken(); removeUserToken();
router.push('login'); router.push('/login');
}).catch(() => { }).catch(() => {
ElMessage.error('注销失败!'); ElMessage.error('注销失败!');
}) })

View File

@ -17,7 +17,7 @@ checkSession().then(() => {
router.push("/chat") router.push("/chat")
} }
}).catch(() => { }).catch(() => {
router.push("login") router.push("/login")
}) })
</script> </script>

View File

@ -34,7 +34,7 @@
<el-row class="text-line"> <el-row class="text-line">
还没有账号 还没有账号
<el-link type="primary" @click="router.push('register')">注册新账号</el-link> <el-link type="primary" @click="router.push('/register')">注册新账号</el-link>
</el-row> </el-row>
</div> </div>
</div> </div>
@ -66,9 +66,9 @@ const password = ref(process.env.VUE_APP_PASS);
checkSession().then(() => { checkSession().then(() => {
if (isMobile()) { if (isMobile()) {
router.push('mobile') router.push('/mobile')
} else { } else {
router.push('chat') router.push('/chat')
} }
}).catch(() => { }).catch(() => {
}) })
@ -94,7 +94,7 @@ const login = function () {
if (isMobile()) { if (isMobile()) {
router.push('/mobile') router.push('/mobile')
} else { } else {
router.push('chat') router.push('/chat')
} }
}).catch((e) => { }).catch((e) => {
ElMessage.error('登录失败,' + e.message) ElMessage.error('登录失败,' + e.message)

View File

@ -75,7 +75,7 @@
<el-row class="text-line"> <el-row class="text-line">
已经有账号 已经有账号
<el-link type="primary" @click="router.push('login')">登录</el-link> <el-link type="primary" @click="router.push('/login')">登录</el-link>
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
@ -144,7 +144,7 @@ const register = function () {
return ElMessage.error('请输入短信验证码'); return ElMessage.error('请输入短信验证码');
} }
httpPost('/api/user/register', formData.value).then(() => { httpPost('/api/user/register', formData.value).then(() => {
ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("login")}) ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("/login")})
}).catch((e) => { }).catch((e) => {
ElMessage.error('注册失败,' + e.message) ElMessage.error('注册失败,' + e.message)
}) })

View File

@ -55,7 +55,7 @@ const username = ref(process.env.VUE_APP_ADMIN_USER);
const password = ref(process.env.VUE_APP_ADMIN_PASS); const password = ref(process.env.VUE_APP_ADMIN_PASS);
checkAdminSession().then(() => { checkAdminSession().then(() => {
router.push("admin") router.push("/admin")
}).catch(() => { }).catch(() => {
}) })
onMounted(() => { onMounted(() => {
@ -76,7 +76,7 @@ const login = function () {
httpPost('/api/admin/login', {username: username.value.trim(), password: password.value.trim()}).then(res => { httpPost('/api/admin/login', {username: username.value.trim(), password: password.value.trim()}).then(res => {
setAdminToken(res.data) setAdminToken(res.data)
router.push("admin") router.push("/admin")
}).catch((e) => { }).catch((e) => {
ElMessage.error('登录失败,' + e.message) ElMessage.error('登录失败,' + e.message)
}) })