26 changed files with 634 additions and 59 deletions
@ -1,6 +1,7 @@ |
|||||
VUE_APP_NODE_ENV=development |
VUE_APP_NODE_ENV=development |
||||
VUE_APP_BASE_URL=https://www.tall.wiki |
VUE_APP_BASE_URL=https://test.tall.wiki |
||||
VUE_APP_API_URL=https://www.tall.wiki/gateway |
VUE_APP_API_URL=https://test.tall.wiki/gateway |
||||
VUE_APP_MSG_URL=wss://www.tall.wiki/websocket/message/v4.0/ws |
VUE_APP_MSG_URL=wss://test.tall.wiki/websocket/message/v4.0/ws |
||||
VUE_APP_PROJECT_PATH=https://www.tall.wiki/tall-project |
VUE_APP_PROJECT_PATH=https://test.tall.wiki/tall-project |
||||
|
VUE_APP_YY_API_URL=http://192.168.0.99/gateway |
||||
VUE_APP_VERSION=v3.2.0 |
VUE_APP_VERSION=v3.2.0 |
||||
|
|||||
@ -1,11 +1,16 @@ |
|||||
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ |
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ |
||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 |
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 |
||||
"version": "0.0", |
"version": "0.0", |
||||
"configurations": [{ |
"configurations": [{ |
||||
"type": "uniCloud", |
"default" : |
||||
"default": { |
{ |
||||
"launchtype": "local" |
"launchtype" : "local" |
||||
} |
}, |
||||
} |
"mp-weixin" : |
||||
|
{ |
||||
|
"launchtype" : "local" |
||||
|
}, |
||||
|
"type" : "uniCloud" |
||||
|
} |
||||
] |
] |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,30 @@ |
|||||
|
const url = process.env.VUE_APP_YY_API_URL; |
||||
|
|
||||
|
const yanyuan = `${url}/yanyuan/v2.0`; |
||||
|
|
||||
|
const install = (Vue, vm) => { |
||||
|
vm.$u.api = { ...vm.$u.api } || {}; |
||||
|
// 填写用户信息
|
||||
|
vm.$u.api.addTrainee = param => vm.$u.post(`${yanyuan}/trainee/add`, param); |
||||
|
// 查询用户创建的老人信息
|
||||
|
vm.$u.api.createTrainee = param => vm.$u.post(`${yanyuan}/trainee/create`, param); |
||||
|
// 查询体验账号
|
||||
|
vm.$u.api.experienceTrainee = param => vm.$u.post(`${yanyuan}/trainee/experience`, param); |
||||
|
// 绑定手机号后,关联用户原有的使用者
|
||||
|
vm.$u.api.relationTrainee = param => vm.$u.post(`${yanyuan}/trainee/relation`, param); |
||||
|
// 体验账号升级
|
||||
|
vm.$u.api.upgradeTrainee = param => vm.$u.post(`${yanyuan}/trainee/upgrade`, param); |
||||
|
|
||||
|
// 申请成为家属
|
||||
|
vm.$u.api.applyFamily = param => vm.$u.post(`${yanyuan}/family/apply`, param); |
||||
|
// 查询个人信息
|
||||
|
vm.$u.api.getPersonalInfo = param => vm.$u.post(`${yanyuan}/family/personal`, param); |
||||
|
|
||||
|
// 绑定工具箱
|
||||
|
vm.$u.api.bindTool = param => vm.$u.post(`${yanyuan}/tool/bind`, param); |
||||
|
|
||||
|
// 用户身份判断
|
||||
|
vm.$u.api.identityUserPower = param => vm.$u.post(`${yanyuan}/userPower/identity`, param); |
||||
|
}; |
||||
|
|
||||
|
export default { install }; |
||||
@ -0,0 +1,13 @@ |
|||||
|
<template> |
||||
|
<u-modal v-model="show" content="111111"></u-modal> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { show: false }; |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style></style> |
||||
@ -0,0 +1,221 @@ |
|||||
|
<template> |
||||
|
<view class="code-box"> |
||||
|
<view class="flex-box"> |
||||
|
<input :value="inputValue" type="number" :focus="autoFocus" :maxlength="maxlength" class="hide-input" @input="getVal" /> |
||||
|
<view class="flex flex-nowrap my-5"> |
||||
|
<block v-for="(item, index) in ranges" :key="index" class="flex-1 mx-1"> |
||||
|
<view |
||||
|
:class="['item', { active: codeIndex === item, middle: type === 'middle', bottom: type === 'bottom', box: type === 'box' }]" |
||||
|
> |
||||
|
<view class="line" v-if="type !== 'middle'"></view> |
||||
|
<view v-if="type === 'middle' && codeIndex <= item" class="bottom-line"></view> |
||||
|
<block v-if="isPwd && codeArr.length >= item"> |
||||
|
<text class="dot">.</text> |
||||
|
</block> |
||||
|
<block v-else> {{ codeArr[index] ? codeArr[index] : '' }}</block> |
||||
|
</view> |
||||
|
</block> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
// 支持使用 v-model |
||||
|
// 支持使用refs |
||||
|
// 打个广告: |
||||
|
// 全新的 UI 组件来袭:mypUI-nvue页面,uni-app模式,一套组件对应mp/h5/app |
||||
|
export default { |
||||
|
name: 'mypOneInput', |
||||
|
props: { |
||||
|
// 支持外部提供,支持使用v-model |
||||
|
// 支持通过value来做清空 |
||||
|
value: { |
||||
|
type: String, |
||||
|
default: '', |
||||
|
}, |
||||
|
// 4/6 |
||||
|
maxlength: { |
||||
|
type: Number, |
||||
|
default: 10, |
||||
|
}, |
||||
|
autoFocus: { |
||||
|
type: Boolean, |
||||
|
default: false, |
||||
|
}, |
||||
|
isPwd: { |
||||
|
type: Boolean, |
||||
|
default: false, |
||||
|
}, |
||||
|
// middle-middle line, bottom-bottom line, box-square box |
||||
|
type: { |
||||
|
type: String, |
||||
|
default: 'bottom', |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
maxlength: { |
||||
|
immediate: true, |
||||
|
handler: function () { |
||||
|
this.ranges = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; |
||||
|
// if (newV === 6) { |
||||
|
// this.ranges = [1, 2, 3, 4, 5, 6]; |
||||
|
// } else { |
||||
|
// this.ranges = [1, 2, 3, 4]; |
||||
|
// } |
||||
|
}, |
||||
|
}, |
||||
|
value: { |
||||
|
immediate: true, |
||||
|
handler: function (newV) { |
||||
|
if (newV !== this.inputValue) { |
||||
|
this.inputValue = newV; |
||||
|
this.toMakeAndCheck(newV); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
inputValue: '', |
||||
|
codeIndex: 1, |
||||
|
codeArr: [], |
||||
|
ranges: [1, 2, 3, 4], |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
getVal(e) { |
||||
|
const val = e.detail.value; |
||||
|
this.inputValue = val; |
||||
|
this.$emit('input', val); |
||||
|
this.toMakeAndCheck(val); |
||||
|
}, |
||||
|
toMakeAndCheck(val) { |
||||
|
const arr = val.split(''); |
||||
|
this.codeIndex = arr.length + 1; |
||||
|
this.codeArr = arr; |
||||
|
if (this.codeIndex > Number(this.maxlength)) { |
||||
|
this.$emit('finish', this.codeArr.join('')); |
||||
|
} |
||||
|
}, |
||||
|
// refs 时不再提供 v-model 支持 |
||||
|
// 支持使用refs来设置value |
||||
|
// 没有提供数据保护与检测,自己在外面对数据进行检测保护 |
||||
|
set(val) { |
||||
|
this.inputValue = val; |
||||
|
this.toMakeAndCheck(val); |
||||
|
}, |
||||
|
// 支持使用refs来清空 |
||||
|
clear() { |
||||
|
this.inputValue = ''; |
||||
|
this.codeArr = []; |
||||
|
this.codeIndex = 1; |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
@keyframes twinkling { |
||||
|
0% { |
||||
|
opacity: 0.2; |
||||
|
} |
||||
|
|
||||
|
50% { |
||||
|
opacity: 0.5; |
||||
|
} |
||||
|
|
||||
|
100% { |
||||
|
opacity: 0.2; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.code-box { |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
.flex-box { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
flex-wrap: wrap; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.flex-box .hide-input { |
||||
|
position: absolute; |
||||
|
top: 0; |
||||
|
left: -100%; |
||||
|
width: 200%; |
||||
|
height: 100%; |
||||
|
text-align: left; |
||||
|
z-index: 9; |
||||
|
opacity: 1; |
||||
|
} |
||||
|
|
||||
|
.flex-box .item { |
||||
|
position: relative; |
||||
|
width: 60upx; |
||||
|
height: 70upx; |
||||
|
margin-right: 12upx; |
||||
|
font-size: 46upx; |
||||
|
font-weight: bold; |
||||
|
color: #333333; |
||||
|
line-height: 70upx; |
||||
|
--tw-bg-opacity: 1; |
||||
|
background-color: rgba(249, 250, 251, var(--tw-bg-opacity)); |
||||
|
} |
||||
|
|
||||
|
.flex-box .item:last-child { |
||||
|
margin-right: 0; |
||||
|
} |
||||
|
|
||||
|
.flex-box .middle { |
||||
|
border: none; |
||||
|
} |
||||
|
|
||||
|
.flex-box .box { |
||||
|
box-sizing: border-box; |
||||
|
border-radius: 6rpx; |
||||
|
} |
||||
|
|
||||
|
.flex-box .bottom { |
||||
|
box-sizing: border-box; |
||||
|
border-bottom: 8rpx solid #212121; |
||||
|
} |
||||
|
|
||||
|
.flex-box .active { |
||||
|
border-color: #00c777; |
||||
|
} |
||||
|
|
||||
|
.flex-box .active .line { |
||||
|
display: block; |
||||
|
} |
||||
|
|
||||
|
.flex-box .line { |
||||
|
display: none; |
||||
|
position: absolute; |
||||
|
left: 50%; |
||||
|
top: 50%; |
||||
|
transform: translate(-50%, -50%); |
||||
|
width: 2upx; |
||||
|
height: 40upx; |
||||
|
background: #333333; |
||||
|
animation: twinkling 1s infinite ease; |
||||
|
} |
||||
|
|
||||
|
.flex-box .dot { |
||||
|
font-size: 80upx; |
||||
|
line-height: 40upx; |
||||
|
} |
||||
|
|
||||
|
.flex-box .bottom-line { |
||||
|
height: 4px; |
||||
|
background: #000000; |
||||
|
width: 80%; |
||||
|
position: absolute; |
||||
|
border-radius: 2px; |
||||
|
top: 50%; |
||||
|
left: 50%; |
||||
|
transform: translate(-50%, -50%); |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,108 @@ |
|||||
|
// 工具箱相关处理
|
||||
|
import { mapState, mapActions } from 'vuex'; |
||||
|
|
||||
|
export default { |
||||
|
computed: mapState('yanyuan', ['toolInfo']), |
||||
|
|
||||
|
methods: { |
||||
|
...mapActions('yanyuan', ['getCreateTrainee']), |
||||
|
|
||||
|
initTool() { |
||||
|
const { toolInfo } = this; |
||||
|
console.log('toolInfo: ', toolInfo); |
||||
|
// 工具箱是否被绑定
|
||||
|
if (!toolInfo || !toolInfo.bindUserId || toolInfo.isBind !== 1) { |
||||
|
console.log('工具箱没有被绑定'); |
||||
|
this.$t.page.openPage('/pagesYanyuan/scan-code/scan-code'); |
||||
|
// this.$t.page.openPage('/pagesYanyuan/input-code/input-code');
|
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// 不是自己 弹出是否申请成为家属
|
||||
|
if (toolInfo.isMine !== 1) { |
||||
|
console.log('绑定者不是自己'); |
||||
|
this.becomeFamily(toolInfo.bindUserId); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// 不是公司用户
|
||||
|
if (toolInfo.isCompany !== 1) { |
||||
|
console.log('不是公司用户'); |
||||
|
this.isNotCompany(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// 是公司用户 填写用户信息
|
||||
|
console.log('是公司用户'); |
||||
|
this.$t.page.openPage('/pagesYanyuan/add-info/add-info'); |
||||
|
|
||||
|
// TODO this测试
|
||||
|
}, |
||||
|
|
||||
|
// 不是公司用户
|
||||
|
isNotCompany() { |
||||
|
if (this.toolInfo.isMax !== 1) { |
||||
|
console.log('没有满员'); |
||||
|
// 没有体验用户
|
||||
|
if (this.toolInfo.isUx !== 1) { |
||||
|
console.log('没有体验用户'); |
||||
|
// 添加新用户
|
||||
|
this.$t.page.openPage('/pagesYanyuan/add-info/add-info'); |
||||
|
return; |
||||
|
} |
||||
|
// 有体验用户 判断体验用户数量
|
||||
|
console.log('有体验用户'); |
||||
|
this.becomeUser(this.toolInfo.uxUserInfo); |
||||
|
} |
||||
|
|
||||
|
// 满员 已绑定
|
||||
|
console.log('满员'); |
||||
|
this.$t.page.openPage('/pagesYanyuan/transfer-page/transfer-page?type=manyuan'); |
||||
|
}, |
||||
|
|
||||
|
// 判断是否成为家属
|
||||
|
becomeFamily(bindUserId) { |
||||
|
console.log('判断是否成为家属'); |
||||
|
this.$t.ui |
||||
|
.showModal('提示', '是否成为家属?') |
||||
|
.then(async () => { |
||||
|
console.log('是'); |
||||
|
const params = { bindUserId }; |
||||
|
console.log('params: ', params); |
||||
|
const res = await this.getCreateTrainee(params); |
||||
|
if (!res.length) { |
||||
|
this.$t.ui.showToast('提醒工具箱拥有者添加使用者信息'); |
||||
|
setTimeout(() => { |
||||
|
uni.redirectTo({ url: '/pages/index/index' }); |
||||
|
}, 2000); |
||||
|
} else { |
||||
|
this.$t.page.openPage('/pagesYanyuan/be-family/be-family'); |
||||
|
} |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
uni.redirectTo({ url: '/pages/index/index' }); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
// 判断是否设置为使用者
|
||||
|
becomeUser(uxUserInfo) { |
||||
|
// 1个弹框 询问是否将XXX设置为使用者 多个 弹框选择使用者
|
||||
|
if (uxUserInfo && uxUserInfo.length === 1) { |
||||
|
const content = uxUserInfo[0].userName; |
||||
|
console.log('判断是否设置为使用者'); |
||||
|
|
||||
|
this.$t.ui |
||||
|
.showModal('提示', `是否将${content}设置为使用者?`) |
||||
|
.then(() => { |
||||
|
console.log('是'); |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
console.log('否'); |
||||
|
}); |
||||
|
} |
||||
|
if (uxUserInfo && uxUserInfo.length > 1) { |
||||
|
console.log('判断是否设置为使用者'); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
@ -0,0 +1,18 @@ |
|||||
|
<template> |
||||
|
<view> 老人列表 </view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: 'BeFamily', |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
|
||||
|
methods: {}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,33 @@ |
|||||
|
<template> |
||||
|
<view class="flex flex-col items-center"> |
||||
|
<img class="my-28 w-24 h-24" src="https://www.tall.wiki/staticrec/yanyuan/logo.png" /> |
||||
|
<view class="text-xl flex flex-col"> |
||||
|
<text class="mb-1">{{ content }}</text> |
||||
|
<text>5秒后跳转到首页...</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { content: '' }; |
||||
|
}, |
||||
|
|
||||
|
onLoad(options) { |
||||
|
if (options.type === 'manyuan') { |
||||
|
this.content = '工具已绑定'; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
this.$nextTick(() => { |
||||
|
setTimeout(() => { |
||||
|
uni.redirectTo({ url: '/pages/index/index' }); |
||||
|
}, 5000); |
||||
|
}); |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style></style> |
||||
@ -0,0 +1,33 @@ |
|||||
|
const actions = { |
||||
|
/** |
||||
|
* 绑定工具箱 |
||||
|
* @param {*} commit |
||||
|
* @param {object} params |
||||
|
*/ |
||||
|
async getBindTool({ commit }, params) { |
||||
|
try { |
||||
|
const data = await uni.$u.api.bindTool(params); |
||||
|
commit('setToolInfo', data); |
||||
|
return data; |
||||
|
} catch (error) { |
||||
|
uni.$t.ui.showToast(error.msg || '工具箱绑定失败'); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 查询用户创建的老人信息 |
||||
|
* @param {*} commit |
||||
|
* @param {object} params |
||||
|
*/ |
||||
|
async getCreateTrainee({ commit }, params) { |
||||
|
try { |
||||
|
const data = await uni.$u.api.createTrainee(params); |
||||
|
commit('setElderlyInfo', data); |
||||
|
return data; |
||||
|
} catch (error) { |
||||
|
uni.$t.ui.showToast(error.msg || '查询失败'); |
||||
|
} |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
export default actions; |
||||
@ -0,0 +1,3 @@ |
|||||
|
const getters = {}; |
||||
|
|
||||
|
export default getters; |
||||
@ -0,0 +1,12 @@ |
|||||
|
import state from './state'; |
||||
|
import getters from './getters'; |
||||
|
import mutations from './mutations'; |
||||
|
import actions from './actions'; |
||||
|
|
||||
|
export default { |
||||
|
namespaced: true, |
||||
|
state, |
||||
|
getters, |
||||
|
mutations, |
||||
|
actions, |
||||
|
}; |
||||
@ -0,0 +1,30 @@ |
|||||
|
const mutations = { |
||||
|
/** |
||||
|
* 设置是否绑定工具箱 |
||||
|
* @param {object} state |
||||
|
* @param {array} show 项目列表 |
||||
|
*/ |
||||
|
setIsBinding(state, show) { |
||||
|
state.isBinding = show; |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 设置工具箱信息 |
||||
|
* @param {object} state |
||||
|
* @param {array} data 项目列表 |
||||
|
*/ |
||||
|
setToolInfo(state, data) { |
||||
|
state.toolInfo = data; |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 设置用户创建的老人信息 |
||||
|
* @param {object} state |
||||
|
* @param {array} data 项目列表 |
||||
|
*/ |
||||
|
setElderlyInfo(state, data) { |
||||
|
state.elderlyInfo = data; |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
export default mutations; |
||||
@ -0,0 +1,8 @@ |
|||||
|
/* eslint-disable */ |
||||
|
const state = { |
||||
|
isBinding: false, // 工具箱是否被绑定
|
||||
|
toolInfo: {}, // 绑定过的工具箱信息
|
||||
|
elderlyInfo: {}, // 用户创建的老人信息
|
||||
|
}; |
||||
|
|
||||
|
export default state; |
||||
Loading…
Reference in new issue