Showing
4 changed files
with
59 additions
and
25 deletions
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-05-26 23:52:36 | 3 | * @Date: 2022-05-26 23:52:36 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-12-28 11:02:30 | 5 | + * @LastEditTime: 2023-02-24 15:17:24 |
| 6 | * @FilePath: /data-table/src/App.vue | 6 | * @FilePath: /data-table/src/App.vue |
| 7 | * @Description: | 7 | * @Description: |
| 8 | --> | 8 | --> |
| ... | @@ -62,9 +62,10 @@ watch( | ... | @@ -62,9 +62,10 @@ watch( |
| 62 | const is_pc = computed(() => wxInfo().isPC); | 62 | const is_pc = computed(() => wxInfo().isPC); |
| 63 | 63 | ||
| 64 | onMounted(async () => { | 64 | onMounted(async () => { |
| 65 | - // const { data } = await wxJsAPI(); | 65 | + const code = getUrlParams(location.href) ? getUrlParams(location.href).code : ''; |
| 66 | - // data.jsApiList = apiList; | 66 | + // const wxJs = await wxJsAPI({ form_code: code }); |
| 67 | - // wx.config(data); | 67 | + // wxJs.data.jsApiList = apiList; |
| 68 | + // wx.config(wxJs.data); | ||
| 68 | // wx.ready(() => { | 69 | // wx.ready(() => { |
| 69 | // wx.showAllNonBaseMenuItem(); | 70 | // wx.showAllNonBaseMenuItem(); |
| 70 | // }); | 71 | // }); |
| ... | @@ -72,7 +73,6 @@ onMounted(async () => { | ... | @@ -72,7 +73,6 @@ onMounted(async () => { |
| 72 | // console.warn(err); | 73 | // console.warn(err); |
| 73 | // }); | 74 | // }); |
| 74 | // 数据收集设置 | 75 | // 数据收集设置 |
| 75 | - const code = getUrlParams(location.href) ? getUrlParams(location.href).code : ''; | ||
| 76 | const { data } = await getFormSettingAPI({ form_code: code }); | 76 | const { data } = await getFormSettingAPI({ form_code: code }); |
| 77 | const form_setting = {}; | 77 | const form_setting = {}; |
| 78 | if (data.length) { | 78 | if (data.length) { | ... | ... |
| ... | @@ -2,8 +2,8 @@ | ... | @@ -2,8 +2,8 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-06-09 13:32:44 | 3 | * @Date: 2022-06-09 13:32:44 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-06-14 14:47:01 | 5 | + * @LastEditTime: 2023-02-23 18:42:57 |
| 6 | - * @FilePath: /tswj/src/api/wx/config.js | 6 | + * @FilePath: /data-table/src/api/wx/config.js |
| 7 | * @Description: | 7 | * @Description: |
| 8 | */ | 8 | */ |
| 9 | import { fn, fetch } from '@/api/fn'; | 9 | import { fn, fetch } from '@/api/fn'; | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-08-29 14:31:20 | 2 | * @Date: 2022-08-29 14:31:20 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-02-07 10:40:40 | 4 | + * @LastEditTime: 2023-02-24 15:14:35 |
| 5 | * @FilePath: /data-table/src/components/TextField/index.vue | 5 | * @FilePath: /data-table/src/components/TextField/index.vue |
| 6 | * @Description: 单行文本输入框 | 6 | * @Description: 单行文本输入框 |
| 7 | --> | 7 | --> |
| ... | @@ -11,26 +11,25 @@ | ... | @@ -11,26 +11,25 @@ |
| 11 | <span v-if="item.component_props.required"> *</span> | 11 | <span v-if="item.component_props.required"> *</span> |
| 12 | {{ item.component_props.label }} | 12 | {{ item.component_props.label }} |
| 13 | </div> | 13 | </div> |
| 14 | - <div | 14 | + <div v-if="item.component_props.note" v-html="item.component_props.note" |
| 15 | - v-if="item.component_props.note" | 15 | + style="font-size: 0.9rem; margin-left: 1rem; color: gray; padding-bottom: 0.5rem; padding-top: 0.25rem; white-space: pre-wrap;" /> |
| 16 | - v-html="item.component_props.note" | 16 | + <van-field v-model="item.value" :name="item.name" :type="item.type" |
| 17 | - style="font-size: 0.9rem; margin-left: 1rem; color: gray; padding-bottom: 0.5rem; padding-top: 0.25rem; white-space: pre-wrap;" | 17 | + :placeholder="item.component_props.placeholder ? item.component_props.placeholder : '请输入'" :rules="item.rules" |
| 18 | - /> | 18 | + :required="item.required" :readonly="item.component_props.readonly" :disabled="item.component_props.disabled" |
| 19 | - <van-field | 19 | + :input-align="item.component_props.align" :right-icon="test === 'camera' ? 'scan' : ''" |
| 20 | - v-model="item.value" | 20 | + @click-right-icon="clickRightIcon" /> |
| 21 | - :name="item.name" | ||
| 22 | - :type="item.type" | ||
| 23 | - :placeholder="item.component_props.placeholder ? item.component_props.placeholder : '请输入'" | ||
| 24 | - :rules="item.rules" | ||
| 25 | - :required="item.required" | ||
| 26 | - :readonly="item.component_props.readonly" | ||
| 27 | - :disabled="item.component_props.disabled" | ||
| 28 | - :input-align="item.component_props.align" | ||
| 29 | - /> | ||
| 30 | </div> | 21 | </div> |
| 31 | </template> | 22 | </template> |
| 32 | 23 | ||
| 33 | <script setup> | 24 | <script setup> |
| 25 | +import { useRoute } from "vue-router"; | ||
| 26 | +import { showSuccessToast, showFailToast } from 'vant'; | ||
| 27 | +// 初始化WX环境 | ||
| 28 | +import wx from 'weixin-js-sdk' | ||
| 29 | +import { wxJsAPI } from '@/api/wx/config' | ||
| 30 | +import { apiList } from '@/api/wx/jsApiList.js' | ||
| 31 | +import { wxInfo, getUrlParams } from "@/utils/tools"; | ||
| 32 | + | ||
| 34 | const props = defineProps({ | 33 | const props = defineProps({ |
| 35 | item: Object, | 34 | item: Object, |
| 36 | }); | 35 | }); |
| ... | @@ -38,6 +37,40 @@ const props = defineProps({ | ... | @@ -38,6 +37,40 @@ const props = defineProps({ |
| 38 | const HideShow = computed(() => { | 37 | const HideShow = computed(() => { |
| 39 | return !props.item.component_props.disabled | 38 | return !props.item.component_props.disabled |
| 40 | }) | 39 | }) |
| 40 | + | ||
| 41 | +const $route = useRoute(); | ||
| 42 | +const test = $route.query.test; | ||
| 43 | + | ||
| 44 | +const clickRightIcon = async () => { | ||
| 45 | + const code = getUrlParams(location.href) ? getUrlParams(location.href).code : ''; | ||
| 46 | + const wxJs = await wxJsAPI({ form_code: code }); | ||
| 47 | + wxJs.data.jsApiList = apiList; | ||
| 48 | + wx.config(wxJs.data); | ||
| 49 | + wx.ready(() => { | ||
| 50 | + wx.scanQRCode({ | ||
| 51 | + needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, | ||
| 52 | + scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有 | ||
| 53 | + success: function (res) { | ||
| 54 | + if (res.errMsg === 'scanQRCode:ok') { | ||
| 55 | + let code = res.resultStr; | ||
| 56 | + let code_arr = code.split(","); | ||
| 57 | + console.warn(code_arr); | ||
| 58 | + } else { | ||
| 59 | + console.warn('扫描失败'); | ||
| 60 | + } | ||
| 61 | + }, | ||
| 62 | + error: function (res) { | ||
| 63 | + if (res.errMsg.indexOf('function_not_exist') > 0) { | ||
| 64 | + alert('版本过低请升级') | ||
| 65 | + } | ||
| 66 | + alert(res.errMsg); | ||
| 67 | + }, | ||
| 68 | + }); | ||
| 69 | + }); | ||
| 70 | + wx.error((err) => { | ||
| 71 | + console.warn(err); | ||
| 72 | + }); | ||
| 73 | +} | ||
| 41 | </script> | 74 | </script> |
| 42 | 75 | ||
| 43 | <style lang="less" scoped> | 76 | <style lang="less" scoped> |
| ... | @@ -46,6 +79,7 @@ const HideShow = computed(() => { | ... | @@ -46,6 +79,7 @@ const HideShow = computed(() => { |
| 46 | padding: 1rem 1rem 0 1rem; | 79 | padding: 1rem 1rem 0 1rem; |
| 47 | font-size: 0.9rem; | 80 | font-size: 0.9rem; |
| 48 | font-weight: bold; | 81 | font-weight: bold; |
| 82 | + | ||
| 49 | span { | 83 | span { |
| 50 | color: red; | 84 | color: red; |
| 51 | } | 85 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-07-18 10:22:22 | 2 | * @Date: 2022-07-18 10:22:22 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-02-22 10:56:40 | 4 | + * @LastEditTime: 2023-02-23 15:41:13 |
| 5 | * @FilePath: /data-table/src/views/index.vue | 5 | * @FilePath: /data-table/src/views/index.vue |
| 6 | * @Description: 首页 | 6 | * @Description: 首页 |
| 7 | --> | 7 | --> | ... | ... |
-
Please register or login to post a comment