怎么在国税网站上做实名认证成都seo推广员

web/2025/9/29 21:19:28/文章来源:
怎么在国税网站上做实名认证,成都seo推广员,如何建设彩票私人网站,网站不公开简历做家教文章目录 一、数据持久化1、用户首选项#xff08;1#xff09;语法说明#xff08;2#xff09;完整代码示例 2、关系型数据库#xff08;1#xff09;初始化数据库#xff08;2#xff09;增删改数据#xff08;3#xff09;查询数据#xff08;4#xff09;完整… 文章目录 一、数据持久化1、用户首选项1语法说明2完整代码示例 2、关系型数据库1初始化数据库2增删改数据3查询数据4完整代码示例 二、通知1、基础通知1基础使用2通知内容类型3完整代码示例 2、进度条通知1基础使用3完整代码示例 3、通知意图1基础使用2完整代码示例 一、数据持久化 1、用户首选项 1语法说明 为应用提供Key-Value键值型的数据处理能力支持应用持久化轻量级数据并对其修改和查询。Key键为string类型要求非空且长度不超过80个字节。如果Value值为string类型可以为空不为空时长度不超过8192个字节。建议存储的数据不超过一万条。导入用户首选项模块 import dataPreferences from ohos.data.preferences;要获取Preferences实例读取指定文件 dataPreferences.getPreferences(this.context, mystore, (err, preferences) {if (err) {console.error(Failed to get preferences. Code:${err.code},message:${err.message});return;}console.info(Succeeded in getting preferences.);// 进行相关数据操作})数据操作写入数据如果已经存在则会覆盖可利用.has() 判断是否存在 preferences.put(startup, auto, (err) {if (err) {console.error(Failed to put data. Code:${err.code}, message:${err.message});return;}console.info(Succeeded in putting data.);})读取数据如果值为null或者非默认值类型则返回默认数据。 preferences.get(startup, default, (err, val) {if (err) {console.error(Failed to get value of startup. Code:${err.code}, message:${err.message});return;}console.info(Succeeded in getting value of startup. val: ${val}.);})删除数据 preferences.delete(startup, (err) {if (err) {console.error(Failed to delete the key startup. Code:${err.code}, message:${err.message});return;}console.info(Succeeded in deleting the key startup.);})数据持久化应用存入数据到Preferences实例后可以使用flush()方法实现数据持久化 preferences.flush((err) {if (err) {console.error(Failed to flush. Code:${err.code}, message:${err.message});return;}console.info(Succeeded in flushing.);})2完整代码示例 ets/common/util/PreferencesUtil.ts加载实例、写入、获取、删除方法 import preferences from ohos.data.preferences;class PreferencesUtil{prefMap: Mapstring, preferences.Preferences new Map()async loadPreference(context, name: string){try { // 加载preferenceslet pref await preferences.getPreferences(context, name)this.prefMap.set(name, pref)console.log(testTag, 加载Preferences[${name}]成功)} catch (e) {console.log(testTag, 加载Preferences[${name}]失败, JSON.stringify(e))}}async putPreferenceValue(name: string, key: string, value: preferences.ValueType){if (!this.prefMap.has(name)) {console.log(testTag, Preferences[${name}]尚未初始化)return}try {let pref this.prefMap.get(name)// 写入数据await pref.put(key, value)// 刷盘await pref.flush()console.log(testTag, 保存Preferences[${name}.${key} ${value}]成功)} catch (e) {console.log(testTag, 保存Preferences[${name}.${key} ${value}]失败, JSON.stringify(e))}}async getPreferenceValue(name: string, key: string, defaultValue: preferences.ValueType){if (!this.prefMap.has(name)) {console.log(testTag, Preferences[${name}]尚未初始化)return}try {let pref this.prefMap.get(name)// 读数据let value await pref.get(key, defaultValue)console.log(testTag, 读取Preferences[${name}.${key} ${value}]成功)return value} catch (e) {console.log(testTag, 读取Preferences[${name}.${key} ]失败, JSON.stringify(e))}} }const preferencesUtil new PreferencesUtil()export default preferencesUtil as PreferencesUtilets/entryability/EntryAbility.ets应用启动时调用加载实例方法 import UIAbility from ohos.app.ability.UIAbility; import PreferencesUtil from ../common/util/PreferencesUtilexport default class EntryAbility extends UIAbility {async onCreate(want, launchParam) {hilog.info(0x0000, testTag, %{public}s, Ability onCreate running);// 加载Preferencesawait PreferencesUtil.loadPreference(this.context, MyPreferences)} } ets/pages/Index.ets页面出现前aboutToAppear()获取实例并赋值 import IndexFontSizePanel from ../views/IndexFontSizePanel import PreferencesUtil from ../common/util/PreferencesUtilEntry Component struct Index {State message: string 页面列表State showPanel: boolean falseProvide fontSize: number 16async aboutToAppear(){this.fontSize await PreferencesUtil.getPreferenceValue(MyPreferences, IndexFontSize, 16) as number}build() {Column() {// 字体修改面板if(this.showPanel){IndexFontSizePanel().transition({translate: { y: 115 }})}}.width(100%).height(100%)}}views/IndexFontSizePanel.etsonChange 方法中修改实例值 import PreferencesUtil from ../common/util/PreferencesUtilComponent export default struct IndexFontSizePanel {Consume fontSize: numberfontSizLabel: object {14: 小,16: 标准,18: 大,20: 特大,}build() {Column() {Text(this.fontSizLabel[this.fontSize]).fontSize(20)Row({ space: 5 }) {Text(A).fontSize(14).fontWeight(FontWeight.Bold)Slider({min: 14,max: 20,step: 2,value: this.fontSize}).showSteps(true).trackThickness(6).layoutWeight(1).onChange(val {// 修改字体大小this.fontSize val// 写入PreferencesPreferencesUtil.putPreferenceValue(MyPreferences, IndexFontSize, val)})Text(A).fontSize(20).fontWeight(FontWeight.Bold)}.width(100%)}.width(100%).padding(15).backgroundColor(#fff1f0f0).borderRadius(20)} }2、关系型数据库 1初始化数据库 a、导入关系型数据库模块 import relationalStore from ohos.data.relationalStore;b、初始化数据库表rdb配置 const STORE_CONFIG {name: RdbTest.db, // 数据库文件名securityLevel: relationalStore.SecurityLevel.S1 // 数据库安全级别 };初始化表的SQL // 建表Sql语句 const SQL_CREATE_TABLE CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB);获取rdb,执行SQL,后续的所有增删改查都是使用rdbStore对象 relationalStore.getRdbStore(this.context, STORE_CONFIG, (err, store) {if (err) {console.error(Failed to get RdbStore. Code:${err.code}, message:${err.message});return;}console.info(Succeeded in getting RdbStore.);store.executeSql(SQL_CREATE_TABLE); // 创建数据表// 这里执行数据库的增、删、改、查等操作});2增删改数据 a.新增数据 const valueBucket {NAME: Lisa,AGE: 18,SALARY: 100.5,CODES: new Uint8Array([1, 2, 3, 4, 5]) }; //EMPLOYEE 数据表名 store.insert(EMPLOYEE, valueBucket, (err, rowId) {if (err) {console.error(Failed to insert data. Code:${err.code}, message:${err.message});return;}console.info(Succeeded in inserting data. rowId:${rowId}); })b.修改数据 const valueBucket {NAME: Rose,AGE: 22, }; // 创建表EMPLOYEE的predicates let predicates new relationalStore.RdbPredicates(EMPLOYEE); // 匹配表EMPLOYEE中NAME为Lisa的字段 predicates.equalTo(NAME, Lisa); store.update(valueBucket, predicates, (err, rows) {if (err) {console.error(Failed to update data. Code:${err.code}, message:${err.message});return;}console.info(Succeeded in updating data. row count: ${rows}); }) c.删除数据 let predicates new relationalStore.RdbPredicates(EMPLOYEE); predicates.equalTo(NAME, Lisa); store.delete(predicates, (err, rows) {if (err) {console.error(Failed to delete data. Code:${err.code}, message:${err.message});return;}console.info(Delete rows: ${rows}); })3查询数据 a.查询数据、返回一个ResultSet结果集 let predicates new relationalStore.RdbPredicates(EMPLOYEE); predicates.equalTo(NAME, Rose); let result await store.query(predicates, [ID, NAME, AGE, SALARY, CODES])b.解析结果 // 准备数组保存结果 let tasks:any[][] //循环遍历结果集判断结果是否遍历到最后一行 while(!result.isAtLastRow){//指针移动到下一行数据result.goToNextRow()//根据字段名获取字段index从而获取字段值let id result.getLong(result.getColumnIndex(ID));let name result.getString(result.getColumnIndex(NAME));tasks.push({id,name}) }4完整代码示例 ets/model/TaskModel.ets import relationalStore from ohos.data.relationalStore; import TaskInfo from ../viewmodel/TaskInfo;class TaskModel {private rdbStore: relationalStore.RdbStoreprivate tableName: string TASK/*** 初始化任务表*/initTaskDB(context){// 1.rdb配置const config {name: MyApplication.db,securityLevel: relationalStore.SecurityLevel.S1}// 2.初始化SQL语句const sql CREATE TABLE IF NOT EXISTS TASK (ID INTEGER PRIMARY KEY AUTOINCREMENT,NAME TEXT NOT NULL,FINISHED bit)// 3.获取rdbrelationalStore.getRdbStore(context, config, (err, rdbStore) {if(err){console.log(testTag, 获取rdbStore失败)return}// 执行SqlrdbStore.executeSql(sql)console.log(testTag, 创建task表成功)// 保存rdbStorethis.rdbStore rdbStore})}/*** 查询任务列表*/async getTaskList(){// 1.构建查询条件let predicates new relationalStore.RdbPredicates(this.tableName)// 2.查询let result await this.rdbStore.query(predicates, [ID, NAME, FINISHED])// 3.解析查询结果// 3.1.定义一个数组组装最终的查询结果let tasks: TaskInfo[] []// 3.2.遍历封装while(!result.isAtLastRow){// 3.3.指针移动到下一行result.goToNextRow()// 3.4.获取数据let id result.getLong(result.getColumnIndex(ID))let name result.getString(result.getColumnIndex(NAME))let finished result.getLong(result.getColumnIndex(FINISHED))// 3.5.封装到数组tasks.push({id, name, finished: !!finished})}console.log(testTag, 查询到数据, JSON.stringify(tasks))return tasks}/*** 添加一个新的任务* param name 任务名称* returns 任务id*/addTask(name: string): Promisenumber{return this.rdbStore.insert(this.tableName, {name, finished: false})}/*** 根据id更新任务状态* param id 任务id* param finished 任务是否完成*/updateTaskStatus(id: number, finished: boolean) {// 1.要更新的数据let data {finished}// 2.更新的条件let predicates new relationalStore.RdbPredicates(this.tableName)predicates.equalTo(ID, id)// 3.更新操作return this.rdbStore.update(data, predicates)}/*** 根据id删除任务* param id 任务id*/deleteTaskById(id: number){// 1.删除的条件let predicates new relationalStore.RdbPredicates(this.tableName)predicates.equalTo(ID, id)// 2.删除操作return this.rdbStore.delete(predicates)} }let taskModel new TaskModel();export default taskModel as TaskModel; ets/entryability/EntryAbility.ets应用启动时调用初始化 import UIAbility from ohos.app.ability.UIAbility; import hilog from ohos.hilog; import window from ohos.window; import TaskModel from ../model/TaskModel;export default class EntryAbility extends UIAbility {async onCreate(want, launchParam) {// 初始化任务表TaskModel.initTaskDB(this.context)} } 页面调用方法查询、添加数据 import TaskModel from ../../model/TaskModel// 总任务数量Link totalTask: numberLink finishTask: number// 任务数组State tasks: TaskInfo[] []aboutToAppear(){// 查询任务列表console.log(testTag, 初始化组件查询任务列表)TaskModel.getTaskList().then(tasks {this.tasks tasks// 更新任务状态this.handleTaskChange()})}handleTaskChange(){// 1.更新任务总数量this.totalTask this.tasks.length// 2.更新已完成任务数量this.finishTask this.tasks.filter(item item.finished).length} handleAddTask(name: string){// 1.新增任务TaskModel.addTask(name).then(id {console.log(testTag, 处理新增任务: , name)// 回显到数组页面this.tasks.push(new TaskInfo(id, name))// 2.更新任务完成状态this.handleTaskChange()// 3.关闭对话框this.dialogController.close()}).catch(error console.log(testTag, 新增任务失败, name, JSON.stringify(error)))} Builder DeleteButton(index: number, id: number){Button(){Image($r(app.media.ic_public_delete_filled)).fillColor(Color.White).width(20)}.width(40).height(40).type(ButtonType.Circle).backgroundColor(Color.Red).margin(5).onClick(() {// 删除任务TaskModel.deleteTaskById(id).then(() {this.tasks.splice(index, 1)console.log(testTag, 尝试删除任务index: ${index})this.handleTaskChange()}).catch(error console.log(testTag, 删除任务失败id , id, JSON.stringify(error)))})}二、通知 1、基础通知 应用可以通过通知接口发送通知消息提醒用户关注应用中变化。用户可以在通知栏查看和操作通知内容 1基础使用 导入notification模块 import notificationManager from ohos.notificationManager;构建通知请求 let request: notificationManager.NotificationRequest {id: 1, content: {// 通知内容...}},showDeliveryTime: true, // 是否显示分发时间deliveryTime: new Date().getTime(), // 通知发送时间groupName: wechat, // 组通知名称slotType: notify.SlotType.SOCIAL_COMMUNICATION // 通道类型... //其它属性查看相关文档 }发布通知 notificationManager.publish(request, (err) {if (err) {console.error(Failed to publish notification. Code is ${err.code}, message is ${err.message});return;}console.info(Succeeded in publishing notification.); }); 取消通知 // 取消 id10 的通知 notificationManager.cancel(10) // 取消当前应用所有通知 notificationManager.cancelAll()2通知内容类型 普通文本类型 let notificationRequest {id: 1,content: {contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // 普通文本类型通知normal: {title: 通知标题,text: 通知内容详情,additionalText: 通知附加内容,}} }长文本类型 let notificationRequest {id: 1,content: {contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, // 长文本类型通知longText: {title: 通知标题,text: 通知内容详情,additionalText: 通知附加内容,longText: 通知中的长文本、很长很长。。。,briefText: 通知概要总结,expandedTitle: 通知展开时的标题,}} }多行文本类型 let notificationRequest {id: 1,content: {contentType: NotificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, // 多行文本类型通知multiLine: {title: 通知标题,text: 通知内容详情,additionalText: 通知附加内容,briefText: 通知概要总结,longTitle: 展开时的标题有多行我很宽,lines: [第一行, 第二行, 第三行, 第四行],}} } 图片类型 // 需要获取图片PixelMap信息 let imagePixelMap: PixelMap undefined; let notificationRequest: notificationManager.NotificationRequest {id: 1,content: {contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE,picture: {title: 通知标题,text: 通知内容详情,additionalText: 通知附加内容,briefText: 通知概要总结,expandedTitle: 通知展开时的标题,picture: imagePixelMap}} }; 获取图片PixelMap信息 async aboutToAppear() {// 获取资源管理器let rm getContext(this).resourceManager;// 读取图片let file await rm.getMediaContent($r(app.media.watchGT4))// 创建PixelMapimage.createImageSource(file.buffer).createPixelMap().then(value this.pixel value).catch(reason console.log(testTag, 加载图片异常, JSON.stringify(reason))) }3完整代码示例 import notify from ohos.notificationManager import image from ohos.multimedia.imageEntry Component struct NotificationPage {// 全局任务ididx: number 100// 图象pixel: PixelMapasync aboutToAppear() {// 获取资源管理器let rm getContext(this).resourceManager;// 读取图片let file await rm.getMediaContent($r(app.media.watchGT4))// 创建PixelMapimage.createImageSource(file.buffer).createPixelMap().then(value this.pixel value).catch(reason console.log(testTag, 加载图片异常, JSON.stringify(reason)))}build() {Column({space: 20}) {Button(发送normalText通知).onClick(() this.publishNormalTextNotification())Button(发送longText通知).onClick(() this.publishLongTextNotification())Button(发送multiLine通知).onClick(() this.publishMultiLineNotification())Button(发送Picture通知).onClick(() this.publishPictureNotification())}.width(100%).height(100%).padding(5).backgroundColor(#f1f2f3)}//通知普通文本publishNormalTextNotification() {let request: notify.NotificationRequest {id: this.idx,content: {contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,normal: {title: 通知标题 this.idx,text: 通知内容详情,additionalText: 通知附加内容}},showDeliveryTime: true,deliveryTime: new Date().getTime(),groupName: wechat,slotType: notify.SlotType.SOCIAL_COMMUNICATION}this.publish(request)}//通知长文本publishLongTextNotification() {let request: notify.NotificationRequest {id: this.idx,content: {contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,longText: {title: 通知标题 this.idx,text: 通知内容详情,additionalText: 通知附加内容,longText: 通知中的长文本我很长我很长我很长我很长我很长我很长我很长,briefText: 通知概要和总结,expandedTitle: 通知展开时的标题 this.idx}}}this.publish(request)}//通知多行文本publishMultiLineNotification() {let request: notify.NotificationRequest {id: this.idx,content: {contentType: notify.ContentType.NOTIFICATION_CONTENT_MULTILINE,multiLine: {title: 通知标题 this.idx,text: 通知内容详情,additionalText: 通知附加内容,briefText: 通知概要和总结,longTitle: 展开时的标题我很宽我很宽我很宽,lines: [第一行,第二行,第三行,第四行,]}}}this.publish(request)}//通知图片类型publishPictureNotification() {let request: notify.NotificationRequest {id: this.idx,content: {contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,picture: {title: 通知标题 this.idx,text: 通知内容详情,additionalText: 通知附加内容,briefText: 通知概要和总结,expandedTitle: 展开后标题 this.idx,picture: this.pixel}}}this.publish(request)}// 发送文本private publish(request: notify.NotificationRequest) {notify.publish(request).then(() console.log(notify test, 发送通知成功)).then(reason console.log(notify test, 发送通知失败, JSON.stringify(reason)))} }2、进度条通知 进度条通知会展示一个动态的进度条主要用于文件下载、长任务处理的进度显示。 1基础使用 判断当前系统是否支持进度条模板 NotificationManager.isSupportTemplate(downloadTemplate).then((data) {console.info([ANS] isSupportTemplate success);let isSupportTpl: boolean data; // isSupportTpl的值为true表示支持支持downloadTemplate模板类通知false表示不支持// ... }).catch((err) {console.error([ANS] isSupportTemplate failed, error[${err}]); });通知模板模板名称必须是 downloadTemplate let template {name:downloadTemplate,data: {title: 标题,fileName: music.mp4, // 文件名progressValue: 30, //进度条当前值progressMaxValue:100, // 进度条最大值} }通知请求 let notificationRquest {id: 1,slotType: notify.SlotType.OTHER_TYPES,template: template, //进度条模板content: {contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,normal: {title: template.data.title template.data.fileName,text: sendTemplate,additionalText: 30%}},deliveryTime: new Date().getTime(),showDeliveryTime: true }发送通知与基础通知相同 3完整代码示例 import notify from ohos.notificationManager import promptAction from ohos.promptActionenum DownloadState {NOT_BEGIN 未开始,DOWNLOADING 下载中,PAUSE 已暂停,FINISHED 已完成, }Component export default struct DownloadCard {// 下载进度State progressValue: number 0progressMaxValue: number 100// 任务状态State state: DownloadState DownloadState.NOT_BEGIN// 下载的文件名filename: string 圣诞星.mp4// 模拟下载的任务的idtaskId: number -1// 通知idnotificationId: number 999isSupport: boolean falseasync aboutToAppear(){// 1.判断当前系统是否支持进度条模板this.isSupport await notify.isSupportTemplate(downloadTemplate)}build() {Row({ space: 10 }) {Image($r(app.media.ic_files_video)).width(50)Column({ space: 5 }) {Row() {Text(this.filename)Text(${this.progressValue}%).fontColor(#c1c2c1)}.width(100%).justifyContent(FlexAlign.SpaceBetween)Progress({value: this.progressValue,total: this.progressMaxValue,})Row({ space: 5 }) {Text(${(this.progressValue * 0.43).toFixed(2)}MB).fontSize(14).fontColor(#c1c2c1)Blank()if (this.state DownloadState.NOT_BEGIN) {Button(开始).downloadButton().onClick(() this.download())} else if (this.state DownloadState.DOWNLOADING) {Button(取消).downloadButton().backgroundColor(#d1d2d3).onClick(() this.cancel())Button(暂停).downloadButton().onClick(() this.pause())} else if (this.state DownloadState.PAUSE) {Button(取消).downloadButton().backgroundColor(#d1d2d3).onClick(() this.cancel())Button(继续).downloadButton().onClick(() this.download())} else {Button(打开).downloadButton().onClick(() this.open())}}.width(100%)}.layoutWeight(1)}.width(100%).borderRadius(20).padding(15).backgroundColor(Color.White)}cancel() {// 取消定时任务if(this.taskId 0){clearInterval(this.taskId);this.taskId -1}// 清理下载任务进度this.progressValue 0// 标记任务状态未开始this.state DownloadState.NOT_BEGIN// 取消通知notify.cancel(this.notificationId)}download() {// 清理旧任务if(this.taskId 0){clearInterval(this.taskId);}// 开启定时任务模拟下载this.taskId setInterval(() {// 判断任务进度是否达到100if(this.progressValue 100){// 任务完成了应该取消定时任务clearInterval(this.taskId)this.taskId -1// 并且标记任务状态为已完成this.state DownloadState.FINISHED// 发送通知this.publishDownloadNotification()return}// 模拟任务进度变更this.progressValue 2// 发送通知this.publishDownloadNotification()}, 500)// 标记任务状态下载中this.state DownloadState.DOWNLOADING}pause() {// 取消定时任务if(this.taskId 0){clearInterval(this.taskId);this.taskId -1}// 标记任务状态已暂停this.state DownloadState.PAUSE// 发送通知this.publishDownloadNotification()}open() {promptAction.showToast({message: 功能未实现})}publishDownloadNotification(){// 1.判断当前系统是否支持进度条模板if(!this.isSupport){// 当前系统不支持进度条模板return}// 2.准备进度条模板的参数let template {name: downloadTemplate,data: {progressValue: this.progressValue,progressMaxValue: this.progressMaxValue}}let request: notify.NotificationRequest {id: this.notificationId,template: template,content: {contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,normal: {title: this.filename : this.state,text: ,additionalText: this.progressValue %}}}// 3.发送通知notify.publish(request).then(() console.log(test, 通知发送成功)).catch(reason console.log(test, 通知发送失败, JSON.stringify(reason)))} }Extend(Button) function downloadButton() {.width(75).height(28).fontSize(14) }3、通知意图 我们可以给通知或其中的按钮设置的行为意图Want从而实现拉起应用组件或发布公共事件等能力。 1基础使用 导入模块 import NotificationManager from ohos.notificationManager; import wantAgent from ohos.app.ability.wantAgent;意图行为信息 let wantAgentInfo {wants: [{deviceId: ,bundleName: com.example.test,abilityName: com.example.test.MainAbility,action: ,entities: [],uri: ,parameters: {}}],operationType: wantAgent.OperationType.START_ABILITY,requestCode: 0,wantAgentFlags:[wantAgent.WantAgentFlags.CONSTANT_FLAG] }创建wantAgent实例 // 用于保存创建成功的WantAgent对象后续使用其完成触发的动作。 let wantAgentObj null;wantAgent.getWantAgent(wantAgentInfo, (err, data) {if (err) {console.error([WantAgent]getWantAgent err JSON.stringify(err));} else {console.info([WantAgent]getWantAgent success);wantAgentObj data;} });通知请求 let notificationRequest {content: {// ....},id: 1,label: TEST,wantAgent: wantAgentObj, }2完整代码示例 import wantAgent, { WantAgent } from ohos.app.ability.wantAgent import promptAction from ohos.promptActionComponent export default struct DownloadCard {// 存放wantAgent实例wantAgentInstance: WantAgentasync aboutToAppear(){// 1.判断当前系统是否支持进度条模板this.isSupport await notify.isSupportTemplate(downloadTemplate)// 2.创建拉取当前应用的行为意图// 2.1.创建wantInfo信息let wantInfo: wantAgent.WantAgentInfo {wants: [{bundleName: com.example.myapplication,abilityName: EntryAbility,}],requestCode: 0,operationType: wantAgent.OperationType.START_ABILITY,wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG]}// 2.2.创建wantAgent实例this.wantAgentInstance await wantAgent.getWantAgent(wantInfo)}build() {···· // 同进度条通知代码示例}open() {promptAction.showToast({message: 功能未实现})}publishDownloadNotification(){// 1.判断当前系统是否支持进度条模板if(!this.isSupport){// 当前系统不支持进度条模板return}// 2.准备进度条模板的参数let template {name: downloadTemplate,data: {progressValue: this.progressValue,progressMaxValue: this.progressMaxValue}}let request: notify.NotificationRequest {id: this.notificationId,template: template,// 通知意图wantAgent: this.wantAgentInstance,content: {contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,normal: {title: this.filename : this.state,text: ,additionalText: this.progressValue %}}}// 3.发送通知notify.publish(request).then(() console.log(test, 通知发送成功)).catch(reason console.log(test, 通知发送失败, JSON.stringify(reason)))} }Extend(Button) function downloadButton() {.width(75).height(28).fontSize(14) }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/84096.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

