Commit cc23ca2dcc69ddf5e3ddd6fcb08bbfb76270abe2
1 parent
2b477a4d
mp:解决 wx-msg 的 css 问题
Showing
1 changed file
with
122 additions
and
38 deletions
yudao-ui-admin/src/views/mp/components/wx-msg/main.vue
| @@ -13,16 +13,17 @@ | @@ -13,16 +13,17 @@ | ||
| 13 | </div> | 13 | </div> |
| 14 | <!-- 消息列表 --> | 14 | <!-- 消息列表 --> |
| 15 | <div class="execution" v-for="item in tableData" :key='item.id'> | 15 | <div class="execution" v-for="item in tableData" :key='item.id'> |
| 16 | - <div class="avue-comment" :class="item.sendFrom == '2' ? 'avue-comment--reverse' : ''"> | 16 | + <div class="avue-comment" :class="item.sendFrom === 2 ? 'avue-comment--reverse' : ''"> |
| 17 | <div class="avatar-div"> | 17 | <div class="avatar-div"> |
| 18 | - <img :src="item.sendFrom == '1' ? item.headimgUrl : item.appLogo" class="avue-comment__avatar"> | ||
| 19 | - <div class="avue-comment__author">{{item.sendFrom == '1' ? item.nickName : item.appName}}</div> | 18 | + <img :src="item.sendFrom === 1 ? item.headimgUrl : item.appLogo" class="avue-comment__avatar"> |
| 19 | +<!-- <div class="avue-comment__author">{{item.sendFrom === 1 ? item.nickName : item.appName}}</div>--> | ||
| 20 | + <div class="avue-comment__author">{{item.sendFrom === 1 ? '用户' : '公众号' }}</div> | ||
| 20 | </div> | 21 | </div> |
| 21 | <div class="avue-comment__main"> | 22 | <div class="avue-comment__main"> |
| 22 | <div class="avue-comment__header"> | 23 | <div class="avue-comment__header"> |
| 23 | <div class="avue-comment__create_time">{{ parseTime(item.createTime) }}</div> | 24 | <div class="avue-comment__create_time">{{ parseTime(item.createTime) }}</div> |
| 24 | </div> | 25 | </div> |
| 25 | - <div class="avue-comment__body" :style="item.sendFrom == '2' ? 'background: #6BED72;' : ''"> | 26 | + <div class="avue-comment__body" :style="item.sendFrom === 2 ? 'background: #6BED72;' : ''"> |
| 26 | <!-- 【事件】区域 --> | 27 | <!-- 【事件】区域 --> |
| 27 | <div v-if="item.type === 'event' && item.event === 'subscribe'"> | 28 | <div v-if="item.type === 'event' && item.event === 'subscribe'"> |
| 28 | <el-tag type="success" size="mini">关注</el-tag> | 29 | <el-tag type="success" size="mini">关注</el-tag> |
| @@ -96,7 +97,6 @@ | @@ -96,7 +97,6 @@ | ||
| 96 | </template> | 97 | </template> |
| 97 | 98 | ||
| 98 | <script> | 99 | <script> |
| 99 | - // import { getMessagePage, addObj } from '@/api/mp/message' | ||
| 100 | import { getMessagePage } from '@/api/mp/message' | 100 | import { getMessagePage } from '@/api/mp/message' |
| 101 | // import WxReplySelect from '@/components/wx-reply/main.vue' | 101 | // import WxReplySelect from '@/components/wx-reply/main.vue' |
| 102 | // import WxNews from '@/components/wx-news/main.vue' | 102 | // import WxNews from '@/components/wx-news/main.vue' |
| @@ -228,46 +228,130 @@ | @@ -228,46 +228,130 @@ | ||
| 228 | } | 228 | } |
| 229 | }; | 229 | }; |
| 230 | </script> | 230 | </script> |
| 231 | - | ||
| 232 | <style lang="scss" scoped> | 231 | <style lang="scss" scoped> |
| 233 | - .msg-main{ | ||
| 234 | - margin-top: -30px; | ||
| 235 | - padding: 10px; | ||
| 236 | - } | ||
| 237 | - .msg-div{ | ||
| 238 | - height: 50vh; | ||
| 239 | - overflow: auto; | ||
| 240 | - background-color: #eaeaea; | ||
| 241 | - } | ||
| 242 | - .msg-send{ | ||
| 243 | - padding: 10px; | 232 | +/* 来自 https://github.com/nmxiaowei/avue/blob/master/styles/src/element-ui/comment.scss */ |
| 233 | +/* 因为 joolun 实现依赖 avue 组件,该页面使用了 comment.scss */ | ||
| 234 | +.avue-comment{ | ||
| 235 | + margin-bottom: 30px; | ||
| 236 | + display: flex; | ||
| 237 | + align-items: flex-start; | ||
| 238 | + &--reverse{ | ||
| 239 | + flex-direction:row-reverse; | ||
| 240 | + .avue-comment__main{ | ||
| 241 | + &:before,&:after{ | ||
| 242 | + left: auto; | ||
| 243 | + right: -8px; | ||
| 244 | + border-width: 8px 0 8px 8px; | ||
| 245 | + } | ||
| 246 | + &:before{ | ||
| 247 | + border-left-color: #dedede; | ||
| 248 | + } | ||
| 249 | + &:after{ | ||
| 250 | + border-left-color: #f8f8f8; | ||
| 251 | + margin-right: 1px; | ||
| 252 | + margin-left: auto; | ||
| 253 | + } | ||
| 254 | + } | ||
| 244 | } | 255 | } |
| 245 | - .avue-comment__main{ | ||
| 246 | - flex: unset!important; | ||
| 247 | - border-radius: 5px!important; | ||
| 248 | - margin: 0 8px!important; | 256 | + &__avatar{ |
| 257 | + width: 48px; | ||
| 258 | + height: 48px; | ||
| 259 | + border-radius: 50%; | ||
| 260 | + border: 1px solid transparent; | ||
| 261 | + box-sizing: border-box; | ||
| 262 | + vertical-align: middle; | ||
| 249 | } | 263 | } |
| 250 | - .avue-comment--reverse { | ||
| 251 | - -webkit-box-orient: horizontal; | ||
| 252 | - -webkit-box-direction: reverse; | ||
| 253 | - -ms-flex-direction: row-reverse; | ||
| 254 | - flex-direction: row-reverse; | 264 | + &__header{ |
| 265 | + padding: 5px 15px; | ||
| 266 | + background: #f8f8f8; | ||
| 267 | + border-bottom: 1px solid #eee; | ||
| 268 | + display: flex; | ||
| 269 | + align-items: center; | ||
| 270 | + justify-content: space-between; | ||
| 255 | } | 271 | } |
| 256 | - .avue-comment__header{ | ||
| 257 | - border-top-left-radius: 5px; | ||
| 258 | - border-top-right-radius: 5px; | 272 | + &__author{ |
| 273 | + font-weight: 700; | ||
| 274 | + font-size: 14px; | ||
| 275 | + color: #999; | ||
| 259 | } | 276 | } |
| 260 | - .avue-comment__body { | ||
| 261 | - border-bottom-right-radius: 5px; | ||
| 262 | - border-bottom-left-radius: 5px; | 277 | + &__main{ |
| 278 | + flex:1; | ||
| 279 | + margin: 0 20px; | ||
| 280 | + position: relative; | ||
| 281 | + border: 1px solid #dedede; | ||
| 282 | + border-radius: 2px; | ||
| 283 | + &:before,&:after{ | ||
| 284 | + position: absolute; | ||
| 285 | + top: 10px; | ||
| 286 | + left: -8px; | ||
| 287 | + right: 100%; | ||
| 288 | + width: 0; | ||
| 289 | + height: 0; | ||
| 290 | + display: block; | ||
| 291 | + content: " "; | ||
| 292 | + border-color: transparent; | ||
| 293 | + border-style: solid solid outset; | ||
| 294 | + border-width: 8px 8px 8px 0; | ||
| 295 | + pointer-events: none; | ||
| 296 | + } | ||
| 297 | + &:before { | ||
| 298 | + border-right-color: #dedede; | ||
| 299 | + z-index: 1; | ||
| 300 | + } | ||
| 301 | + &:after{ | ||
| 302 | + border-right-color: #f8f8f8; | ||
| 303 | + margin-left: 1px; | ||
| 304 | + z-index: 2; | ||
| 305 | + } | ||
| 263 | } | 306 | } |
| 264 | - .avatar-div{ | ||
| 265 | - text-align: center; | ||
| 266 | - width: 80px; | 307 | + &__body{ |
| 308 | + padding: 15px; | ||
| 309 | + overflow: hidden; | ||
| 310 | + background: #fff; | ||
| 311 | + font-family: Segoe UI,Lucida Grande,Helvetica,Arial,Microsoft YaHei,FreeSans,Arimo,Droid Sans,wenquanyi micro hei,Hiragino Sans GB,Hiragino Sans GB W3,FontAwesome,sans-serif;color: #333; | ||
| 312 | + font-size: 14px; | ||
| 267 | } | 313 | } |
| 268 | - .send-but{ | ||
| 269 | - float: right; | ||
| 270 | - margin-top: 8px!important; | 314 | + blockquote{ |
| 315 | + margin:0; | ||
| 316 | + font-family: Georgia,Times New Roman,Times,Kai,Kaiti SC,KaiTi,BiauKai,FontAwesome,serif; | ||
| 317 | + padding: 1px 0 1px 15px; | ||
| 318 | + border-left: 4px solid #ddd; | ||
| 271 | } | 319 | } |
| 320 | +} | ||
| 321 | +</style> | ||
| 322 | +<style lang="scss" scoped> | ||
| 323 | +.msg-main{ | ||
| 324 | + margin-top: -30px; | ||
| 325 | + padding: 10px; | ||
| 326 | +} | ||
| 327 | +.msg-div{ | ||
| 328 | + height: 50vh; | ||
| 329 | + overflow: auto; | ||
| 330 | + background-color: #eaeaea; | ||
| 331 | +} | ||
| 332 | +.msg-send{ | ||
| 333 | + padding: 10px; | ||
| 334 | +} | ||
| 335 | +.avue-comment__main{ | ||
| 336 | + flex: unset!important; | ||
| 337 | + border-radius: 5px!important; | ||
| 338 | + margin: 0 8px!important; | ||
| 339 | +} | ||
| 340 | +.avue-comment__header{ | ||
| 341 | + border-top-left-radius: 5px; | ||
| 342 | + border-top-right-radius: 5px; | ||
| 343 | +} | ||
| 344 | +.avue-comment__body { | ||
| 345 | + border-bottom-right-radius: 5px; | ||
| 346 | + border-bottom-left-radius: 5px; | ||
| 347 | +} | ||
| 348 | +.avatar-div{ | ||
| 349 | + text-align: center; | ||
| 350 | + width: 80px; | ||
| 351 | +} | ||
| 352 | +.send-but{ | ||
| 353 | + float: right; | ||
| 354 | + margin-top: 8px!important; | ||
| 355 | +} | ||
| 272 | </style> | 356 | </style> |
| 273 | 357 |