Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-04-17 17:30:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0a473a50f0b2664486bc093eacf47912cfd618b1
0a473a50
1 parent
685d09a9
feat:增加兴趣选择卡同步
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
4 deletions
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/EditInfoViewModel.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchInterestsHobbiesPage.ets
sight_harmony/products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel.ets
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
View file @
0a473a5
...
...
@@ -24,4 +24,6 @@ export class SpConstants{
static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关
static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关
//未登录保存兴趣标签
static PUBLICVISUTORMODE_INTERESTTAGS = 'PublicVisitorMode_InterestTags'
}
\ No newline at end of file
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
0a473a5
...
...
@@ -258,6 +258,10 @@ export class HttpUrlUtils {
* app启动页 兴趣偏好
*/
static readonly INTERESTS_HOTS_DATA_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/queryTags";
/**
* 更新 兴趣偏好
*/
static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag";
private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
...
...
@@ -663,6 +667,11 @@ export class HttpUrlUtils {
}
static getUpdateInterestsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_UPDATETAG_PATH;
return url;
}
static getLiveDetailsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH
return url
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/EditInfoViewModel.ets
View file @
0a473a5
...
...
@@ -129,10 +129,13 @@ class EditInfoViewModel {
.then((navResDTO: ResponseDTO) => {
if (navResDTO.code == 0) {
promptAction.showToast({ message: '修改成功' })
}else {
promptAction.showToast({ message: navResDTO.message })
}
})
.catch((error: Error) => {
Logger.info(TAG,'updateUserInfo','EditInfoViewModel')
promptAction.showToast({ message: error.message })
})
})
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
0a473a5
...
...
@@ -8,7 +8,7 @@ import { ErrorToastUtils, SPHelper } from 'wdKit'
import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage';
import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params'
import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel'
@Extend(Row)
function otherStyle() {
.backgroundImageSize(ImageSize.Cover)
...
...
@@ -306,6 +306,10 @@ struct LoginPage {
if (this.checkCodePage) {
this.loginViewModel.appLogin(this.phoneContent, 2, this.codeContent).then((data) => {
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
router.back({
params: { userName: data.userName,
userId:data.id},
...
...
@@ -319,6 +323,11 @@ struct LoginPage {
this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
promptAction.showToast({ message: '登录成功' })
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
router.back({
params: { userName: data.userName,
userId:data.id},
...
...
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchInterestsHobbiesPage.ets
View file @
0a473a5
import {InterestsHobbiesModel, InterestsList} from '../viewModel/InterestsHobbiesModel'
import { WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
import { SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
@Entry
@Component
...
...
@@ -121,6 +123,7 @@ struct LaunchInterestsHobbiesPage {
.width('662lpx')
.height('84lpx')
.onClick(()=>{
this.saveTagIds()
//跳转首页
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
})
...
...
@@ -149,4 +152,15 @@ struct LaunchInterestsHobbiesPage {
})
}
saveTagIds(){
let tags: string = ''
if (this.interestsArray.filter(item => item.choose).length > 0) {
let array = this.interestsArray.filter(item => item.choose)
for (let index = 0; index < array.length; index++) {
const element = array[index];
tags = tags.length === 0 ? element.id.toString() : tags + ',' + element.id.toString()
}
}
SPHelper.default.saveSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS,tags)
}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel.ets
View file @
0a473a5
...
...
@@ -3,6 +3,7 @@ import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { Logger, SPHelper } from 'wdKit/Index';
import data from '@ohos.telephony.data';
import { SpConstants } from 'wdConstant/Index';
export interface InterestsBean {
...
...
@@ -60,9 +61,23 @@ export class InterestsHobbiesModel {
fail(error.message)
})
})
}
updateInterests(){
let tags = SPHelper.default.getSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS,'') as string
if (tags.length === 0) return
let bean: Record<string, string> = {};
bean['tagIds'] = tags
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<ResponseDTO>((success, fail) => {
HttpRequest.post<ResponseDTO>(HttpUrlUtils.getUpdateInterestsUrl(),bean,headers).then((data: ResponseDTO) => {
if (data.code == 0) {
Logger.info('InterestsHobbiesModel','updateInterests','更新兴趣成功')
SPHelper.default.deleteSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS)
}
}, (error: Error) => {
fail(error.message)
})
})
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment