Compare commits
2 Commits
17ca482461
...
1b0778606e
| Author | SHA1 | Date |
|---|---|---|
|
|
1b0778606e | |
|
|
8df1ebddc3 |
|
|
@ -6,8 +6,7 @@ import request from '@/utils/request'
|
||||||
export function queryCustAddrApi(data) {
|
export function queryCustAddrApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/user_addr/list',
|
url: '/smart-canteen/user_addr/list',
|
||||||
method: 'get',
|
method: 'get'
|
||||||
params: data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,14 @@ export function getUserProfile() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getUserInfo() {
|
||||||
|
return request({
|
||||||
|
url: '/system/user/getInfo',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 修改用户个人信息
|
// 修改用户个人信息
|
||||||
export function updateUserProfile(data) {
|
export function updateUserProfile(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"base-64": "^1.0.0",
|
"base-64": "^1.0.0",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
|
"image-compressor.js": "^1.1.4",
|
||||||
"image-tools": "^1.4.0",
|
"image-tools": "^1.4.0",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"sm-crypto": "^0.3.13"
|
"sm-crypto": "^0.3.13"
|
||||||
|
|
|
||||||
|
|
@ -723,12 +723,12 @@ page {
|
||||||
.menuContent{
|
.menuContent{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 74vh;
|
height: 70vh;
|
||||||
// background-color: #DD7D3C;
|
// background-color: #DD7D3C;
|
||||||
}
|
}
|
||||||
.content-left{
|
.content-left{
|
||||||
width: 20%;
|
width: 20%;
|
||||||
height: 74vh;
|
height: 70vh;
|
||||||
}
|
}
|
||||||
.active2 {
|
.active2 {
|
||||||
color: #DD7D3C;
|
color: #DD7D3C;
|
||||||
|
|
@ -738,7 +738,7 @@ page {
|
||||||
|
|
||||||
.content-right{
|
.content-right{
|
||||||
width: 80%;
|
width: 80%;
|
||||||
height: 74vh;
|
height: 70vh;
|
||||||
// height: auto !important;
|
// height: auto !important;
|
||||||
}
|
}
|
||||||
.scroll-right-item{
|
.scroll-right-item{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view class="notice-content">
|
<view class="notice-content">
|
||||||
<view class="content-text">{{noticeData.noticeContent}}</view>
|
<view class="content-text">{{noticeData.noticeContentNoHtml}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
<!-- <view class="title">通知</view> -->
|
<!-- <view class="title">通知</view> -->
|
||||||
<view class="time">{{ item.noticeTitle }}</view>
|
<view class="time">{{ item.noticeTitle }}</view>
|
||||||
</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 class="desc" style="float: right;height: 20px;">{{item.updateTime}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 { getWalletBalanceAPI } from "@/api/mine/index.js";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
|
|
@ -126,9 +127,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
this.getUserInfo()
|
||||||
// this.getWalletBalance()
|
// this.getWalletBalance()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getUserInfo() {
|
||||||
|
getUserInfo().then(res => {
|
||||||
|
this.headPortraitUrl= res.user.avatar
|
||||||
|
})
|
||||||
|
},
|
||||||
// 获取钱包余额
|
// 获取钱包余额
|
||||||
async getWalletBalance(userId) {
|
async getWalletBalance(userId) {
|
||||||
let param = {
|
let param = {
|
||||||
|
|
@ -163,14 +170,31 @@
|
||||||
uni.chooseImage({//选择图片
|
uni.chooseImage({//选择图片
|
||||||
count: 1,
|
count: 1,
|
||||||
success: resImage => {
|
success: resImage => {
|
||||||
console.log(resImage)
|
console.log(resImage)
|
||||||
// this.headPortraitUrl = resImage.tempFilePaths[0]
|
if(resImage.tempFiles[0].size>1024*1024){
|
||||||
//转base64
|
uni.showToast({
|
||||||
this.imgToBase64(resImage.tempFilePaths[0]).then(base64 => {
|
title: "头像图片不可大于1MB",
|
||||||
console.log(base64)
|
icon: 'none'
|
||||||
//base64上传
|
})
|
||||||
this.uploadHeadImg(base64)
|
}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) {
|
}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上传
|
//base64上传
|
||||||
uploadHeadImg(base64){
|
uploadHeadImg(base64){
|
||||||
let param = {
|
let param = {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<view class="form-container">
|
<view class="form-container">
|
||||||
<!-- 头像区域 -->
|
<!-- 头像区域 -->
|
||||||
<view class="avatar-section" @click="handleUpdateAvatar">
|
<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">
|
<view class="camera-icon">
|
||||||
<image class="icon" :src="require('@/static/images/my/camera.png')" mode="aspectFit"></image>
|
<image class="icon" :src="require('@/static/images/my/camera.png')" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -123,6 +123,7 @@
|
||||||
import {
|
import {
|
||||||
uploadAvatar,
|
uploadAvatar,
|
||||||
getUserProfile,
|
getUserProfile,
|
||||||
|
getUserInfo,
|
||||||
updateUserProfile,
|
updateUserProfile,
|
||||||
saveUserHeaderPhoto
|
saveUserHeaderPhoto
|
||||||
} from "@/api/system/user"
|
} from "@/api/system/user"
|
||||||
|
|
@ -139,6 +140,7 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
fontValue:uni.getStorageSync('fontSize') || 8,
|
fontValue:uni.getStorageSync('fontSize') || 8,
|
||||||
|
headPortraitUrl:"",
|
||||||
dateShow: false,
|
dateShow: false,
|
||||||
sexShow: false,
|
sexShow: false,
|
||||||
columns: [['男', '女', '未知']],
|
columns: [['男', '女', '未知']],
|
||||||
|
|
@ -150,18 +152,23 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.getUserInfo()
|
this.getUserInfoData()
|
||||||
|
this.getUserHead()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getUserInfo() {
|
getUserInfoData() {
|
||||||
getUserProfile().then(res => {
|
getUserProfile().then(res => {
|
||||||
this.userInfo = res.data;
|
this.userInfo = res.data;
|
||||||
this.userInfo.postIds = res.postIds||[]
|
this.userInfo.postIds = res.postIds||[]
|
||||||
this.userInfo.roleIds = res.roleIds||[]
|
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() {
|
goBack() {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
},
|
},
|
||||||
|
|
@ -234,13 +241,19 @@
|
||||||
count: 1,
|
count: 1,
|
||||||
success: resImage => {
|
success: resImage => {
|
||||||
console.log(resImage)
|
console.log(resImage)
|
||||||
// this.headPortraitUrl = resImage.tempFilePaths[0]
|
if(resImage.tempFiles[0].size>1024*1024){
|
||||||
//转base64
|
uni.showToast({
|
||||||
this.imgToBase64(resImage.tempFilePaths[0]).then(base64 => {
|
title: "头像图片不可大于1MB",
|
||||||
console.log(base64)
|
icon: 'none'
|
||||||
//base64上传
|
})
|
||||||
this.uploadHeadImg(base64)
|
}else{
|
||||||
})
|
let data = {name: 'avatarfile', filePath: resImage.tempFilePaths[0]}
|
||||||
|
uploadAvatar(data).then(response => {
|
||||||
|
if(response.code==200){
|
||||||
|
this.getUserHead()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
<td><u-input
|
<td><u-input
|
||||||
v-model="itme.result"
|
v-model="itme.result"
|
||||||
placeholder="请输入结果"
|
placeholder="请输入结果"
|
||||||
maxlength="5"
|
maxlength="30"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
/></td>
|
/></td>
|
||||||
<td>{{itme.medicalProjectDetailUnit}}</td>
|
<td>{{itme.medicalProjectDetailUnit}}</td>
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,7 @@
|
||||||
<view>{{dashesData.dishesDetailList[0].fat||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].fat||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].carbohydrate||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].carbohydrate||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].dietaryFiber||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].dietaryFiber||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].cholesterol||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].cholesterol||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].carotene||'-'}}</view>
|
|
||||||
<view>{{dashesData.dishesDetailList[0].calcium||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].calcium||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].sodium||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].sodium||'-'}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -75,8 +74,7 @@
|
||||||
<view>{{dashesData.dishesDetailList[0].fatNrv||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].fatNrv||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].carbohydrateNrv||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].carbohydrateNrv||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].dietaryFiberNrv||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].dietaryFiberNrv||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].cholesterolNrv||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].cholesterolNrv||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].caroteneNrv||'-'}}</view>
|
|
||||||
<view>{{dashesData.dishesDetailList[0].calciumNrv||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].calciumNrv||'-'}}</view>
|
||||||
<view>{{dashesData.dishesDetailList[0].sodiumNrv||'-'}}</view>
|
<view>{{dashesData.dishesDetailList[0].sodiumNrv||'-'}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -250,12 +250,12 @@ page {
|
||||||
.menuContent{
|
.menuContent{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 83vh;
|
height: 80vh;
|
||||||
// background-color: #DD7D3C;
|
// background-color: #DD7D3C;
|
||||||
}
|
}
|
||||||
.content-left{
|
.content-left{
|
||||||
width: 20%;
|
width: 20%;
|
||||||
height: 82vh;
|
height: 80vh;
|
||||||
}
|
}
|
||||||
.active2 {
|
.active2 {
|
||||||
color: #DD7D3C;
|
color: #DD7D3C;
|
||||||
|
|
@ -265,7 +265,7 @@ page {
|
||||||
|
|
||||||
.content-right{
|
.content-right{
|
||||||
width: 80%;
|
width: 80%;
|
||||||
height: 82vh;
|
height: 80vh;
|
||||||
}
|
}
|
||||||
.scroll-right-item{
|
.scroll-right-item{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -263,8 +263,8 @@ export default {
|
||||||
{ label: '近6个月', value: 6 }
|
{ label: '近6个月', value: 6 }
|
||||||
],
|
],
|
||||||
currentDateOption: -1,
|
currentDateOption: -1,
|
||||||
startDate: undefined,
|
startDate: getDate(new Date()),
|
||||||
endDate: undefined,
|
endDate: getDate(new Date()),
|
||||||
showStartCalendar: false,
|
showStartCalendar: false,
|
||||||
showEndCalendar: false,
|
showEndCalendar: false,
|
||||||
orderTypes: [{id:"2",name:'预订餐'},{id:"4",name:'商城'},{id:"11",name:'线下消费'}],
|
orderTypes: [{id:"2",name:'预订餐'},{id:"4",name:'商城'},{id:"11",name:'线下消费'}],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue