登录联调完成

master
yujialong 3 days ago
parent c033fc6361
commit 1695a4c4d4
  1. 4
      apis/modules/course.js
  2. 14
      apis/modules/user.js
  3. 2
      apis/request.js
  4. 2
      manifest.json
  5. 16
      pages.json
  6. 105
      pages/achievement/achievement.vue
  7. 47
      pages/index/index.vue
  8. 100
      pages/login/login.vue
  9. 298
      pages/person/person.vue
  10. 39
      uni_modules/uni-data-select/changelog.md
  11. 562
      uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue
  12. 86
      uni_modules/uni-data-select/package.json
  13. 8
      uni_modules/uni-data-select/readme.md
  14. 6
      uni_modules/uni-load-more/changelog.md
  15. 5
      uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue
  16. 12
      uni_modules/uni-load-more/package.json
  17. 78
      user/reg/reg.vue
  18. 63
      user/selectAccount/selectAccount.vue
  19. 95
      user/send/send.vue
  20. 119
      user/switchAccount/switchAccount.vue

@ -36,3 +36,7 @@ export const practiceByStudentDetail = data => {
export const experimentOverview = () => { export const experimentOverview = () => {
return get('occupationlab/occupationlab/achievement/experimentOverview') return get('occupationlab/occupationlab/achievement/experimentOverview')
} }
export const getSchoolEffectiveCourse = () => {
return get('nakadai/nakadai/curriculum/getSchoolEffectiveCourse')
}

@ -14,10 +14,12 @@ export const weChatToken = (data) => {
return post('users/users/user/weChatToken', data) return post('users/users/user/weChatToken', data)
} }
export const captcha = (data) => { export const checkUserNameOrWorkNumber = (data) => {
return Config.baseURL + `users/users/user/captcha` return post('users/users/batchProcessing/checkUserNameOrWorkNumber', data)
} }
export const captcha = Config.baseURL + `users/users/user/captcha`
export const queryProvince = () => { export const queryProvince = () => {
return get('nakadai/nakadai/province/queryProvince') return get('nakadai/nakadai/province/queryProvince')
} }
@ -53,6 +55,14 @@ export const queryUserInfoDetails = () => {
return get('users/users/userAccount/queryUserInfoDetails') return get('users/users/userAccount/queryUserInfoDetails')
} }
export const searchAllAccountsByPhone = data => {
return get('users/users/user/searchAllAccountsByPhone', data)
}
export const switchAccounts = (data) => {
return post('users/users/user/switchAccounts', data)
}
export const updateMyEmail = (data) => { export const updateMyEmail = (data) => {
return post('nakadai/nakadai/partner-team/updateMyEmail', data) return post('nakadai/nakadai/partner-team/updateMyEmail', data)
} }

@ -30,7 +30,7 @@ const request = options => {
setTimeout(() => { setTimeout(() => {
logouted = 0 logouted = 0
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/index' url: '/pages/login/login'
}) })
}, 1500) }, 1500)
reject(data) reject(data)

@ -49,7 +49,7 @@
"quickapp" : {}, "quickapp" : {},
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
"appid" : "wx2b506fdb0eeee65d", "appid" : "wx7e6ca7f895669c62",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"es6" : true, "es6" : true,

@ -74,6 +74,14 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{
"path" : "switchAccount/switchAccount",
"style" :
{
"navigationBarTitleText": "切换账号",
"enablePullDownRefresh": false
}
},
{ {
"path" : "setting/setting", "path" : "setting/setting",
"style" : "style" :
@ -147,14 +155,6 @@
"navigationBarTitleText": "方案详情", "navigationBarTitleText": "方案详情",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path" : "send/send",
"style" :
{
"navigationBarTitleText": "下载发送",
"enablePullDownRefresh": false
}
} }
] ]
} }

