123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- const app = getApp();
- Page({
-
- data: {
- icon: { name: 'tag', isShow: true },
- cardCur: 0,
- swiperList: [{
- id: 0,
- type: 'image',
- url: 'https://cdn.pixabay.com/photo/2018/09/24/15/04/board-3700116__340.jpg'
- }, {
- id: 1,
- type: 'image',
- url: 'https://cdn.pixabay.com/photo/2015/09/02/12/26/desk-918425__340.jpg',
- }, {
- id: 2,
- type: 'image',
- url: 'https://cdn.pixabay.com/photo/2015/07/31/14/59/creative-869200__340.jpg'
- }, {
- id: 3,
- type: 'image',
- url: 'https://cdn.pixabay.com/photo/2019/03/12/20/27/kanban-4051777__340.jpg'
- }],
- jobList:[
- {
- tittle:"测试数据的标题",
- reward:"180/天",
- place:"西乡塘",
- settlement:1,
- isBagEating:1,
- encase:1,
- isTrafficSubsidy:1,
- royalty:1
- },
- {
- tittle: "测试数据的标题",
- reward: "90/天",
- place: "西乡塘",
- settlement: 1,
- isBagEating: 0,
- encase: 1,
- isTrafficSubsidy: 1,
- royalty: 0
- },
- {
- tittle: "测试数据的标题",
- reward: "50/天",
- place: "西乡塘",
- settlement: 1,
- isBagEating: 1,
- encase: 0,
- isTrafficSubsidy: 0,
- royalty: 1
- },
- {
- tittle: "测试数据的标题",
- reward: "80/天",
- place: "西乡塘",
- settlement: 3,
- isBagEating: 1,
- encase: 1,
- isTrafficSubsidy: 1,
- royalty: 1
- },
- {
- tittle: "测试数据的标题",
- reward: "80/天",
- place: "西乡塘",
- settlement: 2,
- isBagEating: 1,
- encase: 1,
- isTrafficSubsidy: 0,
- royalty: 1
- }
- ],
- page:1,
- page_size:6,
- isover:1,
- value:"123"
- },
-
- search: function (event) {
- try {
- var value = wx.getStorageSync('uid')
- if (!value) {
- wx.showToast({
- title: '请到个人中心登录',
- icon: 'none'
- })
- }
- if (value) {
- wx.navigateTo({
- url: 'search/search',
- })
- }
- } catch (e) {
- console.log(e)
- }
- },
-
- job: function (e){
- try {
- var value = wx.getStorageSync('uid')
- if (!value) {
- wx.showToast({
- title: '请到个人中心登录',
- icon: 'none'
- })
- }
- if(value){
- wx.navigateTo({
- url: '../commodity-detail/commodity-detail?id=' + e.currentTarget.dataset.id,
- })
- }
- } catch (e) {
- console.log(e)
- }
- },
-
- onShow: function () {
- var _this = this
- wx.request({
- url: app.globalData.baseURL + '/job/jobs',
- method: 'GET',
- success(res) {
- _this.setData({
- jobList: res.data.data
- });
- console.log(res.data.data)
- }
- })
- },
-
- onLoad: function (options) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.towerSwiper('swiperList');
- },
- DotStyle(e) {
- this.setData({
- DotStyle: e.detail.value
- })
- },
-
- cardSwiper(e) {
- this.setData({
- cardCur: e.detail.current
- })
- },
-
-
- towerSwiper(name) {
- let list = this.data[name];
- for (let i = 0; i < list.length; i++) {
- list[i].zIndex = parseInt(list.length / 2) + 1 - Math.abs(i - parseInt(list.length / 2))
- list[i].mLeft = i - parseInt(list.length / 2)
- }
- this.setData({
- swiperList: list
- })
- },
-
- towerStart(e) {
- this.setData({
- towerStart: e.touches[0].pageX
- })
- },
-
- towerMove(e) {
- this.setData({
- direction: e.touches[0].pageX - this.data.towerStart > 0 ? 'right' : 'left'
- })
- },
-
- towerEnd(e) {
- let direction = this.data.direction;
- let list = this.data.swiperList;
- if (direction == 'right') {
- let mLeft = list[0].mLeft;
- let zIndex = list[0].zIndex;
- for (let i = 1; i < list.length; i++) {
- list[i - 1].mLeft = list[i].mLeft
- list[i - 1].zIndex = list[i].zIndex
- }
- list[list.length - 1].mLeft = mLeft;
- list[list.length - 1].zIndex = zIndex;
- this.setData({
- swiperList: list
- })
- } else {
- let mLeft = list[list.length - 1].mLeft;
- let zIndex = list[list.length - 1].zIndex;
- for (let i = list.length - 1; i > 0; i--) {
- list[i].mLeft = list[i - 1].mLeft
- list[i].zIndex = list[i - 1].zIndex
- }
- list[0].mLeft = mLeft;
- list[0].zIndex = zIndex;
- this.setData({
- swiperList: list
- })
- }
- },
-
- onPullDownRefresh: function () {
- console.log("下拉刷新")
- function randomSort(a, b) { return Math.random() > 0.5 ? -1 : 1; }
- this.setData({
- jobList: this.data.jobList.sort(randomSort)
- })
- wx.stopPullDownRefresh();
-
-
- },
-
- onReachBottom: function () {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- })
|