jiehuo.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="">
  3. <u-navbar :is-back="false" :border-bottom="false" :background="background">
  4. <view style="width: 100%;">
  5. <view class="fzctob" style="padding: 0 30rpx;">
  6. <image src="/static/index/inua.png"
  7. style="width: 24rpx;height: 24rpx;min-width: 24rpx;margin-right: 10rpx;" mode=""></image>
  8. <view class="jhuudd">
  9. <text>北京市</text>
  10. </view>
  11. </view>
  12. </view>
  13. </u-navbar>
  14. <view class="inbddwwer">
  15. <view class="fzctob inbddwddre">
  16. <image src="/static/index/ina1.png"
  17. style="width: 40rpx;height: 40rpx;min-width: 40rpx;margin-right: 12rpx;"></image>
  18. <input type="text" value="" placeholder-style="color: #CCCCCC;font-size: 28rpx;" placeholder="搜索你感兴趣的内容"
  19. v-model="search" @confirm="getlist" />
  20. </view>
  21. </view>
  22. <u-tabs :list="classifylist" :current="current" @change="change"></u-tabs>
  23. <view class="">
  24. <view class="fsxto jhkanuy" hover-class="none" v-for="(item,index) in list"
  25. :key="index" @click="gopl(item.id)">
  26. <view class="fzctob">
  27. <view class="jhuuimg">
  28. <image :src="item.avatarUrl"
  29. style="width: 88rpx;height: 88rpx;min-width: 88rpx;border-radius: 200rpx;" mode=""></image>
  30. </view>
  31. <view class="fsxto" style="width: 100%;margin-left: 12rpx;">
  32. <view class="flztoa">
  33. <text class="jhtxty">{{item.nickName}}</text>
  34. <text class="jhtxtya">{{$u.timeFormat(item.create_time, 'yyyy:mm:dd hh:MM:ss')}}</text>
  35. </view>
  36. <view class="jhtxtyb">
  37. <text>{{item.note}}</text>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="jhtxtyc">
  42. <text>{{item.content}}</text>
  43. </view>
  44. <view class="flztoa" style="margin-top: 30rpx;">
  45. <view class="fzctob">
  46. <image :src="item.is_like == 1?'/static/index/w1.png':'/static/index/w2.png'" style="width: 48rpx;height: 48rpx;min-width: 48rpx;" mode=""></image>
  47. <text class="shitxty">{{item.like_num}}</text>
  48. <view style="margin-left: 40rpx;">
  49. <image src="/static/index/w3.png" style="width: 48rpx;height: 48rpx;min-width: 48rpx;"
  50. mode=""></image>
  51. </view>
  52. </view>
  53. <!-- <view class="">
  54. <text class="shitxtya">2021.06.15</text>
  55. </view> -->
  56. </view>
  57. </view>
  58. </view>
  59. <view class="youjdje" @click="show = true">
  60. <image src="/static/index/inr2.png" style="width: 96rpx;height: 96rpx;min-width: 96rpx;" mode=""></image>
  61. </view>
  62. <view style="height: 120rpx;"></view>
  63. <view class="dibuboot">
  64. <navigator class="dibubootlb" url="../index/index" open-type="redirect" hover-class="none">
  65. <image src="/static/dibu/boa1.png" style="width: 48rpx;height: 48rpx;"></image>
  66. <text>首页</text>
  67. </navigator>
  68. <!-- <navigator class="dibubootlb" url="../lecturer/wdzx" open-type="redirect" hover-class="none">
  69. <image src="/static/dibu/boa2.png" style="width: 48rpx;height: 48rpx;"></image>
  70. <text>咨询</text>
  71. </navigator>
  72. <navigator class="dibubootlb" url="../index/jiehuo" open-type="redirect" hover-class="none">
  73. <image src="/static/dibu/bob3.png" style="width: 48rpx;height: 48rpx;"></image>
  74. <text style="color: #374B6E">解惑</text>
  75. </navigator> -->
  76. <navigator class="dibubootlb" url="../lecturer/my" open-type="redirect" hover-class="none">
  77. <image src="/static/dibu/boa4.png" style="width: 48rpx;height: 48rpx;"></image>
  78. <text>我的</text>
  79. </navigator>
  80. </view>
  81. <u-popup v-model="show" mode="bottom" border-radius="20">
  82. <view class="title">发表解惑</view>
  83. <view class="choicebox">
  84. <view :class="item.id == type_id?'item-a':'item'" v-for="(item,index) in classifylist" :key="index"
  85. @click="changeid(item.id)">{{item.name}}</view>
  86. </view>
  87. <textarea placeholder="请输入您的疑惑" v-model="content"></textarea>
  88. <view class="btn" @click="publish">发布疑惑</view>
  89. </u-popup>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. background: {
  97. backgroundColor: '#ffffff',
  98. },
  99. hhyanm: {
  100. color: '#FFFFFF',
  101. },
  102. search: '',
  103. show: false,
  104. classifylist: [],
  105. current: 0,
  106. list: [],
  107. content: '', //用户输入的内容
  108. user_id: '', //用户id
  109. type_id: '' //选择的分类
  110. }
  111. },
  112. onLoad() {
  113. this.user_id = uni.getStorageSync('id');
  114. this.getclassify();
  115. },
  116. methods: {
  117. change(index) {
  118. this.search = '';
  119. this.current = index;
  120. this.getlist();
  121. },
  122. changeid(id) {
  123. this.type_id = id
  124. },
  125. // 获取资讯列表
  126. getclassify() {
  127. this.$post({
  128. data: {
  129. do: 'getQuestionType'
  130. }
  131. }).then(res => {
  132. this.classifylist = res.data
  133. this.type_id = res.data[0].id
  134. this.getlist();
  135. })
  136. },
  137. //获取解惑列表
  138. getlist() {
  139. let that = this;
  140. this.$post({
  141. data: {
  142. do: 'SearchQuestionList',
  143. data: {
  144. search: that.search,
  145. type_id: that.classifylist[that.current].id,
  146. user_id: that.user_id
  147. }
  148. }
  149. }).then(res => {
  150. this.list = res.data
  151. })
  152. },
  153. //发表疑惑
  154. publish() {
  155. let that = this;
  156. uni.showModal({
  157. title: '提示',
  158. content: '确定发表吗?',
  159. success: function(res) {
  160. if (res.confirm) {
  161. that.$post({
  162. data: {
  163. do: 'AskQuestion',
  164. data: {
  165. content: that.content,
  166. user_id: that.user_id,
  167. type_id: that.type_id
  168. }
  169. }
  170. }).then(res => {
  171. uni.showToast({
  172. title: '发表成功'
  173. })
  174. that.content = '';
  175. that.show = false
  176. that.getlist();
  177. })
  178. }
  179. }
  180. });
  181. },
  182. gopl(id){
  183. uni.navigateTo({
  184. url:'./jiehuo-pl?id=' + id + '&user_id=' + this.user_id
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. page {
  192. background: #FAFAFA;
  193. }
  194. .title {
  195. width: 100%;
  196. text-align: center;
  197. font-size: 34upx;
  198. color: #000000;
  199. margin: 30upx auto;
  200. }
  201. .choicebox {
  202. width: 690upx;
  203. margin: 0 auto;
  204. display: flex;
  205. flex-wrap: wrap;
  206. .item {
  207. width: 160upx;
  208. height: 65upx;
  209. font-size: 28upx;
  210. background: #F4F4F4;
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. border-radius: 50upx;
  215. margin-right: 10upx;
  216. margin-bottom: 10upx;
  217. }
  218. .item-a {
  219. width: 160upx;
  220. height: 65upx;
  221. font-size: 28upx;
  222. background: #374B6E;
  223. color: #ffffff;
  224. display: flex;
  225. align-items: center;
  226. justify-content: center;
  227. border-radius: 50upx;
  228. margin-right: 10upx;
  229. margin-bottom: 10upx;
  230. }
  231. }
  232. textarea {
  233. width: 690upx;
  234. height: 500upx;
  235. border-radius: 16upx 16upx 16upx 16upx;
  236. border: 2upx solid #CCCCCC;
  237. margin: 0 auto;
  238. box-sizing: border-box;
  239. padding: 30upx;
  240. margin-top: 30upx;
  241. }
  242. .btn {
  243. width: 462upx;
  244. height: 96upx;
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. background: #374B6E;
  249. color: #ffffff;
  250. border-radius: 50upx;
  251. margin: 50upx auto;
  252. }
  253. </style>