Merge pull request 'xbx' (#46) from xbx into master
Reviewed-on: http://git.luyuan.tk/luyuan/beelink/pulls/46
This commit is contained in:
commit
b92d59b01d
@ -11,6 +11,7 @@ export interface Get {
|
|||||||
}
|
}
|
||||||
|
|
||||||
axios.interceptors.response.use((response)=>{
|
axios.interceptors.response.use((response)=>{
|
||||||
|
console.log(response)
|
||||||
if(response.data.code == 1001){
|
if(response.data.code == 1001){
|
||||||
router.push("/")
|
router.push("/")
|
||||||
}
|
}
|
||||||
@ -35,6 +36,12 @@ const del: Get = async function (url: string, data?: unknown){
|
|||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const put: Get = async function (url: string, data?: unknown){
|
||||||
|
const res = await axios.put(url, {params:data})
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function setToken(){
|
function setToken(){
|
||||||
axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token");
|
axios.defaults.headers.common['Authorization'] = "Bearer " + getValue("token");
|
||||||
}
|
}
|
||||||
@ -43,5 +50,6 @@ export {
|
|||||||
get,
|
get,
|
||||||
post,
|
post,
|
||||||
del,
|
del,
|
||||||
|
put,
|
||||||
setToken
|
setToken
|
||||||
}
|
}
|
@ -37,7 +37,7 @@ export async function userinfo(){
|
|||||||
const user = await get<UserInfo>('personalInfo');
|
const user = await get<UserInfo>('personalInfo');
|
||||||
// console.log(user.data.img)
|
// console.log(user.data.img)
|
||||||
if(user.code == 1001){
|
if(user.code == 1001){
|
||||||
// router.push("/")
|
router.push("/")
|
||||||
return '未登录';
|
return '未登录';
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@ -277,7 +277,7 @@ export async function sendsms(phone: string, type: number): Promise<boolean>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取国家数据
|
* 获取国家与语言数据
|
||||||
*/
|
*/
|
||||||
|
|
||||||
interface Countries{
|
interface Countries{
|
||||||
@ -296,3 +296,24 @@ export async function getarchives(): Promise<[Countries[],Willsay[]]>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端语言
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface Language {
|
||||||
|
dictionaryid: number;
|
||||||
|
name: string;
|
||||||
|
alias: string;
|
||||||
|
code :string;
|
||||||
|
position: number;
|
||||||
|
publish: number;
|
||||||
|
value: string;
|
||||||
|
deleted_at: null;
|
||||||
|
created_at: string;
|
||||||
|
updated_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getlanguages(): Promise<Language[]>{
|
||||||
|
|
||||||
|
return (await get<Language[]>("languages")).data;
|
||||||
|
}
|
@ -56,7 +56,9 @@ export default createStore({
|
|||||||
actions: {
|
actions: {
|
||||||
async setUserInfo({ commit }){
|
async setUserInfo({ commit }){
|
||||||
const user = await userinfo();
|
const user = await userinfo();
|
||||||
commit('setUserInfo', user);
|
if(user != '未登录'){
|
||||||
|
commit('setUserInfo', user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modules: {
|
modules: {
|
||||||
|
@ -94,9 +94,19 @@
|
|||||||
<a-upload
|
<a-upload
|
||||||
list-type="picture"
|
list-type="picture"
|
||||||
:customRequest="uploads"
|
:customRequest="uploads"
|
||||||
|
:beforeUpload="beforeVideoUpload"
|
||||||
>
|
>
|
||||||
<div class="upload-image">
|
<div class="upload-image">
|
||||||
<PlaySquareOutlined style="fontSize: 22px;" />
|
<PlaySquareOutlined
|
||||||
|
style="fontsize: 22px"
|
||||||
|
v-if="uploadprogress == 0"
|
||||||
|
/>
|
||||||
|
<a-progress
|
||||||
|
type="circle"
|
||||||
|
:percent="uploadprogress"
|
||||||
|
:width="80"
|
||||||
|
v-else
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
<div class="demand">
|
<div class="demand">
|
||||||
@ -171,8 +181,8 @@
|
|||||||
ref="select"
|
ref="select"
|
||||||
:getPopupContainer="triggerNode => triggerNode.parentNode"
|
:getPopupContainer="triggerNode => triggerNode.parentNode"
|
||||||
>
|
>
|
||||||
<a-select-option v-for="(item, index) in ['英语', '中文']" :key="index" :value="item">
|
<a-select-option v-for="(item, index) in languages" :key="index" :value="item.name">
|
||||||
{{ item }}
|
{{ item.name }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</div>
|
</div>
|
||||||
@ -259,14 +269,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, onMounted, reactive, Ref, ref } from "vue";
|
import { computed, defineComponent, onMounted, reactive, Ref, ref, toRaw, watch } from "vue";
|
||||||
import { UserOutlined, PlaySquareOutlined } from '@ant-design/icons-vue';
|
import { UserOutlined, PlaySquareOutlined } from '@ant-design/icons-vue';
|
||||||
import NavBottom from '@/components/NavBottom.vue';
|
import NavBottom from '@/components/NavBottom.vue';
|
||||||
import { uploadflie } from "@/utils/vod"
|
import { uploadflie } from "@/utils/vod"
|
||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
import smile from "@/static/images/smile.png"
|
import smile from "@/static/images/smile.png"
|
||||||
import smilet from "@/static/images/smilet.png"
|
import smilet from "@/static/images/smilet.png"
|
||||||
import { getarchives } from "@/api/index"
|
import { getarchives, getlanguages } from "@/api/index"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Archives",
|
name: "Archives",
|
||||||
@ -291,8 +301,10 @@ export default defineComponent({
|
|||||||
const modalNode = () => document.getElementsByClassName('modal-container')[0]
|
const modalNode = () => document.getElementsByClassName('modal-container')[0]
|
||||||
|
|
||||||
const chiveslist = ref<unknown>([[],[]]);
|
const chiveslist = ref<unknown>([[],[]]);
|
||||||
|
const languages = ref<unknown>([])
|
||||||
onMounted(async ()=>{
|
onMounted(async ()=>{
|
||||||
chiveslist.value = await getarchives()
|
chiveslist.value = await getarchives()
|
||||||
|
languages.value = await getlanguages()
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -420,20 +432,11 @@ export default defineComponent({
|
|||||||
* @return { void }
|
* @return { void }
|
||||||
*/
|
*/
|
||||||
function submitInfo (): void {
|
function submitInfo (): void {
|
||||||
console.log('12');
|
console.log(toRaw(formData.value));
|
||||||
|
|
||||||
}
|
}
|
||||||
interface AntUpload{
|
|
||||||
action: string;
|
|
||||||
data: unknown;
|
|
||||||
file: File;
|
|
||||||
}
|
|
||||||
async function uploads(file: AntUpload){
|
|
||||||
let res = await uploadflie(file.file, (info) => {
|
|
||||||
console.log(info)
|
|
||||||
});
|
|
||||||
console.log(res)
|
|
||||||
}
|
|
||||||
// uploadflie()3.
|
// uploadflie()3.
|
||||||
|
|
||||||
function setlevel(index: number, level: number){
|
function setlevel(index: number, level: number){
|
||||||
@ -441,6 +444,33 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传视频
|
||||||
|
*/
|
||||||
|
interface AntUpload{
|
||||||
|
action: string;
|
||||||
|
data: unknown;
|
||||||
|
file: File;
|
||||||
|
}
|
||||||
|
const uploadprogress: Ref<number> = ref(0);
|
||||||
|
async function uploads(file: AntUpload) {
|
||||||
|
uploadprogress.value=0
|
||||||
|
|
||||||
|
let res = await uploadflie(file.file, (info: any) => {
|
||||||
|
console.log(info);
|
||||||
|
uploadprogress.value = info.percent.toFixed(2) * 100;
|
||||||
|
});
|
||||||
|
userinfo.value.video = res.video.url;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(formData.value.video != ""){
|
||||||
|
uploadprogress.value = 100
|
||||||
|
}
|
||||||
|
watch(formData,()=>{
|
||||||
|
if(formData.value.video != "" && uploadprogress.value == 0){
|
||||||
|
uploadprogress.value = 100
|
||||||
|
}
|
||||||
|
})
|
||||||
return {
|
return {
|
||||||
modalNode,
|
modalNode,
|
||||||
formData,
|
formData,
|
||||||
@ -467,7 +497,9 @@ export default defineComponent({
|
|||||||
smile,
|
smile,
|
||||||
smilet,
|
smilet,
|
||||||
setlevel,
|
setlevel,
|
||||||
chiveslist
|
chiveslist,
|
||||||
|
languages,
|
||||||
|
uploadprogress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -749,5 +781,8 @@ export default defineComponent({
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
::v-deep(.ant-upload-list) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -64,18 +64,18 @@
|
|||||||
<!-- 文件列表 -->
|
<!-- 文件列表 -->
|
||||||
<div v-if="form.video[0].length">
|
<div v-if="form.video[0].length">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in form.video"
|
v-for="(item, index) in form.video"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="video-list"
|
class="video-list"
|
||||||
>
|
>
|
||||||
<img src="@/static/images/link.png" class="link" />
|
<img src="@/static/images/link.png" class="link" />
|
||||||
<span class="one-line-hide">{{ item.split('/')[item.split('/').length-1] }}</span>
|
<span class="one-line-hide">{{ item.split('/')[item.split('/').length-1] }}</span>
|
||||||
<img
|
<img
|
||||||
src="@/static/images/delete.png"
|
src="@/static/images/delete.png"
|
||||||
@click="removeFile(0)"
|
@click="removeFile(0)"
|
||||||
class="del"
|
class="del"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="demand">
|
<div class="demand">
|
||||||
|
Loading…
Reference in New Issue
Block a user