Browse Source

解决sonar扫描的异味

devlop
邓雄飞 4 years ago
parent
commit
b2a726f757
17 changed files with 170 additions and 236 deletions
  1. 6
      common/js/publicFn.js
  2. 11
      components/qn-data-picker/keypress.js
  3. 18
      components/qn-data-picker/qn-data-picker.vue
  4. 253
      components/qn-data-pickerview/qn-data-picker.js
  5. 21
      components/qn-easyinput/qn-easyinput.vue
  6. 9
      components/scroll-list/scroll-list.vue
  7. 4
      components/uni-steps/uni-steps.vue
  8. 2
      pages/account-management/index.vue
  9. 6
      pages/enquiry-list/index.vue
  10. 48
      pages/enterprise-info-edit/index.vue
  11. 10
      pages/enterprise-info/index.vue
  12. 4
      pages/login/index.vue
  13. 2
      pages/mine/index.vue
  14. 2
      pages/test/index.vue
  15. 6
      pages/vip-center/index.vue
  16. 2
      store/index.js
  17. 2
      utils/http/index.js

6
common/js/publicFn.js

@ -26,8 +26,8 @@ const dateTimeFormat = (date, fmt) => {
return fmt return fmt
} }
const pubFn = {
dateTimeFormat
const publicFn = {
dateTimeFormat
} }
export default pubFn
export default publicFn

11
components/qn-data-picker/keypress.js

