Commit 5e0f73e3 authored by leon's avatar leon

feat: change password

parent 93f38934
......@@ -13,13 +13,8 @@
订阅消息
</view>
<u-button
class="my-u-block u-m-t-80"
type="warning"
shape="square"
:ripple="true"
@click="logout()"
>退出</u-button>
<u-button class="my-u-block u-m-t-80" type="warning" shape="square" :ripple="true" @click="logout()">退出
</u-button>
</view>
</template>
......@@ -48,12 +43,28 @@
id: userId,
authorized: false
}
var itemList = [{ 'text': '修改密码', 'show': false, 'count': '0' },
{ 'text': '待授权', 'show': true, 'count': '0' },
{ 'text': '已授权', 'show': true, 'count': '0'}];
var itemList = [{
'text': '修改密码',
'show': false,
'count': '0'
},
{
'text': '待授权',
'show': true,
'count': '0'
},
{
'text': '已授权',
'show': true,
'count': '0'
}
];
this.$u.api.getUserListCount(param).then(res=>{
const { Status, Result } = res.data
this.$u.api.getUserListCount(param).then(res => {
const {
Status,
Result
} = res.data
if (Status === 'true') {
itemList[1].count = Result.no_authorized;
itemList[2].count = Result.authorized;
......@@ -64,7 +75,7 @@
},
// item 点击
selectCell(index) {
switch(index) {
switch (index) {
case 0:
uni.navigateTo({
url: './password'
......@@ -101,17 +112,19 @@
code: code,
id: uni.getStorageSync('userId')
}
that.$u.api.getOpenId(param).then(res=>{
const { Status, Result } = res.data
if (Status === 'true') {
}
that.$u.api.getOpenId(param).then(res => {
const {
Status,
Result
} = res.data
if (Status === 'true') {}
})
}
})
uni.requestSubscribeMessage({
tmplIds: ['GSPZ_GSbsgfRSu8wugGPe2zqmReDbY8yeIEqd8pPPM8'],
success (res) {
success(res) {
console.log('授权结果' + res['GSPZ_GSbsgfRSu8wugGPe2zqmReDbY8yeIEqd8pPPM8'])
}
})
......@@ -141,6 +154,7 @@
flex-direction: column;
}
.item-cell {
display: flex;
position: relative;
......@@ -150,14 +164,17 @@
border-bottom: 0.1rpx solid #cccccc;
}
.item-cell-text {
margin-left: 20rpx;
font-size: 28rpx;
}
.item-cell-list-count {
margin-left: 300rpx;
font-size: 28rpx;
}
.subscribe {
width: 30%;
text-align: center;
......
<template>
<view class="wrap">
<view class="content">
<u-form
ref="uForm"
:model="params"
:error-type="['toast']"
:label-width="120"
>
<u-form ref="uForm" :model="params" :error-type="['toast']" :label-width="120">
<u-form-item label="新密码" prop="password1">
<u-input
v-model="params.password1"
placeholder="请输入新密码"
type="password"
:password-icon="true"
/>
<u-input v-model="params.password1" placeholder="请输入新密码" type="password" :password-icon="true" />
</u-form-item>
<u-form-item label="确认密码" prop="password2">
<u-input
v-model="params.password2"
placeholder="请确认新密码"
type="password"
:password-icon="true"
/>
<u-input v-model="params.password2" placeholder="请确认新密码" type="password" :password-icon="true" />
</u-form-item>
</u-form>
<u-button
class="my-u-block u-m-t-80"
type="warning"
shape="square"
:ripple="true"
@click="submit()"
:disabled="!submitDisabled"
>确认</u-button>
<u-button class="my-u-block u-m-t-80" type="warning" shape="square" :ripple="true" @click="submit()"
:disabled="!submitDisabled">确认</u-button>
</view>
</view>
</template>
......@@ -46,12 +25,16 @@
password2: ''
},
rules: {
password1: [
{ required: true, message: '请输入新密码', trigger: 'blur' }
],
password2: [
{ required: true, message: '请确认新密码', trigger: 'blur' }
]
password1: [{
required: true,
message: '请输入新密码',
trigger: 'blur'
}],
password2: [{
required: true,
message: '请确认新密码',
trigger: 'blur'
}]
}
}
},
......@@ -69,8 +52,16 @@
}
this.$refs.uForm.validate(async valid => {
if (valid) {
let res = await this.$u.api.changePassword(this.params)
const { Status, Result } = res.data
const params = {
appId: wx.getAccountInfoSync().miniProgram.appId,
password: this.params.password1,
id: uni.getStorageSync('userId')
}
let res = await this.$u.api.changePassword(params)
const {
Status,
Result
} = res.data
if (Status === 'true') {
this.$u.vuex('vuex_token', `${res.token_type} ${res.access_token}`)
this.$u.toast('密码修改成功')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment