mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-15 13:43:48 +08:00
tt
This commit is contained in:
78
hotgo-uniapp/pages/sys/user/about.vue
Normal file
78
hotgo-uniapp/pages/sys/user/about.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<view class="u-p-t-30 u-p-b-30 u-flex u-flex-col u-text-center">
|
||||
<u-avatar size="250" src="/static/jeesite/logo200.png"></u-avatar>
|
||||
<view class="title">{{vuex_config.productName}}</view>
|
||||
<view class="version">{{vuex_config.productVersion}}</view>
|
||||
</view>
|
||||
<u-cell-group class="form" :border="false">
|
||||
<u-cell-item :arrow="true" title="检查更新" @click="upgrade()"></u-cell-item>
|
||||
<navigator url="comment" open-type="navigate">
|
||||
<u-cell-item :arrow="true" title="意见反馈"></u-cell-item>
|
||||
</navigator>
|
||||
<navigator url="/pages/common/webview?title=公司首页&url=https://jeesite.com" open-type="navigate">
|
||||
<u-cell-item :arrow="true" title="公司首页">https://jeesite.com</u-cell-item>
|
||||
</navigator>
|
||||
<navigator url="/pages/common/webview?title=服务条款&url=http://s.jeesite.com/" open-type="navigate">
|
||||
<u-cell-item :arrow="true" title="服务条款">http://s.jeesite.com/</u-cell-item>
|
||||
</navigator>
|
||||
</u-cell-group>
|
||||
<view class="copyright">
|
||||
<view>卓源软件 版权所有</view>
|
||||
<view>Copyright © 2021 jeesite.com</view>
|
||||
<view>All Rights Reserved</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
export default {
|
||||
methods: {
|
||||
upgrade(){
|
||||
// #ifdef APP-PLUS
|
||||
this.$u.api.upgradeCheck().then(res => {
|
||||
if (res.result == 'true'){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: res.message + '是否下载更新?',
|
||||
showCancel: true,
|
||||
success: function (res2) {
|
||||
if (res2.confirm) {
|
||||
plus.runtime.openURL(res.data.apkUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.$u.toast(res.message);
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.$u.toast('小程序端或H5端已是最新版,无需检查更新!');
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
.title {
|
||||
display: flex;
|
||||
margin: 30rpx 0;
|
||||
font-size: 50rpx;
|
||||
}
|
||||
.version {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
.copyright {
|
||||
margin-top: 50rpx;
|
||||
text-align: center;
|
||||
line-height: 60rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
98
hotgo-uniapp/pages/sys/user/comment.vue
Normal file
98
hotgo-uniapp/pages/sys/user/comment.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<u-form class="form" :model="model" :rules="rules" ref="uForm" label-position="top">
|
||||
<u-form-item label="分类:" prop="category" label-position="left" label-width="100">
|
||||
<js-select v-model="model.category" dict-type="app_comment_category"
|
||||
placeholder="请选择分类"></js-select>
|
||||
</u-form-item>
|
||||
<u-form-item label="问题和意见" prop="content">
|
||||
<u-input type="textarea" placeholder="请填写10个字以上的问题描述以便我们提供更好的帮助"
|
||||
v-model="model.content" height="200" maxlength="500" />
|
||||
</u-form-item>
|
||||
<u-form-item label="上传图片(选填,提供问题截图)" prop="images">
|
||||
<js-uploadfile v-model="model" biz-type="appComment_image"></js-uploadfile>
|
||||
</u-form-item>
|
||||
<u-form-item label="联系方式(手机、邮箱、QQ号码)" prop="contact">
|
||||
<u-input placeholder="选填,便于我们与你联系,进一步沟通"
|
||||
v-model="model.contact" type="text" maxlength="200"></u-input>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<view class="form-footer">
|
||||
<u-button class="btn" type="primary" @click="submit">提交</u-button>
|
||||
<!-- <u-button class="btn" type="default" @click="cancel">关闭</u-button> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
model: {
|
||||
id: '',
|
||||
category: '',
|
||||
content: '',
|
||||
contact: '',
|
||||
deviceInfo: ''
|
||||
},
|
||||
rules: {
|
||||
category: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择问题和意见的分类',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
content: [
|
||||
{
|
||||
required: true,
|
||||
min: 10, max: 500,
|
||||
message: '问题和意见在 10 到 500 个字符之间',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules);
|
||||
// 获取设备信息
|
||||
uni.getSystemInfo({
|
||||
success: res => {
|
||||
this.model.deviceInfo = JSON.stringify(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
// console.log(this.model)
|
||||
this.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.$u.api.commentSave(this.model).then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: res.message,
|
||||
showCancel: false,
|
||||
success: function () {
|
||||
if (res.result == 'true') {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.$u.toast('您填写的信息有误,请根据提示修正。');
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
106
hotgo-uniapp/pages/sys/user/help.vue
Normal file
106
hotgo-uniapp/pages/sys/user/help.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<view class="search">
|
||||
<u-search v-model="keywords" @custom="search" @search="search"></u-search>
|
||||
</view>
|
||||
<view class="u-p-t-5 u-p-b-5">
|
||||
<u-collapse class="box" :accordion="false" :arrow="false">
|
||||
<view class="item" v-for="(item, index) in list" :key="item.code">
|
||||
<u-collapse-item :open="true">
|
||||
<view class="title" slot="title">
|
||||
<u-icon :name="item.icon != '' ? item.icon : 'home'" :size="35"></u-icon>
|
||||
<view class="text">{{item.name}}</view>
|
||||
</view>
|
||||
<u-cell-group class="list" :border="false">
|
||||
<u-cell-item :arrow="true" v-for="(child, index2) in item.childList" :key="child.code" @click="navTo('/pages/sys/msg/form')">
|
||||
<text slot="title">{{child.name}}</text>
|
||||
<text slot="label">发送者:{{child.createByName}} | 时间:{{child.createDate}}</text>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
</u-collapse-item>
|
||||
</view>
|
||||
</u-collapse>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
keywords: '',
|
||||
|
||||
list: [
|
||||
{
|
||||
code: 'a',
|
||||
name: '常见问题',
|
||||
icon: 'error-circle',
|
||||
childList: [
|
||||
{
|
||||
code: 'a1',
|
||||
name: '为什么没有消息提醒?',
|
||||
createByName: '管理员',
|
||||
createDate: '2021-4-6 12:10'
|
||||
},
|
||||
{
|
||||
code: 'a2',
|
||||
name: '怎么关闭消息提醒?',
|
||||
createByName: '管理员',
|
||||
createDate: '2021-4-6 12:10'
|
||||
},
|
||||
{
|
||||
code: 'a3',
|
||||
name: '怎么办理工单?',
|
||||
createByName: '管理员',
|
||||
createDate: '2021-4-6 12:10'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
code: 'a-1',
|
||||
name: '任务相关',
|
||||
icon: 'clock',
|
||||
childList: [
|
||||
{
|
||||
code: 'a1',
|
||||
name: '怎么办理任务?',
|
||||
createByName: '管理员',
|
||||
createDate: '2021-4-6 12:10'
|
||||
},
|
||||
{
|
||||
code: 'a2',
|
||||
name: '怎么完成任务?',
|
||||
createByName: '管理员',
|
||||
createDate: '2021-4-6 12:10'
|
||||
},
|
||||
{
|
||||
code: 'a3',
|
||||
name: '怎么查询任务?',
|
||||
createByName: '管理员',
|
||||
createDate: '2021-4-6 12:10'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
navTo(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
search(value) {
|
||||
this.$u.toast('搜索内容为:' + value)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
</style>
|
||||
98
hotgo-uniapp/pages/sys/user/index.scss
Normal file
98
hotgo-uniapp/pages/sys/user/index.scss
Normal file
@@ -0,0 +1,98 @@
|
||||
/*!
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* @author ThinkGem
|
||||
* @version 2020-9-1
|
||||
*/
|
||||
.header {
|
||||
background-color: #4094ff;
|
||||
|
||||
.userinfo {
|
||||
display: flex;
|
||||
padding: 40rpx;
|
||||
|
||||
.image {
|
||||
flex-shrink: 0;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
image {
|
||||
border-radius: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-flow: wrap;
|
||||
padding-left: 30rpx;
|
||||
color: #fff;
|
||||
|
||||
.username {
|
||||
width: 100%;
|
||||
font-size: 40rpx;
|
||||
padding-top: 8rpx;
|
||||
}
|
||||
|
||||
.usercode {
|
||||
height: 48rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-top: 10rpx;
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
border-radius: 20rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.logout {
|
||||
flex-shrink: 0;
|
||||
position: absolute;
|
||||
right: 70rpx;
|
||||
top: 65rpx;
|
||||
.u-btn {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
padding: 0 4%;
|
||||
margin-bottom: 5rpx;
|
||||
border-radius: 0 0 100% 100%;
|
||||
background-color: #4094ff;
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
padding: 10rpx;
|
||||
border-radius: 15rpx;
|
||||
box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.15);
|
||||
background-color: #fefefe;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
// flex-flow: wrap;
|
||||
height: 120rpx;
|
||||
color: #666666;
|
||||
font-size: 30rpx;
|
||||
padding: 10rpx 10rpx;
|
||||
|
||||
.icon {
|
||||
font-size: 50rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
padding: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.hover {
|
||||
background-color: #f6f6f6;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
128
hotgo-uniapp/pages/sys/user/index.vue
Normal file
128
hotgo-uniapp/pages/sys/user/index.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<js-lang title="user.title"></js-lang>
|
||||
<view class="header">
|
||||
<view class="userinfo">
|
||||
<view class="image" @click="navTo('info')"><image :src="avatarUrl"></image></view>
|
||||
<view class="info">
|
||||
<view class="username">{{ vuex_user.username || $t('login.noLogin') }}</view>
|
||||
<view class="realname">{{ vuex_user.realname || $t('login.noLogin') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="logout"><u-button type="success" shape="circle" size="mini" @click="logout">{{$t('login.logoutButton')}}</u-button></view>
|
||||
</view>
|
||||
<!-- <view class="toolbar">
|
||||
<view class="box">
|
||||
<navigator class="item" hover-class="hover" url="info">
|
||||
<view class="icon"><u-icon class="u-icon" :style="{ color: '#ea9a44' }" name="account"></u-icon></view>
|
||||
<text class="label">个人信息</text>
|
||||
</navigator>
|
||||
<navigator class="item" hover-class="hover" url="help">
|
||||
<view class="icon"><u-icon class="u-icon" :style="{ color: '#a571fd' }" name="question-circle"></u-icon></view>
|
||||
<text class="label">帮助中心</text>
|
||||
</navigator>
|
||||
<navigator class="item" hover-class="hover" url="info">
|
||||
<view class="icon"><u-icon class="u-icon" :style="{ color: '#ea9a44' }" name="account"></u-icon></view>
|
||||
<text class="label">个人信息</text>
|
||||
</navigator>
|
||||
<navigator class="item" hover-class="hover" url="help">
|
||||
<view class="icon"><u-icon class="u-icon" :style="{ color: '#a571fd' }" name="question-circle"></u-icon></view>
|
||||
<text class="label">帮助中心</text>
|
||||
</navigator>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="u-p-t-10 u-p-b-20">
|
||||
<view class="u-m-t-20">
|
||||
<u-cell-group>
|
||||
<u-cell-item icon="account" :iconSize="iconSize" :iconStyle="{color:'#266bff'}"
|
||||
title="个人信息" @click="navTo('info')"></u-cell-item>
|
||||
<u-cell-item icon="lock" :iconSize="iconSize" :iconStyle="{ color: '#1bca6a' }"
|
||||
title="修改密码" @click="navTo('pwd')"></u-cell-item>
|
||||
<u-cell-item icon="question-circle" :iconSize="iconSize" :iconStyle="{ color: '#d99e59' }"
|
||||
title="帮助中心" @click="navTo('help')"></u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
<view class="u-m-t-20">
|
||||
<u-cell-group>
|
||||
<u-cell-item icon="heart" :iconSize="iconSize" :iconStyle="{ color: '#0a1aff' }"
|
||||
title="关于我们" @click="navTo('about')"></u-cell-item>
|
||||
<u-cell-item icon="kefu-ermai" :iconSize="iconSize" :iconStyle="{ color: '#a571fd' }"
|
||||
title="意见反馈" @click="navTo('comment')"></u-cell-item>
|
||||
<u-cell-item icon="clock" :iconSize="iconSize" :iconStyle="{ color: '#ff6f27' }"
|
||||
title="检查更新" @click="upgrade()"></u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
<view class="u-m-t-20">
|
||||
<u-cell-group>
|
||||
<u-cell-item icon="setting" :iconSize="iconSize" :iconStyle="{ color: '#1a94ff' }"
|
||||
title="系统设置" @click="navTo('setting')"></u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
iconSize: 38
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
avatarUrl() {
|
||||
let url = this.vuex_user.avatar || '/ctxPath/static/images/user1.jpg';
|
||||
url = url.replace('/ctxPath/', this.vuex_config.baseUrl + '/');
|
||||
return url + '?t=' + new Date().getTime();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
navTo(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
logout() {
|
||||
this.$u.api.logout().then(res => {
|
||||
this.$u.toast(res.message);
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/login/index'
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
upgrade(){
|
||||
// #ifdef APP-PLUS
|
||||
this.$u.api.upgradeCheck().then(res => {
|
||||
if (res.result == 'true'){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: res.message + '是否下载更新?',
|
||||
showCancel: true,
|
||||
success: function (res2) {
|
||||
if (res2.confirm) {
|
||||
plus.runtime.openURL(res.data.apkUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.$u.toast(res.message);
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.$u.toast('小程序端或H5端无需检查更新')
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import 'index.scss';
|
||||
page {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
</style>
|
||||
224
hotgo-uniapp/pages/sys/user/info.vue
Normal file
224
hotgo-uniapp/pages/sys/user/info.vue
Normal file
@@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<view class="u-m-t-50 u-flex u-flex-col u-text-center">
|
||||
<u-avatar size="150" :src="avatarUrl"></u-avatar>
|
||||
<u-button size="medium" shape="circle" class="u-m-t-40"
|
||||
style="font-size:34rpx" @click="chooseAvatar">选择头像</u-button>
|
||||
</view>
|
||||
<u-form class="form" :model="model" :rules="rules" ref="uForm">
|
||||
<u-form-item label="昵称" prop="realname" label-width="120">
|
||||
<u-input placeholder="请输入用户昵称" v-model="model.realname" type="text"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="性别" prop="sex" label-width="120">
|
||||
<js-radio v-model="model.sex" dict-type="sys_user_sex"></js-radio>
|
||||
</u-form-item>
|
||||
<u-form-item label="邮箱" prop="email" label-width="120">
|
||||
<u-input placeholder="请输入电子邮箱" v-model="model.email" type="text"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="手机" prop="mobile" label-width="120">
|
||||
<u-input placeholder="请输入手机号码" v-model="model.mobile" type="number" maxlength="11"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="QQ" prop="qq" label-width="120">
|
||||
<u-input placeholder="请输入QQ" v-model="model.qq" type="text"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="地址" prop="address" label-width="120">
|
||||
<u-input type="textarea" placeholder="请输入你的地址" v-model="model.address" height="128" />
|
||||
</u-form-item>
|
||||
<u-form-item label="上次登录时间" label-width="250">
|
||||
{{this.$u.date(model.last_time, 'yyyy-mm-dd hh:MM:ss')}}
|
||||
</u-form-item>
|
||||
<u-form-item label="上次登录地址" label-width="250">
|
||||
{{model.last_ip}}
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<view class="form-footer">
|
||||
<u-button class="btn" type="primary" @click="submit">提交</u-button>
|
||||
<!-- <u-button class="btn" type="default" @click="cancel">关闭</u-button> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
model: {
|
||||
sex: '1'
|
||||
},
|
||||
rules: {
|
||||
realname: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入姓名',
|
||||
trigger: 'blur' ,
|
||||
},
|
||||
{
|
||||
min: 2,
|
||||
max: 32,
|
||||
message: '姓名长度在 2 到 32 个字符',
|
||||
trigger: ['change', 'blur'],
|
||||
},
|
||||
// {
|
||||
// // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
|
||||
// validator: (rule, value, callback) => {
|
||||
// // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
|
||||
// return this.$u.test.chinese(value);
|
||||
// },
|
||||
// message: '姓名必须为中文',
|
||||
// // 触发器可以同时用blur和change,二者之间用英文逗号隔开
|
||||
// trigger: ['change', 'blur'],
|
||||
// },
|
||||
// {
|
||||
// // 异步验证,用途:比如用户注册时输入完账号,后端检查账号是否已存在
|
||||
// // 异步验证需要通过调用 callback(),并且在里面抛出 new Error()
|
||||
// // 抛出的内容为需要提示的信息,和其他方式的 message 属性的提示一样
|
||||
// asyncValidator: (rule, value, callback) => {
|
||||
// this.$u.post('/ebapi/public_api/index').then(res => {
|
||||
// if(res.error) {
|
||||
// // 如果验证出错,需要在callback()抛出new Error('错误提示信息')
|
||||
// callback(new Error('姓名重复'));
|
||||
// } else {
|
||||
// // 如果没有错误,也要执行 callback() 回调
|
||||
// callback();
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// trigger: ['blur'],
|
||||
// },
|
||||
// {
|
||||
// // 正则校验示例,此处用正则校验是否中文,此处仅为示例,因为uView有this.$u.test.chinese可以判断是否中文
|
||||
// pattern: /^[\u4e00-\u9fa5]+$/gi,
|
||||
// message: '简介只能为中文',
|
||||
// trigger: 'change',
|
||||
// },
|
||||
],
|
||||
mobile: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请输入手机号',
|
||||
// trigger: ['change','blur'],
|
||||
// },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
return value === '' || this.$u.test.mobile(value);
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
// password: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请输入密码',
|
||||
// trigger: ['change','blur'],
|
||||
// },
|
||||
// {
|
||||
// // 正则不能含有两边的引号
|
||||
// pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\S{5,12}$/,
|
||||
// message: '需同时含有字母和数字,长度在6-12之间',
|
||||
// trigger: ['change','blur'],
|
||||
// }
|
||||
// ],
|
||||
// rePassword: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请重新输入密码',
|
||||
// trigger: ['change','blur'],
|
||||
// },
|
||||
// {
|
||||
// validator: (rule, value, callback) => {
|
||||
// return value === this.model.password;
|
||||
// },
|
||||
// message: '两次输入的密码不相等',
|
||||
// trigger: ['change','blur'],
|
||||
// }
|
||||
// ],
|
||||
},
|
||||
avatarBase64: ''
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.$u.api.memberProfile().then(res => {
|
||||
this.model = res.data.user;
|
||||
});
|
||||
uni.$on('uAvatarCropper', path => {
|
||||
this.avatarBase64 = path;
|
||||
if (this.avatarBase64 != '' && !this.avatarBase64.startsWith('data:')){
|
||||
// #ifdef APP-PLUS
|
||||
let self = this, fileUrl = this.avatarBase64;
|
||||
plus.io.resolveLocalFileSystemURL(path, function(entry) {
|
||||
entry.file(function(file) {
|
||||
var fileReader = new plus.io.FileReader()
|
||||
fileReader.onload = function(data) {
|
||||
// console.log(data.target.result);
|
||||
self.avatarBase64 = data.target.result;
|
||||
}
|
||||
fileReader.onerror = function(error) { }
|
||||
fileReader.readAsDataURL(file)
|
||||
}, function(error) { })
|
||||
}, function(error) { });
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.avatarBase64 = 'data:image/jpeg;base64,' + uni.getFileSystemManager()
|
||||
.readFileSync(this.avatarBase64, "base64");
|
||||
// #endif
|
||||
}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
avatarUrl() {
|
||||
if (this.avatarBase64 != ''){
|
||||
return this.avatarBase64;
|
||||
}
|
||||
let url = this.vuex_user.avatarUrl || '/ctxPath/static/images/user1.jpg';
|
||||
url = url.replace('/ctxPath/', this.vuex_config.baseUrl + '/');
|
||||
return url;
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules);
|
||||
},
|
||||
methods: {
|
||||
chooseAvatar() {
|
||||
this.$u.route({
|
||||
url: '/uview-ui/components/u-avatar-cropper/u-avatar-cropper',
|
||||
params: {
|
||||
destWidth: 800, // 输出图片宽高
|
||||
rectWidth: 200, // 裁剪框的宽高
|
||||
fileType: 'jpg', // 输出的图片类型,如果'png'类型发现裁剪的图片太大,改成"jpg"即可
|
||||
}
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.model.avatarBase64 = this.avatarBase64;
|
||||
this.$u.api.user.infoSaveBase(this.model).then(res => {
|
||||
this.$u.api.index(); // 保存后更新用户信息
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: res.message,
|
||||
showCancel: false,
|
||||
success: function () {
|
||||
if (res.result == 'true') {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.$u.toast('您填写的信息有误,请根据提示修正。');
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
106
hotgo-uniapp/pages/sys/user/pwd.vue
Normal file
106
hotgo-uniapp/pages/sys/user/pwd.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<u-form class="form" :model="model" :rules="rules" ref="uForm">
|
||||
<u-form-item label="旧密码" prop="oldPassword" label-width="180">
|
||||
<u-input type="password" v-model="model.oldPassword" placeholder="请输入旧密码"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="新密码" prop="newPassword" label-width="180">
|
||||
<u-input type="password" v-model="model.newPassword" placeholder="请输入新密码"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="确认密码" prop="confirmNewPassword" label-width="180">
|
||||
<u-input type="password" v-model="model.confirmNewPassword" placeholder="请确认新密码"></u-input>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
<view class="form-footer">
|
||||
<u-button class="btn" type="primary" @click="submit">提交</u-button>
|
||||
<!-- <u-button class="btn" type="default" @click="cancel">关闭</u-button> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
import base64 from '@/common/base64.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
model: {
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
confirmNewPassword: ''
|
||||
},
|
||||
rules: {
|
||||
oldPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入旧密码',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
newPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入新密码',
|
||||
trigger: ['change','blur'],
|
||||
},
|
||||
{
|
||||
pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\S{5,12}$/,
|
||||
message: '需同时含有字母和数字,长度在6-12之间',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
confirmNewPassword: [
|
||||
{
|
||||
required: true,
|
||||
message: '请重新输入密码',
|
||||
trigger: ['change','blur'],
|
||||
},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
return value === this.model.newPassword;
|
||||
},
|
||||
message: '两次输入的密码不相等',
|
||||
trigger: ['change','blur'],
|
||||
}
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules);
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.$u.api.user.infoSavePwd({
|
||||
oldPassword: base64.btoa(this.model.oldPassword),
|
||||
newPassword: base64.btoa(this.model.newPassword),
|
||||
confirmNewPassword: base64.btoa(this.model.confirmNewPassword)
|
||||
}).then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: res.message,
|
||||
showCancel: false,
|
||||
success: function () {
|
||||
if (res.result == 'true') {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.$u.toast('您填写的信息有误,请根据提示修正。');
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
87
hotgo-uniapp/pages/sys/user/setting.vue
Normal file
87
hotgo-uniapp/pages/sys/user/setting.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<u-cell-group :border="false" title="消息提醒">
|
||||
<u-cell-item title="接受消息提醒" :arrow="false">
|
||||
<u-switch v-model="message" slot="right-icon" class="u-m-l-20"></u-switch>
|
||||
</u-cell-item>
|
||||
<u-cell-item title="通知栏显示消息详情" :arrow="false">
|
||||
<u-switch v-model="messageBar" slot="right-icon" class="u-m-l-20"></u-switch>
|
||||
<text slot="label">关闭后,当收到消息的时候,只显示有提示,不显示消息内容。</text>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
<u-cell-group :border="false" title="声音与振动">
|
||||
<u-cell-item title="收到消息后播放声音或振动" @click="openSettings">
|
||||
<text slot="label">前往系统设置中,修改声音与振动</text>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
<u-cell-group :border="false" title="软件更新提醒">
|
||||
<u-cell-item title="软件更新提醒" :arrow="false">
|
||||
<u-switch v-model="upgrade" slot="right-icon" class="u-m-l-20"></u-switch>
|
||||
<text slot="label">当本软件有新版本发布时,给予提醒</text>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
<view class="u-m-40">
|
||||
<u-button type="primary" @click="logout" :hair-line="false">退出登录</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
*/
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
message: true,
|
||||
messageBar: true,
|
||||
upgrade: true
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openSettings() {
|
||||
// #ifdef APP-PLUS
|
||||
uni.getSystemInfo({
|
||||
success(res) {
|
||||
if(res.platform == 'ios'){
|
||||
plus.runtime.openURL("app-settings://");
|
||||
} else if (res.platform == 'android'){
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var Intent = plus.android.importClass("android.content.Intent");
|
||||
var mIntent = new Intent('android.settings.SOUND_SETTINGS');
|
||||
main.startActivity(mIntent);
|
||||
}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.$u.toast('小程序端或H5端已是最新版,无需检查更新!');
|
||||
// #endif
|
||||
},
|
||||
logout() {
|
||||
this.$u.api.logout().then(res => {
|
||||
this.$u.toast(res.message);
|
||||
if (res.result == 'true') {
|
||||
let self = this;
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/login/index'
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import '../home/index.scss';
|
||||
|
||||
page {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
/deep/ .u-cell-title {
|
||||
padding: 25rpx 30rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user