测试问题修改
This commit is contained in:
		
							parent
							
								
									6744dda6b8
								
							
						
					
					
						commit
						8df1ebddc3
					
				| 
						 | 
				
			
			@ -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'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,14 @@ export function getUserProfile() {
 | 
			
		|||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getUserInfo() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/user/getInfo',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// 修改用户个人信息
 | 
			
		||||
export function updateUserProfile(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 = {
 | 
			
		||||
| 
						 | 
				
			
			@ -164,13 +171,30 @@
 | 
			
		|||
						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.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 = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,10 +152,11 @@
 | 
			
		|||
			}
 | 
			
		||||
		},
 | 
			
		||||
		onLoad() {
 | 
			
		||||
			this.getUserInfo()
 | 
			
		||||
			this.getUserInfoData()
 | 
			
		||||
			this.getUserHead()
 | 
			
		||||
		},
 | 
			
		||||
		methods: {
 | 
			
		||||
			getUserInfo() { 
 | 
			
		||||
			getUserInfoData() { 
 | 
			
		||||
				getUserProfile().then(res => {
 | 
			
		||||
					this.userInfo = res.data;
 | 
			
		||||
					this.userInfo.postIds = res.postIds||[]
 | 
			
		||||
| 
						 | 
				
			
			@ -161,7 +164,11 @@
 | 
			
		|||
					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()
 | 
			
		||||
								} 
 | 
			
		||||
							})   	
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,7 +35,7 @@
 | 
			
		|||
			    <td><u-input
 | 
			
		||||
			      v-model="itme.result"
 | 
			
		||||
			      placeholder="请输入结果"
 | 
			
		||||
			      maxlength="5"
 | 
			
		||||
			      maxlength="30"
 | 
			
		||||
			      show-word-limit
 | 
			
		||||
			    /></td>
 | 
			
		||||
			    <td>{{itme.medicalProjectDetailUnit}}</td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,7 +64,6 @@
 | 
			
		|||
						<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].calcium||'-'}}</view>
 | 
			
		||||
						<view>{{dashesData.dishesDetailList[0].sodium||'-'}}</view>
 | 
			
		||||
					</view>
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +75,6 @@
 | 
			
		|||
						<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].calciumNrv||'-'}}</view>
 | 
			
		||||
						<view>{{dashesData.dishesDetailList[0].sodiumNrv||'-'}}</view>
 | 
			
		||||
					</view>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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%;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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:'线下消费'}],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue