12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- // pages/Components/city/city.js
- const city = require('../../../utils/city')
- const app = getApp()
- Component({
- attached: function() {
- // 在组件实例进入页面节点树时执行
- this.setData({
- hot: city.hotCity.hot,
- cityList:city.citys,
- city:wx.getStorageSync('wxLocalName').city
- })
- },
- /**
- * 组件的属性列表
- */
- properties: {
- },
- /**
- * 组件的初始数据
- */
- data: {
- src:"https://app.schoolwisdoms.com/static/wx/images/",
- hot:[],
- cityList:[],
- cityArr:["TOP","A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","W","X","Y","Z"],
- tipHide: 1,
- showTimeOut:null,
- tipText:"",
- city:''
- },
- /**
- * 组件的方法列表
- */
- methods: {
- changeTitle:function(e){
- var idName = e.target.dataset.id
- clearTimeout(this.data.showTimeOut)
- this.setData({
- tipHide: 0,
- tipText: idName
- })
- this.data.showTimeOut = setTimeout(() => {
- this.setData({
- tipHide: 1,
- })
- }, 800);
-
- if(idName != "TOP"){
- var me = this;
- var query = wx.createSelectorQuery().in(me);
- query.selectViewport().scrollOffset()
- query.select("#"+idName).boundingClientRect();
- query.exec(function (res) {
- var miss = res[0].scrollTop + res[1].top - 93;
- wx.pageScrollTo({
- scrollTop: miss,
- duration: 0
- });
- });
- } else{
- wx.pageScrollTo({
- scrollTop: 0,
- duration: 0
- });
- }
- },
- getCity:function(e){
- var json = wx.getStorageSync('wxLocalName')
- json.city = e.currentTarget.dataset.name + "市"
- wx.setStorageSync('wxLocalName', json)
- wx.navigateBack({
- delta: 0,
- })
- }
- },
-
- })
|