questionnaire.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class="default_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header :title='title' bgColor="transparent"></cus-header>
  4. <image class="top_bg" :src="imgBase+'questionnaire_top_bg.png'" mode="widthFix"></image>
  5. <!-- <view class="tab adfac">
  6. <view class="tab-pre" :class="{'active':tindex===0}" @click="changeTab(0)">我收到的</view>
  7. <view class="tab-pre" :class="{'active':tindex===1}" @click="changeTab(1)">我创建的</view>
  8. </view> -->
  9. <view class="query adfacjb">
  10. <u-icon name="search" size="42rpx" color="#B3BFC8"></u-icon>
  11. <view class="query-inp">
  12. <u-input v-model="keyword" border="none" fontSize="28rpx" color="#002846" confirmType="search"
  13. placeholder="请输入团队名称查询" @confirm="getList"></u-input>
  14. </view>
  15. <view class="query-right" @click="getList">搜索</view>
  16. </view>
  17. <view class="box">
  18. <template v-if="tindex===0">
  19. <receive-list :list="receiveList" @scrolltolower="receiveScrolltolower" @showDialogFn="showDialog"></receive-list>
  20. </template>
  21. <template v-else-if="tindex===1">
  22. <create-list :list="createList" @scrolltolower="createScrolltolower" @showDialogFn="showDialog"></create-list>
  23. </template>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import ReceiveList from './components/receiveList.vue'
  29. import CreateList from './components/createList.vue'
  30. export default {
  31. components:{ ReceiveList, CreateList },
  32. data(){
  33. return {
  34. title:'我创建的问卷',
  35. tindex:0,
  36. keyword:'',
  37. receiveList:[],
  38. createList:[],
  39. teamUserShow:false,
  40. dto:null
  41. }
  42. },
  43. onShareAppMessage(res) {
  44. const sharerId = JSON.parse(uni.getStorageSync('userInfo'))?.id||'';
  45. return {
  46. title: this.dto.title || '发现一个好物,分享给你!',
  47. path: `/pages/home?shareTQId=${this.dto.teamQuestionnaireId}&shareUserId=${sharerId}&shareType=Questionnaire`,
  48. imageUrl: this.$imgBase+'share_fm.png'
  49. };
  50. },
  51. onShow() {
  52. if(this.tindex===0){
  53. this.receiveList = [];
  54. this.getReceiveList();
  55. }else if(this.tindex===1){
  56. this.createList = [];
  57. this.getCreateList();
  58. }
  59. },
  60. onLoad(options) {
  61. if(options.type==='receive'){
  62. this.title = '我收到的问卷';
  63. this.tindex = 0;
  64. this.receiveList = [];
  65. this.getReceiveList();
  66. }
  67. else if(options.type==='create'){
  68. this.title = '我创建的问卷';
  69. this.tindex = 1;
  70. this.createList = [];
  71. this.getCreateList();
  72. }
  73. },
  74. methods:{
  75. showDialog(dto){
  76. this.dto = dto;
  77. },
  78. changeTab(index){
  79. if(this.tindex===index) return
  80. this.tindex = index;
  81. if(index===0){
  82. this.receiveList = [];
  83. this.getReceiveList();
  84. }else if(index===1){
  85. this.createList = [];
  86. this.getCreateList();
  87. }
  88. },
  89. getList(){
  90. let index = this.tindex;
  91. if(index===0){
  92. this.receiveList = [];
  93. this.getReceiveList();
  94. }else if(index===1){
  95. this.createList = [];
  96. this.getCreateList();
  97. }
  98. },
  99. getReceiveList(){
  100. this.$api.get('/core/teammember/que/personalList',{teamName:this.keyword}).then(({data:res})=>{
  101. if(res.code!==0) return this.$showToast(res.msg)
  102. this.receiveList = res.data||[];
  103. if(this.receiveList.length===0) return this.$showToast('暂无数据')
  104. })
  105. },
  106. getCreateList(){
  107. this.$api.get('/core/teammember/que/createList',{teamName:this.keyword}).then(({data:res})=>{
  108. if(res.code!==0) return this.$showToast(res.msg)
  109. this.createList = res.data;
  110. if(this.createList.length===0) return this.$showToast('暂无数据')
  111. })
  112. },
  113. receiveScrolltolower(){
  114. console.log(1);
  115. },
  116. createScrolltolower(){
  117. console.log(2);
  118. }
  119. }
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .default_page{
  124. padding: 0 24rpx 40rpx;
  125. background: #F7F7F7;
  126. box-sizing: border-box;
  127. .top_bg{
  128. width: 100%;
  129. position: absolute;
  130. left: 0;
  131. top: 0;
  132. }
  133. .query{
  134. width: calc(100% - 12rpx);
  135. margin: 40rpx 6rpx 0;
  136. height: 72rpx;
  137. background: #FFFFFF;
  138. border-radius: 36rpx;
  139. padding: 0 36rpx;
  140. box-sizing: border-box;
  141. position: relative;
  142. &-inp{
  143. flex: 1;
  144. padding: 0 20rpx;
  145. box-sizing: border-box;
  146. }
  147. &-right{
  148. font-size: 28rpx;
  149. color: #33A7A7;
  150. padding-left: 20rpx;
  151. position: relative;
  152. &::before{
  153. content: '';
  154. width: 1rpx;
  155. height: 30rpx;
  156. background: rgba(51, 167, 167, .5);
  157. position: absolute;
  158. left: 0;
  159. top: 50%;
  160. margin-top: -15rpx;
  161. }
  162. }
  163. }
  164. .box{
  165. flex: 1;
  166. overflow-y: auto;
  167. margin-top: 20rpx;
  168. }
  169. .tab{
  170. margin-top: 20rpx;
  171. position: relative;
  172. &-pre{
  173. width: 50%;
  174. font-family: PingFangSC, PingFang SC;
  175. font-weight: 400;
  176. font-size: 30rpx;
  177. color: #002846;
  178. line-height: 42rpx;
  179. text-align: center;
  180. &.active{
  181. font-weight: bold;
  182. font-size: 32rpx;
  183. line-height: 45rpx;
  184. position: relative;
  185. &::after{
  186. content: '';
  187. width: 48rpx;
  188. height: 6rpx;
  189. background: linear-gradient( 90deg, #33A7A7 0%, #64BBBB 100%);;
  190. border-radius: 9rpx;
  191. position: absolute;
  192. left: 50%;
  193. margin-left: -24rpx;
  194. bottom: -22rpx;
  195. }
  196. }
  197. }
  198. }
  199. }
  200. </style>