@ -32,15 +32,41 @@
<view class="p-title"> <view class="p-title">
<image class="icon" src="https://izhixinyun.com/images/record6.png" mode="widthFix"></image> 成绩记录明细 <image class="icon" src="https://izhixinyun.com/images/record6.png" mode="widthFix"></image> 成绩记录明细
</view> </view>
<view class="tab-wrap">
<ul class="tabs"> <ul class="tabs">
<li v-for="(item, i) in tabs" :key="i" :class="{active: curTab === item.id}" @click="tabChange(item.id)">{{ item.name }}</li> <li v-for="(item, i) in tabs" :key="i" :class="{active: curTab === item.id}" @click="tabChange(item.id)">{{ item.name }}</li>
</ul> </ul>
<uni-data-select class="select" v-model="mallId" :localdata="courses" @change="initList"></uni-data-select>
</view>
<!-- 练习成绩 -->
<view v-show="!curTab && list.length" class="list">
<view v-for="(item, i) in list" :key="i" class="item" @click="toPrac(item)">
<view class="c-name">{{ item.projectName }}</view>
<view class="line">最高分{{ item.hightScore }}&emsp;&emsp;练习次数{{ item.practiceNum }}</view>
<view class="line">累计练习时长小时{{ item.hightScore }}</view>
<view class="line">最近练习时间{{ item.lastTime }}</view>
<view class="btn">练习情况</view>
</view>
</view>
<!-- 考核成绩 -->
<view v-show="curTab && list.length" class="list">
<view v-for="(item, i) in list" :key="i" class="item" @click="toDetail(item)">
<view class="c-name">{{ item.experimentalName }}</view>
<view class="line">得分{{ item.score }}&emsp;&emsp;耗时{{ item.timeSum }}min</view>
<view class="line">考核开始时间{{ item.startTime }}</view>
<view class="line">考核结束时间{{ item.lastTime }}</view>
<view class="btn">成绩报告</view>
</view>
</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { experimentOverview } from '@/apis/modules/course.js' import { experimentOverview, getSchoolEffectiveCourse, queryPracticeByStudent, queryAssessmentByStudent } from '@/apis/modules/course.js'
export default { export default {
data() { data() {
return { return {
@ -56,6 +82,8 @@
name: '考核' name: '考核'
}, },
], ],
courses: [],
mallId: '',
list: [], list: [],
reachBottom: 0, // 0->,1->,-1-> reachBottom: 0, // 0->,1->,-1->
status: 'more', // more|loading|noMore status: 'more', // more|loading|noMore
@ -65,6 +93,7 @@
}, },
onShow() { onShow() {
this.getOverview() this.getOverview()
this.getCourse()
}, },
methods: { methods: {
// //
@ -72,22 +101,59 @@
const res = await experimentOverview() const res = await experimentOverview()
this.overview = res.data this.overview = res.data
}, },
//
async getCourse () {
const { data } = await getSchoolEffectiveCourse()
if (data.length) {
data.forEach(e => {
e.value = e.mallId
e.text = e.curriculumName
})
this.courses = data
this.mallId = data[0].mallId
this.initList()
}
},
//
async getList () {
let res
const { mallId } = this
if (mallId) {
const { cid } = this.courses.find(e => e.mallId == mallId)
if (this.curTab) {
//
res = await queryAssessmentByStudent({
pageNum: this.page,
pageSize: this.pageSize,
mallId: this.mallId,
curriculumId: cid
})
} else {
//
res = await queryPracticeByStudent({
pageNum: this.page,
pageSize: this.pageSize,
mallId: this.mallId,
curriculumId: cid
})
}
const { page } = res
this.practices = this.reachBottom > 0 ? [...this.practices, ...page.records] : page.records
this.page++ // page+1
const noMore = this.practices.length === page.total //
this.status = noMore ? 'noMore' : 'more' // noMore
this.reachBottom = noMore ? -1 : 0 // -1
}
},
initList() {
this.page = 1
this.reachBottom = 0
this.getList()
},
// tab // tab
tabChange(id) { tabChange(id) {
this.curTab = id this.curTab = id
}, this.initList()
//
toModule(i) {
this.$uma.trackEvent(i) //
let path = '/order/clients/clients'
if (i === 'plan') {
path = '/team/plans/plans'
} else if (i === 'study') {
path = '/team/study/study'
} else if (i === 'info') {
path = '/team/info/info'
}
this.$util.to(path, { type: i })
}, },
// //
toPanel(i) { toPanel(i) {
@ -115,6 +181,17 @@
margin-right: 8rpx; margin-right: 8rpx;
} }
} }
.tab-wrap {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
/deep/.select {
width: 60%;
.uni-select {
border: 0;
}
}
}
.tabs { .tabs {
display: flex; display: flex;
margin-bottom: 32rpx; margin-bottom: 32rpx;

@ -17,11 +17,24 @@
<view class="entry">进入课程</view> <view class="entry">进入课程</view>
</li> </li>
</ul> </ul>
<uni-popup ref="alertDialog">
<uni-forms>
<uni-forms-item label="真实姓名">
<uni-easyinput type="text" v-model.trim="form.account" placeholder="请输入真实姓名" />
</uni-forms-item>
<uni-forms-item label="学号">
<uni-easyinput type="text" v-model.trim="form.account" placeholder="请输入学号" />
</uni-forms-item>
</uni-forms>
<button class="btn" type="primary" @click="realNameSubmit">确认</button>
</uni-popup>
</view> </view>
</template> </template>
<script> <script>
import { schoolCourse, recentUse, getSchoolCourseAuthority } from '@/apis/modules/course.js' import { schoolCourse, recentUse, getSchoolCourseAuthority } from '@/apis/modules/course.js'
import { checkUserNameOrWorkNumber } from '@/apis/modules/user.js'
export default { export default {
data() { data() {
return { return {
@ -37,10 +50,9 @@
page: 1, page: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
cartNum: '', realNameForm: {
productTypeName: '', userName: '',
tagName: '', },
categoryName: '',
} }
}, },
watch: { watch: {
@ -60,6 +72,7 @@
}, },
onShow() { onShow() {
// uni.setStorageSync('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjM5NTc2LCJyblN0ciI6Ik5vcTB1UlNEZ0V0UExOUzBSUWtSZHlVVGsxOFYycnpNIiwiYWNjb3VudElkIjozOTU3NiwidXNlcklkIjozOTU3NSwic2Nob29sSWQiOjI4NDYsInVzZXJOYW1lIjoiYWMiLCJwbGF0Zm9ybUlkIjoiMSJ9.-YiaJdr5H2j6TGezs1eDS1EX5bNYCWGGghRw6eD3jk4') // uni.setStorageSync('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjM5NTc2LCJyblN0ciI6Ik5vcTB1UlNEZ0V0UExOUzBSUWtSZHlVVGsxOFYycnpNIiwiYWNjb3VudElkIjozOTU3NiwidXNlcklkIjozOTU3NSwic2Nob29sSWQiOjI4NDYsInVzZXJOYW1lIjoiYWMiLCJwbGF0Zm9ybUlkIjoiMSJ9.-YiaJdr5H2j6TGezs1eDS1EX5bNYCWGGghRw6eD3jk4')
this.handleRealName()
this.getTab() this.getTab()
}, },
methods: { methods: {
@ -81,6 +94,11 @@
this.list = data this.list = data
} }
}, },
initList() {
this.page = 1
this.reachBottom = 0
this.getList()
},
// tab // tab
async getTab () { async getTab () {
const { data } = await getSchoolCourseAuthority() const { data } = await getSchoolCourseAuthority()
@ -97,11 +115,32 @@
] ]
this.getList() this.getList()
}, },
//
async handleRealName () {
const res = await checkUserNameOrWorkNumber()
//
if (!res.hasName) this.$refs.alertDialog.open()
},
// tab // tab
tabChange(id) { tabChange(id) {
this.curTab = id this.curTab = id
this.initList() this.initList()
}, },
//
async realNameSubmit() {
const form = this.realNameForm
if (!form.userName) return this.$util.errMsg('请输入真实姓名!')
const { token, teamId } = await weChatToken({
...form,
openid: this.openid,
phone: this.phone
})
uni.removeStorageSync('realNameTiped')
uni.setStorageSync('token', data.token)
uni.reLaunch({
url: '../index/index'
})
},
// //
toDetail(item) { toDetail(item) {
this.$util.to(`/course/courseDetail/courseDetail?cid=${item.cid}&mallId=${item.mallId}`) this.$util.to(`/course/courseDetail/courseDetail?cid=${item.cid}&mallId=${item.mallId}`)

@ -13,7 +13,6 @@
<image src="@/static/image/phone.png" mode="widthFix"></image> <image src="@/static/image/phone.png" mode="widthFix"></image>
{{ isReg ? '获取手机号' : '绑定手机'}} {{ isReg ? '获取手机号' : '绑定手机'}}
</button> </button>
<view class="tips">未注册或未绑定职站商城的手机号将帮你注册新账号</view>
</template> </template>
<template v-else> <template v-else>
<view class="btn wechat" @click="login"> <view class="btn wechat" @click="login">
@ -90,16 +89,14 @@
const e = data.sessionKey const e = data.sessionKey
this.sessionKey = e.session_key this.sessionKey = e.session_key
this.openid = e.openid this.openid = e.openid
// this.unionid = e.unionid
uni.setStorageSync('sessionKey', e.session_key) uni.setStorageSync('sessionKey', e.session_key)
uni.setStorageSync('openid', e.openid) uni.setStorageSync('openid', e.openid)
// //
if (data.state === 'login') { if (data.state === 'login') {
this.toIndex()
uni.setStorageSync('token', data.token) uni.setStorageSync('token', data.token)
this.toIndex()
} else { } else {
// //
// this.$util.to(`../reg/reg?openid=${this.openid}`)
this.isLogin = true this.isLogin = true
this.isReg = true this.isReg = true
} }
@ -125,104 +122,25 @@
async onGetPhoneNumber(e){ async onGetPhoneNumber(e){
if (this.submiting) return false if (this.submiting) return false
const { encryptedData, iv } = e.detail const { encryptedData, iv } = e.detail
// 1.使js2.使 ()
const appId = this.isDy ? 'tt2192572fbea04fe601' : uni.getAccountInfoSync().miniProgram.appId const appId = this.isDy ? 'tt2192572fbea04fe601' : uni.getAccountInfoSync().miniProgram.appId
const pc = new WXBizDataCrypt(appId , this.sessionKey) const pc = new WXBizDataCrypt(appId , this.sessionKey)
const data = pc.decryptData(encryptedData , iv) const decData = pc.decryptData(encryptedData , iv)
this.submiting = true this.submiting = true
const phone = data.phoneNumber const phone = decData.phoneNumber
if (this.isReg) { // uni.setStorageSync('phone', phone)
this.submiting = false
const { data } = await studentBinding({ const { data } = await studentBinding({
openid: this.openid, openid: this.openid,
phone, phone,
platformId: 1 platformId: 1
}) })
if (data) {
const accounts = data.userAccounts const accounts = data.userAccounts
if (accounts instanceof Array) { //
uni.setStorageSync('accounts', JSON.stringify(accounts)) uni.setStorageSync('accounts', JSON.stringify(accounts))
this.$util.to(`/user/selectAccount/selectAccount?openid=${this.openid}&phone=${phone}`) this.$util.to(`/user/selectAccount/selectAccount?openid=${this.openid}&phone=${phone}`)
} else { } else {
this.token = data.token //
uni.setStorageSync('token', data.token) this.$util.to(`/user/reg/reg?openid=${this.openid}&phone=${phone}`)
this.toIndex()
}
} else { //
try {
const fn = this.isDy ? douYinUserBinding : userBinding
const res = await fn({
openid: this.openid,
phone,
unionid: this.unionid,
platformId: 4
})
const { token, status } = res
if (status == 10014) {
// unilogincode
uni.login({
success: ({ code }) => {
getSessionKey({
code,
}).then(({ sessionKey }) => {
this.sessionKey = sessionKey.session_key
this.openid = sessionKey.openid
this.$util.to(`../reg/reg?openid=${this.openid}&phone=${phone}`)
}).catch(e => {})
this.isReg = true
}
})
} else {
this.submiting = false
uni.setStorageSync('token', token)
this.toIndex()
}
} catch (e) {
this.submiting = false
uni.showToast({
title: e.message,
icon: 'none'
})
}
}
},
//
toReg() {
this.isReg = true
if (this.agree.length) {
const that = this
uni.getUserProfile({
lang: 'zh_CN',
desc: '登录',
success: ({ userInfo }) => {
uni.setStorageSync('userName', userInfo.nickName)
uni.setStorageSync('avatar', userInfo.avatarUrl)
uni.login({
success: ({ code }) => {
if (code) {
this.submiting = true
getSessionKey({
code,
}).then(({ sessionKey }) => {
this.sessionKey = sessionKey.session_key
this.openid = sessionKey.openid
this.submiting = false
this.isLogin = true
}).catch(e => {
this.submiting = false
})
} else {
this.submiting = false
that.$util.errMsg('登录失败!')
}
}
})
},
fail(res) {
that.$util.errMsg('登录授权失败!')
}
})
} else {
this.$util.errMsg('请先阅读勾选协议!')
} }
}, },
toAgreement(id) { toAgreement(id) {
@ -230,7 +148,7 @@
}, },
// //
toIndex() { toIndex() {
uni.reLaunch({ uni.switchTab({
url: '../index/index' url: '../index/index'
}) })
} }

@ -5,253 +5,70 @@
<view class="wrap"> <view class="wrap">
<view class="info"> <view class="info">
<button class="avatar-btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"> <button class="avatar-btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="avatar" mode=""></image> <image class="avatar" :src="info.avatar" mode=""></image>
</button> </button>
<view class="text"> <view class="text">
<view class="name">{{ my.info.userName }}</view> <view class="name">{{ info.userName }}</view>
<view class="phone">{{ my.info.phone }}</view> <view class="dep-wrap">
<view class="dep">{{ info.schoolName }}</view>
<view class="tag">当前组织</view>
</view>
</view> </view>
<view v-if="!disabled" class="tag">团队负责人</view>
</view> </view>
<view class="list"> <view class="list">
<view v-if="auth('我的:我的团队')" class="item" @click="$util.to('/team/teams/teams')"> <view class="item" @click="$util.to('/team/teams/teams')">
<view class="left"> <view class="left">
<image class="icon" src="@/static/image/person4.png" mode=""></image> <image class="icon" src="@/static/image/person4.png" mode=""></image>
<text class="name">{{ disabled ? '所属团队' : '我的团队' }}</text> <text class="name">我的资料</text>
</view> </view>
<uni-icons type="right" size="15" color="#ccc"></uni-icons> <uni-icons type="right" size="15" color="#ccc"></uni-icons>
</view> </view>
<view v-if="!hasOwnTeam && auth('我的:我的团队')" class="item" @click="createTeam"> <view class="item" @click="$util.to('/user/switchAccount/switchAccount')">
<view class="left"> <view class="left">
<image class="icon" src="@/static/image/person4.png" mode=""></image> <image class="icon" src="@/static/image/person4.png" mode=""></image>
<text class="name">创建自己的团队</text> <text class="name">切换账号</text>
</view> </view>
<uni-icons type="right" size="15" color="#ccc"></uni-icons> <uni-icons type="right" size="15" color="#ccc"></uni-icons>
</view> </view>
<view v-if="auth('我的:团队收益')" class="item"> <view class="item" @click="logout">
<view class="left">
<image class="icon" src="@/static/image/person2.png" mode=""></image>
<text class="name">团队收益</text>
</view>
<text class="val">{{ my.teamIncome }}</text>
</view>
<view v-if="auth('我的:我的项目收益')" class="item">
<view class="left">
<image class="icon" src="@/static/image/person1.png" mode=""></image>
<text class="name">我的项目收益</text>
</view>
<text class="val">{{ my.myIncome }}</text>
</view>
<!-- <view class="item">
<view class="left">
<image class="icon" src="@/static/image/person5.png" mode=""></image>
<text class="name">我的收藏</text>
</view>
</view> -->
<view v-if="auth('我的:市场服务费')" class="item">
<view class="left">
<image class="icon" src="@/static/image/person26.png" mode=""></image>
<text class="name">市场服务费</text>
</view>
<text class="val">{{ my.teamInfo.annualMarketingFee ? '项目抽成' + my.teamInfo.annualMarketingFee + '%' :'-' }}</text>
</view>
<view v-if="auth('我的:团队年费')" class="item">
<view class="left">
<image class="icon" src="@/static/image/person27.png" mode=""></image>
<text class="name">团队年费</text>
</view>
<text class="val">{{ my.teamInfo.annualTeamFee ? '固定年费' + my.teamInfo.annualTeamFee + 'w' : '-' }}</text>
</view>
<view v-if="auth('我的:业务省份')" class="item">
<view class="left">
<image class="icon" src="@/static/image/person8.png" mode=""></image>
<text class="name">业务省份</text>
</view>
<view class="val">
<text v-if="disabled" class="name">{{ provinceName }}</text>
<uni-data-picker v-else class="picker-input" :clear-icon="false" :readonly="disabled" placeholder="请选择省份" popup-title="请选择省份" preload :localdata="provinces" :map="{text: 'provinceName', value: 'provinceId'}" v-model="provinceId" @change="getCity"></uni-data-picker>
</view>
</view>
<view v-if="auth('我的:业务城市')" class="item">
<view class="left">
<image class="icon" src="@/static/image/person9.png" mode=""></image>
<text class="name">业务城市</text>
</view>
<view class="val">
<text v-if="disabled" class="name">{{ cityName }}</text>
<uni-data-picker v-else class="picker-input" :clear-icon="false" :readonly="disabled" placeholder="请选择城市" popup-title="请选择城市" preload :localdata="cities" :map="{text: 'cityName', value: 'cityId'}" v-model="cityId" @change="submit"></uni-data-picker>
</view>
</view>
<view v-if="auth('我的:设置')" class="item" @click="toSet">
<view class="left"> <view class="left">
<image class="icon" src="@/static/image/person3.png" mode=""></image> <image class="icon" src="@/static/image/person3.png" mode=""></image>
<text class="name">设置</text> <text class="name">退出登录</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="!per" class="per-mask">功能升级中敬请期待...</view>
</view> </view>
</template> </template>
<script> <script>
import { my, editProvinceCity } from '@/apis/modules/parner.js' import { queryUserInfoDetails, updateAvatars } from '@/apis/modules/user.js'
import { queryProvince, queryCity, updateAvatars, getUserRolesPermissionMenu } from '@/apis/modules/user.js'
import { getTeamsByAccountId } from '@/apis/modules/client.js'
import OSS from '@/libs/Oss/upload' import OSS from '@/libs/Oss/upload'
export default { export default {
data() { data() {
return { return {
per: true, //
teamId: uni.getStorageSync('teamId') || '',
teams: [],
my: {
info: { info: {
phone: '' avatar: '',
}, userName: '',
teamInfo: { schoolName: ''
annualMarketingFee: '',
annualTeamFee: '',
},
myIncome: 0,
teamIncome: 0
}, },
avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png', avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png',
userName: uni.getStorageSync('userName'), userName: uni.getStorageSync('userName'),
hasOwnTeam: 0, //
disabled: true,
provinces: [],
cities: [],
provinceIcon: {
color: '#007eff',
size: '22',
type: 'location'
},
cityIcon: {
color: '#007eff',
size: '22',
type: 'map-pin-ellipse'
},
provinceId: '',
cityId: '',
provinceName: '',
cityName: ''
} }
}, },
onShow() { onShow() {
this.per = true
if (uni.getStorageSync('token')) {
this.getTeam()
} else {
uni.redirectTo({
url: '/pages/login/login'
})
}
},
methods: {
//
initRole() {
if (!uni.getStorageSync('auth').includes('我的')) {
this.per = false
} else {
this.getInfo() this.getInfo()
}
},
//
getAuth() {
uni.showLoading({
title: '加载中'
})
getUserRolesPermissionMenu({
teamId: this.teams.find(e => e.teamId == this.teamId).partnerClassificationId,
platformId: 4
}).then(({ permissionMenu }) => {
uni.hideLoading()
const auth = []
//
const generateAuth = (list, parent) => {
list.map(e => {
const name = `${parent ? parent + ':' : ''}${e.name}`
auth.push(name)
generateAuth(e.children, name)
})
}
generateAuth(permissionMenu[0].children, '')
uni.setStorageSync('auth', auth)
this.initRole()
}).catch(e => {
uni.hideLoading()
uni.setStorageSync('auth', [])
this.initRole()
})
},
//
getTeam() {
uni.showLoading({
title: '加载中'
})
getTeamsByAccountId().then(({ data }) => {
let hasOwnTeam = 0 //
data.map(e => {
const n = e.partnerClassificationList
e.id = n.id
// parnerIdidteamIduni.getStorageSync('team').partnerId使
e.teamId = e.isTeam == 1 ? +e.partnerClassificationId : n.id
e.partnerClassificationName = n.partnerClassificationName
delete e.partnerClassificationList
if (e.isTeam == 1) hasOwnTeam = 1
})
this.hasOwnTeam = hasOwnTeam
const teamId = uni.getStorageSync('teamId')
if (data.length) {
/**
* @description 如果是第一次进则默认选中第一个团队并把该团队的信息存入缓存
* 或者团队列表里没有该id则说明超管已经被转让也需要重新选中团队
*/
const curTeam = data.find(e => e.teamId == teamId)
if (teamId && curTeam) {
uni.setStorageSync('team', curTeam)
} else if (!uni.getStorageSync('team') || !curTeam) {
this.teamId = data[0].teamId
uni.setStorageSync('teamId', data[0].teamId)
uni.setStorageSync('team', data[0])
}
} else {
// 退
uni.hideLoading()
uni.clearStorageSync()
uni.redirectTo({
url: '../index/index'
})
}
this.disabled = uni.getStorageSync('team').isTeam == 0 //
this.teams = data
this.getAuth()
}).catch(e => {
uni.hideLoading()
})
}, },
methods: {
// //
getInfo() { async getInfo() {
const { partnerId, teamId } = uni.getStorageSync('team') const res = await queryUserInfoDetails()
my({ const r = res.result.hrUserInfo
partnerId, this.info = {
teamId avatar: r.userAvatars || 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
}).then(({ my }) => { userName: r.userName || 'tourist',
this.my = my schoolName: r.schoolName || ''
const avatar = my.info.userAvatars || 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png' }
this.avatar = avatar
uni.setStorageSync('avatar', avatar)
this.provinceId = my.teamInfo.provinceId
this.cityId = my.teamInfo.cityId
uni.setStorageSync('provinceId', this.provinceId)
uni.setStorageSync('cityId', this.cityId)
this.getProvince()
this.provinceId && this.getCity()
}).catch(e => {})
}, },
// //
onChooseAvatar(e) { onChooseAvatar(e) {
@ -269,46 +86,21 @@
toSet() { toSet() {
this.$util.to(`/team/setting/setting`) this.$util.to(`/team/setting/setting`)
}, },
// // 退
getProvince() { logout() {
queryProvince().then(({ list }) => { const that = this
if (this.disabled) { uni.showModal({
const { provinceId } = this title: '提示',
this.provinceName = list.find(e => e.provinceId == provinceId).provinceName content: '确定要退出账号吗?',
} else { success(res) {
this.provinces = list if (res.confirm) {
} uni.clearStorageSync()
}).catch(res => {}) uni.reLaunch({
}, url: '/pages/login/login'
// })
getCity(val) {
if (this.provinceId) {
queryCity({
provinceId: this.provinceId
}).then(({ list }) => {
if (this.disabled) {
const { cityId } = this
this.cityName = list.find(e => e.cityId == cityId).cityName
} else {
this.cities = list
} }
}).catch(res => {})
} else {
this.cities = []
} }
if (val) this.cityId = '' })
},
//
submit() {
const { partnerId, teamId } = uni.getStorageSync('team')
editProvinceCity({
provinceId: this.provinceId,
cityId: this.cityId,
classificationId: teamId,
partnerId
}).then(({ my }) => {
this.$util.sucMsg('修改成功')
}).catch(e => {})
}, },
} }
} }
@ -359,17 +151,23 @@
font-size: 40rpx; font-size: 40rpx;
color: #333; color: #333;
} }
.phone { .dep-wrap {
display: flex;
align-items: center;
}
.dep {
max-width: 350rpx;
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
} }
.tag { .tag {
padding: 8rpx 16rpx; padding: 8rpx 16rpx;
margin-top: -50rpx; margin-left: 10rpx;
font-size: 24rpx; font-size: 24rpx;
color: #fff; color: #333;
background-color: #2979ff; white-space: nowrap;
border-radius: 20px; border-radius: 20px;
border: 1px solid #ccc;
} }
} }
.list { .list {

@ -0,0 +1,39 @@
## 1.0.8(2024-03-28)
- 修复 在vue2下:style动态绑定导致编译失败的bug
## 1.0.7(2024-01-20)
- 修复 长文本回显超过容器的bug,超过容器部分显示省略号
## 1.0.6(2023-04-12)
- 修复 微信小程序点击时会改变背景颜色的 bug
## 1.0.5(2023-02-03)
- 修复 禁用时会显示清空按钮
## 1.0.4(2023-02-02)
- 优化 查询条件短期内多次变更只查询最后一次变更后的结果
- 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue
## 1.0.3(2023-01-16)
- 修复 不关联服务空间报错的问题
## 1.0.2(2023-01-14)
- 新增 属性 `format` 可用于格式化显示选项内容
## 1.0.1(2022-12-06)
- 修复 当where变化时,数据不会自动更新的问题
## 0.1.9(2022-09-05)
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
## 0.1.8(2022-08-29)
- 修复 点击的位置不准确
## 0.1.7(2022-08-12)
- 新增 支持 disabled 属性
## 0.1.6(2022-07-06)
- 修复 pc端宽度异常的bug
## 0.1.5
- 修复 pc端宽度异常的bug
## 0.1.4(2022-07-05)
- 优化 显示样式
## 0.1.3(2022-06-02)
- 修复 localdata 赋值不生效的 bug
- 新增 支持 uni.scss 修改颜色
- 新增 支持选项禁用(数据选项设置 disabled: true 即禁用)
## 0.1.2(2022-05-08)
- 修复 当 value 为 0 时选择不生效的 bug
## 0.1.1(2022-05-07)
- 新增 记住上次的选项(仅 collection 存在时有效)
## 0.1.0(2022-04-22)
- 初始化

@ -0,0 +1,562 @@
<template>
<view class="uni-stat__select">
<span v-if="label" class="uni-label-text hide-on-phone">{{label + ''}}</span>
<view class="uni-stat-box" :class="{'uni-stat__actived': current}">
<view class="uni-select" :class="{'uni-select--disabled':disabled}">
<view class="uni-select__input-box" @click="toggleSelector">
<view v-if="current" class="uni-select__input-text">{{textShow}}</view>
<view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
<view v-if="current && clear && !disabled" @click.stop="clearVal">
<uni-icons type="clear" color="#c0c4cc" size="24" />
</view>
<view v-else>
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
</view>
</view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
<view :class="placement=='bottom'?'uni-popper__arrow_bottom':'uni-popper__arrow_top'"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
<text>{{emptyTips}}</text>
</view>
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
@click="change(item)">
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</template>
<script>
/**
* DataChecklist 数据选择器
* @description 通过数据渲染的下拉框组件
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
* @property {String} value 默认值
* @property {Array} localdata 本地数据 格式 [{text:'',value:''}]
* @property {Boolean} clear 是否可以清空已选项
* @property {Boolean} emptyText 没有数据时显示的文字 本地数据无效
* @property {String} label 左侧标题
* @property {String} placeholder 输入框的提示文字
* @property {Boolean} disabled 是否禁用
* @property {String} placement 弹出位置
* @value top 顶部弹出
* @value bottom 底部弹出default)
* @event {Function} change 选中发生变化触发
*/
export default {
name: "uni-data-select",
mixins: [uniCloud.mixinDatacom || {}],
props: {
localdata: {
type: Array,
default () {
return []
}
},
value: {
type: [String, Number],
default: ''
},
modelValue: {
type: [String, Number],
default: ''
},
label: {
type: String,
default: ''
},
placeholder: {
type: String,
default: '请选择'
},
emptyTips: {
type: String,
default: '无选项'
},
clear: {
type: Boolean,
default: true
},
defItem: {
type: Number,
default: 0
},
disabled: {
type: Boolean,
default: false
},
// field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
format: {
type: String,
default: ''
},
placement: {
type: String,
default: 'bottom'
}
},
data() {
return {
showSelector: false,
current: '',
mixinDatacomResData: [],
apps: [],
channels: [],
cacheKey: "uni-data-select-lastSelectedValue",
};
},
created() {
this.debounceGet = this.debounce(() => {
this.query();
}, 300);
if (this.collection && !this.localdata.length) {
this.debounceGet();
}
},
computed: {
typePlaceholder() {
const text = {
'opendb-stat-app-versions': '版本',
'opendb-app-channels': '渠道',
'opendb-app-list': '应用'
}
const common = this.placeholder
const placeholder = text[this.collection]
return placeholder ?
common + placeholder :
common
},
valueCom() {
// #ifdef VUE3
return this.modelValue;
// #endif
// #ifndef VUE3
return this.value;
// #endif
},
textShow() {
//
let text = this.current;
if (text.length > 10) {
return text.slice(0, 25) + '...';
}
return text;
},
getOffsetByPlacement() {
switch (this.placement) {
case 'top':
return "bottom:calc(100% + 12px);";
case 'bottom':
return "top:calc(100% + 12px);";
}
}
},
watch: {
localdata: {
immediate: true,
handler(val, old) {
if (Array.isArray(val) && old !== val) {
this.mixinDatacomResData = val
}
}
},
valueCom(val, old) {
this.initDefVal()
},
mixinDatacomResData: {
immediate: true,
handler(val) {
if (val.length) {
this.initDefVal()
}
}
},
},
methods: {
debounce(fn, time = 100) {
let timer = null
return function(...args) {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this, args)
}, time)
}
},
//
query() {
this.mixinDatacomEasyGet();
},
//
onMixinDatacomPropsChange() {
if (this.collection) {
this.debounceGet();
}
},
initDefVal() {
let defValue = ''
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
defValue = this.valueCom
} else {
let strogeValue
if (this.collection) {
strogeValue = this.getCache()
}
if (strogeValue || strogeValue === 0) {
defValue = strogeValue
} else {
let defItem = ''
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
defItem = this.mixinDatacomResData[this.defItem - 1].value
}
defValue = defItem
}
if (defValue || defValue === 0) {
this.emit(defValue)
}
}
const def = this.mixinDatacomResData.find(item => item.value === defValue)
this.current = def ? this.formatItemName(def) : ''
},
/**
* @param {[String, Number]} value
* 判断用户给的 value 是否同时为禁用状态
*/
isDisabled(value) {
let isDisabled = false;
this.mixinDatacomResData.forEach(item => {
if (item.value === value) {
isDisabled = item.disable
}
})
return isDisabled;
},
clearVal() {
this.emit('')
if (this.collection) {
this.removeCache()
}
},
change(item) {
if (!item.disable) {
this.showSelector = false
this.current = this.formatItemName(item)
this.emit(item.value)
}
},
emit(val) {
this.$emit('input', val)
this.$emit('update:modelValue', val)
this.$emit('change', val)
if (this.collection) {
this.setCache(val);
}
},
toggleSelector() {
if (this.disabled) {
return
}
this.showSelector = !this.showSelector
},
formatItemName(item) {
let {
text,
value,
channel_code
} = item
channel_code = channel_code ? `(${channel_code})` : ''
if (this.format) {
//
let str = "";
str = this.format;
for (let key in item) {
str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
}
return str;
} else {
return this.collection.indexOf('app-list') > 0 ?
`${text}(${value})` :
(
text ?
text :
`未命名${channel_code}`
)
}
},
//
getLoadData() {
return this.mixinDatacomResData;
},
// key
getCurrentCacheKey() {
return this.collection;
},
//
getCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
return cacheData[name];
},
//
setCache(value, name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
cacheData[name] = value;
uni.setStorageSync(this.cacheKey, cacheData);
},
//
removeCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
delete cacheData[name];
uni.setStorageSync(this.cacheKey, cacheData);
},
}
}
</script>
<style lang="scss">
$uni-base-color: #6a6a6a !default;
$uni-main-color: #333 !default;
$uni-secondary-color: #909399 !default;
$uni-border-3: #e5e5e5;
/* #ifndef APP-NVUE */
@media screen and (max-width: 500px) {
.hide-on-phone {
display: none;
}
}
/* #endif */
.uni-stat__select {
display: flex;
align-items: center;
// padding: 15px;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
width: 100%;
flex: 1;
box-sizing: border-box;
}
.uni-stat-box {
width: 100%;
flex: 1;
}
.uni-stat__actived {
width: 100%;
flex: 1;
// outline: 1px solid #2979ff;
}
.uni-label-text {
font-size: 14px;
font-weight: bold;
color: $uni-base-color;
margin: auto 0;
margin-right: 5px;
}
.uni-select {
font-size: 14px;
border: 1px solid $uni-border-3;
box-sizing: border-box;
border-radius: 4px;
padding: 0 5px;
padding-left: 10px;
position: relative;
/* #ifndef APP-NVUE */
display: flex;
user-select: none;
/* #endif */
flex-direction: row;
align-items: center;
border-bottom: solid 1px $uni-border-3;
width: 100%;
flex: 1;
height: 35px;
&--disabled {
background-color: #f5f7fa;
cursor: not-allowed;
}
}
.uni-select__label {
font-size: 16px;
// line-height: 22px;
height: 35px;
padding-right: 10px;
color: $uni-secondary-color;
}
.uni-select__input-box {
height: 35px;
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex: 1;
flex-direction: row;
align-items: center;
}
.uni-select__input {
flex: 1;
font-size: 14px;
height: 22px;
line-height: 22px;
}
.uni-select__input-plac {
font-size: 14px;
color: $uni-secondary-color;
}
.uni-select__selector {
/* #ifndef APP-NVUE */
box-sizing: border-box;
/* #endif */
position: absolute;
left: 0;
width: 100%;
background-color: #FFFFFF;
border: 1px solid #EBEEF5;
border-radius: 6px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
z-index: 3;
padding: 4px 0;
}
.uni-select__selector-scroll {
/* #ifndef APP-NVUE */
max-height: 200px;
box-sizing: border-box;
/* #endif */
}
/* #ifdef H5 */
@media (min-width: 768px) {
.uni-select__selector-scroll {
max-height: 600px;
}
}
/* #endif */
.uni-select__selector-empty,
.uni-select__selector-item {
/* #ifndef APP-NVUE */
display: flex;
cursor: pointer;
/* #endif */
line-height: 35px;
font-size: 14px;
text-align: center;
/* border-bottom: solid 1px $uni-border-3; */
padding: 0px 10px;
}
.uni-select__selector-item:hover {
background-color: #f9f9f9;
}
.uni-select__selector-empty:last-child,
.uni-select__selector-item:last-child {
/* #ifndef APP-NVUE */
border-bottom: none;
/* #endif */
}
.uni-select__selector__disabled {
opacity: 0.4;
cursor: default;
}
/* picker 弹出层通用的指示小三角 */
.uni-popper__arrow_bottom,
.uni-popper__arrow_bottom::after,
.uni-popper__arrow_top,
.uni-popper__arrow_top::after,
{
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
}
.uni-popper__arrow_bottom {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%;
margin-right: 3px;
border-top-width: 0;
border-bottom-color: #EBEEF5;
}
.uni-popper__arrow_bottom::after {
content: " ";
top: 1px;
margin-left: -6px;
border-top-width: 0;
border-bottom-color: #fff;
}
.uni-popper__arrow_top {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
bottom: -6px;
left: 10%;
margin-right: 3px;
border-bottom-width: 0;
border-top-color: #EBEEF5;
}
.uni-popper__arrow_top::after {
content: " ";
bottom: 1px;
margin-left: -6px;
border-bottom-width: 0;
border-top-color: #fff;
}
.uni-select__input-text {
// width: 280px;
width: 100%;
color: $uni-main-color;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow: hidden;
}
.uni-select__input-placeholder {
color: $uni-base-color;
font-size: 12px;
}
.uni-select--mask {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
z-index: 2;
}
</style>

