This commit is contained in:
Vinjor 2025-03-31 14:31:41 +08:00
parent f78f20f0a7
commit e73f995d53
21 changed files with 2175 additions and 255 deletions

View File

@ -9,3 +9,30 @@ export function getNoticeList(params) {
params: params params: params
}) })
} }
// 查通告详情
export function getNoticeDetail(params) {
return request({
url: '/busi/notice/appGetDetail',
method: 'get',
params: params
})
}
// 浏览通告
export function addView(params) {
return request({
url: '/busi/view/addView',
method: 'post',
params: params
})
}
// 关闭通告
export function closeNotice(params) {
return request({
url: '/busi/notice/publishTakeDown',
method: 'post',
params: params
})
}

View File

@ -0,0 +1,196 @@
<template>
<view style="position: fixed;z-index: -9999;">
<canvas :canvas-id="canvasID" :style="{width:canvasWidth+'px',height:canvasHeight+'px'}"></canvas>
<view v-if="qrCode == ''">
<QRCode ref="qrcode" />
</view>
</view>
</template>
<script>
import QRCode from "@/components/qr_code/qrcode.vue"
var _this;
export default {
name: 'canvas-images',
props: {
// canvasID canvas-id
canvasID: {
Type: String,
default: 'shareCanvas'
},
canvasWidth: { //
Type: 'int',
default: 375
},
canvasHeight: { //
Type: 'int',
default: 500
},
shareTitle: { //
Type: 'String',
default: '我是这张图片的标题'
},
goodsTitle: { //
Type: 'String',
default: '我是这张图片的标题我是这张图片的标题我是这张图片的标'
},
shareImage: { //
Type: 'String',
default: '/static/bg.jpg'
},
qrSize: { //
Type: 'int',
default: 100
},
qrUrl: { //
Type: 'String',
default: 'https://ext.dcloud.net.cn/plugin?id=5747'
}
},
components: {
QRCode
},
data() {
return {
qrCode: '', //
}
},
mounted() {
_this = this;
},
methods: {
//
canvasCreate() {
_this.$refs.qrcode.make({
size: _this.qrSize,
text: _this.qrUrl
})
.then(res => {
// resuni.canvasToTempFilePath
// console.log(res)
_this.qrCode = res.tempFilePath;
_this.onCanvas();
});
},
//
async onCanvas() {
uni.showLoading({
title: "分享图片生成中..."
});
const ctx = uni.createCanvasContext(_this.canvasID, _this);
// canvas
ctx.setFillStyle('#FFFFFF');
ctx.fillRect(0, 0, _this.canvasWidth, _this.canvasHeight);
ctx.setFillStyle('#000000');
//
ctx.drawImage(_this.shareImage, 50, 50);
ctx.setFontSize(18);
ctx.setTextAlign('center');
ctx.fillText(_this.shareTitle, _this.canvasWidth / 2, 30);
//
ctx.setTextAlign('left')
ctx.setFontSize(16)
_this.writeTextOnCanvas(ctx, 30, 21, _this.goodsTitle, 50, 350);
// 线
ctx.setStrokeStyle('#333333');
ctx.setLineDash([5, 10], 2);
ctx.beginPath();
ctx.moveTo(220, 340);
ctx.lineTo(220, 420);
ctx.stroke();
//
ctx.drawImage(_this.qrCode, 225, 330, 100, 100);
// ctx.draw();
// canvas
let pic = await _this.setTime(ctx)
_this.$emit('success', pic);
},
/**
* @param {Object} ctx_2d getContext("2d") 对象
* @param {int} lineheight 段落文本行高
* @param {int} bytelength 设置单字节文字一行内的数量
* @param {string} text 写入画面的段落文本
* @param {int} startleft 开始绘制文本的 x 坐标位置相对于画布
* @param {int} starttop 开始绘制文本的 y 坐标位置相对于画布
*/
writeTextOnCanvas(ctx_2d, lineheight, bytelength, text, startleft, starttop) {
//
function getTrueLength(str) {
var len = str.length,
truelen = 0;
for (var x = 0; x < len; x++) {
if (str.charCodeAt(x) > 128) {
truelen += 2;
} else {
truelen += 1;
}
}
return truelen;
}
// substr
function cutString(str, leng) {
var len = str.length,
tlen = len,
nlen = 0;
for (var x = 0; x < len; x++) {
if (str.charCodeAt(x) > 128) {
if (nlen + 2 < leng) {
nlen += 2;
} else {
tlen = x;
break;
}
} else {
if (nlen + 1 < leng) {
nlen += 1;
} else {
tlen = x;
break;
}
}
}
return tlen;
}
for (var i = 1; getTrueLength(text) > 0; i++) {
var tl = cutString(text, bytelength);
ctx_2d.fillText(text.substr(0, tl).replace(/^\s+|\s+$/, ""), startleft, (i - 1) * lineheight +
starttop);
text = text.substr(tl);
}
},
//
setTime(ctx) {
return new Promise((resole, err) => {
setTimeout(() => {
ctx.draw(false, async () => {
let pic = await _this.getNewPic();
resole(pic)
});
}, 600)
})
},
//
getNewPic() {
return new Promise((resolve, errs) => {
setTimeout(() => {
uni.canvasToTempFilePath({
canvasId: _this.canvasID,
quality: 1,
complete: (res) => {
// H5tempFilePath base64
// showLoading
uni.hideLoading();
//
resolve(res.tempFilePath)
}
}, _this);
}, 200)
})
},
},
mounted() {
_this = this;
}
}
</script>

