刘拾玖 5 månader sedan
förälder
incheckning
ea2fdfe6b9
2 ändrade filer med 107 tillägg och 21 borttagningar
  1. 104 20
      pages/index/CfAppraise.vue
  2. 3 1
      stores/rest.ts

+ 104 - 20
pages/index/CfAppraise.vue

@@ -33,15 +33,27 @@
 					</view>
 					<view class="cf-appraise-edit" v-else>
 						<view class="cf-appraise-edit-tips">
-							展开说说您对“中医用药一件事”的想法吧...
+							<textarea v-model="info.text" class="textarea" :disabled="false" placeholder-style="color:#B3B5B9" maxlength="-1" placeholder="展开说说您对“中医用药一件事”的想法吧..."/>
 						</view>
 						<!-- 最多三张 -->
-						<view class="cf-appraise-edit-add">
-							<text class="iconfont">&#xe69f;</text>
+						<view class="picture-item" v-if="true">
+							<uni-file-picker limit="3"  :auto-upload="false" del-icon="true" file-extname='png,git,jpeg,pdf,jpg' :imageStyles="imageStyles" file-mediatype="image" v-model="fileList" @select="onSelectFile" @delete="onDelFile">
+								<view class="cf-appraise-edit-add">
+									<text class="iconfont">&#xe69f;</text>
+								</view>
+							</uni-file-picker>
 						</view>
+						<view class="echoPicture" v-else>
+							<view v-for="item in fileList" :key="item" class="loop-item">
+								<image class="image-sty" :src="item"></image>
+							</view>
+						</view>
+						
 					</view>
 					<view class="cf-appraise-anonymous">
-						<text class="iconfont" :class="info.anonymous?'is-active':''">&#xe699;</text>匿名评价
+						<view class="anonymous-text" @click="updateAnonymity">
+							<text class="iconfont" :class="info.anonymous?'is-active':''">&#xe699;</text>匿名评价
+						</view>
 					</view>
 				</view>
 				<view class="cf-appraise-btn pub-button is-bg large" v-if="!isEdit" @click="onApply">提交评价</view>
@@ -52,13 +64,16 @@
 <script lang="ts" setup>
 	import { ref, PropType, onMounted } from 'vue'
 	import dlg from '@/lib/dlg.ts'
+	import rest from '@/stores/rest'
+		
 	import CfAppraiseStar from './CfAppraiseStar.vue'
 
-	import testBgUrl from '/static/image/no-data.png'//to del
+	import testBgUrl from '../../static/image/no-data.png'
 
 	const loaded = ref(false)
 	const isEdit = ref(false)
-	const starText = [['', '非常差', '差', '一般', '好', '完全康复'],
+	const starText = [
+	['', '无效健康', '较差健康', '一般健康', '基本健康', '完全康复'],
 	['', '非常差', '差', '一般', '好', '非常好'],
 	['', '非常差', '差', '一般', '好', '非常好'],
 	['', '非常差', '差', '一般', '好', '非常好']]
@@ -81,6 +96,46 @@
 		],
 		anonymous: true
 	})
