123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <template>
- <view class="messageSys">
- <statusBar :item="navBarData"></statusBar>
- <scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollview" :style="{height:(screenHeight - navheight)+'px' }">
- <view class="reverse" id="msglistview">
- <view class="content" v-for="(item,index) in list" :key="index">
- <view class="conblock">
- <view class="header">
- <view class="disC three-font">
- 成功加入[{{item.acName}}]{{item.type>=2?'教研室':'活动'}}
- </view>
- </view>
- <view class="sj fwb-font">{{item.create_at}}</view>
- <view class="main">
- <view class="fwb-font">
- 尊敬的
- <text>{{item.username}}</text>
- </view>
- <view class="fwb-font" style="text-indent: 2em;">
- 我们很高兴通知您,您已成功加入
- <text class="btn-font" style="color: #0056a8;">[{{item.acName}}]</text>
- !欢迎加入我们的团队,我们期待与您一同合作并共同追求卓越教育。
- </view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- navBarData: {
- title: '系统消息',
- btn: 1
- },
- newsLoading: 0, //0默认值 1加载中 2没有更多了
- currentPage: 1,
- navheight: this.navheight, //导航栏高度
- scrollTop: 0,
- // 渲染列表
- list: [],
- };
- },
- methods: {
- // 获取数据
- getdata() {
- let data = {
- oid: this.$store.state.user.openid, //用户id
- type: 1,
- page: this.currentPage,
- lim: 30
- }
- this.$request('/selectMessage', "POST", data).then(res => {
- // console.log('获取', res[0]);
- // this.list = [this.list,...res[0]]
- this.list = res[0]
- // console.log('获取',this.list);
- })
- },
- updateisread() {
- let data = {
- oid: this.$store.state.user.openid, //用户id
- type: 1,
- }
- this.$request('/updateIsRead', "POST", data).then(res => {
- // console.log('获取', res);
- })
- },
- // 聊天记录自动跳转底部
- scrollToBottom() {
- let that = this
- let query = uni.createSelectorQuery()
- query.select('#scrollview').boundingClientRect()
- query.select('#msglistview').boundingClientRect()
- query.exec((res) => {
- // console.log('res', res);
- console.log('res',res[1].height, res[0].height);
- // console.log(res[1].height, res[0].height);
- if (res[1].height > res[0].height) {
- that.scrollTop = res[1].height - res[0].height
- }
- })
- }
- },
- onShow() {
- // 获取页面数据
- this.getdata()
- // 更新已读
- this.updateisread()
- },
- // 进入页面渲染完毕后调用
- onReady() {
- this.scrollToBottom()
- },
- onLoad() {
- // this.userName = this.$store.state.user.userName
- // this.getdata()
- }
- }
- </script>
- <style lang="scss">
- .classTest {
- font-size: 30px;
- }
- .messageSys {
- padding-bottom: 80rpx;
-
- }
- .reverse {
- // flex: 1;
- display: flex;
- flex-direction: column-reverse;
- .content {
- padding: 10px;
- margin: 10px;
- background-color: white;
- border-radius: 8px;
- .conblock {
- .header {
- color: black;
- font-weight: 600;
- display: flex;
- justify-content: space-between;
- .disC {
- display: flex;
- width: 100%;
- font-weight: bold;
- justify-content: space-between;
- align-items: baseline;
- /*隐藏溢出*/
- /*当文本溢出包含元素时显示省略符号来代表被修剪的文本*/
- /*规定段落中的文本不进行换行*/
- white-space: normal;
- letter-spacing: 2rpx;
- display: -webkit-box;
- word-break: break-all;
- text-overflow: ellipsis;
- overflow: hidden;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- /*设置 需要显示的行数*/
- }
- }
- .sj {
- color: #999999;
- font-weight: 500;
- padding: 10rpx 0;
- }
- .main {
- color: #999999;
- view {
- font-weight: 400;
- // font-size: 14px;
- view {
- color: #0056a8;
- font-weight: 600;
- }
- }
- }
- }
- }
- }
- </style>
|