Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-05-09 10:46:56 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e0b1c161f4257d6ce1547b6522305ee1c1c296cd
e0b1c161
1 parent
ce30a24c
✨ feat(新增儿童页面): 页面接口预联调
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
29 deletions
src/main.js
src/views/me/addUser.vue
src/main.js
View file @
e0b1c16
import
{
createApp
}
from
'vue'
;
import
{
Button
,
Image
as
VanImage
,
Col
,
Row
,
Icon
,
Form
,
Field
,
CellGroup
,
ConfigProvider
,
Toast
,
Uploader
,
Empty
,
Tab
,
Tabs
,
Overlay
,
NumberKeyboard
,
Lazyload
,
List
,
PullRefresh
,
Popup
,
Picker
,
Sticky
,
Stepper
,
Tag
,
Swipe
,
SwipeItem
,
Dialog
}
from
'vant'
;
import
{
Button
,
Image
as
VanImage
,
Col
,
Row
,
Icon
,
Form
,
Field
,
CellGroup
,
ConfigProvider
,
Toast
,
Uploader
,
Empty
,
Tab
,
Tabs
,
Overlay
,
NumberKeyboard
,
Lazyload
,
List
,
PullRefresh
,
Popup
,
Picker
,
Sticky
,
Stepper
,
Tag
,
Swipe
,
SwipeItem
,
Dialog
,
ActionSheet
}
from
'vant'
;
import
router
from
'./router'
;
import
App
from
'./App.vue'
;
// import axios from './utils/axios';
...
...
@@ -39,6 +39,7 @@ app.use(Tag);
app
.
use
(
Swipe
);
app
.
use
(
SwipeItem
);
app
.
use
(
Dialog
);
app
.
use
(
ActionSheet
);
app
.
use
(
ConfigProvider
);
...
...
src/views/me/addUser.vue
View file @
e0b1c16
...
...
@@ -32,9 +32,9 @@ import { v4 as uuidv4 } from 'uuid';
import { ref, reactive, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import qs from 'Qs'
import $ from 'jquery'
import { Toast } from 'vant';
const $route = useRoute();
const $router = useRouter();
...
...
@@ -48,20 +48,6 @@ const onSubmit = (values) => {
// console.log('submit', values);
};
// const uuid = () => {
// let s = [];
// let hexDigits = '0123456789abcdef';
// for (var i = 0; i < 36; i++) {
// s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
// }
// s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010
// s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
// s[8] = s[13] = s[18] = s[23] = '-';
// var uuid = s.join('');
// return uuid;
// }
// 图片模块
let lock_btn = ref(false); // 保存按钮锁
let fileList = ref([]);
...
...
@@ -73,12 +59,11 @@ const afterRead = (res) => {
// 此时可以自行将文件上传至服务器
let dataURL = res.content;
let base64url = dataURL.slice(dataURL.indexOf(',') + 1); // 截取前缀的base64 data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnoAAAJeCAYAA.......
// 获取七牛token
axios.post('/srv/?f=shzl_comment&a=upload',
qs.stringify({
//TODO: 获取七牛token
axios.post('/srv/?f=shzl_comment&a=upload', {
filename: `${affix}_${res.file.name}`,
file: base64url
})
)
})
.then(res => {
if (res.statusText === 'OK') {
let config = {
...
...
@@ -92,14 +77,14 @@ const afterRead = (res) => {
.then(res => {
if (res.data.filekey) {
let info = res.data;
axios.post('/srv/?f=shzl_comment&a=upload&t=save_file',
qs.stringify(
{
// TODO: 保存图片返回ID
axios.post('/srv/?f=shzl_comment&a=upload&t=save_file',
{
format: info.image_info.format,
hash: info.hash,
height: info.image_info.height,
width: info.image_info.width,
filekey: info.filekey,
})
)
})
.then(res => {
upload_image.meta_id = res.data.data.meta_id;
lock_btn.value = false; // 头像上传完成, 打开锁
...
...
@@ -137,7 +122,8 @@ const beforeDelete = () => { // 删除图片回调
}
let user_info = reactive({
kindergarten: '杨浦民办科技幼稚园',
kg_id: $route.query.kg_id,
kindergarten: $route.query.kg_name,
name: '',
meta_id: ''
});
...
...
@@ -149,12 +135,13 @@ onMounted(() => {
// 保存用户信息
const saveInfo = () => {
axios.post('/srv/?f=shzl_comment&a=user&t=edit',
qs.stringify({
kindergarten: user_info.kindergarten,
name: user_info.name,
// TODO: 以前接口保存的是一个ID,看后端怎么处理, perf_avatar看样子是一个图片地址
axios.post('/srv/?f=shzl_comment&a=user&t=edit', {
kg_id: user_info.kg_id,
perf_name: user_info.name,
// perf_avatar: upload_image.meta_id ? upload_image.meta_id : user_info.meta_id,
meta_id: upload_image.meta_id ? upload_image.meta_id : user_info.meta_id,
})
)
})
.then(res => {
if (res.data.code === 1) {
Toast.success({
...
...
Please
register
or
login
to post a comment