@uxda/appkit 4.2.57 → 4.2.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import '@nutui/nutui-taro/dist/packages/checkbox/style/css';
4
4
  import { defineComponent, reactive, createBlock, openBlock, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createTextVNode, ref, computed, onUnmounted, createCommentVNode, renderSlot, createVNode, normalizeStyle, unref, isRef, onMounted, createStaticVNode, watch, withDirectives, vShow, useModel, mergeModels, resolveComponent, vModelText, watchPostEffect, withModifiers } from 'vue';
5
5
  import '@nutui/nutui-taro/dist/packages/grid/style/css';
6
6
  import '@nutui/nutui-taro/dist/packages/griditem/style/css';
7
- import Taro, { getSystemInfoSync, getMenuButtonBoundingClientRect, request as request$1, showToast, chooseMedia, chooseMessageFile, showLoading, uploadFile, hideLoading, useDidShow, useRouter } from '@tarojs/taro';
7
+ import Taro, { getSystemInfoSync, getMenuButtonBoundingClientRect, uploadFile, request as request$1, showToast, chooseMedia, chooseMessageFile, showLoading, hideLoading, useDidShow, showModal, getStorageSync, chooseImage, useRouter } from '@tarojs/taro';
8
8
  import '@nutui/nutui-taro/dist/packages/popup/style/css';
9
9
  import isMobilePhone from 'validator/es/lib/isMobilePhone';
10
10
  import isIdentityCard from 'validator/es/lib/isIdentityCard';
@@ -290,6 +290,25 @@ function useEncode() {
290
290
  };
291
291
  }
292
292
 
