Browse Source

开始对接

master
unknown 1 month ago
parent
commit
ec5997a953
  1. 15
      config/api.js
  2. 14
      config/request.js
  3. 2
      config/site.config.js
  4. 12
      main.js
  5. 32
      manifest.json
  6. 189
      pages/exercises/brushQuestions/brushQuestions.vue
  7. 54
      pages/index/index.vue
  8. 8
      pages/vip/vipEntry/vipEntry.vue
  9. 1
      pages/vip/vipQuestions/vipQuestions.vue
  10. BIN
      static/images/bigImg/banner3.png
  11. BIN
      static/images/theory/dtk.png
  12. BIN
      static/images/theory/fankui.png
  13. BIN
      static/images/theory/sc.png
  14. 15
      unpackage/dist/cache/.vite/deps/_metadata.json
  15. 584
      unpackage/dist/cache/.vite/deps/js-md5.js
  16. 7
      unpackage/dist/cache/.vite/deps/js-md5.js.map

15
config/api.js

@ -3,8 +3,8 @@
import { http } from '@/uni_modules/uview-plus' import { http } from '@/uni_modules/uview-plus'
// 微信小程序的一键登录
export const weixinLogin = (data) => http.post('member/auth/weixin-mini-app-login', data)
//登录
export const loginApi = (data) => http.post('token/login', data)
// 验证码登录 // 验证码登录
export const loginSMS = (data) => http.post('member/auth/sms-login', data, { custom: { noToken: true }}) export const loginSMS = (data) => http.post('member/auth/sms-login', data, { custom: { noToken: true }})
// 登录发验证码 // 登录发验证码
@ -13,11 +13,12 @@ export const getLoginCode = (data) => http.post('member/auth/send-sms-code', dat
export const getUserInfo = (data) => http.post('member/user/get', {header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}}) export const getUserInfo = (data) => http.post('member/user/get', {header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}})
// 退出登录 // 退出登录
export const logOut = (data={}) => http.post('member/auth/logout', data, {custom: {catch: true, toast: false }}) export const logOut = (data={}) => http.post('member/auth/logout', data, {custom: {catch: true, toast: false }})
// 驾校列表分页
export const schoolPage = (params) => http.get('business/school/page', {params: params})
// 新增的接口
export const getBannerList = (params={}) => http.get('business/video/getBannerList', {params})
// 题库类型
export const questbanktypeApi = (params={}) => http.get('idex/questbanktype/list', {params})
// 进入答题页
export const startQuestionApi = (data) => http.post('questionBank/startQuestion', data,)
// 提交答案
export const submitAnswerResultApi = (data) => http.post('questionBank/submitAnswerResult.do', data,)

14
config/request.js

