[新增体验官]

This commit is contained in:
2023-07-07 19:00:27 +08:00
parent 7309679527
commit cc5d559bef
26 changed files with 1473 additions and 549 deletions

View File

@@ -1,39 +1,43 @@
/* /*
* 手太欠 * 手太欠
* 愿这世界都如故事里一样 美好而动人~ * 愿这世界都如故事里一样 美好而动人~
*/ */
// 授权登录 // 授权登录
import auth from "./interfaces/auth" import auth from "./interfaces/auth"
// 图片上传 // 图片上传
import file from "./interfaces/file" import file from "./interfaces/file"
// 皮肤健康知识 // 皮肤健康知识
import health from "./interfaces/health" import health from "./interfaces/health"
// 首页 // 首页
import index from "./interfaces/index" import index from "./interfaces/index"
// 产品 // 产品
import mall from "./interfaces/mall" import mall from "./interfaces/mall"
// 订单 // 订单
import order from "./interfaces/order" import order from "./interfaces/order"
// 地址管理 // 体验官
import site from "./interfaces/site" import recruit from "./interfaces/recruit"
// 个人中心 // 地址管理
import user from "./interfaces/user" import site from "./interfaces/site"
export default { // 个人中心
auth, import user from "./interfaces/user"
file,
health, export default {
index, auth,
mall, file,
order, health,
site, index,
user mall,
order,
recruit,
site,
user
} }

View File

@@ -1,41 +1,42 @@
/* /*
* 手太欠 * 手太欠
* 愿这世界都如故事里一样 美好而动人~ * 愿这世界都如故事里一样 美好而动人~
*/ */
import { req, upload } from "../request" import { req, upload } from "../request"
// 是否可以检测
const analyze = () => req({ // 是否可以检测
url: "ai/skin/analyze" const analyze = () => req({
}) url: "ai/skin/analyze"
})
// 创建检测订单
const skinOrder = () => req({ // 创建检测订单
url : "ai/skin/order", const skinOrder = () => req({
method: "POST", url : "ai/skin/order",
}) method: "POST",
})
// 检测订单支付
const skinPay = (order_id, data) => req({ // 检测订单支付
url : "ai/pay/" + order_id + "/wechat", const skinPay = (order_id, data) => req({
data: data, url : "ai/pay/" + order_id + "/wechat",
}) data: data,
})
// 皮肤检测
const skinEnter = (data, path) => { // 皮肤检测
return upload({ const skinEnter = (data, path) => {
url : "ai/skin/analyze", return upload({
key : "image", url : "ai/skin/analyze",
path : path, key : "image",
data : data, path : path,
method : "POST", data : data,
}) method : "POST",
} })
}
export default ({
analyze, export default ({
skinOrder, analyze,
skinPay, skinOrder,
skinEnter skinPay,
skinEnter
}) })

30
api/interfaces/recruit.js Normal file
View File

@@ -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
})

View File

@@ -1,58 +1,58 @@
/* /*
* 手太欠 * 手太欠
* 愿这世界都如故事里一样 美好而动人~ * 愿这世界都如故事里一样 美好而动人~
*/ */
import { req } from "../request" import { req } from "../request"
// 收获地址(列表) // 收获地址(列表)
const siteList = () => req({ const siteList = () => req({
url: "mall/addresses" url: "mall/addresses"
}) })
// 省市区-获取 // 省市区-获取
const create = data => req({ const create = data => req({
url: "mall/addresses/create", url: "mall/addresses/create",
data: data data: data
}) })
// 新增地址 // 新增地址
const siteAdd = data => req({ const siteAdd = data => req({
url: "mall/addresses", url: "mall/addresses",
data: data, data: data,
method: 'POST' method: 'POST'
}) })
// 地址详细 // 地址详细
const siteSee = (address) => req({ const siteSee = (address) => req({
url: "mall/addresses/" + address url: "mall/addresses/" + address
}) })
// 编辑地址 // 编辑地址
const siteEdit = (address, data) => req({ const siteEdit = (address, data) => req({
url: "mall/addresses/" + address, url: "mall/addresses/" + address,
data: data, data: data,
method: 'PUT' method: 'PUT'
}) })
// 删除地址 // 删除地址
const siteDel = (address) => req({ const siteDel = (address) => req({
url: "mall/addresses/" + address, url: "mall/addresses/" + address,
method: 'DELETE' method: 'DELETE'
}) })
// 设置默认地址 // 设置默认地址
const siteDefault = (address) => req({ const siteDefault = (address) => req({
url: "mall/addresses/" + address + "/default", url: "mall/addresses/" + address + "/default",
method: 'POST' method: 'POST'
}) })
export default ({ export default ({
siteList, siteList,
create, create,
siteAdd, siteAdd,
siteSee, siteSee,
siteEdit, siteEdit,
siteDel, siteDel,
siteDefault siteDefault
}) })