@ -7,7 +7,7 @@ export default {
default: false default: false
} }
}, },
mounted () {
mounted() {
const keyNames = { const keyNames = {
esc: ['Esc', 'Escape'], esc: ['Esc', 'Escape'],
tab: 'Tab', tab: 'Tab',
@ -23,10 +23,10 @@ export default {
if (this.disable) { if (this.disable) {
return return
} }
const keyName = Object.keys(keyNames).find(key => {
const keyName = $event.key
const keyName = Object.keys(keyNames).find((key) => {
const name = $event.key
const value = keyNames[key] const value = keyNames[key]
return value === keyName || (Array.isArray(value) && value.includes(keyName))
return value === name || (Array.isArray(value) && value.includes(name))
}) })
if (keyName) { if (keyName) {
// 避免和其他按键事件冲突 // 避免和其他按键事件冲突
@ -39,7 +39,6 @@ export default {
this.$once('hook:beforeDestroy', () => { this.$once('hook:beforeDestroy', () => {
document.removeEventListener('keyup', listener) document.removeEventListener('keyup', listener)
}) })
},
render: () => {}
}
} }
// #endif // #endif

18
components/qn-data-picker/qn-data-picker.vue

@ -239,7 +239,7 @@ export default {
this._dispatchEvent(e) this._dispatchEvent(e)
}, },
_processReadonly(dataList, value) { _processReadonly(dataList, value) {
var isTree = dataList.findIndex((item) => {
let isTree = dataList.findIndex((item) => {
return item.children return item.children
}) })
if (isTree > -1) { if (isTree > -1) {
@ -262,9 +262,8 @@ export default {
} }
let result = [] let result = []
for (let i = 0; i < value.length; i++) {
var val = value[i]
var item = dataList.find((v) => {
for (let val of value) {
let item = dataList.find((v) => {
return v.value == val return v.value == val
}) })
if (item) { if (item) {
@ -276,10 +275,9 @@ export default {
} }
}, },
_filterForArray(data, valueArray) { _filterForArray(data, valueArray) {
var result = []
for (let i = 0; i < valueArray.length; i++) {
var value = valueArray[i]
var found = data.find((item) => {
let result = []
for (let value of valueArray) {
let found = data.find((item) => {
return item.value == value return item.value == value
}) })
if (found) { if (found) {
@ -291,10 +289,6 @@ export default {
_dispatchEvent(selected) { _dispatchEvent(selected) {
let item = {} let item = {}
if (selected.length) { if (selected.length) {
var value = new Array(selected.length)
for (var i = 0; i < selected.length; i++) {
value[i] = selected[i].value
}
item = selected[selected.length - 1] item = selected[selected.length - 1]
} else { } else {
item.value = '' item.value = ''

253
components/qn-data-pickerview/qn-data-picker.js

@ -2,13 +2,13 @@ export default {
props: { props: {
localdata: { localdata: {
type: [Array, Object], type: [Array, Object],
default () {
default() {
return [] return []
} }
}, },
spaceInfo: { spaceInfo: {
type: Object, type: Object,
default () {
default() {
return {} return {}
} }
}, },
@ -62,13 +62,13 @@ export default {
}, },
value: { value: {
type: [Array, String, Number], type: [Array, String, Number],
default () {
default() {
return [] return []
} }
}, },
modelValue: { modelValue: {
type: [Array, String, Number], type: [Array, String, Number],
default () {
default() {
return [] return []
} }
}, },
@ -96,8 +96,8 @@ export default {
type: Object, type: Object,
default() { default() {
return { return {
text: "text",
value: "value"
text: 'text',
value: 'value'
} }
} }
} }
@ -126,59 +126,62 @@ export default {
return !this.collection.length return !this.collection.length
}, },
postField() { postField() {
let fields = [this.field];
let fields = [this.field]
if (this.parentField) { if (this.parentField) {
fields.push(`${this.parentField} as parent_value`);
fields.push(`${this.parentField} as parent_value`)
} }
return fields.join(',');
return fields.join(',')
}, },
dataValue() { dataValue() {
let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null || this.modelValue !== undefined)
let isModelValue = Array.isArray(this.modelValue) ? this.modelValue.length > 0 : this.modelValue !== null || this.modelValue !== undefined
return isModelValue ? this.modelValue : this.value return isModelValue ? this.modelValue : this.value
}, },
hasValue() { hasValue() {
if (typeof this.dataValue === 'number') { if (typeof this.dataValue === 'number') {
return true return true
} }
return (this.dataValue != null) && (this.dataValue.length > 0)
return this.dataValue != null && this.dataValue.length > 0
} }
}, },
created() { created() {
this.$watch(() => {
var al = [];
['pageCurrent',
'pageSize',
'spaceInfo',
'value',
'modelValue',
'localdata',
'collection',
'action',
'field',
'orderby',
'where',
'getont',
'getcount',
'gettree'
].forEach(key => {
al.push(this[key])
});
return al
}, (newValue, oldValue) => {
let needReset = false
for (let i = 2; i < newValue.length; i++) {
if (newValue[i] != oldValue[i]) {
needReset = true
break
this.$watch(
() => {
let al = []
;[
'pageCurrent',
'pageSize',
'spaceInfo',
'value',
'modelValue',
'localdata',
'collection',
'action',
'field',
'orderby',
'where',
'getont',
'getcount',
'gettree'
].forEach((key) => {
al.push(this[key])
})
return al
},
(newValue, oldValue) => {
for (let i = 2; i < newValue.length; i++) {
if (newValue[i] != oldValue[i]) {
needReset = true
break
}
} }
}
if (newValue[0] != oldValue[0]) {
this.page.current = this.pageCurrent
}
this.page.size = this.pageSize
if (newValue[0] != oldValue[0]) {
this.page.current = this.pageCurrent
}
this.page.size = this.pageSize
this.onPropsChange()
})
this.onPropsChange()
}
)
this._treeData = [] this._treeData = []
}, },
methods: { methods: {
@ -225,27 +228,32 @@ export default {
getOptions.getTreePath = options.getTreePath getOptions.getTreePath = options.getTreePath
} }
db = db.skip(size * (current - 1)).limit(size).get(getOptions)
db = db
.skip(size * (current - 1))
.limit(size)
.get(getOptions)
return db return db
}, },
getNodeData(callback) {
if (this.loading) {
return
}
this.loading = true
this.getCommand({
field: this.postField,
where: this._pathWhere()
}).then((res) => {
this.loading = false
this.selected = res.result.data
callback && callback()
}).catch((err) => {
this.loading = false
this.errorMessage = err
})
},
getNodeData(callback) {
if (this.loading) {
return
}
this.loading = true
this.getCommand({
field: this.postField,
where: this._pathWhere()
})
.then((res) => {
this.loading = false
this.selected = res.result.data
callback && callback()
})
.catch((err) => {
this.loading = false
this.errorMessage = err
})
},
getTreePath(callback) { getTreePath(callback) {
if (this.loading) { if (this.loading) {
return return
@ -257,16 +265,18 @@ export default {
getTreePath: { getTreePath: {
startWith: `${this.selfField}=='${this.dataValue}'` startWith: `${this.selfField}=='${this.dataValue}'`
} }
}).then((res) => {
this.loading = false
let treePath = []
this._extractTreePath(res.result.data, treePath)
this.selected = treePath
callback && callback()
}).catch((err) => {
this.loading = false
this.errorMessage = err
}) })
.then((res) => {
this.loading = false
let treePath = []
this._extractTreePath(res.result.data, treePath)
this.selected = treePath
callback && callback()
})
.catch((err) => {
this.loading = false
this.errorMessage = err
})
}, },
loadData() { loadData() {
if (this.isLocaldata) { if (this.isLocaldata) {
@ -306,14 +316,16 @@ export default {
field: this.postField, field: this.postField,
gettree: true, gettree: true,
startwith: `${this.selfField}=='${this.dataValue}'` startwith: `${this.selfField}=='${this.dataValue}'`
}).then((res) => {
this.loading = false
callback(res.result.data)
this.onDataChange()
}).catch((err) => {
this.loading = false
this.errorMessage = err
}) })
.then((res) => {
this.loading = false
callback(res.result.data)
this.onDataChange()
})
.catch((err) => {
this.loading = false
this.errorMessage = err
})
}, },
_loadNodeData(callback, pw) { _loadNodeData(callback, pw) {
if (this.loading) { if (this.loading) {
@ -325,18 +337,20 @@ export default {
field: this.postField, field: this.postField,
where: pw || this._postWhere(), where: pw || this._postWhere(),
pageSize: 500 pageSize: 500
}).then((res) => {
this.loading = false
callback(res.result.data)
this.onDataChange()
}).catch((err) => {
this.loading = false
this.errorMessage = err
}) })
.then((res) => {
this.loading = false
callback(res.result.data)
this.onDataChange()
})
.catch((err) => {
this.loading = false
this.errorMessage = err
})
}, },
_pathWhere() { _pathWhere() {
let result = [] let result = []
let where_field = this._getParentNameByField();
let where_field = this._getParentNameByField()
if (where_field) { if (where_field) {
result.push(`${where_field} == '${this.dataValue}'`) result.push(`${where_field} == '${this.dataValue}'`)
} }
@ -355,7 +369,7 @@ export default {
result.push(`${parentField} == null || ${parentField} == ""`) result.push(`${parentField} == null || ${parentField} == ""`)
} }
if (selected.length) { if (selected.length) {
for (var i = 0; i < selected.length - 1; i++) {
for (let i = 0; i < selected.length - 1; i++) {
result.push(`${parentField} == '${selected[i].value}'`) result.push(`${parentField} == '${selected[i].value}'`)
} }
} }
@ -384,33 +398,32 @@ export default {
return result.join(' || ') return result.join(' || ')
}, },
_getParentNameByField() { _getParentNameByField() {
const fields = this.field.split(',');
let where_field = null;
for (let i = 0; i < fields.length; i++) {
const items = fields[i].split('as');
const fields = this.field.split(',')
let where_field = null
for (let target of fields) {
const items = target.split('as')
if (items.length < 2) { if (items.length < 2) {
continue;
continue
} }
if (items[1].trim() === 'value') { if (items[1].trim() === 'value') {
where_field = items[0].trim();
break;
where_field = items[0].trim()
break
} }
} }
return where_field return where_field
}, },
_isTreeView() { _isTreeView() {
return (this.parentField && this.selfField)
return this.parentField && this.selfField
}, },
_updateSelected() { _updateSelected() {
var dl = this.dataList
var sl = this.selected
let dl = this.dataList
let sl = this.selected
let textField = this.map.text let textField = this.map.text
let valueField = this.map.value let valueField = this.map.value
for (var i = 0; i < sl.length; i++) {
var value = sl[i].value
var dl2 = dl[i]
for (var j = 0; j < dl2.length; j++) {
var item2 = dl2[j]
for (let i = 0; i < sl.length; i++) {
let value = sl[i].value
let dl2 = dl[i]
for (let item2 of dl2) {
if (item2[valueField] === value) { if (item2[valueField] === value) {
sl[i].text = item2[textField] sl[i].text = item2[textField]
break break
@ -419,10 +432,7 @@ export default {
} }
}, },
_updateBindData(node) { _updateBindData(node) {
const {
dataList,
hasNodes
} = this._filterData(this._treeData, this.selected)
const { dataList, hasNodes } = this._filterData(this._treeData, this.selected)
let isleaf = this._stepSearh === false && !hasNodes let isleaf = this._stepSearh === false && !hasNodes
@ -436,7 +446,7 @@ export default {
if (!isleaf && this.selected.length < dataList.length) { if (!isleaf && this.selected.length < dataList.length) {
this.selected.push({ this.selected.push({
value: null, value: null,
text: "请选择"
text: '请选择'
}) })
} }
@ -449,12 +459,14 @@ export default {
let dataList = [] let dataList = []
let hasNodes = true let hasNodes = true
dataList.push(data.filter((item) => {
return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '')
}))
for (let i = 0; i < paths.length; i++) {
var value = paths[i].value
var nodes = data.filter((item) => {
dataList.push(
data.filter((item) => {
return item.parent_value === null || item.parent_value === undefined || item.parent_value === ''
})
)
for (let path of paths) {
let value = path.value
let nodes = data.filter((item) => {
return item.parent_value === value return item.parent_value === value
}) })
@ -471,11 +483,8 @@ export default {
} }
}, },
_extractTree(nodes, result, parent_value) { _extractTree(nodes, result, parent_value) {
let list = result || []
let valueField = this.map.value let valueField = this.map.value
for (let i = 0; i < nodes.length; i++) {
let node = nodes[i]
for (let node of nodes) {
let child = {} let child = {}
for (let key in node) { for (let key in node) {
if (key !== 'children') { if (key !== 'children') {
@ -494,10 +503,7 @@ export default {
} }
}, },
_extractTreePath(nodes, result) { _extractTreePath(nodes, result) {
let list = result || []
for (let i = 0; i < nodes.length; i++) {
let node = nodes[i]
for (let node of nodes) {
let child = {} let child = {}
for (let key in node) { for (let key in node) {
if (key !== 'children') { if (key !== 'children') {
@ -515,8 +521,7 @@ export default {
_findNodePath(key, nodes, path = []) { _findNodePath(key, nodes, path = []) {
let textField = this.map.text let textField = this.map.text
let valueField = this.map.value let valueField = this.map.value
for (let i = 0; i < nodes.length; i++) {
let node = nodes[i]
for (let node of nodes) {
let children = node.children let children = node.children
let text = node[textField] let text = node[textField]
let value = node[valueField] let value = node[valueField]
@ -545,7 +550,7 @@ export default {
this._treeData = [] this._treeData = []
this._extractTree(this.localdata, this._treeData) this._extractTree(this.localdata, this._treeData)
var inputValue = this.dataValue
let inputValue = this.dataValue
if (inputValue === undefined) { if (inputValue === undefined) {
return return
} }

21
components/qn-easyinput/qn-easyinput.vue

@ -82,10 +82,6 @@
</template> </template>
<script> <script>
// import {
// debounce,
// throttle
// } from './common.js'
/** /**
* Easyinput 输入框 * Easyinput 输入框
* @description 此组件可以实现表单的输入与校验包括 "text" "textarea" 类型 * @description 此组件可以实现表单的输入与校验包括 "text" "textarea" 类型
@ -284,10 +280,6 @@ export default {
}) })
}, },
methods: { methods: {
/**
* 初始化变量值
*/
init() {},
onClickIcon(type) { onClickIcon(type) {
this.$emit('iconClick', type) this.$emit('iconClick', type)
}, },
@ -321,9 +313,9 @@ export default {
} }
if (this.errMsg) this.errMsg = '' if (this.errMsg) this.errMsg = ''
this.val = value this.val = value
// TODO vue2
// vue2
this.$emit('input', value) this.$emit('input', value)
// TODO  vue3
//  vue3
this.$emit('update:modelValue', value) this.$emit('update:modelValue', value)
}, },
@ -331,18 +323,17 @@ export default {
this.$emit('focus', event) this.$emit('focus', event)
}, },
onBlur(event) { onBlur(event) {
let value = event.detail.value
this.$emit('blur', event) this.$emit('blur', event)
}, },
onConfirm(e) { onConfirm(e) {
this.$emit('confirm', e.detail.value) this.$emit('confirm', e.detail.value)
}, },
onClear(event) {
onClear() {
this.val = '' this.val = ''
// TODO vue2
// vue2
this.$emit('input', '') this.$emit('input', '')
// TODO vue2
// TODO  vue3
// vue2
//  vue3
this.$emit('update:modelValue', '') this.$emit('update:modelValue', '')
}, },
fieldClick() { fieldClick() {

9
components/scroll-list/scroll-list.vue

@ -486,9 +486,9 @@ export default {
}, },
computed: { computed: {
scrollListWrapStyle() { scrollListWrapStyle() {
let style = {}
style.background = this.defaultOption.background
return style
return {
background: this.defaultOption.background
}
}, },
// //
listWrapStyle() { listWrapStyle() {
@ -615,9 +615,6 @@ export default {
} }
} }
} }
.list-content {
}
.pull-up-wrap { .pull-up-wrap {
display: flex; display: flex;
align-items: center; align-items: center;

4
components/uni-steps/uni-steps.vue

@ -50,12 +50,8 @@
</template> </template>
<script> <script>
// import uniIcons from '../uni-icons/uni-icons.vue'
export default { export default {
name: 'UniSteps', name: 'UniSteps',
// components: {
// uniIcons
// },
props: { props: {
direction: { direction: {
// row column // row column

2
pages/account-management/index.vue

@ -74,7 +74,7 @@ export default {
this.deleteId = item.id this.deleteId = item.id
}, },
confirm() { confirm() {
var params = {
let params = {
id: this.deleteId, id: this.deleteId,
enterpriseId: this.$store.state.companyInfo.id enterpriseId: this.$store.state.companyInfo.id
} }

6
pages/enquiry-list/index.vue

@ -164,10 +164,10 @@ export default {
}, },
// //
placeOrderTap(item, replyItemList) { placeOrderTap(item, replyItemList) {
let supplierOtherFee = replyItemList.map((item) => {
let supplierOtherFee = replyItemList.map((replyItem) => {
return { return {
mallSupplierId: item.mallSupplierId,
otherFee: item.otherFee
mallSupplierId: replyItem.mallSupplierId,
otherFee: replyItem.otherFee
} }
}) })

48
pages/enterprise-info-edit/index.vue

@ -127,18 +127,6 @@
<qn-datetime-picker v-model="form.foundDate" type="date" :border="false"></qn-datetime-picker> <qn-datetime-picker v-model="form.foundDate" type="date" :border="false"></qn-datetime-picker>
</qn-form-item> </qn-form-item>
</view> </view>
<!-- <uni-popup ref="popup" type="bottom">
<view class="popup_modal">
<slot name="title">
<view class="popup_modal-title">可选择已录入公司</view>
</slot>
<scroll-view scroll-y="true" class="popup_modal-scroll">
<view @click="selectCompany(item.enterpriseId)" class="popup_modal-scroll-item" v-for="item in searchList" :key="item.enterpriseId">
{{ item.enterpriseName }}
</view>
</scroll-view>
</view>
</uni-popup> -->
<uni-popup ref="locationPopup" type="bottom"> <uni-popup ref="locationPopup" type="bottom">
<view class="popup_modal"> <view class="popup_modal">
<slot name="title"> <slot name="title">
@ -279,34 +267,6 @@ export default {
this.form.regAddrLatitude = location.latitude this.form.regAddrLatitude = location.latitude
this.$refs.locationPopup.close() this.$refs.locationPopup.close()
}, },
// showCompany(e) {
// let enterpriseName = e.detail.value.trim()
// if (enterpriseName) {
// getCompanyList({ enterpriseName }).then((res) => {
// if (res) {
// this.searchList = res.records
// if (this.searchList.length > 0) {
// this.$refs.popup.open('bottom')
// }
// }
// })
// }
// },
// selectCompany(enterpriseId) {
// this.$refs.popup.close()
// getCompanyInfoById({ enterpriseId }).then((res) => {
// if (res) {
// this.form.id = enterpriseId
// this.form.name = res.name
// // watchname
// setTimeout(() => {
// //
// this.reflectiveCompany(res)
// }, 0)
// }
// })
// },
reflectiveCompany(info) {},
onAreaChange(e) { onAreaChange(e) {
if (e.detail.value && e.detail.value.length > 0) { if (e.detail.value && e.detail.value.length > 0) {
const [province, city, district, street] = e.detail.value const [province, city, district, street] = e.detail.value
@ -357,7 +317,7 @@ export default {
this.form.uniformSocialCreditCode = res.regNum this.form.uniformSocialCreditCode = res.regNum
this.form.name = res.company this.form.name = res.company
this.form.legalPersonName = res.legalPerson this.form.legalPersonName = res.legalPerson
const foundDateArr = res.establishDate.split(/年||日/)
const foundDateArr = res.establishDate.split(/[年月日]/)
this.form.foundDate = foundDateArr[0] + '-' + foundDateArr[1] + '-' + foundDateArr[2] this.form.foundDate = foundDateArr[0] + '-' + foundDateArr[1] + '-' + foundDateArr[2]
this.form.registeredCapital = /\d+/.exec(res.capital)[0] this.form.registeredCapital = /\d+/.exec(res.capital)[0]
} }
@ -378,10 +338,10 @@ export default {
}, },
saveInfo() { saveInfo() {
if (!this.form.id) { if (!this.form.id) {
for (let i = 0; i < validateFields.length; i++) {
if (this.form[validateFields[i].field] === null || this.form[validateFields[i].field] === '') {
for (let validateField of validateFields) {
if (this.form[validateField.field] === null || this.form[validateField.field] === '') {
uni.showToast({ uni.showToast({
title: `${validateFields[i].label}不能为空`,
title: `${validateField.label}不能为空`,
icon: 'none' icon: 'none'
}) })
return return

10
pages/enterprise-info/index.vue

@ -389,7 +389,7 @@ export default {
this.form.uniformSocialCreditCode = res.regNum this.form.uniformSocialCreditCode = res.regNum
this.form.name = res.company this.form.name = res.company
this.form.legalPersonName = res.legalPerson this.form.legalPersonName = res.legalPerson
const foundDateArr = res.establishDate.split(/年||日/)
const foundDateArr = res.establishDate.split(/[年月日]/)
this.form.foundDate = foundDateArr[0] + '-' + foundDateArr[1] + '-' + foundDateArr[2] this.form.foundDate = foundDateArr[0] + '-' + foundDateArr[1] + '-' + foundDateArr[2]
this.form.registeredCapital = /\d+/.exec(res.capital)[0] this.form.registeredCapital = /\d+/.exec(res.capital)[0]
} }
@ -411,10 +411,10 @@ export default {
}, },
saveInfo() { saveInfo() {
if (!this.form.id) { if (!this.form.id) {
for (let i = 0; i < validateFields.length; i++) {
if (this.form[validateFields[i].field] === null || this.form[validateFields[i].field] === '') {
for (let validateField of validateFields) {
if (this.form[validateField.field] === null || this.form[validateField.field] === '') {
uni.showToast({ uni.showToast({
title: `${validateFields[i].label}不能为空`,
title: `${validateField.label}不能为空`,
icon: 'none' icon: 'none'
}) })
return return
@ -449,7 +449,7 @@ export default {
} }
}, },
watch: { watch: {
['form.name'](val) {
['form.name']() {
this.hasSelected = false this.hasSelected = false
this.form.id = null this.form.id = null
this.reflectiveCompany({}) this.reflectiveCompany({})

4
pages/login/index.vue

@ -35,10 +35,6 @@
<text class="agreement_text" @click="jumpAgreement">用户与隐私协议</text> <text class="agreement_text" @click="jumpAgreement">用户与隐私协议</text>
</view> </view>
</view> </view>
<!--
<uni-easyinput v-model="captcha" placeholder="验证码" />
<button @click="getCode">获取验证码</button>
<button @click="login">登录</button> -->
</view> </view>
</template> </template>

2
pages/mine/index.vue

@ -134,7 +134,6 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <view @click="loginGo2('enterprise-info')">enterprise-info</view> -->
</view> </view>
</template> </template>
@ -166,7 +165,6 @@ export default {
if (this.hasCompany) { if (this.hasCompany) {
let redirectUrl = encodeURIComponent(VIP_URL) let redirectUrl = encodeURIComponent(VIP_URL)
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${QN_APPID}&redirect_uri=${redirectUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect` window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${QN_APPID}&redirect_uri=${redirectUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
// loginGo2('vip-center')
} else { } else {
uni.showToast({ uni.showToast({
title: '请先完善企业信息', title: '请先完善企业信息',

2
pages/test/index.vue

@ -51,5 +51,3 @@ export default {
} }
} }
</script> </script>
<style lang="scss" scoped></style>

6
pages/vip-center/index.vue

@ -78,9 +78,9 @@ export default {
] ]
Promise.all(promises).then((res) => { Promise.all(promises).then((res) => {
if (res[0] && res[1]) { if (res[0] && res[1]) {
openVipPay({ channelId: res[0].channelId, tradeOrderId: res[0].orderId, userOpenId: res[1].openId }).then((res) => {
if (res) {
this.wxPay(res)
openVipPay({ channelId: res[0].channelId, tradeOrderId: res[0].orderId, userOpenId: res[1].openId }).then((info) => {
if (info) {
this.wxPay(info)
} }
}) })
} }

2
store/index.js

@ -27,7 +27,7 @@ let qnToken = null,
/** /**
* @value id 当前被分享的供应商账号id * @value id 当前被分享的供应商账号id
*/ */
userId = null,
userId = null
const companyInfoParams = [ const companyInfoParams = [
'id', 'id',
'name', 'name',

2
utils/http/index.js

@ -34,7 +34,7 @@ const config = {
// 请求拦截 // 请求拦截
const reqInterceptor = (config, options) => { const reqInterceptor = (config, options) => {
const { url = '' } = config
const { url } = config
// 添加token // 添加token
let token = '' let token = ''
try { try {

Loading…
Cancel
Save