网站空间单位建设网站需要准备什么

MR混合现实情景实训教学系统在消防安全模拟上的教学应用,将为消防安全教育带来一场革命性的改变。该系统能通过混合现实技术将真实环境与虚拟环境结合,让学生亲身体验到真实的火灾现场,并在模拟环境中进行实践操作,提高消防安全意…

asp商品网站源码海外广告推广公司

最大化: 限制条件: (1) (2) 如何求解这个对偶问题,同时基于对偶问题给出支持向量机算法的统一流程。 (核函数) 只要知道核函数,就可以求个这个最优化的对偶问题。 求解了这个对偶…

vps 网站攻击ip地址湖北标书设计制作

QWidget类 简介 QWidget是Qt中所有用户界面元素的基类。它提供了窗口的基本功能,并允许用户自定义窗口的外观和行为。QWidget可以包含其他QWidget子类的子窗口,从而实现复杂的用户界面。 特性 提供了窗口的基本功能,包括绘制、事件处理、…

网站后台密码忘记了大连建行网点查询

大家好,我是苏貝,本篇博客带大家了解Linux进程(9)进程控制1,如果你觉得我写的还不错的话,可以给我一个赞👍吗,感谢❤️ 目录 (A)什么是进程程序替换&#xf…

sem可以为网站建设做什么秦皇岛房产信息网官网