View File

@@ -1,139 +1,140 @@
/* /*
* 手太欠 * 手太欠
* 愿这世界都如故事里一样 美好而动人~ * 愿这世界都如故事里一样 美好而动人~
*/ */
import {errInfo} from './err' import {errInfo} from './err'
import {updToken} from './updateToken' import {updToken} from './updateToken'
// 请求方式配置 // 请求方式配置
// https://api.shui.shuiganying.com/api //正式地址 // https://api.shui.shuiganying.com/api //正式地址
// https://shuitest.shuiganying.com/api //测试地址 // https://shuitest.shuiganying.com/api //测试地址
// wx6bd4fcc040bfa025 正式appid // wx6bd4fcc040bfa025 正式appid
// wx3056ec23196eaf02 测试appid // wx3056ec23196eaf02 测试appid
const api = "https://api.shui.shuiganying.com/api/" // 正式环境 // const api = "https://api.shui.shuiganying.com/api/" // 正式环境
// const api = "https://shuitest.shuiganying.com/api/" // 测试环境 const api = "https://shuitest.shuiganying.com/api/" // 测试环境
const header = { const header = {
"Accept" : "application/json" "Accept" : "application/json"
} }
let isToken = true let isToken = true
/** /**
* 请求 * 请求
* @property {Object} req * @property {Object} req
*/ */
const req = (obj, noToken) => { const req = (obj, noToken) => {
// 检查是否无需要token // 检查是否无需要token
if(noToken != undefined){ if(noToken != undefined){
isToken = noToken isToken = noToken
} }
// header // header
if(obj.token){ if(obj.token){
header.Authorization = obj.token || '' header.Authorization = obj.token || ''
} else { } else {
header.Authorization = wx.getStorageSync("token") || "" header.Authorization = wx.getStorageSync("token") || ""
} }
// 处理请求信息 // 处理请求信息
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 组合header // 组合header
obj.header = { obj.header = {
"Accept" : "application/json", "Accept" : "application/json",
"channel" : "client", "channel" : "client",
"Authorization" : wx.getStorageSync("token") || "" "Authorization" : wx.getStorageSync("token") || ""
} }
if(!isToken){ if(!isToken){
obj.header.Authorization = '' obj.header.Authorization = ''
} }
wx.request({ wx.request({
url : api + obj.url, timeout: '13000',
header : obj.header || {}, url : api + obj.url,
method : obj.method || 'GET', header : obj.header || {},
data : obj.data || {}, method : obj.method || 'GET',
success : res => { data : obj.data || {},
// 更新token success : res => {
if (res.header.Authorization) updToken(res.header.Authorization) // 更新token
// 处理信息 if (res.header.Authorization) updToken(res.header.Authorization)
if (res.data.status_code == 200) { // 处理信息
resolve(res.data) if (res.data.status_code == 200) {
} else { resolve(res.data)
if (res.data.status_code == 401 || res.data.status_code == 400) { } else {
reject({ if (res.data.status_code == 401 || res.data.status_code == 400) {
login : false, reject({
codeBeen: false login : false,
}) codeBeen: false
} })
reject(res) }
errInfo(res.data) reject(res)
} errInfo(res.data)
}, }
fail: err => { },
wx.showToast({ fail: err => {
title : err.errMsg, wx.showToast({
icon : "none" title : (err.errMsg).indexOf('108') > 0 ? "网络错误,请检查您的网络环境" : err.errMsg,
}) icon : "none"
reject(err) })
}, reject(err)
complete(){ },
if(!isToken) isToken = true complete(){
} if(!isToken) isToken = true
}) }
}) })
} })
}
/**
* 上传 /**
* @property {Object} upload * 上传
*/ * @property {Object} upload
*/
const upload = (obj) => {
// header const upload = (obj) => {
header.Authorization = wx.getStorageSync("token") || "" // header
// 处理上传信息 header.Authorization = wx.getStorageSync("token") || ""
return new Promise((resolve, reject) => { // 处理上传信息
wx.showLoading({ return new Promise((resolve, reject) => {
title: "上传中..", wx.showLoading({
mask: true title: "上传中..",
}) mask: true
wx.uploadFile({ })
url : api + obj.url, wx.uploadFile({
header : header, url : api + obj.url,
name : obj.key || "", header : header,
filePath: obj.path || "", name : obj.key || "",
formData: obj.data || {}, filePath: obj.path || "",
success : res=>{ formData: obj.data || {},
wx.hideLoading(); success : res=>{
// 处理返回值 wx.hideLoading();
let jsonData = JSON.parse(res.data) // 处理返回值
// 更新token let jsonData = JSON.parse(res.data)
if (res.header.Authorization) updToken(res.header.Authorization) // 更新token
// 处理信息 if (res.header.Authorization) updToken(res.header.Authorization)
if (jsonData.status_code == 200) { // 处理信息
resolve(jsonData.data) if (jsonData.status_code == 200) {
} else { resolve(jsonData.data)
if (jsonData.status_code == 401) { } else {
reject({ if (jsonData.status_code == 401) {
login: false reject({
}) login: false
} })
errInfo(jsonData) }
} errInfo(jsonData)
}, }
fail : err=>{ },
wx.showToast({ fail : err=>{
title : err.errMsg, wx.showToast({
icon : "none" title : err.errMsg,
}) icon : "none"
reject(err) })
} reject(err)
}) }
}) })
} })
}
module.exports = {
req, module.exports = {
upload req,
upload
} }

