对接设置接口
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
authLogout
|
||||
authLogout, getUserProfile, getUserNotify, changeUserNotify
|
||||
} from '/pageSubPack/api/apiSub.js'
|
||||
|
||||
//
|
||||
@@ -47,7 +47,8 @@
|
||||
const cacheSize = ref(0)
|
||||
const settingList = ref([{
|
||||
title: '更改手机号码',
|
||||
type: 'arrow'
|
||||
type: 'text',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
title: '修改密码',
|
||||
@@ -144,7 +145,19 @@
|
||||
}
|
||||
|
||||
const onSwitchChange = (item, e) => {
|
||||
item.checked = e.detail.value
|
||||
const checked = e.detail.value
|
||||
const notifyEnabled = checked ? '1' : '0'
|
||||
changeUserNotify({ notifyEnabled }).then(res => {
|
||||
if (res.code === 200) {
|
||||
item.checked = checked
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '更新失败', icon: 'none' })
|
||||
item.checked = !checked
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.showToast({ title: '更新失败', icon: 'none' })
|
||||
item.checked = !checked
|
||||
})
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
@@ -152,6 +165,20 @@
|
||||
url: '/pages/myIndex/myIndex'
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getUserProfile().then(res => {
|
||||
if (res.code === 200 && res.data) {
|
||||
const phone = res.data.phone || ''
|
||||
settingList.value[0].value = phone
|
||||
}
|
||||
})
|
||||
getUserNotify().then(res => {
|
||||
if (res.code === 200 && res.data) {
|
||||
settingList.value[2].checked = res.data.notifyEnabled === '1'
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user