myMsg.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view>
  3. <navbar :config="config" backColor="#666666">
  4. <template v-slot:right>
  5. <image class="clear" @click="clearNews" src="/static/czd/clear.png" mode=""></image>
  6. <image @click="goNewsSet" class="setting" src="/static/czd/set1.png" mode=""></image>
  7. </template>
  8. </navbar>
  9. <view class="garyBox"></view>
  10. <view class="box">
  11. <view class="item" v-for="(v,i) in list" :key="i" @click="goNewDetails(v)">
  12. <image v-if="v.typeMsg=='应用消息'" class="yy" src="/static/czd/yy.png" mode=""></image>
  13. <view class="xt" v-if="v.typeMsg=='系统消息'">
  14. <u-icon name="setting" size="56" color="#fff"></u-icon>
  15. </view>
  16. <view class="item_r">
  17. <view class="item_r_t" :class="v.unread?'dian':''">
  18. <view class="item_r_t_title">{{v.typeMsg}}</view>
  19. <view class="item_r_t_date">{{v.createTime}}</view>
  20. </view>
  21. <view class="item_r_b">{{v.title}}</view>
  22. </view>
  23. </view>
  24. <view class="item" @click="goShopNews()">
  25. <image class="sc" src="/static/czd/sc.png" mode=""></image>
  26. <view class="item_r" :class="shopNews.unread?'dian':''">
  27. <view class="item_r_t">
  28. <view class="item_r_t_title">商城消息</view>
  29. <view class="item_r_t_date"></view>
  30. </view>
  31. <!-- <view class="item_r_b">暂无消息</view> -->
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. config: {
  42. back: true, //false是tolbar页面 是则不写
  43. title: '我的消息',
  44. color: '#1A1A1A',
  45. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  46. // backgroundColor: [0, '#2cba28'],
  47. rightSlot: true,
  48. },
  49. list:[],
  50. messageConfig:false,
  51. shopNews:{}
  52. }
  53. },
  54. onLoad(options) {
  55. if(options.messageConfig){
  56. this.messageConfig=options.messageConfig
  57. }
  58. },
  59. onShow() {
  60. this.getList();
  61. this.getShopNewsNum()
  62. },
  63. methods:{
  64. // 获取我的类型分组
  65. getList(){
  66. this.$yghttp.get('/message/myTypeGroup').then(res=>{
  67. this.list=res.data
  68. })
  69. },
  70. goNewDetails(item){
  71. uni.navigateTo({
  72. url:'/pages/government/newDetails?type='+item.type
  73. })
  74. },
  75. goNewsSet(){
  76. uni.navigateTo({
  77. url:'/pages/government/newsSet'
  78. })
  79. },
  80. goShopNews(){
  81. uni.navigateTo({
  82. url:'/pages/research/setup/myMsg'
  83. })
  84. },
  85. // 获取商城消息未读信息
  86. getShopNewsNum(){
  87. this.$http.get('/private/message/myTypeGroup').then(res=>{
  88. this.shopNews=res.data
  89. })
  90. },
  91. // 全部已读
  92. clearNews(){
  93. uni.showLoading({
  94. title: '',
  95. mask: true
  96. });
  97. this.$yghttp.post('/message/allRead').then(res=>{
  98. this.getList()
  99. uni.hideLoading()
  100. }).catch(()=>{
  101. uni.hideLoading()
  102. })
  103. }
  104. }
  105. }
  106. </script>
  107. <style>
  108. page {
  109. background-color: #F8F8F8;
  110. }
  111. </style>
  112. <style lang="scss">
  113. /deep/ .hx_text_overflow {
  114. font-weight: bold;
  115. }
  116. .garyBox {
  117. width: 100%;
  118. height: 20rpx;
  119. background: rgb(239, 239, 239);
  120. }
  121. .box {
  122. background: #fff;
  123. padding:0 30rpx;
  124. .item{
  125. display: flex;
  126. padding: 30rpx 0;
  127. border-bottom: 1rpx solid rgb(239, 239, 239);
  128. position: relative;
  129. // image{
  130. // width: 80rpx;
  131. // height: 80rpx;
  132. // border-radius: 40rpx;
  133. // }
  134. &:before{
  135. content: "";
  136. display: block;
  137. width: 120rpx;
  138. height: 10rpx;
  139. background: #fff;
  140. position: absolute;
  141. bottom: -5rpx;
  142. left: 0;
  143. }
  144. .yy{
  145. width: 100rpx;
  146. height: 100rpx;
  147. }
  148. .sc{
  149. width: 100rpx;
  150. height: 110rpx;
  151. }
  152. .xt{
  153. width: 100rpx;
  154. height: 100rpx;
  155. background: rgb(62,192,211);
  156. border-radius: 20rpx;
  157. display: flex;
  158. align-items: center;
  159. justify-content: center;
  160. }
  161. .item_r{
  162. flex: 1;
  163. margin-left: 20rpx;
  164. .item_r_t{
  165. display: flex;
  166. justify-content: space-between;
  167. margin-top: 6rpx;
  168. .item_r_t_title{
  169. font-size: 32rpx;
  170. font-weight: 700;
  171. }
  172. .item_r_t_date{
  173. font-size: 28rpx;
  174. color: rgb(142,142,142);
  175. }
  176. }
  177. .item_r_b{
  178. color: rgb(142,142,142);
  179. margin-top: 6rpx;
  180. }
  181. }
  182. }
  183. }
  184. .dian{
  185. position: relative;
  186. &::before{
  187. content: "";
  188. display: block;
  189. width: 15rpx;
  190. height: 15rpx;
  191. border-radius: 50%;
  192. background: rgb(240,74,62);
  193. position: absolute;
  194. top: -10rpx;
  195. right: -10rpx;
  196. }
  197. }
  198. .setting{
  199. width: 44rpx;
  200. height: 42rpx;
  201. margin-right: 20rpx;
  202. }
  203. .clear{
  204. width: 24rpx;
  205. height: 32rpx;
  206. position: relative;
  207. left: -200rpx;
  208. }
  209. </style>