活动按钮状态流转
This commit is contained in:
517
pages/mine/index.vue
Normal file
517
pages/mine/index.vue
Normal file
@@ -0,0 +1,517 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 我的 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<page-meta :page-style="'overflow:' + (pageShow ? 'hidden' : 'visible')"></page-meta>
|
||||
<view class="container" :style="{background: diyData.headerStyle.backgroundColor}" v-if="loadEnd">
|
||||
<!-- 顶部区域 -->
|
||||
<view class="container-header">
|
||||
<!-- 标题栏 -->
|
||||
<view class="header-nav" :style="{height: titleBarHeight + 'px'}">
|
||||
<title-bar positionMode="fixed" :frontColor="titleColor" :backgroundColor="titleBackground" :title="diyData.pageTitle || appletName"></title-bar>
|
||||
</view>
|
||||
<!-- 背景图 -->
|
||||
<image class="header-image" :src="getImagePath(diyData.headerStyle.backgroundImage)" mode="aspectFill" v-if="diyData.headerStyle.backgroundImage"></image>
|
||||
<!-- 用户信息 -->
|
||||
<view class="header-user">
|
||||
<user-info :showStyle="diyData.headerStyle" @getPoster="$refs.memberPoster.getPoster()" @getUserInfo="getUserInfo()"></user-info>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 页面内容 -->
|
||||
<view class="container-main">
|
||||
<block v-for="(item, index) in diyData.items" :key="index" v-if="item.show">
|
||||
<!-- 商城订单 -->
|
||||
<view class="main-column" v-if="item.type == 'mallOrderDiy'">
|
||||
<view class="column-title flex justify-content-between align-items-center">
|
||||
<view class="title">{{item.name}}</view>
|
||||
<view class="btn" @click="toOrder()">查看全部</view>
|
||||
</view>
|
||||
<view class="column-content">
|
||||
<order-menu :showStyle="item.style" :showData="item.data" :domain="diyData.domain"></order-menu>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 我的名片-仅微信小程序可用 -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view class="main-column" v-else-if="item.type == 'cardDiy'">
|
||||
<view class="column-title flex justify-content-between align-items-center">
|
||||
<view class="title">{{item.name}}<text v-if="token">({{cardList.length}})</text></view>
|
||||
<view class="btn" @click="toCard()">查看全部</view>
|
||||
</view>
|
||||
<view class="column-content" style="padding: 0 32rpx;" v-if="token && cardList.length">
|
||||
<scroll-view scroll-x class="content-card">
|
||||
<view class="card-item" v-for="card in cardList" :key="card.id" @click="toCardDetails(card.id)">
|
||||
<image class="item-image" :src="card.image" mode="widthFix"></image>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- 会员中心 -->
|
||||
<view class="main-column" v-else-if="item.type == 'memberDiy' && (!item.memberHide || memberStatus)">
|
||||
<view class="column-title">
|
||||
<view class="title">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="column-content">
|
||||
<menu-center :showStyle="item.style" :showData="item.data" :domain="diyData.domain"></menu-center>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 管理员中心 -->
|
||||
<view class="main-column" v-else-if="item.type == 'adminDiy' && adminStatus">
|
||||
<view class="column-title">
|
||||
<view class="title">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="column-content">
|
||||
<admin-center :showStyle="item.style" :showData="item.data" :domain="diyData.domain"></admin-center>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 系统中心 -->
|
||||
<view class="main-column" v-else-if="item.type == 'navDiy'">
|
||||
<view class="column-title">
|
||||
<view class="title">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="column-content">
|
||||
<menu-center :showStyle="item.style" :showData="item.data" :domain="diyData.domain"></menu-center>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 备案号 -->
|
||||
<view class="main-statement" v-if="statement">备案号:{{statement}}</view>
|
||||
<!-- 技术支持 -->
|
||||
<view class="main-support flex justify-content-center" @click="toSupport" v-if="support && support.image">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button class="clear" open-type="contact" v-if="support.type == 1">
|
||||
<image class="image" :src="support.image" mode="widthFix"></image>
|
||||
</button>
|
||||
<image class="image" :src="support.image" mode="widthFix" v-else></image>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<image class="image" :src="support.image" mode="widthFix"></image>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
<!-- 电子会牌 -->
|
||||
<member-poster ref="memberPoster" @onChange="pageChange"></member-poster>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
import userInfo from "@/pages/component/mine/user-info.vue"
|
||||
import orderMenu from "@/pages/component/mine/order.vue"
|
||||
import menuCenter from "@/pages/component/mine/menu.vue"
|
||||
import adminCenter from "@/pages/component/mine/admin.vue"
|
||||
import memberPoster from "@/pages/component/member/poster.vue"
|
||||
// #ifdef H5
|
||||
import wx from 'weixin-js-sdk';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
userInfo,
|
||||
orderMenu,
|
||||
menuCenter,
|
||||
adminCenter,
|
||||
memberPoster,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 页面是否阻止滚动
|
||||
pageShow: false,
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 自定义模式
|
||||
diyData: null,
|
||||
// 顶部导航栏背景色
|
||||
titleBackground: "rgba(255, 255, 255, 0)",
|
||||
// 顶部导航栏字体颜色
|
||||
titleColor: "#000",
|
||||
// 标题栏高度
|
||||
titleBarHeight: 0,
|
||||
// 名片列表
|
||||
cardList: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
token: state => state.user.token,
|
||||
adminStatus: state => {
|
||||
let status = false
|
||||
if (state.user.userInfo.is_verifying == 1) {
|
||||
status = true
|
||||
}
|
||||
if (state.user.userInfo.set_admin == 1) {
|
||||
status = true
|
||||
}
|
||||
return status
|
||||
},
|
||||
memberStatus: state => {
|
||||
if (state.user.userInfo && state.user.userInfo.apply_member_state) {
|
||||
return state.user.userInfo.apply_member_state.state == 6
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
statement: state => state.app.statement,
|
||||
support: state => state.app.support,
|
||||
shareImage: state => state.app.shareImage,
|
||||
shareTitle: state => state.app.shareTitle,
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
// #ifdef MP-WEIXIN
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight
|
||||
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
||||
this.titleBarHeight = (menuButtonInfo.top - statusBarHeight) * 2 + menuButtonInfo.height + statusBarHeight
|
||||
// #endif
|
||||
},
|
||||
onLoad() {
|
||||
// #ifdef H5
|
||||
this.initConfig()
|
||||
// #endif
|
||||
this.getDiyData(() => {
|
||||
uni.hideLoading()
|
||||
this.loadEnd = true
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
if (uni.getStorageSync("token")) {
|
||||
this.getUserInfo()
|
||||
this.getCardList()
|
||||
}
|
||||
if (this.loadEnd) {
|
||||
this.getDiyData()
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (uni.getStorageSync("token")) {
|
||||
this.getCardList()
|
||||
this.getUserInfo()
|
||||
}
|
||||
this.getDiyData(() => {
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: this.shareTitle,
|
||||
imageUrl: this.shareImage,
|
||||
path: "/pages/index/index",
|
||||
}
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: this.shareTitle,
|
||||
imageUrl: this.shareImage,
|
||||
path: "/pages/index/index",
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
const scrollTop = e.scrollTop
|
||||
if (scrollTop > 100) {
|
||||
this.titleBackground = "#fff"
|
||||
this.titleColor = "black"
|
||||
} else {
|
||||
let opacity = parseFloat(scrollTop / 100).toFixed(4)
|
||||
this.titleBackground = "rgba(255, 255, 255, " + opacity + ")"
|
||||
if (scrollTop > 30) {
|
||||
this.titleColor = "black"
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: "#000000", //文字颜色
|
||||
backgroundColor: "#ffffff" //底部背景色
|
||||
})
|
||||
} else {
|
||||
this.titleColor = this.diyData.headerStyle.titleTextColor === 'white' ? '#ffffff' : '#000000'
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: this.titleColor, //文字颜色
|
||||
backgroundColor: "transparent" //底部背景色
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 改变页面滚动状态
|
||||
pageChange(state) {
|
||||
this.pageShow = state
|
||||
},
|
||||
// 获取自定义数据
|
||||
getDiyData(fn) {
|
||||
this.$util.request("mine.diyData").then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.diyData = res.data
|
||||
const page = this.getPageStyle(res.data)
|
||||
this.diyData.headerStyle = page
|
||||
this.titleColor = page.titleTextColor
|
||||
// #ifdef MP-WEIXIN
|
||||
// 设置navbar标题、颜色
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: page.titleTextColor === 'white' ? '#ffffff' : '#000000',
|
||||
backgroundColor: "transparent",
|
||||
})
|
||||
// #endif
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.pageTitle || this.appletName || "首页",
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取自定义数据 ', error)
|
||||
})
|
||||
},
|
||||
// 获取已选页面样式
|
||||
getPageStyle(data) {
|
||||
var index = data.pageStyle.findIndex(item => {
|
||||
if (item.layout == data.pageLayout) return true
|
||||
})
|
||||
if (index === -1) index = 0
|
||||
return data.pageStyle[index]
|
||||
},
|
||||
// 获取图片地址
|
||||
getImagePath(url) {
|
||||
if (url.indexOf('http') > -1) {
|
||||
return url
|
||||
} else {
|
||||
return this.diyData.domain + url
|
||||
}
|
||||
},
|
||||
// #ifdef H5
|
||||
// 微信公众号初始化方法
|
||||
initConfig() {
|
||||
this.$util.request("main.WeChatConfig", {
|
||||
url: location.href.split('#')[0]
|
||||
}).then(res => {
|
||||
if (res.code == 1) {
|
||||
wx.config({
|
||||
debug: false,
|
||||
appId: res.data.appId,
|
||||
timestamp: Number(res.data.timestamp),
|
||||
nonceStr: res.data.nonceStr,
|
||||
signature: res.data.signature,
|
||||
jsApiList: ["updateAppMessageShareData", "updateTimelineShareData", "wx-open-launch-weapp"],
|
||||
openTagList: ["updateAppMessageShareData", "updateTimelineShareData", 'wx-open-launch-weapp'],
|
||||
})
|
||||
wx.ready(() => {
|
||||
wx.updateAppMessageShareData({
|
||||
title: this.shareTitle,
|
||||
desc: "",
|
||||
link: window.location.href,
|
||||
imgUrl: this.shareImage,
|
||||
});
|
||||
wx.updateTimelineShareData({
|
||||
title: this.shareTitle,
|
||||
link: window.location.href,
|
||||
imgUrl: this.shareImage,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('通过config接口注入权限验证配置 ', error)
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
// 获取用户信息
|
||||
getUserInfo(fn) {
|
||||
this.$util.request("mine.user").then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
uni.setStorageSync("userInfo", res.data)
|
||||
this.$store.commit('user/setUserInfo', res.data)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取用户信息 ', error)
|
||||
})
|
||||
},
|
||||
// 获取名片列表
|
||||
getCardList(fn) {
|
||||
this.$util.request("card.list").then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.cardList = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (error == 401) {
|
||||
this.showLogin = true
|
||||
} else {
|
||||
if (fn) fn()
|
||||
console.error('获取名片列表 ', error)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 跳转全部订单
|
||||
toOrder() {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: '/pagesMall/order/index',
|
||||
})
|
||||
},
|
||||
// 跳转我的名片
|
||||
toCard() {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: '/pagesCard/mine/index',
|
||||
})
|
||||
},
|
||||
// 跳转我的名片详情
|
||||
toCardDetails(id) {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: '/pagesCard/mine/details?id=' + id,
|
||||
})
|
||||
},
|
||||
// 跳转技术支持
|
||||
toSupport() {
|
||||
if (this.support.type == 2) {
|
||||
// 拨打电话
|
||||
this.$util.toPage({
|
||||
mode: 6,
|
||||
phone: this.support.mobile,
|
||||
})
|
||||
} else if (this.support.type == 3) {
|
||||
// 外部链接
|
||||
this.$util.toPage({
|
||||
mode: 4,
|
||||
path: this.support.link,
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
position: relative;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
min-height: 100vh;
|
||||
|
||||
.container-header {
|
||||
position: relative;
|
||||
z-index: 998;
|
||||
|
||||
.header-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.header-user {
|
||||
padding: 0 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.container-main {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 0 32rpx 32rpx;
|
||||
|
||||
.main-column {
|
||||
padding: 32rpx 0;
|
||||
border-radius: 16rpx;
|
||||
background: #ffffff;
|
||||
margin-top: 32rpx;
|
||||
|
||||
.column-title {
|
||||
padding: 0 32rpx;
|
||||
|
||||
.title {
|
||||
color: #5A5B6E;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.column-content {
|
||||
margin-top: 24rpx;
|
||||
|
||||
.content-card {
|
||||
white-space: nowrap;
|
||||
|
||||
.card-item {
|
||||
display: inline-block;
|
||||
margin-left: 16rpx;
|
||||
width: 296rpx;
|
||||
height: 176rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.item-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main-statement {
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
color: #8D929C;
|
||||
margin-top: 32rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.main-support {
|
||||
margin-top: 32rpx;
|
||||
|
||||
.image {
|
||||
width: 400rpx;
|
||||
height: auto;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
118
pages/mine/notice/details.vue
Normal file
118
pages/mine/notice/details.vue
Normal file
@@ -0,0 +1,118 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 通知详情 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar title="通知详情"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-box">
|
||||
<view class="box-info">
|
||||
<view class="info-title">{{noticeInfo.title}}</view>
|
||||
<view class="info-date">{{noticeInfo.createtime}}</view>
|
||||
</view>
|
||||
<view class="box-content">
|
||||
<mp-html :content="noticeInfo.content"></mp-html>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 通知id
|
||||
noticeId: null,
|
||||
// 通知详情
|
||||
noticeInfo: {},
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.noticeId = option.id
|
||||
this.getNoticeInfo(() => {
|
||||
this.loadEnd = true
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 获取通知详情
|
||||
getNoticeInfo(fn) {
|
||||
this.$util.request("mine.notice.details", {
|
||||
id: this.noticeId
|
||||
}).then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.noticeInfo = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取通知详情 ', error)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
|
||||
.main-box {
|
||||
padding: 32rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #FFF;
|
||||
|
||||
.box-info {
|
||||
padding-bottom: 32rpx;
|
||||
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
.info-title {
|
||||
color: #5A5B6E;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.info-date {
|
||||
margin-top: 8rpx;
|
||||
color: #979797;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.box-content {
|
||||
margin-top: 32rpx;
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
156
pages/mine/notice/index.vue
Normal file
156
pages/mine/notice/index.vue
Normal file
@@ -0,0 +1,156 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 消息通知 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar title="消息通知"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-list" v-if="noticeList.length">
|
||||
<view class="list-item" v-for="(item, index) in noticeList" :key="index" @click="toDetails(item.id)">
|
||||
<view class="item-title">{{item.title}}</view>
|
||||
<view class="item-date">{{item.createtime}}</view>
|
||||
<view class="item-point" v-if="item.is_read != 1"></view>
|
||||
</view>
|
||||
</view>
|
||||
<empty top="30%" title="暂无相关内容~" v-else></empty>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 分类查询参数
|
||||
page: 1,
|
||||
limit: 20,
|
||||
hasMore: false,
|
||||
// 消息通知列表
|
||||
noticeList: [],
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.getNoticeList(() => {
|
||||
uni.hideLoading()
|
||||
this.loadEnd = true
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
if (this.loadEnd) {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 0
|
||||
});
|
||||
this.page = 1
|
||||
this.getNoticeList()
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.page = 1
|
||||
this.getNoticeList(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.hasMore) {
|
||||
this.page++
|
||||
this.getNoticeList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取消息通知列表
|
||||
getNoticeList(fn) {
|
||||
if (fn) fn()
|
||||
this.$util.request("mine.notice.list", {
|
||||
page: this.page,
|
||||
limit: this.limit,
|
||||
}).then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
let list = res.data.data
|
||||
this.hasMore = this.page < res.data.total / this.limit ? true : false
|
||||
this.noticeList = this.page == 1 ? list : [...this.noticeList, ...list];
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取帮助列表 ', error)
|
||||
})
|
||||
},
|
||||
// 跳转详情页面
|
||||
toDetails(id) {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: "/pages/mine/notice/details?id=" + id
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
|
||||
.main-list {
|
||||
.list-item {
|
||||
position: relative;
|
||||
border-radius: 16rpx;
|
||||
background: #FFF;
|
||||
padding: 32rpx;
|
||||
margin-top: 32rpx;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.item-date {
|
||||
margin-top: 8rpx;
|
||||
color: #979797;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.item-point {
|
||||
position: absolute;
|
||||
top: 16rpx;
|
||||
right: 16rpx;
|
||||
width: 16rpx;
|
||||
height: 16rpx;
|
||||
background: #FF4646;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
104
pages/mine/problem/details.vue
Normal file
104
pages/mine/problem/details.vue
Normal file
@@ -0,0 +1,104 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 常见问题-详情 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar title="常见问题"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-box">
|
||||
<view class="box-title">{{problemInfo.title}}</view>
|
||||
<view class="box-content">
|
||||
<mp-html :content="problemInfo.reply"></mp-html>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 问题id
|
||||
problemId: null,
|
||||
// 问题详情
|
||||
problemInfo: {},
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.problemId = option.id
|
||||
this.getProblemInfo(() => {
|
||||
this.loadEnd = true
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 获取问题详情
|
||||
getProblemInfo(fn) {
|
||||
this.$util.request("mine.problem.details", {
|
||||
id: this.problemId
|
||||
}).then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.problemInfo = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取问题详情 ', error)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
|
||||
.main-box {
|
||||
padding: 32rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #ffffff;
|
||||
|
||||
.box-title {
|
||||
color: #5A5B6E;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 40rpx;
|
||||
padding-bottom: 32rpx;
|
||||
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.box-content {
|
||||
margin-top: 32rpx;
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
123
pages/mine/problem/index.vue
Normal file
123
pages/mine/problem/index.vue
Normal file
@@ -0,0 +1,123 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 常见问题-列表 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar title="常见问题"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-list" v-if="problemList.length">
|
||||
<view class="list-item" v-for="(item, index) in problemList" :key="index" @click="toDetails(item.id)">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
<empty top="30%" title="暂无相关内容~" v-else></empty>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 分类查询参数
|
||||
page: 1,
|
||||
limit: 20,
|
||||
hasMore: false,
|
||||
// 问题列表
|
||||
problemList: [],
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.getProblemList(() => {
|
||||
uni.hideLoading()
|
||||
this.loadEnd = true
|
||||
})
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.page = 1
|
||||
this.getProblemList(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.hasMore) {
|
||||
this.page++
|
||||
this.getProblemList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取帮助列表
|
||||
getProblemList(fn) {
|
||||
this.$util.request("mine.problem.list", {
|
||||
page: this.page,
|
||||
limit: this.limit,
|
||||
}).then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
let list = res.data.data
|
||||
this.hasMore = this.page < res.data.total / this.limit ? true : false
|
||||
this.problemList = this.page == 1 ? list : [...this.problemList, ...list];
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取帮助列表 ', error)
|
||||
})
|
||||
},
|
||||
// 跳转详情页面
|
||||
toDetails(id) {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: "/pages/mine/problem/details?id=" + id
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
|
||||
.main-list {
|
||||
padding: 0 32rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #ffffff;
|
||||
|
||||
.list-item {
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
padding: 32rpx 0;
|
||||
border-top: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
94
pages/mine/settings/agreement.vue
Normal file
94
pages/mine/settings/agreement.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 协议 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar :title="agreementTitle"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<mp-html :content="content"></mp-html>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 协议类型 1.用户协议,2.隐私政策,3.入会协议
|
||||
agreementType: 0,
|
||||
// 协议标题
|
||||
agreementTitle: "",
|
||||
// 协议内容
|
||||
content: "",
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.agreementType = option.type
|
||||
if (option.type == 1) {
|
||||
this.agreementTitle = "用户协议"
|
||||
} else if (option.type == 2) {
|
||||
this.agreementTitle = "隐私政策"
|
||||
} else if (option.type == 3) {
|
||||
this.agreementTitle = "入会协议"
|
||||
}
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.getConfigInfo(() => {
|
||||
this.loadEnd = true
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 获取协议内容
|
||||
getConfigInfo(fn) {
|
||||
this.$util.request("main.agreement", {
|
||||
type: this.agreementType
|
||||
}).then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.content = res.data.content
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取协议内容 ', error)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
142
pages/mine/settings/system.vue
Normal file
142
pages/mine/settings/system.vue
Normal file
@@ -0,0 +1,142 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 系统设置 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar title="系统设置"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<!-- 功能列表 -->
|
||||
<view class="main-list">
|
||||
<view class="list-item flex align-items-center" @click="toAgreement(1)">
|
||||
<view class="item-title flex-item">用户协议</view>
|
||||
<image class="item-right" src="/static/right.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="list-item flex align-items-center" @click="toAgreement(2)">
|
||||
<view class="item-title flex-item">隐私政策</view>
|
||||
<image class="item-right" src="/static/right.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="list-item flex align-items-center">
|
||||
<view class="item-title flex-item">版本信息</view>
|
||||
<text class="item-tag">{{version}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 退出登录 -->
|
||||
<view class="main-btn" v-if="token" @click="handleExit">退出登录</view>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
token: state => state.user.token,
|
||||
themeColor: state => state.app.themeColor,
|
||||
version: state => state.app.version,
|
||||
})
|
||||
},
|
||||
onLoad() {
|
||||
this.$nextTick(() => {
|
||||
this.loadEnd = true
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 跳转用户协议和隐私政策
|
||||
toAgreement(type) {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: "/pages/mine/settings/agreement?type=" + type
|
||||
})
|
||||
},
|
||||
// 退出登录
|
||||
handleExit() {
|
||||
uni.showModal({
|
||||
title: "系统提示",
|
||||
content: "确定要退出登录吗?",
|
||||
confirmColor: this.themeColor,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.removeStorageSync("token")
|
||||
uni.removeStorageSync("userInfo")
|
||||
this.$store.commit('user/clearAuth')
|
||||
uni.switchTab({
|
||||
url: "/pages/mine/index"
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
|
||||
.main-list {
|
||||
.list-item {
|
||||
padding: 34rpx 32rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-top: 32rpx;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.item-right {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-left: 32rpx;
|
||||
}
|
||||
|
||||
.item-tag {
|
||||
color: #666;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
margin-left: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main-btn {
|
||||
margin-top: 32rpx;
|
||||
padding: 34rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
color: #FF2E2E;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
260
pages/mine/settings/user.vue
Normal file
260
pages/mine/settings/user.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 修改信息 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar :showBack="true" title="修改信息"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<form class="container-form" @submit="onConfirm" v-if="loadEnd">
|
||||
<view class="form-item flex align-items-center">
|
||||
<view class="item-title">头像</view>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button class="item-avatar flex-item flex justify-content-end align-items-center" open-type="chooseAvatar" @chooseavatar="chooseAvatar">
|
||||
<image class="avatar" :src="avatar" mode="aspectFill" v-if="avatar"></image>
|
||||
<image class="avatar" :src="userInfo.avatar" mode="aspectFill" v-else></image>
|
||||
<image class="icon" src="/static/right.png" mode="aspectFit"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<view class="item-avatar flex-item flex justify-content-end align-items-center" @click="chooseAvatar">
|
||||
<image class="avatar" :src="avatar" mode="aspectFill" v-if="avatar"></image>
|
||||
<image class="avatar" :src="userInfo.avatar" mode="aspectFill" v-else></image>
|
||||
<image class="icon" src="/static/right.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<view class="form-item flex align-items-center">
|
||||
<view class="item-title">昵称</view>
|
||||
<view class="item-nickname flex-item">
|
||||
<input class="nickname" type="nickname" name="nickname" :value="nickname" placeholder="请输入新的昵称" />
|
||||
</view>
|
||||
</view>
|
||||
<button class="form-button" form-type="submit">
|
||||
<view class="btn" :style="{background: themeColor}" @click="onConfirm">设置</view>
|
||||
<view class="safe-padding"></view>
|
||||
</button>
|
||||
</form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 用户信息
|
||||
userInfo: {},
|
||||
// 头像
|
||||
avatar: "",
|
||||
// 昵称
|
||||
nickname: "",
|
||||
// 延时器
|
||||
timeout: null,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
})
|
||||
},
|
||||
onLoad() {
|
||||
this.userInfo = uni.getStorageSync("userInfo")
|
||||
this.nickname = this.userInfo.nickname
|
||||
this.$nextTick(() => {
|
||||
this.loadEnd = true
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
clearTimeout(this.timeout)
|
||||
},
|
||||
methods: {
|
||||
// 选择头像
|
||||
chooseAvatar(e) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.avatar = e.detail.avatarUrl
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
this.avatar = res.tempFilePaths[0]
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
// 设置
|
||||
onConfirm(e) {
|
||||
this.nickname = e.detail.value.nickname
|
||||
if (!this.nickname) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "昵称不能为空"
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.avatar && this.nickname === this.userInfo.nickname) {
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "设置成功",
|
||||
mask: true,
|
||||
duration: 1500
|
||||
})
|
||||
this.timeout = setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500);
|
||||
} else {
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
mask: true
|
||||
})
|
||||
this.uploadAvatar(url => {
|
||||
var data = {
|
||||
avatar: url,
|
||||
nickname: this.nickname || this.userInfo.nickname
|
||||
}
|
||||
this.$util.request("mine.updateUser", data).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.code == 1) {
|
||||
var userInfo = uni.getStorageSync("userInfo")
|
||||
userInfo.avatar = res.data.avatar
|
||||
userInfo.nickname = res.data.nickname
|
||||
uni.setStorageSync("userInfo", userInfo)
|
||||
this.$store.commit('user/setUserInfo', userInfo)
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "设置成功",
|
||||
mask: true,
|
||||
duration: 1500
|
||||
})
|
||||
this.timeout = setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('更新用户信息 ' + error)
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
// 上传图片
|
||||
uploadAvatar(fn) {
|
||||
if (!this.avatar) {
|
||||
fn(this.userInfo.avatar)
|
||||
} else {
|
||||
this.$util.uploadFile(this.avatar).then(result => {
|
||||
if (result.code == 1) {
|
||||
fn(result.data.url)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result?.msg || "上传失败",
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('上传图片 ', error)
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-form {
|
||||
display: block;
|
||||
padding: 32rpx 32rpx 168rpx;
|
||||
|
||||
.form-item {
|
||||
margin-top: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
padding-left: 32rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.item-avatar {
|
||||
background: transparent;
|
||||
padding: 24rpx 32rpx 24rpx 0;
|
||||
|
||||
.avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-left: 16rpx;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-nickname {
|
||||
.nickname {
|
||||
text-align: right;
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
padding: 24rpx 0;
|
||||
box-sizing: content-box;
|
||||
padding-right: 32rpx;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-button {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 99;
|
||||
background: #fff;
|
||||
padding: 24rpx;
|
||||
|
||||
.btn {
|
||||
color: #FFF;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
padding: 22rpx 32rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
253
pages/mine/subscribe/index.vue
Normal file
253
pages/mine/subscribe/index.vue
Normal file
@@ -0,0 +1,253 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 消息订阅 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar title="消息订阅"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-header" :style="{top: titleBarHeight + 'px'}">建议您在订阅授权窗口点选“总是允许”选框,以便正常收到消息提醒,订阅按钮上的数字表示订阅消息可发送的次数。</view>
|
||||
<view class="main-list">
|
||||
<view class="list-item flex align-items-center">
|
||||
<view class="item-info flex-item">
|
||||
<view class="info-title text-ellipsis">会员入会申请通知</view>
|
||||
<view class="info-subtitle text-ellipsis">新用户申请入会时向管理员发送提醒</view>
|
||||
</view>
|
||||
<view class="item-btn" @click="handleSubscribe()">
|
||||
<view class="btn" :style="{background: themeColor}">订阅</view>
|
||||
<view class="point" v-if="parseInt(subscribeCount) > 0">{{subscribeCount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 标题栏高度
|
||||
titleBarHeight: 0,
|
||||
// 是否订阅
|
||||
subscribeCount: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
subscribeId: state => state.app.subscribeNotifyIds.applet_initiation_admin,
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
// #ifdef MP-WEIXIN
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight
|
||||
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
||||
this.titleBarHeight = statusBarHeight + (menuButtonInfo.top - statusBarHeight) * 2 + menuButtonInfo.height
|
||||
// #endif
|
||||
},
|
||||
onLoad() {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.getSubscribe(() => {
|
||||
uni.hideLoading()
|
||||
this.loadEnd = true
|
||||
})
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.getSubscribe(() => {
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 获取订阅数量
|
||||
getSubscribe(fn) {
|
||||
this.$util.request("main.message.count").then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.subscribeCount = res.data.subscribe_count
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取订阅数量 ', error)
|
||||
})
|
||||
},
|
||||
// 订阅
|
||||
handleSubscribe() {
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
mask: true
|
||||
})
|
||||
this.subscribeMessage(() => {
|
||||
this.$util.request("main.message.subscribe").then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.code == 1) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '订阅成功'
|
||||
})
|
||||
this.getSubscribe()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('提交订阅消息 ', error)
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请前往小程序端订阅",
|
||||
duration: 2500
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
// 订阅消息
|
||||
subscribeMessage(fn, number = 0) {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: this.subscribeId ? [this.subscribeId] : [],
|
||||
success: (res) => {
|
||||
if (res[this.subscribeId] == 'accept') {
|
||||
fn()
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
title: '订阅失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
if (error.errCode == 20004) {
|
||||
uni.hideLoading()
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请前往设置打开接受通知',
|
||||
confirmText: '确定',
|
||||
showCancel: false,
|
||||
})
|
||||
} else if (error.errCode) {
|
||||
uni.hideLoading()
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '消息订阅失败,无法接收到订阅通知,错误码:' + error.errCode,
|
||||
confirmText: '确定',
|
||||
showCancel: false,
|
||||
})
|
||||
} else if (++number > 3) {
|
||||
this.subscribeMessage(fn, number)
|
||||
} else {
|
||||
fn()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-main {
|
||||
.main-header {
|
||||
color: #F6F7FB;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
padding: 32rpx;
|
||||
background: #5A5B6E;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.main-list {
|
||||
padding: 32rpx;
|
||||
|
||||
.list-item {
|
||||
margin-top: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #ffffff;
|
||||
padding: 32rpx;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.item-info {
|
||||
.info-title {
|
||||
color: #5A5B6E;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.info-subtitle {
|
||||
margin-top: 24rpx;
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-btn {
|
||||
margin-left: 24rpx;
|
||||
position: relative;
|
||||
|
||||
.btn {
|
||||
color: #F6F7FB;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
padding: 12rpx 32rpx;
|
||||
min-width: 160rpx;
|
||||
border-radius: 8rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.point {
|
||||
position: absolute;
|
||||
top: -12rpx;
|
||||
right: -12rpx;
|
||||
color: #F6F7FB;
|
||||
font-size: 24rpx;
|
||||
line-height: 30rpx;
|
||||
text-align: center;
|
||||
min-width: 32rpx;
|
||||
height: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
padding: 0 4rpx;
|
||||
border: 2rpx solid #F6F7FB;
|
||||
background: #FF0000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user