97 lines
2.3 KiB
JavaScript
97 lines
2.3 KiB
JavaScript
// template/xg-bottom/xg-bottom.js
|
|
const app = getApp()
|
|
const util = require('../../utils/util')
|
|
const common = require('../../utils/commonMethod')
|
|
|
|
Component({
|
|
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
type: String,
|
|
bezier: {
|
|
type: Object,
|
|
observer(res) {
|
|
if (res.x == undefined) return
|
|
this.setData({
|
|
// amount: this.data.amount + 1,
|
|
bezierX: res.x,
|
|
bezierY: res.y,
|
|
hideIcon: true,
|
|
}, () => {
|
|
setTimeout(() => {
|
|
this.setData({
|
|
jumpingState: true,
|
|
})
|
|
}, 10)
|
|
})
|
|
|
|
const pos = this.data.pos
|
|
setTimeout(() => {
|
|
this.setData({
|
|
bezierX: pos['x'],
|
|
bezierY: pos['y'],
|
|
})
|
|
}, 30)
|
|
|
|
setTimeout(() => {
|
|
this.setData({
|
|
hideIcon: false,
|
|
jumpingState: false,
|
|
})
|
|
}, 330)
|
|
}
|
|
},
|
|
amount: Number,
|
|
islogin: Boolean,
|
|
sid: String,
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
typeObj: {
|
|
index: "搜索项目",
|
|
school: "搜索本校项目"
|
|
},
|
|
jumpingState: false,
|
|
hideIcon: false,
|
|
bezierX: 0,
|
|
bezierY: 0,
|
|
pos: {
|
|
x: 321,
|
|
y: 750,
|
|
},
|
|
},
|
|
|
|
lifetimes: {
|
|
ready() {
|
|
const screen_data = app.globalData.screen_data
|
|
this.data.pos = {
|
|
x: util.rpxTopx(630),
|
|
y: screen_data.windowHeight - util.rpxTopx(110)
|
|
}
|
|
},
|
|
},
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
// 跳转搜索
|
|
goSearch() {
|
|
common.goPage(`/pages/search/search?type=xg&sid=${ this.data.sid }`)
|
|
},
|
|
|
|
goPage(e) {
|
|
if (!this.data.islogin) {
|
|
this.triggerEvent('openLoginBtnState')
|
|
return
|
|
}
|
|
const url = e.currentTarget.dataset.url
|
|
common.goPage(url)
|
|
},
|
|
}
|
|
}) |