@ -3,7 +3,7 @@ import setObj from '@/config/site.config.js';
let { H5_API, WX_API,httpPrefix } = setObj let { H5_API, WX_API,httpPrefix } = setObj
// import { H5_API, WX_API,httpPrefix } from '@/config/site.config.js'; // import { H5_API, WX_API,httpPrefix } from '@/config/site.config.js';
// import { refreshToken } from './utils' // import { refreshToken } from './utils'
import md5 from 'js-md5'
// import md5 from 'js-md5'
let secretKey = '22d90e09d1374f0f9e4accd07d333e55' let secretKey = '22d90e09d1374f0f9e4accd07d333e55'
@ -26,15 +26,8 @@ let secretKey = '22d90e09d1374f0f9e4accd07d333e55'
uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作 uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作
// 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{}
config.data = config.data || {} config.data = config.data || {}
// 根据custom参数中配置的是否需要token,添加对应的请求头
config.data['timestamp'] = Date.now()
let jsonString = JSON.stringify(config.data)
let strSecretKey = jsonString + secretKey
let hash = md5(strSecretKey)
config.header['Signature'] = hash
config.data = jsonString
// let token = vm.$store.state.user.vuex_loginInfo.accessToken
let token = ''
let loginInfo = uni.getStorageSync('loginInfo') || {}
let token = loginInfo.token
if(token) { if(token) {
config.header.Authorization = 'Bearer ' + token config.header.Authorization = 'Bearer ' + token
} }
@ -52,6 +45,7 @@ let secretKey = '22d90e09d1374f0f9e4accd07d333e55'
// 响应拦截 // 响应拦截
uni.$u.http.interceptors.response.use(async (response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/ uni.$u.http.interceptors.response.use(async (response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
const data = response.data const data = response.data
data.code = data.errorcode
// console.log('请求结果') // console.log('请求结果')
// console.log(data) // console.log(data)
if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') { if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') {

2
config/site.config.js

@ -4,7 +4,7 @@ let obj = {
H5_API: VUE_APP_PLATFORM === 'h5' ? '/api' : '',//h5代理 H5_API: VUE_APP_PLATFORM === 'h5' ? '/api' : '',//h5代理
WX_API: VUE_APP_PLATFORM === 'h5' ? '/' : 'http://www.lyjppt.com/',//非代理地址 不要忘记加/ WX_API: VUE_APP_PLATFORM === 'h5' ? '/' : 'http://www.lyjppt.com/',//非代理地址 不要忘记加/
website: 'http://192.168.1.37', website: 'http://192.168.1.37',
httpPrefix: 'app-api/',
httpPrefix: 'api/',
imgUrl: 'https://jiangxijiakao-1.oss-cn-hangzhou.aliyuncs.com/defaultImages/app/bigImg/', imgUrl: 'https://jiangxijiakao-1.oss-cn-hangzhou.aliyuncs.com/defaultImages/app/bigImg/',
// 支付测试地址 // 支付测试地址
// preUrl: 'https://u8wbs.zyebank.cn/cem_ysb_u6/index.html', // preUrl: 'https://u8wbs.zyebank.cn/cem_ysb_u6/index.html',

12
main.js

@ -1,6 +1,6 @@
import App from './App' import App from './App'
import uviewPlus from '@/uni_modules/uview-plus' import uviewPlus from '@/uni_modules/uview-plus'
// import request from './config/request.js'
import request from './config/request.js'
import { goPage } from '@/utils/utils.js' import { goPage } from '@/utils/utils.js'
// // #ifndef VUE3 // // #ifndef VUE3
// import Vue from 'vue' // import Vue from 'vue'
@ -12,7 +12,6 @@ import { goPage } from '@/utils/utils.js'
// }) // })
// app.$mount() // app.$mount()
// // #endif // // #endif
//
// #ifdef VUE3 // #ifdef VUE3
@ -21,10 +20,17 @@ export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.config.globalProperties.$goPage = goPage app.config.globalProperties.$goPage = goPage
app.use(uviewPlus) app.use(uviewPlus)
// request(app)
request(app)
return { return {
app app
} }
} }
// #endif // #endif

32
manifest.json

@ -70,22 +70,22 @@
}, },
"vueVersion" : "3", "vueVersion" : "3",
"h5" : { "h5" : {
// "devServer" : {
// "port" : 90,
// "disableHostCheck" : true,
// "proxy" : {
// "app-api/" : {
// "target" : "http://www.lyjppt.com/",
// // "target" : "http://192.168.1.40:8099/",
// "changeOrigin" : true,
// "secure" : true
// "pathRewrite" : {
// "^/app-api/" : ""
// }
// }
// },
// "https" : false
// },
"devServer" : {
"port" : 90,
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "http://192.168.1.204:8081/",
// "target" : "http://192.168.1.40:8099/",
"changeOrigin" : true,
"secure" : true,
"pathRewrite" : {
"^/api" : ""
}
}
},
"https" : false
},
"router" : { "router" : {
"mode" : "hash", "mode" : "hash",
"base" : "/h5" "base" : "/h5"

189
pages/exercises/brushQuestions/brushQuestions.vue

@ -12,15 +12,15 @@
<view class="con padding"> <view class="con padding">
<view class="h1_row"> <view class="h1_row">
<text class="tag">单选</text>
<text class="h1">机动车驾驶人在实习期内驾驶机动车不得牵引挂车</text>
<text class="tag">{{types[questionBank.types-1]}}</text>
<text class="h1">{{ questionBank.title}}</text>
</view> </view>
<view class="option"> <view class="option">
<view class="optionItem flex">
<view class="icon">
<image src="@/static/logo.png" mode=""></image>
</view>
<view class="text">正确</view>
<view class="optionItem flex" v-for="(item,index) in questionBank.optionArr" @click="chooseOption(item)">
<view class="icon"></view>
<up-icon name="close-circle-fill" color="#ff0000" size="20"></up-icon>
<up-icon name="checkmark-circle-fill" color="#55ff7f" size="20"></up-icon>
<view class="text">{{item.key}} {{item.text}}</view>
</view> </view>
</view> </view>
<view class="answer flex"> <view class="answer flex">
@ -35,25 +35,66 @@
<view class="tit">题目解析</view> <view class="tit">题目解析</view>
<view class="txt">解析解析解析解析解析解析解析解析解析解析解析解析</view> <view class="txt">解析解析解析解析解析解析解析解析解析解析解析解析</view>
</view> </view>
<view class="btn" @click="">确定</view>
</view>
<view class="bottomBar">
<view class="ul">
<view class="li">
<view class="icon">1</view>
<view class="text">答对</view>
</view>
<view class="li">
<view class="icon">1</view>
<view class="text">答错</view>
</view>
<view class="li">
<view class="icon">1</view>
<view class="text">题目</view>
</view>
<view class="li">
<view class="icon">
<image src="@/static/images/theory/fankui.png" mode=""></image>
</view>
<view class="text">反馈</view>
</view>
<view class="li">
<view class="icon">
<image src="@/static/images/theory/dtk.png" mode=""></image>
</view>
<view class="text">答题卡</view>
</view>
<view class="li">
<view class="icon">
<image src="@/static/images/theory/sc.png" mode=""></image>
</view>
<view class="text">收藏</view>
</view> </view>
</view> </view>
</view>
</view>
</template> </template>
<script>
export default {
data() {
return {
currentNav: '1'
}
},
methods: {
changeNav(val) {
<script setup>
import { startQuestionApi, submitAnswerResultApi } from '@/config/api.js'
import {
ref,
reactive
} from 'vue';
const currentNav = ref('1')
const types = ref([
'单选题',
'多选题',
'判断题'
])
// 123
function changeNav(val) {
console.log(window) console.log(window)
if(this.currentNav == val) return
this.currentNav = val
},
goEmam() {
if(currentNav.value == val) return
currentNav.value = val
}
function goEmam() {
uni.navigateTo({ uni.navigateTo({
// url: '/pages/exercises/exam/exam', // url: '/pages/exercises/exam/exam',
// url: '/pages/exercises/beforeExam/beforeExam', // url: '/pages/exercises/beforeExam/beforeExam',
@ -64,14 +105,111 @@
}) })
} }
function changeTabbar(val) {
console.log(val)
}
//
const questionBank = ref({})
async function startQuestionFn() {
let obj = {
carType: 'car',
stepType: '1',
volume: '0',
types: '1',
sift: '0',
contentType: '1'
}
const {data: res} = await startQuestionApi(obj)
console.log(res.questionBank.types)
if(res.questionBank.types !=3) {
res.questionBank.optionArr = []
let abcd = [
'a',
'b',
'c',
'd',
'e',
'f'
]
abcd.forEach((k,i)=>{
let option = 'option'+k
if(res.questionBank[option]) {
let obj = {
key: k.toLocaleUpperCase(),
text: res.questionBank[option],
index: i+1
}
res.questionBank.optionArr.push(obj)
}
})
}
questionBank.value = res.questionBank
console.log(questionBank.value)
} }
startQuestionFn()
//
const curOption = ref({})
async function chooseOption(item) {
curOption.value = item
let obj = {
answer: '1',
carType: 'car',
questionId: questionBank.value.id,
result: '0',
stepType: 1,
}
const {data: res} = await submitAnswerResultApi(obj)
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
image {display: block;width: 100%;height: 100%;} image {display: block;width: 100%;height: 100%;}
.bottomBar {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 98rpx;
background: #FFFFFF;
border-top: 1rpx solid #F4F4F4;
.ul {
display: flex;
justify-content: space-between;
height: 100%;
align-items: center;
.li {
width: 16.6%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon {
font-size: 30rpx;
height: 30rpx;
line-height: 30rpx;
image {
display: block;
margin-top: 4rpx;
width: 26rpx;
height: 26rpx;
}
}
.text {
font-weight: 500;
font-size: 24rpx;
color: #999999;
margin-top: 10rpx;
}
}
}
}
.content { .content {
padding: 120rpx 0 0 0; padding: 120rpx 0 0 0;
min-height: 100vh;
.u-nav-slot { .u-nav-slot {
width: 306rpx; width: 306rpx;
height: 54rpx; height: 54rpx;
@ -139,16 +277,15 @@
margin-bottom: 50rpx; margin-bottom: 50rpx;
align-items: center; align-items: center;
.icon { .icon {
width: 56rpx;
height: 56rpx;
margin-right: 36rpx;
image {
width: 36rpx;
height:36rpx;
border-radius: 50%; border-radius: 50%;
}
border: 1rpx solid #999;
} }
.text { .text {
font-size: 32rpx; font-size: 32rpx;
margin-left: 16rpx;
} }
} }
} }

54
pages/index/index.vue

@ -3,15 +3,15 @@
<up-navbar title="选择类型" @rightClick="rightClick" :autoBack="true"></up-navbar> <up-navbar title="选择类型" @rightClick="rightClick" :autoBack="true"></up-navbar>
<view class="tit">请选择需要学习的题库类型</view> <view class="tit">请选择需要学习的题库类型</view>
<view class="ul"> <view class="ul">
<view class="li" v-for="(item,index) in tabData" :key="index" @click="chooseCar(item)" :class="{active: item.name==currentCar}">
<view class="checkBox" v-if="item.name==currentCar">
<view class="li" v-for="(item,index) in tabData" :key="index" @click="chooseCar(item)" :class="{active: item.id==currentCar.id}">
<view class="checkBox" v-if="item.id==currentCar.id">
<image src="@/static/images/dg.png" mode=""></image> <image src="@/static/images/dg.png" mode=""></image>
</view> </view>
<view class="icon" :style="item.style">
<image :src="item.icon" mode=""></image>
<view class="icon">
<image :src="item.cover" mode=""></image>
</view> </view>
<view class="name">{{item.name}}</view>
<view class="carType">{{ item.type }}</view>
<view class="name">{{item.title}}</view>
<view class="carType" v-for="(item2,index2) in item.descriptionArr" :key="index2">{{ item2 }}</view>
</view> </view>
</view> </view>
@ -26,6 +26,7 @@
ref, ref,
reactive reactive
} from 'vue'; } from 'vue';
import { loginApi, questbanktypeApi, } from '@/config/api.js'
import { import {
onLoad, onLoad,
onReady onReady
@ -40,9 +41,9 @@
{name: '客车', type: 'A1/B1/A3', style: 'width: 106rpx;height: 68rpx;', icon: new URL('@/static/images/car1.png', import.meta.url).href, id: '1'}, {name: '客车', type: 'A1/B1/A3', style: 'width: 106rpx;height: 68rpx;', icon: new URL('@/static/images/car1.png', import.meta.url).href, id: '1'},
{name: '摩托车', type: 'D/E/F', style: 'width: 102rpx;height: 73rpx;', icon: new URL('@/static/images/car3.png', import.meta.url).href, id: '1'}, {name: '摩托车', type: 'D/E/F', style: 'width: 102rpx;height: 73rpx;', icon: new URL('@/static/images/car3.png', import.meta.url).href, id: '1'},
]) ])
const currentCar = ref('小车')
const currentCar = ref('')
function chooseCar(item) { function chooseCar(item) {
currentCar.value = item.name
currentCar.value = item
} }
function oneBtnClick() { function oneBtnClick() {
@ -50,6 +51,30 @@
url: '/pages/exercises/theoryStudy/theoryStudy' url: '/pages/exercises/theoryStudy/theoryStudy'
}) })
} }
//
async function loginFn() {
const res = await loginApi({
"type": 1,
"username": "18267103167",
})
console.log(res)
uni.setStorageSync('loginInfo', res.data);
}
// if(uni.)
// loginFn()
async function questbanktypeFn() {
const {data: res} = await questbanktypeApi()
let arr = res.map(item=>{
item.descriptionArr = item.description.split(':')
return item
})
tabData.value = arr
currentCar.value = res[0]
console.log(tabData.value)
}
questbanktypeFn()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -67,13 +92,14 @@
} }
.content { .content {
width: 100%; width: 100%;
padding-top: 100rpx;
up-navbar { up-navbar {
} }
.tit { .tit {
padding: 40rpx 0;
padding: 40rpx 20rpx;
font-size: 36rpx; font-size: 36rpx;
color: #333; color: #333;
font-weight: 700; font-weight: 700;
@ -86,11 +112,11 @@
justify-content: space-between; justify-content: space-between;
.li { .li {
width: 190rpx; width: 190rpx;
height: 190rpx;
// height: 190rpx;
padding: 20rpx 0;
border-radius: 10rpx; border-radius: 10rpx;
padding-top: 20rpx;
position: relative; position: relative;
display: flex;align-items: center;justify-content: center;margin: 30rpx 0rpx 0 0 ;flex-direction: column;
display: flex;align-items: center;margin: 30rpx 0rpx 0 0 ;flex-direction: column;
&.active { &.active {
background: #EDF8FF; background: #EDF8FF;
} }
@ -113,7 +139,8 @@
} }
.icon { .icon {
width: 106rpx;
height: 68rpx;
} }
.name { .name {
@ -125,6 +152,7 @@
.carType { .carType {
font-size: 24rpx; font-size: 24rpx;
color: #ccc; color: #ccc;
padding: 4rpx;
} }
} }
} }

8
pages/vip/vipEntry/vipEntry.vue

@ -1,5 +1,9 @@
<template> <template>
<view class="content"> <view class="content">
<!-- <up-navbar leftText=" " title="什么东西?" :safeAreaInsetTop="true" :autoBack="true" :fixed="false" :bgColor="'transparent'" ></up-navbar> -->
<up-navbar leftText=" " :leftIconColor="'#fff'" :safeAreaInsetTop="true" :autoBack="true" title=" " :fixed="true"
:bgColor="'transparent'">
</up-navbar>
<view class="topBg" :class="{bigBg: curVipItem.name=='全科VIP'}"> <view class="topBg" :class="{bigBg: curVipItem.name=='全科VIP'}">
<view class="tag">XXXX成为VIP会员</view> <view class="tag">XXXX成为VIP会员</view>
<view class="tag">一次搞定</view> <view class="tag">一次搞定</view>
@ -193,6 +197,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
align-items: center;
.icon { .icon {
width: 90rpx; width: 90rpx;
height: 90rpx; height: 90rpx;
@ -201,7 +206,7 @@
.icon_arrow { .icon_arrow {
width: 38rpx; width: 38rpx;
height: 36rpx; height: 36rpx;
margin-top: 33rpx;
margin: 33rpx auto;
} }
.text { .text {
margin-top: 18rpx; margin-top: 18rpx;
@ -224,6 +229,7 @@
height: 550rpx; height: 550rpx;
background: url('../../../static/images/bigImg/vipbg.png') no-repeat; background: url('../../../static/images/bigImg/vipbg.png') no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
// padding-top: 88rpx;
position: relative; position: relative;
&.bigBg { &.bigBg {
height: 794rpx; height: 794rpx;

1
pages/vip/vipQuestions/vipQuestions.vue

@ -39,6 +39,7 @@
background: #F4F4F4; background: #F4F4F4;
border-radius: 10rpx; border-radius: 10rpx;
padding: 20rpx; padding: 20rpx;
} }
</style> </style>

BIN
static/images/bigImg/banner3.png

After

Width: 710  |  Height: 162  |  Size: 95 KiB

BIN
static/images/theory/dtk.png

After

Width: 24  |  Height: 24  |  Size: 590 B

BIN
static/images/theory/fankui.png

After

Width: 24  |  Height: 24  |  Size: 396 B

BIN
static/images/theory/sc.png

After

Width: 24  |  Height: 24  |  Size: 531 B

15
unpackage/dist/cache/.vite/deps/_metadata.json

@ -1,8 +1,15 @@
{ {
"hash": "b0d0ffe5",
"configHash": "51797bb4",
"hash": "62b83936",
"configHash": "cb5a66fc",
"lockfileHash": "d536e6bf", "lockfileHash": "d536e6bf",
"browserHash": "1988e6cd",
"optimized": {},
"browserHash": "e831f5c4",
"optimized": {
"js-md5": {
"src": "../../../../../node_modules/js-md5/src/md5.js",
"file": "js-md5.js",
"fileHash": "4f956836",
"needsInterop": true
}
},
"chunks": {} "chunks": {}
} }

584
unpackage/dist/cache/.vite/deps/js-md5.js

@ -0,0 +1,584 @@
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
// browser-external:crypto
var require_crypto = __commonJS({
"browser-external:crypto"(exports, module) {
module.exports = Object.create(new Proxy({}, {
get(_, key) {
if (key !== "__esModule" && key !== "__proto__" && key !== "constructor" && key !== "splice") {
console.warn(`Module "crypto" has been externalized for browser compatibility. Cannot access "crypto.${key}" in client code. See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`);
}
}
}));
}
});
// browser-external:buffer
var require_buffer = __commonJS({
"browser-external:buffer"(exports, module) {
module.exports = Object.create(new Proxy({}, {
get(_, key) {
if (key !== "__esModule" && key !== "__proto__" && key !== "constructor" && key !== "splice") {
console.warn(`Module "buffer" has been externalized for browser compatibility. Cannot access "buffer.${key}" in client code. See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`);
}
}
}));
}
});
// ../../../../../work/questionbankvue3/node_modules/js-md5/src/md5.js
var require_md5 = __commonJS({
"../../../../../work/questionbankvue3/node_modules/js-md5/src/md5.js"(exports, module) {
(function() {
"use strict";
var INPUT_ERROR = "input is invalid type";
var FINALIZE_ERROR = "finalize already called";
var WINDOW = typeof window === "object";
var root = WINDOW ? window : {};
if (root.JS_MD5_NO_WINDOW) {
WINDOW = false;
}
var WEB_WORKER = !WINDOW && typeof self === "object";
var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node;
if (NODE_JS) {
root = global;
} else if (WEB_WORKER) {
root = self;
}
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === "object" && module.exports;
var AMD = typeof define === "function" && define.amd;
var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined";
var HEX_CHARS = "0123456789abcdef".split("");
var EXTRA = [128, 32768, 8388608, -2147483648];
var SHIFT = [0, 8, 16, 24];
var OUTPUT_TYPES = ["hex", "array", "digest", "buffer", "arrayBuffer", "base64"];
var BASE64_ENCODE_CHAR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
var blocks = [], buffer8;
if (ARRAY_BUFFER) {
var buffer = new ArrayBuffer(68);
buffer8 = new Uint8Array(buffer);
blocks = new Uint32Array(buffer);
}
var isArray = Array.isArray;
if (root.JS_MD5_NO_NODE_JS || !isArray) {
isArray = function(obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
};
}
var isView = ArrayBuffer.isView;
if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !isView)) {
isView = function(obj) {
return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer;
};
}
var formatMessage = function(message) {
var type = typeof message;
if (type === "string") {
return [message, true];
}
if (type !== "object" || message === null) {
throw new Error(INPUT_ERROR);
}
if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
return [new Uint8Array(message), false];
}
if (!isArray(message) && !isView(message)) {
throw new Error(INPUT_ERROR);
}
return [message, false];
};
var createOutputMethod = function(outputType) {
return function(message) {
return new Md5(true).update(message)[outputType]();
};
};
var createMethod = function() {
var method = createOutputMethod("hex");
if (NODE_JS) {
method = nodeWrap(method);
}
method.create = function() {
return new Md5();
};
method.update = function(message) {
return method.create().update(message);
};
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
var type = OUTPUT_TYPES[i];
method[type] = createOutputMethod(type);
}
return method;
};
var nodeWrap = function(method) {
var crypto = require_crypto();
var Buffer2 = require_buffer().Buffer;
var bufferFrom;
if (Buffer2.from && !root.JS_MD5_NO_BUFFER_FROM) {
bufferFrom = Buffer2.from;
} else {
bufferFrom = function(message) {
return new Buffer2(message);
};
}
var nodeMethod = function(message) {
if (typeof message === "string") {
return crypto.createHash("md5").update(message, "utf8").digest("hex");
} else {
if (message === null || message === void 0) {
throw new Error(INPUT_ERROR);
} else if (message.constructor === ArrayBuffer) {
message = new Uint8Array(message);
}
}
if (isArray(message) || isView(message) || message.constructor === Buffer2) {
return crypto.createHash("md5").update(bufferFrom(message)).digest("hex");
} else {
return method(message);
}
};
return nodeMethod;
};
var createHmacOutputMethod = function(outputType) {
return function(key, message) {
return new HmacMd5(key, true).update(message)[outputType]();
};
};
var createHmacMethod = function() {
var method = createHmacOutputMethod("hex");
method.create = function(key) {
return new HmacMd5(key);
};
method.update = function(key, message) {
return method.create(key).update(message);
};
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
var type = OUTPUT_TYPES[i];
method[type] = createHmacOutputMethod(type);
}
return method;
};
function Md5(sharedMemory) {
if (sharedMemory) {
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
this.blocks = blocks;
this.buffer8 = buffer8;
} else {
if (ARRAY_BUFFER) {
var buffer2 = new ArrayBuffer(68);
this.buffer8 = new Uint8Array(buffer2);
this.blocks = new Uint32Array(buffer2);
} else {
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
}
}
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
this.finalized = this.hashed = false;
this.first = true;
}
Md5.prototype.update = function(message) {
if (this.finalized) {
throw new Error(FINALIZE_ERROR);
}
var result = formatMessage(message);
message = result[0];
var isString = result[1];
var code, index = 0, i, length = message.length, blocks2 = this.blocks;
var buffer82 = this.buffer8;
while (index < length) {
if (this.hashed) {
this.hashed = false;
blocks2[0] = blocks2[16];
blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
}
if (isString) {
if (ARRAY_BUFFER) {
for (i = this.start; index < length && i < 64; ++index) {
code = message.charCodeAt(index);
if (code < 128) {
buffer82[i++] = code;
} else if (code < 2048) {
buffer82[i++] = 192 | code >>> 6;
buffer82[i++] = 128 | code & 63;
} else if (code < 55296 || code >= 57344) {
buffer82[i++] = 224 | code >>> 12;
buffer82[i++] = 128 | code >>> 6 & 63;
buffer82[i++] = 128 | code & 63;
} else {
code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
buffer82[i++] = 240 | code >>> 18;
buffer82[i++] = 128 | code >>> 12 & 63;
buffer82[i++] = 128 | code >>> 6 & 63;
buffer82[i++] = 128 | code & 63;
}
}
} else {
for (i = this.start; index < length && i < 64; ++index) {
code = message.charCodeAt(index);
if (code < 128) {
blocks2[i >>> 2] |= code << SHIFT[i++ & 3];
} else if (code < 2048) {
blocks2[i >>> 2] |= (192 | code >>> 6) << SHIFT[i++ & 3];
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
} else if (code < 55296 || code >= 57344) {
blocks2[i >>> 2] |= (224 | code >>> 12) << SHIFT[i++ & 3];
blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
} else {
code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
blocks2[i >>> 2] |= (240 | code >>> 18) << SHIFT[i++ & 3];
blocks2[i >>> 2] |= (128 | code >>> 12 & 63) << SHIFT[i++ & 3];
blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
}
}
}
} else {
if (ARRAY_BUFFER) {
for (i = this.start; index < length && i < 64; ++index) {
buffer82[i++] = message[index];
}
} else {
for (i = this.start; index < length && i < 64; ++index) {
blocks2[i >>> 2] |= message[index] << SHIFT[i++ & 3];
}
}
}
this.lastByteIndex = i;
this.bytes += i - this.start;
if (i >= 64) {
this.start = i - 64;
this.hash();
this.hashed = true;
} else {
this.start = i;
}
}
if (this.bytes > 4294967295) {
this.hBytes += this.bytes / 4294967296 << 0;
this.bytes = this.bytes % 4294967296;
}
return this;
};
Md5.prototype.finalize = function() {
if (this.finalized) {
return;
}
this.finalized = true;
var blocks2 = this.blocks, i = this.lastByteIndex;
blocks2[i >>> 2] |= EXTRA[i & 3];
if (i >= 56) {
if (!this.hashed) {
this.hash();
}
blocks2[0] = blocks2[16];
blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
}
blocks2[14] = this.bytes << 3;
blocks2[15] = this.hBytes << 3 | this.bytes >>> 29;
this.hash();
};
Md5.prototype.hash = function() {
var a, b, c, d, bc, da, blocks2 = this.blocks;
if (this.first) {
a = blocks2[0] - 680876937;
a = (a << 7 | a >>> 25) - 271733879 << 0;
d = (-1732584194 ^ a & 2004318071) + blocks2[1] - 117830708;
d = (d << 12 | d >>> 20) + a << 0;
c = (-271733879 ^ d & (a ^ -271733879)) + blocks2[2] - 1126478375;
c = (c << 17 | c >>> 15) + d << 0;
b = (a ^ c & (d ^ a)) + blocks2[3] - 1316259209;
b = (b << 22 | b >>> 10) + c << 0;
} else {
a = this.h0;
b = this.h1;
c = this.h2;
d = this.h3;
a += (d ^ b & (c ^ d)) + blocks2[0] - 680876936;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ a & (b ^ c)) + blocks2[1] - 389564586;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ d & (a ^ b)) + blocks2[2] + 606105819;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ c & (d ^ a)) + blocks2[3] - 1044525330;
b = (b << 22 | b >>> 10) + c << 0;
}
a += (d ^ b & (c ^ d)) + blocks2[4] - 176418897;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ a & (b ^ c)) + blocks2[5] + 1200080426;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ d & (a ^ b)) + blocks2[6] - 1473231341;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ c & (d ^ a)) + blocks2[7] - 45705983;
b = (b << 22 | b >>> 10) + c << 0;
a += (d ^ b & (c ^ d)) + blocks2[8] + 1770035416;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ a & (b ^ c)) + blocks2[9] - 1958414417;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ d & (a ^ b)) + blocks2[10] - 42063;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ c & (d ^ a)) + blocks2[11] - 1990404162;
b = (b << 22 | b >>> 10) + c << 0;
a += (d ^ b & (c ^ d)) + blocks2[12] + 1804603682;
a = (a << 7 | a >>> 25) + b << 0;
d += (c ^ a & (b ^ c)) + blocks2[13] - 40341101;
d = (d << 12 | d >>> 20) + a << 0;
c += (b ^ d & (a ^ b)) + blocks2[14] - 1502002290;
c = (c << 17 | c >>> 15) + d << 0;
b += (a ^ c & (d ^ a)) + blocks2[15] + 1236535329;
b = (b << 22 | b >>> 10) + c << 0;
a += (c ^ d & (b ^ c)) + blocks2[1] - 165796510;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ c & (a ^ b)) + blocks2[6] - 1069501632;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ b & (d ^ a)) + blocks2[11] + 643717713;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ a & (c ^ d)) + blocks2[0] - 373897302;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ d & (b ^ c)) + blocks2[5] - 701558691;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ c & (a ^ b)) + blocks2[10] + 38016083;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ b & (d ^ a)) + blocks2[15] - 660478335;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ a & (c ^ d)) + blocks2[4] - 405537848;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ d & (b ^ c)) + blocks2[9] + 568446438;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ c & (a ^ b)) + blocks2[14] - 1019803690;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ b & (d ^ a)) + blocks2[3] - 187363961;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ a & (c ^ d)) + blocks2[8] + 1163531501;
b = (b << 20 | b >>> 12) + c << 0;
a += (c ^ d & (b ^ c)) + blocks2[13] - 1444681467;
a = (a << 5 | a >>> 27) + b << 0;
d += (b ^ c & (a ^ b)) + blocks2[2] - 51403784;
d = (d << 9 | d >>> 23) + a << 0;
c += (a ^ b & (d ^ a)) + blocks2[7] + 1735328473;
c = (c << 14 | c >>> 18) + d << 0;
b += (d ^ a & (c ^ d)) + blocks2[12] - 1926607734;
b = (b << 20 | b >>> 12) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks2[5] - 378558;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks2[8] - 2022574463;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks2[11] + 1839030562;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks2[14] - 35309556;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks2[1] - 1530992060;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks2[4] + 1272893353;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks2[7] - 155497632;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks2[10] - 1094730640;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks2[13] + 681279174;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks2[0] - 358537222;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks2[3] - 722521979;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks2[6] + 76029189;
b = (b << 23 | b >>> 9) + c << 0;
bc = b ^ c;
a += (bc ^ d) + blocks2[9] - 640364487;
a = (a << 4 | a >>> 28) + b << 0;
d += (bc ^ a) + blocks2[12] - 421815835;
d = (d << 11 | d >>> 21) + a << 0;
da = d ^ a;
c += (da ^ b) + blocks2[15] + 530742520;
c = (c << 16 | c >>> 16) + d << 0;
b += (da ^ c) + blocks2[2] - 995338651;
b = (b << 23 | b >>> 9) + c << 0;
a += (c ^ (b | ~d)) + blocks2[0] - 198630844;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks2[7] + 1126891415;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks2[14] - 1416354905;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks2[5] - 57434055;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks2[12] + 1700485571;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks2[3] - 1894986606;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks2[10] - 1051523;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks2[1] - 2054922799;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks2[8] + 1873313359;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks2[15] - 30611744;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks2[6] - 1560198380;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks2[13] + 1309151649;
b = (b << 21 | b >>> 11) + c << 0;
a += (c ^ (b | ~d)) + blocks2[4] - 145523070;
a = (a << 6 | a >>> 26) + b << 0;
d += (b ^ (a | ~c)) + blocks2[11] - 1120210379;
d = (d << 10 | d >>> 22) + a << 0;
c += (a ^ (d | ~b)) + blocks2[2] + 718787259;
c = (c << 15 | c >>> 17) + d << 0;
b += (d ^ (c | ~a)) + blocks2[9] - 343485551;
b = (b << 21 | b >>> 11) + c << 0;
if (this.first) {
this.h0 = a + 1732584193 << 0;
this.h1 = b - 271733879 << 0;
this.h2 = c - 1732584194 << 0;
this.h3 = d + 271733878 << 0;
this.first = false;
} else {
this.h0 = this.h0 + a << 0;
this.h1 = this.h1 + b << 0;
this.h2 = this.h2 + c << 0;
this.h3 = this.h3 + d << 0;
}
};
Md5.prototype.hex = function() {
this.finalize();
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
return HEX_CHARS[h0 >>> 4 & 15] + HEX_CHARS[h0 & 15] + HEX_CHARS[h0 >>> 12 & 15] + HEX_CHARS[h0 >>> 8 & 15] + HEX_CHARS[h0 >>> 20 & 15] + HEX_CHARS[h0 >>> 16 & 15] + HEX_CHARS[h0 >>> 28 & 15] + HEX_CHARS[h0 >>> 24 & 15] + HEX_CHARS[h1 >>> 4 & 15] + HEX_CHARS[h1 & 15] + HEX_CHARS[h1 >>> 12 & 15] + HEX_CHARS[h1 >>> 8 & 15] + HEX_CHARS[h1 >>> 20 & 15] + HEX_CHARS[h1 >>> 16 & 15] + HEX_CHARS[h1 >>> 28 & 15] + HEX_CHARS[h1 >>> 24 & 15] + HEX_CHARS[h2 >>> 4 & 15] + HEX_CHARS[h2 & 15] + HEX_CHARS[h2 >>> 12 & 15] + HEX_CHARS[h2 >>> 8 & 15] + HEX_CHARS[h2 >>> 20 & 15] + HEX_CHARS[h2 >>> 16 & 15] + HEX_CHARS[h2 >>> 28 & 15] + HEX_CHARS[h2 >>> 24 & 15] + HEX_CHARS[h3 >>> 4 & 15] + HEX_CHARS[h3 & 15] + HEX_CHARS[h3 >>> 12 & 15] + HEX_CHARS[h3 >>> 8 & 15] + HEX_CHARS[h3 >>> 20 & 15] + HEX_CHARS[h3 >>> 16 & 15] + HEX_CHARS[h3 >>> 28 & 15] + HEX_CHARS[h3 >>> 24 & 15];
};
Md5.prototype.toString = Md5.prototype.hex;
Md5.prototype.digest = function() {
this.finalize();
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
return [
h0 & 255,
h0 >>> 8 & 255,
h0 >>> 16 & 255,
h0 >>> 24 & 255,
h1 & 255,
h1 >>> 8 & 255,
h1 >>> 16 & 255,
h1 >>> 24 & 255,
h2 & 255,
h2 >>> 8 & 255,
h2 >>> 16 & 255,
h2 >>> 24 & 255,
h3 & 255,
h3 >>> 8 & 255,
h3 >>> 16 & 255,
h3 >>> 24 & 255
];
};
Md5.prototype.array = Md5.prototype.digest;
Md5.prototype.arrayBuffer = function() {
this.finalize();
var buffer2 = new ArrayBuffer(16);
var blocks2 = new Uint32Array(buffer2);
blocks2[0] = this.h0;
blocks2[1] = this.h1;
blocks2[2] = this.h2;
blocks2[3] = this.h3;
return buffer2;
};
Md5.prototype.buffer = Md5.prototype.arrayBuffer;
Md5.prototype.base64 = function() {
var v1, v2, v3, base64Str = "", bytes = this.array();
for (var i = 0; i < 15; ) {
v1 = bytes[i++];
v2 = bytes[i++];
v3 = bytes[i++];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] + BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] + BASE64_ENCODE_CHAR[v3 & 63];
}
v1 = bytes[i];
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[v1 << 4 & 63] + "==";
return base64Str;
};
function HmacMd5(key, sharedMemory) {
var i, result = formatMessage(key);
key = result[0];
if (result[1]) {
var bytes = [], length = key.length, index = 0, code;
for (i = 0; i < length; ++i) {
code = key.charCodeAt(i);
if (code < 128) {
bytes[index++] = code;
} else if (code < 2048) {
bytes[index++] = 192 | code >>> 6;
bytes[index++] = 128 | code & 63;
} else if (code < 55296 || code >= 57344) {
bytes[index++] = 224 | code >>> 12;
bytes[index++] = 128 | code >>> 6 & 63;
bytes[index++] = 128 | code & 63;
} else {
code = 65536 + ((code & 1023) << 10 | key.charCodeAt(++i) & 1023);
bytes[index++] = 240 | code >>> 18;
bytes[index++] = 128 | code >>> 12 & 63;
bytes[index++] = 128 | code >>> 6 & 63;
bytes[index++] = 128 | code & 63;
}
}
key = bytes;
}
if (key.length > 64) {
key = new Md5(true).update(key).array();
}
var oKeyPad = [], iKeyPad = [];
for (i = 0; i < 64; ++i) {
var b = key[i] || 0;
oKeyPad[i] = 92 ^ b;
iKeyPad[i] = 54 ^ b;
}
Md5.call(this, sharedMemory);
this.update(iKeyPad);
this.oKeyPad = oKeyPad;
this.inner = true;
this.sharedMemory = sharedMemory;
}
HmacMd5.prototype = new Md5();
HmacMd5.prototype.finalize = function() {
Md5.prototype.finalize.call(this);
if (this.inner) {
this.inner = false;
var innerHash = this.array();
Md5.call(this, this.sharedMemory);
this.update(this.oKeyPad);
this.update(innerHash);
Md5.prototype.finalize.call(this);
}
};
var exports2 = createMethod();
exports2.md5 = exports2;
exports2.md5.hmac = createHmacMethod();
if (COMMON_JS) {
module.exports = exports2;
} else {
root.md5 = exports2;
if (AMD) {
define(function() {
return exports2;
});
}
}
})();
}
});
export default require_md5();
/*! Bundled license information:
js-md5/src/md5.js:
(**
* [js-md5]{@link https://github.com/emn178/js-md5}
*
* @namespace md5
* @version 0.8.3
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2023
* @license MIT
*)
*/
//# sourceMappingURL=js-md5.js.map

7
unpackage/dist/cache/.vite/deps/js-md5.js.map
File diff suppressed because it is too large
View File

Loading…
Cancel
Save