pull/1/head
阿怪 11 months ago
parent 60bf302119
commit 4fa658db18

@ -0,0 +1,16 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"default" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

@ -1,4 +1,5 @@
<script>
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
export default {
onLaunch: function() {
console.log('App Launch')

@ -1,8 +1,10 @@
import net from './request.js';
// import store from '../store';
const API = {
//微信登录
getToken: data => net.POST('/login/token',data), // 获取token
wx_login: (data,userId) => net.POST('/user/binding/wechat',data,true,{"userId":userId}), // 微信登录
/*
首页信息
*/

@ -6,9 +6,10 @@ const loginUrl = 'pages/user/login';
export default {
REQUEST(url, method = 'GET', data, checkLogin = true, header) {
let token = uni.getStorageSync('access_token') || '';
let token = uni.getStorageSync('access_token') || 'Basic ZGV20mRldjEyMw==';
const headers = {
"Content-Type": "application/json",
// "Content-Type": "application/x-www-form-urlencoded",
"Authorization": token,
"x-token": token,
"token":token,
@ -17,7 +18,10 @@ export default {
}
var pages = getCurrentPages();
var page = pages[pages.length - 1];
if(!header) {
headers["Content-Type"] = 'application/x-www-form-urlencode'
}
console.log("headers :",headers)
return uni.request({
url: config.baseUrl + url,
method,

@ -1,6 +1,6 @@
// isdev 为 true 表示开发环境 false 表示发布环境
const isdev = true;
const baseUrl = isdev ? 'http://niunai.zhitou1688.com' : 'http://niunai.zhitou1688.com';// 办公室接口 & 测试环境
const baseUrl = isdev ? 'https://71e86bc1.r15.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';// 正式环境(由于本地测试后台没有启动,暂时通用正式服)
@ -8,10 +8,10 @@ const baseUrl = isdev ? 'http://niunai.zhitou1688.com' : 'http://niunai.zhitou16
const shareUrl = isdev ? 'https://h5.gwkjxb.com/' : 'http://test_h5.gwkjxb.com/';
const teacher_admin_url = 'http://teacher.gwkjxb.com/#/login'
const config = {
appName: '牛奶配送',
appName: '保护视力',
baseUrl,
appVersion: '1.0.6',
developer: '牛奶配送',
developer: '保护视力',
// appLogo: require('../static/logo.png'),
shareUrl,
teacher_admin_url,

@ -50,7 +50,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "",
"appid" : "wxaaf66dbb5c3983b3",
"setting" : {
"urlCheck" : false
},

@ -4,15 +4,15 @@
import mySwiper from "@/components/mySwiper.vue"
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()
onLoad((e) => {
if(!store.userInfo?.has_operation) { //
operation_flag.value = true
setTimeout(()=>{
console.log(inputDialog.value)
inputDialog.value.open()
},0)
// operation_flag.value = true
// setTimeout(()=>{
// console.log(inputDialog.value)
// inputDialog.value.open()
// },0)
}
})
//
@ -47,11 +47,35 @@
<view class="content page-box">
<!-- 轮播图 -->
<mySwiper :indicatorDots="true" :isRadius="true" height="160" class="index-siwper margin-b-card" :lbt_list="lbt_list" style="width: 100%;" />
<!-- <uni-popup ref="inputDialog" >
<view class="">
dasdsdd
<view class="main-cards">
<view class="mc-part" style="margin-left: 0;">
<view class="mc-part-text">已完成事项</view>
<image src="../../static/done.png" mode="widthFix"></image>
</view>
<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>
</view>
<view class="attention-card">
<view class="part-title">
注意事项
</view>
<view class="ac-parts">
<view class="ac-part" style="background: linear-gradient(45deg, #ffa2a2,#ffd3d3, #ffffff00);">
术前注意事项
<uni-icons type="forward" color="#ffa2a2" size="20"></uni-icons>
</view>
<view class="ac-part" style="background: linear-gradient(45deg, #f9b275,#fff3e9, #ffffff00);">
术中注意事项
<uni-icons type="forward" color="#f9b275" size="20"></uni-icons>
</view>
</uni-popup> -->
<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" :is-mask-click='false'>
<view class="pop-box">
<view class="pb-title">手术信息</view>
@ -64,7 +88,65 @@
</uni-popup>
</view>
</template>
<style>
<style scoped lang="scss">
.part-title{
border-left: 10rpx solid #fe915d;
padding-left: 20rpx;
font-weight: 900;
}
.attention-card{
margin-top: 20rpx;
width: 100%;
.ac-parts{
margin-top: 20rpx;
.ac-part{
display: flex;
align-items: center;
justify-content: space-between;
padding:30rpx 20rpx;
color: white;
margin: 20rpx 0;
}
}
}
.main-cards{
.mc-part{
.mc-part-text{
position: relative;
z-index: 10;
font-size: 36rpx;
font-weight: 900;
}
width: 50%;
/* text-align: center; */
background: linear-gradient(200deg, #82d8f2, #ddecf0);
color: white;
padding: 40rpx 20rpx;
margin: 0 20rpx;
border-radius: 20rpx;
height: 100rpx;
position: relative;
overflow: hidden;
image{
position: absolute;
width: 66%;
right: 0;
bottom: -20%;
z-index: 1;
// transform: rotate(315deg);
transform: rotate(45deg);
}
}
.mc-part2{
background: linear-gradient(200deg,#bbf4d5, #50c053);
// text-align: right;
}
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
margin-top: 20rpx;
}
.pop-box{
background-color: white;
padding: 20rpx;

@ -1,8 +1,57 @@
<template>
</template>
<script>
<script setup>
//
import { onLoad } from "@dcloudio/uni-app"
import mySwiper from "@/components/mySwiper.vue"
import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js'
const store = useStore()
import api from "@/api/index"
//
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)
wx_login()
}
async function wx_login(token_res){
let res=await new Promise(resolve=>{
uni.login({
provider: 'weixin', //使
success: function (loginRes) {
resolve(loginRes);
console.log(loginRes,'微信登录返回信息');
}
});
});
let userId = ''
// const res = await api.wx_login(data)
let res2=await api.wx_login({code:res.code},userId);
}
</script>
<template>
<view class="user-box page-box">
<button class="submit-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
<!-- <image class="wx_loin_img" :src="wx_login" mode=""></image> -->
<text>登录</text>
</button>
</view>
</template>
<style>
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

@ -0,0 +1,22 @@
## 1.3.52022-01-24
- 优化 size 属性可以传入不带单位的字符串数值
## 1.3.42022-01-24
- 优化 size 支持其他单位
## 1.3.32022-01-17
- 修复 nvue 有些图标不显示的bug兼容老版本图标
## 1.3.22021-12-01
- 优化 示例可复制图标名称
## 1.3.12021-11-23
- 优化 兼容旧组件 type 值
## 1.3.02021-11-19
- 新增 更多图标
- 优化 自定义图标使用方式
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-icons](https://uniapp.dcloud.io/component/uniui/uni-icons)
## 1.1.72021-11-08
## 1.2.02021-07-30
- 组件兼容 vue3如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.52021-05-12
- 新增 组件示例地址
## 1.1.42021-02-05
- 调整为uni_modules目录规范

File diff suppressed because it is too large Load Diff

@ -0,0 +1,96 @@
<template>
<!-- #ifdef APP-NVUE -->
<text :style="{ color: color, 'font-size': iconSize }" class="uni-icons" @click="_onClick">{{unicode}}</text>
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<text :style="{ color: color, 'font-size': iconSize }" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick"></text>
<!-- #endif -->
</template>
<script>
import icons from './icons.js';
const getVal = (val) => {
const reg = /^[0-9]*$/g
return (typeof val === 'number' || reg.test(val) )? val + 'px' : val;
}
// #ifdef APP-NVUE
var domModule = weex.requireModule('dom');
import iconUrl from './uniicons.ttf'
domModule.addRule('fontFace', {
'fontFamily': "uniicons",
'src': "url('"+iconUrl+"')"
});
// #endif
/**
* Icons 图标
* @description 用于展示 icons 图标
* @tutorial https://ext.dcloud.net.cn/plugin?id=28
* @property {Number} size 图标大小
* @property {String} type 图标图案参考示例
* @property {String} color 图标颜色
* @property {String} customPrefix 自定义图标
* @event {Function} click 点击 Icon 触发事件
*/
export default {
name: 'UniIcons',
emits:['click'],
props: {
type: {
type: String,
default: ''
},
color: {
type: String,
default: '#333333'
},
size: {
type: [Number, String],
default: 16
},
customPrefix:{
type: String,
default: ''
}
},
data() {
return {
icons: icons.glyphs
}
},
computed:{
unicode(){
let code = this.icons.find(v=>v.font_class === this.type)
if(code){
return unescape(`%u${code.unicode}`)
}
return ''
},
iconSize(){
return getVal(this.size)
}
},
methods: {
_onClick() {
this.$emit('click')
}
}
}
</script>
<style lang="scss">
/* #ifndef APP-NVUE */
@import './uniicons.css';
@font-face {
font-family: uniicons;
src: url('./uniicons.ttf') format('truetype');
}
/* #endif */
.uni-icons {
font-family: uniicons;
text-decoration: none;
text-align: center;
}
</style>

@ -0,0 +1,663 @@
.uniui-color:before {
content: "\e6cf";
}
.uniui-wallet:before {
content: "\e6b1";
}
.uniui-settings-filled:before {
content: "\e6ce";
}
.uniui-auth-filled:before {
content: "\e6cc";
}
.uniui-shop-filled:before {
content: "\e6cd";
}
.uniui-staff-filled:before {
content: "\e6cb";
}
.uniui-vip-filled:before {
content: "\e6c6";
}
.uniui-plus-filled:before {
content: "\e6c7";
}
.uniui-folder-add-filled:before {
content: "\e6c8";
}
.uniui-color-filled:before {
content: "\e6c9";
}
.uniui-tune-filled:before {
content: "\e6ca";
}
.uniui-calendar-filled:before {
content: "\e6c0";
}
.uniui-notification-filled:before {
content: "\e6c1";
}
.uniui-wallet-filled:before {
content: "\e6c2";
}
.uniui-medal-filled:before {
content: "\e6c3";
}
.uniui-gift-filled:before {
content: "\e6c4";
}
.uniui-fire-filled:before {
content: "\e6c5";
}
.uniui-refreshempty:before {
content: "\e6bf";
}
.uniui-location-filled:before {
content: "\e6af";
}
.uniui-person-filled:before {
content: "\e69d";
}
.uniui-personadd-filled:before {
content: "\e698";
}
.uniui-back:before {
content: "\e6b9";
}
.uniui-forward:before {
content: "\e6ba";
}
.uniui-arrow-right:before {
content: "\e6bb";
}
.uniui-arrowthinright:before {
content: "\e6bb";
}
.uniui-arrow-left:before {
content: "\e6bc";
}
.uniui-arrowthinleft:before {
content: "\e6bc";
}
.uniui-arrow-up:before {
content: "\e6bd";
}
.uniui-arrowthinup:before {
content: "\e6bd";
}
.uniui-arrow-down:before {
content: "\e6be";
}
.uniui-arrowthindown:before {
content: "\e6be";
}
.uniui-bottom:before {
content: "\e6b8";
}
.uniui-arrowdown:before {
content: "\e6b8";
}
.uniui-right:before {
content: "\e6b5";
}
.uniui-arrowright:before {
content: "\e6b5";
}
.uniui-top:before {
content: "\e6b6";
}
.uniui-arrowup:before {
content: "\e6b6";
}
.uniui-left:before {
content: "\e6b7";
}
.uniui-arrowleft:before {
content: "\e6b7";
}
.uniui-eye:before {
content: "\e651";
}
.uniui-eye-filled:before {
content: "\e66a";
}
.uniui-eye-slash:before {
content: "\e6b3";
}
.uniui-eye-slash-filled:before {
content: "\e6b4";
}
.uniui-info-filled:before {
content: "\e649";
}
.uniui-reload:before {
content: "\e6b2";
}
.uniui-micoff-filled:before {
content: "\e6b0";
}
.uniui-map-pin-ellipse:before {
content: "\e6ac";
}
.uniui-map-pin:before {
content: "\e6ad";
}
.uniui-location:before {
content: "\e6ae";
}
.uniui-starhalf:before {
content: "\e683";
}
.uniui-star:before {
content: "\e688";
}
.uniui-star-filled:before {
content: "\e68f";
}
.uniui-calendar:before {
content: "\e6a0";
}
.uniui-fire:before {
content: "\e6a1";
}
.uniui-medal:before {
content: "\e6a2";
}
.uniui-font:before {
content: "\e6a3";
}
.uniui-gift:before {
content: "\e6a4";
}
.uniui-link:before {
content: "\e6a5";
}
.uniui-notification:before {
content: "\e6a6";
}
.uniui-staff:before {
content: "\e6a7";
}
.uniui-vip:before {
content: "\e6a8";
}
.uniui-folder-add:before {
content: "\e6a9";
}
.uniui-tune:before {
content: "\e6aa";
}
.uniui-auth:before {
content: "\e6ab";
}
.uniui-person:before {
content: "\e699";
}
.uniui-email-filled:before {
content: "\e69a";
}
.uniui-phone-filled:before {
content: "\e69b";
}
.uniui-phone:before {
content: "\e69c";
}
.uniui-email:before {
content: "\e69e";
}
.uniui-personadd:before {
content: "\e69f";
}
.uniui-chatboxes-filled:before {
content: "\e692";
}
.uniui-contact:before {
content: "\e693";
}
.uniui-chatbubble-filled:before {
content: "\e694";
}
.uniui-contact-filled:before {
content: "\e695";
}
.uniui-chatboxes:before {
content: "\e696";
}
.uniui-chatbubble:before {
content: "\e697";
}
.uniui-upload-filled:before {
content: "\e68e";
}
.uniui-upload:before {
content: "\e690";
}
.uniui-weixin:before {
content: "\e691";
}
.uniui-compose:before {
content: "\e67f";
}
.uniui-qq:before {
content: "\e680";
}
.uniui-download-filled:before {
content: "\e681";
}
.uniui-pyq:before {
content: "\e682";
}
.uniui-sound:before {
content: "\e684";
}
.uniui-trash-filled:before {
content: "\e685";
}
.uniui-sound-filled:before {
content: "\e686";
}
.uniui-trash:before {
content: "\e687";
}
.uniui-videocam-filled:before {
content: "\e689";
}
.uniui-spinner-cycle:before {
content: "\e68a";
}
.uniui-weibo:before {
content: "\e68b";
}
.uniui-videocam:before {
content: "\e68c";
}
.uniui-download:before {
content: "\e68d";
}
.uniui-help:before {
content: "\e679";
}
.uniui-navigate-filled:before {
content: "\e67a";
}
.uniui-plusempty:before {
content: "\e67b";
}
.uniui-smallcircle:before {
content: "\e67c";
}
.uniui-minus-filled:before {
content: "\e67d";
}
.uniui-micoff:before {
content: "\e67e";
}
.uniui-closeempty:before {
content: "\e66c";
}
.uniui-clear:before {
content: "\e66d";
}
.uniui-navigate:before {
content: "\e66e";
}
.uniui-minus:before {
content: "\e66f";
}
.uniui-image:before {
content: "\e670";
}
.uniui-mic:before {
content: "\e671";
}
.uniui-paperplane:before {
content: "\e672";
}
.uniui-close:before {
content: "\e673";
}
.uniui-help-filled:before {
content: "\e674";
}
.uniui-paperplane-filled:before {
content: "\e675";
}
.uniui-plus:before {
content: "\e676";
}
.uniui-mic-filled:before {
content: "\e677";
}
.uniui-image-filled:before {
content: "\e678";
}
.uniui-locked-filled:before {
content: "\e668";
}
.uniui-info:before {
content: "\e669";
}
.uniui-locked:before {
content: "\e66b";
}
.uniui-camera-filled:before {
content: "\e658";
}
.uniui-chat-filled:before {
content: "\e659";
}
.uniui-camera:before {
content: "\e65a";
}
.uniui-circle:before {
content: "\e65b";
}
.uniui-checkmarkempty:before {
content: "\e65c";
}
.uniui-chat:before {
content: "\e65d";
}
.uniui-circle-filled:before {
content: "\e65e";
}
.uniui-flag:before {
content: "\e65f";
}
.uniui-flag-filled:before {
content: "\e660";
}
.uniui-gear-filled:before {
content: "\e661";
}
.uniui-home:before {
content: "\e662";
}
.uniui-home-filled:before {
content: "\e663";
}
.uniui-gear:before {
content: "\e664";
}
.uniui-smallcircle-filled:before {
content: "\e665";
}
.uniui-map-filled:before {
content: "\e666";
}
.uniui-map:before {
content: "\e667";
}
.uniui-refresh-filled:before {
content: "\e656";
}
.uniui-refresh:before {
content: "\e657";
}
.uniui-cloud-upload:before {
content: "\e645";
}
.uniui-cloud-download-filled:before {
content: "\e646";
}
.uniui-cloud-download:before {
content: "\e647";
}
.uniui-cloud-upload-filled:before {
content: "\e648";
}
.uniui-redo:before {
content: "\e64a";
}
.uniui-images-filled:before {
content: "\e64b";
}
.uniui-undo-filled:before {
content: "\e64c";
}
.uniui-more:before {
content: "\e64d";
}
.uniui-more-filled:before {
content: "\e64e";
}
.uniui-undo:before {
content: "\e64f";
}
.uniui-images:before {
content: "\e650";
}
.uniui-paperclip:before {
content: "\e652";
}
.uniui-settings:before {
content: "\e653";
}
.uniui-search:before {
content: "\e654";
}
.uniui-redo-filled:before {
content: "\e655";
}
.uniui-list:before {
content: "\e644";
}
.uniui-mail-open-filled:before {
content: "\e63a";
}
.uniui-hand-down-filled:before {
content: "\e63c";
}
.uniui-hand-down:before {
content: "\e63d";
}
.uniui-hand-up-filled:before {
content: "\e63e";
}
.uniui-hand-up:before {
content: "\e63f";
}
.uniui-heart-filled:before {
content: "\e641";
}
.uniui-mail-open:before {
content: "\e643";
}
.uniui-heart:before {
content: "\e639";
}
.uniui-loop:before {
content: "\e633";
}
.uniui-pulldown:before {
content: "\e632";
}
.uniui-scan:before {
content: "\e62a";
}
.uniui-bars:before {
content: "\e627";
}
.uniui-cart-filled:before {
content: "\e629";
}
.uniui-checkbox:before {
content: "\e62b";
}
.uniui-checkbox-filled:before {
content: "\e62c";
}
.uniui-shop:before {
content: "\e62f";
}
.uniui-headphones:before {
content: "\e630";
}
.uniui-cart:before {
content: "\e631";
}

@ -0,0 +1,86 @@
{
"id": "uni-icons",
"displayName": "uni-icons 图标",
"version": "1.3.5",
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
"keywords": [
"uni-ui",
"uniui",
"icon",
"图标"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": "^3.2.14"
},
"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"],
"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"
}
}
}
}
}

@ -0,0 +1,8 @@
## Icons 图标
> **组件名uni-icons**
> 代码块: `uIcons`
用于展示 icons 图标 。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-icons)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839

@ -0,0 +1,463 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const api_request = require("./request.js");
const API = {
//微信登录
getToken: (data) => api_request.net.POST("/login/token", data),
// 获取token
wx_login: (data, userId) => api_request.net.POST("/user/binding/wechat", data, true, { "userId": userId }),
// 微信登录
/*
首页信息
*/
getIndexInfo: (data) => api_request.net.GET("/api/index/index"),
// 首页信息
getIndexBanner: (data) => api_request.net.GET("/api/banner/index", data),
// 轮播图
getIndexNotice: (data) => api_request.net.GET("/api/news/notice"),
// 公告
getGoodsDetail: (data) => api_request.net.GET("/api/goods/detail", data),
// 商品详情(普通商品)
getSeckillGoodsDetail: (data) => api_request.net.GET("/api/seckill_goods/detail", data),
// 商品详情(秒杀)
getGroupGoodsDetail: (data) => api_request.net.GET("/api/group_goods/detail", data),
// 商品详情(团购)
getGoodsList: (data) => api_request.net.GET("/api/goods/lists", data),
// 商品列表(普通商品)
getSeckillGoodsList: (data) => api_request.net.GET("/api/seckill_goods/lists", data),
// 商品列表(限时)
getGroupGoodsList: (data) => api_request.net.GET("/api/group_goods/lists?page=&keyword=", data),
// 商品列表(团购)
getNewinfo: (data) => api_request.net.GET("/api/goods/getGoodsSpec", data),
// 根据商品规格更新数据
getCategoryList: (data) => api_request.net.GET("/api/goods_category/lists"),
// 获取商品分类
getCategory: (data) => api_request.net.GET("/api/goods/category", data),
// 根据分类Id获取分类商品
getCartList: (data) => api_request.net.GET("/api/cart/lists", data),
// 获取购物车列表
addCart: (data) => api_request.net.POST("/api/cart/add", data),
// 加入购物车
delCart: (data) => api_request.net.POST("/api/cart/delete", data),
// 删除购物车
updateCart: (data) => api_request.net.POST("/api/cart/edit", data),
// 更新购物车
login: (data) => api_request.net.POST("/api/user/wechatLogin", data),
// 登录
login_test: (data) => api_request.net.GET("/api/user/testLogin?id=1"),
// 登录 测试专用
zhuce: (data) => api_request.net.POST("/api/user/profile", data),
// 注册
getOrderList: (data) => api_request.net.GET("/api/order/lists", data),
//订单列表
getOrderGroupList: (data) => api_request.net.GET("/api/group_order/lists", data),
//订单列表(团购)
getOrderSeckillList: (data) => api_request.net.GET("/api/seckill_order/lists", data),
//订单列表(秒杀)
pay: (data) => api_request.net.POST("/api/order/pay", data),
//支付
payGroup: (data) => api_request.net.POST("/api/group_order/pay", data),
//支付(团购)
paySeckill: (data) => api_request.net.POST("/api/seckill_order/pay", data),
//支付(秒杀)
refund: (data) => api_request.net.POST("/api/order/refund", data),
//退款
getOrderInviteList: (data) => api_request.net.GET("/api/invite/order", data),
//分销订单
getOrderBaseinfo: (data) => api_request.net.POST("/api/order/preview", data),
//获取订单提交页面的基本信息
getOrderGroupBaseinfo: (data) => api_request.net.POST("/api/group_order/preview", data),
//获取订单提交页面的基本信息(团购)
getOrderSeckillBaseinfo: (data) => api_request.net.POST("/api/seckill_order/preview", data),
//获取订单提交页面的基本信息(秒杀)
getOrderCartinfo: (data) => api_request.net.POST("/api/order/cartPreview", data),
//获取订单提交页面的基本信息(购物车来的)
getDelivery: (data) => api_request.net.GET("/api/index/delivery", data),
//获取配送相关的选项(普通商品)
staffApply: (data) => api_request.net.POST("/api/invite/apply", data),
//业务员申请
deliveryApply: (data) => api_request.net.POST("/api/staff/apply", data),
//配送员申请
getDeliveryArea: (data) => api_request.net.GET("/api/staff/getDeliveryArea"),
//获取配送区域
getAddressList: (data) => api_request.net.GET("/api/address/lists"),
//地址列表
getAddDetail: (data) => api_request.net.GET("/api/address/detail", data),
//地址详情
addAddress: (data) => api_request.net.POST("/api/address/add", data),
//新增地址
editAddress: (data) => api_request.net.POST("/api/address/edit", data),
//修改地址
delAddress: (data) => api_request.net.GET("/api/address/delete", data),
//删除地址
getDefaultAddress: (data) => api_request.net.GET("/api/address/getDefault"),
//获取默认地址
orderSubmitFunc: (data) => api_request.net.POST("/api/order/order", data),
//提交订单(普通订单)
orderSubmitCartFunc: (data) => api_request.net.POST("/api/order/cartOrder", data),
//提交订单(购物车)
orderSubmitGroupFunc: (data) => api_request.net.POST("/api/group_order/order", data),
//提交订单(团购订单)
orderSubmitSeckillFunc: (data) => api_request.net.POST("/api/seckill_order/order", data),
//提交订单(秒杀订单)
orderDetail: (data) => api_request.net.GET("/api/order/detail", data),
//订单详情-普通订单 (顾客)
orderGroupDetail: (data) => api_request.net.GET("/api/group_order/detail", data),
//订单详情-团购订单
orderSeckillDetail: (data) => api_request.net.GET("/api/seckill_order/detail", data),
//订单详情-秒杀订单
orderStaffDetail: (data) => api_request.net.GET("/api/staff/orderDetail", data),
//订单详情-配送订单
orderLeaderDetail: (data) => api_request.net.GET("/api/leader/orderDetail", data),
//订单详情-管理员订单
orderCancel: (data) => api_request.net.POST("/api/order/cancle", data),
//取消订单
orderCancelGroup: (data) => api_request.net.POST("/api/group_order/cancle", data),
//取消订单 (团购)
orderCancelSeckill: (data) => api_request.net.POST("/api/seckill_order/cancle", data),
//取消订单 (秒杀)
/*
用户相关
*/
getUserInfo: (data) => api_request.net.GET("/api/user/userInfo", data),
//获取用户信息
updateUserInfo: (data) => api_request.net.POST("/api/user/profile", data),
//更新用户信息
rechargeFunc: (data) => api_request.net.POST("/api/recharge/recharge", data),
//充值
withdrawalFunc: (data) => api_request.net.POST("/api/withdrawl/submit", data),
//提现
vipBuy: (data) => api_request.net.POST("/api/vip/order", data),
//购买VIP
vipConfig: (data) => api_request.net.GET("/api/vip/config"),
//会员说明
/*
优惠券
*/
getCouponsList: (data) => api_request.net.GET("/api/coupon/userCoupons", data),
//优惠券
getCouponsCenterList: (data) => api_request.net.GET("/api/coupon/lists", data),
//领券中心
couponsCenterReceive: (data) => api_request.net.POST("/api/coupon/receive", data),
//领取优惠
getMyStars: (data) => api_request.net.GET("/api/collect/lists", data),
//我的收藏
/*
推广中心
*/
inviteCenter: (data) => api_request.net.GET("/api/invite/index", data),
//首页
inviteCenterwithdrawl: (data) => api_request.net.POST("/api/withdrawl/submit", data),
//提现
inviteCenterwithdrawlDetail: (data) => api_request.net.GET("/api/invite/withdrawlDetail", data),
//提现明细
inviteCenterwithdrawlRecodes: (data) => api_request.net.GET("/api/invite/record", data),
//提现明细(佣金)
getShareQrcode: (data) => api_request.net.GET("/api/user/getShareQrcode"),
//用户分销二维码
/*
配置相关
*/
getConfig: (data) => api_request.net.GET("/api/index/config"),
setDeliveryTime: (data) => api_request.net.POST("/api/staff/setDeliveryTime", data),
// 设置配送时间
getDeliveryTime: (data) => api_request.net.GET("/api/staff/getDeliveryTime"),
// 获取配送时间
getStaffOrder: (data) => api_request.net.GET("/api/staff/orderLists", data),
// 获取订单管理列表(配送员)
getManageOrder: (data) => api_request.net.GET("/api/leader/orderLists", data),
// 获取订单管理列表(团长)
deliveryPhoto: (data) => api_request.net.POST("/api/staff/deliveryPhoto", data),
// 送达拍照
reveiceOrder: (data) => api_request.net.POST("/api/staff/reveiceOrder", data),
// 接单
reveiceOrderOk: (data) => api_request.net.POST("/api/leader/assignOrder", data),
// 派单
getStaffList: (data) => api_request.net.GET("/api/leader/staffList"),
// 配送员列表
goodsBuyFunc: (data) => api_request.net.POST("/api/leader/goodsBuy", data),
// 商品申购
getRecordList: (data) => api_request.net.GET("/api/leader/recordList", data),
// 货物入库
/**
*
* 登录类信息
*
*/
// 检查更新
getUpdateVersion: (data) => api_request.net.GET("/api/v1/index/version"),
// 获取定位
getLocationInfo: (data) => api_request.net.GET("/api/v1/index/ip", data),
// 验证码登陆
codeLogin: (data) => api_request.net.POST("/code/login", data),
// H5扫码登录邀请接口
inviteLogin: (data) => api_request.net.POST("/api/v1/invite/login", data),
// 发送手机验证码接口
sendVerifyCode: (data) => api_request.net.POST("/api/v1/sms/send", { send_type: "student", ...data }),
// 注销账号
unRegister: (data) => api_request.net.POST("/api/v1/student/delete", data),
// 授权登录
accessLogin: (data, t = "wx") => api_request.net.POST(`/api/v1/${t}/login`, data),
// 退出登录
logOut: (data) => api_request.net.POST("/api/v1/code/logout", data),
// 获取省份
getProvince: (data) => api_request.net.GET("/api/v1/colleges/getProvince", data),
// 根据学员所选择的教学点获取院校列表接口
collegesList: (data) => api_request.net.GET("/api/v1/colleges/list", data),
// 通过市反查省/自治区/直辖市
getProvinceByCity: (data) => api_request.net.GET("/api/v1/region/getProvinceByCity", data),
/**
*
* 用户信息
*
*/
// 学员个人信息接口
selectUserInfo: (data) => api_request.net.GET("/api/v1/student/info", data),
// 登录成功后填写学员信息接口
userUpdate: (data) => api_request.net.POST("/api/v1/student/update", data),
// 邀请二维码
qrcode: (data) => api_request.net.POST("/api/v1/student/invite/qrcode", data),
uploadBase64: (data) => api_request.net.POST("/api/v1/student/uploadBase64", data),
// 获取被邀请人列表接口
inviteList: (data) => api_request.net.GET("/api/v1/student/invite/list", data),
// 积分列表
scoreList: (data) => api_request.net.GET("/point", data),
// 余额明细
balanceList: (data) => api_request.net.POST("/api/v1/balance/detail/get/list", data),
// 模拟测试记录
recordList: (data) => api_request.net.GET("/api/v1/test-record/mock/examination/record", data),
// 练习题错误集详情
practiceList: (data) => api_request.net.GET("/api/v1/test-record/practice/list", data),
/**
*
* 首页数据
*
*/
// 首页配置获取
indexConfig: (data) => api_request.net.GET("/api/v1/index/config", data),
// 轮播
// indexBanner: data => net.GET('/app/banner', data),
indexBanner: (data) => api_request.net.POST("/api/v1/index/lbt", data),
// 获取咨询文章列表
// wzList: data => net.GET('/app/consult-wz', data),
wzList: (data) => api_request.net.POST("/api/v1/index/wz/list", data),
// 获取咨询文章
// wzInfo: id => net.GET(`/app/consult-wz/${id}`),
wzInfo: (id) => api_request.net.GET(`/api/v1/index/wz/${id}`),
// 获取课程分页
getCourseList: (data) => api_request.net.GET(`/app/course/page`, data),
// 获取推荐院校列表
// recommendwzList: data => net.GET('/app/academy', data),
recommendwzList: (data) => api_request.net.POST("/api/v1/index/academy/list", data),
// 获取推荐院校文章
// recommendwzInfo: id => net.GET(`/app/academy/${id}`),
recommendwzInfo: (id) => api_request.net.GET(`/api/v1/index/academy/${id}`),
// 推荐院校文章阅读量累计
// recomendaddReadNumber: data => net.PUT('/app/academy/num',data),
recomendaddReadNumber: (data) => api_request.net.POST("/api/v1/index/academy/add/num", data),
//获取考试大纲列表
syllabusList: (data) => api_request.net.POST("/api/v1/index/syllabus/list", data),
// 搜索
search: (data) => api_request.net.POST("/api/v1/index/search", data),
// 阅读量累计
addReadNumber: (data) => api_request.net.PUT("/app/consult-wz/num", data),
// 师资团队列表
lecturerList: (data) => api_request.net.GET("/api/v1/index/lecturer", data),
// 师资详情
lecturerDetail: (id) => api_request.net.GET(`/api/v1/index/lecturer/${id}`),
// 获取资料列表
indexMaterial: (data) => api_request.net.GET("/api/v1/index/material", data),
// indexMaterial: data => net.GET('/app/material', data),
// 获取资料详情
materialDetail: (data) => api_request.net.GET(`/api/v1/index/material/${data.id}`, { buyer_id: data.buyer_id }),
// 获取精品课程
indexBoutiqueCourse: (data) => api_request.net.GET("/api/v1/index/boutique/course", data),
// 获取精品课程详情
boutiqueCourseDetail: (id) => api_request.net.GET(`/api/v1/index/boutique/course/${id}`),
// 获取课程
courseList: (data) => api_request.net.POST("/api/v1/course/get", data),
// 获取套餐
comboList: (data) => api_request.net.POST("/api/v1/combo/course/get", data),
// courseList: data => net.GET('/app/course/page', data),
// 获取课程详情
courseDetail: (id, data) => api_request.net.GET(`/api/v1/course/${id}`, data),
// courseDetail: (id, data) => net.GET(`/app/course`, {id}),
// 获取线下课程
offlineCourseList: (data) => api_request.net.POST("/api/v1/offline/course/get", data),
// 获取线下课程详情
offlineCourseDetail: (id) => api_request.net.GET(`/api/v1/offline/course/${id}`),
// 获取套餐课程详情
getComboDetail: (data) => api_request.net.GET(`/api/v1/combo/course/${data.id}`, { buyer_id: data.buyer_id }),
// 获取直播课列表
// liveCourseList: data => net.GET('/api/v1/sys-course-live', data),
liveCourseList: (data) => api_request.net.GET("/api/v1/api-live-course", data),
// 直播课详情
viewCourse: (id, data) => api_request.net.GET("/api/v1/sys-course-live/" + id, { buyer_id: data.buyer_id }),
// 直播课详情 测试
viewCourse_test: (id, data) => api_request.net.GET("/api/v1/api-live-course/" + id, { buyer_id: data.buyer_id }),
/*题库 管理*/
//题库
getQuestionExercise: (data) => api_request.net.GET("/exercises", data),
// 科目
subjectList: (data) => api_request.net.GET("/api/v1/public/subject", data),
// subjectList: data => net.GET('/app/subject/list', data),
// 获取学员学习列表接口
learningList: (data) => api_request.net.GET("/api/v1/learning", data),
// 学习课程详情
learningDetail: (data) => api_request.net.GET(`/api/v1/learning/course/${data}`),
// 学习直播课程详情
learningLiveDetail: (data) => api_request.net.GET(`/api/v1/learning/course/live/${data}`),
// 学员学习计时接口
// "time_type": "stop" //计时类型 start-开始计时 stop-停止计时
studyDuration: (data) => api_request.net.POST("/api/v1/learning/course/duration", data),
// 学习统计API
courseStatistics: (data) => api_request.net.POST("/api/v1/learning/course/statistics", data),
// 题型分类
questionBankType: (data) => api_request.net.GET("/api/v1/questionBank/type", data),
// 网课、测试、题库详情
exercisesDetails: (data) => api_request.net.GET(`/api/v1/exercises/detail/${data}`),
// 测试练习题列表
testList: (data) => api_request.net.GET("/api/v1/exercises/test/list", data),
// 模拟试卷列表
examinationList: (data) => api_request.net.GET("/api/v1/examination/list", data),
// 获取题库、网课题目列表接口
exerciseSubjectList: (data) => api_request.net.GET("/api/v1/exercise/subject/list", data),
// 试题分类
exercisesType: (data) => api_request.net.GET("/api/v1/exercises/type", data),
// 模拟题详情
examinationDetail: (id) => api_request.net.GET(`/api/v1/examination/detail/${id}`),
// 开始答题
startTest: (data) => api_request.net.POST("/api/v1/exercises/start/answer", data),
// question_bank_id
// 交卷
submitTest: (data) => api_request.net.POST("/api/v1/exercises/submit", data),
// 下一题
nextSubject: (data) => api_request.net.POST("/api/v1/exercises/next", data),
// 重新答题
againAnswer: (data) => api_request.net.POST("/api/v1/exercises/againAnswer", data),
// 答题成绩报告
scoreReport: (data) => api_request.net.GET("/api/v1/exercises/achievement/report", data),
// 获取团购列表
getGroupList: (data) => api_request.net.GET("/api/v1/group/page", data),
// 获取团购详情
getGroupPurchaseData: (data) => api_request.net.GET("/api/v1/group", data),
//发起拼团
starGroupPurchase: (data) => api_request.net.POST("/api/v1/group", data),
//加入拼团
joinGroupPurchase: (data) => api_request.net.POST("/api/v1/group/join", data),
/**
*
* 支付接口
*
*/
// 支付接口
wxOrAlipay: (data) => api_request.net.POST("/api/v1/pay", data),
// 获取openid
getOpenID: (data) => {
return common_vendor.index.request({
url: "https://api.weixin.qq.com/sns/oauth2/access_token",
method: "GET",
// header: {
// ...header,
// ...headers
// },
data
});
},
// 余额支付
yuePay: (data) => api_request.net.POST("/api/v1/student/pay/balance", data),
//H5下单API
// v3_pay:data => net.POST('https://api.mch.weixin.qq.com/v3/pay/transactions/h5',data)
v3_pay: (data) => {
return common_vendor.index.request({
url: "https://api.mch.weixin.qq.com/v3/pay/transactions/h5",
method: "POST",
header: {
"Content-Type": "application/json"
},
data
});
},
//测试
pay_check: (data) => api_request.net.POST("/api/v1/wxpay/check", data),
pay_callback: (data) => api_request.net.POST("/api/v1/wxpay/callback", data),
/**
*
* 地址接口
*
*/
// 列表
addressList: (data) => api_request.net.POST("/api/v1/address", data),
// student_id
// 新增/编辑
addressAction: (data) => api_request.net.POST(`/api/v1/address/add`, data),
editaddressAction: (data) => api_request.net.PUT(`/api/v1/address`, data),
// 删除
addressDelete: (data) => api_request.net.DELETE("/api/v1/address", data),
// id
/**
*
* 购物车接口
*
*/
// 列表
cartList: (data) => api_request.net.POST("/api/v1/shopping/cart", data),
// 添加
cartAdd: (data) => api_request.net.POST("/api/v1/shopping/cart/add", data),
// 编辑
cartUpdate: (data) => api_request.net.POST("/api/v1/shopping/cart/update", data),
// 删除
cartDelete: (data) => api_request.net.POST("/api/v1/shopping/cart/delete", data),
// id
/**
*
* 订单接口
*
*/
// 订单查询
orderList: (data) => api_request.net.POST("/api/v1/api-order/get/my/order/list", data),
// 确认收货
orderUpdate: (data) => api_request.net.POST("/api/v1/api-order/update/material/order", data),
// 删除
orderDelete: (data) => api_request.net.POST("/api/v1/api-order/delete/order", data),
/**
* 商品价格合计
* @param { order_count_list: [{ id: '', order_type: '', num: ''}] }
*
*/
orderCount: (data) => api_request.net.POST("/api/v1/api-order/order/count", data),
/**
* 资料在线课程的立即购买/购物车
* @param { goods: [{ id: '', order_type: '', num: ''}], student_id: '' }
*
*/
orderBuynow: (data) => api_request.net.POST("/api/v1/api-order/order/buynow", data),
// 新增资料订单
orderMaterialAdd: (data) => api_request.net.POST("/api/v1/api-order/add/material/order", data),
// 新增在线课程订单
orderOnlineAdd: (data) => api_request.net.POST("/api/v1/api-order/add/online/order", data),
// 直播课订单
orderLiveAdd: (data) => api_request.net.POST("/api/v1/api-order/add/live/order", data),
// 新增套餐课程订单
orderComboAdd: (data) => api_request.net.POST("/api/v1/api-order/add/combo/order", data),
// 新增线下订单==报名
orderOfflineAdd: (data) => api_request.net.POST("/api/v1/api-order/add/offline/order", data),
// 新增团购订单
orderGroupAdd: (data) => api_request.net.POST("/api/v1/api-order/add/group/order", data),
// 分享平台
shareProvider: () => api_request.net.getShareProvider(),
// 支付方式
paymentProvider: () => api_request.net.getPaymentProvider(),
// 物流查询
queryKuaidi: (data) => api_request.net.POST("/api/v1/kuaidi/poll/query", data),
// SHARE: () => net.SHARE(),
// 提现
transfer: (data) => api_request.net.POST("/api/v1/wxpay/transfer", data),
// 获取我的收藏分页列表
getStarList: (data) => api_request.net.POST("/api/v1/favorite/get", data),
// 取消收藏
cancelStar: (data) => api_request.net.DELETE("/api/v1/favorite", data),
//添加收藏
addStar: (data) => api_request.net.POST("/api/v1/favorite", data)
};
exports.API = API;

@ -0,0 +1,194 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const config_index = require("../config/index.js");
const loginUrl = "pages/user/login";
const net = {
REQUEST(url, method = "GET", data, checkLogin = true, header) {
let token = common_vendor.index.getStorageSync("access_token") || "Basic ZGV20mRldjEyMw==";
const headers = {
"Content-Type": "application/json",
// "Content-Type": "application/x-www-form-urlencoded",
"Authorization": token,
"x-token": token,
"token": token
// "X-Forwarded-For":'client_ip'
// 'Referer':'twzxjy.com'
};
var pages = getCurrentPages();
var page = pages[pages.length - 1];
if (!header) {
headers["Content-Type"] = "application/x-www-form-urlencode";
}
console.log("headers :", headers);
return common_vendor.index.request({
url: config_index.config.baseUrl + url,
method,
header: {
...header,
...headers
},
data
}).then((res) => {
if (res.statusCode === 200 && res.data) {
if (res.data.code === 409) {
common_vendor.index.showModal({
title: "提示",
content: "您的账号已在其他设备登录,已强制下线!",
confirmColor: "#006647",
showCancel: false,
success: (res2) => {
if (res2.confirm) {
common_vendor.index.removeStorageSync("access_token");
common_vendor.index.removeStorageSync("user_info");
if (checkLogin && page.route != loginUrl) {
common_vendor.index.navigateTo({
url: "/" + loginUrl
});
}
}
}
});
return {
...res.data
};
}
if (res.data.code === 5) {
common_vendor.index.removeStorageSync("access_token");
if (page.route != loginUrl && checkLogin) {
common_vendor.index.navigateTo({
url: "/" + loginUrl
});
}
}
return res.data;
} else {
const reg = /abort/;
let code = 0;
let msg = res[0] && res[0].errMsg || "未知错误";
if (res[0] && res[0].errMsg && reg.test(res[0].errMsg)) {
msg = "网络请求中断";
}
return {
code,
msg,
data: null
};
}
}).catch((parmas) => {
return parmas;
});
},
GET(url, body, checkLogin = true, header) {
return this.REQUEST(url, "GET", body, checkLogin, header);
},
POST(url, body, checkLogin = true, header) {
return this.REQUEST(url, "POST", body, checkLogin, header);
},
PUT(url, body, header) {
return this.REQUEST(url, "PUT", body, header);
},
DELETE(url, body, header) {
return this.REQUEST(url, "DELETE", body, header);
},
UPLOAD(data) {
return new Promise((resolve, reject) => {
let token = common_vendor.index.getStorageSync("access_token") || "";
common_vendor.index.uploadFile({
...data,
url: config_index.config.base_url + data.url,
header: {
"Access-Token": token
},
success(res) {
res.data = JSON.parse(res.data);
if (res.data.code === 401) {
common_vendor.index.removeStorageSync("access_token");
common_vendor.index.removeStorageSync("userInfo");
common_vendor.index.navigateTo({
url: "/pages/login/login"
});
}
resolve(res);
},
fail(e) {
console.log(e);
reject(e);
}
});
});
},
getShareProvider: () => {
return common_vendor.index.getProvider({
service: "share"
}).then((res) => {
let data = [];
for (let i = 0; i < res.provider.length; i++) {
switch (res.provider[i]) {
case "weixin":
data.push({
name: "微信好友",
id: "weixin",
icon: "/static/wx.png"
});
data.push({
name: "朋友圈",
id: "weixin",
type: "WXSenceTimeline",
icon: "/static/pyq.png"
});
break;
case "qq":
data.push({
name: "QQ好友",
id: "qq",
icon: "/static/qq.png"
});
break;
}
}
return data;
}).catch((parmas) => {
return Promise.reject();
});
},
getPaymentProvider: () => {
return common_vendor.index.getProvider({
service: "payment"
}).then((res) => {
let data = [];
const aliPay = {
name: "支付宝支付",
id: "alipay",
icon: "/static/order/zfbp@3x.png"
};
const wxPay = {
name: "微信支付",
id: "wxpay",
icon: "/static/order/wxp@3x.png"
};
const yuePay = {
name: "余额支付",
id: "yepay",
icon: "/static/order/yep@3x.png"
};
for (let i = 0; i < res[1].provider.length; i++) {
switch (res[1].provider[i]) {
case "alipay":
data.push({
...aliPay
});
break;
case "wxpay":
data.push({
...wxPay
});
break;
}
}
return [...data, yuePay];
}).catch((parmas) => {
return Promise.reject();
});
}
};
exports.net = net;

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const common_vendor = require("./common/vendor.js");
if (!Math) {
"./pages/index/index.js";
"./pages/wikipedia/index.js";
"./pages/user/index.js";
}
const _sfc_main = {
onLaunch: function() {
console.log("App Launch");
},
onShow: function() {
console.log("App Show");
},
onHide: function() {
console.log("App Hide");
}
};
const App = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f13b4d11"], ["__file", "F:/项目2023/视力表/vision-record/App.vue"]]);
function createApp() {
const app = common_vendor.createSSRApp(App);
app.use(common_vendor.createPinia());
return {
app
};
}
createApp().app.mount("#app");
exports.createApp = createApp;

@ -0,0 +1,40 @@
{
"pages": [
"pages/index/index",
"pages/wikipedia/index",
"pages/user/index"
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#26758d",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/tabs/home.png",
"selectedIconPath": "static/tabs/home2.png",
"text": "首页"
},
{
"pagePath": "pages/wikipedia/index",
"iconPath": "static/tabs/order.png",
"selectedIconPath": "static/tabs/order2.png",
"text": "百科"
},
{
"pagePath": "pages/user/index",
"iconPath": "static/tabs/user.png",
"selectedIconPath": "static/tabs/user2.png",
"text": "我的"
}
]
},
"usingComponents": {}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -0,0 +1,39 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const _sfc_main = {
__name: "mySwiper",
props: ["lbt_list", "height", "isRadius", "indicatorDots"],
setup(__props) {
const props = __props;
const interval = common_vendor.ref(2e3);
const autoplay = common_vendor.ref(true);
common_vendor.watch(() => {
return props.lbt_list;
}, (val1, val2) => {
});
function lbtFunc(item) {
common_vendor.index.navigateTo({
url: item.url
});
return;
}
return (_ctx, _cache) => {
return {
a: common_vendor.f(__props.lbt_list, (item, i, i0) => {
return {
a: item.image,
b: common_vendor.o(($event) => lbtFunc(item))
};
}),
b: __props.isRadius ? 1 : "",
c: common_vendor.s("height: " + __props.height * 2 + "rpx;"),
d: __props.indicatorDots,
e: autoplay.value,
f: interval.value,
g: _ctx.duration
};
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "F:/项目2023/视力表/vision-record/components/mySwiper.vue"]]);
wx.createComponent(Component);

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

@ -0,0 +1 @@
<view class="swiper-box"><view class="uni-margin-wrap"><swiper class="{{['swiper', b && 'radiuscss']}}" style="{{c}}" circular indicator-dots="{{d}}" autoplay="{{e}}" interval="{{f}}" duration="{{g}}"><swiper-item wx:for="{{a}}" wx:for-item="item" bindtap="{{item.b}}"><view class="swiper-item uni-bg-red"><image src="{{item.a}}" style="width:100%" mode="widthFix"></image></view></swiper-item></swiper></view></view>

@ -0,0 +1,39 @@
.radiuscss{
border-radius:30rpx;
overflow: hidden;
}
.swiper-box{
}
.swiper-item>img{
width: 100%;
}
.uni-margin-wrap {
width: 690rpx;
width: 100%;
}
.swiper {
height: 300rpx;
}
.swiper-item {
display: block;
height: 300rpx;
line-height: 300rpx;
text-align: center;
}
.swiper-list {
margin-top: 40rpx;
margin-bottom: 0;
}
.uni-common-mt {
margin-top: 60rpx;
position: relative;
}
.info {
position: absolute;
right: 20rpx;
}
.uni-padding-wrap {
width: 550rpx;
padding: 0 100rpx;
}

@ -0,0 +1,17 @@
"use strict";
const isdev = true;
const baseUrl = "https://71e86bc1.r15.cpolar.top";
const shareUrl = "https://h5.gwkjxb.com/";
const teacher_admin_url = "http://teacher.gwkjxb.com/#/login";
const config = {
appName: "保护视力",
baseUrl,
appVersion: "1.0.6",
developer: "保护视力",
// appLogo: require('../static/logo.png'),
shareUrl,
teacher_admin_url,
appID: "wx2a050f9a5c87a6dc",
isdev
};
exports.config = config;

@ -0,0 +1,88 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const store_index = require("../../store/index.js");
require("../../api/index.js");
require("../../api/request.js");
require("../../config/index.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
(_easycom_uni_icons2 + _easycom_uni_popup2)();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
(mySwiper + _easycom_uni_icons + _easycom_uni_popup)();
}
const mySwiper = () => "../../components/mySwiper.js";
const _sfc_main = {
__name: "index",
setup(__props) {
const store = store_index.useStore();
common_vendor.onLoad((e) => {
var _a;
if (!((_a = store.userInfo) == null ? void 0 : _a.has_operation))
;
});
const inputDialog = common_vendor.ref();
common_vendor.ref();
common_vendor.ref(false);
const lbt_list = common_vendor.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
}
]);
return (_ctx, _cache) => {
return {
a: common_vendor.p({
indicatorDots: true,
isRadius: true,
height: "160",
lbt_list: lbt_list.value
}),
b: common_vendor.p({
type: "forward",
color: "#ffa2a2",
size: "20"
}),
c: common_vendor.p({
type: "forward",
color: "#f9b275",
size: "20"
}),
d: common_vendor.p({
type: "forward",
color: "#8fdc8a",
size: "20"
}),
e: common_vendor.sr(inputDialog, "1cf27b2a-4", {
"k": "inputDialog"
}),
f: common_vendor.p({
["is-mask-click"]: false
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1cf27b2a"], ["__file", "F:/项目2023/视力表/vision-record/pages/index/index.vue"]]);
wx.createPage(MiniProgramPage);

@ -0,0 +1,8 @@
{
"navigationBarTitleText": "首页",
"usingComponents": {
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
"uni-popup": "../../uni_modules/uni-popup/components/uni-popup/uni-popup",
"my-swiper": "../../components/mySwiper"
}
}

@ -0,0 +1 @@
<view class="content page-box data-v-1cf27b2a"><my-swiper wx:if="{{a}}" class="index-siwper margin-b-card data-v-1cf27b2a" style="width:100%" u-i="1cf27b2a-0" bind:__l="__l" u-p="{{a}}"/><view class="main-cards data-v-1cf27b2a"><view class="mc-part data-v-1cf27b2a" style="margin-left:0"><view class="mc-part-text data-v-1cf27b2a">已完成事项</view><image class="data-v-1cf27b2a" src="/static/done.png" mode="widthFix"></image></view><view class="mc-part mc-part2 data-v-1cf27b2a" style="margin-right:0"><view class="mc-part-text data-v-1cf27b2a">待完成事项</view><image class="data-v-1cf27b2a" style="transform:rotate(0deg)" src="/static/undone.png" mode="widthFix"></image></view></view><view class="attention-card data-v-1cf27b2a"><view class="part-title data-v-1cf27b2a"> 注意事项 </view><view class="ac-parts data-v-1cf27b2a"><view class="ac-part data-v-1cf27b2a" style="background:linear-gradient(45deg, #ffa2a2,#ffd3d3, #ffffff00)"> 术前注意事项 <uni-icons wx:if="{{b}}" class="data-v-1cf27b2a" u-i="1cf27b2a-1" bind:__l="__l" u-p="{{b}}"></uni-icons></view><view class="ac-part data-v-1cf27b2a" style="background:linear-gradient(45deg, #f9b275,#fff3e9, #ffffff00)"> 术中注意事项 <uni-icons wx:if="{{c}}" class="data-v-1cf27b2a" u-i="1cf27b2a-2" bind:__l="__l" u-p="{{c}}"></uni-icons></view><view class="ac-part data-v-1cf27b2a" style="background:linear-gradient(45deg, #8fdc8a,#fdfdfd, #ffffff00)"> 术后注意事项 <uni-icons wx:if="{{d}}" class="data-v-1cf27b2a" u-i="1cf27b2a-3" bind:__l="__l" u-p="{{d}}"></uni-icons></view></view></view><uni-popup wx:if="{{f}}" class="r data-v-1cf27b2a" u-s="{{['d']}}" u-r="inputDialog" u-i="1cf27b2a-4" bind:__l="__l" u-p="{{f}}"><view class="pop-box data-v-1cf27b2a"><view class="pb-title data-v-1cf27b2a">手术信息</view></view><view class="pop-close data-v-1cf27b2a"> 关闭 </view></uni-popup></view>

@ -0,0 +1,110 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.part-title.data-v-1cf27b2a {
border-left: 10rpx solid #fe915d;
padding-left: 20rpx;
font-weight: 900;
}
.attention-card.data-v-1cf27b2a {
margin-top: 20rpx;
width: 100%;
}
.attention-card .ac-parts.data-v-1cf27b2a {
margin-top: 20rpx;
}
.attention-card .ac-parts .ac-part.data-v-1cf27b2a {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 20rpx;
color: white;
margin: 20rpx 0;
}
.main-cards.data-v-1cf27b2a {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
margin-top: 20rpx;
}
.main-cards .mc-part.data-v-1cf27b2a {
width: 50%;
/* text-align: center; */
background: linear-gradient(200deg, #82d8f2, #ddecf0);
color: white;
padding: 40rpx 20rpx;
margin: 0 20rpx;
border-radius: 20rpx;
height: 100rpx;
position: relative;
overflow: hidden;
}
.main-cards .mc-part .mc-part-text.data-v-1cf27b2a {
position: relative;
z-index: 10;
font-size: 36rpx;
font-weight: 900;
}
.main-cards .mc-part image.data-v-1cf27b2a {
position: absolute;
width: 66%;
right: 0;
bottom: -20%;
z-index: 1;
transform: rotate(45deg);
}
.main-cards .mc-part2.data-v-1cf27b2a {
background: linear-gradient(200deg, #bbf4d5, #50c053);
}
.pop-box.data-v-1cf27b2a {
background-color: white;
padding: 20rpx;
}
.page-box.data-v-1cf27b2a {
padding: 20rpx;
}
.content.data-v-1cf27b2a {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo.data-v-1cf27b2a {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area.data-v-1cf27b2a {
display: flex;
justify-content: center;
}
.title.data-v-1cf27b2a {
font-size: 36rpx;
color: #8f8f94;
}

@ -0,0 +1,48 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const store_index = require("../../store/index.js");
const api_index = require("../../api/index.js");
require("../../api/request.js");
require("../../config/index.js");
const _sfc_main = {
__name: "index",
setup(__props) {
store_index.useStore();
function getPhoneNumber(e) {
console.log(e);
getAccess_token({ code: e.detail.code });
}
async function getAccess_token(params = {}) {
const data = {
username: params.code,
//手机号按钮获取的code
type: "wechat_mini_app",
identity: "user",
password: "111"
};
await api_index.API.getToken(data);
wx_login();
}
async function wx_login(token_res) {
let res = await new Promise((resolve) => {
common_vendor.index.login({
provider: "weixin",
//使用微信登录
success: function(loginRes) {
resolve(loginRes);
console.log(loginRes, "微信登录返回信息");
}
});
});
let userId = "";
await api_index.API.wx_login({ code: res.code }, userId);
}
return (_ctx, _cache) => {
return {
a: common_vendor.o(getPhoneNumber)
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "F:/项目2023/视力表/vision-record/pages/user/index.vue"]]);
wx.createPage(MiniProgramPage);

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "我的",
"usingComponents": {}
}

@ -0,0 +1 @@
<view class="user-box page-box"><button class="submit-btn" open-type="getPhoneNumber" bindgetphonenumber="{{a}}"><text>登录</text></button></view>

@ -0,0 +1,8 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {};
function _sfc_render(_ctx, _cache) {
return {};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/项目2023/视力表/vision-record/pages/wikipedia/index.vue"]]);
wx.createPage(MiniProgramPage);

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "百科",
"usingComponents": {}
}

@ -0,0 +1,29 @@
{
"description": "项目配置文件。",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"urlCheck": false,
"es6": true,
"postcss": false,
"minified": false,
"newFeature": true,
"bigPackageSizeSupport": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"compileType": "miniprogram",
"libVersion": "3.1.2",
"appid": "wxaaf66dbb5c3983b3",
"projectname": "vision-record",
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "vision-record",
"setting": {
"compileHotReLoad": true
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

@ -0,0 +1,103 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const api_index = require("../api/index.js");
const useStore = common_vendor.defineStore("main2", {
state: () => {
return {
// 所有这些属性都将自动推断其类型
isLogin: false,
userInfo: null,
access_token: "",
historySearchWords: "",
course_detail_id: 0,
timer: null,
surplus_seconds: null,
// 倒计时
test_time: 0,
//测试用时
test_timer: null,
total_score: 0,
status_bar_height: 0,
debounceTimer: null,
systemInfo: null,
cartList: [],
cartChange: false,
remark_text: "",
address: ""
};
},
actions: {
//应用初始化,在这里获取必要的基础信息
appInit() {
const { statusBarHeight } = common_vendor.index.getSystemInfoSync();
this.status_bar_height = statusBarHeight;
},
countdownFunc(minutes) {
this.surplus_seconds = minutes * 60;
},
saveToken(token) {
common_vendor.index.setStorage({
key: "access_token",
data: token,
success: function() {
console.log("token was saved");
}
});
},
saveVisitState() {
common_vendor.index.setStorage({
key: "visitState",
data: 1,
success: function() {
console.log("visitState was saved");
}
});
},
checkLogin() {
let access_token = common_vendor.index.getStorageSync("access_token");
console.log(access_token);
if (access_token) {
this.access_token = access_token;
this.isLogin = true;
this.getUserInfo();
}
},
async getUserInfo() {
const res = await api_index.API.getUserInfo();
if (res.code == 1) {
this.userInfo = res.data;
common_vendor.index.setStorageSync("userInfo", res.data);
}
},
logout() {
this.userInfo = null;
this.isLogin = false;
common_vendor.index.removeStorageSync("access_token");
common_vendor.index.removeStorageSync("visitState");
},
clearStorageFunc() {
common_vendor.index.removeStorageSync("surplus_seconds");
common_vendor.index.removeStorageSync("test_time");
common_vendor.index.removeStorageSync("saved_right_indexs_storage");
},
toLogin() {
common_vendor.index.navigateTo({
url: "/pages/user/login"
});
},
showMsg(msg, type) {
common_vendor.index.showToast({
title: msg,
icon: type || "none",
duration: 2e3
});
},
async getCartList() {
const res = await api_index.API.getCartList();
if (res.code === 1) {
this.cartList = res.data;
}
}
}
});
exports.useStore = useStore;

@ -0,0 +1,64 @@
"use strict";
const uni_modules_uniIcons_components_uniIcons_icons = require("./icons.js");
const common_vendor = require("../../../../common/vendor.js");
require("../../../../app.js");
const getVal = (val) => {
const reg = /^[0-9]*$/g;
return typeof val === "number" || reg.test(val) ? val + "px" : val;
};
const _sfc_main = {
name: "UniIcons",
emits: ["click"],
props: {
type: {
type: String,
default: ""
},
color: {
type: String,
default: "#333333"
},
size: {
type: [Number, String],
default: 16
},
customPrefix: {
type: String,
default: ""
}
},
data() {
return {
icons: uni_modules_uniIcons_components_uniIcons_icons.icons.glyphs
};
},
computed: {
unicode() {
let code = this.icons.find((v) => v.font_class === this.type);
if (code) {
return unescape(`%u${code.unicode}`);
}
return "";
},
iconSize() {
return getVal(this.size);
}
},
methods: {
_onClick() {
this.$emit("click");
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: $props.color,
b: $options.iconSize,
c: common_vendor.n("uniui-" + $props.type),
d: common_vendor.n($props.customPrefix),
e: common_vendor.n($props.customPrefix ? $props.type : ""),
f: common_vendor.o((...args) => $options._onClick && $options._onClick(...args))
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/项目2023/视力表/vision-record/uni_modules/uni-icons/components/uni-icons/uni-icons.vue"]]);
wx.createComponent(Component);

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

@ -0,0 +1 @@
<text style="{{'color:' + a + ';' + ('font-size:' + b)}}" class="{{['uni-icons', c, d, e]}}" bindtap="{{f}}"></text>

File diff suppressed because one or more lines are too long

@ -0,0 +1,370 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "uniPopup",
components: {},
emits: ["change", "maskClick"],
props: {
// 开启动画
animation: {
type: Boolean,
default: true
},
// 弹出层类型可选值top: 顶部弹出层bottom底部弹出层center全屏弹出层
// message: 消息提示 ; dialog : 对话框
type: {
type: String,
default: "center"
},
// maskClick
isMaskClick: {
type: Boolean,
default: null
},
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
maskClick: {
type: Boolean,
default: null
},
backgroundColor: {
type: String,
default: "none"
},
safeArea: {
type: Boolean,
default: true
},
maskBackgroundColor: {
type: String,
default: "rgba(0, 0, 0, 0.4)"
}
},
watch: {
/**
* 监听type类型
*/
type: {
handler: function(type) {
if (!this.config[type])
return;
this[this.config[type]](true);
},
immediate: true
},
isDesktop: {
handler: function(newVal) {
if (!this.config[newVal])
return;
this[this.config[this.type]](true);
},
immediate: true
},
/**
* 监听遮罩是否可点击
* @param {Object} val
*/
maskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
isMaskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
// H5 下禁止底部滚动
showPopup(show) {
}
},
data() {
return {
duration: 300,
ani: [],
showPopup: false,
showTrans: false,
popupWidth: 0,
popupHeight: 0,
config: {
top: "top",
bottom: "bottom",
center: "center",
left: "left",
right: "right",
message: "top",
dialog: "center",
share: "bottom"
},
maskClass: {
position: "fixed",
bottom: 0,
top: 0,
left: 0,
right: 0,
backgroundColor: "rgba(0, 0, 0, 0.4)"
},
transClass: {
position: "fixed",
left: 0,
right: 0
},
maskShow: true,
mkclick: true,
popupstyle: this.isDesktop ? "fixforpc-top" : "top"
};
},
computed: {
isDesktop() {
return this.popupWidth >= 500 && this.popupHeight >= 500;
},
bg() {
if (this.backgroundColor === "" || this.backgroundColor === "none") {
return "transparent";
}
return this.backgroundColor;
}
},
mounted() {
const fixSize = () => {
const {
windowWidth,
windowHeight,
windowTop,
safeArea,
screenHeight,
safeAreaInsets
} = common_vendor.index.getSystemInfoSync();
this.popupWidth = windowWidth;
this.popupHeight = windowHeight + (windowTop || 0);
if (safeArea && this.safeArea) {
this.safeAreaInsets = screenHeight - safeArea.bottom;
} else {
this.safeAreaInsets = 0;
}
};
fixSize();
},
// TODO vue3
unmounted() {
this.setH5Visible();
},
created() {
if (this.isMaskClick === null && this.maskClick === null) {
this.mkclick = true;
} else {
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
}
if (this.animation) {
this.duration = 300;
} else {
this.duration = 0;
}
this.messageChild = null;
this.clearPropagation = false;
this.maskClass.backgroundColor = this.maskBackgroundColor;
},
methods: {
setH5Visible() {
},
/**
* 公用方法不显示遮罩层
*/
closeMask() {
this.maskShow = false;
},
/**
* 公用方法遮罩层禁止点击
*/
disableMask() {
this.mkclick = false;
},
// TODO nvue 取消冒泡
clear(e) {
e.stopPropagation();
this.clearPropagation = true;
},
open(direction) {
if (this.showPopup) {
return;
}
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
if (!(direction && innerType.indexOf(direction) !== -1)) {
direction = this.type;
}
if (!this.config[direction]) {
console.error("缺少类型:", direction);
return;
}
this[this.config[direction]]();
this.$emit("change", {
show: true,
type: direction
});
},
close(type) {
this.showTrans = false;
this.$emit("change", {
show: false,
type: this.type
});
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.showPopup = false;
}, 300);
},
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
touchstart() {
this.clearPropagation = false;
},
onTap() {
if (this.clearPropagation) {
this.clearPropagation = false;
return;
}
this.$emit("maskClick");
if (!this.mkclick)
return;
this.close();
},
/**
* 顶部弹出样式处理
*/
top(type) {
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
this.ani = ["slide-top"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
backgroundColor: this.bg
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
this.$nextTick(() => {
if (this.messageChild && this.type === "message") {
this.messageChild.timerClose();
}
});
},
/**
* 底部弹出样式处理
*/
bottom(type) {
this.popupstyle = "bottom";
this.ani = ["slide-bottom"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
bottom: 0,
paddingBottom: this.safeAreaInsets + "px",
backgroundColor: this.bg
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
/**
* 中间弹出样式处理
*/
center(type) {
this.popupstyle = "center";
this.ani = ["zoom-out", "fade"];
this.transClass = {
position: "fixed",
display: "flex",
flexDirection: "column",
bottom: 0,
left: 0,
right: 0,
top: 0,
justifyContent: "center",
alignItems: "center"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
left(type) {
this.popupstyle = "left";
this.ani = ["slide-left"];
this.transClass = {
position: "fixed",
left: 0,
bottom: 0,
top: 0,
backgroundColor: this.bg,
display: "flex",
flexDirection: "column"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
right(type) {
this.popupstyle = "right";
this.ani = ["slide-right"];
this.transClass = {
position: "fixed",
bottom: 0,
right: 0,
top: 0,
backgroundColor: this.bg,
display: "flex",
flexDirection: "column"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
}
}
};
if (!Array) {
const _easycom_uni_transition2 = common_vendor.resolveComponent("uni-transition");
_easycom_uni_transition2();
}
const _easycom_uni_transition = () => "../../../uni-transition/components/uni-transition/uni-transition.js";
if (!Math) {
_easycom_uni_transition();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.showPopup
}, $data.showPopup ? common_vendor.e({
b: $data.maskShow
}, $data.maskShow ? {
c: common_vendor.o($options.onTap),
d: common_vendor.p({
name: "mask",
["mode-class"]: "fade",
styles: $data.maskClass,
duration: $data.duration,
show: $data.showTrans
})
} : {}, {
e: $options.bg,
f: common_vendor.n($data.popupstyle),
g: common_vendor.o((...args) => $options.clear && $options.clear(...args)),
h: common_vendor.o($options.onTap),
i: common_vendor.p({
["mode-class"]: $data.ani,
name: "content",
styles: $data.transClass,
duration: $data.duration,
show: $data.showTrans
}),
j: common_vendor.o((...args) => $options.touchstart && $options.touchstart(...args)),
k: common_vendor.n($data.popupstyle),
l: common_vendor.n($options.isDesktop ? "fixforpc-z-index" : "")
}) : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/项目2023/视力表/vision-record/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]);
wx.createComponent(Component);

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"uni-transition": "../../../uni-transition/components/uni-transition/uni-transition"
}
}

@ -0,0 +1 @@
<view wx:if="{{a}}" class="{{['uni-popup', k, l]}}"><view bindtouchstart="{{j}}"><uni-transition wx:if="{{b}}" key="1" bindclick="{{c}}" u-i="70678190-0" bind:__l="__l" u-p="{{d}}"/><uni-transition wx:if="{{i}}" u-s="{{['d']}}" key="2" bindclick="{{h}}" u-i="70678190-1" bind:__l="__l" u-p="{{i}}"><view style="{{'background-color:' + e}}" class="{{['uni-popup__wrapper', f]}}" bindtap="{{g}}"><slot/></view></uni-transition></view></view>

@ -0,0 +1,47 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uni-popup {
position: fixed;
z-index: 99;
}
.uni-popup.top, .uni-popup.left, .uni-popup.right {
top: 0;
}
.uni-popup .uni-popup__wrapper {
display: block;
position: relative;
/* iphonex 等安全区设置,底部安全区适配 */
}
.uni-popup .uni-popup__wrapper.left, .uni-popup .uni-popup__wrapper.right {
padding-top: 0;
flex: 1;
}
.fixforpc-z-index {
z-index: 999;
}
.fixforpc-top {
top: 0;
}

@ -0,0 +1,115 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
class MPAnimation {
constructor(options, _this) {
this.options = options;
this.animation = common_vendor.index.createAnimation({
...options
});
this.currentStepAnimates = {};
this.next = 0;
this.$ = _this;
}
_nvuePushAnimates(type, args) {
let aniObj = this.currentStepAnimates[this.next];
let styles = {};
if (!aniObj) {
styles = {
styles: {},
config: {}
};
} else {
styles = aniObj;
}
if (animateTypes1.includes(type)) {
if (!styles.styles.transform) {
styles.styles.transform = "";
}
let unit = "";
if (type === "rotate") {
unit = "deg";
}
styles.styles.transform += `${type}(${args + unit}) `;
} else {
styles.styles[type] = `${args}`;
}
this.currentStepAnimates[this.next] = styles;
}
_animateRun(styles = {}, config = {}) {
let ref = this.$.$refs["ani"].ref;
if (!ref)
return;
return new Promise((resolve, reject) => {
nvueAnimation.transition(ref, {
styles,
...config
}, (res) => {
resolve();
});
});
}
_nvueNextAnimate(animates, step = 0, fn) {
let obj = animates[step];
if (obj) {
let {
styles,
config
} = obj;
this._animateRun(styles, config).then(() => {
step += 1;
this._nvueNextAnimate(animates, step, fn);
});
} else {
this.currentStepAnimates = {};
typeof fn === "function" && fn();
this.isEnd = true;
}
}
step(config = {}) {
this.animation.step(config);
return this;
}
run(fn) {
this.$.animationData = this.animation.export();
this.$.timer = setTimeout(() => {
typeof fn === "function" && fn();
}, this.$.durationTime);
}
}
const animateTypes1 = [
"matrix",
"matrix3d",
"rotate",
"rotate3d",
"rotateX",
"rotateY",
"rotateZ",
"scale",
"scale3d",
"scaleX",
"scaleY",
"scaleZ",
"skew",
"skewX",
"skewY",
"translate",
"translate3d",
"translateX",
"translateY",
"translateZ"
];
const animateTypes2 = ["opacity", "backgroundColor"];
const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
MPAnimation.prototype[type] = function(...args) {
this.animation[type](...args);
return this;
};
});
function createAnimation(option, _this) {
if (!_this)
return;
clearTimeout(_this.timer);
return new MPAnimation(option, _this);
}
exports.createAnimation = createAnimation;

@ -0,0 +1,265 @@
"use strict";
const uni_modules_uniTransition_components_uniTransition_createAnimation = require("./createAnimation.js");
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "uniTransition",
emits: ["click", "change"],
props: {
show: {
type: Boolean,
default: false
},
modeClass: {
type: [Array, String],
default() {
return "fade";
}
},
duration: {
type: Number,
default: 300
},
styles: {
type: Object,
default() {
return {};
}
},
customClass: {
type: String,
default: ""
},
onceRender: {
type: Boolean,
default: false
}
},
data() {
return {
isShow: false,
transform: "",
opacity: 1,
animationData: {},
durationTime: 300,
config: {}
};
},
watch: {
show: {
handler(newVal) {
if (newVal) {
this.open();
} else {
if (this.isShow) {
this.close();
}
}
},
immediate: true
}
},
computed: {
// 生成样式数据
stylesObject() {
let styles = {
...this.styles,
"transition-duration": this.duration / 1e3 + "s"
};
let transform = "";
for (let i in styles) {
let line = this.toLine(i);
transform += line + ":" + styles[i] + ";";
}
return transform;
},
// 初始化动画条件
transformStyles() {
return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
}
},
created() {
this.config = {
duration: this.duration,
timingFunction: "ease",
transformOrigin: "50% 50%",
delay: 0
};
this.durationTime = this.duration;
},
methods: {
/**
* ref 触发 初始化动画
*/
init(obj = {}) {
if (obj.duration) {
this.durationTime = obj.duration;
}
this.animation = uni_modules_uniTransition_components_uniTransition_createAnimation.createAnimation(Object.assign(this.config, obj), this);
},
/**
* 点击组件触发回调
*/
onClick() {
this.$emit("click", {
detail: this.isShow
});
},
/**
* ref 触发 动画分组
* @param {Object} obj
*/
step(obj, config = {}) {
if (!this.animation)
return;
for (let i in obj) {
try {
if (typeof obj[i] === "object") {
this.animation[i](...obj[i]);
} else {
this.animation[i](obj[i]);
}
} catch (e) {
console.error(`方法 ${i} 不存在`);
}
}
this.animation.step(config);
return this;
},
/**
* ref 触发 执行动画
*/
run(fn) {
if (!this.animation)
return;
this.animation.run(fn);
},
// 开始过度动画
open() {
clearTimeout(this.timer);
this.transform = "";
this.isShow = true;
let { opacity, transform } = this.styleInit(false);
if (typeof opacity !== "undefined") {
this.opacity = opacity;
}
this.transform = transform;
this.$nextTick(() => {
this.timer = setTimeout(() => {
this.animation = uni_modules_uniTransition_components_uniTransition_createAnimation.createAnimation(this.config, this);
this.tranfromInit(false).step();
this.animation.run();
this.$emit("change", {
detail: this.isShow
});
}, 20);
});
},
// 关闭过度动画
close(type) {
if (!this.animation)
return;
this.tranfromInit(true).step().run(() => {
this.isShow = false;
this.animationData = null;
this.animation = null;
let { opacity, transform } = this.styleInit(false);
this.opacity = opacity || 1;
this.transform = transform;
this.$emit("change", {
detail: this.isShow
});
});
},
// 处理动画开始前的默认样式
styleInit(type) {
let styles = {
transform: ""
};
let buildStyle = (type2, mode) => {
if (mode === "fade") {
styles.opacity = this.animationType(type2)[mode];
} else {
styles.transform += this.animationType(type2)[mode] + " ";
}
};
if (typeof this.modeClass === "string") {
buildStyle(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildStyle(type, mode);
});
}
return styles;
},
// 处理内置组合动画
tranfromInit(type) {
let buildTranfrom = (type2, mode) => {
let aniNum = null;
if (mode === "fade") {
aniNum = type2 ? 0 : 1;
} else {
aniNum = type2 ? "-100%" : "0";
if (mode === "zoom-in") {
aniNum = type2 ? 0.8 : 1;
}
if (mode === "zoom-out") {
aniNum = type2 ? 1.2 : 1;
}
if (mode === "slide-right") {
aniNum = type2 ? "100%" : "0";
}
if (mode === "slide-bottom") {
aniNum = type2 ? "100%" : "0";
}
}
this.animation[this.animationMode()[mode]](aniNum);
};
if (typeof this.modeClass === "string") {
buildTranfrom(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildTranfrom(type, mode);
});
}
return this.animation;
},
animationType(type) {
return {
fade: type ? 1 : 0,
"slide-top": `translateY(${type ? "0" : "-100%"})`,
"slide-right": `translateX(${type ? "0" : "100%"})`,
"slide-bottom": `translateY(${type ? "0" : "100%"})`,
"slide-left": `translateX(${type ? "0" : "-100%"})`,
"zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
"zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
};
},
// 内置动画类型与实际动画对应字典
animationMode() {
return {
fade: "opacity",
"slide-top": "translateY",
"slide-right": "translateX",
"slide-bottom": "translateY",
"slide-left": "translateX",
"zoom-in": "scale",
"zoom-out": "scale"
};
},
// 驼峰转中横线
toLine(name) {
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: $data.isShow,
b: $data.animationData,
c: common_vendor.n($props.customClass),
d: common_vendor.s($options.transformStyles),
e: common_vendor.o((...args) => $options.onClick && $options.onClick(...args))
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/项目2023/视力表/vision-record/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]);
wx.createComponent(Component);

@ -0,0 +1 @@
<view hidden="{{!a}}" ref="ani" animation="{{b}}" class="{{c}}" style="{{d}}" bindtap="{{e}}"><slot></slot></view>
Loading…
Cancel
Save