调整分包,完成隐私协议(样式待优化)
This commit is contained in:
		
							
								
								
									
										104
									
								
								childPackage/pages/agreements/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								childPackage/pages/agreements/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,104 @@ | ||||
| // pages/agreements/index.js | ||||
| import towxml from "towxml" | ||||
| import { alertInfo } from "../../../utils/index"; | ||||
| Page({ | ||||
|  | ||||
|   /** | ||||
|    * 页面的初始数据 | ||||
|    */ | ||||
|   data: { | ||||
|     url: "" | ||||
|   }, | ||||
|  | ||||
|   /** | ||||
|    * 生命周期函数--监听页面加载 | ||||
|    */ | ||||
|   onLoad(options) { | ||||
|     const { url } = options; | ||||
|     this.getText(url, this.setText) | ||||
|   }, | ||||
|   getText: (url, callback) => { | ||||
|     wx.request({ | ||||
|       url: url, | ||||
|       header: { | ||||
|         'content-type': 'application/x-www-form-urlencoded' | ||||
|       }, | ||||
|       success: (res) => { | ||||
|         if (typeof callback === 'function') { | ||||
|           callback(res); | ||||
|         }; | ||||
|       }, | ||||
|       fail: (err) => { | ||||
|         alertInfo(err) | ||||
|       } | ||||
|  | ||||
|     }); | ||||
|   }, | ||||
|   async setText(res) { | ||||
|       let obj = towxml(res.data,'markdown',{ | ||||
|         theme:'light', //主题 dark 黑色,light白色,不填默认是light | ||||
| //         base:"www.xxx.com", | ||||
|         events:{      //为元素绑定的事件方法 | ||||
|           tap:e => { | ||||
|             console.log('tap',e); | ||||
|           }, | ||||
|           change:e => { | ||||
|             console.log('todo',e); | ||||
|           } | ||||
|         } | ||||
|       }); | ||||
|       //更新解析数据 | ||||
|       this.setData({ | ||||
|         text:obj, | ||||
|       }); | ||||
|    | ||||
|   }, | ||||
|   /** | ||||
|    * 生命周期函数--监听页面初次渲染完成 | ||||
|    */ | ||||
|   onReady() { | ||||
|  | ||||
|   }, | ||||
|  | ||||
|   /** | ||||
|    * 生命周期函数--监听页面显示 | ||||
|    */ | ||||
|   onShow() { | ||||
|  | ||||
|   }, | ||||
|  | ||||
|   /** | ||||
|    * 生命周期函数--监听页面隐藏 | ||||
|    */ | ||||
|   onHide() { | ||||
|  | ||||
|   }, | ||||
|  | ||||
|   /** | ||||
|    * 生命周期函数--监听页面卸载 | ||||
|    */ | ||||
|   onUnload() { | ||||
|  | ||||
|   }, | ||||
|  | ||||
|   /** | ||||
|    * 页面相关事件处理函数--监听用户下拉动作 | ||||
|    */ | ||||
|   onPullDownRefresh() { | ||||
|  | ||||
|   }, | ||||
|  | ||||
|   /** | ||||
|    * 页面上拉触底事件的处理函数 | ||||
|    */ | ||||
|   onReachBottom() { | ||||
|  | ||||
|   }, | ||||
|  | ||||
|   /** | ||||
|    * 用户点击右上角分享 | ||||
|    */ | ||||
|   onShareAppMessage() { | ||||
|  | ||||
|   } | ||||
| }) | ||||
		Reference in New Issue
	
	Block a user