myNotice.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view>
  3. <view class="TUI-conversation-item" :style="{alignItems: item.mytype!='other' ?'flex-start':'center'}" @click.stop="handleDetail(item)">
  4. <aside class="left">
  5. <image mode="aspectFill" class="avatar" v-if="item.mytype!='other'" src="@/static/svg/course_icon.svg" />
  6. <image mode="aspectFill" class="avatar" v-else src="@/static/svg/msg_icon.svg" />
  7. <span class="new" v-if="item.isRead != 1&&item.mytype!='other'"></span>
  8. <!-- <span class="new" v-if="item.unReadNum&&item.mytype=='other'"></span> -->
  9. <span class="num" v-if="item.unReadNum&&item.mytype=='other'">
  10. {{ item.unReadNum > 99 ? "99+" : item.unReadNum }}
  11. </span>
  12. </aside>
  13. <main class="content">
  14. <header class="content-header">
  15. <label>
  16. <p class="name">{{item.mytype!='other' ? item.qwUserName: '系统消息'}}</p>
  17. </label>
  18. </header>
  19. <footer class="content-footer">
  20. <view :class="item.mytype!='other'?'textTwo':'textOne'" style="width: 240px;">{{item.title}}</view>
  21. </footer>
  22. <view class="message-time" v-if="item.mytype!='other'">过期时间: {{item.updateTime}}</view>
  23. <view class="item-footer">
  24. <span class="time">{{
  25. handleItemTime(item.createTime)
  26. }}</span>
  27. </view>
  28. <view class="conversation-line" :style="{bottom: item.mytype!='other' ?'-12px':'-15px'}"></view>
  29. </main>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import { caculateTimeago } from "../utils/date";
  35. import { getSopCourseStudyList,updateSopAppLink } from "@/api/courseAnswer.js"
  36. export default {
  37. props: ["item"],
  38. data() {
  39. return {
  40. }
  41. },
  42. computed: {
  43. handleItemTime() {
  44. return (time)=> {
  45. if (time) {
  46. const t = new Date(time).getTime()
  47. return caculateTimeago(t);
  48. }
  49. return "";
  50. }
  51. }
  52. },
  53. methods: {
  54. handleDetail(item) {
  55. if(item.mytype == 'other') {
  56. uni.navigateTo({
  57. url: '/pages/user/myNoticeList'
  58. })
  59. } else {
  60. this.getCourseRead(item.link)
  61. if(item.appRealLink) {
  62. uni.navigateTo({
  63. url: item.appRealLink
  64. })
  65. }else {
  66. uni.showToast({
  67. icon:'none',
  68. title: "暂无看课链接",
  69. });
  70. }
  71. }
  72. },
  73. getCourseRead(id) {
  74. updateSopAppLink(id).then(res=>{
  75. if(res.code == 200) {
  76. item.isRead = 1
  77. this.$updateMsgDot()
  78. }
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style scoped lang="scss">
  85. .TUI-conversation-item {
  86. position: relative;
  87. padding: 12px;
  88. display: flex;
  89. align-items: center;
  90. .left {
  91. position: relative;
  92. margin-right: 10px;
  93. .num {
  94. font-family: PingFangSC-Regular;
  95. position: absolute;
  96. display: inline-block;
  97. right: -8px;
  98. top: -8px;
  99. background: red;
  100. min-width: 20px;
  101. height: 20px;
  102. font-size: 20rpx;
  103. text-align: center;
  104. line-height: 20px;
  105. border-radius: 50%;
  106. color: #ffffff;
  107. font-weight: 600;
  108. letter-spacing: 0;
  109. }
  110. .new {
  111. position: absolute;
  112. display: inline-block;
  113. right: -4px;
  114. top: -4px;
  115. background: red;
  116. width: 11px;
  117. height: 11px;
  118. border-radius: 50%;
  119. color: #ffffff;
  120. }
  121. .avatar {
  122. width: 48px;
  123. height: 48px;
  124. border-radius: 6px;
  125. }
  126. .avatarCou {
  127. width: 48px;
  128. height: 48px;
  129. border-radius: 6px;
  130. overflow: hidden;
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. image {
  135. width: 62px;
  136. height: 62px;
  137. // border-radius: 6px;
  138. }
  139. }
  140. }
  141. .content {
  142. flex: 1;
  143. // padding-left: 10px;
  144. position: relative;
  145. p {
  146. width: 200px;
  147. overflow: hidden;
  148. text-overflow: ellipsis;
  149. white-space: nowrap;
  150. font-weight: 400;
  151. font-size: 14px;
  152. color: #999999;
  153. letter-spacing: 0;
  154. line-height: 19px;
  155. font-family: PingFangSC-Regular;
  156. }
  157. .message-time {
  158. width: 100%;
  159. font-family: PingFangSC-Regular;
  160. font-size: 12px;
  161. color: #b0b0b0;
  162. line-height: 16px;
  163. display: inline-block;
  164. font-weight: 400;
  165. }
  166. .conversation-line {
  167. position: absolute;
  168. display: block;
  169. left: 0;
  170. right: -12px;
  171. height: 0.5px;
  172. transform: scaleY(0.3);
  173. background: #b0b0b0;
  174. /* padding-top: 10px; */
  175. bottom: -12px;
  176. }
  177. .name {
  178. font-weight: 400;
  179. font-size: 16px;
  180. color: #000000;
  181. letter-spacing: 0;
  182. margin-bottom: 5px;
  183. font-family: PingFangSC-Regular;
  184. }
  185. &-header {
  186. display: flex;
  187. justify-content: space-between;
  188. align-items: center;
  189. label {
  190. flex: 1;
  191. font-size: 14px;
  192. color: #000000;
  193. .name {
  194. // width: 110px;
  195. overflow: hidden;
  196. text-overflow: ellipsis;
  197. white-space: nowrap;
  198. }
  199. }
  200. .time {
  201. font-size: 12px;
  202. color: #b0b0b0;
  203. line-height: 16px;
  204. display: inline-block;
  205. max-width: 75px;
  206. font-weight: 400;
  207. }
  208. }
  209. &-footer {
  210. color: #999999;
  211. line-height: 16px;
  212. display: flex;
  213. .message-text {
  214. margin-left: 4px;
  215. display: block;
  216. width: 240px;
  217. overflow: hidden;
  218. text-overflow: ellipsis;
  219. white-space: nowrap;
  220. }
  221. }
  222. .item-footer {
  223. position: absolute;
  224. right: 0;
  225. top: 0;
  226. justify-items: center;
  227. display: flex;
  228. flex-direction: column;
  229. align-items: flex-end;
  230. .time {
  231. font-size: 12px;
  232. color: #b0b0b0;
  233. line-height: 16px;
  234. display: inline-block;
  235. max-width: 75px;
  236. font-weight: 400;
  237. margin-bottom: 5px;
  238. }
  239. .mute-icon {
  240. display: block;
  241. width: 20px;
  242. height: 20px;
  243. }
  244. }
  245. }
  246. .dialog-box {
  247. position: absolute;
  248. z-index: 5;
  249. background: #fff;
  250. border: 1px solid #dddddd;
  251. padding: 15px 20px;
  252. right: 15px;
  253. top: 30px;
  254. &-item {
  255. top: 60px;
  256. right: 40px;
  257. box-shadow: 0 11px 20px 0 rgb(0 0 0 / 30%);
  258. background: #ffffff;
  259. border: 1px solid #e0e0e0;
  260. box-shadow: 0 -4px 12px 0 rgb(0 0 0 / 6%);
  261. border-radius: 8px;
  262. }
  263. .conversation-options {
  264. height: 35px;
  265. font-family: PingFangSC-Regular;
  266. font-weight: 400;
  267. font-size: 14px;
  268. color: #4f4f4f;
  269. letter-spacing: 0;
  270. line-height: 35px;
  271. }
  272. }
  273. }
  274. </style>