Browse Source

更新了图片上传公共组件

code4eat 4 years ago
parent
commit
002e1dc973

+ 1 - 1
components/tm-modal/tm-modal.vue

@@ -21,7 +21,7 @@
 <style lang="less">
 	.tm-modal {
 		overflow: hidden;
-		position: absolute;
+		position: fixed;
 		top: 0;
 		left: 0;
 		width: 100%;

+ 9 - 2
components/tm-upload-img/tm-upload-img.vue

@@ -10,7 +10,7 @@
 		<!-- 预览图片 -->
 		<view class="img-preview">
 			<view class="img-item" v-for="(src, i) in filePaths" :key="i">
-				<image :src="src"></image>
+				<image class="imgItem" :src="src"></image>
 				<image
 				  class="del-close"
 				  src="/static/del-close.png"
@@ -68,6 +68,7 @@
 					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
 					sourceType: ['album'], //从相册选择
 					success: res1 => {
+					console.log({res1});
             uploadImage(res1).then(fileList => {
               if(this.isMultiple){
                 this.$emit('changeFilePaths', [...this.filePaths, ...fileList], this.pickIndex);
@@ -130,7 +131,9 @@
 		.img-preview {
 			display: flex;
 			flex-wrap: wrap;
-
+            img {
+				opacity: 1 !important;
+			}
 			.img-item {
 				position: relative;
 				margin-right: 25rpx;
@@ -141,8 +144,12 @@
 				>image {
 					width: 300rpx;
 					height: 225rpx;
+					opacity: 1;
 				}
 
+                .imgItem>img {
+					opacity: 1;
+				}
 				.del-close {
 					position: absolute;
 					top: -12.5rpx;

+ 2 - 1
pages/calendar/calendar.vue

@@ -61,6 +61,7 @@
 
 <script>
 import websocket from "../../utils/ws.js"; //引入websocket
+import {wsURL} from "../../utils/requestUrl.js";
 import moment from "moment";
 import changeCalendar from "./components/changeCalendar.vue";
 export default {
@@ -140,7 +141,7 @@ export default {
       this.getCanList();
     },
     initWebsocket(hiId, user, permission) {
-      websocket.url = `ws://192.168.1.45:8088/imed/pfm/websocket/${hiId}/${user}/${permission}`;
+      websocket.url = wsURL(hiId, user, permission);
       websocket.createWebSocket(this.resolverWsData.bind(this));
     },
     // 解析websocket返回数据

+ 9 - 8
pages/checkList/checkList.vue

@@ -3,7 +3,7 @@
 		<scroll-view scroll-y="true" class="check-map-list">
 			<tm-top-menu>
 				<view class="top-menu"  @click="showModalHandle(!showModal)">
-					<text>第{{checkIndex}}/{{planList.length}}次查核</text>
+					<text>{{createTitle}}</text>
 					<image :src="`../../static/${showModal?'open':'close'}-icon.png`"></image>
 				</view>
 			</tm-top-menu>
@@ -77,12 +77,13 @@
 			};
 		},
 		computed: {
-			checkIndex: function() {
-				let index = this.planList.findIndex((item)=> item.id === this.checkId);
-				if(index !== -1) {
-					return index + 1;
+			createTitle: function() {
+				let item = this.planList.find((item)=> item.id === this.checkId);
+				if(item) {
+					let name = item.name;
+					return name.slice(0, name.length - 3) + `/${this.planList.length}` + name.slice(-3);
 				} else {
-					return 0;
+					return '';
 				}
 			}
 		},
@@ -90,8 +91,8 @@
 			this.dispatch('planList', {situationId}).then((data)=>{
 				if(data) {
 					this.planList = data;
-					let check = data.find((item)=> Number(item.status)=== 2);
-					this.checkId = check ? check.id 
+					let checkArr = data.filter((item)=> Number(item.status)=== 2).sort((a,b)=>a.createTime - b.createTime);
+					this.checkId = checkArr ? checkArr[checkArr.length - 1].id 
 						: data.length > 0 ? data[0].id : '';
 					this.getDepList();
 				}

+ 5 - 2
pages/creatingSituations/model.js

@@ -44,13 +44,16 @@ const initState = {
 
 export default {
   namespaced: true,
-  state: initState,
+  state: JSON.parse(JSON.stringify(initState)),
   mutations: {
 		comChangeState(state, {key, data}) {
 			state[key] = data;
 		},
 		setInit(state) {
-			state = initState
+			let _initState = JSON.parse(JSON.stringify(initState));
+			for(let key in _initState) {
+				state[key] = _initState[key];
+			}
 		}
   },
   actions: {

+ 106 - 50
pages/home/home.vue

@@ -40,10 +40,10 @@
 					</view>
 					<image class="icon-more" src="/static/images/icon-more.png"></image>
 					<text class="role">{{nowPermissionName}}</text>
-				</view>
-				<!-- 				<view class="sys-setting">
-					<text class="func-text">系统设置</text>
-					<image class="icon-more" src="/static/images/icon-more.png"></image>
+				</view>
+				<!-- 				<view class="sys-setting">
+					<text class="func-text">系统设置</text>
+					<image class="icon-more" src="/static/images/icon-more.png"></image>
 				</view> -->
 				<view class="suggestions-feedback-btn" @click="feedbackFunc">
 					<text class="func-text">建议与反馈</text>
@@ -71,18 +71,18 @@
 				</scroll-view>
 				<button class="journal-ok" @click="journalOk">确定</button>
 			</view>
-		</tm-modal>
-		<tm-modal v-if="ifshowVersionInfo">
-			<view class="journal">
-				<view class="journal-title">
-					<text>{{versionData.versionNo}}</text>
-					<text>{{versionData.versionDate}}</text>
-				</view>
-				<scroll-view scroll-y="true" class="journal-content">
-					{{versionData.versionContent}}
-				</scroll-view>
-				<button class="journal-ok" @click="ifshowVersionInfo = false">确定</button>
-			</view>
+		</tm-modal>
+		<tm-modal v-if="ifshowVersionInfo">
+			<view class="journal">
+				<view class="journal-title">
+					<text>{{versionData.versionNo}}</text>
+					<text>{{versionData.versionDate}}</text>
+				</view>
+				<scroll-view scroll-y="true" class="journal-content">
+					{{versionData.versionContent}}
+				</scroll-view>
+				<button class="journal-ok" @click="ifshowVersionInfo = false">确定</button>
+			</view>
 		</tm-modal>
 	</view>
 </template>
@@ -90,15 +90,15 @@
 <script>
 	export default {
 		data() {
-			return {
+			return {
 				ifshowVersionInfo:false,
 				showJournal: false,
-				version: '0.5.3',
-				versionData: {
-					versionNo: '',
-					versionId: '',
-					versionDate: '',
-					versionContent: ''
+				version: '0.5.3',
+				versionData: {
+					versionNo: '',
+					versionId: '',
+					versionDate: '',
+					versionContent: ''
 				},
 				journalData: {
 					logId: '',
@@ -198,11 +198,67 @@
 				uni.navigateTo({
 					url: '/pages/role-switching/role-switching'
 				});
-			},
-			feedbackFunc(){
-				uni.navigateTo({
-					url: '/pages/suggestionsFeedback/suggestionsFeedback'
-				});
+			}
+		},
+		created: function() {
+			this.$store.dispatch({
+				type: 'home/commActions',
+				payload: {
+					key: 'getuser',
+				}
+			}).then((data) => {
+				if (data) {
+					uni.setStorageSync('permissions', data.permissions);
+					uni.setStorageSync('nowPermission', data.nowPermission);
+					this.code=data.code;
+					this.name=data.name;
+					this.nowPermission=data.nowPermission;
+					this.dep=data.dep;
+					this.depManager=data.depManager;
+					this.hospName=data.hospName;
+					let current=this.pemissionList.find(item => item.permission == data.nowPermission);
+					this.nowPermissionName=current.name;
+					this.totalTodo=data.permissions.reduce(function(total,currentValue){
+						return total+currentValue.todoNum;
+					},0);
+				}
+			});
+			this.$store.dispatch({
+				type: 'home/commActions',
+				payload: {
+					key: 'getVersionLog',
+					data: {versionNo: this.version}
+				}
+			}).then((data) => {
+				if (data) {
+					if(!data.logId) {
+						this.showJournal = false;
+					} else {
+						this.showJournal = true;
+						this.journalData = data;
+					}
+				}
+			});
+		},
+		methods: {
+			logOut() {
+				this.$store.dispatch({
+					type: 'home/commActions',
+					payload: {
+						key: 'logout',
+					}
+				}).then((data)=>{
+					if(data){
+						uni.redirectTo({
+							url: `/pages/login/login?hospSign=${uni.getStorageSync('hospSign')}`
+						});
+					}
+				});
+			},
+			feedbackFunc(){
+				uni.navigateTo({
+					url: '/pages/suggestionsFeedback/suggestionsFeedback'
+				});
 			},
 			journalOk() {
 				this.showJournal = false;
@@ -216,21 +272,21 @@
 						}
 					}
 				});
-			},
-			showVersionInfo(){
-				this.$store.dispatch({
-					type: 'home/commActions',
-					payload: {
-						key: 'getThisVersionInfo',
-						data: {
-							versionNo: this.version,
-						}
-					}
-				}).then(data=>{
-					// console.log({'getThisVersionInfo':data});
-					this.versionData = data;
-					this.ifshowVersionInfo = true;
-				});
+			},
+			showVersionInfo(){
+				this.$store.dispatch({
+					type: 'home/commActions',
+					payload: {
+						key: 'getThisVersionInfo',
+						data: {
+							versionNo: this.version,
+						}
+					}
+				}).then(data=>{
+					// console.log({'getThisVersionInfo':data});
+					this.versionData = data;
+					this.ifshowVersionInfo = true;
+				});
 			}
 		},
 		computed: {
@@ -445,16 +501,16 @@
 				// 	width: 725rpx;
 				// 	margin-left: 25rpx;
 				// 	background: #FFFFFF;
-				// }
-				.suggestions-feedback-btn {
+				// }
+				.suggestions-feedback-btn {
 					height: 100rpx;
 					width: 725rpx;
 					margin-left: 25rpx;
 					background: #FFFFFF;
-					// border-bottom: 0.62rpx solid #DADEE6;
-					.func-text {
-						
-					}
+					// border-bottom: 0.62rpx solid #DADEE6;
+					.func-text {
+						
+					}
 				}
 				.func-text {
 					font-size: 22.5rpx;
@@ -506,4 +562,4 @@
 			color: #666E80;
 		}
 	}
-</style>
+</style>

+ 2 - 1
pages/mission/mission.vue

@@ -42,6 +42,7 @@
 	// 任务列表
 	import listItem from './components/list-item.vue';
 	import websocket from '../../utils/ws.js';//引入websocket
+	import {wsURL} from "../../utils/requestUrl.js";
 	export default {
 		data(){
 			return {
@@ -163,7 +164,7 @@
 				 */
 			},
 			initWebsocket(hiId,user,permission) {
-			    websocket.url = `ws://192.168.1.45:8088/imed/pfm/websocket/${hiId}/${user}/${permission}`;
+			    websocket.url = wsURL(hiId, user, permission);
 			    websocket.createWebSocket(this.resolverWsData.bind(this));
 			},
 			// 解析websocket返回数据

+ 3 - 1
pages/situationsCenter/situationsCenter.vue

@@ -95,6 +95,8 @@
  */
 <script>
 import websocket from "../../utils/ws.js"; //引入websocket
+import {wsURL} from "../../utils/requestUrl.js";
+
 export default {
   data() {
     return {
@@ -240,7 +242,7 @@ export default {
       this.initSituationList();
     },
     initWebsocket(hiId, user, permission) {
-      websocket.url = `ws://192.168.1.45:8088/imed/pfm/websocket/${hiId}/${user}/${permission}`;
+      websocket.url = wsURL(hiId, user, permission);
       websocket.createWebSocket(this.resolverWsData.bind(this));
     },
     // 解析websocket返回数据

+ 1 - 1
pages/suggestionsFeedback/suggestionsFeedback.vue

@@ -87,7 +87,7 @@
 			uploadImage:uploadImage
 		},
 		onLoad(){
-			console.log(window.location.host);
+			// console.log(window.location.host);
 		},
 		mounted() {
 			this.getAllFeedbackList();

+ 1 - 1
utils/request.js

@@ -8,7 +8,7 @@
 import { URL } from "./requestUrl";
 import { stringify } from 'qs';
 
-const BASE_URL = `${URL}/imed/pfm/`;
+const BASE_URL = `http://${URL}`;
 let AllRequestNum = 0; // 存放请求数,以保证有请求未返回就持续loading
 
 /**

+ 18 - 7
utils/requestUrl.js

@@ -1,8 +1,19 @@
-export const URL = 'http://192.168.51.80:8801'; // 本地
-// export const URL = 'http://192.168.38.174:8088';
-// export const URL = 'http://192.168.1.45:8088'; //内网
-// export const URL = 'http://s1.nsloop.com:5137';  // 外网
-// export const URL = 'http://121.43.139.179:8801';  // 云端服务1
-// export const URL = 'http://172.18.116.20:8801';  // 云端服务2
-
+/*
+ * @Author: your name
+ * @Date: 2021-04-19 15:46:08
+ * @LastEditTime: 2021-04-19 15:49:28
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /web_TracerMethodology/utils/requestUrl.js
+ */
+const base = '192.168.51.80:8801/imed/pfm/';
+export const URL = `//${base}`; // 本地
+// export const URL = '192.168.38.174:8088/imed/pfm/';
+// export const URL = '192.168.1.45:8088/imed/pfm/'; //内网
+// export const URL = 's1.nsloop.com:5137/imed/pfm/';  // 外网
+// export const URL = '121.43.139.179:8801/imed/pfm/';  // 云端服务1
+// export const URL = '172.18.116.20:8801/imed/pfm/';  // 云端服务2
+export const wsURL = (hiId, user, permission) => {
+	return `ws://${base}websocket/${hiId}/${user}/${permission}`;
+}
 

+ 3 - 1
utils/uploadImg.js

@@ -1,14 +1,16 @@
 import { URL } from "./requestUrl.js";
 
 // 上传图片方法(单张/多张上传)
+
 const uploadImage = (params) => {
 	return new Promise((presolve, preject) => {
 		uni.showLoading()
 		let uploads = [];
 		(params.tempFilePaths).forEach((item, i) => {
 			uploads[i] = new Promise((resolve) => {
+				console.log({URL});
 				uni.uploadFile({
-          url: `${URL}/imed/pfm/file/uploadImg`,
+		  url: `${URL}/file/uploadImg`,
           fileType: 'image',
 					filePath: item,
 					name: 'file',

+ 0 - 3
utils/wsUrl.js

@@ -1,3 +0,0 @@
-// export const wsURL = `ws://192.168.1.45:8088/websocket/${hiId}/${user}/${permission}`; // 内网
-export const wsURL = `ws://121.43.139.179:8801/websocket/${hiId}/${user}/${permission}`; // 云端服务1
-// export const wsURL = `ws://172.18.116.20:8801/websocket/${hiId}/${user}/${permission}`; // 云端服务2