master
fy 2026-02-02 16:04:16 +08:00
parent ce14faf568
commit 905a408129
7 changed files with 346 additions and 41 deletions

View File

@ -1,41 +1,110 @@
import upload from '@/utils/upload'
import request from '@/utils/request'
import config from '@/config'
import storage from '@/utils/storage'
import constant from '@/utils/constant'
import { isHttp, isEmpty } from "@/utils/validate"
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import defAva from '@/static/images/profile.jpg'
// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
const data = {
oldPassword,
newPassword
const baseUrl = config.baseUrl
const user = {
state: {
token: getToken(),
id: storage.get(constant.id),
name: storage.get(constant.name),
avatar: storage.get(constant.avatar),
roles: storage.get(constant.roles),
permissions: storage.get(constant.permissions)
},
mutations: {
SET_TOKEN: (state, token) => {
state.token = token
},
SET_ID: (state, id) => {
state.id = id
storage.set(constant.id, id)
},
SET_NAME: (state, name) => {
state.name = name
storage.set(constant.name, name)
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
storage.set(constant.avatar, avatar)
},
SET_ROLES: (state, roles) => {
state.roles = roles
storage.set(constant.roles, roles)
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
storage.set(constant.permissions, permissions)
}
return request({
url: '/system/user/profile/updatePwd',
method: 'put',
data: data
},
actions: {
// 登录
Login({ commit }, userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
let avatar = user.avatar || ""
if (!isHttp(avatar)) {
avatar = (isEmpty(avatar)) ? defAva : baseUrl + avatar
}
const userid = (isEmpty(user) || isEmpty(user.userId)) ? "" : user.userId
const username = (isEmpty(user) || isEmpty(user.userName)) ? "" : user.userName
if (res.roles && res.roles.length > 0) {
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
commit('SET_ID', userid)
commit('SET_NAME', username)
commit('SET_AVATAR', avatar)
resolve(res)
}).catch(error => {
reject(error)
})
})
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
removeToken()
storage.clean()
resolve()
}).catch(error => {
reject(error)
})
})
}
}
}
// 查询用户个人信息
export function getUserProfile() {
return request({
url: '/system/user/profile',
method: 'get'
})
}
// 修改用户个人信息
export function updateUserProfile(data) {
return request({
url: '/system/user/profile',
method: 'put',
data: data
})
}
// 用户头像上传
export function uploadAvatar(data) {
return upload({
url: '/system/user/profile/avatar',
name: data.name,
filePath: data.filePath
})
}
export default user

View File

