dsd
This commit is contained in:
parent
1eceec1dc6
commit
8b950b516b
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
||||
@ -11,7 +11,7 @@ function request(url, method = 'GET', data = {}) {
|
||||
// 获取token,有就丢进请求头
|
||||
const tokenString = wx.getStorageSync('access_token');
|
||||
if (tokenString) {
|
||||
header.Authorization = `Bearer ${tokenString}`;
|
||||
header.Authorization = `${tokenString}`;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
@ -22,18 +22,30 @@ function request(url, method = 'GET', data = {}) {
|
||||
header,
|
||||
success(res) {
|
||||
setTimeout(() => {
|
||||
// HTTP状态码为200才视为成功
|
||||
if (res.code === 200) {
|
||||
resolve(res);
|
||||
console.log(res)
|
||||
if(res.data.code && res.data.code == 10103){
|
||||
wx.removeStorageSync('access_token');
|
||||
wx.switchTab({
|
||||
url: '/pages/my/index',
|
||||
})
|
||||
reject(err);
|
||||
} else {
|
||||
// wx.request的特性,只要有响应就会走success回调,所以在这里判断状态,非200的均视为请求失败
|
||||
reject(res);
|
||||
resolve(res.data);
|
||||
}
|
||||
// // HTTP状态码为200才视为成功
|
||||
// if (res.code === 200) {
|
||||
// resolve(res);
|
||||
// } else {
|
||||
// // wx.request的特性,只要有响应就会走success回调,所以在这里判断状态,非200的均视为请求失败
|
||||
// reject(res);
|
||||
// }
|
||||
}, delay);
|
||||
},
|
||||
fail(err) {
|
||||
setTimeout(() => {
|
||||
console.log(err)
|
||||
// 断网、服务器挂了都会fail回调,直接reject即可
|
||||
|
||||
reject(err);
|
||||
}, delay);
|
||||
},
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import WxCanvas from './wx-canvas';
|
||||
import * as echarts from './echarts';
|
||||
import * as echarts from './echarts.min';
|
||||
|
||||
let ctx;
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
ec-canvas/echarts.min.js
vendored
Normal file
1
ec-canvas/echarts.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7365
miniprogram_npm/crypto-js/index.js
Normal file
7365
miniprogram_npm/crypto-js/index.js
Normal file
File diff suppressed because it is too large
Load Diff
1
miniprogram_npm/crypto-js/index.js.map
Normal file
1
miniprogram_npm/crypto-js/index.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -262,7 +262,7 @@
|
||||
}
|
||||
],
|
||||
"externalClasses": ["t-class", "t-class-content", "t-class-count"],
|
||||
"tpl": "<t-badge content=\"随访\" dot />",
|
||||
"tpl": "<t-badge content=\"消息\" dot />",
|
||||
"path": "./badge/badge"
|
||||
},
|
||||
"t-button": {
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
color: var(--td-tab-bar-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
|
||||
}
|
||||
.t-tab-bar-item__content--checked {
|
||||
color: var(--td-tab-bar-active-color, var(--td-brand-color, var(--td-primary-color-7, #0091cc)));
|
||||
color: var(--td-tab-bar-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
|
||||
font-weight: 600;
|
||||
}
|
||||
.t-tab-bar-item__content--tag {
|
||||
|
||||
@ -4,7 +4,7 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport
|
||||
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
|
||||
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
|
||||
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
|
||||
__DEFINE__(1740983753194, function(require, module, exports) {
|
||||
__DEFINE__(1749049356912, function(require, module, exports) {
|
||||
// This file is autogenerated. It's used to publish CJS to npm.
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
@ -1195,7 +1195,7 @@ __DEFINE__(1740983753194, function(require, module, exports) {
|
||||
}));
|
||||
|
||||
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
|
||||
return __REQUIRE__(1740983753194);
|
||||
return __REQUIRE__(1749049356912);
|
||||
})()
|
||||
//miniprogram-npm-outsideDeps=[]
|
||||
//# sourceMappingURL=index.js.map
|
||||
11
package-lock.json
generated
11
package-lock.json
generated
@ -9,6 +9,7 @@
|
||||
"version": "0.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.2.0",
|
||||
"tdesign-miniprogram": "^1.8.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -546,6 +547,11 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/crypto-js": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.9",
|
||||
"license": "MIT"
|
||||
@ -3462,6 +3468,11 @@
|
||||
"which": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"crypto-js": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
|
||||
},
|
||||
"dayjs": {
|
||||
"version": "1.11.9"
|
||||
},
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
"license": "MIT",
|
||||
"description": "a start-kit for wechat miniprogram powerby TDesign miniprogram",
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.2.0",
|
||||
"tdesign-miniprogram": "^1.8.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// pages/article/index.js
|
||||
import request from '~/api/request';
|
||||
Page({
|
||||
|
||||
/**
|
||||
@ -12,14 +13,18 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
this.getList()
|
||||
},
|
||||
|
||||
|
||||
async getList(){
|
||||
const res = await request('patient/articles', 'get', { title: '', page: 1, page_size: 10 });
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<!--pages/article/index.wxml-->
|
||||
<view class="rich">
|
||||
|
||||
<rich-text nodes=""></rich-text>
|
||||
|
||||
</view>
|
||||
@ -1,4 +1,4 @@
|
||||
import * as echarts from '../../ec-canvas/echarts';
|
||||
import * as echarts from '../../ec-canvas/echarts.min';
|
||||
|
||||
const app = getApp();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import request from '~/api/request';
|
||||
|
||||
const { md5Encrypt } = require('../../utils/encrypt');
|
||||
Page({
|
||||
data: {
|
||||
phoneNumber: '',
|
||||
@ -67,15 +67,19 @@ Page({
|
||||
|
||||
async login() {
|
||||
if (this.data.isPasswordLogin) {
|
||||
const res = await request('patient/password_login', 'post', { mobile: this.data.passwordInfo.account, password: this.data.passwordInfo.password });
|
||||
if (res.success) {
|
||||
await wx.setStorageSync('access_token', res.data.token);
|
||||
const res = await request('patient/password_login', 'post', { mobile: this.data.passwordInfo.account, password: md5Encrypt(this.data.passwordInfo.password) });
|
||||
console.log(res)
|
||||
await wx.setStorageSync('access_token', res.token);
|
||||
wx.switchTab({
|
||||
url: `/pages/my/index`,
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
const res = await request('/patient/code_login', 'post', {code: this.data.code, mobile: this.data.phoneNumber});
|
||||
await wx.setStorageSync('access_token', res.token);
|
||||
wx.switchTab({
|
||||
url: `/pages/my/index`,
|
||||
});
|
||||
// if (res.success) {
|
||||
// wx.navigateTo({
|
||||
// url: `/pages/loginCode/loginCode?phoneNumber=${this.data.phoneNumber}`,
|
||||
|
||||
@ -5,7 +5,7 @@ Page({
|
||||
behaviors: [useToastBehavior],
|
||||
|
||||
data: {
|
||||
isLoad: false,
|
||||
isLoad: true,
|
||||
service: [],
|
||||
personalInfo: {
|
||||
name: '邹方成'
|
||||
@ -40,7 +40,7 @@ Page({
|
||||
settingList: [
|
||||
{ label: '用药方案', path: '/pages/therapeuticRegimen/index', icon: 'service', type: 'text' },
|
||||
{ label: '健康教育', path: '/pages/article/index', icon: 'setting', type: 'text' },
|
||||
|
||||
|
||||
],
|
||||
},
|
||||
|
||||
@ -48,18 +48,31 @@ Page({
|
||||
// this.getServiceList();
|
||||
},
|
||||
|
||||
handelClick(e){
|
||||
handelClick(e) {
|
||||
console.log(e)
|
||||
},
|
||||
|
||||
async onShow() {
|
||||
const Token = wx.getStorageSync('access_token');
|
||||
const personalInfo = await this.getPersonalInfo();
|
||||
|
||||
// const personalInfo = await this.getPersonalInfo();
|
||||
console.log(Token)
|
||||
if (Token) {
|
||||
this.setData({
|
||||
isLoad: false,
|
||||
settingList: [
|
||||
{ label: '用药方案', path: '/pages/therapeuticRegimen/index', icon: 'service', type: 'text' },
|
||||
{ label: '健康教育', path: '/pages/article/index', icon: 'setting', type: 'text' },
|
||||
|
||||
],
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
isLoad: true,
|
||||
personalInfo,
|
||||
settingList: [
|
||||
{ label: '用药方案', path: '', icon: 'service', type: 'text' },
|
||||
{ label: '健康教育', path: '', icon: 'setting', type: 'text' },
|
||||
|
||||
],
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -105,5 +105,8 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"libVersion": "3.8.5"
|
||||
"libVersion": "3.8.5",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
}
|
||||
}
|
||||
7
utils/encrypt.js
Normal file
7
utils/encrypt.js
Normal file
@ -0,0 +1,7 @@
|
||||
const crypto = require('crypto-js');
|
||||
|
||||
function md5Encrypt(password) {
|
||||
return crypto.MD5(password).toString();
|
||||
}
|
||||
|
||||
module.exports = { md5Encrypt };
|
||||
Loading…
x
Reference in New Issue
Block a user