23 changed files with 4082 additions and 2384 deletions
-
3vue/gold-system/package.json
-
9vue/gold-system/src/api/index.js
-
BINvue/gold-system/src/assets/background.jpg
-
23vue/gold-system/src/assets/css/common.css
-
14vue/gold-system/src/router/index.js
-
42vue/gold-system/src/util/http.js
-
517vue/gold-system/src/views/audit/rechargeAudit.vue
-
490vue/gold-system/src/views/audit/refundAudit.vue
-
405vue/gold-system/src/views/consume/addConsume.vue
-
251vue/gold-system/src/views/consume/allConsume.vue
-
84vue/gold-system/src/views/index.vue
-
126vue/gold-system/src/views/login.vue
-
344vue/gold-system/src/views/managerecharge/activity.vue
-
189vue/gold-system/src/views/managerecharge/rate.vue
-
107vue/gold-system/src/views/recharge/addRecharge.vue
-
25vue/gold-system/src/views/recharge/adminRecharge.vue
-
19vue/gold-system/src/views/recharge/allRecharge.vue
-
208vue/gold-system/src/views/refund/addRefund.vue
-
178vue/gold-system/src/views/refund/allRefund.vue
-
248vue/gold-system/src/views/usergold/index.vue
-
943vue/gold-system/src/views/workspace/index.vue
-
104vue/gold-system/src/views/z.vue
-
1vue/gold-system/vite.config.ts
@ -0,0 +1,9 @@ |
|||
import http from '../util/http.js'; |
|||
|
|||
const API={ |
|||
post: function(url,data){ |
|||
return http({url:url,method:'post',data:data}) |
|||
}, |
|||
}; |
|||
|
|||
export default API; |
After Width: 928 | Height: 1133 | Size: 567 KiB |
@ -0,0 +1,42 @@ |
|||
import axios from 'axios'; |
|||
|
|||
export default function (options) { |
|||
//配置每次发送请求都从localStorage中获取名字叫token的数据,
|
|||
//添加到请求头部的Authorization属性中
|
|||
const token = localStorage.getItem('token'); |
|||
//Object.assign用于合并对象的数据
|
|||
options.headers = Object.assign( |
|||
{ token: token }, |
|||
options.headers || {} |
|||
); |
|||
//axios() 返回一个promise对象,用于异步请求
|
|||
//options是一个对象,其中包含了许多用于配置请求的参数,
|
|||
//例如请求的url、请求方法(GET、POST等)、请求头等
|
|||
return axios(options) |
|||
.then(({ status, data, statusText }) => { |
|||
//该函数在请求成功并返回数据时被调用
|
|||
//status:HTTP状态码,例如200表示请求成功。
|
|||
//data:服务器返回的数据。
|
|||
// statusText:HTTP状态文本,例如"OK"表示请求成功。
|
|||
console.log(data); |
|||
if (status == 200) { |
|||
return data; |
|||
} else { |
|||
throw new e(statusText); |
|||
} |
|||
}) |
|||
.catch(e=>{ |
|||
// 检查是否是因为token过期导致的401错误
|
|||
if (e.response && e.response.status === 401) { |
|||
// 清除localStorage中的token
|
|||
localStorage.removeItem('token'); |
|||
// 执行重新登录的逻辑,例如跳转到登录页面
|
|||
window.location.href = '/login'; |
|||
// 可以在这里返回一个特定的值或者对象,以便调用者知道需要重新登录
|
|||
return { needsLogin: true }; |
|||
} else { |
|||
// 其他类型的错误,直接抛出
|
|||
return Promise.reject(e); |
|||
} |
|||
}); |
|||
} |
@ -0,0 +1,126 @@ |
|||
<script setup> |
|||
import { ref, onMounted, reactive, computed } from "vue"; |
|||
import { ElMessage } from "element-plus"; |
|||
import axios from "axios"; |
|||
import { useRouter } from "vue-router"; |
|||
import { VscGlobe } from "vue-icons-plus/vsc"; |
|||
|
|||
const router = useRouter(); // 获取路由实例 |
|||
const form = ref({ name: "", password: "" }); |
|||
//调用方法 |
|||
const login = async function () { |
|||
try { |
|||
const result = await axios.post( |
|||
"http://192.168.8.93:10070/admin/login", |
|||
form.value |
|||
); |
|||
if (result.data.code == 200) { |
|||
localStorage.setItem("token", result.data.msg); |
|||
router.push("/"); |
|||
ElMessage.success("登录成功"); |
|||
console.log("请求成功", result); |
|||
} else { |
|||
form.value.password = ""; |
|||
form.value.username = ""; |
|||
ElMessage.error(result.data.msg); |
|||
} |
|||
} catch (error) { |
|||
console.log("请求失败", error); |
|||
ElMessage.error(result.data.msg); |
|||
// 在这里可以处理错误逻辑,比如显示错误提示等 |
|||
} |
|||
}; |
|||
</script> |
|||
<template> |
|||
<el-row class="login-page"> |
|||
<img |
|||
:span="12" |
|||
src="../assets/background.jpg" |
|||
alt="logo" |
|||
class="bg" |
|||
fit="fit" |
|||
/> |
|||
<el-col :span="6" :offset="3" class="form"> |
|||
<!-- 登录表单 --> |
|||
<el-form |
|||
:model="form" |
|||
size="large" |
|||
autocomplete="off" |
|||
@keyup.enter.native="login()" |
|||
> |
|||
<el-form-item> |
|||
<h1 style="color: #409eff">金币系统登录</h1> |
|||
</el-form-item> |
|||
<el-form-item prop="username"> |
|||
<el-input |
|||
v-model="form.username" |
|||
placeholder="请输入用户名" |
|||
></el-input> |
|||
</el-form-item> |
|||
<el-form-item prop="password"> |
|||
<el-input |
|||
v-model="form.password" |
|||
type="password" |
|||
placeholder="请输入密码" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item class="flex"> </el-form-item> |
|||
<!-- 登录按钮 --> |
|||
<el-form-item> |
|||
<el-button |
|||
class="button" |
|||
type="primary" |
|||
auto-insert-space |
|||
@click="login()" |
|||
>登录</el-button |
|||
> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-col> |
|||
</el-row> |
|||
</template> |
|||
<style scoped> |
|||
.bg { |
|||
border-radius: 0 20px 20px 0; |
|||
height: 100vh; |
|||
width: 50%; |
|||
object-fit: cover; |
|||
} |
|||
.background { |
|||
color: #fffdfd; |
|||
text-align: center; |
|||
font-size: 24px; |
|||
background-color: #08193d; |
|||
} |
|||
.form { |
|||
display: flex; |
|||
flex-direction: column; |
|||
justify-content: center; |
|||
user-select: none; |
|||
|
|||
.title { |
|||
margin: 0 auto; |
|||
} |
|||
|
|||
.button { |
|||
width: 100%; |
|||
} |
|||
|
|||
.flex { |
|||
width: 100%; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
} |
|||
} |
|||
|
|||
/* .box { |
|||
padding: 20px; |
|||
border-radius: 10px; |
|||
background-color: #fff; |
|||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
transform: translate(-50%, -50%); |
|||
} */ |
|||
</style> |
943
vue/gold-system/src/views/workspace/index.vue
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,104 @@ |
|||
<script setup> |
|||
import { all } from 'axios'; |
|||
import * as echarts from 'echarts'; |
|||
import { ref, onMounted, reactive, computed } from "vue"; |
|||
import { VscInfo } from 'vue-icons-plus/vsc' |
|||
import { Bs1CircleFill, Bs2CircleFill, Bs3CircleFill, Bs4Circle, Bs5Circle, Bs6Circle, Bs7Circle, Bs8Circle } from 'vue-icons-plus/bs' |
|||
import axios from 'axios'; |
|||
|
|||
// 变量 |
|||
const option4Data = ref([]); |
|||
const a1=ref(1000); |
|||
const a2=ref(2000); |
|||
const a3=ref(3000); |
|||
const a4=ref(4000); |
|||
onMounted(async function () { |
|||
option4Data.value = [ |
|||
{ value: a1.value, name: '1000金币' }, |
|||
{ value: a2.value, name: '2000金币' }, |
|||
{ value: a3.value, name: '3000金币' }, |
|||
{ value: a4.value, name: '4000金币' }, |
|||
]; |
|||
// 第一个柱状图 基于准备好的dom,初始化echarts实例 |
|||
var rechargeBar = echarts.init(document.getElementById('main')); |
|||
|
|||
const option = { |
|||
tooltip: { |
|||
trigger: 'item' |
|||
}, |
|||
legend: { |
|||
bottom: '-2%', |
|||
left: 'center', |
|||
orient: 'vertical' |
|||
}, |
|||
grid: { |
|||
top: '0%', // 设置图表距离容器顶部的距离为10%,使饼图上移 |
|||
}, |
|||
series: [ |
|||
{ |
|||
name: '全年累计消耗金币数(个)\n10000', |
|||
type: 'pie', |
|||
radius: ['80%', '60%'], |
|||
avoidLabelOverlap: false, |
|||
label: { |
|||
show: true, |
|||
position: 'center', |
|||
formatter: '{a}', |
|||
fontSize: 15, |
|||
fontWeight: 'bold' |
|||
}, |
|||
labelLine: { |
|||
show: false |
|||
}, |
|||
data: option4Data.value, |
|||
color: ['#57a5ff', '#7f29ff', '#f2d113'] |
|||
} |
|||
] |
|||
}; |
|||
// 使用刚指定的配置项和数据显示图表。 |
|||
rechargeBar.setOption(option); |
|||
}) |
|||
|
|||
|
|||
</script> |
|||
|
|||
<template> |
|||
<div>zzz</div> |
|||
<div id="main" style="width: 600px;height:400px;"></div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
.comparedWithYesterday { |
|||
display: flex; |
|||
} |
|||
|
|||
.ranking-item { |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
.ranking-header { |
|||
margin-bottom: 10px; |
|||
display: flex; |
|||
} |
|||
|
|||
.goldCategory { |
|||
margin-right: 20px; |
|||
display: flex; |
|||
} |
|||
|
|||
.bar { |
|||
display: flex; |
|||
} |
|||
|
|||
.pie { |
|||
display: flex; |
|||
} |
|||
|
|||
.el-row { |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.el-radio-button { |
|||
border: 1px solid grey; |
|||
} |
|||
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue