测试问题修改

This commit is contained in:
zzyuan 2025-08-08 15:12:37 +08:00
parent 6744dda6b8
commit 8df1ebddc3
12 changed files with 130 additions and 38 deletions

View File

@ -6,8 +6,7 @@ import request from '@/utils/request'
export function queryCustAddrApi(data) {
return request({
url: '/smart-canteen/user_addr/list',
method: 'get',
params: data
method: 'get'
})
}

View File

@ -31,6 +31,14 @@ export function getUserProfile() {
})
}
export function getUserInfo() {
return request({
url: '/system/user/getInfo',
method: 'get'
})
}
// 修改用户个人信息
export function updateUserProfile(data) {
return request({

View File

@ -11,6 +11,7 @@
"dependencies": {
"base-64": "^1.0.0",
"crypto-js": "^4.2.0",
"image-compressor.js": "^1.1.4",
"image-tools": "^1.4.0",
"js-cookie": "^3.0.5",
"sm-crypto": "^0.3.13"

View File

@ -723,12 +723,12 @@ page {
.menuContent{
width: 100%;
display: flex;
height: 74vh;
height: 70vh;
// background-color: #DD7D3C;
}
.content-left{
width: 20%;
height: 74vh;
height: 70vh;
}
.active2 {
color: #DD7D3C;
@ -738,7 +738,7 @@ page {
.content-right{
width: 80%;
height: 74vh;
height: 70vh;
// height: auto !important;
}
.scroll-right-item{

View File

@ -9,7 +9,7 @@
<!-- 内容区域 -->
<view class="notice-content">
<view class="content-text">{{noticeData.noticeContent}}</view>
<view class="content-text">{{noticeData.noticeContentNoHtml}}</view>
</view>
</view>
</template>

View File

@ -40,7 +40,7 @@
<!-- <view class="title">通知</view> -->
<view class="time">{{ item.noticeTitle }}</view>
</view>
<view class="desc" style="min-height: 42px;">{{ item.noticeContent }}</view>
<view class="desc" style="min-height: 42px;">{{ item.noticeContentNoHtml }}</view>
<view class="desc" style="float: right;height: 20px;">{{item.updateTime}}</view>
</view>

View File

@ -98,7 +98,8 @@
</template>
<script>
import { getUserHeaderPhoto,saveUserHeaderPhoto,uploadAvatar,} from "@/api/system/user";
import { getUserHeaderPhoto,saveUserHeaderPhoto,uploadAvatar,getUserInfo} from "@/api/system/user";
import ImageCompressor from 'image-compressor.js';
import { getWalletBalanceAPI } from "@/api/mine/index.js";
import Cookies from "js-cookie";
import config from '@/config'
@ -126,9 +127,15 @@
}
},
onLoad() {
this.getUserInfo()
// this.getWalletBalance()
},
methods: {
getUserInfo() {
getUserInfo().then(res => {
this.headPortraitUrl= res.user.avatar
})
},
//
async getWalletBalance(userId) {
let param = {
@ -163,14 +170,31 @@
uni.chooseImage({//
count: 1,
success: resImage => {
console.log(resImage)
// this.headPortraitUrl = resImage.tempFilePaths[0]
//base64
this.imgToBase64(resImage.tempFilePaths[0]).then(base64 => {
console.log(base64)
//base64
this.uploadHeadImg(base64)
})
console.log(resImage)
if(resImage.tempFiles[0].size>1024*1024){
uni.showToast({
title: "头像图片不可大于1MB",
icon: 'none'
})
}else{
let data = {name: 'avatarfile', filePath: resImage.tempFilePaths[0]}
uploadAvatar(data).then(response => {
if(response.code==200){
this.getUserInfo()
}
})
}
// this.compressFile(resImage.tempFiles[0]).then(res => {
// const compressRes = res
// console.log(compressRes)
// // console.log(URL.createObjectURL(compressRes))
// let data = {name: 'avatarfile', filePath: compressRes}
// uploadAvatar(data).then(response => {
// // this.getUserInfo()
// })
// })
}
});
}else if(e.val == 2) {
@ -180,6 +204,55 @@
});
}
},
//
compressFile(file) {
return new Promise((resolve, reject) => {
const options = {
success(result) {
// Blob File Blob
const compressedFile = new File([result], file.name, {
type: file.type,
lastModified: Date.now(),
});
return resolve(URL.createObjectURL(compressedFile));
},
error(e) {
return reject(e);
},
};
// 1-3MB
if (file.size > 0.5 * 1024 * 1024 && file.size <= 3 * 1024 * 1024) {
options.quality = 0.3; //
options.convertSize = false;//
options.checkOrientation = false; // false
}
// 3-4MB
if (file.size > 3 * 1024 * 1024 && file.size <= 4 * 1024 * 1024) {
options.quality = 0.25; //
options.convertSize = false;//
options.checkOrientation = false; // false
}
// 5-6MB
if (file.size > 5 * 1024 * 1024 && file.size <= 6 * 1024 * 1024) {
options.quality = 0.2; //
options.convertSize = false;//
options.checkOrientation = false; // false
}
// 6-7MB
if (file.size > 6 * 1024 * 1024 && file.size <= 7 * 1024 * 1024) {
options.quality = 0.15; //
options.convertSize = false;//
options.checkOrientation = false; // false
}
// 7-9MB
if (file.size > 7 * 1024 * 1024 && file.size <= 9 * 1024 * 1024) {
options.quality = 0.1; //
options.convertSize = false;//
options.checkOrientation = false; // false
}
new ImageCompressor(file, options);
});
},
//base64
uploadHeadImg(base64){
let param = {

View File

@ -13,7 +13,7 @@
<view class="form-container">
<!-- 头像区域 -->
<view class="avatar-section" @click="handleUpdateAvatar">
<image class="avatar" :src="userInfo.headPortraitUrl ? userInfo.headPortraitUrl : defaultFace" mode="aspectFill"></image>
<image class="avatar" :src="headPortraitUrl ? headPortraitUrl : defaultFace" mode="aspectFill"></image>
<view class="camera-icon">
<image class="icon" :src="require('@/static/images/my/camera.png')" mode="aspectFit"></image>
</view>
@ -123,6 +123,7 @@
import {
uploadAvatar,
getUserProfile,
getUserInfo,
updateUserProfile,
saveUserHeaderPhoto
} from "@/api/system/user"
@ -139,6 +140,7 @@
data() {
return {
fontValue:uni.getStorageSync('fontSize') || 8,
headPortraitUrl:"",
dateShow: false,
sexShow: false,
columns: [['男', '女', '未知']],
@ -150,18 +152,23 @@
}
},
onLoad() {
this.getUserInfo()
this.getUserInfoData()
this.getUserHead()
},
methods: {
getUserInfo() {
getUserInfoData() {
getUserProfile().then(res => {
this.userInfo = res.data;
this.userInfo.postIds = res.postIds||[]
this.userInfo.roleIds = res.roleIds||[]
console.log('this.userInfo',this.userInfo)
console.log('this.userInfo',this.userInfo)
})
},
getUserHead() {
getUserInfo().then(res => {
this.headPortraitUrl= res.user.avatar
})
},
goBack() {
uni.navigateBack()
},
@ -234,13 +241,19 @@
count: 1,
success: resImage => {
console.log(resImage)
// this.headPortraitUrl = resImage.tempFilePaths[0]
//base64
this.imgToBase64(resImage.tempFilePaths[0]).then(base64 => {
console.log(base64)
//base64
this.uploadHeadImg(base64)
})
if(resImage.tempFiles[0].size>1024*1024){
uni.showToast({
title: "头像图片不可大于1MB",
icon: 'none'
})
}else{
let data = {name: 'avatarfile', filePath: resImage.tempFilePaths[0]}
uploadAvatar(data).then(response => {
if(response.code==200){
this.getUserHead()
}
})
}
}
});
},

View File

@ -35,7 +35,7 @@
<td><u-input
v-model="itme.result"
placeholder="请输入结果"
maxlength="5"
maxlength="30"
show-word-limit
/></td>
<td>{{itme.medicalProjectDetailUnit}}</td>

View File

@ -63,8 +63,7 @@
<view>{{dashesData.dishesDetailList[0].fat||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].carbohydrate||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].dietaryFiber||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].cholesterol||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].carotene||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].cholesterol||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].calcium||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].sodium||'-'}}</view>
</view>
@ -75,8 +74,7 @@
<view>{{dashesData.dishesDetailList[0].fatNrv||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].carbohydrateNrv||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].dietaryFiberNrv||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].cholesterolNrv||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].caroteneNrv||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].cholesterolNrv||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].calciumNrv||'-'}}</view>
<view>{{dashesData.dishesDetailList[0].sodiumNrv||'-'}}</view>
</view>

View File

@ -250,12 +250,12 @@ page {
.menuContent{
width: 100%;
display: flex;
height: 83vh;
height: 80vh;
// background-color: #DD7D3C;
}
.content-left{
width: 20%;
height: 82vh;
height: 80vh;
}
.active2 {
color: #DD7D3C;
@ -265,7 +265,7 @@ page {
.content-right{
width: 80%;
height: 82vh;
height: 80vh;
}
.scroll-right-item{
width: 100%;

View File

@ -263,8 +263,8 @@ export default {
{ label: '近6个月', value: 6 }
],
currentDateOption: -1,
startDate: undefined,
endDate: undefined,
startDate: getDate(new Date()),
endDate: getDate(new Date()),
showStartCalendar: false,
showEndCalendar: false,
orderTypes: [{id:"2",name:'预订餐'},{id:"4",name:'商城'},{id:"11",name:'线下消费'}],