mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-18 16:35:53 +08:00
commit message
This commit is contained in:
125
pages/mine/set/editionIntro.vue
Normal file
125
pages/mine/set/editionIntro.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<view class="edition-intro">
|
||||
<view class="logo c-content">
|
||||
<view>
|
||||
<image src="/static/img/edition.png" mode=""></image>
|
||||
</view>
|
||||
<view>版本不息 优化不止</view>
|
||||
</view>
|
||||
<view class="edition c-content" v-for="(item,index) in editionHistory" :key="index">
|
||||
<view class="level">
|
||||
<text style="color: #1ABC9C;">{{item.version}}</text>
|
||||
<text>{{$u.timeFormat(item.update_time, 'yyyy-mm-dd')}}</text>
|
||||
</view>
|
||||
<view class="detail" v-html="item.content"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as API_Message from "@/api/message.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
editionHistory:[],
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 5
|
||||
},
|
||||
loadStatus:'more'
|
||||
};
|
||||
},
|
||||
onLoad(){
|
||||
if (uni.getSystemInfoSync().platform === 'android') {
|
||||
this.params.type = 0;
|
||||
} else {
|
||||
this.params.type = 1;
|
||||
}
|
||||
this.GET_AppVersionList(true);
|
||||
},
|
||||
onReachBottom() {
|
||||
if(this.loadStatus!='noMore'){
|
||||
this.params.pageNumber++
|
||||
this.GET_AppVersionList(false)
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
GET_AppVersionList(reset){
|
||||
if (reset) {
|
||||
this.params.pageNumber = 1
|
||||
}
|
||||
uni.showLoading({
|
||||
title:"加载中"
|
||||
})
|
||||
API_Message.getAppVersionList(this.params).then(response => {
|
||||
uni.hideLoading()
|
||||
if(response.statusCode==200){
|
||||
const { data } = response
|
||||
if(data.data.length<10){
|
||||
this.loadStatus = 'noMore';
|
||||
}
|
||||
this.editionHistory.push(...data.data)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.edition-intro{
|
||||
.logo{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
font-size: $font-lg;
|
||||
color: $font-color-light;
|
||||
height: 330rpx;
|
||||
margin-bottom: 20rpx;
|
||||
>view:nth-child(1){
|
||||
width: 144rpx;
|
||||
height: 144rpx;
|
||||
border: 1px solid #FFC71C;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
margin-bottom: 30rpx;
|
||||
image{
|
||||
width: 80rpx;
|
||||
height: 113rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin:auto;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.edition{
|
||||
margin-bottom: 20rpx;
|
||||
color: $font-color-light;
|
||||
font-size: $font-sm;
|
||||
.level{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 30rpx ;
|
||||
border-bottom: 1px solid $border-color-light;
|
||||
text:nth-child(1){
|
||||
font-size: $font-base;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.detail{
|
||||
margin-left: 20rpx;
|
||||
line-height: 2em;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
162
pages/mine/set/feedBack.vue
Normal file
162
pages/mine/set/feedBack.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
<template>
|
||||
<div class="feedBack">
|
||||
<div class="feedBack-box">
|
||||
<h4>猜你想问</h4>
|
||||
<div class="feedBack-item" @click="handleClick(index)" v-for="(item,index) in list" :key="index">
|
||||
{{item.text}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="feedBack-box">
|
||||
<h4>问题反馈 <span style="margin-left:10rpx;" v-if="feedBack.type">@{{ list.find(item=>{return item.value == feedBack.type }).text }}</span></h4>
|
||||
<u-input class="field-input" height="500" :border-bottom="false" v-model="feedBack.context" type="textarea" placeholder="请输入反馈信息">
|
||||
</u-input>
|
||||
</div>
|
||||
|
||||
<!-- 上传凭证 -->
|
||||
<div class="feedBack-box">
|
||||
<view class="opt-view">
|
||||
<view class="img-title">上传凭证(最多5张)</view>
|
||||
<view class="images-view">
|
||||
<u-upload :header=" { accessToken: storage.getAccessToken() }" :action="action" width="150" @on-uploaded="onUploaded" :max-count="5" :show-progress="false"></u-upload>
|
||||
</view>
|
||||
</view>
|
||||
</div>
|
||||
|
||||
<div class="feedBack-box">
|
||||
<h4>手机号</h4>
|
||||
<u-input :border-bottom="false" v-model="feedBack.mobile" placeholder="请输入您的手机号">
|
||||
</u-input>
|
||||
</div>
|
||||
|
||||
<div class="submit" @click="submit()">提交</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import storage from "@/utils/storage.js";
|
||||
import config from "@/config/config";
|
||||
import { feedBack } from "@/api/members.js";
|
||||
import { upload } from "@/api/common.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
storage,
|
||||
config,
|
||||
feedBack: {
|
||||
type:"FUNCTION"
|
||||
},
|
||||
action: upload,
|
||||
list: [
|
||||
{ text: "功能相关", value: "FUNCTION" },
|
||||
{ text: "优化反馈", value: "OPTIMIZE" },
|
||||
{ text: "其他", value: "OTHER" },
|
||||
],
|
||||
};
|
||||
},
|
||||
onReady() {},
|
||||
methods: {
|
||||
handleClick(index) {
|
||||
this.$set(this.feedBack, "type", this.list[index].value);
|
||||
},
|
||||
|
||||
//图片上传
|
||||
onUploaded(lists) {
|
||||
let images = [];
|
||||
|
||||
lists.forEach((item) => {
|
||||
images.push(item.response.result);
|
||||
});
|
||||
console.log(images);
|
||||
this.feedBack.images = images.join(",");
|
||||
},
|
||||
|
||||
submit() {
|
||||
if (!this.feedBack.type) {
|
||||
uni.showToast({
|
||||
title: "请填写反馈类型",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (!this.feedBack.context) {
|
||||
uni.showToast({
|
||||
title: "请填写反馈类型",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (this.feedBack.mobile && !this.$u.test.mobile(this.feedBack.mobile)) {
|
||||
uni.showToast({
|
||||
title: "请填写您的正确手机号",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
feedBack(this.feedBack).then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
title: "提交成功!",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.submit {
|
||||
text-align: center;
|
||||
background: $light-color;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
color: #fff;
|
||||
width: 92%;
|
||||
margin-bottom: 100rpx;
|
||||
margin: 0 auto;
|
||||
border-radius: 100px;
|
||||
}
|
||||
.feedBack {
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
.feedBack-box {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
/deep/ .u-input__textarea {
|
||||
padding: 12px;
|
||||
}
|
||||
.feedBack-box:nth-of-type(1) {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
.feedBack-item {
|
||||
margin: 20rpx 0;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
h4 {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.field-input {
|
||||
margin: 20rpx 0;
|
||||
padding: 20rpx 0;
|
||||
background: #fafafa;
|
||||
border-radius: 0.6em;
|
||||
}
|
||||
</style>
|
||||
39
pages/mine/set/notify.vue
Normal file
39
pages/mine/set/notify.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<view class="notify">
|
||||
<u-cell-group>
|
||||
<u-cell-item title="账户通知" :arrow="false">
|
||||
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="setting.account"></u-switch>
|
||||
</u-cell-item>
|
||||
<u-cell-item title="物流通知" :arrow="false">
|
||||
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="setting.logistics"></u-switch>
|
||||
</u-cell-item>
|
||||
<u-cell-item title="优惠促销" :arrow="false">
|
||||
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="setting.cheap"></u-switch>
|
||||
</u-cell-item>
|
||||
<u-cell-item title="服务通知" :arrow="false">
|
||||
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="setting.service"></u-switch>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
setting:{
|
||||
account:false,
|
||||
logistics:false,
|
||||
cheap:false,
|
||||
service:false
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
uni-view{
|
||||
font-size: 20rpx;
|
||||
}
|
||||
</style>
|
||||
220
pages/mine/set/personMsg.vue
Normal file
220
pages/mine/set/personMsg.vue
Normal file
@@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<view class="person-msg">
|
||||
<view class="head c-content" @click="changeFace">
|
||||
<image :src="form.face || '/static/missing-face.png'" mode=""></image>
|
||||
<view>点击修改头像</view>
|
||||
</view>
|
||||
<u-form :model="form" ref="uForm" class="form">
|
||||
<!-- <u-form-item label="用户名" label-width="150"
|
||||
><u-input v-model="form.username" disabled
|
||||
/></u-form-item> -->
|
||||
<u-form-item label="昵称" label-width="150">
|
||||
<u-input v-model="form.nickName" placeholder="请输入昵称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="性别" label-width="150">
|
||||
<!-- {{typeof list[0].value}} {{form.sex + typeof form.sex}} -->
|
||||
<u-radio-group v-model="form.sex" :active-color="lightColor">
|
||||
<u-radio name="1">男</u-radio>
|
||||
<u-radio name="0">女</u-radio>
|
||||
</u-radio-group>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="生日" label-width="150" right-icon="arrow-right">
|
||||
<u-input v-model="birthday" disabled placeholder="请选择出生日期" @click="showBirth = true" />
|
||||
<u-picker v-model="showBirth" mode="time" :confirm-color="lightColor" @confirm="selectTime"></u-picker>
|
||||
</u-form-item>
|
||||
<u-form-item label="城市" label-width="150" placeholder="请选择城市" right-icon="arrow-right">
|
||||
<u-input v-model="form.___path" disabled @click="clickRegion" />
|
||||
</u-form-item>
|
||||
<view class="submit" @click="submit">保存</view>
|
||||
</u-form>
|
||||
|
||||
<m-city :provinceData="region" headTitle="区域选择" ref="cityPicker" @funcValue="getpickerParentValue" pickerSize="4"></m-city>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { saveUserInfo } from "@/api/members.js";
|
||||
import { upload } from "@/api/common.js";
|
||||
|
||||
import storage from "@/utils/storage.js";
|
||||
import uFormItem from "@/uview-ui/components/u-form-item/u-form-item.vue";
|
||||
import gkcity from "@/components/m-city/m-city.vue";
|
||||
export default {
|
||||
components: { uFormItem, "m-city": gkcity },
|
||||
data() {
|
||||
return {
|
||||
lightColor: this.$lightColor,
|
||||
form: {
|
||||
face: "/static/missing-face.png",
|
||||
regionId: [],
|
||||
region: [],
|
||||
sex: "1",
|
||||
___path: "",
|
||||
},
|
||||
birthday: "",
|
||||
photo: [
|
||||
{ text: "立即拍照", color: this.$mainColor },
|
||||
{ text: "从相册选择", color: this.$mainColor },
|
||||
],
|
||||
value: "",
|
||||
region: [
|
||||
{
|
||||
id: "",
|
||||
localName: "请选择",
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
list: [
|
||||
{
|
||||
sex: "男",
|
||||
value: "1",
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
sex: "女",
|
||||
value: "0",
|
||||
disabled: false,
|
||||
},
|
||||
],
|
||||
showBirth: false,
|
||||
showRegion: false,
|
||||
showAction: false,
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
getpickerParentValue(e) {
|
||||
this.form.region = [];
|
||||
this.form.regionId = [];
|
||||
let name = "";
|
||||
|
||||
e.forEach((item, index) => {
|
||||
if (item.id) {
|
||||
this.form.region.push(item.localName);
|
||||
this.form.regionId.push(item.id);
|
||||
if (index == e.length - 1) {
|
||||
name += item.localName;
|
||||
} else {
|
||||
name += item.localName + ",";
|
||||
}
|
||||
this.form.___path = name;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(this.form);
|
||||
},
|
||||
|
||||
clickRegion() {
|
||||
this.$refs.cityPicker.show();
|
||||
},
|
||||
submit() {
|
||||
if (this.form.regionId.length != 0 && this.birthday) {
|
||||
delete this.form.___path;
|
||||
let params = JSON.parse(JSON.stringify(this.form));
|
||||
saveUserInfo(params).then((res) => {
|
||||
console.log(res);
|
||||
if (res.statusCode == 200) {
|
||||
storage.setUserInfo(res.data.result);
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "请填写生日和城市!",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
changeFace(index) {
|
||||
uni.chooseImage({
|
||||
success: (chooseImageRes) => {
|
||||
const tempFilePaths = chooseImageRes.tempFilePaths;
|
||||
uni.uploadFile({
|
||||
url: upload,
|
||||
filePath: tempFilePaths[0],
|
||||
name: "file",
|
||||
header: {
|
||||
accessToken: storage.getAccessToken(),
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
let data = JSON.parse(uploadFileRes.data);
|
||||
|
||||
this.form.face = data.result;
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
selectRegion(region) {
|
||||
//选择地址
|
||||
this.$set(
|
||||
this.form,
|
||||
"address",
|
||||
`${region.province.label} ${region.city.label} ${region.area.label}`
|
||||
);
|
||||
},
|
||||
selectTime(time) {
|
||||
// 生日
|
||||
console.log(time);
|
||||
this.form.birthday = `${time.year}-${time.month}-${time.day}`;
|
||||
this.birthday = `${time.year} - ${time.month} - ${time.day}`;
|
||||
// this.form.timestamp = `${time.year} - ${time.month} - ${time.day}`;
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
// this.form.userName = storage.getUserInfo().username
|
||||
this.form.nickName = storage.getUserInfo().nickName;
|
||||
this.form.sex = storage.getUserInfo().sex || 1;
|
||||
this.form.birthday = storage.getUserInfo().birthday;
|
||||
this.birthday = storage.getUserInfo().birthday || "";
|
||||
this.form.___path = storage.getUserInfo().region;
|
||||
this.form.face = storage.getUserInfo().face || "";
|
||||
this.form.regionId = storage.getUserInfo().regionId || [];
|
||||
this.form.region = storage.getUserInfo().region || [];
|
||||
console.log(this.form);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.submit {
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
text-align: center;
|
||||
margin-top: 90rpx;
|
||||
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
color: $main-color;
|
||||
border-radius: 100px;
|
||||
}
|
||||
.head {
|
||||
height: 260rpx;
|
||||
color: $font-color-light;
|
||||
font-size: $font-sm;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
line-height: 2em;
|
||||
image {
|
||||
width: 144rpx;
|
||||
height: 144rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
/deep/ .u-form {
|
||||
background-color: #ffffff;
|
||||
padding: 0;
|
||||
margin-top: 30rpx;
|
||||
.u-form-item {
|
||||
padding: 0 20rpx;
|
||||
height: 110rpx;
|
||||
line-height: 110rpx;
|
||||
}
|
||||
}
|
||||
.form {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
40
pages/mine/set/securityCenter/deviceManage.vue
Normal file
40
pages/mine/set/securityCenter/deviceManage.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<view class="device-manage">
|
||||
<u-cell-group>
|
||||
<u-cell-item class="border-top" :arrow="false" title="常用设备保护">
|
||||
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="checked"></u-switch>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
<view class="describe">开启常用设备保护后,在不常用的手机上登录时,需要进行账号及密码验证,通过后继续登录。</view>
|
||||
<view class="title">常用设备</view>
|
||||
<u-cell-group class="">
|
||||
<u-cell-item
|
||||
title="HUAWEI Mate30"
|
||||
:center="true"
|
||||
label="最近使用:2020-06-28北京市"
|
||||
value="正在使用"
|
||||
:value-style="{color:'#1abc9c','font-size':'14px'}"
|
||||
:title-style="{'color':'#333'}"
|
||||
>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
checked:true
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.device-manage{
|
||||
.title{
|
||||
padding:0 30rpx 20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
250
pages/mine/set/securityCenter/editPassword.vue
Normal file
250
pages/mine/set/securityCenter/editPassword.vue
Normal file
@@ -0,0 +1,250 @@
|
||||
<template>
|
||||
<view class="box">
|
||||
<view class="box-tips">
|
||||
<h2>
|
||||
{{verificationTitle[validateFlage==false ? 0 : 1].title}}
|
||||
</h2>
|
||||
<view class="verification">{{verificationTitle[step].desc}}</view>
|
||||
</view>
|
||||
<u-form :model="codeForm" class="form" ref="validateCodeForm">
|
||||
<view v-if="!validateFlage">
|
||||
<u-form-item label-width="120" label="手机号" prop="mobile">
|
||||
<u-input v-model="codeForm.mobile" placeholder="请输入您的手机号" />
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item class="sendCode" label-width="120" prop="code" label="验证码">
|
||||
<u-input v-model="codeForm.code" placeholder="请输入验证码" />
|
||||
<u-verification-code unique-key="page-edit" :seconds="seconds" @end="end" @start="start" ref="uCode" @change="codeChange"></u-verification-code>
|
||||
<view @tap="getCode" class="text-tips">{{ tips }}</view>
|
||||
</u-form-item>
|
||||
|
||||
<view class="submit" @click="validatePhone">验证</view>
|
||||
<myVerification keep-running @send="verification" class="verification" ref="verification" business="LOGIN" />
|
||||
</view>
|
||||
<view v-if="validateFlage">
|
||||
<u-form-item label-width="120" label="旧密码">
|
||||
<u-input type="password" v-model="password" placeholder="请输入您的旧密码" />
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label-width="120" label="新密码">
|
||||
|
||||
<u-input type="password" v-model="newPassword" placeholder="请输入您的新密码" />
|
||||
|
||||
</u-form-item>
|
||||
|
||||
<view class="submit" @click="updatePassword">修改密码</view>
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sendMobile, resetByMobile, modifyPass } from "@/api/login";
|
||||
|
||||
import storage from "@/utils/storage.js";
|
||||
import { md5 } from "@/utils/md5.js";
|
||||
import myVerification from "@/components/verification/verification.vue";
|
||||
import uuid from "@/utils/uuid.modified.js";
|
||||
export default {
|
||||
components: {
|
||||
myVerification,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uuid,
|
||||
validateFlage: false, //是否进行了手机号验证
|
||||
verificationTitle: [
|
||||
{
|
||||
title: "安全验证",
|
||||
desc: "请输入当前手机号进行安全验证",
|
||||
},
|
||||
{
|
||||
title: "修改密码",
|
||||
desc: "请输入新密码",
|
||||
},
|
||||
],
|
||||
step: 0, //当前验证步骤
|
||||
flage: false, //是否验证码验证
|
||||
// 验证码登录form
|
||||
codeForm: {
|
||||
mobile: "", //手机号
|
||||
code: "", //验证码
|
||||
},
|
||||
newPassword: "",//新密码
|
||||
password: "", //密码
|
||||
tips: "", //提示
|
||||
seconds: 60,
|
||||
|
||||
// 验证码登录校验
|
||||
codeRules: {
|
||||
mobile: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
return this.$u.test.mobile(value);
|
||||
},
|
||||
message: "手机号码不正确",
|
||||
trigger: ["blur"],
|
||||
},
|
||||
],
|
||||
code: [
|
||||
{
|
||||
min: 4,
|
||||
max: 6,
|
||||
required: true,
|
||||
message: "请输入验证码",
|
||||
trigger: ["blur"],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
onReady() {
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
this.$refs.validateCodeForm.setRules(this.codeRules);
|
||||
},
|
||||
watch: {
|
||||
flage(val) {
|
||||
if (val) {
|
||||
if (this.$refs.uCode.canGetCode) {
|
||||
uni.showLoading({
|
||||
title: "正在获取验证码",
|
||||
});
|
||||
sendMobile(this.codeForm.mobile).then((res) => {
|
||||
uni.hideLoading();
|
||||
// 这里此提示会被this.start()方法中的提示覆盖
|
||||
if (res.data.code == 200) {
|
||||
this.$refs.uCode.start();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$u.toast("请倒计时结束后再发送");
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 修改密码
|
||||
updatePassword() {
|
||||
modifyPass({
|
||||
newPassword: md5(this.newPassword),
|
||||
password: md5(this.password),
|
||||
}).then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
title: "修改成功!",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 验证码验证
|
||||
verification(val) {
|
||||
this.flage = val == this.$store.state.verificationKey ? true : false;
|
||||
},
|
||||
|
||||
// 验证手机号
|
||||
validatePhone() {
|
||||
this.$refs.validateCodeForm.validate((valid) => {
|
||||
if (valid) {
|
||||
resetByMobile(this.codeForm).then((res) => {
|
||||
if (res.data.success) {
|
||||
storage.setAccessToken(res.data.result.accessToken);
|
||||
storage.setRefreshToken(res.data.result.refreshToken);
|
||||
// 登录成功
|
||||
uni.showToast({
|
||||
title: "验证成功!",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
codeChange(text) {
|
||||
this.tips = text;
|
||||
},
|
||||
end() {},
|
||||
|
||||
/**判断是否是当前用户的手机号 */
|
||||
isUserPhone() {
|
||||
let flage = false;
|
||||
let user = this.$options.filters.isLogin();
|
||||
if (user.mobile != this.codeForm.mobile) {
|
||||
uni.showToast({
|
||||
title: "请输入当前绑定手机号",
|
||||
icon: "none",
|
||||
});
|
||||
flage = false;
|
||||
} else {
|
||||
flage = true;
|
||||
}
|
||||
|
||||
return flage;
|
||||
},
|
||||
/**获取验证码 */
|
||||
getCode() {
|
||||
if (this.isUserPhone()) {
|
||||
if (this.tips == "重新获取") {
|
||||
this.flage = true;
|
||||
}
|
||||
if (!this.$u.test.mobile(this.codeForm.mobile)) {
|
||||
uni.showToast({
|
||||
title: "请输入正确手机号",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (!this.flage) {
|
||||
this.$refs.verification.hide();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
start() {
|
||||
this.$u.toast("验证码已发送");
|
||||
this.flage = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import url("../../../passport/login.scss");
|
||||
.u-form-item {
|
||||
margin: 40rpx 0;
|
||||
}
|
||||
.sendCode {
|
||||
/deep/ .u-form-item--right__content__slot {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
.box {
|
||||
padding: 80rpx 0;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.box-tips {
|
||||
margin: 0 72rpx;
|
||||
}
|
||||
.verification {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
</style>
|
||||
84
pages/mine/set/securityCenter/faceLogin.vue
Normal file
84
pages/mine/set/securityCenter/faceLogin.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<view class="face-login">
|
||||
<u-cell-group>
|
||||
<u-cell-item class="border-top" :arrow="false" title="面容登录">
|
||||
<u-switch slot="right-icon" @change="faceSwitchChange" active-color="#1abc9c" size="40" v-model="checked"></u-switch>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
<view class="describe">开启后可使用面容认证完成快捷登录,设置仅对本机生效。</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import storage from '@/utils/storage.js';
|
||||
import { setBiolofy } from '@/api/passport.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
checked: true
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
faceSwitchChange(value) {
|
||||
if (value === true) {
|
||||
const res = uni.getSystemInfoSync();
|
||||
plus.device.getInfo({
|
||||
success: function(e) {
|
||||
let params = {
|
||||
mobile_type: res.model,
|
||||
secret_key: e.uuid
|
||||
};
|
||||
setBiolofy(params).then(res => {
|
||||
if (res.statusCode === 200) {
|
||||
storage.setFaceLogin(true);
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function(e) {
|
||||
//plus.nativeUI.toast('获取设备信息错误:' + JSON.stringify(e));
|
||||
console.error('getDeviceInfo failed: ' + JSON.stringify(e));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
storage.setFaceLogin(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// #ifdef APP-PLUS
|
||||
uni.checkIsSupportSoterAuthentication({
|
||||
success(res) {
|
||||
if (!res.supportMode.find(e => e === 'facial')) {
|
||||
plus.nativeUI.toast('此设备不支持面部识别');
|
||||
uni.navigateBack();
|
||||
}
|
||||
uni.checkIsSoterEnrolledInDevice({
|
||||
checkAuthMode: 'facial',
|
||||
success(_res) {
|
||||
if (!_res.isEnrolled) {
|
||||
plus.nativeUI.toast('此设备未录入面部信息');
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
fail(_err) {
|
||||
// plus.nativeUI.toast(JSON.stringify(_err));
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
},
|
||||
fail(err) {
|
||||
// plus.nativeUI.toast(JSON.stringify(err));
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
this.checked = storage.getFaceLogin() || false;
|
||||
// #endif
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.face-login {
|
||||
}
|
||||
</style>
|
||||
70
pages/mine/set/securityCenter/fingerLogin.vue
Normal file
70
pages/mine/set/securityCenter/fingerLogin.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<view class="finger">
|
||||
<u-cell-group>
|
||||
<u-cell-item class="border-top" :arrow="false" title="指纹登录">
|
||||
<u-switch slot="right-icon" @change="fingerSwitchChange" active-color="#1abc9c" size="40" v-model="checked"></u-switch>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
<view class="describe">开启后可使用指纹认证完成快捷登录,设置仅对本机生效。如需修改指纹,请在系统设置中操作。</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import storage from '@/utils/storage.js';
|
||||
import { setBiolofy } from '@/api/passport.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
checked: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
fingerSwitchChange(value) {
|
||||
if (value === true) {
|
||||
const res = uni.getSystemInfoSync();
|
||||
plus.device.getInfo({
|
||||
success: function(e) {
|
||||
let params = {
|
||||
mobile_type: res.model,
|
||||
secret_key: e.uuid
|
||||
};
|
||||
setBiolofy(params).then(res => {
|
||||
if (res.statusCode === 200) {
|
||||
storage.setFingerLogin(true);
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function(e) {
|
||||
console.error('getDeviceInfo failed: ' + JSON.stringify(e));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
storage.setFingerLogin(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// #ifdef APP-PLUS
|
||||
if (!plus.fingerprint.isSupport()) {
|
||||
plus.nativeUI.toast('此设备不支持指纹识别');
|
||||
uni.navigateBack();
|
||||
}
|
||||
if (!plus.fingerprint.isKeyguardSecure()) {
|
||||
plus.nativeUI.toast('此设备未设置密码锁屏');
|
||||
uni.navigateBack();
|
||||
}
|
||||
if (!plus.fingerprint.isEnrolledFingerprints()) {
|
||||
plus.nativeUI.toast('此设备未录入指纹');
|
||||
uni.navigateBack();
|
||||
}
|
||||
this.checked = storage.getFingerLogin() || false;
|
||||
// #endif
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.finger {
|
||||
}
|
||||
</style>
|
||||
36
pages/mine/set/securityCenter/securityCenter.vue
Normal file
36
pages/mine/set/securityCenter/securityCenter.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<view class="securityCenter">
|
||||
<u-cell-group>
|
||||
<u-cell-item title="修改密码" @click="navigateTo('/pages/mine/set/securityCenter/editPassword')"></u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
mobile: "", //存储手机号
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url: url + `?mobile=${this.mobile}`,
|
||||
});
|
||||
},
|
||||
},
|
||||
onLoad(option) {
|
||||
this.mobile = option.mobile;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.securityCenter {
|
||||
.u-cell {
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
219
pages/mine/set/setUp.vue
Normal file
219
pages/mine/set/setUp.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="person" @click="checkUserInfo()">
|
||||
<u-image width=140 height="140" shape="circle" :src="userInfo.face || '/static/missing-face.png'" mode=""></u-image>
|
||||
<view class="user-name">
|
||||
<view>{{ userInfo.id ? userInfo.username || '' : '暂未登录' }}</view>
|
||||
</view>
|
||||
<u-icon color="#ccc" name="arrow-right"></u-icon>
|
||||
</view>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view style="height: 20rpx; width: 100%"></view>
|
||||
<!-- #endif -->
|
||||
<u-cell-group :border="false">
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<u-cell-item title="清除缓存" :value="fileSizeString" @click="clearCache"></u-cell-item>
|
||||
<!-- #endif -->
|
||||
<u-cell-item title="安全中心" @click="navigateTo('/pages/mine/set/securityCenter/securityCenter')"></u-cell-item>
|
||||
<u-cell-item title="意见反馈" @click="navigateTo('/pages/mine/set/feedBack')"></u-cell-item>
|
||||
<!-- #ifndef H5 -->
|
||||
<u-cell-item title="版本说明" @click="navigateTo('/pages/mine/set/editionIntro')"></u-cell-item>
|
||||
<!-- #endif -->
|
||||
<!-- <u-cell-item title="好评鼓励"></u-cell-item> -->
|
||||
<u-cell-item title="关于我们" @click="navigateTo('/pages/mine/aboutUs')"></u-cell-item>
|
||||
</u-cell-group>
|
||||
<view class="submit" @click="showModalDialog">{{userInfo.id ?'退出登录':'返回登录'}}</view>
|
||||
<u-modal show-cancel-button v-model="quitShow" @confirm="confirm" :confirm-color="lightColor" :async-close="true" :content="userInfo.id ? '确定要退出登录么?' : '确定要返回登录么?'"></u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import storage from "@/utils/storage.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
lightColor: this.$lightColor,
|
||||
quitShow: false,
|
||||
isCertificate: false,
|
||||
userInfo: {},
|
||||
fileSizeString: "0B",
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
navigateTo(url) {
|
||||
if (url == "/pages/set/securityCenter/securityCenter") {
|
||||
url += `?mobile=${this.userInfo.mobile}`;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 确认退出
|
||||
* 清除缓存重新登录
|
||||
*/
|
||||
confirm() {
|
||||
storage.setAccessToken("");
|
||||
storage.setRefreshToken("");
|
||||
storage.setUserInfo({});
|
||||
uni.redirectTo({
|
||||
url: "/pages/passport/login",
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 显示退出登录对话框
|
||||
*/
|
||||
showModalDialog() {
|
||||
this.quitShow = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* 读取当前缓存
|
||||
*/
|
||||
getCacheSize() {
|
||||
//获取缓存数据
|
||||
let that = this;
|
||||
plus.cache.calculate(function (size) {
|
||||
let sizeCache = parseInt(size);
|
||||
if (sizeCache == 0) {
|
||||
that.fileSizeString = "0B";
|
||||
} else if (sizeCache < 1024) {
|
||||
that.fileSizeString = sizeCache + "B";
|
||||
} else if (sizeCache < 1048576) {
|
||||
that.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
|
||||
} else if (sizeCache < 1073741824) {
|
||||
that.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
|
||||
} else {
|
||||
that.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击用户详情
|
||||
* 判断当前是否进入用户中心
|
||||
*/
|
||||
checkUserInfo() {
|
||||
if (this.$options.filters.isLogin("auth")) {
|
||||
this.navigateTo("/pages/mine/set/personMsg");
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "当前暂无用户请登录后重试",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 清除当前设备缓存
|
||||
*/
|
||||
clearCache() {
|
||||
//清理缓存
|
||||
let that = this;
|
||||
let os = plus.os.name;
|
||||
if (os == "Android") {
|
||||
let main = plus.android.runtimeMainActivity();
|
||||
let sdRoot = main.getCacheDir();
|
||||
let files = plus.android.invoke(sdRoot, "listFiles");
|
||||
let len = files.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
let filePath = "" + files[i]; // 没有找到合适的方法获取路径,这样写可以转成文件路径
|
||||
plus.io.resolveLocalFileSystemURL(
|
||||
filePath,
|
||||
function (entry) {
|
||||
if (entry.isDirectory) {
|
||||
entry.removeRecursively(
|
||||
function (entry) {
|
||||
//递归删除其下的所有文件及子目录
|
||||
uni.showToast({
|
||||
title: "缓存清理完成",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
that.getCacheSize(); // 重新计算缓存
|
||||
},
|
||||
function (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
entry.remove();
|
||||
}
|
||||
},
|
||||
function (e) {
|
||||
uni.showToast({
|
||||
title: "文件路径读取失败",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// ios
|
||||
plus.cache.clear(function () {
|
||||
uni.showToast({
|
||||
title: "缓存清理完成",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
that.getCacheSize();
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.userInfo = this.$options.filters.isLogin();
|
||||
// #ifdef APP-PLUS
|
||||
this.getCacheSize();
|
||||
// #endif
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.submit {
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
text-align: center;
|
||||
margin-top: 90rpx;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
color: $main-color;
|
||||
}
|
||||
.person {
|
||||
height: 208rpx;
|
||||
display: flex;
|
||||
padding: 0 20rpx;
|
||||
font-size: $font-base;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
.user-name {
|
||||
flex: 1;
|
||||
margin-left: 30rpx;
|
||||
line-height: 2em;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
}
|
||||
.u-cell {
|
||||
height: 110rpx;
|
||||
/* line-height: 110rpx; */
|
||||
padding: 0 20rpx;
|
||||
align-items: center;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
/deep/ .u-cell__value {
|
||||
color: #cccccc !important;
|
||||
}
|
||||
|
||||
/deep/ .u-cell__right-icon-wrap {
|
||||
color: #cccccc !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user