diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61789f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +yarn.lock + +uni_modules +node_modules +dist +unpackage +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# node_modules +node_modules +package-lock.json +package-lock.json +components.d.ts diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json new file mode 100644 index 0000000..582561b --- /dev/null +++ b/.hbuilderx/launch.json @@ -0,0 +1,16 @@ +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version": "0.0", + "configurations": [{ + "app-plus" : + { + "launchtype" : "local" + }, + "default" : + { + "launchtype" : "local" + }, + "type" : "uniCloud" + } + ] +} diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..e228c5e --- /dev/null +++ b/App.vue @@ -0,0 +1,29 @@ + + + \ No newline at end of file diff --git a/api/api.js b/api/api.js new file mode 100644 index 0000000..1406270 --- /dev/null +++ b/api/api.js @@ -0,0 +1,163 @@ +import {request} from '@/utils/request.js' +const api = { + wxLogin(data) { + return request('/login/wechat_mobile_login', data, 'post', true); + }, + mobileLogin(data) { + return request('/login/mobile_login', data, 'post', true); + }, + getCode(data) { + return request('/code/phone', data, 'post', true); + }, + + getHomeData(data) { //首页数据 + return request('/index', data, 'get', true); + }, + getClassify(id) { //获取分类详情 + return request('/class/' + id, {}, 'get', true); + }, + getClassifyList() { //获取分类详情 + return request('/class/list', {}, 'get', false); + }, + getQuestionPage(data) { //获取问题列表-分页 + return request('/question/page', data, 'post', true, 'application/json'); + }, + getQuestionDetail(id,data) { //获取问题详情 + return request('/question/'+id, data, 'get', false); + }, + collect(data) { + return request('/collection/question', data, 'post', false, 'application/json'); + }, + cancelCollect(data) { + return request('/collection/question/cancel', data, 'put', false, 'application/json'); + }, + getHotList() { //获取问题详情 + return request('/question/hot', {}, 'get', true); + }, + getQuestionStatus(id) { //获取问题解锁状态 + return request('/question/unlock/status/' + id, {}, 'get', true); + }, + getQuestionCoupon(data) { //获取患者可使用优惠卷-单项 + return request('/coupon/usable/question', data, 'get', true); + }, + getVipCoupon(data) { //获取会员可使用优惠卷-单项 + return request('/coupon/usable/member', data, 'get', true); + }, + getVipPrice() { //获取会员配置数据 + return request('/member', {}, 'get', false); + }, + getRecentList() { + return request('/order/member/recent/list', {}, 'get', false); + }, + getUserInfo() { + return request('/user', {}, 'get', true); + }, + getUnnotifyCoupon() { //获取还未弹窗的优惠卷 + return request('/coupon/unnotified', {}, 'get', false); + }, + getLeast() { //获取最少立减金额 + return request('/member/least', {}, 'get', false); + }, + getItemList(data) { //获取单项订单列表-分页 + return request('/order/single/page', data, 'get', true); + }, + getVipList(data) { //获取会员订单列表-分页 + return request('/order/member/page', data, 'get', true); + }, + createItemOrder(data) { //创建单项订单 + return request('/order/single', data, 'post', true); + }, + createVipOrder(data) { //创建会员订单 + return request('/order/member', data, 'post', true); + }, + cancelItemOrder(id) { + return request('/order/single/cancel/' + id, {}, 'put', false); + }, + getItemPayData(data, id) { + return request('/order/single/pay/' + id, data, 'get', true); + + }, + getWxConfig(url, data) { + return request(url, data, 'get', false); + }, + getCollectList(data) { //获取用户收藏题目列表-分页 + return request('/collection/question', data, 'get', true); + }, + getFuliList(data) { //获取用户收藏题目列表-分页 + return request('/coupon', data, 'get', true); + }, + addClickCount(id) { //增加问题点击次数(点击进入详情页的人次 + return request('/question/click/' + id, {}, 'put', false); + }, + addSubmitCount(id) { //增加问题提交次数(提交个人信息进行了算算的人次) + return request('/question/click/submit/' + id, {}, 'put', false); + }, + checkUser(data) { //检测用户数据绑定状态 + return request('/user/check', data, 'GET', false); + }, + getBasic(data) { + return request('/user/info', data, 'GET', true); + }, + updateBasic(data) { + return request('/user', data, 'PUT', true,'application/json'); + }, + getCase(data) { + return request('/user/case', data, 'GET', true); + }, + updateCase(data) { + return request('/user/case', data, 'PUT', true,'application/json'); + }, + getArea(data) { + return request('/area/list', data, 'GET', false); + }, + getDiseaseList(data) { + return request('/disease/list', data, 'GET', false); + }, + getNation(data) { + return request('/nation/list', data, 'GET', false); + }, + getOssSign(data) { + return request('/sign/oss', data, 'GET', false); + }, + ossUpload(url,data){ + return request(url,data,'post',false,'multipart/form-data') + }, + checkItemPaySatus(id) { + return request('/order/single/pay/status/'+id, {}, 'GET', false); + }, + checkVipPaySatus(id) { + return request('/order/member/pay/status/'+id, {}, 'GET', false); + }, + saveAnswer(data,id){//保存单项答案 + return request('/order/single/answer/'+id, data, 'post', false); + }, + getAnswer(id){//获取单项答案 + return request('/order/single/answer/'+id, {}, 'get', false); + }, + getSearchRecommend(){//搜索推荐 + return request('/class/recommend/list', {}, 'get', false); + }, + changeCoupon(){ + return request('/coupon/unnotified', {}, 'put', false); + }, + delVipOrder(id){ + return request('/order/member/'+id, {}, 'DELETE', false); + }, + delItemOrder(id){ + return request('/order/single/'+id, {}, 'DELETE', false); + }, + shareSign(data){ + return request('https://dev-app.igandan.com/app/manager/getSignature4bing', data, 'get', false); + }, + getLikeList(){//搜索推荐 + return request('question/like', {}, 'get', false); + }, + getData(){ + return request('https://www.fastmock.site/mock/32012a46e9f66a6180214eef5edc79ac/mydata/promote', {}, 'get', false); + + } + + + +}; +export default api \ No newline at end of file diff --git a/components/list/list.vue b/components/list/list.vue new file mode 100644 index 0000000..fb66f93 --- /dev/null +++ b/components/list/list.vue @@ -0,0 +1,59 @@ + + + \ No newline at end of file diff --git a/components/tabBar/tabBar.vue b/components/tabBar/tabBar.vue new file mode 100644 index 0000000..a0e1903 --- /dev/null +++ b/components/tabBar/tabBar.vue @@ -0,0 +1,38 @@ + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..c3ff205 --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + + + + + + + +
+ + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..0089a35 --- /dev/null +++ b/main.js @@ -0,0 +1,37 @@ +import App from './App' +import uviewPlus, { setConfig } from 'uview-plus' +// #ifndef VUE3 +console.log(222) +import Vue from 'vue' +import './uni.promisify.adaptor' +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +// #endif + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + app.use(uviewPlus, () => { + return { + options: { + // 修改$u.config对象的属性 + config: { + // 修改默认单位为rpx,相当于执行 uni.$u.config.unit = 'rpx' + unit: 'rpx' + } + } + } + }) + console.log(uni.$u.config.v); + return { + app + } +} +// #endif +console.log(1111) +console.log(process.env.NODE_ENV) \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..90c824a --- /dev/null +++ b/manifest.json @@ -0,0 +1,86 @@ +{ + "name" : "caseDataBase", + "appid" : "__UNI__C5266FA", + "description" : "", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + /* 5+App特有相关 */ + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "compatible" : { + "ignoreVersion" : true, + "runtimeVersion" : "4.45,4.24,4.18", + "compilerVersion" : "4.57" + }, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + /* 模块配置 */ + "modules" : {}, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios" : {}, + /* SDK配置 */ + "sdkConfigs" : {} + } + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "", + "setting" : { + "urlCheck" : false + }, + "usingComponents" : true + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "vueVersion" : "3", + "h5" : { + "router" : { + "mode" : "history", + "base" : "" + }, + "devServer" : { + "https" : false + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..439edd5 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "casedatabase", + "version": "1.0.0", + "description": "", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "uview-plus": "^3.4.4" + } +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..9660a7b --- /dev/null +++ b/pages.json @@ -0,0 +1,67 @@ +{ + "easycom": { + "autoscan": true, + // 注意一定要放在custom里,否则无效,https://ask.dcloud.net.cn/question/131175 + "custom": { + "^u--(.*)": "@/node_modules/uview-plus/components/u-$1/u-$1.vue", + "^up-(.*)": "@/node_modules/uview-plus/components/u-$1/u-$1.vue", + "^u-([^-].*)": "@/node_modules/uview-plus/components/u-$1/u-$1.vue" + + } + }, + "pages": [ + //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录" + } + }, + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "uni-app", + "enablePullDownRefresh":false + } + }, + { + "path": "pages/case/case", + "style": { + "navigationBarTitleText": "互动病例" + } + }, + + { + "path": "pages/apply/apply", + "style": { + "navigationBarTitleText": "注册", + "enablePullDownRefresh": false, + "disableScroll": true + } + }, + { + "path": "pages/register/register", + "style": { + "navigationBarTitleText": "注册" + } + } + ], + "subPackages": [{ + "root": "pages_case", + "pages": [{ + "path": "index/index", + "style": { + "navigationBarTitleText": "uni-app分页" + } + }] + }], + + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "uniIdRouter": {} + } \ No newline at end of file diff --git a/pages/apply/apply.vue b/pages/apply/apply.vue new file mode 100644 index 0000000..e66fcb4 --- /dev/null +++ b/pages/apply/apply.vue @@ -0,0 +1,225 @@ + + + + + \ No newline at end of file diff --git a/pages/case/case.vue b/pages/case/case.vue new file mode 100644 index 0000000..ed157a2 --- /dev/null +++ b/pages/case/case.vue @@ -0,0 +1,34 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue new file mode 100644 index 0000000..47d0a13 --- /dev/null +++ b/pages/index/index.vue @@ -0,0 +1,89 @@ + + + \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue new file mode 100644 index 0000000..7ecf754 --- /dev/null +++ b/pages/login/login.vue @@ -0,0 +1,322 @@ + + + + + \ No newline at end of file diff --git a/pages/register/register.vue b/pages/register/register.vue new file mode 100644 index 0000000..a50bac6 --- /dev/null +++ b/pages/register/register.vue @@ -0,0 +1,227 @@ + + + + + \ No newline at end of file diff --git a/pages_case/index/index.vue b/pages_case/index/index.vue new file mode 100644 index 0000000..80609d7 --- /dev/null +++ b/pages_case/index/index.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/static/default.png b/static/default.png new file mode 100644 index 0000000..613fbd6 Binary files /dev/null and b/static/default.png differ diff --git a/static/logo.png b/static/logo.png new file mode 100644 index 0000000..b5771e2 Binary files /dev/null and b/static/logo.png differ diff --git a/uni.promisify.adaptor.js b/uni.promisify.adaptor.js new file mode 100644 index 0000000..47fbce1 --- /dev/null +++ b/uni.promisify.adaptor.js @@ -0,0 +1,10 @@ +uni.addInterceptor({ + returnValue (res) { + if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) { + return res; + } + return new Promise((resolve, reject) => { + res.then((res) => res[0] ? reject(res[0]) : resolve(res[1])); + }); + }, +}); \ No newline at end of file diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..041d6b3 --- /dev/null +++ b/uni.scss @@ -0,0 +1,77 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ +@import 'uview-plus/theme.scss'; + +/* 颜色变量 */ + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 文字基本颜色 */ +$uni-text-color:#333;//基本色 +$uni-text-color-inverse:#fff;//反色 +$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable:#c0c0c0; + +/* 背景颜色 */ +$uni-bg-color:#ffffff; +$uni-bg-color-grey:#f8f8f8; +$uni-bg-color-hover:#f1f1f1;//点击状态颜色 +$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 + +/* 边框颜色 */ +$uni-border-color:#c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm:12px; +$uni-font-size-base:14px; +$uni-font-size-lg:16px; + +/* 图片尺寸 */ +$uni-img-size-sm:20px; +$uni-img-size-base:26px; +$uni-img-size-lg:40px; + +/* Border Radius */ +$uni-border-radius-sm: 2px; +$uni-border-radius-base: 3px; +$uni-border-radius-lg: 6px; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 5px; +$uni-spacing-row-base: 10px; +$uni-spacing-row-lg: 15px; + +/* 垂直间距 */ +$uni-spacing-col-sm: 4px; +$uni-spacing-col-base: 8px; +$uni-spacing-col-lg: 12px; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2C405A; // 文章标题颜色 +$uni-font-size-title:20px; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle:26px; +$uni-color-paragraph: #3F536E; // 文章段落颜色 +$uni-font-size-paragraph:15px; diff --git a/utils/auth.js b/utils/auth.js new file mode 100644 index 0000000..05bcdb9 --- /dev/null +++ b/utils/auth.js @@ -0,0 +1,22 @@ +function auth(){ //鉴权 + return new Promise((resolve,reject)=>{ + uni.login({ + provider: 'weixin', //使用微信登录 + onlyAuthorize: true, //不弹出授权页面,直接进入微信登录流程 + success(res){ + if(res.errMsg=="login:ok"){ + resolve(res.code) + }else{ + uni.showToast({ + title:res.errMsg, + icon:'error' + }) + } + }, + fail(err){ + reject(err) + } + }) + }) + } + export default auth \ No newline at end of file diff --git a/utils/config.js b/utils/config.js new file mode 100644 index 0000000..fc997ef --- /dev/null +++ b/utils/config.js @@ -0,0 +1,7 @@ +let BASE_URL='' +if(process.env.NODE_ENV=='production'){ + BASE_URL='1111111' +}else{ + BASE_URL='22222222' +} +export default BASE_URL \ No newline at end of file diff --git a/utils/navTo.js b/utils/navTo.js new file mode 100644 index 0000000..25c4831 --- /dev/null +++ b/utils/navTo.js @@ -0,0 +1,22 @@ +import pageUrl from './pageUrl' +function navTo(obj){ + // let token=''; + // if(process.env.NODE_ENV === 'development'){ + // token = uni.getStorageSync('DEV_AUTH_TOKEN_FIGURE'); + // }else{ + // token = uni.getStorageSync('AUTH_TOKEN_FIGURE'); + // } + // if(!token){ + // let page_url=pageUrl(); + // uni.setStorageSync('redirectUrl',page_url); + // uni.navigateTo({ + // url: '/pages/login/login?redirectUrl=has' + // }); + // }else{ + // uni.navigateTo(obj) + // } + uni.navigateTo(obj) + +} + +export default navTo \ No newline at end of file diff --git a/utils/pageUrl.js b/utils/pageUrl.js new file mode 100644 index 0000000..1127538 --- /dev/null +++ b/utils/pageUrl.js @@ -0,0 +1,19 @@ +function pageUrl(){ + // 获取当前页面的实例 + const pages = getCurrentPages(); + const currentPage = pages[pages.length - 1]; + + // 获取页面的完整URL + const url = currentPage.route; // 页面路径 + const options = currentPage.options; // 如果有查询参数,将会在这里 + + // 拼接URL + let fullUrl = url + '?'; + for (let key in options) { + fullUrl += `${key}=${options[key]}&`; + } + fullUrl = fullUrl.substring(0, fullUrl.length - 1); // 移除最后一个"&" + + return fullUrl +} +export default pageUrl \ No newline at end of file diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..eca3566 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,119 @@ +/** + * @Method Description + * @Author: zjd@ + * @Description: 数据请求整合 处理 + * @BASE_URL server + * @param {a===Object||file} 传给后台参数Method 请求方法 url 所请求的接口路径 + * @return Promise对象 所有数据信息 + * @createTime: 2024-7-22 15:05:06 + */ +import BASE_URL from "./config.js"; +//import host from "@/utils/host"; +//import {msg} from "./util.js" +import pageUrl from './pageUrl' +//alert(BASE_URL) +//const BASE_URL=host+"/api" +export const request = (url, data = {}, method = 'post',loading = false,contentType='application/x-www-form-urlencoded') => { + if(loading){ + uni.showLoading({ + title: '加载中', + mask:true + }) + + }; + uni.setStorageSync('DEV_AUTH_TOKEN_FIGURE','eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMTgzMzQzMjEwMTI3ODQ1Mzc2MCIsImV4cCI6MTc0MzEzMTY2OCwibmJmIjoxNzQyODcyNDY4LCJpYXQiOjE3NDI4NzI0Njh9.RGsdwvwck8oDNbStbMA18i5VOmy9JbK68hLNILDGUMQ'); + let token=''; + if(process.env.NODE_ENV === 'development'){ + token = uni.getStorageSync('DEV_AUTH_TOKEN_FIGURE'); + }else{ + token = uni.getStorageSync('AUTH_TOKEN_FIGURE'); + } + // if(!token){ + // let freeList=['/login','/code/phone','/login/wx','/index','/user/check']; + // if(freeList.indexOf(url) == -1){ + // let page_url=pageUrl(); + // if(page_url.indexOf('/login/login')==-1){ + + // uni.setStorageSync('redirectUrl',page_url); + // uni.navigateTo({ + // url: '/pages/login/login?redirectUrl=has' + // }); + // return false; + // }else{ + + + // uni.setStorageSync('redirectUrl',''); + // uni.navigateTo({ + // url: '/pages/login/login' + // }); + // return false; + // } + + // } + // } + let header = { + 'content-type':contentType , + 'Authorization': 'Bearer ' + token + } + return new Promise(function(e, n) { + let timestamp = Date.now(); + uni.request({ + data, + url: url.indexOf('http')!=-1?url:encodeURI(BASE_URL+url+"?timestamp="+timestamp), + method: method, + sslVerify:false, + header:url.indexOf('/manager/getSignature4bing')==-1?header:{}, + timeout:10000, + success: function(res) { + var Authorization_token = res.header.Authorization; + if(Authorization_token){ + if(process.env.NODE_ENV === 'development'){ + uni.setStorageSync('DEV_AUTH_TOKEN_FIGURE', Authorization_token); + }else{ + uni.setStorageSync('AUTH_TOKEN_FIGURE', Authorization_token); + } + + } + if(loading){ + uni.hideLoading(); + }; + if(res.data.code==200){ + e(res) + }else if(res.data.code==401 || res.data.code==403 || res.data.code==405 || res.data.code==406){ + var u=navigator.userAgent; + let isApp=Boolean(u.match(/Gdxz/ig)); + if(isApp){ + uni.navigateTo({ + url: '/pages/index/index' + }); + }else{ + let freeList=['/login','/code/phone','/login/wx','/index','/user/check']; + if(freeList.indexOf(url) == -1){ + + let page_url=pageUrl(); + uni.setStorageSync('redirectUrl',page_url); + uni.navigateTo({ + url: '/pages/login/login?redirectUrl=has' + }); + return false + } + } + + }else if(res.data.code==500){ + n(res) + }else{ + uni.showToast({ + title:res.data.message, + icon:'none', + + }) + n(res) + } + }, + fail: function(err) { + "request:fail " === err.errMsg && msg("请求数据失败!"), n(err.data); + } + }); + }); +} +