AI销管
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

300 lines
7.1 KiB

  1. <template>
  2. <view class="message_list">
  3. <!-- <u-tabs :list="list" :show-bar="false" :is-scroll="false" :current="current" @change="change"></u-tabs> -->
  4. <view class="listMain">
  5. <view class="upgradeList">
  6. <scroll-view :scroll-top="scrollTop" refresher-enabled="true" :refresher-triggered="triggered"
  7. @refresherpulling="onPulling" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
  8. :scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  9. <block v-if="updateAnnList.length!=0">
  10. <block v-for="(item,index) in updateAnnList" :key="index">
  11. <view class="upgradeItem" @click="goDetail(item.content,item.id,item.title)">
  12. <view class="notRead">
  13. <view v-if="item.readFlag==0" class="red"></view>
  14. </view>
  15. <view class="right">
  16. <view class="title">{{item.title}}</view>
  17. <view class="time">{{item.createTime}}</view>
  18. </view>
  19. </view>
  20. </block>
  21. </block>
  22. <block v-else>
  23. <view style=" padding: 100rpx 0;">
  24. <u-empty text="暂无数据" mode="list"></u-empty>
  25. </view>
  26. </block>
  27. </scroll-view>
  28. </view>
  29. <!-- <view class="systemList" v-if="current==0">
  30. <block v-if="sysItemList.length!=0">
  31. <block v-for="(item,index) in sysItemList" :key="index">
  32. <view class="sysItem">
  33. <image class="headpic" src="../../static/images/function1.png"></image>
  34. <view class="right">
  35. <view class="headInfo">
  36. <view class="title">优秀案例</view>
  37. <view class="info">评价你:非常好,品牌价值观还需要补充</view>
  38. </view>
  39. <view class="content">
  40. 我的评论:非常好,品牌价值观还需要补充我的评论:非常好,品牌价值观还需要补充我的评论:非常好,品牌价值观还需要补充我的评论:非常好,品牌价值观还需要补充
  41. </view>
  42. <view class="time">
  43. 2021-01-12 12:23:01
  44. </view>
  45. </view>
  46. </view>
  47. </block>
  48. </block>
  49. <block v-else>
  50. <view style=" padding: 100rpx 0;">
  51. <u-empty text="暂无数据" mode="list"></u-empty>
  52. </view>
  53. </block>
  54. </view>
  55. <view class="upgradeList" v-if="current==1">
  56. <block v-if="updateAnnList.length!=0">
  57. <block v-for="(item,index) in updateAnnList" :key="index">
  58. <view class="upgradeItem" @click="goDetail(item.content,item.id)">
  59. <view class="notRead">
  60. <view v-if="item.readFlag==0" class="red"></view>
  61. </view>
  62. <view class="right">
  63. <view class="title">{{item.title}}</view>
  64. <view class="time">{{item.createTime}}</view>
  65. </view>
  66. </view>
  67. </block>
  68. </block>
  69. <block v-else>
  70. <view style=" padding: 100rpx 0;">
  71. <u-empty text="暂无数据" mode="list"></u-empty>
  72. </view>
  73. </block>
  74. </view>
  75. -->
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. var util = require("../../utils/util.js");
  81. var config = require("../../config");
  82. export default {
  83. data() {
  84. return {
  85. triggered: true,
  86. scrollTop: 0,
  87. old: {
  88. scrollTop: 0
  89. },
  90. updateAnnList: [],
  91. sysItemList: [],
  92. list: [{
  93. name: '系统消息'
  94. }, {
  95. name: `升级公告`,
  96. count: "",
  97. }],
  98. current: 0,
  99. pageNum: 1,
  100. pageSize: 10,
  101. };
  102. },
  103. onShow() {
  104. this.updateAnnList = []
  105. this.pageNum = 1
  106. this.updateInit()
  107. },
  108. onLoad() {
  109. this._freshing = false;
  110. setTimeout(() => {
  111. this.triggered = true;
  112. }, 1000)
  113. },
  114. onPullDownRefresh() {
  115. this.updateInit()
  116. setTimeout(function() {
  117. uni.stopPullDownRefresh();
  118. }, 1000);
  119. },
  120. // onReachBottom(){
  121. // this.pageNum++
  122. // this.updateInit()
  123. // },
  124. methods: {
  125. onPulling(e) {
  126. console.log("onpulling", e);
  127. },
  128. onRefresh() {
  129. if (this._freshing) return;
  130. this.updateInit()
  131. this._freshing = true;
  132. setTimeout(() => {
  133. this.triggered = false;
  134. this._freshing = false;
  135. }, 3000)
  136. },
  137. onRestore() {
  138. this.triggered = 'restore'; // 需要重置
  139. console.log("onRestore");
  140. },
  141. // uppers(e) {
  142. // this.pageNum = 1
  143. // this.updateInit()
  144. // },
  145. lower(e) {
  146. this.pageNum++
  147. this.updateInit()
  148. },
  149. updateInit() {
  150. uni.request({
  151. url: config.service.updateList,
  152. method: "GET",
  153. data: {
  154. id: uni.getStorageSync('weapp_session_userInfo_data').accountId,
  155. num: this.pageNum,
  156. size: this.pageSize
  157. },
  158. header: {
  159. 'content-type': 'application/json',
  160. 'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
  161. },
  162. success: (res) => {
  163. // this.updateAnnList = res.data.data.list.results
  164. if (res.data.data != null) {
  165. this.list[1].count = res.data.data.count
  166. }
  167. if (res.data.data == null) {
  168. console.log(11)
  169. uni.showToast({
  170. title: '已经到底了!',
  171. duration: 2000
  172. });
  173. } else {
  174. if (this.pageNum != 1) {
  175. this.updateAnnList = [...this.updateAnnList, ...res.data.data.list.records];
  176. } else {
  177. this.updateAnnList = res.data.data.list.records
  178. }
  179. }
  180. }
  181. })
  182. },
  183. goDetail(text, id, title) {
  184. let link = encodeURIComponent(JSON.stringify(text))
  185. uni.navigateTo({
  186. url: "./messageDetail?content=" + link + "&id=" + id + "&tit=" + title
  187. })
  188. },
  189. change(index) {
  190. this.current = index;
  191. if (this.current == 1) {
  192. this.updateInit()
  193. }
  194. }
  195. }
  196. }
  197. </script>
  198. <style lang="scss">
  199. .scroll-Y {
  200. height: 100%;
  201. width: 100%;
  202. position: fixed;
  203. }
  204. .message_list {
  205. .u-tab-item {
  206. border: 0.5rpx solid #dedede;
  207. }
  208. .listMain {
  209. margin-top: 20rpx;
  210. .systemList {
  211. .sysItem {
  212. padding: 20rpx;
  213. border: 1rpx solid #ccc;
  214. display: flex;
  215. margin: 16rpx 0;
  216. .headpic {
  217. width: 70rpx;
  218. height: 70rpx;
  219. border-radius: 100%;
  220. margin-right: 30rpx;
  221. }
  222. .right {
  223. .headInfo {
  224. .title {
  225. font-size: 32rpx;
  226. font-weight: bold;
  227. margin-bottom: 8rpx;
  228. }
  229. }
  230. .content {
  231. width: 600rpx;
  232. background: #e6e6e6;
  233. padding: 10rpx;
  234. margin: 14rpx 0;
  235. overflow: hidden;
  236. text-overflow: ellipsis;
  237. white-space: nowrap;
  238. }
  239. .time {
  240. color: #6f6f6f;
  241. font-size: 24rpx;
  242. }
  243. }
  244. }
  245. }
  246. .upgradeList {
  247. .upgradeItem {
  248. padding: 20rpx;
  249. border: 1rpx solid #ccc;
  250. margin: 16rpx 0;
  251. display: flex;
  252. .notRead {
  253. width: 14rpx;
  254. height: 14rpx;
  255. margin-right: 20rpx;
  256. margin-top: 16rpx;
  257. .red {
  258. background: #FF0000;
  259. width: 100%;
  260. height: 100%;
  261. border-radius: 100%;
  262. }
  263. }
  264. .right {
  265. .title {
  266. font-size: 32rpx;
  267. font-weight: bold;
  268. margin-bottom: 8rpx;
  269. }
  270. .time {
  271. color: #6f6f6f;
  272. font-size: 24rpx;
  273. }
  274. }
  275. }
  276. }
  277. }
  278. }
  279. </style>