3
app.js
View File

@@ -52,6 +52,7 @@ App({
isUser : false, isUser : false,
userInfo : null, userInfo : null,
barHeight: '', barHeight: '',
inviteText: '' // 邀请好友临时存储 inviteText: '', // 邀请好友临时存储
isExperience: '' // 体验官身份
} }
}) })

View File

@@ -29,7 +29,9 @@
"pages/login/personal/personal", "pages/login/personal/personal",
"pages/login/agreement/agreement", "pages/login/agreement/agreement",
"pages/mall/webView/webView", "pages/mall/webView/webView",
"pages/order/logistic/logistic" "pages/order/logistic/logistic",
"pages/recruit/index",
"pages/recruit/referto/referto"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
@@ -51,6 +53,12 @@
"iconPath": "/static/tabBarIcon/tabBar_01.png", "iconPath": "/static/tabBarIcon/tabBar_01.png",
"selectedIconPath": "/static/tabBarIcon/tabBar_selected_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", "pagePath": "pages/report/index",
"text": "报告", "text": "报告",

View File

@@ -1,239 +1,250 @@
/* /*
* 手太欠 * 手太欠
* 愿这世界都如故事里一样 美好而动人~ * 愿这世界都如故事里一样 美好而动人~
*/ */
Page({ Page({
data: { data: {
barHeight : getApp().globalData.barHeight, // 状态栏高度 barHeight : getApp().globalData.barHeight, // 状态栏高度
openId : '', openId : '',
nameValue : '', // 姓名 nameValue : '', // 姓名
testTitle : '', testTitle : '',
nameStatus: false, // 姓名填写弹框 nameStatus : false, // 姓名填写弹框
Analyze : '', // 是否交钱 Analyze : '', // 是否交钱
disabled : false, // 支付按钮 disabled : false, // 支付按钮
payStatus : false, // 支付弹框 payStatus : false, // 支付弹框
payPrice : '', // 支付金额 payPrice : '', // 支付金额
}, refertoType: 0,
},
onLoad(options) {
this.setData({ onLoad(options) {
openId: options.code // 体验官 type=1或者type=2 直接面检,不用交钱
}) this.setData({
if(options) { refertoType: options.type
wx.login({ })
success: res => { this.setData({
// 获取openid openId: options.code
this.openInfo(res.code) })
} if(options) {
}) wx.login({
} success: res => {
}, // 获取openid
this.openInfo(res.code)
onShow() { }
// 判断是否可检测 })
this.ifAnalyze(); }
}, },
onShow() {
/** if(this.data.refertoType == '1' || this.data.refertoType == '2') {
* openid this.setData({
*/ testTitle: '请您开始测肤'
openInfo(code) { })
wx.$api.auth.codeOpenid({code: code}).then(res => { return
this.setData({ }
openId: res.data
}) // 判断是否可检测
}).catch(err => {}) this.ifAnalyze();
}, },
/**
* 是否可检测 /**
*/ * openid
ifAnalyze() { */
wx.$api.index.analyze().then(res => { openInfo(code) {
if(res.data.is_first) { wx.$api.auth.codeOpenid({code: code}).then(res => {
this.setData({ this.setData({
testTitle: '首次免费,开始测肤' openId: res.data
}) })
} else if (res.data.is_first == false && res.data.analyze == false) { }).catch(err => {})
this.setData({ },
testTitle: '支付' + res.data.price + '元,进行测肤'
}) /**
} else if (res.data.is_first == false && res.data.analyze == true) { * 是否可检测
this.setData({ */
testTitle: '您已付费,进行检测' ifAnalyze() {
}) wx.$api.index.analyze().then(res => {
} if(res.data.is_first) {
this.setData({
this.setData({ testTitle: '首次免费,开始测肤'
Analyze : res.data })
}) } else if (res.data.is_first == false && res.data.analyze == false) {
if(!res.data.is_update) { this.setData({
this.setData({ testTitle: '支付' + res.data.price + '元,进行测肤'
nameStatus: true })
}) } else if (res.data.is_first == false && res.data.analyze == true) {
} this.setData({
}).catch(err => {}) testTitle: '您已付费,进行检测'
}, })
}
/*
姓名截取 this.setData({
*/ Analyze : res.data
bindinput(e) { })
this.setData({ if(!res.data.is_update) {
nameValue: e.detail.value.substr(0,5) this.setData({
}) nameStatus: true
}, })
}
/* }).catch(err => {})
提交信息 },
*/
issueForm() { /*
wx.showLoading({ 姓名截取
title: '信息提交中...', */
mask : true bindinput(e) {
}) this.setData({
let data = { nameValue: e.detail.value.substr(0,5)
name : this.data.nameValue })
} },
wx.$api.auth.userAdd(data).then(() => {
wx.hideLoading() /*
this.setData({ 提交信息
nameStatus: false */
}) issueForm() {
}).catch(err => {}) wx.showLoading({
}, title: '信息提交中...',
mask : true
/** })
* 开始皮肤检测 let data = {
*/ name : this.data.nameValue
goAnalyze() { }
if(this.data.Analyze.is_first == false && this.data.Analyze.analyze == false) { wx.$api.auth.userAdd(data).then(() => {
this.setData({ wx.hideLoading()
payStatus: true this.setData({
}) nameStatus: false
} else { })
this.uploadPhoto() }).catch(err => {})
} },
},
/**
/** * 开始皮肤检测
* 上传图片信息 */
*/ goAnalyze() {
uploadPhoto() { if(this.data.Analyze.is_first == false && this.data.Analyze.analyze == false) {
wx.chooseMedia({ this.setData({
count : 1, payStatus: true
sourceType: ['camera'], })
camera : 'front', } else {
success : path => { this.uploadPhoto()
// 获取皮肤检测接口 }
if(wx.cropImage){ },
wx.cropImage({
src: path.tempFiles[0].tempFilePath, // 图片路径 /**
cropScale: '3:4', // 裁剪比例 * 上传图片信息
success: res=> { */
// 获取皮肤检测接口 uploadPhoto() {
this.checkEnter(res.tempFilePath); wx.chooseMedia({
}, count : 1,
complete: err => {} sourceType: ['camera'],
}) camera : 'front',
return success : path => {
} // 获取皮肤检测接口
this.checkEnter(path.tempFiles[0].tempFilePath); if(wx.cropImage){
} wx.cropImage({
}) src: path.tempFiles[0].tempFilePath, // 图片路径
}, cropScale: '3:4', // 裁剪比例
success: res=> {
/** // 获取皮肤检测接口
* 皮肤检测接口 this.checkEnter(res.tempFilePath);
*/ },
checkEnter(img) { complete: err => {}
wx.$api.index.skinEnter({}, img).then(res => { })
wx.redirectTo({ return
url: "/pages/report/detail/detail?image_id=" + res.image_id }
}) this.checkEnter(path.tempFiles[0].tempFilePath);
}) }
}, })
},
/** /**
* 关闭支付弹窗 * 皮肤检测接口
*/ */
cancelAnalyze() { checkEnter(img) {
this.setData({ wx.$api.index.skinEnter({type: this.data.refertoType}, img).then(res => {
payStatus: false wx.redirectTo({
}) url: "/pages/report/detail/detail?image_id=" + res.image_id + "&type=" + this.data.refertoType
}, })
})
/** },
* 创建订单
*/ /**
payFound() { * 关闭支付弹窗
wx.$api.index.skinOrder().then(res => { */
this.setData({ cancelAnalyze() {
disabled : true this.setData({
}) payStatus: false
this.payBtn(res.data.order_id) })
}).catch(err => {}) },
},
/**
/** * 创建订单
* 确认支付1元 */
*/ payFound() {
payBtn(orderid) { wx.$api.index.skinOrder().then(res => {
wx.showLoading({ this.setData({
title: '支付中...', disabled : true
mask : true })
}) this.payBtn(res.data.order_id)
wx.$api.index.skinPay(orderid,{type: 'miniapp', openid: this.data.openId}).then(res=>{ }).catch(err => {})
wx.hideLoading() },
let payInfo = JSON.parse(res.data.wechat)
wx.requestPayment({ /**
timeStamp: payInfo.timeStamp, * 确认支付1元
nonceStr : payInfo.nonceStr, */
package : payInfo.package, payBtn(orderid) {
paySign : payInfo.paySign, wx.showLoading({
signType : payInfo.signType, title: '支付中...',
success : res=>{ mask : true
if(res.errMsg == "requestPayment:ok"){ })
wx.showToast({ wx.$api.index.skinPay(orderid,{type: 'miniapp', openid: this.data.openId}).then(res=>{
title: '支付成功', wx.hideLoading()
icon : 'success' let payInfo = JSON.parse(res.data.wechat)
}) wx.requestPayment({
} timeStamp: payInfo.timeStamp,
this.setData({ nonceStr : payInfo.nonceStr,
payStatus: false package : payInfo.package,
}) paySign : payInfo.paySign,
this.setData({ signType : payInfo.signType,
Analyze: false success : res=>{
}) if(res.errMsg == "requestPayment:ok"){
this.uploadPhoto() wx.showToast({
}, title: '支付成功',
fail : err=>{ icon : 'success'
wx.showToast({ })
title: '支付失败', }
icon : 'error' this.setData({
}) payStatus: false
this.setData({ })
disabled : false, this.setData({
payStatus: false Analyze: false
}) })
} this.uploadPhoto()
}) },
}).catch(err => { fail : err=>{
this.setData({ wx.showToast({
disabled : false, title: '支付失败',
payStatus: false icon : 'error'
}) })
}); this.setData({
}, disabled : false,
payStatus: false
/** })
* 返回上一页 }
*/ })
returnGo() { }).catch(err => {
wx.navigateBack({ this.setData({
delta: 1 disabled : false,
}) payStatus: false
}, })
}) });
},
/**
* 返回上一页
*/
returnGo() {
wx.navigateBack({
delta: 1
})
},
})

