defaultError.js 2.6 KB
// pages/defaultError/defaultError.js
const errorList = {
	OFF: {
		text: '获取定位失败',
		tips: '',
		imgUrl: 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/ecuda/shop/shouquanweizhi.png',
		title: ''
	},
	0: {
		text: '授权位置信息',
		tips: '',
		imgUrl: 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/ecuda/shop/shouquanweizhi.png',
		title: ''
	},
	OVER_ACTIVITY_AREA: {
		text: '查看其它可领券',
		tips: '',
		imgUrl: 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/ecuda/shop/bufuhe.png',
		title: ''
	},
	ACTIVITY_EXPIRED: {
		text: '查看其它可领券',
		tips: '',
		imgUrl: 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/ecuda/shop/yijiesu.png',
		title: ''
	},
	ACTIVITY_NO_START: {
		text: '查看其它可领券',
		tips: '',
		imgUrl: 'https://hbrand.oss-cn-hangzhou.aliyuncs.com/ecuda/shop/weikaishi.png',
		title: ''
	}
}

const data = {
	activityId: 0
}

Page({

	/**
   * 页面的初始数据
   */
	data: {
		navH: 50,
		errorStatus: 0,
		result: {
			text: '',
			tips: '',
			imgUrl: '',
			title: ''
		}
	},

	/**
   * 生命周期函数--监听页面加载
   */
	onLoad: function (options) {
		console.log(options)
		const arr = options.errorMsg.split('|')
		errorList[options.errorId].title = arr[0]
		errorList[options.errorId].tips = arr[1]

		this.setData({
			result: errorList[options.errorId],
			navH: wx.getSystemInfoSync().statusBarHeight,
			errorStatus: options.errorId
		})

		if (options.activityId) {
			data.activityId = options.activityId
		}
	},

	/**
   * 生命周期函数--监听页面初次渲染完成
   */
	onReady: function () {

	},

	/**
   * 生命周期函数--监听页面显示
   */
	onShow: function () {
		if (this.data.errorStatus == 0) {
			wx.authorize({
				scope: 'scope.userFuzzyLocation',
				success() {
					wx.getFuzzyLocation({
						type: 'gcj02',
						success: function (res) {
							wx.navigateBack({})
						},
						fail: function (res) {

						},
						complete: function (res) { }
					})
				},
				fail() {}
			})
		}
	},

	/**
   * 生命周期函数--监听页面隐藏
   */
	onHide: function () {

	},

	/**
   * 生命周期函数--监听页面卸载
   */
	onUnload: function () {

	},

	/**
   * 页面相关事件处理函数--监听用户下拉动作
   */
	onPullDownRefresh: function () {

	},

	/**
   * 页面上拉触底事件的处理函数
   */
	onReachBottom: function () {

	},

	/**
   * 用户点击右上角分享
   */
	onShareAppMessage: function () {

	},

	tapBtnAuth() {
		wx.openSetting({})
	},

	tapBtn() {
		// wx.reLaunch({
		// 	url: '/pages/index/index'
		// })
		wx.reLaunch({
			url: '/custom-pages/custom-index/index'
		})
	},

	reback() {
		wx.navigateBack({})
	}
})