Commit 69c5fcec authored by Zhang Xiaojie's avatar Zhang Xiaojie

请求函数

parent ea99fd3a
......@@ -9,7 +9,6 @@
import Vue from 'vue'
import { Editor, EditorContent } from '@tiptap/vue-2'
import StarterKit from '@tiptap/starter-kit'
import Placeholder from '@tiptap/extension-placeholder'
import {Image as Timage} from '@tiptap/extension-image'
import EditorMenuBar from './editorMenuBar.vue'
......@@ -49,7 +48,6 @@ export default Vue.extend({
extensions: [
StarterKit,
Timage,
Placeholder
],
autofocus: 'start',
})
......@@ -67,10 +65,6 @@ export default Vue.extend({
img{
display: block;
margin: 0 auto;
&::after{
content: 'sc';
display: block;
}
}
}
......
import baseAxios from '../index'
const prefix = '/banner/admin'
export function bannerAdd(data: {
file_name: string
location: number
title: string
}) {
return baseAxios({
url: prefix + '/add',
method: 'POST',
data,
})
}
export function bannerQuery(data: {
banner_status: string
location: number
title: string
}) {
return baseAxios({
url: prefix + '/add',
method: 'POST',
data,
})
}
\ No newline at end of file
import baseAxios from '..'
export function login() {
return baseAxios({
method: 'POST',
data: JSON.stringify({}),
})
}
import baseAxios from '..'
export function upload(file: File | Blob) {
const formData = new FormData();
formData.append('file', file);
return baseAxios({
method: 'POST',
url:'/upload',
data: formData
})
}
\ No newline at end of file
import baseAxios from '../index'
const prefix = '/admin'
export function adminLogin(data: {
name: string
pwd: string
}):any;
export function adminLogin(data: {
name: string
phone:string
verifyCode: string
}):any;
export function adminLogin(data: {
name: string
phone?:string
pwd?:string
verifyCode?: string
}) {
return baseAxios({
url: prefix + '/login',
method: 'POST',
data,
})
}
// export function checkPhoneIsRegistered(phone: string) {
// return baseAxios({
// url: prefix + '/check/phone',
// method: 'get',
// params: {
// phone,
// },
// })
// }
// export function userLogout() {
// return baseAxios({
// url: prefix + '/logout',
// method: 'GET',
// })
// }
import { getUserMsg } from '@/utils/userMsg/userMsg'
import axios from 'axios'
import { Modal } from 'ant-design-vue'
const baseAxios = axios.create({
baseURL: '/api',
baseURL: '/proxyApi/api/v1',
headers: {
Authorization: getUserMsg()?.token,
},
......@@ -11,5 +12,18 @@ const baseAxios = axios.create({
const get = baseAxios.get
const post = baseAxios.post
baseAxios.interceptors.response.use(
(value: any) => {
return value.data
},
(error) => {
Modal.error({
title: '错误',
content: error.message,
});
throw new Error(error)
},
)
export default baseAxios
export enum eLevel{
firstLevel_branch,
secondary_branch,
firstLevel_sub_branch,
secondary_sub_branch,
firstLevel_branch=1,
secondary_branch=2,
firstLevel_sub_branch=3,
secondary_sub_branch=4,
}
\ No newline at end of file
......@@ -73,6 +73,7 @@ import { setUserMsg } from '@/utils/userMsg/userMsg'
import { eLoginWay } from './type'
import { phoneValid,isPhoneValid } from './const'
import { Tabs,FormModel} from 'ant-design-vue'
import { adminLogin } from '@/service/UserManagementService/index'
import Vue from 'vue'
Vue.use(Tabs)
......@@ -150,26 +151,36 @@ export default Vue.extend({
}
return isValid
},
async registerFunc(phone: string, code: string) {
// const ret = await this.$service.userService.loginAndSign({
// codetype: "sms",
// telephone: phone,
// verificationCode: code,
// });
// if (ret) {
// const { Authorization, user } = ret;
// token.setToken(Authorization);
// userMsg.setUserMsg(user);
// this.$router.push({
// name: "Home",
// });
// }
},
async loginByCodeFunc(phone: string, code: string) {
return this.registerFunc(phone, code);
async loginByCodeFunc(name:string,phone: string, code: string) {
const ret = await adminLogin({
name:name,
phone: name,
verifyCode: code,
})
if (ret) {
const { accessToken, user } = ret.data
// setUserMsg(user)
console.log(ret.data);
// this.$router.push({
// name: "home",
// });
}
},
async loginByPwdFunc(phone: string, pwd: string) {
console.log(phone, pwd);
async loginByPwdFunc(name: string, pwd: string) {
const ret = await adminLogin({
name: name,
pwd: pwd,
})
if (ret) {
const { accessToken, user } = ret.data
// setUserMsg(user)
console.log(ret.data);
// this.$router.push({
// name: "home",
// });
}
},
async handleClickLogin() {
if(this.isValid()) {
......
export enum changeWay{
CODE,
PASSWORD
<<<<<<< HEAD
}
=======
}
export enum codeType{
......@@ -11,5 +8,4 @@ export enum codeType{
toConfirmChange
}
export const phoneValid = new RegExp(/^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/)
>>>>>>> c85785174709d6a01b7b9e48a35a0b1688df9008
export const phoneValid = new RegExp(/^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/)
\ No newline at end of file
<template>
<div>
<<<<<<< HEAD
<p class=" text-2xl font-bold mb-5">修改密码</p>
<a-tabs default-active-key="1" @change="toggleChangeWay" style="width:40%">
<!-- 通过手机验证码修改 -->
......@@ -71,16 +70,10 @@
</a-tab-pane>
</a-tabs>
<a-button type="primary" @click="handleSubmission">提交</a-button>
=======
<template>
<router-view></router-view>
</template>
>>>>>>> c85785174709d6a01b7b9e48a35a0b1688df9008
</div>
</template>
<script lang="ts">
<<<<<<< HEAD
import Vue from 'vue'
import { changeWay } from './const'
import { Tabs,FormModel} from 'ant-design-vue'
......@@ -185,15 +178,4 @@ export default Vue.extend({
.w-200{
width:200px
}
=======
import Vue from 'vue'
export default Vue.extend({
})
</script>
<style scoped>
>>>>>>> c85785174709d6a01b7b9e48a35a0b1688df9008
</style>
\ No newline at end of file
......@@ -13,21 +13,13 @@ module.exports = {
}
},
devServer: {
proxy: { // 设置代理
'/api': {
target: 'http://localhost:8999/news',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
},
// [IMAGE_PROXY]: {
// // target: 'http://47.114.159.142:7999',
// target: 'http://localhost:8999',
// pathRewrite: {
// ["^" + IMAGE_PROXY]: '',
// }
// }
}
},
proxy: {
"/proxyApi": {
target: 'http://172.16.102.150:8091',
pathRewrite: {
'^/proxyApi': '',
},
}
},
},
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment