Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
custom_form
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
2023-03-24 16:13:28 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
853f138e41265964c6e4d4738ee3faaa11a9c639
853f138e
1 parent
33b8ba85
h5和小程序获取表单配置调整
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
10 deletions
src/app.config.js
src/app.js
src/pages/index/index.vue
src/pages/table/index.vue
src/app.config.js
View file @
853f138
/*
* @Date: 2023-03-23 11:17:54
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-03-24 1
3:13:44
* @LastEditTime: 2023-03-24 1
6:01:10
* @FilePath: /custom_form/src/app.config.js
* @Description: 文件描述
*/
...
...
src/app.js
View file @
853f138
/*
* @Date: 2023-03-23 11:17:54
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-03-24 1
4:14:27
* @LastEditTime: 2023-03-24 1
6:04:21
* @FilePath: /custom_form/src/app.js
* @Description: 文件描述
*/
import
{
createApp
}
from
'vue'
import
{
createPinia
}
from
'pinia'
import
'./app.less'
import
{
mainStore
}
from
'@/stores'
import
{
getFormSettingAPI
}
from
'@/api/form.js'
import
{
getUrlParams
}
from
'@/utils/tools'
const
App
=
createApp
({
// 可以使用所有的 Vue 生命周期方法
mounted
()
{
async
mounted
()
{
if
(
process
.
env
.
TARO_ENV
===
'h5'
)
{
const
code
=
getUrlParams
(
location
.
href
)
?
getUrlParams
(
location
.
href
).
code
:
''
const
store
=
mainStore
();
// 数据收集设置
const
{
data
}
=
await
getFormSettingAPI
({
form_code
:
code
});
const
form_setting
=
{};
if
(
data
.
length
)
{
Object
.
assign
(
form_setting
,
data
[
0
][
'property_list'
],
data
[
0
][
'extend'
]);
}
// 缓存表单设置
store
.
changeFormSetting
(
form_setting
);
}
},
// 对应 onLaunch
...
...
src/pages/index/index.vue
View file @
853f138
...
...
@@ -8,15 +8,15 @@
<script setup>
import { ref, computed, watchEffect, onMounted } from "vue";
import Taro from '@tarojs/taro'
import { mainStore } from '@/stores'
import { wxInfo, getUrlParams } from "@/utils/tools";
// 初始化WX环境
import wx from 'weixin-js-sdk'
import { wxJsAPI } from '@/api/wx/config'
import { apiList } from '@/api/wx/jsApiList.js'
import { styleColor } from "@/constant.js";
import { getFormSettingAPI } from "@/api/form.js";
import { mainStore } from '@/stores'
import { getFormSettingAPI } from '@/api/form.js'
import Taro from '@tarojs/taro'
// TAG: 自定义主题颜色
const themeVars = {
...
...
@@ -37,7 +37,6 @@ const onOk = () => {
onMounted(async () => {
const store = mainStore();
const raw_url = encodeURIComponent(location.pathname + location.hash);
// 数据收集设置
const { data } = await getFormSettingAPI({ form_code: code });
const form_setting = {};
...
...
@@ -46,6 +45,8 @@ onMounted(async () => {
}
// 缓存表单设置
store.changeFormSetting(form_setting);
const raw_url = encodeURIComponent(location.pathname + location.hash);
// 没有授权判断
const no_auth_info = form_setting.wxzq_enable && !form_setting.x_field_weixin_openid;
const no_preview_model = model !== 'preview';
...
...
src/pages/table/index.vue
View file @
853f138
<!--
* @Date: 2023-03-24 09:19:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-03-24 15:
19:34
* @FilePath: /custom_form/src/pages/
table
/index.vue
* @LastEditTime: 2023-03-24 15:
55:18
* @FilePath: /custom_form/src/pages/
index
/index.vue
* @Description: 文件描述
-->
<template>
...
...
@@ -13,7 +13,7 @@
</template>
<script setup>
import Taro from '@tarojs/taro'
import Taro
, { useLoad }
from '@tarojs/taro'
import { $ } from '@tarojs/extend'
import { createComponentType } from "@/hooks/useComponentType";
import { ref, computed, watchEffect, onMounted } from "vue";
...
...
@@ -125,6 +125,7 @@ onMounted(async () => {
// TAG: 全局背景色
$('body').css('background-color', styleColor.backgroundColor)
const { data } = await queryFormAPI({ form_code });
const form_data = data;
// 动态修改标题
Taro.setNavigationBarTitle({
...
...
Please
register
or
login
to post a comment