@ -0,0 +1,86 @@
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
"version": "1.0.8",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
"select",
"uni-data-select",
"下拉框",
"下拉选"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": "^3.1.1"
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": ["uni-load-more"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "n"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "n"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

@ -0,0 +1,8 @@
## DataSelect 下拉框选择器
> **组件名:uni-data-select**
> 代码块: `uDataSelect`
当选项过多时,使用下拉菜单展示并选择内容
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-select)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839

@ -1,3 +1,9 @@
## 1.3.6(2024-10-15)
- 修复 微信小程序中的getSystemInfo警告
## 1.3.5(2024-10-12)
- 修复 微信小程序中的getSystemInfo警告
## 1.3.4(2024-10-12)
- 修复 微信小程序中的getSystemInfo警告
## 1.3.3(2022-01-20) ## 1.3.3(2022-01-20)
- 新增 showText属性 ,是否显示文本 - 新增 showText属性 ,是否显示文本
## 1.3.2(2022-01-19) ## 1.3.2(2022-01-19)

@ -37,7 +37,12 @@
<script> <script>
let platform let platform
setTimeout(() => { setTimeout(() => {
// #ifdef MP-WEIXIN
platform = uni.getDeviceInfo().platform
// #endif
// #ifndef MP-WEIXIN
platform = uni.getSystemInfoSync().platform platform = uni.getSystemInfoSync().platform
// #endif
}, 16) }, 16)
import { import {

@ -1,7 +1,7 @@
{ {
"id": "uni-load-more", "id": "uni-load-more",
"displayName": "uni-load-more 加载更多", "displayName": "uni-load-more 加载更多",
"version": "1.3.3", "version": "1.3.6",
"description": "LoadMore 组件,常用在列表里面,做滚动加载使用。", "description": "LoadMore 组件,常用在列表里面,做滚动加载使用。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -17,10 +17,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -37,7 +33,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-scss"], "dependencies": ["uni-scss"],
@ -45,7 +42,8 @@
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y",
"alipay": "n"
}, },
"client": { "client": {
"App": { "App": {

@ -8,21 +8,21 @@
</view> </view>
</view> </view>
<view class="wrap"> <view class="wrap">
<view>
<uni-forms> <uni-forms>
<uni-forms-item> <uni-forms-item>
<uni-easyinput type="text" v-model="form.userName" placeholder="请输入账号" /> <uni-easyinput type="text" v-model.trim="form.account" placeholder="请输入账号" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item> <uni-forms-item>
<uni-easyinput type="password" v-model.trim="form.password" placeholder="请输入密码"></uni-easyinput> <uni-easyinput type="password" v-model.trim="form.password" placeholder="请输入密码" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item class="ver-code"> <uni-forms-item>
<uni-easyinput type="text" v-model="form.userName" placeholder="请输入验证码" /> <view class="ver-code">
<image class="ver-img" src="verImg" mode="widthFix" @clilck="getVerImg"></image> <uni-easyinput type="text" v-model.trim="form.code" placeholder="请输入验证码" />
<image class="ver-img" :src="verImg" mode="widthFix" @click="getVerImg"></image>
</view>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<button type="primary" @click="submit">登录</button> <button class="btn" type="primary" @click="submit">登录</button>
</view>
</view> </view>
</view> </view>
</template> </template>
@ -35,9 +35,10 @@
openid: '', openid: '',
phone: '', phone: '',
form: { form: {
userName: '', account: '',
provinceId: '', password: '',
cityId: '', code: '',
random: '',
}, },
verImg: '', verImg: '',
} }
@ -46,49 +47,31 @@
const pages = getCurrentPages() const pages = getCurrentPages()
const { options } = pages[pages.length - 1] const { options } = pages[pages.length - 1]
this.openid = options.openid this.openid = options.openid
this.phone = options.phone this.phone = options.phone || ''
this.getVerImg() this.getVerImg()
}, },
methods: { methods: {
getVerImg () { // getVerImg () { //
this.form.random = Math.floor(Math.random() * 999999999); this.form.random = Math.floor(Math.random() * 999999999)
this.verImg = captcha + "?random=" + `${this.form.random}`; this.verImg = `${captcha}?random=${this.form.random}`
}, },
// //
async submit() { async submit() {
const { form } = this const { form } = this
if (!form.userName) return this.$util.errMsg('请输入姓名!') if (!form.account) return this.$util.errMsg('请输入账号!')
if (!form.provinceId) return this.$util.errMsg('请选择意向省份!') if (!form.password) return this.$util.errMsg('请输入密码!')
if (!form.cityId) return this.$util.errMsg('请选择意向城市!') if (!form.code) return this.$util.errMsg('请输入验证码!')
form.phone = this.phone const { data } = await weChatToken({
const { token, teamId } = await weChatToken(form) ...form,
this.$util.sucMsg(form.isTeam === 0 ? '创建成功' : '注册成功') openid: this.openid,
// tokenteamId phone: this.phone,
// if (token) { platformId: 1,
// teamId && uni.setStorageSync('teamId', teamId) })
// uni.setStorageSync('toke', token) uni.setStorageSync('token', data.token)
// setTimeout(() => { uni.switchTab({
// this.toIndex() url: '/pages/index/index'
// }, 1500)
// } else {
// setTimeout(() => {
// uni.redirectTo({
// url: '../login/login'
// })
// }, 1500)
// }
}
},
//
toIndex() {
uni.reLaunch({
url: this.my ? '../person/person' : '../home/home'
}) })
}, },
//
back() {
uni.navigateBack()
}
} }
} }
</script> </script>
@ -133,8 +116,13 @@
.ver-code { .ver-code {
display: flex; display: flex;
.ver-img { .ver-img {
width: 100rpx; width: 200rpx;
height: 80rpx;
margin-left: 20rpx;
}
} }
.btn {
width: 100%;
} }
} }
</style> </style>

