diff --git a/api/index.js b/api/index.js index 2d57142..4fbfd4d 100644 --- a/api/index.js +++ b/api/index.js @@ -1,39 +1,43 @@ -/* - * 手太欠 - * 愿这世界都如故事里一样 美好而动人~ -*/ - -// 授权登录 -import auth from "./interfaces/auth" - -// 图片上传 -import file from "./interfaces/file" - -// 皮肤健康知识 -import health from "./interfaces/health" - -// 首页 -import index from "./interfaces/index" - -// 产品 -import mall from "./interfaces/mall" - -// 订单 -import order from "./interfaces/order" - -// 地址管理 -import site from "./interfaces/site" - -// 个人中心 -import user from "./interfaces/user" - -export default { - auth, - file, - health, - index, - mall, - order, - site, - user +/* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +// 授权登录 +import auth from "./interfaces/auth" + +// 图片上传 +import file from "./interfaces/file" + +// 皮肤健康知识 +import health from "./interfaces/health" + +// 首页 +import index from "./interfaces/index" + +// 产品 +import mall from "./interfaces/mall" + +// 订单 +import order from "./interfaces/order" + +// 体验官 +import recruit from "./interfaces/recruit" + +// 地址管理 +import site from "./interfaces/site" + +// 个人中心 +import user from "./interfaces/user" + +export default { + auth, + file, + health, + index, + mall, + order, + recruit, + site, + user } \ No newline at end of file diff --git a/api/interfaces/index.js b/api/interfaces/index.js index 67783dc..e4a129f 100644 --- a/api/interfaces/index.js +++ b/api/interfaces/index.js @@ -1,41 +1,42 @@ - /* - * 手太欠 - * 愿这世界都如故事里一样 美好而动人~ -*/ - -import { req, upload } from "../request" - -// 是否可以检测 -const analyze = () => req({ - url: "ai/skin/analyze" -}) - -// 创建检测订单 -const skinOrder = () => req({ - url : "ai/skin/order", - method: "POST", -}) - -// 检测订单支付 -const skinPay = (order_id, data) => req({ - url : "ai/pay/" + order_id + "/wechat", - data: data, -}) - -// 皮肤检测 -const skinEnter = (data, path) => { - return upload({ - url : "ai/skin/analyze", - key : "image", - path : path, - data : data, - method : "POST", - }) -} - -export default ({ - analyze, - skinOrder, - skinPay, - skinEnter + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req, upload } from "../request" + + +// 是否可以检测 +const analyze = () => req({ + url: "ai/skin/analyze" +}) + +// 创建检测订单 +const skinOrder = () => req({ + url : "ai/skin/order", + method: "POST", +}) + +// 检测订单支付 +const skinPay = (order_id, data) => req({ + url : "ai/pay/" + order_id + "/wechat", + data: data, +}) + +// 皮肤检测 +const skinEnter = (data, path) => { + return upload({ + url : "ai/skin/analyze", + key : "image", + path : path, + data : data, + method : "POST", + }) +} + +export default ({ + analyze, + skinOrder, + skinPay, + skinEnter }) \ No newline at end of file diff --git a/api/interfaces/recruit.js b/api/interfaces/recruit.js new file mode 100644 index 0000000..68a8f4f --- /dev/null +++ b/api/interfaces/recruit.js @@ -0,0 +1,30 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req } from "../request" + +// 体验官首页 +const index = data => req({ + url : "experiences", + data: data +}) + +// 申请前置接口 +const Enroll = (experience_id) => req({ + url : "experiences/enroll/" + experience_id +}) + +// 申请前置接口 +const recruitAdd = (data) => req({ + url : "experiences/enroll", + method: "POST", + data: data +}) + +export default ({ + index, + Enroll, + recruitAdd +}) \ No newline at end of file diff --git a/api/interfaces/site.js b/api/interfaces/site.js index 1ceb9d8..9eabc68 100644 --- a/api/interfaces/site.js +++ b/api/interfaces/site.js @@ -1,58 +1,58 @@ - /* - * 手太欠 - * 愿这世界都如故事里一样 美好而动人~ -*/ - -import { req } from "../request" - -// 收获地址(列表) -const siteList = () => req({ - url: "mall/addresses" -}) - -// 省市区-获取 -const create = data => req({ - url: "mall/addresses/create", - data: data -}) - -// 新增地址 -const siteAdd = data => req({ - url: "mall/addresses", - data: data, - method: 'POST' -}) - -// 地址详细 -const siteSee = (address) => req({ - url: "mall/addresses/" + address -}) - -// 编辑地址 -const siteEdit = (address, data) => req({ - url: "mall/addresses/" + address, - data: data, - method: 'PUT' -}) - -// 删除地址 -const siteDel = (address) => req({ - url: "mall/addresses/" + address, - method: 'DELETE' -}) - -// 设置默认地址 -const siteDefault = (address) => req({ - url: "mall/addresses/" + address + "/default", - method: 'POST' -}) - -export default ({ - siteList, - create, - siteAdd, - siteSee, - siteEdit, - siteDel, - siteDefault + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import { req } from "../request" + +// 收获地址(列表) +const siteList = () => req({ + url: "mall/addresses" +}) + +// 省市区-获取 +const create = data => req({ + url: "mall/addresses/create", + data: data +}) + +// 新增地址 +const siteAdd = data => req({ + url: "mall/addresses", + data: data, + method: 'POST' +}) + +// 地址详细 +const siteSee = (address) => req({ + url: "mall/addresses/" + address +}) + +// 编辑地址 +const siteEdit = (address, data) => req({ + url: "mall/addresses/" + address, + data: data, + method: 'PUT' +}) + +// 删除地址 +const siteDel = (address) => req({ + url: "mall/addresses/" + address, + method: 'DELETE' +}) + +// 设置默认地址 +const siteDefault = (address) => req({ + url: "mall/addresses/" + address + "/default", + method: 'POST' +}) + +export default ({ + siteList, + create, + siteAdd, + siteSee, + siteEdit, + siteDel, + siteDefault }) \ No newline at end of file diff --git a/api/request.js b/api/request.js index ed4ce8f..c2e3077 100644 --- a/api/request.js +++ b/api/request.js @@ -1,139 +1,140 @@ -/* - * 手太欠 - * 愿这世界都如故事里一样 美好而动人~ -*/ - -import {errInfo} from './err' -import {updToken} from './updateToken' - -// 请求方式配置 -// https://api.shui.shuiganying.com/api //正式地址 -// https://shuitest.shuiganying.com/api //测试地址 -// wx6bd4fcc040bfa025 正式appid -// wx3056ec23196eaf02 测试appid -const api = "https://api.shui.shuiganying.com/api/" // 正式环境 -// const api = "https://shuitest.shuiganying.com/api/" // 测试环境 -const header = { - "Accept" : "application/json" -} -let isToken = true - -/** - * 请求 - * @property {Object} req - */ - -const req = (obj, noToken) => { - // 检查是否无需要token - if(noToken != undefined){ - isToken = noToken - } - - // header - if(obj.token){ - header.Authorization = obj.token || '' - } else { - header.Authorization = wx.getStorageSync("token") || "" - } - - // 处理请求信息 - return new Promise((resolve, reject) => { - // 组合header - obj.header = { - "Accept" : "application/json", - "channel" : "client", - "Authorization" : wx.getStorageSync("token") || "" - } - if(!isToken){ - obj.header.Authorization = '' - } - wx.request({ - url : api + obj.url, - header : obj.header || {}, - method : obj.method || 'GET', - data : obj.data || {}, - success : res => { - // 更新token - if (res.header.Authorization) updToken(res.header.Authorization) - // 处理信息 - if (res.data.status_code == 200) { - resolve(res.data) - } else { - if (res.data.status_code == 401 || res.data.status_code == 400) { - reject({ - login : false, - codeBeen: false - }) - } - reject(res) - errInfo(res.data) - } - }, - fail: err => { - wx.showToast({ - title : err.errMsg, - icon : "none" - }) - reject(err) - }, - complete(){ - if(!isToken) isToken = true - } - }) - }) -} - - -/** - * 上传 - * @property {Object} upload - */ - -const upload = (obj) => { - // header - header.Authorization = wx.getStorageSync("token") || "" - // 处理上传信息 - return new Promise((resolve, reject) => { - wx.showLoading({ - title: "上传中..", - mask: true - }) - wx.uploadFile({ - url : api + obj.url, - header : header, - name : obj.key || "", - filePath: obj.path || "", - formData: obj.data || {}, - success : res=>{ - wx.hideLoading(); - // 处理返回值 - let jsonData = JSON.parse(res.data) - // 更新token - if (res.header.Authorization) updToken(res.header.Authorization) - // 处理信息 - if (jsonData.status_code == 200) { - resolve(jsonData.data) - } else { - if (jsonData.status_code == 401) { - reject({ - login: false - }) - } - errInfo(jsonData) - } - }, - fail : err=>{ - wx.showToast({ - title : err.errMsg, - icon : "none" - }) - reject(err) - } - }) - }) -} - -module.exports = { - req, - upload +/* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ +*/ + +import {errInfo} from './err' +import {updToken} from './updateToken' + +// 请求方式配置 +// https://api.shui.shuiganying.com/api //正式地址 +// https://shuitest.shuiganying.com/api //测试地址 +// wx6bd4fcc040bfa025 正式appid +// wx3056ec23196eaf02 测试appid +// const api = "https://api.shui.shuiganying.com/api/" // 正式环境 +const api = "https://shuitest.shuiganying.com/api/" // 测试环境 +const header = { + "Accept" : "application/json" +} +let isToken = true + +/** + * 请求 + * @property {Object} req + */ + +const req = (obj, noToken) => { + // 检查是否无需要token + if(noToken != undefined){ + isToken = noToken + } + + // header + if(obj.token){ + header.Authorization = obj.token || '' + } else { + header.Authorization = wx.getStorageSync("token") || "" + } + + // 处理请求信息 + return new Promise((resolve, reject) => { + // 组合header + obj.header = { + "Accept" : "application/json", + "channel" : "client", + "Authorization" : wx.getStorageSync("token") || "" + } + if(!isToken){ + obj.header.Authorization = '' + } + wx.request({ + timeout: '13000', + url : api + obj.url, + header : obj.header || {}, + method : obj.method || 'GET', + data : obj.data || {}, + success : res => { + // 更新token + if (res.header.Authorization) updToken(res.header.Authorization) + // 处理信息 + if (res.data.status_code == 200) { + resolve(res.data) + } else { + if (res.data.status_code == 401 || res.data.status_code == 400) { + reject({ + login : false, + codeBeen: false + }) + } + reject(res) + errInfo(res.data) + } + }, + fail: err => { + wx.showToast({ + title : (err.errMsg).indexOf('108') > 0 ? "网络错误,请检查您的网络环境" : err.errMsg, + icon : "none" + }) + reject(err) + }, + complete(){ + if(!isToken) isToken = true + } + }) + }) +} + + +/** + * 上传 + * @property {Object} upload + */ + +const upload = (obj) => { + // header + header.Authorization = wx.getStorageSync("token") || "" + // 处理上传信息 + return new Promise((resolve, reject) => { + wx.showLoading({ + title: "上传中..", + mask: true + }) + wx.uploadFile({ + url : api + obj.url, + header : header, + name : obj.key || "", + filePath: obj.path || "", + formData: obj.data || {}, + success : res=>{ + wx.hideLoading(); + // 处理返回值 + let jsonData = JSON.parse(res.data) + // 更新token + if (res.header.Authorization) updToken(res.header.Authorization) + // 处理信息 + if (jsonData.status_code == 200) { + resolve(jsonData.data) + } else { + if (jsonData.status_code == 401) { + reject({ + login: false + }) + } + errInfo(jsonData) + } + }, + fail : err=>{ + wx.showToast({ + title : err.errMsg, + icon : "none" + }) + reject(err) + } + }) + }) +} + +module.exports = { + req, + upload } \ No newline at end of file diff --git a/app.js b/app.js index 240f862..f015e0d 100644 --- a/app.js +++ b/app.js @@ -52,6 +52,7 @@ App({ isUser : false, userInfo : null, barHeight: '', - inviteText: '' // 邀请好友临时存储 + inviteText: '', // 邀请好友临时存储 + isExperience: '' // 体验官身份 } }) \ No newline at end of file diff --git a/app.json b/app.json index b041034..22c354d 100644 --- a/app.json +++ b/app.json @@ -29,7 +29,9 @@ "pages/login/personal/personal", "pages/login/agreement/agreement", "pages/mall/webView/webView", - "pages/order/logistic/logistic" + "pages/order/logistic/logistic", + "pages/recruit/index", + "pages/recruit/referto/referto" ], "window": { "backgroundTextStyle": "light", @@ -51,6 +53,12 @@ "iconPath": "/static/tabBarIcon/tabBar_01.png", "selectedIconPath": "/static/tabBarIcon/tabBar_selected_01.png" }, + { + "pagePath": "pages/recruit/index", + "text": "体验官", + "iconPath": "/static/tabBarIcon/tabBar_04.png", + "selectedIconPath": "/static/tabBarIcon/tabBar_selected_04.png" + }, { "pagePath": "pages/report/index", "text": "报告", diff --git a/pages/index/assess/assess.js b/pages/index/assess/assess.js index 136ca30..dfe348f 100644 --- a/pages/index/assess/assess.js +++ b/pages/index/assess/assess.js @@ -1,239 +1,250 @@ - /* - * 手太欠 - * 愿这世界都如故事里一样 美好而动人~ - */ - -Page({ - data: { - barHeight : getApp().globalData.barHeight, // 状态栏高度 - openId : '', - nameValue : '', // 姓名 - testTitle : '', - nameStatus: false, // 姓名填写弹框 - Analyze : '', // 是否交钱 - disabled : false, // 支付按钮 - payStatus : false, // 支付弹框 - payPrice : '', // 支付金额 - }, - - onLoad(options) { - this.setData({ - openId: options.code - }) - if(options) { - wx.login({ - success: res => { - // 获取openid - this.openInfo(res.code) - } - }) - } - }, - - onShow() { - // 判断是否可检测 - this.ifAnalyze(); - }, - - - /** - * openid - */ - openInfo(code) { - wx.$api.auth.codeOpenid({code: code}).then(res => { - this.setData({ - openId: res.data - }) - }).catch(err => {}) - }, - - /** - * 是否可检测 - */ - ifAnalyze() { - wx.$api.index.analyze().then(res => { - if(res.data.is_first) { - this.setData({ - testTitle: '首次免费,开始测肤' - }) - } else if (res.data.is_first == false && res.data.analyze == false) { - this.setData({ - testTitle: '支付' + res.data.price + '元,进行测肤' - }) - } else if (res.data.is_first == false && res.data.analyze == true) { - this.setData({ - testTitle: '您已付费,进行检测' - }) - } - - this.setData({ - Analyze : res.data - }) - if(!res.data.is_update) { - this.setData({ - nameStatus: true - }) - } - }).catch(err => {}) - }, - - /* - 姓名截取 - */ - bindinput(e) { - this.setData({ - nameValue: e.detail.value.substr(0,5) - }) - }, - - /* - 提交信息 - */ - issueForm() { - wx.showLoading({ - title: '信息提交中...', - mask : true - }) - let data = { - name : this.data.nameValue - } - wx.$api.auth.userAdd(data).then(() => { - wx.hideLoading() - this.setData({ - nameStatus: false - }) - }).catch(err => {}) - }, - - /** - * 开始皮肤检测 - */ - goAnalyze() { - if(this.data.Analyze.is_first == false && this.data.Analyze.analyze == false) { - this.setData({ - payStatus: true - }) - } else { - this.uploadPhoto() - } - }, - - /** - * 上传图片信息 - */ - uploadPhoto() { - wx.chooseMedia({ - count : 1, - sourceType: ['camera'], - camera : 'front', - success : path => { - // 获取皮肤检测接口 - if(wx.cropImage){ - wx.cropImage({ - src: path.tempFiles[0].tempFilePath, // 图片路径 - cropScale: '3:4', // 裁剪比例 - success: res=> { - // 获取皮肤检测接口 - this.checkEnter(res.tempFilePath); - }, - complete: err => {} - }) - return - } - this.checkEnter(path.tempFiles[0].tempFilePath); - } - }) - }, - - /** - * 皮肤检测接口 - */ - checkEnter(img) { - wx.$api.index.skinEnter({}, img).then(res => { - wx.redirectTo({ - url: "/pages/report/detail/detail?image_id=" + res.image_id - }) - }) - }, - - /** - * 关闭支付弹窗 - */ - cancelAnalyze() { - this.setData({ - payStatus: false - }) - }, - - /** - * 创建订单 - */ - payFound() { - wx.$api.index.skinOrder().then(res => { - this.setData({ - disabled : true - }) - this.payBtn(res.data.order_id) - }).catch(err => {}) - }, - - /** - * 确认支付1元 - */ - payBtn(orderid) { - wx.showLoading({ - title: '支付中...', - mask : true - }) - wx.$api.index.skinPay(orderid,{type: 'miniapp', openid: this.data.openId}).then(res=>{ - wx.hideLoading() - let payInfo = JSON.parse(res.data.wechat) - wx.requestPayment({ - timeStamp: payInfo.timeStamp, - nonceStr : payInfo.nonceStr, - package : payInfo.package, - paySign : payInfo.paySign, - signType : payInfo.signType, - success : res=>{ - if(res.errMsg == "requestPayment:ok"){ - wx.showToast({ - title: '支付成功', - icon : 'success' - }) - } - this.setData({ - payStatus: false - }) - this.setData({ - Analyze: false - }) - this.uploadPhoto() - }, - fail : err=>{ - wx.showToast({ - title: '支付失败', - icon : 'error' - }) - this.setData({ - disabled : false, - payStatus: false - }) - } - }) - }).catch(err => { - this.setData({ - disabled : false, - payStatus: false - }) - }); - }, - - /** - * 返回上一页 - */ - returnGo() { - wx.navigateBack({ - delta: 1 - }) - }, -}) + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + +Page({ + data: { + barHeight : getApp().globalData.barHeight, // 状态栏高度 + openId : '', + nameValue : '', // 姓名 + testTitle : '', + nameStatus : false, // 姓名填写弹框 + Analyze : '', // 是否交钱 + disabled : false, // 支付按钮 + payStatus : false, // 支付弹框 + payPrice : '', // 支付金额 + refertoType: 0, + }, + + onLoad(options) { + // 体验官 type=1或者type=2 直接面检,不用交钱 + this.setData({ + refertoType: options.type + }) + this.setData({ + openId: options.code + }) + if(options) { + wx.login({ + success: res => { + // 获取openid + this.openInfo(res.code) + } + }) + } + }, + + onShow() { + if(this.data.refertoType == '1' || this.data.refertoType == '2') { + this.setData({ + testTitle: '请您开始测肤' + }) + return + } + + // 判断是否可检测 + this.ifAnalyze(); + }, + + + /** + * openid + */ + openInfo(code) { + wx.$api.auth.codeOpenid({code: code}).then(res => { + this.setData({ + openId: res.data + }) + }).catch(err => {}) + }, + + /** + * 是否可检测 + */ + ifAnalyze() { + wx.$api.index.analyze().then(res => { + if(res.data.is_first) { + this.setData({ + testTitle: '首次免费,开始测肤' + }) + } else if (res.data.is_first == false && res.data.analyze == false) { + this.setData({ + testTitle: '支付' + res.data.price + '元,进行测肤' + }) + } else if (res.data.is_first == false && res.data.analyze == true) { + this.setData({ + testTitle: '您已付费,进行检测' + }) + } + + this.setData({ + Analyze : res.data + }) + if(!res.data.is_update) { + this.setData({ + nameStatus: true + }) + } + }).catch(err => {}) + }, + + /* + 姓名截取 + */ + bindinput(e) { + this.setData({ + nameValue: e.detail.value.substr(0,5) + }) + }, + + /* + 提交信息 + */ + issueForm() { + wx.showLoading({ + title: '信息提交中...', + mask : true + }) + let data = { + name : this.data.nameValue + } + wx.$api.auth.userAdd(data).then(() => { + wx.hideLoading() + this.setData({ + nameStatus: false + }) + }).catch(err => {}) + }, + + /** + * 开始皮肤检测 + */ + goAnalyze() { + if(this.data.Analyze.is_first == false && this.data.Analyze.analyze == false) { + this.setData({ + payStatus: true + }) + } else { + this.uploadPhoto() + } + }, + + /** + * 上传图片信息 + */ + uploadPhoto() { + wx.chooseMedia({ + count : 1, + sourceType: ['camera'], + camera : 'front', + success : path => { + // 获取皮肤检测接口 + if(wx.cropImage){ + wx.cropImage({ + src: path.tempFiles[0].tempFilePath, // 图片路径 + cropScale: '3:4', // 裁剪比例 + success: res=> { + // 获取皮肤检测接口 + this.checkEnter(res.tempFilePath); + }, + complete: err => {} + }) + return + } + this.checkEnter(path.tempFiles[0].tempFilePath); + } + }) + }, + /** + * 皮肤检测接口 + */ + checkEnter(img) { + wx.$api.index.skinEnter({type: this.data.refertoType}, img).then(res => { + wx.redirectTo({ + url: "/pages/report/detail/detail?image_id=" + res.image_id + "&type=" + this.data.refertoType + }) + }) + }, + + /** + * 关闭支付弹窗 + */ + cancelAnalyze() { + this.setData({ + payStatus: false + }) + }, + + /** + * 创建订单 + */ + payFound() { + wx.$api.index.skinOrder().then(res => { + this.setData({ + disabled : true + }) + this.payBtn(res.data.order_id) + }).catch(err => {}) + }, + + /** + * 确认支付1元 + */ + payBtn(orderid) { + wx.showLoading({ + title: '支付中...', + mask : true + }) + wx.$api.index.skinPay(orderid,{type: 'miniapp', openid: this.data.openId}).then(res=>{ + wx.hideLoading() + let payInfo = JSON.parse(res.data.wechat) + wx.requestPayment({ + timeStamp: payInfo.timeStamp, + nonceStr : payInfo.nonceStr, + package : payInfo.package, + paySign : payInfo.paySign, + signType : payInfo.signType, + success : res=>{ + if(res.errMsg == "requestPayment:ok"){ + wx.showToast({ + title: '支付成功', + icon : 'success' + }) + } + this.setData({ + payStatus: false + }) + this.setData({ + Analyze: false + }) + this.uploadPhoto() + }, + fail : err=>{ + wx.showToast({ + title: '支付失败', + icon : 'error' + }) + this.setData({ + disabled : false, + payStatus: false + }) + } + }) + }).catch(err => { + this.setData({ + disabled : false, + payStatus: false + }) + }); + }, + + /** + * 返回上一页 + */ + returnGo() { + wx.navigateBack({ + delta: 1 + }) + }, +}) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 4ec3965..f5c52bd 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,30 +1,30 @@ - - - - - - 下滑了解详情 - - - - - - - - - 检测 - - - - - - - - - - - - - - {{userLogin ? testTitle : '立即开启皮肤检测'}} - + + + + + + 下滑了解详情 + + + + + + + + + 检测 + + + + + + + + + + + + + + {{userLogin ? testTitle : '立即开启皮肤检测'}} + diff --git a/pages/login/index.js b/pages/login/index.js index 9f7d09f..06dbe1f 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -81,7 +81,8 @@ Page({ code : this.data.loginCode, encryptedData : enData, iv : iv, - invite : getApp().globalData.inviteText || '' + invite : getApp().globalData.inviteText || '', + is_experience : getApp().globalData.isExperience }).then(res=>{ // 存储登录信息 wx.setStorage({ diff --git a/pages/recruit/index.js b/pages/recruit/index.js new file mode 100644 index 0000000..ff1af0a --- /dev/null +++ b/pages/recruit/index.js @@ -0,0 +1,73 @@ +// pages/recruit/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + recruitData: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if(options.invite != undefined) { + getApp().globalData.inviteText = options.invite + } + if(options.is_experience != undefined) { + getApp().globalData.isExperience = options.is_experience + } + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取体验官首页 + this.recruitInfo(); + }, + + /** + * 体验官首页 + */ + recruitInfo() { + wx.$api.recruit.index().then(res => { + this.setData({ + recruitData: res.data + }) + }).catch(err => {}) + }, + + /** + * 申请 + */ + applyGo() { + if(wx.getStorageSync("token") != ''){ + if(this.data.recruitData.can.status == 0) { + wx.navigateTo({ + url: './referto/referto?id=' + this.data.recruitData.experience_id + }) + } else{ + wx.navigateTo({ + url: '/pages/index/assess/assess?type=1' + }) + } + return + } + + // 去登录 + wx.navigateTo({ + url: "/pages/login/index" + }) + }, + + rejectGo() { + wx.showModal({ + title: '驳回原因提示', + showCancel: false, + content: this.data.recruitData.can.remark, + success: res => {} + }) + } +}) \ No newline at end of file diff --git a/pages/recruit/index.json b/pages/recruit/index.json new file mode 100644 index 0000000..7af8b0a --- /dev/null +++ b/pages/recruit/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/recruit/index.wxml b/pages/recruit/index.wxml new file mode 100644 index 0000000..ab16085 --- /dev/null +++ b/pages/recruit/index.wxml @@ -0,0 +1,71 @@ + + + + + + + + + + + + 招募人数 + {{recruitData.total}}人 + + + + + 招募时间 + {{recruitData.start_at}} + + 即日起开始报名{{recruitData.total}}人,人满为止 + + + + 招募时间 + + 剩余名额 + + + + {{item}} + + + + + + + + + + + + + + + + + + + + + + {{recruitData.can.text}} + {{recruitData.can.text}} + + + + 暂无申请权限 + + + 查看驳回原因 + + + + + + + 水感应·好“雾”星球 + + + \ No newline at end of file diff --git a/pages/recruit/index.wxss b/pages/recruit/index.wxss new file mode 100644 index 0000000..82d3b16 --- /dev/null +++ b/pages/recruit/index.wxss @@ -0,0 +1,205 @@ +.recruit-title { + width: 100%; +} + +.recruit { + margin: 10rpx 0; + position: relative; + width: 100%; +} + +.recruit-back { + position: absolute; + left: 0; + top: 0; + width: 100%; +} + +.recruit-cont { + width: 100%; + position: absolute; + left: 0; + top: 0; +} + +.recruit-padding { + padding: 30rpx; + box-sizing: border-box; +} + +.recruit-block { + background-color: #5390f4; + border-radius: 50rpx; + padding: 20rpx; + box-sizing: border-box; +} + +.recruit-border { + border: 4rpx solid #000000; + border-radius: 50rpx; + padding: 40rpx; + box-sizing: border-box; +} + +.recruit-img { + width: 100%; +} + +.recruit-white { + background-color: white; + border-radius: 40rpx; + padding: 5rpx 35rpx; + box-sizing: border-box; + margin-top: 30rpx; + position: relative; +} + +.recruit-white::after { + position: absolute; + content: ''; + left: calc(50% - 100rpx); + top: -18rpx; + background-color: #ffde49; + height: 36rpx; + width: 200rpx; + border-radius: 80rpx; +} + +.recruit-label { + padding: 5rpx 0 5rpx 30rpx; + margin: 40rpx 0; + position: relative; +} + +.recruit-label::after { + position: absolute; + content: ''; + left: 0; + top: 0; + background-color: #5390f4; + border-radius: 50rpx; + width: 10rpx; + height: 100%; +} + +.recruit-title { + display: flex; + font-weight: 600; + font-size: 32rpx; +} + +.recruit-name { + flex: 1; +} + +.recruit-text { + margin-top: 10rpx; + font-size: 28rpx; +} + +.recruit-number { + position: absolute; + right: -2rpx; + top: 5rpx; + display: flex; +} + +.recruit-see { + position: relative; + width: 70rpx; + margin: 0 2rpx; +} + +.recruit-see-img, +.recruit-see-text { + position: absolute; + left: 0; + top: 0; +} + +.recruit-see-img { + width: 100%; +} + +.recruit-see-text { + text-align: center; + color: #ffffff; + width: 70rpx; + line-height: 90rpx; + font-weight: 600; + font-size: 54rpx; +} + +/* 流程 */ +.recruit-flow { + text-align: center; + margin: 60rpx 0 20rpx; +} + +.recruit-flow-img { + width: 55%; +} + +.recruit-btn { + position: relative; + margin: 60rpx 0 30rpx; + height: 100rpx; +} + +.recruit-btn-img, +.recruit-btn-text { + position: absolute; + left: 0; + top: 0; + width: 100%; +} + +.recruit-btn-text { + color: #ffffff; + text-align: center; + line-height: 100rpx; + font-size: 34rpx; +} + +.recruit-btn-img.active { + -webkit-filter: grayscale(100%); + -moz-filter: grayscale(100%); + -ms-filter: grayscale(100%); + -o-filter: grayscale(100%); + filter: grayscale(100%); + filter: gray; +} + +.recruit-bottom { + position: relative; + height: 180rpx; +} + +.recruit-bottom-img { + position: absolute; + left: 0; + top: 0; + width: 100%; +} + +.recruit-bottom-text { + position: absolute; + left: 0; + bottom: 0; + width: 100%; + z-index: 9; + color: #ffffff; + text-align: center; + font-size: 28rpx; +} + +.reject-tips { + text-align: center; + font-size: 28rpx; + color: #5390f4; +} + +/* .reject-tips image { + width: 38rpx; + display: inline-block; +} */ \ No newline at end of file diff --git a/pages/recruit/referto/referto.js b/pages/recruit/referto/referto.js new file mode 100644 index 0000000..f6fa673 --- /dev/null +++ b/pages/recruit/referto/referto.js @@ -0,0 +1,176 @@ +// pages/recruit/referto/referto.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + experienceId: '', + typesArr : [], + typesIndex : 0, + refertoStatus: false, + paySuccess : false, // 兑换成功显示 + + // 市级选择 + cityArr : [], + cityId : 0, + cityIndex : 0, + + // 区域选择 + regiArr : [], + regiId : 0, + regiIndex : 0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + experienceId: options.id + }) + // 获取申请前置接口 + this.recruitInfo(options.id); + + this.setData({ + paySuccess: true + }) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 申请前置接口 + */ + recruitInfo(id) { + wx.$api.recruit.Enroll(id).then(res => { + let areas = [ + { + city: "请选择城市", + city_id: null, + experience_area_id: null, + surplus: null + } + ] + this.setData({ + typesArr : [{experience_type_id: null, name: "请选择体验内容"}, ...res.data.types], + cityArr : [...areas, ...res.data.areas], + }) + + // 获取区级列表 + this.regilist(res.data.areas[this.data.cityIndex].city_id) + }).catch(err => {}) + }, + + /** + * 市级下拉筛选 + */ + cityDrop(e) { + let city = this.data.cityArr, + index = e.detail.value, + citycode = city[index].city_id + if (index != this.data.cityIndex) { + this.setData({ + cityIndex : index, + cityId : citycode + }) + + // 获取市级列表 + this.regilist(citycode) + } + }, + + /** + * 区列表 + */ + regilist(areaId) { + wx.$api.site.create({ + parent_id: areaId + }).then(res=>{ + this.setData({ + regiArr : [{id: null, name: "请选择区域", parent_id: null}, ...res.data], + regiId : null, + regiIndex : 0 + }) + }) + }, + + /** + * 区下拉筛选 + */ + regiDrop(e) { + let newIndex = e.detail.value + this.setData({ + regiIndex : newIndex, + regiId : this.data.regiArr[newIndex].id + }) + }, + + /** + * 体验内容筛选 + */ + tasteDrop(e) { + let newIndex = e.detail.value + this.setData({ + typesIndex : newIndex + }) + }, + + /** + * 提交表单 + */ + siteform(e) { + let value = e.detail.value + let errMsg = '' + if(this.data.regiId === null) errMsg = "请选择区域" + if(this.data.cityId === null || this.data.cityArr[this.data.cityIndex].experience_area_id === null) errMsg = "请选择城市" + if(this.data.typesArr[this.data.typesIndex].experience_type_id === null) errMsg = "请选择体验内容" + + if(errMsg != ''){ + wx.showToast({ + title: errMsg, + icon : 'none' + }) + return + } + + let data = { + name : value.name, + address : value.address, + city_id : this.data.cityId, + district_id : this.data.regiId, + experience_id : this.data.experienceId, + experience_area_id : this.data.cityArr[this.data.cityIndex].experience_area_id, + experience_type_id : this.data.typesArr[this.data.typesIndex].experience_type_id + } + this.setData({ + disabled: true + }) + wx.$api.recruit.recruitAdd(data).then(res => { + this.setData({ + refertoStatus: true + }) + }).catch(() =>{ + this.setData({ + disabled: false + }) + }) + }, + + /** + * 关闭弹框,跳转首页 + */ + refertoTap() { + this.setData({ + refertoStatus: false + }) + wx.switchTab({ + url: '/pages/recruit/index' + }) + } +}) \ No newline at end of file diff --git a/pages/recruit/referto/referto.json b/pages/recruit/referto/referto.json new file mode 100644 index 0000000..1bb0d43 --- /dev/null +++ b/pages/recruit/referto/referto.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "申请体验馆" +} \ No newline at end of file diff --git a/pages/recruit/referto/referto.wxml b/pages/recruit/referto/referto.wxml new file mode 100644 index 0000000..61b1e58 --- /dev/null +++ b/pages/recruit/referto/referto.wxml @@ -0,0 +1,67 @@ + + + + + + + 活动报名 + activity + +
+ + + + + {{ typesArr[typesIndex].name }} + + + + + + + + + + + + + {{ cityArr[cityIndex].city }} + + + + + + + + + {{ regiArr[regiIndex].name }} + + + + + + + + + + + + 剩余名额为0,不可申请 + +
+ +
+
+
+ + + + + 去面部检测 > + + + + \ No newline at end of file diff --git a/pages/recruit/referto/referto.wxss b/pages/recruit/referto/referto.wxss new file mode 100644 index 0000000..8da6efa --- /dev/null +++ b/pages/recruit/referto/referto.wxss @@ -0,0 +1,250 @@ +page { + background-image: linear-gradient(to top, #6fbaf0, #6fbaf0); + padding-bottom: 50rpx; +} + +.referto-img { + width: 100%; +} + +.referto-cont { + padding: 0 30rpx; + box-sizing: border-box; +} + +.referto-blue { + background-color: #0e55ad; + border-radius: 20rpx; + position: relative; + top: -20rpx; + z-index: 9; +} + +.referto-blue::after, +.referto-blue::before { + position: absolute; + content: ''; + background-color: rgba(14, 85, 173, .2); + left: 20rpx; + border-radius: 20rpx 20rpx 0 0; +} +.referto-blue::after { + z-index: -2; + width: calc(100% - 40rpx); + left: 20rpx; + top: -20rpx; + height: 20rpx; +} +.referto-blue::before { + z-index: -1; + width: calc(100% - 80rpx); + left: 40rpx; + top: -40rpx; + height: 40rpx; +} + +.referto-drop { + padding: 30rpx; + box-sizing: border-box; + position: relative; +} + +.referto-drop image { + width: 40rpx; + position: absolute; + right: 30rpx; +} + +.referto-drop text { + display: inline-block; + width: 20rpx; + height: 20rpx; + border-radius: 50%; + background-color: #ffaf59; + margin-right: 20rpx; +} + +.referto-drop text:nth-child(2) { + background-color: #7fe2ff; +} + +.referto-drop text:nth-child(3) { + background-color: #ffffff; +} + +.referto-white { + background: white; + border-radius: 20rpx; + padding: 30rpx; + position: relative; +} + + +.referto-back { + position: absolute; + bottom: 0; + right: 0; + width: 50%; +} + +.referto-title { + margin-bottom: 30rpx; + display: flex; +} + +.referto-title-name { + flex: 1; + display: inline-block; +} + +.referto-title-name text { + background-color: #1e6dce; + padding: 0 30rpx; + line-height: 68rpx; + font-size: 34rpx; + border-radius: 20rpx 0 20rpx 0; + color: #fff; + display: inline-block; +} + +.referto-title-tips { + text-transform: uppercase; + font-size: 44rpx; + line-height: 68rpx; + color: #eef6ff; +} + +.site-form { + display: block; +} + +.site-input { + position: relative; + line-height: 90rpx; + margin-bottom: 30rpx; +} + +.site-input label text { + color: #ee291b; +} + +.site-input input, +.site-input picker { + width: 100%; + height: 90rpx; + background-color: #f9fcff; + padding: 0 30rpx; + box-sizing: border-box; +} + +.site-input image { + width: 44rpx; + height: 44rpx; + position: absolute; + right: 20rpx; + top: calc(50% + 22rpx); +} + +.site-btn { + padding: 20rpx 30rpx; + margin: 60rpx 0; + text-align: center; + position: relative; + z-index: 2; +} + +.site-btn button[size="mini"], +.site-btn text { + display: inline-block; + background: #1e6dce; + border-radius: 80rpx; + height: 88rpx; + line-height: 88rpx; + font-size: 30rpx; + color: white; + padding: 0 80rpx; +} + +.site-btn.active text { + background: #b4b4b4; +} + +.site-btn button[disabled] { + background: #7789ff !important; + color: #fff !important; +} + +.site-switch { + font-size: 32rpx; + margin: 30rpx; + display: flex; + line-height: 40rpx; +} + +.site-switch text { + flex: 1; +} + +.site-switch-active { + color: #797979; +} + +.site-input textarea { + background-color: #f9fcff; + padding: 30rpx; + width: 100%; + box-sizing: border-box; + min-height: 40rpx; +} + +.refertoEject { + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, .6); + z-index: 1000; + display: none; +} + +.refertoEject.active { + display: block; +} + +.refertoCont { + -webkit-box-orient: vertical; + -webkit-box-pack: center; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 10000; + padding: 0 10%; + box-sizing: border-box; + text-align: center; + display: none; +} + +.refertoCont.active { + display: -webkit-box; +} + +.refertoCont-name { + background-image: linear-gradient(to bottom, #ffb70a, #ff7e1c); + color: #fff; + display: inline-block; + margin-bottom: 50rpx; + padding: 0 60rpx; + border: 4rpx solid #ffffff; + line-height: 80rpx; + border-radius: 90rpx; + font-size: 34rpx; +} + +.refertoCont-close { + width: 68rpx; + display: block; + margin: 0 auto; +} \ No newline at end of file diff --git a/pages/report/detail/detail.js b/pages/report/detail/detail.js index 25efa08..c4c1166 100644 --- a/pages/report/detail/detail.js +++ b/pages/report/detail/detail.js @@ -9,6 +9,7 @@ const max = 200; // 最大宽度  单位px Page({ data: { + Type : '', //接口来源 barHeight : getApp().globalData.barHeight, // 状态栏高度 isFixedTop : 0, loading : true, @@ -36,6 +37,11 @@ Page({ }, onLoad(options) { + console.log(options) + this.setData({ + Type: options.type + }) + this.setData({ imageId: options.image_id }) diff --git a/pages/report/detail/detail.wxml b/pages/report/detail/detail.wxml index 0a942a1..58b2d73 100644 --- a/pages/report/detail/detail.wxml +++ b/pages/report/detail/detail.wxml @@ -380,7 +380,11 @@ - + + 返回首页 + 产品推荐 + + 邀请好友 产品推荐 diff --git a/project.config.json b/project.config.json index bfdbf9f..80b5f41 100644 --- a/project.config.json +++ b/project.config.json @@ -45,7 +45,7 @@ }, "compileType": "miniprogram", "libVersion": "2.17.0", - "appid": "wx6bd4fcc040bfa025", + "appid": "wx3056ec23196eaf02", "projectname": "miniprogram-92", "condition": {}, "editorSetting": { diff --git a/project.private.config.json b/project.private.config.json index dab4086..57047fb 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -59,8 +59,8 @@ }, { "name": "", - "pathName": "pages/health/article/article", - "query": "id=2", + "pathName": "pages/user/code/code", + "query": "", "launchMode": "default", "scene": null }, @@ -70,6 +70,13 @@ "query": "", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/recruit/referto/referto", + "query": "", + "launchMode": "default", + "scene": null } ] } diff --git a/static/icons/refertoEdit.png b/static/icons/refertoEdit.png new file mode 100644 index 0000000..3124d75 Binary files /dev/null and b/static/icons/refertoEdit.png differ diff --git a/static/icons/rejectIcon.png b/static/icons/rejectIcon.png new file mode 100644 index 0000000..9a66c99 Binary files /dev/null and b/static/icons/rejectIcon.png differ diff --git a/static/tabBarIcon/tabBar_04.png b/static/tabBarIcon/tabBar_04.png new file mode 100644 index 0000000..7492d1e Binary files /dev/null and b/static/tabBarIcon/tabBar_04.png differ diff --git a/static/tabBarIcon/tabBar_selected_04.png b/static/tabBarIcon/tabBar_selected_04.png new file mode 100644 index 0000000..0401cbe Binary files /dev/null and b/static/tabBarIcon/tabBar_selected_04.png differ