View File

@@ -1,30 +1,30 @@
<!-- 第一屏幕 --> <!-- 第一屏幕 -->
<!-- bindtap="assessGo" --> <!-- bindtap="assessGo" -->
<view class="indexBack"> <view class="indexBack">
<image class="indexBack-img" src="https://cdn.shuiganying.com/images/2023/05/17/d8be509c6ce2bd268967388621bc095a.png"></image> <image class="indexBack-img" src="https://cdn.shuiganying.com/images/2023/05/17/d8be509c6ce2bd268967388621bc095a.png"></image>
<view class="indexText"> <view class="indexText">
<view class="indexText-name">下滑了解详情</view> <view class="indexText-name">下滑了解详情</view>
<image class="indexText-arrow" src="https://cdn.shuiganying.com/images/2023/05/16/d323c1a5d97c0c566126e3a2ff7f1827.png"></image> <image class="indexText-arrow" src="https://cdn.shuiganying.com/images/2023/05/16/d323c1a5d97c0c566126e3a2ff7f1827.png"></image>
</view> </view>
</view> </view>
<!-- 漂浮窗 --> <!-- 漂浮窗 -->
<view class="wander" bindtap="assessGo"> <view class="wander" bindtap="assessGo">
<view class="wander-cont"> <view class="wander-cont">
<image class="wander-icon" src="https://cdn.shuiganying.com/images/2023/05/16/e69134d810039f1c9bfe9111036d92fb.png" mode="widthFix"></image> <image class="wander-icon" src="https://cdn.shuiganying.com/images/2023/05/16/e69134d810039f1c9bfe9111036d92fb.png" mode="widthFix"></image>
<view class="wander-name">检测</view> <view class="wander-name">检测</view>
</view> </view>
</view> </view>
<!-- 单图 --> <!-- 单图 -->
<view class="indexSingle"> <view class="indexSingle">
<image class="indexSingle-img" mode="widthFix" src="https://cdn.shuiganying.com/images/2023/05/18/ac3182087d2607104409f3fc988514c6.gif"></image> <image class="indexSingle-img" mode="widthFix" src="https://cdn.shuiganying.com/images/2023/05/18/ac3182087d2607104409f3fc988514c6.gif"></image>
<image class="indexSingle-img" style="margin-top: -280rpx;" mode="widthFix" src="https://cdn.shuiganying.com/images/2023/05/18/a6dee6dbb61b03ffe0ca55896a77a4d4.png"></image> <image class="indexSingle-img" style="margin-top: -280rpx;" mode="widthFix" src="https://cdn.shuiganying.com/images/2023/05/18/a6dee6dbb61b03ffe0ca55896a77a4d4.png"></image>
<image class="indexSingle-img" mode="widthFix" src="https://cdn.shuiganying.com/images/2023/07/01/142307c731c974a66f7d802087b361f8.png"></image> <image class="indexSingle-img" mode="widthFix" src="https://cdn.shuiganying.com/images/2023/07/01/142307c731c974a66f7d802087b361f8.png"></image>
<image class="indexSingle-img" mode="widthFix" src="https://cdn.shuiganying.com/images/2023/05/17/88be57f403db19a0413b93045bd406d8.png"></image> <image class="indexSingle-img" mode="widthFix" src="https://cdn.shuiganying.com/images/2023/05/17/88be57f403db19a0413b93045bd406d8.png"></image>
</view> </view>
<view class="testBtn"> <view class="testBtn">
<image class="indexText-arrow" src="https://cdn.shuiganying.com/images/2023/05/16/a72e053db51bc68bed00168047d2cb3e.png"></image> <image class="indexText-arrow" src="https://cdn.shuiganying.com/images/2023/05/16/a72e053db51bc68bed00168047d2cb3e.png"></image>
<view class="testBtn-go" bindtap="assessGo">{{userLogin ? testTitle : '立即开启皮肤检测'}}</view> <view class="testBtn-go" bindtap="assessGo">{{userLogin ? testTitle : '立即开启皮肤检测'}}</view>
</view> </view>

