Compare commits
No commits in common. "c4edb4ec3dbeea8532c856fbde8787c04141912c" and "d4a6e9b1cd2268cce80c8fcc12f88605c8bdca70" have entirely different histories.
c4edb4ec3d
...
d4a6e9b1cd
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,3 @@ node_modules/*
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
unpackage
|
||||
.hbuilderx
|
||||
|
57
App.vue
57
App.vue
@ -1,41 +1,18 @@
|
||||
<!-- // <script>
|
||||
//
|
||||
// export default {
|
||||
// onLaunch: function() {
|
||||
// console.log('App Launch')
|
||||
// },
|
||||
// onShow: function() {
|
||||
// console.log('App Show')
|
||||
// },
|
||||
// onHide: function() {
|
||||
// console.log('App Hide')
|
||||
// }
|
||||
// }
|
||||
// </script> -->
|
||||
<script setup>
|
||||
<script>
|
||||
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
import { onLoad,onLaunch } from "@dcloudio/uni-app"
|
||||
import {useStore} from '@/store/index.js'
|
||||
const store = useStore()
|
||||
onLaunch((e) => {
|
||||
console.log('App onLaunch')
|
||||
let userInfo = uni.getStorageSync('userInfo')
|
||||
let operation_info = uni.getStorageSync('operation_info')
|
||||
if(userInfo) { // 已经登录过
|
||||
store.userInfo = userInfo
|
||||
}
|
||||
if(operation_info) {
|
||||
store.operation_info = operation_info
|
||||
}
|
||||
uni.getSystemInfo({
|
||||
success:function(res){
|
||||
// console.log(res.screenHeight)
|
||||
store.systemInfo = res
|
||||
// sHeight.value = res.screenHeight
|
||||
}
|
||||
})
|
||||
})
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log('App Launch')
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show')
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/*每个页面公共css */
|
||||
.page-bg-gray{
|
||||
@ -60,14 +37,6 @@
|
||||
-webkit-box-orient: vertical;
|
||||
/* min-height: 38rpx; */
|
||||
}
|
||||
.text-ellipsis-2{ /*超出部分省略号 双行*/
|
||||
overflow:hidden;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-line-clamp: 2;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
/* min-height: 38rpx; */
|
||||
}
|
||||
.icon-custom{
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
|
21
api/index.js
21
api/index.js
@ -3,27 +3,16 @@ import net from './request.js';
|
||||
// import store from '../store';
|
||||
const API = {
|
||||
//微信登录
|
||||
getToken: data => net.POST('/login/token',data,true,{"Content-Type":"application/x-www-form-urlencoded"}), // 获取token
|
||||
getToken: data => net.POST('/login/token',data), // 获取token
|
||||
wx_login: (data,userId) => net.POST('/user/binding/wechat',data,true,{"userId":userId}), // 微信登录
|
||||
// upload: (data) => net.POST('/user/upload',data), // 文件上传
|
||||
userinfoUpdae:data => net.PUT('/user/info',data,true,{"Content-Type":"application/x-www-form-urlencoded"}), // 更新用户信息
|
||||
// ai 客服
|
||||
getAikefuList:data => net.GET('/akefu/list',data), // 获取获取客服列表
|
||||
getReply:data => net.POST('/ai',data), // 获取客服回复
|
||||
userinfoUpdae:data => net.PUT('/user/info',data), // 更新用户信息
|
||||
// 首页
|
||||
getHospitalList:data => net.GET('/hospital/list',data), // 获取医院信息
|
||||
saveVision:data => net.POST("/vision",data),// 保存视力测试结果
|
||||
getLbtList:data => net.GET("/banner/list",data),// 获取轮播图
|
||||
hospital:data => net.PUT("/user/hospital",data),// 修改医院信息
|
||||
getHospitalInfo:id => net.GET("/hospital/"+id),// 根据ID获取医院信息
|
||||
getTodoist:data => net.GET("/user/todo",data),// 获取待办事项
|
||||
getVisionList:data => net.GET("/vision/list",data),// 获取测试记录
|
||||
todoFinished:data => net.PUT("/user/todo",data),// 修改待办列表状态
|
||||
// 百科
|
||||
getArticleList:data => net.GET("/article/list",data),// 百科列表
|
||||
getArticleDetail:data => net.GET("/article/"+data.id),// 文章详情
|
||||
// 我的
|
||||
getStarList:data => net.GET("/favorite/list",data),// 收藏列表
|
||||
getArticleDetail:data => net.GET("/article/"+data.id),// 百科列表
|
||||
|
||||
/*
|
||||
首页信息
|
||||
*/
|
||||
@ -415,7 +404,7 @@ const API = {
|
||||
transfer: data => net.POST('/api/v1/wxpay/transfer', data),
|
||||
|
||||
// 获取我的收藏分页列表
|
||||
// getStarList: data => net.POST('/api/v1/favorite/get', data),
|
||||
getStarList: data => net.POST('/api/v1/favorite/get', data),
|
||||
// 取消收藏
|
||||
cancelStar: data => net.DELETE('/api/v1/favorite',data),
|
||||
//添加收藏
|
||||
|
@ -19,27 +19,21 @@ export default {
|
||||
let token = uni.getStorageSync('access_token') || 'Basic ZGV2OmRldjEyMw==';
|
||||
const headers = {
|
||||
// "Content-Type": "application/json",
|
||||
// "Content-Type": "application/x-www-form-urlencoded",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Authorization": token,
|
||||
"x-token": token,
|
||||
"token":token,
|
||||
// "X-Forwarded-For":'client_ip'
|
||||
// 'Referer':'twzxjy.com'
|
||||
}
|
||||
if(!header) {
|
||||
headers["Content-Type"] = "application/json"
|
||||
}
|
||||
if(header && !header["Content-Type"]) {
|
||||
header["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
}
|
||||
var pages = getCurrentPages();
|
||||
var page = pages[pages.length - 1];
|
||||
return uni.request({
|
||||
url: config.baseUrl + url,
|
||||
method,
|
||||
header: {
|
||||
...headers,
|
||||
...header
|
||||
...header,
|
||||
...headers
|
||||
},
|
||||
data
|
||||
}).then(res => {
|
||||
|
@ -1,47 +0,0 @@
|
||||
<template>
|
||||
<view class="aikefuBox">
|
||||
<!-- 这是ai客服!!!! -->
|
||||
<unFab ref="fab" :pattern="pattern" horizontal="left" vertical="bottom"
|
||||
direction="horizontal" @fabClick="fabClick" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import unFab from '@/uni_modules/uni-fab/components/uni-fab/uni-fab.vue'
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
// import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick,computed} from "vue"
|
||||
// import unCombox from '@/uni_modules/uni-combox/components/uni-combox/uni-combox.vue'
|
||||
import {useStore} from '@/store/index.js'
|
||||
const store = useStore()
|
||||
import api from "@/api/index.js"
|
||||
const pattern = ref({
|
||||
color: '#7A7E83',
|
||||
backgroundColor: '#fff',
|
||||
selectedColor: '#26758d',
|
||||
buttonColor: '#26758d',
|
||||
iconColor: '#fff',
|
||||
icon:'headphones'
|
||||
})
|
||||
// const content = ref([{
|
||||
// iconPath: '/static/image.png',
|
||||
// selectedIconPath: '/static/image-active.png',
|
||||
// text: '相册',
|
||||
// active: false
|
||||
// }])
|
||||
function fabClick() {
|
||||
// uni.showToast({
|
||||
// title: '点击了悬浮按钮',
|
||||
// icon: 'none'
|
||||
// })
|
||||
uni.navigateTo({
|
||||
url:"/pages/index/aikefu"
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.aikefuBox{
|
||||
margin-top: 200rpx;
|
||||
}
|
||||
</style>
|
@ -21,7 +21,7 @@
|
||||
function lbtFunc(item) {
|
||||
// 新版数据结构的跳转形式
|
||||
uni.navigateTo({
|
||||
url:item.link
|
||||
url:item.url
|
||||
});
|
||||
return
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
<swiper-item @click="lbtFunc(item)" v-for="(item,i) in lbt_list">
|
||||
<view class="swiper-item uni-bg-red">
|
||||
<!-- <img style="width: 100%;" :src="item.url" alt=""> -->
|
||||
<image :src="item.imgUrl" style="width: 100%;" mode="widthFix"></image>
|
||||
<image :src="item.image" style="width: 100%;" mode="widthFix"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
@ -1,6 +1,6 @@
|
||||
// isdev 为 true 表示开发环境 false 表示发布环境
|
||||
const isdev = true;
|
||||
const baseUrl = isdev ? 'https://api.jimingyiliao.com' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境
|
||||
const baseUrl = isdev ? 'https://62bafc5f.r16.cpolar.top' : 'http://niunai.zhitou1688.com';// 办公室接口 & 测试环境
|
||||
// const baseUrl = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境
|
||||
// const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服)
|
||||
|
||||
|
60
pages.json
60
pages.json
@ -60,66 +60,6 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "视力测试"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/todo",
|
||||
"style": {
|
||||
"navigationBarTitleText": "待办事项",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/done",
|
||||
"style": {
|
||||
"navigationBarTitleText": "事务处理",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/visionList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "测试记录",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/note_list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "注意事项",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/setting/userAgreement",
|
||||
"style": {
|
||||
"navigationBarTitleText": "用户协议"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/setting/privacyPolicy",
|
||||
"style": {
|
||||
"navigationBarTitleText": "隐私政策"
|
||||
}
|
||||
},{
|
||||
"path": "pages/user/setting/phone_list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "个人信息手机清单"
|
||||
}
|
||||
},{
|
||||
"path": "pages/user/setting/aboutUs",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关于我们"
|
||||
}
|
||||
},{
|
||||
"path": "pages/index/aikefu",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客服中心"
|
||||
}
|
||||
},{
|
||||
"path": "pages/index/result",
|
||||
"style": {
|
||||
"navigationBarTitleText": "测试结果"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
@ -1,203 +0,0 @@
|
||||
<script setup>
|
||||
// 引入依赖
|
||||
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
||||
// import unCombox from '@/uni_modules/uni-combox/components/uni-combox/uni-combox.vue'
|
||||
import { onLoad,onShow } from "@dcloudio/uni-app"
|
||||
import mySwiper from "@/components/mySwiper.vue"
|
||||
import aikefu from "@/components/aikefu.vue"
|
||||
import {ref,onMounted,nextTick,watch,getCurrentInstance} from "vue"
|
||||
import api from '@/api/index.js'
|
||||
import {useStore} from '@/store/index.js'
|
||||
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
const store = useStore()
|
||||
onLoad((e) => {
|
||||
uni.createSelectorQuery().in(instance).select('.show-part').boundingClientRect((res)=>{
|
||||
w_h.value = res.height
|
||||
// console.log(res)
|
||||
}).exec()
|
||||
})
|
||||
// 变量
|
||||
const w_h = ref(0)
|
||||
const records = ref([
|
||||
{
|
||||
content:'您好,很高兴为您服务!',
|
||||
type:1,//1-客服;2-我
|
||||
}
|
||||
])
|
||||
const scrollContainer = ref()
|
||||
const in_content = ref('')
|
||||
const scrollTop = ref(0.01) //注意:不要设置成0,不然无效
|
||||
const instance = getCurrentInstance(); // 获取组件实例
|
||||
const is_loading = ref(false)
|
||||
// 函数
|
||||
async function sendFunc() {
|
||||
if(is_loading.value) {
|
||||
return
|
||||
}
|
||||
is_loading.value = true
|
||||
if(!in_content.value) {
|
||||
uni.showToast({
|
||||
title:"请填写内容",
|
||||
icon:'error',
|
||||
duration:2000,
|
||||
mask:true
|
||||
})
|
||||
is_loading.value = false
|
||||
return
|
||||
}
|
||||
|
||||
records.value.push({
|
||||
content:in_content.value,
|
||||
type:2
|
||||
})
|
||||
const res = await api.getReply({msg:in_content.value})
|
||||
is_loading.value = false
|
||||
if(res.code === 0) {
|
||||
in_content.value = ''
|
||||
// 判断用户输入的关键字是否有效
|
||||
if(res.data.content) {
|
||||
records.value.push({
|
||||
content:res.data.content,
|
||||
type:1
|
||||
})
|
||||
}
|
||||
else{
|
||||
records.value.push({
|
||||
content:'请输入正确的关键词',
|
||||
type:-1
|
||||
})
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:"error",
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
// 滚动条设置
|
||||
uni.createSelectorQuery().in(instance).select('#scroll-view-content').boundingClientRect((res)=>{
|
||||
let top = res.height-w_h.value+100;
|
||||
if(top>0){
|
||||
scrollTop.value = top;
|
||||
}
|
||||
// console.log(res.height,w_h.value)
|
||||
}).exec()
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="aikefuBox page-box page-bg-gray" style="height: 100%;">
|
||||
<!-- 信息展示区域 -->
|
||||
<!-- <view class="ac-part show-part" id="show-part" ref="scrollContainer" :style="{scrollTop:scrollTop}"> -->
|
||||
<scroll-view :scroll-with-animation="true" :scroll-y="true" class="ac-part show-part" scroll-y="true" :scroll-top="scrollTop">
|
||||
<view class="ac-listt-box" id="scroll-view-content">
|
||||
<view class="r_list-card" v-for="(item,i) in records">
|
||||
<view v-if="item.type!=-1" class="r-row" :class="item.type === 1?'row-left':'row-right'">
|
||||
<view class="r-avatar" v-if="item.type === 1">
|
||||
<image src="../../static/kefu.png" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="r-content" :class="{'r-content-right':item.type==2}">{{item.content}}</view>
|
||||
</view>
|
||||
<!-- 错误提示 -->
|
||||
<view class="r-row wrong-text" v-if="item.type==-1" style="color: #bfbfbf;text-align: center">
|
||||
{{item.content}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- </view> -->
|
||||
<!-- 输入区域 -->
|
||||
<view class="as-part input-part">
|
||||
<view class="input-box">
|
||||
<view class="ib-left">
|
||||
<input v-model="in_content" type="text" placeholder="输入您想咨询的内容">
|
||||
</view>
|
||||
<view class="ib-right">
|
||||
<view class="send_btn" @tap="sendFunc">发送</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.aikefuBox{
|
||||
height: 100%;
|
||||
.show-part{
|
||||
height: 88%;
|
||||
// overflow-y: auto;
|
||||
.ac-listt-box{
|
||||
padding: 20rpx;
|
||||
.r_list-card{
|
||||
margin: 40rpx 0;
|
||||
.r-row{
|
||||
overflow: hidden;
|
||||
.r-avatar{
|
||||
float: left;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
image{
|
||||
width: 100%;
|
||||
}
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.r-content{
|
||||
background-color: white;
|
||||
display: inline-block;
|
||||
padding: 20rpx;
|
||||
border-radius:0 20rpx 20rpx 20rpx;
|
||||
box-shadow: 10rpx 10rpx 10rpx #efefef;
|
||||
}
|
||||
.r-content-right{
|
||||
float: right;
|
||||
border-radius: 20rpx 0 20rpx 20rpx;
|
||||
background-color: #26758d;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.input-part{
|
||||
height: 12%;
|
||||
background: white;
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
.input-box{
|
||||
padding: 20rpx;
|
||||
display: flex;
|
||||
align-content: center;
|
||||
.ib-left{
|
||||
width: 88%;
|
||||
margin-right: 20rpx;
|
||||
input{
|
||||
width: 100%;
|
||||
border: 2rpx solid #c3c3c3;
|
||||
padding: 10rpx 8rpx;
|
||||
border-radius: 20rpx;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.ib-right{
|
||||
width: 12%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.send_btn{
|
||||
padding: 10rpx;
|
||||
background: #26758d;
|
||||
color: white;
|
||||
border-radius: 10rpx;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.ac-part{
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,266 +0,0 @@
|
||||
<script setup>
|
||||
// 引入依赖
|
||||
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
||||
import { onLoad,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
|
||||
// import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick,watch} from "vue"
|
||||
import api from '@/api/index.js'
|
||||
import util from "@/utils/index.js"
|
||||
import {useStore} from '@/store/index.js'
|
||||
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
import ccNewsTabs from '@/uni_modules/cc-newsTabs/components/cc-newsTabs/cc-newsTabs.vue'
|
||||
const store = useStore()
|
||||
// 生命周期
|
||||
onLoad((e) => {
|
||||
c_index.value = parseInt(e.state_index)
|
||||
list_box.value[c_index.value].queryParams.isFinish = c_index.value?0:1
|
||||
if(store.systemInfo) {
|
||||
swiper_h.value = store.systemInfo.windowHeight
|
||||
}
|
||||
getList()
|
||||
})
|
||||
onPullDownRefresh(()=> { // 下拉刷新
|
||||
init()
|
||||
getList()
|
||||
})
|
||||
onReachBottom(() => { // 上滑触底
|
||||
list_box.value[c_index.value].queryParams.page++
|
||||
getList()
|
||||
})
|
||||
// 变量
|
||||
const inputDialog = ref()
|
||||
const state_index = ref(0)
|
||||
const swiper_h = ref(0)
|
||||
const list = ref([])
|
||||
const list_box = ref([
|
||||
{
|
||||
show_index:0,
|
||||
state:1,
|
||||
list:[],
|
||||
queryParams:{
|
||||
page:1,
|
||||
pageSize:10,
|
||||
isFinish:1
|
||||
}
|
||||
},
|
||||
{
|
||||
show_index:1,
|
||||
state:0,
|
||||
list:[],
|
||||
queryParams:{
|
||||
page:1,
|
||||
pageSize:10,
|
||||
isFinish:1
|
||||
}
|
||||
}
|
||||
])
|
||||
const queryParams = ref({
|
||||
page:1,
|
||||
pageSize:10,
|
||||
isFinish:1
|
||||
})
|
||||
const c_index = ref(-1)
|
||||
const tabArr = ref([
|
||||
{
|
||||
name: '已完成',
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
name: '待完成',
|
||||
id: '2',
|
||||
}
|
||||
])
|
||||
// 函数
|
||||
function init(){
|
||||
// list.value = []
|
||||
list_box.value[c_index.value].list = []
|
||||
list_box.value[c_index.value].queryParams.page = 1
|
||||
list_box.value[c_index.value].queryParams.pageSize = 10
|
||||
}
|
||||
function queryStateInitFunc() {
|
||||
list_box.value[c_index.value].queryParams.isFinish = c_index.value?0:1
|
||||
}
|
||||
async function getList() {
|
||||
uni.showLoading({
|
||||
mask:true
|
||||
})
|
||||
const res = await api.getTodoist(list_box.value[c_index.value].queryParams)
|
||||
uni.hideLoading();
|
||||
if(res.code === 0) {
|
||||
if(res.data && res.data.length > 0) {
|
||||
// list.value.push(...res.data)
|
||||
list_box.value[c_index.value].list.push(...res.data)
|
||||
}
|
||||
else{
|
||||
list_box.value[c_index.value].queryParams.page--
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:"error",
|
||||
duration:2000,
|
||||
mask:true,
|
||||
success() {
|
||||
if(res.code === 7) // 登录失败
|
||||
{
|
||||
store.afterFailLogin(2000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function tabChange(currentIndex) {
|
||||
c_index.value = currentIndex
|
||||
// if(list_box.value[c_index.value].list.length === 0) {
|
||||
// queryStateInitFunc()
|
||||
// getList()
|
||||
// }
|
||||
|
||||
}
|
||||
function scroll_func(e) {
|
||||
c_index.value = e.detail.current
|
||||
if(list_box.value[c_index.value].list.length === 0) {
|
||||
queryStateInitFunc()
|
||||
getList()
|
||||
}
|
||||
}
|
||||
const handle_info = ref(null)
|
||||
const handle_info_index = ref(0)
|
||||
function handle_func(item,i) {
|
||||
handle_info.value = item
|
||||
handle_info_index.value = i
|
||||
inputDialog.value.open()
|
||||
}
|
||||
function finishFunc() {
|
||||
// api.todoFinished
|
||||
uni.showModal({
|
||||
title:'温馨提示',
|
||||
content:"确定要完成该事务吗?",
|
||||
success:async function(res) {
|
||||
if(res.confirm) {
|
||||
const res_ = await api.todoFinished({
|
||||
id:handle_info.value.ID,
|
||||
isFinish:1
|
||||
})
|
||||
uni.showToast({
|
||||
title:res_.msg,
|
||||
icon:"error",
|
||||
duration:2000,
|
||||
mask:true,
|
||||
success() {
|
||||
if(res_.code === 0) {
|
||||
list_box.value[c_index.value].list.splice(handle_info_index.value,1)
|
||||
list_box.value[0].list = []
|
||||
inputDialog.value.close()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="todoBox page-box">
|
||||
<cc-newsTabs :tabArr="tabArr" :o_index="c_index" @tabChange="tabChange"></cc-newsTabs>
|
||||
<swiper :current="c_index" @change="scroll_func" :style="{'--size':swiper_h+'px'}" class="swiper" circular :indicator-dots="false" :autoplay="false" >
|
||||
<swiper-item v-for="(item1,i1) in list_box">
|
||||
<view class="todoBox">
|
||||
<view v-for="(item,i) in item1.list" @tap="handle_func(item,i)" class="td-item swiper-item uni-bg-green">
|
||||
<view class="td-content text-ellipsis-2">
|
||||
{{item.content}}
|
||||
</view>
|
||||
<view class="td-info small-text">
|
||||
{{util.timestampToDate(item.CreatedAt)}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<uni-popup ref="inputDialog" >
|
||||
<view class="pop-box">
|
||||
<view class="pb-title">完善手术信息</view>
|
||||
<view class="pb-content">
|
||||
<view class="pb-item">
|
||||
<view class="pb-item-left">事项说明</view>
|
||||
<view class="pb-item-right">
|
||||
{{handle_info?.content}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="pb-item">
|
||||
<view class="pb-item-left">创建时间</view>
|
||||
<view class="pb-item-right">
|
||||
{{util.timestampToDate(handle_info?.CreatedAt)}}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!handle_info?.isFinish" class="pb-item pb-item-btn" @tap="finishFunc">完成该事务</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.swiper{
|
||||
height: var(--size);
|
||||
}
|
||||
.todoBox{
|
||||
padding: 20rpx;
|
||||
.td-item{
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 2rpx solid #eaeaea;
|
||||
margin-bottom: 20rpx;
|
||||
.td-content{
|
||||
padding-bottom:20rpx;
|
||||
}
|
||||
.td-info{
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
.pb-item-btn{
|
||||
padding: 20rpx 0;
|
||||
text-align: center;
|
||||
color: white;
|
||||
background: #26758d;
|
||||
justify-content: center;
|
||||
width: 66%;
|
||||
margin: 0 auto;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.pop-box{
|
||||
.pb-title{
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
padding-top: 20rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
background-color: white;
|
||||
padding: 20rpx;
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.pb-item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 40rpx;
|
||||
// justify-content: space-between;
|
||||
.pb-item-left{
|
||||
width: 30%;
|
||||
color: gray;
|
||||
}
|
||||
.pb-item-right{
|
||||
position: relative;
|
||||
margin-left: 10rpx;
|
||||
width: 75%;
|
||||
}
|
||||
}
|
||||
:deep(){
|
||||
.uni-popup__wrapper{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -2,169 +2,68 @@
|
||||
// 引入依赖
|
||||
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
||||
import unCombox from '@/uni_modules/uni-combox/components/uni-combox/uni-combox.vue'
|
||||
import { onLoad,onShow } from "@dcloudio/uni-app"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import mySwiper from "@/components/mySwiper.vue"
|
||||
import aikefu from "@/components/aikefu.vue"
|
||||
import {ref,onMounted,nextTick,watch} from "vue"
|
||||
import api from '@/api/index.js'
|
||||
import {ref,onMounted,nextTick} from "vue"
|
||||
import {useStore} from '@/store/index.js'
|
||||
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
const store = useStore()
|
||||
onShow((e) => {
|
||||
getLbtList()
|
||||
if(store.userInfo && !store.operation_info) { //登录过 且 未填写手术信息
|
||||
// getHospitalList()
|
||||
onLoad((e) => {
|
||||
if(!store.userInfo?.has_operation) { // 未填写手术信息
|
||||
operation_flag.value = true
|
||||
setTimeout(()=>{
|
||||
console.log(inputDialog.value)
|
||||
inputDialog.value.open()
|
||||
},0)
|
||||
}
|
||||
})
|
||||
|
||||
// 变量
|
||||
const hospitals = ref(null)
|
||||
// const hospitals_show = ref(false)
|
||||
const inputDialog = ref()
|
||||
const inputClose = ref()
|
||||
const choosed_h = ref(null)
|
||||
const blur_h = ref(0)
|
||||
const surgery_time = ref(null) // 手术时间
|
||||
const isSurgery = ref(-1) //是否已经手术 0为手术,1已经手术
|
||||
const lbt_list = ref([])
|
||||
// 失去焦点的监听
|
||||
// watch(blur_h,(val1,val2) => {
|
||||
// // hospitals.value = null
|
||||
// if(!choosed_h) { // 未选择值
|
||||
|
||||
// }
|
||||
// })
|
||||
const h_queryParams = ref({
|
||||
page:1,
|
||||
pageSize:1000,
|
||||
key:''
|
||||
})
|
||||
// 函数
|
||||
async function getHospitalList() {
|
||||
const res = await api.getHospitalList(h_queryParams.value)
|
||||
if(res.code == 0) {
|
||||
hospitals.value = res.data.list
|
||||
const operation_flag = ref(false)
|
||||
const lbt_list = ref([
|
||||
{
|
||||
banner_name: "首页轮播2",
|
||||
createtime: 1694851490,
|
||||
deletetime: null,
|
||||
id: 6,
|
||||
image: "http://niunai.zhitou1688.com/uploads/20230922/ea3b3348df5d2b41eb49ddbf86b83516.png",
|
||||
is_show: 1,
|
||||
type: "index",
|
||||
url: "",
|
||||
weigh: 6,
|
||||
},{
|
||||
banner_name: "首页轮播2",
|
||||
createtime: 1694851490,
|
||||
deletetime: null,
|
||||
id: 6,
|
||||
image: "/static/vip2.png",
|
||||
is_show: 1,
|
||||
type: "index",
|
||||
url: "",
|
||||
weigh: 6,
|
||||
}
|
||||
}
|
||||
async function getLbtList() { // 获取轮播图
|
||||
const res = await api.getLbtList()
|
||||
if(res.code == 0) {
|
||||
if(res.data.list) {
|
||||
lbt_list.value = res.data.list
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
function toClose() {
|
||||
inputDialog.value.close()
|
||||
}
|
||||
function radioChange(e) {
|
||||
isSurgery.value = e.detail.value
|
||||
console.log(e)
|
||||
}
|
||||
const single = ref('')
|
||||
function maskClick(e){
|
||||
// console.log('maskClick事件:', e);
|
||||
}
|
||||
const hValue = ref('') // 医院
|
||||
const hValueId = ref('') // 医院id
|
||||
function onClickH() {
|
||||
h_queryParams.value.key = hValue.value
|
||||
getHospitalList()
|
||||
|
||||
function onClickH(e) {
|
||||
// console.log(hValue.value)
|
||||
}
|
||||
function toExam() { // 视力测试
|
||||
uni.navigateTo({
|
||||
url:"/pages/index/visionTest"
|
||||
})
|
||||
}
|
||||
function toChooseH(item) {
|
||||
// console.log(item)
|
||||
choosed_h.value = item
|
||||
hValue.value = item.name
|
||||
// hospitals.value = null
|
||||
}
|
||||
// function blurFunc() {
|
||||
// blur_h.value = 1
|
||||
// hospitals.value = null
|
||||
// }
|
||||
function focusFunc() {
|
||||
// blur_h.value = 0
|
||||
}
|
||||
function toBlur(){
|
||||
hospitals.value = null
|
||||
}
|
||||
async function toSave() {
|
||||
if(isSurgery.value == -1) {
|
||||
return
|
||||
}
|
||||
if(!surgery_time.value) {
|
||||
return
|
||||
}
|
||||
if(!choosed_h.value || !choosed_h.value.ID) {
|
||||
return
|
||||
}
|
||||
let user_info = JSON.parse(uni.getStorageSync('userInfo'))
|
||||
let h_query = {
|
||||
isSurgery:parseInt(isSurgery.value),
|
||||
surgery_time:surgery_time.value,
|
||||
userId:user_info.userId,
|
||||
hospitalId:choosed_h.value?.ID
|
||||
}
|
||||
// console.log(h_query);return
|
||||
const res = await api.hospital(h_query)
|
||||
if(res.code == 0) {
|
||||
uni.showToast({
|
||||
title:"保存成功",
|
||||
icon:"success",
|
||||
duration:2000
|
||||
})
|
||||
uni.setStorageSync('operation_info',JSON.stringify(h_query))
|
||||
store.operation_info = JSON.stringify(h_query)
|
||||
toClose()
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:"error",
|
||||
duration:2000,
|
||||
success() {
|
||||
if(res.code === 7) // 登录失败
|
||||
{
|
||||
// // 清空缓存
|
||||
// uni.removeStorageSync('userInfo');
|
||||
// uni.removeStorageSync('access_token');
|
||||
// uni.removeStorageSync('avatarUrl');
|
||||
// uni.switchTab({
|
||||
// url:'/pages/user/index'
|
||||
// })
|
||||
store.afterFailLogin()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function todoFunc(state_index) {
|
||||
let url = '/pages/index/todo'
|
||||
url = '/pages/index/done?state_index='+state_index
|
||||
// if(state_index === 0) {
|
||||
// url = '/pages/index/done?state_index='+state_index
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
function toVisionList() {
|
||||
uni.navigateTo({
|
||||
url:"/pages/index/visionList"
|
||||
})
|
||||
}
|
||||
function toNote(index) {
|
||||
uni.navigateTo({
|
||||
url:"/pages/index/note_list?index="+index
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="content page-box">
|
||||
@ -176,28 +75,12 @@
|
||||
<uni-icons type="forward" color="#9bc027" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="attention-card">
|
||||
<view class="part-title">
|
||||
测试记录
|
||||
</view>
|
||||
<view class="ac-parts">
|
||||
<view @tap="toVisionList" class="ac-part" style="color: gray;" >
|
||||
视力测试记录
|
||||
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="attention-card">
|
||||
<view class="part-title">
|
||||
事务处理
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-cards">
|
||||
<view @tap="todoFunc(0)" class="mc-part" style="margin-left: 0;">
|
||||
<view class="mc-part" style="margin-left: 0;">
|
||||
<view class="mc-part-text">已完成事项</view>
|
||||
<image src="../../static/done.png" mode="widthFix"></image>
|
||||
</view>
|
||||
<view @tap="todoFunc(1)" class="mc-part mc-part2" style="margin-right: 0;">
|
||||
<view class="mc-part mc-part2" style="margin-right: 0;">
|
||||
<view class="mc-part-text">待完成事项</view>
|
||||
<image style="transform: rotate(0deg);" src="../../static/undone.png" mode="widthFix"></image>
|
||||
</view>
|
||||
@ -207,21 +90,21 @@
|
||||
注意事项
|
||||
</view>
|
||||
<view class="ac-parts">
|
||||
<view @tap="toNote(0)" class="ac-part" style="background: linear-gradient(45deg, #ffa2a2,#ffd3d3, #ffffff00);">
|
||||
<view class="ac-part" style="background: linear-gradient(45deg, #ffa2a2,#ffd3d3, #ffffff00);">
|
||||
术前注意事项
|
||||
<uni-icons type="forward" color="#ffa2a2" size="20"></uni-icons>
|
||||
</view>
|
||||
<view @tap="toNote(1)" class="ac-part" style="background: linear-gradient(45deg, #f9b275,#fff3e9, #ffffff00);">
|
||||
<view class="ac-part" style="background: linear-gradient(45deg, #f9b275,#fff3e9, #ffffff00);">
|
||||
术中注意事项
|
||||
<uni-icons type="forward" color="#f9b275" size="20"></uni-icons>
|
||||
</view>
|
||||
<view @tap="toNote(2)" class="ac-part" style="background: linear-gradient(45deg, #8fdc8a,#fdfdfd, #ffffff00);">
|
||||
<view class="ac-part" style="background: linear-gradient(45deg, #8fdc8a,#fdfdfd, #ffffff00);">
|
||||
术后注意事项
|
||||
<uni-icons type="forward" color="#8fdc8a" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-popup ref="inputDialog" @tap="toBlur" :is-mask-click='false'>
|
||||
<uni-popup ref="inputDialog" :is-mask-click='false'>
|
||||
<view class="pop-box">
|
||||
<view class="pb-title">完善手术信息</view>
|
||||
<view class="pb-content">
|
||||
@ -238,22 +121,15 @@
|
||||
<view class="pb-item-left">手术时间</view>
|
||||
<view class="pb-item-right">
|
||||
<!-- <uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" /> -->
|
||||
<uniDatetimePicker type="date" :clear-icon="false" v-model="surgery_time" @maskClick="maskClick" ></uniDatetimePicker>
|
||||
<uniDatetimePicker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" ></uniDatetimePicker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pb-item">
|
||||
<view class="pb-item-left">医院名称</view>
|
||||
<view class="pb-item-right">
|
||||
<!-- <uniEasyinput @tap.stop="focusFunc" suffixIcon="search" v-model="hValue" focus placeholder="请输入内容" @iconClick="onClickH"></uniEasyinput>
|
||||
<view class="h_res_show_aprt" v-if="hospitals">
|
||||
<view v-for="(item,i) in hospitals" @tap.stop="toChooseH(item)" class="h_res_show_aprt_row text-ellipsis-1">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view> -->
|
||||
<uni-combox @input="onClickH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="hValue"></uni-combox>
|
||||
<uniEasyinput suffixIcon="search" v-model="hValue" focus placeholder="请输入内容" @iconClick="onClickH"></uniEasyinput>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pb-item pb-item-btn" @tap="toSave">提交</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pop-close" @tap="toClose">
|
||||
@ -262,40 +138,9 @@
|
||||
<!-- <uni-popup-dialog ref="inputClose" mode="input" title="输入内容" value="对话框预置提示内容!"
|
||||
placeholder="请输入内容" @confirm="dialogInputConfirm"></uni-popup-dialog> -->
|
||||
</uni-popup>
|
||||
<aikefu />
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.pb-item-btn{
|
||||
padding: 20rpx 0;
|
||||
text-align: center;
|
||||
color: white;
|
||||
background: #26758d;
|
||||
justify-content: center;
|
||||
width: 66%;
|
||||
margin: 0 auto;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.h_res_show_aprt{
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
width: 100%;
|
||||
background: white;
|
||||
z-index: 10;
|
||||
box-shadow: 1px 2px 10px #02020236;
|
||||
border: 1px solid #e3e3e3;
|
||||
max-height: 400rpx;
|
||||
overflow-y: auto;
|
||||
left: 0;
|
||||
.h_res_show_aprt_row{
|
||||
padding: 20rpx 10rpx;
|
||||
border-bottom: 2rpx #e3e3e3 solid;
|
||||
color: gray;
|
||||
}
|
||||
.h_res_show_aprt_row:last-child{
|
||||
border-bottom:unset
|
||||
}
|
||||
}
|
||||
.mc-row{
|
||||
display:flex;
|
||||
// width: 100%;
|
||||
@ -319,10 +164,8 @@
|
||||
// justify-content: space-between;
|
||||
.pb-item-left{
|
||||
width: 30%;
|
||||
color: gray;
|
||||
}
|
||||
.pb-item-right{
|
||||
position: relative;
|
||||
margin-left: 10rpx;
|
||||
width: 75%;
|
||||
}
|
||||
|
@ -1,281 +0,0 @@
|
||||
<script setup>
|
||||
// 引入依赖
|
||||
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
||||
import { onLoad,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
|
||||
// import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick,watch} from "vue"
|
||||
import api from '@/api/index.js'
|
||||
import util from "@/utils/index.js"
|
||||
import {useStore} from '@/store/index.js'
|
||||
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
import ccNewsTabs from '@/uni_modules/cc-newsTabs/components/cc-newsTabs/cc-newsTabs.vue'
|
||||
const store = useStore()
|
||||
// 生命周期
|
||||
onLoad((e) => {
|
||||
c_index.value = parseInt(e.index)
|
||||
list_box.value[c_index.value].queryParams.state = c_index.value==0?1:c_index.value==1?2:3
|
||||
if(store.systemInfo) {
|
||||
swiper_h.value = store.systemInfo.windowHeight
|
||||
}
|
||||
getList()
|
||||
})
|
||||
onPullDownRefresh(()=> { // 下拉刷新
|
||||
init()
|
||||
getList()
|
||||
})
|
||||
onReachBottom(() => { // 上滑触底
|
||||
list_box.value[c_index.value].queryParams.page++
|
||||
getList()
|
||||
})
|
||||
// 变量
|
||||
const inputDialog = ref()
|
||||
const state_index = ref(0)
|
||||
const swiper_h = ref(0)
|
||||
const list = ref([])
|
||||
const list_box = ref([
|
||||
{
|
||||
show_index:0,
|
||||
state:1,
|
||||
list:[],
|
||||
queryParams:{
|
||||
page:1,
|
||||
pageSize:10,
|
||||
statet:1
|
||||
}
|
||||
},
|
||||
{
|
||||
show_index:1,
|
||||
state:2,
|
||||
list:[],
|
||||
queryParams:{
|
||||
page:1,
|
||||
pageSize:10,
|
||||
statet:2
|
||||
}
|
||||
},
|
||||
{
|
||||
show_index:1,
|
||||
state:3,
|
||||
list:[],
|
||||
queryParams:{
|
||||
page:1,
|
||||
pageSize:10,
|
||||
statet:3
|
||||
}
|
||||
}
|
||||
])
|
||||
const queryParams = ref({
|
||||
page:1,
|
||||
pageSize:10,
|
||||
state:1
|
||||
})
|
||||
const c_index = ref(-1)
|
||||
const tabArr = ref([
|
||||
{
|
||||
name: '手术前',
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
name: '手术中',
|
||||
id: '2',
|
||||
},
|
||||
{
|
||||
name: '手术后',
|
||||
id: '3',
|
||||
}
|
||||
])
|
||||
// 函数
|
||||
function init(){
|
||||
// list.value = []
|
||||
list_box.value[c_index.value].list = []
|
||||
list_box.value[c_index.value].queryParams.page = 1
|
||||
list_box.value[c_index.value].queryParams.pageSize = 10
|
||||
}
|
||||
function queryStateInitFunc() {
|
||||
list_box.value[c_index.value].queryParams.state = c_index.value?0:1
|
||||
}
|
||||
async function getList() {
|
||||
uni.showLoading({
|
||||
mask:true
|
||||
})
|
||||
const res = await api.getTodoist(list_box.value[c_index.value].queryParams)
|
||||
uni.hideLoading();
|
||||
if(res.code === 0) {
|
||||
if(res.data && res.data.length > 0) {
|
||||
// list.value.push(...res.data)
|
||||
list_box.value[c_index.value].list.push(...res.data)
|
||||
}
|
||||
else{
|
||||
list_box.value[c_index.value].queryParams.page--
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:"error",
|
||||
duration:2000,
|
||||
mask:true,
|
||||
success() {
|
||||
if(res.code === 7) // 登录失败
|
||||
{
|
||||
store.afterFailLogin(2000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function tabChange(currentIndex) {
|
||||
c_index.value = currentIndex
|
||||
// if(list_box.value[c_index.value].list.length === 0) {
|
||||
// queryStateInitFunc()
|
||||
// getList()
|
||||
// }
|
||||
|
||||
}
|
||||
function scroll_func(e) {
|
||||
c_index.value = e.detail.current
|
||||
if(list_box.value[c_index.value].list.length === 0) {
|
||||
queryStateInitFunc()
|
||||
getList()
|
||||
}
|
||||
}
|
||||
const handle_info = ref(null)
|
||||
const handle_info_index = ref(0)
|
||||
function handle_func(item,i) {
|
||||
handle_info.value = item
|
||||
handle_info_index.value = i
|
||||
inputDialog.value.open()
|
||||
}
|
||||
function finishFunc() {
|
||||
// api.todoFinished
|
||||
uni.showModal({
|
||||
title:'温馨提示',
|
||||
content:"确定要完成该事务吗?",
|
||||
success:async function(res) {
|
||||
if(res.confirm) {
|
||||
const res_ = await api.todoFinished({
|
||||
id:handle_info.value.ID,
|
||||
state:1
|
||||
})
|
||||
uni.showToast({
|
||||
title:res_.msg,
|
||||
icon:"error",
|
||||
duration:2000,
|
||||
mask:true,
|
||||
success() {
|
||||
if(res_.code === 0) {
|
||||
list_box.value[c_index.value].list.splice(handle_info_index.value,1)
|
||||
list_box.value[0].list = []
|
||||
inputDialog.value.close()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="todoBox page-box">
|
||||
<cc-newsTabs :tabArr="tabArr" :o_index="c_index" @tabChange="tabChange"></cc-newsTabs>
|
||||
<swiper :current="c_index" @change="scroll_func" :style="{'--size':swiper_h+'px'}" class="swiper" circular :indicator-dots="false" :autoplay="false" >
|
||||
<swiper-item v-for="(item1,i1) in list_box">
|
||||
<view class="todoBox">
|
||||
<view v-for="(item,i) in item1.list" @tap="handle_func(item,i)" class="td-item swiper-item uni-bg-green">
|
||||
<view class="td-content text-ellipsis-2">
|
||||
{{item.content}}
|
||||
</view>
|
||||
<view class="td-info small-text">
|
||||
{{util.timestampToDate(item.CreatedAt)}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<uni-popup ref="inputDialog" >
|
||||
<view class="pop-box">
|
||||
<view class="pb-title">注意事项</view>
|
||||
<view class="pb-content">
|
||||
<view class="pb-item">
|
||||
<!-- <view class="pb-item-left">事项说明</view> -->
|
||||
<view class="pb-item-right">
|
||||
{{handle_info?.content}}
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="pb-item">
|
||||
<view class="pb-item-left">创建时间</view>
|
||||
<view class="pb-item-right">
|
||||
{{util.timestampToDate(handle_info?.CreatedAt)}}
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view v-if="!handle_info?.state" class="pb-item pb-item-btn" @tap="finishFunc">完成该事务</view> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.swiper{
|
||||
height: var(--size);
|
||||
}
|
||||
.todoBox{
|
||||
padding: 20rpx;
|
||||
.td-item{
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 2rpx solid #eaeaea;
|
||||
margin-bottom: 20rpx;
|
||||
.td-content{
|
||||
padding-bottom:20rpx;
|
||||
}
|
||||
.td-info{
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
.pb-item-btn{
|
||||
padding: 20rpx 0;
|
||||
text-align: center;
|
||||
color: white;
|
||||
background: #26758d;
|
||||
justify-content: center;
|
||||
width: 66%;
|
||||
margin: 0 auto;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.pop-box{
|
||||
.pb-title{
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
padding-top: 20rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
background-color: white;
|
||||
padding: 20rpx;
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.pb-item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 40rpx;
|
||||
// justify-content: space-between;
|
||||
.pb-item-left{
|
||||
width: 30%;
|
||||
color: gray;
|
||||
}
|
||||
.pb-item-right{
|
||||
position: relative;
|
||||
margin-left: 10rpx;
|
||||
width: 75%;
|
||||
}
|
||||
}
|
||||
:deep(){
|
||||
.uni-popup__wrapper{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,163 +0,0 @@
|
||||
<script setup>
|
||||
// 引入依赖
|
||||
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
// import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick} from "vue"
|
||||
import {useStore} from '@/store/index.js'
|
||||
import api from "@/api/index.js"
|
||||
const store = useStore()
|
||||
onLoad((e) => {
|
||||
res_.value = JSON.parse(decodeURIComponent(e.res))
|
||||
console.log(res_.value)
|
||||
randomFunc()
|
||||
})
|
||||
// 变量
|
||||
const res_ = ref(null)
|
||||
const userInfo = ref(null)
|
||||
const bg_imgs = ref([
|
||||
'https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result1.jpg',
|
||||
'https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result2.jpg',
|
||||
'https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result3.jpg',
|
||||
])
|
||||
const bg_index = ref(0)
|
||||
const avatarUrl = ref(null)
|
||||
const info = ref({left:'',right:''})
|
||||
const show_ = ref(false)
|
||||
// 函数
|
||||
function randomFunc() {
|
||||
bg_index.value = parseInt((Math.random()*3))
|
||||
uni.getImageInfo({
|
||||
src:bg_imgs.value[bg_index.value],
|
||||
success:function(res) {
|
||||
avatarUrl.value = uni.getStorageSync('avatarUrl')
|
||||
info.value.left = res_.value.leftEyeVision
|
||||
info.value.right = res_.value.rightEyeVision
|
||||
show_.value = true
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="visionTestBox page-box">
|
||||
<!-- <view class="actionBox" :style="{background:`url(${bg_imgs[bg_index]})`}">
|
||||
测试
|
||||
</view> -->
|
||||
<view class="actionBox">
|
||||
<view class="img-box">
|
||||
<image style="width: 100%;" :src="bg_imgs[bg_index]" mode="widthFix"></image>
|
||||
<view v-if="show_" class="avatar-box">
|
||||
<image :src="avatarUrl" mode="widthFix"></image>
|
||||
</view>
|
||||
<view v-if="show_" class="res-text-row">
|
||||
<view class="rtr-left">{{info.left}}</view>
|
||||
<view class="rtr-right">{{info.right}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.avatar-box{
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top:280rpx;
|
||||
image{
|
||||
width: 260rpx;
|
||||
margin: 0px auto;
|
||||
display: block;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.img-box{
|
||||
position: relative;
|
||||
.res-text-row{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
top: 47%;
|
||||
font-weight: 900;
|
||||
color:gray;
|
||||
.rtr-left{
|
||||
margin-left: 20%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.visionTestBox,.actionBox{
|
||||
height: 100%;
|
||||
}
|
||||
.actionBox{
|
||||
.ab-show-box{
|
||||
// width: 100%;
|
||||
height: 50%;
|
||||
border: 2rpx solid #d0d0d0;
|
||||
margin: 10rpx;
|
||||
margin-top: 0px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
image{
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
.ab-action-box{
|
||||
.ac-row{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.ac-row-card-text{
|
||||
padding: 10rpx !important;
|
||||
width: 80rpx !important;
|
||||
height: 80rpx !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.ac-row-card{
|
||||
// white-space: nowrap;
|
||||
margin: 20rpx;
|
||||
font-size: 24rpx;
|
||||
border-radius: 50%;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
padding: 30rpx;
|
||||
box-shadow: 2rpx 20rpx 40rpx #dfdfdf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.content-text{
|
||||
margin-bottom: 20rpx;
|
||||
.ct-title{
|
||||
text-align: center;
|
||||
font-size: 34px;
|
||||
color: #26758d;
|
||||
}
|
||||
}
|
||||
.okBtn{
|
||||
width: 100%;
|
||||
color: white;
|
||||
background-color: #26758d;
|
||||
padding: 20rpx;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.pop-box{
|
||||
.pb-title{
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
background-color: white;
|
||||
padding: 20rpx;
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
</style>
|
@ -1,84 +0,0 @@
|
||||
<script setup>
|
||||
// 引入依赖
|
||||
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
||||
import { onLoad,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
|
||||
// import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick,watch} from "vue"
|
||||
import api from '@/api/index.js'
|
||||
import util from "@/utils/index.js"
|
||||
import {useStore} from '@/store/index.js'
|
||||
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
const store = useStore()
|
||||
// 生命周期
|
||||
onLoad((e) => {
|
||||
getList()
|
||||
})
|
||||
onPullDownRefresh(()=> { // 下拉刷新
|
||||
init()
|
||||
getList()
|
||||
})
|
||||
onReachBottom(() => { // 上滑触底
|
||||
queryParams.value.page++
|
||||
getList()
|
||||
})
|
||||
// 变量
|
||||
const list = ref([])
|
||||
const queryParams = ref({
|
||||
page:1,
|
||||
pageSize:10,
|
||||
isFinish:0
|
||||
})
|
||||
// 函数
|
||||
function init(){
|
||||
list.value = []
|
||||
queryParams.value.page = 1
|
||||
queryParams.value.pageSize = 10
|
||||
}
|
||||
async function getList() {
|
||||
const res = await api.getTodoist(queryParams.value)
|
||||
if(res.code === 0) {
|
||||
if(res.data && res.data.length > 0) {
|
||||
list.value.push(...res.data)
|
||||
}
|
||||
else{
|
||||
queryParams.value.page--
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:"获取失败",
|
||||
icon:"error",
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="todoBox page-box">
|
||||
<view class="td-item" v-for="(item,i) in list">
|
||||
<view class="td-content text-ellipsis-2">
|
||||
{{item.content}}
|
||||
</view>
|
||||
<view class="td-info small-text">
|
||||
{{util.timestampToDate(item.CreatedAt)}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.todoBox{
|
||||
padding: 20rpx;
|
||||
.td-item{
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 2rpx solid #eaeaea;
|
||||
margin-bottom: 20rpx;
|
||||
.td-content{
|
||||
padding-bottom:20rpx;
|
||||
}
|
||||
.td-info{
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,104 +0,0 @@
|
||||
<script setup>
|
||||
// 引入依赖
|
||||
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
||||
import { onLoad,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
|
||||
import emptyCard from "@/components/emptyCard.vue"
|
||||
import {ref,onMounted,nextTick,watch} from "vue"
|
||||
import api from '@/api/index.js'
|
||||
import util from "@/utils/index.js"
|
||||
import {useStore} from '@/store/index.js'
|
||||
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
const store = useStore()
|
||||
// 生命周期
|
||||
onLoad((e) => {
|
||||
if(store.userInfo){
|
||||
let user_info = JSON.parse(store.userInfo)
|
||||
queryParams.value.userId = user_info.userId
|
||||
}
|
||||
getList()
|
||||
})
|
||||
onPullDownRefresh(()=> { // 下拉刷新
|
||||
init()
|
||||
getList()
|
||||
})
|
||||
onReachBottom(() => { // 上滑触底
|
||||
queryParams.value.page++
|
||||
getList()
|
||||
})
|
||||
// 变量
|
||||
const list = ref([])
|
||||
const queryParams = ref({
|
||||
page:1,
|
||||
pageSize:10,
|
||||
userId:0
|
||||
})
|
||||
// 函数
|
||||
function init(){
|
||||
list.value = []
|
||||
queryParams.value.page = 1
|
||||
queryParams.value.pageSize = 10
|
||||
}
|
||||
async function getList() {
|
||||
const res = await api.getVisionList(queryParams.value)
|
||||
if(res.code === 0) {
|
||||
if(res.data.list && res.data.list.length > 0) {
|
||||
list.value.push(...res.data.list)
|
||||
}
|
||||
else{
|
||||
queryParams.value.page--
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:"获取失败",
|
||||
icon:"error",
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="visinoListBox page-box">
|
||||
<view class="vl-item-box" v-if="list.length > 0">
|
||||
<view class="vl-item" v-for="(item,i) in list">
|
||||
<view class="vl-title">{{util.timestampToDate(item.CreatedAt)}}</view>
|
||||
<view class="vl-row-box">
|
||||
<view class="vl-row">
|
||||
<view class="vlr-left">右眼</view>
|
||||
<view class="vlr-left">{{item.rightEyeVision}}</view>
|
||||
</view>
|
||||
<view class="vl-row">
|
||||
<view class="vlr-left">左眼</view>
|
||||
<view class="vlr-left">{{item.leftEyeVision}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<emptyCard v-else></emptyCard>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.visinoListBox{
|
||||
.vl-item-box{
|
||||
padding: 20rpx;
|
||||
.vl-item{
|
||||
.vl-title{
|
||||
border-left: 4rpx solid red;
|
||||
}
|
||||
.vl-row-box{
|
||||
.vl-row{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.vlr-left{
|
||||
|
||||
}
|
||||
.vlr-right{
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -6,31 +6,22 @@
|
||||
// import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick} from "vue"
|
||||
import {useStore} from '@/store/index.js'
|
||||
import api from "@/api/index.js"
|
||||
const store = useStore()
|
||||
onLoad((e) => {
|
||||
userInfo.value = JSON.parse(store.userInfo)
|
||||
countDown.value = countDown_init
|
||||
// if(!store.userInfo?.has_operation) { // 未填写手术信息
|
||||
// setTimeout(()=>{
|
||||
// // console.log(inputDialog.value)
|
||||
// inputDialog.value.open()
|
||||
// },0)
|
||||
// }
|
||||
setTimeout(()=>{
|
||||
// console.log(inputDialog.value)
|
||||
inputDialog.value.open()
|
||||
},0)
|
||||
if(!store.userInfo?.has_operation) { // 未填写手术信息
|
||||
setTimeout(()=>{
|
||||
// console.log(inputDialog.value)
|
||||
inputDialog.value.open()
|
||||
},0)
|
||||
}
|
||||
})
|
||||
// 变量
|
||||
const userInfo = ref(null)
|
||||
const inputDialog = ref()
|
||||
const inputDialog2 = ref()
|
||||
const inputDialog3 = ref()
|
||||
const step1 = ref('先测右眼,请遮住左眼')
|
||||
const step2 = ref('请遮住右眼')
|
||||
const countDown = ref(null) // 倒计时
|
||||
const countDown_init = 3
|
||||
const countDown = ref(5)
|
||||
const scale_ = ref(1)
|
||||
const current_img = ref("") // 当前图片
|
||||
const current_img_index = ref(null)
|
||||
@ -68,19 +59,13 @@
|
||||
width:'29px'
|
||||
})
|
||||
const num = ref(0)
|
||||
const now = ref(1); // 1-右眼;2-左眼
|
||||
const now = ref(1)
|
||||
const vision_info = ref({
|
||||
left:4,
|
||||
right:4
|
||||
right:4.1
|
||||
})
|
||||
const is_test = ref(true)
|
||||
// 函数
|
||||
function toStart() { // 开始测试
|
||||
// if(is_test.value) {
|
||||
// uni.navigateTo({
|
||||
// url:'/pages/index/result'
|
||||
// })
|
||||
// }
|
||||
inputDialog.value.close()
|
||||
inputDialog2.value.open()
|
||||
let s = setInterval(() => {
|
||||
@ -108,31 +93,22 @@
|
||||
}
|
||||
function chooseFunc(index) {
|
||||
// 先执行加减分
|
||||
if(!index || index!=current_img_index.value){ // 不加分
|
||||
if(!index){ // 扣分
|
||||
|
||||
}
|
||||
else{ // 加分
|
||||
if(now.value == 1) { // 右眼
|
||||
vision_info.value.right+=0.1
|
||||
vision_info.value.right = Number(vision_info.value.right.toFixed(1))
|
||||
}
|
||||
else{ // 左眼
|
||||
vision_info.value.left+=0.1
|
||||
vision_info.value.left = Number(vision_info.value.left.toFixed(1))
|
||||
}
|
||||
}
|
||||
// 换图片
|
||||
randomFunc()
|
||||
|
||||
// 判断是否结束,换眼
|
||||
if(num.value>8) { // 结束换眼
|
||||
if(now.value == 2) { // 结束测试
|
||||
inputDialog3.value.open()
|
||||
|
||||
return
|
||||
}
|
||||
show_size.value.width = '29px'
|
||||
countDown.value = countDown_init
|
||||
countDown.value = 5
|
||||
step1.value = '测左眼,请遮住右眼'
|
||||
num.value = 0
|
||||
num.value = 8
|
||||
now.value = 2
|
||||
toStart()
|
||||
}
|
||||
@ -141,32 +117,8 @@
|
||||
num.value++
|
||||
}
|
||||
}
|
||||
async function okFunc() { // 结束测试
|
||||
// inputDialog3.value.open()
|
||||
uni.showLoading({
|
||||
mask:true
|
||||
})
|
||||
const params = {
|
||||
leftEyeVision:vision_info.value.left+'',
|
||||
rightEyeVision:vision_info.value.right+'',
|
||||
userId:userInfo.value.userId
|
||||
}
|
||||
const res = await api.saveVision(params)
|
||||
uni.hideLoading()
|
||||
if(res.code == 0) {
|
||||
uni.showToast({
|
||||
title:"保存成功",
|
||||
icon:"success",
|
||||
duration:2000,
|
||||
success: function (res1){
|
||||
// uni.navigateBack()
|
||||
uni.redirectTo({
|
||||
url:"/pages/index/result?res="+encodeURIComponent(JSON.stringify(params))
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
function okFunc() { // 结束测试
|
||||
inputDialog3.value.open()
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@ -195,10 +147,8 @@
|
||||
<view class="pop-box">
|
||||
<view class="pb-title">测试须知</view>
|
||||
<view class="pb-content">
|
||||
<view class="content-text" style="color: gray;">
|
||||
1.适应室内光纤两分钟左右。
|
||||
2.取坐位或站立、正对手机,检查者眼部跟手机平行,保持手机距离40厘米。
|
||||
3.先测右眼后测左眼,测试时请遮挡另一只眼睛。
|
||||
<view class="content-text">
|
||||
使用uni-app自带的editor组件,该组件支持App、H5、微信小程序,其他家小程序自身未提供这类解决方案。
|
||||
</view>
|
||||
<view class="okBtn" @tap="toStart">确定</view>
|
||||
</view>
|
||||
@ -216,16 +166,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<uni-popup ref="inputDialog3" :is-mask-click='false'>
|
||||
<uni-popup ref="inputDialog3" :is-mask-click='true'>
|
||||
<view class="pop-box">
|
||||
<view class="pb-title">测试结束</view>
|
||||
<view class="pb-content">
|
||||
<view class="content-text">
|
||||
测试结束,当前视力为{{vision_info.left}}(左),{{vision_info.right}}(右)。
|
||||
<view style="opacity: 0;">
|
||||
使用uni-app自带的editor组件,该组件支持App、H5、微信小程序,其他家小程序自身未提供这类解决方案。
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="okBtn" @tap="okFunc">确定</view>
|
||||
</view>
|
||||
@ -248,7 +194,7 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
image{
|
||||
height: auto;
|
||||
// width: 29px;
|
||||
}
|
||||
}
|
||||
.ab-action-box{
|
||||
|
@ -7,14 +7,12 @@
|
||||
const store = useStore()
|
||||
import api from "@/api/index"
|
||||
import custom from "@/utils/index.js"
|
||||
onLoad((e) => {
|
||||
token_info.value = JSON.parse(decodeURIComponent(e.token_info))
|
||||
onLoad(() => {
|
||||
// is_login.value = custom.checkLogin()
|
||||
// console.log(is_login.value)
|
||||
})
|
||||
|
||||
// 变量
|
||||
const token_info = ref(null)
|
||||
const avatarUrl = ref(null)
|
||||
const nickname = ref('')
|
||||
const res_form = ref(null)
|
||||
@ -36,47 +34,28 @@
|
||||
// console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
|
||||
// console.log(e.detail.errno) // 错误码(失败时返回)
|
||||
}
|
||||
async function getAccess_token(code){//
|
||||
async function getAccess_token(params={}){//获取token 获取手机号
|
||||
//清除token缓存
|
||||
// wx.clearStorageSync();
|
||||
if(!avatarUrl.value) {
|
||||
uni.showToast({
|
||||
title:"请选择头像!",
|
||||
icon:"error",
|
||||
duration:1500
|
||||
})
|
||||
return
|
||||
}
|
||||
if(!nickname.value) {
|
||||
uni.showToast({
|
||||
title:"请填写昵称!",
|
||||
icon:"error",
|
||||
duration:1500
|
||||
})
|
||||
return
|
||||
}
|
||||
//访问接口
|
||||
// console.log(code.value);return
|
||||
// const data={
|
||||
// username:code,//手机号按钮获取的code
|
||||
// type:'wechat_mini_app',
|
||||
// identity:'user',
|
||||
// password:'111',
|
||||
// avatarUrl:avatarUrl.value,
|
||||
// nickName:nickname.value
|
||||
// }
|
||||
const data={
|
||||
username:params.code,//手机号按钮获取的code
|
||||
type:'wechat_mini_app',
|
||||
identity:'user',
|
||||
password:'111',
|
||||
avatarUrl:avatarUrl.value,
|
||||
nickName:nickname.value
|
||||
}
|
||||
// console.log('登录参数:',data);return;
|
||||
// const res = await api.getToken(data)
|
||||
// if(res.code === 200) {
|
||||
// uni.setStorageSync('avatarUrl', avatarUrl.value);//avatarUrl
|
||||
// res_form.value = res.data
|
||||
// res_form.value.access_token = 'Bearer '+res.data.access_token
|
||||
// let userId = res.data.userId
|
||||
// uni.setStorageSync('access_token',res_form.value.access_token);// token单独缓存一次
|
||||
// wx_login(userId)
|
||||
// }
|
||||
uni.setStorageSync('avatarUrl', avatarUrl.value);//avatarUrl
|
||||
wx_login(userId)
|
||||
const res = await api.getToken(data)
|
||||
if(res.code === 200) {
|
||||
uni.setStorageSync('avatarUrl', avatarUrl.value);//avatarUrl
|
||||
res_form.value = res.data
|
||||
res_form.value.access_token = 'Bearer '+res.data.access_token
|
||||
let userId = res.data.userId
|
||||
uni.setStorageSync('access_token',res_form.value.access_token);// token单独缓存一次
|
||||
wx_login(userId)
|
||||
}
|
||||
}
|
||||
async function wx_login(userId){
|
||||
let res=await new Promise(resolve=>{
|
||||
@ -98,7 +77,6 @@
|
||||
avatarUrl.value = file.data.file.url
|
||||
uni.setStorageSync('avatarUrl', file.data.file.url);//头像链接
|
||||
const up_res = await updateFunc() // 更新用户信息
|
||||
// isInfo // 判断是否填过手术信息的字段(是否使用待定)
|
||||
uni.switchTab({
|
||||
url:"/pages/user/index"
|
||||
})
|
||||
@ -120,39 +98,6 @@
|
||||
// console.log('拿到的值:',e)
|
||||
// console.log('nickname:',nickname.value)
|
||||
}
|
||||
async function updateInfoFunc() {
|
||||
if(!avatarUrl.value) {
|
||||
uni.showToast({
|
||||
title:"请选择头像!",
|
||||
icon:"error",
|
||||
duration:1500
|
||||
})
|
||||
return
|
||||
}
|
||||
if(!nickname.value) {
|
||||
uni.showToast({
|
||||
title:"请填写昵称!",
|
||||
icon:"error",
|
||||
duration:1500
|
||||
})
|
||||
return
|
||||
}
|
||||
// let user_info = JSON.parse(uni.getStorageSync('userInfo'))
|
||||
await custom.uploadImage(avatarUrl.value,async (file)=>{
|
||||
avatarUrl.value = file.data.file.url
|
||||
uni.setStorageSync('avatarUrl', file.data.file.url);//头像链接
|
||||
token_info.value.nickname = nickname.value
|
||||
token_info.value.avatar = avatarUrl.value
|
||||
uni.setStorageSync('userInfo',JSON.stringify(token_info.value))
|
||||
const up_res = await updateFunc() // 更新用户信息
|
||||
|
||||
uni.setStorageSync('access_token','Bearer '+token_info.value.access_token);// token单独缓存一次
|
||||
uni.switchTab({
|
||||
url:"/pages/user/index"
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="loginBox page-box img-part card-part" style="text-align:center">
|
||||
@ -164,8 +109,7 @@
|
||||
<input type="nickname" @blur="nameInput" class="weui-input" placeholder="请输入昵称" v-model="nickname" />
|
||||
</view>
|
||||
<view class="btn-part">
|
||||
<!-- <button class="buy-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">立即登录</button> -->
|
||||
<button class="buy-btn" @tap="updateInfoFunc">立即登录</button>
|
||||
<button class="buy-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">立即登录</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<template>
|
||||
<view class="feedbackBox">
|
||||
<view class="writeBox">
|
||||
<textarea placeholder="输入您的问题" class="textarea" v-model="txt"></textarea>
|
||||
<textarea class="textarea" v-model="txt"></textarea>
|
||||
</view>
|
||||
<view class="btn-part">
|
||||
<view class="btn">提交</view>
|
||||
|
@ -8,29 +8,73 @@
|
||||
import api from "@/api/index"
|
||||
import custom from "@/utils/index.js"
|
||||
onShow(() => {
|
||||
getInfo()
|
||||
is_login.value = custom.checkLogin()
|
||||
// console.log(is_login.value)
|
||||
if(is_login.value) {
|
||||
userinfo.value = uni.getStorageSync('userInfo')
|
||||
avatar.value = uni.getStorageSync('avatarUrl')
|
||||
userinfo.value = JSON.parse(userinfo.value)
|
||||
// console.log(userinfo.value)
|
||||
}
|
||||
})
|
||||
// 变量
|
||||
const avatar = ref('')
|
||||
const res_form = ref(null)
|
||||
const is_login = ref(null)
|
||||
const userinfo = ref(null)
|
||||
const newUser = ref(null)
|
||||
// const avatarUrl = ref(null)
|
||||
const nickname = ref('')
|
||||
// 函数
|
||||
function getInfo(){
|
||||
is_login.value = custom.checkLogin()
|
||||
// store.checkLogin()
|
||||
// console.log(is_login.value)
|
||||
if(is_login.value) {
|
||||
avatar.value = uni.getStorageSync('avatarUrl')
|
||||
userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
|
||||
function getPhoneNumber (e) {
|
||||
// tel_code.value = e.detail.code
|
||||
// console.log(e)
|
||||
getAccess_token({code:e.detail.code})
|
||||
// console.log(e.detail.code) // 动态令牌
|
||||
// console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
|
||||
// console.log(e.detail.errno) // 错误码(失败时返回)
|
||||
}
|
||||
async function getAccess_token(params={}){//获取token 获取手机号
|
||||
//清除token缓存
|
||||
// wx.clearStorageSync();
|
||||
//访问接口
|
||||
const data={
|
||||
username:params.code,//手机号按钮获取的code
|
||||
type:'wechat_mini_app',
|
||||
identity:'user',
|
||||
password:'111'
|
||||
}
|
||||
// console.log('登录参数:',data)
|
||||
const res = await api.getToken(data)
|
||||
if(res.code === 200) {
|
||||
res_form.value = res.data
|
||||
res_form.value.access_token = 'Bearer '+res.data.access_token
|
||||
let userId = res.data.userId
|
||||
uni.setStorageSync('access_token',res_form.value.access_token);// token单独缓存一次
|
||||
wx_login(userId)
|
||||
}
|
||||
}
|
||||
function toLogin(token_info) {
|
||||
async function wx_login(userId){
|
||||
let res=await new Promise(resolve=>{
|
||||
uni.login({
|
||||
provider: 'weixin', //使用微信登录
|
||||
success: function (loginRes) {
|
||||
resolve(loginRes);
|
||||
console.log(loginRes,'微信登录返回信息');
|
||||
}
|
||||
});
|
||||
});
|
||||
let res2=await api.wx_login({code:res.code},userId);
|
||||
if(res2.code === 0) {
|
||||
// for(let prop in res_form.value) {
|
||||
// uni.setStorageSync(prop,res_form.value[prop])
|
||||
// }
|
||||
uni.setStorageSync(userInfo,JSON.stringify(res_form.value))
|
||||
}
|
||||
else{
|
||||
uni.clearStorage();
|
||||
}
|
||||
}
|
||||
function toLogin() {
|
||||
uni.navigateTo({
|
||||
url:"/pages/login/login?token_info="+token_info
|
||||
url:"/pages/login/login"
|
||||
})
|
||||
}
|
||||
function toDetail(type) {
|
||||
@ -57,93 +101,9 @@
|
||||
})
|
||||
}
|
||||
function toUserInfo() {
|
||||
if(is_login.value) {
|
||||
uni.navigateTo({
|
||||
url:"/pages/user/userInfo"
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
function getPhoneNumber (e) {
|
||||
// tel_code.value = e.detail.code
|
||||
console.log(e)
|
||||
getAccess_token({code:e.detail.code})
|
||||
// console.log(e.detail.code) // 动态令牌
|
||||
// console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
|
||||
// console.log(e.detail.errno) // 错误码(失败时返回)
|
||||
}
|
||||
async function getAccess_token(params={}){//获取token 获取手机号
|
||||
//清除token缓存
|
||||
// wx.clearStorageSync();
|
||||
//访问接口
|
||||
const data={
|
||||
username:params.code,//手机号按钮获取的code
|
||||
type:'wechat_mini_app',
|
||||
identity:'user',
|
||||
password:'111'
|
||||
}
|
||||
// console.log('登录参数:',data);return;
|
||||
const res = await api.getToken(data)
|
||||
if(res.code === 200) {
|
||||
// newUser.value = res.data.newUser
|
||||
if(res.data.newUser) { // 新用户,不做任何缓存动作,跳转登录页
|
||||
let userId = res.data.userId
|
||||
let res_p=await new Promise(resolve=>{
|
||||
uni.login({
|
||||
provider: 'weixin', //使用微信登录
|
||||
success: function (loginRes) {
|
||||
resolve(loginRes);
|
||||
console.log(loginRes,'微信登录返回信息');
|
||||
}
|
||||
});
|
||||
});
|
||||
uni.setStorageSync('access_token','Bearer '+res.data.access_token);// token单独缓存一次
|
||||
let res2=await api.wx_login({code:res_p.code},userId);
|
||||
if(res2.code === 0) {
|
||||
store.checkLogin()
|
||||
toLogin(encodeURIComponent(JSON.stringify(res.data)))
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.setStorageSync('avatarUrl', res.data.avatar);//avatarUrl
|
||||
res_form.value = res.data
|
||||
res_form.value.access_token = 'Bearer '+res.data.access_token
|
||||
let userId = res.data.userId
|
||||
uni.setStorageSync('access_token',res_form.value.access_token);// token单独缓存一次
|
||||
wx_login(userId)
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
icon:"error",
|
||||
title:res.msg,
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
}
|
||||
async function wx_login(userId){
|
||||
let res=await new Promise(resolve=>{
|
||||
uni.login({
|
||||
provider: 'weixin', //使用微信登录
|
||||
success: function (loginRes) {
|
||||
resolve(loginRes);
|
||||
console.log(loginRes,'微信登录返回信息');
|
||||
}
|
||||
});
|
||||
});
|
||||
let res2=await api.wx_login({code:res.code},userId);
|
||||
if(res2.code === 0) {
|
||||
uni.setStorageSync('userInfo',JSON.stringify(res_form.value))
|
||||
// is_login.value = custom.checkLogin()
|
||||
store.checkLogin()
|
||||
getInfo()
|
||||
// if(newUser.value) {
|
||||
// toLogin()
|
||||
// }
|
||||
}
|
||||
else{
|
||||
uni.clearStorage();
|
||||
}
|
||||
uni.navigateTo({
|
||||
url:"/pages/user/userInfo"
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@ -155,12 +115,8 @@
|
||||
</view>
|
||||
<uni-icons style="position: absolute;right:20rpx;top: 40%;" v-if="is_login" type="forward" color="white" size="20"></uni-icons>
|
||||
</view>
|
||||
<!-- <view class="btn-box" @tap="toLogin" v-if="!is_login"> -->
|
||||
<view class="btn-box" v-if="!is_login">
|
||||
<!-- <view class="btn">登录</view> -->
|
||||
<view class="btn-part">
|
||||
<button class="buy-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">立即登录</button>
|
||||
</view>
|
||||
<view class="btn-box" @tap="toLogin" v-if="!is_login">
|
||||
<view class="btn">登录</view>
|
||||
</view>
|
||||
<view class="row-box" v-else>
|
||||
<view class="rb-card" @tap="toDetail(1)" style="margin-bottom: 10px;">
|
||||
@ -210,17 +166,6 @@
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.buy-btn{
|
||||
display: inline-block;
|
||||
margin-top:1rem;
|
||||
background-color: #26758d;
|
||||
color: white;
|
||||
border-radius: 50rpx;
|
||||
font-weight: 200;
|
||||
font-size: 24rpx;
|
||||
width: 50%;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
.rbc-content-left-box{
|
||||
uni-icons{
|
||||
margin-right: 20rpx;
|
||||
|
@ -4,7 +4,6 @@
|
||||
import {ref,onMounted,nextTick} from "vue"
|
||||
import {useStore} from '@/store/index.js'
|
||||
import api from "@/api/index.js"
|
||||
const store = useStore()
|
||||
onLoad(() => {
|
||||
// console.log(useStore.userInfo)
|
||||
userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
|
||||
@ -15,39 +14,7 @@
|
||||
const avatar = ref(null)
|
||||
// 方法
|
||||
function toDetail(type) {
|
||||
let url = ''
|
||||
switch(type) {
|
||||
case 1:
|
||||
url = '/pages/user/setting/userAgreement'
|
||||
break;
|
||||
case 2:
|
||||
url = '/pages/user/setting/privacyPolicy'
|
||||
break;
|
||||
case 3:
|
||||
url = '/pages/user/setting/phone_list'
|
||||
break;
|
||||
case 4:
|
||||
url = '/pages/user/setting/aboutUs'
|
||||
break;
|
||||
case 5: // 退出
|
||||
uni.showModal({
|
||||
title:"提示",
|
||||
content:"确认要退出登录吗?",
|
||||
success:async function(res) {
|
||||
if(res.confirm) {
|
||||
store.logout()
|
||||
}
|
||||
}
|
||||
})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(url) {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@ -63,7 +30,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(2)">
|
||||
<view class="rb-card" @tap="toDetail(1)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<!-- <uni-icons type="phone" color="gray" size="26"></uni-icons> -->
|
||||
@ -73,7 +40,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(3)">
|
||||
<view class="rb-card" @tap="toDetail(1)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<!-- <uni-icons type="calendar" color="gray" size="26"></uni-icons> -->
|
||||
@ -83,7 +50,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(4)">
|
||||
<view class="rb-card" @tap="toDetail(1)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<!-- <uni-icons type="paperplane" color="gray" size="26"></uni-icons> -->
|
||||
@ -93,7 +60,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(5)">
|
||||
<view class="rb-card" @tap="toDetail(1)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<!-- <uni-icons type="paperplane" color="gray" size="26"></uni-icons> -->
|
||||
|
@ -1,11 +0,0 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<view class="aboutUs page-box page-bg-gray">
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
@ -1,11 +0,0 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<view class="phone_list page-box page-bg-gray">
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
@ -1,11 +0,0 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<view class="privacyPolicy page-box page-bg-gray">
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
@ -1,11 +0,0 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<view class="userAgreement page-box page-bg-gray">
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
@ -4,71 +4,39 @@
|
||||
import {ref,onMounted,nextTick} from "vue"
|
||||
import {useStore} from '@/store/index.js'
|
||||
import api from "@/api/index.js"
|
||||
const store = useStore()
|
||||
import emptyCard from "@/components/emptyCard.vue"
|
||||
// 生命周期
|
||||
onLoad((e) => {
|
||||
let userinfo = JSON.parse(store.userInfo)
|
||||
// console.log(userinfo)
|
||||
queryParams.value.userId = userinfo.userId
|
||||
getList()
|
||||
})
|
||||
onPullDownRefresh(()=> { // 下拉刷新
|
||||
init()
|
||||
getList()
|
||||
|
||||
})
|
||||
onReachBottom(() => { // 上滑触底
|
||||
queryParams.value.page ++
|
||||
getList()
|
||||
|
||||
})
|
||||
// 变量
|
||||
// const user_info = ref(null)
|
||||
const list = ref([
|
||||
// {
|
||||
// id:1,
|
||||
// cover_img:'https://gwjxb.oss-cn-chengdu.aliyuncs.com/logo.png',
|
||||
// title:'金秋相逢 共叙合作',
|
||||
// reading_num:100,
|
||||
// content:`
|
||||
// 新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
// 春发其华,秋收其实。
|
||||
// 共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
// `
|
||||
// },
|
||||
// {
|
||||
// id:2,
|
||||
// cover_img:'https://ms.bdimg.com/pacific/0/pic/1083217647_-478899572.png?x=0&y=0&h=340&w=510&vh=340.00&vw=510.00&oh=340.00&ow=510.00',
|
||||
// title:'金秋相逢 共叙合作',
|
||||
// reading_num:100,
|
||||
// content:`
|
||||
// 新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
// 春发其华,秋收其实。
|
||||
// 共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
// `
|
||||
// }
|
||||
])
|
||||
const queryParams = ref({
|
||||
page:1,
|
||||
pageSize:10,
|
||||
userId:0
|
||||
})
|
||||
// 方法
|
||||
function init() {
|
||||
queryParams.page = 1
|
||||
queryParams.pageSize = 10
|
||||
list.value = []
|
||||
}
|
||||
async function getList() {
|
||||
const res = await api.getStarList(queryParams.value)
|
||||
if(res.code === 0) {
|
||||
if( res.data.list.length>0) {
|
||||
list.value.push(...res.data.list)
|
||||
}
|
||||
else{
|
||||
queryParams.page-=1
|
||||
}
|
||||
{
|
||||
id:1,
|
||||
cover_img:'https://gwjxb.oss-cn-chengdu.aliyuncs.com/logo.png',
|
||||
title:'金秋相逢 共叙合作',
|
||||
reading_num:100,
|
||||
content:`
|
||||
新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
春发其华,秋收其实。
|
||||
共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
`
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
cover_img:'https://ms.bdimg.com/pacific/0/pic/1083217647_-478899572.png?x=0&y=0&h=340&w=510&vh=340.00&vw=510.00&oh=340.00&ow=510.00',
|
||||
title:'金秋相逢 共叙合作',
|
||||
reading_num:100,
|
||||
content:`
|
||||
新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
春发其华,秋收其实。
|
||||
共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
`
|
||||
}
|
||||
}
|
||||
])
|
||||
// 方法
|
||||
function toDetail(item) {
|
||||
let info = encodeURIComponent(JSON.stringify(item))
|
||||
// console.log(info)
|
||||
@ -80,7 +48,7 @@
|
||||
<template>
|
||||
<view class="starBox page-box page-bg-gray">
|
||||
<view class="list-box">
|
||||
<view class="lb-card" v-if="list.length > 0" v-for="(item,i) in list" @tap="toDetail(item)">
|
||||
<view class="lb-card" v-for="(item,i) in list" @tap="toDetail(item)">
|
||||
<view class="lb-left">
|
||||
<image :src="item.cover_img" mode="aspectFill"></image>
|
||||
</view>
|
||||
@ -89,9 +57,7 @@
|
||||
<view class="lb-content text-ellipsis-1 small-text">{{item.content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<emptyCard v-else></emptyCard>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
|
@ -1,167 +1,20 @@
|
||||
<script setup>
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
// import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick,computed} from "vue"
|
||||
import unCombox from '@/uni_modules/uni-combox/components/uni-combox/uni-combox.vue'
|
||||
import {ref,onMounted,nextTick} from "vue"
|
||||
import {useStore} from '@/store/index.js'
|
||||
const store = useStore()
|
||||
import api from "@/api/index.js"
|
||||
onLoad(() => {
|
||||
// console.log(useStore.userInfo)
|
||||
userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
|
||||
console.log(userinfo.value)
|
||||
avatar.value = uni.getStorageSync('avatarUrl')
|
||||
if(uni.getStorageSync('operation_info')) {
|
||||
h_info.value = JSON.parse(uni.getStorageSync('operation_info'))
|
||||
if(h_info.value) {
|
||||
// console.log(h_info.value)
|
||||
getHospital(h_info.value.hospitalId)
|
||||
}
|
||||
}
|
||||
})
|
||||
// 变量
|
||||
const h_queryParams = ref({
|
||||
page:1,
|
||||
pageSize:1000,
|
||||
key:''
|
||||
})
|
||||
const hospitals = ref(null)
|
||||
const userinfo = ref({})
|
||||
const userinfo = ref(null)
|
||||
const avatar = ref(null)
|
||||
const h_info = ref({})
|
||||
const inputDialog = ref(null)
|
||||
const input_title = ref(null)
|
||||
const hValue = ref('') // 医院
|
||||
const hValueId = ref('') // 医院id
|
||||
// const form_data = ref({})
|
||||
// const userForm = ref(null)
|
||||
// 方法
|
||||
async function getHospitalList() {
|
||||
const res = await api.getHospitalList(h_queryParams.value)
|
||||
if(res.code == 0) {
|
||||
hospitals.value = res.data.list
|
||||
}
|
||||
}
|
||||
function onClickH() {
|
||||
h_queryParams.value.key = hValue.value
|
||||
getHospitalList()
|
||||
|
||||
}
|
||||
async function getHospital(id) {
|
||||
const res = await api.getHospitalInfo(id)
|
||||
if(res.code === 0) {
|
||||
h_info.value.name = res.data.name
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:"error",
|
||||
duration:2000,
|
||||
mask:true,
|
||||
success() {}
|
||||
})
|
||||
}
|
||||
}
|
||||
const edit_type= ref(null)
|
||||
|
||||
function toDetail(type) {
|
||||
edit_type.value = type
|
||||
switch(type){
|
||||
case 1: // 修改昵称
|
||||
inputDialog.value.open()
|
||||
input_title.value = '修改昵称'
|
||||
break;
|
||||
case 2: // 修改电话
|
||||
inputDialog.value.open()
|
||||
input_title.value = '修改电话'
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
function finishFunc() {
|
||||
inputDialog.value.close()
|
||||
}
|
||||
const startDate = computed(() => getDate('start'))
|
||||
const endDate = computed(() => getDate('end'))
|
||||
const choosed_h = ref(null)
|
||||
const date = ref(null)
|
||||
function getDate(type) {
|
||||
const date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
|
||||
if (type === 'start') {
|
||||
year = year - 60;
|
||||
} else if (type === 'end') {
|
||||
year = year + 2;
|
||||
}
|
||||
month = month > 9 ? month : '0' + month;
|
||||
day = day > 9 ? day : '0' + day;
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
function bindDateChange(e) {
|
||||
console.log(e)
|
||||
h_info.value.surgery_time = e.detail.value
|
||||
}
|
||||
function toChooseH(item) {
|
||||
console.log(item)
|
||||
choosed_h.value = item
|
||||
hValue.value = item.name
|
||||
// hospitals.value = null
|
||||
}
|
||||
async function sumbmitFunc() {
|
||||
// console.log(choosed_h.value,h_info.value,userinfo.value)
|
||||
let obj = {
|
||||
id: userinfo.value.userId,
|
||||
// isSurgery: 1, //是否已经手术 0为手术,1已经手术
|
||||
surgery_time: h_info.value?.surgery_time, //手术时间
|
||||
nickname: userinfo.value.nickname,
|
||||
// avatar: '',
|
||||
phone: userinfo.value.phone,
|
||||
hospitalId:choosed_h.value?.ID
|
||||
}
|
||||
const res = await api.userinfoUpdae(obj)
|
||||
// console.log('res is ',res)
|
||||
if(res.code === 0) {
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:"success",
|
||||
duration:2000,
|
||||
async success() {
|
||||
await wx_login(userinfo.value.userId)
|
||||
uni.navigateBack()
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:"error",
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
}
|
||||
async function wx_login(userId){
|
||||
let res=await new Promise(resolve=>{
|
||||
uni.login({
|
||||
provider: 'weixin', //使用微信登录
|
||||
success: function (loginRes) {
|
||||
resolve(loginRes);
|
||||
console.log(loginRes,'微信登录返回信息');
|
||||
}
|
||||
});
|
||||
});
|
||||
let res2=await api.wx_login({code:res.code},userId);
|
||||
if(res2.code === 0) {
|
||||
uni.setStorageSync('userInfo',JSON.stringify(userinfo.value))
|
||||
// is_login.value = custom.checkLogin()
|
||||
store.checkLogin()
|
||||
}
|
||||
else{
|
||||
uni.clearStorage();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@ -181,7 +34,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(2)">
|
||||
<view class="rb-card" @tap="toDetail(1)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<uni-icons type="phone" color="gray" size="26"></uni-icons>
|
||||
@ -192,54 +45,29 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(3)">
|
||||
<view class="rb-card" @tap="toDetail(1)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<uni-icons type="calendar" color="gray" size="26"></uni-icons>
|
||||
手术时间</view>
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<!-- {{h_info?.surgery_time}} -->
|
||||
<picker mode="date" :value="h_info?.surgery_time" :start="startDate" :end="endDate" @change="bindDateChange">
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<view class="uni-input"> {{h_info?.surgery_time}}</view>
|
||||
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
2023-10-1
|
||||
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(4)">
|
||||
<view class="rb-card" @tap="toDetail(1)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<uni-icons type="paperplane" color="gray" size="26"></uni-icons>
|
||||
手术医院</view>
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<!-- {{h_info?.name}} -->
|
||||
<uni-combox @input="onClickH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="hValue"></uni-combox>
|
||||
金山医院
|
||||
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--修改姓名/电话 弹窗 -->
|
||||
<uni-popup ref="inputDialog" >
|
||||
<view class="pop-box">
|
||||
<view class="pb-title">{{input_title}}</view>
|
||||
<view class="pb-content">
|
||||
<view class="pb-item">
|
||||
<!-- <view class="pb-item-left">事项说明</view> -->
|
||||
<view class="pb-item-right">
|
||||
<!-- <input v-if="edit_type == 1" class="uni-input" v-model="userinfo.nickname" focus placeholder="输入您的姓名" />
|
||||
<input v-else class="uni-input" v-model="userinfo.phone" focus placeholder="输入您的电话" /> -->
|
||||
<uni-easyinput :inputBorder="false" v-if="edit_type == 1" borderColor="#26758d" v-model="userinfo.nickname" focus placeholder="输入您的姓名"></uni-easyinput>
|
||||
<uni-easyinput :inputBorder="false" v-else borderColor="#26758d" v-model="userinfo.phone" focus placeholder="输入您的电话"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pb-item pb-item-btn" @tap="finishFunc">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<view class="pb-item pb-item-btn" style="margin-top: 40rpx;" @tap="sumbmitFunc">确定</view>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
@ -326,48 +154,4 @@
|
||||
.user-box{
|
||||
background: #f6f6f6;
|
||||
}
|
||||
.pb-item-btn{
|
||||
padding: 20rpx 0;
|
||||
text-align: center;
|
||||
color: white;
|
||||
background: #26758d;
|
||||
justify-content: center;
|
||||
width: 66%;
|
||||
margin: 0 auto;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.pop-box{
|
||||
.pb-title{
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
padding-top: 20rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
background-color: white;
|
||||
padding: 20rpx;
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.pb-item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 40rpx;
|
||||
// justify-content: space-between;
|
||||
.pb-item-left{
|
||||
width: 30%;
|
||||
color: gray;
|
||||
}
|
||||
.pb-item-right{
|
||||
position: relative;
|
||||
// margin-left: 10rpx;
|
||||
width:100%;
|
||||
}
|
||||
}
|
||||
:deep(){
|
||||
.uni-popup__wrapper{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -6,19 +6,17 @@
|
||||
// import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick} from "vue"
|
||||
import {useStore} from '@/store/index.js'
|
||||
import emptyCard from "@/components/emptyCard.vue"
|
||||
import api from "@/api/index.js"
|
||||
import util from "@/utils"
|
||||
onLoad((e) => {
|
||||
// console.log(e)
|
||||
// a_info.value = JSON.parse(decodeURIComponent(e.info))
|
||||
console.log(e)
|
||||
a_info.value = JSON.parse(decodeURIComponent(e.info))
|
||||
if(!e.id) {
|
||||
uni.showToast({
|
||||
icon:"error",
|
||||
title:"错误",
|
||||
duration:2000
|
||||
})
|
||||
// a_info.value = null
|
||||
a_info.value = null
|
||||
return
|
||||
}
|
||||
getDetail(e.id)
|
||||
@ -29,19 +27,6 @@
|
||||
// 函数
|
||||
async function getDetail(id) {
|
||||
const res = await api.getArticleDetail({id})
|
||||
if(res.code == 0) {
|
||||
a_info.value = res.data
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:'获取失败',
|
||||
icon:"error",
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
}
|
||||
async function starFunc(type) { // 点击收藏
|
||||
a_info.value.isStar = type
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@ -49,32 +34,11 @@
|
||||
<view class="title">
|
||||
{{a_info?.title}}
|
||||
</view>
|
||||
<view v-if="a_info" class="more-info small-text">{{util.timestampToDate(a_info?.CreatedAt)}}</view>
|
||||
<view class="more-info small-text">2023-10-5</view>
|
||||
<view class="d-content" v-html="a_info?.content"></view>
|
||||
<view class="action-box" v-if="a_info">
|
||||
<view class="ab-item">
|
||||
<uni-icons color="gray" type="eye" size="30"></uni-icons>
|
||||
<view style="color: gray;">{{a_info?.reading_num}}</view>
|
||||
</view>
|
||||
<view class="ab-item">
|
||||
<uni-icons color="#26758d" @tap="starFunc(0)" v-if="a_info?.isStar" type="star-filled" size="30"></uni-icons>
|
||||
<uni-icons color="gray" @tap="starFunc(1)" v-else type="star" size="30"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<emptyCard title="暂无内容" v-if="!a_info"></emptyCard>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.action-box{
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
.ab-item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 20rpx;
|
||||
}
|
||||
}
|
||||
.detailBox{
|
||||
.more-info{
|
||||
text-align: right;
|
||||
|
@ -7,7 +7,6 @@
|
||||
import {ref,onMounted,nextTick} from "vue"
|
||||
import {useStore} from '@/store/index.js'
|
||||
import api from "@/api/index"
|
||||
import emptyCard from "@/components/emptyCard.vue"
|
||||
// 生命周期
|
||||
onLoad(() => {
|
||||
getList()
|
||||
@ -30,36 +29,43 @@
|
||||
page:1,
|
||||
pageSize:10
|
||||
})
|
||||
const list = ref([])
|
||||
const list = ref([
|
||||
{
|
||||
id:1,
|
||||
cover_img:'https://gwjxb.oss-cn-chengdu.aliyuncs.com/logo.png',
|
||||
title:'金秋相逢 共叙合作',
|
||||
reading_num:100,
|
||||
content:`
|
||||
新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
春发其华,秋收其实。
|
||||
共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
`
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
cover_img:'https://ms.bdimg.com/pacific/0/pic/1083217647_-478899572.png?x=0&y=0&h=340&w=510&vh=340.00&vw=510.00&oh=340.00&ow=510.00',
|
||||
title:'金秋相逢 共叙合作',
|
||||
reading_num:100,
|
||||
content:`
|
||||
新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
春发其华,秋收其实。
|
||||
共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
`
|
||||
}
|
||||
])
|
||||
// 方法
|
||||
function init() {
|
||||
queryParams.page = 1
|
||||
queryParams.pageSize = 10
|
||||
list.value = []
|
||||
}
|
||||
async function getList(){
|
||||
const res = await api.getArticleList(queryParams.value)
|
||||
if(res.code == 0) {
|
||||
if( res.data.list.length>0) {
|
||||
list.value.push(...res.data.list)
|
||||
}
|
||||
else{
|
||||
queryParams.page-=1
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:'获取失败',
|
||||
icon:"error",
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
}
|
||||
function toDetail(item) {
|
||||
let info = encodeURIComponent(JSON.stringify(item))
|
||||
// console.log(info)
|
||||
uni.navigateTo({
|
||||
url:"./detail?id="+item.ID
|
||||
url:"./detail?info="+info+"&id="+item.id
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@ -69,16 +75,15 @@
|
||||
|
||||
</view>
|
||||
<view class="list-box">
|
||||
<view v-if="list.length>0" class="lb-card" v-for="(item,i) in list" @tap="toDetail(item)">
|
||||
<view class="lb-card" v-for="(item,i) in list" @tap="toDetail(item)">
|
||||
<view class="lb-left">
|
||||
<image :src="item.cover_img" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="lb-right">
|
||||
<view class="lb-title">{{item.title}}</view>
|
||||
<view class="lb-content text-ellipsis-1 small-text" v-html="item.content"></view>
|
||||
<view class="lb-content text-ellipsis-1 small-text">{{item.content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<emptyCard v-else></emptyCard>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
BIN
static/kefu.png
BIN
static/kefu.png
Binary file not shown.
Before Width: | Height: | Size: 9.9 KiB |
@ -23,8 +23,7 @@ export const useStore = defineStore('main2', {
|
||||
cartList:[],
|
||||
cartChange:false,
|
||||
remark_text:'',
|
||||
address:'',
|
||||
operation_info:null, // 手术信息
|
||||
address:''
|
||||
}
|
||||
},
|
||||
actions:{
|
||||
@ -62,19 +61,8 @@ export const useStore = defineStore('main2', {
|
||||
if(access_token) {
|
||||
this.access_token = access_token
|
||||
this.isLogin = true
|
||||
this.userInfo = uni.getStorageSync('userInfo')
|
||||
this.operation_info = uni.getStorageSync('operation_info')
|
||||
// this.getUserInfo()
|
||||
}
|
||||
else{
|
||||
this.access_token = null
|
||||
this.isLogin = false
|
||||
this.userInfo = null
|
||||
// 清空缓存
|
||||
// uni.removeStorageSync('userInfo');
|
||||
// uni.removeStorageSync('access_token');
|
||||
// uni.removeStorageSync('avatarUrl');
|
||||
}
|
||||
// else{
|
||||
// if(!visitState) {
|
||||
// // uni.navigateTo({
|
||||
@ -157,19 +145,6 @@ export const useStore = defineStore('main2', {
|
||||
// cart_list.value = res.data
|
||||
// }
|
||||
}
|
||||
},
|
||||
afterFailLogin(duration){
|
||||
setTimeout(()=>{
|
||||
uni.removeStorageSync('userInfo');
|
||||
uni.removeStorageSync('access_token');
|
||||
uni.removeStorageSync('avatarUrl');
|
||||
this.userInfo = null
|
||||
this.operation_info = null
|
||||
uni.switchTab({
|
||||
url:'/pages/user/index'
|
||||
})
|
||||
},duration)
|
||||
|
||||
}
|
||||
}
|
||||
})
|
@ -1,4 +0,0 @@
|
||||
## 2.0(2023-10-28)
|
||||
适配vue3 小程序
|
||||
## 1.0.0(2023-07-16)
|
||||
组件初始化
|
@ -1,195 +0,0 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
|
||||
|
||||
<!-- 顶部选项卡 -->
|
||||
<scroll-view id="nav-bar" class="nav-bar" scroll-x scroll-with-animation :scroll-left="scrollLeft">
|
||||
<!-- <view v-for="(item,index) in tabArr" :key="item.id" class="nav-item"
|
||||
:class="{current: index === tabCurrentIndex}" :id="'tab'+index" @click="changeTab(index)">{{item.name}}
|
||||
</view> -->
|
||||
<view v-for="(item,index) in tabArr" :key="item.id" class="nav-item"
|
||||
:style="{width:tab_width+'%'}"
|
||||
:class="{current: index === o_index}" :id="'tab'+index" @click="changeTab(index)">{{item.name}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let windowWidth = uni.getSystemInfoSync().windowWidth,
|
||||
scrollTimer = false,
|
||||
tabBar;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tabCurrentIndex: 0, //当前选项卡索引
|
||||
scrollLeft: 0, //顶部选项卡左滑距离
|
||||
tab_width:0,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.tabArr)
|
||||
this.tab_width = parseFloat(100/this.tabArr.length)
|
||||
},
|
||||
props: {
|
||||
tabArr: {
|
||||
type: Array,
|
||||
default () {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
o_index: {
|
||||
type: Number,
|
||||
default () {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
//tab切换
|
||||
async changeTab(e) {
|
||||
|
||||
if (scrollTimer) {
|
||||
//多次切换只执行最后一次
|
||||
clearTimeout(scrollTimer);
|
||||
scrollTimer = false;
|
||||
}
|
||||
let index = e;
|
||||
//e=number为点击切换,e=object为swiper滑动切换
|
||||
if (typeof e === 'object') {
|
||||
index = e.detail.current
|
||||
}
|
||||
if (typeof tabBar !== 'object') {
|
||||
tabBar = await this.getElSize("nav-bar")
|
||||
}
|
||||
//计算宽度相关
|
||||
let tabBarScrollLeft = tabBar.scrollLeft;
|
||||
let width = 0;
|
||||
let nowWidth = 0;
|
||||
//获取可滑动总宽度
|
||||
for (let i = 0; i <= index; i++) {
|
||||
let result = await this.getElSize('tab' + i);
|
||||
width += result.width;
|
||||
if (i === index) {
|
||||
nowWidth = result.width;
|
||||
}
|
||||
}
|
||||
if (typeof e === 'number') {
|
||||
//点击切换时先切换再滚动tabbar,避免同时切换视觉错位
|
||||
this.tabCurrentIndex = index;
|
||||
}
|
||||
// console.log("windowWidth = " + windowWidth);
|
||||
//延迟300ms,等待swiper动画结束再修改tabbar
|
||||
scrollTimer = setTimeout(() => {
|
||||
if (width - nowWidth / 2 > windowWidth / 2) {
|
||||
//如果当前项越过中心点,将其放在屏幕中心
|
||||
this.scrollLeft = width - nowWidth / 2 - windowWidth / 2;
|
||||
} else {
|
||||
this.scrollLeft = 0;
|
||||
}
|
||||
if (typeof e === 'object') {
|
||||
this.tabCurrentIndex = index;
|
||||
}
|
||||
this.tabCurrentIndex = index;
|
||||
|
||||
|
||||
|
||||
|
||||
}, 300)
|
||||
// console.log('changeTab is done!!!')
|
||||
this.$emit("tabChange", this.tabCurrentIndex);
|
||||
|
||||
},
|
||||
//获得元素的size
|
||||
getElSize(id) {
|
||||
return new Promise((res, rej) => {
|
||||
|
||||
// 在自定义组件中,使用wx.createSelectorQuery() 不能用wx. 而是this.createSelectorQuery()
|
||||
// 微信文档: 但是在uni的官方文档中并没有关于需要切换this的介绍,是用uni.createSelectorQuery()在自定义组件内部也是无效的。
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
let el = this.createSelectorQuery().select('#' + id);
|
||||
// #endif
|
||||
|
||||
// #ifdef H5 || APP-PLUS
|
||||
|
||||
let el = uni.createSelectorQuery().select('#' + id);
|
||||
|
||||
// #endif
|
||||
|
||||
el.fields({
|
||||
size: true,
|
||||
scrollOffset: true,
|
||||
rect: true
|
||||
}, (data) => {
|
||||
res(data);
|
||||
}).exec();
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
.content {
|
||||
background-color: #f8f8f8;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 隐藏滚动条scrollbar */
|
||||
.nav-bar ::-webkit-scrollbar {
|
||||
|
||||
display: none;
|
||||
background-color: transparent;
|
||||
|
||||
}
|
||||
|
||||
/* 顶部tabbar */
|
||||
.nav-bar {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
height: 90upx;
|
||||
white-space: nowrap;
|
||||
box-shadow: 0 2upx 8upx rgba(0, 0, 0, .06);
|
||||
background-color: #fff;
|
||||
|
||||
|
||||
.nav-item {
|
||||
display: inline-block;
|
||||
/* width: 150upx; */
|
||||
/* width: 33.33%; */
|
||||
height: 90upx;
|
||||
text-align: center;
|
||||
line-height: 90upx;
|
||||
font-size: 30upx;
|
||||
/* color: #303133; */
|
||||
color: gray;
|
||||
position: relative;
|
||||
font-weight: 900;
|
||||
&:after {
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-bottom: 4upx solid #26758d;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 0;
|
||||
transform: translateX(-50%);
|
||||
transition: .3s;
|
||||
}
|
||||
}
|
||||
|
||||
.current {
|
||||
color: #26758d;
|
||||
|
||||
&:after {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,85 +0,0 @@
|
||||
{
|
||||
"id": "cc-newsTabs",
|
||||
"displayName": "自定义可自由滚动新闻栏tabs选项卡标签栏标题栏组件(适配vue3 小程序)",
|
||||
"version": "2.0",
|
||||
"description": "自定义可自由滚动新闻栏tabs选项卡标签栏标题栏组件(适配vue3 小程序)",
|
||||
"keywords": [
|
||||
"tabs",
|
||||
"新闻栏",
|
||||
"选项卡",
|
||||
"标题栏",
|
||||
"标签栏"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.8.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"type": "component-vue",
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": ""
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
},
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"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",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y",
|
||||
"钉钉": "y",
|
||||
"快手": "y",
|
||||
"飞书": "y",
|
||||
"京东": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "y",
|
||||
"联盟": "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
# cc-newsTabs
|
||||
|
||||
|
||||
#### 使用方法
|
||||
```使用方法
|
||||
<!-- tabArr:tab数组 tabChange:标签栏切换 -->
|
||||
<cc-newsTabs :tabArr="tabArr" @tabChange="tabChange"></cc-newsTabs>
|
||||
|
||||
//初始化数据
|
||||
tabArr: [{
|
||||
name: '关注',
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
name: '推荐',
|
||||
id: '2'
|
||||
},
|
||||
{
|
||||
name: '体育',
|
||||
id: '3'
|
||||
},
|
||||
{
|
||||
name: '热点',
|
||||
id: '4'
|
||||
},
|
||||
{
|
||||
name: '财经',
|
||||
id: '5'
|
||||
},
|
||||
{
|
||||
name: '娱乐',
|
||||
id: '6'
|
||||
},
|
||||
{
|
||||
name: '军事',
|
||||
id: '7'
|
||||
},
|
||||
{
|
||||
name: '历史',
|
||||
id: '8'
|
||||
},
|
||||
{
|
||||
name: '本地',
|
||||
id: '9'
|
||||
}],
|
||||
|
||||
// tab标签栏改变事件
|
||||
tabChange(currentIndex) {
|
||||
|
||||
uni.showModal({
|
||||
title: "当前选择序列",
|
||||
content: "当前选择序列 = " + currentIndex
|
||||
})
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### HTML代码实现部分
|
||||
```html
|
||||
<template>
|
||||
<view class="content">
|
||||
|
||||
<!-- tabArr:tab数组 tabChange:标签栏切换 -->
|
||||
<cc-newsTabs :tabArr="tabArr" @tabChange="tabChange"></cc-newsTabs>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
||||
tabArr: [{
|
||||
name: '关注',
|
||||
id: '1',
|
||||
}, {
|
||||
name: '推荐',
|
||||
id: '2'
|
||||
}, {
|
||||
name: '体育',
|
||||
id: '3'
|
||||
}, {
|
||||
name: '热点',
|
||||
id: '4'
|
||||
}, {
|
||||
name: '财经',
|
||||
id: '5'
|
||||
}, {
|
||||
name: '娱乐',
|
||||
id: '6'
|
||||
}, {
|
||||
name: '军事',
|
||||
id: '7'
|
||||
}, {
|
||||
name: '历史',
|
||||
id: '8'
|
||||
}, {
|
||||
name: '本地',
|
||||
id: '9'
|
||||
}],
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
tabChange(currentIndex) {
|
||||
|
||||
uni.showModal({
|
||||
title: "当前选择序列",
|
||||
content: "当前选择序列 = " + currentIndex
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page,
|
||||
.content {
|
||||
background-color: #f8f8f8;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
```
|
@ -1,15 +0,0 @@
|
||||
## 1.0.1(2021-11-23)
|
||||
- 优化 label、label-width 属性
|
||||
## 1.0.0(2021-11-19)
|
||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-combox](https://uniapp.dcloud.io/component/uniui/uni-combox)
|
||||
## 0.1.0(2021-07-30)
|
||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||
## 0.0.6(2021-05-12)
|
||||
- 新增 组件示例地址
|
||||
## 0.0.5(2021-04-21)
|
||||
- 优化 添加依赖 uni-icons, 导入后自动下载依赖
|
||||
## 0.0.4(2021-02-05)
|
||||
- 优化 组件引用关系,通过uni_modules引用组件
|
||||
## 0.0.3(2021-02-04)
|
||||
- 调整为uni_modules目录规范
|
@ -1,295 +0,0 @@
|
||||
<template>
|
||||
<view class="uni-combox" :class="border ? '' : 'uni-combox__no-border'">
|
||||
<view v-if="label" class="uni-combox__label" :style="labelStyle">
|
||||
<text>{{label}}</text>
|
||||
</view>
|
||||
<view class="uni-combox__input-box">
|
||||
<input class="uni-combox__input" type="text" :placeholder="placeholder"
|
||||
placeholder-class="uni-combox__input-plac" v-model="inputVal" @input="onInput" @focus="onFocus"
|
||||
@blur="onBlur" />
|
||||
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector">
|
||||
</uni-icons>
|
||||
</view>
|
||||
<view class="uni-combox__selector" v-if="showSelector && filterCandidates">
|
||||
<view class="uni-popper__arrow"></view>
|
||||
<scroll-view scroll-y="true" class="uni-combox__selector-scroll">
|
||||
<view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0">
|
||||
<text>{{emptyTips}}</text>
|
||||
</view>
|
||||
<view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index"
|
||||
@click="onSelectorClick(index)">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* Combox 组合输入框
|
||||
* @description 组合输入框一般用于既可以输入也可以选择的场景
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=1261
|
||||
* @property {String} label 左侧文字
|
||||
* @property {String} labelWidth 左侧内容宽度
|
||||
* @property {String} placeholder 输入框占位符
|
||||
* @property {Array} candidates 候选项列表
|
||||
* @property {String} emptyTips 筛选结果为空时显示的文字
|
||||
* @property {String} value 组合框的值
|
||||
*/
|
||||
export default {
|
||||
name: 'uniCombox',
|
||||
emits: ['input', 'update:modelValue'],
|
||||
props: {
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
labelWidth: {
|
||||
type: String,
|
||||
default: 'auto'
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
candidates: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
emptyTips: {
|
||||
type: String,
|
||||
default: '无匹配项'
|
||||
},
|
||||
// #ifndef VUE3
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSelector: false,
|
||||
inputVal: '',
|
||||
// inputValId:0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
labelStyle() {
|
||||
if (this.labelWidth === 'auto') {
|
||||
return ""
|
||||
}
|
||||
return `width: ${this.labelWidth}`
|
||||
},
|
||||
filterCandidates() {
|
||||
if(this.candidates) {
|
||||
return this.candidates.filter((item) => {
|
||||
return item.name.toString().indexOf(this.inputVal) > -1
|
||||
})
|
||||
}
|
||||
else{
|
||||
return null
|
||||
}
|
||||
|
||||
},
|
||||
filterCandidatesLength() {
|
||||
if(this.candidates) {
|
||||
return this.filterCandidates.length
|
||||
}
|
||||
else{
|
||||
return null
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// #ifndef VUE3
|
||||
value: {
|
||||
handler(newVal) {
|
||||
this.inputVal = newVal
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
modelValue: {
|
||||
handler(newVal) {
|
||||
// console.log(1212121,newVal)
|
||||
this.inputVal = newVal
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
toggleSelector() {
|
||||
this.showSelector = !this.showSelector
|
||||
},
|
||||
onFocus() {
|
||||
this.showSelector = true
|
||||
},
|
||||
onBlur() {
|
||||
setTimeout(() => {
|
||||
this.showSelector = false
|
||||
}, 153)
|
||||
},
|
||||
onSelectorClick(index) {
|
||||
// console.log(this.filterCandidates,index)
|
||||
// console.log(this.filterCandidates[index].name)
|
||||
// console.log( this.filterCandidates.length)
|
||||
|
||||
// // console.log(this.filterCandidates)
|
||||
// // this.inputValId = this.filterCandidates[index].ID
|
||||
this.showSelector = false
|
||||
// this.$emit('input', this.inputVal)
|
||||
this.$emit('update:modelValue', this.inputVal)
|
||||
this.$emit('choosed', this.filterCandidates[index])
|
||||
this.inputVal = this.filterCandidates[index].name
|
||||
},
|
||||
onInput() {
|
||||
setTimeout(() => {
|
||||
this.$emit('input', this.inputVal)
|
||||
this.$emit('update:modelValue', this.inputVal)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uni-combox {
|
||||
font-size: 14px;
|
||||
border: 1px solid #DCDFE6;
|
||||
border-radius: 4px;
|
||||
padding: 6px 10px;
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
// height: 40px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
// border-bottom: solid 1px #DDDDDD;
|
||||
}
|
||||
|
||||
.uni-combox__label {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
padding-right: 10px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.uni-combox__input-box {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-combox__input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.uni-combox__input-plac {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.uni-combox__selector {
|
||||
/* #ifndef APP-NVUE */
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
position: absolute;
|
||||
top: calc(100% + 12px);
|
||||
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: 2;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.uni-combox__selector-scroll {
|
||||
/* #ifndef APP-NVUE */
|
||||
max-height: 200px;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-combox__selector-empty,
|
||||
.uni-combox__selector-item {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
line-height: 36px;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
// border-bottom: solid 1px #DDDDDD;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
.uni-combox__selector-item:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.uni-combox__selector-empty:last-child,
|
||||
.uni-combox__selector-item:last-child {
|
||||
/* #ifndef APP-NVUE */
|
||||
border-bottom: none;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
// picker 弹出层通用的指示小三角
|
||||
.uni-popper__arrow,
|
||||
.uni-popper__arrow::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 6px;
|
||||
}
|
||||
|
||||
.uni-popper__arrow {
|
||||
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::after {
|
||||
content: " ";
|
||||
top: 1px;
|
||||
margin-left: -6px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
.uni-combox__no-border {
|
||||
border: none;
|
||||
}
|
||||
</style>
|
@ -1,90 +0,0 @@
|
||||
{
|
||||
"id": "uni-combox",
|
||||
"displayName": "uni-combox 组合框",
|
||||
"version": "1.0.1",
|
||||
"description": "可以选择也可以输入的表单项 ",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
"uniui",
|
||||
"combox",
|
||||
"组合框",
|
||||
"select"
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
"uni-scss",
|
||||
"uni-icons"
|
||||
],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"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",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
|
||||
|
||||
## Combox 组合框
|
||||
> **组件名:uni-combox**
|
||||
> 代码块: `uCombox`
|
||||
|
||||
|
||||
组合框组件。
|
||||
|
||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-combox)
|
||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
|
@ -1,23 +0,0 @@
|
||||
## 1.2.5(2023-03-29)
|
||||
- 新增 pattern.icon 属性,可自定义图标
|
||||
## 1.2.4(2022-09-07)
|
||||
小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false)
|
||||
## 1.2.3(2022-09-05)
|
||||
- 修复 nvue 环境下,具有 tabBar 时,fab 组件下部位置无法正常获取 --window-bottom 的bug,详见:[https://ask.dcloud.net.cn/question/110638?notification_id=826310](https://ask.dcloud.net.cn/question/110638?notification_id=826310)
|
||||
## 1.2.2(2021-12-29)
|
||||
- 更新 组件依赖
|
||||
## 1.2.1(2021-11-19)
|
||||
- 修复 阴影颜色不正确的bug
|
||||
## 1.2.0(2021-11-19)
|
||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-fab](https://uniapp.dcloud.io/component/uniui/uni-fab)
|
||||
## 1.1.1(2021-11-09)
|
||||
- 新增 提供组件设计资源,组件样式调整
|
||||
## 1.1.0(2021-07-30)
|
||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||
## 1.0.7(2021-05-12)
|
||||
- 新增 组件示例地址
|
||||
## 1.0.6(2021-02-05)
|
||||
- 调整为uni_modules目录规范
|
||||
- 优化 按钮背景色调整
|
||||
- 优化 兼容pc端
|
@ -1,491 +0,0 @@
|
||||
<template>
|
||||
<view class="uni-cursor-point">
|
||||
<view v-if="popMenu && (leftBottom||rightBottom||leftTop||rightTop) && content.length > 0" :class="{
|
||||
'uni-fab--leftBottom': leftBottom,
|
||||
'uni-fab--rightBottom': rightBottom,
|
||||
'uni-fab--leftTop': leftTop,
|
||||
'uni-fab--rightTop': rightTop
|
||||
}" class="uni-fab"
|
||||
:style="nvueBottom"
|
||||
>
|
||||
<view :class="{
|
||||
'uni-fab__content--left': horizontal === 'left',
|
||||
'uni-fab__content--right': horizontal === 'right',
|
||||
'uni-fab__content--flexDirection': direction === 'vertical',
|
||||
'uni-fab__content--flexDirectionStart': flexDirectionStart,
|
||||
'uni-fab__content--flexDirectionEnd': flexDirectionEnd,
|
||||
'uni-fab__content--other-platform': !isAndroidNvue
|
||||
}" :style="{ width: boxWidth, height: boxHeight, backgroundColor: styles.backgroundColor }"
|
||||
class="uni-fab__content" elevation="5">
|
||||
<view v-if="flexDirectionStart || horizontalLeft" class="uni-fab__item uni-fab__item--first" />
|
||||
<view v-for="(item, index) in content" :key="index" :class="{ 'uni-fab__item--active': isShow }"
|
||||
class="uni-fab__item" @click="_onItemClick(index, item)">
|
||||
<image :src="item.active ? item.selectedIconPath : item.iconPath" class="uni-fab__item-image"
|
||||
mode="aspectFit" />
|
||||
<text class="uni-fab__item-text"
|
||||
:style="{ color: item.active ? styles.selectedColor : styles.color }">{{ item.text }}</text>
|
||||
</view>
|
||||
<view v-if="flexDirectionEnd || horizontalRight" class="uni-fab__item uni-fab__item--first" />
|
||||
</view>
|
||||
</view>
|
||||
<view :class="{
|
||||
'uni-fab__circle--leftBottom': leftBottom,
|
||||
'uni-fab__circle--rightBottom': rightBottom,
|
||||
'uni-fab__circle--leftTop': leftTop,
|
||||
'uni-fab__circle--rightTop': rightTop,
|
||||
'uni-fab__content--other-platform': !isAndroidNvue
|
||||
}" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor, 'bottom': nvueBottom }" @click="_onClick">
|
||||
<uni-icons class="fab-circle-icon" :type="styles.icon" :color="styles.iconColor" size="32"
|
||||
:class="{'uni-fab__plus--active': isShow && content.length > 0}"></uni-icons>
|
||||
<!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view>
|
||||
<view class="fab-circle-h" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let platform = 'other'
|
||||
// #ifdef APP-NVUE
|
||||
platform = uni.getSystemInfoSync().platform
|
||||
// #endif
|
||||
|
||||
/**
|
||||
* Fab 悬浮按钮
|
||||
* @description 点击可展开一个图形按钮菜单
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=144
|
||||
* @property {Object} pattern 可选样式配置项
|
||||
* @property {Object} horizontal = [left | right] 水平对齐方式
|
||||
* @value left 左对齐
|
||||
* @value right 右对齐
|
||||
* @property {Object} vertical = [bottom | top] 垂直对齐方式
|
||||
* @value bottom 下对齐
|
||||
* @value top 上对齐
|
||||
* @property {Object} direction = [horizontal | vertical] 展开菜单显示方式
|
||||
* @value horizontal 水平显示
|
||||
* @value vertical 垂直显示
|
||||
* @property {Array} content 展开菜单内容配置项
|
||||
* @property {Boolean} popMenu 是否使用弹出菜单
|
||||
* @event {Function} trigger 展开菜单点击事件,返回点击信息
|
||||
* @event {Function} fabClick 悬浮按钮点击事件
|
||||
*/
|
||||
export default {
|
||||
name: 'UniFab',
|
||||
emits: ['fabClick', 'trigger'],
|
||||
props: {
|
||||
pattern: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
horizontal: {
|
||||
type: String,
|
||||
default: 'left'
|
||||
},
|
||||
vertical: {
|
||||
type: String,
|
||||
default: 'bottom'
|
||||
},
|
||||
direction: {
|
||||
type: String,
|
||||
default: 'horizontal'
|
||||
},
|
||||
content: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
popMenu: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fabShow: false,
|
||||
isShow: false,
|
||||
isAndroidNvue: platform === 'android',
|
||||
styles: {
|
||||
color: '#3c3e49',
|
||||
selectedColor: '#007AFF',
|
||||
backgroundColor: '#fff',
|
||||
buttonColor: '#007AFF',
|
||||
iconColor: '#fff',
|
||||
icon: 'plusempty'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
contentWidth(e) {
|
||||
return (this.content.length + 1) * 55 + 15 + 'px'
|
||||
},
|
||||
contentWidthMin() {
|
||||
return '55px'
|
||||
},
|
||||
// 动态计算宽度
|
||||
boxWidth() {
|
||||
return this.getPosition(3, 'horizontal')
|
||||
},
|
||||
// 动态计算高度
|
||||
boxHeight() {
|
||||
return this.getPosition(3, 'vertical')
|
||||
},
|
||||
// 计算左下位置
|
||||
leftBottom() {
|
||||
return this.getPosition(0, 'left', 'bottom')
|
||||
},
|
||||
// 计算右下位置
|
||||
rightBottom() {
|
||||
return this.getPosition(0, 'right', 'bottom')
|
||||
},
|
||||
// 计算左上位置
|
||||
leftTop() {
|
||||
return this.getPosition(0, 'left', 'top')
|
||||
},
|
||||
rightTop() {
|
||||
return this.getPosition(0, 'right', 'top')
|
||||
},
|
||||
flexDirectionStart() {
|
||||
return this.getPosition(1, 'vertical', 'top')
|
||||
},
|
||||
flexDirectionEnd() {
|
||||
return this.getPosition(1, 'vertical', 'bottom')
|
||||
},
|
||||
horizontalLeft() {
|
||||
return this.getPosition(2, 'horizontal', 'left')
|
||||
},
|
||||
horizontalRight() {
|
||||
return this.getPosition(2, 'horizontal', 'right')
|
||||
},
|
||||
// 计算 nvue bottom
|
||||
nvueBottom() {
|
||||
const safeBottom = uni.getSystemInfoSync().windowBottom;
|
||||
// #ifdef APP-NVUE
|
||||
return 30 + safeBottom
|
||||
// #endif
|
||||
// #ifndef APP-NVUE
|
||||
return 30
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pattern: {
|
||||
handler(val, oldVal) {
|
||||
this.styles = Object.assign({}, this.styles, val)
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.isShow = this.show
|
||||
if (this.top === 0) {
|
||||
this.fabShow = true
|
||||
}
|
||||
// 初始化样式
|
||||
this.styles = Object.assign({}, this.styles, this.pattern)
|
||||
},
|
||||
methods: {
|
||||
_onClick() {
|
||||
this.$emit('fabClick')
|
||||
if (!this.popMenu) {
|
||||
return
|
||||
}
|
||||
this.isShow = !this.isShow
|
||||
},
|
||||
open() {
|
||||
this.isShow = true
|
||||
},
|
||||
close() {
|
||||
this.isShow = false
|
||||
},
|
||||
/**
|
||||
* 按钮点击事件
|
||||
*/
|
||||
_onItemClick(index, item) {
|
||||
if (!this.isShow) {
|
||||
return
|
||||
}
|
||||
this.$emit('trigger', {
|
||||
index,
|
||||
item
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取 位置信息
|
||||
*/
|
||||
getPosition(types, paramA, paramB) {
|
||||
if (types === 0) {
|
||||
return this.horizontal === paramA && this.vertical === paramB
|
||||
} else if (types === 1) {
|
||||
return this.direction === paramA && this.vertical === paramB
|
||||
} else if (types === 2) {
|
||||
return this.direction === paramA && this.horizontal === paramB
|
||||
} else {
|
||||
return this.isShow && this.direction === paramA ? this.contentWidth : this.contentWidthMin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
$uni-shadow-base:0 1px 5px 2px rgba($color: #000000, $alpha: 0.3) !default;
|
||||
|
||||
.uni-fab {
|
||||
position: fixed;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 10;
|
||||
border-radius: 45px;
|
||||
box-shadow: $uni-shadow-base;
|
||||
}
|
||||
|
||||
.uni-cursor-point {
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-fab--active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.uni-fab--leftBottom {
|
||||
left: 15px;
|
||||
bottom: 30px;
|
||||
/* #ifdef H5 */
|
||||
left: calc(15px + var(--window-left));
|
||||
bottom: calc(30px + var(--window-bottom));
|
||||
/* #endif */
|
||||
// padding: 10px;
|
||||
}
|
||||
|
||||
.uni-fab--leftTop {
|
||||
left: 15px;
|
||||
top: 30px;
|
||||
/* #ifdef H5 */
|
||||
left: calc(15px + var(--window-left));
|
||||
top: calc(30px + var(--window-top));
|
||||
/* #endif */
|
||||
// padding: 10px;
|
||||
}
|
||||
|
||||
.uni-fab--rightBottom {
|
||||
right: 15px;
|
||||
bottom: 30px;
|
||||
/* #ifdef H5 */
|
||||
right: calc(15px + var(--window-right));
|
||||
bottom: calc(30px + var(--window-bottom));
|
||||
/* #endif */
|
||||
// padding: 10px;
|
||||
}
|
||||
|
||||
.uni-fab--rightTop {
|
||||
right: 15px;
|
||||
top: 30px;
|
||||
/* #ifdef H5 */
|
||||
right: calc(15px + var(--window-right));
|
||||
top: calc(30px + var(--window-top));
|
||||
/* #endif */
|
||||
// padding: 10px;
|
||||
}
|
||||
|
||||
.uni-fab__circle {
|
||||
position: fixed;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
background-color: #3c3e49;
|
||||
border-radius: 45px;
|
||||
z-index: 11;
|
||||
// box-shadow: $uni-shadow-base;
|
||||
}
|
||||
|
||||
.uni-fab__circle--leftBottom {
|
||||
left: 15px;
|
||||
bottom: 30px;
|
||||
/* #ifdef H5 */
|
||||
left: calc(15px + var(--window-left));
|
||||
bottom: calc(30px + var(--window-bottom));
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-fab__circle--leftTop {
|
||||
left: 15px;
|
||||
top: 30px;
|
||||
/* #ifdef H5 */
|
||||
left: calc(15px + var(--window-left));
|
||||
top: calc(30px + var(--window-top));
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-fab__circle--rightBottom {
|
||||
right: 15px;
|
||||
bottom: 30px;
|
||||
/* #ifdef H5 */
|
||||
right: calc(15px + var(--window-right));
|
||||
bottom: calc(30px + var(--window-bottom));
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-fab__circle--rightTop {
|
||||
right: 15px;
|
||||
top: 30px;
|
||||
/* #ifdef H5 */
|
||||
right: calc(15px + var(--window-right));
|
||||
top: calc(30px + var(--window-top));
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-fab__circle--left {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.uni-fab__circle--right {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.uni-fab__circle--top {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.uni-fab__circle--bottom {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.uni-fab__plus {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
// .fab-circle-v {
|
||||
// position: absolute;
|
||||
// width: 2px;
|
||||
// height: 24px;
|
||||
// left: 0;
|
||||
// top: 0;
|
||||
// right: 0;
|
||||
// bottom: 0;
|
||||
// /* #ifndef APP-NVUE */
|
||||
// margin: auto;
|
||||
// /* #endif */
|
||||
// background-color: white;
|
||||
// transform: rotate(0deg);
|
||||
// transition: transform 0.3s;
|
||||
// }
|
||||
|
||||
// .fab-circle-h {
|
||||
// position: absolute;
|
||||
// width: 24px;
|
||||
// height: 2px;
|
||||
// left: 0;
|
||||
// top: 0;
|
||||
// right: 0;
|
||||
// bottom: 0;
|
||||
// /* #ifndef APP-NVUE */
|
||||
// margin: auto;
|
||||
// /* #endif */
|
||||
// background-color: white;
|
||||
// transform: rotate(0deg);
|
||||
// transition: transform 0.3s;
|
||||
// }
|
||||
|
||||
.fab-circle-icon {
|
||||
transform: rotate(0deg);
|
||||
transition: transform 0.3s;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
.uni-fab__plus--active {
|
||||
transform: rotate(135deg);
|
||||
}
|
||||
|
||||
.uni-fab__content {
|
||||
/* #ifndef APP-NVUE */
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
border-radius: 55px;
|
||||
overflow: hidden;
|
||||
transition-property: width, height;
|
||||
transition-duration: 0.2s;
|
||||
width: 55px;
|
||||
border-color: #DDDDDD;
|
||||
border-width: 1rpx;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.uni-fab__content--other-platform {
|
||||
border-width: 0px;
|
||||
box-shadow: $uni-shadow-base;
|
||||
}
|
||||
|
||||
.uni-fab__content--left {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.uni-fab__content--right {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.uni-fab__content--flexDirection {
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.uni-fab__content--flexDirectionStart {
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.uni-fab__content--flexDirectionEnd {
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.uni-fab__item {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.uni-fab__item--active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.uni-fab__item-image {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.uni-fab__item-text {
|
||||
color: #FFFFFF;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.uni-fab__item--first {
|
||||
width: 55px;
|
||||
}
|
||||
</style>
|
@ -1,84 +0,0 @@
|
||||
{
|
||||
"id": "uni-fab",
|
||||
"displayName": "uni-fab 悬浮按钮",
|
||||
"version": "1.2.5",
|
||||
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
"uniui",
|
||||
"按钮",
|
||||
"悬浮按钮",
|
||||
"fab"
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
},
|
||||
"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-scss","uni-icons"],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"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",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
## Fab 悬浮按钮
|
||||
> **组件名:uni-fab**
|
||||
> 代码块: `uFab`
|
||||
|
||||
|
||||
点击可展开一个图形按钮菜单
|
||||
|
||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-fab)
|
||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
|
Loading…
Reference in New Issue
Block a user