@ -1,5 +1,5 @@
<template> <template>
<view> <view class="page">
<view class="tips">已为你展示{{ phone }}手机号关联的账号登录后可在切换账号列表快捷切换至其他账号</view> <view class="tips">已为你展示{{ phone }}手机号关联的账号登录后可在切换账号列表快捷切换至其他账号</view>
<template v-if="accounts.length"> <template v-if="accounts.length">
@ -9,50 +9,59 @@
<image class="avatar" :src="item.userAvatars || require('@/static/image/avatar.png')" mode=""></image> <image class="avatar" :src="item.userAvatars || require('@/static/image/avatar.png')" mode=""></image>
<view class="info"> <view class="info">
<view class="name">{{ item.userName }}</view> <view class="name">{{ item.userName }}</view>
<view class="org">{{ item.phone }}</view> <view class="org">{{ item.schoolName }}</view>
</view> </view>
</view> </view>
<view class="btn">登录</view> <view class="btn" @click="login(item)">登录</view>
</li> </li>
</ul> </ul>
<uni-load-more :status="status" />
</template> </template>
<empty v-else></empty>
</view> </view>
</template> </template>
<script> <script>
import { weChatToken } from '@/apis/modules/user.js'
export default { export default {
data() { data() {
return { return {
accounts: uni.getStorageSync('accounts'), openid: '',
phone: '',
accounts: JSON.parse(uni.getStorageSync('accounts')),
} }
}, },
//
onPullDownRefresh() {
this.initList()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1500)
},
onShow() { onShow() {
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
this.openid = options.openid
this.phone = options.phone
}, },
methods: { methods: {
initList() { //
this.page = 1 async login(item) {
this.reachBottom = 0 const { data } = await weChatToken({
this.getList() id: item.id,
openid: this.openid,
phone: this.phone,
platformId: 1,
})
debugger
uni.setStorageSync('token', data.token)
uni.switchTab({
url: '/pages/index/index'
})
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.page {
padding: 30rpx;
}
.tips { .tips {
margin-bottom: 20rpx; margin-bottom: 20rpx;
font-size: 24rpx; font-size: 24rpx;
color: #333; color: #616161;
} }
.list { .list {
li { li {
@ -62,6 +71,11 @@
padding: 30rpx; padding: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
background-color: #fff; background-color: #fff;
border-radius: 8rpx;
}
.left {
display: inline-flex;
align-items: center;
} }
.avatar { .avatar {
width: 100rpx; width: 100rpx;
@ -71,24 +85,19 @@
} }
.name { .name {
margin-bottom: 6rpx; margin-bottom: 6rpx;
font-size: 30rpx; font-size: 32rpx;
color: #333; color: #333;
} }
.val { .org {
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
} }
.btn { .btn {
padding: 8rpx 16rpx; padding: 10rpx 36rpx;
font-size: 24rpx; font-size: 24rpx;
color: #fff; color: #fff;
background-color: #2979ff; background-color: #2979ff;
border-radius: 20px; border-radius: 20px;
} }
} }
.plus {
position: fixed;
bottom: 40rpx;
right: 40rpx;
}
</style> </style>

@ -1,95 +0,0 @@
<template>
<view class="container">
<uni-card :is-shadow="false" :border="false" padding="0" is-full>
<view class="form">
<view class="line">
<uni-data-checkbox v-model="myVal" :localdata="checkList" @change="myChange"></uni-data-checkbox>
<text>我的邮箱</text>
<uni-easyinput v-model="email" disabled />
<view class="bind" @click="$util.to('../email/email')">绑定</view>
</view>
<view class="line">
<uni-data-checkbox v-model="otherVal" :localdata="checkList" @change="otherChange"></uni-data-checkbox>
<text>其他邮箱</text>
<uni-easyinput v-model="otherEmail" placeholder="请输入其他邮箱" />
</view>
<button type="primary" @click="submit">确认</button>
</view>
</uni-card>
</view>
</template>
<script>
import { mailFileSend } from '@/apis/modules/parner.js'
import { my } from '@/apis/modules/parner.js'
export default {
data() {
return {
email: '',
otherEmail: '',
myVal: 1,
otherVal: '',
checkList: [{
text: '',
value: 1
}],
}
},
onShow() {
this.getInfo()
},
methods: {
//
getInfo() {
const team = uni.getStorageSync('team')
my({
partnerId: team.partnerId,
teamId: team.teamId
}).then(({ my }) => {
this.email = my.info.email
}).catch(e => {})
},
myChange(e) {
this.otherVal = ''
},
otherChange(e) {
this.myVal = ''
},
//
submit() {
const { otherEmail } = this
if (this.myVal && !this.email) return this.$util.errMsg('请选择其他邮箱!')
if (this.otherVal && !otherEmail) return this.$util.errMsg('请输入邮箱!')
const data = uni.getStorageSync('files')
data.mail = this.myVal ? this.email : otherEmail
mailFileSend(data).then(res => {
this.$util.sucMsg('发送成功!')
setTimeout(() => {
uni.navigateBack()
}, 1000)
}).catch(e => {})
},
}
}
</script>
<style scoped lang="scss">
.form {
padding: 15px;
background-color: #fff;
}
.line {
display: flex;
align-items: center;
margin-bottom: 15px;
text {
margin: 0 10px 0 -20px;
}
}
.bind {
margin-left: 20rpx;
font-size: 26rpx;
color: #1f83ff;
white-space: nowrap;
}
</style>

@ -0,0 +1,119 @@
<template>
<view class="page">
<template v-if="list.length">
<ul class="list">
<li v-for="item in list" @change="checkChange(item)">
<view class="left">
<image class="avatar" :src="item.userAvatars || require('@/static/image/avatar.png')" mode=""></image>
<view class="info">
<view class="name">{{ item.userName }}</view>
<view class="org">{{ item.schoolName }}</view>
</view>
</view>
<uni-icons v-if="curAccount === item.id" type="checkbox" size="30" color="#007EFF"></uni-icons>
<uni-icons v-else type="circle" size="30" color="#e2e2e2"></uni-icons>
</li>
</ul>
<view class="add" @click="addAccount">
<view class="icon">
<uni-icons type="plusempty" size="20" color="#afafaf"></uni-icons>
</view>
<text>添加新账号</text>
</view>
</template>
</view>
</template>
<script>
import { searchAllAccountsByPhone, switchAccounts } from '@/apis/modules/user.js'
export default {
data() {
return {
openid: uni.getStorageSync('openid'),
curAccount: '',
list: [],
checkList: [{
text: '',
value: 1
}],
}
},
onShow() {
this.getList()
},
methods: {
async getList() {
const res = await searchAllAccountsByPhone({
platformId: 1
})
this.curAccount = +res.accountId
this.list = res.data
},
//
async checkChange(e) {
const { data } = await switchAccounts({
id: e.id,
openid: this.openid,
platformId: 1
})
},
//
addAccount() {
this.$util.to(`../reg/reg?openid=${this.openid}&phone=`)
}
}
}
</script>
<style scoped lang="scss">
.page {
min-height: 100%;
padding: 30rpx;
background-color: #fff;
}
.list {
li {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
}
.left {
display: inline-flex;
align-items: center;
}
.avatar {
width: 80rpx;
height: 80rpx;
margin-right: 20rpx;
border-radius: 50%;
}
.name {
margin-bottom: 6rpx;
font-size: 32rpx;
color: #333;
}
.org {
font-size: 28rpx;
color: #333;
}
}
.add {
display: flex;
align-items: center;
padding: 30rpx 0;
.icon {
display: flex;
justify-content: center;
align-items: center;
width: 80rpx;
height: 80rpx;
background-color: #f5f5f5;
border-radius: 50%;
}
text {
margin-left: 20rpx;
font-size: 28rpx;
}
}
</style>
Loading…
Cancel
Save