提交 fdf887bee58a0527c7e6fd15f07692a270f434a7

作者 wangws
1 个父辈 525086a3

1

... ... @@ -226,4 +226,17 @@ export const getformApplyschooldetailApi = (id,params) => http.get('/internship/
226 226 })
227 227
228 228 // 实习申请-审核
229   -export const putformApplyApi = (id,params) => http.put('/internship/v1/formApply/audit/'+id, params)
\ No newline at end of file
  229 +export const putformApplyApi = (id,params) => http.put('/internship/v1/formApply/audit/'+id, params)
  230 +
  231 +// 公告
  232 +export const msginfoUrl = (params) => http.get('/basic/v1/student/msg/info', {
  233 + params: params
  234 +})
  235 +
  236 +// 公告列表
  237 +export const msglistUrl = (params) => http.get('/basic/v1/student/msg/list', {
  238 + params: params
  239 +})
  240 +
  241 +// 公告详情
  242 +export const msgdetailUrl = (id,params) => http.get('/basic/v1/student/msg/detail/'+id, params)
\ No newline at end of file
... ...
... ... @@ -5,13 +5,13 @@ module.exports = (vm) => {
5 5 /* config 为默认全局配置*/
6 6
7 7 // 测试环境
8   - // config.baseURL = "http://47.110.250.177:8000";
  8 + config.baseURL = "http://47.110.250.177:8000";
9 9
10 10 // 预生产环境
11 11 // config.baseURL = "https://api-isxpre.workai.com.cn";
12 12
13 13 // 线上环境
14   - config.baseURL = "https://api-isx.workai.com.cn";
  14 + // config.baseURL = "https://api-isx.workai.com.cn";
15 15
16 16 config.header = {
17 17 // 'content-type': 'xxx'
... ...
... ... @@ -25,6 +25,13 @@
25 25 "navigationBarTextStyle": "black",
26 26 "enablePullDownRefresh": false
27 27 }
  28 + },
  29 + {
  30 + "path": "pages/tabBar/message/message",
  31 + "style": {
  32 + "navigationBarTextStyle": "black",
  33 + "navigationBarTitleText": "消息"
  34 + }
28 35 },
29 36 {
30 37 "path": "pages/tabBar/my/my",
... ... @@ -248,6 +255,25 @@
248 255 }
249 256 }
250 257 ]
  258 + },
  259 + {
  260 + "root": "pages/main/message",
  261 + "pages": [{
  262 + "path": "message-list/message-list",
  263 + "style": {
  264 + "navigationBarTitleText": "公告列表",
  265 + "navigationBarTextStyle": "black",
  266 + "enablePullDownRefresh": false
  267 + }
  268 + }, {
  269 + "path": "message-detail/message-detail",
  270 + "style": {
  271 + "navigationBarTitleText": "公告详情",
  272 + "navigationBarTextStyle": "black",
  273 + "enablePullDownRefresh": false
  274 + }
  275 +
  276 + }]
251 277 },
252 278 {
253 279 "root": "pages/main/my",
... ... @@ -403,6 +429,12 @@
403 429 "iconPath": "/static/img/icon/internship.png",
404 430 "selectedIconPath": "/static/img/icon/internshipHL.png",
405 431 "text": "实习生"
  432 + },
  433 + {
  434 + "pagePath": "pages/tabBar/message/message",
  435 + "iconPath": "/static/img/icon/icon_message.png",
  436 + "selectedIconPath": "/static/img/icon/icon_messageHL.png",
  437 + "text": "消息"
406 438 },
407 439 {
408 440 "pagePath": "pages/tabBar/my/my",
... ...
... ... @@ -392,24 +392,25 @@
392 392 // _this.uploadInfos();
393 393 // } else {}
394 394 // console.log('_this.ossInit...', _this.ossInit)
395   - let formdata = {}
396   - if (this.ossInit.uploadType == 'aliyun') {
397   - formdata = {
398   - 'key': `${_this.ossInit.dir}${new Date().getTime()}`,
399   - 'action': `${_this.ossInit.host}`,
400   - 'OSSAccessKeyId': _this.ossInit.accessId,
401   - 'policy': _this.ossInit.policy,
402   - 'signature': _this.ossInit.signature,
403   - 'callback': _this.ossInit.callback,
404   - }
405   - } else {
406   - formdata = {
407   - 'bucket': _this.ossInit.bucket,
408   - 'dir': _this.ossInit.dir,
409   - 'fileName': `${_this.ossInit.dir}${new Date().getTime()}`,
410   - 'accessId': _this.ossInit.accessId,
411   - 'policy': _this.ossInit.policy
412   - }
  395 + let formdata = {}
  396 + if (this.ossInit.uploadType == 'minio') {
  397 + formdata = {
  398 + 'bucket': _this.ossInit.bucket,
  399 + 'dir': _this.ossInit.dir,
  400 + 'fileName': `${_this.ossInit.dir}${new Date().getTime()}/` + '${filename}',
  401 + 'accessId': _this.ossInit.accessId,
  402 + 'policy': _this.ossInit.policy
  403 + }
  404 + }else {
  405 + formdata = {
  406 + 'key': `${_this.ossInit.dir}${new Date().getTime()}/` + '${filename}',
  407 + // 'key': `${_this.ossInit.dir}${new Date().getTime()}`,
  408 + 'action': `${_this.ossInit.host}`,
  409 + 'OSSAccessKeyId': _this.ossInit.accessId,
  410 + 'policy': _this.ossInit.policy,
  411 + 'signature': _this.ossInit.signature,
  412 + 'callback': _this.ossInit.callback,
  413 + }
413 414 }
414 415 return new Promise((resolve, reject) => {
415 416 var gapLength = this.picList.length - this.attachments.length
... ... @@ -448,27 +449,34 @@
448 449 // }
449 450 // console.log("uploadFiles...", this.fileList, this.attachmentsFile)
450 451 let formdata = {}
451   - if (this.ossInit.uploadType == 'aliyun') {
  452 + if (this.ossInit.uploadType == 'minio') {
  453 + formdata = {
  454 + 'bucket': _this.ossInit.bucket,
  455 + 'dir': _this.ossInit.dir,
  456 + 'fileName': `${_this.ossInit.dir}${new Date().getTime()}/` + '${filename}',
  457 + 'accessId': _this.ossInit.accessId,
  458 + 'policy': _this.ossInit.policy
  459 + }
  460 + }else {
452 461 formdata = {
453   - 'key': `${_this.ossInit.dir}${new Date().getTime()}`,
  462 + 'key': `${_this.ossInit.dir}${new Date().getTime()}/` + '${filename}',
  463 + // 'key': `${_this.ossInit.dir}${new Date().getTime()}`,
454 464 'action': `${_this.ossInit.host}`,
455 465 'OSSAccessKeyId': _this.ossInit.accessId,
456 466 'policy': _this.ossInit.policy,
457 467 'signature': _this.ossInit.signature,
458 468 'callback': _this.ossInit.callback,
459 469 }
460   - } else {
461   - formdata = {
462   - 'bucket': _this.ossInit.bucket,
463   - 'dir': _this.ossInit.dir,
464   - 'fileName': `${_this.ossInit.dir}${new Date().getTime()}`,
465   - 'accessId': _this.ossInit.accessId,
466   - 'policy': _this.ossInit.policy
467   - }
468 470 }
469 471 return new Promise((resolve, reject) => {
470 472 var gapLength = this.fileList.length - this.attachmentsFile.length
471   - for (var i = 0; i < gapLength; i++) {
  473 + for (var i = 0; i < gapLength; i++) {
  474 + let item = _this.fileList[_this.fileList.length - gapLength + i]
  475 + if (this.ossInit.uploadType == 'minio') {
  476 + formdata.fileName = `${_this.ossInit.dir}${new Date().getTime()}/` + item.name
  477 + }else {
  478 + formdata.key = `${_this.ossInit.dir}${new Date().getTime()}/` + item.name
  479 + }
472 480 uni.uploadFile({
473 481 url: _this.ossInit.host,
474 482 filePath: _this.fileList[_this.fileList.length - gapLength + i].path,
... ...
... ... @@ -274,23 +274,24 @@
274 274 let _this = this;
275 275
276 276 let formdata = {}
277   - if (this.ossInit.uploadType == 'aliyun') {
  277 + if (this.ossInit.uploadType == 'minio') {
278 278 formdata = {
279   - 'key': `${_this.ossInit.dir}${new Date().getTime()}`,
  279 + 'bucket': _this.ossInit.bucket,
  280 + 'dir': _this.ossInit.dir,
  281 + 'fileName': `${_this.ossInit.dir}${new Date().getTime()}/` + '${filename}',
  282 + 'accessId': _this.ossInit.accessId,
  283 + 'policy': _this.ossInit.policy
  284 + }
  285 + }else {
  286 + formdata = {
  287 + 'key': `${_this.ossInit.dir}${new Date().getTime()}/` + '${filename}',
  288 + // 'key': `${_this.ossInit.dir}${new Date().getTime()}`,
280 289 'action': `${_this.ossInit.host}`,
281 290 'OSSAccessKeyId': _this.ossInit.accessId,
282 291 'policy': _this.ossInit.policy,
283 292 'signature': _this.ossInit.signature,
284 293 'callback': _this.ossInit.callback,
285 294 }
286   - } else {
287   - formdata = {
288   - 'bucket': _this.ossInit.bucket,
289   - 'dir': _this.ossInit.dir,
290   - 'fileName': `${_this.ossInit.dir}${new Date().getTime()}`,
291   - 'accessId': _this.ossInit.accessId,
292   - 'policy': _this.ossInit.policy
293   - }
294 295 }
295 296 wx.chooseMessageFile({
296 297 count: 9,
... ...
... ... @@ -45,7 +45,7 @@
45 45 const year = d.getFullYear();
46 46 let month = d.getMonth() + 1;
47 47 month = month < 10 ? `0${month}` : month;
48   - const date = d.getDate();
  48 + const date = this.getZero(d.getDate());
49 49
50 50 return {
51 51 initList: [],
... ... @@ -95,6 +95,14 @@
95 95 change(date) {
96 96 console.log(date); // 日期 eg:'2022-01-01'
97 97 this.filterData(this.initList, date);
  98 + },
  99 +
  100 + getZero(num) {
  101 + // 单数前面加0
  102 + if (parseInt(num) < 10) {
  103 + num = '0' + num;
  104 + }
  105 + return num;
98 106 },
99 107
100 108 changeMonth(year, month) {
... ...
  1 +<template>
  2 + <view class="page">
  3 + <view class="content">
  4 + <view class="t1">
  5 + {{detailObj.title}}
  6 + </view>
  7 + <view class="dv">
  8 + <view class="tag">
  9 + {{type[detailObj.type]}}
  10 + </view>
  11 + <view class="time">
  12 + {{$u.timeFrom(detailObj.sendTime)}}
  13 + </view>
  14 + </view>
  15 + </view>
  16 + <view style="background-color: #F7F7F7; width: 100%; height: 10px;"></view>
  17 + <view class="tip">
  18 + <view class="ggxq">
  19 + 公告详情
  20 + </view>
  21 + <view class="green-line"></view>
  22 + </view>
  23 + <view class="desc">
  24 + <!-- {{detailObj.content}} -->
  25 + <u-parse :tagStyle="parsestyle" :content="detailObj.content"></u-parse>
  26 + </view>
  27 + <view class="fj">
  28 + 附件
  29 + </view>
  30 + <view class="greenbg" v-for="(item,index) in attachmentsFile" :key="index" @click="openLink(item.response)">
  31 + <image v-if="item.response.mime_type.indexOf('image') != -1" src="/static/img/message/icon_img.png" style="width: 60rpx;height: 60rpx;"></image>
  32 + <image v-else src="/static/img/message/icon_file.png" style="width: 60rpx;height: 60rpx;"></image>
  33 + <view class="name">
  34 + {{item.response.filename}}
  35 + </view>
  36 + </view>
  37 + </view>
  38 +</template>
  39 +
  40 +<script>
  41 + import {
  42 + msgdetailUrl,
  43 + getImgUrlApi
  44 + } from '@/config/api.js';
  45 + export default {
  46 + data() {
  47 + return {
  48 + id: '',
  49 + detailObj: {},
  50 + type: {
  51 + system: '系统公告',
  52 + inform: '通知公告',
  53 + safety_rules: '安全条例',
  54 + vital_document: '重要文件'
  55 + },
  56 + parsestyle: {
  57 + p: 'color: rgba(0,0,0,0.85);font-size:28rpx;font-family: PingFangSC-Light, PingFang SC;',
  58 + },
  59 + attachmentsFile: [],
  60 + }
  61 + },
  62 +
  63 + onLoad(e) {
  64 + this.id = e.id
  65 + msgdetailUrl(this.id).then(res => {
  66 +
  67 + if (res) {
  68 + this.detailObj = res
  69 +
  70 + if (this.detailObj.attachments) {
  71 + this.attachmentsFile = JSON.parse(this.detailObj.attachments)
  72 + }
  73 + }
  74 + })
  75 + },
  76 +
  77 + methods: {
  78 + openLink(e) {
  79 + var _this = this
  80 +
  81 + uni.showLoading({
  82 + title: '努力加载中~',
  83 + mask: true
  84 + })
  85 +
  86 + if (e.mime_type.indexOf("image") != -1) {
  87 + _this.openImage(`${this.vuex_ossUrlPubilc}/${e.object}`)
  88 + } else {
  89 + let type = ''
  90 + if (e.object.substring(e.object.lastIndexOf(".")+1) == 'xlsx') {
  91 + type = 'xlsx'
  92 + }else if (e.object.substring(e.object.lastIndexOf(".")+1) == 'pdf') {
  93 + type = 'pdf'
  94 + }else if (e.object.substring(e.object.lastIndexOf(".")+1) == 'docx') {
  95 + type = 'docx'
  96 + }else if (e.object.substring(e.object.lastIndexOf(".")+1) == 'doc') {
  97 + type = 'doc'
  98 + }else if (e.object.substring(e.object.lastIndexOf(".")+1) == 'xls') {
  99 + type = 'xls'
  100 + }
  101 + uni.downloadFile({
  102 + url: `${this.vuex_ossUrlPubilc}/${e.object}`,
  103 + success: function(res) {
  104 + var filePath = res.tempFilePath;
  105 + uni.openDocument({
  106 + filePath: filePath,
  107 + showMenu: true,
  108 + fileType: type,
  109 + success: function(res) {
  110 + console.log('打开文档成功');
  111 + },
  112 + fail(e) {
  113 + console.log('打开文档error', e);
  114 + },
  115 + complete: function() {
  116 + uni.hideLoading();
  117 + }
  118 + });
  119 + }
  120 + });
  121 + }
  122 + // this.$u.api.getImgUrl({
  123 + // bucket: e.bucket,
  124 + // filePath: e.object
  125 + // }).then(data => {
  126 + // console.log("data...", data)
  127 + // if (e.mime_type.indexOf("image") != -1) {
  128 + // _this.openImage(data.url)
  129 + // } else {
  130 + // uni.downloadFile({
  131 + // url: data.url,
  132 + // success: function(res) {
  133 + // var filePath = res.tempFilePath;
  134 + // uni.openDocument({
  135 + // filePath: filePath,
  136 + // showMenu: true,
  137 + // success: function(res) {
  138 + // console.log('打开文档成功');
  139 + // },
  140 + // fail(e) {
  141 + // console.log('打开文档error',e);
  142 + // },
  143 + // complete: function() {
  144 + // uni.hideLoading();
  145 + // }
  146 + // });
  147 + // }
  148 + // });
  149 + // }
  150 + // })
  151 + },
  152 + openImage(imgPath) {
  153 + let array = new Array(1).fill(imgPath);
  154 + uni.previewImage({
  155 + urls: array,
  156 + success(res) {
  157 + uni.hideLoading();
  158 + console.log('openImage success');
  159 + },
  160 + fail(res) {
  161 + uni.hideLoading();
  162 + console.log('openImage fail:', res);
  163 + }
  164 + });
  165 + },
  166 + }
  167 + }
  168 +</script>
  169 +
  170 +<style lang="scss" scoped>
  171 + .page {
  172 +
  173 + .content {
  174 + padding: 25px 16px;
  175 +
  176 + .t1 {
  177 + font-size: 20px;
  178 + font-family: PingFangSC-Medium, PingFang SC;
  179 + font-weight: 500;
  180 + color: #000000;
  181 + }
  182 +
  183 + .dv {
  184 + margin-top: 8px;
  185 + display: flex;
  186 + justify-content: space-between;
  187 +
  188 + .tag {
  189 + display: inline-block;
  190 + padding: 5px;
  191 + background: rgba(12,177,122,0.06);
  192 + border-radius: 2px;
  193 + font-size: 11px;
  194 + font-family: PingFangSC-Light, PingFang SC;
  195 + font-weight: 300;
  196 + color: #0CB17A;
  197 + }
  198 +
  199 + .time {
  200 + font-size: 14px;
  201 + font-family: PingFangSC-Light, PingFang SC;
  202 + font-weight: 300;
  203 + color: rgba(0,0,0,0.45);
  204 + }
  205 + }
  206 +
  207 + }
  208 +
  209 + .tip {
  210 + padding: 30px 16px 0;
  211 + border-bottom: 0.5px solid #E5E5E6;
  212 +
  213 + .ggxq {
  214 + font-size: 16px;
  215 + font-family: PingFangSC-Medium, PingFang SC;
  216 + font-weight: 500;
  217 + color: #000000;
  218 + }
  219 +
  220 + .green-line {
  221 + margin-top: 12px;
  222 + margin-left: 12px;
  223 + width: 40px;
  224 + height: 4px;
  225 + background: linear-gradient(270deg, #26B961 0%, #26B961 100%);
  226 + }
  227 + }
  228 +
  229 + .desc {
  230 + margin: 20px 16px 0;
  231 + // font-size: 14px;
  232 + // font-family: PingFangSC-Regular, PingFang SC;
  233 + // font-weight: 400;
  234 + // color: rgba(0,0,0,0.65);
  235 + }
  236 +
  237 + .fj {
  238 + margin: 30px 16px 0;
  239 + font-size: 14px;
  240 + font-family: PingFangSC-Regular, PingFang SC;
  241 + font-weight: 400;
  242 + color: #000000;
  243 + }
  244 +
  245 + .greenbg {
  246 + margin: 40rpx 32rpx 0;
  247 + display: flex;
  248 + align-items: center;
  249 + // width: 100%;
  250 + height: 68px;
  251 + background: rgba(12,177,122,0.03);
  252 + border-radius: 8px;
  253 + padding: 0 40rpx;
  254 +
  255 + .name {
  256 + margin-left: 8px;
  257 + font-size: 14px;
  258 + font-family: PingFangSC-Regular, PingFang SC;
  259 + font-weight: 400;
  260 + color: #000000;
  261 + }
  262 + }
  263 + }
  264 +</style>
\ No newline at end of file
... ...
  1 +<template>
  2 + <view class="page">
  3 + <view v-if="list.length > 0">
  4 + <view class="list">
  5 + <view v-for="(item,index) in list" :key="index" @click="handelClick(item)">
  6 + <view class="time">
  7 + {{$u.timeFrom(item.sendTime)}}
  8 + </view>
  9 + <view class="list-item">
  10 + <image class="head" :src="`${vuex_ossUrlPubilc}/${item.coverPicPath[0].response.object}`"></image>
  11 + <view class="item-t">
  12 + {{item.title}}
  13 + </view>
  14 + <view class="tag">
  15 + {{type[item.type]}}
  16 + </view>
  17 + <view v-if="item.ifRead == 'unread'" class="red"></view>
  18 + </view>
  19 + </view>
  20 + </view>
  21 + <view style="height: 40rpx;"></view>
  22 + <c-loading :loading="loading"></c-loading>
  23 + <view style="height: 40rpx;"></view>
  24 + </view>
  25 + <view v-else style="width: 100%; height: 100%;">
  26 + <view style="margin: 150px auto 0; width: 187px;height: 110px;">
  27 + <image style="width: 187px;height: 110px;" :src="'/static/img/internship/nodata.png'"></image>
  28 + </view>
  29 + <view style="width: 100%; margin-top: 10px; text-align: center; font-size: 13px; color: #121212;">暂无数据
  30 + </view>
  31 + </view>
  32 + </view>
  33 +</template>
  34 +
  35 +<script>
  36 + import {
  37 + msglistUrl,
  38 + } from '@/config/api.js';
  39 + import listMixin from "@/common/mixins/list-mixin.js";
  40 + export default {
  41 + mixins: [listMixin],
  42 + data() {
  43 + return {
  44 + source: '',
  45 + list: [],
  46 + type: {
  47 + system: '系统公告',
  48 + inform: '通知公告',
  49 + safety_rules: '安全条例',
  50 + vital_document: '重要文件'
  51 + }
  52 + }
  53 + },
  54 +
  55 + onLoad(e) {
  56 + this.source = e.type == '1' ? 'operation' : 'teacher'
  57 + this.loadTestData()
  58 + },
  59 +
  60 + onShow(e) {
  61 + // if (JSON.stringify(this.vuex_user) == '{}') {
  62 + // return
  63 + // }
  64 + // this.loadTestData()
  65 + },
  66 +
  67 + methods: {
  68 + handelClick(item) {
  69 + item.ifRead = 'read'
  70 + this.$u.route({
  71 + url: "/pages/main/message/message-detail/message-detail",
  72 + params: {
  73 + id: item.id
  74 + }
  75 + });
  76 + },
  77 +
  78 + loadTestData() {
  79 + this.finished = false;
  80 + this.loading = "loadmore";
  81 + this.page = 0;
  82 + this.list = [];
  83 + this.mylist = [];
  84 + this._getList();
  85 + },
  86 +
  87 + // 模拟后端分页
  88 + async getData(requestParams) {
  89 + const {
  90 + search = {}
  91 + } = requestParams;
  92 +
  93 + let params = {};
  94 + params.pageNumber = requestParams.page + 1;
  95 + params.pageSize = 10;
  96 + params.source = this.source
  97 +
  98 + return await msglistUrl(params);
  99 + },
  100 +
  101 + // 数据请求(没错就是这么少的代码)
  102 + async _getList() {
  103 + if (this.page == 0) {
  104 + this.list = [];
  105 + }
  106 +
  107 + uni.showLoading({
  108 + title: '数据加载中~',
  109 + mask: true
  110 + })
  111 +
  112 + // 根据实际情况修改自己修改key
  113 + let result = await this.getData({
  114 + page: this.page, // 传入页码
  115 + size: this.size, // 传入每页条数
  116 + search: this.search, // 传入搜索的对象
  117 + });
  118 +
  119 + this.total = result.total;
  120 +
  121 + result.records.map((item) => {
  122 + item.coverPicPath = JSON.parse(item.coverPicPath)
  123 + this.list.push(item);
  124 + });
  125 +
  126 + if (this.list.length == this.total) {
  127 + this.finished = true;
  128 + this.loading = 'nomore';
  129 + }
  130 +
  131 + uni.hideLoading();
  132 + },
  133 + }
  134 + }
  135 +</script>
  136 +
  137 +<style lang="scss" scoped>
  138 + .page {
  139 + padding: 32rpx;
  140 + background: #FDFDFD;
  141 +
  142 + .list {
  143 + // margin-bottom: 15px;
  144 +
  145 + .time {
  146 + font-size: 14px;
  147 + font-family: PingFangSC-Light, PingFang SC;
  148 + font-weight: 300;
  149 + color: rgba(0,0,0,0.45);
  150 + text-align: center;
  151 + }
  152 +
  153 + .list-item {
  154 + margin-top: 15px;
  155 + margin-bottom: 20px;
  156 + width: 100%;
  157 + // height: 238px;
  158 + background: #FFFFFF;
  159 + box-shadow: 0px 2px 20px 0px rgba(0,0,0,0.06);
  160 + border-radius: 8px;
  161 + // overflow: hidden;
  162 + position: relative;
  163 +
  164 + .head {
  165 + width: 100%;
  166 + height: 172px;
  167 + background: #EBEBEB;
  168 + border-top-left-radius: 8px;
  169 + border-top-right-radius: 8px;
  170 + }
  171 +
  172 + .item-t {
  173 + margin: 10px 20px 0;
  174 + font-size: 16px;
  175 + font-family: PingFangSC-Medium, PingFang SC;
  176 + font-weight: 500;
  177 + color: #000000;
  178 + }
  179 +
  180 + .tag {
  181 + margin: 10px 20px;
  182 + display: inline-block;
  183 + padding: 5px;
  184 + background: rgba(12,177,122,0.06);
  185 + border-radius: 2px;
  186 + font-size: 11px;
  187 + font-family: PingFangSC-Light, PingFang SC;
  188 + font-weight: 300;
  189 + color: #0CB17A;
  190 + }
  191 +
  192 + .tag1 {
  193 + margin: 10px 0px;
  194 + display: inline-block;
  195 + padding: 5px;
  196 + background: rgba(12,177,122,0.06);
  197 + border-radius: 2px;
  198 + font-size: 11px;
  199 + font-family: PingFangSC-Light, PingFang SC;
  200 + font-weight: 300;
  201 + color: #0CB17A;
  202 + }
  203 +
  204 + }
  205 +
  206 + .red {
  207 + position: absolute;
  208 + left: -4px;
  209 + top: -4px;
  210 + width: 12px;
  211 + height: 12px;
  212 + border-radius: 6px;
  213 + background-color: red;
  214 + }
  215 + }
  216 + }
  217 +</style>
... ...
... ... @@ -130,24 +130,26 @@
130 130 uploadImages() { //上传图片
131 131 var _this = this
132 132 console.log('begin', this.picList)
  133 +
133 134 let formdata = {}
134   - if (this.ossInit.uploadType == 'aliyun') {
  135 + if (this.ossInit.uploadType == 'minio') {
135 136 formdata = {
136   - 'key': `${_this.ossInit.dir}${new Date().getTime()}`,
  137 + 'bucket': _this.ossInit.bucket,
  138 + 'dir': _this.ossInit.dir,
  139 + 'fileName': `${_this.ossInit.dir}${new Date().getTime()}/` + '${filename}',
  140 + 'accessId': _this.ossInit.accessId,
  141 + 'policy': _this.ossInit.policy
  142 + }
  143 + }else {
  144 + formdata = {
  145 + 'key': `${_this.ossInit.dir}${new Date().getTime()}/` + '${filename}',
  146 + // 'key': `${_this.ossInit.dir}${new Date().getTime()}`,
137 147 'action': `${_this.ossInit.host}`,
138 148 'OSSAccessKeyId': _this.ossInit.accessId,
139 149 'policy': _this.ossInit.policy,
140 150 'signature': _this.ossInit.signature,
141 151 'callback': _this.ossInit.callback,
142 152 }
143   - } else {
144   - formdata = {
145   - 'bucket': _this.ossInit.bucket,
146   - 'dir': _this.ossInit.dir,
147   - 'fileName': `${_this.ossInit.dir}${new Date().getTime()}`,
148   - 'accessId': _this.ossInit.accessId,
149   - 'policy': _this.ossInit.policy
150   - }
151 153 }
152 154 for (var i = 0; i < this.picList.length; i++) {
153 155 uni.uploadFile({
... ...
  1 +<template>
  2 + <view class="page">
  3 + <view class="cell" @click="jump('1')">
  4 + <!-- <view style="display: flex; width: 100%;"> -->
  5 + <img class="icon" src="/static/img/message/msg2.png" alt="">
  6 + <view class="cell-c">
  7 + <view class="t1">
  8 + 系统公告
  9 + </view>
  10 + <view class="t2">
  11 + {{systemNotice.noticeTitle?systemNotice.noticeTitle:'暂无公告'}}
  12 + </view>
  13 + </view>
  14 + <!-- </view> -->
  15 + <view class="time" v-if="systemNotice.sendTime">
  16 + {{$u.timeFrom(systemNotice.sendTime)}}
  17 + </view>
  18 + <view v-if="systemNotice.ifRead == 'unread'" class="red"></view>
  19 + </view>
  20 + <view class="cell" style="margin-top: 30px;" @click="jump('2')">
  21 + <!-- <view style="display: flex; width: 100%;"> -->
  22 + <img class="icon" src="/static/img/message/msg1.png" alt="">
  23 + <view class="cell-c">
  24 + <view class="t1">
  25 + 学校公告
  26 + </view>
  27 + <view class="t2">
  28 + {{schoolNotice.noticeTitle?schoolNotice.noticeTitle:'暂无公告'}}
  29 + </view>
  30 + </view>
  31 + <!-- </view> -->
  32 + <view class="time" v-if="schoolNotice.sendTime">
  33 + {{$u.timeFrom(schoolNotice.sendTime)}}
  34 + </view>
  35 + <view v-if="schoolNotice.ifRead == 'unread'" class="red"></view>
  36 + </view>
  37 + </view>
  38 +</template>
  39 +
  40 +<script>
  41 + import {
  42 + mapGetters,
  43 + mapState,
  44 + mapActions
  45 + } from 'vuex'
  46 +
  47 + import {
  48 + msginfoUrl,
  49 + } from '@/config/api.js';
  50 +
  51 + export default {
  52 + data() {
  53 + return {
  54 + systemNotice: {},
  55 + schoolNotice: {}
  56 + }
  57 + },
  58 +
  59 + onShow() {
  60 + if (this.hasLogin) {
  61 + msginfoUrl().then(res => {
  62 + if (res) {
  63 + this.systemNotice = res.systemNotice
  64 + this.schoolNotice = res.schoolNotice
  65 + }
  66 + })
  67 + }
  68 + },
  69 +
  70 + computed: {
  71 + ...mapState({
  72 + hasLogin: 'hasLogin',
  73 + vuex_user: 'vuex_user',
  74 + teacher: (state) => state.vuex_user.teacher,
  75 + }),
  76 +
  77 +
  78 + },
  79 +
  80 + methods: {
  81 + beforeSwitch(index) {
  82 + return true
  83 + },
  84 +
  85 + jump(type) {
  86 + this.$u.route({
  87 + url: "/pages/main/message/message-list/message-list",
  88 + params: {
  89 + type: type
  90 + }
  91 + });
  92 + }
  93 + }
  94 + }
  95 +</script>
  96 +
  97 +<style lang="scss" scoped>
  98 + .page {
  99 + padding: 16px;
  100 +
  101 + .cell {
  102 + display: flex;
  103 + align-items: center;
  104 + justify-content: space-between;
  105 + height: 50px;
  106 + position: relative;
  107 +
  108 + .icon {
  109 + width: 50px;
  110 + height: 50px;
  111 + }
  112 +
  113 + .cell-c {
  114 + flex: 1;
  115 + margin-left: 20rpx;
  116 + display: flex;
  117 + flex-direction: column;
  118 +
  119 + .t1 {
  120 + font-size: 16px;
  121 + font-family: PingFangSC-Medium, PingFang SC;
  122 + font-weight: 500;
  123 + color: #000000;
  124 + }
  125 +
  126 + .t2 {
  127 + width: 100%;
  128 + overflow: hidden;
  129 + text-overflow: ellipsis;
  130 + display: -webkit-box;
  131 + -webkit-line-clamp: 1;
  132 + -webkit-box-orient: vertical;
  133 + white-space: normal;
  134 + word-break: break-all;
  135 + word-wrap: break-word;
  136 + margin-top: 20rpx;
  137 + font-size: 14px;
  138 + font-family: PingFangSC-Regular, PingFang SC;
  139 + font-weight: 400;
  140 + color: rgba(18,18,18,0.45);
  141 + }
  142 + }
  143 +
  144 + .time {
  145 + font-size: 14px;
  146 + font-family: PingFangSC-Light, PingFang SC;
  147 + font-weight: 300;
  148 + color: rgba(0,0,0,0.45);
  149 + }
  150 +
  151 + .red {
  152 + position: absolute;
  153 + left: 3px;
  154 + top: -1px;
  155 + width: 12px;
  156 + height: 12px;
  157 + border-radius: 6px;
  158 + background-color: red;
  159 + }
  160 + }
  161 + }
  162 +</style>
\ No newline at end of file
... ...
... ... @@ -350,10 +350,16 @@ function timeFrom(timestamp = null, format = 'yyyy-mm-dd') {
350 350 break
351 351 case timer >= 3600 && timer < 86400:
352 352 tips = `${parseInt(timer / 3600)}小时前`
353   - break
354   - case timer >= 86400 && timer < 2592000:
355   - tips = `${parseInt(timer / 86400)}天前`
356   - break
  353 + break
  354 + case timer >= 86400 && timer < 604800:
  355 + tips = parseInt(timer / 86400) + '天前';
  356 + break;
  357 + case timer >= 604800:
  358 + tips = timeFormat(timestamp, 'yyyy年mm月dd日');
  359 + break;
  360 + // case timer >= 86400 && timer < 2592000:
  361 + // tips = `${parseInt(timer / 86400)}天前`
  362 + // break
357 363 default:
358 364 // 如果format为false,则无论什么时间戳,都显示xx之前
359 365 if (format === false) {
... ...
注册登录 后发表评论