前言 前言:在实际使用中,经常要参考官方的案例,但有时候因为工具的不一样,比如idea 和 eclipse,普通项目和spring项目等的差别;还有时候因为水平有限,难以在散布于官方的各个文档读懂&#xff…

对加强政务门户网站建设的意见国外教程 网站

2、解压到某一文件夹,如“C:\Program Files\MySQL\mysql-5.7.20-winx64”3、添加环境变量(系统变量):变量名:MYSQL_HOME变量值:C:\Program Files\MySQL\mysql-5.7.20-winx64;在系统变量path原有值后添加路径&#xff1…

备案通过网站还是打不开怎么用网站做转换服务器

基本的算法实践在上一篇博文,这篇博文向大家详细展示一下数据结构的高级应用,可能有些难,但这是重点,实用性很强,而且用的好往往事半功倍,想获得力量吗,开整: 我把他们分为这几块&a…

上海网站建设公司介绍wordpress th7

上一篇笔记中学习了ADC驱动,STM32MP157 也有DAC外设,DAC也使用的IIO驱动框架。本章就来学习一下如下在Linux下使用STM32MP157上的DAC。 DAC简介 ADC是模数转换器,负责将外界的模拟信号转换为数字信号。DAC刚好相反,是数模转换器…

建设京东类的网站需要什么流程图涂料网站模版

