This commit is contained in:
2026-04-16 16:25:16 +08:00
parent aedab4b0ee
commit 88c080889e
4165 changed files with 926326 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
<template>
<view class="d-flex flex-column ">
<div class="page">
<tabler-header></tabler-header>
<tabler-footer></tabler-footer>
</div>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
@@ -0,0 +1,417 @@
<template>
<tabler-header type="mini" ref="heard"></tabler-header>
<div class="page-wrapper">
<!-- Page header -->
<div class="page-header d-print-none">
<div class="container-xl">
<div class="row g-2 align-items-center">
<div class="col">
<h2 class="page-title">
设置
</h2>
</div>
</div>
</div>
</div>
<!-- Page body -->
<div class="page-body">
<div class="container-xl">
<div class="card">
<div class="row g-0">
<setting-menu></setting-menu>
<div class="col-12 col-md-9 d-flex flex-column">
<div class="card-body">
<h2 class="mb-4">信息设置</h2>
<!-- <h3 class="card-title">Profile Details</h3> -->
<div class="row align-items-center">
<div class="col-auto">
<avatar size="xl" :url="user_info.AvatarPath"></avatar>
</div>
<div class="col-auto"><a class="btn" @click="showPopup">更改头像 </a></div>
<!-- <div class="col-auto"><a href="#" class="btn btn-ghost-danger">
删除头像
</a></div> -->
</div>
<!-- <h3 class="card-title mt-4">Business Profile</h3> -->
<div class="row g-3">
<div class="col-md">
<div class="form-label">名字</div>
<input type="text" class="my_input_field" v-model="user_info.Username"
maxlength="30">
</div>
<div class="col-md">
<div class="form-label">备注</div>
<input type="text" class="my_input_field" v-model="user_info.FirstName"
maxlength="50">
</div>
</div>
<div class="mb-3">
<label class="form-label">生日</label>
<div class="row g-2">
<div class="col-5">
<uni-datetime-picker type="date" :clear-icon="false" v-model="birthdate" />
</div>
</div>
</div>
</div>
<div class="card-footer bg-transparent mt-auto">
<div class="btn-list justify-content-end">
<a href="#" class="btn btn-primary">
提交
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<tabler-footer></tabler-footer>
<uni-popup ref="popup" type="center">
<view class="popup-content">
<div class="card card-body container">
<h1>头像裁剪工具</h1>
<div class="flex-wrapper">
<!-- 左侧裁剪区 -->
<div class="crop-section">
<div ref="image_wrapper">
<img ref="cropper_image"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
</div>
<!-- 上传进度 -->
<div class="progress-container">
<div class="progress-bar"></div>
</div>
<div class="preview-stats">
<!-- <p>当前缩放: <span id="zoomValue">100%</span></p> -->
<p>图片尺寸: <span ref="imageSize">0 x 0</span></p>
</div>
</div>
<!-- 右侧预览区 -->
<div class="preview-section">
<h3>实时预览</h3>
<div class="preview-box">
<img ref="preview_img"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=">
</div>
<!-- 控制按钮 -->
<div class="controls">
<button class="btn btn-primary" @click="selefile">📁 选择图片</button>
<button class="btn btn-secondary " onclick="rotateImage(-90)"> 左旋</button>
<button class="btn btn-success " id="uploadBtn"> 裁剪头像</button>
<button class="btn btn-danger " style="margin-top: 150px;" @click="closePopup"> 取消</button>
</div>
</div>
</div>
</div>
</view>
</uni-popup>
</template>
<script>
import "/static/dist/libs/cropper/cropper.min.js"
export default {
data() {
return {
user_info: {
AvatarPath: "",
Username: "",
FirstName: "",
Birthdate: "",
},
birthdate: "",
}
},
methods: {
showPopup() {
this.$refs.popup.open();
},
closePopup() {
this.$refs.popup.close();
},
updateImageInfo() {
if (this.cropper) {
const data = this.cropper.getData();
// document.getElementById('zoomValue').textContent =
// `${Math.round(currentScale * 100)}%`;
// document.getElementById('imageSize').textContent =
// `${Math.round(data.width)} x ${Math.round(data.height)}`;
}
},
updatePreview() {
const canvas = this.cropper.getCroppedCanvas({
width: 250,
height: 250,
imageSmoothingQuality: 'high'
});
if (canvas) {
var that = this
canvas.toBlob(blob => {
const previewUrl = URL.createObjectURL(blob);
that.$refs.preview_img.src = previewUrl;
// 清理旧URL
setTimeout(() => URL.revokeObjectURL(previewUrl), 1000);
}, 'image/jpeg', 0.85);
this.updateImageInfo();
}
},
initCropper(imageSrc) {
var that = this
// 初始化Cropper
if (this.cropper) {
this.cropper.destroy();
}
const image = this.$refs.cropper_image
console.log(image)
image.src = imageSrc;
this.cropper = new Cropper(image, {
aspectRatio: 1,
viewMode: 2,
autoCropArea: 0.8,
zoomable: true,
zoomOnWheel: true,
zoomOnTouch: true,
wheelZoomRatio: 0.1,
//minCanvasWidth: 400,
//minCanvasHeight: 400,
crop: that.updatePreview,
ready() {
that.updateImageInfo();
//document.querySelector('.progress-container').style.display = 'none';
}
});
},
selefile() {
var that=this
uni.chooseImage({
count: 1, // 最多9张
sourceType: ['album', 'camera'], // 来源相册或相机
success: (res) => {
console.log(res);
// 如果需要得到原始的File对象(在H5中),则使用res.tempFiles
const file = res.tempFiles[0];
if (!file) return;
if (!file.type.startsWith('image/')) {
that.$refs.footer.alert('warning', "⚠️ 请选择有效的图片文件")
return;
}
const reader = new FileReader();
reader.onload = () => {
that.initCropper(reader.result);
//currentScale = 1;
};
reader.readAsDataURL(file);
}
});
// this.initCropper(
// 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='
// );
},
},
mounted() {
if (this.$refs.heard.is_login) {
this.user_info = this.$refs.heard.user_info
this.birthdate = this.user_info.Birthdate.substring(0, 10)
} else {
}
// 初始化默认图片
}
}
</script>
<style>
@import url("/static/dist/libs/cropper/cropper.min.css");
/* 头像裁剪器样式*/
.container {
width: 95%;
/* 改为百分比宽度 */
margin: 20px auto;
/* 增加上下边距 */
max-width: 1200px;
/* 保留最大宽度 */
background: white;
padding: 30px;
border-radius: 12px;
}
.flex-wrapper {
display: flex;
gap: 30px;
margin-top: 20px;
flex-wrap: wrap;
/* 添加换行支持 */
}
/* 裁剪区域 */
.crop-section {
background-color: aqua;
flex: 1 1 60%;
/* 弹性布局基础宽度 */
min-width: 300px;
/* 降低最小宽度 */
height: auto;
/* 移除固定高度 */
min-height: 400px;
/* 设置最小高度 */
}
#image-wrapper {
width: 100%;
height: 60vh;
/* 改用视窗单位 */
max-height: 600px;
/* 设置最大高度 */
background: #f8f9fa;
border: 2px dashed #ddd;
border-radius: 8px;
overflow: hidden;
}
/* 预览区域自适应 */
.preview-section {
flex: 1 1 35%;
/* 弹性布局基础宽度 */
min-width: 250px;
/* 设置合理最小宽度 */
}
/* 移动端适配 */
@media (max-width: 768px) {
.container {
padding: 15px;
/* 减少内边距 */
}
.flex-wrapper {
flex-direction: column;
/* 垂直排列 */
}
.crop-section,
.preview-section {
width: 100% !important;
/* 强制全宽 */
min-width: unset;
/* 移除最小宽度 */
}
#image-wrapper {
height: 50vh;
/* 调整移动端高度 */
}
.preview-box {
width: 120px;
/* 缩小预览区域 */
height: 120px;
}
.controls {
flex-direction: column;
/* 垂直排列按钮 */
margin-top: 10px;
}
}
#cropper-image {
max-width: none !important;
max-height: none !important;
}
/* 控制区域 */
.controls {
margin-top: 20px;
display: flex;
flex-direction: column;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
/* 预览区域 */
.preview-section {
flex: 1;
min-width: 50px;
}
.preview-box {
width: 150px;
height: 150px;
/* border-radius: 50%; */
border: 3px solid var(--primary-color);
overflow: hidden;
margin: 0 auto 20px;
}
#preview-img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* 上传进度 */
.progress-container {
height: 8px;
background: #eee;
border-radius: 4px;
margin-top: 20px;
overflow: hidden;
display: none;
}
.progress-bar {
width: 0%;
height: 100%;
background: var(--primary-color);
transition: width 0.3s ease;
}
</style>
+192
View File
@@ -0,0 +1,192 @@
<template>
<view class="d-flex flex-column">
<tabler-header type="mini"></tabler-header>
<div class="page page-center">
<div class="container container-normal py-4">
<div class="row align-items-center g-4">
<div class="col-lg">
<div class="container-tight">
<div class="text-center mb-4">
<div class="navbar-brand navbar-brand-autodark"><img src="/static/logo.svg" height="36"
alt=""></div>
</div>
<div class="card card-md">
<div class="card-body">
<h2 class="h2 text-center mb-4">登录你的账号</h2>
<div class="mb-3">
<label class="form-label mb-0 ms-1">用户名</label>
<input type="text" class="my_input_field"
:placeholder-class="is_username_err?'my_input_placeholder_error':'my_input_placeholder'"
:placeholder="ph_username" autocomplete="off" maxlength="25"
v-model="post_data.username">
</div>
<div class="mb-2">
<label class="form-label mb-0 ms-1">密码</label>
<input type="password" class="my_input_field"
:placeholder-class="is_password_err?'my_input_placeholder_error':'my_input_placeholder'"
password="true" :placeholder="ph_password" autocomplete="off"
maxlength="100" v-model="post_data.password">
</div>
<!-- <div class="mb-2">
<checkbox-group @change="chack_box_change">
<label class="d-flex">
<checkbox value="keep_login_in" />
<span class="form-check-label">保持登录</span>
</label>
</checkbox-group>
</div> -->
<div class="form-footer">
<button class="btn btn-primary w-100" @click="submit_data">登录</button>
</div>
</div>
</div>
<div class="text-center text-secondary mt-3">
还没账号
<a href="/sign-up/" tabindex="-1">点击注册</a>
<span class="form-label-description">
<a href="./forgot-password.html">忘记密码</a>
</span>
</div>
</div>
</div>
<div class="col-lg d-none d-lg-block">
<img src="/static/illustrations/undraw_secure_login_pdn4.svg" height="300"
class="d-block mx-auto" alt="">
</div>
</div>
</div>
</div>
<tabler-footer ref="footer"></tabler-footer>
</view>
</template>
<script>
import {
my_network_func
} from '../my_network_func'
import {
myfunc
} from '../myfunc'
export default {
data() {
return {
ph_username: "",
ph_password: "",
is_username_err: false,
is_password_err: false,
post_data: {
is_keep_login: true,
username: "",
password: "",
}
}
},
methods: {
initdata(){
this.ph_username="输入你的用户名"
this.ph_password="输入你的密码"
this.is_username_err=false
this.is_password_err=false
this.post_data.is_keep_login=true
this.post_data.username=""
this.post_data.password=""
},
chack_box_change(val) {
//console.log(val.detail.value[0])
if (val.detail.value[0] === 'keep_login_in') {
this.post_data.is_keep_login = true
} else {
this.post_data.is_keep_login = false
}
},
submit_data() {
//提交登录数据,
//先验证数据合法性
if (this.post_data.username == "") {
this.is_username_err = true
this.ph_username = "用户名不能为空"
} else {
this.is_username_err = false
}
if (this.post_data.password == "") {
this.is_password_err = true
this.ph_password = "密码不能为空"
} else {
this.is_password_err = false
}
if (this.is_username_err === false && this.is_password_err === false) {
my_network_func.post_json("/user/login", this.post_data, (c) => {
if (c.statusCode == 200) {
if (c.data.err_code == 0) {
this.$refs.footer.alert('success', "登录成功")
myfunc.save_json("cookie", c.data.return.cookie)
myfunc.save_json("user_info", c.data.return.user_info)
this.initdata()
setTimeout(() => {
uni.navigateTo({
url: '/'
});
}, 1000);
} else {
this.$refs.footer.alert('warning', "账号或密码不正确")
}
} else {
this.$refs.footer.alert('danger', "网络连接错误:" + c.statusCode)
}
})
} else {
}
}
},
mounted() {
this.initdata()
}
}
</script>
<style>
.my123 {
/* 设置边框:宽度、样式、颜色 */
border: 1px solid #e3e3e3;
/* 2像素宽的红色实线边框 */
/* 设置圆角,值越大,角越圆 */
border-radius: 3px;
/* 也可以使用百分比,例如50%会变成圆形 */
font-size: 24px;
}
</style>
+7
View File
@@ -0,0 +1,7 @@
<template>
<view></view>
</template>
<script>
</script>