Parcourir la source

问卷接口联调完成;我的页面修改等

htc il y a 1 semaine
Parent
commit
964913cc9a
8 fichiers modifiés avec 113 ajouts et 109 suppressions
  1. 2 2
      http/baseApi.js
  2. 2 4
      pages/dialog.vue
  3. 40 17
      pages/my.vue
  4. 21 11
      pages/questionnaire.vue
  5. 44 73
      pages/questionnaireFill.vue
  6. 3 1
      pages/questionnaireResult.vue
  7. BIN
      static/avatar.png
  8. 1 1
      utils/system.js

+ 2 - 2
http/baseApi.js

@@ -1,5 +1,5 @@
-const BaseApi = 'https://glt.ringzle.com:8033/witcarbon-app/app' //线上
-// const BaseApi = 'http://192.168.2.19:9023/witcarbon-app/app' //李勇
+const BaseApi = 'https://transcend.ringzle.com/chuangheng-app/app' //线上
+// const BaseApi = 'http://192.168.2.19:9023/chuangheng-app/app' //李勇
 
 export {
 	BaseApi

+ 2 - 4
pages/dialog.vue

@@ -176,10 +176,7 @@
 						if(newtext){
 							let answer = this.dialogList[this.dialogList.length-1].answer+newtext;
 							this.$set(this.dialogList[this.dialogList.length-1],'answer',answer);
-							uni.pageScrollTo({
-							    scrollTop: 99999,
-							    duration: 300
-							});
+							uni.pageScrollTo({ scrollTop: 99999, duration: 300});
 						}
 					});
 			    });
@@ -228,6 +225,7 @@
 					share:false,
 				}
 				this.dialogList = [...this.dialogList,...[qa]];
+				uni.pageScrollTo({ scrollTop: 99999, duration: 300});
 				this.sendRequestWithRetry();
 				this.question = '';
 			},

+ 40 - 17
pages/my.vue

@@ -2,18 +2,21 @@
 	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
 		<cus-header title='我的' bgColor="transparent" :showback="false"></cus-header>
 		<div class="info adffcacjc">
-			<div class="i_avatar"></div>
-			<div class="i_name">{{'龙傲天'}}</div>
-			<div class="i_phone">手机号:{{'18888888888'}}</div>
+			<div class="i_avatar">
+				<image src="@/static/avatar.png"></image>
+			</div>
+			<div class="i_name">{{userName}}</div>
+			<div class="i_phone">手机号:{{mobile}}</div>
 		</div>
 		<div class="box">
 			<div class="tabs adf">
 				<div class="pre" :class="{'active':tidx===1}" @tap="changeTab(1)">收藏</div>
 				<div class="pre" :class="{'active':tidx===2}" @tap="changeTab(2)">评论</div>
+				<div class="pre" :class="{'active':tidx===3}" @tap="changeTab(3)">报告</div>
 			</div>
 			<div class="list" :style="{'height':'calc(100vh - '+(356+mt)+'px)'}">
 				<block v-if="tidx===1">
-					<u-list @scrolltolower="stCollect">
+					<u-list @scrolltolower="stCollect" v-if="collectList.length">
 						<u-list-item v-for="(item, index) in collectList" :key="index">
 							<div class="l_item adfacjb">
 								<div class="li_l">
@@ -25,16 +28,21 @@
 							</div>
 						</u-list-item>
 					</u-list>
+					<template v-else>
+						<page-empty :height="'calc(100vh - '+(356+mt)+'px)'"></page-empty>
+					</template>
 				</block>
 				<block v-else-if="tidx===2">
