|
@@ -1,49 +1,44 @@
|
|
|
|
|
|
|
|
|
const app = getApp()
|
|
|
-import { lookInit } from '../../component/look/look';
|
|
|
-import { myInit } from '../../component/mys/mys';
|
|
|
-import { searchInit } from '../../component/search/search';
|
|
|
-import httpRequestApi from '../../utils/APIRequest';
|
|
|
-import httputil from '../../utils/httputil';
|
|
|
+import { hotInit } from '../../component/hot/hot';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
Page({
|
|
|
data: {
|
|
|
tab:[
|
|
|
{
|
|
|
- name: '看',
|
|
|
- templates: 'look',
|
|
|
- img: '../../static/image/look1.png',
|
|
|
- selectimg: '../../static/image/look2.png'
|
|
|
+ name: '热门',
|
|
|
+ templates: 'hot',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '关注',
|
|
|
+ templates: 'follow',
|
|
|
},
|
|
|
{
|
|
|
- name: '搜',
|
|
|
- templates: 'search',
|
|
|
- img: '../../static/image/sou1.png',
|
|
|
- selectimg: '../../static/image/sou2.png'
|
|
|
- }, {
|
|
|
name: '我的',
|
|
|
- templates: 'mys',
|
|
|
- img: '../../static/image/my1.png',
|
|
|
- selectimg: '../../static/image/my2.png'
|
|
|
+ templates: 'my',
|
|
|
}
|
|
|
],
|
|
|
ind: 0,
|
|
|
- templates: 'look',
|
|
|
+ templates: 'hot',
|
|
|
jurisdictionFlag: true
|
|
|
},
|
|
|
|
|
|
switcher: function({currentTarget}) {
|
|
|
- let ind = currentTarget.dataset.ind;
|
|
|
- let templates = this.data.tab[ind].templates;
|
|
|
+ let index = currentTarget.dataset.index;
|
|
|
+ let templates = this.data.tab[index].templates;
|
|
|
|
|
|
this.setData({
|
|
|
- ind,
|
|
|
+ index,
|
|
|
templates
|
|
|
})
|
|
|
- if (ind == 1) {
|
|
|
+ if (index == 1) {
|
|
|
searchInit(this);
|
|
|
}
|
|
|
- if (ind == 2) {
|
|
|
+ if (index == 2) {
|
|
|
myInit(this);
|
|
|
}
|
|
|
},
|
|
@@ -53,17 +48,17 @@ Page({
|
|
|
},1000)
|
|
|
},
|
|
|
onLoad: function (options) {
|
|
|
- if(options.ind) {
|
|
|
- let ind = options.ind;
|
|
|
- let templates = this.data.tab[ind].templates;
|
|
|
+ if(options.index) {
|
|
|
+ let index = options.index;
|
|
|
+ let templates = this.data.tab[index].templates;
|
|
|
this.setData({
|
|
|
templates,
|
|
|
- ind,
|
|
|
+ index,
|
|
|
})
|
|
|
- if (ind == 1) {
|
|
|
+ if (index == 1) {
|
|
|
searchInit(this);
|
|
|
}
|
|
|
- if (ind == 2) {
|
|
|
+ if (index == 2) {
|
|
|
myInit(this);
|
|
|
}
|
|
|
}
|
|
@@ -71,17 +66,17 @@ Page({
|
|
|
},
|
|
|
|
|
|
init: function () {
|
|
|
- httputil.getOpenidSessionKey((res) => {
|
|
|
- console.log('微信的用户信息', res);
|
|
|
- this.setData({
|
|
|
- jurisdictionFlag: true
|
|
|
- })
|
|
|
- lookInit(this);
|
|
|
- },(error) => {
|
|
|
- console.log(error);
|
|
|
- this.setData({
|
|
|
- jurisdictionFlag: false
|
|
|
- })
|
|
|
- });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
})
|