1
@ -8,4 +8,31 @@ export function getNoticeList(params) {
|
||||
method: 'get',
|
||||
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
|
||||
})
|
||||
}
|
196
components/hj-placard/shareImages.vue
Normal 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 => {
|
||||
// 返回的res与uni.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) => {
|
||||
// 在H5平台下,tempFilePath 为 base64
|
||||
// 关闭showLoading
|
||||
uni.hideLoading();
|
||||
// 储存海报地址 也是分享的地址
|
||||
resolve(res.tempFilePath)
|
||||
}
|
||||
}, _this);
|
||||
}, 200)
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
_this = this;
|
||||
}
|
||||
}
|
||||
</script>
|
1362
components/qr_code/qrcode.js
Normal file
27
components/qr_code/qrcode.vue
Normal 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>
|
@ -16,9 +16,14 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
currPage: {
|
||||
Type: 'int',
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currPage: 0,
|
||||
tabbar: [{
|
||||
id: 0,
|
||||
code: "home",
|
||||
@ -66,7 +71,7 @@
|
||||
* @param {Object} item
|
||||
*/
|
||||
goPage(item) {
|
||||
this.currPage=item.id
|
||||
this.currPage = item.id
|
||||
this.$emit("changeMenu", item.code)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"html2canvas": "^1.4.1",
|
||||
"rich-text-parser": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -9,7 +9,7 @@
|
||||
<view class="left-text">
|
||||
<view class="text-item">
|
||||
<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>
|
||||
<view class="text-item">
|
||||
@ -168,6 +168,7 @@
|
||||
flex: none;
|
||||
width: 30rpx;
|
||||
height: 29rpx;
|
||||
margin-left: 6rpx;
|
||||
}
|
||||
|
||||
.dl-item-right {
|
||||
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<!-- 主体区域 -->
|
||||
<view style="width: 100%;">
|
||||
<view class="content-body">
|
||||
<!-- 通告列表页 -->
|
||||
<notice-index v-show="'home'==menuCode"></notice-index>
|
||||
<mine-index v-show="'my'==menuCode"></mine-index>
|
||||
</view>
|
||||
<tabBarVue :currPage="0" ref="tarBar" @changeMenu="changeMenu"></tabBarVue>
|
||||
<tabBarVue :currPage="3" ref="tarBar" @changeMenu="changeMenu"></tabBarVue>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -15,16 +15,16 @@
|
||||
import noticeIndex from '@/pages/components/index.vue'
|
||||
import mineIndex from '@/pages/mine/index.vue'
|
||||
export default {
|
||||
components:{
|
||||
components: {
|
||||
tabBarVue,
|
||||
noticeIndex,
|
||||
mineIndex
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menus: ['全部', '最新', '高奖励', '急招', '品牌置换'],
|
||||
menus: ['全部', '最新', '高奖励', '急招', '品牌置换'],
|
||||
menuIndex: 0,
|
||||
dataList:['1','2','2','2'],
|
||||
dataList: ['1', '2', '2', '2'],
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
@ -32,7 +32,7 @@
|
||||
total: 0,
|
||||
//下来刷新状态
|
||||
isTriggered: false,
|
||||
menuCode:"home",
|
||||
menuCode: "my",
|
||||
}
|
||||
},
|
||||
onLoad: function() {
|
||||
@ -46,8 +46,8 @@
|
||||
* 菜单切换
|
||||
* @param {Object} code
|
||||
*/
|
||||
changeMenu(code){
|
||||
this.menuCode=code
|
||||
changeMenu(code) {
|
||||
this.menuCode = code
|
||||
},
|
||||
/**
|
||||
* 上滑加载数据
|
||||
@ -77,10 +77,15 @@
|
||||
.content {
|
||||
width: 100%;
|
||||
color: #363636;
|
||||
background-color: white;
|
||||
background-color: #F6F6F6;
|
||||
font-size: 38rpx;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.content-body {
|
||||
width: 100%;
|
||||
background-color: white;
|
||||
padding-top: var(--status-bar-height);
|
||||
padding-bottom: var(--window-bottom);
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -1,203 +1,419 @@
|
||||
<template>
|
||||
<view class="mine-container" :style="{height: `${windowHeight}px`}">
|
||||
<!--顶部个人信息栏-->
|
||||
<view class="header-section">
|
||||
<view class="flex padding justify-between">
|
||||
<view class="flex align-center">
|
||||
<view v-if="!avatar" class="cu-avatar xl round bg-white">
|
||||
<view class="iconfont icon-people text-gray icon"></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 v-if="name" @click="handleToInfo" class="user-info">
|
||||
<view class="u_title">
|
||||
用户名:{{ name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="handleToInfo" class="flex align-center">
|
||||
<text>个人信息</text>
|
||||
<view class="iconfont icon-right"></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 class="action-item" @click="handleBuilding">
|
||||
<view class="iconfont icon-service text-blue icon"></view>
|
||||
<text class="text">在线客服</text>
|
||||
</view>
|
||||
<view class="action-item" @click="handleBuilding">
|
||||
<view class="iconfont icon-community text-mauve icon"></view>
|
||||
<text class="text">反馈社区</text>
|
||||
</view>
|
||||
<view class="action-item" @click="handleBuilding">
|
||||
<view class="iconfont icon-dianzan text-green icon"></view>
|
||||
<text class="text">点赞我们</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-list">
|
||||
<view class="list-cell list-cell-arrow" @click="handleToEditInfo">
|
||||
<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>
|
||||
<tabBarVue :currPage="3" ref="tarBar" ></tabBarVue>
|
||||
</view>
|
||||
<view class="mine-container">
|
||||
<!-- 切换身份 -->
|
||||
<view class="dl-title">
|
||||
<view class="left-search" @click="changeUserType('bz'==nowUserType?'tgz':'bz')">
|
||||
<image class="dl-image" src="@/static/mine/change_role.png" mode="aspectFit"></image>
|
||||
<text class="dl-text">切换至{{'bz'==nowUserType?'通告主':'博主'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 头像信息 -->
|
||||
<view class="dl-person-box">
|
||||
<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 class="other-box">
|
||||
<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 class="other-box">
|
||||
<view class="box-room">
|
||||
<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 class="menu-item">
|
||||
<image src="@/static/mine/kefu.png" mode="aspectFit"></image>
|
||||
<view>联系客服</view>
|
||||
</view>
|
||||
<view class="menu-item">
|
||||
<image src="@/static/mine/gognzhonghao.png" mode="aspectFit"></image>
|
||||
<view>公众号</view>
|
||||
</view>
|
||||
<view class="menu-item">
|
||||
<image src="@/static/mine/jairushequ.png" mode="aspectFit"></image>
|
||||
<view>加入社区</view>
|
||||
</view>
|
||||
<view class="menu-item">
|
||||
<image src="@/static/mine/yijianfankui.png" mode="aspectFit"></image>
|
||||
<view>意见反馈</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tabBarVue from '@/components/tabbar/tabBar.vue'
|
||||
import storage from '@/utils/storage'
|
||||
|
||||
export default {
|
||||
components:{
|
||||
tabBarVue,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: this.$store.state.user.name,
|
||||
version: getApp().globalData.config.appInfo.version
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
avatar() {
|
||||
return this.$store.state.user.avatar
|
||||
},
|
||||
windowHeight() {
|
||||
return uni.getSystemInfoSync().windowHeight - 50
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleToInfo() {
|
||||
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('模块建设中~')
|
||||
}
|
||||
}
|
||||
}
|
||||
import storage from '@/utils/storage'
|
||||
import constant from '@/utils/constant';
|
||||
import {
|
||||
changeUserType,
|
||||
getUserType,
|
||||
formatNumberWithUnits,
|
||||
calculateTimeDifference
|
||||
} from '@/utils/common.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
tabBarVue,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//当前用户类型
|
||||
nowUserType: null,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
nowUserType = getUserType()
|
||||
},
|
||||
computed: {
|
||||
windowHeight() {
|
||||
return uni.getSystemInfoSync().windowHeight - 50
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 切换用户身份
|
||||
*/
|
||||
changeUserType(type) {
|
||||
changeUserType(type)
|
||||
this.nowUserType = type
|
||||
},
|
||||
handleToInfo() {
|
||||
this.$tab.navigateTo('/pages/mine/info/index')
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f5f6f7;
|
||||
}
|
||||
.mine-container {
|
||||
width: 100%;
|
||||
color: #363636;
|
||||
font-size: 38rpx;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
|
||||
.mine-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.dl-title {
|
||||
width: 100%;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
font-size: 26rpx;
|
||||
padding: 55rpx 10rpx 13rpx 15rpx;
|
||||
border-bottom: 1px solid #F4F4F4;
|
||||
|
||||
|
||||
.header-section {
|
||||
padding: 15px 15px 45px 15px;
|
||||
background-color: #3c96f3;
|
||||
color: white;
|
||||
.left-search {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: left;
|
||||
position: relative;
|
||||
|
||||
.login-tip {
|
||||
font-size: 18px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.dl-image {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
|
||||
.cu-avatar {
|
||||
border: 2px solid #eaeaea;
|
||||
.dl-text {
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 40px;
|
||||
}
|
||||
}
|
||||
.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-info {
|
||||
margin-left: 15px;
|
||||
.user-image-box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.u_title {
|
||||
font-size: 18px;
|
||||
line-height: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.dl-image-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100rpx;
|
||||
position: relative;
|
||||
|
||||
.content-section {
|
||||
position: relative;
|
||||
top: -50px;
|
||||
.touxiang {
|
||||
border-radius: 50%;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
.mine-actions {
|
||||
margin: 15px 15px;
|
||||
padding: 20px 0px;
|
||||
border-radius: 8px;
|
||||
background-color: white;
|
||||
.sex {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
position: absolute;
|
||||
bottom: -5rpx;
|
||||
right: 0rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.action-item {
|
||||
.icon {
|
||||
font-size: 28px;
|
||||
}
|
||||
.name-box {
|
||||
display: flex;
|
||||
padding-left: 20rpx;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
align-items: self-start;
|
||||
justify-content: center;
|
||||
|
||||
.text {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
margin: 8px 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
BIN
static/bg.jpg
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
static/detail/approval.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
static/detail/card.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
static/detail/home.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
static/detail/share.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@ -108,6 +108,8 @@ const user = {
|
||||
}
|
||||
//会员权益
|
||||
setJSONData(constant.userRightsKey, res.rights)
|
||||
//用户基本信息
|
||||
setJSONData(constant.userInfo, res.user)
|
||||
if (!getStrData(constant.userTypeKey)) {
|
||||
//没有默认身份,默认博主
|
||||
changeUserType(constant.bz)
|
||||
|
@ -1,23 +1,25 @@
|
||||
<template>
|
||||
<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>
|
||||
</view>
|
||||
</view> -->
|
||||
<view v-if="mode === 'base'" class="uni-dialog-content">
|
||||
<slot>
|
||||
<image v-if="iconPath" :src="iconPath" mode="aspectFit"></image>
|
||||
<text class="uni-dialog-content-text">{{content}}</text>
|
||||
</slot>
|
||||
</view>
|
||||
<view v-else class="uni-dialog-content">
|
||||
<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>
|
||||
</view>
|
||||
<view class="uni-dialog-button-group">
|
||||
<view class="uni-dialog-button" @click="closeDialog">
|
||||
<text class="uni-dialog-button-text">{{closeText}}</text>
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
@ -28,10 +30,12 @@
|
||||
<script>
|
||||
import popup from '../uni-popup/popup.js'
|
||||
import {
|
||||
initVueI18n
|
||||
initVueI18n
|
||||
} from '@dcloudio/uni-i18n'
|
||||
import messages from '../uni-popup/i18n/index.js'
|
||||
const { t } = initVueI18n(messages)
|
||||
const {
|
||||
t
|
||||
} = initVueI18n(messages)
|
||||
/**
|
||||
* PopUp 弹出层-对话框样式
|
||||
* @description 弹出层-对话框样式
|
||||
@ -55,9 +59,9 @@
|
||||
export default {
|
||||
name: "uniPopupDialog",
|
||||
mixins: [popup],
|
||||
emits:['confirm','close'],
|
||||
emits: ['confirm', 'close'],
|
||||
props: {
|
||||
inputType:{
|
||||
inputType: {
|
||||
type: String,
|
||||
default: 'text'
|
||||
},
|
||||
@ -89,11 +93,15 @@
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
cancelText:{
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
confirmText:{
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
iconPath: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
@ -151,12 +159,12 @@
|
||||
* 点击确认按钮
|
||||
*/
|
||||
onOk() {
|
||||
if (this.mode === 'input'){
|
||||
if (this.mode === 'input') {
|
||||
this.$emit('confirm', this.val)
|
||||
}else{
|
||||
} else {
|
||||
this.$emit('confirm')
|
||||
}
|
||||
if(this.beforeClose) return
|
||||
if (this.beforeClose) return
|
||||
this.popup.close()
|
||||
},
|
||||
/**
|
||||
@ -164,17 +172,17 @@
|
||||
*/
|
||||
closeDialog() {
|
||||
this.$emit('close')
|
||||
if(this.beforeClose) return
|
||||
if (this.beforeClose) return
|
||||
this.popup.close()
|
||||
},
|
||||
close(){
|
||||
close() {
|
||||
this.popup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
<style lang="scss">
|
||||
.uni-popup-dialog {
|
||||
width: 300px;
|
||||
border-radius: 11px;
|
||||
@ -199,15 +207,22 @@
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
|
||||
image {
|
||||
margin: 30rpx 0 15rpx 0;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-dialog-content-text {
|
||||
font-size: 14px;
|
||||
color: #6C6C6C;
|
||||
color: #363636;
|
||||
}
|
||||
|
||||
.uni-dialog-button-group {
|
||||
@ -232,6 +247,11 @@
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.dl-button-ok {
|
||||
background-color: #FC1F3E;
|
||||
border-radius: 0 0 11px 0;
|
||||
}
|
||||
|
||||
.uni-border-left {
|
||||
border-left-color: #f0f0f0;
|
||||
border-left-style: solid;
|
||||
@ -244,7 +264,7 @@
|
||||
}
|
||||
|
||||
.uni-button-color {
|
||||
color: #007aff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.uni-dialog-input {
|
||||
@ -272,4 +292,4 @@
|
||||
.uni-popup__info {
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -3,7 +3,9 @@
|
||||
<view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view>
|
||||
<view class="uni-share-content">
|
||||
<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>
|
||||
<text class="uni-share-text">{{item.text}}</text>
|
||||
</view>
|
||||
@ -19,14 +21,16 @@
|
||||
<script>
|
||||
import popup from '../uni-popup/popup.js'
|
||||
import {
|
||||
initVueI18n
|
||||
initVueI18n
|
||||
} from '@dcloudio/uni-i18n'
|
||||
import messages from '../uni-popup/i18n/index.js'
|
||||
const { t } = initVueI18n(messages)
|
||||
const {
|
||||
t
|
||||
} = initVueI18n(messages)
|
||||
export default {
|
||||
name: 'UniPopupShare',
|
||||
mixins:[popup],
|
||||
emits:['select'],
|
||||
mixins: [popup],
|
||||
emits: ['select'],
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
@ -45,21 +49,21 @@
|
||||
name: 'wx'
|
||||
},
|
||||
{
|
||||
text: '支付宝',
|
||||
text: '海报',
|
||||
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',
|
||||
name: 'qq'
|
||||
},
|
||||
{
|
||||
text: '新浪',
|
||||
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/0dacdbe0-50bf-11eb-8ff1-d5dcf8779628.png',
|
||||
name: 'sina'
|
||||
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/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
|
||||
// name: 'copy'
|
||||
@ -77,7 +81,7 @@
|
||||
cancelText() {
|
||||
return t("uni-popup.cancel")
|
||||
},
|
||||
shareTitleText() {
|
||||
shareTitleText() {
|
||||
return this.title || t("uni-popup.shareTitle")
|
||||
}
|
||||
},
|
||||
@ -91,24 +95,34 @@
|
||||
index
|
||||
})
|
||||
this.close()
|
||||
|
||||
},
|
||||
/**
|
||||
* 关闭窗口
|
||||
*/
|
||||
close() {
|
||||
if(this.beforeClose) return
|
||||
if (this.beforeClose) return
|
||||
this.popup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" >
|
||||
<style lang="scss">
|
||||
button[plain] {
|
||||
border: 0
|
||||
}
|
||||
|
||||
.share-button {
|
||||
position: absolute;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.uni-popup-share {
|
||||
background-color: #fff;
|
||||
border-top-left-radius: 11px;
|
||||
border-top-right-radius: 11px;
|
||||
}
|
||||
|
||||
.uni-share-title {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
@ -118,10 +132,12 @@
|
||||
justify-content: center;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.uni-share-title-text {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.uni-share-content {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
@ -137,11 +153,12 @@
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
width: 360px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.uni-share-content-item {
|
||||
width: 90px;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
@ -152,7 +169,9 @@
|
||||
}
|
||||
|
||||
.uni-share-content-item:active {
|
||||
pointer-events: none;
|
||||
background-color: #f5f5f5;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uni-share-image {
|
||||
@ -161,6 +180,7 @@
|
||||
}
|
||||
|
||||
.uni-share-text {
|
||||
z-index: 999;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
color: #3B4144;
|
||||
@ -184,4 +204,4 @@
|
||||
.uni-share-button::after {
|
||||
border-radius: 50px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -1,41 +1,41 @@
|
||||
const TokenKey = 'App-Token'
|
||||
|
||||
export function getToken() {
|
||||
return uni.getStorageSync(TokenKey)
|
||||
return uni.getStorageSync(TokenKey)
|
||||
}
|
||||
|
||||
export function setToken(token) {
|
||||
return uni.setStorageSync(TokenKey, token)
|
||||
return uni.setStorageSync(TokenKey, token)
|
||||
}
|
||||
|
||||
export function removeToken() {
|
||||
return uni.removeStorageSync(TokenKey)
|
||||
return uni.removeStorageSync(TokenKey)
|
||||
}
|
||||
|
||||
export function getJSONData(keyStr) {
|
||||
if(uni.getStorageSync(keyStr)){
|
||||
return JSON.parse(uni.getStorageSync(keyStr))
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
if (uni.getStorageSync(keyStr)) {
|
||||
return JSON.parse(uni.getStorageSync(keyStr))
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function setJSONData(keyStr,dataObj) {
|
||||
return uni.setStorageSync(keyStr, JSON.stringify(dataObj))
|
||||
export function setJSONData(keyStr, dataObj) {
|
||||
return uni.setStorageSync(keyStr, JSON.stringify(dataObj))
|
||||
}
|
||||
|
||||
export function removeJSONData(keyStr) {
|
||||
return uni.removeStorageSync(keyStr)
|
||||
return uni.removeStorageSync(keyStr)
|
||||
}
|
||||
|
||||
export function getStrData(keyStr) {
|
||||
return uni.getStorageSync(keyStr)
|
||||
return uni.getStorageSync(keyStr)
|
||||
}
|
||||
|
||||
export function setStrData(keyStr,dataStr) {
|
||||
return uni.setStorageSync(keyStr, dataStr)
|
||||
export function setStrData(keyStr, dataStr) {
|
||||
return uni.setStorageSync(keyStr, dataStr)
|
||||
}
|
||||
|
||||
export function removeStrData(keyStr) {
|
||||
return uni.removeStorageSync(keyStr)
|
||||
return uni.removeStorageSync(keyStr)
|
||||
}
|
@ -28,7 +28,8 @@ export function hasRights(code) {
|
||||
rtnData = userRights[code]
|
||||
}
|
||||
return rtnData
|
||||
}/**
|
||||
}
|
||||
/**
|
||||
* 切换用户当前身份
|
||||
* @param {Object} value 身份值
|
||||
*/
|
||||
@ -36,6 +37,14 @@ export function changeUserType(value) {
|
||||
setStrData(constant.userTypeKey, value)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户当前身份
|
||||
* @param {Object} value 身份值
|
||||
*/
|
||||
export function getUserType() {
|
||||
return getStrData(constant.userTypeKey)
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示消息提示框
|
||||
* @param content 提示的标题
|
||||
@ -97,10 +106,11 @@ export function tansParams(params) {
|
||||
*/
|
||||
export function formatNumberWithUnits(num) {
|
||||
const units = ['', 'k', 'w', 'kw'];
|
||||
const absNum = Math.abs(num); // 获取绝对值以处理负数
|
||||
// 获取绝对值以处理负数
|
||||
let absNum = Math.abs(num);
|
||||
// 处理小于1000的情况,直接返回原数字的字符串形式
|
||||
if (absNum < 1000) {
|
||||
return absNum.toString();
|
||||
return num;
|
||||
}
|
||||
|
||||
// 寻找合适的单位
|
||||
@ -119,3 +129,29 @@ export function formatNumberWithUnits(num) {
|
||||
const formattedNum = absNum.toFixed(2).replace(/\.?0+$/, ''); // 保留两位小数并去除末尾的零
|
||||
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) + "小时前"
|
||||
}
|
||||
}
|
@ -7,6 +7,8 @@ const constant = {
|
||||
userRightsKey: 'User-Rights',
|
||||
// 用户当前身份code
|
||||
userTypeKey: 'User-Type',
|
||||
//当前用户信息
|
||||
userInfo: 'User-Info',
|
||||
//博主
|
||||
bz: '02',
|
||||
//通告主
|
||||
|