Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
swx_weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-10-24 16:52:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
069fb84d1f4ad74f8a5d147e8525e2bb73428e4e
069fb84d
1 parent
9bb4a7cf
✨ feat: 新增陪伴记录API联调
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
21 deletions
src/api/Partner/index.js
src/pages/addRecord/index.vue
src/api/Partner/index.js
0 → 100644
View file @
069fb84
/*
* @Date: 2022-10-20 13:15:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-24 11:00:14
* @FilePath: /swx/src/api/Partner/index.js
* @Description: 陪伴用户
*/
import
{
fn
,
fetch
}
from
'../fn'
;
const
Api
=
{
ADD_PARTNER
:
'/srv/?a=partner_add'
,
}
/**
* @description: 新增陪伴记录
* @returns
*/
export
const
addPartnerAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
ADD_PARTNER
,
params
));
src/pages/addRecord/index.vue
View file @
069fb84
<!--
* @Date: 2022-09-30 09:53:14
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-
09-30 11:50:1
7
* @LastEditTime: 2022-
10-24 16:44:0
7
* @FilePath: /swx/src/pages/addRecord/index.vue
* @Description: 文件描述
-->
...
...
@@ -27,7 +27,7 @@
<view style="margin-right: 0; margin-top: 0.5rem;"><van-icon :name="icon_sel" color="" /></view>
</view>
</view>
<van-field :value="
messag
e" label-class="label-class" input-class="input-class" label="跟进内容" type="textarea"
<van-field :value="
not
e" label-class="label-class" input-class="input-class" label="跟进内容" type="textarea"
placeholder="请输入跟进记录详情" placeholder-style="color: #CCC; font-size: 1.05rem;" :autosize="{ maxHeight: 300, minHeight: 150 }" customStyle="" inputAlign=""
rightIcon="" :required="false" :border="false" @change="onChange" />
</view>
...
...
@@ -35,39 +35,61 @@
<bottom-button @on-submit="onSubmit">保存</bottom-button>
<!-- 陪伴状态弹出框 -->
<van-popup :show="show_popup" position="bottom" custom-style="height:
4
0%;" :lock-scroll="true">
<van-popup :show="show_popup" position="bottom" custom-style="height:
5
0%;" :lock-scroll="true">
<van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="columns" toolbar-class="picker-toolbar"
@confirm="onConfirm" @cancel="onCancel"
@change="onChange"
/>
@confirm="onConfirm" @cancel="onCancel" />
</van-popup>
<van-toast id="van-toast" />
</template>
<script setup>
import { ref } from "vue";
import { ref, onMounted } from "vue";
import icon_sel from '@/images/icon/sel@2x.png'
import bottomButton from "@/components/bottom-button";
import Taro from '@tarojs/taro'
import { hostInfoAPI } from '@/api/Host/index';
import { getCurrentPageParam } from "@/utils/weapp";
import { DEFAULT_HOST_STATUS } from '@/utils/sysData'
import { addPartnerAPI } from '@/api/Partner/index';
import Toast from '@/components/vant-weapp/toast/toast';
const username = ref('精妙');
const message = ref('');
const username = JSON.parse(getCurrentPageParam().name);
const columns = ref(DEFAULT_HOST_STATUS);
onMounted(async () => {
const { code, data } = await hostInfoAPI({ i: getCurrentPageParam().host_id });
if (code) {
columns.value = columns.value.concat(data.user_status);
}
});
const onSubmit = (val) => {
console.warn(val);
Taro.showToast({
title: '请检查输入项',
icon: 'error',
duration: 2000
});
Taro.redirectTo({
url: '../joinSuccess/index'
})
const onSubmit = async () => {
if (!user_status.value) {
Toast.fail('陪伴状态为空');
return false;
}
if (!note.value) {
Toast.fail('跟进内容为空');
return false;
}
const params = {
member_id: getCurrentPageParam().id,
status: user_status.value,
note: note.value
}
const { code, data } = await addPartnerAPI(params);
if (code) {
Toast.success('添加成功');
Taro.navigateBack();
}
}
const show_popup = ref(false);
const user_status = ref('');
const
columns = ref(['跟进', '引导']
);
const
note = ref(''
);
const onChange = (event) => {
const { picker, value, index }
= event.detail;
note.value
= event.detail;
}
const onConfirm = (event) => {
const { picker, value, index } = event.detail;
...
...
@@ -81,7 +103,10 @@ const onCancel = (event) => {
<script>
import "./index.less";
import mixin from '@/utils/mixin';
export default {
name: "demoPage",
name: "addRecordPage",
mixins: [mixin.init],
};
</script>
...
...
Please
register
or
login
to post a comment