+	const fileList = ref([])//用于显示图片列表
+	const files =  ref([]) //上传post
+	const imageStyles = ref({
+		width: '210rpx',
+		height: '210rpx',
+	})
+
+
+	// 上传图片
+	const onSelectFile = async (res)=> {
+		console.log("上传")
+		if (!res.tempFilePaths.length) return;
+		uni.showLoading({
+			title: '',
+			mask: true
+		});
+		for (var i = 0; i < res.tempFilePaths.length; i++) { 
+			// 将 Blob 转换为 Base64 
+			let blob = res.tempFilePaths[i]; 
+			let  uploadedFile = await rest.upload(blob);
+			if (!uploadedFile) {
+				dlg.error("上传失败,请重试!");
+				uni.hideLoading();
+				return;
+			}
+			files.value.push(uploadedFile);
+		}
+		uni.hideLoading();
+	}
+
+	// 删除图片
+	const onDelFile = (val) => {
+		if (val.index != -1) {
+			files.value.splice(val.index, 1);
+		}
+	}
+	// 修改
+	const updateAnonymity = ()=> {
+		info.value.anonymous = !info.value.anonymous
+	}
 
 	const onClickComprehensive = (val : number) => {
 		info.value.comprehensiveVal = val
@@ -88,7 +143,15 @@
 
 	const getInfo = async () => {
 		loaded.value = true;
-		// todo 有值取值,没值初始化 
+		try {
+			let res = await rest.get('/app-api/zyyp/prescription-evaluate/getByOrderId',{orderId:'2024_1857595040975118338'})
+			if (res){
+				console.log("内容存在",res)
+			}
+			console.log("内容不存在",res)
+		} catch (e) {
+			console.log(e);
+		}
 		info.value = infoNew.value
 		// isEdit.value = true
 		// info.value = info2.value
@@ -127,6 +190,7 @@
 					border-radius: 8rpx;
 
 					.cf-appraise-top-title {
+						text-align: center;
 						font-size: $uni-font-size-xl;
 						line-height: $uni-line-height-xl;
 						font-weight: 600;
@@ -199,28 +263,48 @@
 					border-radius: 8rpx;
 					margin-top: 24rpx;
 					color: $uni-text-color-grey;
-
-					.cf-appraise-edit-add {
+					.cf-appraise-edit-tips {
+						.textarea {
+							width: 100%;
+						}
+					}
+					.picture-item {
 						margin-top: 16rpx;
-						width: 200rpx;
-						height: 200rpx;
-						border-radius: 8rpx;
-						background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), #1E92F0;
-						@include flex-center;
-
-						.iconfont {
-							font-size: 76rpx;
-							color: $uni-color-primary;
+						.cf-appraise-edit-add {
+							@include flex-center;
+							width: 100%;
+							height: 100%;
+							background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), #1E92F0;
+							.iconfont {
+								font-size: 76rpx;
+								color: $uni-color-primary;
+							}
+						}
+					}
+					.echoPicture {
+						margin-top: 16rpx;
+						display: flex;
+						flex-wrap: wrap;
+						padding-left: 2px;
+						.loop-item {
+							.image-sty{
+								height: 200rpx;
+								width: 200rpx;
+								margin: 5px 2px 0 0px;
+							}
 						}
 					}
 				}
 
 				.cf-appraise-anonymous {
+					display: flex;
 					margin: $uni-spacing-col-s4 0 $uni-spacing-col-s4 $uni-spacing-row-s4;
-					@include flex;
 					// font-size: $uni-font-size-sm;
 					// line-height: $uni-line-height-lg;
-
+					.anonymous-text {
+						@include flex;
+						flex-wrap: 0;
+					}
 					.iconfont {
 						margin-right: 16rpx;
 						font-size: 40rpx;

+ 3 - 1
stores/rest.ts

@@ -10,6 +10,7 @@ function getHeader() {
 	//获取token
 	let token = getToken()
 	let tenant = getTenant()
+	header["Authorization"] = "Bearer " + 'test1';
 	if (token) {
 		header["Authorization"] = "Bearer " + token;
 		// header["token"] = token;
@@ -99,7 +100,7 @@ const fetch = async (method : any, url : string, data : any, loading = false) =>
 const uploadSync = (filePath) => {
 	return new Promise((resolve, reject) => {
 		uni.uploadFile({
-			url: BASE_URL + '/infra/file/upload',
+			url: BASE_URL + '/admin-api/infra/file/upload',
 			// file: image,
 			header: getHeader(),
 			filePath: filePath,
@@ -128,6 +129,7 @@ const uploadSync = (filePath) => {
 	});
 }
 
+
 //上传
 const upload = async (file) => {
 	console.log("file==>", JSON.stringify(file));