-					<div class="l_item" v-for="(item,index) in commentList" :key="index">
-						
-					</div>
-					<u-list @scrolltolower="stComment">
-						<u-list-item v-for="(item, index) in commentList" :key="index">
-							
-						</u-list-item>
-					</u-list>
+					<u-list @scrolltolower="stComment" v-if="commentList.length"></u-list>
+					<template v-else>
+						<page-empty :height="'calc(100vh - '+(356+mt)+'px)'"></page-empty>
+					</template>
+				</block>
+				<block v-else-if="tidx===3">
+					<u-list @scrolltolower="stReport" v-if="reportList.length"></u-list>
+					<template v-else>
+						<page-empty :height="'calc(100vh - '+(356+mt)+'px)'"></page-empty>
+					</template>
 				</block>
 			</div>
 		</div>
@@ -44,13 +52,23 @@
 
 <script>
 	import Tabbar from '@/components/CusTabbar/index.vue'
+	import pageEmpty from '@/components/pageEmpty/index.vue'
 	export default {
-		components:{ Tabbar },
+		components:{ Tabbar, pageEmpty },
 		data(){
 			return {
+				userName:'',
+				mobile:'',
 				tidx:1,
-				collectList:[1],
-				commentList:[1]
+				collectList:[],
+				commentList:[],
+				reportList:[],
+			}
+		},
+		onLoad() {
+			if(uni.getStorageSync('userInfo')){
+				this.userName = JSON.parse(uni.getStorageSync('userInfo')).realName||'';
+				this.mobile = JSON.parse(uni.getStorageSync('userInfo')).mobile||'';
 			}
 		},
 		methods:{
@@ -76,6 +94,11 @@
 				border-radius: 50%;
 				background: #FFFFFF;
 				margin-top: 30rpx;
+				image{
+					width: 100%;
+					height: 100%;
+					border-radius: 50%;
+				}
 			}
 			.i_name{
 				font-family: PingFang-SC, PingFang-SC;
@@ -100,10 +123,10 @@
 			border-radius: 32rpx 32rpx 0 0;
 			background: #FFFFFF;
 			.tabs{
-				padding: 38rpx calc((100% - 500rpx) / 2) 40rpx;
+				padding: 38rpx calc((100% - 510rpx) / 2) 40rpx;
 				border-bottom: 1rpx solid #E5E7EB;
 				.pre{
-					width: 250rpx;
+					width: 170rpx;
 					font-family: PingFang-SC, PingFang-SC;
 					font-weight: bold;
 					font-size: 32rpx;

+ 21 - 11
pages/questionnaire.vue

@@ -9,51 +9,61 @@
 			<div class="list">
 				<div class="l_item" v-for="(item,index) in list" :key="index">
 					<div class="li_top adfacjb">
-						<div class="lt_l">{{'企业员工培训需求调查问卷'}}</div>
+						<div class="lt_l">{{item.title}}</div>
 						<div class="lt_r" :class="{'dcy':item.status===0,'ycy':item.status===1}">{{item.status===0?'待参与':item.status===1?'已参与':''}}</div>
 					</div>
 					<div class="li_text">
-						所属项目:<span>{{'合肥市传秀科技有限公司'}}</span>
+						所属项目:<span>{{item.enterpriseName}}</span>
 					</div>
 					<div class="li_text">
-						所属团队:<span>{{'研发团队'}}</span>
+						所属团队:<span>{{item.teamName}}</span>
 					</div>
 					<div class="li_bottom adfacjb">
-						<div class="lb_l">截止时间:{{ '2025-05-28 24:00:00'}}</div>
+						<div class="lb_l">截止时间:{{ item.endTime}}</div>
 						<div class="lb_r">
-							<div class="lr_btn" @tap="" v-if="item.status===0" @tap="toFill">立即作答</div>
+							<div class="lr_btn" @tap="" v-if="item.status===0" @tap="toFill(item)">立即作答</div>
 							<div class="lr_btn" @tap="" v-if="item.status===1" @tap="toRepoer">查看报告</div>
 						</div>
 					</div>
 				</div>
 			</div>
 		</template>
+		<template v-else>
+			<page-empty :height="'calc(100vh - 200px)'"></page-empty>
+		</template>
 		<Tabbar :tabbarIndex="1"></Tabbar>
 	</view>
 </template>
 
 <script>
 	import Tabbar from '@/components/CusTabbar/index.vue'
+	import pageEmpty from '@/components/pageEmpty/index.vue'
 	export default {
-		components:{ Tabbar },
+		components:{ Tabbar, pageEmpty },
 		data(){
 			return {
 				tidx:1,
-				dataList:[{status:0},{status:1}],
 				list:[]
 			}
 		},
 		onLoad() {
-			this.list = JSON.parse(JSON.stringify(this.dataList)).filter(d=>d.status===0)
+			this.getList();
 		},
 		methods:{
+			getList(){
+				this.$api.get('/core/teammember/que/listByUser').then(res=>{
+					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					this.list = res.data.data.filter(d=>d.status===this.tidx-1)
+				})
+			},
 			changeTab(index){
 				this.tidx = index;
-				this.list = JSON.parse(JSON.stringify(this.dataList)).filter(d=>d.status===index-1)
+				this.getList();
 			},
-			toFill(){
+			toFill(item){
+				if(Date.parse(new Date())-Date.parse(item.endTime)>0) return this.$showToast('已过截止时间,无法作答!')
 				uni.navigateTo({
-					url:'/pages/questionnaireFill'
+					url:`/pages/questionnaireFill?teamQuestionnaireId=${item.teamQuestionnaireId}&title=${item.title}`
 				})
 			},
 			toRepoer(){

+ 44 - 73
pages/questionnaireFill.vue

@@ -2,43 +2,22 @@
 	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
 		<cus-header title='问卷填写'></cus-header>
 		<div class="top adffcacjc">
-			<p>{{'企业员工培训需求调查问卷'}}</p>
-			<p class="tip">共 <span>{{36}}</span> 题,请耐心选择!</p>
+			<p>{{title}}</p>
+			<p class="tip">共 <span>{{list.length}}</span> 题,请耐心选择!</p>
 		</div>
 		<div class="list" :style="{'height':(h-180-mt)+'px'}">
 			<div class="l_item" v-for="(item,index) in list" :key="index">
 				<div class="li_box" :class="{'active':item.warn}">
-					<div class="lb_title adfac">
+					<div class="lb_title adf">
 						<span>*</span>
 						{{index+1}}. {{item.question}}
-						<text v-if="item.type===2">【多选题】</text>
 					</div>
-					<div class="lb_answers" v-if="[1,2].includes(item.type)">
-						<template v-if="item.type===1">
-							<u-radio-group v-model="item.answer" placement="column">
-								<div class="la_item" v-for="(pre,idx) in item.answers" :key="idx">
-									<u-radio :label="pre.name" :name="pre.name" activeColor="#833478" size="36rpx" iconSize="32rpx" labelSize="32rpx"></u-radio>
-								</div>
-							</u-radio-group>
-						</template>
-						<template v-else-if="item.type===2">
-							<u-checkbox-group v-model="item.answer" placement="column">
-								<div class="la_item" v-for="(pre,idx) in item.answers" :key="idx">
-									<u-checkbox :label="pre.name" :name="pre.name" activeColor="#833478" size="36rpx" iconSize="32rpx" labelSize="32rpx"></u-checkbox>
-								</div>
-							</u-checkbox-group>
-						</template>
-					</div>
-					<template v-if="item.type===3">
-						<div class="la_inp adfac">
-							<u--input placeholder="请输入" border="none" v-model="item.answer"></u--input>
-						</div>
-					</template>
-					<div class="la_warn adfac" v-if="item.type===2&&item.warn">
-						<div class="lw adffcacjc">
-							<u-icon name="close" color="#FFFFFF" size="23rpx"></u-icon>
-						</div>
-						<span>此题最少要选择{{item.limit}}项,您少选择了{{item.limit-(item.answer.length||0)}}项</span>
+					<div class="lb_answers">
+						<u-radio-group v-model="item.answer" placement="column">
+							<div class="la_item" v-for="(pre,idx) in item.userAnswer" :key="idx">
+								<u-radio :label="pre.questionOption" :name="pre.questionOption" activeColor="#833478" size="36rpx" iconSize="32rpx" labelSize="32rpx"></u-radio>
+							</div>
+						</u-radio-group>
 					</div>
 				</div>
 			</div>
@@ -53,56 +32,48 @@
 	export default {
 		data(){
 			return {
-				list:[
-					{
-						question:'您所在的部门是哪个?',
-						answer:'',
-						answers:[
-							{name:'A 人力资源部'},
-							{name:'B 财务部'},
-							{name:'C 市场部'},
-							{name:'D 技术部'},
-							{name:'E 其他'},
-						],
-						type:1, //1 单选;2 多选; 3 输入
-						warn:false
-					},
-					{
-						question:'您的工作年限是?',
-						answer:'',
-						answers:[
-							{name:'A 1年以下'},
-							{name:'B 1-3年'},
-							{name:'C 3-5年'},
-							{name:'D 5年以上'},
-						],
-						type:2,
-						limit:2,
-						warn:false
-					},
-					{
-						question:'您的收入是?',
-						answer:'',
-						type:3,
-						warn:false
-					}
-				]
+				title:'',
+				teamQuestionnaireId:'',
+				list:[]
 			}
 		},
+		onLoad(option) {
+			this.title = option.title;
+			this.teamQuestionnaireId = option.teamQuestionnaireId;
+			this.getList();
+		},
 		methods:{
+			getList(){
+				this.$api.get('/core/team/member/answer/listByUser/'+this.teamQuestionnaireId).then(res=>{
+					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					this.list = res.data.data;
+					this.list.forEach((l,i)=>{
+						this.$set(this.list[i],'warn',false);
+						this.$set(this.list[i],'answer','');
+					})
+				})
+			},
 			submitWj(){
 				this.list.forEach((l,i)=>{
-					if(l.type===2){
-						this.$set(this.list[i],'warn',l.answer.length<l.limit)
-					}else{
-						this.$set(this.list[i],'warn',!l.answer?true:false)
-					}
+					this.$set(this.list[i],'warn',!l.answer?true:false)
 				})
-				if(this.list.find(l=>l.warn)) return
-				uni.navigateTo({
-					url:'/pages/questionnaireResult'
+				let idx = this.list.findIndex(l=>l.warn);
+				if(idx>-1) return this.$showModal(`第${idx+1}项未选择答案,请选择。`)
+				let newList = JSON.parse(JSON.stringify(this.list));
+				newList.forEach(l=>{
+					l.isAnswer = '1';
+					let i = l.userAnswer.findIndex(a=>a.questionOption===l.answer)
+					if(i>-1) l.userAnswer[i].userAnswer = true;
+					delete l.answer
+					delete l.warn
 				})
-			},
+				this.$api.post('/core/team/member/answer/submit',newList).then(res=>{
+					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					uni.navigateTo({
+						url:'/pages/questionnaireResult'
+					})
+				})
+			}
 		}
 	}
 </script>

+ 3 - 1
pages/questionnaireResult.vue

@@ -21,7 +21,9 @@
 		},
 		methods:{
 			toBack(){
-				uni.navigateBack();
+				uni.reLaunch({
+					url:'/pages/questionnaire'
+				})
 			},
 			reviewRepoer(){
 				

BIN
static/avatar.png


+ 1 - 1
utils/system.js

@@ -7,7 +7,7 @@ export default {
 			imgBase:this.$imgBase
 		}
 	},
-	onShow(){
+	onShow(){
 		uni.getSystemInfo({
 			success:res=>{
 				if(res.platform === 'android'){