Commit 9b466372 authored by leon's avatar leon

feat: change password

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