View File

@@ -81,7 +81,8 @@ Page({
code : this.data.loginCode, code : this.data.loginCode,
encryptedData : enData, encryptedData : enData,
iv : iv, iv : iv,
invite : getApp().globalData.inviteText || '' invite : getApp().globalData.inviteText || '',
is_experience : getApp().globalData.isExperience
}).then(res=>{ }).then(res=>{
// 存储登录信息 // 存储登录信息
wx.setStorage({ wx.setStorage({

73
pages/recruit/index.js Normal file
View File

@@ -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 => {}
})
}
})

4
pages/recruit/index.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationStyle": "custom"
}

71
pages/recruit/index.wxml Normal file
View File

@@ -0,0 +1,71 @@
<image class="recruit-title" src="https://cdn.shuiganying.com/images/2023/07/07/0ff31357e1b3c2237bbb797a07c9a418.png" mode="widthFix"></image>
<view class="recruit">
<image class="recruit-back" src="https://cdn.shuiganying.com/images/2023/07/07/a39118138469ebd5ca31eb316ff355aa.png" mode="widthFix"></image>
<view class="recruit-cont">
<view class="recruit-padding">
<view class="recruit-block">
<view class="recruit-border">
<image class="recruit-img" src="https://cdn.shuiganying.com/images/2023/07/07/843c66b3a2cfcec3c1aff664029d32a8.png" mode="widthFix"></image>
<view class="recruit-white">
<view class="recruit-label">
<view class="recruit-title">
<view class="recruit-name">招募人数</view>
<view class="recruit-data">{{recruitData.total}}人</view>
</view>
</view>
<view class="recruit-label">
<view class="recruit-title">
<view class="recruit-name">招募时间</view>
<view class="recruit-data">{{recruitData.start_at}}</view>
</view>
<view class="recruit-text">即日起开始报名{{recruitData.total}}人,人满为止</view>
</view>
<view class="recruit-label">
<view class="recruit-title">
<view class="recruit-name">招募时间</view>
</view>
<view class="recruit-text">剩余名额</view>
<view class="recruit-number">
<view class="recruit-see" wx:for="{{recruitData.surplus.array}}" wx:key="surplus">
<image class="recruit-see-img" src="https://cdn.shuiganying.com/images/2023/07/07/ffd0beb9825b9191c0ed2a17e07d57f4.png" mode="widthFix"></image>
<text class="recruit-see-text">{{item}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 流程 -->
<view class="recruit-flow">
<image class="recruit-flow-img" src="https://cdn.shuiganying.com/images/2023/07/07/3f13e7baa0d18da70d40e632572dad84.png" mode="widthFix"></image>
</view>
<view class="recruit-block">
<view class="recruit-border">
<image class="recruit-img" src="https://cdn.shuiganying.com/images/2023/07/07/76d648d27c8700798cbb96a81d7f2a52.png" mode="widthFix"></image>
</view>
</view>
<!-- 按钮 -->
<view class="recruit-btn">
<block wx:if="{{recruitData.is_show_button}}">
<image class="recruit-btn-img {{recruitData.can.status >= 2 ? 'active' : ''}}" src="https://cdn.shuiganying.com/images/2023/07/07/327b691cd8129d8945790fd2e7c34497.png" mode="widthFix"></image>
<view class="recruit-btn-text" wx:if="{{recruitData.can.status >= 2 ? 'active' : ''}}">{{recruitData.can.text}}</view>
<view class="recruit-btn-text" bindtap="applyGo" wx:else>{{recruitData.can.text}}</view>
</block>
<block wx:else>
<image class="recruit-btn-img active" src="https://cdn.shuiganying.com/images/2023/07/07/327b691cd8129d8945790fd2e7c34497.png" mode="widthFix"></image>
<view class="recruit-btn-text">暂无申请权限</view>
</block>
</view>
<view class="reject-tips" bindtap="rejectGo" wx:if="{{recruitData.can.status == 3}}">查看驳回原因</view>
<!-- <image src="/static/icons/rejectIcon.png" mode="widthFix"></image> -->
</view>
<!-- 底部 -->
<view class="recruit-bottom">
<image class="recruit-bottom-img" src="https://cdn.shuiganying.com/images/2023/07/07/99bbdab2c12d05bb267fb43886f6a5b6.png" mode="widthFix"></image>
<view class="recruit-bottom-text">水感应·好“雾”星球</view>
</view>
</view>
</view>

205
pages/recruit/index.wxss Normal file
View File

@@ -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;
} */