@ -2,7 +2,8 @@
module.exports = {
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
baseUrl:'http://193.112.94.36:8080',
baseUrl:'http://yunzs.haich.cc',
// baseUrl:'http://193.112.94.36:8080',
// baseUrl = 'https://api.ruoyi.com'
// prodApi: 'https://vue.ruoyi.vip/prod-api',
// baseUrl: 'http://localhost:8080',

View File

@ -168,6 +168,12 @@
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/back/back",
"style": {
"navigationBarTitleText": ""
}
}
],
"tabBar": {

222
pages/back/back.vue Normal file
View File

@ -0,0 +1,222 @@
<template>
<view class="page-container">
<!-- 顶部状态栏模拟原生手机状态栏 -->
<!-- 导航栏 -->
<view class="navbar">
<view class="nav-tabs">
<view class="tab-item active">全部事件</view>
<view class="tab-item">只看订单</view>
</view>
</view>
<!-- 搜索与筛选区 -->
<view class="search-section">
<view class="search-box">
<text class="search-icon">🔍</text>
<input class="search-input" placeholder="稽查单/事件/订单/商品名/用户" />
<text class="split-icon"></text>
</view>
<view class="filter-btn">
<text class="filter-icon">🔍</text>
<text class="filter-text">筛选</text>
</view>
</view>
<!-- 内容区 -->
<view class="content">
<view class="empty-card">
<view class="empty-icon-wrapper">
<view class="empty-icon">📄</view>
</view>
<text class="empty-text">暂无数据</text>
</view>
</view>
</view>
</template>
<script>
export default {
methods: {
goBack() {
uni.navigateBack();
}
}
};
</script>
<style scoped>
/* 页面基础容器 */
.page-container {
width: 100%;
min-height: 100vh;
background-color: #f5f5f5;
display: flex;
flex-direction: column;
}
/* 状态栏 */
.status-bar {
height: 44px;
background-color: #e62318;
color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 16px;
font-size: 17px;
font-weight: 500;
}
.status-icons {
display: flex;
gap: 8px;
}
/* 导航栏 */
.navbar {
height: 48px;
background-color: #e62318;
color: white;
display: flex;
align-items: center;
padding: 0 16px;
position: relative;
}
.nav-back {
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
}
.back-icon {
font-size: 20px;
font-weight: 500;
}
.nav-tabs {
flex: 1;
display: flex;
justify-content: center;
gap: 40px;
}
.tab-item {
font-size: 17px;
padding: 0 8px;
position: relative;
}
.tab-item.active {
font-weight: bold;
}
.tab-item.active::after {
content: '';
position: absolute;
bottom: -8px;
left: 0;
right: 0;
height: 3px;
background-color: white;
border-radius: 2px;
}
/* 搜索与筛选区 */
.search-section {
background-color: white;
padding: 12px 16px;
display: flex;
align-items: center;
gap: 12px;
}
.search-box {
flex: 1;
height: 36px;
background-color: #f5f5f5;
border-radius: 6px;
border: 1px solid #e5e5e5;
display: flex;
align-items: center;
padding: 0 12px;
}
.search-icon {
font-size: 16px;
color: #999;
margin-right: 8px;
}
.search-input {
flex: 1;
font-size: 15px;
color: #333;
background: transparent;
border: none;
outline: none;
}
.split-icon {
font-size: 16px;
color: #999;
margin-left: 8px;
}
.filter-btn {
height: 36px;
background-color: #f5f5f5;
border-radius: 6px;
padding: 0 12px;
display: flex;
align-items: center;
gap: 4px;
font-size: 15px;
color: #333;
}
.filter-icon {
font-size: 16px;
}
/* 内容区 */
.content {
flex: 1;
padding: 24px 16px;
}
.empty-card {
background-color: white;
border-radius: 12px;
padding: 60px 0;
display: flex;
flex-direction: column;
align-items: center;
}
.empty-icon-wrapper {
width: 80px;
height: 80px;
background-color: #fff5f5;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16px;
}
.empty-icon {
font-size: 32px;
color: #ffb3b3;
}
.empty-text {
font-size: 16px;
color: #666;
}
</style>

View File

@ -102,7 +102,7 @@
</view>
<view class="grid-item" @click="navigateTo('订单')">
<view class="item-iconb">
<view class="item-iconb" @click="goToBack">
</view>
<text class="item-text">订单</text>
@ -279,6 +279,11 @@ export default {
uni.navigateTo({
url: '/pages/asset/asset'
})
},
goToBack(){
uni.navigateTo({
url:'/pages/back/back'
})
},
// reLaunchToA() {
// uni.reLaunch({

View File

@ -37,11 +37,12 @@
</template>
<script>
import config from '@/config'
import config from './../../../config'
import store from "@/store"
import { uploadAvatar } from "@/api/system/user"
const baseUrl = config.baseUrl
console.log('Avatar module base URL:', baseUrl)
let sysInfo = uni.getSystemInfoSync()
let SCREEN_WIDTH = sysInfo.screenWidth
let PAGE_X, // x

View File

@ -1,4 +1,4 @@
import config from '@/config'
import config from './../../config'
import storage from '@/utils/storage'
import constant from '@/utils/constant'
import { isHttp, isEmpty } from "@/utils/validate"
@ -7,6 +7,7 @@ import { getToken, setToken, removeToken } from '@/utils/auth'
import defAva from '@/static/images/profile.jpg'
const baseUrl = config.baseUrl
console.log('User module base URL:', baseUrl)
const user = {
state: {