From bd39d8bf79e4d96ba7ade4341423c81027b7642c Mon Sep 17 00:00:00 2001 From: Tuisku Date: Wed, 8 Jun 2022 15:20:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 37 ++++- components/search/searchbar.js | 1 + components/search/searchbar.wxml | 17 +-- pages/lookup/lookimg/img.wxml | 5 +- pages/material/material.js | 64 +++------ pages/material/subpage/newest/newest.js | 127 ++++++++---------- pages/material/subpage/newest/newest.wxml | 8 +- pages/material/subpage/newest/newest.wxss | 4 +- pages/quest/quest.js | 45 ++++--- .../components/collection/collection.js | 48 ++++--- .../components/collection/collection.wxml | 6 +- .../detail/components/detailed/detailed.wxml | 4 +- .../detail/components/detailed/detailed.wxss | 4 +- .../detail/components/effect/effect.wxss | 1 - .../subpage/detail/components/link/link.js | 69 ++++++---- .../subpage/detail/components/link/link.wxml | 2 +- pages/quest/subpage/detail/detail.js | 4 +- pages/user/subpage/relation/relation.wxml | 8 +- pages/user/user.js | 31 +++-- project.private.config.json | 2 +- utils/config.js | 3 +- utils/util.js | 4 +- 22 files changed, 270 insertions(+), 224 deletions(-) diff --git a/app.js b/app.js index 8dab547..0a99250 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,6 @@ // app.js import {host,cdn} from "./utils/config" +import {http} from './utils/util' App({ onLaunch() { // 展示本地存储能力 @@ -10,7 +11,41 @@ App({ // 登录 wx.login({ success: res => { - // 发送 res.code 到后台换取 openId, sessionKey, unionId + // this.setData({ + // code: res.code + // }) + http("/user/login", "post", { + code: res.code + }).then(res => { + if (res.msg === "未注册!") { + // this.getUserProfile() + wx.showToast({ + title: '您尚未注册,请点击个人头像位置以注册登录', + icon: 'none', + duration: 2000 + }) + } else { + getApp().globalData.token = res.data.token + // this.setData({ + // user_avatar:res.data.user.avatar, + // user_name:res.data.user.name, + // user_tip:'欢迎来到星途~' + // }) + wx.setStorage({ + key: 'user', + data: res.data.user + }) + wx.setStorage({ + key: 'token', + data: res.data.token + }) + // wx.getStorage({ + // key: 'token', + // success (res) { + // } + // }) + } + }) } }) }, diff --git a/components/search/searchbar.js b/components/search/searchbar.js index 49fc52b..b766b8a 100644 --- a/components/search/searchbar.js +++ b/components/search/searchbar.js @@ -42,6 +42,7 @@ Component({ }, // 用户点击确定触发 handleConfirm() { + console.log('handleConfirm', this.data.inputValue) this.triggerEvent('handleSearch', this.data.inputValue) } } diff --git a/components/search/searchbar.wxml b/components/search/searchbar.wxml index 9a9a253..64d6fbd 100644 --- a/components/search/searchbar.wxml +++ b/components/search/searchbar.wxml @@ -3,21 +3,14 @@ - - + + 取消 - + \ No newline at end of file diff --git a/pages/lookup/lookimg/img.wxml b/pages/lookup/lookimg/img.wxml index 417c125..99f2d7e 100644 --- a/pages/lookup/lookimg/img.wxml +++ b/pages/lookup/lookimg/img.wxml @@ -1,12 +1,11 @@ - + {{data.title}} - 星途追风 - 星途凌云 + - - + + @@ -41,7 +41,7 @@ - - + + \ No newline at end of file diff --git a/pages/material/subpage/newest/newest.wxss b/pages/material/subpage/newest/newest.wxss index 5f27f58..d5c6648 100644 --- a/pages/material/subpage/newest/newest.wxss +++ b/pages/material/subpage/newest/newest.wxss @@ -182,7 +182,7 @@ background: rgba(0, 0, 0, 0.3); border: 2rpx solid #FFFFFF; position: relative; - bottom: 93rpx; + bottom: 140rpx; left: 100rpx; border-radius: 32rpx; } @@ -193,7 +193,7 @@ background: #006BFF; border: 2rpx solid #FFFFFF; position: relative; - bottom: 93rpx; + bottom: 140rpx; left: 100rpx; border-radius: 32rpx; } diff --git a/pages/quest/quest.js b/pages/quest/quest.js index 1523c3b..61d7f0b 100644 --- a/pages/quest/quest.js +++ b/pages/quest/quest.js @@ -92,27 +92,9 @@ Page({ success: function (res) {} }) this.getdata() - http("/brand/list", "post", {}).then(res => { - // console.log(res.data.records) - res.data.records.forEach(element => { - element.is = false - element.title = element.name - let a = element - this.setData({ - 'selectItem[3].rank': this.data.selectItem[3].rank.concat(a) - }) - }); - }) - http("/tag/list", "post", {}).then(res => { - // console.log(res.data.records) - res.data.records.forEach(element => { - element.is = false - let a = element - this.setData({ - 'selectItem[1].rank': this.data.selectItem[1].rank.concat(a) - }) - }); - }) + }, + handleSearch (b) { + console.log(b) }, to(e) { wx.navigateTo({ @@ -143,6 +125,27 @@ Page({ 'maxpage': res.data.pages, }) }) + http("/brand/list", "post", {}).then(res => { + // console.log(res.data.records) + res.data.records.forEach(element => { + element.is = false + element.title = element.name + let a = element + this.setData({ + 'selectItem[3].rank': this.data.selectItem[3].rank.concat(a) + }) + }); + }) + http("/tag/list", "post", {}).then(res => { + // console.log(res.data.records) + res.data.records.forEach(element => { + element.is = false + let a = element + this.setData({ + 'selectItem[1].rank': this.data.selectItem[1].rank.concat(a) + }) + }); + }) }, // 点击菜单栏触发的事件函数 handleClick: function (e) { diff --git a/pages/quest/subpage/detail/components/collection/collection.js b/pages/quest/subpage/detail/components/collection/collection.js index 02c450b..a6d1664 100644 --- a/pages/quest/subpage/detail/components/collection/collection.js +++ b/pages/quest/subpage/detail/components/collection/collection.js @@ -1,11 +1,12 @@ // pages/quest/subpage/detail/components/collection/collection.js -import {http} from '../../../../../../utils/util' +import { + http +} from '../../../../../../utils/util' Component({ /** * 组件的属性列表 */ - properties: { - }, + properties: {}, /** * 组件的初始数据 @@ -28,42 +29,42 @@ Component({ * 组件的方法列表 */ methods: { - blur(e){ + blur(e) { let a = "form." + e.currentTarget.dataset.mes let b = e.detail.value this.setData({ [a]: b }) }, - getUserProvince(e){ + getUserProvince(e) { this.setData({ 'form.add': e.detail.value }) }, - getbrand(){ + getbrand() { this.setData({ brand: true }) - http("/brand/list", "post",).then(res=>{ - if (this.data.brandpage === this.data.brandmax) { - } else { + http("/brand/list", "post", ).then(res => { + if (this.data.brandpage === this.data.brandmax) {} else { this.setData({ brands: this.data.brands.concat(res.data.records), brandmax: res.data.pages, - brandpage : this.data.brandpage + brandpage: this.data.brandpage }) this.getbrand() } }) }, - choosebrand(e){ + choosebrand(e) { this.setData({ 'form.type': e.currentTarget.dataset.mes, brand: false }) }, - update () { - console.log(this.data.form) + update() { + // console.log(this.data.form) + // console.log(this.data.form.tel.match(/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/)) if (!this.data.form.name) { wx.showToast({ title: '请输入姓名', @@ -76,6 +77,12 @@ Component({ icon: 'none', duration: 2000 }) + } else if (!this.data.form.tel.match(/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/)) { + wx.showToast({ + title: '请输入正确的手机号', + icon: 'none', + duration: 2000 + }) } else if (this.data.form.add.length === 0) { wx.showToast({ title: '请选择地区', @@ -83,18 +90,29 @@ Component({ duration: 2000 }) } else { - http("/task/customerNote", "post",{ + http("/task/customerNote", "post", { customerName: this.data.form.name, tel: this.data.form.tel, area: this.data.form.add.toString(), brandId: this.data.form.type ? this.data.form.type.id : '', remarks: this.data.form.tip - }).then(res=>{ + }).then(res => { wx.showToast({ title: res.data, icon: 'none', duration: 2000 }) + if (res.success) { + this.setData({ + form: { + name: '', + tel: '', + add: [], + type: null, + tip: '' + } + }) + } }) } } diff --git a/pages/quest/subpage/detail/components/collection/collection.wxml b/pages/quest/subpage/detail/components/collection/collection.wxml index ef149f1..fdae1d7 100644 --- a/pages/quest/subpage/detail/components/collection/collection.wxml +++ b/pages/quest/subpage/detail/components/collection/collection.wxml @@ -4,13 +4,13 @@ 姓名* - + 手机号* - + @@ -39,7 +39,7 @@ 备注 - + diff --git a/pages/quest/subpage/detail/components/detailed/detailed.wxml b/pages/quest/subpage/detail/components/detailed/detailed.wxml index ea7b147..1262617 100644 --- a/pages/quest/subpage/detail/components/detailed/detailed.wxml +++ b/pages/quest/subpage/detail/components/detailed/detailed.wxml @@ -10,12 +10,12 @@ 起止时间 - {{data.start}}\n~\n{{data.end}} + {{data.start}}~{{data.end}} 任务标签 - {{item.title}}\n + {{item.title}} diff --git a/pages/quest/subpage/detail/components/detailed/detailed.wxss b/pages/quest/subpage/detail/components/detailed/detailed.wxss index 3e5ac3a..12b45d8 100644 --- a/pages/quest/subpage/detail/components/detailed/detailed.wxss +++ b/pages/quest/subpage/detail/components/detailed/detailed.wxss @@ -67,13 +67,15 @@ } .mes { - max-width: 265rpx; + max-width: 400rpx; font-size: 28rpx; font-family: MiSans-Demibold, MiSans; font-weight: 600; color: #333333; line-height: 28rpx; text-align: end; + display: flex; + flex-wrap: wrap; } .in { diff --git a/pages/quest/subpage/detail/components/effect/effect.wxss b/pages/quest/subpage/detail/components/effect/effect.wxss index d40fcd0..5a095cd 100644 --- a/pages/quest/subpage/detail/components/effect/effect.wxss +++ b/pages/quest/subpage/detail/components/effect/effect.wxss @@ -19,7 +19,6 @@ } .count_num { - width: 124rpx; height: 64rpx; font-size: 64rpx; font-family: MiSans-Demibold, MiSans; diff --git a/pages/quest/subpage/detail/components/link/link.js b/pages/quest/subpage/detail/components/link/link.js index db7ffe2..208f77b 100644 --- a/pages/quest/subpage/detail/components/link/link.js +++ b/pages/quest/subpage/detail/components/link/link.js @@ -1,5 +1,7 @@ // pages/quest/subpage/detail/components/link/link.js -import {http} from '../../../../../../utils/util' +import { + http +} from '../../../../../../utils/util' Component({ /** * 组件的属性列表 @@ -20,20 +22,20 @@ Component({ */ data: { platforms: [{ - id: 1, - name: '抖音' - }, { - id: 2, - name: '快手' - }, - // { - // id: 3, - // name: '朋友圈' - // }, { - // id: 4, - // name: '视频号' - // } - ], + id: 1, + name: '抖音' + }, { + id: 2, + name: '快手' + }, + // { + // id: 3, + // name: '朋友圈' + // }, { + // id: 4, + // name: '视频号' + // } + ], platform: null, platformdia: false, link: '', @@ -74,19 +76,38 @@ Component({ }) }, up(e) { - http("/video/userAdd", "post",{ - id: this.data.data.id, - type: this.data.platform.id, - url: this.data.link - }).then(res=>{ + if (!this.data.platform) { wx.showToast({ - title: res.data, + title: '请选择平台', icon: 'none', duration: 2000 - }).then(res=>{ - this.triggerEvent('getdata','') }) - }) + } else if (!this.data.link) { + wx.showToast({ + title: '请输入链接', + icon: 'none', + duration: 2000 + }) + } else { + http("/video/userAdd", "post", { + id: this.data.data.id, + type: this.data.platform.id, + url: this.data.link + }).then(res => { + wx.showToast({ + title: res.data, + icon: 'none', + duration: 2000 + }).then(res => { + this.triggerEvent('getdata', '') + this.setData({ + link_type: false, + platform: null, + link: '' + }) + }) + }) + } }, chooseImage() { let that = this diff --git a/pages/quest/subpage/detail/components/link/link.wxml b/pages/quest/subpage/detail/components/link/link.wxml index 0603c87..99307fb 100644 --- a/pages/quest/subpage/detail/components/link/link.wxml +++ b/pages/quest/subpage/detail/components/link/link.wxml @@ -11,7 +11,7 @@ 输入链接 - + diff --git a/pages/quest/subpage/detail/detail.js b/pages/quest/subpage/detail/detail.js index 4dd6dde..7e47772 100644 --- a/pages/quest/subpage/detail/detail.js +++ b/pages/quest/subpage/detail/detail.js @@ -44,8 +44,8 @@ Page({ table: res.data.rewardRuleList }) this.setData({ - 'data.start': res.data.start.slice(0, 16), - 'data.end': res.data.end.slice(0, 16) + 'data.start': res.data.start.slice(0, 10), + 'data.end': res.data.end.slice(0, 10) }) }) http("/video/addedRecord", "post", { diff --git a/pages/user/subpage/relation/relation.wxml b/pages/user/subpage/relation/relation.wxml index d9753bd..748f909 100644 --- a/pages/user/subpage/relation/relation.wxml +++ b/pages/user/subpage/relation/relation.wxml @@ -3,7 +3,7 @@ - + 抖音 未提交 @@ -25,7 +25,7 @@ - + 快手 未提交 @@ -47,7 +47,7 @@ - + 朋友圈 未提交 @@ -69,7 +69,7 @@ - + 视频号 未提交 diff --git a/pages/user/user.js b/pages/user/user.js index a3c825d..c6f74c3 100644 --- a/pages/user/user.js +++ b/pages/user/user.js @@ -68,9 +68,9 @@ Page({ } else { getApp().globalData.token = res.data.token this.setData({ - user_avatar:res.data.user.avatar, - user_name:res.data.user.name, - user_tip:'欢迎来到星途~' + user_avatar: res.data.user.avatar, + user_name: res.data.user.name, + user_tip: '欢迎来到星途~' }) wx.setStorage({ key: 'user', @@ -80,11 +80,11 @@ Page({ key: 'token', data: res.data.token }) - wx.getStorage({ - key: 'token', - success (res) { - } - }) + // wx.getStorage({ + // key: 'token', + // success (res) { + // } + // }) } }) } @@ -139,7 +139,7 @@ Page({ }) }) }, - colse () { + colse() { this.data({ phone: false }) @@ -157,6 +157,19 @@ Page({ canIUseGetUserProfile: true }) } + let that = this + wx.getStorage({ + key: 'user', + success(res) { + // console.log('res') + // console.log(res) + that.setData({ + user_avatar: res.data.avatar, + user_name: res.data.name, + user_tip: '欢迎来到星途~' + }) + } + }) }, /** diff --git a/project.private.config.json b/project.private.config.json index b8295b9..742204b 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -2,7 +2,7 @@ "projectname": "xx", "setting": { "compileHotReLoad": true, - "urlCheck": false + "urlCheck": true }, "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "libVersion": "2.24.2", diff --git a/utils/config.js b/utils/config.js index 90a7c3f..e22f0e2 100644 --- a/utils/config.js +++ b/utils/config.js @@ -1,6 +1,7 @@ -const host = 'https://api.sws010.com' +const host = 'https://api.sws010.com/wxApp' const cdn = 'https://cdn.sws010.com' +// https://api.sws010.com/wxApp // api.sws010.com // cdn.sws010.com diff --git a/utils/util.js b/utils/util.js index 4ae38de..a3c640b 100644 --- a/utils/util.js +++ b/utils/util.js @@ -32,8 +32,8 @@ const http = (url, method, data, isLoading = true) => { 'token': wx.getStorageSync('token') } } - console.log(url) - console.log(method) + // console.log(url) + // console.log(method) wx.request({ url: host + url, method: 'POST',