1362
components/qr_code/qrcode.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
<template>
<view class="qrcode">
<canvas id="qrcode" canvas-id="qrcode" :style="{'width': `${options.size}px`, 'height': `${options.size}px`}" />
</view>
</template>
<script>
import qrcode from './qrcode'
export default {
name: 'qrcode',
data() {
return {
options: {
canvasId: 'qrcode',
size: 354,
margin: 10,
text: ''
}
}
},
methods: {
make(options) {
return qrcode.make(Object.assign(this.options, options), this)
}
}
}
</script>

View File

@ -16,9 +16,14 @@
<script> <script>
export default { export default {
props: {
currPage: {
Type: 'int',
default: 0
}
},
data() { data() {
return { return {
currPage: 0,
tabbar: [{ tabbar: [{
id: 0, id: 0,
code: "home", code: "home",
@ -66,7 +71,7 @@
* @param {Object} item * @param {Object} item
*/ */
goPage(item) { goPage(item) {
this.currPage=item.id this.currPage = item.id
this.$emit("changeMenu", item.code) this.$emit("changeMenu", item.code)
} }
} }

View File

@ -1,5 +1,6 @@
{ {
"dependencies": { "dependencies": {
"html2canvas": "^1.4.1",
"rich-text-parser": "^1.0.2" "rich-text-parser": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -9,7 +9,7 @@
<view class="left-text"> <view class="left-text">
<view class="text-item"> <view class="text-item">
<image class="dl-icon" src="@/static/index/money.png" mode="aspectFit"></image> <image class="dl-icon" src="@/static/index/money.png" mode="aspectFit"></image>
<view v-if="0==item.feeUp" class="dl-content">奖励无稿费</view> <view v-if="null==item.feeUp" class="dl-content">奖励无稿费</view>
<view v-else class="dl-content">奖励¥{{item.feeDown}}-{{item.feeUp}}</view> <view v-else class="dl-content">奖励¥{{item.feeDown}}-{{item.feeUp}}</view>
</view> </view>
<view class="text-item"> <view class="text-item">
@ -168,6 +168,7 @@
flex: none; flex: none;
width: 30rpx; width: 30rpx;
height: 29rpx; height: 29rpx;
margin-left: 6rpx;
} }
.dl-item-right { .dl-item-right {

View File

@ -1,12 +1,12 @@
<template> <template>
<view class="content"> <view class="content">
<!-- 主体区域 --> <!-- 主体区域 -->
<view style="width: 100%;"> <view class="content-body">
<!-- 通告列表页 --> <!-- 通告列表页 -->
<notice-index v-show="'home'==menuCode"></notice-index> <notice-index v-show="'home'==menuCode"></notice-index>
<mine-index v-show="'my'==menuCode"></mine-index> <mine-index v-show="'my'==menuCode"></mine-index>
</view> </view>
<tabBarVue :currPage="0" ref="tarBar" @changeMenu="changeMenu"></tabBarVue> <tabBarVue :currPage="3" ref="tarBar" @changeMenu="changeMenu"></tabBarVue>
</view> </view>
</template> </template>
@ -15,7 +15,7 @@
import noticeIndex from '@/pages/components/index.vue' import noticeIndex from '@/pages/components/index.vue'
import mineIndex from '@/pages/mine/index.vue' import mineIndex from '@/pages/mine/index.vue'
export default { export default {
components:{ components: {
tabBarVue, tabBarVue,
noticeIndex, noticeIndex,
mineIndex mineIndex
@ -24,7 +24,7 @@
return { return {
menus: ['全部', '最新', '高奖励', '急招', '品牌置换'], menus: ['全部', '最新', '高奖励', '急招', '品牌置换'],
menuIndex: 0, menuIndex: 0,
dataList:['1','2','2','2'], dataList: ['1', '2', '2', '2'],
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@ -32,7 +32,7 @@
total: 0, total: 0,
// //
isTriggered: false, isTriggered: false,
menuCode:"home", menuCode: "my",
} }
}, },
onLoad: function() { onLoad: function() {
@ -46,8 +46,8 @@
* 菜单切换 * 菜单切换
* @param {Object} code * @param {Object} code
*/ */
changeMenu(code){ changeMenu(code) {
this.menuCode=code this.menuCode = code
}, },
/** /**
* 上滑加载数据 * 上滑加载数据
@ -77,9 +77,14 @@
.content { .content {
width: 100%; width: 100%;
color: #363636; color: #363636;
background-color: white; background-color: #F6F6F6;
font-size: 38rpx; font-size: 38rpx;
height: 100vh; height: 100vh;
}
.content-body {
width: 100%;
background-color: white;
padding-top: var(--status-bar-height); padding-top: var(--status-bar-height);
padding-bottom: var(--window-bottom); padding-bottom: var(--window-bottom);
} }

View File

@ -1,200 +1,416 @@
<template> <template>
<view class="mine-container" :style="{height: `${windowHeight}px`}"> <view class="mine-container">
<!--顶部个人信息栏--> <!-- 切换身份 -->
<view class="header-section"> <view class="dl-title">
<view class="flex padding justify-between"> <view class="left-search" @click="changeUserType('bz'==nowUserType?'tgz':'bz')">
<view class="flex align-center"> <image class="dl-image" src="@/static/mine/change_role.png" mode="aspectFit"></image>
<view v-if="!avatar" class="cu-avatar xl round bg-white"> <text class="dl-text">切换至{{'bz'==nowUserType?'通告主':'博主'}}</text>
<view class="iconfont icon-people text-gray icon"></view>
</view> </view>
<image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
</image>
<view v-if="!name" @click="handleToLogin" class="login-tip">
点击登录
</view> </view>
<view v-if="name" @click="handleToInfo" class="user-info"> <!-- 头像信息 -->
<view class="u_title"> <view class="dl-person-box">
用户名{{ name }} <view class="user-image-box">
<view class="dl-image-box">
<image class="touxiang" src="@/static/images/profile.jpg" mode="aspectFit"></image>
<image class="sex" src="@/static/mine/sex_girl.png" mode="aspectFit"></image>
</view>
<view class="name-box">
<text style="margin-bottom: 10rpx;">李林</text>
<view class="fans-box">
<image src="@/static/mine/fans.png" mode="aspectFit"></image>
<view class="fans-num">1000</view>
</view>
</view>
<view class="edit-box">
编辑 <uni-icons type="right" color="#929292" size="12">{{item.unicode}}</uni-icons>
</view>
</view>
<!-- 会员开通 -->
<view class="dl-member-box">
<view class="dl-left">
<image class="dl-icon" src="@/static/index/zuanshi.png" mode="aspectFit"></image>
<text>开通会员 解锁更多权益</text>
</view>
<view class="dl-right">
<view class="dl-go-view">立即开通</view>
</view>
</view>
<!-- 积分 -->
<view class="points-box">
<view class="item-box">
<view class="item-text-box">
<view>积分<text class="red-text">140</text></view>
<view class="dl-little">赚积分<uni-icons type="right" size="10">{{item.unicode}}</uni-icons></view>
</view>
<image src="@/static/index/zuanshi.png" mode="aspectFit"></image>
</view>
<view class="item-box">
<view class="item-text-box">
<view>报名<text class="red-text">140</text></view>
<view class="dl-little">去提额<uni-icons type="right" size="10">{{item.unicode}}</uni-icons></view>
</view>
<image src="@/static/index/zuanshi.png" mode="aspectFit"></image>
</view> </view>
</view> </view>
</view> </view>
<view @click="handleToInfo" class="flex align-center"> <!-- 个人信息和其他信息 -->
<text>个人信息</text> <view class="other-box">
<view class="iconfont icon-right"></view> <view class="box-room">
<view class="detail-title">个人信息</view>
<view class="menu-box">
<view class="menu-item">
<image src="@/static/mine/zuji.png" mode="aspectFit"></image>
<view>足迹</view>
</view>
<view class="menu-item">
<image src="@/static/mine/shezhi.png" mode="aspectFit"></image>
<view>设置</view>
</view>
<view class="menu-item">
<image src="@/static/mine/dizhi.png" mode="aspectFit"></image>
<view>地址</view>
</view>
<view class="menu-item">
<image src="@/static/mine/mingpian.png" mode="aspectFit"></image>
<view>名片</view>
</view>
<view class="menu-item">
<image src="@/static/mine/tongyong.png" mode="aspectFit"></image>
<view>通用</view>
</view> </view>
</view> </view>
</view> </view>
<view class="content-section">
<view class="mine-actions grid col-4 text-center">
<view class="action-item" @click="handleJiaoLiuQun">
<view class="iconfont icon-friendfill text-pink icon"></view>
<text class="text">交流群</text>
</view> </view>
<view class="action-item" @click="handleBuilding"> <view class="other-box">
<view class="iconfont icon-service text-blue icon"></view> <view class="box-room">
<text class="text">在线客服</text> <view class="detail-title">其他信息</view>
<view class="menu-box">
<view class="menu-item">
<image src="@/static/mine/xinrenshouce.png" mode="aspectFit"></image>
<view>新人手册</view>
</view> </view>
<view class="action-item" @click="handleBuilding"> <view class="menu-item">
<view class="iconfont icon-community text-mauve icon"></view> <image src="@/static/mine/kefu.png" mode="aspectFit"></image>
<text class="text">反馈社区</text> <view>联系客服</view>
</view> </view>
<view class="action-item" @click="handleBuilding"> <view class="menu-item">
<view class="iconfont icon-dianzan text-green icon"></view> <image src="@/static/mine/gognzhonghao.png" mode="aspectFit"></image>
<text class="text">点赞我们</text> <view>公众号</view>
</view> </view>
<view class="menu-item">
<image src="@/static/mine/jairushequ.png" mode="aspectFit"></image>
<view>加入社区</view>
</view> </view>
<view class="menu-item">
<view class="menu-list"> <image src="@/static/mine/yijianfankui.png" mode="aspectFit"></image>
<view class="list-cell list-cell-arrow" @click="handleToEditInfo"> <view>意见反馈</view>
<view class="menu-item-box">
<view class="iconfont icon-user menu-icon"></view>
<view>编辑资料</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleHelp">
<view class="menu-item-box">
<view class="iconfont icon-help menu-icon"></view>
<view>常见问题</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleAbout">
<view class="menu-item-box">
<view class="iconfont icon-aixin menu-icon"></view>
<view>关于我们</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleToSetting">
<view class="menu-item-box">
<view class="iconfont icon-setting menu-icon"></view>
<view>应用设置</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<tabBarVue :currPage="3" ref="tarBar" ></tabBarVue>
</view> </view>
</template> </template>
<script> <script>
import tabBarVue from '@/components/tabbar/tabBar.vue' import tabBarVue from '@/components/tabbar/tabBar.vue'
import storage from '@/utils/storage' import storage from '@/utils/storage'
import constant from '@/utils/constant';
import {
changeUserType,
getUserType,
formatNumberWithUnits,
calculateTimeDifference
} from '@/utils/common.js'
export default { export default {
components:{ components: {
tabBarVue, tabBarVue,
}, },
data() { data() {
return { return {
name: this.$store.state.user.name, //
version: getApp().globalData.config.appInfo.version nowUserType: null,
} }
}, },
computed: { onLoad() {
avatar() { nowUserType = getUserType()
return this.$store.state.user.avatar
}, },
computed: {
windowHeight() { windowHeight() {
return uni.getSystemInfoSync().windowHeight - 50 return uni.getSystemInfoSync().windowHeight - 50
} }
}, },
methods: { methods: {
/**
* 切换用户身份
*/
changeUserType(type) {
changeUserType(type)
this.nowUserType = type
},
handleToInfo() { handleToInfo() {
this.$tab.navigateTo('/pages/mine/info/index') this.$tab.navigateTo('/pages/mine/info/index')
}, },
handleToEditInfo() {
this.$tab.navigateTo('/pages/mine/info/edit')
},
handleToSetting() {
this.$tab.navigateTo('/pages/mine/setting/index')
},
handleToLogin() {
this.$tab.reLaunch('/pages/login')
},
handleToAvatar() {
this.$tab.navigateTo('/pages/mine/avatar/index')
},
handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => {
this.$tab.reLaunch('/pages/index')
})
})
},
handleHelp() {
this.$tab.navigateTo('/pages/mine/help/index')
},
handleAbout() {
this.$tab.navigateTo('/pages/mine/about/index')
},
handleJiaoLiuQun() {
this.$modal.showToast('QQ群①133713780(满)、②146013835(满)、③189091635')
},
handleBuilding() {
this.$modal.showToast('模块建设中~')
}
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
page {
background-color: #f5f6f7;
}
.mine-container { .mine-container {
width: 100%; width: 100%;
color: #363636;
font-size: 38rpx;
height: 100%; height: 100%;
display: flex;
flex-direction: column;
.header-section { align-items: center;
padding: 15px 15px 45px 15px; justify-content: center;
background-color: #3c96f3;
color: white;
.login-tip {
font-size: 18px;
margin-left: 10px;
}
.cu-avatar {
border: 2px solid #eaeaea;
.icon {
font-size: 40px;
}
}
.user-info {
margin-left: 15px;
.u_title {
font-size: 18px;
line-height: 30px;
}
}
}
.content-section {
position: relative; position: relative;
top: -50px;
.mine-actions { .dl-title {
margin: 15px 15px; width: 100%;
padding: 20px 0px;
border-radius: 8px;
background-color: white; background-color: white;
display: flex;
position: relative;
z-index: 10;
font-size: 26rpx;
padding: 55rpx 10rpx 13rpx 15rpx;
border-bottom: 1px solid #F4F4F4;
.action-item {
.icon { .left-search {
font-size: 28px; flex: 1;
display: flex;
align-items: center;
justify-content: left;
position: relative;
.dl-image {
width: 30rpx;
height: 30rpx;
} }
.text { .dl-text {
display: block; padding-left: 10rpx;
font-size: 13px; }
margin: 8px 0px; }
}
.dl-person-box {
width: 100%;
background-color: white;
padding: 20rpx 25rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
.user-image-box {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
.dl-image-box {
display: flex;
align-items: center;
justify-content: center;
width: 100rpx;
position: relative;
.touxiang {
border-radius: 50%;
width: 80rpx;
height: 80rpx;
}
.sex {
width: 40rpx;
height: 40rpx;
position: absolute;
bottom: -5rpx;
right: 0rpx;
}
}
.name-box {
display: flex;
padding-left: 20rpx;
flex: 1;
flex-direction: column;
align-items: self-start;
justify-content: center;
.fans-box {
font-size: 18rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #FEF4EF;
padding: 5rpx 10rpx;
color: #FE9860;
border-radius: 20rpx;
image {
height: 20rpx;
width: 20rpx;
}
}
.fans-num {}
}
.edit-box {
color: #929292;
text-align: right;
padding-right: 20rpx;
font-size: 22rpx;
width: 200rpx;
}
}
.dl-member-box {
display: flex;
align-items: center;
margin-top: 10rpx;
border-radius: 35rpx;
justify-content: center;
height: 120rpx;
width: 100%;
background: url('/static/index/member-bg.png');
background-size: contain;
background-position: center;
/* 图片居中显示 */
background-repeat: no-repeat;
/* 不重复背景图片 */
.dl-left {
display: flex;
flex: 1;
padding-left: 30rpx;
align-items: center;
font-size: 30rpx;
color: #623109;
justify-content: left;
.dl-icon {
width: 60rpx;
height: 56rpx;
}
}
.dl-right {
.dl-go-view {
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #F5D8A5;
color: #623109;
padding: 10rpx 25rpx;
float: right;
border-radius: 30rpx;
}
}
}
}
.points-box {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
.item-box {
flex: 1;
border-radius: 20rpx;
background-color: #FEF4EF;
margin: 8rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx;
.item-text-box {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.dl-little {
font-size: 22rpx;
background-color: white;
border-radius: 20rpx;
padding: 5rpx 20rpx;
margin-top: 15rpx;
}
}
image {
width: 100rpx;
height: 100rpx;
}
.red-text {
color: #FC1F3E;
}
}
}
.other-box {
background-color: #F6F6F6;
width: 100%;
flex-direction: column;
padding: 30rpx;
display: flex;
align-items: center;
justify-content: center;
.box-room {
display: flex;
background-color: white;
border-radius: 20rpx;
width: 100%;
flex-direction: column;
padding: 25rpx 30rpx;
align-items: self-start;
justify-content: center;
.detail-title {
border-left: 8rpx solid #FC1F3E;
font-weight: bold;
font-size: 29rpx;
padding-left: 20rpx;
margin-bottom: 30rpx;
}
.menu-box {
border-top: 1rpx solid #F7F7F7;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
.menu-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 24rpx;
margin: 10rpx;
image {
width: 60rpx;
height: 60rpx;
margin-bottom: 10rpx;
}
} }
} }
} }

BIN
static/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
static/detail/approval.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
static/detail/card.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
static/detail/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
static/detail/share.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -108,6 +108,8 @@ const user = {
} }
//会员权益 //会员权益
setJSONData(constant.userRightsKey, res.rights) setJSONData(constant.userRightsKey, res.rights)
//用户基本信息
setJSONData(constant.userInfo, res.user)
if (!getStrData(constant.userTypeKey)) { if (!getStrData(constant.userTypeKey)) {
//没有默认身份,默认博主 //没有默认身份,默认博主
changeUserType(constant.bz) changeUserType(constant.bz)

View File

@ -1,23 +1,25 @@
<template> <template>
<view class="uni-popup-dialog"> <view class="uni-popup-dialog">
<view class="uni-dialog-title"> <!-- <view class="uni-dialog-title">
<text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{titleText}}</text> <text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{titleText}}</text>
</view> </view> -->
<view v-if="mode === 'base'" class="uni-dialog-content"> <view v-if="mode === 'base'" class="uni-dialog-content">
<slot> <slot>
<image v-if="iconPath" :src="iconPath" mode="aspectFit"></image>
<text class="uni-dialog-content-text">{{content}}</text> <text class="uni-dialog-content-text">{{content}}</text>
</slot> </slot>
</view> </view>
<view v-else class="uni-dialog-content"> <view v-else class="uni-dialog-content">
<slot> <slot>
<input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText" :focus="focus" > <input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText"
:focus="focus">
</slot> </slot>
</view> </view>
<view class="uni-dialog-button-group"> <view class="uni-dialog-button-group">
<view class="uni-dialog-button" @click="closeDialog"> <view class="uni-dialog-button" @click="closeDialog">
<text class="uni-dialog-button-text">{{closeText}}</text> <text class="uni-dialog-button-text">{{closeText}}</text>
</view> </view>
<view class="uni-dialog-button uni-border-left" @click="onOk"> <view class="uni-dialog-button uni-border-left dl-button-ok" @click="onOk">
<text class="uni-dialog-button-text uni-button-color">{{okText}}</text> <text class="uni-dialog-button-text uni-button-color">{{okText}}</text>
</view> </view>
</view> </view>
@ -31,7 +33,9 @@
initVueI18n initVueI18n
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import messages from '../uni-popup/i18n/index.js' import messages from '../uni-popup/i18n/index.js'
const { t } = initVueI18n(messages) const {
t
} = initVueI18n(messages)
/** /**
* PopUp 弹出层-对话框样式 * PopUp 弹出层-对话框样式
* @description 弹出层-对话框样式 * @description 弹出层-对话框样式
@ -55,9 +59,9 @@
export default { export default {
name: "uniPopupDialog", name: "uniPopupDialog",
mixins: [popup], mixins: [popup],
emits:['confirm','close'], emits: ['confirm', 'close'],
props: { props: {
inputType:{ inputType: {
type: String, type: String,
default: 'text' default: 'text'
}, },
@ -89,11 +93,15 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
cancelText:{ cancelText: {
type: String, type: String,
default: '' default: ''
}, },
confirmText:{ confirmText: {
type: String,
default: ''
},
iconPath: {
type: String, type: String,
default: '' default: ''
} }
@ -151,12 +159,12 @@
* 点击确认按钮 * 点击确认按钮
*/ */
onOk() { onOk() {
if (this.mode === 'input'){ if (this.mode === 'input') {
this.$emit('confirm', this.val) this.$emit('confirm', this.val)
}else{ } else {
this.$emit('confirm') this.$emit('confirm')
} }
if(this.beforeClose) return if (this.beforeClose) return
this.popup.close() this.popup.close()
}, },
/** /**
@ -164,17 +172,17 @@
*/ */
closeDialog() { closeDialog() {
this.$emit('close') this.$emit('close')
if(this.beforeClose) return if (this.beforeClose) return
this.popup.close() this.popup.close()
}, },
close(){ close() {
this.popup.close() this.popup.close()
} }
} }
} }
</script> </script>
<style lang="scss" > <style lang="scss">
.uni-popup-dialog { .uni-popup-dialog {
width: 300px; width: 300px;
border-radius: 11px; border-radius: 11px;
@ -199,15 +207,22 @@
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
/* #endif */ /* #endif */
flex-direction: row; display: flex;
flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 20px; padding: 20px;
image {
margin: 30rpx 0 15rpx 0;
width: 100rpx;
height: 100rpx;
}
} }
.uni-dialog-content-text { .uni-dialog-content-text {
font-size: 14px; font-size: 14px;
color: #6C6C6C; color: #363636;
} }
.uni-dialog-button-group { .uni-dialog-button-group {
@ -232,6 +247,11 @@
height: 45px; height: 45px;
} }
.dl-button-ok {
background-color: #FC1F3E;
border-radius: 0 0 11px 0;
}
.uni-border-left { .uni-border-left {
border-left-color: #f0f0f0; border-left-color: #f0f0f0;
border-left-style: solid; border-left-style: solid;
@ -244,7 +264,7 @@
} }
.uni-button-color { .uni-button-color {
color: #007aff; color: white;
} }
.uni-dialog-input { .uni-dialog-input {

View File

@ -3,7 +3,9 @@
<view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view> <view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view>
<view class="uni-share-content"> <view class="uni-share-content">
<view class="uni-share-content-box"> <view class="uni-share-content-box">
<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)"> <view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index"
@click.stop="select(item,index)">
<button v-if="'wx'==item.name" class="share-button" open-type="share" plain="true"></button>
<image class="uni-share-image" :src="item.icon" mode="aspectFill"></image> <image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
<text class="uni-share-text">{{item.text}}</text> <text class="uni-share-text">{{item.text}}</text>
</view> </view>
@ -22,11 +24,13 @@
initVueI18n initVueI18n
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import messages from '../uni-popup/i18n/index.js' import messages from '../uni-popup/i18n/index.js'
const { t } = initVueI18n(messages) const {
t
} = initVueI18n(messages)
export default { export default {
name: 'UniPopupShare', name: 'UniPopupShare',
mixins:[popup], mixins: [popup],
emits:['select'], emits: ['select'],
props: { props: {
title: { title: {
type: String, type: String,
@ -45,21 +49,21 @@
name: 'wx' name: 'wx'
}, },
{ {
text: '支付宝', text: '海报',
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/d684ae40-50be-11eb-8ff1-d5dcf8779628.png', icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/d684ae40-50be-11eb-8ff1-d5dcf8779628.png',
name: 'wx' name: 'hb'
}, },
{ {
text: 'QQ', text: '举报',
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/e7a79520-50be-11eb-b997-9918a5dda011.png', icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/e7a79520-50be-11eb-b997-9918a5dda011.png',
name: 'qq' name: 'jb'
},
{
text: '新浪',
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/0dacdbe0-50bf-11eb-8ff1-d5dcf8779628.png',
name: 'sina'
}, },
// { // {
// text: '',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/0dacdbe0-50bf-11eb-8ff1-d5dcf8779628.png',
// name: 'sina'
// },
// {
// text: '', // text: '',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png', // icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
// name: 'copy' // name: 'copy'
@ -91,24 +95,34 @@
index index
}) })
this.close() this.close()
}, },
/** /**
* 关闭窗口 * 关闭窗口
*/ */
close() { close() {
if(this.beforeClose) return if (this.beforeClose) return
this.popup.close() this.popup.close()
} }
} }
} }
</script> </script>
<style lang="scss" > <style lang="scss">
button[plain] {
border: 0
}
.share-button {
position: absolute;
width: 100rpx;
height: 100rpx;
}
.uni-popup-share { .uni-popup-share {
background-color: #fff; background-color: #fff;
border-top-left-radius: 11px; border-top-left-radius: 11px;
border-top-right-radius: 11px; border-top-right-radius: 11px;
} }
.uni-share-title { .uni-share-title {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -118,10 +132,12 @@
justify-content: center; justify-content: center;
height: 40px; height: 40px;
} }
.uni-share-title-text { .uni-share-title-text {
font-size: 14px; font-size: 14px;
color: #666; color: #666;
} }
.uni-share-content { .uni-share-content {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -137,11 +153,12 @@
/* #endif */ /* #endif */
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
width: 360px; width: 100%;
} }
.uni-share-content-item { .uni-share-content-item {
width: 90px; position: relative;
flex: 1;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
/* #endif */ /* #endif */
@ -152,7 +169,9 @@
} }
.uni-share-content-item:active { .uni-share-content-item:active {
pointer-events: none;
background-color: #f5f5f5; background-color: #f5f5f5;
position: relative;
} }
.uni-share-image { .uni-share-image {
@ -161,6 +180,7 @@
} }
.uni-share-text { .uni-share-text {
z-index: 999;
margin-top: 10px; margin-top: 10px;
font-size: 14px; font-size: 14px;
color: #3B4144; color: #3B4144;

View File

@ -13,14 +13,14 @@ export function removeToken() {
} }
export function getJSONData(keyStr) { export function getJSONData(keyStr) {
if(uni.getStorageSync(keyStr)){ if (uni.getStorageSync(keyStr)) {
return JSON.parse(uni.getStorageSync(keyStr)) return JSON.parse(uni.getStorageSync(keyStr))
}else{ } else {
return ""; return null;
} }
} }
export function setJSONData(keyStr,dataObj) { export function setJSONData(keyStr, dataObj) {
return uni.setStorageSync(keyStr, JSON.stringify(dataObj)) return uni.setStorageSync(keyStr, JSON.stringify(dataObj))
} }
@ -32,7 +32,7 @@ export function getStrData(keyStr) {
return uni.getStorageSync(keyStr) return uni.getStorageSync(keyStr)
} }
export function setStrData(keyStr,dataStr) { export function setStrData(keyStr, dataStr) {
return uni.setStorageSync(keyStr, dataStr) return uni.setStorageSync(keyStr, dataStr)
} }

View File

@ -28,7 +28,8 @@ export function hasRights(code) {
rtnData = userRights[code] rtnData = userRights[code]
} }
return rtnData return rtnData
}/** }
/**
* 切换用户当前身份 * 切换用户当前身份
* @param {Object} value 身份值 * @param {Object} value 身份值
*/ */
@ -36,6 +37,14 @@ export function changeUserType(value) {
setStrData(constant.userTypeKey, value) setStrData(constant.userTypeKey, value)
} }
/**
* 获取用户当前身份
* @param {Object} value 身份值
*/
export function getUserType() {
return getStrData(constant.userTypeKey)
}
/** /**
* 显示消息提示框 * 显示消息提示框
* @param content 提示的标题 * @param content 提示的标题
@ -97,10 +106,11 @@ export function tansParams(params) {
*/ */
export function formatNumberWithUnits(num) { export function formatNumberWithUnits(num) {
const units = ['', 'k', 'w', 'kw']; const units = ['', 'k', 'w', 'kw'];
const absNum = Math.abs(num); // 获取绝对值以处理负数 // 获取绝对值以处理负数
let absNum = Math.abs(num);
// 处理小于1000的情况直接返回原数字的字符串形式 // 处理小于1000的情况直接返回原数字的字符串形式
if (absNum < 1000) { if (absNum < 1000) {
return absNum.toString(); return num;
} }
// 寻找合适的单位 // 寻找合适的单位
@ -119,3 +129,29 @@ export function formatNumberWithUnits(num) {
const formattedNum = absNum.toFixed(2).replace(/\.?0+$/, ''); // 保留两位小数并去除末尾的零 const formattedNum = absNum.toFixed(2).replace(/\.?0+$/, ''); // 保留两位小数并去除末尾的零
return formattedNum + units[unitIndex]; return formattedNum + units[unitIndex];
} }
/**
* 计算某个时间是几天几小时之前
* @param {Object} time
*/
export function calculateTimeDifference(time) {
// 将时间字符串转换为Date对象
const nowDate = new Date();
const lastDate = new Date(time);
// 计算时间差(毫秒)
const diffMs = Math.abs(nowDate.getTime() - lastDate.getTime());
// 将毫秒转换为小时
const diffHours = diffMs / (1000 * 60 * 60);
// 计算完整的整天天数和剩余的小时数
const diffDays = Math.floor(diffHours / 24);
const remainingHours = diffHours % 24;
if (diffDays > 0) {
return parseInt(diffDays) + "天前"
} else {
return parseInt(remainingHours) + "小时前"
}
}

View File

@ -7,6 +7,8 @@ const constant = {
userRightsKey: 'User-Rights', userRightsKey: 'User-Rights',
// 用户当前身份code // 用户当前身份code
userTypeKey: 'User-Type', userTypeKey: 'User-Type',
//当前用户信息
userInfo: 'User-Info',
//博主 //博主
bz: '02', bz: '02',
//通告主 //通告主