293
+ const globalData = {};
294
+
295
+ const appKitOptions = {
296
+ app: () => "",
297
+ tenant: () => "",
298
+ token: () => "",
299
+ tempToken: () => "",
300
+ baseUrl: () => "",
301
+ 401() {
302
+ },
303
+ gray: () => ""
304
+ };
305
+ const useAppKitOptions = () => {
306
+ if (!globalData.$appKitOptions) {
307
+ globalData.$appKitOptions = appKitOptions;
308
+ }
309
+ return globalData.$appKitOptions;
310
+ };
311
+
293
312
  const mappings = {
294
313
  downloadUrl: "thrumb",
295
314
  fileId: "id",
@@ -303,14 +322,21 @@ const transformFields = (row) => {
303
322
  return Object.fromEntries(Object.entries(row).map(([k, v]) => [mappings[k] || k, v]));
304
323
  };
305
324
  const useUpload = (config) => {
325
+ const appkitOptions = useAppKitOptions();
326
+ console.log("===config", config);
306
327
  const upload = (url, file) => {
307
328
  return new Promise((resolve, reject) => {
308
- Taro.uploadFile({
329
+ console.log(file, "----file");
330
+ uploadFile({
309
331
  url: config.baseUrl + url,
310
332
  filePath: file.path,
311
333
  name: "file",
312
- header: config.headers ?? {
313
- token: Taro.getStorageSync("session")
334
+ formData: {
335
+ objectNo: `min${Date.now()}`
336
+ },
337
+ header: {
338
+ ...config.headers,
339
+ token: appkitOptions.tempToken() || appkitOptions.token()
314
340
  },
315
341
  success: (rsp) => {
316
342
  const { data } = rsp;
@@ -372,25 +398,6 @@ function useCrypto(config) {
372
398
  };
373
399
  }
374
400
 
375
- const globalData = {};
376
-
377
- const appKitOptions = {
378
- app: () => "",
379
- tenant: () => "",
380
- token: () => "",
381
- tempToken: () => "",
382
- baseUrl: () => "",
383
- 401() {
384
- },
385
- gray: () => ""
386
- };
387
- const useAppKitOptions = () => {
388
- if (!globalData.$appKitOptions) {
389
- globalData.$appKitOptions = appKitOptions;
390
- }
391
- return globalData.$appKitOptions;
392
- };
393
-
394
401
  const defaultLogOptions = {
395
402
  projectName: "ddyk-dev",
396
403
  logStore: "ddjf-internet-web",
@@ -1169,8 +1176,19 @@ var script$D = /* @__PURE__ */ defineComponent({
1169
1176
  onUploadFile(csRes);
1170
1177
  }
1171
1178
  }
1172
- function onPhotograph() {
1179
+ async function onPhotograph() {
1173
1180
  if (props.disabled) return;
1181
+ if (Taro.getEnv() === "WEB") {
1182
+ const csRes = await chooseMedia({
1183
+ count: 1,
1184
+ sourceType: ["album"],
1185
+ // "camera" | "album"
1186
+ maxDuration: 60
1187
+ // 使用duration属性判断是图片还是视频,图片没有该属性
1188
+ });
1189
+ onUploadFile(csRes);
1190
+ return;
1191
+ }
1174
1192
  activeSheetVisible.value = true;
1175
1193
  }
1176
1194
  return (_ctx, _cache) => {
@@ -1252,7 +1270,7 @@ var script$C = /* @__PURE__ */ defineComponent({
1252
1270
  console.log("===onIconClick");
1253
1271
  let result = null;
1254
1272
  try {
1255
- const csRes = await Taro.chooseMedia({
1273
+ const csRes = await chooseMedia({
1256
1274
  count: 1,
1257
1275
  sourceType: ["album", "camera"]
1258
1276
  });
@@ -1428,14 +1446,6 @@ const endpointsList$2 = {
1428
1446
  * http://ytech.dev.ddjf.info/payment/doc.html#/%E5%AE%A2%E6%88%B7%E5%9F%9FAPI/%E6%94%AF%E4%BB%98%E4%B8%AD%E5%BF%83-%E5%AF%B9%E5%A4%96%E6%8E%A5%E5%8F%A3/rechargePayUsingPOST
1429
1447
  */
1430
1448
  \u83B7\u53D6\u5FAE\u4FE1\u652F\u4ED8\u53C2\u6570\u5305: {
1431
- // {
1432
- // "amount": 100,
1433
- // "appCode": "crm",
1434
- // "caseCode": "aiApproveRecharge",
1435
- // "tenantId": "17454646",
1436
- // "transFlowNo": "4343244",
1437
- // "certificateNo": "o7k8L0QTqcwRIBKVUPzI7iPfghLM"
1438
- // }
1439
1449
  path: "/payment/outer/payment/rechargePay",
1440
1450
  translate: (params) => ({
1441
1451
  amount: params.amount,
@@ -3968,7 +3978,7 @@ var script$l = /* @__PURE__ */ defineComponent({
3968
3978
  rebate: "\u63A8\u8350\u670B\u53CB\u4F7F\u7528\u5317\u6597\u661F\u3001\u4F01\u660E\u661F\u83B7\u53D6\uFF0C\u8FD4\u4F63\u6536\u76CA= \u8FD4\u4F63\u57FA\u6570 * \u8FD4\u4F63\u6BD4\u4F8B"
3969
3979
  };
3970
3980
  function onHelpClick(type) {
3971
- Taro.showModal({
3981
+ showModal({
3972
3982
  content: toastMap[type],
3973
3983
  showCancel: false,
3974
3984
  confirmText: "\u77E5\u9053\u4E86"
@@ -4159,7 +4169,7 @@ var script$j = /* @__PURE__ */ defineComponent({
4159
4169
  const props = __props;
4160
4170
  const emit = __emit;
4161
4171
  const areaFormatOptions = computed(() => {
4162
- const { province_list, city_list, county_list } = JSON.parse(Taro.getStorageSync("wechat_area"));
4172
+ const { province_list, city_list, county_list } = JSON.parse(getStorageSync("wechat_area"));
4163
4173
  const map = /* @__PURE__ */ new Map();
4164
4174
  city_list.forEach((item) => {
4165
4175
  const provinceShortId = item.id.slice(0, 2);
@@ -5511,7 +5521,6 @@ var script$c = /* @__PURE__ */ defineComponent({
5511
5521
  const emits = __emit;
5512
5522
  return (_ctx, _cache) => {
5513
5523
  const _component_rich_text = resolveComponent("rich-text");
5514
- const _component_scroll_view = resolveComponent("scroll-view");
5515
5524
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
5516
5525
  createVNode(script$d, {
5517
5526
  bordered: false,
@@ -5522,7 +5531,7 @@ var script$c = /* @__PURE__ */ defineComponent({
5522
5531
  }, null, 8, ["value"]),
5523
5532
  createElementVNode("div", _hoisted_2$7, [
5524
5533
  unref(list).length ? (openBlock(), createElementBlock("div", _hoisted_3$5, [
5525
- createVNode(_component_scroll_view, {
5534
+ createVNode(unref(ScrollView), {
5526
5535
  class: "content",
5527
5536
  "scroll-y": true,
5528
5537
  "refresher-enabled": true,
@@ -5991,7 +6000,7 @@ var script$9 = /* @__PURE__ */ defineComponent({
5991
6000
  }
5992
6001
  const avatarVisible = ref(false);
5993
6002
  async function toUpload() {
5994
- if (!userInfo.value.avatar) {
6003
+ if (!userInfo.value.avatar && Taro.getEnv() !== "WEB") {
5995
6004
  const profile = await Taro.getUserProfile({
5996
6005
  desc: "\u5934\u50CF\u7528\u4E8E\u6539\u53D8\u9ED8\u8BA4\u5934\u50CF"
5997
6006
  });
@@ -6000,7 +6009,7 @@ var script$9 = /* @__PURE__ */ defineComponent({
6000
6009
  });
6001
6010
  updateImage(res.tempFilePath);
6002
6011
  } else {
6003
- let res = await Taro.chooseImage({
6012
+ let res = await chooseImage({
6004
6013
  count: 1
6005
6014
  });
6006
6015
  if (res.tempFilePaths) {
@@ -6015,7 +6024,7 @@ var script$9 = /* @__PURE__ */ defineComponent({
6015
6024
  });
6016
6025
  const appkitOptions = useAppKitOptions();
6017
6026
  const $http = useHttp();
6018
- let Res = await Taro.uploadFile({
6027
+ let Res = await uploadFile({
6019
6028
  url: `${appkitOptions.baseUrl()}/cas/file/uploadImg`,
6020
6029
  filePath,
6021
6030
  name: "file",
@@ -6120,7 +6129,7 @@ var script$9 = /* @__PURE__ */ defineComponent({
6120
6129
  });
6121
6130
  }
6122
6131
  function toLogout() {
6123
- Taro.showModal({
6132
+ showModal({
6124
6133
  title: "\u63D0\u793A",
6125
6134
  content: "\u786E\u5B9A\u8981\u9000\u51FA\u767B\u5F55\u5417\uFF1F",
6126
6135
  confirmText: "\u786E\u5B9A",
@@ -6149,7 +6158,6 @@ var script$9 = /* @__PURE__ */ defineComponent({
6149
6158
  return (_ctx, _cache) => {
6150
6159
  const _component_nut_cell = Cell;
6151
6160
  const _component_nut_button = Button;
6152
- const _component_scroll_view = resolveComponent("scroll-view");
6153
6161
  const _component_nut_input = Input;
6154
6162
  const _component_nut_dialog = Dialog;
6155
6163
  const _component_nut_popup = Popup;
@@ -6157,7 +6165,7 @@ var script$9 = /* @__PURE__ */ defineComponent({
6157
6165
  Fragment,
6158
6166
  null,
6159
6167
  [
6160
- createVNode(_component_scroll_view, {
6168
+ createVNode(unref(ScrollView), {
6161
6169
  "scroll-y": !userState.visible && !avatarVisible.value,
6162
6170
  class: "user-info"
6163
6171
  }, {
@@ -7703,7 +7711,7 @@ var script$5 = /* @__PURE__ */ defineComponent({
7703
7711
  async function onConfirm() {
7704
7712
  const [err, res] = await cropperRef.value.crop();
7705
7713
  if (err) {
7706
- Taro.showModal({
7714
+ showModal({
7707
7715
  title: "\u6E29\u99A8\u63D0\u793A",
7708
7716
  content: err.message,
7709
7717
  confirmColor: "#017fff"
@@ -7824,15 +7832,15 @@ var script$4 = /* @__PURE__ */ defineComponent({
7824
7832
  type: item.fileType,
7825
7833
  status: "uploading"
7826
7834
  });
7827
- await uploadFile(formState.attachment[formState.attachment.length - 1]);
7835
+ await uploadFile$1(formState.attachment[formState.attachment.length - 1]);
7828
7836
  }
7829
7837
  }
7830
7838
  });
7831
7839
  }
7832
- async function uploadFile(item) {
7840
+ async function uploadFile$1(item) {
7833
7841
  const appkitOptions = useAppKitOptions();
7834
7842
  const token = appkitOptions.tempToken() || appkitOptions.token();
7835
- let Res = await Taro.uploadFile({
7843
+ let Res = await uploadFile({
7836
7844
  url: `${appkitOptions.baseUrl()}/saas-base/file/upload`,
7837
7845
  filePath: item.url,
7838
7846
  name: "file",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.2.57",
3
+ "version": "4.2.59",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -45,7 +45,7 @@
45
45
  import { ref, watch } from 'vue'
46
46
  import { endpoints, useHttp } from '../api'
47
47
  import { Promoter } from '../types'
48
- import Taro, { useDidShow } from '@tarojs/taro'
48
+ import Taro, { useDidShow, showModal } from '@tarojs/taro'
49
49
  import { useAmount } from '../../shared/composables/useAmount'
50
50
  import { IconFont } from '@nutui/icons-vue-taro'
51
51
 
@@ -118,7 +118,7 @@ const toastMap = {
118
118
  rebate: '推荐朋友使用北斗星、企明星获取,返佣收益= 返佣基数 * 返佣比例',
119
119
  }
120
120
  function onHelpClick(type: string) {
121
- Taro.showModal({
121
+ showModal({
122
122
  content: toastMap[type],
123
123
  showCancel: false,
124
124
  confirmText: '知道了',
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="second-balance">
3
- <page-header title="权益余额" />
3
+ <page-header :title="Taro.getEnv() !== 'WEB' ? '权益余额' : ''" />
4
4
  <div class="positions" v-if="data.length">
5
5
  <div class="position" v-for="(item, index) in data" :key="index">
6
6
  <div class="icon"></div>
@@ -13,6 +13,7 @@
13
13
  </template>
14
14
 
15
15
  <script lang="ts" setup>
16
+ import Taro from "@tarojs/taro";
16
17
  import { Privilege } from "../types";
17
18
  import EmptyView from "../../shared/components/EmptyView.vue";
18
19
 
@@ -30,8 +31,10 @@ withDefaults(defineProps<SecondBalanceProps>(), {
30
31
  <style lang="scss">
31
32
  .second-balance {
32
33
  width: 100vw;
34
+
33
35
  .positions {
34
36
  padding: 15px;
37
+
35
38
  .position {
36
39
  border-radius: 5px;
37
40
  background: #f7f8fa;
@@ -42,6 +45,7 @@ withDefaults(defineProps<SecondBalanceProps>(), {
42
45
  margin-bottom: 10px;
43
46
  padding: 0 10px;
44
47
  gap: 10px;
48
+
45
49
  .icon {
46
50
  width: 30px;
47
51
  height: 30px;
@@ -53,12 +57,14 @@ withDefaults(defineProps<SecondBalanceProps>(), {
53
57
  flex-basis: 30px;
54
58
  flex-grow: 0;
55
59
  }
60
+
56
61
  .title {
57
62
  flex-grow: 1;
58
63
  color: #353535;
59
64
  font-size: 14px;
60
65
  font-weight: 500;
61
66
  }
67
+
62
68
  .amount {
63
69
  flex-grow: 0;
64
70
  color: #9e7b5a;
@@ -4,7 +4,7 @@
4
4
  <!--* TIP: 微信原生实现多列选择器-->
5
5
  <script setup lang="ts">
6
6
  import { computed, ref, watch } from 'vue'
7
- import Taro from '@tarojs/taro'
7
+ import Taro, {getStorageSync} from '@tarojs/taro'
8
8
  import DdIcon from '../dd-icon/index.vue'
9
9
 
10
10
  interface AreaItem {
@@ -36,7 +36,7 @@ const props = withDefaults(defineProps<PropsType>(), {
36
36
  const emit = defineEmits(['update:value', 'change', 'cancel'])
37
37
 
38
38
  const areaFormatOptions = computed<AreaItem[]>(() => {
39
- const { province_list, city_list, county_list } = JSON.parse(Taro.getStorageSync('wechat_area'))
39
+ const { province_list, city_list, county_list } = JSON.parse(getStorageSync('wechat_area'))
40
40
  const map = new Map()
41
41
  city_list.forEach((item: any) => {
42
42
  const provinceShortId = item.id.slice(0, 2)
@@ -1,41 +1,18 @@
1
1
  <template>
2
2
  <div class="notice-list">
3
- <DdSearch
4
- :bordered="false"
5
- :focus="false"
6
- :value="query.title"
7
- placeholder="请输入关键字搜索"
8
- @search="onSearch"
9
- />
3
+ <DdSearch :bordered="false" :focus="false" :value="query.title" placeholder="请输入关键字搜索" @search="onSearch" />
10
4
 
11
5
  <div style="flex: 1; overflow: hidden">
12
6
  <div class="wrapper" v-if="list.length">
13
- <scroll-view
14
- class="content"
15
- :scroll-y="true"
16
- :refresher-enabled="true"
17
- :refresherTriggered="isRefresh"
18
- @refresherrefresh="onRefresh"
19
- :lower-threshold="100"
20
- @scrolltolower="runNext"
21
- bindscroll=""
22
- >
23
- <div
24
- class="card"
25
- :class="{ active: item.isRead != '1' }"
26
- v-for="(item, index) in list"
27
- :key="index"
28
- @click="notifyRead(item, index)"
29
- >
7
+ <ScrollView class="content" :scroll-y="true" :refresher-enabled="true" :refresherTriggered="isRefresh"
8
+ @refresherrefresh="onRefresh" :lower-threshold="100" @scrolltolower="runNext" bindscroll="">
9
+ <div class="card" :class="{ active: item.isRead != '1' }" v-for="(item, index) in list" :key="index"
10
+ @click="notifyRead(item, index)">
30
11
  <div class="point"></div>
31
12
  <div>
32
13
  <div class="time">{{ formatMinutes(item.receiveTime) }}</div>
33
- <div
34
- v-if="app !== 'loankit' || (app === 'loankit' && item.title !== item.context)"
35
- class="text tit"
36
- style="display: flex; align-items: center"
37
- :class="{ gray: item.isRead == '1' }"
38
- >
14
+ <div v-if="app !== 'loankit' || (app === 'loankit' && item.title !== item.context)" class="text tit"
15
+ style="display: flex; align-items: center" :class="{ gray: item.isRead == '1' }">
39
16
  {{ item.title }}
40
17
  <div class="notice-list-label" v-if="showApp && appMap[item.appCode]">
41
18
  {{ appMap[item.appCode] }}
@@ -43,26 +20,19 @@
43
20
  </div>
44
21
  <div class="text" :class="{ gray: item.isRead == '1' }">
45
22
  <rich-text style="white-space: pre-wrap" :nodes="item.context"></rich-text>
46
- <span
47
- v-if="item.link && item.msgType == 3"
48
- class="notice-list-file"
49
- @click="onNoticeView(item.link)"
50
- >
23
+ <span v-if="item.link && item.msgType == 3" class="notice-list-file" @click="onNoticeView(item.link)">
51
24
  查看附件
52
25
  </span>
53
26
  </div>
54
27
  </div>
55
28
  </div>
56
29
  <div v-if="isLast" class="cue-text" style="padding-bottom: 40px">没有更多了</div>
57
- </scroll-view>
30
+ </ScrollView>
58
31
  </div>
59
32
  <div v-else class="no-data">
60
33
  <div class="no-data-img">
61
- <img
62
- style="width: 100%; height: 100%"
63
- src="https://cdn.ddjf.com/static/images/loan-manage/no-data.png"
64
- alt=""
65
- />
34
+ <img style="width: 100%; height: 100%" src="https://cdn.ddjf.com/static/images/loan-manage/no-data.png"
35
+ alt="" />
66
36
  </div>
67
37
  <div class="text">暂无记录</div>
68
38
  </div>
@@ -79,6 +49,7 @@ import { useNotice } from './useNotice'
79
49
  import { useCommonList } from './useCommonList'
80
50
  import { NoticeListQueryTypes, NoticeListTypes } from '../types'
81
51
  import { useAppKitOptions } from '../../Appkit'
52
+ import { ScrollView } from '@tarojs/components'
82
53
 
83
54
  const props = withDefaults(
84
55
  defineProps<{
@@ -190,20 +161,24 @@ const emits = defineEmits(['view'])
190
161
  overflow: hidden;
191
162
  display: flex;
192
163
  flex-direction: column;
164
+
193
165
  .wrapper {
194
166
  height: 100%;
195
167
  padding: 10px 12px;
196
168
  box-sizing: border-box;
169
+
197
170
  .content {
198
171
  height: 100%;
199
172
  background: #ffffff;
200
173
  border-radius: 10px;
174
+
201
175
  .card {
202
176
  margin: 0 10px;
203
177
  min-height: 64px;
204
178
  background: #fff;
205
179
  position: relative;
206
180
  padding: 10px;
181
+
207
182
  &::before {
208
183
  content: '';
209
184
  position: absolute;
@@ -213,6 +188,7 @@ const emits = defineEmits(['view'])
213
188
  width: 1px;
214
189
  background: #d8d8d8;
215
190
  }
191
+
216
192
  &::after {
217
193
  content: '';
218
194
  position: absolute;
@@ -222,12 +198,15 @@ const emits = defineEmits(['view'])
222
198
  width: 1px;
223
199
  background: #d8d8d8;
224
200
  }
201
+
225
202
  &:first-child::before {
226
203
  display: none;
227
204
  }
205
+
228
206
  &:last-child::after {
229
207
  display: none;
230
208
  }
209
+
231
210
  .point {
232
211
  width: 5px;
233
212
  height: 5px;
@@ -238,6 +217,7 @@ const emits = defineEmits(['view'])
238
217
  top: 18px;
239
218
  z-index: 9;
240
219
  }
220
+
241
221
  .time {
242
222
  font-size: 13px;
243
223
  color: #353535;
@@ -245,26 +225,32 @@ const emits = defineEmits(['view'])
245
225
  opacity: 0.2;
246
226
  margin-bottom: 5px;
247
227
  }
228
+
248
229
  .text {
249
230
  font-size: 14px;
250
231
  line-height: 20px;
251
232
  color: #9fa0a1;
252
233
  }
234
+
253
235
  &.active {
254
236
  .point {
255
237
  background-color: #f43309;
256
238
  }
239
+
257
240
  .text {
258
241
  color: #171a1d;
259
242
  font-size: 13px;
243
+
260
244
  &.tit {
261
245
  font-size: 15px;
262
246
  margin-bottom: 4px;
263
247
  }
264
248
  }
249
+
265
250
  .notice-list-label {
266
251
  opacity: 1;
267
252
  }
253
+
268
254
  .notice-list-file {
269
255
  opacity: 1;
270
256
  }
@@ -272,18 +258,21 @@ const emits = defineEmits(['view'])
272
258
  }
273
259
  }
274
260
  }
261
+
275
262
  .no-data {
276
263
  background-color: #fff;
277
264
  display: flex;
278
265
  align-items: center;
279
266
  flex-direction: column;
280
267
  height: 100%;
268
+
281
269
  .text {
282
270
  height: 20px;
283
271
  font-size: 14px;
284
272
  color: #7e7e7e;
285
273
  line-height: 20px;
286
274
  }
275
+
287
276
  &-img {
288
277
  width: 238px;
289
278
  height: 157px;
@@ -291,17 +280,20 @@ const emits = defineEmits(['view'])
291
280
  margin-bottom: 19px;
292
281
  }
293
282
  }
283
+
294
284
  &-file {
295
285
  font-size: 10px;
296
286
  color: var(--app-primary-color, #017fff);
297
287
  opacity: 0.5;
298
288
  }
289
+
299
290
  .cue-text {
300
291
  font-size: 13px;
301
292
  color: rgba(60, 60, 60, 0.5);
302
293
  padding: 30px 0 calc(30px + env(safe-area-inset-bottom, 0px));
303
294
  text-align: center;
304
295
  }
296
+
305
297
  &-label {
306
298
  border: 1px solid #caa264;
307
299
  color: #caa264;
@@ -26,14 +26,6 @@ const endpointsList: HttpEndpoints = {
26
26
  * http://ytech.dev.ddjf.info/payment/doc.html#/%E5%AE%A2%E6%88%B7%E5%9F%9FAPI/%E6%94%AF%E4%BB%98%E4%B8%AD%E5%BF%83-%E5%AF%B9%E5%A4%96%E6%8E%A5%E5%8F%A3/rechargePayUsingPOST
27
27
  */
28
28
  获取微信支付参数包: {
29
- // {
30
- // "amount": 100,
31
- // "appCode": "crm",
32
- // "caseCode": "aiApproveRecharge",
33
- // "tenantId": "17454646",
34
- // "transFlowNo": "4343244",
35
- // "certificateNo": "o7k8L0QTqcwRIBKVUPzI7iPfghLM"
36
- // }
37
29
  path: '/payment/outer/payment/rechargePay',
38
30
  translate: (params: PaymentParams) => ({
39
31
  amount: params.amount,
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script lang="ts" setup>
8
- import Taro, { showToast, showLoading, hideLoading, uploadFile } from '@tarojs/taro';
8
+ import Taro, { showToast, showLoading, hideLoading, uploadFile, chooseMedia } from '@tarojs/taro';
9
9
  import { NsIcon } from '@uxda/nutshell/taro';
10
10
  import { useAppKitOptions } from '../../Appkit';
11
11
 
@@ -60,7 +60,7 @@ async function onIconClick() {
60
60
  console.log('===onIconClick');
61
61
  let result: OcrResult | null = null;
62
62
  try {
63
- const csRes = await Taro.chooseMedia({
63
+ const csRes = await chooseMedia({
64
64
  count: 1,
65
65
  sourceType: ['album', 'camera']
66
66
  });
@@ -190,9 +190,20 @@ async function chooseImages(item: any) {
190
190
  }
191
191
  }
192
192
 
193
- function onPhotograph() {
193
+ async function onPhotograph() {
194
194
  if (props.disabled) return
195
195
 
196
+ if (Taro.getEnv() === 'WEB') {
197
+ const csRes = await chooseMedia({
198
+ count: 1,
199
+ sourceType: ['album'], // "camera" | "album"
200
+ maxDuration: 60, // 使用duration属性判断是图片还是视频,图片没有该属性
201
+ })
202
+
203
+ onUploadFile(csRes)
204
+ return
205
+ }
206
+
196
207
  activeSheetVisible.value = true
197
208
  }
198
209
  </script>
@@ -1,20 +1,21 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro, { uploadFile } from '@tarojs/taro'
2
2
  import { Media } from '@uxda/nutshell/taro'
3
+ import { useAppKitOptions } from '../../Appkit'
3
4
 
4
5
  export type UploadConfig = {
5
- baseUrl: string,
6
- name?: string,
6
+ baseUrl: string
7
+ name?: string
7
8
  headers?: Record<string, string>
8
9
  }
9
10
 
10
- const mappings: {[x: string]: keyof Media} = {
11
+ const mappings: { [x: string]: keyof Media } = {
11
12
  downloadUrl: 'thrumb',
12
13
  fileId: 'id',
13
14
  fileName: 'name',
14
15
  fileSize: 'size',
15
16
  fileSuffix: 'ext',
16
17
  fileType: 'type',
17
- originalUrl: 'url'
18
+ originalUrl: 'url',
18
19
  }
19
20
 
20
21
  const transformFields = (row: any) => {
@@ -24,14 +25,22 @@ const transformFields = (row: any) => {
24
25
  type UploadFunction = (url: string, file: Media) => Promise<Media>
25
26
 
26
27
  export const useUpload = (config: UploadConfig) => {
28
+ const appkitOptions = useAppKitOptions()
29
+ console.log('===config', config)
30
+
27
31
  const upload: UploadFunction = (url: string, file: Media) => {
28
32
  return new Promise<Media>((resolve, reject) => {
29
- Taro.uploadFile({
33
+ console.log(file, '----file')
34
+ uploadFile({
30
35
  url: config.baseUrl + url,
31
36
  filePath: file.path!,
32
37
  name: 'file',
33
- header: config.headers ?? {
34
- token: Taro.getStorageSync('session')
38
+ formData: {
39
+ objectNo: `min${Date.now()}`,
40
+ },
41
+ header: {
42
+ ...config.headers,
43
+ token: appkitOptions.tempToken() || appkitOptions.token(),
35
44
  },
36
45
  success: (rsp: any) => {
37
46
  const { data } = rsp
@@ -42,7 +51,7 @@ export const useUpload = (config: UploadConfig) => {
42
51
  resolve(transformFields(response.result))
43
52
  } catch (e) {
44
53
  reject({
45
- message: '文件上传异常'
54
+ message: '文件上传异常',
46
55
  })
47
56
  }
48
57
  },
@@ -50,6 +59,6 @@ export const useUpload = (config: UploadConfig) => {
50
59
  })
51
60
  }
52
61
  return {
53
- upload
62
+ upload,
54
63
  }
55
- }
64
+ }
@@ -38,7 +38,7 @@
38
38
  </template>
39
39
 
40
40
  <script lang="ts" setup>
41
- import Taro, { showToast, showLoading, chooseMedia } from '@tarojs/taro'
41
+ import Taro, { showToast, showLoading, chooseMedia, uploadFile as TaroUploadFile } from '@tarojs/taro'
42
42
  import { onMounted, reactive, ref } from 'vue'
43
43
  import { useAppKitOptions } from '../../Appkit'
44
44
  import { useHttp } from '../api'
@@ -139,7 +139,7 @@ async function uploadFile(item: any) {
139
139
  const appkitOptions = useAppKitOptions()
140
140
  const token = appkitOptions.tempToken() || appkitOptions.token()
141
141
 
142
- let Res: any = await Taro.uploadFile({
142
+ let Res: any = await TaroUploadFile({
143
143
  url: `${appkitOptions.baseUrl()}/saas-base/file/upload`,
144
144
  filePath: item.url,
145
145
  name: 'file',
@@ -10,7 +10,7 @@
10
10
  </template>
11
11
 
12
12
  <script lang="ts" setup>
13
- import Taro, { useRouter } from '@tarojs/taro'
13
+ import Taro, { useRouter, showModal } from '@tarojs/taro'
14
14
  import { ref } from 'vue'
15
15
  import btCropper from '../../components/bt-cropper/index.vue'
16
16
 
@@ -28,7 +28,7 @@ function onCancel() {
28
28
  async function onConfirm() {
29
29
  const [err, res] = await cropperRef.value.crop()
30
30
  if (err) {
31
- Taro.showModal({
31
+ showModal({
32
32
  title: '温馨提示',
33
33
  content: err.message,
34
34
  confirmColor: '#017fff',
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <scroll-view :scroll-y="!userState.visible && !avatarVisible" class="user-info">
2
+ <ScrollView :scroll-y="!userState.visible && !avatarVisible" class="user-info">
3
3
  <DdSkeleton v-if="firstLoading" :row="3"></DdSkeleton>
4
4
  <div v-else class="user-info-wrap">
5
5
  <div class="user-info-tit">账号信息</div>
@@ -78,7 +78,7 @@
78
78
  type="primary">退出登录</nut-button>
79
79
  </div>
80
80
  </div>
81
- </scroll-view>
81
+ </ScrollView>
82
82
 
83
83
  <!-- 修改用户名弹框 -->
84
84
  <nut-dialog title="输入新的用户名" :border="false" pop-class="change-username-popup" v-model:visible="userState.visible"
@@ -128,12 +128,13 @@
128
128
  </template>
129
129
 
130
130
  <script lang="ts" setup>
131
- import Taro, { useDidShow, showToast, showLoading, hideLoading } from "@tarojs/taro";
131
+ import Taro, { useDidShow, showToast, showLoading, hideLoading, uploadFile, showModal, chooseImage } from "@tarojs/taro";
132
132
  import { ref, onMounted, reactive, onUnmounted } from "vue";
133
133
  import { useAppKitOptions } from "../../Appkit";
134
134
  import { useEncode } from "../../shared/composables/useEncode";
135
135
  import DdSkeleton from "../../components/dd-skeleton/index.vue";
136
136
  import { useHttp } from "../api";
137
+ import { ScrollView } from '@tarojs/components'
137
138
 
138
139
  const props = withDefaults(
139
140
  defineProps<{
@@ -186,7 +187,7 @@ const avatarVisible = ref(false);
186
187
 
187
188
  // 去上传头像
188
189
  async function toUpload() {
189
- if (!userInfo.value.avatar) {
190
+ if (!userInfo.value.avatar && Taro.getEnv() !== "WEB") {
190
191
  const profile = await Taro.getUserProfile({
191
192
  desc: "头像用于改变默认头像",
192
193
  });
@@ -197,7 +198,7 @@ async function toUpload() {
197
198
 
198
199
  updateImage(res.tempFilePath);
199
200
  } else {
200
- let res = await Taro.chooseImage({
201
+ let res = await chooseImage({
201
202
  count: 1,
202
203
  });
203
204
  if (res.tempFilePaths) {
@@ -216,7 +217,7 @@ async function updateImage(filePath: string) {
216
217
  const appkitOptions = useAppKitOptions();
217
218
  const $http = useHttp();
218
219
 
219
- let Res: any = await Taro.uploadFile({
220
+ let Res: any = await uploadFile({
220
221
  url: `${appkitOptions.baseUrl()}/cas/file/uploadImg`,
221
222
  filePath: filePath,
222
223
  name: "file",
@@ -347,7 +348,7 @@ function onNickNameOk() {
347
348
  }
348
349
  // 退出登录
349
350
  function toLogout() {
350
- Taro.showModal({
351
+ showModal({
351
352
  title: "提示",
352
353
  content: "确定要退出登录吗?",
353
354
  confirmText: "确定",