Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
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-02-24 15:31:06 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1dd8fa4426424ebe81b7dfdf06dc80fc5a6fbab5
1dd8fa44
1 parent
fcc47b62
引入微信功能
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
25 deletions
src/App.vue
src/api/wx/config.js
src/components/TextField/index.vue
src/views/index.vue
src/App.vue
View file @
1dd8fa4
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-26 23:52:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 202
2-12-28 11:02:30
* @LastEditTime: 202
3-02-24 15:17:24
* @FilePath: /data-table/src/App.vue
* @Description:
-->
...
...
@@ -62,9 +62,10 @@ watch(
const is_pc = computed(() => wxInfo().isPC);
onMounted(async () => {
// const { data } = await wxJsAPI();
// data.jsApiList = apiList;
// wx.config(data);
const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
// const wxJs = await wxJsAPI({ form_code: code });
// wxJs.data.jsApiList = apiList;
// wx.config(wxJs.data);
// wx.ready(() => {
// wx.showAllNonBaseMenuItem();
// });
...
...
@@ -72,7 +73,6 @@ onMounted(async () => {
// console.warn(err);
// });
// 数据收集设置
const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
const { data } = await getFormSettingAPI({ form_code: code });
const form_setting = {};
if (data.length) {
...
...
src/api/wx/config.js
View file @
1dd8fa4
...
...
@@ -2,8 +2,8 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-06-09 13:32:44
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 202
2-06-14 14:47:01
* @FilePath: /
tswj
/src/api/wx/config.js
* @LastEditTime: 202
3-02-23 18:42:57
* @FilePath: /
data-table
/src/api/wx/config.js
* @Description:
*/
import
{
fn
,
fetch
}
from
'@/api/fn'
;
...
...
src/components/TextField/index.vue
View file @
1dd8fa4
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-02-
07 10:40:40
* @LastEditTime: 2023-02-
24 15:14:35
* @FilePath: /data-table/src/components/TextField/index.vue
* @Description: 单行文本输入框
-->
...
...
@@ -11,26 +11,25 @@
<span v-if="item.component_props.required"> *</span>
{{ item.component_props.label }}
</div>
<div
v-if="item.component_props.note"
v-html="item.component_props.note"
style="font-size: 0.9rem; margin-left: 1rem; color: gray; padding-bottom: 0.5rem; padding-top: 0.25rem; white-space: pre-wrap;"
/>
<van-field
v-model="item.value"
:name="item.name"
:type="item.type"
:placeholder="item.component_props.placeholder ? item.component_props.placeholder : '请输入'"
:rules="item.rules"
:required="item.required"
:readonly="item.component_props.readonly"
:disabled="item.component_props.disabled"
:input-align="item.component_props.align"
/>
<div v-if="item.component_props.note" v-html="item.component_props.note"
style="font-size: 0.9rem; margin-left: 1rem; color: gray; padding-bottom: 0.5rem; padding-top: 0.25rem; white-space: pre-wrap;" />
<van-field v-model="item.value" :name="item.name" :type="item.type"
:placeholder="item.component_props.placeholder ? item.component_props.placeholder : '请输入'" :rules="item.rules"
:required="item.required" :readonly="item.component_props.readonly" :disabled="item.component_props.disabled"
:input-align="item.component_props.align" :right-icon="test === 'camera' ? 'scan' : ''"
@click-right-icon="clickRightIcon" />
</div>
</template>
<script setup>
import { useRoute } from "vue-router";
import { showSuccessToast, showFailToast } from 'vant';
// 初始化WX环境
import wx from 'weixin-js-sdk'
import { wxJsAPI } from '@/api/wx/config'
import { apiList } from '@/api/wx/jsApiList.js'
import { wxInfo, getUrlParams } from "@/utils/tools";
const props = defineProps({
item: Object,
});
...
...
@@ -38,6 +37,40 @@ const props = defineProps({
const HideShow = computed(() => {
return !props.item.component_props.disabled
})
const $route = useRoute();
const test = $route.query.test;
const clickRightIcon = async () => {
const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
const wxJs = await wxJsAPI({ form_code: code });
wxJs.data.jsApiList = apiList;
wx.config(wxJs.data);
wx.ready(() => {
wx.scanQRCode({
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
success: function (res) {
if (res.errMsg === 'scanQRCode:ok') {
let code = res.resultStr;
let code_arr = code.split(",");
console.warn(code_arr);
} else {
console.warn('扫描失败');
}
},
error: function (res) {
if (res.errMsg.indexOf('function_not_exist') > 0) {
alert('版本过低请升级')
}
alert(res.errMsg);
},
});
});
wx.error((err) => {
console.warn(err);
});
}
</script>
<style lang="less" scoped>
...
...
@@ -46,6 +79,7 @@ const HideShow = computed(() => {
padding: 1rem 1rem 0 1rem;
font-size: 0.9rem;
font-weight: bold;
span {
color: red;
}
...
...
src/views/index.vue
View file @
1dd8fa4
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-02-2
2 10:56:40
* @LastEditTime: 2023-02-2
3 15:41:13
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
Please
register
or
login
to post a comment