活动按钮状态流转
This commit is contained in:
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>
|
||||
Reference in New Issue
Block a user