View File

@@ -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'
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "申请体验馆"
}

View File

@@ -0,0 +1,67 @@
<image class="referto-img" src="https://cdn.shuiganying.com/images/2023/07/07/80b66f6a79ff3ef3dc6b32ae1b9d1abf.png" mode="widthFix"></image>
<view class="referto-cont">
<view class="referto-blue">
<view class="referto-drop"><text></text><text></text><text></text><image src="/static/icons/refertoEdit.png" mode="widthFix"></image></view>
<view class="referto-white">
<view class="referto-title">
<view class="referto-title-name"><text>活动报名</text></view>
<view class="referto-title-tips">activity</view>
</view>
<form bindsubmit="siteform" class="site-form">
<view class="site-input">
<label>体验内容</label>
<picker bindchange="tasteDrop" value="{{typesIndex}}" range="{{typesArr}}" range-key="name" class="conneColor">
<view class="picker">
{{ typesArr[typesIndex].name }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>姓名</label>
<input placeholder="请输入姓名" name="name" type="text"></input>
</view>
<view class="site-input">
<label>选择城市 <text wx:if="{{cityIndex > 0}}">({{'此地区剩余名额' + cityArr[cityIndex].surplus + '人'}})</text></label>
<picker bindchange="cityDrop" value="{{cityIndex}}" range="{{cityArr}}" range-key="city" class="conneColor">
<view class="picker">
{{ cityArr[cityIndex].city }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>选择区域</label>
<picker bindchange="regiDrop" value="{{regiIndex}}" range="{{regiArr}}" range-key="name" class="conneColor">
<view class="picker">
{{ regiArr[regiIndex].name }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<input placeholder="请输入详细地址" name="address" type="text"></input>
</view>
<view class="site-btn" wx:if="{{cityArr[cityIndex].surplus != 0}}">
<button form-type="submit" size="mini" disabled="{{disabled}}">提交申请</button>
</view>
<view class="site-btn active" wx:else>
<text>剩余名额为0不可申请</text>
</view>
</form>
<image class="referto-back" src="https://cdn.shuiganying.com/images/2023/07/07/5a376e923d0ba914c307d7f33da2ab7d.png" mode="widthFix"></image>
</view>
</view>
</view>
<view class="refertoEject {{refertoStatus ? 'active' : ''}}" catchtouchmove='true'></view>
<view class="refertoCont {{refertoStatus ? 'active' : ''}}" catchtouchmove='true'>
<image class="refertoCont-img" src="https://cdn.shuiganying.com/images/2023/07/07/0a62178990571065b1332066abdfa09f.png" mode="widthFix"></image>
<navigator class="refertoCont-name" hover-class="none" url="/pages/index/assess/assess?type=1" open-type="reLaunch">去面部检测 ></navigator>
<image class="refertoCont-close" bindtap="refertoTap" src="https://cdn.shuiganying.com/images/2023/07/07/f9975891c1efa9b5fcd59fe33a75ed60.png" mode="widthFix"></image>
</view>
<!-- <view class="pack-center pages-hint grey" wx:if="{{paySuccess}}">
<image src="/static/icons/loadingGif.gif"></image>
<view>疯狂加载中...</view>
</view> -->

View File

@@ -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;
}

View File

@@ -9,6 +9,7 @@ const max = 200; // 最大宽度  单位px
Page({ Page({
data: { data: {
Type : '', //接口来源
barHeight : getApp().globalData.barHeight, // 状态栏高度 barHeight : getApp().globalData.barHeight, // 状态栏高度
isFixedTop : 0, isFixedTop : 0,
loading : true, loading : true,
@@ -36,6 +37,11 @@ Page({
}, },
onLoad(options) { onLoad(options) {
console.log(options)
this.setData({
Type: options.type
})
this.setData({ this.setData({
imageId: options.image_id imageId: options.image_id
}) })

View File

@@ -380,7 +380,11 @@
<!-- 按钮 --> <!-- 按钮 -->
<view class="footer {{footerPop ? 'active' : ''}}"> <view class="footer {{footerPop ? 'active' : ''}}">
<view class="footer-flex"> <view class="footer-flex" wx:if="{{Type == '1' || Type == '2'}}">
<navigator hover-class="none" url="/pages/index/index" class="footer-flex-btn footer-flex-share" open-type="switchTab">返回首页</navigator>
<navigator hover-class="none" url="/pages/mall/index" open-type="switchTab" class="footer-flex-btn">产品推荐</navigator>
</view>
<view class="footer-flex" wx:else>
<navigator hover-class="none" url="../share/share" class="footer-flex-btn footer-flex-share">邀请好友</navigator> <navigator hover-class="none" url="../share/share" class="footer-flex-btn footer-flex-share">邀请好友</navigator>
<navigator hover-class="none" url="/pages/mall/index" open-type="switchTab" class="footer-flex-btn">产品推荐</navigator> <navigator hover-class="none" url="/pages/mall/index" open-type="switchTab" class="footer-flex-btn">产品推荐</navigator>
</view> </view>

View File

@@ -45,7 +45,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.17.0", "libVersion": "2.17.0",
"appid": "wx6bd4fcc040bfa025", "appid": "wx3056ec23196eaf02",
"projectname": "miniprogram-92", "projectname": "miniprogram-92",
"condition": {}, "condition": {},
"editorSetting": { "editorSetting": {

View File

@@ -59,8 +59,8 @@
}, },
{ {
"name": "", "name": "",
"pathName": "pages/health/article/article", "pathName": "pages/user/code/code",
"query": "id=2", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
@@ -70,6 +70,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/recruit/referto/referto",
"query": "",
"launchMode": "default",
"scene": null
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
static/icons/rejectIcon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB