From 9127778c6fe1b920b7e7f91073bad4cfc474b2b3 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Wed, 26 Mar 2025 10:09:11 +0800 Subject: [PATCH] 1 --- api/business/notice.js | 20 ++--- pages/components/notice-item.vue | 85 ++++++++++++--------- static/index/xiaohongshu.png | Bin 1390 -> 0 bytes utils/common.js | 126 ++++++++++++++++++++----------- 4 files changed, 138 insertions(+), 93 deletions(-) delete mode 100644 static/index/xiaohongshu.png diff --git a/api/business/notice.js b/api/business/notice.js index ad062bf..b39a993 100644 --- a/api/business/notice.js +++ b/api/business/notice.js @@ -1,15 +1,11 @@ import upload from '@/utils/upload' import request from '@/utils/request' -// 根据code查分类树 -export function getCatgByCode(code) { - const data = { - oldPassword, - newPassword - } - return request({ - url: '/system/user/profile/updatePwd', - method: 'put', - data: data - }) -} +// 根据条件查询通告列表 +export function getNoticeList(params) { + return request({ + url: '/busi/notice/appList', + method: 'get', + params: params + }) +} \ No newline at end of file diff --git a/pages/components/notice-item.vue b/pages/components/notice-item.vue index 8c87ddf..10ecdb3 100644 --- a/pages/components/notice-item.vue +++ b/pages/components/notice-item.vue @@ -2,45 +2,51 @@ - - 某品牌鞋子上海、宁波博主探店招募某品牌鞋子上海、宁波博主探店招募 + + {{item.title}} - 奖励:¥30-400 + 奖励:无稿费 + 奖励:¥{{item.feeDown}}-{{item.feeUp}} - 粉丝:1K-10w + + 粉丝:{{formatNumberWithUnits(item.fansDown)}}-{{formatNumberWithUnits(item.fansUp)}} - + - 类型:时尚 探店 运动 颜值 + 类型:{{item.bloggerTypesText}} - + - - 资深Pr资深 + + {{item.userNickName}} - 659 + {{item.reportNum}} - 659 + {{item.viewNum}} - + @@ -67,7 +75,7 @@ .dl-notice-box { font-size: 29rpx; width: 100%; - padding: 20rpx; + padding: 18rpx; background-color: white; border-radius: 30rpx; margin-bottom: 20rpx; @@ -75,7 +83,7 @@ .dl-notice-title { display: flex; width: 100%; - padding-bottom: 20rpx; + padding-bottom: 10rpx; align-items: center; justify-content: center; @@ -93,35 +101,37 @@ white-space: nowrap; width: 100%; font-weight: bold; - + } } - .dl-notice-content{ + + .dl-notice-content { font-size: 27rpx; display: flex; color: #363636; width: 100%; align-items: center; justify-content: center; - - .left-text{ + + .left-text { flex: 1; min-width: 0; margin-right: 10rpx; - - .text-item{ + + .text-item { display: flex; padding: 5rpx; width: 100%; align-items: center; justify-content: center; - - .dl-icon{ + + .dl-icon { flex: none; width: 40rpx; height: 44rpx; } - .dl-content{ + + .dl-content { flex: 1; overflow: hidden; text-overflow: ellipsis; @@ -129,43 +139,48 @@ width: 100%; padding-left: 15rpx; } - .item-box{ + + .item-box { display: flex; width: 100%; align-items: center; justify-content: center; - - .dl-icon2{ + + .dl-icon2 { flex: none; width: 40rpx; height: 44rpx; border-radius: 50%; } - .dl-icon3{ + + .dl-icon3 { flex: none; width: 30rpx; height: 29rpx; } - .dl-item-right{ + + .dl-item-right { flex: 1; padding-left: 10rpx; - min-width: 0; + min-width: 100rpx; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; } - .dl-number{ + + .dl-number { font-size: 26rpx; margin-right: 5rpx; } } } } - .right-image{ + + .right-image { flex: none; - width: 230rpx; - height: 230rpx; + width: 220rpx; + height: 220rpx; border-radius: 20rpx; } } diff --git a/static/index/xiaohongshu.png b/static/index/xiaohongshu.png deleted file mode 100644 index 007baa283c137e60b954be862ce38b8f874057b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1390 zcmV-!1(EuRP)Px)C`m*?RA@u(ntNG(g-3*gphg!jYzP%B%YBjQQdrddiTzZJH0clbVf5LndHu# zbI7!;@qRsdNLb$M0={AxkA8sHvdEx6p`Vi-Ld3JYQWd~f}lG=XvB;M_SgcGW7_xf3cYgWmgPfSx^r&YfZ7 zM%c8;U6?>FUNn8fhQYOK-awZx!^n~T<0>lP%o#{ehc;~t?1>YwWJ&e7h65@nfLXJk zqy(lj*S= zE*v^!1dJE~SFZR2_38zReF>2QYWw%YqDB6y%Tt1zG6j|`GkprzvuDl6ZWAUrIV3|4 z9OxLLV@G)L!f)R2Lr%i?>@kz{=mC!&!Sm;)C@6=NxUE{j-o3C?59$~NCrHohrKZAh{j&!8_JyupVenwsz1snn!4_x-07y=T3m5#L!Ux*0!AbmC=n_$K+1qry<9qF@VB47X@uX7>eB zIZjA0c`|&sBfWorxP9B?kt|!IK)rz^L3!NG{2>V6Lw4nP_z-&c{v1e&nwSW0-ay;7 z4p2@GWMr7{g2~E)^XG$mNX0b)DuYY zuRK`28n$o$97v(2_2K19=+MCto{|EC1{urB%NnCrAE3-k$9r}5(D?DDB&*tJ5-EM@ zl35JbuZJBwOyyIqty^c{wRYI;#tj3MmIlq5fy(mY#im#HsK2}%jvX_fdh`RbLPO&qh@W5jDB0cP}1>buCl>jxH2$9y;Q+|;JNnSv|05$)C zJtvIxfOHG;y@28X9Z7bHw6-4dbt0}KNxx(MV28$Oz#mZzqz%4gx8wcVj`cHvTK0J( zh8zB|zO8B%`~+wZOK*=vL(_5TGPmP=Te(nPjcHZ$YK-10(W^1at%f?X)Gqx$KCj07 w7I=&wXk|~JXmCq7I>dm&u~sC;HaZXe2RAavMC@V^6951J07*qoM6N<$f`&kje*gdg diff --git a/utils/common.js b/utils/common.js index 471a22f..12602f5 100644 --- a/utils/common.js +++ b/utils/common.js @@ -1,4 +1,9 @@ -import { getJSONData,setJSONData,removeJSONData,setStrData } from '@/utils/auth' +import { + getJSONData, + setJSONData, + removeJSONData, + setStrData +} from '@/utils/auth' // 用户权益code const UserRightsKey = 'User-Rights' //用户当前身份code @@ -12,7 +17,7 @@ export function hasRights(code) { let userRights = getJSONData(UserRightsKey) //默认无权限 let rtnData = false - if(''!=userRights && userRights.con){ + if ('' != userRights && userRights.con) { } return rtnData @@ -23,60 +28,89 @@ export function hasRights(code) { * @param {Object} value 身份值 */ export function changeUserType(value) { - setStrData(UserTypeKey,value) + setStrData(UserTypeKey, value) } /** -* 显示消息提示框 -* @param content 提示的标题 -*/ + * 显示消息提示框 + * @param content 提示的标题 + */ export function toast(content) { - uni.showToast({ - icon: 'none', - title: content - }) + uni.showToast({ + icon: 'none', + title: content + }) } /** -* 显示模态弹窗 -* @param content 提示的标题 -*/ + * 显示模态弹窗 + * @param content 提示的标题 + */ export function showConfirm(content) { - return new Promise((resolve, reject) => { - uni.showModal({ - title: '提示', - content: content, - cancelText: '取消', - confirmText: '确定', - success: function(res) { - resolve(res) - } - }) - }) + return new Promise((resolve, reject) => { + uni.showModal({ + title: '提示', + content: content, + cancelText: '取消', + confirmText: '确定', + success: function(res) { + resolve(res) + } + }) + }) } /** -* 参数处理 -* @param params 参数 -*/ + * 参数处理 + * @param params 参数 + */ export function tansParams(params) { - let result = '' - for (const propName of Object.keys(params)) { - const value = params[propName] - var part = encodeURIComponent(propName) + "=" - if (value !== null && value !== "" && typeof (value) !== "undefined") { - if (typeof value === 'object') { - for (const key of Object.keys(value)) { - if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { - let params = propName + '[' + key + ']' - var subPart = encodeURIComponent(params) + "=" - result += subPart + encodeURIComponent(value[key]) + "&" - } - } - } else { - result += part + encodeURIComponent(value) + "&" - } - } - } - return result + let result = '' + for (const propName of Object.keys(params)) { + const value = params[propName] + var part = encodeURIComponent(propName) + "=" + if (value !== null && value !== "" && typeof(value) !== "undefined") { + if (typeof value === 'object') { + for (const key of Object.keys(value)) { + if (value[key] !== null && value[key] !== "" && typeof(value[key]) !== 'undefined') { + let params = propName + '[' + key + ']' + var subPart = encodeURIComponent(params) + "=" + result += subPart + encodeURIComponent(value[key]) + "&" + } + } + } else { + result += part + encodeURIComponent(value) + "&" + } + } + } + return result } + +/** + * 数字单位转换 + * @param {Object} num + */ +export function formatNumberWithUnits(num) { + const units = ['', 'k', 'w', 'kw']; + const absNum = Math.abs(num); // 获取绝对值以处理负数 + // 处理小于1000的情况,直接返回原数字的字符串形式 + if (absNum < 1000) { + return absNum.toString(); + } + + // 寻找合适的单位 + let unitIndex = 0; + if (absNum > 10000000) { + absNum /= 10000000; + unitIndex = 3; + } else if (absNum > 10000) { + absNum /= 10000; + unitIndex = 2; + } else if (absNum > 1000) { + absNum /= 1000; + unitIndex = 1; + } + // 格式化数字,并添加单位 + const formattedNum = absNum.toFixed(2).replace(/\.?0+$/, ''); // 保留两位小数并去除末尾的零 + return formattedNum + units[unitIndex]; +} \ No newline at end of file