msg.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="msg">
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="top">
  5. <view class="left" @click="puMsg" :class="current == 0 ? info1 : info2">
  6. <text class="">消息通知</text>
  7. <view v-if="current == 0" class="yun">
  8. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
  9. mode="aspectFill"></image>
  10. </view>
  11. </view>
  12. <view class="right" @click="sysMsg" :class="current == 1 ? info1 : info2">
  13. <text class="">系统通知</text>
  14. <view v-if="current == 1" class="yun">
  15. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//yym/Ellipse 10.png"
  16. mode="aspectFill"></image>
  17. </view>
  18. </view>
  19. </view>
  20. <swiper class="scroll-view-height" @change="swipeIndex" :current="current" :duration="300">
  21. <swiper-item>
  22. <scroll-view scroll-y="true" style="height: 100%;">
  23. <view class="">
  24. <view class="" v-for="(item,index) in Msglist" :key="index">
  25. <view class="msgBlock" v-if="item.type==0">
  26. <view class="tit">
  27. <view>活动报名成功</view>
  28. <view class="msgtime">
  29. {{item.create_at}}
  30. </view>
  31. </view>
  32. <view class="contxt">恭喜!您已成功完成<text style="color: rgba(0, 86, 168, 1);">“{{item.acName}}”</text>活动报名。您的参与信息已经成功提交,您现在是我们活动的一部分,我们非常期待与您共度美好时光。</view>
  33. <view class="contxt">
  34. 以下是一些额外信息,以确保您充分了解您的参与:
  35. </view>
  36. <view class="contxt1" style="display: flex;">
  37. <view class="" style="width: 2em;text-align: center;">•</view>
  38. <view class=""> 活动名称: [{{item.acName}}]</view>
  39. </view>
  40. <view class="contxt1" style="display: flex;">
  41. <view class="" style="width: 2em;text-align: center;">•</view>
  42. <view class=""> 日期: [×××]</view>
  43. </view>
  44. <view class="contxt1" style="display: flex;">
  45. <view class="" style="width: 2em;text-align: center;">•</view>
  46. <!-- <view class=""> 时间: [{{item.begin_at}}]</view> -->
  47. <view class=""> 时间: [×××]</view>
  48. </view>
  49. <view class="contxt1" style="display: flex;">
  50. <view class="" style="width: 2em;text-align: center;">•</view>
  51. <view class=""> 地点: [{{item.address}}]</view>
  52. </view>
  53. </view>
  54. <view class="msgBlock" v-if="item.type==1">
  55. <view class="tit">
  56. <view>活动开始提醒</view>
  57. <text class="msgtime">{{item.create_at}}</text>
  58. </view>
  59. <view class="contxt">
  60. <text style="color: rgba(0, 86, 168, 1);">“丽湖职教双创教育国际虚拟教研室 • 常规教研活动 第9期”</text>活动现在已经在我们的平台上正式上线,欢迎您点击浏览和积极参加。不要错过这个令人兴奋的机会,我们期待着与您一同度过难忘的时光。点击活动名称进入活动详情哦!
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- <view class="loading">
  66. <view v-if="clLoading==1">数据加载中...</view>
  67. <view v-if="clLoading==2">没有更多了~~</view>
  68. </view> -->
  69. </scroll-view>
  70. </swiper-item>
  71. <swiper-item>
  72. <scroll-view scroll-y="true" style="height: 100%;">
  73. <view class="">
  74. <view class="" v-for="(item,index) in Msglist" :key="index">
  75. <view class="msgBlock" v-if="item.type==2">
  76. <view class="tit">
  77. <view>恭喜您,成功加入会员</view>
  78. <text class="msgtime">{{item.create_at}}</text>
  79. </view>
  80. <view class="contxt1">
  81. 尊敬的<text style="color: rgba(0, 86, 168, 1);">{{item.username}}</text>,
  82. </view>
  83. <view class="contxt">
  84. 我们很高兴通知您,您已成功加入<text style="color: rgba(0, 86, 168, 1);">[XXX小程序会员]</text>!欢迎加入我们的团队,我们期待与您一同合作并参与。
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <!-- <view class="loading">
  90. <view v-if="sysLoading==1">数据加载中...</view>
  91. <view v-if="sysLoading==2">没有更多了~~</view>
  92. </view> -->
  93. </scroll-view>
  94. </swiper-item>
  95. </swiper>
  96. </view>
  97. </template>
  98. <script>
  99. export default {
  100. data() {
  101. return {
  102. navBarData: {
  103. title: '活动消息',
  104. btn: 1
  105. },
  106. Msglist:[],
  107. currentPage:1,
  108. current: 0, //登录方式切换
  109. info1: "info1", //类名
  110. info2: "info2",
  111. };
  112. },
  113. methods:{
  114. // 获取数据
  115. getdata() {
  116. let data = {
  117. oid: this.$store.state.user.openid, //用户id
  118. page: this.currentPage,
  119. lim: 30
  120. }
  121. this.$request('/selectMessage', "POST", data).then(res => {
  122. console.log('获取', res);
  123. // this.list = [this.list,...res[0]]
  124. this.Msglist = res[0]
  125. // console.log('获取',this.list);
  126. })
  127. },
  128. // 更新已读
  129. updateisread() {
  130. let data = {
  131. oid: this.$store.state.user.openid, //用户id
  132. // type: 2,
  133. }
  134. this.$request('/updateIsRead', "POST", data).then(res => {
  135. // console.log('获取', res);
  136. })
  137. },
  138. puMsg(){
  139. this.current =0;
  140. },
  141. sysMsg(){
  142. this.current = 1;
  143. },
  144. swipeIndex(index) {
  145. this.current = index.detail.current;
  146. },
  147. },
  148. onShow() {
  149. this.getdata()
  150. this.updateisread()
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. .msg {
  156. display: flex;
  157. flex-direction: column;
  158. flex: 1;
  159. justify-content: space-between;
  160. width: 750rpx;
  161. height: 100vh;
  162. .loading {
  163. height: 30rpx;
  164. text-align: center;
  165. padding-top: 20rpx;
  166. padding-bottom: 100rpx;
  167. font-size: 26rpx;
  168. color: #888;
  169. line-height: 2em;
  170. }
  171. .top {
  172. display: flex;
  173. justify-content: space-between;
  174. margin: auto;
  175. width: 100%;
  176. background-color: #ffffff;
  177. padding: 10px 20%;
  178. .info1 {
  179. font-weight: bold !important;
  180. position: relative;
  181. color: rgba(0, 0, 0, 0.8);
  182. font-size: 34rpx;
  183. line-height: 48rpx;
  184. width: 136rpx;
  185. height: 48rpx;
  186. text-align: center;
  187. .yun {
  188. width: 134rpx;
  189. height: 32rpx;
  190. position: absolute;
  191. left: 0;
  192. bottom: -10rpx;
  193. image {
  194. width: 100%;
  195. height: 100%;
  196. }
  197. }
  198. }
  199. .info2 {
  200. color: rgba(0, 0, 0, 0.6);
  201. font-size: 34rpx;
  202. font-weight: 400;
  203. line-height: 48rpx;
  204. width: 136rpx;
  205. height: 48rpx;
  206. text-align: center;
  207. font-family: 微软雅黑;
  208. }
  209. }
  210. .scroll-view-height {
  211. padding: 20rpx 0;
  212. flex: 1;
  213. .msgBlock{
  214. width: 720rpx;
  215. margin: auto;
  216. background-color: #ffffff;
  217. border-radius: 12px;
  218. padding: 28rpx 24rpx 32rpx 24rpx;
  219. margin-bottom: 20rpx;
  220. .tit{
  221. font-size: 34rpx;
  222. font-weight: 400;
  223. height: 48rpx;
  224. line-height: 48rpx;
  225. margin-bottom: 20rpx;
  226. color: rgba(0, 0, 0, 0.8);
  227. display: flex;
  228. justify-content: space-between;
  229. .msgtime{
  230. line-height: 58rpx;
  231. font-size: 28rpx;
  232. color: rgba(0, 0, 0, 0.4);
  233. }
  234. }
  235. .contxt{
  236. text-indent: 2em;
  237. color: rgba(0, 0, 0, 0.6);
  238. font-size: 28rpx;
  239. line-height: 40rpx;
  240. }
  241. .contxt1{
  242. color: rgba(0, 0, 0, 0.6);
  243. font-size: 28rpx;
  244. line-height: 40rpx;
  245. }
  246. }
  247. }
  248. }
  249. </style>