蓝牙篇之蓝牙核心规范(V5.4)深入详解汇总 1.概述 SMP是安全管理器协议,用于蓝牙低功耗系统的安全管理。SMP协议定义了配对和Key的分发过程的实现,以及用于实现这些方法的协议和工具。SMP的内容主要是配对和Key的分发,然后用Key对链路或数据进行加密 。 安全管理器协议(…

桂林建站平台哪家好网站后台数据分析怎么做

这一直以来是我写代码的一个痛点,C#11终于解决了,那就是我想把一个整齐的格式的json字符串转出,但不能如愿,要不用一个三方库来搞定,要不就加各种双引号,如果有变量还得小心处理{},因为在C#stri…

网站域名根目录海西州住房建设局网站

JSON: JavaScript Object Notation(JavaScript 对象表示法) JSON 是存储和交换文本信息的语法。类似 XML。 JSON 比 XML 更小、更快,更易解析。 JSON是一种轻量级的数据交换格式。 它基于(欧洲计算机协会制定的js规范)的一个子集,采用完全独立于编程语言…

国外的服务器网站长丰住房和建设局网站

一、为什么要整合 1&#xff0c;管理SessionFactory实例&#xff08;只需要一个&#xff09; 2&#xff0c;声明式事务管理 spirng的作用 IOC 管理对象.. AOP 事务管理.. 二、整合步骤 1.整合sessionFactory 在applicationContext.xml添加 1 <!-- 导入外部的properties文件 …

阳江做网站多少钱w网站制作和推广

导读:作为文化产业的一部分,动漫影响了我国一代又一代青少年,据钱江晚报调查显示,有超过七成的95后愿意从事与动漫相关的行业,可见其对青少年影响力之大。 动漫论坛作为最先开始热爱动漫人士进行交流的方式之一,是爱好者们共享信息,寻找同伴的重要渠道之一。在这次毕业设…

网站开发的心得与体会塘厦最新消息

笔者前几日在做数据库迁移的时候&#xff0c;发现了一个挺有意思的小东西&#xff1a;数据库访问限制(Host Match limit),简单地翻阅了下给官方资料&#xff0c;发现这个东西应用场景其实非常广泛&#xff0c;只是我们采用了其他可能没有原生数据库带的Access Limit 功能好地方…

零代码建站平台国内什么网站用asp.net

文章目录数列solutioncode秘密通道solutioncode小X游世界树solutioncode划分solutioncode数列 a[1]a[2]a[3]1 a[x]a[x-3]a[x-1] (x>3) 求 a 数列的第 n 项对 1000000007&#xff08;10^97&#xff09;取余的值。 输入格式 第一行一个整数 T&#xff0c;表示询问个数。 以下…

做科研找论文的网站软件项目管理心得

数据库系统 课程实验3数据库设计 计科210X 甘晴void 202108010XXX 目录 文章目录 数据库系统 课程实验3<br>数据库设计实验目的实验内容实验重难点实验环境实验过程&#xff08;0&#xff09;数据库需求描述&#xff08;1&#xff09;数据库概念结构设计E-R图实体图书馆…

国外学做咖啡的网站优秀商业空间设计案例分析

第九章 类加载及执行子系统的案例与实战 Q&#xff1a;如果有10个WEB应用程序都是用Spring来进行组织管理的话&#xff0c;可以把Spring放到Common或Shared目录下&#xff08;Tomcat5.0&#xff09;让这些程序共享。Spring要对用户程序的类进行管理&#xff0c;自然要能访问到用…

c2c网站购物体验情况登记表什么软件推广比较好

个人感觉看这一个就够了&#xff01;&#xff01;&#xff01; 优化│TSP中两种不同消除子环路的方法及callback实现&#xff08;Python调用Gurobi求解&#xff09; 刘兴禄运筹学修炼日记&#xff1a;TSP中两种不同消除子环路的方法及callback实现&#xff08;Python调用Guro…

校园网站建设的重要性信誉好的苏州网站建设

1、Django中写一个后端接口&#xff0c;给HTML提供dicom文件接口的方式 1、首先创建django项目 1、下载安装跨域的包 pip3 install django-cors-headers2、使用pycharm创建一个Django项目 3、点击创建在另一个窗口&#xff0c;这个都无所谓&#xff0c;怎么都行&#xff0c;…

网站源代码制作云南省建设厅网站首页

随着互联网的全面普及&#xff0c;基于互联网的电子商务也应运而生&#xff0c;并在近年来获得了巨大的发展&#xff0c;成为一种全新的商务模式&#xff0c;被许多经济专家认为是新的经济增长点。 作为一种全新的商务模式&#xff0c;它有很大的发展前途&#xff0c;同时&…