From 7af87512eb9b34f04f6d7a53c7b3d83de202d7a7 Mon Sep 17 00:00:00 2001 From: zoujiandong <10130823232@qq.com> Date: Fri, 11 Apr 2025 10:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 34 ++++ .hbuilderx/launch.json | 16 ++ App.vue | 29 ++++ api/api.js | 163 ++++++++++++++++++ components/list/list.vue | 59 +++++++ components/tabBar/tabBar.vue | 38 +++++ index.html | 20 +++ main.js | 37 ++++ manifest.json | 86 ++++++++++ package.json | 15 ++ pages.json | 67 ++++++++ pages/apply/apply.vue | 225 ++++++++++++++++++++++++ pages/case/case.vue | 34 ++++ pages/index/index.vue | 89 ++++++++++ pages/login/login.vue | 322 +++++++++++++++++++++++++++++++++++ pages/register/register.vue | 227 ++++++++++++++++++++++++ pages_case/index/index.vue | 60 +++++++ static/default.png | Bin 0 -> 2003 bytes static/logo.png | Bin 0 -> 4023 bytes uni.promisify.adaptor.js | 10 ++ uni.scss | 77 +++++++++ utils/auth.js | 22 +++ utils/config.js | 7 + utils/navTo.js | 22 +++ utils/pageUrl.js | 19 +++ utils/request.js | 119 +++++++++++++ 26 files changed, 1797 insertions(+) create mode 100644 .gitignore create mode 100644 .hbuilderx/launch.json create mode 100644 App.vue create mode 100644 api/api.js create mode 100644 components/list/list.vue create mode 100644 components/tabBar/tabBar.vue create mode 100644 index.html create mode 100644 main.js create mode 100644 manifest.json create mode 100644 package.json create mode 100644 pages.json create mode 100644 pages/apply/apply.vue create mode 100644 pages/case/case.vue create mode 100644 pages/index/index.vue create mode 100644 pages/login/login.vue create mode 100644 pages/register/register.vue create mode 100644 pages_case/index/index.vue create mode 100644 static/default.png create mode 100644 static/logo.png create mode 100644 uni.promisify.adaptor.js create mode 100644 uni.scss create mode 100644 utils/auth.js create mode 100644 utils/config.js create mode 100644 utils/navTo.js create mode 100644 utils/pageUrl.js create mode 100644 utils/request.js 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 0000000000000000000000000000000000000000..613fbd62ae3b56a8c7b1c0c5f36d10cbbe5bc2ac GIT binary patch literal 2003 zcmaJ?X;f2Z8V(Y0SmM&5h|1tKmLf#R9!MmTl@cL{Nh}}?hmhQa8%%CYZX_%fff+@s z4iW^BMT%*)OsyMID-(JK(2>YC5!_}h4uw%hJ-C1vJJ?Gx<``+_D&-=W~ zckbS##7}VEE4(on3{Dg$kf5s!eHp*;M8B!Y?d9mQ91*4TH^>RfHhyYoj8q%@x6Ky}> z0Z7TlC)33wv7QfRLvi^AP@118Q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SCNx89m_ { + 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); + } + }); + }); +} +